deepline 0.3.474 → 0.3.476

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 (155) hide show
  1. package/dist/bundling-sources/sdk/src/play.ts +2 -2
  2. package/dist/bundling-sources/sdk/src/release.ts +3 -3
  3. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +19 -6
  4. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
  5. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +24 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +21 -4
  7. package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +12 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +47 -21
  9. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +18 -8
  10. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +163 -40
  11. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
  12. package/dist/cli/auth-2ZY57Q7W.js +41 -0
  13. package/dist/cli/{auth-QMANU5PV.mjs → auth-A22724UX.mjs} +5 -5
  14. package/dist/cli/{billing-YJAP4VZN.mjs → billing-IIBEZ6J7.mjs} +6 -6
  15. package/dist/cli/{billing-WZ5POBZX.js → billing-T5Q6OO6M.js} +79 -79
  16. package/dist/cli/{chunk-35SZHTRW.mjs → chunk-2WEPQSA2.mjs} +5 -5
  17. package/dist/cli/{chunk-MXUJVCKV.mjs → chunk-2YHDNHRR.mjs} +4 -4
  18. package/dist/cli/{chunk-V4ILQ2DS.mjs → chunk-3A7TDUZV.mjs} +1 -1
  19. package/dist/cli/{chunk-BB4RZMWA.mjs → chunk-4WMIMSSI.mjs} +5 -5
  20. package/dist/cli/{chunk-ZRWQKTSX.mjs → chunk-4YWYLHED.mjs} +3 -3
  21. package/dist/cli/{chunk-ORQYKA4I.js → chunk-5AEEINTU.js} +4 -4
  22. package/dist/cli/{chunk-3NRZFMX4.js → chunk-5FBCMLJW.js} +6 -6
  23. package/dist/cli/{chunk-XNP7XTBN.js → chunk-5PYSYW63.js} +26 -26
  24. package/dist/cli/{chunk-PGKELBIY.js → chunk-6YZYCKWD.js} +51 -51
  25. package/dist/cli/{chunk-RXITRC37.js → chunk-7HAUVMRF.js} +3 -3
  26. package/dist/cli/{chunk-JCNJQH6X.js → chunk-A6BETJ2A.js} +3 -3
  27. package/dist/cli/{chunk-STLJYWUC.js → chunk-AS3VECCY.js} +7 -7
  28. package/dist/cli/{chunk-LHOEWAVD.js → chunk-B7PEXXRW.js} +53 -53
  29. package/dist/cli/{chunk-IK3VOGDR.js → chunk-CBVCCXIY.js} +21 -21
  30. package/dist/cli/{chunk-JEYX3345.mjs → chunk-CFSCHLNQ.mjs} +3 -3
  31. package/dist/cli/{chunk-3MZPWIOE.mjs → chunk-D7EQ4PI5.mjs} +1 -1
  32. package/dist/cli/{chunk-XP7FAYLN.js → chunk-EBWYNNTJ.js} +5 -5
  33. package/dist/cli/{chunk-DQZBERDL.mjs → chunk-F5PYBZ2H.mjs} +1 -1
  34. package/dist/cli/{chunk-AIPTW3EK.js → chunk-FK7SBMSZ.js} +3 -3
  35. package/dist/cli/{chunk-Z27NSLPC.mjs → chunk-FVPT44IJ.mjs} +1 -1
  36. package/dist/cli/{chunk-RGIQ5ZJX.mjs → chunk-H3GOAZHV.mjs} +2 -2
  37. package/dist/cli/{chunk-AWJKYS25.js → chunk-HSANVBVL.js} +2 -2
  38. package/dist/cli/{chunk-JSXMJSBE.js → chunk-IC3BZJR7.js} +8 -8
  39. package/dist/cli/{chunk-MNK4ZK2C.mjs → chunk-J4FCTFQS.mjs} +10 -10
  40. package/dist/cli/{chunk-MKSB2FTU.mjs → chunk-JU2KBLOR.mjs} +97 -12
  41. package/dist/cli/{chunk-EIKONWW7.mjs → chunk-KCP6XNRR.mjs} +1 -1
  42. package/dist/cli/{chunk-YKNULB7V.js → chunk-KGLIDLJ2.js} +5 -5
  43. package/dist/cli/{chunk-N62MS3XJ.js → chunk-L45IECBZ.js} +6 -6
  44. package/dist/cli/{chunk-7IYOWIEJ.mjs → chunk-LJFIUT5R.mjs} +2 -2
  45. package/dist/cli/{chunk-ZGC2SUAA.mjs → chunk-LZCYDU6Q.mjs} +2 -2
  46. package/dist/cli/{chunk-3ODBCZLL.js → chunk-MYYOCJZ2.js} +93 -93
  47. package/dist/cli/{chunk-DKR7QPEO.js → chunk-MZSLFWOT.js} +1 -1
  48. package/dist/cli/{chunk-26CZVDQN.mjs → chunk-NPNQCPFP.mjs} +2 -2
  49. package/dist/cli/{chunk-UKX4FESF.mjs → chunk-NREO7TT4.mjs} +2 -2
  50. package/dist/cli/{chunk-KKWQ24VM.mjs → chunk-NTJDZURV.mjs} +2 -2
  51. package/dist/cli/{chunk-4C34LGI4.js → chunk-PGNLD6L6.js} +10 -10
  52. package/dist/cli/{chunk-G3UHAYRX.js → chunk-TEJSRJNH.js} +8 -8
  53. package/dist/cli/{chunk-UGYLGT7B.mjs → chunk-UHTJWDYB.mjs} +3 -3
  54. package/dist/cli/{chunk-EK2TAZJZ.js → chunk-ULKGYVYP.js} +2 -2
  55. package/dist/cli/{chunk-DUGZKPRK.mjs → chunk-UYA7LJGC.mjs} +2 -2
  56. package/dist/cli/{chunk-YVJ6IWVD.mjs → chunk-VKBZLV2K.mjs} +1 -1
  57. package/dist/cli/{chunk-YFDTF2XC.js → chunk-VLYUFZUT.js} +9 -9
  58. package/dist/cli/{chunk-THDXVSNL.mjs → chunk-VPAVNEDQ.mjs} +4 -4
  59. package/dist/cli/{chunk-RLQIGBFK.js → chunk-W3BHZUPL.js} +3 -3
  60. package/dist/cli/{chunk-5QS4T4KR.js → chunk-WFVEMDQL.js} +2 -2
  61. package/dist/cli/{chunk-475V572K.js → chunk-WTPRRKZA.js} +131 -46
  62. package/dist/cli/{chunk-CXBEZAPU.js → chunk-YEJDFZJP.js} +16 -16
  63. package/dist/cli/{chunk-JJVYUKLY.mjs → chunk-YQOWMQEW.mjs} +1 -1
  64. package/dist/cli/{chunk-YK64UZXN.mjs → chunk-ZOXV6WFI.mjs} +1 -1
  65. package/dist/cli/{chunk-YX762HFK.mjs → chunk-ZV4OWYLZ.mjs} +2 -2
  66. package/dist/cli/command-docs.js +2 -2
  67. package/dist/cli/command-docs.mjs +1 -1
  68. package/dist/cli/{csv-ENKCFCSM.js → csv-FXOQ2PBE.js} +13 -13
  69. package/dist/cli/{csv-QCLQOIEA.mjs → csv-GPVCETS2.mjs} +4 -4
  70. package/dist/cli/{db-P25LGP33.mjs → db-F5UJTBGP.mjs} +6 -6
  71. package/dist/cli/{db-5TLBZDT3.js → db-LXYV4GPZ.js} +27 -27
  72. package/dist/cli/{describe-W2H5DHR6.mjs → describe-GYWCI7I6.mjs} +17 -17
  73. package/dist/cli/describe-IB7SUIUT.js +48 -0
  74. package/dist/cli/describe-core.d.mts +3 -3
  75. package/dist/cli/describe-core.d.ts +3 -3
  76. package/dist/cli/{executions-VYZCYUBR.mjs → executions-6NL2YW76.mjs} +6 -6
  77. package/dist/cli/{executions-YHFAWJOJ.js → executions-6SJKTY2L.js} +8 -8
  78. package/dist/cli/{feedback-K2FWYYLZ.mjs → feedback-7AMQCNTB.mjs} +4 -4
  79. package/dist/cli/{feedback-RJF3QSBB.js → feedback-E3HULSQD.js} +8 -8
  80. package/dist/cli/{git-S3APUPLL.mjs → git-74IS2EFH.mjs} +5 -5
  81. package/dist/cli/git-A2QIIMW5.js +25 -0
  82. package/dist/cli/index.js +139 -139
  83. package/dist/cli/index.mjs +41 -41
  84. package/dist/cli/{legacy-noops-ICYZACTW.mjs → legacy-noops-52FFRTRZ.mjs} +5 -5
  85. package/dist/cli/{legacy-noops-3SWNRE7Z.js → legacy-noops-ALWUQPKS.js} +8 -8
  86. package/dist/cli/{monitors-DEZCEQLB.mjs → monitors-VTJIWWW2.mjs} +7 -7
  87. package/dist/cli/{monitors-VRIWTRPG.js → monitors-Z4ADOGTY.js} +91 -91
  88. package/dist/cli/{org-NX752DTE.js → org-2BTEKDF5.js} +72 -72
  89. package/dist/cli/{org-IQW5ZIAO.mjs → org-7GU6H7JL.mjs} +6 -6
  90. package/dist/cli/{pages-5WQRVVKX.mjs → pages-I6PFQGEU.mjs} +6 -6
  91. package/dist/cli/{pages-YIBWYGVS.js → pages-MG36E7RY.js} +17 -17
  92. package/dist/cli/{play-WOMJXS4O.mjs → play-7KFSLJX2.mjs} +18 -18
  93. package/dist/cli/{play-3EXNH3HD.js → play-VN52S3RV.js} +321 -321
  94. package/dist/cli/{providers-XDVPYRTS.mjs → providers-D46JDEL2.mjs} +6 -6
  95. package/dist/cli/{providers-C2WYSR2Y.js → providers-W5XLII66.js} +9 -9
  96. package/dist/cli/{quickstart-YMSIL2TK.mjs → quickstart-4GTXBZHY.mjs} +4 -4
  97. package/dist/cli/{quickstart-7RABZF66.js → quickstart-TIZAC63S.js} +6 -6
  98. package/dist/cli/{run-5QVVWFGL.js → run-FOVEMYYX.js} +36 -36
  99. package/dist/cli/{run-A4JD6TAR.mjs → run-LE3D4LVU.mjs} +22 -22
  100. package/dist/cli/{search-2TOSF2G3.mjs → search-6YL6WJMQ.mjs} +7 -7
  101. package/dist/cli/search-HN6SVDQU.js +32 -0
  102. package/dist/cli/{secrets-Q7UVOSNM.js → secrets-CSTTTMZH.js} +15 -15
  103. package/dist/cli/{secrets-BUN4ORE7.mjs → secrets-D66U6RTT.mjs} +6 -6
  104. package/dist/cli/{sessions-NXQOQ4HX.js → sessions-45M2NRAA.js} +6 -6
  105. package/dist/cli/{sessions-IAOORI6X.mjs → sessions-XIO3OUER.mjs} +5 -5
  106. package/dist/cli/{settings-WD4KSY5S.js → settings-N42CVKSK.js} +78 -78
  107. package/dist/cli/{settings-BMI373AI.mjs → settings-R33X2D5T.mjs} +11 -11
  108. package/dist/cli/{setup-55VIWAWR.mjs → setup-CBBC4FQP.mjs} +9 -9
  109. package/dist/cli/{setup-3IA7BVPE.js → setup-HREDVNF2.js} +44 -44
  110. package/dist/cli/{skills-GKITMBTM.mjs → skills-4X6WS2PT.mjs} +9 -7
  111. package/dist/cli/skills-QZ6HZX2T.js +33 -0
  112. package/dist/cli/tools-KFIH7UWB.js +55 -0
  113. package/dist/cli/{tools-XHCFC7GP.mjs → tools-YR46YFR2.mjs} +16 -16
  114. package/dist/cli/{update-SWB24YKE.mjs → update-5CYAZX5X.mjs} +9 -9
  115. package/dist/cli/update-VZLEJLWJ.js +33 -0
  116. package/dist/cli/{workflow-5QPMFI3Z.js → workflow-M7AA722W.js} +17 -17
  117. package/dist/cli/{workflow-XO4CKUA7.mjs → workflow-NKQ3CWPK.mjs} +7 -7
  118. package/dist/{client-Bgl0_zXi.d.mts → client-AjmfA5nR.d.mts} +1 -1
  119. package/dist/{client-_ah6IuhK.d.ts → client-DMyY-QL8.d.ts} +1 -1
  120. package/dist/{client-core-C-ZF5vh9.d.ts → client-core-C705vFyV.d.ts} +1 -1
  121. package/dist/{client-core-Bfsedm0_.d.mts → client-core-CpBbvLEX.d.mts} +1 -1
  122. package/dist/{compiler-manifest-CCOqDGjU.d.mts → compiler-manifest-hqIAukR0.d.mts} +1 -1
  123. package/dist/{compiler-manifest-CCOqDGjU.d.ts → compiler-manifest-hqIAukR0.d.ts} +1 -1
  124. package/dist/{errors-Cy3kPnsi.d.ts → errors-CRO2qQ6k.d.ts} +1 -1
  125. package/dist/{errors-BLccD7tG.d.mts → errors-DIHVetNY.d.mts} +1 -1
  126. package/dist/{index-D5e4h1-H.d.ts → index-B8DVoeYt.d.ts} +1 -1
  127. package/dist/{index-4-j44HuT.d.mts → index-DVZ_X4Gb.d.mts} +1 -1
  128. package/dist/index.d.mts +9 -9
  129. package/dist/index.d.ts +9 -9
  130. package/dist/index.js +9 -9
  131. package/dist/index.mjs +6 -6
  132. package/dist/install-integrity.json +110 -110
  133. package/dist/plays/bundle-play-file.d.mts +3 -3
  134. package/dist/plays/bundle-play-file.d.ts +3 -3
  135. package/dist/plays/bundle-play-file.mjs +1 -1
  136. package/dist/plays/play-description.d.mts +2 -2
  137. package/dist/plays/play-description.d.ts +2 -2
  138. package/dist/plays/run-request.d.mts +2 -2
  139. package/dist/plays/run-request.d.ts +2 -2
  140. package/dist/release.d.mts +3 -3
  141. package/dist/release.d.ts +3 -3
  142. package/dist/release.js +2 -2
  143. package/dist/release.mjs +1 -1
  144. package/dist/server.d.mts +4 -4
  145. package/dist/server.d.ts +4 -4
  146. package/dist/server.js +5 -5
  147. package/dist/server.mjs +3 -3
  148. package/package.json +1 -1
  149. package/dist/cli/auth-O6KAH543.js +0 -41
  150. package/dist/cli/describe-44L7OBGM.js +0 -48
  151. package/dist/cli/git-F3EI5DY5.js +0 -25
  152. package/dist/cli/search-772R7YHI.js +0 -32
  153. package/dist/cli/skills-PUUTFMP3.js +0 -31
  154. package/dist/cli/tools-3WX7TUUG.js +0 -55
  155. package/dist/cli/update-PC3CLODV.js +0 -33
@@ -12736,9 +12736,17 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
12736
12736
  if (providers?.length === 0) return [];
12737
12737
  // The v12 table retains deleted history. Avoid planning the lineage repair
12738
12738
  // when neither a legacy row nor a v2 NULL-domain duplicate needs adoption.
12739
- // A row arriving after this read is picked up by the next claim poll; the
12740
- // provider-qualified v2 claim below still runs on every call.
12741
- const adoptionWork = await client.query<{ pending: boolean }>(`
12739
+ // The same read proves whether any v2 row could be claimed: the claim below
12740
+ // is ~15 KB of SQL whose planning costs milliseconds while every idle
12741
+ // worker polls it each second, so it is skipped when nothing is claimable.
12742
+ // `claimable` repeats the claim's own row predicates without the detached
12743
+ // sandbox fence, so it is a superset of what the claim could select. A row
12744
+ // arriving after this read is picked up by the next claim poll.
12745
+ const adoptionWork = await client.query<{
12746
+ pending: boolean;
12747
+ claimable: boolean;
12748
+ }>(
12749
+ `
12742
12750
  SELECT EXISTS (
12743
12751
  SELECT 1 FROM ${tableName('sandbox_cleanup_jobs_v2', options)}
12744
12752
  WHERE provider = 'daytona' AND routing_domain IS NULL
@@ -12746,9 +12754,29 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
12746
12754
  ) OR EXISTS (
12747
12755
  SELECT 1 FROM ${tableName('sandbox_cleanup_jobs', options)}
12748
12756
  WHERE status <> 'deleted'
12749
- ) AS pending
12750
- `);
12751
- if (typeof adoptionWork.rows[0]?.pending !== 'boolean') {
12757
+ ) AS pending,
12758
+ EXISTS (
12759
+ SELECT 1 FROM ${tableName('sandbox_cleanup_jobs_v2', options)} AS cleanup
12760
+ WHERE cleanup.status <> 'deleted' AND cleanup.blocked_at IS NULL
12761
+ AND (cleanup.available_at <= now() OR cleanup.diagnostic_json IS NOT NULL)
12762
+ AND (cleanup.lease_expires_at IS NULL OR cleanup.lease_expires_at <= now())
12763
+ AND ($1::text IS NULL OR cleanup.environment = $1)
12764
+ AND ($2::text[] IS NULL OR cleanup.provider = ANY($2::text[]))
12765
+ AND ($3::text IS NULL OR cleanup.run_id = $3)
12766
+ AND ($4::integer IS NULL OR cleanup.attempt <= $4)
12767
+ ) AS claimable
12768
+ `,
12769
+ [
12770
+ input.environment?.trim() || null,
12771
+ providers,
12772
+ input.runId ?? null,
12773
+ input.throughAttempt ?? null,
12774
+ ],
12775
+ );
12776
+ if (
12777
+ typeof adoptionWork.rows[0]?.pending !== 'boolean' ||
12778
+ typeof adoptionWork.rows[0]?.claimable !== 'boolean'
12779
+ ) {
12752
12780
  throw new Error(
12753
12781
  'Sandbox cleanup adoption preflight returned no pending proof.',
12754
12782
  );
@@ -12944,6 +12972,10 @@ export async function claimPostgresSchedulerSandboxCleanupJobs(
12944
12972
  ON CONFLICT (provider, sandbox_id, routing_domain_key) DO NOTHING
12945
12973
  `,
12946
12974
  );
12975
+ // Adoption may have just created claimable v2 rows, so only an idle read
12976
+ // that proved neither kind of work skips the claim.
12977
+ if (!adoptionWork.rows[0].pending && !adoptionWork.rows[0].claimable)
12978
+ return [];
12947
12979
  const claimed = await client.query<{
12948
12980
  provider: 'daytona' | 'modal';
12949
12981
  sandbox_id: string;
@@ -16389,7 +16421,6 @@ export async function executePostgresSchedulerClaim(
16389
16421
  execute: PostgresSchedulerAttemptExecutor,
16390
16422
  options: PostgresSchedulerClaimExecutionOptions = {},
16391
16423
  ): Promise<PostgresSchedulerWorkerOnceResult> {
16392
- let runtimeResources: unknown[] = [];
16393
16424
  let runnerFailureResult: Extract<
16394
16425
  PlayRunnerResult,
16395
16426
  { status: 'failed' }
@@ -16445,11 +16476,6 @@ export async function executePostgresSchedulerClaim(
16445
16476
  },
16446
16477
  options,
16447
16478
  );
16448
- runtimeResources = await readPostgresSchedulerRuntimeResourcesForRun(
16449
- client,
16450
- { runId: claim.runId },
16451
- options,
16452
- );
16453
16479
  // A PlayRunnerResult envelope ({status, output, logs, steps, ...}) is the
16454
16480
  // executor's transport shape; the run's terminal result — what the ledger
16455
16481
  // run.completed event and `runs get` expose — is the play's own output.
@@ -16587,31 +16613,9 @@ export async function executePostgresSchedulerClaim(
16587
16613
  `Postgres scheduler worker failed after losing lease for ${claim.runId}/${claim.attempt}: ${message}`,
16588
16614
  );
16589
16615
  }
16590
- if (runtimeResources.length === 0) {
16591
- await settlePostgresSchedulerRuntimeResources(
16592
- client,
16593
- {
16594
- runId: claim.runId,
16595
- billingEndedAt: runnerTerminalReceivedAtMs ?? Date.now(),
16596
- terminalReason,
16597
- },
16598
- options,
16599
- ).catch((settlementError) => {
16600
- console.warn('[postgres-scheduler.resource_settlement_failed]', {
16601
- runId: claim.runId,
16602
- terminalReason,
16603
- error:
16604
- settlementError instanceof Error
16605
- ? settlementError.message
16606
- : String(settlementError),
16607
- });
16608
- });
16609
- runtimeResources = await readPostgresSchedulerRuntimeResourcesForRun(
16610
- client,
16611
- { runId: claim.runId },
16612
- options,
16613
- ).catch(() => []);
16614
- }
16616
+ // The failure statement already stamps every sandbox and persists its
16617
+ // cleanup/billing obligations. Return to terminal projection without
16618
+ // reacquiring custody locks or reading resources that this caller never uses.
16615
16619
  return {
16616
16620
  status: 'failed',
16617
16621
  runId: claim.runId,
@@ -19477,6 +19481,27 @@ export async function readPostgresSchedulerTerminalArrayInputIntent(
19477
19481
  return readTerminalArrayInputIntentForScope(client, input, options);
19478
19482
  }
19479
19483
 
19484
+ /**
19485
+ * Prove delivery before exposing the same run's terminal cleanup intent.
19486
+ * Fold the optional-column probe into that proof, preserving old schemas
19487
+ * without another round trip or copying the wide run tuple to JSON.
19488
+ */
19489
+ export async function assertPostgresRunLedgerDeliveryAndReadTerminalArrayInputIntent(
19490
+ client: PostgresSchedulerQueryClient,
19491
+ input: Parameters<typeof assertPostgresRunLedgerDelivery>[1],
19492
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
19493
+ ): Promise<{ playName: string | null; started: boolean }> {
19494
+ const markerPresent = await provePostgresRunLedgerDelivery(
19495
+ client,
19496
+ input,
19497
+ options,
19498
+ true,
19499
+ );
19500
+ return markerPresent
19501
+ ? readTerminalArrayInputIntentRow(client, input, options)
19502
+ : { playName: null, started: false };
19503
+ }
19504
+
19480
19505
  /** Internal dispatch already owns the run's outbox lease; receiver reads also bind its org. */
19481
19506
  async function readTerminalArrayInputIntentForScope(
19482
19507
  client: PostgresSchedulerQueryClient,
@@ -19499,6 +19524,14 @@ async function readTerminalArrayInputIntentForScope(
19499
19524
  if (column.rows[0]?.present !== true) {
19500
19525
  return { playName: null, started: false };
19501
19526
  }
19527
+ return readTerminalArrayInputIntentRow(client, input, options);
19528
+ }
19529
+
19530
+ async function readTerminalArrayInputIntentRow(
19531
+ client: PostgresSchedulerQueryClient,
19532
+ input: { orgId?: string; runId: string },
19533
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
19534
+ ): Promise<{ playName: string | null; started: boolean }> {
19502
19535
  const run = await client.query<{
19503
19536
  array_input_started: boolean;
19504
19537
  play_name: string;
@@ -19529,6 +19562,15 @@ export async function assertPostgresRunLedgerDelivery(
19529
19562
  },
19530
19563
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
19531
19564
  ): Promise<void> {
19565
+ await provePostgresRunLedgerDelivery(client, input, options);
19566
+ }
19567
+
19568
+ async function provePostgresRunLedgerDelivery(
19569
+ client: PostgresSchedulerQueryClient,
19570
+ input: Parameters<typeof assertPostgresRunLedgerDelivery>[1],
19571
+ options?: Pick<PostgresSchedulerOptions, 'schema'>,
19572
+ readArrayInputMarker = false,
19573
+ ): Promise<boolean> {
19532
19574
  const result = await client.query<{
19533
19575
  delivery_key: string;
19534
19576
  event_type: string;
@@ -19539,6 +19581,7 @@ export async function assertPostgresRunLedgerDelivery(
19539
19581
  blocked: boolean;
19540
19582
  payload_json: unknown;
19541
19583
  created_at: Date;
19584
+ array_input_marker_present?: boolean;
19542
19585
  }>(
19543
19586
  `
19544
19587
  SELECT outbox.delivery_key,
@@ -19551,6 +19594,16 @@ export async function assertPostgresRunLedgerDelivery(
19551
19594
  outbox.failed_at IS NOT NULL AS blocked,
19552
19595
  outbox.payload_json,
19553
19596
  outbox.created_at
19597
+ ${
19598
+ readArrayInputMarker
19599
+ ? `, EXISTS (
19600
+ SELECT 1 FROM pg_attribute
19601
+ WHERE attrelid = to_regclass($3)
19602
+ AND attname = 'array_input_started'
19603
+ AND NOT attisdropped
19604
+ ) AS array_input_marker_present`
19605
+ : ''
19606
+ }
19554
19607
  FROM ${tableName('outbox', options)} AS outbox
19555
19608
  JOIN ${tableName('runs', options)} AS runs ON runs.run_id = outbox.run_id
19556
19609
  WHERE outbox.run_id = $1 AND runs.org_id = $2
@@ -19562,7 +19615,9 @@ export async function assertPostgresRunLedgerDelivery(
19562
19615
  -- their own delivery without changing the drain's convergence behavior.
19563
19616
  LIMIT ${RUN_LEDGER_PROJECTION_PREFIX_MAX_FACTS}
19564
19617
  `,
19565
- [input.runId, input.orgId],
19618
+ readArrayInputMarker
19619
+ ? [input.runId, input.orgId, tableName('runs', options)]
19620
+ : [input.runId, input.orgId],
19566
19621
  );
19567
19622
  const rows = result.rows;
19568
19623
  const leaseOwner = input.leaseOwner?.trim() || rows[0]?.lease_owner;
@@ -19656,7 +19711,8 @@ export async function assertPostgresRunLedgerDelivery(
19656
19711
  input.idempotencyKey === batchKey ||
19657
19712
  legacySingletonKey)
19658
19713
  ) {
19659
- if (input.projectedEvents === undefined) return;
19714
+ if (input.projectedEvents === undefined)
19715
+ return rows[0]?.array_input_marker_present === true;
19660
19716
  const prefixEvents: PlayRunLedgerIngressEvent[] = [];
19661
19717
  for (const prefixRow of prefix) {
19662
19718
  prefixEvents.push(
@@ -19696,7 +19752,8 @@ export async function assertPostgresRunLedgerDelivery(
19696
19752
  expectedEventCandidates: expectedProjectionCandidates,
19697
19753
  ...(input.projectionChunk ? { chunk: input.projectionChunk } : {}),
19698
19754
  });
19699
- if (projectionMismatch === null) return;
19755
+ if (projectionMismatch === null)
19756
+ return rows[0]?.array_input_marker_present === true;
19700
19757
  throw new RunLedgerProjectionLeaseLostError(
19701
19758
  'projected_events_mismatch',
19702
19759
  projectionMismatch,
@@ -19749,6 +19806,40 @@ function runLedgerOrderSql(alias: string): string {
19749
19806
  return `CASE ${alias}.event_type WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runCreated} THEN 0 WHEN ${RUN_EVENT_KIND_SQL_LITERAL.runStarted} THEN 1 ELSE 2 END, ${alias}.created_at, ${alias}.event_id`;
19750
19807
  }
19751
19808
 
19809
+ /**
19810
+ * Whether a lane (or, without `searchOnly`, either lane) holds any
19811
+ * undelivered fact. Global discovery and due-clock statements are kilobytes
19812
+ * of SQL planned on every call, and an idle Preview projector issues them
19813
+ * twice a second. Every such statement starts from these same undelivered
19814
+ * rows, so an empty probe proves it would return nothing. The probe is the
19815
+ * first seek of `runLedgerPendingRunsSql`: an ordered LIMIT keeps the lane's
19816
+ * pending partial index even when statistics expect the other lane's backlog
19817
+ * to match, where EXISTS (which discards ORDER BY and LIMIT) would scan the
19818
+ * retained outbox instead.
19819
+ */
19820
+ async function runLedgerOutboxLaneHasPending(
19821
+ client: PostgresSchedulerQueryClient,
19822
+ options: Pick<PostgresSchedulerOptions, 'schema'> | undefined,
19823
+ searchOnly?: boolean,
19824
+ ): Promise<boolean> {
19825
+ const lane =
19826
+ searchOnly === undefined
19827
+ ? ''
19828
+ : `AND ${searchLaneSql('pending')} = ${String(searchOnly)}`;
19829
+ const result = await client.query<{ pending: boolean }>(
19830
+ `SELECT (
19831
+ SELECT pending.run_id FROM ${tableName('outbox', options)} AS pending
19832
+ WHERE pending.delivered_at IS NULL ${lane}
19833
+ ORDER BY pending.run_id LIMIT 1
19834
+ ) IS NOT NULL AS pending`,
19835
+ );
19836
+ const pending = result.rows[0]?.pending;
19837
+ if (typeof pending !== 'boolean') {
19838
+ throw new Error('Run Ledger outbox pending probe returned no proof.');
19839
+ }
19840
+ return pending;
19841
+ }
19842
+
19752
19843
  /** Enumerate pending runs by index seeks, skipping each run's entire fact tail. */
19753
19844
  function runLedgerPendingRunsSql(
19754
19845
  options?: Pick<PostgresSchedulerOptions, 'schema'>,
@@ -21081,6 +21172,16 @@ export async function readPostgresSchedulerOutboxNextDueAt(
21081
21172
  ? [true]
21082
21173
  : [false, true];
21083
21174
  const runId = options?.runId?.trim() || null;
21175
+ // Every due time below belongs to an undelivered fact.
21176
+ if (
21177
+ !runId &&
21178
+ !(await runLedgerOutboxLaneHasPending(
21179
+ client,
21180
+ options,
21181
+ options?.lane === undefined ? undefined : lanes[0],
21182
+ ))
21183
+ )
21184
+ return null;
21084
21185
  const result = await client.query<{ due_at: Date | string | null }>(
21085
21186
  `
21086
21187
  -- Seek distinct run identities without reading their pending fact tails.
@@ -23107,6 +23208,28 @@ async function dispatchRunLedgerOutboxBatchWithScope(
23107
23208
  arrayInputStarted: scope?.nextArrayInputStarted,
23108
23209
  }
23109
23210
  : await withClient(async (client) => {
23211
+ // Global discovery of an empty lane would plan its multi-kilobyte
23212
+ // claim statements only to select nothing.
23213
+ if (
23214
+ !scope &&
23215
+ !input.runId?.trim() &&
23216
+ !input.headEventId?.trim() &&
23217
+ !(await runLedgerOutboxLaneHasPending(
23218
+ client,
23219
+ options,
23220
+ input.searchOnly === true,
23221
+ ))
23222
+ ) {
23223
+ return {
23224
+ events: [] as PostgresSchedulerOutboxEvent[],
23225
+ launchJson: null,
23226
+ ingressPrefixClaimed: false,
23227
+ freshClaimLease: undefined,
23228
+ transportDelivered: undefined,
23229
+ transportOwnershipUnconfirmed: undefined,
23230
+ arrayInputStarted: undefined,
23231
+ };
23232
+ }
23110
23233
  const fast = await claimFastEvents(client);
23111
23234
  let result: Awaited<ReturnType<typeof claimEvents>>;
23112
23235
  if (fast !== null) {
@@ -2988,7 +2988,7 @@ export const PLAY_AUTHORING_FIELD_REGISTRY = {
2988
2988
  resolution: 'static-required',
2989
2989
  issueCode: 'play_authoring_binding_invalid',
2990
2990
  description:
2991
- 'Deepline-managed sandbox size. Standard is 1 GiB memory. Large (4 GiB) and xlarge (8 GiB) are available only on branch Preview deployments. Production supports standard.',
2991
+ 'Deepline-managed sandbox size: standard (1 GiB memory, 1 CPU), large (4 GiB, 2 CPU), or xlarge (8 GiB, 4 CPU). Standard is the default. Compute pricing follows the workspace plan and selected size.',
2992
2992
  errorMessage:
2993
2993
  'runtime.size must be the static literal "standard", "large", or "xlarge".',
2994
2994
  },
@@ -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 _chunk6YZYCKWDjs = require('./chunk-6YZYCKWD.js');
17
+ require('./chunk-AS3VECCY.js');
18
+ require('./chunk-7HAUVMRF.js');
19
+ require('./chunk-5AEEINTU.js');
20
+ require('./chunk-ALJJRZNJ.js');
21
+ require('./chunk-XNYIZMNQ.js');
22
+ require('./chunk-DIAWYWT5.js');
23
+ require('./chunk-A6BETJ2A.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 = _chunk6YZYCKWDjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk6YZYCKWDjs.authStatusLine; exports.clearPendingClaim = _chunk6YZYCKWDjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk6YZYCKWDjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk6YZYCKWDjs.handleRegister; exports.handleStatus = _chunk6YZYCKWDjs.handleStatus; exports.handleWait = _chunk6YZYCKWDjs.handleWait; exports.httpJson = _chunk6YZYCKWDjs.httpJson; exports.readPendingAuthClaim = _chunk6YZYCKWDjs.readPendingAuthClaim; exports.readStatusBanner = _chunk6YZYCKWDjs.readStatusBanner; exports.registerAuthCommands = _chunk6YZYCKWDjs.registerAuthCommands; exports.reportSetupCompleted = _chunk6YZYCKWDjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk6YZYCKWDjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk6YZYCKWDjs.statusBannerLine;
@@ -13,14 +13,14 @@ import {
13
13
  reportSetupCompleted,
14
14
  resolvePendingAuthClaimForResume,
15
15
  statusBannerLine
16
- } from "./chunk-JEYX3345.mjs";
17
- import "./chunk-KKWQ24VM.mjs";
18
- import "./chunk-YK64UZXN.mjs";
19
- import "./chunk-Z27NSLPC.mjs";
16
+ } from "./chunk-CFSCHLNQ.mjs";
17
+ import "./chunk-NTJDZURV.mjs";
18
+ import "./chunk-ZOXV6WFI.mjs";
19
+ import "./chunk-FVPT44IJ.mjs";
20
20
  import "./chunk-4QF2K7TM.mjs";
21
21
  import "./chunk-DLIRSHV6.mjs";
22
22
  import "./chunk-HBL4PM5Q.mjs";
23
- import "./chunk-UGYLGT7B.mjs";
23
+ import "./chunk-UHTJWDYB.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-26CZVDQN.mjs";
3
+ } from "./chunk-NPNQCPFP.mjs";
4
4
  import {
5
5
  iterateCursorPages,
6
6
  requireBillingIdempotencyKey
7
- } from "./chunk-DQZBERDL.mjs";
7
+ } from "./chunk-F5PYBZ2H.mjs";
8
8
  import "./chunk-L2VKAASU.mjs";
9
9
  import "./chunk-NELMCOWK.mjs";
10
10
  import "./chunk-S3A4IXBQ.mjs";
@@ -15,9 +15,9 @@ import {
15
15
  openInBrowser,
16
16
  printCommandEnvelope,
17
17
  shouldEmitJson
18
- } from "./chunk-KKWQ24VM.mjs";
19
- import "./chunk-YK64UZXN.mjs";
20
- import "./chunk-Z27NSLPC.mjs";
18
+ } from "./chunk-NTJDZURV.mjs";
19
+ import "./chunk-ZOXV6WFI.mjs";
20
+ import "./chunk-FVPT44IJ.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-UGYLGT7B.mjs";
29
+ import "./chunk-UHTJWDYB.mjs";
30
30
  import "./chunk-WZYKRD7T.mjs";
31
31
  import "./chunk-KRD6H754.mjs";
32
32