deepline 0.1.175 → 0.1.176

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.
@@ -607,10 +607,10 @@ var SDK_RELEASE = {
607
607
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
608
608
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
609
609
  // fields shipped in 0.1.153.
610
- version: "0.1.175",
610
+ version: "0.1.176",
611
611
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
612
612
  supportPolicy: {
613
- latest: "0.1.175",
613
+ latest: "0.1.176",
614
614
  minimumSupported: "0.1.53",
615
615
  deprecatedBelow: "0.1.53",
616
616
  commandMinimumSupported: [
@@ -871,9 +871,10 @@ var HttpClient = class {
871
871
  headers["Content-Type"] = "application/json";
872
872
  }
873
873
  let lastError = null;
874
- const candidateUrls = buildCandidateUrls(url);
874
+ const candidateUrls = options?.exactUrlOnly ? [url] : buildCandidateUrls(url);
875
875
  let retryAfterDelayMs = null;
876
- for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
876
+ const maxRetries = options?.maxRetries ?? this.config.maxRetries;
877
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
877
878
  if (attempt > 0) {
878
879
  const backoffMs = Math.min(1e3 * Math.pow(2, attempt - 1), 3e4);
879
880
  const delayMs = retryAfterDelayMs === null ? backoffMs : Math.max(backoffMs, retryAfterDelayMs);
@@ -900,7 +901,7 @@ var HttpClient = class {
900
901
  if (response.status === 429) {
901
902
  const retryAfter = parseRetryAfter(response);
902
903
  lastError = new RateLimitError(retryAfter);
903
- if (attempt < this.config.maxRetries) {
904
+ if (attempt < maxRetries) {
904
905
  retryAfterDelayMs = retryAfter;
905
906
  break;
906
907
  }
@@ -930,7 +931,7 @@ var HttpClient = class {
930
931
  ...htmlError.workerThrewException ? { workerThrewException: true } : {}
931
932
  }
932
933
  );
933
- if (retryableApiError && attempt < this.config.maxRetries) {
934
+ if (retryableApiError && attempt < maxRetries) {
934
935
  retryAfterDelayMs = parseOptionalRetryAfter(response);
935
936
  break;
936
937
  }
@@ -942,7 +943,7 @@ var HttpClient = class {
942
943
  lastError = new DeeplineError(msg, response.status, apiErrorCode, {
943
944
  response: parsed
944
945
  });
945
- if (retryableApiError && attempt < this.config.maxRetries) {
946
+ if (retryableApiError && attempt < maxRetries) {
946
947
  retryAfterDelayMs = parseOptionalRetryAfter(response);
947
948
  break;
948
949
  }
@@ -961,7 +962,7 @@ var HttpClient = class {
961
962
  lastError = error instanceof Error ? error : new Error(String(error));
962
963
  }
963
964
  }
964
- if (attempt < this.config.maxRetries) continue;
965
+ if (attempt < maxRetries) continue;
965
966
  }
966
967
  if (lastError instanceof DeeplineError) {
967
968
  throw lastError;
@@ -2096,6 +2097,7 @@ var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
2096
2097
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
2097
2098
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
2098
2099
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
2100
+ var DEEPLINEAGENT_EXECUTE_TIMEOUT_MS = 15 * 60 * 1e3;
2099
2101
  function normalizePlayRunIntegrationMode(value) {
2100
2102
  if (value === "live" || value === "eval_stub" || value === "fixture") {
2101
2103
  return value;
@@ -2170,6 +2172,10 @@ function chunkRegisterPlayArtifacts(artifacts) {
2170
2172
  }
2171
2173
  return chunks;
2172
2174
  }
2175
+ function resolveToolExecuteTimeoutMs(toolId) {
2176
+ const normalized = toolId.trim().toLowerCase();
2177
+ return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
2178
+ }
2173
2179
  var RUN_LOGS_PAGE_LIMIT = 1e3;
2174
2180
  function isRecord3(value) {
2175
2181
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
@@ -2609,7 +2615,12 @@ var DeeplineClient = class {
2609
2615
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
2610
2616
  { payload: input2 },
2611
2617
  headers,
2612
- { forbiddenAsApiError: true }
2618
+ {
2619
+ forbiddenAsApiError: true,
2620
+ timeout: options?.timeout ?? resolveToolExecuteTimeoutMs(toolId),
2621
+ maxRetries: options?.maxRetries ?? 0,
2622
+ exactUrlOnly: true
2623
+ }
2613
2624
  );
2614
2625
  }
2615
2626
  /**
@@ -4569,10 +4580,21 @@ function failureMessageFromRecord(value) {
4569
4580
  }
4570
4581
  return directError || resultError || `Column status: ${status}`;
4571
4582
  }
4572
- function flattenObjectColumns(row) {
4583
+ function shouldPreserveJsonStringColumn(columns, key) {
4584
+ if (!columns) {
4585
+ return false;
4586
+ }
4587
+ if (columns.has(key)) {
4588
+ return true;
4589
+ }
4590
+ const normalizedKey = key.toLowerCase().replace(/[^a-z0-9]/g, "");
4591
+ return normalizedKey ? columns.has(normalizedKey) : false;
4592
+ }
4593
+ function flattenObjectColumns(row, options = {}) {
4573
4594
  const flattened = {};
4574
4595
  for (const [key, rawValue] of Object.entries(row)) {
4575
4596
  const value = parseMaybeJsonObject(rawValue);
4597
+ const parsedFromString = typeof rawValue === "string" && value !== rawValue;
4576
4598
  if (key === "_metadata") {
4577
4599
  flattened[key] = value && typeof value === "object" ? JSON.stringify(value) : value;
4578
4600
  continue;
@@ -4583,6 +4605,10 @@ function flattenObjectColumns(row) {
4583
4605
  if (hasMatchedEnvelope) {
4584
4606
  flattened[key] = JSON.stringify(record);
4585
4607
  continue;
4608
+ }
4609
+ if (parsedFromString && shouldPreserveJsonStringColumn(options.preserveJsonStringColumns, key)) {
4610
+ flattened[key] = rawValue;
4611
+ continue;
4586
4612
  } else {
4587
4613
  const failureMessage = failureMessageFromRecord(record);
4588
4614
  if (failureMessage) {
@@ -4607,8 +4633,8 @@ function recordRows(value) {
4607
4633
  (row) => Boolean(row) && typeof row === "object" && !Array.isArray(row)
4608
4634
  );
4609
4635
  }
4610
- function dataExportRows(rows) {
4611
- return rows.map((row) => flattenObjectColumns(row));
4636
+ function dataExportRows(rows, options = {}) {
4637
+ return rows.map((row) => flattenObjectColumns(row, options));
4612
4638
  }
4613
4639
  function dataExportColumns(rows, preferredColumns = []) {
4614
4640
  const discoveredColumns = [
@@ -16910,7 +16936,8 @@ function helperSource() {
16910
16936
  // src/cli/commands/enrich.ts
16911
16937
  var ENRICH_EXPORT_PAGE_SIZE = 5e3;
16912
16938
  var ENRICH_AUTO_BATCH_ROWS = 250;
16913
- var ENRICH_HEAVY_PLAY_AUTO_BATCH_ROWS = 40;
16939
+ var ENRICH_HEAVY_PLAY_AUTO_BATCH_ROWS = 25;
16940
+ var ENRICH_NESTED_PROVIDER_AUTO_BATCH_ROWS = 50;
16914
16941
  var ENRICH_EXPORT_BACKING_ROWS_WAIT_MS = 6e4;
16915
16942
  var ENRICH_EXPORT_BACKING_ROWS_POLL_MS = 1e3;
16916
16943
  var ENRICH_SOURCE_ROW_INDEX_COLUMN = "__deeplineSourceRowIndex";
@@ -16925,6 +16952,12 @@ var HEAVY_ENRICH_AUTO_BATCH_PLAYS = /* @__PURE__ */ new Set([
16925
16952
  "company-to-contact-by-role-waterfall",
16926
16953
  "company_to_contact_by_role_waterfall"
16927
16954
  ]);
16955
+ var HEAVY_ENRICH_AUTO_BATCH_TOOLS = /* @__PURE__ */ new Set([
16956
+ "ai_inference",
16957
+ "aiinference",
16958
+ "deeplineagent"
16959
+ ]);
16960
+ var ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER = "__deeplineTestAiInference";
16928
16961
  var PLAN_SHAPING_OPTION_NAMES = [
16929
16962
  "with",
16930
16963
  "withWaterfall",
@@ -16942,6 +16975,15 @@ function normalizeAlias2(value) {
16942
16975
  function hasPlanShapingArgs(args) {
16943
16976
  return optionWasProvided(args, "--with") || optionWasProvided(args, "--with-waterfall") || optionWasProvided(args, "--min-results") || optionWasProvided(args, "--end-waterfall");
16944
16977
  }
16978
+ function isMarkedTestAiInferenceCommand(command) {
16979
+ if ("with_waterfall" in command) {
16980
+ return false;
16981
+ }
16982
+ if (normalizeEnrichPlayRef(command.tool) !== "run_javascript") {
16983
+ return false;
16984
+ }
16985
+ return isRecord7(command.payload) && command.payload[ENRICH_TEST_AI_INFERENCE_PAYLOAD_MARKER] === true;
16986
+ }
16945
16987
  function enrichDebugEnabled(env = process.env) {
16946
16988
  const raw = String(env.DEEPLINE_DEBUG_ENRICH ?? "").trim().toLowerCase();
16947
16989
  if (["1", "true", "yes", "on"].includes(raw)) {
@@ -17709,8 +17751,6 @@ function normalizeEnrichPlayRef(value) {
17709
17751
  return normalized || null;
17710
17752
  }
17711
17753
  function configContainsHeavyEnrichPlay(config) {
17712
- let hasNestedPlayStep = false;
17713
- let hasSubrequestProviderStep = false;
17714
17754
  const visit = (commands) => {
17715
17755
  for (const command of commands) {
17716
17756
  if ("with_waterfall" in command) {
@@ -17734,18 +17774,67 @@ function configContainsHeavyEnrichPlay(config) {
17734
17774
  return true;
17735
17775
  }
17736
17776
  const normalizedTool = normalizeEnrichPlayRef(command.tool);
17777
+ const normalizedOperation = normalizeEnrichPlayRef(command.operation);
17778
+ if (isMarkedTestAiInferenceCommand(command) || normalizedTool && HEAVY_ENRICH_AUTO_BATCH_TOOLS.has(normalizedTool) || normalizedOperation && HEAVY_ENRICH_AUTO_BATCH_TOOLS.has(normalizedOperation)) {
17779
+ return true;
17780
+ }
17781
+ }
17782
+ return false;
17783
+ };
17784
+ return visit(config.commands);
17785
+ }
17786
+ function configContainsNestedProviderEnrichWorkload(config) {
17787
+ let hasNestedPlayStep = false;
17788
+ let hasSubrequestProviderStep = false;
17789
+ const visit = (commands) => {
17790
+ for (const command of commands) {
17791
+ if ("with_waterfall" in command) {
17792
+ visit(command.commands);
17793
+ continue;
17794
+ }
17795
+ if (command.disabled) {
17796
+ continue;
17797
+ }
17798
+ const normalizedTool = normalizeEnrichPlayRef(command.tool);
17737
17799
  if (command.play || normalizedTool === "test-play") {
17738
17800
  hasNestedPlayStep = true;
17739
17801
  } else if (normalizedTool !== null && normalizedTool !== "run_javascript") {
17740
17802
  hasSubrequestProviderStep = true;
17741
17803
  }
17742
17804
  }
17743
- return false;
17744
17805
  };
17745
- return visit(config.commands) || hasNestedPlayStep && hasSubrequestProviderStep;
17806
+ visit(config.commands);
17807
+ return hasNestedPlayStep && hasSubrequestProviderStep;
17746
17808
  }
17747
17809
  function enrichAutoBatchRowsForConfig(config) {
17748
- return configContainsHeavyEnrichPlay(config) ? ENRICH_HEAVY_PLAY_AUTO_BATCH_ROWS : ENRICH_AUTO_BATCH_ROWS;
17810
+ if (configContainsHeavyEnrichPlay(config)) {
17811
+ return ENRICH_HEAVY_PLAY_AUTO_BATCH_ROWS;
17812
+ }
17813
+ if (configContainsNestedProviderEnrichWorkload(config)) {
17814
+ return ENRICH_NESTED_PROVIDER_AUTO_BATCH_ROWS;
17815
+ }
17816
+ return ENRICH_AUTO_BATCH_ROWS;
17817
+ }
17818
+ function enrichAiRuntimeCompactAliases(config) {
17819
+ const aliases = /* @__PURE__ */ new Set();
17820
+ const visit = (commands) => {
17821
+ for (const command of commands) {
17822
+ if ("with_waterfall" in command) {
17823
+ visit(command.commands);
17824
+ continue;
17825
+ }
17826
+ if (command.disabled) {
17827
+ continue;
17828
+ }
17829
+ const normalizedTool = normalizeEnrichPlayRef(command.tool);
17830
+ const normalizedOperation = normalizeEnrichPlayRef(command.operation);
17831
+ if (isMarkedTestAiInferenceCommand(command) || normalizedTool && HEAVY_ENRICH_AUTO_BATCH_TOOLS.has(normalizedTool) || normalizedOperation && HEAVY_ENRICH_AUTO_BATCH_TOOLS.has(normalizedOperation)) {
17832
+ aliases.add(normalizeAlias2(command.alias));
17833
+ }
17834
+ }
17835
+ };
17836
+ visit(config.commands);
17837
+ return aliases;
17749
17838
  }
17750
17839
  async function maybeWriteOutputCsv(input2) {
17751
17840
  if (!input2.outputPath) return null;
@@ -17841,6 +17930,52 @@ function selectedSourceCsvRange(sourceCsvPath, rows) {
17841
17930
  sourceRows
17842
17931
  };
17843
17932
  }
17933
+ function compactRuntimeCsvCell(value) {
17934
+ const parsed = parseMaybeJsonObject(value);
17935
+ const compacted = compactAiInferenceCellForCsv(parsed);
17936
+ return materializeCsvCellValue(compacted);
17937
+ }
17938
+ async function writeSlimBatchedRuntimeCsv(input2) {
17939
+ const cleanRows = readCsvRows(input2.cleanSourceCsvPath).map(
17940
+ (row) => ({ ...row })
17941
+ );
17942
+ const mergeRows = readCsvRows(input2.mergeSourceCsvPath);
17943
+ const preserveJsonStringColumns = /* @__PURE__ */ new Set([
17944
+ ...cleanRows.flatMap((row) => Object.keys(row)),
17945
+ ...mergeRows.flatMap((row) => Object.keys(row))
17946
+ ]);
17947
+ const selectedRange = selectedSourceCsvRange(
17948
+ input2.mergeSourceCsvPath,
17949
+ input2.rows
17950
+ );
17951
+ for (let rowIndex = selectedRange.start; rowIndex <= selectedRange.end; rowIndex += 1) {
17952
+ const mergeRow = mergeRows[rowIndex];
17953
+ if (!mergeRow) {
17954
+ continue;
17955
+ }
17956
+ const baseRow = cleanRows[rowIndex] ?? {};
17957
+ const compactOverlayCell = ([key, value]) => {
17958
+ return [
17959
+ key,
17960
+ input2.compactAliases.has(normalizeAlias2(key)) ? compactRuntimeCsvCell(value) : value
17961
+ ];
17962
+ };
17963
+ cleanRows[rowIndex] = {
17964
+ ...baseRow,
17965
+ ...Object.fromEntries(
17966
+ Object.entries(mergeRow).map(compactOverlayCell)
17967
+ )
17968
+ };
17969
+ }
17970
+ const columns = dataExportColumns(
17971
+ dataExportRows(cleanRows, { preserveJsonStringColumns })
17972
+ );
17973
+ await writeFile3(
17974
+ input2.outputPath,
17975
+ csvStringFromRows(cleanRows, columns),
17976
+ "utf8"
17977
+ );
17978
+ }
17844
17979
  function selectedSourceCsvRowCount(options) {
17845
17980
  if (!options?.sourceCsvPath) {
17846
17981
  return null;
@@ -18147,6 +18282,22 @@ function mergeExportedSheetRow(target, next) {
18147
18282
  target._metadata = metadata;
18148
18283
  }
18149
18284
  }
18285
+ function countEnrichedRowsInSourceRange(exportResult, rows) {
18286
+ const start = Math.max(0, rows.rowStart ?? 0);
18287
+ const end = rows.rowEnd === null || rows.rowEnd === void 0 ? Number.MAX_SAFE_INTEGER : Math.max(start, rows.rowEnd);
18288
+ const rowIndexes = /* @__PURE__ */ new Set();
18289
+ for (const row of exportResult.enrichedDataRows) {
18290
+ const rowIndex = sourceRowIndexFromEnrichRow(row, start, end);
18291
+ if (rowIndex !== null) {
18292
+ rowIndexes.add(rowIndex);
18293
+ }
18294
+ }
18295
+ if (rowIndexes.size > 0) {
18296
+ return rowIndexes.size;
18297
+ }
18298
+ const selectedRows = end === Number.MAX_SAFE_INTEGER ? exportResult.enrichedRows : end - start + 1;
18299
+ return Math.min(exportResult.enrichedRows, Math.max(0, selectedRows));
18300
+ }
18150
18301
  function coalesceExportableSheetRows(rows, sourceRowStart = 0) {
18151
18302
  const mergedRows = [];
18152
18303
  const bySourceRowIndex = /* @__PURE__ */ new Map();
@@ -18778,10 +18929,12 @@ async function fetchBackingRowsForCsvExport(input2) {
18778
18929
  };
18779
18930
  }
18780
18931
  function mergeRowsForCsvExport(enrichedRows, options) {
18932
+ const compactAliases = options?.config ? enrichAiRuntimeCompactAliases(options.config) : /* @__PURE__ */ new Set();
18781
18933
  const rows = dataExportRows(
18782
18934
  normalizeEnrichRowsForCsvExport(enrichedRows, options?.config, {
18783
18935
  statusFailureMessages: options?.statusFailureMessages
18784
- })
18936
+ }),
18937
+ { preserveJsonStringColumns: compactAliases }
18785
18938
  );
18786
18939
  const range = options?.rows;
18787
18940
  if (!options?.sourceCsvPath) {
@@ -18801,16 +18954,16 @@ function mergeRowsForCsvExport(enrichedRows, options) {
18801
18954
  const maxEnd = Math.max(start, baseRows.length - 1);
18802
18955
  const inclusiveEnd = range?.rowEnd === null || range?.rowEnd === void 0 ? maxEnd : Math.min(maxEnd, range.rowEnd);
18803
18956
  const expectedSelectedRows = baseRows.length === 0 ? 0 : Math.max(0, inclusiveEnd - start + 1);
18804
- const canMergeSparseBySourceIndex = rows.length > 0 && rows.every(
18957
+ const hasRowsInSelectedRange = rows.some(
18805
18958
  (row) => sourceRowIndexFromEnrichRow(row, start, inclusiveEnd) !== null
18806
18959
  );
18807
- if (options.inPlace && rows.length < expectedSelectedRows && !options.allowPartial && !canMergeSparseBySourceIndex) {
18960
+ if (options.inPlace && rows.length < expectedSelectedRows && !options.allowPartial && !hasRowsInSelectedRange) {
18808
18961
  throw new Error(
18809
18962
  `Refusing to write a partial in-place CSV export: the run returned ${rows.length} row(s) for ${expectedSelectedRows} selected source row(s).`
18810
18963
  );
18811
18964
  }
18812
18965
  const merged = [...baseRows];
18813
- if (canMergeSparseBySourceIndex) {
18966
+ if (hasRowsInSelectedRange) {
18814
18967
  for (const rawEnriched of rows) {
18815
18968
  const rowIndex = sourceRowIndexFromEnrichRow(
18816
18969
  rawEnriched,
@@ -18945,9 +19098,45 @@ function materializeCsvCellValue(value) {
18945
19098
  }
18946
19099
  return value;
18947
19100
  }
18948
- function materializeAliasSuccessCell(row, alias) {
19101
+ function disambiguateCompactAiInferencePayload(value) {
19102
+ const parsed = parseMaybeJsonObject(value);
19103
+ if (!isRecord7(parsed) || !cellFailureError(parsed)) {
19104
+ return value;
19105
+ }
19106
+ return {
19107
+ status: "completed",
19108
+ extracted_json: parsed
19109
+ };
19110
+ }
19111
+ function compactAiInferenceCellForCsv(value) {
19112
+ if (!isRecord7(value)) {
19113
+ return value;
19114
+ }
19115
+ const extractedJson = value.extracted_json;
19116
+ if (extractedJson !== null && extractedJson !== void 0) {
19117
+ return disambiguateCompactAiInferencePayload(extractedJson);
19118
+ }
19119
+ const result = isRecord7(value.result) ? value.result : null;
19120
+ const object = result?.object;
19121
+ if (object !== null && object !== void 0) {
19122
+ return disambiguateCompactAiInferencePayload(object);
19123
+ }
19124
+ const text = result?.text;
19125
+ if (typeof text === "string" && text.trim()) {
19126
+ return disambiguateCompactAiInferencePayload(text);
19127
+ }
19128
+ const output2 = value.output;
19129
+ if (typeof output2 === "string" && output2.trim()) {
19130
+ return disambiguateCompactAiInferencePayload(output2);
19131
+ }
19132
+ return value;
19133
+ }
19134
+ function materializeEnrichAliasCellForCsv(row, alias, options) {
18949
19135
  const direct = row[alias];
18950
19136
  if (isRecord7(direct)) {
19137
+ if (options?.compactAiCell && direct.status === "completed" && (isRecord7(direct.result) || Object.prototype.hasOwnProperty.call(direct, "extracted_json") || typeof direct.output === "string")) {
19138
+ return materializeCsvCellValue(compactAiInferenceCellForCsv(direct));
19139
+ }
18951
19140
  if (Object.prototype.hasOwnProperty.call(direct, "matched_result") || Object.prototype.hasOwnProperty.call(direct, "matchedResult") || Object.prototype.hasOwnProperty.call(direct, "result")) {
18952
19141
  return materializeCsvCellValue(direct);
18953
19142
  }
@@ -19006,6 +19195,7 @@ function materializeAliasSuccessCell(row, alias) {
19006
19195
  }
19007
19196
  function normalizeEnrichRowsForCsvExport(rows, config, options) {
19008
19197
  const aliases = config ? collectConfigScalarAliasOrder(config) : [];
19198
+ const aiCompactAliases = config ? enrichAiRuntimeCompactAliases(config) : null;
19009
19199
  const failureOperationByAlias = hardFailureOperationByAlias(config);
19010
19200
  return rows.map((row) => {
19011
19201
  const metadata = legacyMetadataFromRow(row);
@@ -19048,7 +19238,9 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
19048
19238
  }
19049
19239
  }
19050
19240
  for (const alias of aliases) {
19051
- const value = materializeAliasSuccessCell(normalized, alias);
19241
+ const value = materializeEnrichAliasCellForCsv(normalized, alias, {
19242
+ compactAiCell: aiCompactAliases?.has(normalizeAlias2(alias)) ?? false
19243
+ });
19052
19244
  if (value !== void 0) {
19053
19245
  normalized[alias] = value;
19054
19246
  continue;
@@ -19373,7 +19565,7 @@ function registerEnrichCommand(program) {
19373
19565
  capturedResult: captured2.result,
19374
19566
  client: client2,
19375
19567
  config,
19376
- sourceCsvPath: input2.sourceCsvPath,
19568
+ sourceCsvPath: input2.mergeSourceCsvPath ?? input2.sourceCsvPath,
19377
19569
  rows: input2.rows,
19378
19570
  inPlace: Boolean(options.inPlace)
19379
19571
  });
@@ -19389,11 +19581,12 @@ function registerEnrichCommand(program) {
19389
19581
  `
19390
19582
  );
19391
19583
  }
19392
- let workingSourceCsvPath = sourceCsvPath;
19584
+ let workingMergeSourceCsvPath = sourceCsvPath;
19393
19585
  let lastStatus = null;
19394
19586
  let finalExportResult = null;
19395
19587
  let totalEnrichedRows = 0;
19396
19588
  const batchFailureRows = [];
19589
+ const runtimeCompactAliases = enrichAiRuntimeCompactAliases(config);
19397
19590
  for (let chunkStart = selectedRange.start, chunkIndex = 0; chunkStart <= selectedRange.end; chunkStart += autoBatchRows, chunkIndex += 1) {
19398
19591
  const chunkRows = {
19399
19592
  rowStart: chunkStart,
@@ -19408,8 +19601,19 @@ function registerEnrichCommand(program) {
19408
19601
  `
19409
19602
  );
19410
19603
  }
19604
+ const runtimeSourceCsvPath = options.inPlace ? sourceCsvPath : workingMergeSourceCsvPath === inputCsv ? inputCsv : join7(tempDir, `runtime-batch-${chunkIndex}.csv`);
19605
+ if (!options.inPlace && runtimeSourceCsvPath !== inputCsv) {
19606
+ await writeSlimBatchedRuntimeCsv({
19607
+ cleanSourceCsvPath: inputCsv,
19608
+ mergeSourceCsvPath: workingMergeSourceCsvPath,
19609
+ rows: chunkRows,
19610
+ compactAliases: runtimeCompactAliases,
19611
+ outputPath: runtimeSourceCsvPath
19612
+ });
19613
+ }
19411
19614
  const chunk = await runOne({
19412
- sourceCsvPath: workingSourceCsvPath,
19615
+ sourceCsvPath: runtimeSourceCsvPath,
19616
+ mergeSourceCsvPath: workingMergeSourceCsvPath,
19413
19617
  rows: chunkRows,
19414
19618
  json: true,
19415
19619
  passthroughStdout: false,
@@ -19419,7 +19623,10 @@ function registerEnrichCommand(program) {
19419
19623
  if (chunk.captured.result !== 0) {
19420
19624
  if (chunk.exportResult) {
19421
19625
  finalExportResult = chunk.exportResult;
19422
- totalEnrichedRows += chunk.exportResult.enrichedRows;
19626
+ totalEnrichedRows += countEnrichedRowsInSourceRange(
19627
+ chunk.exportResult,
19628
+ chunkRows
19629
+ );
19423
19630
  batchFailureRows.push(...chunk.exportResult.enrichedDataRows);
19424
19631
  }
19425
19632
  const failureReport3 = await maybeEmitEnrichFailureReport({
@@ -19480,9 +19687,12 @@ function registerEnrichCommand(program) {
19480
19687
  }
19481
19688
  if (chunk.exportResult) {
19482
19689
  finalExportResult = chunk.exportResult;
19483
- totalEnrichedRows += chunk.exportResult.enrichedRows;
19690
+ totalEnrichedRows += countEnrichedRowsInSourceRange(
19691
+ chunk.exportResult,
19692
+ chunkRows
19693
+ );
19484
19694
  batchFailureRows.push(...chunk.exportResult.enrichedDataRows);
19485
- workingSourceCsvPath = outputPath;
19695
+ workingMergeSourceCsvPath = outputPath;
19486
19696
  }
19487
19697
  }
19488
19698
  const outputRows = readCsvRows(outputPath);
package/dist/index.d.mts CHANGED
@@ -1089,6 +1089,8 @@ type EnrichCompiledConfig = {
1089
1089
  type ExecuteToolRawOptions = {
1090
1090
  includeToolMetadata?: boolean;
1091
1091
  responseIntent?: 'raw' | 'row_artifact';
1092
+ timeout?: number;
1093
+ maxRetries?: number;
1092
1094
  };
1093
1095
  /**
1094
1096
  * Standard provider/tool execution envelope returned by low-level SDK calls.
package/dist/index.d.ts CHANGED
@@ -1089,6 +1089,8 @@ type EnrichCompiledConfig = {
1089
1089
  type ExecuteToolRawOptions = {
1090
1090
  includeToolMetadata?: boolean;
1091
1091
  responseIntent?: 'raw' | 'row_artifact';
1092
+ timeout?: number;
1093
+ maxRetries?: number;
1092
1094
  };
1093
1095
  /**
1094
1096
  * Standard provider/tool execution envelope returned by low-level SDK calls.
package/dist/index.js CHANGED
@@ -421,10 +421,10 @@ var SDK_RELEASE = {
421
421
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
422
422
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
423
423
  // fields shipped in 0.1.153.
424
- version: "0.1.175",
424
+ version: "0.1.176",
425
425
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
426
426
  supportPolicy: {
427
- latest: "0.1.175",
427
+ latest: "0.1.176",
428
428
  minimumSupported: "0.1.53",
429
429
  deprecatedBelow: "0.1.53",
430
430
  commandMinimumSupported: [
@@ -685,9 +685,10 @@ var HttpClient = class {
685
685
  headers["Content-Type"] = "application/json";
686
686
  }
687
687
  let lastError = null;
688
- const candidateUrls = buildCandidateUrls(url);
688
+ const candidateUrls = options?.exactUrlOnly ? [url] : buildCandidateUrls(url);
689
689
  let retryAfterDelayMs = null;
690
- for (let attempt = 0; attempt <= this.config.maxRetries; attempt++) {
690
+ const maxRetries = options?.maxRetries ?? this.config.maxRetries;
691
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
691
692
  if (attempt > 0) {
692
693
  const backoffMs = Math.min(1e3 * Math.pow(2, attempt - 1), 3e4);
693
694
  const delayMs = retryAfterDelayMs === null ? backoffMs : Math.max(backoffMs, retryAfterDelayMs);
@@ -714,7 +715,7 @@ var HttpClient = class {
714
715
  if (response.status === 429) {
715
716
  const retryAfter = parseRetryAfter(response);
716
717
  lastError = new RateLimitError(retryAfter);
717
- if (attempt < this.config.maxRetries) {
718
+ if (attempt < maxRetries) {
718
719
  retryAfterDelayMs = retryAfter;
719
720
  break;
720
721
  }
@@ -744,7 +745,7 @@ var HttpClient = class {
744
745
  ...htmlError.workerThrewException ? { workerThrewException: true } : {}
745
746
  }
746
747
  );
747
- if (retryableApiError && attempt < this.config.maxRetries) {
748
+ if (retryableApiError && attempt < maxRetries) {
748
749
  retryAfterDelayMs = parseOptionalRetryAfter(response);
749
750
  break;
750
751
  }
@@ -756,7 +757,7 @@ var HttpClient = class {
756
757
  lastError = new DeeplineError(msg, response.status, apiErrorCode, {
757
758
  response: parsed
758
759
  });
759
- if (retryableApiError && attempt < this.config.maxRetries) {
760
+ if (retryableApiError && attempt < maxRetries) {
760
761
  retryAfterDelayMs = parseOptionalRetryAfter(response);
761
762
  break;
762
763
  }
@@ -775,7 +776,7 @@ var HttpClient = class {
775
776
  lastError = error instanceof Error ? error : new Error(String(error));
776
777
  }
777
778
  }
778
- if (attempt < this.config.maxRetries) continue;
779
+ if (attempt < maxRetries) continue;
779
780
  }
780
781
  if (lastError instanceof DeeplineError) {
781
782
  throw lastError;
@@ -1910,6 +1911,7 @@ var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
1910
1911
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
1911
1912
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
1912
1913
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
1914
+ var DEEPLINEAGENT_EXECUTE_TIMEOUT_MS = 15 * 60 * 1e3;
1913
1915
  function normalizePlayRunIntegrationMode(value) {
1914
1916
  if (value === "live" || value === "eval_stub" || value === "fixture") {
1915
1917
  return value;
@@ -1984,6 +1986,10 @@ function chunkRegisterPlayArtifacts(artifacts) {
1984
1986
  }
1985
1987
  return chunks;
1986
1988
  }
1989
+ function resolveToolExecuteTimeoutMs(toolId) {
1990
+ const normalized = toolId.trim().toLowerCase();
1991
+ return normalized === "deeplineagent" || normalized === "deeplineagent_deeplineagent" || normalized === "ai_inference" || normalized === "deeplineagent_ai_inference" || normalized === "aiinference" ? DEEPLINEAGENT_EXECUTE_TIMEOUT_MS : void 0;
1992
+ }
1987
1993
  var RUN_LOGS_PAGE_LIMIT = 1e3;
1988
1994
  function isRecord3(value) {
1989
1995
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
@@ -2423,7 +2429,12 @@ var DeeplineClient = class {
2423
2429
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
2424
2430
  { payload: input },
2425
2431
  headers,
2426
- { forbiddenAsApiError: true }
2432
+ {
2433
+ forbiddenAsApiError: true,
2434
+ timeout: options?.timeout ?? resolveToolExecuteTimeoutMs(toolId),
2435
+ maxRetries: options?.maxRetries ?? 0,
2436
+ exactUrlOnly: true
2437
+ }
2427
2438
  );
2428
2439
  }
2429
2440
  /**