@aaac/runtime 0.1.55 → 0.2.1
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/README.md +6 -11
- package/dist/adapters/adk-sdk.d.ts +3 -3
- package/dist/adapters/adk-sdk.js +6 -8
- package/dist/adapters/adk-sdk.js.map +1 -1
- package/dist/adapters/claude-agent-sdk.d.ts +3 -3
- package/dist/adapters/claude-agent-sdk.js +22 -23
- package/dist/adapters/claude-agent-sdk.js.map +1 -1
- package/dist/adapters/mock.d.ts +2 -3
- package/dist/adapters/openai-agents-sdk.d.ts +3 -3
- package/dist/adapters/openai-agents-sdk.js +6 -5
- package/dist/adapters/openai-agents-sdk.js.map +1 -1
- package/dist/chunk-2INQL5TG.js +298 -0
- package/dist/chunk-2INQL5TG.js.map +1 -0
- package/dist/chunk-3CLWG72V.js +47 -0
- package/dist/chunk-3CLWG72V.js.map +1 -0
- package/dist/chunk-3DDB34BU.js +237 -0
- package/dist/chunk-3DDB34BU.js.map +1 -0
- package/dist/chunk-ABXDSTUV.js +685 -0
- package/dist/chunk-ABXDSTUV.js.map +1 -0
- package/dist/{chunk-3H3PVPPF.js → chunk-F5R46S7I.js} +151 -204
- package/dist/chunk-F5R46S7I.js.map +1 -0
- package/dist/chunk-FKAI54OM.js +234 -0
- package/dist/chunk-FKAI54OM.js.map +1 -0
- package/dist/chunk-KTVMMG33.js +1111 -0
- package/dist/chunk-KTVMMG33.js.map +1 -0
- package/dist/chunk-MSVIEEGR.js +269 -0
- package/dist/chunk-MSVIEEGR.js.map +1 -0
- package/dist/chunk-VJXGCWSZ.js +36 -0
- package/dist/chunk-VJXGCWSZ.js.map +1 -0
- package/dist/claude-bundles/full.js +311 -309
- package/dist/claude-bundles/lean.js +6 -6
- package/dist/claude-bundles/prompt.js +17 -0
- package/dist/generator/index.d.ts +2 -2
- package/dist/generator/index.js +8 -7
- package/dist/guardrail-hooks-CB23nhZV.d.ts +202 -0
- package/dist/hook-protocol-CFnNudiV.d.ts +96 -0
- package/dist/hooks-lite-CoWWnCRH.d.ts +428 -0
- package/dist/index-BlSepCSZ.d.ts +296 -0
- package/dist/index.d.ts +785 -105
- package/dist/index.js +2189 -634
- package/dist/index.js.map +1 -1
- package/dist/lib/claude-native/hooks-lite.d.ts +3 -26
- package/dist/lib/claude-native/hooks-lite.js +18 -36
- package/dist/lib/claude-native/hooks-prompt.d.ts +5 -0
- package/dist/lib/claude-native/hooks-prompt.js +33 -0
- package/dist/lib/claude-native/hooks-prompt.js.map +1 -0
- package/dist/lib/claude-native/index.d.ts +56 -214
- package/dist/lib/claude-native/index.js +79 -280
- package/dist/lib/claude-native/index.js.map +1 -1
- package/dist/{navigation-context-D_E1NIUf.d.ts → navigation-context-B-RpUg3_.d.ts} +1 -1
- package/dist/navigation-index-prompt-CbrS5laO.d.ts +43 -0
- package/dist/{task-runner-DfIEorkU.d.ts → task-runner-GWoI7_71.d.ts} +100 -493
- package/dist/workspace-user-prompt-submit-D11Iu0zO.d.ts +269 -0
- package/package.json +15 -6
- package/dist/chunk-3H3PVPPF.js.map +0 -1
- package/dist/chunk-DBM5XN67.js +0 -354
- package/dist/chunk-DBM5XN67.js.map +0 -1
- package/dist/chunk-KXGUWBGK.js +0 -370
- package/dist/chunk-KXGUWBGK.js.map +0 -1
- package/dist/chunk-LDCQZPDG.js +0 -11
- package/dist/chunk-LDCQZPDG.js.map +0 -1
- package/dist/chunk-N4KNGDYY.js +0 -1963
- package/dist/chunk-N4KNGDYY.js.map +0 -1
- package/dist/chunk-NMX4C6LC.js +0 -332
- package/dist/chunk-NMX4C6LC.js.map +0 -1
- package/dist/chunk-QVH5KKBR.js +0 -374
- package/dist/chunk-QVH5KKBR.js.map +0 -1
- package/dist/context-DKkamYX_.d.ts +0 -31
- package/dist/guardrail-hooks-slK-z0Dz.d.ts +0 -83
- package/dist/index-LqEvaRk-.d.ts +0 -299
- package/dist/workspace-pre-tool-use-C6nidc0q.d.ts +0 -333
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderNavigationIndexPrompt
|
|
3
|
+
} from "./chunk-3CLWG72V.js";
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_CACHE_KEY,
|
|
6
|
+
buildContextResponse,
|
|
7
|
+
listArtifacts,
|
|
8
|
+
readFreshNavigationBuild
|
|
9
|
+
} from "./chunk-3DDB34BU.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/claude-native/navigation-cache.ts
|
|
12
|
+
import { spawn } from "child_process";
|
|
13
|
+
var MAX_RENDERED_DIAGNOSTICS = 20;
|
|
14
|
+
function renderNavigationDiagnostics(diagnostics, label = "navigation-index") {
|
|
15
|
+
if (!diagnostics || diagnostics.length === 0) return void 0;
|
|
16
|
+
const lines = diagnostics.slice(0, MAX_RENDERED_DIAGNOSTICS).map((d) => ` - [${d.severity}] ${d.path}: ${d.message}`);
|
|
17
|
+
const hidden = diagnostics.length - lines.length;
|
|
18
|
+
if (hidden > 0) {
|
|
19
|
+
lines.push(` - \u2026 ${hidden} more`);
|
|
20
|
+
}
|
|
21
|
+
return [`${label} diagnostics (${diagnostics.length}):`, ...lines].join("\n");
|
|
22
|
+
}
|
|
23
|
+
var ENSURE_BIN_TIMEOUT_MS = 3e4;
|
|
24
|
+
function isNavigationDiagnostic(value) {
|
|
25
|
+
if (typeof value !== "object" || value === null) return false;
|
|
26
|
+
const d = value;
|
|
27
|
+
return typeof d.path === "string" && typeof d.message === "string" && typeof d.severity === "string";
|
|
28
|
+
}
|
|
29
|
+
function hasReadableDiagnostics(obj) {
|
|
30
|
+
return obj.diagnostics === void 0 || Array.isArray(obj.diagnostics) && obj.diagnostics.every(isNavigationDiagnostic);
|
|
31
|
+
}
|
|
32
|
+
function isEnsureBinMemberResult(value) {
|
|
33
|
+
if (typeof value !== "object" || value === null) return false;
|
|
34
|
+
const r = value;
|
|
35
|
+
return typeof r.member === "string" && typeof r.status === "string" && hasReadableDiagnostics(r);
|
|
36
|
+
}
|
|
37
|
+
function isEnsureBinOutput(value) {
|
|
38
|
+
if (typeof value !== "object" || value === null) return false;
|
|
39
|
+
const obj = value;
|
|
40
|
+
if (typeof obj.component !== "string") return false;
|
|
41
|
+
if (obj.results !== void 0) {
|
|
42
|
+
return Array.isArray(obj.results) && obj.results.every(isEnsureBinMemberResult);
|
|
43
|
+
}
|
|
44
|
+
return typeof obj.status === "string" && Array.isArray(obj.sources) && obj.sources.every((s) => typeof s === "string") && hasReadableDiagnostics(obj);
|
|
45
|
+
}
|
|
46
|
+
async function runEnsureNavigationIndexBin(binPath) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const child = spawn(process.execPath, [binPath], {
|
|
49
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
50
|
+
timeout: ENSURE_BIN_TIMEOUT_MS
|
|
51
|
+
});
|
|
52
|
+
let stdout = "";
|
|
53
|
+
let stderr = "";
|
|
54
|
+
child.stdout.setEncoding("utf8");
|
|
55
|
+
child.stderr.setEncoding("utf8");
|
|
56
|
+
child.stdout.on("data", (chunk) => stdout += chunk);
|
|
57
|
+
child.stderr.on("data", (chunk) => stderr += chunk);
|
|
58
|
+
child.on("error", (err) => reject(err));
|
|
59
|
+
child.on("close", (code) => {
|
|
60
|
+
if (code !== 0) {
|
|
61
|
+
reject(new Error(`ensure-navigation-index exited ${code}: ${stderr.trim()}`));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
let printed;
|
|
65
|
+
try {
|
|
66
|
+
printed = JSON.parse(stdout.trim());
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
resolve(isEnsureBinOutput(printed) ? printed : void 0);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function navigationIndexUnavailable(cacheKey) {
|
|
74
|
+
return new Error(
|
|
75
|
+
`navigation-index cache \`${cacheKey}\` is still unreadable after ensure-navigation-index reported success \u2014 the rebuild did not write it, or wrote it against a different source list. Run \`.claude/bin/ensure-navigation-index\` directly to see why.`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/lib/claude-native/user-prompt-submit.ts
|
|
80
|
+
function createUserPromptSubmitHandler(config) {
|
|
81
|
+
return async function handleUserPromptSubmit(input) {
|
|
82
|
+
const prompt = input.prompt ?? "";
|
|
83
|
+
const read = async () => (await readFreshNavigationBuild({ cacheDir: config.cacheDir }))?.navigationIndex;
|
|
84
|
+
let navigationIndex = await read();
|
|
85
|
+
let diagnostics;
|
|
86
|
+
if (!navigationIndex) {
|
|
87
|
+
const output = await runEnsureNavigationIndexBin(config.ensureBin);
|
|
88
|
+
if (output && "diagnostics" in output) {
|
|
89
|
+
diagnostics = renderNavigationDiagnostics(output.diagnostics);
|
|
90
|
+
}
|
|
91
|
+
navigationIndex = await read();
|
|
92
|
+
}
|
|
93
|
+
if (!navigationIndex) {
|
|
94
|
+
throw navigationIndexUnavailable(DEFAULT_CACHE_KEY);
|
|
95
|
+
}
|
|
96
|
+
const sections = [
|
|
97
|
+
// renderNavigationIndexPrompt already emits the "## Project Navigation
|
|
98
|
+
// Index" heading — don't duplicate it here.
|
|
99
|
+
renderNavigationIndexPrompt(navigationIndex),
|
|
100
|
+
"",
|
|
101
|
+
"> Use `analyzer.getContextMap` with candidate paths/artifacts from the index",
|
|
102
|
+
"> when you need structured dependency and read-target guidance."
|
|
103
|
+
];
|
|
104
|
+
const candidates = renderCandidateArtifacts(prompt, navigationIndex);
|
|
105
|
+
if (candidates) {
|
|
106
|
+
sections.push(candidates);
|
|
107
|
+
}
|
|
108
|
+
if (diagnostics) {
|
|
109
|
+
sections.push("", diagnostics);
|
|
110
|
+
}
|
|
111
|
+
return buildContextResponse("UserPromptSubmit", sections.join("\n"));
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function renderCandidateArtifacts(prompt, navigationIndex, heading = "## Candidate Artifacts (from prompt keywords)") {
|
|
115
|
+
const candidates = extractCandidateArtifacts(prompt, navigationIndex);
|
|
116
|
+
if (candidates.length === 0) return void 0;
|
|
117
|
+
const lines = candidates.map((c) => {
|
|
118
|
+
const props = c.artifact.properties ?? {};
|
|
119
|
+
const tags = [props.type, props.authority, props.manual_edit ? `edit:${props.manual_edit}` : ""].filter(Boolean).join(", ");
|
|
120
|
+
return `- ${c.artifactId} [${tags}]`;
|
|
121
|
+
});
|
|
122
|
+
return `${heading}
|
|
123
|
+
${lines.join("\n")}`;
|
|
124
|
+
}
|
|
125
|
+
function extractCandidateArtifacts(prompt, navigationIndex) {
|
|
126
|
+
if (!prompt.trim()) return [];
|
|
127
|
+
const artifacts = listArtifacts(navigationIndex);
|
|
128
|
+
const lowerPrompt = prompt.toLowerCase();
|
|
129
|
+
const matches = [];
|
|
130
|
+
const seen = /* @__PURE__ */ new Set();
|
|
131
|
+
for (const { id, artifact } of artifacts) {
|
|
132
|
+
if (lowerPrompt.includes(id.toLowerCase()) && !seen.has(id)) {
|
|
133
|
+
seen.add(id);
|
|
134
|
+
matches.push({ artifactId: id, artifact });
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
const patterns = artifact.files?.path_patterns ?? [];
|
|
138
|
+
for (const pattern of patterns) {
|
|
139
|
+
if (typeof pattern !== "string") continue;
|
|
140
|
+
const literal = pattern.replace(/[*?]/g, "").replace(/\{.*\}/g, "");
|
|
141
|
+
if (literal.length > 3 && lowerPrompt.includes(literal.toLowerCase()) && !seen.has(id)) {
|
|
142
|
+
seen.add(id);
|
|
143
|
+
matches.push({ artifactId: id, artifact });
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return matches;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/lib/claude-native/workspace-members.ts
|
|
152
|
+
function renderMemberSection({ member, result }) {
|
|
153
|
+
const summary = renderNavigationIndexPrompt(result.navigationIndex);
|
|
154
|
+
const cacheNote = result.fromCache ? "(loaded from cache)" : "(freshly built)";
|
|
155
|
+
const diagnostics = renderNavigationDiagnostics(
|
|
156
|
+
result.diagnostics,
|
|
157
|
+
`${member.name} navigation-index`
|
|
158
|
+
);
|
|
159
|
+
return `### Member: ${member.name} ${cacheNote}
|
|
160
|
+
${summary}` + (diagnostics ? `
|
|
161
|
+
|
|
162
|
+
${diagnostics}` : "");
|
|
163
|
+
}
|
|
164
|
+
async function readFreshMemberIndices(cacheDir, members) {
|
|
165
|
+
return Promise.all(
|
|
166
|
+
members.map(async (member) => ({
|
|
167
|
+
member,
|
|
168
|
+
navigationIndex: (await readFreshNavigationBuild({ cacheDir, cacheKey: member.cacheKey }))?.navigationIndex
|
|
169
|
+
}))
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/lib/claude-native/workspace-user-prompt-submit.ts
|
|
174
|
+
function createWorkspaceUserPromptSubmitHandler(config) {
|
|
175
|
+
return async function handleWorkspaceUserPromptSubmit(input) {
|
|
176
|
+
const prompt = input.prompt ?? "";
|
|
177
|
+
let read = await readFreshMemberIndices(config.cacheDir, config.members);
|
|
178
|
+
const rebuildDiagnostics = /* @__PURE__ */ new Map();
|
|
179
|
+
if (read.some((entry) => !entry.navigationIndex)) {
|
|
180
|
+
const output = await runEnsureNavigationIndexBin(config.ensureBin);
|
|
181
|
+
if (output && "results" in output) {
|
|
182
|
+
for (const result of output.results) {
|
|
183
|
+
if (result.diagnostics) rebuildDiagnostics.set(result.member, result.diagnostics);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
read = await readFreshMemberIndices(config.cacheDir, config.members);
|
|
187
|
+
}
|
|
188
|
+
const sections = [];
|
|
189
|
+
for (const entry of read) {
|
|
190
|
+
if (!entry.navigationIndex) {
|
|
191
|
+
throw navigationIndexUnavailable(entry.member.cacheKey);
|
|
192
|
+
}
|
|
193
|
+
sections.push(
|
|
194
|
+
renderMemberSection({
|
|
195
|
+
member: entry.member,
|
|
196
|
+
result: {
|
|
197
|
+
navigationIndex: entry.navigationIndex,
|
|
198
|
+
fromCache: true,
|
|
199
|
+
...rebuildDiagnostics.has(entry.member.name) ? { diagnostics: rebuildDiagnostics.get(entry.member.name) } : {}
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
);
|
|
203
|
+
const candidates = renderCandidateArtifacts(
|
|
204
|
+
prompt,
|
|
205
|
+
entry.navigationIndex,
|
|
206
|
+
`#### Candidate Artifacts in ${entry.member.name} (from prompt keywords)`
|
|
207
|
+
);
|
|
208
|
+
if (candidates) {
|
|
209
|
+
sections.push(candidates);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (sections.length === 0) {
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
215
|
+
const additionalContext = [
|
|
216
|
+
sections.join("\n\n"),
|
|
217
|
+
"",
|
|
218
|
+
"> Use `analyzer.getContextMap` with candidate paths/artifacts from a member's index",
|
|
219
|
+
"> when you need structured dependency and read-target guidance."
|
|
220
|
+
].join("\n");
|
|
221
|
+
return buildContextResponse("UserPromptSubmit", additionalContext);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export {
|
|
226
|
+
renderNavigationDiagnostics,
|
|
227
|
+
runEnsureNavigationIndexBin,
|
|
228
|
+
createUserPromptSubmitHandler,
|
|
229
|
+
renderCandidateArtifacts,
|
|
230
|
+
renderMemberSection,
|
|
231
|
+
readFreshMemberIndices,
|
|
232
|
+
createWorkspaceUserPromptSubmitHandler
|
|
233
|
+
};
|
|
234
|
+
//# sourceMappingURL=chunk-FKAI54OM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/claude-native/navigation-cache.ts","../src/lib/claude-native/user-prompt-submit.ts","../src/lib/claude-native/workspace-members.ts","../src/lib/claude-native/workspace-user-prompt-submit.ts"],"sourcesContent":["/**\n * Navigation-index cache: diagnostics rendering and escalation to the canonical\n * rebuild bin.\n *\n * Everything here is lean — `cache-store` + `node:child_process`, and NOT\n * `navigation-context`. That is the point: the interactive hooks must be able to\n * answer from a warm cache without loading the `agent-contracts` DSL loader\n * (~2.3MB of bundle, ~360ms), while still being correct when the cache is stale.\n *\n * The split of duties:\n * - deciding whether the cache is fresh → `navigation-freshness.ts`, a\n * separate module because the PreToolUse guard needs that answer and must\n * NOT be able to reach the `spawn` below (see that file's header)\n * - actually rebuilding → `ensure-navigation-index.ts`, and\n * from a lean process the `.claude/bin/ensure-navigation-index` bin that\n * wraps it. A lean hook never rebuilds in-process; it runs that bin. There\n * is exactly one rebuild implementation, reached two ways.\n */\n\nimport { spawn } from \"node:child_process\";\n\n/** One finding from a navigation-index build (artifact binding / schema). */\nexport interface NavigationDiagnostic {\n path: string;\n message: string;\n severity: string;\n}\n\n/**\n * How many diagnostics are spelled out before collapsing into a count. Sized to\n * show a whole artifact registry's binding findings (unbound + orphan) for a\n * typical project rather than truncating the picture the reader needs.\n */\nconst MAX_RENDERED_DIAGNOSTICS = 20;\n\n/**\n * Render build diagnostics as hook context lines. Returns undefined when there\n * is nothing to report, so callers can skip the section entirely.\n */\nexport function renderNavigationDiagnostics(\n diagnostics: NavigationDiagnostic[] | undefined,\n label = \"navigation-index\",\n): string | undefined {\n if (!diagnostics || diagnostics.length === 0) return undefined;\n\n const lines = diagnostics\n .slice(0, MAX_RENDERED_DIAGNOSTICS)\n .map((d) => ` - [${d.severity}] ${d.path}: ${d.message}`);\n const hidden = diagnostics.length - lines.length;\n if (hidden > 0) {\n lines.push(` - … ${hidden} more`);\n }\n\n return [`${label} diagnostics (${diagnostics.length}):`, ...lines].join(\"\\n\");\n}\n\n/**\n * Upper bound on a rebuild triggered from a hook. The rebuild loads the DSL\n * loader and walks the artifact registry — well under a second in practice — so\n * exceeding this means something is wrong, and a hook must report it rather than\n * hold up the user's prompt indefinitely. The kill produces a non-zero exit, so\n * a timed-out rebuild travels the same reporting path as any other failed one.\n */\nconst ENSURE_BIN_TIMEOUT_MS = 30_000;\n\n/**\n * What the SINGLE-COMPONENT `ensure-navigation-index` bin prints on success.\n *\n * Mirrors the emitter field for field (`buildEnsureNavigationIndexBin` in\n * @aaac/contracts claude-generator): `status`, `component` and `sources` are\n * written on every run, and `diagnostics` is spread in only when the build\n * produced findings — so that one field is optional and the rest are not.\n */\nexport interface EnsureBinComponentOutput {\n status: string;\n component: string;\n sources: string[];\n diagnostics?: NavigationDiagnostic[];\n}\n\n/** One member's line in the workspace bin's output. */\nexport interface EnsureBinMemberResult {\n member: string;\n status: string;\n diagnostics?: NavigationDiagnostic[];\n}\n\n/**\n * What the WORKSPACE `ensure-navigation-index` bin prints on success — one entry\n * per member, from `buildWorkspaceEnsureNavigationIndexBin` in the same emitter.\n */\nexport interface EnsureBinWorkspaceOutput {\n component: string;\n results: EnsureBinMemberResult[];\n}\n\n/**\n * A line printed by either bin. The union, not one shape with every field\n * optional: an all-optional shape models the emitters as looser than they are,\n * and a type that promises nothing leaves each consumer to invent its own `??`\n * — which is how both prompt hooks came to walk this line unguarded and answer\n * a malformed one with a `TypeError` instead of a prompt (#327).\n */\nexport type EnsureBinOutput = EnsureBinComponentOutput | EnsureBinWorkspaceOutput;\n\nfunction isNavigationDiagnostic(value: unknown): value is NavigationDiagnostic {\n if (typeof value !== \"object\" || value === null) return false;\n const d = value as Record<string, unknown>;\n return (\n typeof d.path === \"string\" &&\n typeof d.message === \"string\" &&\n typeof d.severity === \"string\"\n );\n}\n\n/** Absent is the emitter's \"nothing to report\"; present has to be readable. */\nfunction hasReadableDiagnostics(obj: Record<string, unknown>): boolean {\n return (\n obj.diagnostics === undefined ||\n (Array.isArray(obj.diagnostics) && obj.diagnostics.every(isNavigationDiagnostic))\n );\n}\n\nfunction isEnsureBinMemberResult(value: unknown): value is EnsureBinMemberResult {\n if (typeof value !== \"object\" || value === null) return false;\n const r = value as Record<string, unknown>;\n return (\n typeof r.member === \"string\" &&\n typeof r.status === \"string\" &&\n hasReadableDiagnostics(r)\n );\n}\n\n/**\n * The single gate between another process's stdout and the types above. What\n * passes may be walked without further guarding; what fails is not this bin's\n * output and none of it may be read as one.\n *\n * Every declared field is checked, including ones no caller reads today, because\n * the return type — not the set of fields somebody happens to dereference — is\n * what the predicate promises. `results` discriminates the two shapes: it is the\n * one field only the workspace bin writes.\n */\nfunction isEnsureBinOutput(value: unknown): value is EnsureBinOutput {\n if (typeof value !== \"object\" || value === null) return false;\n const obj = value as Record<string, unknown>;\n if (typeof obj.component !== \"string\") return false;\n if (obj.results !== undefined) {\n return Array.isArray(obj.results) && obj.results.every(isEnsureBinMemberResult);\n }\n return (\n typeof obj.status === \"string\" &&\n Array.isArray(obj.sources) &&\n obj.sources.every((s) => typeof s === \"string\") &&\n hasReadableDiagnostics(obj)\n );\n}\n\n/**\n * Run the project's own `ensure-navigation-index` bin to rebuild the cache.\n *\n * This is how a lean hook rebuilds: by invoking the canonical bin, not by\n * importing the builder. Two properties are load-bearing.\n *\n * `stdio` is fully piped. The bin writes a JSON line to ITS stdout, and the\n * calling hook writes its own hook-response JSON to the SAME stdout — inheriting\n * would interleave the two and corrupt the response Claude Code parses.\n *\n * A CHILD THAT COULD NOT REBUILD THROWS, it does not return a status. Every hook\n * bin wraps its `main()` in a catch that writes the message to stderr and exits\n * 1 — that is the single failure report in this harness, and it is exactly what\n * SessionStart already spends when the same DSL fails to load, because\n * SessionStart builds in-process and the builder throws. Handing the failure\n * back as an optional field instead made it droppable, and both callers dropped\n * it: the per-prompt hook answered `{}`, which is also its normal \"nothing to\n * inject\" response, so a broken DSL was reported by one hook and passed over in\n * silence by the other (#310). A non-zero exit is not blocking for either hook —\n * only exit 2 rejects a prompt, and neither of these hooks spends it.\n *\n * `undefined` is the OTHER answer, and it is not a failure: the child exited 0,\n * so the rebuild happened and the index is in the cache where every caller reads\n * it from. All that is missing is the line describing the rebuild.\n */\nexport async function runEnsureNavigationIndexBin(\n binPath: string,\n): Promise<EnsureBinOutput | undefined> {\n return new Promise<EnsureBinOutput | undefined>((resolve, reject) => {\n const child = spawn(process.execPath, [binPath], {\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n timeout: ENSURE_BIN_TIMEOUT_MS,\n });\n\n let stdout = \"\";\n let stderr = \"\";\n child.stdout.setEncoding(\"utf8\");\n child.stderr.setEncoding(\"utf8\");\n child.stdout.on(\"data\", (chunk: string) => (stdout += chunk));\n child.stderr.on(\"data\", (chunk: string) => (stderr += chunk));\n\n child.on(\"error\", (err) => reject(err));\n child.on(\"close\", (code) => {\n if (code !== 0) {\n reject(new Error(`ensure-navigation-index exited ${code}: ${stderr.trim()}`));\n return;\n }\n // Rebuilt, but said something we cannot read — bytes that are not JSON,\n // or JSON that is not this bin's shape. One answer for both: no\n // diagnostics. The cache is still warm, so this is not a failure for the\n // caller; whether the rebuild actually landed is answered by re-reading\n // the cache, which every caller does anyway.\n let printed: unknown;\n try {\n printed = JSON.parse(stdout.trim());\n } catch {\n // Not JSON — the gate below gives it the same answer.\n }\n resolve(isEnsureBinOutput(printed) ? printed : undefined);\n });\n });\n}\n\n/**\n * The error a hook raises when the index it exists to inject is STILL not\n * readable after the canonical rebuild reported success.\n *\n * A rebuild that exits non-zero already throws above. This is the other half:\n * the bin claimed success, so nothing was reported, yet the cache entry the hook\n * needs is absent or stale — a swallowed cache write, a source file touched\n * mid-build, or a member the bin does not warm. Returning \"no context\" there is\n * indistinguishable from a project with nothing to say, which is what made the\n * per-prompt hook silent in the first place (#310). One message producer for\n * both prompt handlers, so the single-component and workspace hooks cannot\n * describe the same state differently.\n */\nexport function navigationIndexUnavailable(cacheKey: string): Error {\n return new Error(\n `navigation-index cache \\`${cacheKey}\\` is still unreadable after ` +\n `ensure-navigation-index reported success — the rebuild did not write it, ` +\n `or wrote it against a different source list. Run ` +\n `\\`.claude/bin/ensure-navigation-index\\` directly to see why.`,\n );\n}\n","/**\n * UserPromptSubmit Hook Handler — navigation-index summary injection.\n *\n * Executed after prompt submission, before Claude processes it. Provides a\n * compact navigation-index summary so the LLM can pick candidates and delegate\n * deep exploration to `analyzer.getContextMap` (Level 2).\n *\n * ContextPack is NOT pre-injected by default (#206 Phase D).\n *\n * Hot path: this fires on every prompt submission, so it stays on the lean\n * module graph — cache read plus, when stale, a child process running the\n * project's `ensure-navigation-index` bin. It never imports the DSL loader.\n */\n\nimport { renderNavigationIndexPrompt } from \"../navigation-index-prompt.js\";\nimport {\n navigationIndexUnavailable,\n renderNavigationDiagnostics,\n runEnsureNavigationIndexBin,\n} from \"./navigation-cache.js\";\nimport {\n readFreshNavigationBuild,\n DEFAULT_CACHE_KEY,\n} from \"./navigation-freshness.js\";\nimport {\n listArtifacts,\n} from \"./artifact-resolver.js\";\nimport {\n buildContextResponse,\n type HookOutput,\n type UserPromptSubmitInput,\n} from \"./hook-protocol.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface UserPromptSubmitHandlerConfig {\n /** Absolute path to .claude/cache/ directory. */\n cacheDir: string;\n /**\n * Absolute path to this project's `.claude/bin/ensure-navigation-index`.\n *\n * This handler is on the interactive hot path — it runs on EVERY prompt\n * submission — so it must not carry the DSL loader. It answers from the warm\n * cache and, when that cache is stale, runs the project's own\n * `ensure-navigation-index` bin as a child process to refresh it. That bin is\n * the single rebuild implementation; nothing is duplicated here.\n */\n ensureBin: string;\n}\n\n// ---------------------------------------------------------------------------\n// Handler\n// ---------------------------------------------------------------------------\n\n/**\n * Create a UserPromptSubmit hook handler.\n */\nexport function createUserPromptSubmitHandler(\n config: UserPromptSubmitHandlerConfig,\n) {\n return async function handleUserPromptSubmit(\n input: UserPromptSubmitInput,\n ): Promise<HookOutput> {\n const prompt = input.prompt ?? \"\";\n\n const read = async () =>\n (await readFreshNavigationBuild({ cacheDir: config.cacheDir }))?.navigationIndex;\n\n let navigationIndex = await read();\n let diagnostics: string | undefined;\n if (!navigationIndex) {\n // Stale or cold: refresh through the canonical bin, then read again. A bin\n // that could not run throws, and this hook's bin reports that on stderr\n // and exits 1 — the same answer SessionStart gives to the same DSL error.\n const output = await runEnsureNavigationIndexBin(config.ensureBin);\n // `config.ensureBin` is the single-component bin, which reports one\n // diagnostics list for the one index it builds. The workspace shape's\n // per-member lists belong to the handler that knows the members.\n if (output && \"diagnostics\" in output) {\n diagnostics = renderNavigationDiagnostics(output.diagnostics);\n }\n navigationIndex = await read();\n }\n\n if (!navigationIndex) {\n throw navigationIndexUnavailable(DEFAULT_CACHE_KEY);\n }\n\n const sections: string[] = [\n // renderNavigationIndexPrompt already emits the \"## Project Navigation\n // Index\" heading — don't duplicate it here.\n renderNavigationIndexPrompt(navigationIndex),\n \"\",\n \"> Use `analyzer.getContextMap` with candidate paths/artifacts from the index\",\n \"> when you need structured dependency and read-target guidance.\",\n ];\n\n const candidates = renderCandidateArtifacts(prompt, navigationIndex);\n if (candidates) {\n sections.push(candidates);\n }\n if (diagnostics) {\n sections.push(\"\", diagnostics);\n }\n\n return buildContextResponse(\"UserPromptSubmit\", sections.join(\"\\n\"));\n };\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\ninterface CandidateArtifact {\n artifactId: string;\n artifact: ReturnType<typeof listArtifacts>[number][\"artifact\"];\n}\n\n/**\n * Render the prompt-keyword candidate section, or undefined when nothing matched.\n * Shared with the workspace handler, which renders one section per member.\n */\nexport function renderCandidateArtifacts(\n prompt: string,\n navigationIndex: Record<string, unknown>,\n heading = \"## Candidate Artifacts (from prompt keywords)\",\n): string | undefined {\n const candidates = extractCandidateArtifacts(prompt, navigationIndex);\n if (candidates.length === 0) return undefined;\n\n const lines = candidates.map((c) => {\n const props = c.artifact.properties ?? {};\n const tags = [props.type, props.authority, props.manual_edit ? `edit:${props.manual_edit}` : \"\"]\n .filter(Boolean)\n .join(\", \");\n return `- ${c.artifactId} [${tags}]`;\n });\n return `${heading}\\n${lines.join(\"\\n\")}`;\n}\n\nfunction extractCandidateArtifacts(\n prompt: string,\n navigationIndex: Record<string, unknown>,\n): CandidateArtifact[] {\n if (!prompt.trim()) return [];\n\n const artifacts = listArtifacts(navigationIndex);\n const lowerPrompt = prompt.toLowerCase();\n const matches: CandidateArtifact[] = [];\n const seen = new Set<string>();\n\n for (const { id, artifact } of artifacts) {\n if (lowerPrompt.includes(id.toLowerCase()) && !seen.has(id)) {\n seen.add(id);\n matches.push({ artifactId: id, artifact });\n continue;\n }\n\n const patterns = artifact.files?.path_patterns ?? [];\n for (const pattern of patterns) {\n if (typeof pattern !== \"string\") continue;\n const literal = pattern.replace(/[*?]/g, \"\").replace(/\\{.*\\}/g, \"\");\n if (literal.length > 3 && lowerPrompt.includes(literal.toLowerCase()) && !seen.has(id)) {\n seen.add(id);\n matches.push({ artifactId: id, artifact });\n break;\n }\n }\n }\n\n return matches;\n}\n","/**\n * Workspace member navigation — the shared warm-up + rendering used by every\n * workspace hook that needs per-member navigation indices (SessionStart and\n * UserPromptSubmit). One member = one navigation-index cache entry.\n *\n * LEAN module: it reads and renders, never builds. The heavy per-member warm-up\n * (`ensureMemberIndices`) lives with its only caller, the SessionStart handler,\n * so that importing member rendering does not drag `navigation-context` and the\n * `agent-contracts` DSL loader into the per-interaction hooks. Only types are\n * taken from `ensure-navigation-index`, and type imports are erased at build.\n */\n\nimport { renderNavigationIndexPrompt } from \"../navigation-index-prompt.js\";\nimport type {\n EnsureNavigationIndexOptions,\n NavigationIndexResult,\n} from \"./ensure-navigation-index.js\";\nimport { renderNavigationDiagnostics } from \"./navigation-cache.js\";\nimport { readFreshNavigationBuild } from \"./navigation-freshness.js\";\n\n/**\n * What a member needs to be READ from cache and rendered. Deliberately without\n * `navigationOptions`: the per-interaction hooks never build, so requiring build\n * options there would force them to resolve — and therefore parse — the embedded\n * DSL they exist to avoid.\n */\nexport interface WorkspaceMemberCacheConfig {\n /** Human-readable member name (e.g. `\"aaac\"`). */\n name: string;\n /**\n * Unique cache key for this member's navigation-index JSON.\n * Format: `navigation-index.<name>`.\n */\n cacheKey: string;\n}\n\n/** A member the SessionStart warm-up can also BUILD. */\nexport interface WorkspaceMemberNavConfig extends WorkspaceMemberCacheConfig {\n /** Absolute path to member root directory. */\n root: string;\n /** Source files for mtime-based cache invalidation. */\n sourceFiles: string[];\n /** Options passed to `buildNavigationContext()` on cache miss. */\n navigationOptions: EnsureNavigationIndexOptions[\"navigationOptions\"];\n}\n\nexport interface WorkspaceMemberNavResult {\n member: WorkspaceMemberCacheConfig;\n result: NavigationIndexResult;\n}\n\n/** One member's context section: index summary + freshness + build diagnostics. */\nexport function renderMemberSection({ member, result }: WorkspaceMemberNavResult): string {\n const summary = renderNavigationIndexPrompt(result.navigationIndex);\n const cacheNote = result.fromCache ? \"(loaded from cache)\" : \"(freshly built)\";\n const diagnostics = renderNavigationDiagnostics(\n result.diagnostics,\n `${member.name} navigation-index`,\n );\n return (\n `### Member: ${member.name} ${cacheNote}\\n${summary}` +\n (diagnostics ? `\\n\\n${diagnostics}` : \"\")\n );\n}\n\n/**\n * Lean read of every member's cached index.\n *\n * Members whose cache is missing or stale come back as `undefined`, so the\n * caller can run the workspace `ensure-navigation-index` bin ONCE — it warms\n * every member — and read again, instead of rebuilding per member in-process.\n */\nexport async function readFreshMemberIndices(\n cacheDir: string,\n members: WorkspaceMemberCacheConfig[],\n): Promise<\n Array<{ member: WorkspaceMemberCacheConfig; navigationIndex?: Record<string, unknown> }>\n> {\n return Promise.all(\n members.map(async (member) => ({\n member,\n navigationIndex: (\n await readFreshNavigationBuild({ cacheDir, cacheKey: member.cacheKey })\n )?.navigationIndex,\n })),\n );\n}\n","/**\n * Workspace UserPromptSubmit Hook Handler — per-member navigation context.\n *\n * The workspace hook set previously emitted the SINGLE-component ContextPack bin\n * at the workspace root (#263): SessionStart and PreToolUse were member-aware\n * while prompt submission saw only the root manifest, so no member's artifacts\n * reached the prompt. This mirrors the SessionStart handler — one index per\n * member — and adds prompt-keyword candidates per member.\n *\n * Hot path: this fires on every prompt submission, so it stays lean — it reads\n * each member's cached index and, when any is stale, runs the workspace\n * `ensure-navigation-index` bin ONCE (that bin warms every member) before\n * reading again. It never imports the DSL loader.\n */\n\nimport {\n readFreshMemberIndices,\n renderMemberSection,\n type WorkspaceMemberCacheConfig,\n} from \"./workspace-members.js\";\nimport {\n navigationIndexUnavailable,\n runEnsureNavigationIndexBin,\n type NavigationDiagnostic,\n} from \"./navigation-cache.js\";\nimport { renderCandidateArtifacts } from \"./user-prompt-submit.js\";\nimport {\n buildContextResponse,\n type HookOutput,\n type UserPromptSubmitInput,\n} from \"./hook-protocol.js\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface WorkspaceUserPromptSubmitConfig {\n /** Absolute path to the shared `.claude/cache/` directory. */\n cacheDir: string;\n /** Workspace members whose indices feed the prompt context. */\n members: WorkspaceMemberCacheConfig[];\n /**\n * Absolute path to this workspace's `.claude/bin/ensure-navigation-index`,\n * the single rebuild implementation. Run at most once per invocation, however\n * many members are stale, because that bin warms all of them.\n */\n ensureBin: string;\n}\n\n// ---------------------------------------------------------------------------\n// Handler\n// ---------------------------------------------------------------------------\n\nexport function createWorkspaceUserPromptSubmitHandler(\n config: WorkspaceUserPromptSubmitConfig,\n) {\n return async function handleWorkspaceUserPromptSubmit(\n input: UserPromptSubmitInput,\n ): Promise<HookOutput> {\n const prompt = input.prompt ?? \"\";\n\n let read = await readFreshMemberIndices(config.cacheDir, config.members);\n // Per-member diagnostics from a rebuild, keyed by member name.\n const rebuildDiagnostics = new Map<string, NavigationDiagnostic[]>();\n if (read.some((entry) => !entry.navigationIndex)) {\n const output = await runEnsureNavigationIndexBin(config.ensureBin);\n // `config.ensureBin` is the workspace bin, so `results` is the shape it\n // prints; a member reports `diagnostics` only when its build found any.\n if (output && \"results\" in output) {\n for (const result of output.results) {\n if (result.diagnostics) rebuildDiagnostics.set(result.member, result.diagnostics);\n }\n }\n read = await readFreshMemberIndices(config.cacheDir, config.members);\n }\n\n const sections: string[] = [];\n for (const entry of read) {\n // A member the rebuild did not leave an index for is a build failure, and\n // dropping its section renders context that LOOKS complete — the member is\n // simply not there. The workspace SessionStart handler already fails the\n // whole hook when any member cannot be built (`ensureMemberIndices` is a\n // `Promise.all`), so this reports it the same way (#310).\n if (!entry.navigationIndex) {\n throw navigationIndexUnavailable(entry.member.cacheKey);\n }\n\n sections.push(\n renderMemberSection({\n member: entry.member,\n result: {\n navigationIndex: entry.navigationIndex,\n fromCache: true,\n ...(rebuildDiagnostics.has(entry.member.name)\n ? { diagnostics: rebuildDiagnostics.get(entry.member.name) }\n : {}),\n },\n }),\n );\n const candidates = renderCandidateArtifacts(\n prompt,\n entry.navigationIndex,\n `#### Candidate Artifacts in ${entry.member.name} (from prompt keywords)`,\n );\n if (candidates) {\n sections.push(candidates);\n }\n }\n\n // Every member that IS declared rendered a section above or threw, so this is\n // reachable only for a workspace that declares no members at all: nothing to\n // inject, which is what an empty response means.\n if (sections.length === 0) {\n return {};\n }\n\n const additionalContext = [\n sections.join(\"\\n\\n\"),\n \"\",\n \"> Use `analyzer.getContextMap` with candidate paths/artifacts from a member's index\",\n \"> when you need structured dependency and read-target guidance.\",\n ].join(\"\\n\");\n\n return buildContextResponse(\"UserPromptSubmit\", additionalContext);\n };\n}\n"],"mappings":";;;;;;;;;;;AAmBA,SAAS,aAAa;AActB,IAAM,2BAA2B;AAM1B,SAAS,4BACd,aACA,QAAQ,oBACY;AACpB,MAAI,CAAC,eAAe,YAAY,WAAW,EAAG,QAAO;AAErD,QAAM,QAAQ,YACX,MAAM,GAAG,wBAAwB,EACjC,IAAI,CAAC,MAAM,QAAQ,EAAE,QAAQ,KAAK,EAAE,IAAI,KAAK,EAAE,OAAO,EAAE;AAC3D,QAAM,SAAS,YAAY,SAAS,MAAM;AAC1C,MAAI,SAAS,GAAG;AACd,UAAM,KAAK,cAAS,MAAM,OAAO;AAAA,EACnC;AAEA,SAAO,CAAC,GAAG,KAAK,iBAAiB,YAAY,MAAM,MAAM,GAAG,KAAK,EAAE,KAAK,IAAI;AAC9E;AASA,IAAM,wBAAwB;AA0C9B,SAAS,uBAAuB,OAA+C;AAC7E,MAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;AACxD,QAAM,IAAI;A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