@descryy/mcp 0.4.0 → 0.6.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 (121) hide show
  1. package/dist/bin/descry-mcp.js +16 -2
  2. package/dist/bin/descry-mcp.js.map +1 -1
  3. package/dist/browser/driver.d.ts +105 -6
  4. package/dist/browser/driver.d.ts.map +1 -1
  5. package/dist/browser/driver.js +17 -3
  6. package/dist/browser/driver.js.map +1 -1
  7. package/dist/browser/evidence.d.ts +11 -0
  8. package/dist/browser/evidence.d.ts.map +1 -1
  9. package/dist/browser/evidence.js +64 -8
  10. package/dist/browser/evidence.js.map +1 -1
  11. package/dist/browser/fake-driver.d.ts +8 -0
  12. package/dist/browser/fake-driver.d.ts.map +1 -1
  13. package/dist/browser/fake-driver.js +26 -3
  14. package/dist/browser/fake-driver.js.map +1 -1
  15. package/dist/browser/playwright-driver.d.ts +68 -14
  16. package/dist/browser/playwright-driver.d.ts.map +1 -1
  17. package/dist/browser/playwright-driver.js +318 -38
  18. package/dist/browser/playwright-driver.js.map +1 -1
  19. package/dist/browser/provider.d.ts +10 -4
  20. package/dist/browser/provider.d.ts.map +1 -1
  21. package/dist/browser/provider.js +10 -4
  22. package/dist/browser/provider.js.map +1 -1
  23. package/dist/browser/scenario-runner.d.ts +9 -0
  24. package/dist/browser/scenario-runner.d.ts.map +1 -1
  25. package/dist/browser/scenario-runner.js +32 -2
  26. package/dist/browser/scenario-runner.js.map +1 -1
  27. package/dist/browser/tool-support.js +1 -1
  28. package/dist/browser/tool-support.js.map +1 -1
  29. package/dist/cancellation.d.ts +55 -0
  30. package/dist/cancellation.d.ts.map +1 -0
  31. package/dist/cancellation.js +76 -0
  32. package/dist/cancellation.js.map +1 -0
  33. package/dist/capped.d.ts +41 -0
  34. package/dist/capped.d.ts.map +1 -0
  35. package/dist/capped.js +35 -0
  36. package/dist/capped.js.map +1 -0
  37. package/dist/registry.d.ts +20 -1
  38. package/dist/registry.d.ts.map +1 -1
  39. package/dist/registry.js +71 -4
  40. package/dist/registry.js.map +1 -1
  41. package/dist/render.d.ts +92 -0
  42. package/dist/render.d.ts.map +1 -1
  43. package/dist/render.js +250 -5
  44. package/dist/render.js.map +1 -1
  45. package/dist/runtime-registry.d.ts +19 -1
  46. package/dist/runtime-registry.d.ts.map +1 -1
  47. package/dist/runtime-registry.js +88 -4
  48. package/dist/runtime-registry.js.map +1 -1
  49. package/dist/server.d.ts +19 -0
  50. package/dist/server.d.ts.map +1 -1
  51. package/dist/server.js +135 -11
  52. package/dist/server.js.map +1 -1
  53. package/dist/session.d.ts +22 -0
  54. package/dist/session.d.ts.map +1 -1
  55. package/dist/session.js +27 -1
  56. package/dist/session.js.map +1 -1
  57. package/dist/tools/analyze.d.ts +23 -3
  58. package/dist/tools/analyze.d.ts.map +1 -1
  59. package/dist/tools/analyze.js +35 -3
  60. package/dist/tools/analyze.js.map +1 -1
  61. package/dist/tools/browser-click.d.ts.map +1 -1
  62. package/dist/tools/browser-click.js +14 -0
  63. package/dist/tools/browser-click.js.map +1 -1
  64. package/dist/tools/browser-fill.d.ts.map +1 -1
  65. package/dist/tools/browser-fill.js +14 -0
  66. package/dist/tools/browser-fill.js.map +1 -1
  67. package/dist/tools/browser-navigate.d.ts.map +1 -1
  68. package/dist/tools/browser-navigate.js +14 -0
  69. package/dist/tools/browser-navigate.js.map +1 -1
  70. package/dist/tools/browser-run-scenario.d.ts.map +1 -1
  71. package/dist/tools/browser-run-scenario.js +12 -3
  72. package/dist/tools/browser-run-scenario.js.map +1 -1
  73. package/dist/tools/browser-save-scenario.d.ts.map +1 -1
  74. package/dist/tools/browser-save-scenario.js +109 -3
  75. package/dist/tools/browser-save-scenario.js.map +1 -1
  76. package/dist/tools/browser-start-session.d.ts.map +1 -1
  77. package/dist/tools/browser-start-session.js +43 -0
  78. package/dist/tools/browser-start-session.js.map +1 -1
  79. package/dist/tools/browser-type.d.ts.map +1 -1
  80. package/dist/tools/browser-type.js +14 -0
  81. package/dist/tools/browser-type.js.map +1 -1
  82. package/dist/tools/contracts.d.ts +41 -10
  83. package/dist/tools/contracts.d.ts.map +1 -1
  84. package/dist/tools/contracts.js +117 -17
  85. package/dist/tools/contracts.js.map +1 -1
  86. package/dist/tools/cross-pr.d.ts +39 -10
  87. package/dist/tools/cross-pr.d.ts.map +1 -1
  88. package/dist/tools/cross-pr.js +113 -29
  89. package/dist/tools/cross-pr.js.map +1 -1
  90. package/dist/tools/git-diff.d.ts.map +1 -1
  91. package/dist/tools/git-diff.js +30 -2
  92. package/dist/tools/git-diff.js.map +1 -1
  93. package/dist/tools/impact.d.ts.map +1 -1
  94. package/dist/tools/impact.js +50 -2
  95. package/dist/tools/impact.js.map +1 -1
  96. package/dist/tools/observe-runtime.d.ts.map +1 -1
  97. package/dist/tools/observe-runtime.js +84 -4
  98. package/dist/tools/observe-runtime.js.map +1 -1
  99. package/dist/tools/observe-tests.d.ts +12 -0
  100. package/dist/tools/observe-tests.d.ts.map +1 -1
  101. package/dist/tools/observe-tests.js +92 -8
  102. package/dist/tools/observe-tests.js.map +1 -1
  103. package/dist/tools/pre-push.d.ts +40 -7
  104. package/dist/tools/pre-push.d.ts.map +1 -1
  105. package/dist/tools/pre-push.js +65 -23
  106. package/dist/tools/pre-push.js.map +1 -1
  107. package/dist/tools/scope.d.ts.map +1 -1
  108. package/dist/tools/scope.js +20 -4
  109. package/dist/tools/scope.js.map +1 -1
  110. package/dist/tools/validate.d.ts +40 -1
  111. package/dist/tools/validate.d.ts.map +1 -1
  112. package/dist/tools/validate.js +150 -27
  113. package/dist/tools/validate.js.map +1 -1
  114. package/dist/tools/verification-status.d.ts.map +1 -1
  115. package/dist/tools/verification-status.js +3 -3
  116. package/dist/tools/verification-status.js.map +1 -1
  117. package/dist/transport.d.ts +12 -1
  118. package/dist/transport.d.ts.map +1 -1
  119. package/dist/transport.js +30 -16
  120. package/dist/transport.js.map +1 -1
  121. package/package.json +22 -13
package/dist/render.d.ts CHANGED
@@ -35,6 +35,20 @@
35
35
  * 4. `class == "action"` returning anything other than a handshake envelope on
36
36
  * the first call → throw (§7) — enforced in `action-handshake.ts` and
37
37
  * `server.ts`, not here: this module never sees a mint, only a redeemed run.
38
+ *
39
+ * ## A fifth invariant, B6: a truncated answer must carry real counts
40
+ *
41
+ * `result.truncated === true` with no `answer.truncatedDetail` used to fall
42
+ * back to a sentinel, `{shown: -1, total: -1}` — chosen to be "unmistakably
43
+ * fake," except that it is a number, so it passes any presence check and then
44
+ * poisons whatever arithmetic reads `total - shown`. A field that lies is
45
+ * worse than a field that is absent, which is the same argument the five
46
+ * result states rest on. So the sentinel is gone: a tool that sets
47
+ * `result.truncated` without a `truncatedDetail` is a programming error,
48
+ * thrown in every environment except production, where the envelope instead
49
+ * reports `truncated: null` plus a disclosure naming the gap — degraded
50
+ * honestly rather than dishonestly precise. See `capped()` in `./capped.ts`
51
+ * for how a tool is meant to avoid ever hitting this.
38
52
  */
39
53
  import { type ReliabilityClass, type ReportCategory } from "@descryy/ir";
40
54
  import type { ResultState, SignalTypeCount, ToolClass } from "@descryy/ir";
@@ -231,6 +245,19 @@ export interface AnswerEnvelope<T = unknown> {
231
245
  readonly tool: string;
232
246
  /** Contract §6, rule 8. A behaviour change is a version bump; recorded with the run. */
233
247
  readonly toolVersion: string;
248
+ /**
249
+ * B10 — this call's own id in `Session#recordedCalls()`, minted before
250
+ * rendering (`Session#allocateCallId`) so it can be carried here rather
251
+ * than only discovered after the fact. A caller reads this off a real
252
+ * reply and cites it in `verify_claim`'s `callId` — the positive path that
253
+ * was previously unreachable because the id used to be minted only when
254
+ * `Session#recordCall` ran, one step after the envelope that would have
255
+ * carried it was already built and sent. Not recorded here — `verify_claim`
256
+ * itself is excluded from `Session#recordCall` (MK-12) and every other
257
+ * path still records under this same value, so the id an agent reads is
258
+ * always the id `recordedCall` will actually find.
259
+ */
260
+ readonly callId: string;
234
261
  readonly state: ResultState;
235
262
  /** DEC-278's three classes — §6's retry table reads this. */
236
263
  readonly class: ToolClass;
@@ -295,6 +322,61 @@ export interface AnswerEnvelope<T = unknown> {
295
322
  /** MK-6. Constant for this server — see `Provenance`'s own doc. */
296
323
  readonly provenance: Provenance;
297
324
  }
325
+ /**
326
+ * The envelope, declared for a host to validate against — MCP's `outputSchema`.
327
+ *
328
+ * ## Why this exists at all
329
+ *
330
+ * Every reply from this server carries `structuredContent`, and until this was
331
+ * added a host had no way to check what it received. `tools/list` already ships
332
+ * `class`, `tier` and `toolVersion` on the same reasoning — a fact about the
333
+ * reply that an external client cannot otherwise read — and this is the
334
+ * standard-shaped member of that group rather than a fourth non-standard field.
335
+ *
336
+ * ## `data` is deliberately open, and that is a disclosed gap
337
+ *
338
+ * The envelope's thirteen fields are uniform across all thirty tools, so they
339
+ * are described exactly. `data` is not: its shape is `ImpactData`, `ScopeData`
340
+ * and twenty-eight others, and nothing today derives a JSON Schema from those
341
+ * TypeScript types. Hand-writing thirty schemas would put a second description
342
+ * of each shape in a second place with nothing checking the two agree — the
343
+ * drift this repo has already paid for once with the tool count in prose, and
344
+ * a schema that is confidently wrong about `data` is worse for a validating
345
+ * host than one that declines to describe it.
346
+ *
347
+ * So `data` is `{}` — "anything" — and this paragraph is the disclosure rather
348
+ * than a silent omission (rule 7). Tightening it is real work with a real
349
+ * prerequisite: a generator from the handler types, or the schemas checked
350
+ * against recorded replies. Until then the promise made here is exactly the
351
+ * promise kept.
352
+ *
353
+ * ## The enums are read, not restated
354
+ *
355
+ * `state`, `class`, `reportCategory` and `reliabilityCap` build their `enum`
356
+ * from the exported vocabulary arrays. A restated list is a second source of
357
+ * truth that goes stale in silence; spread from the array, adding a report
358
+ * category and forgetting the schema is a red test instead.
359
+ */
360
+ export declare const ANSWER_ENVELOPE_SCHEMA: Record<string, unknown>;
361
+ /**
362
+ * The other shape a `tools/call` can return — `renderToolError`'s.
363
+ *
364
+ * Declared rather than quietly excluded. A bad argument is the most ordinary
365
+ * failure a tool has, it deliberately does not use the five-state envelope
366
+ * (see `renderToolError`), and a schema that admitted only the envelope would
367
+ * be one the server itself violates on that path. Declaring a union that is
368
+ * true beats declaring a single shape that is tidy.
369
+ */
370
+ export declare const TOOL_ERROR_SCHEMA: Record<string, unknown>;
371
+ /**
372
+ * What every tool declares as its `outputSchema`: the envelope or the argument
373
+ * error, discriminated by their required fields.
374
+ *
375
+ * One shared constant rather than a per-tool object because the shape genuinely
376
+ * is shared — the only per-tool part is `data`, which is open. When `data`
377
+ * becomes describable this becomes a function of the tool.
378
+ */
379
+ export declare const TOOL_OUTPUT_SCHEMA: Record<string, unknown>;
298
380
  export declare class DisclosureError extends Error {
299
381
  constructor(message: string);
300
382
  }
@@ -305,6 +387,16 @@ export interface RenderOptions {
305
387
  readonly toolTier: ToolTier;
306
388
  readonly elapsedMs: number;
307
389
  readonly limitMs: number;
390
+ /**
391
+ * B10 — the id this call will be recorded under, minted by
392
+ * `Session#allocateCallId()` before `renderAnswer` runs so it can be
393
+ * threaded into the envelope's own `callId`. Optional so every direct
394
+ * `renderAnswer` call in a test — none of which has a session's id
395
+ * sequence to draw from, and none of which asserts on `callId` — keeps
396
+ * compiling unchanged; a random id fills the gap there. `server.ts` is the
397
+ * one caller for which this matters and it always supplies a real one.
398
+ */
399
+ readonly callId?: string;
308
400
  /**
309
401
  * This connection's record of which standing disclosures it has already been
310
402
  * given in full. Optional: a caller with no session to dedupe within (every
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAmB,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,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,aAAa,GACrB,cAAc,CA6BhB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,GACrB,cAAc,CA+BhB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,CAgCnF"}
package/dist/render.js CHANGED
@@ -35,8 +35,23 @@
35
35
  * 4. `class == "action"` returning anything other than a handshake envelope on
36
36
  * the first call → throw (§7) — enforced in `action-handshake.ts` and
37
37
  * `server.ts`, not here: this module never sees a mint, only a redeemed run.
38
+ *
39
+ * ## A fifth invariant, B6: a truncated answer must carry real counts
40
+ *
41
+ * `result.truncated === true` with no `answer.truncatedDetail` used to fall
42
+ * back to a sentinel, `{shown: -1, total: -1}` — chosen to be "unmistakably
43
+ * fake," except that it is a number, so it passes any presence check and then
44
+ * poisons whatever arithmetic reads `total - shown`. A field that lies is
45
+ * worse than a field that is absent, which is the same argument the five
46
+ * result states rest on. So the sentinel is gone: a tool that sets
47
+ * `result.truncated` without a `truncatedDetail` is a programming error,
48
+ * thrown in every environment except production, where the envelope instead
49
+ * reports `truncated: null` plus a disclosure naming the gap — degraded
50
+ * honestly rather than dishonestly precise. See `capped()` in `./capped.ts`
51
+ * for how a tool is meant to avoid ever hitting this.
38
52
  */
39
- import { reliabilityCap, reliabilityDisclosure, reportCategory as deriveReportCategory, } from "@descryy/ir";
53
+ import { randomUUID } from "node:crypto";
54
+ import { RELIABILITY_CLASSES, REPORT_CATEGORIES, RESULT_STATES, TOOL_CLASSES, reliabilityCap, reliabilityDisclosure, reportCategory as deriveReportCategory, } from "@descryy/ir";
40
55
  /**
41
56
  * MK-5 — which of the sixteen tools states a conclusion about the user's code
42
57
  * versus which reports a fact about the graph.
@@ -82,6 +97,209 @@ const PROVENANCE = {
82
97
  * adopts the ceiling by implementing `ToolAnswer.fitToBudget`.
83
98
  */
84
99
  export const MAX_REPLY_BYTES = 60_000;
100
+ // ---------------------------------------------------------------------------
101
+ // The wire schema for everything above
102
+ // ---------------------------------------------------------------------------
103
+ /** `T | null`, in the JSON Schema this server's declared subset uses. */
104
+ function nullable(schema) {
105
+ return { anyOf: [schema, { type: "null" }] };
106
+ }
107
+ /**
108
+ * The envelope, declared for a host to validate against — MCP's `outputSchema`.
109
+ *
110
+ * ## Why this exists at all
111
+ *
112
+ * Every reply from this server carries `structuredContent`, and until this was
113
+ * added a host had no way to check what it received. `tools/list` already ships
114
+ * `class`, `tier` and `toolVersion` on the same reasoning — a fact about the
115
+ * reply that an external client cannot otherwise read — and this is the
116
+ * standard-shaped member of that group rather than a fourth non-standard field.
117
+ *
118
+ * ## `data` is deliberately open, and that is a disclosed gap
119
+ *
120
+ * The envelope's thirteen fields are uniform across all thirty tools, so they
121
+ * are described exactly. `data` is not: its shape is `ImpactData`, `ScopeData`
122
+ * and twenty-eight others, and nothing today derives a JSON Schema from those
123
+ * TypeScript types. Hand-writing thirty schemas would put a second description
124
+ * of each shape in a second place with nothing checking the two agree — the
125
+ * drift this repo has already paid for once with the tool count in prose, and
126
+ * a schema that is confidently wrong about `data` is worse for a validating
127
+ * host than one that declines to describe it.
128
+ *
129
+ * So `data` is `{}` — "anything" — and this paragraph is the disclosure rather
130
+ * than a silent omission (rule 7). Tightening it is real work with a real
131
+ * prerequisite: a generator from the handler types, or the schemas checked
132
+ * against recorded replies. Until then the promise made here is exactly the
133
+ * promise kept.
134
+ *
135
+ * ## The enums are read, not restated
136
+ *
137
+ * `state`, `class`, `reportCategory` and `reliabilityCap` build their `enum`
138
+ * from the exported vocabulary arrays. A restated list is a second source of
139
+ * truth that goes stale in silence; spread from the array, adding a report
140
+ * category and forgetting the schema is a red test instead.
141
+ */
142
+ export const ANSWER_ENVELOPE_SCHEMA = {
143
+ type: "object",
144
+ title: "Descry answer envelope",
145
+ description: "The uniform reply shape for every Descry tool. `state` distinguishes " +
146
+ "'looked and found nothing' (empty) from 'could not look' (refused); read " +
147
+ "`disclosures` before summarising the answer.",
148
+ properties: {
149
+ tool: { type: "string", description: "The tool that produced this reply." },
150
+ toolVersion: {
151
+ type: "string",
152
+ description: "Bumped on any behaviour change; recorded with the run.",
153
+ },
154
+ callId: {
155
+ type: "string",
156
+ description: "This call's own id in this session's recorded tool calls. Cite it in verify_claim's " +
157
+ "\"callId\" to check a claim against this exact call's real result.",
158
+ },
159
+ state: {
160
+ type: "string",
161
+ enum: [...RESULT_STATES],
162
+ description: "ok = found something; empty = looked completely and found nothing (a " +
163
+ "fact about your code); refused = could not look (a fact about Descry, " +
164
+ "never about your code); failed = something broke; timed_out = ran out " +
165
+ "of budget, partial answer.",
166
+ },
167
+ class: {
168
+ type: "string",
169
+ enum: [...TOOL_CLASSES],
170
+ description: "Retry semantics: read, stateful-read, or action.",
171
+ },
172
+ headline: { type: "string", description: "One-sentence plain-English answer." },
173
+ data: {
174
+ description: "The tool's own payload, or null on refused/failed/timed_out. Shape is " +
175
+ "per-tool and is not described here — see this schema's own " +
176
+ "documentation for why, and the tool description for the fields.",
177
+ },
178
+ graph: {
179
+ type: "object",
180
+ description: "What the answer rests on.",
181
+ properties: {
182
+ commitSha: nullable({ type: "string" }),
183
+ builtAt: nullable({ type: "string" }),
184
+ irSchemaVersion: { type: "integer" },
185
+ resolutionFloor: {
186
+ ...nullable({ type: "integer", minimum: 0, maximum: 4 }),
187
+ description: "R0 syntax only; R1 imports resolved; R2 references resolved; R3 " +
188
+ "type checker; R4 observed at runtime. Null when the graph was not " +
189
+ "consulted at all.",
190
+ },
191
+ reliabilityCap: {
192
+ type: "string",
193
+ enum: [...RELIABILITY_CLASSES],
194
+ description: "C = unconfirmed behavioural prediction, must not be relayed as " +
195
+ "fact; B = structural or reference evidence; A = as strong as this " +
196
+ "graph makes it.",
197
+ },
198
+ },
199
+ required: ["commitSha", "builtAt", "irSchemaVersion", "resolutionFloor", "reliabilityCap"],
200
+ },
201
+ truncated: nullable({
202
+ type: "object",
203
+ properties: {
204
+ shown: { type: "integer" },
205
+ total: { type: "integer", description: "The count before the cap." },
206
+ more: nullable({ type: "string" }),
207
+ },
208
+ required: ["shown", "total", "more"],
209
+ }),
210
+ refusals: nullable({
211
+ type: "object",
212
+ properties: {
213
+ count: { type: "integer" },
214
+ exemplar: { type: "string" },
215
+ handle: { type: "string", description: "Pass to refusal_fetch for the full list." },
216
+ },
217
+ required: ["count", "exemplar", "handle"],
218
+ }),
219
+ budget: {
220
+ type: "object",
221
+ properties: {
222
+ elapsedMs: { type: "integer" },
223
+ limitMs: { type: "integer" },
224
+ },
225
+ required: ["elapsedMs", "limitMs"],
226
+ },
227
+ disclosures: {
228
+ type: "array",
229
+ items: { type: "string" },
230
+ description: "What this answer does not cover. Never empty when the answer is " +
231
+ "degraded, truncated, refused, failed or timed out.",
232
+ },
233
+ reportCategory: {
234
+ ...nullable({ type: "string", enum: [...REPORT_CATEGORIES] }),
235
+ description: "Null for conclusion-tier tools, and for replies that make no claim at " +
236
+ "all. 'confirmed' is unreachable from this surface by construction.",
237
+ },
238
+ provenance: {
239
+ type: "object",
240
+ description: "Constant for this server. governancePipeline is always false here.",
241
+ properties: {
242
+ surface: { type: "string", enum: ["mcp"] },
243
+ adjudicatedBy: { type: "string", enum: ["descry"] },
244
+ presentedBy: { type: "string", enum: ["host-agent"] },
245
+ governancePipeline: { type: "boolean", enum: [false] },
246
+ },
247
+ required: ["surface", "adjudicatedBy", "presentedBy", "governancePipeline"],
248
+ },
249
+ },
250
+ // Every field is emitted on every path, including the ones that are always
251
+ // null on a fault — `renderFailed` and `renderTimedOut` build the whole
252
+ // envelope. So "required" here is the literal truth rather than a minimum.
253
+ required: [
254
+ "tool",
255
+ "toolVersion",
256
+ "callId",
257
+ "state",
258
+ "class",
259
+ "headline",
260
+ "data",
261
+ "graph",
262
+ "truncated",
263
+ "refusals",
264
+ "budget",
265
+ "disclosures",
266
+ "reportCategory",
267
+ "provenance",
268
+ ],
269
+ };
270
+ /**
271
+ * The other shape a `tools/call` can return — `renderToolError`'s.
272
+ *
273
+ * Declared rather than quietly excluded. A bad argument is the most ordinary
274
+ * failure a tool has, it deliberately does not use the five-state envelope
275
+ * (see `renderToolError`), and a schema that admitted only the envelope would
276
+ * be one the server itself violates on that path. Declaring a union that is
277
+ * true beats declaring a single shape that is tidy.
278
+ */
279
+ export const TOOL_ERROR_SCHEMA = {
280
+ type: "object",
281
+ title: "Tool argument error",
282
+ description: "Returned with isError when the call itself was malformed — fix the " +
283
+ "arguments and retry. Not a statement about the code either way.",
284
+ properties: {
285
+ tool: { type: "string" },
286
+ status: { type: "string", enum: ["error"] },
287
+ message: { type: "string" },
288
+ },
289
+ required: ["tool", "status", "message"],
290
+ };
291
+ /**
292
+ * What every tool declares as its `outputSchema`: the envelope or the argument
293
+ * error, discriminated by their required fields.
294
+ *
295
+ * One shared constant rather than a per-tool object because the shape genuinely
296
+ * is shared — the only per-tool part is `data`, which is open. When `data`
297
+ * becomes describable this becomes a function of the tool.
298
+ */
299
+ export const TOOL_OUTPUT_SCHEMA = {
300
+ type: "object",
301
+ anyOf: [ANSWER_ENVELOPE_SCHEMA, TOOL_ERROR_SCHEMA],
302
+ };
85
303
  export class DisclosureError extends Error {
86
304
  constructor(message) {
87
305
  super(message);
@@ -145,6 +363,26 @@ export function renderAnswer(tool, answer, options) {
145
363
  '"we found nothing" from "we could not look" from "something broke"; with no reason attached ' +
146
364
  "this reply says none of them.");
147
365
  }
366
+ // B6, fifth invariant (module header): a truncated answer must carry real
367
+ // counts. The old fallback here was a sentinel, `{shown: -1, total: -1}` —
368
+ // worse than absent, because it passes a presence check and then poisons
369
+ // arithmetic. A tool that sets `result.truncated` without supplying
370
+ // `answer.truncatedDetail` has not held the two together the way
371
+ // `capped()` (`./capped.ts`) makes automatic, so this is a defect in that
372
+ // tool, caught here rather than shipped: thrown everywhere except
373
+ // production, where the honest degradation is `null` plus a disclosure
374
+ // that the count itself is unavailable — never a fabricated one.
375
+ let missingTruncationDetail = null;
376
+ if (result.truncated && answer.truncatedDetail === undefined) {
377
+ if (process.env["NODE_ENV"] !== "production") {
378
+ throw new DisclosureError(`${tool} set result.truncated without a truncatedDetail (shown/total). Build the capped ` +
379
+ 'slice and its detail together — see capped() in "./capped.ts" — rather than capping ' +
380
+ "and reporting separately, where one of the two can be forgotten.");
381
+ }
382
+ missingTruncationDetail =
383
+ "this reply was truncated, but how much was withheld is unavailable — a defect in this " +
384
+ "tool, not a fact about your code";
385
+ }
148
386
  const resolutionFloor = result.stamp.resolutionFloor;
149
387
  const cap = reliabilityCap(resolutionFloor, nameLevel);
150
388
  // Full the first time this connection meets this category, a short reference
@@ -153,6 +391,7 @@ export function renderAnswer(tool, answer, options) {
153
391
  const reliability = reliabilityDisclosure(resolutionFloor, nameLevel);
154
392
  const disclosures = [
155
393
  ...result.notes,
394
+ ...(missingTruncationDetail === null ? [] : [missingTruncationDetail]),
156
395
  options.disclosureLedger?.firstSighting(reliability.key) === false
157
396
  ? reliability.brief
158
397
  : reliability.full,
@@ -163,9 +402,15 @@ export function renderAnswer(tool, answer, options) {
163
402
  ]
164
403
  : []),
165
404
  ];
405
+ // B10 — minted by the caller before this call, so it is threaded through
406
+ // rather than generated here; a fallback exists only for the direct callers
407
+ // (tests) that have no session id sequence to draw from. See `callId`'s own
408
+ // doc on `AnswerEnvelope` and `RenderOptions`.
409
+ const callId = options.callId ?? randomUUID();
166
410
  const build = (data, extraNotes, fitTruncation) => ({
167
411
  tool,
168
412
  toolVersion: options.toolVersion,
413
+ callId,
169
414
  state,
170
415
  class: options.toolClass,
171
416
  headline: answer.headline,
@@ -179,10 +424,7 @@ export function renderAnswer(tool, answer, options) {
179
424
  resolutionFloor,
180
425
  reliabilityCap: cap,
181
426
  },
182
- truncated: fitTruncation ??
183
- (!result.truncated
184
- ? null
185
- : (answer.truncatedDetail ?? { shown: -1, total: -1, more: null })),
427
+ truncated: fitTruncation ?? (!result.truncated ? null : (answer.truncatedDetail ?? null)),
186
428
  refusals: answer.refusalSummary ?? null,
187
429
  budget: { elapsedMs: options.elapsedMs, limitMs: options.limitMs },
188
430
  // The fit's own notes go first among the disclosures it added, ahead of
@@ -300,6 +542,7 @@ export function renderFailed(tool, message, options) {
300
542
  const envelope = {
301
543
  tool,
302
544
  toolVersion: options.toolVersion,
545
+ callId: options.callId ?? randomUUID(),
303
546
  state: "failed",
304
547
  class: options.toolClass,
305
548
  headline: `${tool} failed.`,
@@ -343,6 +586,7 @@ export function renderHandshake(tool, token, willDo, options) {
343
586
  const envelope = {
344
587
  tool,
345
588
  toolVersion: options.toolVersion,
589
+ callId: options.callId ?? randomUUID(),
346
590
  state: "ok",
347
591
  class: options.toolClass,
348
592
  headline: `Confirmation required: ${willDo}`,
@@ -383,6 +627,7 @@ export function renderTimedOut(tool, options) {
383
627
  const envelope = {
384
628
  tool,
385
629
  toolVersion: options.toolVersion,
630
+ callId: options.callId ?? randomUUID(),
386
631
  state: "timed_out",
387
632
  class: options.toolClass,
388
633
  headline: `${tool} timed out.`,
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,cAAc,IAAI,oBAAoB,GAGvC,MAAM,aAAa,CAAC;AAQrB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,UAAU,CAAU,CAAC;AAkB9D,MAAM,UAAU,GAAe;IAC7B,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,QAAQ;IACvB,WAAW,EAAE,YAAY;IACzB,kBAAkB,EAAE,KAAK;CAC1B,CAAC;AA8FF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AA0GtC,MAAM,OAAO,eAAgB,SAAQ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,CAAC,IAAY,EAAE,OAAsB;IACjE,MAAM,QAAQ,GAAyB;QACrC,IAAI;QACJ,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,UAAU,EAAE;QACtC,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,OAAO,CAAC,SAAS;QACxB,QAAQ,EAAE,GAAG,IAAI,aAAa;QAC9B,IAAI,EAAE,IAAI;QACV,KAAK,EAAE;YACL,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI;YACb,eAAe,EAAE,CAAC;YAClB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,GAAG;SACpB;QACD,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;QAClE,WAAW,EAAE;YACX,GAAG,IAAI,8BAA8B,OAAO,CAAC,OAAO,2CAA2C;gBAC7F,oEAAoE;SACvE;QACD,8DAA8D;QAC9D,cAAc,EAAE,IAAI;QACpB,UAAU,EAAE,UAAU;KACvB,CAAC;IACF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,iBAAiB,EAAE,QAA8C;QACjE,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
@@ -40,6 +40,24 @@
40
40
  * Every failure leaves here as a thrown `RuntimeAdapterLoadError` carrying the
41
41
  * specifier and the reason, so the caller cannot take an adapter without also
42
42
  * having to handle not getting one.
43
+ *
44
+ * ## B5: a bare specifier now resolves from the user's own repository first
45
+ *
46
+ * A bare specifier in a dynamic `import()` resolves against the IMPORTING
47
+ * MODULE's own location — this file's, unconditionally, before this fix. The
48
+ * documented launch (`npx -y @descryy/mcp <repo-path>`) puts this file inside
49
+ * an npx cache, so that root held only what npx installed; the user's
50
+ * repository, its `node_modules`, and the working directory were never
51
+ * consulted, which made the documented remedy ("install the adapter
52
+ * alongside this server") impossible under the documented configuration.
53
+ *
54
+ * `resolveAdapterModule` (below `loadRuntimeAdapter`) now tries three roots
55
+ * in order and names every one tried on failure: an already-resolved
56
+ * specifier is used directly; a bare specifier resolves from `repoPath` —
57
+ * the repository `observe_runtime` was pointed at — via `createRequire`
58
+ * anchored at that repo's own `package.json`; failing that, from this
59
+ * module's own closure, unchanged, so an adapter already declared as
60
+ * `@descryy/mcp`'s own dependency still resolves.
43
61
  */
44
62
  import type { RuntimeAdapter } from "@descryy/runtime-backend-observation";
45
63
  /** A runtime adapter named the way `SourceSpec` names a static one. */
@@ -59,5 +77,5 @@ export declare class RuntimeAdapterLoadError extends Error {
59
77
  readonly spec: RuntimeAdapterSpec;
60
78
  constructor(spec: RuntimeAdapterSpec, reason: string);
61
79
  }
62
- export declare function loadRuntimeAdapter(spec: RuntimeAdapterSpec): Promise<RuntimeAdapter>;
80
+ export declare function loadRuntimeAdapter(spec: RuntimeAdapterSpec, repoPath: string): Promise<RuntimeAdapter>;
63
81
  //# sourceMappingURL=runtime-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-registry.d.ts","sourceRoot":"","sources":["../src/runtime-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAE3E,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,K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