@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
@@ -1,4 +1,4 @@
1
- // Refuse local-only reads and direct execution of worker output by the conductor.
1
+ // Refuse local-only reads and unverified worker execution/integration by the conductor.
2
2
  import { realpathSync, readFileSync, readdirSync, statSync } from 'node:fs';
3
3
  import { resolve, dirname, relative, isAbsolute, sep, matchesGlob, basename } from 'node:path';
4
4
 
@@ -27,7 +27,7 @@ const contains = (base, file) => relative(base, file) === ''
27
27
 
28
28
  // Retain quoting for glob characters, but never execute shell expansions or substitutions.
29
29
  const literalPattern = value => value.replace(/[*?\[\]{}()!+@]/g, char => char === ']' ? ']' : `[${char}]`);
30
- function shellCommands(command) {
30
+ function shellCommands(command, retainTransfers = false) {
31
31
  const commands = [];
32
32
  let words = [], value = '', pattern = '', glob = false, quote = null;
33
33
  const word = () => {
@@ -50,7 +50,14 @@ function shellCommands(command) {
50
50
  if (char === quote) quote = null;
51
51
  else append(char, false);
52
52
  } else if (char === "'" || char === '"') quote = char;
53
- else if (/[;&|<>()`\n]/.test(char)) end();
53
+ else if (retainTransfers && /[|<>]/.test(char)) {
54
+ word();
55
+ let operator = char;
56
+ if (command[index + 1] === char) operator += command[++index];
57
+ // `2>&1` / `<&3` duplicate a descriptor; the following word is a descriptor, not a path.
58
+ else if (/[<>]/.test(char) && command[index + 1] === '&') operator += command[++index];
59
+ words.push({ value: operator, operator: true });
60
+ } else if (/[;&|<>()`\n]/.test(char)) end();
54
61
  else if (/\s/.test(char)) word();
55
62
  else append(char, true);
56
63
  }
@@ -166,14 +173,50 @@ export function conductorWorkerTrees(root) {
166
173
  }
167
174
 
168
175
  const workerExecutionDenial = 'AIWG: conductor must not execute or import worker-written code; use aiwg ralph-external --verify-worker instead';
176
+ const workerIntegrationDenial = 'AIWG: conductor must not integrate unverified worker bytes, execute or import worker-written code, or edit worker paths; use aiwg ralph-external --verify-worker --run-dir ABS_DIR --artifact ABS_FILE --check JSON --deliverable ABS_FILE. Only accepted bytes are delivered; blocked/rejected results never authorize integration. Shell coverage is limited; Write/Edit content copied from a Read is not detected.';
169
177
  const runtime = /^(?:node(?:js)?|python(?:\d+(?:\.\d+)*)?|npm|npx|pnpm|yarn|bun|deno|vitest|jest|pytest|py\.test|mocha|ava|tap|tsx|ts-node|make|cmake|ctest|cargo|go|ruby|perl|php|java)$/;
170
178
  const shells = new Set(['sh', 'bash', 'dash', 'zsh']);
171
179
  const wrappers = new Set(['env', 'nice', 'timeout', 'systemd-run', 'sudo', 'command', 'exec', 'nohup']);
172
180
  const wrapperValues = new Set(['-n', '--adjustment', '-p', '--property', '-u', '--user', '-g', '--group',
173
181
  '-C', '--chdir', '--working-directory', '--unit', '--description', '--slice', '--kill-after', '-k', '-s', '--signal']);
174
182
 
183
+ // Recognize transfer operands without interpreting expansions or running worker code.
184
+ function transferPaths(args) {
185
+ const operands = [];
186
+ let target, options = true;
187
+ for (let i = 0; i < args.length; i++) {
188
+ const arg = args[i];
189
+ if (options && arg === '--') { options = false; continue; }
190
+ if (options && arg.startsWith('-')) {
191
+ const [option, assigned] = arg.split('=');
192
+ if (['-t', '--target-directory'].includes(option)) target = assigned ?? args[++i];
193
+ else if (['-m', '--mode', '-o', '--owner', '-g', '--group', '--suffix', '-S', '-e', '--rsh', '--exclude', '--include'].includes(option)
194
+ && assigned === undefined) i++;
195
+ continue;
196
+ }
197
+ operands.push(arg);
198
+ }
199
+ return { sources: target ? operands : operands.slice(0, -1), destination: target ?? operands.at(-1) };
200
+ }
201
+
202
+ // Preserve command boundaries for execution checks and carry data only across pipes.
203
+ function transferCommands(command) {
204
+ const result = [];
205
+ for (const group of shellCommands(command, true)) {
206
+ let words = [];
207
+ for (const token of group) {
208
+ if (token.operator && ['|', '||'].includes(token.value)) {
209
+ if (words.length) result.push({ words, pipe: token.value === '|' });
210
+ words = [];
211
+ } else words.push(token);
212
+ }
213
+ if (words.length) result.push({ words, pipe: false });
214
+ }
215
+ return result;
216
+ }
217
+
175
218
  function workerExecution(command, initialCwd, trees, depth = 0) {
176
- if (depth > 4) return true;
219
+ if (depth > 4) return workerExecutionDenial;
177
220
  const protectedTrees = trees.flatMap(tree => [resolve(tree), canonical(resolve(tree))]);
178
221
  const copies = [];
179
222
  let cwd = initialCwd;
@@ -183,7 +226,8 @@ function workerExecution(command, initialCwd, trees, depth = 0) {
183
226
  };
184
227
  const references = value => (value.match(/[^\s"'`;&|<>()\[\]{},]+/g) ?? [])
185
228
  .some(token => untrusted(token.split('=').at(-1)));
186
- for (const words of shellCommands(command)) {
229
+ let pipedSource = false;
230
+ for (const { words, pipe } of transferCommands(command)) {
187
231
  let index = 0;
188
232
  while (/^[A-Za-z_][A-Za-z0-9_]*=/.test(words[index]?.value ?? '')) index++;
189
233
  let name = basename(words[index]?.value ?? '');
@@ -206,30 +250,49 @@ function workerExecution(command, initialCwd, trees, depth = 0) {
206
250
  name = basename(words[index]?.value ?? '');
207
251
  }
208
252
  const args = words.slice(index + 1).map(word => word.value);
253
+ // AIWG's own output (resolve plans, status JSON) is product output even when its
254
+ // arguments name worker-tree paths; only worker file bytes are transfer sources (#4122).
255
+ // The command name and option flags are not paths, even when cwd is inside a worker tree.
256
+ const workerSource = name !== 'aiwg' && (pipedSource || words.some((word, cursor) => !word.operator
257
+ && cursor > index && !word.value.startsWith('-')
258
+ && (untrusted(word.value) || globReferences(word, cwd, protectedTrees))
259
+ && !['>', '>>', '>&', '<&'].includes(words[cursor - 1]?.value)
260
+ && !(/^\d+$/.test(word.value) && /^[<>]/.test(words[cursor + 1]?.value ?? ''))));
261
+ pipedSource = pipe && workerSource;
209
262
  if (name === 'cd') {
210
263
  const target = args.find(arg => arg !== '--' && arg !== '-P' && arg !== '-L');
211
264
  if (target) cwd = resolve(cwd, target);
212
265
  continue;
213
266
  }
214
- if (['cp', 'mv', 'install'].includes(name)) {
215
- const operands = args.filter(arg => !arg.startsWith('-'));
216
- const destination = operands.at(-1);
217
- for (const source of operands.slice(0, -1)) if (destination && untrusted(source)) {
267
+ if (['cp', 'mv', 'install', 'rsync'].includes(name)) {
268
+ const { sources, destination } = transferPaths(args);
269
+ // Globs and directory operands cannot establish an accepted single-file digest.
270
+ if (destination && !untrusted(destination) && (workerSource || sources.some(source =>
271
+ protectedTrees.some(tree => contains(canonical(resolve(cwd, source)), tree))))) return workerIntegrationDenial;
272
+ for (const source of sources) if (destination && untrusted(source)) {
218
273
  copies.push(resolve(cwd, destination), resolve(cwd, destination, basename(source)));
219
274
  }
220
275
  continue;
221
276
  }
222
- if (words[index]?.value.includes('/') && untrusted(words[index].value)) return true;
277
+ // Keep a pipeline together so `cat worker | tee dest` and input redirection
278
+ // carry the worker source through to the destination. Never inspect contents.
279
+ const output = words.some((word, cursor) => ['>', '>>'].includes(word.value)
280
+ && words[cursor + 1] && !untrusted(words[cursor + 1].value));
281
+ const tee = name === 'tee' && words.slice(index + 1)
282
+ .some(arg => !arg.operator && !arg.value.startsWith('-') && !untrusted(arg.value));
283
+ if (workerSource && (output || tee) && !(name === 'aiwg' && args.includes('--verify-worker'))) return workerIntegrationDenial;
284
+ if (words[index]?.value.includes('/') && untrusted(words[index].value)) return workerExecutionDenial;
223
285
  if (shells.has(name)) {
224
286
  const inline = args.findIndex(arg => /^-[^-]*c/.test(arg));
225
287
  if (inline >= 0 && args[inline + 1] !== undefined) {
226
- if (workerExecution(args[inline + 1], cwd, [...protectedTrees, ...copies], depth + 1)) return true;
288
+ const reason = workerExecution(args[inline + 1], cwd, [...protectedTrees, ...copies], depth + 1);
289
+ if (reason) return reason;
227
290
  continue;
228
291
  }
229
292
  }
230
- if ((runtime.test(name) || shells.has(name)) && (untrusted('.') || words.some(word => references(word.value)))) return true;
293
+ if ((runtime.test(name) || shells.has(name)) && (untrusted('.') || words.some(word => references(word.value)))) return workerExecutionDenial;
231
294
  }
232
- return false;
295
+ return null;
233
296
  }
234
297
 
235
298
  export function conductorToolDenial(event, root, paths, workerTrees = conductorWorkerTrees(root)) {
@@ -242,8 +305,14 @@ export function conductorToolDenial(event, root, paths, workerTrees = conductorW
242
305
  return protectedPaths.some(base => contains(base, file) || contains(base, canonical(file)));
243
306
  };
244
307
  if ([input.file_path, input.path].some(denied)) return 'AIWG: local-only task input is unavailable to this conductor';
308
+ if (workerTrees.length && ['Write', 'Edit', 'MultiEdit'].includes(event.tool_name)
309
+ && [input.file_path, input.path].some(candidate => typeof candidate === 'string'
310
+ && workerTrees.some(tree => contains(canonical(resolve(tree)), canonical(resolve(cwd, candidate)))
311
+ // Rule 9: the conductor writes the worker brief under the worker tree's .handoff/ before launch.
312
+ && !contains(canonical(resolve(tree, '.handoff')), canonical(resolve(cwd, candidate)))))) return workerIntegrationDenial;
245
313
  if (typeof input.command === 'string') {
246
- if (workerTrees.length && workerExecution(input.command, cwd, workerTrees)) return workerExecutionDenial;
314
+ const reason = workerTrees.length && workerExecution(input.command, cwd, workerTrees);
315
+ if (reason) return reason;
247
316
  // Covers literal/quoted paths, compound commands and common redirections. This is
248
317
  // deliberately conservative, not a shell interpreter or a filesystem sandbox.
249
318
  const command = input.command;
@@ -3,8 +3,8 @@ import { workerDispatchBlocked, isWorkerMaintenance, workerRecoveryDiagnostic }
3
3
  * Model Configuration Loader
4
4
  * Loads and merges model configurations from multiple sources with proper precedence
5
5
  *
6
- * @implements @.aiwg/architecture/ADR-015-enhanced-model-selection.md
7
- * @architecture @.aiwg/architecture/enhanced-model-selection-design.md
6
+ * @implements @docs/models/supported-models.md
7
+ * @architecture @docs/models/supported-models.md
8
8
  */
9
9
  import { readFile } from 'fs/promises';
10
10
  import { dirname, resolve } from 'path';
@@ -7,8 +7,8 @@
7
7
  * - Hierarchical configuration (default < user < project < agent)
8
8
  * - Backwards compatibility with v1 configs
9
9
  *
10
- * @implements @.aiwg/architecture/ADR-015-enhanced-model-selection.md
11
- * @architecture @.aiwg/architecture/enhanced-model-selection-design.md
10
+ * @implements @docs/models/supported-models.md
11
+ * @architecture @docs/models/supported-models.md
12
12
  *
13
13
  * @module models
14
14
  */
@@ -0,0 +1,155 @@
1
+ import { buildWorkerObservation, discoveryDigest, runModelDiscoveryCommand } from './model-discovery.js';
2
+ import { loadProviderModelCapabilities } from './provider-policy.js';
3
+ import { normalizeWorkerVersionBanner, workerVersionProbeEnvironment } from './worker-installation.mjs';
4
+ /** Reject credentials and redirect destinations before issuing any request. */
5
+ export function localModelsUrl(source) {
6
+ const url = new URL(source.endpoint);
7
+ if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
8
+ throw new Error('host-denied');
9
+ }
10
+ if (!['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname)
11
+ && !source.allowedHosts?.includes(url.hostname))
12
+ throw new Error('host-denied');
13
+ url.pathname = `${url.pathname.replace(/\/+$/, '')}/models`;
14
+ return url;
15
+ }
16
+ /** Failures are typed observations; response bodies and credential values never escape. */
17
+ export async function discoverLocalEndpointModels(options) {
18
+ const { source } = options;
19
+ const observedAt = (options.now?.() ?? new Date()).toISOString();
20
+ let reason;
21
+ let ids = new Set();
22
+ try {
23
+ const url = localModelsUrl(source);
24
+ const token = source.authEnv ? (options.env ?? process.env)[source.authEnv] : undefined;
25
+ if (source.authEnv && !token)
26
+ reason = 'auth-env-missing';
27
+ else {
28
+ const response = await (options.fetchImpl ?? fetch)(url, { redirect: 'error',
29
+ headers: { accept: 'application/json', ...(token ? { authorization: `Bearer ${token}` } : {}) },
30
+ signal: AbortSignal.timeout(Math.min(30000, Math.max(1, source.timeoutMs ?? 3000))) });
31
+ if (response.status === 401 || response.status === 403)
32
+ reason = 'unauthorized';
33
+ else if (!response.ok)
34
+ reason = 'endpoint-down';
35
+ else {
36
+ // Bound response bytes as well as elapsed time, including chunked responses.
37
+ const reader = response.body?.getReader();
38
+ if (!reader)
39
+ throw new Error('invalid-response');
40
+ const chunks = [];
41
+ let bytes = 0;
42
+ try {
43
+ for (;;) {
44
+ const part = await reader.read();
45
+ if (part.done)
46
+ break;
47
+ bytes += part.value.byteLength;
48
+ if (bytes > 1024 * 1024)
49
+ throw new Error('invalid-response');
50
+ chunks.push(part.value);
51
+ }
52
+ }
53
+ finally {
54
+ await reader.cancel().catch(() => { });
55
+ }
56
+ const payload = JSON.parse(Buffer.concat(chunks).toString('utf8'));
57
+ if (!Array.isArray(payload?.data) || payload.data.some((row) => !row || typeof row.id !== 'string'))
58
+ throw new Error('invalid-response');
59
+ ids = new Set(payload.data.map((row) => row.id));
60
+ }
61
+ }
62
+ }
63
+ catch (error) {
64
+ const name = error.name;
65
+ reason = name === 'TimeoutError' || name === 'AbortError' ? 'timeout'
66
+ : error.message === 'host-denied' ? 'host-denied'
67
+ : error instanceof SyntaxError || error.message === 'invalid-response' ? 'invalid-response' : 'endpoint-down';
68
+ }
69
+ const models = source.models.map(declared => {
70
+ const unavailableReason = reason ?? (!ids.has(declared.id) ? 'model-missing' : undefined);
71
+ const worker = buildWorkerObservation({ cliId: options.cli, source: 'local-endpoint',
72
+ runtimeVersion: options.runtimeVersion, accountScope: 'local-runtime', accountBinding: options.accountBinding,
73
+ observedAt, contentDigest: discoveryDigest(JSON.stringify({ declared, endpoint: source.endpoint, unavailableReason })) }, {
74
+ modelId: declared.id, family: declared.family ?? 'unknown', visibility: 'listed', lifecycle: 'active',
75
+ availability: unavailableReason ? 'unavailable' : 'accessible', contextTokens: declared.contextTokens,
76
+ maxOutputTokens: declared.maxOutputTokens, effortSupport: declared.efforts ? 'explicit' : 'not-applicable',
77
+ efforts: declared.efforts?.map(id => ({ id, selfDelegates: null })), provenanceFields: []
78
+ });
79
+ worker.endpoint = source.endpoint;
80
+ worker.checkpoint = declared.checkpoint;
81
+ if (unavailableReason)
82
+ worker.unavailableReason = unavailableReason;
83
+ // Presence is endpoint-observed; execution path and checkpoint remain operator declarations.
84
+ worker.dataUse.processing = 'local';
85
+ worker.pricing.billing = 'local';
86
+ worker.provenance[0].fields = ['/id', '/apiModelId', '/availability', '/unavailableReason', '/observedAt', '/fetchedAt'];
87
+ worker.provenance[0].source = `${source.endpoint.replace(/\/+$/, '')}/models`;
88
+ worker.provenance[0].digest = discoveryDigest(JSON.stringify({ id: declared.id, unavailableReason, observedAt }));
89
+ worker.provenance.push({ fields: ['/endpoint', '/checkpoint', '/family', '/contextTokens', '/maxOutputTokens',
90
+ '/efforts', '/effortSupport', '/dataUse/processing', '/pricing/billing'], source: `/parallelism/clis/${options.cli}/localModels`,
91
+ kind: 'operator', observedAt, digest: discoveryDigest(JSON.stringify(source)), confidence: 'reported' });
92
+ worker.evidenceDigest = discoveryDigest(JSON.stringify({ source, id: declared.id, unavailableReason }));
93
+ return { id: declared.id, apiModelId: declared.id, llmProvider: 'self-hosted', reasoningEfforts: declared.efforts ?? [], worker };
94
+ });
95
+ const failure = reason ?? (models.some(row => row.worker.unavailableReason) ? 'model-missing' : undefined);
96
+ return { provider: options.provider, source: 'local-endpoint', observedAt, runtimeVersion: options.runtimeVersion,
97
+ accountScope: 'local-runtime', accountBinding: options.accountBinding, models,
98
+ ...(failure ? { errorKind: failure === 'unauthorized' ? 'authentication' : failure === 'timeout' ? 'timeout' : 'environment',
99
+ error: `Local model observation unavailable: ${failure}` } : {}) };
100
+ }
101
+ function enabledInstallations(options) {
102
+ return Object.entries(options.parallelism?.clis ?? {}).filter(([, installation]) => installation.enabled !== false);
103
+ }
104
+ /** A provider shared by vendor and endpoint installations still needs its vendor observation. */
105
+ export function usesVendorDiscovery(provider, options) {
106
+ const installations = enabledInstallations(options).filter(([, installation]) => installation.adapter === `providers:${provider}`);
107
+ return !installations.some(([, installation]) => installation.localModels)
108
+ || installations.some(([, installation]) => !installation.localModels);
109
+ }
110
+ /** Local-only refreshes must not fetch the optional public vendor catalog. */
111
+ export function hasOnlyLocalModelSources(options) {
112
+ return enabledInstallations(options).some(([, installation]) => installation.localModels)
113
+ && !options.inventory.providers.some(provider => provider.available && usesVendorDiscovery(provider.id, options));
114
+ }
115
+ /** Merge endpoint facts into the normal catalog; its owner performs the single cache write. */
116
+ export async function mergeLocalEndpointCatalog(catalog, options, cached) {
117
+ const localInstallations = enabledInstallations(options).filter(([, installation]) => installation.localModels);
118
+ if (!localInstallations.length)
119
+ return catalog;
120
+ const discovery = catalog.discovery;
121
+ const instances = Object.fromEntries(Object.entries(discovery.instances ?? {})
122
+ .filter(([, entry]) => entry.source !== 'local-endpoint'));
123
+ for (const [cli, installation] of localInstallations) {
124
+ if (!options.allowNetwork || !options.forceRefresh) {
125
+ const prior = cached?.discovery?.instances?.[cli];
126
+ if (prior?.source === 'local-endpoint' && prior.models.every(row => row.worker?.provenance.some(entry => entry.digest === discoveryDigest(JSON.stringify(installation.localModels))))) {
127
+ instances[cli] = prior;
128
+ }
129
+ continue;
130
+ }
131
+ const provider = installation.adapter.split(':')[1];
132
+ const runtimeVersion = await localRuntimeVersion(installation, options);
133
+ instances[cli] = await discoverLocalEndpointModels({ cli, provider,
134
+ source: installation.localModels, runtimeVersion, accountBinding: installation.accountScope,
135
+ fetchImpl: options.fetchImpl, now: options.now });
136
+ }
137
+ return { ...catalog, discovery: { ...discovery, instances } };
138
+ }
139
+ async function localRuntimeVersion(installation, options) {
140
+ try {
141
+ const registry = loadProviderModelCapabilities();
142
+ const [namespace, id] = installation.adapter.split(':');
143
+ const provider = registry.providers[id];
144
+ const adapter = namespace === 'providers' ? provider?.workerAdapter ?? provider?.workerHealthAdapter
145
+ : registry.workerAdapters?.[id];
146
+ if (adapter?.invocation.kind !== 'process')
147
+ return 'unknown';
148
+ const result = await (options.runner ?? runModelDiscoveryCommand)(installation.executable ?? adapter.invocation.executable, adapter.invocation.versionArgv, { cwd: options.inventory.projectDir, timeoutMs: 3000, env: workerVersionProbeEnvironment() });
149
+ return normalizeWorkerVersionBanner(result.stdout.trim(), adapter.invocation.versionPattern);
150
+ }
151
+ catch {
152
+ return 'unknown';
153
+ }
154
+ }
155
+ //# sourceMappingURL=local-endpoint-models.js.map
@@ -1312,7 +1312,7 @@
1312
1312
  "id": "opencode-direct",
1313
1313
  "provider": "opencode",
1314
1314
  "adapterVersion": "1",
1315
- "supportedVersions": "2.0.26",
1315
+ "supportedVersions": ">=1.18.0 <2.0.0 || >=2.0.26 <3.0.0",
1316
1316
  "runtimeDriver": "installed:opencode",
1317
1317
  "catalogAdapter": {
1318
1318
  "kind": "file",
@@ -1359,27 +1359,27 @@
1359
1359
  "invocationProfiles": {
1360
1360
  "direct-shell": {
1361
1361
  "transport": "shell",
1362
- "supportedVersions": "2.0.26",
1362
+ "supportedVersions": ">=1.18.0 <2.0.0 || >=2.0.26 <3.0.0",
1363
1363
  "controls": {
1364
1364
  "model": {
1365
1365
  "support": "unqualified",
1366
- "mapping": "-m/--model (opencode run --help: '--model, -m string Model to use in the format provider/model#variant')",
1367
- "evidence": "H: opencode 2.0.26 `opencode run --help` (captured 2026-10-10, .aiwg/working/s1-scratch/cli-help/opencode-2.0.26.txt)"
1366
+ "mapping": "1.x: -m/--model provider/model with separate --variant <effort>; 2.x: -m/--model (opencode run --help: '--model, -m string Model to use in the format provider/model#variant')",
1367
+ "evidence": "H: opencode 2.0.26 `opencode run --help` (captured 2026-10-10, .aiwg/working/s1-scratch/cli-help/opencode-2.0.26.txt); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): -m, --model model to use in the format of provider/model; --variant model variant (provider-specific reasoning effort, e.g., high, max, minimal)"
1368
1368
  },
1369
1369
  "effort": {
1370
1370
  "support": "unqualified",
1371
- "mapping": "explicit effort maps to a #<variant> suffix on --model (provider/model#variant); binary disassembly of the installed CLI (the variant-builder, minified as qU(model, manual)) shows variant ids are drawn directly from each model's own capabilities.supports.reasoning_effort list (e.g. low/medium/high), or fixed ids \"max\"/\"high\" for extended-thinking models exposing max_thinking_budget instead; the valid id set is model-specific and not enumerated here, so this adapter appends a syntactically valid id and the real CLI refuses one a given model does not expose",
1372
- "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (variant-builder function, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help` ('--model, -m string Model to use in the format provider/model#variant')"
1371
+ "mapping": "1.x explicit effort maps to --variant <effort>; 2.x explicit effort maps to a #<variant> suffix on --model (provider/model#variant); binary disassembly of the installed CLI (the variant-builder, minified as qU(model, manual)) shows variant ids are drawn directly from each model's own capabilities.supports.reasoning_effort list (e.g. low/medium/high), or fixed ids \"max\"/\"high\" for extended-thinking models exposing max_thinking_budget instead; the valid id set is model-specific and not enumerated here, so this adapter appends a syntactically valid id and the real CLI refuses one a given model does not expose",
1372
+ "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (variant-builder function, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help` ('--model, -m string Model to use in the format provider/model#variant'); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --variant model variant (provider-specific reasoning effort, e.g., high, max, minimal)"
1373
1373
  },
1374
1374
  "sandbox": {
1375
1375
  "support": "unqualified",
1376
1376
  "mapping": "unavailable: no scoped sandbox flag on 'run'; the only permission-adjacent flag is --auto, a blanket approval bypass this profile never emits",
1377
- "evidence": "H: opencode 2.0.26 `opencode run --help` ('--auto Auto-approve permissions that are not explicitly denied')"
1377
+ "evidence": "H: opencode 2.0.26 `opencode run --help` ('--auto Auto-approve permissions that are not explicitly denied'); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --auto auto-approve permissions that are not explicitly denied"
1378
1378
  },
1379
1379
  "approval": {
1380
1380
  "support": "unqualified",
1381
1381
  "mapping": "--auto ('Auto-approve permissions that are not explicitly denied') is a blanket bypass and is refused by policy; what a permission request does without --auto in non-interactive `run` is not independently confirmed: binary disassembly shows a shared permission.asked/permission.replied protocol where an unanswered request resolves to a \"reject\" outcome (`_===\"once\"||_===\"always\"?_:\"reject\"`, with requestPermission(...).catch(()=>{return}) on no responder), but that path is traced through the ACP/session-protocol layer, not reproduced against plain `run`, so this stays unavailable rather than asserted",
1382
- "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (permission.asked/permission.replied reject-on-no-answer pattern, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help`"
1382
+ "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (permission.asked/permission.replied reject-on-no-answer pattern, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help`; H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --auto auto-approve permissions that are not explicitly denied"
1383
1383
  },
1384
1384
  "workdir": {
1385
1385
  "support": "unqualified",
@@ -1389,7 +1389,7 @@
1389
1389
  "finalOutput": {
1390
1390
  "support": "unqualified",
1391
1391
  "mapping": "no --output/-o flag and no positive whole-run terminal event (binary disassembly: the run loop returns silently on session.execution.succeeded, in any mode); the final answer is the captured stdout --format json JSONL stream, accepted only when every line parses, no error event occurs, any present step_finish says \"stop\", and at least one text part has a recorded part.time.end (or a stop step_finish substitutes for that) -- a live 2.0.26 run confirmed a clean single-text-event stream with no step_start/step_finish at all",
1392
- "evidence": "H: opencode 2.0.26 `opencode run --help` ('--format choice Output format (choices: default, json)')"
1392
+ "evidence": "H: opencode 2.0.26 `opencode run --help` ('--format choice Output format (choices: default, json)'); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --format default|json"
1393
1393
  },
1394
1394
  "stdin": {
1395
1395
  "support": "unqualified",
@@ -8,6 +8,7 @@ import { dirname, join, relative } from 'node:path';
8
8
  import { constants } from 'node:fs';
9
9
  import { homedir, tmpdir } from 'node:os';
10
10
  import { stripVTControlCharacters } from 'node:util';
11
+ import { mergeLocalEndpointCatalog, usesVendorDiscovery, hasOnlyLocalModelSources } from './local-endpoint-models.js';
11
12
  export const PROVIDER_DISCOVERY_DECISIONS = {
12
13
  claude: {
13
14
  provider: 'claude',
@@ -579,7 +580,7 @@ export async function resolveDynamicModelCatalog(options) {
579
580
  && (!options.codex?.accountBinding || cached.discovery?.providers.codex?.accountBinding === options.codex.accountBinding)
580
581
  && (!options.muse?.accountBinding || cached.discovery?.providers.muse?.accountBinding === options.muse.accountBinding)
581
582
  && isFresh(cached, now, options.ttlMs ?? DEFAULT_TTL_MS, signature)) {
582
- return {
583
+ return mergeLocalEndpointCatalog({
583
584
  ...cached,
584
585
  discovery: cached.discovery
585
586
  ? {
@@ -590,10 +591,10 @@ export async function resolveDynamicModelCatalog(options) {
590
591
  : cached.discovery.source,
591
592
  }
592
593
  : undefined,
593
- };
594
+ }, options, cached);
594
595
  }
595
596
  if (!options.allowNetwork && !options.nativeDiscoverers) {
596
- return {
597
+ return mergeLocalEndpointCatalog({
597
598
  ...staticCatalog,
598
599
  discovery: {
599
600
  source: 'static',
@@ -602,9 +603,9 @@ export async function resolveDynamicModelCatalog(options) {
602
603
  providers: {},
603
604
  ...(staticCatalog.discovery?.instances ? { instances: staticCatalog.discovery.instances } : {}),
604
605
  },
605
- };
606
+ }, options, cached);
606
607
  }
607
- const remoteUrl = options.remoteUrl ?? process.env.AIWG_MODEL_CATALOG_URL;
608
+ const remoteUrl = hasOnlyLocalModelSources(options) ? undefined : options.remoteUrl ?? process.env.AIWG_MODEL_CATALOG_URL;
608
609
  let catalog = staticCatalog;
609
610
  let source = 'static';
610
611
  let remoteError;
@@ -650,6 +651,8 @@ export async function resolveDynamicModelCatalog(options) {
650
651
  };
651
652
  const providerDiscovery = {};
652
653
  for (const provider of available) {
654
+ if (!usesVendorDiscovery(provider, options))
655
+ continue;
653
656
  const discoverer = nativeDiscoverers[provider];
654
657
  if (discoverer) {
655
658
  try {
@@ -755,6 +758,7 @@ export async function resolveDynamicModelCatalog(options) {
755
758
  for (const entry of Object.values(providerDiscovery)) {
756
759
  resolved = recordAccountInstance(resolved, discoveryInstanceId(entry), entry);
757
760
  }
761
+ resolved = await mergeLocalEndpointCatalog(resolved, options, cached);
758
762
  await atomicWrite(cacheFile, `${JSON.stringify(resolved, null, 2)}\n`);
759
763
  return resolved;
760
764
  }
@@ -0,0 +1,16 @@
1
+ // Render OpenCode model/effort arguments for the qualified distribution line.
2
+ import { workerVersionRangeMismatch } from './worker-installation.mjs';
3
+ import { major } from 'semver';
4
+
5
+ export const OPENCODE_SUPPORTED_VERSIONS = Object.freeze(['>=1.18.0 <2.0.0', '>=2.0.26 <3.0.0']);
6
+
7
+ export function opencodeWorkerModelArgs(model, effort, cliVersion) {
8
+ if (typeof cliVersion !== 'string'
9
+ || workerVersionRangeMismatch(cliVersion, [OPENCODE_SUPPORTED_VERSIONS.join(' || ')]) !== null) {
10
+ throw new Error('OpenCode worker requires a supported installed CLI version');
11
+ }
12
+ if (major(cliVersion) === 1) {
13
+ return ['-m', model, ...(effort === null ? [] : ['--variant', effort])];
14
+ }
15
+ return ['-m', effort === null ? model : `${model}#${effort}`];
16
+ }
@@ -2,8 +2,8 @@
2
2
  * Model Resolver
3
3
  * Resolves agent names and roles to concrete model identifiers using tier system
4
4
  *
5
- * @implements @.aiwg/architecture/ADR-015-enhanced-model-selection.md
6
- * @architecture @.aiwg/architecture/enhanced-model-selection-design.md
5
+ * @implements @docs/models/supported-models.md
6
+ * @architecture @docs/models/supported-models.md
7
7
  */
8
8
  import { normalizeModelTier, TIER_ORDER, flagshipElected, isFlagshipModel } from './tiers.js';
9
9
  import { compileModelPolicy } from './provider-policy.js';
@@ -201,7 +201,7 @@ export async function prepareInstalledWorkerInvocation(instance, invocation, qua
201
201
  const expectedArtifacts = typeof instance.buildWorkerArtifacts === 'function'
202
202
  ? instance.buildWorkerArtifacts({ ...driverInput, permissions: qualification.permissions }) : undefined;
203
203
  if (JSON.stringify(expectedArtifacts) !== JSON.stringify(result.artifacts)) throw new WorkerPolicyError('OG_PIN_MISMATCH', 'Worker artifacts differ from authorized driver mapping');
204
- const workerArgs = instance.buildWorkerArgs(driverInput, profile, qualification.permissions);
204
+ const workerArgs = instance.buildWorkerArgs({ ...driverInput, cliVersion: qualification.cliVersion }, profile, qualification.permissions);
205
205
  if (!isOperatorQualifiedWorkerAdapter(qualification.adapter)) assertWorkerControlArgv(profile, workerArgs);
206
206
  const expected = [scope.binary.realpath, ...workerArgs];
207
207
  if (JSON.stringify(expected) !== JSON.stringify(result.argv)
@@ -285,7 +285,7 @@ export async function inspectWorkerInstallation(instance, request) {
285
285
  let controlArgv = null;
286
286
  if (!operatorApproved && Object.values(profile.controls).some(hasControlArgvMapping)) {
287
287
  if (!request.invocation) throw new Error('Worker control qualification requires representative argv invocation');
288
- controlArgv = instance.buildWorkerArgs(structuredClone(request.invocation), profile, request.permissions);
288
+ controlArgv = instance.buildWorkerArgs({ ...structuredClone(request.invocation), cliVersion }, profile, request.permissions);
289
289
  assertWorkerControlArgv(profile, controlArgv);
290
290
  }
291
291
  const environment = request.environment ?? {};
@@ -768,6 +768,7 @@ export async function inspectRecordedWorkerQualifications({ cwd, policy, paralle
768
768
  if (!configured || configured.enabled === false || !/^[a-z][a-z0-9-]{0,62}$/.test(cli)
769
769
  || await realpath(installation.cwd) !== workspace
770
770
  || qualificationDigest(policy) !== installation.effectiveConfigDigest
771
+ || (installation.localModelsDigest || configured.localModels) && installation.localModelsDigest !== qualificationDigest(configured.localModels ?? null)
771
772
  || configured.adapter !== `providers:${adapter.provider}` && configured.adapter !== adapter.id
772
773
  || configured.accountScope !== binding.accountScope
773
774
  || binding.profile !== installation.profile || binding.cliVersion !== installation.cliVersion
@@ -915,6 +916,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
915
916
  if (binding.profile !== installation.profile || binding.cliVersion !== installation.cliVersion
916
917
  || binding.accountScope !== installation.accountScope
917
918
  || qualificationDigest(binding.boundary) !== qualificationDigest(installation.boundary)) throw fail();
919
+ if (parallelism && (installation.localModelsDigest || parallelism.clis?.[cli]?.localModels) && installation.localModelsDigest !== qualificationDigest(parallelism.clis?.[cli]?.localModels ?? null)) throw fail();
918
920
  reason = 'effective-config-digest';
919
921
  if (qualificationDigest(policy) !== installation.effectiveConfigDigest) throw fail();
920
922
  reason = 'evidence';
@@ -1004,7 +1006,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
1004
1006
  ...(typeof instance.buildWorkerStdinFrame === 'function'
1005
1007
  ? { buildWorkerStdinFrame: (brief, invocation) => instance.buildWorkerStdinFrame(brief, invocation) } : {}),
1006
1008
  buildInvocation: async input => profile.transport === 'shell'
1007
- ? buildInstalledWorkerTransport(instance, input, profile, adapter.invocation, scope.binary.realpath, installation.environment)
1009
+ ? buildInstalledWorkerTransport(instance, { ...input, cliVersion: binding.cliVersion }, profile, adapter.invocation, scope.binary.realpath, installation.environment)
1008
1010
  : instance.buildInvocation(input),
1009
1011
  prepareWorkerInvocation: (invocation, qualification) => prepareInstalledWorkerInvocation(instance, invocation, qualification),
1010
1012
  ...(mcpRegistry ? { mcpRegistry, mcpProfile: record.mcpProfile } : {}),
@@ -161,7 +161,7 @@ export function resolveWorkerPlan(snapshot, request, ceilingDefaults = {}) {
161
161
  const permissions = { ...group.execution, transport: group.execution?.transport ?? 'shell' };
162
162
  const transport = permissions.transport;
163
163
  if (request.transport === 'mcp' && permissions.launchMode === 'native-sandbox') {
164
- const reason = diagnostic('OG_POLICY_RELAXATION', `/parallelism/groups/${groupId}/execution/launchMode`, 'MCP worker-invoke does not support native-sandbox isolation. Use models resolve --transport shell and the shell launcher, or select a group with systemd-unit isolation.');
164
+ const reason = diagnostic('OG_POLICY_RELAXATION', `/parallelism/groups/${groupId}/execution/launchMode`, '--transport mcp selects an MCP-server worker, which native-sandbox groups do not support. Resolve with --transport shell, then launch with --launch-worker, or from a confined conductor with MCP worker-invoke transport "shell"; or select a group with systemd-unit isolation.');
165
165
  for (const member of group.members ?? [])
166
166
  plan.exclusions.push({ group: groupId, member: member.id, model: member.model, effort: null, diagnostics: [reason] });
167
167
  if (request.group === groupId)
@@ -15,8 +15,8 @@
15
15
  *
16
16
  * @module src/plugin/plugin-installer
17
17
  * @implements @.aiwg/requirements/use-cases/UC-010-rollback-plugin-installation.md
18
- * @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.1 PluginManager
19
- * @adr @.aiwg/architecture/decisions/ADR-006-plugin-rollback-strategy.md
18
+ * @architecture @docs/architecture/cli/index.md
19
+ * @adr @docs/plugin-marketplace-guide.md
20
20
  * @nfr @.aiwg/requirements/nfr-modules/reliability.md - NFR-REL-002 (zero data loss)
21
21
  * @tests @test/unit/plugin/plugin-installer.test.ts
22
22
  * @depends @src/plugin/metadata-validator.ts
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * @module src/plugin/registry-validator
8
8
  * @implements @.aiwg/requirements/use-cases/UC-011-validate-plugin-security.md
9
- * @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.1 PluginManager
10
- * @adr @.aiwg/architecture/decisions/ADR-002-plugin-isolation-strategy.md
9
+ * @architecture @docs/architecture/cli/index.md
10
+ * @adr @docs/plugin-marketplace-guide.md
11
11
  * @tests @test/unit/plugin/registry-validator.test.ts
12
12
  * @depends @src/plugin/metadata-validator.ts
13
13
  */
@@ -8,7 +8,7 @@
8
8
  * Skills are the canonical source format; commands are deployment artifacts.
9
9
  * See ADR: Skills as the Canonical Extension Type.
10
10
  *
11
- * @implements .aiwg/architecture/adr-skills-canonical-extension-type.md
11
+ * @implements docs/extensions/extension-types.md
12
12
  * @issue #550
13
13
  */
14
14
  import fs from 'fs/promises';
@@ -0,0 +1,2 @@
1
+ export function withDeploymentInputSession<T>(work: () => Promise<T>): Promise<T>;
2
+ export function deploymentSessionInput<T>(key: string, create: () => T, dispose: (value: T) => void): T | undefined;
@@ -0,0 +1,38 @@
1
+ // Own lazily created immutable inputs for one update, including nested redeploys.
2
+ import { AsyncLocalStorage } from 'node:async_hooks';
3
+
4
+ const sessions = new AsyncLocalStorage();
5
+
6
+ export async function withDeploymentInputSession(work) {
7
+ const existing = sessions.getStore();
8
+ if (existing && !existing.closed) return work();
9
+ const session = { inputs: new Map(), closed: false };
10
+ return sessions.run(session, async () => {
11
+ let result, workError, failed = false;
12
+ try { result = await work(); }
13
+ catch (error) { workError = error; failed = true; }
14
+ session.closed = true;
15
+ const errors = [];
16
+ for (const { value, dispose } of session.inputs.values()) {
17
+ try { dispose(value); } catch (error) { errors.push(error); }
18
+ }
19
+ session.inputs.clear();
20
+ if (failed) {
21
+ if (errors.length) {
22
+ // Even a frozen or primitive thrown value must keep its identity.
23
+ try { Object.defineProperty(workError, 'disposeErrors', { value: errors, configurable: true }); } catch {}
24
+ }
25
+ throw workError;
26
+ }
27
+ if (errors.length) throw new AggregateError(errors, 'Failed to dispose deployment inputs');
28
+ return result;
29
+ });
30
+ }
31
+
32
+ /** Outside an update, keep the established standalone deployment lifecycle. */
33
+ export function deploymentSessionInput(key, create, dispose) {
34
+ const session = sessions.getStore();
35
+ if (!session || session.closed) return undefined;
36
+ if (!session.inputs.has(key)) session.inputs.set(key, { value: create(), dispose });
37
+ return session.inputs.get(key).value;
38
+ }