@ewhauser/world-celld 0.7.0 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.8.0 (2026-09-27)
6
+
7
+ ## What's Changed
8
+ * test(perf): add a run-bearing mode to the MinIO queue benchmark by @ewhauser in https://github.com/ewhauser/world-celld/pull/78
9
+ * feat(queue): accept inline run-bearing Queue bodies at delivery by @ewhauser in https://github.com/ewhauser/world-celld/pull/79
10
+ * feat(queue): support run-scoped Queue idempotency claims by @ewhauser in https://github.com/ewhauser/world-celld/pull/81
11
+ * perf(queue): keep small run-bearing bodies inline in the broker by @ewhauser in https://github.com/ewhauser/world-celld/pull/80
12
+ * perf(queue): keep new runs' idempotency claims in the run cell by @ewhauser in https://github.com/ewhauser/world-celld/pull/82
13
+ * feat(streams): read, append, and expire segment-layout streams by @ewhauser in https://github.com/ewhauser/world-celld/pull/83
14
+ * perf(streams): store new streams in segment rows by @ewhauser in https://github.com/ewhauser/world-celld/pull/84
15
+ * chore(deps): bump zizmorcore/zizmor-action from 0.6.3 to 0.6.4 in the github-actions group across 1 directory by @dependabot[bot] in https://github.com/ewhauser/world-celld/pull/62
16
+ * test(smoke): keep the retention-restart Queue payload in object storage by @ewhauser in https://github.com/ewhauser/world-celld/pull/85
17
+ * Limit Dependabot to security updates by @ewhauser in https://github.com/ewhauser/world-celld/pull/63
18
+
19
+
20
+ **Full Changelog**: https://github.com/ewhauser/world-celld/compare/v0.7.0...v0.8.0
21
+
5
22
  ## 0.7.0 (2026-09-27)
6
23
 
7
24
  ## What's Changed
package/dist/index.d.ts CHANGED
@@ -323,10 +323,19 @@ interface NativeQueueEnvelope {
323
323
  runId?: string;
324
324
  idempotencyKey?: string;
325
325
  payloadKey?: string;
326
- /** Inline only for the small, run-less health-check envelope. */
326
+ /**
327
+ * Inline body. Health checks always travel inline; a run-bearing body may
328
+ * travel inline when it is small and carries no user data, in which case
329
+ * delivery checks the run's expiry instead of reading a payload object.
330
+ */
327
331
  body?: string;
328
332
  /** Absolute workflow redelivery deadline; long waits are chained by the consumer. */
329
333
  notBefore?: number;
334
+ /**
335
+ * Where the idempotency claim lives. Absent: the claim cell named by queue
336
+ * and key. `run`: an entry in the run's own cell (requires `runId`).
337
+ */
338
+ claimScope?: 'run';
330
339
  /** Failed deliveries carried across suspension re-publishes. */
331
340
  deliveryFailures?: number;
332
341
  suspensionCount?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/retention.ts","../src/apply-event.ts","../src/storage.ts","../src/stream-protocol.ts","../src/streamer.ts","../src/queue-protocol.ts","../src/queue.ts","../src/run-list.ts","../src/indexes.ts","../src/config.ts","../src/index.ts"],"mappings":";;KAOY;UAEK;EACf;EACA;EACA;EACA,WAAW;;EAEX,SAAS;;EAET,cAAc;;EAEd,iBAAiB;EACjB;EACA,OAAO;EACP,OAAO;;EAEP;EACA;EACA;EACA,gBAAgB;EAChB,eAAe;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA,SAAS;EACT,cAAc;EACd,iBAAiB;EACjB,WAAW;EACX,cAAc;;EAEd,SAAS;;KAGC;KAEA,eAAe;EACrB;EAAU,OAAO;;EACjB;EAAW;EAAqB;EAAiB,WAAW;;UAEjD;EACf;EACA;;UAae;EACf;EACA,OAAO;;UAGQ;EACf;;UAGe;EACf;EACA,OAAO;EACP;;UAGe;EACf;;UAGe;EACf;;UAGe;;EAEf;EACA;;UAGe;;EAEf;;EAEA;;EAEA;EACA;;UAGe;EACf;;;;UC0Ce;;EAEf;EACA,MAAM,qBAAqB;;EAE3B,SAAS;;;;;EAKT;IAAgB;IAAe;;;EAE/B;;EAEA,UAAU;;KAiFA;UAWK;EACf;EACA,MAAM;EACN;;EAEA;;EAEA;;UAGe;EACf;;EAEA,QAAQ;EACR,MAAM;EACN,OAAO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,QAAQ;EAChE,UAAU,SAAS,0BAA0B,QAAQ;;;;;KChI3C,iBAAiB;UAEZ;EACf;EACA;;UAGe;EACf,aAAa;EACb,gBAAgB;EAChB,gBAAgB;EAChB,kBAAkB;;UAGH;;;;;;;EAOf;;;;;EAKA;;;;;EAKA,MAAM;;EAEN;;;;;;EAMA;;;;;;EAMA;;EAEA;;EAEA;;EAEA;;;;UCpBe;EACf,UAAU,gBAAgB,QAAQ;EAClC,SAAS,gBAAgB,QAAQ;EACjC,WAAW,gBAAgB,QAAQ;EACnC,MAAM,gBAAgB,QAAQ;;KAGpB,aAAa,QAAQ;EAAkB,WAAW;;iBAS9C,iBAAiB,SAAS,mBAAmB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/retention.ts","../src/apply-event.ts","../src/storage.ts","../src/stream-protocol.ts","../src/streamer.ts","../src/queue-protocol.ts","../src/queue.ts","../src/run-list.ts","../src/indexes.ts","../src/config.ts","../src/index.ts"],"mappings":";;KAOY;UAEK;EACf;EACA;EACA;EACA,WAAW;;EAEX,SAAS;;EAET,cAAc;;EAEd,iBAAiB;EACjB;EACA,OAAO;EACP,OAAO;;EAEP;EACA;EACA;EACA,gBAAgB;EAChB,eAAe;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA,SAAS;EACT,cAAc;EACd,iBAAiB;EACjB,WAAW;EACX,cAAc;;EAEd,SAAS;;KAGC;KAEA,eAAe;EACrB;EAAU,OAAO;;EACjB;EAAW;EAAqB;EAAiB,WAAW;;UAEjD;EACf;EACA;;UAae;EACf;EACA,OAAO;;UAGQ;EACf;;UAGe;EACf;EACA,OAAO;EACP;;UAGe;EACf;;UAGe;EACf;;UAGe;;EAEf;EACA;;UAGe;;EAEf;;EAEA;;EAEA;EACA;;UAGe;EACf;;;;UC0Ce;;EAEf;EACA,MAAM,qBAAqB;;EAE3B,SAAS;;;;;EAKT;IAAgB;IAAe;;;EAE/B;;EAEA,UAAU;;KAiFA;UAWK;EACf;EACA,MAA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,cAAc,kBACb;EACH,uBACE,eACA,OAAO,gBACP,aAAa,kBACZ;EACH,mBAAmB,SAAS,4BAA4B,QAAQ;EAChE,UAAU,SAAS,0BAA0B,QAAQ;;;;;KChI3C,iBAAiB;UAEZ;EACf;EACA;;UAGe;EACf,aAAa;EACb,gBAAgB;EAChB,gBAAgB;EAChB,kBAAkB;;UAGH;;;;;;;EAOf;;;;;EAKA;;;;;EAKA,MAAM;;EAEN;;;;;;EAMA;;;;;;EAMA;;EAEA;;EAEA;;EAEA;;;;UCpBe;EACf,UAAU,gBAAgB,QAAQ;EAClC,SAAS,gBAAgB,QAAQ;EACjC,WAAW,gBAAgB,QAAQ;EACnC,MAAM,gBAAgB,QAAQ;;KAGpB,aAAa,QAAQ;EAAkB,WAAW;;iBAS9C,iBAAiB,SAAS,mBAAmB"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as STREAM_BATCH_CONTENT_TYPE, C as MAX_QUEUE_DELIVERY_TIMEOUT_MS, D as checkedQueueTimestampAdd, E as boundedIntegerOption, F as MAX_STREAM_ERROR_BYTES, H as decodeStreamReadResult, I as MAX_STREAM_LONG_POLL_MS, J as isChunkLimitRejection, K as encodeStreamWriteBatch, L as MAX_STREAM_READ_BYTES, M as strictIntegerSetting, N as MAX_STREAM_BATCH_BYTES, P as MAX_STREAM_CHUNK_BYTES, R as MAX_STREAM_READ_CHUNKS, S as MAX_FLEET_RPC_TIMEOUT_MS, V as STREAM_CHUNK_LIMIT_HEADER, W as decodeStreamWriteResult, Y as normalizeStreamError, _ as createWorkflowIndex, a as nativeQueueDelaySeconds, f as compact, g as stringify, h as parse, j as queueDelayDeadline, m as rpcStringify, n as listRunsPage, p as rpcParse, v as runIndexMetadata, w as MAX_QUEUE_DERIVED_DEADLINE_HEADROOM_MS, z as MAX_STREAM_WRITE_CHUNKS } from "./run-list-B__jKuE7.js";
1
+ import { B as MAX_STREAM_WRITE_CHUNKS, C as MAX_FLEET_RPC_TIMEOUT_MS, D as boundedIntegerOption, F as MAX_STREAM_CHUNK_BYTES, G as decodeStreamWriteResult, H as STREAM_CHUNK_LIMIT_HEADER, I as MAX_STREAM_ERROR_BYTES, L as MAX_STREAM_LONG_POLL_MS, M as queueDelayDeadline, N as strictIntegerSetting, O as checkedQueueTimestampAdd, P as MAX_STREAM_BATCH_BYTES, R as MAX_STREAM_READ_BYTES, T as MAX_QUEUE_DERIVED_DEADLINE_HEADROOM_MS, U as decodeStreamReadResult, V as STREAM_BATCH_CONTENT_TYPE, X as normalizeStreamError, Y as isChunkLimitRejection, _ as stringify, g as parse, h as rpcStringify, m as rpcParse, n as listRunsPage, o as nativeQueueDelaySeconds, p as compact, q as encodeStreamWriteBatch, v as createWorkflowIndex, w as MAX_QUEUE_DELIVERY_TIMEOUT_MS, y as runIndexMetadata, z as MAX_STREAM_READ_CHUNKS } from "./run-list-C987PkJ2.js";
2
2
  import { CreateEventSchema, EventSchema, HookSchema, MessageId, QueuePayloadSchema, SPEC_VERSION_CURRENT, StepSchema, WaitSchema, WorkflowRunSchema, parseQueueName } from "@workflow/world";
3
3
  import { EntityConflictError, HookNotFoundError, RunExpiredError, RunNotSupportedError, TooEarlyError, WorkflowRunNotFoundError, WorkflowWorldError } from "@workflow/errors";
4
4
  import { monotonicFactory } from "ulid";
@@ -1,4 +1,4 @@
1
- import { n as NativeQueueEnvelope, t as QueueDeliveryResult } from "./queue-delivery-DzNOtCYA.js";
1
+ import { n as NativeQueueEnvelope, t as QueueDeliveryResult } from "./queue-delivery-BdeNUbRN.js";
2
2
  //#region src/worker/queue-consumer.d.ts
3
3
  interface NativeQueueMessage {
4
4
  readonly body: unknown;
@@ -1,4 +1,4 @@
1
- import { c as validateNativeQueueEnvelope, m as QUEUE_CLAIM_STALE_MS, r as nativeQueueDelaySeconds, v as queueDelayDeadline } from "./queue-protocol-CtH7UUCO.js";
1
+ import { h as QUEUE_CLAIM_STALE_MS, i as nativeQueueDelaySeconds, l as validateNativeQueueEnvelope, y as queueDelayDeadline } from "./queue-protocol-DKYt8qZJ.js";
2
2
  //#region src/worker/queue-consumer.ts
3
3
  function backoffSeconds(attempt) {
4
4
  return Math.min(60, 2 ** Math.min(attempt, 30));
@@ -26,14 +26,40 @@ interface NativeQueueEnvelope {
26
26
  runId?: string;
27
27
  idempotencyKey?: string;
28
28
  payloadKey?: string;
29
- /** Inline only for the small, run-less health-check envelope. */
29
+ /**
30
+ * Inline body. Health checks always travel inline; a run-bearing body may
31
+ * travel inline when it is small and carries no user data, in which case
32
+ * delivery checks the run's expiry instead of reading a payload object.
33
+ */
30
34
  body?: string;
31
35
  /** Absolute workflow redelivery deadline; long waits are chained by the consumer. */
32
36
  notBefore?: number;
37
+ /**
38
+ * Where the idempotency claim lives. Absent: the claim cell named by queue
39
+ * and key. `run`: an entry in the run's own cell (requires `runId`).
40
+ */
41
+ claimScope?: 'run';
33
42
  /** Failed deliveries carried across suspension re-publishes. */
34
43
  deliveryFailures?: number;
35
44
  suspensionCount?: number;
36
45
  }
46
+ /**
47
+ * Enqueue-side answer from a run cell. `cell`: the run predates run-scoped
48
+ * claims, so its idempotency claims stay in claim cells. `run`: the
49
+ * reservation was made in the run's own cell.
50
+ */
51
+ type RunQueueReservation = {
52
+ ok: false;
53
+ message: string;
54
+ } | {
55
+ ok: true;
56
+ scope: 'cell';
57
+ } | {
58
+ ok: true;
59
+ scope: 'run';
60
+ admitted: boolean;
61
+ messageId: string;
62
+ };
37
63
  //#endregion
38
64
  //#region src/worker/queue-delivery.d.ts
39
65
  type QueueDeliveryResult = {
@@ -45,5 +71,5 @@ type QueueDeliveryResult = {
45
71
  kind: 'retry';
46
72
  };
47
73
  //#endregion
48
- export { QueuePayloadRegistration as i, NativeQueueEnvelope as n, QueuePayloadOrphan as r, QueueDeliveryResult as t };
49
- //# sourceMappingURL=queue-delivery-DzNOtCYA.d.ts.map
74
+ export { RunQueueReservation as a, QueuePayloadRegistration as i, NativeQueueEnvelope as n, QueuePayloadOrphan as r, QueueDeliveryResult as t };
75
+ //# sourceMappingURL=queue-delivery-BdeNUbRN.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-delivery-BdeNUbRN.d.ts","names":[],"sources":["../src/queue-protocol.ts","../src/worker/queue-delivery.ts"],"mappings":";UAgCiB;EACf;EACA;;EAEA;;UAGe;EACf;EACA;EACA;EACA;;;;;;;;;UAUe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;EAMA;;EAEA;;;;;EAKA;;EAEA;EACA;;;;;;;KAQU;EACN;EAAW;;EACX;EAAU;;EACV;EAAU;EAAc;EAAmB;;;;KC5ErC;EACN;;EACA;EAAiB;;EACjB"}
@@ -52,6 +52,28 @@ const LIFECYCLE_COMPACTION_RETRY_MS = 1e3;
52
52
  const NATIVE_QUEUE_MAX_DELAY_SECONDS = 86400;
53
53
  const NATIVE_QUEUE_MAX_MESSAGE_BYTES = 128e3;
54
54
  const QUEUE_PAYLOAD_REGISTRY_PREFIX = "queue-payload:";
55
+ /** Workflow payload fields that carry user data, which run retention must be able to delete. */
56
+ const USER_DATA_FIELDS = [
57
+ "runInput",
58
+ "hookInput",
59
+ "stepInput"
60
+ ];
61
+ /**
62
+ * A run-bearing body may stay inline when it is small and carries no user
63
+ * data: then it holds only IDs, trace context, and metadata, and nothing in it
64
+ * needs run retention to delete it from object storage.
65
+ */
66
+ function isInlineRunBody(body) {
67
+ if (body.length > 8192) return false;
68
+ if (new TextEncoder().encode(body).byteLength > 8192) return false;
69
+ let parsed;
70
+ try {
71
+ parsed = JSON.parse(body);
72
+ } catch {
73
+ return false;
74
+ }
75
+ return isRecord(parsed) && USER_DATA_FIELDS.every((field) => parsed[field] === void 0);
76
+ }
55
77
  function queuePayloadRegistryKey(messageId) {
56
78
  return `${QUEUE_PAYLOAD_REGISTRY_PREFIX}${messageId}`;
57
79
  }
@@ -82,6 +104,7 @@ function validateNativeQueueEnvelope(value) {
82
104
  "payloadKey",
83
105
  "body"
84
106
  ]) if (value[field] !== void 0 && typeof value[field] !== "string") throw new TypeError(`world-celld native queue envelope ${field} must be a string`);
107
+ if (value.claimScope !== void 0 && (value.claimScope !== "run" || value.runId === void 0)) throw new TypeError("world-celld native queue envelope claimScope must be 'run' with a runId");
85
108
  if (value.payloadKey === void 0 === (value.body === void 0)) throw new TypeError("world-celld native queue envelope must contain exactly one payload source");
86
109
  for (const field of [
87
110
  "notBefore",
@@ -99,6 +122,6 @@ function validateNativeQueueSendOptions(value) {
99
122
  return delaySeconds === void 0 ? {} : { delaySeconds };
100
123
  }
101
124
  //#endregion
102
- export { isRecord as _, queueOrphanName as a, validateNativeQueueEnvelope as c, HOOK_CLAIM_LEASE_MS as d, LIFECYCLE_COMPACTION_RETRY_MS as f, isPositiveSafeInteger as g, isNonNegativeSafeInteger as h, queueClaimName as i, validateNativeQueueSendOptions as l, QUEUE_CLAIM_STALE_MS as m, QUEUE_PAYLOAD_REGISTRY_PREFIX as n, queuePayloadObjectKey as o, MAX_RUN_INDEX_PUBLICATION_LIFETIME_MS as p, nativeQueueDelaySeconds as r, queuePayloadRegistryKey as s, NATIVE_QUEUE_MAX_MESSAGE_BYTES as t, CATALOG_FENCE_GRACE_MS as u, queueDelayDeadline as v, strictIntegerSetting as y };
125
+ export { isPositiveSafeInteger as _, queueClaimName as a, strictIntegerSetting as b, queuePayloadRegistryKey as c, CATALOG_FENCE_GRACE_MS as d, HOOK_CLAIM_LEASE_MS as f, isNonNegativeSafeInteger as g, QUEUE_CLAIM_STALE_MS as h, nativeQueueDelaySeconds as i, validateNativeQueueEnvelope as l, MAX_RUN_INDEX_PUBLICATION_LIFETIME_MS as m, QUEUE_PAYLOAD_REGISTRY_PREFIX as n, queueOrphanName as o, LIFECYCLE_COMPACTION_RETRY_MS as p, isInlineRunBody as r, queuePayloadObjectKey as s, NATIVE_QUEUE_MAX_MESSAGE_BYTES as t, validateNativeQueueSendOptions as u, isRecord as v, queueDelayDeadline as y };
103
126
 
104
- //# sourceMappingURL=queue-protocol-CtH7UUCO.js.map
127
+ //# sourceMappingURL=queue-protocol-DKYt8qZJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue-protocol-DKYt8qZJ.js","names":[],"sources":["../src/validation.ts","../src/lifecycle.ts","../src/queue-protocol.ts"],"sourcesContent":["/** Largest epoch-ms deadline that fits the queue's fixed-width 13-digit keys. */\nexport const MAX_QUEUE_TIMESTAMP_MS = 9_999_999_999_999;\nexport const MAX_QUEUE_DELAY_SECONDS = Math.floor(MAX_QUEUE_TIMESTAMP_MS / 1000);\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\nexport function isNonNegativeSafeInteger(value: unknown): value is number {\n return Number.isSafeInteger(value) && (value as number) >= 0;\n}\n\nexport function isPositiveSafeInteger(value: unknown): value is number {\n return Number.isSafeInteger(value) && (value as number) > 0;\n}\n\nexport function boundedIntegerOption(\n name: string,\n value: unknown,\n fallback: number,\n minimum: number,\n maximum = Number.MAX_SAFE_INTEGER,\n): number {\n if (value === undefined) return fallback;\n if (!Number.isSafeInteger(value) || (value as number) < minimum || (value as number) > maximum) {\n throw new Error(`${name} must be an integer between ${minimum} and ${maximum}`);\n }\n return value as number;\n}\n\n/**\n * Parse a deployment/runtime integer setting without accepting whitespace,\n * exponents, fractions, or numeric prefixes such as `5junk`.\n */\nexport function strictIntegerSetting(\n name: string,\n raw: string | number | undefined,\n fallback: number,\n minimum: number,\n maximum = Number.MAX_SAFE_INTEGER,\n): number {\n if (raw === undefined) return fallback;\n const value = typeof raw === 'number' ? raw : /^\\d+$/.test(raw) ? Number(raw) : Number.NaN;\n if (!Number.isSafeInteger(value) || value < minimum || value > maximum) {\n throw new Error(`${name} must be an integer between ${minimum} and ${maximum}`);\n }\n return value;\n}\n\nexport function isValidQueueDelaySeconds(value: unknown, minimum: 0 | 1 = 0): value is number {\n return (\n Number.isSafeInteger(value) &&\n (value as number) >= minimum &&\n (value as number) <= MAX_QUEUE_DELAY_SECONDS\n );\n}\n\nexport function queueDelayDeadline(\n now: number,\n delaySeconds: unknown,\n minimum: 0 | 1 = 0,\n requiredHeadroomMs = 0,\n): number | null {\n if (!isNonNegativeSafeInteger(now) || !isValidQueueDelaySeconds(delaySeconds, minimum)) {\n return null;\n }\n return checkedQueueTimestampAdd(now, delaySeconds * 1000, requiredHeadroomMs);\n}\n\n/**\n * Add an offset to a queue timestamp while preserving its 13-digit key order.\n * Optional headroom reserves space for a later persisted derivative deadline.\n */\nexport function checkedQueueTimestampAdd(\n timestampMs: unknown,\n offsetMs: unknown,\n requiredHeadroomMs = 0,\n): number | null {\n if (\n !isNonNegativeSafeInteger(timestampMs) ||\n !isNonNegativeSafeInteger(offsetMs) ||\n !isNonNegativeSafeInteger(requiredHeadroomMs)\n ) {\n return null;\n }\n const timestamp = timestampMs;\n const offset = offsetMs;\n if (timestamp > MAX_QUEUE_TIMESTAMP_MS || offset > MAX_QUEUE_TIMESTAMP_MS - timestamp) {\n return null;\n }\n const result = timestamp + offset;\n return requiredHeadroomMs <= MAX_QUEUE_TIMESTAMP_MS - result ? result : null;\n}\n","import { MAX_QUEUE_TIMESTAMP_MS } from './validation.js';\n\n/**\n * Hard protocol bounds used by lifecycle leases and derivative-fence cleanup.\n *\n * These are not retention TTLs. They bound how long a request which was\n * admitted before expiry may still mutate a derivative Durable Object:\n *\n * - fleet calls have at most three 5-minute attempts plus bounded retry delay;\n * - one native Queue idempotency claim stays live for at most 15 minutes\n * without a successful delivery or explicit workflow suspension;\n * - hook admission spans reserve retries, one authoritative apply, and\n * finalize retries before the exact claim must be reacquired.\n */\nexport const MAX_FLEET_RPC_TIMEOUT_MS = 5 * 60 * 1000;\nexport const FLEET_IDEMPOTENT_ATTEMPTS = 3;\nexport const FLEET_RETRY_BACKOFF_MAX_MS = 900;\n\nexport const MAX_IDEMPOTENT_RPC_LIFETIME_MS =\n FLEET_IDEMPOTENT_ATTEMPTS * MAX_FLEET_RPC_TIMEOUT_MS + FLEET_RETRY_BACKOFF_MAX_MS;\nexport const MAX_RUN_INDEX_PUBLICATION_LIFETIME_MS =\n MAX_FLEET_RPC_TIMEOUT_MS + MAX_IDEMPOTENT_RPC_LIFETIME_MS;\n\nexport const MAX_QUEUE_DELIVERY_TIMEOUT_MS = 5 * 60 * 1000;\nexport const QUEUE_CLAIM_STALE_MS = 15 * 60 * 1000;\n/** A fresh delivery edge may advance an immediately-due message by one millisecond. */\nexport const QUEUE_ALARM_EDGE_MS = 1;\nexport const MAX_QUEUE_DERIVED_DEADLINE_HEADROOM_MS = QUEUE_CLAIM_STALE_MS + QUEUE_ALARM_EDGE_MS;\n/** Latest admissible due time with room for a fresh queue claim. */\nexport const MAX_QUEUE_SCHEDULE_TIMESTAMP_MS =\n MAX_QUEUE_TIMESTAMP_MS - MAX_QUEUE_DERIVED_DEADLINE_HEADROOM_MS;\n\nexport const CATALOG_FENCE_GRACE_MS = MAX_RUN_INDEX_PUBLICATION_LIFETIME_MS;\n\nexport const HOOK_CLAIM_LEASE_MS =\n (FLEET_IDEMPOTENT_ATTEMPTS * 2 + 1) * MAX_FLEET_RPC_TIMEOUT_MS + FLEET_RETRY_BACKOFF_MAX_MS * 2;\n\nexport const LIFECYCLE_COMPACTION_BATCH = 128;\nexport const LIFECYCLE_COMPACTION_RETRY_MS = 1000;\n","import { isNonNegativeSafeInteger, isRecord } from './validation.js';\nimport { MAX_QUEUE_SCHEDULE_TIMESTAMP_MS } from './lifecycle.js';\n\nexport { QUEUE_CLAIM_STALE_MS } from './lifecycle.js';\n\n/** celld v0.6.0 follows this native Queue producer-delay ceiling. */\nexport const NATIVE_QUEUE_MAX_DELAY_SECONDS = 86_400;\nexport const NATIVE_QUEUE_MAX_MESSAGE_BYTES = 128_000;\nexport const MAX_QUEUE_SUSPENSIONS = 256;\nexport const QUEUE_PAYLOAD_REGISTRY_PREFIX = 'queue-payload:';\n/** Largest run-bearing body that may travel inline in the broker envelope. */\nexport const MAX_INLINE_RUN_BODY_BYTES = 8 * 1024;\n/** Workflow payload fields that carry user data, which run retention must be able to delete. */\nconst USER_DATA_FIELDS = ['runInput', 'hookInput', 'stepInput'] as const;\n\n/**\n * A run-bearing body may stay inline when it is small and carries no user\n * data: then it holds only IDs, trace context, and metadata, and nothing in it\n * needs run retention to delete it from object storage.\n */\nexport function isInlineRunBody(body: string): boolean {\n if (body.length > MAX_INLINE_RUN_BODY_BYTES) return false;\n if (new TextEncoder().encode(body).byteLength > MAX_INLINE_RUN_BODY_BYTES) return false;\n let parsed: unknown;\n try {\n parsed = JSON.parse(body);\n } catch {\n return false;\n }\n return isRecord(parsed) && USER_DATA_FIELDS.every((field) => parsed[field] === undefined);\n}\n\nexport interface QueuePayloadRegistration {\n messageId: string;\n key: string;\n /** Delete an orphaned resilient-start payload after this deadline. */\n orphanExpiresAt: number;\n}\n\nexport interface QueuePayloadOrphan {\n messageId: string;\n runId: string;\n key: string;\n expiresAt: number;\n}\n\n/**\n * Small broker message carried by celld's native Queue.\n *\n * Run-bearing payload bytes live in object storage so the broker's 128 kB limit does not\n * narrow the Workflow World contract and run retention can delete those bytes\n * without waiting for the Queue's fixed four-day retention window.\n */\nexport interface NativeQueueEnvelope {\n version: 1;\n messageId: string;\n queueName: string;\n targetBaseUrl: string;\n runId?: string;\n idempotencyKey?: string;\n payloadKey?: string;\n /**\n * Inline body. Health checks always travel inline; a run-bearing body may\n * travel inline when it is small and carries no user data, in which case\n * delivery checks the run's expiry instead of reading a payload object.\n */\n body?: string;\n /** Absolute workflow redelivery deadline; long waits are chained by the consumer. */\n notBefore?: number;\n /**\n * Where the idempotency claim lives. Absent: the claim cell named by queue\n * and key. `run`: an entry in the run's own cell (requires `runId`).\n */\n claimScope?: 'run';\n /** Failed deliveries carried across suspension re-publishes. */\n deliveryFailures?: number;\n suspensionCount?: number;\n}\n\n/**\n * Enqueue-side answer from a run cell. `cell`: the run predates run-scoped\n * claims, so its idempotency claims stay in claim cells. `run`: the\n * reservation was made in the run's own cell.\n */\nexport type RunQueueReservation =\n | { ok: false; message: string }\n | { ok: true; scope: 'cell' }\n | { ok: true; scope: 'run'; admitted: boolean; messageId: string };\n\nexport interface NativeQueueSendOptions {\n delaySeconds?: number;\n}\n\nexport interface NativeQueueSendResult {\n messageId: string;\n}\n\nexport function queuePayloadRegistryKey(messageId: string): string {\n return `${QUEUE_PAYLOAD_REGISTRY_PREFIX}${messageId}`;\n}\n\nexport function queuePayloadObjectKey(runId: string, messageId: string): string {\n return `workflow-queue/${encodeURIComponent(runId)}/${encodeURIComponent(messageId)}`;\n}\n\nexport function queueClaimName(queueName: string, idempotencyKey: string): string {\n return `claim:${queueName.length}:${queueName}:${idempotencyKey}`;\n}\n\nexport function queueOrphanName(messageId: string): string {\n return `queue-orphan:${messageId}`;\n}\n\nexport function nativeQueueDelaySeconds(notBefore: number | undefined, now: number): number {\n if (notBefore === undefined || notBefore <= now) return 0;\n return Math.min(NATIVE_QUEUE_MAX_DELAY_SECONDS, Math.ceil((notBefore - now) / 1000));\n}\n\nexport function validateNativeQueueEnvelope(value: unknown): NativeQueueEnvelope {\n if (!isRecord(value)) throw new TypeError('world-celld native queue envelope must be an object');\n if (value.version !== 1)\n throw new TypeError('world-celld native queue envelope version must be 1');\n for (const field of ['messageId', 'queueName', 'targetBaseUrl'] as const) {\n if (typeof value[field] !== 'string' || value[field].length === 0) {\n throw new TypeError(`world-celld native queue envelope ${field} must be a non-empty string`);\n }\n }\n for (const field of ['runId', 'idempotencyKey', 'payloadKey', 'body'] as const) {\n if (value[field] !== undefined && typeof value[field] !== 'string') {\n throw new TypeError(`world-celld native queue envelope ${field} must be a string`);\n }\n }\n if (value.claimScope !== undefined && (value.claimScope !== 'run' || value.runId === undefined)) {\n throw new TypeError(\"world-celld native queue envelope claimScope must be 'run' with a runId\");\n }\n if ((value.payloadKey === undefined) === (value.body === undefined)) {\n throw new TypeError(\n 'world-celld native queue envelope must contain exactly one payload source',\n );\n }\n for (const field of ['notBefore', 'deliveryFailures', 'suspensionCount'] as const) {\n if (value[field] !== undefined && !isNonNegativeSafeInteger(value[field])) {\n throw new TypeError(\n `world-celld native queue envelope ${field} must be a non-negative safe integer`,\n );\n }\n }\n if (\n value.notBefore !== undefined &&\n (value.notBefore as number) > MAX_QUEUE_SCHEDULE_TIMESTAMP_MS\n ) {\n throw new TypeError(\n `world-celld native queue envelope notBefore must not exceed ${MAX_QUEUE_SCHEDULE_TIMESTAMP_MS}`,\n );\n }\n return value as unknown as NativeQueueEnvelope;\n}\n\nexport function validateNativeQueueSendOptions(value: unknown): NativeQueueSendOptions {\n if (value === undefined) return {};\n if (!isRecord(value)) throw new TypeError('world-celld native queue options must be an object');\n const delaySeconds = value.delaySeconds;\n if (\n delaySeconds !== undefined &&\n (!Number.isSafeInteger(delaySeconds) ||\n (delaySeconds as number) < 0 ||\n (delaySeconds as number) > NATIVE_QUEUE_MAX_DELAY_SECONDS)\n ) {\n throw new TypeError(\n `world-celld native queue delaySeconds must be an integer between 0 and ${NATIVE_QUEUE_MAX_DELAY_SECONDS}`,\n );\n }\n return delaySeconds === undefined ? {} : { delaySeconds: delaySeconds as number };\n}\n"],"mappings":"AAEA,MAAa,0BAA0B,KAAK,MAAM,gBAAyB,GAAI;AAE/E,SAAgB,SAAS,OAAkD;CACzE,OAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAgB,yBAAyB,OAAiC;CACxE,OAAO,OAAO,cAAc,KAAK,KAAM,SAAoB;AAC7D;AAEA,SAAgB,sBAAsB,OAAiC;CACrE,OAAO,OAAO,cAAc,KAAK,KAAM,QAAmB;AAC5D;;;;;AAoBA,SAAgB,qBACd,MACA,KACA,UACA,SACA,UAAU,OAAO,kBACT;CACR,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,QAAQ,OAAO,QAAQ,WAAW,MAAM,QAAQ,KAAK,GAAG,IAAI,OAAO,GAAG,IAAI;CAChF,IAAI,CAAC,OAAO,cAAc,KAAK,KAAK,QAAQ,WAAW,QAAQ,SAC7D,MAAM,I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ACtE,MAAM,IAAI,UACR,qCAAqC,MAAM,qCAC7C;CAGJ,IACE,MAAM,cAAc,KAAA,KACnB,MAAM,YAAuB,iCAE9B,MAAM,IAAI,UACR,+DAA+D,iCACjE;CAEF,OAAO;AACT;AAEA,SAAgB,+BAA+B,OAAwC;CACrF,IAAI,UAAU,KAAA,GAAW,OAAO,CAAC;CACjC,IAAI,CAAC,SAAS,KAAK,GAAG,MAAM,IAAI,UAAU,oDAAoD;CAC9F,MAAM,eAAe,MAAM;CAC3B,IACE,iBAAiB,KAAA,MAChB,CAAC,OAAO,cAAc,YAAY,KAChC,eAA0B,KAC1B,eAAA,QAEH,MAAM,IAAI,UACR,0EAA0E,gCAC5E;CAEF,OAAO,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAgB,aAAuB;AAClF"}
@@ -662,6 +662,28 @@ function compact(obj) {
662
662
  const NATIVE_QUEUE_MAX_DELAY_SECONDS = 86400;
663
663
  const NATIVE_QUEUE_MAX_MESSAGE_BYTES = 128e3;
664
664
  const QUEUE_PAYLOAD_REGISTRY_PREFIX = "queue-payload:";
665
+ /** Workflow payload fields that carry user data, which run retention must be able to delete. */
666
+ const USER_DATA_FIELDS = [
667
+ "runInput",
668
+ "hookInput",
669
+ "stepInput"
670
+ ];
671
+ /**
672
+ * A run-bearing body may stay inline when it is small and carries no user
673
+ * data: then it holds only IDs, trace context, and metadata, and nothing in it
674
+ * needs run retention to delete it from object storage.
675
+ */
676
+ function isInlineRunBody(body) {
677
+ if (body.length > 8192) return false;
678
+ if (new TextEncoder().encode(body).byteLength > 8192) return false;
679
+ let parsed;
680
+ try {
681
+ parsed = JSON.parse(body);
682
+ } catch {
683
+ return false;
684
+ }
685
+ return isRecord(parsed) && USER_DATA_FIELDS.every((field) => parsed[field] === void 0);
686
+ }
665
687
  function queuePayloadRegistryKey(messageId) {
666
688
  return `${QUEUE_PAYLOAD_REGISTRY_PREFIX}${messageId}`;
667
689
  }
@@ -692,6 +714,7 @@ function validateNativeQueueEnvelope(value) {
692
714
  "payloadKey",
693
715
  "body"
694
716
  ]) if (value[field] !== void 0 && typeof value[field] !== "string") throw new TypeError(`world-celld native queue envelope ${field} must be a string`);
717
+ if (value.claimScope !== void 0 && (value.claimScope !== "run" || value.runId === void 0)) throw new TypeError("world-celld native queue envelope claimScope must be 'run' with a runId");
695
718
  if (value.payloadKey === void 0 === (value.body === void 0)) throw new TypeError("world-celld native queue envelope must contain exactly one payload source");
696
719
  for (const field of [
697
720
  "notBefore",
@@ -782,6 +805,6 @@ async function listRunsPage(deps, request) {
782
805
  };
783
806
  }
784
807
  //#endregion
785
- export { isRecord as A, STREAM_BATCH_CONTENT_TYPE as B, MAX_QUEUE_DELIVERY_TIMEOUT_MS as C, checkedQueueTimestampAdd as D, boundedIntegerOption as E, MAX_STREAM_ERROR_BYTES as F, encodeStreamReadResult as G, decodeStreamReadResult as H, MAX_STREAM_LONG_POLL_MS as I, isChunkLimitRejection as J, encodeStreamWriteBatch as K, MAX_STREAM_READ_BYTES as L, strictIntegerSetting as M, MAX_STREAM_BATCH_BYTES as N, isNonNegativeSafeInteger as O, MAX_STREAM_CHUNK_BYTES as P, MAX_STREAM_READ_CHUNKS as R, MAX_FLEET_RPC_TIMEOUT_MS as S, MAX_RUN_INDEX_PUBLICATION_LIFETIME_MS as T, decodeStreamWriteBatch as U, STREAM_CHUNK_LIMIT_HEADER as V, decodeStreamWriteResult as W, validateStreamReadRequest as X, normalizeStreamError as Y, validateStreamWriteChunks as Z, createWorkflowIndex as _, nativeQueueDelaySeconds as a, HOOK_CLAIM_LEASE_MS as b, queuePayloadObjectKey as c, validateNativeQueueSendOptions as d, compact as f, stringify as g, parse as h, QUEUE_PAYLOAD_REGISTRY_PREFIX as i, queueDelayDeadline as j, isPositiveSafeInteger as k, queuePayloadRegistryKey as l, rpcStringify as m, listRunsPage as n, queueClaimName as o, rpcParse as p, encodeStreamWriteResult as q, NATIVE_QUEUE_MAX_MESSAGE_BYTES as r, queueOrphanName as s, MAX_RUN_LIST_LIMIT as t, validateNativeQueueEnvelope as u, runIndexMetadata as v, MAX_QUEUE_DERIVED_DEADLINE_HEADROOM_MS as w, LIFECYCLE_COMPACTION_RETRY_MS as x, CATALOG_FENCE_GRACE_MS as y, MAX_STREAM_WRITE_CHUNKS as z };
808
+ export { isPositiveSafeInteger as A, MAX_STREAM_WRITE_CHUNKS as B, MAX_FLEET_RPC_TIMEOUT_MS as C, boundedIntegerOption as D, MAX_RUN_INDEX_PUBLICATION_LIFETIME_MS as E, MAX_STREAM_CHUNK_BYTES as F, decodeStreamWriteResult as G, STREAM_CHUNK_LIMIT_HEADER as H, MAX_STREAM_ERROR_BYTES as I, encodeStreamWriteResult as J, encodeStreamReadResult as K, MAX_STREAM_LONG_POLL_MS as L, queueDelayDeadline as M, strictIntegerSetting as N, checkedQueueTimestampAdd as O, MAX_STREAM_BATCH_BYTES as P, validateStreamWriteChunks as Q, MAX_STREAM_READ_BYTES as R, LIFECYCLE_COMPACTION_RETRY_MS as S, MAX_QUEUE_DERIVED_DEADLINE_HEADROOM_MS as T, decodeStreamReadResult as U, STREAM_BATCH_CONTENT_TYPE as V, decodeStreamWriteBatch as W, normalizeStreamError as X, isChunkLimitRejection as Y, validateStreamReadRequest as Z, stringify as _, isInlineRunBody as a, CATALOG_FENCE_GRACE_MS as b, queueOrphanName as c, validateNativeQueueEnvelope as d, validateNativeQueueSendOptions as f, parse as g, rpcStringify as h, QUEUE_PAYLOAD_REGISTRY_PREFIX as i, isRecord as j, isNonNegativeSafeInteger as k, queuePayloadObjectKey as l, rpcParse as m, listRunsPage as n, nativeQueueDelaySeconds as o, compact as p, encodeStreamWriteBatch as q, NATIVE_QUEUE_MAX_MESSAGE_BYTES as r, queueClaimName as s, MAX_RUN_LIST_LIMIT as t, queuePayloadRegistryKey as u, createWorkflowIndex as v, MAX_QUEUE_DELIVERY_TIMEOUT_MS as w, HOOK_CLAIM_LEASE_MS as x, runIndexMetadata as y, MAX_STREAM_READ_CHUNKS as z };
786
809
 
787
- //# sourceMappingURL=run-list-B__jKuE7.js.map
810
+ //# sourceMappingURL=run-list-C987PkJ2.js.map