@descryy/mcp 0.1.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.
Files changed (118) hide show
  1. package/LICENSE +21 -0
  2. package/dist/action-handshake.d.ts +86 -0
  3. package/dist/action-handshake.d.ts.map +1 -0
  4. package/dist/action-handshake.js +144 -0
  5. package/dist/action-handshake.js.map +1 -0
  6. package/dist/bin/descry-mcp.d.ts +18 -0
  7. package/dist/bin/descry-mcp.d.ts.map +1 -0
  8. package/dist/bin/descry-mcp.js +54 -0
  9. package/dist/bin/descry-mcp.js.map +1 -0
  10. package/dist/index.d.ts +32 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +15 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/language-guess.d.ts +17 -0
  15. package/dist/language-guess.d.ts.map +1 -0
  16. package/dist/language-guess.js +43 -0
  17. package/dist/language-guess.js.map +1 -0
  18. package/dist/protocol.d.ts +91 -0
  19. package/dist/protocol.d.ts.map +1 -0
  20. package/dist/protocol.js +127 -0
  21. package/dist/protocol.js.map +1 -0
  22. package/dist/registry.d.ts +72 -0
  23. package/dist/registry.d.ts.map +1 -0
  24. package/dist/registry.js +136 -0
  25. package/dist/registry.js.map +1 -0
  26. package/dist/render.d.ts +275 -0
  27. package/dist/render.d.ts.map +1 -0
  28. package/dist/render.js +333 -0
  29. package/dist/render.js.map +1 -0
  30. package/dist/server.d.ts +42 -0
  31. package/dist/server.d.ts.map +1 -0
  32. package/dist/server.js +263 -0
  33. package/dist/server.js.map +1 -0
  34. package/dist/session.d.ts +164 -0
  35. package/dist/session.d.ts.map +1 -0
  36. package/dist/session.js +302 -0
  37. package/dist/session.js.map +1 -0
  38. package/dist/tools/analyze.d.ts +124 -0
  39. package/dist/tools/analyze.d.ts.map +1 -0
  40. package/dist/tools/analyze.js +411 -0
  41. package/dist/tools/analyze.js.map +1 -0
  42. package/dist/tools/contracts.d.ts +105 -0
  43. package/dist/tools/contracts.d.ts.map +1 -0
  44. package/dist/tools/contracts.js +141 -0
  45. package/dist/tools/contracts.js.map +1 -0
  46. package/dist/tools/cross-pr.d.ts +137 -0
  47. package/dist/tools/cross-pr.d.ts.map +1 -0
  48. package/dist/tools/cross-pr.js +216 -0
  49. package/dist/tools/cross-pr.js.map +1 -0
  50. package/dist/tools/git-diff.d.ts +29 -0
  51. package/dist/tools/git-diff.d.ts.map +1 -0
  52. package/dist/tools/git-diff.js +117 -0
  53. package/dist/tools/git-diff.js.map +1 -0
  54. package/dist/tools/git-history.d.ts +27 -0
  55. package/dist/tools/git-history.d.ts.map +1 -0
  56. package/dist/tools/git-history.js +91 -0
  57. package/dist/tools/git-history.js.map +1 -0
  58. package/dist/tools/history.d.ts +63 -0
  59. package/dist/tools/history.d.ts.map +1 -0
  60. package/dist/tools/history.js +114 -0
  61. package/dist/tools/history.js.map +1 -0
  62. package/dist/tools/impact.d.ts +81 -0
  63. package/dist/tools/impact.d.ts.map +1 -0
  64. package/dist/tools/impact.js +229 -0
  65. package/dist/tools/impact.js.map +1 -0
  66. package/dist/tools/index.d.ts +33 -0
  67. package/dist/tools/index.d.ts.map +1 -0
  68. package/dist/tools/index.js +47 -0
  69. package/dist/tools/index.js.map +1 -0
  70. package/dist/tools/kit.d.ts +183 -0
  71. package/dist/tools/kit.d.ts.map +1 -0
  72. package/dist/tools/kit.js +117 -0
  73. package/dist/tools/kit.js.map +1 -0
  74. package/dist/tools/link-workspace.d.ts +62 -0
  75. package/dist/tools/link-workspace.d.ts.map +1 -0
  76. package/dist/tools/link-workspace.js +156 -0
  77. package/dist/tools/link-workspace.js.map +1 -0
  78. package/dist/tools/lookup.d.ts +29 -0
  79. package/dist/tools/lookup.d.ts.map +1 -0
  80. package/dist/tools/lookup.js +73 -0
  81. package/dist/tools/lookup.js.map +1 -0
  82. package/dist/tools/pr-analysis.d.ts +89 -0
  83. package/dist/tools/pr-analysis.d.ts.map +1 -0
  84. package/dist/tools/pr-analysis.js +169 -0
  85. package/dist/tools/pr-analysis.js.map +1 -0
  86. package/dist/tools/propagation.d.ts +74 -0
  87. package/dist/tools/propagation.d.ts.map +1 -0
  88. package/dist/tools/propagation.js +194 -0
  89. package/dist/tools/propagation.js.map +1 -0
  90. package/dist/tools/questions.d.ts +80 -0
  91. package/dist/tools/questions.d.ts.map +1 -0
  92. package/dist/tools/questions.js +213 -0
  93. package/dist/tools/questions.js.map +1 -0
  94. package/dist/tools/refusal-fetch.d.ts +71 -0
  95. package/dist/tools/refusal-fetch.d.ts.map +1 -0
  96. package/dist/tools/refusal-fetch.js +137 -0
  97. package/dist/tools/refusal-fetch.js.map +1 -0
  98. package/dist/tools/scope.d.ts +60 -0
  99. package/dist/tools/scope.d.ts.map +1 -0
  100. package/dist/tools/scope.js +160 -0
  101. package/dist/tools/scope.js.map +1 -0
  102. package/dist/tools/similar-incidents.d.ts +105 -0
  103. package/dist/tools/similar-incidents.d.ts.map +1 -0
  104. package/dist/tools/similar-incidents.js +228 -0
  105. package/dist/tools/similar-incidents.js.map +1 -0
  106. package/dist/tools/validate.d.ts +103 -0
  107. package/dist/tools/validate.d.ts.map +1 -0
  108. package/dist/tools/validate.js +176 -0
  109. package/dist/tools/validate.js.map +1 -0
  110. package/dist/tools/verification-status.d.ts +68 -0
  111. package/dist/tools/verification-status.d.ts.map +1 -0
  112. package/dist/tools/verification-status.js +179 -0
  113. package/dist/tools/verification-status.js.map +1 -0
  114. package/dist/transport.d.ts +58 -0
  115. package/dist/transport.d.ts.map +1 -0
  116. package/dist/transport.js +115 -0
  117. package/dist/transport.js.map +1 -0
  118. package/package.json +33 -0
@@ -0,0 +1,229 @@
1
+ /**
2
+ * `impact` — "what breaks if I change this, what covers it, have we seen it before?"
3
+ *
4
+ * §18's tool-name list is deliberately not a build list ("the tool names are
5
+ * implementation details") — but three of the functions it names were already
6
+ * built and correct in the query layer with no MCP tool ever calling them:
7
+ * `impactOf` (blast radius — find_dependents/find_callers/find_usages),
8
+ * `testsCovering` (find_tests) and `rootCauseSearch` (find_related_incidents,
9
+ * find_fix_patterns). This wires all three under one call, the same way
10
+ * `validate` bundles env, rollback and the config graph — a developer asking
11
+ * "what does changing this touch" wants the blast radius, what already tests
12
+ * it and what has broken near it before in one answer, not three round trips.
13
+ *
14
+ * A fourth, `traceApi` (find_dependencies read the other direction, or "how
15
+ * does this reach that"), runs only when a second node is given — it answers
16
+ * a different question (a path between two specific symbols) and forcing it
17
+ * into every call would mean walking the graph for a question nobody asked.
18
+ *
19
+ * ## Direction, and why the default is structural rather than data-carrying
20
+ *
21
+ * `propagation` already owns PROPAGATES_TO/READS/WRITES/RETURNS — what data
22
+ * carries. This tool defaults to CALLS, IMPORTS, IMPLEMENTS, INHERITS,
23
+ * USES_API and SERVES_API — what structure depends on what. The two tools
24
+ * answer different questions over the same primitives; a caller after "who
25
+ * calls this" should never have to remember that CALLS lives in a tool named
26
+ * for propagation.
27
+ */
28
+ import { impactOf, rootCauseSearch, testsCovering, traceApi } from "@descryy/core";
29
+ import { briefNode, optionalBoolean, optionalEnum, optionalInteger, optionalString, optionalStringArray, ToolInputError, } from "./kit.js";
30
+ import { resolveOneNode } from "./lookup.js";
31
+ /** Structural edges — what depends on what, never what data carries. */
32
+ const STRUCTURAL_EDGE_TYPES = [
33
+ "CALLS",
34
+ "IMPORTS",
35
+ "IMPLEMENTS",
36
+ "INHERITS",
37
+ "USES_API",
38
+ "SERVES_API",
39
+ ];
40
+ const SCHEMA = {
41
+ type: "object",
42
+ properties: {
43
+ nodeId: { type: "string", description: "Graph node id to start from." },
44
+ symbol: {
45
+ type: "string",
46
+ description: "Symbol name to start from, when you do not have a node id. Ambiguity is reported rather " +
47
+ "than guessed at — narrow it with \"file\".",
48
+ },
49
+ file: {
50
+ type: "string",
51
+ description: "Repository-relative path, to disambiguate \"symbol\" or to start from a file.",
52
+ },
53
+ to: {
54
+ type: "string",
55
+ description: "A second node id, symbol or path — when given, also traces a path from the start node to " +
56
+ "this one (find_api_contract's \"how does this reach that\" question).",
57
+ },
58
+ edgeTypes: {
59
+ type: "array",
60
+ items: { type: "string" },
61
+ description: "Restrict the blast-radius walk. Defaults to CALLS, IMPORTS, IMPLEMENTS, INHERITS, " +
62
+ "USES_API and SERVES_API — structural edges. For data-flow, use \"propagation\" instead.",
63
+ },
64
+ direction: {
65
+ type: "string",
66
+ enum: ["in", "out"],
67
+ description: "Which way to walk. Default \"in\" — what depends on this symbol (the blast radius). " +
68
+ "\"out\" answers a different question — what this symbol reaches — and is what a caller " +
69
+ "in one repository needs to walk toward a route served by another.",
70
+ },
71
+ crossApiEndpoint: {
72
+ type: "boolean",
73
+ description: "At an API_ENDPOINT node, also follow the USES_API/SERVES_API edge the walk's own " +
74
+ "direction would not otherwise see, reaching the API_ROUTE that serves it on the other " +
75
+ "side of the join (DEC-138: the walk otherwise stops at the shared endpoint). Off by " +
76
+ "default.",
77
+ },
78
+ maxDepth: { type: "integer", minimum: 1, description: "Hop limit on the blast radius. Default unbounded." },
79
+ limit: {
80
+ type: "integer",
81
+ minimum: 1,
82
+ description: "Cap on nodes in the reply. Default 25 — MK-9: the prior default of 100 cost ~5.6k tokens " +
83
+ "per call in this surface's own serialized envelope; 25 lands near ~1.6k, matching the " +
84
+ "default cap `validate`/`contracts` already use. A capped reply always discloses shown/total " +
85
+ "(§5.5); raise this explicitly when the full set is needed.",
86
+ },
87
+ },
88
+ additionalProperties: false,
89
+ };
90
+ async function run(args, ctx) {
91
+ const nodeId = optionalString(args, "nodeId");
92
+ const symbol = optionalString(args, "symbol");
93
+ const file = optionalString(args, "file");
94
+ const to = optionalString(args, "to");
95
+ const edgeTypes = optionalStringArray(args, "edgeTypes");
96
+ const direction = optionalEnum(args, "direction", ["in", "out"]);
97
+ const crossApiEndpoint = optionalBoolean(args, "crossApiEndpoint") ?? false;
98
+ const maxDepth = optionalInteger(args, "maxDepth", 1);
99
+ const limit = optionalInteger(args, "limit", 1) ?? 25;
100
+ if (nodeId === undefined && symbol === undefined && file === undefined) {
101
+ throw new ToolInputError('give one of "nodeId", "symbol" or "file"');
102
+ }
103
+ const provider = ctx.session.provider();
104
+ const found = resolveOneNode(ctx.session, { nodeId, symbol, file });
105
+ if (found.node === null) {
106
+ const base = provider.baseStamp();
107
+ return {
108
+ result: {
109
+ data: { candidates: found.candidates.map(briefNode) },
110
+ stamp: { commitSha: base.commitSha, graphBuiltAt: base.graphBuiltAt, irSchemaVersion: base.irSchemaVersion, resolutionFloor: 0 },
111
+ truncated: false,
112
+ notes: found.notes,
113
+ },
114
+ nameLevel: true,
115
+ state: "refused",
116
+ headline: found.headline,
117
+ };
118
+ }
119
+ const walked = edgeTypes ?? STRUCTURAL_EDGE_TYPES;
120
+ ctx.progress(direction === "out" ? `Finding what ${found.node.name} reaches` : `Finding what depends on ${found.node.name}`);
121
+ const impact = impactOf(provider, [found.node.id], {
122
+ types: walked,
123
+ ...(direction === undefined ? {} : { direction }),
124
+ ...(crossApiEndpoint ? { crossApiEndpoint } : {}),
125
+ ...(maxDepth === undefined ? {} : { maxDepth }),
126
+ });
127
+ const affected = impact.data.filter((entry) => entry.node.id !== found.node?.id);
128
+ const shownAffected = affected.slice(0, limit);
129
+ ctx.progress(`Finding tests covering ${found.node.name}`);
130
+ const tests = testsCovering(provider, found.node.id, maxDepth === undefined ? {} : { maxDepth });
131
+ ctx.progress(`Checking for related incidents and fix patterns`);
132
+ const related = rootCauseSearch(provider, found.node.id);
133
+ let path = null;
134
+ const pathNotes = [];
135
+ if (to !== undefined) {
136
+ const target = resolveOneNode(ctx.session, { symbol: to, file: undefined });
137
+ if (target.node === null) {
138
+ pathNotes.push(`"to" (${JSON.stringify(to)}) did not resolve: ${target.headline}`);
139
+ }
140
+ else {
141
+ ctx.progress(`Tracing a path to ${target.node.name}`);
142
+ const traced = traceApi(provider, found.node.id, target.node.id, { direction: "both" });
143
+ path = { to: briefNode(target.node), hops: traced.data.hops, nodes: traced.data.path.map(briefNode) };
144
+ pathNotes.push(...traced.notes);
145
+ }
146
+ }
147
+ const present = new Set();
148
+ for (const edge of [...provider.outgoing(found.node.id), ...provider.incoming(found.node.id)]) {
149
+ if (walked.includes(edge.type))
150
+ present.add(edge.type);
151
+ }
152
+ const absent = walked.filter((type) => !present.has(type));
153
+ const analysed = present.size > 0;
154
+ const notes = [...found.notes, ...impact.notes, ...tests.notes, ...related.notes, ...pathNotes];
155
+ if (shownAffected.length < affected.length) {
156
+ notes.push(`${affected.length - shownAffected.length} further affected node(s) exist but are not listed — ` +
157
+ `the reply is capped at ${limit}.`);
158
+ }
159
+ if (absent.length > 0) {
160
+ notes.push(`No ${absent.join(", ")} edge touches this node, so ${absent.length === 1 ? "that type" : "those types"} ` +
161
+ "contributed nothing to the blast radius.");
162
+ }
163
+ if (!analysed) {
164
+ notes.push(`None of the requested edge types (${walked.join(", ")}) appear on any edge touching this node. ` +
165
+ "That is not a finding that nothing depends on it — a producer for these edges may not run in " +
166
+ "this graph. This probe is local to one node and does not choose between the causes.");
167
+ }
168
+ const resolutionFloor = Math.min(impact.stamp.resolutionFloor, tests.stamp.resolutionFloor, related.stamp.resolutionFloor);
169
+ return {
170
+ result: {
171
+ data: {
172
+ from: briefNode(found.node),
173
+ affected: shownAffected.map((entry) => ({
174
+ ...briefNode(entry.node),
175
+ depth: entry.depth,
176
+ score: Number(entry.score.toFixed(4)),
177
+ })),
178
+ affectedTotal: affected.length,
179
+ coveringTests: tests.data.map(briefNode),
180
+ related: related.data.map((m) => ({ ...briefNode(m.incident), via: m.via })),
181
+ path,
182
+ analysed,
183
+ edgeTypesWalked: walked,
184
+ edgeTypesPresent: [...present].sort(),
185
+ },
186
+ stamp: { ...impact.stamp, resolutionFloor },
187
+ // `impact.truncated` is the query layer's own internal cap; it says
188
+ // nothing about this tool's own `limit` slice of `affected`, which can
189
+ // cap further still — the same gap history.ts had (P27).
190
+ truncated: impact.truncated || tests.truncated || related.truncated || shownAffected.length < affected.length,
191
+ notes,
192
+ },
193
+ nameLevel: false,
194
+ ...(analysed ? (affected.length === 0 ? { state: "empty" } : {}) : { state: "refused" }),
195
+ // `affected` is the primary collection this tool exists to report — tests/
196
+ // related can also be independently capped, but a single shown/total pair
197
+ // cannot honestly describe three different lists, so this covers the one
198
+ // §4's TruncationDetail doc calls "the primary collection" and leaves the
199
+ // other two to the boolean above and their own prose notes.
200
+ ...(shownAffected.length < affected.length
201
+ ? { truncatedDetail: { shown: shownAffected.length, total: affected.length, more: null } }
202
+ : {}),
203
+ headline: !analysed
204
+ ? `${found.node.name}'s blast radius was not analysed: the graph holds no ${walked.join("/")} edge ` +
205
+ "touching it. This is not a finding that nothing depends on it."
206
+ : direction === "out"
207
+ ? `${found.node.name} reaches ${affected.length} node(s); ${tests.data.length} test(s) cover it` +
208
+ `${related.data.length > 0 ? `; ${related.data.length} related incident(s)/fix(es)` : ""}.`
209
+ : `${found.node.name} affects ${affected.length} node(s); ${tests.data.length} test(s) cover it` +
210
+ `${related.data.length > 0 ? `; ${related.data.length} related incident(s)/fix(es)` : ""}.`,
211
+ };
212
+ }
213
+ export const impactTool = {
214
+ name: "impact",
215
+ class: "read",
216
+ tier: "evidence",
217
+ version: "1.0.0",
218
+ title: "Blast radius, test coverage and prior incidents for a symbol",
219
+ description: "Given a symbol, report what depends on it (blast radius over CALLS/IMPORTS/IMPLEMENTS/" +
220
+ "INHERITS/USES_API/SERVES_API), which tests cover it, and any incidents or fix patterns " +
221
+ "linked to it by a graph edge. Pass \"to\" to also trace a path to a second symbol. Pass " +
222
+ "\"direction\": \"out\" to instead ask what a symbol reaches, and \"crossApiEndpoint\": true " +
223
+ "with it to walk from a frontend caller across a shared API_ENDPOINT into the backend " +
224
+ "API_ROUTE that serves it. For data flow (what a value reaches, not what depends on a " +
225
+ "symbol), use \"propagation\" instead.",
226
+ inputSchema: SCHEMA,
227
+ run,
228
+ };
229
+ //# sourceMappingURL=impact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impact.js","sourceRoot":"","sources":["../../src/tools/impact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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AE,CAAC,QAAQ;YACjB,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,wDAAwD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ;gBAClG,gEAAgE;YAClE,CAAC,CAAC,SAAS,KAAK,KAAK;gBACnB,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,YAAY,QAAQ,CAAC,MAAM,aAAa,KAAK,CAAC,IAAI,CAAC,MAAM,mBAAmB;oBAC9F,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,MAAM,8BAA8B,CAAC,CAAC,CAAC,EAAE,GAAG;gBAC7F,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,YAAY,QAAQ,CAAC,MAAM,aAAa,KAAK,CAAC,IAAI,CAAC,MAAM,mBAAmB;oBAC9F,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,MAAM,8BAA8B,CAAC,CAAC,CAAC,EAAE,GAAG;KAClG,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAmB;IACxC,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,8DAA8D;IACrE,WAAW,EACT,wFAAwF;QACxF,yFAAyF;QACzF,0FAA0F;QAC1F,8FAA8F;QAC9F,uFAAuF;QACvF,uFAAuF;QACvF,uCAAuC;IACzC,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The commands of blueprint §1.11, in the order a developer meets them.
3
+ *
4
+ * `analyze` first because nothing else works without it, then the three
5
+ * questions asked of an existing graph, then `contracts` — which is declared,
6
+ * described and honestly unavailable. See `contracts.ts` for why it is here
7
+ * rather than omitted.
8
+ */
9
+ import type { ToolDefinition } from "./kit.ts";
10
+ export declare const TOOLS: readonly ToolDefinition[];
11
+ export declare const TOOLS_BY_NAME: ReadonlyMap<string, ToolDefinition>;
12
+ export { ToolInputError } from "./kit.ts";
13
+ export type { BriefNode, NodeCandidates, Progress, ToolContext, ToolDefinition, } from "./kit.ts";
14
+ export { resolveOneNode } from "./lookup.ts";
15
+ export { TOOL_TIERS } from "../render.ts";
16
+ export type { ToolTier } from "../render.ts";
17
+ export type { AnalyzeData, SourceRun } from "./analyze.ts";
18
+ export type { ContractPathFinding, ContractShapeMismatchReport, ContractShapeStatus, ContractsData, } from "./contracts.ts";
19
+ export type { BlockedCheck, CrossPrData, CrossPrEmptyDiff, CrossPrGitFailure, CrossPrReport, HiddenDependencyCheck, HiddenDependencyFinding, OverlapCheck, OverlapReportChecked, SupersededCheck, } from "./cross-pr.ts";
20
+ export type { GitDiffData, GitDiffEntry } from "./git-diff.ts";
21
+ export type { GitHistoryCommit, GitHistoryData } from "./git-history.ts";
22
+ export type { CoChangedFile, HistoryData, HistoryFile, HistoryFileResolved, HistoryFileUnresolved, HistoryReport } from "./history.ts";
23
+ export type { ImpactData, ImpactedNode, ImpactReport, RelatedNode, TracedPath } from "./impact.ts";
24
+ export type { LinkWorkspaceData, LinkedRepo } from "./link-workspace.ts";
25
+ export type { AffectedNode, PrAnalysisData, PrAnalysisEmptyDiff, PrAnalysisGitFailure, PrAnalysisRange, PrAnalysisReport, PrAnalysisUnresolved, } from "./pr-analysis.ts";
26
+ export type { PropagationData, PropagationReport, ReachedNode } from "./propagation.ts";
27
+ export type { QuestionsData } from "./questions.ts";
28
+ export type { RefusalFetchData, RefusalFetchPageData, RefusalFetchSummaryData, RefusalFetchSummaryItem, } from "./refusal-fetch.ts";
29
+ export type { ScopeData, ScopeNotSeeded, ScopeReport, ScopeTierCount, ScopedNodeReport } from "./scope.ts";
30
+ export type { SimilarIncidentReport, SimilarIncidentSignalReport, SimilarIncidentsData, } from "./similar-incidents.ts";
31
+ export type { ConfigDependencyReport, EnvFindingReport, ValidateData } from "./validate.ts";
32
+ export type { VerificationStatusData, VerificationStatusExercisedItem, } from "./verification-status.ts";
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,eAAO,MAAM,KAAK,EAAE,SAAS,cAAc,EAiB1C,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,cAAc,CAE7D,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAO7C,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,YAAY,EACZ,oBAAoB,EACpB,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACvI,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACnG,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzE,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxF,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3G,YAAY,EACV,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5F,YAAY,EACV,sBAAsB,EACtB,+BAA+B,GAChC,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The commands of blueprint §1.11, in the order a developer meets them.
3
+ *
4
+ * `analyze` first because nothing else works without it, then the three
5
+ * questions asked of an existing graph, then `contracts` — which is declared,
6
+ * described and honestly unavailable. See `contracts.ts` for why it is here
7
+ * rather than omitted.
8
+ */
9
+ import { analyzeTool } from "./analyze.js";
10
+ import { contractsTool } from "./contracts.js";
11
+ import { crossPrTool } from "./cross-pr.js";
12
+ import { gitDiffTool } from "./git-diff.js";
13
+ import { gitHistoryTool } from "./git-history.js";
14
+ import { historyTool } from "./history.js";
15
+ import { impactTool } from "./impact.js";
16
+ import { linkWorkspaceTool } from "./link-workspace.js";
17
+ import { prAnalysisTool } from "./pr-analysis.js";
18
+ import { propagationTool } from "./propagation.js";
19
+ import { questionsTool } from "./questions.js";
20
+ import { refusalFetchTool } from "./refusal-fetch.js";
21
+ import { scopeTool } from "./scope.js";
22
+ import { similarIncidentsTool } from "./similar-incidents.js";
23
+ import { validateTool } from "./validate.js";
24
+ import { verificationStatusTool } from "./verification-status.js";
25
+ export const TOOLS = [
26
+ analyzeTool,
27
+ linkWorkspaceTool,
28
+ scopeTool,
29
+ prAnalysisTool,
30
+ crossPrTool,
31
+ propagationTool,
32
+ impactTool,
33
+ historyTool,
34
+ contractsTool,
35
+ validateTool,
36
+ similarIncidentsTool,
37
+ questionsTool,
38
+ refusalFetchTool,
39
+ verificationStatusTool,
40
+ gitDiffTool,
41
+ gitHistoryTool,
42
+ ];
43
+ export const TOOLS_BY_NAME = new Map(TOOLS.map((tool) => [tool.name, tool]));
44
+ export { ToolInputError } from "./kit.js";
45
+ export { resolveOneNode } from "./lookup.js";
46
+ export { TOOL_TIERS } from "../render.js";
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,CAAC,MAAM,KAAK,GAA8B;IAC9C,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,cAAc;IACd,WAAW;IACX,eAAe;IACf,UAAU;IACV,WAAW;IACX,aAAa;IACb,YAAY;IACZ,oBAAoB;IACpB,aAAa;IACb,gBAAgB;IAChB,sBAAsB;IACtB,WAAW;IACX,cAAc;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAwC,IAAI,GAAG,CACvE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACvC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAQ1C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * What every tool is handed and what every tool may return.
3
+ *
4
+ * The return type is `ToolAnswer`, never content. A tool produces an *answer*;
5
+ * `render.ts` is the only thing that turns an answer into a reply, and it
6
+ * attaches the staleness stamp, the reliability cap and the disclosures on the
7
+ * way. A tool physically cannot ship a result with the caveats stripped off.
8
+ */
9
+ import type { ResolutionLevel, ResultState, ToolClass } from "@descryy/ir";
10
+ import type { ToolAnswer, ToolTier, TruncationDetail } from "../render.ts";
11
+ import type { Session } from "../session.ts";
12
+ /**
13
+ * Streaming narration — §22.2's primary UX, at the protocol level.
14
+ *
15
+ * A no-op when the client did not send a progress token, which is the common
16
+ * case for a scripted call. Tools call it unconditionally; deciding whether
17
+ * anybody is listening is not their job.
18
+ */
19
+ export type Progress = (message: string, current?: number, total?: number) => void;
20
+ export interface ToolContext {
21
+ readonly session: Session;
22
+ readonly progress: Progress;
23
+ readonly signal: AbortSignal;
24
+ }
25
+ export interface ToolDefinition {
26
+ readonly name: string;
27
+ readonly title: string;
28
+ readonly description: string;
29
+ /**
30
+ * DEC-278's three classes, and the assignment for all fourteen endpoints is
31
+ * tabulated in `ai-tool-contract.md` §8 rather than re-derived here.
32
+ *
33
+ * The line is deliberately **not** "does it write bytes". It is *can this
34
+ * call's effect change a later finding without the developer having said
35
+ * so.* `analyze` re-derives from code already on disk and `link_workspace`
36
+ * records where that code is, so neither can introduce a claim the
37
+ * repository does not already contain — both are `stateful-read`.
38
+ * `questions` writes a `ConfirmedFact`: human testimony that becomes a graph
39
+ * input, feeds `humanAsserted`, and is capped at reliability class B by
40
+ * DEC-223 precisely because it rests on one unaudited assertion. It is the
41
+ * only `action`, and the only class §4's two-call handshake gates.
42
+ *
43
+ * Required, and deliberately given no default — the same reasoning as
44
+ * `reliabilityCap`'s `nameLevel`. A tool author who has not thought about
45
+ * which class they are in is exactly the author who would inherit the wrong
46
+ * one, and the wrong one here is a mutating endpoint silently treated as
47
+ * pure.
48
+ *
49
+ * The type lives in `@descryy/ir` because the desktop lane and the AI layer
50
+ * read the same three names; restating the union here would be a second
51
+ * source of truth for one vocabulary.
52
+ */
53
+ readonly class: ToolClass;
54
+ /**
55
+ * MK-5 — does this tool's output state a conclusion about the user's code,
56
+ * or report a fact about the graph? Required and undefaulted, the same
57
+ * reasoning as `class` just above: three tools (`validate`, `contracts`,
58
+ * `cross_pr`) already refuse rather than over-claim and never return raw
59
+ * candidates — an author who has not thought about which one theirs is
60
+ * would be exactly the author to leave it defaulted to the safer-sounding
61
+ * one. See `ToolTier`'s own doc in `../render.ts` for why the type lives
62
+ * there and not here.
63
+ */
64
+ readonly tier: ToolTier;
65
+ /**
66
+ * Contract §6, rule 8. Every tool starts at `"1.0.0"` — none has shipped a
67
+ * behaviour change yet — and a future bump is what invalidates the golden
68
+ * investigations that depended on the old behaviour (`ai-layer-plan.md` §9
69
+ * layer 4).
70
+ */
71
+ readonly version: string;
72
+ readonly inputSchema: Record<string, unknown>;
73
+ run(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolAnswer<unknown>>;
74
+ /**
75
+ * Required when, and only when, `class === "action"` — `action-handshake.ts`
76
+ * throws at mint time if an action-class tool omits it (a registry bug, not
77
+ * a caller mistake). Absent on `read`/`stateful-read` tools; TypeScript
78
+ * cannot express "required iff this other field equals X", so it stays
79
+ * optional here and the constraint is enforced at the one call site that
80
+ * needs it, `tool-classes.test.ts` for the static half.
81
+ *
82
+ * Returns the plain-English "willDo" description of what confirming this
83
+ * call would do, or `undefined` when *this particular call* has nothing to
84
+ * confirm — `questions` with no `answer` argument is a pure read of the
85
+ * open-question queue, and gating that behind a token would make the tool
86
+ * unable to answer the first question asked of it.
87
+ */
88
+ describeAction?(args: Record<string, unknown>, ctx: ToolContext): string | undefined | Promise<string | undefined>;
89
+ }
90
+ /**
91
+ * An argument the caller can fix.
92
+ *
93
+ * Distinct from a thrown `Error`, which is a bug here. This becomes an `isError`
94
+ * tool result the agent can read and retry from; a bug becomes a JSON-RPC
95
+ * internal error, which it cannot.
96
+ */
97
+ export declare class ToolInputError extends Error {
98
+ constructor(message: string);
99
+ }
100
+ export declare function optionalString(args: Record<string, unknown>, key: string): string | undefined;
101
+ export declare function requiredString(args: Record<string, unknown>, key: string): string;
102
+ export declare function optionalStringArray(args: Record<string, unknown>, key: string): readonly string[] | undefined;
103
+ export declare function optionalInteger(args: Record<string, unknown>, key: string, min: number): number | undefined;
104
+ export declare function optionalEnum<T extends string>(args: Record<string, unknown>, key: string, allowed: readonly T[]): T | undefined;
105
+ export declare function optionalBoolean(args: Record<string, unknown>, key: string): boolean | undefined;
106
+ /**
107
+ * Wrap data that did not come from the query layer in the same envelope.
108
+ *
109
+ * `analyze` is the case: it writes rather than reads, so it has no
110
+ * `QueryResult`, and it would be the natural place for the disclosure discipline
111
+ * to leak. It uses this instead, so its reply carries the same stamp and the
112
+ * same rules as every query's.
113
+ */
114
+ export declare function answer<T>(options: {
115
+ readonly headline: string;
116
+ readonly data: T;
117
+ readonly resolutionFloor: ResolutionLevel;
118
+ readonly commitSha: string | null;
119
+ readonly graphBuiltAt: number | null;
120
+ readonly irSchemaVersion: number;
121
+ readonly notes: readonly string[];
122
+ readonly truncated?: boolean;
123
+ readonly truncatedDetail?: TruncationDetail;
124
+ readonly nameLevel: boolean;
125
+ /** One of the five result states (`ai-tool-contract.md` §1). Omitted means `"ok"`. */
126
+ readonly state?: ResultState;
127
+ /** §5.4 — see `render.ts`'s `ToolAnswer.refusalSummary` doc for which callers have one. */
128
+ readonly refusalSummary?: {
129
+ readonly count: number;
130
+ readonly exemplar: string;
131
+ readonly handle: string;
132
+ };
133
+ }): ToolAnswer<T>;
134
+ /**
135
+ * An IR node as it appears in a tool reply.
136
+ *
137
+ * The four optional fields are optional in the payload too, not `null` — a
138
+ * node with no file omits the key rather than carrying an empty one, which is
139
+ * what keeps a 1,000-node reply affordable. A caller must therefore test for
140
+ * presence, not for null.
141
+ *
142
+ * `language` is the IR node's own field passed through verbatim. Nothing here
143
+ * or above reads it, branches on it, or knows any value it can take (rule 1);
144
+ * it travels because a developer reading the reply is entitled to see which
145
+ * adapter's evidence a row rests on.
146
+ */
147
+ export interface BriefNode {
148
+ readonly id: string;
149
+ readonly type: string;
150
+ readonly name: string;
151
+ readonly file?: string;
152
+ /** Start line only — a reply carries where to look, not how much to read. */
153
+ readonly line?: number;
154
+ readonly language?: string;
155
+ readonly resolution: number;
156
+ }
157
+ /**
158
+ * What a tool returns when the symbol, path or id it was given resolved to
159
+ * nothing, or to more than one thing.
160
+ *
161
+ * Shared by `impact` and `propagation`, because both go through
162
+ * `resolveOneNode` and both refuse the same way: no answer is computed, and
163
+ * the candidates come back so the caller can narrow rather than guess. An
164
+ * empty `candidates` means nothing matched at all; two or more means the name
165
+ * was ambiguous. One is impossible — that is the case that resolves.
166
+ */
167
+ export interface NodeCandidates {
168
+ readonly candidates: readonly BriefNode[];
169
+ }
170
+ /** Trim an IR node down to what an agent needs, so a 1,000-node reply stays readable. */
171
+ export declare function briefNode(node: {
172
+ id: string;
173
+ type: string;
174
+ name: string;
175
+ file: string | null;
176
+ range: {
177
+ startLine: number;
178
+ endLine: number;
179
+ } | null;
180
+ language: string | null;
181
+ resolution: number;
182
+ }): BriefNode;
183
+ //# sourceMappingURL=kit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kit.d.ts","sourceRoot":"","sources":["../../src/tools/kit.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAEnF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,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AC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1G,GAAG,UAAU,CAAC,CAAC,CAAC,CAoBhB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACrD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,SAAS,CAUZ"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * What every tool is handed and what every tool may return.
3
+ *
4
+ * The return type is `ToolAnswer`, never content. A tool produces an *answer*;
5
+ * `render.ts` is the only thing that turns an answer into a reply, and it
6
+ * attaches the staleness stamp, the reliability cap and the disclosures on the
7
+ * way. A tool physically cannot ship a result with the caveats stripped off.
8
+ */
9
+ /**
10
+ * An argument the caller can fix.
11
+ *
12
+ * Distinct from a thrown `Error`, which is a bug here. This becomes an `isError`
13
+ * tool result the agent can read and retry from; a bug becomes a JSON-RPC
14
+ * internal error, which it cannot.
15
+ */
16
+ export class ToolInputError extends Error {
17
+ constructor(message) {
18
+ super(message);
19
+ this.name = "ToolInputError";
20
+ }
21
+ }
22
+ // --- argument reading -------------------------------------------------------
23
+ // Hand-written rather than schema-validated. The surface is five tools with
24
+ // about a dozen arguments between them; a validator would be a dependency and a
25
+ // second source of truth for the schemas already declared to the client.
26
+ export function optionalString(args, key) {
27
+ const value = args[key];
28
+ if (value === undefined || value === null)
29
+ return undefined;
30
+ if (typeof value !== "string")
31
+ throw new ToolInputError(`"${key}" must be a string`);
32
+ return value;
33
+ }
34
+ export function requiredString(args, key) {
35
+ const value = optionalString(args, key);
36
+ if (value === undefined || value === "")
37
+ throw new ToolInputError(`"${key}" is required`);
38
+ return value;
39
+ }
40
+ export function optionalStringArray(args, key) {
41
+ const value = args[key];
42
+ if (value === undefined || value === null)
43
+ return undefined;
44
+ if (!Array.isArray(value) || value.some((v) => typeof v !== "string")) {
45
+ throw new ToolInputError(`"${key}" must be an array of strings`);
46
+ }
47
+ return value;
48
+ }
49
+ export function optionalInteger(args, key, min) {
50
+ const value = args[key];
51
+ if (value === undefined || value === null)
52
+ return undefined;
53
+ if (typeof value !== "number" || !Number.isInteger(value) || value < min) {
54
+ throw new ToolInputError(`"${key}" must be an integer of at least ${min}`);
55
+ }
56
+ return value;
57
+ }
58
+ export function optionalEnum(args, key, allowed) {
59
+ const value = optionalString(args, key);
60
+ if (value === undefined)
61
+ return undefined;
62
+ if (!allowed.includes(value)) {
63
+ throw new ToolInputError(`"${key}" must be one of: ${allowed.join(", ")}`);
64
+ }
65
+ return value;
66
+ }
67
+ export function optionalBoolean(args, key) {
68
+ const value = args[key];
69
+ if (value === undefined || value === null)
70
+ return undefined;
71
+ if (typeof value !== "boolean")
72
+ throw new ToolInputError(`"${key}" must be a boolean`);
73
+ return value;
74
+ }
75
+ // --- building answers -------------------------------------------------------
76
+ /**
77
+ * Wrap data that did not come from the query layer in the same envelope.
78
+ *
79
+ * `analyze` is the case: it writes rather than reads, so it has no
80
+ * `QueryResult`, and it would be the natural place for the disclosure discipline
81
+ * to leak. It uses this instead, so its reply carries the same stamp and the
82
+ * same rules as every query's.
83
+ */
84
+ export function answer(options) {
85
+ const result = {
86
+ data: options.data,
87
+ stamp: {
88
+ commitSha: options.commitSha,
89
+ graphBuiltAt: options.graphBuiltAt,
90
+ irSchemaVersion: options.irSchemaVersion,
91
+ resolutionFloor: options.resolutionFloor,
92
+ },
93
+ truncated: options.truncated ?? false,
94
+ notes: options.notes,
95
+ };
96
+ return {
97
+ result,
98
+ nameLevel: options.nameLevel,
99
+ headline: options.headline,
100
+ ...(options.state === undefined ? {} : { state: options.state }),
101
+ ...(options.truncatedDetail === undefined ? {} : { truncatedDetail: options.truncatedDetail }),
102
+ ...(options.refusalSummary === undefined ? {} : { refusalSummary: options.refusalSummary }),
103
+ };
104
+ }
105
+ /** Trim an IR node down to what an agent needs, so a 1,000-node reply stays readable. */
106
+ export function briefNode(node) {
107
+ return {
108
+ id: node.id,
109
+ type: node.type,
110
+ name: node.name,
111
+ ...(node.file === null ? {} : { file: node.file }),
112
+ ...(node.range === null ? {} : { line: node.range.startLine }),
113
+ ...(node.language === null ? {} : { language: node.language }),
114
+ resolution: node.resolution,
115
+ };
116
+ }
117
+ //# sourceMappingURL=kit.js.map