deepline 0.1.207 → 0.1.209
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/apps/play-runner-workers/src/runtime/receipts.ts +2 -12
- package/dist/bundling-sources/sdk/src/client.ts +10 -0
- package/dist/bundling-sources/sdk/src/http.ts +10 -1
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +16 -31
- package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +312 -207
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +0 -5
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +429 -102
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +27 -5
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +31 -12
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +105 -10
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +21 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +32 -86
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +141 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +45 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +180 -447
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +33 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +11 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-kind-guard.ts +112 -0
- package/dist/cli/index.js +38 -5
- package/dist/cli/index.mjs +38 -5
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +32 -5
- package/dist/index.mjs +32 -5
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/child-run-lifecycle.ts +0 -70
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
type WorkReceiptBatchMarkRunningCommand,
|
|
5
5
|
type WorkReceiptClaim,
|
|
6
6
|
type WorkReceiptCommand,
|
|
7
|
-
type WorkReceiptFailureKind,
|
|
8
7
|
type WorkReceiptGetCommand,
|
|
9
8
|
type WorkReceiptStatus,
|
|
10
9
|
} from '../../../../shared_libs/play-runtime/work-receipts';
|
|
@@ -17,6 +16,7 @@ import {
|
|
|
17
16
|
isPlayExecutionSuspendedError,
|
|
18
17
|
isPlayRowExecutionSuspendedError,
|
|
19
18
|
} from '../../../../shared_libs/play-runtime/suspension';
|
|
19
|
+
import { runtimeReceiptFailureKindForError } from '../../../../shared_libs/play-runtime/durable-receipt-execution';
|
|
20
20
|
import type { WorkerWorkBudgetMeter } from './work-budget';
|
|
21
21
|
|
|
22
22
|
export type RuntimeReceiptStatus = WorkReceiptStatus;
|
|
@@ -132,15 +132,6 @@ function errorMessage(error: unknown): string {
|
|
|
132
132
|
return error instanceof Error ? error.message : String(error);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
function runtimeReceiptFailureKindForError(
|
|
136
|
-
error: unknown,
|
|
137
|
-
): WorkReceiptFailureKind {
|
|
138
|
-
return isPlayExecutionSuspendedError(error) ||
|
|
139
|
-
isPlayRowExecutionSuspendedError(error)
|
|
140
|
-
? 'repairable'
|
|
141
|
-
: 'terminal';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
135
|
async function waitForReusableReceipt<T>(input: {
|
|
145
136
|
key: string;
|
|
146
137
|
playName: string;
|
|
@@ -363,8 +354,7 @@ async function executeAndPersistReceipt<T>(input: {
|
|
|
363
354
|
budgetMeter: input.budgetMeter,
|
|
364
355
|
heartbeatIntervalMs: input.heartbeatIntervalMs,
|
|
365
356
|
targets: [{ key: input.key, leaseId }],
|
|
366
|
-
execute: () =>
|
|
367
|
-
input.execute({ leaseId }, input.wasFailed === true),
|
|
357
|
+
execute: () => input.execute({ leaseId }, input.wasFailed === true),
|
|
368
358
|
});
|
|
369
359
|
} catch (error) {
|
|
370
360
|
if (error instanceof RuntimeLeaseLostError) {
|
|
@@ -1807,6 +1807,16 @@ export class DeeplineClient {
|
|
|
1807
1807
|
description?: string;
|
|
1808
1808
|
artifact: Record<string, unknown>;
|
|
1809
1809
|
integrationMode?: 'live' | 'eval_stub' | 'fixture';
|
|
1810
|
+
/**
|
|
1811
|
+
* Sibling plays from the same local bundle graph. Lets the server splice
|
|
1812
|
+
* unpublished local children into the checked plan and enforce the
|
|
1813
|
+
* row-scoped batch rule (ADR 0013).
|
|
1814
|
+
*/
|
|
1815
|
+
importedPlays?: Array<{
|
|
1816
|
+
playName?: string | null;
|
|
1817
|
+
sourceCode: string;
|
|
1818
|
+
sourcePath?: string | null;
|
|
1819
|
+
}>;
|
|
1810
1820
|
}): Promise<PlayCheckResult> {
|
|
1811
1821
|
const integrationMode = normalizePlayRunIntegrationMode(
|
|
1812
1822
|
input.integrationMode ?? process.env.DEEPLINE_EVAL_INTEGRATION_MODE,
|
|
@@ -28,6 +28,7 @@ import type { LiveEventEnvelope } from './types.js';
|
|
|
28
28
|
import { baseUrlSlug, sdkCliStateDirPath } from './config.js';
|
|
29
29
|
import { detectAgentRuntime, isCoworkLikeSandbox } from './agent-runtime.js';
|
|
30
30
|
import {
|
|
31
|
+
ABSURD_RELEASE_OVERRIDE_HEADER,
|
|
31
32
|
COORDINATOR_INTERNAL_TOKEN_HEADER,
|
|
32
33
|
COORDINATOR_URL_OVERRIDE_HEADER,
|
|
33
34
|
RUNTIME_SCHEDULER_SCHEMA_OVERRIDE_HEADER,
|
|
@@ -245,6 +246,10 @@ export class HttpClient {
|
|
|
245
246
|
typeof process !== 'undefined'
|
|
246
247
|
? process.env?.DEEPLINE_INTERNAL_TOKEN
|
|
247
248
|
: undefined;
|
|
249
|
+
const absurdReleaseOverride =
|
|
250
|
+
typeof process !== 'undefined'
|
|
251
|
+
? process.env?.DEEPLINE_ABSURD_RELEASE
|
|
252
|
+
: undefined;
|
|
248
253
|
if (coordinatorUrl?.trim()) {
|
|
249
254
|
headers[COORDINATOR_URL_OVERRIDE_HEADER] = coordinatorUrl.trim();
|
|
250
255
|
}
|
|
@@ -282,11 +287,15 @@ export class HttpClient {
|
|
|
282
287
|
if (runtimeTestFault?.trim()) {
|
|
283
288
|
headers[PLAY_RUNTIME_TEST_FAULT_HEADER] = runtimeTestFault.trim();
|
|
284
289
|
}
|
|
290
|
+
if (absurdReleaseOverride?.trim() && coordinatorInternalToken?.trim()) {
|
|
291
|
+
headers[ABSURD_RELEASE_OVERRIDE_HEADER] = absurdReleaseOverride.trim();
|
|
292
|
+
}
|
|
285
293
|
if (
|
|
286
294
|
coordinatorInternalToken?.trim() &&
|
|
287
295
|
(coordinatorUrl?.trim() ||
|
|
288
296
|
workerCallbackUrl?.trim() ||
|
|
289
|
-
runtimeTestFault?.trim()
|
|
297
|
+
runtimeTestFault?.trim() ||
|
|
298
|
+
absurdReleaseOverride?.trim())
|
|
290
299
|
) {
|
|
291
300
|
headers[COORDINATOR_INTERNAL_TOKEN_HEADER] =
|
|
292
301
|
coordinatorInternalToken.trim();
|
|
@@ -106,10 +106,10 @@ export const SDK_RELEASE = {
|
|
|
106
106
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
107
107
|
// fields shipped in 0.1.153.
|
|
108
108
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
109
|
-
version: '0.1.
|
|
109
|
+
version: '0.1.209',
|
|
110
110
|
apiContract: '2026-06-dataset-handle-results-hard-cutover',
|
|
111
111
|
supportPolicy: {
|
|
112
|
-
latest: '0.1.
|
|
112
|
+
latest: '0.1.209',
|
|
113
113
|
minimumSupported: '0.1.53',
|
|
114
114
|
deprecatedBelow: '0.1.53',
|
|
115
115
|
commandMinimumSupported: [
|
|
@@ -129,15 +129,6 @@ type RuntimeApiRequest =
|
|
|
129
129
|
staticPipeline?: unknown;
|
|
130
130
|
source?: 'published' | 'ad_hoc' | 'draft';
|
|
131
131
|
}
|
|
132
|
-
| {
|
|
133
|
-
action: 'settle_inline_child_run';
|
|
134
|
-
parentRunId: string;
|
|
135
|
-
childRunId: string;
|
|
136
|
-
childPlayName: string;
|
|
137
|
-
status: 'completed' | 'failed' | 'cancelled';
|
|
138
|
-
result?: unknown;
|
|
139
|
-
error?: string | null;
|
|
140
|
-
}
|
|
141
132
|
| ({
|
|
142
133
|
action: 'save_results';
|
|
143
134
|
} & RuntimeSaveResults)
|
|
@@ -343,6 +334,16 @@ const APP_RUNTIME_API_RECEIPT_RETRY_DELAYS_MS = [
|
|
|
343
334
|
const APP_RUNTIME_API_APPEND_RETRY_DELAYS_MS = [
|
|
344
335
|
100, 250, 500, 1_000, 2_000, 4_000, 8_000,
|
|
345
336
|
] as const;
|
|
337
|
+
// Full jitter (AWS "equal jitter" variant): sleep a random amount in
|
|
338
|
+
// [delay/2, delay] so a thundering herd of sibling settlements that all lost the
|
|
339
|
+
// same OCC race do not re-collide in lockstep on the next attempt.
|
|
340
|
+
function applyRetryJitter(delayMs: number): number {
|
|
341
|
+
if (delayMs <= 0) {
|
|
342
|
+
return 0;
|
|
343
|
+
}
|
|
344
|
+
const half = delayMs / 2;
|
|
345
|
+
return Math.round(half + Math.random() * half);
|
|
346
|
+
}
|
|
346
347
|
const APP_RUNTIME_API_DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
347
348
|
const RUN_STATUS_LEDGER_SNAPSHOT_CACHE_LIMIT = 1_000;
|
|
348
349
|
const runStatusLedgerSnapshots = new Map<string, PlayRunLedgerSnapshot>();
|
|
@@ -450,7 +451,7 @@ function summarizeAppRuntimeErrorBody(body: string): string {
|
|
|
450
451
|
}
|
|
451
452
|
|
|
452
453
|
export function isTransientAppRuntimeFailureBody(body: string): boolean {
|
|
453
|
-
return /WorkerOverloaded|"\s*code\s*"\s*:\s*"\s*InternalServerError\s*"|Your request couldn't be completed\. Try again later\.|timeout exceeded when trying to connect|timed out|fetch failed|ECONNRESET|ECONNREFUSED|UND_ERR_CONNECT_TIMEOUT|tuple concurrently updated|RUNTIME_SCHEDULER_SATURATED|Runtime scheduler DB pool is saturated|Runtime scheduler DB circuit breaker is open/i.test(
|
|
454
|
+
return /WorkerOverloaded|"\s*code\s*"\s*:\s*"\s*InternalServerError\s*"|Your request couldn't be completed\. Try again later\.|timeout exceeded when trying to connect|timed out|fetch failed|ECONNRESET|ECONNREFUSED|UND_ERR_CONNECT_TIMEOUT|tuple concurrently updated|RUNTIME_SCHEDULER_SATURATED|Runtime scheduler DB pool is saturated|Runtime scheduler DB circuit breaker is open|OptimisticConcurrencyControlFailure|changed while this mutation was being run|Documents read from or written to the .* table changed while this mutation/i.test(
|
|
454
455
|
body,
|
|
455
456
|
);
|
|
456
457
|
}
|
|
@@ -524,8 +525,7 @@ function isRetryableAppRuntimeAction(
|
|
|
524
525
|
action === 'release_runtime_step_receipt' ||
|
|
525
526
|
action === 'save_results' ||
|
|
526
527
|
action === 'skip_runtime_step_receipt' ||
|
|
527
|
-
action === 'start_inline_child_run'
|
|
528
|
-
action === 'settle_inline_child_run'
|
|
528
|
+
action === 'start_inline_child_run'
|
|
529
529
|
);
|
|
530
530
|
}
|
|
531
531
|
|
|
@@ -679,7 +679,9 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
679
679
|
attempt < maxAttempts &&
|
|
680
680
|
isRetryableAppRuntimeFetchError({ action: body.action, error })
|
|
681
681
|
) {
|
|
682
|
-
await sleep(
|
|
682
|
+
await sleep(
|
|
683
|
+
applyRetryJitter(appRuntimeRetryDelayMs(body.action, attempt)),
|
|
684
|
+
);
|
|
683
685
|
continue;
|
|
684
686
|
}
|
|
685
687
|
throw new AppRuntimeApiTransportError({
|
|
@@ -702,7 +704,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
702
704
|
) {
|
|
703
705
|
await sleep(
|
|
704
706
|
Math.max(
|
|
705
|
-
appRuntimeRetryDelayMs(body.action, attempt),
|
|
707
|
+
applyRetryJitter(appRuntimeRetryDelayMs(body.action, attempt)),
|
|
706
708
|
appRuntimeRetryAfterMs(response, responseText) ?? 0,
|
|
707
709
|
),
|
|
708
710
|
);
|
|
@@ -1020,23 +1022,6 @@ export async function startRunViaAppRuntime(
|
|
|
1020
1022
|
});
|
|
1021
1023
|
}
|
|
1022
1024
|
|
|
1023
|
-
export async function settleInlineChildRunViaAppRuntime(
|
|
1024
|
-
context: WorkerRuntimeApiContext,
|
|
1025
|
-
input: {
|
|
1026
|
-
parentRunId: string;
|
|
1027
|
-
childRunId: string;
|
|
1028
|
-
childPlayName: string;
|
|
1029
|
-
status: 'completed' | 'failed' | 'cancelled';
|
|
1030
|
-
result?: unknown;
|
|
1031
|
-
error?: string | null;
|
|
1032
|
-
},
|
|
1033
|
-
): Promise<void> {
|
|
1034
|
-
await postAppRuntimeApi<{ ok: true }>(context, {
|
|
1035
|
-
action: 'settle_inline_child_run',
|
|
1036
|
-
...input,
|
|
1037
|
-
});
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
1025
|
export async function saveResultsViaAppRuntime(
|
|
1041
1026
|
context: WorkerRuntimeApiContext,
|
|
1042
1027
|
input: RuntimeSaveResults,
|
|
@@ -49,3 +49,21 @@ export function resolveChildExecutionStrategy(input: {
|
|
|
49
49
|
}
|
|
50
50
|
return { strategy: 'inline', reason: 'scalar_child' };
|
|
51
51
|
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Verbatim rejection message for a scheduling-required child invoked per row.
|
|
55
|
+
* Shared by the static preflight (`plays check`/publish gate) and the runtime
|
|
56
|
+
* launch guard so a dynamically-named child fails with the EXACT same text as a
|
|
57
|
+
* statically-provable one. See ADR 0013.
|
|
58
|
+
*/
|
|
59
|
+
export function inlineChildScheduledInRowMessage(
|
|
60
|
+
childPlayName: string,
|
|
61
|
+
rowContextField: string,
|
|
62
|
+
): string {
|
|
63
|
+
return (
|
|
64
|
+
`ctx.runPlay("${childPlayName}") runs per row in the "${rowContextField}" batch, ` +
|
|
65
|
+
'but it is a scheduling-required child (it uses ctx.dataset()/ctx.csv(), waits on an ' +
|
|
66
|
+
'event, or sets an explicit timeout). Row-scoped children must be scalar. ' +
|
|
67
|
+
'Give the batch ONE dataset child at play level instead of fanning a scheduled run out per row.'
|
|
68
|
+
);
|
|
69
|
+
}
|