deepline 0.3.526 → 0.3.527

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 (129) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +24 -3
  3. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +35 -5
  4. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +12 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +50 -8
  6. package/dist/cli/auth-C7BBYIQD.js +43 -0
  7. package/dist/cli/{auth-JATW5XZE.mjs → auth-LRMMQFJ4.mjs} +5 -5
  8. package/dist/cli/{billing-TSHBJIJS.js → billing-M76MMWZB.js} +79 -79
  9. package/dist/cli/{billing-UT5LIESH.mjs → billing-WZZDXVRJ.mjs} +6 -6
  10. package/dist/cli/{chunk-F5KFGF45.js → chunk-2A6IRSE6.js} +5 -5
  11. package/dist/cli/{chunk-2JNX3MDG.mjs → chunk-2L3HVEBM.mjs} +1 -1
  12. package/dist/cli/{chunk-BYEF4RBX.js → chunk-3L2DNG5X.js} +11 -11
  13. package/dist/cli/{chunk-FMPGWAIR.js → chunk-3PQDEBO6.js} +1 -1
  14. package/dist/cli/{chunk-HPACLONQ.mjs → chunk-4YN7DZEA.mjs} +2 -2
  15. package/dist/cli/{chunk-D2XMFXFM.mjs → chunk-5YR6CDJ2.mjs} +6 -6
  16. package/dist/cli/{chunk-3ZEV5BS5.js → chunk-66YLAQ2X.js} +26 -26
  17. package/dist/cli/{chunk-TXJW6RIM.mjs → chunk-77VNC2KF.mjs} +1 -1
  18. package/dist/cli/{chunk-WITNIMLE.js → chunk-7DPWGAOU.js} +3 -3
  19. package/dist/cli/{chunk-WOLY6SU4.mjs → chunk-AXFHQWGA.mjs} +1 -1
  20. package/dist/cli/{chunk-B33J4YCC.js → chunk-C7A44BZ7.js} +3 -3
  21. package/dist/cli/{chunk-U6OUX47C.mjs → chunk-E4TEZE62.mjs} +2 -2
  22. package/dist/cli/{chunk-UTCGCES2.js → chunk-EOL7PXLW.js} +7 -7
  23. package/dist/cli/{chunk-ED2N4NRI.js → chunk-ETXQZGQU.js} +16 -16
  24. package/dist/cli/{chunk-Y47OCS5V.mjs → chunk-GIRMVMXP.mjs} +1 -1
  25. package/dist/cli/{chunk-DY2AT3JQ.mjs → chunk-HA2J2OAS.mjs} +10 -10
  26. package/dist/cli/{chunk-SCLRGDF4.js → chunk-HB3YUHEL.js} +44 -44
  27. package/dist/cli/{chunk-J5OXJ4JI.js → chunk-HQZLTK3P.js} +2 -2
  28. package/dist/cli/{chunk-MQB25LMV.mjs → chunk-JEIGNX3G.mjs} +5 -5
  29. package/dist/cli/{chunk-7COEN3IR.js → chunk-JSEISVAZ.js} +4 -4
  30. package/dist/cli/{chunk-XVIMOB2U.mjs → chunk-JSVHBJE2.mjs} +2 -2
  31. package/dist/cli/{chunk-TVHDWS5U.mjs → chunk-KDFUQRVU.mjs} +1 -1
  32. package/dist/cli/{chunk-3MYI3IXW.js → chunk-LHMHUA5D.js} +7 -7
  33. package/dist/cli/{chunk-26ULNPQ7.mjs → chunk-M45S7JAY.mjs} +2 -2
  34. package/dist/cli/{chunk-6COGHW7B.mjs → chunk-MIL5YDKZ.mjs} +2 -2
  35. package/dist/cli/{chunk-IMP7WR22.mjs → chunk-MMM2WMTF.mjs} +5 -5
  36. package/dist/cli/{chunk-BVITYMBK.mjs → chunk-NVII3RWQ.mjs} +2 -2
  37. package/dist/cli/{chunk-RZJWHL7L.js → chunk-OKRBGXDI.js} +5 -5
  38. package/dist/cli/{chunk-CDP3LMDT.js → chunk-OLSATEDQ.js} +6 -6
  39. package/dist/cli/{chunk-SJ6KUCGM.js → chunk-OXHY3LD3.js} +53 -53
  40. package/dist/cli/{chunk-2GJW4RAQ.mjs → chunk-P5ZU5ZHA.mjs} +1 -1
  41. package/dist/cli/{chunk-IWLDJQGV.mjs → chunk-QKKT5G4K.mjs} +3 -3
  42. package/dist/cli/{chunk-TCLJXJAG.mjs → chunk-QKY3H3HA.mjs} +4 -4
  43. package/dist/cli/{chunk-UWCEBS7F.js → chunk-R6IWWPY7.js} +14 -14
  44. package/dist/cli/{chunk-WBY3R55B.js → chunk-RGL2YGJZ.js} +2 -2
  45. package/dist/cli/{chunk-EEYZLTXX.mjs → chunk-RMCKTV4R.mjs} +1 -1
  46. package/dist/cli/{chunk-6JMWATX5.mjs → chunk-RTPLRMEB.mjs} +5 -5
  47. package/dist/cli/{chunk-6DHEV6IA.js → chunk-SRQQAUXN.js} +2 -2
  48. package/dist/cli/{chunk-477PXM65.js → chunk-UAQ7ZWRP.js} +22 -22
  49. package/dist/cli/{chunk-BFH3DJYV.mjs → chunk-UJHS2O5O.mjs} +3 -3
  50. package/dist/cli/{chunk-UUIC2JFZ.mjs → chunk-UKOG6PCB.mjs} +1 -1
  51. package/dist/cli/{chunk-C3EW6I65.mjs → chunk-VTXBV4AX.mjs} +1 -1
  52. package/dist/cli/{chunk-YNFPZVII.mjs → chunk-VV2AFJ3I.mjs} +5 -5
  53. package/dist/cli/{chunk-46HEYGLY.js → chunk-XI47UAVU.js} +9 -9
  54. package/dist/cli/{chunk-D5OEUPPM.js → chunk-XYG4IOJK.js} +98 -98
  55. package/dist/cli/{chunk-O7WUATQC.js → chunk-YJ4YVFXC.js} +13 -13
  56. package/dist/cli/{chunk-77RAGJIZ.mjs → chunk-YKPMIJJ2.mjs} +2 -2
  57. package/dist/cli/{chunk-TBQC2XS3.js → chunk-YSDPYQBH.js} +41 -41
  58. package/dist/cli/{chunk-CYN2AHR6.js → chunk-YUYDP2EG.js} +6 -6
  59. package/dist/cli/{chunk-6H56LKJB.js → chunk-ZHY7AY5V.js} +16 -16
  60. package/dist/cli/{csv-4BLFRED6.mjs → csv-FEFNXZF7.mjs} +4 -4
  61. package/dist/cli/{csv-KSJB5Z3M.js → csv-IRP6VT7Q.js} +13 -13
  62. package/dist/cli/{db-OVW6C3DV.mjs → db-IHECMWZ3.mjs} +6 -6
  63. package/dist/cli/{db-G7Z5CKO2.js → db-Y5VNPNRD.js} +27 -27
  64. package/dist/cli/describe-MNJVJHRE.js +50 -0
  65. package/dist/cli/{describe-OEFTD7WQ.mjs → describe-XCVC2WLL.mjs} +18 -18
  66. package/dist/cli/{executions-7ZKQ4ZU3.mjs → executions-3FWZYUJV.mjs} +6 -6
  67. package/dist/cli/{executions-O7USCBCW.js → executions-QH3KJ6MA.js} +8 -8
  68. package/dist/cli/{feedback-Y55WCRIQ.js → feedback-BGHWMOLH.js} +14 -14
  69. package/dist/cli/{feedback-KUBL5E3I.mjs → feedback-F3OZXOPM.mjs} +6 -6
  70. package/dist/cli/git-MDOHEW5J.js +25 -0
  71. package/dist/cli/{git-C6ZAU5JA.mjs → git-RWPH3D75.mjs} +5 -5
  72. package/dist/cli/index.js +141 -141
  73. package/dist/cli/index.mjs +43 -43
  74. package/dist/cli/{legacy-noops-MUXD4HRC.mjs → legacy-noops-5ADSTBJ5.mjs} +6 -6
  75. package/dist/cli/{legacy-noops-OVWX4KB3.js → legacy-noops-G6CYD5LM.js} +9 -9
  76. package/dist/cli/{monitors-2ZSGBY52.mjs → monitors-AFNAU3A2.mjs} +7 -7
  77. package/dist/cli/{monitors-3QVYGYWA.js → monitors-VZCBZO26.js} +100 -100
  78. package/dist/cli/{org-RDSPE5FB.mjs → org-JVLYTU24.mjs} +6 -6
  79. package/dist/cli/{org-S6Z3SDLI.js → org-X4QRYBC4.js} +86 -86
  80. package/dist/cli/{pages-K5DSMHLJ.mjs → pages-VELKZKBL.mjs} +6 -6
  81. package/dist/cli/{pages-VUWF2OR7.js → pages-YMM4KBW5.js} +18 -18
  82. package/dist/cli/{play-SQOJTUFC.js → play-J7DEBHI7.js} +317 -317
  83. package/dist/cli/{play-PZLXOYEX.mjs → play-MIY6BYRB.mjs} +18 -18
  84. package/dist/cli/{providers-AMIGP3D4.mjs → providers-2H3W3W7G.mjs} +6 -6
  85. package/dist/cli/{providers-FZBEPUOI.js → providers-TOUB7Y2A.js} +9 -9
  86. package/dist/cli/{quickstart-HNOQKGOF.mjs → quickstart-GKAS5265.mjs} +4 -4
  87. package/dist/cli/{quickstart-QIHZDBGM.js → quickstart-LHY2LN3P.js} +6 -6
  88. package/dist/cli/{run-JDW6BDNT.mjs → run-KYGNOWYD.mjs} +23 -23
  89. package/dist/cli/{run-IQGM3TO2.js → run-QCAVDPE5.js} +41 -41
  90. package/dist/cli/search-G67CEHR7.js +33 -0
  91. package/dist/cli/{search-DMVUKJ23.mjs → search-YPGAIFDX.mjs} +8 -8
  92. package/dist/cli/{search-output-UUW6UNHF.js → search-output-ASELNQ2U.js} +6 -6
  93. package/dist/cli/{search-output-5UAPUUHH.mjs → search-output-OOC3VK4T.mjs} +4 -4
  94. package/dist/cli/{secrets-U532KN24.js → secrets-KX3TQB4R.js} +15 -15
  95. package/dist/cli/{secrets-46KSTPFN.mjs → secrets-VJ4XYSMZ.mjs} +6 -6
  96. package/dist/cli/{sessions-RUNWYHYX.mjs → sessions-KUN7H7E5.mjs} +6 -6
  97. package/dist/cli/sessions-QILPX4XQ.js +22 -0
  98. package/dist/cli/{settings-O2A37FFA.js → settings-5NIF4BU7.js} +86 -86
  99. package/dist/cli/{settings-56L3WHCY.mjs → settings-JKFYZ2IT.mjs} +13 -13
  100. package/dist/cli/{setup-Q27X6JZY.mjs → setup-5AX3TN6G.mjs} +10 -10
  101. package/dist/cli/{setup-ETFSMSCH.js → setup-MYV3IHPS.js} +50 -50
  102. package/dist/cli/{skills-WFQRZL4D.mjs → skills-JLS4CINQ.mjs} +8 -8
  103. package/dist/cli/skills-NG32XTZI.js +37 -0
  104. package/dist/cli/tools-OZG3V77R.js +57 -0
  105. package/dist/cli/{tools-EV6CKJOX.mjs → tools-VBYKD3MJ.mjs} +17 -17
  106. package/dist/cli/{update-KIPPFVCH.mjs → update-QWAIVJRI.mjs} +10 -10
  107. package/dist/cli/update-YL5WVSKU.js +35 -0
  108. package/dist/cli/{views-LMJXWD4N.mjs → views-TBWGZAVZ.mjs} +6 -6
  109. package/dist/cli/{views-DNZ2HFTA.js → views-ZW56JZB5.js} +18 -18
  110. package/dist/cli/{workflow-ZUDTIOK6.js → workflow-EKSZST6M.js} +17 -17
  111. package/dist/cli/{workflow-3XKUQ73U.mjs → workflow-X7UQPJMQ.mjs} +7 -7
  112. package/dist/index.js +9 -9
  113. package/dist/index.mjs +6 -6
  114. package/dist/install-integrity.json +104 -104
  115. package/dist/release.d.mts +1 -1
  116. package/dist/release.d.ts +1 -1
  117. package/dist/release.js +2 -2
  118. package/dist/release.mjs +1 -1
  119. package/dist/server.js +5 -5
  120. package/dist/server.mjs +3 -3
  121. package/package.json +1 -1
  122. package/dist/cli/auth-L2POG3LL.js +0 -43
  123. package/dist/cli/describe-KMYR2JBC.js +0 -50
  124. package/dist/cli/git-NBVQ3VGW.js +0 -25
  125. package/dist/cli/search-BNWRL3YY.js +0 -33
  126. package/dist/cli/sessions-JZUONXH4.js +0 -22
  127. package/dist/cli/skills-IKDJ5JDN.js +0 -37
  128. package/dist/cli/tools-B735AA67.js +0 -57
  129. package/dist/cli/update-CNNURAM3.js +0 -35
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.526',
208
+ version: '0.3.527',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -19,6 +19,7 @@ import type {
19
19
  import { isIsolatedRuntimeSchedulerSchema } from '../../runtime-scheduler-topology';
20
20
  import { PLAY_RUNNER_TIMEOUT_SECONDS } from '../../runtime-constants';
21
21
  import {
22
+ MAX_PLAY_SANDBOX_RUNTIME_LIMITS,
22
23
  STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
23
24
  playSandboxSizeForLimits,
24
25
  validatePlaySandboxRuntimeLimits,
@@ -78,6 +79,28 @@ const DAYTONA_ABSENT_OPERATION_RECREATE_AFTER_MS = 3 * 60_000;
78
79
  // `reserved`, and `deleting` can never be promoted to `live`, so no runner
79
80
  // command can reach it afterwards.
80
81
  export const DAYTONA_STUCK_CREATING_REPLACE_AFTER_MS = 2 * 60_000;
82
+
83
+ /** Daytona's inactivity stop for a one-shot sandbox of this Play timeout. */
84
+ export function daytonaAutoStopIntervalMinutes(timeoutSeconds: number): number {
85
+ return Math.ceil(
86
+ (timeoutSeconds + PLAY_RUNNER_TIMEOUT_SECONDS - 30 * 60) / 60,
87
+ );
88
+ }
89
+
90
+ /**
91
+ * How long after it was sent a one-shot create that landed late is certainly
92
+ * gone. Every one-shot sandbox is ephemeral: Daytona deletes it as soon as it
93
+ * stops, and it stops at the latest after the longest Play's inactivity
94
+ * interval. Thirty minutes on top cover a create the provider accepted but had
95
+ * not yet made visible, and a create sent a few minutes after its reservation
96
+ * was read.
97
+ */
98
+ export const DAYTONA_SENT_CREATE_GONE_AFTER_MS =
99
+ daytonaAutoStopIntervalMinutes(
100
+ MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds,
101
+ ) *
102
+ 60_000 +
103
+ 30 * 60_000;
81
104
  // Explicit runner deadline + scheduler GC own the normal lifecycle. Daytona's
82
105
  // inactivity stop is a wider crash backstop measured from sandbox creation, so
83
106
  // setup time cannot consume the terminal-flush grace.
@@ -642,9 +665,7 @@ async function createOneShotDaytonaSandbox(input: {
642
665
  // Daytona deletes an ephemeral sandbox immediately when it stops.
643
666
  ephemeral: true,
644
667
  autoDeleteInterval: 0,
645
- autoStopInterval: Math.ceil(
646
- (limits.timeoutSeconds + PLAY_RUNNER_TIMEOUT_SECONDS - 30 * 60) / 60,
647
- ),
668
+ autoStopInterval: daytonaAutoStopIntervalMinutes(limits.timeoutSeconds),
648
669
  autoArchiveInterval: DAYTONA_AUTO_ARCHIVE_INTERVAL_MINUTES,
649
670
  // A non-empty `networkAllowList` IS the "block all egress except these
650
671
  // CIDRs" control; Daytona rejects create when `networkBlockAll: true` is
@@ -345,6 +345,7 @@ import {
345
345
  readReservedDaytonaCancellationOperation,
346
346
  recordDaytonaSandboxCleanupIntent,
347
347
  reserveRuntimeSandboxOperation,
348
+ RUNTIME_SANDBOX_CAPACITY_LEASE_MS,
348
349
  runtimeSandboxCapacityAdmissionMode,
349
350
  RuntimeSandboxCapacityLimitError,
350
351
  } from './runtime-sandbox-capacity';
@@ -10243,22 +10244,51 @@ export async function reconcileReservedDaytonaCancellationOnce(input: {
10243
10244
  } catch (error) {
10244
10245
  const message = error instanceof Error ? error.message : String(error);
10245
10246
  if (!/\b(?:sandbox )?not found\b|\b404\b/i.test(message)) throw error;
10247
+ const ageMs = Date.now() - operation.createdAtMs;
10248
+ if (ageMs < RUNTIME_RELIABILITY_POLICY.recovery.horizonMs) return;
10249
+ const abandonedWhileActive = await input.runWithClient((client) =>
10250
+ abandonRuntimeSandboxOperationReservation(
10251
+ client,
10252
+ {
10253
+ operationKey: operation.operationKey,
10254
+ // Execution recovery ending is not proof a sent create cannot land.
10255
+ onlyWhileRunActive: true,
10256
+ },
10257
+ input.schedulerOptions,
10258
+ ),
10259
+ );
10260
+ if (abandonedWhileActive) return;
10261
+ const { DAYTONA_SENT_CREATE_GONE_AFTER_MS } =
10262
+ await import('../runner-backends/backends/daytona-lifecycle');
10263
+ // A resume can resend this same-name create until the reservation's
10264
+ // capacity lease expires, so measure the sandbox's whole life from there.
10246
10265
  if (
10247
- Date.now() - operation.createdAtMs <
10248
- RUNTIME_RELIABILITY_POLICY.recovery.horizonMs
10266
+ ageMs <
10267
+ RUNTIME_SANDBOX_CAPACITY_LEASE_MS + DAYTONA_SENT_CREATE_GONE_AFTER_MS
10249
10268
  )
10250
10269
  return;
10251
- await input.runWithClient((client) =>
10270
+ // Every claim of a terminal Run is released. Past the last create's
10271
+ // longest ephemeral life, a create that landed late has stopped and
10272
+ // deleted itself, so this 404 means nothing the reservation could bind.
10273
+ const abandonedAfterTerminal = await input.runWithClient((client) =>
10252
10274
  abandonRuntimeSandboxOperationReservation(
10253
10275
  client,
10254
10276
  {
10255
10277
  operationKey: operation.operationKey,
10256
- // Execution recovery ending is not proof a sent create cannot land.
10257
- onlyWhileRunActive: true,
10278
+ onlyAfterRunTerminal: true,
10258
10279
  },
10259
10280
  input.schedulerOptions,
10260
10281
  ),
10261
10282
  );
10283
+ if (abandonedAfterTerminal)
10284
+ console.info(
10285
+ '[absurd-runtime.worker] daytona_terminal_unbound_create_abandoned',
10286
+ {
10287
+ runId: operation.runId,
10288
+ operationKey: operation.operationKey,
10289
+ ageMs,
10290
+ },
10291
+ );
10262
10292
  return;
10263
10293
  } finally {
10264
10294
  control.dispose();
@@ -952,6 +952,11 @@ export async function abandonRuntimeSandboxOperationReservation(
952
952
  attempt?: number;
953
953
  /** A lookup 404 must not retire a terminal Run's unresolved creation. */
954
954
  onlyWhileRunActive?: boolean;
955
+ /**
956
+ * Only once the Run is terminal: the caller has proven that any create
957
+ * this reservation sent has outlived every sandbox it could have made.
958
+ */
959
+ onlyAfterRunTerminal?: boolean;
955
960
  },
956
961
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
957
962
  ): Promise<boolean> {
@@ -986,6 +991,12 @@ export async function abandonRuntimeSandboxOperationReservation(
986
991
  WHERE status IN ('queued', 'running', 'waiting')
987
992
  )
988
993
  )
994
+ AND (
995
+ NOT $6::boolean OR EXISTS (
996
+ SELECT 1 FROM custody_run
997
+ WHERE status IN ('completed', 'failed', 'cancelled')
998
+ )
999
+ )
989
1000
  RETURNING operation.operation_key
990
1001
  ), released AS (
991
1002
  UPDATE ${leases} AS lease
@@ -1003,6 +1014,7 @@ export async function abandonRuntimeSandboxOperationReservation(
1003
1014
  runtimeSandboxOperationFromStates('abandon_reservation'),
1004
1015
  input.attempt ?? null,
1005
1016
  input.onlyWhileRunActive ?? false,
1017
+ input.onlyAfterRunTerminal ?? false,
1006
1018
  ],
1007
1019
  );
1008
1020
  return result.rows.length === 1;
@@ -73,6 +73,22 @@ export const TOOL_EXECUTE_CONCURRENCY_BACKPRESSURE_MAX_ATTEMPTS = 65;
73
73
  export const TOOL_EXECUTE_RUNTIME_SCHEDULER_CAPACITY_MAX_ATTEMPTS = 65;
74
74
  /** Re-admission after a stale shared provider permit is safely replayable. */
75
75
  export const TOOL_EXECUTE_PROVIDER_PACING_WAIT_MAX_ATTEMPTS = 65;
76
+ // Logical attempts advance only after a fully received retryable HTTP result.
77
+ // Gateway follower polls stay on the same attempt. The runtime gateway refuses
78
+ // a fenced attempt above this ceiling unless it claims the preceding provider
79
+ // 429, which bounds the wire value before fingerprints or history queries, so
80
+ // malformed executor traffic cannot turn one request into unbounded work.
81
+ export const EXECUTION_GATEWAY_MAX_LOGICAL_ATTEMPT = 32;
82
+ // Every fenced retry other than a shed or follower poll opens the next logical
83
+ // attempt. A Deepline refusal made before dispatch gets the attempts the other
84
+ // advancing reasons leave under the gateway ceiling: idempotency in progress,
85
+ // customer DB storage, and the edge, provider and replay-safe 5xx retries.
86
+ export const TOOL_EXECUTE_FENCED_PRE_DISPATCH_RATE_REFUSAL_MAX_ATTEMPTS =
87
+ EXECUTION_GATEWAY_MAX_LOGICAL_ATTEMPT -
88
+ (TOOL_EXECUTE_IDEMPOTENCY_IN_PROGRESS_MAX_ATTEMPTS - 1) -
89
+ (TOOL_EXECUTE_CUSTOMER_DB_STORAGE_UNAVAILABLE_MAX_ATTEMPTS - 1) -
90
+ 3 * (TOOL_EXECUTE_TRANSIENT_HTTP_MAX_ATTEMPTS - 1) +
91
+ 1;
76
92
  export const TOOL_EXECUTE_TRANSPORT_MAX_ATTEMPTS = 3;
77
93
  export const TOOL_EXECUTE_TRANSPORT_RETRY_DELAY_MS = 1_000;
78
94
  // A sandbox lost new connections for about 97 seconds on 2026-10-30, and each
@@ -462,6 +478,12 @@ function isConcurrencyBackpressureResponse(input: {
462
478
  );
463
479
  }
464
480
 
481
+ /** Pacing limits a caller can wait out; a quota denial names when it ends instead. */
482
+ const PRE_DISPATCH_RATE_KINDS = new Set([
483
+ 'requests_per_second',
484
+ 'requests_per_minute',
485
+ ]);
486
+
465
487
  function isPreDispatchRateRefusalResponse(input: {
466
488
  status: number;
467
489
  bodyText: string;
@@ -474,13 +496,13 @@ function isPreDispatchRateRefusalResponse(input: {
474
496
  body.failure_origin === 'deepline_rate_limit' &&
475
497
  body.error_category === 'rate_limit' &&
476
498
  body.provider_request_dispatched === false &&
477
- // Workspace tool admission precedes billing for both execute paths.
478
- // Credential refusals release a charge and retain their unfenced contract.
479
- ((body.rate_limit_bucket_scope === 'customer_tool' &&
480
- body.rate_limit_kind === 'requests_per_minute') ||
481
- (input.executionFenced !== true &&
482
- body.rate_limit_bucket_scope === 'credential_shared' &&
483
- body.rate_limit_kind === 'requests_per_second'))
499
+ typeof body.rate_limit_kind === 'string' &&
500
+ PRE_DISPATCH_RATE_KINDS.has(body.rate_limit_kind) &&
501
+ // Workspace tool admission precedes billing for both execute paths. Every
502
+ // other Deepline refusal releases a charge it opened, so a fenced call
503
+ // keeps replaying its recorded outcome.
504
+ (body.rate_limit_bucket_scope === 'customer_tool' ||
505
+ input.executionFenced !== true)
484
506
  );
485
507
  }
486
508
 
@@ -646,6 +668,8 @@ function decideToolExecuteHttpRetry(input: {
646
668
  concurrencyBackpressure?: boolean;
647
669
  runtimeSchedulerCapacity?: boolean;
648
670
  providerPacingWait?: boolean;
671
+ /** A Deepline limiter refused before dispatch (`isPreDispatchRateRefusalResponse`). */
672
+ preDispatchRateRefusal?: boolean;
649
673
  hardBillingFailure?: boolean;
650
674
  hasRetryAfterHeader?: boolean;
651
675
  transientHttpRetrySafe?: boolean;
@@ -669,6 +693,20 @@ function decideToolExecuteHttpRetry(input: {
669
693
  reason: 'concurrency_backpressure',
670
694
  };
671
695
  }
696
+ // Waiting out a refusal that sent nothing is always safe, so a row waits as
697
+ // long as app pacing would let it rather than failing at eight attempts.
698
+ // A fenced retry opens a new gateway attempt, so it stays under the
699
+ // gateway's ceiling.
700
+ if (input.preDispatchRateRefusal) {
701
+ return {
702
+ retryable: true,
703
+ attemptCap:
704
+ input.executionFenced === true
705
+ ? TOOL_EXECUTE_FENCED_PRE_DISPATCH_RATE_REFUSAL_MAX_ATTEMPTS
706
+ : TOOL_EXECUTE_PROVIDER_PACING_WAIT_MAX_ATTEMPTS,
707
+ reason: 'rate_limit',
708
+ };
709
+ }
672
710
  if (!input.hasRetryAfterHeader) {
673
711
  return {
674
712
  retryable: true,
@@ -947,6 +985,7 @@ export function classifyToolExecuteHttpFailure(input: {
947
985
  concurrencyBackpressure,
948
986
  runtimeSchedulerCapacity,
949
987
  providerPacingWait,
988
+ preDispatchRateRefusal,
950
989
  hasRetryAfterHeader,
951
990
  transientHttpRetrySafe,
952
991
  edgeGatewayFailure,
@@ -1020,6 +1059,7 @@ export function classifyToolExecuteHttpFailure(input: {
1020
1059
  concurrencyBackpressure,
1021
1060
  runtimeSchedulerCapacity,
1022
1061
  providerPacingWait,
1062
+ preDispatchRateRefusal,
1023
1063
  hardBillingFailure,
1024
1064
  hasRetryAfterHeader,
1025
1065
  transientHttpRetrySafe,
@@ -1164,7 +1204,9 @@ export function classifyToolExecuteHttpFailure(input: {
1164
1204
  // the tool-call budget. The run-wide retry budget is a runaway guard
1165
1205
  // whose breach is run-fatal; a provider outage across a large map must
1166
1206
  // surface as row failures, not exhaust it and fail the whole run.
1167
- retryDecision.reason !== 'provider_server_error',
1207
+ retryDecision.reason !== 'provider_server_error' &&
1208
+ // A wait on a refusal that sent nothing is pacing, not a failed call.
1209
+ !preDispatchRateRefusal,
1168
1210
  // The app reported a provider failure and asked for a retry, so it has
1169
1211
  // already released that attempt's reservation, and admission never reopens
1170
1212
  // one. BILLING_UNAVAILABLE may follow an authorization whose response was
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ var _chunkOXHY3LD3js = require('./chunk-OXHY3LD3.js');
18
+ require('./chunk-EOL7PXLW.js');
19
+ require('./chunk-7DPWGAOU.js');
20
+ require('./chunk-JSEISVAZ.js');
21
+ require('./chunk-T2N3B7IQ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-SQWET4SL.js');
24
+ require('./chunk-3PQDEBO6.js');
25
+ require('./chunk-OG64RBAC.js');
26
+ require('./chunk-COGTRVWW.js');
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkOXHY3LD3js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkOXHY3LD3js.authStatusLine; exports.clearPendingClaim = _chunkOXHY3LD3js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkOXHY3LD3js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkOXHY3LD3js.handleRegister; exports.handleStatus = _chunkOXHY3LD3js.handleStatus; exports.handleWait = _chunkOXHY3LD3js.handleWait; exports.httpJson = _chunkOXHY3LD3js.httpJson; exports.readPendingAuthClaim = _chunkOXHY3LD3js.readPendingAuthClaim; exports.readStatusBanner = _chunkOXHY3LD3js.readStatusBanner; exports.registerAuthCommands = _chunkOXHY3LD3js.registerAuthCommands; exports.reportApprovalLinkShown = _chunkOXHY3LD3js.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkOXHY3LD3js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkOXHY3LD3js.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkOXHY3LD3js.statusBannerLine;
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-IWLDJQGV.mjs";
18
- import "./chunk-XVIMOB2U.mjs";
19
- import "./chunk-TXJW6RIM.mjs";
20
- import "./chunk-2GJW4RAQ.mjs";
17
+ } from "./chunk-QKKT5G4K.mjs";
18
+ import "./chunk-JSVHBJE2.mjs";
19
+ import "./chunk-77VNC2KF.mjs";
20
+ import "./chunk-P5ZU5ZHA.mjs";
21
21
  import "./chunk-QNHHZ63P.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-ZPGGW27Q.mjs";
24
- import "./chunk-EEYZLTXX.mjs";
24
+ import "./chunk-RMCKTV4R.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {