@aiwg/cli 2026.11.4 → 2026.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agentic/code/providers/capability-matrix.yaml +75 -5
- package/agentic/code/providers/model-capabilities.v1.json +44 -36
- package/bin/aiwg.mjs +6 -4
- package/dist/src/activity-log/cli.js +1 -1
- package/dist/src/agents/agent-deployer.js +1 -1
- package/dist/src/artifacts/audit/types.js +1 -1
- package/dist/src/artifacts/discover-facets.js +1 -1
- package/dist/src/artifacts/enrichment/prompt.js +1 -1
- package/dist/src/artifacts/enrichment/types.js +1 -1
- package/dist/src/artifacts/index-builder.js +4 -2
- package/dist/src/artifacts/query-engine-rules.js +2 -2
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/artifacts/views/definition.js +1 -1
- package/dist/src/artifacts/views/types.js +1 -1
- package/dist/src/catalog/cli.js +1 -1
- package/dist/src/catalog/cli.mjs +1 -1
- package/dist/src/catalog/loader.js +1 -1
- package/dist/src/catalog/loader.mjs +1 -1
- package/dist/src/catalog/types.js +1 -1
- package/dist/src/cli/cli-extension-loader.js +19 -5
- package/dist/src/cli/cli-extension-paths.js +65 -0
- package/dist/src/cli/handlers/best-practices-audit.js +1 -1
- package/dist/src/cli/handlers/help.js +3 -4
- package/dist/src/cli/handlers/index.js +1 -1
- package/dist/src/cli/handlers/marketplace-plugin-search.js +37 -0
- package/dist/src/cli/handlers/marketplace.js +3 -1
- package/dist/src/cli/handlers/models.js +1 -1
- package/dist/src/cli/handlers/ralph-launcher.js +8 -2
- package/dist/src/cli/handlers/ralph.js +1 -1
- package/dist/src/cli/handlers/runtime-info.js +1 -1
- package/dist/src/cli/handlers/scaffolding.js +2 -2
- package/dist/src/cli/handlers/script-runner.js +8 -5
- package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
- package/dist/src/cli/handlers/steward-format.js +12 -0
- package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
- package/dist/src/cli/handlers/subcommands-list-format.js +19 -1
- package/dist/src/cli/handlers/types.js +1 -1
- package/dist/src/cli/handlers/use.js +15 -6
- package/dist/src/cli/handlers/utilities.js +1 -1
- package/dist/src/cli/handlers/utility-doctor.js +4 -0
- package/dist/src/cli/handlers/version.js +1 -1
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/help-generator.js +9 -11
- package/dist/src/cli/hooks/builtin/activity-log-hook.js +1 -1
- package/dist/src/cli/router.js +1 -1
- package/dist/src/cli/workflow-orchestrator.js +1 -1
- package/dist/src/config/worker-context.js +37 -7
- package/dist/src/config/worker-parallelism.js +11 -0
- package/dist/src/contributors/detect.js +1 -1
- package/dist/src/contributors/discover.js +1 -1
- package/dist/src/contributors/heuristic.js +1 -1
- package/dist/src/contributors/index.js +1 -1
- package/dist/src/contributors/types.js +1 -1
- package/dist/src/contributors/validation.js +1 -1
- package/dist/src/effects/worker-delivery.js +83 -0
- package/dist/src/extensions/capability-index.js +1 -1
- package/dist/src/extensions/commands/definitions.js +2 -2
- package/dist/src/extensions/deployment-registration.js +1 -1
- package/dist/src/extensions/index.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/manifest.js +10 -2
- package/dist/src/extensions/project-local-activity.js +1 -1
- package/dist/src/extensions/project-local-discovery.js +23 -3
- package/dist/src/extensions/project-local-doctor.js +7 -3
- package/dist/src/extensions/project-local-promote.js +3 -3
- package/dist/src/extensions/project-local-remove.js +3 -3
- package/dist/src/extensions/project-local-scaffold.js +20 -8
- package/dist/src/extensions/registry.js +1 -1
- package/dist/src/extensions/shadow-resolver.js +1 -1
- package/dist/src/extensions/types.js +1 -1
- package/dist/src/extensions/upstream-registry.js +1 -1
- package/dist/src/extensions/validation.js +1 -1
- package/dist/src/intake/git-history-analyzer.js +1 -1
- package/dist/src/kb/cli.js +1 -1
- package/dist/src/marketplace/plugin-directory.js +36 -0
- package/dist/src/marketplace/plugin-search.js +180 -0
- package/dist/src/mcp/cli.mjs +2 -2
- package/dist/src/mcp/helpers.mjs +1 -1
- package/dist/src/mcp/http-tools.mjs +8 -6
- package/dist/src/mcp/http-transport.mjs +3 -1
- package/dist/src/mcp/server.mjs +1 -1
- package/dist/src/mcp/tools/command-run.mjs +1 -1
- package/dist/src/mcp/tools/discovery.mjs +1 -1
- package/dist/src/mcp/tools/subsystems.mjs +1 -1
- package/dist/src/mcp/tools/worker-invoke.mjs +68 -22
- package/dist/src/mcp/tools/worker-local-only-preflight.mjs +79 -0
- package/dist/src/mcp/tools/worker-recorded-launch.mjs +26 -0
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +33 -6
- package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +33 -0
- package/dist/src/mcp/tools/worker-verify-deliver.mjs +27 -0
- package/dist/src/models/catalog-policy.js +2 -2
- package/dist/src/models/conductor-data-policy.mjs +83 -14
- package/dist/src/models/config-loader.js +2 -2
- package/dist/src/models/factory-models.js +144 -0
- package/dist/src/models/index.js +2 -2
- package/dist/src/models/local-endpoint-models.js +155 -0
- package/dist/src/models/model-capabilities.v1.json +44 -36
- package/dist/src/models/model-discovery.js +16 -8
- package/dist/src/models/opencode-worker-model.mjs +16 -0
- package/dist/src/models/resolver.js +2 -2
- package/dist/src/models/worker-installation.d.mts +2 -0
- package/dist/src/models/worker-installation.mjs +16 -5
- package/dist/src/models/worker-invocation-policy.js +25 -1
- package/dist/src/models/worker-plan.js +1 -1
- package/dist/src/models/wrapper-enforcement.js +1 -1
- package/dist/src/plugin/plugin-installer.js +2 -2
- package/dist/src/plugin/registry-validator.js +2 -2
- package/dist/src/plugin/skill-command-translator.js +1 -1
- package/dist/src/policy/repo-access.js +3 -1
- package/dist/src/providers/capability-matrix.yaml +75 -5
- package/dist/src/providers/deployment-ownership.mjs +8 -1
- 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 +2 -1
- package/dist/src/rlm/cache/hash.js +1 -1
- package/dist/src/rlm/cache/store.js +1 -1
- package/dist/src/rlm/cache/types.js +1 -1
- package/dist/src/serve/worker-invocation-preparation.js +13 -0
- package/dist/src/serve/worker-invocation.js +21 -6
- package/dist/src/serve/worker-stdin-frame.mjs +1 -1
- package/dist/src/sessions/adapters/grok-build-native-records.js +77 -7
- package/dist/src/sessions/adapters/grok-build-native.js +148 -1
- package/dist/src/sessions/adapters/grok-build.js +36 -14
- package/dist/src/sessions/normalization.js +1 -1
- package/dist/src/skills/run.js +0 -11
- package/dist/src/smiths/agentsmith/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/index.js +1 -1
- package/dist/src/smiths/context-pipeline/provider-policy.js +1 -1
- package/dist/src/smiths/context-pipeline/types.js +1 -1
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +4 -0
- package/dist/src/smiths/hook-bridge/factory-trust.js +2 -2
- package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +10 -7
- package/dist/src/smiths/hook-bridge/hermes-trust.js +65 -0
- package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +2 -2
- package/dist/src/smiths/mcpsmith/generator.js +2 -2
- package/dist/src/smiths/mcpsmith/index.js +2 -2
- package/dist/src/smiths/mcpsmith/types.js +2 -2
- package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
- package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
- package/dist/src/smiths/toolsmith/runtime-discovery.mjs +2 -2
- package/dist/src/smiths/toolsmith/types.js +2 -2
- package/dist/src/storage/backends/fortemi.js +1 -1
- package/dist/src/storage/backends/fs.js +1 -1
- package/dist/src/storage/backends/logseq.js +1 -1
- package/dist/src/storage/backends/obsidian.js +1 -1
- package/dist/src/storage/cli.js +2 -2
- package/dist/src/storage/config.js +1 -1
- package/dist/src/storage/index.js +1 -1
- package/dist/src/storage/subsystem-cli.js +1 -1
- package/dist/src/storage/types.js +1 -1
- package/dist/src/testing/generators/test-case-generator.js +1 -1
- package/dist/src/writing/validation-engine.js +1 -1
- package/package.json +11 -1
- package/schemas/models/model-catalog.v1.schema.json +6 -3
- package/tools/agents/deploy-agents.mjs +4 -2
- package/tools/agents/deploy-options.mjs +2 -0
- package/tools/agents/providers/base-inventory.mjs +3 -1
- package/tools/agents/providers/base-kernel-skills.mjs +11 -5
- package/tools/agents/providers/conductor-data-guard.mjs +1 -1
- package/tools/agents/providers/grok-build.mjs +31 -40
- package/tools/agents/providers/model-wrapper.mjs +2 -5
- package/tools/agents/providers/rule-deployment-commit.mjs +3 -0
- package/tools/agents/providers/rule-deployment-prepare.mjs +2 -2
- package/tools/agents/providers/rule-projection.mjs +39 -4
- package/tools/agents/providers/skill-copy-prune.mjs +12 -0
- package/tools/agents/providers/stale-artifact-prune.mjs +24 -10
- 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/mcp-worker-launch.mjs +67 -0
- package/tools/ralph-external/lib/opencode-adapter.mjs +9 -7
- package/tools/ralph-external/lib/trusted-verification.mjs +1021 -0
- package/tools/ralph-external/lib/typed-stop-delivery.mjs +46 -0
- package/tools/ralph-external/lib/verification-isolation.mjs +509 -0
- package/tools/ralph-external/lib/worker-context.mjs +3 -3
- package/tools/ralph-external/lib/worker-delivery-guards.mjs +95 -0
- package/tools/ralph-external/lib/worker-delivery-record.mjs +15 -0
- package/tools/ralph-external/lib/worker-final.mjs +4 -1
- package/tools/ralph-external/lib/worker-inputs.mjs +20 -1
- package/tools/ralph-external/lib/worker-isolation-status.mjs +3 -0
- package/tools/ralph-external/lib/worker-isolation.mjs +1 -0
- package/tools/ralph-external/lib/worker-launch-cli.mjs +8 -0
- package/tools/ralph-external/lib/worker-local-only-paths.mjs +45 -0
- package/tools/ralph-external/lib/worker-prompt.mjs +4 -1
- package/tools/ralph-external/lib/worker-retry-evidence.mjs +2 -1
- package/tools/ralph-external/lib/worker-run-directory.mjs +45 -0
- package/tools/ralph-external/lib/worker-termination.mjs +21 -12
- package/tools/ralph-external/lib/worker-unit-cleanup.mjs +10 -2
- package/tools/ralph-external/lib/worker-verification-cli.mjs +164 -0
- package/tools/ralph-external/lib/worktree-preparation.mjs +417 -0
- package/tools/ralph-external/session-launcher.mjs +30 -32
- package/vscode-extension/schemas/aiwg.config.v1.json +27 -0
|
@@ -45,7 +45,7 @@ export function isOperatorQualifiedWorkerAdapter(adapter) {
|
|
|
45
45
|
}
|
|
46
46
|
/** Bundled renderers with an independently checked native direct baseline. */
|
|
47
47
|
export function hasOperatorWorkerNativeRenderer(adapter) {
|
|
48
|
-
return isOperatorQualifiedWorkerAdapter(adapter) && ['codex', 'muse'].includes(adapter.provider)
|
|
48
|
+
return isOperatorQualifiedWorkerAdapter(adapter) && ['codex', 'muse', 'factory'].includes(adapter.provider)
|
|
49
49
|
&& adapter.invocation.kind === 'process';
|
|
50
50
|
}
|
|
51
51
|
/** The process-group launch boundary requires the independently verified native renderer. */
|
|
@@ -73,6 +73,30 @@ export function assertOperatorWorkerNativeArgv(adapter, argv, selected, permissi
|
|
|
73
73
|
const sandbox = permissions?.sandbox ?? 'workspace-write';
|
|
74
74
|
if (!['read-only', 'workspace-write', 'external'].includes(sandbox))
|
|
75
75
|
throw new Error('Requested sandbox has no verified native renderer');
|
|
76
|
+
if (adapter.provider === 'factory') {
|
|
77
|
+
if (sandbox === 'external' || (permissions?.approval ?? 'never') !== 'never') {
|
|
78
|
+
throw new Error('Factory direct worker requires native sandbox and never approval');
|
|
79
|
+
}
|
|
80
|
+
if (selected.model.startsWith('custom:') && (selected.model.trim() !== selected.model || !/^custom:[^\s\x00-\x1f\x7f]+-\d+$/.test(selected.model))) {
|
|
81
|
+
throw new Error('Factory custom model selector requires a safe normalized name and numeric suffix');
|
|
82
|
+
}
|
|
83
|
+
requirePair('-m', selected.model);
|
|
84
|
+
requirePair('--output-format', 'stream-json');
|
|
85
|
+
const cwd = args[args.indexOf('--cwd') + 1];
|
|
86
|
+
if (!args.includes('--cwd') || !cwd?.startsWith('/') || cwd.includes('\0')) {
|
|
87
|
+
throw new Error('Factory direct worker requires an absolute workspace');
|
|
88
|
+
}
|
|
89
|
+
if (selected.effort.value === null && !selected.model.startsWith('custom:')) {
|
|
90
|
+
throw new Error('Factory built-in models require explicit effort');
|
|
91
|
+
}
|
|
92
|
+
const expected = ['exec', ...(sandbox === 'workspace-write' ? ['--auto', 'low'] : []),
|
|
93
|
+
'-m', selected.model, ...(selected.effort.value === null ? [] : ['-r', selected.effort.value]),
|
|
94
|
+
'--cwd', cwd, '--output-format', 'stream-json'];
|
|
95
|
+
if (args.length !== expected.length || args.some((value, index) => value !== expected[index])) {
|
|
96
|
+
throw new Error('Factory native worker controls could be overridden');
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
76
100
|
if (adapter.provider === 'muse') {
|
|
77
101
|
requirePair('--provider', 'meta');
|
|
78
102
|
requirePair('--model', selected.model);
|
|
@@ -161,7 +161,7 @@ export function resolveWorkerPlan(snapshot, request, ceilingDefaults = {}) {
|
|
|
161
161
|
const permissions = { ...group.execution, transport: group.execution?.transport ?? 'shell' };
|
|
162
162
|
const transport = permissions.transport;
|
|
163
163
|
if (request.transport === 'mcp' && permissions.launchMode === 'native-sandbox') {
|
|
164
|
-
const reason = diagnostic('OG_POLICY_RELAXATION', `/parallelism/groups/${groupId}/execution/launchMode`, 'MCP worker-
|
|
164
|
+
const reason = diagnostic('OG_POLICY_RELAXATION', `/parallelism/groups/${groupId}/execution/launchMode`, '--transport mcp selects an MCP-server worker, which native-sandbox groups do not support. Resolve with --transport shell, then launch with --launch-worker, or from a confined conductor with MCP worker-invoke transport "shell"; or select a group with systemd-unit isolation.');
|
|
165
165
|
for (const member of group.members ?? [])
|
|
166
166
|
plan.exclusions.push({ group: groupId, member: member.id, model: member.model, effort: null, diagnostics: [reason] });
|
|
167
167
|
if (request.group === groupId)
|
|
@@ -93,7 +93,7 @@ export function wrapperEnforcementReport(provider, artifact) {
|
|
|
93
93
|
const details = {
|
|
94
94
|
claude: 'Use AIWG wrappers or an explicit invocation model. Unpinned general-purpose agents inherit; CLAUDE_CODE_SUBAGENT_MODEL supplies a fallback and CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 can override pins.',
|
|
95
95
|
omp: 'Native model and thinkingLevel fields can pin exact operator role models; configured/* catalog entries are placeholders.',
|
|
96
|
-
'grok-build': '
|
|
96
|
+
'grok-build': 'Grok Build 1.0.77: frontmatter model is ignored; agents inherit the session model. Select worker models with CLI -m; role/tier intent is informational.',
|
|
97
97
|
openclaw: 'Markdown wrapper mirrors do not set native subagents.model or per-spawn overrides.',
|
|
98
98
|
openhuman: 'User harness wrappers carry semantic model hints; project wrappers omit model. Neither is an exact pin.',
|
|
99
99
|
antigravity: 'Wrapper mirrors do not project native CLI model/effort flags.',
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
*
|
|
16
16
|
* @module src/plugin/plugin-installer
|
|
17
17
|
* @implements @.aiwg/requirements/use-cases/UC-010-rollback-plugin-installation.md
|
|
18
|
-
* @architecture
|
|
19
|
-
* @adr
|
|
18
|
+
* @architecture @docs/architecture/cli/index.md
|
|
19
|
+
* @adr @docs/plugin-marketplace-guide.md
|
|
20
20
|
* @nfr @.aiwg/requirements/nfr-modules/reliability.md - NFR-REL-002 (zero data loss)
|
|
21
21
|
* @tests @test/unit/plugin/plugin-installer.test.ts
|
|
22
22
|
* @depends @src/plugin/metadata-validator.ts
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @module src/plugin/registry-validator
|
|
8
8
|
* @implements @.aiwg/requirements/use-cases/UC-011-validate-plugin-security.md
|
|
9
|
-
* @architecture
|
|
10
|
-
* @adr
|
|
9
|
+
* @architecture @docs/architecture/cli/index.md
|
|
10
|
+
* @adr @docs/plugin-marketplace-guide.md
|
|
11
11
|
* @tests @test/unit/plugin/registry-validator.test.ts
|
|
12
12
|
* @depends @src/plugin/metadata-validator.ts
|
|
13
13
|
*/
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Skills are the canonical source format; commands are deployment artifacts.
|
|
9
9
|
* See ADR: Skills as the Canonical Extension Type.
|
|
10
10
|
*
|
|
11
|
-
* @implements
|
|
11
|
+
* @implements docs/extensions/extension-types.md
|
|
12
12
|
* @issue #550
|
|
13
13
|
*/
|
|
14
14
|
import fs from 'fs/promises';
|
|
@@ -123,7 +123,9 @@ function normalizeRepoEntry(entry, index, projectRoot) {
|
|
|
123
123
|
export function loadRepoAccessManifest(startDir = process.cwd()) {
|
|
124
124
|
const manifestPath = findRepoAccessManifest(startDir);
|
|
125
125
|
if (!manifestPath) {
|
|
126
|
-
throw new Error(
|
|
126
|
+
throw new Error('Repo access manifest not found. Expected .aiwg/aiwg.config workspace + repos blocks (canonical). '
|
|
127
|
+
+ `Legacy compatibility fallbacks: ${REPO_ACCESS_MANIFEST_PATHS.join(' or ')}. `
|
|
128
|
+
+ 'Register a repo with aiwg repo-access add --path <repo-or-file> --name <name> --allow read,write.');
|
|
127
129
|
}
|
|
128
130
|
const workspaceProjectRoot = findProjectRootFromManifest(manifestPath);
|
|
129
131
|
const isWorkspaceConfig = manifestPath.endsWith('/.aiwg/aiwg.config')
|
|
@@ -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; 1.0.77
|
|
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,17 +592,38 @@ 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
601
|
# #2577: every claim and its limits are recorded in
|
|
564
602
|
# docs/providers/grok-build-native-agents.md (1.0.77 evidence table).
|
|
565
603
|
# Captured headless shapes: test/unit/providers/grok-build-headless.test.ts.
|
|
566
|
-
#
|
|
567
|
-
#
|
|
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.
|
|
568
623
|
daemon_tier: unsupported
|
|
569
624
|
daemon_pty_adapter: false
|
|
570
625
|
artifact_paths:
|
|
571
|
-
agents: .grok/agents/ #
|
|
626
|
+
agents: .grok/agents/ # captured project discovery; grok-build-provider.test.ts
|
|
572
627
|
commands: null
|
|
573
628
|
skills: .grok/skills/
|
|
574
629
|
skills_cross_agent: .grok/.aiwg/skills/ # --copy-all opt-in mirror
|
|
@@ -581,7 +636,7 @@ providers:
|
|
|
581
636
|
mcp: true # fixture-backed config only: grok-build-native-integration.test.ts; live MCP unverified
|
|
582
637
|
behaviors: false # unverified: needs behavior registration/execution capture
|
|
583
638
|
mission_control: false # unverified: needs mission lifecycle capture
|
|
584
|
-
daemon: false #
|
|
639
|
+
daemon: false # deferred: ACP frame replay is not resident lifecycle qualification (grok-build-acp.test.ts)
|
|
585
640
|
emulation:
|
|
586
641
|
cron: null
|
|
587
642
|
agent_teams: aiwg-mc
|
|
@@ -600,6 +655,14 @@ providers:
|
|
|
600
655
|
|
|
601
656
|
hermes:
|
|
602
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
|
|
603
666
|
route_feasibility:
|
|
604
667
|
scope: in
|
|
605
668
|
identity: runtime-configured-only
|
|
@@ -654,6 +717,13 @@ providers:
|
|
|
654
717
|
|
|
655
718
|
muse:
|
|
656
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
|
|
657
727
|
route_feasibility:
|
|
658
728
|
scope: in
|
|
659
729
|
identity: runtime-configured-only
|
|
@@ -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. */
|
|
@@ -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.
|
|
@@ -76,7 +76,8 @@ export async function runGrokHeadless(options) {
|
|
|
76
76
|
const timeoutMs = Math.min(options.timeoutMs ?? DEFAULT_TIMEOUT_MS, MAX_TIMEOUT_MS);
|
|
77
77
|
const maxBytes = Math.min(Math.max(options.maxOutputBytes ?? DEFAULT_MAX_OUTPUT, 1024), DEFAULT_MAX_OUTPUT);
|
|
78
78
|
const env = options.env ?? process.env;
|
|
79
|
-
|
|
79
|
+
// 1.0.77: workflow can spawn children even when spawn_subagent is disabled.
|
|
80
|
+
const args = [...(options.prefixArgs ?? []), '--no-auto-update', '--allow', 'Bash(aiwg discover *)', ...(options.disableSubagents ? ['--no-subagents', '--disallowed-tools', 'workflow'] : []), '-p', options.prompt, '--output-format', format];
|
|
80
81
|
const streaming = format === 'streaming-json' || format === 'streaming-messages-json';
|
|
81
82
|
return new Promise((resolve, reject) => {
|
|
82
83
|
const child = spawn(options.command ?? 'grok', args, {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* order does not affect the resulting hash.
|
|
7
7
|
*
|
|
8
8
|
* @implements #1203
|
|
9
|
-
* @see
|
|
9
|
+
* @see docs/architecture/index-and-manifest-loading.md
|
|
10
10
|
*/
|
|
11
11
|
import { createHash } from 'node:crypto';
|
|
12
12
|
/** Compute a stable sha256 hex hash for a cache key. */
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* └── metadata.json
|
|
9
9
|
*
|
|
10
10
|
* @implements #1203
|
|
11
|
-
* @see
|
|
11
|
+
* @see docs/architecture/index-and-manifest-loading.md
|
|
12
12
|
*/
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from 'node:fs';
|
|
14
14
|
import { join } from 'node:path';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Validate and render a prepared invocation against trusted installation controls. */
|
|
2
2
|
import path from 'node:path';
|
|
3
|
+
import { findPackageRoot } from '../cli/find-package-root.js';
|
|
4
|
+
import { workerOutputPaths } from './worker-invocation-paths.js';
|
|
3
5
|
import { directWorkerEnvironment } from '../config/worker-attribution.mjs';
|
|
4
6
|
import { createHash } from 'node:crypto';
|
|
5
7
|
import { fileURLToPath } from 'node:url';
|
|
@@ -133,6 +135,17 @@ export async function prepareWorkerInvocation(invocation, qualification) {
|
|
|
133
135
|
else {
|
|
134
136
|
throw new Error(`Unsupported worker stdin mode: ${result.stdin}`);
|
|
135
137
|
}
|
|
138
|
+
const root = findPackageRoot(path.dirname(fileURLToPath(import.meta.url)));
|
|
139
|
+
if (!root)
|
|
140
|
+
throw new Error('Worker shell handoff requires the installed AIWG package root');
|
|
141
|
+
const guard = path.join(root, 'tools/ralph-external/lib/worker-shell-capture.mjs');
|
|
142
|
+
const binding = { request: { role: qualification.role, task: qualification.task ?? null,
|
|
143
|
+
group: result.selected.group, workdir: result.cwd },
|
|
144
|
+
invocation: { cwd: result.cwd, briefPath: result.briefPath, briefDigest: result.briefDigest, stdin: result.stdin, selected: result.selected },
|
|
145
|
+
paths: workerOutputPaths(result) };
|
|
146
|
+
// Reserve every output before shell redirection or vendor-owned final writes.
|
|
147
|
+
// Noclobber also protects stream files created between reservation and exec.
|
|
148
|
+
result.shellCommand = `${[process.execPath, guard, JSON.stringify(binding)].map(quote).join(' ')} && (set -C; ${result.shellCommand})`;
|
|
136
149
|
}
|
|
137
150
|
else {
|
|
138
151
|
const binding = result.mcp;
|
|
@@ -83,6 +83,8 @@ const invocationChecks = {
|
|
|
83
83
|
message: 'Worker invocation preparation failed; check installation evidence, policy, paths and environment, then qualify again.' },
|
|
84
84
|
installation_recheck_unavailable: { pointer: '/invocation/prepareWorkerInvocation',
|
|
85
85
|
message: 'The selected profile requires an installation recheck, but the installed driver has no preparation method. Restore the qualified driver and qualify again.' },
|
|
86
|
+
brief_missing: { pointer: '/request/brief',
|
|
87
|
+
message: 'The brief file does not exist, and the selected worker adapter needs its content to build the invocation. Write the brief, then resolve again.' },
|
|
86
88
|
qualified_workspace_mismatch: { pointer: '/request/workdir',
|
|
87
89
|
message: 'Worker workdir differs from the qualified workspace. Use the qualified workspace or run aiwg doctor --probe-workers --qualify from the requested workdir.' },
|
|
88
90
|
};
|
|
@@ -99,7 +101,7 @@ export async function buildWorkerInvocationTransport(driver, input) {
|
|
|
99
101
|
assertWorkerLaunchMode(driver.qualification.adapter, input.permissions);
|
|
100
102
|
let transport;
|
|
101
103
|
try {
|
|
102
|
-
transport = await driver.buildInvocation(input);
|
|
104
|
+
transport = await driver.buildInvocation({ ...input, cliVersion: driver.qualification.cliVersion });
|
|
103
105
|
}
|
|
104
106
|
catch (error) {
|
|
105
107
|
throw new WorkerInvocationCheckError(error instanceof WorkerPolicyError ? error.code : 'OG_ADAPTER_UNQUALIFIED', 'invocation_build_failed');
|
|
@@ -140,7 +142,10 @@ export async function revalidateWorkerInvocationPlan(saved, snapshot, drivers, n
|
|
|
140
142
|
if (!current.invocation || current.status !== 'eligible'
|
|
141
143
|
|| Date.parse(saved.invocation.expiresAt) > Date.parse(current.invocation.expiresAt)
|
|
142
144
|
|| qualificationDigest({ ...current.invocation, expiresAt: saved.invocation.expiresAt }) !== qualificationDigest(saved.invocation)) {
|
|
143
|
-
|
|
145
|
+
// Tell the conductor the usual remedy; a plan resolved from another directory (for example the
|
|
146
|
+
// worker tree, whose config and model sources differ) never matches. The refusal is unchanged.
|
|
147
|
+
throw new WorkerPolicyError('OG_PIN_MISMATCH', 'Saved invocation differs from current qualified plan; resolve again'
|
|
148
|
+
+ ' from the conductor project directory you launch from (a plan resolved elsewhere, such as in the worker tree, never matches)');
|
|
144
149
|
}
|
|
145
150
|
return structuredClone(saved.invocation);
|
|
146
151
|
}
|
|
@@ -278,9 +283,19 @@ export async function resolveWorkerInvocation(snapshot, request, drivers, now =
|
|
|
278
283
|
stepEnforcement: controls.includes('stepCap') ? profile.controls.stepCap.support : 'unavailable' };
|
|
279
284
|
let effectiveHealth = resolveWorkerEffectiveHealth(healthConfig, healthInput);
|
|
280
285
|
const invocationId = expected?.invocationId ?? randomUUID();
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
286
|
+
let transport;
|
|
287
|
+
try {
|
|
288
|
+
transport = await buildWorkerInvocationTransport(driver, { invocationId, selected: structuredClone(selected), permissions: structuredClone(tuple.permissions),
|
|
289
|
+
cwd: request.workdir, briefPath: request.brief, brief: bytes?.toString('utf8') ?? '', finalPath, limits: structuredClone(limits),
|
|
290
|
+
health: structuredClone(effectiveHealth), role: request.role });
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
// A driver that needs the brief cannot build without it; name the missing file, not the adapter (#4161).
|
|
294
|
+
if (bytes !== null || !(error instanceof WorkerInvocationCheckError) || error.reason !== 'invocation_build_failed')
|
|
295
|
+
throw error;
|
|
296
|
+
pointer = '/request/brief';
|
|
297
|
+
throw new WorkerInvocationCheckError('OG_CONFIG_REFERENCE', 'brief_missing');
|
|
298
|
+
}
|
|
284
299
|
for (const output of Object.values(workerOutputPaths({ ...transport, selected, transport: tuple.transport, finalPath, stdoutPath, stderrPath }))) {
|
|
285
300
|
await inspectPath(output, 'output');
|
|
286
301
|
if (path.resolve(request.brief) === output)
|
|
@@ -316,7 +331,7 @@ export async function resolveWorkerInvocation(snapshot, request, drivers, now =
|
|
|
316
331
|
controlEvidence: isOperatorQualifiedWorkerAdapter(adapter) ? [adapter.qualification.evidenceRef, ...controls.map(name => profile.controls[name].evidence)] : controls.map(name => profile.controls[name].evidence),
|
|
317
332
|
health: effectiveHealth, };
|
|
318
333
|
const invocationQualification = { ...qualification, now: Date.parse(now),
|
|
319
|
-
ceilings: request.ceilings,
|
|
334
|
+
ceilings: request.ceilings, task: request.task,
|
|
320
335
|
policy: plan.policy, permissions: tuple.permissions, role: request.role, modelObservation: observation,
|
|
321
336
|
expectedDigests: { policyDigest, catalogDigest: plan.digests.catalogDigest, profileDigest: plan.digests.profileDigest, briefDigest },
|
|
322
337
|
requiredControls: controls };
|
|
@@ -73,7 +73,7 @@ export async function recordedWorkerStdinBytes({ filename, workspace, cli, adapt
|
|
|
73
73
|
const { loadRecordedWorkerInstallations } = await import('../models/worker-installation.mjs');
|
|
74
74
|
const { loadProviderModelCapabilities } = await import('../models/provider-policy.js');
|
|
75
75
|
const { drivers } = await loadRecordedWorkerInstallations({ registry: loadProviderModelCapabilities(),
|
|
76
|
-
cwd: workspace, policy, storePath, storeDigest });
|
|
76
|
+
cwd: workspace, policy, cli, storePath, storeDigest });
|
|
77
77
|
const driver = drivers[cli];
|
|
78
78
|
if (!driver || driver.qualification.adapterId !== adapterId
|
|
79
79
|
|| driver.qualification.adapter.invocation.stdin !== 'adapter-frame'
|