@aiwg/cli 2026.10.0 → 2026.10.3

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 (168) hide show
  1. package/agentic/code/providers/capability-matrix.yaml +270 -0
  2. package/agentic/code/providers/model-capabilities.v1.json +3091 -24
  3. package/bin/aiwg.mjs +86 -21
  4. package/dist/src/a2a/codecs.js +9 -0
  5. package/dist/src/artifacts/corpus-tools/vision-extract.js +105 -15
  6. package/dist/src/artifacts/repair.js +9 -4
  7. package/dist/src/channel/manager.mjs +59 -10
  8. package/dist/src/cli/child-process-result.js +40 -0
  9. package/dist/src/cli/env.js +38 -16
  10. package/dist/src/cli/flag-parsing.js +236 -0
  11. package/dist/src/cli/handlers/decision.js +297 -2
  12. package/dist/src/cli/handlers/diagnose.js +9 -2
  13. package/dist/src/cli/handlers/feedback.js +14 -5
  14. package/dist/src/cli/handlers/init.js +245 -30
  15. package/dist/src/cli/handlers/mc.js +23 -0
  16. package/dist/src/cli/handlers/models.js +69 -6
  17. package/dist/src/cli/handlers/ralph.js +3 -0
  18. package/dist/src/cli/handlers/refresh.js +16 -0
  19. package/dist/src/cli/handlers/regenerate.js +14 -0
  20. package/dist/src/cli/handlers/runtime-info.js +24 -9
  21. package/dist/src/cli/handlers/script-runner.js +16 -6
  22. package/dist/src/cli/handlers/session.js +396 -62
  23. package/dist/src/cli/handlers/sessions.js +146 -40
  24. package/dist/src/cli/handlers/setup-manifest.js +439 -39
  25. package/dist/src/cli/handlers/setup.js +139 -39
  26. package/dist/src/cli/handlers/subcommands.js +3 -1
  27. package/dist/src/cli/handlers/team.js +18 -8
  28. package/dist/src/cli/handlers/use.js +13 -0
  29. package/dist/src/cli/handlers/utilities.js +106 -23
  30. package/dist/src/cli/prompt-utils.js +72 -0
  31. package/dist/src/cli/provider-resolution.js +11 -0
  32. package/dist/src/config/aiwg-config.js +268 -4
  33. package/dist/src/config/cli.js +146 -19
  34. package/dist/src/config/dispatch-thresholds-runtime.mjs +38 -0
  35. package/dist/src/config/project-artifacts-health.mjs +14 -3
  36. package/dist/src/config/user-config.js +36 -10
  37. package/dist/src/decision/adapters/jev.js +80 -28
  38. package/dist/src/decision/ask.js +352 -0
  39. package/dist/src/decision/driver.js +4 -0
  40. package/dist/src/decision/entry.js +38 -6
  41. package/dist/src/decision/heldout/collector.js +10 -1
  42. package/dist/src/decision/index.js +3 -0
  43. package/dist/src/decision/interop.js +60 -8
  44. package/dist/src/decision/jev-credentials.js +121 -0
  45. package/dist/src/decision/ledger.js +839 -0
  46. package/dist/src/decision/validate.js +6 -3
  47. package/dist/src/effects/dispatch-verifier.js +252 -0
  48. package/dist/src/effects/index.js +1 -0
  49. package/dist/src/features/installer.js +2 -2
  50. package/dist/src/flow/graph-metadata.js +5 -0
  51. package/dist/src/gates/providers/loader.js +3 -1
  52. package/dist/src/installation/manager-command.mjs +1 -1
  53. package/dist/src/installation/manager.mjs +17 -2
  54. package/dist/src/lint/runner.js +2 -2
  55. package/dist/src/mcp/adapters/codex-runtime.js +360 -56
  56. package/dist/src/mcp/cli.mjs +587 -77
  57. package/dist/src/mcp/config-file.mjs +279 -0
  58. package/dist/src/mcp/config-layers.mjs +348 -0
  59. package/dist/src/mcp/credentials.mjs +484 -0
  60. package/dist/src/mcp/grok-build-config.mjs +16 -26
  61. package/dist/src/mcp/helpers.mjs +106 -2
  62. package/dist/src/mcp/omp-config.mjs +50 -29
  63. package/dist/src/mcp/profiles.js +97 -23
  64. package/dist/src/mcp/profiles.mjs +99 -27
  65. package/dist/src/mcp/registry.js +264 -57
  66. package/dist/src/mcp/registry.mjs +198 -45
  67. package/dist/src/mcp/server.mjs +403 -20
  68. package/dist/src/mcp/toml-string.mjs +9 -0
  69. package/dist/src/mcp/toml-strip-mcp.mjs +135 -0
  70. package/dist/src/mcp/tool-filters.mjs +357 -0
  71. package/dist/src/mcp/tools/agentic-sandbox.mjs +3 -1
  72. package/dist/src/mcp/tools/decision.mjs +58 -0
  73. package/dist/src/mcp/tools/orchestration.mjs +38 -0
  74. package/dist/src/mcp/tools/subsystems.mjs +39 -8
  75. package/dist/src/mcp/tools/worker-invoke.mjs +1539 -0
  76. package/dist/src/mcp/tools/worker-shell-control.mjs +258 -0
  77. package/dist/src/mcp/tools/worker-stdin-runtime.mjs +79 -0
  78. package/dist/src/memory/project-registry.js +2 -2
  79. package/dist/src/mission-protocol/codecs.js +639 -1
  80. package/dist/src/mission-protocol/types.js +110 -0
  81. package/dist/src/mission-protocol/worker-status.js +2 -0
  82. package/dist/src/models/config-loader.js +70 -13
  83. package/dist/src/models/grok-build-models.js +93 -41
  84. package/dist/src/models/model-capabilities.v1.json +3091 -24
  85. package/dist/src/models/model-discovery.js +862 -63
  86. package/dist/src/models/provider-policy.js +625 -11
  87. package/dist/src/models/qualification-digest.mjs +17 -0
  88. package/dist/src/models/resolver.js +259 -0
  89. package/dist/src/models/worker-direct-readiness.js +529 -0
  90. package/dist/src/models/worker-dispatch-offer.js +169 -0
  91. package/dist/src/models/worker-health-readiness.js +131 -0
  92. package/dist/src/models/worker-installation.mjs +879 -0
  93. package/dist/src/models/wrapper-route.js +18 -0
  94. package/dist/src/ops/registry.js +9 -14
  95. package/dist/src/plugins/standalone-packager.js +4 -3
  96. package/dist/src/process/bounded-child-process.mjs +387 -0
  97. package/dist/src/process/cli-command.mjs +75 -0
  98. package/dist/src/providers/capability-matrix.js +8 -0
  99. package/dist/src/providers/capability-matrix.yaml +270 -0
  100. package/dist/src/providers/grok-build-headless.js +43 -21
  101. package/dist/src/providers/provider-definitions.js +9 -1
  102. package/dist/src/providers/provider-definitions.mjs +9 -2
  103. package/dist/src/serve/executor-registry.js +16 -24
  104. package/dist/src/serve/fleet-mission-conductor.js +9 -0
  105. package/dist/src/serve/mission-conductor.js +9 -0
  106. package/dist/src/serve/shared-host-scheduler.js +2 -0
  107. package/dist/src/serve/worker-invocation.js +538 -0
  108. package/dist/src/serve/worker-stdin-frame.mjs +107 -0
  109. package/dist/src/sessions/adapter-registry.js +45 -0
  110. package/dist/src/sessions/adapters/generic.js +37 -3
  111. package/dist/src/sessions/adapters/grokbot-locator.js +111 -0
  112. package/dist/src/sessions/adapters/grokbot.js +423 -24
  113. package/dist/src/sessions/adapters/muse-workspace-scan.js +108 -0
  114. package/dist/src/sessions/adapters/muse.js +68 -29
  115. package/dist/src/sessions/adapters/pi.js +1 -0
  116. package/dist/src/sessions/batch-contracts.js +13 -1
  117. package/dist/src/sessions/batch-import.js +23 -42
  118. package/dist/src/sessions/candidates.js +47 -11
  119. package/dist/src/sessions/contracts.js +35 -0
  120. package/dist/src/sessions/coverage-preflight.js +134 -0
  121. package/dist/src/sessions/discovery.js +3 -0
  122. package/dist/src/sessions/grok-build-cli.js +67 -5
  123. package/dist/src/sessions/importer.js +24 -8
  124. package/dist/src/sessions/index.js +2 -0
  125. package/dist/src/sessions/repository.js +54 -13
  126. package/dist/src/sessions/workspace-discovery.js +99 -37
  127. package/dist/src/skills/adapters/clawhub.js +10 -8
  128. package/dist/src/skills/adapters/openclaw.js +10 -7
  129. package/dist/src/smiths/context-pipeline/parallelism-section.js +192 -3
  130. package/dist/src/smiths/context-pipeline/workspace-context.js +116 -9
  131. package/dist/src/smiths/hook-bridge/codex-translator.js +6 -5
  132. package/dist/src/smiths/mcpsmith/example.js +1 -1
  133. package/dist/src/smiths/toolsmith/runtime-discovery.mjs +10 -14
  134. package/dist/src/storage/backends/logseq.js +68 -7
  135. package/dist/src/storage/fortemi-qualification-receipt.js +2 -2
  136. package/dist/src/testing/generators/test-code-generator.js +57 -30
  137. package/dist/src/uhp/client.js +11 -1
  138. package/dist/src/uhp/mission.js +5 -0
  139. package/dist/src/update/checker.mjs +5 -5
  140. package/dist/src/update/notifier.mjs +54 -2
  141. package/dist/src/writing/fidelity.js +18 -1
  142. package/package.json +18 -1
  143. package/schemas/mission-v1.schema.json +2429 -0
  144. package/schemas/models/model-catalog.v1.schema.json +301 -0
  145. package/schemas/models/model-config-compatibility.v1.schema.json +281 -0
  146. package/schemas/models/model-policy.v1.schema.json +14 -0
  147. package/schemas/models/provider-model-capabilities.v1.schema.json +1066 -0
  148. package/tools/_resolve-impl.mjs +39 -0
  149. package/tools/agents/deploy-agents.mjs +15 -2
  150. package/tools/agents/providers/base.mjs +63 -43
  151. package/tools/agents/providers/grokbot.mjs +11 -12
  152. package/tools/agents/providers/hermes.mjs +6 -3
  153. package/tools/agents/providers/omp.mjs +5 -2
  154. package/tools/agents/providers/openclaw-translator.mjs +19 -5
  155. package/tools/providers/deepseek-harness-transport.mjs +358 -0
  156. package/tools/providers/omp-transport.mjs +192 -0
  157. package/tools/ralph-external/lib/claude-adapter.mjs +389 -0
  158. package/tools/ralph-external/lib/codex-adapter.mjs +432 -0
  159. package/tools/ralph-external/lib/deepseek-harness-adapter.mjs +397 -0
  160. package/tools/ralph-external/lib/factory-adapter.mjs +503 -0
  161. package/tools/ralph-external/lib/muse-adapter.mjs +364 -0
  162. package/tools/ralph-external/lib/omp-adapter.mjs +315 -0
  163. package/tools/ralph-external/lib/opencode-adapter.mjs +575 -0
  164. package/tools/ralph-external/lib/openhuman-adapter.mjs +75 -0
  165. package/tools/ralph-external/lib/pi-adapter.mjs +333 -0
  166. package/tools/ralph-external/lib/provider-adapter.mjs +690 -0
  167. package/tools/ralph-external/lib/worker-health.mjs +439 -0
  168. package/vscode-extension/schemas/aiwg.config.v1.json +1953 -0
@@ -10,7 +10,9 @@
10
10
  * @implements #889
11
11
  */
12
12
 
13
- import { readFile, writeFile, mkdir } from 'fs/promises';
13
+ import { resolveCredentialPolicy } from './credentials.mjs';
14
+ import { isLowerLayerEntry, loadLayered, resolveProfileExtends, resolveConfigLayers, saveLayerData } from './config-layers.mjs';
15
+ import { readFile, writeFile } from 'fs/promises';
14
16
  import { resolve } from 'path';
15
17
  import { homedir } from 'os';
16
18
  import { existsSync } from 'fs';
@@ -95,8 +97,12 @@ export class McpProfileRegistry {
95
97
  #configDir;
96
98
  #cache = null;
97
99
 
100
+ #layers;
101
+ #layering = null;
102
+
98
103
  constructor(configDirOverride) {
99
- this.#configDir = resolveConfigDir(configDirOverride);
104
+ this.#layers = resolveConfigLayers(configDirOverride);
105
+ this.#configDir = this.#layers ? this.#layers[this.#layers.length - 1] : resolveConfigDir(configDirOverride);
100
106
  }
101
107
 
102
108
  getPath() {
@@ -106,6 +112,13 @@ export class McpProfileRegistry {
106
112
  async load() {
107
113
  if (this.#cache) return this.#cache;
108
114
 
115
+ if (this.#layers) {
116
+ const layered = await loadLayered(this.#layers, PROFILES_FILENAME, 'profiles', DEFAULT_DATA);
117
+ this.#cache = layered.data;
118
+ this.#layering = layered.layering;
119
+ return this.#cache;
120
+ }
121
+
109
122
  const filePath = this.getPath();
110
123
  try {
111
124
  const content = await readFile(filePath, 'utf-8');
@@ -119,17 +132,24 @@ export class McpProfileRegistry {
119
132
  this.#cache = { ...DEFAULT_DATA, profiles: {} };
120
133
  }
121
134
 
135
+ try {
136
+ resolveCredentialPolicy({ registryPolicy: this.#cache.credentialPolicy, env: {} });
137
+ } catch (error) {
138
+ this.#cache = null;
139
+ throw new Error(`Invalid MCP credential policy in ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
140
+ }
141
+
122
142
  return this.#cache;
123
143
  }
124
144
 
125
- async save() {
126
- if (!this.#cache) return;
127
- await mkdir(this.#configDir, { recursive: true });
128
- await writeFile(
129
- this.getPath(),
130
- JSON.stringify(this.#cache, null, 2) + '\n',
131
- 'utf-8',
132
- );
145
+ async save(data = this.#cache) {
146
+ if (!data) return;
147
+ await saveLayerData(this.getPath(), data, 'profiles', this.#layers, this.#layering);
148
+ this.#cache = data;
149
+ if (this.#layers) {
150
+ this.clearCache();
151
+ await this.load();
152
+ }
133
153
  }
134
154
 
135
155
  /**
@@ -171,7 +191,7 @@ export class McpProfileRegistry {
171
191
  /** Add a new profile */
172
192
  async add(profile, serverRegistry) {
173
193
  this.#validateName(profile.name);
174
- const data = await this.load();
194
+ const data = structuredClone(await this.load());
175
195
 
176
196
  if (data.profiles[profile.name]) {
177
197
  throw new Error(
@@ -180,17 +200,19 @@ export class McpProfileRegistry {
180
200
  }
181
201
 
182
202
  await this.#validateServers(profile.servers ?? [], serverRegistry);
203
+ if (profile.extends?.length) resolveProfileExtends(profile.name, { ...data.profiles, [profile.name]: profile });
183
204
 
184
205
  data.profiles[profile.name] = {
185
206
  name: profile.name,
186
207
  description: profile.description,
208
+ ...(profile.extends ? { extends: profile.extends } : {}),
187
209
  servers: profile.servers ?? [],
188
210
  providerOverrides: profile.providerOverrides ?? {},
189
211
  createdAt: new Date().toISOString(),
190
212
  updatedAt: new Date().toISOString(),
191
213
  };
192
214
 
193
- await this.save();
215
+ await this.save(data);
194
216
  }
195
217
 
196
218
  /** Get a profile by name */
@@ -199,6 +221,16 @@ export class McpProfileRegistry {
199
221
  return data.profiles[name];
200
222
  }
201
223
 
224
+ /**
225
+ * Return a profile with its `extends` chain applied across all configuration
226
+ * layers. Use get() for the profile exactly as stored.
227
+ */
228
+ async resolve(name) {
229
+ const data = await this.load();
230
+ if (!data.profiles[name]) return undefined;
231
+ return resolveProfileExtends(name, data.profiles);
232
+ }
233
+
202
234
  /** List all profiles */
203
235
  async list() {
204
236
  const data = await this.load();
@@ -207,7 +239,7 @@ export class McpProfileRegistry {
207
239
 
208
240
  /** Edit an existing profile (add/remove servers, update description) */
209
241
  async edit(name, changes, serverRegistry) {
210
- const data = await this.load();
242
+ const data = structuredClone(await this.load());
211
243
  const existing = data.profiles[name];
212
244
  if (!existing) {
213
245
  throw new Error(`Profile "${name}" not found.`);
@@ -232,20 +264,47 @@ export class McpProfileRegistry {
232
264
  );
233
265
  }
234
266
 
267
+ if (changes.clearToolFilters) {
268
+ const overrides = { ...(current.providerOverrides ?? {}) };
269
+ delete overrides[changes.clearToolFilters];
270
+ current.providerOverrides = overrides;
271
+ }
272
+
273
+ for (const [provider, override] of Object.entries(changes.providerOverrides ?? {})) {
274
+ const overrides = { ...(current.providerOverrides ?? {}) };
275
+ const previous = overrides[provider] ?? {};
276
+ const merge = (before, added) => (added ? [...new Set([...(before ?? []), ...added])] : before);
277
+ overrides[provider] = {
278
+ ...previous,
279
+ ...(override.toolDeny ? { toolDeny: merge(previous.toolDeny, override.toolDeny) } : {}),
280
+ ...(override.toolAllow ? { toolAllow: merge(previous.toolAllow, override.toolAllow) } : {}),
281
+ };
282
+ current.providerOverrides = overrides;
283
+ }
284
+
235
285
  current.updatedAt = new Date().toISOString();
236
286
  data.profiles[name] = current;
237
- await this.save();
287
+ await this.save(data);
238
288
  return data.profiles[name];
239
289
  }
240
290
 
241
291
  /** Remove a profile */
242
292
  async remove(name) {
243
- const data = await this.load();
293
+ const data = structuredClone(await this.load());
244
294
  if (!data.profiles[name]) {
245
295
  throw new Error(`Profile "${name}" not found.`);
246
296
  }
297
+ if (this.#layering && isLowerLayerEntry(this.#layering, name)) {
298
+ throw new Error(`Profile "${name}" is defined in a lower configuration layer; remove it there.`);
299
+ }
300
+ const dependents = Object.entries(data.profiles)
301
+ .filter(([other, profile]) => other !== name && profile.extends?.includes(name))
302
+ .map(([other]) => other);
303
+ if (dependents.length) {
304
+ throw new Error(`Cannot remove profile "${name}": extended by ${dependents.join(', ')}.`);
305
+ }
247
306
  delete data.profiles[name];
248
- await this.save();
307
+ await this.save(data);
249
308
  }
250
309
 
251
310
  /**
@@ -253,7 +312,7 @@ export class McpProfileRegistry {
253
312
  * If the profile contains '__all__', expand to all servers in serverRegistry.
254
313
  */
255
314
  async resolveServers(name, serverRegistry) {
256
- const profile = await this.get(name);
315
+ const profile = await this.resolve(name);
257
316
  if (!profile) {
258
317
  throw new Error(`Profile "${name}" not found.`);
259
318
  }
@@ -276,10 +335,11 @@ export class McpProfileRegistry {
276
335
  async importFrom(filePath) {
277
336
  const content = await readFile(filePath, 'utf-8');
278
337
  const imported = JSON.parse(content);
279
- const data = await this.load();
338
+ const data = structuredClone(await this.load());
280
339
 
281
340
  let added = 0;
282
341
  let updated = 0;
342
+ const invalidNames = [];
283
343
 
284
344
  const profiles = imported.profiles ?? (
285
345
  typeof imported === 'object' && !Array.isArray(imported)
@@ -287,24 +347,30 @@ export class McpProfileRegistry {
287
347
  : {}
288
348
  );
289
349
 
350
+ const candidate = { ...data.profiles };
351
+
290
352
  for (const [name, profile] of Object.entries(profiles)) {
291
353
  try {
292
354
  this.#validateName(name);
293
- } catch {
294
- continue; // skip invalid names silently during import
355
+ } catch (error) {
356
+ // Collected and refused below with the complete graph-validation pass,
357
+ // instead of silently dropping named profiles from the import.
358
+ invalidNames.push(`${name}: ${error instanceof Error ? error.message : String(error)}`);
359
+ continue;
295
360
  }
296
- if (data.profiles[name]) {
297
- data.profiles[name] = {
298
- ...data.profiles[name],
361
+ if (candidate[name]) {
362
+ candidate[name] = {
363
+ ...candidate[name],
299
364
  ...profile,
300
365
  name,
301
366
  updatedAt: new Date().toISOString(),
302
367
  };
303
368
  updated++;
304
369
  } else {
305
- data.profiles[name] = {
370
+ candidate[name] = {
306
371
  name,
307
372
  description: profile.description,
373
+ ...(profile.extends ? { extends: profile.extends } : {}),
308
374
  servers: profile.servers ?? [],
309
375
  providerOverrides: profile.providerOverrides ?? {},
310
376
  createdAt: new Date().toISOString(),
@@ -314,7 +380,13 @@ export class McpProfileRegistry {
314
380
  }
315
381
  }
316
382
 
317
- await this.save();
383
+ if (invalidNames.length) {
384
+ throw new Error(`Refusing to import profile(s) with invalid names: ${invalidNames.join('; ')}`);
385
+ }
386
+
387
+ for (const name of Object.keys(candidate)) resolveProfileExtends(name, candidate);
388
+ data.profiles = candidate;
389
+ await this.save(data);
318
390
  return { added, updated };
319
391
  }
320
392
 
@@ -335,7 +407,7 @@ export class McpProfileRegistry {
335
407
 
336
408
  /** Install preset profiles (does not overwrite existing) */
337
409
  async initPresets() {
338
- const data = await this.load();
410
+ const data = structuredClone(await this.load());
339
411
  let added = 0;
340
412
 
341
413
  for (const [name, preset] of Object.entries(PRESET_PROFILES)) {
@@ -350,7 +422,7 @@ export class McpProfileRegistry {
350
422
  }
351
423
  }
352
424
 
353
- await this.save();
425
+ await this.save(data);
354
426
  return { added, total: Object.keys(PRESET_PROFILES).length };
355
427
  }
356
428