deepline 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -216,8 +216,8 @@ function resolveConfig(options) {
216
216
  }
217
217
 
218
218
  // src/version.ts
219
- var SDK_VERSION = "0.1.35";
220
- var SDK_API_CONTRACT = "2026-05-v2-tool-result-contract";
219
+ var SDK_VERSION = "0.1.36";
220
+ var SDK_API_CONTRACT = "2026-05-v2-tool-response";
221
221
 
222
222
  // ../shared_libs/play-runtime/coordinator-headers.ts
223
223
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -528,7 +528,7 @@ function sleep(ms) {
528
528
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
529
529
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
530
530
  var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
531
- var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-execution-result";
531
+ var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
532
532
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
533
533
  function sleep2(ms) {
534
534
  return new Promise((resolve11) => setTimeout(resolve11, ms));
@@ -797,8 +797,8 @@ var DeeplineClient = class {
797
797
  /**
798
798
  * Execute a tool and return the standard execution envelope.
799
799
  *
800
- * The `toolExecutionResult.toolOutput.raw` field contains the raw tool output.
801
- * `toolExecutionResult.toolOutput.meta` contains tool/provider metadata.
800
+ * The `toolResponse.raw` field contains the raw tool response.
801
+ * `toolResponse.meta` contains tool/provider metadata.
802
802
  * Top-level fields such as `status`, `job_id`, and `billing` describe the
803
803
  * Deepline execution envelope.
804
804
  */
@@ -6587,6 +6587,7 @@ function buildRunNextCommands(status) {
6587
6587
  }
6588
6588
  const commands = {
6589
6589
  get: `deepline runs get ${runId} --json`,
6590
+ full: `deepline runs get ${runId} --full --json`,
6590
6591
  stop: `deepline runs stop ${runId} --reason "stale lock" --json`,
6591
6592
  logs: `deepline runs logs ${runId} --out run.log --json`
6592
6593
  };
@@ -7281,6 +7282,10 @@ function renderServerResultView(value) {
7281
7282
  );
7282
7283
  }
7283
7284
  const tables = Array.isArray(view.tables) ? view.tables : [];
7285
+ const topLevelOutputTable = view.topLevelOutputTable && typeof view.topLevelOutputTable === "object" && !Array.isArray(view.topLevelOutputTable) ? view.topLevelOutputTable : null;
7286
+ if (typeof topLevelOutputTable?.queryCommand === "string") {
7287
+ lines.push(` top-level outputs: ${topLevelOutputTable.queryCommand}`);
7288
+ }
7284
7289
  if (tables.length > 0) {
7285
7290
  lines.push(" tables:");
7286
7291
  for (const table of tables.slice(0, 6)) {
@@ -7297,6 +7302,21 @@ function renderServerResultView(value) {
7297
7302
  lines.push(
7298
7303
  ` ${String(table.tableNamespace ?? "table")}${lineLabel}: ${rowLabel}${details.join(" ")}`
7299
7304
  );
7305
+ if (typeof table.queryDatasetCommand === "string") {
7306
+ lines.push(` inspect rows: ${table.queryDatasetCommand}`);
7307
+ }
7308
+ if (table.debugHelp && typeof table.debugHelp === "object" && !Array.isArray(table.debugHelp)) {
7309
+ const debugHelp = table.debugHelp;
7310
+ const rawResultFields = Array.isArray(debugHelp.rawResultFields) ? debugHelp.rawResultFields.filter(
7311
+ (field) => typeof field === "string"
7312
+ ) : [];
7313
+ if (rawResultFields.length > 0) {
7314
+ lines.push(` tool-result columns: ${rawResultFields.join(", ")}`);
7315
+ }
7316
+ }
7317
+ if (typeof table.slowExportAsCsvCommand === "string") {
7318
+ lines.push(` export rows: ${table.slowExportAsCsvCommand}`);
7319
+ }
7300
7320
  }
7301
7321
  }
7302
7322
  return { lines: lines.length > 1 ? lines : [], actions: [] };
@@ -7322,7 +7342,8 @@ function writeStartedPlayRun(input) {
7322
7342
  ` get status: deepline runs get ${input.runId} --json`,
7323
7343
  ` logs: deepline runs logs ${input.runId} --json`,
7324
7344
  ` stop run: deepline runs stop ${input.runId} --reason "stale lock" --json`,
7325
- ` result JSON: deepline runs get ${input.runId} --json`
7345
+ ` result JSON: deepline runs get ${input.runId} --json`,
7346
+ ` full debug JSON: deepline runs get ${input.runId} --full --json`
7326
7347
  ];
7327
7348
  if (input.dashboardUrl) {
7328
7349
  lines.push(` play page: ${input.dashboardUrl}`);
@@ -8960,17 +8981,13 @@ function normalizeRows(value) {
8960
8981
  }
8961
8982
  function candidateRoots(payload) {
8962
8983
  const roots = [{ path: null, value: payload }];
8963
- if (isPlainObject(payload) && isPlainObject(payload.toolExecutionResult)) {
8964
- roots.push({ path: "toolExecutionResult", value: payload.toolExecutionResult });
8965
- const toolOutput = payload.toolExecutionResult.toolOutput;
8966
- if (isPlainObject(toolOutput)) {
8967
- roots.push({ path: "toolExecutionResult.toolOutput", value: toolOutput });
8968
- if (Object.prototype.hasOwnProperty.call(toolOutput, "raw")) {
8969
- roots.push({
8970
- path: "toolExecutionResult.toolOutput.raw",
8971
- value: toolOutput.raw
8972
- });
8973
- }
8984
+ if (isPlainObject(payload) && isPlainObject(payload.toolResponse)) {
8985
+ roots.push({ path: "toolResponse", value: payload.toolResponse });
8986
+ if (Object.prototype.hasOwnProperty.call(payload.toolResponse, "raw")) {
8987
+ roots.push({
8988
+ path: "toolResponse.raw",
8989
+ value: payload.toolResponse.raw
8990
+ });
8974
8991
  }
8975
8992
  }
8976
8993
  if (isPlainObject(payload) && isPlainObject(payload.output)) {
@@ -9276,7 +9293,7 @@ Notes:
9276
9293
  waterfalls, row maps, checkpoints, and retries.
9277
9294
  execute is the canonical execution verb. run is a compatibility alias.
9278
9295
  Calling a provider-backed tool can spend Deepline credits. Use --json for the
9279
- stable result payload and --full-output when debugging response metadata.
9296
+ stable result payload plus output preview and debugging helpers.
9280
9297
 
9281
9298
  Examples:
9282
9299
  deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
@@ -9289,7 +9306,7 @@ Examples:
9289
9306
  }, []).option("--json [payload]", "Emit JSON output. Use `--input` or `--payload` for passing JSON params.").option("--input <payload>", "Merge a JSON object into the tool params").option("--payload <payload>", "Merge a JSON object into the tool params").option(
9290
9307
  "--output-format <format>",
9291
9308
  "Output format: auto, csv, csv_file, json, or json_file"
9292
- ).option("--full-output", "Emit the full JSON payload").option("--no-preview", "Only print the extracted output path when applicable").action(async (toolId, options) => {
9309
+ ).option("--no-preview", "Only print the extracted output path when applicable").action(async (toolId, options) => {
9293
9310
  const args = [
9294
9311
  toolId,
9295
9312
  ...options.param.flatMap((value) => ["--param", value]),
@@ -9298,7 +9315,6 @@ Examples:
9298
9315
  ...options.input ? ["--input", options.input] : [],
9299
9316
  ...options.payload ? ["--payload", options.payload] : [],
9300
9317
  ...options.outputFormat ? ["--output-format", options.outputFormat] : [],
9301
- ...options.fullOutput ? ["--full-output"] : [],
9302
9318
  ...options.preview === false ? ["--no-preview"] : []
9303
9319
  ];
9304
9320
  process.exitCode = await executeTool(args);
@@ -9323,13 +9339,29 @@ async function getTool(args) {
9323
9339
  throw error;
9324
9340
  }
9325
9341
  if (argsWantJson(args)) {
9326
- process.stdout.write(`${JSON.stringify(tool)}
9342
+ process.stdout.write(`${JSON.stringify(toolMetadataJsonForDescribe(tool, toolId))}
9327
9343
  `);
9328
9344
  return 0;
9329
9345
  }
9330
9346
  printToolDetails(tool, toolId);
9331
9347
  return 0;
9332
9348
  }
9349
+ function toolMetadataJsonForDescribe(tool, requestedToolId) {
9350
+ const toolId = String(tool.toolId || requestedToolId);
9351
+ return {
9352
+ ...tool,
9353
+ toolId,
9354
+ provider: tool.provider,
9355
+ displayName: tool.displayName,
9356
+ runtimeOutputHelp: {
9357
+ contract: "tools describe shows the declared schema and semantic getters; it is not an observed provider response.",
9358
+ observeActualShape: `deepline tools execute ${toolId} --input '{...}' --json`,
9359
+ observedOutput: `deepline tools execute ${toolId} --input '{...}' --json`,
9360
+ forPlayGetterBugs: "Run the play, then inspect the emitted table commands from runs get. Use deepline db query against the run tables before editing getters.",
9361
+ executeOutputFields: "tools execute JSON may include output_preview for this direct probe only; play debugging uses run tables."
9362
+ }
9363
+ };
9364
+ }
9333
9365
  function printToolDetails(tool, requestedToolId) {
9334
9366
  const toolId = String(tool.toolId || requestedToolId);
9335
9367
  const operation = typeof tool.operation === "string" ? tool.operation : "";
@@ -9350,6 +9382,10 @@ function printToolDetails(tool, requestedToolId) {
9350
9382
  const samples = recordField(tool, "samples");
9351
9383
  const usageGuidance = recordField(tool, "usageGuidance", "usage_guidance");
9352
9384
  console.log(`Tool: ${toolId}`);
9385
+ console.log(" Runtime output help:");
9386
+ console.log(" describe shows declared schema/getters, not an observed provider response");
9387
+ console.log(` observe actual shape: deepline tools execute ${toolId} --input '{...}' --json`);
9388
+ console.log(" for play getter bugs: run the play, then use the db query commands printed by runs get");
9353
9389
  if (displayName) {
9354
9390
  console.log(" Display name:");
9355
9391
  console.log(` ${displayName}`);
@@ -9446,32 +9482,18 @@ function printUsageGuidance(usageGuidance) {
9446
9482
  if (Object.keys(usageGuidance).length === 0) return;
9447
9483
  const execute = stringField(usageGuidance, "execute");
9448
9484
  const toolExecutionResult = recordField(usageGuidance, "toolExecutionResult", "tool_execution_result");
9449
- const toolOutput = recordField(toolExecutionResult, "toolOutput", "tool_output");
9450
- const extractedLists = extractionEntries(toolExecutionResult, "extractedLists", "extracted_lists");
9451
- const extractedValues = extractionEntries(toolExecutionResult, "extractedValues", "extracted_values");
9485
+ const toolResponse = recordField(toolExecutionResult, "toolResponse", "tool_response");
9486
+ const extractedLists = arrayField(toolExecutionResult, "extractedLists", "extracted_lists");
9487
+ const extractedValues = arrayField(toolExecutionResult, "extractedValues", "extracted_values");
9452
9488
  console.log(" Usage guidance:");
9453
9489
  if (execute) console.log(` ${execute}`);
9454
- const raw = pathField(toolOutput, "raw");
9455
- const meta = pathField(toolOutput, "meta");
9456
- if (raw) console.log(` Raw tool output: ${raw}`);
9457
- if (meta) console.log(` Tool output metadata: ${meta}`);
9490
+ const raw = stringField(toolResponse, "raw");
9491
+ const meta = stringField(toolResponse, "meta");
9492
+ if (raw) console.log(` Raw tool response: ${raw}`);
9493
+ if (meta) console.log(` Tool response metadata: ${meta}`);
9458
9494
  printExtractions("Extracted lists", extractedLists);
9459
9495
  printExtractions("Extracted values", extractedValues);
9460
9496
  }
9461
- function pathField(record, key) {
9462
- const value = record[key];
9463
- if (typeof value === "string") return value.trim();
9464
- if (isRecord3(value)) return stringField(value, "path");
9465
- return "";
9466
- }
9467
- function extractionEntries(record, camelKey, snakeKey) {
9468
- const value = record[camelKey] ?? record[snakeKey];
9469
- if (Array.isArray(value)) return value;
9470
- if (!isRecord3(value)) return [];
9471
- return Object.entries(value).map(
9472
- ([name, entry]) => isRecord3(entry) ? { name, ...entry } : { name }
9473
- );
9474
- }
9475
9497
  function printExtractions(label, entries) {
9476
9498
  if (!entries.length) return;
9477
9499
  console.log(` ${label}:`);
@@ -9561,7 +9583,7 @@ function listExtractorPathsFromUsageGuidance(tool) {
9561
9583
  const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
9562
9584
  if (!Array.isArray(paths)) return [];
9563
9585
  return paths.map(
9564
- (path) => path.trim().replace(/^toolExecutionResult\.toolOutput\.raw\.?/, "").replace(/^\./, "")
9586
+ (path) => path.trim().replace(/^toolExecutionResult\.toolResponse\.raw\.?/, "").replace(/^toolExecutionResult\.toolOutput\.raw\.?/, "").replace(/^\./, "")
9565
9587
  ).filter(Boolean);
9566
9588
  });
9567
9589
  }
@@ -9633,12 +9655,11 @@ function normalizeOutputFormat(raw) {
9633
9655
  function parseExecuteOptions(args) {
9634
9656
  const toolId = args[0];
9635
9657
  if (!toolId) {
9636
- throw new Error(`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--output-format auto|csv|csv_file|json|json_file] [--full-output] [--no-preview]`);
9658
+ throw new Error(`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--output-format auto|csv|csv_file|json|json_file] [--no-preview]`);
9637
9659
  }
9638
9660
  const params = {};
9639
9661
  let outputFormat = "auto";
9640
9662
  let noPreview = false;
9641
- let fullOutput = false;
9642
9663
  for (let index = 1; index < args.length; index += 1) {
9643
9664
  const arg = args[index];
9644
9665
  if ((arg === "--param" || arg === "-p") && args[index + 1]) {
@@ -9663,18 +9684,13 @@ function parseExecuteOptions(args) {
9663
9684
  outputFormat = normalizeOutputFormat(args[++index]);
9664
9685
  continue;
9665
9686
  }
9666
- if (arg === "--full-output") {
9667
- outputFormat = "json";
9668
- fullOutput = true;
9669
- continue;
9670
- }
9671
9687
  if (arg === "--no-preview") {
9672
9688
  noPreview = true;
9673
9689
  continue;
9674
9690
  }
9675
9691
  throw new Error(`Unknown option: ${arg}`);
9676
9692
  }
9677
- return { toolId, params, outputFormat, noPreview, fullOutput };
9693
+ return { toolId, params, outputFormat, noPreview };
9678
9694
  }
9679
9695
  function safeFileStem(value) {
9680
9696
  return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
@@ -9745,7 +9761,8 @@ function buildToolExecuteBaseEnvelope(input) {
9745
9761
  kind: summaryEntries.length > 0 ? "object" : "raw",
9746
9762
  summary: input.summary
9747
9763
  };
9748
- const envelopeHasCanonicalOutput = isRecord3(envelope.toolExecutionResult) && isRecord3(envelope.toolExecutionResult.toolOutput) && Object.prototype.hasOwnProperty.call(envelope.toolExecutionResult.toolOutput, "raw");
9764
+ const envelopeHasCanonicalOutput = isRecord3(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
9765
+ const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
9749
9766
  const actions = input.listConversion ? [
9750
9767
  {
9751
9768
  label: "next",
@@ -9756,15 +9773,21 @@ function buildToolExecuteBaseEnvelope(input) {
9756
9773
  ...envelope,
9757
9774
  ...envelopeHasCanonicalOutput ? { output_preview: outputPreview } : { output: outputPreview },
9758
9775
  ...summaryEntries.length > 0 ? { summary: input.summary } : {},
9759
- next: input.listConversion ? {
9760
- expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
9761
- } : {},
9776
+ next: {
9777
+ inspect: inspectCommand,
9778
+ playDebugging: "When fixing a play getter, inspect the actual play run table with runs get / inspect rows; do not copy CLI preview paths blindly.",
9779
+ ...input.listConversion ? {
9780
+ expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again.",
9781
+ listSourcePath: input.listConversion.sourcePath ?? "auto-detected list in the CLI response preview"
9782
+ } : {}
9783
+ },
9762
9784
  render: {
9763
9785
  sections: input.listConversion ? [
9764
9786
  {
9765
9787
  title: "output",
9766
9788
  lines: [
9767
9789
  `${input.listConversion.rows.length} row(s) extracted from ${input.listConversion.sourcePath ?? "auto-detected list"}`,
9790
+ "paths above are observed from this execute response; use run table rows to debug play getters",
9768
9791
  `columns: ${JSON.stringify(Object.keys(input.listConversion.rows[0] ?? {}))}`,
9769
9792
  `preview: ${JSON.stringify(input.listConversion.rows.slice(0, 5))}`
9770
9793
  ]
@@ -9807,16 +9830,13 @@ async function executeTool(args) {
9807
9830
  throw error;
9808
9831
  }
9809
9832
  const rawResponse = await client.executeTool(parsed.toolId, parsed.params);
9810
- if (parsed.fullOutput) {
9811
- printJson(rawResponse);
9812
- return 0;
9813
- }
9814
9833
  const listConversion = tryConvertToList(rawResponse, {
9815
9834
  listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
9816
9835
  });
9817
9836
  const summary = extractSummaryFields(rawResponse);
9818
9837
  const baseEnvelope = buildToolExecuteBaseEnvelope({
9819
9838
  toolId: parsed.toolId,
9839
+ params: parsed.params,
9820
9840
  rawResponse,
9821
9841
  listConversion,
9822
9842
  summary
@@ -193,8 +193,8 @@ function resolveConfig(options) {
193
193
  }
194
194
 
195
195
  // src/version.ts
196
- var SDK_VERSION = "0.1.35";
197
- var SDK_API_CONTRACT = "2026-05-v2-tool-result-contract";
196
+ var SDK_VERSION = "0.1.36";
197
+ var SDK_API_CONTRACT = "2026-05-v2-tool-response";
198
198
 
199
199
  // ../shared_libs/play-runtime/coordinator-headers.ts
200
200
  var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
@@ -505,7 +505,7 @@ function sleep(ms) {
505
505
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
506
506
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
507
507
  var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
508
- var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-execution-result";
508
+ var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
509
509
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
510
510
  function sleep2(ms) {
511
511
  return new Promise((resolve11) => setTimeout(resolve11, ms));
@@ -774,8 +774,8 @@ var DeeplineClient = class {
774
774
  /**
775
775
  * Execute a tool and return the standard execution envelope.
776
776
  *
777
- * The `toolExecutionResult.toolOutput.raw` field contains the raw tool output.
778
- * `toolExecutionResult.toolOutput.meta` contains tool/provider metadata.
777
+ * The `toolResponse.raw` field contains the raw tool response.
778
+ * `toolResponse.meta` contains tool/provider metadata.
779
779
  * Top-level fields such as `status`, `job_id`, and `billing` describe the
780
780
  * Deepline execution envelope.
781
781
  */
@@ -6574,6 +6574,7 @@ function buildRunNextCommands(status) {
6574
6574
  }
6575
6575
  const commands = {
6576
6576
  get: `deepline runs get ${runId} --json`,
6577
+ full: `deepline runs get ${runId} --full --json`,
6577
6578
  stop: `deepline runs stop ${runId} --reason "stale lock" --json`,
6578
6579
  logs: `deepline runs logs ${runId} --out run.log --json`
6579
6580
  };
@@ -7268,6 +7269,10 @@ function renderServerResultView(value) {
7268
7269
  );
7269
7270
  }
7270
7271
  const tables = Array.isArray(view.tables) ? view.tables : [];
7272
+ const topLevelOutputTable = view.topLevelOutputTable && typeof view.topLevelOutputTable === "object" && !Array.isArray(view.topLevelOutputTable) ? view.topLevelOutputTable : null;
7273
+ if (typeof topLevelOutputTable?.queryCommand === "string") {
7274
+ lines.push(` top-level outputs: ${topLevelOutputTable.queryCommand}`);
7275
+ }
7271
7276
  if (tables.length > 0) {
7272
7277
  lines.push(" tables:");
7273
7278
  for (const table of tables.slice(0, 6)) {
@@ -7284,6 +7289,21 @@ function renderServerResultView(value) {
7284
7289
  lines.push(
7285
7290
  ` ${String(table.tableNamespace ?? "table")}${lineLabel}: ${rowLabel}${details.join(" ")}`
7286
7291
  );
7292
+ if (typeof table.queryDatasetCommand === "string") {
7293
+ lines.push(` inspect rows: ${table.queryDatasetCommand}`);
7294
+ }
7295
+ if (table.debugHelp && typeof table.debugHelp === "object" && !Array.isArray(table.debugHelp)) {
7296
+ const debugHelp = table.debugHelp;
7297
+ const rawResultFields = Array.isArray(debugHelp.rawResultFields) ? debugHelp.rawResultFields.filter(
7298
+ (field) => typeof field === "string"
7299
+ ) : [];
7300
+ if (rawResultFields.length > 0) {
7301
+ lines.push(` tool-result columns: ${rawResultFields.join(", ")}`);
7302
+ }
7303
+ }
7304
+ if (typeof table.slowExportAsCsvCommand === "string") {
7305
+ lines.push(` export rows: ${table.slowExportAsCsvCommand}`);
7306
+ }
7287
7307
  }
7288
7308
  }
7289
7309
  return { lines: lines.length > 1 ? lines : [], actions: [] };
@@ -7309,7 +7329,8 @@ function writeStartedPlayRun(input) {
7309
7329
  ` get status: deepline runs get ${input.runId} --json`,
7310
7330
  ` logs: deepline runs logs ${input.runId} --json`,
7311
7331
  ` stop run: deepline runs stop ${input.runId} --reason "stale lock" --json`,
7312
- ` result JSON: deepline runs get ${input.runId} --json`
7332
+ ` result JSON: deepline runs get ${input.runId} --json`,
7333
+ ` full debug JSON: deepline runs get ${input.runId} --full --json`
7313
7334
  ];
7314
7335
  if (input.dashboardUrl) {
7315
7336
  lines.push(` play page: ${input.dashboardUrl}`);
@@ -8947,17 +8968,13 @@ function normalizeRows(value) {
8947
8968
  }
8948
8969
  function candidateRoots(payload) {
8949
8970
  const roots = [{ path: null, value: payload }];
8950
- if (isPlainObject(payload) && isPlainObject(payload.toolExecutionResult)) {
8951
- roots.push({ path: "toolExecutionResult", value: payload.toolExecutionResult });
8952
- const toolOutput = payload.toolExecutionResult.toolOutput;
8953
- if (isPlainObject(toolOutput)) {
8954
- roots.push({ path: "toolExecutionResult.toolOutput", value: toolOutput });
8955
- if (Object.prototype.hasOwnProperty.call(toolOutput, "raw")) {
8956
- roots.push({
8957
- path: "toolExecutionResult.toolOutput.raw",
8958
- value: toolOutput.raw
8959
- });
8960
- }
8971
+ if (isPlainObject(payload) && isPlainObject(payload.toolResponse)) {
8972
+ roots.push({ path: "toolResponse", value: payload.toolResponse });
8973
+ if (Object.prototype.hasOwnProperty.call(payload.toolResponse, "raw")) {
8974
+ roots.push({
8975
+ path: "toolResponse.raw",
8976
+ value: payload.toolResponse.raw
8977
+ });
8961
8978
  }
8962
8979
  }
8963
8980
  if (isPlainObject(payload) && isPlainObject(payload.output)) {
@@ -9263,7 +9280,7 @@ Notes:
9263
9280
  waterfalls, row maps, checkpoints, and retries.
9264
9281
  execute is the canonical execution verb. run is a compatibility alias.
9265
9282
  Calling a provider-backed tool can spend Deepline credits. Use --json for the
9266
- stable result payload and --full-output when debugging response metadata.
9283
+ stable result payload plus output preview and debugging helpers.
9267
9284
 
9268
9285
  Examples:
9269
9286
  deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
@@ -9276,7 +9293,7 @@ Examples:
9276
9293
  }, []).option("--json [payload]", "Emit JSON output. Use `--input` or `--payload` for passing JSON params.").option("--input <payload>", "Merge a JSON object into the tool params").option("--payload <payload>", "Merge a JSON object into the tool params").option(
9277
9294
  "--output-format <format>",
9278
9295
  "Output format: auto, csv, csv_file, json, or json_file"
9279
- ).option("--full-output", "Emit the full JSON payload").option("--no-preview", "Only print the extracted output path when applicable").action(async (toolId, options) => {
9296
+ ).option("--no-preview", "Only print the extracted output path when applicable").action(async (toolId, options) => {
9280
9297
  const args = [
9281
9298
  toolId,
9282
9299
  ...options.param.flatMap((value) => ["--param", value]),
@@ -9285,7 +9302,6 @@ Examples:
9285
9302
  ...options.input ? ["--input", options.input] : [],
9286
9303
  ...options.payload ? ["--payload", options.payload] : [],
9287
9304
  ...options.outputFormat ? ["--output-format", options.outputFormat] : [],
9288
- ...options.fullOutput ? ["--full-output"] : [],
9289
9305
  ...options.preview === false ? ["--no-preview"] : []
9290
9306
  ];
9291
9307
  process.exitCode = await executeTool(args);
@@ -9310,13 +9326,29 @@ async function getTool(args) {
9310
9326
  throw error;
9311
9327
  }
9312
9328
  if (argsWantJson(args)) {
9313
- process.stdout.write(`${JSON.stringify(tool)}
9329
+ process.stdout.write(`${JSON.stringify(toolMetadataJsonForDescribe(tool, toolId))}
9314
9330
  `);
9315
9331
  return 0;
9316
9332
  }
9317
9333
  printToolDetails(tool, toolId);
9318
9334
  return 0;
9319
9335
  }
9336
+ function toolMetadataJsonForDescribe(tool, requestedToolId) {
9337
+ const toolId = String(tool.toolId || requestedToolId);
9338
+ return {
9339
+ ...tool,
9340
+ toolId,
9341
+ provider: tool.provider,
9342
+ displayName: tool.displayName,
9343
+ runtimeOutputHelp: {
9344
+ contract: "tools describe shows the declared schema and semantic getters; it is not an observed provider response.",
9345
+ observeActualShape: `deepline tools execute ${toolId} --input '{...}' --json`,
9346
+ observedOutput: `deepline tools execute ${toolId} --input '{...}' --json`,
9347
+ forPlayGetterBugs: "Run the play, then inspect the emitted table commands from runs get. Use deepline db query against the run tables before editing getters.",
9348
+ executeOutputFields: "tools execute JSON may include output_preview for this direct probe only; play debugging uses run tables."
9349
+ }
9350
+ };
9351
+ }
9320
9352
  function printToolDetails(tool, requestedToolId) {
9321
9353
  const toolId = String(tool.toolId || requestedToolId);
9322
9354
  const operation = typeof tool.operation === "string" ? tool.operation : "";
@@ -9337,6 +9369,10 @@ function printToolDetails(tool, requestedToolId) {
9337
9369
  const samples = recordField(tool, "samples");
9338
9370
  const usageGuidance = recordField(tool, "usageGuidance", "usage_guidance");
9339
9371
  console.log(`Tool: ${toolId}`);
9372
+ console.log(" Runtime output help:");
9373
+ console.log(" describe shows declared schema/getters, not an observed provider response");
9374
+ console.log(` observe actual shape: deepline tools execute ${toolId} --input '{...}' --json`);
9375
+ console.log(" for play getter bugs: run the play, then use the db query commands printed by runs get");
9340
9376
  if (displayName) {
9341
9377
  console.log(" Display name:");
9342
9378
  console.log(` ${displayName}`);
@@ -9433,32 +9469,18 @@ function printUsageGuidance(usageGuidance) {
9433
9469
  if (Object.keys(usageGuidance).length === 0) return;
9434
9470
  const execute = stringField(usageGuidance, "execute");
9435
9471
  const toolExecutionResult = recordField(usageGuidance, "toolExecutionResult", "tool_execution_result");
9436
- const toolOutput = recordField(toolExecutionResult, "toolOutput", "tool_output");
9437
- const extractedLists = extractionEntries(toolExecutionResult, "extractedLists", "extracted_lists");
9438
- const extractedValues = extractionEntries(toolExecutionResult, "extractedValues", "extracted_values");
9472
+ const toolResponse = recordField(toolExecutionResult, "toolResponse", "tool_response");
9473
+ const extractedLists = arrayField(toolExecutionResult, "extractedLists", "extracted_lists");
9474
+ const extractedValues = arrayField(toolExecutionResult, "extractedValues", "extracted_values");
9439
9475
  console.log(" Usage guidance:");
9440
9476
  if (execute) console.log(` ${execute}`);
9441
- const raw = pathField(toolOutput, "raw");
9442
- const meta = pathField(toolOutput, "meta");
9443
- if (raw) console.log(` Raw tool output: ${raw}`);
9444
- if (meta) console.log(` Tool output metadata: ${meta}`);
9477
+ const raw = stringField(toolResponse, "raw");
9478
+ const meta = stringField(toolResponse, "meta");
9479
+ if (raw) console.log(` Raw tool response: ${raw}`);
9480
+ if (meta) console.log(` Tool response metadata: ${meta}`);
9445
9481
  printExtractions("Extracted lists", extractedLists);
9446
9482
  printExtractions("Extracted values", extractedValues);
9447
9483
  }
9448
- function pathField(record, key) {
9449
- const value = record[key];
9450
- if (typeof value === "string") return value.trim();
9451
- if (isRecord3(value)) return stringField(value, "path");
9452
- return "";
9453
- }
9454
- function extractionEntries(record, camelKey, snakeKey) {
9455
- const value = record[camelKey] ?? record[snakeKey];
9456
- if (Array.isArray(value)) return value;
9457
- if (!isRecord3(value)) return [];
9458
- return Object.entries(value).map(
9459
- ([name, entry]) => isRecord3(entry) ? { name, ...entry } : { name }
9460
- );
9461
- }
9462
9484
  function printExtractions(label, entries) {
9463
9485
  if (!entries.length) return;
9464
9486
  console.log(` ${label}:`);
@@ -9548,7 +9570,7 @@ function listExtractorPathsFromUsageGuidance(tool) {
9548
9570
  const paths = entry.details?.candidatePaths ?? entry.details?.rawToolOutputPaths;
9549
9571
  if (!Array.isArray(paths)) return [];
9550
9572
  return paths.map(
9551
- (path) => path.trim().replace(/^toolExecutionResult\.toolOutput\.raw\.?/, "").replace(/^\./, "")
9573
+ (path) => path.trim().replace(/^toolExecutionResult\.toolResponse\.raw\.?/, "").replace(/^toolExecutionResult\.toolOutput\.raw\.?/, "").replace(/^\./, "")
9552
9574
  ).filter(Boolean);
9553
9575
  });
9554
9576
  }
@@ -9620,12 +9642,11 @@ function normalizeOutputFormat(raw) {
9620
9642
  function parseExecuteOptions(args) {
9621
9643
  const toolId = args[0];
9622
9644
  if (!toolId) {
9623
- throw new Error(`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--output-format auto|csv|csv_file|json|json_file] [--full-output] [--no-preview]`);
9645
+ throw new Error(`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--output-format auto|csv|csv_file|json|json_file] [--no-preview]`);
9624
9646
  }
9625
9647
  const params = {};
9626
9648
  let outputFormat = "auto";
9627
9649
  let noPreview = false;
9628
- let fullOutput = false;
9629
9650
  for (let index = 1; index < args.length; index += 1) {
9630
9651
  const arg = args[index];
9631
9652
  if ((arg === "--param" || arg === "-p") && args[index + 1]) {
@@ -9650,18 +9671,13 @@ function parseExecuteOptions(args) {
9650
9671
  outputFormat = normalizeOutputFormat(args[++index]);
9651
9672
  continue;
9652
9673
  }
9653
- if (arg === "--full-output") {
9654
- outputFormat = "json";
9655
- fullOutput = true;
9656
- continue;
9657
- }
9658
9674
  if (arg === "--no-preview") {
9659
9675
  noPreview = true;
9660
9676
  continue;
9661
9677
  }
9662
9678
  throw new Error(`Unknown option: ${arg}`);
9663
9679
  }
9664
- return { toolId, params, outputFormat, noPreview, fullOutput };
9680
+ return { toolId, params, outputFormat, noPreview };
9665
9681
  }
9666
9682
  function safeFileStem(value) {
9667
9683
  return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
@@ -9732,7 +9748,8 @@ function buildToolExecuteBaseEnvelope(input) {
9732
9748
  kind: summaryEntries.length > 0 ? "object" : "raw",
9733
9749
  summary: input.summary
9734
9750
  };
9735
- const envelopeHasCanonicalOutput = isRecord3(envelope.toolExecutionResult) && isRecord3(envelope.toolExecutionResult.toolOutput) && Object.prototype.hasOwnProperty.call(envelope.toolExecutionResult.toolOutput, "raw");
9751
+ const envelopeHasCanonicalOutput = isRecord3(envelope.toolResponse) && Object.prototype.hasOwnProperty.call(envelope.toolResponse, "raw");
9752
+ const inspectCommand = `deepline tools execute ${input.toolId} --input ${shellQuote(JSON.stringify(input.params))} --json`;
9736
9753
  const actions = input.listConversion ? [
9737
9754
  {
9738
9755
  label: "next",
@@ -9743,15 +9760,21 @@ function buildToolExecuteBaseEnvelope(input) {
9743
9760
  ...envelope,
9744
9761
  ...envelopeHasCanonicalOutput ? { output_preview: outputPreview } : { output: outputPreview },
9745
9762
  ...summaryEntries.length > 0 ? { summary: input.summary } : {},
9746
- next: input.listConversion ? {
9747
- expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
9748
- } : {},
9763
+ next: {
9764
+ inspect: inspectCommand,
9765
+ playDebugging: "When fixing a play getter, inspect the actual play run table with runs get / inspect rows; do not copy CLI preview paths blindly.",
9766
+ ...input.listConversion ? {
9767
+ expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again.",
9768
+ listSourcePath: input.listConversion.sourcePath ?? "auto-detected list in the CLI response preview"
9769
+ } : {}
9770
+ },
9749
9771
  render: {
9750
9772
  sections: input.listConversion ? [
9751
9773
  {
9752
9774
  title: "output",
9753
9775
  lines: [
9754
9776
  `${input.listConversion.rows.length} row(s) extracted from ${input.listConversion.sourcePath ?? "auto-detected list"}`,
9777
+ "paths above are observed from this execute response; use run table rows to debug play getters",
9755
9778
  `columns: ${JSON.stringify(Object.keys(input.listConversion.rows[0] ?? {}))}`,
9756
9779
  `preview: ${JSON.stringify(input.listConversion.rows.slice(0, 5))}`
9757
9780
  ]
@@ -9794,16 +9817,13 @@ async function executeTool(args) {
9794
9817
  throw error;
9795
9818
  }
9796
9819
  const rawResponse = await client.executeTool(parsed.toolId, parsed.params);
9797
- if (parsed.fullOutput) {
9798
- printJson(rawResponse);
9799
- return 0;
9800
- }
9801
9820
  const listConversion = tryConvertToList(rawResponse, {
9802
9821
  listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
9803
9822
  });
9804
9823
  const summary = extractSummaryFields(rawResponse);
9805
9824
  const baseEnvelope = buildToolExecuteBaseEnvelope({
9806
9825
  toolId: parsed.toolId,
9826
+ params: parsed.params,
9807
9827
  rawResponse,
9808
9828
  listConversion,
9809
9829
  summary