deepline 0.3.247 → 0.3.248
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.ts +177 -13
- package/dist/bundling-sources/sdk/src/index.ts +8 -0
- package/dist/bundling-sources/sdk/src/plays/input-example.ts +40 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/overview.ts +457 -0
- package/dist/bundling-sources/sdk/src/runs/receipts.ts +23 -0
- package/dist/bundling-sources/sdk/src/tool-calls.ts +21 -1
- package/dist/bundling-sources/sdk/src/types.ts +16 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +19 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/column-names.ts +17 -3
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +40 -8
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +142 -14
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +6 -3
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +26 -21
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +23 -21
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/log-context.ts +105 -0
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +8 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +40 -4
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +50 -5
- package/dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-log-buffer.ts +28 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +56 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +184 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +327 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +87 -30
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +24 -13
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +23 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +76 -33
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +90 -35
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +62 -21
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +368 -66
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +22 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +105 -121
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +1347 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +16 -19
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +14 -6
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +40 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +5 -2
- package/dist/bundling-sources/shared_libs/plays/dataset-summary.ts +11 -7
- package/dist/bundling-sources/shared_libs/plays/static-pipeline-storage-codec.ts +5 -2
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +11 -2
- package/dist/cli/index.js +3504 -2368
- package/dist/cli/index.mjs +3188 -2052
- package/dist/{compiler-manifest-n8ZtPv2h.d.mts → compiler-manifest-DavmLa8y.d.mts} +1 -0
- package/dist/{compiler-manifest-n8ZtPv2h.d.ts → compiler-manifest-DavmLa8y.d.ts} +1 -0
- package/dist/index.d.mts +97 -5
- package/dist/index.d.ts +97 -5
- package/dist/index.js +135 -15
- package/dist/index.mjs +135 -15
- package/dist/install-integrity.json +9 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/bundle-play-file.mjs +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts
CHANGED
|
@@ -20,6 +20,10 @@ import {
|
|
|
20
20
|
import type { PlayVisualNodeProgressMap } from '../worker-api-types';
|
|
21
21
|
import type { PlayExecutionEvent } from '../ctx-types';
|
|
22
22
|
import type { PlayActivityObservation } from '../activity-observation';
|
|
23
|
+
import {
|
|
24
|
+
normalizePlayLogContext,
|
|
25
|
+
type PlayLogContext,
|
|
26
|
+
} from '../log-context';
|
|
23
27
|
import type {
|
|
24
28
|
PlayRunnerLogEvent,
|
|
25
29
|
PlayRunnerResult,
|
|
@@ -274,33 +278,53 @@ type TerminalLogReplayPayload = NonNullable<
|
|
|
274
278
|
RuntimeStatusUpdate['terminalLogReplay']
|
|
275
279
|
>;
|
|
276
280
|
|
|
277
|
-
function
|
|
281
|
+
function terminalReplayEntriesForMode(input: {
|
|
278
282
|
resultLogs: readonly string[];
|
|
283
|
+
resultLogContexts?: readonly (PlayLogContext | null)[];
|
|
279
284
|
durableLogMode: PostgresSchedulerDurableLogMode;
|
|
280
|
-
}): string
|
|
281
|
-
|
|
282
|
-
.
|
|
283
|
-
.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
}): Array<{ line: string; context: PlayLogContext | null }> {
|
|
286
|
+
if (
|
|
287
|
+
input.resultLogContexts !== undefined &&
|
|
288
|
+
input.resultLogContexts.length !== input.resultLogs.length
|
|
289
|
+
) {
|
|
290
|
+
throw new TypeError('Terminal log contexts must align with result logs.');
|
|
291
|
+
}
|
|
292
|
+
return input.resultLogs.flatMap((rawLine, index) => {
|
|
293
|
+
const line = rawLine.trim();
|
|
294
|
+
if (
|
|
295
|
+
line.length === 0 ||
|
|
296
|
+
!shouldPublishTerminalResultLog(input.durableLogMode, line)
|
|
297
|
+
) {
|
|
298
|
+
return [];
|
|
299
|
+
}
|
|
300
|
+
return [
|
|
301
|
+
{
|
|
302
|
+
line,
|
|
303
|
+
context: normalizePlayLogContext(input.resultLogContexts?.[index]),
|
|
304
|
+
},
|
|
305
|
+
];
|
|
306
|
+
});
|
|
288
307
|
}
|
|
289
308
|
|
|
290
309
|
function terminalReplayPayloadForMode(input: {
|
|
291
310
|
resultLogs: readonly string[];
|
|
311
|
+
resultLogContexts?: readonly (PlayLogContext | null)[];
|
|
292
312
|
durableLogMode: PostgresSchedulerDurableLogMode;
|
|
293
313
|
liveLogs: readonly string[];
|
|
314
|
+
liveLogContexts: readonly (PlayLogContext | null)[];
|
|
294
315
|
liveLogsTotalCount: number;
|
|
295
316
|
replayAllTerminalLogs: boolean;
|
|
296
317
|
producerAttempt?: number;
|
|
297
318
|
}): TerminalLogReplayPayload | null {
|
|
298
|
-
|
|
319
|
+
if (input.liveLogs.length !== input.liveLogContexts.length) {
|
|
320
|
+
throw new TypeError('Live log contexts must align with live log lines.');
|
|
321
|
+
}
|
|
322
|
+
let entries = terminalReplayEntriesForMode(input);
|
|
299
323
|
// Detached recovery is a complete attempt-local buffer. Its total count
|
|
300
324
|
// gives the replay an offset of zero on that attempt's positional channel;
|
|
301
325
|
// producerAttempt fences stale deliveries while the ledger absorbs only an
|
|
302
326
|
// exact retransmission from that same attempt.
|
|
303
|
-
let totalCount =
|
|
327
|
+
let totalCount = entries.length;
|
|
304
328
|
if (
|
|
305
329
|
input.durableLogMode === 'direct_worker' &&
|
|
306
330
|
!input.replayAllTerminalLogs
|
|
@@ -311,24 +335,27 @@ function terminalReplayPayloadForMode(input: {
|
|
|
311
335
|
if (!key) continue;
|
|
312
336
|
observedCounts.set(key, (observedCounts.get(key) ?? 0) + 1);
|
|
313
337
|
}
|
|
314
|
-
const
|
|
315
|
-
for (const
|
|
316
|
-
const key = line.trim().replace(CTX_LOG_TIMESTAMP_PREFIX_RE, '');
|
|
338
|
+
const boundedEntries: typeof entries = [];
|
|
339
|
+
for (const entry of entries) {
|
|
340
|
+
const key = entry.line.trim().replace(CTX_LOG_TIMESTAMP_PREFIX_RE, '');
|
|
317
341
|
const remaining = observedCounts.get(key) ?? 0;
|
|
318
342
|
if (remaining > 0) {
|
|
319
343
|
observedCounts.set(key, remaining - 1);
|
|
320
344
|
continue;
|
|
321
345
|
}
|
|
322
|
-
|
|
346
|
+
boundedEntries.push(entry);
|
|
323
347
|
}
|
|
324
|
-
|
|
325
|
-
totalCount = input.liveLogsTotalCount +
|
|
348
|
+
entries = boundedEntries;
|
|
349
|
+
totalCount = input.liveLogsTotalCount + entries.length;
|
|
326
350
|
}
|
|
327
|
-
if (
|
|
351
|
+
if (entries.length === 0) {
|
|
328
352
|
return null;
|
|
329
353
|
}
|
|
354
|
+
const lines = entries.map((entry) => entry.line);
|
|
355
|
+
const lineContexts = entries.map((entry) => entry.context);
|
|
330
356
|
return {
|
|
331
357
|
lines,
|
|
358
|
+
...(lineContexts.some(Boolean) ? { lineContexts } : {}),
|
|
332
359
|
...(input.replayAllTerminalLogs ? { dedupeMode: 'exact' as const } : {}),
|
|
333
360
|
...(typeof input.producerAttempt === 'number'
|
|
334
361
|
? { producerAttempt: input.producerAttempt }
|
|
@@ -385,6 +412,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
385
412
|
let liveNodeProgress: PlayVisualNodeProgressMap = {};
|
|
386
413
|
let liveNodeProgressDirty = false;
|
|
387
414
|
let liveLogs: string[] = [];
|
|
415
|
+
let liveLogContexts: Array<PlayLogContext | null> = [];
|
|
388
416
|
let liveLogsTotalCount = input.initialLiveLogTotalCount ?? 0;
|
|
389
417
|
let liveLogsDirty = false;
|
|
390
418
|
let workCounters: RuntimeStatusUpdate['workCounters'];
|
|
@@ -461,6 +489,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
461
489
|
|
|
462
490
|
const nextProgress = { ...liveNodeProgress };
|
|
463
491
|
const nextLogs = liveLogs.slice();
|
|
492
|
+
const nextLogContexts = liveLogContexts.slice();
|
|
464
493
|
const nextLogTotalCount = liveLogsTotalCount;
|
|
465
494
|
const nextDatasetLifecycleEvents = pendingDatasetLifecycleEvents;
|
|
466
495
|
pendingDatasetLifecycleEvents = [];
|
|
@@ -480,6 +509,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
480
509
|
status: request.status,
|
|
481
510
|
liveNodeProgress: nextProgress,
|
|
482
511
|
liveLogs: nextLogs,
|
|
512
|
+
liveLogContexts: nextLogContexts,
|
|
483
513
|
liveLogTotalCount: nextLogTotalCount,
|
|
484
514
|
liveLogProducerAttempt: producerAttempt,
|
|
485
515
|
datasetLifecycleEvents: nextDatasetLifecycleEvents,
|
|
@@ -579,15 +609,19 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
579
609
|
void flush({ force }).catch(() => undefined);
|
|
580
610
|
};
|
|
581
611
|
|
|
582
|
-
const appendLiveLog = (line: string) => {
|
|
612
|
+
const appendLiveLog = (line: string, context?: unknown) => {
|
|
583
613
|
const trimmed = line.trim();
|
|
584
614
|
if (!trimmed) {
|
|
585
615
|
return;
|
|
586
616
|
}
|
|
587
617
|
liveLogsTotalCount += 1;
|
|
588
618
|
liveLogs = [...liveLogs, trimmed];
|
|
619
|
+
liveLogContexts = [...liveLogContexts, normalizePlayLogContext(context)];
|
|
589
620
|
if (liveLogs.length > LIVE_LOG_TAIL_LIMIT) {
|
|
590
621
|
liveLogs = liveLogs.slice(liveLogs.length - LIVE_LOG_TAIL_LIMIT);
|
|
622
|
+
liveLogContexts = liveLogContexts.slice(
|
|
623
|
+
liveLogContexts.length - LIVE_LOG_TAIL_LIMIT,
|
|
624
|
+
);
|
|
591
625
|
}
|
|
592
626
|
liveLogsDirty = true;
|
|
593
627
|
};
|
|
@@ -1138,13 +1172,17 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1138
1172
|
return;
|
|
1139
1173
|
}
|
|
1140
1174
|
if (type === 'log') {
|
|
1141
|
-
const logEvent = event as {
|
|
1175
|
+
const logEvent = event as {
|
|
1176
|
+
line?: unknown;
|
|
1177
|
+
source?: unknown;
|
|
1178
|
+
context?: unknown;
|
|
1179
|
+
};
|
|
1142
1180
|
const rawLine = logEvent.line;
|
|
1143
1181
|
if (typeof rawLine !== 'string' || !rawLine) {
|
|
1144
1182
|
return;
|
|
1145
1183
|
}
|
|
1146
1184
|
if (shouldPublishDurableLogEvent(durableLogMode, logEvent)) {
|
|
1147
|
-
appendLiveLog(rawLine);
|
|
1185
|
+
appendLiveLog(rawLine, logEvent.context);
|
|
1148
1186
|
}
|
|
1149
1187
|
markMapStartedFromLog(rawLine);
|
|
1150
1188
|
markMapStartedFromPerfLog(rawLine);
|
|
@@ -1423,8 +1461,10 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1423
1461
|
? null
|
|
1424
1462
|
: terminalReplayPayloadForMode({
|
|
1425
1463
|
resultLogs: result.logs,
|
|
1464
|
+
resultLogContexts: result.logContexts,
|
|
1426
1465
|
durableLogMode,
|
|
1427
1466
|
liveLogs,
|
|
1467
|
+
liveLogContexts,
|
|
1428
1468
|
liveLogsTotalCount,
|
|
1429
1469
|
replayAllTerminalLogs: options.replayAllTerminalLogs === true,
|
|
1430
1470
|
producerAttempt:
|
|
@@ -1502,6 +1542,7 @@ export async function collectGatewayRunnerTerminalProgressLedgerEvents(input: {
|
|
|
1502
1542
|
lastCheckpointAt: finalUpdate.lastCheckpointAt,
|
|
1503
1543
|
liveNodeProgress: finalUpdate.liveNodeProgress,
|
|
1504
1544
|
liveLogs,
|
|
1545
|
+
liveLogContexts: finalUpdate.liveLogContexts,
|
|
1505
1546
|
liveLogsChannelOffset: Math.max(0, liveLogTotalCount - liveLogs.length),
|
|
1506
1547
|
liveLogsProducerAttempt:
|
|
1507
1548
|
finalUpdate.liveLogProducerAttempt ?? input.attempt,
|