deepline 0.1.201 → 0.1.203

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 (33) hide show
  1. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +30 -9
  2. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +25 -0
  3. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +139 -124
  4. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  5. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +17 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/bounded-dispatch.ts +52 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +154 -23
  8. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +10 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +16 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +121 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/governor/adaptive-admission.ts +6 -1
  12. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +22 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +86 -19
  14. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +141 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/governor/budget-state-backend.ts +43 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +129 -41
  17. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +40 -2
  18. package/dist/bundling-sources/shared_libs/play-runtime/receipt-completion-sink.ts +92 -33
  19. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +13 -5
  20. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +122 -120
  21. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +10 -8
  22. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +140 -32
  23. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +2 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +225 -29
  25. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +26 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +21 -0
  27. package/dist/bundling-sources/shared_libs/plays/dataset.ts +32 -10
  28. package/dist/cli/index.js +335 -77
  29. package/dist/cli/index.mjs +341 -83
  30. package/dist/index.js +3 -2
  31. package/dist/index.mjs +3 -2
  32. package/package.json +1 -1
  33. package/dist/bundling-sources/shared_libs/play-runtime/adaptive-tool-dispatcher.ts +0 -355
@@ -18,6 +18,7 @@ import type {
18
18
  import type { ExecutionPlan } from './execution-plan';
19
19
  import type { PlayRuntimeManifestMap } from '../plays/compiler-manifest';
20
20
  import type { PreloadedRuntimeDbSession } from './db-session';
21
+ import type { RuntimeAuthorityDescriptor } from './execution-capabilities';
21
22
  import type { PlayRunnerRuntimeTiming } from './protocol';
22
23
  import type { RuntimeTestPolicyOverrides } from './test-runtime-seams';
23
24
  import type { PlayRunInputPayload } from './play-input';
@@ -123,9 +124,21 @@ export type PlaySchedulerSubmitInput = {
123
124
  childPlayManifests?: PlayRuntimeManifestMap | null;
124
125
  playCallGovernance?: PlayCallGovernanceSnapshot | null;
125
126
  preloadedDbSessions?: PreloadedRuntimeDbSession[] | null;
127
+ /**
128
+ * Secret that decrypts `preloadedDbSessions` postgres URLs. Equals the run's
129
+ * original submit-time executor (authority) token that AES-GCM sealed the
130
+ * sessions. Held separately from `executorToken` because durable schedulers
131
+ * re-mint a per-attempt `executorToken` (adding `run_attempt`/capabilities
132
+ * claims) for API auth; that re-minted string is NOT valid decryption key
133
+ * material for sessions sealed under the original token. The worker/runner use
134
+ * this field for DB-session unwrap and the re-minted `executorToken` for auth.
135
+ */
136
+ preloadedDbSessionUnwrapKey?: string | null;
126
137
  /** Optional immutable Worker module source for local Dynamic Worker loading. */
127
138
  dynamicWorkerCode?: string | null;
128
139
  executorToken: string;
140
+ /** Immutable facts used by durable schedulers to mint a fresh leg token. */
141
+ runtimeAuthority: RuntimeAuthorityDescriptor;
129
142
  /**
130
143
  * Public app origin used by Workers to call Deepline runtime API routes.
131
144
  * When omitted, legacy schedulers fall back to baseUrl.
@@ -151,6 +164,14 @@ export type PlaySchedulerSubmitInput = {
151
164
  coordinatorInternalToken?: string | null;
152
165
  /** Runtime deploy generation/version that owns this run, when known. */
153
166
  runtimeDeployVersion?: string | null;
167
+ /**
168
+ * Absurd release lane that owns this run for its whole life (children, parks,
169
+ * wakes, retries). Stamped at launch by the absurd scheduler backend and
170
+ * persisted inside launch_json. The worker derives the run's queue from this,
171
+ * never from process-local config. Absent on pre-release launch rows, in which
172
+ * case the worker falls back to the dev-collapse id (today's queue).
173
+ */
174
+ absurdReleaseId?: string | null;
154
175
  /** Request-scoped Vercel Deployment Protection bypass for preview runtime callbacks. */
155
176
  vercelProtectionBypassToken?: string | null;
156
177
  /** Request-scoped, dev-only runtime fault injection header for black-box durability tests. */
@@ -4,6 +4,7 @@ const PLAY_DATASET_BRAND = Symbol.for('deepline.play.dataset');
4
4
  const NODE_INSPECT_CUSTOM = Symbol.for('nodejs.util.inspect.custom');
5
5
  const DEFAULT_MATERIALIZE_LIMIT = 10_000;
6
6
  export const PLAY_DATASET_EXECUTION_PAGE_ROWS = 1_000;
7
+ export const PLAY_DATASET_EXECUTION_PAGE_BYTES = 64 * 1024 * 1024;
7
8
 
8
9
  export type PlayDatasetKind = 'csv' | 'map';
9
10
 
@@ -545,6 +546,8 @@ export type MaterializePlayDatasetInputOptions<T> = {
545
546
 
546
547
  export type IteratePlayDatasetInputPagesOptions<T> = {
547
548
  pageSize?: number;
549
+ maxPageBytes?: number;
550
+ estimateRowBytes?: (row: T) => number;
548
551
  onRow?: (row: T, index: number) => void;
549
552
  };
550
553
 
@@ -560,21 +563,40 @@ export async function* iteratePlayDatasetInputPages<T>(
560
563
  options?: IteratePlayDatasetInputPagesOptions<T>,
561
564
  ): AsyncIterable<{ rows: T[]; offset: number }> {
562
565
  const pageSize = normalizeDatasetExecutionPageSize(options?.pageSize);
566
+ const maxPageBytes = Math.max(
567
+ 1,
568
+ Math.floor(options?.maxPageBytes ?? PLAY_DATASET_EXECUTION_PAGE_BYTES),
569
+ );
570
+ const estimateRowBytes =
571
+ options?.estimateRowBytes ??
572
+ ((row: T) => {
573
+ const serialized = JSON.stringify(row);
574
+ return serialized === undefined ? 0 : serialized.length;
575
+ });
563
576
  let page: T[] = [];
577
+ let pageBytes = 0;
564
578
  let offset = 0;
565
579
  let index = 0;
566
- const pushRow = (row: T): { rows: T[]; offset: number } | null => {
580
+ const pushRow = (row: T): Array<{ rows: T[]; offset: number }> => {
567
581
  options?.onRow?.(row, index);
568
582
  index += 1;
583
+ const rowBytes = Math.max(0, Math.ceil(estimateRowBytes(row)));
584
+ const ready: Array<{ rows: T[]; offset: number }> = [];
585
+ if (page.length > 0 && pageBytes + rowBytes > maxPageBytes) {
586
+ ready.push({ rows: page, offset });
587
+ offset += page.length;
588
+ page = [];
589
+ pageBytes = 0;
590
+ }
569
591
  page.push(row);
570
- if (page.length < pageSize) {
571
- return null;
592
+ pageBytes += rowBytes;
593
+ if (page.length >= pageSize || pageBytes >= maxPageBytes) {
594
+ ready.push({ rows: page, offset });
595
+ offset += page.length;
596
+ page = [];
597
+ pageBytes = 0;
572
598
  }
573
- const fullPage = page;
574
- const fullOffset = offset;
575
- page = [];
576
- offset += fullPage.length;
577
- return { rows: fullPage, offset: fullOffset };
599
+ return ready;
578
600
  };
579
601
 
580
602
  const flush = (): { rows: T[]; offset: number } | null => {
@@ -582,13 +604,13 @@ export async function* iteratePlayDatasetInputPages<T>(
582
604
  const finalPage = page;
583
605
  const finalOffset = offset;
584
606
  page = [];
607
+ pageBytes = 0;
585
608
  offset += finalPage.length;
586
609
  return { rows: finalPage, offset: finalOffset };
587
610
  };
588
611
 
589
612
  const emitRow = async function* (row: T) {
590
- const ready = pushRow(row);
591
- if (ready) yield ready;
613
+ for (const ready of pushRow(row)) yield ready;
592
614
  };
593
615
 
594
616
  if (isPlayDataset(input)) {