deepline 0.3.289 → 0.3.291
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 +8 -6
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/overview.ts +16 -6
- package/dist/bundling-sources/sdk/src/types.ts +21 -2
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +41 -11
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +317 -63
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -2
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/log-context.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +19 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/attempts/worker-terminal-projection.ts +6 -5
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-event-catalog.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +74 -33
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +73 -3
- package/dist/bundling-sources/shared_libs/play-runtime/run-log-buffer.ts +39 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +72 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +2 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +77 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool-options.ts +145 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +17 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +8 -139
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +19 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +176 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +7 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1404 -478
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +55 -25
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +97 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +34 -15
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +558 -57
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +10 -1
- package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/test-admission-batching.ts +103 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +22 -5
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +35 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +68 -8
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/zerobounce-batching.ts +75 -28
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +2 -0
- package/dist/cli/index.js +195 -582
- package/dist/cli/index.mjs +195 -582
- package/dist/{client-FR_u0dxT.d.ts → client-Ct4jmvAg.d.ts} +29 -8
- package/dist/{client-phK1Ixcl.d.mts → client-Ct9GKrwu.d.mts} +29 -8
- package/dist/{compiler-manifest-9SQtUuKb.d.mts → compiler-manifest-qtTNYvBl.d.mts} +2 -0
- package/dist/{compiler-manifest-9SQtUuKb.d.ts → compiler-manifest-qtTNYvBl.d.ts} +2 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +14 -5
- package/dist/index.mjs +14 -5
- package/dist/install-integrity.json +7 -4
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- 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.mjs
CHANGED
|
@@ -3510,7 +3510,7 @@ var SDK_RELEASE = {
|
|
|
3510
3510
|
// getters keep their established compatibility behavior.
|
|
3511
3511
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3512
3512
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3513
|
-
version: "0.3.
|
|
3513
|
+
version: "0.3.291",
|
|
3514
3514
|
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.",
|
|
3515
3515
|
packageCapabilities: {
|
|
3516
3516
|
updatePreferences: 1
|
|
@@ -5546,6 +5546,7 @@ var RUN_SCHEDULER_OUTBOX_EVENT_TYPE = {
|
|
|
5546
5546
|
runCancelled: RUN_EVENT_KIND.runCancelled,
|
|
5547
5547
|
runEvents: "run.events",
|
|
5548
5548
|
runnerLogs: "runner.logs",
|
|
5549
|
+
receiptEvent: "receipt.event",
|
|
5549
5550
|
runWaitTimeout: "run.wait_timeout"
|
|
5550
5551
|
};
|
|
5551
5552
|
var RUN_SCHEDULER_OUTBOX_EVENT_TYPES = Object.freeze(
|
|
@@ -5646,6 +5647,7 @@ var RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL = {
|
|
|
5646
5647
|
runCancelled: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCancelled),
|
|
5647
5648
|
runEvents: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runEvents),
|
|
5648
5649
|
runnerLogs: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runnerLogs),
|
|
5650
|
+
receiptEvent: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.receiptEvent),
|
|
5649
5651
|
runWaitTimeout: sqlStringLiteral(
|
|
5650
5652
|
RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runWaitTimeout
|
|
5651
5653
|
)
|
|
@@ -5975,7 +5977,7 @@ function classifyLegacyLogLine(line) {
|
|
|
5975
5977
|
if (/^\[perf\] runtime receipt\b/i.test(message)) {
|
|
5976
5978
|
return "receipt";
|
|
5977
5979
|
}
|
|
5978
|
-
if (/^\[perf\] runtime
|
|
5980
|
+
if (/^\[perf\]/i.test(message) || /^\[runtime\.(?:phase_summary|logs|log_transport)\]/i.test(message) || /\[worker\] picked up run\b/.test(message) || /\[worker\] heartbeat\b/.test(message) || /\[worker\] progress completedRows=\d+ totalRows=\d+ rowUpdates=\d+/.test(
|
|
5979
5981
|
message
|
|
5980
5982
|
) || /\[worker\] step started\b/.test(message) || /\[worker\] Preparing run files\b/.test(message) || /\[worker\] Run files ready\b/.test(message) || /\[worker\] Runtime ready\b/.test(message) || /\[worker\] Sandbox (?:starting|create start|create done|workspace ready|upload start|runner uploaded)\b/.test(
|
|
5981
5983
|
message
|
|
@@ -7807,8 +7809,10 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
7807
7809
|
/**
|
|
7808
7810
|
* Execute a tool and return the standard execution envelope.
|
|
7809
7811
|
*
|
|
7810
|
-
* The `toolResponse.rawV2` field contains the complete
|
|
7811
|
-
* `
|
|
7812
|
+
* The `toolResponse.rawV2` field contains the complete tool response,
|
|
7813
|
+
* preserving its original nesting. Inspect `getTool().examples` for a full
|
|
7814
|
+
* Deepline response example. Optional `toolResponse.responseMeta` contains
|
|
7815
|
+
* response metadata.
|
|
7812
7816
|
* Top-level fields such as `status`, `job_id`, and `billing` describe the
|
|
7813
7817
|
* Deepline execution envelope.
|
|
7814
7818
|
*/
|
|
@@ -8521,7 +8525,7 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8521
8525
|
});
|
|
8522
8526
|
} catch (error) {
|
|
8523
8527
|
failedLogsLoaded = false;
|
|
8524
|
-
const retryCommand = `deepline runs
|
|
8528
|
+
const retryCommand = `deepline runs logs ${runId} --failed --json`;
|
|
8525
8529
|
const reason = error instanceof Error && error.message.trim() ? ` (${error.message.trim().slice(0, 500)})` : "";
|
|
8526
8530
|
failedLogs = {
|
|
8527
8531
|
runId,
|
|
@@ -21761,7 +21765,7 @@ var KIND_DESCRIPTIONS = {
|
|
|
21761
21765
|
"dataset.lifecycle": "Dataset registered, available or failed.",
|
|
21762
21766
|
"activity.observed": "Provider or workflow activity.",
|
|
21763
21767
|
"work.counters": "Call, request and rate-limit totals.",
|
|
21764
|
-
"receipt.completed": "Saved
|
|
21768
|
+
"receipt.completed": "Saved result or call details.",
|
|
21765
21769
|
"receipt.failed": "Saved work result: failed.",
|
|
21766
21770
|
"receipt.skipped": "Saved work result: skipped.",
|
|
21767
21771
|
"runtime.event": "Other event."
|
|
@@ -21802,6 +21806,10 @@ var FILTER_EXAMPLES = [
|
|
|
21802
21806
|
{
|
|
21803
21807
|
label: "One run and step",
|
|
21804
21808
|
command: `deepline runs logs '<run-id>' --where '$.stepId == "company-lookup"' --json`
|
|
21809
|
+
},
|
|
21810
|
+
{
|
|
21811
|
+
label: "Error logs for one step",
|
|
21812
|
+
command: `deepline runs logs --kind log.appended --where '$.level == "error" && $.stepId == "company-lookup"' --payloads --json`
|
|
21805
21813
|
}
|
|
21806
21814
|
];
|
|
21807
21815
|
function wrapParagraph(text) {
|
|
@@ -21822,10 +21830,14 @@ function renderRunLogsHelp() {
|
|
|
21822
21830
|
"",
|
|
21823
21831
|
"Examples:",
|
|
21824
21832
|
` ${READ_EXAMPLES[0]}`,
|
|
21833
|
+
` deepline runs logs --where '$.eventId == "receipt:5a32ee1a-46cf-4853-b72b-5f1d782ffab4"' --payloads --json`,
|
|
21825
21834
|
" deepline runs logs --kind run.failed --json",
|
|
21826
|
-
...[
|
|
21827
|
-
|
|
21828
|
-
|
|
21835
|
+
...[
|
|
21836
|
+
FILTER_EXAMPLES[1],
|
|
21837
|
+
FILTER_EXAMPLES[2],
|
|
21838
|
+
FILTER_EXAMPLES[5],
|
|
21839
|
+
FILTER_EXAMPLES[7]
|
|
21840
|
+
].map(({ command }) => ` ${command}`),
|
|
21829
21841
|
"",
|
|
21830
21842
|
"Event kinds:",
|
|
21831
21843
|
...RUN_LOGS_KIND_HELP.map(
|
|
@@ -21844,6 +21856,7 @@ function renderRunLogsHelp() {
|
|
|
21844
21856
|
"A run ID alone reads text logs. Omit it or add a search flag to search events; a supplied run ID narrows the search.",
|
|
21845
21857
|
"Defaults to the last hour; maximum lookback is seven days. Follow next.logs for events; use nextCursor with --cursor for older text logs.",
|
|
21846
21858
|
"--payloads returns available details or saved results: up to 10 events and 16 MiB.",
|
|
21859
|
+
"To read one exact saved result, filter by its returned eventId and add --payloads.",
|
|
21847
21860
|
"--out, --failed and --log-level apply to text logs and cannot be combined with event search."
|
|
21848
21861
|
].map((note) => wrapParagraph(note)),
|
|
21849
21862
|
"",
|
|
@@ -22176,13 +22189,6 @@ var DATASET_EXECUTION_BUCKETS = [
|
|
|
22176
22189
|
"skipped:missed",
|
|
22177
22190
|
"failed"
|
|
22178
22191
|
];
|
|
22179
|
-
function formatDatasetRowCountsLine(counts) {
|
|
22180
|
-
const { persisted, succeeded, failed } = counts;
|
|
22181
|
-
if (succeeded === persisted && failed === 0) {
|
|
22182
|
-
return `${persisted} persisted`;
|
|
22183
|
-
}
|
|
22184
|
-
return `${persisted} persisted (${succeeded} succeeded, ${failed} failed)`;
|
|
22185
|
-
}
|
|
22186
22192
|
|
|
22187
22193
|
// src/runs/overview.ts
|
|
22188
22194
|
var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -22201,7 +22207,7 @@ function lifecycleActions(status, id, state) {
|
|
|
22201
22207
|
return {
|
|
22202
22208
|
...["started", "queued", "running", "waiting"].includes(state ?? "") ? { stopRunCmd: `deepline runs stop ${id} --json` } : {},
|
|
22203
22209
|
...state === "failed" ? {
|
|
22204
|
-
getFailedLogsCmd: `deepline runs
|
|
22210
|
+
getFailedLogsCmd: `deepline runs logs ${id} --failed --json`,
|
|
22205
22211
|
...status.rerunCommand ? { rerunCmd: status.rerunCommand } : {}
|
|
22206
22212
|
} : {}
|
|
22207
22213
|
};
|
|
@@ -22404,7 +22410,7 @@ function buildRunOverview(status, fullStatus) {
|
|
|
22404
22410
|
);
|
|
22405
22411
|
return {
|
|
22406
22412
|
datasetId: dataset.datasetId,
|
|
22407
|
-
name: dataset.tableNamespace,
|
|
22413
|
+
name: dataset.tableNamespace ?? (typeof stepOutput?.tableNamespace === "string" ? stepOutput.tableNamespace : dataset.path),
|
|
22408
22414
|
stepId: step?.id ?? named[0]?.[1].stepId,
|
|
22409
22415
|
rowCount: dataset.rowCount ?? null,
|
|
22410
22416
|
...dataset.lifecycle ? { lifecycle: dataset.lifecycle } : {},
|
|
@@ -22498,7 +22504,7 @@ function buildRunOverview(status, fullStatus) {
|
|
|
22498
22504
|
function receiptAction(id) {
|
|
22499
22505
|
const quotedId = `'${id.replace(/'/g, "'\\''")}'`;
|
|
22500
22506
|
return {
|
|
22501
|
-
getReceiptCmd: `deepline runs
|
|
22507
|
+
getReceiptCmd: `deepline runs logs ${quotedId} --kind receipt.completed --payloads --json`
|
|
22502
22508
|
};
|
|
22503
22509
|
}
|
|
22504
22510
|
function buildRunNavigation(status) {
|
|
@@ -24385,7 +24391,7 @@ Examples:
|
|
|
24385
24391
|
// src/cli/commands/run-receipt.ts
|
|
24386
24392
|
import { readFile, writeFile as writeFile3 } from "fs/promises";
|
|
24387
24393
|
function registerRunReceiptCommand(runs) {
|
|
24388
|
-
runs.command("receipt <runId>").description(
|
|
24394
|
+
runs.command("receipt <runId>", { hidden: true }).description(
|
|
24389
24395
|
"Read retained tool responses by receipt key. Never executes tools."
|
|
24390
24396
|
).option(
|
|
24391
24397
|
"--key <key>",
|
|
@@ -24399,8 +24405,7 @@ function registerRunReceiptCommand(runs) {
|
|
|
24399
24405
|
"after",
|
|
24400
24406
|
`
|
|
24401
24407
|
Examples:
|
|
24402
|
-
deepline runs
|
|
24403
|
-
jq -r '.[].receipt_key' rows.json | deepline runs receipt <run-id> --keys - --out responses.json
|
|
24408
|
+
deepline runs logs <run-id> --kind receipt.completed --payloads --json
|
|
24404
24409
|
|
|
24405
24410
|
Returns one outcome per key, preserving order and duplicates. A missing or
|
|
24406
24411
|
unavailable result is explicit; other keys are still returned. Exit 4 means
|
|
@@ -31670,7 +31675,7 @@ async function traceCliSpan(phase, fields2, run) {
|
|
|
31670
31675
|
}
|
|
31671
31676
|
|
|
31672
31677
|
// src/cli/play-check-hints.ts
|
|
31673
|
-
var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`.
|
|
31678
|
+
var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`. Read tool-specific fields from `toolExecutionResult.toolResponse.rawV2` using the nesting shown in the response example, and use `toolExecutionResult.extractedLists.<name>.get()` for declared row/list outputs.";
|
|
31674
31679
|
var DATASET_API_HINT = "Deepline hint: PlayDataset is lazy, durable, and async-only. Use `.count()`, `.first()`, `.at(index)`, `.peek(n)`, `.materialize(limit)`, or async iteration; do not use `.length`, numeric indexing, spread, synchronous iteration, `.rows`, or `.toArray()`.";
|
|
31675
31680
|
var ROW_PROPERTY_HINT = "Deepline hint: this row type only contains fields produced by the CSV/schema and previous map steps. Check source column casing and the exact output field names from earlier steps before scaling.";
|
|
31676
31681
|
var TOOLS_EXECUTE_SIGNATURE_HINT = "Deepline hint: ctx.tools.execute requires a request object: `ctx.tools.execute({ id, tool, input, description })`. The stable `id` is required for logs, metadata, and result-cache identity; terminal cache reuse is based on play, tool, semantic input, auth scope, provider action version, and cache policy.";
|
|
@@ -36638,12 +36643,13 @@ function buildRunNextCommands(status) {
|
|
|
36638
36643
|
};
|
|
36639
36644
|
}
|
|
36640
36645
|
const actions2 = buildRunNavigation(status).actions;
|
|
36646
|
+
const exportDatasetCmds = Array.isArray(actions2.exportDatasetCmds) ? actions2.exportDatasetCmds : !status.package && extractCanonicalRowsInfo(status) ? [`deepline runs export ${runId} --out output.csv`] : [];
|
|
36641
36647
|
const commands = {
|
|
36642
36648
|
get: String(actions2.getRunCmd ?? `deepline runs get ${runId} --json`),
|
|
36643
36649
|
full: String(
|
|
36644
36650
|
actions2.getFullRunCmd ?? `deepline runs get ${runId} --full --json`
|
|
36645
36651
|
),
|
|
36646
|
-
...
|
|
36652
|
+
...exportDatasetCmds.length === 1 ? { export: String(exportDatasetCmds[0]) } : {},
|
|
36647
36653
|
logs: String(
|
|
36648
36654
|
!status.package ? `deepline runs logs ${runId} --out run.log --json` : actions2.getLogsCmd ?? `deepline runs logs ${runId} --limit 100 --json`
|
|
36649
36655
|
)
|
|
@@ -36652,7 +36658,7 @@ function buildRunNextCommands(status) {
|
|
|
36652
36658
|
commands.stop = `deepline runs stop ${runId} --json`;
|
|
36653
36659
|
}
|
|
36654
36660
|
if (status.status === "failed") {
|
|
36655
|
-
commands.failedLogs = `deepline runs
|
|
36661
|
+
commands.failedLogs = `deepline runs logs ${runId} --failed --json`;
|
|
36656
36662
|
if (status.rerunCommand) commands.run = status.rerunCommand;
|
|
36657
36663
|
}
|
|
36658
36664
|
if (status.dashboardUrl) {
|
|
@@ -37083,7 +37089,7 @@ function compactPlayStatus(status) {
|
|
|
37083
37089
|
next: {
|
|
37084
37090
|
...readRecord(packaged.next) ?? {},
|
|
37085
37091
|
...status.failedLogs ? {
|
|
37086
|
-
failedLogs: `deepline runs
|
|
37092
|
+
failedLogs: `deepline runs logs ${status.runId} --failed --json`
|
|
37087
37093
|
} : {},
|
|
37088
37094
|
...status.rerunCommand ? { run: status.rerunCommand } : {}
|
|
37089
37095
|
}
|
|
@@ -37096,14 +37102,14 @@ function compactPlayStatus(status) {
|
|
|
37096
37102
|
...status.failedLogs ? {
|
|
37097
37103
|
next: {
|
|
37098
37104
|
...readRecord(packaged.next) ?? {},
|
|
37099
|
-
failedLogs: `deepline runs
|
|
37105
|
+
failedLogs: `deepline runs logs ${status.runId} --failed --json`
|
|
37100
37106
|
}
|
|
37101
37107
|
} : {},
|
|
37102
37108
|
...status.rerunCommand ? {
|
|
37103
37109
|
next: {
|
|
37104
37110
|
...readRecord(packaged.next) ?? {},
|
|
37105
37111
|
...status.failedLogs ? {
|
|
37106
|
-
failedLogs: `deepline runs
|
|
37112
|
+
failedLogs: `deepline runs logs ${status.runId} --failed --json`
|
|
37107
37113
|
} : {},
|
|
37108
37114
|
run: status.rerunCommand
|
|
37109
37115
|
}
|
|
@@ -37152,9 +37158,6 @@ function compactRunErrorForEnvelope(message, runId) {
|
|
|
37152
37158
|
const headline = firstStackFrame >= 0 ? lines.slice(0, firstStackFrame).join("\n") : message;
|
|
37153
37159
|
return truncateErrorForDisplay(headline, runId, 1e3);
|
|
37154
37160
|
}
|
|
37155
|
-
function readRunPackageRun(packaged) {
|
|
37156
|
-
return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
|
|
37157
|
-
}
|
|
37158
37161
|
function readRecordArray(value) {
|
|
37159
37162
|
return Array.isArray(value) ? value.filter(
|
|
37160
37163
|
(item) => item !== null && typeof item === "object" && !Array.isArray(item)
|
|
@@ -37166,131 +37169,6 @@ function readRecord(value) {
|
|
|
37166
37169
|
function readNonNegativeInteger(value) {
|
|
37167
37170
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : null;
|
|
37168
37171
|
}
|
|
37169
|
-
function formatSummaryScalar(value) {
|
|
37170
|
-
if (typeof value === "number") {
|
|
37171
|
-
return Number.isFinite(value) ? formatInteger(Math.trunc(value)) : null;
|
|
37172
|
-
}
|
|
37173
|
-
if (typeof value === "string" || typeof value === "boolean") {
|
|
37174
|
-
return String(value);
|
|
37175
|
-
}
|
|
37176
|
-
if (value === null) {
|
|
37177
|
-
return "null";
|
|
37178
|
-
}
|
|
37179
|
-
return null;
|
|
37180
|
-
}
|
|
37181
|
-
function formatSummaryScalarParts(record5, skipKeys = /* @__PURE__ */ new Set()) {
|
|
37182
|
-
const parts = [];
|
|
37183
|
-
for (const [key, value] of Object.entries(record5)) {
|
|
37184
|
-
if (skipKeys.has(key)) {
|
|
37185
|
-
continue;
|
|
37186
|
-
}
|
|
37187
|
-
const formatted = formatSummaryScalar(value);
|
|
37188
|
-
if (formatted !== null) {
|
|
37189
|
-
parts.push(`${key}=${formatted}`);
|
|
37190
|
-
}
|
|
37191
|
-
}
|
|
37192
|
-
return parts;
|
|
37193
|
-
}
|
|
37194
|
-
var DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT = 10;
|
|
37195
|
-
function formatTopValuesPart(value) {
|
|
37196
|
-
const topValues = readRecord(value);
|
|
37197
|
-
if (!topValues) {
|
|
37198
|
-
return null;
|
|
37199
|
-
}
|
|
37200
|
-
const entries = Object.entries(topValues).slice(
|
|
37201
|
-
0,
|
|
37202
|
-
DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT
|
|
37203
|
-
);
|
|
37204
|
-
if (entries.length === 0) {
|
|
37205
|
-
return null;
|
|
37206
|
-
}
|
|
37207
|
-
return `top_values=${entries.map(([topValue, count2]) => `${topValue}=${String(count2)}`).join(", ")}`;
|
|
37208
|
-
}
|
|
37209
|
-
function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
|
|
37210
|
-
const record5 = readRecord(summary);
|
|
37211
|
-
const columnStats = readRecord(record5?.columnStats);
|
|
37212
|
-
if (!record5 || !columnStats) {
|
|
37213
|
-
return [];
|
|
37214
|
-
}
|
|
37215
|
-
const lines = [];
|
|
37216
|
-
const rowCounts = readRecord(record5.rowCounts);
|
|
37217
|
-
if (rowCounts) {
|
|
37218
|
-
const persisted = readNonNegativeInteger(rowCounts.persisted);
|
|
37219
|
-
const succeeded = readNonNegativeInteger(rowCounts.succeeded);
|
|
37220
|
-
const failed = readNonNegativeInteger(rowCounts.failed);
|
|
37221
|
-
if (persisted !== null) {
|
|
37222
|
-
lines.push(
|
|
37223
|
-
`${indent2}rows: ${formatDatasetRowCountsLine({
|
|
37224
|
-
persisted,
|
|
37225
|
-
succeeded: succeeded ?? persisted,
|
|
37226
|
-
failed: failed ?? 0
|
|
37227
|
-
})}`
|
|
37228
|
-
);
|
|
37229
|
-
}
|
|
37230
|
-
}
|
|
37231
|
-
const parts = formatSummaryScalarParts(
|
|
37232
|
-
record5,
|
|
37233
|
-
/* @__PURE__ */ new Set(["columnStats", "rowCounts"])
|
|
37234
|
-
);
|
|
37235
|
-
if (parts.length > 0) {
|
|
37236
|
-
lines.push(`${indent2}summary: ${parts.join(" ")}`);
|
|
37237
|
-
}
|
|
37238
|
-
for (const [column, rawColumnSummary] of Object.entries(columnStats)) {
|
|
37239
|
-
const columnSummary = readRecord(rawColumnSummary);
|
|
37240
|
-
if (!columnSummary) continue;
|
|
37241
|
-
const execution = readRecord(columnSummary.execution);
|
|
37242
|
-
const executionText = execution ? Object.entries(execution).map(([bucket, value]) => `${bucket}=${String(value)}`).join(", ") : "";
|
|
37243
|
-
const topValuesText = formatTopValuesPart(columnSummary.top_values);
|
|
37244
|
-
const columnParts = [
|
|
37245
|
-
...formatSummaryScalarParts(
|
|
37246
|
-
columnSummary,
|
|
37247
|
-
/* @__PURE__ */ new Set(["execution", "top_values"])
|
|
37248
|
-
),
|
|
37249
|
-
topValuesText,
|
|
37250
|
-
executionText ? `execution=${executionText}` : null
|
|
37251
|
-
].filter(Boolean);
|
|
37252
|
-
if (columnParts.length > 0) {
|
|
37253
|
-
lines.push(`${indent2} ${column}: ${columnParts.join(" ")}`);
|
|
37254
|
-
}
|
|
37255
|
-
}
|
|
37256
|
-
return lines;
|
|
37257
|
-
}
|
|
37258
|
-
function actionToCommand(action) {
|
|
37259
|
-
if (!action || typeof action !== "object" || Array.isArray(action)) {
|
|
37260
|
-
return null;
|
|
37261
|
-
}
|
|
37262
|
-
const record5 = action;
|
|
37263
|
-
if (typeof record5.command === "string" && record5.command.trim()) {
|
|
37264
|
-
return record5.command.trim();
|
|
37265
|
-
}
|
|
37266
|
-
if (record5.kind === "deepline_run_inspect" && typeof record5.runId === "string") {
|
|
37267
|
-
return `deepline runs get ${record5.runId} --json`;
|
|
37268
|
-
}
|
|
37269
|
-
if (record5.kind === "deepline_run_full" && typeof record5.runId === "string") {
|
|
37270
|
-
return `deepline runs get ${record5.runId} --full --json`;
|
|
37271
|
-
}
|
|
37272
|
-
if (record5.kind === "deepline_run_billing" && typeof record5.runId === "string") {
|
|
37273
|
-
return `deepline runs get ${record5.runId} --full --json | jq '.billing'`;
|
|
37274
|
-
}
|
|
37275
|
-
if (record5.kind === "deepline_run_export" && typeof record5.runId === "string" && typeof record5.datasetPath === "string") {
|
|
37276
|
-
return `deepline runs export ${record5.runId} --dataset ${shellSingleQuote(
|
|
37277
|
-
record5.datasetPath
|
|
37278
|
-
)} --out ${shellSingleQuote(`${record5.datasetPath.split(".").pop() || "dataset"}.csv`)}`;
|
|
37279
|
-
}
|
|
37280
|
-
if (record5.kind === "deepline_run_logs") {
|
|
37281
|
-
if (typeof record5.command === "string" && record5.command.trim()) {
|
|
37282
|
-
return record5.command;
|
|
37283
|
-
}
|
|
37284
|
-
if (typeof record5.runId === "string") {
|
|
37285
|
-
return record5.view === "failed" ? `deepline runs get ${record5.runId} --log-failed --json` : `deepline runs logs ${record5.runId} --json`;
|
|
37286
|
-
}
|
|
37287
|
-
}
|
|
37288
|
-
if (record5.kind === "deepline_db_query" && typeof record5.sql === "string") {
|
|
37289
|
-
const maxRows = typeof record5.maxRows === "number" && Number.isFinite(record5.maxRows) ? Math.trunc(record5.maxRows) : 20;
|
|
37290
|
-
return `deepline db query --sql ${shellSingleQuote(record5.sql)} --max-rows ${maxRows} --json`;
|
|
37291
|
-
}
|
|
37292
|
-
return null;
|
|
37293
|
-
}
|
|
37294
37172
|
function packageDatasetRecords(packaged) {
|
|
37295
37173
|
const catalog = readRecordArray(packaged.datasets);
|
|
37296
37174
|
if (catalog.length > 0) return catalog;
|
|
@@ -37299,24 +37177,6 @@ function packageDatasetRecords(packaged) {
|
|
|
37299
37177
|
return output2?.kind === "dataset" ? [output2] : [];
|
|
37300
37178
|
});
|
|
37301
37179
|
}
|
|
37302
|
-
function packageReturnedDatasetIdentity(packaged) {
|
|
37303
|
-
const datasetIds = /* @__PURE__ */ new Set();
|
|
37304
|
-
const paths = /* @__PURE__ */ new Set();
|
|
37305
|
-
const outputs = readRecord(packaged.outputs) ?? {};
|
|
37306
|
-
for (const outputValue of Object.values(outputs)) {
|
|
37307
|
-
const output2 = readRecord(outputValue);
|
|
37308
|
-
if (output2?.kind !== "dataset") continue;
|
|
37309
|
-
if (typeof output2.datasetId === "string" && output2.datasetId.trim()) {
|
|
37310
|
-
datasetIds.add(output2.datasetId.trim());
|
|
37311
|
-
}
|
|
37312
|
-
for (const candidate of [output2.dataset, output2.path]) {
|
|
37313
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
37314
|
-
paths.add(candidate.trim());
|
|
37315
|
-
}
|
|
37316
|
-
}
|
|
37317
|
-
}
|
|
37318
|
-
return { datasetIds, paths };
|
|
37319
|
-
}
|
|
37320
37180
|
function formatRunStepProgress(progress, includeRowOutcomes = false) {
|
|
37321
37181
|
const executed = readNonNegativeInteger(progress.executed);
|
|
37322
37182
|
const total = readNonNegativeInteger(progress.total);
|
|
@@ -37339,205 +37199,6 @@ function formatRunStepProgress(progress, includeRowOutcomes = false) {
|
|
|
37339
37199
|
}
|
|
37340
37200
|
return parts.join(" \xB7 ");
|
|
37341
37201
|
}
|
|
37342
|
-
function formatPackageDatasetActionLines(packaged, options) {
|
|
37343
|
-
const returned = packageReturnedDatasetIdentity(packaged);
|
|
37344
|
-
const includeSummary = options?.includeSummary ?? true;
|
|
37345
|
-
const lines = [];
|
|
37346
|
-
const steps = readRecordArray(packaged.steps);
|
|
37347
|
-
const stepsByDatasetId = /* @__PURE__ */ new Map();
|
|
37348
|
-
const stepsByPath = /* @__PURE__ */ new Map();
|
|
37349
|
-
const stepsByNamespace = /* @__PURE__ */ new Map();
|
|
37350
|
-
for (const step of steps) {
|
|
37351
|
-
if (step.kind !== "dataset") continue;
|
|
37352
|
-
const output2 = readRecord(step.output);
|
|
37353
|
-
if (typeof output2?.datasetId === "string") {
|
|
37354
|
-
stepsByDatasetId.set(output2.datasetId, step);
|
|
37355
|
-
}
|
|
37356
|
-
if (typeof output2?.path === "string") {
|
|
37357
|
-
stepsByPath.set(output2.path, step);
|
|
37358
|
-
}
|
|
37359
|
-
if (typeof step.id === "string") {
|
|
37360
|
-
stepsByNamespace.set(step.id, step);
|
|
37361
|
-
}
|
|
37362
|
-
}
|
|
37363
|
-
for (const dataset of packageDatasetRecords(packaged)) {
|
|
37364
|
-
const path = typeof dataset.path === "string" && dataset.path.trim() ? dataset.path.trim() : "dataset";
|
|
37365
|
-
const datasetId = typeof dataset.datasetId === "string" ? dataset.datasetId.trim() : "";
|
|
37366
|
-
const isReturned = datasetId && returned.datasetIds.has(datasetId) || returned.paths.has(path);
|
|
37367
|
-
const category = isReturned ? "returned" : dataset.recovered === true ? "recovered" : "persisted";
|
|
37368
|
-
const rowCount = typeof dataset.rowCount === "number" && Number.isFinite(dataset.rowCount) ? Math.max(0, Math.trunc(dataset.rowCount)) : null;
|
|
37369
|
-
const lifecycle = readRecord(dataset.lifecycle);
|
|
37370
|
-
const countUnconfirmed = lifecycle?.complete === false;
|
|
37371
|
-
const persistedLowerBound = typeof lifecycle?.persistedRowsAtLeast === "number" && Number.isFinite(lifecycle.persistedRowsAtLeast) ? Math.max(0, Math.trunc(lifecycle.persistedRowsAtLeast)) : 0;
|
|
37372
|
-
const actions2 = readRecord(dataset.actions) ?? {};
|
|
37373
|
-
if (countUnconfirmed) {
|
|
37374
|
-
lines.push(
|
|
37375
|
-
` dataset ${path}: row count unconfirmed (at least ${formatInteger(persistedLowerBound)} persisted)`
|
|
37376
|
-
);
|
|
37377
|
-
} else if (includeSummary) {
|
|
37378
|
-
if (category === "recovered" && Object.keys(actions2).length === 0) {
|
|
37379
|
-
lines.push(
|
|
37380
|
-
` dataset ${path}: available, ${rowCount === null ? "persisted" : formatInteger(rowCount)} rows persisted; re-running reuses completed work`
|
|
37381
|
-
);
|
|
37382
|
-
} else {
|
|
37383
|
-
lines.push(
|
|
37384
|
-
` ${category} dataset ${path}: ${rowCount === null ? "unknown rows" : `${formatInteger(rowCount)} ${rowCount === 1 ? "row" : "rows"}`}`
|
|
37385
|
-
);
|
|
37386
|
-
}
|
|
37387
|
-
}
|
|
37388
|
-
const step = (datasetId ? stepsByDatasetId.get(datasetId) : void 0) ?? stepsByPath.get(path) ?? (typeof dataset.tableNamespace === "string" ? stepsByNamespace.get(dataset.tableNamespace) : void 0);
|
|
37389
|
-
const progress = readRecord(step?.progress);
|
|
37390
|
-
if (progress) {
|
|
37391
|
-
lines.push(` progress: ${formatRunStepProgress(progress)}`);
|
|
37392
|
-
}
|
|
37393
|
-
if (lifecycle) {
|
|
37394
|
-
const succeeded = readNonNegativeInteger(lifecycle.succeededRowsAtLeast);
|
|
37395
|
-
const failed = readNonNegativeInteger(lifecycle.failedRowsAtLeast);
|
|
37396
|
-
const complete = lifecycle.complete === true;
|
|
37397
|
-
lines.push(
|
|
37398
|
-
` saved: ${complete ? "" : "at least "}${formatInteger(persistedLowerBound)} persisted${succeeded === null ? "" : ` \xB7 ${complete ? "" : "at least "}${formatInteger(succeeded)} succeeded`}${failed === null ? "" : ` \xB7 ${complete ? "" : "at least "}${formatInteger(failed)} failed`}`
|
|
37399
|
-
);
|
|
37400
|
-
}
|
|
37401
|
-
const exportAction = readRecord(actions2.exportCsv);
|
|
37402
|
-
const exportCommand = actionToCommand(exportAction);
|
|
37403
|
-
const exportScope = readRecord(exportAction?.scope);
|
|
37404
|
-
const queryAction = readRecord(actions2.query);
|
|
37405
|
-
const queryScope = readRecord(queryAction?.scope);
|
|
37406
|
-
const runQueryCommand = queryScope?.kind === "run" ? actionToCommand(queryAction) : null;
|
|
37407
|
-
const currentQueryCommand = actionToCommand(actions2.queryCurrentTable);
|
|
37408
|
-
const legacyQueryCommand = actionToCommand(actions2.query);
|
|
37409
|
-
if (runQueryCommand) {
|
|
37410
|
-
lines.push(` query rows from this run: ${runQueryCommand}`);
|
|
37411
|
-
} else if (currentQueryCommand) {
|
|
37412
|
-
lines.push(` query current table: ${currentQueryCommand}`);
|
|
37413
|
-
} else if (legacyQueryCommand) {
|
|
37414
|
-
lines.push(` query run rows (legacy): ${legacyQueryCommand}`);
|
|
37415
|
-
}
|
|
37416
|
-
if (exportCommand) {
|
|
37417
|
-
lines.push(
|
|
37418
|
-
exportScope?.kind === "database" ? ` export current table (may include other runs): ${exportCommand}` : ` export this run: ${exportCommand}`
|
|
37419
|
-
);
|
|
37420
|
-
}
|
|
37421
|
-
const unavailable = readRecord(dataset.exportUnavailable);
|
|
37422
|
-
if (typeof unavailable?.reason === "string" && typeof unavailable.message === "string") {
|
|
37423
|
-
lines.push(
|
|
37424
|
-
` export unavailable (${unavailable.reason}): ${unavailable.message}`
|
|
37425
|
-
);
|
|
37426
|
-
}
|
|
37427
|
-
}
|
|
37428
|
-
return lines;
|
|
37429
|
-
}
|
|
37430
|
-
function packageSavedRowCount(packaged) {
|
|
37431
|
-
const rowCounts = packageDatasetRecords(packaged).map((dataset) => dataset.rowCount).filter(
|
|
37432
|
-
(rowCount) => typeof rowCount === "number" && Number.isFinite(rowCount)
|
|
37433
|
-
).map((rowCount) => Math.max(0, Math.trunc(rowCount)));
|
|
37434
|
-
if (rowCounts.length === 0) return null;
|
|
37435
|
-
return rowCounts.reduce((total, rowCount) => total + rowCount, 0);
|
|
37436
|
-
}
|
|
37437
|
-
function runtimeLimitWindowLabel(runtimeLimitFailure) {
|
|
37438
|
-
const message = getStringField(runtimeLimitFailure, "message") ?? "";
|
|
37439
|
-
const configuredSeconds = /\bconfigured\s+(\d+)\s+second(?:s)?\s+runtime limit\b/i.exec(message)?.[1];
|
|
37440
|
-
if (configuredSeconds) {
|
|
37441
|
-
const seconds = Number(configuredSeconds);
|
|
37442
|
-
if (Number.isSafeInteger(seconds) && seconds > 0) {
|
|
37443
|
-
if (seconds % 3600 === 0) return `${seconds / 3600}-hour`;
|
|
37444
|
-
if (seconds % 60 === 0) return `${seconds / 60}-minute`;
|
|
37445
|
-
return `${seconds}-second`;
|
|
37446
|
-
}
|
|
37447
|
-
}
|
|
37448
|
-
const match = /\b(\d+)\s+(hour|hours|minute|minutes|second|seconds)\b/i.exec(
|
|
37449
|
-
message
|
|
37450
|
-
);
|
|
37451
|
-
if (!match) return "30-minute";
|
|
37452
|
-
const unit = match[2].toLowerCase().replace(/s$/, "");
|
|
37453
|
-
return `${match[1]}-${unit}`;
|
|
37454
|
-
}
|
|
37455
|
-
function runtimeLimitCheckpointLines(packaged, runId, runtimeLimitFailure) {
|
|
37456
|
-
const savedRows = packageSavedRowCount(packaged);
|
|
37457
|
-
const lines = [
|
|
37458
|
-
`\u2713 progress saved ${runId}`,
|
|
37459
|
-
"",
|
|
37460
|
-
`The Play reached its ${runtimeLimitWindowLabel(runtimeLimitFailure)} runtime window.`
|
|
37461
|
-
];
|
|
37462
|
-
if (savedRows === null) {
|
|
37463
|
-
lines.push("Progress completed before the runtime window closed.");
|
|
37464
|
-
} else {
|
|
37465
|
-
lines.push(
|
|
37466
|
-
`${formatInteger(savedRows)} ${savedRows === 1 ? "row was" : "rows were"} saved successfully.`
|
|
37467
|
-
);
|
|
37468
|
-
}
|
|
37469
|
-
lines.push(
|
|
37470
|
-
"",
|
|
37471
|
-
"Run the same Play again to continue where you left off.",
|
|
37472
|
-
"Completed work will be reused automatically."
|
|
37473
|
-
);
|
|
37474
|
-
return lines;
|
|
37475
|
-
}
|
|
37476
|
-
function formatInlinePackageValue(value) {
|
|
37477
|
-
const compacted = compactReturnValue(value);
|
|
37478
|
-
const json2 = JSON.stringify(compacted);
|
|
37479
|
-
return clampJsonPreviewText(json2 ?? String(compacted), 500);
|
|
37480
|
-
}
|
|
37481
|
-
function formatPackageValueOutputLines(packaged) {
|
|
37482
|
-
const outputs = packaged.outputs && typeof packaged.outputs === "object" && !Array.isArray(packaged.outputs) ? packaged.outputs : null;
|
|
37483
|
-
if (!outputs) return [];
|
|
37484
|
-
const returned = Object.entries(outputs).filter(([, output2]) => {
|
|
37485
|
-
const record5 = readRecord(output2);
|
|
37486
|
-
return record5?.kind === "dataset" || record5?.kind === "value" && Object.prototype.hasOwnProperty.call(record5, "value");
|
|
37487
|
-
});
|
|
37488
|
-
if (returned.length === 0) return [];
|
|
37489
|
-
const datasets = packageDatasetRecords(packaged);
|
|
37490
|
-
const datasetSteps = readRecordArray(packaged.steps).filter(
|
|
37491
|
-
(step) => step.kind === "dataset"
|
|
37492
|
-
);
|
|
37493
|
-
const lines = [" result:"];
|
|
37494
|
-
for (const [name, rawOutput] of returned.slice(0, 8)) {
|
|
37495
|
-
const output2 = readRecord(rawOutput);
|
|
37496
|
-
if (output2.kind === "dataset") {
|
|
37497
|
-
const path = typeof output2.dataset === "string" ? output2.dataset : name;
|
|
37498
|
-
const rowCount = readNonNegativeInteger(output2.rowCount);
|
|
37499
|
-
lines.push(
|
|
37500
|
-
` ${name}: dataset ${path}${rowCount === null ? "" : ` (${formatInteger(rowCount)} persisted rows)`}`
|
|
37501
|
-
);
|
|
37502
|
-
const dataset = datasets.find(
|
|
37503
|
-
(candidate) => typeof output2.datasetId === "string" && candidate.datasetId === output2.datasetId || candidate.path === path
|
|
37504
|
-
);
|
|
37505
|
-
const stepOutput = datasetSteps.map((step) => readRecord(step.output)).find(
|
|
37506
|
-
(candidate) => typeof output2.datasetId === "string" && candidate?.datasetId === output2.datasetId || candidate?.path === path
|
|
37507
|
-
);
|
|
37508
|
-
const preview = readRecord(stepOutput?.preview ?? dataset?.preview);
|
|
37509
|
-
const rows = Array.isArray(preview?.rows) ? preview.rows.slice(0, 2) : [];
|
|
37510
|
-
if (rows.length > 0) {
|
|
37511
|
-
lines.push(` sample rows (${rows.length}):`);
|
|
37512
|
-
lines.push(
|
|
37513
|
-
...rows.map(
|
|
37514
|
-
(row) => ` ${clampJsonPreviewText(JSON.stringify(row) ?? String(row), 350)}`
|
|
37515
|
-
)
|
|
37516
|
-
);
|
|
37517
|
-
}
|
|
37518
|
-
continue;
|
|
37519
|
-
}
|
|
37520
|
-
const value = output2.value;
|
|
37521
|
-
const compacted = compactReturnValue(value);
|
|
37522
|
-
if (compacted && typeof compacted === "object") {
|
|
37523
|
-
lines.push(` ${name}:`);
|
|
37524
|
-
lines.push(...formatJsonPreview(compacted).map((line) => ` ${line}`));
|
|
37525
|
-
} else {
|
|
37526
|
-
lines.push(` ${name}: ${formatInlinePackageValue(value)}`);
|
|
37527
|
-
}
|
|
37528
|
-
}
|
|
37529
|
-
if (returned.length > 8) {
|
|
37530
|
-
lines.push(` ... ${returned.length - 8} more output(s)`);
|
|
37531
|
-
}
|
|
37532
|
-
return lines;
|
|
37533
|
-
}
|
|
37534
|
-
function authoredPackageStackFrames(packaged) {
|
|
37535
|
-
const stack = readRecordArray(packaged.errors).map((entry) => typeof entry.stack === "string" ? entry.stack : null).find((candidate) => Boolean(candidate?.trim()));
|
|
37536
|
-
if (!stack) return [];
|
|
37537
|
-
return stack.split("\n").map((line) => line.trim()).filter((line) => line.startsWith("at ")).filter(
|
|
37538
|
-
(line) => !line.includes("/virtual/deepline-plays/") && !line.includes("/apps/play-runner/") && !line.includes("/shared_libs/play-runtime/") && !line.includes("node:internal")
|
|
37539
|
-
).slice(0, 5);
|
|
37540
|
-
}
|
|
37541
37202
|
function activityTargetLabel(target) {
|
|
37542
37203
|
const kind = typeof target.kind === "string" ? target.kind : "target";
|
|
37543
37204
|
const label = typeof target.label === "string" ? target.label.trim() : "";
|
|
@@ -37693,152 +37354,6 @@ function formatRunTimingTextLines(run) {
|
|
|
37693
37354
|
].join(" \xB7 ")}`
|
|
37694
37355
|
];
|
|
37695
37356
|
}
|
|
37696
|
-
function formatRecentRunLogLines(value) {
|
|
37697
|
-
const logs = readRecord(value);
|
|
37698
|
-
if (!logs || !Array.isArray(logs.tail)) return [];
|
|
37699
|
-
const tail = logs.tail.filter(
|
|
37700
|
-
(line) => typeof line === "string"
|
|
37701
|
-
);
|
|
37702
|
-
if (tail.length === 0) return [];
|
|
37703
|
-
const shown = tail.map((line) => classifyLogLine(line)).filter(
|
|
37704
|
-
(entry) => entry.level !== "debug" && !isProviderRowWaitLogLine(entry.line)
|
|
37705
|
-
).slice(-8);
|
|
37706
|
-
const total = readNonNegativeInteger(logs.totalCount);
|
|
37707
|
-
if (shown.length === 0) {
|
|
37708
|
-
return [
|
|
37709
|
-
` recent logs: no non-debug lines in the retained preview (${total === null ? "total unknown" : `${formatInteger(total)} total`})`,
|
|
37710
|
-
...logs.truncated === true ? [" [older log bodies lost to retention limit]"] : []
|
|
37711
|
-
];
|
|
37712
|
-
}
|
|
37713
|
-
const lines = [
|
|
37714
|
-
` recent logs (${total === null ? "count unknown" : `${formatInteger(total)} total`}; showing ${shown.length}):`,
|
|
37715
|
-
...shown.map(
|
|
37716
|
-
(entry) => ` ${clampJsonPreviewText(formatProviderCapacityWaitLogLine(entry.line) ?? formatMapProgressDiagnosticLogLine(entry.line) ?? entry.line, 350)}`
|
|
37717
|
-
)
|
|
37718
|
-
];
|
|
37719
|
-
if (logs.truncated === true) {
|
|
37720
|
-
lines.push(" [older log bodies lost to retention limit]");
|
|
37721
|
-
}
|
|
37722
|
-
return lines;
|
|
37723
|
-
}
|
|
37724
|
-
function buildRunPackageTextLines(packaged) {
|
|
37725
|
-
const run = readRunPackageRun(packaged);
|
|
37726
|
-
const runId = typeof run.id === "string" ? run.id : "unknown";
|
|
37727
|
-
const status = typeof run.status === "string" ? run.status : "unknown";
|
|
37728
|
-
const playName = typeof run.playName === "string" ? run.playName : null;
|
|
37729
|
-
const runtimeLimitFailure = readRecordArray(packaged.errors).find(
|
|
37730
|
-
(entry) => entry.code === "RUNTIME_LIMIT_EXCEEDED"
|
|
37731
|
-
);
|
|
37732
|
-
const isRuntimeTimeout = status === "failed" && (runtimeLimitFailure !== void 0 || typeof run.error === "string" && /RUNTIME_LIMIT_EXCEEDED/.test(run.error));
|
|
37733
|
-
const isRuntimeLimitCheckpoint = isRuntimeTimeout;
|
|
37734
|
-
const checkpointFailure = runtimeLimitFailure ?? (typeof run.error === "string" ? { message: run.error } : { message: "The Play reached its runtime limit and was stopped." });
|
|
37735
|
-
const lines = isRuntimeLimitCheckpoint ? runtimeLimitCheckpointLines(packaged, runId, checkpointFailure) : [
|
|
37736
|
-
`${status === "completed" ? "\u2713" : status === "failed" ? "\u2717" : "\u2022"} ${status} ${runId}`
|
|
37737
|
-
];
|
|
37738
|
-
const outcome = typeof run.outcome === "string" ? run.outcome : null;
|
|
37739
|
-
if (outcome) lines.push(` outcome: ${outcome}`);
|
|
37740
|
-
const recovery = readRecord(run.recovery);
|
|
37741
|
-
if (recovery) {
|
|
37742
|
-
const mode = typeof recovery.mode === "string" ? recovery.mode : "recovered";
|
|
37743
|
-
const sourceRunId = typeof recovery.sourceRunId === "string" ? ` from ${recovery.sourceRunId}` : "";
|
|
37744
|
-
lines.push(` recovery: ${mode}${sourceRunId}`);
|
|
37745
|
-
}
|
|
37746
|
-
const runError = typeof run.error === "string" && run.error.trim() ? run.error.trim() : null;
|
|
37747
|
-
const structuredRuntimeLimitMessage = typeof runtimeLimitFailure?.message === "string" && runtimeLimitFailure.message.trim() ? `${typeof runtimeLimitFailure.code === "string" ? runtimeLimitFailure.code : "RUNTIME_LIMIT_EXCEEDED"}: ${runtimeLimitFailure.message.trim()}` : null;
|
|
37748
|
-
const displayRunError = structuredRuntimeLimitMessage ?? runError;
|
|
37749
|
-
if (!isRuntimeLimitCheckpoint && displayRunError && (status === "failed" || status === "cancelled")) {
|
|
37750
|
-
lines.push(` error: ${truncateErrorForDisplay(displayRunError, runId)}`);
|
|
37751
|
-
const stackFrames = authoredPackageStackFrames(packaged);
|
|
37752
|
-
if (stackFrames.length > 0) {
|
|
37753
|
-
lines.push(" stack:");
|
|
37754
|
-
lines.push(...stackFrames.map((frame) => ` ${frame}`));
|
|
37755
|
-
}
|
|
37756
|
-
}
|
|
37757
|
-
const failedLogs = readRecord(packaged.failedLogs);
|
|
37758
|
-
const failedLogEntries = Array.isArray(failedLogs?.entries) ? failedLogs.entries.filter(
|
|
37759
|
-
(entry) => typeof entry === "string"
|
|
37760
|
-
) : [];
|
|
37761
|
-
const failedLogAssociation = typeof failedLogs?.association === "string" ? failedLogs.association : null;
|
|
37762
|
-
const failedLogWarning = typeof failedLogs?.warning === "string" && failedLogs.warning.trim() ? failedLogs.warning.trim() : null;
|
|
37763
|
-
if (failedLogEntries.length > 0) {
|
|
37764
|
-
lines.push(" failed logs:");
|
|
37765
|
-
lines.push(...failedLogEntries.map((entry) => ` ${entry}`));
|
|
37766
|
-
}
|
|
37767
|
-
if (failedLogAssociation === "retained_before_truncation") {
|
|
37768
|
-
lines.push(" failed log context: last retained lines before truncation");
|
|
37769
|
-
}
|
|
37770
|
-
if (failedLogWarning) {
|
|
37771
|
-
lines.push(` warning: ${failedLogWarning}`);
|
|
37772
|
-
}
|
|
37773
|
-
const packageWarnings = Array.isArray(packaged.warnings) ? Array.from(
|
|
37774
|
-
new Set(
|
|
37775
|
-
packaged.warnings.filter(
|
|
37776
|
-
(warning) => typeof warning === "string" && warning.trim().length > 0
|
|
37777
|
-
)
|
|
37778
|
-
)
|
|
37779
|
-
).slice(0, 16) : [];
|
|
37780
|
-
lines.push(...packageWarnings.map((warning) => ` warning: ${warning}`));
|
|
37781
|
-
const failedLogNext = readRecord(failedLogs?.next);
|
|
37782
|
-
if (failedLogWarning && typeof failedLogNext?.logs === "string") {
|
|
37783
|
-
lines.push(
|
|
37784
|
-
failedLogAssociation === "retained_before_truncation" ? ` retained logs: ${failedLogNext.logs}` : ` retry failed logs: ${failedLogNext.logs}`
|
|
37785
|
-
);
|
|
37786
|
-
}
|
|
37787
|
-
if (playName && !isRuntimeLimitCheckpoint) {
|
|
37788
|
-
lines.push(` play: ${playName}`);
|
|
37789
|
-
}
|
|
37790
|
-
lines.push(...formatRunTimingTextLines(run));
|
|
37791
|
-
if (!isRuntimeLimitCheckpoint) {
|
|
37792
|
-
lines.push(...buildRunActivityTextLines(run));
|
|
37793
|
-
}
|
|
37794
|
-
lines.push(...buildRunStatusEvidenceTextLines(packaged));
|
|
37795
|
-
lines.push(...formatPackageValueOutputLines(packaged));
|
|
37796
|
-
lines.push(
|
|
37797
|
-
...formatPackageDatasetActionLines(packaged, {
|
|
37798
|
-
includeSummary: !isRuntimeLimitCheckpoint
|
|
37799
|
-
})
|
|
37800
|
-
);
|
|
37801
|
-
lines.push(...formatRecentRunLogLines(packaged.logs));
|
|
37802
|
-
const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
|
|
37803
|
-
const logsCommand = actionToCommand(next.logs);
|
|
37804
|
-
for (const step of isRuntimeLimitCheckpoint ? [] : readRecordArray(packaged.steps).slice(0, 8)) {
|
|
37805
|
-
const id = typeof step.id === "string" ? step.id : "step";
|
|
37806
|
-
const kind = typeof step.kind === "string" ? step.kind : "step";
|
|
37807
|
-
const stepStatus = typeof step.status === "string" ? step.status : status;
|
|
37808
|
-
const output2 = step.output && typeof step.output === "object" && !Array.isArray(step.output) ? step.output : null;
|
|
37809
|
-
const rowCount = output2 && typeof output2.rowCount === "number" ? ` rows=${formatInteger(output2.rowCount)}` : "";
|
|
37810
|
-
const preview = output2?.preview && typeof output2.preview === "object" && !Array.isArray(output2.preview) ? output2.preview : null;
|
|
37811
|
-
const previewRows = Array.isArray(preview?.rows) ? preview.rows.length : null;
|
|
37812
|
-
lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}`);
|
|
37813
|
-
lines.push(...formatPackageDatasetSummaryLines(output2?.summary));
|
|
37814
|
-
if (previewRows !== null) {
|
|
37815
|
-
lines.push(
|
|
37816
|
-
` preview=${previewRows}${preview?.truncated ? " truncated" : ""}`
|
|
37817
|
-
);
|
|
37818
|
-
}
|
|
37819
|
-
}
|
|
37820
|
-
const inspectCommand = actionToCommand(next.inspect);
|
|
37821
|
-
const fullResultCommand = actionToCommand(next.full);
|
|
37822
|
-
const hasCatalogExportAction = packageDatasetRecords(packaged).some(
|
|
37823
|
-
(dataset) => Boolean(actionToCommand(readRecord(dataset.actions)?.exportCsv))
|
|
37824
|
-
);
|
|
37825
|
-
const legacyExportCommand = hasCatalogExportAction ? null : actionToCommand(next.export);
|
|
37826
|
-
const runAgainCommand = typeof next.run === "string" && next.run.trim() ? next.run.trim() : null;
|
|
37827
|
-
if (inspectCommand) lines.push(` inspect: ${inspectCommand}`);
|
|
37828
|
-
if (fullResultCommand)
|
|
37829
|
-
lines.push(
|
|
37830
|
-
` ${isRuntimeTimeout ? "full run details" : "full result"}: ${fullResultCommand}`
|
|
37831
|
-
);
|
|
37832
|
-
if (logsCommand) lines.push(` logs: ${logsCommand}`);
|
|
37833
|
-
if (legacyExportCommand) {
|
|
37834
|
-
lines.push(` export CSV: ${legacyExportCommand}`);
|
|
37835
|
-
}
|
|
37836
|
-
if (runAgainCommand && !isRuntimeLimitCheckpoint) {
|
|
37837
|
-
lines.push(" run again (completed work is reused):");
|
|
37838
|
-
lines.push(` ${runAgainCommand}`);
|
|
37839
|
-
}
|
|
37840
|
-
return lines;
|
|
37841
|
-
}
|
|
37842
37357
|
function buildOrdinaryPlayRunCommand(options, resolvedRevisionId) {
|
|
37843
37358
|
const target = options.target.kind === "file" ? options.target.path : options.target.name;
|
|
37844
37359
|
const parts = ["deepline", "plays", "run", shellSingleQuote(target)];
|
|
@@ -37924,6 +37439,57 @@ function buildRunLaunch(status) {
|
|
|
37924
37439
|
)
|
|
37925
37440
|
};
|
|
37926
37441
|
}
|
|
37442
|
+
function buildPlayCompletionTextLines(status) {
|
|
37443
|
+
const overview = buildRunOverview(status);
|
|
37444
|
+
const { run } = overview;
|
|
37445
|
+
const failed = run.status === "failed";
|
|
37446
|
+
const label = run.status === "completed" ? overview.rowOutcomes?.hasRowFailures ? "Completed with row failures" : "Completed" : failed ? "Failed" : run.status;
|
|
37447
|
+
const lines = [
|
|
37448
|
+
`${label} ${run.playName ?? status.playName ?? "Play"}`,
|
|
37449
|
+
`Run: ${run.id}`
|
|
37450
|
+
];
|
|
37451
|
+
for (const failure of overview.failures.steps) {
|
|
37452
|
+
lines.push(
|
|
37453
|
+
`Failed step: ${failure.stepId}${failure.message ? ` \u2014 ${failure.message}` : ""}`
|
|
37454
|
+
);
|
|
37455
|
+
}
|
|
37456
|
+
if (overview.errorDetails.run)
|
|
37457
|
+
lines.push(
|
|
37458
|
+
`Error: ${truncateErrorForDisplay(overview.errorDetails.run, run.id)}`
|
|
37459
|
+
);
|
|
37460
|
+
if (Object.hasOwn(overview, "result")) {
|
|
37461
|
+
lines.push(
|
|
37462
|
+
"Result:",
|
|
37463
|
+
...formatJsonPreview(compactReturnValue(overview.result))
|
|
37464
|
+
);
|
|
37465
|
+
}
|
|
37466
|
+
if (overview.rowOutcomes?.hasRowFailures) {
|
|
37467
|
+
lines.push(
|
|
37468
|
+
`Rows: ${overview.rowOutcomes.completedRows} completed, ${overview.rowOutcomes.failedRows} failed`
|
|
37469
|
+
);
|
|
37470
|
+
}
|
|
37471
|
+
for (const dataset of overview.datasets) {
|
|
37472
|
+
lines.push(
|
|
37473
|
+
`Rows (${dataset.name ?? dataset.datasetId}): ${dataset.rowCount ?? "unknown"}`
|
|
37474
|
+
);
|
|
37475
|
+
if (dataset.exportUnavailable)
|
|
37476
|
+
lines.push(`Export unavailable: ${dataset.exportUnavailable.message}`);
|
|
37477
|
+
}
|
|
37478
|
+
for (const warning of overview.warnings) lines.push(`Warning: ${warning}`);
|
|
37479
|
+
const exports = overview.actions.exportDatasetCmds;
|
|
37480
|
+
if (Array.isArray(exports))
|
|
37481
|
+
for (const command of exports) lines.push(`Export CSV: ${command}`);
|
|
37482
|
+
lines.push(
|
|
37483
|
+
`Logs: ${failed ? String(
|
|
37484
|
+
overview.actions.getFailedLogsCmd ?? `deepline runs logs ${shellSingleQuote(run.id)} --failed`
|
|
37485
|
+
) : String(
|
|
37486
|
+
overview.actions.getLogsCmd ?? `deepline runs logs ${shellSingleQuote(run.id)}`
|
|
37487
|
+
)}`
|
|
37488
|
+
);
|
|
37489
|
+
if (failed && status.rerunCommand)
|
|
37490
|
+
lines.push(`Retry: ${status.rerunCommand}`);
|
|
37491
|
+
return lines;
|
|
37492
|
+
}
|
|
37927
37493
|
function writePlayResult(status, jsonOutput, options) {
|
|
37928
37494
|
const packaged = getPlayRunPackage(status);
|
|
37929
37495
|
const hits = options?.hits ?? null;
|
|
@@ -37942,10 +37508,7 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
37942
37508
|
...displayPackage
|
|
37943
37509
|
} = compactPlayStatus(status);
|
|
37944
37510
|
const lines2 = [
|
|
37945
|
-
...
|
|
37946
|
-
buildRunPackageTextLines(displayPackage),
|
|
37947
|
-
status
|
|
37948
|
-
),
|
|
37511
|
+
...buildPlayCompletionTextLines(status),
|
|
37949
37512
|
...formatRunHitsLines(hits)
|
|
37950
37513
|
];
|
|
37951
37514
|
printCommandEnvelope(displayPackage, {
|
|
@@ -37981,7 +37544,7 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
37981
37544
|
)
|
|
37982
37545
|
);
|
|
37983
37546
|
if (status.status === "failed") {
|
|
37984
|
-
lines.push(` failed logs: deepline runs
|
|
37547
|
+
lines.push(` failed logs: deepline runs logs ${runId} --failed --json`);
|
|
37985
37548
|
if (status.rerunCommand) {
|
|
37986
37549
|
lines.push(" run again (completed work is reused):");
|
|
37987
37550
|
lines.push(` ${status.rerunCommand}`);
|
|
@@ -38011,18 +37574,23 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
38011
37574
|
);
|
|
38012
37575
|
}
|
|
38013
37576
|
function withRunNavigationLines(lines, status, actionCommands = buildRunNavigation(status).actions) {
|
|
38014
|
-
const navigation = buildRunNavigation(status);
|
|
38015
37577
|
const existing = lines.join("\n");
|
|
38016
|
-
|
|
38017
|
-
|
|
38018
|
-
|
|
38019
|
-
|
|
38020
|
-
|
|
38021
|
-
|
|
37578
|
+
const labels = {
|
|
37579
|
+
getRunCmd: "Inspect",
|
|
37580
|
+
getFullRunCmd: "Full run",
|
|
37581
|
+
getBillingCmd: "Billing",
|
|
37582
|
+
getLogsCmd: "Logs",
|
|
37583
|
+
getFailedLogsCmd: "Failure logs",
|
|
37584
|
+
getReceiptCmd: "Saved responses",
|
|
37585
|
+
exportDatasetCmds: "Export rows",
|
|
37586
|
+
queryTableSqlCmds: "Query rows",
|
|
37587
|
+
stopRunCmd: "Stop run",
|
|
37588
|
+
rerunCmd: "Retry"
|
|
37589
|
+
};
|
|
38022
37590
|
for (const [name, value] of Object.entries(actionCommands)) {
|
|
38023
37591
|
for (const command of Array.isArray(value) ? value : [value]) {
|
|
38024
37592
|
if (typeof command === "string" && !existing.includes(command))
|
|
38025
|
-
lines.push(` ${name}: ${command}`);
|
|
37593
|
+
lines.push(` ${labels[name] ?? name}: ${command}`);
|
|
38026
37594
|
}
|
|
38027
37595
|
}
|
|
38028
37596
|
return lines;
|
|
@@ -38765,7 +38333,12 @@ function writeStartedPlayRun(input2) {
|
|
|
38765
38333
|
failedLogs: _failedLogs,
|
|
38766
38334
|
...displayPackage
|
|
38767
38335
|
} = input2.package;
|
|
38768
|
-
const lines2 =
|
|
38336
|
+
const lines2 = buildPlayCompletionTextLines({
|
|
38337
|
+
runId: input2.runId,
|
|
38338
|
+
playName: input2.playName,
|
|
38339
|
+
status: input2.status,
|
|
38340
|
+
package: displayPackage
|
|
38341
|
+
});
|
|
38769
38342
|
const output3 = lines2.join("\n");
|
|
38770
38343
|
if (input2.progress) {
|
|
38771
38344
|
input2.progress.writeLine(output3, process.stdout);
|
|
@@ -38793,17 +38366,11 @@ function writeStartedPlayRun(input2) {
|
|
|
38793
38366
|
};
|
|
38794
38367
|
const lines = [
|
|
38795
38368
|
`Started ${input2.playName}`,
|
|
38796
|
-
`
|
|
38797
|
-
`
|
|
38798
|
-
` input: ${input2.inputFieldCount ?? 0} top-level field(s) supplied`,
|
|
38799
|
-
` cache: ${input2.forceToolRefresh ? "completed provider receipts may be refreshed" : input2.force ? "fresh run graph; completed provider receipts may still be reused" : "completed provider receipts may be reused"}`,
|
|
38800
|
-
` inspect: deepline runs get ${input2.runId} --json`,
|
|
38801
|
-
` full debug: deepline runs get ${input2.runId} --full --json`,
|
|
38802
|
-
` logs: deepline runs logs ${input2.runId} --json`,
|
|
38803
|
-
` export after completion: deepline runs export ${input2.runId} --out output.csv`,
|
|
38369
|
+
`Run: ${input2.runId}`,
|
|
38370
|
+
`Logs: deepline runs logs ${shellSingleQuote(input2.runId)}`,
|
|
38804
38371
|
...["started", "queued", "running", "waiting"].includes(
|
|
38805
38372
|
input2.status ?? "started"
|
|
38806
|
-
) ? [`
|
|
38373
|
+
) ? [`Stop: deepline runs stop ${shellSingleQuote(input2.runId)} --json`] : []
|
|
38807
38374
|
];
|
|
38808
38375
|
if (input2.jsonOutput) {
|
|
38809
38376
|
printCommandEnvelope(payload, { json: true, fields: input2.jsonFields });
|
|
@@ -40225,7 +39792,7 @@ function renderRunOverviewText(overview, extras = {}) {
|
|
|
40225
39792
|
getBillingCmd: "Billing",
|
|
40226
39793
|
getLogsCmd: "Logs",
|
|
40227
39794
|
getFailedLogsCmd: "Failure logs",
|
|
40228
|
-
getReceiptCmd: "
|
|
39795
|
+
getReceiptCmd: "Saved responses",
|
|
40229
39796
|
exportDatasetCmds: "Export rows",
|
|
40230
39797
|
queryTableSqlCmds: "Query rows",
|
|
40231
39798
|
stopRunCmd: "Stop run",
|
|
@@ -40247,7 +39814,7 @@ async function handleRunGet(args) {
|
|
|
40247
39814
|
args.includes("--config") ? "config" : "get"
|
|
40248
39815
|
);
|
|
40249
39816
|
args = selection.args;
|
|
40250
|
-
const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--config]
|
|
39817
|
+
const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--config]";
|
|
40251
39818
|
let runId;
|
|
40252
39819
|
try {
|
|
40253
39820
|
runId = parseRunIdPositional(args, usage2);
|
|
@@ -43256,7 +42823,7 @@ Examples:
|
|
|
43256
42823
|
deepline runs get play/my-play/run/20260501t000000-000
|
|
43257
42824
|
deepline runs get play/my-play/run/20260501t000000-000 --json
|
|
43258
42825
|
deepline runs get play/my-play/run/20260501t000000-000 --json run.status,run.durationMs
|
|
43259
|
-
deepline runs
|
|
42826
|
+
deepline runs logs play/my-play/run/20260501t000000-000 --failed --json
|
|
43260
42827
|
deepline runs get play/my-play/run/20260501t000000-000 --full --json
|
|
43261
42828
|
deepline runs get play/my-play/run/20260501t000000-000 --input
|
|
43262
42829
|
deepline runs get play/my-play/run/20260501t000000-000 --config --json
|
|
@@ -43273,9 +42840,8 @@ Examples:
|
|
|
43273
42840
|
).option(
|
|
43274
42841
|
"--config",
|
|
43275
42842
|
"Explicitly print the recorded configuration, without full results"
|
|
43276
|
-
).
|
|
43277
|
-
"--log-failed",
|
|
43278
|
-
"Attach a bounded terminal-failure log window for failed runs"
|
|
42843
|
+
).addOption(
|
|
42844
|
+
new Option4("--log-failed", "Attach terminal-failure logs").hideHelp()
|
|
43279
42845
|
).action(async (runId, options) => {
|
|
43280
42846
|
process.exitCode = await handleRunGet([
|
|
43281
42847
|
runId,
|
|
@@ -50726,7 +50292,10 @@ Examples:
|
|
|
50726
50292
|
`
|
|
50727
50293
|
Notes:
|
|
50728
50294
|
Shows the compact agent contract by default: what the tool does, cost,
|
|
50729
|
-
required inputs, play getters, and
|
|
50295
|
+
required inputs, play getters, input and full Deepline response examples,
|
|
50296
|
+
and a ctx.tools.execute snippet. Tool responses live at toolResponse.rawV2;
|
|
50297
|
+
preserve the nesting shown in the tool's example. Schemas and examples are
|
|
50298
|
+
separate describe fields.
|
|
50730
50299
|
get is accepted as a compatibility alias for describe.
|
|
50731
50300
|
|
|
50732
50301
|
Examples:
|
|
@@ -50749,7 +50318,7 @@ Examples:
|
|
|
50749
50318
|
"Quote an ai_evaluate, ai_inference, or deeplineagent JSON payload (inline or @file)"
|
|
50750
50319
|
).option("--pricing-only", "Only print pricing and billing semantics").option("--schema-only", "Only print input schema fields").option(
|
|
50751
50320
|
"--examples-only",
|
|
50752
|
-
"Only print
|
|
50321
|
+
"Only print input payload and full Deepline execution response examples"
|
|
50753
50322
|
).option("--getters-only", "Only print extracted list/value getters").addOption(
|
|
50754
50323
|
new Option5(
|
|
50755
50324
|
"--compact",
|
|
@@ -50926,6 +50495,30 @@ async function getTool(toolId, options = {}) {
|
|
|
50926
50495
|
);
|
|
50927
50496
|
return 0;
|
|
50928
50497
|
}
|
|
50498
|
+
if ((options.schemaOnly || options.examplesOnly || options.gettersOnly) && !isMonitorTypeTool(tool) && !isPlayLikeTool(tool) && (options.json || options.contractJson)) {
|
|
50499
|
+
const contract = toolContractJsonForDescribe(tool, toolId);
|
|
50500
|
+
printCompactJson({
|
|
50501
|
+
toolId: contract.toolId,
|
|
50502
|
+
...options.schemaOnly ? {
|
|
50503
|
+
inputSchema: contract.inputSchema,
|
|
50504
|
+
inputFields: contract.inputFields,
|
|
50505
|
+
outputSchema: contract.outputSchema,
|
|
50506
|
+
outputFields: contract.outputFields,
|
|
50507
|
+
responseSchema: contract.responseSchema
|
|
50508
|
+
} : options.examplesOnly ? {
|
|
50509
|
+
examples: contract.examples ?? [],
|
|
50510
|
+
responseAccess: contract.responseAccess,
|
|
50511
|
+
getters: contract.getters,
|
|
50512
|
+
executeCommand: contract.executeCommand
|
|
50513
|
+
} : {
|
|
50514
|
+
getters: contract.getters,
|
|
50515
|
+
responseAccess: contract.responseAccess
|
|
50516
|
+
},
|
|
50517
|
+
...modelDescription ? { modelOptions: modelDescription } : {},
|
|
50518
|
+
...inferenceQuote ? { inferenceQuote } : {}
|
|
50519
|
+
});
|
|
50520
|
+
return 0;
|
|
50521
|
+
}
|
|
50929
50522
|
if (options.contractJson) {
|
|
50930
50523
|
printCompactJson({
|
|
50931
50524
|
...toolContractJsonForDescribe(tool, toolId),
|
|
@@ -51067,6 +50660,9 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
51067
50660
|
} : {},
|
|
51068
50661
|
inputFields: inputFields.map(inputFieldJsonForDescribe),
|
|
51069
50662
|
inputSchema,
|
|
50663
|
+
...isRecord8(tool.responseSchema) ? { responseSchema: tool.responseSchema } : {},
|
|
50664
|
+
...Array.isArray(tool.examples) ? { examples: tool.examples } : {},
|
|
50665
|
+
responseAccess: "result.toolResponse.rawV2",
|
|
51070
50666
|
...Object.keys(outputSchemaRecord).length > 0 ? {
|
|
51071
50667
|
outputSchema: publicToolInputSchemaForDescribe(outputSchemaRecord),
|
|
51072
50668
|
outputFields: outputFields.map(inputFieldJsonForDescribe)
|
|
@@ -51288,15 +50884,13 @@ function printCompactToolContract(tool, requestedToolId) {
|
|
|
51288
50884
|
}
|
|
51289
50885
|
}
|
|
51290
50886
|
console.log("");
|
|
51291
|
-
printToolExamplesOnly(tool, requestedToolId
|
|
50887
|
+
printToolExamplesOnly(tool, requestedToolId);
|
|
51292
50888
|
const starterScript = isRecord8(contract.starterScript) ? contract.starterScript : {};
|
|
51293
50889
|
const starterPath = stringField2(starterScript, "path");
|
|
51294
50890
|
if (starterPath) {
|
|
51295
50891
|
console.log("");
|
|
51296
50892
|
console.log(`Starter script: ${starterPath}`);
|
|
51297
|
-
console.log(
|
|
51298
|
-
"Copy it into your project and replace the sample input with the proven probe payload."
|
|
51299
|
-
);
|
|
50893
|
+
console.log("Copy it into your project and adapt the example input.");
|
|
51300
50894
|
}
|
|
51301
50895
|
if (listGetters.length || valueGetters.length) {
|
|
51302
50896
|
console.log("");
|
|
@@ -51386,11 +50980,15 @@ function printToolSchemaOnly(tool, requestedToolId) {
|
|
|
51386
50980
|
recordField(contract, "inputSchema")
|
|
51387
50981
|
);
|
|
51388
50982
|
if (declaredSchema) {
|
|
51389
|
-
console.log("Declared JSON Schema:");
|
|
50983
|
+
console.log("Declared input JSON Schema:");
|
|
51390
50984
|
console.log(JSON.stringify(declaredSchema, null, 2));
|
|
51391
50985
|
}
|
|
50986
|
+
if (isRecord8(contract.responseSchema)) {
|
|
50987
|
+
console.log("Deepline execution response JSON Schema:");
|
|
50988
|
+
console.log(JSON.stringify(contract.responseSchema, null, 2));
|
|
50989
|
+
}
|
|
51392
50990
|
}
|
|
51393
|
-
function printToolExamplesOnly(tool, requestedToolId
|
|
50991
|
+
function printToolExamplesOnly(tool, requestedToolId) {
|
|
51394
50992
|
if (isMonitorTypeTool(tool)) {
|
|
51395
50993
|
printMonitorTypeDeploy(tool);
|
|
51396
50994
|
return;
|
|
@@ -51402,7 +51000,11 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
51402
51000
|
const contract = toolContractJsonForDescribe(tool, requestedToolId);
|
|
51403
51001
|
const toolId = String(contract.toolId);
|
|
51404
51002
|
const inputFields = Array.isArray(contract.inputFields) ? contract.inputFields : [];
|
|
51405
|
-
const
|
|
51003
|
+
const examples = arrayField2(tool, "examples").filter(isRecord8);
|
|
51004
|
+
const firstExample = examples[0];
|
|
51005
|
+
const sampleInput = firstExample && isRecord8(firstExample.input) ? firstExample.input : samplePayload(recordField(tool, "samples"), "request") ?? samplePayloadForInputFields(inputFields);
|
|
51006
|
+
console.log("Example input payload:");
|
|
51007
|
+
console.log(JSON.stringify(sampleInput, null, 2));
|
|
51406
51008
|
console.log(`Use in a play:`);
|
|
51407
51009
|
console.log("```ts");
|
|
51408
51010
|
console.log("const result = await ctx.tools.execute({");
|
|
@@ -51412,6 +51014,7 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
51412
51014
|
` input: ${JSON.stringify(sampleInput || {}, null, 2).replace(/\n/g, "\n ")},`
|
|
51413
51015
|
);
|
|
51414
51016
|
console.log("});");
|
|
51017
|
+
console.log("const response = result.toolResponse.rawV2;");
|
|
51415
51018
|
const getters = isRecord8(contract.getters) ? contract.getters : {};
|
|
51416
51019
|
const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
|
|
51417
51020
|
const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
|
|
@@ -51425,10 +51028,19 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
51425
51028
|
);
|
|
51426
51029
|
}
|
|
51427
51030
|
console.log("```");
|
|
51428
|
-
|
|
51429
|
-
const
|
|
51430
|
-
|
|
51031
|
+
for (const example of examples) {
|
|
51032
|
+
const description = stringField2(example, "description");
|
|
51033
|
+
if (description) console.log(description);
|
|
51034
|
+
console.log("Example Deepline execution response:");
|
|
51035
|
+
console.log(JSON.stringify(example.response, null, 2));
|
|
51431
51036
|
}
|
|
51037
|
+
if (!examples.length)
|
|
51038
|
+
console.log(
|
|
51039
|
+
"No Deepline execution response example is published by this server."
|
|
51040
|
+
);
|
|
51041
|
+
console.log(
|
|
51042
|
+
"Read tool-specific fields from result.toolResponse.rawV2 using the nesting above. In a play, use the declared getters for extracted values and lists. Billing and execution metadata may also be returned."
|
|
51043
|
+
);
|
|
51432
51044
|
}
|
|
51433
51045
|
function printPlayLikeToolUsage(tool, requestedToolId) {
|
|
51434
51046
|
const toolId = String(tool.toolId || requestedToolId);
|
|
@@ -51573,9 +51185,9 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
|
|
|
51573
51185
|
inputFields: inputFields.map(inputFieldJsonForDescribe),
|
|
51574
51186
|
usageGuidance,
|
|
51575
51187
|
runtimeOutputHelp: {
|
|
51576
|
-
contract: "
|
|
51188
|
+
contract: "Schemas declare field shapes. Examples illustrate input payloads and full Deepline execution responses; they are not observed responses from this call.",
|
|
51577
51189
|
getterScope: "extractedValues/extractedLists .get() only works for declared Deepline getters listed in usageGuidance.toolExecutionResult.",
|
|
51578
|
-
rawToolResponse: "Use toolExecutionResult.toolResponse.rawV2 for
|
|
51190
|
+
rawToolResponse: "Use toolExecutionResult.toolResponse.rawV2 for the complete tool response. Preserve its nesting and sibling fields as shown in examples; use declared getters for extracted values and lists.",
|
|
51579
51191
|
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter.",
|
|
51580
51192
|
observeActualShape: observedOutputCommand,
|
|
51581
51193
|
observedOutput: observedOutputCommand,
|
|
@@ -51590,7 +51202,25 @@ function usageGuidanceWithAccessDefaults(usageGuidance) {
|
|
|
51590
51202
|
const existingAccess = recordField(usageGuidance, "access");
|
|
51591
51203
|
return {
|
|
51592
51204
|
...usageGuidance,
|
|
51205
|
+
prefer: [
|
|
51206
|
+
"Use only the declared extractedLists and extractedValues getters listed below.",
|
|
51207
|
+
"Use toolExecutionResult.toolResponse.rawV2 for the complete tool response, preserving the nesting shown in the response example.",
|
|
51208
|
+
"Schemas declare field shapes; examples illustrate input values and full Deepline execution responses."
|
|
51209
|
+
],
|
|
51210
|
+
toolExecutionResult: {
|
|
51211
|
+
...recordField(
|
|
51212
|
+
usageGuidance,
|
|
51213
|
+
"toolExecutionResult",
|
|
51214
|
+
"tool_execution_result"
|
|
51215
|
+
),
|
|
51216
|
+
toolResponse: {
|
|
51217
|
+
rawV2: "toolResponse.rawV2",
|
|
51218
|
+
view: "toolResponse.view",
|
|
51219
|
+
responseMeta: "toolResponse.responseMeta"
|
|
51220
|
+
}
|
|
51221
|
+
},
|
|
51593
51222
|
access: {
|
|
51223
|
+
...existingAccess,
|
|
51594
51224
|
extractedLists: {
|
|
51595
51225
|
expression: "toolExecutionResult.extractedLists.<name>.get()",
|
|
51596
51226
|
meaning: "Declared Deepline list extractors only."
|
|
@@ -51602,13 +51232,13 @@ function usageGuidanceWithAccessDefaults(usageGuidance) {
|
|
|
51602
51232
|
...existingAccess,
|
|
51603
51233
|
rawToolResponse: {
|
|
51604
51234
|
expression: "toolExecutionResult.toolResponse.rawV2",
|
|
51605
|
-
meaning: "Complete
|
|
51235
|
+
meaning: "Complete tool response with its original nesting. Read tool-specific fields here; use declared getters for extracted values and lists."
|
|
51606
51236
|
},
|
|
51607
51237
|
canonicalToolResponse: {
|
|
51608
51238
|
expression: "toolExecutionResult.toolResponse.rawV2",
|
|
51609
|
-
meaning: "Complete
|
|
51239
|
+
meaning: "Complete tool response with its original nesting and sibling fields."
|
|
51610
51240
|
},
|
|
51611
|
-
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter;
|
|
51241
|
+
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter; read it from toolResponse.rawV2 using the nesting shown in the response example."
|
|
51612
51242
|
}
|
|
51613
51243
|
};
|
|
51614
51244
|
}
|
|
@@ -51940,23 +51570,6 @@ function formatRateWindow(windowMs) {
|
|
|
51940
51570
|
if (windowMs === 36e5) return "hour";
|
|
51941
51571
|
return `${windowMs}ms`;
|
|
51942
51572
|
}
|
|
51943
|
-
function printSamples(samples) {
|
|
51944
|
-
const requestPayload = samplePayload(samples, "request");
|
|
51945
|
-
const responsePayload = samplePayload(samples, "response");
|
|
51946
|
-
if (requestPayload === void 0 && responsePayload === void 0) return;
|
|
51947
|
-
console.log(" Samples:");
|
|
51948
|
-
if (requestPayload !== void 0)
|
|
51949
|
-
printJsonPreview("Example payload", requestPayload);
|
|
51950
|
-
if (responsePayload !== void 0)
|
|
51951
|
-
printJsonPreview("Example response", responsePayload);
|
|
51952
|
-
}
|
|
51953
|
-
function printJsonPreview(label, payload) {
|
|
51954
|
-
console.log(` ${label}:`);
|
|
51955
|
-
const rendered = JSON.stringify(payload, null, 2);
|
|
51956
|
-
for (const line of rendered.split("\n")) {
|
|
51957
|
-
console.log(` ${line}`);
|
|
51958
|
-
}
|
|
51959
|
-
}
|
|
51960
51573
|
function samplePayload(samples, key) {
|
|
51961
51574
|
const entry = samples[key];
|
|
51962
51575
|
if (!isRecord8(entry)) return void 0;
|