deepline 0.1.149 → 0.1.150

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
@@ -655,10 +655,10 @@ var SDK_RELEASE = {
655
655
  // the SDK enrich generator's one-second stale policy.
656
656
  // 0.1.110 ships authored V2 prebuilts and required top-level play descriptions.
657
657
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
658
- version: "0.1.149",
658
+ version: "0.1.150",
659
659
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
660
660
  supportPolicy: {
661
- latest: "0.1.149",
661
+ latest: "0.1.150",
662
662
  minimumSupported: "0.1.53",
663
663
  deprecatedBelow: "0.1.53",
664
664
  commandMinimumSupported: [
@@ -2122,6 +2122,7 @@ async function* observeRunEvents(options) {
2122
2122
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
2123
2123
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
2124
2124
  var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
2125
+ var EXECUTE_RESPONSE_INTENT_HEADER = "x-deepline-execute-response-intent";
2125
2126
  var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
2126
2127
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
2127
2128
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
@@ -2606,7 +2607,8 @@ var DeeplineClient = class {
2606
2607
  async executeTool(toolId, input2, options) {
2607
2608
  const headers = {
2608
2609
  [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
2609
- ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {}
2610
+ ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
2611
+ ...options?.responseIntent ? { [EXECUTE_RESPONSE_INTENT_HEADER]: options.responseIntent } : {}
2610
2612
  };
2611
2613
  return this.http.post(
2612
2614
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
@@ -20554,6 +20556,19 @@ function normalizeRows(value) {
20554
20556
  return { value: entry };
20555
20557
  });
20556
20558
  }
20559
+ function columnsForRows(rows) {
20560
+ const seen = /* @__PURE__ */ new Set();
20561
+ const columns = [];
20562
+ for (const row of rows) {
20563
+ for (const key of Object.keys(row)) {
20564
+ if (!seen.has(key)) {
20565
+ seen.add(key);
20566
+ columns.push(key);
20567
+ }
20568
+ }
20569
+ }
20570
+ return columns;
20571
+ }
20557
20572
  function candidateRoots(payload) {
20558
20573
  const roots = [
20559
20574
  { path: null, value: payload }
@@ -20636,6 +20651,16 @@ function tryConvertToList(payload, options) {
20636
20651
  }
20637
20652
  return null;
20638
20653
  }
20654
+ function projectRowOutput(conversion) {
20655
+ return {
20656
+ rows: conversion.rows,
20657
+ rowCount: conversion.rows.length,
20658
+ columns: columnsForRows(conversion.rows),
20659
+ previewRows: conversion.rows.slice(0, 5),
20660
+ strategy: conversion.strategy,
20661
+ sourcePath: conversion.sourcePath
20662
+ };
20663
+ }
20639
20664
  function ensureOutputDir() {
20640
20665
  const outputDir = (0, import_node_path14.join)((0, import_node_os10.homedir)(), ".local", "share", "deepline", "data");
20641
20666
  (0, import_node_fs12.mkdirSync)(outputDir, { recursive: true });
@@ -20650,16 +20675,7 @@ function writeJsonOutputFile(payload, stem) {
20650
20675
  function writeCsvOutputFile(rows, stem, options) {
20651
20676
  const outputPath = options?.outPath ? options.outPath : (0, import_node_path14.join)(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
20652
20677
  (0, import_node_fs12.mkdirSync)((0, import_node_path14.dirname)(outputPath), { recursive: true });
20653
- const seen = /* @__PURE__ */ new Set();
20654
- const columns = [];
20655
- for (const row of rows) {
20656
- for (const key of Object.keys(row)) {
20657
- if (!seen.has(key)) {
20658
- seen.add(key);
20659
- columns.push(key);
20660
- }
20661
- }
20662
- }
20678
+ const columns = columnsForRows(rows);
20663
20679
  const escapeCell = (value) => {
20664
20680
  const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
20665
20681
  if (/[",\n]/.test(normalized)) {
@@ -20667,13 +20683,20 @@ function writeCsvOutputFile(rows, stem, options) {
20667
20683
  }
20668
20684
  return normalized;
20669
20685
  };
20670
- const lines = [];
20671
- lines.push(columns.map(escapeCell).join(","));
20672
- for (const row of rows) {
20673
- lines.push(columns.map((column) => escapeCell(row[column])).join(","));
20686
+ const fd = (0, import_node_fs12.openSync)(outputPath, "w");
20687
+ try {
20688
+ (0, import_node_fs12.writeSync)(fd, `${columns.map(escapeCell).join(",")}
20689
+ `);
20690
+ for (const row of rows) {
20691
+ (0, import_node_fs12.writeSync)(
20692
+ fd,
20693
+ `${columns.map((column) => escapeCell(row[column])).join(",")}
20694
+ `
20695
+ );
20696
+ }
20697
+ } finally {
20698
+ (0, import_node_fs12.closeSync)(fd);
20674
20699
  }
20675
- (0, import_node_fs12.writeFileSync)(outputPath, `${lines.join("\n")}
20676
- `, "utf-8");
20677
20700
  const previewRows = rows.slice(0, 5);
20678
20701
  const previewColumns = columns.slice(0, 5);
20679
20702
  const preview = [
@@ -21200,10 +21223,7 @@ Examples:
21200
21223
  ).option(
21201
21224
  "--output-format <format>",
21202
21225
  "Output format: auto, csv, csv_file, json, or json_file"
21203
- ).option(
21204
- "-o, --out <path>",
21205
- "Write row-shaped tool output to this CSV path"
21206
- ).option(
21226
+ ).option("-o, --out <path>", "Write row-shaped tool output to this CSV path").option(
21207
21227
  "--no-preview",
21208
21228
  "Only print the extracted output path when applicable"
21209
21229
  ).action(async (toolId, options) => {
@@ -22057,6 +22077,100 @@ function buildToolExecuteBaseEnvelope(input2) {
22057
22077
  }
22058
22078
  };
22059
22079
  }
22080
+ function buildToolExecuteRowArtifactEnvelope(input2) {
22081
+ const {
22082
+ toolResponse: _toolResponse,
22083
+ result: _result,
22084
+ output: _output,
22085
+ output_preview: _outputPreview,
22086
+ render: _render,
22087
+ next: _next,
22088
+ local: _local,
22089
+ ...base
22090
+ } = input2.baseEnvelope;
22091
+ void _toolResponse;
22092
+ void _result;
22093
+ void _output;
22094
+ void _outputPreview;
22095
+ void _render;
22096
+ void _next;
22097
+ void _local;
22098
+ return {
22099
+ ...base,
22100
+ status: typeof base.status === "string" ? base.status : "completed",
22101
+ output_preview: {
22102
+ kind: "list",
22103
+ rowCount: input2.rowOutput.rowCount,
22104
+ columns: input2.rowOutput.columns,
22105
+ preview: input2.rowOutput.previewRows,
22106
+ listStrategy: input2.rowOutput.strategy,
22107
+ listSourcePath: input2.rowOutput.sourcePath
22108
+ },
22109
+ csv_path: input2.csv.path,
22110
+ row_count: input2.csv.rowCount,
22111
+ row_count_returned: input2.csv.rowCount,
22112
+ columns: input2.csv.columns,
22113
+ extracted_csv: input2.csv.path,
22114
+ extracted_csv_rows: input2.csv.rowCount,
22115
+ extracted_csv_columns: input2.csv.columns,
22116
+ preview: input2.csv.preview,
22117
+ list_strategy: input2.rowOutput.strategy,
22118
+ list_source_path: input2.rowOutput.sourcePath,
22119
+ summary: input2.summary,
22120
+ local: {
22121
+ extracted_csv: input2.csv.path,
22122
+ extracted_csv_rows: input2.csv.rowCount,
22123
+ extracted_csv_columns: input2.csv.columns,
22124
+ preview: input2.csv.preview,
22125
+ starter_script: input2.seededScript.path,
22126
+ project_dir: input2.seededScript.projectDir,
22127
+ copy_to_project: {
22128
+ macos_linux: input2.seededScript.macCopyCommand,
22129
+ windows_powershell: input2.seededScript.windowsCopyCommand
22130
+ }
22131
+ },
22132
+ starter_script: input2.seededScript.path,
22133
+ project_dir: input2.seededScript.projectDir,
22134
+ copy_to_project: {
22135
+ macos_linux: input2.seededScript.macCopyCommand,
22136
+ windows_powershell: input2.seededScript.windowsCopyCommand
22137
+ },
22138
+ next: {
22139
+ inspect: "Re-run with --json only when you need the raw provider/tool response.",
22140
+ listSourcePath: input2.rowOutput.sourcePath,
22141
+ expandToPlay: "Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
22142
+ },
22143
+ render: {
22144
+ sections: [
22145
+ {
22146
+ title: `${input2.csv.path} (${input2.csv.rowCount} rows)`,
22147
+ lines: [
22148
+ ...input2.csv.columns.length > 0 ? [`columns: ${JSON.stringify(input2.csv.columns)}`] : [],
22149
+ ...Object.keys(input2.summary).length > 0 ? [
22150
+ `summary: ${Object.entries(input2.summary).map(([key, value]) => `${key}=${String(value)}`).join(", ")}`
22151
+ ] : [],
22152
+ `preview: ${JSON.stringify(input2.rowOutput.previewRows)}`,
22153
+ `starter script: ${input2.seededScript.path}`
22154
+ ]
22155
+ }
22156
+ ],
22157
+ actions: [
22158
+ {
22159
+ label: "next",
22160
+ command: "Move the script into a project folder and expand it into a Deepline play. Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
22161
+ },
22162
+ {
22163
+ label: "macOS/Linux",
22164
+ command: input2.seededScript.macCopyCommand
22165
+ },
22166
+ {
22167
+ label: "Windows PowerShell",
22168
+ command: input2.seededScript.windowsCopyCommand
22169
+ }
22170
+ ]
22171
+ }
22172
+ };
22173
+ }
22060
22174
  async function executeTool(args) {
22061
22175
  let parsed;
22062
22176
  try {
@@ -22108,7 +22222,9 @@ async function executeTool(args) {
22108
22222
  }
22109
22223
  return 2;
22110
22224
  }
22111
- const rawResponse = await client2.executeTool(parsed.toolId, parsed.params);
22225
+ const rawResponse = await client2.executeTool(parsed.toolId, parsed.params, {
22226
+ responseIntent: parsed.outPath || parsed.outputFormat === "csv" || parsed.outputFormat === "csv_file" ? "row_artifact" : "raw"
22227
+ });
22112
22228
  const listConversion = tryConvertToList(rawResponse, {
22113
22229
  listExtractorPaths: listExtractorPathsFromUsageGuidance(metadata)
22114
22230
  });
@@ -22172,6 +22288,7 @@ async function executeTool(args) {
22172
22288
  printCommandEnvelope(baseEnvelope, { json: false });
22173
22289
  return 0;
22174
22290
  }
22291
+ const rowOutput = projectRowOutput(listConversion);
22175
22292
  const csv = writeCsvOutputFile(
22176
22293
  listConversion.rows,
22177
22294
  `${parsed.toolId}_output`,
@@ -22182,91 +22299,23 @@ async function executeTool(args) {
22182
22299
  payload: parsed.params,
22183
22300
  rows: listConversion.rows
22184
22301
  });
22185
- const materializedEnvelope = {
22186
- ...baseEnvelope,
22187
- local: {
22188
- extracted_csv: csv.path,
22189
- extracted_csv_rows: csv.rowCount,
22190
- extracted_csv_columns: csv.columns,
22191
- preview: csv.preview,
22192
- starter_script: seededScript.path,
22193
- project_dir: seededScript.projectDir,
22194
- copy_to_project: {
22195
- macos_linux: seededScript.macCopyCommand,
22196
- windows_powershell: seededScript.windowsCopyCommand
22197
- }
22198
- },
22199
- render: {
22200
- sections: [
22201
- {
22202
- title: `${csv.path} (${csv.rowCount} rows)`,
22203
- lines: [
22204
- ...csv.columns.length > 0 ? [`columns: ${JSON.stringify(csv.columns)}`] : [],
22205
- ...Object.keys(summary).length > 0 ? [
22206
- `summary: ${Object.entries(summary).map(([key, value]) => `${key}=${String(value)}`).join(", ")}`
22207
- ] : [],
22208
- `preview: ${JSON.stringify(csv.preview)}`,
22209
- `starter script: ${seededScript.path}`
22210
- ]
22211
- }
22212
- ],
22213
- actions: [
22214
- {
22215
- label: "next",
22216
- command: "Move the script into a project folder and expand it into a Deepline play. Use stable map and step keys so reruns are idempotent: completed rows are reused, and only missing or stale work runs again."
22217
- },
22218
- {
22219
- label: "macOS/Linux",
22220
- command: seededScript.macCopyCommand
22221
- },
22222
- {
22223
- label: "Windows PowerShell",
22224
- command: seededScript.windowsCopyCommand
22225
- }
22226
- ]
22227
- }
22228
- };
22302
+ const materializedEnvelope = buildToolExecuteRowArtifactEnvelope({
22303
+ baseEnvelope,
22304
+ csv,
22305
+ rowOutput,
22306
+ summary,
22307
+ seededScript
22308
+ });
22229
22309
  if (parsed.outputFormat === "csv_file") {
22230
- printCommandEnvelope(
22231
- {
22232
- ...materializedEnvelope,
22233
- extracted_csv: csv.path,
22234
- extracted_csv_rows: csv.rowCount,
22235
- extracted_csv_columns: csv.columns,
22236
- preview: csv.preview,
22237
- list_strategy: listConversion.strategy,
22238
- list_source_path: listConversion.sourcePath,
22239
- starter_script: seededScript.path,
22240
- project_dir: seededScript.projectDir,
22241
- copy_to_project: {
22242
- macos_linux: seededScript.macCopyCommand,
22243
- windows_powershell: seededScript.windowsCopyCommand
22244
- },
22245
- summary
22246
- },
22247
- { json: true }
22248
- );
22310
+ printCommandEnvelope(materializedEnvelope, { json: true });
22249
22311
  return 0;
22250
22312
  }
22251
22313
  if (parsed.outPath) {
22252
- printCommandEnvelope(
22253
- {
22254
- ...materializedEnvelope,
22255
- csv_path: csv.path,
22256
- row_count: csv.rowCount,
22257
- row_count_returned: csv.rowCount,
22258
- columns: csv.columns,
22259
- preview: csv.preview,
22260
- list_strategy: listConversion.strategy,
22261
- list_source_path: listConversion.sourcePath,
22262
- summary
22263
- },
22264
- {
22265
- json: argsWantJson(args) || shouldEmitJson(),
22266
- text: `Wrote ${csv.rowCount} row(s) to ${csv.path}
22314
+ printCommandEnvelope(materializedEnvelope, {
22315
+ json: argsWantJson(args) || shouldEmitJson(),
22316
+ text: `Wrote ${csv.rowCount} row(s) to ${csv.path}
22267
22317
  `
22268
- }
22269
- );
22318
+ });
22270
22319
  return 0;
22271
22320
  }
22272
22321
  if (parsed.noPreview) {