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.js
CHANGED
|
@@ -3515,7 +3515,7 @@ var SDK_RELEASE = {
|
|
|
3515
3515
|
// getters keep their established compatibility behavior.
|
|
3516
3516
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3517
3517
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3518
|
-
version: "0.3.
|
|
3518
|
+
version: "0.3.291",
|
|
3519
3519
|
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.",
|
|
3520
3520
|
packageCapabilities: {
|
|
3521
3521
|
updatePreferences: 1
|
|
@@ -5551,6 +5551,7 @@ var RUN_SCHEDULER_OUTBOX_EVENT_TYPE = {
|
|
|
5551
5551
|
runCancelled: RUN_EVENT_KIND.runCancelled,
|
|
5552
5552
|
runEvents: "run.events",
|
|
5553
5553
|
runnerLogs: "runner.logs",
|
|
5554
|
+
receiptEvent: "receipt.event",
|
|
5554
5555
|
runWaitTimeout: "run.wait_timeout"
|
|
5555
5556
|
};
|
|
5556
5557
|
var RUN_SCHEDULER_OUTBOX_EVENT_TYPES = Object.freeze(
|
|
@@ -5651,6 +5652,7 @@ var RUN_SCHEDULER_OUTBOX_EVENT_TYPE_SQL_LITERAL = {
|
|
|
5651
5652
|
runCancelled: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runCancelled),
|
|
5652
5653
|
runEvents: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runEvents),
|
|
5653
5654
|
runnerLogs: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runnerLogs),
|
|
5655
|
+
receiptEvent: sqlStringLiteral(RUN_SCHEDULER_OUTBOX_EVENT_TYPE.receiptEvent),
|
|
5654
5656
|
runWaitTimeout: sqlStringLiteral(
|
|
5655
5657
|
RUN_SCHEDULER_OUTBOX_EVENT_TYPE.runWaitTimeout
|
|
5656
5658
|
)
|
|
@@ -5980,7 +5982,7 @@ function classifyLegacyLogLine(line) {
|
|
|
5980
5982
|
if (/^\[perf\] runtime receipt\b/i.test(message)) {
|
|
5981
5983
|
return "receipt";
|
|
5982
5984
|
}
|
|
5983
|
-
if (/^\[perf\] runtime
|
|
5985
|
+
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(
|
|
5984
5986
|
message
|
|
5985
5987
|
) || /\[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(
|
|
5986
5988
|
message
|
|
@@ -7812,8 +7814,10 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
7812
7814
|
/**
|
|
7813
7815
|
* Execute a tool and return the standard execution envelope.
|
|
7814
7816
|
*
|
|
7815
|
-
* The `toolResponse.rawV2` field contains the complete
|
|
7816
|
-
* `
|
|
7817
|
+
* The `toolResponse.rawV2` field contains the complete tool response,
|
|
7818
|
+
* preserving its original nesting. Inspect `getTool().examples` for a full
|
|
7819
|
+
* Deepline response example. Optional `toolResponse.responseMeta` contains
|
|
7820
|
+
* response metadata.
|
|
7817
7821
|
* Top-level fields such as `status`, `job_id`, and `billing` describe the
|
|
7818
7822
|
* Deepline execution envelope.
|
|
7819
7823
|
*/
|
|
@@ -8526,7 +8530,7 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
8526
8530
|
});
|
|
8527
8531
|
} catch (error) {
|
|
8528
8532
|
failedLogsLoaded = false;
|
|
8529
|
-
const retryCommand = `deepline runs
|
|
8533
|
+
const retryCommand = `deepline runs logs ${runId} --failed --json`;
|
|
8530
8534
|
const reason = error instanceof Error && error.message.trim() ? ` (${error.message.trim().slice(0, 500)})` : "";
|
|
8531
8535
|
failedLogs = {
|
|
8532
8536
|
runId,
|
|
@@ -21732,7 +21736,7 @@ var KIND_DESCRIPTIONS = {
|
|
|
21732
21736
|
"dataset.lifecycle": "Dataset registered, available or failed.",
|
|
21733
21737
|
"activity.observed": "Provider or workflow activity.",
|
|
21734
21738
|
"work.counters": "Call, request and rate-limit totals.",
|
|
21735
|
-
"receipt.completed": "Saved
|
|
21739
|
+
"receipt.completed": "Saved result or call details.",
|
|
21736
21740
|
"receipt.failed": "Saved work result: failed.",
|
|
21737
21741
|
"receipt.skipped": "Saved work result: skipped.",
|
|
21738
21742
|
"runtime.event": "Other event."
|
|
@@ -21773,6 +21777,10 @@ var FILTER_EXAMPLES = [
|
|
|
21773
21777
|
{
|
|
21774
21778
|
label: "One run and step",
|
|
21775
21779
|
command: `deepline runs logs '<run-id>' --where '$.stepId == "company-lookup"' --json`
|
|
21780
|
+
},
|
|
21781
|
+
{
|
|
21782
|
+
label: "Error logs for one step",
|
|
21783
|
+
command: `deepline runs logs --kind log.appended --where '$.level == "error" && $.stepId == "company-lookup"' --payloads --json`
|
|
21776
21784
|
}
|
|
21777
21785
|
];
|
|
21778
21786
|
function wrapParagraph(text) {
|
|
@@ -21793,10 +21801,14 @@ function renderRunLogsHelp() {
|
|
|
21793
21801
|
"",
|
|
21794
21802
|
"Examples:",
|
|
21795
21803
|
` ${READ_EXAMPLES[0]}`,
|
|
21804
|
+
` deepline runs logs --where '$.eventId == "receipt:5a32ee1a-46cf-4853-b72b-5f1d782ffab4"' --payloads --json`,
|
|
21796
21805
|
" deepline runs logs --kind run.failed --json",
|
|
21797
|
-
...[
|
|
21798
|
-
|
|
21799
|
-
|
|
21806
|
+
...[
|
|
21807
|
+
FILTER_EXAMPLES[1],
|
|
21808
|
+
FILTER_EXAMPLES[2],
|
|
21809
|
+
FILTER_EXAMPLES[5],
|
|
21810
|
+
FILTER_EXAMPLES[7]
|
|
21811
|
+
].map(({ command }) => ` ${command}`),
|
|
21800
21812
|
"",
|
|
21801
21813
|
"Event kinds:",
|
|
21802
21814
|
...RUN_LOGS_KIND_HELP.map(
|
|
@@ -21815,6 +21827,7 @@ function renderRunLogsHelp() {
|
|
|
21815
21827
|
"A run ID alone reads text logs. Omit it or add a search flag to search events; a supplied run ID narrows the search.",
|
|
21816
21828
|
"Defaults to the last hour; maximum lookback is seven days. Follow next.logs for events; use nextCursor with --cursor for older text logs.",
|
|
21817
21829
|
"--payloads returns available details or saved results: up to 10 events and 16 MiB.",
|
|
21830
|
+
"To read one exact saved result, filter by its returned eventId and add --payloads.",
|
|
21818
21831
|
"--out, --failed and --log-level apply to text logs and cannot be combined with event search."
|
|
21819
21832
|
].map((note) => wrapParagraph(note)),
|
|
21820
21833
|
"",
|
|
@@ -22147,13 +22160,6 @@ var DATASET_EXECUTION_BUCKETS = [
|
|
|
22147
22160
|
"skipped:missed",
|
|
22148
22161
|
"failed"
|
|
22149
22162
|
];
|
|
22150
|
-
function formatDatasetRowCountsLine(counts) {
|
|
22151
|
-
const { persisted, succeeded, failed } = counts;
|
|
22152
|
-
if (succeeded === persisted && failed === 0) {
|
|
22153
|
-
return `${persisted} persisted`;
|
|
22154
|
-
}
|
|
22155
|
-
return `${persisted} persisted (${succeeded} succeeded, ${failed} failed)`;
|
|
22156
|
-
}
|
|
22157
22163
|
|
|
22158
22164
|
// src/runs/overview.ts
|
|
22159
22165
|
var record3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
@@ -22172,7 +22178,7 @@ function lifecycleActions(status, id, state) {
|
|
|
22172
22178
|
return {
|
|
22173
22179
|
...["started", "queued", "running", "waiting"].includes(state ?? "") ? { stopRunCmd: `deepline runs stop ${id} --json` } : {},
|
|
22174
22180
|
...state === "failed" ? {
|
|
22175
|
-
getFailedLogsCmd: `deepline runs
|
|
22181
|
+
getFailedLogsCmd: `deepline runs logs ${id} --failed --json`,
|
|
22176
22182
|
...status.rerunCommand ? { rerunCmd: status.rerunCommand } : {}
|
|
22177
22183
|
} : {}
|
|
22178
22184
|
};
|
|
@@ -22375,7 +22381,7 @@ function buildRunOverview(status, fullStatus) {
|
|
|
22375
22381
|
);
|
|
22376
22382
|
return {
|
|
22377
22383
|
datasetId: dataset.datasetId,
|
|
22378
|
-
name: dataset.tableNamespace,
|
|
22384
|
+
name: dataset.tableNamespace ?? (typeof stepOutput?.tableNamespace === "string" ? stepOutput.tableNamespace : dataset.path),
|
|
22379
22385
|
stepId: step?.id ?? named[0]?.[1].stepId,
|
|
22380
22386
|
rowCount: dataset.rowCount ?? null,
|
|
22381
22387
|
...dataset.lifecycle ? { lifecycle: dataset.lifecycle } : {},
|
|
@@ -22469,7 +22475,7 @@ function buildRunOverview(status, fullStatus) {
|
|
|
22469
22475
|
function receiptAction(id) {
|
|
22470
22476
|
const quotedId = `'${id.replace(/'/g, "'\\''")}'`;
|
|
22471
22477
|
return {
|
|
22472
|
-
getReceiptCmd: `deepline runs
|
|
22478
|
+
getReceiptCmd: `deepline runs logs ${quotedId} --kind receipt.completed --payloads --json`
|
|
22473
22479
|
};
|
|
22474
22480
|
}
|
|
22475
22481
|
function buildRunNavigation(status) {
|
|
@@ -24328,7 +24334,7 @@ Examples:
|
|
|
24328
24334
|
// src/cli/commands/run-receipt.ts
|
|
24329
24335
|
var import_promises4 = require("fs/promises");
|
|
24330
24336
|
function registerRunReceiptCommand(runs) {
|
|
24331
|
-
runs.command("receipt <runId>").description(
|
|
24337
|
+
runs.command("receipt <runId>", { hidden: true }).description(
|
|
24332
24338
|
"Read retained tool responses by receipt key. Never executes tools."
|
|
24333
24339
|
).option(
|
|
24334
24340
|
"--key <key>",
|
|
@@ -24342,8 +24348,7 @@ function registerRunReceiptCommand(runs) {
|
|
|
24342
24348
|
"after",
|
|
24343
24349
|
`
|
|
24344
24350
|
Examples:
|
|
24345
|
-
deepline runs
|
|
24346
|
-
jq -r '.[].receipt_key' rows.json | deepline runs receipt <run-id> --keys - --out responses.json
|
|
24351
|
+
deepline runs logs <run-id> --kind receipt.completed --payloads --json
|
|
24347
24352
|
|
|
24348
24353
|
Returns one outcome per key, preserving order and duplicates. A missing or
|
|
24349
24354
|
unavailable result is explicit; other keys are still returned. Exit 4 means
|
|
@@ -31594,7 +31599,7 @@ async function traceCliSpan(phase, fields2, run) {
|
|
|
31594
31599
|
}
|
|
31595
31600
|
|
|
31596
31601
|
// src/cli/play-check-hints.ts
|
|
31597
|
-
var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`.
|
|
31602
|
+
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.";
|
|
31598
31603
|
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()`.";
|
|
31599
31604
|
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.";
|
|
31600
31605
|
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.";
|
|
@@ -36562,12 +36567,13 @@ function buildRunNextCommands(status) {
|
|
|
36562
36567
|
};
|
|
36563
36568
|
}
|
|
36564
36569
|
const actions2 = buildRunNavigation(status).actions;
|
|
36570
|
+
const exportDatasetCmds = Array.isArray(actions2.exportDatasetCmds) ? actions2.exportDatasetCmds : !status.package && extractCanonicalRowsInfo(status) ? [`deepline runs export ${runId} --out output.csv`] : [];
|
|
36565
36571
|
const commands = {
|
|
36566
36572
|
get: String(actions2.getRunCmd ?? `deepline runs get ${runId} --json`),
|
|
36567
36573
|
full: String(
|
|
36568
36574
|
actions2.getFullRunCmd ?? `deepline runs get ${runId} --full --json`
|
|
36569
36575
|
),
|
|
36570
|
-
...
|
|
36576
|
+
...exportDatasetCmds.length === 1 ? { export: String(exportDatasetCmds[0]) } : {},
|
|
36571
36577
|
logs: String(
|
|
36572
36578
|
!status.package ? `deepline runs logs ${runId} --out run.log --json` : actions2.getLogsCmd ?? `deepline runs logs ${runId} --limit 100 --json`
|
|
36573
36579
|
)
|
|
@@ -36576,7 +36582,7 @@ function buildRunNextCommands(status) {
|
|
|
36576
36582
|
commands.stop = `deepline runs stop ${runId} --json`;
|
|
36577
36583
|
}
|
|
36578
36584
|
if (status.status === "failed") {
|
|
36579
|
-
commands.failedLogs = `deepline runs
|
|
36585
|
+
commands.failedLogs = `deepline runs logs ${runId} --failed --json`;
|
|
36580
36586
|
if (status.rerunCommand) commands.run = status.rerunCommand;
|
|
36581
36587
|
}
|
|
36582
36588
|
if (status.dashboardUrl) {
|
|
@@ -37007,7 +37013,7 @@ function compactPlayStatus(status) {
|
|
|
37007
37013
|
next: {
|
|
37008
37014
|
...readRecord(packaged.next) ?? {},
|
|
37009
37015
|
...status.failedLogs ? {
|
|
37010
|
-
failedLogs: `deepline runs
|
|
37016
|
+
failedLogs: `deepline runs logs ${status.runId} --failed --json`
|
|
37011
37017
|
} : {},
|
|
37012
37018
|
...status.rerunCommand ? { run: status.rerunCommand } : {}
|
|
37013
37019
|
}
|
|
@@ -37020,14 +37026,14 @@ function compactPlayStatus(status) {
|
|
|
37020
37026
|
...status.failedLogs ? {
|
|
37021
37027
|
next: {
|
|
37022
37028
|
...readRecord(packaged.next) ?? {},
|
|
37023
|
-
failedLogs: `deepline runs
|
|
37029
|
+
failedLogs: `deepline runs logs ${status.runId} --failed --json`
|
|
37024
37030
|
}
|
|
37025
37031
|
} : {},
|
|
37026
37032
|
...status.rerunCommand ? {
|
|
37027
37033
|
next: {
|
|
37028
37034
|
...readRecord(packaged.next) ?? {},
|
|
37029
37035
|
...status.failedLogs ? {
|
|
37030
|
-
failedLogs: `deepline runs
|
|
37036
|
+
failedLogs: `deepline runs logs ${status.runId} --failed --json`
|
|
37031
37037
|
} : {},
|
|
37032
37038
|
run: status.rerunCommand
|
|
37033
37039
|
}
|
|
@@ -37076,9 +37082,6 @@ function compactRunErrorForEnvelope(message, runId) {
|
|
|
37076
37082
|
const headline = firstStackFrame >= 0 ? lines.slice(0, firstStackFrame).join("\n") : message;
|
|
37077
37083
|
return truncateErrorForDisplay(headline, runId, 1e3);
|
|
37078
37084
|
}
|
|
37079
|
-
function readRunPackageRun(packaged) {
|
|
37080
|
-
return packaged.run && typeof packaged.run === "object" && !Array.isArray(packaged.run) ? packaged.run : {};
|
|
37081
|
-
}
|
|
37082
37085
|
function readRecordArray(value) {
|
|
37083
37086
|
return Array.isArray(value) ? value.filter(
|
|
37084
37087
|
(item) => item !== null && typeof item === "object" && !Array.isArray(item)
|
|
@@ -37090,131 +37093,6 @@ function readRecord(value) {
|
|
|
37090
37093
|
function readNonNegativeInteger(value) {
|
|
37091
37094
|
return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : null;
|
|
37092
37095
|
}
|
|
37093
|
-
function formatSummaryScalar(value) {
|
|
37094
|
-
if (typeof value === "number") {
|
|
37095
|
-
return Number.isFinite(value) ? formatInteger(Math.trunc(value)) : null;
|
|
37096
|
-
}
|
|
37097
|
-
if (typeof value === "string" || typeof value === "boolean") {
|
|
37098
|
-
return String(value);
|
|
37099
|
-
}
|
|
37100
|
-
if (value === null) {
|
|
37101
|
-
return "null";
|
|
37102
|
-
}
|
|
37103
|
-
return null;
|
|
37104
|
-
}
|
|
37105
|
-
function formatSummaryScalarParts(record5, skipKeys = /* @__PURE__ */ new Set()) {
|
|
37106
|
-
const parts = [];
|
|
37107
|
-
for (const [key, value] of Object.entries(record5)) {
|
|
37108
|
-
if (skipKeys.has(key)) {
|
|
37109
|
-
continue;
|
|
37110
|
-
}
|
|
37111
|
-
const formatted = formatSummaryScalar(value);
|
|
37112
|
-
if (formatted !== null) {
|
|
37113
|
-
parts.push(`${key}=${formatted}`);
|
|
37114
|
-
}
|
|
37115
|
-
}
|
|
37116
|
-
return parts;
|
|
37117
|
-
}
|
|
37118
|
-
var DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT = 10;
|
|
37119
|
-
function formatTopValuesPart(value) {
|
|
37120
|
-
const topValues = readRecord(value);
|
|
37121
|
-
if (!topValues) {
|
|
37122
|
-
return null;
|
|
37123
|
-
}
|
|
37124
|
-
const entries = Object.entries(topValues).slice(
|
|
37125
|
-
0,
|
|
37126
|
-
DATASET_SUMMARY_TOP_VALUES_DISPLAY_LIMIT
|
|
37127
|
-
);
|
|
37128
|
-
if (entries.length === 0) {
|
|
37129
|
-
return null;
|
|
37130
|
-
}
|
|
37131
|
-
return `top_values=${entries.map(([topValue, count2]) => `${topValue}=${String(count2)}`).join(", ")}`;
|
|
37132
|
-
}
|
|
37133
|
-
function formatPackageDatasetSummaryLines(summary, indent2 = " ") {
|
|
37134
|
-
const record5 = readRecord(summary);
|
|
37135
|
-
const columnStats = readRecord(record5?.columnStats);
|
|
37136
|
-
if (!record5 || !columnStats) {
|
|
37137
|
-
return [];
|
|
37138
|
-
}
|
|
37139
|
-
const lines = [];
|
|
37140
|
-
const rowCounts = readRecord(record5.rowCounts);
|
|
37141
|
-
if (rowCounts) {
|
|
37142
|
-
const persisted = readNonNegativeInteger(rowCounts.persisted);
|
|
37143
|
-
const succeeded = readNonNegativeInteger(rowCounts.succeeded);
|
|
37144
|
-
const failed = readNonNegativeInteger(rowCounts.failed);
|
|
37145
|
-
if (persisted !== null) {
|
|
37146
|
-
lines.push(
|
|
37147
|
-
`${indent2}rows: ${formatDatasetRowCountsLine({
|
|
37148
|
-
persisted,
|
|
37149
|
-
succeeded: succeeded ?? persisted,
|
|
37150
|
-
failed: failed ?? 0
|
|
37151
|
-
})}`
|
|
37152
|
-
);
|
|
37153
|
-
}
|
|
37154
|
-
}
|
|
37155
|
-
const parts = formatSummaryScalarParts(
|
|
37156
|
-
record5,
|
|
37157
|
-
/* @__PURE__ */ new Set(["columnStats", "rowCounts"])
|
|
37158
|
-
);
|
|
37159
|
-
if (parts.length > 0) {
|
|
37160
|
-
lines.push(`${indent2}summary: ${parts.join(" ")}`);
|
|
37161
|
-
}
|
|
37162
|
-
for (const [column, rawColumnSummary] of Object.entries(columnStats)) {
|
|
37163
|
-
const columnSummary = readRecord(rawColumnSummary);
|
|
37164
|
-
if (!columnSummary) continue;
|
|
37165
|
-
const execution = readRecord(columnSummary.execution);
|
|
37166
|
-
const executionText = execution ? Object.entries(execution).map(([bucket, value]) => `${bucket}=${String(value)}`).join(", ") : "";
|
|
37167
|
-
const topValuesText = formatTopValuesPart(columnSummary.top_values);
|
|
37168
|
-
const columnParts = [
|
|
37169
|
-
...formatSummaryScalarParts(
|
|
37170
|
-
columnSummary,
|
|
37171
|
-
/* @__PURE__ */ new Set(["execution", "top_values"])
|
|
37172
|
-
),
|
|
37173
|
-
topValuesText,
|
|
37174
|
-
executionText ? `execution=${executionText}` : null
|
|
37175
|
-
].filter(Boolean);
|
|
37176
|
-
if (columnParts.length > 0) {
|
|
37177
|
-
lines.push(`${indent2} ${column}: ${columnParts.join(" ")}`);
|
|
37178
|
-
}
|
|
37179
|
-
}
|
|
37180
|
-
return lines;
|
|
37181
|
-
}
|
|
37182
|
-
function actionToCommand(action) {
|
|
37183
|
-
if (!action || typeof action !== "object" || Array.isArray(action)) {
|
|
37184
|
-
return null;
|
|
37185
|
-
}
|
|
37186
|
-
const record5 = action;
|
|
37187
|
-
if (typeof record5.command === "string" && record5.command.trim()) {
|
|
37188
|
-
return record5.command.trim();
|
|
37189
|
-
}
|
|
37190
|
-
if (record5.kind === "deepline_run_inspect" && typeof record5.runId === "string") {
|
|
37191
|
-
return `deepline runs get ${record5.runId} --json`;
|
|
37192
|
-
}
|
|
37193
|
-
if (record5.kind === "deepline_run_full" && typeof record5.runId === "string") {
|
|
37194
|
-
return `deepline runs get ${record5.runId} --full --json`;
|
|
37195
|
-
}
|
|
37196
|
-
if (record5.kind === "deepline_run_billing" && typeof record5.runId === "string") {
|
|
37197
|
-
return `deepline runs get ${record5.runId} --full --json | jq '.billing'`;
|
|
37198
|
-
}
|
|
37199
|
-
if (record5.kind === "deepline_run_export" && typeof record5.runId === "string" && typeof record5.datasetPath === "string") {
|
|
37200
|
-
return `deepline runs export ${record5.runId} --dataset ${shellSingleQuote(
|
|
37201
|
-
record5.datasetPath
|
|
37202
|
-
)} --out ${shellSingleQuote(`${record5.datasetPath.split(".").pop() || "dataset"}.csv`)}`;
|
|
37203
|
-
}
|
|
37204
|
-
if (record5.kind === "deepline_run_logs") {
|
|
37205
|
-
if (typeof record5.command === "string" && record5.command.trim()) {
|
|
37206
|
-
return record5.command;
|
|
37207
|
-
}
|
|
37208
|
-
if (typeof record5.runId === "string") {
|
|
37209
|
-
return record5.view === "failed" ? `deepline runs get ${record5.runId} --log-failed --json` : `deepline runs logs ${record5.runId} --json`;
|
|
37210
|
-
}
|
|
37211
|
-
}
|
|
37212
|
-
if (record5.kind === "deepline_db_query" && typeof record5.sql === "string") {
|
|
37213
|
-
const maxRows = typeof record5.maxRows === "number" && Number.isFinite(record5.maxRows) ? Math.trunc(record5.maxRows) : 20;
|
|
37214
|
-
return `deepline db query --sql ${shellSingleQuote(record5.sql)} --max-rows ${maxRows} --json`;
|
|
37215
|
-
}
|
|
37216
|
-
return null;
|
|
37217
|
-
}
|
|
37218
37096
|
function packageDatasetRecords(packaged) {
|
|
37219
37097
|
const catalog = readRecordArray(packaged.datasets);
|
|
37220
37098
|
if (catalog.length > 0) return catalog;
|
|
@@ -37223,24 +37101,6 @@ function packageDatasetRecords(packaged) {
|
|
|
37223
37101
|
return output2?.kind === "dataset" ? [output2] : [];
|
|
37224
37102
|
});
|
|
37225
37103
|
}
|
|
37226
|
-
function packageReturnedDatasetIdentity(packaged) {
|
|
37227
|
-
const datasetIds = /* @__PURE__ */ new Set();
|
|
37228
|
-
const paths = /* @__PURE__ */ new Set();
|
|
37229
|
-
const outputs = readRecord(packaged.outputs) ?? {};
|
|
37230
|
-
for (const outputValue of Object.values(outputs)) {
|
|
37231
|
-
const output2 = readRecord(outputValue);
|
|
37232
|
-
if (output2?.kind !== "dataset") continue;
|
|
37233
|
-
if (typeof output2.datasetId === "string" && output2.datasetId.trim()) {
|
|
37234
|
-
datasetIds.add(output2.datasetId.trim());
|
|
37235
|
-
}
|
|
37236
|
-
for (const candidate of [output2.dataset, output2.path]) {
|
|
37237
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
37238
|
-
paths.add(candidate.trim());
|
|
37239
|
-
}
|
|
37240
|
-
}
|
|
37241
|
-
}
|
|
37242
|
-
return { datasetIds, paths };
|
|
37243
|
-
}
|
|
37244
37104
|
function formatRunStepProgress(progress, includeRowOutcomes = false) {
|
|
37245
37105
|
const executed = readNonNegativeInteger(progress.executed);
|
|
37246
37106
|
const total = readNonNegativeInteger(progress.total);
|
|
@@ -37263,205 +37123,6 @@ function formatRunStepProgress(progress, includeRowOutcomes = false) {
|
|
|
37263
37123
|
}
|
|
37264
37124
|
return parts.join(" \xB7 ");
|
|
37265
37125
|
}
|
|
37266
|
-
function formatPackageDatasetActionLines(packaged, options) {
|
|
37267
|
-
const returned = packageReturnedDatasetIdentity(packaged);
|
|
37268
|
-
const includeSummary = options?.includeSummary ?? true;
|
|
37269
|
-
const lines = [];
|
|
37270
|
-
const steps = readRecordArray(packaged.steps);
|
|
37271
|
-
const stepsByDatasetId = /* @__PURE__ */ new Map();
|
|
37272
|
-
const stepsByPath = /* @__PURE__ */ new Map();
|
|
37273
|
-
const stepsByNamespace = /* @__PURE__ */ new Map();
|
|
37274
|
-
for (const step of steps) {
|
|
37275
|
-
if (step.kind !== "dataset") continue;
|
|
37276
|
-
const output2 = readRecord(step.output);
|
|
37277
|
-
if (typeof output2?.datasetId === "string") {
|
|
37278
|
-
stepsByDatasetId.set(output2.datasetId, step);
|
|
37279
|
-
}
|
|
37280
|
-
if (typeof output2?.path === "string") {
|
|
37281
|
-
stepsByPath.set(output2.path, step);
|
|
37282
|
-
}
|
|
37283
|
-
if (typeof step.id === "string") {
|
|
37284
|
-
stepsByNamespace.set(step.id, step);
|
|
37285
|
-
}
|
|
37286
|
-
}
|
|
37287
|
-
for (const dataset of packageDatasetRecords(packaged)) {
|
|
37288
|
-
const path = typeof dataset.path === "string" && dataset.path.trim() ? dataset.path.trim() : "dataset";
|
|
37289
|
-
const datasetId = typeof dataset.datasetId === "string" ? dataset.datasetId.trim() : "";
|
|
37290
|
-
const isReturned = datasetId && returned.datasetIds.has(datasetId) || returned.paths.has(path);
|
|
37291
|
-
const category = isReturned ? "returned" : dataset.recovered === true ? "recovered" : "persisted";
|
|
37292
|
-
const rowCount = typeof dataset.rowCount === "number" && Number.isFinite(dataset.rowCount) ? Math.max(0, Math.trunc(dataset.rowCount)) : null;
|
|
37293
|
-
const lifecycle = readRecord(dataset.lifecycle);
|
|
37294
|
-
const countUnconfirmed = lifecycle?.complete === false;
|
|
37295
|
-
const persistedLowerBound = typeof lifecycle?.persistedRowsAtLeast === "number" && Number.isFinite(lifecycle.persistedRowsAtLeast) ? Math.max(0, Math.trunc(lifecycle.persistedRowsAtLeast)) : 0;
|
|
37296
|
-
const actions2 = readRecord(dataset.actions) ?? {};
|
|
37297
|
-
if (countUnconfirmed) {
|
|
37298
|
-
lines.push(
|
|
37299
|
-
` dataset ${path}: row count unconfirmed (at least ${formatInteger(persistedLowerBound)} persisted)`
|
|
37300
|
-
);
|
|
37301
|
-
} else if (includeSummary) {
|
|
37302
|
-
if (category === "recovered" && Object.keys(actions2).length === 0) {
|
|
37303
|
-
lines.push(
|
|
37304
|
-
` dataset ${path}: available, ${rowCount === null ? "persisted" : formatInteger(rowCount)} rows persisted; re-running reuses completed work`
|
|
37305
|
-
);
|
|
37306
|
-
} else {
|
|
37307
|
-
lines.push(
|
|
37308
|
-
` ${category} dataset ${path}: ${rowCount === null ? "unknown rows" : `${formatInteger(rowCount)} ${rowCount === 1 ? "row" : "rows"}`}`
|
|
37309
|
-
);
|
|
37310
|
-
}
|
|
37311
|
-
}
|
|
37312
|
-
const step = (datasetId ? stepsByDatasetId.get(datasetId) : void 0) ?? stepsByPath.get(path) ?? (typeof dataset.tableNamespace === "string" ? stepsByNamespace.get(dataset.tableNamespace) : void 0);
|
|
37313
|
-
const progress = readRecord(step?.progress);
|
|
37314
|
-
if (progress) {
|
|
37315
|
-
lines.push(` progress: ${formatRunStepProgress(progress)}`);
|
|
37316
|
-
}
|
|
37317
|
-
if (lifecycle) {
|
|
37318
|
-
const succeeded = readNonNegativeInteger(lifecycle.succeededRowsAtLeast);
|
|
37319
|
-
const failed = readNonNegativeInteger(lifecycle.failedRowsAtLeast);
|
|
37320
|
-
const complete = lifecycle.complete === true;
|
|
37321
|
-
lines.push(
|
|
37322
|
-
` 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`}`
|
|
37323
|
-
);
|
|
37324
|
-
}
|
|
37325
|
-
const exportAction = readRecord(actions2.exportCsv);
|
|
37326
|
-
const exportCommand = actionToCommand(exportAction);
|
|
37327
|
-
const exportScope = readRecord(exportAction?.scope);
|
|
37328
|
-
const queryAction = readRecord(actions2.query);
|
|
37329
|
-
const queryScope = readRecord(queryAction?.scope);
|
|
37330
|
-
const runQueryCommand = queryScope?.kind === "run" ? actionToCommand(queryAction) : null;
|
|
37331
|
-
const currentQueryCommand = actionToCommand(actions2.queryCurrentTable);
|
|
37332
|
-
const legacyQueryCommand = actionToCommand(actions2.query);
|
|
37333
|
-
if (runQueryCommand) {
|
|
37334
|
-
lines.push(` query rows from this run: ${runQueryCommand}`);
|
|
37335
|
-
} else if (currentQueryCommand) {
|
|
37336
|
-
lines.push(` query current table: ${currentQueryCommand}`);
|
|
37337
|
-
} else if (legacyQueryCommand) {
|
|
37338
|
-
lines.push(` query run rows (legacy): ${legacyQueryCommand}`);
|
|
37339
|
-
}
|
|
37340
|
-
if (exportCommand) {
|
|
37341
|
-
lines.push(
|
|
37342
|
-
exportScope?.kind === "database" ? ` export current table (may include other runs): ${exportCommand}` : ` export this run: ${exportCommand}`
|
|
37343
|
-
);
|
|
37344
|
-
}
|
|
37345
|
-
const unavailable = readRecord(dataset.exportUnavailable);
|
|
37346
|
-
if (typeof unavailable?.reason === "string" && typeof unavailable.message === "string") {
|
|
37347
|
-
lines.push(
|
|
37348
|
-
` export unavailable (${unavailable.reason}): ${unavailable.message}`
|
|
37349
|
-
);
|
|
37350
|
-
}
|
|
37351
|
-
}
|
|
37352
|
-
return lines;
|
|
37353
|
-
}
|
|
37354
|
-
function packageSavedRowCount(packaged) {
|
|
37355
|
-
const rowCounts = packageDatasetRecords(packaged).map((dataset) => dataset.rowCount).filter(
|
|
37356
|
-
(rowCount) => typeof rowCount === "number" && Number.isFinite(rowCount)
|
|
37357
|
-
).map((rowCount) => Math.max(0, Math.trunc(rowCount)));
|
|
37358
|
-
if (rowCounts.length === 0) return null;
|
|
37359
|
-
return rowCounts.reduce((total, rowCount) => total + rowCount, 0);
|
|
37360
|
-
}
|
|
37361
|
-
function runtimeLimitWindowLabel(runtimeLimitFailure) {
|
|
37362
|
-
const message = getStringField(runtimeLimitFailure, "message") ?? "";
|
|
37363
|
-
const configuredSeconds = /\bconfigured\s+(\d+)\s+second(?:s)?\s+runtime limit\b/i.exec(message)?.[1];
|
|
37364
|
-
if (configuredSeconds) {
|
|
37365
|
-
const seconds = Number(configuredSeconds);
|
|
37366
|
-
if (Number.isSafeInteger(seconds) && seconds > 0) {
|
|
37367
|
-
if (seconds % 3600 === 0) return `${seconds / 3600}-hour`;
|
|
37368
|
-
if (seconds % 60 === 0) return `${seconds / 60}-minute`;
|
|
37369
|
-
return `${seconds}-second`;
|
|
37370
|
-
}
|
|
37371
|
-
}
|
|
37372
|
-
const match = /\b(\d+)\s+(hour|hours|minute|minutes|second|seconds)\b/i.exec(
|
|
37373
|
-
message
|
|
37374
|
-
);
|
|
37375
|
-
if (!match) return "30-minute";
|
|
37376
|
-
const unit = match[2].toLowerCase().replace(/s$/, "");
|
|
37377
|
-
return `${match[1]}-${unit}`;
|
|
37378
|
-
}
|
|
37379
|
-
function runtimeLimitCheckpointLines(packaged, runId, runtimeLimitFailure) {
|
|
37380
|
-
const savedRows = packageSavedRowCount(packaged);
|
|
37381
|
-
const lines = [
|
|
37382
|
-
`\u2713 progress saved ${runId}`,
|
|
37383
|
-
"",
|
|
37384
|
-
`The Play reached its ${runtimeLimitWindowLabel(runtimeLimitFailure)} runtime window.`
|
|
37385
|
-
];
|
|
37386
|
-
if (savedRows === null) {
|
|
37387
|
-
lines.push("Progress completed before the runtime window closed.");
|
|
37388
|
-
} else {
|
|
37389
|
-
lines.push(
|
|
37390
|
-
`${formatInteger(savedRows)} ${savedRows === 1 ? "row was" : "rows were"} saved successfully.`
|
|
37391
|
-
);
|
|
37392
|
-
}
|
|
37393
|
-
lines.push(
|
|
37394
|
-
"",
|
|
37395
|
-
"Run the same Play again to continue where you left off.",
|
|
37396
|
-
"Completed work will be reused automatically."
|
|
37397
|
-
);
|
|
37398
|
-
return lines;
|
|
37399
|
-
}
|
|
37400
|
-
function formatInlinePackageValue(value) {
|
|
37401
|
-
const compacted = compactReturnValue(value);
|
|
37402
|
-
const json2 = JSON.stringify(compacted);
|
|
37403
|
-
return clampJsonPreviewText(json2 ?? String(compacted), 500);
|
|
37404
|
-
}
|
|
37405
|
-
function formatPackageValueOutputLines(packaged) {
|
|
37406
|
-
const outputs = packaged.outputs && typeof packaged.outputs === "object" && !Array.isArray(packaged.outputs) ? packaged.outputs : null;
|
|
37407
|
-
if (!outputs) return [];
|
|
37408
|
-
const returned = Object.entries(outputs).filter(([, output2]) => {
|
|
37409
|
-
const record5 = readRecord(output2);
|
|
37410
|
-
return record5?.kind === "dataset" || record5?.kind === "value" && Object.prototype.hasOwnProperty.call(record5, "value");
|
|
37411
|
-
});
|
|
37412
|
-
if (returned.length === 0) return [];
|
|
37413
|
-
const datasets = packageDatasetRecords(packaged);
|
|
37414
|
-
const datasetSteps = readRecordArray(packaged.steps).filter(
|
|
37415
|
-
(step) => step.kind === "dataset"
|
|
37416
|
-
);
|
|
37417
|
-
const lines = [" result:"];
|
|
37418
|
-
for (const [name, rawOutput] of returned.slice(0, 8)) {
|
|
37419
|
-
const output2 = readRecord(rawOutput);
|
|
37420
|
-
if (output2.kind === "dataset") {
|
|
37421
|
-
const path = typeof output2.dataset === "string" ? output2.dataset : name;
|
|
37422
|
-
const rowCount = readNonNegativeInteger(output2.rowCount);
|
|
37423
|
-
lines.push(
|
|
37424
|
-
` ${name}: dataset ${path}${rowCount === null ? "" : ` (${formatInteger(rowCount)} persisted rows)`}`
|
|
37425
|
-
);
|
|
37426
|
-
const dataset = datasets.find(
|
|
37427
|
-
(candidate) => typeof output2.datasetId === "string" && candidate.datasetId === output2.datasetId || candidate.path === path
|
|
37428
|
-
);
|
|
37429
|
-
const stepOutput = datasetSteps.map((step) => readRecord(step.output)).find(
|
|
37430
|
-
(candidate) => typeof output2.datasetId === "string" && candidate?.datasetId === output2.datasetId || candidate?.path === path
|
|
37431
|
-
);
|
|
37432
|
-
const preview = readRecord(stepOutput?.preview ?? dataset?.preview);
|
|
37433
|
-
const rows = Array.isArray(preview?.rows) ? preview.rows.slice(0, 2) : [];
|
|
37434
|
-
if (rows.length > 0) {
|
|
37435
|
-
lines.push(` sample rows (${rows.length}):`);
|
|
37436
|
-
lines.push(
|
|
37437
|
-
...rows.map(
|
|
37438
|
-
(row) => ` ${clampJsonPreviewText(JSON.stringify(row) ?? String(row), 350)}`
|
|
37439
|
-
)
|
|
37440
|
-
);
|
|
37441
|
-
}
|
|
37442
|
-
continue;
|
|
37443
|
-
}
|
|
37444
|
-
const value = output2.value;
|
|
37445
|
-
const compacted = compactReturnValue(value);
|
|
37446
|
-
if (compacted && typeof compacted === "object") {
|
|
37447
|
-
lines.push(` ${name}:`);
|
|
37448
|
-
lines.push(...formatJsonPreview(compacted).map((line) => ` ${line}`));
|
|
37449
|
-
} else {
|
|
37450
|
-
lines.push(` ${name}: ${formatInlinePackageValue(value)}`);
|
|
37451
|
-
}
|
|
37452
|
-
}
|
|
37453
|
-
if (returned.length > 8) {
|
|
37454
|
-
lines.push(` ... ${returned.length - 8} more output(s)`);
|
|
37455
|
-
}
|
|
37456
|
-
return lines;
|
|
37457
|
-
}
|
|
37458
|
-
function authoredPackageStackFrames(packaged) {
|
|
37459
|
-
const stack = readRecordArray(packaged.errors).map((entry) => typeof entry.stack === "string" ? entry.stack : null).find((candidate) => Boolean(candidate?.trim()));
|
|
37460
|
-
if (!stack) return [];
|
|
37461
|
-
return stack.split("\n").map((line) => line.trim()).filter((line) => line.startsWith("at ")).filter(
|
|
37462
|
-
(line) => !line.includes("/virtual/deepline-plays/") && !line.includes("/apps/play-runner/") && !line.includes("/shared_libs/play-runtime/") && !line.includes("node:internal")
|
|
37463
|
-
).slice(0, 5);
|
|
37464
|
-
}
|
|
37465
37126
|
function activityTargetLabel(target) {
|
|
37466
37127
|
const kind = typeof target.kind === "string" ? target.kind : "target";
|
|
37467
37128
|
const label = typeof target.label === "string" ? target.label.trim() : "";
|
|
@@ -37617,152 +37278,6 @@ function formatRunTimingTextLines(run) {
|
|
|
37617
37278
|
].join(" \xB7 ")}`
|
|
37618
37279
|
];
|
|
37619
37280
|
}
|
|
37620
|
-
function formatRecentRunLogLines(value) {
|
|
37621
|
-
const logs = readRecord(value);
|
|
37622
|
-
if (!logs || !Array.isArray(logs.tail)) return [];
|
|
37623
|
-
const tail = logs.tail.filter(
|
|
37624
|
-
(line) => typeof line === "string"
|
|
37625
|
-
);
|
|
37626
|
-
if (tail.length === 0) return [];
|
|
37627
|
-
const shown = tail.map((line) => classifyLogLine(line)).filter(
|
|
37628
|
-
(entry) => entry.level !== "debug" && !isProviderRowWaitLogLine(entry.line)
|
|
37629
|
-
).slice(-8);
|
|
37630
|
-
const total = readNonNegativeInteger(logs.totalCount);
|
|
37631
|
-
if (shown.length === 0) {
|
|
37632
|
-
return [
|
|
37633
|
-
` recent logs: no non-debug lines in the retained preview (${total === null ? "total unknown" : `${formatInteger(total)} total`})`,
|
|
37634
|
-
...logs.truncated === true ? [" [older log bodies lost to retention limit]"] : []
|
|
37635
|
-
];
|
|
37636
|
-
}
|
|
37637
|
-
const lines = [
|
|
37638
|
-
` recent logs (${total === null ? "count unknown" : `${formatInteger(total)} total`}; showing ${shown.length}):`,
|
|
37639
|
-
...shown.map(
|
|
37640
|
-
(entry) => ` ${clampJsonPreviewText(formatProviderCapacityWaitLogLine(entry.line) ?? formatMapProgressDiagnosticLogLine(entry.line) ?? entry.line, 350)}`
|
|
37641
|
-
)
|
|
37642
|
-
];
|
|
37643
|
-
if (logs.truncated === true) {
|
|
37644
|
-
lines.push(" [older log bodies lost to retention limit]");
|
|
37645
|
-
}
|
|
37646
|
-
return lines;
|
|
37647
|
-
}
|
|
37648
|
-
function buildRunPackageTextLines(packaged) {
|
|
37649
|
-
const run = readRunPackageRun(packaged);
|
|
37650
|
-
const runId = typeof run.id === "string" ? run.id : "unknown";
|
|
37651
|
-
const status = typeof run.status === "string" ? run.status : "unknown";
|
|
37652
|
-
const playName = typeof run.playName === "string" ? run.playName : null;
|
|
37653
|
-
const runtimeLimitFailure = readRecordArray(packaged.errors).find(
|
|
37654
|
-
(entry) => entry.code === "RUNTIME_LIMIT_EXCEEDED"
|
|
37655
|
-
);
|
|
37656
|
-
const isRuntimeTimeout = status === "failed" && (runtimeLimitFailure !== void 0 || typeof run.error === "string" && /RUNTIME_LIMIT_EXCEEDED/.test(run.error));
|
|
37657
|
-
const isRuntimeLimitCheckpoint = isRuntimeTimeout;
|
|
37658
|
-
const checkpointFailure = runtimeLimitFailure ?? (typeof run.error === "string" ? { message: run.error } : { message: "The Play reached its runtime limit and was stopped." });
|
|
37659
|
-
const lines = isRuntimeLimitCheckpoint ? runtimeLimitCheckpointLines(packaged, runId, checkpointFailure) : [
|
|
37660
|
-
`${status === "completed" ? "\u2713" : status === "failed" ? "\u2717" : "\u2022"} ${status} ${runId}`
|
|
37661
|
-
];
|
|
37662
|
-
const outcome = typeof run.outcome === "string" ? run.outcome : null;
|
|
37663
|
-
if (outcome) lines.push(` outcome: ${outcome}`);
|
|
37664
|
-
const recovery = readRecord(run.recovery);
|
|
37665
|
-
if (recovery) {
|
|
37666
|
-
const mode = typeof recovery.mode === "string" ? recovery.mode : "recovered";
|
|
37667
|
-
const sourceRunId = typeof recovery.sourceRunId === "string" ? ` from ${recovery.sourceRunId}` : "";
|
|
37668
|
-
lines.push(` recovery: ${mode}${sourceRunId}`);
|
|
37669
|
-
}
|
|
37670
|
-
const runError = typeof run.error === "string" && run.error.trim() ? run.error.trim() : null;
|
|
37671
|
-
const structuredRuntimeLimitMessage = typeof runtimeLimitFailure?.message === "string" && runtimeLimitFailure.message.trim() ? `${typeof runtimeLimitFailure.code === "string" ? runtimeLimitFailure.code : "RUNTIME_LIMIT_EXCEEDED"}: ${runtimeLimitFailure.message.trim()}` : null;
|
|
37672
|
-
const displayRunError = structuredRuntimeLimitMessage ?? runError;
|
|
37673
|
-
if (!isRuntimeLimitCheckpoint && displayRunError && (status === "failed" || status === "cancelled")) {
|
|
37674
|
-
lines.push(` error: ${truncateErrorForDisplay(displayRunError, runId)}`);
|
|
37675
|
-
const stackFrames = authoredPackageStackFrames(packaged);
|
|
37676
|
-
if (stackFrames.length > 0) {
|
|
37677
|
-
lines.push(" stack:");
|
|
37678
|
-
lines.push(...stackFrames.map((frame) => ` ${frame}`));
|
|
37679
|
-
}
|
|
37680
|
-
}
|
|
37681
|
-
const failedLogs = readRecord(packaged.failedLogs);
|
|
37682
|
-
const failedLogEntries = Array.isArray(failedLogs?.entries) ? failedLogs.entries.filter(
|
|
37683
|
-
(entry) => typeof entry === "string"
|
|
37684
|
-
) : [];
|
|
37685
|
-
const failedLogAssociation = typeof failedLogs?.association === "string" ? failedLogs.association : null;
|
|
37686
|
-
const failedLogWarning = typeof failedLogs?.warning === "string" && failedLogs.warning.trim() ? failedLogs.warning.trim() : null;
|
|
37687
|
-
if (failedLogEntries.length > 0) {
|
|
37688
|
-
lines.push(" failed logs:");
|
|
37689
|
-
lines.push(...failedLogEntries.map((entry) => ` ${entry}`));
|
|
37690
|
-
}
|
|
37691
|
-
if (failedLogAssociation === "retained_before_truncation") {
|
|
37692
|
-
lines.push(" failed log context: last retained lines before truncation");
|
|
37693
|
-
}
|
|
37694
|
-
if (failedLogWarning) {
|
|
37695
|
-
lines.push(` warning: ${failedLogWarning}`);
|
|
37696
|
-
}
|
|
37697
|
-
const packageWarnings = Array.isArray(packaged.warnings) ? Array.from(
|
|
37698
|
-
new Set(
|
|
37699
|
-
packaged.warnings.filter(
|
|
37700
|
-
(warning) => typeof warning === "string" && warning.trim().length > 0
|
|
37701
|
-
)
|
|
37702
|
-
)
|
|
37703
|
-
).slice(0, 16) : [];
|
|
37704
|
-
lines.push(...packageWarnings.map((warning) => ` warning: ${warning}`));
|
|
37705
|
-
const failedLogNext = readRecord(failedLogs?.next);
|
|
37706
|
-
if (failedLogWarning && typeof failedLogNext?.logs === "string") {
|
|
37707
|
-
lines.push(
|
|
37708
|
-
failedLogAssociation === "retained_before_truncation" ? ` retained logs: ${failedLogNext.logs}` : ` retry failed logs: ${failedLogNext.logs}`
|
|
37709
|
-
);
|
|
37710
|
-
}
|
|
37711
|
-
if (playName && !isRuntimeLimitCheckpoint) {
|
|
37712
|
-
lines.push(` play: ${playName}`);
|
|
37713
|
-
}
|
|
37714
|
-
lines.push(...formatRunTimingTextLines(run));
|
|
37715
|
-
if (!isRuntimeLimitCheckpoint) {
|
|
37716
|
-
lines.push(...buildRunActivityTextLines(run));
|
|
37717
|
-
}
|
|
37718
|
-
lines.push(...buildRunStatusEvidenceTextLines(packaged));
|
|
37719
|
-
lines.push(...formatPackageValueOutputLines(packaged));
|
|
37720
|
-
lines.push(
|
|
37721
|
-
...formatPackageDatasetActionLines(packaged, {
|
|
37722
|
-
includeSummary: !isRuntimeLimitCheckpoint
|
|
37723
|
-
})
|
|
37724
|
-
);
|
|
37725
|
-
lines.push(...formatRecentRunLogLines(packaged.logs));
|
|
37726
|
-
const next = packaged.next && typeof packaged.next === "object" && !Array.isArray(packaged.next) ? packaged.next : {};
|
|
37727
|
-
const logsCommand = actionToCommand(next.logs);
|
|
37728
|
-
for (const step of isRuntimeLimitCheckpoint ? [] : readRecordArray(packaged.steps).slice(0, 8)) {
|
|
37729
|
-
const id = typeof step.id === "string" ? step.id : "step";
|
|
37730
|
-
const kind = typeof step.kind === "string" ? step.kind : "step";
|
|
37731
|
-
const stepStatus = typeof step.status === "string" ? step.status : status;
|
|
37732
|
-
const output2 = step.output && typeof step.output === "object" && !Array.isArray(step.output) ? step.output : null;
|
|
37733
|
-
const rowCount = output2 && typeof output2.rowCount === "number" ? ` rows=${formatInteger(output2.rowCount)}` : "";
|
|
37734
|
-
const preview = output2?.preview && typeof output2.preview === "object" && !Array.isArray(output2.preview) ? output2.preview : null;
|
|
37735
|
-
const previewRows = Array.isArray(preview?.rows) ? preview.rows.length : null;
|
|
37736
|
-
lines.push(` ${kind} ${id}: ${stepStatus}${rowCount}`);
|
|
37737
|
-
lines.push(...formatPackageDatasetSummaryLines(output2?.summary));
|
|
37738
|
-
if (previewRows !== null) {
|
|
37739
|
-
lines.push(
|
|
37740
|
-
` preview=${previewRows}${preview?.truncated ? " truncated" : ""}`
|
|
37741
|
-
);
|
|
37742
|
-
}
|
|
37743
|
-
}
|
|
37744
|
-
const inspectCommand = actionToCommand(next.inspect);
|
|
37745
|
-
const fullResultCommand = actionToCommand(next.full);
|
|
37746
|
-
const hasCatalogExportAction = packageDatasetRecords(packaged).some(
|
|
37747
|
-
(dataset) => Boolean(actionToCommand(readRecord(dataset.actions)?.exportCsv))
|
|
37748
|
-
);
|
|
37749
|
-
const legacyExportCommand = hasCatalogExportAction ? null : actionToCommand(next.export);
|
|
37750
|
-
const runAgainCommand = typeof next.run === "string" && next.run.trim() ? next.run.trim() : null;
|
|
37751
|
-
if (inspectCommand) lines.push(` inspect: ${inspectCommand}`);
|
|
37752
|
-
if (fullResultCommand)
|
|
37753
|
-
lines.push(
|
|
37754
|
-
` ${isRuntimeTimeout ? "full run details" : "full result"}: ${fullResultCommand}`
|
|
37755
|
-
);
|
|
37756
|
-
if (logsCommand) lines.push(` logs: ${logsCommand}`);
|
|
37757
|
-
if (legacyExportCommand) {
|
|
37758
|
-
lines.push(` export CSV: ${legacyExportCommand}`);
|
|
37759
|
-
}
|
|
37760
|
-
if (runAgainCommand && !isRuntimeLimitCheckpoint) {
|
|
37761
|
-
lines.push(" run again (completed work is reused):");
|
|
37762
|
-
lines.push(` ${runAgainCommand}`);
|
|
37763
|
-
}
|
|
37764
|
-
return lines;
|
|
37765
|
-
}
|
|
37766
37281
|
function buildOrdinaryPlayRunCommand(options, resolvedRevisionId) {
|
|
37767
37282
|
const target = options.target.kind === "file" ? options.target.path : options.target.name;
|
|
37768
37283
|
const parts = ["deepline", "plays", "run", shellSingleQuote(target)];
|
|
@@ -37848,6 +37363,57 @@ function buildRunLaunch(status) {
|
|
|
37848
37363
|
)
|
|
37849
37364
|
};
|
|
37850
37365
|
}
|
|
37366
|
+
function buildPlayCompletionTextLines(status) {
|
|
37367
|
+
const overview = buildRunOverview(status);
|
|
37368
|
+
const { run } = overview;
|
|
37369
|
+
const failed = run.status === "failed";
|
|
37370
|
+
const label = run.status === "completed" ? overview.rowOutcomes?.hasRowFailures ? "Completed with row failures" : "Completed" : failed ? "Failed" : run.status;
|
|
37371
|
+
const lines = [
|
|
37372
|
+
`${label} ${run.playName ?? status.playName ?? "Play"}`,
|
|
37373
|
+
`Run: ${run.id}`
|
|
37374
|
+
];
|
|
37375
|
+
for (const failure of overview.failures.steps) {
|
|
37376
|
+
lines.push(
|
|
37377
|
+
`Failed step: ${failure.stepId}${failure.message ? ` \u2014 ${failure.message}` : ""}`
|
|
37378
|
+
);
|
|
37379
|
+
}
|
|
37380
|
+
if (overview.errorDetails.run)
|
|
37381
|
+
lines.push(
|
|
37382
|
+
`Error: ${truncateErrorForDisplay(overview.errorDetails.run, run.id)}`
|
|
37383
|
+
);
|
|
37384
|
+
if (Object.hasOwn(overview, "result")) {
|
|
37385
|
+
lines.push(
|
|
37386
|
+
"Result:",
|
|
37387
|
+
...formatJsonPreview(compactReturnValue(overview.result))
|
|
37388
|
+
);
|
|
37389
|
+
}
|
|
37390
|
+
if (overview.rowOutcomes?.hasRowFailures) {
|
|
37391
|
+
lines.push(
|
|
37392
|
+
`Rows: ${overview.rowOutcomes.completedRows} completed, ${overview.rowOutcomes.failedRows} failed`
|
|
37393
|
+
);
|
|
37394
|
+
}
|
|
37395
|
+
for (const dataset of overview.datasets) {
|
|
37396
|
+
lines.push(
|
|
37397
|
+
`Rows (${dataset.name ?? dataset.datasetId}): ${dataset.rowCount ?? "unknown"}`
|
|
37398
|
+
);
|
|
37399
|
+
if (dataset.exportUnavailable)
|
|
37400
|
+
lines.push(`Export unavailable: ${dataset.exportUnavailable.message}`);
|
|
37401
|
+
}
|
|
37402
|
+
for (const warning of overview.warnings) lines.push(`Warning: ${warning}`);
|
|
37403
|
+
const exports2 = overview.actions.exportDatasetCmds;
|
|
37404
|
+
if (Array.isArray(exports2))
|
|
37405
|
+
for (const command of exports2) lines.push(`Export CSV: ${command}`);
|
|
37406
|
+
lines.push(
|
|
37407
|
+
`Logs: ${failed ? String(
|
|
37408
|
+
overview.actions.getFailedLogsCmd ?? `deepline runs logs ${shellSingleQuote(run.id)} --failed`
|
|
37409
|
+
) : String(
|
|
37410
|
+
overview.actions.getLogsCmd ?? `deepline runs logs ${shellSingleQuote(run.id)}`
|
|
37411
|
+
)}`
|
|
37412
|
+
);
|
|
37413
|
+
if (failed && status.rerunCommand)
|
|
37414
|
+
lines.push(`Retry: ${status.rerunCommand}`);
|
|
37415
|
+
return lines;
|
|
37416
|
+
}
|
|
37851
37417
|
function writePlayResult(status, jsonOutput, options) {
|
|
37852
37418
|
const packaged = getPlayRunPackage(status);
|
|
37853
37419
|
const hits = options?.hits ?? null;
|
|
@@ -37866,10 +37432,7 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
37866
37432
|
...displayPackage
|
|
37867
37433
|
} = compactPlayStatus(status);
|
|
37868
37434
|
const lines2 = [
|
|
37869
|
-
...
|
|
37870
|
-
buildRunPackageTextLines(displayPackage),
|
|
37871
|
-
status
|
|
37872
|
-
),
|
|
37435
|
+
...buildPlayCompletionTextLines(status),
|
|
37873
37436
|
...formatRunHitsLines(hits)
|
|
37874
37437
|
];
|
|
37875
37438
|
printCommandEnvelope(displayPackage, {
|
|
@@ -37905,7 +37468,7 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
37905
37468
|
)
|
|
37906
37469
|
);
|
|
37907
37470
|
if (status.status === "failed") {
|
|
37908
|
-
lines.push(` failed logs: deepline runs
|
|
37471
|
+
lines.push(` failed logs: deepline runs logs ${runId} --failed --json`);
|
|
37909
37472
|
if (status.rerunCommand) {
|
|
37910
37473
|
lines.push(" run again (completed work is reused):");
|
|
37911
37474
|
lines.push(` ${status.rerunCommand}`);
|
|
@@ -37935,18 +37498,23 @@ function writePlayResult(status, jsonOutput, options) {
|
|
|
37935
37498
|
);
|
|
37936
37499
|
}
|
|
37937
37500
|
function withRunNavigationLines(lines, status, actionCommands = buildRunNavigation(status).actions) {
|
|
37938
|
-
const navigation = buildRunNavigation(status);
|
|
37939
37501
|
const existing = lines.join("\n");
|
|
37940
|
-
|
|
37941
|
-
|
|
37942
|
-
|
|
37943
|
-
|
|
37944
|
-
|
|
37945
|
-
|
|
37502
|
+
const labels = {
|
|
37503
|
+
getRunCmd: "Inspect",
|
|
37504
|
+
getFullRunCmd: "Full run",
|
|
37505
|
+
getBillingCmd: "Billing",
|
|
37506
|
+
getLogsCmd: "Logs",
|
|
37507
|
+
getFailedLogsCmd: "Failure logs",
|
|
37508
|
+
getReceiptCmd: "Saved responses",
|
|
37509
|
+
exportDatasetCmds: "Export rows",
|
|
37510
|
+
queryTableSqlCmds: "Query rows",
|
|
37511
|
+
stopRunCmd: "Stop run",
|
|
37512
|
+
rerunCmd: "Retry"
|
|
37513
|
+
};
|
|
37946
37514
|
for (const [name, value] of Object.entries(actionCommands)) {
|
|
37947
37515
|
for (const command of Array.isArray(value) ? value : [value]) {
|
|
37948
37516
|
if (typeof command === "string" && !existing.includes(command))
|
|
37949
|
-
lines.push(` ${name}: ${command}`);
|
|
37517
|
+
lines.push(` ${labels[name] ?? name}: ${command}`);
|
|
37950
37518
|
}
|
|
37951
37519
|
}
|
|
37952
37520
|
return lines;
|
|
@@ -38689,7 +38257,12 @@ function writeStartedPlayRun(input2) {
|
|
|
38689
38257
|
failedLogs: _failedLogs,
|
|
38690
38258
|
...displayPackage
|
|
38691
38259
|
} = input2.package;
|
|
38692
|
-
const lines2 =
|
|
38260
|
+
const lines2 = buildPlayCompletionTextLines({
|
|
38261
|
+
runId: input2.runId,
|
|
38262
|
+
playName: input2.playName,
|
|
38263
|
+
status: input2.status,
|
|
38264
|
+
package: displayPackage
|
|
38265
|
+
});
|
|
38693
38266
|
const output3 = lines2.join("\n");
|
|
38694
38267
|
if (input2.progress) {
|
|
38695
38268
|
input2.progress.writeLine(output3, process.stdout);
|
|
@@ -38717,17 +38290,11 @@ function writeStartedPlayRun(input2) {
|
|
|
38717
38290
|
};
|
|
38718
38291
|
const lines = [
|
|
38719
38292
|
`Started ${input2.playName}`,
|
|
38720
|
-
`
|
|
38721
|
-
`
|
|
38722
|
-
` input: ${input2.inputFieldCount ?? 0} top-level field(s) supplied`,
|
|
38723
|
-
` 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"}`,
|
|
38724
|
-
` inspect: deepline runs get ${input2.runId} --json`,
|
|
38725
|
-
` full debug: deepline runs get ${input2.runId} --full --json`,
|
|
38726
|
-
` logs: deepline runs logs ${input2.runId} --json`,
|
|
38727
|
-
` export after completion: deepline runs export ${input2.runId} --out output.csv`,
|
|
38293
|
+
`Run: ${input2.runId}`,
|
|
38294
|
+
`Logs: deepline runs logs ${shellSingleQuote(input2.runId)}`,
|
|
38728
38295
|
...["started", "queued", "running", "waiting"].includes(
|
|
38729
38296
|
input2.status ?? "started"
|
|
38730
|
-
) ? [`
|
|
38297
|
+
) ? [`Stop: deepline runs stop ${shellSingleQuote(input2.runId)} --json`] : []
|
|
38731
38298
|
];
|
|
38732
38299
|
if (input2.jsonOutput) {
|
|
38733
38300
|
printCommandEnvelope(payload, { json: true, fields: input2.jsonFields });
|
|
@@ -40149,7 +39716,7 @@ function renderRunOverviewText(overview, extras = {}) {
|
|
|
40149
39716
|
getBillingCmd: "Billing",
|
|
40150
39717
|
getLogsCmd: "Logs",
|
|
40151
39718
|
getFailedLogsCmd: "Failure logs",
|
|
40152
|
-
getReceiptCmd: "
|
|
39719
|
+
getReceiptCmd: "Saved responses",
|
|
40153
39720
|
exportDatasetCmds: "Export rows",
|
|
40154
39721
|
queryTableSqlCmds: "Query rows",
|
|
40155
39722
|
stopRunCmd: "Stop run",
|
|
@@ -40171,7 +39738,7 @@ async function handleRunGet(args) {
|
|
|
40171
39738
|
args.includes("--config") ? "config" : "get"
|
|
40172
39739
|
);
|
|
40173
39740
|
args = selection.args;
|
|
40174
|
-
const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--config]
|
|
39741
|
+
const usage2 = "Usage: deepline runs get <run-id> [--json] [--full] [--input] [--config]";
|
|
40175
39742
|
let runId;
|
|
40176
39743
|
try {
|
|
40177
39744
|
runId = parseRunIdPositional(args, usage2);
|
|
@@ -43180,7 +42747,7 @@ Examples:
|
|
|
43180
42747
|
deepline runs get play/my-play/run/20260501t000000-000
|
|
43181
42748
|
deepline runs get play/my-play/run/20260501t000000-000 --json
|
|
43182
42749
|
deepline runs get play/my-play/run/20260501t000000-000 --json run.status,run.durationMs
|
|
43183
|
-
deepline runs
|
|
42750
|
+
deepline runs logs play/my-play/run/20260501t000000-000 --failed --json
|
|
43184
42751
|
deepline runs get play/my-play/run/20260501t000000-000 --full --json
|
|
43185
42752
|
deepline runs get play/my-play/run/20260501t000000-000 --input
|
|
43186
42753
|
deepline runs get play/my-play/run/20260501t000000-000 --config --json
|
|
@@ -43197,9 +42764,8 @@ Examples:
|
|
|
43197
42764
|
).option(
|
|
43198
42765
|
"--config",
|
|
43199
42766
|
"Explicitly print the recorded configuration, without full results"
|
|
43200
|
-
).
|
|
43201
|
-
"--log-failed",
|
|
43202
|
-
"Attach a bounded terminal-failure log window for failed runs"
|
|
42767
|
+
).addOption(
|
|
42768
|
+
new import_commander4.Option("--log-failed", "Attach terminal-failure logs").hideHelp()
|
|
43203
42769
|
).action(async (runId, options) => {
|
|
43204
42770
|
process.exitCode = await handleRunGet([
|
|
43205
42771
|
runId,
|
|
@@ -50585,7 +50151,10 @@ Examples:
|
|
|
50585
50151
|
`
|
|
50586
50152
|
Notes:
|
|
50587
50153
|
Shows the compact agent contract by default: what the tool does, cost,
|
|
50588
|
-
required inputs, play getters, and
|
|
50154
|
+
required inputs, play getters, input and full Deepline response examples,
|
|
50155
|
+
and a ctx.tools.execute snippet. Tool responses live at toolResponse.rawV2;
|
|
50156
|
+
preserve the nesting shown in the tool's example. Schemas and examples are
|
|
50157
|
+
separate describe fields.
|
|
50589
50158
|
get is accepted as a compatibility alias for describe.
|
|
50590
50159
|
|
|
50591
50160
|
Examples:
|
|
@@ -50608,7 +50177,7 @@ Examples:
|
|
|
50608
50177
|
"Quote an ai_evaluate, ai_inference, or deeplineagent JSON payload (inline or @file)"
|
|
50609
50178
|
).option("--pricing-only", "Only print pricing and billing semantics").option("--schema-only", "Only print input schema fields").option(
|
|
50610
50179
|
"--examples-only",
|
|
50611
|
-
"Only print
|
|
50180
|
+
"Only print input payload and full Deepline execution response examples"
|
|
50612
50181
|
).option("--getters-only", "Only print extracted list/value getters").addOption(
|
|
50613
50182
|
new import_commander5.Option(
|
|
50614
50183
|
"--compact",
|
|
@@ -50785,6 +50354,30 @@ async function getTool(toolId, options = {}) {
|
|
|
50785
50354
|
);
|
|
50786
50355
|
return 0;
|
|
50787
50356
|
}
|
|
50357
|
+
if ((options.schemaOnly || options.examplesOnly || options.gettersOnly) && !isMonitorTypeTool(tool) && !isPlayLikeTool(tool) && (options.json || options.contractJson)) {
|
|
50358
|
+
const contract = toolContractJsonForDescribe(tool, toolId);
|
|
50359
|
+
printCompactJson({
|
|
50360
|
+
toolId: contract.toolId,
|
|
50361
|
+
...options.schemaOnly ? {
|
|
50362
|
+
inputSchema: contract.inputSchema,
|
|
50363
|
+
inputFields: contract.inputFields,
|
|
50364
|
+
outputSchema: contract.outputSchema,
|
|
50365
|
+
outputFields: contract.outputFields,
|
|
50366
|
+
responseSchema: contract.responseSchema
|
|
50367
|
+
} : options.examplesOnly ? {
|
|
50368
|
+
examples: contract.examples ?? [],
|
|
50369
|
+
responseAccess: contract.responseAccess,
|
|
50370
|
+
getters: contract.getters,
|
|
50371
|
+
executeCommand: contract.executeCommand
|
|
50372
|
+
} : {
|
|
50373
|
+
getters: contract.getters,
|
|
50374
|
+
responseAccess: contract.responseAccess
|
|
50375
|
+
},
|
|
50376
|
+
...modelDescription ? { modelOptions: modelDescription } : {},
|
|
50377
|
+
...inferenceQuote ? { inferenceQuote } : {}
|
|
50378
|
+
});
|
|
50379
|
+
return 0;
|
|
50380
|
+
}
|
|
50788
50381
|
if (options.contractJson) {
|
|
50789
50382
|
printCompactJson({
|
|
50790
50383
|
...toolContractJsonForDescribe(tool, toolId),
|
|
@@ -50926,6 +50519,9 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
|
|
|
50926
50519
|
} : {},
|
|
50927
50520
|
inputFields: inputFields.map(inputFieldJsonForDescribe),
|
|
50928
50521
|
inputSchema,
|
|
50522
|
+
...isRecord8(tool.responseSchema) ? { responseSchema: tool.responseSchema } : {},
|
|
50523
|
+
...Array.isArray(tool.examples) ? { examples: tool.examples } : {},
|
|
50524
|
+
responseAccess: "result.toolResponse.rawV2",
|
|
50929
50525
|
...Object.keys(outputSchemaRecord).length > 0 ? {
|
|
50930
50526
|
outputSchema: publicToolInputSchemaForDescribe(outputSchemaRecord),
|
|
50931
50527
|
outputFields: outputFields.map(inputFieldJsonForDescribe)
|
|
@@ -51147,15 +50743,13 @@ function printCompactToolContract(tool, requestedToolId) {
|
|
|
51147
50743
|
}
|
|
51148
50744
|
}
|
|
51149
50745
|
console.log("");
|
|
51150
|
-
printToolExamplesOnly(tool, requestedToolId
|
|
50746
|
+
printToolExamplesOnly(tool, requestedToolId);
|
|
51151
50747
|
const starterScript = isRecord8(contract.starterScript) ? contract.starterScript : {};
|
|
51152
50748
|
const starterPath = stringField2(starterScript, "path");
|
|
51153
50749
|
if (starterPath) {
|
|
51154
50750
|
console.log("");
|
|
51155
50751
|
console.log(`Starter script: ${starterPath}`);
|
|
51156
|
-
console.log(
|
|
51157
|
-
"Copy it into your project and replace the sample input with the proven probe payload."
|
|
51158
|
-
);
|
|
50752
|
+
console.log("Copy it into your project and adapt the example input.");
|
|
51159
50753
|
}
|
|
51160
50754
|
if (listGetters.length || valueGetters.length) {
|
|
51161
50755
|
console.log("");
|
|
@@ -51245,11 +50839,15 @@ function printToolSchemaOnly(tool, requestedToolId) {
|
|
|
51245
50839
|
recordField(contract, "inputSchema")
|
|
51246
50840
|
);
|
|
51247
50841
|
if (declaredSchema) {
|
|
51248
|
-
console.log("Declared JSON Schema:");
|
|
50842
|
+
console.log("Declared input JSON Schema:");
|
|
51249
50843
|
console.log(JSON.stringify(declaredSchema, null, 2));
|
|
51250
50844
|
}
|
|
50845
|
+
if (isRecord8(contract.responseSchema)) {
|
|
50846
|
+
console.log("Deepline execution response JSON Schema:");
|
|
50847
|
+
console.log(JSON.stringify(contract.responseSchema, null, 2));
|
|
50848
|
+
}
|
|
51251
50849
|
}
|
|
51252
|
-
function printToolExamplesOnly(tool, requestedToolId
|
|
50850
|
+
function printToolExamplesOnly(tool, requestedToolId) {
|
|
51253
50851
|
if (isMonitorTypeTool(tool)) {
|
|
51254
50852
|
printMonitorTypeDeploy(tool);
|
|
51255
50853
|
return;
|
|
@@ -51261,7 +50859,11 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
51261
50859
|
const contract = toolContractJsonForDescribe(tool, requestedToolId);
|
|
51262
50860
|
const toolId = String(contract.toolId);
|
|
51263
50861
|
const inputFields = Array.isArray(contract.inputFields) ? contract.inputFields : [];
|
|
51264
|
-
const
|
|
50862
|
+
const examples = arrayField2(tool, "examples").filter(isRecord8);
|
|
50863
|
+
const firstExample = examples[0];
|
|
50864
|
+
const sampleInput = firstExample && isRecord8(firstExample.input) ? firstExample.input : samplePayload(recordField(tool, "samples"), "request") ?? samplePayloadForInputFields(inputFields);
|
|
50865
|
+
console.log("Example input payload:");
|
|
50866
|
+
console.log(JSON.stringify(sampleInput, null, 2));
|
|
51265
50867
|
console.log(`Use in a play:`);
|
|
51266
50868
|
console.log("```ts");
|
|
51267
50869
|
console.log("const result = await ctx.tools.execute({");
|
|
@@ -51271,6 +50873,7 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
51271
50873
|
` input: ${JSON.stringify(sampleInput || {}, null, 2).replace(/\n/g, "\n ")},`
|
|
51272
50874
|
);
|
|
51273
50875
|
console.log("});");
|
|
50876
|
+
console.log("const response = result.toolResponse.rawV2;");
|
|
51274
50877
|
const getters = isRecord8(contract.getters) ? contract.getters : {};
|
|
51275
50878
|
const valueGetters = Array.isArray(getters.extractedValues) ? getters.extractedValues : [];
|
|
51276
50879
|
const listGetters = Array.isArray(getters.extractedLists) ? getters.extractedLists : [];
|
|
@@ -51284,10 +50887,19 @@ function printToolExamplesOnly(tool, requestedToolId, options = {}) {
|
|
|
51284
50887
|
);
|
|
51285
50888
|
}
|
|
51286
50889
|
console.log("```");
|
|
51287
|
-
|
|
51288
|
-
const
|
|
51289
|
-
|
|
50890
|
+
for (const example of examples) {
|
|
50891
|
+
const description = stringField2(example, "description");
|
|
50892
|
+
if (description) console.log(description);
|
|
50893
|
+
console.log("Example Deepline execution response:");
|
|
50894
|
+
console.log(JSON.stringify(example.response, null, 2));
|
|
51290
50895
|
}
|
|
50896
|
+
if (!examples.length)
|
|
50897
|
+
console.log(
|
|
50898
|
+
"No Deepline execution response example is published by this server."
|
|
50899
|
+
);
|
|
50900
|
+
console.log(
|
|
50901
|
+
"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."
|
|
50902
|
+
);
|
|
51291
50903
|
}
|
|
51292
50904
|
function printPlayLikeToolUsage(tool, requestedToolId) {
|
|
51293
50905
|
const toolId = String(tool.toolId || requestedToolId);
|
|
@@ -51432,9 +51044,9 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
|
|
|
51432
51044
|
inputFields: inputFields.map(inputFieldJsonForDescribe),
|
|
51433
51045
|
usageGuidance,
|
|
51434
51046
|
runtimeOutputHelp: {
|
|
51435
|
-
contract: "
|
|
51047
|
+
contract: "Schemas declare field shapes. Examples illustrate input payloads and full Deepline execution responses; they are not observed responses from this call.",
|
|
51436
51048
|
getterScope: "extractedValues/extractedLists .get() only works for declared Deepline getters listed in usageGuidance.toolExecutionResult.",
|
|
51437
|
-
rawToolResponse: "Use toolExecutionResult.toolResponse.rawV2 for
|
|
51049
|
+
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.",
|
|
51438
51050
|
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter.",
|
|
51439
51051
|
observeActualShape: observedOutputCommand,
|
|
51440
51052
|
observedOutput: observedOutputCommand,
|
|
@@ -51449,7 +51061,25 @@ function usageGuidanceWithAccessDefaults(usageGuidance) {
|
|
|
51449
51061
|
const existingAccess = recordField(usageGuidance, "access");
|
|
51450
51062
|
return {
|
|
51451
51063
|
...usageGuidance,
|
|
51064
|
+
prefer: [
|
|
51065
|
+
"Use only the declared extractedLists and extractedValues getters listed below.",
|
|
51066
|
+
"Use toolExecutionResult.toolResponse.rawV2 for the complete tool response, preserving the nesting shown in the response example.",
|
|
51067
|
+
"Schemas declare field shapes; examples illustrate input values and full Deepline execution responses."
|
|
51068
|
+
],
|
|
51069
|
+
toolExecutionResult: {
|
|
51070
|
+
...recordField(
|
|
51071
|
+
usageGuidance,
|
|
51072
|
+
"toolExecutionResult",
|
|
51073
|
+
"tool_execution_result"
|
|
51074
|
+
),
|
|
51075
|
+
toolResponse: {
|
|
51076
|
+
rawV2: "toolResponse.rawV2",
|
|
51077
|
+
view: "toolResponse.view",
|
|
51078
|
+
responseMeta: "toolResponse.responseMeta"
|
|
51079
|
+
}
|
|
51080
|
+
},
|
|
51452
51081
|
access: {
|
|
51082
|
+
...existingAccess,
|
|
51453
51083
|
extractedLists: {
|
|
51454
51084
|
expression: "toolExecutionResult.extractedLists.<name>.get()",
|
|
51455
51085
|
meaning: "Declared Deepline list extractors only."
|
|
@@ -51461,13 +51091,13 @@ function usageGuidanceWithAccessDefaults(usageGuidance) {
|
|
|
51461
51091
|
...existingAccess,
|
|
51462
51092
|
rawToolResponse: {
|
|
51463
51093
|
expression: "toolExecutionResult.toolResponse.rawV2",
|
|
51464
|
-
meaning: "Complete
|
|
51094
|
+
meaning: "Complete tool response with its original nesting. Read tool-specific fields here; use declared getters for extracted values and lists."
|
|
51465
51095
|
},
|
|
51466
51096
|
canonicalToolResponse: {
|
|
51467
51097
|
expression: "toolExecutionResult.toolResponse.rawV2",
|
|
51468
|
-
meaning: "Complete
|
|
51098
|
+
meaning: "Complete tool response with its original nesting and sibling fields."
|
|
51469
51099
|
},
|
|
51470
|
-
invalidGetterHint: "If TypeScript says an extractedValues/extractedLists property does not exist, that field is not a declared Deepline getter;
|
|
51100
|
+
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."
|
|
51471
51101
|
}
|
|
51472
51102
|
};
|
|
51473
51103
|
}
|
|
@@ -51799,23 +51429,6 @@ function formatRateWindow(windowMs) {
|
|
|
51799
51429
|
if (windowMs === 36e5) return "hour";
|
|
51800
51430
|
return `${windowMs}ms`;
|
|
51801
51431
|
}
|
|
51802
|
-
function printSamples(samples) {
|
|
51803
|
-
const requestPayload = samplePayload(samples, "request");
|
|
51804
|
-
const responsePayload = samplePayload(samples, "response");
|
|
51805
|
-
if (requestPayload === void 0 && responsePayload === void 0) return;
|
|
51806
|
-
console.log(" Samples:");
|
|
51807
|
-
if (requestPayload !== void 0)
|
|
51808
|
-
printJsonPreview("Example payload", requestPayload);
|
|
51809
|
-
if (responsePayload !== void 0)
|
|
51810
|
-
printJsonPreview("Example response", responsePayload);
|
|
51811
|
-
}
|
|
51812
|
-
function printJsonPreview(label, payload) {
|
|
51813
|
-
console.log(` ${label}:`);
|
|
51814
|
-
const rendered = JSON.stringify(payload, null, 2);
|
|
51815
|
-
for (const line of rendered.split("\n")) {
|
|
51816
|
-
console.log(` ${line}`);
|
|
51817
|
-
}
|
|
51818
|
-
}
|
|
51819
51432
|
function samplePayload(samples, key) {
|
|
51820
51433
|
const entry = samples[key];
|
|
51821
51434
|
if (!isRecord8(entry)) return void 0;
|