@aiwg/cli 2026.11.0 → 2026.11.2
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 +9 -0
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +136 -0
- package/agentic/code/providers/flue/README.md +2 -1
- package/agentic/code/providers/model-capabilities.v1.json +27 -23
- package/agentic/code/providers/model-catalog.v1.json +3 -3
- package/dist/src/artifacts/cli.js +13 -13
- package/dist/src/artifacts/discover-cli-help.js +25 -0
- package/dist/src/artifacts/discover-facets.js +2 -0
- package/dist/src/artifacts/discover-session-facets.js +15 -0
- package/dist/src/artifacts/fortemi-core-prebuilt-freshness.js +28 -0
- package/dist/src/artifacts/fortemi-core-query-adapter.js +4 -4
- package/dist/src/artifacts/fortemi-core-sync.js +3 -0
- package/dist/src/artifacts/framework-capabilities.js +11 -3
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +12 -13
- package/dist/src/artifacts/index-dependencies.js +72 -0
- package/dist/src/artifacts/query-engine-discover-output.js +13 -5
- package/dist/src/artifacts/query-engine-discover.js +103 -28
- package/dist/src/artifacts/query-engine-entries.js +107 -10
- package/dist/src/artifacts/query-engine-installation.js +27 -0
- package/dist/src/artifacts/query-engine-options.js +14 -1
- package/dist/src/artifacts/query-engine-rules.js +1 -2
- package/dist/src/artifacts/query-engine-scoring.js +38 -32
- package/dist/src/artifacts/query-engine-show-card.js +8 -2
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +5 -3
- package/dist/src/artifacts/query-engine-templates.js +33 -0
- package/dist/src/artifacts/query-engine-verbose.js +25 -0
- package/dist/src/artifacts/relations-builder.js +49 -4
- package/dist/src/artifacts/relations.js +26 -10
- package/dist/src/artifacts/template-references.js +42 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/bundle-reconciliation.js +7 -3
- package/dist/src/cli/handlers/checkpoint-handoff.js +48 -0
- package/dist/src/cli/handlers/checkpoint-record.js +20 -0
- package/dist/src/cli/handlers/checkpoint.js +176 -0
- package/dist/src/cli/handlers/decision.js +1 -1
- package/dist/src/cli/handlers/doctor-args.js +3 -1
- package/dist/src/cli/handlers/doctor-help.js +2 -1
- package/dist/src/cli/handlers/help.js +1 -0
- package/dist/src/cli/handlers/index.js +4 -2
- package/dist/src/cli/handlers/models-resource-sample.js +7 -3
- package/dist/src/cli/handlers/ralph-launcher.js +1 -1
- package/dist/src/cli/handlers/refresh-bundles.js +2 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +196 -0
- package/dist/src/cli/handlers/refresh.js +10 -2
- package/dist/src/cli/handlers/script-runner.js +2 -1
- package/dist/src/cli/handlers/steward-signing.js +44 -0
- package/dist/src/cli/handlers/steward.js +5 -0
- package/dist/src/cli/handlers/subcommands-discovery.js +8 -1
- package/dist/src/cli/handlers/use-provider-results.js +17 -0
- package/dist/src/cli/handlers/use.js +19 -18
- package/dist/src/cli/router.js +12 -2
- package/dist/src/cli/services/deployment-verification.js +11 -7
- package/dist/src/cli/user-scope-mirror.js +3 -1
- package/dist/src/config/aiwg-config.js +5 -1
- package/dist/src/config/cli.js +1 -0
- package/dist/src/config/delivery-validation.js +21 -0
- package/dist/src/config/host-resource-report.d.mts +1 -1
- package/dist/src/config/host-resource-report.mjs +23 -4
- package/dist/src/config/host-resource-runtime.d.mts +8 -0
- package/dist/src/config/host-resource-runtime.mjs +67 -24
- package/dist/src/config/index-graph-overrides.js +4 -0
- package/dist/src/config/worker-attribution.d.mts +7 -0
- package/dist/src/config/worker-attribution.mjs +44 -0
- package/dist/src/config/worker-write.js +4 -10
- package/dist/src/decision/ledger.js +15 -15
- package/dist/src/decision/offload.js +6 -7
- package/dist/src/delivery/git.js +62 -0
- package/dist/src/delivery/pr.js +151 -0
- package/dist/src/delivery/template-sections.js +56 -0
- package/dist/src/delivery/tracker.js +33 -0
- package/dist/src/discovery/interview.js +1 -1
- package/dist/src/extensions/claude-hooks-installer.js +62 -53
- package/dist/src/extensions/loader.js +2 -1
- package/dist/src/extensions/managed-hook-script-state.js +48 -0
- package/dist/src/extensions/muse-managed-hooks.js +49 -0
- package/dist/src/issues/cli.js +15 -3
- package/dist/src/issues/external-cli.js +79 -0
- package/dist/src/issues/live.js +26 -2
- package/dist/src/issues/local.js +5 -1
- package/dist/src/issues/tracker-policy.js +27 -0
- package/dist/src/mcp/json-document.d.mts +2 -0
- package/dist/src/mcp/tools/worker-invoke.mjs +2 -1
- package/dist/src/mcp/tools/worker-stdin-runtime.mjs +12 -0
- package/dist/src/models/conductor-data-policy.d.mts +3 -2
- package/dist/src/models/conductor-data-policy.mjs +94 -5
- package/dist/src/models/model-capabilities.v1.json +27 -23
- package/dist/src/models/model-catalog.v1.json +3 -3
- package/dist/src/models/provider-policy.js +8 -0
- package/dist/src/models/worker-health-readiness.js +20 -4
- package/dist/src/models/worker-health-snapshot.js +29 -0
- package/dist/src/models/worker-installation.d.mts +5 -1
- package/dist/src/models/worker-installation.mjs +11 -5
- package/dist/src/models/worker-plan.js +3 -3
- package/dist/src/models/worker-qualification-policy.js +54 -0
- package/dist/src/models/worker-selection-policy.js +2 -1
- package/dist/src/providers/deployment-lock.js +77 -0
- package/dist/src/providers/deployment-ownership.d.mts +12 -2
- package/dist/src/providers/deployment-ownership.mjs +115 -21
- package/dist/src/providers/deployment-preservation.d.mts +2 -1
- package/dist/src/providers/deployment-preservation.mjs +3 -0
- package/dist/src/providers/provider-definitions.js +4 -0
- package/dist/src/providers/skill-ownership.d.mts +1 -0
- package/dist/src/providers/transformation-receipt-integration.js +4 -2
- package/dist/src/providers/transformation-receipt.js +4 -2
- package/dist/src/serve/worker-invocation-preparation.js +3 -1
- package/dist/src/serve/worker-invocation.js +6 -2
- package/dist/src/skills/run.js +5 -0
- package/dist/src/smiths/context-pipeline/workspace-audit.js +34 -17
- package/dist/src/smiths/context-pipeline/workspace-context-shared.js +12 -6
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +44 -4
- package/dist/src/smiths/context-pipeline/workspace-document.js +5 -2
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -1
- package/dist/src/smiths/hook-bridge/codex-translator.js +150 -92
- package/dist/src/smiths/hook-bridge/codex-trust.js +50 -0
- package/dist/src/smiths/hook-bridge/factory-hook-config.js +132 -0
- package/dist/src/smiths/hook-bridge/factory-translator.js +88 -33
- package/dist/src/smiths/hook-bridge/hermes-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/index.js +3 -3
- package/dist/src/smiths/hook-bridge/loader.js +10 -2
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +5 -0
- package/dist/src/storage/workspace-permissions-health.js +64 -0
- package/dist/src/storage/workspace-permissions.js +51 -0
- package/package.json +9 -2
- package/schemas/models/model-config-compatibility.v1.schema.json +4 -0
- package/tools/agents/deploy-agents.mjs +15 -0
- package/tools/agents/providers/base-contract.mjs +7 -1
- package/tools/agents/providers/base-files.mjs +2 -1
- package/tools/agents/providers/base-flat-artifacts.mjs +6 -3
- package/tools/agents/providers/base-inventory.mjs +35 -13
- package/tools/agents/providers/base-models-platforms.mjs +3 -3
- package/tools/agents/providers/base-skill-copy.mjs +2 -0
- package/tools/agents/providers/base.mjs +1 -1
- package/tools/agents/providers/bound-rules-pointer.mjs +21 -0
- package/tools/agents/providers/claude-post-deploy.mjs +9 -5
- package/tools/agents/providers/codex-post-deploy.mjs +10 -0
- package/tools/agents/providers/conductor-data-guard.mjs +35 -11
- package/tools/agents/providers/factory-hooks.mjs +43 -0
- package/tools/agents/providers/factory.mjs +4 -91
- package/tools/agents/providers/muse-hooks.mjs +6 -41
- package/tools/agents/providers/muse-prompt-discovery.mjs +18 -0
- package/tools/agents/providers/packaged-codex-agents.mjs +48 -0
- package/tools/agents/providers/provider-prepare-coordinator.mjs +15 -10
- package/tools/agents/providers/rule-delivery-surface.mjs +10 -7
- package/tools/agents/providers/rule-deployment-commit.mjs +10 -0
- package/tools/agents/providers/rule-presentation.mjs +6 -5
- package/tools/agents/providers/rule-projection.mjs +10 -2
- package/tools/agents/providers/rule-startup.mjs +8 -1
- package/tools/agents/providers/stale-artifact-prune.mjs +9 -8
- package/tools/cli/decision-offload-report.mjs +7 -2
- package/tools/plugin/issue-template-copies.mjs +24 -0
- package/tools/plugin/package-plugins.mjs +11 -3
- package/tools/ralph-external/lib/factory-adapter.mjs +7 -8
- package/tools/ralph-external/lib/worker-artifacts.mjs +4 -2
- package/tools/ralph-external/lib/worker-capture.mjs +157 -0
- package/tools/ralph-external/lib/worker-final.mjs +43 -8
- package/tools/ralph-external/lib/worker-health.mjs +3 -0
- package/tools/ralph-external/lib/worker-invocation-processes.mjs +9 -6
- package/tools/ralph-external/lib/worker-launch-cli.mjs +20 -2
- package/tools/ralph-external/lib/worker-process-identity.mjs +30 -0
- package/tools/ralph-external/lib/worker-prompt.mjs +35 -0
- package/tools/ralph-external/lib/worker-retry-evidence.mjs +87 -6
- package/tools/ralph-external/lib/worker-run-directory-refusal.mjs +8 -0
- package/tools/ralph-external/lib/worker-termination.mjs +56 -6
- package/tools/ralph-external/process-monitor.mjs +12 -18
- package/tools/ralph-external/session-launcher.mjs +53 -36
- package/vscode-extension/schemas/aiwg.config.v1.json +15 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
id: aiwg-prompt-discovery
|
|
2
|
+
description: Bounded prompt-time capability candidates and show/rules/apply guidance
|
|
3
|
+
events: [UserPromptSubmit]
|
|
4
|
+
command: node
|
|
5
|
+
args: ['$AIWG_ROOT/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs']
|
|
6
|
+
timeout: 2
|
|
7
|
+
# These bridges map an event but cannot deliver additionalContext to the model.
|
|
8
|
+
# Muse uses its project hook owner; Claude uses claude-hooks-installer.
|
|
9
|
+
degrade-on: [hermes, copilot, grok-build]
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Inject bounded capability discovery at prompt time; errors always fail open.
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { pathToFileURL } = require('node:url');
|
|
6
|
+
const { Worker } = require('node:worker_threads');
|
|
7
|
+
|
|
8
|
+
const configured = Number(process.env.AIWG_PROMPT_DISCOVERY_TIMEOUT_MS || 1500);
|
|
9
|
+
const budget = Number.isFinite(configured) && configured > 0 ? Math.min(configured, 10000) : 1500;
|
|
10
|
+
const deadline = Date.now() + budget;
|
|
11
|
+
let worker;
|
|
12
|
+
const finish = () => {
|
|
13
|
+
if (worker) void worker.terminate();
|
|
14
|
+
process.exit(0);
|
|
15
|
+
};
|
|
16
|
+
// Covers stdin, runtime lookup, imports, index loading, ranking and output.
|
|
17
|
+
setTimeout(finish, budget);
|
|
18
|
+
process.stdout.on('error', finish);
|
|
19
|
+
|
|
20
|
+
function runtimeModule() {
|
|
21
|
+
const roots = process.env.AIWG_ROOT ? [process.env.AIWG_ROOT] : [];
|
|
22
|
+
if (!roots.length) {
|
|
23
|
+
for (const dir of (process.env.PATH || '').split(path.delimiter)) {
|
|
24
|
+
if (!dir) continue;
|
|
25
|
+
try { roots.push(path.dirname(path.dirname(fs.realpathSync(path.join(dir, 'aiwg'))))); }
|
|
26
|
+
catch { /* This PATH entry has no AIWG executable. */ }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
for (const root of roots) {
|
|
30
|
+
const modulePath = path.join(root, 'dist/src/artifacts/query-engine-discover.js');
|
|
31
|
+
if (fs.existsSync(modulePath)) return pathToFileURL(modulePath).href;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function shouldDiscover(prompt) {
|
|
37
|
+
if (!prompt || /^\/[a-z][\w:-]*(?:[ \t]+[^\n]*)?$/i.test(prompt)) return false;
|
|
38
|
+
if (/^\[SYSTEM NOTIFICATION - NOT USER INPUT\]/i.test(prompt)
|
|
39
|
+
|| /<(?:task-notification|system-reminder|tool[_-]result)(?=[\s>])/i.test(prompt)) return false;
|
|
40
|
+
const words = prompt.split(/\s+/);
|
|
41
|
+
// Short action requests still qualify; bare acknowledgements/options do not.
|
|
42
|
+
const imperative = /\b(add|apply|audit|build|check|create|debug|delete|deploy|describe|disable|document|enable|explain|fetch|find|fix|generate|help|implement|inspect|install|list|look|make|read|refactor|remove|rename|repair|research|review|run|search|set|show|summarize|test|trace|update|use|validate|verify|write)\b/i;
|
|
43
|
+
return words.length >= 4 || imperative.test(prompt);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function contextFor(envelope, prompt) {
|
|
47
|
+
const clean = (value, max) => typeof value === 'string'
|
|
48
|
+
? value.replace(/[\x00-\x1f\x7f]/g, ' ').replace(/[*_]/g, '').replace(/\s+/g, ' ').trim().slice(0, max) : '';
|
|
49
|
+
const prefix = 'AIWG candidates:\n';
|
|
50
|
+
const next = '\nFirst call: aiwg show <type> <name> (best fit) -> rules (--rules --with-rule-bodies; --body) -> apply.'
|
|
51
|
+
+ '\nIf none fit, run aiwg discover; never decline without it.';
|
|
52
|
+
const candidates = (Array.isArray(envelope?.results) ? envelope.results : [])
|
|
53
|
+
.filter(r => typeof r?.score === 'number' && Number.isFinite(r.score) && r.score >= 0.20
|
|
54
|
+
&& /^[a-z][a-z-]{0,19}$/.test(r.type) && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,69}$/.test(r.name))
|
|
55
|
+
.sort((a, b) => b.score - a.score).slice(0, 3);
|
|
56
|
+
const template = candidates.find(candidate => candidate.templates?.length)?.templates?.[0];
|
|
57
|
+
const templateHint = template && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,69}$/.test(template.name)
|
|
58
|
+
&& /^aiwg show template [a-zA-Z0-9][a-zA-Z0-9_.:-]{0,149}$/.test(template.show_command)
|
|
59
|
+
? `\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.
|
|
62
|
+
// Muse UAT (2026-11-06): advisory wording was ignored; first-call wording was followed.
|
|
63
|
+
if (!candidates.some(r => r.score >= 0.70)) {
|
|
64
|
+
// Restrict by type only when the request asks for an AIWG component of that type, not when a
|
|
65
|
+
// type word merely appears ("removes every managed Claude hook" is not a hook search).
|
|
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();
|
|
67
|
+
const type = namedType === 'workflow' ? 'flow' : namedType;
|
|
68
|
+
// The request goes through a quoted heredoc so the shell never expands it (#3946).
|
|
69
|
+
// One line: multi-line wording lowered first-call compliance in harness UAT.
|
|
70
|
+
let need = prompt.replace(/[\x00-\x1f\x7f]/g, ' ').replace(/AIWG_REQUEST/g, ' ').replace(/\s+/g, ' ').trim().slice(0, 220);
|
|
71
|
+
const instruction = () => `Before any other tool call or answer, run: aiwg discover --stdin${type ? ` --type ${type}` : ''} <<'AIWG_REQUEST' with the request on the next line and AIWG_REQUEST on the last line (never put request text in quotes on a command line), then answer from its result. Answering or declining without running it violates the skill-discovery rule. Request: ${need}${templateHint}`;
|
|
72
|
+
while (instruction().length > 599 && need.length) need = need.slice(0, -1);
|
|
73
|
+
return instruction();
|
|
74
|
+
}
|
|
75
|
+
// Leave room for the template drill-in even when candidate names are long.
|
|
76
|
+
while (candidates.length > 1 && prefix.length + next.length + templateHint.length
|
|
77
|
+
+ candidates.map(r => `${r.type} ${r.name} (${r.score.toFixed(2).slice(0, 6)}): `).join('\n').length > 599) candidates.pop();
|
|
78
|
+
// Share the remaining space so long names cannot push total context past 599.
|
|
79
|
+
const labels = candidates.map(r => `${r.type} ${r.name} (${r.score.toFixed(2).slice(0, 6)}): `);
|
|
80
|
+
const available = 599 - prefix.length - next.length - templateHint.length - labels.join('\n').length;
|
|
81
|
+
const perCapability = Math.min(100, Math.max(0, Math.floor(available / (candidates.length || 1))));
|
|
82
|
+
const rows = candidates.map((r, i) => labels[i] + clean(r.capability, perCapability));
|
|
83
|
+
if (!rows.length) return '';
|
|
84
|
+
return prefix + rows.join('\n') + templateHint + next;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function main() {
|
|
88
|
+
if (/^(0|false|off)$/i.test(process.env.AIWG_PROMPT_DISCOVERY || '') || process.stdin.isTTY) return finish();
|
|
89
|
+
const chunks = [];
|
|
90
|
+
let size = 0;
|
|
91
|
+
for await (const chunk of process.stdin) {
|
|
92
|
+
size += chunk.length;
|
|
93
|
+
if (size > 1024 * 1024) return finish();
|
|
94
|
+
chunks.push(chunk);
|
|
95
|
+
}
|
|
96
|
+
const event = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
97
|
+
if (event.hook_event_name && event.hook_event_name !== 'UserPromptSubmit') return finish();
|
|
98
|
+
if ([event.role, event.message?.role].some(role => role && role !== 'user')
|
|
99
|
+
|| /^(system|notification|tool[_-]result)$/.test(event.type || '')) return finish();
|
|
100
|
+
const prompt = typeof event.prompt === 'string' ? event.prompt.trim() : '';
|
|
101
|
+
if (!shouldDiscover(prompt)) return finish();
|
|
102
|
+
const moduleUrl = runtimeModule();
|
|
103
|
+
if (!moduleUrl || Date.now() >= deadline) return finish();
|
|
104
|
+
// The installed discovery API prints a JSON envelope. Capture it inside the
|
|
105
|
+
// isolated worker; no CLI bootstrap and no stdout/stderr leaks to the harness.
|
|
106
|
+
worker = new Worker(`
|
|
107
|
+
const { parentPort, workerData } = require('node:worker_threads');
|
|
108
|
+
console.log = value => {
|
|
109
|
+
if (typeof value === 'string') {
|
|
110
|
+
try { parentPort.postMessage(JSON.parse(value)); } catch {}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
(async () => {
|
|
114
|
+
const { discoverCapability } = await import(workerData.moduleUrl);
|
|
115
|
+
await discoverCapability(workerData.cwd, {
|
|
116
|
+
phrase: workerData.prompt, limit: 3, json: true, jsonPretty: false, promptContext: true,
|
|
117
|
+
resourceSource: 'local', offline: true
|
|
118
|
+
});
|
|
119
|
+
})().catch(() => process.exit(0));
|
|
120
|
+
`, {
|
|
121
|
+
eval: true, stdout: true, stderr: true,
|
|
122
|
+
workerData: { moduleUrl, prompt, cwd: process.cwd() },
|
|
123
|
+
});
|
|
124
|
+
worker.on('message', envelope => {
|
|
125
|
+
if (Date.now() >= deadline) return finish();
|
|
126
|
+
const context = contextFor(envelope, prompt);
|
|
127
|
+
if (context) process.stdout.write(JSON.stringify({
|
|
128
|
+
hookSpecificOutput: { hookEventName: 'UserPromptSubmit', additionalContext: context },
|
|
129
|
+
}) + '\n', finish);
|
|
130
|
+
else finish();
|
|
131
|
+
});
|
|
132
|
+
worker.on('error', finish);
|
|
133
|
+
worker.on('exit', finish);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
main().catch(finish);
|
|
@@ -16,9 +16,10 @@ The default tools run the installed `aiwg mcp serve` in the app's launch directo
|
|
|
16
16
|
For another trusted project or executable, call `createAiwgTools({ cwd, command, args, env })`
|
|
17
17
|
at app setup and mount the returned tools. Configuration belongs to the app,
|
|
18
18
|
never to model tool inputs. The app needs AIWG installed on PATH, Node 24+, and
|
|
19
|
-
the tested Flue 2.3.0 graph: Valibot, `@modelcontextprotocol/client` 2.
|
|
19
|
+
the tested Flue 2.3.0 graph: Valibot, `@modelcontextprotocol/client` 2.3.0 and
|
|
20
20
|
its `/stdio` export. These are already present in the pinned lab graph; AIWG
|
|
21
21
|
does not install dependencies or provide model credentials.
|
|
22
|
+
For an existing app, use the [MCP overrides in the setup guide](../../../../docs/providers/flue.md#package-mode).
|
|
22
23
|
|
|
23
24
|
Each call owns a stdio child and closes it on success or failure. Initialization
|
|
24
25
|
has a 10-second deadline and observes cancellation; transport cleanup can take
|
|
@@ -1079,7 +1079,7 @@
|
|
|
1079
1079
|
"agent": "native",
|
|
1080
1080
|
"skill": "informational",
|
|
1081
1081
|
"globalChild": "native",
|
|
1082
|
-
"identifierSyntax": "Factory model ID or
|
|
1082
|
+
"identifierSyntax": "Factory built-in model ID or custom BYOK model selector",
|
|
1083
1083
|
"effortValues": [
|
|
1084
1084
|
"low",
|
|
1085
1085
|
"medium",
|
|
@@ -1097,7 +1097,7 @@
|
|
|
1097
1097
|
"id": "factory-direct",
|
|
1098
1098
|
"provider": "factory",
|
|
1099
1099
|
"adapterVersion": "1",
|
|
1100
|
-
"supportedVersions": "0.
|
|
1100
|
+
"supportedVersions": "1.0.0",
|
|
1101
1101
|
"runtimeDriver": "installed:factory",
|
|
1102
1102
|
"catalogAdapter": {
|
|
1103
1103
|
"kind": "file",
|
|
@@ -1122,7 +1122,7 @@
|
|
|
1122
1122
|
],
|
|
1123
1123
|
"stdin": "brief-text",
|
|
1124
1124
|
"cwd": "${workspace}",
|
|
1125
|
-
"envAllowlist": ["FACTORY_API_KEY", "HOME", "PATH"],
|
|
1125
|
+
"envAllowlist": ["FACTORY_API_KEY", "HOME", "OPENROUTER_API_KEY", "PATH"],
|
|
1126
1126
|
"versionArgv": [
|
|
1127
1127
|
"--version"
|
|
1128
1128
|
],
|
|
@@ -1147,78 +1147,82 @@
|
|
|
1147
1147
|
"invocationProfiles": {
|
|
1148
1148
|
"direct-shell": {
|
|
1149
1149
|
"transport": "shell",
|
|
1150
|
-
"supportedVersions": "0.
|
|
1150
|
+
"supportedVersions": "1.0.0",
|
|
1151
1151
|
"controls": {
|
|
1152
1152
|
"model": {
|
|
1153
1153
|
"support": "unqualified",
|
|
1154
|
-
"mapping": "[-m/--model MODEL]; exact catalog model ID, never the CLI default
|
|
1155
|
-
"evidence": "H: droid-cli 0.
|
|
1154
|
+
"mapping": "[-m/--model MODEL]; exact catalog model ID, never the CLI default or a generic alias",
|
|
1155
|
+
"evidence": "H: droid-cli 1.0.0 exec --help documents -m/--model <id>; unqualified until live model-pin evidence"
|
|
1156
1156
|
},
|
|
1157
1157
|
"effort": {
|
|
1158
1158
|
"support": "unqualified",
|
|
1159
1159
|
"mapping": "[-r/--reasoning-effort LEVEL]; valid levels are model-dependent (exec --help 'Model details'); never the per-model default",
|
|
1160
|
-
"evidence": "H: droid-cli 0.
|
|
1160
|
+
"evidence": "H: droid-cli 1.0.0 exec --help documents -r/--reasoning-effort <level> (defaults per model); unqualified until live evidence"
|
|
1161
1161
|
},
|
|
1162
1162
|
"sandbox": {
|
|
1163
1163
|
"support": "unqualified",
|
|
1164
1164
|
"mapping": "workspace-write -> [--auto low]; read-only -> no --auto flag (the CLI's own documented read-only default); --skip-permissions-unsafe and the medium/high --auto tiers are out of this contract's scope and are never emitted",
|
|
1165
|
-
"evidence": "H: droid-cli 0.
|
|
1165
|
+
"evidence": "H: droid-cli 1.0.0 exec --help documents --auto <level> (low|medium|high), its 'Autonomy Levels' default read-only mode, and --skip-permissions-unsafe ('Bypass all checks - DANGEROUS!'); unqualified until live evidence"
|
|
1166
1166
|
},
|
|
1167
1167
|
"approval": {
|
|
1168
1168
|
"support": "unqualified",
|
|
1169
1169
|
"mapping": "unavailable as a separate flag: exec is non-interactive by construction and --auto (the sandbox control) is the only permission gate",
|
|
1170
|
-
"evidence": "H: droid-cli 0.238.0 exec --help documents exec as 'Run non-interactively (for scripts/automation)' with no approval-prompt flag; unqualified until live evidence"
|
|
1170
|
+
"evidence": "H: prior droid-cli 0.238.0 exec --help documents exec as 'Run non-interactively (for scripts/automation)' with no approval-prompt flag; not reverified on 1.0.0, unqualified until live evidence"
|
|
1171
1171
|
},
|
|
1172
1172
|
"workdir": {
|
|
1173
1173
|
"support": "unqualified",
|
|
1174
1174
|
"mapping": "[--cwd W] conductor working root, plus the conductor process cwd",
|
|
1175
|
-
"evidence": "H: droid-cli 0.
|
|
1175
|
+
"evidence": "H: droid-cli 1.0.0 exec --help documents --cwd <path>; unqualified until live evidence"
|
|
1176
1176
|
},
|
|
1177
1177
|
"finalOutput": {
|
|
1178
1178
|
"support": "unqualified",
|
|
1179
1179
|
"mapping": "unavailable as a file target: no -o/output-file flag is documented for exec (-o/--output-format selects stream shape, not a destination); the final is the last type:\"result\" line of the captured --output-format stream-json stdout stream",
|
|
1180
|
-
"evidence": "H: droid-cli 0.
|
|
1180
|
+
"evidence": "H: droid-cli 1.0.0 exec --help documents -o/--output-format <text|json|stream-json|stream-jsonrpc|acp> with no file-path argument; D: https://docs.factory.com/droid-exec/overview documents the terminal result object shape; unqualified until live evidence"
|
|
1181
1181
|
},
|
|
1182
1182
|
"stdin": {
|
|
1183
1183
|
"support": "unqualified",
|
|
1184
1184
|
"mapping": "brief-text: omitting the prompt argument makes exec read the prompt from stdin to EOF; brief text never enters argv, rendered commands or serialized plans",
|
|
1185
|
-
"evidence": "H: droid-cli 0.
|
|
1185
|
+
"evidence": "H: titan eval on droid-cli 1.0.0 verified stdin ingestion: the brief was echoed as the first stream-json message. Live result pending: blocked by 402 No active subscription; no successful inference recorded"
|
|
1186
1186
|
},
|
|
1187
1187
|
"structuredOutput": {
|
|
1188
1188
|
"support": "unqualified",
|
|
1189
1189
|
"mapping": "unavailable: no --output-schema-equivalent flag is documented for exec",
|
|
1190
|
-
"evidence": "H: droid-cli 0.238.0 exec --help advertises no output-schema flag; unqualified until live evidence"
|
|
1190
|
+
"evidence": "H: prior droid-cli 0.238.0 exec --help advertises no output-schema flag; not reverified on 1.0.0, unqualified until live evidence"
|
|
1191
1191
|
},
|
|
1192
1192
|
"stepCap": {
|
|
1193
1193
|
"support": "unqualified",
|
|
1194
|
-
"mapping": "unavailable: no step or turn cap flag is evidenced on 0.
|
|
1195
|
-
"evidence": "H: droid-cli 0.238.0 exec --help advertises no step-cap flag; unknown controls block tasks requiring them"
|
|
1194
|
+
"mapping": "unavailable: no step or turn cap flag is evidenced on 1.0.0; deadline and output-byte bounds come from the invoking shell",
|
|
1195
|
+
"evidence": "H: prior droid-cli 0.238.0 exec --help advertises no step-cap flag; unknown controls block tasks requiring them"
|
|
1196
1196
|
},
|
|
1197
1197
|
"trust": {
|
|
1198
1198
|
"support": "unqualified",
|
|
1199
|
-
"mapping": "unknown: workspace-trust behaviour is not evidenced for non-interactive exec on 0.
|
|
1200
|
-
"evidence": "H: droid-cli 0.238.0 exec --help documents no trust-prompt flag for exec; unqualified until live evidence"
|
|
1199
|
+
"mapping": "unknown: workspace-trust behaviour is not evidenced for non-interactive exec on 1.0.0",
|
|
1200
|
+
"evidence": "H: prior droid-cli 0.238.0 exec --help documents no trust-prompt flag for exec; not reverified on 1.0.0, unqualified until live evidence"
|
|
1201
1201
|
},
|
|
1202
1202
|
"children": {
|
|
1203
1203
|
"support": "unqualified",
|
|
1204
1204
|
"mapping": "controllable: --mission spawns worker sessions via factoryd (never emitted by this profile, which keeps every run single-agent)",
|
|
1205
|
-
"evidence": "H: droid-cli 0.238.0 exec --help documents --mission/--worker-model/--validator-model as mission-mode only; the direct profile never emits them; unqualified until live evidence"
|
|
1205
|
+
"evidence": "H: prior droid-cli 0.238.0 exec --help documents --mission/--worker-model/--validator-model as mission-mode only; the direct profile never emits them; not reverified on 1.0.0, unqualified until live evidence"
|
|
1206
1206
|
},
|
|
1207
1207
|
"fallback": {
|
|
1208
1208
|
"support": "unqualified",
|
|
1209
1209
|
"mapping": "unavailable: no non-mission fallback-model flag is documented for exec (--spec-model/--worker-model/--validator-model are mission-mode only)",
|
|
1210
|
-
"evidence": "H: droid-cli 0.238.0 exec --help scopes --spec-model/--worker-model/--validator-model to --mission/--use-spec; unknown controls block tasks requiring them"
|
|
1210
|
+
"evidence": "H: prior droid-cli 0.238.0 exec --help scopes --spec-model/--worker-model/--validator-model to --mission/--use-spec; unknown controls block tasks requiring them"
|
|
1211
1211
|
}
|
|
1212
1212
|
},
|
|
1213
|
-
"envAllowlist": ["FACTORY_API_KEY", "HOME", "PATH"],
|
|
1213
|
+
"envAllowlist": ["FACTORY_API_KEY", "HOME", "OPENROUTER_API_KEY", "PATH"],
|
|
1214
1214
|
"pitfalls": [
|
|
1215
1215
|
"Documentation/help and synthetic observations are not authenticated live qualification.",
|
|
1216
|
+
"Titan 1.0.0 eval (2026-11-06, BYOK custom model via OpenRouter): the brief on stdin returns the exact smoke reply in read-only mode and with --auto low; -m selects the custom model and the stream-json system event reports it. Catalog evidence stays H; live qualification is recorded only by aiwg doctor --probe-workers --qualify.",
|
|
1217
|
+
"-r/--reasoning-effort is accepted but ignored for BYOK custom models: the system event reports reasoning_effort none, so effort is not enforceable on them.",
|
|
1218
|
+
"droid relabels custom model IDs by display name: custom:<name>-2 is reported back as custom:<name>-0. Match the model by name, not by the numeric suffix.",
|
|
1219
|
+
"Under --auto low a command above the tier ends the run with exit 1 and the error Exec ended early: insufficient permission to proceed; nothing runs.",
|
|
1216
1220
|
"Unknown model, effort, permission or required step mappings block dispatch.",
|
|
1217
1221
|
"Native MCP/client, MSP/ACP, gateway and conversation capabilities do not establish worker authority.",
|
|
1218
1222
|
"--skip-permissions-unsafe is Ralph-loop legacy and never part of the direct profile.",
|
|
1219
1223
|
"The stream-json/json event vocabulary (assistant/user/tool_call/tool_result/hook/error/result) is doc-sourced (docs.factory.com), not help-verified; it never promotes qualification status beyond unqualified.",
|
|
1220
1224
|
"There is no -o/output-file flag on exec: the final is read from the captured stdout stream, never a separate file.",
|
|
1221
|
-
"FACTORY_API_KEY
|
|
1225
|
+
"Auth is the Factory account (FACTORY_API_KEY or keyring) or a BYOK customModels entry in ~/.factory/settings.json whose apiKey is an env reference; the launch env must carry that variable (OPENROUTER_API_KEY is allowlisted; a BYOK key under another name blocks with Custom model apiKey references the environment variable ... which is not set). HOME locates ~/.factory/settings.json."
|
|
1222
1226
|
],
|
|
1223
1227
|
"health": {
|
|
1224
1228
|
"version": 1,
|
|
@@ -1244,8 +1248,8 @@
|
|
|
1244
1248
|
{
|
|
1245
1249
|
"kind": "help",
|
|
1246
1250
|
"ref": "tools/ralph-external/lib/factory-adapter.mjs",
|
|
1247
|
-
"observedAt": "2026-
|
|
1248
|
-
"cliVersion": "0.
|
|
1251
|
+
"observedAt": "2026-11-06T00:00:00Z",
|
|
1252
|
+
"cliVersion": "1.0.0"
|
|
1249
1253
|
},
|
|
1250
1254
|
{
|
|
1251
1255
|
"kind": "documentation",
|
|
@@ -162,17 +162,17 @@
|
|
|
162
162
|
"factory": {
|
|
163
163
|
"roles": {
|
|
164
164
|
"reasoning": {
|
|
165
|
-
"id": "
|
|
165
|
+
"id": "claude-opus-5",
|
|
166
166
|
"status": "active",
|
|
167
167
|
"observed": false
|
|
168
168
|
},
|
|
169
169
|
"coding": {
|
|
170
|
-
"id": "
|
|
170
|
+
"id": "claude-sonnet-5",
|
|
171
171
|
"status": "active",
|
|
172
172
|
"observed": false
|
|
173
173
|
},
|
|
174
174
|
"efficiency": {
|
|
175
|
-
"id": "
|
|
175
|
+
"id": "claude-haiku-4-5-20251001",
|
|
176
176
|
"status": "active",
|
|
177
177
|
"observed": false
|
|
178
178
|
}
|
|
@@ -19,12 +19,13 @@
|
|
|
19
19
|
import path from 'node:path';
|
|
20
20
|
import { readFileSync } from 'node:fs';
|
|
21
21
|
import { fileURLToPath } from 'node:url';
|
|
22
|
-
import { GRAPH_CONFIGS,
|
|
23
|
-
import { resolveIndexWorkers } from './index-preparation.js';
|
|
22
|
+
import { GRAPH_CONFIGS, OPERATIONAL_SHOW_TYPES, isOperationalShowType, loadUserGraphConfigs, loadGlobalGraphConfigs, orderedGraphEntries, } from './types.js';
|
|
24
23
|
import { SUPPORTED_VIEWS } from './corpus-views/renderers.js';
|
|
25
24
|
import { parseResourceSelector, readVerifiedRegularFile, } from '../resources/web-release.js';
|
|
26
25
|
import { findPackageRoot } from '../cli/find-package-root.js';
|
|
27
26
|
import { createResourceCredentialProvider, prepareResourceCredentials } from '../auth/resource-credentials.js';
|
|
27
|
+
import { readDiscoverPhrase } from './query-engine-options.js';
|
|
28
|
+
import { printDiscoverUsage } from './discover-cli-help.js';
|
|
28
29
|
const MAX_RESOURCE_TRUST_ROOT_BYTES = 64 * 1024;
|
|
29
30
|
function webReleaseOptionsFromEnvironment(credentialProvider = createResourceCredentialProvider(process.env)) {
|
|
30
31
|
const baseUrl = process.env.AIWG_RESOURCE_BASE_URL;
|
|
@@ -534,6 +535,7 @@ async function handleBuild(args) {
|
|
|
534
535
|
console.log(' aiwg index sync --all');
|
|
535
536
|
return;
|
|
536
537
|
}
|
|
538
|
+
const { resolveIndexWorkers } = await import('./index-preparation.js');
|
|
537
539
|
let workers;
|
|
538
540
|
try {
|
|
539
541
|
workers = resolveIndexWorkers(parseFlagValue(args, '--index-workers', 'Error: --index-workers requires a value'));
|
|
@@ -1465,9 +1467,13 @@ const DISCOVER_VALUE_FLAGS = new Set([
|
|
|
1465
1467
|
* @implements #1214
|
|
1466
1468
|
*/
|
|
1467
1469
|
async function handleDiscover(args) {
|
|
1470
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
1471
|
+
printDiscoverUsage();
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1468
1474
|
const credentials = await prepareResourceCredentials(args);
|
|
1469
1475
|
args = credentials.args;
|
|
1470
|
-
const { discoverCapability } = await import('./query-engine.js');
|
|
1476
|
+
const { discoverCapability } = await import('./query-engine-discover.js');
|
|
1471
1477
|
const cwd = process.cwd();
|
|
1472
1478
|
// Parse the positional phrase. Flags may appear before or after it — the
|
|
1473
1479
|
// documented local-backend fallback is written flag-first
|
|
@@ -1489,18 +1495,10 @@ async function handleDiscover(args) {
|
|
|
1489
1495
|
index += 1;
|
|
1490
1496
|
}
|
|
1491
1497
|
}
|
|
1492
|
-
const phrase = textParts
|
|
1498
|
+
const phrase = await readDiscoverPhrase(textParts, flags);
|
|
1493
1499
|
if (!phrase) {
|
|
1494
1500
|
console.error('Error: aiwg index discover requires a search phrase');
|
|
1495
|
-
|
|
1496
|
-
console.log('Usage: aiwg index discover "<phrase>" [--type <kinds>] [--limit N] [--json|--format json|text] [--pretty|--compact] [--graph <name>] [--backend local|fortemi-core] [--resource-source local|web|auto] [--aiwg-version <version|range|digest|channel>] [--offline]');
|
|
1497
|
-
console.log('');
|
|
1498
|
-
console.log('Examples:');
|
|
1499
|
-
console.log(' aiwg index discover "create intake"');
|
|
1500
|
-
console.log(' aiwg index discover "deploy production" --limit 5');
|
|
1501
|
-
console.log(` aiwg index discover "audit security" --type ${OPERATIONAL_DISCOVERY_TYPES.join(',')}`);
|
|
1502
|
-
console.log(' aiwg index discover "intake" --format json --pretty');
|
|
1503
|
-
console.log(' aiwg discover "intake" --resource-source web --aiwg-version stable');
|
|
1501
|
+
printDiscoverUsage();
|
|
1504
1502
|
process.exit(1);
|
|
1505
1503
|
}
|
|
1506
1504
|
const typeValue = parseFlagValue(flags, '--type', 'Error: --type requires a value');
|
|
@@ -1542,6 +1540,8 @@ async function handleDiscover(args) {
|
|
|
1542
1540
|
offline,
|
|
1543
1541
|
webReleaseOptions,
|
|
1544
1542
|
includePaths: false,
|
|
1543
|
+
noBuild: flags.includes('--no-build'),
|
|
1544
|
+
verbose: flags.includes('--verbose') || flags.includes('--debug'),
|
|
1545
1545
|
});
|
|
1546
1546
|
}
|
|
1547
1547
|
/**
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Keep discover usage shared between top-level help and the index alias.
|
|
2
|
+
export function printDiscoverUsage() {
|
|
3
|
+
console.log(`Usage: aiwg discover [<phrase> | --stdin] [options]
|
|
4
|
+
aiwg index discover [<phrase> | --stdin] [options]
|
|
5
|
+
|
|
6
|
+
--stdin Read and trim the phrase from stdin; excludes positional text
|
|
7
|
+
--type <kinds> Filter comma-separated artifact types (e.g. skill,template)
|
|
8
|
+
--limit N Maximum results (default: 5)
|
|
9
|
+
--json Emit JSON (--format json|text also supported)
|
|
10
|
+
--pretty | --compact JSON formatting (default: pretty)
|
|
11
|
+
--graph <name> Search a specific graph
|
|
12
|
+
--backend local|fortemi-core
|
|
13
|
+
--resource-source local|web|auto
|
|
14
|
+
--aiwg-version <version|range|digest|channel>
|
|
15
|
+
--offline Require cached web resources
|
|
16
|
+
--no-build Read cached local metadata only
|
|
17
|
+
--verbose, --debug Show cache fallback diagnostics
|
|
18
|
+
--help, -h Show this help
|
|
19
|
+
|
|
20
|
+
Pass shell-sensitive requests with a quoted heredoc:
|
|
21
|
+
aiwg discover --stdin <<'AIWG_REQUEST'
|
|
22
|
+
<the request, verbatim>
|
|
23
|
+
AIWG_REQUEST`);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=discover-cli-help.js.map
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
*
|
|
31
31
|
* @implements #1623 (U3)
|
|
32
32
|
*/
|
|
33
|
+
import { SESSION_FACETS } from './discover-session-facets.js';
|
|
33
34
|
/**
|
|
34
35
|
* The curated facet table. Kept deliberately small and legible — it is a
|
|
35
36
|
* routing index, not a knowledge base. Guarded by the discover acceptance
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
* metadata-completeness lint (empty triggers cannot recur).
|
|
38
39
|
*/
|
|
39
40
|
export const DISCOVER_FACETS = [
|
|
41
|
+
...SESSION_FACETS,
|
|
40
42
|
{
|
|
41
43
|
facet: 'authoring-surface',
|
|
42
44
|
label: 'Expansion authoring (extension / addon / framework)',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const SESSION_FACETS = [
|
|
2
|
+
{
|
|
3
|
+
facet: 'feature-domain', label: 'Session checkpoint and handoff',
|
|
4
|
+
intents: ['resume conductor handoff', 'continue session handoff', 'write session handoff',
|
|
5
|
+
'create session handoff', 'resume interrupted work', 'handoff',
|
|
6
|
+
'hand off to a new session', 'split this session', 'prepare a handoff for a new session'],
|
|
7
|
+
capabilities: ['checkpoint'],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
facet: 'feature-domain', label: 'Repair failing tests',
|
|
11
|
+
intents: ['fix failing test', 'repair failing tests', 'fix flaky tests'],
|
|
12
|
+
capabilities: ['flaky-fix', 'executable-feedback'],
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
//# sourceMappingURL=discover-session-facets.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Bind prebuilt framework exports to their package/source identity and repair path.
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { frameworkSourceDigest } from './framework-source-digest.js';
|
|
5
|
+
import { inferInstallationMethod } from '../installation/manager.mjs';
|
|
6
|
+
export function prebuiltFrameworkFreshnessReason(root, manifest) {
|
|
7
|
+
try {
|
|
8
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
9
|
+
if (typeof manifest.package_version !== 'string' || manifest.package_version !== pkg.version) {
|
|
10
|
+
return `prebuilt package version '${manifest.package_version ?? 'missing'}' differs from current package version '${pkg.version}'`;
|
|
11
|
+
}
|
|
12
|
+
if (typeof manifest.source_digest !== 'string' || manifest.source_digest !== frameworkSourceDigest(root, false)) {
|
|
13
|
+
return 'prebuilt source digest differs from current framework sources (modified, added or removed source)';
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return `prebuilt source identity is unreadable: ${error instanceof Error ? error.message : String(error)}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function fortemiCorePrebuiltRepairHint(root) {
|
|
22
|
+
if (inferInstallationMethod(root) === 'source') {
|
|
23
|
+
const quotedRoot = `'${root.replaceAll("'", "'\\''")}'`;
|
|
24
|
+
return `run npm --prefix ${quotedRoot} run release:fortemi-index to rebuild this source checkout's framework index`;
|
|
25
|
+
}
|
|
26
|
+
return 'run "aiwg index sync --backend fortemi-core --graph framework" to rebuild the local framework cache';
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=fortemi-core-prebuilt-freshness.js.map
|
|
@@ -136,7 +136,7 @@ function readVerifiedRegularFile(pathname, expectedSize, expectedSha256, label)
|
|
|
136
136
|
fs.closeSync(fd);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
export function loadFortemiCoreExport(cwd, graph = "project", sourcePaths) {
|
|
139
|
+
export function loadFortemiCoreExport(cwd, graph = "project", sourcePaths, prebuiltSelection) {
|
|
140
140
|
if (sourcePaths) {
|
|
141
141
|
try {
|
|
142
142
|
const manifestBytes = readVerifiedRegularFile(sourcePaths.manifestPath, sourcePaths.manifestSize, sourcePaths.manifestSha256, "Verified Fortemi Core manifest");
|
|
@@ -173,7 +173,7 @@ export function loadFortemiCoreExport(cwd, graph = "project", sourcePaths) {
|
|
|
173
173
|
}
|
|
174
174
|
// A content-validated shipped corpus does not need the source metadata index.
|
|
175
175
|
// This also avoids preferring a much larger locally materialized text cache.
|
|
176
|
-
if (graph === 'framework' && selectPrebuiltRelations(cwd).reader) {
|
|
176
|
+
if (graph === 'framework' && (prebuiltSelection ?? selectPrebuiltRelations(cwd)).reader) {
|
|
177
177
|
const prebuilt = getFortemiCorePrebuiltStatus(graph, resolveFrameworkIndexRoot(cwd));
|
|
178
178
|
if (prebuilt.built && !prebuilt.stale) {
|
|
179
179
|
return { exported: JSON.parse(fs.readFileSync(prebuilt.exportPath, 'utf8')) };
|
|
@@ -289,8 +289,8 @@ function entryFromRecord(record) {
|
|
|
289
289
|
operationalState: record.operational_state,
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
-
export function loadFortemiCoreMetadataEntries(cwd, graph = "project", sourcePaths) {
|
|
293
|
-
const loaded = loadFortemiCoreExport(cwd, graph, sourcePaths);
|
|
292
|
+
export function loadFortemiCoreMetadataEntries(cwd, graph = "project", sourcePaths, prebuiltSelection) {
|
|
293
|
+
const loaded = loadFortemiCoreExport(cwd, graph, sourcePaths, prebuiltSelection);
|
|
294
294
|
if (!loaded.exported)
|
|
295
295
|
return {
|
|
296
296
|
entries: [],
|
|
@@ -7,6 +7,7 @@ import { GRAPH_CONFIGS, getProjectIndexRoot, loadGlobalGraphConfigs } from "./ty
|
|
|
7
7
|
import { buildAiwgFortemiIndexExport, } from "./browser-export.js";
|
|
8
8
|
import { loadGraphIndexFile, publishIndexFiles } from "./index-reader.js";
|
|
9
9
|
import { getFrameworkIndexBaseDir } from './framework-index-paths.js';
|
|
10
|
+
import { prebuiltFrameworkFreshnessReason } from './fortemi-core-prebuilt-freshness.js';
|
|
10
11
|
export function getFortemiCoreIndexDir(cwd, graph) {
|
|
11
12
|
loadGlobalGraphConfigs();
|
|
12
13
|
if (graph === 'framework')
|
|
@@ -387,6 +388,8 @@ export function getFortemiCorePrebuiltStatus(graph = "framework", packageRoot) {
|
|
|
387
388
|
else if (!Array.isArray(exported.items) || exported.items.length !== prebuiltManifest.item_count) {
|
|
388
389
|
reason = "prebuilt export item count does not match manifest";
|
|
389
390
|
}
|
|
391
|
+
if (!reason && graph === 'framework')
|
|
392
|
+
reason = prebuiltFrameworkFreshnessReason(path.resolve(dir, '../../..'), prebuiltManifest);
|
|
390
393
|
}
|
|
391
394
|
catch (err) {
|
|
392
395
|
reason = `prebuilt export file is unreadable: ${err instanceof Error ? err.message : String(err)}`;
|
|
@@ -6,6 +6,10 @@ import { frameworkSourceDigest } from './framework-source-digest.js';
|
|
|
6
6
|
import { acquireDirectoryLock, DirectoryLockContentionError } from './prebuilt-build-lock.js';
|
|
7
7
|
import { FRAMEWORK_CORPUS_KINDS as CORPUS_KINDS, resolveFrameworkCorpusRoot } from './framework-index-paths.js';
|
|
8
8
|
export { resolveFrameworkCorpusRoot } from './framework-index-paths.js';
|
|
9
|
+
/** Permission failures allow query callers to serve existing indexes without writes. */
|
|
10
|
+
export function isIndexWritePermissionError(error) {
|
|
11
|
+
return ['EROFS', 'EACCES', 'EPERM'].includes(error?.code ?? '');
|
|
12
|
+
}
|
|
9
13
|
function readText(file) {
|
|
10
14
|
try {
|
|
11
15
|
return fs.readFileSync(file, 'utf8');
|
|
@@ -36,7 +40,7 @@ function gitHead(root) {
|
|
|
36
40
|
* receipt avoids rereading unchanged source contents and detects uncommitted
|
|
37
41
|
* edits as well as manifest/package/HEAD changes.
|
|
38
42
|
*/
|
|
39
|
-
function sourceFingerprint(root) {
|
|
43
|
+
function sourceFingerprint(root, sourceDigest) {
|
|
40
44
|
const hash = createHash('sha256').update('framework-capabilities-v2');
|
|
41
45
|
hash.update(path.resolve(root));
|
|
42
46
|
try {
|
|
@@ -44,7 +48,7 @@ function sourceFingerprint(root) {
|
|
|
44
48
|
}
|
|
45
49
|
catch { /* fixture root */ }
|
|
46
50
|
hash.update(gitHead(root));
|
|
47
|
-
hash.update(frameworkSourceDigest(root));
|
|
51
|
+
hash.update(sourceDigest ?? frameworkSourceDigest(root));
|
|
48
52
|
for (const kind of CORPUS_KINDS) {
|
|
49
53
|
const dir = path.join(root, 'agentic/code', kind);
|
|
50
54
|
let entries;
|
|
@@ -98,7 +102,7 @@ export async function refreshFrameworkCapabilities(root, syncFortemi = true, opt
|
|
|
98
102
|
const fortemiSignature = () => [
|
|
99
103
|
'manifest.json', 'aiwg-fortemi-index-v2.json',
|
|
100
104
|
].map(file => fileSignature(path.join(fortemiDir, file))).join('|');
|
|
101
|
-
const source = sourceFingerprint(root);
|
|
105
|
+
const source = sourceFingerprint(root, options.sourceDigest);
|
|
102
106
|
const current = () => ({
|
|
103
107
|
source, index: fileSignature(metadataPath), relations: fileSignature(path.join(dir, 'relations.json')), ...(syncFortemi ? { fortemi: fortemiSignature() } : {}),
|
|
104
108
|
});
|
|
@@ -158,6 +162,10 @@ export async function isCorpusBundleInstalled(cwd, root, kind, id) {
|
|
|
158
162
|
const config = await readAiwgConfigCandidate(cwd);
|
|
159
163
|
if (!config)
|
|
160
164
|
return false;
|
|
165
|
+
// Every normal deployment includes aiwg-utils, even when only the requested
|
|
166
|
+
// framework is recorded. Standard skills are loaded from the source corpus.
|
|
167
|
+
if (kind === 'addon' && id === 'aiwg-utils' && Object.values(config.installed).some(entry => Object.values(entry.deployedTo ?? {}).some(deployment => deployment.skipUtils !== true)))
|
|
168
|
+
return true;
|
|
161
169
|
if (config.installed[id] || (kind === 'framework' && config.installed.all))
|
|
162
170
|
return true;
|
|
163
171
|
try {
|
|
@@ -3,7 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
5
|
import { BUILTIN_GRAPH_CONFIGS, INDEX_EXTRACTOR_VERSION, getGraphIndexDir } from './types.js';
|
|
6
|
-
export const FRAMEWORK_RELATIONS_REVISION =
|
|
6
|
+
export const FRAMEWORK_RELATIONS_REVISION = 4;
|
|
7
7
|
const REVISION = FRAMEWORK_RELATIONS_REVISION;
|
|
8
8
|
const sha256 = (value) => createHash('sha256').update(value).digest('hex');
|
|
9
9
|
/** No absolute paths, git revision or mtimes enter the portable digest. */
|