deepline 0.1.52 → 0.1.54

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.
@@ -197,12 +197,12 @@ function resolveConfig(options) {
197
197
 
198
198
  // src/release.ts
199
199
  var SDK_RELEASE = {
200
- version: "0.1.52",
201
- apiContract: "2026-05-stripe-promo-checkout",
200
+ version: "0.1.54",
201
+ apiContract: "2026-05-run-response-package",
202
202
  supportPolicy: {
203
- latest: "0.1.52",
204
- minimumSupported: "0.1.40",
205
- deprecatedBelow: "0.1.40"
203
+ latest: "0.1.54",
204
+ minimumSupported: "0.1.53",
205
+ deprecatedBelow: "0.1.53"
206
206
  }
207
207
  };
208
208
 
@@ -536,15 +536,38 @@ function isTransientCompileManifestError(error) {
536
536
  function isRecord(value) {
537
537
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
538
538
  }
539
+ function isPlayRunPackage(value) {
540
+ return Boolean(
541
+ value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
542
+ );
543
+ }
539
544
  function normalizePlayStatus(raw) {
540
- const status = typeof raw.status === "string" ? raw.status : "running";
541
- const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : "";
545
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
546
+ const packageRun = runPackage?.run;
547
+ const status = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : "running";
548
+ const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
542
549
  return {
543
550
  ...raw,
544
551
  runId,
552
+ ...runPackage ? { package: runPackage, outputs: runPackage.outputs } : {},
545
553
  status
546
554
  };
547
555
  }
556
+ function normalizePlayRunStart(raw) {
557
+ const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
558
+ if (!runPackage) {
559
+ return raw;
560
+ }
561
+ const status = typeof runPackage.run.status === "string" ? runPackage.run.status : "running";
562
+ return {
563
+ workflowId: runPackage.run.id,
564
+ name: runPackage.run.playName,
565
+ status,
566
+ ...runPackage.run.dashboardUrl ? { dashboardUrl: runPackage.run.dashboardUrl } : {},
567
+ ...TERMINAL_PLAY_STATUSES.has(status) ? { finalStatus: runPackage } : {},
568
+ package: runPackage
569
+ };
570
+ }
548
571
  function decodeBase64Bytes(value) {
549
572
  const binary = atob(value);
550
573
  const bytes = new Uint8Array(binary.length);
@@ -574,25 +597,31 @@ function updatePlayLiveStatusState(state, event) {
574
597
  if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
575
598
  return null;
576
599
  }
577
- const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
578
- const status = normalizeLiveStatus(payload.status) ?? state.status;
579
- const logs = readStringArray(payload.logs);
580
- if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status") {
600
+ const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : isPlayRunPackage(payload) ? payload.run.id : state.runId;
601
+ const status = normalizeLiveStatus(payload.status) ?? (isPlayRunPackage(payload) ? normalizeLiveStatus(payload.run.status) : null) ?? state.status;
602
+ const progressPayload = isRecord(payload.progress) ? payload.progress : {};
603
+ const payloadLogs = readStringArray(payload.logs);
604
+ const progressLogs = readStringArray(progressPayload.logs);
605
+ const logs = payloadLogs.length > 0 ? payloadLogs : progressLogs;
606
+ if (logs.length > 0 || event.type === "play.run.snapshot" || event.type === "play.run.final_status" && !isPlayRunPackage(payload)) {
581
607
  state.logs = logs;
582
608
  }
583
609
  if ("result" in payload) {
584
610
  state.result = payload.result;
611
+ } else if (isPlayRunPackage(payload)) {
612
+ state.result = payload;
585
613
  }
586
614
  if (typeof payload.error === "string" && payload.error.trim()) {
587
615
  state.error = payload.error;
588
616
  }
589
617
  state.runId = runId;
590
618
  state.status = status;
591
- const progressRecord = payload.progress && typeof payload.progress === "object" && !Array.isArray(payload.progress) ? payload.progress : {};
619
+ const progressRecord = progressPayload;
592
620
  const next = {
593
621
  ...payload,
594
622
  runId,
595
623
  status,
624
+ ...isPlayRunPackage(payload) ? { package: payload, outputs: payload.outputs } : {},
596
625
  progress: {
597
626
  ...progressRecord,
598
627
  status: typeof progressRecord.status === "string" ? progressRecord.status : status,
@@ -608,7 +637,8 @@ function playRunResultFromStatus(status, startedAt, fallbackRunId) {
608
637
  return {
609
638
  success: status.status === "completed",
610
639
  runId: status.runId || fallbackRunId,
611
- result: status.result,
640
+ result: status.package ?? status.result,
641
+ ...status.package ? { package: status.package } : {},
612
642
  logs: status.progress?.logs ?? [],
613
643
  durationMs: Date.now() - startedAt,
614
644
  error: status.progress?.error ?? (status.status !== "completed" ? status.status : void 0)
@@ -638,7 +668,7 @@ var DeeplineClient = class {
638
668
  this.config = resolveConfig(options);
639
669
  this.http = new HttpClient(this.config);
640
670
  this.runs = {
641
- get: (runId) => this.getRunStatus(runId),
671
+ get: (runId, options2) => this.getRunStatus(runId, options2),
642
672
  list: (options2) => this.listRuns(options2),
643
673
  tail: (runId, options2) => this.tailRun(runId, options2),
644
674
  logs: (runId, options2) => this.getRunLogs(runId, options2),
@@ -857,9 +887,9 @@ var DeeplineClient = class {
857
887
  * artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
858
888
  * });
859
889
  * ```
860
- */
890
+ */
861
891
  async startPlayRun(request) {
862
- return this.http.post("/api/v2/plays/run", {
892
+ const response = await this.http.post("/api/v2/plays/run", {
863
893
  ...request.name ? { name: request.name } : {},
864
894
  ...request.revisionId ? { revisionId: request.revisionId } : {},
865
895
  ...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
@@ -882,6 +912,7 @@ var DeeplineClient = class {
882
912
  // different profile pass `request.profile` explicitly.
883
913
  ...request.profile ? { profile: request.profile } : {}
884
914
  });
915
+ return normalizePlayRunStart(response);
885
916
  }
886
917
  async *startPlayRunStream(request, options) {
887
918
  const body = {
@@ -1165,6 +1196,9 @@ var DeeplineClient = class {
1165
1196
  if (options?.billing === false) {
1166
1197
  params.set("billing", "false");
1167
1198
  }
1199
+ if (options?.full === true) {
1200
+ params.set("full", "true");
1201
+ }
1168
1202
  const query = params.size > 0 ? `?${params.toString()}` : "";
1169
1203
  const response = await this.http.get(
1170
1204
  `/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
@@ -1253,9 +1287,14 @@ var DeeplineClient = class {
1253
1287
  * deepline runs get <run-id> --json
1254
1288
  * ```
1255
1289
  */
1256
- async getRunStatus(runId) {
1290
+ async getRunStatus(runId, options) {
1291
+ const params = new URLSearchParams();
1292
+ if (options?.full === true) {
1293
+ params.set("full", "true");
1294
+ }
1295
+ const query = params.size > 0 ? `?${params.toString()}` : "";
1257
1296
  const response = await this.http.get(
1258
- `/api/v2/runs/${encodeURIComponent(runId)}`
1297
+ `/api/v2/runs/${encodeURIComponent(runId)}${query}`
1259
1298
  );
1260
1299
  return normalizePlayStatus(response);
1261
1300
  }
@@ -5567,6 +5606,17 @@ async function traceCliSpan(phase, fields, run) {
5567
5606
  }
5568
5607
 
5569
5608
  // src/cli/commands/play.ts
5609
+ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
5610
+ "--json",
5611
+ "--wait",
5612
+ "--tail",
5613
+ "--watch",
5614
+ "--no-wait",
5615
+ "--logs",
5616
+ "--full",
5617
+ "--force",
5618
+ "--no-open"
5619
+ ]);
5570
5620
  function traceCliSync(phase, fields, run) {
5571
5621
  const startedAt = Date.now();
5572
5622
  try {
@@ -6085,25 +6135,46 @@ var PLAY_START_TRANSIENT_RETRY_DELAYS_MS = [500, 1500];
6085
6135
  function getEventPayload(event) {
6086
6136
  return event.payload && typeof event.payload === "object" ? event.payload : {};
6087
6137
  }
6138
+ function playStatusValue(value) {
6139
+ return value === "queued" || value === "running" || value === "waiting" || value === "completed" || value === "failed" || value === "cancelled" ? value : null;
6140
+ }
6141
+ function getRunRecordFromPackage(value) {
6142
+ if (!isPlayRunPackageValue(value)) {
6143
+ return null;
6144
+ }
6145
+ const run = value.run;
6146
+ return run && typeof run === "object" && !Array.isArray(run) ? run : null;
6147
+ }
6148
+ function getRunIdFromLiveEvent(event) {
6149
+ const payload = getEventPayload(event);
6150
+ const directRunId = payload.runId;
6151
+ if (typeof directRunId === "string" && directRunId.trim()) {
6152
+ return directRunId;
6153
+ }
6154
+ const packageRunId = getRunRecordFromPackage(payload)?.id;
6155
+ return typeof packageRunId === "string" && packageRunId.trim() ? packageRunId : null;
6156
+ }
6088
6157
  function getStatusFromLiveEvent(event) {
6089
6158
  if (event.type !== "play.run.status" && event.type !== "play.run.snapshot" && event.type !== "play.run.final_status") {
6090
6159
  return null;
6091
6160
  }
6092
- const status = getEventPayload(event).status;
6093
- return status === "queued" || status === "running" || status === "waiting" || status === "completed" || status === "failed" || status === "cancelled" ? status : null;
6161
+ const payload = getEventPayload(event);
6162
+ return playStatusValue(payload.status) ?? playStatusValue(getRunRecordFromPackage(payload)?.status);
6094
6163
  }
6095
6164
  function getFinalStatusFromLiveEvent(event) {
6096
6165
  if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
6097
6166
  return null;
6098
6167
  }
6099
6168
  const payload = getEventPayload(event);
6100
- const status = payload.status;
6169
+ const packageRun = getRunRecordFromPackage(payload);
6170
+ const status = playStatusValue(payload.status) ?? playStatusValue(packageRun?.status);
6101
6171
  if (status !== "completed" && status !== "failed" && status !== "cancelled") {
6102
6172
  return null;
6103
6173
  }
6174
+ const runId = typeof payload.runId === "string" ? payload.runId : typeof packageRun?.id === "string" ? packageRun.id : "";
6104
6175
  return {
6105
6176
  ...payload,
6106
- runId: typeof payload.runId === "string" ? payload.runId : "",
6177
+ runId,
6107
6178
  status
6108
6179
  };
6109
6180
  }
@@ -6121,7 +6192,8 @@ function describeLiveEventPhase(event) {
6121
6192
  if (status === "running") {
6122
6193
  return null;
6123
6194
  }
6124
- const runId = typeof payload.runId === "string" && payload.runId ? ` ${payload.runId}` : "";
6195
+ const eventRunId = getRunIdFromLiveEvent(event);
6196
+ const runId = eventRunId ? ` ${eventRunId}` : "";
6125
6197
  return status ? `${status}${runId}` : null;
6126
6198
  }
6127
6199
  if (event.type === "play.step.status" || event.type === "play.step.progress") {
@@ -6370,7 +6442,7 @@ async function startAndWaitForPlayCompletionByStreamOnce(input) {
6370
6442
  signal: controller.signal
6371
6443
  })) {
6372
6444
  eventCount += 1;
6373
- const eventRunId = getEventPayload(event).runId;
6445
+ const eventRunId = getRunIdFromLiveEvent(event);
6374
6446
  if (typeof eventRunId === "string" && eventRunId && eventRunId !== "pending") {
6375
6447
  lastKnownWorkflowId = eventRunId;
6376
6448
  firstRunIdMs ??= Date.now() - startedAt;
@@ -6967,16 +7039,27 @@ function stripProviderSpendFromBilling(value) {
6967
7039
  }
6968
7040
  return next;
6969
7041
  }
7042
+ function isPlayRunPackageValue(value) {
7043
+ return Boolean(
7044
+ value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run.id === "string"
7045
+ );
7046
+ }
7047
+ function getPlayRunPackage(status) {
7048
+ const direct = status;
7049
+ if (isPlayRunPackageValue(direct)) {
7050
+ return direct;
7051
+ }
7052
+ const packaged = status.package;
7053
+ return isPlayRunPackageValue(packaged) ? packaged : null;
7054
+ }
6970
7055
  function compactPlayStatus(status) {
7056
+ const packaged = getPlayRunPackage(status);
7057
+ if (packaged) {
7058
+ return packaged;
7059
+ }
6971
7060
  const rowsInfo = extractCanonicalRowsInfo(status);
6972
7061
  const result = status && typeof status === "object" ? status.result : null;
6973
7062
  const warnings = buildRunWarnings(status, rowsInfo);
6974
- const datasetStats = rowsInfo && rowsInfo.complete ? buildDatasetStats(
6975
- rowsInfo.rows,
6976
- rowsInfo.totalRows,
6977
- rowsInfo.columns,
6978
- extractDatasetExecutionStats(status)
6979
- ) : null;
6980
7063
  const billing = status && typeof status === "object" ? stripProviderSpendFromBilling(
6981
7064
  status.billing
6982
7065
  ) : null;
@@ -6998,8 +7081,6 @@ function compactPlayStatus(status) {
6998
7081
  ...displayError ? { error: displayError } : {},
6999
7082
  ...warnings.length > 0 ? { warnings } : {},
7000
7083
  ...result !== void 0 ? { result } : {},
7001
- ...status.resultView ? { resultView: status.resultView } : {},
7002
- ...datasetStats ? { dataset_stats: datasetStats } : {},
7003
7084
  ...billing ? { billing } : {},
7004
7085
  next: buildRunNextCommands(status)
7005
7086
  };
@@ -7019,51 +7100,87 @@ function enrichPlayStatusWithDatasetStats(status) {
7019
7100
  )
7020
7101
  };
7021
7102
  }
7022
- function formatDatasetStatsLines(datasetStats) {
7023
- if (!datasetStats) {
7024
- return [];
7103
+ function readRunPackageRun(packaged) {
7104
+ return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
7105
+ }
7106
+ function readRecordArray(value) {
7107
+ return Array.isArray(value) ? value.filter(
7108
+ (item) => item !== null && typeof item === "object" && !Array.isArray(item)
7109
+ ) : [];
7110
+ }
7111
+ function actionToCommand(action) {
7112
+ if (!action || typeof action !== "object" || Array.isArray(action)) {
7113
+ return null;
7025
7114
  }
7026
- const lines = [" column stats:"];
7027
- for (const [column, stat3] of Object.entries(datasetStats.columnStats).slice(
7028
- 0,
7029
- 12
7030
- )) {
7031
- const topValues = stat3.top_values ? `, top_values=${Object.entries(stat3.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
7032
- const sample = stat3.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat3.sample_value)}` : "";
7033
- const execution = stat3.execution ? `, execution=${Object.entries(stat3.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
7034
- lines.push(
7035
- ` ${column}: non_empty=${stat3.non_empty}, unique=${stat3.unique}${topValues}${sample}${execution}`
7036
- );
7115
+ const record = action;
7116
+ if (record.kind === "deepline_run_inspect" && typeof record.runId === "string") {
7117
+ return `deepline runs get ${record.runId} --json`;
7037
7118
  }
7038
- return lines;
7119
+ if (record.kind === "deepline_run_export" && typeof record.runId === "string" && typeof record.datasetPath === "string") {
7120
+ return `deepline runs export ${record.runId} --dataset ${shellSingleQuote(
7121
+ record.datasetPath
7122
+ )} --out ${shellSingleQuote(`${record.datasetPath.split(".").pop() || "dataset"}.csv`)}`;
7123
+ }
7124
+ if (record.kind === "deepline_db_query" && typeof record.sql === "string") {
7125
+ const maxRows = typeof record.maxRows === "number" && Number.isFinite(record.maxRows) ? Math.trunc(record.maxRows) : 20;
7126
+ return `deepline db query --sql ${shellSingleQuote(record.sql)} --max-rows ${maxRows} --json`;
7127
+ }
7128
+ return null;
7039
7129
  }
7040
- function buildJsonRunResultRenderLines(status) {
7041
- const publicStatus = status.status ?? "running";
7042
- const runId = status.runId ?? "unknown";
7043
- const lines = [`${publicStatus} ${runId}`];
7044
- const progressError = status.progress?.error;
7045
- if (typeof progressError === "string") {
7046
- const billing = extractBillingForStatus(status, progressError);
7047
- if (isInsufficientCreditsBilling(billing)) {
7048
- lines.push(...buildInsufficientCreditsSummaryLines({ status, billing }));
7130
+ function readFirstDatasetActions(packaged) {
7131
+ for (const step of readRecordArray(packaged.steps)) {
7132
+ const output = step.output && typeof step.output === "object" && !Array.isArray(step.output) ? step.output : null;
7133
+ const actions = output?.actions && typeof output.actions === "object" && !Array.isArray(output.actions) ? output.actions : null;
7134
+ if (actions) {
7135
+ return actions;
7049
7136
  }
7050
7137
  }
7138
+ return {};
7139
+ }
7140
+ function buildRunPackageTextLines(packaged) {
7141
+ const run = readRunPackageRun(packaged);
7142
+ const runId = typeof run.id === "string" ? run.id : "unknown";
7143
+ const status = typeof run.status === "string" ? run.status : "unknown";
7144
+ const playName = typeof run.playName === "string" ? run.playName : null;
7145
+ const lines = [`${status === "completed" ? "\u2713" : status === "failed" ? "\u2717" : "\u2022"} ${status} ${runId}`];
7146
+ if (playName) {
7147
+ lines.push(` play: ${playName}`);
7148
+ }
7149
+ for (const step of readRecordArray(packaged.steps).slice(0, 8)) {
7150
+ const id = typeof step.id === "string" ? step.id : "step";
7151
+ const kind = typeof step.kind === "string" ? step.kind : "step";
7152
+ const stepStatus = typeof step.status === "string" ? step.status : status;
7153
+ const output = step.output && typeof step.output === "object" && !Array.isArray(step.output) ? step.output : null;
7154
+ const rowCount = output && typeof output.rowCount === "number" ? ` rows=${formatInteger(output.rowCount)}` : "";
7155
+ const preview = output?.preview && typeof output.preview === "object" && !Array.isArray(output.preview) ? output.preview : null;
7156
+ const previewRows = Array.isArray(preview?.rows) ? preview.rows.length : null;
7157
+ const previewLabel = previewRows !== null ? ` preview=${previewRows}${preview?.truncated ? " truncated" : ""}` : "";
7158
+ lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}${previewLabel}`);
7159
+ }
7160
+ const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
7161
+ const datasetActions = readFirstDatasetActions(packaged);
7162
+ const inspectCommand = actionToCommand(next.inspect);
7163
+ const queryCommand = actionToCommand(next.query) ?? actionToCommand(datasetActions.query);
7164
+ const exportCommand = actionToCommand(next.export) ?? actionToCommand(datasetActions.exportCsv);
7165
+ if (inspectCommand) lines.push(` inspect: ${inspectCommand}`);
7166
+ if (queryCommand) lines.push(` query: ${queryCommand}`);
7167
+ if (exportCommand) lines.push(` export CSV: ${exportCommand}`);
7051
7168
  return lines;
7052
7169
  }
7053
7170
  function writePlayResult(status, jsonOutput, options) {
7171
+ const packaged = getPlayRunPackage(status);
7054
7172
  if (jsonOutput) {
7055
- const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
7056
- printCommandEnvelope({
7057
- ...payload2,
7058
- render: {
7059
- sections: [
7060
- {
7061
- title: "run result",
7062
- lines: buildJsonRunResultRenderLines(status)
7063
- }
7064
- ]
7065
- }
7066
- }, { json: true });
7173
+ const payload2 = options?.fullJson ? status : compactPlayStatus(status);
7174
+ printCommandEnvelope(payload2, { json: true });
7175
+ return;
7176
+ }
7177
+ if (packaged && !options?.fullJson) {
7178
+ const lines2 = buildRunPackageTextLines(packaged);
7179
+ printCommandEnvelope(packaged, {
7180
+ json: false,
7181
+ text: `${lines2.join("\n")}
7182
+ `
7183
+ });
7067
7184
  return;
7068
7185
  }
7069
7186
  const result = status.result;
@@ -7074,16 +7191,9 @@ function writePlayResult(status, jsonOutput, options) {
7074
7191
  lines.push(`${success ? "\u2713" : "\u2717"} ${publicStatus} ${runId}`);
7075
7192
  const rowsInfo = extractCanonicalRowsInfo(status);
7076
7193
  const warnings = buildRunWarnings(status, rowsInfo);
7077
- const datasetStats = rowsInfo && rowsInfo.complete ? buildDatasetStats(
7078
- rowsInfo.rows,
7079
- rowsInfo.totalRows,
7080
- rowsInfo.columns,
7081
- extractDatasetExecutionStats(status)
7082
- ) : null;
7083
7194
  for (const warning of warnings) {
7084
7195
  lines.push(` warning: ${warning}`);
7085
7196
  }
7086
- lines.push(...formatDatasetStatsLines(datasetStats));
7087
7197
  const progressError = status.progress?.error;
7088
7198
  if (progressError && typeof progressError === "string") {
7089
7199
  const billing = extractBillingForStatus(status, progressError);
@@ -7111,6 +7221,21 @@ function writePlayResult(status, jsonOutput, options) {
7111
7221
  }, { json: jsonOutput, text: `${lines.join("\n")}
7112
7222
  ` });
7113
7223
  }
7224
+ async function resolvePlayRunOutputStatus(input) {
7225
+ if (!input.fullJson || !getPlayRunPackage(input.status)) {
7226
+ return input.status;
7227
+ }
7228
+ const runId = input.status.runId;
7229
+ if (!runId) {
7230
+ return input.status;
7231
+ }
7232
+ const fullStatus = await input.client.getPlayStatus(runId, {
7233
+ billing: false,
7234
+ full: true
7235
+ });
7236
+ const dashboardUrl = input.status.dashboardUrl;
7237
+ return typeof dashboardUrl === "string" ? { ...fullStatus, dashboardUrl } : fullStatus;
7238
+ }
7114
7239
  var RUN_EXPORT_PAGE_SIZE = 5e3;
7115
7240
  function shellSingleQuote(value) {
7116
7241
  return `'${value.replace(/'/g, `'\\''`)}'`;
@@ -7464,6 +7589,24 @@ function renderServerResultView(value) {
7464
7589
  return { lines: lines.length > 1 ? lines : [], actions: [] };
7465
7590
  }
7466
7591
  function writeStartedPlayRun(input) {
7592
+ if (input.package && isPlayRunPackageValue(input.package)) {
7593
+ if (input.jsonOutput) {
7594
+ printCommandEnvelope(input.package, { json: true });
7595
+ return;
7596
+ }
7597
+ const lines2 = buildRunPackageTextLines(input.package);
7598
+ const output2 = lines2.join("\n");
7599
+ if (input.progress) {
7600
+ input.progress.writeLine(output2, process.stdout);
7601
+ return;
7602
+ }
7603
+ printCommandEnvelope(input.package, {
7604
+ json: false,
7605
+ text: `${output2}
7606
+ `
7607
+ });
7608
+ return;
7609
+ }
7467
7610
  const payload = {
7468
7611
  runId: input.runId,
7469
7612
  workflowId: input.runId,
@@ -7509,7 +7652,7 @@ function writeStartedPlayRun(input) {
7509
7652
  ` });
7510
7653
  }
7511
7654
  function parsePlayRunOptions(args) {
7512
- 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.";
7655
+ 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.";
7513
7656
  let filePath = null;
7514
7657
  let playName = null;
7515
7658
  let input = null;
@@ -7517,6 +7660,7 @@ function parsePlayRunOptions(args) {
7517
7660
  let revisionSelector = null;
7518
7661
  const watch = !args.includes("--no-wait");
7519
7662
  let jsonOutput = watch ? args.includes("--json") : argsWantJson(args);
7663
+ const fullJson = args.includes("--full");
7520
7664
  const emitLogs = !jsonOutput || args.includes("--logs");
7521
7665
  const force = args.includes("--force");
7522
7666
  const noOpen = args.includes("--no-open");
@@ -7561,7 +7705,7 @@ function parsePlayRunOptions(args) {
7561
7705
  waitTimeoutMs = parsePositiveInteger2(args[++index], arg);
7562
7706
  continue;
7563
7707
  }
7564
- if (arg === "--json" || arg === "--wait" || arg === "--tail" || arg === "--watch" || arg === "--no-wait" || arg === "--logs" || arg === "--force" || arg === "--no-open") {
7708
+ if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
7565
7709
  if (arg === "--watch") {
7566
7710
  continue;
7567
7711
  }
@@ -7623,6 +7767,7 @@ function parsePlayRunOptions(args) {
7623
7767
  watch,
7624
7768
  emitLogs,
7625
7769
  jsonOutput,
7770
+ fullJson,
7626
7771
  waitTimeoutMs,
7627
7772
  force,
7628
7773
  noOpen
@@ -7934,10 +8079,17 @@ async function handleFileBackedRun(options) {
7934
8079
  } else {
7935
8080
  progress.fail();
7936
8081
  }
8082
+ const outputStatus = await resolvePlayRunOutputStatus({
8083
+ client,
8084
+ status: finalStatus,
8085
+ fullJson: options.fullJson
8086
+ });
7937
8087
  traceCliSync(
7938
8088
  "cli.play_write_result",
7939
8089
  { targetKind: "file", playName },
7940
- () => writePlayResult(finalStatus, options.jsonOutput)
8090
+ () => writePlayResult(outputStatus, options.jsonOutput, {
8091
+ fullJson: options.fullJson
8092
+ })
7941
8093
  );
7942
8094
  return finalStatus.status === "completed" ? 0 : 1;
7943
8095
  }
@@ -7962,6 +8114,7 @@ async function handleFileBackedRun(options) {
7962
8114
  playName,
7963
8115
  status: started.status,
7964
8116
  dashboardUrl: resolvedDashboardUrl,
8117
+ package: options.fullJson ? void 0 : started.package,
7965
8118
  jsonOutput: options.jsonOutput,
7966
8119
  progress
7967
8120
  });
@@ -8073,10 +8226,17 @@ async function handleNamedRun(options) {
8073
8226
  } else {
8074
8227
  progress.fail();
8075
8228
  }
8229
+ const outputStatus = await resolvePlayRunOutputStatus({
8230
+ client,
8231
+ status: finalStatus,
8232
+ fullJson: options.fullJson
8233
+ });
8076
8234
  traceCliSync(
8077
8235
  "cli.play_write_result",
8078
8236
  { targetKind: "name", playName },
8079
- () => writePlayResult(finalStatus, options.jsonOutput)
8237
+ () => writePlayResult(outputStatus, options.jsonOutput, {
8238
+ fullJson: options.fullJson
8239
+ })
8080
8240
  );
8081
8241
  return finalStatus.status === "completed" ? 0 : 1;
8082
8242
  }
@@ -8101,6 +8261,7 @@ async function handleNamedRun(options) {
8101
8261
  playName: started.name ?? playName,
8102
8262
  status: started.status,
8103
8263
  dashboardUrl: resolvedDashboardUrl,
8264
+ package: options.fullJson ? void 0 : started.package,
8104
8265
  jsonOutput: options.jsonOutput,
8105
8266
  progress
8106
8267
  });
@@ -8163,7 +8324,9 @@ async function handleRunGet(args) {
8163
8324
  return 1;
8164
8325
  }
8165
8326
  const client = new DeeplineClient();
8166
- const status = await client.runs.get(runId);
8327
+ const status = await client.runs.get(runId, {
8328
+ full: args.includes("--full")
8329
+ });
8167
8330
  writePlayResult(status, argsWantJson(args), {
8168
8331
  fullJson: args.includes("--full")
8169
8332
  });
@@ -8352,7 +8515,7 @@ async function handleRunExport(args) {
8352
8515
  return 1;
8353
8516
  }
8354
8517
  const client = new DeeplineClient();
8355
- const status = await client.getPlayStatus(runId);
8518
+ const status = await client.getPlayStatus(runId, { full: true });
8356
8519
  const exportResult = await exportPlayStatusRows(client, status, outPath, {
8357
8520
  datasetPath
8358
8521
  });
@@ -9072,7 +9235,7 @@ Examples:
9072
9235
  ).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(
9073
9236
  "--logs",
9074
9237
  "When output is non-interactive, stream play logs to stderr while waiting"
9075
- ).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(
9238
+ ).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(
9076
9239
  "afterAll",
9077
9240
  `
9078
9241
  Pass-through input flags:
@@ -9109,6 +9272,7 @@ Pass-through input flags:
9109
9272
  ...options.force ? ["--force"] : [],
9110
9273
  ...options.noOpen || options.open === false ? ["--no-open"] : [],
9111
9274
  ...options.json ? ["--json"] : [],
9275
+ ...options.full ? ["--full"] : [],
9112
9276
  ...passthroughArgs
9113
9277
  ]);
9114
9278
  });