deepline 0.3.274 → 0.3.276
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/bundling-sources/sdk/src/client.ts +148 -19
- package/dist/bundling-sources/sdk/src/index.ts +3 -0
- package/dist/bundling-sources/sdk/src/play.ts +4 -10
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/log-cursor.ts +35 -0
- package/dist/bundling-sources/sdk/src/types.ts +10 -3
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +12 -26
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +7 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +15 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +18 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts +7 -4
- package/dist/bundling-sources/shared_libs/plays/table-csv.ts +152 -0
- package/dist/cli/index.js +411 -284
- package/dist/cli/index.mjs +411 -284
- package/dist/{client-2rIHKJiq.d.mts → client-C0EhEIQO.d.mts} +78 -13
- package/dist/{client-D6fRwhnE.d.ts → client-HxPrGPbv.d.ts} +78 -13
- package/dist/index.d.mts +6 -12
- package/dist/index.d.ts +6 -12
- package/dist/index.js +87 -9
- package/dist/index.mjs +87 -9
- package/dist/install-integrity.json +4 -2
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1998,18 +1998,18 @@ function playInputExampleArgs(schema) {
|
|
|
1998
1998
|
if (!schema) return " --input '@<input.json>'";
|
|
1999
1999
|
if (schema.$ref || schema.allOf) return " --input '@<input.json>'";
|
|
2000
2000
|
const csv = schema.csvInput;
|
|
2001
|
-
const
|
|
2001
|
+
const csvField2 = typeof csv?.inputField === "string" ? csv.inputField : null;
|
|
2002
2002
|
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
2003
|
-
const csvOnlyRequired = required.every((key) => key ===
|
|
2003
|
+
const csvOnlyRequired = required.every((key) => key === csvField2);
|
|
2004
2004
|
const alternatives = schema.oneOf ?? schema.anyOf;
|
|
2005
2005
|
const hasCsvAlternative = Array.isArray(alternatives) && alternatives.some((branch) => {
|
|
2006
2006
|
if (!branch || typeof branch !== "object") return false;
|
|
2007
2007
|
const keys = branch.required;
|
|
2008
|
-
return Array.isArray(keys) && keys.includes(
|
|
2008
|
+
return Array.isArray(keys) && keys.includes(csvField2) && keys.every((key) => key === csvField2);
|
|
2009
2009
|
});
|
|
2010
|
-
if (
|
|
2011
|
-
if (
|
|
2012
|
-
const value = JSON.stringify({ [
|
|
2010
|
+
if (csvField2 && csvOnlyRequired && (!alternatives || hasCsvAlternative)) {
|
|
2011
|
+
if (csvField2 === "csv") return " --csv '<contacts.csv>'";
|
|
2012
|
+
const value = JSON.stringify({ [csvField2]: "<contacts.csv>" });
|
|
2013
2013
|
return ` --input '${value.replace(/'/g, "'\\''")}'`;
|
|
2014
2014
|
}
|
|
2015
2015
|
if (Array.isArray(schema.required) && !required.length && !csv && !alternatives) {
|
|
@@ -3512,7 +3512,7 @@ var SDK_RELEASE = {
|
|
|
3512
3512
|
// getters keep their established compatibility behavior.
|
|
3513
3513
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3514
3514
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3515
|
-
version: "0.3.
|
|
3515
|
+
version: "0.3.276",
|
|
3516
3516
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
3517
3517
|
packageCapabilities: {
|
|
3518
3518
|
updatePreferences: 1
|
|
@@ -6215,6 +6215,28 @@ async function* watchRunEvents(options) {
|
|
|
6215
6215
|
}
|
|
6216
6216
|
}
|
|
6217
6217
|
|
|
6218
|
+
// src/runs/log-cursor.ts
|
|
6219
|
+
var RUN_LOGS_CURSOR_PREFIX = "before:";
|
|
6220
|
+
function encodeRunLogsCursor(beforeSequence) {
|
|
6221
|
+
return `${RUN_LOGS_CURSOR_PREFIX}${beforeSequence}`;
|
|
6222
|
+
}
|
|
6223
|
+
function isRunLogsCursor(value) {
|
|
6224
|
+
return value.startsWith(RUN_LOGS_CURSOR_PREFIX);
|
|
6225
|
+
}
|
|
6226
|
+
function parseRunLogsCursor(value) {
|
|
6227
|
+
const raw = isRunLogsCursor(value) ? value.slice(RUN_LOGS_CURSOR_PREFIX.length) : "";
|
|
6228
|
+
const parsed = /^[1-9]\d*$/.test(raw) ? Number(raw) : NaN;
|
|
6229
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
6230
|
+
throw Object.assign(
|
|
6231
|
+
new Error(
|
|
6232
|
+
`Invalid run log cursor ${JSON.stringify(value)}. Pass the nextCursor value from a previous deepline runs logs result.`
|
|
6233
|
+
),
|
|
6234
|
+
{ exitCode: 2 }
|
|
6235
|
+
);
|
|
6236
|
+
}
|
|
6237
|
+
return parsed;
|
|
6238
|
+
}
|
|
6239
|
+
|
|
6218
6240
|
// src/types.ts
|
|
6219
6241
|
function isStopAllPlayRunsDryRunResult(result) {
|
|
6220
6242
|
return "dryRun" in result && result.dryRun === true;
|
|
@@ -7165,6 +7187,7 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
7165
7187
|
status: (runId) => this.getRunLifecycleStatus(runId),
|
|
7166
7188
|
list: (options2) => this.listRuns(options2),
|
|
7167
7189
|
listPage: (options2) => this.listRunsPage(options2),
|
|
7190
|
+
history: (options2) => this.getRunsHistory(options2),
|
|
7168
7191
|
watch: (runId, options2) => this.watchRunToTerminal(runId, options2),
|
|
7169
7192
|
tail: (runId, options2) => this.tailRun(runId, options2),
|
|
7170
7193
|
logs: (runId, options2) => this.getRunLogs(runId, options2),
|
|
@@ -8242,11 +8265,21 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8242
8265
|
if (options?.full === true) {
|
|
8243
8266
|
params.set("full", "true");
|
|
8244
8267
|
}
|
|
8268
|
+
if (options?.configuration === true) {
|
|
8269
|
+
params.set("include", "configuration");
|
|
8270
|
+
}
|
|
8245
8271
|
const query = params.size > 0 ? `?${params.toString()}` : "";
|
|
8246
8272
|
const response = await this.http.get(
|
|
8247
8273
|
`/api/v2/runs/${encodeURIComponent(runId)}${query}`,
|
|
8248
8274
|
{ headers: { "x-deepline-run-status": "1" } }
|
|
8249
8275
|
);
|
|
8276
|
+
if (options?.configuration === true && !Object.hasOwn(response, "contract")) {
|
|
8277
|
+
throw new DeeplineError(
|
|
8278
|
+
"This server does not support recorded configuration reads.",
|
|
8279
|
+
void 0,
|
|
8280
|
+
"RUN_CONFIGURATION_UNAVAILABLE"
|
|
8281
|
+
);
|
|
8282
|
+
}
|
|
8250
8283
|
const status = normalizePlayStatus(response);
|
|
8251
8284
|
if (options?.failedLogs !== true || status.status !== "failed") {
|
|
8252
8285
|
return status;
|
|
@@ -8334,6 +8367,33 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8334
8367
|
async listRuns(options) {
|
|
8335
8368
|
return (await this.listRunsPage(options)).runs;
|
|
8336
8369
|
}
|
|
8370
|
+
/** The same tenant-scoped run history searched by the dashboard and CLI. */
|
|
8371
|
+
async getRunsHistory(options = {}) {
|
|
8372
|
+
const params = new URLSearchParams();
|
|
8373
|
+
const search = options.search?.trim();
|
|
8374
|
+
if (search && search.length > 200) {
|
|
8375
|
+
throw new Error("Run search must be at most 200 characters.");
|
|
8376
|
+
}
|
|
8377
|
+
if (options.type && options.type !== "all" && !search) {
|
|
8378
|
+
throw new Error("runs.history options.type requires options.search.");
|
|
8379
|
+
}
|
|
8380
|
+
if (search) params.set("search", search);
|
|
8381
|
+
if (search && options.type) params.set("type", options.type);
|
|
8382
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
8383
|
+
if (options.orgId) params.set("orgId", options.orgId);
|
|
8384
|
+
if (options.limit !== void 0) {
|
|
8385
|
+
if (!Number.isSafeInteger(options.limit) || options.limit < 1) {
|
|
8386
|
+
throw new Error(
|
|
8387
|
+
"runs.history options.limit must be a positive integer."
|
|
8388
|
+
);
|
|
8389
|
+
}
|
|
8390
|
+
params.set("limit", String(options.limit));
|
|
8391
|
+
}
|
|
8392
|
+
return this.http.get(
|
|
8393
|
+
`/api/v2/dashboard/runs-history?${params.toString()}`,
|
|
8394
|
+
{ signal: options.signal }
|
|
8395
|
+
);
|
|
8396
|
+
}
|
|
8337
8397
|
/** Read one run page without discarding server pagination metadata. */
|
|
8338
8398
|
async listRunsPage(options) {
|
|
8339
8399
|
const playName = options.play?.trim();
|
|
@@ -8440,6 +8500,13 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8440
8500
|
"INVALID_RUN_LOG_VIEW"
|
|
8441
8501
|
);
|
|
8442
8502
|
}
|
|
8503
|
+
if (options?.cursor !== void 0 && options.failed === true) {
|
|
8504
|
+
throw new DeeplineError(
|
|
8505
|
+
"runs.logs cannot combine failed with cursor.",
|
|
8506
|
+
void 0,
|
|
8507
|
+
"INVALID_RUN_LOG_VIEW"
|
|
8508
|
+
);
|
|
8509
|
+
}
|
|
8443
8510
|
if (options?.failed === true) {
|
|
8444
8511
|
const requestedLimit = typeof options.limit === "number" && Number.isFinite(options.limit) && options.limit > 0 ? Math.trunc(options.limit) : RUNS_FAILED_LOG_LIMIT;
|
|
8445
8512
|
const failedLimit = Math.min(RUNS_FAILED_LOG_LIMIT, requestedLimit);
|
|
@@ -8465,6 +8532,7 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8465
8532
|
...page.logsTruncated ? { logsTruncated: true } : {}
|
|
8466
8533
|
};
|
|
8467
8534
|
}
|
|
8535
|
+
const beforeSequence = options?.cursor !== void 0 ? parseRunLogsCursor(options.cursor) : null;
|
|
8468
8536
|
const limit = options?.all ? Number.MAX_SAFE_INTEGER : typeof options?.limit === "number" && Number.isFinite(options.limit) && options.limit > 0 ? Math.trunc(options.limit) : 200;
|
|
8469
8537
|
const fetchPage = (afterSeq2, pageLimit) => this.http.get(
|
|
8470
8538
|
`/api/v2/runs/${encodeURIComponent(runId)}/logs?afterSeq=${afterSeq2}&limit=${pageLimit}`,
|
|
@@ -8472,24 +8540,33 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8472
8540
|
);
|
|
8473
8541
|
const probe = await fetchPage(0, 1);
|
|
8474
8542
|
const lastStoredSeq = probe.lastStoredSeq;
|
|
8475
|
-
|
|
8543
|
+
const oldestStoredSeq = probe.entries[0]?.seq ?? null;
|
|
8544
|
+
const upperSeq = beforeSequence === null ? Number.POSITIVE_INFINITY : Math.min(beforeSequence - 1, lastStoredSeq);
|
|
8545
|
+
const windowEndSeq = Math.min(upperSeq, lastStoredSeq);
|
|
8546
|
+
let afterSeq = options?.all ? 0 : Math.max(0, windowEndSeq - limit);
|
|
8476
8547
|
const entries = [];
|
|
8477
|
-
while (entries.length < limit) {
|
|
8548
|
+
while (entries.length < limit && afterSeq < upperSeq) {
|
|
8478
8549
|
const page = await fetchPage(
|
|
8479
8550
|
afterSeq,
|
|
8480
|
-
Math.min(
|
|
8551
|
+
Math.min(
|
|
8552
|
+
RUN_LOGS_PAGE_LIMIT,
|
|
8553
|
+
limit - entries.length,
|
|
8554
|
+
upperSeq - afterSeq
|
|
8555
|
+
)
|
|
8481
8556
|
);
|
|
8482
|
-
|
|
8557
|
+
const inWindow = page.entries.filter((entry) => entry.seq <= upperSeq);
|
|
8558
|
+
if (inWindow.length === 0) {
|
|
8483
8559
|
break;
|
|
8484
8560
|
}
|
|
8485
|
-
entries.push(...
|
|
8486
|
-
afterSeq =
|
|
8487
|
-
if (!page.hasMore) {
|
|
8561
|
+
entries.push(...inWindow);
|
|
8562
|
+
afterSeq = inWindow[inWindow.length - 1].seq;
|
|
8563
|
+
if (!page.hasMore || inWindow.length < page.entries.length) {
|
|
8488
8564
|
break;
|
|
8489
8565
|
}
|
|
8490
8566
|
}
|
|
8491
8567
|
const firstSequence = entries.length > 0 ? entries[0].seq : null;
|
|
8492
8568
|
const lastSequence = entries.length > 0 ? entries[entries.length - 1].seq : null;
|
|
8569
|
+
const olderLinesExist = firstSequence !== null && oldestStoredSeq !== null && firstSequence > oldestStoredSeq;
|
|
8493
8570
|
return {
|
|
8494
8571
|
runId: probe.runId,
|
|
8495
8572
|
totalCount: probe.totalLogCount,
|
|
@@ -8497,7 +8574,8 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8497
8574
|
firstSequence,
|
|
8498
8575
|
lastSequence,
|
|
8499
8576
|
truncated: entries.length < probe.totalLogCount,
|
|
8500
|
-
hasMore:
|
|
8577
|
+
hasMore: olderLinesExist,
|
|
8578
|
+
nextCursor: olderLinesExist ? encodeRunLogsCursor(firstSequence) : null,
|
|
8501
8579
|
entries: entries.map((entry) => entry.line),
|
|
8502
8580
|
view: options?.all ? "all" : "tail",
|
|
8503
8581
|
...probe.logsTruncated ? { logsTruncated: true } : {}
|
|
@@ -10468,6 +10546,7 @@ var ROOTS = {
|
|
|
10468
10546
|
check: "kind target checked scope name exportName valid stage issues inputSchema outputSchema recognized triggers runtimeLimit limits featureFlags sourceHash artifactHash graphHash toolGetterHints exports actions diagnostics reference origin ownerType activeScheduledPlays command_context",
|
|
10469
10547
|
run: "schemaVersion kind run datasets actions apiVersion dashboardUrl progress rowOutcomes steps errors error warnings result resultState execution command_context diagnostics",
|
|
10470
10548
|
get: "schemaVersion kind run runStatus steps failures errorDetails rowOutcomes warnings failedLogs datasets result resultState actions diagnostics command_context",
|
|
10549
|
+
config: "runId contract command_context",
|
|
10471
10550
|
export: "runId datasets csv_path json_path format source rowCount columns notice metadata_path actions command_context"
|
|
10472
10551
|
};
|
|
10473
10552
|
function parseJsonFields(args, surface) {
|
|
@@ -15664,205 +15743,73 @@ function registerPlayTriggerConfigCommands(plays) {
|
|
|
15664
15743
|
var import_node_crypto7 = require("crypto");
|
|
15665
15744
|
|
|
15666
15745
|
// src/cli/run-logs-help.ts
|
|
15667
|
-
var
|
|
15668
|
-
"run.created":
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
"run.
|
|
15673
|
-
|
|
15674
|
-
|
|
15675
|
-
|
|
15676
|
-
"
|
|
15677
|
-
|
|
15678
|
-
|
|
15679
|
-
|
|
15680
|
-
"
|
|
15681
|
-
"
|
|
15682
|
-
|
|
15683
|
-
|
|
15684
|
-
|
|
15685
|
-
"
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
"run
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
},
|
|
15702
|
-
"step.progress": {
|
|
15703
|
-
emittedBy: "Managed step execution",
|
|
15704
|
-
payloadFields: ["stepId", "label", "kind", "status", "progress"]
|
|
15705
|
-
},
|
|
15706
|
-
"step.completed": {
|
|
15707
|
-
emittedBy: "Managed step execution",
|
|
15708
|
-
payloadFields: ["stepId", "label", "kind", "artifactTableNamespace"]
|
|
15709
|
-
},
|
|
15710
|
-
"step.failed": {
|
|
15711
|
-
emittedBy: "Managed step execution",
|
|
15712
|
-
payloadFields: [
|
|
15713
|
-
"stepId",
|
|
15714
|
-
"label",
|
|
15715
|
-
"kind",
|
|
15716
|
-
"error",
|
|
15717
|
-
"artifactTableNamespace"
|
|
15718
|
-
]
|
|
15719
|
-
},
|
|
15720
|
-
"step.skipped": {
|
|
15721
|
-
emittedBy: "Managed step execution",
|
|
15722
|
-
payloadFields: ["stepId", "label", "kind", "artifactTableNamespace"]
|
|
15723
|
-
},
|
|
15724
|
-
"log.appended": {
|
|
15725
|
-
emittedBy: "ctx.log and runtime/coordinator messages",
|
|
15726
|
-
payloadFields: [
|
|
15727
|
-
"lines",
|
|
15728
|
-
"lineContexts",
|
|
15729
|
-
"producerAttempt",
|
|
15730
|
-
"channelOffset",
|
|
15731
|
-
"logsTruncated"
|
|
15732
|
-
]
|
|
15733
|
-
},
|
|
15734
|
-
"dataset.lifecycle": {
|
|
15735
|
-
emittedBy: "Managed dataset storage",
|
|
15736
|
-
payloadFields: [
|
|
15737
|
-
"datasetId",
|
|
15738
|
-
"path",
|
|
15739
|
-
"tableNamespace",
|
|
15740
|
-
"phase",
|
|
15741
|
-
"persistedRows",
|
|
15742
|
-
"succeededRows",
|
|
15743
|
-
"failedRows",
|
|
15744
|
-
"complete",
|
|
15745
|
-
"bornFrom"
|
|
15746
|
-
]
|
|
15746
|
+
var KIND_DESCRIPTIONS = {
|
|
15747
|
+
"run.created": "Run accepted.",
|
|
15748
|
+
"run.started": "Execution started.",
|
|
15749
|
+
"run.waiting": "Run waiting.",
|
|
15750
|
+
"run.resumed": "Execution resumed.",
|
|
15751
|
+
"run.completed": "Run succeeded.",
|
|
15752
|
+
"run.failed": "Run failed.",
|
|
15753
|
+
"run.cancelled": "Run cancelled.",
|
|
15754
|
+
"step.started": "Step started.",
|
|
15755
|
+
"step.progress": "Progress update.",
|
|
15756
|
+
"step.completed": "Step succeeded.",
|
|
15757
|
+
"step.failed": "Step failed.",
|
|
15758
|
+
"step.skipped": "Step skipped.",
|
|
15759
|
+
"log.appended": "Text log line.",
|
|
15760
|
+
"dataset.lifecycle": "Dataset registered, available or failed.",
|
|
15761
|
+
"activity.observed": "Provider or workflow activity.",
|
|
15762
|
+
"work.counters": "Call, request and rate-limit totals.",
|
|
15763
|
+
"receipt.completed": "Saved work result: succeeded.",
|
|
15764
|
+
"receipt.failed": "Saved work result: failed.",
|
|
15765
|
+
"receipt.skipped": "Saved work result: skipped.",
|
|
15766
|
+
"runtime.event": "Other event."
|
|
15767
|
+
};
|
|
15768
|
+
var RUN_LOGS_KIND_HELP = RUN_EVENT_SEARCH_KIND_VALUES.map((kind) => ({
|
|
15769
|
+
kind,
|
|
15770
|
+
description: KIND_DESCRIPTIONS[kind]
|
|
15771
|
+
}));
|
|
15772
|
+
var READ_EXAMPLES = [
|
|
15773
|
+
"deepline runs logs '<run-id>'",
|
|
15774
|
+
"deepline runs logs '<run-id>' --out run.log"
|
|
15775
|
+
];
|
|
15776
|
+
var FILTER_EXAMPLES = [
|
|
15777
|
+
{
|
|
15778
|
+
label: "Failed work with saved details",
|
|
15779
|
+
command: `deepline runs logs --kind receipt.failed --where '$.status == "failed"' --payloads --json`
|
|
15747
15780
|
},
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15781
|
+
{
|
|
15782
|
+
label: "One failed step",
|
|
15783
|
+
command: `deepline runs logs --kind step.failed --where '$.stepId == "company-lookup"' --payloads --json`
|
|
15751
15784
|
},
|
|
15752
|
-
"work.counters": {
|
|
15753
|
-
emittedBy: "Runtime work accounting",
|
|
15754
|
-
payloadFields: [
|
|
15755
|
-
"attempt",
|
|
15756
|
-
"invocationSeq",
|
|
15757
|
-
"segmentId",
|
|
15758
|
-
"logicalCalls",
|
|
15759
|
-
"providerRequests",
|
|
15760
|
-
"provider429s",
|
|
15761
|
-
"final"
|
|
15762
|
-
]
|
|
15763
|
-
}
|
|
15764
|
-
};
|
|
15765
|
-
var RUN_LOGS_KIND_HELP = [
|
|
15766
|
-
...Object.entries(RUN_EVENT_KIND_CATALOG).map(([kind, descriptor]) => ({
|
|
15767
|
-
kind,
|
|
15768
|
-
description: descriptor.description,
|
|
15769
|
-
...EVENT_DETAILS[kind]
|
|
15770
|
-
})),
|
|
15771
|
-
...Object.entries(RUN_RECEIPT_SEARCH_KIND_CATALOG).map(
|
|
15772
|
-
([kind, descriptor]) => ({
|
|
15773
|
-
kind,
|
|
15774
|
-
description: descriptor.description,
|
|
15775
|
-
emittedBy: "Durable work receipt settlement",
|
|
15776
|
-
payloadFields: ["status", "output", "error", "errorPayload"]
|
|
15777
|
-
})
|
|
15778
|
-
),
|
|
15779
15785
|
{
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
payloadFields: []
|
|
15784
|
-
}
|
|
15785
|
-
];
|
|
15786
|
-
var SECTIONS = [
|
|
15786
|
+
label: "Provider and operation",
|
|
15787
|
+
command: `deepline runs logs --kind activity.observed --where '$.provider == "apollo" && $.operation == "company_lookup"' --json`
|
|
15788
|
+
},
|
|
15787
15789
|
{
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
"These commands read existing evidence; they do not start a run or execute a provider. Replace <run-id>, <play-name> and other angle-bracket values with identifiers returned by the CLI.",
|
|
15791
|
-
"Text logs: runs logs <run-id> returns the last 200 retained lines by default. --out writes the full retained stream to a local file. --log-level filters text severity; debug includes all retained levels. --failed reads only a terminal-failed run\u2019s last 20 retained lines and reports retention limitations.",
|
|
15792
|
-
"Event search: omit the run ID, or add any of --since, --until, --play, --kind, --where, --payloads, --cursor, --runtime-namespace or --runtime-backend. A supplied run ID then narrows the search. --limit and --json alone do not switch a run\u2019s text logs to event search. Text-only flags --out, --failed and --log-level cannot be combined with event search.",
|
|
15793
|
-
"Current status and returned output selectors: runs get <run-id> --json. Live observation: runs watch <run-id>. Dataset rows: runs export <run-id> --dataset <returned-selector> --out rows.csv. A referenced tool response: runs receipt <run-id> --key <returned-receipt-key> --json. Read each command\u2019s --help for its options."
|
|
15794
|
-
],
|
|
15795
|
-
commands: [
|
|
15796
|
-
"deepline runs logs <run-id> --json",
|
|
15797
|
-
"deepline runs logs <run-id> --out run.log --json",
|
|
15798
|
-
"deepline runs logs --kind run.failed --json",
|
|
15799
|
-
"deepline runs logs --kind step.failed --payloads --json",
|
|
15800
|
-
"deepline runs logs --kind receipt.failed --payloads --json"
|
|
15801
|
-
]
|
|
15790
|
+
label: "Failed dataset",
|
|
15791
|
+
command: `deepline runs logs --kind dataset.lifecycle --where '$.datasetId == "companies" && $.phase == "failed"' --payloads --json`
|
|
15802
15792
|
},
|
|
15803
15793
|
{
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
"Search defaults to the last hour, newest first. Use explicit ISO UTC --since and --until values for reproducible queries; the maximum lookback is seven days. Default page size is 100 events; --limit accepts 1\u2013200. With --payloads, default and maximum are 10 events, with 16 MiB total payload data.",
|
|
15807
|
-
"JSON returns events[], returnedCount, since, until, nextCursor and next.logs. Run the returned next.logs command to continue with the same filters and UTC window; nextCursor is opaque. A bounded page or an empty result does not establish whole-run coverage or application health."
|
|
15808
|
-
],
|
|
15809
|
-
commands: [
|
|
15810
|
-
"deepline runs logs <run-id> --kind log.appended --json",
|
|
15811
|
-
"deepline runs logs --play <play-name> --since <UTC-start> --until <UTC-end> --json"
|
|
15812
|
-
]
|
|
15794
|
+
label: "String log context",
|
|
15795
|
+
command: `deepline runs logs --kind log.appended --where '$.context.companyId == "acme_123"' --json`
|
|
15813
15796
|
},
|
|
15814
15797
|
{
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
"Identity strings: orgId, runId, playName, runtimeScope. These come from authenticated execution state; filters only narrow your authorized organization/runtime. Preview reads require the existing runtime credential and an authorized --runtime-namespace; --runtime-backend selects daytona or modal.",
|
|
15818
|
-
"Event string: kind. Optional strings: source, stepId, stepKind, status, datasetId, phase, provider, operation. Optional positive integer: producerAttempt. These fields exist only when recorded; inspect a returned event before filtering on an optional field.",
|
|
15819
|
-
'stepId/stepKind describe recorded step work; datasetId/phase describe dataset lifecycle (registered, available, failed). provider/operation appear on typed provider activity.observed events, not every receipt or provider call. status is the recorded status or activity state when present: run.completed and step.completed do not imply status == "completed". Select lifecycle outcomes with --kind.',
|
|
15820
|
-
"context.<key> matches an authored flat scalar log field: string, number or boolean. Context cannot override event identity. Missing fields do not match. --where supports only $.field == literal predicates joined with &&, at most eight predicates and 512 bytes. No OR, ranges, wildcards, nested payload paths or text search. Time uses --since/--until; level and message are not --where fields.",
|
|
15821
|
-
'Wrap the entire predicate in single shell quotes so $ and && reach the CLI unchanged. Inside it, strings use double quotes; numbers and booleans are unquoted. Types must match: 2 differs from "2", false differs from "false". Examples use illustrative recorded values; use your own step IDs, dataset IDs, provider/operation names and authored context. The context examples assume ctx.log recorded companyId: "acme_123", attempt: 2 and cached: false.'
|
|
15822
|
-
],
|
|
15823
|
-
commands: [
|
|
15824
|
-
"# Failed retained work with its stored error/result",
|
|
15825
|
-
`deepline runs logs --kind receipt.failed --where '$.status == "failed"' --payloads --json`,
|
|
15826
|
-
"# Failure details for one named step",
|
|
15827
|
-
`deepline runs logs --kind step.failed --where '$.stepId == "company-lookup"' --payloads --json`,
|
|
15828
|
-
"# Typed provider observations matching both fields",
|
|
15829
|
-
`deepline runs logs --kind activity.observed --where '$.provider == "apollo" && $.operation == "company_lookup"' --json`,
|
|
15830
|
-
"# Failed lifecycle transitions for one dataset",
|
|
15831
|
-
`deepline runs logs --kind dataset.lifecycle --where '$.datasetId == "companies" && $.phase == "failed"' --payloads --json`,
|
|
15832
|
-
"# Authored string context on log lines",
|
|
15833
|
-
`deepline runs logs --kind log.appended --where '$.context.companyId == "acme_123"' --json`,
|
|
15834
|
-
"# Authored number and boolean context, both required to match",
|
|
15835
|
-
"deepline runs logs --kind log.appended --where '$.context.attempt == 2 && $.context.cached == false' --json",
|
|
15836
|
-
"# Known producer identity within one run",
|
|
15837
|
-
`deepline runs logs <run-id> --where '$.source == "worker" && $.producerAttempt == 1' --json`
|
|
15838
|
-
]
|
|
15798
|
+
label: "Number and boolean log context",
|
|
15799
|
+
command: "deepline runs logs --kind log.appended --where '$.context.attempt == 2 && $.context.cached == false' --json"
|
|
15839
15800
|
},
|
|
15840
15801
|
{
|
|
15841
|
-
|
|
15842
|
-
|
|
15843
|
-
"Search events include eventId, occurredAt, ingestedAt, kind, runId, playName, level and message. The CLI puts indexed fields directly on each events[] entry; SDK/API responses keep them under searchDoc. Log search message is a preview (up to 2,048 characters); use text logs or --out for full retained lines.",
|
|
15844
|
-
"--payloads adds eventPayload for stored canonical events: lifecycle, step details/errors, activity observations, dataset transitions and work counters. Receipt matches instead hydrate payload with status, output, error and errorPayload. An event without a receipt does not promise a tool response; retained payloads may be unavailable. Neither --where nor event search indexes request/response bodies.",
|
|
15845
|
-
"Search does not expose a receipt key or storage reference. To retrieve a specific retained tool response with runs receipt, use the receipt key returned in the run\u2019s exported evidence or tool execution metadata. For full row data, follow runs get output/export actions; dataset.lifecycle contains metadata, not all dataset rows.",
|
|
15846
|
-
"The catalog lists known searchable kinds, including receipt outcomes and the runtime.event fallback. Use the exact dotted name with --kind. Future stored kinds can also be queried; this list is not a CLI validation allowlist. Events are observations, not a count of billed provider calls.",
|
|
15847
|
-
"Catalog payload fields are possible producer fields, not required fields or --where paths. Canonical eventPayload uses type for the dotted event kind; its kind field, when present on a step, becomes indexed stepKind. Indexed log entries describe individual lines rather than reproducing the original lines batch.",
|
|
15848
|
-
"Canonical event envelopes carry runId, type, occurredAt (producer milliseconds), source, optional seq and optional producer-owned payload. Search occurredAt/ingestedAt are UTC timestamp strings. source identifies the recorded producer; producerAttempt is present only when known.",
|
|
15849
|
-
"activity.observed stores observation with activityId, stepId, target, state and observedAt. Targets describe provider, dataset, lease, runner, step or capacity work. State kinds are active, queued, waiting, retrying, scheduled, completed or failed; retry/wait detail stays in the payload. work.counters contains aggregate logicalCalls, providerRequests and provider429s, not per-call responses."
|
|
15850
|
-
],
|
|
15851
|
-
commands: []
|
|
15802
|
+
label: "One run and step",
|
|
15803
|
+
command: `deepline runs logs '<run-id>' --where '$.stepId == "company-lookup"' --json`
|
|
15852
15804
|
}
|
|
15853
15805
|
];
|
|
15854
|
-
|
|
15855
|
-
"Event/log/receipt search shares the PlanetScale index. New runs marked runEventStore=planet_scale retain accepted event/log history in PlanetScale; Convex keeps current run/control state and eligible saved-Play rollup facts. Older unmarked runs retain their existing readers. No backfill is implied.",
|
|
15856
|
-
"Search retention is seven days; receipt payload retention is independent. Logs reflect accepted, retained lines: runtime sampling and truncation can omit original console output. Read returned retention/sampling warnings; an export contains the full retained stream, not suppressed lines."
|
|
15857
|
-
];
|
|
15858
|
-
function wrapParagraph(text, indent2 = 2) {
|
|
15806
|
+
function wrapParagraph(text) {
|
|
15859
15807
|
const lines = [];
|
|
15860
|
-
|
|
15861
|
-
let line = padding;
|
|
15808
|
+
let line = " ";
|
|
15862
15809
|
for (const word of text.split(" ")) {
|
|
15863
15810
|
if (line.length + word.length > 80 && line.trim()) {
|
|
15864
15811
|
lines.push(line.trimEnd());
|
|
15865
|
-
line =
|
|
15812
|
+
line = " ";
|
|
15866
15813
|
}
|
|
15867
15814
|
line += `${word} `;
|
|
15868
15815
|
}
|
|
@@ -15870,34 +15817,36 @@ function wrapParagraph(text, indent2 = 2) {
|
|
|
15870
15817
|
return lines.join("\n");
|
|
15871
15818
|
}
|
|
15872
15819
|
function renderRunLogsHelp() {
|
|
15873
|
-
const section = ({
|
|
15874
|
-
title,
|
|
15875
|
-
paragraphs,
|
|
15876
|
-
commands
|
|
15877
|
-
}) => [
|
|
15878
|
-
`${title}:`,
|
|
15879
|
-
...paragraphs.flatMap((paragraph) => [wrapParagraph(paragraph), ""]),
|
|
15880
|
-
...commands.length ? [" Common commands:", ...commands.map((command) => ` ${command}`)] : [],
|
|
15881
|
-
""
|
|
15882
|
-
];
|
|
15883
15820
|
return [
|
|
15884
15821
|
"",
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
]
|
|
15822
|
+
"Examples:",
|
|
15823
|
+
` ${READ_EXAMPLES[0]}`,
|
|
15824
|
+
" deepline runs logs --kind run.failed --json",
|
|
15825
|
+
...[FILTER_EXAMPLES[1], FILTER_EXAMPLES[2], FILTER_EXAMPLES[5]].map(
|
|
15826
|
+
({ command }) => ` ${command}`
|
|
15827
|
+
),
|
|
15828
|
+
"",
|
|
15829
|
+
"Event kinds:",
|
|
15830
|
+
...RUN_LOGS_KIND_HELP.map(
|
|
15831
|
+
({ kind, description }) => ` ${kind.padEnd(20)} ${description}`
|
|
15896
15832
|
),
|
|
15897
15833
|
"",
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15834
|
+
"Filters:",
|
|
15835
|
+
...[
|
|
15836
|
+
"Use $.field == value; combine matches with &&.",
|
|
15837
|
+
"Quote the whole filter with single shell quotes. Strings use double quotes; numbers and booleans are unquoted.",
|
|
15838
|
+
"Missing fields do not match. Maximum eight matches and 512 bytes per filter."
|
|
15839
|
+
].map((note) => wrapParagraph(note)),
|
|
15840
|
+
"",
|
|
15841
|
+
"Search:",
|
|
15842
|
+
...[
|
|
15843
|
+
"A run ID alone reads text logs. Omit it or add a search flag to search events; a supplied run ID narrows the search.",
|
|
15844
|
+
"Defaults to the last hour; maximum lookback is seven days. Follow next.logs for events; use nextCursor with --cursor for older text logs.",
|
|
15845
|
+
"--payloads returns available details or saved results: up to 10 events and 16 MiB.",
|
|
15846
|
+
"--out, --failed and --log-level apply to text logs and cannot be combined with event search."
|
|
15847
|
+
].map((note) => wrapParagraph(note)),
|
|
15848
|
+
"",
|
|
15849
|
+
"More examples: https://deepline.com/docs/sdk-v2/run-events"
|
|
15901
15850
|
].join("\n");
|
|
15902
15851
|
}
|
|
15903
15852
|
|
|
@@ -18545,24 +18494,31 @@ includes nextCommand when another page is available.
|
|
|
18545
18494
|
|
|
18546
18495
|
// src/cli/commands/plays/run-history.ts
|
|
18547
18496
|
async function handleRunsHistory(options) {
|
|
18548
|
-
|
|
18549
|
-
if (options.
|
|
18550
|
-
|
|
18497
|
+
let limit;
|
|
18498
|
+
if (options.type && !["all", "plays", "monitors"].includes(options.type)) {
|
|
18499
|
+
throw new Error("--type must be all, plays or monitors.");
|
|
18500
|
+
}
|
|
18551
18501
|
if (options.limit !== void 0) {
|
|
18552
|
-
|
|
18502
|
+
limit = Number(options.limit);
|
|
18553
18503
|
if (!/^\d+$/.test(options.limit) || !Number.isSafeInteger(limit) || limit < 1) {
|
|
18554
18504
|
throw new Error("--limit must be a positive integer.");
|
|
18555
18505
|
}
|
|
18556
|
-
query.set("limit", String(limit));
|
|
18557
18506
|
}
|
|
18558
|
-
const
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18507
|
+
const page = await new DeeplineClient().runs.history({
|
|
18508
|
+
cursor: options.cursor,
|
|
18509
|
+
orgId: options.org,
|
|
18510
|
+
search: options.search,
|
|
18511
|
+
type: options.type,
|
|
18512
|
+
limit
|
|
18513
|
+
});
|
|
18562
18514
|
const lines = page.runs.map(
|
|
18563
18515
|
(run) => `${run.workflowName} \xB7 ${run.status} \xB7 ${run.runId}`
|
|
18564
18516
|
);
|
|
18565
|
-
if (lines.length === 0)
|
|
18517
|
+
if (lines.length === 0) {
|
|
18518
|
+
lines.push(
|
|
18519
|
+
options.search && page.hasMore ? "No matches in this page; continue searching with the next cursor." : "No runs found on this page."
|
|
18520
|
+
);
|
|
18521
|
+
}
|
|
18566
18522
|
if (page.hasMore) lines.push(`Next cursor: ${page.nextCursor}`);
|
|
18567
18523
|
printCommandEnvelope(
|
|
18568
18524
|
{ ...page, render: { sections: [{ title: "Run history", lines }] } },
|
|
@@ -18574,6 +18530,12 @@ function registerRunHistoryCommand(runs) {
|
|
|
18574
18530
|
"--cursor <cursor>",
|
|
18575
18531
|
"Opaque nextCursor returned by the previous page"
|
|
18576
18532
|
).option("--limit <count>", "Maximum runs on this page").option(
|
|
18533
|
+
"--search <text>",
|
|
18534
|
+
"Search Play/workflow names, run IDs and statuses"
|
|
18535
|
+
).option(
|
|
18536
|
+
"--type <type>",
|
|
18537
|
+
"Search all, plays or monitors (requires --search)"
|
|
18538
|
+
).option(
|
|
18577
18539
|
"--org <id>",
|
|
18578
18540
|
"Workspace ID (must match the authenticated workspace)"
|
|
18579
18541
|
).option("--json", "Emit JSON output. Also automatic when stdout is piped").addHelpText(
|
|
@@ -24284,6 +24246,63 @@ var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : (0, im
|
|
|
24284
24246
|
var import_node_fs11 = require("fs");
|
|
24285
24247
|
var import_node_path13 = require("path");
|
|
24286
24248
|
|
|
24249
|
+
// ../plays/table-csv.ts
|
|
24250
|
+
var TABLE_EXPORT_ERROR_COLUMN = "_error";
|
|
24251
|
+
var UNRECORDED_FAILURE_REASON = "Row failed without a recorded reason.";
|
|
24252
|
+
function tableCellText(value) {
|
|
24253
|
+
if (value === null || value === void 0) return "";
|
|
24254
|
+
if (typeof value === "string") return value;
|
|
24255
|
+
if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean")
|
|
24256
|
+
return String(value);
|
|
24257
|
+
if (value instanceof Date) return value.toISOString();
|
|
24258
|
+
if (typeof value === "symbol" || typeof value === "function") return "";
|
|
24259
|
+
try {
|
|
24260
|
+
return JSON.stringify(
|
|
24261
|
+
value,
|
|
24262
|
+
(_key, nested) => typeof nested === "bigint" ? nested.toString() : nested
|
|
24263
|
+
) ?? "";
|
|
24264
|
+
} catch {
|
|
24265
|
+
return String(value);
|
|
24266
|
+
}
|
|
24267
|
+
}
|
|
24268
|
+
function csvField(value) {
|
|
24269
|
+
const text = tableCellText(value);
|
|
24270
|
+
return /[",\r\n]/.test(text) ? `"${text.replaceAll('"', '""')}"` : text;
|
|
24271
|
+
}
|
|
24272
|
+
function csvRecord(values) {
|
|
24273
|
+
return `${values.map(csvField).join(",")}
|
|
24274
|
+
`;
|
|
24275
|
+
}
|
|
24276
|
+
function isFailedRow(row) {
|
|
24277
|
+
return row.status === "failed";
|
|
24278
|
+
}
|
|
24279
|
+
function tableExportHasFailedRows(rows) {
|
|
24280
|
+
for (const row of rows) if (isFailedRow(row)) return true;
|
|
24281
|
+
return false;
|
|
24282
|
+
}
|
|
24283
|
+
function tableExportErrorCell(row) {
|
|
24284
|
+
if (!isFailedRow(row)) return "";
|
|
24285
|
+
const reason = typeof row.error === "string" ? row.error.trim() : "";
|
|
24286
|
+
return reason || UNRECORDED_FAILURE_REASON;
|
|
24287
|
+
}
|
|
24288
|
+
function tableExportColumns(columns, withError) {
|
|
24289
|
+
if (!withError) return [...columns];
|
|
24290
|
+
return [
|
|
24291
|
+
...columns.filter((column) => column !== TABLE_EXPORT_ERROR_COLUMN),
|
|
24292
|
+
TABLE_EXPORT_ERROR_COLUMN
|
|
24293
|
+
];
|
|
24294
|
+
}
|
|
24295
|
+
function tableExportCells(row, columns, withError) {
|
|
24296
|
+
return tableExportColumns(columns, withError).map(
|
|
24297
|
+
(column) => column === TABLE_EXPORT_ERROR_COLUMN && withError ? tableExportErrorCell(row) : Object.hasOwn(row.data, column) ? row.data[column] : void 0
|
|
24298
|
+
);
|
|
24299
|
+
}
|
|
24300
|
+
function tableCsvText(header, records) {
|
|
24301
|
+
let text = csvRecord(header);
|
|
24302
|
+
for (const record5 of records) text += csvRecord(record5);
|
|
24303
|
+
return text;
|
|
24304
|
+
}
|
|
24305
|
+
|
|
24287
24306
|
// src/cli/run-dataset-order.ts
|
|
24288
24307
|
function underscoreKeysLast(keys) {
|
|
24289
24308
|
return [...keys].sort(
|
|
@@ -24332,9 +24351,13 @@ var RunDatasetCsv = class _RunDatasetCsv {
|
|
|
24332
24351
|
}
|
|
24333
24352
|
write(outPath) {
|
|
24334
24353
|
const absolutePath = (0, import_node_path13.resolve)(outPath);
|
|
24354
|
+
const { rows, columns } = this.#projection;
|
|
24335
24355
|
(0, import_node_fs11.writeFileSync)(
|
|
24336
24356
|
absolutePath,
|
|
24337
|
-
|
|
24357
|
+
tableCsvText(
|
|
24358
|
+
columns,
|
|
24359
|
+
rows.map((data) => tableExportCells({ data }, columns, false))
|
|
24360
|
+
),
|
|
24338
24361
|
"utf-8"
|
|
24339
24362
|
);
|
|
24340
24363
|
return absolutePath;
|
|
@@ -31930,7 +31953,20 @@ async function fetchBackingDatasetRows(input2) {
|
|
|
31930
31953
|
}
|
|
31931
31954
|
offset += page.rows.length;
|
|
31932
31955
|
}
|
|
31933
|
-
const
|
|
31956
|
+
const withError = tableExportHasFailedRows(
|
|
31957
|
+
sheetRows.filter(
|
|
31958
|
+
(row) => Boolean(row) && typeof row === "object" && !Array.isArray(row)
|
|
31959
|
+
)
|
|
31960
|
+
);
|
|
31961
|
+
const rows = sheetRows.map((row) => {
|
|
31962
|
+
const data = exportableSheetRow(row);
|
|
31963
|
+
return data && withError ? {
|
|
31964
|
+
...data,
|
|
31965
|
+
[TABLE_EXPORT_ERROR_COLUMN]: tableExportErrorCell(
|
|
31966
|
+
row
|
|
31967
|
+
)
|
|
31968
|
+
} : data;
|
|
31969
|
+
}).filter((row) => Boolean(row));
|
|
31934
31970
|
const hasCompleteSettledPrefix = acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal !== null && // A zero-row run-scoped read is not a settled export when the returned
|
|
31935
31971
|
// Dataset Handle advertised rows. That shape is the replay/reuse case:
|
|
31936
31972
|
// the rows belong to another writer (or the projection has not caught up)
|
|
@@ -33912,9 +33948,12 @@ function renderRunOverviewText(overview, extras = {}) {
|
|
|
33912
33948
|
${renderCommandEnvelopeText({ render: { sections, actions: actions2 } })}`;
|
|
33913
33949
|
}
|
|
33914
33950
|
async function handleRunGet(args) {
|
|
33915
|
-
const selection = parseJsonFields(
|
|
33951
|
+
const selection = parseJsonFields(
|
|
33952
|
+
args,
|
|
33953
|
+
args.includes("--config") ? "config" : "get"
|
|
33954
|
+
);
|
|
33916
33955
|
args = selection.args;
|
|
33917
|
-
const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--log-failed]";
|
|
33956
|
+
const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--config] [--log-failed]";
|
|
33918
33957
|
let runId;
|
|
33919
33958
|
try {
|
|
33920
33959
|
runId = parseRunIdPositional(args, usage2);
|
|
@@ -33923,6 +33962,25 @@ async function handleRunGet(args) {
|
|
|
33923
33962
|
return 1;
|
|
33924
33963
|
}
|
|
33925
33964
|
const client2 = new DeeplineClient();
|
|
33965
|
+
if (args.includes("--config")) {
|
|
33966
|
+
if (args.some((arg) => ["--input", "--full", "--log-failed"].includes(arg))) {
|
|
33967
|
+
console.error(
|
|
33968
|
+
"--config cannot be combined with --input, --full or --log-failed."
|
|
33969
|
+
);
|
|
33970
|
+
return 1;
|
|
33971
|
+
}
|
|
33972
|
+
const status2 = await client2.runs.get(runId, { configuration: true });
|
|
33973
|
+
if (!Object.hasOwn(status2, "contract")) {
|
|
33974
|
+
throw new Error(
|
|
33975
|
+
"This server does not support recorded configuration reads."
|
|
33976
|
+
);
|
|
33977
|
+
}
|
|
33978
|
+
printCommandEnvelope(
|
|
33979
|
+
{ runId, contract: status2.contract ?? null },
|
|
33980
|
+
{ json: true, fields: selection.fields }
|
|
33981
|
+
);
|
|
33982
|
+
return 0;
|
|
33983
|
+
}
|
|
33926
33984
|
if (args.includes("--input")) {
|
|
33927
33985
|
const input2 = await client2.getRunInput(runId);
|
|
33928
33986
|
printCommandEnvelope(input2, { json: true });
|
|
@@ -34428,15 +34486,17 @@ async function handleRunLogs(args) {
|
|
|
34428
34486
|
"--play",
|
|
34429
34487
|
"--kind",
|
|
34430
34488
|
"--where",
|
|
34431
|
-
"--cursor",
|
|
34432
34489
|
"--payloads",
|
|
34433
34490
|
"--runtime-namespace",
|
|
34434
34491
|
"--runtime-backend"
|
|
34435
34492
|
]);
|
|
34436
|
-
|
|
34493
|
+
const cursorIndex = args.indexOf("--cursor");
|
|
34494
|
+
const cursorValue = cursorIndex >= 0 ? args[cursorIndex + 1] : void 0;
|
|
34495
|
+
const continuesEventSearch = cursorIndex >= 0 && !(cursorValue && isRunLogsCursor(cursorValue));
|
|
34496
|
+
if (!args[0] || args[0].startsWith("--") || continuesEventSearch || args.some((arg) => searchFlags.has(arg))) {
|
|
34437
34497
|
return handleRunEventSearch(args);
|
|
34438
34498
|
}
|
|
34439
|
-
const usage2 = "Usage: deepline runs logs <run-id> [--limit 200] [--failed] [--out run.log] [--log-level debug|info|warn|error] [--json]";
|
|
34499
|
+
const usage2 = "Usage: deepline runs logs <run-id> [--limit 200] [--cursor before:<seq>] [--failed] [--out run.log] [--log-level debug|info|warn|error] [--json]";
|
|
34440
34500
|
let runId;
|
|
34441
34501
|
try {
|
|
34442
34502
|
runId = parseRunIdPositional(args, usage2);
|
|
@@ -34446,6 +34506,7 @@ async function handleRunLogs(args) {
|
|
|
34446
34506
|
}
|
|
34447
34507
|
let limit = 200;
|
|
34448
34508
|
let outPath = null;
|
|
34509
|
+
let cursor;
|
|
34449
34510
|
let logLevel = "debug";
|
|
34450
34511
|
let hasExplicitLogLevel = false;
|
|
34451
34512
|
let usesDebugAlias = false;
|
|
@@ -34484,6 +34545,10 @@ async function handleRunLogs(args) {
|
|
|
34484
34545
|
outPath = (0, import_node_path19.resolve)(args[++index]);
|
|
34485
34546
|
continue;
|
|
34486
34547
|
}
|
|
34548
|
+
if (arg === "--cursor" && args[index + 1]) {
|
|
34549
|
+
cursor = args[++index];
|
|
34550
|
+
continue;
|
|
34551
|
+
}
|
|
34487
34552
|
if (arg.startsWith("--")) {
|
|
34488
34553
|
console.error(`${arg} is not supported by deepline runs logs.`);
|
|
34489
34554
|
return 1;
|
|
@@ -34502,6 +34567,12 @@ async function handleRunLogs(args) {
|
|
|
34502
34567
|
);
|
|
34503
34568
|
return 1;
|
|
34504
34569
|
}
|
|
34570
|
+
if (cursor !== void 0 && (failed || outPath)) {
|
|
34571
|
+
console.error(
|
|
34572
|
+
"--cursor pages the bounded log tail; it cannot be combined with --failed or --out."
|
|
34573
|
+
);
|
|
34574
|
+
return 1;
|
|
34575
|
+
}
|
|
34505
34576
|
const client2 = new DeeplineClient();
|
|
34506
34577
|
if (outPath) {
|
|
34507
34578
|
const result2 = await client2.runs.logs(runId, { all: true });
|
|
@@ -34535,19 +34606,25 @@ async function handleRunLogs(args) {
|
|
|
34535
34606
|
return 0;
|
|
34536
34607
|
}
|
|
34537
34608
|
const result = await client2.runs.logs(runId, {
|
|
34538
|
-
...failed ? { limit, failed: true } : { all: logLevel !== "debug", limit }
|
|
34539
|
-
|
|
34540
|
-
|
|
34541
|
-
|
|
34542
|
-
|
|
34543
|
-
|
|
34544
|
-
|
|
34609
|
+
...failed ? { limit, failed: true } : { all: logLevel !== "debug", limit },
|
|
34610
|
+
...cursor !== void 0 ? { cursor } : {}
|
|
34611
|
+
});
|
|
34612
|
+
const page = failed ? {
|
|
34613
|
+
entries: result.entries,
|
|
34614
|
+
firstSequence: result.firstSequence,
|
|
34615
|
+
lastSequence: result.lastSequence,
|
|
34616
|
+
truncated: result.truncated,
|
|
34617
|
+
hasMore: result.hasMore,
|
|
34618
|
+
nextCursor: void 0
|
|
34619
|
+
} : selectRunLogTailPage(result, logLevel, limit);
|
|
34620
|
+
const entries = page.entries;
|
|
34621
|
+
const nextPage = page.nextCursor ? `deepline runs logs ${result.runId} --limit ${limit}${logLevel === "debug" ? "" : ` --log-level ${logLevel}`} --cursor ${page.nextCursor} --json` : null;
|
|
34545
34622
|
const filteredResult = {
|
|
34546
34623
|
...result,
|
|
34547
34624
|
entries,
|
|
34548
34625
|
returnedCount: entries.length,
|
|
34549
|
-
truncated:
|
|
34550
|
-
hasMore:
|
|
34626
|
+
truncated: page.truncated,
|
|
34627
|
+
hasMore: page.hasMore,
|
|
34551
34628
|
view: failed ? result.view : "tail",
|
|
34552
34629
|
next: {
|
|
34553
34630
|
...result.next ?? {},
|
|
@@ -34560,10 +34637,11 @@ async function handleRunLogs(args) {
|
|
|
34560
34637
|
runId: result.runId,
|
|
34561
34638
|
totalCount: result.totalCount,
|
|
34562
34639
|
returnedCount: entries.length,
|
|
34563
|
-
firstSequence:
|
|
34564
|
-
lastSequence:
|
|
34640
|
+
firstSequence: page.firstSequence,
|
|
34641
|
+
lastSequence: page.lastSequence,
|
|
34565
34642
|
truncated: filteredResult.truncated,
|
|
34566
34643
|
hasMore: filteredResult.hasMore,
|
|
34644
|
+
...page.nextCursor !== void 0 ? { nextCursor: page.nextCursor } : {},
|
|
34567
34645
|
logLevel,
|
|
34568
34646
|
...result.logsTruncated ? { logsTruncated: true } : {},
|
|
34569
34647
|
entries,
|
|
@@ -34572,6 +34650,7 @@ async function handleRunLogs(args) {
|
|
|
34572
34650
|
...result.warning ? { warning: result.warning } : {},
|
|
34573
34651
|
next: {
|
|
34574
34652
|
...result.next ?? {},
|
|
34653
|
+
...nextPage ? { page: nextPage } : {},
|
|
34575
34654
|
export: `deepline runs logs ${result.runId} --out run.log --log-level ${logLevel} --json`
|
|
34576
34655
|
},
|
|
34577
34656
|
render: { sections: [{ title: "run logs", lines: entries }] }
|
|
@@ -34583,6 +34662,37 @@ async function handleRunLogs(args) {
|
|
|
34583
34662
|
);
|
|
34584
34663
|
return 0;
|
|
34585
34664
|
}
|
|
34665
|
+
function selectRunLogTailPage(result, logLevel, limit) {
|
|
34666
|
+
if (logLevel === "debug") {
|
|
34667
|
+
return {
|
|
34668
|
+
entries: [...result.entries],
|
|
34669
|
+
firstSequence: result.firstSequence,
|
|
34670
|
+
lastSequence: result.lastSequence,
|
|
34671
|
+
truncated: result.truncated,
|
|
34672
|
+
hasMore: result.hasMore,
|
|
34673
|
+
nextCursor: result.nextCursor ?? null
|
|
34674
|
+
};
|
|
34675
|
+
}
|
|
34676
|
+
const first = result.firstSequence;
|
|
34677
|
+
if (result.entries.length > 0 && (first === null || result.lastSequence === null || result.lastSequence - first + 1 !== result.entries.length)) {
|
|
34678
|
+
throw new Error(
|
|
34679
|
+
`Run log window is not contiguous (sequences ${first}..${result.lastSequence} for ${result.entries.length} lines); cannot page by severity.`
|
|
34680
|
+
);
|
|
34681
|
+
}
|
|
34682
|
+
const matching = result.entries.map((line, index) => ({ line, seq: first + index })).filter(
|
|
34683
|
+
(entry) => logLevelReaches(classifyLogLine(entry.line).level, logLevel)
|
|
34684
|
+
);
|
|
34685
|
+
const selected = matching.slice(-limit);
|
|
34686
|
+
const olderMatchesExist = matching.length > selected.length;
|
|
34687
|
+
return {
|
|
34688
|
+
entries: selected.map((entry) => entry.line),
|
|
34689
|
+
firstSequence: selected[0]?.seq ?? null,
|
|
34690
|
+
lastSequence: selected.at(-1)?.seq ?? null,
|
|
34691
|
+
truncated: result.truncated || olderMatchesExist,
|
|
34692
|
+
hasMore: olderMatchesExist,
|
|
34693
|
+
nextCursor: olderMatchesExist ? encodeRunLogsCursor(selected[0].seq) : null
|
|
34694
|
+
};
|
|
34695
|
+
}
|
|
34586
34696
|
async function handleRunEventSearch(args) {
|
|
34587
34697
|
const usage2 = "Usage: deepline runs logs [run-id] [--since ISO] [--until ISO] [--play name] [--kind kind] [--where jsonpath] [--payloads] [--cursor token] [--limit 100] [--json]";
|
|
34588
34698
|
const values = {};
|
|
@@ -34748,6 +34858,14 @@ function buildRunLogsText(result) {
|
|
|
34748
34858
|
}
|
|
34749
34859
|
return `${lines.join("\n")}${lines.length > 0 ? "\n" : ""}`;
|
|
34750
34860
|
}
|
|
34861
|
+
function resolveRunStopState(result) {
|
|
34862
|
+
if (result.state) return result.state;
|
|
34863
|
+
if (result.cancelling === true) return "cancelling";
|
|
34864
|
+
if (result.stopped === false || result.staleSchedulerState === true) {
|
|
34865
|
+
return "failed";
|
|
34866
|
+
}
|
|
34867
|
+
return "stopped";
|
|
34868
|
+
}
|
|
34751
34869
|
async function handleRunStop(args) {
|
|
34752
34870
|
const usage2 = 'Usage: deepline runs stop <run-id> [--reason "text"] [--json]';
|
|
34753
34871
|
let runId;
|
|
@@ -34766,15 +34884,25 @@ async function handleRunStop(args) {
|
|
|
34766
34884
|
}
|
|
34767
34885
|
const client2 = new DeeplineClient();
|
|
34768
34886
|
const result = await client2.runs.stop(runId, { reason });
|
|
34769
|
-
|
|
34887
|
+
const state = resolveRunStopState(result);
|
|
34888
|
+
const hitlCleanupIncomplete = state === "cancelling" && result.hitlCancellationPending === true;
|
|
34889
|
+
if (state === "cancelling" && !hitlCleanupIncomplete) {
|
|
34890
|
+
const {
|
|
34891
|
+
error: _legacyError,
|
|
34892
|
+
staleSchedulerState: _legacyStale,
|
|
34893
|
+
...cancelling
|
|
34894
|
+
} = result;
|
|
34770
34895
|
const lines2 = [
|
|
34771
|
-
`
|
|
34896
|
+
`Cancelling run ${result.runId || runId}; sandbox cleanup and the final run update are pending.`,
|
|
34772
34897
|
...result.hitlCancelledCount > 0 ? [`cancelled HITL waits: ${result.hitlCancelledCount}`] : [],
|
|
34773
34898
|
`inspect: deepline runs get ${runId} --full --json`
|
|
34774
34899
|
];
|
|
34775
34900
|
printCommandEnvelope(
|
|
34776
34901
|
{
|
|
34777
|
-
...
|
|
34902
|
+
...cancelling,
|
|
34903
|
+
state,
|
|
34904
|
+
stopped: false,
|
|
34905
|
+
cancelling: true,
|
|
34778
34906
|
render: {
|
|
34779
34907
|
sections: [
|
|
34780
34908
|
{
|
|
@@ -34788,9 +34916,8 @@ async function handleRunStop(args) {
|
|
|
34788
34916
|
);
|
|
34789
34917
|
return 0;
|
|
34790
34918
|
}
|
|
34791
|
-
|
|
34792
|
-
|
|
34793
|
-
const detail = typeof result.error === "string" && result.error.trim() ? result.error.trim() : result.staleSchedulerState === true ? "scheduler state for the run is stale" : "the server did not confirm the stop";
|
|
34919
|
+
if (state === "failed" || hitlCleanupIncomplete) {
|
|
34920
|
+
const detail = typeof result.error === "string" && result.error.trim() ? result.error.trim() : hitlCleanupIncomplete ? "cancellation is queued, but HITL cleanup is still pending" : result.staleSchedulerState === true ? "scheduler state for the run is stale" : "the server did not confirm the stop";
|
|
34794
34921
|
const lines2 = [
|
|
34795
34922
|
`Failed to stop run ${runId}: ${detail}.`,
|
|
34796
34923
|
...result.hitlCancelledCount > 0 ? [`cancelled HITL waits: ${result.hitlCancelledCount}`] : [],
|
|
@@ -36811,15 +36938,15 @@ Examples:
|
|
|
36811
36938
|
...options.json ? ["--json"] : []
|
|
36812
36939
|
]);
|
|
36813
36940
|
});
|
|
36814
|
-
const runs = program.command("runs").description("Inspect,
|
|
36941
|
+
const runs = program.command("runs").description("Inspect, watch, stop, and export play runs.").addHelpText(
|
|
36815
36942
|
"after",
|
|
36816
36943
|
`
|
|
36817
36944
|
Concepts:
|
|
36818
36945
|
A run is one execution instance of a play. It has status, progress, logs,
|
|
36819
36946
|
returned result, dataset previews, recovery metadata, and optional dataset export.
|
|
36820
36947
|
plays run starts NEW work and follows it by default; --no-wait returns immediately.
|
|
36821
|
-
runs
|
|
36822
|
-
Use
|
|
36948
|
+
runs watch attaches to EXISTING work and follows progress without starting a run.
|
|
36949
|
+
Use watch after a disconnect or --no-wait; do not launch again to reconnect.
|
|
36823
36950
|
get reads the current overview once. logs fetches persisted log history.
|
|
36824
36951
|
stop requests cancellation. rerun starts new work and may spend credits.
|
|
36825
36952
|
|
|
@@ -36833,14 +36960,15 @@ Retrieve results:
|
|
|
36833
36960
|
not JSON rows. For a JSON row file, use --format json --out results.json.
|
|
36834
36961
|
|
|
36835
36962
|
Follow existing work:
|
|
36836
|
-
deepline runs
|
|
36837
|
-
|
|
36838
|
-
|
|
36963
|
+
deepline runs watch <run-id>
|
|
36964
|
+
watch --json waits for one terminal JSON document; --jsonl streams live events.
|
|
36965
|
+
runs tail is an alias of runs watch.
|
|
36839
36966
|
|
|
36840
36967
|
More options:
|
|
36841
36968
|
deepline runs get -h
|
|
36842
36969
|
deepline runs children -h
|
|
36843
36970
|
deepline runs tail -h
|
|
36971
|
+
deepline runs watch -h
|
|
36844
36972
|
deepline runs export -h
|
|
36845
36973
|
deepline plays -h
|
|
36846
36974
|
|
|
@@ -36887,6 +37015,7 @@ Notes:
|
|
|
36887
37015
|
Run activity and status evidence retain provider cooldown and call progress.
|
|
36888
37016
|
Use --input only when you intentionally need the original payload; it can
|
|
36889
37017
|
contain customer data and is never included in ordinary status output.
|
|
37018
|
+
--config reads only the recorded graph and source; it never uses current Play code.
|
|
36890
37019
|
--json run.status,datasets.name,actions selects fields without flattening.
|
|
36891
37020
|
Selection changes stdout only, not the server query. Optional missing paths
|
|
36892
37021
|
are omitted; array positions are preserved. --json diagnostics needs --full.
|
|
@@ -36898,6 +37027,7 @@ Examples:
|
|
|
36898
37027
|
deepline runs get play/my-play/run/20260501t000000-000 --log-failed --json
|
|
36899
37028
|
deepline runs get play/my-play/run/20260501t000000-000 --full --json
|
|
36900
37029
|
deepline runs get play/my-play/run/20260501t000000-000 --input
|
|
37030
|
+
deepline runs get play/my-play/run/20260501t000000-000 --config --json
|
|
36901
37031
|
`
|
|
36902
37032
|
).option(
|
|
36903
37033
|
"--json [fields]",
|
|
@@ -36908,6 +37038,9 @@ Examples:
|
|
|
36908
37038
|
).option(
|
|
36909
37039
|
"--input",
|
|
36910
37040
|
"Explicitly print the original retained input JSON (may contain customer data)"
|
|
37041
|
+
).option(
|
|
37042
|
+
"--config",
|
|
37043
|
+
"Explicitly print the recorded configuration, without full results"
|
|
36911
37044
|
).option(
|
|
36912
37045
|
"--log-failed",
|
|
36913
37046
|
"Attach a bounded terminal-failure log window for failed runs"
|
|
@@ -36917,6 +37050,7 @@ Examples:
|
|
|
36917
37050
|
...jsonFieldArgs(options.json),
|
|
36918
37051
|
...options.full ? ["--full"] : [],
|
|
36919
37052
|
...options.input ? ["--input"] : [],
|
|
37053
|
+
...options.config ? ["--config"] : [],
|
|
36920
37054
|
...options.logFailed ? ["--log-failed"] : []
|
|
36921
37055
|
]);
|
|
36922
37056
|
});
|
|
@@ -37057,15 +37191,7 @@ Examples:
|
|
|
37057
37191
|
...options.logLevel ? ["--log-level", options.logLevel] : []
|
|
37058
37192
|
]);
|
|
37059
37193
|
});
|
|
37060
|
-
runs.command("logs [runId]").description(
|
|
37061
|
-
"Fetch one run\u2019s logs or search recent runtime events across runs."
|
|
37062
|
-
).addHelpText("after", renderRunLogsHelp()).option(
|
|
37063
|
-
"--limit <count>",
|
|
37064
|
-
"Text tail: default 200; search: default 100, max 200 (10 with --payloads)"
|
|
37065
|
-
).option("--out <path>", "Write the full retained log stream to a file").option("--failed", "Show the bounded terminal-failure log window").option(
|
|
37066
|
-
"--log-level <level>",
|
|
37067
|
-
"Minimum severity: debug (default), info, warn, or error"
|
|
37068
|
-
).addOption(
|
|
37194
|
+
runs.command("logs [runId]").description("Read a run\u2019s logs or search recent events.").addHelpText("after", renderRunLogsHelp()).option("--limit <count>", "Maximum results: logs 200; events 100, max 200").option("--out <path>", "Save the full available text log").option("--failed", "Last 20 lines of a failed run").option("--log-level <level>", "debug (default), info, warn or error").addOption(
|
|
37069
37195
|
new import_commander3.Option(
|
|
37070
37196
|
"--logs",
|
|
37071
37197
|
"Compatibility alias for --log-level debug"
|
|
@@ -37075,19 +37201,20 @@ Examples:
|
|
|
37075
37201
|
"--debug",
|
|
37076
37202
|
"Compatibility alias for --log-level debug"
|
|
37077
37203
|
).hideHelp()
|
|
37078
|
-
).option("--json", "
|
|
37079
|
-
"--
|
|
37080
|
-
"
|
|
37081
|
-
).
|
|
37082
|
-
|
|
37083
|
-
|
|
37084
|
-
|
|
37085
|
-
|
|
37086
|
-
|
|
37087
|
-
|
|
37088
|
-
|
|
37089
|
-
|
|
37090
|
-
|
|
37204
|
+
).option("--json", "JSON output; automatic when piped").option("--since <timestamp>", "Search from this UTC time").option("--until <timestamp>", "Search before this UTC time").option("--play <name>", "Filter by Play").option("--kind <kind>", "Filter by event kind").option("--where <filter>", "Match event fields; examples below").option("--payloads", "Include available details or saved results").option(
|
|
37205
|
+
"--cursor <token>",
|
|
37206
|
+
"Continue to older logs or the next events page"
|
|
37207
|
+
).addOption(
|
|
37208
|
+
new import_commander3.Option(
|
|
37209
|
+
"--runtime-namespace <name>",
|
|
37210
|
+
"Search an explicitly authorized Preview namespace"
|
|
37211
|
+
).hideHelp()
|
|
37212
|
+
).addOption(
|
|
37213
|
+
new import_commander3.Option(
|
|
37214
|
+
"--runtime-backend <backend>",
|
|
37215
|
+
"Preview backend: daytona or modal"
|
|
37216
|
+
).hideHelp()
|
|
37217
|
+
).action(async (runId, options) => {
|
|
37091
37218
|
process.exitCode = await handleRunLogs([
|
|
37092
37219
|
...runId ? [runId] : [],
|
|
37093
37220
|
...options.limit ? ["--limit", options.limit] : [],
|