instar 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,68 @@
1
+ /**
2
+ * CapabilityIndex — single source of truth for the /capabilities self-discovery
3
+ * surface AND the discoverability lint that PR #290 introduced.
4
+ *
5
+ * Before this module: /capabilities was a hand-curated 440-line object literal
6
+ * in routes.ts, and the lint test in tests/unit/capabilities-discoverability.test.ts
7
+ * kept a parallel hand-written INTERNAL_ALLOWLIST. Two manual surfaces had to
8
+ * stay in sync for the discoverability promise to hold; nothing structurally
9
+ * enforced that sync. Echo's case study (topic 11141, 2026-05-21) called out
10
+ * the third manual edit point as the next obvious risk.
11
+ *
12
+ * After this module: /capabilities iterates CAPABILITY_INDEX and the lint
13
+ * reads the same array. Adding a new top-level route prefix to routes.ts
14
+ * fails CI until the author either adds an entry to CAPABILITY_INDEX (the
15
+ * "this is agent-facing, surface it" choice) or adds the prefix to
16
+ * INTERNAL_PREFIXES (the "this is operator-only, skip discovery" choice).
17
+ * The lint test no longer carries policy in test code — it just enforces the
18
+ * invariant that every prefix has been classified.
19
+ *
20
+ * Each entry has a `build(input)` function that produces the block to merge
21
+ * into the /capabilities response. Builders are pure (no I/O beyond what
22
+ * ctx already exposes) so /capabilities stays cheap to call on every probe.
23
+ *
24
+ * Spec: docs/specs/capabilities-introspection.md (PR #N — follow-up #2 of two).
25
+ */
26
+ import type { SecretDrop } from './SecretDrop.js';
27
+ import type { RouteContext } from './routes.js';
28
+ /** Inputs every capability builder receives. Pure data — no closures. */
29
+ export interface CapabilityBuildInput {
30
+ ctx: RouteContext;
31
+ /** Names of files under .claude/scripts/ — already enumerated by the handler. */
32
+ scripts: string[];
33
+ /** The SecretDrop instance — required for the `secrets` block's pending count. */
34
+ secretDrop: SecretDrop;
35
+ }
36
+ /** A single capability surfaced in the /capabilities response. */
37
+ export interface CapabilityEntry {
38
+ /** JSON key under which this capability appears in the response body. */
39
+ readonly key: string;
40
+ /** Top-level route prefixes this capability owns. Drives the lint. */
41
+ readonly prefixes: readonly string[];
42
+ /** Human-friendly one-line description (for docs + telemetry). */
43
+ readonly description: string;
44
+ /** Produce the block to merge into the response. */
45
+ readonly build: (input: CapabilityBuildInput) => unknown;
46
+ }
47
+ export declare const CAPABILITY_INDEX: readonly CapabilityEntry[];
48
+ /**
49
+ * Top-level route prefixes that are intentionally invisible to agents in
50
+ * the /capabilities response. Each entry is a deliberate "skip" with a
51
+ * one-line reason. The discoverability lint verifies that every prefix in
52
+ * routes.ts is either claimed by a CAPABILITY_INDEX entry OR allowlisted
53
+ * here — never both, never neither.
54
+ */
55
+ export declare const INTERNAL_PREFIXES: ReadonlyArray<{
56
+ prefix: string;
57
+ reason: string;
58
+ }>;
59
+ /**
60
+ * Map every top-level route prefix to its CapabilityIndex key (for entries
61
+ * that claim prefixes). Lint uses this to verify routes.ts has full coverage.
62
+ */
63
+ export declare function buildPrefixToKeyMap(): Map<string, string>;
64
+ /** Set of all prefixes that should NOT appear in /capabilities. */
65
+ export declare function buildInternalPrefixSet(): Set<string>;
66
+ /** Iterate the index and produce the full capability-block object. */
67
+ export declare function buildAllCapabilityBlocks(input: CapabilityBuildInput): Record<string, unknown>;
68
+ //# sourceMappingURL=CapabilityIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CapabilityIndex.d.ts","sourceRoot":"","sources":["../../src/server/CapabilityIndex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,YAAY,CAAC;IAClB,iFAAiF;IACjF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,kFAAkF;IAClF,UAAU,EAAE,UAAU,CAAC;CACxB;AA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