zcode-app-cli 3.9.1-16 → 3.10.1-17

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.
Files changed (36) hide show
  1. package/bin/zcode.js +18 -0
  2. package/config.example.json +15 -0
  3. package/package.json +3 -3
  4. package/vendor/extraction.json +4 -4
  5. package/vendor/node_modules/@zcode/tui/dist/index.js +767 -188
  6. package/vendor/node_modules/@zcode/tui/package.json +1 -1
  7. package/vendor/packages/browser-use-plugin/.zcode-plugin/plugin.json +1 -1
  8. package/vendor/packages/browser-use-plugin/dist/mcp/server.js +891 -475
  9. package/vendor/packages/browser-use-plugin/docs/api.json +7 -2
  10. package/vendor/packages/browser-use-plugin/docs/overview.md +4 -1
  11. package/vendor/packages/browser-use-plugin/docs/playwright.md +4 -6
  12. package/vendor/packages/browser-use-plugin/docs/safety.md +1 -1
  13. package/vendor/packages/browser-use-plugin/docs/workflow.md +1 -1
  14. package/vendor/packages/browser-use-plugin/package.json +1 -1
  15. package/vendor/packages/browser-use-plugin/scripts/browser-client.mjs +65 -9
  16. package/vendor/packages/browser-use-plugin/skills/control-browser/SKILL.md +6 -3
  17. package/vendor/packages/document-skills-plugin/.zcode-plugin/plugin.json +2 -2
  18. package/vendor/packages/document-skills-plugin/agents/judge.md +51 -0
  19. package/vendor/packages/document-skills-plugin/package.json +4 -4
  20. package/vendor/packages/document-skills-plugin/skills/pptx/SKILL.md +9 -4
  21. package/vendor/packages/zcode-cua-plugin/.zcode-plugin/plugin.json +3 -3
  22. package/vendor/packages/zcode-cua-plugin/dist/mcp/server.js +573 -1023
  23. package/vendor/packages/zcode-cua-plugin/node_modules/koffi/build/koffi/linux_x64/koffi.node +0 -0
  24. package/vendor/packages/zcode-cua-plugin/node_modules/koffi/index.d.ts +288 -0
  25. package/vendor/packages/zcode-cua-plugin/node_modules/koffi/index.js +634 -0
  26. package/vendor/packages/zcode-cua-plugin/node_modules/koffi/package.json +38 -0
  27. package/vendor/packages/zcode-cua-plugin/package.json +1 -1
  28. package/vendor/packages/zcode-cua-plugin/scripts/build-mcp.mjs +3 -1
  29. package/vendor/packages/zcode-cua-plugin/scripts/bump-zcode-cua-producer.mjs +4 -4
  30. package/vendor/packages/zcode-cua-plugin/scripts/check-cua-baseline.mjs +2 -2
  31. package/vendor/packages/zcode-cua-plugin/scripts/check-version-coherence.mjs +4 -4
  32. package/vendor/packages/zcode-cua-plugin/scripts/sync-cache.mjs +9 -2
  33. package/vendor/packages/zcode-cua-plugin/scripts/sync-skill-from-zcode-cua.mjs +7 -7
  34. package/vendor/packages/zcode-cua-plugin/skills/{zcode-computer-use → computer-use}/SKILL.md +56 -13
  35. package/vendor/zcode.cjs +776 -775
  36. package/zcode-runtime.lock.json +3 -3
@@ -2,7 +2,7 @@
2
2
  // 唯一的原子 producer bump 命令 —— 一次调用完成全部 producer 记录的同步更新:
3
3
  // pnpm-workspace.yaml catalog(两个别名)
4
4
  // pnpm-lock.yaml(通过 pnpm install)
5
- // bundled Skill(skills/zcode-computer-use/SKILL.md)
5
+ // bundled Skill(skills/computer-use/SKILL.md)
6
6
  // upstream.json(commit/ref/skillSha256 provenance)
7
7
  // wrapper 版本三处记录 + 官方插件定义 + 实现契约(复用 check-version-coherence.mjs 写回)
8
8
  // 成功后自动跑快速基线门禁与 skill-sync 不可变性测试自校验;--commit 直接产出单个
@@ -34,9 +34,9 @@ const workspacePath = resolve(repoRoot, "pnpm-workspace.yaml");
34
34
  const producerRoot = resolve(
35
35
  process.env.ZCODE_CUA_REPO ?? resolve(packageRoot, "../../../../../zcode-cua"),
36
36
  );
37
- const skillPath = "plugin/skills/zcode-computer-use/SKILL.md";
37
+ const skillPath = "plugin/skills/computer-use/SKILL.md";
38
38
  const producerManifestPath = "plugin/.zcode-plugin/plugin.json";
39
- const targetSkill = resolve(packageRoot, "skills/zcode-computer-use/SKILL.md");
39
+ const targetSkill = resolve(packageRoot, "skills/computer-use/SKILL.md");
40
40
  const provenancePath = resolve(packageRoot, "upstream.json");
41
41
  const doCommit = process.argv.includes("--commit");
42
42
  const positionalArgs = process.argv.slice(2).filter((arg) => !arg.startsWith("--"));
@@ -230,7 +230,7 @@ const commitFileSet = [
230
230
  "pnpm-workspace.yaml",
231
231
  "pnpm-lock.yaml",
232
232
  "apps/zcode-cli/packages/zcode-cua-plugin/upstream.json",
233
- "apps/zcode-cli/packages/zcode-cua-plugin/skills/zcode-computer-use/SKILL.md",
233
+ "apps/zcode-cli/packages/zcode-cua-plugin/skills/computer-use/SKILL.md",
234
234
  "apps/zcode-cli/packages/zcode-cua-plugin/package.json",
235
235
  "apps/zcode-cli/packages/zcode-cua-plugin/.zcode-plugin/plugin.json",
236
236
  "apps/zcode-cli/packages/bootstrap/src/app/official-plugin-definitions.ts",
@@ -31,7 +31,7 @@ const [
31
31
  readFile(resolve(repoRoot, "pnpm-workspace.yaml"), "utf8"),
32
32
  readFile(resolve(repoRoot, "pnpm-lock.yaml"), "utf8"),
33
33
  readFile(resolve(packageRoot, "upstream.json"), "utf8"),
34
- readFile(resolve(packageRoot, "skills/zcode-computer-use/SKILL.md")),
34
+ readFile(resolve(packageRoot, "skills/computer-use/SKILL.md")),
35
35
  readFile(
36
36
  resolve(
37
37
  repoRoot,
@@ -116,7 +116,7 @@ if (provenance.commit !== catalogCommit || provenance.ref !== catalogCommit) {
116
116
  `ref=${provenance.ref},catalog=${catalogCommit}`,
117
117
  );
118
118
  }
119
- if (provenance.skillPath !== "plugin/skills/zcode-computer-use/SKILL.md") {
119
+ if (provenance.skillPath !== "plugin/skills/computer-use/SKILL.md") {
120
120
  fail(`upstream.json.skillPath 不是 producer Skill 路径(当前 ${provenance.skillPath})`);
121
121
  }
122
122
  const skillSha256 = createHash("sha256").update(skillBytes).digest("hex");
@@ -385,7 +385,7 @@ if (pinValues.length !== 1 || !pinValues[0]) {
385
385
  const expected = pinValues[0];
386
386
 
387
387
  function readOfficialPluginVersion(source) {
388
- const block = source.match(/name:\s*"zcode-cua"[\s\S]*?version:\s*"([^"]+)"[\s\S]*?\n\s*\},/u);
388
+ const block = source.match(/name:\s*"computer-use"[\s\S]*?version:\s*"([^"]+)"[\s\S]*?\n\s*\},/u);
389
389
  return block?.[1] ?? null;
390
390
  }
391
391
 
@@ -395,7 +395,7 @@ const officialPluginDefinitions = await readFile(officialPluginDefinitionsPath,
395
395
  const records = {
396
396
  "wrapper package.json.version": wrapperPackageJson.version,
397
397
  "wrapper .zcode-plugin/plugin.json.version": (await readJson(wrapperManifestPath)).version,
398
- "official-plugin-definitions zcode-cua.version":
398
+ "official-plugin-definitions computer-use.version":
399
399
  readOfficialPluginVersion(officialPluginDefinitions),
400
400
  "installed producer package.json.version": installedRuntimePackage.version,
401
401
  ...producerPins,
@@ -447,9 +447,9 @@ const wrote = [];
447
447
  if (await writeVersionField(wrapperPackageJsonPath, expected)) wrote.push("package.json");
448
448
  if (await writeVersionField(wrapperManifestPath, expected)) wrote.push(".zcode-plugin/plugin.json");
449
449
  const officialVersionPattern =
450
- /(name:\s*"zcode-cua"[\s\S]*?version:\s*")([^"]+)("[\s\S]*?\n\s*\},)/u;
450
+ /(name:\s*"computer-use"[\s\S]*?version:\s*")([^"]+)("[\s\S]*?\n\s*\},)/u;
451
451
  if (!officialVersionPattern.test(officialPluginDefinitions)) {
452
- throw new Error("[cua-version] 未找到 official-plugin-definitions 中的 zcode-cua version");
452
+ throw new Error("[cua-version] 未找到 official-plugin-definitions 中的 computer-use version");
453
453
  }
454
454
  const updatedOfficialPluginDefinitions = officialPluginDefinitions.replace(
455
455
  officialVersionPattern,
@@ -19,6 +19,7 @@ import { dirname, join, resolve } from "node:path";
19
19
  import { fileURLToPath, pathToFileURL } from "node:url";
20
20
  import { homedir } from "node:os";
21
21
  import { stageSharpIntoBundledAgents } from "../../../../../packages/desktop/scripts/sharp-package-assets.mjs";
22
+ import { stageKoffiIntoBundledAgents } from "../../../../../packages/desktop/scripts/koffi-package-assets.mjs";
22
23
 
23
24
  const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
24
25
 
@@ -41,13 +42,13 @@ async function resolveCacheDir() {
41
42
  const text = await readFile(marketplace, "utf8");
42
43
  const parsed = JSON.parse(text);
43
44
  const entry = (parsed.plugins ?? parsed.items ?? []).find(
44
- (p) => p?.name === "zcode-cua" && p?.cachePath,
45
+ (p) => p?.name === "computer-use" && p?.cachePath,
45
46
  );
46
47
  if (entry?.cachePath && existsSync(entry.cachePath)) return entry.cachePath;
47
48
  } catch {
48
49
  // marketplace.json missing/unreadable — fall through to glob.
49
50
  }
50
- const cacheRoot = join(homedir(), ".zcode/cli/plugins/cache/zcode-plugins-official/zcode-cua");
51
+ const cacheRoot = join(homedir(), ".zcode/cli/plugins/cache/zcode-plugins-official/computer-use");
51
52
  if (existsSync(cacheRoot)) {
52
53
  const dirs = await readdir(cacheRoot);
53
54
  if (dirs.length === 1) return join(cacheRoot, dirs[0]);
@@ -91,6 +92,12 @@ stageSharpIntoBundledAgents({
91
92
  targetPlatform: { os: process.platform, arch: process.arch },
92
93
  });
93
94
  copied.push("node_modules/sharp runtime");
95
+ stageKoffiIntoBundledAgents({
96
+ koffiPackageRoot: resolve(packageRoot, "../adapters"),
97
+ glmDir: cacheDir,
98
+ targetPlatform: { os: process.platform, arch: process.arch },
99
+ });
100
+ copied.push("node_modules/koffi runtime");
94
101
 
95
102
  console.log(`sync:cache → ${cacheDir}`);
96
103
  console.log(` copied: ${copied.join(", ") || "(nothing)"}`);
@@ -12,9 +12,9 @@ const defaultRepositoryRoot = resolve(packageRoot, "../../../../../zcode-cua");
12
12
  const repositoryRoot = resolve(
13
13
  process.argv[2] ?? process.env.ZCODE_CUA_REPO ?? defaultRepositoryRoot,
14
14
  );
15
- const sourceSkill = resolve(repositoryRoot, "plugin/skills/zcode-computer-use/SKILL.md");
15
+ const sourceSkill = resolve(repositoryRoot, "plugin/skills/computer-use/SKILL.md");
16
16
  const sourceManifest = resolve(repositoryRoot, "plugin/.zcode-plugin/plugin.json");
17
- const targetSkill = resolve(packageRoot, "skills/zcode-computer-use/SKILL.md");
17
+ const targetSkill = resolve(packageRoot, "skills/computer-use/SKILL.md");
18
18
  const provenancePath = resolve(packageRoot, "upstream.json");
19
19
  // 修复:bundled wrapper 的 plugin.json / package.json 之前各自维护 0.1.0,
20
20
  // 与实际 zcode-cua MCP server 版本割裂(UI 展示、缓存路径、marketplace 条目都对不上)。
@@ -38,7 +38,7 @@ const [skillBytes, manifestText, workspaceText, revision, sourceStatus] = await
38
38
  "--porcelain",
39
39
  "--untracked-files=all",
40
40
  "--",
41
- "plugin/skills/zcode-computer-use/SKILL.md",
41
+ "plugin/skills/computer-use/SKILL.md",
42
42
  "plugin/.zcode-plugin/plugin.json",
43
43
  ],
44
44
  { encoding: "utf8" },
@@ -67,8 +67,8 @@ if (sourceStatus.stdout.trim() !== "") {
67
67
  throw new Error("Refusing to sync Skill or plugin manifest from uncommitted producer content");
68
68
  }
69
69
  const manifest = JSON.parse(manifestText);
70
- if (manifest.name !== "zcode-cua" || typeof manifest.version !== "string") {
71
- throw new Error(`Invalid zcode-cua plugin manifest at ${sourceManifest}`);
70
+ if (manifest.name !== "computer-use" || typeof manifest.version !== "string") {
71
+ throw new Error(`Invalid computer-use plugin manifest at ${sourceManifest}`);
72
72
  }
73
73
 
74
74
  /**
@@ -95,7 +95,7 @@ await writeFile(
95
95
  repository: "https://dev.aminer.cn/codegeex/zcode-cua.git",
96
96
  ref: upstreamRef,
97
97
  commit: upstreamCommit,
98
- skillPath: "plugin/skills/zcode-computer-use/SKILL.md",
98
+ skillPath: "plugin/skills/computer-use/SKILL.md",
99
99
  skillSha256: createHash("sha256").update(skillBytes).digest("hex"),
100
100
  },
101
101
  null,
@@ -106,7 +106,7 @@ await writeFile(
106
106
  const manifestUpdated = await syncVersionField(bundledManifestPath, manifest.version);
107
107
  const packageJsonUpdated = await syncVersionField(bundledPackageJsonPath, manifest.version);
108
108
 
109
- console.log(`Synced zcode-computer-use skill from zcode-cua ${manifest.version}`);
109
+ console.log(`Synced computer-use skill from zcode-cua ${manifest.version}`);
110
110
  if (manifestUpdated || packageJsonUpdated) {
111
111
  console.log(
112
112
  `Aligned bundled wrapper version to ${manifest.version} ` +
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: zcode-computer-use
2
+ name: computer-use
3
3
  description: Main-agent-only desktop control through accessibility-first semantic actions with visual pixel fallback only when accessibility cannot reach the target.
4
4
  ---
5
5
 
@@ -12,18 +12,35 @@ Main agent only. Never delegate Computer Use to a subagent.
12
12
  Observe once, act once, then verify.
13
13
 
14
14
  1. If readiness is unknown, call `request_access` once.
15
- 2. Resolve the app with `list_apps`; use `open_application` only when needed.
15
+ 2. `list_apps` shows running apps only. If the user names an app that is absent,
16
+ use `open_application` once with the original user-provided name: copy it character-for-character,
17
+ including its script, case, spaces, punctuation, and suffixes such as `app`.
18
+ For example, use `{"name":"网易云音乐app"}`, not `{"name":"网易云音乐"}`;
19
+ use `{"name":"日历"}`, not `{"name":"Calendar"}`.
20
+ Do not translate, localize, normalize, shorten, or remove a suffix. Do not retry names,
21
+ operate Finder/Spotlight, use shell commands to discover it, or substitute a different running app.
16
22
  3. Call `get_app_state`. Start with the accessibility tree and no screenshot.
17
23
  4. If the target has an accessibility element, use an element action. This is the primary path because it is semantic, precise, background-safe, and does not steal the user's focus.
18
24
  5. Only when accessibility cannot locate or express the target, request a window
19
25
  screenshot or full screenshot and use a frame-bound coordinate action.
20
- 6. Prefer `return_state="compact"` when the action supports it. Otherwise observe
21
- again only when verification is required.
26
+ 6. Let actions return the default receipt only. Use `return_state="compact"` or
27
+ call `get_app_state` only when the next step needs fresh UI state.
22
28
 
23
29
  Do not run both the accessibility and visual workflows for the same action.
24
30
  Do not activate or focus an app merely to make a semantic action work.
25
31
  Honor tool capabilities and fail-closed results.
26
32
 
33
+ Tool failures are reported without a producer-side permission classifier. Read
34
+ the original message before choosing recovery. Call `request_access` once only
35
+ when the failure explicitly names Accessibility or Screen Recording; do not
36
+ infer macOS permission loss from a generic `permission_denied`, foreground,
37
+ focus-policy, UIPI, or capability failure. If delivery is `possibly_sent`,
38
+ observe the application state and never replay the same action automatically.
39
+ If `request_access` reports Accessibility as `denied`/`stale` or Screen Recording
40
+ as `denied`, tell the user that authorization is required and end the current
41
+ turn. Do not call another Computer Use action, retry `request_access`, or promise
42
+ that the interrupted action will continue automatically after authorization.
43
+
27
44
  ## Choose the target
28
45
 
29
46
  There are two authoritative target forms:
@@ -74,8 +91,31 @@ occlusion, permission, or capability refusal.
74
91
  A coordinate refusal may report that windows covering the point were skipped, or
75
92
  name an owner other than the app you expected. Those windows are invisible
76
93
  overlays belonging to the user's environment. Raise the window you meant to act on
77
- with `open_application(activate=true, confirm_focus_steal=true)`, observe again,
78
- and retry. Do not move, resize, or close the reported windows.
94
+ with `open_application(activate=true)`, observe again, and retry. Do not move,
95
+ resize, or close the reported windows.
96
+
97
+ ### macOS file panels
98
+
99
+ For an `open_panel` / `save_panel` exact-path workflow, background app-scoped
100
+ keyboard receipts may be accepted without executing the AppKit command. Use this
101
+ single recovery sequence:
102
+
103
+ 1. Observe the panel and keep its `pid`, `bundle_id`, and fresh `actual_window_id`.
104
+ 2. Call `open_application` with those three fields and `activate=true`.
105
+ 3. Observe the same panel again, then send Cmd+Shift+G with `strategy=event` and
106
+ that exact panel window id.
107
+ 4. Observe by `pid` / `bundle_id` **without the old panel `window_id`**, so CUA
108
+ returns the newly focused `attached_dialog`. Pin its fresh `actual_window_id`
109
+ for the path `type(strategy=event)` and Enter.
110
+
111
+ `key` and `type` never activate implicitly. If they return `foreground_required`
112
+ with `action_sent=false`, repeat the confirmed activation and fresh observation;
113
+ do not retry the same key blindly. Ordinary windows and popovers do not receive
114
+ this activation exception.
115
+
116
+ For every ordinary launch or application activation, omit `window_id`. Never
117
+ invent a window id or use a placeholder such as `1`. If `bundle_id` or `pid` is
118
+ known, pass that canonical identity without a translated or guessed `name`.
79
119
 
80
120
  ## Text and keyboard
81
121
 
@@ -98,13 +138,16 @@ Platform app references:
98
138
  ## Outcome and retry safety
99
139
 
100
140
  `action_sent=true` means the action may already have happened. Never blindly
101
- replay it. Retry a non-idempotent action only when `action_sent=false`.
102
-
103
- Use returned post-state or a fresh `get_app_state` to verify the result. Old
104
- `state_id` values become stale after an element write. When
105
- `state_sync_status="refresh_required"`, call `get_app_state` before another
106
- element write. A changed tree is not by itself proof that this action caused the
107
- change; prefer target-specific verification fields when present.
141
+ replay it. When `action_sent=false`, re-observe with `get_app_state`, choose a
142
+ fresh target from the new state, and issue a new action only if it is still
143
+ needed. Never replay the same stale action call.
144
+
145
+ The default action result is an `action_receipt`, not a UI observation. Old
146
+ `state_id` values used by a sent element write are consumed after dispatch; call
147
+ `get_app_state` before another element write or whenever the next step depends
148
+ on current UI state. A changed tree is not by itself proof that this action
149
+ caused the change; verify with the app state or an external task oracle when it
150
+ matters.
108
151
 
109
152
  Call `stop_computer_control` to stop the active control session. Do not continue
110
153
  after the kill switch, denied access, or a non-retryable readiness result.