@aiwg/cli 2026.11.5 → 2026.11.7

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 (201) hide show
  1. package/agentic/code/providers/model-capabilities.v1.json +9 -9
  2. package/bin/aiwg.mjs +6 -4
  3. package/dist/src/activity-log/cli.js +1 -1
  4. package/dist/src/agents/agent-deployer.js +1 -1
  5. package/dist/src/artifacts/audit/types.js +1 -1
  6. package/dist/src/artifacts/browser-export.js +1 -0
  7. package/dist/src/artifacts/discover-facets.js +1 -1
  8. package/dist/src/artifacts/enrichment/prompt.js +1 -1
  9. package/dist/src/artifacts/enrichment/types.js +1 -1
  10. package/dist/src/artifacts/fortemi-core-query-adapter.js +2 -0
  11. package/dist/src/artifacts/index-builder.js +1 -0
  12. package/dist/src/artifacts/query-engine-discover-output.js +1 -0
  13. package/dist/src/artifacts/query-engine-discover.js +2 -2
  14. package/dist/src/artifacts/query-engine-scoring.js +7 -0
  15. package/dist/src/artifacts/template-output-kind.js +10 -0
  16. package/dist/src/artifacts/types.js +1 -1
  17. package/dist/src/artifacts/views/definition.js +1 -1
  18. package/dist/src/artifacts/views/types.js +1 -1
  19. package/dist/src/catalog/cli.js +1 -1
  20. package/dist/src/catalog/cli.mjs +1 -1
  21. package/dist/src/catalog/loader.js +1 -1
  22. package/dist/src/catalog/loader.mjs +1 -1
  23. package/dist/src/catalog/types.js +1 -1
  24. package/dist/src/cli/cli-extension-loader.js +19 -5
  25. package/dist/src/cli/cli-extension-paths.js +65 -0
  26. package/dist/src/cli/handlers/best-practices-audit.js +1 -1
  27. package/dist/src/cli/handlers/dataset.js +11 -2
  28. package/dist/src/cli/handlers/help.js +3 -4
  29. package/dist/src/cli/handlers/index.js +1 -1
  30. package/dist/src/cli/handlers/marketplace-plugin-search.js +37 -0
  31. package/dist/src/cli/handlers/marketplace.js +3 -1
  32. package/dist/src/cli/handlers/models.js +1 -1
  33. package/dist/src/cli/handlers/ralph-launcher.js +8 -2
  34. package/dist/src/cli/handlers/ralph.js +1 -1
  35. package/dist/src/cli/handlers/runtime-info.js +1 -1
  36. package/dist/src/cli/handlers/scaffolding.js +2 -2
  37. package/dist/src/cli/handlers/script-runner.js +1 -1
  38. package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
  39. package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
  40. package/dist/src/cli/handlers/subcommands-list-format.js +19 -1
  41. package/dist/src/cli/handlers/types.js +1 -1
  42. package/dist/src/cli/handlers/update.js +26 -12
  43. package/dist/src/cli/handlers/use.js +6 -5
  44. package/dist/src/cli/handlers/utilities.js +1 -1
  45. package/dist/src/cli/handlers/version.js +1 -1
  46. package/dist/src/cli/handlers/workspace.js +1 -1
  47. package/dist/src/cli/handlers/writing.js +7 -1
  48. package/dist/src/cli/help-generator.js +9 -11
  49. package/dist/src/cli/hooks/builtin/activity-log-hook.js +1 -1
  50. package/dist/src/cli/router.js +1 -1
  51. package/dist/src/cli/workflow-orchestrator.js +1 -1
  52. package/dist/src/config/worker-context.js +37 -7
  53. package/dist/src/config/worker-parallelism.js +11 -0
  54. package/dist/src/contributors/detect.js +1 -1
  55. package/dist/src/contributors/discover.js +1 -1
  56. package/dist/src/contributors/heuristic.js +1 -1
  57. package/dist/src/contributors/index.js +1 -1
  58. package/dist/src/contributors/types.js +1 -1
  59. package/dist/src/contributors/validation.js +1 -1
  60. package/dist/src/dataset/backend-selection.d.ts +3 -0
  61. package/dist/src/dataset/backend-selection.js +11 -0
  62. package/dist/src/dataset/contract-range.d.ts +7 -0
  63. package/dist/src/dataset/contract-range.js +55 -0
  64. package/dist/src/dataset/fortemi-execution-bridge.d.ts +2 -0
  65. package/dist/src/dataset/fortemi-execution-bridge.js +12 -1
  66. package/dist/src/dataset/index.d.ts +2 -0
  67. package/dist/src/dataset/index.js +2 -0
  68. package/dist/src/dataset/orchestration-service.d.ts +1 -1
  69. package/dist/src/dataset/orchestration-service.js +7 -8
  70. package/dist/src/dataset/orchestration-types.d.ts +2 -0
  71. package/dist/src/dataset/service-binding-checkpoints.d.ts +10 -0
  72. package/dist/src/dataset/service-binding-checkpoints.js +26 -0
  73. package/dist/src/dataset/service-binding-contract.d.ts +46 -0
  74. package/dist/src/dataset/service-binding-contract.js +25 -0
  75. package/dist/src/dataset/service-binding-registry.d.ts +12 -0
  76. package/dist/src/dataset/service-binding-registry.js +118 -0
  77. package/dist/src/effects/worker-delivery.js +83 -0
  78. package/dist/src/extensions/capability-index.js +1 -1
  79. package/dist/src/extensions/commands/definitions.js +2 -2
  80. package/dist/src/extensions/deployment-registration.js +1 -1
  81. package/dist/src/extensions/index.js +1 -1
  82. package/dist/src/extensions/loader.js +1 -1
  83. package/dist/src/extensions/manifest.js +27 -9
  84. package/dist/src/extensions/project-local-activity.js +1 -1
  85. package/dist/src/extensions/project-local-discovery.js +2 -2
  86. package/dist/src/extensions/project-local-doctor.js +9 -4
  87. package/dist/src/extensions/project-local-promote.js +3 -3
  88. package/dist/src/extensions/project-local-remove.js +3 -3
  89. package/dist/src/extensions/project-local-scaffold.js +1 -1
  90. package/dist/src/extensions/project-quickref-discovery.js +11 -0
  91. package/dist/src/extensions/project-quickref.js +4 -7
  92. package/dist/src/extensions/registry.js +1 -1
  93. package/dist/src/extensions/shadow-resolver.js +1 -1
  94. package/dist/src/extensions/types.js +1 -1
  95. package/dist/src/extensions/upstream-registry.js +1 -1
  96. package/dist/src/extensions/validation.js +1 -1
  97. package/dist/src/intake/git-history-analyzer.js +1 -1
  98. package/dist/src/kb/cli.js +1 -1
  99. package/dist/src/marketplace/plugin-directory.js +36 -0
  100. package/dist/src/marketplace/plugin-search.js +180 -0
  101. package/dist/src/mcp/cli.mjs +2 -2
  102. package/dist/src/mcp/helpers.mjs +1 -1
  103. package/dist/src/mcp/http-tools.mjs +8 -6
  104. package/dist/src/mcp/http-transport.mjs +3 -1
  105. package/dist/src/mcp/server.mjs +1 -1
  106. package/dist/src/mcp/tools/command-run.mjs +1 -1
  107. package/dist/src/mcp/tools/discovery.mjs +1 -1
  108. package/dist/src/mcp/tools/subsystems.mjs +1 -1
  109. package/dist/src/mcp/tools/worker-invoke.mjs +71 -23
  110. package/dist/src/mcp/tools/worker-launch-ledger.mjs +33 -0
  111. package/dist/src/mcp/tools/worker-local-only-preflight.mjs +79 -0
  112. package/dist/src/mcp/tools/worker-recorded-launch.mjs +26 -0
  113. package/dist/src/mcp/tools/worker-stdin-runtime.mjs +33 -6
  114. package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +49 -0
  115. package/dist/src/mcp/tools/worker-verify-deliver.mjs +25 -0
  116. package/dist/src/models/catalog-policy.js +2 -2
  117. package/dist/src/models/conductor-data-policy.mjs +83 -14
  118. package/dist/src/models/config-loader.js +2 -2
  119. package/dist/src/models/index.js +2 -2
  120. package/dist/src/models/local-endpoint-models.js +155 -0
  121. package/dist/src/models/model-capabilities.v1.json +9 -9
  122. package/dist/src/models/model-discovery.js +9 -5
  123. package/dist/src/models/opencode-worker-model.mjs +16 -0
  124. package/dist/src/models/resolver.js +2 -2
  125. package/dist/src/models/worker-installation.mjs +5 -3
  126. package/dist/src/models/worker-plan.js +1 -1
  127. package/dist/src/plugin/plugin-installer.js +2 -2
  128. package/dist/src/plugin/registry-validator.js +2 -2
  129. package/dist/src/plugin/skill-command-translator.js +1 -1
  130. package/dist/src/providers/deployment-input-session.d.mts +2 -0
  131. package/dist/src/providers/deployment-input-session.mjs +38 -0
  132. package/dist/src/rlm/cache/hash.js +1 -1
  133. package/dist/src/rlm/cache/store.js +1 -1
  134. package/dist/src/rlm/cache/types.js +1 -1
  135. package/dist/src/serve/worker-invocation-preparation.js +54 -22
  136. package/dist/src/serve/worker-invocation.js +25 -8
  137. package/dist/src/serve/worker-shell-prompt.d.mts +6 -0
  138. package/dist/src/serve/worker-shell-prompt.mjs +78 -0
  139. package/dist/src/skills/run.js +0 -11
  140. package/dist/src/smiths/agentsmith/generator.js +1 -1
  141. package/dist/src/smiths/context-pipeline/index.js +1 -1
  142. package/dist/src/smiths/context-pipeline/provider-policy.js +1 -1
  143. package/dist/src/smiths/context-pipeline/types.js +1 -1
  144. package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +2 -2
  145. package/dist/src/smiths/mcpsmith/generator.js +2 -2
  146. package/dist/src/smiths/mcpsmith/index.js +2 -2
  147. package/dist/src/smiths/mcpsmith/types.js +2 -2
  148. package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
  149. package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
  150. package/dist/src/smiths/toolsmith/runtime-discovery.mjs +2 -2
  151. package/dist/src/smiths/toolsmith/types.js +2 -2
  152. package/dist/src/storage/backends/fortemi.js +1 -1
  153. package/dist/src/storage/backends/fs.js +1 -1
  154. package/dist/src/storage/backends/logseq.js +1 -1
  155. package/dist/src/storage/backends/obsidian.js +1 -1
  156. package/dist/src/storage/cli.js +2 -2
  157. package/dist/src/storage/config.js +1 -1
  158. package/dist/src/storage/index.js +1 -1
  159. package/dist/src/storage/subsystem-cli.js +1 -1
  160. package/dist/src/storage/types.js +1 -1
  161. package/dist/src/testing/generators/test-case-generator.js +1 -1
  162. package/dist/src/writing/campaign-patterns.js +96 -0
  163. package/dist/src/writing/campaign-report.js +41 -0
  164. package/dist/src/writing/contextual-diagnostics.js +29 -5
  165. package/dist/src/writing/current-patterns.catalogue.json +87 -0
  166. package/dist/src/writing/current-patterns.js +99 -0
  167. package/dist/src/writing/prose-mask.js +80 -0
  168. package/dist/src/writing/structural-patterns.js +109 -0
  169. package/dist/src/writing/validation-campaign.js +19 -0
  170. package/dist/src/writing/validation-engine.js +18 -11
  171. package/dist/src/writing/validation-rules.js +4 -3
  172. package/package.json +11 -1
  173. package/schemas/dataset/service-binding.v1.schema.json +70 -0
  174. package/schemas/models/model-catalog.v1.schema.json +6 -3
  175. package/tools/agents/providers/base-models-platforms.mjs +87 -48
  176. package/tools/agents/providers/conductor-data-guard.mjs +1 -1
  177. package/tools/agents/providers/rule-deployment-corpus-inputs.mjs +19 -0
  178. package/tools/agents/providers/rule-deployment-input-session.mjs +40 -0
  179. package/tools/agents/providers/rule-deployment-prepare.mjs +15 -6
  180. package/tools/plugin/package-plugins.mjs +2 -0
  181. package/tools/ralph-external/lib/mcp-worker-launch.mjs +67 -0
  182. package/tools/ralph-external/lib/opencode-adapter.mjs +9 -7
  183. package/tools/ralph-external/lib/trusted-verification.mjs +1021 -0
  184. package/tools/ralph-external/lib/typed-stop-delivery.mjs +55 -0
  185. package/tools/ralph-external/lib/verification-isolation.mjs +509 -0
  186. package/tools/ralph-external/lib/worker-context.mjs +3 -3
  187. package/tools/ralph-external/lib/worker-delivery-guards.mjs +141 -0
  188. package/tools/ralph-external/lib/worker-delivery-record.mjs +15 -0
  189. package/tools/ralph-external/lib/worker-final.mjs +4 -1
  190. package/tools/ralph-external/lib/worker-isolation-status.mjs +3 -0
  191. package/tools/ralph-external/lib/worker-launch-cli.mjs +8 -0
  192. package/tools/ralph-external/lib/worker-local-only-paths.mjs +45 -0
  193. package/tools/ralph-external/lib/worker-prompt.mjs +4 -1
  194. package/tools/ralph-external/lib/worker-retry-evidence.mjs +2 -1
  195. package/tools/ralph-external/lib/worker-run-directory-refusal.mjs +2 -1
  196. package/tools/ralph-external/lib/worker-run-directory.mjs +45 -0
  197. package/tools/ralph-external/lib/worker-unit-cleanup.mjs +10 -2
  198. package/tools/ralph-external/lib/worker-verification-cli.mjs +164 -0
  199. package/tools/ralph-external/lib/worktree-preparation.mjs +417 -0
  200. package/tools/ralph-external/session-launcher.mjs +8 -15
  201. package/vscode-extension/schemas/aiwg.config.v1.json +27 -0
@@ -0,0 +1,141 @@
1
+ // Refuse unsafe publication requests before protected checks execute.
2
+ import { closeSync, fstatSync, realpathSync } from 'node:fs';
3
+ import { basename, dirname, isAbsolute, join, resolve } from 'node:path';
4
+ import { boundedPrivateRead } from './worker-inputs.mjs';
5
+ import { parseStrictWorkerJson } from './strict-worker-json.mjs';
6
+ import { digestArtifactFd, pinArtifact, resolveWorktreeRoot } from './trusted-verification.mjs';
7
+
8
+ export class WorkerDeliveryRefusal extends Error {
9
+ constructor(code, message) {
10
+ super(`${code}: ${message}`);
11
+ this.code = code;
12
+ }
13
+ }
14
+ const refuse = (code, message) => { throw new WorkerDeliveryRefusal(code, message); };
15
+
16
+ export function requireDeliveryArtifact(artifactPath, finalPath) {
17
+ if (!artifactPath) refuse('ARTIFACT_REQUIRED', 'publication requires explicit artifact_path / --artifact');
18
+ if (finalPath && realpathSync(artifactPath) === realpathSync(finalPath)) {
19
+ refuse('ARTIFACT_REQUIRED', 'artifact_path / --artifact must name a deliverable, never the worker final / handoff wrapper');
20
+ }
21
+ }
22
+
23
+ export async function readDeliveryExit(runDir, inspect) {
24
+ try {
25
+ const exit = JSON.parse((await boundedPrivateRead(join(runDir, 'exit.json'), 1048576, inspect, true, true)).toString('utf8'));
26
+ if (typeof exit?.endedAt !== 'string' || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?(?:Z|[+-]\d\d:\d\d)$/.test(exit.endedAt)
27
+ || !Number.isFinite(Date.parse(exit.endedAt))) {
28
+ throw new Error('exit.json requires an ISO endedAt');
29
+ }
30
+ return exit;
31
+ } catch (error) {
32
+ refuse('EXIT_EVIDENCE_MISSING', `publication requires readable launcher exit.json with endedAt (${error.message})`);
33
+ }
34
+ }
35
+
36
+ const probes = new Set(['test', '[', 'stat', 'ls', 'true', 'file', 'wc']);
37
+ const emptyPatterns = new Set(['', '.', '^', '$', '.*']);
38
+ const searchValueOptions = new Set(['-m', '--max-count', '-A', '--after-context', '-B', '--before-context', '-C', '--context',
39
+ '-g', '--glob', '--iglob', '-t', '--type', '-T', '--type-not', '--include', '--exclude', '--exclude-dir']);
40
+
41
+ function searchPatterns(args) {
42
+ const patterns = [];
43
+ const operands = [];
44
+ let options = true;
45
+ for (let i = 0; i < args.length; i++) {
46
+ const arg = args[i];
47
+ if (options && arg === '--') { options = false; continue; }
48
+ if (options && (arg === '-f' || arg === '--file' || /^-f.|^--file=/.test(arg))) return null;
49
+ if (options && (arg === '-e' || arg === '--regexp')) { patterns.push(args[++i]); continue; }
50
+ if (options && arg.startsWith('--regexp=')) { patterns.push(arg.slice(9)); continue; }
51
+ if (options && /^-[^-]*e/.test(arg)) { patterns.push(arg.slice(arg.indexOf('e') + 1) || args[++i]); continue; }
52
+ if (options && searchValueOptions.has(arg)) { i++; continue; }
53
+ if (options && arg.startsWith('-')) continue;
54
+ operands.push(arg);
55
+ }
56
+ return patterns.length ? patterns : operands.slice(0, 1);
57
+ }
58
+
59
+ function knownEmptyCheck(command, args) {
60
+ if (command === 'grep' || command === 'rg') {
61
+ const patterns = searchPatterns(args);
62
+ return patterns?.length > 0 && patterns.every(pattern => typeof pattern === 'string' && emptyPatterns.has(pattern));
63
+ }
64
+ if (/^(?:py|python(?:\d+(?:\.\d+)*)?)$/.test(command)) {
65
+ return args.some((arg, i) => arg === '-mjson.tool' || arg === '-m' && args[i + 1] === 'json.tool');
66
+ }
67
+ if (command === 'node' || command === 'nodejs') {
68
+ for (const arg of args) {
69
+ // After the script operand or --, these spellings are script arguments.
70
+ if (arg === '--' || arg === '-' || !arg.startsWith('-')) return false;
71
+ if (arg === '-c' || arg === '--check') return true;
72
+ }
73
+ return false;
74
+ }
75
+ if (command === 'jq') {
76
+ const filter = args.find(arg => !arg.startsWith('-'));
77
+ const exitStatus = args.some(arg => arg === '--exit-status' || /^-[^-]*e/.test(arg));
78
+ return filter === 'empty' || filter === '.' && !exitStatus;
79
+ }
80
+ return command === 'wc'; // A direct wc invocation prints counts without comparing them.
81
+ }
82
+ // This is a narrow argv heuristic, not proof that a check asserts correctness.
83
+ // Probe binaries with only path/flag operands cannot qualify. Other checks
84
+ // must mention the artifact, its basename, or a containing directory in args.
85
+ export function isContentFreeCheck(check, artifactPath) {
86
+ const args = check.args ?? [];
87
+ let command = check.command;
88
+ try { command = realpathSync(command); } catch { /* The verifier refuses unavailable binaries. */ }
89
+ if ([basename(check.command), basename(command)].some(name => knownEmptyCheck(name, args))) return true;
90
+ const pathOrFlag = arg => arg.startsWith('-') || isAbsolute(arg) || arg === basename(artifactPath) || !/[;&|<>$`"'(){}]/.test(arg);
91
+ if ((probes.has(basename(check.command)) || probes.has(basename(command))) && args.every(pathOrFlag)) return true;
92
+ const references = [artifactPath, basename(artifactPath)];
93
+ for (let directory = dirname(artifactPath); directory !== dirname(directory); directory = dirname(directory)) references.push(directory);
94
+ return !args.some(arg => references.some(ref => arg.includes(ref)));
95
+ }
96
+
97
+ async function claimedArtifacts(finalPath, inspect) {
98
+ if (!finalPath) return [];
99
+ const bytes = await boundedPrivateRead(finalPath, 1048576, inspect);
100
+ let final;
101
+ try { final = parseStrictWorkerJson(new TextDecoder('utf-8', { fatal: true }).decode(bytes), 64); }
102
+ catch (error) {
103
+ // Unstructured handoff text is supported; ambiguous JSON claims are not.
104
+ if (error.code === 'SYNTAX') return [];
105
+ throw error;
106
+ }
107
+ return [final?.artifacts, final?.result?.artifacts].flatMap(value => Array.isArray(value) ? value : []);
108
+ }
109
+
110
+ export async function prepareWorkerDeliveryGuard({ worktreeRoot, artifactPath, finalPath, checks, exit, inspect }) {
111
+ const claims = await claimedArtifacts(finalPath, inspect);
112
+ // Run on the verifier's own pinned descriptor and digest, leaving no gap
113
+ // between request validation and the bytes the checks will accept.
114
+ const guard = (pinned, digest) => {
115
+ const cutoff = Date.parse(exit.endedAt) + 2000;
116
+ if (pinned.stat.ctimeMs > cutoff || pinned.stat.mtimeMs > cutoff) {
117
+ refuse('ARTIFACT_CHANGED_AFTER_EXIT', 'artifact ctime or mtime is later than launcher endedAt (2 s clock slack)');
118
+ }
119
+ const matching = claims.filter(claim => {
120
+ if (typeof claim?.path !== 'string' || typeof claim.digest !== 'string') return false;
121
+ const path = resolve(worktreeRoot, claim.path);
122
+ if (path === resolve(artifactPath)) return true;
123
+ try { return realpathSync(path) === pinned.realPath; } catch { return false; }
124
+ });
125
+ if (matching.some(claim => claim.digest !== digest)) {
126
+ refuse('ARTIFACT_CHANGED_AFTER_EXIT', 'artifact digest does not match the worker final claim');
127
+ }
128
+ const after = fstatSync(pinned.fd);
129
+ if (after.ctimeMs !== pinned.stat.ctimeMs || after.mtimeMs !== pinned.stat.mtimeMs || after.size !== pinned.stat.size) {
130
+ refuse('ARTIFACT_CHANGED_AFTER_EXIT', 'artifact changed while checking exit evidence');
131
+ }
132
+ if (!checks.some(check => !isContentFreeCheck(check, pinned.realPath))) {
133
+ refuse('CHECKS_CONTENT_FREE', 'publication requires at least one check beyond known content-free probes, referencing the artifact path, basename, or containing directory');
134
+ }
135
+ };
136
+ // Refuse before probing isolation, then repeat on the verifier's exact pin.
137
+ const pinned = pinArtifact(resolveWorktreeRoot(worktreeRoot), artifactPath);
138
+ try { guard(pinned, digestArtifactFd(pinned)); }
139
+ finally { closeSync(pinned.fd); }
140
+ return guard;
141
+ }
@@ -0,0 +1,15 @@
1
+ // Connect the installed verifier to the existing host-configured signed effects ledger.
2
+ import { importImpl } from '../../_resolve-impl.mjs';
3
+
4
+ async function ledgerFor(projectDir) {
5
+ const { effectSession, openLedger } = await importImpl(import.meta.url, 'effects/host.js');
6
+ return openLedger(await effectSession(projectDir, 'delivery'));
7
+ }
8
+ export async function prepareDeliveryRecord(projectDir, metadata) {
9
+ const { prepareWorkerDelivery } = await importImpl(import.meta.url, 'effects/worker-delivery.js');
10
+ return prepareWorkerDelivery(await ledgerFor(projectDir), metadata);
11
+ }
12
+ export async function lookupDeliveryRecord(projectDir, destination) {
13
+ const { lookupWorkerDelivery } = await importImpl(import.meta.url, 'effects/worker-delivery.js');
14
+ return lookupWorkerDelivery(await ledgerFor(projectDir), destination);
15
+ }
@@ -130,7 +130,10 @@ export async function collectWorkerFinal({ path, workdir, driver, output, invoca
130
130
  }
131
131
  } else {
132
132
  const decoded = scan(finalBytes);
133
- claims = driver.extractFinal ? driver.extractFinal(finalBytes.toString('utf8')) : decoded;
133
+ // A worker-written final that is already workerClaims is used as written. Adapter extraction
134
+ // (for example Muse's JSONL event parser) applies only to vendor-shaped files (#4158).
135
+ claims = driver.extractFinal && !validateWorkerPayload('workerClaims', decoded).valid
136
+ ? driver.extractFinal(finalBytes.toString('utf8')) : decoded;
134
137
  }
135
138
  if (!parseError) {
136
139
  const validation = validateWorkerPayload('workerClaims', claims);
@@ -9,6 +9,9 @@ function emptyCgroup(fields, readCgroup) {
9
9
  if (!['inactive', 'failed'].includes(fields.ActiveState)) return false;
10
10
  // A loaded inactive unit can have released its cgroup entirely.
11
11
  if (fields.LoadState === 'loaded' && fields.ControlGroup === '') return true;
12
+ // systemd garbage-collects a unit that exited successfully once it is inactive and its cgroup is
13
+ // released; the same not-found/inactive/MainPID=0 shape parseShellUnitStatus accepts (#4158).
14
+ if (fields.LoadState === 'not-found' && fields.MainPID === '0' && (fields.ControlGroup ?? '') === '') return true;
12
15
  const group = fields.ControlGroup;
13
16
  if (!group?.startsWith('/') || group === '/' || group.split('/').includes('..')) return false;
14
17
  try { return /^populated 0$/m.test(readCgroup(`/sys/fs/cgroup${group}/cgroup.events`, 'utf8')); }
@@ -11,6 +11,14 @@ export function workerFinalFailureMessage(result) {
11
11
  + (failure.scanError ? ` (scan failed: ${failure.scanError})` : '');
12
12
  }
13
13
 
14
+ /** Rule 9 step 9: never nest --launch-worker inside the confined conductor unit (#4163). A
15
+ * guardrail for honest mistakes, not a security boundary: the nested sandbox fails either way. */
16
+ export function confinedConductorLaunchRefusal(env = process.env) {
17
+ if (env.AIWG_CONFINED_CONDUCTOR !== '1') return null;
18
+ return 'OG_CONFINED_LAUNCH_REFUSED: --launch-worker cannot run inside a confined conductor unit (its worker sandbox would nest and fail). '
19
+ + 'Launch workers with the aiwg MCP worker-invoke tool (operation "run", transport "shell", run_dir) and follow them with operation "status". No worker was started.';
20
+ }
21
+
14
22
  export function parseWorkerLaunchArgs(args) {
15
23
  const result = {};
16
24
  const seen = new Set();
@@ -0,0 +1,45 @@
1
+ // Remove declared local-only inputs from conductor-owned worker worktrees before deployment.
2
+ import { spawnSync } from 'node:child_process';
3
+ import { lstatSync, rmSync } from 'node:fs';
4
+ import path from 'node:path';
5
+ import { importImpl } from '../../_resolve-impl.mjs';
6
+
7
+ function existingTarget(worktreePath, relative) {
8
+ let target = worktreePath;
9
+ for (const component of relative.split('/')) {
10
+ target = path.join(target, component);
11
+ let info;
12
+ try { info = lstatSync(target); } catch (error) {
13
+ if (error.code === 'ENOENT' || error.code === 'ENOTDIR') return null;
14
+ throw error;
15
+ }
16
+ if (info.isSymbolicLink()) throw new Error(`refusing symlinked local-only path component: ${relative}`);
17
+ }
18
+ return target;
19
+ }
20
+
21
+ export async function excludeWorkerLocalOnlyPaths({ repoRoot, worktreePath, spawn = spawnSync, timeoutMs = 30000 }) {
22
+ const { readAiwgConfig } = await importImpl(import.meta.url, 'config/aiwg-config.js');
23
+ const { ConfigLoader } = await importImpl(import.meta.url, 'models/config-loader.js');
24
+ const { collectLocalOnlyPaths } = await importImpl(import.meta.url, 'models/conductor-data-policy.mjs');
25
+ const config = await readAiwgConfig(repoRoot);
26
+ const models = await new ConfigLoader(repoRoot).load(config?.parallelism);
27
+ const paths = collectLocalOnlyPaths(models.defaults.workerSelection, config?.parallelism);
28
+ // Validate every component before changing the index or removing anything.
29
+ const targets = paths.map(relative => ({ relative, target: existingTarget(worktreePath, relative) }))
30
+ .filter(entry => entry.target !== null);
31
+ if (!targets.length) return [];
32
+
33
+ const git = (args, input) => {
34
+ const result = spawn('git', args, { cwd: worktreePath, encoding: 'utf8', timeout: timeoutMs, input });
35
+ if (result.error) throw new Error(`git ${args.join(' ')} failed to run: ${result.error.message}`);
36
+ if (result.status !== 0) throw new Error(`git ${args.join(' ')} exited ${result.status}: ${String(result.stderr ?? '').trim()}`);
37
+ return String(result.stdout ?? '');
38
+ };
39
+ // Literal pathspecs include tracked descendants, without treating names as glob syntax.
40
+ const tracked = git(['ls-files', '-z', '--', ...targets.map(({ relative }) => `:(literal)${relative}`)]);
41
+ if (tracked) git(['update-index', '--skip-worktree', '-z', '--stdin'], tracked);
42
+ // rm unlinks descendant symlinks themselves; it never traverses their targets.
43
+ for (const { target } of targets) rmSync(target, { recursive: true, force: true });
44
+ return targets.map(({ relative }) => relative);
45
+ }
@@ -9,7 +9,10 @@ Required minimal wrapper example (replace the summary and report your actual sta
9
9
  Allowed status: completed, partial, blocked, failed. Keep all seven fields; add no other top-level fields.
10
10
  Put the answer in summary or a separate task artifact. For each listed artifact use
11
11
  {"path":"answer.json","digest":"sha256:<64 lowercase hex characters>","change":"created"}
12
- with a real digest and a file beneath the worker tree. Empty collections are allowed.
12
+ with a real digest and a file beneath the worker tree. Each claim and check is an object, never a string:
13
+ {"id":"claim-1","text":"What you did or found","evidence":[{"ref":"answer.json","digest":"sha256:<64 lowercase hex characters>"}]}
14
+ {"checkId":"check-1","exitCode":0,"evidence":{"ref":"answer.json","digest":"sha256:<64 lowercase hex characters>"},"environment":"worker tree"}
15
+ Evidence items use "ref", not "path". Each limitation is a plain string. Empty collections are allowed.
13
16
  Keep this JSON separate from stdout, stderr and last-message captures. A file at the worker-tree root
14
17
  does not satisfy a different declared final-output path. Worker claims remain unverified.
15
18
 
@@ -151,9 +151,10 @@ async function assertNoOpenPredecessor({ runDir, captureRoot, saved, inspect, re
151
151
  const filename = join(previousDir, 'invocation.json');
152
152
  if (!await inspect(filename, 'file')) continue;
153
153
  const record = JSON.parse((await boundedPrivateRead(filename, 1048576, inspect, true, true)).toString('utf8'));
154
- if (record.origin !== 'launcher' || ((record.taskBindingDigest ?? record.taskDigest) !== taskDigest
154
+ if (!['launcher', 'shell-handoff'].includes(record.origin) || ((record.taskBindingDigest ?? record.taskDigest) !== taskDigest
155
155
  && !await matchesTaskIdentity(record, saved))) continue;
156
156
  try {
157
+ if (record.origin === 'shell-handoff') throw new Error('Raw shell predecessor termination is unknown');
157
158
  // Reuse the authenticated owned-stop loader, including missing exits.
158
159
  await verifyRetryPredecessor({ invocationId: record.invocationId, runDir: previousDir }, { inspect, workerWritableRoots });
159
160
  } catch (cause) {
@@ -1,7 +1,8 @@
1
1
  // Format bounded, actionable diagnostics for a refused worker run directory.
2
2
  export function workerRunDirectoryRefusal(entries) {
3
3
  const reason = 'Worker run directory must be fresh, empty, private and owned';
4
- if (!entries.length) return reason;
4
+ // An empty but pre-created directory fails on mode or ownership; name the remedy (#2918 40b direct-01).
5
+ if (!entries.length) return `${reason}. Pass a run_dir path that does not exist yet (its parent may be missing); the launcher creates it with mode 0700, so do not pre-create it.`;
5
6
  const names = entries.toSorted().slice(0, 5).map(name => JSON.stringify(name)).join(', ');
6
7
  const remaining = entries.length > 5 ? ` (+${entries.length - 5} more)` : '';
7
8
  return `${reason}. Unexpected entries: ${names}${remaining}. Keep the plan and other files outside the run dir, or pass a new run dir.`;
@@ -0,0 +1,45 @@
1
+ // Create private in-project run parents without following symlinked components.
2
+ import { lstat, mkdir } from 'node:fs/promises';
3
+ import { dirname, isAbsolute, join, parse, relative, resolve } from 'node:path';
4
+ import { withWorkerPath } from './worker-inputs.mjs';
5
+
6
+ export async function createAttemptRunDirectory(runDir, projectRoot = process.cwd()) {
7
+ if (!isAbsolute(runDir) || runDir.includes('\0') || runDir.split('/').includes('..')) {
8
+ throw new Error('Invalid worker run directory path');
9
+ }
10
+ const parent = dirname(runDir);
11
+ const root = resolve(projectRoot);
12
+ const rel = relative(root, parent);
13
+ const inProject = rel === '' || (!isAbsolute(rel) && rel !== '..' && !rel.startsWith('../'));
14
+ if (inProject) {
15
+ await withWorkerPath(root, async target => {
16
+ const stat = await lstat(target);
17
+ if (stat.isSymbolicLink() || !stat.isDirectory()) throw new Error('Invalid conductor project root');
18
+ });
19
+ }
20
+ let current = parse(parent).root;
21
+ for (const segment of parent.slice(current.length).split('/').filter(Boolean)) {
22
+ current = join(current, segment);
23
+ try {
24
+ const stat = await lstat(current);
25
+ if (stat.isSymbolicLink() || !stat.isDirectory()) {
26
+ throw new Error(`Worker run directory parent must be a directory without symlinks: ${current}`);
27
+ }
28
+ } catch (error) {
29
+ if (error.code !== 'ENOENT') throw error;
30
+ if (!inProject) {
31
+ throw new Error(`Worker run directory parent does not exist: ${parent}; create it (mode 0700) before launch`);
32
+ }
33
+ await withWorkerPath(current, async target => {
34
+ try { await mkdir(target, { mode: 0o700 }); } catch (error) {
35
+ if (error.code !== 'EEXIST') throw error;
36
+ }
37
+ const stat = await lstat(target);
38
+ if (stat.isSymbolicLink() || !stat.isDirectory()) {
39
+ throw new Error(`Worker run directory parent must be a directory without symlinks: ${current}`);
40
+ }
41
+ });
42
+ }
43
+ }
44
+ await withWorkerPath(runDir, target => mkdir(target, { mode: 0o700 }));
45
+ }
@@ -25,10 +25,18 @@ export function resetRecordedWorkerUnit(outcome, native, { spawn = spawnSync, lo
25
25
  try {
26
26
  const client = resolveSystemdClient('systemctl');
27
27
  const options = { encoding: 'utf8', timeout: 500, killSignal: 'SIGKILL', env: buildSystemdClientEnv({ envNames: [] }) };
28
- const shown = spawn(client, ['--user', 'show', '-p', 'Description', '--value', '--', owner.unit], options);
28
+ const shown = spawn(client, ['--user', 'show', '-p', 'LoadState', '-p', 'Description', '--', owner.unit], options);
29
29
  if (shown.error || shown.status !== 0) throw new Error(shown.error?.message ?? (String(shown.stderr ?? '').trim() || 'ownership query failed'));
30
+ const properties = Object.fromEntries(String(shown.stdout ?? '').trim().split('\n').map(line => {
31
+ const separator = line.indexOf('=');
32
+ return [line.slice(0, separator), line.slice(separator + 1)];
33
+ }));
34
+ if (properties.LoadState === 'not-found') {
35
+ owners.delete(outcome?.child ?? outcome);
36
+ return true;
37
+ }
30
38
  // A failed submission may have collided with somebody else's existing unit.
31
- if (String(shown.stdout ?? '').trim() !== owner.description) {
39
+ if (properties.Description !== owner.description) {
32
40
  owners.delete(outcome?.child ?? outcome);
33
41
  throw new Error('unit ownership does not match this launch');
34
42
  }
@@ -0,0 +1,164 @@
1
+ // Expose the installed trusted verifier through the existing worker-run CLI.
2
+ import { prepareDeliveryRecord, lookupDeliveryRecord } from './worker-delivery-record.mjs';
3
+ import { deliverTypedStop } from './typed-stop-delivery.mjs';
4
+ import { createHash } from 'node:crypto';
5
+ import { closeSync, lstatSync, mkdtempSync, readSync, realpathSync, renameSync, rmSync, writeFileSync } from 'node:fs';
6
+ import { basename, dirname, relative, sep, isAbsolute, join } from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { importImpl } from '../../_resolve-impl.mjs';
9
+ import { boundedPrivateRead } from './worker-inputs.mjs';
10
+ import { verifyRetryPredecessor } from '../session-launcher.mjs';
11
+ import { pinArtifact, resolveWorktreeRoot, verifyWorkerArtifact } from './trusted-verification.mjs';
12
+ import { missingRequiredCapabilities, probeVerificationIsolationCapabilities } from './verification-isolation.mjs';
13
+ import { WorkerDeliveryRefusal, requireDeliveryArtifact, readDeliveryExit, prepareWorkerDeliveryGuard } from './worker-delivery-guards.mjs';
14
+
15
+ const usage = 'Usage: ralph-external --verify-worker --run-dir ABS_DIR --check JSON [--check JSON] [--artifact ABS_FILE] [--deliverable ABS_FILE] [--check-descendants] [--json] (lookup: --verify-worker --delivery-status --deliverable ABS_FILE --json)';
16
+ const checkKeys = new Set(['id', 'command', 'args', 'cwd', 'envNames', 'timeoutMs']);
17
+ const absolute = value => typeof value === 'string' && isAbsolute(value) && !value.includes('\0');
18
+
19
+ export function parseWorkerVerificationArgs(args) {
20
+ const result = { checks: [], json: false };
21
+ const seen = new Set();
22
+ for (let i = 0; i < args.length; i++) {
23
+ const flag = args[i];
24
+ if (flag !== '--check' && seen.has(flag)) throw new Error(`Duplicate verification option: ${flag}`);
25
+ seen.add(flag);
26
+ if (flag === '--verify-worker') continue;
27
+ if (flag === '--check-descendants') { result.checkDescendants = true; continue; }
28
+ if (flag === '--delivery-status') { result.deliveryStatus = true; continue; }
29
+ if (flag === '--json') { result.json = true; continue; }
30
+ if (!['--run-dir', '--artifact', '--deliverable', '--check'].includes(flag)) throw new Error(`Unsupported verification option: ${flag}`);
31
+ const value = args[++i];
32
+ if (!value || value.startsWith('--')) throw new Error(`${flag} requires a value`);
33
+ if (flag !== '--check') {
34
+ if (!absolute(value)) throw new Error(`${flag} requires an absolute NUL-free path`);
35
+ result[flag === '--run-dir' ? 'runDir' : flag === '--artifact' ? 'artifactPath' : 'deliverablePath'] = value;
36
+ continue;
37
+ }
38
+ if (Buffer.byteLength(value) > 65536 || result.checks.length >= 32) throw new Error('Protected check input exceeds bounds');
39
+ const check = JSON.parse(value);
40
+ if (!check || Array.isArray(check) || typeof check !== 'object' || Object.keys(check).some(key => !checkKeys.has(key))
41
+ || typeof check.id !== 'string' || !check.id || result.checks.some(entry => entry.id === check.id)
42
+ || !absolute(check.command) || check.args !== undefined && (!Array.isArray(check.args) || check.args.some(arg => typeof arg !== 'string' || arg.includes('\0')))
43
+ || check.cwd !== undefined && !absolute(check.cwd)
44
+ || check.envNames !== undefined && (!Array.isArray(check.envNames) || check.envNames.some(name => typeof name !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)))
45
+ || check.timeoutMs !== undefined && (!Number.isSafeInteger(check.timeoutMs) || check.timeoutMs <= 0 || check.timeoutMs > 86400000)) {
46
+ throw new Error('Invalid protected check: require a unique id, absolute command, and optional args/cwd/envNames/timeoutMs; isolation overrides are forbidden');
47
+ }
48
+ result.checks.push(check);
49
+ }
50
+ if (!seen.has('--verify-worker') || (result.deliveryStatus ? !result.deliverablePath || result.runDir || result.checks.length || result.artifactPath || result.checkDescendants : !result.runDir || !result.checks.length)) throw new Error(usage);
51
+ return result;
52
+ }
53
+
54
+ // Publish only bytes matching this verifier call's acceptance; logs are never authority.
55
+ export function deliverVerifiedArtifact(result, { artifactPath, deliverablePath, worktreeRoot, writableRoots = [] }) {
56
+ if (result.status !== 'accepted' || !deliverablePath) return;
57
+ const root = resolveWorktreeRoot(worktreeRoot);
58
+ const parent = realpathSync(dirname(deliverablePath));
59
+ const destination = join(parent, basename(deliverablePath));
60
+ for (const tree of [root, ...writableRoots]) {
61
+ const rel = relative(realpathSync(tree), destination);
62
+ if (rel === '' || rel !== '..' && !rel.startsWith('..' + sep) && !isAbsolute(rel)) {
63
+ throw new Error('--deliverable must be outside worker-writable roots');
64
+ }
65
+ }
66
+ let existing;
67
+ try { existing = lstatSync(destination); } catch (error) { if (error.code !== 'ENOENT') throw error; }
68
+ if (existing && (!existing.isFile() || existing.nlink !== 1)) throw new Error('--deliverable must be a regular non-linked file or an absent path');
69
+ const pinned = pinArtifact(root, artifactPath);
70
+ let bytes;
71
+ try {
72
+ // Bounded by pinArtifact's size limit, plus one byte to detect growth.
73
+ const buffer = Buffer.alloc(pinned.stat.size + 1);
74
+ let offset = 0, count;
75
+ while (offset < buffer.length && (count = readSync(pinned.fd, buffer, offset, buffer.length - offset, offset)) > 0) offset += count;
76
+ bytes = buffer.subarray(0, offset);
77
+ if (`sha256:${createHash('sha256').update(bytes).digest('hex')}` !== result.artifactDigest) {
78
+ throw new Error('artifact digest changed after acceptance; refusing --deliverable');
79
+ }
80
+ } finally { closeSync(pinned.fd); }
81
+ const staging = mkdtempSync(join(parent, '.aiwg-deliver-'));
82
+ try {
83
+ const staged = join(staging, 'artifact');
84
+ writeFileSync(staged, bytes, { flag: 'wx', mode: 0o600 });
85
+ renameSync(staged, destination);
86
+ } finally { rmSync(staging, { recursive: true, force: true }); }
87
+ }
88
+
89
+ export async function verifyWorkerRun(request, dependencies = {}) {
90
+ if (Object.hasOwn(request, 'typedStop')) return deliverTypedStop(request, { ...dependencies, prepareRecord: dependencies.prepareRecord ?? prepareDeliveryRecord });
91
+ try { return await verifyWorkerRunRequest(request, dependencies); }
92
+ catch (error) {
93
+ if (!(error instanceof WorkerDeliveryRefusal)) throw error;
94
+ return { status: 'rejected', verifierId: 'trusted-verification@1', runnerRef: new URL('./trusted-verification.mjs', import.meta.url).href,
95
+ artifactDigest: null, evidence: [], findings: [error.message], errorCode: error.code,
96
+ controlledContext: 'publication request refused before protected checks', isolation: { mode: 'n/a', degraded: [] } };
97
+ }
98
+ }
99
+
100
+ async function verifyWorkerRunRequest({ runDir, checks, artifactPath, deliverablePath, checkDescendants = false, projectDir = process.cwd() }, { prepareRecord = prepareDeliveryRecord } = {}) {
101
+ const { inspectWorkerPath: inspect } = await importImpl(import.meta.url, 'serve/worker-invocation-paths.js');
102
+ const record = JSON.parse((await boundedPrivateRead(join(runDir, 'invocation.json'), 1048576, inspect, true, true)).toString('utf8'));
103
+ const worktreeRoot = record.worktree?.path;
104
+ if (deliverablePath) requireDeliveryArtifact(artifactPath, record.paths?.final);
105
+ artifactPath ??= record.paths?.final;
106
+ if (!absolute(worktreeRoot) || !absolute(artifactPath)) throw new Error('Launcher record requires absolute worktree and artifact paths');
107
+ // Independently loaded installed qualifications own writable roots; the record
108
+ // being authenticated cannot declare the only roots used to authenticate it.
109
+ const { loadWorkerInputs } = await importImpl(import.meta.url, 'cli/handlers/models.js');
110
+ const inputs = await loadWorkerInputs({ cwd: projectDir, args: [], rawArgs: [],
111
+ frameworkRoot: fileURLToPath(new URL('../../../', import.meta.url)) });
112
+ const writableRoots = Object.values(inputs.drivers).flatMap(driver => driver.qualification.installation?.workerWritableRoots ?? []);
113
+ if (!writableRoots.length) throw new Error('Trusted worker installation writable roots are required; run verification from the configured conductor project');
114
+ // Reuse the launcher's owned-record and confirmed-stop checks. Never run checks
115
+ // concurrently with a worker, or read check definitions out of worker metadata.
116
+ const exit = deliverablePath ? await readDeliveryExit(runDir, inspect) : null;
117
+ await verifyRetryPredecessor({ runDir, invocationId: record.invocationId }, { inspect, workerWritableRoots: [worktreeRoot, ...writableRoots], checkDescendants });
118
+ const guardArtifact = deliverablePath ? await prepareWorkerDeliveryGuard({ worktreeRoot, artifactPath, finalPath: record.paths?.final, checks, exit, inspect }) : undefined;
119
+ const capabilities = probeVerificationIsolationCapabilities();
120
+ const missing = missingRequiredCapabilities(capabilities);
121
+ const runnerRef = new URL('./trusted-verification.mjs', import.meta.url).href;
122
+ if (capabilities.mode !== 'systemd-unit' || missing.length) {
123
+ return { status: 'blocked', verifierId: 'trusted-verification@1', runnerRef, artifactDigest: null, evidence: [],
124
+ findings: [`ISOLATION_UNAVAILABLE: required verification isolation is unavailable (${missing.join(', ')}); use a host with enforced write/home/network confinement`],
125
+ controlledContext: 'protected checks refused before execution', isolation: { mode: capabilities.mode, degraded: capabilities.degraded }, errorCode: 'ISOLATION_UNAVAILABLE' };
126
+ }
127
+ // CLI arguments are conductor-owned protected definitions. Register exactly
128
+ // their binaries, never a manifest, PATH search, directory or worker claim.
129
+ const result = verifyWorkerArtifact({ worktreeRoot, artifactPath, checks, guardArtifact,
130
+ allowedCheckBinaries: checks.map(check => check.command), runnerRef });
131
+ if (result.status === 'accepted' && deliverablePath) {
132
+ const complete = await prepareRecord(projectDir, { artifactDigest: result.artifactDigest, deliverablePath,
133
+ verifierId: result.verifierId, runDir, invocationId: record.invocationId });
134
+ deliverVerifiedArtifact(result, { artifactPath, deliverablePath, worktreeRoot, writableRoots });
135
+ result.deliveryRecord = await complete();
136
+ }
137
+ return result;
138
+ }
139
+
140
+ export async function runWorkerVerificationCli(args, { stdout = console.log, stderr = console.error } = {}) {
141
+ let result;
142
+ try {
143
+ const request = parseWorkerVerificationArgs(args);
144
+ if (request.deliveryStatus) {
145
+ const delivery = await lookupDeliveryRecord(process.cwd(), request.deliverablePath);
146
+ stdout(args.includes('--json') ? JSON.stringify(delivery) : `Deliverable: ${delivery.verified ? 'verified' : 'unverified'}`);
147
+ return delivery.verified ? 0 : 1;
148
+ }
149
+ result = await verifyWorkerRun(request);
150
+ } catch (error) {
151
+ result = { status: 'rejected', verifierId: 'trusted-verification@1', runnerRef: new URL('./trusted-verification.mjs', import.meta.url).href,
152
+ artifactDigest: null, evidence: [], findings: [error.message], errorCode: 'VERIFICATION_REQUEST_FAILED',
153
+ controlledContext: 'verification request refused', isolation: { mode: 'n/a', degraded: [] } };
154
+ }
155
+ const exitCode = result.status === 'accepted' ? 0 : result.status === 'blocked' ? 2 : 1;
156
+ const output = { version: 1, kind: 'worker-verification', ...result, exitCode };
157
+ if (args.includes('--json')) stdout(JSON.stringify(output));
158
+ else {
159
+ stdout(`Worker verification: ${result.status}`);
160
+ for (const finding of result.findings) stdout(finding);
161
+ }
162
+ if (exitCode) stderr(`Worker verification ${result.status}: ${result.errorCode ?? result.findings.join('; ')}`);
163
+ return exitCode;
164
+ }