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/cli/index.js CHANGED
@@ -218,9 +218,20 @@ function resolveConfig(options) {
218
218
  };
219
219
  }
220
220
 
221
+ // src/release.ts
222
+ var SDK_RELEASE = {
223
+ version: "0.1.53",
224
+ apiContract: "2026-05-run-response-package",
225
+ supportPolicy: {
226
+ latest: "0.1.53",
227
+ minimumSupported: "0.1.53",
228
+ deprecatedBelow: "0.1.53"
229
+ }
230
+ };
231
+
221
232
  // src/version.ts
222
- var SDK_VERSION = "0.1.51";
223
- var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
233
+ var SDK_VERSION = SDK_RELEASE.version;
234
+ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
224
235
 
225
236
  // ../shared_libs/play-runtime/coordinator-headers.ts
226
237
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -548,15 +559,38 @@ function isTransientCompileManifestError(error) {
548
559
  function isRecord(value) {
549
560
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
550
561
  }
562
+ function isPlayRunPackage(value) {
563
+ return Boolean(
564
+ value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
565
+ );
566
+ }
551
567
  function normalizePlayStatus(raw) {
552
- const status = typeof raw.status === "string" ? raw.status : "running";
553
- const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : "";
568
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
569
+ const packageRun = runPackage?.run;
570
+ const status = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : "running";
571
+ const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
554
572
  return {
555
573
  ...raw,
556
574
  runId,
575
+ ...runPackage ? { package: runPackage, outputs: runPackage.outputs } : {},
557
576
  status
558
577
  };
559
578
  }
579
+ function normalizePlayRunStart(raw) {
580
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
581
+ if (!runPackage) {
582
+ return raw;
583
+ }
584
+ const status = typeof runPackage.run.status === "string" ? runPackage.run.status : "running";
585
+ return {
586
+ workflowId: runPackage.run.id,
587
+ name: runPackage.run.playName,
588
+ status,
589
+ ...runPackage.run.dashboardUrl ? { dashboardUrl: runPackage.run.dashboardUrl } : {},
590
+ ...TERMINAL_PLAY_STATUSES.has(status) ? { finalStatus: runPackage } : {},
591
+ package: runPackage
592
+ };
593
+ }
560
594
  function decodeBase64Bytes(value) {
561
595
  const binary = atob(value);
562
596
  const bytes = new Uint8Array(binary.length);
@@ -586,25 +620,31 @@ function updatePlayLiveStatusState(state, event) {
586
620
  if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
587
621
  return null;
588
622
  }
589
- const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
590
- const status = normalizeLiveStatus(payload.status) ?? state.status;
591
- const logs = readStringArray(payload.logs);
592
- if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
623
+ const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
624
+ const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
625
+ const progressPayload = isRecord(payload.progress) ? payload.progress : {};
626
+ const payloadLogs = readStringArray(payload.logs);
627
+ const progressLogs = readStringArray(progressPayload.logs);
628
+ const logs = payloadLogs.length > 0 ? payloadLogs : progressLogs;
629
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status" && !isPlayRunPackage(payload)) {
593
630
  state.logs = logs;
594
631
  }
595
632
  if ("result" in payload) {
596
633
  state.result = payload.result;
634
+ } else if (isPlayRunPackage(payload)) {
635
+ state.result = payload;
597
636
  }
598
637
  if (typeof payload.error === "string" && payload.error.trim()) {
599
638
  state.error = payload.error;
600
639
  }
601
640
  state.runId = runId;
602
641
  state.status = status;
603
- const progressRecord = payload.progress && typeof payload.progress === "object" && !Array.isArray(payload.progress) ? payload.progress : {};
642
+ const progressRecord = progressPayload;
604
643
  const next = {
605
644
  ...payload,
606
645
  runId,
607
646
  status,
647
+ ...isPlayRunPackage(payload) ? { package: payload, outputs: payload.outputs } : {},
608
648
  progress: {
609
649
  ...progressRecord,
610
650
  status: typeof progressRecord.status === "string" ? progressRecord.status : status,
@@ -620,7 +660,8 @@ function playRunResultFromStatus(status, startedAt, fallbackRunId) {
620
660
  return {
621
661
  success: status.status === "completed",
622
662
  runId: status.runId || fallbackRunId,
623
- result: status.result,
663
+ result: status.package ?? status.result,
664
+ ...status.package ? { package: status.package } : {},
624
665
  logs: status.progress?.logs ?? [],
625
666
  durationMs: Date.now() - startedAt,
626
667
  error: status.progress?.error ?? (status.status !== "completed" ? status.status : void 0)
@@ -650,7 +691,7 @@ var DeeplineClient = class {
650
691
  this.config = resolveConfig(options);
651
692
  this.http = new HttpClient(this.config);
652
693
  this.runs = {
653
- get: (runId) => this.getRunStatus(runId),
694
+ get: (runId, options2) => this.getRunStatus(runId, options2),
654
695
  list: (options2) => this.listRuns(options2),
655
696
  tail: (runId, options2) => this.tailRun(runId, options2),
656
697
  logs: (runId, options2) => this.getRunLogs(runId, options2),
@@ -869,9 +910,9 @@ var DeeplineClient = class {
869
910
  * artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
870
911
  * });
871
912
  * ```
872
- */
913
+ */
873
914
  async startPlayRun(request) {
874
- return this.http.post("/api/v2/plays/run", {
915
+ const response = await this.http.post("/api/v2/plays/run", {
875
916
  ...request.name ? { name: request.name } : {},
876
917
  ...request.revisionId ? { revisionId: request.revisionId } : {},
877
918
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
@@ -894,6 +935,7 @@ var DeeplineClient = class {
894
935
  // different profile pass `request.profile` explicitly.
895
936
  ...request.profile ? { profile: request.profile } : {}
896
937
  });
938
+ return normalizePlayRunStart(response);
897
939
  }
898
940
  async *startPlayRunStream(request, options) {
899
941
  const body = {
@@ -1177,6 +1219,9 @@ var DeeplineClient = class {
1177
1219
  if (options?.billing === false) {
1178
1220
  params.set("billing", "false");
1179
1221
  }
1222
+ if (options?.full === true) {
1223
+ params.set("full", "true");
1224
+ }
1180
1225
  const query = params.size > 0 ? `?${params.toString()}` : "";
1181
1226
  const response = await this.http.get(
1182
1227
  `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
@@ -1265,9 +1310,14 @@ var DeeplineClient = class {
1265
1310
  * deepline runs get <run-id> --json
1266
1311
  * ```
1267
1312
  */
1268
- async getRunStatus(runId) {
1313
+ async getRunStatus(runId, options) {
1314
+ const params = new URLSearchParams();
1315
+ if (options?.full === true) {
1316
+ params.set("full", "true");
1317
+ }
1318
+ const query = params.size > 0 ? `?${params.toString()}` : "";
1269
1319
  const response = await this.http.get(
1270
- `/api/v2/runs/${encodeURIComponent(runId)}`
1320
+ `/api/v2/runs/${encodeURIComponent(runId)}${query}`
1271
1321
  );
1272
1322
  return normalizePlayStatus(response);
1273
1323
  }
@@ -5569,6 +5619,17 @@ async function traceCliSpan(phase, fields, run) {
5569
5619
  }
5570
5620
 
5571
5621
  // src/cli/commands/play.ts
5622
+ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
5623
+ "--json",
5624
+ "--wait",
5625
+ "--tail",
5626
+ "--watch",
5627
+ "--no-wait",
5628
+ "--logs",
5629
+ "--full",
5630
+ "--force",
5631
+ "--no-open"
5632
+ ]);
5572
5633
  function traceCliSync(phase, fields, run) {
5573
5634
  const startedAt = Date.now();
5574
5635
  try {
@@ -6087,25 +6148,46 @@ var PLAY_START_TRANSIENT_RETRY_DELAYS_MS = [500, 1500];
6087
6148
  function getEventPayload(event) {
6088
6149
  return event.payload && typeof event.payload === "object" ? event.payload : {};
6089
6150
  }
6151
+ function playStatusValue(value) {
6152
+ return value === "queued" || value === "running" || value === "waiting" || value === "completed" || value === "failed" || value === "cancelled" ? value : null;
6153
+ }
6154
+ function getRunRecordFromPackage(value) {
6155
+ if (!isPlayRunPackageValue(value)) {
6156
+ return null;
6157
+ }
6158
+ const run = value.run;
6159
+ return run && typeof run === "object" && !Array.isArray(run) ? run : null;
6160
+ }
6161
+ function getRunIdFromLiveEvent(event) {
6162
+ const payload = getEventPayload(event);
6163
+ const directRunId = payload.runId;
6164
+ if (typeof directRunId === "string" && directRunId.trim()) {
6165
+ return directRunId;
6166
+ }
6167
+ const packageRunId = getRunRecordFromPackage(payload)?.id;
6168
+ return typeof packageRunId === "string" && packageRunId.trim() ? packageRunId : null;
6169
+ }
6090
6170
  function getStatusFromLiveEvent(event) {
6091
6171
  if (event.type !== "play.run.status" && event.type !== "play.run.snapshot" && event.type !== "play.run.final_status") {
6092
6172
  return null;
6093
6173
  }
6094
- const status = getEventPayload(event).status;
6095
- return status === "queued" || status === "running" || status === "waiting" || status === "completed" || status === "failed" || status === "cancelled" ? status : null;
6174
+ const payload = getEventPayload(event);
6175
+ return playStatusValue(payload.status) ?? playStatusValue(getRunRecordFromPackage(payload)?.status);
6096
6176
  }
6097
6177
  function getFinalStatusFromLiveEvent(event) {
6098
6178
  if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
6099
6179
  return null;
6100
6180
  }
6101
6181
  const payload = getEventPayload(event);
6102
- const status = payload.status;
6182
+ const packageRun = getRunRecordFromPackage(payload);
6183
+ const status = playStatusValue(payload.status) ?? playStatusValue(packageRun?.status);
6103
6184
  if (status !== "completed" && status !== "failed" && status !== "cancelled") {
6104
6185
  return null;
6105
6186
  }
6187
+ const runId = typeof payload.runId === "string" ? payload.runId : typeof packageRun?.id === "string" ? packageRun.id : "";
6106
6188
  return {
6107
6189
  ...payload,
6108
- runId: typeof payload.runId === "string" ? payload.runId : "",
6190
+ runId,
6109
6191
  status
6110
6192
  };
6111
6193
  }
@@ -6123,7 +6205,8 @@ function describeLiveEventPhase(event) {
6123
6205
  if (status === "running") {
6124
6206
  return null;
6125
6207
  }
6126
- const runId = typeof payload.runId === "string" && payload.runId ? ` ${payload.runId}` : "";
6208
+ const eventRunId = getRunIdFromLiveEvent(event);
6209
+ const runId = eventRunId ? ` ${eventRunId}` : "";
6127
6210
  return status ? `${status}${runId}` : null;
6128
6211
  }
6129
6212
  if (event.type === "play.step.status" || event.type === "play.step.progress") {
@@ -6372,7 +6455,7 @@ async function startAndWaitForPlayCompletionByStreamOnce(input) {
6372
6455
  signal: controller.signal
6373
6456
  })) {
6374
6457
  eventCount += 1;
6375
- const eventRunId = getEventPayload(event).runId;
6458
+ const eventRunId = getRunIdFromLiveEvent(event);
6376
6459
  if (typeof eventRunId === "string" && eventRunId && eventRunId !== "pending") {
6377
6460
  lastKnownWorkflowId = eventRunId;
6378
6461
  firstRunIdMs ??= Date.now() - startedAt;
@@ -6969,16 +7052,27 @@ function stripProviderSpendFromBilling(value) {
6969
7052
  }
6970
7053
  return next;
6971
7054
  }
7055
+ function isPlayRunPackageValue(value) {
7056
+ return Boolean(
7057
+ value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run.id === "string"
7058
+ );
7059
+ }
7060
+ function getPlayRunPackage(status) {
7061
+ const direct = status;
7062
+ if (isPlayRunPackageValue(direct)) {
7063
+ return direct;
7064
+ }
7065
+ const packaged = status.package;
7066
+ return isPlayRunPackageValue(packaged) ? packaged : null;
7067
+ }
6972
7068
  function compactPlayStatus(status) {
7069
+ const packaged = getPlayRunPackage(status);
7070
+ if (packaged) {
7071
+ return packaged;
7072
+ }
6973
7073
  const rowsInfo = extractCanonicalRowsInfo(status);
6974
7074
  const result = status && typeof status === "object" ? status.result : null;
6975
7075
  const warnings = buildRunWarnings(status, rowsInfo);
6976
- const datasetStats = rowsInfo && rowsInfo.complete ? buildDatasetStats(
6977
- rowsInfo.rows,
6978
- rowsInfo.totalRows,
6979
- rowsInfo.columns,
6980
- extractDatasetExecutionStats(status)
6981
- ) : null;
6982
7076
  const billing = status && typeof status === "object" ? stripProviderSpendFromBilling(
6983
7077
  status.billing
6984
7078
  ) : null;
@@ -7000,8 +7094,6 @@ function compactPlayStatus(status) {
7000
7094
  ...displayError ? { error: displayError } : {},
7001
7095
  ...warnings.length > 0 ? { warnings } : {},
7002
7096
  ...result !== void 0 ? { result } : {},
7003
- ...status.resultView ? { resultView: status.resultView } : {},
7004
- ...datasetStats ? { dataset_stats: datasetStats } : {},
7005
7097
  ...billing ? { billing } : {},
7006
7098
  next: buildRunNextCommands(status)
7007
7099
  };
@@ -7021,51 +7113,87 @@ function enrichPlayStatusWithDatasetStats(status) {
7021
7113
  )
7022
7114
  };
7023
7115
  }
7024
- function formatDatasetStatsLines(datasetStats) {
7025
- if (!datasetStats) {
7026
- return [];
7116
+ function readRunPackageRun(packaged) {
7117
+ return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
7118
+ }
7119
+ function readRecordArray(value) {
7120
+ return Array.isArray(value) ? value.filter(
7121
+ (item) => item !== null && typeof item === "object" && !Array.isArray(item)
7122
+ ) : [];
7123
+ }
7124
+ function actionToCommand(action) {
7125
+ if (!action || typeof action !== "object" || Array.isArray(action)) {
7126
+ return null;
7027
7127
  }
7028
- const lines = [" column stats:"];
7029
- for (const [column, stat3] of Object.entries(datasetStats.columnStats).slice(
7030
- 0,
7031
- 12
7032
- )) {
7033
- const topValues = stat3.top_values ? `, top_values=${Object.entries(stat3.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
7034
- const sample = stat3.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat3.sample_value)}` : "";
7035
- const execution = stat3.execution ? `, execution=${Object.entries(stat3.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
7036
- lines.push(
7037
- ` ${column}: non_empty=${stat3.non_empty}, unique=${stat3.unique}${topValues}${sample}${execution}`
7038
- );
7128
+ const record = action;
7129
+ if (record.kind === "deepline_run_inspect" && typeof record.runId === "string") {
7130
+ return `deepline runs get ${record.runId} --json`;
7039
7131
  }
7040
- return lines;
7132
+ if (record.kind === "deepline_run_export" && typeof record.runId === "string" && typeof record.datasetPath === "string") {
7133
+ return `deepline runs export ${record.runId} --dataset ${shellSingleQuote(
7134
+ record.datasetPath
7135
+ )} --out ${shellSingleQuote(`${record.datasetPath.split(".").pop() || "dataset"}.csv`)}`;
7136
+ }
7137
+ if (record.kind === "deepline_db_query" && typeof record.sql === "string") {
7138
+ const maxRows = typeof record.maxRows === "number" && Number.isFinite(record.maxRows) ? Math.trunc(record.maxRows) : 20;
7139
+ return `deepline db query --sql ${shellSingleQuote(record.sql)} --max-rows ${maxRows} --json`;
7140
+ }
7141
+ return null;
7041
7142
  }
7042
- function buildJsonRunResultRenderLines(status) {
7043
- const publicStatus = status.status ?? "running";
7044
- const runId = status.runId ?? "unknown";
7045
- const lines = [`${publicStatus} ${runId}`];
7046
- const progressError = status.progress?.error;
7047
- if (typeof progressError === "string") {
7048
- const billing = extractBillingForStatus(status, progressError);
7049
- if (isInsufficientCreditsBilling(billing)) {
7050
- lines.push(...buildInsufficientCreditsSummaryLines({ status, billing }));
7143
+ function readFirstDatasetActions(packaged) {
7144
+ for (const step of readRecordArray(packaged.steps)) {
7145
+ const output = step.output && typeof step.output === "object" && !Array.isArray(step.output) ? step.output : null;
7146
+ const actions = output?.actions && typeof output.actions === "object" && !Array.isArray(output.actions) ? output.actions : null;
7147
+ if (actions) {
7148
+ return actions;
7051
7149
  }
7052
7150
  }
7151
+ return {};
7152
+ }
7153
+ function buildRunPackageTextLines(packaged) {
7154
+ const run = readRunPackageRun(packaged);
7155
+ const runId = typeof run.id === "string" ? run.id : "unknown";
7156
+ const status = typeof run.status === "string" ? run.status : "unknown";
7157
+ const playName = typeof run.playName === "string" ? run.playName : null;
7158
+ const lines = [`${status === "completed" ? "\u2713" : status === "failed" ? "\u2717" : "\u2022"} ${status} ${runId}`];
7159
+ if (playName) {
7160
+ lines.push(` play: ${playName}`);
7161
+ }
7162
+ for (const step of readRecordArray(packaged.steps).slice(0, 8)) {
7163
+ const id = typeof step.id === "string" ? step.id : "step";
7164
+ const kind = typeof step.kind === "string" ? step.kind : "step";
7165
+ const stepStatus = typeof step.status === "string" ? step.status : status;
7166
+ const output = step.output && typeof step.output === "object" && !Array.isArray(step.output) ? step.output : null;
7167
+ const rowCount = output && typeof output.rowCount === "number" ? ` rows=${formatInteger(output.rowCount)}` : "";
7168
+ const preview = output?.preview && typeof output.preview === "object" && !Array.isArray(output.preview) ? output.preview : null;
7169
+ const previewRows = Array.isArray(preview?.rows) ? preview.rows.length : null;
7170
+ const previewLabel = previewRows !== null ? ` preview=${previewRows}${preview?.truncated ? " truncated" : ""}` : "";
7171
+ lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}${previewLabel}`);
7172
+ }
7173
+ const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
7174
+ const datasetActions = readFirstDatasetActions(packaged);
7175
+ const inspectCommand = actionToCommand(next.inspect);
7176
+ const queryCommand = actionToCommand(next.query) ?? actionToCommand(datasetActions.query);
7177
+ const exportCommand = actionToCommand(next.export) ?? actionToCommand(datasetActions.exportCsv);
7178
+ if (inspectCommand) lines.push(` inspect: ${inspectCommand}`);
7179
+ if (queryCommand) lines.push(` query: ${queryCommand}`);
7180
+ if (exportCommand) lines.push(` export CSV: ${exportCommand}`);
7053
7181
  return lines;
7054
7182
  }
7055
7183
  function writePlayResult(status, jsonOutput, options) {
7184
+ const packaged = getPlayRunPackage(status);
7056
7185
  if (jsonOutput) {
7057
- const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
7058
- printCommandEnvelope({
7059
- ...payload2,
7060
- render: {
7061
- sections: [
7062
- {
7063
- title: "run result",
7064
- lines: buildJsonRunResultRenderLines(status)
7065
- }
7066
- ]
7067
- }
7068
- }, { json: true });
7186
+ const payload2 = options?.fullJson ? status : compactPlayStatus(status);
7187
+ printCommandEnvelope(payload2, { json: true });
7188
+ return;
7189
+ }
7190
+ if (packaged && !options?.fullJson) {
7191
+ const lines2 = buildRunPackageTextLines(packaged);
7192
+ printCommandEnvelope(packaged, {
7193
+ json: false,
7194
+ text: `${lines2.join("\n")}
7195
+ `
7196
+ });
7069
7197
  return;
7070
7198
  }
7071
7199
  const result = status.result;
@@ -7076,16 +7204,9 @@ function writePlayResult(status, jsonOutput, options) {
7076
7204
  lines.push(`${success ? "\u2713" : "\u2717"} ${publicStatus} ${runId}`);
7077
7205
  const rowsInfo = extractCanonicalRowsInfo(status);
7078
7206
  const warnings = buildRunWarnings(status, rowsInfo);
7079
- const datasetStats = rowsInfo && rowsInfo.complete ? buildDatasetStats(
7080
- rowsInfo.rows,
7081
- rowsInfo.totalRows,
7082
- rowsInfo.columns,
7083
- extractDatasetExecutionStats(status)
7084
- ) : null;
7085
7207
  for (const warning of warnings) {
7086
7208
  lines.push(` warning: ${warning}`);
7087
7209
  }
7088
- lines.push(...formatDatasetStatsLines(datasetStats));
7089
7210
  const progressError = status.progress?.error;
7090
7211
  if (progressError && typeof progressError === "string") {
7091
7212
  const billing = extractBillingForStatus(status, progressError);
@@ -7113,6 +7234,21 @@ function writePlayResult(status, jsonOutput, options) {
7113
7234
  }, { json: jsonOutput, text: `${lines.join("\n")}
7114
7235
  ` });
7115
7236
  }
7237
+ async function resolvePlayRunOutputStatus(input) {
7238
+ if (!input.fullJson || !getPlayRunPackage(input.status)) {
7239
+ return input.status;
7240
+ }
7241
+ const runId = input.status.runId;
7242
+ if (!runId) {
7243
+ return input.status;
7244
+ }
7245
+ const fullStatus = await input.client.getPlayStatus(runId, {
7246
+ billing: false,
7247
+ full: true
7248
+ });
7249
+ const dashboardUrl = input.status.dashboardUrl;
7250
+ return typeof dashboardUrl === "string" ? { ...fullStatus, dashboardUrl } : fullStatus;
7251
+ }
7116
7252
  var RUN_EXPORT_PAGE_SIZE = 5e3;
7117
7253
  function shellSingleQuote(value) {
7118
7254
  return `'${value.replace(/'/g, `'\\''`)}'`;
@@ -7466,6 +7602,24 @@ function renderServerResultView(value) {
7466
7602
  return { lines: lines.length > 1 ? lines : [], actions: [] };
7467
7603
  }
7468
7604
  function writeStartedPlayRun(input) {
7605
+ if (input.package && isPlayRunPackageValue(input.package)) {
7606
+ if (input.jsonOutput) {
7607
+ printCommandEnvelope(input.package, { json: true });
7608
+ return;
7609
+ }
7610
+ const lines2 = buildRunPackageTextLines(input.package);
7611
+ const output2 = lines2.join("\n");
7612
+ if (input.progress) {
7613
+ input.progress.writeLine(output2, process.stdout);
7614
+ return;
7615
+ }
7616
+ printCommandEnvelope(input.package, {
7617
+ json: false,
7618
+ text: `${output2}
7619
+ `
7620
+ });
7621
+ return;
7622
+ }
7469
7623
  const payload = {
7470
7624
  runId: input.runId,
7471
7625
  workflowId: input.runId,
@@ -7511,7 +7665,7 @@ function writeStartedPlayRun(input) {
7511
7665
  ` });
7512
7666
  }
7513
7667
  function parsePlayRunOptions(args) {
7514
- const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--<input> value]\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.map guidance.";
7668
+ const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--full] [--<input> value]\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.map guidance.";
7515
7669
  let filePath = null;
7516
7670
  let playName = null;
7517
7671
  let input = null;
@@ -7519,6 +7673,7 @@ function parsePlayRunOptions(args) {
7519
7673
  let revisionSelector = null;
7520
7674
  const watch = !args.includes("--no-wait");
7521
7675
  let jsonOutput = watch ? args.includes("--json") : argsWantJson(args);
7676
+ const fullJson = args.includes("--full");
7522
7677
  const emitLogs = !jsonOutput || args.includes("--logs");
7523
7678
  const force = args.includes("--force");
7524
7679
  const noOpen = args.includes("--no-open");
@@ -7563,7 +7718,7 @@ function parsePlayRunOptions(args) {
7563
7718
  waitTimeoutMs = parsePositiveInteger2(args[++index], arg);
7564
7719
  continue;
7565
7720
  }
7566
- if (arg === "--json" || arg === "--wait" || arg === "--tail" || arg === "--watch" || arg === "--no-wait" || arg === "--logs" || arg === "--force" || arg === "--no-open") {
7721
+ if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
7567
7722
  if (arg === "--watch") {
7568
7723
  continue;
7569
7724
  }
@@ -7625,6 +7780,7 @@ function parsePlayRunOptions(args) {
7625
7780
  watch,
7626
7781
  emitLogs,
7627
7782
  jsonOutput,
7783
+ fullJson,
7628
7784
  waitTimeoutMs,
7629
7785
  force,
7630
7786
  noOpen
@@ -7936,10 +8092,17 @@ async function handleFileBackedRun(options) {
7936
8092
  } else {
7937
8093
  progress.fail();
7938
8094
  }
8095
+ const outputStatus = await resolvePlayRunOutputStatus({
8096
+ client,
8097
+ status: finalStatus,
8098
+ fullJson: options.fullJson
8099
+ });
7939
8100
  traceCliSync(
7940
8101
  "cli.play_write_result",
7941
8102
  { targetKind: "file", playName },
7942
- () => writePlayResult(finalStatus, options.jsonOutput)
8103
+ () => writePlayResult(outputStatus, options.jsonOutput, {
8104
+ fullJson: options.fullJson
8105
+ })
7943
8106
  );
7944
8107
  return finalStatus.status === "completed" ? 0 : 1;
7945
8108
  }
@@ -7964,6 +8127,7 @@ async function handleFileBackedRun(options) {
7964
8127
  playName,
7965
8128
  status: started.status,
7966
8129
  dashboardUrl: resolvedDashboardUrl,
8130
+ package: options.fullJson ? void 0 : started.package,
7967
8131
  jsonOutput: options.jsonOutput,
7968
8132
  progress
7969
8133
  });
@@ -8075,10 +8239,17 @@ async function handleNamedRun(options) {
8075
8239
  } else {
8076
8240
  progress.fail();
8077
8241
  }
8242
+ const outputStatus = await resolvePlayRunOutputStatus({
8243
+ client,
8244
+ status: finalStatus,
8245
+ fullJson: options.fullJson
8246
+ });
8078
8247
  traceCliSync(
8079
8248
  "cli.play_write_result",
8080
8249
  { targetKind: "name", playName },
8081
- () => writePlayResult(finalStatus, options.jsonOutput)
8250
+ () => writePlayResult(outputStatus, options.jsonOutput, {
8251
+ fullJson: options.fullJson
8252
+ })
8082
8253
  );
8083
8254
  return finalStatus.status === "completed" ? 0 : 1;
8084
8255
  }
@@ -8103,6 +8274,7 @@ async function handleNamedRun(options) {
8103
8274
  playName: started.name ?? playName,
8104
8275
  status: started.status,
8105
8276
  dashboardUrl: resolvedDashboardUrl,
8277
+ package: options.fullJson ? void 0 : started.package,
8106
8278
  jsonOutput: options.jsonOutput,
8107
8279
  progress
8108
8280
  });
@@ -8165,7 +8337,9 @@ async function handleRunGet(args) {
8165
8337
  return 1;
8166
8338
  }
8167
8339
  const client = new DeeplineClient();
8168
- const status = await client.runs.get(runId);
8340
+ const status = await client.runs.get(runId, {
8341
+ full: args.includes("--full")
8342
+ });
8169
8343
  writePlayResult(status, argsWantJson(args), {
8170
8344
  fullJson: args.includes("--full")
8171
8345
  });
@@ -8354,7 +8528,7 @@ async function handleRunExport(args) {
8354
8528
  return 1;
8355
8529
  }
8356
8530
  const client = new DeeplineClient();
8357
- const status = await client.getPlayStatus(runId);
8531
+ const status = await client.getPlayStatus(runId, { full: true });
8358
8532
  const exportResult = await exportPlayStatusRows(client, status, outPath, {
8359
8533
  datasetPath
8360
8534
  });
@@ -9074,7 +9248,7 @@ Examples:
9074
9248
  ).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
9075
9249
  "--logs",
9076
9250
  "When output is non-interactive, stream play logs to stderr while waiting"
9077
- ).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Supersede any active runs for this play").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").addHelpText(
9251
+ ).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Supersede any active runs for this play").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
9078
9252
  "afterAll",
9079
9253
  `
9080
9254
  Pass-through input flags:
@@ -9111,6 +9285,7 @@ Pass-through input flags:
9111
9285
  ...options.force ? ["--force"] : [],
9112
9286
  ...options.noOpen || options.open === false ? ["--no-open"] : [],
9113
9287
  ...options.json ? ["--json"] : [],
9288
+ ...options.full ? ["--full"] : [],
9114
9289
  ...passthroughArgs
9115
9290
  ]);
9116
9291
  });