deepline 0.3.492 → 0.3.493
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/client-core.ts +11 -5
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +6 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/verdict.ts +25 -9
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +36 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +5 -4
- package/dist/bundling-sources/shared_libs/play-runtime/crustdata-company-identify-batching.ts +162 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +19 -3
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +17 -23
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +28 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-placement-policy.ts +75 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +412 -59
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +38 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +19 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-operation.ts +165 -12
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +358 -0
- package/dist/cli/{auth-4I6QY5WX.mjs → auth-3NAY3AST.mjs} +5 -5
- package/dist/cli/auth-KYQLDI6V.js +43 -0
- package/dist/cli/{billing-2H4GOJZY.js → billing-FSB4BBBO.js} +80 -80
- package/dist/cli/{billing-4F6L4JSI.mjs → billing-SBWQCC7B.mjs} +7 -7
- package/dist/cli/{chunk-MQ2LQOAM.mjs → chunk-2BRTYIAH.mjs} +23 -9
- package/dist/cli/{chunk-E47VAVAR.js → chunk-2H4OFVR5.js} +5 -5
- package/dist/cli/{chunk-ZDTPSVGF.js → chunk-2I7VN65H.js} +10 -10
- package/dist/cli/{chunk-LCCFGSV7.mjs → chunk-2IHGVAGT.mjs} +2 -2
- package/dist/cli/{chunk-BDUFZSUL.js → chunk-2NGIBJM2.js} +8 -8
- package/dist/cli/{chunk-OTUT3XTX.mjs → chunk-3QGUWB6E.mjs} +4 -4
- package/dist/cli/{chunk-3BRDP4UP.mjs → chunk-4IJFQV3O.mjs} +1 -1
- package/dist/cli/{chunk-PIC6M4X3.mjs → chunk-4NIGNT7X.mjs} +1 -1
- package/dist/cli/{chunk-YVOYZPMY.mjs → chunk-5DIZ2G74.mjs} +2 -2
- package/dist/cli/{chunk-TKLDKIJU.mjs → chunk-5JPKRDFC.mjs} +7 -5
- package/dist/cli/{chunk-FTXIJTV2.mjs → chunk-5WOPBX3H.mjs} +1 -1
- package/dist/cli/{chunk-R5MP3CIY.mjs → chunk-67ZG7XZV.mjs} +3 -3
- package/dist/cli/{chunk-W4FEX5ZF.js → chunk-7HABWOMB.js} +261 -261
- package/dist/cli/{chunk-FPLN7PHP.js → chunk-AGTXL6LZ.js} +5 -5
- package/dist/cli/{chunk-SE23YSBK.js → chunk-AWMCZAUR.js} +3 -3
- package/dist/cli/{chunk-HHTVRICE.js → chunk-C2MRDPA5.js} +17 -17
- package/dist/cli/{chunk-ONONSV2Q.mjs → chunk-DVQHG6AM.mjs} +1 -0
- package/dist/cli/{chunk-O3K22ZC7.js → chunk-DWJ4RXSA.js} +34 -11
- package/dist/cli/{chunk-6YO4OJPM.mjs → chunk-DYP27IWC.mjs} +99 -24
- package/dist/cli/{chunk-EANFUHRM.mjs → chunk-E5ILCMKQ.mjs} +1 -1
- package/dist/cli/{chunk-Y7QCMOGZ.mjs → chunk-EBAS3UT2.mjs} +6 -6
- package/dist/cli/{chunk-DJOLMS2A.js → chunk-EFO5GVYS.js} +1 -1
- package/dist/cli/{chunk-NF7NUKWF.js → chunk-EYG336YV.js} +132 -57
- package/dist/cli/{chunk-OKHBAAJG.mjs → chunk-GSC35TPZ.mjs} +2 -2
- package/dist/cli/{chunk-MPITIXW4.mjs → chunk-HLM2UFQ5.mjs} +13 -5
- package/dist/cli/{chunk-TVUE4CPW.js → chunk-HTUSTPP4.js} +32 -32
- package/dist/cli/{chunk-GDSZWTJK.mjs → chunk-IJJ6D5WL.mjs} +12 -12
- package/dist/cli/{chunk-3TISK5RQ.js → chunk-IJOHWGPF.js} +6 -6
- package/dist/cli/{chunk-NBL6JMIY.js → chunk-IOBPR2VO.js} +17 -17
- package/dist/cli/{chunk-EFFHRXKB.js → chunk-IOMEJKGK.js} +2 -2
- package/dist/cli/{chunk-A7ZMG2QZ.mjs → chunk-IRDYBMA7.mjs} +34 -11
- package/dist/cli/{chunk-B2JE3HD6.js → chunk-JO2JZUBR.js} +3 -3
- package/dist/cli/{chunk-4IP5MLWU.js → chunk-JO5FFSR7.js} +6 -1
- package/dist/cli/{chunk-O2FB42N2.js → chunk-KCDZWS2B.js} +56 -56
- package/dist/cli/{chunk-CGDUFVNE.mjs → chunk-KGDDQMI7.mjs} +2 -2
- package/dist/cli/{chunk-UUH4GQRL.mjs → chunk-KKSKYZO4.mjs} +1 -1
- package/dist/cli/{chunk-OTDX4A4W.js → chunk-LGTZYI5B.js} +21 -21
- package/dist/cli/{chunk-JJAHWKJ2.js → chunk-MLEUOTEQ.js} +73 -59
- package/dist/cli/{chunk-YOCEY4EI.mjs → chunk-NALJJTPS.mjs} +5 -5
- package/dist/cli/{chunk-HFEJ7JJT.js → chunk-NPNAEPY4.js} +26 -26
- package/dist/cli/{chunk-3IBKEOL4.js → chunk-NWIDPT7H.js} +4 -4
- package/dist/cli/{chunk-AUQQVDAB.js → chunk-PKV5CD3W.js} +1 -0
- package/dist/cli/{chunk-4RB74KJX.js → chunk-QTPS5RLG.js} +15 -15
- package/dist/cli/{chunk-4OLXMJ2L.js → chunk-RLX5ZFNX.js} +8 -6
- package/dist/cli/{chunk-DEJIN4DF.mjs → chunk-SAW3FBCA.mjs} +5 -0
- package/dist/cli/{chunk-RC366IJS.mjs → chunk-SXD2EYAH.mjs} +6 -6
- package/dist/cli/{chunk-YNWET57Z.js → chunk-TIFRRLZT.js} +7 -7
- package/dist/cli/{chunk-ZCKUNXXR.mjs → chunk-TNQOR6XQ.mjs} +1 -1
- package/dist/cli/{chunk-OGNIB64W.js → chunk-UCMY2SO2.js} +23 -15
- package/dist/cli/{chunk-O65HDVA7.mjs → chunk-VFHIYWMC.mjs} +5 -5
- package/dist/cli/{chunk-JHBRJDUC.js → chunk-WCZFCOMZ.js} +7 -7
- package/dist/cli/{chunk-FFOJRD53.mjs → chunk-WTFI7BVH.mjs} +3 -3
- package/dist/cli/{chunk-42Z6VC2Q.js → chunk-XLE7KXE7.js} +2 -2
- package/dist/cli/{chunk-Q3CCCTRQ.js → chunk-XQX476QK.js} +14 -14
- package/dist/cli/{chunk-F6EQWY4E.mjs → chunk-Y3NN2UAF.mjs} +2 -2
- package/dist/cli/{chunk-MJFVF5AW.mjs → chunk-ZQH4TXM2.mjs} +2 -2
- package/dist/cli/{chunk-DVGCPOEA.mjs → chunk-ZVW7EWTC.mjs} +7 -7
- package/dist/cli/{chunk-4GJIJHRQ.mjs → chunk-ZVXB7OU7.mjs} +1 -1
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-JGJNDRSA.js → csv-DKYZE2KM.js} +13 -13
- package/dist/cli/{csv-VGXGV7YM.mjs → csv-XR22YQXT.mjs} +4 -4
- package/dist/cli/{db-OYG27ZBM.mjs → db-EOKG36YN.mjs} +7 -7
- package/dist/cli/{db-W52WJ6E5.js → db-RNYRTCMV.js} +28 -28
- package/dist/cli/describe-ICFXOQBW.mjs +50 -0
- package/dist/cli/describe-RS75I33X.js +50 -0
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-EVE4KUGL.mjs → executions-3RAOACNS.mjs} +7 -7
- package/dist/cli/{executions-LAJHZGPY.js → executions-OBWPSWH7.js} +9 -9
- package/dist/cli/{feedback-75QB7KVG.mjs → feedback-6EQRVBKF.mjs} +4 -4
- package/dist/cli/{feedback-ZABCN7RT.js → feedback-6GPEUBLF.js} +8 -8
- package/dist/cli/getting-started.d.mts +12 -10
- package/dist/cli/getting-started.d.ts +12 -10
- package/dist/cli/getting-started.js +4 -2
- package/dist/cli/getting-started.mjs +3 -1
- package/dist/cli/{git-QIFEYQGY.mjs → git-CVQ24DTR.mjs} +5 -5
- package/dist/cli/git-DEFE4SSB.js +25 -0
- package/dist/cli/index.js +143 -143
- package/dist/cli/index.mjs +43 -43
- package/dist/cli/{legacy-noops-PNTWBBGY.mjs → legacy-noops-QULJZYNH.mjs} +5 -5
- package/dist/cli/{legacy-noops-2TBIAMCM.js → legacy-noops-XPOATG5V.js} +8 -8
- package/dist/cli/{monitors-LOHUYJEI.mjs → monitors-AFT5YJPZ.mjs} +49 -9
- package/dist/cli/{monitors-UKBOEGBS.js → monitors-OJ4CMREE.js} +169 -129
- package/dist/cli/{org-E7A6QLBW.js → org-RKT52CSL.js} +73 -73
- package/dist/cli/{org-JRUKUOUF.mjs → org-WHKNXANG.mjs} +7 -7
- package/dist/cli/{pages-K76HA473.mjs → pages-EEAQFGVD.mjs} +7 -7
- package/dist/cli/{pages-EUDFFLLD.js → pages-SOE3R667.js} +18 -18
- package/dist/cli/{play-DG2N66SV.mjs → play-LXFWHUBP.mjs} +147 -52
- package/dist/cli/{play-UWHNUJRA.js → play-OTJJ4E4T.js} +661 -566
- package/dist/cli/{providers-DZX6TTC6.js → providers-RU4HIAT3.js} +10 -10
- package/dist/cli/{providers-RUTTPUZD.mjs → providers-U3CPKTMM.mjs} +7 -7
- package/dist/cli/{quickstart-RGZZN2YE.mjs → quickstart-75AO2AJC.mjs} +5 -5
- package/dist/cli/{quickstart-U4NMD7KX.js → quickstart-N72IVA2Y.js} +13 -13
- package/dist/cli/{run-MOJWQYFQ.mjs → run-IGWFL6WH.mjs} +29 -28
- package/dist/cli/{run-5UNF4FHG.js → run-MMYES3IW.js} +44 -43
- package/dist/cli/search-EQURI7SZ.js +32 -0
- package/dist/cli/{search-5B3ZDU7H.mjs → search-FIYESBLZ.mjs} +8 -8
- package/dist/cli/{search-output-VQWJS3FN.js → search-output-2FXN4ZWD.js} +9 -6
- package/dist/cli/{search-output-QS4IWWHA.mjs → search-output-3I5KSW36.mjs} +7 -4
- package/dist/cli/{secrets-S3PJMEAC.js → secrets-HCZQ6JNP.js} +16 -16
- package/dist/cli/{secrets-V5XVDBIS.mjs → secrets-O7IUQ3VT.mjs} +7 -7
- package/dist/cli/{sessions-Y5QMEZ3D.js → sessions-5AYTT4IW.js} +6 -6
- package/dist/cli/{sessions-5V3X24XI.mjs → sessions-KY7A3EZO.mjs} +5 -5
- package/dist/cli/{settings-3U6RRO5F.js → settings-P4VFYWJK.js} +80 -80
- package/dist/cli/{settings-LHZYY5PT.mjs → settings-WSMRR2GS.mjs} +13 -13
- package/dist/cli/{setup-MLLIGO2S.js → setup-J7CA3EJL.js} +57 -57
- package/dist/cli/{setup-AJLWXYAN.mjs → setup-YTVKVQC7.mjs} +13 -13
- package/dist/cli/skills-KKPEGLAR.js +36 -0
- package/dist/cli/{skills-5O2MUWKK.mjs → skills-W5WY764N.mjs} +10 -10
- package/dist/cli/tools-65Y4QTW6.js +57 -0
- package/dist/cli/{tools-PWNMI5CD.mjs → tools-YECI6N3N.mjs} +20 -20
- package/dist/cli/{update-SXT4QW7S.mjs → update-BIFBIEII.mjs} +10 -10
- package/dist/cli/update-WDG7VFOW.js +34 -0
- package/dist/cli/{workflow-3WTF5IYT.js → workflow-D2TUFFH6.js} +18 -18
- package/dist/cli/{workflow-KPRM6ARO.mjs → workflow-XZVDNARC.mjs} +8 -8
- package/dist/{client-Cb1ej1Vr.d.ts → client-BDB_VbE4.d.ts} +1 -1
- package/dist/{client-vWpbLNCB.d.mts → client-CNzJ1LTF.d.mts} +1 -1
- package/dist/{client-core-CoBTvsXG.d.mts → client-core-CSv3DlPD.d.mts} +10 -3
- package/dist/{client-core-BmVs6SP0.d.ts → client-core-xEa9x3pl.d.ts} +10 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +115 -114
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/plays/run-request.js +2 -2
- package/dist/plays/run-request.mjs +1 -1
- 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.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-7BCLZU6K.js +0 -43
- package/dist/cli/describe-FIXCRO5N.mjs +0 -50
- package/dist/cli/describe-G3O6OUBG.js +0 -50
- package/dist/cli/git-QBAR46NW.js +0 -25
- package/dist/cli/search-3DAEJL6S.js +0 -32
- package/dist/cli/skills-BBLIML5M.js +0 -36
- package/dist/cli/tools-X5SQXUMM.js +0 -57
- package/dist/cli/update-AEJ2ZSZQ.js +0 -34
|
@@ -1576,9 +1576,10 @@ export type MonitorFleetWaitOptions = {
|
|
|
1576
1576
|
onProgress?: (payload: MonitorFleetResult) => void;
|
|
1577
1577
|
/**
|
|
1578
1578
|
* Which terminal state ends the wait. `converged` (default) also stops on
|
|
1579
|
-
* `degraded` and `
|
|
1580
|
-
* `degraded`. A timeout is not an
|
|
1581
|
-
* the caller reads `status` to
|
|
1579
|
+
* `degraded`, `deactivated`, and `billing_suspended`; `deactivated` stops on
|
|
1580
|
+
* `deactivated`, `degraded`, and `billing_suspended`. A timeout is not an
|
|
1581
|
+
* error: the last snapshot is returned and the caller reads `status` to
|
|
1582
|
+
* decide the verdict.
|
|
1582
1583
|
*/
|
|
1583
1584
|
until?: 'converged' | 'deactivated';
|
|
1584
1585
|
};
|
|
@@ -7686,10 +7687,15 @@ export class DeeplineClient {
|
|
|
7686
7687
|
): Promise<MonitorFleetResult> {
|
|
7687
7688
|
const timeoutMs = Math.max(1, options?.timeoutMs ?? 10 * 60_000);
|
|
7688
7689
|
const pollIntervalMs = Math.max(1, options?.pollIntervalMs ?? 2_000);
|
|
7690
|
+
// The server's settled verdicts (`FLEET_SETTLED_VERDICTS` in
|
|
7691
|
+
// packages/monitors/fleets/verdict.ts): a fleet stays in each until someone
|
|
7692
|
+
// acts, so polling one only runs out the timeout. A deactivation wait does
|
|
7693
|
+
// not stop on `converged`. tests/sdk/monitor-fleets-namespace.test.ts
|
|
7694
|
+
// checks this against the server's list.
|
|
7689
7695
|
const terminal: ReadonlySet<string> =
|
|
7690
7696
|
options?.until === 'deactivated'
|
|
7691
|
-
? new Set(['deactivated', 'degraded'])
|
|
7692
|
-
: new Set(['converged', 'degraded', 'deactivated']);
|
|
7697
|
+
? new Set(['deactivated', 'degraded', 'billing_suspended'])
|
|
7698
|
+
: new Set(['converged', 'degraded', 'deactivated', 'billing_suspended']);
|
|
7693
7699
|
const startedAt = Date.now();
|
|
7694
7700
|
let latest = await this.getMonitorFleet(fleetId);
|
|
7695
7701
|
while (true) {
|
|
@@ -610,6 +610,7 @@ export function normalizePlayRunStart(
|
|
|
610
610
|
...(runPackage.run.dashboardUrl
|
|
611
611
|
? { dashboardUrl: runPackage.run.dashboardUrl }
|
|
612
612
|
: {}),
|
|
613
|
+
...(runPackage.run.runUrl ? { runUrl: runPackage.run.runUrl } : {}),
|
|
613
614
|
...(runPackage.rateLimited ? { rateLimited: runPackage.rateLimited } : {}),
|
|
614
615
|
...(isTerminalPlayRunLifecycleStatus(status)
|
|
615
616
|
? raw.finalStatusView === 'full' && raw.runId === runPackage.run.id
|
|
@@ -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.493',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -906,6 +906,8 @@ export interface PlayRunPackage {
|
|
|
906
906
|
requestedBy?: { name: string };
|
|
907
907
|
status: string;
|
|
908
908
|
dashboardUrl?: string;
|
|
909
|
+
/** The Play page with this run selected. */
|
|
910
|
+
runUrl?: string;
|
|
909
911
|
/** Durable acceptance time: the run record was created. */
|
|
910
912
|
acceptedAt?: number | null;
|
|
911
913
|
updatedAt?: number | null;
|
|
@@ -1032,6 +1034,8 @@ export interface PlayStatus {
|
|
|
1032
1034
|
playName?: string;
|
|
1033
1035
|
/** Dashboard URL for inspecting the play and its run output in the app. */
|
|
1034
1036
|
dashboardUrl?: string;
|
|
1037
|
+
/** The Play page with this run selected. */
|
|
1038
|
+
runUrl?: string;
|
|
1035
1039
|
/** Product-level play-run state. */
|
|
1036
1040
|
status:
|
|
1037
1041
|
| 'queued'
|
|
@@ -1932,6 +1936,8 @@ export interface PlayRunStart {
|
|
|
1932
1936
|
contract?: Record<string, unknown> | null;
|
|
1933
1937
|
/** Dashboard URL for the named play. */
|
|
1934
1938
|
dashboardUrl?: string;
|
|
1939
|
+
/** The Play page with this run selected. */
|
|
1940
|
+
runUrl?: string;
|
|
1935
1941
|
/** Terminal status returned when the start request used a short completion wait. */
|
|
1936
1942
|
finalStatus?: unknown;
|
|
1937
1943
|
/** Explicit full representation assembled by the canonical status reader. */
|
|
@@ -36,15 +36,31 @@ export const FLEET_LIFECYCLE_STATUSES = [
|
|
|
36
36
|
export type FleetLifecycleStatus = (typeof FLEET_LIFECYCLE_STATUSES)[number];
|
|
37
37
|
|
|
38
38
|
/** What a caller is told the fleet is doing. */
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
export const FLEET_STATUS_VERDICTS = [
|
|
40
|
+
'converging',
|
|
41
|
+
'converged',
|
|
42
|
+
'degraded',
|
|
43
|
+
'deactivating',
|
|
44
|
+
'deactivated',
|
|
45
|
+
'billing_suspending',
|
|
46
|
+
'billing_suspended',
|
|
47
|
+
'billing_reactivating',
|
|
48
|
+
] as const;
|
|
49
|
+
|
|
50
|
+
export type FleetStatusVerdict = (typeof FLEET_STATUS_VERDICTS)[number];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Verdicts a fleet stays in until new input arrives: a sync, a retry, a
|
|
54
|
+
* reactivation, or a payment. Polling one of these changes nothing, so every
|
|
55
|
+
* wait stops on them; the other verdicts are still moving on their own.
|
|
56
|
+
* `getMonitorFleet` answers these four without a "poll again" `next`.
|
|
57
|
+
*/
|
|
58
|
+
export const FLEET_SETTLED_VERDICTS = [
|
|
59
|
+
'converged',
|
|
60
|
+
'degraded',
|
|
61
|
+
'deactivated',
|
|
62
|
+
'billing_suspended',
|
|
63
|
+
] as const satisfies readonly FleetStatusVerdict[];
|
|
48
64
|
|
|
49
65
|
/**
|
|
50
66
|
* A Fleet's customer state. A Fleet has no `provisioning` state: its first
|
|
@@ -676,6 +676,24 @@
|
|
|
676
676
|
"failureAlert": "vercel_route_wrapper",
|
|
677
677
|
"domainReportRequired": true
|
|
678
678
|
},
|
|
679
|
+
{
|
|
680
|
+
"id": "vercel.prebuilt-hit-rate-daily",
|
|
681
|
+
"name": "Prebuilt hit rate daily",
|
|
682
|
+
"scheduler": "vercel_cron",
|
|
683
|
+
"cadence": "20 0 * * *",
|
|
684
|
+
"timezone": "UTC",
|
|
685
|
+
"source": "apps/deepline-api/vercel.json",
|
|
686
|
+
"locator": "/api/v2/cron/prebuilt-hit-rate-daily",
|
|
687
|
+
"owner": "product",
|
|
688
|
+
"criticality": "reporting",
|
|
689
|
+
"purpose": "Count the previous UTC day's customer prebuilt Play output rows and rows with a result, per Play and workspace, before the cost stats refresh folds them into the hit rate search shows.",
|
|
690
|
+
"successDefinition": "Every scored prebuilt's successful customer root runs from that day are counted from their sheets and saved to prebuiltPlayResultDays.",
|
|
691
|
+
"failureDefinition": "Run listing, sheet reads or the Convex write fail, leaving the day's counts missing or partial.",
|
|
692
|
+
"startGraceMs": 300000,
|
|
693
|
+
"runTimeoutMs": 600000,
|
|
694
|
+
"failureAlert": "vercel_route_wrapper",
|
|
695
|
+
"domainReportRequired": true
|
|
696
|
+
},
|
|
679
697
|
{
|
|
680
698
|
"id": "vercel.sdk-cli-activity-digest",
|
|
681
699
|
"name": "SDK CLI activity digest",
|
|
@@ -1540,6 +1558,24 @@
|
|
|
1540
1558
|
"failureAlert": "convex_action_wrapper",
|
|
1541
1559
|
"domainReportRequired": true
|
|
1542
1560
|
},
|
|
1561
|
+
{
|
|
1562
|
+
"id": "convex.monitor-findings-roll",
|
|
1563
|
+
"name": "Monitor findings roll",
|
|
1564
|
+
"scheduler": "convex_cron",
|
|
1565
|
+
"cadence": "13 * * * *",
|
|
1566
|
+
"timezone": "UTC",
|
|
1567
|
+
"source": "packages/convex/crons.ts",
|
|
1568
|
+
"locator": "monitor findings roll",
|
|
1569
|
+
"owner": "monitors",
|
|
1570
|
+
"criticality": "maintenance",
|
|
1571
|
+
"purpose": "Move every Monitors findings row that holds findings and is behind today forward, and prune findings dedupe markers older than the window.",
|
|
1572
|
+
"successDefinition": "Every row behind today is rolled within the pass budget, or the remainder is left for the next hourly pass; zero rows behind is a valid no-op.",
|
|
1573
|
+
"failureDefinition": "A roll or prune page fails, leaving findings window totals stale for the rows behind today.",
|
|
1574
|
+
"startGraceMs": 120000,
|
|
1575
|
+
"runTimeoutMs": 1800000,
|
|
1576
|
+
"failureAlert": "convex_action_wrapper",
|
|
1577
|
+
"domainReportRequired": true
|
|
1578
|
+
},
|
|
1543
1579
|
{
|
|
1544
1580
|
"id": "convex.cleanup-expired-notification-audit-records",
|
|
1545
1581
|
"name": "Cleanup expired notification audit records",
|
|
@@ -33,6 +33,7 @@ export const MANUALLY_RUNNABLE_CONVEX_CRON_JOB_IDS = [
|
|
|
33
33
|
'convex.observe-operational-queue-health',
|
|
34
34
|
'convex.cleanup-expired-notification-audit-records',
|
|
35
35
|
'convex.fail-stale-play-deployments',
|
|
36
|
+
'convex.monitor-findings-roll',
|
|
36
37
|
] as const;
|
|
37
38
|
|
|
38
39
|
export type ManuallyRunnableConvexCronJobId =
|
|
@@ -94,12 +95,12 @@ export const MAX_ORG_ALLOW_LIST = 20;
|
|
|
94
95
|
* `MAX_ORG_ALLOW_LIST` distinct, non-empty organization ids; an
|
|
95
96
|
* empty list would silently mean "nothing", which no caller intends.
|
|
96
97
|
*/
|
|
97
|
-
export function normalizeOrgAllowList(
|
|
98
|
-
orgIds: readonly string[],
|
|
99
|
-
): string[] {
|
|
98
|
+
export function normalizeOrgAllowList(orgIds: readonly string[]): string[] {
|
|
100
99
|
const normalized = orgIds.map((orgId) => orgId.trim());
|
|
101
100
|
if (normalized.length === 0) {
|
|
102
|
-
throw new Error(
|
|
101
|
+
throw new Error(
|
|
102
|
+
'An organization scope must name at least one organization.',
|
|
103
|
+
);
|
|
103
104
|
}
|
|
104
105
|
if (normalized.length > MAX_ORG_ALLOW_LIST) {
|
|
105
106
|
throw new Error(
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineBatchStrategyMap,
|
|
3
|
+
type BatchOperationStrategy,
|
|
4
|
+
} from './batching-types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Crustdata's company identify takes up to 25 values of one identifier type
|
|
8
|
+
* and answers each with its own `{ matched_on, match_type, matches }` entry,
|
|
9
|
+
* echoing the value exactly as sent. The endpoint allows 30 requests a minute,
|
|
10
|
+
* so one call per row made a 278-company Play wait about ten minutes.
|
|
11
|
+
*/
|
|
12
|
+
export const CRUSTDATA_COMPANY_IDENTIFY_MAX_BATCH_SIZE = 25;
|
|
13
|
+
|
|
14
|
+
const IDENTIFIER_FIELDS = [
|
|
15
|
+
'professional_network_profile_urls',
|
|
16
|
+
'domains',
|
|
17
|
+
'names',
|
|
18
|
+
] as const;
|
|
19
|
+
type IdentifierField = (typeof IDENTIFIER_FIELDS)[number];
|
|
20
|
+
|
|
21
|
+
type IdentifyPayload = Record<string, unknown>;
|
|
22
|
+
type IdentifyEntry = Record<string, unknown> & {
|
|
23
|
+
matched_on?: unknown;
|
|
24
|
+
matches?: unknown;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** A row that names one value of one batchable identifier, and nothing else. */
|
|
28
|
+
function batchableIdentifier(
|
|
29
|
+
payload: IdentifyPayload,
|
|
30
|
+
): { field: IdentifierField; value: string } | null {
|
|
31
|
+
const keys = Object.keys(payload);
|
|
32
|
+
if (keys.length !== 1) return null;
|
|
33
|
+
const field = IDENTIFIER_FIELDS.find((name) => name === keys[0]);
|
|
34
|
+
if (!field) return null;
|
|
35
|
+
const raw = payload[field];
|
|
36
|
+
const values = Array.isArray(raw) ? raw : [raw];
|
|
37
|
+
if (values.length !== 1 || typeof values[0] !== 'string') return null;
|
|
38
|
+
const value = values[0].trim();
|
|
39
|
+
return value ? { field, value } : null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function passthroughKey(payload: IdentifyPayload): string {
|
|
43
|
+
return `passthrough:${JSON.stringify(payload)}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Crustdata echoes the value; this only absorbs case and trailing slashes. */
|
|
47
|
+
function looseKey(value: string): string {
|
|
48
|
+
return value.trim().toLowerCase().replace(/\/+$/, '');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function entriesOf(fullResult: unknown): IdentifyEntry[] {
|
|
52
|
+
const list = Array.isArray(fullResult)
|
|
53
|
+
? fullResult
|
|
54
|
+
: (fullResult as { data?: unknown } | null)?.data;
|
|
55
|
+
if (!Array.isArray(list)) {
|
|
56
|
+
throw new Error('crustdata_v3_company_identify returned no result list.');
|
|
57
|
+
}
|
|
58
|
+
return list as IdentifyEntry[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const crustdataCompanyIdentifyBatchStrategy: BatchOperationStrategy<
|
|
62
|
+
IdentifyPayload,
|
|
63
|
+
IdentifyPayload,
|
|
64
|
+
object,
|
|
65
|
+
IdentifyEntry[]
|
|
66
|
+
> = {
|
|
67
|
+
sourceOperation: 'crustdata_v3_company_identify',
|
|
68
|
+
batchOperation: 'crustdata_v3_company_identify',
|
|
69
|
+
kind: 'identifier_batch',
|
|
70
|
+
maxBatchSize: CRUSTDATA_COMPANY_IDENTIFY_MAX_BATCH_SIZE,
|
|
71
|
+
// The legacy raw view is the same list, but rawV2 is the documented shape.
|
|
72
|
+
resultView: 'rawV2',
|
|
73
|
+
// The provider takes exactly one identifier type per request.
|
|
74
|
+
canBatchWith(left, right) {
|
|
75
|
+
const a = batchableIdentifier(left);
|
|
76
|
+
const b = batchableIdentifier(right);
|
|
77
|
+
return Boolean(a && b && a.field === b.field);
|
|
78
|
+
},
|
|
79
|
+
// A row naming several values, several identifier types or other fields is
|
|
80
|
+
// sent alone, exactly as written.
|
|
81
|
+
toBucketKey(payload) {
|
|
82
|
+
const identifier = batchableIdentifier(payload);
|
|
83
|
+
return identifier
|
|
84
|
+
? `crustdata_v3_company_identify:${identifier.field}`
|
|
85
|
+
: passthroughKey(payload);
|
|
86
|
+
},
|
|
87
|
+
toItemKey(payload) {
|
|
88
|
+
const identifier = batchableIdentifier(payload);
|
|
89
|
+
return identifier
|
|
90
|
+
? JSON.stringify([identifier.field, identifier.value])
|
|
91
|
+
: passthroughKey(payload);
|
|
92
|
+
},
|
|
93
|
+
compile(payloads) {
|
|
94
|
+
const [only] = payloads;
|
|
95
|
+
if (payloads.length === 1 && only && !batchableIdentifier(only)) {
|
|
96
|
+
return {
|
|
97
|
+
batchOperation: 'crustdata_v3_company_identify',
|
|
98
|
+
batchPayload: only,
|
|
99
|
+
items: [{ itemKey: passthroughKey(only), payload: only }],
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const identifiers = payloads.map((payload) => {
|
|
103
|
+
const identifier = batchableIdentifier(payload);
|
|
104
|
+
if (!identifier) {
|
|
105
|
+
throw new Error(
|
|
106
|
+
'crustdata_v3_company_identify batched a row without one identifier.',
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return identifier;
|
|
110
|
+
});
|
|
111
|
+
return {
|
|
112
|
+
batchOperation: 'crustdata_v3_company_identify',
|
|
113
|
+
batchPayload: {
|
|
114
|
+
[identifiers[0]!.field]: identifiers.map(({ value }) => value),
|
|
115
|
+
},
|
|
116
|
+
items: payloads.map((payload, index) => ({
|
|
117
|
+
itemKey: JSON.stringify([
|
|
118
|
+
identifiers[index]!.field,
|
|
119
|
+
identifiers[index]!.value,
|
|
120
|
+
]),
|
|
121
|
+
payload,
|
|
122
|
+
})),
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
splitResult(fullResult, compiled) {
|
|
126
|
+
const entries = entriesOf(fullResult);
|
|
127
|
+
if (
|
|
128
|
+
compiled.items.length === 1 &&
|
|
129
|
+
compiled.items[0]!.itemKey.startsWith('passthrough:')
|
|
130
|
+
) {
|
|
131
|
+
return [
|
|
132
|
+
{
|
|
133
|
+
itemKey: compiled.items[0]!.itemKey,
|
|
134
|
+
result: entries,
|
|
135
|
+
rawResult: entries,
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
const exact = new Map<string, IdentifyEntry>();
|
|
140
|
+
const loose = new Map<string, IdentifyEntry>();
|
|
141
|
+
for (const entry of entries) {
|
|
142
|
+
if (typeof entry?.matched_on !== 'string') continue;
|
|
143
|
+
exact.set(entry.matched_on, entry);
|
|
144
|
+
loose.set(looseKey(entry.matched_on), entry);
|
|
145
|
+
}
|
|
146
|
+
return compiled.items.map((item) => {
|
|
147
|
+
const [, value] = JSON.parse(item.itemKey) as [string, string];
|
|
148
|
+
const entry = exact.get(value) ?? loose.get(looseKey(value));
|
|
149
|
+
if (!entry) {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`crustdata_v3_company_identify omitted the result for ${value}.`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
// The list a single-value request returns.
|
|
155
|
+
return { itemKey: item.itemKey, result: [entry], rawResult: [entry] };
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const crustdataCompanyIdentifyBatchStrategies = defineBatchStrategyMap({
|
|
161
|
+
crustdata_v3_company_identify: crustdataCompanyIdentifyBatchStrategy,
|
|
162
|
+
});
|
|
@@ -47,6 +47,11 @@
|
|
|
47
47
|
*/
|
|
48
48
|
import { PLAY_RUNNER_TERMINAL_GRACE_SECONDS } from './/runtime-constants';
|
|
49
49
|
import { DAYTONA_PLAY_RUNNER_LABEL_SOURCE } from './/runner-backends/backends/daytona-labels';
|
|
50
|
+
import {
|
|
51
|
+
runtimeSandboxOperationFromStates,
|
|
52
|
+
runtimeSandboxOperationFromStatesSqlCast,
|
|
53
|
+
runtimeSandboxOperationTargetState,
|
|
54
|
+
} from './/scheduler-backends/runtime-sandbox-operation';
|
|
50
55
|
|
|
51
56
|
export { DAYTONA_PLAY_RUNNER_LABEL_SOURCE };
|
|
52
57
|
|
|
@@ -535,6 +540,9 @@ export function createPostgresDaytonaJanitorOwnershipPort(input: {
|
|
|
535
540
|
const cleanup = `${quoteIdent(input.schema)}.${quoteIdent(
|
|
536
541
|
'sandbox_cleanup_jobs_v2',
|
|
537
542
|
)}`;
|
|
543
|
+
const operationStates = runtimeSandboxOperationFromStatesSqlCast(
|
|
544
|
+
quoteIdent(input.schema),
|
|
545
|
+
);
|
|
538
546
|
return {
|
|
539
547
|
async inspect({ sandboxId, routingDomain }) {
|
|
540
548
|
if (!routingDomain) {
|
|
@@ -688,10 +696,10 @@ export function createPostgresDaytonaJanitorOwnershipPort(input: {
|
|
|
688
696
|
WHERE NOT EXISTS (SELECT 1 FROM inserted)
|
|
689
697
|
), transitioned AS (
|
|
690
698
|
UPDATE ${operations} AS operation
|
|
691
|
-
SET state =
|
|
699
|
+
SET state = $6, updated_at = clock_timestamp()
|
|
692
700
|
FROM owned
|
|
693
701
|
WHERE operation.operation_key = owned.operation_key
|
|
694
|
-
AND operation.state =
|
|
702
|
+
AND operation.state = ANY($7::${operationStates})
|
|
695
703
|
AND EXISTS (
|
|
696
704
|
SELECT 1 FROM current_cleanup
|
|
697
705
|
WHERE current_cleanup.run_id = owned.run_id
|
|
@@ -709,7 +717,15 @@ export function createPostgresDaytonaJanitorOwnershipPort(input: {
|
|
|
709
717
|
FROM owned
|
|
710
718
|
LEFT JOIN current_cleanup ON TRUE
|
|
711
719
|
`,
|
|
712
|
-
[
|
|
720
|
+
[
|
|
721
|
+
operationKey,
|
|
722
|
+
sandboxId,
|
|
723
|
+
routingDomain,
|
|
724
|
+
runId,
|
|
725
|
+
attempt,
|
|
726
|
+
runtimeSandboxOperationTargetState('janitor_authorize_cleanup'),
|
|
727
|
+
runtimeSandboxOperationFromStates('janitor_authorize_cleanup'),
|
|
728
|
+
],
|
|
713
729
|
);
|
|
714
730
|
const row = result.rows[0];
|
|
715
731
|
if (!row) return 'ownership_missing';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bouncebanBatchStrategies } from './/bounceban-batching';
|
|
2
2
|
import type { AnyBatchOperationStrategy } from './batching-types';
|
|
3
3
|
import { bettercontactBatchStrategies } from './bettercontact-batching';
|
|
4
|
+
import { crustdataCompanyIdentifyBatchStrategies } from './crustdata-company-identify-batching';
|
|
4
5
|
import { DEFAULT_PLAY_RUNTIME_BATCH_STRATEGIES } from './default-batch-strategies';
|
|
5
6
|
import { freeCompanyLookupBatchStrategies } from './free-company-lookup-batching';
|
|
6
7
|
import { fullenrichBatchStrategies } from './fullenrich-batching';
|
|
@@ -16,6 +17,7 @@ export const PLAY_RUNTIME_BATCH_OPERATION_REGISTRY: Record<
|
|
|
16
17
|
...DEFAULT_PLAY_RUNTIME_BATCH_STRATEGIES,
|
|
17
18
|
...bettercontactBatchStrategies,
|
|
18
19
|
...bouncebanBatchStrategies,
|
|
20
|
+
...crustdataCompanyIdentifyBatchStrategies,
|
|
19
21
|
...freeCompanyLookupBatchStrategies,
|
|
20
22
|
...fullenrichBatchStrategies,
|
|
21
23
|
...opensosdataBatchStrategies,
|
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
import { RECEIPT_STATUS_CODE } from './receipt-status';
|
|
2
|
+
import {
|
|
3
|
+
tenantWorkReceiptClaimTransition,
|
|
4
|
+
tenantWorkReceiptFromStatuses,
|
|
5
|
+
WORK_RECEIPT_LIVE_STATUSES,
|
|
6
|
+
} from './work-receipt-state-machine';
|
|
2
7
|
|
|
8
|
+
/** The claim's allowed-from codes, from `TENANT_WORK_RECEIPT_TRANSITIONS`. */
|
|
3
9
|
export function workReceiptClaimableStatusCodes(input: {
|
|
4
10
|
forceRefresh?: boolean;
|
|
5
11
|
forceFailedRefresh?: boolean;
|
|
6
12
|
reclaimRunning?: boolean;
|
|
7
13
|
}): number[] {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
RECEIPT_STATUS_CODE.failed,
|
|
12
|
-
...(input.reclaimRunning === true ? [RECEIPT_STATUS_CODE.running] : []),
|
|
13
|
-
RECEIPT_STATUS_CODE.completed,
|
|
14
|
-
RECEIPT_STATUS_CODE.skipped,
|
|
15
|
-
];
|
|
16
|
-
}
|
|
17
|
-
if (input.reclaimRunning === true) {
|
|
18
|
-
return [
|
|
19
|
-
RECEIPT_STATUS_CODE.queued,
|
|
20
|
-
RECEIPT_STATUS_CODE.running,
|
|
21
|
-
RECEIPT_STATUS_CODE.failed,
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
return [RECEIPT_STATUS_CODE.queued, RECEIPT_STATUS_CODE.failed];
|
|
14
|
+
return tenantWorkReceiptFromStatuses(
|
|
15
|
+
tenantWorkReceiptClaimTransition(input),
|
|
16
|
+
).map((status) => RECEIPT_STATUS_CODE[status]);
|
|
25
17
|
}
|
|
26
18
|
|
|
19
|
+
/** `queued` and `running`: the live statuses an owner may still write. */
|
|
20
|
+
const LIVE_STATUS_CODES_SQL = WORK_RECEIPT_LIVE_STATUSES.map(
|
|
21
|
+
(status) => `${RECEIPT_STATUS_CODE[status]}::smallint`,
|
|
22
|
+
).join(',\n ');
|
|
23
|
+
|
|
27
24
|
export function workReceiptClaimConflictPredicateSql(input: {
|
|
28
25
|
receiptTable: string;
|
|
29
26
|
claimableStatusesSql: string;
|
|
@@ -146,8 +143,7 @@ export function workReceiptActiveOwnerPredicateSql(input: {
|
|
|
146
143
|
const table = input.receiptTable;
|
|
147
144
|
const ownerRunAttemptSql = input.ownerRunAttemptSql ?? '0';
|
|
148
145
|
return `${table}.status IN (
|
|
149
|
-
${
|
|
150
|
-
${RECEIPT_STATUS_CODE.running}::smallint
|
|
146
|
+
${LIVE_STATUS_CODES_SQL}
|
|
151
147
|
)
|
|
152
148
|
/* owner: runtime; remove lease-owner fallback compat after ledger cutover M1 */
|
|
153
149
|
AND COALESCE(${table}.lease_owner_run_id, ${table}.run_id) = ${input.ownerRunIdSql}
|
|
@@ -176,8 +172,7 @@ export function workReceiptReleaseOwnerPredicateSql(input: {
|
|
|
176
172
|
const table = input.receiptTable;
|
|
177
173
|
const ownerRunAttemptSql = input.ownerRunAttemptSql ?? '0';
|
|
178
174
|
return `${table}.status IN (
|
|
179
|
-
${
|
|
180
|
-
${RECEIPT_STATUS_CODE.running}::smallint
|
|
175
|
+
${LIVE_STATUS_CODES_SQL}
|
|
181
176
|
)
|
|
182
177
|
/* owner: runtime; remove lease-owner fallback compat after ledger cutover M1 */
|
|
183
178
|
AND COALESCE(${table}.lease_owner_run_id, ${table}.run_id) = ${input.ownerRunIdSql}
|
|
@@ -195,8 +190,7 @@ export function workReceiptHeartbeatPredicateSql(input: {
|
|
|
195
190
|
const table = input.receiptTable;
|
|
196
191
|
const ownerRunAttemptSql = input.ownerRunAttemptSql ?? '0';
|
|
197
192
|
return `${table}.status IN (
|
|
198
|
-
${
|
|
199
|
-
${RECEIPT_STATUS_CODE.running}::smallint
|
|
193
|
+
${LIVE_STATUS_CODES_SQL}
|
|
200
194
|
)
|
|
201
195
|
/* owner: runtime; remove lease-owner fallback compat after ledger cutover M1 */
|
|
202
196
|
AND COALESCE(${table}.lease_owner_run_id, ${table}.run_id) = ${input.ownerRunIdSql}
|
|
@@ -111,6 +111,26 @@ function classifyDaytonaAcquisitionFailure(
|
|
|
111
111
|
return null;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
// Raised only by a failed Modal create or an open Modal circuit, so no Play code
|
|
115
|
+
// has started. A timed-out create can still produce a sandbox; the Modal
|
|
116
|
+
// backend records it for cleanup and never runs the Play in it. Modal failures
|
|
117
|
+
// after create stay on Modal.
|
|
118
|
+
const MODAL_PRE_CREATE_RECOVERY_REASONS: ReadonlySet<string> = new Set([
|
|
119
|
+
'modal_capacity_exhausted_before_execution',
|
|
120
|
+
'modal_sandbox_unavailable_before_execution',
|
|
121
|
+
'modal_circuit_open_before_execution',
|
|
122
|
+
]);
|
|
123
|
+
|
|
124
|
+
function classifyModalAcquisitionFailure(
|
|
125
|
+
error: unknown,
|
|
126
|
+
): RuntimeSandboxPlacementFailureReason | null {
|
|
127
|
+
if (!isPlayRunRecoveryError(error)) return null;
|
|
128
|
+
return error.decision.stage === 'pre_code' &&
|
|
129
|
+
MODAL_PRE_CREATE_RECOVERY_REASONS.has(error.decision.reason)
|
|
130
|
+
? 'provider_capacity_exhausted'
|
|
131
|
+
: null;
|
|
132
|
+
}
|
|
133
|
+
|
|
114
134
|
/**
|
|
115
135
|
* Deep placement Implementation. Provider order alone never permits a retry:
|
|
116
136
|
* the policy must also name the exact pre-execution transition and the source
|
|
@@ -261,7 +281,7 @@ export function createRuntimeSandboxPlacementBackendForPolicy(
|
|
|
261
281
|
},
|
|
262
282
|
modal: {
|
|
263
283
|
backend: overrides.modal ?? modalPlayRunnerBackend,
|
|
264
|
-
classifyAcquisitionFailure:
|
|
284
|
+
classifyAcquisitionFailure: classifyModalAcquisitionFailure,
|
|
265
285
|
},
|
|
266
286
|
},
|
|
267
287
|
});
|
|
@@ -298,6 +318,11 @@ export const modalOnlyPlayRunnerBackend =
|
|
|
298
318
|
RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalOnlyV1,
|
|
299
319
|
);
|
|
300
320
|
|
|
321
|
+
export const modalThenDaytonaPlayRunnerBackend =
|
|
322
|
+
createRuntimeSandboxPlacementBackendForPolicy(
|
|
323
|
+
RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalThenDaytonaV1,
|
|
324
|
+
);
|
|
325
|
+
|
|
301
326
|
const DEFAULT_POLICY_BACKENDS: Readonly<
|
|
302
327
|
Record<RuntimeSandboxPlacementPolicyId, PlayRunnerBackend>
|
|
303
328
|
> = {
|
|
@@ -308,6 +333,8 @@ const DEFAULT_POLICY_BACKENDS: Readonly<
|
|
|
308
333
|
[RUNTIME_SANDBOX_PLACEMENT_POLICIES.daytonaModalCanaryV1]:
|
|
309
334
|
daytonaModalCanaryPlayRunnerBackend,
|
|
310
335
|
[RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalOnlyV1]: modalOnlyPlayRunnerBackend,
|
|
336
|
+
[RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalThenDaytonaV1]:
|
|
337
|
+
modalThenDaytonaPlayRunnerBackend,
|
|
311
338
|
};
|
|
312
339
|
|
|
313
340
|
export function resolveDefaultRuntimeSandboxPlacementBackend(
|
|
@@ -19,6 +19,7 @@ export const RUNTIME_SANDBOX_PLACEMENT_POLICIES = {
|
|
|
19
19
|
daytonaThenModalV1: 'daytona_then_modal@1',
|
|
20
20
|
daytonaModalCanaryV1: 'daytona_modal_canary@1',
|
|
21
21
|
modalOnlyV1: 'modal_only@1',
|
|
22
|
+
modalThenDaytonaV1: 'modal_then_daytona@1',
|
|
22
23
|
} as const;
|
|
23
24
|
|
|
24
25
|
/** Deployment-scoped policy selection for an isolated runtime lane. */
|
|
@@ -169,6 +170,40 @@ const MODAL_ONLY_V1: RuntimeSandboxPlacementPolicy = {
|
|
|
169
170
|
cleanupProviders: [RUNTIME_SANDBOX_PROVIDERS.modal],
|
|
170
171
|
};
|
|
171
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Modal first, for when Daytona is unhealthy. It runs on the Daytona lane and
|
|
175
|
+
* artifact, so switching the default needs no new worker. Daytona is used only
|
|
176
|
+
* when the Modal sandbox create fails, before any Play code started. A create
|
|
177
|
+
* that timed out may still produce a Modal sandbox; that sandbox is recorded as
|
|
178
|
+
* a cleanup obligation and never runs the Play. Any later Modal failure stays
|
|
179
|
+
* on Modal.
|
|
180
|
+
*/
|
|
181
|
+
const MODAL_THEN_DAYTONA_V1: RuntimeSandboxPlacementPolicy = {
|
|
182
|
+
id: RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalThenDaytonaV1,
|
|
183
|
+
compatibilityRuntimeBackend: PLAY_RUNTIME_BACKENDS.daytona,
|
|
184
|
+
providers: [
|
|
185
|
+
RUNTIME_SANDBOX_PROVIDERS.modal,
|
|
186
|
+
RUNTIME_SANDBOX_PROVIDERS.daytona,
|
|
187
|
+
],
|
|
188
|
+
transitions: [
|
|
189
|
+
{
|
|
190
|
+
from: RUNTIME_SANDBOX_PROVIDERS.modal,
|
|
191
|
+
to: RUNTIME_SANDBOX_PROVIDERS.daytona,
|
|
192
|
+
stage: 'acquisition',
|
|
193
|
+
reasons: ['provider_capacity_exhausted'],
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
requiredCredentialEnv: [
|
|
197
|
+
'DAYTONA_API_KEY',
|
|
198
|
+
'MODAL_TOKEN_ID',
|
|
199
|
+
'MODAL_TOKEN_SECRET',
|
|
200
|
+
],
|
|
201
|
+
cleanupProviders: [
|
|
202
|
+
RUNTIME_SANDBOX_PROVIDERS.daytona,
|
|
203
|
+
RUNTIME_SANDBOX_PROVIDERS.modal,
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
|
|
172
207
|
export const RUNTIME_SANDBOX_PLACEMENT_POLICY_CATALOG: Readonly<
|
|
173
208
|
Record<RuntimeSandboxPlacementPolicyId, RuntimeSandboxPlacementPolicy>
|
|
174
209
|
> = {
|
|
@@ -178,6 +213,8 @@ export const RUNTIME_SANDBOX_PLACEMENT_POLICY_CATALOG: Readonly<
|
|
|
178
213
|
[RUNTIME_SANDBOX_PLACEMENT_POLICIES.daytonaModalCanaryV1]:
|
|
179
214
|
DAYTONA_MODAL_CANARY_V1,
|
|
180
215
|
[RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalOnlyV1]: MODAL_ONLY_V1,
|
|
216
|
+
[RUNTIME_SANDBOX_PLACEMENT_POLICIES.modalThenDaytonaV1]:
|
|
217
|
+
MODAL_THEN_DAYTONA_V1,
|
|
181
218
|
};
|
|
182
219
|
|
|
183
220
|
export function resolveRuntimeSandboxPlacementPolicy(
|
|
@@ -214,6 +251,44 @@ export function runtimeSandboxPlacementPolicyForBackend(
|
|
|
214
251
|
return null;
|
|
215
252
|
}
|
|
216
253
|
|
|
254
|
+
/**
|
|
255
|
+
* The policy a default launch on `backend` writes: one with no explicit
|
|
256
|
+
* policy, preview namespace or internal placement pin. `operatorDefaultId` is
|
|
257
|
+
* the stored operator switch (`deepline-admin runtime placement set`). It
|
|
258
|
+
* replaces the backend's policy only for the backend that policy runs on, so a
|
|
259
|
+
* Modal-first value does not touch local or Modal-backend launches.
|
|
260
|
+
*/
|
|
261
|
+
export function resolveDefaultRuntimeSandboxPlacementPolicy(
|
|
262
|
+
backend: PlayRuntimeBackendId,
|
|
263
|
+
operatorDefaultId?: RuntimeSandboxPlacementPolicyId | null,
|
|
264
|
+
): RuntimeSandboxPlacementPolicy | null {
|
|
265
|
+
if (operatorDefaultId) {
|
|
266
|
+
const policy = resolveRuntimeSandboxPlacementPolicy(operatorDefaultId);
|
|
267
|
+
if (policy.compatibilityRuntimeBackend === backend) return policy;
|
|
268
|
+
}
|
|
269
|
+
return runtimeSandboxPlacementPolicyForBackend(backend);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* The policy ids an operator may store as the default for `backend`. The
|
|
274
|
+
* frozen `daytona_only@1` compatibility policy is excluded: new launches must
|
|
275
|
+
* not write it, or its retirement would never finish.
|
|
276
|
+
*/
|
|
277
|
+
export function operatorDefaultRuntimeSandboxPlacementPolicyIds(
|
|
278
|
+
backend: PlayRuntimeBackendId,
|
|
279
|
+
): readonly RuntimeSandboxPlacementPolicyId[] {
|
|
280
|
+
return runtimeSandboxPlacementPoliciesForBackend(backend)
|
|
281
|
+
.filter((policy) => policy !== DAYTONA_ONLY_V1)
|
|
282
|
+
.map((policy) => policy.id);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** Whether this build knows `id`. Older or newer releases may not. */
|
|
286
|
+
export function isKnownRuntimeSandboxPlacementPolicyId(
|
|
287
|
+
id: string,
|
|
288
|
+
): id is RuntimeSandboxPlacementPolicyId {
|
|
289
|
+
return Object.hasOwn(RUNTIME_SANDBOX_PLACEMENT_POLICY_CATALOG, id.trim());
|
|
290
|
+
}
|
|
291
|
+
|
|
217
292
|
export function runtimeSandboxPlacementPoliciesForBackend(
|
|
218
293
|
backend: PlayRuntimeBackendId,
|
|
219
294
|
): readonly RuntimeSandboxPlacementPolicy[] {
|