@aaac/runtime 0.1.54 → 0.2.0
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 +2235 -659
- 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-CLc8iTzy.d.ts → task-runner-GWoI7_71.d.ts} +100 -478
- 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
|
@@ -1,26 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Cache-key helpers shared between the heavy navigation-index warm path
|
|
6
|
-
* (`ensure-navigation-index.ts`) and the lean PreToolUse hot path
|
|
7
|
-
* (`workspace-pre-tool-use.ts`).
|
|
8
|
-
*
|
|
9
|
-
* This module is intentionally dependency-free (no `navigation-context` /
|
|
10
|
-
* `agent-contracts` imports) so it is safe to include in the lean
|
|
11
|
-
* `hooks-lite` entry point without pulling the heavy DSL loader.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Cache-key suffix under which a member's DSL guardrail rules are persisted
|
|
15
|
-
* alongside its navigation-index (#238 / C5).
|
|
16
|
-
*
|
|
17
|
-
* The navigation-index cache stays byte-identical to previous versions; the
|
|
18
|
-
* guardrail rules live in a companion entry (e.g.
|
|
19
|
-
* `navigation-index.aaac.guardrails.json`) so the lean PreToolUse hook can
|
|
20
|
-
* read them without importing the heavy `agent-contracts` DSL loader.
|
|
21
|
-
*/
|
|
22
|
-
declare const GUARDRAIL_CACHE_SUFFIX = ".guardrails";
|
|
23
|
-
/** Companion cache key for a navigation-index cache key's guardrail rules. */
|
|
24
|
-
declare function guardrailCacheKey(navigationCacheKey: string): string;
|
|
25
|
-
|
|
26
|
-
export { GUARDRAIL_CACHE_SUFFIX, guardrailCacheKey };
|
|
1
|
+
export { a as HookEventName, b as HookInput, H as HookOutput, P as PermissionDecision, c as PreToolUseInput, S as SessionStartInput, U as UserPromptSubmitInput, f as buildContextResponse, e as emitHookOutput, r as readHookInput } from '../../hook-protocol-CFnNudiV.js';
|
|
2
|
+
export { A as ArtifactMatch, C as CacheEntry, a as CacheStore, b as CacheStoreOptions, D as DEFAULT_CACHE_KEY, d as FreshNavigationBuild, N as NavigationArtifact, P as PreToolUseHandlerConfig, W as WorkspaceFileSuggestionMember, f as WorkspaceMemberPreToolUseConfig, g as WorkspacePreToolUseConfig, j as createCacheStore, k as createPreToolUseHandler, l as createWorkspacePreToolUseHandler, o as handleFileSuggestion, p as handleWorkspaceFileSuggestion, q as isCachedRecord, s as listArtifacts, t as readFreshNavigationBuild } from '../../hooks-lite-CoWWnCRH.js';
|
|
3
|
+
import '../../guardrail-hooks-CB23nhZV.js';
|
|
@@ -1,51 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
TimeoutError,
|
|
3
|
-
buildAllowResponse,
|
|
4
|
-
buildContextResponse,
|
|
5
|
-
buildDenyResponse,
|
|
6
|
-
computeSourceHash,
|
|
7
|
-
createCacheStore,
|
|
8
|
-
createExclusiveLock,
|
|
9
2
|
createPreToolUseHandler,
|
|
10
3
|
createWorkspacePreToolUseHandler,
|
|
4
|
+
handleFileSuggestion,
|
|
5
|
+
handleWorkspaceFileSuggestion
|
|
6
|
+
} from "../../chunk-2INQL5TG.js";
|
|
7
|
+
import {
|
|
8
|
+
DEFAULT_CACHE_KEY,
|
|
9
|
+
buildContextResponse,
|
|
10
|
+
createCacheStore,
|
|
11
11
|
emitHookOutput,
|
|
12
|
-
|
|
12
|
+
isCachedRecord,
|
|
13
13
|
listArtifacts,
|
|
14
|
-
|
|
15
|
-
readHookInput
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
stripMemberPrefix,
|
|
19
|
-
withDegrade,
|
|
20
|
-
withTimeout
|
|
21
|
-
} from "../../chunk-QVH5KKBR.js";
|
|
22
|
-
import {
|
|
23
|
-
GUARDRAIL_CACHE_SUFFIX,
|
|
24
|
-
guardrailCacheKey
|
|
25
|
-
} from "../../chunk-LDCQZPDG.js";
|
|
26
|
-
import "../../chunk-NMX4C6LC.js";
|
|
14
|
+
readFreshNavigationBuild,
|
|
15
|
+
readHookInput
|
|
16
|
+
} from "../../chunk-3DDB34BU.js";
|
|
17
|
+
import "../../chunk-MSVIEEGR.js";
|
|
27
18
|
import "../../chunk-BJ7B4R26.js";
|
|
28
19
|
export {
|
|
29
|
-
|
|
30
|
-
TimeoutError,
|
|
31
|
-
buildAllowResponse,
|
|
20
|
+
DEFAULT_CACHE_KEY,
|
|
32
21
|
buildContextResponse,
|
|
33
|
-
buildDenyResponse,
|
|
34
|
-
computeSourceHash,
|
|
35
22
|
createCacheStore,
|
|
36
|
-
createExclusiveLock,
|
|
37
23
|
createPreToolUseHandler,
|
|
38
24
|
createWorkspacePreToolUseHandler,
|
|
39
25
|
emitHookOutput,
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
handleFileSuggestion,
|
|
27
|
+
handleWorkspaceFileSuggestion,
|
|
28
|
+
isCachedRecord,
|
|
42
29
|
listArtifacts,
|
|
43
|
-
|
|
44
|
-
readHookInput
|
|
45
|
-
resolvePathToArtifacts,
|
|
46
|
-
routePathToMember,
|
|
47
|
-
stripMemberPrefix,
|
|
48
|
-
withDegrade,
|
|
49
|
-
withTimeout
|
|
30
|
+
readFreshNavigationBuild,
|
|
31
|
+
readHookInput
|
|
50
32
|
};
|
|
51
33
|
//# sourceMappingURL=hooks-lite.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { H as HookOutput, U as UserPromptSubmitInput, e as emitHookOutput, r as readHookInput } from '../../hook-protocol-CFnNudiV.js';
|
|
2
|
+
export { E as EnsureBinOutput, N as NavigationDiagnostic, U as UserPromptSubmitHandlerConfig, W as WorkspaceMemberCacheConfig, a as WorkspaceMemberNavResult, b as WorkspaceUserPromptSubmitConfig, c as createUserPromptSubmitHandler, d as createWorkspaceUserPromptSubmitHandler, r as readFreshMemberIndices, e as renderCandidateArtifacts, f as renderMemberSection, g as renderNavigationDiagnostics, h as runEnsureNavigationIndexBin } from '../../workspace-user-prompt-submit-D11Iu0zO.js';
|
|
3
|
+
export { N as NavigationArtifactNode, i as isNavigationIndex, r as renderNavigationIndexPrompt } from '../../navigation-index-prompt-CbrS5laO.js';
|
|
4
|
+
import '../../navigation-context-B-RpUg3_.js';
|
|
5
|
+
import '../../guardrail-hooks-CB23nhZV.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createUserPromptSubmitHandler,
|
|
3
|
+
createWorkspaceUserPromptSubmitHandler,
|
|
4
|
+
readFreshMemberIndices,
|
|
5
|
+
renderCandidateArtifacts,
|
|
6
|
+
renderMemberSection,
|
|
7
|
+
renderNavigationDiagnostics,
|
|
8
|
+
runEnsureNavigationIndexBin
|
|
9
|
+
} from "../../chunk-FKAI54OM.js";
|
|
10
|
+
import {
|
|
11
|
+
isNavigationIndex,
|
|
12
|
+
renderNavigationIndexPrompt
|
|
13
|
+
} from "../../chunk-3CLWG72V.js";
|
|
14
|
+
import {
|
|
15
|
+
emitHookOutput,
|
|
16
|
+
readHookInput
|
|
17
|
+
} from "../../chunk-3DDB34BU.js";
|
|
18
|
+
import "../../chunk-MSVIEEGR.js";
|
|
19
|
+
import "../../chunk-BJ7B4R26.js";
|
|
20
|
+
export {
|
|
21
|
+
createUserPromptSubmitHandler,
|
|
22
|
+
createWorkspaceUserPromptSubmitHandler,
|
|
23
|
+
emitHookOutput,
|
|
24
|
+
isNavigationIndex,
|
|
25
|
+
readFreshMemberIndices,
|
|
26
|
+
readHookInput,
|
|
27
|
+
renderCandidateArtifacts,
|
|
28
|
+
renderMemberSection,
|
|
29
|
+
renderNavigationDiagnostics,
|
|
30
|
+
renderNavigationIndexPrompt,
|
|
31
|
+
runEnsureNavigationIndexBin
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=hooks-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,7 +1,42 @@
|
|
|
1
|
-
import { S as SessionStartInput,
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
import '../../
|
|
1
|
+
import { S as SessionStartInput, H as HookOutput } from '../../hook-protocol-CFnNudiV.js';
|
|
2
|
+
export { a as HookEventName, b as HookInput, P as PermissionDecision, c as PreToolUseInput, U as UserPromptSubmitInput, d as buildAllowResponse, f as buildContextResponse, g as buildDenyResponse, e as emitHookOutput, p as parseHookInput, r as readHookInput } from '../../hook-protocol-CFnNudiV.js';
|
|
3
|
+
export { A as ArtifactMatch, C as CacheEntry, a as CacheStore, b as CacheStoreOptions, D as DEFAULT_CACHE_KEY, F as FileSuggestionCandidate, c as FileSuggestionOptions, d as FreshNavigationBuild, N as NavigationArtifact, P as PreToolUseHandlerConfig, W as WorkspaceFileSuggestionMember, e as WorkspaceMember, f as WorkspaceMemberPreToolUseConfig, g as WorkspacePreToolUseConfig, h as computeCurrentHash, i as computeSourceHash, j as createCacheStore, k as createPreToolUseHandler, l as createWorkspacePreToolUseHandler, m as formatNdjson, n as generateCandidates, o as handleFileSuggestion, p as handleWorkspaceFileSuggestion, q as isCachedRecord, r as isProtectedArtifact, s as listArtifacts, t as readFreshNavigationBuild, u as resolvePathToArtifacts, v as routePathToMember, w as stripMemberPrefix } from '../../hooks-lite-CoWWnCRH.js';
|
|
4
|
+
import { N as NavigationContextOptions } from '../../navigation-context-B-RpUg3_.js';
|
|
5
|
+
import { i as EnsureNavigationIndexOptions, j as WorkspaceMemberNavConfig, a as WorkspaceMemberNavResult } from '../../workspace-user-prompt-submit-D11Iu0zO.js';
|
|
6
|
+
export { E as EnsureBinOutput, N as NavigationDiagnostic, k as NavigationIndexResult, U as UserPromptSubmitHandlerConfig, W as WorkspaceMemberCacheConfig, b as WorkspaceUserPromptSubmitConfig, c as createUserPromptSubmitHandler, d as createWorkspaceUserPromptSubmitHandler, l as ensureNavigationIndex, r as readFreshMemberIndices, f as renderMemberSection, g as renderNavigationDiagnostics, h as runEnsureNavigationIndexBin } from '../../workspace-user-prompt-submit-D11Iu0zO.js';
|
|
7
|
+
import '../../guardrail-hooks-CB23nhZV.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Latency utilities — timeout wrapper, graph build exclusion, degrade policy.
|
|
11
|
+
*
|
|
12
|
+
* Mirrors the Promise-sharing pattern from analyzer-bridge.ts for concurrent
|
|
13
|
+
* graph build exclusion.
|
|
14
|
+
*/
|
|
15
|
+
declare class TimeoutError extends Error {
|
|
16
|
+
constructor(ms: number);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Race a promise against a timeout. Resolves with the promise result or
|
|
20
|
+
* rejects with TimeoutError.
|
|
21
|
+
*/
|
|
22
|
+
declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T>;
|
|
23
|
+
/**
|
|
24
|
+
* Creates an exclusive async lock that ensures only one invocation runs at a
|
|
25
|
+
* time. Subsequent callers await the same Promise (analyzer-bridge pattern).
|
|
26
|
+
*/
|
|
27
|
+
declare function createExclusiveLock<T>(): {
|
|
28
|
+
run: (fn: () => Promise<T>) => Promise<T>;
|
|
29
|
+
};
|
|
30
|
+
interface DegradeResult<T> {
|
|
31
|
+
value: T;
|
|
32
|
+
degraded: boolean;
|
|
33
|
+
reason?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Attempt an operation with timeout; if it fails or times out, return the
|
|
37
|
+
* fallback value with `degraded: true`.
|
|
38
|
+
*/
|
|
39
|
+
declare function withDegrade<T>(operation: () => Promise<T>, fallback: T, timeoutMs: number): Promise<DegradeResult<T>>;
|
|
5
40
|
|
|
6
41
|
/**
|
|
7
42
|
* Navigation sources — resolve the project manifest into the inputs the
|
|
@@ -25,14 +60,16 @@ interface ResolveNavigationSourcesOptions {
|
|
|
25
60
|
projectRoot: string;
|
|
26
61
|
/**
|
|
27
62
|
* The component's bundled `/$embedded/` DSL, baked into the hook bin by
|
|
28
|
-
* `claude sync
|
|
63
|
+
* `claude sync` — the only writer of `.claude/bin/*` (#273). Undefined for a
|
|
64
|
+
* component whose contract declares no embedded DSL, where the bin resolves
|
|
29
65
|
* `dslPath` directly.
|
|
30
66
|
*/
|
|
31
67
|
embeddedDsl?: Record<string, unknown>;
|
|
32
68
|
/**
|
|
33
69
|
* Project-root-relative agents DSL path used ONLY when `projectRoot` has no
|
|
34
|
-
* `project.yaml` (a bare component checkout)
|
|
35
|
-
*
|
|
70
|
+
* `project.yaml` (a bare component checkout), and only when the file is
|
|
71
|
+
* actually there — it is a convention, not a declaration. With a manifest
|
|
72
|
+
* present the manifest's `agents:` wins.
|
|
36
73
|
*/
|
|
37
74
|
dslPath: string;
|
|
38
75
|
}
|
|
@@ -56,132 +93,6 @@ interface NavigationSources {
|
|
|
56
93
|
*/
|
|
57
94
|
declare function resolveNavigationSources(options: ResolveNavigationSourcesOptions): Promise<NavigationSources>;
|
|
58
95
|
|
|
59
|
-
/**
|
|
60
|
-
* Ensure Navigation Index — cache warm / invalidation.
|
|
61
|
-
*
|
|
62
|
-
* Checks cache freshness via source file mtime comparison. If stale,
|
|
63
|
-
* calls buildNavigationContext() and writes to .claude/cache/.
|
|
64
|
-
* If fresh, returns cached data immediately.
|
|
65
|
-
*
|
|
66
|
-
* This is the performance-critical path for SessionStart hooks.
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
interface EnsureNavigationIndexOptions {
|
|
70
|
-
/** Absolute path to .claude/cache/ directory. */
|
|
71
|
-
cacheDir: string;
|
|
72
|
-
/** Paths to source files whose mtime drives cache invalidation. */
|
|
73
|
-
sourceFiles: string[];
|
|
74
|
-
/** Options for buildNavigationContext() when cache is stale. */
|
|
75
|
-
navigationOptions: NavigationContextOptions;
|
|
76
|
-
/**
|
|
77
|
-
* Cache key for the stored JSON file (default: `"navigation-index"`).
|
|
78
|
-
*
|
|
79
|
-
* In workspace mode each member uses its own key, e.g.
|
|
80
|
-
* `"navigation-index.aaac"`, so their caches remain isolated.
|
|
81
|
-
* Single-component callers omit this field and the default preserves
|
|
82
|
-
* byte-identical behaviour with previous versions.
|
|
83
|
-
*/
|
|
84
|
-
cacheKey?: string;
|
|
85
|
-
}
|
|
86
|
-
interface NavigationIndexResult {
|
|
87
|
-
navigationIndex: Record<string, unknown>;
|
|
88
|
-
/** Whether the result was loaded from cache (true) or freshly built (false). */
|
|
89
|
-
fromCache: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Diagnostics from the build that produced this index — artifact-binding
|
|
92
|
-
* findings (`unbound-artifact` / `orphan-binding` / `type-mismatch`) and
|
|
93
|
-
* schema validation issues. Present only on a fresh build: they describe the
|
|
94
|
-
* DSL/registry the index was built from, so a caller that hit the cache has
|
|
95
|
-
* already been told once. Callers MUST surface them (a dropped
|
|
96
|
-
* `orphan-binding` is exactly how a project's artifact registry silently
|
|
97
|
-
* fails to reach the hooks — #260).
|
|
98
|
-
*/
|
|
99
|
-
diagnostics?: Array<{
|
|
100
|
-
path: string;
|
|
101
|
-
message: string;
|
|
102
|
-
severity: string;
|
|
103
|
-
}>;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Render build diagnostics as hook context lines. Returns undefined when there
|
|
107
|
-
* is nothing to report, so callers can skip the section entirely.
|
|
108
|
-
*/
|
|
109
|
-
declare function renderNavigationDiagnostics(diagnostics: NavigationIndexResult["diagnostics"], label?: string): string | undefined;
|
|
110
|
-
/**
|
|
111
|
-
* Ensure the navigation index is available and fresh. Returns the index
|
|
112
|
-
* data, building + caching if necessary.
|
|
113
|
-
*
|
|
114
|
-
* In workspace mode, pass a unique `cacheKey` per member (e.g.
|
|
115
|
-
* `"navigation-index.aaac"`) so each member's index is stored and
|
|
116
|
-
* invalidated independently.
|
|
117
|
-
*/
|
|
118
|
-
declare function ensureNavigationIndex(options: EnsureNavigationIndexOptions): Promise<NavigationIndexResult>;
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* File Suggestion Handler — artifact-aware @ completion for Claude Code.
|
|
122
|
-
*
|
|
123
|
-
* Reads stdin prefix, filters navigation-index artifacts, and emits NDJSON
|
|
124
|
-
* candidates sorted by relevance score.
|
|
125
|
-
*/
|
|
126
|
-
interface FileSuggestionCandidate {
|
|
127
|
-
label: string;
|
|
128
|
-
path: string;
|
|
129
|
-
kind: "artifact" | "file";
|
|
130
|
-
/** Artifact ID this file/pattern belongs to. */
|
|
131
|
-
artifact?: string;
|
|
132
|
-
/** Authority of the artifact (canonical, generated, etc.). */
|
|
133
|
-
authority?: string;
|
|
134
|
-
/** Manual edit policy for the artifact. */
|
|
135
|
-
manual_edit?: string;
|
|
136
|
-
/** Relevance score (higher = more relevant). */
|
|
137
|
-
score: number;
|
|
138
|
-
}
|
|
139
|
-
interface FileSuggestionOptions {
|
|
140
|
-
/** The navigation index to search. */
|
|
141
|
-
navigationIndex: Record<string, unknown>;
|
|
142
|
-
/** Maximum number of candidates to return. */
|
|
143
|
-
maxCandidates?: number;
|
|
144
|
-
/**
|
|
145
|
-
* Prefix prepended to every emitted path (#266). Artifact `path_patterns` are
|
|
146
|
-
* project-root relative, so in a workspace — where Claude Code's cwd is the
|
|
147
|
-
* workspace root — a member's candidates must be re-rooted under the member
|
|
148
|
-
* directory. The mirror image of `stripMemberPrefix` on the PreToolUse side.
|
|
149
|
-
*/
|
|
150
|
-
pathPrefix?: string;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Generate file suggestion candidates from the navigation index.
|
|
154
|
-
* Filters by prefix if provided, then returns NDJSON-formatted candidates.
|
|
155
|
-
*/
|
|
156
|
-
declare function generateCandidates(prefix: string, options: FileSuggestionOptions): FileSuggestionCandidate[];
|
|
157
|
-
/**
|
|
158
|
-
* Format candidates as NDJSON (one JSON object per line).
|
|
159
|
-
*/
|
|
160
|
-
declare function formatNdjson(candidates: FileSuggestionCandidate[]): string;
|
|
161
|
-
/**
|
|
162
|
-
* Main handler for file-suggestion bin script.
|
|
163
|
-
* Reads prefix from stdin, returns NDJSON candidates to stdout.
|
|
164
|
-
*/
|
|
165
|
-
declare function handleFileSuggestion(navigationIndex: Record<string, unknown>, stdinData: string): Promise<string>;
|
|
166
|
-
/** One workspace member's cached index, as the file-suggestion bin knows it. */
|
|
167
|
-
interface WorkspaceFileSuggestionMember {
|
|
168
|
-
/** Member name (for diagnostics only). */
|
|
169
|
-
name: string;
|
|
170
|
-
/** Workspace-relative member path — prepended to every candidate path. */
|
|
171
|
-
memberPath: string;
|
|
172
|
-
/** Cache key of this member's navigation-index. */
|
|
173
|
-
cacheKey: string;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Workspace variant (#266): merge candidates from every member's own index.
|
|
177
|
-
*
|
|
178
|
-
* The single-component handler reads the lone `navigation-index` cache entry,
|
|
179
|
-
* which workspace mode never writes (each member has its own key) — so `@`
|
|
180
|
-
* completion returned nothing at all. Members whose index has not been built yet
|
|
181
|
-
* are skipped rather than failing the hook: SessionStart warms them.
|
|
182
|
-
*/
|
|
183
|
-
declare function handleWorkspaceFileSuggestion(cacheDir: string, members: WorkspaceFileSuggestionMember[], stdinData: string, maxCandidates?: number): Promise<string>;
|
|
184
|
-
|
|
185
96
|
/**
|
|
186
97
|
* SessionStart Hook Handler — cache warm + navigation-index summary injection.
|
|
187
98
|
*
|
|
@@ -204,66 +115,6 @@ interface SessionStartHandlerConfig {
|
|
|
204
115
|
*/
|
|
205
116
|
declare function createSessionStartHandler(config: SessionStartHandlerConfig): (_input: SessionStartInput) => Promise<HookOutput>;
|
|
206
117
|
|
|
207
|
-
/**
|
|
208
|
-
* UserPromptSubmit Hook Handler — navigation-index summary injection.
|
|
209
|
-
*
|
|
210
|
-
* Executed after prompt submission, before Claude processes it. Provides a
|
|
211
|
-
* compact navigation-index summary so the LLM can pick candidates and delegate
|
|
212
|
-
* deep exploration to `analyzer.getContextMap` (Level 2).
|
|
213
|
-
*
|
|
214
|
-
* ContextPack is NOT pre-injected by default (#206 Phase D).
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
interface UserPromptSubmitHandlerConfig {
|
|
218
|
-
/** Absolute path to .claude/cache/ directory. */
|
|
219
|
-
cacheDir: string;
|
|
220
|
-
/** Source files for cache invalidation. */
|
|
221
|
-
sourceFiles: string[];
|
|
222
|
-
/** Options for buildNavigationContext(). */
|
|
223
|
-
navigationOptions: EnsureNavigationIndexOptions["navigationOptions"];
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Create a UserPromptSubmit hook handler.
|
|
227
|
-
*/
|
|
228
|
-
declare function createUserPromptSubmitHandler(config: UserPromptSubmitHandlerConfig): (input: UserPromptSubmitInput) => Promise<HookOutput>;
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Workspace member navigation — the shared warm-up + rendering used by every
|
|
232
|
-
* workspace hook that needs per-member navigation indices (SessionStart and
|
|
233
|
-
* UserPromptSubmit). One member = one navigation-index cache entry.
|
|
234
|
-
*
|
|
235
|
-
* Heavy path (pulls ensureNavigationIndex → navigation-context → agent-contracts);
|
|
236
|
-
* never import from the lean `hooks-lite` entry.
|
|
237
|
-
*/
|
|
238
|
-
|
|
239
|
-
interface WorkspaceMemberNavConfig {
|
|
240
|
-
/** Human-readable member name (e.g. `"aaac"`). */
|
|
241
|
-
name: string;
|
|
242
|
-
/** Absolute path to member root directory. */
|
|
243
|
-
root: string;
|
|
244
|
-
/**
|
|
245
|
-
* Unique cache key for this member's navigation-index JSON.
|
|
246
|
-
* Format: `navigation-index.<name>`.
|
|
247
|
-
*/
|
|
248
|
-
cacheKey: string;
|
|
249
|
-
/** Source files for mtime-based cache invalidation. */
|
|
250
|
-
sourceFiles: string[];
|
|
251
|
-
/** Options passed to `buildNavigationContext()` on cache miss. */
|
|
252
|
-
navigationOptions: EnsureNavigationIndexOptions["navigationOptions"];
|
|
253
|
-
}
|
|
254
|
-
interface WorkspaceMemberNavResult {
|
|
255
|
-
member: WorkspaceMemberNavConfig;
|
|
256
|
-
result: NavigationIndexResult;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Build (or validate) every member's navigation-index in **parallel** — each
|
|
260
|
-
* cache key has its own exclusive lock, so concurrent calls for the same member
|
|
261
|
-
* deduplicate rather than queue behind other members.
|
|
262
|
-
*/
|
|
263
|
-
declare function ensureMemberIndices(cacheDir: string, members: WorkspaceMemberNavConfig[]): Promise<WorkspaceMemberNavResult[]>;
|
|
264
|
-
/** One member's context section: index summary + freshness + build diagnostics. */
|
|
265
|
-
declare function renderMemberSection({ member, result }: WorkspaceMemberNavResult): string;
|
|
266
|
-
|
|
267
118
|
/**
|
|
268
119
|
* Workspace SessionStart Hook Handler — per-member navigation-index warm-up.
|
|
269
120
|
*
|
|
@@ -283,28 +134,19 @@ interface WorkspaceSessionStartConfig {
|
|
|
283
134
|
members: WorkspaceMemberNavConfig[];
|
|
284
135
|
}
|
|
285
136
|
/**
|
|
286
|
-
*
|
|
137
|
+
* Build (or validate) every member's navigation-index in **parallel** — each
|
|
138
|
+
* cache key has its own exclusive lock, so concurrent calls for the same member
|
|
139
|
+
* deduplicate rather than queue behind other members.
|
|
140
|
+
*
|
|
141
|
+
* This is the heavy path, and it lives here because SessionStart is the only
|
|
142
|
+
* hook that may pay for it: it fires once per session. The per-interaction hooks
|
|
143
|
+
* read the cache instead and run the `ensure-navigation-index` bin when it is
|
|
144
|
+
* stale, which reaches this same builder in a child process.
|
|
287
145
|
*/
|
|
288
|
-
declare function
|
|
289
|
-
|
|
146
|
+
declare function ensureMemberIndices(cacheDir: string, members: WorkspaceMemberNavConfig[]): Promise<WorkspaceMemberNavResult[]>;
|
|
290
147
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
* The workspace hook set previously emitted the SINGLE-component ContextPack bin
|
|
294
|
-
* at the workspace root (#263): SessionStart and PreToolUse were member-aware
|
|
295
|
-
* while prompt submission saw only the root manifest, so no member's artifacts
|
|
296
|
-
* reached the prompt. This mirrors the SessionStart handler — one index per
|
|
297
|
-
* member — and adds prompt-keyword candidates per member.
|
|
298
|
-
*
|
|
299
|
-
* Heavy path (ensureNavigationIndex → agent-contracts); not part of hooks-lite.
|
|
148
|
+
* Create a workspace-aware SessionStart hook handler.
|
|
300
149
|
*/
|
|
150
|
+
declare function createWorkspaceSessionStartHandler(config: WorkspaceSessionStartConfig): (_input: SessionStartInput) => Promise<HookOutput>;
|
|
301
151
|
|
|
302
|
-
|
|
303
|
-
/** Absolute path to the shared `.claude/cache/` directory. */
|
|
304
|
-
cacheDir: string;
|
|
305
|
-
/** Workspace members whose indices feed the prompt context. */
|
|
306
|
-
members: WorkspaceMemberNavConfig[];
|
|
307
|
-
}
|
|
308
|
-
declare function createWorkspaceUserPromptSubmitHandler(config: WorkspaceUserPromptSubmitConfig): (input: UserPromptSubmitInput) => Promise<HookOutput>;
|
|
309
|
-
|
|
310
|
-
export { type EnsureNavigationIndexOptions, type FileSuggestionCandidate, type FileSuggestionOptions, HookOutput, type NavigationIndexResult, type NavigationSources, type ResolveNavigationSourcesOptions, type SessionStartHandlerConfig, SessionStartInput, type UserPromptSubmitHandlerConfig, UserPromptSubmitInput, type WorkspaceFileSuggestionMember, type WorkspaceMemberNavConfig, type WorkspaceMemberNavResult, type WorkspaceSessionStartConfig, type WorkspaceUserPromptSubmitConfig, createSessionStartHandler, createUserPromptSubmitHandler, createWorkspaceSessionStartHandler, createWorkspaceUserPromptSubmitHandler, ensureMemberIndices, ensureNavigationIndex, formatNdjson, generateCandidates, handleFileSuggestion, handleWorkspaceFileSuggestion, renderMemberSection, renderNavigationDiagnostics, resolveNavigationSources };
|
|
152
|
+
export { type DegradeResult, EnsureNavigationIndexOptions, HookOutput, type NavigationSources, type ResolveNavigationSourcesOptions, type SessionStartHandlerConfig, SessionStartInput, TimeoutError, WorkspaceMemberNavConfig, WorkspaceMemberNavResult, type WorkspaceSessionStartConfig, createExclusiveLock, createSessionStartHandler, createWorkspaceSessionStartHandler, ensureMemberIndices, resolveNavigationSources, withDegrade, withTimeout };
|