deepline 0.3.525 → 0.3.527
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/agent-runtime.ts +98 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +14 -5
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure-class.ts +98 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +24 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +35 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +39 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +50 -8
- package/dist/cli/auth-C7BBYIQD.js +43 -0
- package/dist/cli/{auth-TH3VGYBK.mjs → auth-LRMMQFJ4.mjs} +5 -5
- package/dist/cli/{billing-TWKVUFU2.js → billing-M76MMWZB.js} +82 -82
- package/dist/cli/{billing-CMHFI2LN.mjs → billing-WZZDXVRJ.mjs} +7 -7
- package/dist/cli/{chunk-CQSANB3V.js → chunk-2A6IRSE6.js} +5 -5
- package/dist/cli/{chunk-CZNEQMJR.mjs → chunk-2L3HVEBM.mjs} +1 -1
- package/dist/cli/{chunk-DYS3KWYF.js → chunk-3L2DNG5X.js} +11 -11
- package/dist/cli/{chunk-2WFVLOB7.js → chunk-3PQDEBO6.js} +1 -1
- package/dist/cli/{chunk-KPINGHIF.mjs → chunk-4YN7DZEA.mjs} +2 -2
- package/dist/cli/{chunk-OXFIJYN3.mjs → chunk-5YR6CDJ2.mjs} +6 -6
- package/dist/cli/{chunk-5JFAQUZS.js → chunk-66YLAQ2X.js} +26 -26
- package/dist/cli/{chunk-U4M32NFS.mjs → chunk-77VNC2KF.mjs} +1 -1
- package/dist/cli/{chunk-TFEGJEYO.js → chunk-7DPWGAOU.js} +3 -3
- package/dist/cli/{chunk-WEYFSBAD.mjs → chunk-7FCD34YS.mjs} +18 -11
- package/dist/cli/{chunk-CLTL7ZJI.mjs → chunk-AXFHQWGA.mjs} +1 -1
- package/dist/cli/{chunk-4UWXFXQF.js → chunk-C7A44BZ7.js} +3 -3
- package/dist/cli/{chunk-LAMGJQDY.mjs → chunk-E4TEZE62.mjs} +2 -2
- package/dist/cli/{chunk-S5LUY3KJ.js → chunk-EOL7PXLW.js} +7 -7
- package/dist/cli/{chunk-N4MMU3QF.js → chunk-ETXQZGQU.js} +16 -16
- package/dist/cli/{chunk-IMO3HXWZ.mjs → chunk-GIRMVMXP.mjs} +1 -1
- package/dist/cli/{chunk-YC7FKAJ4.mjs → chunk-HA2J2OAS.mjs} +10 -10
- package/dist/cli/{chunk-NRBCETWL.js → chunk-HB3YUHEL.js} +44 -44
- package/dist/cli/{chunk-P62LON53.js → chunk-HQZLTK3P.js} +2 -2
- package/dist/cli/{chunk-UQYKSOGO.mjs → chunk-JEIGNX3G.mjs} +5 -5
- package/dist/cli/{chunk-LE537GBC.js → chunk-JSEISVAZ.js} +138 -78
- package/dist/cli/{chunk-GCLNX72G.mjs → chunk-JSVHBJE2.mjs} +2 -2
- package/dist/cli/{chunk-ETHVJ2ZE.mjs → chunk-KDFUQRVU.mjs} +1 -1
- package/dist/cli/{chunk-QR7VYYNM.js → chunk-LHMHUA5D.js} +7 -7
- package/dist/cli/{chunk-ZWFTHEPT.mjs → chunk-M45S7JAY.mjs} +2 -2
- package/dist/cli/{chunk-WGRDOPAK.mjs → chunk-MIL5YDKZ.mjs} +2 -2
- package/dist/cli/{chunk-TXSBPBHB.mjs → chunk-MMM2WMTF.mjs} +5 -5
- package/dist/cli/{chunk-EP6YH6QJ.mjs → chunk-NVII3RWQ.mjs} +2 -2
- package/dist/cli/{chunk-V2GN4PLK.js → chunk-OKRBGXDI.js} +5 -5
- package/dist/cli/{chunk-LXKH4MKH.js → chunk-OLSATEDQ.js} +6 -6
- package/dist/cli/{chunk-V65J64FL.js → chunk-OXHY3LD3.js} +53 -53
- package/dist/cli/{chunk-OWQF6WVH.mjs → chunk-P5ZU5ZHA.mjs} +61 -1
- package/dist/cli/{chunk-RMZ6CISE.mjs → chunk-QKKT5G4K.mjs} +3 -3
- package/dist/cli/{chunk-JVWSIA2V.mjs → chunk-QKY3H3HA.mjs} +4 -4
- package/dist/cli/{chunk-WA3FG7DH.js → chunk-R6IWWPY7.js} +14 -14
- package/dist/cli/{chunk-MRUFGOJR.js → chunk-RGL2YGJZ.js} +2 -2
- package/dist/cli/{chunk-7C4F4TLR.mjs → chunk-RMCKTV4R.mjs} +1 -1
- package/dist/cli/{chunk-NO4URKKT.mjs → chunk-RTPLRMEB.mjs} +5 -5
- package/dist/cli/{chunk-ESWM2JW4.js → chunk-SRQQAUXN.js} +2 -2
- package/dist/cli/{chunk-CKTRQSRA.js → chunk-UAQ7ZWRP.js} +22 -22
- package/dist/cli/{chunk-7OF3A4KJ.mjs → chunk-UJHS2O5O.mjs} +84 -57
- package/dist/cli/{chunk-VYIAWAKJ.mjs → chunk-UKOG6PCB.mjs} +1 -1
- package/dist/cli/{chunk-UXF3ODJJ.mjs → chunk-VTXBV4AX.mjs} +1 -1
- package/dist/cli/{chunk-M43ZYNDA.mjs → chunk-VV2AFJ3I.mjs} +5 -5
- package/dist/cli/{chunk-CWRL6IQP.js → chunk-WL6GAZBD.js} +18 -11
- package/dist/cli/{chunk-NB2ECLQE.js → chunk-XI47UAVU.js} +9 -9
- package/dist/cli/{chunk-AVDEYOVP.js → chunk-XYG4IOJK.js} +98 -98
- package/dist/cli/{chunk-KEZ3KBWW.js → chunk-YJ4YVFXC.js} +97 -70
- package/dist/cli/{chunk-5BSGWIQD.mjs → chunk-YKPMIJJ2.mjs} +2 -2
- package/dist/cli/{chunk-MHBSRNI7.js → chunk-YSDPYQBH.js} +41 -41
- package/dist/cli/{chunk-KBOSALBI.js → chunk-YUYDP2EG.js} +6 -6
- package/dist/cli/{chunk-TO72GW5I.js → chunk-ZHY7AY5V.js} +16 -16
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-OO554TPX.mjs → csv-FEFNXZF7.mjs} +4 -4
- package/dist/cli/{csv-5JHWVJ5N.js → csv-IRP6VT7Q.js} +13 -13
- package/dist/cli/{db-SQKJ6RKU.mjs → db-IHECMWZ3.mjs} +6 -6
- package/dist/cli/{db-CYQJ4OXF.js → db-Y5VNPNRD.js} +27 -27
- package/dist/cli/describe-MNJVJHRE.js +50 -0
- package/dist/cli/{describe-N7AKTUQV.mjs → describe-XCVC2WLL.mjs} +18 -18
- package/dist/cli/{executions-F34DORW6.mjs → executions-3FWZYUJV.mjs} +6 -6
- package/dist/cli/{executions-K7EGCRKX.js → executions-QH3KJ6MA.js} +8 -8
- package/dist/cli/{feedback-NOQVCA3Q.js → feedback-BGHWMOLH.js} +65 -17
- package/dist/cli/{feedback-GQHKCS66.mjs → feedback-F3OZXOPM.mjs} +61 -13
- package/dist/cli/git-MDOHEW5J.js +25 -0
- package/dist/cli/{git-2EEITXDB.mjs → git-RWPH3D75.mjs} +5 -5
- package/dist/cli/index.js +145 -145
- package/dist/cli/index.mjs +44 -44
- package/dist/cli/{legacy-noops-JHMY5XRB.mjs → legacy-noops-5ADSTBJ5.mjs} +6 -6
- package/dist/cli/{legacy-noops-RFNHQ7RG.js → legacy-noops-G6CYD5LM.js} +9 -9
- package/dist/cli/{monitors-RDMP6SPZ.mjs → monitors-AFNAU3A2.mjs} +7 -7
- package/dist/cli/{monitors-UKRZ4BDK.js → monitors-VZCBZO26.js} +100 -100
- package/dist/cli/{org-RF3G4KMB.mjs → org-JVLYTU24.mjs} +6 -6
- package/dist/cli/{org-OX7TYTHV.js → org-X4QRYBC4.js} +86 -86
- package/dist/cli/{pages-FBM3MGSP.mjs → pages-VELKZKBL.mjs} +6 -6
- package/dist/cli/{pages-MKQT5LFV.js → pages-YMM4KBW5.js} +18 -18
- package/dist/cli/{play-OOVX2DMV.js → play-J7DEBHI7.js} +317 -317
- package/dist/cli/{play-YWC2UORM.mjs → play-MIY6BYRB.mjs} +18 -18
- package/dist/cli/{providers-3PEQESIU.mjs → providers-2H3W3W7G.mjs} +6 -6
- package/dist/cli/{providers-2CGZYLER.js → providers-TOUB7Y2A.js} +9 -9
- package/dist/cli/{quickstart-KVB36SOW.mjs → quickstart-GKAS5265.mjs} +4 -4
- package/dist/cli/{quickstart-6AANHKQZ.js → quickstart-LHY2LN3P.js} +6 -6
- package/dist/cli/{run-QC23NRKO.mjs → run-KYGNOWYD.mjs} +23 -23
- package/dist/cli/{run-NJ7WV5TK.js → run-QCAVDPE5.js} +41 -41
- package/dist/cli/search-G67CEHR7.js +33 -0
- package/dist/cli/{search-7BMFFZI2.mjs → search-YPGAIFDX.mjs} +8 -8
- package/dist/cli/{search-output-XC2AVBFX.js → search-output-ASELNQ2U.js} +6 -6
- package/dist/cli/{search-output-CALZ4ZI2.mjs → search-output-OOC3VK4T.mjs} +4 -4
- package/dist/cli/{secrets-VHU4B2D4.js → secrets-KX3TQB4R.js} +15 -15
- package/dist/cli/{secrets-7ZHA57DI.mjs → secrets-VJ4XYSMZ.mjs} +6 -6
- package/dist/cli/sessions-KUN7H7E5.mjs +22 -0
- package/dist/cli/sessions-QILPX4XQ.js +22 -0
- package/dist/cli/{settings-WV77QJGD.js → settings-5NIF4BU7.js} +86 -86
- package/dist/cli/{settings-AVY4NNHI.mjs → settings-JKFYZ2IT.mjs} +13 -13
- package/dist/cli/{setup-AOUJ3RMU.mjs → setup-5AX3TN6G.mjs} +10 -10
- package/dist/cli/{setup-GE5TLTC4.js → setup-MYV3IHPS.js} +50 -50
- package/dist/cli/{skills-FVWO2G66.mjs → skills-JLS4CINQ.mjs} +8 -8
- package/dist/cli/skills-NG32XTZI.js +37 -0
- package/dist/cli/tools-OZG3V77R.js +57 -0
- package/dist/cli/{tools-URE655B4.mjs → tools-VBYKD3MJ.mjs} +17 -17
- package/dist/cli/{update-5B4G4345.mjs → update-QWAIVJRI.mjs} +10 -10
- package/dist/cli/update-YL5WVSKU.js +35 -0
- package/dist/cli/{views-GSECJ5IK.mjs → views-TBWGZAVZ.mjs} +6 -6
- package/dist/cli/{views-IC762HEQ.js → views-ZW56JZB5.js} +18 -18
- package/dist/cli/{workflow-EME7ZEOV.js → workflow-EKSZST6M.js} +17 -17
- package/dist/cli/{workflow-6UQM565I.mjs → workflow-X7UQPJMQ.mjs} +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +107 -106
- 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-K7PMRXNG.js +0 -43
- package/dist/cli/describe-PASXOL3R.js +0 -50
- package/dist/cli/git-UU4YFJ2Q.js +0 -25
- package/dist/cli/search-NH4DTXUK.js +0 -33
- package/dist/cli/sessions-2TE5JWVP.js +0 -18
- package/dist/cli/sessions-YYULWFZE.mjs +0 -18
- package/dist/cli/skills-OL7LD6QX.js +0 -37
- package/dist/cli/tools-VQ5JO6DI.js +0 -57
- package/dist/cli/update-7ZOIOTZN.js +0 -35
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { readdirSync, statSync } from 'node:fs';
|
|
1
2
|
import { homedir } from 'node:os';
|
|
3
|
+
import { basename, join } from 'node:path';
|
|
2
4
|
|
|
3
5
|
const EXPLICIT_AGENT_RUNTIMES = new Set([
|
|
4
6
|
'claude_code',
|
|
@@ -67,6 +69,102 @@ export function agentSessionIdFromEnvironment(
|
|
|
67
69
|
return null;
|
|
68
70
|
}
|
|
69
71
|
|
|
72
|
+
const SESSION_UUID_RE =
|
|
73
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
74
|
+
|
|
75
|
+
/** Whether a value has the UUID shape Claude and Codex session IDs use. */
|
|
76
|
+
export function isAgentSessionId(value: string): boolean {
|
|
77
|
+
return SESSION_UUID_RE.test(value);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The VM home of a Claude Cowork session, `/sessions/<name>`, taken from HOME
|
|
82
|
+
* or, when HOME is the bare `/sessions`, the working directory. These are the
|
|
83
|
+
* same homes isCoworkLikeSandbox treats as Cowork.
|
|
84
|
+
*/
|
|
85
|
+
export function coworkSessionHome(
|
|
86
|
+
env: Readonly<Record<string, string | undefined>> = process.env,
|
|
87
|
+
cwd: string = process.cwd(),
|
|
88
|
+
): string | null {
|
|
89
|
+
const home = env.HOME?.trim() || homedir();
|
|
90
|
+
const path = home === '/sessions' ? cwd : home;
|
|
91
|
+
return path.match(/^\/sessions\/(?!\.\.?(?:\/|$))[^/]+/)?.[0] ?? null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Directories holding Claude transcripts as `<root>/<project>/<id>.jsonl`:
|
|
96
|
+
* CLAUDE_CONFIG_DIR, the Cowork session's mounted config dir, then ~/.claude.
|
|
97
|
+
*/
|
|
98
|
+
export function claudeProjectsRoots(
|
|
99
|
+
env: Readonly<Record<string, string | undefined>> = process.env,
|
|
100
|
+
cwd: string = process.cwd(),
|
|
101
|
+
): string[] {
|
|
102
|
+
const roots: string[] = [];
|
|
103
|
+
const configDir = env.CLAUDE_CONFIG_DIR?.trim();
|
|
104
|
+
if (configDir) roots.push(join(configDir, 'projects'));
|
|
105
|
+
const coworkHome = coworkSessionHome(env, cwd);
|
|
106
|
+
if (coworkHome) roots.push(coworkProjectsRoot(coworkHome));
|
|
107
|
+
roots.push(join(env.HOME?.trim() || homedir(), '.claude', 'projects'));
|
|
108
|
+
return [...new Set(roots)];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Cowork mounts each session's own Claude config dir at `~/mnt/.claude`, so
|
|
113
|
+
* its transcripts live in `~/mnt/.claude/projects/<project>/<id>.jsonl`.
|
|
114
|
+
*/
|
|
115
|
+
function coworkProjectsRoot(coworkHome: string): string {
|
|
116
|
+
return join(coworkHome, 'mnt', '.claude', 'projects');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type AgentTranscript = { sessionId: string; filePath: string };
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* The transcript of the Claude Cowork session this process runs in, or null
|
|
123
|
+
* outside Cowork or before the transcript exists. Cowork does not reliably
|
|
124
|
+
* pass CLAUDE_CODE_SESSION_ID to commands, but each session has its own
|
|
125
|
+
* config dir, so its newest transcript is the current session.
|
|
126
|
+
*/
|
|
127
|
+
export function coworkTranscriptFromEnvironment(
|
|
128
|
+
env: Readonly<Record<string, string | undefined>> = process.env,
|
|
129
|
+
cwd: string = process.cwd(),
|
|
130
|
+
): AgentTranscript | null {
|
|
131
|
+
const coworkHome = coworkSessionHome(env, cwd);
|
|
132
|
+
if (!coworkHome) return null;
|
|
133
|
+
const root = coworkProjectsRoot(coworkHome);
|
|
134
|
+
let newest: (AgentTranscript & { mtimeMs: number }) | null = null;
|
|
135
|
+
for (const project of readDirectoryNames(root)) {
|
|
136
|
+
for (const fileName of readDirectoryNames(join(root, project))) {
|
|
137
|
+
const sessionId = basename(fileName, '.jsonl');
|
|
138
|
+
if (!fileName.endsWith('.jsonl') || !SESSION_UUID_RE.test(sessionId)) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const filePath = join(root, project, fileName);
|
|
142
|
+
let mtimeMs: number;
|
|
143
|
+
try {
|
|
144
|
+
const stat = statSync(filePath);
|
|
145
|
+
if (!stat.isFile()) continue;
|
|
146
|
+
mtimeMs = stat.mtimeMs;
|
|
147
|
+
} catch {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
if (!newest || mtimeMs > newest.mtimeMs) {
|
|
151
|
+
newest = { sessionId, filePath, mtimeMs };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return newest
|
|
156
|
+
? { sessionId: newest.sessionId, filePath: newest.filePath }
|
|
157
|
+
: null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function readDirectoryNames(dir: string): string[] {
|
|
161
|
+
try {
|
|
162
|
+
return readdirSync(dir);
|
|
163
|
+
} catch {
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
70
168
|
export function isCoworkLikeSandbox(): boolean {
|
|
71
169
|
const pluginMode = truthyEnv('DEEPLINE_PLUGIN_MODE');
|
|
72
170
|
const claudeRemote = truthyEnv('CLAUDE_CODE_REMOTE');
|
|
@@ -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.527',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -338,13 +338,18 @@ export type DurableRunNextActionKind =
|
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
340
|
* Why a stopped durable run stopped. `play_error`: the Play's own error (the
|
|
341
|
-
* customer's). `
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
* `
|
|
341
|
+
* customer's). `provider_failure`: a provider call failed the run, by the
|
|
342
|
+
* run's structured failure origin (as the public run event classes it).
|
|
343
|
+
* `platform_recovery_exhausted`: Deepline's automatic recovery ran out
|
|
344
|
+
* (resume it). `platform_failure`: another platform failure the runtime
|
|
345
|
+
* recognizes. `cancelled`: cancelled (code names a platform cancel).
|
|
346
|
+
* `unknown`: no stored terminal error. Readers must tolerate classes they do
|
|
347
|
+
* not know: older servers never send `provider_failure`, and a newer one may
|
|
348
|
+
* add a class.
|
|
345
349
|
*/
|
|
346
350
|
export const DURABLE_RUN_FAILURE_CLASSES = [
|
|
347
351
|
'play_error',
|
|
352
|
+
'provider_failure',
|
|
348
353
|
'platform_recovery_exhausted',
|
|
349
354
|
'platform_failure',
|
|
350
355
|
'cancelled',
|
|
@@ -354,7 +359,11 @@ export type DurableRunFailureClass =
|
|
|
354
359
|
(typeof DURABLE_RUN_FAILURE_CLASSES)[number];
|
|
355
360
|
|
|
356
361
|
/** `failureCause` list filter of the `durable-play-runs` quarantined listing. */
|
|
357
|
-
export const DURABLE_RUN_FAILURE_CAUSE_FILTERS = [
|
|
362
|
+
export const DURABLE_RUN_FAILURE_CAUSE_FILTERS = [
|
|
363
|
+
'platform',
|
|
364
|
+
'provider',
|
|
365
|
+
'play',
|
|
366
|
+
] as const;
|
|
358
367
|
export type DurableRunFailureCauseFilter =
|
|
359
368
|
(typeof DURABLE_RUN_FAILURE_CAUSE_FILTERS)[number];
|
|
360
369
|
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who a failed Play run's structured failure belongs to.
|
|
3
|
+
*
|
|
4
|
+
* One classifier for every reader of a run's structured failure (`errors[0]`
|
|
5
|
+
* of the terminal result, or its ledger summary): the public run event and
|
|
6
|
+
* the durable scheduler's inventory read the same code sets, so they cannot
|
|
7
|
+
* disagree about a provider failure. No value imports, so the scheduler's
|
|
8
|
+
* light SQL module can use it.
|
|
9
|
+
*/
|
|
10
|
+
import type {
|
|
11
|
+
ToolExecutionErrorCategory,
|
|
12
|
+
ToolExecutionErrorOrigin,
|
|
13
|
+
} from '../plays/tool-execution-error';
|
|
14
|
+
|
|
15
|
+
/** Mirrors `PROVIDER_EXHAUSTED_CODE` in `run-failure.ts`. */
|
|
16
|
+
export const PROVIDER_EXHAUSTED_FAILURE_CODE = 'PROVIDER_EXHAUSTED';
|
|
17
|
+
|
|
18
|
+
export const PLATFORM_RUN_FAILURE_CODES = [
|
|
19
|
+
'BILLING_UNAVAILABLE',
|
|
20
|
+
'MODAL_PAYLOAD_UPLOAD_TIMEOUT',
|
|
21
|
+
'PLATFORM_DEPLOY_INTERRUPTED',
|
|
22
|
+
'PLATFORM_WORKER_SUBREQUEST_INTERRUPTED',
|
|
23
|
+
'PLATFORM_WORKFLOW_ENDPOINT_INTERRUPTED',
|
|
24
|
+
'RUN_STORAGE_FAILED',
|
|
25
|
+
'RUNTIME_RUNNER_LOST',
|
|
26
|
+
'RUNTIME_SANDBOX_INSPECTION_UNAVAILABLE',
|
|
27
|
+
'RUNTIME_SANDBOX_KILLED',
|
|
28
|
+
'RUNTIME_SANDBOX_LOST',
|
|
29
|
+
'RUNTIME_SANDBOX_START_FAILED',
|
|
30
|
+
'WORKSPACE_STORAGE_NOT_READY',
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
export const CALLER_RUN_FAILURE_CODES = [
|
|
34
|
+
'OUTPUT_TOO_LARGE',
|
|
35
|
+
'PLAY_CALL_DEPTH_EXCEEDED',
|
|
36
|
+
'RUNTIME_LIMIT_EXCEEDED',
|
|
37
|
+
// The controlled memory abort is the same caller-side resource fact as the
|
|
38
|
+
// OOM it replaces: the run's byte profile, not Deepline's platform, is what
|
|
39
|
+
// has to change before a retry can succeed.
|
|
40
|
+
'RUNTIME_SANDBOX_MEMORY_ABORT',
|
|
41
|
+
'RUNTIME_SANDBOX_OOM',
|
|
42
|
+
'RUNTIME_SUSPENDED_CHECKPOINT_TOO_LARGE',
|
|
43
|
+
] as const;
|
|
44
|
+
|
|
45
|
+
export const ACCOUNT_POLICY_RUN_FAILURE_CODES = [
|
|
46
|
+
'INSUFFICIENT_CREDITS',
|
|
47
|
+
'MONTHLY_CREDIT_CAP_EXCEEDED',
|
|
48
|
+
'RUN_CREDIT_CAP_EXCEEDED',
|
|
49
|
+
'SANDBOX_CAPACITY_EXCEEDED',
|
|
50
|
+
] as const;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Codes whose class wins over the failure's `origin`: a provider-origin
|
|
54
|
+
* failure carrying one of these is not a provider failure.
|
|
55
|
+
*/
|
|
56
|
+
export const RUN_FAILURE_CODES_CLASSED_BEFORE_ORIGIN = [
|
|
57
|
+
...ACCOUNT_POLICY_RUN_FAILURE_CODES,
|
|
58
|
+
...PLATFORM_RUN_FAILURE_CODES,
|
|
59
|
+
...CALLER_RUN_FAILURE_CODES,
|
|
60
|
+
] as const;
|
|
61
|
+
|
|
62
|
+
export type PlayRunFailureClass =
|
|
63
|
+
| 'account_policy'
|
|
64
|
+
| 'platform_failure'
|
|
65
|
+
| 'caller_failure'
|
|
66
|
+
| 'provider_failure'
|
|
67
|
+
| 'unknown_failure';
|
|
68
|
+
|
|
69
|
+
const ACCOUNT_POLICY = new Set<string>(ACCOUNT_POLICY_RUN_FAILURE_CODES);
|
|
70
|
+
const PLATFORM = new Set<string>(PLATFORM_RUN_FAILURE_CODES);
|
|
71
|
+
const CALLER = new Set<string>(CALLER_RUN_FAILURE_CODES);
|
|
72
|
+
|
|
73
|
+
export function playRunFailureClass(failure: {
|
|
74
|
+
readonly code: string;
|
|
75
|
+
readonly phase: string;
|
|
76
|
+
readonly origin?: ToolExecutionErrorOrigin;
|
|
77
|
+
readonly category?: ToolExecutionErrorCategory;
|
|
78
|
+
}): PlayRunFailureClass {
|
|
79
|
+
const code = failure.code.trim().toUpperCase();
|
|
80
|
+
if (ACCOUNT_POLICY.has(code)) return 'account_policy';
|
|
81
|
+
if (PLATFORM.has(code)) return 'platform_failure';
|
|
82
|
+
if (CALLER.has(code)) return 'caller_failure';
|
|
83
|
+
if (code === PROVIDER_EXHAUSTED_FAILURE_CODE) return 'provider_failure';
|
|
84
|
+
|
|
85
|
+
if (failure.origin === 'provider') return 'provider_failure';
|
|
86
|
+
if (failure.origin === 'caller') return 'caller_failure';
|
|
87
|
+
if (failure.origin === 'deepline') {
|
|
88
|
+
return failure.category === 'billing'
|
|
89
|
+
? 'account_policy'
|
|
90
|
+
: 'platform_failure';
|
|
91
|
+
}
|
|
92
|
+
if (failure.origin === 'unknown') return 'unknown_failure';
|
|
93
|
+
if (failure.phase === 'infrastructure' || failure.phase === 'storage') {
|
|
94
|
+
return 'platform_failure';
|
|
95
|
+
}
|
|
96
|
+
if (failure.phase === 'billing') return 'account_policy';
|
|
97
|
+
return 'unknown_failure';
|
|
98
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
import { isIsolatedRuntimeSchedulerSchema } from '../../runtime-scheduler-topology';
|
|
20
20
|
import { PLAY_RUNNER_TIMEOUT_SECONDS } from '../../runtime-constants';
|
|
21
21
|
import {
|
|
22
|
+
MAX_PLAY_SANDBOX_RUNTIME_LIMITS,
|
|
22
23
|
STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS,
|
|
23
24
|
playSandboxSizeForLimits,
|
|
24
25
|
validatePlaySandboxRuntimeLimits,
|
|
@@ -78,6 +79,28 @@ const DAYTONA_ABSENT_OPERATION_RECREATE_AFTER_MS = 3 * 60_000;
|
|
|
78
79
|
// `reserved`, and `deleting` can never be promoted to `live`, so no runner
|
|
79
80
|
// command can reach it afterwards.
|
|
80
81
|
export const DAYTONA_STUCK_CREATING_REPLACE_AFTER_MS = 2 * 60_000;
|
|
82
|
+
|
|
83
|
+
/** Daytona's inactivity stop for a one-shot sandbox of this Play timeout. */
|
|
84
|
+
export function daytonaAutoStopIntervalMinutes(timeoutSeconds: number): number {
|
|
85
|
+
return Math.ceil(
|
|
86
|
+
(timeoutSeconds + PLAY_RUNNER_TIMEOUT_SECONDS - 30 * 60) / 60,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* How long after it was sent a one-shot create that landed late is certainly
|
|
92
|
+
* gone. Every one-shot sandbox is ephemeral: Daytona deletes it as soon as it
|
|
93
|
+
* stops, and it stops at the latest after the longest Play's inactivity
|
|
94
|
+
* interval. Thirty minutes on top cover a create the provider accepted but had
|
|
95
|
+
* not yet made visible, and a create sent a few minutes after its reservation
|
|
96
|
+
* was read.
|
|
97
|
+
*/
|
|
98
|
+
export const DAYTONA_SENT_CREATE_GONE_AFTER_MS =
|
|
99
|
+
daytonaAutoStopIntervalMinutes(
|
|
100
|
+
MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds,
|
|
101
|
+
) *
|
|
102
|
+
60_000 +
|
|
103
|
+
30 * 60_000;
|
|
81
104
|
// Explicit runner deadline + scheduler GC own the normal lifecycle. Daytona's
|
|
82
105
|
// inactivity stop is a wider crash backstop measured from sandbox creation, so
|
|
83
106
|
// setup time cannot consume the terminal-flush grace.
|
|
@@ -642,9 +665,7 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
642
665
|
// Daytona deletes an ephemeral sandbox immediately when it stops.
|
|
643
666
|
ephemeral: true,
|
|
644
667
|
autoDeleteInterval: 0,
|
|
645
|
-
autoStopInterval:
|
|
646
|
-
(limits.timeoutSeconds + PLAY_RUNNER_TIMEOUT_SECONDS - 30 * 60) / 60,
|
|
647
|
-
),
|
|
668
|
+
autoStopInterval: daytonaAutoStopIntervalMinutes(limits.timeoutSeconds),
|
|
648
669
|
autoArchiveInterval: DAYTONA_AUTO_ARCHIVE_INTERVAL_MINUTES,
|
|
649
670
|
// A non-empty `networkAllowList` IS the "block all egress except these
|
|
650
671
|
// CIDRs" control; Daytona rejects create when `networkBlockAll: true` is
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -345,6 +345,7 @@ import {
|
|
|
345
345
|
readReservedDaytonaCancellationOperation,
|
|
346
346
|
recordDaytonaSandboxCleanupIntent,
|
|
347
347
|
reserveRuntimeSandboxOperation,
|
|
348
|
+
RUNTIME_SANDBOX_CAPACITY_LEASE_MS,
|
|
348
349
|
runtimeSandboxCapacityAdmissionMode,
|
|
349
350
|
RuntimeSandboxCapacityLimitError,
|
|
350
351
|
} from './runtime-sandbox-capacity';
|
|
@@ -10243,22 +10244,51 @@ export async function reconcileReservedDaytonaCancellationOnce(input: {
|
|
|
10243
10244
|
} catch (error) {
|
|
10244
10245
|
const message = error instanceof Error ? error.message : String(error);
|
|
10245
10246
|
if (!/\b(?:sandbox )?not found\b|\b404\b/i.test(message)) throw error;
|
|
10247
|
+
const ageMs = Date.now() - operation.createdAtMs;
|
|
10248
|
+
if (ageMs < RUNTIME_RELIABILITY_POLICY.recovery.horizonMs) return;
|
|
10249
|
+
const abandonedWhileActive = await input.runWithClient((client) =>
|
|
10250
|
+
abandonRuntimeSandboxOperationReservation(
|
|
10251
|
+
client,
|
|
10252
|
+
{
|
|
10253
|
+
operationKey: operation.operationKey,
|
|
10254
|
+
// Execution recovery ending is not proof a sent create cannot land.
|
|
10255
|
+
onlyWhileRunActive: true,
|
|
10256
|
+
},
|
|
10257
|
+
input.schedulerOptions,
|
|
10258
|
+
),
|
|
10259
|
+
);
|
|
10260
|
+
if (abandonedWhileActive) return;
|
|
10261
|
+
const { DAYTONA_SENT_CREATE_GONE_AFTER_MS } =
|
|
10262
|
+
await import('../runner-backends/backends/daytona-lifecycle');
|
|
10263
|
+
// A resume can resend this same-name create until the reservation's
|
|
10264
|
+
// capacity lease expires, so measure the sandbox's whole life from there.
|
|
10246
10265
|
if (
|
|
10247
|
-
|
|
10248
|
-
|
|
10266
|
+
ageMs <
|
|
10267
|
+
RUNTIME_SANDBOX_CAPACITY_LEASE_MS + DAYTONA_SENT_CREATE_GONE_AFTER_MS
|
|
10249
10268
|
)
|
|
10250
10269
|
return;
|
|
10251
|
-
|
|
10270
|
+
// Every claim of a terminal Run is released. Past the last create's
|
|
10271
|
+
// longest ephemeral life, a create that landed late has stopped and
|
|
10272
|
+
// deleted itself, so this 404 means nothing the reservation could bind.
|
|
10273
|
+
const abandonedAfterTerminal = await input.runWithClient((client) =>
|
|
10252
10274
|
abandonRuntimeSandboxOperationReservation(
|
|
10253
10275
|
client,
|
|
10254
10276
|
{
|
|
10255
10277
|
operationKey: operation.operationKey,
|
|
10256
|
-
|
|
10257
|
-
onlyWhileRunActive: true,
|
|
10278
|
+
onlyAfterRunTerminal: true,
|
|
10258
10279
|
},
|
|
10259
10280
|
input.schedulerOptions,
|
|
10260
10281
|
),
|
|
10261
10282
|
);
|
|
10283
|
+
if (abandonedAfterTerminal)
|
|
10284
|
+
console.info(
|
|
10285
|
+
'[absurd-runtime.worker] daytona_terminal_unbound_create_abandoned',
|
|
10286
|
+
{
|
|
10287
|
+
runId: operation.runId,
|
|
10288
|
+
operationKey: operation.operationKey,
|
|
10289
|
+
ageMs,
|
|
10290
|
+
},
|
|
10291
|
+
);
|
|
10262
10292
|
return;
|
|
10263
10293
|
} finally {
|
|
10264
10294
|
control.dispose();
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts
CHANGED
|
@@ -479,8 +479,8 @@ export async function listDurableRuns(
|
|
|
479
479
|
limit: number;
|
|
480
480
|
cursor?: string | null;
|
|
481
481
|
/**
|
|
482
|
-
* `failed` only: keep platform (exhausted recovery or platform failure)
|
|
483
|
-
* or Play failures. Filters a bounded index slice like `recovering`.
|
|
482
|
+
* `failed` only: keep platform (exhausted recovery or platform failure),
|
|
483
|
+
* provider, or Play failures. Filters a bounded index slice like `recovering`.
|
|
484
484
|
*/
|
|
485
485
|
cause?: DurableRunFailureCause | null;
|
|
486
486
|
},
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../../observability/dlq';
|
|
11
11
|
import { resolveRuntimeSchedulerSchemaEnv } from './runtime-scheduler-schema';
|
|
12
12
|
import { RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE } from '../play-admission-outcome';
|
|
13
|
+
import { RUN_FAILURE_CODES_CLASSED_BEFORE_ORIGIN } from '../run-failure-class';
|
|
13
14
|
|
|
14
15
|
export type DurableRunSqlOptions = { readonly schema?: string };
|
|
15
16
|
type Options = DurableRunSqlOptions;
|
|
@@ -58,6 +59,7 @@ export {
|
|
|
58
59
|
/** `list --state failed --cause` → the classes it keeps. */
|
|
59
60
|
export const DURABLE_RUN_FAILURE_CAUSES = {
|
|
60
61
|
platform: ['platform_recovery_exhausted', 'platform_failure'],
|
|
62
|
+
provider: ['provider_failure'],
|
|
61
63
|
play: ['play_error'],
|
|
62
64
|
} as const satisfies Record<
|
|
63
65
|
DurableRunFailureCauseFilter,
|
|
@@ -94,6 +96,35 @@ const RUNTIME_ERROR_CLASS_PREFIXES = [
|
|
|
94
96
|
*/
|
|
95
97
|
export const DURABLE_RUN_FAILURE_MESSAGE_MAX_CHARS = 512;
|
|
96
98
|
|
|
99
|
+
/**
|
|
100
|
+
* SQL: whether `runs.terminal_result_json` holds a provider-owned structured
|
|
101
|
+
* failure, read exactly as the public run event reads it
|
|
102
|
+
* (`playRunFailureClass` over the first `errors[]` entry, or its ledger
|
|
103
|
+
* summary): a well-formed entry (string `code` and `phase`, boolean or null
|
|
104
|
+
* `retryable`) whose `origin` is `provider` and whose code is not classed
|
|
105
|
+
* before origin (account policy, platform or caller codes). `origin` is set
|
|
106
|
+
* only from a typed `ToolExecutionError`, never from text, so a Play that
|
|
107
|
+
* merely throws or mentions a provider code stays the Play's. Rows written
|
|
108
|
+
* without `errors[]` or `origin` (older runners, string-only failures, or a
|
|
109
|
+
* result too large to store) read as before. `PROVIDER_EXHAUSTED` without an
|
|
110
|
+
* origin is a text-derived code, so it stays the Play's here.
|
|
111
|
+
*/
|
|
112
|
+
function durableRunProviderFailureSql(): string {
|
|
113
|
+
// Extract `errors[0]` once per row: every reference to
|
|
114
|
+
// `runs.terminal_result_json` re-reads the whole stored result (up to
|
|
115
|
+
// TERMINAL_RUN_RESULT_MAX_BYTES), while `entry.failure` is the small entry.
|
|
116
|
+
return `EXISTS (
|
|
117
|
+
SELECT 1
|
|
118
|
+
FROM (SELECT runs.terminal_result_json #> '{errors,0}' AS failure) AS entry
|
|
119
|
+
WHERE jsonb_typeof(entry.failure) = 'object'
|
|
120
|
+
AND jsonb_typeof(entry.failure -> 'code') = 'string'
|
|
121
|
+
AND jsonb_typeof(entry.failure -> 'phase') = 'string'
|
|
122
|
+
AND jsonb_typeof(entry.failure -> 'retryable') IN ('boolean', 'null')
|
|
123
|
+
AND entry.failure ->> 'origin' = 'provider'
|
|
124
|
+
AND upper(btrim(entry.failure ->> 'code')) <> ALL (ARRAY[${RUN_FAILURE_CODES_CLASSED_BEFORE_ORIGIN.map((code) => `'${code}'`).join(', ')}]::text[])
|
|
125
|
+
)`;
|
|
126
|
+
}
|
|
127
|
+
|
|
97
128
|
/**
|
|
98
129
|
* SQL: `LEFT JOIN LATERAL ... AS failure` over `runs`, yielding
|
|
99
130
|
* `failure.failure_class`, `failure_code`, `failure_message` and
|
|
@@ -117,6 +148,12 @@ export const DURABLE_RUN_FAILURE_MESSAGE_MAX_CHARS = 512;
|
|
|
117
148
|
* (`RUNTIME_MODAL_SANDBOX_CREATE_OUTCOME_UNKNOWN`) and a Modal payload upload
|
|
118
149
|
* past its deadline (`MODAL_PAYLOAD_UPLOAD_TIMEOUT`). Only the leading code
|
|
119
150
|
* position counts, so stored rows of any age read the same way.
|
|
151
|
+
*
|
|
152
|
+
* A failure no platform rule claims is `provider_failure` when the run's
|
|
153
|
+
* stored terminal result carries a provider-origin structured failure (see
|
|
154
|
+
* `durableRunProviderFailureSql`), the class the public run event gives it;
|
|
155
|
+
* otherwise `play_error`. `terminal_result_json` is read only on that branch,
|
|
156
|
+
* so platform-classed and non-failed rows never load it.
|
|
120
157
|
*/
|
|
121
158
|
export function durableRunFailureLateralSql(): string {
|
|
122
159
|
return `LEFT JOIN LATERAL (
|
|
@@ -132,6 +169,8 @@ export function durableRunFailureLateralSql(): string {
|
|
|
132
169
|
OR parsed.code IN ('CTX_RUN_PLAY_INLINE_ONLY', '${RUNTIME_DB_SESSION_PRELOAD_INCOMPLETE}', ${PLATFORM_RUNTIME_FAILURE_CODES.map((code) => `'${code}'`).join(', ')})
|
|
133
170
|
OR starts_with(parsed.code, 'SCHEDULER_')
|
|
134
171
|
THEN 'platform_failure'
|
|
172
|
+
WHEN ${durableRunProviderFailureSql()}
|
|
173
|
+
THEN 'provider_failure'
|
|
135
174
|
ELSE 'play_error'
|
|
136
175
|
END AS failure_class,
|
|
137
176
|
CASE
|
|
@@ -952,6 +952,11 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
952
952
|
attempt?: number;
|
|
953
953
|
/** A lookup 404 must not retire a terminal Run's unresolved creation. */
|
|
954
954
|
onlyWhileRunActive?: boolean;
|
|
955
|
+
/**
|
|
956
|
+
* Only once the Run is terminal: the caller has proven that any create
|
|
957
|
+
* this reservation sent has outlived every sandbox it could have made.
|
|
958
|
+
*/
|
|
959
|
+
onlyAfterRunTerminal?: boolean;
|
|
955
960
|
},
|
|
956
961
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
957
962
|
): Promise<boolean> {
|
|
@@ -986,6 +991,12 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
986
991
|
WHERE status IN ('queued', 'running', 'waiting')
|
|
987
992
|
)
|
|
988
993
|
)
|
|
994
|
+
AND (
|
|
995
|
+
NOT $6::boolean OR EXISTS (
|
|
996
|
+
SELECT 1 FROM custody_run
|
|
997
|
+
WHERE status IN ('completed', 'failed', 'cancelled')
|
|
998
|
+
)
|
|
999
|
+
)
|
|
989
1000
|
RETURNING operation.operation_key
|
|
990
1001
|
), released AS (
|
|
991
1002
|
UPDATE ${leases} AS lease
|
|
@@ -1003,6 +1014,7 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
1003
1014
|
runtimeSandboxOperationFromStates('abandon_reservation'),
|
|
1004
1015
|
input.attempt ?? null,
|
|
1005
1016
|
input.onlyWhileRunActive ?? false,
|
|
1017
|
+
input.onlyAfterRunTerminal ?? false,
|
|
1006
1018
|
],
|
|
1007
1019
|
);
|
|
1008
1020
|
return result.rows.length === 1;
|
|
@@ -73,6 +73,22 @@ export const TOOL_EXECUTE_CONCURRENCY_BACKPRESSURE_MAX_ATTEMPTS = 65;
|
|
|
73
73
|
export const TOOL_EXECUTE_RUNTIME_SCHEDULER_CAPACITY_MAX_ATTEMPTS = 65;
|
|
74
74
|
/** Re-admission after a stale shared provider permit is safely replayable. */
|
|
75
75
|
export const TOOL_EXECUTE_PROVIDER_PACING_WAIT_MAX_ATTEMPTS = 65;
|
|
76
|
+
// Logical attempts advance only after a fully received retryable HTTP result.
|
|
77
|
+
// Gateway follower polls stay on the same attempt. The runtime gateway refuses
|
|
78
|
+
// a fenced attempt above this ceiling unless it claims the preceding provider
|
|
79
|
+
// 429, which bounds the wire value before fingerprints or history queries, so
|
|
80
|
+
// malformed executor traffic cannot turn one request into unbounded work.
|
|
81
|
+
export const EXECUTION_GATEWAY_MAX_LOGICAL_ATTEMPT = 32;
|
|
82
|
+
// Every fenced retry other than a shed or follower poll opens the next logical
|
|
83
|
+
// attempt. A Deepline refusal made before dispatch gets the attempts the other
|
|
84
|
+
// advancing reasons leave under the gateway ceiling: idempotency in progress,
|
|
85
|
+
// customer DB storage, and the edge, provider and replay-safe 5xx retries.
|
|
86
|
+
export const TOOL_EXECUTE_FENCED_PRE_DISPATCH_RATE_REFUSAL_MAX_ATTEMPTS =
|
|
87
|
+
EXECUTION_GATEWAY_MAX_LOGICAL_ATTEMPT -
|
|
88
|
+
(TOOL_EXECUTE_IDEMPOTENCY_IN_PROGRESS_MAX_ATTEMPTS - 1) -
|
|
89
|
+
(TOOL_EXECUTE_CUSTOMER_DB_STORAGE_UNAVAILABLE_MAX_ATTEMPTS - 1) -
|
|
90
|
+
3 * (TOOL_EXECUTE_TRANSIENT_HTTP_MAX_ATTEMPTS - 1) +
|
|
91
|
+
1;
|
|
76
92
|
export const TOOL_EXECUTE_TRANSPORT_MAX_ATTEMPTS = 3;
|
|
77
93
|
export const TOOL_EXECUTE_TRANSPORT_RETRY_DELAY_MS = 1_000;
|
|
78
94
|
// A sandbox lost new connections for about 97 seconds on 2026-10-30, and each
|
|
@@ -462,6 +478,12 @@ function isConcurrencyBackpressureResponse(input: {
|
|
|
462
478
|
);
|
|
463
479
|
}
|
|
464
480
|
|
|
481
|
+
/** Pacing limits a caller can wait out; a quota denial names when it ends instead. */
|
|
482
|
+
const PRE_DISPATCH_RATE_KINDS = new Set([
|
|
483
|
+
'requests_per_second',
|
|
484
|
+
'requests_per_minute',
|
|
485
|
+
]);
|
|
486
|
+
|
|
465
487
|
function isPreDispatchRateRefusalResponse(input: {
|
|
466
488
|
status: number;
|
|
467
489
|
bodyText: string;
|
|
@@ -474,13 +496,13 @@ function isPreDispatchRateRefusalResponse(input: {
|
|
|
474
496
|
body.failure_origin === 'deepline_rate_limit' &&
|
|
475
497
|
body.error_category === 'rate_limit' &&
|
|
476
498
|
body.provider_request_dispatched === false &&
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
499
|
+
typeof body.rate_limit_kind === 'string' &&
|
|
500
|
+
PRE_DISPATCH_RATE_KINDS.has(body.rate_limit_kind) &&
|
|
501
|
+
// Workspace tool admission precedes billing for both execute paths. Every
|
|
502
|
+
// other Deepline refusal releases a charge it opened, so a fenced call
|
|
503
|
+
// keeps replaying its recorded outcome.
|
|
504
|
+
(body.rate_limit_bucket_scope === 'customer_tool' ||
|
|
505
|
+
input.executionFenced !== true)
|
|
484
506
|
);
|
|
485
507
|
}
|
|
486
508
|
|
|
@@ -646,6 +668,8 @@ function decideToolExecuteHttpRetry(input: {
|
|
|
646
668
|
concurrencyBackpressure?: boolean;
|
|
647
669
|
runtimeSchedulerCapacity?: boolean;
|
|
648
670
|
providerPacingWait?: boolean;
|
|
671
|
+
/** A Deepline limiter refused before dispatch (`isPreDispatchRateRefusalResponse`). */
|
|
672
|
+
preDispatchRateRefusal?: boolean;
|
|
649
673
|
hardBillingFailure?: boolean;
|
|
650
674
|
hasRetryAfterHeader?: boolean;
|
|
651
675
|
transientHttpRetrySafe?: boolean;
|
|
@@ -669,6 +693,20 @@ function decideToolExecuteHttpRetry(input: {
|
|
|
669
693
|
reason: 'concurrency_backpressure',
|
|
670
694
|
};
|
|
671
695
|
}
|
|
696
|
+
// Waiting out a refusal that sent nothing is always safe, so a row waits as
|
|
697
|
+
// long as app pacing would let it rather than failing at eight attempts.
|
|
698
|
+
// A fenced retry opens a new gateway attempt, so it stays under the
|
|
699
|
+
// gateway's ceiling.
|
|
700
|
+
if (input.preDispatchRateRefusal) {
|
|
701
|
+
return {
|
|
702
|
+
retryable: true,
|
|
703
|
+
attemptCap:
|
|
704
|
+
input.executionFenced === true
|
|
705
|
+
? TOOL_EXECUTE_FENCED_PRE_DISPATCH_RATE_REFUSAL_MAX_ATTEMPTS
|
|
706
|
+
: TOOL_EXECUTE_PROVIDER_PACING_WAIT_MAX_ATTEMPTS,
|
|
707
|
+
reason: 'rate_limit',
|
|
708
|
+
};
|
|
709
|
+
}
|
|
672
710
|
if (!input.hasRetryAfterHeader) {
|
|
673
711
|
return {
|
|
674
712
|
retryable: true,
|
|
@@ -947,6 +985,7 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
947
985
|
concurrencyBackpressure,
|
|
948
986
|
runtimeSchedulerCapacity,
|
|
949
987
|
providerPacingWait,
|
|
988
|
+
preDispatchRateRefusal,
|
|
950
989
|
hasRetryAfterHeader,
|
|
951
990
|
transientHttpRetrySafe,
|
|
952
991
|
edgeGatewayFailure,
|
|
@@ -1020,6 +1059,7 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
1020
1059
|
concurrencyBackpressure,
|
|
1021
1060
|
runtimeSchedulerCapacity,
|
|
1022
1061
|
providerPacingWait,
|
|
1062
|
+
preDispatchRateRefusal,
|
|
1023
1063
|
hardBillingFailure,
|
|
1024
1064
|
hasRetryAfterHeader,
|
|
1025
1065
|
transientHttpRetrySafe,
|
|
@@ -1164,7 +1204,9 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
1164
1204
|
// the tool-call budget. The run-wide retry budget is a runaway guard
|
|
1165
1205
|
// whose breach is run-fatal; a provider outage across a large map must
|
|
1166
1206
|
// surface as row failures, not exhaust it and fail the whole run.
|
|
1167
|
-
retryDecision.reason !== 'provider_server_error'
|
|
1207
|
+
retryDecision.reason !== 'provider_server_error' &&
|
|
1208
|
+
// A wait on a refusal that sent nothing is pacing, not a failed call.
|
|
1209
|
+
!preDispatchRateRefusal,
|
|
1168
1210
|
// The app reported a provider failure and asked for a retry, so it has
|
|
1169
1211
|
// already released that attempt's reservation, and admission never reopens
|
|
1170
1212
|
// one. BILLING_UNAVAILABLE may follow an authorization whose response was
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkOXHY3LD3js = require('./chunk-OXHY3LD3.js');
|
|
18
|
+
require('./chunk-EOL7PXLW.js');
|
|
19
|
+
require('./chunk-7DPWGAOU.js');
|
|
20
|
+
require('./chunk-JSEISVAZ.js');
|
|
21
|
+
require('./chunk-T2N3B7IQ.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-SQWET4SL.js');
|
|
24
|
+
require('./chunk-3PQDEBO6.js');
|
|
25
|
+
require('./chunk-OG64RBAC.js');
|
|
26
|
+
require('./chunk-COGTRVWW.js');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkOXHY3LD3js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkOXHY3LD3js.authStatusLine; exports.clearPendingClaim = _chunkOXHY3LD3js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkOXHY3LD3js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkOXHY3LD3js.handleRegister; exports.handleStatus = _chunkOXHY3LD3js.handleStatus; exports.handleWait = _chunkOXHY3LD3js.handleWait; exports.httpJson = _chunkOXHY3LD3js.httpJson; exports.readPendingAuthClaim = _chunkOXHY3LD3js.readPendingAuthClaim; exports.readStatusBanner = _chunkOXHY3LD3js.readStatusBanner; exports.registerAuthCommands = _chunkOXHY3LD3js.registerAuthCommands; exports.reportApprovalLinkShown = _chunkOXHY3LD3js.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkOXHY3LD3js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkOXHY3LD3js.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkOXHY3LD3js.statusBannerLine;
|
|
@@ -14,14 +14,14 @@ 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-QKKT5G4K.mjs";
|
|
18
|
+
import "./chunk-JSVHBJE2.mjs";
|
|
19
|
+
import "./chunk-77VNC2KF.mjs";
|
|
20
|
+
import "./chunk-P5ZU5ZHA.mjs";
|
|
21
21
|
import "./chunk-QNHHZ63P.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-ZPGGW27Q.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-RMCKTV4R.mjs";
|
|
25
25
|
import "./chunk-WZYKRD7T.mjs";
|
|
26
26
|
import "./chunk-KRD6H754.mjs";
|
|
27
27
|
export {
|