agentfootprint 11.4.0 → 12.0.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 (198) hide show
  1. package/CAPABILITIES.md +3 -1
  2. package/dist/adapters/code/agentcore.js +295 -214
  3. package/dist/adapters/code/agentcore.js.map +1 -1
  4. package/dist/adapters/code/agentcoreClient.js +178 -0
  5. package/dist/adapters/code/agentcoreClient.js.map +1 -0
  6. package/dist/adapters/code/agentcoreWire.js +348 -0
  7. package/dist/adapters/code/agentcoreWire.js.map +1 -0
  8. package/dist/adapters/code/fileName.js +100 -0
  9. package/dist/adapters/code/fileName.js.map +1 -0
  10. package/dist/adapters/code/local.js +529 -183
  11. package/dist/adapters/code/local.js.map +1 -1
  12. package/dist/adapters/code/output.js +140 -0
  13. package/dist/adapters/code/output.js.map +1 -0
  14. package/dist/adapters/mcp/agentcoreRuntime/invoke.js +7 -6
  15. package/dist/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
  16. package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js +36 -2
  17. package/dist/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
  18. package/dist/adapters/mcp/agentcoreRuntime/transport.js +3 -1
  19. package/dist/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
  20. package/dist/core/codeRunnerTool.js +52 -7
  21. package/dist/core/codeRunnerTool.js.map +1 -1
  22. package/dist/doors/providers.js.map +1 -1
  23. package/dist/esm/adapters/code/agentcore.d.ts +65 -68
  24. package/dist/esm/adapters/code/agentcore.js +293 -212
  25. package/dist/esm/adapters/code/agentcore.js.map +1 -1
  26. package/dist/esm/adapters/code/agentcoreClient.d.ts +193 -0
  27. package/dist/esm/adapters/code/agentcoreClient.js +173 -0
  28. package/dist/esm/adapters/code/agentcoreClient.js.map +1 -0
  29. package/dist/esm/adapters/code/agentcoreWire.d.ts +119 -0
  30. package/dist/esm/adapters/code/agentcoreWire.js +334 -0
  31. package/dist/esm/adapters/code/agentcoreWire.js.map +1 -0
  32. package/dist/esm/adapters/code/fileName.d.ts +43 -0
  33. package/dist/esm/adapters/code/fileName.js +96 -0
  34. package/dist/esm/adapters/code/fileName.js.map +1 -0
  35. package/dist/esm/adapters/code/local.d.ts +91 -12
  36. package/dist/esm/adapters/code/local.js +528 -182
  37. package/dist/esm/adapters/code/local.js.map +1 -1
  38. package/dist/esm/adapters/code/output.d.ts +70 -0
  39. package/dist/esm/adapters/code/output.js +129 -0
  40. package/dist/esm/adapters/code/output.js.map +1 -0
  41. package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.d.ts +7 -6
  42. package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js +7 -6
  43. package/dist/esm/adapters/mcp/agentcoreRuntime/invoke.js.map +1 -1
  44. package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +32 -1
  45. package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js +35 -1
  46. package/dist/esm/adapters/mcp/agentcoreRuntime/sessionBusy.js.map +1 -1
  47. package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js +4 -2
  48. package/dist/esm/adapters/mcp/agentcoreRuntime/transport.js.map +1 -1
  49. package/dist/esm/core/codeRunnerTool.d.ts +15 -3
  50. package/dist/esm/core/codeRunnerTool.js +52 -7
  51. package/dist/esm/core/codeRunnerTool.js.map +1 -1
  52. package/dist/esm/doors/providers.d.ts +1 -1
  53. package/dist/esm/doors/providers.js.map +1 -1
  54. package/dist/esm/events/payloads.d.ts +144 -29
  55. package/dist/esm/index.d.ts +2 -0
  56. package/dist/esm/index.js +5 -0
  57. package/dist/esm/index.js.map +1 -1
  58. package/dist/esm/mcp/callLifetime.d.ts +57 -14
  59. package/dist/esm/mcp/callLifetime.js +67 -19
  60. package/dist/esm/mcp/callLifetime.js.map +1 -1
  61. package/dist/esm/mcp/callMarker.d.ts +43 -0
  62. package/dist/esm/mcp/callMarker.js +69 -0
  63. package/dist/esm/mcp/callMarker.js.map +1 -0
  64. package/dist/esm/mcp/connectionRefusals.js +7 -0
  65. package/dist/esm/mcp/connectionRefusals.js.map +1 -1
  66. package/dist/esm/mcp/index.d.ts +2 -0
  67. package/dist/esm/mcp/index.js +3 -0
  68. package/dist/esm/mcp/index.js.map +1 -1
  69. package/dist/esm/mcp/mcpClient.js +93 -26
  70. package/dist/esm/mcp/mcpClient.js.map +1 -1
  71. package/dist/esm/mcp/replay.d.ts +291 -0
  72. package/dist/esm/mcp/replay.js +405 -0
  73. package/dist/esm/mcp/replay.js.map +1 -0
  74. package/dist/esm/mcp/replayUnavailable.d.ts +68 -0
  75. package/dist/esm/mcp/replayUnavailable.js +87 -0
  76. package/dist/esm/mcp/replayUnavailable.js.map +1 -0
  77. package/dist/esm/mcp/requestLedger.d.ts +115 -32
  78. package/dist/esm/mcp/requestLedger.js +193 -52
  79. package/dist/esm/mcp/requestLedger.js.map +1 -1
  80. package/dist/esm/mcp/seriesEvidence.d.ts +73 -15
  81. package/dist/esm/mcp/seriesEvidence.js +114 -21
  82. package/dist/esm/mcp/seriesEvidence.js.map +1 -1
  83. package/dist/esm/mcp/throttleRetry.d.ts +86 -42
  84. package/dist/esm/mcp/throttleRetry.js +158 -50
  85. package/dist/esm/mcp/throttleRetry.js.map +1 -1
  86. package/dist/esm/mcp/toolResult.d.ts +6 -0
  87. package/dist/esm/mcp/toolResult.js +15 -0
  88. package/dist/esm/mcp/toolResult.js.map +1 -1
  89. package/dist/esm/mcp/types.d.ts +73 -8
  90. package/dist/esm/provider-contract/codeSandbox.d.ts +89 -0
  91. package/dist/esm/provider-contract/codeSandbox.js +119 -0
  92. package/dist/esm/provider-contract/codeSandbox.js.map +1 -0
  93. package/dist/esm/provider-contract/sessionExpired.d.ts +31 -0
  94. package/dist/esm/provider-contract/sessionExpired.js +40 -0
  95. package/dist/esm/provider-contract/sessionExpired.js.map +1 -0
  96. package/dist/esm/provider-contract/types.d.ts +166 -17
  97. package/dist/esm/provider-contract/types.js +9 -0
  98. package/dist/esm/provider-contract/types.js.map +1 -1
  99. package/dist/esm/redaction/knownStrings.js +16 -0
  100. package/dist/esm/redaction/knownStrings.js.map +1 -1
  101. package/dist/esm/tool-providers/index.d.ts +2 -2
  102. package/dist/esm/tool-providers/index.js +4 -0
  103. package/dist/esm/tool-providers/index.js.map +1 -1
  104. package/dist/esm/tools/requestEvidence.js +60 -0
  105. package/dist/esm/tools/requestEvidence.js.map +1 -1
  106. package/dist/index.js +12 -4
  107. package/dist/index.js.map +1 -1
  108. package/dist/mcp/callLifetime.js +66 -18
  109. package/dist/mcp/callLifetime.js.map +1 -1
  110. package/dist/mcp/callMarker.js +74 -0
  111. package/dist/mcp/callMarker.js.map +1 -0
  112. package/dist/mcp/connectionRefusals.js +7 -0
  113. package/dist/mcp/connectionRefusals.js.map +1 -1
  114. package/dist/mcp/index.js +5 -1
  115. package/dist/mcp/index.js.map +1 -1
  116. package/dist/mcp/mcpClient.js +91 -24
  117. package/dist/mcp/mcpClient.js.map +1 -1
  118. package/dist/mcp/replay.js +415 -0
  119. package/dist/mcp/replay.js.map +1 -0
  120. package/dist/mcp/replayUnavailable.js +92 -0
  121. package/dist/mcp/replayUnavailable.js.map +1 -0
  122. package/dist/mcp/requestLedger.js +193 -52
  123. package/dist/mcp/requestLedger.js.map +1 -1
  124. package/dist/mcp/seriesEvidence.js +116 -22
  125. package/dist/mcp/seriesEvidence.js.map +1 -1
  126. package/dist/mcp/throttleRetry.js +160 -51
  127. package/dist/mcp/throttleRetry.js.map +1 -1
  128. package/dist/mcp/toolResult.js +17 -1
  129. package/dist/mcp/toolResult.js.map +1 -1
  130. package/dist/provider-contract/codeSandbox.js +125 -0
  131. package/dist/provider-contract/codeSandbox.js.map +1 -0
  132. package/dist/provider-contract/sessionExpired.js +44 -0
  133. package/dist/provider-contract/sessionExpired.js.map +1 -0
  134. package/dist/provider-contract/types.js +12 -1
  135. package/dist/provider-contract/types.js.map +1 -1
  136. package/dist/redaction/knownStrings.js +16 -0
  137. package/dist/redaction/knownStrings.js.map +1 -1
  138. package/dist/tool-providers/index.js +5 -1
  139. package/dist/tool-providers/index.js.map +1 -1
  140. package/dist/tools/requestEvidence.js +60 -0
  141. package/dist/tools/requestEvidence.js.map +1 -1
  142. package/dist/types/adapters/code/agentcore.d.ts +65 -68
  143. package/dist/types/adapters/code/agentcore.d.ts.map +1 -1
  144. package/dist/types/adapters/code/agentcoreClient.d.ts +194 -0
  145. package/dist/types/adapters/code/agentcoreClient.d.ts.map +1 -0
  146. package/dist/types/adapters/code/agentcoreWire.d.ts +120 -0
  147. package/dist/types/adapters/code/agentcoreWire.d.ts.map +1 -0
  148. package/dist/types/adapters/code/fileName.d.ts +44 -0
  149. package/dist/types/adapters/code/fileName.d.ts.map +1 -0
  150. package/dist/types/adapters/code/local.d.ts +91 -12
  151. package/dist/types/adapters/code/local.d.ts.map +1 -1
  152. package/dist/types/adapters/code/output.d.ts +71 -0
  153. package/dist/types/adapters/code/output.d.ts.map +1 -0
  154. package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts +7 -6
  155. package/dist/types/adapters/mcp/agentcoreRuntime/invoke.d.ts.map +1 -1
  156. package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts +32 -1
  157. package/dist/types/adapters/mcp/agentcoreRuntime/sessionBusy.d.ts.map +1 -1
  158. package/dist/types/adapters/mcp/agentcoreRuntime/transport.d.ts.map +1 -1
  159. package/dist/types/core/codeRunnerTool.d.ts +15 -3
  160. package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
  161. package/dist/types/doors/providers.d.ts +1 -1
  162. package/dist/types/doors/providers.d.ts.map +1 -1
  163. package/dist/types/events/payloads.d.ts +144 -29
  164. package/dist/types/events/payloads.d.ts.map +1 -1
  165. package/dist/types/index.d.ts +2 -0
  166. package/dist/types/index.d.ts.map +1 -1
  167. package/dist/types/mcp/callLifetime.d.ts +57 -14
  168. package/dist/types/mcp/callLifetime.d.ts.map +1 -1
  169. package/dist/types/mcp/callMarker.d.ts +44 -0
  170. package/dist/types/mcp/callMarker.d.ts.map +1 -0
  171. package/dist/types/mcp/index.d.ts +2 -0
  172. package/dist/types/mcp/index.d.ts.map +1 -1
  173. package/dist/types/mcp/mcpClient.d.ts.map +1 -1
  174. package/dist/types/mcp/replay.d.ts +292 -0
  175. package/dist/types/mcp/replay.d.ts.map +1 -0
  176. package/dist/types/mcp/replayUnavailable.d.ts +69 -0
  177. package/dist/types/mcp/replayUnavailable.d.ts.map +1 -0
  178. package/dist/types/mcp/requestLedger.d.ts +115 -32
  179. package/dist/types/mcp/requestLedger.d.ts.map +1 -1
  180. package/dist/types/mcp/seriesEvidence.d.ts +73 -15
  181. package/dist/types/mcp/seriesEvidence.d.ts.map +1 -1
  182. package/dist/types/mcp/throttleRetry.d.ts +86 -42
  183. package/dist/types/mcp/throttleRetry.d.ts.map +1 -1
  184. package/dist/types/mcp/toolResult.d.ts +6 -0
  185. package/dist/types/mcp/toolResult.d.ts.map +1 -1
  186. package/dist/types/mcp/types.d.ts +73 -8
  187. package/dist/types/mcp/types.d.ts.map +1 -1
  188. package/dist/types/provider-contract/codeSandbox.d.ts +90 -0
  189. package/dist/types/provider-contract/codeSandbox.d.ts.map +1 -0
  190. package/dist/types/provider-contract/sessionExpired.d.ts +32 -0
  191. package/dist/types/provider-contract/sessionExpired.d.ts.map +1 -0
  192. package/dist/types/provider-contract/types.d.ts +166 -17
  193. package/dist/types/provider-contract/types.d.ts.map +1 -1
  194. package/dist/types/redaction/knownStrings.d.ts.map +1 -1
  195. package/dist/types/tool-providers/index.d.ts +2 -2
  196. package/dist/types/tool-providers/index.d.ts.map +1 -1
  197. package/dist/types/tools/requestEvidence.d.ts.map +1 -1
  198. package/package.json +1 -1
@@ -15,27 +15,53 @@
15
15
  * the call. The link is undone when the call settles: the SDK keeps its
16
16
  * abort listener on the signal it was given, and a link that outlived the
17
17
  * call would cancel a request that had already finished.
18
- * 2. ITS TICKET is issued, when the call carries the run's evidence port and
19
- * the connection has a ledger, keyed by the request's params object.
18
+ * 2. ITS MARKER is issued when the connection has a ledger, with its ticket
19
+ * when the call carries the run's evidence port: a library-private string
20
+ * in the request's `_meta` (`callMarker.ts`), which ties the request to
21
+ * the call even when the SDK copies the params, and which the transport
22
+ * takes out before anything is sent.
20
23
  * 3. ITS SETTLING ENDS ITS SERIES. However `callTool` settles — answered,
21
24
  * failed, or given up by the SDK (its own timeout) — a retry series still
22
25
  * sending the request is cut there and then, inside the call: it files
23
26
  * `cancelled` before the call's result is read, and sends nothing more.
27
+ * 4. ITS VERDICT REACHES ITS RECORD. A series that has ended waits for the
28
+ * call to settle before it files, because only the call can say whether
29
+ * the answer completed — a 200 can carry a tool error. The call leaves its
30
+ * verdict in the request's shared replay facts (`replay.ts` ·
31
+ * `RequestReplay`) before it settles the series' wait.
32
+ * 5. "MAY HAVE RUN" IS RAISED HERE — footprintjs's law, under the
33
+ * `'app-authorized'` policy (`replay.ts` · `RequestReplay`, its
34
+ * `uncertain`). A received refusal or error is preserved: a 429, a 503,
35
+ * a JSON-RPC or tool error — or a chain in which every attempt received
36
+ * one — keeps the server's error as it came, its effect still `unknown`.
37
+ * A call that genuinely lacked an answer somewhere — an attempt with no
38
+ * response at all, or a request the HTTP layer accepted whose JSON-RPC
39
+ * answer never came — and then fails, fails with footprintjs's
40
+ * `UnknownEffectError`, its final error (a later refusal's, or the
41
+ * timeout) as the `cause`: that error alone would read as "failed, try
42
+ * again". A call that completes returns normally. Under `'compatibility'`
43
+ * the caller sees the error it always did; the record still says the
44
+ * effect is unknown. A cancellation never raises it: a call its caller
45
+ * cancelled ends with the caller's reason, as it always did.
24
46
  *
25
- * In dev mode, a ticket that no request was bound to by the time the call
26
- * settled, when a `tools/call` request DID go out, is named once per connection: the SDK copied
27
- * the params, so the call's attempts could not be matched to it. Its
28
- * cancellation still reached the request (1, and the ledger's own watch on
29
- * `notifications/cancelled`).
47
+ * In dev mode, a ticket that no request was matched to by the time the call
48
+ * settled, when a `tools/call` request DID go out, is named once per
49
+ * connection: the SDK rebuilt the params without the marker, so the call's
50
+ * attempts could not be matched to it. Its cancellation still reached the
51
+ * request (1, and the ledger's own watch on `notifications/cancelled`). Under
52
+ * `'app-authorized'` such a request is never sent at all
53
+ * (`replayUnavailable.ts`).
30
54
  */
31
- import { isDevMode } from 'footprintjs';
55
+ import { isDevMode, UnknownEffectError } from 'footprintjs';
32
56
  import { eitherSignal, linkedController } from '../lib/abort.js';
33
57
  import { requestEvidenceOf } from '../tools/requestEvidence.js';
58
+ import { markParams } from './callMarker.js';
34
59
  /**
35
60
  * Open one call.
36
61
  *
37
- * @param params the request's params object — the SDK hands this very object to
38
- * the transport, which is how the ledger knows the request is this call's.
62
+ * @param params the request's params. The call sends them marked
63
+ * (`OpenCall.params`): the marker, not the object, is how the ledger knows
64
+ * the request is this call's — it survives an SDK that copies the params.
39
65
  * @param ctx the call's context: its signal, and the run's evidence port if any.
40
66
  * @param clientSignal the client's own `signal` (`McpClientOptions.signal`).
41
67
  * @param ledger the connection's ledger, when the library built its transport.
@@ -51,15 +77,37 @@ export function openCall(params, ctx, clientSignal, ledger, server) {
51
77
  ? undefined
52
78
  : { sink, signal: eitherSignal(signal, settled?.signal) };
53
79
  const sentBefore = ledger?.toolCallsSent ?? 0;
54
- if (ticket !== undefined)
55
- ledger?.issue(params, ticket);
80
+ // Every call on a watched connection gets a marker, ticket or not: under
81
+ // 'app-authorized' its request must be matched to it either way. The call
82
+ // holds its entry, so what it reads survives the connection closing.
83
+ const issued = ledger?.issue(ticket);
84
+ let mayHaveRun = false;
56
85
  return {
86
+ params: issued === undefined ? params : markParams(params, issued.marker),
57
87
  ...(signal !== undefined && { signal }),
58
- close: () => {
88
+ failed: (error, verdict) => {
89
+ // A call its caller cancelled ends with the caller's reason, whatever its
90
+ // series did; the record still says what is known of its effect.
91
+ if (verdict === 'completed' || signal?.aborted === true)
92
+ return error;
93
+ const replay = issued?.request?.replay;
94
+ if (replay === undefined || !replay.uncertain)
95
+ return error;
96
+ mayHaveRun = true;
97
+ // The key, when one was sent, is an argument VALUE: it stays with the
98
+ // caller, who sent it, and never rides an error a run may record.
99
+ return new UnknownEffectError({ system: server, attempts: replay.sent, cause: error });
100
+ },
101
+ close: (verdict) => {
102
+ // The verdict first: settling the series' wait files its record.
103
+ issued?.request?.replay.settle(verdict, mayHaveRun);
104
+ // By its own entry, never the params object: a copy cannot keep a watch alive.
105
+ if (issued !== undefined)
106
+ ledger?.settle(issued);
59
107
  settled?.abort(callSettled());
60
108
  link?.unlink();
61
109
  if (ticket !== undefined && ledger !== undefined) {
62
- noteUnbound(ledger, ticket, sentBefore, server);
110
+ noteUnbound(ledger, issued?.request !== undefined, sentBefore, server);
63
111
  }
64
112
  },
65
113
  };
@@ -85,15 +133,15 @@ function callSettled() {
85
133
  });
86
134
  }
87
135
  /** Dev mode, once per connection: a request went out for this call, but the ledger never matched it. */
88
- function noteUnbound(ledger, ticket, sentBefore, server) {
89
- if (!isDevMode() || ledger.wasBound(ticket) || ledger.toolCallsSent <= sentBefore)
136
+ function noteUnbound(ledger, matched, sentBefore, server) {
137
+ if (!isDevMode() || matched || ledger.toolCallsSent <= sentBefore)
90
138
  return;
91
139
  if (!ledger.firstUnbound())
92
140
  return;
93
141
  // eslint-disable-next-line no-console
94
142
  console.warn(`[agentfootprint] mcpClient[${server}]: a tool call's request could not be matched to ` +
95
- 'the call, so its retry attempts were not recorded in the run. The MCP SDK copied the ' +
96
- "request's params before sending them. The call itself is unaffected, and its " +
97
- 'cancellation still reached the request.');
143
+ 'the call, so its retry attempts were not recorded in the run. The MCP SDK sent the ' +
144
+ "request without the call's `_meta` marker: it rebuilt the request's params. The call " +
145
+ 'itself is unaffected, and its cancellation still reached the request.');
98
146
  }
99
147
  //# sourceMappingURL=callLifetime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"callLifetime.js","sourceRoot":"","sources":["../../../src/mcp/callLifetime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,E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jD,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,SAAS,QAAQ,CAAC,GAAY;IAC5B,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,WAAW,KAAK,WAAW,EAAE,CAAC;QAClF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAI,GAAqC,CAAC,MAAM,CAAC;IACzD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,CAAC;AAED,0EAA0E;AAC1E,SAAS,WAAW;IAClB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,0DAA0D,CAAC,EAAE;QAC1F,IAAI,EAAE,YAAY;KACnB,CAAC,CAAC;AACL,CAAC;AAED,wGAAwG;AACxG,SAAS,WAAW,CAClB,MAAqB,EACrB,OAAgB,EAChB,UAAkB,EAClB,MAAc;IAEd,IAAI,CAAC,SAAS,EAAE,IAAI,OAAO,IAAI,MAAM,CAAC,aAAa,IAAI,UAAU;QAAE,OAAO;IAC1E,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE;QAAE,OAAO;IACnC,sCAAsC;IACtC,OAAO,CAAC,IAAI,CACV,8BAA8B,MAAM,mDAAmD;QACrF,qFAAqF;QACrF,uFAAuF;QACvF,uEAAuE,CAC1E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * callMarker — a library-private marker that ties one MCP tool call to the one
3
+ * request the SDK sends for it, whatever the SDK copies on the way.
4
+ *
5
+ * Pattern: mark at the call, take at the transport.
6
+ * Role: The correlation hop of the request ledger (`requestLedger.ts`). The
7
+ * call puts its marker in the request's own `_meta` bag
8
+ * (`markParams`); the MCP SDK carries `_meta` through to the
9
+ * transport — the very object, or a copy of it (`structuredClone`, a
10
+ * spread) — and the ledger's watched `send` takes the marker out again
11
+ * (`takeMarker`) before the transport serializes the request. The
12
+ * server receives the bytes it always did: the marker never leaves the
13
+ * client.
14
+ *
15
+ * An object's identity does not survive a copy; a string inside it does. So an
16
+ * SDK that copies the params still delivers the marker, and the request is
17
+ * matched to its call by the call's own word, never by guessing from content
18
+ * (two calls with the same arguments are the case content matching gets wrong).
19
+ * An SDK that rebuilds the params and drops `_meta` delivers nothing: the
20
+ * request then matches no call, and the ledger says so (`requestLedger.ts`).
21
+ */
22
+ /** The `_meta` key the marker rides under. Never sent: `takeMarker` removes it. */
23
+ export declare const CALL_MARKER_KEY = "agentfootprint/call-ref";
24
+ /**
25
+ * `params` with `marker` added to its `_meta` bag: a new object, with every
26
+ * other key in its place; `params` itself is not changed. A `_meta` that was
27
+ * absent is added, after the other keys, so `takeMarker` can remove it whole.
28
+ */
29
+ export declare function markParams<P extends object>(params: P, marker: string): P;
30
+ /** What `takeMarker` found: the marker, when the message carried one, and the message to send. */
31
+ export interface TakenMarker {
32
+ readonly marker?: string;
33
+ /** The message without the marker, or the message itself when it carried none. */
34
+ readonly message: unknown;
35
+ }
36
+ /**
37
+ * The marker a JSON-RPC message carries in `params._meta`, and the message
38
+ * without it. The message is never changed in place: the SDK's object stays
39
+ * the SDK's. Without the marker, the params are what they were before
40
+ * `markParams`: a `_meta` the marker alone filled is removed, and any other
41
+ * entry, the SDK's own included, keeps its place.
42
+ */
43
+ export declare function takeMarker(message: unknown): TakenMarker;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * callMarker — a library-private marker that ties one MCP tool call to the one
3
+ * request the SDK sends for it, whatever the SDK copies on the way.
4
+ *
5
+ * Pattern: mark at the call, take at the transport.
6
+ * Role: The correlation hop of the request ledger (`requestLedger.ts`). The
7
+ * call puts its marker in the request's own `_meta` bag
8
+ * (`markParams`); the MCP SDK carries `_meta` through to the
9
+ * transport — the very object, or a copy of it (`structuredClone`, a
10
+ * spread) — and the ledger's watched `send` takes the marker out again
11
+ * (`takeMarker`) before the transport serializes the request. The
12
+ * server receives the bytes it always did: the marker never leaves the
13
+ * client.
14
+ *
15
+ * An object's identity does not survive a copy; a string inside it does. So an
16
+ * SDK that copies the params still delivers the marker, and the request is
17
+ * matched to its call by the call's own word, never by guessing from content
18
+ * (two calls with the same arguments are the case content matching gets wrong).
19
+ * An SDK that rebuilds the params and drops `_meta` delivers nothing: the
20
+ * request then matches no call, and the ledger says so (`requestLedger.ts`).
21
+ */
22
+ /** The `_meta` key the marker rides under. Never sent: `takeMarker` removes it. */
23
+ export const CALL_MARKER_KEY = 'agentfootprint/call-ref';
24
+ /**
25
+ * `params` with `marker` added to its `_meta` bag: a new object, with every
26
+ * other key in its place; `params` itself is not changed. A `_meta` that was
27
+ * absent is added, after the other keys, so `takeMarker` can remove it whole.
28
+ */
29
+ export function markParams(params, marker) {
30
+ const meta = recordOf(params._meta) ?? {};
31
+ return { ...params, _meta: { ...meta, [CALL_MARKER_KEY]: marker } };
32
+ }
33
+ /**
34
+ * The marker a JSON-RPC message carries in `params._meta`, and the message
35
+ * without it. The message is never changed in place: the SDK's object stays
36
+ * the SDK's. Without the marker, the params are what they were before
37
+ * `markParams`: a `_meta` the marker alone filled is removed, and any other
38
+ * entry, the SDK's own included, keeps its place.
39
+ */
40
+ export function takeMarker(message) {
41
+ const fields = recordOf(message);
42
+ const params = recordOf(fields?.['params']);
43
+ const meta = recordOf(params?.['_meta']);
44
+ if (fields === undefined ||
45
+ params === undefined ||
46
+ meta === undefined ||
47
+ !Object.prototype.hasOwnProperty.call(meta, CALL_MARKER_KEY)) {
48
+ return { message };
49
+ }
50
+ const { [CALL_MARKER_KEY]: marker, ...rest } = meta;
51
+ // A copy keeps every key in its place: `_meta` is replaced where it stood, or
52
+ // removed when the marker alone filled it.
53
+ const unmarked = { ...params };
54
+ if (Object.keys(rest).length > 0)
55
+ unmarked['_meta'] = rest;
56
+ else
57
+ delete unmarked['_meta'];
58
+ return {
59
+ ...(typeof marker === 'string' && { marker }),
60
+ message: { ...fields, params: unmarked },
61
+ };
62
+ }
63
+ /** A plain object's own fields, or `undefined` for anything else. */
64
+ function recordOf(value) {
65
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
66
+ ? value
67
+ : undefined;
68
+ }
69
+ //# sourceMappingURL=callMarker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callMarker.js","sourceRoot":"","sources":["../../../src/mcp/callMarker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAmB,MAAS,EAAE,MAAc;IACpE,MAAM,IAAI,GAAG,QAAQ,CAAE,MAAuC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5E,OAAO,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;AACtE,CAAC;AASD;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACzC,IACE,MAAM,KAAK,SAAS;QACpB,MAAM,KAAK,SAAS;QACpB,IAAI,KAAK,SAAS;QAClB,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,EAC5D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;IACD,MAAM,EAAE,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,CAAC;IACpD,8EAA8E;IAC9E,2CAA2C;IAC3C,MAAM,QAAQ,GAA4B,EAAE,GAAG,MAAM,EAAE,CAAC;IACxD,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;;QACtD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9B,OAAO;QACL,GAAG,CAAC,OAAO,MAAM,KAAK,QAAQ,IAAI,EAAE,MAAM,EAAE,CAAC;QAC7C,OAAO,EAAE,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE;KACzC,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACzE,CAAC,CAAE,KAA2C;QAC9C,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
@@ -65,6 +65,13 @@ const BUILT_BY_THE_TRANSPORT = [
65
65
  '`agentfootprint/providers`) and hand THAT to your transport — it is the same ' +
66
66
  'implementation, applied where you build it.',
67
67
  ],
68
+ [
69
+ 'replay',
70
+ 'The replay declaration is asked by the retry series inside that transport, and a ' +
71
+ 'connection you built has none of ours: `retryingFetch` keeps the compatibility ' +
72
+ 'policy (a 429 retried for every tool, the assumption recorded nowhere). Pass ' +
73
+ '`transport` instead to have tool calls sent again only as you declare.',
74
+ ],
68
75
  [
69
76
  'clientInfo',
70
77
  'Pass it to the SDK `Client` constructor instead: `new Client(clientInfo, { capabilities: {} })`.',
@@ -1 +1 @@
1
- {"version":3,"file":"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ED,sDAAsD;IACtD,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,sBAAsB,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,0BAA0B,MAAM,6BAA6B;gBAChE,oEAAoE,MAAM,QAAQ;gBAClF,6DAA6D,KAAK,EAAE,CACvE,CAAC;QACJ,CAAC;IACH,CAAC;IACD,gBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,sBAAsB,GAExB;IACF;QACE,iBAAiB;QACjB,gFAAgF;YAC9E,+EAA+E;YAC/E,6CAA6C;KAChD;IACD;QACE,QAAQ;QACR,mFAAmF;YACjF,iFAAiF;YACjF,+EAA+E;YAC/E,wEAAwE;KAC3E;IACD;QACE,YAAY;QACZ,kGAAkG;KACnG;IACD;QACE,WAAW;QACX,gGAAgG;KACjG;IACD;QACE,KAAK;QACL,+EAA+E;YAC7E,wCAAwC;KAC3C;IACD;QACE,SAAS;QACT,uFAAuF;KACxF;CACF,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,SAAS,gBAAgB,CAAC,UAAmB,EAAE,EAAU;IACvD,MAAM,OAAO,GAAG,CAAC,UAAU,IAAI,EAAE,CAAsC,CAAC;IACxE,KAAK,MAAM,MAAM,IAAI,kBAAkB,EAAE,CAAC;QACxC,IAAI,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,UAAU,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,GAAG,EAAE,6BAA6B,MAAM,yCAAyC;gBAC/E,oFAAoF;gBACpF,kFAAkF;gBAClF,uDAAuD,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -11,4 +11,6 @@ export { mockMcpClient, type MockMcpClientOptions, type MockMcpTool } from './mo
11
11
  export { gatewayTransport, GatewayAuthorizationRequiredError, type GatewayTransportOptions, } from './gatewayTransport.js';
12
12
  export { retryingFetch } from './throttleRetry.js';
13
13
  export type { RetryOnThrottle, ThrottleFetch, ThrottleRetryInfo, ThrottleRetryOptions, } from './throttleRetry.js';
14
+ export type { McpReplayDeduplication, McpReplayKind, McpReplayOptions, McpReplayPolicy, McpReplayTool, } from './replay.js';
15
+ export { McpReplayUnavailableError, type McpReplayUnavailableReason } from './replayUnavailable.js';
14
16
  export type { McpCallToolResult, McpClient, McpClientOptions, McpConnection, McpConnectionOptions, McpSdk, McpGatewayTransport, McpHttpTransport, McpStdioTransport, McpTransport, McpSdkClient, McpServeOptions, McpServeHandle, McpServeTransport, McpHttpServeTransport, McpStdioServeTransport, McpSdkServer, } from './types.js';
@@ -15,4 +15,7 @@ export { gatewayTransport, GatewayAuthorizationRequiredError, } from './gatewayT
15
15
  // 9.81.0 so the `connection` arm, which builds no transport of its own, can
16
16
  // apply the SAME implementation instead of silently going without it.
17
17
  export { retryingFetch } from './throttleRetry.js';
18
+ // A call under 'app-authorized' that a connection cannot honour is refused
19
+ // before it is sent, with a typed reason.
20
+ export { McpReplayUnavailableError } from './replayUnavailable.js';
18
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,8EAA8E;AAC9E,0EAA0E;AAC1E,OAAO,EAAE,mBAAmB,EAAsB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAA+C,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACL,gBAAgB,EAChB,iCAAiC,GAElC,MAAM,uBAAuB,CAAC;AAC/B,6EAA6E;AAC7E,4EAA4E;AAC5E,sEAAsE;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,8EAA8E;AAC9E,0EAA0E;AAC1E,OAAO,EAAE,mBAAmB,EAAsB,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAA+C,MAAM,oBAAoB,CAAC;AAChG,OAAO,EACL,gBAAgB,EAChB,iCAAiC,GAElC,MAAM,uBAAuB,CAAC;AAC/B,6EAA6E;AAC7E,4EAA4E;AAC5E,sEAAsE;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAgBnD,2EAA2E;AAC3E,0CAA0C;AAC1C,OAAO,EAAE,yBAAyB,EAAmC,MAAM,wBAAwB,CAAC"}
@@ -42,12 +42,15 @@
42
42
  * loads only when a consumer actually constructs a client. Tests
43
43
  * inject `_client` and skip the import path entirely.
44
44
  */
45
+ import { isDevMode } from 'footprintjs';
45
46
  import { callMetaOf, readToolExtras } from './toolExtras.js';
46
- import { readToolResult, resultModeOf } from './toolResult.js';
47
+ import { isToolError, readToolResult, resultModeOf } from './toolResult.js';
47
48
  import { createVendingFetch } from './gatewayTransport.js';
48
- import { ledgeredFetch, retryingFetch } from './throttleRetry.js';
49
+ import { ledgeredFetch, retryingFetch, seriesWithoutThrottle, } from './throttleRetry.js';
49
50
  import { RequestLedger } from './requestLedger.js';
50
51
  import { openCall } from './callLifetime.js';
52
+ import { McpReplayUnavailableError, unavailableBeforeSending } from './replayUnavailable.js';
53
+ import { needsSeries, replayDeclarationOf, } from './replay.js';
51
54
  import { refuseConflictingOptions } from './connectionRefusals.js';
52
55
  import { sdkLoadFailure } from './sdkLoadFailure.js';
53
56
  import { transportUrl } from './transportUrl.js';
@@ -87,7 +90,12 @@ export async function mcpClient(opts) {
87
90
  // Before anything connects: an option that names a behaviour which cannot
88
91
  // happen on the chosen arm is a defect, not a preference.
89
92
  refuseConflictingOptions(opts, name);
90
- const { connection, ledger } = await openConnection(opts);
93
+ // The app's replay declaration — who may send a tool call again — read and
94
+ // checked once, here, before anything connects (`replay.ts`).
95
+ const replay = replayDeclarationOf(opts.replay, `mcpClient[${name}]`);
96
+ const strict = replay.policy === 'app-authorized';
97
+ const { connection, ledger } = await openConnection(opts, replay, name);
98
+ const unlisted = new Set();
91
99
  // Tool cache so consumers calling `.tools()` more than once don't
92
100
  // hammer the server. `.refresh()` invalidates it.
93
101
  let cache = null;
@@ -103,7 +111,8 @@ export async function mcpClient(opts) {
103
111
  const listed = opts.signal
104
112
  ? await connection.listTools(undefined, { signal: opts.signal })
105
113
  : await connection.listTools();
106
- return listed.tools.map((t) => wrapMcpTool(name, connection, t, opts.signal, resultMode, ledger));
114
+ noteUnlisted(replay, listed.tools, name, unlisted);
115
+ return listed.tools.map((t) => wrapMcpTool(name, connection, t, opts.signal, resultMode, ledger, strict));
107
116
  };
108
117
  return {
109
118
  name,
@@ -123,7 +132,13 @@ export async function mcpClient(opts) {
123
132
  return;
124
133
  closed = true;
125
134
  cache = null;
126
- await connection.close();
135
+ try {
136
+ await connection.close();
137
+ }
138
+ finally {
139
+ // Nothing this connection sent is awaited any more, however it closed.
140
+ ledger?.close();
141
+ }
127
142
  },
128
143
  };
129
144
  }
@@ -136,7 +151,7 @@ export async function mcpClient(opts) {
136
151
  * A call with neither `connection` nor `sdk` reaches `resolveClient` with two
137
152
  * `undefined` arguments and takes the identical path it always took.
138
153
  */
139
- async function openConnection(opts) {
154
+ async function openConnection(opts, replay, name) {
140
155
  if (opts.connection !== undefined)
141
156
  return { connection: opts.connection };
142
157
  if (opts._client !== undefined)
@@ -144,17 +159,17 @@ async function openConnection(opts) {
144
159
  // `refuseConflictingOptions` has already refused the case where this is
145
160
  // absent, so the assertion documents that guarantee rather than assuming it.
146
161
  const transport = opts.transport;
147
- return resolveClient(transport, opts.clientInfo, opts.signal, opts.retryOnThrottle, opts.sdk);
162
+ return resolveClient(transport, opts.clientInfo, opts.signal, opts.retryOnThrottle, opts.sdk, replay, name);
148
163
  }
149
164
  // ─── SDK construction (lazy require, unless the caller supplied it) ─
150
- async function resolveClient(transport, clientInfo, signal, retryOnThrottle, sdk) {
165
+ async function resolveClient(transport, clientInfo, signal, retryOnThrottle, sdk, replay, name = 'mcp') {
151
166
  if (sdk !== undefined)
152
167
  assertSdk(sdk, transport.transport);
153
168
  const mod = sdk ?? loadClientModule();
154
169
  const client = new mod.Client(clientInfo ?? DEFAULT_CLIENT_INFO, {
155
170
  capabilities: {},
156
171
  });
157
- const built = await buildTransport(transport, retryOnThrottle, sdk);
172
+ const built = await buildTransport(transport, retryOnThrottle, sdk, replay, name);
158
173
  // Same rule as callTool: options ride beside the transport, never inside it.
159
174
  if (signal)
160
175
  await client.connect(built.transport, { signal });
@@ -204,7 +219,7 @@ function loadClientModule() {
204
219
  }));
205
220
  }
206
221
  }
207
- async function buildTransport(t, retryOnThrottle, sdk) {
222
+ async function buildTransport(t, retryOnThrottle, sdk, replay, name = 'mcp') {
208
223
  if (t.transport === 'stdio') {
209
224
  // Deliberately NOT served by `sdk`: stdio spawns a subprocess, so it can
210
225
  // never run in a browser, and `client/stdio.js` is the SDK's one client
@@ -249,9 +264,23 @@ async function buildTransport(t, retryOnThrottle, sdk) {
249
264
  //
250
265
  // The ledger joins the same series, so each request a dispatched tool call
251
266
  // sends files its attempts into that call's run; the transport's `send` is
252
- // watched to bind each request to its call (`requestLedger.ts`). A fetch that
253
- // runs no series (retry off) gets no ledger: there is nothing to file.
254
- const ledger = new RequestLedger();
267
+ // watched to bind each request to its call (`requestLedger.ts`). The app's
268
+ // replay declaration joins with it: the series asks it before sending a tool
269
+ // call again (`replay.ts`). `retryOnThrottle: false` turns off the 429 rule
270
+ // and nothing else: when the declaration still needs a series — a tool
271
+ // declared repeatable on 'network', or the 'app-authorized' policy — the
272
+ // series stays, with that rule switched off (`seriesWithoutThrottle`).
273
+ // Otherwise a fetch that runs no series gets neither ledger nor declaration:
274
+ // there is nothing to file and nothing is sent again.
275
+ const retried = (inner) => retryOnThrottle === false && replay !== undefined && needsSeries(replay)
276
+ ? seriesWithoutThrottle(inner)
277
+ : retryingFetch(inner, retryOnThrottle);
278
+ // Under 'app-authorized' the ledger refuses a request it cannot match to its
279
+ // call, and awaits each matched request's answer (`requestLedger.ts`).
280
+ const ledger = new RequestLedger({
281
+ server: name,
282
+ strict: replay?.policy === 'app-authorized',
283
+ });
255
284
  if (t.transport === 'gateway') {
256
285
  // The consumer's own `fetch` (9.32.0) goes UNDERNEATH the vending, not
257
286
  // beside it: `createVendingFetch` resolves the credential, applies it to
@@ -260,8 +289,8 @@ async function buildTransport(t, retryOnThrottle, sdk) {
260
289
  // credential is still vended per request. Passing `undefined` is the
261
290
  // default global `fetch`, which is byte-identical to every release before
262
291
  // the seam existed.
263
- const gatewayFetch = retryingFetch(createVendingFetch(t, t.fetch), retryOnThrottle);
264
- const ledgered = gatewayFetch && ledgeredFetch(gatewayFetch, ledger);
292
+ const gatewayFetch = retried(createVendingFetch(t, t.fetch));
293
+ const ledgered = gatewayFetch && ledgeredFetch(gatewayFetch, ledger, replay);
265
294
  return watched(new httpMod.StreamableHTTPClientTransport(transportUrl(t.url, 'mcpClient'), {
266
295
  fetch: ledgered ?? gatewayFetch,
267
296
  }), ledgered && ledger);
@@ -270,8 +299,8 @@ async function buildTransport(t, retryOnThrottle, sdk) {
270
299
  // are given. The SDK folds `requestInit.headers` into the `init.headers` it
271
300
  // hands the custom fetch, so a signer sees the static headers and has the
272
301
  // final word over the bytes — see `McpHttpTransport.fetch`.
273
- const httpFetch = retryingFetch(t.fetch, retryOnThrottle);
274
- const ledgered = httpFetch && ledgeredFetch(httpFetch, ledger);
302
+ const httpFetch = retried(t.fetch);
303
+ const ledgered = httpFetch && ledgeredFetch(httpFetch, ledger, replay);
275
304
  const fetch = ledgered ?? httpFetch;
276
305
  return watched(new httpMod.StreamableHTTPClientTransport(transportUrl(t.url, 'mcpClient'), {
277
306
  ...(t.headers && { requestInit: { headers: { ...t.headers } } }),
@@ -306,8 +335,26 @@ function loadHttpModule(transport) {
306
335
  }));
307
336
  }
308
337
  }
338
+ /**
339
+ * Dev mode, once per client and name: a replay entry for a tool the server does
340
+ * not list applies to nothing — a misspelled name would leave a tool that makes
341
+ * changes outside the side-effect guard, so it is named.
342
+ */
343
+ function noteUnlisted(replay, listed, server, noted) {
344
+ if (replay.tools.size === 0 || !isDevMode())
345
+ return;
346
+ const names = new Set(listed.map((tool) => tool.name));
347
+ for (const tool of replay.tools.keys()) {
348
+ if (names.has(tool) || noted.has(tool))
349
+ continue;
350
+ noted.add(tool);
351
+ // eslint-disable-next-line no-console
352
+ console.warn(`[agentfootprint] mcpClient[${server}]: \`replay.tools\` names ${JSON.stringify(tool)}, ` +
353
+ "which the server does not list, so the entry applies to nothing. Check the name against the server's tool list.");
354
+ }
355
+ }
309
356
  // ─── Tool wrapping ─────────────────────────────────────────────────
310
- function wrapMcpTool(serverName, connection, mcp, signal, resultMode, ledger) {
357
+ function wrapMcpTool(serverName, connection, mcp, signal, resultMode, ledger, strict = false) {
311
358
  const tool = {
312
359
  schema: {
313
360
  name: mcp.name,
@@ -349,20 +396,40 @@ function wrapMcpTool(serverName, connection, mcp, signal, resultMode, ledger) {
349
396
  ...(ctx?.time !== undefined && { _meta: callMetaOf(ctx.time) }),
350
397
  };
351
398
  // The call's lifetime (`callLifetime.ts`): its context's signal and the
352
- // client's cancel the SDK request while it runs; a call the agent
353
- // dispatched issues a ticket keyed by THIS params object — the one the
354
- // SDK hands the transport — so the retry series that sends it files its
355
- // attempts into the call's run; and however the call settles, a series
356
- // still sending is cut, inside the call. Nothing is added to the request.
399
+ // client's cancel the SDK request while it runs; the call puts a private
400
+ // marker in its params' `_meta` (`call.params`), which ties the request
401
+ // the SDK sends to this call — through any copy the SDK makes — so the
402
+ // retry series that sends it files its attempts into the call's run; and
403
+ // however the call settles, a series still sending is cut, inside the
404
+ // call. The transport takes the marker out: the server receives the
405
+ // request it always did.
406
+ //
407
+ // How it settles is its verdict: `completed` when the server answered and
408
+ // not with an error (a result it then cannot decode still completed).
409
+ // Under 'app-authorized', a call that genuinely lacked an answer somewhere
410
+ // and does not complete fails as "may have run"; a received refusal or
411
+ // error is delivered as it came (`callLifetime.ts`). That contract needs
412
+ // each request matched to its call and each answer seen: a connection
413
+ // that cannot establish both refuses the call here, before anything is
414
+ // sent (`replayUnavailable.ts`).
415
+ const unavailable = strict ? unavailableBeforeSending(ledger) : undefined;
416
+ if (unavailable !== undefined) {
417
+ throw new McpReplayUnavailableError(unavailable, serverName, mcp.name);
418
+ }
357
419
  const call = openCall(params, ctx, signal, ledger, serverName);
420
+ let verdict = 'failed';
358
421
  try {
359
422
  const result = call.signal
360
- ? await connection.callTool(params, undefined, { signal: call.signal })
361
- : await connection.callTool(params);
423
+ ? await connection.callTool(call.params, undefined, { signal: call.signal })
424
+ : await connection.callTool(call.params);
425
+ verdict = isToolError(result) ? 'tool-error' : 'completed';
362
426
  return readToolResult(result, mcp.name, serverName, resultMode);
363
427
  }
428
+ catch (error) {
429
+ throw call.failed(error, verdict);
430
+ }
364
431
  finally {
365
- call.close();
432
+ call.close(verdict);
366
433
  }
367
434
  },
368
435
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mcpClient.js","sourceRoot":"","sources":["../../../src/mcp/mcpClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAaH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAwB,MAAM,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