deepline 0.1.208 → 0.1.210

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 (39) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +0 -2
  2. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +102 -138
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +2 -12
  4. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +12 -4
  5. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +25 -92
  6. package/dist/bundling-sources/sdk/src/client.ts +10 -0
  7. package/dist/bundling-sources/sdk/src/play.ts +2 -2
  8. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  9. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +16 -31
  10. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +18 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +4 -5
  12. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +316 -232
  13. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +16 -2
  14. package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +0 -5
  15. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +2 -4
  16. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +1 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +429 -102
  18. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +27 -5
  19. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +18 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +31 -12
  21. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +103 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +105 -10
  23. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +21 -1
  24. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +32 -86
  25. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +141 -2
  26. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +45 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +180 -447
  28. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +12 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +33 -1
  30. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +11 -0
  31. package/dist/bundling-sources/shared_libs/plays/artifact-kind-guard.ts +112 -0
  32. package/dist/cli/index.js +33 -8
  33. package/dist/cli/index.mjs +33 -8
  34. package/dist/index.d.mts +11 -2
  35. package/dist/index.d.ts +11 -2
  36. package/dist/index.js +26 -4
  37. package/dist/index.mjs +26 -4
  38. package/package.json +1 -1
  39. package/dist/bundling-sources/shared_libs/play-runtime/child-run-lifecycle.ts +0 -70
@@ -129,15 +129,6 @@ type RuntimeApiRequest =
129
129
  staticPipeline?: unknown;
130
130
  source?: 'published' | 'ad_hoc' | 'draft';
131
131
  }
132
- | {
133
- action: 'settle_inline_child_run';
134
- parentRunId: string;
135
- childRunId: string;
136
- childPlayName: string;
137
- status: 'completed' | 'failed' | 'cancelled';
138
- result?: unknown;
139
- error?: string | null;
140
- }
141
132
  | ({
142
133
  action: 'save_results';
143
134
  } & RuntimeSaveResults)
@@ -343,6 +334,16 @@ const APP_RUNTIME_API_RECEIPT_RETRY_DELAYS_MS = [
343
334
  const APP_RUNTIME_API_APPEND_RETRY_DELAYS_MS = [
344
335
  100, 250, 500, 1_000, 2_000, 4_000, 8_000,
345
336
  ] as const;
337
+ // Full jitter (AWS "equal jitter" variant): sleep a random amount in
338
+ // [delay/2, delay] so a thundering herd of sibling settlements that all lost the
339
+ // same OCC race do not re-collide in lockstep on the next attempt.
340
+ function applyRetryJitter(delayMs: number): number {
341
+ if (delayMs <= 0) {
342
+ return 0;
343
+ }
344
+ const half = delayMs / 2;
345
+ return Math.round(half + Math.random() * half);
346
+ }
346
347
  const APP_RUNTIME_API_DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
347
348
  const RUN_STATUS_LEDGER_SNAPSHOT_CACHE_LIMIT = 1_000;
348
349
  const runStatusLedgerSnapshots = new Map<string, PlayRunLedgerSnapshot>();
@@ -450,7 +451,7 @@ function summarizeAppRuntimeErrorBody(body: string): string {
450
451
  }
451
452
 
452
453
  export function isTransientAppRuntimeFailureBody(body: string): boolean {
453
- return /WorkerOverloaded|"\s*code\s*"\s*:\s*"\s*InternalServerError\s*"|Your request couldn't be completed\. Try again later\.|timeout exceeded when trying to connect|timed out|fetch failed|ECONNRESET|ECONNREFUSED|UND_ERR_CONNECT_TIMEOUT|tuple concurrently updated|RUNTIME_SCHEDULER_SATURATED|Runtime scheduler DB pool is saturated|Runtime scheduler DB circuit breaker is open/i.test(
454
+ return /WorkerOverloaded|"\s*code\s*"\s*:\s*"\s*InternalServerError\s*"|Your request couldn't be completed\. Try again later\.|timeout exceeded when trying to connect|timed out|fetch failed|ECONNRESET|ECONNREFUSED|UND_ERR_CONNECT_TIMEOUT|tuple concurrently updated|RUNTIME_SCHEDULER_SATURATED|Runtime scheduler DB pool is saturated|Runtime scheduler DB circuit breaker is open|OptimisticConcurrencyControlFailure|changed while this mutation was being run|Documents read from or written to the .* table changed while this mutation/i.test(
454
455
  body,
455
456
  );
456
457
  }
@@ -524,8 +525,7 @@ function isRetryableAppRuntimeAction(
524
525
  action === 'release_runtime_step_receipt' ||
525
526
  action === 'save_results' ||
526
527
  action === 'skip_runtime_step_receipt' ||
527
- action === 'start_inline_child_run' ||
528
- action === 'settle_inline_child_run'
528
+ action === 'start_inline_child_run'
529
529
  );
530
530
  }
531
531
 
@@ -679,7 +679,9 @@ async function postAppRuntimeApi<TResponse>(
679
679
  attempt < maxAttempts &&
680
680
  isRetryableAppRuntimeFetchError({ action: body.action, error })
681
681
  ) {
682
- await sleep(appRuntimeRetryDelayMs(body.action, attempt));
682
+ await sleep(
683
+ applyRetryJitter(appRuntimeRetryDelayMs(body.action, attempt)),
684
+ );
683
685
  continue;
684
686
  }
685
687
  throw new AppRuntimeApiTransportError({
@@ -702,7 +704,7 @@ async function postAppRuntimeApi<TResponse>(
702
704
  ) {
703
705
  await sleep(
704
706
  Math.max(
705
- appRuntimeRetryDelayMs(body.action, attempt),
707
+ applyRetryJitter(appRuntimeRetryDelayMs(body.action, attempt)),
706
708
  appRuntimeRetryAfterMs(response, responseText) ?? 0,
707
709
  ),
708
710
  );
@@ -1020,23 +1022,6 @@ export async function startRunViaAppRuntime(
1020
1022
  });
1021
1023
  }
1022
1024
 
1023
- export async function settleInlineChildRunViaAppRuntime(
1024
- context: WorkerRuntimeApiContext,
1025
- input: {
1026
- parentRunId: string;
1027
- childRunId: string;
1028
- childPlayName: string;
1029
- status: 'completed' | 'failed' | 'cancelled';
1030
- result?: unknown;
1031
- error?: string | null;
1032
- },
1033
- ): Promise<void> {
1034
- await postAppRuntimeApi<{ ok: true }>(context, {
1035
- action: 'settle_inline_child_run',
1036
- ...input,
1037
- });
1038
- }
1039
-
1040
1025
  export async function saveResultsViaAppRuntime(
1041
1026
  context: WorkerRuntimeApiContext,
1042
1027
  input: RuntimeSaveResults,
@@ -49,3 +49,21 @@ export function resolveChildExecutionStrategy(input: {
49
49
  }
50
50
  return { strategy: 'inline', reason: 'scalar_child' };
51
51
  }
52
+
53
+ /**
54
+ * Verbatim rejection message for a scheduling-required child invoked per row.
55
+ * Shared by the static preflight (`plays check`/publish gate) and the runtime
56
+ * launch guard so a dynamically-named child fails with the EXACT same text as a
57
+ * statically-provable one. See ADR 0013.
58
+ */
59
+ export function inlineChildScheduledInRowMessage(
60
+ childPlayName: string,
61
+ rowContextField: string,
62
+ ): string {
63
+ return (
64
+ `ctx.runPlay("${childPlayName}") runs per row in the "${rowContextField}" batch, ` +
65
+ 'but it is a scheduling-required child (it uses ctx.dataset()/ctx.csv(), waits on an ' +
66
+ 'event, or sets an explicit timeout). Row-scoped children must be scalar. ' +
67
+ 'Give the batch ONE dataset child at play level instead of fanning a scheduled run out per row.'
68
+ );
69
+ }
@@ -44,8 +44,7 @@ export interface ChildRunIdInputs {
44
44
  key?: string | null;
45
45
  /**
46
46
  * Canonical durable runPlay semantic key when the launching substrate has one.
47
- * In-process runtimes pass the same key used by durable receipts so row-scoped
48
- * receipt identity and child run identity cannot drift apart.
47
+ * This scopes each fresh child invocation to its parent call site and row.
49
48
  */
50
49
  runPlaySemanticKey?: string | null;
51
50
  /** Child input payload (semantic-fallback input). */
@@ -57,9 +56,9 @@ export interface ChildRunIdInputs {
57
56
  }
58
57
 
59
58
  /**
60
- * A failed durable runPlay receipt must launch a fresh child attempt while
61
- * ordinary submit retries keep attaching to the original child. The receipt
62
- * lease is the attempt fence, so it is the only extra identity required.
59
+ * A failed child launch must use a fresh attempt identity while ordinary
60
+ * transport retries keep attaching to the original child. The caller-provided
61
+ * lease is the attempt fence.
63
62
  */
64
63
  export function childSubmitIdempotencyKey(input: {
65
64
  receiptKey: string;