@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.
- package/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +3 -2
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +12 -9
- package/agentic/code/addons/aiwg-utils/rules/anti-laziness.md +2 -0
- package/agentic/code/addons/composition-engine/lib/runtime.mjs +5 -26
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +22 -0
- package/agentic/code/providers/capability-matrix.yaml +85 -18
- package/agentic/code/providers/model-capabilities.v1.json +35 -27
- package/dist/src/a2a/hitl-authorization.js +46 -0
- package/dist/src/a2a/hitl-driver.js +5 -5
- package/dist/src/artifacts/browser-export.js +2 -0
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +9 -27
- package/dist/src/artifacts/index-capability.js +24 -0
- package/dist/src/artifacts/query-engine-discover-output.js +8 -3
- package/dist/src/artifacts/query-engine-rules.js +29 -11
- package/dist/src/artifacts/query-engine-scoring.js +5 -5
- package/dist/src/artifacts/query-engine-show-card.js +5 -1
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +3 -3
- package/dist/src/artifacts/query-engine-templates.js +10 -4
- package/dist/src/artifacts/query-engine-verbose.js +18 -4
- package/dist/src/artifacts/relations-builder.js +1 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/checkpoint-handoff.js +2 -1
- package/dist/src/cli/handlers/guided-setup.js +3 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +17 -5
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/script-runner.js +7 -4
- package/dist/src/cli/handlers/sessions.js +1 -1
- package/dist/src/cli/handlers/steward-format.js +12 -0
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/use.js +14 -6
- package/dist/src/cli/handlers/utility-doctor.js +9 -2
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/services/deployment-probe-scope.js +40 -0
- package/dist/src/cli/services/deployment-verification.js +4 -5
- package/dist/src/config/aiwg-config.js +6 -0
- package/dist/src/config/authorization-cli.js +61 -3
- package/dist/src/config/cli-help.js +1 -1
- package/dist/src/config/cli.js +4 -2
- package/dist/src/config/host-resource-runtime.mjs +1 -1
- package/dist/src/config/user-registry.js +9 -1
- package/dist/src/config/worker-owner-lock.js +90 -10
- package/dist/src/decision/graph-flow-adapter.js +1 -1
- package/dist/src/effects/authorization-grant.js +50 -0
- package/dist/src/effects/authorization-store.js +130 -0
- package/dist/src/effects/index.js +2 -0
- package/dist/src/effects/ledger.js +1 -0
- package/dist/src/effects/lifecycle.js +1 -1
- package/dist/src/effects/reader.js +4 -0
- package/dist/src/effects/records.js +4 -0
- package/dist/src/effects/schema.js +2 -0
- package/dist/src/extensions/claude-hooks-installer.js +7 -7
- package/dist/src/extensions/manifest.js +6 -0
- package/dist/src/extensions/muse-managed-hooks.js +11 -0
- package/dist/src/extensions/project-local-discovery.js +21 -1
- package/dist/src/extensions/project-local-scaffold.js +19 -7
- package/dist/src/extensions/user-hook-diagnostics.js +32 -0
- package/dist/src/extensions/verified-hook-command.js +32 -0
- package/dist/src/lint/rule-conflicts.js +52 -0
- package/dist/src/lint/runner.js +3 -0
- package/dist/src/mcp/cli.mjs +3 -1
- package/dist/src/mcp/elicitation.mjs +30 -0
- package/dist/src/mcp/grok-build-config.mjs +1 -1
- package/dist/src/mcp/muse-native-config.mjs +1 -0
- package/dist/src/mcp/server.mjs +2 -0
- package/dist/src/mcp/tools/authorization.mjs +78 -0
- package/dist/src/models/factory-models.js +144 -0
- package/dist/src/models/model-capabilities.v1.json +35 -27
- package/dist/src/models/model-discovery.js +7 -3
- package/dist/src/models/worker-installation.d.mts +2 -0
- package/dist/src/models/worker-installation.mjs +11 -2
- package/dist/src/models/worker-invocation-policy.js +25 -1
- package/dist/src/models/wrapper-enforcement.js +1 -1
- package/dist/src/policy/authorization-capture.js +64 -0
- package/dist/src/policy/authorization-operations.js +108 -0
- package/dist/src/policy/hitl-check.js +3 -2
- package/dist/src/policy/hitl-consume.js +14 -0
- package/dist/src/policy/hitl-durable-store.js +60 -0
- package/dist/src/policy/hitl-durable.js +60 -0
- package/dist/src/policy/hitl-receipt.js +5 -0
- package/dist/src/policy/hitl.js +44 -6
- package/dist/src/policy/repo-access.js +3 -1
- package/dist/src/process/bounded-child-process.mjs +49 -39
- package/dist/src/providers/capability-matrix.yaml +85 -18
- package/dist/src/providers/deployment-ownership.d.mts +1 -0
- package/dist/src/providers/deployment-ownership.mjs +29 -3
- package/dist/src/providers/deployment-preservation.mjs +44 -3
- package/dist/src/providers/grok-build-acp.js +13 -5
- package/dist/src/providers/grok-build-dispatch.js +35 -2
- package/dist/src/providers/grok-build-headless.js +171 -77
- package/dist/src/providers/grok-build-inspect.js +1 -0
- package/dist/src/providers/grok-build-paths.js +2 -0
- package/dist/src/providers/muse-paths.js +4 -2
- package/dist/src/providers/provider-context-contracts.js +12 -4
- package/dist/src/providers/provider-definition-schema.js +6 -0
- package/dist/src/providers/provider-seeds-1.js +3 -3
- package/dist/src/providers/provider-seeds-2.js +6 -4
- package/dist/src/providers/provider-seeds-3.js +6 -6
- package/dist/src/rules/activation.d.mts +2 -0
- package/dist/src/rules/activation.mjs +16 -7
- package/dist/src/rules/inline-budget.d.mts +2 -1
- package/dist/src/rules/inline-budget.mjs +4 -2
- package/dist/src/rules/inventory.js +3 -0
- package/dist/src/rules/precedence.d.mts +6 -0
- package/dist/src/rules/precedence.mjs +49 -0
- package/dist/src/rules/project-precedence.js +73 -0
- package/dist/src/rules/rule-frontmatter.schema.json +15 -0
- package/dist/src/serve/a2a-terminal-observer.js +12 -3
- package/dist/src/serve/mission-hitl.js +20 -1
- package/dist/src/serve/worker-stdin-frame.mjs +1 -1
- package/dist/src/sessions/adapters/grok-build-fallback.js +33 -0
- package/dist/src/sessions/adapters/grok-build-native-records.js +134 -0
- package/dist/src/sessions/adapters/grok-build-native.js +237 -98
- package/dist/src/sessions/adapters/grok-build.js +95 -32
- package/dist/src/sessions/grok-build-cli-output.js +113 -0
- package/dist/src/sessions/grok-build-cli.js +4 -28
- package/dist/src/sessions/normalization.js +1 -1
- package/dist/src/smiths/context-pipeline/bridge-ownership.js +4 -3
- package/dist/src/smiths/context-pipeline/finalization.js +5 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +20 -17
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +6 -1
- package/dist/src/smiths/context-pipeline/workspace-document.js +6 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -12
- package/dist/src/smiths/hook-bridge/codex-translator.js +11 -14
- package/dist/src/smiths/hook-bridge/codex-trust.js +7 -2
- package/dist/src/smiths/hook-bridge/copilot-translator.js +2 -1
- package/dist/src/smiths/hook-bridge/factory-trust.js +2 -2
- package/dist/src/smiths/hook-bridge/grok-build-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +81 -0
- package/dist/src/smiths/hook-bridge/hermes-translator.js +5 -3
- package/dist/src/smiths/hook-bridge/hermes-trust.js +65 -0
- package/dist/src/smiths/hook-bridge/index.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +3 -2
- package/package.json +7 -1
- package/tools/agents/deploy-agents.mjs +9 -8
- package/tools/agents/deploy-options.mjs +3 -0
- package/tools/agents/providers/base-frontmatter.mjs +3 -2
- package/tools/agents/providers/base-inventory.mjs +3 -1
- package/tools/agents/providers/base-kernel-skills.mjs +11 -5
- package/tools/agents/providers/claude-post-deploy.mjs +1 -1
- package/tools/agents/providers/codex-post-deploy.mjs +1 -1
- package/tools/agents/providers/generic.mjs +66 -0
- package/tools/agents/providers/grok-build.mjs +34 -41
- package/tools/agents/providers/model-wrapper.mjs +2 -5
- package/tools/agents/providers/muse-hooks.mjs +13 -11
- package/tools/agents/providers/muse-prompt-discovery.mjs +5 -1
- package/tools/agents/providers/muse.mjs +2 -1
- package/tools/agents/providers/openclaw.mjs +2 -1
- package/tools/agents/providers/rule-deployment-commit.mjs +3 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +7 -5
- package/tools/agents/providers/rule-deployment-state.mjs +14 -6
- package/tools/agents/providers/rule-projection.mjs +39 -4
- package/tools/agents/providers/rule-startup.mjs +11 -10
- package/tools/agents/providers/skill-copy-prune.mjs +12 -0
- package/tools/agents/providers/staged-directory-reference.mjs +14 -0
- package/tools/agents/providers/stale-artifact-prune.mjs +24 -10
- package/tools/agents/providers/user-hooks.mjs +26 -0
- package/tools/cli/authorization-health.mjs +20 -0
- package/tools/cli/workspace-status.mjs +7 -0
- package/tools/commands/deploy-prompts-codex.mjs +15 -1
- package/tools/ralph-external/lib/claude-adapter.mjs +2 -0
- package/tools/ralph-external/lib/factory-adapter.mjs +6 -2
- package/tools/ralph-external/lib/worker-inputs.mjs +20 -1
- package/tools/ralph-external/lib/worker-isolation.mjs +1 -0
- package/tools/ralph-external/lib/worker-termination.mjs +21 -12
- package/tools/ralph-external/session-launcher.mjs +22 -17
- package/vscode-extension/schemas/aiwg.config.v1.json +20 -0
|
@@ -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;
|
|
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:
|
|
564
|
-
#
|
|
565
|
-
# test/unit/providers/grok-build-
|
|
566
|
-
#
|
|
567
|
-
#
|
|
568
|
-
#
|
|
569
|
-
#
|
|
570
|
-
#
|
|
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/ #
|
|
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
|
|
583
|
-
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:
|
|
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
|
|
@@ -23,6 +23,7 @@ export class DeploymentOutputState {
|
|
|
23
23
|
export type DeploymentOutputSnapshot = Map<string, Buffer | DeploymentOutputState>;
|
|
24
24
|
export function outputDigest(entry: Buffer | DeploymentOutputState | undefined): string | undefined;
|
|
25
25
|
export function sameOutput(a: Buffer | DeploymentOutputState | undefined, b: Buffer | DeploymentOutputState | undefined): boolean;
|
|
26
|
+
export function legacyCodexPromptOwner(file: string, entry: Buffer | DeploymentOutputState | undefined): string | undefined;
|
|
26
27
|
export function captureDeploymentOutputs(roots: PathLike[], options?: { previous?: DeploymentOutputSnapshot }): DeploymentOutputSnapshot;
|
|
27
28
|
export function recordDeploymentOutputs(before: DeploymentOutputSnapshot, roots: PathLike[], opts?: DeploymentOwnershipOptions): void;
|
|
28
29
|
export function refreshSettingsDigests(record: { settings?: Record<string, unknown> }): void;
|
|
@@ -17,7 +17,14 @@ const bundleOwner = source => extractFrameworkSlug(source) || source.replaceAll(
|
|
|
17
17
|
export const deploymentOwner = opts => {
|
|
18
18
|
const names = { sdlc: 'sdlc-complete', marketing: 'media-marketing-kit', mmk: 'media-marketing-kit',
|
|
19
19
|
research: 'research-complete', forensics: 'forensics-complete', dfir: 'forensics-complete', validation: 'validation-complete', ops: 'ops-complete', general: 'writing-quality' };
|
|
20
|
-
|
|
20
|
+
const source = opts.logicalInputPath?.(opts.srcRoot) || opts.srcRoot;
|
|
21
|
+
let scopedOwner;
|
|
22
|
+
if (opts.bundleOnly && opts.srcRoot) {
|
|
23
|
+
const file = path.join(opts.srcRoot, 'manifest.json');
|
|
24
|
+
const manifest = parse(fs.existsSync(file) ? fs.readFileSync(file) : null);
|
|
25
|
+
scopedOwner = typeof manifest.id === 'string' && manifest.id ? manifest.id : path.resolve(source);
|
|
26
|
+
}
|
|
27
|
+
return opts.frameworkSlug || bundleOwner(`${source}/manifest.json`) || scopedOwner || names[opts.mode] || opts.mode;
|
|
21
28
|
};
|
|
22
29
|
|
|
23
30
|
/** Only provider output surfaces, never arbitrary project source directories. */
|
|
@@ -58,6 +65,22 @@ const digestOf = entry => {
|
|
|
58
65
|
export const outputDigest = entry => digestOf(entry);
|
|
59
66
|
/** Content equality; a stat-only entry never equals a different entry. */
|
|
60
67
|
export const sameOutput = (a, b) => a != null && b != null && (a === b || (digestOf(a) !== undefined && digestOf(a) === digestOf(b)));
|
|
68
|
+
|
|
69
|
+
// v2026.10.0–v2026.10.19: deploy-prompts-codex.mjs emitted these exact
|
|
70
|
+
// unmarked bytes (description frontmatter + trimmed command body, no final LF).
|
|
71
|
+
// Sources: addons/{dataset-intelligence,schema-governance,aiwg-utils}/commands/
|
|
72
|
+
// {dataset,schema,sessions}.md. Fixtures retain v2026.10.3 sources and outputs.
|
|
73
|
+
const LEGACY_CODEX_PROMPTS = {
|
|
74
|
+
'aiwg-dataset.md': ['sha256:652469f0023144af5597cb6571f9ff498e5a11e5795de4074480f814dc106a87', 'dataset-intelligence'],
|
|
75
|
+
'aiwg-schema.md': ['sha256:65000b74de7149b70229f5c8409e2c6a6c4d5e45086f776e0db2ae8633c176f9', 'schema-governance'],
|
|
76
|
+
'aiwg-sessions.md': ['sha256:ad0591041932dbbb8a08a5d0e946490b2ef3e18a1b65f610df3555b6b67eb690', 'aiwg-utils'],
|
|
77
|
+
};
|
|
78
|
+
/** Recognize only historical bytes at their original Codex prompt names. */
|
|
79
|
+
export function legacyCodexPromptOwner(file, entry) {
|
|
80
|
+
if (path.basename(path.dirname(file)) !== 'prompts' || path.basename(path.dirname(path.dirname(file))) !== '.codex') return undefined;
|
|
81
|
+
const known = LEGACY_CODEX_PROMPTS[path.basename(file)];
|
|
82
|
+
return known && known[0] === digestOf(entry) ? known[1] : undefined;
|
|
83
|
+
}
|
|
61
84
|
const bytesOf = (file, entry) => {
|
|
62
85
|
if (entry == null || Buffer.isBuffer(entry)) return entry;
|
|
63
86
|
throw new Error(`Deployment snapshot did not retain bytes for ${file}`);
|
|
@@ -270,10 +293,13 @@ export function recordDeploymentOutputs(before, roots, opts = {}) {
|
|
|
270
293
|
if (path.basename(file) === SIDECAR || /(?:^|[/\\])aiwg\.config$/.test(file)
|
|
271
294
|
|| /(?:\.bak\.|\.aiwg-backup-)/.test(path.basename(file))) continue;
|
|
272
295
|
if (preserved.has(file)) continue;
|
|
296
|
+
const legacyOwner = opts.provider === 'codex'
|
|
297
|
+
&& !parse(before.get(path.join(path.dirname(file), SIDECAR))).managed?.[path.basename(file)]
|
|
298
|
+
&& legacyCodexPromptOwner(file, before.get(file));
|
|
273
299
|
const changed = !sameOutput(before.get(file), bytes);
|
|
274
300
|
const declaration = declared.get(file);
|
|
275
301
|
if (opts.onlyDeclared && !declaration) continue;
|
|
276
|
-
if (!changed && !declaration && !opts.writtenFiles?.includes(file)) continue;
|
|
302
|
+
if (!changed && !declaration && !legacyOwner && !opts.writtenFiles?.includes(file)) continue;
|
|
277
303
|
// Existing integrity receipts that disagree with bytes never bless operator edits.
|
|
278
304
|
if (declaration?.entry.hash && declaration.entry.hash !== digestOf(bytes)) continue;
|
|
279
305
|
let skillRoot = path.dirname(file);
|
|
@@ -298,7 +324,7 @@ export function recordDeploymentOutputs(before, roots, opts = {}) {
|
|
|
298
324
|
|| skillReceipt.managed?.['SKILL.md']?.frameworkSlug;
|
|
299
325
|
const generatedIndex = /^RULES-(?:INDEX|ONDEMAND)\.(?:md|mdc)$/.test(path.basename(file));
|
|
300
326
|
const kind = generatedIndex ? 'rule-index' : current.kind || artifactKind(file);
|
|
301
|
-
const selectedOwner = opts.provider === 'flue' ? owner : sourceOwner || (opts.onlyDeclared ? current.owners?.[0] : owner);
|
|
327
|
+
const selectedOwner = opts.provider === 'flue' ? owner : sourceOwner || legacyOwner || (opts.onlyDeclared ? current.owners?.[0] : owner);
|
|
302
328
|
if (!selectedOwner) {
|
|
303
329
|
console.warn(`Ownership not recorded for ${file}: no framework owner resolved.`);
|
|
304
330
|
continue;
|
|
@@ -3,6 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { frameworkRegistryId } from '../config/framework-aliases.js';
|
|
6
|
+
import { deploymentOwner } from './deployment-ownership.mjs';
|
|
6
7
|
const hash = bytes => `sha256:${createHash('sha256').update(bytes).digest('hex')}`;
|
|
7
8
|
const parse = bytes => { try { return JSON.parse(bytes?.toString() || '{}'); } catch { return {}; } };
|
|
8
9
|
const sidecar = '.aiwg-manifest.json';
|
|
@@ -48,10 +49,27 @@ export function preserveDeploymentOutputs(before, roots, opts = {}) {
|
|
|
48
49
|
const base = receipt.scope === 'project' && file === path.join(opts.target, '.aiwg', sidecar) ? opts.target : path.dirname(file);
|
|
49
50
|
for (const [name, record] of Object.entries(receipt.managed || {})) {
|
|
50
51
|
const target = path.resolve(base, name);
|
|
51
|
-
if (target.startsWith(`${base}${path.sep}`)) claims.set(target, { record, file, name });
|
|
52
|
+
if (target.startsWith(`${base}${path.sep}`)) claims.set(target, { record, file, name, target });
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
const restored = [];
|
|
56
|
+
const owner = deploymentOwner(opts);
|
|
57
|
+
const sharedIndex = file => /^RULES-(?:INDEX|ONDEMAND|BOUND)\.(?:md|mdc)$/.test(path.basename(file))
|
|
58
|
+
|| context.has(path.basename(file)) || path.basename(file) === '.windsurfrules'
|
|
59
|
+
// Flue's app modules describe every selected bundle, even in a scoped pass.
|
|
60
|
+
|| opts.provider === 'flue' && ['skills.ts', 'specialists.ts', 'tools.ts', 'remote-specialist.js', 'remote-specialist.d.ts']
|
|
61
|
+
.some(name => file === path.join(opts.target, 'src/aiwg', name));
|
|
62
|
+
const foreign = (file, record) => {
|
|
63
|
+
if (opts.force) {
|
|
64
|
+
const claim = claims.get(file);
|
|
65
|
+
const current = claim && parse(fs.existsSync(claim.file) ? fs.readFileSync(claim.file) : null);
|
|
66
|
+
const source = current?.skillSource || current?.managed?.[claim?.name]?.sourcePath;
|
|
67
|
+
const logical = opts.logicalInputPath || (file => file);
|
|
68
|
+
if (source && logical(source).startsWith(`${logical(opts.srcRoot)}${path.sep}`)) return false;
|
|
69
|
+
}
|
|
70
|
+
const owners = record?.owners || (record?.frameworkSlug ? [record.frameworkSlug] : []);
|
|
71
|
+
return opts.bundleOnly && !sharedIndex(file) && (owners.length !== 1 || owners[0] !== owner);
|
|
72
|
+
};
|
|
55
73
|
for (const [file, bytes] of before) {
|
|
56
74
|
if (path.basename(file) === sidecar) continue;
|
|
57
75
|
// Snapshots keep bytes for receipt-claimed and receipt-adjacent files only;
|
|
@@ -60,18 +78,41 @@ export function preserveDeploymentOutputs(before, roots, opts = {}) {
|
|
|
60
78
|
const exists = fs.existsSync(file);
|
|
61
79
|
if (!exists && opts.replacedSkillCopies?.has(file)) continue;
|
|
62
80
|
const claim = claims.get(file);
|
|
63
|
-
|
|
81
|
+
// A named bundle's transaction cannot rewrite or retire another owner's
|
|
82
|
+
// payload, including older marker-only kernel rules and shared settings.
|
|
83
|
+
const outOfScope = foreign(file, claim?.record);
|
|
84
|
+
const edited = claim && (claim.record.hash ? claim.record.hash !== hash(bytes) : opts.bundleOnly)
|
|
85
|
+
&& !context.has(path.basename(file)) && claim.record.kind !== 'settings';
|
|
64
86
|
const owners = claim?.record.owners || (claim?.record.frameworkSlug ? [claim.record.frameworkSlug] : []);
|
|
65
87
|
const currentOwner = (opts.srcRoot || '').replaceAll('\\', '/').match(/(?:agentic\/code|\.aiwg)\/(?:frameworks|addons|extensions)\/([^/]+)/)?.[1] || frameworkRegistryId(opts.mode || '');
|
|
66
88
|
const copy = (opts.copyMode ?? opts.copyStandardSkills) || owners.some(owner => providerCopyMode(opts.target, opts.provider, owner, opts.config, currentOwner));
|
|
67
|
-
|
|
89
|
+
const retire = opts.copyMode === false && opts.retiredRuleFiles?.has(file);
|
|
90
|
+
if (!(outOfScope || edited || !exists && copy && !retire) || exists && fs.readFileSync(file).equals(bytes)) continue;
|
|
68
91
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
69
92
|
fs.writeFileSync(file, bytes);
|
|
70
93
|
if (edited) console.warn(`${opts.logicalOutputPath?.(file) || file}: kept (operator-edited)`);
|
|
71
94
|
restored.push(claim);
|
|
72
95
|
}
|
|
96
|
+
if (opts.bundleOnly) {
|
|
97
|
+
opts.writtenFiles = opts.writtenFiles?.filter(file => !before.has(file) || !foreign(file, claims.get(file)?.record));
|
|
98
|
+
// Keep foreign ownership records verbatim. A rewritten sidecar must never
|
|
99
|
+
// turn an unchanged kernel payload into an output of the selected addon.
|
|
100
|
+
for (const [file, previous] of receipts) {
|
|
101
|
+
if (opts.replacedSkillCopies?.has(file) && !fs.existsSync(file)) continue;
|
|
102
|
+
const current = parse(fs.existsSync(file) ? fs.readFileSync(file) : null);
|
|
103
|
+
current.managed ||= {};
|
|
104
|
+
const base = previous.scope === 'project' && file === path.join(opts.target, '.aiwg', sidecar) ? opts.target : path.dirname(file);
|
|
105
|
+
for (const [name, record] of Object.entries(previous.managed || {})) {
|
|
106
|
+
if (foreign(path.resolve(base, name), record)) current.managed[name] = record;
|
|
107
|
+
}
|
|
108
|
+
const exclusivelyForeign = [previous.managed || {}, current.managed].every(managed =>
|
|
109
|
+
Object.entries(managed).every(([name, record]) => foreign(path.resolve(base, name), record)));
|
|
110
|
+
writeReceipt(file, exclusivelyForeign ? before.get(file) : `${JSON.stringify(current, null, 2)}\n`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
73
113
|
// Keep the old digest for protected payloads: a later run must still detect edits.
|
|
74
114
|
for (const claim of restored.filter(Boolean)) {
|
|
115
|
+
if (foreign(claim.target, claim.record)) continue;
|
|
75
116
|
const { managed: _managed, ...metadata } = receipts.get(claim.file) || {};
|
|
76
117
|
const receipt = { ...metadata, ...parse(fs.existsSync(claim.file) ? fs.readFileSync(claim.file) : null) };
|
|
77
118
|
receipt.managed ??= {};
|
|
@@ -23,7 +23,7 @@ export class GrokAcpClient {
|
|
|
23
23
|
this.timeoutMs = Math.min(Math.max(options.timeoutMs ?? 30_000, 1), 120_000);
|
|
24
24
|
this.maxStderrBytes = options.maxStderrBytes ?? 1024 * 1024;
|
|
25
25
|
this.onUpdate = options.onUpdate;
|
|
26
|
-
this.child = spawn(options.command ?? 'grok', [...(options.prefixArgs ?? []), '--no-auto-update', ...(options.disableSubagents ? ['--no-subagents'] : []), 'agent', 'stdio'], {
|
|
26
|
+
this.child = spawn(options.command ?? 'grok', [...(options.prefixArgs ?? []), '--no-auto-update', '--allow', 'Bash(aiwg discover *)', ...(options.disableSubagents ? ['--no-subagents', '--disallowed-tools', 'workflow'] : []), 'agent', 'stdio'], {
|
|
27
27
|
cwd: options.cwd, env: this.env, stdio: ['pipe', 'pipe', 'pipe'], shell: false,
|
|
28
28
|
});
|
|
29
29
|
this.child.on('error', error => this.failAll(new Error(`Grok ACP launch failed: ${error.message}`)));
|
|
@@ -71,7 +71,7 @@ export class GrokAcpClient {
|
|
|
71
71
|
this.close();
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
if (message.method === 'session/update') {
|
|
74
|
+
if (message.method === 'session/update' || message.method === '_x.ai/session_notification') {
|
|
75
75
|
const params = message.params;
|
|
76
76
|
const update = params?.update;
|
|
77
77
|
if (update) {
|
|
@@ -121,7 +121,7 @@ export class GrokAcpClient {
|
|
|
121
121
|
async initialize() {
|
|
122
122
|
const init = await this.request('initialize', {
|
|
123
123
|
protocolVersion: 1,
|
|
124
|
-
clientCapabilities: { fs: { readTextFile:
|
|
124
|
+
clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false },
|
|
125
125
|
});
|
|
126
126
|
const methods = Array.isArray(init.authMethods)
|
|
127
127
|
? init.authMethods.map(item => item.id) : [];
|
|
@@ -133,7 +133,12 @@ export class GrokAcpClient {
|
|
|
133
133
|
: 'no supported non-interactive method was offered';
|
|
134
134
|
throw new Error(`Grok ACP authentication unavailable: ${reason}`);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
// Captured 1.0.77 advertises the active cached login in initialize; it
|
|
137
|
+
// proceeds straight to session/new without an authenticate round trip.
|
|
138
|
+
const meta = init._meta;
|
|
139
|
+
if (authMethod !== 'cached_token' || meta?.defaultAuthMethodId !== 'cached_token') {
|
|
140
|
+
await this.request('authenticate', { methodId: authMethod, _meta: { headless: true } });
|
|
141
|
+
}
|
|
137
142
|
const session = await this.request('session/new', { cwd: this.cwd, mcpServers: [] });
|
|
138
143
|
if (typeof session.sessionId !== 'string' || !session.sessionId)
|
|
139
144
|
throw new Error('Grok ACP session/new returned no sessionId');
|
|
@@ -161,7 +166,10 @@ export class GrokAcpClient {
|
|
|
161
166
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
162
167
|
if (abortRequested || signal?.aborted)
|
|
163
168
|
throw aborted();
|
|
164
|
-
|
|
169
|
+
const meta = result._meta && typeof result._meta === 'object' && !Array.isArray(result._meta)
|
|
170
|
+
? JSON.parse(redactGrokOutput(JSON.stringify(result._meta), this.env)) : undefined;
|
|
171
|
+
return { text: this.text.trim(), ...(typeof result.stopReason === 'string' ? { stopReason: result.stopReason } : {}),
|
|
172
|
+
...(meta ? { _meta: meta } : {}) };
|
|
165
173
|
}
|
|
166
174
|
catch (error) {
|
|
167
175
|
if (abortRequested || signal?.aborted)
|
|
@@ -3,7 +3,7 @@ import { execFile } from 'node:child_process';
|
|
|
3
3
|
import { promisify } from 'node:util';
|
|
4
4
|
import { lstat, mkdir, mkdtemp, open, readFile, readdir, realpath, unlink, writeFile } from 'node:fs/promises';
|
|
5
5
|
import { tmpdir } from 'node:os';
|
|
6
|
-
import { join, resolve } from 'node:path';
|
|
6
|
+
import { isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
7
7
|
import { createHash, randomUUID } from 'node:crypto';
|
|
8
8
|
import { readAiwgConfig, resolveParallelism } from '../config/aiwg-config.js';
|
|
9
9
|
import { runGrokHeadless } from './grok-build-headless.js';
|
|
@@ -122,6 +122,39 @@ export async function acquireGrokProjectSlot(key, limit) {
|
|
|
122
122
|
}
|
|
123
123
|
throw new Error(`Grok Build project parallelism cap ${limit} reached`);
|
|
124
124
|
}
|
|
125
|
+
/** Parse captured list metadata only; never create, remove or enter a native copy. */
|
|
126
|
+
export function parseGrokNativeWorktreeList(json) {
|
|
127
|
+
const invalid = () => { throw new Error('Invalid Grok Build worktree list: expected standalone copy ownership metadata'); };
|
|
128
|
+
let rows;
|
|
129
|
+
try {
|
|
130
|
+
rows = JSON.parse(json);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return invalid();
|
|
134
|
+
}
|
|
135
|
+
if (!Array.isArray(rows))
|
|
136
|
+
return invalid();
|
|
137
|
+
return rows.map(value => {
|
|
138
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
139
|
+
return invalid();
|
|
140
|
+
const row = value;
|
|
141
|
+
for (const key of ['id', 'path', 'source_repo', 'repo_name', 'kind', 'git_ref', 'head_commit', 'session_id', 'status']) {
|
|
142
|
+
if (typeof row[key] !== 'string' || !row[key] || row[key].includes('\0'))
|
|
143
|
+
return invalid();
|
|
144
|
+
}
|
|
145
|
+
const path = row.path;
|
|
146
|
+
const source = row.source_repo;
|
|
147
|
+
const offset = relative(source, path);
|
|
148
|
+
if (row.creation_mode !== 'standalone' || !isAbsolute(path) || !isAbsolute(source)
|
|
149
|
+
|| !offset || (!isAbsolute(offset) && offset !== '..' && !offset.startsWith(`..${sep}`))
|
|
150
|
+
|| !/^[0-9a-f]{40}$/i.test(row.head_commit)
|
|
151
|
+
|| !Number.isSafeInteger(row.creator_pid) || row.creator_pid < 1
|
|
152
|
+
|| !['created_at', 'last_accessed_at'].every(key => typeof row[key] === 'number' && Number.isFinite(row[key]) && row[key] >= 0)
|
|
153
|
+
|| (row.metadata !== undefined && (!row.metadata || typeof row.metadata !== 'object' || Array.isArray(row.metadata))))
|
|
154
|
+
return invalid();
|
|
155
|
+
return row;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
125
158
|
async function gitOut(cwd, ...args) {
|
|
126
159
|
const result = await git('git', args, { cwd, timeout: 15_000, maxBuffer: 1024 * 1024 });
|
|
127
160
|
return result.stdout.trim();
|
|
@@ -234,7 +267,7 @@ export class GrokBuildDispatcher {
|
|
|
234
267
|
this.active += 1;
|
|
235
268
|
try {
|
|
236
269
|
const worktree = options.isolate ? await prepareGrokWorktree(options.projectRoot) : undefined;
|
|
237
|
-
// Grok's internal autonomous subagent fan-out has no documented hard
|
|
270
|
+
// Grok's internal autonomous subagent/workflow fan-out has no documented hard
|
|
238
271
|
// project cap. Disable it in AIWG-controlled headless workers so every
|
|
239
272
|
// parallel worker consumes one dispatcher slot. Interactive Grok use
|
|
240
273
|
// remains outside this bounded API and must not be claimed as enforced.
|