deepline 0.1.155 → 0.1.157

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
@@ -657,10 +657,10 @@ var SDK_RELEASE = {
657
657
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
658
658
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
659
659
  // fields shipped in 0.1.153.
660
- version: "0.1.155",
660
+ version: "0.1.157",
661
661
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
662
662
  supportPolicy: {
663
- latest: "0.1.155",
663
+ latest: "0.1.157",
664
664
  minimumSupported: "0.1.53",
665
665
  deprecatedBelow: "0.1.53",
666
666
  commandMinimumSupported: [
@@ -9365,7 +9365,7 @@ async function traceCliSpan(phase, fields, run) {
9365
9365
  var EXTRACTED_GETTER_ERROR_HINT = "Deepline hint: extractedValues/extractedLists .get() only works for declared Deepline getters listed by `deepline tools describe <tool> --json`. Use `toolExecutionResult.toolResponse.raw` for provider/tool-specific fields.";
9366
9366
  var DATASET_API_HINT = "Deepline hint: PlayDataset is lazy and durable. Use `.peek(n)` for a small preview or `.materialize()` when you intentionally need rows in memory; do not use `.rows`, `.toArray()`, or array methods directly on the dataset handle.";
9367
9367
  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.";
9368
- 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 replay-safe receipts.";
9368
+ 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 receipt attachment; provider-call reuse is based on play, tool, semantic input, auth scope, provider action version, and cache policy.";
9369
9369
  var RUN_PLAY_SIGNATURE_HINT = "Deepline hint: ctx.runPlay uses a stable key plus a composable child play reference. Direct-run-only or map-backed batch plays must be run directly, exported, then consumed by a separate play.";
9370
9370
  var MAP_BACKED_CHILD_HINT = "Deepline hint: map-backed child plays own durable table state and cannot be called from another play. Run that play directly, export its dataset, then pass the CSV to the next play.";
9371
9371
  function sourceLineForError(sourceCode, error) {
@@ -12840,7 +12840,7 @@ function writeStartedPlayRun(input2) {
12840
12840
  );
12841
12841
  }
12842
12842
  function parsePlayRunOptions(args) {
12843
- const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--profile <id>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--profile <id>] [--live|--latest|--revision-id <id>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--full] [--<input> value]\n --profile defaults to workers_edge; pass hatchet explicitly for Hatchet runtime comparison.\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.dataset guidance.";
12843
+ const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--profile <id>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--full] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--profile <id>] [--live|--latest|--revision-id <id>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--full] [--<input> value]\n --profile defaults to workers_edge; pass hatchet explicitly for Hatchet runtime comparison.\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotent call caching and ctx.dataset guidance.";
12844
12844
  let filePath = null;
12845
12845
  let playName = null;
12846
12846
  let input2 = null;
@@ -14696,10 +14696,15 @@ Notes:
14696
14696
  This command starts cloud work and may spend Deepline credits through tool calls.
14697
14697
 
14698
14698
  Idempotent execution:
14699
- Stable tool call ids are the reuse key:
14699
+ Durable tool-call reuse is based on the actual external call identity:
14700
+ same play, tool, semantic input, auth scope, provider action version, and
14701
+ cache policy.
14700
14702
 
14701
14703
  await ctx.tools.execute({ id: 'company_lookup', tool, input });
14702
14704
 
14705
+ The authored id is still required for readable logs, metadata, and receipt
14706
+ attachment, but renaming it alone does not rebuy the same provider request.
14707
+
14703
14708
  For rows, use ctx.dataset plus a stable row key:
14704
14709
 
14705
14710
  const rows = await ctx
@@ -14711,8 +14716,7 @@ Idempotent execution:
14711
14716
  }))
14712
14717
  .run({ key: 'domain' });
14713
14718
 
14714
- Reuse needs the same play, call id, semantic input, auth scope, and cache
14715
- policy. Dataset cells are storage; put freshness on the actual call:
14719
+ Dataset cells are storage; put freshness on the actual call:
14716
14720
 
14717
14721
  await ctx.tools.execute({
14718
14722
  id: 'find_cto',
@@ -17633,7 +17637,7 @@ async function buildEnrichFailureReport(input2) {
17633
17637
  rows: input2.rows,
17634
17638
  rowRange: input2.rowRange,
17635
17639
  client: input2.client,
17636
- outputPath: input2.exportResult?.path ?? input2.outputPath ?? null,
17640
+ outputPath: input2.reportOutputPath ?? input2.exportResult?.path ?? input2.outputPath ?? null,
17637
17641
  status: input2.status
17638
17642
  });
17639
17643
  }
@@ -18922,7 +18926,7 @@ function registerEnrichCommand(program) {
18922
18926
  return;
18923
18927
  }
18924
18928
  const rows = parseRows(options.rows, options.all);
18925
- const outputPath = options.inPlace ? inputCsv : options.output;
18929
+ let outputPath = options.inPlace ? inputCsv : options.output;
18926
18930
  const sourceCsvPath = !options.inPlace && outputPath && await regularFileExists(outputPath) ? outputPath : inputCsv;
18927
18931
  const forceAliases = resolveForceAliases(config, options);
18928
18932
  for (const alias of collectFailedInputAliases(
@@ -18940,8 +18944,39 @@ function registerEnrichCommand(program) {
18940
18944
  });
18941
18945
  const tempDir = await (0, import_promises3.mkdtemp)((0, import_node_path12.join)((0, import_node_os8.tmpdir)(), "deepline-enrich-play-"));
18942
18946
  const tempPlay = (0, import_node_path12.join)(tempDir, "deepline-enrich.play.ts");
18947
+ let inPlaceTempDir = null;
18948
+ let inPlaceTempOutputPath = null;
18949
+ const inPlaceFinalOutputPath = options.inPlace ? (0, import_node_path12.resolve)(inputCsv) : null;
18950
+ const inPlaceCommitOutputPath = options.inPlace ? (await (0, import_promises3.lstat)(inputCsv)).isSymbolicLink() ? await (0, import_promises3.realpath)(inputCsv) : inPlaceFinalOutputPath : null;
18951
+ const failureReportOutputPath = options.inPlace ? inPlaceFinalOutputPath : null;
18952
+ let inPlaceCommitted = false;
18953
+ const commitInPlaceOutput = async (exportResult) => {
18954
+ if (!inPlaceTempOutputPath || !inPlaceCommitOutputPath || !inPlaceFinalOutputPath) {
18955
+ return exportResult;
18956
+ }
18957
+ await (0, import_promises3.rename)(inPlaceTempOutputPath, inPlaceCommitOutputPath);
18958
+ inPlaceCommitted = true;
18959
+ if (!exportResult) {
18960
+ return null;
18961
+ }
18962
+ return {
18963
+ ...exportResult,
18964
+ path: inPlaceFinalOutputPath
18965
+ };
18966
+ };
18943
18967
  try {
18944
18968
  await (0, import_promises3.writeFile)(tempPlay, playSource, "utf8");
18969
+ if (options.inPlace) {
18970
+ inPlaceTempDir = await (0, import_promises3.mkdtemp)(
18971
+ (0, import_node_path12.join)(
18972
+ (0, import_node_path12.dirname)(inPlaceCommitOutputPath ?? (0, import_node_path12.resolve)(inputCsv)),
18973
+ ".deepline-enrich-in-place-"
18974
+ )
18975
+ );
18976
+ inPlaceTempOutputPath = (0, import_node_path12.join)(inPlaceTempDir, "output.csv");
18977
+ await (0, import_promises3.copyFile)((0, import_node_path12.resolve)(inputCsv), inPlaceTempOutputPath);
18978
+ outputPath = inPlaceTempOutputPath;
18979
+ }
18945
18980
  const runOne = async (input2) => {
18946
18981
  const runtimeInput = {
18947
18982
  file: (0, import_node_path12.resolve)(input2.sourceCsvPath),
@@ -19038,10 +19073,10 @@ function registerEnrichCommand(program) {
19038
19073
  rows: chunkRows
19039
19074
  },
19040
19075
  result: chunk.status,
19041
- output: enrichOutputJson(chunk.exportResult)
19076
+ output: options.inPlace ? null : enrichOutputJson(chunk.exportResult)
19042
19077
  });
19043
19078
  } else {
19044
- if (chunk.exportResult) {
19079
+ if (chunk.exportResult && !options.inPlace) {
19045
19080
  process.stderr.write(
19046
19081
  `Wrote ${chunk.exportResult.rows} row(s) to ${chunk.exportResult.path}${chunk.exportResult.partial ? " (partial run output)" : ""}
19047
19082
  `
@@ -19073,15 +19108,18 @@ function registerEnrichCommand(program) {
19073
19108
  rowEnd: selectedRange.end
19074
19109
  },
19075
19110
  client: client2,
19076
- outputPath,
19111
+ outputPath: failureReportOutputPath ?? finalExportResult?.path ?? outputPath,
19077
19112
  status: lastStatus
19078
19113
  });
19114
+ if (!failureReport2) {
19115
+ finalExportResult = await commitInPlaceOutput(finalExportResult);
19116
+ }
19079
19117
  if (options.json) {
19080
19118
  const run = rewriteEnrichJsonStatus({
19081
19119
  status: lastStatus,
19082
19120
  config,
19083
19121
  forceAliases,
19084
- output: finalExportResult ? {
19122
+ output: finalExportResult && (!failureReport2 || !options.inPlace) ? {
19085
19123
  ...finalExportResult,
19086
19124
  sourceCsvRows: selectedRange.sourceRows,
19087
19125
  selectedRows: selectedRange.count,
@@ -19099,7 +19137,7 @@ function registerEnrichCommand(program) {
19099
19137
  chunkRows: ENRICH_AUTO_BATCH_ROWS,
19100
19138
  selectedRows: selectedRange.count
19101
19139
  },
19102
- output: finalExportResult ? {
19140
+ output: finalExportResult && (!failureReport2 || !options.inPlace) ? {
19103
19141
  sourceCsvRows: selectedRange.sourceRows,
19104
19142
  selectedRows: selectedRange.count,
19105
19143
  enrichedRows: totalEnrichedRows,
@@ -19126,7 +19164,7 @@ function registerEnrichCommand(program) {
19126
19164
  });
19127
19165
  const rowsForFailureReport = exportResult?.enrichedDataRows ?? extractCanonicalRowsInfo(status)?.rows ?? [];
19128
19166
  if (captured.result !== 0) {
19129
- if (exportResult) {
19167
+ if (exportResult && !options.inPlace) {
19130
19168
  process.stderr.write(
19131
19169
  `Wrote ${exportResult.rows} row(s) to ${exportResult.path}${exportResult.partial ? " (partial run output)" : ""}
19132
19170
  `
@@ -19139,13 +19177,14 @@ function registerEnrichCommand(program) {
19139
19177
  client: client2,
19140
19178
  exportResult,
19141
19179
  outputPath,
19180
+ reportOutputPath: failureReportOutputPath,
19142
19181
  status
19143
19182
  });
19144
19183
  if (options.json) {
19145
19184
  printJson({
19146
19185
  ok: false,
19147
19186
  run: status,
19148
- output: enrichOutputJson(exportResult),
19187
+ output: options.inPlace ? null : enrichOutputJson(exportResult),
19149
19188
  ...failureReport2 ? {
19150
19189
  failure_report: {
19151
19190
  path: failureReport2.path,
@@ -19165,19 +19204,21 @@ function registerEnrichCommand(program) {
19165
19204
  client: client2,
19166
19205
  exportResult,
19167
19206
  outputPath,
19207
+ reportOutputPath: failureReportOutputPath,
19168
19208
  status
19169
19209
  });
19210
+ const committedExportResult2 = failureReport2 ? exportResult : await commitInPlaceOutput(exportResult);
19170
19211
  const run = rewriteEnrichJsonStatus({
19171
19212
  status,
19172
19213
  config,
19173
19214
  forceAliases,
19174
- output: exportResult,
19215
+ output: failureReport2 && options.inPlace ? null : committedExportResult2,
19175
19216
  failureReport: failureReport2
19176
19217
  });
19177
19218
  printJson({
19178
19219
  ok: !failureReport2,
19179
19220
  run,
19180
- output: enrichOutputJson(exportResult),
19221
+ output: failureReport2 && options.inPlace ? null : enrichOutputJson(committedExportResult2),
19181
19222
  ...failureReport2 ? {
19182
19223
  failure_report: {
19183
19224
  path: failureReport2.path,
@@ -19190,32 +19231,38 @@ function registerEnrichCommand(program) {
19190
19231
  }
19191
19232
  return;
19192
19233
  }
19193
- if (exportResult) {
19234
+ const failureReport = await maybeEmitEnrichFailureReport({
19235
+ config,
19236
+ rows: rowsForFailureReport,
19237
+ rowRange: rows,
19238
+ client: client2,
19239
+ outputPath: failureReportOutputPath ?? exportResult?.path ?? null,
19240
+ status
19241
+ });
19242
+ const committedExportResult = failureReport ? options.inPlace ? null : exportResult : await commitInPlaceOutput(exportResult);
19243
+ if (committedExportResult) {
19194
19244
  process.stderr.write(
19195
- `Wrote ${exportResult.rows} row(s) to ${exportResult.path}
19245
+ `Wrote ${committedExportResult.rows} row(s) to ${committedExportResult.path}
19196
19246
  `
19197
19247
  );
19198
19248
  const waterfallSummaryLines = buildEnrichWaterfallSummaryLines(
19199
19249
  config,
19200
- exportResult.enrichedDataRows
19250
+ committedExportResult.enrichedDataRows
19201
19251
  );
19202
19252
  if (waterfallSummaryLines.length > 0) {
19203
19253
  process.stdout.write(`${waterfallSummaryLines.join("\n")}
19204
19254
  `);
19205
19255
  }
19206
19256
  }
19207
- const failureReport = await maybeEmitEnrichFailureReport({
19208
- config,
19209
- rows: rowsForFailureReport,
19210
- rowRange: rows,
19211
- client: client2,
19212
- outputPath: exportResult?.path ?? outputPath ?? null,
19213
- status
19214
- });
19215
19257
  if (failureReport) {
19216
19258
  process.exitCode = EXIT_SERVER2;
19217
19259
  }
19218
19260
  } finally {
19261
+ if (inPlaceTempDir) {
19262
+ await (0, import_promises3.rm)(inPlaceTempDir, { recursive: true, force: true });
19263
+ } else if (inPlaceTempOutputPath && !inPlaceCommitted) {
19264
+ await (0, import_promises3.rm)(inPlaceTempOutputPath, { force: true });
19265
+ }
19219
19266
  await (0, import_promises3.rm)(tempDir, { recursive: true, force: true });
19220
19267
  }
19221
19268
  });