deepline 0.1.211 → 0.1.212

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 (33) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +150 -11
  2. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/customer-console.ts +23 -0
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/client.ts +118 -3
  5. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  7. package/dist/bundling-sources/sdk/src/types.ts +47 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +253 -30
  9. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +22 -20
  10. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +12 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/dataset-id.ts +10 -4
  12. package/dist/bundling-sources/shared_libs/play-runtime/db-session.ts +9 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +3 -5
  14. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +14 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +4 -2
  16. package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +21 -1
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +128 -6
  18. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +7 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +37 -5
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +19 -10
  21. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +63 -7
  22. package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +18 -4
  23. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +29 -9
  24. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +22 -1
  25. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +79 -1
  26. package/dist/cli/index.js +637 -229
  27. package/dist/cli/index.mjs +637 -229
  28. package/dist/index.d.mts +76 -6
  29. package/dist/index.d.ts +76 -6
  30. package/dist/index.js +225 -43
  31. package/dist/index.mjs +225 -43
  32. package/dist/plays/bundle-play-file.mjs +65 -4
  33. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -431,6 +431,16 @@ type PlayRunActionPackage = {
431
431
  runId: string;
432
432
  datasetPath: string;
433
433
  format: 'csv';
434
+ } | {
435
+ kind: 'deepline_run_logs';
436
+ runId: string;
437
+ view: 'failed' | 'tail';
438
+ limit: number;
439
+ command: string;
440
+ api: {
441
+ method: 'GET';
442
+ path: string;
443
+ };
434
444
  };
435
445
  /**
436
446
  * Compact canonical package for an inspected play run.
@@ -460,11 +470,30 @@ interface PlayRunPackage {
460
470
  steps: Array<Record<string, unknown>>;
461
471
  /** Named output summaries, including dataset handles and scalar outputs. */
462
472
  outputs: Record<string, Record<string, unknown>>;
473
+ /** Every durable Dataset Handle explicitly registered by this run. */
474
+ datasets?: Array<{
475
+ kind: 'dataset';
476
+ datasetId?: string;
477
+ path: string;
478
+ tableNamespace?: string;
479
+ rowCount?: number;
480
+ recovered?: true;
481
+ preview?: Record<string, unknown>;
482
+ actions?: Record<string, PlayRunActionPackage>;
483
+ }>;
484
+ /** Small retained tail of customer and runtime logs; fetch the full stream through `runs.logs`. */
485
+ logs?: {
486
+ tail: string[];
487
+ totalCount: number;
488
+ returnedCount: number;
489
+ truncated?: boolean;
490
+ };
463
491
  /** Follow-up actions a caller can perform against the run. */
464
492
  next?: {
465
493
  inspect?: PlayRunActionPackage;
466
494
  export?: PlayRunActionPackage;
467
495
  query?: PlayRunActionPackage;
496
+ logs?: PlayRunActionPackage;
468
497
  };
469
498
  }
470
499
  /**
@@ -490,6 +519,8 @@ interface PlayStatus {
490
519
  apiVersion?: number;
491
520
  /** Saved play name for this run, when available. */
492
521
  name?: string;
522
+ /** Exact saved revision launched for this run, when applicable. */
523
+ revisionId?: string;
493
524
  /** Alias for `name` used by run/result APIs. */
494
525
  playName?: string;
495
526
  /** Dashboard URL for inspecting the play and its run output in the app. */
@@ -524,6 +555,26 @@ interface PlayStatus {
524
555
  } | null;
525
556
  /** Structured follow-up actions for inspect/query/export. */
526
557
  next?: PlayRunPackage['next'] | Record<string, unknown>;
558
+ /** Bounded terminal-failure log window requested by `runs.get`. */
559
+ failedLogs?: {
560
+ runId: string;
561
+ totalCount: number;
562
+ returnedCount: number;
563
+ firstSequence: number | null;
564
+ lastSequence: number | null;
565
+ truncated: boolean;
566
+ hasMore: boolean;
567
+ entries: string[];
568
+ view?: 'failed';
569
+ association?: 'terminal_failure_window' | 'retained_before_truncation';
570
+ warning?: string;
571
+ next?: {
572
+ logs: string;
573
+ };
574
+ logsTruncated?: boolean;
575
+ };
576
+ /** Exact ordinary `plays run` command that can rerun a failed execution. */
577
+ rerunCommand?: string;
527
578
  }
528
579
  type LiveEventScope = 'play' | 'agent';
529
580
  interface LiveEventEnvelope<TPayload = unknown> {
@@ -1217,9 +1268,20 @@ type RunsListOptions = {
1217
1268
  status?: string;
1218
1269
  limit?: number;
1219
1270
  };
1271
+ /** Options for `client.runs.get(...)`. */
1272
+ type RunsGetOptions = {
1273
+ /** Return the raw status payload instead of the compact package. */
1274
+ full?: boolean;
1275
+ /** Attach a bounded end-of-stream window for a failed run. */
1276
+ failedLogs?: boolean;
1277
+ /** Requested failed-log lines to attach (default 20, hard-capped at 20). */
1278
+ failedLogLimit?: number;
1279
+ };
1220
1280
  /** Streaming options for `client.runs.tail(...)`. */
1221
1281
  type RunsTailOptions = {
1222
1282
  signal?: AbortSignal;
1283
+ /** Observe each canonical live event while `tail` waits for terminal state. */
1284
+ onEvent?: (event: PlayLiveEvent) => void;
1223
1285
  /**
1224
1286
  * Called before each stream reconnect. Server stream windows are finite, so
1225
1287
  * long runs reconnect with backoff until a terminal status is observed.
@@ -1242,6 +1304,8 @@ type RunsLogsOptions = {
1242
1304
  limit?: number;
1243
1305
  /** Fetch every stored log line, paginating to the full totalCount. */
1244
1306
  all?: boolean;
1307
+ /** Select the bounded failure view; truncated runs degrade explicitly. */
1308
+ failed?: boolean;
1245
1309
  };
1246
1310
  /** Persisted log response for one play run. */
1247
1311
  type RunsLogsResult = {
@@ -1253,6 +1317,16 @@ type RunsLogsResult = {
1253
1317
  truncated: boolean;
1254
1318
  hasMore: boolean;
1255
1319
  entries: string[];
1320
+ /** Selected public log view. */
1321
+ view?: 'tail' | 'failed' | 'all';
1322
+ /** Whether entries are terminal context or the last pre-truncation lines. */
1323
+ association?: 'terminal_failure_window' | 'retained_before_truncation';
1324
+ /** Loud explanation when the terminal failure window was not retained. */
1325
+ warning?: string;
1326
+ /** Exact follow-up command when the selected view is degraded. */
1327
+ next?: {
1328
+ logs: string;
1329
+ };
1256
1330
  /**
1257
1331
  * True when the run crossed the Run Log Stream retention cap: `totalCount`
1258
1332
  * keeps counting, but stored line bodies end at a loud truncation marker.
@@ -1307,9 +1381,7 @@ type PlaySecretMetadata = {
1307
1381
  */
1308
1382
  type RunsNamespace = {
1309
1383
  /** Get current run status by public run id. */
1310
- get: (runId: string, options?: {
1311
- full?: boolean;
1312
- }) => Promise<PlayStatus>;
1384
+ get: (runId: string, options?: RunsGetOptions) => Promise<PlayStatus>;
1313
1385
  /** List runs for one play, optionally filtered by status. */
1314
1386
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
1315
1387
  /** Stream run events and return the latest/terminal run status. */
@@ -2090,9 +2162,7 @@ declare class DeeplineClient {
2090
2162
  * deepline runs get <run-id> --json
2091
2163
  * ```
2092
2164
  */
2093
- getRunStatus(runId: string, options?: {
2094
- full?: boolean;
2095
- }): Promise<PlayStatus>;
2165
+ getRunStatus(runId: string, options?: RunsGetOptions): Promise<PlayStatus>;
2096
2166
  /**
2097
2167
  * List play runs using the public runs resource model.
2098
2168
  *
package/dist/index.d.ts CHANGED
@@ -431,6 +431,16 @@ type PlayRunActionPackage = {
431
431
  runId: string;
432
432
  datasetPath: string;
433
433
  format: 'csv';
434
+ } | {
435
+ kind: 'deepline_run_logs';
436
+ runId: string;
437
+ view: 'failed' | 'tail';
438
+ limit: number;
439
+ command: string;
440
+ api: {
441
+ method: 'GET';
442
+ path: string;
443
+ };
434
444
  };
435
445
  /**
436
446
  * Compact canonical package for an inspected play run.
@@ -460,11 +470,30 @@ interface PlayRunPackage {
460
470
  steps: Array<Record<string, unknown>>;
461
471
  /** Named output summaries, including dataset handles and scalar outputs. */
462
472
  outputs: Record<string, Record<string, unknown>>;
473
+ /** Every durable Dataset Handle explicitly registered by this run. */
474
+ datasets?: Array<{
475
+ kind: 'dataset';
476
+ datasetId?: string;
477
+ path: string;
478
+ tableNamespace?: string;
479
+ rowCount?: number;
480
+ recovered?: true;
481
+ preview?: Record<string, unknown>;
482
+ actions?: Record<string, PlayRunActionPackage>;
483
+ }>;
484
+ /** Small retained tail of customer and runtime logs; fetch the full stream through `runs.logs`. */
485
+ logs?: {
486
+ tail: string[];
487
+ totalCount: number;
488
+ returnedCount: number;
489
+ truncated?: boolean;
490
+ };
463
491
  /** Follow-up actions a caller can perform against the run. */
464
492
  next?: {
465
493
  inspect?: PlayRunActionPackage;
466
494
  export?: PlayRunActionPackage;
467
495
  query?: PlayRunActionPackage;
496
+ logs?: PlayRunActionPackage;
468
497
  };
469
498
  }
470
499
  /**
@@ -490,6 +519,8 @@ interface PlayStatus {
490
519
  apiVersion?: number;
491
520
  /** Saved play name for this run, when available. */
492
521
  name?: string;
522
+ /** Exact saved revision launched for this run, when applicable. */
523
+ revisionId?: string;
493
524
  /** Alias for `name` used by run/result APIs. */
494
525
  playName?: string;
495
526
  /** Dashboard URL for inspecting the play and its run output in the app. */
@@ -524,6 +555,26 @@ interface PlayStatus {
524
555
  } | null;
525
556
  /** Structured follow-up actions for inspect/query/export. */
526
557
  next?: PlayRunPackage['next'] | Record<string, unknown>;
558
+ /** Bounded terminal-failure log window requested by `runs.get`. */
559
+ failedLogs?: {
560
+ runId: string;
561
+ totalCount: number;
562
+ returnedCount: number;
563
+ firstSequence: number | null;
564
+ lastSequence: number | null;
565
+ truncated: boolean;
566
+ hasMore: boolean;
567
+ entries: string[];
568
+ view?: 'failed';
569
+ association?: 'terminal_failure_window' | 'retained_before_truncation';
570
+ warning?: string;
571
+ next?: {
572
+ logs: string;
573
+ };
574
+ logsTruncated?: boolean;
575
+ };
576
+ /** Exact ordinary `plays run` command that can rerun a failed execution. */
577
+ rerunCommand?: string;
527
578
  }
528
579
  type LiveEventScope = 'play' | 'agent';
529
580
  interface LiveEventEnvelope<TPayload = unknown> {
@@ -1217,9 +1268,20 @@ type RunsListOptions = {
1217
1268
  status?: string;
1218
1269
  limit?: number;
1219
1270
  };
1271
+ /** Options for `client.runs.get(...)`. */
1272
+ type RunsGetOptions = {
1273
+ /** Return the raw status payload instead of the compact package. */
1274
+ full?: boolean;
1275
+ /** Attach a bounded end-of-stream window for a failed run. */
1276
+ failedLogs?: boolean;
1277
+ /** Requested failed-log lines to attach (default 20, hard-capped at 20). */
1278
+ failedLogLimit?: number;
1279
+ };
1220
1280
  /** Streaming options for `client.runs.tail(...)`. */
1221
1281
  type RunsTailOptions = {
1222
1282
  signal?: AbortSignal;
1283
+ /** Observe each canonical live event while `tail` waits for terminal state. */
1284
+ onEvent?: (event: PlayLiveEvent) => void;
1223
1285
  /**
1224
1286
  * Called before each stream reconnect. Server stream windows are finite, so
1225
1287
  * long runs reconnect with backoff until a terminal status is observed.
@@ -1242,6 +1304,8 @@ type RunsLogsOptions = {
1242
1304
  limit?: number;
1243
1305
  /** Fetch every stored log line, paginating to the full totalCount. */
1244
1306
  all?: boolean;
1307
+ /** Select the bounded failure view; truncated runs degrade explicitly. */
1308
+ failed?: boolean;
1245
1309
  };
1246
1310
  /** Persisted log response for one play run. */
1247
1311
  type RunsLogsResult = {
@@ -1253,6 +1317,16 @@ type RunsLogsResult = {
1253
1317
  truncated: boolean;
1254
1318
  hasMore: boolean;
1255
1319
  entries: string[];
1320
+ /** Selected public log view. */
1321
+ view?: 'tail' | 'failed' | 'all';
1322
+ /** Whether entries are terminal context or the last pre-truncation lines. */
1323
+ association?: 'terminal_failure_window' | 'retained_before_truncation';
1324
+ /** Loud explanation when the terminal failure window was not retained. */
1325
+ warning?: string;
1326
+ /** Exact follow-up command when the selected view is degraded. */
1327
+ next?: {
1328
+ logs: string;
1329
+ };
1256
1330
  /**
1257
1331
  * True when the run crossed the Run Log Stream retention cap: `totalCount`
1258
1332
  * keeps counting, but stored line bodies end at a loud truncation marker.
@@ -1307,9 +1381,7 @@ type PlaySecretMetadata = {
1307
1381
  */
1308
1382
  type RunsNamespace = {
1309
1383
  /** Get current run status by public run id. */
1310
- get: (runId: string, options?: {
1311
- full?: boolean;
1312
- }) => Promise<PlayStatus>;
1384
+ get: (runId: string, options?: RunsGetOptions) => Promise<PlayStatus>;
1313
1385
  /** List runs for one play, optionally filtered by status. */
1314
1386
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
1315
1387
  /** Stream run events and return the latest/terminal run status. */
@@ -2090,9 +2162,7 @@ declare class DeeplineClient {
2090
2162
  * deepline runs get <run-id> --json
2091
2163
  * ```
2092
2164
  */
2093
- getRunStatus(runId: string, options?: {
2094
- full?: boolean;
2095
- }): Promise<PlayStatus>;
2165
+ getRunStatus(runId: string, options?: RunsGetOptions): Promise<PlayStatus>;
2096
2166
  /**
2097
2167
  * List play runs using the public runs resource model.
2098
2168
  *