deepline 0.3.182 → 0.3.184

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.
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.182',
203
+ version: '0.3.184',
204
204
  updateSummary:
205
205
  'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
206
206
  packageCapabilities: {
@@ -11836,6 +11836,9 @@ export async function failPostgresSchedulerAttempt(
11836
11836
  * Cancel a run: terminal `cancelled` status, all live attempts cancelled, and
11837
11837
  * terminal notify so observers settle immediately. An in-flight executor's
11838
11838
  * complete/fail then no-ops on its status guard (the run stays cancelled).
11839
+ * Receipt ownership is released by the terminal run status itself; claimers
11840
+ * lazily take an incomplete receipt from a terminal owner instead of making
11841
+ * cancellation rewrite an unbounded number of receipt rows.
11839
11842
  */
11840
11843
  export async function cancelPostgresSchedulerRun(
11841
11844
  client: PostgresSchedulerQueryClient,
@@ -11902,29 +11905,7 @@ export async function cancelPostgresSchedulerRun(
11902
11905
  WHERE target.run_id = $1
11903
11906
  AND target.status IN ('queued', 'running', 'waiting')
11904
11907
  ${strandedEligibility}
11905
- RETURNING target.run_id, target.org_id, target.launch_json
11906
- ),
11907
- released_receipts AS (
11908
- -- Cancellation is a terminal, and a terminal releases everything the
11909
- -- run claimed. A receipt left 'running' behind a dead lease matches no
11910
- -- non-forced claim status set, so a successor would park on it for the
11911
- -- whole receipt wait budget instead of executing the call itself.
11912
- UPDATE ${tableName('receipts', options)} AS receipt
11913
- SET ${RELEASE_RECEIPT_TO_PENDING_SET_CLAUSE}
11914
- FROM cancelled_run
11915
- WHERE receipt.org_id = cancelled_run.org_id
11916
- AND receipt.status IN ('queued', 'running')
11917
- -- Every successful claim stamps both run_id and
11918
- -- lease_owner_run_id with the current owner. Keep the explicit
11919
- -- owner fence below for mixed-version rows, while giving Postgres
11920
- -- the direct run_id equality it needs to use
11921
- -- runtime_scheduler_receipts_run_idx. Without this predicate,
11922
- -- COALESCE forces a scan of the org's complete receipt history and
11923
- -- cancellation can hit its statement timeout on a large workspace.
11924
- AND receipt.run_id = cancelled_run.run_id
11925
- AND COALESCE(receipt.lease_owner_run_id, receipt.run_id)
11926
- = cancelled_run.run_id
11927
- RETURNING receipt.k
11908
+ RETURNING target.run_id, target.launch_json
11928
11909
  ),
11929
11910
  cancelled_attempts AS (
11930
11911
  UPDATE ${tableName('attempts', options)}
@@ -14562,10 +14543,9 @@ export async function releasePostgresSchedulerReceipt(
14562
14543
  }
14563
14544
 
14564
14545
  /**
14565
- * The write that returns a claimed receipt to the free pool. Every release
14566
- * path shares it so a successor's non-forced claim always matches what a dead
14567
- * owner left behind. Claimers also understand terminal ownership directly so
14568
- * a later writer release can stop rewriting every receipt synchronously.
14546
+ * The write that returns one attempt's claimed receipts to the free pool.
14547
+ * Attempt cleanup uses this eager path; whole-run terminalization is the
14548
+ * constant-time ownership fence that claimers resolve lazily.
14569
14549
  */
14570
14550
  const RELEASE_RECEIPT_TO_PENDING_SET_CLAUSE = `status = 'pending',
14571
14551
  output_json = NULL,
package/dist/cli/index.js CHANGED
@@ -3051,7 +3051,7 @@ var SDK_RELEASE = {
3051
3051
  // getters keep their established compatibility behavior.
3052
3052
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3053
3053
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3054
- version: "0.3.182",
3054
+ version: "0.3.184",
3055
3055
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
3056
3056
  packageCapabilities: {
3057
3057
  updatePreferences: 1
@@ -14141,6 +14141,7 @@ function mergeCanonicalRowsInfo(left, right) {
14141
14141
  source: preferred.source ?? fallback.source,
14142
14142
  datasetId: preferred.datasetId ?? fallback.datasetId,
14143
14143
  tableNamespace: preferred.tableNamespace ?? fallback.tableNamespace,
14144
+ currentTableQueryCommand: preferred.currentTableQueryCommand ?? fallback.currentTableQueryCommand,
14144
14145
  ...left.recovered || right.recovered ? { recovered: true } : {},
14145
14146
  ...recoveredReturnPaths2.length ? { recoveredReturnPaths: recoveredReturnPaths2 } : {},
14146
14147
  ...currentTable ? { currentTable: true } : {},
@@ -14209,6 +14210,12 @@ function hasCurrentTableExport(value) {
14209
14210
  const exportCsv = value.actions.exportCsv;
14210
14211
  return isRecord8(exportCsv) && isRecord8(exportCsv.scope) && exportCsv.scope.kind === "database" && exportCsv.scope.mutability === "current";
14211
14212
  }
14213
+ function currentTableQueryCommand(value) {
14214
+ if (!isRecord8(value) || !isRecord8(value.actions)) return void 0;
14215
+ const query = value.actions.queryCurrentTable;
14216
+ const command = isRecord8(query) ? query.command : void 0;
14217
+ return typeof command === "string" && command.trim() ? command.trim() : void 0;
14218
+ }
14212
14219
  function recoveredReturnPaths(value) {
14213
14220
  if (!Array.isArray(value)) return [];
14214
14221
  return [
@@ -14316,6 +14323,9 @@ function canonicalRowsInfoFromCandidate(input2) {
14316
14323
  tableNamespace: typeof candidate.value.tableNamespace === "string" ? candidate.value.tableNamespace : null,
14317
14324
  ...candidate.value.recovered === true ? { recovered: true } : {},
14318
14325
  ...hasCurrentTableExport(candidate.value) ? { currentTable: true } : {},
14326
+ ...currentTableQueryCommand(candidate.value) ? {
14327
+ currentTableQueryCommand: currentTableQueryCommand(candidate.value)
14328
+ } : {},
14319
14329
  ...recoveredReturnPaths(candidate.value.recoveredReturnPaths).length ? {
14320
14330
  recoveredReturnPaths: recoveredReturnPaths(
14321
14331
  candidate.value.recoveredReturnPaths
@@ -26317,7 +26327,20 @@ async function fetchBackingDatasetRows(input2) {
26317
26327
  offset += page.rows.length;
26318
26328
  }
26319
26329
  const rows = sheetRows.map(exportableSheetRow).filter((row) => Boolean(row));
26320
- const hasCompleteSettledPrefix = !currentTable && acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal !== null && rows.length >= settledTotal;
26330
+ const hasCompleteSettledPrefix = !currentTable && acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal !== null && // A zero-row run-scoped read is not a settled export when the returned
26331
+ // Dataset Handle advertised rows. That shape is the replay/reuse case:
26332
+ // the rows belong to another writer (or the projection has not caught up)
26333
+ // and must not erase the run package's advertised count.
26334
+ (settledTotal > 0 || input2.rowsInfo.totalRows === 0) && rows.length >= settledTotal;
26335
+ if (!currentTable && acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal === 0 && rows.length === 0 && input2.rowsInfo.totalRows > 0) {
26336
+ return {
26337
+ ...input2.rowsInfo,
26338
+ rows: [],
26339
+ totalRows: input2.rowsInfo.totalRows,
26340
+ complete: true,
26341
+ source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
26342
+ };
26343
+ }
26321
26344
  if (!currentTable && rows.length < input2.rowsInfo.totalRows && !hasCompleteSettledPrefix || currentTable && rows.length === 0 && input2.rowsInfo.totalRows > 0) {
26322
26345
  return null;
26323
26346
  }
@@ -26373,7 +26396,8 @@ function assertDatasetHasExportableRows(input2) {
26373
26396
  "output.csv",
26374
26397
  datasetLabel
26375
26398
  );
26376
- const explanation = terminalRunWithMissingAdvertisedRows ? ` The terminal result advertised ${advertisedRows} row(s), but none are currently attributed to this run's durable sheet. Those rows may have been reused from an earlier run or the projection may still be lagging; export refuses to guess another run's rows. Retry the same export after projection catches up (do not rerun the Play): ${retryCommand}. If it remains empty, inspect the full package with ${inspectCommand} and export the run that owns the durable dataset; this command will not use a database-wide table query that could mix runs.` : ` The run status is '${runStatus || "unknown"}', so it likely failed before persisting rows to this dataset. That means provider calls may have been billed without a durable row; inspect ${inspectCommand}, fix the failure cause, then rerun the Play so completed receipts can be reused.`;
26399
+ const currentTableQueryCommand2 = input2.rowsInfo.currentTableQueryCommand;
26400
+ const explanation = terminalRunWithMissingAdvertisedRows ? ` The terminal result advertised ${advertisedRows} row(s), but none are currently attributed to this run's durable sheet. Those rows may have been reused from an earlier run or the projection may still be lagging; export refuses to guess another run's rows. Retry the same export after projection catches up (do not rerun the Play): ${retryCommand}. If it remains empty, inspect the full package with ${inspectCommand}` + (currentTableQueryCommand2 ? `, then inspect the current table's _run_id/_writer_run_id with ${currentTableQueryCommand2} and export the run that owns those rows` : " and export the run that owns the durable dataset") + "; this command will not use a database-wide table query that could mix runs." : ` The run status is '${runStatus || "unknown"}', so it likely failed before persisting rows to this dataset. That means provider calls may have been billed without a durable row; inspect ${inspectCommand}, fix the failure cause, then rerun the Play so completed receipts can be reused.`;
26377
26401
  throw new DeeplineError(
26378
26402
  `Run ${input2.status.runId} has zero rows to export from dataset '${datasetLabel}'.` + explanation + (available.length > 0 ? ` Available datasets: ${available.join(", ")}.` : " No datasets were materialized for this run."),
26379
26403
  void 0,
@@ -26386,6 +26410,7 @@ function assertDatasetHasExportableRows(input2) {
26386
26410
  guidance: terminalRunWithMissingAdvertisedRows ? {
26387
26411
  inspect_command: inspectCommand,
26388
26412
  retry_command: retryCommand,
26413
+ ...currentTableQueryCommand2 ? { lookup_writer_command: currentTableQueryCommand2 } : {},
26389
26414
  do_not_rerun: true,
26390
26415
  reason: "Run output is terminal but its rows are not attributed to this run; export refuses to guess another writer."
26391
26416
  } : {
@@ -3046,7 +3046,7 @@ var SDK_RELEASE = {
3046
3046
  // getters keep their established compatibility behavior.
3047
3047
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3048
3048
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3049
- version: "0.3.182",
3049
+ version: "0.3.184",
3050
3050
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
3051
3051
  packageCapabilities: {
3052
3052
  updatePreferences: 1
@@ -14156,6 +14156,7 @@ function mergeCanonicalRowsInfo(left, right) {
14156
14156
  source: preferred.source ?? fallback.source,
14157
14157
  datasetId: preferred.datasetId ?? fallback.datasetId,
14158
14158
  tableNamespace: preferred.tableNamespace ?? fallback.tableNamespace,
14159
+ currentTableQueryCommand: preferred.currentTableQueryCommand ?? fallback.currentTableQueryCommand,
14159
14160
  ...left.recovered || right.recovered ? { recovered: true } : {},
14160
14161
  ...recoveredReturnPaths2.length ? { recoveredReturnPaths: recoveredReturnPaths2 } : {},
14161
14162
  ...currentTable ? { currentTable: true } : {},
@@ -14224,6 +14225,12 @@ function hasCurrentTableExport(value) {
14224
14225
  const exportCsv = value.actions.exportCsv;
14225
14226
  return isRecord8(exportCsv) && isRecord8(exportCsv.scope) && exportCsv.scope.kind === "database" && exportCsv.scope.mutability === "current";
14226
14227
  }
14228
+ function currentTableQueryCommand(value) {
14229
+ if (!isRecord8(value) || !isRecord8(value.actions)) return void 0;
14230
+ const query = value.actions.queryCurrentTable;
14231
+ const command = isRecord8(query) ? query.command : void 0;
14232
+ return typeof command === "string" && command.trim() ? command.trim() : void 0;
14233
+ }
14227
14234
  function recoveredReturnPaths(value) {
14228
14235
  if (!Array.isArray(value)) return [];
14229
14236
  return [
@@ -14331,6 +14338,9 @@ function canonicalRowsInfoFromCandidate(input2) {
14331
14338
  tableNamespace: typeof candidate.value.tableNamespace === "string" ? candidate.value.tableNamespace : null,
14332
14339
  ...candidate.value.recovered === true ? { recovered: true } : {},
14333
14340
  ...hasCurrentTableExport(candidate.value) ? { currentTable: true } : {},
14341
+ ...currentTableQueryCommand(candidate.value) ? {
14342
+ currentTableQueryCommand: currentTableQueryCommand(candidate.value)
14343
+ } : {},
14334
14344
  ...recoveredReturnPaths(candidate.value.recoveredReturnPaths).length ? {
14335
14345
  recoveredReturnPaths: recoveredReturnPaths(
14336
14346
  candidate.value.recoveredReturnPaths
@@ -26389,7 +26399,20 @@ async function fetchBackingDatasetRows(input2) {
26389
26399
  offset += page.rows.length;
26390
26400
  }
26391
26401
  const rows = sheetRows.map(exportableSheetRow).filter((row) => Boolean(row));
26392
- const hasCompleteSettledPrefix = !currentTable && acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal !== null && rows.length >= settledTotal;
26402
+ const hasCompleteSettledPrefix = !currentTable && acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal !== null && // A zero-row run-scoped read is not a settled export when the returned
26403
+ // Dataset Handle advertised rows. That shape is the replay/reuse case:
26404
+ // the rows belong to another writer (or the projection has not caught up)
26405
+ // and must not erase the run package's advertised count.
26406
+ (settledTotal > 0 || input2.rowsInfo.totalRows === 0) && rows.length >= settledTotal;
26407
+ if (!currentTable && acceptsSettledRowsAsCompleteExport(input2.status) && settledTotal === 0 && rows.length === 0 && input2.rowsInfo.totalRows > 0) {
26408
+ return {
26409
+ ...input2.rowsInfo,
26410
+ rows: [],
26411
+ totalRows: input2.rowsInfo.totalRows,
26412
+ complete: true,
26413
+ source: `${input2.rowsInfo.source ?? "result.rows"} -> /api/v2/plays/${playName}/sheet?tableNamespace=${tableNamespace}`
26414
+ };
26415
+ }
26393
26416
  if (!currentTable && rows.length < input2.rowsInfo.totalRows && !hasCompleteSettledPrefix || currentTable && rows.length === 0 && input2.rowsInfo.totalRows > 0) {
26394
26417
  return null;
26395
26418
  }
@@ -26445,7 +26468,8 @@ function assertDatasetHasExportableRows(input2) {
26445
26468
  "output.csv",
26446
26469
  datasetLabel
26447
26470
  );
26448
- const explanation = terminalRunWithMissingAdvertisedRows ? ` The terminal result advertised ${advertisedRows} row(s), but none are currently attributed to this run's durable sheet. Those rows may have been reused from an earlier run or the projection may still be lagging; export refuses to guess another run's rows. Retry the same export after projection catches up (do not rerun the Play): ${retryCommand}. If it remains empty, inspect the full package with ${inspectCommand} and export the run that owns the durable dataset; this command will not use a database-wide table query that could mix runs.` : ` The run status is '${runStatus || "unknown"}', so it likely failed before persisting rows to this dataset. That means provider calls may have been billed without a durable row; inspect ${inspectCommand}, fix the failure cause, then rerun the Play so completed receipts can be reused.`;
26471
+ const currentTableQueryCommand2 = input2.rowsInfo.currentTableQueryCommand;
26472
+ const explanation = terminalRunWithMissingAdvertisedRows ? ` The terminal result advertised ${advertisedRows} row(s), but none are currently attributed to this run's durable sheet. Those rows may have been reused from an earlier run or the projection may still be lagging; export refuses to guess another run's rows. Retry the same export after projection catches up (do not rerun the Play): ${retryCommand}. If it remains empty, inspect the full package with ${inspectCommand}` + (currentTableQueryCommand2 ? `, then inspect the current table's _run_id/_writer_run_id with ${currentTableQueryCommand2} and export the run that owns those rows` : " and export the run that owns the durable dataset") + "; this command will not use a database-wide table query that could mix runs." : ` The run status is '${runStatus || "unknown"}', so it likely failed before persisting rows to this dataset. That means provider calls may have been billed without a durable row; inspect ${inspectCommand}, fix the failure cause, then rerun the Play so completed receipts can be reused.`;
26449
26473
  throw new DeeplineError(
26450
26474
  `Run ${input2.status.runId} has zero rows to export from dataset '${datasetLabel}'.` + explanation + (available.length > 0 ? ` Available datasets: ${available.join(", ")}.` : " No datasets were materialized for this run."),
26451
26475
  void 0,
@@ -26458,6 +26482,7 @@ function assertDatasetHasExportableRows(input2) {
26458
26482
  guidance: terminalRunWithMissingAdvertisedRows ? {
26459
26483
  inspect_command: inspectCommand,
26460
26484
  retry_command: retryCommand,
26485
+ ...currentTableQueryCommand2 ? { lookup_writer_command: currentTableQueryCommand2 } : {},
26461
26486
  do_not_rerun: true,
26462
26487
  reason: "Run output is terminal but its rows are not attributed to this run; export refuses to guess another writer."
26463
26488
  } : {
package/dist/index.js CHANGED
@@ -864,7 +864,7 @@ var SDK_RELEASE = {
864
864
  // getters keep their established compatibility behavior.
865
865
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
866
866
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
867
- version: "0.3.182",
867
+ version: "0.3.184",
868
868
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
869
869
  packageCapabilities: {
870
870
  updatePreferences: 1
package/dist/index.mjs CHANGED
@@ -768,7 +768,7 @@ var SDK_RELEASE = {
768
768
  // getters keep their established compatibility behavior.
769
769
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
770
770
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
771
- version: "0.3.182",
771
+ version: "0.3.184",
772
772
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
773
773
  packageCapabilities: {
774
774
  updatePreferences: 1
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.182";
152
+ readonly version: "0.3.184";
153
153
  readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.d.ts CHANGED
@@ -149,7 +149,7 @@ type SdkRelease = {
149
149
  supportPolicy: SdkSupportPolicy;
150
150
  };
151
151
  declare const SDK_RELEASE: {
152
- readonly version: "0.3.182";
152
+ readonly version: "0.3.184";
153
153
  readonly updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.";
154
154
  readonly packageCapabilities: {
155
155
  readonly updatePreferences: 1;
package/dist/release.js CHANGED
@@ -74,7 +74,7 @@ var SDK_RELEASE = {
74
74
  // getters keep their established compatibility behavior.
75
75
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
76
76
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
77
- version: "0.3.182",
77
+ version: "0.3.184",
78
78
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
79
79
  packageCapabilities: {
80
80
  updatePreferences: 1
package/dist/release.mjs CHANGED
@@ -48,7 +48,7 @@ var SDK_RELEASE = {
48
48
  // getters keep their established compatibility behavior.
49
49
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
50
50
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
51
- version: "0.3.182",
51
+ version: "0.3.184",
52
52
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
53
53
  packageCapabilities: {
54
54
  updatePreferences: 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.3.182",
3
+ "version": "0.3.184",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",