deepline 0.3.562 → 0.3.564

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 (138) 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 +2 -0
  3. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +50 -7
  4. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +44 -1
  5. package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +8 -0
  6. package/dist/cli/auth-645UXOAZ.js +44 -0
  7. package/dist/cli/{auth-OFHWBJ2W.mjs → auth-PXZ7JZUT.mjs} +5 -5
  8. package/dist/cli/{billing-PPOC7TAY.mjs → billing-AMYFMDZL.mjs} +8 -8
  9. package/dist/cli/{billing-BORJ3ZHJ.js → billing-OY2ZN5XJ.js} +99 -99
  10. package/dist/cli/{chunk-GWJ4EOW2.mjs → chunk-2ISK6CUL.mjs} +11 -11
  11. package/dist/cli/{chunk-LK4LR4K7.mjs → chunk-2PMHEUED.mjs} +3 -3
  12. package/dist/cli/{chunk-R5PPP3JU.js → chunk-2SKEXMFV.js} +5 -5
  13. package/dist/cli/{chunk-5COJEZSB.js → chunk-4JQ6MHE7.js} +4 -4
  14. package/dist/cli/{chunk-RKB536LB.mjs → chunk-4NNNJLAZ.mjs} +2 -2
  15. package/dist/cli/{chunk-EVZDU7CF.js → chunk-4SV43Z64.js} +3 -3
  16. package/dist/cli/{chunk-UC2ATYB3.mjs → chunk-56P2BEVI.mjs} +2 -2
  17. package/dist/cli/{chunk-3OJLUVOS.mjs → chunk-655PNNU7.mjs} +1 -1
  18. package/dist/cli/{chunk-KJDS2X5S.mjs → chunk-7DU4VODD.mjs} +2 -2
  19. package/dist/cli/{chunk-GAN6UYEN.js → chunk-7NSHH3NB.js} +5 -5
  20. package/dist/cli/{chunk-P6XJRHLF.js → chunk-BRQVKZWJ.js} +7 -7
  21. package/dist/cli/{chunk-GAMCJW6E.mjs → chunk-CXN574UU.mjs} +1 -1
  22. package/dist/cli/{chunk-UZ4ELBHM.mjs → chunk-DHZOC2QX.mjs} +2 -2
  23. package/dist/cli/{chunk-WDKU7NOR.mjs → chunk-DTTMFSNG.mjs} +1 -1
  24. package/dist/cli/{chunk-EHUUHKWY.mjs → chunk-DYTTZHYX.mjs} +5 -5
  25. package/dist/cli/{chunk-RYWWBTDB.js → chunk-GWTFA5GD.js} +3 -3
  26. package/dist/cli/{chunk-SQFWIUNP.mjs → chunk-HEWVHSNN.mjs} +4 -4
  27. package/dist/cli/{chunk-3BV2OD25.js → chunk-HGGIWRA5.js} +48 -48
  28. package/dist/cli/{chunk-6BGEW3KU.js → chunk-HPXN5QZZ.js} +20 -20
  29. package/dist/cli/{chunk-7IHSJ3RD.js → chunk-HXZSXPT2.js} +53 -53
  30. package/dist/cli/{chunk-GH5R65SB.js → chunk-I2GVGCMM.js} +12 -12
  31. package/dist/cli/{chunk-Z2FC6UQQ.js → chunk-I4XWKMGR.js} +15 -15
  32. package/dist/cli/{chunk-RFB52LP5.js → chunk-IW3N7ARM.js} +8 -8
  33. package/dist/cli/{chunk-7DRCIDPW.mjs → chunk-JVSHMUGE.mjs} +3 -3
  34. package/dist/cli/{chunk-YB6N6WKX.js → chunk-KBGP4CS5.js} +10 -10
  35. package/dist/cli/{chunk-IQJQB7J6.js → chunk-KR76WIOX.js} +1 -1
  36. package/dist/cli/{chunk-5YQVEV7I.mjs → chunk-MY45K7SA.mjs} +5 -5
  37. package/dist/cli/{chunk-5VXK34DQ.mjs → chunk-OCLHNDVN.mjs} +5 -5
  38. package/dist/cli/{chunk-ZQLEEOZR.mjs → chunk-QHBYLHOG.mjs} +2 -2
  39. package/dist/cli/{chunk-5XS5BTMC.mjs → chunk-QQTZ6KG4.mjs} +4 -4
  40. package/dist/cli/{chunk-7HFWEQ6Y.js → chunk-R5555CB5.js} +2 -2
  41. package/dist/cli/{chunk-LJXFCEP2.js → chunk-RBTOZO5M.js} +41 -41
  42. package/dist/cli/{chunk-LXL7OZOG.mjs → chunk-RK5EKJAT.mjs} +1 -1
  43. package/dist/cli/{chunk-YT4WIYFT.js → chunk-RKG2E2JF.js} +9 -9
  44. package/dist/cli/{chunk-QC3NTBF7.mjs → chunk-RW6PFYT5.mjs} +5 -5
  45. package/dist/cli/{chunk-WFVL6A7I.mjs → chunk-TK6YKQ45.mjs} +1 -1
  46. package/dist/cli/{chunk-L4KUAJFR.mjs → chunk-TVF7XVPN.mjs} +1 -1
  47. package/dist/cli/{chunk-YAXYFPBF.mjs → chunk-UWX4TTJU.mjs} +2 -2
  48. package/dist/cli/{chunk-CIEMDAJE.js → chunk-V2GHSOQB.js} +100 -100
  49. package/dist/cli/{chunk-YX47WHVT.js → chunk-V2SNCH5X.js} +6 -6
  50. package/dist/cli/{chunk-5NGS4RLF.js → chunk-WDXXHTIF.js} +23 -23
  51. package/dist/cli/{chunk-J5P7VGV5.js → chunk-WSEMXB7X.js} +20 -20
  52. package/dist/cli/{chunk-USA6QRDO.mjs → chunk-WXB7PU3O.mjs} +1 -1
  53. package/dist/cli/{chunk-AAIYXQRJ.mjs → chunk-XP6ALUAZ.mjs} +2 -2
  54. package/dist/cli/{chunk-QWB4VW4T.js → chunk-XVYU3J2J.js} +13 -13
  55. package/dist/cli/{chunk-4O47WP3B.js → chunk-XWDCKDUP.js} +26 -26
  56. package/dist/cli/{chunk-AASSDBQ3.js → chunk-Y2FZJRRM.js} +2 -2
  57. package/dist/cli/{chunk-5KMZR36E.mjs → chunk-YIDXJD5L.mjs} +1 -1
  58. package/dist/cli/{chunk-PDHLHEUL.js → chunk-YMQOTCLU.js} +2 -2
  59. package/dist/cli/{chunk-J7XEUV5W.mjs → chunk-ZJ23RI3B.mjs} +2 -2
  60. package/dist/cli/{chunk-XHZFA67G.mjs → chunk-ZOITMXVO.mjs} +1 -1
  61. package/dist/cli/{chunk-UVZQR7I6.js → chunk-ZZW5A4HZ.js} +5 -5
  62. package/dist/cli/{concurrent-runs-help-IRM4PNIE.mjs → concurrent-runs-help-5GPKNDAY.mjs} +6 -6
  63. package/dist/cli/concurrent-runs-help-QKZXIMSW.js +22 -0
  64. package/dist/cli/{csv-6T4CONXY.mjs → csv-ARPN6J6K.mjs} +4 -4
  65. package/dist/cli/{csv-UEFHJV5P.js → csv-X3FHV56H.js} +13 -13
  66. package/dist/cli/{db-P6SN3JUE.mjs → db-2HWSS3MA.mjs} +6 -6
  67. package/dist/cli/{db-PNDYQRRC.js → db-WINZJRWC.js} +27 -27
  68. package/dist/cli/{describe-U2ZIQ4JH.mjs → describe-333JCD22.mjs} +18 -18
  69. package/dist/cli/describe-6TJYCPFQ.js +50 -0
  70. package/dist/cli/{executions-WELIUVIV.mjs → executions-JYYXIRE6.mjs} +6 -6
  71. package/dist/cli/{executions-7AOZES2Z.js → executions-UHZHVQLO.js} +8 -8
  72. package/dist/cli/{feedback-XTTK5GLD.js → feedback-6G4SDI7M.js} +14 -14
  73. package/dist/cli/{feedback-66WWUWIR.mjs → feedback-KNGQ4VMG.mjs} +6 -6
  74. package/dist/cli/{git-S23WMQAB.mjs → git-DREIWOYN.mjs} +5 -5
  75. package/dist/cli/git-TQNP4MAD.js +26 -0
  76. package/dist/cli/index.js +143 -143
  77. package/dist/cli/index.mjs +45 -45
  78. package/dist/cli/{integrations-DEHG2ILN.mjs → integrations-UY3T3ZHA.mjs} +7 -7
  79. package/dist/cli/{integrations-MPKN5JRT.js → integrations-V6EO6JAM.js} +20 -20
  80. package/dist/cli/{legacy-noops-IKVIOTDJ.js → legacy-noops-7LZ2HNLB.js} +9 -9
  81. package/dist/cli/{legacy-noops-7TU2COQH.mjs → legacy-noops-FSL5Y4TO.mjs} +6 -6
  82. package/dist/cli/{mcp-5ZFZKBX2.js → mcp-TAVIRUQC.js} +24 -24
  83. package/dist/cli/{mcp-BGUKF2AA.mjs → mcp-WDJV3OCV.mjs} +4 -4
  84. package/dist/cli/{monitors-EUSWYOUL.js → monitors-HGT2RVR5.js} +100 -100
  85. package/dist/cli/{monitors-2QZUTM7K.mjs → monitors-L5FSJSVD.mjs} +7 -7
  86. package/dist/cli/{org-W4S2QIOX.js → org-4LNYSIEM.js} +121 -121
  87. package/dist/cli/{org-FDA5EGQC.mjs → org-J5DJCLTU.mjs} +6 -6
  88. package/dist/cli/{outcomes-WF34PZAX.js → outcomes-4QO264GU.js} +14 -14
  89. package/dist/cli/{outcomes-KZ7SM5TM.mjs → outcomes-5DZ5EZ5Q.mjs} +6 -6
  90. package/dist/cli/{play-XYJBKWRX.js → play-FZY7NZAM.js} +324 -324
  91. package/dist/cli/{play-XHHJYBBZ.mjs → play-SETNQCBB.mjs} +19 -19
  92. package/dist/cli/{providers-SCT2LUCO.js → providers-754HLYAW.js} +9 -9
  93. package/dist/cli/{providers-WHPZMDA6.mjs → providers-PIS6IQVA.mjs} +6 -6
  94. package/dist/cli/{quickstart-IXLB34QZ.js → quickstart-2TIUCHQF.js} +6 -6
  95. package/dist/cli/{quickstart-L45XFREM.mjs → quickstart-5P4NYWZK.mjs} +4 -4
  96. package/dist/cli/{run-EZCUNFI7.js → run-OQNK7G3I.js} +44 -44
  97. package/dist/cli/{run-SAWTV6NP.mjs → run-WAN4VZMS.mjs} +23 -23
  98. package/dist/cli/{search-GW2P4KNN.mjs → search-PTX7IMBB.mjs} +7 -7
  99. package/dist/cli/search-VXKJDQA5.js +32 -0
  100. package/dist/cli/{search-output-WRDJJFBW.js → search-output-AXVUC3TF.js} +6 -6
  101. package/dist/cli/{search-output-ASU6D6XX.mjs → search-output-N44NPUN6.mjs} +4 -4
  102. package/dist/cli/{secrets-AAV7JKPF.js → secrets-32WRPZB2.js} +15 -15
  103. package/dist/cli/{secrets-N5EAETGP.mjs → secrets-ZODIPUMI.mjs} +6 -6
  104. package/dist/cli/{sessions-WYISBB4D.mjs → sessions-JRIS3JMT.mjs} +6 -6
  105. package/dist/cli/sessions-MW3SUF7R.js +23 -0
  106. package/dist/cli/{settings-X7BTX2N3.mjs → settings-OI3OHCD5.mjs} +12 -12
  107. package/dist/cli/{settings-WOIN3AIB.js → settings-YIZUG6T3.js} +85 -85
  108. package/dist/cli/{setup-APLGF5BY.mjs → setup-4QQ33WUA.mjs} +9 -9
  109. package/dist/cli/{setup-J3RS6UKU.js → setup-AF3I4UPE.js} +49 -49
  110. package/dist/cli/skills-ECMGSQM4.js +37 -0
  111. package/dist/cli/{skills-UGPVOIYQ.mjs → skills-EITRSX56.mjs} +7 -7
  112. package/dist/cli/{tools-6WNR75VQ.mjs → tools-CMOLGIDR.mjs} +17 -17
  113. package/dist/cli/tools-QTTCIEQM.js +57 -0
  114. package/dist/cli/update-N3YQGALD.js +37 -0
  115. package/dist/cli/{update-XG2EJRAG.mjs → update-PGEARBAI.mjs} +9 -9
  116. package/dist/cli/{views-LUNVYDBY.mjs → views-2H77STII.mjs} +6 -6
  117. package/dist/cli/{views-FSB6OV5N.js → views-KFLXOZ5N.js} +21 -21
  118. package/dist/cli/{workflow-RWTUI4GA.js → workflow-HCEMVZAZ.js} +17 -17
  119. package/dist/cli/{workflow-TEJ7J2EQ.mjs → workflow-XWMAYWVX.mjs} +7 -7
  120. package/dist/index.js +9 -9
  121. package/dist/index.mjs +6 -6
  122. package/dist/install-integrity.json +112 -112
  123. package/dist/release.d.mts +1 -1
  124. package/dist/release.d.ts +1 -1
  125. package/dist/release.js +2 -2
  126. package/dist/release.mjs +1 -1
  127. package/dist/server.js +5 -5
  128. package/dist/server.mjs +3 -3
  129. package/package.json +1 -1
  130. package/dist/cli/auth-FM3JO6FN.js +0 -44
  131. package/dist/cli/concurrent-runs-help-RGKC4GDM.js +0 -22
  132. package/dist/cli/describe-DDP4Q7SK.js +0 -50
  133. package/dist/cli/git-53OSBVPB.js +0 -26
  134. package/dist/cli/search-S5KQIDCG.js +0 -32
  135. package/dist/cli/sessions-H33DKDTF.js +0 -23
  136. package/dist/cli/skills-7PT2KDQN.js +0 -37
  137. package/dist/cli/tools-Q2PVYNUE.js +0 -57
  138. package/dist/cli/update-C64JFIMU.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.562',
208
+ version: '0.3.564',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -1651,6 +1651,7 @@ export async function sweepOrphanEarlyModalSandboxes(input: {
1651
1651
  nowMs?: () => number;
1652
1652
  sleep?: (ms: number) => Promise<void>;
1653
1653
  limit?: number;
1654
+ listLimit?: number;
1654
1655
  }): Promise<EarlySandboxSweepOutcome> {
1655
1656
  return await sweepOrphanEarlySandboxes({
1656
1657
  calls: earlyModalSandboxCalls(input),
@@ -1659,6 +1660,7 @@ export async function sweepOrphanEarlyModalSandboxes(input: {
1659
1660
  ...(input.nowMs === undefined ? {} : { nowMs: input.nowMs }),
1660
1661
  ...(input.sleep === undefined ? {} : { sleep: input.sleep }),
1661
1662
  ...(input.limit === undefined ? {} : { limit: input.limit }),
1663
+ ...(input.listLimit === undefined ? {} : { listLimit: input.listLimit }),
1662
1664
  });
1663
1665
  }
1664
1666
 
@@ -159,9 +159,10 @@ export type EarlySandboxEntry<TSandbox = EarlySandboxHandle> = {
159
159
  *
160
160
  * It also counts this process's outstanding early sandboxes (`outstanding`);
161
161
  * the worker lane's per-process cap reads it. One counts from `put` until the
162
- * first of: its create fails (the entry resolves null), a launch takes it
163
- * (adoption), the reaper or sweep settles its sandbox id (`settle`), or the
164
- * entry's TTL. Each path releases at most once, so no path double-counts and
162
+ * first of: its create fails (the entry resolves null), a launch adopts it
163
+ * (`settle` after the re-tag), the reaper or sweep settles its sandbox id
164
+ * (`settle`), or the entry's TTL. A launch that takes the entry but refuses
165
+ * the sandbox does not release it: the sandbox is alive until reaped. Each path releases at most once, so no path double-counts and
165
166
  * an error path never leaks a slot past the TTL.
166
167
  */
167
168
  export class EarlySandboxRegistry<
@@ -200,13 +201,28 @@ export class EarlySandboxRegistry<
200
201
  return this.#outstanding.size;
201
202
  }
202
203
 
204
+ /** The same count for one org's hints (entries put with that `orgId`). */
205
+ outstandingForOrg(orgId: string): number {
206
+ let count = 0;
207
+ for (const owner of this.#outstandingOrg.values())
208
+ if (owner === orgId) count += 1;
209
+ return count;
210
+ }
211
+
212
+ readonly #outstandingOrg = new Map<
213
+ Promise<EarlySandboxEntry<TSandbox> | null>,
214
+ string
215
+ >();
216
+
203
217
  put(
204
218
  key: string,
205
219
  entry: Promise<EarlySandboxEntry<TSandbox> | null>,
206
220
  ttlMs: number = EARLY_SANDBOX_REAP_AFTER_MS * 2,
221
+ orgId?: string,
207
222
  ): void {
208
223
  this.#entries.set(key, entry);
209
224
  this.#outstanding.add(entry);
225
+ if (orgId) this.#outstandingOrg.set(entry, orgId);
210
226
  void entry.then(
211
227
  (resolved) => {
212
228
  if (!this.#outstanding.has(entry)) return;
@@ -231,7 +247,9 @@ export class EarlySandboxRegistry<
231
247
  () => this.#taken.delete(key),
232
248
  EARLY_SANDBOX_REAP_AFTER_MS * 2,
233
249
  ).unref?.();
234
- this.#release(entry);
250
+ // Still outstanding: an adoption that refuses this sandbox leaves it
251
+ // alive until the reaper or sweep ends it. A successful adoption
252
+ // settles it by id (`settle`); otherwise the reap does, or the TTL.
235
253
  for (const handler of this.#takeHandlers) handler(key);
236
254
  }
237
255
  return entry;
@@ -257,6 +275,7 @@ export class EarlySandboxRegistry<
257
275
 
258
276
  #release(entry: Promise<EarlySandboxEntry<TSandbox> | null>): void {
259
277
  if (!this.#outstanding.delete(entry)) return;
278
+ this.#outstandingOrg.delete(entry);
260
279
  for (const [sandboxId, held] of this.#outstandingBySandboxId) {
261
280
  if (held === entry) this.#outstandingBySandboxId.delete(sandboxId);
262
281
  }
@@ -500,7 +519,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
500
519
  });
501
520
  return null;
502
521
  });
503
- adapter.registry.put(key, started);
522
+ adapter.registry.put(key, started, undefined, orgId);
504
523
  logEarlySandbox(adapter.logScope, 'hint_accepted', {
505
524
  key,
506
525
  orgId,
@@ -639,7 +658,14 @@ export function scheduleEarlySandboxReap(input: {
639
658
  export const EARLY_SANDBOX_SWEEP_INTERVAL_MS = 60_000;
640
659
  /** ±20% per interval, and a first pass in [0, 40%] of it. */
641
660
  export const EARLY_SANDBOX_SWEEP_JITTER_RATIO = 0.2;
661
+ /** Orphans one pass terminates; the rest wait for the next pass. */
642
662
  const EARLY_SANDBOX_SWEEP_LIMIT = 20;
663
+ /**
664
+ * Early sandboxes one pass reads. Larger than the termination limit so young
665
+ * (still adoptable) sandboxes, which the pass skips, cannot fill it and keep
666
+ * older orphans out of every pass on a busy worker.
667
+ */
668
+ const EARLY_SANDBOX_SWEEP_LIST_LIMIT = 100;
643
669
  const EARLY_SANDBOX_SWEEP_CONFIRM_ATTEMPTS = 5;
644
670
 
645
671
  export type EarlySandboxSweepOutcome = {
@@ -647,6 +673,8 @@ export type EarlySandboxSweepOutcome = {
647
673
  terminated: number;
648
674
  unconfirmed: number;
649
675
  young: number;
676
+ /** Orphans past this pass's termination limit, left for the next pass. */
677
+ deferred: number;
650
678
  };
651
679
 
652
680
  export async function sweepOrphanEarlySandboxes(input: {
@@ -664,9 +692,14 @@ export async function sweepOrphanEarlySandboxes(input: {
664
692
  nowMs?: () => number;
665
693
  sleep?: (ms: number) => Promise<void>;
666
694
  limit?: number;
695
+ listLimit?: number;
667
696
  }): Promise<EarlySandboxSweepOutcome> {
668
697
  const nowMs = input.nowMs ?? Date.now;
669
698
  const limit = input.limit ?? EARLY_SANDBOX_SWEEP_LIMIT;
699
+ const listLimit = Math.max(
700
+ limit,
701
+ input.listLimit ?? EARLY_SANDBOX_SWEEP_LIST_LIMIT,
702
+ );
670
703
  const ids = new Set<string>();
671
704
  // One listing: the retired F2 hedge tag is no longer swept (nothing
672
705
  // creates it, and no hedge leg ever carried an environment tag).
@@ -674,12 +707,15 @@ export async function sweepOrphanEarlySandboxes(input: {
674
707
  source: EARLY_SANDBOX_SOURCE_TAG,
675
708
  [EARLY_ENVIRONMENT_TAG]: input.environment,
676
709
  })) {
677
- if (ids.size >= limit) break;
710
+ if (ids.size >= listLimit) break;
678
711
  if (listed.sandboxId?.trim()) ids.add(listed.sandboxId.trim());
679
712
  }
680
713
  let terminated = 0;
681
714
  let unconfirmed = 0;
682
715
  let young = 0;
716
+ let deferred = 0;
717
+ // Claimed synchronously after each tag read, so at most `limit` terminate.
718
+ let claimed = 0;
683
719
  await Promise.all(
684
720
  [...ids].map(async (sandboxId) => {
685
721
  try {
@@ -697,6 +733,11 @@ export async function sweepOrphanEarlySandboxes(input: {
697
733
  young += 1;
698
734
  return;
699
735
  }
736
+ if (claimed >= limit) {
737
+ deferred += 1;
738
+ return;
739
+ }
740
+ claimed += 1;
700
741
  const confirmAttempts = await terminateEarlySandboxConfirmed({
701
742
  sandbox: fresh,
702
743
  readExitCode: readEarlySandboxExitCode(input.calls),
@@ -724,7 +765,7 @@ export async function sweepOrphanEarlySandboxes(input: {
724
765
  }
725
766
  }),
726
767
  );
727
- return { observed: ids.size, terminated, unconfirmed, young };
768
+ return { observed: ids.size, terminated, unconfirmed, young, deferred };
728
769
  }
729
770
 
730
771
  /** PB: the runner limits a pre-boot fixed, which a launch must match. */
@@ -993,6 +1034,8 @@ export async function adoptEarlySandbox<
993
1034
  // Re-tag first: from here the sandbox is an ordinary launch sandbox for
994
1035
  // every cleanup and reconciliation path, and the reaper skips it.
995
1036
  await sandbox.setTags({ ...input.createTags, earlyKey: key });
1037
+ // Adopted: it is the launch's sandbox now, no longer early capacity.
1038
+ registry.settle(sandbox.sandboxId);
996
1039
  input.emitStage('early:adopted', {
997
1040
  key,
998
1041
  how,
@@ -68,6 +68,14 @@ export const EARLY_SANDBOX_POLICY_LEAD_PROVIDER: RuntimeSandboxProviderId =
68
68
  */
69
69
  export const EARLY_SANDBOX_MAX_OUTSTANDING_PER_WORKER = 16;
70
70
 
71
+ /**
72
+ * Of those, the most one org's hints may hold. A hint is sent before credit
73
+ * admission, so without it one org's request burst could hold every slot
74
+ * (each unadopted sandbox is billed to nobody until the reaper ends it) and
75
+ * starve other orgs' early starts. A hint past it is refused the same way.
76
+ */
77
+ export const EARLY_SANDBOX_MAX_OUTSTANDING_PER_ORG_PER_WORKER = 4;
78
+
71
79
  export type EarlySandboxAdapterSelectionRefusal =
72
80
  | 'lane_lead_not_single'
73
81
  | 'adapter_missing'
@@ -89,6 +97,7 @@ export type EarlySandboxHintRefusal =
89
97
  | 'worker_draining'
90
98
  | 'no_idle_slot'
91
99
  | 'outstanding_cap'
100
+ | 'org_outstanding_cap'
92
101
  | 'listener_unavailable'
93
102
  | `listener_${EarlySandboxListenerHintRefusal}`;
94
103
 
@@ -245,12 +254,31 @@ export function outstandingEarlySandboxes(
245
254
  return total;
246
255
  }
247
256
 
257
+ /** One org's outstanding early sandboxes in this process, over every registry. */
258
+ export function outstandingEarlySandboxesForOrg(
259
+ orgId: string,
260
+ adapters: Readonly<
261
+ Partial<Record<RuntimeSandboxProviderId, EarlySandboxAdapter>>
262
+ > = EARLY_SANDBOX_ADAPTERS,
263
+ ): number {
264
+ const registries = new Set(
265
+ Object.values(adapters).flatMap((adapter) =>
266
+ adapter ? [adapter.registry] : [],
267
+ ),
268
+ );
269
+ let total = 0;
270
+ for (const registry of registries)
271
+ total += registry.outstandingForOrg(orgId);
272
+ return total;
273
+ }
274
+
248
275
  function refuseEarlySandboxHint(input: {
249
276
  reason: EarlySandboxHintRefusal;
250
277
  backend: PlayRuntimeBackendId;
251
278
  workflowId: string;
252
279
  sandboxPlacementPolicyId: string | null;
253
280
  outstanding?: number;
281
+ cap?: number;
254
282
  }): false {
255
283
  console.error(
256
284
  JSON.stringify({
@@ -263,7 +291,7 @@ function refuseEarlySandboxHint(input: {
263
291
  ? {}
264
292
  : {
265
293
  outstanding: input.outstanding,
266
- cap: EARLY_SANDBOX_MAX_OUTSTANDING_PER_WORKER,
294
+ cap: input.cap ?? EARLY_SANDBOX_MAX_OUTSTANDING_PER_WORKER,
267
295
  }),
268
296
  }),
269
297
  );
@@ -354,6 +382,21 @@ export function startWorkerLaneEarlySandbox(
354
382
  outstanding,
355
383
  });
356
384
  }
385
+ const hintOrgId = input.orgId?.trim();
386
+ if (hintOrgId) {
387
+ const orgOutstanding = outstandingEarlySandboxesForOrg(
388
+ hintOrgId,
389
+ input.adapters ?? EARLY_SANDBOX_ADAPTERS,
390
+ );
391
+ if (orgOutstanding >= EARLY_SANDBOX_MAX_OUTSTANDING_PER_ORG_PER_WORKER) {
392
+ return refuseEarlySandboxHint({
393
+ ...hint,
394
+ reason: 'org_outstanding_cap',
395
+ outstanding: orgOutstanding,
396
+ cap: EARLY_SANDBOX_MAX_OUTSTANDING_PER_ORG_PER_WORKER,
397
+ });
398
+ }
399
+ }
357
400
  const request = {
358
401
  workflowId: input.workflowId,
359
402
  orgId: input.orgId ?? null,
@@ -35,6 +35,13 @@ export function readRequestedOrgHeader(
35
35
  return orgId ? { kind: 'org', orgId } : { kind: 'absent' };
36
36
  }
37
37
  export const EXTENSION_PANEL_PATH = '/extension/plays';
38
+ /**
39
+ * The error a published extension returns for a path outside its allowlist.
40
+ * Installed extensions keep the allowlist they shipped with, so the panel can
41
+ * see this for an endpoint added after the user's extension was built.
42
+ */
43
+ export const UNSUPPORTED_EXTENSION_REQUEST =
44
+ 'This request is not supported by Deepline Plays.';
38
45
 
39
46
  export type BridgeFormEntry = [
40
47
  string,
@@ -84,6 +91,7 @@ export function isAllowedExtensionRequest(
84
91
  pathname === '/api/v2/auth/session' ||
85
92
  pathname === '/api/v2/plays' ||
86
93
  pathname === '/api/v2/runs' ||
94
+ pathname === '/api/v2/views' ||
87
95
  /^\/api\/v2\/plays\/[^/]+(?:\/sheet(?:\/export)?)?$/.test(pathname) ||
88
96
  /^\/api\/v2\/runs\/[^/]+(?:\/input)?$/.test(pathname))
89
97
  );
@@ -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 _chunkHXZSXPT2js = require('./chunk-HXZSXPT2.js');
18
+ require('./chunk-WSEMXB7X.js');
19
+ require('./chunk-4SV43Z64.js');
20
+ require('./chunk-4JQ6MHE7.js');
21
+ require('./chunk-6VLFQZK6.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-LFQJW4S2.js');
24
+ require('./chunk-CFJFUVX2.js');
25
+ require('./chunk-KR76WIOX.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 = _chunkHXZSXPT2js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkHXZSXPT2js.authStatusLine; exports.clearPendingClaim = _chunkHXZSXPT2js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkHXZSXPT2js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkHXZSXPT2js.handleRegister; exports.handleStatus = _chunkHXZSXPT2js.handleStatus; exports.handleWait = _chunkHXZSXPT2js.handleWait; exports.httpJson = _chunkHXZSXPT2js.httpJson; exports.readPendingAuthClaim = _chunkHXZSXPT2js.readPendingAuthClaim; exports.readStatusBanner = _chunkHXZSXPT2js.readStatusBanner; exports.registerAuthCommands = _chunkHXZSXPT2js.registerAuthCommands; exports.reportApprovalLinkShown = _chunkHXZSXPT2js.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkHXZSXPT2js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkHXZSXPT2js.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkHXZSXPT2js.statusBannerLine;
@@ -14,15 +14,15 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-LK4LR4K7.mjs";
18
- import "./chunk-RKB536LB.mjs";
19
- import "./chunk-XHZFA67G.mjs";
20
- import "./chunk-L4KUAJFR.mjs";
17
+ } from "./chunk-2PMHEUED.mjs";
18
+ import "./chunk-4NNNJLAZ.mjs";
19
+ import "./chunk-ZOITMXVO.mjs";
20
+ import "./chunk-TVF7XVPN.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-WFVL6A7I.mjs";
25
+ import "./chunk-TK6YKQ45.mjs";
26
26
  import "./chunk-WZYKRD7T.mjs";
27
27
  import "./chunk-KRD6H754.mjs";
28
28
  export {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  concurrentRunsLine
3
- } from "./chunk-AAIYXQRJ.mjs";
4
- import "./chunk-LK4LR4K7.mjs";
3
+ } from "./chunk-XP6ALUAZ.mjs";
4
+ import "./chunk-2PMHEUED.mjs";
5
5
  import {
6
6
  DeeplineClient
7
- } from "./chunk-YAXYFPBF.mjs";
7
+ } from "./chunk-UWX4TTJU.mjs";
8
8
  import {
9
9
  PUBLIC_PLAN_SKUS,
10
10
  iterateCursorPages,
11
11
  requireBillingIdempotencyKey
12
- } from "./chunk-LXL7OZOG.mjs";
12
+ } from "./chunk-RK5EKJAT.mjs";
13
13
  import "./chunk-FZHMNK6F.mjs";
14
14
  import "./chunk-5TYLSS4Q.mjs";
15
15
  import "./chunk-PSX3WHIH.mjs";
@@ -32,9 +32,9 @@ import {
32
32
  openInBrowser,
33
33
  printCommandEnvelope,
34
34
  shouldEmitJson
35
- } from "./chunk-RKB536LB.mjs";
36
- import "./chunk-XHZFA67G.mjs";
37
- import "./chunk-L4KUAJFR.mjs";
35
+ } from "./chunk-4NNNJLAZ.mjs";
36
+ import "./chunk-ZOITMXVO.mjs";
37
+ import "./chunk-TVF7XVPN.mjs";
38
38
  import {
39
39
  AuthError,
40
40
  ConfigError
@@ -44,7 +44,7 @@ import {
44
44
  DeeplineError
45
45
  } from "./chunk-Z3A2S3QM.mjs";
46
46
  import "./chunk-2MGZAI54.mjs";
47
- import "./chunk-WFVL6A7I.mjs";
47
+ import "./chunk-TK6YKQ45.mjs";
48
48
  import "./chunk-WZYKRD7T.mjs";
49
49
  import "./chunk-KRD6H754.mjs";
50
50