deepline 0.1.199 → 0.1.200
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/coordinator-entry.ts +5 -1
- package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +51 -17
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/README.md +1 -1
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +16 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +40 -9
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +108 -39
- package/dist/bundling-sources/sdk/src/http.ts +5 -2
- package/dist/bundling-sources/sdk/src/play.ts +1 -1
- package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +7 -0
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/sdk/src/worker-play-entry.ts +11 -55
- package/dist/bundling-sources/shared_libs/play-runtime/adaptive-tool-dispatcher.ts +355 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +172 -73
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1794 -377
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +67 -4
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +161 -39
- package/dist/bundling-sources/shared_libs/play-runtime/governor/adaptive-admission.ts +218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +115 -25
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +17 -17
- package/dist/bundling-sources/shared_libs/play-runtime/lease-policy.ts +22 -0
- package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/live-events.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +265 -0
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +135 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-input.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +0 -3
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +10 -1
- package/dist/bundling-sources/shared_libs/play-runtime/providers.ts +9 -15
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-completion-sink.ts +262 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-heartbeat-supervisor.ts +64 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +76 -8
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-state-sink.ts +59 -0
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-status.ts +3 -2
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +269 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +2 -3
- package/dist/bundling-sources/shared_libs/play-runtime/run-terminal-source.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +433 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +227 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +882 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +573 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/bundle.ts +264 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/index.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runner-events.ts +35 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +53 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +459 -103
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-infra-mode.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-attempt-state-machine.ts +23 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +16 -24
- package/dist/bundling-sources/shared_libs/play-runtime/serial-task-queue.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/submit-limits.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/vercel-protection.ts +81 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +54 -9
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +17 -3
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +0 -20
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +105 -4
- package/dist/bundling-sources/shared_libs/plays/row-identity.ts +4 -11
- package/dist/cli/index.js +167 -54
- package/dist/cli/index.mjs +167 -54
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.mjs +8 -8
- package/dist/plays/bundle-play-file.mjs +15 -20
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/hatchet-cold-execution-diagnosis.ts +0 -321
- package/dist/bundling-sources/shared_libs/play-runtime/hatchet-cold-execution-target.ts +0 -158
- package/dist/bundling-sources/shared_libs/temporal/constants.ts +0 -39
- package/dist/bundling-sources/shared_libs/temporal/preview-config.ts +0 -150
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
} from '@shared_libs/play-runtime/runtime-contract';
|
|
39
39
|
import { PLAY_RUNTIME_API_COMPAT_PATH } from '@shared_libs/play-runtime/runtime-api-paths';
|
|
40
40
|
import { PLAY_RUNTIME_TEST_FAULT_HEADER } from '@shared_libs/play-runtime/test-runtime-seams';
|
|
41
|
+
import { vercelProtectionBypassHeaders } from '@shared_libs/play-runtime/vercel-protection';
|
|
41
42
|
|
|
42
43
|
export type StoredPlayArtifactPayload = {
|
|
43
44
|
sourceCode: string;
|
|
@@ -65,7 +66,7 @@ export type RuntimeStatusUpdate = {
|
|
|
65
66
|
liveLogTotalCount?: number;
|
|
66
67
|
/**
|
|
67
68
|
* Explicit terminal-output replay for final runner logs when the caller must
|
|
68
|
-
* keep `status` nonterminal.
|
|
69
|
+
* keep `status` nonterminal. Direct-worker/Postgres progress finalizers do this so
|
|
69
70
|
* scheduler projection remains the only terminal run writer, while the Run
|
|
70
71
|
* Log Stream still gets terminal transport recovery semantics.
|
|
71
72
|
*/
|
|
@@ -85,10 +86,6 @@ export type RuntimeSaveResults = {
|
|
|
85
86
|
error?: string;
|
|
86
87
|
publicResult?: Record<string, unknown> | null;
|
|
87
88
|
maxCreditsPerRun?: number | null;
|
|
88
|
-
temporalActionEstimate?: {
|
|
89
|
-
totalActions?: number;
|
|
90
|
-
[key: string]: unknown;
|
|
91
|
-
} | null;
|
|
92
89
|
};
|
|
93
90
|
userId?: string | null;
|
|
94
91
|
};
|
|
@@ -127,7 +124,6 @@ type RuntimeApiRequest =
|
|
|
127
124
|
maxCreditsPerRun?: number | null;
|
|
128
125
|
staticPipeline?: unknown;
|
|
129
126
|
source?: 'published' | 'ad_hoc' | 'draft';
|
|
130
|
-
activeRunLimit?: number | null;
|
|
131
127
|
}
|
|
132
128
|
| ({
|
|
133
129
|
action: 'save_results';
|
|
@@ -136,7 +132,8 @@ type RuntimeApiRequest =
|
|
|
136
132
|
action: 'apply_row_updates';
|
|
137
133
|
playName: string;
|
|
138
134
|
tableNamespace: string;
|
|
139
|
-
sheetContract
|
|
135
|
+
sheetContract?: PlaySheetContract | null;
|
|
136
|
+
contractSnapshot?: unknown;
|
|
140
137
|
runId: string;
|
|
141
138
|
userEmail: string;
|
|
142
139
|
updates: Array<Omit<PlayRowUpdate, 'rowId'> & { runId?: string }>;
|
|
@@ -249,6 +246,36 @@ type RuntimeApiRequest =
|
|
|
249
246
|
forceRefresh?: boolean;
|
|
250
247
|
forceFailedRefresh?: boolean;
|
|
251
248
|
}
|
|
249
|
+
| {
|
|
250
|
+
action: 'mark_runtime_step_receipt_running';
|
|
251
|
+
playName: string;
|
|
252
|
+
runId: string;
|
|
253
|
+
key: string;
|
|
254
|
+
runAttempt?: number | null;
|
|
255
|
+
leaseId?: string | null;
|
|
256
|
+
}
|
|
257
|
+
| {
|
|
258
|
+
action: 'mark_runtime_step_receipts_running';
|
|
259
|
+
playName: string;
|
|
260
|
+
runId: string;
|
|
261
|
+
receipts: Array<{
|
|
262
|
+
key: string;
|
|
263
|
+
runId: string;
|
|
264
|
+
runAttempt?: number | null;
|
|
265
|
+
leaseId?: string | null;
|
|
266
|
+
}>;
|
|
267
|
+
}
|
|
268
|
+
| {
|
|
269
|
+
action: 'mark_runtime_step_receipts_queued';
|
|
270
|
+
playName: string;
|
|
271
|
+
runId: string;
|
|
272
|
+
receipts: Array<{
|
|
273
|
+
key: string;
|
|
274
|
+
runId: string;
|
|
275
|
+
runAttempt?: number | null;
|
|
276
|
+
leaseId?: string | null;
|
|
277
|
+
}>;
|
|
278
|
+
}
|
|
252
279
|
| {
|
|
253
280
|
action: 'complete_runtime_step_receipts';
|
|
254
281
|
playName: string;
|
|
@@ -304,7 +331,6 @@ const runStatusLedgerSnapshots = new Map<string, PlayRunLedgerSnapshot>();
|
|
|
304
331
|
// positionally (exactly-once on the channel, repeated identical lines kept).
|
|
305
332
|
const runLogChannelSentCounts = new Map<string, number>();
|
|
306
333
|
const runStatusUpdateChains = new Map<string, Promise<void>>();
|
|
307
|
-
const vercelProtectionCookieCache = new Map<string, Promise<string | null>>();
|
|
308
334
|
|
|
309
335
|
function isTerminalRuntimeStatus(status: string): boolean {
|
|
310
336
|
return (
|
|
@@ -353,12 +379,53 @@ function isRetryableAppRuntimeResponse(input: {
|
|
|
353
379
|
}
|
|
354
380
|
return (
|
|
355
381
|
input.status === 429 ||
|
|
382
|
+
(input.status >= 520 && input.status <= 524) ||
|
|
356
383
|
input.status === 502 ||
|
|
357
384
|
input.status === 503 ||
|
|
358
385
|
input.status === 504
|
|
359
386
|
);
|
|
360
387
|
}
|
|
361
388
|
|
|
389
|
+
function summarizeAppRuntimeErrorBody(body: string): string {
|
|
390
|
+
const trimmed = body.trim();
|
|
391
|
+
if (!trimmed) {
|
|
392
|
+
return 'empty response body';
|
|
393
|
+
}
|
|
394
|
+
if (/<!doctype\s+html|<html[\s>]/i.test(trimmed)) {
|
|
395
|
+
const title = trimmed.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1];
|
|
396
|
+
const normalizedTitle = title
|
|
397
|
+
?.replace(/<[^>]+>/g, ' ')
|
|
398
|
+
.replace(/\s+/g, ' ')
|
|
399
|
+
.trim();
|
|
400
|
+
return normalizedTitle
|
|
401
|
+
? `HTML error page: ${normalizedTitle}`
|
|
402
|
+
: 'HTML error page';
|
|
403
|
+
}
|
|
404
|
+
try {
|
|
405
|
+
const parsed = JSON.parse(trimmed) as unknown;
|
|
406
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
407
|
+
const record = parsed as Record<string, unknown>;
|
|
408
|
+
const message =
|
|
409
|
+
typeof record.debug_error === 'string'
|
|
410
|
+
? record.debug_error
|
|
411
|
+
: typeof record.details === 'string'
|
|
412
|
+
? record.details
|
|
413
|
+
: typeof record.error === 'string'
|
|
414
|
+
? record.error
|
|
415
|
+
: typeof record.message === 'string'
|
|
416
|
+
? record.message
|
|
417
|
+
: null;
|
|
418
|
+
if (message?.trim()) {
|
|
419
|
+
return message.trim();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
} catch {}
|
|
423
|
+
if (/<[A-Za-z][\s\S]*>/.test(trimmed)) {
|
|
424
|
+
return 'HTML error page';
|
|
425
|
+
}
|
|
426
|
+
return trimmed.length > 500 ? `${trimmed.slice(0, 500)}...` : trimmed;
|
|
427
|
+
}
|
|
428
|
+
|
|
362
429
|
function isTransientAppRuntimeFailureBody(body: string): boolean {
|
|
363
430
|
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/i.test(
|
|
364
431
|
body,
|
|
@@ -384,20 +451,32 @@ function isRetryableAppRuntimeAction(
|
|
|
384
451
|
): boolean {
|
|
385
452
|
return (
|
|
386
453
|
action === 'append_run_events' ||
|
|
454
|
+
action === 'apply_row_updates' ||
|
|
455
|
+
action === 'compute_billing_finalize' ||
|
|
456
|
+
action === 'compute_billing_record_item' ||
|
|
457
|
+
action === 'compute_billing_upsert' ||
|
|
387
458
|
action === 'create_db_session' ||
|
|
388
459
|
action === 'create_signed_artifact_url' ||
|
|
389
460
|
action === 'create_signed_staged_file_url' ||
|
|
390
461
|
action === 'get_runtime_step_receipt' ||
|
|
391
462
|
action === 'get_runtime_step_receipts' ||
|
|
463
|
+
action === 'heartbeat_runtime_step_receipts' ||
|
|
392
464
|
action === 'claim_runtime_step_receipt' ||
|
|
393
465
|
action === 'claim_runtime_step_receipts' ||
|
|
466
|
+
action === 'mark_runtime_step_receipt_running' ||
|
|
467
|
+
action === 'mark_runtime_step_receipts_running' ||
|
|
468
|
+
action === 'mark_runtime_step_receipts_queued' ||
|
|
394
469
|
action === 'complete_runtime_step_receipt' ||
|
|
395
470
|
action === 'complete_runtime_step_receipts' ||
|
|
396
471
|
action === 'fail_runtime_step_receipt' ||
|
|
397
472
|
action === 'fail_runtime_step_receipts' ||
|
|
398
473
|
action === 'rate_state_acquire' ||
|
|
399
474
|
action === 'rate_state_release' ||
|
|
400
|
-
action === 'rate_state_penalize'
|
|
475
|
+
action === 'rate_state_penalize' ||
|
|
476
|
+
action === 'release_runtime_step_receipt' ||
|
|
477
|
+
action === 'save_results' ||
|
|
478
|
+
action === 'skip_runtime_step_receipt' ||
|
|
479
|
+
action === 'start_inline_child_run'
|
|
401
480
|
);
|
|
402
481
|
}
|
|
403
482
|
|
|
@@ -420,62 +499,38 @@ function appRuntimeRetryDelayMs(
|
|
|
420
499
|
return appRuntimeRetryDelaysForAction(action)[attempt - 1] ?? 1_000;
|
|
421
500
|
}
|
|
422
501
|
|
|
423
|
-
function
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
502
|
+
function appRuntimeRetryAfterMs(
|
|
503
|
+
response: Response,
|
|
504
|
+
body: string,
|
|
505
|
+
): number | null {
|
|
506
|
+
try {
|
|
507
|
+
const parsed = JSON.parse(body) as unknown;
|
|
508
|
+
if (
|
|
509
|
+
parsed &&
|
|
510
|
+
typeof parsed === 'object' &&
|
|
511
|
+
!Array.isArray(parsed) &&
|
|
512
|
+
typeof (parsed as Record<string, unknown>).retry_after_ms === 'number'
|
|
513
|
+
) {
|
|
514
|
+
return Math.max(
|
|
515
|
+
0,
|
|
516
|
+
Math.min((parsed as Record<string, number>).retry_after_ms, 30_000),
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
} catch {}
|
|
437
520
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
.
|
|
441
|
-
|
|
442
|
-
return getter.call(headers);
|
|
443
|
-
}
|
|
444
|
-
const single = headers.get('set-cookie');
|
|
445
|
-
return single ? [single] : [];
|
|
521
|
+
const retryAfterSeconds = Number(response.headers.get('retry-after'));
|
|
522
|
+
return Number.isFinite(retryAfterSeconds)
|
|
523
|
+
? Math.max(0, Math.min(retryAfterSeconds * 1_000, 30_000))
|
|
524
|
+
: null;
|
|
446
525
|
}
|
|
447
526
|
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
.flatMap((header) => header.split(/,(?=\s*[^;,=]+=[^;,]+)/g))
|
|
451
|
-
.map((header) => header.split(';', 1)[0]?.trim() ?? '')
|
|
452
|
-
.filter(Boolean);
|
|
453
|
-
return cookies.length > 0 ? cookies.join('; ') : null;
|
|
527
|
+
function sleep(ms: number): Promise<void> {
|
|
528
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
454
529
|
}
|
|
455
530
|
|
|
456
|
-
function
|
|
457
|
-
context: WorkerRuntimeApiContext,
|
|
458
|
-
): Promise<string | null> {
|
|
459
|
-
const bypassToken = context.vercelProtectionBypassToken?.trim();
|
|
460
|
-
if (!bypassToken) return Promise.resolve(null);
|
|
461
|
-
|
|
531
|
+
function resolveAppRuntimeApiUrl(context: WorkerRuntimeApiContext): string {
|
|
462
532
|
const baseUrl = context.baseUrl.trim().replace(/\/$/, '');
|
|
463
|
-
|
|
464
|
-
const cached = vercelProtectionCookieCache.get(cacheKey);
|
|
465
|
-
if (cached) return cached;
|
|
466
|
-
|
|
467
|
-
const promise = (async () => {
|
|
468
|
-
const url = new URL(`${baseUrl}/api/v2/health`);
|
|
469
|
-
url.searchParams.set('x-vercel-set-bypass-cookie', 'true');
|
|
470
|
-
url.searchParams.set('x-vercel-protection-bypass', bypassToken);
|
|
471
|
-
const runtimeFetch = context.fetch ?? fetch;
|
|
472
|
-
const response = await runtimeFetch(url.toString(), {
|
|
473
|
-
headers: { 'x-vercel-protection-bypass': bypassToken },
|
|
474
|
-
}).catch(() => null);
|
|
475
|
-
return response ? cookieHeaderFromSetCookie(response.headers) : null;
|
|
476
|
-
})();
|
|
477
|
-
vercelProtectionCookieCache.set(cacheKey, promise);
|
|
478
|
-
return promise;
|
|
533
|
+
return `${baseUrl}${PLAY_RUNTIME_API_COMPAT_PATH}`;
|
|
479
534
|
}
|
|
480
535
|
|
|
481
536
|
async function postAppRuntimeApi<TResponse>(
|
|
@@ -490,33 +545,31 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
490
545
|
if (!token) {
|
|
491
546
|
throw new Error('Worker runtime API requires executorToken.');
|
|
492
547
|
}
|
|
493
|
-
const
|
|
548
|
+
const runtimeFetch = context.fetch ?? fetch;
|
|
549
|
+
const vercelHeaders = await vercelProtectionBypassHeaders({
|
|
550
|
+
baseUrl,
|
|
551
|
+
token: context.vercelProtectionBypassToken,
|
|
552
|
+
fetchImpl: runtimeFetch,
|
|
553
|
+
});
|
|
494
554
|
|
|
495
555
|
const maxAttempts = appRuntimeMaxAttempts(body.action);
|
|
496
556
|
|
|
497
557
|
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
498
558
|
let response: Response;
|
|
499
559
|
try {
|
|
500
|
-
const runtimeFetch = context.fetch ?? fetch;
|
|
501
560
|
response = await runtimeFetch(resolveAppRuntimeApiUrl(context), {
|
|
502
561
|
method: 'POST',
|
|
503
562
|
headers: {
|
|
504
563
|
'content-type': 'application/json',
|
|
505
564
|
authorization: `Bearer ${token}`,
|
|
506
565
|
[PLAY_RUNTIME_CONTRACT_HEADER]: String(PLAY_RUNTIME_CONTRACT),
|
|
507
|
-
...
|
|
508
|
-
? {
|
|
509
|
-
'x-vercel-protection-bypass':
|
|
510
|
-
context.vercelProtectionBypassToken.trim(),
|
|
511
|
-
}
|
|
512
|
-
: {}),
|
|
566
|
+
...vercelHeaders,
|
|
513
567
|
...(context.runtimeTestFaultHeader?.trim()
|
|
514
568
|
? {
|
|
515
569
|
[PLAY_RUNTIME_TEST_FAULT_HEADER]:
|
|
516
570
|
context.runtimeTestFaultHeader.trim(),
|
|
517
571
|
}
|
|
518
572
|
: {}),
|
|
519
|
-
...(vercelProtectionCookie ? { cookie: vercelProtectionCookie } : {}),
|
|
520
573
|
},
|
|
521
574
|
body: JSON.stringify(body),
|
|
522
575
|
});
|
|
@@ -542,11 +595,16 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
542
595
|
body: responseText,
|
|
543
596
|
})
|
|
544
597
|
) {
|
|
545
|
-
await sleep(
|
|
598
|
+
await sleep(
|
|
599
|
+
Math.max(
|
|
600
|
+
appRuntimeRetryDelayMs(body.action, attempt),
|
|
601
|
+
appRuntimeRetryAfterMs(response, responseText) ?? 0,
|
|
602
|
+
),
|
|
603
|
+
);
|
|
546
604
|
continue;
|
|
547
605
|
}
|
|
548
606
|
throw new Error(
|
|
549
|
-
`App runtime API ${body.action} failed with status ${response.status}: ${responseText}`,
|
|
607
|
+
`App runtime API ${body.action} failed with status ${response.status}: ${summarizeAppRuntimeErrorBody(responseText)}`,
|
|
550
608
|
);
|
|
551
609
|
}
|
|
552
610
|
|
|
@@ -774,13 +832,13 @@ async function updateRunStatusViaAppRuntimeUnlocked(
|
|
|
774
832
|
},
|
|
775
833
|
previousSnapshot,
|
|
776
834
|
now: update.lastCheckpointAt ?? Date.now(),
|
|
777
|
-
source: '
|
|
835
|
+
source: 'worker',
|
|
778
836
|
});
|
|
779
837
|
if (terminalLogReplay && terminalLogReplay.lines.length > 0) {
|
|
780
838
|
events.push(
|
|
781
839
|
...buildTerminalLogReplayEvents({
|
|
782
840
|
runId: update.playId,
|
|
783
|
-
source: '
|
|
841
|
+
source: 'worker',
|
|
784
842
|
occurredAt: update.lastCheckpointAt ?? Date.now(),
|
|
785
843
|
lines: terminalLogReplay.lines,
|
|
786
844
|
liveLogTotalCount: terminalLogReplay.totalCount,
|
|
@@ -834,7 +892,6 @@ export async function startRunViaAppRuntime(
|
|
|
834
892
|
maxCreditsPerRun?: number | null;
|
|
835
893
|
staticPipeline?: unknown;
|
|
836
894
|
source?: 'published' | 'ad_hoc' | 'draft';
|
|
837
|
-
activeRunLimit?: number | null;
|
|
838
895
|
},
|
|
839
896
|
): Promise<void> {
|
|
840
897
|
await postAppRuntimeApi<{ ok: true }>(context, {
|
|
@@ -969,6 +1026,48 @@ export async function claimRuntimeStepReceiptsViaAppRuntime(
|
|
|
969
1026
|
});
|
|
970
1027
|
}
|
|
971
1028
|
|
|
1029
|
+
export async function markRuntimeStepReceiptRunningViaAppRuntime(
|
|
1030
|
+
context: WorkerRuntimeApiContext,
|
|
1031
|
+
input: Omit<
|
|
1032
|
+
Extract<RuntimeApiRequest, { action: 'mark_runtime_step_receipt_running' }>,
|
|
1033
|
+
'action'
|
|
1034
|
+
>,
|
|
1035
|
+
): Promise<RuntimeStepReceipt | null> {
|
|
1036
|
+
return await postAppRuntimeApi<RuntimeStepReceipt | null>(context, {
|
|
1037
|
+
action: 'mark_runtime_step_receipt_running',
|
|
1038
|
+
...input,
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export async function markRuntimeStepReceiptsRunningViaAppRuntime(
|
|
1043
|
+
context: WorkerRuntimeApiContext,
|
|
1044
|
+
input: Omit<
|
|
1045
|
+
Extract<
|
|
1046
|
+
RuntimeApiRequest,
|
|
1047
|
+
{ action: 'mark_runtime_step_receipts_running' }
|
|
1048
|
+
>,
|
|
1049
|
+
'action'
|
|
1050
|
+
>,
|
|
1051
|
+
): Promise<Array<RuntimeStepReceipt | null>> {
|
|
1052
|
+
return await postAppRuntimeApi<Array<RuntimeStepReceipt | null>>(context, {
|
|
1053
|
+
action: 'mark_runtime_step_receipts_running',
|
|
1054
|
+
...input,
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
export async function markRuntimeStepReceiptsQueuedViaAppRuntime(
|
|
1059
|
+
context: WorkerRuntimeApiContext,
|
|
1060
|
+
input: Omit<
|
|
1061
|
+
Extract<RuntimeApiRequest, { action: 'mark_runtime_step_receipts_queued' }>,
|
|
1062
|
+
'action'
|
|
1063
|
+
>,
|
|
1064
|
+
): Promise<Array<RuntimeStepReceipt | null>> {
|
|
1065
|
+
return await postAppRuntimeApi<Array<RuntimeStepReceipt | null>>(context, {
|
|
1066
|
+
action: 'mark_runtime_step_receipts_queued',
|
|
1067
|
+
...input,
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
|
|
972
1071
|
export async function completeRuntimeStepReceiptViaAppRuntime(
|
|
973
1072
|
context: WorkerRuntimeApiContext,
|
|
974
1073
|
input: Omit<
|