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
@@ -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.8',
163
+ version: '0.2.10',
164
164
  contracts: {
165
165
  api: {
166
166
  name: 'sdk-http-api',
@@ -328,6 +328,7 @@ type ProjectionStep = {
328
328
  nodeId: string;
329
329
  status?: string;
330
330
  label?: string;
331
+ artifactTableNamespace?: string | null;
331
332
  updatedAt?: number | null;
332
333
  progress?: PlayActivityProgress | null;
333
334
  };
@@ -490,6 +491,19 @@ export function projectPlayRunActivity(input: {
490
491
  )
491
492
  .sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))[0];
492
493
  if (pendingDataset) {
494
+ const activeDatasetStep = input.nodeStates?.find(
495
+ (candidate) =>
496
+ candidate.nodeId === input.activeNodeId &&
497
+ candidate.status === 'running' &&
498
+ candidate.artifactTableNamespace === pendingDataset.tableNamespace,
499
+ );
500
+ const datasetStep =
501
+ activeDatasetStep ??
502
+ input.nodeStates?.find(
503
+ (candidate) =>
504
+ candidate.artifactTableNamespace === pendingDataset.tableNamespace,
505
+ );
506
+ const datasetProgress = datasetStep?.progress ?? null;
493
507
  return projection(
494
508
  {
495
509
  schemaVersion: 1,
@@ -502,17 +516,20 @@ export function projectPlayRunActivity(input: {
502
516
  state: {
503
517
  kind: 'active',
504
518
  progress: {
505
- completed: pendingDataset.persistedRows,
519
+ completed:
520
+ datasetProgress?.completed ?? pendingDataset.persistedRows,
506
521
  total:
507
- typeof pendingDataset.succeededRows === 'number' ||
522
+ datasetProgress?.total ??
523
+ (typeof pendingDataset.succeededRows === 'number' ||
508
524
  typeof pendingDataset.failedRows === 'number'
509
525
  ? (pendingDataset.succeededRows ?? 0) +
510
526
  (pendingDataset.failedRows ?? 0)
511
- : undefined,
512
- failed: pendingDataset.failedRows,
527
+ : undefined),
528
+ failed: datasetProgress?.failed ?? pendingDataset.failedRows,
513
529
  },
514
530
  },
515
- observedAt: pendingDataset.updatedAt ?? observedAt,
531
+ observedAt:
532
+ datasetStep?.updatedAt ?? pendingDataset.updatedAt ?? observedAt,
516
533
  },
517
534
  now,
518
535
  );
@@ -367,17 +367,8 @@ function isRetryableAppRuntimeResponse(input: {
367
367
  // The app runtime may explicitly classify an otherwise-client-error status
368
368
  // as transient. Keep the structured delivery contract authoritative rather
369
369
  // than reducing every 4xx to permanent at the worker boundary.
370
- try {
371
- const parsed = JSON.parse(input.body) as unknown;
372
- if (
373
- parsed &&
374
- typeof parsed === 'object' &&
375
- !Array.isArray(parsed) &&
376
- (parsed as { retryable?: unknown }).retryable === true
377
- ) {
378
- return true;
379
- }
380
- } catch {}
370
+ const explicitRetryable = appRuntimeExplicitRetryable(input.body);
371
+ if (explicitRetryable !== null) return explicitRetryable;
381
372
  if (
382
373
  input.action === 'append_run_events' &&
383
374
  input.status === 500 &&
@@ -391,6 +382,19 @@ function isRetryableAppRuntimeResponse(input: {
391
382
  return isRetryableAppRuntimeResponseStatus(input.status);
392
383
  }
393
384
 
385
+ function appRuntimeExplicitRetryable(body: string): boolean | null {
386
+ try {
387
+ const parsed = JSON.parse(body) as unknown;
388
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
389
+ return null;
390
+ }
391
+ const retryable = (parsed as { retryable?: unknown }).retryable;
392
+ return typeof retryable === 'boolean' ? retryable : null;
393
+ } catch {
394
+ return null;
395
+ }
396
+ }
397
+
394
398
  function isRetryableAppRuntimeResponseStatus(status: number): boolean {
395
399
  return (
396
400
  status === 429 ||
@@ -1158,15 +1162,14 @@ async function postAppRuntimeApi<TResponse>(
1158
1162
  status: response.status,
1159
1163
  code,
1160
1164
  requestId,
1161
- // Immediate request retries are intentionally selective, but durable
1162
- // delivery must never classify an unrecognized upstream 5xx as poison.
1163
- retryable:
1164
- response.status >= 500 ||
1165
- isRetryableAppRuntimeResponse({
1166
- action: body.action,
1167
- status: response.status,
1168
- body: responseText,
1169
- }),
1165
+ // The structured response is authoritative even for a 5xx. Retrying an
1166
+ // explicitly deterministic database failure here turns one rejected SQL
1167
+ // statement into an unbounded outer-writer loop.
1168
+ retryable: isRetryableAppRuntimeResponse({
1169
+ action: body.action,
1170
+ status: response.status,
1171
+ body: responseText,
1172
+ }),
1170
1173
  detail: summarizeAppRuntimeErrorBody(responseText),
1171
1174
  boundaryLabel,
1172
1175
  });