deepline 0.3.258 → 0.3.259

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.
Files changed (67) hide show
  1. package/dist/bundling-sources/sdk/src/api-error.ts +45 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +98 -459
  3. package/dist/bundling-sources/sdk/src/http.ts +1 -34
  4. package/dist/bundling-sources/sdk/src/index.ts +8 -0
  5. package/dist/bundling-sources/sdk/src/plays/csv-data-input.ts +139 -0
  6. package/dist/bundling-sources/sdk/src/plays/run-request.ts +855 -0
  7. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  8. package/dist/bundling-sources/sdk/src/runs/overview.ts +45 -2
  9. package/dist/bundling-sources/sdk/src/types.ts +5 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +8 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +42 -10
  12. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +23 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +3 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-admission-outcome.ts +23 -5
  16. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +1 -1
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-execution-state.ts +845 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +106 -6
  19. package/dist/bundling-sources/shared_libs/play-runtime/run-observation.ts +440 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +35 -2
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +66 -7
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +0 -29
  23. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +475 -36
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +78 -11
  27. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +550 -42
  28. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +181 -8
  29. package/dist/bundling-sources/shared_libs/play-runtime/step-lifecycle-tracker.ts +0 -18
  30. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +80 -7
  31. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +37 -2
  32. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +148 -18
  33. package/dist/bundling-sources/shared_libs/plays/cascade-falloff.ts +86 -0
  34. package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +611 -0
  35. package/dist/bundling-sources/shared_libs/plays/docflow.ts +21 -0
  36. package/dist/bundling-sources/shared_libs/plays/play-exports.ts +28 -5
  37. package/dist/bundling-sources/shared_libs/plays/settings-contract.ts +92 -10
  38. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +5 -0
  39. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +222 -0
  40. package/dist/bundling-sources/shared_libs/plays/trigger-config-route.ts +15 -0
  41. package/dist/cli/index.js +4957 -771
  42. package/dist/cli/index.mjs +4957 -771
  43. package/dist/client-B5XbKrrs.d.mts +6564 -0
  44. package/dist/client-C9Y49yya.d.ts +6564 -0
  45. package/dist/{compiler-manifest-C4mdRJOP.d.mts → compiler-manifest-CUuh8C3b.d.mts} +14 -1
  46. package/dist/{compiler-manifest-C4mdRJOP.d.ts → compiler-manifest-CUuh8C3b.d.ts} +14 -1
  47. package/dist/index.d.mts +7 -6275
  48. package/dist/index.d.ts +7 -6275
  49. package/dist/index.js +360 -326
  50. package/dist/index.mjs +360 -326
  51. package/dist/install-integrity.json +21 -2
  52. package/dist/plays/bundle-play-file.d.mts +2 -2
  53. package/dist/plays/bundle-play-file.d.ts +2 -2
  54. package/dist/plays/bundle-play-file.mjs +117 -18
  55. package/dist/plays/csv-data-input.d.mts +37 -0
  56. package/dist/plays/csv-data-input.d.ts +37 -0
  57. package/dist/plays/csv-data-input.js +3135 -0
  58. package/dist/plays/csv-data-input.mjs +3108 -0
  59. package/dist/plays/run-request.d.mts +6 -0
  60. package/dist/plays/run-request.d.ts +6 -0
  61. package/dist/plays/run-request.js +664 -0
  62. package/dist/plays/run-request.mjs +614 -0
  63. package/dist/release.d.mts +1 -1
  64. package/dist/release.d.ts +1 -1
  65. package/dist/release.js +1 -1
  66. package/dist/release.mjs +1 -1
  67. package/package.json +12 -1
@@ -412,6 +412,8 @@ export function createPostgresSchedulerProgressReporter(input: {
412
412
 
413
413
  let liveNodeProgress: PlayVisualNodeProgressMap = {};
414
414
  let liveNodeProgressDirty = false;
415
+ /** Set once this reporter finalizes a FAILED result; see `finalize`. */
416
+ let nodeProgressSealed = false;
415
417
  let liveLogs: string[] = [];
416
418
  let liveLogContexts: Array<PlayLogContext | null> = [];
417
419
  let liveLogsTotalCount = input.initialLiveLogTotalCount ?? 0;
@@ -525,7 +527,7 @@ export function createPostgresSchedulerProgressReporter(input: {
525
527
  await publishStatusUpdate({
526
528
  playId: launch.runId,
527
529
  status: request.status,
528
- liveNodeProgress: nextProgress,
530
+ liveNodeProgress: nodeProgressSealed ? {} : nextProgress,
529
531
  liveLogs: nextLogs,
530
532
  liveLogContexts: nextLogContexts,
531
533
  liveLogTotalCount: nextLogTotalCount,
@@ -1453,19 +1455,28 @@ export function createPostgresSchedulerProgressReporter(input: {
1453
1455
  };
1454
1456
  workCountersDirty = true;
1455
1457
  }
1456
- // Mark started steps terminal with real timestamps. Static branches that
1457
- // never started remain non-executed; suspended runs stay in-flight.
1458
+ // A failed result's terminal is already decided: every caller that
1459
+ // finalizes one does so after (or while) the scheduler commits
1460
+ // `run.failed`, and the ledger freezes a terminal run's steps. Its step
1461
+ // facts from here are projections of this reporter's own partial view — a
1462
+ // parked worker's fold saw page-sized map totals and never saw the
1463
+ // runner's failures — so they used to land after `run.failed` claiming
1464
+ // docflow nodes were "running" and a 50,000-row map had "completed" 2,000.
1465
+ // The settled counts that ARE true travel in the terminal outbox row
1466
+ // (`buildFailedTerminalSettledProgressEvents`). Logs, work counters,
1467
+ // dataset and activity facts still flush.
1458
1468
  if (result?.status === 'failed') {
1459
- stepLifecycle.markStartedFailed();
1469
+ nodeProgressSealed = true;
1460
1470
  } else if (result?.status === 'completed') {
1471
+ // Mark started steps terminal with real timestamps. Static branches
1472
+ // that never started remain non-executed; suspended runs stay
1473
+ // in-flight.
1461
1474
  stepLifecycle.markAllTerminal();
1462
- }
1463
- // Terminal runs derive their per-map step progress from the durable data
1464
- // plane, overriding any stale/dropped event-fed counters. Checkpoint
1465
- // frames first (cheap, in-result), then sheet-table counts as the
1466
- // reconciliation of record. Suspended runs stay mid-flight, so leave their
1467
- // live counters untouched.
1468
- if (result?.status === 'completed' || result?.status === 'failed') {
1475
+ // Completed runs derive their per-map step progress from the durable
1476
+ // data plane, overriding any stale/dropped event-fed counters.
1477
+ // Checkpoint frames first (cheap, in-result), then sheet-table counts as
1478
+ // the reconciliation of record. Suspended runs stay mid-flight, so
1479
+ // leave their live counters untouched.
1469
1480
  reconcileTerminalMapProgressFromCheckpoint(result);
1470
1481
  reconcileTerminalMapProgressFromSheetOutcomes();
1471
1482
  }
@@ -1502,6 +1513,62 @@ export function createPostgresSchedulerProgressReporter(input: {
1502
1513
  };
1503
1514
  }
1504
1515
 
1516
+ /**
1517
+ * The settled row counts of a FAILED run's maps, as ledger facts that travel
1518
+ * in the `run.failed` outbox row ahead of the terminal fact.
1519
+ *
1520
+ * A failed run's final counts used to arrive only through the worker's
1521
+ * post-terminal progress finalize, after `run.failed` had made the ledger's
1522
+ * steps immutable, so they were dropped: the ledger kept the last live tick
1523
+ * (1,241 completed) while the runtime sheet held 1,260 completed and 38 failed
1524
+ * rows. These facts carry counts only — the runtime sheet's settled split
1525
+ * (ADR 0016 rule 3) — and nothing else a stopped run cannot vouch for:
1526
+ *
1527
+ * - no total: the sheet holds the rows materialized so far (a map admits its
1528
+ * input in pages), not the map's input count, so it would understate it;
1529
+ * - no completion stamp or status change: the map did not complete; the
1530
+ * terminal fact that follows settles it as failed;
1531
+ * - no progress line: the ledger rewrites the settled line from its counts.
1532
+ */
1533
+ export function buildFailedTerminalSettledProgressEvents(input: {
1534
+ launch: Pick<PlaySchedulerSubmitInput, 'runId' | 'contractSnapshot'>;
1535
+ outcomes: ReadonlyArray<{
1536
+ tableNamespace: string;
1537
+ completed: number;
1538
+ failed: number;
1539
+ }>;
1540
+ occurredAt: number;
1541
+ }): PlayRunLedgerEvent[] {
1542
+ const lookup = buildMapNodeLookup(input.launch.contractSnapshot);
1543
+ const events: PlayRunLedgerEvent[] = [];
1544
+ for (const outcome of input.outcomes) {
1545
+ const nodeRef = resolveDatasetNodeRefFromTableNamespace(
1546
+ lookup,
1547
+ outcome.tableNamespace,
1548
+ );
1549
+ if (!nodeRef) continue;
1550
+ const completed = Math.max(0, Math.floor(outcome.completed) || 0);
1551
+ const failed = Math.max(0, Math.floor(outcome.failed) || 0);
1552
+ if (completed <= 0 && failed <= 0) continue;
1553
+ events.push({
1554
+ type: 'step.progress',
1555
+ runId: input.launch.runId,
1556
+ source: 'worker',
1557
+ occurredAt: input.occurredAt,
1558
+ stepId: nodeRef.nodeId,
1559
+ status: 'running',
1560
+ progress: {
1561
+ completed,
1562
+ completedRows: completed,
1563
+ failed,
1564
+ artifactTableNamespace: nodeRef.artifactTableNamespace,
1565
+ updatedAt: input.occurredAt,
1566
+ },
1567
+ });
1568
+ }
1569
+ return events;
1570
+ }
1571
+
1505
1572
  export const createDirectWorkerProgressReporter = (input: {
1506
1573
  launch: PlaySchedulerSubmitInput;
1507
1574
  producerAttempt?: number;