deepline 0.1.315 → 0.1.317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +34 -6
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +0 -17
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +5 -2
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -157,7 +157,7 @@ export const SDK_RELEASE = {
|
|
|
157
157
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
158
158
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
159
159
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
160
|
-
version: '0.1.
|
|
160
|
+
version: '0.1.317',
|
|
161
161
|
contracts: {
|
|
162
162
|
api: {
|
|
163
163
|
name: 'sdk-http-api',
|
|
@@ -1371,6 +1371,12 @@ export class PlayContextImpl {
|
|
|
1371
1371
|
}> = [];
|
|
1372
1372
|
private processedRowCount = 0;
|
|
1373
1373
|
private sleepBoundaryIndex = 0;
|
|
1374
|
+
/**
|
|
1375
|
+
* `ctx.customerDb.query` is syntactic sugar over the query_customer_db tool.
|
|
1376
|
+
* Keep generated tool ids distinct so separate imperative queries retain
|
|
1377
|
+
* their normal mutation semantics.
|
|
1378
|
+
*/
|
|
1379
|
+
private customerDbQueryIndex = 0;
|
|
1374
1380
|
private readonly secretRedactor: SecretRedactionContext =
|
|
1375
1381
|
createSecretRedactionContext();
|
|
1376
1382
|
private mapInvocationIndex = 0;
|
|
@@ -1475,17 +1481,39 @@ export class PlayContextImpl {
|
|
|
1475
1481
|
}
|
|
1476
1482
|
readonly customerDb = {
|
|
1477
1483
|
query: async <TRow extends object = Record<string, unknown>>(
|
|
1478
|
-
statement:
|
|
1479
|
-
| string
|
|
1480
|
-
| { kind: 'sql.query'; text: string; values: readonly unknown[] },
|
|
1484
|
+
statement: string,
|
|
1481
1485
|
options?: { maxRows?: number; timeoutMs?: number },
|
|
1482
1486
|
): Promise<TRow[]> => {
|
|
1483
|
-
|
|
1487
|
+
const result = (await this.tools.execute({
|
|
1488
|
+
id: `customer_db_query_${this.customerDbQueryIndex++}`,
|
|
1489
|
+
tool: 'query_customer_db',
|
|
1490
|
+
input: {
|
|
1491
|
+
sql: statement,
|
|
1492
|
+
...(options?.maxRows !== undefined
|
|
1493
|
+
? { max_rows: options.maxRows }
|
|
1494
|
+
: {}),
|
|
1495
|
+
},
|
|
1496
|
+
description: 'Customer DB query',
|
|
1497
|
+
// The direct executor never reused a prior SQL result. Preserve that
|
|
1498
|
+
// imperative behavior for reads and mutations alike.
|
|
1499
|
+
force: true,
|
|
1500
|
+
...(options?.timeoutMs !== undefined
|
|
1501
|
+
? { timeoutMs: options.timeoutMs }
|
|
1502
|
+
: {}),
|
|
1503
|
+
})) as { toolOutput?: { raw?: unknown } };
|
|
1504
|
+
const raw = result.toolOutput?.raw;
|
|
1505
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
1506
|
+
throw new Error(
|
|
1507
|
+
'query_customer_db returned an invalid Customer DB result.',
|
|
1508
|
+
);
|
|
1509
|
+
}
|
|
1510
|
+
const rows = (raw as { rows?: unknown }).rows;
|
|
1511
|
+
if (rows === undefined) return [];
|
|
1512
|
+
if (!Array.isArray(rows)) {
|
|
1484
1513
|
throw new Error(
|
|
1485
|
-
'
|
|
1514
|
+
'query_customer_db returned an invalid Customer DB rows result.',
|
|
1486
1515
|
);
|
|
1487
1516
|
}
|
|
1488
|
-
const rows = await this.#options.queryCustomerDb(statement, options);
|
|
1489
1517
|
return [...rows] as TRow[];
|
|
1490
1518
|
},
|
|
1491
1519
|
};
|
|
@@ -298,22 +298,6 @@ export interface ToolExecutionRequest {
|
|
|
298
298
|
receiptWaitMs?: number;
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
-
export type SqlQuery = {
|
|
302
|
-
readonly kind: 'sql.query';
|
|
303
|
-
readonly text: string;
|
|
304
|
-
readonly values: readonly unknown[];
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
export type CustomerDbQueryOptions = {
|
|
308
|
-
maxRows?: number;
|
|
309
|
-
timeoutMs?: number;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
export type CustomerDbQueryHandler = (
|
|
313
|
-
statement: SqlQuery | string,
|
|
314
|
-
options?: CustomerDbQueryOptions,
|
|
315
|
-
) => Promise<readonly Record<string, unknown>[]>;
|
|
316
|
-
|
|
317
301
|
export interface PlayCallOptions {
|
|
318
302
|
description?: string;
|
|
319
303
|
/**
|
|
@@ -732,7 +716,6 @@ export interface ContextOptions {
|
|
|
732
716
|
toolDispatcherMaxInFlightGroups?: number;
|
|
733
717
|
/** Deterministic test override for the active-group cap per scheduling lane. */
|
|
734
718
|
toolDispatcherMaxInFlightGroupsPerLane?: number;
|
|
735
|
-
queryCustomerDb?: CustomerDbQueryHandler;
|
|
736
719
|
executeStructuredPlayDefinition?: (input: {
|
|
737
720
|
definition: PlayStructuredDefinition;
|
|
738
721
|
ctx: unknown;
|
|
@@ -7,6 +7,7 @@ const CLOUDFLARE_WORKFLOW_ENDPOINT_UNAVAILABLE_RE =
|
|
|
7
7
|
const VERCEL_RUNTIME_API_DEPLOYMENT_MISSING_RE =
|
|
8
8
|
/runtime API 404:[\s\S]*(?:DeploymentNotFound|DEPLOYMENT_NOT_FOUND|requested deployment .*exist|deployment could not be found on Vercel)/i;
|
|
9
9
|
const RUNTIME_LIMIT_EXCEEDED_RE = /\bRUNTIME_LIMIT_EXCEEDED\b/i;
|
|
10
|
+
const RUNTIME_RUNNER_LOST_RE = /\bRUNTIME_RUNNER_LOST\b/i;
|
|
10
11
|
const RUNTIME_SANDBOX_INSPECTION_UNAVAILABLE_RE =
|
|
11
12
|
/\bRUNTIME_SANDBOX_INSPECTION_UNAVAILABLE\b/i;
|
|
12
13
|
const RUNTIME_SANDBOX_LOST_RE = /\bRUNTIME_SANDBOX_LOST\b/i;
|
|
@@ -32,6 +33,8 @@ export const RUNTIME_SANDBOX_KILLED_MESSAGE =
|
|
|
32
33
|
'The execution sandbox was killed before it could return a result, and the kill reason is unavailable. Completed work is durably recorded. Retry the same command safely; Deepline reuses completed steps and does not repeat their provider calls.';
|
|
33
34
|
export const RUNTIME_LIMIT_EXCEEDED_MESSAGE =
|
|
34
35
|
'The play reached its 30 minute runtime limit and was stopped. Completed row state was preserved; run a smaller batch or continue from the persisted rows.';
|
|
36
|
+
export const RUNTIME_RUNNER_LOST_MESSAGE =
|
|
37
|
+
'The execution runner stopped reporting liveness before returning a terminal result. Completed work is preserved, but Deepline did not automatically replay the run because provider side effects may already exist. Re-run only when it is safe to do so.';
|
|
35
38
|
export const RUNTIME_SANDBOX_INSPECTION_UNAVAILABLE_MESSAGE =
|
|
36
39
|
'The play stopped after Deepline could not verify the execution sandbox state. Completed row state was preserved. Re-run from the persisted rows; if this keeps happening, contact Deepline support with the run ID.';
|
|
37
40
|
|
|
@@ -266,6 +269,20 @@ export function normalizePlayRunFailure(error: unknown): PlayRunFailureDetails {
|
|
|
266
269
|
cause,
|
|
267
270
|
};
|
|
268
271
|
}
|
|
272
|
+
if (RUNTIME_RUNNER_LOST_RE.test(rawCause)) {
|
|
273
|
+
const stack = error instanceof Error ? boundedFailureStack(error) : null;
|
|
274
|
+
const causes = error instanceof Error ? failureCauseTexts(error) : [];
|
|
275
|
+
return {
|
|
276
|
+
code: 'RUNTIME_RUNNER_LOST',
|
|
277
|
+
phase: 'infrastructure',
|
|
278
|
+
message: RUNTIME_RUNNER_LOST_MESSAGE,
|
|
279
|
+
retryable: false,
|
|
280
|
+
cause,
|
|
281
|
+
...(error instanceof Error ? { name: error.name || 'Error' } : {}),
|
|
282
|
+
...(stack ? { stack } : {}),
|
|
283
|
+
...(causes.length > 0 ? { causes } : {}),
|
|
284
|
+
};
|
|
285
|
+
}
|
|
269
286
|
if (RUNTIME_SANDBOX_INSPECTION_UNAVAILABLE_RE.test(rawCause)) {
|
|
270
287
|
return {
|
|
271
288
|
code: 'RUNTIME_SANDBOX_INSPECTION_UNAVAILABLE',
|
|
@@ -1038,6 +1038,7 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
1038
1038
|
exitCodePath: stagedPayload.exitCodePath,
|
|
1039
1039
|
runtimeCompletedPath: stagedPayload.runtimeCompletedPath,
|
|
1040
1040
|
startedAtMs: Date.now(),
|
|
1041
|
+
heartbeatTimeoutMs: push.leaseSeconds * 1_000,
|
|
1041
1042
|
ceilingMs:
|
|
1042
1043
|
(executionTimeoutSeconds + PLAY_RUNNER_TERMINAL_GRACE_SECONDS) *
|
|
1043
1044
|
1_000,
|
|
@@ -23,8 +23,8 @@ export type PlayExecutionSuspension =
|
|
|
23
23
|
* Push-execution park (B2-final): the Daytona runner command was started
|
|
24
24
|
* DETACHED and the worker parks instead of holding anything. The parked
|
|
25
25
|
* attempt wakes on the runner's pushed terminal (the gateway emits the
|
|
26
|
-
* absurd wake event)
|
|
27
|
-
* persisted state.
|
|
26
|
+
* absurd wake event), the scheduler-owned heartbeat deadline, or the
|
|
27
|
+
* hard execution ceiling, then finalizes from persisted state.
|
|
28
28
|
*/
|
|
29
29
|
kind: 'detached_runner';
|
|
30
30
|
boundaryId: string;
|
|
@@ -42,6 +42,9 @@ export type PlayExecutionSuspension =
|
|
|
42
42
|
/** Exact customer-code completion fence inside the Daytona sandbox. */
|
|
43
43
|
runtimeCompletedPath?: string;
|
|
44
44
|
startedAtMs: number;
|
|
45
|
+
/** Scheduler-owned liveness deadline. The sandbox can renew it only by
|
|
46
|
+
* persisting `heartbeat_at` through the receipt gateway. */
|
|
47
|
+
heartbeatTimeoutMs: number;
|
|
45
48
|
/** Overall run ceiling; the park timeout. */
|
|
46
49
|
ceilingMs: number;
|
|
47
50
|
};
|
package/dist/cli/index.js
CHANGED
|
@@ -1037,7 +1037,7 @@ var SDK_RELEASE = {
|
|
|
1037
1037
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
1038
1038
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
1039
1039
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
1040
|
-
version: "0.1.
|
|
1040
|
+
version: "0.1.317",
|
|
1041
1041
|
contracts: {
|
|
1042
1042
|
api: {
|
|
1043
1043
|
name: "sdk-http-api",
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1022,7 +1022,7 @@ var SDK_RELEASE = {
|
|
|
1022
1022
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
1023
1023
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
1024
1024
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
1025
|
-
version: "0.1.
|
|
1025
|
+
version: "0.1.317",
|
|
1026
1026
|
contracts: {
|
|
1027
1027
|
api: {
|
|
1028
1028
|
name: "sdk-http-api",
|
package/dist/index.js
CHANGED
|
@@ -760,7 +760,7 @@ var SDK_RELEASE = {
|
|
|
760
760
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
761
761
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
762
762
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
763
|
-
version: "0.1.
|
|
763
|
+
version: "0.1.317",
|
|
764
764
|
contracts: {
|
|
765
765
|
api: {
|
|
766
766
|
name: "sdk-http-api",
|
package/dist/index.mjs
CHANGED
|
@@ -686,7 +686,7 @@ var SDK_RELEASE = {
|
|
|
686
686
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
687
687
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
688
688
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
689
|
-
version: "0.1.
|
|
689
|
+
version: "0.1.317",
|
|
690
690
|
contracts: {
|
|
691
691
|
api: {
|
|
692
692
|
name: "sdk-http-api",
|