@aiwg/cli 2026.11.4 → 2026.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/agentic/code/providers/capability-matrix.yaml +75 -5
  2. package/agentic/code/providers/model-capabilities.v1.json +44 -36
  3. package/bin/aiwg.mjs +6 -4
  4. package/dist/src/activity-log/cli.js +1 -1
  5. package/dist/src/agents/agent-deployer.js +1 -1
  6. package/dist/src/artifacts/audit/types.js +1 -1
  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/index-builder.js +4 -2
  11. package/dist/src/artifacts/query-engine-rules.js +2 -2
  12. package/dist/src/artifacts/types.js +1 -1
  13. package/dist/src/artifacts/views/definition.js +1 -1
  14. package/dist/src/artifacts/views/types.js +1 -1
  15. package/dist/src/catalog/cli.js +1 -1
  16. package/dist/src/catalog/cli.mjs +1 -1
  17. package/dist/src/catalog/loader.js +1 -1
  18. package/dist/src/catalog/loader.mjs +1 -1
  19. package/dist/src/catalog/types.js +1 -1
  20. package/dist/src/cli/cli-extension-loader.js +19 -5
  21. package/dist/src/cli/cli-extension-paths.js +65 -0
  22. package/dist/src/cli/handlers/best-practices-audit.js +1 -1
  23. package/dist/src/cli/handlers/help.js +3 -4
  24. package/dist/src/cli/handlers/index.js +1 -1
  25. package/dist/src/cli/handlers/marketplace-plugin-search.js +37 -0
  26. package/dist/src/cli/handlers/marketplace.js +3 -1
  27. package/dist/src/cli/handlers/models.js +1 -1
  28. package/dist/src/cli/handlers/ralph-launcher.js +8 -2
  29. package/dist/src/cli/handlers/ralph.js +1 -1
  30. package/dist/src/cli/handlers/runtime-info.js +1 -1
  31. package/dist/src/cli/handlers/scaffolding.js +2 -2
  32. package/dist/src/cli/handlers/script-runner.js +8 -5
  33. package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
  34. package/dist/src/cli/handlers/steward-format.js +12 -0
  35. package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
  36. package/dist/src/cli/handlers/subcommands-list-format.js +19 -1
  37. package/dist/src/cli/handlers/types.js +1 -1
  38. package/dist/src/cli/handlers/use.js +15 -6
  39. package/dist/src/cli/handlers/utilities.js +1 -1
  40. package/dist/src/cli/handlers/utility-doctor.js +4 -0
  41. package/dist/src/cli/handlers/version.js +1 -1
  42. package/dist/src/cli/handlers/workspace.js +1 -1
  43. package/dist/src/cli/help-generator.js +9 -11
  44. package/dist/src/cli/hooks/builtin/activity-log-hook.js +1 -1
  45. package/dist/src/cli/router.js +1 -1
  46. package/dist/src/cli/workflow-orchestrator.js +1 -1
  47. package/dist/src/config/worker-context.js +37 -7
  48. package/dist/src/config/worker-parallelism.js +11 -0
  49. package/dist/src/contributors/detect.js +1 -1
  50. package/dist/src/contributors/discover.js +1 -1
  51. package/dist/src/contributors/heuristic.js +1 -1
  52. package/dist/src/contributors/index.js +1 -1
  53. package/dist/src/contributors/types.js +1 -1
  54. package/dist/src/contributors/validation.js +1 -1
  55. package/dist/src/effects/worker-delivery.js +83 -0
  56. package/dist/src/extensions/capability-index.js +1 -1
  57. package/dist/src/extensions/commands/definitions.js +2 -2
  58. package/dist/src/extensions/deployment-registration.js +1 -1
  59. package/dist/src/extensions/index.js +1 -1
  60. package/dist/src/extensions/loader.js +1 -1
  61. package/dist/src/extensions/manifest.js +10 -2
  62. package/dist/src/extensions/project-local-activity.js +1 -1
  63. package/dist/src/extensions/project-local-discovery.js +23 -3
  64. package/dist/src/extensions/project-local-doctor.js +7 -3
  65. package/dist/src/extensions/project-local-promote.js +3 -3
  66. package/dist/src/extensions/project-local-remove.js +3 -3
  67. package/dist/src/extensions/project-local-scaffold.js +20 -8
  68. package/dist/src/extensions/registry.js +1 -1
  69. package/dist/src/extensions/shadow-resolver.js +1 -1
  70. package/dist/src/extensions/types.js +1 -1
  71. package/dist/src/extensions/upstream-registry.js +1 -1
  72. package/dist/src/extensions/validation.js +1 -1
  73. package/dist/src/intake/git-history-analyzer.js +1 -1
  74. package/dist/src/kb/cli.js +1 -1
  75. package/dist/src/marketplace/plugin-directory.js +36 -0
  76. package/dist/src/marketplace/plugin-search.js +180 -0
  77. package/dist/src/mcp/cli.mjs +2 -2
  78. package/dist/src/mcp/helpers.mjs +1 -1
  79. package/dist/src/mcp/http-tools.mjs +8 -6
  80. package/dist/src/mcp/http-transport.mjs +3 -1
  81. package/dist/src/mcp/server.mjs +1 -1
  82. package/dist/src/mcp/tools/command-run.mjs +1 -1
  83. package/dist/src/mcp/tools/discovery.mjs +1 -1
  84. package/dist/src/mcp/tools/subsystems.mjs +1 -1
  85. package/dist/src/mcp/tools/worker-invoke.mjs +68 -22
  86. package/dist/src/mcp/tools/worker-local-only-preflight.mjs +79 -0
  87. package/dist/src/mcp/tools/worker-recorded-launch.mjs +26 -0
  88. package/dist/src/mcp/tools/worker-stdin-runtime.mjs +33 -6
  89. package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +33 -0
  90. package/dist/src/mcp/tools/worker-verify-deliver.mjs +27 -0
  91. package/dist/src/models/catalog-policy.js +2 -2
  92. package/dist/src/models/conductor-data-policy.mjs +83 -14
  93. package/dist/src/models/config-loader.js +2 -2
  94. package/dist/src/models/factory-models.js +144 -0
  95. package/dist/src/models/index.js +2 -2
  96. package/dist/src/models/local-endpoint-models.js +155 -0
  97. package/dist/src/models/model-capabilities.v1.json +44 -36
  98. package/dist/src/models/model-discovery.js +16 -8
  99. package/dist/src/models/opencode-worker-model.mjs +16 -0
  100. package/dist/src/models/resolver.js +2 -2
  101. package/dist/src/models/worker-installation.d.mts +2 -0
  102. package/dist/src/models/worker-installation.mjs +16 -5
  103. package/dist/src/models/worker-invocation-policy.js +25 -1
  104. package/dist/src/models/worker-plan.js +1 -1
  105. package/dist/src/models/wrapper-enforcement.js +1 -1
  106. package/dist/src/plugin/plugin-installer.js +2 -2
  107. package/dist/src/plugin/registry-validator.js +2 -2
  108. package/dist/src/plugin/skill-command-translator.js +1 -1
  109. package/dist/src/policy/repo-access.js +3 -1
  110. package/dist/src/providers/capability-matrix.yaml +75 -5
  111. package/dist/src/providers/deployment-ownership.mjs +8 -1
  112. package/dist/src/providers/deployment-preservation.mjs +44 -3
  113. package/dist/src/providers/grok-build-acp.js +13 -5
  114. package/dist/src/providers/grok-build-dispatch.js +35 -2
  115. package/dist/src/providers/grok-build-headless.js +2 -1
  116. package/dist/src/rlm/cache/hash.js +1 -1
  117. package/dist/src/rlm/cache/store.js +1 -1
  118. package/dist/src/rlm/cache/types.js +1 -1
  119. package/dist/src/serve/worker-invocation-preparation.js +13 -0
  120. package/dist/src/serve/worker-invocation.js +21 -6
  121. package/dist/src/serve/worker-stdin-frame.mjs +1 -1
  122. package/dist/src/sessions/adapters/grok-build-native-records.js +77 -7
  123. package/dist/src/sessions/adapters/grok-build-native.js +148 -1
  124. package/dist/src/sessions/adapters/grok-build.js +36 -14
  125. package/dist/src/sessions/normalization.js +1 -1
  126. package/dist/src/skills/run.js +0 -11
  127. package/dist/src/smiths/agentsmith/generator.js +1 -1
  128. package/dist/src/smiths/context-pipeline/index.js +1 -1
  129. package/dist/src/smiths/context-pipeline/provider-policy.js +1 -1
  130. package/dist/src/smiths/context-pipeline/types.js +1 -1
  131. package/dist/src/smiths/context-pipeline/workspace-doctor.js +4 -0
  132. package/dist/src/smiths/hook-bridge/factory-trust.js +2 -2
  133. package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +10 -7
  134. package/dist/src/smiths/hook-bridge/hermes-trust.js +65 -0
  135. package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +2 -2
  136. package/dist/src/smiths/mcpsmith/generator.js +2 -2
  137. package/dist/src/smiths/mcpsmith/index.js +2 -2
  138. package/dist/src/smiths/mcpsmith/types.js +2 -2
  139. package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
  140. package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
  141. package/dist/src/smiths/toolsmith/runtime-discovery.mjs +2 -2
  142. package/dist/src/smiths/toolsmith/types.js +2 -2
  143. package/dist/src/storage/backends/fortemi.js +1 -1
  144. package/dist/src/storage/backends/fs.js +1 -1
  145. package/dist/src/storage/backends/logseq.js +1 -1
  146. package/dist/src/storage/backends/obsidian.js +1 -1
  147. package/dist/src/storage/cli.js +2 -2
  148. package/dist/src/storage/config.js +1 -1
  149. package/dist/src/storage/index.js +1 -1
  150. package/dist/src/storage/subsystem-cli.js +1 -1
  151. package/dist/src/storage/types.js +1 -1
  152. package/dist/src/testing/generators/test-case-generator.js +1 -1
  153. package/dist/src/writing/validation-engine.js +1 -1
  154. package/package.json +11 -1
  155. package/schemas/models/model-catalog.v1.schema.json +6 -3
  156. package/tools/agents/deploy-agents.mjs +4 -2
  157. package/tools/agents/deploy-options.mjs +2 -0
  158. package/tools/agents/providers/base-inventory.mjs +3 -1
  159. package/tools/agents/providers/base-kernel-skills.mjs +11 -5
  160. package/tools/agents/providers/conductor-data-guard.mjs +1 -1
  161. package/tools/agents/providers/grok-build.mjs +31 -40
  162. package/tools/agents/providers/model-wrapper.mjs +2 -5
  163. package/tools/agents/providers/rule-deployment-commit.mjs +3 -0
  164. package/tools/agents/providers/rule-deployment-prepare.mjs +2 -2
  165. package/tools/agents/providers/rule-projection.mjs +39 -4
  166. package/tools/agents/providers/skill-copy-prune.mjs +12 -0
  167. package/tools/agents/providers/stale-artifact-prune.mjs +24 -10
  168. package/tools/ralph-external/lib/claude-adapter.mjs +2 -0
  169. package/tools/ralph-external/lib/factory-adapter.mjs +6 -2
  170. package/tools/ralph-external/lib/mcp-worker-launch.mjs +67 -0
  171. package/tools/ralph-external/lib/opencode-adapter.mjs +9 -7
  172. package/tools/ralph-external/lib/trusted-verification.mjs +1021 -0
  173. package/tools/ralph-external/lib/typed-stop-delivery.mjs +46 -0
  174. package/tools/ralph-external/lib/verification-isolation.mjs +509 -0
  175. package/tools/ralph-external/lib/worker-context.mjs +3 -3
  176. package/tools/ralph-external/lib/worker-delivery-guards.mjs +95 -0
  177. package/tools/ralph-external/lib/worker-delivery-record.mjs +15 -0
  178. package/tools/ralph-external/lib/worker-final.mjs +4 -1
  179. package/tools/ralph-external/lib/worker-inputs.mjs +20 -1
  180. package/tools/ralph-external/lib/worker-isolation-status.mjs +3 -0
  181. package/tools/ralph-external/lib/worker-isolation.mjs +1 -0
  182. package/tools/ralph-external/lib/worker-launch-cli.mjs +8 -0
  183. package/tools/ralph-external/lib/worker-local-only-paths.mjs +45 -0
  184. package/tools/ralph-external/lib/worker-prompt.mjs +4 -1
  185. package/tools/ralph-external/lib/worker-retry-evidence.mjs +2 -1
  186. package/tools/ralph-external/lib/worker-run-directory.mjs +45 -0
  187. package/tools/ralph-external/lib/worker-termination.mjs +21 -12
  188. package/tools/ralph-external/lib/worker-unit-cleanup.mjs +10 -2
  189. package/tools/ralph-external/lib/worker-verification-cli.mjs +164 -0
  190. package/tools/ralph-external/lib/worktree-preparation.mjs +417 -0
  191. package/tools/ralph-external/session-launcher.mjs +30 -32
  192. package/vscode-extension/schemas/aiwg.config.v1.json +27 -0
@@ -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
@@ -700,7 +700,7 @@
700
700
  "id": "copilot",
701
701
  "provider": "copilot",
702
702
  "adapterVersion": "1",
703
- "supportedVersions": "1.0.95",
703
+ "supportedVersions": "1.0.106",
704
704
  "runtimeDriver": "installed:copilot",
705
705
  "catalogAdapter": {
706
706
  "kind": "file",
@@ -711,10 +711,6 @@
711
711
  "kind": "process",
712
712
  "executable": "copilot",
713
713
  "argv": [
714
- "-p",
715
- "Follow the instructions in the attached file exactly.",
716
- "--attachment",
717
- "${brief}",
718
714
  "--model",
719
715
  "${model}",
720
716
  "--reasoning-effort",
@@ -727,9 +723,9 @@
727
723
  "--no-custom-instructions",
728
724
  "--disable-builtin-mcps"
729
725
  ],
730
- "stdin": "closed",
726
+ "stdin": "brief-text",
731
727
  "cwd": "${workspace}",
732
- "envAllowlist": ["PATH"],
728
+ "envAllowlist": ["PATH", "COPILOT_PROVIDER_BASE_URL", "COPILOT_PROVIDER_TYPE", "COPILOT_MODEL", "COPILOT_PROVIDER_API_KEY", "COPILOT_PROVIDER_API_KEY_COMMAND"],
733
729
  "versionArgv": [
734
730
  "--version"
735
731
  ],
@@ -754,7 +750,7 @@
754
750
  "invocationProfiles": {
755
751
  "direct-shell": {
756
752
  "transport": "shell",
757
- "supportedVersions": "1.0.95",
753
+ "supportedVersions": "1.0.106",
758
754
  "controls": {
759
755
  "model": {
760
756
  "support": "unqualified",
@@ -783,18 +779,18 @@
783
779
  },
784
780
  "finalOutput": {
785
781
  "support": "unqualified",
786
- "mapping": "stdout --output-format json (JSONL, one JSON object per line); no output-file flag carries the agent's final answer (--usage-output-file is usage statistics only and is not wired here)",
787
- "evidence": "H: copilot 1.0.95 --help / `copilot help <topic>`, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/copilot-1.0.95.txt; never live qualification) ('--output-format <format> Output format: ... 'json' (JSONL, one JSON object per line)'; '--usage-output-file <file> Write final usage statistics as JSON')"
782
+ "mapping": "stdout JSONL: extract the last assistant.message data.content after assistant.turn_end/assistant.idle; reject malformed or error-shaped streams, then validate workerClaims against trusted process termination",
783
+ "evidence": "L: copilot 1.0.106 BYOK OpenRouter qwen/qwen3.8-27b, 2026-11-10 (#4088); sanitized captures test/fixtures/providers/copilot/copilot-stdin-only.jsonl and copilot-stdin.jsonl; model.call_final_result.data.isByok=true; single-turn stdin-only exact reply without tools"
788
784
  },
789
785
  "stdin": {
790
786
  "support": "unqualified",
791
- "mapping": "unavailable for the brief: -p/--prompt <text> only accepts inline argv text; the brief instead rides on --attachment <path> as a file, with -p fixed to a content-free instruction",
792
- "evidence": "H: copilot 1.0.95 --help / `copilot help <topic>`, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/copilot-1.0.95.txt; never live qualification) ('-p, --prompt <text> Execute a prompt in non-interactive mode'; '--attachment <path> Attach a file (image or native document) to the initial prompt; only valid in non-interactive mode')"
787
+ "mapping": "brief-text: pipe the brief to EOF with no -p/--prompt or --attachment; 1.0.106 rejects Markdown attachments and ignores stdin when -p is present",
788
+ "evidence": "L: copilot 1.0.106 BYOK OpenRouter qwen/qwen3.8-27b, 2026-11-10 (#4088); sanitized captures test/fixtures/providers/copilot/copilot-stdin-only.jsonl and copilot-stdin.jsonl; model.call_final_result.data.isByok=true; single-turn stdin-only exact reply without tools"
793
789
  },
794
790
  "structuredOutput": {
795
791
  "support": "unqualified",
796
- "mapping": "unavailable: no output-schema flag is evidenced, and the --output-format json JSONL event vocabulary itself is not documented in --help; no event field name is invented",
797
- "evidence": "H: copilot 1.0.95 --help / `copilot help <topic>`, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/copilot-1.0.95.txt; never live qualification)"
792
+ "mapping": "No output-schema flag is evidenced; assistant.message data.content is validated by the shared strict workerClaims parser",
793
+ "evidence": "L: copilot 1.0.106 BYOK OpenRouter qwen/qwen3.8-27b, 2026-11-10 (#4088); sanitized captures test/fixtures/providers/copilot/copilot-stdin-only.jsonl and copilot-stdin.jsonl; model.call_final_result.data.isByok=true; single-turn stdin-only exact reply without tools"
798
794
  },
799
795
  "stepCap": {
800
796
  "support": "unqualified",
@@ -817,15 +813,15 @@
817
813
  "evidence": "H: copilot 1.0.95 --help / `copilot help <topic>`, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/copilot-1.0.95.txt; never live qualification) ('--auto-tier <preference> Set the Auto routing profile')"
818
814
  }
819
815
  },
820
- "envAllowlist": ["PATH"],
816
+ "envAllowlist": ["PATH", "COPILOT_PROVIDER_BASE_URL", "COPILOT_PROVIDER_TYPE", "COPILOT_MODEL", "COPILOT_PROVIDER_API_KEY", "COPILOT_PROVIDER_API_KEY_COMMAND"],
821
817
  "pitfalls": [
822
818
  "Documentation/help and synthetic observations are not authenticated live qualification.",
823
819
  "Unknown model, effort, permission or required step mappings block dispatch.",
824
820
  "Native MCP/client, MSP/ACP, gateway and conversation capabilities do not establish worker authority.",
825
- "The --output-format json JSONL event-type vocabulary is not documented in --help, and the installed binary is a compiled per-architecture native package with no readable bundled source (unlike e.g. Pi's JS bundle); no event-level health signal is evidenced, so observeHealthEvent always returns null and completion is exit-code gated only, EXCEPT one conservative guard: a line with a top-level 'type: \"error\"' or non-null 'error' field always fails the final, even at exit 0 (defensive synthetic-shape check, not an observed Copilot event).",
821
+ "Captured 1.0.106 assistant.message data.content supplies the final answer after assistant.turn_end/assistant.idle. Health remains process-only with no event-level health signal evidenced for progress; error-shaped lines fail even at exit zero.",
826
822
  "--allow-all-tools/--allow-all/--yolo are never emitted; a tool outside the resolved --allow-tool scope may still require interactive confirmation a non-interactive run cannot answer, and whether that fails closed or hangs is unqualified without a live run.",
827
823
  "--sandbox's OS-level command sandbox depends on host prerequisites (bwrap/slirp4netns/iptables on Linux) not probed here; this profile never emits it and relies on the CLI's default path restriction instead.",
828
- "Live qualification is an open S1 blocker: this profile has been exercised only against --help/--version/subcommand --help; the smoke command in docs/providers/copilot-direct.md is the first live check. Live attempt evidence (host noodle, 2026-10-10): COPILOT_GITHUB_TOKEN set to a classic ghp_ PAT exits 1 with 'Classic Personal Access Tokens (ghp_) are not supported by Copilot' on stderr and EMPTY stdout; a fine-grained PAT or prior copilot/gh login is required and the smoke run remains blocked on that."
824
+ "The 1.0.95 help-only attachment path is superseded by the 1.0.106 stdin-only BYOK capture (#4088). The old GitHub-account run on 2026-10-10 remains recorded as blocked: Classic Personal Access Tokens (ghp_) are not supported by Copilot. Other required controls remain unqualified."
829
825
  ],
830
826
  "health": {
831
827
  "version": 1,
@@ -834,7 +830,7 @@
834
830
  "signalParser": "provider-copilot-health-v1",
835
831
  "sessionLogLocator": null,
836
832
  "progressEvidence": [],
837
- "stopEvidence": "owned process identity and observed exit; the JSONL stream carries no evidenced error-event vocabulary, so completion is exit-code gated only, except a conservative guard that fails any line shaped 'type: \"error\"' or carrying a non-null top-level 'error' field even at exit 0",
833
+ "stopEvidence": "host-observed process exit and termination plus strict workerClaims validation of the settled assistant.message answer; error-shaped streams fail even at exit zero",
838
834
  "fixtureRef": "test/fixtures/providers/copilot/health/manifest.json",
839
835
  "qualifiedAt": null,
840
836
  "statusOperation": null,
@@ -842,7 +838,8 @@
842
838
  "coverage": "degraded",
843
839
  "qualificationTarget": "process-only",
844
840
  "evidenceGrades": [
845
- "H"
841
+ "H",
842
+ "D"
846
843
  ],
847
844
  "provenance": [
848
845
  {
@@ -850,6 +847,12 @@
850
847
  "ref": ".aiwg/working/s1-scratch/cli-help/copilot-1.0.95.txt",
851
848
  "observedAt": "2026-10-10T00:00:00Z",
852
849
  "cliVersion": "1.0.95"
850
+ },
851
+ {
852
+ "kind": "documentation",
853
+ "ref": "docs/providers/copilot-direct.md",
854
+ "observedAt": "2026-11-10T23:12:29Z",
855
+ "cliVersion": "1.0.106"
853
856
  }
854
857
  ],
855
858
  "qualificationOwner": "B-OG-36",
@@ -1157,8 +1160,8 @@
1157
1160
  },
1158
1161
  "effort": {
1159
1162
  "support": "unqualified",
1160
- "mapping": "[-r/--reasoning-effort LEVEL]; valid levels are model-dependent (exec --help 'Model details'); never the per-model default",
1161
- "evidence": "H: droid-cli 1.0.0 exec --help documents -r/--reasoning-effort <level> (defaults per model); unqualified until live evidence"
1163
+ "mapping": "[-r/--reasoning-effort LEVEL]; valid levels are model-dependent (exec --help 'Model details'); never the per-model default. Not enforceable for BYOK custom models: -r is ignored and the session reports reasoning_effort: none",
1164
+ "evidence": "H: droid-cli 1.0.0 exec --help documents -r/--reasoning-effort <level> (defaults per model); BYOK custom models ignore it (reasoning_effort: none), so effort is not enforceable; unqualified until live evidence"
1162
1165
  },
1163
1166
  "sandbox": {
1164
1167
  "support": "unqualified",
@@ -1309,7 +1312,7 @@
1309
1312
  "id": "opencode-direct",
1310
1313
  "provider": "opencode",
1311
1314
  "adapterVersion": "1",
1312
- "supportedVersions": "2.0.26",
1315
+ "supportedVersions": ">=1.18.0 <2.0.0 || >=2.0.26 <3.0.0",
1313
1316
  "runtimeDriver": "installed:opencode",
1314
1317
  "catalogAdapter": {
1315
1318
  "kind": "file",
@@ -1356,27 +1359,27 @@
1356
1359
  "invocationProfiles": {
1357
1360
  "direct-shell": {
1358
1361
  "transport": "shell",
1359
- "supportedVersions": "2.0.26",
1362
+ "supportedVersions": ">=1.18.0 <2.0.0 || >=2.0.26 <3.0.0",
1360
1363
  "controls": {
1361
1364
  "model": {
1362
1365
  "support": "unqualified",
1363
- "mapping": "-m/--model (opencode run --help: '--model, -m string Model to use in the format provider/model#variant')",
1364
- "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)"
1365
1368
  },
1366
1369
  "effort": {
1367
1370
  "support": "unqualified",
1368
- "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",
1369
- "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)"
1370
1373
  },
1371
1374
  "sandbox": {
1372
1375
  "support": "unqualified",
1373
1376
  "mapping": "unavailable: no scoped sandbox flag on 'run'; the only permission-adjacent flag is --auto, a blanket approval bypass this profile never emits",
1374
- "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"
1375
1378
  },
1376
1379
  "approval": {
1377
1380
  "support": "unqualified",
1378
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",
1379
- "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"
1380
1383
  },
1381
1384
  "workdir": {
1382
1385
  "support": "unqualified",
@@ -1386,7 +1389,7 @@
1386
1389
  "finalOutput": {
1387
1390
  "support": "unqualified",
1388
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",
1389
- "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"
1390
1393
  },
1391
1394
  "stdin": {
1392
1395
  "support": "unqualified",
@@ -2599,7 +2602,7 @@
2599
2602
  "skill": "inherited",
2600
2603
  "globalChild": "native",
2601
2604
  "identifierSyntax": "Provider-local alias from grok inspect and $GROK_HOME config; distinct from API model id",
2602
- "inheritance": "Agent and skill roles resolve through the session model unless a validated Grok Build alias is selected",
2605
+ "inheritance": "Agents inherit the session model: Grok Build 1.0.77 ignores agent frontmatter model. AIWG role/tier intent is informational; select worker models with CLI -m. Fixture-backed test: test/unit/providers/grok-build-provider.test.ts. Skill roles inherit the session model.",
2603
2606
  "invalidPinFallback": "Report the unavailable alias; use the sole discovered model only when exactly one is available",
2604
2607
  "configTarget": "$GROK_HOME/config.toml [models] and [model.<alias>] (read-only discovery)",
2605
2608
  "artifactFormat": "Grok Build model alias",
@@ -2637,9 +2640,13 @@
2637
2640
  "--output-format",
2638
2641
  "streaming-json",
2639
2642
  "--no-subagents",
2643
+ "--disallowed-tools",
2644
+ "workflow",
2640
2645
  "--no-plan",
2641
2646
  "--no-alt-screen",
2642
- "--disable-web-search"
2647
+ "--disable-web-search",
2648
+ "--allow",
2649
+ "Bash(aiwg discover *)"
2643
2650
  ],
2644
2651
  "stdin": "closed",
2645
2652
  "cwd": "${workspace}",
@@ -2702,7 +2709,7 @@
2702
2709
  },
2703
2710
  "finalOutput": {
2704
2711
  "support": "unqualified",
2705
- "mapping": "stdout --output-format streaming-json (NDJSON, one ACP session update per line); the final 'end' event's stopReason plus concatenated 'text' chunks form the answer; no separate output-file flag is evidenced. NOTE: the SEPARATE, pre-existing src/providers/grok-build-headless.ts transport and its shared tools/ralph-external/lib/worker-health.mjs generic branch use a different, older message/result event shape and --output-format json (a single JSON object); this direct-shell profile's own observeHealthEvent/parseDirectFinal handle only the streaming-json/ACP shape and never touch that other path.",
2712
+ "mapping": "stdout --output-format streaming-json (NDJSON, one ACP session update per line); the final 'end' event's stopReason plus concatenated 'text' chunks form the answer; no separate output-file flag is evidenced. The separate src/providers/grok-build-headless.ts transport now defaults to streaming-json with captured 1.0.77 parser contracts; this direct-shell profile retains its own observeHealthEvent/parseDirectFinal.",
2706
2713
  "evidence": "H: grok 1.0.50 (c58f321264ba, stable) --help, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/grok-1.0.50.txt); plus the installed binary's own bundled docs (strings-read, never live qualification; full extracts preserved in docs/providers/grok-build-cli-evidence.md) ('--output-format <OUTPUT_FORMAT> ... streaming-json: NDJSON: one ACP session update per line, the agent's native format'; bundled output-format doc gives the full event vocabulary and a worked example, preserved in the evidence file, confirming 'json' is a single object with text/stopReason/sessionId/requestId/usage fields -- NOT the message/result shape -- and 'streaming-json' is the ACP-derived text/thought/tool_call/tool_call_update/usage/plan/available_commands/end/error vocabulary)"
2707
2714
  },
2708
2715
  "stdin": {
@@ -2727,8 +2734,8 @@
2727
2734
  },
2728
2735
  "children": {
2729
2736
  "support": "unqualified",
2730
- "mapping": "--no-subagents (disables subagent spawning; denies hidden fan-out)",
2731
- "evidence": "H: grok 1.0.50 (c58f321264ba, stable) --help, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/grok-1.0.50.txt); plus the installed binary's own bundled docs (strings-read, never live qualification; full extracts preserved in docs/providers/grok-build-cli-evidence.md) ('--no-subagents Disable subagent spawning')"
2737
+ "mapping": "--no-subagents --disallowed-tools workflow (1.0.77 capture: workflow can spawn children despite --no-subagents; combined argv tested in grok-build-direct.test.ts; live-verified on 1.0.77 2026-11-10: no spawn_subagent or workflow call and no subagent records)",
2738
+ "evidence": "H: grok 1.0.50 (c58f321264ba, stable) --help, captured 2026-10-10 (.aiwg/working/s1-scratch/cli-help/grok-1.0.50.txt); plus the installed binary's own bundled docs (strings-read, never live qualification; full extracts preserved in docs/providers/grok-build-cli-evidence.md) ('--no-subagents Disable subagent spawning'); 2026-11-10 1.0.77 capture correction: test/fixtures/providers/grok-build/captured-20261110/permissions.json replayed by test/unit/providers/grok-build-headless.test.ts demonstrates workflow bypass; both flags required in rendered argv"
2732
2739
  },
2733
2740
  "fallback": {
2734
2741
  "support": "unqualified",
@@ -2745,10 +2752,11 @@
2745
2752
  "Documentation/help and synthetic observations are not authenticated live qualification.",
2746
2753
  "Unknown model, effort, permission or required step mappings block dispatch.",
2747
2754
  "Native MCP/client, MSP/ACP, gateway and conversation capabilities do not establish worker authority.",
2748
- "The separate, pre-existing src/providers/grok-build-headless.ts transport and the generic grok-build branch in tools/ralph-external/lib/worker-health.mjs use --output-format json and an older message/result event shape; this profile's streaming-json/ACP grammar is independent and does not change that path or its consumers.",
2755
+ "The separate src/providers/grok-build-headless.ts transport defaults to streaming-json and also parses captured json and streaming-messages-json; this direct profile retains its independent streaming-json parser.",
2749
2756
  "No --no-ask-user-equivalent flag is listed in the captured root --help for this version (an internal no-ask-user arg name exists in the compiled binary's own strings but is not printed help text), so it is never emitted; whether an ask_user_question tool call blocks indefinitely under dontAsk in a non-interactive run is unqualified, not invented away.",
2750
2757
  "--always-approve and --permission-mode bypassPermissions are never emitted; a scoped --allow/--deny rule value, or the model/effort value, starting with '-' or containing whitespace/control characters is refused by the driver before argv is built.",
2751
2758
  "Permission-mode and sandbox-profile semantics are quoted directly from the installed binary's own bundled documentation (see docs/providers/grok-build-cli-evidence.md for the full extracts, strings command and binary version/hash); where that documentation does not settle a question (e.g. ask_user_question behavior under dontAsk), the control stays unqualified rather than assumed safe.",
2759
+ "1.0.77 captured permissions (2026-11-10): default headless cancels spawn_subagent and workflow because a headless run cannot ask for approval; --allow spawn_subagent did not cover them. --permission-mode auto ran them, but AIWG keeps its existing permission defaults. Evidence: test/fixtures/providers/grok-build/captured-20261110/permissions.json; test/unit/providers/grok-build-headless.test.ts. ACP authMethods, logged-in session/new, end_turn usage, compact notifications and cancelled/MidTurnAbort are replayed in grok-build-acp.test.ts; live ACP dispatch qualification remains deferred. Native -w creates standalone copies under ~/.grok/worktrees/<slug>/<name>, not git worktrees; ownership/recovery list parsing is tested in grok-build-dispatch.test.ts. The combined flags were verified live on 1.0.77 (2026-11-10: no spawn_subagent or workflow call, no subagent records); compatibility with the older pinned 1.0.50 direct profile remains unverified.",
2752
2760
  "Live qualification is an open S1 blocker: this profile has been exercised only against --help/--version/subcommand --help plus strings-read bundled docs, never a live prompted run. The smoke command in docs/providers/grok-build-direct.md is the first live check and needs an XAI_API_KEY (or cached grok login) from the operator."
2753
2761
  ],
2754
2762
  "health": {
@@ -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',
@@ -39,9 +40,9 @@ export const PROVIDER_DISCOVERY_DECISIONS = {
39
40
  },
40
41
  factory: {
41
42
  provider: 'factory',
42
- status: 'unsupported',
43
- interface: null,
44
- reason: 'Droid exposes model selection through policy and interactive surfaces, but no documented non-interactive model-list command.',
43
+ status: 'native',
44
+ interface: 'bounded customModels fields from ~/.factory/settings.json; droid --version',
45
+ reason: 'Configured BYOK custom selectors are observable locally; built-in plan models have no documented non-interactive model-list command and stay static.',
45
46
  documentation: 'https://docs.factory.ai/cli/configuration/models',
46
47
  },
47
48
  grokbot: {
@@ -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;
@@ -635,6 +636,10 @@ export async function resolveDynamicModelCatalog(options) {
635
636
  muse: () => discoverMuseCatalogModels({
636
637
  ...options.muse, catalogDir: options.muse?.catalogDir ?? join(homeDir, MUSE_CATALOG_DIR), now: options.now,
637
638
  }),
639
+ factory: async () => {
640
+ const { discoverProjectFactoryModels } = await import('./factory-models.js');
641
+ return discoverProjectFactoryModels(options.inventory.projectDir, { homeDir, runner: options.runner, now: options.now });
642
+ },
638
643
  opencode: () => discoverOpenCodeModels(),
639
644
  openclaw: () => discoverOpenClawModels(),
640
645
  pi: () => discoverPiModels(),
@@ -646,6 +651,8 @@ export async function resolveDynamicModelCatalog(options) {
646
651
  };
647
652
  const providerDiscovery = {};
648
653
  for (const provider of available) {
654
+ if (!usesVendorDiscovery(provider, options))
655
+ continue;
649
656
  const discoverer = nativeDiscoverers[provider];
650
657
  if (discoverer) {
651
658
  try {
@@ -751,6 +758,7 @@ export async function resolveDynamicModelCatalog(options) {
751
758
  for (const entry of Object.values(providerDiscovery)) {
752
759
  resolved = recordAccountInstance(resolved, discoveryInstanceId(entry), entry);
753
760
  }
761
+ resolved = await mergeLocalEndpointCatalog(resolved, options, cached);
754
762
  await atomicWrite(cacheFile, `${JSON.stringify(resolved, null, 2)}\n`);
755
763
  return resolved;
756
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';
@@ -7,6 +7,8 @@ export function loadRecordedWorkerInstallations(input: {
7
7
  cwd: string;
8
8
  policy?: WorkerSelectionPolicy;
9
9
  parallelism?: import('../config/aiwg-config.js').ParallelismConfig;
10
+ /** Restrict revalidation to a CLI already selected by a bound invocation. */
11
+ cli?: string;
10
12
  storePath?: string;
11
13
  storeDigest?: string;
12
14
  /** Request validation after store presence, before recorded policy/adapter checks. */
@@ -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
@@ -836,7 +837,7 @@ export async function recordWorkerInstallation(instance, options) {
836
837
 
837
838
  /** Read recorded host authority, validate installation bytes and the current CLI
838
839
  * version, then load the same approved factory used by Ralph. */
839
- export async function loadRecordedWorkerInstallations({ registry, cwd, policy, parallelism, storePath, storeDigest, precheckPolicy }) {
840
+ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, parallelism, cli: requestedCli, storePath, storeDigest, precheckPolicy }) {
840
841
  const { WorkerPolicyError, WorkerQualificationPolicyError, parseProviderModelCapabilities } = await import('./provider-policy.js');
841
842
  // Compiled TS modules load lazily so the managed launcher's ESM-only import chain stays minimal (#3851).
842
843
  const { workerQualificationPolicyDiagnostic } = await import('./worker-qualification-policy.js');
@@ -890,6 +891,9 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
890
891
  if (prior === undefined || workspaces[prior] !== requestedWorkspace) selected.set(record?.cli, index);
891
892
  }
892
893
  for (const [registration, record] of stored.registrations.entries()) {
894
+ // Shared-store registrations outside this request cannot grant authority or block it.
895
+ if ((parallelism && !Object.keys(parallelism.clis ?? {}).includes(record?.cli))
896
+ || (requestedCli !== undefined && record?.cli !== requestedCli)) continue;
893
897
  reason = 'record-identity';
894
898
  try {
895
899
  const { cli, binding, adapter } = record;
@@ -912,6 +916,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
912
916
  if (binding.profile !== installation.profile || binding.cliVersion !== installation.cliVersion
913
917
  || binding.accountScope !== installation.accountScope
914
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();
915
920
  reason = 'effective-config-digest';
916
921
  if (qualificationDigest(policy) !== installation.effectiveConfigDigest) throw fail();
917
922
  reason = 'evidence';
@@ -925,7 +930,13 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
925
930
  await assertTrustedStore(filename, installation.workerWritableRoots);
926
931
  reason = 'adapter-metadata';
927
932
  const candidateRegistry = structuredClone(resolvedRegistry);
928
- if (candidateRegistry.providers[adapter.id]) candidateRegistry.providers[adapter.id].workerAdapter = adapter;
933
+ // Match qualification's provider lookup without making a -direct ID canonical.
934
+ const provider = candidateRegistry.providers[adapter.provider];
935
+ const reference = parallelism?.clis?.[cli]?.adapter ?? `providers:${cli}`;
936
+ const providerId = isOperatorQualifiedWorkerAdapter(adapter)
937
+ && (provider?.workerAdapter ?? provider?.workerHealthAdapter)?.id === adapter.id
938
+ && reference === `providers:${adapter.provider}` ? adapter.provider : adapter.id;
939
+ if (candidateRegistry.providers[providerId]) candidateRegistry.providers[providerId].workerAdapter = adapter;
929
940
  else { candidateRegistry.workerAdapters ??= {}; candidateRegistry.workerAdapters[adapter.id] = adapter; }
930
941
  parseProviderModelCapabilities(candidateRegistry);
931
942
  // The loader validates package identity, bytes and static exports BEFORE import.
@@ -995,7 +1006,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
995
1006
  ...(typeof instance.buildWorkerStdinFrame === 'function'
996
1007
  ? { buildWorkerStdinFrame: (brief, invocation) => instance.buildWorkerStdinFrame(brief, invocation) } : {}),
997
1008
  buildInvocation: async input => profile.transport === 'shell'
998
- ? 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)
999
1010
  : instance.buildInvocation(input),
1000
1011
  prepareWorkerInvocation: (invocation, qualification) => prepareInstalledWorkerInvocation(instance, invocation, qualification),
1001
1012
  ...(mcpRegistry ? { mcpRegistry, mcpProfile: record.mcpProfile } : {}),