deepline 0.3.505 → 0.3.506

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 (162) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +121 -5
  2. package/dist/bundling-sources/sdk/src/index.ts +3 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +2 -0
  5. package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +176 -0
  6. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +17 -0
  7. package/dist/bundling-sources/shared_libs/monitors/fleets/overview.ts +118 -0
  8. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +29 -1
  9. package/dist/bundling-sources/shared_libs/monitors/legacy-radar-retirement.ts +29 -10
  10. package/dist/bundling-sources/shared_libs/monitors/package.json +4 -0
  11. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +8 -8
  12. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +52 -5
  13. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +48 -5
  14. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +13 -40
  15. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +36 -3
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-egress.ts +55 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +66 -0
  18. package/dist/cli/auth-MMHG2OFE.js +43 -0
  19. package/dist/cli/{auth-AHE2EDQA.mjs → auth-ZHFONT2D.mjs} +5 -5
  20. package/dist/cli/{billing-JOIZPHON.js → billing-3Z7N4WTL.js} +101 -91
  21. package/dist/cli/{billing-7CPWTGGI.mjs → billing-B2YEMNHE.mjs} +27 -17
  22. package/dist/cli/{chunk-CA3SYXCS.js → chunk-26DJ4BDY.js} +2 -2
  23. package/dist/cli/{chunk-PZN24YQQ.mjs → chunk-2CFTDVEP.mjs} +2 -2
  24. package/dist/cli/{chunk-OMEDQ77C.mjs → chunk-2IXXB7OA.mjs} +5 -5
  25. package/dist/cli/{chunk-XHPB6RGY.js → chunk-2OY5DXTC.js} +1 -1
  26. package/dist/cli/{chunk-CSLLQWAB.mjs → chunk-3BFZEHBH.mjs} +1 -1
  27. package/dist/cli/{chunk-3YEOOXD4.js → chunk-3F676QXJ.js} +11 -11
  28. package/dist/cli/{chunk-WTQLUULB.js → chunk-5ARG7J7A.js} +6 -6
  29. package/dist/cli/{chunk-NARJWXBR.mjs → chunk-6RYVIZRP.mjs} +2 -2
  30. package/dist/cli/{chunk-EMUFF6EU.js → chunk-75NAFY36.js} +7 -7
  31. package/dist/cli/{chunk-BWAYMJ23.js → chunk-AD2WJUZA.js} +91 -48
  32. package/dist/cli/{chunk-JVKEZT7L.mjs → chunk-AFSYNOG4.mjs} +22 -1
  33. package/dist/cli/{chunk-OA6U5NVB.mjs → chunk-BJ5OX62J.mjs} +5 -5
  34. package/dist/cli/{chunk-7DDKLFOY.mjs → chunk-BQBPVUFJ.mjs} +3 -3
  35. package/dist/cli/{chunk-UZ24SF7N.mjs → chunk-CHGRURBN.mjs} +5 -5
  36. package/dist/cli/{chunk-JA7YBRP4.mjs → chunk-D7OCORZ7.mjs} +1 -1
  37. package/dist/cli/{chunk-IDAE5VDH.js → chunk-DB54ROPH.js} +5 -5
  38. package/dist/cli/{chunk-GAUNJCXQ.js → chunk-E554XCJI.js} +96 -96
  39. package/dist/cli/{chunk-IZYOYXG7.mjs → chunk-EN7GXLFX.mjs} +4 -4
  40. package/dist/cli/{chunk-7QLK2GHL.js → chunk-F53SGS3C.js} +5 -5
  41. package/dist/cli/{chunk-JSTKLYYD.js → chunk-F7IQQYKV.js} +2 -2
  42. package/dist/cli/{chunk-FIQ5UEIF.mjs → chunk-FFGQR5J3.mjs} +2 -2
  43. package/dist/cli/{chunk-SPN7U3MV.js → chunk-FWSEGIT6.js} +4 -4
  44. package/dist/cli/{chunk-K26YOPDO.js → chunk-GDHLL5EQ.js} +22 -1
  45. package/dist/cli/{chunk-ACI6CUDX.mjs → chunk-GJNIC2CO.mjs} +78 -45
  46. package/dist/cli/{chunk-QYGYVCRI.js → chunk-GRESJ3H3.js} +14 -14
  47. package/dist/cli/{chunk-MHZAG2ZQ.js → chunk-HINTYT5H.js} +93 -60
  48. package/dist/cli/{chunk-HASFFOSU.js → chunk-LRSRJJPD.js} +16 -16
  49. package/dist/cli/{chunk-ZLN2B5YA.js → chunk-MHRR47VQ.js} +3 -3
  50. package/dist/cli/{chunk-6FEN6VWZ.js → chunk-N7G36GXB.js} +26 -26
  51. package/dist/cli/{chunk-MAFZ64RN.mjs → chunk-ND4WPLTE.mjs} +2 -2
  52. package/dist/cli/{chunk-5XT4DZQL.mjs → chunk-O4DZG4VA.mjs} +2 -2
  53. package/dist/cli/{chunk-OORPAQVC.js → chunk-OD6TASBP.js} +8 -8
  54. package/dist/cli/{chunk-Y52XY56V.js → chunk-OHNMJ5XQ.js} +41 -41
  55. package/dist/cli/{chunk-4OFSAZN6.mjs → chunk-ONBXTEFQ.mjs} +46 -3
  56. package/dist/cli/{chunk-6U3AGJWI.mjs → chunk-OPBXKB57.mjs} +1 -1
  57. package/dist/cli/{chunk-W6I4N4JN.mjs → chunk-OUGJUM5X.mjs} +6 -6
  58. package/dist/cli/{chunk-VXKWF3AD.js → chunk-PRIHD5XS.js} +9 -9
  59. package/dist/cli/{chunk-RT3HJBIH.mjs → chunk-QAY5AS2H.mjs} +10 -10
  60. package/dist/cli/{chunk-GXMNOUHP.js → chunk-QP333GFE.js} +7 -7
  61. package/dist/cli/{chunk-7DDACLMX.js → chunk-SUJIVF6L.js} +16 -16
  62. package/dist/cli/{chunk-QGNNAZ5M.mjs → chunk-TEMORCEE.mjs} +1 -1
  63. package/dist/cli/{chunk-7AD565DO.mjs → chunk-TS4KFQKS.mjs} +1 -1
  64. package/dist/cli/{chunk-YBIVVAL7.mjs → chunk-XUY7WQ2R.mjs} +3 -3
  65. package/dist/cli/{chunk-PDLOPF5L.mjs → chunk-YEX6RPUO.mjs} +1 -1
  66. package/dist/cli/{chunk-WPCF7C6B.js → chunk-YJKKOSXS.js} +3 -3
  67. package/dist/cli/{chunk-SHKRL7CW.mjs → chunk-YVOS5KSG.mjs} +1 -1
  68. package/dist/cli/{chunk-52FPW2RD.mjs → chunk-YWZEBPXK.mjs} +2 -2
  69. package/dist/cli/{chunk-WTUC5VKB.mjs → chunk-Z7EHY2MF.mjs} +2 -2
  70. package/dist/cli/{chunk-LC4FG34E.js → chunk-ZM5BJ5MP.js} +53 -53
  71. package/dist/cli/{chunk-45XYW477.js → chunk-ZZDTWVCQ.js} +21 -21
  72. package/dist/cli/command-docs.js +2 -2
  73. package/dist/cli/command-docs.mjs +1 -1
  74. package/dist/cli/{csv-DZHVIW3G.js → csv-7K7LK63Y.js} +13 -13
  75. package/dist/cli/{csv-WTPI6ZON.mjs → csv-ARHQ54HA.mjs} +4 -4
  76. package/dist/cli/{db-NR4PJ6AF.mjs → db-JBX24NJY.mjs} +6 -6
  77. package/dist/cli/{db-D7LPPNCC.js → db-V4Z2I6DY.js} +27 -27
  78. package/dist/cli/describe-AYXVS6DZ.js +50 -0
  79. package/dist/cli/{describe-NCKAJPUG.mjs → describe-RBDSGSZ7.mjs} +18 -18
  80. package/dist/cli/describe-core.d.mts +3 -3
  81. package/dist/cli/describe-core.d.ts +3 -3
  82. package/dist/cli/{executions-RQVJ4LAB.mjs → executions-BAZEU63W.mjs} +6 -6
  83. package/dist/cli/{executions-UQG6LWEN.js → executions-XEZKV5QU.js} +8 -8
  84. package/dist/cli/{feedback-TCHA67IA.js → feedback-LOERESRU.js} +8 -8
  85. package/dist/cli/{feedback-RD4Y3YQR.mjs → feedback-YDSWBHCO.mjs} +4 -4
  86. package/dist/cli/{git-Z7434B7Y.mjs → git-4Z3W2CQU.mjs} +5 -5
  87. package/dist/cli/git-T6WKO7EA.js +25 -0
  88. package/dist/cli/index.js +145 -149
  89. package/dist/cli/index.mjs +46 -50
  90. package/dist/cli/{legacy-noops-23WRA7DH.js → legacy-noops-4QIQPVE5.js} +8 -8
  91. package/dist/cli/{legacy-noops-LQJU4UIV.mjs → legacy-noops-E4HH7S5O.mjs} +5 -5
  92. package/dist/cli/{monitors-Z6VYUZ2W.mjs → monitors-FPDW5DDM.mjs} +305 -8
  93. package/dist/cli/{monitors-KOWN7M3V.js → monitors-QBHDSDA7.js} +423 -126
  94. package/dist/cli/{org-2T5K2VP5.js → org-JO4GGSAH.js} +72 -72
  95. package/dist/cli/{org-UBNRO5XO.mjs → org-UCDHIHAD.mjs} +6 -6
  96. package/dist/cli/{pages-GHPJBVV3.mjs → pages-6V52IZXY.mjs} +6 -6
  97. package/dist/cli/{pages-SRXTU7XO.js → pages-FJAAXAWO.js} +18 -18
  98. package/dist/cli/{play-2HMZ57EZ.js → play-F3AENS6W.js} +317 -317
  99. package/dist/cli/{play-HRQKGTXA.mjs → play-MF4DWROJ.mjs} +18 -18
  100. package/dist/cli/{providers-JWJRFRR5.mjs → providers-NJJLTECA.mjs} +6 -6
  101. package/dist/cli/{providers-P5O676MZ.js → providers-XXOQLPX7.js} +9 -9
  102. package/dist/cli/{quickstart-YCY72TAO.js → quickstart-JCE3XGQG.js} +6 -6
  103. package/dist/cli/{quickstart-S7NZUQRO.mjs → quickstart-Z5MSMI7S.mjs} +4 -4
  104. package/dist/cli/{run-QWMRIUIU.mjs → run-56UGPIRL.mjs} +23 -23
  105. package/dist/cli/{run-MHLLGF4G.js → run-X2DNIW3F.js} +41 -41
  106. package/dist/cli/search-B753RTKC.js +33 -0
  107. package/dist/cli/{search-4BFTQUEP.mjs → search-SZYI4NBB.mjs} +8 -8
  108. package/dist/cli/{search-output-62LBVZHN.js → search-output-7UNT6EMP.js} +6 -6
  109. package/dist/cli/{search-output-LIYHDTBP.mjs → search-output-T35QNZUF.mjs} +4 -4
  110. package/dist/cli/{secrets-KKKHVSOO.js → secrets-JMUAVIVC.js} +15 -15
  111. package/dist/cli/{secrets-GW27V77E.mjs → secrets-Q36VC35L.mjs} +6 -6
  112. package/dist/cli/{sessions-R75LBGIL.mjs → sessions-HG6I3HMY.mjs} +5 -5
  113. package/dist/cli/{sessions-R3OEINAR.js → sessions-SUXU7OM7.js} +6 -6
  114. package/dist/cli/{settings-MQIHAEZN.js → settings-UIELQ5CV.js} +106 -79
  115. package/dist/cli/{settings-I3AQZSYG.mjs → settings-Z76XW4KF.mjs} +39 -12
  116. package/dist/cli/{setup-X3QRJERP.js → setup-2L7H5P2O.js} +50 -50
  117. package/dist/cli/{setup-2YA5MYMS.mjs → setup-OXNYAOQ4.mjs} +10 -10
  118. package/dist/cli/skills-DEVXYGYH.js +37 -0
  119. package/dist/cli/{skills-7252FOOI.mjs → skills-XSNLXJGI.mjs} +8 -8
  120. package/dist/cli/tools-SCGHABDL.js +57 -0
  121. package/dist/cli/{tools-SKQTSVGE.mjs → tools-SUSFAYFH.mjs} +17 -17
  122. package/dist/cli/update-BSIILGO3.js +35 -0
  123. package/dist/cli/{update-GNBBSKTB.mjs → update-ENSTG3QO.mjs} +10 -10
  124. package/dist/cli/{workflow-QB7YYWPP.js → workflow-FMBZNY4F.js} +17 -17
  125. package/dist/cli/{workflow-OJSAL5FO.mjs → workflow-Z33QE6VT.mjs} +7 -7
  126. package/dist/{client-DEJg0CZn.d.mts → client-BDbouy3Y.d.mts} +1 -1
  127. package/dist/{client-B3GSaSFn.d.ts → client-Cx0420fs.d.ts} +1 -1
  128. package/dist/{client-core-GQmy3N8y.d.ts → client-core-B4hq0-m2.d.ts} +51 -4
  129. package/dist/{client-core-C404E33V.d.mts → client-core-CwiVaMZ5.d.mts} +51 -4
  130. package/dist/{compiler-manifest-DaJrA2KV.d.mts → compiler-manifest-BeURaD5Y.d.mts} +2 -0
  131. package/dist/{compiler-manifest-DaJrA2KV.d.ts → compiler-manifest-BeURaD5Y.d.ts} +2 -0
  132. package/dist/{errors-KLga4bLr.d.ts → errors-BoPXPrSy.d.ts} +1 -1
  133. package/dist/{errors-BKnSYueU.d.mts → errors-kBuT4kGK.d.mts} +1 -1
  134. package/dist/{index-C5nAZ-VS.d.ts → index-D0crdGM1.d.ts} +1 -1
  135. package/dist/{index-C-8AFpWy.d.mts → index-DC7oRAAC.d.mts} +1 -1
  136. package/dist/index.d.mts +7 -7
  137. package/dist/index.d.ts +7 -7
  138. package/dist/index.js +9 -9
  139. package/dist/index.mjs +6 -6
  140. package/dist/install-integrity.json +115 -112
  141. package/dist/plays/bundle-play-file.d.mts +3 -3
  142. package/dist/plays/bundle-play-file.d.ts +3 -3
  143. package/dist/plays/play-description.d.mts +2 -2
  144. package/dist/plays/play-description.d.ts +2 -2
  145. package/dist/plays/run-request.d.mts +2 -2
  146. package/dist/plays/run-request.d.ts +2 -2
  147. package/dist/release.d.mts +1 -1
  148. package/dist/release.d.ts +1 -1
  149. package/dist/release.js +2 -2
  150. package/dist/release.mjs +1 -1
  151. package/dist/server.d.mts +4 -4
  152. package/dist/server.d.ts +4 -4
  153. package/dist/server.js +5 -5
  154. package/dist/server.mjs +3 -3
  155. package/package.json +1 -1
  156. package/dist/cli/auth-SEPKNRHV.js +0 -43
  157. package/dist/cli/describe-HVQBTKFM.js +0 -50
  158. package/dist/cli/git-TUB2ZUEH.js +0 -25
  159. package/dist/cli/search-QPUHOEIL.js +0 -33
  160. package/dist/cli/skills-BPZWMZSL.js +0 -37
  161. package/dist/cli/tools-F7RVQ3IK.js +0 -57
  162. package/dist/cli/update-TLSY6LC2.js +0 -35
@@ -331,7 +331,7 @@
331
331
  "id": "github.log-triage",
332
332
  "name": "Scheduled Log Triage",
333
333
  "scheduler": "github_actions",
334
- "cadence": "29 */12 * * *",
334
+ "cadence": "29 */2 * * 1-5;29 */6 * * 0,6",
335
335
  "timezone": "UTC",
336
336
  "source": ".github/workflows/log-triage-scheduled.yml",
337
337
  "locator": "schedule:",
@@ -422,8 +422,8 @@
422
422
  "id": "github.provider-dashboard",
423
423
  "name": "Tool health dashboard nightly",
424
424
  "scheduler": "github_actions",
425
- "cadence": "0 14,15 * * *",
426
- "timezone": "America/New_York",
425
+ "cadence": "0 14 * * *;0 15 * * *",
426
+ "timezone": "UTC",
427
427
  "source": ".github/workflows/provider-dashboard-nightly.yml",
428
428
  "locator": "schedule:",
429
429
  "owner": "integrations",
@@ -554,15 +554,15 @@
554
554
  "id": "github.runtime-latency-daily",
555
555
  "name": "Daily Runtime Latency Budgets",
556
556
  "scheduler": "github_actions",
557
- "cadence": "0 5 * * *",
557
+ "cadence": "0 5 * * *;0 3 * * *",
558
558
  "timezone": "America/New_York",
559
559
  "source": ".github/workflows/runtime-latency-daily.yml",
560
560
  "locator": "schedule:",
561
561
  "owner": "runtime",
562
562
  "criticality": "operational",
563
- "purpose": "Run the quiet provider latency budget that left the PR gate against a fresh exact-SHA Preview of main, and retain its timings.",
564
- "successDefinition": "The provider latency baseline meets its unchanged budget and the Preview target is settled, released, and scaled to zero.",
565
- "failureDefinition": "Target preparation, the provider latency baseline, or settlement and release of the Preview estate fails.",
563
+ "purpose": "Run the runtime latency budgets that left the PR gate at 05:00 and the billing load proofs at 03:00 against a fresh exact-SHA Preview of main, and retain their timings.",
564
+ "successDefinition": "Every scenario in the run's plan meets its budget or assertions and the Preview target is settled, released, and scaled to zero.",
565
+ "failureDefinition": "Target preparation, any scenario in the run's plan, or settlement and release of the Preview estate fails.",
566
566
  "startGraceMs": 600000,
567
567
  "runTimeoutMs": 7200000,
568
568
  "failureAlert": "github_workflow_run",
@@ -1058,7 +1058,7 @@
1058
1058
  "id": "convex.observe-large-usage-charges",
1059
1059
  "name": "Observe unusually large usage charges",
1060
1060
  "scheduler": "convex_scheduled_action",
1061
- "cadence": "runAfter(0) from each consumed positive usage-notification batch",
1061
+ "cadence": "runAfter(0) from each consumed usage-notification batch with a charge above the $10 message threshold",
1062
1062
  "timezone": "UTC",
1063
1063
  "source": "packages/convex/scheduledJobsNode.ts",
1064
1064
  "locator": "observeLargeUsageCharges",
@@ -363,7 +363,7 @@ import {
363
363
  isAlwaysFreshIntegrationTool,
364
364
  isAlwaysFreshIntegrationWriteTool,
365
365
  } from './tool-cache-policy';
366
- import { isRowIsolationExemptError } from './row-isolation';
366
+ import { isAbortLikeError, isRowIsolationExemptError } from './row-isolation';
367
367
  import {
368
368
  replayTrackedMarkerReceiptKey,
369
369
  replayUnsafeMarkerReceiptKey,
@@ -388,6 +388,7 @@ import {
388
388
  } from './output-size-limits';
389
389
  import {
390
390
  RuntimeReceiptWriter,
391
+ RuntimeReceiptWriterBufferLimitError,
391
392
  type RuntimeReceiptWriterRetryEvent,
392
393
  writeRuntimeReceiptWithBackpressure,
393
394
  } from './runtime-receipt-writer';
@@ -4144,6 +4145,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
4144
4145
  completedAt?: (value: T) => number | undefined;
4145
4146
  sharesResult?: (value: T) => boolean;
4146
4147
  publishLatestOnRefresh?: true;
4148
+ /** Names the tool in the shared-cache skip log. */
4149
+ toolId?: string;
4147
4150
  onOutcome?: (value: T, metadata: CallFreshnessMetadata) => T;
4148
4151
  }): Promise<T> {
4149
4152
  const orgId = this.#options.orgId?.trim();
@@ -4157,6 +4160,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
4157
4160
  semanticKey: input.semanticKey,
4158
4161
  invocationId: input.invocationId,
4159
4162
  runId: this.historyRunId,
4163
+ receiptOwnerRunId: this.currentReceiptOwnerRunId,
4164
+ onLatestPublishSkipped: (event) =>
4165
+ this.reportSharedReadCachePublishSkipped({
4166
+ ...event,
4167
+ ...(input.toolId ? { toolId: input.toolId } : {}),
4168
+ }),
4160
4169
  requestedStaleAfterSeconds: input.policy.requested,
4161
4170
  effectiveStaleAfterSeconds: input.policy.effective,
4162
4171
  store: this.durableReceiptExecutionStore(),
@@ -6732,18 +6741,55 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
6732
6741
  assertNoSecretTaint(input.result, 'Shared read cache result');
6733
6742
  await publish({
6734
6743
  key: input.access.key,
6735
- runId: this.historyRunId,
6744
+ runId: this.currentReceiptOwnerRunId,
6736
6745
  output: latestCacheResultOutput(
6737
6746
  completedCallForResult(input.result, 0, input.storedResultReceiptKey),
6738
6747
  ),
6739
6748
  });
6740
6749
  } catch (error) {
6741
- this.runtimeLog(
6742
- `Tool ${input.toolId} shared read cache publish skipped: ${error instanceof Error ? error.message : String(error)}`,
6743
- );
6750
+ // Cancellation is the run stopping, not a publish failure.
6751
+ if (isAbortLikeError(error)) throw error;
6752
+ this.reportSharedReadCachePublishSkipped({
6753
+ key: input.access.key,
6754
+ reason:
6755
+ error instanceof RuntimeReceiptWriterBufferLimitError
6756
+ ? 'too_large'
6757
+ : 'error',
6758
+ error,
6759
+ toolId: input.toolId,
6760
+ });
6744
6761
  }
6745
6762
  }
6746
6763
 
6764
+ #sharedReadCachePublishSkips = 0;
6765
+
6766
+ /**
6767
+ * A shared-cache publish is an optimization, so a skip never fails the run.
6768
+ * It is still reported: a structured line for the first skip and then each
6769
+ * power-of-two count, so a run that skips thousands of publishes stays quiet.
6770
+ */
6771
+ private reportSharedReadCachePublishSkipped(event: {
6772
+ key: string;
6773
+ reason: 'too_large' | 'error';
6774
+ error: unknown;
6775
+ toolId?: string;
6776
+ }): void {
6777
+ const count = ++this.#sharedReadCachePublishSkips;
6778
+ if ((count & (count - 1)) !== 0) return;
6779
+ this.runtimeLog(
6780
+ JSON.stringify({
6781
+ event: 'shared_read_cache_publish_skipped',
6782
+ reason: event.reason,
6783
+ ...(event.toolId ? { toolId: event.toolId } : {}),
6784
+ skippedCount: count,
6785
+ message:
6786
+ event.error instanceof Error
6787
+ ? event.error.message
6788
+ : String(event.error),
6789
+ }),
6790
+ );
6791
+ }
6792
+
6747
6793
  private async resolveToolAuthScopeDigest(
6748
6794
  toolId: string,
6749
6795
  ): Promise<string | null> {
@@ -14511,6 +14557,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
14511
14557
  semanticKey,
14512
14558
  invocationId,
14513
14559
  policy,
14560
+ toolId,
14514
14561
  ...(publishLatestOnRefresh
14515
14562
  ? { publishLatestOnRefresh: true as const }
14516
14563
  : {}),
@@ -9,6 +9,7 @@ import {
9
9
  type DurableReceiptExecutionStore,
10
10
  } from './durable-receipt-execution';
11
11
  import { DURABLE_RUNS_ROLLOUT } from './durable-runs-rollout';
12
+ import { RuntimeReceiptWriterBufferLimitError } from './runtime-receipt-writer';
12
13
  import { assertNoSecretTaint } from './secret-capability';
13
14
  import {
14
15
  deserializeToolExecuteResult,
@@ -152,6 +153,17 @@ export function completedCallForResult(
152
153
  };
153
154
  }
154
155
 
156
+ /**
157
+ * Matches `isAbortLikeError` (row-isolation.ts), which this module cannot
158
+ * import without a cycle through durable-receipt-execution.
159
+ */
160
+ function isCancellationError(error: unknown): boolean {
161
+ return (
162
+ error instanceof Error &&
163
+ (error.name === 'WorkflowAbort' || error.name === 'AbortError')
164
+ );
165
+ }
166
+
155
167
  /** The `publish_latest_cache_result` output; the receiver stamps the time. */
156
168
  export function latestCacheResultOutput(
157
169
  call: CompletedCall,
@@ -229,6 +241,21 @@ export async function executeWithFreshnessReceipt<T>(input: {
229
241
  * an authored 0 never publish.
230
242
  */
231
243
  publishLatestOnRefresh?: true;
244
+ /**
245
+ * Run identity of the executor token. The shared-cache publish is checked
246
+ * against it by the gateway, so it must not be the history run ID, which
247
+ * differs for an inline child. Defaults to `runId` (a root run: identical).
248
+ */
249
+ receiptOwnerRunId?: string;
250
+ /**
251
+ * Reports a shared-cache publish that was skipped or failed. The publish is
252
+ * an optimization, so the run proceeds; the caller makes this observable.
253
+ */
254
+ onLatestPublishSkipped?: (event: {
255
+ key: string;
256
+ reason: 'too_large' | 'error';
257
+ error: unknown;
258
+ }) => void;
232
259
  onOutcome: (value: T, metadata: CallFreshnessMetadata) => T;
233
260
  withHydration: <Result>(
234
261
  read: (
@@ -482,11 +509,27 @@ export async function executeWithFreshnessReceipt<T>(input: {
482
509
  ) {
483
510
  // The receiver stamps the time and keeps only the newer entry. An
484
511
  // older receiver reports `unavailable`; either outcome is final.
485
- await input.store.publishLatestCacheResult({
486
- key: latestCacheKey,
487
- runId: input.runId,
488
- output: latestCacheResultOutput(completed),
489
- });
512
+ try {
513
+ await input.store.publishLatestCacheResult({
514
+ key: latestCacheKey,
515
+ runId: input.receiptOwnerRunId ?? input.runId,
516
+ output: latestCacheResultOutput(completed),
517
+ });
518
+ } catch (error) {
519
+ // Cancellation is the run stopping, not a publish failure.
520
+ if (isCancellationError(error)) throw error;
521
+ // Best effort: the result was produced and stored; a failed or
522
+ // oversized shared-cache publish must not fail the customer's run.
523
+ // The payload is never truncated; an oversized result is not shared.
524
+ input.onLatestPublishSkipped?.({
525
+ key: latestCacheKey,
526
+ reason:
527
+ error instanceof RuntimeReceiptWriterBufferLimitError
528
+ ? 'too_large'
529
+ : 'error',
530
+ error,
531
+ });
532
+ }
490
533
  }
491
534
  // Each overlapping miss owns its live result even if the immutable receipt
492
535
  // insert loses to a sibling. The stored winner is for later recovery.
@@ -1,4 +1,3 @@
1
- import { resolve4 } from 'node:dns/promises';
2
1
  import type { CreateSandboxFromSnapshotParams, Sandbox } from '@daytonaio/sdk';
3
2
  import {
4
3
  boundedDaytonaProviderTextForLog,
@@ -18,6 +17,7 @@ import type {
18
17
  PlayRunnerResult,
19
18
  } from '../../protocol';
20
19
  import { isIsolatedRuntimeSchedulerSchema } from '../../runtime-scheduler-topology';
20
+ import { withRuntimeGatewayEgressCidrs } from '../../runtime-gateway-egress';
21
21
  import { PLAY_RUNNER_TIMEOUT_SECONDS } from '../../runtime-constants';
22
22
  import {
23
23
  STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
@@ -564,15 +564,10 @@ export function filterIpv4CidrAllowList(raw: string | null): string | null {
564
564
  }
565
565
 
566
566
  /**
567
- * A run pinned to an app-hosted Runtime gateway reaches that immutable
568
- * deployment by hostname, whose addresses cannot be enumerated ahead of time.
569
- * Daytona accepts a CIDR `networkAllowList` or a `domainAllowList`, never
570
- * both ("mutually exclusive"), and a restricted sandbox already carries the
571
- * CIDR list. So when egress is already restricted, add the /24 around each
572
- * IPv4 address the pinned host resolves to, to that same list: the sandbox
573
- * resolves the same name and may be answered with a different address in the
574
- * same Vercel range. An unrestricted sandbox needs nothing (a list would
575
- * restrict it), and an unpinned run is returned unchanged.
567
+ * Daytona's form of the shared pinned-host egress rule
568
+ * (`withRuntimeGatewayEgressCidrs`): its `networkAllowList` is one
569
+ * comma-separated CIDR string. An unrestricted sandbox and an unpinned run
570
+ * are returned unchanged, without resolving.
576
571
  */
577
572
  export async function runtimeGatewayDaytonaNetworkAllowList(input: {
578
573
  credentialScope:
@@ -581,37 +576,15 @@ export async function runtimeGatewayDaytonaNetworkAllowList(input: {
581
576
  networkAllowList: string | null;
582
577
  resolveIpv4?: (hostname: string) => Promise<string[]>;
583
578
  }): Promise<string | null> {
584
- const scope = input.credentialScope;
585
- if (!scope || !input.networkAllowList) return input.networkAllowList;
586
- const hostname = new URL(scope.origin).hostname;
587
- if (!hostname) {
588
- throw new Error('Runtime gateway credential scope has no hostname.');
579
+ if (!input.credentialScope || !input.networkAllowList) {
580
+ return input.networkAllowList;
589
581
  }
590
- const addresses = await (input.resolveIpv4 ?? resolve4)(hostname);
591
- const networks = [
592
- ...new Set(
593
- addresses
594
- .map((address) => address.split('.'))
595
- .filter(
596
- (octets) =>
597
- octets.length === 4 &&
598
- octets.every((octet) => /^\d{1,3}$/.test(octet)),
599
- )
600
- .map((octets) => `${octets[0]}.${octets[1]}.${octets[2]}.0/24`),
601
- ),
602
- ];
603
- if (networks.length === 0) {
604
- throw new Error(
605
- `Runtime gateway host ${hostname} resolved to no IPv4 address; refusing to start a pinned sandbox that could not reach it.`,
606
- );
607
- }
608
- const existing = input.networkAllowList
609
- .split(',')
610
- .map((entry) => entry.trim());
611
- return [
612
- ...existing,
613
- ...networks.filter((network) => !existing.includes(network)),
614
- ].join(',');
582
+ const cidrs = await withRuntimeGatewayEgressCidrs({
583
+ credentialScope: input.credentialScope,
584
+ cidrs: input.networkAllowList.split(','),
585
+ ...(input.resolveIpv4 ? { resolveIpv4: input.resolveIpv4 } : {}),
586
+ });
587
+ return cidrs ? cidrs.join(',') : null;
615
588
  }
616
589
 
617
590
  export function resolveDaytonaSandboxNetworkPolicy(input: {
@@ -26,6 +26,7 @@ import {
26
26
  withModalCallSignal,
27
27
  } from '../../modal-runtime-config';
28
28
  import type { PlaySandboxRuntimeLimits } from '../../../plays/sandbox-runtime-limits';
29
+ import { withRuntimeGatewayEgressCidrs } from '../../runtime-gateway-egress';
29
30
  import { validateDaytonaExecutionContext } from './daytona-lifecycle';
30
31
  import {
31
32
  stageRunnerPayload,
@@ -340,6 +341,21 @@ async function persistLateModalSandboxResource(input: {
340
341
  );
341
342
  }
342
343
 
344
+ /** DNS failures that a later attempt can outrun (not "no such record"). */
345
+ const TRANSIENT_RESOLVER_ERROR_CODES: ReadonlySet<string> = new Set([
346
+ 'EAI_AGAIN',
347
+ 'ETIMEOUT',
348
+ 'ESERVFAIL',
349
+ 'ECONNREFUSED',
350
+ 'ECONNRESET',
351
+ 'ECANCELLED',
352
+ ]);
353
+
354
+ function isTransientResolverError(error: unknown): boolean {
355
+ const code = (error as { code?: unknown } | null)?.code;
356
+ return typeof code === 'string' && TRANSIENT_RESOLVER_ERROR_CODES.has(code);
357
+ }
358
+
343
359
  export const modalPlayRunnerBackend: PlayRunnerBackend = {
344
360
  async execute(config, callbacks) {
345
361
  let runtimeResourceRegistrationError: unknown;
@@ -372,6 +388,25 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
372
388
  runtimeSchedulerSchema: config.context.runtimeSchedulerSchema,
373
389
  limits: config.context.sandboxRuntimeLimits,
374
390
  });
391
+ // A run pinned to an app-hosted Runtime gateway must reach that host
392
+ // through a restricted sandbox's CIDR list, by the same rule as Daytona.
393
+ // Only a pinned, already-restricted sandbox resolves anything; every
394
+ // other run keeps the exact list and path it had before.
395
+ const credentialScope = config.context.runtimeGatewayCredentialScope;
396
+ const outboundCidrAllowlist =
397
+ credentialScope && modalConfig.outboundCidrAllowlist
398
+ ? await withRuntimeGatewayEgressCidrs({
399
+ credentialScope,
400
+ cidrs: modalConfig.outboundCidrAllowlist,
401
+ }).catch((error: unknown) => {
402
+ // A resolver hiccup is not the run's fault and no sandbox exists
403
+ // yet: defer like any runner that could not reach its gateway.
404
+ // A host with no IPv4 address still fails loudly.
405
+ throw isTransientResolverError(error)
406
+ ? recoveryForRunnerStartupNotLive(error)
407
+ : error;
408
+ })
409
+ : modalConfig.outboundCidrAllowlist;
375
410
  const resources = modalSandboxResourcesForPlay(modalConfig.limits);
376
411
  const memoryPolicy = resolveModalSandboxMemoryPolicy({
377
412
  limits: modalConfig.limits,
@@ -460,9 +495,7 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
460
495
  idleTimeoutMs: modalSandboxLifetimeMs(modalConfig.limits),
461
496
  workdir: modalConfig.workdir,
462
497
  tags: createTags,
463
- ...(modalConfig.outboundCidrAllowlist
464
- ? { outboundCidrAllowlist: modalConfig.outboundCidrAllowlist }
465
- : {}),
498
+ ...(outboundCidrAllowlist ? { outboundCidrAllowlist } : {}),
466
499
  }),
467
500
  onLateSuccess: async (lateSandbox) => {
468
501
  logSandboxCreateOutcome({
@@ -0,0 +1,55 @@
1
+ import { resolve4 } from 'node:dns/promises';
2
+ import type { RuntimeGatewayCredentialScope } from './runtime-gateway-sandbox-credential';
3
+
4
+ /**
5
+ * Egress to the pinned Runtime gateway host for a sandbox whose outbound
6
+ * network is restricted to a CIDR list. Shared by every sandbox provider
7
+ * (Daytona `networkAllowList`, Modal `outboundCidrAllowlist`).
8
+ *
9
+ * A pinned run reaches its immutable app deployment by hostname, whose
10
+ * addresses cannot be enumerated ahead of time, and the providers accept a
11
+ * CIDR list (Daytona refuses a CIDR list and a domain list together). So when
12
+ * egress is already restricted, add the /24 around each IPv4 address the
13
+ * pinned host resolves to: the sandbox resolves the same name and may be
14
+ * answered with a different address in the same range. An unrestricted
15
+ * sandbox needs nothing (a list would restrict it), and an unpinned run is
16
+ * returned unchanged without resolving anything.
17
+ */
18
+ export async function withRuntimeGatewayEgressCidrs(input: {
19
+ credentialScope: RuntimeGatewayCredentialScope | null | undefined;
20
+ /** The provider's CIDR allow-list; null or empty means unrestricted. */
21
+ cidrs: readonly string[] | null;
22
+ resolveIpv4?: (hostname: string) => Promise<string[]>;
23
+ }): Promise<string[] | null> {
24
+ const scope = input.credentialScope;
25
+ if (!scope || !input.cidrs || input.cidrs.length === 0) {
26
+ return input.cidrs ? [...input.cidrs] : null;
27
+ }
28
+ const hostname = new URL(scope.origin).hostname;
29
+ if (!hostname) {
30
+ throw new Error('Runtime gateway credential scope has no hostname.');
31
+ }
32
+ const addresses = await (input.resolveIpv4 ?? resolve4)(hostname);
33
+ const networks = [
34
+ ...new Set(
35
+ addresses
36
+ .map((address) => address.split('.'))
37
+ .filter(
38
+ (octets) =>
39
+ octets.length === 4 &&
40
+ octets.every((octet) => /^\d{1,3}$/.test(octet)),
41
+ )
42
+ .map((octets) => `${octets[0]}.${octets[1]}.${octets[2]}.0/24`),
43
+ ),
44
+ ];
45
+ if (networks.length === 0) {
46
+ throw new Error(
47
+ `Runtime gateway host ${hostname} resolved to no IPv4 address; refusing to start a pinned sandbox that could not reach it.`,
48
+ );
49
+ }
50
+ const existing = input.cidrs.map((entry) => entry.trim());
51
+ return [
52
+ ...existing,
53
+ ...networks.filter((network) => !existing.includes(network)),
54
+ ];
55
+ }
@@ -13706,6 +13706,72 @@ export async function readPostgresSchedulerComputeBillingRecovery(
13706
13706
  : null;
13707
13707
  }
13708
13708
 
13709
+ /** A finalized Preview charge can outlive its test workspace and job ACK. */
13710
+ export async function acknowledgeFinalizedTrainComputeBillingJob(
13711
+ client: PostgresSchedulerQueryClient,
13712
+ input: {
13713
+ schema: string;
13714
+ runId: string;
13715
+ orgId: string;
13716
+ attemptCount: number;
13717
+ resumeEpoch: string | null;
13718
+ resourceSnapshot: ReadonlyArray<readonly [number, unknown]>;
13719
+ },
13720
+ ): Promise<boolean> {
13721
+ const { schema, runId, orgId, attemptCount, resumeEpoch, resourceSnapshot } =
13722
+ input;
13723
+ if (!/^runtime_scheduler_preview_release_train(?:_[b-d])?$/u.test(schema)) {
13724
+ throw new Error(
13725
+ 'Finalized train billing recovery requires a named Preview lane.',
13726
+ );
13727
+ }
13728
+ const result = await client.query(
13729
+ `WITH matching_run AS MATERIALIZED (
13730
+ SELECT run.run_id
13731
+ FROM ${tableName('runs', { schema })} AS run
13732
+ WHERE run.run_id = $1 AND run.org_id = $2
13733
+ AND run.status IN ('completed', 'failed', 'cancelled')
13734
+ AND run.launch_json->>'schedulerSchema' = $3
13735
+ AND (run.launch_json->>'resumeEpoch') IS NOT DISTINCT FROM $4
13736
+ AND coalesce(run.admission_json, run.launch_json)->>'schedulerSchema' = $3
13737
+ AND (coalesce(run.admission_json, run.launch_json)->>'resumeEpoch')
13738
+ IS NOT DISTINCT FROM $4
13739
+ FOR UPDATE OF run
13740
+ ), matching_attempts AS MATERIALIZED (
13741
+ SELECT attempt.attempt, attempt.resource_json
13742
+ FROM ${tableName('attempts', { schema })} AS attempt
13743
+ JOIN matching_run ON matching_run.run_id = attempt.run_id
13744
+ ORDER BY attempt.attempt
13745
+ FOR UPDATE OF attempt
13746
+ )
13747
+ UPDATE ${tableName('compute_billing_jobs_v2', { schema })} AS job
13748
+ SET status = 'settled', blocked_at = NULL, block_reason = NULL,
13749
+ last_error = NULL, settled_at = now(), updated_at = now()
13750
+ FROM matching_run
13751
+ WHERE job.run_id = matching_run.run_id
13752
+ AND job.status = 'pending' AND job.blocked_at IS NOT NULL
13753
+ AND job.lease_owner IS NULL AND job.lease_expires_at IS NULL
13754
+ AND job.attempt_count = $5
13755
+ AND $6::jsonb = (
13756
+ SELECT coalesce(
13757
+ jsonb_agg(jsonb_build_array(attempt, resource_json) ORDER BY attempt),
13758
+ '[]'::jsonb
13759
+ )
13760
+ FROM matching_attempts
13761
+ )
13762
+ RETURNING job.run_id`,
13763
+ [
13764
+ runId,
13765
+ orgId,
13766
+ schema,
13767
+ resumeEpoch,
13768
+ attemptCount,
13769
+ JSON.stringify(resourceSnapshot),
13770
+ ],
13771
+ );
13772
+ return result.rows.length === 1;
13773
+ }
13774
+
13709
13775
  /**
13710
13776
  * Explicit operator reconciliation takes its own settlement lease atomically.
13711
13777
  * A retained worker must not win a pending-row race and use the old issuer.
@@ -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 _chunkZM5BJ5MPjs = require('./chunk-ZM5BJ5MP.js');
18
+ require('./chunk-75NAFY36.js');
19
+ require('./chunk-MHRR47VQ.js');
20
+ require('./chunk-FWSEGIT6.js');
21
+ require('./chunk-ALJJRZNJ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-DIAWYWT5.js');
24
+ require('./chunk-2OY5DXTC.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 = _chunkZM5BJ5MPjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkZM5BJ5MPjs.authStatusLine; exports.clearPendingClaim = _chunkZM5BJ5MPjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkZM5BJ5MPjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkZM5BJ5MPjs.handleRegister; exports.handleStatus = _chunkZM5BJ5MPjs.handleStatus; exports.handleWait = _chunkZM5BJ5MPjs.handleWait; exports.httpJson = _chunkZM5BJ5MPjs.httpJson; exports.readPendingAuthClaim = _chunkZM5BJ5MPjs.readPendingAuthClaim; exports.readStatusBanner = _chunkZM5BJ5MPjs.readStatusBanner; exports.registerAuthCommands = _chunkZM5BJ5MPjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkZM5BJ5MPjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkZM5BJ5MPjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkZM5BJ5MPjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkZM5BJ5MPjs.statusBannerLine;
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-7DDKLFOY.mjs";
18
- import "./chunk-PZN24YQQ.mjs";
19
- import "./chunk-SHKRL7CW.mjs";
20
- import "./chunk-7AD565DO.mjs";
17
+ } from "./chunk-BQBPVUFJ.mjs";
18
+ import "./chunk-2CFTDVEP.mjs";
19
+ import "./chunk-YVOS5KSG.mjs";
20
+ import "./chunk-TS4KFQKS.mjs";
21
21
  import "./chunk-4QF2K7TM.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-HBL4PM5Q.mjs";
24
- import "./chunk-6U3AGJWI.mjs";
24
+ import "./chunk-OPBXKB57.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {