@descryy/mcp 0.6.0 → 0.7.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 (260) hide show
  1. package/dist/action-handshake.d.ts +8 -75
  2. package/dist/action-handshake.d.ts.map +1 -1
  3. package/dist/action-handshake.js +9 -79
  4. package/dist/action-handshake.js.map +1 -1
  5. package/dist/bin/descry-mcp.d.ts +4 -15
  6. package/dist/bin/descry-mcp.d.ts.map +1 -1
  7. package/dist/bin/descry-mcp.js +12 -42
  8. package/dist/bin/descry-mcp.js.map +1 -1
  9. package/dist/browser/driver.d.ts +59 -224
  10. package/dist/browser/driver.d.ts.map +1 -1
  11. package/dist/browser/driver.js +9 -55
  12. package/dist/browser/driver.js.map +1 -1
  13. package/dist/browser/evidence.d.ts +10 -43
  14. package/dist/browser/evidence.d.ts.map +1 -1
  15. package/dist/browser/evidence.js +20 -54
  16. package/dist/browser/evidence.js.map +1 -1
  17. package/dist/browser/fake-driver.d.ts +4 -16
  18. package/dist/browser/fake-driver.d.ts.map +1 -1
  19. package/dist/browser/fake-driver.js +6 -20
  20. package/dist/browser/fake-driver.js.map +1 -1
  21. package/dist/browser/graph-write.d.ts +4 -45
  22. package/dist/browser/graph-write.d.ts.map +1 -1
  23. package/dist/browser/graph-write.js +8 -53
  24. package/dist/browser/graph-write.js.map +1 -1
  25. package/dist/browser/playwright-driver.d.ts +7 -91
  26. package/dist/browser/playwright-driver.d.ts.map +1 -1
  27. package/dist/browser/playwright-driver.js +40 -194
  28. package/dist/browser/playwright-driver.js.map +1 -1
  29. package/dist/browser/provider.d.ts +5 -34
  30. package/dist/browser/provider.d.ts.map +1 -1
  31. package/dist/browser/provider.js +4 -24
  32. package/dist/browser/provider.js.map +1 -1
  33. package/dist/browser/registry.d.ts +26 -106
  34. package/dist/browser/registry.d.ts.map +1 -1
  35. package/dist/browser/registry.js +20 -77
  36. package/dist/browser/registry.js.map +1 -1
  37. package/dist/browser/scenario-resolve.d.ts +10 -44
  38. package/dist/browser/scenario-resolve.d.ts.map +1 -1
  39. package/dist/browser/scenario-resolve.js +10 -41
  40. package/dist/browser/scenario-resolve.js.map +1 -1
  41. package/dist/browser/scenario-runner.d.ts +12 -70
  42. package/dist/browser/scenario-runner.d.ts.map +1 -1
  43. package/dist/browser/scenario-runner.js +30 -90
  44. package/dist/browser/scenario-runner.js.map +1 -1
  45. package/dist/browser/stack-parser.d.ts +4 -28
  46. package/dist/browser/stack-parser.d.ts.map +1 -1
  47. package/dist/browser/stack-parser.js +12 -39
  48. package/dist/browser/stack-parser.js.map +1 -1
  49. package/dist/browser/tool-support.d.ts +20 -67
  50. package/dist/browser/tool-support.d.ts.map +1 -1
  51. package/dist/browser/tool-support.js +21 -65
  52. package/dist/browser/tool-support.js.map +1 -1
  53. package/dist/browser/url-scheme.d.ts +14 -0
  54. package/dist/browser/url-scheme.d.ts.map +1 -0
  55. package/dist/browser/url-scheme.js +38 -0
  56. package/dist/browser/url-scheme.js.map +1 -0
  57. package/dist/cancellation.d.ts +11 -46
  58. package/dist/cancellation.d.ts.map +1 -1
  59. package/dist/cancellation.js +11 -46
  60. package/dist/cancellation.js.map +1 -1
  61. package/dist/capped.d.ts +9 -33
  62. package/dist/capped.d.ts.map +1 -1
  63. package/dist/capped.js +7 -27
  64. package/dist/capped.js.map +1 -1
  65. package/dist/disclosure-ledger.d.ts +6 -30
  66. package/dist/disclosure-ledger.d.ts.map +1 -1
  67. package/dist/disclosure-ledger.js +4 -26
  68. package/dist/disclosure-ledger.js.map +1 -1
  69. package/dist/index.d.ts +10 -26
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +7 -17
  72. package/dist/index.js.map +1 -1
  73. package/dist/module-trust.d.ts +24 -0
  74. package/dist/module-trust.d.ts.map +1 -0
  75. package/dist/module-trust.js +60 -0
  76. package/dist/module-trust.js.map +1 -0
  77. package/dist/path-confinement.d.ts +31 -0
  78. package/dist/path-confinement.d.ts.map +1 -0
  79. package/dist/path-confinement.js +44 -0
  80. package/dist/path-confinement.js.map +1 -0
  81. package/dist/protocol.d.ts +10 -53
  82. package/dist/protocol.d.ts.map +1 -1
  83. package/dist/protocol.js +14 -60
  84. package/dist/protocol.js.map +1 -1
  85. package/dist/registry.d.ts +10 -58
  86. package/dist/registry.d.ts.map +1 -1
  87. package/dist/registry.js +38 -90
  88. package/dist/registry.js.map +1 -1
  89. package/dist/render.d.ts +42 -11
  90. package/dist/render.d.ts.map +1 -1
  91. package/dist/render.js +74 -10
  92. package/dist/render.js.map +1 -1
  93. package/dist/runtime-registry.d.ts +7 -66
  94. package/dist/runtime-registry.d.ts.map +1 -1
  95. package/dist/runtime-registry.js +39 -114
  96. package/dist/runtime-registry.js.map +1 -1
  97. package/dist/scenarios/index.d.ts +1 -1
  98. package/dist/scenarios/index.d.ts.map +1 -1
  99. package/dist/scenarios/index.js +1 -1
  100. package/dist/scenarios/index.js.map +1 -1
  101. package/dist/scenarios/parse.d.ts +4 -18
  102. package/dist/scenarios/parse.d.ts.map +1 -1
  103. package/dist/scenarios/parse.js +14 -34
  104. package/dist/scenarios/parse.js.map +1 -1
  105. package/dist/scenarios/scenario.d.ts +18 -74
  106. package/dist/scenarios/scenario.d.ts.map +1 -1
  107. package/dist/scenarios/scenario.js +7 -34
  108. package/dist/scenarios/scenario.js.map +1 -1
  109. package/dist/scenarios/storage.d.ts +11 -41
  110. package/dist/scenarios/storage.d.ts.map +1 -1
  111. package/dist/scenarios/storage.js +57 -47
  112. package/dist/scenarios/storage.js.map +1 -1
  113. package/dist/server.d.ts.map +1 -1
  114. package/dist/server.js +37 -17
  115. package/dist/server.js.map +1 -1
  116. package/dist/session.d.ts +67 -259
  117. package/dist/session.d.ts.map +1 -1
  118. package/dist/session.js +69 -250
  119. package/dist/session.js.map +1 -1
  120. package/dist/tools/analyze.d.ts +24 -118
  121. package/dist/tools/analyze.d.ts.map +1 -1
  122. package/dist/tools/analyze.js +44 -166
  123. package/dist/tools/analyze.js.map +1 -1
  124. package/dist/tools/browser-click.d.ts +3 -21
  125. package/dist/tools/browser-click.d.ts.map +1 -1
  126. package/dist/tools/browser-click.js +10 -31
  127. package/dist/tools/browser-click.js.map +1 -1
  128. package/dist/tools/browser-close-session.d.ts +4 -13
  129. package/dist/tools/browser-close-session.d.ts.map +1 -1
  130. package/dist/tools/browser-close-session.js +4 -13
  131. package/dist/tools/browser-close-session.js.map +1 -1
  132. package/dist/tools/browser-fill.d.ts +5 -36
  133. package/dist/tools/browser-fill.d.ts.map +1 -1
  134. package/dist/tools/browser-fill.js +9 -44
  135. package/dist/tools/browser-fill.js.map +1 -1
  136. package/dist/tools/browser-navigate.d.ts +6 -27
  137. package/dist/tools/browser-navigate.d.ts.map +1 -1
  138. package/dist/tools/browser-navigate.js +6 -23
  139. package/dist/tools/browser-navigate.js.map +1 -1
  140. package/dist/tools/browser-run-scenario.d.ts +5 -31
  141. package/dist/tools/browser-run-scenario.d.ts.map +1 -1
  142. package/dist/tools/browser-run-scenario.js +10 -46
  143. package/dist/tools/browser-run-scenario.js.map +1 -1
  144. package/dist/tools/browser-save-scenario.d.ts +3 -28
  145. package/dist/tools/browser-save-scenario.d.ts.map +1 -1
  146. package/dist/tools/browser-save-scenario.js +15 -74
  147. package/dist/tools/browser-save-scenario.js.map +1 -1
  148. package/dist/tools/browser-snapshot.d.ts +6 -39
  149. package/dist/tools/browser-snapshot.d.ts.map +1 -1
  150. package/dist/tools/browser-snapshot.js +4 -31
  151. package/dist/tools/browser-snapshot.js.map +1 -1
  152. package/dist/tools/browser-start-session.d.ts +4 -23
  153. package/dist/tools/browser-start-session.d.ts.map +1 -1
  154. package/dist/tools/browser-start-session.js +33 -55
  155. package/dist/tools/browser-start-session.js.map +1 -1
  156. package/dist/tools/browser-type.d.ts +5 -35
  157. package/dist/tools/browser-type.d.ts.map +1 -1
  158. package/dist/tools/browser-type.js +10 -45
  159. package/dist/tools/browser-type.js.map +1 -1
  160. package/dist/tools/contracts.d.ts +9 -86
  161. package/dist/tools/contracts.d.ts.map +1 -1
  162. package/dist/tools/contracts.js +24 -80
  163. package/dist/tools/contracts.js.map +1 -1
  164. package/dist/tools/cross-pr.d.ts +42 -30
  165. package/dist/tools/cross-pr.d.ts.map +1 -1
  166. package/dist/tools/cross-pr.js +81 -62
  167. package/dist/tools/cross-pr.js.map +1 -1
  168. package/dist/tools/git-diff.d.ts +18 -2
  169. package/dist/tools/git-diff.d.ts.map +1 -1
  170. package/dist/tools/git-diff.js +118 -26
  171. package/dist/tools/git-diff.js.map +1 -1
  172. package/dist/tools/git-history.d.ts +5 -16
  173. package/dist/tools/git-history.d.ts.map +1 -1
  174. package/dist/tools/git-history.js +3 -10
  175. package/dist/tools/git-history.js.map +1 -1
  176. package/dist/tools/history.d.ts +4 -33
  177. package/dist/tools/history.d.ts.map +1 -1
  178. package/dist/tools/history.js +6 -31
  179. package/dist/tools/history.js.map +1 -1
  180. package/dist/tools/impact.d.ts +7 -51
  181. package/dist/tools/impact.d.ts.map +1 -1
  182. package/dist/tools/impact.js +15 -67
  183. package/dist/tools/impact.js.map +1 -1
  184. package/dist/tools/index.d.ts +3 -8
  185. package/dist/tools/index.d.ts.map +1 -1
  186. package/dist/tools/index.js +3 -8
  187. package/dist/tools/index.js.map +1 -1
  188. package/dist/tools/kit.d.ts +66 -113
  189. package/dist/tools/kit.d.ts.map +1 -1
  190. package/dist/tools/kit.js +60 -28
  191. package/dist/tools/kit.js.map +1 -1
  192. package/dist/tools/link-workspace.d.ts +7 -45
  193. package/dist/tools/link-workspace.d.ts.map +1 -1
  194. package/dist/tools/link-workspace.js +10 -48
  195. package/dist/tools/link-workspace.js.map +1 -1
  196. package/dist/tools/lookup.d.ts +4 -14
  197. package/dist/tools/lookup.d.ts.map +1 -1
  198. package/dist/tools/lookup.js +4 -14
  199. package/dist/tools/lookup.js.map +1 -1
  200. package/dist/tools/mark-incident.d.ts +7 -54
  201. package/dist/tools/mark-incident.d.ts.map +1 -1
  202. package/dist/tools/mark-incident.js +15 -68
  203. package/dist/tools/mark-incident.js.map +1 -1
  204. package/dist/tools/observe-runtime.d.ts +27 -210
  205. package/dist/tools/observe-runtime.d.ts.map +1 -1
  206. package/dist/tools/observe-runtime.js +257 -435
  207. package/dist/tools/observe-runtime.js.map +1 -1
  208. package/dist/tools/observe-tests.d.ts +9 -100
  209. package/dist/tools/observe-tests.d.ts.map +1 -1
  210. package/dist/tools/observe-tests.js +24 -152
  211. package/dist/tools/observe-tests.js.map +1 -1
  212. package/dist/tools/pr-analysis.d.ts +18 -2
  213. package/dist/tools/pr-analysis.d.ts.map +1 -1
  214. package/dist/tools/pr-analysis.js +73 -23
  215. package/dist/tools/pr-analysis.js.map +1 -1
  216. package/dist/tools/pre-push.d.ts +68 -16
  217. package/dist/tools/pre-push.d.ts.map +1 -1
  218. package/dist/tools/pre-push.js +98 -35
  219. package/dist/tools/pre-push.js.map +1 -1
  220. package/dist/tools/propagation.d.ts +11 -53
  221. package/dist/tools/propagation.d.ts.map +1 -1
  222. package/dist/tools/propagation.js +14 -57
  223. package/dist/tools/propagation.js.map +1 -1
  224. package/dist/tools/questions.d.ts +13 -63
  225. package/dist/tools/questions.d.ts.map +1 -1
  226. package/dist/tools/questions.js +33 -105
  227. package/dist/tools/questions.js.map +1 -1
  228. package/dist/tools/refusal-fetch.d.ts +4 -40
  229. package/dist/tools/refusal-fetch.d.ts.map +1 -1
  230. package/dist/tools/refusal-fetch.js +4 -40
  231. package/dist/tools/refusal-fetch.js.map +1 -1
  232. package/dist/tools/runtime-incident.d.ts +4 -63
  233. package/dist/tools/runtime-incident.d.ts.map +1 -1
  234. package/dist/tools/runtime-incident.js +10 -87
  235. package/dist/tools/runtime-incident.js.map +1 -1
  236. package/dist/tools/scope.d.ts +7 -25
  237. package/dist/tools/scope.d.ts.map +1 -1
  238. package/dist/tools/scope.js +10 -29
  239. package/dist/tools/scope.js.map +1 -1
  240. package/dist/tools/similar-incidents.d.ts +11 -86
  241. package/dist/tools/similar-incidents.d.ts.map +1 -1
  242. package/dist/tools/similar-incidents.js +7 -71
  243. package/dist/tools/similar-incidents.js.map +1 -1
  244. package/dist/tools/validate.d.ts +14 -69
  245. package/dist/tools/validate.d.ts.map +1 -1
  246. package/dist/tools/validate.js +23 -74
  247. package/dist/tools/validate.js.map +1 -1
  248. package/dist/tools/verification-status.d.ts +9 -64
  249. package/dist/tools/verification-status.d.ts.map +1 -1
  250. package/dist/tools/verification-status.js +9 -62
  251. package/dist/tools/verification-status.js.map +1 -1
  252. package/dist/tools/verify-claim.d.ts +5 -52
  253. package/dist/tools/verify-claim.d.ts.map +1 -1
  254. package/dist/tools/verify-claim.js +6 -56
  255. package/dist/tools/verify-claim.js.map +1 -1
  256. package/dist/transport.d.ts +15 -52
  257. package/dist/transport.d.ts.map +1 -1
  258. package/dist/transport.js +16 -60
  259. package/dist/transport.js.map +1 -1
  260. package/package.json +30 -21
@@ -1,44 +1,8 @@
1
1
  /**
2
- * `refusal_fetch` — the fourteenth endpoint (`ai-layer-plan.md` §3), and the
3
- * new work that endpoint's own re-derivation pointed at. §4 technique 4:
4
- * *"Refusals summarised, never enumerated. A count, one verbatim exemplar, a
5
- * handle to fetch the rest."*
6
- *
7
- * The logic underneath — `summariseRefusals`/`fetchRefusalPage`
8
- * (`@descryy/core`'s `query/refusal-fetch.ts`) — is already built and
9
- * unit-tested; this is the tool boundary its own header names as still open:
10
- * *"An MCP surface that wants a prettier, shorter token... is free to wrap
11
- * this — that is a presentation choice for P27."* No wrapping was needed —
12
- * the handle is already opaque and self-describing — so this tool is thin:
13
- * read the population, hand it to whichever of the two functions the call
14
- * shape asks for.
15
- *
16
- * ## Two calls, one tool — same pattern `questions.ts` already uses
17
- *
18
- * No `handle` argument → a fresh summary (`summariseRefusals`): cheap, one
19
- * count, one exemplar, a handle. A `handle` argument → redeem it for a real
20
- * page (`fetchRefusalPage`). This mirrors `questions.ts`'s own "no `answer`
21
- * argument is a pure read" split rather than inventing a second shape.
22
- *
23
- * ## The call-site trap this tool must not reproduce
24
- *
25
- * `refusal-fetch.ts`'s own header names it explicitly: the store reader
26
- * defaults to `classified: true`, which silently drops every unclassified
27
- * row (DEC-243's grouper only wants the classifiable subset). This tool
28
- * always asks for `{ classified: false }` — the complete ledger, classified
29
- * and unclassified alike — because a `refusal_fetch` that only showed the
30
- * askable subset would be the empty-denominator defect wearing this
31
- * technique's clothes, exactly what that module's header warns against.
32
- *
33
- * ## No cap on the population read
34
- *
35
- * `provider.unresolvedRefs({ classified: false })` is called with no
36
- * `limit` — the handle's population fingerprint has to be stable between the
37
- * summary call and every page redemption, and a capped read here would make
38
- * "the ledger changed" indistinguishable from "the cap sampled differently
39
- * this time." Correctness over a cheap shortcut, same choice `refusal-fetch.ts`
40
- * itself already made.
41
- */
2
+ * `refusal_fetch` — §4 technique 4: summarise, never enumerate (count, exemplar,
3
+ * handle). No `handle` → fresh summary; `handle` → redeem a page (mirrors
4
+ * `questions.ts`). Always reads `{classified: false}` — the default `true` would
5
+ * silently drop unclassified rows (DEC-243). No `limit`: the population must stay stable. */
42
6
  import { type ToolDefinition } from "./kit.ts";
43
7
  export interface RefusalFetchSummaryItem {
44
8
  readonly fromNodeId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-fetch.d.ts","sourceRoot":"","sources":["../../src/tools/refusal-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAIH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,UAAU,CAAC;AAqBlB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM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AED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,qGAAqG;IACrG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uGAAuG;IACvG,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACnD,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yDAAyD;IACzD,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;AAkF9E,eAAO,MAAM,gBAAgB,EAAE,cAe9B,CAAC"}
@@ -1,44 +1,8 @@
1
1
  /**
2
- * `refusal_fetch` — the fourteenth endpoint (`ai-layer-plan.md` §3), and the
3
- * new work that endpoint's own re-derivation pointed at. §4 technique 4:
4
- * *"Refusals summarised, never enumerated. A count, one verbatim exemplar, a
5
- * handle to fetch the rest."*
6
- *
7
- * The logic underneath — `summariseRefusals`/`fetchRefusalPage`
8
- * (`@descryy/core`'s `query/refusal-fetch.ts`) — is already built and
9
- * unit-tested; this is the tool boundary its own header names as still open:
10
- * *"An MCP surface that wants a prettier, shorter token... is free to wrap
11
- * this — that is a presentation choice for P27."* No wrapping was needed —
12
- * the handle is already opaque and self-describing — so this tool is thin:
13
- * read the population, hand it to whichever of the two functions the call
14
- * shape asks for.
15
- *
16
- * ## Two calls, one tool — same pattern `questions.ts` already uses
17
- *
18
- * No `handle` argument → a fresh summary (`summariseRefusals`): cheap, one
19
- * count, one exemplar, a handle. A `handle` argument → redeem it for a real
20
- * page (`fetchRefusalPage`). This mirrors `questions.ts`'s own "no `answer`
21
- * argument is a pure read" split rather than inventing a second shape.
22
- *
23
- * ## The call-site trap this tool must not reproduce
24
- *
25
- * `refusal-fetch.ts`'s own header names it explicitly: the store reader
26
- * defaults to `classified: true`, which silently drops every unclassified
27
- * row (DEC-243's grouper only wants the classifiable subset). This tool
28
- * always asks for `{ classified: false }` — the complete ledger, classified
29
- * and unclassified alike — because a `refusal_fetch` that only showed the
30
- * askable subset would be the empty-denominator defect wearing this
31
- * technique's clothes, exactly what that module's header warns against.
32
- *
33
- * ## No cap on the population read
34
- *
35
- * `provider.unresolvedRefs({ classified: false })` is called with no
36
- * `limit` — the handle's population fingerprint has to be stable between the
37
- * summary call and every page redemption, and a capped read here would make
38
- * "the ledger changed" indistinguishable from "the cap sampled differently
39
- * this time." Correctness over a cheap shortcut, same choice `refusal-fetch.ts`
40
- * itself already made.
41
- */
2
+ * `refusal_fetch` — §4 technique 4: summarise, never enumerate (count, exemplar,
3
+ * handle). No `handle` → fresh summary; `handle` → redeem a page (mirrors
4
+ * `questions.ts`). Always reads `{classified: false}` — the default `true` would
5
+ * silently drop unclassified rows (DEC-243). No `limit`: the population must stay stable. */
42
6
  import { fetchRefusalPage, summariseRefusals } from "@descryy/core";
43
7
  import { answer, optionalInteger, optionalString, } from "./kit.js";
44
8
  const SCHEMA = {
@@ -1 +1 @@
1
- {"version":3,"file":"refusal-fetch.js","sourceRoot":"","sources":["../../src/tools/refusal-fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,EACL,MAAM,EACN,eAAe,EACf,cAAc,GAGf,MAAM,UAAU,CAAC;AAGlB,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;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AAE,EAAE;QACT,IAAI,EAAE;YACJ,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;YAC5B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,4CAA4C;IACnD,WAAW,EACT,8FAA8F;QAC9F,iGAAiG;QACjG,+FAA+F;QAC/F,8FAA8F;QAC9F,4FAA4F;QAC5F,kCAAkC;IACpC,WAAW,EAAE,MAA4C;IACzD,GAAG;CACJ,CAAC"}
@@ -1,59 +1,7 @@
1
1
  /**
2
- * A service that died during an observed run, recorded as an incident.
3
- *
4
- * The fifth and last incident mechanism — and the only one whose evidence is a
5
- * machine's rather than a person's. `observe_runtime` already spawns real
6
- * processes and watches them; a process that exits non-zero or takes a fatal
7
- * signal really did fail, and that is a fact about the world in the same class
8
- * as the R4 edges that tool already writes.
9
- *
10
- * ## An exception is not an incident, and this is where that bites hardest
11
- *
12
- * The obvious design — every `EXCEPTION` becomes an incident — is wrong and
13
- * would be the worst instance of the pollution the whole incident ruling is
14
- * about. A caught, expected error during a run Descry itself provoked is not a
15
- * production failure, and `INCIDENT` is an EARNED-class claim that biases diff
16
- * scoping permanently. The conformance fixture prints a real `Error.stack` on a
17
- * timer precisely to have caught exceptions in the stream, and none of them may
18
- * mint anything.
19
- *
20
- * So the qualifying condition is about the **process**, not the log:
21
- *
22
- * - a non-zero exit code, or
23
- * - a fatal signal Descry did not send.
24
- *
25
- * The second half needs care, because Descry's own teardown *is* a signal.
26
- * `SIGTERM` at the end of an observation window is the orchestrator stopping a
27
- * healthy service, and reading it as a crash would make every successful run
28
- * mint an incident. Only the signals a process takes when it dies of its own
29
- * accord count — see `FATAL_SIGNALS`.
30
- *
31
- * ## What the incident is correlated to, and what that claim is
32
- *
33
- * Every file named by an `EXCEPTION` source location observed during the run.
34
- * That is deliberately *not* "the cause": nothing here knows which exception
35
- * killed the process, and picking the last one would be recency standing in for
36
- * causality. The honest claim, and the one the record's own summary makes, is
37
- * **"these files were implicated in a run in which this service died"** — real,
38
- * checkable, and weaker than a root cause.
39
- *
40
- * This is also better than the ruling predicted.
41
- * `DEC-NEXT-collector-evidence-carries-no-service-name` blocks the *correlator*
42
- * from resolving symbol evidence, so the decision expected this mechanism to
43
- * mint an incident with no file edges at all. It does not need the correlator:
44
- * `Evidence.sourceLocation.file` is an absolute path the adapter already
45
- * parsed, and turning it into a repo-relative one is a subtraction, not a
46
- * resolution.
47
- *
48
- * ## Durability
49
- *
50
- * Written as a `ConfirmedIncident` carrying `observedInRun`, which is what the
51
- * projecting source reads to stamp `detectedVia: "runtime-observed"`. A run is
52
- * gone once the process exits, so the record cannot live only in a store that
53
- * DEC-017 drops on the next schema bump — the same argument that put a
54
- * developer's testimony in `.descry/config.json`, reached from the other side.
55
- *
56
- * See `DEC-NEXT-incident-minting-beyond-explicit-reverts`.
2
+ * Mints an `INCIDENT` from `observe_runtime`'s process exit/signal, never
3
+ * from `EXCEPTION` events (a caught, provoked error isn't a failure).
4
+ * Correlates to files an exception named — "implicated", not "caused". See `DEC-NEXT-incident-minting-beyond-explicit-reverts`.
57
5
  */
58
6
  import type { ConfirmedIncident } from "@descryy/ir";
59
7
  /** One observed service, in the shape `observe_runtime` already reports. */
@@ -80,13 +28,6 @@ export interface RuntimeIncidentInput {
80
28
  }
81
29
  /** Whether this service's exit is a failure rather than Descry stopping it. */
82
30
  export declare function died(outcome: ObservedProcessOutcome): boolean;
83
- /**
84
- * The incident a run witnessed, or `null` when every service exited cleanly —
85
- * which is the overwhelmingly common case and is not a finding.
86
- *
87
- * One record per run, not one per dead service: a run in which two services
88
- * died is one failure of one system observed once, and minting two would double
89
- * its weight in every ranking that counts incidents.
90
- */
31
+ /** The incident a run witnessed, or null when every service exited cleanly (the common case, not a finding). One record per run, not per dead service — two deaths are one system failure, not two. */
91
32
  export declare function runtimeObservedIncident(input: RuntimeIncidentInput): ConfirmedIncident | null;
92
33
  //# sourceMappingURL=runtime-incident.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-incident.d.ts","sourceRoot":"","sources":["../../src/tools/runtime-incident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAmBrD,4EAA4E;AAC5E,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,4EAA4E;AAC5E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACrD,iFAAiF;IACjF,QAAQ,CAAC,kBAAkB,EAAE,SAAS,yBAAyB,EAAE,CAAC;IAClE,kFAAkF;IAClF,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,+EAA+E;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K,EAAE,oBAAoB,GAAG,iBAAiB,GAAG,IAAI,CAkC7F"}
@@ -1,69 +1,10 @@
1
1
  /**
2
- * A service that died during an observed run, recorded as an incident.
3
- *
4
- * The fifth and last incident mechanism — and the only one whose evidence is a
5
- * machine's rather than a person's. `observe_runtime` already spawns real
6
- * processes and watches them; a process that exits non-zero or takes a fatal
7
- * signal really did fail, and that is a fact about the world in the same class
8
- * as the R4 edges that tool already writes.
9
- *
10
- * ## An exception is not an incident, and this is where that bites hardest
11
- *
12
- * The obvious design — every `EXCEPTION` becomes an incident — is wrong and
13
- * would be the worst instance of the pollution the whole incident ruling is
14
- * about. A caught, expected error during a run Descry itself provoked is not a
15
- * production failure, and `INCIDENT` is an EARNED-class claim that biases diff
16
- * scoping permanently. The conformance fixture prints a real `Error.stack` on a
17
- * timer precisely to have caught exceptions in the stream, and none of them may
18
- * mint anything.
19
- *
20
- * So the qualifying condition is about the **process**, not the log:
21
- *
22
- * - a non-zero exit code, or
23
- * - a fatal signal Descry did not send.
24
- *
25
- * The second half needs care, because Descry's own teardown *is* a signal.
26
- * `SIGTERM` at the end of an observation window is the orchestrator stopping a
27
- * healthy service, and reading it as a crash would make every successful run
28
- * mint an incident. Only the signals a process takes when it dies of its own
29
- * accord count — see `FATAL_SIGNALS`.
30
- *
31
- * ## What the incident is correlated to, and what that claim is
32
- *
33
- * Every file named by an `EXCEPTION` source location observed during the run.
34
- * That is deliberately *not* "the cause": nothing here knows which exception
35
- * killed the process, and picking the last one would be recency standing in for
36
- * causality. The honest claim, and the one the record's own summary makes, is
37
- * **"these files were implicated in a run in which this service died"** — real,
38
- * checkable, and weaker than a root cause.
39
- *
40
- * This is also better than the ruling predicted.
41
- * `DEC-NEXT-collector-evidence-carries-no-service-name` blocks the *correlator*
42
- * from resolving symbol evidence, so the decision expected this mechanism to
43
- * mint an incident with no file edges at all. It does not need the correlator:
44
- * `Evidence.sourceLocation.file` is an absolute path the adapter already
45
- * parsed, and turning it into a repo-relative one is a subtraction, not a
46
- * resolution.
47
- *
48
- * ## Durability
49
- *
50
- * Written as a `ConfirmedIncident` carrying `observedInRun`, which is what the
51
- * projecting source reads to stamp `detectedVia: "runtime-observed"`. A run is
52
- * gone once the process exits, so the record cannot live only in a store that
53
- * DEC-017 drops on the next schema bump — the same argument that put a
54
- * developer's testimony in `.descry/config.json`, reached from the other side.
55
- *
56
- * See `DEC-NEXT-incident-minting-beyond-explicit-reverts`.
2
+ * Mints an `INCIDENT` from `observe_runtime`'s process exit/signal, never
3
+ * from `EXCEPTION` events (a caught, provoked error isn't a failure).
4
+ * Correlates to files an exception named — "implicated", not "caused". See `DEC-NEXT-incident-minting-beyond-explicit-reverts`.
57
5
  */
58
6
  import { isAbsolute, relative } from "node:path";
59
- /**
60
- * Signals a process takes when it dies of its own accord.
61
- *
62
- * `SIGTERM` and `SIGINT` are absent on purpose: those are what an orchestrator
63
- * sends to stop a healthy service, and Descry's own teardown sends the first
64
- * one at the end of every observation window. Counting them would make a
65
- * successful run mint an incident, every time.
66
- */
7
+ /** Signals a process takes when it dies on its own; SIGTERM/SIGINT excluded on purpose — Descry's own teardown sends SIGTERM, and counting it would mint an incident on every successful run. */
67
8
  const FATAL_SIGNALS = new Set([
68
9
  "SIGSEGV",
69
10
  "SIGABRT",
@@ -80,13 +21,7 @@ export function died(outcome) {
80
21
  return true;
81
22
  return outcome.signal !== null && FATAL_SIGNALS.has(outcome.signal);
82
23
  }
83
- /**
84
- * Repo-relative, and only when the path really is inside the repository.
85
- *
86
- * A stack frame in `node_modules` or in the runtime's own internals names a
87
- * real file that is not this repository's, and correlating an incident to it
88
- * would attach the failure to code the developer cannot change.
89
- */
24
+ /** Repo-relative path, only when truly inside the repo — a `node_modules`/runtime-internal frame names code the developer can't change, so correlating to it would misattribute the failure. */
90
25
  function insideRepo(repoRoot, file) {
91
26
  if (!isAbsolute(file))
92
27
  return file.includes("node_modules") ? null : file;
@@ -97,14 +32,7 @@ function insideRepo(repoRoot, file) {
97
32
  return null;
98
33
  return rel;
99
34
  }
100
- /**
101
- * The incident a run witnessed, or `null` when every service exited cleanly —
102
- * which is the overwhelmingly common case and is not a finding.
103
- *
104
- * One record per run, not one per dead service: a run in which two services
105
- * died is one failure of one system observed once, and minting two would double
106
- * its weight in every ranking that counts incidents.
107
- */
35
+ /** The incident a run witnessed, or null when every service exited cleanly (the common case, not a finding). One record per run, not per dead service — two deaths are one system failure, not two. */
108
36
  export function runtimeObservedIncident(input) {
109
37
  const dead = input.services.filter(died);
110
38
  if (dead.length === 0)
@@ -114,10 +42,8 @@ export function runtimeObservedIncident(input) {
114
42
  .map((location) => (location.file === null ? null : insideRepo(input.repoRoot, location.file)))
115
43
  .filter((path) => path !== null && path !== "")),
116
44
  ].sort();
117
- // No file the repository owns means nothing to attach the incident to, and a
118
- // record naming no file is invisible to every query that looks for one. The
119
- // death is still reported in the tool's own counts — this returns no record
120
- // rather than an unfindable one.
45
+ // No owned file means nothing to attach to, and an unfindable record is
46
+ // worse than none — the death is still reported in the tool's own counts.
121
47
  if (files.length === 0)
122
48
  return null;
123
49
  const names = dead.map((d) => d.service).sort();
@@ -126,13 +52,10 @@ export function runtimeObservedIncident(input) {
126
52
  .join(", ");
127
53
  return {
128
54
  repo: input.repo,
129
- // States what was witnessed and nothing more. Not "X is broken" — a run
130
- // that provoked a crash has established that the crash happened, not what
131
- // is wrong.
55
+ // States only what was witnessed: the crash happened, not what's wrong.
132
56
  summary: `observed run: ${how}`,
133
57
  files,
134
- // The message-similarity signal's input, which is what makes a future
135
- // failure with the same error text match this one at all.
58
+ // Input to the message-similarity signal — matches a future failure with the same error text.
136
59
  ...(input.exceptionTexts.length === 0
137
60
  ? {}
138
61
  : { errorText: [...new Set(input.exceptionTexts)].slice(0, 5).join(" | ").slice(0, 2_000) }),
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-incident.js","sourceRoot":"","sources":["../../src/tools/runtime-incident.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI;SACb,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;SAC/G,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,wEAAwE;QACxE,OAAO,EAAE,iBAAiB,GAAG,EAAE;QAC/B,KAAK;QACL,8FAA8F;QAC9F,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAC9F,WAAW,EAAE,oBAAoB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QACpD,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE;QACxD,aAAa,EAAE,KAAK,CAAC,KAAK;KAC3B,CAAC;AACJ,CAAC"}
@@ -1,20 +1,8 @@
1
1
  /**
2
- * `scope` — "I am about to change this. What else does it touch?"
3
- *
4
- * §12.5's diff scoping, exposed. Expansion stops on **score**, not hop count:
5
- * a delete reaching a payment gateway four hops out matters and a logging import
6
- * one hop out does not, and hop-count scoping cannot tell those apart.
7
- *
8
- * ## Files in, node ids out — and the misses are part of the answer
9
- *
10
- * A developer names files; scoping seeds on nodes. A path in the request that
11
- * the graph has never heard of is the interesting case, and it has two very
12
- * different causes that look identical from here: the file is not analysable by
13
- * any configured adapter, or the graph is stale and predates the file. Both mean
14
- * the blast radius omits it, so both are disclosed. Reporting "0 affected" for a
15
- * file the graph does not contain would be the exact confirmed-clean-versus-not-
16
- * analysable collapse §20.2 exists to prevent.
17
- */
2
+ * `scope` — §12.5 diff scoping: what else does this change touch? Expansion stops
3
+ * on score, not hop count — a payment gateway 4 hops out matters, a logging import
4
+ * 1 hop out doesn't. A file the graph never heard of has two causes (not analysable,
5
+ * or stale graph) — both disclosed, never reported as "0 affected" (§20.2's collapse). */
18
6
  import { type ScopeTier } from "@descryy/core";
19
7
  import type { EdgeType } from "@descryy/ir";
20
8
  import { type BriefNode, type ToolDefinition } from "./kit.ts";
@@ -41,15 +29,9 @@ export interface ScopeReport {
41
29
  readonly budgetUsed: number;
42
30
  readonly byTier: readonly ScopeTierCount[];
43
31
  }
44
- /**
45
- * Nothing the caller named is in the graph, so the traversal never ran.
46
- *
47
- * A genuinely different shape rather than a `ScopeReport` full of zeroes, and
48
- * the absent keys are the tell: there is no `budget` because nothing was
49
- * spent, and no `affectedTotal` because nothing was counted. `changed` and
50
- * `affected` are always empty here and `seeds` is always 0 — narrow on
51
- * `"seeds" in data`.
52
- */
32
+ /** Nothing named resolved into the graph, so the traversal never ran — a different
33
+ * shape, not a zeroed `ScopeReport`: no `budget`/`affectedTotal` because nothing ran.
34
+ * Narrow on `"seeds" in data`. */
53
35
  export interface ScopeNotSeeded {
54
36
  readonly changed: readonly ScopedNodeReport[];
55
37
  readonly affected: readonly ScopedNodeReport[];
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,E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,SAAS,gBAAgB,EAAE,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,cAAc,CAAC;AAmKrD,eAAO,MAAM,SAAS,EAAE,cAavB,CAAC"}
@@ -1,20 +1,8 @@
1
1
  /**
2
- * `scope` — "I am about to change this. What else does it touch?"
3
- *
4
- * §12.5's diff scoping, exposed. Expansion stops on **score**, not hop count:
5
- * a delete reaching a payment gateway four hops out matters and a logging import
6
- * one hop out does not, and hop-count scoping cannot tell those apart.
7
- *
8
- * ## Files in, node ids out — and the misses are part of the answer
9
- *
10
- * A developer names files; scoping seeds on nodes. A path in the request that
11
- * the graph has never heard of is the interesting case, and it has two very
12
- * different causes that look identical from here: the file is not analysable by
13
- * any configured adapter, or the graph is stale and predates the file. Both mean
14
- * the blast radius omits it, so both are disclosed. Reporting "0 affected" for a
15
- * file the graph does not contain would be the exact confirmed-clean-versus-not-
16
- * analysable collapse §20.2 exists to prevent.
17
- */
2
+ * `scope` — §12.5 diff scoping: what else does this change touch? Expansion stops
3
+ * on score, not hop count — a payment gateway 4 hops out matters, a logging import
4
+ * 1 hop out doesn't. A file the graph never heard of has two causes (not analysable,
5
+ * or stale graph) — both disclosed, never reported as "0 affected" (§20.2's collapse). */
18
6
  import { nodesInFiles, scopeChange } from "@descryy/core";
19
7
  import { answer, briefNode, optionalEnum, optionalInteger, optionalStringArray, ToolInputError, } from "./kit.js";
20
8
  import { capped } from "../capped.js";
@@ -114,12 +102,9 @@ async function run(args, ctx) {
114
102
  ...(budget === undefined ? {} : { budget }),
115
103
  });
116
104
  const affected = scoped.data.affected;
117
- // B6 — `capped()` produces the slice and its shown/total detail together,
118
- // so this reply cannot cap without carrying what it capped. Previously this
119
- // sliced by hand and only ever updated the prose note (below); `truncated`
120
- // and `truncatedDetail` were never set, so `render.ts` reported `null` —
121
- // this tool's reply was shorter than the scope it computed and nothing on
122
- // the wire said so.
105
+ // `capped()` produces the slice and its shown/total detail together, so this reply
106
+ // can't cap without carrying what it capped — previously hand-sliced with only the
107
+ // prose note updated, so `truncated`/`truncatedDetail` stayed unset on the wire.
123
108
  const cap = capped(affected, limit);
124
109
  if (cap.detail !== null) {
125
110
  notes.push(`${cap.detail.total - cap.detail.shown} lower-scoring affected node(s) are in the scope but not ` +
@@ -144,13 +129,9 @@ async function run(args, ctx) {
144
129
  budgetUsed: scoped.data.budgetUsed,
145
130
  byTier,
146
131
  },
147
- // Deliberately not `scoped.truncated` (`traverse.ts`'s own flag for
148
- // nodes the node *budget* dropped before they ever reached `affected`).
149
- // That is a different fact — fully disclosed on its own via
150
- // `droppedForBudget` and `scoped.notes` — from "this reply is shorter
151
- // than the scope this tool computed," which is what `truncated` here
152
- // means. Conflating the two would make `total` claim a count this tool
153
- // never actually reached.
132
+ // Deliberately not `scoped.truncated` (the node *budget*'s own drop flag,
133
+ // disclosed separately via `droppedForBudget`) — this `truncated` means "this
134
+ // reply is shorter than the scope computed," a different fact from that.
154
135
  truncated: cap.detail !== null,
155
136
  notes: [...scoped.notes, ...notes],
156
137
  },
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/tools/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAmC,MAAM,eAAe,CAAC;AAG3F,OAAO,EACL,MAAM,EACN,SAAS,EACT,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,cAAc,GAIf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AA8CtC,MAAM,QAAQ,GAAG,CAAC,UAAU,EAAE,IAAI,EAAE,SAAS,CAAU,CAAC;AAExD,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAE,IAAI,EAAE,QA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et in the graph**.
4
- *
5
- * ## Why this is a separate tool from `impact`'s `related` field
6
- *
7
- * `rootCauseSearch` — the `related` list every `impact` reply carries — walks
8
- * `INCIDENT_CORRELATED`/`FIXED_BY` edges out of a node that already exists.
9
- * It cannot help with a failure observed a moment ago: a stack trace and a set
10
- * of touched files have no node, so there is nothing to walk from. This tool
11
- * is the other direction. It takes the failure as a description and ranks the
12
- * `INCIDENT` nodes the graph already holds against it, using the two signals
13
- * `similarIncidents` (`@descryy/core`, DEC-274 step 2) computes from data the
14
- * graph already has: file-set Jaccard over `INCIDENT_CORRELATED`, and
15
- * token-set Jaccard over the incident's own text. Deterministic, no vector
16
- * store, no model call.
17
- *
18
- * ## The disclosure this tool exists to carry, and it is not optional
19
- *
20
- * DEC-279 makes one sentence mandatory here, and DEC-274 is why. That
21
- * measurement ran the correlation machinery over `descry-core`,
22
- * `descry-runtime` and `descry-adapters` — 734, 459 and 203 commits — and
23
- * found **zero `INCIDENT` nodes in all three**. Not few: zero. Only an
24
- * explicit `git revert` mints an `INCIDENT` today; a fix-forward commit, which
25
- * is how almost every real bug is actually fixed, mints nothing at all.
26
- *
27
- * So this matcher's **recall is not computable — 0/0, not 0%**. It has never
28
- * been handed a real incident to find, and no number describes how many it
29
- * would miss. An empty result therefore means *"no linked incident in this
30
- * graph, and this graph has few or no incidents"* and must never be read as
31
- * *"no similar incident exists."* That is the same *absence is not evidence*
32
- * obligation `impact` already carries on every reply, and `similar-incidents.test.ts`
33
- * fails if it goes missing from either the empty or the non-empty branch.
34
- *
35
- * ## Two different absences, and they are not the same result
36
- *
37
- * `ai-tool-contract.md` §1.3a splits them, and the split is the whole reason
38
- * this endpoint is interesting:
39
- *
40
- * - **Incidents exist and none matched.** The denominator is real, the tool
41
- * looked completely, and the absence is a fact about the code. `state:
42
- * "empty"`, per §1.1's split.
43
- * - **The graph holds zero `INCIDENT` nodes.** There is no denominator.
44
- * Nothing was looked at, and the reason is Descry's producer coverage
45
- * rather than anything about this repository: only `git revert` mints an
46
- * `INCIDENT` and fix-forward mints nothing. Answering "empty" there would
47
- * say *"this code has no similar incidents"* when the true statement is
48
- * *"Descry cannot see most incidents in any codebase"* — the
49
- * empty-denominator defect inside the endpoint written to demonstrate the
50
- * rule against it. So it is a refusal, carried as `state: "refused"` (§1.1:
51
- * `refused` is a result state, and `not analysable` is a report category —
52
- * different axes, never this).
53
- *
54
- * §1.3a generalises it past this tool: **when a query's population is itself
55
- * zero, the answer is a refusal, never an empty result.** That puts this in
56
- * line with its siblings rather than apart from them — `contracts` refuses on
57
- * a graph with no endpoint, `propagation` when no walked edge type touches
58
- * the start node.
59
- *
60
- * The denominator travels in the payload either way. `incidentsInGraph` is
61
- * the population and `analysed` is false only when it is zero, so a caller
62
- * can tell the two absences apart **from the payload alone, with no string
63
- * matching on prose** — §1's distinguishability requirement, satisfied
64
- * without waiting for the wider envelope.
65
- */
1
+ /** `similar_incidents` ranks existing `INCIDENT` nodes against a failure with no graph node yet,
2
+ * deterministically (file/token Jaccard, no vector store). DEC-274 found zero `INCIDENT` nodes
3
+ * across three repos (734/459/203 commits): recall is 0/0, not 0% — an empty result never means
4
+ * "no similar incident exists" (DEC-279). §1.3a: a zero-incident graph is `refused`, never `empty`
5
+ * — the same split `contracts` and `propagation` apply to their own zero-population case. */
66
6
  import { type SimilarIncidentSignalKind } from "@descryy/core";
67
7
  import { type BriefNode, type ToolDefinition } from "./kit.ts";
68
8
  /** One signal that fired for a candidate — the "why", never a bare score. */
@@ -75,32 +15,17 @@ export interface SimilarIncidentReport {
75
15
  readonly incident: BriefNode;
76
16
  /** The `FIX_PATTERN` this incident resolved to, when a `FIXED_BY` edge exists. */
77
17
  readonly fix: BriefNode | null;
78
- /**
79
- * How this incident came to exist — the `INCIDENT` node's own
80
- * `attrs.detectedVia`.
81
- *
82
- * Reported per match rather than folded away, because the mechanisms are not
83
- * interchangeable and a ranked list that hides the difference is not
84
- * reportable. `explicit-revert` and `manual-revert` rest on a revert somebody
85
- * wrote; `issue-reference` on a developer's `Fixes #123`; `runtime-observed`
86
- * on a process that really died; `developer-confirmed` on a person saying so,
87
- * which is testimony and capped at reliability class B by DEC-223 wherever it
88
- * is used. `null` for an incident minted before this field existed.
89
- */
18
+ /** How this incident was detected (`attrs.detectedVia`) — reported per match since the
19
+ * mechanisms differ: revert, `Fixes #123`, a process dying at runtime, or `developer-confirmed`
20
+ * testimony (capped at reliability B, DEC-223). `null` for incidents minted before this field. */
90
21
  readonly detectedVia: string | null;
91
22
  readonly signals: readonly SimilarIncidentSignalReport[];
92
23
  /** Weighted combination of every signal the query attempted, 0..1. */
93
24
  readonly score: number;
94
25
  }
95
- /**
96
- * One shape, both branches.
97
- *
98
- * `analysed: false` with `incidentsInGraph: 0` is the zero-denominator case
99
- * and arrives with `state: "refused"`; every other reply is `ok`.
100
- * The two counts are in the payload rather than only in the prose because a
101
- * caller deciding what to say about an empty list needs the denominator, and
102
- * a sentence it has to parse is not a denominator.
103
- */
26
+ /** One shape, both branches: `analysed: false` with `incidentsInGraph: 0` is the zero-denominator
27
+ * case, `state: "refused"`. Counts live in the payload, not just prose, so a caller can read the
28
+ * denominator without parsing a sentence. */
104
29
  export interface SimilarIncidentsData {
105
30
  readonly query: {
106
31
  readonly touchedFiles: readonly string[];