deepline 0.3.464 → 0.3.465

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 (117) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +130 -57
  3. package/dist/cli/auth-W62UTNJZ.js +41 -0
  4. package/dist/cli/{auth-GMSI6QWR.mjs → auth-WZCX4MTH.mjs} +5 -5
  5. package/dist/cli/{billing-6G2RFLM7.mjs → billing-ATR3CLIW.mjs} +6 -6
  6. package/dist/cli/{billing-MGH36CNP.js → billing-DQUD3DBY.js} +77 -77
  7. package/dist/cli/{chunk-VYDOPASG.mjs → chunk-3K3EHT6E.mjs} +1 -1
  8. package/dist/cli/{chunk-WLIFUH6W.js → chunk-3XFNF6RR.js} +8 -8
  9. package/dist/cli/{chunk-4XNXFHG6.js → chunk-4URRABMM.js} +1 -1
  10. package/dist/cli/{chunk-GVJVBBGV.js → chunk-5VGMRONE.js} +3 -3
  11. package/dist/cli/{chunk-ACZLDP7L.js → chunk-6WKYRHGT.js} +3 -3
  12. package/dist/cli/{chunk-UM363DQF.mjs → chunk-6Y34LU6P.mjs} +2 -2
  13. package/dist/cli/{chunk-2RFTOESC.js → chunk-7R76B3WE.js} +5 -5
  14. package/dist/cli/{chunk-PPQL5F4P.mjs → chunk-7Y2MLWTM.mjs} +1 -1
  15. package/dist/cli/{chunk-UOAHDEAI.js → chunk-A3GML7WW.js} +9 -9
  16. package/dist/cli/{chunk-6KDOO7IM.mjs → chunk-B6GAIXVD.mjs} +4 -4
  17. package/dist/cli/{chunk-ZQERHPZA.js → chunk-BQNUJK53.js} +26 -26
  18. package/dist/cli/{chunk-K3BARC72.js → chunk-DDF74332.js} +2 -2
  19. package/dist/cli/{chunk-VZX4P5FT.js → chunk-DJD4KLIX.js} +93 -93
  20. package/dist/cli/{chunk-OA7IIOLW.mjs → chunk-E3EYQ2FQ.mjs} +4 -4
  21. package/dist/cli/{chunk-EQNJUG3N.js → chunk-E3PLLFE2.js} +53 -53
  22. package/dist/cli/{chunk-O4AOYLZE.mjs → chunk-EA2F4YVX.mjs} +2 -2
  23. package/dist/cli/{chunk-J327QVQV.mjs → chunk-EISIAWBD.mjs} +1 -1
  24. package/dist/cli/{chunk-HGUHBLX5.mjs → chunk-EVQBOVOJ.mjs} +3 -3
  25. package/dist/cli/{chunk-3MKRAI6R.mjs → chunk-FFTLJGZQ.mjs} +5 -5
  26. package/dist/cli/{chunk-O4ZMADW4.js → chunk-GBQSEOXE.js} +7 -7
  27. package/dist/cli/{chunk-44BEFU62.mjs → chunk-GNLCGR7R.mjs} +2 -2
  28. package/dist/cli/{chunk-VQHEMZ33.mjs → chunk-GW7RUNLW.mjs} +1 -1
  29. package/dist/cli/{chunk-XMDBN2K7.mjs → chunk-HS6CM7TF.mjs} +10 -10
  30. package/dist/cli/{chunk-CUZVOPPY.mjs → chunk-HXWZ52CW.mjs} +3 -3
  31. package/dist/cli/{chunk-K4DVRQTY.js → chunk-JN7AOVD4.js} +16 -16
  32. package/dist/cli/{chunk-RFOQRCMW.mjs → chunk-JQSPKPHT.mjs} +4 -4
  33. package/dist/cli/{chunk-X3XJ6ZSJ.js → chunk-LFTLH5BK.js} +2 -2
  34. package/dist/cli/{chunk-MQNBOSQP.mjs → chunk-N27BUJU3.mjs} +5 -5
  35. package/dist/cli/{chunk-3AIMFE3Z.js → chunk-N57JYG7J.js} +36 -36
  36. package/dist/cli/{chunk-6E2KNNTD.mjs → chunk-NIJYJI67.mjs} +2 -2
  37. package/dist/cli/{chunk-DO3FSI4C.mjs → chunk-OEU3ZNBZ.mjs} +1 -1
  38. package/dist/cli/{chunk-FVAB2JRO.js → chunk-OKI3HWFF.js} +8 -8
  39. package/dist/cli/{chunk-TU3M7UXJ.js → chunk-OQDN6JK6.js} +10 -10
  40. package/dist/cli/{chunk-FEWZT4RV.js → chunk-PIGMBDBZ.js} +21 -21
  41. package/dist/cli/{chunk-ZIMCLWEW.js → chunk-QPJ2BDFD.js} +5 -5
  42. package/dist/cli/{chunk-BMUDQMYE.js → chunk-RREWUPC3.js} +6 -6
  43. package/dist/cli/{chunk-TMVBBGSK.mjs → chunk-SBM5JVTK.mjs} +1 -1
  44. package/dist/cli/{chunk-E4QJKJH6.js → chunk-SOIXDMZK.js} +51 -51
  45. package/dist/cli/{chunk-6A7OH2PV.mjs → chunk-SSQXSMAT.mjs} +2 -2
  46. package/dist/cli/{chunk-5XIGEYYK.js → chunk-TJXGEK7P.js} +6 -6
  47. package/dist/cli/{chunk-M4QVY6RW.mjs → chunk-UMQT7QMB.mjs} +2 -2
  48. package/dist/cli/{chunk-ZAB6KCZW.js → chunk-W4J2EK5K.js} +3 -3
  49. package/dist/cli/{chunk-6COF5LIE.mjs → chunk-X6BQ4JAD.mjs} +2 -2
  50. package/dist/cli/{chunk-5CKIO7KA.mjs → chunk-XFAO5A5R.mjs} +1 -1
  51. package/dist/cli/{chunk-NI3QFUK7.js → chunk-XJ5W64AC.js} +4 -4
  52. package/dist/cli/{chunk-MP3O4ISC.mjs → chunk-YZZGFUQ4.mjs} +1 -1
  53. package/dist/cli/{csv-4ZVMBOCK.mjs → csv-AE7OLXCV.mjs} +4 -4
  54. package/dist/cli/{csv-W2JPV57R.js → csv-ZVFGYRB7.js} +13 -13
  55. package/dist/cli/{db-6YNFDHEW.js → db-JOD2MQ2T.js} +27 -27
  56. package/dist/cli/{db-TVK6BLRB.mjs → db-KTXMCLB5.mjs} +6 -6
  57. package/dist/cli/describe-2IKB4KIX.js +48 -0
  58. package/dist/cli/{describe-JFN4ECPO.mjs → describe-FENTKQFK.mjs} +17 -17
  59. package/dist/cli/{executions-2FK4FFKE.mjs → executions-FJCV5L37.mjs} +6 -6
  60. package/dist/cli/{executions-J4CAN7RB.js → executions-IT6TQ65Q.js} +8 -8
  61. package/dist/cli/{feedback-EYRRLA2P.mjs → feedback-LTTO73YD.mjs} +4 -4
  62. package/dist/cli/{feedback-NOO4OM4U.js → feedback-WGURC3BG.js} +8 -8
  63. package/dist/cli/git-UOIC2DJL.js +25 -0
  64. package/dist/cli/{git-D3Q4JKBC.mjs → git-ZYEDB2UG.mjs} +5 -5
  65. package/dist/cli/index.js +135 -135
  66. package/dist/cli/index.mjs +40 -40
  67. package/dist/cli/{legacy-noops-SUFJWBLZ.mjs → legacy-noops-EGQ4G4BT.mjs} +5 -5
  68. package/dist/cli/{legacy-noops-5ZGRKSN3.js → legacy-noops-JFXWEOZF.js} +8 -8
  69. package/dist/cli/{monitors-IRDIIR6J.mjs → monitors-IK6GWLCA.mjs} +7 -7
  70. package/dist/cli/{monitors-3QFJZA6Z.js → monitors-WKN2K6ZH.js} +91 -91
  71. package/dist/cli/{org-275OJJ7W.js → org-FE5VMAKF.js} +68 -68
  72. package/dist/cli/{org-2VA2FSMG.mjs → org-PD5YBUHR.mjs} +6 -6
  73. package/dist/cli/{pages-SPRBOZRA.js → pages-H3DKEVVI.js} +17 -17
  74. package/dist/cli/{pages-WCUEBFYU.mjs → pages-ZVKSOSZJ.mjs} +6 -6
  75. package/dist/cli/{play-NMHUWBET.js → play-2UL5OPGH.js} +304 -304
  76. package/dist/cli/{play-7UL5H6QU.mjs → play-RLIQY22H.mjs} +17 -17
  77. package/dist/cli/{providers-72LUJEAT.js → providers-2IMHQDBC.js} +9 -9
  78. package/dist/cli/{providers-WSCKV557.mjs → providers-M4AFFJF2.mjs} +6 -6
  79. package/dist/cli/{quickstart-XSUUAE2Y.js → quickstart-OE64DBKK.js} +6 -6
  80. package/dist/cli/{quickstart-K4LAKJKJ.mjs → quickstart-PS4QKNG2.mjs} +4 -4
  81. package/dist/cli/{run-R2MOXXHH.mjs → run-3TKR5CZU.mjs} +22 -22
  82. package/dist/cli/{run-MLV2CLW7.js → run-SWLGV2VS.js} +36 -36
  83. package/dist/cli/{search-WHJZNWKE.mjs → search-AMZ67RKO.mjs} +7 -7
  84. package/dist/cli/search-LXG7T6YZ.js +32 -0
  85. package/dist/cli/{secrets-YGVOFLI5.mjs → secrets-INBXKNFM.mjs} +6 -6
  86. package/dist/cli/{secrets-7PXFBOFY.js → secrets-ZTLJY7L2.js} +15 -15
  87. package/dist/cli/{sessions-ASXXZI42.js → sessions-3GKS45NP.js} +6 -6
  88. package/dist/cli/{sessions-G7I54W4L.mjs → sessions-ZVBTKQ7J.mjs} +5 -5
  89. package/dist/cli/{settings-RTEBMDPC.js → settings-7YG3UWJH.js} +78 -78
  90. package/dist/cli/{settings-4GFO6JYO.mjs → settings-AUPDZZ2U.mjs} +11 -11
  91. package/dist/cli/{setup-4RJGKSDC.mjs → setup-44QB72NU.mjs} +9 -9
  92. package/dist/cli/{setup-A6V2MJK7.js → setup-YGESCFTH.js} +44 -44
  93. package/dist/cli/{skills-432W6EGS.mjs → skills-N3AWWCWO.mjs} +7 -7
  94. package/dist/cli/skills-QALGBUFY.js +31 -0
  95. package/dist/cli/{tools-SABREK3C.mjs → tools-3SHNTJPU.mjs} +16 -16
  96. package/dist/cli/tools-PUQ3JBZ7.js +55 -0
  97. package/dist/cli/{update-F7NO5RDW.mjs → update-3TWB5EEV.mjs} +9 -9
  98. package/dist/cli/update-O7XSJMLX.js +33 -0
  99. package/dist/cli/{workflow-F4N7CFUX.mjs → workflow-SYP62XNN.mjs} +7 -7
  100. package/dist/cli/{workflow-TF6YDWTM.js → workflow-ULIZU7KI.js} +17 -17
  101. package/dist/index.js +9 -9
  102. package/dist/index.mjs +6 -6
  103. package/dist/install-integrity.json +96 -96
  104. package/dist/release.d.mts +1 -1
  105. package/dist/release.d.ts +1 -1
  106. package/dist/release.js +2 -2
  107. package/dist/release.mjs +1 -1
  108. package/dist/server.js +5 -5
  109. package/dist/server.mjs +3 -3
  110. package/package.json +1 -1
  111. package/dist/cli/auth-P4E7M3AV.js +0 -41
  112. package/dist/cli/describe-APW5TWBT.js +0 -48
  113. package/dist/cli/git-FPF6DT43.js +0 -25
  114. package/dist/cli/search-AYFUV6YV.js +0 -32
  115. package/dist/cli/skills-GOQECD7H.js +0 -31
  116. package/dist/cli/tools-JXYN7WOE.js +0 -55
  117. package/dist/cli/update-BSB4TJER.js +0 -33
@@ -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.464',
208
+ version: '0.3.465',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -705,13 +705,12 @@ const TOOL_RETRY_AFTER_FALLBACK_MS = 1_000;
705
705
  // broken gateway-to-runner connection, not slow provider work.
706
706
  export const TOOL_EXECUTE_RESPONSE_BODY_TIMEOUT_MS = 30_000;
707
707
  const TOOL_RETRY_HEARTBEAT_INTERVAL_MS = 30_000;
708
- // Avoid paying sandbox startup and checkpoint replay for ordinary provider
709
- // holds. Bound cumulative residency so sustained holds still park durably.
710
- const TOOL_PROVIDER_RESIDENT_WAIT_BUDGET_MS = 10 * 60_000;
708
+ // Provider pacing and authored sleeps share one live-sandbox wait policy.
709
+ // Bound provider retry residency; longer waits and execution drains still park.
710
+ const SANDBOX_RESIDENT_WAIT_BUDGET_MS = 10 * 60_000;
711
711
  // The call already waited its whole admission budget in this sandbox, so it
712
712
  // rejoins the shared lane promptly instead of adding a fixed delay of its own.
713
713
  const PROVIDER_ADMISSION_REQUEUE_DELAY_MS = 1_000;
714
- const AUTHORED_SLEEP_RESIDENT_LIMIT_MS = 10_000;
715
714
  const DEEPLINEAGENT_TOOL_RUNTIME_TIMEOUT_MS = 15 * 60 * 1000;
716
715
  // Every runtime-API tool fetch needs a client-side deadline. Without one, a
717
716
  // stalled execute request (e.g. a credential-less call whose gateway connection
@@ -2910,6 +2909,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
2910
2909
  * broad catch cannot turn the invocation into a normal completed result.
2911
2910
  */
2912
2911
  private pendingDurableSuspension: PlayExecutionSuspension | null = null;
2912
+ private readonly durableSuspensionController = new AbortController();
2913
+ private readonly activeAuthoredSleepIntents = new Map<
2914
+ string,
2915
+ Promise<Extract<PlayExecutionSuspension, { kind: 'sleep' }>>
2916
+ >();
2913
2917
  private readonly durableCallCacheEpochMs: number;
2914
2918
  /**
2915
2919
  * Durable tool receipts are the replay/cache authority for the execution
@@ -3276,7 +3280,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
3276
3280
  private suspendDurably(suspension: PlayExecutionSuspension): never {
3277
3281
  this.pendingDurableSuspension ??= suspension;
3278
3282
  this.#options.onBatchComplete?.(this.checkpoint);
3279
- throw new PlayExecutionSuspendedError(this.pendingDurableSuspension);
3283
+ const error = new PlayExecutionSuspendedError(
3284
+ this.pendingDurableSuspension,
3285
+ );
3286
+ this.durableSuspensionController.abort(error);
3287
+ throw error;
3280
3288
  }
3281
3289
 
3282
3290
  async tool<TOutput = unknown>(
@@ -11949,13 +11957,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
11949
11957
  // rather than resetting it for each successive provider response.
11950
11958
  let providerIdleWaitStartedAt: number | null = null;
11951
11959
  const canWaitForProviderRetry = (retry: ProviderRowRetry) => {
11960
+ if (retry.readyAtMs >= (this.#options.executionDrainAtMs ?? Infinity))
11961
+ return false;
11952
11962
  const elapsedMs =
11953
11963
  providerIdleWaitStartedAt === null
11954
11964
  ? 0
11955
11965
  : performance.now() - providerIdleWaitStartedAt;
11956
11966
  return (
11957
11967
  Math.max(1, retry.readyAtMs - Date.now()) <=
11958
- Math.max(0, TOOL_PROVIDER_RESIDENT_WAIT_BUDGET_MS - elapsedMs)
11968
+ Math.max(0, SANDBOX_RESIDENT_WAIT_BUDGET_MS - elapsedMs)
11959
11969
  );
11960
11970
  };
11961
11971
  const activeRowHistories = new Map<number, Record<string, unknown>>();
@@ -15937,21 +15947,66 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
15937
15947
  existing?.kind === 'sleep'
15938
15948
  ? existing.delayMs
15939
15949
  : Math.max(1_000, Math.ceil(retryAtMs - Date.now()));
15950
+ // Provider holds end at an absolute deadline. Checkpoint persistence,
15951
+ // runner shutdown and scheduler handoff must not restart the whole delay.
15952
+ const wakeAtMs =
15953
+ existing?.kind === 'sleep' && existing.wakeAtMs !== undefined
15954
+ ? existing.wakeAtMs
15955
+ : Date.now() + delayMs;
15940
15956
  this.checkpoint.resolvedBoundaries = {
15941
15957
  ...(this.checkpoint.resolvedBoundaries ?? {}),
15942
- [boundaryId]: { kind: 'sleep', delayMs },
15958
+ [boundaryId]: { ...existing, kind: 'sleep', delayMs, wakeAtMs },
15943
15959
  };
15944
15960
  this.runtimeLog(
15945
15961
  `[runtime.provider.wait] ${JSON.stringify({
15946
15962
  provider,
15947
- retry_at: new Date(Date.now() + delayMs).toISOString(),
15948
- wait_ms: delayMs,
15963
+ retry_at: new Date(wakeAtMs).toISOString(),
15964
+ wait_ms: Math.max(0, wakeAtMs - Date.now()),
15949
15965
  boundary_id: boundaryId,
15950
15966
  })}`,
15951
15967
  { level: 'warn' },
15952
15968
  );
15953
- this.observeProviderCapacityWait(provider, Date.now() + delayMs);
15954
- this.suspendDurably({ kind: 'sleep', boundaryId, delayMs });
15969
+ this.observeProviderCapacityWait(provider, wakeAtMs);
15970
+ await this.suspendForEarliestSleep({
15971
+ kind: 'sleep',
15972
+ boundaryId,
15973
+ delayMs,
15974
+ wakeAtMs,
15975
+ });
15976
+ }
15977
+
15978
+ private async suspendForEarliestSleep(
15979
+ intent: Extract<PlayExecutionSuspension, { kind: 'sleep' }>,
15980
+ ): Promise<never> {
15981
+ const publications = new Set(this.activeAuthoredSleepIntents.values());
15982
+ let published = await Promise.all(publications);
15983
+ for (;;) {
15984
+ this.assertNoPendingDurableSuspension();
15985
+ const added = [...this.activeAuthoredSleepIntents.values()].filter(
15986
+ (publication) => !publications.has(publication),
15987
+ );
15988
+ if (added.length === 0) break;
15989
+ for (const publication of added) publications.add(publication);
15990
+ published = published.concat(await Promise.all(added));
15991
+ }
15992
+ const earliest = published.reduce((selected, candidate) => {
15993
+ const boundary =
15994
+ this.checkpoint.resolvedBoundaries?.[candidate.boundaryId];
15995
+ if (
15996
+ candidate.wakeAtMs === undefined ||
15997
+ (boundary?.kind === 'sleep' && boundary.completedAt !== undefined)
15998
+ )
15999
+ return selected;
16000
+ return selected.wakeAtMs === undefined ||
16001
+ candidate.wakeAtMs < selected.wakeAtMs
16002
+ ? candidate
16003
+ : selected;
16004
+ }, intent);
16005
+ // Legacy sleeps keep relative timing. Absolute sleeps yield at the first
16006
+ // unfinished wake, including authored siblings of a provider hold.
16007
+ return this.suspendDurably(
16008
+ intent.wakeAtMs === undefined ? intent : earliest,
16009
+ );
15955
16010
  }
15956
16011
 
15957
16012
  private sleepMetadataReceiptKey(
@@ -16132,50 +16187,62 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
16132
16187
  if (existing?.kind === 'sleep' && existing.completedAt !== undefined) {
16133
16188
  return;
16134
16189
  }
16135
- const wakeAtMs =
16136
- existing?.kind === 'sleep' && existing.wakeAtMs !== undefined
16137
- ? existing.wakeAtMs
16138
- : this.durableDirectToolResultsBackedByReceipts
16139
- ? await this.resolveCanonicalSleepWakeAtMs(boundaryId, delayMs)
16140
- : undefined;
16141
- this.assertNoPendingDurableSuspension();
16142
- this.checkpoint.resolvedBoundaries = {
16143
- ...(this.checkpoint.resolvedBoundaries ?? {}),
16144
- [boundaryId]: {
16145
- ...existing,
16146
- kind: 'sleep',
16147
- delayMs,
16148
- ...(wakeAtMs !== undefined ? { wakeAtMs } : {}),
16149
- },
16150
- };
16151
- if (
16152
- wakeAtMs !== undefined &&
16153
- !rowStore &&
16154
- this.durableDirectToolResultsBackedByReceipts &&
16155
- (wakeAtMs <= Date.now() ||
16156
- (delayMs <= AUTHORED_SLEEP_RESIDENT_LIMIT_MS &&
16157
- wakeAtMs < (this.#options.executionDrainAtMs ?? Infinity)))
16158
- ) {
16159
- const remainingMs = Math.max(0, wakeAtMs - Date.now());
16160
- if (remainingMs > 0)
16161
- await this.sleepWithCheckpointHeartbeat(remainingMs);
16190
+ // Register publication before awaiting storage so concurrent sleeps all
16191
+ // participate in handoff. A slow publication cannot hide an earlier timer.
16192
+ const publication = (async () => {
16193
+ const wakeAtMs =
16194
+ existing?.kind === 'sleep' && existing.wakeAtMs !== undefined
16195
+ ? existing.wakeAtMs
16196
+ : this.durableDirectToolResultsBackedByReceipts
16197
+ ? await this.resolveCanonicalSleepWakeAtMs(boundaryId, delayMs)
16198
+ : undefined;
16162
16199
  this.assertNoPendingDurableSuspension();
16163
- this.checkpoint.resolvedBoundaries[boundaryId] = {
16164
- ...this.checkpoint.resolvedBoundaries[boundaryId],
16165
- kind: 'sleep',
16200
+ this.checkpoint.resolvedBoundaries = {
16201
+ ...(this.checkpoint.resolvedBoundaries ?? {}),
16202
+ [boundaryId]: {
16203
+ ...existing,
16204
+ kind: 'sleep',
16205
+ delayMs,
16206
+ ...(wakeAtMs !== undefined ? { wakeAtMs } : {}),
16207
+ },
16208
+ };
16209
+ return {
16210
+ kind: 'sleep' as const,
16211
+ boundaryId,
16166
16212
  delayMs,
16167
- wakeAtMs,
16168
- completedAt: Date.now(),
16213
+ ...(wakeAtMs !== undefined ? { wakeAtMs } : {}),
16169
16214
  };
16170
- this.#options.onBatchComplete?.(this.checkpoint);
16171
- return;
16215
+ })();
16216
+ this.activeAuthoredSleepIntents.set(boundaryId, publication);
16217
+ try {
16218
+ const intent = await publication;
16219
+ const wakeAtMs = intent.wakeAtMs;
16220
+ const remainingMs =
16221
+ wakeAtMs === undefined ? null : Math.max(0, wakeAtMs - Date.now());
16222
+ if (
16223
+ remainingMs !== null &&
16224
+ this.durableDirectToolResultsBackedByReceipts &&
16225
+ (remainingMs === 0 ||
16226
+ (remainingMs <= SANDBOX_RESIDENT_WAIT_BUDGET_MS &&
16227
+ wakeAtMs! < (this.#options.executionDrainAtMs ?? Infinity)))
16228
+ ) {
16229
+ if (remainingMs > 0)
16230
+ await this.sleepWithCheckpointHeartbeat(remainingMs);
16231
+ this.assertNoPendingDurableSuspension();
16232
+ this.checkpoint.resolvedBoundaries![boundaryId] = {
16233
+ ...this.checkpoint.resolvedBoundaries![boundaryId],
16234
+ kind: 'sleep',
16235
+ delayMs,
16236
+ wakeAtMs,
16237
+ completedAt: Date.now(),
16238
+ };
16239
+ this.#options.onBatchComplete?.(this.checkpoint);
16240
+ return;
16241
+ }
16242
+ await this.suspendForEarliestSleep(intent);
16243
+ } finally {
16244
+ this.activeAuthoredSleepIntents.delete(boundaryId);
16172
16245
  }
16173
- this.suspendDurably({
16174
- kind: 'sleep',
16175
- boundaryId,
16176
- delayMs,
16177
- ...(wakeAtMs !== undefined ? { wakeAtMs } : {}),
16178
- });
16179
16246
  }
16180
16247
  return new Promise((resolve) => setTimeout(resolve, delayMs));
16181
16248
  }
@@ -19785,6 +19852,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19785
19852
  // work. Repeated zero or expired holds must also yield durably.
19786
19853
  let residentProviderWaitStartedAt: number | null = null;
19787
19854
  const canWaitForProviderInSandbox = (waitMs: number) => {
19855
+ if (
19856
+ Date.now() + Math.max(1, waitMs) >=
19857
+ (this.#options.executionDrainAtMs ?? Infinity)
19858
+ )
19859
+ return false;
19788
19860
  if (
19789
19861
  providerResidentWaitKey &&
19790
19862
  this.exhaustedProviderResidentWaitCalls.has(
@@ -19798,7 +19870,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
19798
19870
  : performance.now() - residentProviderWaitStartedAt;
19799
19871
  return (
19800
19872
  Math.max(1, waitMs) <=
19801
- Math.max(0, TOOL_PROVIDER_RESIDENT_WAIT_BUDGET_MS - elapsedMs)
19873
+ Math.max(0, SANDBOX_RESIDENT_WAIT_BUDGET_MS - elapsedMs)
19802
19874
  );
19803
19875
  };
19804
19876
  const markProviderResidentWaitBudgetExhausted = () => {
@@ -21591,12 +21663,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21591
21663
  const waitMs = Math.max(1, Math.ceil(ms));
21592
21664
  const startedAt = performance.now();
21593
21665
  const executionSignal = this.#options.executionSignal;
21594
- const signal =
21595
- executionSignal && callerSignal
21596
- ? AbortSignal.any([executionSignal, callerSignal])
21597
- : (executionSignal ?? callerSignal);
21666
+ const signal = AbortSignal.any([
21667
+ this.durableSuspensionController.signal,
21668
+ ...(executionSignal ? [executionSignal] : []),
21669
+ ...(callerSignal ? [callerSignal] : []),
21670
+ ]);
21598
21671
 
21599
- signal?.throwIfAborted();
21672
+ signal.throwIfAborted();
21600
21673
  while (performance.now() - startedAt < waitMs) {
21601
21674
  this.#options.onBatchComplete?.(this.checkpoint);
21602
21675
  signal?.throwIfAborted();
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+ var _chunkSOIXDMZKjs = require('./chunk-SOIXDMZK.js');
17
+ require('./chunk-GBQSEOXE.js');
18
+ require('./chunk-5VGMRONE.js');
19
+ require('./chunk-XJ5W64AC.js');
20
+ require('./chunk-ALJJRZNJ.js');
21
+ require('./chunk-XNYIZMNQ.js');
22
+ require('./chunk-DIAWYWT5.js');
23
+ require('./chunk-4URRABMM.js');
24
+ require('./chunk-OG64RBAC.js');
25
+ require('./chunk-COGTRVWW.js');
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkSOIXDMZKjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkSOIXDMZKjs.authStatusLine; exports.clearPendingClaim = _chunkSOIXDMZKjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkSOIXDMZKjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkSOIXDMZKjs.handleRegister; exports.handleStatus = _chunkSOIXDMZKjs.handleStatus; exports.handleWait = _chunkSOIXDMZKjs.handleWait; exports.httpJson = _chunkSOIXDMZKjs.httpJson; exports.readPendingAuthClaim = _chunkSOIXDMZKjs.readPendingAuthClaim; exports.readStatusBanner = _chunkSOIXDMZKjs.readStatusBanner; exports.registerAuthCommands = _chunkSOIXDMZKjs.registerAuthCommands; exports.reportSetupCompleted = _chunkSOIXDMZKjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkSOIXDMZKjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkSOIXDMZKjs.statusBannerLine;
@@ -13,14 +13,14 @@ import {
13
13
  reportSetupCompleted,
14
14
  resolvePendingAuthClaimForResume,
15
15
  statusBannerLine
16
- } from "./chunk-CUZVOPPY.mjs";
17
- import "./chunk-6A7OH2PV.mjs";
18
- import "./chunk-5CKIO7KA.mjs";
19
- import "./chunk-MP3O4ISC.mjs";
16
+ } from "./chunk-HXWZ52CW.mjs";
17
+ import "./chunk-SSQXSMAT.mjs";
18
+ import "./chunk-XFAO5A5R.mjs";
19
+ import "./chunk-YZZGFUQ4.mjs";
20
20
  import "./chunk-4QF2K7TM.mjs";
21
21
  import "./chunk-DLIRSHV6.mjs";
22
22
  import "./chunk-HBL4PM5Q.mjs";
23
- import "./chunk-J327QVQV.mjs";
23
+ import "./chunk-EISIAWBD.mjs";
24
24
  import "./chunk-WZYKRD7T.mjs";
25
25
  import "./chunk-KRD6H754.mjs";
26
26
  export {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DeeplineClient
3
- } from "./chunk-44BEFU62.mjs";
3
+ } from "./chunk-GNLCGR7R.mjs";
4
4
  import {
5
5
  iterateCursorPages,
6
6
  requireBillingIdempotencyKey
7
- } from "./chunk-VQHEMZ33.mjs";
7
+ } from "./chunk-GW7RUNLW.mjs";
8
8
  import "./chunk-L2VKAASU.mjs";
9
9
  import "./chunk-FAG4DFUC.mjs";
10
10
  import "./chunk-S3A4IXBQ.mjs";
@@ -15,9 +15,9 @@ import {
15
15
  openInBrowser,
16
16
  printCommandEnvelope,
17
17
  shouldEmitJson
18
- } from "./chunk-6A7OH2PV.mjs";
19
- import "./chunk-5CKIO7KA.mjs";
20
- import "./chunk-MP3O4ISC.mjs";
18
+ } from "./chunk-SSQXSMAT.mjs";
19
+ import "./chunk-XFAO5A5R.mjs";
20
+ import "./chunk-YZZGFUQ4.mjs";
21
21
  import {
22
22
  AuthError,
23
23
  ConfigError
@@ -26,7 +26,7 @@ import "./chunk-DLIRSHV6.mjs";
26
26
  import {
27
27
  DeeplineError
28
28
  } from "./chunk-HBL4PM5Q.mjs";
29
- import "./chunk-J327QVQV.mjs";
29
+ import "./chunk-EISIAWBD.mjs";
30
30
  import "./chunk-WZYKRD7T.mjs";
31
31
  import "./chunk-KRD6H754.mjs";
32
32