Refine render junctions guidance
Agent CI/CD / docker-image (push) Successful in 11s
Agent CI/CD / deploy-fallback-log (push) Has been skipped

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-05-20 17:43:40 +08:00
parent 725935e270
commit f24e8109a0
3 changed files with 12 additions and 29 deletions
-7
View File
@@ -1,7 +1,5 @@
import { tool } from "@opencode-ai/plugin";
const persistentRenderRefPattern = /^res-[a-z0-9-]+$/i;
export default tool({
description:
"在前端地图上对 junctions 图层应用分区渲染。优先直接传入 render_ref(指向已持久化的渲染结果引用,格式应为 res-...),不要传 /tmp/*.json 之类的临时文件路径,也不要先把 ref 内容完整读出再重组;前端会自行根据 render_ref 拉取完整 payload 并渲染,这样可以避免 LLM 读取大型 node_area_map。若必须自行构造供 render_ref 引用的 JSON,其 data 结构必须为 { node_area_map: Record<string, string>, area_ids?: string[], area_colors?: Record<string, string> },其中 node_area_map 的 key 是 junction/node idvalue 是 area id。",
@@ -11,11 +9,6 @@ export default tool({
.describe("Why this junction rendering action is needed for the user request."),
render_ref: tool.schema
.string()
.trim()
.regex(
persistentRenderRefPattern,
"render_ref 必须是持久化结果引用(例如 res-1234abcd),不能是 /tmp/*.json 文件路径",
)
.describe(
"渲染引用 ID。必须是持久化结果引用(res-...),不要传 /tmp/*.json 或其他本地路径。前端会按该引用读取完整 payload.data 并渲染,不需要先用 fetch_result_ref 提取完整数据。render_ref 对应的数据结构必须是 { node_area_map: { [junctionId]: areaId }, area_ids?: string[], area_colors?: { [areaId]: color } }node_area_map 必填,area_ids / area_colors 可选。",
),