deepline 0.1.51 → 0.1.53

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/index.d.mts CHANGED
@@ -407,7 +407,7 @@ interface ToolMetadata extends ToolDefinition {
407
407
  * ```typescript
408
408
  * const result = await client.runPlay(code, null, 'my-play');
409
409
  * if (result.success) {
410
- * console.log('Output:', result.result);
410
+ * console.log('Run package:', result.result);
411
411
  * console.log(`Completed in ${result.durationMs}ms`);
412
412
  * } else {
413
413
  * console.error('Failed:', result.error);
@@ -420,8 +420,10 @@ interface PlayRunResult {
420
420
  success: boolean;
421
421
  /** Public play-run identifier. */
422
422
  runId: string;
423
- /** The play's return value. Only present on success. */
423
+ /** Canonical run package for current play runs; legacy clients may receive a raw result. */
424
424
  result?: unknown;
425
+ /** Canonical compact run package when returned by the server. */
426
+ package?: PlayRunPackage;
425
427
  /** All log lines emitted via `ctx.log()` during execution. */
426
428
  logs: string[];
427
429
  /** Wall-clock duration from submission to completion, in milliseconds. */
@@ -442,6 +444,51 @@ interface PlayProgressStatus {
442
444
  /** Error message if the play has failed. */
443
445
  error?: string;
444
446
  }
447
+ type PlayRunActionPackage = {
448
+ kind: 'deepline_run_inspect';
449
+ runId: string;
450
+ api: {
451
+ method: 'GET';
452
+ path: string;
453
+ };
454
+ } | {
455
+ kind: 'deepline_db_query';
456
+ datasetPath: string;
457
+ tableNamespace?: string;
458
+ sql: string;
459
+ maxRows: number;
460
+ api: {
461
+ method: 'POST';
462
+ path: '/api/v2/db/query';
463
+ };
464
+ } | {
465
+ kind: 'deepline_run_export';
466
+ runId: string;
467
+ datasetPath: string;
468
+ format: 'csv';
469
+ };
470
+ interface PlayRunPackage {
471
+ schemaVersion: 1;
472
+ kind: 'play_run';
473
+ run: {
474
+ id: string;
475
+ playName: string;
476
+ status: string;
477
+ dashboardUrl?: string;
478
+ updatedAt?: number | null;
479
+ startedAt?: number | null;
480
+ finishedAt?: number | null;
481
+ durationMs?: number | null;
482
+ error?: string;
483
+ };
484
+ steps: Array<Record<string, unknown>>;
485
+ outputs: Record<string, Record<string, unknown>>;
486
+ next?: {
487
+ inspect?: PlayRunActionPackage;
488
+ export?: PlayRunActionPackage;
489
+ query?: PlayRunActionPackage;
490
+ };
491
+ }
445
492
  /**
446
493
  * Current status of a play execution, returned by {@link DeeplineClient.getPlayStatus}.
447
494
  *
@@ -475,8 +522,13 @@ interface PlayStatus {
475
522
  progress?: PlayProgressStatus;
476
523
  /** Partial or final result. Available once the play returns. */
477
524
  result?: unknown;
525
+ /** Compact typed run package returned by current run status endpoints. */
526
+ package?: PlayRunPackage;
527
+ /** Compact typed output summaries, mirrored from the run package when present. */
528
+ outputs?: PlayRunPackage['outputs'];
478
529
  /** Scheduler-backed run metadata when returned by the status endpoint. */
479
530
  run?: {
531
+ id?: string;
480
532
  startTime?: string | null;
481
533
  closeTime?: string | null;
482
534
  [key: string]: unknown;
@@ -492,6 +544,8 @@ interface PlayStatus {
492
544
  eventKey?: string;
493
545
  until?: number;
494
546
  } | null;
547
+ /** Structured follow-up actions for inspect/query/export. */
548
+ next?: PlayRunPackage['next'] | Record<string, unknown>;
495
549
  }
496
550
  type LiveEventScope = 'play' | 'agent';
497
551
  interface LiveEventEnvelope<TPayload = unknown> {
@@ -773,6 +827,8 @@ interface PlayRunStart {
773
827
  dashboardUrl?: string;
774
828
  /** Terminal status returned when the start request used a short completion wait. */
775
829
  finalStatus?: unknown;
830
+ /** Canonical compact run package returned by current SDK/API responses. */
831
+ package?: PlayRunPackage;
776
832
  }
777
833
  /**
778
834
  * Result returned by {@link DeeplineClient.checkPlayArtifact}.
@@ -966,7 +1022,9 @@ type PlaySheetRowsResult = {
966
1022
  deltaCursor?: number;
967
1023
  };
968
1024
  type RunsNamespace = {
969
- get: (runId: string) => Promise<PlayStatus>;
1025
+ get: (runId: string, options?: {
1026
+ full?: boolean;
1027
+ }) => Promise<PlayStatus>;
970
1028
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
971
1029
  tail: (runId: string, options?: RunsTailOptions) => Promise<PlayStatus>;
972
1030
  logs: (runId: string, options?: RunsLogsOptions) => Promise<RunsLogsResult>;
@@ -1107,7 +1165,7 @@ declare class DeeplineClient {
1107
1165
  * artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
1108
1166
  * });
1109
1167
  * ```
1110
- */
1168
+ */
1111
1169
  startPlayRun(request: StartPlayRunRequest): Promise<PlayRunStart>;
1112
1170
  startPlayRunStream(request: StartPlayRunRequest, options?: {
1113
1171
  signal?: AbortSignal;
@@ -1293,6 +1351,7 @@ declare class DeeplineClient {
1293
1351
  */
1294
1352
  getPlayStatus(workflowId: string, options?: {
1295
1353
  billing?: boolean;
1354
+ full?: boolean;
1296
1355
  }): Promise<PlayStatus>;
1297
1356
  /**
1298
1357
  * Stream semantic play-run events using the same SSE feed as the dashboard.
@@ -1354,7 +1413,9 @@ declare class DeeplineClient {
1354
1413
  * deepline runs get <run-id> --json
1355
1414
  * ```
1356
1415
  */
1357
- getRunStatus(runId: string): Promise<PlayStatus>;
1416
+ getRunStatus(runId: string, options?: {
1417
+ full?: boolean;
1418
+ }): Promise<PlayStatus>;
1358
1419
  /**
1359
1420
  * List play runs using the public runs resource model.
1360
1421
  *
@@ -1541,8 +1602,8 @@ declare class DeeplineClient {
1541
1602
  }>;
1542
1603
  }
1543
1604
 
1544
- declare const SDK_VERSION = "0.1.51";
1545
- declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1605
+ declare const SDK_VERSION: string;
1606
+ declare const SDK_API_CONTRACT: string;
1546
1607
 
1547
1608
  /**
1548
1609
  * Base error class for all Deepline SDK errors.
package/dist/index.d.ts CHANGED
@@ -407,7 +407,7 @@ interface ToolMetadata extends ToolDefinition {
407
407
  * ```typescript
408
408
  * const result = await client.runPlay(code, null, 'my-play');
409
409
  * if (result.success) {
410
- * console.log('Output:', result.result);
410
+ * console.log('Run package:', result.result);
411
411
  * console.log(`Completed in ${result.durationMs}ms`);
412
412
  * } else {
413
413
  * console.error('Failed:', result.error);
@@ -420,8 +420,10 @@ interface PlayRunResult {
420
420
  success: boolean;
421
421
  /** Public play-run identifier. */
422
422
  runId: string;
423
- /** The play's return value. Only present on success. */
423
+ /** Canonical run package for current play runs; legacy clients may receive a raw result. */
424
424
  result?: unknown;
425
+ /** Canonical compact run package when returned by the server. */
426
+ package?: PlayRunPackage;
425
427
  /** All log lines emitted via `ctx.log()` during execution. */
426
428
  logs: string[];
427
429
  /** Wall-clock duration from submission to completion, in milliseconds. */
@@ -442,6 +444,51 @@ interface PlayProgressStatus {
442
444
  /** Error message if the play has failed. */
443
445
  error?: string;
444
446
  }
447
+ type PlayRunActionPackage = {
448
+ kind: 'deepline_run_inspect';
449
+ runId: string;
450
+ api: {
451
+ method: 'GET';
452
+ path: string;
453
+ };
454
+ } | {
455
+ kind: 'deepline_db_query';
456
+ datasetPath: string;
457
+ tableNamespace?: string;
458
+ sql: string;
459
+ maxRows: number;
460
+ api: {
461
+ method: 'POST';
462
+ path: '/api/v2/db/query';
463
+ };
464
+ } | {
465
+ kind: 'deepline_run_export';
466
+ runId: string;
467
+ datasetPath: string;
468
+ format: 'csv';
469
+ };
470
+ interface PlayRunPackage {
471
+ schemaVersion: 1;
472
+ kind: 'play_run';
473
+ run: {
474
+ id: string;
475
+ playName: string;
476
+ status: string;
477
+ dashboardUrl?: string;
478
+ updatedAt?: number | null;
479
+ startedAt?: number | null;
480
+ finishedAt?: number | null;
481
+ durationMs?: number | null;
482
+ error?: string;
483
+ };
484
+ steps: Array<Record<string, unknown>>;
485
+ outputs: Record<string, Record<string, unknown>>;
486
+ next?: {
487
+ inspect?: PlayRunActionPackage;
488
+ export?: PlayRunActionPackage;
489
+ query?: PlayRunActionPackage;
490
+ };
491
+ }
445
492
  /**
446
493
  * Current status of a play execution, returned by {@link DeeplineClient.getPlayStatus}.
447
494
  *
@@ -475,8 +522,13 @@ interface PlayStatus {
475
522
  progress?: PlayProgressStatus;
476
523
  /** Partial or final result. Available once the play returns. */
477
524
  result?: unknown;
525
+ /** Compact typed run package returned by current run status endpoints. */
526
+ package?: PlayRunPackage;
527
+ /** Compact typed output summaries, mirrored from the run package when present. */
528
+ outputs?: PlayRunPackage['outputs'];
478
529
  /** Scheduler-backed run metadata when returned by the status endpoint. */
479
530
  run?: {
531
+ id?: string;
480
532
  startTime?: string | null;
481
533
  closeTime?: string | null;
482
534
  [key: string]: unknown;
@@ -492,6 +544,8 @@ interface PlayStatus {
492
544
  eventKey?: string;
493
545
  until?: number;
494
546
  } | null;
547
+ /** Structured follow-up actions for inspect/query/export. */
548
+ next?: PlayRunPackage['next'] | Record<string, unknown>;
495
549
  }
496
550
  type LiveEventScope = 'play' | 'agent';
497
551
  interface LiveEventEnvelope<TPayload = unknown> {
@@ -773,6 +827,8 @@ interface PlayRunStart {
773
827
  dashboardUrl?: string;
774
828
  /** Terminal status returned when the start request used a short completion wait. */
775
829
  finalStatus?: unknown;
830
+ /** Canonical compact run package returned by current SDK/API responses. */
831
+ package?: PlayRunPackage;
776
832
  }
777
833
  /**
778
834
  * Result returned by {@link DeeplineClient.checkPlayArtifact}.
@@ -966,7 +1022,9 @@ type PlaySheetRowsResult = {
966
1022
  deltaCursor?: number;
967
1023
  };
968
1024
  type RunsNamespace = {
969
- get: (runId: string) => Promise<PlayStatus>;
1025
+ get: (runId: string, options?: {
1026
+ full?: boolean;
1027
+ }) => Promise<PlayStatus>;
970
1028
  list: (options: RunsListOptions) => Promise<PlayRunListItem[]>;
971
1029
  tail: (runId: string, options?: RunsTailOptions) => Promise<PlayStatus>;
972
1030
  logs: (runId: string, options?: RunsLogsOptions) => Promise<RunsLogsResult>;
@@ -1107,7 +1165,7 @@ declare class DeeplineClient {
1107
1165
  * artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
1108
1166
  * });
1109
1167
  * ```
1110
- */
1168
+ */
1111
1169
  startPlayRun(request: StartPlayRunRequest): Promise<PlayRunStart>;
1112
1170
  startPlayRunStream(request: StartPlayRunRequest, options?: {
1113
1171
  signal?: AbortSignal;
@@ -1293,6 +1351,7 @@ declare class DeeplineClient {
1293
1351
  */
1294
1352
  getPlayStatus(workflowId: string, options?: {
1295
1353
  billing?: boolean;
1354
+ full?: boolean;
1296
1355
  }): Promise<PlayStatus>;
1297
1356
  /**
1298
1357
  * Stream semantic play-run events using the same SSE feed as the dashboard.
@@ -1354,7 +1413,9 @@ declare class DeeplineClient {
1354
1413
  * deepline runs get <run-id> --json
1355
1414
  * ```
1356
1415
  */
1357
- getRunStatus(runId: string): Promise<PlayStatus>;
1416
+ getRunStatus(runId: string, options?: {
1417
+ full?: boolean;
1418
+ }): Promise<PlayStatus>;
1358
1419
  /**
1359
1420
  * List play runs using the public runs resource model.
1360
1421
  *
@@ -1541,8 +1602,8 @@ declare class DeeplineClient {
1541
1602
  }>;
1542
1603
  }
1543
1604
 
1544
- declare const SDK_VERSION = "0.1.51";
1545
- declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1605
+ declare const SDK_VERSION: string;
1606
+ declare const SDK_API_CONTRACT: string;
1546
1607
 
1547
1608
  /**
1548
1609
  * Base error class for all Deepline SDK errors.
package/dist/index.js CHANGED
@@ -214,9 +214,20 @@ function resolveConfig(options) {
214
214
  };
215
215
  }
216
216
 
217
+ // src/release.ts
218
+ var SDK_RELEASE = {
219
+ version: "0.1.53",
220
+ apiContract: "2026-05-run-response-package",
221
+ supportPolicy: {
222
+ latest: "0.1.53",
223
+ minimumSupported: "0.1.53",
224
+ deprecatedBelow: "0.1.53"
225
+ }
226
+ };
227
+
217
228
  // src/version.ts
218
- var SDK_VERSION = "0.1.51";
219
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
229
+ var SDK_VERSION = SDK_RELEASE.version;
230
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
220
231
 
221
232
  // ../shared_libs/play-runtime/coordinator-headers.ts
222
233
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -544,15 +555,38 @@ function isTransientCompileManifestError(error) {
544
555
  function isRecord(value) {
545
556
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
546
557
  }
558
+ function isPlayRunPackage(value) {
559
+ return Boolean(
560
+ value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
561
+ );
562
+ }
547
563
  function normalizePlayStatus(raw) {
548
- const status = typeof raw.status === "string" ? raw.status : "running";
549
- const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : "";
564
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
565
+ const packageRun = runPackage?.run;
566
+ const status = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : "running";
567
+ const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
550
568
  return {
551
569
  ...raw,
552
570
  runId,
571
+ ...runPackage ? { package: runPackage, outputs: runPackage.outputs } : {},
553
572
  status
554
573
  };
555
574
  }
575
+ function normalizePlayRunStart(raw) {
576
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
577
+ if (!runPackage) {
578
+ return raw;
579
+ }
580
+ const status = typeof runPackage.run.status === "string" ? runPackage.run.status : "running";
581
+ return {
582
+ workflowId: runPackage.run.id,
583
+ name: runPackage.run.playName,
584
+ status,
585
+ ...runPackage.run.dashboardUrl ? { dashboardUrl: runPackage.run.dashboardUrl } : {},
586
+ ...TERMINAL_PLAY_STATUSES.has(status) ? { finalStatus: runPackage } : {},
587
+ package: runPackage
588
+ };
589
+ }
556
590
  function decodeBase64Bytes(value) {
557
591
  const binary = atob(value);
558
592
  const bytes = new Uint8Array(binary.length);
@@ -582,25 +616,31 @@ function updatePlayLiveStatusState(state, event) {
582
616
  if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
583
617
  return null;
584
618
  }
585
- const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
586
- const status = normalizeLiveStatus(payload.status) ?? state.status;
587
- const logs = readStringArray(payload.logs);
588
- if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
619
+ const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
620
+ const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
621
+ const progressPayload = isRecord(payload.progress) ? payload.progress : {};
622
+ const payloadLogs = readStringArray(payload.logs);
623
+ const progressLogs = readStringArray(progressPayload.logs);
624
+ const logs = payloadLogs.length > 0 ? payloadLogs : progressLogs;
625
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status" && !isPlayRunPackage(payload)) {
589
626
  state.logs = logs;
590
627
  }
591
628
  if ("result" in payload) {
592
629
  state.result = payload.result;
630
+ } else if (isPlayRunPackage(payload)) {
631
+ state.result = payload;
593
632
  }
594
633
  if (typeof payload.error === "string" && payload.error.trim()) {
595
634
  state.error = payload.error;
596
635
  }
597
636
  state.runId = runId;
598
637
  state.status = status;
599
- const progressRecord = payload.progress && typeof payload.progress === "object" && !Array.isArray(payload.progress) ? payload.progress : {};
638
+ const progressRecord = progressPayload;
600
639
  const next = {
601
640
  ...payload,
602
641
  runId,
603
642
  status,
643
+ ...isPlayRunPackage(payload) ? { package: payload, outputs: payload.outputs } : {},
604
644
  progress: {
605
645
  ...progressRecord,
606
646
  status: typeof progressRecord.status === "string" ? progressRecord.status : status,
@@ -616,7 +656,8 @@ function playRunResultFromStatus(status, startedAt, fallbackRunId) {
616
656
  return {
617
657
  success: status.status === "completed",
618
658
  runId: status.runId || fallbackRunId,
619
- result: status.result,
659
+ result: status.package ?? status.result,
660
+ ...status.package ? { package: status.package } : {},
620
661
  logs: status.progress?.logs ?? [],
621
662
  durationMs: Date.now() - startedAt,
622
663
  error: status.progress?.error ?? (status.status !== "completed" ? status.status : void 0)
@@ -646,7 +687,7 @@ var DeeplineClient = class {
646
687
  this.config = resolveConfig(options);
647
688
  this.http = new HttpClient(this.config);
648
689
  this.runs = {
649
- get: (runId) => this.getRunStatus(runId),
690
+ get: (runId, options2) => this.getRunStatus(runId, options2),
650
691
  list: (options2) => this.listRuns(options2),
651
692
  tail: (runId, options2) => this.tailRun(runId, options2),
652
693
  logs: (runId, options2) => this.getRunLogs(runId, options2),
@@ -865,9 +906,9 @@ var DeeplineClient = class {
865
906
  * artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
866
907
  * });
867
908
  * ```
868
- */
909
+ */
869
910
  async startPlayRun(request) {
870
- return this.http.post("/api/v2/plays/run", {
911
+ const response = await this.http.post("/api/v2/plays/run", {
871
912
  ...request.name ? { name: request.name } : {},
872
913
  ...request.revisionId ? { revisionId: request.revisionId } : {},
873
914
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
@@ -890,6 +931,7 @@ var DeeplineClient = class {
890
931
  // different profile pass `request.profile` explicitly.
891
932
  ...request.profile ? { profile: request.profile } : {}
892
933
  });
934
+ return normalizePlayRunStart(response);
893
935
  }
894
936
  async *startPlayRunStream(request, options) {
895
937
  const body = {
@@ -1173,6 +1215,9 @@ var DeeplineClient = class {
1173
1215
  if (options?.billing === false) {
1174
1216
  params.set("billing", "false");
1175
1217
  }
1218
+ if (options?.full === true) {
1219
+ params.set("full", "true");
1220
+ }
1176
1221
  const query = params.size > 0 ? `?${params.toString()}` : "";
1177
1222
  const response = await this.http.get(
1178
1223
  `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
@@ -1261,9 +1306,14 @@ var DeeplineClient = class {
1261
1306
  * deepline runs get <run-id> --json
1262
1307
  * ```
1263
1308
  */
1264
- async getRunStatus(runId) {
1309
+ async getRunStatus(runId, options) {
1310
+ const params = new URLSearchParams();
1311
+ if (options?.full === true) {
1312
+ params.set("full", "true");
1313
+ }
1314
+ const query = params.size > 0 ? `?${params.toString()}` : "";
1265
1315
  const response = await this.http.get(
1266
- `/api/v2/runs/${encodeURIComponent(runId)}`
1316
+ `/api/v2/runs/${encodeURIComponent(runId)}${query}`
1267
1317
  );
1268
1318
  return normalizePlayStatus(response);
1269
1319
  }
@@ -2180,6 +2230,9 @@ var DeeplinePlayJobImpl = class {
2180
2230
  status.progress?.error || `Play run ${this.id} ended with ${status.status}.`
2181
2231
  );
2182
2232
  }
2233
+ if (status.package) {
2234
+ return status.package;
2235
+ }
2183
2236
  const payload = status.result;
2184
2237
  return (payload && "output" in payload ? payload.output : status.result) ?? null;
2185
2238
  }
package/dist/index.mjs CHANGED
@@ -168,9 +168,20 @@ function resolveConfig(options) {
168
168
  };
169
169
  }
170
170
 
171
+ // src/release.ts
172
+ var SDK_RELEASE = {
173
+ version: "0.1.53",
174
+ apiContract: "2026-05-run-response-package",
175
+ supportPolicy: {
176
+ latest: "0.1.53",
177
+ minimumSupported: "0.1.53",
178
+ deprecatedBelow: "0.1.53"
179
+ }
180
+ };
181
+
171
182
  // src/version.ts
172
- var SDK_VERSION = "0.1.51";
173
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
183
+ var SDK_VERSION = SDK_RELEASE.version;
184
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
174
185
 
175
186
  // ../shared_libs/play-runtime/coordinator-headers.ts
176
187
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -498,15 +509,38 @@ function isTransientCompileManifestError(error) {
498
509
  function isRecord(value) {
499
510
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
500
511
  }
512
+ function isPlayRunPackage(value) {
513
+ return Boolean(
514
+ value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
515
+ );
516
+ }
501
517
  function normalizePlayStatus(raw) {
502
- const status = typeof raw.status === "string" ? raw.status : "running";
503
- const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : "";
518
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
519
+ const packageRun = runPackage?.run;
520
+ const status = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : "running";
521
+ const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
504
522
  return {
505
523
  ...raw,
506
524
  runId,
525
+ ...runPackage ? { package: runPackage, outputs: runPackage.outputs } : {},
507
526
  status
508
527
  };
509
528
  }
529
+ function normalizePlayRunStart(raw) {
530
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
531
+ if (!runPackage) {
532
+ return raw;
533
+ }
534
+ const status = typeof runPackage.run.status === "string" ? runPackage.run.status : "running";
535
+ return {
536
+ workflowId: runPackage.run.id,
537
+ name: runPackage.run.playName,
538
+ status,
539
+ ...runPackage.run.dashboardUrl ? { dashboardUrl: runPackage.run.dashboardUrl } : {},
540
+ ...TERMINAL_PLAY_STATUSES.has(status) ? { finalStatus: runPackage } : {},
541
+ package: runPackage
542
+ };
543
+ }
510
544
  function decodeBase64Bytes(value) {
511
545
  const binary = atob(value);
512
546
  const bytes = new Uint8Array(binary.length);
@@ -536,25 +570,31 @@ function updatePlayLiveStatusState(state, event) {
536
570
  if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
537
571
  return null;
538
572
  }
539
- const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
540
- const status = normalizeLiveStatus(payload.status) ?? state.status;
541
- const logs = readStringArray(payload.logs);
542
- if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
573
+ const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
574
+ const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
575
+ const progressPayload = isRecord(payload.progress) ? payload.progress : {};
576
+ const payloadLogs = readStringArray(payload.logs);
577
+ const progressLogs = readStringArray(progressPayload.logs);
578
+ const logs = payloadLogs.length > 0 ? payloadLogs : progressLogs;
579
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status" && !isPlayRunPackage(payload)) {
543
580
  state.logs = logs;
544
581
  }
545
582
  if ("result" in payload) {
546
583
  state.result = payload.result;
584
+ } else if (isPlayRunPackage(payload)) {
585
+ state.result = payload;
547
586
  }
548
587
  if (typeof payload.error === "string" && payload.error.trim()) {
549
588
  state.error = payload.error;
550
589
  }
551
590
  state.runId = runId;
552
591
  state.status = status;
553
- const progressRecord = payload.progress && typeof payload.progress === "object" && !Array.isArray(payload.progress) ? payload.progress : {};
592
+ const progressRecord = progressPayload;
554
593
  const next = {
555
594
  ...payload,
556
595
  runId,
557
596
  status,
597
+ ...isPlayRunPackage(payload) ? { package: payload, outputs: payload.outputs } : {},
558
598
  progress: {
559
599
  ...progressRecord,
560
600
  status: typeof progressRecord.status === "string" ? progressRecord.status : status,
@@ -570,7 +610,8 @@ function playRunResultFromStatus(status, startedAt, fallbackRunId) {
570
610
  return {
571
611
  success: status.status === "completed",
572
612
  runId: status.runId || fallbackRunId,
573
- result: status.result,
613
+ result: status.package ?? status.result,
614
+ ...status.package ? { package: status.package } : {},
574
615
  logs: status.progress?.logs ?? [],
575
616
  durationMs: Date.now() - startedAt,
576
617
  error: status.progress?.error ?? (status.status !== "completed" ? status.status : void 0)
@@ -600,7 +641,7 @@ var DeeplineClient = class {
600
641
  this.config = resolveConfig(options);
601
642
  this.http = new HttpClient(this.config);
602
643
  this.runs = {
603
- get: (runId) => this.getRunStatus(runId),
644
+ get: (runId, options2) => this.getRunStatus(runId, options2),
604
645
  list: (options2) => this.listRuns(options2),
605
646
  tail: (runId, options2) => this.tailRun(runId, options2),
606
647
  logs: (runId, options2) => this.getRunLogs(runId, options2),
@@ -819,9 +860,9 @@ var DeeplineClient = class {
819
860
  * artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
820
861
  * });
821
862
  * ```
822
- */
863
+ */
823
864
  async startPlayRun(request) {
824
- return this.http.post("/api/v2/plays/run", {
865
+ const response = await this.http.post("/api/v2/plays/run", {
825
866
  ...request.name ? { name: request.name } : {},
826
867
  ...request.revisionId ? { revisionId: request.revisionId } : {},
827
868
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
@@ -844,6 +885,7 @@ var DeeplineClient = class {
844
885
  // different profile pass `request.profile` explicitly.
845
886
  ...request.profile ? { profile: request.profile } : {}
846
887
  });
888
+ return normalizePlayRunStart(response);
847
889
  }
848
890
  async *startPlayRunStream(request, options) {
849
891
  const body = {
@@ -1127,6 +1169,9 @@ var DeeplineClient = class {
1127
1169
  if (options?.billing === false) {
1128
1170
  params.set("billing", "false");
1129
1171
  }
1172
+ if (options?.full === true) {
1173
+ params.set("full", "true");
1174
+ }
1130
1175
  const query = params.size > 0 ? `?${params.toString()}` : "";
1131
1176
  const response = await this.http.get(
1132
1177
  `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
@@ -1215,9 +1260,14 @@ var DeeplineClient = class {
1215
1260
  * deepline runs get <run-id> --json
1216
1261
  * ```
1217
1262
  */
1218
- async getRunStatus(runId) {
1263
+ async getRunStatus(runId, options) {
1264
+ const params = new URLSearchParams();
1265
+ if (options?.full === true) {
1266
+ params.set("full", "true");
1267
+ }
1268
+ const query = params.size > 0 ? `?${params.toString()}` : "";
1219
1269
  const response = await this.http.get(
1220
- `/api/v2/runs/${encodeURIComponent(runId)}`
1270
+ `/api/v2/runs/${encodeURIComponent(runId)}${query}`
1221
1271
  );
1222
1272
  return normalizePlayStatus(response);
1223
1273
  }
@@ -2134,6 +2184,9 @@ var DeeplinePlayJobImpl = class {
2134
2184
  status.progress?.error || `Play run ${this.id} ended with ${status.status}.`
2135
2185
  );
2136
2186
  }
2187
+ if (status.package) {
2188
+ return status.package;
2189
+ }
2137
2190
  const payload = status.result;
2138
2191
  return (payload && "output" in payload ? payload.output : status.result) ?? null;
2139
2192
  }