@stigmer/runner 3.40.1 → 3.41.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 (248) hide show
  1. package/README.md +3 -1
  2. package/dist/.build-fingerprint +1 -1
  3. package/dist/__test-utils__/execution-record-fixture.d.ts +2 -1
  4. package/dist/__test-utils__/execution-record-fixture.js.map +1 -1
  5. package/dist/activities/call-agent.js +1 -1
  6. package/dist/activities/discover-mcp-server.d.ts +7 -1
  7. package/dist/activities/discover-mcp-server.js +13 -29
  8. package/dist/activities/discover-mcp-server.js.map +1 -1
  9. package/dist/activities/execute-cursor/__test-utils__/fold.d.ts +4 -2
  10. package/dist/activities/execute-cursor/__test-utils__/fold.js +3 -4
  11. package/dist/activities/execute-cursor/__test-utils__/fold.js.map +1 -1
  12. package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js +1 -0
  13. package/dist/activities/execute-cursor/__test-utils__/hermetic-cursor.js.map +1 -1
  14. package/dist/activities/execute-cursor/approval-policy.d.ts +1 -29
  15. package/dist/activities/execute-cursor/approval-policy.js +11 -35
  16. package/dist/activities/execute-cursor/approval-policy.js.map +1 -1
  17. package/dist/activities/execute-cursor/boundary-rows.js +4 -4
  18. package/dist/activities/execute-cursor/boundary-rows.js.map +1 -1
  19. package/dist/activities/execute-cursor/translator.d.ts +12 -17
  20. package/dist/activities/execute-cursor/translator.js +13 -30
  21. package/dist/activities/execute-cursor/translator.js.map +1 -1
  22. package/dist/activities/execute-cursor/turn-stream.js +4 -2
  23. package/dist/activities/execute-cursor/turn-stream.js.map +1 -1
  24. package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.d.ts +11 -1
  25. package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js +22 -3
  26. package/dist/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.js.map +1 -1
  27. package/dist/activities/execute-deep-agent/inline-publisher.d.ts +33 -2
  28. package/dist/activities/execute-deep-agent/inline-publisher.js +33 -7
  29. package/dist/activities/execute-deep-agent/inline-publisher.js.map +1 -1
  30. package/dist/activities/execute-deep-agent/platform-route.d.ts +48 -13
  31. package/dist/activities/execute-deep-agent/platform-route.js +87 -19
  32. package/dist/activities/execute-deep-agent/platform-route.js.map +1 -1
  33. package/dist/activities/execute-deep-agent/streaming-side-effects.d.ts +20 -3
  34. package/dist/activities/execute-deep-agent/streaming-side-effects.js +26 -4
  35. package/dist/activities/execute-deep-agent/streaming-side-effects.js.map +1 -1
  36. package/dist/activities/execute-deep-agent/translator.d.ts +5 -4
  37. package/dist/activities/execute-deep-agent/translator.js +5 -4
  38. package/dist/activities/execute-deep-agent/translator.js.map +1 -1
  39. package/dist/activities/execute-deep-agent/turn-settle.js +6 -6
  40. package/dist/activities/execute-deep-agent/turn-settle.js.map +1 -1
  41. package/dist/activities/execute-deep-agent/turn-setup.js +7 -7
  42. package/dist/activities/execute-deep-agent/turn-setup.js.map +1 -1
  43. package/dist/activities/execute-deep-agent/turn-stream.d.ts +10 -6
  44. package/dist/activities/execute-deep-agent/turn-stream.js +6 -16
  45. package/dist/activities/execute-deep-agent/turn-stream.js.map +1 -1
  46. package/dist/activities/execute-deep-agent/turn.d.ts +4 -1
  47. package/dist/activities/execute-deep-agent/turn.js +15 -6
  48. package/dist/activities/execute-deep-agent/turn.js.map +1 -1
  49. package/dist/activities/workflow-event-activities.js +2 -0
  50. package/dist/activities/workflow-event-activities.js.map +1 -1
  51. package/dist/config.d.ts +9 -0
  52. package/dist/config.js +2 -0
  53. package/dist/config.js.map +1 -1
  54. package/dist/exit-backstop.d.ts +64 -0
  55. package/dist/exit-backstop.js +79 -0
  56. package/dist/exit-backstop.js.map +1 -0
  57. package/dist/harness/terminal-table.d.ts +12 -5
  58. package/dist/harness/terminal-table.js +13 -13
  59. package/dist/harness/terminal-table.js.map +1 -1
  60. package/dist/harness/transcript/builder.d.ts +21 -0
  61. package/dist/harness/transcript/builder.js +53 -31
  62. package/dist/harness/transcript/builder.js.map +1 -1
  63. package/dist/harness/transcript/events.d.ts +22 -26
  64. package/dist/harness/transcript/events.js +6 -5
  65. package/dist/harness/transcript/events.js.map +1 -1
  66. package/dist/harness/turn-context.d.ts +3 -1
  67. package/dist/harness/turn-context.js +5 -3
  68. package/dist/harness/turn-context.js.map +1 -1
  69. package/dist/main.js +10 -4
  70. package/dist/main.js.map +1 -1
  71. package/dist/middleware/cost-advisory.d.ts +6 -3
  72. package/dist/middleware/cost-advisory.js +6 -3
  73. package/dist/middleware/cost-advisory.js.map +1 -1
  74. package/dist/middleware/execution-budget.d.ts +22 -7
  75. package/dist/middleware/execution-budget.js +57 -35
  76. package/dist/middleware/execution-budget.js.map +1 -1
  77. package/dist/middleware/index.d.ts +10 -7
  78. package/dist/middleware/index.js +10 -7
  79. package/dist/middleware/index.js.map +1 -1
  80. package/dist/middleware/types.d.ts +6 -1
  81. package/dist/runner-manager.js +3 -2
  82. package/dist/runner-manager.js.map +1 -1
  83. package/dist/runner.d.ts +25 -0
  84. package/dist/runner.js +41 -14
  85. package/dist/runner.js.map +1 -1
  86. package/dist/shared/approval-policy.d.ts +23 -13
  87. package/dist/shared/approval-policy.js +47 -14
  88. package/dist/shared/approval-policy.js.map +1 -1
  89. package/dist/shared/caller-identity.d.ts +4 -5
  90. package/dist/shared/caller-identity.js +4 -5
  91. package/dist/shared/caller-identity.js.map +1 -1
  92. package/dist/shared/channel-attachment.js +3 -2
  93. package/dist/shared/channel-attachment.js.map +1 -1
  94. package/dist/shared/connect-backfill.d.ts +2 -1
  95. package/dist/shared/connect-backfill.js +2 -2
  96. package/dist/shared/connect-backfill.js.map +1 -1
  97. package/dist/shared/mcp-resolver.d.ts +10 -1
  98. package/dist/shared/mcp-resolver.js +11 -2
  99. package/dist/shared/mcp-resolver.js.map +1 -1
  100. package/dist/shared/memory-attachment.js +3 -2
  101. package/dist/shared/memory-attachment.js.map +1 -1
  102. package/dist/shared/model-error.d.ts +25 -3
  103. package/dist/shared/model-error.js +78 -10
  104. package/dist/shared/model-error.js.map +1 -1
  105. package/dist/shared/platform-server-address.d.ts +71 -0
  106. package/dist/shared/platform-server-address.js +103 -0
  107. package/dist/shared/platform-server-address.js.map +1 -0
  108. package/dist/shared/synthesized-attachment.d.ts +0 -5
  109. package/dist/shared/synthesized-attachment.js +0 -12
  110. package/dist/shared/synthesized-attachment.js.map +1 -1
  111. package/dist/shared/tool-rounds.d.ts +51 -23
  112. package/dist/shared/tool-rounds.js +67 -24
  113. package/dist/shared/tool-rounds.js.map +1 -1
  114. package/dist/shared/workspace/platform-dir.d.ts +15 -0
  115. package/dist/shared/workspace/platform-dir.js +18 -1
  116. package/dist/shared/workspace/platform-dir.js.map +1 -1
  117. package/dist/shared/workspace/stigmer-link.d.ts +21 -14
  118. package/dist/shared/workspace/stigmer-link.js +91 -29
  119. package/dist/shared/workspace/stigmer-link.js.map +1 -1
  120. package/dist/tools/url-guard.d.ts +5 -1
  121. package/dist/tools/url-guard.js +9 -2
  122. package/dist/tools/url-guard.js.map +1 -1
  123. package/dist/worker.d.ts +11 -2
  124. package/dist/worker.js +1 -1
  125. package/dist/worker.js.map +1 -1
  126. package/dist/workflow-engine/tasks/human-input.d.ts +16 -0
  127. package/dist/workflow-engine/tasks/human-input.js +79 -37
  128. package/dist/workflow-engine/tasks/human-input.js.map +1 -1
  129. package/dist/workflow-engine/types.d.ts +14 -4
  130. package/dist/workflow-engine/types.js.map +1 -1
  131. package/dist/workflows/call-agent-orchestrator.d.ts +13 -0
  132. package/dist/workflows/call-agent-orchestrator.js.map +1 -1
  133. package/dist/workflows/engine-core.d.ts +25 -0
  134. package/dist/workflows/engine-core.js.map +1 -1
  135. package/dist/workflows/execute-from-execution.d.ts +3 -0
  136. package/dist/workflows/execute-from-execution.js.map +1 -1
  137. package/dist/workflows/human-input-orchestrator.d.ts +9 -12
  138. package/dist/workflows/human-input-orchestrator.js +12 -44
  139. package/dist/workflows/human-input-orchestrator.js.map +1 -1
  140. package/package.json +5 -5
  141. package/src/__test-utils__/config-fixture.ts +1 -0
  142. package/src/__test-utils__/execution-record-fixture.ts +2 -1
  143. package/src/__test-utils__/harness-contract/runtime-contract.ts +5 -3
  144. package/src/__test-utils__/test-gate.ts +8 -0
  145. package/src/__tests__/exit-backstop.test.ts +91 -0
  146. package/src/__tests__/golden-e2e.test.ts +80 -62
  147. package/src/__tests__/history-encryption-e2e.test.ts +51 -27
  148. package/src/__tests__/runner.test.ts +60 -2
  149. package/src/activities/__tests__/classify-tool-approvals.test.ts +1 -0
  150. package/src/activities/__tests__/discover-mcp-server.hang.test.ts +5 -1
  151. package/src/activities/__tests__/discover-mcp-server.test.ts +90 -49
  152. package/src/activities/__tests__/workflow-event-activities.test.ts +28 -7
  153. package/src/activities/call-agent.ts +1 -1
  154. package/src/activities/discover-mcp-server.ts +27 -37
  155. package/src/activities/execute-cursor/__test-utils__/fold.ts +6 -4
  156. package/src/activities/execute-cursor/__test-utils__/hermetic-cursor.ts +1 -0
  157. package/src/activities/execute-cursor/__tests__/approval-gate.test.ts +4 -29
  158. package/src/activities/execute-cursor/__tests__/hermetic/bypassed-tool-call.test.ts +120 -0
  159. package/src/activities/execute-cursor/__tests__/hermetic/file-review-capture.test.ts +5 -5
  160. package/src/activities/execute-cursor/__tests__/hermetic/goldens/file-review-capture.status.json +0 -2
  161. package/src/activities/execute-cursor/__tests__/hermetic/goldens/resolution-error.status.json +1 -1
  162. package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.error-delta.status.json +0 -3
  163. package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.output-first.status.json +0 -2
  164. package/src/activities/execute-cursor/__tests__/hermetic/goldens/shell-output-delta.status.json +0 -2
  165. package/src/activities/execute-cursor/__tests__/hermetic/goldens/stall.status.json +0 -2
  166. package/src/activities/execute-cursor/__tests__/hermetic/goldens/unattributed-hook-block.status.json +0 -3
  167. package/src/activities/execute-cursor/__tests__/hermetic/shell-output-delta.test.ts +9 -7
  168. package/src/activities/execute-cursor/__tests__/hermetic/thrown-error-arms.test.ts +6 -1
  169. package/src/activities/execute-cursor/__tests__/hitl-resume-history.test.ts +8 -11
  170. package/src/activities/execute-cursor/__tests__/sequential-gate-resume.test.ts +1 -3
  171. package/src/activities/execute-cursor/__tests__/translator.test.ts +68 -15
  172. package/src/activities/execute-cursor/approval-policy.ts +11 -36
  173. package/src/activities/execute-cursor/boundary-rows.ts +3 -3
  174. package/src/activities/execute-cursor/translator.ts +15 -32
  175. package/src/activities/execute-cursor/turn-stream.ts +4 -1
  176. package/src/activities/execute-deep-agent/__test-utils__/hermetic-deep-agent.ts +33 -2
  177. package/src/activities/execute-deep-agent/__tests__/adapter.test.ts +1 -0
  178. package/src/activities/execute-deep-agent/__tests__/hermetic/file-review-capture.test.ts +4 -0
  179. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/file-review-capture.status.json +1 -1
  180. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn1.status.json +1 -1
  181. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/inline-artifact.turn2.status.json +1 -1
  182. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/recursion-limit.persisted.status.json +8 -73
  183. package/src/activities/execute-deep-agent/__tests__/hermetic/goldens/resolution-error.status.json +1 -1
  184. package/src/activities/execute-deep-agent/__tests__/hermetic/inline-artifact-across-gate.test.ts +17 -0
  185. package/src/activities/execute-deep-agent/__tests__/hermetic/recursion-limit.test.ts +86 -26
  186. package/src/activities/execute-deep-agent/__tests__/hermetic/resolution-error.test.ts +9 -5
  187. package/src/activities/execute-deep-agent/__tests__/hermetic/thrown-turn-drains-publishes.test.ts +159 -0
  188. package/src/activities/execute-deep-agent/__tests__/inline-publisher.test.ts +84 -0
  189. package/src/activities/execute-deep-agent/__tests__/platform-route.test.ts +47 -10
  190. package/src/activities/execute-deep-agent/__tests__/streaming-side-effects.test.ts +34 -0
  191. package/src/activities/execute-deep-agent/__tests__/turn-stream.test.ts +13 -5
  192. package/src/activities/execute-deep-agent/inline-publisher.ts +47 -7
  193. package/src/activities/execute-deep-agent/platform-route.ts +109 -20
  194. package/src/activities/execute-deep-agent/streaming-side-effects.ts +27 -4
  195. package/src/activities/execute-deep-agent/translator.ts +5 -4
  196. package/src/activities/execute-deep-agent/turn-settle.ts +6 -6
  197. package/src/activities/execute-deep-agent/turn-setup.ts +7 -7
  198. package/src/activities/execute-deep-agent/turn-stream.ts +15 -22
  199. package/src/activities/execute-deep-agent/turn.ts +16 -7
  200. package/src/activities/workflow-event-activities.ts +2 -0
  201. package/src/config.ts +11 -0
  202. package/src/exit-backstop.ts +97 -0
  203. package/src/harness/README.md +5 -5
  204. package/src/harness/terminal-table.ts +13 -13
  205. package/src/harness/transcript/__tests__/builder.test.ts +93 -21
  206. package/src/harness/transcript/builder.ts +53 -30
  207. package/src/harness/transcript/events.ts +22 -27
  208. package/src/harness/turn-context.ts +5 -3
  209. package/src/main.ts +9 -5
  210. package/src/middleware/__tests__/execution-budget.test.ts +181 -103
  211. package/src/middleware/cost-advisory.ts +6 -3
  212. package/src/middleware/execution-budget.ts +60 -34
  213. package/src/middleware/index.ts +10 -7
  214. package/src/middleware/types.ts +6 -1
  215. package/src/runner-manager.ts +3 -2
  216. package/src/runner.ts +57 -15
  217. package/src/shared/__tests__/approval-policy.test.ts +41 -0
  218. package/src/shared/__tests__/artifact-storage.test.ts +1 -0
  219. package/src/shared/__tests__/connect-backfill.test.ts +15 -11
  220. package/src/shared/__tests__/mcp-resolver.test.ts +72 -10
  221. package/src/shared/__tests__/model-error.test.ts +71 -3
  222. package/src/shared/__tests__/platform-server-address.test.ts +122 -0
  223. package/src/shared/__tests__/tool-rounds.test.ts +64 -14
  224. package/src/shared/approval-policy.ts +57 -14
  225. package/src/shared/caller-identity.ts +4 -5
  226. package/src/shared/channel-attachment.ts +2 -2
  227. package/src/shared/connect-backfill.ts +5 -1
  228. package/src/shared/mcp-resolver.ts +11 -1
  229. package/src/shared/memory-attachment.ts +2 -2
  230. package/src/shared/model-error.ts +87 -9
  231. package/src/shared/platform-server-address.ts +123 -0
  232. package/src/shared/synthesized-attachment.ts +0 -12
  233. package/src/shared/tool-rounds.ts +70 -24
  234. package/src/shared/workspace/__tests__/stigmer-link.test.ts +107 -10
  235. package/src/shared/workspace/platform-dir.ts +19 -1
  236. package/src/shared/workspace/stigmer-link.ts +99 -29
  237. package/src/tools/__tests__/url-guard.test.ts +19 -1
  238. package/src/tools/url-guard.ts +9 -1
  239. package/src/worker.ts +12 -2
  240. package/src/workflow-engine/__tests__/golden-execution.test.ts +2 -1
  241. package/src/workflow-engine/__tests__/loader.test.ts +1 -1
  242. package/src/workflow-engine/__tests__/tasks/human-input.test.ts +133 -57
  243. package/src/workflow-engine/tasks/human-input.ts +92 -42
  244. package/src/workflow-engine/types.ts +16 -4
  245. package/src/workflows/call-agent-orchestrator.ts +7 -0
  246. package/src/workflows/engine-core.ts +18 -0
  247. package/src/workflows/execute-from-execution.ts +2 -1
  248. package/src/workflows/human-input-orchestrator.ts +15 -56
@@ -19,6 +19,14 @@
19
19
  * (BYO-key) mode, attributes billing errors to the user's own account
20
20
  * with actionable wording.
21
21
  *
22
+ * 3. On Stigmer Cloud an organization may bring its own provider key, which
23
+ * the proxy injects upstream in place of the platform's. A failure on
24
+ * that key is the organization's, not the platform's, yet it reaches the
25
+ * runner in proxy mode. The proxy keeps the provider's status and message
26
+ * and marks the message with ORGANIZATION_PROVIDER_KEY_SENTINEL; this
27
+ * module words a marked failure as the organization's key, never as a
28
+ * platform fault.
29
+ *
22
30
  * Classification order is load-bearing: the sentinel check must precede
23
31
  * status mapping, otherwise the proxy's 503 would classify as a retryable
24
32
  * 5xx and waste Temporal retries against a dead platform account.
@@ -32,6 +40,13 @@ import type { LlmProvider } from "./llm-proxy.js";
32
40
  * change both or neither.
33
41
  */
34
42
  export declare const PLATFORM_CAPACITY_SENTINEL = "STIGMER_PLATFORM_MODEL_CAPACITY";
43
+ /**
44
+ * Machine-readable code the cloud proxy embeds in a provider failure it
45
+ * relays from a call served on the organization's own provider key. The
46
+ * message text carries it, as it carries PLATFORM_CAPACITY_SENTINEL.
47
+ * Duplicated in stigmer-cloud's LLM proxy lane; change both or neither.
48
+ */
49
+ export declare const ORGANIZATION_PROVIDER_KEY_SENTINEL = "STIGMER_ORGANIZATION_PROVIDER_KEY";
35
50
  export interface ClassifiedModelError {
36
51
  /** Stable machine-readable code (doubles as the Temporal failure type). */
37
52
  readonly code: string;
@@ -59,8 +74,15 @@ export interface ModelErrorContext {
59
74
  }
60
75
  /**
61
76
  * Walk the `cause` chain to the root error. LangChain's MiddlewareError (and
62
- * anything else that chains causes) preserves the original SDK error there.
63
- * Depth-capped so a pathological cause cycle cannot spin forever.
77
+ * anything else that chains causes) preserves the original SDK error there,
78
+ * and the root is the one link carrying the provider's `.status`.
79
+ *
80
+ * The chain is as long as the agent's middleware stack: LangChain wraps a
81
+ * model call's failure once per middleware that implements `wrapModelCall`
82
+ * (`MiddlewareError.wrap` in its AgentNode), and a native turn stacks
83
+ * deepagents' own middleware, the to-do list and Stigmer's, well past ten
84
+ * layers. So the walk has no depth bound; a cause cycle ends it instead, at
85
+ * the first error seen twice.
64
86
  */
65
87
  export declare function unwrapModelError(err: unknown): unknown;
66
88
  /**
@@ -73,7 +95,7 @@ export declare function unwrapModelError(err: unknown): unknown;
73
95
  * operations too): only positively-identified model errors get relabeled;
74
96
  * everything else keeps its own identity.
75
97
  */
76
- export declare function classifyModelCallError(err: unknown, ctx: ModelErrorContext): ClassifiedModelError | undefined;
98
+ export declare function classifyModelCallError(err: unknown, callerCtx: ModelErrorContext): ClassifiedModelError | undefined;
77
99
  /**
78
100
  * Describe an arbitrary activity failure for the execution's user-visible
79
101
  * error field: model-call errors get classified codes and messages; anything
@@ -19,6 +19,14 @@
19
19
  * (BYO-key) mode, attributes billing errors to the user's own account
20
20
  * with actionable wording.
21
21
  *
22
+ * 3. On Stigmer Cloud an organization may bring its own provider key, which
23
+ * the proxy injects upstream in place of the platform's. A failure on
24
+ * that key is the organization's, not the platform's, yet it reaches the
25
+ * runner in proxy mode. The proxy keeps the provider's status and message
26
+ * and marks the message with ORGANIZATION_PROVIDER_KEY_SENTINEL; this
27
+ * module words a marked failure as the organization's key, never as a
28
+ * platform fault.
29
+ *
22
30
  * Classification order is load-bearing: the sentinel check must precede
23
31
  * status mapping, otherwise the proxy's 503 would classify as a retryable
24
32
  * 5xx and waste Temporal retries against a dead platform account.
@@ -32,20 +40,31 @@ import { parseAnthropicBackend, BACKEND_DOC_URL, BEDROCK_INFERENCE_PREFIX_ENV, F
32
40
  * change both or neither.
33
41
  */
34
42
  export const PLATFORM_CAPACITY_SENTINEL = "STIGMER_PLATFORM_MODEL_CAPACITY";
43
+ /**
44
+ * Machine-readable code the cloud proxy embeds in a provider failure it
45
+ * relays from a call served on the organization's own provider key. The
46
+ * message text carries it, as it carries PLATFORM_CAPACITY_SENTINEL.
47
+ * Duplicated in stigmer-cloud's LLM proxy lane; change both or neither.
48
+ */
49
+ export const ORGANIZATION_PROVIDER_KEY_SENTINEL = "STIGMER_ORGANIZATION_PROVIDER_KEY";
35
50
  /**
36
51
  * Walk the `cause` chain to the root error. LangChain's MiddlewareError (and
37
- * anything else that chains causes) preserves the original SDK error there.
38
- * Depth-capped so a pathological cause cycle cannot spin forever.
52
+ * anything else that chains causes) preserves the original SDK error there,
53
+ * and the root is the one link carrying the provider's `.status`.
54
+ *
55
+ * The chain is as long as the agent's middleware stack: LangChain wraps a
56
+ * model call's failure once per middleware that implements `wrapModelCall`
57
+ * (`MiddlewareError.wrap` in its AgentNode), and a native turn stacks
58
+ * deepagents' own middleware, the to-do list and Stigmer's, well past ten
59
+ * layers. So the walk has no depth bound; a cause cycle ends it instead, at
60
+ * the first error seen twice.
39
61
  */
40
62
  export function unwrapModelError(err) {
63
+ const seen = new Set([err]);
41
64
  let current = err;
42
- for (let depth = 0; depth < 10; depth++) {
43
- if (current instanceof Error && current.cause instanceof Error) {
44
- current = current.cause;
45
- }
46
- else {
47
- return current;
48
- }
65
+ while (current instanceof Error && current.cause instanceof Error && !seen.has(current.cause)) {
66
+ current = current.cause;
67
+ seen.add(current);
49
68
  }
50
69
  return current;
51
70
  }
@@ -59,9 +78,20 @@ export function unwrapModelError(err) {
59
78
  * operations too): only positively-identified model errors get relabeled;
60
79
  * everything else keeps its own identity.
61
80
  */
62
- export function classifyModelCallError(err, ctx) {
81
+ export function classifyModelCallError(err, callerCtx) {
63
82
  const root = unwrapModelError(err);
64
83
  const message = root instanceof Error ? root.message : String(root);
84
+ // 0. Organization-key sentinel — before everything that reads proxyMode:
85
+ // the call went through the proxy but on the organization's own key,
86
+ // so its failures are the organization's. The key-specific failures
87
+ // get key-specific wording; the rest classify as direct mode would.
88
+ const organizationKey = message.includes(ORGANIZATION_PROVIDER_KEY_SENTINEL);
89
+ if (organizationKey) {
90
+ const classified = classifyOrganizationKeyError(root, message, callerCtx);
91
+ if (classified !== undefined)
92
+ return classified;
93
+ }
94
+ const ctx = organizationKey ? { ...callerCtx, proxyMode: false } : callerCtx;
65
95
  const backend = resolveDirectBackend(ctx);
66
96
  // 1. Platform sentinel — before status mapping (see module doc).
67
97
  if (message.includes(PLATFORM_CAPACITY_SENTINEL)) {
@@ -181,6 +211,44 @@ export function classifyModelCallError(err, ctx) {
181
211
  }
182
212
  return undefined;
183
213
  }
214
+ /**
215
+ * The failures an organization's own provider key causes, worded for the
216
+ * organization's admin: out of credit or quota at the provider, the key
217
+ * rejected, or the key's account not permitted the model. Undefined for
218
+ * every other failure, which classifies as direct mode would.
219
+ */
220
+ function classifyOrganizationKeyError(root, message, ctx) {
221
+ const provider = providerSubject(ctx);
222
+ if (isProviderBillingMessage(message)) {
223
+ return {
224
+ code: "LLM_PROVIDER_BILLING",
225
+ retryable: false,
226
+ message: `Your organization's own ${providerLabel(ctx)} key is out of credits or over quota. ` +
227
+ `Add credits to that provider account, or update the key in Settings → Provider keys. ` +
228
+ `Provider message: ${message}`,
229
+ };
230
+ }
231
+ const status = typeof root.status === "number"
232
+ ? root.status
233
+ : undefined;
234
+ if (status === 401) {
235
+ return {
236
+ code: "LLM_AUTHENTICATION_ERROR",
237
+ retryable: false,
238
+ message: `${provider} rejected your organization's own key (authentication, HTTP 401) for ${modelLabel(ctx)}. ` +
239
+ `Update the key in Settings → Provider keys.`,
240
+ };
241
+ }
242
+ if (status === 403) {
243
+ return {
244
+ code: "LLM_PERMISSION_DENIED",
245
+ retryable: false,
246
+ message: `${provider} denied your organization's own key (authorization, HTTP 403) for ${modelLabel(ctx)}. ` +
247
+ `Check that the key's account may use this model, or update the key in Settings → Provider keys.`,
248
+ };
249
+ }
250
+ return undefined;
251
+ }
184
252
  /**
185
253
  * Retryability policy (unchanged from the original call-llm classifier):
186
254
  * - 4xx (except 429): nonRetryable — client/config errors won't self-heal
@@ -1 +1 @@
1
- {"version":3,"file":"model-error.js","sourceRoot":"","sources":["../../src/shared/model-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,4BAA4B,EAC5B,0BAA0B,EAC1B,oBAAoB,GAErB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AA6B5E;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,IAAI,OAAO,GAAG,GAAG,CAAC;IAClB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC;QACxC,IAAI,OAAO,YAAY,KAAK,IAAI,OAAO,CAAC,KAAK,YAAY,KAAK,EAAE,CAAC;YAC/D,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,sBA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CAAC,GAAG,CAAC,+BAA+B;QAC9F,8FAA8F;QAC9F,mEAAmE,0BAA0B,GAAG,CACjG,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,GAAsB;IAC3C,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW;QAAE,OAAO,WAAW,CAAC;IACrD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC/C,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,iEAAiE;AACjE,SAAS,eAAe,CAAC,GAAsB;IAC7C,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAClE,CAAC;AAED,SAAS,UAAU,CAAC,GAAsB;IACxC,IAAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,QAAQ;QAAE,OAAO,UAAU,GAAG,CAAC,OAAO,MAAM,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;IACzF,IAAI,GAAG,CAAC,OAAO;QAAE,OAAO,UAAU,GAAG,CAAC,OAAO,GAAG,CAAC;IACjD,IAAI,GAAG,CAAC,QAAQ;QAAE,OAAO,cAAc,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC;IAC7D,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The Stigmer server's address for user-defined MCP servers — the reserved
3
+ * STIGMER_SERVER_ADDRESS key, and the one dial-target rule every writer of
4
+ * that key shares (stigmer/stigmer#1433, #1446).
5
+ *
6
+ * The runner is the one component that supplies it, because the runner is
7
+ * the one that knows where the consumer runs:
8
+ *
9
+ * - A remote HTTP server receives the key only through a templated header,
10
+ * so it needs the server's PUBLIC address: STIGMER_MCP_PUBLIC_ENDPOINT,
11
+ * which the server hands every sandbox it provisions from its own
12
+ * configuration (stigmer/stigmer#1447), or an operator names to a
13
+ * runner it starts by hand.
14
+ * - A stdio server is a child of this runner (only a local runner spawns
15
+ * one; mcp-transport-guard.ts), so the address the runner itself dials,
16
+ * STIGMER_BACKEND_ENDPOINT, is right for it by construction.
17
+ *
18
+ * No page supplies it: a value written into a run's runtime_env sits in the
19
+ * top merge layer, above every value the user saved (stigmer/stigmer#1446).
20
+ *
21
+ * The runner FILLS, it never overrides: a non-empty value already in the
22
+ * environment (one the user saved or typed to aim a server elsewhere)
23
+ * stands. A key nobody can supply stays missing, and a
24
+ * header that templates it fails with the resolver's named
25
+ * PlaceholderResolutionError instead of dialing a guess.
26
+ *
27
+ * Injection is opt-in exactly as for the caller-identity keys
28
+ * (caller-identity.ts): only a server whose spec.env declares the key
29
+ * receives it. Applied before filterEnvToDeclaredKeys at execution
30
+ * (mcp-resolver.ts) and before placeholder resolution at discovery
31
+ * (activities/discover-mcp-server.ts), so both phases share one rule.
32
+ */
33
+ import type { McpServer } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
34
+ import type { Config } from "../config.js";
35
+ /**
36
+ * Reserved env key: the Stigmer server's gRPC dial target, host:port. The
37
+ * name the mcp-server reads its target from (mcp-server/src/config.ts) and
38
+ * `@stigmer/react` keeps out of its setup prompts
39
+ * (sdk/react/src/environment/systemEnvVars.ts); a cross-package string,
40
+ * pinned on every side.
41
+ */
42
+ export declare const SERVER_ADDRESS_ENV_KEY = "STIGMER_SERVER_ADDRESS";
43
+ /** The two runner-known endpoints an address can be filled from. */
44
+ export type PlatformEndpoints = Pick<Config, "mcpPublicEndpoint" | "stigmerBackendEndpoint">;
45
+ /**
46
+ * The gRPC dial target (host:port) for an endpoint, the shape
47
+ * STIGMER_SERVER_ADDRESS wants.
48
+ *
49
+ * An http(s) URL becomes its host with an explicit port: the URL's own, else
50
+ * 80 for http and 443 for https. The port is never left implicit, because
51
+ * the mcp-server derives TLS from it and assumes :443 with TLS for a
52
+ * non-loopback host that has none (mcp-server/src/config.ts). Any other
53
+ * input (a scheme-less host:port, a bare host) is already a dial target and
54
+ * passes through unchanged.
55
+ */
56
+ export declare function grpcTarget(endpoint: string): string;
57
+ /**
58
+ * The address the platform supplies for a server of this transport, or
59
+ * `null` when the runner knows none: the operator's public endpoint for any
60
+ * transport, else the runner's own backend endpoint for a stdio child.
61
+ */
62
+ export declare function platformServerAddress(transport: McpServerTransport | undefined, endpoints: PlatformEndpoints): string | null;
63
+ /**
64
+ * Return the env map with STIGMER_SERVER_ADDRESS filled for `server` when it
65
+ * declares the key and the map holds no non-empty value for it; otherwise the
66
+ * map itself, unchanged. Never mutates its input.
67
+ */
68
+ export declare function fillPlatformServerAddress(server: McpServer, envVars: Record<string, string>, endpoints: PlatformEndpoints): Record<string, string>;
69
+ /** The transports a McpServer spec declares (its `serverType` oneof). */
70
+ type McpServerTransport = NonNullable<NonNullable<McpServer["spec"]>["serverType"]["case"]>;
71
+ export {};
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The Stigmer server's address for user-defined MCP servers — the reserved
3
+ * STIGMER_SERVER_ADDRESS key, and the one dial-target rule every writer of
4
+ * that key shares (stigmer/stigmer#1433, #1446).
5
+ *
6
+ * The runner is the one component that supplies it, because the runner is
7
+ * the one that knows where the consumer runs:
8
+ *
9
+ * - A remote HTTP server receives the key only through a templated header,
10
+ * so it needs the server's PUBLIC address: STIGMER_MCP_PUBLIC_ENDPOINT,
11
+ * which the server hands every sandbox it provisions from its own
12
+ * configuration (stigmer/stigmer#1447), or an operator names to a
13
+ * runner it starts by hand.
14
+ * - A stdio server is a child of this runner (only a local runner spawns
15
+ * one; mcp-transport-guard.ts), so the address the runner itself dials,
16
+ * STIGMER_BACKEND_ENDPOINT, is right for it by construction.
17
+ *
18
+ * No page supplies it: a value written into a run's runtime_env sits in the
19
+ * top merge layer, above every value the user saved (stigmer/stigmer#1446).
20
+ *
21
+ * The runner FILLS, it never overrides: a non-empty value already in the
22
+ * environment (one the user saved or typed to aim a server elsewhere)
23
+ * stands. A key nobody can supply stays missing, and a
24
+ * header that templates it fails with the resolver's named
25
+ * PlaceholderResolutionError instead of dialing a guess.
26
+ *
27
+ * Injection is opt-in exactly as for the caller-identity keys
28
+ * (caller-identity.ts): only a server whose spec.env declares the key
29
+ * receives it. Applied before filterEnvToDeclaredKeys at execution
30
+ * (mcp-resolver.ts) and before placeholder resolution at discovery
31
+ * (activities/discover-mcp-server.ts), so both phases share one rule.
32
+ */
33
+ /**
34
+ * Reserved env key: the Stigmer server's gRPC dial target, host:port. The
35
+ * name the mcp-server reads its target from (mcp-server/src/config.ts) and
36
+ * `@stigmer/react` keeps out of its setup prompts
37
+ * (sdk/react/src/environment/systemEnvVars.ts); a cross-package string,
38
+ * pinned on every side.
39
+ */
40
+ export const SERVER_ADDRESS_ENV_KEY = "STIGMER_SERVER_ADDRESS";
41
+ /**
42
+ * The gRPC dial target (host:port) for an endpoint, the shape
43
+ * STIGMER_SERVER_ADDRESS wants.
44
+ *
45
+ * An http(s) URL becomes its host with an explicit port: the URL's own, else
46
+ * 80 for http and 443 for https. The port is never left implicit, because
47
+ * the mcp-server derives TLS from it and assumes :443 with TLS for a
48
+ * non-loopback host that has none (mcp-server/src/config.ts). Any other
49
+ * input (a scheme-less host:port, a bare host) is already a dial target and
50
+ * passes through unchanged.
51
+ */
52
+ export function grpcTarget(endpoint) {
53
+ let url;
54
+ try {
55
+ url = new URL(endpoint);
56
+ }
57
+ catch {
58
+ return endpoint;
59
+ }
60
+ // `new URL("host:7234")` parses with `host:` as its scheme, so only a
61
+ // real http(s) URL is taken apart.
62
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
63
+ return endpoint;
64
+ }
65
+ const port = url.port || (url.protocol === "https:" ? "443" : "80");
66
+ return `${url.hostname}:${port}`;
67
+ }
68
+ /**
69
+ * The address the platform supplies for a server of this transport, or
70
+ * `null` when the runner knows none: the operator's public endpoint for any
71
+ * transport, else the runner's own backend endpoint for a stdio child.
72
+ */
73
+ export function platformServerAddress(transport, endpoints) {
74
+ if (endpoints.mcpPublicEndpoint) {
75
+ return grpcTarget(endpoints.mcpPublicEndpoint);
76
+ }
77
+ if (transport === "stdio") {
78
+ return grpcTarget(endpoints.stigmerBackendEndpoint);
79
+ }
80
+ return null;
81
+ }
82
+ /**
83
+ * Return the env map with STIGMER_SERVER_ADDRESS filled for `server` when it
84
+ * declares the key and the map holds no non-empty value for it; otherwise the
85
+ * map itself, unchanged. Never mutates its input.
86
+ */
87
+ export function fillPlatformServerAddress(server, envVars, endpoints) {
88
+ const declared = server.spec?.env ?? {};
89
+ if (!(SERVER_ADDRESS_ENV_KEY in declared) || envVars[SERVER_ADDRESS_ENV_KEY]) {
90
+ return envVars;
91
+ }
92
+ const value = platformServerAddress(server.spec?.serverType.case, endpoints);
93
+ if (value === null) {
94
+ return envVars;
95
+ }
96
+ const source = endpoints.mcpPublicEndpoint
97
+ ? "STIGMER_MCP_PUBLIC_ENDPOINT"
98
+ : "STIGMER_BACKEND_ENDPOINT";
99
+ console.info(`MCP server '${server.metadata?.slug ?? ""}': ${SERVER_ADDRESS_ENV_KEY} ` +
100
+ `filled from ${source} (no value in the execution environment)`);
101
+ return { ...envVars, [SERVER_ADDRESS_ENV_KEY]: value };
102
+ }
103
+ //# sourceMappingURL=platform-server-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-server-address.js","sourceRoot":"","sources":["../../src/shared/platform-server-address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAK/D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,sEAAsE;IACtE,mCAAmC;IACnC,IAAI,GAAG,CAAC,QAAQ,KAAK,O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IAAI,CACV,eAAe,MAAM,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,MAAM,sBAAsB,GAAG;QACzE,eAAe,MAAM,0CAA0C,CAChE,CAAC;IACF,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAE,CAAC;AACzD,CAAC"}
@@ -71,8 +71,3 @@ export declare function stdioCredentialEnv(credential: string | null): Record<st
71
71
  * in that warning (e.g. "channel messaging").
72
72
  */
73
73
  export declare function injectSynthesizedAttachment(resolvedServers: ResolvedMcpServer[], attachment: ResolvedMcpServer, label: string): ResolvedMcpServer[];
74
- /**
75
- * The gRPC dial target (host:port) for a backend endpoint URL — the
76
- * shape STIGMER_SERVER_ADDRESS wants (the bridge warns on schemes).
77
- */
78
- export declare function grpcTarget(endpoint: string): string;
@@ -56,16 +56,4 @@ export function injectSynthesizedAttachment(resolvedServers, attachment, label)
56
56
  attachment,
57
57
  ];
58
58
  }
59
- /**
60
- * The gRPC dial target (host:port) for a backend endpoint URL — the
61
- * shape STIGMER_SERVER_ADDRESS wants (the bridge warns on schemes).
62
- */
63
- export function grpcTarget(endpoint) {
64
- try {
65
- return new URL(endpoint).host;
66
- }
67
- catch {
68
- return endpoint;
69
- }
70
- }
71
59
  //# sourceMappingURL=synthesized-attachment.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"synthesized-attachment.js","sourceRoot":"","sources":["../../src/shared/synthesized-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAyB;IAEzB,OAAO,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,EAAE;QAC7C,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE;QACxC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,eAAoC,EACpC,UAA6B,EAC7B,KAAa;IAEb,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;IACzE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CACV,oBAAoB,UAAU,CAAC,IAAI,yBAAyB,KAAK,GAAG;YACpE,kDAAkD,CACnD,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC;QAC5D,UAAU;KACX,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,QAAQ,CAAC;IAClB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"synthesized-attachment.js","sourceRoot":"","sources":["../../src/shared/synthesized-attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiCH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,UAAyB;IAEzB,OAAO,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,EAAE;QAC7C,CAAC,CAAC,EAAE,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE;QACxC,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,eAAoC,EACpC,UAA6B,EAC7B,KAAa;IAEb,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC;IACzE,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CACV,oBAAoB,UAAU,CAAC,IAAI,yBAAyB,KAAK,GAAG;YACpE,kDAAkD,CACnD,CAAC;IACJ,CAAC;IACD,OAAO;QACL,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,IAAI,CAAC;QAC5D,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -1,18 +1,28 @@
1
1
  /**
2
- * ExecutionConfig.max_tool_rounds → LangGraph recursion_limit resolution.
2
+ * ExecutionConfig.max_tool_rounds: the round budget, its backstop, and the
3
+ * signal that the budget ended a turn.
3
4
  *
4
5
  * Implements the proto contract (agentexecution/v1/spec.proto):
5
- * - 0 / unset = unlimited — no recursionLimit is placed on the invoke
6
- * config, preserving the run-until-done + loop-detection posture.
6
+ * - 0 / unset = unlimited: no round limit and no recursionLimit, preserving
7
+ * the run-until-done + loop-detection posture.
7
8
  * - When set, valid range is 10–1000 rounds; out-of-range values are
8
9
  * clamped to the nearest bound with a warning log.
9
- * - recursion_limit = rounds × 6: each model-tool round consumes multiple
10
- * graph super-steps because every active middleware hook is its own
11
- * node; ×6 is the contract's floor estimate.
10
+ * - A round is one model response that proposes one or more tool calls,
11
+ * followed by their execution; parallel calls are one round.
12
12
  *
13
- * The SAME resolved limit must feed both LangGraph's hard stop (the invoke
14
- * config) and the ExecutionBudgetMiddleware's wrap-up advisory, so the
15
- * "~80% of budget" warning and the enforcement point can never disagree.
13
+ * The budget is COUNTED, not estimated. `middleware/execution-budget.ts`
14
+ * counts rounds where the model is called and throws
15
+ * {@link ToolRoundLimitError} before round N+1's model call, so N rounds
16
+ * run on every middleware stack. The count and the "~80% of budget"
17
+ * advisory live in that one middleware, so they can never disagree. Until
18
+ * #1113 the budget was LangGraph's recursion limit at rounds × 6 super-steps,
19
+ * and because every middleware hook is its own graph node, how many rounds
20
+ * fitted moved whenever the stack did.
21
+ *
22
+ * LangGraph's recursion limit stays only as a backstop
23
+ * ({@link backstopRecursionLimit}): generous enough never to bind before the
24
+ * round count on any stack, it halts a graph that loops without calling the
25
+ * model. Either stop is the same outcome ({@link isToolCallBudgetStop}).
16
26
  *
17
27
  * The knob and its terminal copy live together (the `cost-guard.ts` shape):
18
28
  * when the budget is exhausted the adapter ends its turn `tool_call_limit`
@@ -20,20 +30,27 @@
20
30
  * below — the platform deliberately stopped the run, work is checkpointed,
21
31
  * and the conversation continues on the next message.
22
32
  */
23
- export declare const SUPER_STEPS_PER_ROUND = 6;
24
33
  export declare const MIN_TOOL_ROUNDS = 10;
25
34
  export declare const MAX_TOOL_ROUNDS = 1000;
26
35
  /**
27
- * The advisory-only budget used when max_tool_rounds is unset: high enough
28
- * to never fire on a healthy run. Deliberately NOT enforced as a hard
29
- * recursionLimit — unset means unlimited per the proto contract.
36
+ * Super-steps per round the backstop allows: well above the graph nodes one
37
+ * round costs on any stack the runner builds (about five today), so the
38
+ * round count, never the backstop, is what a bounded run meets.
39
+ */
40
+ export declare const SUPER_STEPS_BACKSTOP_PER_ROUND = 20;
41
+ /**
42
+ * The advisory-only round budget used when max_tool_rounds is unset: high
43
+ * enough to never fire on a healthy run. Deliberately NOT enforced — unset
44
+ * means unlimited per the proto contract.
30
45
  */
31
- export declare const UNBOUNDED_ADVISORY_RECURSION_LIMIT = 6000;
46
+ export declare const UNBOUNDED_ADVISORY_TOOL_ROUNDS = 1000;
32
47
  /**
33
- * The recursionLimit for the invoke config, or null when the execution is
34
- * unbounded (max_tool_rounds 0/unset — the pre-existing default posture).
48
+ * The round budget for a turn, clamped to the valid range, or null when the
49
+ * execution is unbounded (max_tool_rounds 0/unset — the default posture).
35
50
  */
36
- export declare function resolveRecursionLimit(maxToolRounds: number | undefined): number | null;
51
+ export declare function resolveToolRoundLimit(maxToolRounds: number | undefined): number | null;
52
+ /** The recursionLimit backstop for a bounded turn's invoke config; see {@link SUPER_STEPS_BACKSTOP_PER_ROUND}. */
53
+ export declare function backstopRecursionLimit(toolRoundLimit: number): number;
37
54
  /**
38
55
  * Stable prefix of the tool-call-limit terminal error. This is a cross-repo
39
56
  * contract: consumers that need to distinguish "ran out of tool-call budget"
@@ -53,10 +70,21 @@ export declare function formatToolCallLimitError(): string;
53
70
  */
54
71
  export declare const TOOL_CALL_LIMIT_USER_COPY: string;
55
72
  /**
56
- * Whether an error thrown out of a LangGraph run is the graph exhausting the
57
- * recursion limit `resolveRecursionLimit` placed on it — the budget's own
58
- * signal, not a failure: the adapter ends the turn `tool_call_limit`.
59
- * Matched by class name and message because the error class is not
60
- * exported on a stable path across `@langchain/langgraph` versions.
73
+ * The execution budget's stop: thrown by `middleware/execution-budget.ts` in
74
+ * place of round N+1's model call, so the graph ends on round N's tool
75
+ * results with no proposed call left unexecuted.
76
+ */
77
+ export declare class ToolRoundLimitError extends Error {
78
+ readonly toolRoundLimit: number;
79
+ constructor(toolRoundLimit: number);
80
+ }
81
+ /**
82
+ * Whether an error thrown out of a LangGraph run is the tool-call budget
83
+ * ending the turn — the budget's own signal, not a failure: the adapter ends
84
+ * the turn `tool_call_limit`. Two producers, one outcome: the round count's
85
+ * {@link ToolRoundLimitError}, which reaches the turn wrapped in LangChain's
86
+ * `MiddlewareError` once per `wrapModelCall` layer (so the cause chain is
87
+ * walked, as `unwrapModelError` does for a model error), and the backstop's
88
+ * `GraphRecursionError`.
61
89
  */
62
- export declare function isGraphRecursionError(err: unknown): boolean;
90
+ export declare function isToolCallBudgetStop(err: unknown): boolean;