@aiwg/cli 2026.11.3 → 2026.11.5

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 (169) hide show
  1. package/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +3 -2
  2. package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +12 -9
  3. package/agentic/code/addons/aiwg-utils/rules/anti-laziness.md +2 -0
  4. package/agentic/code/addons/composition-engine/lib/runtime.mjs +5 -26
  5. package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +22 -0
  6. package/agentic/code/providers/capability-matrix.yaml +85 -18
  7. package/agentic/code/providers/model-capabilities.v1.json +35 -27
  8. package/dist/src/a2a/hitl-authorization.js +46 -0
  9. package/dist/src/a2a/hitl-driver.js +5 -5
  10. package/dist/src/artifacts/browser-export.js +2 -0
  11. package/dist/src/artifacts/framework-source-digest.js +1 -1
  12. package/dist/src/artifacts/index-builder.js +9 -27
  13. package/dist/src/artifacts/index-capability.js +24 -0
  14. package/dist/src/artifacts/query-engine-discover-output.js +8 -3
  15. package/dist/src/artifacts/query-engine-rules.js +29 -11
  16. package/dist/src/artifacts/query-engine-scoring.js +5 -5
  17. package/dist/src/artifacts/query-engine-show-card.js +5 -1
  18. package/dist/src/artifacts/query-engine-show-load.js +1 -1
  19. package/dist/src/artifacts/query-engine-show.js +3 -3
  20. package/dist/src/artifacts/query-engine-templates.js +10 -4
  21. package/dist/src/artifacts/query-engine-verbose.js +18 -4
  22. package/dist/src/artifacts/relations-builder.js +1 -0
  23. package/dist/src/artifacts/types.js +1 -1
  24. package/dist/src/cli/handlers/checkpoint-handoff.js +2 -1
  25. package/dist/src/cli/handlers/guided-setup.js +3 -1
  26. package/dist/src/cli/handlers/refresh-managed-deployment.js +17 -5
  27. package/dist/src/cli/handlers/rules.js +1 -1
  28. package/dist/src/cli/handlers/script-runner.js +7 -4
  29. package/dist/src/cli/handlers/sessions.js +1 -1
  30. package/dist/src/cli/handlers/steward-format.js +12 -0
  31. package/dist/src/cli/handlers/steward.js +1 -1
  32. package/dist/src/cli/handlers/use.js +14 -6
  33. package/dist/src/cli/handlers/utility-doctor.js +9 -2
  34. package/dist/src/cli/handlers/workspace.js +1 -1
  35. package/dist/src/cli/services/deployment-probe-scope.js +40 -0
  36. package/dist/src/cli/services/deployment-verification.js +4 -5
  37. package/dist/src/config/aiwg-config.js +6 -0
  38. package/dist/src/config/authorization-cli.js +61 -3
  39. package/dist/src/config/cli-help.js +1 -1
  40. package/dist/src/config/cli.js +4 -2
  41. package/dist/src/config/host-resource-runtime.mjs +1 -1
  42. package/dist/src/config/user-registry.js +9 -1
  43. package/dist/src/config/worker-owner-lock.js +90 -10
  44. package/dist/src/decision/graph-flow-adapter.js +1 -1
  45. package/dist/src/effects/authorization-grant.js +50 -0
  46. package/dist/src/effects/authorization-store.js +130 -0
  47. package/dist/src/effects/index.js +2 -0
  48. package/dist/src/effects/ledger.js +1 -0
  49. package/dist/src/effects/lifecycle.js +1 -1
  50. package/dist/src/effects/reader.js +4 -0
  51. package/dist/src/effects/records.js +4 -0
  52. package/dist/src/effects/schema.js +2 -0
  53. package/dist/src/extensions/claude-hooks-installer.js +7 -7
  54. package/dist/src/extensions/manifest.js +6 -0
  55. package/dist/src/extensions/muse-managed-hooks.js +11 -0
  56. package/dist/src/extensions/project-local-discovery.js +21 -1
  57. package/dist/src/extensions/project-local-scaffold.js +19 -7
  58. package/dist/src/extensions/user-hook-diagnostics.js +32 -0
  59. package/dist/src/extensions/verified-hook-command.js +32 -0
  60. package/dist/src/lint/rule-conflicts.js +52 -0
  61. package/dist/src/lint/runner.js +3 -0
  62. package/dist/src/mcp/cli.mjs +3 -1
  63. package/dist/src/mcp/elicitation.mjs +30 -0
  64. package/dist/src/mcp/grok-build-config.mjs +1 -1
  65. package/dist/src/mcp/muse-native-config.mjs +1 -0
  66. package/dist/src/mcp/server.mjs +2 -0
  67. package/dist/src/mcp/tools/authorization.mjs +78 -0
  68. package/dist/src/models/factory-models.js +144 -0
  69. package/dist/src/models/model-capabilities.v1.json +35 -27
  70. package/dist/src/models/model-discovery.js +7 -3
  71. package/dist/src/models/worker-installation.d.mts +2 -0
  72. package/dist/src/models/worker-installation.mjs +11 -2
  73. package/dist/src/models/worker-invocation-policy.js +25 -1
  74. package/dist/src/models/wrapper-enforcement.js +1 -1
  75. package/dist/src/policy/authorization-capture.js +64 -0
  76. package/dist/src/policy/authorization-operations.js +108 -0
  77. package/dist/src/policy/hitl-check.js +3 -2
  78. package/dist/src/policy/hitl-consume.js +14 -0
  79. package/dist/src/policy/hitl-durable-store.js +60 -0
  80. package/dist/src/policy/hitl-durable.js +60 -0
  81. package/dist/src/policy/hitl-receipt.js +5 -0
  82. package/dist/src/policy/hitl.js +44 -6
  83. package/dist/src/policy/repo-access.js +3 -1
  84. package/dist/src/process/bounded-child-process.mjs +49 -39
  85. package/dist/src/providers/capability-matrix.yaml +85 -18
  86. package/dist/src/providers/deployment-ownership.d.mts +1 -0
  87. package/dist/src/providers/deployment-ownership.mjs +29 -3
  88. package/dist/src/providers/deployment-preservation.mjs +44 -3
  89. package/dist/src/providers/grok-build-acp.js +13 -5
  90. package/dist/src/providers/grok-build-dispatch.js +35 -2
  91. package/dist/src/providers/grok-build-headless.js +171 -77
  92. package/dist/src/providers/grok-build-inspect.js +1 -0
  93. package/dist/src/providers/grok-build-paths.js +2 -0
  94. package/dist/src/providers/muse-paths.js +4 -2
  95. package/dist/src/providers/provider-context-contracts.js +12 -4
  96. package/dist/src/providers/provider-definition-schema.js +6 -0
  97. package/dist/src/providers/provider-seeds-1.js +3 -3
  98. package/dist/src/providers/provider-seeds-2.js +6 -4
  99. package/dist/src/providers/provider-seeds-3.js +6 -6
  100. package/dist/src/rules/activation.d.mts +2 -0
  101. package/dist/src/rules/activation.mjs +16 -7
  102. package/dist/src/rules/inline-budget.d.mts +2 -1
  103. package/dist/src/rules/inline-budget.mjs +4 -2
  104. package/dist/src/rules/inventory.js +3 -0
  105. package/dist/src/rules/precedence.d.mts +6 -0
  106. package/dist/src/rules/precedence.mjs +49 -0
  107. package/dist/src/rules/project-precedence.js +73 -0
  108. package/dist/src/rules/rule-frontmatter.schema.json +15 -0
  109. package/dist/src/serve/a2a-terminal-observer.js +12 -3
  110. package/dist/src/serve/mission-hitl.js +20 -1
  111. package/dist/src/serve/worker-stdin-frame.mjs +1 -1
  112. package/dist/src/sessions/adapters/grok-build-fallback.js +33 -0
  113. package/dist/src/sessions/adapters/grok-build-native-records.js +134 -0
  114. package/dist/src/sessions/adapters/grok-build-native.js +237 -98
  115. package/dist/src/sessions/adapters/grok-build.js +95 -32
  116. package/dist/src/sessions/grok-build-cli-output.js +113 -0
  117. package/dist/src/sessions/grok-build-cli.js +4 -28
  118. package/dist/src/sessions/normalization.js +1 -1
  119. package/dist/src/smiths/context-pipeline/bridge-ownership.js +4 -3
  120. package/dist/src/smiths/context-pipeline/finalization.js +5 -0
  121. package/dist/src/smiths/context-pipeline/generator.js +1 -1
  122. package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +20 -17
  123. package/dist/src/smiths/context-pipeline/workspace-doctor.js +6 -1
  124. package/dist/src/smiths/context-pipeline/workspace-document.js +6 -0
  125. package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -12
  126. package/dist/src/smiths/hook-bridge/codex-translator.js +11 -14
  127. package/dist/src/smiths/hook-bridge/codex-trust.js +7 -2
  128. package/dist/src/smiths/hook-bridge/copilot-translator.js +2 -1
  129. package/dist/src/smiths/hook-bridge/factory-trust.js +2 -2
  130. package/dist/src/smiths/hook-bridge/grok-build-translator.js +3 -1
  131. package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +81 -0
  132. package/dist/src/smiths/hook-bridge/hermes-translator.js +5 -3
  133. package/dist/src/smiths/hook-bridge/hermes-trust.js +65 -0
  134. package/dist/src/smiths/hook-bridge/index.js +3 -1
  135. package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +3 -2
  136. package/package.json +7 -1
  137. package/tools/agents/deploy-agents.mjs +9 -8
  138. package/tools/agents/deploy-options.mjs +3 -0
  139. package/tools/agents/providers/base-frontmatter.mjs +3 -2
  140. package/tools/agents/providers/base-inventory.mjs +3 -1
  141. package/tools/agents/providers/base-kernel-skills.mjs +11 -5
  142. package/tools/agents/providers/claude-post-deploy.mjs +1 -1
  143. package/tools/agents/providers/codex-post-deploy.mjs +1 -1
  144. package/tools/agents/providers/generic.mjs +66 -0
  145. package/tools/agents/providers/grok-build.mjs +34 -41
  146. package/tools/agents/providers/model-wrapper.mjs +2 -5
  147. package/tools/agents/providers/muse-hooks.mjs +13 -11
  148. package/tools/agents/providers/muse-prompt-discovery.mjs +5 -1
  149. package/tools/agents/providers/muse.mjs +2 -1
  150. package/tools/agents/providers/openclaw.mjs +2 -1
  151. package/tools/agents/providers/rule-deployment-commit.mjs +3 -0
  152. package/tools/agents/providers/rule-deployment-prepare.mjs +7 -5
  153. package/tools/agents/providers/rule-deployment-state.mjs +14 -6
  154. package/tools/agents/providers/rule-projection.mjs +39 -4
  155. package/tools/agents/providers/rule-startup.mjs +11 -10
  156. package/tools/agents/providers/skill-copy-prune.mjs +12 -0
  157. package/tools/agents/providers/staged-directory-reference.mjs +14 -0
  158. package/tools/agents/providers/stale-artifact-prune.mjs +24 -10
  159. package/tools/agents/providers/user-hooks.mjs +26 -0
  160. package/tools/cli/authorization-health.mjs +20 -0
  161. package/tools/cli/workspace-status.mjs +7 -0
  162. package/tools/commands/deploy-prompts-codex.mjs +15 -1
  163. package/tools/ralph-external/lib/claude-adapter.mjs +2 -0
  164. package/tools/ralph-external/lib/factory-adapter.mjs +6 -2
  165. package/tools/ralph-external/lib/worker-inputs.mjs +20 -1
  166. package/tools/ralph-external/lib/worker-isolation.mjs +1 -0
  167. package/tools/ralph-external/lib/worker-termination.mjs +21 -12
  168. package/tools/ralph-external/session-launcher.mjs +22 -17
  169. package/vscode-extension/schemas/aiwg.config.v1.json +20 -0
@@ -4,6 +4,7 @@ events: [UserPromptSubmit]
4
4
  command: node
5
5
  args: ['$AIWG_ROOT/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs']
6
6
  timeout: 2
7
- # These bridges map an event but cannot deliver additionalContext to the model.
7
+ # These bridges cannot inject prompt context; their startup rules require discovery.
8
8
  # Muse uses its project hook owner; Claude uses claude-hooks-installer.
9
- degrade-on: [hermes, copilot, grok-build]
9
+ # Hermes uses pre_llm_call shell hooks with a native {context} response.
10
+ degrade-on: [copilot, grok-build]
@@ -49,18 +49,18 @@ function contextFor(envelope, prompt) {
49
49
  const prefix = 'AIWG candidates:\n';
50
50
  const next = '\nFirst call: aiwg show <type> <name> (best fit) -> rules (--rules --with-rule-bodies; --body) -> apply.'
51
51
  + '\nIf none fit, run aiwg discover; never decline without it.';
52
- const candidates = (Array.isArray(envelope?.results) ? envelope.results : [])
52
+ let candidates = (Array.isArray(envelope?.results) ? envelope.results : [])
53
53
  .filter(r => typeof r?.score === 'number' && Number.isFinite(r.score) && r.score >= 0.20
54
54
  && /^[a-z][a-z-]{0,19}$/.test(r.type) && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,69}$/.test(r.name))
55
55
  .sort((a, b) => b.score - a.score).slice(0, 3);
56
- const template = candidates.find(candidate => candidate.templates?.length)?.templates?.[0];
56
+ const strong = candidates.filter(r => r.score >= 0.70);
57
+ const template = (strong.length ? strong : candidates).find(candidate => candidate.templates?.length)?.templates?.[0];
57
58
  const templateHint = template && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,69}$/.test(template.name)
58
59
  && /^aiwg show template [a-zA-Z0-9][a-zA-Z0-9_.:-]{0,149}$/.test(template.show_command)
59
60
  ? `\nTemplate ${template.name}: ${template.show_command}` : '';
60
- // 0.70 excludes the UAT's unrelated 0.60/0.40 hits; retain today's top 3
61
- // only when at least one candidate supplies a stronger signal.
61
+ // 0.70 excludes weak hits; each displayed candidate must supply a strong signal.
62
62
  // Muse UAT (2026-11-06): advisory wording was ignored; first-call wording was followed.
63
- if (!candidates.some(r => r.score >= 0.70)) {
63
+ if (!strong.length) {
64
64
  // Restrict by type only when the request asks for an AIWG component of that type, not when a
65
65
  // type word merely appears ("removes every managed Claude hook" is not a hook search).
66
66
  const namedType = prompt.match(/\b(?:aiwg|is there an?|are there any|find|list|which|what)\s+(?:aiwg\s+)?(decision-definition|decision-ruleset|decision-binding|gate-pack|skill|agent|command|rule|schema|flow|runbook|template|behavior|hook|workflow)s?\b/i)?.[1].toLowerCase();
@@ -72,6 +72,7 @@ function contextFor(envelope, prompt) {
72
72
  while (instruction().length > 599 && need.length) need = need.slice(0, -1);
73
73
  return instruction();
74
74
  }
75
+ candidates = strong;
75
76
  // Leave room for the template drill-in even when candidate names are long.
76
77
  while (candidates.length > 1 && prefix.length + next.length + templateHint.length
77
78
  + candidates.map(r => `${r.type} ${r.name} (${r.score.toFixed(2).slice(0, 6)}): `).join('\n').length > 599) candidates.pop();
@@ -94,10 +95,12 @@ async function main() {
94
95
  chunks.push(chunk);
95
96
  }
96
97
  const event = JSON.parse(Buffer.concat(chunks).toString('utf8'));
97
- if (event.hook_event_name && event.hook_event_name !== 'UserPromptSubmit') return finish();
98
+ const hermes = event.hook_event_name === 'pre_llm_call';
99
+ if (event.hook_event_name && event.hook_event_name !== 'UserPromptSubmit' && !hermes) return finish();
98
100
  if ([event.role, event.message?.role].some(role => role && role !== 'user')
99
101
  || /^(system|notification|tool[_-]result)$/.test(event.type || '')) return finish();
100
- const prompt = typeof event.prompt === 'string' ? event.prompt.trim() : '';
102
+ const text = hermes ? event.extra?.user_message : event.prompt;
103
+ const prompt = typeof text === 'string' ? text.trim() : '';
101
104
  if (!shouldDiscover(prompt)) return finish();
102
105
  const moduleUrl = runtimeModule();
103
106
  if (!moduleUrl || Date.now() >= deadline) return finish();
@@ -119,12 +122,12 @@ async function main() {
119
122
  })().catch(() => process.exit(0));
120
123
  `, {
121
124
  eval: true, stdout: true, stderr: true,
122
- workerData: { moduleUrl, prompt, cwd: process.cwd() },
125
+ workerData: { moduleUrl, prompt, cwd: hermes && typeof event.cwd === 'string' ? event.cwd : process.cwd() },
123
126
  });
124
127
  worker.on('message', envelope => {
125
128
  if (Date.now() >= deadline) return finish();
126
129
  const context = contextFor(envelope, prompt);
127
- if (context) process.stdout.write(JSON.stringify({
130
+ if (context) process.stdout.write(JSON.stringify(hermes ? { context } : {
128
131
  hookSpecificOutput: { hookEventName: 'UserPromptSubmit', additionalContext: context },
129
132
  }) + '\n', finish);
130
133
  else finish();
@@ -1,4 +1,6 @@
1
1
  ---
2
+ precedence: critical
3
+ overridable: false
2
4
  activation: core
3
5
  summary: "Complete authorized implementation and verification; fix root causes without deleting tests, weakening assertions, hiding failures, or removing features to pass."
4
6
  enforcement: high
@@ -6,6 +6,7 @@ import Ajv from 'ajv';
6
6
  import Ajv2020 from 'ajv/dist/2020.js';
7
7
  import addFormats from 'ajv-formats';
8
8
  import { validateFlowGraph } from './validator.mjs';
9
+ import { createFlowAuthority } from './authority.mjs';
9
10
 
10
11
  const RESOURCE_KEYS = ['activations', 'tokens', 'costUsd', 'timeMs'];
11
12
 
@@ -514,9 +515,6 @@ export async function executeFlowGraph(manifest, options = {}) {
514
515
  const graphId = validation.normalized.identity.graphId;
515
516
  const runId = options.runId ?? `${graphId}:run`;
516
517
  const evaluatePredicate = options.evaluatePredicate ?? defaultPredicate;
517
- const allowedCapabilities = new Set(options.allowedCapabilities ?? manifest.spec.capabilities.map((item) => item.id));
518
- const allowedPermissions = new Set(options.allowedPermissions ?? manifest.spec.permissions);
519
- const approvedGates = new Set(options.approvedGates ?? []);
520
518
  const nodeOrder = new Map(manifest.spec.nodes.map((node, index) => [node.id, index]));
521
519
  const nodes = new Map(manifest.spec.nodes.map((node) => [node.id, node]));
522
520
  const stateFields = new Map(manifest.spec.state.fields.map((field) => [field.name, field]));
@@ -624,26 +622,7 @@ export async function executeFlowGraph(manifest, options = {}) {
624
622
  }));
625
623
  }
626
624
 
627
- function enforceAuthority(node) {
628
- const missingCapability = node.capabilities.find((id) => !allowedCapabilities.has(id));
629
- if (missingCapability) throw new FlowGraphRuntimeError('CAPABILITY_DENIED', `Node '${node.id}' is not authorized for capability '${missingCapability}'.`);
630
- const missingPermission = node.permissions.find((id) => !allowedPermissions.has(id));
631
- if (missingPermission) throw new FlowGraphRuntimeError('PERMISSION_DENIED', `Node '${node.id}' is not authorized for permission '${missingPermission}'.`);
632
- if (node.kind === 'gate' && new Set(options.cancelledGates ?? []).has(node.id)) {
633
- throw new FlowGraphRuntimeError('APPROVAL_CANCELLED', `Approval gate '${node.id}' was cancelled.`);
634
- }
635
- if (node.kind === 'gate' && !approvedGates.has(node.id)) {
636
- throw new FlowGraphRuntimeError('APPROVAL_REQUIRED', `Gate '${node.id}' has not been approved.`);
637
- }
638
- if (node.sideEffectMode === 'approval-required') {
639
- if (new Set(options.cancelledGates ?? []).has(node.approvalGate)) {
640
- throw new FlowGraphRuntimeError('APPROVAL_CANCELLED', `Approval gate '${node.approvalGate}' was cancelled.`);
641
- }
642
- if (!approvedGates.has(node.approvalGate)) {
643
- throw new FlowGraphRuntimeError('APPROVAL_REQUIRED', `Node '${node.id}' is waiting for approval gate '${node.approvalGate}'.`);
644
- }
645
- }
646
- }
625
+ const enforceAuthority = createFlowAuthority(manifest, options, evidence, FlowGraphRuntimeError);
647
626
 
648
627
  function validateInputs(node, inputs) {
649
628
  if (!managed) return assertNoWorkerValues(inputs);
@@ -706,7 +685,7 @@ export async function executeFlowGraph(manifest, options = {}) {
706
685
  }
707
686
 
708
687
  async function invoke(node, activationTick, iteration = 1) {
709
- enforceAuthority(node);
688
+ await enforceAuthority(node);
710
689
  const inputs = inputsFor(node);
711
690
  validateInputs(node, inputs);
712
691
  const inputSnapshot = clone(inputs);
@@ -997,8 +976,8 @@ export async function executeFlowGraph(manifest, options = {}) {
997
976
  for (const node of nodesToRun) recordJoinEvidence(joinFor(node.id));
998
977
  let settled;
999
978
  if (parallelEligible && managed) {
979
+ for (const node of nodesToRun) await enforceAuthority(node);
1000
980
  const requests = nodesToRun.map((node) => {
1001
- enforceAuthority(node);
1002
981
  const inputs = inputsFor(node);
1003
982
  validateInputs(node, inputs);
1004
983
  const requested = requestedResources(node);
@@ -1070,8 +1049,8 @@ export async function executeFlowGraph(manifest, options = {}) {
1070
1049
  }
1071
1050
  await persist();
1072
1051
  } else if (parallelEligible) {
1052
+ for (const node of nodesToRun) await enforceAuthority(node);
1073
1053
  const requests = nodesToRun.map((node) => {
1074
- enforceAuthority(node);
1075
1054
  const inputs = inputsFor(node);
1076
1055
  validateInputs(node, inputs);
1077
1056
  const nodeRunId = `${runId}:${node.id}:${tick}:${iteration}`;
@@ -170,9 +170,31 @@
170
170
  "idempotencyKey": { "type": "string", "minLength": 1 },
171
171
  "approvalGate": { "$ref": "#/definitions/id" },
172
172
  "scope": { "$ref": "#/definitions/observationScope" },
173
+ "hitlAction": { "$ref": "#/definitions/hitlAction" },
173
174
  "retry": { "$ref": "#/definitions/retryPolicy" },
174
175
  "fallback": { "$ref": "#/definitions/fallbackPolicy" },
175
176
  "ceilings": { "$ref": "#/definitions/ceilings" }
177
+ },
178
+ "allOf": [
179
+ { "if": { "required": ["hitlAction"] }, "then": { "properties": { "kind": { "const": "gate" } } } }
180
+ ]
181
+ },
182
+ "hitlAction": {
183
+ "description": "Host-authored classification of the exact pending execution plan. Never populate from node inputs, worker output or model text; unknown effects retain human review.",
184
+ "type": "object",
185
+ "required": ["category", "repo", "environment", "resources", "reversible", "impact"],
186
+ "additionalProperties": false,
187
+ "properties": {
188
+ "category": { "type": "string", "minLength": 1 },
189
+ "repo": { "type": "string", "minLength": 1 },
190
+ "target": { "type": "string", "minLength": 1 },
191
+ "environment": { "type": "string", "minLength": 1 },
192
+ "resources": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
193
+ "verb": { "type": "string", "minLength": 1 },
194
+ "reversible": { "type": "boolean" },
195
+ "impact": { "enum": ["low", "medium", "high"] },
196
+ "actor": { "type": "string", "minLength": 1 },
197
+ "inputDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
176
198
  }
177
199
  },
178
200
  "inputBinding": {
@@ -93,6 +93,14 @@ providers:
93
93
 
94
94
  codex:
95
95
  display_name: OpenAI Codex
96
+ byok:
97
+ status: documented
98
+ settings:
99
+ - 'Harness config.toml: model_provider and model select a model_providers entry with base_url, env_key and wire_api = "responses".'
100
+ - 'env_key names an environment variable; inject its value from the environment or a secret-store command only.'
101
+ verification: 'After approval, send "Reply with exactly: byok-ok" and check the Codex session log for the resolved model and provider.'
102
+ notes: 'Custom providers require the Responses API; OpenRouter compatibility with the requested model is unverified. Do not copy a Chat Completions configuration.'
103
+ docs: docs/agents/providers/codex.md#wire-protocol
96
104
  route_feasibility:
97
105
  scope: in
98
106
  identity: runtime-configured-only
@@ -176,6 +184,16 @@ providers:
176
184
 
177
185
  copilot:
178
186
  display_name: GitHub Copilot
187
+ byok:
188
+ status: verified
189
+ settings:
190
+ - 'COPILOT_PROVIDER_BASE_URL=https://openrouter.ai/api/v1'
191
+ - 'COPILOT_PROVIDER_TYPE=openai'
192
+ - 'COPILOT_MODEL=qwen/qwen3.8-27b'
193
+ - 'Key: COPILOT_PROVIDER_API_KEY environment variable or COPILOT_PROVIDER_API_KEY_COMMAND secret-store command.'
194
+ verification: 'After approval, send "Reply with exactly: byok-ok" and check the Copilot harness log/session for the resolved model qwen/qwen3.8-27b.'
195
+ notes: 'Operator live run, 2026-11-09 (#4054); harness BYOK settings do not qualify the AIWG direct-worker parser or its cleared-environment profile.'
196
+ docs: docs/providers/copilot-direct.md#bring-your-own-key
179
197
  aliases:
180
198
  - github-copilot
181
199
  route_feasibility:
@@ -226,6 +244,14 @@ providers:
226
244
 
227
245
  factory:
228
246
  display_name: Factory AI
247
+ byok:
248
+ status: verified
249
+ settings:
250
+ - 'Harness-owned BYOK custom models: select the exact registered custom: model ID with droid exec -m <custom-model-id>.'
251
+ - 'Use only harness-supported environment or secret-store command injection at point of use; if the installed harness requires a plaintext apiKey in settings.json, stop and choose a secure route with the operator.'
252
+ verification: 'After approval, send "Reply with exactly: byok-ok" on stdin and inspect the Droid session for the resolved model and reasoning_effort none.'
253
+ notes: 'Operator live run, 2026-11-09 (#4054): -r reasoning effort is ignored for custom models. Copy the custom: selector from the harness model listing, not the upstream API ID or display name. #3969: heavy/medium/light aliases are rejected; use full built-in IDs for built-in models.'
254
+ docs: docs/providers/factory-direct.md#bring-your-own-key
229
255
  aliases:
230
256
  - factory-ai
231
257
  route_feasibility:
@@ -327,6 +353,14 @@ providers:
327
353
 
328
354
  opencode:
329
355
  display_name: OpenCode
356
+ byok:
357
+ status: verified
358
+ settings:
359
+ - 'Key: OPENROUTER_API_KEY environment variable; OpenRouter provider is harness-owned.'
360
+ - 'Model: opencode run -m openrouter/qwen/qwen3.8-27b (provider-prefixed model selector).'
361
+ verification: 'After approval, send "Reply with exactly: byok-ok" and inspect the OpenCode log/session for the resolved model qwen/qwen3.8-27b under openrouter.'
362
+ notes: 'Operator live run, 2026-11-09 (#4054); this guidance does not change AIWG worker environment allowlists or qualify direct dispatch.'
363
+ docs: docs/providers/opencode-direct.md#bring-your-own-key
330
364
  route_feasibility:
331
365
  scope: in
332
366
  identity: runtime-configured-only
@@ -549,7 +583,7 @@ providers:
549
583
  scope: in
550
584
  identity: runtime-configured-only
551
585
  evidence: R
552
- channel: "grok -p --output-format streaming-json; bounded parser + model/effort pinning"
586
+ channel: "grok -p --output-format streaming-json; 1.0.77 captures: headless/ACP parser contracts, workflow fan-out bypass; combined deny flags rendered (live enforcement and model/effort pins unverified)"
553
587
  fanout: unknown
554
588
  probe_budget: { status: authorized, calls: 3, tokens: 30000, authorized_by: operator, authorized_at: "2026-10-07", hosts: [titan, noodle] }
555
589
  coverage:
@@ -558,37 +592,55 @@ providers:
558
592
  live_qualified: false
559
593
  sources:
560
594
  - "src/providers/grok-build-headless.ts"
595
+ - "test/unit/providers/grok-build-headless.test.ts"
596
+ - "test/unit/providers/grok-build-acp.test.ts"
597
+ - "test/unit/providers/grok-build-dispatch.test.ts"
598
+ - "test/conformance/orchestration-v1/grok-build-direct.test.ts"
561
599
  status: experimental
562
600
  # xAI Grok Build CLI/TUI. Distinct from Grok Bot (`grokbot`).
563
- # #2577: fixture-backed native subagents and background tasks; see
564
- # test/unit/providers/grok-build-provider.test.ts and
565
- # test/unit/providers/grok-build-dispatch.test.ts. MCP is independently
566
- # covered by test/unit/providers/grok-build-native-integration.test.ts.
567
- # Headless and ACP protocol contracts are tested in grok-build-headless.test.ts
568
- # and grok-build-acp.test.ts. ACP does not establish a daemon lifecycle.
569
- # No fixture supports native cron, multi-agent teams, mission control,
570
- # or AIWG behavior registration; those claims remain false.
601
+ # #2577: every claim and its limits are recorded in
602
+ # docs/providers/grok-build-native-agents.md (1.0.77 evidence table).
603
+ # Captured headless shapes: test/unit/providers/grok-build-headless.test.ts.
604
+ # 2026-11-10 1.0.77: captured-20261110 fixtures replayed by the tests above.
605
+ # Default headless cancels spawn_subagent/workflow: "a headless run cannot ask
606
+ # for approval". --allow spawn_subagent did not cover them; permission-mode auto
607
+ # ran them. AIWG permission defaults stay unchanged (no automatic approval).
608
+ # --no-subagents alone still permits workflow-spawned children. All AIWG leaf
609
+ # argv builders also deny workflow with --disallowed-tools workflow; combined
610
+ # live flag enforcement is unverified, so route_feasibility.fanout stays unknown.
611
+ # Native -w is a standalone copy under ~/.grok/worktrees/<slug>/<name>, NOT a
612
+ # git worktree; list --json ownership/recovery metadata parsing is fixture-backed
613
+ # in grok-build-dispatch.test.ts. AIWG isolation still uses its own detached Git
614
+ # worktree and never edits the user's working files (synthetic dispatch test).
615
+ # ACP authMethods, logged-in session/new amid _x.ai/* notifications, end_turn
616
+ # _meta usage, compact/summary notifications and cancelled/MidTurnAbort are
617
+ # fixture-backed in grok-build-acp.test.ts; live ACP dispatch remains deferred.
618
+ # 2026-11-10 set-b: project .grok/agents/*.md discovery and ignored model pins
619
+ # replayed by grok-build-provider.test.ts with captured-20261110/native-agents.json.
620
+ # Only name/description frontmatter is emitted; role/tier intent lives in the
621
+ # body, not model pins. User-scope mirroring is offline-tested in grok-build-use.test.ts.
622
+ # Resident lifecycle remains unverified.
571
623
  daemon_tier: unsupported
572
624
  daemon_pty_adapter: false
573
625
  artifact_paths:
574
- agents: .grok/agents/ # qualified AIWG model workers only
626
+ agents: .grok/agents/ # captured project discovery; grok-build-provider.test.ts
575
627
  commands: null
576
628
  skills: .grok/skills/
577
629
  skills_cross_agent: .grok/.aiwg/skills/ # --copy-all opt-in mirror
578
630
  rules: "Indexed: aiwg show rule + AGENTS.md / host .grok/rules (AIWG writer deferred #2577)"
579
631
  behaviors: null
580
632
  native_features:
581
- cron: false
582
- agent_teams: false # independent subagents do not imply native team orchestration
583
- tasks: true # native background subagents/tasks
584
- mcp: true
585
- behaviors: false
586
- mission_control: false
587
- daemon: false
633
+ cron: false # unverified: needs recurring-loop execution capture
634
+ agent_teams: false # unverified: needs team lifecycle capture
635
+ tasks: false # unverified: headless tool calls do not prove background task lifecycle
636
+ mcp: true # fixture-backed config only: grok-build-native-integration.test.ts; live MCP unverified
637
+ behaviors: false # unverified: needs behavior registration/execution capture
638
+ mission_control: false # unverified: needs mission lifecycle capture
639
+ daemon: false # deferred: ACP frame replay is not resident lifecycle qualification (grok-build-acp.test.ts)
588
640
  emulation:
589
641
  cron: null
590
642
  agent_teams: aiwg-mc
591
- tasks: native
643
+ tasks: aiwg-mc
592
644
  mcp: null
593
645
  behaviors: aiwg-mc
594
646
  mission_control: aiwg-mc
@@ -603,6 +655,14 @@ providers:
603
655
 
604
656
  hermes:
605
657
  display_name: Hermes
658
+ byok:
659
+ status: verified
660
+ settings:
661
+ - 'Key: OPENROUTER_API_KEY environment variable.'
662
+ - 'Provider/model: hermes chat --provider openrouter -m qwen/qwen3.8-27b; never rely on auto provider selection.'
663
+ verification: 'After approval, send "Reply with exactly: byok-ok" and inspect the Hermes log/session for the resolved model qwen/qwen3.8-27b under openrouter.'
664
+ notes: 'Operator live run, 2026-11-09 (#4054); manual CLI guidance does not change the AIWG direct-worker cleared environment or its dispatch status.'
665
+ docs: docs/providers/hermes-direct.md#bring-your-own-key
606
666
  route_feasibility:
607
667
  scope: in
608
668
  identity: runtime-configured-only
@@ -657,6 +717,13 @@ providers:
657
717
 
658
718
  muse:
659
719
  display_name: Muse Code
720
+ byok:
721
+ status: unverified
722
+ settings:
723
+ - 'Muse --provider / --model and harness settings select catalog models; an OpenRouter key setting is unverified. Do not invent an environment variable or endpoint flag.'
724
+ verification: 'First confirm upstream BYOK support without a paid call; after explicit approval of a supported route, send "Reply with exactly: byok-ok" and check the Muse session log for the resolved model.'
725
+ notes: 'Existing Muse notes cover the Meta model catalog only. Offer a verified Hermes, OpenCode or Copilot route when OpenRouter is required.'
726
+ docs: docs/agents/providers/muse.md
660
727
  route_feasibility:
661
728
  scope: in
662
729
  identity: runtime-configured-only
@@ -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",
@@ -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": {
@@ -0,0 +1,46 @@
1
+ // Resolves host-bound prompt actions without deriving authority from executor text or schemas.
2
+ import Ajv from 'ajv';
3
+ export async function lookupPromptAuthorization(opts) {
4
+ try {
5
+ const { checkHitlAuthorization } = await import('../policy/hitl-check.js');
6
+ const { hitlDigest } = await import('../policy/hitl.js');
7
+ const envelope = structuredClone(opts.envelope);
8
+ const supplied = opts.authorization?.bindings.get(envelope.prompt_id);
9
+ const binding = supplied && structuredClone(supplied);
10
+ let eligible = binding && binding.taskId === opts.taskId && binding.contextId === opts.contextId
11
+ && binding.promptId === envelope.prompt_id && binding.promptDigest === hitlDigest(envelope)
12
+ && (!envelope.allowed_responders || envelope.allowed_responders.includes('any'))
13
+ && (!envelope.deadline || Date.parse(envelope.deadline) > Date.now());
14
+ if (eligible) {
15
+ try {
16
+ const validate = new Ajv({ strict: true }).compile(envelope.response_schema);
17
+ eligible = !('$async' in validate && validate.$async === true) && !!validate(binding.response);
18
+ }
19
+ catch {
20
+ eligible = false;
21
+ }
22
+ }
23
+ // No host classification means unknown effects. Still consult the resolver,
24
+ // which retains review rather than treating prompt text as a safe action.
25
+ const checked = await checkHitlAuthorization(opts.authorization?.projectDir ?? process.cwd(), eligible ? binding.action : null);
26
+ if (!eligible || checked.decision !== 'auto-authorized' || !checked.receipt?.file || !checked.receipt.effectId)
27
+ return;
28
+ if (envelope.deadline && Date.parse(envelope.deadline) <= Date.now())
29
+ return;
30
+ return { response: binding.response, authorization: { receipt: checked.receipt,
31
+ provenance: checked.provenance, ...(checked.authorizationGrant ? { authorizationGrant: checked.authorizationGrant } : {}) } };
32
+ }
33
+ catch {
34
+ return; // Lookup failures retain the existing human collection path.
35
+ }
36
+ }
37
+ export async function collectAuthorizedHitlResponse(opts, signal) {
38
+ const authorized = signal.aborted ? undefined : await lookupPromptAuthorization(opts);
39
+ if (authorized && !signal.aborted)
40
+ return authorized;
41
+ return { response: await opts.adapter.collect(opts.envelope, {
42
+ ...(opts.taskId !== undefined ? { taskId: opts.taskId } : {}),
43
+ ...(opts.contextId !== undefined ? { contextId: opts.contextId } : {}), signal,
44
+ }), authorization: undefined };
45
+ }
46
+ //# sourceMappingURL=hitl-authorization.js.map