@aiwg/cli 2026.11.2 → 2026.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agentic/code/addons/aiwg-hooks/canonical/aiwg-prompt-discovery.yaml +3 -2
- package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +12 -9
- package/agentic/code/addons/aiwg-utils/rules/anti-laziness.md +2 -0
- package/agentic/code/addons/composition-engine/lib/runtime.mjs +5 -26
- package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +22 -0
- package/agentic/code/providers/capability-matrix.yaml +17 -20
- package/agentic/code/providers/model-capabilities.v1.json +17 -16
- package/dist/src/a2a/hitl-authorization.js +46 -0
- package/dist/src/a2a/hitl-driver.js +5 -5
- package/dist/src/artifacts/browser-export.js +2 -0
- package/dist/src/artifacts/framework-source-digest.js +1 -1
- package/dist/src/artifacts/index-builder.js +5 -25
- package/dist/src/artifacts/index-capability.js +24 -0
- package/dist/src/artifacts/query-engine-discover-output.js +8 -3
- package/dist/src/artifacts/query-engine-rules.js +27 -9
- package/dist/src/artifacts/query-engine-scoring.js +5 -5
- package/dist/src/artifacts/query-engine-show-card.js +5 -1
- package/dist/src/artifacts/query-engine-show-load.js +1 -1
- package/dist/src/artifacts/query-engine-show.js +3 -3
- package/dist/src/artifacts/query-engine-templates.js +10 -4
- package/dist/src/artifacts/query-engine-verbose.js +18 -4
- package/dist/src/artifacts/relations-builder.js +1 -0
- package/dist/src/artifacts/types.js +1 -1
- package/dist/src/cli/handlers/checkpoint-handoff.js +2 -1
- package/dist/src/cli/handlers/dataset.js +17 -0
- package/dist/src/cli/handlers/guided-setup.js +3 -1
- package/dist/src/cli/handlers/refresh-managed-deployment.js +17 -5
- package/dist/src/cli/handlers/rules.js +1 -1
- package/dist/src/cli/handlers/sessions.js +1 -1
- package/dist/src/cli/handlers/steward.js +1 -1
- package/dist/src/cli/handlers/use.js +18 -5
- package/dist/src/cli/handlers/utility-doctor.js +5 -2
- package/dist/src/cli/handlers/workspace.js +1 -1
- package/dist/src/cli/services/deployment-probe-scope.js +40 -0
- package/dist/src/cli/services/deployment-verification.js +5 -6
- package/dist/src/config/aiwg-config.js +6 -0
- package/dist/src/config/authorization-cli.js +61 -3
- package/dist/src/config/cli-help.js +1 -1
- package/dist/src/config/cli.js +4 -2
- package/dist/src/config/decision-config.js +2 -1
- package/dist/src/config/host-resource-runtime.mjs +1 -1
- package/dist/src/config/jev-credential-reference.js +56 -0
- package/dist/src/config/user-config.js +13 -19
- package/dist/src/config/user-registry.js +9 -1
- package/dist/src/config/worker-owner-lock.js +90 -10
- package/dist/src/decision/ask.js +3 -2
- package/dist/src/decision/graph-flow-adapter.js +1 -1
- package/dist/src/decision/jev-credentials.js +22 -0
- package/dist/src/decision/offload.js +1 -1
- package/dist/src/decision/openbao-kv-resolver.mjs +96 -0
- package/dist/src/decision/openbao-runtime.js +101 -0
- package/dist/src/effects/authorization-grant.js +50 -0
- package/dist/src/effects/authorization-store.js +130 -0
- package/dist/src/effects/index.js +2 -0
- package/dist/src/effects/ledger.js +1 -0
- package/dist/src/effects/lifecycle.js +1 -1
- package/dist/src/effects/reader.js +4 -0
- package/dist/src/effects/records.js +4 -0
- package/dist/src/effects/schema.js +2 -0
- package/dist/src/extensions/claude-hooks-installer.js +7 -7
- package/dist/src/extensions/muse-managed-hooks.js +11 -0
- package/dist/src/extensions/user-hook-diagnostics.js +32 -0
- package/dist/src/extensions/verified-hook-command.js +32 -0
- package/dist/src/lint/rule-conflicts.js +52 -0
- package/dist/src/lint/runner.js +3 -0
- package/dist/src/mcp/cli.mjs +3 -1
- package/dist/src/mcp/elicitation.mjs +30 -0
- package/dist/src/mcp/grok-build-config.mjs +1 -1
- package/dist/src/mcp/muse-native-config.mjs +1 -0
- package/dist/src/mcp/server.mjs +2 -0
- package/dist/src/mcp/tools/authorization.mjs +78 -0
- package/dist/src/models/model-capabilities.v1.json +17 -16
- package/dist/src/policy/authorization-capture.js +64 -0
- package/dist/src/policy/authorization-operations.js +108 -0
- package/dist/src/policy/hitl-check.js +3 -2
- package/dist/src/policy/hitl-consume.js +14 -0
- package/dist/src/policy/hitl-durable-store.js +60 -0
- package/dist/src/policy/hitl-durable.js +60 -0
- package/dist/src/policy/hitl-receipt.js +5 -0
- package/dist/src/policy/hitl.js +44 -6
- package/dist/src/process/bounded-child-process.mjs +49 -39
- package/dist/src/providers/capability-matrix.yaml +17 -20
- package/dist/src/providers/deployment-ownership.d.mts +1 -0
- package/dist/src/providers/deployment-ownership.mjs +21 -2
- package/dist/src/providers/grok-build-headless.js +170 -77
- package/dist/src/providers/grok-build-inspect.js +1 -0
- package/dist/src/providers/grok-build-paths.js +2 -0
- package/dist/src/providers/muse-paths.js +4 -2
- package/dist/src/providers/provider-context-contracts.js +12 -4
- package/dist/src/providers/provider-definition-schema.js +6 -0
- package/dist/src/providers/provider-seeds-1.js +3 -3
- package/dist/src/providers/provider-seeds-2.js +6 -4
- package/dist/src/providers/provider-seeds-3.js +6 -6
- package/dist/src/rules/activation.d.mts +2 -0
- package/dist/src/rules/activation.mjs +16 -7
- package/dist/src/rules/inline-budget.d.mts +2 -1
- package/dist/src/rules/inline-budget.mjs +4 -2
- package/dist/src/rules/inventory.js +3 -0
- package/dist/src/rules/precedence.d.mts +6 -0
- package/dist/src/rules/precedence.mjs +49 -0
- package/dist/src/rules/project-precedence.js +73 -0
- package/dist/src/rules/rule-frontmatter.schema.json +15 -0
- package/dist/src/serve/a2a-terminal-observer.js +12 -3
- package/dist/src/serve/mission-hitl.js +20 -1
- package/dist/src/sessions/adapters/grok-build-fallback.js +33 -0
- package/dist/src/sessions/adapters/grok-build-native-records.js +64 -0
- package/dist/src/sessions/adapters/grok-build-native.js +92 -100
- package/dist/src/sessions/adapters/grok-build.js +65 -24
- package/dist/src/sessions/grok-build-cli-output.js +113 -0
- package/dist/src/sessions/grok-build-cli.js +4 -28
- package/dist/src/smiths/context-pipeline/bridge-ownership.js +4 -3
- package/dist/src/smiths/context-pipeline/finalization.js +5 -0
- package/dist/src/smiths/context-pipeline/generator.js +1 -1
- package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +20 -17
- package/dist/src/smiths/context-pipeline/workspace-doctor.js +6 -1
- package/dist/src/smiths/context-pipeline/workspace-document.js +6 -0
- package/dist/src/smiths/context-pipeline/workspace-migration.js +2 -12
- package/dist/src/smiths/hook-bridge/codex-translator.js +11 -14
- package/dist/src/smiths/hook-bridge/codex-trust.js +7 -2
- package/dist/src/smiths/hook-bridge/copilot-translator.js +2 -1
- package/dist/src/smiths/hook-bridge/factory-trust.js +56 -0
- package/dist/src/smiths/hook-bridge/grok-build-translator.js +3 -1
- package/dist/src/smiths/hook-bridge/hermes-prompt-discovery.js +78 -0
- package/dist/src/smiths/hook-bridge/hermes-translator.js +5 -3
- package/dist/src/smiths/hook-bridge/index.js +3 -1
- package/dist/src/smiths/hook-bridge/prompt-discovery-gaps.js +3 -2
- package/package.json +7 -1
- package/tools/agents/deploy-agents.mjs +5 -6
- package/tools/agents/deploy-options.mjs +1 -0
- package/tools/agents/providers/base-frontmatter.mjs +3 -2
- package/tools/agents/providers/claude-post-deploy.mjs +1 -1
- package/tools/agents/providers/codex-post-deploy.mjs +1 -1
- package/tools/agents/providers/generic.mjs +66 -0
- package/tools/agents/providers/grok-build.mjs +3 -1
- package/tools/agents/providers/muse-hooks.mjs +13 -11
- package/tools/agents/providers/muse-prompt-discovery.mjs +5 -1
- package/tools/agents/providers/muse.mjs +2 -1
- package/tools/agents/providers/openclaw.mjs +2 -1
- package/tools/agents/providers/rule-deployment-prepare.mjs +5 -3
- package/tools/agents/providers/rule-deployment-state.mjs +14 -6
- package/tools/agents/providers/rule-startup.mjs +11 -10
- package/tools/agents/providers/staged-directory-reference.mjs +14 -0
- package/tools/agents/providers/user-hooks.mjs +26 -0
- package/tools/cli/authorization-health.mjs +20 -0
- package/tools/cli/decision-offload-report.mjs +2 -0
- package/tools/cli/workspace-status.mjs +7 -0
- package/tools/commands/deploy-prompts-codex.mjs +15 -1
- package/tools/plugin/package-plugins.mjs +6 -1
- package/tools/ralph-external/lib/claude-adapter.mjs +2 -2
- package/vscode-extension/schemas/aiwg.config.v1.json +20 -0
|
@@ -4,6 +4,7 @@ events: [UserPromptSubmit]
|
|
|
4
4
|
command: node
|
|
5
5
|
args: ['$AIWG_ROOT/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs']
|
|
6
6
|
timeout: 2
|
|
7
|
-
# These bridges
|
|
7
|
+
# These bridges cannot inject prompt context; their startup rules require discovery.
|
|
8
8
|
# Muse uses its project hook owner; Claude uses claude-hooks-installer.
|
|
9
|
-
|
|
9
|
+
# Hermes uses pre_llm_call shell hooks with a native {context} response.
|
|
10
|
+
degrade-on: [copilot, grok-build]
|
|
@@ -49,18 +49,18 @@ function contextFor(envelope, prompt) {
|
|
|
49
49
|
const prefix = 'AIWG candidates:\n';
|
|
50
50
|
const next = '\nFirst call: aiwg show <type> <name> (best fit) -> rules (--rules --with-rule-bodies; --body) -> apply.'
|
|
51
51
|
+ '\nIf none fit, run aiwg discover; never decline without it.';
|
|
52
|
-
|
|
52
|
+
let candidates = (Array.isArray(envelope?.results) ? envelope.results : [])
|
|
53
53
|
.filter(r => typeof r?.score === 'number' && Number.isFinite(r.score) && r.score >= 0.20
|
|
54
54
|
&& /^[a-z][a-z-]{0,19}$/.test(r.type) && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,69}$/.test(r.name))
|
|
55
55
|
.sort((a, b) => b.score - a.score).slice(0, 3);
|
|
56
|
-
const
|
|
56
|
+
const strong = candidates.filter(r => r.score >= 0.70);
|
|
57
|
+
const template = (strong.length ? strong : candidates).find(candidate => candidate.templates?.length)?.templates?.[0];
|
|
57
58
|
const templateHint = template && /^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,69}$/.test(template.name)
|
|
58
59
|
&& /^aiwg show template [a-zA-Z0-9][a-zA-Z0-9_.:-]{0,149}$/.test(template.show_command)
|
|
59
60
|
? `\nTemplate ${template.name}: ${template.show_command}` : '';
|
|
60
|
-
// 0.70 excludes
|
|
61
|
-
// only when at least one candidate supplies a stronger signal.
|
|
61
|
+
// 0.70 excludes weak hits; each displayed candidate must supply a strong signal.
|
|
62
62
|
// Muse UAT (2026-11-06): advisory wording was ignored; first-call wording was followed.
|
|
63
|
-
if (!
|
|
63
|
+
if (!strong.length) {
|
|
64
64
|
// Restrict by type only when the request asks for an AIWG component of that type, not when a
|
|
65
65
|
// type word merely appears ("removes every managed Claude hook" is not a hook search).
|
|
66
66
|
const namedType = prompt.match(/\b(?:aiwg|is there an?|are there any|find|list|which|what)\s+(?:aiwg\s+)?(decision-definition|decision-ruleset|decision-binding|gate-pack|skill|agent|command|rule|schema|flow|runbook|template|behavior|hook|workflow)s?\b/i)?.[1].toLowerCase();
|
|
@@ -72,6 +72,7 @@ function contextFor(envelope, prompt) {
|
|
|
72
72
|
while (instruction().length > 599 && need.length) need = need.slice(0, -1);
|
|
73
73
|
return instruction();
|
|
74
74
|
}
|
|
75
|
+
candidates = strong;
|
|
75
76
|
// Leave room for the template drill-in even when candidate names are long.
|
|
76
77
|
while (candidates.length > 1 && prefix.length + next.length + templateHint.length
|
|
77
78
|
+ candidates.map(r => `${r.type} ${r.name} (${r.score.toFixed(2).slice(0, 6)}): `).join('\n').length > 599) candidates.pop();
|
|
@@ -94,10 +95,12 @@ async function main() {
|
|
|
94
95
|
chunks.push(chunk);
|
|
95
96
|
}
|
|
96
97
|
const event = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
97
|
-
|
|
98
|
+
const hermes = event.hook_event_name === 'pre_llm_call';
|
|
99
|
+
if (event.hook_event_name && event.hook_event_name !== 'UserPromptSubmit' && !hermes) return finish();
|
|
98
100
|
if ([event.role, event.message?.role].some(role => role && role !== 'user')
|
|
99
101
|
|| /^(system|notification|tool[_-]result)$/.test(event.type || '')) return finish();
|
|
100
|
-
const
|
|
102
|
+
const text = hermes ? event.extra?.user_message : event.prompt;
|
|
103
|
+
const prompt = typeof text === 'string' ? text.trim() : '';
|
|
101
104
|
if (!shouldDiscover(prompt)) return finish();
|
|
102
105
|
const moduleUrl = runtimeModule();
|
|
103
106
|
if (!moduleUrl || Date.now() >= deadline) return finish();
|
|
@@ -119,12 +122,12 @@ async function main() {
|
|
|
119
122
|
})().catch(() => process.exit(0));
|
|
120
123
|
`, {
|
|
121
124
|
eval: true, stdout: true, stderr: true,
|
|
122
|
-
workerData: { moduleUrl, prompt, cwd: process.cwd() },
|
|
125
|
+
workerData: { moduleUrl, prompt, cwd: hermes && typeof event.cwd === 'string' ? event.cwd : process.cwd() },
|
|
123
126
|
});
|
|
124
127
|
worker.on('message', envelope => {
|
|
125
128
|
if (Date.now() >= deadline) return finish();
|
|
126
129
|
const context = contextFor(envelope, prompt);
|
|
127
|
-
if (context) process.stdout.write(JSON.stringify({
|
|
130
|
+
if (context) process.stdout.write(JSON.stringify(hermes ? { context } : {
|
|
128
131
|
hookSpecificOutput: { hookEventName: 'UserPromptSubmit', additionalContext: context },
|
|
129
132
|
}) + '\n', finish);
|
|
130
133
|
else finish();
|
|
@@ -6,6 +6,7 @@ import Ajv from 'ajv';
|
|
|
6
6
|
import Ajv2020 from 'ajv/dist/2020.js';
|
|
7
7
|
import addFormats from 'ajv-formats';
|
|
8
8
|
import { validateFlowGraph } from './validator.mjs';
|
|
9
|
+
import { createFlowAuthority } from './authority.mjs';
|
|
9
10
|
|
|
10
11
|
const RESOURCE_KEYS = ['activations', 'tokens', 'costUsd', 'timeMs'];
|
|
11
12
|
|
|
@@ -514,9 +515,6 @@ export async function executeFlowGraph(manifest, options = {}) {
|
|
|
514
515
|
const graphId = validation.normalized.identity.graphId;
|
|
515
516
|
const runId = options.runId ?? `${graphId}:run`;
|
|
516
517
|
const evaluatePredicate = options.evaluatePredicate ?? defaultPredicate;
|
|
517
|
-
const allowedCapabilities = new Set(options.allowedCapabilities ?? manifest.spec.capabilities.map((item) => item.id));
|
|
518
|
-
const allowedPermissions = new Set(options.allowedPermissions ?? manifest.spec.permissions);
|
|
519
|
-
const approvedGates = new Set(options.approvedGates ?? []);
|
|
520
518
|
const nodeOrder = new Map(manifest.spec.nodes.map((node, index) => [node.id, index]));
|
|
521
519
|
const nodes = new Map(manifest.spec.nodes.map((node) => [node.id, node]));
|
|
522
520
|
const stateFields = new Map(manifest.spec.state.fields.map((field) => [field.name, field]));
|
|
@@ -624,26 +622,7 @@ export async function executeFlowGraph(manifest, options = {}) {
|
|
|
624
622
|
}));
|
|
625
623
|
}
|
|
626
624
|
|
|
627
|
-
|
|
628
|
-
const missingCapability = node.capabilities.find((id) => !allowedCapabilities.has(id));
|
|
629
|
-
if (missingCapability) throw new FlowGraphRuntimeError('CAPABILITY_DENIED', `Node '${node.id}' is not authorized for capability '${missingCapability}'.`);
|
|
630
|
-
const missingPermission = node.permissions.find((id) => !allowedPermissions.has(id));
|
|
631
|
-
if (missingPermission) throw new FlowGraphRuntimeError('PERMISSION_DENIED', `Node '${node.id}' is not authorized for permission '${missingPermission}'.`);
|
|
632
|
-
if (node.kind === 'gate' && new Set(options.cancelledGates ?? []).has(node.id)) {
|
|
633
|
-
throw new FlowGraphRuntimeError('APPROVAL_CANCELLED', `Approval gate '${node.id}' was cancelled.`);
|
|
634
|
-
}
|
|
635
|
-
if (node.kind === 'gate' && !approvedGates.has(node.id)) {
|
|
636
|
-
throw new FlowGraphRuntimeError('APPROVAL_REQUIRED', `Gate '${node.id}' has not been approved.`);
|
|
637
|
-
}
|
|
638
|
-
if (node.sideEffectMode === 'approval-required') {
|
|
639
|
-
if (new Set(options.cancelledGates ?? []).has(node.approvalGate)) {
|
|
640
|
-
throw new FlowGraphRuntimeError('APPROVAL_CANCELLED', `Approval gate '${node.approvalGate}' was cancelled.`);
|
|
641
|
-
}
|
|
642
|
-
if (!approvedGates.has(node.approvalGate)) {
|
|
643
|
-
throw new FlowGraphRuntimeError('APPROVAL_REQUIRED', `Node '${node.id}' is waiting for approval gate '${node.approvalGate}'.`);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
}
|
|
625
|
+
const enforceAuthority = createFlowAuthority(manifest, options, evidence, FlowGraphRuntimeError);
|
|
647
626
|
|
|
648
627
|
function validateInputs(node, inputs) {
|
|
649
628
|
if (!managed) return assertNoWorkerValues(inputs);
|
|
@@ -706,7 +685,7 @@ export async function executeFlowGraph(manifest, options = {}) {
|
|
|
706
685
|
}
|
|
707
686
|
|
|
708
687
|
async function invoke(node, activationTick, iteration = 1) {
|
|
709
|
-
enforceAuthority(node);
|
|
688
|
+
await enforceAuthority(node);
|
|
710
689
|
const inputs = inputsFor(node);
|
|
711
690
|
validateInputs(node, inputs);
|
|
712
691
|
const inputSnapshot = clone(inputs);
|
|
@@ -997,8 +976,8 @@ export async function executeFlowGraph(manifest, options = {}) {
|
|
|
997
976
|
for (const node of nodesToRun) recordJoinEvidence(joinFor(node.id));
|
|
998
977
|
let settled;
|
|
999
978
|
if (parallelEligible && managed) {
|
|
979
|
+
for (const node of nodesToRun) await enforceAuthority(node);
|
|
1000
980
|
const requests = nodesToRun.map((node) => {
|
|
1001
|
-
enforceAuthority(node);
|
|
1002
981
|
const inputs = inputsFor(node);
|
|
1003
982
|
validateInputs(node, inputs);
|
|
1004
983
|
const requested = requestedResources(node);
|
|
@@ -1070,8 +1049,8 @@ export async function executeFlowGraph(manifest, options = {}) {
|
|
|
1070
1049
|
}
|
|
1071
1050
|
await persist();
|
|
1072
1051
|
} else if (parallelEligible) {
|
|
1052
|
+
for (const node of nodesToRun) await enforceAuthority(node);
|
|
1073
1053
|
const requests = nodesToRun.map((node) => {
|
|
1074
|
-
enforceAuthority(node);
|
|
1075
1054
|
const inputs = inputsFor(node);
|
|
1076
1055
|
validateInputs(node, inputs);
|
|
1077
1056
|
const nodeRunId = `${runId}:${node.id}:${tick}:${iteration}`;
|
|
@@ -170,9 +170,31 @@
|
|
|
170
170
|
"idempotencyKey": { "type": "string", "minLength": 1 },
|
|
171
171
|
"approvalGate": { "$ref": "#/definitions/id" },
|
|
172
172
|
"scope": { "$ref": "#/definitions/observationScope" },
|
|
173
|
+
"hitlAction": { "$ref": "#/definitions/hitlAction" },
|
|
173
174
|
"retry": { "$ref": "#/definitions/retryPolicy" },
|
|
174
175
|
"fallback": { "$ref": "#/definitions/fallbackPolicy" },
|
|
175
176
|
"ceilings": { "$ref": "#/definitions/ceilings" }
|
|
177
|
+
},
|
|
178
|
+
"allOf": [
|
|
179
|
+
{ "if": { "required": ["hitlAction"] }, "then": { "properties": { "kind": { "const": "gate" } } } }
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"hitlAction": {
|
|
183
|
+
"description": "Host-authored classification of the exact pending execution plan. Never populate from node inputs, worker output or model text; unknown effects retain human review.",
|
|
184
|
+
"type": "object",
|
|
185
|
+
"required": ["category", "repo", "environment", "resources", "reversible", "impact"],
|
|
186
|
+
"additionalProperties": false,
|
|
187
|
+
"properties": {
|
|
188
|
+
"category": { "type": "string", "minLength": 1 },
|
|
189
|
+
"repo": { "type": "string", "minLength": 1 },
|
|
190
|
+
"target": { "type": "string", "minLength": 1 },
|
|
191
|
+
"environment": { "type": "string", "minLength": 1 },
|
|
192
|
+
"resources": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "minLength": 1 } },
|
|
193
|
+
"verb": { "type": "string", "minLength": 1 },
|
|
194
|
+
"reversible": { "type": "boolean" },
|
|
195
|
+
"impact": { "enum": ["low", "medium", "high"] },
|
|
196
|
+
"actor": { "type": "string", "minLength": 1 },
|
|
197
|
+
"inputDigest": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" }
|
|
176
198
|
}
|
|
177
199
|
},
|
|
178
200
|
"inputBinding": {
|
|
@@ -26,10 +26,10 @@ providers:
|
|
|
26
26
|
probe_budget: { status: authorized, calls: 3, tokens: 30000, authorized_by: operator, authorized_at: "2026-10-07", hosts: [titan, noodle] }
|
|
27
27
|
coverage:
|
|
28
28
|
profile_issue: "roctinam/aiwg#2900"
|
|
29
|
-
source_date: "2026-
|
|
29
|
+
source_date: "2026-11-07"
|
|
30
30
|
live_qualified: false
|
|
31
31
|
sources:
|
|
32
|
-
- "host-help: claude 2.1.
|
|
32
|
+
- "host-help: claude 2.1.319 on titan (--version/--help/-p --help only)"
|
|
33
33
|
- "tools/ralph-external/lib/claude-adapter.mjs"
|
|
34
34
|
status: stable
|
|
35
35
|
daemon_tier: unsupported
|
|
@@ -549,7 +549,7 @@ providers:
|
|
|
549
549
|
scope: in
|
|
550
550
|
identity: runtime-configured-only
|
|
551
551
|
evidence: R
|
|
552
|
-
channel: "grok -p --output-format streaming-json; bounded parser
|
|
552
|
+
channel: "grok -p --output-format streaming-json; 1.0.77 adds --no-auto-update; bounded parser (model/effort pins unverified by captures)"
|
|
553
553
|
fanout: unknown
|
|
554
554
|
probe_budget: { status: authorized, calls: 3, tokens: 30000, authorized_by: operator, authorized_at: "2026-10-07", hosts: [titan, noodle] }
|
|
555
555
|
coverage:
|
|
@@ -560,35 +560,32 @@ providers:
|
|
|
560
560
|
- "src/providers/grok-build-headless.ts"
|
|
561
561
|
status: experimental
|
|
562
562
|
# xAI Grok Build CLI/TUI. Distinct from Grok Bot (`grokbot`).
|
|
563
|
-
# #2577:
|
|
564
|
-
#
|
|
565
|
-
# test/unit/providers/grok-build-
|
|
566
|
-
#
|
|
567
|
-
#
|
|
568
|
-
# and grok-build-acp.test.ts. ACP does not establish a daemon lifecycle.
|
|
569
|
-
# No fixture supports native cron, multi-agent teams, mission control,
|
|
570
|
-
# or AIWG behavior registration; those claims remain false.
|
|
563
|
+
# #2577: every claim and its limits are recorded in
|
|
564
|
+
# docs/providers/grok-build-native-agents.md (1.0.77 evidence table).
|
|
565
|
+
# Captured headless shapes: test/unit/providers/grok-build-headless.test.ts.
|
|
566
|
+
# Agent compilation, native fan-out/worktrees and ACP remain unverified by
|
|
567
|
+
# these captures; pre-existing synthetic tests establish AIWG behavior only.
|
|
571
568
|
daemon_tier: unsupported
|
|
572
569
|
daemon_pty_adapter: false
|
|
573
570
|
artifact_paths:
|
|
574
|
-
agents: .grok/agents/ #
|
|
571
|
+
agents: .grok/agents/ # writer path; native frontmatter unverified by captures
|
|
575
572
|
commands: null
|
|
576
573
|
skills: .grok/skills/
|
|
577
574
|
skills_cross_agent: .grok/.aiwg/skills/ # --copy-all opt-in mirror
|
|
578
575
|
rules: "Indexed: aiwg show rule + AGENTS.md / host .grok/rules (AIWG writer deferred #2577)"
|
|
579
576
|
behaviors: null
|
|
580
577
|
native_features:
|
|
581
|
-
cron: false
|
|
582
|
-
agent_teams: false
|
|
583
|
-
tasks:
|
|
584
|
-
mcp: true
|
|
585
|
-
behaviors: false
|
|
586
|
-
mission_control: false
|
|
587
|
-
daemon: false
|
|
578
|
+
cron: false # unverified: needs recurring-loop execution capture
|
|
579
|
+
agent_teams: false # unverified: needs team lifecycle capture
|
|
580
|
+
tasks: false # unverified: headless tool calls do not prove background task lifecycle
|
|
581
|
+
mcp: true # fixture-backed config only: grok-build-native-integration.test.ts; live MCP unverified
|
|
582
|
+
behaviors: false # unverified: needs behavior registration/execution capture
|
|
583
|
+
mission_control: false # unverified: needs mission lifecycle capture
|
|
584
|
+
daemon: false # unverified: ACP is separate and needs agent-stdio capture
|
|
588
585
|
emulation:
|
|
589
586
|
cron: null
|
|
590
587
|
agent_teams: aiwg-mc
|
|
591
|
-
tasks:
|
|
588
|
+
tasks: aiwg-mc
|
|
592
589
|
mcp: null
|
|
593
590
|
behaviors: aiwg-mc
|
|
594
591
|
mission_control: aiwg-mc
|
|
@@ -256,7 +256,7 @@
|
|
|
256
256
|
"id": "claude-direct",
|
|
257
257
|
"provider": "claude",
|
|
258
258
|
"adapterVersion": "1",
|
|
259
|
-
"supportedVersions": "2.1.295",
|
|
259
|
+
"supportedVersions": ">=2.1.295 <2.2.0",
|
|
260
260
|
"runtimeDriver": "installed:claude",
|
|
261
261
|
"catalogAdapter": {
|
|
262
262
|
"kind": "file",
|
|
@@ -329,67 +329,67 @@
|
|
|
329
329
|
"invocationProfiles": {
|
|
330
330
|
"direct-shell": {
|
|
331
331
|
"transport": "shell",
|
|
332
|
-
"supportedVersions": "2.1.295",
|
|
332
|
+
"supportedVersions": ">=2.1.295 <2.2.0",
|
|
333
333
|
"controls": {
|
|
334
334
|
"model": {
|
|
335
335
|
"support": "unqualified",
|
|
336
336
|
"mapping": "--model ${model}; moving aliases denied",
|
|
337
|
-
"evidence": "H: claude 2.1.
|
|
337
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --model <model> Model for the current session. Provide; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
338
338
|
},
|
|
339
339
|
"effort": {
|
|
340
340
|
"support": "unqualified",
|
|
341
341
|
"mapping": "--effort ${effort}; explicit low/medium/high/xhigh/max",
|
|
342
|
-
"evidence": "H: claude 2.1.
|
|
342
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --effort <level> Effort level for the current session (low, medium, high, xhigh, max); full verbatim excerpts: docs/providers/claude-direct.md"
|
|
343
343
|
},
|
|
344
344
|
"sandbox": {
|
|
345
345
|
"support": "unqualified",
|
|
346
346
|
"mapping": "partial: --restricted confines whitelisted file tools, scoped by --tools/--allowedTools (workspace-write: Read,Glob,Grep,Edit,Write; read-only: Read,Glob,Grep); OS sandbox unavailable in CLI, external boundary required",
|
|
347
|
-
"evidence": "H: claude 2.1.
|
|
347
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --restricted Restricted mode: removes the built-in tools that run commands or code; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
348
348
|
},
|
|
349
349
|
"approval": {
|
|
350
350
|
"support": "unqualified",
|
|
351
351
|
"mapping": "--permission-mode dontAsk --permission-prompts none; prompting and bypass modes denied",
|
|
352
|
-
"evidence": "H: claude 2.1.
|
|
352
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --permission-prompts <target> Who answers permission prompts with --print: \"host\" (the SDK host or --permission-prompt-tool) or \"none\" (nobody: anything that would prompt is denied automatically; the permission mode still decides everything else); full verbatim excerpts: docs/providers/claude-direct.md"
|
|
353
353
|
},
|
|
354
354
|
"workdir": {
|
|
355
355
|
"support": "unqualified",
|
|
356
356
|
"mapping": "spawn cwd from conductor; no invented --cwd flag",
|
|
357
|
-
"evidence": "H: claude 2.1.
|
|
357
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); Usage: claude [options] [command] [prompt]; no workspace switch is emitted; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
358
358
|
},
|
|
359
359
|
"finalOutput": {
|
|
360
360
|
"support": "unqualified",
|
|
361
361
|
"mapping": "parse exactly one success result envelope from stdout; result JSON text or structured_output; exit-zero error fails",
|
|
362
|
-
"evidence": "H: claude 2.1.
|
|
362
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --output-format <format> Output format (only works with --print): \"text\" (default), \"json\" (single result), or \"stream-json\" (realtime streaming); full verbatim excerpts: docs/providers/claude-direct.md"
|
|
363
363
|
},
|
|
364
364
|
"stdin": {
|
|
365
365
|
"support": "unqualified",
|
|
366
366
|
"mapping": "--input-format text; brief-text on stdin through EOF; never prompt argv",
|
|
367
|
-
"evidence": "H: claude 2.1.
|
|
367
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --input-format <format> Input format (only works with --print): \"text\" (default), or \"stream-json\"; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
368
368
|
},
|
|
369
369
|
"structuredOutput": {
|
|
370
370
|
"support": "unqualified",
|
|
371
371
|
"mapping": "unavailable in current renderer: CLI --json-schema exists but schema input is not passed to this driver",
|
|
372
|
-
"evidence": "H: claude 2.1.
|
|
372
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --json-schema <schema> JSON Schema for structured output validation (only works with --print).; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
373
373
|
},
|
|
374
374
|
"stepCap": {
|
|
375
375
|
"support": "unqualified",
|
|
376
376
|
"mapping": "unavailable: --max-turns is not listed by installed help; never emitted",
|
|
377
|
-
"evidence": "H: claude 2.1.
|
|
377
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); No --max-turns line appears in claude 2.1.319 --help or -p --help; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
378
378
|
},
|
|
379
379
|
"trust": {
|
|
380
380
|
"support": "unqualified",
|
|
381
381
|
"mapping": "--print --safe-mode --restricted --setting-sources \"\" --strict-mcp-config --mcp-config {\"mcpServers\":{}}; inherited customization disabled",
|
|
382
|
-
"evidence": "H: claude 2.1.
|
|
382
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --safe-mode Start with all customizations (CLAUDE.md, skills, installed plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, keybindings, and more) disabled; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
383
383
|
},
|
|
384
384
|
"children": {
|
|
385
385
|
"support": "unqualified",
|
|
386
386
|
"mapping": "--tools/--allowedTools Read,Glob,Grep,Edit,Write (workspace-write) or Read,Glob,Grep (read-only) --disallowedTools Agent,Task,Bash,PowerShell,REPL,WebFetch; no child/command tool or external MCP",
|
|
387
|
-
"evidence": "H: claude 2.1.
|
|
387
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --tools <tools...> Specify the list of available tools from the built-in set.; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
388
388
|
},
|
|
389
389
|
"fallback": {
|
|
390
390
|
"support": "unqualified",
|
|
391
391
|
"mapping": "exact model; --safe-mode; never emit --fallback-model; model substitutions do not qualify the profile",
|
|
392
|
-
"evidence": "H: claude 2.1.
|
|
392
|
+
"evidence": "H: claude 2.1.319 --help and -p --help (2026-11-07); --fallback-model <model> Enable automatic fallback to specified model(s) when the default model is overloaded or not available.; full verbatim excerpts: docs/providers/claude-direct.md"
|
|
393
393
|
}
|
|
394
394
|
},
|
|
395
395
|
"envAllowlist": [
|
|
@@ -403,6 +403,7 @@
|
|
|
403
403
|
"Final output is the captured .stdout JSONL stream, not a CLI-created finalPath file. Normalize with ClaudeAdapter.parseWorkerFinal before verification.",
|
|
404
404
|
"Unavailable: renderer schema input, help-evidenced turn cap, native MCP reasoning worker. claude mcp serve exposes only debug/help/verbose and is a code-tools server.",
|
|
405
405
|
"Commands, Agent/Task, inherited MCP, hooks, plugins and skills are disabled in this restricted file-tools profile.",
|
|
406
|
+
"Version policy: >=2.1.295 <2.2.0 preserves the earlier help-verified baseline and accepts compatible 2.1 patch updates; 2.1.319 help was rechecked on titan on 2026-11-07. Range/resolver tests cover 2.1.317 and 2.1.319 synthetically, not live inference. Older versions, prereleases and 2.2+ remain blocked.",
|
|
406
407
|
"Bare mode is not used: installed help states it changes auth to API-key-only. No account or credential files were inspected."
|
|
407
408
|
],
|
|
408
409
|
"health": {
|
|
@@ -429,8 +430,8 @@
|
|
|
429
430
|
{
|
|
430
431
|
"kind": "help",
|
|
431
432
|
"ref": "docs/providers/claude-direct.md",
|
|
432
|
-
"observedAt": "2026-
|
|
433
|
-
"cliVersion": "2.1.
|
|
433
|
+
"observedAt": "2026-11-08T01:49:23Z",
|
|
434
|
+
"cliVersion": "2.1.319"
|
|
434
435
|
},
|
|
435
436
|
{
|
|
436
437
|
"kind": "repository",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Resolves host-bound prompt actions without deriving authority from executor text or schemas.
|
|
2
|
+
import Ajv from 'ajv';
|
|
3
|
+
export async function lookupPromptAuthorization(opts) {
|
|
4
|
+
try {
|
|
5
|
+
const { checkHitlAuthorization } = await import('../policy/hitl-check.js');
|
|
6
|
+
const { hitlDigest } = await import('../policy/hitl.js');
|
|
7
|
+
const envelope = structuredClone(opts.envelope);
|
|
8
|
+
const supplied = opts.authorization?.bindings.get(envelope.prompt_id);
|
|
9
|
+
const binding = supplied && structuredClone(supplied);
|
|
10
|
+
let eligible = binding && binding.taskId === opts.taskId && binding.contextId === opts.contextId
|
|
11
|
+
&& binding.promptId === envelope.prompt_id && binding.promptDigest === hitlDigest(envelope)
|
|
12
|
+
&& (!envelope.allowed_responders || envelope.allowed_responders.includes('any'))
|
|
13
|
+
&& (!envelope.deadline || Date.parse(envelope.deadline) > Date.now());
|
|
14
|
+
if (eligible) {
|
|
15
|
+
try {
|
|
16
|
+
const validate = new Ajv({ strict: true }).compile(envelope.response_schema);
|
|
17
|
+
eligible = !('$async' in validate && validate.$async === true) && !!validate(binding.response);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
eligible = false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// No host classification means unknown effects. Still consult the resolver,
|
|
24
|
+
// which retains review rather than treating prompt text as a safe action.
|
|
25
|
+
const checked = await checkHitlAuthorization(opts.authorization?.projectDir ?? process.cwd(), eligible ? binding.action : null);
|
|
26
|
+
if (!eligible || checked.decision !== 'auto-authorized' || !checked.receipt?.file || !checked.receipt.effectId)
|
|
27
|
+
return;
|
|
28
|
+
if (envelope.deadline && Date.parse(envelope.deadline) <= Date.now())
|
|
29
|
+
return;
|
|
30
|
+
return { response: binding.response, authorization: { receipt: checked.receipt,
|
|
31
|
+
provenance: checked.provenance, ...(checked.authorizationGrant ? { authorizationGrant: checked.authorizationGrant } : {}) } };
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return; // Lookup failures retain the existing human collection path.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export async function collectAuthorizedHitlResponse(opts, signal) {
|
|
38
|
+
const authorized = signal.aborted ? undefined : await lookupPromptAuthorization(opts);
|
|
39
|
+
if (authorized && !signal.aborted)
|
|
40
|
+
return authorized;
|
|
41
|
+
return { response: await opts.adapter.collect(opts.envelope, {
|
|
42
|
+
...(opts.taskId !== undefined ? { taskId: opts.taskId } : {}),
|
|
43
|
+
...(opts.contextId !== undefined ? { contextId: opts.contextId } : {}), signal,
|
|
44
|
+
}), authorization: undefined };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=hitl-authorization.js.map
|
|
@@ -39,6 +39,7 @@ import { existsSync } from 'node:fs';
|
|
|
39
39
|
import { dirname, join, resolve as resolvePath } from 'node:path';
|
|
40
40
|
import { fileURLToPath } from 'node:url';
|
|
41
41
|
import { buildHitlResponseMessage, extractHitlEnvelope, validateResponseStructurally, } from './hitl.js';
|
|
42
|
+
import { collectAuthorizedHitlResponse } from './hitl-authorization.js';
|
|
42
43
|
import { digestDecisionContext } from '../audit/operator-decision.js';
|
|
43
44
|
/** Default audit log — writes to stderr as JSONL. Replace with a file/HTTP sink in production. */
|
|
44
45
|
export class StderrHitlAuditLog {
|
|
@@ -162,6 +163,7 @@ export async function driveHitlPromptsForTask(opts) {
|
|
|
162
163
|
const ctx = inferEventContext(event);
|
|
163
164
|
await driveOnePrompt({
|
|
164
165
|
envelope,
|
|
166
|
+
authorization: opts.authorization,
|
|
165
167
|
client: opts.client,
|
|
166
168
|
adapter: opts.adapter,
|
|
167
169
|
auditLog,
|
|
@@ -222,12 +224,9 @@ export async function driveOnePrompt(opts) {
|
|
|
222
224
|
try {
|
|
223
225
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
224
226
|
let response;
|
|
227
|
+
let authorization;
|
|
225
228
|
try {
|
|
226
|
-
response = await
|
|
227
|
-
...(opts.taskId !== undefined ? { taskId: opts.taskId } : {}),
|
|
228
|
-
...(opts.contextId !== undefined ? { contextId: opts.contextId } : {}),
|
|
229
|
-
signal: controller.signal,
|
|
230
|
-
});
|
|
229
|
+
({ response, authorization } = await collectAuthorizedHitlResponse(opts, controller.signal));
|
|
231
230
|
}
|
|
232
231
|
catch (err) {
|
|
233
232
|
if (controller.signal.aborted) {
|
|
@@ -312,6 +311,7 @@ export async function driveOnePrompt(opts) {
|
|
|
312
311
|
...(opts.taskId !== undefined ? { task_id: opts.taskId } : {}),
|
|
313
312
|
...(opts.contextId !== undefined ? { context_id: opts.contextId } : {}),
|
|
314
313
|
outcome: 'responded',
|
|
314
|
+
...(authorization ? { authorization } : {}),
|
|
315
315
|
response_digest: digestDecisionContext(response),
|
|
316
316
|
duration_ms: Date.now() - startedAt,
|
|
317
317
|
});
|
|
@@ -459,6 +459,8 @@ function recordForEntry(cwd, entry, graphName, dependencyGraph, privacy, schemaV
|
|
|
459
459
|
...(entry.activation ? { activation: entry.activation } : {}),
|
|
460
460
|
...(entry.bound_to ? { bound_to: entry.bound_to } : {}),
|
|
461
461
|
...(entry.ruleEnforcement ? { enforcement: entry.ruleEnforcement } : {}),
|
|
462
|
+
...(entry.rulePrecedence ? { precedence: entry.rulePrecedence } : {}),
|
|
463
|
+
...(entry.ruleOverridable === undefined ? {} : { overridable: entry.ruleOverridable }),
|
|
462
464
|
...(entry.rulePaths ? { paths: entry.rulePaths } : {}),
|
|
463
465
|
...(entry.governedPaths ? { aiwg_governed_paths: entry.governedPaths } : {}),
|
|
464
466
|
...(entry.ruleSummary !== undefined ? { summary: entry.ruleSummary } : {}),
|
|
@@ -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 = 5;
|
|
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. */
|
|
@@ -30,6 +30,8 @@ import { collectGraphIndexFiles, findArtifactFiles, indexPathFor } from './index
|
|
|
30
30
|
import { acquireDirectoryLock } from './prebuilt-build-lock.js';
|
|
31
31
|
import { graphIndexDigest, indexAdapterRegistry, recordIndexVerification } from './index-adapters.js';
|
|
32
32
|
import { loadMemoryRecord } from '../memory/maintenance-record.js';
|
|
33
|
+
import { extractCapability } from './index-capability.js';
|
|
34
|
+
export { extractCapability } from './index-capability.js';
|
|
33
35
|
import { extractTemplateReferences, isTemplateReference } from './template-references.js';
|
|
34
36
|
import { createDependencyResolver, extractFlowDependencies } from './index-dependencies.js';
|
|
35
37
|
function absoluteEntryPath(cwd, entryPath, graph) {
|
|
@@ -81,6 +83,8 @@ export function extractRuleBindings(data, body = '') {
|
|
|
81
83
|
const enforcement = typeof data.enforcement === 'string' ? data.enforcement
|
|
82
84
|
: body.match(/^\*\*Enforcement Level\*\*:\s*([A-Za-z]+)/m)?.[1];
|
|
83
85
|
return {
|
|
86
|
+
rulePrecedence: typeof data.precedence === 'string' ? data.precedence : 'medium',
|
|
87
|
+
ruleOverridable: typeof data.overridable === 'boolean' ? data.overridable : true,
|
|
84
88
|
...(enforcement ? { ruleEnforcement: enforcement.trim().toLowerCase() } : {}),
|
|
85
89
|
...(Array.isArray(data.paths) ? { rulePaths: data.paths.filter((value) => typeof value === 'string') } : {}),
|
|
86
90
|
...(typeof data.activation === 'string' ? { activation: data.activation } : {}),
|
|
@@ -559,30 +563,6 @@ export function extractTriggers(body, frontmatter) {
|
|
|
559
563
|
}
|
|
560
564
|
return [...new Set(phrases)];
|
|
561
565
|
}
|
|
562
|
-
/**
|
|
563
|
-
* Extract a capability summary for a skill/agent/command/rule.
|
|
564
|
-
*
|
|
565
|
-
* Prefers the frontmatter `description` field (used uniformly across
|
|
566
|
-
* AIWG SKILL.md / agent files). Falls back to the first non-heading
|
|
567
|
-
* paragraph of the body. Capped at 240 chars so the index stays
|
|
568
|
-
* token-tight when surfaced via `aiwg index discover`.
|
|
569
|
-
*
|
|
570
|
-
* @implements #1214
|
|
571
|
-
*/
|
|
572
|
-
export function extractCapability(data, body) {
|
|
573
|
-
if (typeof data.description === 'string' && data.description.trim().length > 0) {
|
|
574
|
-
return data.description.trim().slice(0, 240);
|
|
575
|
-
}
|
|
576
|
-
// Fallback: first non-empty paragraph that isn't a heading.
|
|
577
|
-
const stripped = body.replace(/^---\n[\s\S]*?\n---\n/, '');
|
|
578
|
-
for (const block of stripped.split(/\n\s*\n/)) {
|
|
579
|
-
const trimmed = block.trim();
|
|
580
|
-
if (!trimmed || trimmed.startsWith('#'))
|
|
581
|
-
continue;
|
|
582
|
-
return trimmed.replace(/\s+/g, ' ').slice(0, 240);
|
|
583
|
-
}
|
|
584
|
-
return undefined;
|
|
585
|
-
}
|
|
586
566
|
/**
|
|
587
567
|
* Extract a SkillScriptSpec from skill frontmatter (#1227).
|
|
588
568
|
*
|
|
@@ -923,7 +903,7 @@ function extractIndexArtifact(job, bindingOnly, warnings = []) {
|
|
|
923
903
|
// Declarative processes have no trigger phrases — they rely on their
|
|
924
904
|
// capability and structure-aware search terms.
|
|
925
905
|
const triggers = isDiscoverable && !flow ? extractTriggers(body, data) : undefined;
|
|
926
|
-
const capability = flow?.capability ?? decision?.capability ?? gatePack?.capability ?? schemaDoc?.capability ?? runbook?.capability ?? (isDiscoverable ? extractCapability(data, body) : undefined);
|
|
906
|
+
const capability = flow?.capability ?? decision?.capability ?? gatePack?.capability ?? schemaDoc?.capability ?? runbook?.capability ?? (isDiscoverable ? extractCapability(data, body, type === 'template' ? extractCanonicalName(data, relativePath) : undefined) : undefined);
|
|
927
907
|
const kind = flow?.kind ?? decision?.kind ?? gatePack?.kind ?? runbook?.kind;
|
|
928
908
|
const sourceType = runbook && physicalType !== 'runbook' ? physicalType : undefined;
|
|
929
909
|
const searchTerms = flow?.searchTerms ?? decision?.searchTerms ?? gatePack?.searchTerms ?? schemaDoc?.searchTerms ?? runbook?.searchTerms;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Derive discovery capabilities from usable prose, with safe title fallbacks for templates.
|
|
2
|
+
function usableText(value) {
|
|
3
|
+
if (typeof value !== 'string')
|
|
4
|
+
return undefined;
|
|
5
|
+
const text = value.trim();
|
|
6
|
+
if (!text || /\{\{[^}]*\}\}|^#/.test(text))
|
|
7
|
+
return undefined;
|
|
8
|
+
return text.replace(/\s+/g, ' ').slice(0, 240);
|
|
9
|
+
}
|
|
10
|
+
export function extractCapability(data, body, fallbackTitle) {
|
|
11
|
+
const description = usableText(data.description);
|
|
12
|
+
if (description)
|
|
13
|
+
return description;
|
|
14
|
+
const stripped = body.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n/, '');
|
|
15
|
+
for (const block of stripped.split(/\r?\n\s*\r?\n/)) {
|
|
16
|
+
const text = usableText(block);
|
|
17
|
+
if (text)
|
|
18
|
+
return text;
|
|
19
|
+
}
|
|
20
|
+
// Strip heading markers before considering a title; never surface a raw heading.
|
|
21
|
+
const heading = stripped.match(/^\s*#{1,6}\s+(.+?)(?:\s+#+)?\s*$/m)?.[1];
|
|
22
|
+
return usableText(data.title) ?? usableText(heading) ?? usableText(fallbackTitle);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index-capability.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { diagnoseFacetActivations } from './discover-facets.js';
|
|
4
4
|
import { buildRunHint, DISCOVER_TYPE_ORDER, discoveryIdForEntry, normalizeIndexedPath, scopeRank, showHintForDiscoverResult, } from './query-engine-entries.js';
|
|
5
|
-
import { boundRuleDescriptor, compoundGoverningRules, governingRuleFields, governingRuleStats, RULE_CHECK_OBLIGATION, statsText, } from './query-engine-rules.js';
|
|
5
|
+
import { ruleOrderingFields, boundRuleDescriptor, compoundGoverningRules, governingRuleFields, governingRuleStats, RULE_CHECK_OBLIGATION, statsText, } from './query-engine-rules.js';
|
|
6
6
|
import { tokenize } from './query-engine-scoring.js';
|
|
7
7
|
import { ensureRelations, loadRelations } from './relations.js';
|
|
8
8
|
import { templateRelationFields } from './query-engine-templates.js';
|
|
@@ -47,13 +47,14 @@ export async function emitDiscoverResults(context) {
|
|
|
47
47
|
const relations = resourceSource === 'local' && (!params.graph || params.graph === 'framework')
|
|
48
48
|
? prebuiltRelations ?? (readOnly ? loadRelations(cwd, cwd, false)
|
|
49
49
|
: await ensureRelations(cwd, cwd, { verbose: params.verbose, selection: prebuiltSelection, reconciled: frameworkReconciled })) : undefined;
|
|
50
|
+
const orderingFor = (entry) => ruleOrderingFields(cwd, aiwgRoot ?? cwd, entry, resourceSource === 'local' ? resolvePath(entry) : undefined);
|
|
50
51
|
const governing = scored.map(result => compoundGoverningRules(entries, result.entry, relations ?? undefined, params.phrase));
|
|
51
52
|
const responseRules = new Map();
|
|
52
53
|
for (const item of governing.flat()) {
|
|
53
54
|
const key = `${item.rule.type}:${item.rule.path}`, prior = responseRules.get(key);
|
|
54
55
|
responseRules.set(key, { rule: item.rule, applicability: [...new Set([...(prior?.applicability ?? []), ...item.applicability])] });
|
|
55
56
|
}
|
|
56
|
-
const responseFields = governingRuleFields([...responseRules.values()]);
|
|
57
|
+
const responseFields = governingRuleFields([...responseRules.values()], orderingFor);
|
|
57
58
|
const responseRuleStats = governingRuleStats([...responseRules.values()]);
|
|
58
59
|
const includePaths = params.includePaths ?? true;
|
|
59
60
|
const facetActivations = diagnoseFacetActivations(params.phrase);
|
|
@@ -121,10 +122,11 @@ export async function emitDiscoverResults(context) {
|
|
|
121
122
|
type: r.entry.type,
|
|
122
123
|
name: r.entry.name,
|
|
123
124
|
title: r.entry.title,
|
|
125
|
+
...orderingFor(r.entry),
|
|
124
126
|
...templateRelationFields(r.entry, ruleRelations, 3, includePaths),
|
|
125
127
|
score: Math.round(r.score * 100) / 100,
|
|
126
128
|
ranking: rankingDiagnostic(r.entry, r.score, r.facetDiagnostics),
|
|
127
|
-
...governingRuleFields(governing[resultIndex]),
|
|
129
|
+
...governingRuleFields(governing[resultIndex], orderingFor),
|
|
128
130
|
triggers: r.entry.triggers ?? [],
|
|
129
131
|
capability: r.entry.capability ?? r.entry.summary,
|
|
130
132
|
kernel: r.entry.kernel ?? false,
|
|
@@ -194,6 +196,9 @@ export async function emitDiscoverResults(context) {
|
|
|
194
196
|
const topTrigger = topTriggerMatch?.value ??
|
|
195
197
|
(r.entry.triggers && r.entry.triggers.length > 0 ? r.entry.triggers[0] : '');
|
|
196
198
|
console.log(`${i + 1}. ${r.entry.title}`);
|
|
199
|
+
const ordering = orderingFor(r.entry);
|
|
200
|
+
if ('precedence' in ordering)
|
|
201
|
+
console.log(` precedence: ${ordering.precedence} | overridable: ${ordering.overridable} | source: ${ordering.precedence_source} | project context: ${ordering.project_context}`);
|
|
197
202
|
console.log(` type: ${r.entry.type} score: ${score}${flags ? ` flags: ${flags}` : ''}`);
|
|
198
203
|
console.log(` ${includePaths ? 'path' : 'id'}: ${locator}`);
|
|
199
204
|
if (r.entry.name) {
|