deepline 0.2.55 → 0.2.56

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.
Files changed (41) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +14 -0
  2. package/dist/bundling-sources/sdk/src/http.ts +19 -1
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/stream-reconnect.ts +6 -0
  5. package/dist/bundling-sources/sdk/src/types.ts +7 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +146 -12
  7. package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +6 -3
  8. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +1631 -748
  9. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +20 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +81 -52
  11. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +146 -6
  12. package/dist/bundling-sources/shared_libs/play-runtime/gateway-auth-session.ts +56 -22
  13. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +14 -11
  14. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +21 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +81 -21
  16. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +7 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +21 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +27 -2
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +49 -10
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +96 -3
  22. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +341 -67
  23. package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +10 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-contract.ts +8 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-pg.ts +17 -2
  26. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver.ts +4 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +17 -1
  28. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +16 -2
  29. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +25 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +3 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +2 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +80 -1
  33. package/dist/bundling-sources/shared_libs/security/safe-fetch.ts +9 -0
  34. package/dist/bundling-sources/shared_libs/security/safe-outbound-fetch.ts +85 -48
  35. package/dist/cli/index.js +409 -51
  36. package/dist/cli/index.mjs +389 -25
  37. package/dist/index.d.mts +19 -1
  38. package/dist/index.d.ts +19 -1
  39. package/dist/index.js +29 -2
  40. package/dist/index.mjs +29 -2
  41. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -4,6 +4,7 @@ import '@sinclair/typebox';
4
4
 
5
5
  declare const FIXTURE_BEHAVIOR_VERSION: 1;
6
6
  declare const FIXTURE_BEHAVIOR_RESPONSE_VERSION: 2;
7
+ declare const FIXTURE_BEHAVIOR_REPLAY_VERSION: 3;
7
8
  type FixtureBehaviorV1 = {
8
9
  version: typeof FIXTURE_BEHAVIOR_VERSION;
9
10
  responseDelaySamplesMs: number[];
@@ -23,7 +24,17 @@ type FixtureBehaviorV2 = {
23
24
  version: typeof FIXTURE_BEHAVIOR_RESPONSE_VERSION;
24
25
  responseSamples: FixtureResponseSample[];
25
26
  };
26
- type FixtureBehavior = FixtureBehaviorV1 | FixtureBehaviorV2;
27
+ type FixtureReplayBundle = {
28
+ bundleId: string;
29
+ manifestSha256: string;
30
+ syntheticFallbackToolIds?: string[];
31
+ };
32
+ type FixtureBehaviorV3 = {
33
+ version: typeof FIXTURE_BEHAVIOR_REPLAY_VERSION;
34
+ responseSamples: FixtureResponseSample[];
35
+ replayBundle: FixtureReplayBundle;
36
+ };
37
+ type FixtureBehavior = FixtureBehaviorV1 | FixtureBehaviorV2 | FixtureBehaviorV3;
27
38
 
28
39
  type PlayRuntimeSelection = {
29
40
  environment: 'preview';
@@ -1567,6 +1578,13 @@ interface StartPlayRunRequest {
1567
1578
  force?: boolean;
1568
1579
  /** Explicit cache-bypass flag for durable dataset and tool-call reuse. */
1569
1580
  forceToolRefresh?: boolean;
1581
+ /**
1582
+ * Per-run ceiling for concurrently resident provider-tool executions and
1583
+ * direct ctx.fetch calls. The server validates the supported range.
1584
+ */
1585
+ maxConcurrentExternalCalls?: number;
1586
+ /** Run-wide default and ceiling for live dataset-map row resolvers. */
1587
+ maxConcurrentRows?: number;
1570
1588
  /** Optionally let the start request wait briefly and return a terminal result. */
1571
1589
  waitForCompletionMs?: number;
1572
1590
  /**
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import '@sinclair/typebox';
4
4
 
5
5
  declare const FIXTURE_BEHAVIOR_VERSION: 1;
6
6
  declare const FIXTURE_BEHAVIOR_RESPONSE_VERSION: 2;
7
+ declare const FIXTURE_BEHAVIOR_REPLAY_VERSION: 3;
7
8
  type FixtureBehaviorV1 = {
8
9
  version: typeof FIXTURE_BEHAVIOR_VERSION;
9
10
  responseDelaySamplesMs: number[];
@@ -23,7 +24,17 @@ type FixtureBehaviorV2 = {
23
24
  version: typeof FIXTURE_BEHAVIOR_RESPONSE_VERSION;
24
25
  responseSamples: FixtureResponseSample[];
25
26
  };
26
- type FixtureBehavior = FixtureBehaviorV1 | FixtureBehaviorV2;
27
+ type FixtureReplayBundle = {
28
+ bundleId: string;
29
+ manifestSha256: string;
30
+ syntheticFallbackToolIds?: string[];
31
+ };
32
+ type FixtureBehaviorV3 = {
33
+ version: typeof FIXTURE_BEHAVIOR_REPLAY_VERSION;
34
+ responseSamples: FixtureResponseSample[];
35
+ replayBundle: FixtureReplayBundle;
36
+ };
37
+ type FixtureBehavior = FixtureBehaviorV1 | FixtureBehaviorV2 | FixtureBehaviorV3;
27
38
 
28
39
  type PlayRuntimeSelection = {
29
40
  environment: 'preview';
@@ -1567,6 +1578,13 @@ interface StartPlayRunRequest {
1567
1578
  force?: boolean;
1568
1579
  /** Explicit cache-bypass flag for durable dataset and tool-call reuse. */
1569
1580
  forceToolRefresh?: boolean;
1581
+ /**
1582
+ * Per-run ceiling for concurrently resident provider-tool executions and
1583
+ * direct ctx.fetch calls. The server validates the supported range.
1584
+ */
1585
+ maxConcurrentExternalCalls?: number;
1586
+ /** Run-wide default and ceiling for live dataset-map row resolvers. */
1587
+ maxConcurrentRows?: number;
1570
1588
  /** Optionally let the start request wait briefly and return a terminal result. */
1571
1589
  waitForCompletionMs?: number;
1572
1590
  /**
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.55",
766
+ version: "0.2.56",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -1346,9 +1346,26 @@ var HttpClient = class {
1346
1346
  if (error instanceof AuthError || error instanceof DeeplineError) {
1347
1347
  throw error;
1348
1348
  }
1349
- lastError = error instanceof Error ? error : new Error(String(error));
1349
+ const normalized = error instanceof Error ? error : new Error(String(error));
1350
+ if (isAbortLikeError(normalized) && options?.signal?.aborted) {
1351
+ throw new DeeplineError(
1352
+ `Stream from ${this.config.baseUrl} was aborted by the caller.`,
1353
+ void 0,
1354
+ "ABORTED"
1355
+ );
1356
+ }
1357
+ lastError = normalized;
1350
1358
  }
1351
1359
  }
1360
+ if (lastError && isAbortLikeError(lastError)) {
1361
+ throw new DeeplineError(
1362
+ withCoworkNetworkHint(
1363
+ `Unable to stream from ${this.config.baseUrl}. The remote stream was interrupted.`
1364
+ ),
1365
+ void 0,
1366
+ "PLAY_STREAM_NETWORK_ABORTED"
1367
+ );
1368
+ }
1352
1369
  throw new DeeplineError(
1353
1370
  withCoworkNetworkHint(
1354
1371
  lastError?.message ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
@@ -1611,6 +1628,9 @@ function streamReconnectDelayMs(attempt) {
1611
1628
  return Math.max(1, Math.floor(Math.random() * (cappedExponentialMs + 1)));
1612
1629
  }
1613
1630
  function isTransientPlayStreamError(error) {
1631
+ if (error instanceof DeeplineError && error.code === "PLAY_STREAM_NETWORK_ABORTED") {
1632
+ return true;
1633
+ }
1614
1634
  if (error instanceof DeeplineError && typeof error.statusCode === "number") {
1615
1635
  return error.statusCode >= 500 && error.statusCode < 600;
1616
1636
  }
@@ -1763,6 +1783,7 @@ var RUNTIME_RECEIPT_OUTPUT_MAX_BYTES = 10 * 1024 * 1024;
1763
1783
  var RUNTIME_RECEIPT_COMPLETION_BUFFER_MAX_BYTES = 32 * 1024 * 1024;
1764
1784
  var RUNNER_TERMINAL_PUSH_MAX_BODY_BYTES = 16 * 1024 * 1024;
1765
1785
  var RUNTIME_RECEIPT_GATEWAY_BATCH_MAX_BYTES = 12 * 1024 * 1024;
1786
+ var RUNTIME_RECEIPT_WRITER_TARGET_BATCH_BYTES = 4 * 1024 * 1024;
1766
1787
  var RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES = 64 * 1024;
1767
1788
 
1768
1789
  // ../shared_libs/play-runtime/ledger-safe-payload.ts
@@ -4345,6 +4366,10 @@ var DeeplineClient = class {
4345
4366
  ...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
4346
4367
  ...request.force ? { force: true } : {},
4347
4368
  ...forceToolRefresh ? { forceToolRefresh: true } : {},
4369
+ ...typeof request.maxConcurrentExternalCalls === "number" ? {
4370
+ maxConcurrentExternalCalls: request.maxConcurrentExternalCalls
4371
+ } : {},
4372
+ ...typeof request.maxConcurrentRows === "number" ? { maxConcurrentRows: request.maxConcurrentRows } : {},
4348
4373
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
4349
4374
  // Profile selection is the API's job, not the CLI's. The server
4350
4375
  // defaults to absurd; callers normally omit this field.
@@ -4397,6 +4422,8 @@ var DeeplineClient = class {
4397
4422
  ...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
4398
4423
  ...request.force ? { force: true } : {},
4399
4424
  ...forceToolRefresh ? { forceToolRefresh: true } : {},
4425
+ ...typeof request.maxConcurrentExternalCalls === "number" ? { maxConcurrentExternalCalls: request.maxConcurrentExternalCalls } : {},
4426
+ ...typeof request.maxConcurrentRows === "number" ? { maxConcurrentRows: request.maxConcurrentRows } : {},
4400
4427
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
4401
4428
  ...request.profile ? { profile: request.profile } : {},
4402
4429
  ...integrationMode ? { integrationMode } : {},
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.55",
692
+ version: "0.2.56",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -1272,9 +1272,26 @@ var HttpClient = class {
1272
1272
  if (error instanceof AuthError || error instanceof DeeplineError) {
1273
1273
  throw error;
1274
1274
  }
1275
- lastError = error instanceof Error ? error : new Error(String(error));
1275
+ const normalized = error instanceof Error ? error : new Error(String(error));
1276
+ if (isAbortLikeError(normalized) && options?.signal?.aborted) {
1277
+ throw new DeeplineError(
1278
+ `Stream from ${this.config.baseUrl} was aborted by the caller.`,
1279
+ void 0,
1280
+ "ABORTED"
1281
+ );
1282
+ }
1283
+ lastError = normalized;
1276
1284
  }
1277
1285
  }
1286
+ if (lastError && isAbortLikeError(lastError)) {
1287
+ throw new DeeplineError(
1288
+ withCoworkNetworkHint(
1289
+ `Unable to stream from ${this.config.baseUrl}. The remote stream was interrupted.`
1290
+ ),
1291
+ void 0,
1292
+ "PLAY_STREAM_NETWORK_ABORTED"
1293
+ );
1294
+ }
1278
1295
  throw new DeeplineError(
1279
1296
  withCoworkNetworkHint(
1280
1297
  lastError?.message ? `Unable to stream from ${this.config.baseUrl}. ${lastError.message}` : `Unable to stream from ${this.config.baseUrl}.`
@@ -1537,6 +1554,9 @@ function streamReconnectDelayMs(attempt) {
1537
1554
  return Math.max(1, Math.floor(Math.random() * (cappedExponentialMs + 1)));
1538
1555
  }
1539
1556
  function isTransientPlayStreamError(error) {
1557
+ if (error instanceof DeeplineError && error.code === "PLAY_STREAM_NETWORK_ABORTED") {
1558
+ return true;
1559
+ }
1540
1560
  if (error instanceof DeeplineError && typeof error.statusCode === "number") {
1541
1561
  return error.statusCode >= 500 && error.statusCode < 600;
1542
1562
  }
@@ -1689,6 +1709,7 @@ var RUNTIME_RECEIPT_OUTPUT_MAX_BYTES = 10 * 1024 * 1024;
1689
1709
  var RUNTIME_RECEIPT_COMPLETION_BUFFER_MAX_BYTES = 32 * 1024 * 1024;
1690
1710
  var RUNNER_TERMINAL_PUSH_MAX_BODY_BYTES = 16 * 1024 * 1024;
1691
1711
  var RUNTIME_RECEIPT_GATEWAY_BATCH_MAX_BYTES = 12 * 1024 * 1024;
1712
+ var RUNTIME_RECEIPT_WRITER_TARGET_BATCH_BYTES = 4 * 1024 * 1024;
1692
1713
  var RUNNER_POST_TERMINAL_DIAGNOSTIC_MAX_BYTES = 64 * 1024;
1693
1714
 
1694
1715
  // ../shared_libs/play-runtime/ledger-safe-payload.ts
@@ -4271,6 +4292,10 @@ var DeeplineClient = class {
4271
4292
  ...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
4272
4293
  ...request.force ? { force: true } : {},
4273
4294
  ...forceToolRefresh ? { forceToolRefresh: true } : {},
4295
+ ...typeof request.maxConcurrentExternalCalls === "number" ? {
4296
+ maxConcurrentExternalCalls: request.maxConcurrentExternalCalls
4297
+ } : {},
4298
+ ...typeof request.maxConcurrentRows === "number" ? { maxConcurrentRows: request.maxConcurrentRows } : {},
4274
4299
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
4275
4300
  // Profile selection is the API's job, not the CLI's. The server
4276
4301
  // defaults to absurd; callers normally omit this field.
@@ -4323,6 +4348,8 @@ var DeeplineClient = class {
4323
4348
  ...request.packagedFiles?.length ? { packagedFiles: request.packagedFiles } : {},
4324
4349
  ...request.force ? { force: true } : {},
4325
4350
  ...forceToolRefresh ? { forceToolRefresh: true } : {},
4351
+ ...typeof request.maxConcurrentExternalCalls === "number" ? { maxConcurrentExternalCalls: request.maxConcurrentExternalCalls } : {},
4352
+ ...typeof request.maxConcurrentRows === "number" ? { maxConcurrentRows: request.maxConcurrentRows } : {},
4326
4353
  ...typeof request.waitForCompletionMs === "number" ? { waitForCompletionMs: request.waitForCompletionMs } : {},
4327
4354
  ...request.profile ? { profile: request.profile } : {},
4328
4355
  ...integrationMode ? { integrationMode } : {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.55",
3
+ "version": "0.2.56",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {