deepline 0.3.527 → 0.3.528

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 (146) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +141 -211
  3. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +5 -0
  4. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +66 -1
  5. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +135 -161
  6. package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +56 -1
  7. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +11 -1
  8. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +36 -6
  9. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +35 -5
  10. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +12 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +1 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +16 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +25 -5
  14. package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +6 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +6 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-claim-loop-timing.ts +145 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +48 -5
  18. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +281 -66
  19. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +13 -5
  20. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +30 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +105 -13
  22. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/result-receipt-policy.ts +10 -1
  23. package/dist/cli/auth-CWJZYLTB.js +43 -0
  24. package/dist/cli/{auth-LRMMQFJ4.mjs → auth-PPOTNK4T.mjs} +5 -5
  25. package/dist/cli/{billing-M76MMWZB.js → billing-3C7T7CUQ.js} +79 -79
  26. package/dist/cli/{billing-WZZDXVRJ.mjs → billing-OEZUQ2K6.mjs} +6 -6
  27. package/dist/cli/{chunk-R6IWWPY7.js → chunk-237PKFIQ.js} +14 -14
  28. package/dist/cli/{chunk-YSDPYQBH.js → chunk-36UD7H7Y.js} +41 -41
  29. package/dist/cli/{chunk-M45S7JAY.mjs → chunk-42ZSDTOC.mjs} +2 -2
  30. package/dist/cli/{chunk-YJ4YVFXC.js → chunk-4SBUXDKZ.js} +13 -13
  31. package/dist/cli/{chunk-HB3YUHEL.js → chunk-5MJ4CDAQ.js} +44 -44
  32. package/dist/cli/{chunk-UJHS2O5O.mjs → chunk-6OLQWQU5.mjs} +3 -3
  33. package/dist/cli/{chunk-EOL7PXLW.js → chunk-7WZXUAQW.js} +7 -7
  34. package/dist/cli/{chunk-YUYDP2EG.js → chunk-7X3NLHI7.js} +6 -6
  35. package/dist/cli/{chunk-XYG4IOJK.js → chunk-ADZGTMLU.js} +98 -98
  36. package/dist/cli/{chunk-MIL5YDKZ.mjs → chunk-AFIAVG5T.mjs} +2 -2
  37. package/dist/cli/{chunk-3L2DNG5X.js → chunk-B3HQF2CA.js} +11 -11
  38. package/dist/cli/{chunk-HA2J2OAS.mjs → chunk-B6YWCGVC.mjs} +10 -10
  39. package/dist/cli/{chunk-NVII3RWQ.mjs → chunk-CMTY6SVY.mjs} +2 -2
  40. package/dist/cli/{chunk-AXFHQWGA.mjs → chunk-DCVNL5XN.mjs} +1 -1
  41. package/dist/cli/{chunk-RTPLRMEB.mjs → chunk-FPHAUP55.mjs} +5 -5
  42. package/dist/cli/{chunk-JSEISVAZ.js → chunk-FXYWEKUK.js} +4 -4
  43. package/dist/cli/{chunk-HQZLTK3P.js → chunk-G7RTPKRJ.js} +2 -2
  44. package/dist/cli/{chunk-OKRBGXDI.js → chunk-GCBFSFLA.js} +5 -5
  45. package/dist/cli/{chunk-VTXBV4AX.mjs → chunk-GFGFAAY2.mjs} +1 -1
  46. package/dist/cli/{chunk-JSVHBJE2.mjs → chunk-GP7E4TE4.mjs} +2 -2
  47. package/dist/cli/{chunk-4YN7DZEA.mjs → chunk-GSBKODMU.mjs} +2 -2
  48. package/dist/cli/{chunk-RMCKTV4R.mjs → chunk-HJVNCRXY.mjs} +1 -1
  49. package/dist/cli/{chunk-7DPWGAOU.js → chunk-IJAEYEJM.js} +3 -3
  50. package/dist/cli/{chunk-VV2AFJ3I.mjs → chunk-IM5XQ4DG.mjs} +5 -5
  51. package/dist/cli/{chunk-XI47UAVU.js → chunk-IXEEXYE2.js} +9 -9
  52. package/dist/cli/{chunk-JEIGNX3G.mjs → chunk-IYCRX34W.mjs} +5 -5
  53. package/dist/cli/{chunk-ZHY7AY5V.js → chunk-KHVCHFE3.js} +16 -16
  54. package/dist/cli/{chunk-KDFUQRVU.mjs → chunk-KLGYBOGZ.mjs} +1 -1
  55. package/dist/cli/{chunk-UKOG6PCB.mjs → chunk-KWIKFR7Y.mjs} +1 -1
  56. package/dist/cli/{chunk-ETXQZGQU.js → chunk-LT4IEJ6V.js} +16 -16
  57. package/dist/cli/{chunk-RGL2YGJZ.js → chunk-LU4EA3ET.js} +2 -2
  58. package/dist/cli/{chunk-UAQ7ZWRP.js → chunk-MLNH4DK2.js} +22 -22
  59. package/dist/cli/{chunk-YKPMIJJ2.mjs → chunk-NCOTOGTK.mjs} +2 -2
  60. package/dist/cli/{chunk-MMM2WMTF.mjs → chunk-NZM4KWWV.mjs} +5 -5
  61. package/dist/cli/{chunk-C7A44BZ7.js → chunk-OEI7YUEF.js} +3 -3
  62. package/dist/cli/{chunk-LHMHUA5D.js → chunk-OGVUT2KM.js} +7 -7
  63. package/dist/cli/{chunk-OXHY3LD3.js → chunk-OVZSNBDJ.js} +53 -53
  64. package/dist/cli/{chunk-5YR6CDJ2.mjs → chunk-PS2UYVAE.mjs} +6 -6
  65. package/dist/cli/{chunk-66YLAQ2X.js → chunk-R5ZQVQ3K.js} +26 -26
  66. package/dist/cli/{chunk-QKY3H3HA.mjs → chunk-RC5CG5SE.mjs} +4 -4
  67. package/dist/cli/{chunk-SRQQAUXN.js → chunk-RFTBMEWL.js} +2 -2
  68. package/dist/cli/{chunk-P5ZU5ZHA.mjs → chunk-RML3VSTN.mjs} +1 -1
  69. package/dist/cli/{chunk-2L3HVEBM.mjs → chunk-SP2KZ7SH.mjs} +1 -1
  70. package/dist/cli/{chunk-QKKT5G4K.mjs → chunk-T4QPRL3P.mjs} +3 -3
  71. package/dist/cli/{chunk-GIRMVMXP.mjs → chunk-ULUI2FEM.mjs} +1 -1
  72. package/dist/cli/{chunk-3PQDEBO6.js → chunk-WXHBD6H7.js} +1 -1
  73. package/dist/cli/{chunk-OLSATEDQ.js → chunk-XD2DRBPH.js} +6 -6
  74. package/dist/cli/{chunk-77VNC2KF.mjs → chunk-Z25KC5V2.mjs} +1 -1
  75. package/dist/cli/{chunk-E4TEZE62.mjs → chunk-Z44S7VWO.mjs} +2 -2
  76. package/dist/cli/{chunk-2A6IRSE6.js → chunk-ZFD5FJCZ.js} +5 -5
  77. package/dist/cli/{csv-FEFNXZF7.mjs → csv-K7TRWOFJ.mjs} +4 -4
  78. package/dist/cli/{csv-IRP6VT7Q.js → csv-OTRVTHD2.js} +13 -13
  79. package/dist/cli/{db-IHECMWZ3.mjs → db-C7GQU3TZ.mjs} +6 -6
  80. package/dist/cli/{db-Y5VNPNRD.js → db-UO2ZFLFN.js} +27 -27
  81. package/dist/cli/describe-IK4UYJ5M.js +50 -0
  82. package/dist/cli/{describe-XCVC2WLL.mjs → describe-LG4CPTIV.mjs} +18 -18
  83. package/dist/cli/{executions-QH3KJ6MA.js → executions-LHFVPO7E.js} +8 -8
  84. package/dist/cli/{executions-3FWZYUJV.mjs → executions-P3INNVZE.mjs} +6 -6
  85. package/dist/cli/{feedback-F3OZXOPM.mjs → feedback-H22FWG63.mjs} +6 -6
  86. package/dist/cli/{feedback-BGHWMOLH.js → feedback-M3HZQAWX.js} +14 -14
  87. package/dist/cli/git-72ADWRUQ.js +25 -0
  88. package/dist/cli/{git-RWPH3D75.mjs → git-G2N7PVFI.mjs} +5 -5
  89. package/dist/cli/index.js +141 -141
  90. package/dist/cli/index.mjs +43 -43
  91. package/dist/cli/{legacy-noops-G6CYD5LM.js → legacy-noops-2RVROWBY.js} +9 -9
  92. package/dist/cli/{legacy-noops-5ADSTBJ5.mjs → legacy-noops-LDYSWTL2.mjs} +6 -6
  93. package/dist/cli/{monitors-AFNAU3A2.mjs → monitors-IYT3VON7.mjs} +7 -7
  94. package/dist/cli/{monitors-VZCBZO26.js → monitors-U4RE6KN5.js} +100 -100
  95. package/dist/cli/{org-JVLYTU24.mjs → org-R3JE22GS.mjs} +6 -6
  96. package/dist/cli/{org-X4QRYBC4.js → org-SO52ZGRP.js} +86 -86
  97. package/dist/cli/{pages-VELKZKBL.mjs → pages-5RLT5YTF.mjs} +6 -6
  98. package/dist/cli/{pages-YMM4KBW5.js → pages-SWXJQJXH.js} +18 -18
  99. package/dist/cli/{play-MIY6BYRB.mjs → play-2ELYCSXZ.mjs} +18 -18
  100. package/dist/cli/{play-J7DEBHI7.js → play-J4UXOQOJ.js} +317 -317
  101. package/dist/cli/{providers-2H3W3W7G.mjs → providers-IXITXHTS.mjs} +6 -6
  102. package/dist/cli/{providers-TOUB7Y2A.js → providers-VVUDGV2D.js} +9 -9
  103. package/dist/cli/{quickstart-GKAS5265.mjs → quickstart-HQCGDPPL.mjs} +4 -4
  104. package/dist/cli/{quickstart-LHY2LN3P.js → quickstart-XPH6MT47.js} +6 -6
  105. package/dist/cli/{run-KYGNOWYD.mjs → run-H2HQPWC4.mjs} +23 -23
  106. package/dist/cli/{run-QCAVDPE5.js → run-OR646AC6.js} +41 -41
  107. package/dist/cli/search-D27DZH2D.js +33 -0
  108. package/dist/cli/{search-YPGAIFDX.mjs → search-MBPI5SBW.mjs} +8 -8
  109. package/dist/cli/{search-output-OOC3VK4T.mjs → search-output-CYOMJNRV.mjs} +4 -4
  110. package/dist/cli/{search-output-ASELNQ2U.js → search-output-YGNSHBXX.js} +6 -6
  111. package/dist/cli/{secrets-KX3TQB4R.js → secrets-HVZKNNLZ.js} +15 -15
  112. package/dist/cli/{secrets-VJ4XYSMZ.mjs → secrets-NK2CN7WI.mjs} +6 -6
  113. package/dist/cli/sessions-MTISSOZ4.js +22 -0
  114. package/dist/cli/{sessions-KUN7H7E5.mjs → sessions-NY4G427U.mjs} +6 -6
  115. package/dist/cli/{settings-5NIF4BU7.js → settings-PVJRDEN2.js} +86 -86
  116. package/dist/cli/{settings-JKFYZ2IT.mjs → settings-RC4FGYY2.mjs} +13 -13
  117. package/dist/cli/{setup-MYV3IHPS.js → setup-B7QB4YV2.js} +50 -50
  118. package/dist/cli/{setup-5AX3TN6G.mjs → setup-YT3XSY6X.mjs} +10 -10
  119. package/dist/cli/{skills-JLS4CINQ.mjs → skills-5ILFNAHR.mjs} +8 -8
  120. package/dist/cli/skills-BHF35NLX.js +37 -0
  121. package/dist/cli/{tools-VBYKD3MJ.mjs → tools-7PAY32OZ.mjs} +17 -17
  122. package/dist/cli/tools-W5BZ37L6.js +57 -0
  123. package/dist/cli/update-M65CGK42.js +35 -0
  124. package/dist/cli/{update-QWAIVJRI.mjs → update-Z27QYB6O.mjs} +10 -10
  125. package/dist/cli/{views-TBWGZAVZ.mjs → views-2IANF6KR.mjs} +6 -6
  126. package/dist/cli/{views-ZW56JZB5.js → views-NP2SCMOV.js} +18 -18
  127. package/dist/cli/{workflow-EKSZST6M.js → workflow-2GNQL646.js} +17 -17
  128. package/dist/cli/{workflow-X7UQPJMQ.mjs → workflow-CAMEZLLY.mjs} +7 -7
  129. package/dist/index.js +9 -9
  130. package/dist/index.mjs +6 -6
  131. package/dist/install-integrity.json +105 -104
  132. package/dist/release.d.mts +1 -1
  133. package/dist/release.d.ts +1 -1
  134. package/dist/release.js +2 -2
  135. package/dist/release.mjs +1 -1
  136. package/dist/server.js +5 -5
  137. package/dist/server.mjs +3 -3
  138. package/package.json +1 -1
  139. package/dist/cli/auth-C7BBYIQD.js +0 -43
  140. package/dist/cli/describe-MNJVJHRE.js +0 -50
  141. package/dist/cli/git-MDOHEW5J.js +0 -25
  142. package/dist/cli/search-G67CEHR7.js +0 -33
  143. package/dist/cli/sessions-QILPX4XQ.js +0 -22
  144. package/dist/cli/skills-NG32XTZI.js +0 -37
  145. package/dist/cli/tools-OZG3V77R.js +0 -57
  146. package/dist/cli/update-YL5WVSKU.js +0 -35
@@ -9533,6 +9533,13 @@ export type PostgresSchedulerRecoveryDeferral = {
9533
9533
  exhausted: boolean;
9534
9534
  deferCount: number | null;
9535
9535
  deadlineAtMs: number | null;
9536
+ /** The pacing request was honoured: uncounted, after its own delay. */
9537
+ paced?: true;
9538
+ /**
9539
+ * Paced only: the delay the run was requeued with, the requested pacing
9540
+ * delay or the backoff floor for how long the run has been paced, if longer.
9541
+ */
9542
+ pacingDelayMs?: number;
9536
9543
  };
9537
9544
 
9538
9545
  /**
@@ -9959,7 +9966,8 @@ export async function resumePostgresSchedulerRun(
9959
9966
  absurd_task_id = task_spawn.task_id,
9960
9967
  recovery_json = coalesce(runs.recovery_json, '{}'::jsonb) - ARRAY[
9961
9968
  'postCode', 'version', 'kind', 'dependency', 'reason', 'deferCount',
9962
- 'deadlineAtMs', 'nextRetryAtMs', 'updatedAtMs', 'exhaustedAtMs'
9969
+ 'deadlineAtMs', 'nextRetryAtMs', 'updatedAtMs', 'exhaustedAtMs',
9970
+ 'pacedSinceMs'
9963
9971
  ]::text[],
9964
9972
  launch_json = runs.launch_json || jsonb_build_object(
9965
9973
  'resumeEpoch', task_spawn.epoch,
@@ -10367,9 +10375,40 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10367
10375
  /** Must match the scheduler's actual DeferTask policy for observability. */
10368
10376
  deferBaseMs?: number;
10369
10377
  deferMaxMs?: number;
10378
+ /**
10379
+ * Compiled start pacing: requeue after exactly this delay. The defer count
10380
+ * is left as it is and the horizon is not started (an existing deadline is
10381
+ * kept), so contention for a bucket that keeps granting can never exhaust
10382
+ * the outage budget.
10383
+ */
10384
+ pacingDelayMs?: number;
10385
+ /**
10386
+ * Required with pacingDelayMs. The first paced defer records
10387
+ * `pacedSinceMs`; once this long has passed since it, the defer is counted
10388
+ * on the outage ladder instead, so pacing alone cannot hold a run forever.
10389
+ */
10390
+ pacingHorizonMs?: number;
10391
+ /**
10392
+ * Required with pacingDelayMs. A run paced for T since `pacedSinceMs` is
10393
+ * requeued after at least min(T / pacingBackoffDivisor,
10394
+ * pacingBackoffMaxMs), so a run that keeps losing the bucket backs off
10395
+ * instead of retrying every few seconds for the whole horizon.
10396
+ */
10397
+ pacingBackoffDivisor?: number;
10398
+ pacingBackoffMaxMs?: number;
10370
10399
  },
10371
10400
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
10372
10401
  ): Promise<PostgresSchedulerRecoveryDeferral> {
10402
+ if (
10403
+ input.pacingDelayMs !== undefined &&
10404
+ (input.pacingHorizonMs === undefined ||
10405
+ input.pacingBackoffDivisor === undefined ||
10406
+ input.pacingBackoffMaxMs === undefined)
10407
+ ) {
10408
+ throw new Error(
10409
+ `Paced pre-code defer for ${input.runId}/${input.attempt} needs a pacing horizon and backoff.`,
10410
+ );
10411
+ }
10373
10412
  const initialDeadlineAtMs = input.nowMs + input.horizonMs;
10374
10413
  const noCodeWorkCounterDigest = createHash('sha256')
10375
10414
  .update(`${input.runId}\u0000${input.attempt}\u0000pre-code`)
@@ -10401,6 +10440,8 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10401
10440
  work_counters_recorded: boolean;
10402
10441
  defer_count: string | null;
10403
10442
  deadline_at_ms: string | null;
10443
+ paced: boolean | null;
10444
+ paced_delay_ms: string | null;
10404
10445
  }>(
10405
10446
  `
10406
10447
  WITH ${runtimeSandboxCustodyLocksSql('run.run_id = $1', options)}, candidate AS (
@@ -10415,13 +10456,38 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10415
10456
  AND attempts.lease_token = $3
10416
10457
  AND attempts.status IN ('claimed', 'running', 'waiting')
10417
10458
  AND runs.status IN ('queued', 'running', 'waiting')
10459
+ ), pacing AS (
10460
+ -- A pacing request is honoured only within the pacing horizon of the
10461
+ -- run's first paced defer; past it, this defer is counted below.
10462
+ SELECT run_id,
10463
+ recovery_json,
10464
+ CASE WHEN $16::bigint IS NULL
10465
+ THEN (recovery_json ->> 'pacedSinceMs')::bigint
10466
+ ELSE coalesce((recovery_json ->> 'pacedSinceMs')::bigint, $7::bigint)
10467
+ END AS paced_since_ms,
10468
+ $16::bigint IS NOT NULL
10469
+ AND $7::bigint < coalesce(
10470
+ (recovery_json ->> 'pacedSinceMs')::bigint,
10471
+ $7::bigint
10472
+ ) + $17::bigint AS paced
10473
+ FROM candidate
10418
10474
  ), computed AS (
10419
10475
  SELECT run_id,
10420
- coalesce((recovery_json ->> 'deferCount')::integer, 0) + 1
10476
+ paced,
10477
+ paced_since_ms,
10478
+ coalesce((recovery_json ->> 'deferCount')::integer, 0)
10479
+ + CASE WHEN paced THEN 0 ELSE 1 END
10421
10480
  AS defer_count,
10422
- coalesce((recovery_json ->> 'deadlineAtMs')::bigint, $4::bigint)
10423
- AS deadline_at_ms
10424
- FROM candidate
10481
+ coalesce(
10482
+ (recovery_json ->> 'deadlineAtMs')::bigint,
10483
+ CASE WHEN NOT paced THEN $4::bigint END
10484
+ ) AS deadline_at_ms,
10485
+ -- A run paced for T waits at least min(T / divisor, max).
10486
+ CASE WHEN paced THEN greatest(
10487
+ $16::bigint,
10488
+ least($19::bigint, ($7::bigint - paced_since_ms) / $18::bigint)
10489
+ ) END AS paced_delay_ms
10490
+ FROM pacing
10425
10491
  ), open_circuit AS (
10426
10492
  INSERT INTO ${tableName(POSTGRES_SCHEDULER_DEPENDENCY_CIRCUITS_TABLE, options)} AS circuit (
10427
10493
  dependency, state, open_until_ms, probe_until_ms, probe_token, last_reason, updated_at
@@ -10452,7 +10518,7 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10452
10518
  AND attempts.attempt = $2
10453
10519
  AND attempts.lease_token = $3
10454
10520
  AND computed.defer_count <= $6
10455
- AND $7::bigint < computed.deadline_at_ms
10521
+ AND (computed.paced OR $7::bigint < computed.deadline_at_ms)
10456
10522
  RETURNING attempts.run_id
10457
10523
  ), requeued_run AS (
10458
10524
  UPDATE ${tableName('runs', options)} AS runs
@@ -10467,14 +10533,22 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10467
10533
  'dependency', $8::text,
10468
10534
  'reason', $9::text,
10469
10535
  'deferCount', computed.defer_count,
10470
- 'deadlineAtMs', computed.deadline_at_ms,
10471
10536
  'nextRetryAtMs',
10472
- $7::bigint + least(
10473
- $13::numeric,
10474
- $12::numeric * power(2::numeric, computed.defer_count - 1)
10475
- )::bigint,
10537
+ $7::bigint + CASE WHEN computed.paced THEN computed.paced_delay_ms ELSE
10538
+ least(
10539
+ $13::numeric,
10540
+ $12::numeric * power(2::numeric, computed.defer_count - 1)
10541
+ )::bigint
10542
+ END,
10476
10543
  'updatedAtMs', $7::bigint
10477
- ),
10544
+ ) || CASE
10545
+ -- A paced first defer has no horizon to record.
10546
+ WHEN computed.deadline_at_ms IS NULL THEN '{}'::jsonb
10547
+ ELSE jsonb_build_object('deadlineAtMs', computed.deadline_at_ms)
10548
+ END || CASE
10549
+ WHEN computed.paced_since_ms IS NULL THEN '{}'::jsonb
10550
+ ELSE jsonb_build_object('pacedSinceMs', computed.paced_since_ms)
10551
+ END,
10478
10552
  updated_at = now()
10479
10553
  FROM computed
10480
10554
  JOIN deferred_attempt ON deferred_attempt.run_id = computed.run_id
@@ -10530,7 +10604,9 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10530
10604
  ) AS work_counters_recorded,
10531
10605
  EXISTS (SELECT 1 FROM open_circuit) AS circuit_opened,
10532
10606
  (SELECT defer_count::text FROM computed LIMIT 1) AS defer_count,
10533
- (SELECT deadline_at_ms::text FROM computed LIMIT 1) AS deadline_at_ms
10607
+ (SELECT deadline_at_ms::text FROM computed LIMIT 1) AS deadline_at_ms,
10608
+ (SELECT paced FROM computed LIMIT 1) AS paced,
10609
+ (SELECT paced_delay_ms::text FROM computed LIMIT 1) AS paced_delay_ms
10534
10610
  `,
10535
10611
  [
10536
10612
  input.runId,
@@ -10552,6 +10628,10 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10552
10628
  input.deferMaxMs ?? 300_000,
10553
10629
  noCodeWorkCounterEventId,
10554
10630
  stableStringify({ events: [noCodeWorkCounterEvent] }),
10631
+ input.pacingDelayMs ?? null,
10632
+ input.pacingHorizonMs ?? null,
10633
+ input.pacingBackoffDivisor ?? null,
10634
+ input.pacingBackoffMaxMs ?? null,
10555
10635
  ],
10556
10636
  );
10557
10637
  const row = result.rows[0];
@@ -10570,11 +10650,23 @@ export async function deferPostgresSchedulerAttemptForRecovery(
10570
10650
  }
10571
10651
  const deferCount = row.defer_count ? Number(row.defer_count) : null;
10572
10652
  const deadlineAtMs = row.deadline_at_ms ? Number(row.deadline_at_ms) : null;
10653
+ const pacingDelayMs =
10654
+ row.paced === true && row.paced_delay_ms !== null
10655
+ ? Number(row.paced_delay_ms)
10656
+ : null;
10657
+ if (row.paced === true && !Number.isSafeInteger(pacingDelayMs)) {
10658
+ throw new Error(
10659
+ `Paced pre-code defer for ${input.runId}/${input.attempt} returned no requeue delay.`,
10660
+ );
10661
+ }
10573
10662
  return {
10574
10663
  deferred: row.deferred,
10575
10664
  exhausted: !row.deferred,
10576
10665
  deferCount: Number.isSafeInteger(deferCount) ? deferCount : null,
10577
10666
  deadlineAtMs: Number.isSafeInteger(deadlineAtMs) ? deadlineAtMs : null,
10667
+ ...(row.paced === true
10668
+ ? { paced: true as const, pacingDelayMs: pacingDelayMs as number }
10669
+ : {}),
10578
10670
  };
10579
10671
  }
10580
10672
 
@@ -19,6 +19,13 @@ export function resolveToolCallResultReceiptPolicy(input: {
19
19
  force: boolean;
20
20
  /** Historical local contexts may have no durable result store. */
21
21
  canStoreResult?: boolean;
22
+ /**
23
+ * The logical call's occurrence index was reserved with its operation slot
24
+ * (#10027), so the forced result receipt is keyed in its own namespace.
25
+ * A receipt in the older namespace was numbered in tool-layer entry order,
26
+ * proves no occurrence, and is never reused for such a call.
27
+ */
28
+ occurrenceBound?: boolean;
22
29
  }): { resultReceiptKey: string; force: boolean } {
23
30
  if (!input.resultReceiptKey.trim()) {
24
31
  throw new Error('Tool Call result policy requires a result receipt key.');
@@ -39,7 +46,9 @@ export function resolveToolCallResultReceiptPolicy(input: {
39
46
  orgId: input.orgId,
40
47
  toolId: input.toolId,
41
48
  receiptKey: input.resultReceiptKey,
42
- invocationIdentity: `forced-result:${input.runId}:${input.logicalCallId}`,
49
+ invocationIdentity: input.occurrenceBound
50
+ ? `forced-result:reserved-v1:${input.runId}:${input.logicalCallId}`
51
+ : `forced-result:${input.runId}:${input.logicalCallId}`,
43
52
  }),
44
53
  force: false,
45
54
  };
@@ -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 _chunkOVZSNBDJjs = require('./chunk-OVZSNBDJ.js');
18
+ require('./chunk-7WZXUAQW.js');
19
+ require('./chunk-IJAEYEJM.js');
20
+ require('./chunk-FXYWEKUK.js');
21
+ require('./chunk-T2N3B7IQ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-SQWET4SL.js');
24
+ require('./chunk-WXHBD6H7.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 = _chunkOVZSNBDJjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkOVZSNBDJjs.authStatusLine; exports.clearPendingClaim = _chunkOVZSNBDJjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkOVZSNBDJjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkOVZSNBDJjs.handleRegister; exports.handleStatus = _chunkOVZSNBDJjs.handleStatus; exports.handleWait = _chunkOVZSNBDJjs.handleWait; exports.httpJson = _chunkOVZSNBDJjs.httpJson; exports.readPendingAuthClaim = _chunkOVZSNBDJjs.readPendingAuthClaim; exports.readStatusBanner = _chunkOVZSNBDJjs.readStatusBanner; exports.registerAuthCommands = _chunkOVZSNBDJjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkOVZSNBDJjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkOVZSNBDJjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkOVZSNBDJjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkOVZSNBDJjs.statusBannerLine;
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-QKKT5G4K.mjs";
18
- import "./chunk-JSVHBJE2.mjs";
19
- import "./chunk-77VNC2KF.mjs";
20
- import "./chunk-P5ZU5ZHA.mjs";
17
+ } from "./chunk-T4QPRL3P.mjs";
18
+ import "./chunk-GP7E4TE4.mjs";
19
+ import "./chunk-Z25KC5V2.mjs";
20
+ import "./chunk-RML3VSTN.mjs";
21
21
  import "./chunk-QNHHZ63P.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-ZPGGW27Q.mjs";
24
- import "./chunk-RMCKTV4R.mjs";
24
+ import "./chunk-HJVNCRXY.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {