@ewhauser/world-celld 0.2.0 → 0.3.1

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.
package/dist/worker.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CreateEventRequest, Event, Hook, RunCreatedEventRequest, Step, TerminalWorkflowRunStatus, ValidQueueName, WorkflowRun } from "@workflow/world";
1
+ import { CreateEventParams, CreateEventRequest, Event, Hook, RunCreatedEventRequest, Step, TerminalWorkflowRunStatus, ValidQueueName, Wait, WorkflowRun } from "@workflow/world";
2
2
  //#region src/worker/router.d.ts
3
3
  /** Minimal structural DO namespace type (celld provides the real thing). */
4
4
  interface DONamespaceLike {
@@ -12,7 +12,10 @@ interface DONamespaceLike {
12
12
  interface WorkerEnv {
13
13
  WORKFLOW_DB: DONamespaceLike;
14
14
  WORKFLOW_STREAMS: DONamespaceLike;
15
- WORKFLOW_INDEX: DONamespaceLike;
15
+ WORKFLOW_RUN_CATALOG: DONamespaceLike;
16
+ WORKFLOW_RUN_FENCES: DONamespaceLike;
17
+ WORKFLOW_HOOK_TOKENS: DONamespaceLike;
18
+ WORKFLOW_HOOK_IDS: DONamespaceLike;
16
19
  WORKFLOW_QUEUE: DONamespaceLike;
17
20
  WORLD_SECRET?: string;
18
21
  }
@@ -30,6 +33,8 @@ interface CleanupRecord {
30
33
  dueAt: Date;
31
34
  queueShards: number;
32
35
  phase: CleanupPhase;
36
+ /** Optimistic-concurrency token for alarm/RPC work that awaits another cell. */
37
+ generation: number;
33
38
  attempts: number;
34
39
  lastError?: string;
35
40
  lastAttemptAt?: Date;
@@ -55,28 +60,30 @@ type RunReadOutcome<T> = {
55
60
  message: string;
56
61
  tombstone: RunTombstone;
57
62
  };
58
- interface HookIndexReference {
59
- hookId: string;
60
- token: string;
61
- }
62
- interface ExpireRunIndexesRequest {
63
- runId: string;
64
- keys: string[];
65
- hooks: HookIndexReference[];
66
- expiredAt: number;
67
- }
68
63
  interface ExpireRunIndexesResult {
69
64
  deleted: number;
70
65
  }
71
66
  interface ExpireRunStreamsResult {
72
67
  streams: string[];
73
68
  }
69
+ interface FinalizeRunStreamsResult {
70
+ /** Cumulative registry entries removed for this run. */
71
+ deleted: number;
72
+ done: boolean;
73
+ }
74
74
  interface ExpireStreamResult {
75
+ /** True only when this call installed the stream's expiration fence. */
75
76
  deleted: boolean;
77
+ /** Chunk rows removed by this bounded call. */
76
78
  chunks: number;
79
+ /** Payload bytes represented by the removed chunk rows. */
80
+ bytes: number;
81
+ done: boolean;
77
82
  }
78
83
  interface ExpireQueueRunResult {
84
+ /** Cumulative messages removed for this run in this queue shard. */
79
85
  deleted: number;
86
+ done: boolean;
80
87
  }
81
88
  interface ScheduleCleanupRequest {
82
89
  retentionMs: number;
@@ -88,18 +95,22 @@ interface ApplyEventRequest {
88
95
  /** The effective run id (already resolved / generated by the caller). */
89
96
  runId: string;
90
97
  data: CreateEventRequest | RunCreatedEventRequest;
98
+ /** Workflow 5 event-log position and preload options. */
99
+ params?: CreateEventParams;
91
100
  /**
92
- * Current holder of the hook token per the global KV token index
101
+ * Current holder of the hook token per the sharded token-ownership index
93
102
  * (hook_created only). `null` means the token is unclaimed.
94
103
  */
95
104
  tokenHolder?: {
96
105
  runId: string;
97
106
  hookId: string;
98
107
  } | null;
108
+ /** Exact token/ID reservation fenced on ambiguous-delivery resolution. */
109
+ hookClaimId?: string;
99
110
  /** Internal world-celld retention policy captured with the event. */
100
111
  cleanup?: ScheduleCleanupRequest;
101
112
  }
102
- type ApplyEventErrorCode = 'RUN_NOT_FOUND' | 'STEP_NOT_FOUND' | 'HOOK_NOT_FOUND' | 'ENTITY_CONFLICT' | 'RUN_EXPIRED' | 'TOO_EARLY' | 'RUN_NOT_SUPPORTED' | 'LEGACY_RUN_NOT_SUPPORTED';
113
+ type ApplyEventErrorCode = 'RUN_NOT_FOUND' | 'STEP_NOT_FOUND' | 'HOOK_NOT_FOUND' | 'WAIT_NOT_FOUND' | 'ENTITY_CONFLICT' | 'HOOK_CLAIM_CANCELLED' | 'RUN_EXPIRED' | 'TOO_EARLY' | 'RUN_NOT_SUPPORTED';
103
114
  interface ApplyEventFailure {
104
115
  ok: false;
105
116
  code: ApplyEventErrorCode;
@@ -116,7 +127,10 @@ interface ApplyEventSuccess {
116
127
  run?: WorkflowRun;
117
128
  step?: Step;
118
129
  hook?: Hook;
119
- /** Hooks whose tokens must be released from the global KV index. */
130
+ wait?: Wait;
131
+ /** True when a lazy step_started atomically created its step. */
132
+ stepCreated?: true;
133
+ /** Hooks whose token and ID indexes must be released. */
120
134
  releasedHooks: Array<{
121
135
  hookId: string;
122
136
  token: string;
@@ -126,15 +140,47 @@ interface ApplyEventSuccess {
126
140
  workflowName: string;
127
141
  createdAt: Date;
128
142
  };
129
- /** Set when the global KV hook index must be (re)written. */
143
+ /** Set when the sharded hook indexes must be (re)written. */
130
144
  hookToIndex?: Hook;
131
145
  /** All events (ascending), preloaded for run_started responses. */
132
146
  events?: Event[];
147
+ /** Pagination metadata required whenever events are returned. */
148
+ cursor?: string | null;
149
+ hasMore?: boolean;
150
+ /** Server-owned event ceiling advertised on run lifecycle writes. */
151
+ maxEvents?: number;
133
152
  }
134
153
  type ApplyEventOutcome = ApplyEventSuccess | ApplyEventFailure;
135
154
  //#endregion
155
+ //#region src/stream-protocol.d.ts
156
+ type StreamTerminalState = 'open' | 'closed' | 'errored' | 'expired';
157
+ interface StreamErrorData {
158
+ name: string;
159
+ message: string;
160
+ }
161
+ interface StreamWriteResult {
162
+ startIndex: number;
163
+ count: number;
164
+ tailIndex: number;
165
+ }
166
+ interface StreamReadRequest {
167
+ runId: string;
168
+ startIndex: number;
169
+ maxChunks: number;
170
+ maxBytes: number;
171
+ waitMs: number;
172
+ }
173
+ interface StreamReadResult {
174
+ startIndex: number;
175
+ tailIndex: number;
176
+ chunks: Uint8Array[];
177
+ state: StreamTerminalState;
178
+ timedOut: boolean;
179
+ error?: StreamErrorData;
180
+ }
181
+ //#endregion
136
182
  //#region src/queue.d.ts
137
- type Pathname = 'flow' | 'step';
183
+ type Pathname = 'flow';
138
184
  /**
139
185
  * Enqueue request accepted by a QueueDO cell. The message payload travels
140
186
  * pre-encoded with the shared tagged-JSON codec (`body`), so the cell can
@@ -157,7 +203,7 @@ interface EnqueueRequest {
157
203
  config: QueueCellConfig;
158
204
  }
159
205
  interface QueueCellConfig {
160
- /** Base URL of the app; deliveries POST to `${baseUrl}/.well-known/workflow/v1/{flow|step}`. */
206
+ /** Base URL of the app; deliveries POST to `${baseUrl}/.well-known/workflow/v1/flow`. */
161
207
  targetBaseUrl: string;
162
208
  queueShards: number;
163
209
  }
@@ -171,6 +217,35 @@ type EnqueueOutcome = {
171
217
  message: string;
172
218
  };
173
219
  //#endregion
220
+ //#region src/indexes.d.ts
221
+ interface IndexListOptions {
222
+ prefix?: string;
223
+ cursor?: string;
224
+ limit?: number;
225
+ reverse?: boolean;
226
+ }
227
+ interface IndexListPage {
228
+ keys: Array<{
229
+ name: string;
230
+ value: string;
231
+ }>;
232
+ list_complete: boolean;
233
+ cursor?: string;
234
+ }
235
+ type RunFenceStatus = 'active' | 'terminal' | 'expired';
236
+ interface RunFenceStub {
237
+ getStatus(): Promise<RunFenceStatus>;
238
+ fenceTerminal(at: number): Promise<RunFenceStatus>;
239
+ fenceExpired(at: number): Promise<RunFenceStatus>;
240
+ }
241
+ interface CellIdLike {
242
+ toString(): string;
243
+ }
244
+ interface CellNamespaceLike<T> {
245
+ idFromName(name: string): CellIdLike;
246
+ get(id: CellIdLike): T;
247
+ }
248
+ //#endregion
174
249
  //#region src/config.d.ts
175
250
  interface HookTokenOwner {
176
251
  runId: string;
@@ -193,53 +268,55 @@ declare class DurableObject<TEnv = unknown> {
193
268
  constructor(ctx: DurableObjectState, env: TEnv);
194
269
  }
195
270
  //#endregion
196
- //#region src/worker/durable-objects/IndexDO.d.ts
197
- /**
198
- * Global index cell, replacing the Workers KV namespace world-cloudflare
199
- * uses for run listing and hook token/id lookup.
200
- *
201
- * A single cell (named `index`) serializes every read and write. Hook-token
202
- * reservation, publication, and release use storage transactions so
203
- * concurrent runs cannot both acquire the same token.
204
- *
205
- * The RPC surface matches the storage-layer KVNamespace interface bit-for-bit
206
- * (including MockKVNamespace's pagination contract: cursor = last returned
207
- * key, `list_complete` reflects whether further keys exist), so the vendored
208
- * storage.ts works against it unchanged.
209
- */
210
- declare class IndexDO extends DurableObject {
211
- get(key: string): Promise<string | null>;
212
- put(key: string, value: string): Promise<void>;
213
- /** Publish a derived index only while its owning run is not expired. */
214
- putOwned(runId: string, key: string, value: string): Promise<{
271
+ //#region src/worker/durable-objects/hook-index-shared.d.ts
272
+ interface HookIndexEnv {
273
+ WORKFLOW_RUN_FENCES?: CellNamespaceLike<RunFenceStub>;
274
+ }
275
+ //#endregion
276
+ //#region src/worker/durable-objects/HookIdDO.d.ts
277
+ /** Hook-ID ownership and lookup shard; every hook ID has one transaction domain. */
278
+ declare class HookIdDO extends DurableObject<HookIndexEnv> {
279
+ get(hookId: string): Promise<string | null>;
280
+ reserve(hookId: string, owner: HookTokenOwner, proposedClaimId: string): Promise<{
281
+ claimed: true;
282
+ claimId: string;
283
+ } | {
284
+ claimed: false;
285
+ holder: HookTokenOwner;
286
+ }>;
287
+ publish(hookId: string, serializedHook: string, owner: HookTokenOwner, claimId?: string): Promise<{
215
288
  stored: boolean;
216
289
  }>;
217
- delete(key: string): Promise<void>;
218
- list(options?: {
219
- prefix?: string;
220
- cursor?: string;
221
- limit?: number;
222
- reverse?: boolean;
223
- }): Promise<{
224
- keys: Array<{
225
- name: string;
226
- }>;
227
- list_complete: boolean;
228
- cursor?: string;
290
+ releaseClaim(hookId: string, owner: HookTokenOwner, claimId: string): Promise<void>;
291
+ releaseBatch(hooks: Array<{
292
+ hookId: string;
293
+ owner: HookTokenOwner;
294
+ }>, fencedAt: number, runFenced: boolean): Promise<{
295
+ deleted: number;
229
296
  }>;
230
- reserveHookToken(token: string, owner: HookTokenOwner): Promise<{
231
- claimed: boolean;
232
- holder?: HookTokenOwner;
297
+ }
298
+ //#endregion
299
+ //#region src/worker/durable-objects/HookTokenDO.d.ts
300
+ /** Token-ownership shard. A token hashes to exactly one shard and transaction domain. */
301
+ declare class HookTokenDO extends DurableObject<HookIndexEnv> {
302
+ get(token: string): Promise<string | null>;
303
+ reserve(token: string, owner: HookTokenOwner, proposedClaimId: string): Promise<{
304
+ claimed: true;
305
+ claimId: string;
306
+ } | {
307
+ claimed: false;
308
+ holder: HookTokenOwner;
309
+ }>;
310
+ finalize(token: string, serializedHook: string, owner: HookTokenOwner, claimId?: string): Promise<{
311
+ stored: boolean;
312
+ }>;
313
+ releaseClaim(token: string, owner: HookTokenOwner, claimId: string): Promise<void>;
314
+ releaseBatch(hooks: Array<{
315
+ token: string;
316
+ owner: HookTokenOwner;
317
+ }>, fencedAt: number, runFenced: boolean): Promise<{
318
+ deleted: number;
233
319
  }>;
234
- finalizeHookIndexes(token: string, hookId: string, serializedHook: string, owner: HookTokenOwner): Promise<void>;
235
- releaseHookToken(token: string, owner: HookTokenOwner): Promise<void>;
236
- deleteHookIndexes(token: string, hookId: string, owner: HookTokenOwner): Promise<void>;
237
- /**
238
- * Fence a run and remove all of its known derived indexes atomically.
239
- * Once the fence exists, putOwned() and hook finalization cannot resurrect
240
- * entries from a delayed request.
241
- */
242
- expireRun(request: ExpireRunIndexesRequest): Promise<ExpireRunIndexesResult>;
243
320
  }
244
321
  //#endregion
245
322
  //#region src/worker/durable-objects/QueueDO.d.ts
@@ -255,7 +332,8 @@ declare class IndexDO extends DurableObject {
255
332
  * cfg pinned QueueCellConfig (first-enqueue wins)
256
333
  * msg:<messageId> MessageRow
257
334
  * due:<paddedMs>:<messageId> schedule index -> messageId
258
- * inflight:<messageId> crash-recovery deadline (epoch ms)
335
+ * inflight-deadline:<paddedMs>:<messageId>
336
+ * ordered crash-recovery index -> messageId
259
337
  * key:<idempotencyKey> active dedup claim -> messageId
260
338
  * dlq:<paddedMs>:<messageId> DeadLetterRow
261
339
  * run:<runId>:<messageId> QueueRunReference for retention cleanup
@@ -319,6 +397,7 @@ declare class QueueDO extends DurableObject {
319
397
  }>;
320
398
  purgeDeadLetters(): Promise<{
321
399
  purged: number;
400
+ hasMore: boolean;
322
401
  }>;
323
402
  /**
324
403
  * Recovery hatch for celld's six-failure alarm abandonment: derive the due
@@ -328,67 +407,78 @@ declare class QueueDO extends DurableObject {
328
407
  alarmAt: number | null;
329
408
  }>;
330
409
  /** Fence a run and purge every live, inflight, and dead-letter message it owns. */
331
- expireRun(runId: string, expiredAt: number): Promise<ExpireQueueRunResult>;
410
+ expireRun(runId: string, expiredAt: number, options?: {
411
+ limit?: number;
412
+ }): Promise<ExpireQueueRunResult>;
413
+ }
414
+ //#endregion
415
+ //#region src/worker/durable-objects/RunCatalogDO.d.ts
416
+ /** One of a fixed set of run-catalog shards, routed by the stable run ID hash. */
417
+ declare class RunCatalogDO extends DurableObject {
418
+ upsertRun(runId: string, keys: string[], serializedMetadata: string): Promise<{
419
+ stored: boolean;
420
+ }>;
421
+ list(options?: IndexListOptions): Promise<IndexListPage>;
422
+ expireRun(runId: string, keys: string[], expiredAt: number): Promise<ExpireRunIndexesResult>;
423
+ }
424
+ //#endregion
425
+ //#region src/worker/durable-objects/RunFenceDO.d.ts
426
+ /** Per-run lifecycle fence used by hook shards without a global lookup cell. */
427
+ declare class RunFenceDO extends DurableObject {
428
+ getStatus(): Promise<RunFenceStatus>;
429
+ fenceTerminal(at: number): Promise<RunFenceStatus>;
430
+ fenceExpired(at: number): Promise<RunFenceStatus>;
332
431
  }
333
432
  //#endregion
334
433
  //#region src/worker/durable-objects/StreamDO.d.ts
335
434
  /**
336
435
  * Durable Object backing workflow streams.
337
436
  *
338
- * Two roles, selected by the DO name:
339
- * - `stream:<name>`: chunk storage for a single stream. A monotonic
340
- * per-stream counter (maintained transactionally inside the DO) assigns
341
- * each chunk its index; one chunk per storage key.
342
- * - `run-streams:<runId>`: registry of stream names owned by a run,
343
- * powering `listStreamsByRunId`.
437
+ * Stream cells persist binary chunks under monotonic offset keys. Public
438
+ * reads are bounded long polls, and writes append a bounded ordered batch in
439
+ * one storage transaction. Per-run registry cells retain their existing role.
344
440
  */
345
441
  declare class StreamDO extends DurableObject {
442
+ private meta;
443
+ private metaLoad;
444
+ private mutationTail;
445
+ private changeVersion;
446
+ private readonly waiters;
346
447
  private getMeta;
347
448
  private assertOwner;
449
+ private assertWritable;
450
+ private runMutation;
451
+ private wakeReaders;
452
+ private waitForChange;
453
+ private readSnapshot;
454
+ /** Append one bounded binary batch with contiguous indexes. */
455
+ writeChunks(runId: string, chunks: Uint8Array[]): Promise<StreamWriteResult>;
348
456
  /**
349
- * Append a chunk. The index is allocated inside the transaction, so
350
- * concurrent writers can never collide or skip.
351
- */
352
- writeChunk(runId: string, data: Uint8Array): Promise<number>;
353
- /**
354
- * Close the stream (idempotent). Readers observe `done: true` once all
355
- * previously written chunks have been consumed.
457
+ * Return available binary chunks and terminal metadata in one bounded
458
+ * operation, waiting at most waitMs when the requested offset is idle.
356
459
  */
460
+ readChunks(request: StreamReadRequest, signal?: AbortSignal): Promise<StreamReadResult>;
461
+ /** Close idempotently; the first terminal state wins. */
357
462
  closeStream(runId: string): Promise<void>;
358
- /**
359
- * Read up to `limit` chunks starting at `startIndex` (0-based, inclusive).
360
- */
361
- getChunks(params: {
362
- startIndex: number;
363
- limit: number;
364
- }): Promise<{
365
- chunks: Uint8Array[];
366
- /** Whether the stream is closed. */
367
- done: boolean;
368
- /** Index of the last written chunk, -1 when empty. */
369
- tailIndex: number;
370
- }>;
371
- /**
372
- * Lightweight stream metadata: last chunk index and completion flag.
373
- */
374
- getInfo(): Promise<{
375
- tailIndex: number;
376
- done: boolean;
377
- }>;
378
- /**
379
- * Register a stream name against this per-run registry instance.
380
- */
463
+ /** Persist a terminal stream failure and wake every pending reader. */
464
+ failStream(runId: string, error: StreamErrorData | string): Promise<void>;
465
+ /** Register a stream name against this per-run registry instance. */
381
466
  registerStream(runId: string, name: string): Promise<void>;
382
- /**
383
- * List stream names registered against this per-run registry instance.
384
- */
385
467
  listStreams(): Promise<string[]>;
386
468
  /** Fence a run's registry before any stream cells are removed. */
387
- expireRegistry(runId: string, expiredAt: number): Promise<ExpireRunStreamsResult>;
388
- /** Remove the registry payload after every referenced stream was fenced. */
389
- finalizeRegistry(runId: string): Promise<void>;
390
- /** Delete stream payload while leaving a small ownership tombstone. */
391
- expireStream(runId: string, expiredAt: number): Promise<ExpireStreamResult>;
469
+ expireRegistry(runId: string, expiredAt: number, options?: {
470
+ limit?: number;
471
+ }): Promise<ExpireRunStreamsResult>;
472
+ /** Remove completed registry entries in a bounded, retry-safe batch. */
473
+ finalizeRegistry(runId: string, streams: string[]): Promise<FinalizeRunStreamsResult>;
474
+ /**
475
+ * Fence the stream and delete one bounded page. Listing size keys avoids
476
+ * loading payloads, and the transaction makes a crash retry resume safely.
477
+ */
478
+ expireStream(runId: string, expiredAt: number, options?: {
479
+ limit?: number;
480
+ byteLimit?: number;
481
+ }): Promise<ExpireStreamResult>;
392
482
  }
393
483
  //#endregion
394
484
  //#region src/worker/durable-objects/WorkflowRunDO.d.ts
@@ -403,13 +493,25 @@ declare class StreamDO extends DurableObject {
403
493
  * queue-message dedup claims (see claimInflight/releaseInflight).
404
494
  */
405
495
  declare class WorkflowRunDO extends DurableObject {
406
- private schemaReady;
407
496
  private now;
408
- private ensureSchema;
409
- private expiredTombstone;
497
+ private tombstoneFrom;
498
+ private retentionState;
410
499
  private read;
500
+ private readKey;
411
501
  /** Apply an event and capture all retention metadata in the same transaction. */
412
502
  applyEvent(request: ApplyEventRequest): Promise<ApplyEventOutcome>;
503
+ /**
504
+ * Resolve an ambiguous hook-creation RPC in the same serialization domain as
505
+ * applyEvent. If the hook is absent, the exact reservation is durably fenced
506
+ * before the caller releases its token and hook-ID claims.
507
+ */
508
+ resolveHookTokenClaim(request: {
509
+ hookId: string;
510
+ token: string;
511
+ claimId: string;
512
+ }): Promise<{
513
+ committed: boolean;
514
+ }>;
413
515
  getRun(): Promise<RunReadOutcome<WorkflowRun | null>>;
414
516
  getStep(stepId: string): Promise<RunReadOutcome<Step | null>>;
415
517
  listSteps(params?: {
@@ -447,10 +549,20 @@ declare class WorkflowRunDO extends DurableObject {
447
549
  rearmCleanup(): Promise<CleanupRecord | null>;
448
550
  alarm(): Promise<void>;
449
551
  private namespace;
552
+ private workflowIndex;
450
553
  private setCleanupPhase;
554
+ private executeScheduledCleanupPage;
451
555
  private executeCleanup;
556
+ private executeTerminalCleanup;
557
+ private deleteTerminalHookPage;
558
+ private deleteTerminalHookMarkerPage;
559
+ private deleteTerminalWaitPage;
560
+ private deleteIndexPage;
561
+ private deleteStreamPage;
562
+ private deleteQueuePage;
452
563
  private deletePayloadBatch;
453
564
  private recordCleanupFailure;
565
+ private recordTerminalCleanupFailure;
454
566
  claimInflight(params: {
455
567
  messageId: string;
456
568
  staleMs: number;
@@ -465,5 +577,5 @@ declare const _default: {
465
577
  fetch(request: Request, env: WorkerEnv): Promise<Response>;
466
578
  };
467
579
  //#endregion
468
- export { IndexDO, QueueDO, StreamDO, type WorkerEnv, WorkflowRunDO, createRouter, _default as default };
580
+ export { HookIdDO, HookTokenDO, QueueDO, RunCatalogDO, RunFenceDO, StreamDO, type WorkerEnv, WorkflowRunDO, createRouter, _default as default };
469
581
  //# sourceMappingURL=worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","names":[],"sources":["../src/worker/router.ts","../src/retention.ts","../src/apply-event.ts","../src/queue.ts","../src/config.ts","../src/worker/do-base.ts","../src/worker/durable-objects/IndexDO.ts","../src/worker/durable-objects/QueueDO.ts","../src/worker/durable-objects/StreamDO.ts","../src/worker/durable-objects/WorkflowRunDO.ts","../src/worker/worker.ts"],"mappings":";;;UAmBiB;EACf,WAAW;IAAiB;;EAC5B,IAAI;IAAM;;;UAGK;EACf,aAAa;EACb,kBAAkB;EAClB,gBAAgB;EAChB,gBAAgB;EAChB;;iBA6Fc,aAAa,KAAK,aAAS,SAClB,YAAU,Q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,MAAM;IAAS;IAAuB;;EAe7D,UAAU;IACd;IACA;IACA;MACE,QAAQ;IAAiB,MAAM;IAAQ;IAAuB;;EAe5D,oBAAoB,QAAQ;;EAM5B,gBAAgB,SAAS,yBAAyB,QAAQ;EAkC1D,WAAW,SAAS,yBAAyB,QAAQ;EAsBrD,gBAAgB,QAAQ;EAYxB,SAAS;UASP;UAQM;UAkBA;UAwFA;UAoCA;EAgBR,cAAc;IAClB;IACA;MACE;IAAU;;EAiBR,mBAAmB;;;;;EC7mBnB,MAAK,SAAU,SAAO,KAAO,YAAY,QAAQ"}
1
+ {"version":3,"file":"worker.d.ts","names":[],"sources":["../src/worker/router.ts","../src/retention.ts","../src/apply-event.ts","../src/stream-protocol.ts","../src/queue.ts","../src/indexes.ts","../src/config.ts","../src/worker/do-base.ts","../src/worker/durable-objects/hook-index-shared.ts","../src/worker/durable-objects/HookIdDO.ts","../src/worker/durable-objects/HookTokenDO.ts","../src/worker/durable-objects/QueueDO.ts","../src/worker/durable-objects/RunCatalogDO.ts","../src/worker/durable-objects/RunFenceDO.ts","../src/worker/durable-objects/StreamDO.ts","../src/worker/durable-objects/WorkflowRunDO.ts","../src/worker/worker.ts"],"mappings":";;;UA+CiB;EACf,WAAW;IAAiB;;EAC5B,IAAI;IAAM;;;UAGK;EACf,aAAa;EACb,kBAAkB;EAClB,sBAAsB;EACtB,qBAAqB;EACrB,sBAAsB;EACtB,mBAAmB;EACnB,gBAAgB;EAChB;;iBA6Ic,aAAa,KAAK,aAAS,SAClB,YAAU,QAAQ;;;KCnM/B;UAEK;EACf;EACA;EACA;EACA,WAAW;EACX,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;EACA,OAAO;;EAEP;EACA;EACA;EACA,gBAAgB;EAChB,eAAe;EACf;EACA;EACA;;UAGe;EACf;EACA;EACA,gBAAgB;EAChB,aAAa;EACb,WAAW;EACX,cAAc;;KAGJ,eAAe;EACrB;EAAU,OAAO;;EACjB;EAAW;EAAqB;EAAiB,WAAW;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