deepline 0.1.228 → 0.1.229

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 +76 -1842
  2. package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +0 -113
  3. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +81 -968
  4. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +1 -50
  5. package/dist/bundling-sources/sdk/src/release.ts +2 -2
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +67 -15
  7. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +84 -79
  8. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +152 -688
  9. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +3 -10
  10. package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +2 -2
  11. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +12 -47
  12. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +0 -2
  13. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +12 -200
  14. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +2 -17
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +6 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +28 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-execution-scope.ts +16 -64
  18. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -4
  19. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +37 -9
  20. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +0 -36
  21. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +3 -21
  22. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +9 -1
  23. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +2 -0
  24. package/dist/cli/index.js +2 -2
  25. package/dist/cli/index.mjs +2 -2
  26. package/dist/{compiler-manifest-BhgZ23A4.d.ts → compiler-manifest-CYcwzSOJ.d.mts} +2 -0
  27. package/dist/{compiler-manifest-BhgZ23A4.d.mts → compiler-manifest-CYcwzSOJ.d.ts} +2 -0
  28. package/dist/index.d.mts +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2 -2
  31. package/dist/index.mjs +2 -2
  32. package/dist/plays/bundle-play-file.d.mts +2 -2
  33. package/dist/plays/bundle-play-file.d.ts +2 -2
  34. package/package.json +1 -1
  35. package/dist/bundling-sources/apps/play-runner-workers/src/child-manifest-resolver.ts +0 -108
  36. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-await.ts +0 -374
  37. package/dist/bundling-sources/apps/play-runner-workers/src/child-play-submit.ts +0 -203
  38. package/dist/bundling-sources/shared_libs/play-runtime/child-execution-placement.ts +0 -14
  39. package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +0 -121
@@ -147,12 +147,6 @@ type CoordinatorTerminalState = {
147
147
  completedAt: number;
148
148
  };
149
149
 
150
- type CoordinatorChildTerminalState = {
151
- eventKey: string;
152
- data: unknown;
153
- storedAt: number;
154
- };
155
-
156
150
  type CoordinatorRunEvent =
157
151
  | {
158
152
  seq: number;
@@ -258,7 +252,6 @@ const WORKFLOW_DB_SESSIONS_KEY = 'db-sessions';
258
252
  const COORDINATOR_TRACE_KEY_PREFIX = 't:';
259
253
  const COORDINATOR_RUN_EVENT_KEY_PREFIX = 'e:';
260
254
  const COORDINATOR_TERMINAL_KEY = 'terminal';
261
- const COORDINATOR_CHILD_TERMINAL_KEY_PREFIX = 'child-terminal:';
262
255
  const COORDINATOR_RUN_EVENT_SEQUENCE_KEY = 'event-seq';
263
256
  const COORDINATOR_TRACE_MAX_ENTRIES = 200;
264
257
  const COORDINATOR_RUN_EVENT_MAX_ENTRIES = 500;
@@ -301,7 +294,6 @@ export class PlayDedup implements DurableObject {
301
294
  private waiters: Map<string, Set<(value: unknown) => void>> = new Map();
302
295
  private runEventWaiters: Set<(value: CoordinatorRunEvent) => void> =
303
296
  new Set();
304
- private childTerminalWaiters: Map<string, Set<() => void>> = new Map();
305
297
  // Per-(bucketId, ruleId) request-window state for the rate-state backend.
306
298
  // In-memory by design — see the RateRule doc block. Single-threaded DO access
307
299
  // makes this the same sliding-window algorithm as InMemoryRateStateBackend.
@@ -334,27 +326,6 @@ export class PlayDedup implements DurableObject {
334
326
  return `${toolId}:${inputHash}`;
335
327
  }
336
328
 
337
- private childTerminalKey(eventKey: string): string {
338
- return `${COORDINATOR_CHILD_TERMINAL_KEY_PREFIX}${eventKey}`;
339
- }
340
-
341
- private wakeChildTerminalWaiters(eventKey: string): void {
342
- const waiters = this.childTerminalWaiters.get(eventKey);
343
- if (!waiters) return;
344
- for (const resolve of waiters) {
345
- resolve();
346
- }
347
- this.childTerminalWaiters.delete(eventKey);
348
- }
349
-
350
- private async readChildTerminalState(
351
- eventKey: string,
352
- ): Promise<CoordinatorChildTerminalState | undefined> {
353
- return await this.state.storage.get<CoordinatorChildTerminalState>(
354
- this.childTerminalKey(eventKey),
355
- );
356
- }
357
-
358
329
  async fetch(req: Request): Promise<Response> {
359
330
  const url = new URL(req.url);
360
331
  try {
@@ -399,12 +370,6 @@ export class PlayDedup implements DurableObject {
399
370
  return await this.handleTerminalSet(req);
400
371
  case '/terminal-get':
401
372
  return await this.handleTerminalGet();
402
- case '/child-terminal-set':
403
- return await this.handleChildTerminalSet(req);
404
- case '/child-terminal-get':
405
- return await this.handleChildTerminalGet(req);
406
- case '/child-terminal-await':
407
- return await this.handleChildTerminalAwait(req);
408
373
  case '/rate-acquire':
409
374
  return await this.handleRateAcquire(req);
410
375
  case '/rate-penalize':
@@ -427,7 +392,6 @@ export class PlayDedup implements DurableObject {
427
392
  await this.state.storage.deleteAll();
428
393
  this.waiters.clear();
429
394
  this.runEventWaiters.clear();
430
- this.childTerminalWaiters.clear();
431
395
  }
432
396
 
433
397
  private async handleLookupOrClaim(req: Request): Promise<Response> {
@@ -1120,83 +1084,6 @@ export class PlayDedup implements DurableObject {
1120
1084
  });
1121
1085
  }
1122
1086
 
1123
- private async handleChildTerminalSet(req: Request): Promise<Response> {
1124
- const body = (await req.json().catch(() => null)) as {
1125
- eventKey?: unknown;
1126
- data?: unknown;
1127
- storedAt?: unknown;
1128
- } | null;
1129
- const eventKey =
1130
- typeof body?.eventKey === 'string' && body.eventKey.trim()
1131
- ? body.eventKey.trim()
1132
- : '';
1133
- if (!eventKey) {
1134
- return new Response('eventKey is required', { status: 400 });
1135
- }
1136
- const state: CoordinatorChildTerminalState = {
1137
- eventKey,
1138
- data: durableStorageRedactor.redact(body?.data ?? null),
1139
- storedAt:
1140
- typeof body?.storedAt === 'number' && Number.isFinite(body.storedAt)
1141
- ? body.storedAt
1142
- : Date.now(),
1143
- };
1144
- await this.state.storage.put(this.childTerminalKey(eventKey), state);
1145
- this.wakeChildTerminalWaiters(eventKey);
1146
- return new Response('{}', {
1147
- headers: { 'content-type': 'application/json' },
1148
- });
1149
- }
1150
-
1151
- private async handleChildTerminalGet(req: Request): Promise<Response> {
1152
- const eventKey = new URL(req.url).searchParams.get('eventKey')?.trim();
1153
- if (!eventKey) {
1154
- return new Response('eventKey is required', { status: 400 });
1155
- }
1156
- const state = await this.readChildTerminalState(eventKey);
1157
- return new Response(JSON.stringify({ state: state ?? null }), {
1158
- headers: { 'content-type': 'application/json' },
1159
- });
1160
- }
1161
-
1162
- private async handleChildTerminalAwait(req: Request): Promise<Response> {
1163
- const url = new URL(req.url);
1164
- const eventKey = url.searchParams.get('eventKey')?.trim();
1165
- if (!eventKey) {
1166
- return new Response('eventKey is required', { status: 400 });
1167
- }
1168
- const timeoutMs = Math.min(
1169
- Math.max(Number(url.searchParams.get('timeoutMs') ?? '0'), 0),
1170
- 30_000,
1171
- );
1172
- let state = await this.readChildTerminalState(eventKey);
1173
- if (!state && timeoutMs > 0) {
1174
- await new Promise<void>((resolve) => {
1175
- let settled = false;
1176
- let timeout: ReturnType<typeof setTimeout> | null = null;
1177
- const finish = () => {
1178
- if (settled) return;
1179
- settled = true;
1180
- this.childTerminalWaiters.get(eventKey)?.delete(finish);
1181
- if (this.childTerminalWaiters.get(eventKey)?.size === 0) {
1182
- this.childTerminalWaiters.delete(eventKey);
1183
- }
1184
- if (timeout) clearTimeout(timeout);
1185
- resolve();
1186
- };
1187
- timeout = setTimeout(finish, timeoutMs);
1188
- if (!this.childTerminalWaiters.has(eventKey)) {
1189
- this.childTerminalWaiters.set(eventKey, new Set());
1190
- }
1191
- this.childTerminalWaiters.get(eventKey)!.add(finish);
1192
- });
1193
- state = await this.readChildTerminalState(eventKey);
1194
- }
1195
- return new Response(JSON.stringify({ state: state ?? null }), {
1196
- headers: { 'content-type': 'application/json' },
1197
- });
1198
- }
1199
-
1200
1087
  /**
1201
1088
  * Lease up to `requested` request-window permits for `bucketId` under all
1202
1089
  * `rules`. Single-threaded DO access means this is the same sliding-window