deepline 0.1.161 → 0.1.163

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.161",
610
+ version: "0.1.163",
611
611
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
612
612
  supportPolicy: {
613
- latest: "0.1.161",
613
+ latest: "0.1.163",
614
614
  minimumSupported: "0.1.53",
615
615
  deprecatedBelow: "0.1.53",
616
616
  commandMinimumSupported: [
@@ -17769,7 +17769,7 @@ function fallbackRowsInfoForGeneratedEnrichExport(status, options) {
17769
17769
  columns: [],
17770
17770
  columnsExplicit: false,
17771
17771
  complete: false,
17772
- source: GENERATED_ENRICH_ROWS_TABLE_NAMESPACE,
17772
+ source: null,
17773
17773
  tableNamespace: GENERATED_ENRICH_ROWS_TABLE_NAMESPACE
17774
17774
  };
17775
17775
  }
@@ -17790,10 +17790,45 @@ function hasLossyPreviewPlaceholder(value, depth = 0) {
17790
17790
  }
17791
17791
  return false;
17792
17792
  }
17793
+ function statusReferencesGeneratedEnrichRows(value, depth = 0) {
17794
+ if (depth > 12 || value === null || value === void 0) {
17795
+ return false;
17796
+ }
17797
+ if (typeof value === "string") {
17798
+ return value.trim() === GENERATED_ENRICH_ROWS_TABLE_NAMESPACE;
17799
+ }
17800
+ if (Array.isArray(value)) {
17801
+ return value.some(
17802
+ (item) => statusReferencesGeneratedEnrichRows(item, depth + 1)
17803
+ );
17804
+ }
17805
+ if (typeof value === "object") {
17806
+ return Object.values(value).some(
17807
+ (item) => statusReferencesGeneratedEnrichRows(item, depth + 1)
17808
+ );
17809
+ }
17810
+ return false;
17811
+ }
17812
+ function generatedEnrichRowsTableNamespaceForExport(rowsInfo, status) {
17813
+ const tableNamespace = rowsInfo.tableNamespace?.trim() || null;
17814
+ if (tableNamespace === "result.rows") {
17815
+ return GENERATED_ENRICH_ROWS_TABLE_NAMESPACE;
17816
+ }
17817
+ if (!tableNamespace && statusReferencesGeneratedEnrichRows(status)) {
17818
+ return GENERATED_ENRICH_ROWS_TABLE_NAMESPACE;
17819
+ }
17820
+ return tableNamespace;
17821
+ }
17793
17822
  function shouldFetchBackingRowsForEnrichExport(rowsInfo, status, options = {}) {
17794
17823
  const terminalStatus = readEnrichRunStatus(status);
17795
- const tableNamespace = rowsInfo.tableNamespace?.trim();
17824
+ const tableNamespace = generatedEnrichRowsTableNamespaceForExport(
17825
+ rowsInfo,
17826
+ status
17827
+ );
17796
17828
  if (terminalStatus === "failed" || terminalStatus === "cancelled") {
17829
+ if (tableNamespace === GENERATED_ENRICH_ROWS_TABLE_NAMESPACE && rowsInfo.source !== null && typeof options.selectedSourceRows === "number" && rowsInfo.rows.length < options.selectedSourceRows) {
17830
+ return true;
17831
+ }
17797
17832
  return tableNamespace === GENERATED_ENRICH_ROWS_TABLE_NAMESPACE && (rowsInfo.recovered === true || hasPartialRunOutputWarning(status));
17798
17833
  }
17799
17834
  if (tableNamespace === GENERATED_ENRICH_ROWS_TABLE_NAMESPACE && typeof options.selectedSourceRows === "number" && rowsInfo.rows.length < options.selectedSourceRows) {
@@ -17921,6 +17956,45 @@ function exportableSheetRow2(row, sourceRowStart = 0) {
17921
17956
  }
17922
17957
  return fallback;
17923
17958
  }
17959
+ function mergeExportedSheetRow(target, next) {
17960
+ const baseMetadata = target._metadata;
17961
+ const nextMetadata = next._metadata;
17962
+ for (const [key, value] of Object.entries(next)) {
17963
+ const existing = target[key];
17964
+ if (isNonEmptyCsvCell(existing) && !isNonEmptyCsvCell(value)) {
17965
+ continue;
17966
+ }
17967
+ target[key] = value;
17968
+ }
17969
+ const metadata = mergeLegacyMetadataCell(baseMetadata, nextMetadata);
17970
+ if (metadata !== void 0) {
17971
+ target._metadata = metadata;
17972
+ }
17973
+ }
17974
+ function coalesceExportableSheetRows(rows, sourceRowStart = 0) {
17975
+ const mergedRows = [];
17976
+ const bySourceRowIndex = /* @__PURE__ */ new Map();
17977
+ for (const row of rows) {
17978
+ const rowIndex = sourceRowIndexFromEnrichRow(
17979
+ row,
17980
+ sourceRowStart,
17981
+ Number.MAX_SAFE_INTEGER
17982
+ );
17983
+ if (rowIndex === null) {
17984
+ mergedRows.push(row);
17985
+ continue;
17986
+ }
17987
+ const existing = bySourceRowIndex.get(rowIndex);
17988
+ if (existing) {
17989
+ mergeExportedSheetRow(existing, row);
17990
+ continue;
17991
+ }
17992
+ const next = { ...row };
17993
+ bySourceRowIndex.set(rowIndex, next);
17994
+ mergedRows.push(next);
17995
+ }
17996
+ return mergedRows;
17997
+ }
17924
17998
  function sourceRowIndexFromEnrichRow(row, start, end) {
17925
17999
  const value = row[ENRICH_SOURCE_ROW_INDEX_COLUMN];
17926
18000
  const parsed = typeof value === "number" ? value : typeof value === "string" && value.trim() ? Number(value) : Number.NaN;
@@ -18025,7 +18099,11 @@ function aliasFailureCellCandidates(row, alias) {
18025
18099
  if (key.startsWith(dottedPrefix)) {
18026
18100
  assignFlattenedFailurePath(nested, key.slice(dottedPrefix.length), value);
18027
18101
  } else if (key.startsWith(underscorePrefix)) {
18028
- assignFlattenedFailurePath(nested, key.slice(underscorePrefix.length), value);
18102
+ assignFlattenedFailurePath(
18103
+ nested,
18104
+ key.slice(underscorePrefix.length),
18105
+ value
18106
+ );
18029
18107
  }
18030
18108
  }
18031
18109
  if (Object.keys(nested).length > 0) {
@@ -18403,13 +18481,14 @@ function mergePreferredColumns(preferredColumns, rows) {
18403
18481
  async function fetchBackingRowsForCsvExport(input2) {
18404
18482
  const runId = extractRunId(input2.status);
18405
18483
  const playName = extractPlayName2(input2.status);
18406
- const tableNamespace = input2.rowsInfo.tableNamespace?.trim() || GENERATED_ENRICH_ROWS_TABLE_NAMESPACE;
18484
+ const tableNamespace = generatedEnrichRowsTableNamespaceForExport(input2.rowsInfo, input2.status) || GENERATED_ENRICH_ROWS_TABLE_NAMESPACE;
18407
18485
  if (!runId || !playName || !tableNamespace) {
18408
18486
  return null;
18409
18487
  }
18410
18488
  const deadline = Date.now() + enrichExportBackingRowsWaitMs();
18411
18489
  let lastRows = [];
18412
- const minimumExpectedRows = typeof input2.expectedRows === "number" && input2.expectedRows > 0 ? Math.trunc(input2.expectedRows) : input2.rowsInfo.totalRows;
18490
+ const hasExplicitExpectedRows = typeof input2.expectedRows === "number" && input2.expectedRows > 0;
18491
+ const minimumExpectedRows = hasExplicitExpectedRows ? Math.trunc(Number(input2.expectedRows)) : input2.rowsInfo.totalRows;
18413
18492
  let lastExpectedTotal = minimumExpectedRows;
18414
18493
  for (; ; ) {
18415
18494
  const sheetRows = [];
@@ -18434,10 +18513,15 @@ async function fetchBackingRowsForCsvExport(input2) {
18434
18513
  }
18435
18514
  offset += page.rows.length;
18436
18515
  }
18437
- const rows = sheetRows.map((row) => exportableSheetRow2(row, input2.sourceRowStart ?? 0)).filter((row) => Boolean(row));
18516
+ const rawRows = sheetRows.map((row) => exportableSheetRow2(row, input2.sourceRowStart ?? 0)).filter((row) => Boolean(row));
18517
+ const rows = coalesceExportableSheetRows(
18518
+ rawRows,
18519
+ input2.sourceRowStart ?? 0
18520
+ );
18438
18521
  lastRows = rows;
18439
18522
  lastExpectedTotal = expectedTotal;
18440
- if (expectedTotal > 0 && rows.length >= expectedTotal || expectedTotal === 0 && rows.length > 0) {
18523
+ const requiredExportRows = hasExplicitExpectedRows ? minimumExpectedRows : expectedTotal;
18524
+ if (requiredExportRows > 0 && rows.length >= requiredExportRows || requiredExportRows === 0 && rows.length > 0) {
18441
18525
  return {
18442
18526
  ...input2.rowsInfo,
18443
18527
  rows,
@@ -18445,7 +18529,7 @@ async function fetchBackingRowsForCsvExport(input2) {
18445
18529
  input2.rowsInfo.columnsExplicit ? input2.rowsInfo.columns : [],
18446
18530
  rows
18447
18531
  ),
18448
- totalRows: Math.max(rows.length, expectedTotal),
18532
+ totalRows: hasExplicitExpectedRows ? Math.max(rows.length, minimumExpectedRows) : Math.max(rows.length, expectedTotal),
18449
18533
  complete: true,
18450
18534
  source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
18451
18535
  };
@@ -18465,7 +18549,7 @@ async function fetchBackingRowsForCsvExport(input2) {
18465
18549
  input2.rowsInfo.columnsExplicit ? input2.rowsInfo.columns : [],
18466
18550
  lastRows
18467
18551
  ),
18468
- totalRows: Math.max(lastExpectedTotal, input2.rowsInfo.totalRows),
18552
+ totalRows: hasExplicitExpectedRows ? Math.max(lastRows.length, minimumExpectedRows) : Math.max(lastExpectedTotal, input2.rowsInfo.totalRows),
18469
18553
  complete: false,
18470
18554
  source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
18471
18555
  };
@@ -18653,8 +18737,13 @@ function materializeAliasSuccessCell(row, alias) {
18653
18737
  directCells.push({ field, value });
18654
18738
  }
18655
18739
  }
18656
- for (const preferredField of [alias, ...ENRICH_FLATTENED_SUCCESS_FIELD_PRIORITY]) {
18657
- const preferred = directCells.find(({ field }) => field === preferredField);
18740
+ for (const preferredField of [
18741
+ alias,
18742
+ ...ENRICH_FLATTENED_SUCCESS_FIELD_PRIORITY
18743
+ ]) {
18744
+ const preferred = directCells.find(
18745
+ ({ field }) => field === preferredField
18746
+ );
18658
18747
  if (preferred) {
18659
18748
  return materializeCsvCellValue(preferred.value);
18660
18749
  }
@@ -18856,7 +18945,7 @@ function assertCompleteRowsForCsvExport(rowsInfo, status, outputPath, options =
18856
18945
  return;
18857
18946
  }
18858
18947
  const runId = status && typeof status === "object" && !Array.isArray(status) && typeof status.runId === "string" ? status.runId : null;
18859
- const dataset = rowsInfo.source ?? "result.rows";
18948
+ const dataset = rowsInfo.source ?? rowsInfo.tableNamespace ?? "result.rows";
18860
18949
  const retry = runId ? ` Retry after the run finalizes its backing dataset with: deepline runs export ${runId} --dataset ${dataset} --out ${outputPath}` : "";
18861
18950
  throw new Error(
18862
18951
  `Refusing to write a partial CSV export: the run returned ${rowsInfo.rows.length} preview row(s) out of ${rowsInfo.totalRows}.${retry}`
@@ -22,6 +22,14 @@ type PlayArtifactKind = (typeof PLAY_ARTIFACT_KINDS)[keyof typeof PLAY_ARTIFACT_
22
22
  interface PlayStaticReturnField {
23
23
  name: string;
24
24
  isDataset: boolean;
25
+ /**
26
+ * For a dataset-valued field, the `ctx.dataset(KEY, ...)` key backing it
27
+ * (e.g. `job_change_checks`) — so the UI can label the return by the dataset
28
+ * it actually produces instead of the bland object key (`rows`). Undefined
29
+ * for non-dataset fields, `ctx.csv(...)` (no durable name), or when the key
30
+ * isn't a static string literal.
31
+ */
32
+ datasetName?: string;
25
33
  }
26
34
  interface PlayStaticPipeline {
27
35
  tableNamespace?: string;
@@ -92,6 +100,18 @@ type PlayStaticSubstepMetadata = {
92
100
  conditional?: boolean;
93
101
  dependsOnFields?: string[];
94
102
  };
103
+ /**
104
+ * One arm of a conditional `control_flow` substep — an `if`/`else if`/`else`
105
+ * leg, a `switch` case, or a ternary branch. Carries its own steps so the graph
106
+ * can render the conditional as a real fork instead of a flat strip.
107
+ */
108
+ type PlayStaticControlFlowBranch = {
109
+ /** Short arm label, e.g. `if`, `else if`, `else`, `case 'x'`, `default`. */
110
+ label: string;
111
+ /** The arm's condition source text, when it has one (omitted for `else`). */
112
+ condition?: string;
113
+ steps: PlayStaticSubstep[];
114
+ };
95
115
  type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
96
116
  type: 'csv';
97
117
  field: string;
@@ -172,7 +192,12 @@ type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
172
192
  type: 'control_flow';
173
193
  kind: 'conditional' | 'loop';
174
194
  field: string;
195
+ /** Flattened steps across every arm, in source order (back-compat). */
175
196
  steps: PlayStaticSubstep[];
197
+ /** Discriminant source text (the `if`/ternary test, `switch` subject). */
198
+ condition?: string;
199
+ /** Per-arm breakdown for conditionals; omitted for loops. */
200
+ branches?: PlayStaticControlFlowBranch[];
176
201
  description?: string;
177
202
  sourceRange?: PlayStaticSourceRange;
178
203
  callDepth?: number;
@@ -22,6 +22,14 @@ type PlayArtifactKind = (typeof PLAY_ARTIFACT_KINDS)[keyof typeof PLAY_ARTIFACT_
22
22
  interface PlayStaticReturnField {
23
23
  name: string;
24
24
  isDataset: boolean;
25
+ /**
26
+ * For a dataset-valued field, the `ctx.dataset(KEY, ...)` key backing it
27
+ * (e.g. `job_change_checks`) — so the UI can label the return by the dataset
28
+ * it actually produces instead of the bland object key (`rows`). Undefined
29
+ * for non-dataset fields, `ctx.csv(...)` (no durable name), or when the key
30
+ * isn't a static string literal.
31
+ */
32
+ datasetName?: string;
25
33
  }
26
34
  interface PlayStaticPipeline {
27
35
  tableNamespace?: string;
@@ -92,6 +100,18 @@ type PlayStaticSubstepMetadata = {
92
100
  conditional?: boolean;
93
101
  dependsOnFields?: string[];
94
102
  };
103
+ /**
104
+ * One arm of a conditional `control_flow` substep — an `if`/`else if`/`else`
105
+ * leg, a `switch` case, or a ternary branch. Carries its own steps so the graph
106
+ * can render the conditional as a real fork instead of a flat strip.
107
+ */
108
+ type PlayStaticControlFlowBranch = {
109
+ /** Short arm label, e.g. `if`, `else if`, `else`, `case 'x'`, `default`. */
110
+ label: string;
111
+ /** The arm's condition source text, when it has one (omitted for `else`). */
112
+ condition?: string;
113
+ steps: PlayStaticSubstep[];
114
+ };
95
115
  type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
96
116
  type: 'csv';
97
117
  field: string;
@@ -172,7 +192,12 @@ type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
172
192
  type: 'control_flow';
173
193
  kind: 'conditional' | 'loop';
174
194
  field: string;
195
+ /** Flattened steps across every arm, in source order (back-compat). */
175
196
  steps: PlayStaticSubstep[];
197
+ /** Discriminant source text (the `if`/ternary test, `switch` subject). */
198
+ condition?: string;
199
+ /** Per-arm breakdown for conditionals; omitted for loops. */
200
+ branches?: PlayStaticControlFlowBranch[];
176
201
  description?: string;
177
202
  sourceRange?: PlayStaticSourceRange;
178
203
  callDepth?: number;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as PlayCompilerManifest } from './compiler-manifest-DW1flrHk.mjs';
1
+ import { a as PlayCompilerManifest } from './compiler-manifest-VhtM9n24.mjs';
2
2
 
3
3
  declare const DEEPLINE_TOOL_CATEGORIES: readonly ["company_search", "people_search", "people_enrich", "email_finder", "email_verify", "phone_finder", "phone_verify", "identity_resolution", "reverse_lookup", "enrichment", "batch", "premium", "free"];
4
4
  type DeeplineToolCategory = (typeof DEEPLINE_TOOL_CATEGORIES)[number] | (string & {});
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as PlayCompilerManifest } from './compiler-manifest-DW1flrHk.js';
1
+ import { a as PlayCompilerManifest } from './compiler-manifest-VhtM9n24.js';
2
2
 
3
3
  declare const DEEPLINE_TOOL_CATEGORIES: readonly ["company_search", "people_search", "people_enrich", "email_finder", "email_verify", "phone_finder", "phone_verify", "identity_resolution", "reverse_lookup", "enrichment", "batch", "premium", "free"];
4
4
  type DeeplineToolCategory = (typeof DEEPLINE_TOOL_CATEGORIES)[number] | (string & {});
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.161",
424
+ version: "0.1.163",
425
425
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
426
426
  supportPolicy: {
427
- latest: "0.1.161",
427
+ latest: "0.1.163",
428
428
  minimumSupported: "0.1.53",
429
429
  deprecatedBelow: "0.1.53",
430
430
  commandMinimumSupported: [
package/dist/index.mjs CHANGED
@@ -351,10 +351,10 @@ var SDK_RELEASE = {
351
351
  // 0.1.111 ships dataset-native tool list getters and result row datasets.
352
352
  // 0.1.154 removes the short-lived generated enrich StepOptions recompute
353
353
  // fields shipped in 0.1.153.
354
- version: "0.1.161",
354
+ version: "0.1.163",
355
355
  apiContract: "2026-06-dataset-handle-results-hard-cutover",
356
356
  supportPolicy: {
357
- latest: "0.1.161",
357
+ latest: "0.1.163",
358
358
  minimumSupported: "0.1.53",
359
359
  deprecatedBelow: "0.1.53",
360
360
  commandMinimumSupported: [
@@ -1,5 +1,5 @@
1
- import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-DW1flrHk.mjs';
2
- export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-DW1flrHk.mjs';
1
+ import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-VhtM9n24.mjs';
2
+ export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-VhtM9n24.mjs';
3
3
 
4
4
  type PlayPackageImport = {
5
5
  name: string;
@@ -1,5 +1,5 @@
1
- import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-DW1flrHk.js';
2
- export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-DW1flrHk.js';
1
+ import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-VhtM9n24.js';
2
+ export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-VhtM9n24.js';
3
3
 
4
4
  type PlayPackageImport = {
5
5
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.161",
3
+ "version": "0.1.163",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {