deepline 0.2.24 → 0.2.26

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.
@@ -1319,7 +1319,18 @@ async function uploadStagedFileToPresignedUrl(input: {
1319
1319
  break;
1320
1320
  }
1321
1321
  } catch (error) {
1322
- lastError = error;
1322
+ // fetch rejects network-level failures instead of returning a Response.
1323
+ // Sandboxed egress proxies commonly reject the TLS CONNECT this way, so
1324
+ // preserve the existing multipart fallback after direct retries finish.
1325
+ lastError =
1326
+ error instanceof TypeError
1327
+ ? new DeeplineError(
1328
+ `Direct storage upload of ${input.logicalPath} could not reach the storage endpoint: ${error.message}`,
1329
+ undefined,
1330
+ 'STAGED_FILE_UPLOAD_EGRESS_DENIED',
1331
+ { logicalPath: input.logicalPath },
1332
+ )
1333
+ : error;
1323
1334
  }
1324
1335
  if (attempt < STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS) {
1325
1336
  await sleep(250 * attempt);
@@ -160,7 +160,7 @@ export const SDK_RELEASE = {
160
160
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
161
161
  // exposed storage-dependent synchronous access. This deliberate minor
162
162
  // release keeps lazy paging semantics independent of row residency.
163
- version: '0.2.24',
163
+ version: '0.2.26',
164
164
  contracts: {
165
165
  api: {
166
166
  name: 'sdk-http-api',
@@ -38,6 +38,13 @@ export class GatewayPostgresAdmission {
38
38
  #commitPriorityGrants = 0;
39
39
  #consecutiveCommitPriorityGrants = 0;
40
40
 
41
+ constructor(
42
+ private readonly limits: {
43
+ maxOrdinaryActive?: number;
44
+ maxTotalActive?: number;
45
+ } = {},
46
+ ) {}
47
+
41
48
  async acquire(
42
49
  lane: GatewayPostgresLane,
43
50
  options: { signal?: AbortSignal } = {},
@@ -95,10 +102,20 @@ export class GatewayPostgresAdmission {
95
102
  }
96
103
 
97
104
  #canGrant(lane: GatewayPostgresLane): boolean {
98
- if (this.#activeTotal() >= GATEWAY_POSTGRES_MAX_TOTAL_ACTIVE) return false;
105
+ if (this.#activeTotal() >= this.#maxTotalActive()) return false;
99
106
  return (
100
107
  lane === 'commit' ||
101
- this.#ordinaryActive < GATEWAY_POSTGRES_MAX_ORDINARY_ACTIVE
108
+ this.#ordinaryActive < this.#maxOrdinaryActive()
109
+ );
110
+ }
111
+
112
+ #maxTotalActive(): number {
113
+ return this.limits.maxTotalActive ?? GATEWAY_POSTGRES_MAX_TOTAL_ACTIVE;
114
+ }
115
+
116
+ #maxOrdinaryActive(): number {
117
+ return (
118
+ this.limits.maxOrdinaryActive ?? GATEWAY_POSTGRES_MAX_ORDINARY_ACTIVE
102
119
  );
103
120
  }
104
121
 
@@ -116,10 +133,10 @@ export class GatewayPostgresAdmission {
116
133
  }
117
134
 
118
135
  #drain(): void {
119
- while (this.#activeTotal() < GATEWAY_POSTGRES_MAX_TOTAL_ACTIVE) {
136
+ while (this.#activeTotal() < this.#maxTotalActive()) {
120
137
  const ordinaryCanRun =
121
138
  this.#waiting.ordinary.length > 0 &&
122
- this.#ordinaryActive < GATEWAY_POSTGRES_MAX_ORDINARY_ACTIVE;
139
+ this.#ordinaryActive < this.#maxOrdinaryActive();
123
140
  if (
124
141
  ordinaryCanRun &&
125
142
  this.#waiting.commit.length > 0 &&
@@ -1138,6 +1138,7 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
1138
1138
  }
1139
1139
  emitDaytonaStage(callbacks, config.context, 'execute:error', {
1140
1140
  sandboxId: sandboxCleanup.currentSandbox()?.id ?? null,
1141
+ runnerAttempt: Math.max(0, Math.floor(config.context.runAttempt ?? 0)),
1141
1142
  error: formatDaytonaError(error),
1142
1143
  operation: 'runner_backend',
1143
1144
  elapsedMs: Date.now() - startedAt,
@@ -1,6 +1,8 @@
1
1
  export const PLAY_RUNTIME_CONTRACT = 4;
2
2
  export const PLAY_RUNTIME_CONTRACT_MIN_SUPPORTED = 1;
3
3
  export const PLAY_RUNTIME_CONTRACT_HEADER = 'x-deepline-runtime-contract';
4
+ /** Shared runner/gateway envelope limit for unacknowledged progress recovery. */
5
+ export const RUNTIME_RUNNER_TERMINAL_PROGRESS_MAX_EVENTS = 2_000;
4
6
  /**
5
7
  * Opaque, per-request correlation key generated inside the sandbox runner.
6
8
  * It contains no customer data and lets gateway logs distinguish a request that
package/dist/cli/index.js CHANGED
@@ -1044,7 +1044,7 @@ var SDK_RELEASE = {
1044
1044
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1045
1045
  // exposed storage-dependent synchronous access. This deliberate minor
1046
1046
  // release keeps lazy paging semantics independent of row residency.
1047
- version: "0.2.24",
1047
+ version: "0.2.26",
1048
1048
  contracts: {
1049
1049
  api: {
1050
1050
  name: "sdk-http-api",
@@ -3631,7 +3631,12 @@ async function uploadStagedFileToPresignedUrl(input2) {
3631
3631
  break;
3632
3632
  }
3633
3633
  } catch (error) {
3634
- lastError = error;
3634
+ lastError = error instanceof TypeError ? new DeeplineError(
3635
+ `Direct storage upload of ${input2.logicalPath} could not reach the storage endpoint: ${error.message}`,
3636
+ void 0,
3637
+ "STAGED_FILE_UPLOAD_EGRESS_DENIED",
3638
+ { logicalPath: input2.logicalPath }
3639
+ ) : error;
3635
3640
  }
3636
3641
  if (attempt < STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS) {
3637
3642
  await sleep2(250 * attempt);
@@ -7832,11 +7837,14 @@ async function handleUsage(options) {
7832
7837
  `Last 30 days usage: ${last30Usage ?? "(unknown)"}`,
7833
7838
  ...Number.isFinite(temporaryHolds) && temporaryHolds > 0 ? [`Temporary holds: ${temporaryHolds}`] : [],
7834
7839
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
7840
+ ...options.runId && recent.run_id ? [
7841
+ `Run spend: ${(payload.run ?? {}).spent_credits ?? "(unknown)"} Deepline Credits`
7842
+ ] : [],
7835
7843
  ...recentUsageLines(
7836
7844
  Array.isArray(recent.entries) ? recent.entries : []
7837
7845
  ),
7838
7846
  ...typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? [
7839
- `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}`
7847
+ `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}${options.runId ? ` --run-id ${options.runId}` : ""}`
7840
7848
  ] : []
7841
7849
  ];
7842
7850
  printCommandEnvelope(
@@ -7991,7 +7999,7 @@ async function handleLedgerExportAll(options) {
7991
7999
  summary = summarizeLedgerRows(summary, rows);
7992
8000
  }
7993
8001
  const nextCursor = typeof payload.next_cursor === "string" && payload.next_cursor.length > 0 ? payload.next_cursor : null;
7994
- if (rows.length === 0 || payload.has_more !== true || nextCursor === null) {
8002
+ if (payload.has_more !== true || nextCursor === null) {
7995
8003
  break;
7996
8004
  }
7997
8005
  if (nextCursor === cursor) break;
@@ -8002,7 +8010,7 @@ async function handleLedgerExportAll(options) {
8002
8010
  output_path: outputPath,
8003
8011
  row_count: summary.row_count,
8004
8012
  net_delta_credits: summary.net_delta_credits,
8005
- scope: "current_auth_context",
8013
+ scope: "workspace",
8006
8014
  ...options.runId ? { run_id: options.runId } : {},
8007
8015
  render: {
8008
8016
  sections: [
@@ -8010,7 +8018,7 @@ async function handleLedgerExportAll(options) {
8010
8018
  title: "billing ledger",
8011
8019
  lines: [
8012
8020
  `Billing ledger written to ${outputPath}`,
8013
- `${summary.row_count} row(s) exported for the current auth context${options.runId ? ` and run ${options.runId}` : ""}.`,
8021
+ `${summary.row_count} row(s) exported for the active workspace${options.runId ? ` and run ${options.runId}` : ""}.`,
8014
8022
  `Net ledger delta: ${summary.net_delta_credits} Deepline Credits`
8015
8023
  ]
8016
8024
  }
@@ -8610,9 +8618,8 @@ Examples:
8610
8618
  "after",
8611
8619
  `
8612
8620
  Notes:
8613
- Read-only. Exports ledger rows for the current auth context. API-key auth is
8614
- scoped by the server to that API key; session auth is scoped to the active
8615
- workspace.
8621
+ Read-only. Exports every ledger row for the active workspace, including rows
8622
+ created without an API key.
8616
8623
 
8617
8624
  Examples:
8618
8625
  deepline billing ledger export all
@@ -8632,7 +8639,7 @@ Examples:
8632
8639
  "after",
8633
8640
  `
8634
8641
  Notes:
8635
- Pages through the ledger for the current auth context, writes CSV locally,
8642
+ Pages through the workspace ledger, writes CSV locally,
8636
8643
  then reports the row count and the net delta computed from delta_credits.
8637
8644
 
8638
8645
  Examples:
@@ -1030,7 +1030,7 @@ var SDK_RELEASE = {
1030
1030
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1031
1031
  // exposed storage-dependent synchronous access. This deliberate minor
1032
1032
  // release keeps lazy paging semantics independent of row residency.
1033
- version: "0.2.24",
1033
+ version: "0.2.26",
1034
1034
  contracts: {
1035
1035
  api: {
1036
1036
  name: "sdk-http-api",
@@ -3617,7 +3617,12 @@ async function uploadStagedFileToPresignedUrl(input2) {
3617
3617
  break;
3618
3618
  }
3619
3619
  } catch (error) {
3620
- lastError = error;
3620
+ lastError = error instanceof TypeError ? new DeeplineError(
3621
+ `Direct storage upload of ${input2.logicalPath} could not reach the storage endpoint: ${error.message}`,
3622
+ void 0,
3623
+ "STAGED_FILE_UPLOAD_EGRESS_DENIED",
3624
+ { logicalPath: input2.logicalPath }
3625
+ ) : error;
3621
3626
  }
3622
3627
  if (attempt < STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS) {
3623
3628
  await sleep2(250 * attempt);
@@ -7830,11 +7835,14 @@ async function handleUsage(options) {
7830
7835
  `Last 30 days usage: ${last30Usage ?? "(unknown)"}`,
7831
7836
  ...Number.isFinite(temporaryHolds) && temporaryHolds > 0 ? [`Temporary holds: ${temporaryHolds}`] : [],
7832
7837
  `Monthly limit: ${quota.enabled ? quota.monthly_credits_limit ?? "(unknown)" : "off"}`,
7838
+ ...options.runId && recent.run_id ? [
7839
+ `Run spend: ${(payload.run ?? {}).spent_credits ?? "(unknown)"} Deepline Credits`
7840
+ ] : [],
7833
7841
  ...recentUsageLines(
7834
7842
  Array.isArray(recent.entries) ? recent.entries : []
7835
7843
  ),
7836
7844
  ...typeof recent.next_cursor === "string" && recent.next_cursor.length > 0 ? [
7837
- `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}`
7845
+ `Next page: deepline billing usage --cursor ${recent.next_cursor}${options.limit ? ` --limit ${options.limit}` : ""}${options.runId ? ` --run-id ${options.runId}` : ""}`
7838
7846
  ] : []
7839
7847
  ];
7840
7848
  printCommandEnvelope(
@@ -7989,7 +7997,7 @@ async function handleLedgerExportAll(options) {
7989
7997
  summary = summarizeLedgerRows(summary, rows);
7990
7998
  }
7991
7999
  const nextCursor = typeof payload.next_cursor === "string" && payload.next_cursor.length > 0 ? payload.next_cursor : null;
7992
- if (rows.length === 0 || payload.has_more !== true || nextCursor === null) {
8000
+ if (payload.has_more !== true || nextCursor === null) {
7993
8001
  break;
7994
8002
  }
7995
8003
  if (nextCursor === cursor) break;
@@ -8000,7 +8008,7 @@ async function handleLedgerExportAll(options) {
8000
8008
  output_path: outputPath,
8001
8009
  row_count: summary.row_count,
8002
8010
  net_delta_credits: summary.net_delta_credits,
8003
- scope: "current_auth_context",
8011
+ scope: "workspace",
8004
8012
  ...options.runId ? { run_id: options.runId } : {},
8005
8013
  render: {
8006
8014
  sections: [
@@ -8008,7 +8016,7 @@ async function handleLedgerExportAll(options) {
8008
8016
  title: "billing ledger",
8009
8017
  lines: [
8010
8018
  `Billing ledger written to ${outputPath}`,
8011
- `${summary.row_count} row(s) exported for the current auth context${options.runId ? ` and run ${options.runId}` : ""}.`,
8019
+ `${summary.row_count} row(s) exported for the active workspace${options.runId ? ` and run ${options.runId}` : ""}.`,
8012
8020
  `Net ledger delta: ${summary.net_delta_credits} Deepline Credits`
8013
8021
  ]
8014
8022
  }
@@ -8608,9 +8616,8 @@ Examples:
8608
8616
  "after",
8609
8617
  `
8610
8618
  Notes:
8611
- Read-only. Exports ledger rows for the current auth context. API-key auth is
8612
- scoped by the server to that API key; session auth is scoped to the active
8613
- workspace.
8619
+ Read-only. Exports every ledger row for the active workspace, including rows
8620
+ created without an API key.
8614
8621
 
8615
8622
  Examples:
8616
8623
  deepline billing ledger export all
@@ -8630,7 +8637,7 @@ Examples:
8630
8637
  "after",
8631
8638
  `
8632
8639
  Notes:
8633
- Pages through the ledger for the current auth context, writes CSV locally,
8640
+ Pages through the workspace ledger, writes CSV locally,
8634
8641
  then reports the row count and the net delta computed from delta_credits.
8635
8642
 
8636
8643
  Examples:
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.24",
766
+ version: "0.2.26",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -3350,7 +3350,12 @@ async function uploadStagedFileToPresignedUrl(input) {
3350
3350
  break;
3351
3351
  }
3352
3352
  } catch (error) {
3353
- lastError = error;
3353
+ lastError = error instanceof TypeError ? new DeeplineError(
3354
+ `Direct storage upload of ${input.logicalPath} could not reach the storage endpoint: ${error.message}`,
3355
+ void 0,
3356
+ "STAGED_FILE_UPLOAD_EGRESS_DENIED",
3357
+ { logicalPath: input.logicalPath }
3358
+ ) : error;
3354
3359
  }
3355
3360
  if (attempt < STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS) {
3356
3361
  await sleep2(250 * attempt);
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.24",
692
+ version: "0.2.26",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -3276,7 +3276,12 @@ async function uploadStagedFileToPresignedUrl(input) {
3276
3276
  break;
3277
3277
  }
3278
3278
  } catch (error) {
3279
- lastError = error;
3279
+ lastError = error instanceof TypeError ? new DeeplineError(
3280
+ `Direct storage upload of ${input.logicalPath} could not reach the storage endpoint: ${error.message}`,
3281
+ void 0,
3282
+ "STAGED_FILE_UPLOAD_EGRESS_DENIED",
3283
+ { logicalPath: input.logicalPath }
3284
+ ) : error;
3280
3285
  }
3281
3286
  if (attempt < STAGE_DIRECT_UPLOAD_MAX_ATTEMPTS) {
3282
3287
  await sleep2(250 * attempt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {