deepline 0.3.560 → 0.3.562

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 (137) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +16 -1
  3. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +57 -2
  4. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +24 -2
  5. package/dist/cli/auth-FM3JO6FN.js +44 -0
  6. package/dist/cli/{auth-5DIOQ3MO.mjs → auth-OFHWBJ2W.mjs} +5 -5
  7. package/dist/cli/{billing-N5NS5CU6.js → billing-BORJ3ZHJ.js} +99 -99
  8. package/dist/cli/{billing-K7EJAM55.mjs → billing-PPOC7TAY.mjs} +8 -8
  9. package/dist/cli/{chunk-4CQ7LVRT.js → chunk-3BV2OD25.js} +48 -48
  10. package/dist/cli/{chunk-SCM6BR4Q.mjs → chunk-3OJLUVOS.mjs} +1 -1
  11. package/dist/cli/{chunk-5VC6K4NJ.js → chunk-4O47WP3B.js} +26 -26
  12. package/dist/cli/{chunk-ZXB2Y3SG.js → chunk-5COJEZSB.js} +4 -4
  13. package/dist/cli/{chunk-4PBYS3PS.mjs → chunk-5KMZR36E.mjs} +1 -1
  14. package/dist/cli/{chunk-V7ZOAXZ4.js → chunk-5NGS4RLF.js} +23 -23
  15. package/dist/cli/{chunk-GKONGPVW.mjs → chunk-5VXK34DQ.mjs} +5 -5
  16. package/dist/cli/{chunk-JQDVX3D4.mjs → chunk-5XS5BTMC.mjs} +4 -4
  17. package/dist/cli/{chunk-BQ2Z6PSE.mjs → chunk-5YQVEV7I.mjs} +5 -5
  18. package/dist/cli/{chunk-Q77PM7U2.js → chunk-6BGEW3KU.js} +20 -20
  19. package/dist/cli/{chunk-A62A73U6.mjs → chunk-7DRCIDPW.mjs} +3 -3
  20. package/dist/cli/{chunk-I7CQJ7JP.js → chunk-7HFWEQ6Y.js} +2 -2
  21. package/dist/cli/{chunk-OPT36HX4.js → chunk-7IHSJ3RD.js} +53 -53
  22. package/dist/cli/{chunk-V7OFUYMO.mjs → chunk-AAIYXQRJ.mjs} +2 -2
  23. package/dist/cli/{chunk-JYT6P2M2.js → chunk-AASSDBQ3.js} +2 -2
  24. package/dist/cli/{chunk-CQS5E6D2.js → chunk-CIEMDAJE.js} +100 -100
  25. package/dist/cli/{chunk-NNKZ4JYP.mjs → chunk-EHUUHKWY.mjs} +5 -5
  26. package/dist/cli/{chunk-7ZE6DF6B.js → chunk-EVZDU7CF.js} +3 -3
  27. package/dist/cli/{chunk-DOAD7ZCA.mjs → chunk-GAMCJW6E.mjs} +1 -1
  28. package/dist/cli/{chunk-LMY7CGI7.js → chunk-GAN6UYEN.js} +5 -5
  29. package/dist/cli/{chunk-UTPANENL.js → chunk-GH5R65SB.js} +12 -12
  30. package/dist/cli/{chunk-GTRGJITW.mjs → chunk-GWJ4EOW2.mjs} +11 -11
  31. package/dist/cli/{chunk-Y5CZWGO4.js → chunk-IQJQB7J6.js} +1 -1
  32. package/dist/cli/{chunk-E76MM3SC.js → chunk-J5P7VGV5.js} +20 -20
  33. package/dist/cli/{chunk-4MAY2TA3.mjs → chunk-J7XEUV5W.mjs} +2 -2
  34. package/dist/cli/{chunk-GR5WG72L.mjs → chunk-KJDS2X5S.mjs} +2 -2
  35. package/dist/cli/{chunk-AMUMEL4C.mjs → chunk-L4KUAJFR.mjs} +1 -1
  36. package/dist/cli/{chunk-4GRIMNDO.js → chunk-LJXFCEP2.js} +41 -41
  37. package/dist/cli/{chunk-JHS7WKRS.mjs → chunk-LK4LR4K7.mjs} +3 -3
  38. package/dist/cli/{chunk-F5CZ3Q2I.mjs → chunk-LXL7OZOG.mjs} +1 -1
  39. package/dist/cli/{chunk-24GZT76F.js → chunk-P6XJRHLF.js} +7 -7
  40. package/dist/cli/{chunk-YDWFE7MX.js → chunk-PDHLHEUL.js} +2 -2
  41. package/dist/cli/{chunk-UI7BBF2O.mjs → chunk-QC3NTBF7.mjs} +5 -5
  42. package/dist/cli/{chunk-KP4B3JOT.js → chunk-QWB4VW4T.js} +13 -13
  43. package/dist/cli/{chunk-TE2NSUT5.js → chunk-R5PPP3JU.js} +5 -5
  44. package/dist/cli/{chunk-5QMEJPN5.js → chunk-RFB52LP5.js} +8 -8
  45. package/dist/cli/{chunk-G33LSF4T.mjs → chunk-RKB536LB.mjs} +2 -2
  46. package/dist/cli/{chunk-BW4NVW5T.js → chunk-RYWWBTDB.js} +3 -3
  47. package/dist/cli/{chunk-OS3FDGKX.mjs → chunk-SQFWIUNP.mjs} +4 -4
  48. package/dist/cli/{chunk-A4X2O75M.mjs → chunk-UC2ATYB3.mjs} +2 -2
  49. package/dist/cli/{chunk-ZSDZ3Q5P.mjs → chunk-USA6QRDO.mjs} +1 -1
  50. package/dist/cli/{chunk-MBLPUJ5I.js → chunk-UVZQR7I6.js} +5 -5
  51. package/dist/cli/{chunk-ZJJUVUP6.mjs → chunk-UZ4ELBHM.mjs} +2 -2
  52. package/dist/cli/{chunk-WOZKGI6H.mjs → chunk-WDKU7NOR.mjs} +1 -1
  53. package/dist/cli/{chunk-XLM7L4UY.mjs → chunk-WFVL6A7I.mjs} +1 -1
  54. package/dist/cli/{chunk-CQJMFUMK.mjs → chunk-XHZFA67G.mjs} +1 -1
  55. package/dist/cli/{chunk-RQKCNQ5Q.mjs → chunk-YAXYFPBF.mjs} +2 -2
  56. package/dist/cli/{chunk-ZY64JRBV.js → chunk-YB6N6WKX.js} +10 -10
  57. package/dist/cli/{chunk-FW2WRBZO.js → chunk-YT4WIYFT.js} +9 -9
  58. package/dist/cli/{chunk-MCGR7NG3.js → chunk-YX47WHVT.js} +6 -6
  59. package/dist/cli/{chunk-Z4FWF237.js → chunk-Z2FC6UQQ.js} +15 -15
  60. package/dist/cli/{chunk-5XMABMQU.mjs → chunk-ZQLEEOZR.mjs} +2 -2
  61. package/dist/cli/{concurrent-runs-help-TCB2EKTR.mjs → concurrent-runs-help-IRM4PNIE.mjs} +6 -6
  62. package/dist/cli/concurrent-runs-help-RGKC4GDM.js +22 -0
  63. package/dist/cli/{csv-R45YJYUO.mjs → csv-6T4CONXY.mjs} +4 -4
  64. package/dist/cli/{csv-DWC44DLD.js → csv-UEFHJV5P.js} +13 -13
  65. package/dist/cli/{db-XZXNKW7B.mjs → db-P6SN3JUE.mjs} +6 -6
  66. package/dist/cli/{db-XIN3KF47.js → db-PNDYQRRC.js} +27 -27
  67. package/dist/cli/describe-DDP4Q7SK.js +50 -0
  68. package/dist/cli/{describe-6KSAHJBD.mjs → describe-U2ZIQ4JH.mjs} +18 -18
  69. package/dist/cli/{executions-C3UZLR7Y.js → executions-7AOZES2Z.js} +8 -8
  70. package/dist/cli/{executions-RSPQRWYL.mjs → executions-WELIUVIV.mjs} +6 -6
  71. package/dist/cli/{feedback-7RCSKLW4.mjs → feedback-66WWUWIR.mjs} +6 -6
  72. package/dist/cli/{feedback-A7WP67XL.js → feedback-XTTK5GLD.js} +14 -14
  73. package/dist/cli/git-53OSBVPB.js +26 -0
  74. package/dist/cli/{git-JE6TFEK4.mjs → git-S23WMQAB.mjs} +5 -5
  75. package/dist/cli/index.js +143 -143
  76. package/dist/cli/index.mjs +45 -45
  77. package/dist/cli/{integrations-DEU3ZW5P.mjs → integrations-DEHG2ILN.mjs} +7 -7
  78. package/dist/cli/{integrations-L2D3EY3H.js → integrations-MPKN5JRT.js} +20 -20
  79. package/dist/cli/{legacy-noops-TL5PBCVQ.mjs → legacy-noops-7TU2COQH.mjs} +6 -6
  80. package/dist/cli/{legacy-noops-AHTEO6EF.js → legacy-noops-IKVIOTDJ.js} +9 -9
  81. package/dist/cli/{mcp-KXR7YJEG.js → mcp-5ZFZKBX2.js} +24 -24
  82. package/dist/cli/{mcp-PVRF5CGK.mjs → mcp-BGUKF2AA.mjs} +4 -4
  83. package/dist/cli/{monitors-BMGSROH3.mjs → monitors-2QZUTM7K.mjs} +7 -7
  84. package/dist/cli/{monitors-YHF6RQGU.js → monitors-EUSWYOUL.js} +100 -100
  85. package/dist/cli/{org-OO6LQPS6.mjs → org-FDA5EGQC.mjs} +6 -6
  86. package/dist/cli/{org-IQJO6DJ7.js → org-W4S2QIOX.js} +121 -121
  87. package/dist/cli/{outcomes-6QO6NEKO.mjs → outcomes-KZ7SM5TM.mjs} +6 -6
  88. package/dist/cli/{outcomes-NAEAOCNT.js → outcomes-WF34PZAX.js} +14 -14
  89. package/dist/cli/{play-MZQSOYVV.mjs → play-XHHJYBBZ.mjs} +19 -19
  90. package/dist/cli/{play-TYIBTW4E.js → play-XYJBKWRX.js} +324 -324
  91. package/dist/cli/{providers-JDSSPMWH.js → providers-SCT2LUCO.js} +9 -9
  92. package/dist/cli/{providers-JR4OWXRX.mjs → providers-WHPZMDA6.mjs} +6 -6
  93. package/dist/cli/{quickstart-T363ASLH.js → quickstart-IXLB34QZ.js} +6 -6
  94. package/dist/cli/{quickstart-JBX6BKGZ.mjs → quickstart-L45XFREM.mjs} +4 -4
  95. package/dist/cli/{run-J3KWBIXA.js → run-EZCUNFI7.js} +44 -44
  96. package/dist/cli/{run-6PWTGRJI.mjs → run-SAWTV6NP.mjs} +23 -23
  97. package/dist/cli/{search-XQG7UXAE.mjs → search-GW2P4KNN.mjs} +7 -7
  98. package/dist/cli/search-S5KQIDCG.js +32 -0
  99. package/dist/cli/{search-output-DNONJFPF.mjs → search-output-ASU6D6XX.mjs} +4 -4
  100. package/dist/cli/{search-output-YZYLNDU6.js → search-output-WRDJJFBW.js} +6 -6
  101. package/dist/cli/{secrets-SCKPXIT7.js → secrets-AAV7JKPF.js} +15 -15
  102. package/dist/cli/{secrets-MR7VXG74.mjs → secrets-N5EAETGP.mjs} +6 -6
  103. package/dist/cli/sessions-H33DKDTF.js +23 -0
  104. package/dist/cli/{sessions-MPIJTGWQ.mjs → sessions-WYISBB4D.mjs} +6 -6
  105. package/dist/cli/{settings-YPKR5JFF.js → settings-WOIN3AIB.js} +85 -85
  106. package/dist/cli/{settings-Y5NW74ER.mjs → settings-X7BTX2N3.mjs} +12 -12
  107. package/dist/cli/{setup-5RJCLRZI.mjs → setup-APLGF5BY.mjs} +9 -9
  108. package/dist/cli/{setup-673Q3LGR.js → setup-J3RS6UKU.js} +49 -49
  109. package/dist/cli/skills-7PT2KDQN.js +37 -0
  110. package/dist/cli/{skills-2QVBD4LD.mjs → skills-UGPVOIYQ.mjs} +7 -7
  111. package/dist/cli/{tools-627KG34F.mjs → tools-6WNR75VQ.mjs} +17 -17
  112. package/dist/cli/tools-Q2PVYNUE.js +57 -0
  113. package/dist/cli/update-C64JFIMU.js +37 -0
  114. package/dist/cli/{update-535TTARD.mjs → update-XG2EJRAG.mjs} +9 -9
  115. package/dist/cli/{views-FQNWZUWB.js → views-FSB6OV5N.js} +21 -21
  116. package/dist/cli/{views-3M24ZTXA.mjs → views-LUNVYDBY.mjs} +6 -6
  117. package/dist/cli/{workflow-H6F7WAOE.js → workflow-RWTUI4GA.js} +17 -17
  118. package/dist/cli/{workflow-CN46XZPG.mjs → workflow-TEJ7J2EQ.mjs} +7 -7
  119. package/dist/index.js +9 -9
  120. package/dist/index.mjs +6 -6
  121. package/dist/install-integrity.json +112 -112
  122. package/dist/release.d.mts +1 -1
  123. package/dist/release.d.ts +1 -1
  124. package/dist/release.js +2 -2
  125. package/dist/release.mjs +1 -1
  126. package/dist/server.js +5 -5
  127. package/dist/server.mjs +3 -3
  128. package/package.json +1 -1
  129. package/dist/cli/auth-R2S7KYAA.js +0 -44
  130. package/dist/cli/concurrent-runs-help-TKAZVMA4.js +0 -22
  131. package/dist/cli/describe-WLRAQDYC.js +0 -50
  132. package/dist/cli/git-E6XV5MEY.js +0 -26
  133. package/dist/cli/search-DPVHT5MJ.js +0 -32
  134. package/dist/cli/sessions-VNWLXJR2.js +0 -23
  135. package/dist/cli/skills-YGFFPGCR.js +0 -37
  136. package/dist/cli/tools-2BC7K3ZU.js +0 -57
  137. package/dist/cli/update-HWEOSPDS.js +0 -37
@@ -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.560',
208
+ version: '0.3.562',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -116,6 +116,7 @@ import {
116
116
  EARLY_SANDBOX_NARROW_MIN_STABLE_MS,
117
117
  EARLY_SANDBOX_NARROW_PREFIX,
118
118
  narrowEarlySandboxAllowlist,
119
+ EARLY_SANDBOX_GATEWAY_PINNED_ADDRESSES,
119
120
  type EarlySandboxEgressRefusal,
120
121
  type EarlySandboxNarrowedAllowlist,
121
122
  type EarlySandboxNarrowRefusal,
@@ -911,6 +912,11 @@ function emitModalStage(
911
912
  runId: context.runId ?? null,
912
913
  playName: context.playName ?? null,
913
914
  stage,
915
+ // Early-start stages name their org so per-org monitoring reads it
916
+ // directly; other stages are unchanged.
917
+ ...(stage.startsWith('early:')
918
+ ? { orgId: context.orgId ?? null }
919
+ : {}),
914
920
  ...extra,
915
921
  atMs: Date.now(),
916
922
  }),
@@ -1503,6 +1509,8 @@ const earlyModalPreboots = new WeakMap<
1503
1509
  */
1504
1510
  export async function startEarlyModalPreboot(input: {
1505
1511
  key: string;
1512
+ /** Logged with each pre-boot event; the key is already org-scoped. */
1513
+ orgId?: string;
1506
1514
  sandbox: Pick<ModalSandbox, 'exec' | 'sandboxId'>;
1507
1515
  bakedRunner: Promise<{ hash: string; path: string } | undefined>;
1508
1516
  workDir: string;
@@ -1518,6 +1526,7 @@ export async function startEarlyModalPreboot(input: {
1518
1526
  ): EarlyModalPreboot => {
1519
1527
  logEarlyModalSandbox('preboot_failed', {
1520
1528
  key: input.key,
1529
+ orgId: input.orgId ?? null,
1521
1530
  sandboxId: input.sandbox.sandboxId,
1522
1531
  status,
1523
1532
  reason,
@@ -1584,6 +1593,7 @@ export async function startEarlyModalPreboot(input: {
1584
1593
  state.exitCode = code;
1585
1594
  logEarlyModalSandbox('preboot_exited', {
1586
1595
  key: input.key,
1596
+ orgId: input.orgId ?? null,
1587
1597
  sandboxId: input.sandbox.sandboxId,
1588
1598
  exitCode: code,
1589
1599
  aliveMs: Date.now() - startedAtMs,
@@ -1593,6 +1603,7 @@ export async function startEarlyModalPreboot(input: {
1593
1603
  );
1594
1604
  logEarlyModalSandbox('preboot_started', {
1595
1605
  key: input.key,
1606
+ orgId: input.orgId ?? null,
1596
1607
  sandboxId: input.sandbox.sandboxId,
1597
1608
  elapsedMs: Date.now() - startedAtMs,
1598
1609
  });
@@ -1884,6 +1895,7 @@ async function createEarlyModalSandbox(
1884
1895
  const sandbox = await awaitEarlyCreate(createEarly());
1885
1896
  logEarlyModalSandbox('created', {
1886
1897
  key,
1898
+ orgId,
1887
1899
  workflowId: input.workflowId,
1888
1900
  sandboxId: sandbox.sandboxId,
1889
1901
  hintToRequestMs: createRequestedAtMs - hintAtMs,
@@ -1903,6 +1915,7 @@ async function createEarlyModalSandbox(
1903
1915
  sandbox,
1904
1916
  startEarlyModalPreboot({
1905
1917
  key,
1918
+ orgId,
1906
1919
  sandbox,
1907
1920
  bakedRunner: modalBakedRunnerExpectation({
1908
1921
  imageBaked: true,
@@ -2022,7 +2035,8 @@ export function startEarlyModalSandboxEgressWatch(): void {
2022
2035
  * EN (per-run; granted only through a per-organization fast_launch@7 pin): an early sandbox without the sidecar
2023
2036
  * carries a narrowed allowlist (`narrowEarlySandboxAllowlist`: each gateway
2024
2037
  * IPv4 as a /32, contained in the deployment's, from an address set stable
2025
- * for EARLY_SANDBOX_NARROW_MIN_STABLE_MS) instead of the deployment's. Its
2038
+ * for EARLY_SANDBOX_NARROW_MIN_STABLE_MS or equal to the pinned long-lived
2039
+ * gateway addresses) instead of the deployment's. Its
2026
2040
  * egress key names that list, so only a launch whose own fresh derivation
2027
2041
  * gives the same list adopts it; any other launch misses and creates its own
2028
2042
  * sandbox with the deployment's allowlist, byte-identical to today.
@@ -2118,6 +2132,7 @@ export function earlyModalNarrowedAllowlist(input: {
2118
2132
  outboundCidrAllowlist: input.outboundCidrAllowlist,
2119
2133
  prefix: EARLY_SANDBOX_NARROW_PREFIX,
2120
2134
  minStableMs: EARLY_SANDBOX_NARROW_MIN_STABLE_MS,
2135
+ pinnedAddresses: EARLY_SANDBOX_GATEWAY_PINNED_ADDRESSES,
2121
2136
  gatewayHosts: earlySandboxGatewayHosts(),
2122
2137
  gateway: gateway.state(),
2123
2138
  nowMs: input.nowMs ?? Date.now(),
@@ -262,6 +262,52 @@ export const EARLY_SANDBOX_NARROW_PREFIX = 32;
262
262
  */
263
263
  export const EARLY_SANDBOX_NARROW_MIN_STABLE_MS = 30 * 60_000;
264
264
 
265
+ /**
266
+ * Gateway addresses known to be long-lived, by host: the Production gateway
267
+ * apps' Fly shared public IPv4s (`flyctl ips list`, read 2026-11-27; the
268
+ * address belongs to the app for its lifetime). The stability window exists
269
+ * because one process cannot tell a long-lived address set from one that
270
+ * just changed; this is that evidence held outside the process, so a worker
271
+ * that has just booted does not refuse EN for its first 30 minutes, and every
272
+ * worker derives the same narrowed list (adoption crosses workers).
273
+ *
274
+ * It only waives the window, and only when the resolved hosts are exactly
275
+ * pinned and the resolved address set equals their pinned addresses; any
276
+ * other host (Preview) or a changed address falls back to the window. When a
277
+ * gateway's address changes, update this map.
278
+ */
279
+ export const EARLY_SANDBOX_GATEWAY_PINNED_ADDRESSES: Readonly<
280
+ Record<string, readonly string[]>
281
+ > = {
282
+ 'deepline-runtime-execution-relay.fly.dev': ['66.241.125.56'],
283
+ 'deepline-runtime-receipt-gateway.fly.dev': ['66.241.125.202'],
284
+ };
285
+
286
+ /**
287
+ * Whether a resolved gateway state matches the pinned long-lived addresses:
288
+ * every host pinned, and the address set equal to the union of their pins.
289
+ */
290
+ export function earlySandboxGatewayAddressesPinned(
291
+ gateway: EarlySandboxGatewayAddresses,
292
+ pinned: Readonly<
293
+ Record<string, readonly string[]>
294
+ > = EARLY_SANDBOX_GATEWAY_PINNED_ADDRESSES,
295
+ ): boolean {
296
+ if (gateway.status !== 'resolved' || gateway.hosts.length === 0) return false;
297
+ const expected = new Set<string>();
298
+ for (const host of gateway.hosts) {
299
+ if (!Object.prototype.hasOwnProperty.call(pinned, host)) return false;
300
+ const addresses = pinned[host]!;
301
+ if (addresses.length === 0) return false;
302
+ for (const address of addresses) expected.add(address);
303
+ }
304
+ const actual = new Set(gateway.addresses);
305
+ return (
306
+ actual.size === expected.size &&
307
+ [...actual].every((address) => expected.has(address))
308
+ );
309
+ }
310
+
265
311
  /**
266
312
  * An allowlist for one early sandbox that only shrinks the deployment's:
267
313
  * each current gateway address masked to `prefix` (24..32), kept only when
@@ -272,7 +318,8 @@ export const EARLY_SANDBOX_NARROW_MIN_STABLE_MS = 30 * 60_000;
272
318
  * `earlySandboxEgressRefusal` for the same gateway state.
273
319
  *
274
320
  * With `minStableMs`, it also refuses (`egress_narrow_unstable`) unless the
275
- * gateway address set has stayed the same for at least that long.
321
+ * gateway address set has stayed the same for at least that long, or equals
322
+ * the `pinnedAddresses` long-lived set (`earlySandboxGatewayAddressesPinned`).
276
323
  *
277
324
  * Used only behind the per-run EN switch (Modal early create and adoption),
278
325
  * which only a per-organization fast_launch@7 pin grants.
@@ -284,6 +331,8 @@ export function narrowEarlySandboxAllowlist(input: {
284
331
  gateway: EarlySandboxGatewayAddresses;
285
332
  nowMs: number;
286
333
  minStableMs?: number;
334
+ /** Long-lived addresses by host that waive `minStableMs`; none by default. */
335
+ pinnedAddresses?: Readonly<Record<string, readonly string[]>>;
287
336
  }): EarlySandboxNarrowedAllowlist {
288
337
  if (
289
338
  !Number.isInteger(input.prefix) ||
@@ -302,7 +351,13 @@ export function narrowEarlySandboxAllowlist(input: {
302
351
  }
303
352
  const fresh = freshGatewayAddresses(input);
304
353
  if ('refused' in fresh) return fresh;
305
- if (input.minStableMs !== undefined) {
354
+ if (
355
+ input.minStableMs !== undefined &&
356
+ !(
357
+ input.pinnedAddresses &&
358
+ earlySandboxGatewayAddressesPinned(input.gateway, input.pinnedAddresses)
359
+ )
360
+ ) {
306
361
  const stableSinceMs =
307
362
  input.gateway.status === 'resolved'
308
363
  ? input.gateway.stableSinceMs
@@ -183,6 +183,18 @@ export class EarlySandboxRegistry<
183
183
  return this.#entries.has(key);
184
184
  }
185
185
 
186
+ /**
187
+ * Whether a hint for `key` already started this process's early sandbox:
188
+ * still held, or taken by a launch within the entry TTL. A redelivered
189
+ * request (same server-made run id) then starts no second sandbox, which
190
+ * no launch would adopt.
191
+ */
192
+ hinted(key: string): boolean {
193
+ return this.#entries.has(key) || this.#taken.has(key);
194
+ }
195
+
196
+ readonly #taken = new Set<string>();
197
+
186
198
  /** This process's early sandboxes not yet adopted, reaped or expired. */
187
199
  outstanding(): number {
188
200
  return this.#outstanding.size;
@@ -214,6 +226,11 @@ export class EarlySandboxRegistry<
214
226
  const entry = this.#entries.get(key);
215
227
  this.#entries.delete(key);
216
228
  if (entry) {
229
+ this.#taken.add(key);
230
+ setTimeout(
231
+ () => this.#taken.delete(key),
232
+ EARLY_SANDBOX_REAP_AFTER_MS * 2,
233
+ ).unref?.();
217
234
  this.#release(entry);
218
235
  for (const handler of this.#takeHandlers) handler(key);
219
236
  }
@@ -466,7 +483,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
466
483
  workflowId: input.workflowId,
467
484
  ...scope,
468
485
  });
469
- if (adapter.registry.has(key)) return false;
486
+ if (adapter.registry.hinted(key)) return false;
470
487
  const hintAtMs = Date.now();
471
488
  const started = (async () =>
472
489
  await adapter.createEarly({
@@ -478,6 +495,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
478
495
  }))().catch((error: unknown) => {
479
496
  logEarlySandbox(adapter.logScope, 'create_failed', {
480
497
  key,
498
+ orgId,
481
499
  error: error instanceof Error ? error.message : String(error),
482
500
  });
483
501
  return null;
@@ -485,6 +503,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
485
503
  adapter.registry.put(key, started);
486
504
  logEarlySandbox(adapter.logScope, 'hint_accepted', {
487
505
  key,
506
+ orgId,
488
507
  workflowId: input.workflowId,
489
508
  });
490
509
  return true;
@@ -549,7 +568,8 @@ export async function reapEarlySandboxById(input: {
549
568
  sleep?: (ms: number) => Promise<void>;
550
569
  }): Promise<'not_early' | 'terminated'> {
551
570
  const fresh = await input.calls.fromId(input.sandboxId);
552
- if (!isUnadoptedEarlySandbox(await fresh.getTags())) return 'not_early';
571
+ const tags = await fresh.getTags();
572
+ if (!isUnadoptedEarlySandbox(tags)) return 'not_early';
553
573
  const confirmAttempts = await terminateEarlySandboxConfirmed({
554
574
  sandbox: fresh,
555
575
  readExitCode: readEarlySandboxExitCode(input.calls),
@@ -558,6 +578,7 @@ export async function reapEarlySandboxById(input: {
558
578
  });
559
579
  logEarlySandbox(input.calls.logScope, 'reaped_unadopted', {
560
580
  key: input.key,
581
+ orgId: tags.orgId ?? null,
561
582
  sandboxId: input.sandboxId,
562
583
  confirmAttempts,
563
584
  });
@@ -686,6 +707,7 @@ export async function sweepOrphanEarlySandboxes(input: {
686
707
  input.registry?.settle(sandboxId);
687
708
  logEarlySandbox(input.calls.logScope, 'swept_orphan', {
688
709
  key: tags.earlyKey ?? null,
710
+ orgId: tags.orgId ?? null,
689
711
  sandboxId,
690
712
  ageMs,
691
713
  confirmAttempts,
@@ -0,0 +1,44 @@
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 _chunk7IHSJ3RDjs = require('./chunk-7IHSJ3RD.js');
18
+ require('./chunk-J5P7VGV5.js');
19
+ require('./chunk-EVZDU7CF.js');
20
+ require('./chunk-5COJEZSB.js');
21
+ require('./chunk-6VLFQZK6.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-LFQJW4S2.js');
24
+ require('./chunk-CFJFUVX2.js');
25
+ require('./chunk-IQJQB7J6.js');
26
+ require('./chunk-OG64RBAC.js');
27
+ require('./chunk-COGTRVWW.js');
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ exports.EXIT_WORKSPACE_MISMATCH = _chunk7IHSJ3RDjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk7IHSJ3RDjs.authStatusLine; exports.clearPendingClaim = _chunk7IHSJ3RDjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk7IHSJ3RDjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk7IHSJ3RDjs.handleRegister; exports.handleStatus = _chunk7IHSJ3RDjs.handleStatus; exports.handleWait = _chunk7IHSJ3RDjs.handleWait; exports.httpJson = _chunk7IHSJ3RDjs.httpJson; exports.readPendingAuthClaim = _chunk7IHSJ3RDjs.readPendingAuthClaim; exports.readStatusBanner = _chunk7IHSJ3RDjs.readStatusBanner; exports.registerAuthCommands = _chunk7IHSJ3RDjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunk7IHSJ3RDjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunk7IHSJ3RDjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk7IHSJ3RDjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk7IHSJ3RDjs.statusBannerLine;
@@ -14,15 +14,15 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-JHS7WKRS.mjs";
18
- import "./chunk-G33LSF4T.mjs";
19
- import "./chunk-CQJMFUMK.mjs";
20
- import "./chunk-AMUMEL4C.mjs";
17
+ } from "./chunk-LK4LR4K7.mjs";
18
+ import "./chunk-RKB536LB.mjs";
19
+ import "./chunk-XHZFA67G.mjs";
20
+ import "./chunk-L4KUAJFR.mjs";
21
21
  import "./chunk-ASB47RXJ.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-Z3A2S3QM.mjs";
24
24
  import "./chunk-2MGZAI54.mjs";
25
- import "./chunk-XLM7L4UY.mjs";
25
+ import "./chunk-WFVL6A7I.mjs";
26
26
  import "./chunk-WZYKRD7T.mjs";
27
27
  import "./chunk-KRD6H754.mjs";
28
28
  export {