deepline 0.1.30 → 0.1.31
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 +52 -53
- package/dist/cli/index.mjs +52 -53
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/repo/sdk/src/version.ts +2 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -266,8 +266,8 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
// src/version.ts
|
|
269
|
-
var SDK_VERSION = "0.1.
|
|
270
|
-
var SDK_API_CONTRACT = "2026-05-runs-
|
|
269
|
+
var SDK_VERSION = "0.1.31";
|
|
270
|
+
var SDK_API_CONTRACT = "2026-05-runs-export-v3";
|
|
271
271
|
|
|
272
272
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
273
273
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -6384,7 +6384,7 @@ function stripProviderSpendFromBilling(value) {
|
|
|
6384
6384
|
}
|
|
6385
6385
|
return next;
|
|
6386
6386
|
}
|
|
6387
|
-
function compactPlayStatus(status
|
|
6387
|
+
function compactPlayStatus(status) {
|
|
6388
6388
|
const rowsInfo = extractCanonicalRowsInfo(status);
|
|
6389
6389
|
const result = status && typeof status === "object" ? status.result : null;
|
|
6390
6390
|
const warnings = buildRunWarnings(status, rowsInfo);
|
|
@@ -6413,7 +6413,6 @@ function compactPlayStatus(status, options) {
|
|
|
6413
6413
|
...error ? { error } : {},
|
|
6414
6414
|
...warnings.length > 0 ? { warnings } : {},
|
|
6415
6415
|
...result !== void 0 ? { result } : {},
|
|
6416
|
-
...options?.exportedPath ? { local: { csv_path: options.exportedPath } } : {},
|
|
6417
6416
|
...status.resultView ? { resultView: status.resultView } : {},
|
|
6418
6417
|
...datasetStats ? { dataset_stats: datasetStats } : {},
|
|
6419
6418
|
...billing ? { billing } : {},
|
|
@@ -6455,7 +6454,7 @@ function formatDatasetStatsLines(datasetStats) {
|
|
|
6455
6454
|
}
|
|
6456
6455
|
function writePlayResult(status, jsonOutput, options) {
|
|
6457
6456
|
if (jsonOutput) {
|
|
6458
|
-
const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status
|
|
6457
|
+
const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
|
|
6459
6458
|
printCommandEnvelope({
|
|
6460
6459
|
...payload2,
|
|
6461
6460
|
render: {
|
|
@@ -6485,9 +6484,6 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
6485
6484
|
rowsInfo.columns,
|
|
6486
6485
|
extractDatasetExecutionStats(status)
|
|
6487
6486
|
) : null;
|
|
6488
|
-
if (options?.exportedPath) {
|
|
6489
|
-
lines.push(` exported CSV: file=${options.exportedPath}`);
|
|
6490
|
-
}
|
|
6491
6487
|
for (const warning of warnings) {
|
|
6492
6488
|
lines.push(` warning: ${warning}`);
|
|
6493
6489
|
}
|
|
@@ -6505,7 +6501,7 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
6505
6501
|
lines.push(...renderedServerView.lines);
|
|
6506
6502
|
}
|
|
6507
6503
|
lines.push(...renderedServerView.actions);
|
|
6508
|
-
const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status
|
|
6504
|
+
const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
|
|
6509
6505
|
printCommandEnvelope({
|
|
6510
6506
|
...payload,
|
|
6511
6507
|
render: {
|
|
@@ -6515,8 +6511,6 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
6515
6511
|
` });
|
|
6516
6512
|
}
|
|
6517
6513
|
var RUN_EXPORT_PAGE_SIZE = 5e3;
|
|
6518
|
-
var PLAY_RUN_OUT_EXPORT_ATTEMPTS = 8;
|
|
6519
|
-
var PLAY_RUN_OUT_EXPORT_RETRY_DELAY_MS = 1e3;
|
|
6520
6514
|
function shellSingleQuote(value) {
|
|
6521
6515
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
6522
6516
|
}
|
|
@@ -6565,6 +6559,27 @@ function exportableSheetRow(row) {
|
|
|
6565
6559
|
}
|
|
6566
6560
|
return fallback;
|
|
6567
6561
|
}
|
|
6562
|
+
function mergeExportColumns(preferredColumns, rows) {
|
|
6563
|
+
const columns = [];
|
|
6564
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6565
|
+
for (const column of preferredColumns) {
|
|
6566
|
+
if (!column || seen.has(column)) {
|
|
6567
|
+
continue;
|
|
6568
|
+
}
|
|
6569
|
+
seen.add(column);
|
|
6570
|
+
columns.push(column);
|
|
6571
|
+
}
|
|
6572
|
+
for (const row of rows) {
|
|
6573
|
+
for (const column of Object.keys(row)) {
|
|
6574
|
+
if (seen.has(column)) {
|
|
6575
|
+
continue;
|
|
6576
|
+
}
|
|
6577
|
+
seen.add(column);
|
|
6578
|
+
columns.push(column);
|
|
6579
|
+
}
|
|
6580
|
+
}
|
|
6581
|
+
return columns;
|
|
6582
|
+
}
|
|
6568
6583
|
async function fetchBackingDatasetRows(input) {
|
|
6569
6584
|
const playName = extractRunPlayName(input.status);
|
|
6570
6585
|
const tableNamespace = input.rowsInfo.tableNamespace?.trim();
|
|
@@ -6596,7 +6611,10 @@ async function fetchBackingDatasetRows(input) {
|
|
|
6596
6611
|
if (rows.length < input.rowsInfo.totalRows) {
|
|
6597
6612
|
return null;
|
|
6598
6613
|
}
|
|
6599
|
-
const columns =
|
|
6614
|
+
const columns = mergeExportColumns(
|
|
6615
|
+
input.rowsInfo.columnsExplicit ? input.rowsInfo.columns : [],
|
|
6616
|
+
rows
|
|
6617
|
+
);
|
|
6600
6618
|
return {
|
|
6601
6619
|
...input.rowsInfo,
|
|
6602
6620
|
rows,
|
|
@@ -6638,20 +6656,27 @@ async function exportPlayStatusRows(client, status, outPath, options = {}) {
|
|
|
6638
6656
|
const attempts = Math.max(1, Math.trunc(options.attempts ?? 1));
|
|
6639
6657
|
const retryDelayMs = Math.max(0, Math.trunc(options.retryDelayMs ?? 0));
|
|
6640
6658
|
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
6641
|
-
|
|
6642
|
-
|
|
6659
|
+
let fetchedRowsInfo = null;
|
|
6660
|
+
try {
|
|
6661
|
+
fetchedRowsInfo = await fetchBackingDatasetRows({
|
|
6662
|
+
client,
|
|
6663
|
+
status,
|
|
6664
|
+
rowsInfo
|
|
6665
|
+
});
|
|
6666
|
+
} catch (error) {
|
|
6667
|
+
if (!rowsInfo.complete) {
|
|
6668
|
+
throw error;
|
|
6669
|
+
}
|
|
6643
6670
|
}
|
|
6644
|
-
const fetchedRowsInfo = await fetchBackingDatasetRows({
|
|
6645
|
-
client,
|
|
6646
|
-
status,
|
|
6647
|
-
rowsInfo
|
|
6648
|
-
});
|
|
6649
6671
|
if (fetchedRowsInfo?.complete) {
|
|
6650
6672
|
return {
|
|
6651
6673
|
path: writeCanonicalRowsCsv(fetchedRowsInfo, outPath),
|
|
6652
6674
|
rowsInfo: fetchedRowsInfo
|
|
6653
6675
|
};
|
|
6654
6676
|
}
|
|
6677
|
+
if (rowsInfo.complete) {
|
|
6678
|
+
return { path: writeCanonicalRowsCsv(rowsInfo, outPath), rowsInfo };
|
|
6679
|
+
}
|
|
6655
6680
|
if (attempt < attempts && retryDelayMs > 0) {
|
|
6656
6681
|
await sleep4(retryDelayMs);
|
|
6657
6682
|
}
|
|
@@ -6779,7 +6804,7 @@ function writeStartedPlayRun(input) {
|
|
|
6779
6804
|
` });
|
|
6780
6805
|
}
|
|
6781
6806
|
function parsePlayRunOptions(args) {
|
|
6782
|
-
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--
|
|
6807
|
+
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--watch] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--watch] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--watch] [--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.";
|
|
6783
6808
|
let filePath = null;
|
|
6784
6809
|
let playName = null;
|
|
6785
6810
|
let input = null;
|
|
@@ -6790,7 +6815,6 @@ function parsePlayRunOptions(args) {
|
|
|
6790
6815
|
const emitLogs = !jsonOutput || args.includes("--logs");
|
|
6791
6816
|
const force = args.includes("--force");
|
|
6792
6817
|
const noOpen = args.includes("--no-open");
|
|
6793
|
-
let outPath = null;
|
|
6794
6818
|
let waitTimeoutMs = null;
|
|
6795
6819
|
for (let index = 0; index < args.length; index += 1) {
|
|
6796
6820
|
const arg = args[index];
|
|
@@ -6818,9 +6842,10 @@ function parsePlayRunOptions(args) {
|
|
|
6818
6842
|
revisionSelector = "latest";
|
|
6819
6843
|
continue;
|
|
6820
6844
|
}
|
|
6821
|
-
if (arg === "--out"
|
|
6822
|
-
|
|
6823
|
-
|
|
6845
|
+
if (arg === "--out" || arg.startsWith("--out=")) {
|
|
6846
|
+
throw new Error(
|
|
6847
|
+
"--out is not a plays run flag. Run the play first, then export rows with: deepline runs export <run-id> --out output.csv"
|
|
6848
|
+
);
|
|
6824
6849
|
}
|
|
6825
6850
|
if (arg === "--poll-interval-ms" || arg === "--interval-ms") {
|
|
6826
6851
|
throw new Error(
|
|
@@ -6890,11 +6915,6 @@ function parsePlayRunOptions(args) {
|
|
|
6890
6915
|
"--live, --latest, and --revision-id only apply to named plays."
|
|
6891
6916
|
);
|
|
6892
6917
|
}
|
|
6893
|
-
if (outPath && !watch) {
|
|
6894
|
-
throw new Error(
|
|
6895
|
-
"--out requires --watch so the CLI can export the completed run output."
|
|
6896
|
-
);
|
|
6897
|
-
}
|
|
6898
6918
|
return {
|
|
6899
6919
|
target: filePath ? { kind: "file", path: filePath } : { kind: "name", name: playName },
|
|
6900
6920
|
input,
|
|
@@ -6905,7 +6925,6 @@ function parsePlayRunOptions(args) {
|
|
|
6905
6925
|
jsonOutput,
|
|
6906
6926
|
waitTimeoutMs,
|
|
6907
6927
|
force,
|
|
6908
|
-
outPath,
|
|
6909
6928
|
noOpen
|
|
6910
6929
|
};
|
|
6911
6930
|
}
|
|
@@ -7080,14 +7099,6 @@ async function handleFileBackedRun(options) {
|
|
|
7080
7099
|
progress
|
|
7081
7100
|
})
|
|
7082
7101
|
);
|
|
7083
|
-
const exportResult = await traceCliSpan(
|
|
7084
|
-
"cli.play_export_rows",
|
|
7085
|
-
{ targetKind: "file", playName },
|
|
7086
|
-
() => exportPlayStatusRows(client, finalStatus, options.outPath, {
|
|
7087
|
-
attempts: PLAY_RUN_OUT_EXPORT_ATTEMPTS,
|
|
7088
|
-
retryDelayMs: PLAY_RUN_OUT_EXPORT_RETRY_DELAY_MS
|
|
7089
|
-
})
|
|
7090
|
-
);
|
|
7091
7102
|
if (finalStatus.status === "completed") {
|
|
7092
7103
|
progress.complete();
|
|
7093
7104
|
} else {
|
|
@@ -7096,7 +7107,7 @@ async function handleFileBackedRun(options) {
|
|
|
7096
7107
|
traceCliSync(
|
|
7097
7108
|
"cli.play_write_result",
|
|
7098
7109
|
{ targetKind: "file", playName },
|
|
7099
|
-
() => writePlayResult(finalStatus, options.jsonOutput
|
|
7110
|
+
() => writePlayResult(finalStatus, options.jsonOutput)
|
|
7100
7111
|
);
|
|
7101
7112
|
return finalStatus.status === "completed" ? 0 : 1;
|
|
7102
7113
|
}
|
|
@@ -7224,14 +7235,6 @@ async function handleNamedRun(options) {
|
|
|
7224
7235
|
progress
|
|
7225
7236
|
})
|
|
7226
7237
|
);
|
|
7227
|
-
const exportResult = await traceCliSpan(
|
|
7228
|
-
"cli.play_export_rows",
|
|
7229
|
-
{ targetKind: "name", playName },
|
|
7230
|
-
() => exportPlayStatusRows(client, finalStatus, options.outPath, {
|
|
7231
|
-
attempts: PLAY_RUN_OUT_EXPORT_ATTEMPTS,
|
|
7232
|
-
retryDelayMs: PLAY_RUN_OUT_EXPORT_RETRY_DELAY_MS
|
|
7233
|
-
})
|
|
7234
|
-
);
|
|
7235
7238
|
if (finalStatus.status === "completed") {
|
|
7236
7239
|
progress.complete();
|
|
7237
7240
|
} else {
|
|
@@ -7240,7 +7243,7 @@ async function handleNamedRun(options) {
|
|
|
7240
7243
|
traceCliSync(
|
|
7241
7244
|
"cli.play_write_result",
|
|
7242
7245
|
{ targetKind: "name", playName },
|
|
7243
|
-
() => writePlayResult(finalStatus, options.jsonOutput
|
|
7246
|
+
() => writePlayResult(finalStatus, options.jsonOutput)
|
|
7244
7247
|
);
|
|
7245
7248
|
return finalStatus.status === "completed" ? 0 : 1;
|
|
7246
7249
|
}
|
|
@@ -8006,17 +8009,14 @@ Idempotent execution:
|
|
|
8006
8009
|
Examples:
|
|
8007
8010
|
deepline plays run my.play.ts --input '{"domain":"stripe.com"}' --watch
|
|
8008
8011
|
deepline plays run my.play.ts --input @input.json --wait --json
|
|
8009
|
-
deepline plays run enrich.play.ts --input '{"file":"leads.csv"}' --watch --out leads-enriched.csv
|
|
8010
8012
|
deepline plays run person-linkedin-to-email --input '{"linkedin_url":"..."}' --watch
|
|
8011
8013
|
deepline plays run cto-search.play.ts --limit 5 --watch
|
|
8014
|
+
deepline runs export <run-id> --out output.csv
|
|
8012
8015
|
deepline runs get <run-id>
|
|
8013
8016
|
`
|
|
8014
8017
|
).option("--file <path>", "Local play file to run").option("--name <name>", "Saved play name to run").option("-i, --input <json>", "Input JSON object or @file path").option("--live", "Run the current live revision explicitly").option("--latest", "Run the newest saved revision, even if it is not live").option(
|
|
8015
8018
|
"--revision-id <id>",
|
|
8016
8019
|
"Run a specific saved revision instead of the live revision"
|
|
8017
|
-
).option(
|
|
8018
|
-
"--out <path>",
|
|
8019
|
-
"Write the completed row output to CSV; requires --watch"
|
|
8020
8020
|
).option("--watch", "Stream logs until completion").option("--wait", "Alias for --watch; stream logs until completion").option(
|
|
8021
8021
|
"--logs",
|
|
8022
8022
|
"When output is non-interactive, stream play logs to stderr while waiting"
|
|
@@ -8048,7 +8048,6 @@ Pass-through input flags:
|
|
|
8048
8048
|
...options.live ? ["--live"] : [],
|
|
8049
8049
|
...options.latest ? ["--latest"] : [],
|
|
8050
8050
|
...options.revisionId ? ["--revision-id", options.revisionId] : [],
|
|
8051
|
-
...options.out ? ["--out", options.out] : [],
|
|
8052
8051
|
...options.watch || options.wait ? ["--watch"] : [],
|
|
8053
8052
|
...options.logs ? ["--logs"] : [],
|
|
8054
8053
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
package/dist/cli/index.mjs
CHANGED
|
@@ -243,8 +243,8 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
// src/version.ts
|
|
246
|
-
var SDK_VERSION = "0.1.
|
|
247
|
-
var SDK_API_CONTRACT = "2026-05-runs-
|
|
246
|
+
var SDK_VERSION = "0.1.31";
|
|
247
|
+
var SDK_API_CONTRACT = "2026-05-runs-export-v3";
|
|
248
248
|
|
|
249
249
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
250
250
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -6371,7 +6371,7 @@ function stripProviderSpendFromBilling(value) {
|
|
|
6371
6371
|
}
|
|
6372
6372
|
return next;
|
|
6373
6373
|
}
|
|
6374
|
-
function compactPlayStatus(status
|
|
6374
|
+
function compactPlayStatus(status) {
|
|
6375
6375
|
const rowsInfo = extractCanonicalRowsInfo(status);
|
|
6376
6376
|
const result = status && typeof status === "object" ? status.result : null;
|
|
6377
6377
|
const warnings = buildRunWarnings(status, rowsInfo);
|
|
@@ -6400,7 +6400,6 @@ function compactPlayStatus(status, options) {
|
|
|
6400
6400
|
...error ? { error } : {},
|
|
6401
6401
|
...warnings.length > 0 ? { warnings } : {},
|
|
6402
6402
|
...result !== void 0 ? { result } : {},
|
|
6403
|
-
...options?.exportedPath ? { local: { csv_path: options.exportedPath } } : {},
|
|
6404
6403
|
...status.resultView ? { resultView: status.resultView } : {},
|
|
6405
6404
|
...datasetStats ? { dataset_stats: datasetStats } : {},
|
|
6406
6405
|
...billing ? { billing } : {},
|
|
@@ -6442,7 +6441,7 @@ function formatDatasetStatsLines(datasetStats) {
|
|
|
6442
6441
|
}
|
|
6443
6442
|
function writePlayResult(status, jsonOutput, options) {
|
|
6444
6443
|
if (jsonOutput) {
|
|
6445
|
-
const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status
|
|
6444
|
+
const payload2 = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
|
|
6446
6445
|
printCommandEnvelope({
|
|
6447
6446
|
...payload2,
|
|
6448
6447
|
render: {
|
|
@@ -6472,9 +6471,6 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
6472
6471
|
rowsInfo.columns,
|
|
6473
6472
|
extractDatasetExecutionStats(status)
|
|
6474
6473
|
) : null;
|
|
6475
|
-
if (options?.exportedPath) {
|
|
6476
|
-
lines.push(` exported CSV: file=${options.exportedPath}`);
|
|
6477
|
-
}
|
|
6478
6474
|
for (const warning of warnings) {
|
|
6479
6475
|
lines.push(` warning: ${warning}`);
|
|
6480
6476
|
}
|
|
@@ -6492,7 +6488,7 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
6492
6488
|
lines.push(...renderedServerView.lines);
|
|
6493
6489
|
}
|
|
6494
6490
|
lines.push(...renderedServerView.actions);
|
|
6495
|
-
const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status
|
|
6491
|
+
const payload = options?.fullJson ? enrichPlayStatusWithDatasetStats(status) : compactPlayStatus(status);
|
|
6496
6492
|
printCommandEnvelope({
|
|
6497
6493
|
...payload,
|
|
6498
6494
|
render: {
|
|
@@ -6502,8 +6498,6 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
6502
6498
|
` });
|
|
6503
6499
|
}
|
|
6504
6500
|
var RUN_EXPORT_PAGE_SIZE = 5e3;
|
|
6505
|
-
var PLAY_RUN_OUT_EXPORT_ATTEMPTS = 8;
|
|
6506
|
-
var PLAY_RUN_OUT_EXPORT_RETRY_DELAY_MS = 1e3;
|
|
6507
6501
|
function shellSingleQuote(value) {
|
|
6508
6502
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
6509
6503
|
}
|
|
@@ -6552,6 +6546,27 @@ function exportableSheetRow(row) {
|
|
|
6552
6546
|
}
|
|
6553
6547
|
return fallback;
|
|
6554
6548
|
}
|
|
6549
|
+
function mergeExportColumns(preferredColumns, rows) {
|
|
6550
|
+
const columns = [];
|
|
6551
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6552
|
+
for (const column of preferredColumns) {
|
|
6553
|
+
if (!column || seen.has(column)) {
|
|
6554
|
+
continue;
|
|
6555
|
+
}
|
|
6556
|
+
seen.add(column);
|
|
6557
|
+
columns.push(column);
|
|
6558
|
+
}
|
|
6559
|
+
for (const row of rows) {
|
|
6560
|
+
for (const column of Object.keys(row)) {
|
|
6561
|
+
if (seen.has(column)) {
|
|
6562
|
+
continue;
|
|
6563
|
+
}
|
|
6564
|
+
seen.add(column);
|
|
6565
|
+
columns.push(column);
|
|
6566
|
+
}
|
|
6567
|
+
}
|
|
6568
|
+
return columns;
|
|
6569
|
+
}
|
|
6555
6570
|
async function fetchBackingDatasetRows(input) {
|
|
6556
6571
|
const playName = extractRunPlayName(input.status);
|
|
6557
6572
|
const tableNamespace = input.rowsInfo.tableNamespace?.trim();
|
|
@@ -6583,7 +6598,10 @@ async function fetchBackingDatasetRows(input) {
|
|
|
6583
6598
|
if (rows.length < input.rowsInfo.totalRows) {
|
|
6584
6599
|
return null;
|
|
6585
6600
|
}
|
|
6586
|
-
const columns =
|
|
6601
|
+
const columns = mergeExportColumns(
|
|
6602
|
+
input.rowsInfo.columnsExplicit ? input.rowsInfo.columns : [],
|
|
6603
|
+
rows
|
|
6604
|
+
);
|
|
6587
6605
|
return {
|
|
6588
6606
|
...input.rowsInfo,
|
|
6589
6607
|
rows,
|
|
@@ -6625,20 +6643,27 @@ async function exportPlayStatusRows(client, status, outPath, options = {}) {
|
|
|
6625
6643
|
const attempts = Math.max(1, Math.trunc(options.attempts ?? 1));
|
|
6626
6644
|
const retryDelayMs = Math.max(0, Math.trunc(options.retryDelayMs ?? 0));
|
|
6627
6645
|
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
6628
|
-
|
|
6629
|
-
|
|
6646
|
+
let fetchedRowsInfo = null;
|
|
6647
|
+
try {
|
|
6648
|
+
fetchedRowsInfo = await fetchBackingDatasetRows({
|
|
6649
|
+
client,
|
|
6650
|
+
status,
|
|
6651
|
+
rowsInfo
|
|
6652
|
+
});
|
|
6653
|
+
} catch (error) {
|
|
6654
|
+
if (!rowsInfo.complete) {
|
|
6655
|
+
throw error;
|
|
6656
|
+
}
|
|
6630
6657
|
}
|
|
6631
|
-
const fetchedRowsInfo = await fetchBackingDatasetRows({
|
|
6632
|
-
client,
|
|
6633
|
-
status,
|
|
6634
|
-
rowsInfo
|
|
6635
|
-
});
|
|
6636
6658
|
if (fetchedRowsInfo?.complete) {
|
|
6637
6659
|
return {
|
|
6638
6660
|
path: writeCanonicalRowsCsv(fetchedRowsInfo, outPath),
|
|
6639
6661
|
rowsInfo: fetchedRowsInfo
|
|
6640
6662
|
};
|
|
6641
6663
|
}
|
|
6664
|
+
if (rowsInfo.complete) {
|
|
6665
|
+
return { path: writeCanonicalRowsCsv(rowsInfo, outPath), rowsInfo };
|
|
6666
|
+
}
|
|
6642
6667
|
if (attempt < attempts && retryDelayMs > 0) {
|
|
6643
6668
|
await sleep4(retryDelayMs);
|
|
6644
6669
|
}
|
|
@@ -6766,7 +6791,7 @@ function writeStartedPlayRun(input) {
|
|
|
6766
6791
|
` });
|
|
6767
6792
|
}
|
|
6768
6793
|
function parsePlayRunOptions(args) {
|
|
6769
|
-
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--
|
|
6794
|
+
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--watch] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--watch] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--watch] [--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.";
|
|
6770
6795
|
let filePath = null;
|
|
6771
6796
|
let playName = null;
|
|
6772
6797
|
let input = null;
|
|
@@ -6777,7 +6802,6 @@ function parsePlayRunOptions(args) {
|
|
|
6777
6802
|
const emitLogs = !jsonOutput || args.includes("--logs");
|
|
6778
6803
|
const force = args.includes("--force");
|
|
6779
6804
|
const noOpen = args.includes("--no-open");
|
|
6780
|
-
let outPath = null;
|
|
6781
6805
|
let waitTimeoutMs = null;
|
|
6782
6806
|
for (let index = 0; index < args.length; index += 1) {
|
|
6783
6807
|
const arg = args[index];
|
|
@@ -6805,9 +6829,10 @@ function parsePlayRunOptions(args) {
|
|
|
6805
6829
|
revisionSelector = "latest";
|
|
6806
6830
|
continue;
|
|
6807
6831
|
}
|
|
6808
|
-
if (arg === "--out"
|
|
6809
|
-
|
|
6810
|
-
|
|
6832
|
+
if (arg === "--out" || arg.startsWith("--out=")) {
|
|
6833
|
+
throw new Error(
|
|
6834
|
+
"--out is not a plays run flag. Run the play first, then export rows with: deepline runs export <run-id> --out output.csv"
|
|
6835
|
+
);
|
|
6811
6836
|
}
|
|
6812
6837
|
if (arg === "--poll-interval-ms" || arg === "--interval-ms") {
|
|
6813
6838
|
throw new Error(
|
|
@@ -6877,11 +6902,6 @@ function parsePlayRunOptions(args) {
|
|
|
6877
6902
|
"--live, --latest, and --revision-id only apply to named plays."
|
|
6878
6903
|
);
|
|
6879
6904
|
}
|
|
6880
|
-
if (outPath && !watch) {
|
|
6881
|
-
throw new Error(
|
|
6882
|
-
"--out requires --watch so the CLI can export the completed run output."
|
|
6883
|
-
);
|
|
6884
|
-
}
|
|
6885
6905
|
return {
|
|
6886
6906
|
target: filePath ? { kind: "file", path: filePath } : { kind: "name", name: playName },
|
|
6887
6907
|
input,
|
|
@@ -6892,7 +6912,6 @@ function parsePlayRunOptions(args) {
|
|
|
6892
6912
|
jsonOutput,
|
|
6893
6913
|
waitTimeoutMs,
|
|
6894
6914
|
force,
|
|
6895
|
-
outPath,
|
|
6896
6915
|
noOpen
|
|
6897
6916
|
};
|
|
6898
6917
|
}
|
|
@@ -7067,14 +7086,6 @@ async function handleFileBackedRun(options) {
|
|
|
7067
7086
|
progress
|
|
7068
7087
|
})
|
|
7069
7088
|
);
|
|
7070
|
-
const exportResult = await traceCliSpan(
|
|
7071
|
-
"cli.play_export_rows",
|
|
7072
|
-
{ targetKind: "file", playName },
|
|
7073
|
-
() => exportPlayStatusRows(client, finalStatus, options.outPath, {
|
|
7074
|
-
attempts: PLAY_RUN_OUT_EXPORT_ATTEMPTS,
|
|
7075
|
-
retryDelayMs: PLAY_RUN_OUT_EXPORT_RETRY_DELAY_MS
|
|
7076
|
-
})
|
|
7077
|
-
);
|
|
7078
7089
|
if (finalStatus.status === "completed") {
|
|
7079
7090
|
progress.complete();
|
|
7080
7091
|
} else {
|
|
@@ -7083,7 +7094,7 @@ async function handleFileBackedRun(options) {
|
|
|
7083
7094
|
traceCliSync(
|
|
7084
7095
|
"cli.play_write_result",
|
|
7085
7096
|
{ targetKind: "file", playName },
|
|
7086
|
-
() => writePlayResult(finalStatus, options.jsonOutput
|
|
7097
|
+
() => writePlayResult(finalStatus, options.jsonOutput)
|
|
7087
7098
|
);
|
|
7088
7099
|
return finalStatus.status === "completed" ? 0 : 1;
|
|
7089
7100
|
}
|
|
@@ -7211,14 +7222,6 @@ async function handleNamedRun(options) {
|
|
|
7211
7222
|
progress
|
|
7212
7223
|
})
|
|
7213
7224
|
);
|
|
7214
|
-
const exportResult = await traceCliSpan(
|
|
7215
|
-
"cli.play_export_rows",
|
|
7216
|
-
{ targetKind: "name", playName },
|
|
7217
|
-
() => exportPlayStatusRows(client, finalStatus, options.outPath, {
|
|
7218
|
-
attempts: PLAY_RUN_OUT_EXPORT_ATTEMPTS,
|
|
7219
|
-
retryDelayMs: PLAY_RUN_OUT_EXPORT_RETRY_DELAY_MS
|
|
7220
|
-
})
|
|
7221
|
-
);
|
|
7222
7225
|
if (finalStatus.status === "completed") {
|
|
7223
7226
|
progress.complete();
|
|
7224
7227
|
} else {
|
|
@@ -7227,7 +7230,7 @@ async function handleNamedRun(options) {
|
|
|
7227
7230
|
traceCliSync(
|
|
7228
7231
|
"cli.play_write_result",
|
|
7229
7232
|
{ targetKind: "name", playName },
|
|
7230
|
-
() => writePlayResult(finalStatus, options.jsonOutput
|
|
7233
|
+
() => writePlayResult(finalStatus, options.jsonOutput)
|
|
7231
7234
|
);
|
|
7232
7235
|
return finalStatus.status === "completed" ? 0 : 1;
|
|
7233
7236
|
}
|
|
@@ -7993,17 +7996,14 @@ Idempotent execution:
|
|
|
7993
7996
|
Examples:
|
|
7994
7997
|
deepline plays run my.play.ts --input '{"domain":"stripe.com"}' --watch
|
|
7995
7998
|
deepline plays run my.play.ts --input @input.json --wait --json
|
|
7996
|
-
deepline plays run enrich.play.ts --input '{"file":"leads.csv"}' --watch --out leads-enriched.csv
|
|
7997
7999
|
deepline plays run person-linkedin-to-email --input '{"linkedin_url":"..."}' --watch
|
|
7998
8000
|
deepline plays run cto-search.play.ts --limit 5 --watch
|
|
8001
|
+
deepline runs export <run-id> --out output.csv
|
|
7999
8002
|
deepline runs get <run-id>
|
|
8000
8003
|
`
|
|
8001
8004
|
).option("--file <path>", "Local play file to run").option("--name <name>", "Saved play name to run").option("-i, --input <json>", "Input JSON object or @file path").option("--live", "Run the current live revision explicitly").option("--latest", "Run the newest saved revision, even if it is not live").option(
|
|
8002
8005
|
"--revision-id <id>",
|
|
8003
8006
|
"Run a specific saved revision instead of the live revision"
|
|
8004
|
-
).option(
|
|
8005
|
-
"--out <path>",
|
|
8006
|
-
"Write the completed row output to CSV; requires --watch"
|
|
8007
8007
|
).option("--watch", "Stream logs until completion").option("--wait", "Alias for --watch; stream logs until completion").option(
|
|
8008
8008
|
"--logs",
|
|
8009
8009
|
"When output is non-interactive, stream play logs to stderr while waiting"
|
|
@@ -8035,7 +8035,6 @@ Pass-through input flags:
|
|
|
8035
8035
|
...options.live ? ["--live"] : [],
|
|
8036
8036
|
...options.latest ? ["--latest"] : [],
|
|
8037
8037
|
...options.revisionId ? ["--revision-id", options.revisionId] : [],
|
|
8038
|
-
...options.out ? ["--out", options.out] : [],
|
|
8039
8038
|
...options.watch || options.wait ? ["--watch"] : [],
|
|
8040
8039
|
...options.logs ? ["--logs"] : [],
|
|
8041
8040
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
package/dist/index.d.mts
CHANGED
|
@@ -1438,8 +1438,8 @@ declare class DeeplineClient {
|
|
|
1438
1438
|
}>;
|
|
1439
1439
|
}
|
|
1440
1440
|
|
|
1441
|
-
declare const SDK_VERSION = "0.1.
|
|
1442
|
-
declare const SDK_API_CONTRACT = "2026-05-runs-
|
|
1441
|
+
declare const SDK_VERSION = "0.1.31";
|
|
1442
|
+
declare const SDK_API_CONTRACT = "2026-05-runs-export-v3";
|
|
1443
1443
|
|
|
1444
1444
|
/**
|
|
1445
1445
|
* Base error class for all Deepline SDK errors.
|
package/dist/index.d.ts
CHANGED
|
@@ -1438,8 +1438,8 @@ declare class DeeplineClient {
|
|
|
1438
1438
|
}>;
|
|
1439
1439
|
}
|
|
1440
1440
|
|
|
1441
|
-
declare const SDK_VERSION = "0.1.
|
|
1442
|
-
declare const SDK_API_CONTRACT = "2026-05-runs-
|
|
1441
|
+
declare const SDK_VERSION = "0.1.31";
|
|
1442
|
+
declare const SDK_API_CONTRACT = "2026-05-runs-export-v3";
|
|
1443
1443
|
|
|
1444
1444
|
/**
|
|
1445
1445
|
* Base error class for all Deepline SDK errors.
|
package/dist/index.js
CHANGED
|
@@ -241,8 +241,8 @@ function resolveConfig(options) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
// src/version.ts
|
|
244
|
-
var SDK_VERSION = "0.1.
|
|
245
|
-
var SDK_API_CONTRACT = "2026-05-runs-
|
|
244
|
+
var SDK_VERSION = "0.1.31";
|
|
245
|
+
var SDK_API_CONTRACT = "2026-05-runs-export-v3";
|
|
246
246
|
|
|
247
247
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
248
248
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
package/dist/index.mjs
CHANGED
|
@@ -195,8 +195,8 @@ function resolveConfig(options) {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
// src/version.ts
|
|
198
|
-
var SDK_VERSION = "0.1.
|
|
199
|
-
var SDK_API_CONTRACT = "2026-05-runs-
|
|
198
|
+
var SDK_VERSION = "0.1.31";
|
|
199
|
+
var SDK_API_CONTRACT = "2026-05-runs-export-v3";
|
|
200
200
|
|
|
201
201
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
202
202
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.
|
|
2
|
-
export const SDK_API_CONTRACT = "2026-05-runs-
|
|
1
|
+
export const SDK_VERSION = "0.1.31";
|
|
2
|
+
export const SDK_API_CONTRACT = "2026-05-runs-export-v3";
|