zcode-app-cli 3.14.0-27 → 3.14.3-27

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.
@@ -1,11 +1,12 @@
1
1
  # Worked dynamic-workflow examples
2
2
 
3
- Four complete scripts, end to end. Each is a whole arc — world read, topology, loop or
3
+ Five complete scripts, end to end. Each is a whole arc — world read, topology, loop or
4
4
  fan-out, salvage, artifacts, return shape — so read one when you want to see how the pieces
5
5
  sit together rather than looking up a single shape (`patterns.md` is for that).
6
6
 
7
- Every script here is submitted as the `script` argument of the `CreateWorkflow` tool, whose
8
- description carries the API surface these scripts are written against.
7
+ Every script here is submitted as the `script` argument of the `CreateWorkflow` tool. The
8
+ API surface they are written against is `SKILL.md` §16 (the facade block in §16.2 and the
9
+ rules in §16.3), not the tool description.
9
10
 
10
11
  ---
11
12
 
@@ -659,3 +660,142 @@ One artifact, deliberately. The report lists every attempt, which is more than t
659
660
  could follow is the round number and whether the checker passed, and the phase timeline
660
661
  lighting up "Repair what the checker rejected" again already shows exactly that. A metrics
661
662
  tile would repeat it, and the proof file is the repository's to show, not a card's.
663
+
664
+ ## 5. Changed-file review with confirmation as reviews land
665
+
666
+ Review every changed file, triage its findings on one scale, confirm each kept finding
667
+ independently, and hand back a report. Everything a file needs happens as soon as its own
668
+ review lands; the only join is the cross-file deduplication that needs every finding.
669
+
670
+ <!-- compile -->
671
+ ```ts
672
+ interface Finding {
673
+ /** Workspace-relative path, with a line when it applies: "src/a.ts:42". */
674
+ where: string;
675
+ /** One sentence: what is wrong. */
676
+ what: string;
677
+ /** What showed it: the lines read, or the command and the output that proved it. */
678
+ evidence: string;
679
+ /** How much it matters. Reserve "high" for data loss, a crash, or a wrong result. */
680
+ severity: "low" | "medium" | "high";
681
+ }
682
+ interface Review {
683
+ findings: Finding[];
684
+ }
685
+ interface Keep {
686
+ /** True when this finding is worth putting in front of a human. */
687
+ keep: boolean;
688
+ }
689
+ interface Confirmation {
690
+ /** True only when you reproduced the problem yourself from the evidence. */
691
+ reproduced: boolean;
692
+ /** What you did to check, one sentence. */
693
+ note: string;
694
+ }
695
+ interface ReportedFinding extends Finding {
696
+ /** "verified" when the confirmer reproduced it; "unconfirmed" when it could not. */
697
+ status: "verified" | "unconfirmed";
698
+ }
699
+ interface Digest {
700
+ /** The confirmed findings with duplicates across files merged, one line each. */
701
+ lines: string[];
702
+ /** Two or three sentences a reader can act on. */
703
+ summary: string;
704
+ }
705
+ interface WorkflowReport {
706
+ /** Two or three sentences answering what the user asked for. */
707
+ conclusion: string;
708
+ findings: ReportedFinding[];
709
+ /** What the run checked and how. */
710
+ verified: string[];
711
+ /** What the run did not look at or could not check, and why. */
712
+ notCovered: string[];
713
+ }
714
+
715
+ phase("Review each changed file and confirm its findings as they land");
716
+ let paths: string[];
717
+ try {
718
+ paths = await git.changedFiles("origin/main");
719
+ } catch {
720
+ paths = await files.glob("src/**/*.ts");
721
+ }
722
+ log(`reviewing ${paths.length} changed files`);
723
+
724
+ // One triage subagent for all findings: severity only means anything if it is judged on a
725
+ // consistent scale. It is a queue, not a barrier — asks on it run FIFO, so a finding reaches
726
+ // it the moment its file's review lands, whichever file that is.
727
+ const triage = agent("triage", "You decide which review findings deserve a human's attention. Be strict.");
728
+
729
+ // One reviewer per file, fresh each: the files are unrelated, so nothing is gained by
730
+ // sharing a context and everything is gained by running them at once. Triage and
731
+ // confirmation live inside the same callback, so no file waits for the slowest review
732
+ // before its findings move on; the outer `Promise.all` is the only join the report waits on.
733
+ const perFile = await Promise.all(
734
+ paths.map(async (p) => {
735
+ const review = await agent(`reviewer-${p}`).ask<Review>(`Review ${p} for correctness bugs.`);
736
+
737
+ const kept: Finding[] = [];
738
+ for (const finding of review.findings) {
739
+ const verdict = await triage.ask<Keep>(`Worth reporting? ${JSON.stringify(finding)}`);
740
+ if (verdict.keep) kept.push(finding);
741
+ }
742
+
743
+ // A separate confirmer per kept finding, blind to the reviewer that raised it: it reads
744
+ // the code, runs a check if one decides it, and is told not to fix anything. The name
745
+ // carries the path and the index, because every subagent name in a run must be unique.
746
+ return Promise.all(
747
+ kept.map(async (finding, index) => {
748
+ const check = await agent(`confirmer-${p}-${index}`).ask<Confirmation>(
749
+ `Reproduce this finding from its evidence alone: read the code, run a check if one exists. Do not edit any file.\n${JSON.stringify(finding)}`,
750
+ );
751
+ const reported: ReportedFinding = {
752
+ ...finding,
753
+ status: check.reproduced ? "verified" : "unconfirmed",
754
+ };
755
+ report(reported); // published now, with its status, so it survives a later failure
756
+ return reported;
757
+ }),
758
+ );
759
+ }),
760
+ );
761
+ const confirmed = perFile.flat();
762
+ log(`${confirmed.length} findings confirmed or labelled`);
763
+
764
+ // The one stage that genuinely needs every finding: two reviewers can flag the same root
765
+ // cause from two files, and only a reader of the whole list can merge them.
766
+ phase("Merge duplicate findings across files and write them up");
767
+ const digest = await agent("editor", "You merge review findings that share a root cause and write them up for the engineer who fixes them.")
768
+ .ask<Digest>(`Merge duplicates and write these up:\n${JSON.stringify(confirmed)}`);
769
+
770
+ const verifiedCount = confirmed.filter((f) => f.status === "verified").length;
771
+ await artifact.markdown(
772
+ "report",
773
+ [
774
+ `# Review of ${paths.length} changed files: ${confirmed.length} findings, ${verifiedCount} reproduced`,
775
+ "",
776
+ digest.summary,
777
+ "",
778
+ ...digest.lines.map((line) => `- ${line}`),
779
+ "",
780
+ "## Every finding",
781
+ ...confirmed.map((f) => `- **${f.where}** (${f.severity}, ${f.status}): ${f.what}\n ${f.evidence}`),
782
+ ].join("\n"),
783
+ { title: "Review report" },
784
+ );
785
+ const result: WorkflowReport = {
786
+ conclusion: digest.summary,
787
+ findings: confirmed,
788
+ verified: paths.map((p) => `reviewed ${p}; every kept finding re-checked by a separate subagent`),
789
+ notCovered: ["files outside the change set", "runtime behaviour no existing test exercises"],
790
+ };
791
+ return result;
792
+ ```
793
+
794
+ Three shapes in one script, each chosen for a reason. The reviewers are fresh and parallel
795
+ because the files are unrelated. The triage subagent is shared because severity must mean the
796
+ same thing twice — and sharing costs nothing here, because its FIFO queue is fed as reviews
797
+ land rather than after all of them. The confirmers are fresh, per finding and blind to the
798
+ reviewer, and they start the moment their file's triage is done: with twelve files and one
799
+ slow reviewer, eleven files' findings are confirmed and reported while it is still reading.
800
+ Nothing gets a second reader on top: each finding was confirmed, and the editor's job is
801
+ merging and writing up, not re-checking.
@@ -80509,11 +80509,12 @@ import { open as open2 } from "node:fs/promises";
80509
80509
  import { existsSync, realpathSync, writeFileSync } from "node:fs";
80510
80510
  import { basename as basename2, dirname, isAbsolute as isAbsolute2, join as join3, resolve } from "node:path";
80511
80511
  import { basename as basename3, join as join4 } from "node:path";
80512
+ import { existsSync as existsSync2 } from "node:fs";
80512
80513
  import { join as join5 } from "node:path";
80513
80514
  import {
80514
80515
  constants as fsConstants,
80515
80516
  createWriteStream,
80516
- existsSync as existsSync3,
80517
+ existsSync as existsSync4,
80517
80518
  fstatSync as fstatSync2,
80518
80519
  lstatSync as lstatSync2
80519
80520
  } from "node:fs";
@@ -80559,7 +80560,7 @@ import { createHash } from "node:crypto";
80559
80560
  var import_express = __toESM(require_express2(), 1);
80560
80561
  import { Readable } from "stream";
80561
80562
  import crypto2 from "crypto";
80562
- import { appendFileSync, existsSync as existsSync2, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
80563
+ import { appendFileSync, existsSync as existsSync3, mkdirSync, readdirSync, unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
80563
80564
  import { dirname as dirname3, isAbsolute as isAbsolute4, join as join7 } from "node:path";
80564
80565
  import { dirname as dirname2, isAbsolute as isAbsolute3, join as join6 } from "node:path";
80565
80566
  import { join as join9 } from "node:path";
@@ -87459,7 +87460,7 @@ var ZCODE_CUA_HELPER_BUILD_ID;
87459
87460
  var init_cua_version = __esm({
87460
87461
  "src/broker/shared/cua-version.ts"() {
87461
87462
  "use strict";
87462
- ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-291084-a1328db1" : "";
87463
+ ZCODE_CUA_HELPER_BUILD_ID = true ? "pipeline-293504-ab4d5e6b" : "";
87463
87464
  }
87464
87465
  });
87465
87466
  var init_shared = __esm({
@@ -87899,6 +87900,13 @@ ${stderr}`;
87899
87900
  };
87900
87901
  }
87901
87902
  async function defaultAssessGatekeeper(appPath) {
87903
+ if (existsSync2(MACOS_SYSTEM_COMMANDS.syspolicyCheck)) {
87904
+ await execFileText(MACOS_SYSTEM_COMMANDS.syspolicyCheck, [
87905
+ "distribution",
87906
+ appPath
87907
+ ]);
87908
+ return;
87909
+ }
87902
87910
  await execFileText(MACOS_SYSTEM_COMMANDS.spctl, [
87903
87911
  "-a",
87904
87912
  "-vv",
@@ -88424,7 +88432,7 @@ function ensureCuaHelperInstalledSingleFlight(context) {
88424
88432
  async function ensureCuaHelperInstalledUnderLease(context, lease) {
88425
88433
  const { plan, logger, dependencies } = context;
88426
88434
  lease.assertHeld();
88427
- if (existsSync3(plan.appPath)) {
88435
+ if (existsSync4(plan.appPath)) {
88428
88436
  try {
88429
88437
  const installedVerification = await verifyCuaHelperBundle(
88430
88438
  plan.appPath,
@@ -88575,7 +88583,7 @@ async function shouldRefreshLocalDevBundledHelper(plan, executableName) {
88575
88583
  );
88576
88584
  }
88577
88585
  async function stageBundledHelperApp(bundledAppPath, workDir) {
88578
- if (!existsSync3(bundledAppPath)) {
88586
+ if (!existsSync4(bundledAppPath)) {
88579
88587
  throw new CuaHelperError(
88580
88588
  "helper_missing",
88581
88589
  `Bundled ZCode Computer Use.app is missing at ${bundledAppPath}`
@@ -88868,7 +88876,7 @@ async function promoteHelperApp(stagedAppPath, finalAppPath) {
88868
88876
  `.${HELPER_APP_NAME}.backup-${process.pid}-${Date.now()}`
88869
88877
  );
88870
88878
  let hasBackup = false;
88871
- if (existsSync3(finalAppPath)) {
88879
+ if (existsSync4(finalAppPath)) {
88872
88880
  await rm(backupPath, { recursive: true, force: true });
88873
88881
  await rename(finalAppPath, backupPath);
88874
88882
  hasBackup = true;
@@ -115295,8 +115303,8 @@ var TOOL_DEF_BY_NAME = new Map([
115295
115303
  ...keyboardRuntimeTools.map((t) => [t.name, t])
115296
115304
  ]);
115297
115305
  var SERVER_VERSION = (() => {
115298
- if ("0.6.1".trim().length > 0) {
115299
- return "0.6.1";
115306
+ if ("0.6.3".trim().length > 0) {
115307
+ return "0.6.3";
115300
115308
  }
115301
115309
  try {
115302
115310
  const require2 = createRequire2(import.meta.url);
@@ -116055,9 +116063,9 @@ function createComputerUseRuntime(options) {
116055
116063
  }
116056
116064
  async function ensureStandaloneHelperLaunched(socketPath, env) {
116057
116065
  if (process.platform !== "darwin") return;
116058
- const { existsSync: existsSync4 } = await import("node:fs");
116066
+ const { existsSync: existsSync5 } = await import("node:fs");
116059
116067
  const bundledDevAppPath = env.ZCODE_CUA_BUNDLED_HELPER_APP_PATH?.trim();
116060
- if (bundledDevAppPath && existsSync4(bundledDevAppPath)) {
116068
+ if (bundledDevAppPath && existsSync5(bundledDevAppPath)) {
116061
116069
  const { createCuaHelperInstaller: createCuaHelperInstaller2 } = await Promise.resolve().then(() => (init_helperInstaller(), helperInstaller_exports));
116062
116070
  const refreshed = await createCuaHelperInstaller2({
116063
116071
  env,
@@ -116067,7 +116075,7 @@ async function ensureStandaloneHelperLaunched(socketPath, env) {
116067
116075
  return;
116068
116076
  }
116069
116077
  const candidates = standaloneHelperCandidatePaths(env);
116070
- const appPath = candidates.find((candidate) => existsSync4(candidate));
116078
+ const appPath = candidates.find((candidate) => existsSync5(candidate));
116071
116079
  if (!appPath) return;
116072
116080
  await launchHelperApp(appPath, socketPath, env);
116073
116081
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "computer-use",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Computer Use: automate desktop apps with mouse, keyboard, and UI element control.",
5
5
  "author": {
6
6
  "name": "Z.ai"
@@ -255,6 +255,26 @@ own window order:
255
255
  - `window_id` — stable integer. Pass it back inside `app_ref` to address that
256
256
  window.
257
257
  - `title` — the window title; `""` or `null` for a window that carries none.
258
+ `""` means the window has an `AXTitle` that is empty — a Qt or custom-drawn
259
+ panel typically looks like this. `null` means the title could not be read at
260
+ all, which happens both for an AX window whose `AXTitle` read fails and for a
261
+ row the broker merged in from CoreGraphics, so it does not tell the two apart.
262
+ Use `subrole` for that distinction.
263
+ - `subrole` — the window's `AXSubrole`, present only on a real AX window. A row
264
+ merged in from CoreGraphics (a WindowServer surface the accessibility tree does
265
+ not expose) has no `subrole` at all, so the field's presence is what separates
266
+ "a window you can bind and operate" from "a leftover surface". Its own value
267
+ discriminates weakly: a survey of 34 windows across 30 apps found 31 of them
268
+ reporting `AXStandardWindow`, with `AXDialog` the only other value that carried
269
+ information. macOS only.
270
+ - `text_preview` — a content sample for a window with no usable title: the first
271
+ few strings found inside it, joined and truncated. **Never an identifier.** The
272
+ order comes from the accessibility child order, which is creation order and
273
+ carries no semantic guarantee — in the same app a dialog yields its heading
274
+ while a main window yields toolbar noise. It is collected only when `title` is
275
+ empty, omitted when nothing could be collected, and it can contain whatever the
276
+ window displays, including the user's own data. Read it as a hint for choosing
277
+ which window to observe, then confirm by observing that window. macOS only.
258
278
  - `bounds` — `[x, y, width, height]` in global screen points. Diagnostic only:
259
279
  these must never be copied into a coordinate target.
260
280
  - `main` — the app's AX main window. `focused` — the app's AX focused (key)
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@zcode/zcode-cua-plugin",
4
- "version": "0.6.1",
4
+ "version": "0.6.3",
5
5
  "private": true,
6
6
  "description": "ZCode CUA SDK and skill package; execution is provided by the shared node_repl host.",
7
7
  "license": "MIT",
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "zcode-guide",
3
- "version": "0.2.0",
4
- "description": "ZCode usage and self-diagnosis guide: teaches agents and users how to configure MCP servers, commands, skills, hooks, and plugins, how to locate and fix configuration problems for each, and how to author dynamic workflows.",
3
+ "version": "0.3.0",
4
+ "description": "ZCode usage and self-diagnosis guide: teaches agents and users how to configure MCP servers, commands, skills, hooks, and plugins, and how to locate and fix configuration problems for each.",
5
5
  "author": { "name": "Z.ai" },
6
6
  "license": "MIT",
7
- "commands": "commands",
8
7
  "skills": "skills"
9
8
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@zcode/zcode-guide-plugin",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "private": true,
6
6
  "license": "MIT",
7
7
  "description": "作为官方 ZCode 内置插件发布的使用与自诊断指南技能集。"