deepline 0.3.561 → 0.3.563
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.
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +74 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +44 -1
- package/dist/cli/{auth-3WPN7C5X.mjs → auth-3YES4ACM.mjs} +5 -5
- package/dist/cli/auth-UC22BJN2.js +44 -0
- package/dist/cli/{billing-DOHRRK73.js → billing-L2GDKBXK.js} +99 -99
- package/dist/cli/{billing-NCTL4WRP.mjs → billing-NZ2NCOQS.mjs} +8 -8
- package/dist/cli/{chunk-O5TXP65R.mjs → chunk-2MAP42AM.mjs} +1 -1
- package/dist/cli/{chunk-3VBYUQ4G.js → chunk-2UW5A57I.js} +9 -9
- package/dist/cli/{chunk-XFEBBBYA.js → chunk-4KHRPJOW.js} +53 -53
- package/dist/cli/{chunk-K72PGYSH.js → chunk-4MPLA5RD.js} +48 -48
- package/dist/cli/{chunk-CCRGOHC2.mjs → chunk-6LPMQPSQ.mjs} +2 -2
- package/dist/cli/{chunk-IEVV72X5.mjs → chunk-6U7CIG3C.mjs} +4 -4
- package/dist/cli/{chunk-QO5MVJWJ.mjs → chunk-6UHRBEDV.mjs} +3 -3
- package/dist/cli/{chunk-GITMBBDH.mjs → chunk-AYNDNXBJ.mjs} +1 -1
- package/dist/cli/{chunk-EAU5JJXS.mjs → chunk-BP2XRVBA.mjs} +5 -5
- package/dist/cli/{chunk-JV3WBT3X.js → chunk-CH7OVBBJ.js} +5 -5
- package/dist/cli/{chunk-X6IDT5II.js → chunk-DA24O3ZV.js} +3 -3
- package/dist/cli/{chunk-BIIKWKTD.mjs → chunk-DFCBNTVQ.mjs} +2 -2
- package/dist/cli/{chunk-65L4IL3E.js → chunk-DVWFK676.js} +6 -6
- package/dist/cli/{chunk-XKYNEKG2.js → chunk-ERT4ZMZT.js} +5 -5
- package/dist/cli/{chunk-5TWCVY3S.js → chunk-FCRBXLIJ.js} +12 -12
- package/dist/cli/{chunk-RSFBTSJZ.js → chunk-G5CY6KI2.js} +41 -41
- package/dist/cli/{chunk-JKBSEUFN.mjs → chunk-GVRVZQBY.mjs} +2 -2
- package/dist/cli/{chunk-GPGNBG3E.mjs → chunk-H2N324LF.mjs} +3 -3
- package/dist/cli/{chunk-OML66OOS.js → chunk-H3UIWEXF.js} +2 -2
- package/dist/cli/{chunk-5FJGP5NZ.mjs → chunk-HST5XA3B.mjs} +2 -2
- package/dist/cli/{chunk-ZFTQYCMB.js → chunk-IICHFEFE.js} +5 -5
- package/dist/cli/{chunk-GCBXXN4P.mjs → chunk-JVXHVEWX.mjs} +5 -5
- package/dist/cli/{chunk-SBUFCQ3W.mjs → chunk-K5FNC4VL.mjs} +2 -2
- package/dist/cli/{chunk-4OITRR2V.js → chunk-K77ANXGU.js} +13 -13
- package/dist/cli/{chunk-I4FFGMIQ.mjs → chunk-L5O7MWRZ.mjs} +5 -5
- package/dist/cli/{chunk-PQLQ2YV7.mjs → chunk-L5QJRMFJ.mjs} +2 -2
- package/dist/cli/{chunk-6EJOADKB.js → chunk-LIO7CPM3.js} +8 -8
- package/dist/cli/{chunk-XDTI5HF7.js → chunk-MGOCWY7J.js} +100 -100
- package/dist/cli/{chunk-LRQZ2XO5.mjs → chunk-NCGDBNNF.mjs} +2 -2
- package/dist/cli/{chunk-PLQ4OMYO.js → chunk-NS56OQUQ.js} +1 -1
- package/dist/cli/{chunk-AH5T5LX2.js → chunk-NTRTFEI4.js} +26 -26
- package/dist/cli/{chunk-S4WTJQEJ.mjs → chunk-O3NLECXL.mjs} +1 -1
- package/dist/cli/{chunk-NGIQXZIE.js → chunk-OZC6SSOB.js} +7 -7
- package/dist/cli/{chunk-AEIRQFS3.mjs → chunk-POGS26GF.mjs} +1 -1
- package/dist/cli/{chunk-HSRYGNCA.js → chunk-QGIHGITM.js} +3 -3
- package/dist/cli/{chunk-OTOID2SE.js → chunk-QGNITJYC.js} +15 -15
- package/dist/cli/{chunk-F5XQN6PU.js → chunk-QOLFZD6Q.js} +2 -2
- package/dist/cli/{chunk-JNI4353Z.mjs → chunk-RP2LCS7G.mjs} +11 -11
- package/dist/cli/{chunk-3CZLPUBB.js → chunk-SJ2LY4V5.js} +20 -20
- package/dist/cli/{chunk-M4ZL2H5B.js → chunk-T2RNEBV7.js} +4 -4
- package/dist/cli/{chunk-2YNYWHBI.js → chunk-TX5PQ7KP.js} +10 -10
- package/dist/cli/{chunk-CUU5CL3V.js → chunk-U77PK5R3.js} +20 -20
- package/dist/cli/{chunk-EN36QYE7.mjs → chunk-UMJWODG7.mjs} +1 -1
- package/dist/cli/{chunk-HLWNMRSF.mjs → chunk-UUEVGLGO.mjs} +1 -1
- package/dist/cli/{chunk-DSOQL4ZF.js → chunk-V4KKZGLT.js} +23 -23
- package/dist/cli/{chunk-PSXPGRZK.js → chunk-VYY6HNOC.js} +2 -2
- package/dist/cli/{chunk-7HGJKBNU.mjs → chunk-XDZZCRUG.mjs} +1 -1
- package/dist/cli/{chunk-42RBMROP.mjs → chunk-XTSQ3ZV5.mjs} +2 -2
- package/dist/cli/{chunk-T5WVODJY.mjs → chunk-XWGWVLQQ.mjs} +4 -4
- package/dist/cli/{chunk-OBQOFQX2.mjs → chunk-XY5DE4TK.mjs} +5 -5
- package/dist/cli/{chunk-MTD7OXGL.mjs → chunk-YDXFVE4V.mjs} +1 -1
- package/dist/cli/{chunk-JRQDDQLZ.mjs → chunk-ZX3UZCWC.mjs} +1 -1
- package/dist/cli/concurrent-runs-help-NMNGH7QN.js +22 -0
- package/dist/cli/{concurrent-runs-help-YGCPBET7.mjs → concurrent-runs-help-VEZX3RK4.mjs} +6 -6
- package/dist/cli/{csv-FWL7B2BV.mjs → csv-RJBNLD23.mjs} +4 -4
- package/dist/cli/{csv-QEDNA7FG.js → csv-W5C4JCYL.js} +13 -13
- package/dist/cli/{db-SRNS2IET.js → db-GYCRUH4V.js} +27 -27
- package/dist/cli/{db-RJEX3BRW.mjs → db-VVGP2KCM.mjs} +6 -6
- package/dist/cli/describe-HJ564FPP.js +50 -0
- package/dist/cli/{describe-N7EFSCTT.mjs → describe-HZW272Y6.mjs} +18 -18
- package/dist/cli/{executions-FVZYM5X7.js → executions-D37NX6CD.js} +8 -8
- package/dist/cli/{executions-UIB2VWM3.mjs → executions-N4ZA4ZD5.mjs} +6 -6
- package/dist/cli/{feedback-2UFZ73PJ.mjs → feedback-4PB4ACBV.mjs} +6 -6
- package/dist/cli/{feedback-4DPMGP54.js → feedback-W6CY6UBA.js} +14 -14
- package/dist/cli/git-LMRN2YR5.js +26 -0
- package/dist/cli/{git-LBADM335.mjs → git-WHIEYIVM.mjs} +5 -5
- package/dist/cli/index.js +143 -143
- package/dist/cli/index.mjs +45 -45
- package/dist/cli/{integrations-2MLNXLEQ.mjs → integrations-ASNRHKLO.mjs} +7 -7
- package/dist/cli/{integrations-YNXYTLOA.js → integrations-HXY5DR6D.js} +20 -20
- package/dist/cli/{legacy-noops-KZ4TWNLG.js → legacy-noops-PJNDUOWG.js} +9 -9
- package/dist/cli/{legacy-noops-MLULOC4E.mjs → legacy-noops-YYX2W2WX.mjs} +6 -6
- package/dist/cli/{mcp-B3KGTSQW.js → mcp-APKPI24N.js} +24 -24
- package/dist/cli/{mcp-LBP6ZNGI.mjs → mcp-T32DPP4D.mjs} +4 -4
- package/dist/cli/{monitors-7OB3JGLF.js → monitors-BY4DJFCF.js} +100 -100
- package/dist/cli/{monitors-IUJPNNJJ.mjs → monitors-DTJD3IUI.mjs} +7 -7
- package/dist/cli/{org-ZETP5SLA.js → org-2GMHKAQK.js} +121 -121
- package/dist/cli/{org-4BJVKLJ4.mjs → org-GQYIJBKO.mjs} +6 -6
- package/dist/cli/{outcomes-4IH5QXAA.mjs → outcomes-3ASEQLIF.mjs} +6 -6
- package/dist/cli/{outcomes-XZLWT7OK.js → outcomes-4XY4F57P.js} +14 -14
- package/dist/cli/{play-KMXUSZ3W.js → play-2LDJMIG2.js} +324 -324
- package/dist/cli/{play-QGYAHOX6.mjs → play-EX7PB6CI.mjs} +19 -19
- package/dist/cli/{providers-LXMG2WMM.mjs → providers-GAERKWYW.mjs} +6 -6
- package/dist/cli/{providers-A4FNCWOJ.js → providers-IDIFP5PU.js} +9 -9
- package/dist/cli/{quickstart-BRN25JX5.js → quickstart-7NL5YAJF.js} +6 -6
- package/dist/cli/{quickstart-3L4ZMV5Y.mjs → quickstart-E2GCIGR4.mjs} +4 -4
- package/dist/cli/{run-P3WFKNPE.mjs → run-2EPOAEJ5.mjs} +23 -23
- package/dist/cli/{run-36GX6EWC.js → run-3CEY5JF3.js} +44 -44
- package/dist/cli/search-ILJXFKNF.js +32 -0
- package/dist/cli/{search-SEQFDQKQ.mjs → search-TYRKGVKB.mjs} +7 -7
- package/dist/cli/{search-output-Y32YHSQ3.js → search-output-FRRT574G.js} +6 -6
- package/dist/cli/{search-output-I5U5EI75.mjs → search-output-O7FYSGYQ.mjs} +4 -4
- package/dist/cli/{secrets-DH46W2VF.js → secrets-5W2ZF2JB.js} +15 -15
- package/dist/cli/{secrets-OIXJK4E4.mjs → secrets-5YL7RU2B.mjs} +6 -6
- package/dist/cli/{sessions-OADAVWXU.mjs → sessions-VWENSY3G.mjs} +6 -6
- package/dist/cli/sessions-YMXBFVB3.js +23 -0
- package/dist/cli/{settings-DNJBXD5N.js → settings-JQOMJTOC.js} +85 -85
- package/dist/cli/{settings-2N5IJ7CZ.mjs → settings-W6FCYDJC.mjs} +12 -12
- package/dist/cli/{setup-5LLJ77BQ.mjs → setup-3JUQWZTS.mjs} +9 -9
- package/dist/cli/{setup-KKZXSKN6.js → setup-DJIVQUBT.js} +49 -49
- package/dist/cli/{skills-U76N7CTT.mjs → skills-7JTWCFL3.mjs} +7 -7
- package/dist/cli/skills-T36PD3IA.js +37 -0
- package/dist/cli/{tools-4US4UIIT.mjs → tools-DRR3KDV2.mjs} +17 -17
- package/dist/cli/tools-X53FZHIC.js +57 -0
- package/dist/cli/update-BISEE3LC.js +37 -0
- package/dist/cli/{update-AH44HYX7.mjs → update-KL43AZPW.mjs} +9 -9
- package/dist/cli/{views-YJAFUL2K.mjs → views-FFTXTJ7U.mjs} +6 -6
- package/dist/cli/{views-HOCGYKC5.js → views-HX4GM53H.js} +21 -21
- package/dist/cli/{workflow-UCVXUIRX.mjs → workflow-QO7BRZLM.mjs} +7 -7
- package/dist/cli/{workflow-ZNP5BLMJ.js → workflow-R2K6CH2X.js} +17 -17
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +112 -112
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-3NPCF7CL.js +0 -44
- package/dist/cli/concurrent-runs-help-HWDISMIC.js +0 -22
- package/dist/cli/describe-OHO4OETQ.js +0 -50
- package/dist/cli/git-6AKXBYB7.js +0 -26
- package/dist/cli/search-EEJ2VPS3.js +0 -32
- package/dist/cli/sessions-UJVLZK2H.js +0 -23
- package/dist/cli/skills-HRGWKTL6.js +0 -37
- package/dist/cli/tools-RTNCLQEP.js +0 -57
- package/dist/cli/update-YY5PZGYJ.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.
|
|
208
|
+
version: '0.3.563',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -912,6 +912,11 @@ function emitModalStage(
|
|
|
912
912
|
runId: context.runId ?? null,
|
|
913
913
|
playName: context.playName ?? null,
|
|
914
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
|
+
: {}),
|
|
915
920
|
...extra,
|
|
916
921
|
atMs: Date.now(),
|
|
917
922
|
}),
|
|
@@ -1504,6 +1509,8 @@ const earlyModalPreboots = new WeakMap<
|
|
|
1504
1509
|
*/
|
|
1505
1510
|
export async function startEarlyModalPreboot(input: {
|
|
1506
1511
|
key: string;
|
|
1512
|
+
/** Logged with each pre-boot event; the key is already org-scoped. */
|
|
1513
|
+
orgId?: string;
|
|
1507
1514
|
sandbox: Pick<ModalSandbox, 'exec' | 'sandboxId'>;
|
|
1508
1515
|
bakedRunner: Promise<{ hash: string; path: string } | undefined>;
|
|
1509
1516
|
workDir: string;
|
|
@@ -1519,6 +1526,7 @@ export async function startEarlyModalPreboot(input: {
|
|
|
1519
1526
|
): EarlyModalPreboot => {
|
|
1520
1527
|
logEarlyModalSandbox('preboot_failed', {
|
|
1521
1528
|
key: input.key,
|
|
1529
|
+
orgId: input.orgId ?? null,
|
|
1522
1530
|
sandboxId: input.sandbox.sandboxId,
|
|
1523
1531
|
status,
|
|
1524
1532
|
reason,
|
|
@@ -1585,6 +1593,7 @@ export async function startEarlyModalPreboot(input: {
|
|
|
1585
1593
|
state.exitCode = code;
|
|
1586
1594
|
logEarlyModalSandbox('preboot_exited', {
|
|
1587
1595
|
key: input.key,
|
|
1596
|
+
orgId: input.orgId ?? null,
|
|
1588
1597
|
sandboxId: input.sandbox.sandboxId,
|
|
1589
1598
|
exitCode: code,
|
|
1590
1599
|
aliveMs: Date.now() - startedAtMs,
|
|
@@ -1594,6 +1603,7 @@ export async function startEarlyModalPreboot(input: {
|
|
|
1594
1603
|
);
|
|
1595
1604
|
logEarlyModalSandbox('preboot_started', {
|
|
1596
1605
|
key: input.key,
|
|
1606
|
+
orgId: input.orgId ?? null,
|
|
1597
1607
|
sandboxId: input.sandbox.sandboxId,
|
|
1598
1608
|
elapsedMs: Date.now() - startedAtMs,
|
|
1599
1609
|
});
|
|
@@ -1641,6 +1651,7 @@ export async function sweepOrphanEarlyModalSandboxes(input: {
|
|
|
1641
1651
|
nowMs?: () => number;
|
|
1642
1652
|
sleep?: (ms: number) => Promise<void>;
|
|
1643
1653
|
limit?: number;
|
|
1654
|
+
listLimit?: number;
|
|
1644
1655
|
}): Promise<EarlySandboxSweepOutcome> {
|
|
1645
1656
|
return await sweepOrphanEarlySandboxes({
|
|
1646
1657
|
calls: earlyModalSandboxCalls(input),
|
|
@@ -1649,6 +1660,7 @@ export async function sweepOrphanEarlyModalSandboxes(input: {
|
|
|
1649
1660
|
...(input.nowMs === undefined ? {} : { nowMs: input.nowMs }),
|
|
1650
1661
|
...(input.sleep === undefined ? {} : { sleep: input.sleep }),
|
|
1651
1662
|
...(input.limit === undefined ? {} : { limit: input.limit }),
|
|
1663
|
+
...(input.listLimit === undefined ? {} : { listLimit: input.listLimit }),
|
|
1652
1664
|
});
|
|
1653
1665
|
}
|
|
1654
1666
|
|
|
@@ -1885,6 +1897,7 @@ async function createEarlyModalSandbox(
|
|
|
1885
1897
|
const sandbox = await awaitEarlyCreate(createEarly());
|
|
1886
1898
|
logEarlyModalSandbox('created', {
|
|
1887
1899
|
key,
|
|
1900
|
+
orgId,
|
|
1888
1901
|
workflowId: input.workflowId,
|
|
1889
1902
|
sandboxId: sandbox.sandboxId,
|
|
1890
1903
|
hintToRequestMs: createRequestedAtMs - hintAtMs,
|
|
@@ -1904,6 +1917,7 @@ async function createEarlyModalSandbox(
|
|
|
1904
1917
|
sandbox,
|
|
1905
1918
|
startEarlyModalPreboot({
|
|
1906
1919
|
key,
|
|
1920
|
+
orgId,
|
|
1907
1921
|
sandbox,
|
|
1908
1922
|
bakedRunner: modalBakedRunnerExpectation({
|
|
1909
1923
|
imageBaked: true,
|
|
@@ -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
|
|
163
|
-
* (
|
|
164
|
-
* entry's TTL.
|
|
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<
|
|
@@ -183,18 +184,45 @@ export class EarlySandboxRegistry<
|
|
|
183
184
|
return this.#entries.has(key);
|
|
184
185
|
}
|
|
185
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Whether a hint for `key` already started this process's early sandbox:
|
|
189
|
+
* still held, or taken by a launch within the entry TTL. A redelivered
|
|
190
|
+
* request (same server-made run id) then starts no second sandbox, which
|
|
191
|
+
* no launch would adopt.
|
|
192
|
+
*/
|
|
193
|
+
hinted(key: string): boolean {
|
|
194
|
+
return this.#entries.has(key) || this.#taken.has(key);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
readonly #taken = new Set<string>();
|
|
198
|
+
|
|
186
199
|
/** This process's early sandboxes not yet adopted, reaped or expired. */
|
|
187
200
|
outstanding(): number {
|
|
188
201
|
return this.#outstanding.size;
|
|
189
202
|
}
|
|
190
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
|
+
|
|
191
217
|
put(
|
|
192
218
|
key: string,
|
|
193
219
|
entry: Promise<EarlySandboxEntry<TSandbox> | null>,
|
|
194
220
|
ttlMs: number = EARLY_SANDBOX_REAP_AFTER_MS * 2,
|
|
221
|
+
orgId?: string,
|
|
195
222
|
): void {
|
|
196
223
|
this.#entries.set(key, entry);
|
|
197
224
|
this.#outstanding.add(entry);
|
|
225
|
+
if (orgId) this.#outstandingOrg.set(entry, orgId);
|
|
198
226
|
void entry.then(
|
|
199
227
|
(resolved) => {
|
|
200
228
|
if (!this.#outstanding.has(entry)) return;
|
|
@@ -214,7 +242,14 @@ export class EarlySandboxRegistry<
|
|
|
214
242
|
const entry = this.#entries.get(key);
|
|
215
243
|
this.#entries.delete(key);
|
|
216
244
|
if (entry) {
|
|
217
|
-
this.#
|
|
245
|
+
this.#taken.add(key);
|
|
246
|
+
setTimeout(
|
|
247
|
+
() => this.#taken.delete(key),
|
|
248
|
+
EARLY_SANDBOX_REAP_AFTER_MS * 2,
|
|
249
|
+
).unref?.();
|
|
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.
|
|
218
253
|
for (const handler of this.#takeHandlers) handler(key);
|
|
219
254
|
}
|
|
220
255
|
return entry;
|
|
@@ -240,6 +275,7 @@ export class EarlySandboxRegistry<
|
|
|
240
275
|
|
|
241
276
|
#release(entry: Promise<EarlySandboxEntry<TSandbox> | null>): void {
|
|
242
277
|
if (!this.#outstanding.delete(entry)) return;
|
|
278
|
+
this.#outstandingOrg.delete(entry);
|
|
243
279
|
for (const [sandboxId, held] of this.#outstandingBySandboxId) {
|
|
244
280
|
if (held === entry) this.#outstandingBySandboxId.delete(sandboxId);
|
|
245
281
|
}
|
|
@@ -466,7 +502,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
|
|
|
466
502
|
workflowId: input.workflowId,
|
|
467
503
|
...scope,
|
|
468
504
|
});
|
|
469
|
-
if (adapter.registry.
|
|
505
|
+
if (adapter.registry.hinted(key)) return false;
|
|
470
506
|
const hintAtMs = Date.now();
|
|
471
507
|
const started = (async () =>
|
|
472
508
|
await adapter.createEarly({
|
|
@@ -478,13 +514,15 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
|
|
|
478
514
|
}))().catch((error: unknown) => {
|
|
479
515
|
logEarlySandbox(adapter.logScope, 'create_failed', {
|
|
480
516
|
key,
|
|
517
|
+
orgId,
|
|
481
518
|
error: error instanceof Error ? error.message : String(error),
|
|
482
519
|
});
|
|
483
520
|
return null;
|
|
484
521
|
});
|
|
485
|
-
adapter.registry.put(key, started);
|
|
522
|
+
adapter.registry.put(key, started, undefined, orgId);
|
|
486
523
|
logEarlySandbox(adapter.logScope, 'hint_accepted', {
|
|
487
524
|
key,
|
|
525
|
+
orgId,
|
|
488
526
|
workflowId: input.workflowId,
|
|
489
527
|
});
|
|
490
528
|
return true;
|
|
@@ -549,7 +587,8 @@ export async function reapEarlySandboxById(input: {
|
|
|
549
587
|
sleep?: (ms: number) => Promise<void>;
|
|
550
588
|
}): Promise<'not_early' | 'terminated'> {
|
|
551
589
|
const fresh = await input.calls.fromId(input.sandboxId);
|
|
552
|
-
|
|
590
|
+
const tags = await fresh.getTags();
|
|
591
|
+
if (!isUnadoptedEarlySandbox(tags)) return 'not_early';
|
|
553
592
|
const confirmAttempts = await terminateEarlySandboxConfirmed({
|
|
554
593
|
sandbox: fresh,
|
|
555
594
|
readExitCode: readEarlySandboxExitCode(input.calls),
|
|
@@ -558,6 +597,7 @@ export async function reapEarlySandboxById(input: {
|
|
|
558
597
|
});
|
|
559
598
|
logEarlySandbox(input.calls.logScope, 'reaped_unadopted', {
|
|
560
599
|
key: input.key,
|
|
600
|
+
orgId: tags.orgId ?? null,
|
|
561
601
|
sandboxId: input.sandboxId,
|
|
562
602
|
confirmAttempts,
|
|
563
603
|
});
|
|
@@ -618,7 +658,14 @@ export function scheduleEarlySandboxReap(input: {
|
|
|
618
658
|
export const EARLY_SANDBOX_SWEEP_INTERVAL_MS = 60_000;
|
|
619
659
|
/** ±20% per interval, and a first pass in [0, 40%] of it. */
|
|
620
660
|
export const EARLY_SANDBOX_SWEEP_JITTER_RATIO = 0.2;
|
|
661
|
+
/** Orphans one pass terminates; the rest wait for the next pass. */
|
|
621
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;
|
|
622
669
|
const EARLY_SANDBOX_SWEEP_CONFIRM_ATTEMPTS = 5;
|
|
623
670
|
|
|
624
671
|
export type EarlySandboxSweepOutcome = {
|
|
@@ -626,6 +673,8 @@ export type EarlySandboxSweepOutcome = {
|
|
|
626
673
|
terminated: number;
|
|
627
674
|
unconfirmed: number;
|
|
628
675
|
young: number;
|
|
676
|
+
/** Orphans past this pass's termination limit, left for the next pass. */
|
|
677
|
+
deferred: number;
|
|
629
678
|
};
|
|
630
679
|
|
|
631
680
|
export async function sweepOrphanEarlySandboxes(input: {
|
|
@@ -643,9 +692,14 @@ export async function sweepOrphanEarlySandboxes(input: {
|
|
|
643
692
|
nowMs?: () => number;
|
|
644
693
|
sleep?: (ms: number) => Promise<void>;
|
|
645
694
|
limit?: number;
|
|
695
|
+
listLimit?: number;
|
|
646
696
|
}): Promise<EarlySandboxSweepOutcome> {
|
|
647
697
|
const nowMs = input.nowMs ?? Date.now;
|
|
648
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
|
+
);
|
|
649
703
|
const ids = new Set<string>();
|
|
650
704
|
// One listing: the retired F2 hedge tag is no longer swept (nothing
|
|
651
705
|
// creates it, and no hedge leg ever carried an environment tag).
|
|
@@ -653,12 +707,15 @@ export async function sweepOrphanEarlySandboxes(input: {
|
|
|
653
707
|
source: EARLY_SANDBOX_SOURCE_TAG,
|
|
654
708
|
[EARLY_ENVIRONMENT_TAG]: input.environment,
|
|
655
709
|
})) {
|
|
656
|
-
if (ids.size >=
|
|
710
|
+
if (ids.size >= listLimit) break;
|
|
657
711
|
if (listed.sandboxId?.trim()) ids.add(listed.sandboxId.trim());
|
|
658
712
|
}
|
|
659
713
|
let terminated = 0;
|
|
660
714
|
let unconfirmed = 0;
|
|
661
715
|
let young = 0;
|
|
716
|
+
let deferred = 0;
|
|
717
|
+
// Claimed synchronously after each tag read, so at most `limit` terminate.
|
|
718
|
+
let claimed = 0;
|
|
662
719
|
await Promise.all(
|
|
663
720
|
[...ids].map(async (sandboxId) => {
|
|
664
721
|
try {
|
|
@@ -676,6 +733,11 @@ export async function sweepOrphanEarlySandboxes(input: {
|
|
|
676
733
|
young += 1;
|
|
677
734
|
return;
|
|
678
735
|
}
|
|
736
|
+
if (claimed >= limit) {
|
|
737
|
+
deferred += 1;
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
claimed += 1;
|
|
679
741
|
const confirmAttempts = await terminateEarlySandboxConfirmed({
|
|
680
742
|
sandbox: fresh,
|
|
681
743
|
readExitCode: readEarlySandboxExitCode(input.calls),
|
|
@@ -686,6 +748,7 @@ export async function sweepOrphanEarlySandboxes(input: {
|
|
|
686
748
|
input.registry?.settle(sandboxId);
|
|
687
749
|
logEarlySandbox(input.calls.logScope, 'swept_orphan', {
|
|
688
750
|
key: tags.earlyKey ?? null,
|
|
751
|
+
orgId: tags.orgId ?? null,
|
|
689
752
|
sandboxId,
|
|
690
753
|
ageMs,
|
|
691
754
|
confirmAttempts,
|
|
@@ -702,7 +765,7 @@ export async function sweepOrphanEarlySandboxes(input: {
|
|
|
702
765
|
}
|
|
703
766
|
}),
|
|
704
767
|
);
|
|
705
|
-
return { observed: ids.size, terminated, unconfirmed, young };
|
|
768
|
+
return { observed: ids.size, terminated, unconfirmed, young, deferred };
|
|
706
769
|
}
|
|
707
770
|
|
|
708
771
|
/** PB: the runner limits a pre-boot fixed, which a launch must match. */
|
|
@@ -971,6 +1034,8 @@ export async function adoptEarlySandbox<
|
|
|
971
1034
|
// Re-tag first: from here the sandbox is an ordinary launch sandbox for
|
|
972
1035
|
// every cleanup and reconciliation path, and the reaper skips it.
|
|
973
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);
|
|
974
1039
|
input.emitStage('early:adopted', {
|
|
975
1040
|
key,
|
|
976
1041
|
how,
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts
CHANGED
|
@@ -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,
|
|
@@ -14,15 +14,15 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-H2N324LF.mjs";
|
|
18
|
+
import "./chunk-GVRVZQBY.mjs";
|
|
19
|
+
import "./chunk-UMJWODG7.mjs";
|
|
20
|
+
import "./chunk-XDZZCRUG.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-
|
|
25
|
+
import "./chunk-AYNDNXBJ.mjs";
|
|
26
26
|
import "./chunk-WZYKRD7T.mjs";
|
|
27
27
|
import "./chunk-KRD6H754.mjs";
|
|
28
28
|
export {
|
|
@@ -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 _chunk4KHRPJOWjs = require('./chunk-4KHRPJOW.js');
|
|
18
|
+
require('./chunk-U77PK5R3.js');
|
|
19
|
+
require('./chunk-DA24O3ZV.js');
|
|
20
|
+
require('./chunk-T2RNEBV7.js');
|
|
21
|
+
require('./chunk-6VLFQZK6.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-LFQJW4S2.js');
|
|
24
|
+
require('./chunk-CFJFUVX2.js');
|
|
25
|
+
require('./chunk-NS56OQUQ.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 = _chunk4KHRPJOWjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunk4KHRPJOWjs.authStatusLine; exports.clearPendingClaim = _chunk4KHRPJOWjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunk4KHRPJOWjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunk4KHRPJOWjs.handleRegister; exports.handleStatus = _chunk4KHRPJOWjs.handleStatus; exports.handleWait = _chunk4KHRPJOWjs.handleWait; exports.httpJson = _chunk4KHRPJOWjs.httpJson; exports.readPendingAuthClaim = _chunk4KHRPJOWjs.readPendingAuthClaim; exports.readStatusBanner = _chunk4KHRPJOWjs.readStatusBanner; exports.registerAuthCommands = _chunk4KHRPJOWjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunk4KHRPJOWjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunk4KHRPJOWjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunk4KHRPJOWjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunk4KHRPJOWjs.statusBannerLine;
|