@dream-craft/canvas-agent 0.6.5 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-instructions.md +2 -1
- package/dist/canvas/schemas.js +8 -2
- package/package.json +1 -1
package/agent-instructions.md
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
- 只有用户明确要求使用“Codex 内置生图”“ImageGen 技能”或意思明确相同的能力时,才使用 Codex 自带的 `imagegen`;不要因为用户只说“生成图片”就自行改用内置生图。内置生图完成后,其结果会由 Canvas Agent 自动展示到对话并插入当前画布,无需再创建空节点或重复生成。
|
|
13
13
|
- 只有用户明确说要在生图/视频工作台生成时,才使用 `workbench_image_*`、`workbench_video_*`。生成任务提交后应说明已经在画布或工作台开始生成,不要在实际没有结果时声称“已生成”。
|
|
14
14
|
- 需要生成内容时直接调用对应生成工具,不要绑定特定业务场景,不要模拟鼠标点击,不要要求用户手动复制 JSON。
|
|
15
|
-
- 需要获取、保存或核对生成结果图片时,使用画布节点元数据里的资源地址(`canvas_get_state` 读取)或工具返回的文件路径;不要用浏览器自动化(js/browser 工具)从页面 DOM 抓取或下载图片,也不要在网页 DOM 里查找画布内容。
|
|
15
|
+
- 需要获取、保存或核对生成结果图片时,使用画布节点元数据里的资源地址(`canvas_get_state` 读取)或工具返回的文件路径;不要用浏览器自动化(js/browser 工具)从页面 DOM 抓取或下载图片,也不要在网页 DOM 里查找画布内容。
|
|
16
|
+
- 画布工具返回 `unsupported call: <工具名>` 时,含义是**该工具名未在本会话被 Codex 动态工具发现激活**,不是画布未连接、也不是工具不存在——同会话其他画布工具能调用成功即是佐证。对策:先用工具搜索(tool_search)搜该工具名或其功能描述(如 `canvas_get_state`、"read canvas nodes state")把工具激活,再调用;换一次搜索词仍激活失败才向用户报告缺口。禁止把 `unsupported call` 当成「画布未连接」向用户陈述或写进问卷 contextText。开始操作画布前,若 `canvas_get_state` 尚未验证可用(首次调用即报 unsupported call),先激活再继续,不要跳过画布状态读取直接凭记忆操作。
|
|
16
17
|
|
|
17
18
|
## Windows shell 与工具缺失行为
|
|
18
19
|
|
package/dist/canvas/schemas.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// 部分模型调用 MCP 工具时会把数组/对象参数整体序列化成 JSON 字符串传入(实测 Codex 传 canvas_apply_ops 的 ops),
|
|
3
|
-
// 这里做宽容解析:收到字符串先尝试 JSON.parse
|
|
3
|
+
// 这里做宽容解析:收到字符串先尝试 JSON.parse 还原;失败时剥掉对象/数组末尾的 trailing comma(LLM 输出常见毛病,
|
|
4
|
+
// 实测 canvas_present_survey groups 因此整次校验失败)重试一次,仍失败再走原值让 zod 给出可读错误。
|
|
4
5
|
function tolerant(schema) {
|
|
5
6
|
return z.preprocess((value) => {
|
|
6
7
|
if (typeof value !== "string")
|
|
@@ -9,7 +10,12 @@ function tolerant(schema) {
|
|
|
9
10
|
return JSON.parse(value);
|
|
10
11
|
}
|
|
11
12
|
catch {
|
|
12
|
-
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(value.replace(/,(\s*[\]}])/g, "$1"));
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
13
19
|
}
|
|
14
20
|
}, schema);
|
|
15
21
|
}
|