deepline 0.2.8 → 0.2.10

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 (22) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +22 -5
  3. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +23 -20
  4. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +470 -258
  5. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +2 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/db-session.ts +8 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +2 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +40 -7
  9. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +9 -3
  10. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +8 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +2 -21
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +75 -58
  13. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +22 -14
  14. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +52 -22
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +38 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +26 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +19 -6
  18. package/dist/cli/index.js +12 -5
  19. package/dist/cli/index.mjs +12 -5
  20. package/dist/index.js +12 -5
  21. package/dist/index.mjs +12 -5
  22. package/package.json +1 -1
@@ -1,3 +1,8 @@
1
+ import {
2
+ PLAY_RUNNER_TERMINAL_GRACE_SECONDS,
3
+ STANDARD_PLAY_RUNTIME_LIMIT_SECONDS,
4
+ } from './runtime-constants';
5
+
1
6
  export type PlayExecutionSuspension =
2
7
  | {
3
8
  kind: 'sleep';
@@ -57,6 +62,8 @@ export type PlayExecutionSuspension =
57
62
  heartbeatTimeoutMs: number;
58
63
  /** Overall run ceiling; the park timeout. */
59
64
  ceilingMs: number;
65
+ /** Launch-pinned user-code deadline. Missing on historical suspensions. */
66
+ runtimeLimitSeconds?: number;
60
67
  };
61
68
 
62
69
  export type DetachedRunnerSuspension = Extract<
@@ -64,6 +71,25 @@ export type DetachedRunnerSuspension = Extract<
64
71
  { kind: 'detached_runner' }
65
72
  >;
66
73
 
74
+ export function resolveDetachedRunnerRuntimeLimitSeconds(
75
+ suspension: Pick<
76
+ DetachedRunnerSuspension,
77
+ 'runtimeLimitSeconds' | 'ceilingMs'
78
+ >,
79
+ ): number {
80
+ if (
81
+ Number.isSafeInteger(suspension.runtimeLimitSeconds) &&
82
+ Number(suspension.runtimeLimitSeconds) > 0
83
+ ) {
84
+ return Number(suspension.runtimeLimitSeconds);
85
+ }
86
+ const legacyDerived =
87
+ (suspension.ceilingMs - PLAY_RUNNER_TERMINAL_GRACE_SECONDS * 1_000) / 1_000;
88
+ return Number.isSafeInteger(legacyDerived) && legacyDerived > 0
89
+ ? legacyDerived
90
+ : STANDARD_PLAY_RUNTIME_LIMIT_SECONDS;
91
+ }
92
+
67
93
  export class PlayExecutionSuspendedError extends Error {
68
94
  readonly suspension: PlayExecutionSuspension;
69
95
 
@@ -26,7 +26,7 @@ type ParsedRuntimeTestFaults =
26
26
 
27
27
  type RuntimeTestSeamContext = {
28
28
  internalTokenHeader?: string | null;
29
- syntheticRunHeader?: string | null;
29
+ verifiedSyntheticExecutor?: boolean;
30
30
  };
31
31
 
32
32
  type ParsedRuntimeTestFaultCounts =
@@ -44,6 +44,8 @@ type ValidatedRuntimeTestFaultHeader =
44
44
  export type RuntimeTestPolicyOverrides = {
45
45
  /** Opt-in bounded runner map latency profile for local/preview diagnosis. */
46
46
  mapLatencyProfile?: boolean;
47
+ /** Exercise provider pacing during fixture runs without dispatching provider traffic. */
48
+ enforceFixtureProviderPacing?: boolean;
47
49
  receiptLeaseTtlMs?: number;
48
50
  sheetAttemptLeaseMs?: number;
49
51
  heartbeatIntervalMs?: number;
@@ -117,10 +119,7 @@ function runtimeTestSeamsAuthorized(
117
119
  return (
118
120
  testRuntimeSeamsEnabled() ||
119
121
  internalTokenAllowsRuntimeSeams(context) ||
120
- Boolean(
121
- context?.syntheticRunHeader?.trim() &&
122
- context.syntheticRunHeader.trim() !== '0',
123
- )
122
+ context?.verifiedSyntheticExecutor === true
124
123
  );
125
124
  }
126
125
 
@@ -183,7 +182,8 @@ function parseRuntimeTestPolicyOverrides(
183
182
  (key) =>
184
183
  !RUNTIME_TEST_POLICY_MS_FIELDS.has(key) &&
185
184
  key !== 'workBudgetYieldLimits' &&
186
- key !== 'mapLatencyProfile',
185
+ key !== 'mapLatencyProfile' &&
186
+ key !== 'enforceFixtureProviderPacing',
187
187
  );
188
188
  if (unknownKeys.length > 0) {
189
189
  return {
@@ -200,6 +200,16 @@ function parseRuntimeTestPolicyOverrides(
200
200
  }
201
201
  overrides.mapLatencyProfile = record.mapLatencyProfile;
202
202
  }
203
+ if ('enforceFixtureProviderPacing' in record) {
204
+ if (typeof record.enforceFixtureProviderPacing !== 'boolean') {
205
+ return {
206
+ error:
207
+ 'testPolicyOverrides.enforceFixtureProviderPacing must be a boolean.',
208
+ };
209
+ }
210
+ overrides.enforceFixtureProviderPacing =
211
+ record.enforceFixtureProviderPacing;
212
+ }
203
213
  for (const field of RUNTIME_TEST_POLICY_MS_FIELDS) {
204
214
  if (!(field in record)) continue;
205
215
  const parsed = readPositiveIntegerField({
@@ -279,6 +289,7 @@ export function readRuntimeTestFaultRegistry(input: {
279
289
  headerValue: string | null;
280
290
  internalTokenHeader?: string | null;
281
291
  syntheticRunHeader?: string | null;
292
+ verifiedSyntheticExecutor?: boolean;
282
293
  }): ParsedRuntimeTestFaults {
283
294
  const headerValue = input.headerValue?.trim();
284
295
  if (!headerValue) {
@@ -320,6 +331,7 @@ export function validateRuntimeTestFaultHeader(input: {
320
331
  headerValue: string | null;
321
332
  internalTokenHeader?: string | null;
322
333
  syntheticRunHeader?: string | null;
334
+ verifiedSyntheticExecutor?: boolean;
323
335
  }): ValidatedRuntimeTestFaultHeader {
324
336
  const parsed = parseRuntimeTestFaultCounts(input);
325
337
  if (parsed.ok === false) {
@@ -332,6 +344,7 @@ export function parseRuntimeTestFaultCounts(input: {
332
344
  headerValue: string | null;
333
345
  internalTokenHeader?: string | null;
334
346
  syntheticRunHeader?: string | null;
347
+ verifiedSyntheticExecutor?: boolean;
335
348
  }): ParsedRuntimeTestFaultCounts {
336
349
  const headerValue = input.headerValue?.trim();
337
350
  if (!headerValue) {
package/dist/cli/index.js CHANGED
@@ -1040,7 +1040,7 @@ var SDK_RELEASE = {
1040
1040
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1041
1041
  // exposed storage-dependent synchronous access. This deliberate minor
1042
1042
  // release keeps lazy paging semantics independent of row residency.
1043
- version: "0.2.8",
1043
+ version: "0.2.10",
1044
1044
  contracts: {
1045
1045
  api: {
1046
1046
  name: "sdk-http-api",
@@ -2177,6 +2177,13 @@ function projectPlayRunActivity(input2) {
2177
2177
  (dataset) => dataset.phase === "registered" || dataset.complete !== true && dataset.phase !== "failed"
2178
2178
  ).sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))[0];
2179
2179
  if (pendingDataset) {
2180
+ const activeDatasetStep = input2.nodeStates?.find(
2181
+ (candidate) => candidate.nodeId === input2.activeNodeId && candidate.status === "running" && candidate.artifactTableNamespace === pendingDataset.tableNamespace
2182
+ );
2183
+ const datasetStep = activeDatasetStep ?? input2.nodeStates?.find(
2184
+ (candidate) => candidate.artifactTableNamespace === pendingDataset.tableNamespace
2185
+ );
2186
+ const datasetProgress = datasetStep?.progress ?? null;
2180
2187
  return projection(
2181
2188
  {
2182
2189
  schemaVersion: 1,
@@ -2189,12 +2196,12 @@ function projectPlayRunActivity(input2) {
2189
2196
  state: {
2190
2197
  kind: "active",
2191
2198
  progress: {
2192
- completed: pendingDataset.persistedRows,
2193
- total: typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0,
2194
- failed: pendingDataset.failedRows
2199
+ completed: datasetProgress?.completed ?? pendingDataset.persistedRows,
2200
+ total: datasetProgress?.total ?? (typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0),
2201
+ failed: datasetProgress?.failed ?? pendingDataset.failedRows
2195
2202
  }
2196
2203
  },
2197
- observedAt: pendingDataset.updatedAt ?? observedAt
2204
+ observedAt: datasetStep?.updatedAt ?? pendingDataset.updatedAt ?? observedAt
2198
2205
  },
2199
2206
  now
2200
2207
  );
@@ -1025,7 +1025,7 @@ var SDK_RELEASE = {
1025
1025
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1026
1026
  // exposed storage-dependent synchronous access. This deliberate minor
1027
1027
  // release keeps lazy paging semantics independent of row residency.
1028
- version: "0.2.8",
1028
+ version: "0.2.10",
1029
1029
  contracts: {
1030
1030
  api: {
1031
1031
  name: "sdk-http-api",
@@ -2162,6 +2162,13 @@ function projectPlayRunActivity(input2) {
2162
2162
  (dataset) => dataset.phase === "registered" || dataset.complete !== true && dataset.phase !== "failed"
2163
2163
  ).sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))[0];
2164
2164
  if (pendingDataset) {
2165
+ const activeDatasetStep = input2.nodeStates?.find(
2166
+ (candidate) => candidate.nodeId === input2.activeNodeId && candidate.status === "running" && candidate.artifactTableNamespace === pendingDataset.tableNamespace
2167
+ );
2168
+ const datasetStep = activeDatasetStep ?? input2.nodeStates?.find(
2169
+ (candidate) => candidate.artifactTableNamespace === pendingDataset.tableNamespace
2170
+ );
2171
+ const datasetProgress = datasetStep?.progress ?? null;
2165
2172
  return projection(
2166
2173
  {
2167
2174
  schemaVersion: 1,
@@ -2174,12 +2181,12 @@ function projectPlayRunActivity(input2) {
2174
2181
  state: {
2175
2182
  kind: "active",
2176
2183
  progress: {
2177
- completed: pendingDataset.persistedRows,
2178
- total: typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0,
2179
- failed: pendingDataset.failedRows
2184
+ completed: datasetProgress?.completed ?? pendingDataset.persistedRows,
2185
+ total: datasetProgress?.total ?? (typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0),
2186
+ failed: datasetProgress?.failed ?? pendingDataset.failedRows
2180
2187
  }
2181
2188
  },
2182
- observedAt: pendingDataset.updatedAt ?? observedAt
2189
+ observedAt: datasetStep?.updatedAt ?? pendingDataset.updatedAt ?? observedAt
2183
2190
  },
2184
2191
  now
2185
2192
  );
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.8",
766
+ version: "0.2.10",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -1900,6 +1900,13 @@ function projectPlayRunActivity(input) {
1900
1900
  (dataset) => dataset.phase === "registered" || dataset.complete !== true && dataset.phase !== "failed"
1901
1901
  ).sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))[0];
1902
1902
  if (pendingDataset) {
1903
+ const activeDatasetStep = input.nodeStates?.find(
1904
+ (candidate) => candidate.nodeId === input.activeNodeId && candidate.status === "running" && candidate.artifactTableNamespace === pendingDataset.tableNamespace
1905
+ );
1906
+ const datasetStep = activeDatasetStep ?? input.nodeStates?.find(
1907
+ (candidate) => candidate.artifactTableNamespace === pendingDataset.tableNamespace
1908
+ );
1909
+ const datasetProgress = datasetStep?.progress ?? null;
1903
1910
  return projection(
1904
1911
  {
1905
1912
  schemaVersion: 1,
@@ -1912,12 +1919,12 @@ function projectPlayRunActivity(input) {
1912
1919
  state: {
1913
1920
  kind: "active",
1914
1921
  progress: {
1915
- completed: pendingDataset.persistedRows,
1916
- total: typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0,
1917
- failed: pendingDataset.failedRows
1922
+ completed: datasetProgress?.completed ?? pendingDataset.persistedRows,
1923
+ total: datasetProgress?.total ?? (typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0),
1924
+ failed: datasetProgress?.failed ?? pendingDataset.failedRows
1918
1925
  }
1919
1926
  },
1920
- observedAt: pendingDataset.updatedAt ?? observedAt
1927
+ observedAt: datasetStep?.updatedAt ?? pendingDataset.updatedAt ?? observedAt
1921
1928
  },
1922
1929
  now
1923
1930
  );
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.8",
692
+ version: "0.2.10",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -1826,6 +1826,13 @@ function projectPlayRunActivity(input) {
1826
1826
  (dataset) => dataset.phase === "registered" || dataset.complete !== true && dataset.phase !== "failed"
1827
1827
  ).sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))[0];
1828
1828
  if (pendingDataset) {
1829
+ const activeDatasetStep = input.nodeStates?.find(
1830
+ (candidate) => candidate.nodeId === input.activeNodeId && candidate.status === "running" && candidate.artifactTableNamespace === pendingDataset.tableNamespace
1831
+ );
1832
+ const datasetStep = activeDatasetStep ?? input.nodeStates?.find(
1833
+ (candidate) => candidate.artifactTableNamespace === pendingDataset.tableNamespace
1834
+ );
1835
+ const datasetProgress = datasetStep?.progress ?? null;
1829
1836
  return projection(
1830
1837
  {
1831
1838
  schemaVersion: 1,
@@ -1838,12 +1845,12 @@ function projectPlayRunActivity(input) {
1838
1845
  state: {
1839
1846
  kind: "active",
1840
1847
  progress: {
1841
- completed: pendingDataset.persistedRows,
1842
- total: typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0,
1843
- failed: pendingDataset.failedRows
1848
+ completed: datasetProgress?.completed ?? pendingDataset.persistedRows,
1849
+ total: datasetProgress?.total ?? (typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0),
1850
+ failed: datasetProgress?.failed ?? pendingDataset.failedRows
1844
1851
  }
1845
1852
  },
1846
- observedAt: pendingDataset.updatedAt ?? observedAt
1853
+ observedAt: datasetStep?.updatedAt ?? pendingDataset.updatedAt ?? observedAt
1847
1854
  },
1848
1855
  now
1849
1856
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {