deepline 0.1.52 → 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 +246 -82
- package/dist/cli/index.mjs +246 -82
- package/dist/index.d.mts +66 -5
- package/dist/index.d.ts +66 -5
- package/dist/index.js +60 -18
- package/dist/index.mjs +60 -18
- package/dist/repo/sdk/src/client.ts +92 -19
- package/dist/repo/sdk/src/play.ts +3 -0
- package/dist/repo/sdk/src/release.ts +5 -5
- package/dist/repo/sdk/src/types.ts +60 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -220,12 +220,12 @@ function resolveConfig(options) {
|
|
|
220
220
|
|
|
221
221
|
// src/release.ts
|
|
222
222
|
var SDK_RELEASE = {
|
|
223
|
-
version: "0.1.
|
|
224
|
-
apiContract: "2026-05-
|
|
223
|
+
version: "0.1.53",
|
|
224
|
+
apiContract: "2026-05-run-response-package",
|
|
225
225
|
supportPolicy: {
|
|
226
|
-
latest: "0.1.
|
|
227
|
-
minimumSupported: "0.1.
|
|
228
|
-
deprecatedBelow: "0.1.
|
|
226
|
+
latest: "0.1.53",
|
|
227
|
+
minimumSupported: "0.1.53",
|
|
228
|
+
deprecatedBelow: "0.1.53"
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
231
|
|
|
@@ -559,15 +559,38 @@ function isTransientCompileManifestError(error) {
|
|
|
559
559
|
function isRecord(value) {
|
|
560
560
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
561
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
|
+
}
|
|
562
567
|
function normalizePlayStatus(raw) {
|
|
563
|
-
const
|
|
564
|
-
const
|
|
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 ?? "";
|
|
565
572
|
return {
|
|
566
573
|
...raw,
|
|
567
574
|
runId,
|
|
575
|
+
...runPackage ? { package: runPackage, outputs: runPackage.outputs } : {},
|
|
568
576
|
status
|
|
569
577
|
};
|
|
570
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
|
+
}
|
|
571
594
|
function decodeBase64Bytes(value) {
|
|
572
595
|
const binary = atob(value);
|
|
573
596
|
const bytes = new Uint8Array(binary.length);
|
|
@@ -597,25 +620,31 @@ function updatePlayLiveStatusState(state, event) {
|
|
|
597
620
|
if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
|
|
598
621
|
return null;
|
|
599
622
|
}
|
|
600
|
-
const runId = typeof payload.runId === "string" && payload.runId ? payload.runId : state.runId;
|
|
601
|
-
const status = normalizeLiveStatus(payload.status) ?? state.status;
|
|
602
|
-
const
|
|
603
|
-
|
|
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)) {
|
|
604
630
|
state.logs = logs;
|
|
605
631
|
}
|
|
606
632
|
if ("result" in payload) {
|
|
607
633
|
state.result = payload.result;
|
|
634
|
+
} else if (isPlayRunPackage(payload)) {
|
|
635
|
+
state.result = payload;
|
|
608
636
|
}
|
|
609
637
|
if (typeof payload.error === "string" && payload.error.trim()) {
|
|
610
638
|
state.error = payload.error;
|
|
611
639
|
}
|
|
612
640
|
state.runId = runId;
|
|
613
641
|
state.status = status;
|
|
614
|
-
const progressRecord =
|
|
642
|
+
const progressRecord = progressPayload;
|
|
615
643
|
const next = {
|
|
616
644
|
...payload,
|
|
617
645
|
runId,
|
|
618
646
|
status,
|
|
647
|
+
...isPlayRunPackage(payload) ? { package: payload, outputs: payload.outputs } : {},
|
|
619
648
|
progress: {
|
|
620
649
|
...progressRecord,
|
|
621
650
|
status: typeof progressRecord.status === "string" ? progressRecord.status : status,
|
|
@@ -631,7 +660,8 @@ function playRunResultFromStatus(status, startedAt, fallbackRunId) {
|
|
|
631
660
|
return {
|
|
632
661
|
success: status.status === "completed",
|
|
633
662
|
runId: status.runId || fallbackRunId,
|
|
634
|
-
result: status.result,
|
|
663
|
+
result: status.package ?? status.result,
|
|
664
|
+
...status.package ? { package: status.package } : {},
|
|
635
665
|
logs: status.progress?.logs ?? [],
|
|
636
666
|
durationMs: Date.now() - startedAt,
|
|
637
667
|
error: status.progress?.error ?? (status.status !== "completed" ? status.status : void 0)
|
|
@@ -661,7 +691,7 @@ var DeeplineClient = class {
|
|
|
661
691
|
this.config = resolveConfig(options);
|
|
662
692
|
this.http = new HttpClient(this.config);
|
|
663
693
|
this.runs = {
|
|
664
|
-
get: (runId) => this.getRunStatus(runId),
|
|
694
|
+
get: (runId, options2) => this.getRunStatus(runId, options2),
|
|
665
695
|
list: (options2) => this.listRuns(options2),
|
|
666
696
|
tail: (runId, options2) => this.tailRun(runId, options2),
|
|
667
697
|
logs: (runId, options2) => this.getRunLogs(runId, options2),
|
|
@@ -880,9 +910,9 @@ var DeeplineClient = class {
|
|
|
880
910
|
* artifactStorageKey: 'plays/v1/orgs/acme/plays/my-play/artifacts/playgraph_abc123.json',
|
|
881
911
|
* });
|
|
882
912
|
* ```
|
|
883
|
-
|
|
913
|
+
*/
|
|
884
914
|
async startPlayRun(request) {
|
|
885
|
-
|
|
915
|
+
const response = await this.http.post("/api/v2/plays/run", {
|
|
886
916
|
...request.name ? { name: request.name } : {},
|
|
887
917
|
...request.revisionId ? { revisionId: request.revisionId } : {},
|
|
888
918
|
...request.artifactStorageKey ? { artifactStorageKey: request.artifactStorageKey } : {},
|
|
@@ -905,6 +935,7 @@ var DeeplineClient = class {
|
|
|
905
935
|
// different profile pass `request.profile` explicitly.
|
|
906
936
|
...request.profile ? { profile: request.profile } : {}
|
|
907
937
|
});
|
|
938
|
+
return normalizePlayRunStart(response);
|
|
908
939
|
}
|
|
909
940
|
async *startPlayRunStream(request, options) {
|
|
910
941
|
const body = {
|
|
@@ -1188,6 +1219,9 @@ var DeeplineClient = class {
|
|
|
1188
1219
|
if (options?.billing === false) {
|
|
1189
1220
|
params.set("billing", "false");
|
|
1190
1221
|
}
|
|
1222
|
+
if (options?.full === true) {
|
|
1223
|
+
params.set("full", "true");
|
|
1224
|
+
}
|
|
1191
1225
|
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
1192
1226
|
const response = await this.http.get(
|
|
1193
1227
|
`/api/v2/plays/run/${encodeURIComponent(workflowId)}${query}`
|
|
@@ -1276,9 +1310,14 @@ var DeeplineClient = class {
|
|
|
1276
1310
|
* deepline runs get <run-id> --json
|
|
1277
1311
|
* ```
|
|
1278
1312
|
*/
|
|
1279
|
-
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()}` : "";
|
|
1280
1319
|
const response = await this.http.get(
|
|
1281
|
-
`/api/v2/runs/${encodeURIComponent(runId)}`
|
|
1320
|
+
`/api/v2/runs/${encodeURIComponent(runId)}${query}`
|
|
1282
1321
|
);
|
|
1283
1322
|
return normalizePlayStatus(response);
|
|
1284
1323
|
}
|
|
@@ -5580,6 +5619,17 @@ async function traceCliSpan(phase, fields, run) {
|
|
|
5580
5619
|
}
|
|
5581
5620
|
|
|
5582
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
|
+
]);
|
|
5583
5633
|
function traceCliSync(phase, fields, run) {
|
|
5584
5634
|
const startedAt = Date.now();
|
|
5585
5635
|
try {
|
|
@@ -6098,25 +6148,46 @@ var PLAY_START_TRANSIENT_RETRY_DELAYS_MS = [500, 1500];
|
|
|
6098
6148
|
function getEventPayload(event) {
|
|
6099
6149
|
return event.payload && typeof event.payload === "object" ? event.payload : {};
|
|
6100
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
|
+
}
|
|
6101
6170
|
function getStatusFromLiveEvent(event) {
|
|
6102
6171
|
if (event.type !== "play.run.status" && event.type !== "play.run.snapshot" && event.type !== "play.run.final_status") {
|
|
6103
6172
|
return null;
|
|
6104
6173
|
}
|
|
6105
|
-
const
|
|
6106
|
-
return status
|
|
6174
|
+
const payload = getEventPayload(event);
|
|
6175
|
+
return playStatusValue(payload.status) ?? playStatusValue(getRunRecordFromPackage(payload)?.status);
|
|
6107
6176
|
}
|
|
6108
6177
|
function getFinalStatusFromLiveEvent(event) {
|
|
6109
6178
|
if (event.type !== "play.run.snapshot" && event.type !== "play.run.status" && event.type !== "play.run.final_status") {
|
|
6110
6179
|
return null;
|
|
6111
6180
|
}
|
|
6112
6181
|
const payload = getEventPayload(event);
|
|
6113
|
-
const
|
|
6182
|
+
const packageRun = getRunRecordFromPackage(payload);
|
|
6183
|
+
const status = playStatusValue(payload.status) ?? playStatusValue(packageRun?.status);
|
|
6114
6184
|
if (status !== "completed" && status !== "failed" && status !== "cancelled") {
|
|
6115
6185
|
return null;
|
|
6116
6186
|
}
|
|
6187
|
+
const runId = typeof payload.runId === "string" ? payload.runId : typeof packageRun?.id === "string" ? packageRun.id : "";
|
|
6117
6188
|
return {
|
|
6118
6189
|
...payload,
|
|
6119
|
-
runId
|
|
6190
|
+
runId,
|
|
6120
6191
|
status
|
|
6121
6192
|
};
|
|
6122
6193
|
}
|
|
@@ -6134,7 +6205,8 @@ function describeLiveEventPhase(event) {
|
|
|
6134
6205
|
if (status === "running") {
|
|
6135
6206
|
return null;
|
|
6136
6207
|
}
|
|
6137
|
-
const
|
|
6208
|
+
const eventRunId = getRunIdFromLiveEvent(event);
|
|
6209
|
+
const runId = eventRunId ? ` ${eventRunId}` : "";
|
|
6138
6210
|
return status ? `${status}${runId}` : null;
|
|
6139
6211
|
}
|
|
6140
6212
|
if (event.type === "play.step.status" || event.type === "play.step.progress") {
|
|
@@ -6383,7 +6455,7 @@ async function startAndWaitForPlayCompletionByStreamOnce(input) {
|
|
|
6383
6455
|
signal: controller.signal
|
|
6384
6456
|
})) {
|
|
6385
6457
|
eventCount += 1;
|
|
6386
|
-
const eventRunId =
|
|
6458
|
+
const eventRunId = getRunIdFromLiveEvent(event);
|
|
6387
6459
|
if (typeof eventRunId === "string" && eventRunId && eventRunId !== "pending") {
|
|
6388
6460
|
lastKnownWorkflowId = eventRunId;
|
|
6389
6461
|
firstRunIdMs ??= Date.now() - startedAt;
|
|
@@ -6980,16 +7052,27 @@ function stripProviderSpendFromBilling(value) {
|
|
|
6980
7052
|
}
|
|
6981
7053
|
return next;
|
|
6982
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
|
+
}
|
|
6983
7068
|
function compactPlayStatus(status) {
|
|
7069
|
+
const packaged = getPlayRunPackage(status);
|
|
7070
|
+
if (packaged) {
|
|
7071
|
+
return packaged;
|
|
7072
|
+
}
|
|
6984
7073
|
const rowsInfo = extractCanonicalRowsInfo(status);
|
|
6985
7074
|
const result = status && typeof status === "object" ? status.result : null;
|
|
6986
7075
|
const warnings = buildRunWarnings(status, rowsInfo);
|
|
6987
|
-
const datasetStats = rowsInfo && rowsInfo.complete ? buildDatasetStats(
|
|
6988
|
-
rowsInfo.rows,
|
|
6989
|
-
rowsInfo.totalRows,
|
|
6990
|
-
rowsInfo.columns,
|
|
6991
|
-
extractDatasetExecutionStats(status)
|
|
6992
|
-
) : null;
|
|
6993
7076
|
const billing = status && typeof status === "object" ? stripProviderSpendFromBilling(
|
|
6994
7077
|
status.billing
|
|
6995
7078
|
) : null;
|
|
@@ -7011,8 +7094,6 @@ function compactPlayStatus(status) {
|
|
|
7011
7094
|
...displayError ? { error: displayError } : {},
|
|
7012
7095
|
...warnings.length > 0 ? { warnings } : {},
|
|
7013
7096
|
...result !== void 0 ? { result } : {},
|
|
7014
|
-
...status.resultView ? { resultView: status.resultView } : {},
|
|
7015
|
-
...datasetStats ? { dataset_stats: datasetStats } : {},
|
|
7016
7097
|
...billing ? { billing } : {},
|
|
7017
7098
|
next: buildRunNextCommands(status)
|
|
7018
7099
|
};
|
|
@@ -7032,51 +7113,87 @@ function enrichPlayStatusWithDatasetStats(status) {
|
|
|
7032
7113
|
)
|
|
7033
7114
|
};
|
|
7034
7115
|
}
|
|
7035
|
-
function
|
|
7036
|
-
|
|
7037
|
-
|
|
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;
|
|
7038
7127
|
}
|
|
7039
|
-
const
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
12
|
|
7043
|
-
)) {
|
|
7044
|
-
const topValues = stat3.top_values ? `, top_values=${Object.entries(stat3.top_values).slice(0, 3).map(([value, count]) => `${value}=${count}`).join(", ")}` : "";
|
|
7045
|
-
const sample = stat3.sample_value !== void 0 ? `, sample_value=${JSON.stringify(stat3.sample_value)}` : "";
|
|
7046
|
-
const execution = stat3.execution ? `, execution=${Object.entries(stat3.execution).map(([bucket, count]) => `${bucket}=${count}`).join(", ")}` : "";
|
|
7047
|
-
lines.push(
|
|
7048
|
-
` ${column}: non_empty=${stat3.non_empty}, unique=${stat3.unique}${topValues}${sample}${execution}`
|
|
7049
|
-
);
|
|
7128
|
+
const record = action;
|
|
7129
|
+
if (record.kind === "deepline_run_inspect" && typeof record.runId === "string") {
|
|
7130
|
+
return `deepline runs get ${record.runId} --json`;
|
|
7050
7131
|
}
|
|
7051
|
-
|
|
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;
|
|
7052
7142
|
}
|
|
7053
|
-
function
|
|
7054
|
-
const
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
const billing = extractBillingForStatus(status, progressError);
|
|
7060
|
-
if (isInsufficientCreditsBilling(billing)) {
|
|
7061
|
-
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;
|
|
7062
7149
|
}
|
|
7063
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}`);
|
|
7064
7181
|
return lines;
|
|
7065
7182
|
}
|
|
7066
7183
|
function writePlayResult(status, jsonOutput, options) {
|
|
7184
|
+
const packaged = getPlayRunPackage(status);
|
|
7067
7185
|
if (jsonOutput) {
|
|
7068
|
-
const payload2 = options?.fullJson ?
|
|
7069
|
-
printCommandEnvelope({
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
}, { 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
|
+
});
|
|
7080
7197
|
return;
|
|
7081
7198
|
}
|
|
7082
7199
|
const result = status.result;
|
|
@@ -7087,16 +7204,9 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
7087
7204
|
lines.push(`${success ? "\u2713" : "\u2717"} ${publicStatus} ${runId}`);
|
|
7088
7205
|
const rowsInfo = extractCanonicalRowsInfo(status);
|
|
7089
7206
|
const warnings = buildRunWarnings(status, rowsInfo);
|
|
7090
|
-
const datasetStats = rowsInfo && rowsInfo.complete ? buildDatasetStats(
|
|
7091
|
-
rowsInfo.rows,
|
|
7092
|
-
rowsInfo.totalRows,
|
|
7093
|
-
rowsInfo.columns,
|
|
7094
|
-
extractDatasetExecutionStats(status)
|
|
7095
|
-
) : null;
|
|
7096
7207
|
for (const warning of warnings) {
|
|
7097
7208
|
lines.push(` warning: ${warning}`);
|
|
7098
7209
|
}
|
|
7099
|
-
lines.push(...formatDatasetStatsLines(datasetStats));
|
|
7100
7210
|
const progressError = status.progress?.error;
|
|
7101
7211
|
if (progressError && typeof progressError === "string") {
|
|
7102
7212
|
const billing = extractBillingForStatus(status, progressError);
|
|
@@ -7124,6 +7234,21 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
7124
7234
|
}, { json: jsonOutput, text: `${lines.join("\n")}
|
|
7125
7235
|
` });
|
|
7126
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
|
+
}
|
|
7127
7252
|
var RUN_EXPORT_PAGE_SIZE = 5e3;
|
|
7128
7253
|
function shellSingleQuote(value) {
|
|
7129
7254
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
@@ -7477,6 +7602,24 @@ function renderServerResultView(value) {
|
|
|
7477
7602
|
return { lines: lines.length > 1 ? lines : [], actions: [] };
|
|
7478
7603
|
}
|
|
7479
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
|
+
}
|
|
7480
7623
|
const payload = {
|
|
7481
7624
|
runId: input.runId,
|
|
7482
7625
|
workflowId: input.runId,
|
|
@@ -7522,7 +7665,7 @@ function writeStartedPlayRun(input) {
|
|
|
7522
7665
|
` });
|
|
7523
7666
|
}
|
|
7524
7667
|
function parsePlayRunOptions(args) {
|
|
7525
|
-
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.";
|
|
7526
7669
|
let filePath = null;
|
|
7527
7670
|
let playName = null;
|
|
7528
7671
|
let input = null;
|
|
@@ -7530,6 +7673,7 @@ function parsePlayRunOptions(args) {
|
|
|
7530
7673
|
let revisionSelector = null;
|
|
7531
7674
|
const watch = !args.includes("--no-wait");
|
|
7532
7675
|
let jsonOutput = watch ? args.includes("--json") : argsWantJson(args);
|
|
7676
|
+
const fullJson = args.includes("--full");
|
|
7533
7677
|
const emitLogs = !jsonOutput || args.includes("--logs");
|
|
7534
7678
|
const force = args.includes("--force");
|
|
7535
7679
|
const noOpen = args.includes("--no-open");
|
|
@@ -7574,7 +7718,7 @@ function parsePlayRunOptions(args) {
|
|
|
7574
7718
|
waitTimeoutMs = parsePositiveInteger2(args[++index], arg);
|
|
7575
7719
|
continue;
|
|
7576
7720
|
}
|
|
7577
|
-
if (arg
|
|
7721
|
+
if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
|
|
7578
7722
|
if (arg === "--watch") {
|
|
7579
7723
|
continue;
|
|
7580
7724
|
}
|
|
@@ -7636,6 +7780,7 @@ function parsePlayRunOptions(args) {
|
|
|
7636
7780
|
watch,
|
|
7637
7781
|
emitLogs,
|
|
7638
7782
|
jsonOutput,
|
|
7783
|
+
fullJson,
|
|
7639
7784
|
waitTimeoutMs,
|
|
7640
7785
|
force,
|
|
7641
7786
|
noOpen
|
|
@@ -7947,10 +8092,17 @@ async function handleFileBackedRun(options) {
|
|
|
7947
8092
|
} else {
|
|
7948
8093
|
progress.fail();
|
|
7949
8094
|
}
|
|
8095
|
+
const outputStatus = await resolvePlayRunOutputStatus({
|
|
8096
|
+
client,
|
|
8097
|
+
status: finalStatus,
|
|
8098
|
+
fullJson: options.fullJson
|
|
8099
|
+
});
|
|
7950
8100
|
traceCliSync(
|
|
7951
8101
|
"cli.play_write_result",
|
|
7952
8102
|
{ targetKind: "file", playName },
|
|
7953
|
-
() => writePlayResult(
|
|
8103
|
+
() => writePlayResult(outputStatus, options.jsonOutput, {
|
|
8104
|
+
fullJson: options.fullJson
|
|
8105
|
+
})
|
|
7954
8106
|
);
|
|
7955
8107
|
return finalStatus.status === "completed" ? 0 : 1;
|
|
7956
8108
|
}
|
|
@@ -7975,6 +8127,7 @@ async function handleFileBackedRun(options) {
|
|
|
7975
8127
|
playName,
|
|
7976
8128
|
status: started.status,
|
|
7977
8129
|
dashboardUrl: resolvedDashboardUrl,
|
|
8130
|
+
package: options.fullJson ? void 0 : started.package,
|
|
7978
8131
|
jsonOutput: options.jsonOutput,
|
|
7979
8132
|
progress
|
|
7980
8133
|
});
|
|
@@ -8086,10 +8239,17 @@ async function handleNamedRun(options) {
|
|
|
8086
8239
|
} else {
|
|
8087
8240
|
progress.fail();
|
|
8088
8241
|
}
|
|
8242
|
+
const outputStatus = await resolvePlayRunOutputStatus({
|
|
8243
|
+
client,
|
|
8244
|
+
status: finalStatus,
|
|
8245
|
+
fullJson: options.fullJson
|
|
8246
|
+
});
|
|
8089
8247
|
traceCliSync(
|
|
8090
8248
|
"cli.play_write_result",
|
|
8091
8249
|
{ targetKind: "name", playName },
|
|
8092
|
-
() => writePlayResult(
|
|
8250
|
+
() => writePlayResult(outputStatus, options.jsonOutput, {
|
|
8251
|
+
fullJson: options.fullJson
|
|
8252
|
+
})
|
|
8093
8253
|
);
|
|
8094
8254
|
return finalStatus.status === "completed" ? 0 : 1;
|
|
8095
8255
|
}
|
|
@@ -8114,6 +8274,7 @@ async function handleNamedRun(options) {
|
|
|
8114
8274
|
playName: started.name ?? playName,
|
|
8115
8275
|
status: started.status,
|
|
8116
8276
|
dashboardUrl: resolvedDashboardUrl,
|
|
8277
|
+
package: options.fullJson ? void 0 : started.package,
|
|
8117
8278
|
jsonOutput: options.jsonOutput,
|
|
8118
8279
|
progress
|
|
8119
8280
|
});
|
|
@@ -8176,7 +8337,9 @@ async function handleRunGet(args) {
|
|
|
8176
8337
|
return 1;
|
|
8177
8338
|
}
|
|
8178
8339
|
const client = new DeeplineClient();
|
|
8179
|
-
const status = await client.runs.get(runId
|
|
8340
|
+
const status = await client.runs.get(runId, {
|
|
8341
|
+
full: args.includes("--full")
|
|
8342
|
+
});
|
|
8180
8343
|
writePlayResult(status, argsWantJson(args), {
|
|
8181
8344
|
fullJson: args.includes("--full")
|
|
8182
8345
|
});
|
|
@@ -8365,7 +8528,7 @@ async function handleRunExport(args) {
|
|
|
8365
8528
|
return 1;
|
|
8366
8529
|
}
|
|
8367
8530
|
const client = new DeeplineClient();
|
|
8368
|
-
const status = await client.getPlayStatus(runId);
|
|
8531
|
+
const status = await client.getPlayStatus(runId, { full: true });
|
|
8369
8532
|
const exportResult = await exportPlayStatusRows(client, status, outPath, {
|
|
8370
8533
|
datasetPath
|
|
8371
8534
|
});
|
|
@@ -9085,7 +9248,7 @@ Examples:
|
|
|
9085
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(
|
|
9086
9249
|
"--logs",
|
|
9087
9250
|
"When output is non-interactive, stream play logs to stderr while waiting"
|
|
9088
|
-
).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(
|
|
9089
9252
|
"afterAll",
|
|
9090
9253
|
`
|
|
9091
9254
|
Pass-through input flags:
|
|
@@ -9122,6 +9285,7 @@ Pass-through input flags:
|
|
|
9122
9285
|
...options.force ? ["--force"] : [],
|
|
9123
9286
|
...options.noOpen || options.open === false ? ["--no-open"] : [],
|
|
9124
9287
|
...options.json ? ["--json"] : [],
|
|
9288
|
+
...options.full ? ["--full"] : [],
|
|
9125
9289
|
...passthroughArgs
|
|
9126
9290
|
]);
|
|
9127
9291
|
});
|