@aiwg/cli 2026.10.9 → 2026.10.11

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 (116) hide show
  1. package/agentic/code/providers/model-capabilities.v1.json +275 -17
  2. package/bin/aiwg.mjs +8 -0
  3. package/dist/src/cli/handlers/mc-admission.js +39 -0
  4. package/dist/src/cli/handlers/mc.js +2 -31
  5. package/dist/src/cli/handlers/models-help.js +52 -0
  6. package/dist/src/cli/handlers/models.js +11 -81
  7. package/dist/src/cli/handlers/sessions.js +198 -15
  8. package/dist/src/cli/handlers/use-addon-profile.js +72 -0
  9. package/dist/src/cli/handlers/use.js +203 -234
  10. package/dist/src/cli/ui.js +1 -0
  11. package/dist/src/config/aiwg-config.js +38 -184
  12. package/dist/src/config/cli-help.js +54 -0
  13. package/dist/src/config/cli.js +5 -69
  14. package/dist/src/config/config-normalization.js +10 -0
  15. package/dist/src/config/worker-activation-gate.js +26 -0
  16. package/dist/src/config/worker-adoption-cli.js +102 -0
  17. package/dist/src/config/worker-adoption.js +368 -0
  18. package/dist/src/config/worker-config-digest.js +14 -0
  19. package/dist/src/config/worker-context.js +337 -0
  20. package/dist/src/config/worker-group-templates.js +150 -0
  21. package/dist/src/config/worker-guidance-warning.js +28 -0
  22. package/dist/src/config/worker-owner-lock.js +152 -0
  23. package/dist/src/config/worker-parallelism.js +154 -0
  24. package/dist/src/config/worker-write.js +75 -0
  25. package/dist/src/decision/telemetry/exporter.js +2 -1
  26. package/dist/src/decision/telemetry/index.js +1 -0
  27. package/dist/src/decision/telemetry/mapping.js +43 -0
  28. package/dist/src/decision/telemetry/otlp-http.js +5 -2
  29. package/dist/src/decision/telemetry/redaction.js +6 -1
  30. package/dist/src/decision/telemetry/types.js +3 -0
  31. package/dist/src/decision/telemetry/worker.js +69 -0
  32. package/dist/src/lint/rule-activation.js +15 -7
  33. package/dist/src/lint/runner.js +2 -2
  34. package/dist/src/mcp/server.mjs +2 -11
  35. package/dist/src/mcp/stdio-lifecycle.mjs +27 -0
  36. package/dist/src/mcp/tools/worker-failure-diagnostics.mjs +9 -0
  37. package/dist/src/mcp/tools/worker-invoke.mjs +114 -16
  38. package/dist/src/mission-protocol/codecs.js +8 -38
  39. package/dist/src/mission-protocol/worker-contract-diagnostics.js +62 -0
  40. package/dist/src/mission-protocol/worker-invocation-types.js +2 -0
  41. package/dist/src/models/conductor-data-policy.d.mts +8 -0
  42. package/dist/src/models/conductor-data-policy.mjs +190 -0
  43. package/dist/src/models/config-loader.js +19 -3
  44. package/dist/src/models/config-writer.js +27 -0
  45. package/dist/src/models/model-capabilities.v1.json +275 -17
  46. package/dist/src/models/provider-policy.js +14 -155
  47. package/dist/src/models/resolver.js +2 -293
  48. package/dist/src/models/worker-artifact-binding.mjs +12 -0
  49. package/dist/src/models/worker-direct-readiness-policy.js +155 -0
  50. package/dist/src/models/worker-direct-readiness.js +9 -218
  51. package/dist/src/models/worker-health-readiness.js +105 -26
  52. package/dist/src/models/worker-installation.mjs +12 -14
  53. package/dist/src/models/worker-member-references.js +64 -0
  54. package/dist/src/models/worker-plan.js +317 -0
  55. package/dist/src/models/worker-selection-policy.js +217 -0
  56. package/dist/src/models/wrapper-deployment.js +1 -1
  57. package/dist/src/policy/authorization.js +29 -1
  58. package/dist/src/process/aiwg-probe-command.d.mts +15 -0
  59. package/dist/src/process/aiwg-probe-command.mjs +37 -0
  60. package/dist/src/serve/shared-host-admission-checks.js +116 -0
  61. package/dist/src/serve/shared-host-scheduler.js +25 -107
  62. package/dist/src/serve/shared-host-starvation.js +73 -0
  63. package/dist/src/serve/worker-artifacts.d.mts +4 -0
  64. package/dist/src/serve/worker-artifacts.mjs +56 -0
  65. package/dist/src/serve/worker-command-request.js +68 -0
  66. package/dist/src/serve/worker-invocation-paths.js +144 -0
  67. package/dist/src/serve/worker-invocation-preparation.js +169 -0
  68. package/dist/src/serve/worker-invocation.js +24 -291
  69. package/dist/src/serve/worker-stdin-frame.d.mts +2 -2
  70. package/dist/src/serve/worker-stdin-frame.mjs +6 -6
  71. package/dist/src/sessions/adapters/grokbot.js +7 -0
  72. package/dist/src/sessions/batch-import.js +34 -6
  73. package/dist/src/sessions/contracts.js +19 -0
  74. package/dist/src/sessions/coverage-preflight.js +7 -1
  75. package/dist/src/sessions/fortemi-export-mapping.js +33 -3
  76. package/dist/src/sessions/host-catalog.js +157 -0
  77. package/dist/src/sessions/image-blobs.js +141 -0
  78. package/dist/src/sessions/importer.js +23 -3
  79. package/dist/src/sessions/index.js +2 -0
  80. package/dist/src/sessions/refresh.js +25 -2
  81. package/dist/src/sessions/repository.js +164 -22
  82. package/dist/src/sessions/workspace-discovery.js +5 -2
  83. package/dist/src/smiths/context-pipeline/parallelism-section.js +19 -7
  84. package/package.json +15 -1
  85. package/schemas/mission-v1.schema.json +20 -19
  86. package/schemas/models/model-config-compatibility.v1.schema.json +16 -0
  87. package/tools/agents/providers/claude-post-deploy.mjs +35 -0
  88. package/tools/agents/providers/claude.mjs +3 -30
  89. package/tools/agents/providers/codex-post-deploy.mjs +13 -0
  90. package/tools/agents/providers/codex.mjs +2 -8
  91. package/tools/agents/providers/conductor-data-guard.mjs +61 -0
  92. package/tools/agents/providers/rule-delivery.mjs +3 -16
  93. package/tools/agents/providers/rule-presentation.mjs +38 -0
  94. package/tools/plugin/package-plugins.mjs +1 -1
  95. package/tools/ralph-external/lib/claude-adapter.mjs +2 -2
  96. package/tools/ralph-external/lib/codex-adapter.mjs +3 -3
  97. package/tools/ralph-external/lib/managed-worker-attempt.mjs +86 -0
  98. package/tools/ralph-external/lib/muse-adapter.mjs +10 -0
  99. package/tools/ralph-external/lib/provider-adapter.mjs +11 -260
  100. package/tools/ralph-external/lib/session-attempt.mjs +85 -0
  101. package/tools/ralph-external/lib/strict-worker-json.mjs +190 -0
  102. package/tools/ralph-external/lib/worker-artifacts.mjs +209 -0
  103. package/tools/ralph-external/lib/worker-context.mjs +237 -0
  104. package/tools/ralph-external/lib/worker-final.mjs +143 -0
  105. package/tools/ralph-external/lib/worker-inputs.mjs +55 -0
  106. package/tools/ralph-external/lib/worker-invocation-ancestry.mjs +132 -0
  107. package/tools/ralph-external/lib/worker-invocation-processes.mjs +123 -0
  108. package/tools/ralph-external/lib/worker-isolation-status.mjs +48 -0
  109. package/tools/ralph-external/lib/worker-isolation.mjs +19 -73
  110. package/tools/ralph-external/lib/worker-launch-cli.mjs +49 -0
  111. package/tools/ralph-external/lib/worker-native-sandbox.mjs +83 -0
  112. package/tools/ralph-external/lib/worker-overflow.mjs +48 -13
  113. package/tools/ralph-external/lib/worker-retry-evidence.mjs +103 -0
  114. package/tools/ralph-external/lib/worker-termination.mjs +82 -0
  115. package/tools/ralph-external/session-launcher.mjs +124 -313
  116. package/vscode-extension/schemas/aiwg.config.v1.json +161 -2
@@ -0,0 +1,82 @@
1
+ // Confirm owned containment is empty independently of semantic observer coverage.
2
+ import { sampleWorkerIdentity, isSafeWorkerGroupTarget } from '../process-monitor.mjs';
3
+ import { getWorkerIsolationStatus } from './worker-isolation-status.mjs';
4
+ import { scanWorkerInvocationProcesses } from './worker-invocation-processes.mjs';
5
+
6
+ export function observeWorkerTermination({ mode, native, workerExited, identity,
7
+ supervisor = sampleWorkerIdentity(process.pid), kill = process.kill, invocationId,
8
+ scan = scanWorkerInvocationProcesses, deadline } = {}) {
9
+ if (mode === 'systemd-unit') {
10
+ const exited = workerExited === true || [1, 2, 3].includes(native?.execMainCode);
11
+ return { confirmed: exited && native?.active === false && native?.cgroupEmpty === true,
12
+ missing: !exited ? 'launcher-observed exit or unit ExecMainCode exit evidence' : native?.active !== false
13
+ ? 'unit inactive evidence' : native?.cgroupEmpty !== true ? 'empty unit cgroup (TasksCurrent=0)' : null };
14
+ }
15
+ if (!workerExited) return { confirmed: false, missing: 'launcher-observed worker exit' };
16
+ if (!identity || identity.pid !== identity.pgid || identity.uid !== process.getuid?.()
17
+ || !supervisor || identity.host !== supervisor.host || identity.bootId !== supervisor.bootId
18
+ || !isSafeWorkerGroupTarget(identity.pgid, supervisor)) {
19
+ return { confirmed: false, missing: 'launcher-owned process group identity on this host and boot' };
20
+ }
21
+ try { kill(-identity.pgid, 0); }
22
+ catch (error) {
23
+ // Pass the recorded leader so the marker scan can tell a parallel
24
+ // hardened (non-dumpable) worker's tree apart from a genuine escapee via
25
+ // readable stat/cgroup links instead of failing closed on every
26
+ // unreadable post-start process.
27
+ if (error.code === 'ESRCH') {
28
+ return scan({ invocationId, startTicks: identity.startTicks, uid: identity.uid, deadline,
29
+ workerPid: identity.pid, workerPgid: identity.pgid, workerSession: identity.sessionId });
30
+ }
31
+ return { confirmed: false, missing: `empty owned process group (signal-0 returned ${error.code ?? 'unknown'})` };
32
+ }
33
+ return { confirmed: false, missing: 'empty owned process group (signal-0 still finds members)' };
34
+ }
35
+
36
+ export function terminationRemedy(result, runDir) {
37
+ const missing = result?.isolation === 'systemd-unit'
38
+ ? 'unit exit, inactive state and empty cgroup (TasksCurrent=0)'
39
+ : 'launcher-observed worker exit, empty owned process group (kill(-pgid, 0) = ESRCH) and escaped-descendant evidence (bounded same-uid invocation-marker scan in Linux /proc)';
40
+ return `Missing evidence: ${missing}. Repeat the original --launch-worker${runDir ? ` --retry-of-run-dir ${JSON.stringify(runDir)}` : ' --retry-of-run-dir DIR'} or --verify-worker${runDir ? ` --run-dir ${JSON.stringify(runDir)}` : ' --run-dir DIR'} command with --check-descendants for a bounded descendant check (at most 2 seconds); live or unknown descendants still refuse linkage. Missing launcher-owned group identity requires the original launch owner to establish containment; worker-reported identity cannot authorize this check.`;
41
+ }
42
+
43
+ export async function recheckWorkerTermination({ processRecord, exitRecord,
44
+ status = getWorkerIsolationStatus, observe = observeWorkerTermination,
45
+ now = () => performance.now(), wait = ms => new Promise(resolve => setTimeout(resolve, ms)) }) {
46
+ if (processRecord?.invocationId !== exitRecord.invocationId || processRecord.origin !== 'launcher') {
47
+ return { confirmed: false, missing: 'matching launcher process.json' };
48
+ }
49
+ const local = sampleWorkerIdentity(process.pid);
50
+ if (!local || processRecord.supervisor?.host !== local.host || processRecord.supervisor?.bootId !== local.bootId
51
+ || processRecord.supervisor?.uid !== local.uid || processRecord.isolation !== exitRecord.isolation
52
+ || !['systemd-unit', 'native-sandbox', 'degraded'].includes(processRecord.isolation)) {
53
+ return { confirmed: false, missing: 'launcher containment identity on this host and boot' };
54
+ }
55
+ const identity = processRecord.identityObservation === 'stable-owned-group'
56
+ && processRecord.ownership === 'owned-group' ? processRecord.worker : null;
57
+ if (processRecord.isolation !== 'systemd-unit' && processRecord.invocationMarker !== processRecord.invocationId) {
58
+ return { confirmed: false, missing: 'escaped-descendant evidence: launcher-bound invocation marker in process.json' };
59
+ }
60
+ const deadline = now() + 2000;
61
+ // Both elapsed time and sample count bound the check, including injected clocks.
62
+ let evidence;
63
+ for (let attempt = 0; attempt < 21; attempt++) {
64
+ if (evidence && now() >= deadline) return evidence;
65
+ let native = null;
66
+ // Use the unit's retained exit state whenever a unit name is recorded,
67
+ // not only when the recorded mode already says systemd-unit: launch-mode
68
+ // selection is unchanged, but unit (cgroup) evidence is preferred
69
+ // wherever it is available. Non-unit modes still ignore it below.
70
+ if (typeof processRecord.unit === 'string' && processRecord.unit !== '') {
71
+ try { native = status(processRecord.unit, { timeoutMs: Math.max(1, Math.min(100, deadline - now())) }); }
72
+ catch { /* Unavailable is never empty. */ }
73
+ }
74
+ evidence = observe({ mode: processRecord.isolation, native, identity, invocationId: processRecord.invocationId,
75
+ deadline: Math.min(deadline, now() + 100),
76
+ workerExited: Number.isInteger(exitRecord.exitCode) && exitRecord.exitCode >= 0 && exitRecord.exitCode <= 255
77
+ || exitRecord.captureCoverage === 'complete' && exitRecord.workerTermination === 'confirmed' && /^SIG[A-Z0-9]+$/.test(exitRecord.signal ?? '') });
78
+ if (evidence.confirmed || evidence.markerPresent || now() >= deadline || attempt === 20) return evidence;
79
+ await wait(Math.min(100, Math.max(0, deadline - now())));
80
+ }
81
+ return evidence;
82
+ }