@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,11 +1,7 @@
1
- /**
2
- * What the seven browser tools share.
3
- *
4
- * Kept in one place because the parts that repeat are the parts that must not
5
- * drift: how a dead session is reported, how consent is checked, and how a
6
- * reply is stamped. Seven copies of a refusal is seven chances for one of
7
- * them to say something slightly different about the same state.
8
- */
1
+ /** What the seven browser tools share — kept in one place because the parts that repeat
2
+ * are the parts that must not drift: how a dead session is reported, how consent is
3
+ * checked, how a reply is stamped. Seven copies of a refusal is seven chances for one to
4
+ * say something slightly different about the same state. */
9
5
  import { answer } from "../tools/kit.js";
10
6
  import { evidenceNotes, evidenceReport } from "./evidence.js";
11
7
  import { graphWriteNotes, writeBrowserObservations, NO_GRAPH_WRITE } from "./graph-write.js";
@@ -31,15 +27,9 @@ export function browserStamp(ctx) {
31
27
  };
32
28
  }
33
29
  }
34
- /**
35
- * Every browser reply, stamped identically.
36
- *
37
- * `resolutionFloor: 4` on a successful observation, and that is not
38
- * generosity: R4 is "observed at runtime", and a page element this call
39
- * actually saw is the definition of it. A refusal or a failure observed
40
- * nothing, so it stamps R0 — the floor has to describe the evidence behind
41
- * *this* reply, not the tool's best case.
42
- */
30
+ /** Every browser reply, stamped identically. `resolutionFloor: 4` on success — R4 is
31
+ * "observed at runtime", exactly what this call saw; a refusal/failure observed nothing,
32
+ * so stamps R0 — describing this reply's evidence, not the tool's best case. */
43
33
  export function browserAnswer(options) {
44
34
  const stamp = browserStamp(options.ctx);
45
35
  const observed = (options.state ?? "ok") === "ok";
@@ -60,14 +50,9 @@ export function browserAnswer(options) {
60
50
  ...(options.fitToBudget === undefined ? {} : { fitToBudget: options.fitToBudget }),
61
51
  });
62
52
  }
63
- /**
64
- * Look a session up, or describe exactly why it cannot be used.
65
- *
66
- * The three dead states are deliberately not collapsed into one. "You never
67
- * had this session", "it timed out five minutes ago, here is what it saw" and
68
- * "the browser crashed" are three different things for a caller to do next,
69
- * and only the last of them is a `failed`.
70
- */
53
+ /** Looks a session up, or says exactly why it can't be used. The three dead states stay
54
+ * apart — "never had it", "timed out, here's what it saw", "crashed" send a caller to
55
+ * three different things; only the last is `failed`. */
71
56
  export async function useSession(registry, sessionId) {
72
57
  const used = await registry.use(sessionId);
73
58
  if (used.ok)
@@ -82,8 +67,7 @@ export async function useSession(registry, sessionId) {
82
67
  return {
83
68
  ok: false,
84
69
  dead: {
85
- // A crash is something breaking; a reap is Descry having tidied up. The
86
- // five states exist to keep those apart.
70
+ // A crash is something breaking; a reap is Descry tidying up — the five states keep those apart.
87
71
  state: used.kind === "crashed" ? "failed" : "refused",
88
72
  headline: used.kind === "crashed" ? `Browser session ${sessionId} crashed.` : `Browser session ${sessionId} is gone.`,
89
73
  notes: [used.reason, ...carried],
@@ -91,19 +75,9 @@ export async function useSession(registry, sessionId) {
91
75
  },
92
76
  };
93
77
  }
94
- /**
95
- * Drain what the page has said, relate it to the graph, and produce both the
96
- * payload and the disclosures in one place.
97
- *
98
- * Every evidence-bearing browser tool goes through this rather than draining
99
- * for itself. Two reasons, and the second is the one that matters: a tool
100
- * that drained without correlating would be a tool through which the R4 write
101
- * silently does not happen, and nothing about its reply would look different.
102
- *
103
- * A repository with no graph correlates nothing and says so. That is a real
104
- * state — a developer can drive a browser against an app they have never
105
- * analysed — and it must not look like "we looked and found no connection".
106
- */
78
+ /** Drains page evidence, relates it to the graph, and returns both in one place — every
79
+ * evidence-bearing tool routes through this so the R4 write can't silently not happen.
80
+ * No graph correlates nothing and says so; that's real, not "found no connection". */
107
81
  export async function observeAndCorrelate(ctx, entry) {
108
82
  const observation = await entry.page.drainEvidence();
109
83
  const evidence = evidenceReport(observation);
@@ -116,10 +90,8 @@ export async function observeAndCorrelate(ctx, entry) {
116
90
  driver: ctx.session.store().driver,
117
91
  repo: ctx.session.config.repo,
118
92
  runId: entry.runId,
119
- // An edge records the commit the observed application was built from,
120
- // so a later reader can tell whether the code moved under the
121
- // observation. Absent that, the observation is still real but cannot
122
- // be dated against the source, so it is not written at all.
93
+ // An edge records the commit the app was built from, so a reader can tell if code
94
+ // moved since. Without it, the observation is real but undatable against source, so not written.
123
95
  commitSha: commitSha ?? "",
124
96
  repoRoot: ctx.session.repoPath,
125
97
  requests: observation.requests,
@@ -139,27 +111,9 @@ export function emptyEvidence() {
139
111
  export function reportOf(observation) {
140
112
  return evidenceReport(observation);
141
113
  }
142
- /**
143
- * Is `url` inside the origin this session was consented for?
144
- *
145
- * The consent ruling's one hard bound. Checked here rather than in each verb
146
- * so that a future eighth tool cannot forget it.
147
- */
148
- /**
149
- * Does this session's environment profile permit changing the application?
150
- *
151
- * Read off the profile the session was opened under — DEC-270's
152
- * `safetyLevel`, the same field `observe_runtime` consults. Deliberately not
153
- * a per-tool flag: two independent notions of "safe" is how a runtime run and
154
- * a browser run end up disagreeing about the same environment.
155
- *
156
- * A session opened with no profile returns null here, and the session's own
157
- * consent is then the only authorization — which is a real authorization,
158
- * granted explicitly at `browser_start_session` against a named origin. The
159
- * two are independent and both must pass: consent answers *may Descry drive a
160
- * browser against this target at all*, the profile answers *may it mutate*,
161
- * and neither excuses the other.
162
- */
114
+ /** Does the session's environment profile permit changing the application? Reads DEC-270's
115
+ * `safetyLevel` (same field `observe_runtime` consults), not a per-tool flag — two "safe"
116
+ * notions could disagree. No profile ⇒ null; consent and profile are independent, both must pass. */
163
117
  export function mutationRefusal(entry) {
164
118
  if (entry.profile === null)
165
119
  return null;
@@ -170,6 +124,8 @@ export function mutationRefusal(entry) {
170
124
  "browser_navigate and browser_snapshot read the page and remain available. This is a fact about the " +
171
125
  "profile you supplied, not about the page — the session's own consent is intact and does not override it.");
172
126
  }
127
+ /** Is `url` inside the origin this session was consented for? The consent ruling's one
128
+ * hard bound — checked here, not in each verb, so a future eighth tool can't forget it. */
173
129
  export function withinConsent(entry, url) {
174
130
  try {
175
131
  return new URL(url).origin === entry.consentedOrigin;
@@ -1 +1 @@
1
- {"version":3,"file":"tool-support.js","sourceRoot":"","sources":["../../src/browser/tool-support.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAoB,MAAM,iBAAiB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,cAAc,EAA8B,MAAM,eAAe,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,cAAc,EAA0B,MAAM,kBAAkB,CAAC;AAkBrH,MAAM,UAAU,YAAY,CAAC,GAAgB;IAC3C,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC;QACjD,OAAO;YACL,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,IAAI;YAClB,eAAe,EAAE,CAAC;YAClB,YAAY,EAAE,CAAC;YACf,IAAI,EACF,mGAAmG;gBACnG,yFAAyF;SAC5F,CAA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P,KAAK,CAAC,IAAI,CACR,mGAAmG;gBACjG,wFAAwF,CAC3F,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AAC5E,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AACtH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,WAA+B;IACtD,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC;AACrC,CAAC;AAED;;sGAEsG;AACtG,MAAM,UAAU,eAAe,CAAC,KAA0B;IACxD,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1D,OAAO,CACL,wBAAwB,KAAK,CAAC,OAAO,CAAC,IAAI,2DAA2D;QACrG,mGAAmG;QACnG,qGAAqG;QACrG,0GAA0G,CAC3G,CAAC;AACJ,CAAC;AAED;4FAC4F;AAC5F,MAAM,UAAU,aAAa,CAAC,KAA0B,EAAE,GAAW;IACnE,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,eAAe,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Which URL schemes `browser_start_session` may open (A-F7). `file:`/`data:` resolve
3
+ * `.origin` to `"null"`, so same-origin containment passes for every local file (e.g.
4
+ * `file:///etc/passwd` reads back as inside consent). Only http:/https: trusted by
5
+ * default; opt in extras via `DESCRY_ALLOW_BROWSER_URL_SCHEMES`. */
6
+ export declare const ALLOW_BROWSER_URL_SCHEMES_ENV_VAR = "DESCRY_ALLOW_BROWSER_URL_SCHEMES";
7
+ export type UrlSchemeDecision = {
8
+ readonly allowed: true;
9
+ } | {
10
+ readonly allowed: false;
11
+ readonly reason: string;
12
+ };
13
+ export declare function checkUrlScheme(url: URL): UrlSchemeDecision;
14
+ //# sourceMappingURL=url-scheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-scheme.d.ts","sourceRoot":"","sources":["../../src/browser/url-scheme.ts"],"names":[],"mappings":"AAAA;;;;oEAIoE;AAEpE,eAAO,MAAM,iCAAiC,qCAAqC,CAAC;AAepF,MAAM,MAAM,iBAAiB,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAOlH,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,iBAAiB,CAa1D"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Which URL schemes `browser_start_session` may open (A-F7). `file:`/`data:` resolve
3
+ * `.origin` to `"null"`, so same-origin containment passes for every local file (e.g.
4
+ * `file:///etc/passwd` reads back as inside consent). Only http:/https: trusted by
5
+ * default; opt in extras via `DESCRY_ALLOW_BROWSER_URL_SCHEMES`. */
6
+ export const ALLOW_BROWSER_URL_SCHEMES_ENV_VAR = "DESCRY_ALLOW_BROWSER_URL_SCHEMES";
7
+ const DEFAULT_ALLOWED_SCHEMES = new Set(["http:", "https:"]);
8
+ function operatorAllowedSchemes() {
9
+ const raw = process.env[ALLOW_BROWSER_URL_SCHEMES_ENV_VAR];
10
+ if (raw === undefined || raw.trim() === "")
11
+ return DEFAULT_ALLOWED_SCHEMES;
12
+ const extra = raw
13
+ .split(",")
14
+ .map((s) => s.trim())
15
+ .filter((s) => s !== "")
16
+ .map((s) => (s.endsWith(":") ? s : `${s}:`));
17
+ return new Set([...DEFAULT_ALLOWED_SCHEMES, ...extra]);
18
+ }
19
+ /** The one exception: `about:blank` carries no content (no hazard like `file:`/`data:`)
20
+ * and is the standard pre-navigation target for browser automation. Other `about:`
21
+ * URLs (`about:config`, …) can expose browser-internal state and are excluded. */
22
+ const INERT_TARGET = "about:blank";
23
+ export function checkUrlScheme(url) {
24
+ if (url.href === INERT_TARGET)
25
+ return { allowed: true };
26
+ const allowed = operatorAllowedSchemes();
27
+ if (allowed.has(url.protocol))
28
+ return { allowed: true };
29
+ return {
30
+ allowed: false,
31
+ reason: `"${url.href}" uses the "${url.protocol}" scheme, which this tool does not open by default. Same-origin ` +
32
+ "containment (the check every other browser tool relies on) does not hold for a file: or data: URL — " +
33
+ 'both resolve to the origin "null", so a session opened on one would treat every local file as inside ' +
34
+ `consent. Only http: and https: are allowed by default; set ${ALLOW_BROWSER_URL_SCHEMES_ENV_VAR} ` +
35
+ '(e.g. "file") in this server\'s own environment to add a scheme deliberately.',
36
+ };
37
+ }
38
+ //# sourceMappingURL=url-scheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url-scheme.js","sourceRoot":"","sources":["../../src/browser/url-scheme.ts"],"names":[],"mappings":"AAAA;;;;oEAIoE;AAEpE,MAAM,CAAC,MAAM,iCAAiC,GAAG,kCAAkC,CAAC;AAEpF,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE7D,SAAS,sBAAsB;IAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAC3D,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,uBAAuB,CAAC;IAC3E,MAAM,KAAK,GAAG,GAAG;SACd,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;SACvB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,uBAAuB,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;AACzD,CAAC;AAID;;mFAEmF;AACnF,MAAM,YAAY,GAAG,aAAa,CAAC;AAEnC,MAAM,UAAU,cAAc,CAAC,GAAQ;IACrC,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACxD,MAAM,OAAO,GAAG,sBAAsB,EAAE,CAAC;IACzC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACxD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,MAAM,EACJ,IAAI,GAAG,CAAC,IAAI,eAAe,GAAG,CAAC,QAAQ,kEAAkE;YACzG,sGAAsG;YACtG,uGAAuG;YACvG,8DAA8D,iCAAiC,GAAG;YAClG,+EAA+E;KAClF,CAAC;AACJ,CAAC"}
@@ -1,53 +1,18 @@
1
- /**
2
- * What a tool does when the caller has already gone.
3
- *
4
- * `notifications/cancelled` makes the *server* stop waiting and suppress the
5
- * response. It cannot make the work stop, and for the tools that hold
6
- * something real — a browser, an application, a test runner — the work
7
- * continuing after the reply is discarded is the whole problem: a Chromium
8
- * nothing will ever close, an application still being driven, a scenario
9
- * still clicking through a live system on behalf of a caller who cancelled.
10
- *
11
- * So `ctx.signal` is checked at the points where a tool is about to *start*
12
- * something, and whatever the tool already started is released. Three rules
13
- * hold everywhere it is used:
14
- *
15
- * 1. **Release what this call started, and nothing else.** A cancelled verb
16
- * does not close the session `browser_start_session` opened, and a
17
- * cancelled run does not kill a process it merely attached to. Cancellation
18
- * stops the work it was asked to stop; tearing down a caller's own state
19
- * because one call was cancelled is a second failure, not a cleanup.
20
- * 2. **Keep the evidence.** Nothing witnessed before the cancellation is
21
- * thrown away. Evidence captured and then dropped is worse than evidence
22
- * never captured, because nothing discloses it.
23
- * 3. **Never let a cancelled run render as a clean one.** A check that stopped
24
- * a third of the way through has not passed, and the reply says so even
25
- * though nobody is expected to read it — the reply is suppressed only when
26
- * the cancellation arrived over the wire, and this same path is reachable
27
- * when a signal is aborted for any other reason.
28
- *
29
- * The state is `refused`: cancellation is a fact about Descry — it stopped
30
- * looking — and never a fact about the user's code. `empty` would say the run
31
- * looked and found nothing, which is the one thing it must not say.
32
- */
1
+ /** What a tool does when the caller has already gone. `notifications/cancelled` stops the
2
+ * server from waiting, not the work itself — a browser or process would keep running
3
+ * unless released. Three rules: release only what this call started (never a caller's own
4
+ * state), keep evidence already witnessed, never render a cancelled run as clean. State is
5
+ * `refused` (a fact about Descry stopping) not `empty` (which would falsely say it looked and found nothing). */
33
6
  /** The reply state for a call that stopped because its signal was aborted. */
34
7
  export declare const CANCELLED_STATE: "refused";
35
8
  export declare function cancellationHeadline(what: string): string;
36
- /**
37
- * @param stopped What this call stopped doing, in the caller's terms.
38
- * @param released What it tore down, when it had started something. Omitted
39
- * when there was nothing to release — claiming a teardown that did not happen
40
- * is the same class of false statement as hiding one that did.
41
- */
9
+ /** @param stopped What this call stopped doing, in the caller's terms.
10
+ * @param released What it tore down, if anything — omitted when nothing was released;
11
+ * claiming a teardown that didn't happen is as false as hiding one that did. */
42
12
  export declare function cancellationNotes(stopped: string, released?: string): readonly string[];
43
- /**
44
- * A promise that settles when the signal aborts, and a way to stop listening.
45
- *
46
- * The disposal half is the point. `Promise.race` leaves the losing promise
47
- * pending forever, so a listener added per call and never removed accumulates
48
- * on a signal that outlives the call — the standard leak this shape exists to
49
- * avoid. Callers race and then dispose in a `finally`.
50
- */
13
+ /** A promise that settles when the signal aborts, plus a way to stop listening.
14
+ * `Promise.race` leaves the loser pending forever, so an unremoved listener leaks on a
15
+ * signal that outlives the call — callers race then dispose in a `finally`. */
51
16
  export declare function whenAborted(signal: AbortSignal): {
52
17
  readonly promise: Promise<void>;
53
18
  dispose(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"cancellation.d.ts","sourceRoot":"","sources":["../src/cancellation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAG,SAAkB,CAAC;AAElD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAMvF;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CAgBrG"}
1
+ {"version":3,"file":"cancellation.d.ts","sourceRoot":"","sources":["../src/cancellation.ts"],"names":[],"mappings":"AAAA;;;;kHAIkH;AAElH,8EAA8E;AAC9E,eAAO,MAAM,eAAe,EAAG,SAAkB,CAAC;AAElD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;iFAEiF;AACjF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAMvF;AAED;;gFAEgF;AAChF,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAAC,OAAO,IAAI,IAAI,CAAA;CAAE,CAgBrG"}
@@ -1,46 +1,16 @@
1
- /**
2
- * What a tool does when the caller has already gone.
3
- *
4
- * `notifications/cancelled` makes the *server* stop waiting and suppress the
5
- * response. It cannot make the work stop, and for the tools that hold
6
- * something real — a browser, an application, a test runner — the work
7
- * continuing after the reply is discarded is the whole problem: a Chromium
8
- * nothing will ever close, an application still being driven, a scenario
9
- * still clicking through a live system on behalf of a caller who cancelled.
10
- *
11
- * So `ctx.signal` is checked at the points where a tool is about to *start*
12
- * something, and whatever the tool already started is released. Three rules
13
- * hold everywhere it is used:
14
- *
15
- * 1. **Release what this call started, and nothing else.** A cancelled verb
16
- * does not close the session `browser_start_session` opened, and a
17
- * cancelled run does not kill a process it merely attached to. Cancellation
18
- * stops the work it was asked to stop; tearing down a caller's own state
19
- * because one call was cancelled is a second failure, not a cleanup.
20
- * 2. **Keep the evidence.** Nothing witnessed before the cancellation is
21
- * thrown away. Evidence captured and then dropped is worse than evidence
22
- * never captured, because nothing discloses it.
23
- * 3. **Never let a cancelled run render as a clean one.** A check that stopped
24
- * a third of the way through has not passed, and the reply says so even
25
- * though nobody is expected to read it — the reply is suppressed only when
26
- * the cancellation arrived over the wire, and this same path is reachable
27
- * when a signal is aborted for any other reason.
28
- *
29
- * The state is `refused`: cancellation is a fact about Descry — it stopped
30
- * looking — and never a fact about the user's code. `empty` would say the run
31
- * looked and found nothing, which is the one thing it must not say.
32
- */
1
+ /** What a tool does when the caller has already gone. `notifications/cancelled` stops the
2
+ * server from waiting, not the work itself — a browser or process would keep running
3
+ * unless released. Three rules: release only what this call started (never a caller's own
4
+ * state), keep evidence already witnessed, never render a cancelled run as clean. State is
5
+ * `refused` (a fact about Descry stopping) not `empty` (which would falsely say it looked and found nothing). */
33
6
  /** The reply state for a call that stopped because its signal was aborted. */
34
7
  export const CANCELLED_STATE = "refused";
35
8
  export function cancellationHeadline(what) {
36
9
  return `The call was cancelled; ${what}.`;
37
10
  }
38
- /**
39
- * @param stopped What this call stopped doing, in the caller's terms.
40
- * @param released What it tore down, when it had started something. Omitted
41
- * when there was nothing to release — claiming a teardown that did not happen
42
- * is the same class of false statement as hiding one that did.
43
- */
11
+ /** @param stopped What this call stopped doing, in the caller's terms.
12
+ * @param released What it tore down, if anything — omitted when nothing was released;
13
+ * claiming a teardown that didn't happen is as false as hiding one that did. */
44
14
  export function cancellationNotes(stopped, released) {
45
15
  return [
46
16
  `This call was cancelled before it finished. ${stopped} Nothing here is a finding about your ` +
@@ -48,14 +18,9 @@ export function cancellationNotes(stopped, released) {
48
18
  ...(released === undefined ? [] : [released]),
49
19
  ];
50
20
  }
51
- /**
52
- * A promise that settles when the signal aborts, and a way to stop listening.
53
- *
54
- * The disposal half is the point. `Promise.race` leaves the losing promise
55
- * pending forever, so a listener added per call and never removed accumulates
56
- * on a signal that outlives the call — the standard leak this shape exists to
57
- * avoid. Callers race and then dispose in a `finally`.
58
- */
21
+ /** A promise that settles when the signal aborts, plus a way to stop listening.
22
+ * `Promise.race` leaves the loser pending forever, so an unremoved listener leaks on a
23
+ * signal that outlives the call — callers race then dispose in a `finally`. */
59
24
  export function whenAborted(signal) {
60
25
  if (signal.aborted)
61
26
  return { promise: Promise.resolve(), dispose: () => { } };
@@ -1 +1 @@
1
- {"version":3,"file":"cancellation.js","sourceRoot":"","sources":["../src/cancellation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,eAAe,GAAG,SAAkB,CAAC;AAElD,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,2BAA2B,IAAI,GAAG,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe,EAAE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CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;KAC9C,CAAC;AACJ,CAAC;AAED;;gFAEgF;AAChF,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC7C,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;IAE7E,IAAI,OAAO,GAAe,GAAG,EAAE,GAAE,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAC5C,OAAO,GAAG,GAAG,EAAE;YACb,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,OAAO;QACL,OAAO;QACP,OAAO,EAAE,GAAG,EAAE;YACZ,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC"}
package/dist/capped.d.ts CHANGED
@@ -1,41 +1,17 @@
1
- /**
2
- * `capped(items, limit) → { shown, detail }` — B6's fix, part 2.
3
- *
4
- * `render.ts`'s envelope carries a `truncated` field precisely so a caller
5
- * does not have to guess whether a short list is short because that is all
6
- * there was, or because the reply was cut. Before this helper existed, three
7
- * tools computed that cut three different ways: one sliced and remembered to
8
- * report `shown`/`total` by hand, one sliced and forgot, one never sliced at
9
- * all but discarded rows anyway. Two of the three left `render.ts` with
10
- * nothing to report and it filled the gap with a sentinel
11
- * (`{shown:-1,total:-1}`) that is worse than reporting nothing, because it
12
- * passes a presence check and then poisons arithmetic.
13
- *
14
- * This is the fix: the slice and the fact that a slice happened are computed
15
- * together, in one call, so a tool cannot hold one without the other. A tool
16
- * that caps a list calls this instead of `.slice(0, limit)`, and then has a
17
- * `detail` sitting right next to `shown` with nothing further to remember.
18
- */
1
+ /** `capped(items, limit) → { shown, detail }`, B6's fix. Three tools used to compute a list cut
2
+ * three different ways; two left `render.ts` filling the gap with a `{shown:-1,total:-1}`
3
+ * sentinel — worse than nothing, since it passes a presence check and poisons arithmetic. Now the
4
+ * slice and the fact it happened are computed together, so a tool can't hold one without the other. */
19
5
  import type { TruncationDetail } from "./render.ts";
20
6
  export interface Capped<T> {
21
7
  /** The first `limit` items, in their original order. */
22
8
  readonly shown: readonly T[];
23
- /**
24
- * `null` when nothing was withheld — `shown` already holds everything
25
- * `items` had. Non-null exactly when `shown.length < items.length`, and
26
- * carries the same `{shown, total}` shape `render.ts` puts on the wire, so
27
- * a tool can pass it straight through as `truncatedDetail`.
28
- */
9
+ /** `null` when nothing was withheld; otherwise the same `{shown, total}` shape `render.ts` puts
10
+ * on the wire, so a tool can pass it straight through as `truncatedDetail`. */
29
11
  readonly detail: TruncationDetail | null;
30
12
  }
31
- /**
32
- * Slice `items` to `limit` and report what that cost in the same call.
33
- *
34
- * A negative or fractional `limit` is treated as zero rather than thrown —
35
- * the callers here already validate `limit` as a positive integer at the
36
- * schema boundary (`optionalInteger(..., 1)`), so a non-positive value
37
- * reaching this function is defensive, not an expected input to reject
38
- * loudly.
39
- */
13
+ /** Slices `items` to `limit` and reports the cost in the same call. A negative/fractional `limit`
14
+ * is treated as zero rather than thrown — defensive only, callers already validate at the schema
15
+ * boundary. */
40
16
  export declare function capped<T>(items: readonly T[], limit: number): Capped<T>;
41
17
  //# sourceMappingURL=capped.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capped.d.ts","sourceRoot":"","sources":["../src/capped.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAKvE"}
1
+ {"version":3,"file":"capped.d.ts","sourceRoot":"","sources":["../src/capped.ts"],"names":[],"mappings":"AAAA;;;wGAGwG;AAExG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,MAAM,CAAC,CAAC;IACvB,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAC7B;oFACgF;IAChF,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC1C;AAED;;gBAEgB;AAChB,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,CAKvE"}
package/dist/capped.js CHANGED
@@ -1,30 +1,10 @@
1
- /**
2
- * `capped(items, limit) → { shown, detail }` — B6's fix, part 2.
3
- *
4
- * `render.ts`'s envelope carries a `truncated` field precisely so a caller
5
- * does not have to guess whether a short list is short because that is all
6
- * there was, or because the reply was cut. Before this helper existed, three
7
- * tools computed that cut three different ways: one sliced and remembered to
8
- * report `shown`/`total` by hand, one sliced and forgot, one never sliced at
9
- * all but discarded rows anyway. Two of the three left `render.ts` with
10
- * nothing to report and it filled the gap with a sentinel
11
- * (`{shown:-1,total:-1}`) that is worse than reporting nothing, because it
12
- * passes a presence check and then poisons arithmetic.
13
- *
14
- * This is the fix: the slice and the fact that a slice happened are computed
15
- * together, in one call, so a tool cannot hold one without the other. A tool
16
- * that caps a list calls this instead of `.slice(0, limit)`, and then has a
17
- * `detail` sitting right next to `shown` with nothing further to remember.
18
- */
19
- /**
20
- * Slice `items` to `limit` and report what that cost in the same call.
21
- *
22
- * A negative or fractional `limit` is treated as zero rather than thrown —
23
- * the callers here already validate `limit` as a positive integer at the
24
- * schema boundary (`optionalInteger(..., 1)`), so a non-positive value
25
- * reaching this function is defensive, not an expected input to reject
26
- * loudly.
27
- */
1
+ /** `capped(items, limit) → { shown, detail }`, B6's fix. Three tools used to compute a list cut
2
+ * three different ways; two left `render.ts` filling the gap with a `{shown:-1,total:-1}`
3
+ * sentinel — worse than nothing, since it passes a presence check and poisons arithmetic. Now the
4
+ * slice and the fact it happened are computed together, so a tool can't hold one without the other. */
5
+ /** Slices `items` to `limit` and reports the cost in the same call. A negative/fractional `limit`
6
+ * is treated as zero rather than thrown — defensive only, callers already validate at the schema
7
+ * boundary. */
28
8
  export function capped(items, limit) {
29
9
  const bound = Number.isFinite(limit) && limit > 0 ? Math.floor(limit) : 0;
30
10
  const shown = items.slice(0, bound);
@@ -1 +1 @@
1
- {"version":3,"file":"capped.js","sourceRoot":"","sources":["../src/capped.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAgBH;;;;;;;;GAQG;AACH,MAAM,UAAU,MAAM,CAAI,KAAmB,EAAE,KAAa;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACrF,CAAC"}
1
+ {"version":3,"file":"capped.js","sourceRoot":"","sources":["../src/capped.ts"],"names":[],"mappings":"AAAA;;;wGAGwG;AAYxG;;gBAEgB;AAChB,MAAM,UAAU,MAAM,CAAI,KAAmB,EAAE,KAAa;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACpC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACjE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;AACrF,CAAC"}
@@ -1,35 +1,11 @@
1
1
  /**
2
- * Which standing disclosures this connection has already been given in full.
3
- *
4
- * The tax it removes was measured, not supposed: the R0/class-C reliability
5
- * sentence is 354 characters — ~88 tokens — and appeared byte-for-byte
6
- * identical on the large majority of one session's thirty-odd tool calls.
7
- * Nothing about it was wrong; it was simply the same paragraph, re-billed to
8
- * the caller's context window every call, and the loop this server is built
9
- * for (edit, re-check, edit again) is the one that pays it most.
10
- *
11
- * ## What the ledger is allowed to shorten, and what it is not
12
- *
13
- * Only the *argument* for a cap. The floor and the class it caps to stay on
14
- * every reply, first or fiftieth, in `graph.resolutionFloor` /
15
- * `graph.reliabilityCap` and in the short disclosure itself. Rule 7 is about
16
- * what reaches the user, and a reply that stopped naming its own cap after
17
- * the first call would be a reply that silently does less.
18
- *
19
- * ## Per connection, deliberately not per process
20
- *
21
- * "Already disclosed" is a fact about one conversation. A ledger shared across
22
- * connections would let the *second* client's first call inherit the first
23
- * client's history — that client would receive the short form of a sentence it
24
- * has never seen, which is the exact failure this is supposed to avoid, only
25
- * harder to notice. So one ledger is created per `createMcpServer`, and it
26
- * lives as long as that server does.
27
- */
2
+ * Tracks disclosures this connection has already seen in full. Measured: the
3
+ * R0/class-C sentence is ~354 chars (~88 tokens), repeated on most of a 30-call
4
+ * session. Only the *argument* shortens — floor/cap stay on every reply (rule 7).
5
+ * Per connection, not per process — a second client can't inherit the first's history. */
28
6
  export interface DisclosureLedger {
29
- /**
30
- * `true` the first time this key is seen on this connection, `false` after.
31
- * Records the sighting — calling it is what marks the key as disclosed.
32
- */
7
+ /** `true` the first time this key is seen on this connection, `false` after —
8
+ * calling it is what marks the key as disclosed. */
33
9
  firstSighting(key: string): boolean;
34
10
  /** Keys disclosed in full so far. For tests and diagnostics. */
35
11
  disclosed(): readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"disclosure-ledger.d.ts","sourceRoot":"","sources":["../src/disclosure-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,gEAAgE;IAChE,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAUzD"}
1
+ {"version":3,"file":"disclosure-ledger.d.ts","sourceRoot":"","sources":["../src/disclosure-ledger.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAE1F,MAAM,WAAW,gBAAgB;IAC/B;yDACqD;IACrD,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,gEAAgE;IAChE,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAUzD"}
@@ -1,30 +1,8 @@
1
1
  /**
2
- * Which standing disclosures this connection has already been given in full.
3
- *
4
- * The tax it removes was measured, not supposed: the R0/class-C reliability
5
- * sentence is 354 characters — ~88 tokens — and appeared byte-for-byte
6
- * identical on the large majority of one session's thirty-odd tool calls.
7
- * Nothing about it was wrong; it was simply the same paragraph, re-billed to
8
- * the caller's context window every call, and the loop this server is built
9
- * for (edit, re-check, edit again) is the one that pays it most.
10
- *
11
- * ## What the ledger is allowed to shorten, and what it is not
12
- *
13
- * Only the *argument* for a cap. The floor and the class it caps to stay on
14
- * every reply, first or fiftieth, in `graph.resolutionFloor` /
15
- * `graph.reliabilityCap` and in the short disclosure itself. Rule 7 is about
16
- * what reaches the user, and a reply that stopped naming its own cap after
17
- * the first call would be a reply that silently does less.
18
- *
19
- * ## Per connection, deliberately not per process
20
- *
21
- * "Already disclosed" is a fact about one conversation. A ledger shared across
22
- * connections would let the *second* client's first call inherit the first
23
- * client's history — that client would receive the short form of a sentence it
24
- * has never seen, which is the exact failure this is supposed to avoid, only
25
- * harder to notice. So one ledger is created per `createMcpServer`, and it
26
- * lives as long as that server does.
27
- */
2
+ * Tracks disclosures this connection has already seen in full. Measured: the
3
+ * R0/class-C sentence is ~354 chars (~88 tokens), repeated on most of a 30-call
4
+ * session. Only the *argument* shortens — floor/cap stay on every reply (rule 7).
5
+ * Per connection, not per process — a second client can't inherit the first's history. */
28
6
  export function createDisclosureLedger() {
29
7
  const seen = new Set();
30
8
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"disclosure-ledger.js","sourceRoot":"","sources":["../src/disclosure-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAYH,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO;QACL,aAAa,CAAC,GAAG;YACf,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,KAAK,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"disclosure-ledger.js","sourceRoot":"","sources":["../src/disclosure-ledger.ts"],"names":[],"mappings":"AAAA;;;;0FAI0F;AAU1F,MAAM,UAAU,sBAAsB;IACpC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO;QACL,aAAa,CAAC,GAAG;YACf,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,KAAK,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,OAAO,IAAI,CAAC;QACd,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;KAC3B,CAAC;AACJ,CAAC"}