@adonis-agora/durable 0.47.0 → 0.49.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.
Files changed (183) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/assets/spa/assets/index-6nmSTfT7.css +1 -0
  3. package/dist/assets/spa/assets/index-DdB9zxuX.js +16 -0
  4. package/dist/assets/spa/assets/index-DdB9zxuX.js.map +1 -0
  5. package/dist/assets/spa/index.html +2 -2
  6. package/dist/configure.d.ts.map +1 -1
  7. package/dist/configure.js +1 -0
  8. package/dist/configure.js.map +1 -1
  9. package/dist/providers/dashboard_provider.d.ts +3 -1
  10. package/dist/providers/dashboard_provider.d.ts.map +1 -1
  11. package/dist/providers/dashboard_provider.js +7 -2
  12. package/dist/providers/dashboard_provider.js.map +1 -1
  13. package/dist/providers/durable_provider.d.ts +0 -25
  14. package/dist/providers/durable_provider.d.ts.map +1 -1
  15. package/dist/providers/durable_provider.js +30 -5
  16. package/dist/providers/durable_provider.js.map +1 -1
  17. package/dist/src/codec-state-store.d.ts +2 -0
  18. package/dist/src/codec-state-store.d.ts.map +1 -1
  19. package/dist/src/codec-state-store.js +6 -0
  20. package/dist/src/codec-state-store.js.map +1 -1
  21. package/dist/src/completion.d.ts +11 -0
  22. package/dist/src/completion.d.ts.map +1 -1
  23. package/dist/src/completion.js +18 -1
  24. package/dist/src/completion.js.map +1 -1
  25. package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -1
  26. package/dist/src/dashboard/gateway-adapter.js +10 -0
  27. package/dist/src/dashboard/gateway-adapter.js.map +1 -1
  28. package/dist/src/dashboard/handlers.d.ts +22 -1
  29. package/dist/src/dashboard/handlers.d.ts.map +1 -1
  30. package/dist/src/dashboard/handlers.js +63 -10
  31. package/dist/src/dashboard/handlers.js.map +1 -1
  32. package/dist/src/dashboard/index.d.ts +1 -1
  33. package/dist/src/dashboard/index.js +1 -1
  34. package/dist/src/dashboard/openapi.d.ts.map +1 -1
  35. package/dist/src/dashboard/openapi.js +26 -2
  36. package/dist/src/dashboard/openapi.js.map +1 -1
  37. package/dist/src/define_config.d.ts +6 -0
  38. package/dist/src/define_config.d.ts.map +1 -1
  39. package/dist/src/define_config.js.map +1 -1
  40. package/dist/src/engine.d.ts +89 -3
  41. package/dist/src/engine.d.ts.map +1 -1
  42. package/dist/src/engine.js +448 -39
  43. package/dist/src/engine.js.map +1 -1
  44. package/dist/src/errors.d.ts +30 -12
  45. package/dist/src/errors.d.ts.map +1 -1
  46. package/dist/src/errors.js +17 -8
  47. package/dist/src/errors.js.map +1 -1
  48. package/dist/src/fan-join.d.ts +36 -6
  49. package/dist/src/fan-join.d.ts.map +1 -1
  50. package/dist/src/fan-join.js +63 -8
  51. package/dist/src/fan-join.js.map +1 -1
  52. package/dist/src/handshake/announced.d.ts +94 -0
  53. package/dist/src/handshake/announced.d.ts.map +1 -0
  54. package/dist/src/handshake/announced.js +113 -0
  55. package/dist/src/handshake/announced.js.map +1 -0
  56. package/dist/src/handshake/descriptor.d.ts +59 -0
  57. package/dist/src/handshake/descriptor.d.ts.map +1 -1
  58. package/dist/src/handshake/descriptor.js +38 -0
  59. package/dist/src/handshake/descriptor.js.map +1 -1
  60. package/dist/src/index.d.ts +6 -3
  61. package/dist/src/index.d.ts.map +1 -1
  62. package/dist/src/index.js +5 -2
  63. package/dist/src/index.js.map +1 -1
  64. package/dist/src/interfaces.d.ts +85 -4
  65. package/dist/src/interfaces.d.ts.map +1 -1
  66. package/dist/src/interfaces.js.map +1 -1
  67. package/dist/src/metrics.d.ts +5 -0
  68. package/dist/src/metrics.d.ts.map +1 -1
  69. package/dist/src/metrics.js +14 -1
  70. package/dist/src/metrics.js.map +1 -1
  71. package/dist/src/on-error.d.ts +59 -0
  72. package/dist/src/on-error.d.ts.map +1 -0
  73. package/dist/src/on-error.js +71 -0
  74. package/dist/src/on-error.js.map +1 -0
  75. package/dist/src/otel/durable-metrics.d.ts +6 -0
  76. package/dist/src/otel/durable-metrics.d.ts.map +1 -1
  77. package/dist/src/otel/durable-metrics.js +22 -2
  78. package/dist/src/otel/durable-metrics.js.map +1 -1
  79. package/dist/src/otel/durable-otel.d.ts.map +1 -1
  80. package/dist/src/otel/durable-otel.js +15 -0
  81. package/dist/src/otel/durable-otel.js.map +1 -1
  82. package/dist/src/protocol.d.ts.map +1 -1
  83. package/dist/src/protocol.js +1 -0
  84. package/dist/src/protocol.js.map +1 -1
  85. package/dist/src/run-detail-summary.d.ts +98 -0
  86. package/dist/src/run-detail-summary.d.ts.map +1 -0
  87. package/dist/src/run-detail-summary.js +150 -0
  88. package/dist/src/run-detail-summary.js.map +1 -0
  89. package/dist/src/run-gateway/interface.d.ts +11 -0
  90. package/dist/src/run-gateway/interface.d.ts.map +1 -1
  91. package/dist/src/run-gateway/proxy-run-gateway.d.ts +3 -0
  92. package/dist/src/run-gateway/proxy-run-gateway.d.ts.map +1 -1
  93. package/dist/src/run-gateway/proxy-run-gateway.js +8 -0
  94. package/dist/src/run-gateway/proxy-run-gateway.js.map +1 -1
  95. package/dist/src/run-gateway/run-request-responder.d.ts +4 -3
  96. package/dist/src/run-gateway/run-request-responder.d.ts.map +1 -1
  97. package/dist/src/run-gateway/run-request-responder.js +23 -3
  98. package/dist/src/run-gateway/run-request-responder.js.map +1 -1
  99. package/dist/src/run-gateway/store-run-gateway.d.ts +3 -0
  100. package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -1
  101. package/dist/src/run-gateway/store-run-gateway.js +7 -0
  102. package/dist/src/run-gateway/store-run-gateway.js.map +1 -1
  103. package/dist/src/stores/lucid.d.ts +1 -0
  104. package/dist/src/stores/lucid.d.ts.map +1 -1
  105. package/dist/src/stores/lucid.js +17 -4
  106. package/dist/src/stores/lucid.js.map +1 -1
  107. package/dist/src/testing/in-memory-state-store.d.ts +1 -0
  108. package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
  109. package/dist/src/testing/in-memory-state-store.js +14 -6
  110. package/dist/src/testing/in-memory-state-store.js.map +1 -1
  111. package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
  112. package/dist/src/testing-kit/state-store-conformance.js +59 -0
  113. package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
  114. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts +144 -0
  115. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts.map +1 -0
  116. package/dist/src/transports/bullmq/adaptive-concurrency.js +312 -0
  117. package/dist/src/transports/bullmq/adaptive-concurrency.js.map +1 -0
  118. package/dist/src/transports/bullmq/bullmq-transport.d.ts +18 -1
  119. package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
  120. package/dist/src/transports/bullmq/bullmq-transport.js +50 -49
  121. package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
  122. package/dist/src/transports/bullmq/deps.d.ts +11 -1
  123. package/dist/src/transports/bullmq/deps.d.ts.map +1 -1
  124. package/dist/src/transports/bullmq/deps.js +12 -1
  125. package/dist/src/transports/bullmq/deps.js.map +1 -1
  126. package/dist/src/transports/bullmq/index.d.ts +1 -0
  127. package/dist/src/transports/bullmq/index.d.ts.map +1 -1
  128. package/dist/src/transports/bullmq/index.js +1 -0
  129. package/dist/src/transports/bullmq/index.js.map +1 -1
  130. package/dist/src/transports/db-schema.d.ts +12 -0
  131. package/dist/src/transports/db-schema.d.ts.map +1 -1
  132. package/dist/src/transports/db-schema.js +24 -0
  133. package/dist/src/transports/db-schema.js.map +1 -1
  134. package/dist/src/transports/db.d.ts +14 -0
  135. package/dist/src/transports/db.d.ts.map +1 -1
  136. package/dist/src/transports/db.js +34 -0
  137. package/dist/src/transports/db.js.map +1 -1
  138. package/dist/src/transports/event-emitter.d.ts +8 -0
  139. package/dist/src/transports/event-emitter.d.ts.map +1 -1
  140. package/dist/src/transports/event-emitter.js +27 -0
  141. package/dist/src/transports/event-emitter.js.map +1 -1
  142. package/dist/src/transports/factory.d.ts +33 -2
  143. package/dist/src/transports/factory.d.ts.map +1 -1
  144. package/dist/src/transports/factory.js +29 -1
  145. package/dist/src/transports/factory.js.map +1 -1
  146. package/dist/src/transports/queue.d.ts +19 -0
  147. package/dist/src/transports/queue.d.ts.map +1 -1
  148. package/dist/src/transports/queue.js +17 -0
  149. package/dist/src/transports/queue.js.map +1 -1
  150. package/dist/src/transports/worker-keys-db.d.ts +17 -0
  151. package/dist/src/transports/worker-keys-db.d.ts.map +1 -0
  152. package/dist/src/transports/worker-keys-db.js +43 -0
  153. package/dist/src/transports/worker-keys-db.js.map +1 -0
  154. package/dist/src/transports/worker-keys.d.ts +56 -0
  155. package/dist/src/transports/worker-keys.d.ts.map +1 -0
  156. package/dist/src/transports/worker-keys.js +92 -0
  157. package/dist/src/transports/worker-keys.js.map +1 -0
  158. package/dist/src/worker-runtime/index.d.ts +1 -1
  159. package/dist/src/worker-runtime/index.d.ts.map +1 -1
  160. package/dist/src/worker-runtime/index.js.map +1 -1
  161. package/dist/src/worker-runtime/worker-runtime.d.ts +7 -2
  162. package/dist/src/worker-runtime/worker-runtime.d.ts.map +1 -1
  163. package/dist/src/worker-runtime/worker-runtime.js +22 -20
  164. package/dist/src/worker-runtime/worker-runtime.js.map +1 -1
  165. package/dist/src/workflow-ctx.d.ts +13 -1
  166. package/dist/src/workflow-ctx.d.ts.map +1 -1
  167. package/dist/src/workflow-ctx.js +44 -6
  168. package/dist/src/workflow-ctx.js.map +1 -1
  169. package/dist/src/workflow-discovery.d.ts.map +1 -1
  170. package/dist/src/workflow-discovery.js +2 -1
  171. package/dist/src/workflow-discovery.js.map +1 -1
  172. package/dist/src/workflow-ref.d.ts +31 -0
  173. package/dist/src/workflow-ref.d.ts.map +1 -1
  174. package/dist/src/workflow-ref.js +22 -0
  175. package/dist/src/workflow-ref.js.map +1 -1
  176. package/dist/stubs/database/migrations/create_durable_transport_worker_keys.stub +24 -0
  177. package/package.json +5 -5
  178. package/skills/durable-cluster/SKILL.md +10 -0
  179. package/skills/durable-transports-stores/SKILL.md +37 -0
  180. package/skills/durable-workflows/SKILL.md +22 -1
  181. package/dist/assets/spa/assets/index-CL6q2kMB.js +0 -16
  182. package/dist/assets/spa/assets/index-CL6q2kMB.js.map +0 -1
  183. package/dist/assets/spa/assets/index-DU6cGcJz.css +0 -1
@@ -0,0 +1,144 @@
1
+ import type { WorkerStatus } from '../../interfaces.js';
2
+ /**
3
+ * The adaptive controller's tunables — every field optional, each with a default from the spec.
4
+ * Spread under `{ mode: 'adaptive' }` to widen a plain `concurrency: number` into a self-tuning knob.
5
+ */
6
+ export interface AdaptiveConcurrencyOptions {
7
+ /** Floor the controller won't go below. Default 1. */
8
+ min?: number;
9
+ /** Ceiling the controller won't exceed. Default 32. */
10
+ max?: number;
11
+ /** Initial limit. Default `min` (clamped into `[min,max]`). */
12
+ start?: number;
13
+ /** RSS percent of the memory ceiling at which the hard brake fires. Default 85. */
14
+ ramCeilingPct?: number;
15
+ /** CPU percent (0..100×cores normalised to 0..100) ceiling; absent = off. Default undefined. */
16
+ cpuCeilingPct?: number;
17
+ /** Control-loop period in ms. Default 2000. */
18
+ tickMs?: number;
19
+ }
20
+ /**
21
+ * The `concurrency` option, widened (backward-compatible): a plain `number` is fixed (unchanged), the
22
+ * string `'adaptive'` is adaptive-with-defaults, and an object `{ mode:'adaptive', ... }` is adaptive
23
+ * with overrides. `undefined` keeps the historical default of 1 (fixed).
24
+ */
25
+ export type ConcurrencyOption = number | 'adaptive' | ({
26
+ mode: 'adaptive';
27
+ } & AdaptiveConcurrencyOptions);
28
+ /** The fully-resolved adaptive tunables (every default applied), carried on a resolved config. */
29
+ export interface AdaptiveConfig {
30
+ min: number;
31
+ max: number;
32
+ start: number;
33
+ ramCeilingPct: number;
34
+ cpuCeilingPct?: number;
35
+ tickMs: number;
36
+ }
37
+ /** A normalised `concurrency` option: a `fixed` number, or an `adaptive` config with every default applied. */
38
+ export interface ResolvedConcurrency {
39
+ mode: 'fixed' | 'adaptive';
40
+ /** Present when `mode === 'fixed'` — the never-moving concurrency. */
41
+ fixed?: number;
42
+ /** Present when `mode === 'adaptive'` — the controller's tunables. */
43
+ adaptive?: AdaptiveConfig;
44
+ }
45
+ /**
46
+ * Normalise a {@link ConcurrencyOption} into a {@link ResolvedConcurrency}: a bare number (or
47
+ * `undefined` → 1) becomes `{ mode:'fixed', fixed }`; `'adaptive'` / `{ mode:'adaptive', ... }`
48
+ * become `{ mode:'adaptive', adaptive }` with every default from the spec applied and `start`
49
+ * clamped into `[min,max]`.
50
+ *
51
+ * A non-finite or out-of-range number falls back to its default (a bad `cpuCeilingPct` turns the
52
+ * CPU ceiling off): BullMQ throws on a `NaN` or sub-1 concurrency, a `NaN` ceiling never brakes, and
53
+ * a `NaN` `tickMs` makes the control loop fire every millisecond.
54
+ */
55
+ export declare function resolveConcurrency(opt?: ConcurrencyOption): ResolvedConcurrency;
56
+ /**
57
+ * The process memory ceiling in bytes, read once (cgroup limits don't move at runtime): cgroup v2
58
+ * `memory.max`, then cgroup v1 `memory.limit_in_bytes`, then the host total. A `max` / absurdly-large
59
+ * ("unlimited") cgroup value falls through to {@link totalmem}. No new deps — just `node:fs`/`node:os`.
60
+ */
61
+ export declare function readMemoryLimitBytes(): number;
62
+ /** Construction surface for {@link AdaptiveController}. */
63
+ export interface AdaptiveControllerOptions {
64
+ /** The raw `concurrency` option (resolved internally). */
65
+ concurrency?: ConcurrencyOption;
66
+ /**
67
+ * Applied whenever the live limit changes — wire it to `worker.concurrency = limit`. Called once
68
+ * with the initial limit is NOT done here; the caller passes the initial limit to the Worker ctor
69
+ * and reads {@link AdaptiveController.limit}. Subsequent adaptive moves call this.
70
+ */
71
+ apply?: (limit: number) => void;
72
+ /** Injectable clock (tests). Defaults to {@link Date.now}. */
73
+ now?: () => number;
74
+ /** Injectable RSS reader (tests). Defaults to `process.memoryUsage().rss`. */
75
+ readRss?: () => number;
76
+ /** Injectable memory-ceiling reader (tests). Defaults to {@link readMemoryLimitBytes} (read once). */
77
+ readMemoryLimit?: () => number;
78
+ }
79
+ /**
80
+ * A single gradient-limit (AIMD) concurrency controller, shared by every per-routing-token task
81
+ * worker of one {@link import('./bullmq-transport.js').BullMQTransport}. It tracks in-flight work and a rolling window of
82
+ * completions, and — in `adaptive` mode — re-evaluates the worker's concurrency every `tickMs` from a
83
+ * latency gradient, an error/stall backpressure signal, a hard RAM brake and an optional CPU ceiling.
84
+ *
85
+ * In `fixed` mode it never moves the limit but still tracks `inFlight`/RSS/throughput/p95 so the
86
+ * observability half (the heartbeat status payload) works without adaptive. Either way, {@link snapshot}
87
+ * returns the shared {@link WorkerStatus} contract the heartbeat writer stamps.
88
+ */
89
+ export declare class AdaptiveController {
90
+ private readonly resolved;
91
+ private readonly apply;
92
+ private readonly now;
93
+ private readonly readRss;
94
+ private readonly memoryLimitBytes;
95
+ private readonly tickMs;
96
+ private currentLimit;
97
+ private inFlightCount;
98
+ private readonly window;
99
+ private rttLongMs?;
100
+ private cpuPct?;
101
+ private lastAdjust?;
102
+ private completionsThisTick;
103
+ private stallTicks;
104
+ private lastCpuUsage?;
105
+ private timer;
106
+ constructor(options?: AdaptiveControllerOptions);
107
+ /** The concurrency to hand the BullMQ Worker on construction (fixed N, or the adaptive `start`). */
108
+ get initialLimit(): number;
109
+ /** The live limit in effect right now. */
110
+ get limit(): number;
111
+ /** `true` when the controller will move the limit on its own (adaptive mode). */
112
+ get isAdaptive(): boolean;
113
+ /** Start the control loop. The timer is `unref`'d so it never keeps the process alive; idempotent. */
114
+ start(): void;
115
+ /** Stop the control loop (call on worker close). Idempotent. */
116
+ stop(): void;
117
+ /** A task started — bump in-flight. Call from the job processor before awaiting the body. */
118
+ onStart(): void;
119
+ /**
120
+ * A task settled. ALWAYS drops in-flight and counts toward stall liveness (`completionsThisTick`),
121
+ * so the saturation gate, the heartbeat `inFlight`, and the "alive-but-busy" signal see every task.
122
+ *
123
+ * `kind` gates the MEASUREMENT window: only `'step'` completions push a duration into the rolling
124
+ * window that feeds the latency gradient / throughput / p95 / error rate. A workflow TURN
125
+ * (`kind: 'workflow'`) is NOT measured — a 5ms suspend sitting next to a 2s step would corrupt the
126
+ * gradient — but it still counts as in-flight + forward progress. This is the single concurrency
127
+ * pool measuring steps only; the transport tags the kind when it routes a job by shape.
128
+ */
129
+ onSettle(durationMs: number, ok: boolean, kind: 'workflow' | 'step'): void;
130
+ /**
131
+ * One control-loop iteration: sample CPU, refresh the latency baseline, then (adaptive only) decide
132
+ * the next limit and apply it. Exposed (not private) so a test can drive ticks deterministically.
133
+ */
134
+ tick(): void;
135
+ private sampleCpu;
136
+ private refreshRttLong;
137
+ private rssPct;
138
+ private decide;
139
+ /** The shared {@link WorkerStatus} the heartbeat writer stamps. Best-effort fields are omitted when
140
+ * unmeasured (no completions yet → no p95/throughput; no CPU sample yet → no `cpuPct`). */
141
+ snapshot(): WorkerStatus;
142
+ private throughputPerMin;
143
+ }
144
+ //# sourceMappingURL=adaptive-concurrency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-concurrency.d.ts","sourceRoot":"","sources":["../../../../src/transports/bullmq/adaptive-concurrency.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gGAAgG;IAChG,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,UAAU,GACV,CAAC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,0BAA0B,CAAC,CAAC;AAExD,kGAAkG;AAClG,MAAM,WAAW,cAAc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,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,SAAS,CAAC,CAAS;IAC3B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,UAAU,CAAC,CAAe;IAElC,OAAO,CAAC,mBAAmB,CAAK;IAChC,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,YAAY,CAAC,CAAkB;IACvC,OAAO,CAAC,KAAK,CAA6C;IAE1D,YAAY,OAAO,GAAE,yBAA8B,EAWlD;IAED,oGAAoG;IACpG,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,0CAA0C;IAC1C,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,iFAAiF;IACjF,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,sGAAsG;IACtG,KAAK,IAAI,IAAI,CAKZ;IAED,gEAAgE;IAChE,IAAI,IAAI,IAAI,CAKX;IAED,6FAA6F;IAC7F,OAAO,IAAI,IAAI,CAEd;IAED;;;;;;;;;OASG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAQzE;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,CAYX;IAED,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,MAAM;IAKd,OAAO,CAAC,MAAM;IAwCd;gGAC4F;IAC5F,QAAQ,IAAI,YAAY,CAyBvB;IAED,OAAO,CAAC,gBAAgB;CAUzB"}
@@ -0,0 +1,312 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { cpus, totalmem } from 'node:os';
3
+ const DEFAULT_MIN = 1;
4
+ const DEFAULT_MAX = 32;
5
+ const DEFAULT_RAM_CEILING_PCT = 85;
6
+ const DEFAULT_TICK_MS = 2000;
7
+ function clamp(value, min, max) {
8
+ return Math.min(max, Math.max(min, value));
9
+ }
10
+ /** `value` floored when it is a finite number of at least 1, else `fallback`. */
11
+ function wholeAtLeastOne(value, fallback) {
12
+ return value !== undefined && Number.isFinite(value) && value >= 1 ? Math.floor(value) : fallback;
13
+ }
14
+ /** `value` when it is a finite number above 0, else `fallback`. */
15
+ function finitePositive(value, fallback) {
16
+ return value !== undefined && Number.isFinite(value) && value > 0 ? value : fallback;
17
+ }
18
+ /**
19
+ * Normalise a {@link ConcurrencyOption} into a {@link ResolvedConcurrency}: a bare number (or
20
+ * `undefined` → 1) becomes `{ mode:'fixed', fixed }`; `'adaptive'` / `{ mode:'adaptive', ... }`
21
+ * become `{ mode:'adaptive', adaptive }` with every default from the spec applied and `start`
22
+ * clamped into `[min,max]`.
23
+ *
24
+ * A non-finite or out-of-range number falls back to its default (a bad `cpuCeilingPct` turns the
25
+ * CPU ceiling off): BullMQ throws on a `NaN` or sub-1 concurrency, a `NaN` ceiling never brakes, and
26
+ * a `NaN` `tickMs` makes the control loop fire every millisecond.
27
+ */
28
+ export function resolveConcurrency(opt) {
29
+ if (opt === undefined)
30
+ return { mode: 'fixed', fixed: 1 };
31
+ if (typeof opt === 'number')
32
+ return { mode: 'fixed', fixed: wholeAtLeastOne(opt, 1) };
33
+ const overrides = opt === 'adaptive' ? {} : opt;
34
+ const min = wholeAtLeastOne(overrides.min, DEFAULT_MIN);
35
+ const max = Math.max(min, wholeAtLeastOne(overrides.max, DEFAULT_MAX));
36
+ const start = clamp(wholeAtLeastOne(overrides.start, min), min, max);
37
+ const cpuCeilingPct = finitePositive(overrides.cpuCeilingPct, undefined);
38
+ const adaptive = {
39
+ min,
40
+ max,
41
+ start,
42
+ ramCeilingPct: finitePositive(overrides.ramCeilingPct, DEFAULT_RAM_CEILING_PCT),
43
+ tickMs: wholeAtLeastOne(overrides.tickMs, DEFAULT_TICK_MS),
44
+ ...(cpuCeilingPct !== undefined ? { cpuCeilingPct } : {}),
45
+ };
46
+ return { mode: 'adaptive', adaptive };
47
+ }
48
+ // The cgroup "unlimited" sentinel: a limit at/above this is no real cap, so fall through to host total.
49
+ const CGROUP_UNLIMITED = 2 ** 62;
50
+ /**
51
+ * The process memory ceiling in bytes, read once (cgroup limits don't move at runtime): cgroup v2
52
+ * `memory.max`, then cgroup v1 `memory.limit_in_bytes`, then the host total. A `max` / absurdly-large
53
+ * ("unlimited") cgroup value falls through to {@link totalmem}. No new deps — just `node:fs`/`node:os`.
54
+ */
55
+ export function readMemoryLimitBytes() {
56
+ try {
57
+ const raw = readFileSync('/sys/fs/cgroup/memory.max', 'utf8').trim();
58
+ if (raw && raw !== 'max') {
59
+ const n = Number(raw);
60
+ if (Number.isFinite(n) && n > 0 && n < CGROUP_UNLIMITED)
61
+ return n;
62
+ }
63
+ }
64
+ catch {
65
+ /* not cgroup v2 (or unreadable) — try v1 next */
66
+ }
67
+ try {
68
+ const raw = readFileSync('/sys/fs/cgroup/memory/memory.limit_in_bytes', 'utf8').trim();
69
+ const n = Number(raw);
70
+ if (Number.isFinite(n) && n > 0 && n < CGROUP_UNLIMITED)
71
+ return n;
72
+ }
73
+ catch {
74
+ /* not cgroup v1 (or unreadable) — fall through to host total */
75
+ }
76
+ return totalmem();
77
+ }
78
+ // How many recent completions the controller reasons over (latency percentiles + throughput + errors).
79
+ const WINDOW_SIZE = 100;
80
+ // EWMA smoothing for the "no-queuing" baseline (rttLong): low weight so a single fast sample doesn't
81
+ // reset the baseline, but it still tracks a genuine floor shift.
82
+ const RTT_LONG_EWMA_ALPHA = 0.2;
83
+ // Consecutive ticks with in-flight work but zero completions before we call the worker stalled.
84
+ const STALL_TICKS = 2;
85
+ function percentile(sortedAsc, p) {
86
+ if (sortedAsc.length === 0)
87
+ return 0;
88
+ const idx = clamp(Math.ceil((p / 100) * sortedAsc.length) - 1, 0, sortedAsc.length - 1);
89
+ return sortedAsc[idx] ?? 0;
90
+ }
91
+ /**
92
+ * A single gradient-limit (AIMD) concurrency controller, shared by every per-routing-token task
93
+ * worker of one {@link import('./bullmq-transport.js').BullMQTransport}. It tracks in-flight work and a rolling window of
94
+ * completions, and — in `adaptive` mode — re-evaluates the worker's concurrency every `tickMs` from a
95
+ * latency gradient, an error/stall backpressure signal, a hard RAM brake and an optional CPU ceiling.
96
+ *
97
+ * In `fixed` mode it never moves the limit but still tracks `inFlight`/RSS/throughput/p95 so the
98
+ * observability half (the heartbeat status payload) works without adaptive. Either way, {@link snapshot}
99
+ * returns the shared {@link WorkerStatus} contract the heartbeat writer stamps.
100
+ */
101
+ export class AdaptiveController {
102
+ resolved;
103
+ apply;
104
+ now;
105
+ readRss;
106
+ memoryLimitBytes;
107
+ tickMs;
108
+ currentLimit;
109
+ inFlightCount = 0;
110
+ window = [];
111
+ rttLongMs;
112
+ cpuPct;
113
+ lastAdjust;
114
+ completionsThisTick = 0;
115
+ stallTicks = 0;
116
+ lastCpuUsage;
117
+ timer;
118
+ constructor(options = {}) {
119
+ this.resolved = resolveConcurrency(options.concurrency);
120
+ this.apply = options.apply ?? (() => { });
121
+ this.now = options.now ?? Date.now;
122
+ this.readRss = options.readRss ?? (() => process.memoryUsage().rss);
123
+ this.memoryLimitBytes = (options.readMemoryLimit ?? readMemoryLimitBytes)();
124
+ this.tickMs = this.resolved.adaptive?.tickMs ?? DEFAULT_TICK_MS;
125
+ this.currentLimit =
126
+ this.resolved.mode === 'adaptive'
127
+ ? (this.resolved.adaptive?.start ?? DEFAULT_MIN)
128
+ : (this.resolved.fixed ?? 1);
129
+ }
130
+ /** The concurrency to hand the BullMQ Worker on construction (fixed N, or the adaptive `start`). */
131
+ get initialLimit() {
132
+ return this.currentLimit;
133
+ }
134
+ /** The live limit in effect right now. */
135
+ get limit() {
136
+ return this.currentLimit;
137
+ }
138
+ /** `true` when the controller will move the limit on its own (adaptive mode). */
139
+ get isAdaptive() {
140
+ return this.resolved.mode === 'adaptive';
141
+ }
142
+ /** Start the control loop. The timer is `unref`'d so it never keeps the process alive; idempotent. */
143
+ start() {
144
+ if (this.timer)
145
+ return;
146
+ this.lastCpuUsage = process.cpuUsage();
147
+ this.timer = setInterval(() => this.tick(), this.tickMs);
148
+ this.timer.unref?.();
149
+ }
150
+ /** Stop the control loop (call on worker close). Idempotent. */
151
+ stop() {
152
+ if (this.timer) {
153
+ clearInterval(this.timer);
154
+ this.timer = undefined;
155
+ }
156
+ }
157
+ /** A task started — bump in-flight. Call from the job processor before awaiting the body. */
158
+ onStart() {
159
+ this.inFlightCount += 1;
160
+ }
161
+ /**
162
+ * A task settled. ALWAYS drops in-flight and counts toward stall liveness (`completionsThisTick`),
163
+ * so the saturation gate, the heartbeat `inFlight`, and the "alive-but-busy" signal see every task.
164
+ *
165
+ * `kind` gates the MEASUREMENT window: only `'step'` completions push a duration into the rolling
166
+ * window that feeds the latency gradient / throughput / p95 / error rate. A workflow TURN
167
+ * (`kind: 'workflow'`) is NOT measured — a 5ms suspend sitting next to a 2s step would corrupt the
168
+ * gradient — but it still counts as in-flight + forward progress. This is the single concurrency
169
+ * pool measuring steps only; the transport tags the kind when it routes a job by shape.
170
+ */
171
+ onSettle(durationMs, ok, kind) {
172
+ this.inFlightCount = Math.max(0, this.inFlightCount - 1);
173
+ // Forward progress for stall detection counts BOTH kinds — a worker churning workflow turns is
174
+ // not stalled even when no step settles this tick.
175
+ this.completionsThisTick += 1;
176
+ if (kind !== 'step')
177
+ return;
178
+ this.window.push({ durationMs, ok, at: this.now() });
179
+ if (this.window.length > WINDOW_SIZE)
180
+ this.window.shift();
181
+ }
182
+ /**
183
+ * One control-loop iteration: sample CPU, refresh the latency baseline, then (adaptive only) decide
184
+ * the next limit and apply it. Exposed (not private) so a test can drive ticks deterministically.
185
+ */
186
+ tick() {
187
+ this.sampleCpu();
188
+ this.refreshRttLong();
189
+ // Stall = in-flight work but no completion this tick, sustained over STALL_TICKS.
190
+ if (this.inFlightCount > 0 && this.completionsThisTick === 0)
191
+ this.stallTicks += 1;
192
+ else
193
+ this.stallTicks = 0;
194
+ const stalled = this.stallTicks >= STALL_TICKS;
195
+ this.completionsThisTick = 0;
196
+ if (this.resolved.mode !== 'adaptive' || !this.resolved.adaptive)
197
+ return;
198
+ this.decide(this.resolved.adaptive, stalled);
199
+ }
200
+ sampleCpu() {
201
+ if (!this.lastCpuUsage) {
202
+ this.lastCpuUsage = process.cpuUsage();
203
+ return;
204
+ }
205
+ const delta = process.cpuUsage(this.lastCpuUsage);
206
+ this.lastCpuUsage = process.cpuUsage();
207
+ const cores = Math.max(1, cpus().length);
208
+ // delta is microseconds of CPU; the tick spans tickMs ms = tickMs*1000 micros of wall time.
209
+ const micros = delta.user + delta.system;
210
+ this.cpuPct = (micros / (this.tickMs * 1000 * cores)) * 100;
211
+ }
212
+ refreshRttLong() {
213
+ if (this.window.length === 0)
214
+ return;
215
+ let minDuration = this.window[0]?.durationMs ?? 0;
216
+ for (const c of this.window)
217
+ if (c.durationMs < minDuration)
218
+ minDuration = c.durationMs;
219
+ this.rttLongMs =
220
+ this.rttLongMs === undefined
221
+ ? minDuration
222
+ : RTT_LONG_EWMA_ALPHA * minDuration + (1 - RTT_LONG_EWMA_ALPHA) * this.rttLongMs;
223
+ }
224
+ rssPct() {
225
+ if (this.memoryLimitBytes <= 0)
226
+ return 0;
227
+ return (100 * this.readRss()) / this.memoryLimitBytes;
228
+ }
229
+ decide(cfg, stalled) {
230
+ const current = this.currentLimit;
231
+ const durations = this.window.map((c) => c.durationMs).sort((a, b) => a - b);
232
+ const p50 = percentile(durations, 50);
233
+ const errors = this.window.reduce((n, c) => n + (c.ok ? 0 : 1), 0);
234
+ const errorRate = this.window.length === 0 ? 0 : errors / this.window.length;
235
+ const gradient = this.rttLongMs !== undefined && p50 > 0 ? Math.min(1, this.rttLongMs / p50) : 1;
236
+ const rssPct = this.rssPct();
237
+ const saturated = this.inFlightCount >= current * 0.8;
238
+ let next = current;
239
+ let reason;
240
+ if (rssPct >= cfg.ramCeilingPct) {
241
+ next = Math.max(cfg.min, Math.floor(current * 0.8));
242
+ reason = 'ram_ceiling';
243
+ }
244
+ else if (cfg.cpuCeilingPct !== undefined && (this.cpuPct ?? 0) >= cfg.cpuCeilingPct) {
245
+ // CPU at/over the ceiling: never grow; shed one to relieve it.
246
+ next = Math.max(cfg.min, current - 1);
247
+ reason = 'cpu_ceiling';
248
+ }
249
+ else if (errorRate > 0.2 || stalled) {
250
+ next = Math.max(cfg.min, current - 1);
251
+ reason = 'backpressure';
252
+ }
253
+ else if (gradient < 0.7) {
254
+ next = Math.max(cfg.min, Math.floor(current * gradient));
255
+ reason = 'shrink';
256
+ }
257
+ else if (gradient >= 0.9 && saturated) {
258
+ next = Math.min(cfg.max, current + 1);
259
+ reason = 'grow';
260
+ }
261
+ next = clamp(next, cfg.min, cfg.max);
262
+ if (next === current || reason === undefined)
263
+ return;
264
+ this.currentLimit = next;
265
+ this.lastAdjust = { at: this.now(), from: current, to: next, reason };
266
+ this.apply(next);
267
+ }
268
+ /** The shared {@link WorkerStatus} the heartbeat writer stamps. Best-effort fields are omitted when
269
+ * unmeasured (no completions yet → no p95/throughput; no CPU sample yet → no `cpuPct`). */
270
+ snapshot() {
271
+ const durations = this.window.map((c) => c.durationMs).sort((a, b) => a - b);
272
+ const rssBytes = this.readRss();
273
+ const rssLimitBytes = this.memoryLimitBytes;
274
+ const status = {
275
+ runtime: 'node',
276
+ concurrency: {
277
+ mode: this.resolved.mode,
278
+ limit: this.currentLimit,
279
+ ...(this.resolved.mode === 'adaptive' && this.resolved.adaptive
280
+ ? { min: this.resolved.adaptive.min, max: this.resolved.adaptive.max }
281
+ : {}),
282
+ },
283
+ inFlight: this.inFlightCount,
284
+ rssBytes,
285
+ rssLimitBytes,
286
+ rssPct: rssLimitBytes > 0 ? (100 * rssBytes) / rssLimitBytes : 0,
287
+ };
288
+ if (this.cpuPct !== undefined)
289
+ status.cpuPct = this.cpuPct;
290
+ if (this.window.length > 0) {
291
+ status.throughputPerMin = this.throughputPerMin();
292
+ status.p95Ms = percentile(durations, 95);
293
+ }
294
+ if (this.lastAdjust)
295
+ status.lastAdjust = this.lastAdjust;
296
+ return status;
297
+ }
298
+ throughputPerMin() {
299
+ if (this.window.length === 0)
300
+ return 0;
301
+ const first = this.window[0];
302
+ const last = this.window[this.window.length - 1];
303
+ if (!first || !last)
304
+ return 0;
305
+ const spanMs = last.at - first.at;
306
+ // A single completion (or all in the same ms) has no measurable span — report the raw count/min.
307
+ if (spanMs <= 0)
308
+ return this.window.length;
309
+ return (this.window.length / spanMs) * 60_000;
310
+ }
311
+ }
312
+ //# sourceMappingURL=adaptive-concurrency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-concurrency.js","sourceRoot":"","sources":["../../../../src/transports/bullmq/adaptive-concurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAmDzC,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED,iFAAiF;AACjF,SAAS,eAAe,CAAC,KAAyB,EAAE,QAAgB;IAClE,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AACpG,CAAC;AAED,mEAAmE;AACnE,SAAS,cAAc,CAAI,KAAyB,EAAE,QAAW;IAC/D,OAAO,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK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AK,GAAG,UAAU,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,IAAI,CAAC,UAAU;YAAE,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,gBAAgB;QACtB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjD,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;QAClC,iGAAiG;QACjG,IAAI,MAAM,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;IAChD,CAAC;CACF"}
@@ -2,7 +2,8 @@ import type { WorkerDescriptor } from '../../handshake/descriptor.js';
2
2
  import type { GroupHealth, Heartbeat, RemoteTask, RunReply, RunRequest, StartRunMessage, StepResult, TenantEvent, Transport, WorkflowDecision, WorkflowStepEvent, WorkflowTask } from '../../interfaces.js';
3
3
  import { type StepHandler } from '../../protocol.js';
4
4
  import { type WorkflowTurnHandler } from '../../workflow-turn.js';
5
- import type { BullMQDeps, RedisLike } from './deps.js';
5
+ import { type ConcurrencyOption } from './adaptive-concurrency.js';
6
+ import { type BullMQDeps, type RedisLike } from './deps.js';
6
7
  export interface BullMQTransportOptions {
7
8
  /**
8
9
  * Ceiling (ms) `close()` gives the graceful shutdown before it stops waiting and drops the Redis
@@ -34,6 +35,22 @@ export interface BullMQTransportOptions {
34
35
  instanceId?: string | undefined;
35
36
  /** Where a background failure (a failed heartbeat refresh, a result-publish error) is reported. */
36
37
  onError?: ((err: unknown) => void) | undefined;
38
+ /**
39
+ * How many step results this instance settles at once from the results queue. With the default
40
+ * of 1, a wide fan's results queue up behind one checkpoint write at a time on each pod. The engine
41
+ * still resumes one run's turns in order on an instance, so a run never gets two concurrent turns
42
+ * from it. A non-finite or sub-1 value falls back to the default. Default 1.
43
+ */
44
+ resultConcurrency?: number | undefined;
45
+ /**
46
+ * How many tasks each per-routing-token task worker runs at once. A number pins it (a non-finite or
47
+ * sub-1 value falls back to 1). `'adaptive'` or `{ mode: 'adaptive', min, max, start, tickMs,
48
+ * ramCeilingPct, cpuCeilingPct }` lets an {@link AdaptiveController} move the limit at runtime from
49
+ * step latency, error rate and stalls, braking on RAM (and CPU, when a ceiling is set). The live
50
+ * limit, in-flight count and last adjustment ride the worker heartbeat in both modes. Unset leaves
51
+ * each task worker at the deps' default concurrency.
52
+ */
53
+ concurrency?: ConcurrencyOption | undefined;
37
54
  }
38
55
  /**
39
56
  * A queue-backed {@link Transport} over BullMQ/Redis, BYTE-COMPATIBLE with the aviary
@@ -1 +1 @@
1
- {"version":3,"file":"bullmq-transport.d.ts","sourceRoot":"","sources":["../../../../src/transports/bullmq/bullmq-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EAGT,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,KAAK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GAAmG;IAC7F,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAMpD;IAED,wGAAwG;IACxG,UAAU,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,IAAI,CAoBnD;IAED,2GAA2G;IACrG,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxD;IAED;;;;;OAKG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAqB7E;IAyBD,uGAAuG;IACjG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CA8B3B;CACF"}
1
+ {"version":3,"file":"bullmq-transport.d.ts","sourceRoot":"","sources":["../../../../src/transports/bullmq/bullmq-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,UAAU,EACV,eAAe,EACf,UAAU,EACV,WAAW,EACX,SAAS,EAGT,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACvF,OAAO,EACL,KAAK,UAAU,EAEf,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AA4BnB,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,2FAA2F;IAC3F,IAAI,EAAE,UAAU,CAAC;IACjB;;;;OAIG;IACH,SAAS,C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