@graphrefly/graphrefly 0.39.0 → 0.41.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 (218) hide show
  1. package/dist/{cascading-g2_rhhaM.d.ts → cascading-BNfxffgc.d.ts} +1 -1
  2. package/dist/{cascading-BzuxW0_w.d.cts → cascading-Cxs1eztH.d.cts} +1 -1
  3. package/dist/chunk-2W553JJC.js +1 -0
  4. package/dist/{chunk-5LK7XMEV.js → chunk-33N4TU3X.js} +1 -1
  5. package/dist/chunk-4MKL6Q3K.js +1 -0
  6. package/dist/chunk-5B3JDG5F.js +1 -0
  7. package/dist/chunk-5QSXEMXG.js +1 -0
  8. package/dist/{chunk-R75BMDLA.js → chunk-5TEFC2ZX.js} +1 -1
  9. package/dist/chunk-5TOPVRN6.js +1 -0
  10. package/dist/{chunk-INHC33EH.js → chunk-5VEZLQFN.js} +1 -1
  11. package/dist/{chunk-NQI2C36M.js → chunk-7PQLZMOG.js} +1 -1
  12. package/dist/{chunk-7NZMZJMW.js → chunk-AI7QC7J6.js} +1 -1
  13. package/dist/{chunk-L7WY6TZS.js → chunk-AK5RHMC5.js} +1 -1
  14. package/dist/{chunk-ZOX3LBRV.js → chunk-CGNOWGV6.js} +1 -1
  15. package/dist/{chunk-INH6FS2G.js → chunk-CYOSWFT2.js} +1 -1
  16. package/dist/{chunk-GX5LSSRE.js → chunk-EC2WNSZ7.js} +1 -1
  17. package/dist/{chunk-HAWKGIXM.js → chunk-ELAASRBT.js} +1 -1
  18. package/dist/{chunk-7QFRK3N3.js → chunk-F7VUYPP6.js} +1 -1
  19. package/dist/{chunk-LQNOXGET.js → chunk-G3M3IMEV.js} +1 -1
  20. package/dist/{chunk-HX3EGQ5Z.js → chunk-GI4Q7PNY.js} +1 -1
  21. package/dist/{chunk-XQ55HO5N.js → chunk-H5SCWHWP.js} +1 -1
  22. package/dist/{chunk-CGDMTXSY.js → chunk-KNVCCBIU.js} +1 -1
  23. package/dist/{chunk-IA7DUNGB.js → chunk-L77I47VU.js} +1 -1
  24. package/dist/{chunk-JNMC2WJ6.js → chunk-M3FQSXEW.js} +1 -1
  25. package/dist/{chunk-D47YVDR5.js → chunk-OLIKJUKI.js} +1 -1
  26. package/dist/{chunk-SC7BQDNP.js → chunk-OV5AA6HJ.js} +1 -1
  27. package/dist/{chunk-7JRF5YEK.js → chunk-POXANAJ6.js} +1 -1
  28. package/dist/chunk-RSMEXK53.js +43 -0
  29. package/dist/{chunk-KD4NHLMU.js → chunk-SC27WTSG.js} +1 -1
  30. package/dist/chunk-TSOYJ743.js +1 -0
  31. package/dist/{chunk-AU7YTQX7.js → chunk-TT4C7DXW.js} +1 -1
  32. package/dist/{chunk-TFPZLQ5H.js → chunk-UISPDFJ3.js} +1 -1
  33. package/dist/{chunk-N7UIBZCW.js → chunk-URJ2VFNC.js} +1 -1
  34. package/dist/{chunk-GEAO3TL3.js → chunk-VV62MIG4.js} +1 -1
  35. package/dist/{chunk-VJJLIEAL.js → chunk-VXPLLA4P.js} +1 -1
  36. package/dist/{chunk-WHIZM6JV.js → chunk-WZYB3JQS.js} +1 -1
  37. package/dist/{chunk-S2U57TFC.js → chunk-X7QKTXXC.js} +1 -1
  38. package/dist/{chunk-7SD73DS6.js → chunk-YQRN4CIV.js} +1 -1
  39. package/dist/chunk-Z6X7B6A4.js +61 -0
  40. package/dist/{chunk-RF3QZP6D.js → chunk-ZAJ7J7TO.js} +1 -1
  41. package/dist/compat/index.d.cts +6 -6
  42. package/dist/compat/index.d.ts +6 -6
  43. package/dist/compat/index.js +1 -1
  44. package/dist/compat/nestjs/index.d.cts +4 -4
  45. package/dist/compat/nestjs/index.d.ts +4 -4
  46. package/dist/compat/nestjs/index.js +1 -1
  47. package/dist/compat/zustand/index.d.cts +2 -2
  48. package/dist/compat/zustand/index.d.ts +2 -2
  49. package/dist/compat/zustand/index.js +1 -1
  50. package/dist/{composite-DGatA-JK.d.ts → decay-BnrlbxSv.d.ts} +38 -2
  51. package/dist/{composite-CKd0e2vz.d.cts → decay-C25AyNAj.d.cts} +38 -2
  52. package/dist/extra/index.cjs +15 -15
  53. package/dist/extra/index.d.cts +6 -6
  54. package/dist/extra/index.d.ts +6 -6
  55. package/dist/extra/index.js +1 -1
  56. package/dist/extra/node.js +1 -1
  57. package/dist/extra/operators.js +1 -1
  58. package/dist/extra/reactive.d.cts +1 -1
  59. package/dist/extra/reactive.d.ts +1 -1
  60. package/dist/extra/reactive.js +1 -1
  61. package/dist/extra/render/index.d.cts +1 -1
  62. package/dist/extra/render/index.d.ts +1 -1
  63. package/dist/extra/sources.cjs +1 -1
  64. package/dist/extra/sources.js +1 -1
  65. package/dist/graph/index.d.cts +3 -3
  66. package/dist/graph/index.d.ts +3 -3
  67. package/dist/graph/index.js +1 -1
  68. package/dist/{graph-30XSgtVX.d.ts → graph-BkIkog4h.d.ts} +1 -1
  69. package/dist/{graph-BUwMAxJI.d.cts → graph-E6likq7w.d.cts} +1 -1
  70. package/dist/{index-BXd6OMEy.d.ts → index-3k4Gg6-n.d.ts} +2 -2
  71. package/dist/{index-DszPlZzK.d.ts → index-40ZT4MHj.d.ts} +1 -1
  72. package/dist/index-8s-Qm-gz.d.ts +218 -0
  73. package/dist/{index-K-vl_c6A.d.cts → index-A3U3CSve.d.cts} +1 -1
  74. package/dist/{index-jKLph6cu.d.ts → index-B6iTqKtJ.d.ts} +1 -1
  75. package/dist/{index-WyFKER-c.d.ts → index-B72TQQHd.d.cts} +3 -3
  76. package/dist/{index-CmqiJZKM.d.ts → index-BAQrjuZF.d.ts} +64 -6
  77. package/dist/{index-CusEP3Sv.d.ts → index-BQ1fR4li.d.ts} +1 -1
  78. package/dist/{index-jr6PuSBt.d.ts → index-BaA-xpSw.d.ts} +2 -2
  79. package/dist/{index-FVoPvhAu.d.cts → index-Bd91Nmf4.d.cts} +2 -2
  80. package/dist/{index-PqbnoScQ.d.ts → index-BgjS2b8N.d.ts} +2 -2
  81. package/dist/{index-DCbE8fFM.d.cts → index-BiHUBEKq.d.cts} +2 -2
  82. package/dist/{index-DlgHqQxW.d.cts → index-BilOa6AE.d.cts} +6 -32
  83. package/dist/{index-DoYc8BWK.d.cts → index-BmSQLAZo.d.cts} +2 -2
  84. package/dist/{index-DlrWu9Hs.d.cts → index-C-dkXOpB.d.cts} +1 -1
  85. package/dist/{index-C7VV_qOs.d.ts → index-C5cQ7Gfx.d.ts} +2 -2
  86. package/dist/{index-CPhBvRJU.d.ts → index-C6ZUaos7.d.ts} +1 -1
  87. package/dist/{index-PlJ3MraE.d.ts → index-CAP3UGsq.d.ts} +1 -1
  88. package/dist/{index-B41Asm7D.d.ts → index-CD2dBMet.d.ts} +2 -2
  89. package/dist/{index-C19qqa38.d.ts → index-CG33HeBW.d.ts} +19 -4
  90. package/dist/index-CGhMJNHb.d.cts +128 -0
  91. package/dist/{index-BAlaVimV.d.ts → index-CQtWm7jS.d.ts} +2 -2
  92. package/dist/{index-8R1vzNOx.d.cts → index-CRm0YIzC.d.cts} +2 -2
  93. package/dist/index-CUIkE1l9.d.cts +230 -0
  94. package/dist/{index-KlZ_ZUip.d.cts → index-Cczxgd2D.d.ts} +3 -3
  95. package/dist/{index-DIHcMLr6.d.cts → index-CgnCFhr2.d.cts} +1 -1
  96. package/dist/{index-BC9VybQs.d.ts → index-Ck35nA-T.d.ts} +2 -2
  97. package/dist/{index-BndG0cpK.d.cts → index-Cnr1WrlX.d.cts} +1 -1
  98. package/dist/{index-H_I66pav.d.cts → index-CtFNGe-m.d.cts} +2 -2
  99. package/dist/index-CuPUehFa.d.cts +218 -0
  100. package/dist/index-D1Gc7wV5.d.ts +230 -0
  101. package/dist/{index-CWHtYmSh.d.cts → index-D4uimgee.d.cts} +1 -1
  102. package/dist/{index-xZYcDqFH.d.cts → index-DGD4_fj6.d.cts} +19 -4
  103. package/dist/{index-CwP_KAMS.d.cts → index-DGTo1yka.d.cts} +64 -6
  104. package/dist/{index-BUPVld1w.d.ts → index-DH4fm2Ck.d.ts} +2 -2
  105. package/dist/{index-DyM4tFAe.d.cts → index-DQQCOIt8.d.cts} +2 -2
  106. package/dist/{index-BJ26eEjs.d.cts → index-DVAlsmEU.d.cts} +2 -2
  107. package/dist/{index-DINuaZlJ.d.cts → index-DVDapw2k.d.cts} +1 -1
  108. package/dist/{index-iTX5IqSP.d.ts → index-DfOK_oL5.d.ts} +208 -203
  109. package/dist/{index-DTtBpuQy.d.cts → index-DgJc8Zgc.d.cts} +5 -3
  110. package/dist/{index-BKMdnYnk.d.ts → index-DhLyOHYZ.d.ts} +1 -1
  111. package/dist/{index-89FczVZ_.d.ts → index-DhnsQfa3.d.ts} +77 -51
  112. package/dist/{index-L8XI8Zql.d.cts → index-DktLSZOc.d.cts} +2 -2
  113. package/dist/{index-pVDQcbar.d.cts → index-DpiGqtrs.d.cts} +77 -51
  114. package/dist/{index-mNwgxC21.d.cts → index-DuRsN9ae.d.cts} +208 -203
  115. package/dist/{index-B9fmw5n2.d.ts → index-I1cCY3ZI.d.ts} +5 -3
  116. package/dist/index-N2MAxt7_.d.ts +128 -0
  117. package/dist/{index-Br3WnqEn.d.ts → index-WSlcjhQF.d.ts} +6 -32
  118. package/dist/{index-DQUVq1_d.d.ts → index-bXXLSvor.d.ts} +2 -2
  119. package/dist/{index-BhUaMYm_.d.ts → index-da2V5vPy.d.ts} +1 -1
  120. package/dist/{index-PsVHpPwP.d.cts → index-t6L2qpHh.d.cts} +2 -2
  121. package/dist/{index-IwFqHxCs.d.cts → index-tV3AA9hI.d.cts} +1 -1
  122. package/dist/index.cjs +48 -48
  123. package/dist/index.d.cts +33 -33
  124. package/dist/index.d.ts +33 -33
  125. package/dist/index.js +1 -1
  126. package/dist/patterns/ai/browser.cjs +5 -5
  127. package/dist/patterns/ai/browser.d.cts +2 -2
  128. package/dist/patterns/ai/browser.d.ts +2 -2
  129. package/dist/patterns/ai/browser.js +1 -1
  130. package/dist/patterns/ai/index.cjs +14 -14
  131. package/dist/patterns/ai/index.d.cts +11 -11
  132. package/dist/patterns/ai/index.d.ts +11 -11
  133. package/dist/patterns/ai/index.js +1 -1
  134. package/dist/patterns/ai/node.js +1 -1
  135. package/dist/patterns/audit/index.d.cts +3 -3
  136. package/dist/patterns/audit/index.d.ts +3 -3
  137. package/dist/patterns/audit/index.js +1 -1
  138. package/dist/patterns/cqrs/index.d.cts +3 -3
  139. package/dist/patterns/cqrs/index.d.ts +3 -3
  140. package/dist/patterns/cqrs/index.js +1 -1
  141. package/dist/patterns/demo-shell/index.d.cts +3 -3
  142. package/dist/patterns/demo-shell/index.d.ts +3 -3
  143. package/dist/patterns/demo-shell/index.js +1 -1
  144. package/dist/patterns/domain-templates/index.d.cts +2 -2
  145. package/dist/patterns/domain-templates/index.d.ts +2 -2
  146. package/dist/patterns/domain-templates/index.js +1 -1
  147. package/dist/patterns/graphspec/index.d.cts +2 -2
  148. package/dist/patterns/graphspec/index.d.ts +2 -2
  149. package/dist/patterns/graphspec/index.js +1 -1
  150. package/dist/patterns/guarded-execution/index.cjs +3 -3
  151. package/dist/patterns/guarded-execution/index.d.cts +4 -4
  152. package/dist/patterns/guarded-execution/index.d.ts +4 -4
  153. package/dist/patterns/guarded-execution/index.js +1 -1
  154. package/dist/patterns/harness/index.cjs +8 -8
  155. package/dist/patterns/harness/index.d.cts +7 -7
  156. package/dist/patterns/harness/index.d.ts +7 -7
  157. package/dist/patterns/harness/index.js +1 -1
  158. package/dist/patterns/job-queue/index.cjs +3 -3
  159. package/dist/patterns/job-queue/index.d.cts +3 -3
  160. package/dist/patterns/job-queue/index.d.ts +3 -3
  161. package/dist/patterns/job-queue/index.js +1 -1
  162. package/dist/patterns/lens/index.cjs +3 -3
  163. package/dist/patterns/lens/index.d.cts +3 -4
  164. package/dist/patterns/lens/index.d.ts +3 -4
  165. package/dist/patterns/lens/index.js +1 -1
  166. package/dist/patterns/memory/index.cjs +1 -1
  167. package/dist/patterns/memory/index.d.cts +3 -3
  168. package/dist/patterns/memory/index.d.ts +3 -3
  169. package/dist/patterns/memory/index.js +1 -1
  170. package/dist/patterns/messaging/index.d.cts +2 -2
  171. package/dist/patterns/messaging/index.d.ts +2 -2
  172. package/dist/patterns/messaging/index.js +1 -1
  173. package/dist/patterns/orchestration/index.d.cts +3 -3
  174. package/dist/patterns/orchestration/index.d.ts +3 -3
  175. package/dist/patterns/orchestration/index.js +1 -1
  176. package/dist/patterns/process/index.d.cts +4 -4
  177. package/dist/patterns/process/index.d.ts +4 -4
  178. package/dist/patterns/process/index.js +1 -1
  179. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  180. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  181. package/dist/patterns/reactive-layout/index.js +1 -1
  182. package/dist/patterns/reduction/index.d.cts +2 -2
  183. package/dist/patterns/reduction/index.d.ts +2 -2
  184. package/dist/patterns/reduction/index.js +1 -1
  185. package/dist/patterns/refine-loop/index.d.cts +3 -3
  186. package/dist/patterns/refine-loop/index.d.ts +3 -3
  187. package/dist/patterns/refine-loop/index.js +1 -1
  188. package/dist/patterns/resilient-pipeline/index.cjs +3 -1
  189. package/dist/patterns/resilient-pipeline/index.d.cts +7 -3
  190. package/dist/patterns/resilient-pipeline/index.d.ts +7 -3
  191. package/dist/patterns/resilient-pipeline/index.js +1 -1
  192. package/dist/patterns/surface/index.d.cts +3 -3
  193. package/dist/patterns/surface/index.d.ts +3 -3
  194. package/dist/patterns/surface/index.js +1 -1
  195. package/dist/{pipeline-graph-D8vKcO_p.d.ts → pipeline-graph-CB4La-UW.d.ts} +2 -2
  196. package/dist/{pipeline-graph-BQPr2Lqs.d.cts → pipeline-graph-MWrQZXCq.d.cts} +2 -2
  197. package/dist/{reactive-layout-8CSc0tiA.d.cts → reactive-layout-BtZfUKuL.d.cts} +1 -1
  198. package/dist/{reactive-layout-DkTXxtSy.d.ts → reactive-layout-KJj4E2dT.d.ts} +1 -1
  199. package/dist/{reactive-map-B2qfD3hb.d.cts → reactive-map-6P_k3AQM.d.cts} +1 -1
  200. package/dist/{reactive-map-jFIsE6Kt.d.ts → reactive-map-CjXByDV-.d.ts} +1 -1
  201. package/dist/{resilience-HTF2LBRS.js → resilience-JISHQD2F.js} +1 -1
  202. package/dist/{topology-tree-B5Ngw3j0.d.cts → topology-tree-3LBKFsUo.d.cts} +1 -1
  203. package/dist/{topology-tree-BtvbgMXJ.d.ts → topology-tree-mF7Emqzm.d.ts} +1 -1
  204. package/package.json +1 -1
  205. package/dist/chunk-5XRI6RM3.js +0 -1
  206. package/dist/chunk-73PBQNST.js +0 -1
  207. package/dist/chunk-A6ZSKGUG.js +0 -1
  208. package/dist/chunk-EWF7KCDJ.js +0 -61
  209. package/dist/chunk-IUB4NYI2.js +0 -1
  210. package/dist/chunk-MC4UYY2X.js +0 -1
  211. package/dist/chunk-XEUANKBO.js +0 -43
  212. package/dist/chunk-ZJ7SM3G2.js +0 -1
  213. package/dist/index-BEHmxORq.d.ts +0 -135
  214. package/dist/index-BM9szD8n.d.cts +0 -113
  215. package/dist/index-BskfDoZ_.d.ts +0 -113
  216. package/dist/index-CIRG8Hxp.d.cts +0 -135
  217. package/dist/index-Cey6VTnX.d.ts +0 -166
  218. package/dist/index-CpLpJb6A.d.cts +0 -166
@@ -0,0 +1,218 @@
1
+ import { N as Node, A as Actor, P as PolicyRuleData } from './node-BYInONRr.cjs';
2
+ import { G as Graph, b as GraphDescribeOutput, a as GraphOptions, d as GraphDescribeOptions, D as DescribeFilter } from './graph-E6likq7w.cjs';
3
+ import { P as PolicyGateGraph, a as PolicyViolation } from './index-BmSQLAZo.cjs';
4
+ import { T as TopicGraph } from './index-Cnr1WrlX.cjs';
5
+
6
+ /**
7
+ * Composable safety layer (roadmap §9.0b — Tier 5.1 Wave-B rebuild).
8
+ *
9
+ * {@link guardedExecution} wraps any {@link Graph} with:
10
+ *
11
+ * - {@link policyGate} — reactive ABAC (Tier 2.3 rename of `policyEnforcer`),
12
+ * policies stored as a `Node` so LLMs / humans can update them at runtime.
13
+ * Full transitive dynamic coverage via `watchTopologyTree`.
14
+ * - Reactive {@link GuardedExecutionGraph.scopedDescribeNode} — a thin
15
+ * delegate over `target.describe({ reactive: true, actor })` that re-derives
16
+ * on every settle (topology change, error transition, actor swap).
17
+ * - The enforcer's `violations` topic is republished as `violations` on
18
+ * the wrapper, composable with {@link graphLens}'s `health`.
19
+ * - The wrapper-level `lints` topic surfaces non-policy diagnostic warnings
20
+ * (`empty-policies` / `audit-no-effect` / `no-actor`) so misconfigurations
21
+ * are caught reactively rather than via thrown errors at scattered call sites.
22
+ * - The `scope` derived publishes the current configuration tuple
23
+ * (`{actor, mode, policiesCount}`) for dashboards.
24
+ *
25
+ * V1 scope: policies + actor + reactive scoped describe + lints + scope.
26
+ * Budget-as-option is NOT in V1 — it requires a cost-tracking design that
27
+ * hasn't landed yet. Callers who need a budget limit today append a
28
+ * budget-aware {@link PolicyRuleData} to the policies list (check current
29
+ * cost and `deny` when exhausted).
30
+ *
31
+ * @module
32
+ */
33
+
34
+ /** Diagnostic warning published on {@link GuardedExecutionGraph.lints}. */
35
+ interface GuardedExecutionLint {
36
+ /**
37
+ * - `"empty-policies"` — `policies` Node emitted an empty array in
38
+ * `mode: "enforce"`. Static empty arrays throw at construction; this
39
+ * covers the reactive case.
40
+ * - `"audit-no-effect"` — `mode: "audit"` plus the target has no per-node
41
+ * guards, so `scopedDescribeNode` filters by per-node guards only and
42
+ * policies will never gate visibility (they still populate `violations`
43
+ * on writes).
44
+ * - `"no-actor"` — neither a wrapper-configured nor per-call actor was
45
+ * supplied. `scopedDescribeNode` falls back to "describe everything"
46
+ * for the corresponding subscription.
47
+ */
48
+ kind: "empty-policies" | "audit-no-effect" | "no-actor";
49
+ message: string;
50
+ timestamp_ns: number;
51
+ }
52
+ /** Configuration tuple published on {@link GuardedExecutionGraph.scope}. */
53
+ interface GuardedScope {
54
+ /** The wrapper-configured default actor, or `null` when none configured. */
55
+ actor: Actor | null;
56
+ mode: "audit" | "enforce";
57
+ /** Current policy count (reactive — re-emits on `policies` Node updates). */
58
+ policiesCount: number;
59
+ }
60
+ /** Options for {@link guardedExecution}. */
61
+ interface GuardedExecutionOptions {
62
+ /**
63
+ * Policies enforced against every guarded write. Static list or a live
64
+ * `Node<readonly PolicyRuleData[]>` (LLM-updatable).
65
+ *
66
+ * **Empty-policies handling:**
67
+ * - Static empty array + `mode: "enforce"` throws `RangeError` at
68
+ * construction (deny-by-default is almost certainly a misconfiguration).
69
+ * - Node-supplied empty array + `mode: "enforce"` emits a one-time
70
+ * `"empty-policies"` lint on first such emission (the wrapper can't
71
+ * throw mid-run — surface the warning reactively).
72
+ * - `mode: "audit"` tolerates empty policies (no guards stacked; policies
73
+ * only feed the `violations` channel on writes).
74
+ */
75
+ policies: readonly PolicyRuleData[] | Node<readonly PolicyRuleData[]>;
76
+ /**
77
+ * Default actor used when the caller invokes
78
+ * {@link GuardedExecutionGraph.scopedDescribeNode} without an override.
79
+ * Accepts a static {@link Actor} or a `Node<Actor>` — when a Node is
80
+ * supplied, the reactive describe re-derives on every actor emission so
81
+ * harnesses binding a per-turn actor get a single live describe Node
82
+ * instead of re-creating one per turn.
83
+ *
84
+ * Omit to scope per-call only. A `"no-actor"` lint fires once per instance
85
+ * if neither a configured nor per-call actor is ever supplied (the
86
+ * resulting describe is unscoped — full visibility).
87
+ */
88
+ actor?: Actor | Node<Actor>;
89
+ /**
90
+ * `"enforce"` (default) — push guards onto target nodes so disallowed
91
+ * writes throw {@link GuardDenied}.
92
+ * `"audit"` — record would-be denials to the `violations` topic without
93
+ * blocking writes.
94
+ */
95
+ mode?: "audit" | "enforce";
96
+ /** Ring-buffer cap for the `violations` topic. Default 1000 (inherited from policyGate). */
97
+ violationsLimit?: number;
98
+ /** Ring-buffer cap for the `lints` topic. Default 64 — each lint kind fires at most once per instance. */
99
+ lintsLimit?: number;
100
+ /** Wrapper graph name. Default `${target.name}_guarded`. */
101
+ name?: string;
102
+ /** Wrapper graph options. */
103
+ graph?: GraphOptions;
104
+ }
105
+ /**
106
+ * Wrapper over a target {@link Graph} providing reactive ABAC + reactive
107
+ * scoped describe + diagnostic lints. Mounts a {@link PolicyGateGraph} under
108
+ * `enforcer`, a {@link TopicGraph} of {@link GuardedExecutionLint} under
109
+ * `lints`, and a `scope` derived publishing `{actor, mode, policiesCount}`.
110
+ *
111
+ * @category patterns
112
+ */
113
+ declare class GuardedExecutionGraph extends Graph {
114
+ readonly enforcer: PolicyGateGraph;
115
+ readonly violations: TopicGraph<PolicyViolation>;
116
+ readonly lints: TopicGraph<GuardedExecutionLint>;
117
+ readonly scope: Node<GuardedScope>;
118
+ /**
119
+ * Canonical reactive describe scoped to the wrapper's configured `actor`.
120
+ * Subscribes ONCE at construction; lifecycle owned by the wrapper (disposed
121
+ * on `wrapper.destroy()`). Use this property for the common case
122
+ * (long-lived consumer wanting "describe scoped to my actor"); use
123
+ * {@link scopedDescribeNode} only when a per-call actor override or
124
+ * different `detail`/`fields` is required.
125
+ *
126
+ * Re-derives on every settle of the target graph: structural changes,
127
+ * status transitions (errors flip nodes into `"errored"`), and actor
128
+ * emissions (when a `Node<Actor>` is bound, including the SENTINEL bridge
129
+ * applied internally — see qa G1B).
130
+ */
131
+ readonly scopedDescribe: Node<GraphDescribeOutput>;
132
+ private readonly _target;
133
+ private readonly _actorNode;
134
+ private readonly _mode;
135
+ private readonly _firedLintKinds;
136
+ constructor(target: Graph, opts: GuardedExecutionOptions);
137
+ private _fireLint;
138
+ /**
139
+ * **Per-call escape hatch.** Prefer {@link scopedDescribe} (the mounted
140
+ * property) for the common case of "describe scoped to my actor." Use
141
+ * this method ONLY when you need a per-call actor override or different
142
+ * `detail`/`fields`/`filter`.
143
+ *
144
+ * Returns a live `Node<GraphDescribeOutput>` scoped to the supplied (or
145
+ * configured) actor, plus an explicit `dispose` for caller-controlled
146
+ * lifecycle. Re-derives on every settle of the target graph: structural
147
+ * changes, status transitions, and actor emissions (when a `Node<Actor>`
148
+ * is bound).
149
+ *
150
+ * **Lifecycle (qa G1A — EC1 fix).** Each call instantiates a fresh
151
+ * `target.describe({reactive: true})` handle (with its own version state,
152
+ * observe handle, transitive topology subscriptions, derived + keepalive).
153
+ * The caller MUST invoke the returned `dispose()` when finished to release
154
+ * these resources. Disposers ARE also tracked on the wrapper graph so
155
+ * `wrapper.destroy()` cleans up any handles the caller forgot — but a
156
+ * long-lived wrapper with heavy per-call usage will leak until destroy
157
+ * unless `dispose()` is called explicitly.
158
+ *
159
+ * @param actorOverride - Optional per-call override. Static {@link Actor}
160
+ * or `Node<Actor>`. Omit to use the wrapper-configured default.
161
+ * @param opts - Standard {@link GraphDescribeOptions} fields (`detail`,
162
+ * `fields`, `filter`). `actor` / `reactive` / `reactiveName` are
163
+ * controlled by the wrapper.
164
+ * @returns `{node, dispose}` — `node` is the live describe Node; `dispose`
165
+ * tears down the underlying reactive describe subscription idempotently.
166
+ */
167
+ scopedDescribeNode(actorOverride?: Actor | Node<Actor>, opts?: Omit<GraphDescribeOptions, "actor" | "reactive" | "reactiveName">): {
168
+ node: Node<GraphDescribeOutput>;
169
+ dispose: () => void;
170
+ };
171
+ /** The wrapped graph (escape hatch for tooling). */
172
+ get target(): Graph;
173
+ }
174
+ /**
175
+ * Wrap a {@link Graph} with {@link policyGate} plus a reactive scoped describe
176
+ * lens. Returns a {@link GuardedExecutionGraph} that can be mounted, diffed,
177
+ * or composed with {@link graphLens}.
178
+ *
179
+ * @param target - The graph to guard.
180
+ * @param opts - See {@link GuardedExecutionOptions}.
181
+ *
182
+ * @example
183
+ * ```ts
184
+ * const guarded = guardedExecution(app, {
185
+ * actor: state<Actor>({ type: "human", id: "alice" }), // reactive — re-derive on swap
186
+ * policies: [
187
+ * { effect: "allow", action: "read", actorType: "human" },
188
+ * { effect: "deny", action: "write", pathPattern: "system::*" },
189
+ * ],
190
+ * mode: "enforce",
191
+ * });
192
+ *
193
+ * // Canonical: subscribe to the mounted reactive describe (no per-call leak).
194
+ * guarded.scopedDescribe.subscribe((msgs) => { /* live describe per actor / topology change *\/ });
195
+ * // Per-call escape hatch (different actor / detail) — caller manages dispose.
196
+ * const detailed = guarded.scopedDescribeNode(undefined, { detail: "standard" });
197
+ * try { detailed.node.subscribe(/* … *\/); } finally { detailed.dispose(); }
198
+ * guarded.violations.events.subscribe(msgs => console.log("violations:", msgs));
199
+ * guarded.lints.events.subscribe(msgs => console.warn("lints:", msgs));
200
+ * guarded.scope.subscribe(msgs => console.log("scope:", msgs));
201
+ * ```
202
+ *
203
+ * @category patterns
204
+ */
205
+ declare function guardedExecution(target: Graph, opts: GuardedExecutionOptions): GuardedExecutionGraph;
206
+
207
+ declare const index_DescribeFilter: typeof DescribeFilter;
208
+ type index_GuardedExecutionGraph = GuardedExecutionGraph;
209
+ declare const index_GuardedExecutionGraph: typeof GuardedExecutionGraph;
210
+ type index_GuardedExecutionLint = GuardedExecutionLint;
211
+ type index_GuardedExecutionOptions = GuardedExecutionOptions;
212
+ type index_GuardedScope = GuardedScope;
213
+ declare const index_guardedExecution: typeof guardedExecution;
214
+ declare namespace index {
215
+ export { index_DescribeFilter as DescribeFilter, index_GuardedExecutionGraph as GuardedExecutionGraph, type index_GuardedExecutionLint as GuardedExecutionLint, type index_GuardedExecutionOptions as GuardedExecutionOptions, type index_GuardedScope as GuardedScope, index_guardedExecution as guardedExecution };
216
+ }
217
+
218
+ export { GuardedExecutionGraph as G, type GuardedExecutionLint as a, type GuardedExecutionOptions as b, type GuardedScope as c, guardedExecution as g, index as i };
@@ -0,0 +1,230 @@
1
+ import { f as factoryTag, p as placeholderArgs } from './meta-D8OyedKp.js';
2
+ import { N as Node } from './node-BYInONRr.js';
3
+ import { S as StatusValue, C as CircuitState, R as RateLimiterState, a as RateLimiterOptions, b as CircuitBreakerOptions, c as RetryOptions, F as FallbackInput, N as NS_PER_MS, d as NS_PER_SEC } from './index-BAQrjuZF.js';
4
+ import { G as Graph, a as GraphOptions } from './graph-BkIkog4h.js';
5
+ import { B as BudgetConstraint } from './budget-gate-CmmVtasH.js';
6
+
7
+ /**
8
+ * Resilience composition with correct nesting order (roadmap §9.0b — Tier 5.2 Wave-B rebuild).
9
+ *
10
+ * {@link resilientPipeline} composes the resilience primitives from
11
+ * `extra/resilience/` in the canonical nesting order:
12
+ *
13
+ * ```text
14
+ * rateLimit → budget → breaker → timeout → retry → fallback → status
15
+ * ```
16
+ *
17
+ * Returns a {@link ResilientPipelineGraph} (Graph subclass) with mounted
18
+ * intermediate nodes and per-layer status companions, replacing the prior
19
+ * bundle return. Each intermediate is mounted under a stable name so
20
+ * `pipeline.describe()` shows the resilience chain in topology snapshots,
21
+ * mermaid renders, and `lens.health` aggregations.
22
+ *
23
+ * **Per-attempt timeout vs. retry ordering.** `timeout` is applied BEFORE
24
+ * `retry` so each retry attempt resubscribes to a fresh deadline (per-attempt
25
+ * semantics). If `timeout` wrapped `retry`, a single deadline would apply to
26
+ * the entire retry chain — not what callers expect.
27
+ *
28
+ * **`breakerOnOpen` + `retry` interaction.** With `breakerOnOpen: "error"` AND
29
+ * `retry`, retry sees `CircuitOpenError` and resubscribes; the next attempt
30
+ * very likely also breaker-open → another error → retry burns its budget
31
+ * against an open circuit. Either set retry's `backoff` long enough for the
32
+ * breaker reset window OR keep the default `breakerOnOpen: "skip"` (emits
33
+ * RESOLVED when open; downstream drops the beat without retry firing).
34
+ *
35
+ * **Reactive options (switchMap rebuild).** Every primitive option accepts a
36
+ * `T | Node<T>` (precedent-aligned with `FallbackInput<T>`). When the caller
37
+ * supplies a static value, the layer is built once at construction. When the
38
+ * caller supplies a `Node<T>`, the pipeline subscribes via `switchMap` and
39
+ * **rebuilds the layer on every option emission** — the chain stalls until
40
+ * the option Node emits its first DATA. Each rebuild creates a fresh
41
+ * primitive instance, so internal state is lost (rate-limiter pending buffer,
42
+ * breaker failure count, retry attempt count, in-flight timeout). Per-layer
43
+ * **companion Nodes** (`droppedCount`, `rateLimitState`, `breakerState`) are
44
+ * therefore exposed ONLY for the static-options path. Primitive-side widening
45
+ * (filed in `docs/optimizations.md` under "Tier 5.2 follow-up — primitive-side
46
+ * reactive-options widening") will preserve internal state once it lands and
47
+ * the pipeline will trivially forward Node-form options to the primitive.
48
+ *
49
+ * @module
50
+ */
51
+
52
+ /**
53
+ * `T | Node<T>` for primitive options — precedent-aligned with
54
+ * {@link FallbackInput} and `policyGate.policies`. When the caller supplies a
55
+ * static value, the layer is built once at construction. When the caller
56
+ * supplies a `Node<T>`, the pipeline subscribes via {@link switchMap}: the
57
+ * layer is rebuilt on every option emission. **State-loss caveat:** each
58
+ * rebuild creates a fresh primitive instance — `rateLimiter` loses its pending
59
+ * buffer, `circuitBreaker` resets failure count, `retry` resets attempt
60
+ * count, `timeout` cancels in-flight deadline. This is the documented
61
+ * switchMap-pattern semantics; primitive-side widening (filed in
62
+ * `docs/optimizations.md`) will preserve internal state once it lands and the
63
+ * pipeline can forward Node-form options directly.
64
+ *
65
+ * Per-layer **companion Nodes** (`droppedCount`, `rateLimitState`,
66
+ * `breakerState`) are exposed only for the static-options path — Node-form
67
+ * leaves them as `undefined` because each rebuild creates new companion
68
+ * instances and a switchMap-mirrored companion would track only the latest
69
+ * bundle. Callers needing both reactive options AND companions wait for
70
+ * primitive-side widening.
71
+ */
72
+ type NodeOrValue<T> = T | Node<T>;
73
+ /**
74
+ * Options for {@link resilientPipeline}. Every layer is optional — omit a
75
+ * field and that layer is skipped.
76
+ *
77
+ * Reactive (`Node<T>`) forms are accepted everywhere a primitive value would
78
+ * fit; the pipeline subscribes via `switchMap` and rebuilds the layer on each
79
+ * emission. See module JSDoc for the rebuild semantics + state-loss caveat.
80
+ */
81
+ interface ResilientPipelineOptions<T> {
82
+ /**
83
+ * Admission control — at most `maxEvents` `DATA` per `windowNs`. See
84
+ * {@link rateLimiter}.
85
+ *
86
+ * `maxBuffer` is optional at the pipeline layer (defaults to `Infinity`,
87
+ * preserving the historical unbounded behavior). Pass an explicit positive
88
+ * integer to opt in to a bounded queue.
89
+ */
90
+ rateLimit?: NodeOrValue<Omit<RateLimiterOptions, "maxBuffer"> & {
91
+ maxBuffer?: number;
92
+ }>;
93
+ /** Cost/constraint gate. See {@link budgetGate}. */
94
+ budget?: NodeOrValue<ReadonlyArray<BudgetConstraint>>;
95
+ /** Circuit breaker — fail-fast when the downstream resource is unhealthy. See {@link circuitBreaker}. */
96
+ breaker?: NodeOrValue<CircuitBreakerOptions>;
97
+ /**
98
+ * Behavior when the breaker is open:
99
+ * - `"skip"` (default) — emit `RESOLVED` (lets downstream drop the beat).
100
+ * - `"error"` — emit a `CircuitOpenError` so `retry` / `fallback` can react.
101
+ * See module JSDoc for the retry-budget burn caveat.
102
+ *
103
+ * Static (configuration-only — no reactive form).
104
+ */
105
+ breakerOnOpen?: "skip" | "error";
106
+ /** Retry policy on terminal `ERROR`. See {@link retry}. */
107
+ retry?: NodeOrValue<RetryOptions>;
108
+ /**
109
+ * Per-attempt deadline in milliseconds. Converted to ns internally. Omit
110
+ * to skip the timeout wrap.
111
+ *
112
+ * Specified in ms (not ns) because callers consistently think in
113
+ * millisecond deadlines; the underlying {@link timeout} primitive takes ns
114
+ * internally.
115
+ */
116
+ timeoutMs?: NodeOrValue<number>;
117
+ /** Final fallback value emitted on terminal `ERROR` after retry exhausts. See {@link fallback}. */
118
+ fallback?: FallbackInput<T>;
119
+ /**
120
+ * Initial status reported by the status node. Default `"pending"`. Static.
121
+ */
122
+ initialStatus?: StatusValue;
123
+ /** Wrapper graph name. Default `"resilient_pipeline"`. */
124
+ name?: string;
125
+ /** Wrapper graph options. */
126
+ graph?: GraphOptions;
127
+ }
128
+ /**
129
+ * Graph subclass returned by {@link resilientPipeline}. Mounts each
130
+ * configured intermediate under a stable name and exposes per-layer status
131
+ * companions.
132
+ *
133
+ * @category patterns
134
+ */
135
+ declare class ResilientPipelineGraph<T> extends Graph {
136
+ /**
137
+ * Final resilient node — subscribe to this for `DATA` emissions.
138
+ *
139
+ * Named `output` (not `node`) because `Graph.node(name)` already names the
140
+ * path-resolution method on the base class; a `readonly node` field would
141
+ * shadow it.
142
+ */
143
+ readonly output: Node<T>;
144
+ /** Live status: `"pending" | "running" | "completed" | "errored"`. */
145
+ readonly status: Node<StatusValue>;
146
+ /**
147
+ * Last error payload, or `null` when not errored.
148
+ *
149
+ * Named `lastError` (not `error`) because `Graph.error(name, err)` already
150
+ * names a method on the base class.
151
+ */
152
+ readonly lastError: Node<unknown | null>;
153
+ /** Breaker state when `opts.breaker` is provided; `undefined` otherwise. */
154
+ readonly breakerState: Node<CircuitState> | undefined;
155
+ /**
156
+ * Drop-counter when `opts.rateLimit` is provided; `undefined` otherwise.
157
+ *
158
+ * **Lifetime note:** `droppedCount` retains its final value through
159
+ * terminal (`COMPLETE` / `ERROR` / `TEARDOWN`); the underlying counter
160
+ * resets to `0` only at the next subscription cycle.
161
+ */
162
+ readonly droppedCount: Node<number> | undefined;
163
+ /**
164
+ * Combined rate-limit state when `opts.rateLimit` is provided; `undefined`
165
+ * otherwise. Same lifecycle as {@link droppedCount} but exposes
166
+ * `pendingCount` and `paused` alongside the drop counter for richer
167
+ * backpressure observability (Tier 5.2 D7).
168
+ */
169
+ readonly rateLimitState: Node<RateLimiterState> | undefined;
170
+ constructor(source: Node<T>, opts?: ResilientPipelineOptions<T>);
171
+ }
172
+ /**
173
+ * Compose a resilient pipeline around `source` in the canonical nesting
174
+ * order — `rateLimit → budget → breaker → timeout → retry → fallback → status`.
175
+ * Omit any option to skip that layer.
176
+ *
177
+ * Returns a {@link ResilientPipelineGraph} (Graph subclass) —
178
+ * `pipeline.output` is the externally visible final node; `pipeline.status`
179
+ * / `pipeline.lastError` / `pipeline.breakerState` / `pipeline.droppedCount`
180
+ * are the per-layer companions. Call `pipeline.describe()` to see the
181
+ * mounted intermediates; compose with {@link graphLens}'s `health` for
182
+ * aggregate status.
183
+ *
184
+ * **Naming note:** `output` and `lastError` (not `node` / `error`) avoid
185
+ * clashes with `Graph.node(name)` and `Graph.error(name, err)` on the base
186
+ * class.
187
+ *
188
+ * @param source - Upstream node to wrap.
189
+ * @param opts - See {@link ResilientPipelineOptions}. All fields optional.
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * const safeFetch = resilientPipeline(fetchNode, {
194
+ * rateLimit: { maxEvents: 10, windowNs: NS_PER_SEC },
195
+ * breaker: { failureThreshold: 5 },
196
+ * retry: { count: 3, backoff: "exponential" },
197
+ * timeoutMs: 10_000,
198
+ * fallback: null,
199
+ * });
200
+ * safeFetch.output.subscribe(msgs => console.log(msgs));
201
+ * safeFetch.status.subscribe(msgs => console.log(msgs));
202
+ * safeFetch.describe({ format: "ascii" }); // visualize the chain
203
+ * ```
204
+ *
205
+ * @category patterns
206
+ */
207
+ declare function resilientPipeline<T>(source: Node<T>, opts?: ResilientPipelineOptions<T>): ResilientPipelineGraph<T>;
208
+
209
+ declare const index_BudgetConstraint: typeof BudgetConstraint;
210
+ declare const index_CircuitBreakerOptions: typeof CircuitBreakerOptions;
211
+ declare const index_CircuitState: typeof CircuitState;
212
+ declare const index_FallbackInput: typeof FallbackInput;
213
+ declare const index_NS_PER_MS: typeof NS_PER_MS;
214
+ declare const index_NS_PER_SEC: typeof NS_PER_SEC;
215
+ type index_NodeOrValue<T> = NodeOrValue<T>;
216
+ declare const index_RateLimiterOptions: typeof RateLimiterOptions;
217
+ declare const index_RateLimiterState: typeof RateLimiterState;
218
+ type index_ResilientPipelineGraph<T> = ResilientPipelineGraph<T>;
219
+ declare const index_ResilientPipelineGraph: typeof ResilientPipelineGraph;
220
+ type index_ResilientPipelineOptions<T> = ResilientPipelineOptions<T>;
221
+ declare const index_RetryOptions: typeof RetryOptions;
222
+ declare const index_StatusValue: typeof StatusValue;
223
+ declare const index_factoryTag: typeof factoryTag;
224
+ declare const index_placeholderArgs: typeof placeholderArgs;
225
+ declare const index_resilientPipeline: typeof resilientPipeline;
226
+ declare namespace index {
227
+ export { index_BudgetConstraint as BudgetConstraint, index_CircuitBreakerOptions as CircuitBreakerOptions, index_CircuitState as CircuitState, index_FallbackInput as FallbackInput, index_NS_PER_MS as NS_PER_MS, index_NS_PER_SEC as NS_PER_SEC, type index_NodeOrValue as NodeOrValue, index_RateLimiterOptions as RateLimiterOptions, index_RateLimiterState as RateLimiterState, index_ResilientPipelineGraph as ResilientPipelineGraph, type index_ResilientPipelineOptions as ResilientPipelineOptions, index_RetryOptions as RetryOptions, index_StatusValue as StatusValue, index_factoryTag as factoryTag, index_placeholderArgs as placeholderArgs, index_resilientPipeline as resilientPipeline };
228
+ }
229
+
230
+ export { type NodeOrValue as N, ResilientPipelineGraph as R, type ResilientPipelineOptions as a, index as i, resilientPipeline as r };
@@ -1,4 +1,4 @@
1
- import { C as CatchOptions, a as ClassifyResult, D as Decision, b as DecisionAction, G as GateController, c as GateOptions, P as PipelineGraph, S as StepRef, T as TerminalCause, d as decisionKeyOf, p as pipelineGraph } from './pipeline-graph-BQPr2Lqs.cjs';
1
+ import { C as CatchOptions, a as ClassifyResult, D as Decision, b as DecisionAction, G as GateController, c as GateOptions, P as PipelineGraph, S as StepRef, T as TerminalCause, d as decisionKeyOf, p as pipelineGraph } from './pipeline-graph-MWrQZXCq.cjs';
2
2
 
3
3
  /**
4
4
  * Orchestration patterns (roadmap §4.1).
@@ -1,9 +1,9 @@
1
1
  import { N as Node } from './node-BYInONRr.cjs';
2
- import { B as BaseAuditRecord } from './index-DINuaZlJ.cjs';
2
+ import { B as BaseAuditRecord } from './index-DVDapw2k.cjs';
3
3
  import { a as ReactiveLogBundle } from './reactive-log-_zeEnB9H.cjs';
4
4
  import { NodeInput } from './extra/sources.cjs';
5
5
  import { AppendLogStorageTier } from './extra/storage-tiers.cjs';
6
- import { G as Graph, a as GraphOptions } from './graph-BUwMAxJI.cjs';
6
+ import { G as Graph, a as GraphOptions } from './graph-E6likq7w.cjs';
7
7
 
8
8
  /**
9
9
  * Job queue patterns (roadmap §4.2).
@@ -112,16 +112,31 @@ type StageDef<T> = string | {
112
112
  id: string;
113
113
  version: string | number;
114
114
  };
115
+ /**
116
+ * Per-stage cap on `claim → work → ack` cycles per pump tick.
117
+ * Overrides {@link JobFlowOptions.maxPerPump} for this stage. Useful
118
+ * when stages have asymmetric cost (e.g. an LLM-execute stage capped
119
+ * at 4 concurrent calls while a cheap verify stage runs unbounded).
120
+ *
121
+ * Falls back to the top-level `JobFlowOptions.maxPerPump`, which in
122
+ * turn falls back to `DEFAULT_MAX_PER_PUMP` (256).
123
+ */
124
+ maxPerPump?: number;
115
125
  };
116
126
  type JobFlowOptions<T = unknown> = {
117
127
  graph?: GraphOptions;
118
128
  /**
119
129
  * Stage definitions. Each stage is either a bare name string (pure
120
- * pass-through) or a `{ name, work?, handlerVersion? }` object.
130
+ * pass-through) or a `{ name, work?, handlerVersion?, maxPerPump? }` object.
121
131
  *
122
132
  * For back-compat, `string[]` values behave as stages with no work hook.
123
133
  */
124
134
  stages?: readonly StageDef<T>[];
135
+ /**
136
+ * Default cap on claims per pump tick across all stages. Per-stage
137
+ * overrides can be set on each {@link StageDef.maxPerPump}; if neither is
138
+ * set, falls back to `DEFAULT_MAX_PER_PUMP` (256).
139
+ */
125
140
  maxPerPump?: number;
126
141
  };
127
142
  declare class JobFlowGraph<T> extends Graph {
@@ -168,4 +183,4 @@ declare namespace index {
168
183
  export { type index_JobEnvelope as JobEnvelope, type index_JobEvent as JobEvent, type index_JobEventAction as JobEventAction, index_JobFlowGraph as JobFlowGraph, type index_JobFlowOptions as JobFlowOptions, index_JobQueueGraph as JobQueueGraph, type index_JobQueueOptions as JobQueueOptions, type index_JobState as JobState, type index_StageDef as StageDef, type index_WorkFn as WorkFn, index_jobEventKeyOf as jobEventKeyOf, index_jobFlow as jobFlow, index_jobQueue as jobQueue };
169
184
  }
170
185
 
171
- export { JobQueueGraph as J, type StageDef as S, type WorkFn as W, type JobEnvelope as a, type JobEvent as b, type JobEventAction as c, JobFlowGraph as d, type JobFlowOptions as e, type JobQueueOptions as f, type JobState as g, jobFlow as h, index as i, jobEventKeyOf as j, jobQueue as k };
186
+ export { type JobEnvelope as J, type StageDef as S, type WorkFn as W, JobFlowGraph as a, JobQueueGraph as b, type JobEvent as c, type JobEventAction as d, type JobFlowOptions as e, type JobQueueOptions as f, type JobState as g, jobFlow as h, index as i, jobEventKeyOf as j, jobQueue as k };
@@ -169,6 +169,13 @@ type RetryOptions = {
169
169
  count?: number;
170
170
  /** Delay between attempts; strategies use **nanoseconds**. */
171
171
  backoff?: BackoffStrategy | BackoffPreset;
172
+ /**
173
+ * Caller-supplied metadata merged into the produced node's `meta` (Tier 5.2
174
+ * D8 widening). Use {@link domainMeta} to tag the layer for `describe()`
175
+ * grouping. The primitive's `factoryTag("retry", …)` always wins against
176
+ * caller keys.
177
+ */
178
+ meta?: Record<string, unknown>;
172
179
  };
173
180
  /** Factory-mode-only options. `initial` seeds the outer node's cache before the first attempt. */
174
181
  type RetryFactoryOptions<T> = RetryOptions & {
@@ -323,6 +330,7 @@ type WithBreakerBundle<T> = {
323
330
  */
324
331
  declare function withBreaker<T>(breaker: CircuitBreaker, options?: {
325
332
  onOpen?: "skip" | "error";
333
+ meta?: Record<string, unknown>;
326
334
  }): (source: Node<T>) => WithBreakerBundle<T>;
327
335
  interface TokenBucket {
328
336
  /**
@@ -409,6 +417,15 @@ type RateLimiterOptions = {
409
417
  maxBuffer: number;
410
418
  /** Overflow policy when `maxBuffer` is exceeded. Default: `"drop-newest"`. */
411
419
  onOverflow?: RateLimiterOverflowPolicy;
420
+ /**
421
+ * Caller-supplied metadata merged into the produced node's `meta` (Tier 5.2
422
+ * D8 widening). Use {@link domainMeta} to tag the layer for `describe()` /
423
+ * mermaid grouping (e.g. `domainMeta("resilient", "rate-limit")`). The
424
+ * primitive's own `factoryTag("rateLimiter", opts)` and the `droppedCount`
425
+ * / `rateLimitState` companion seeds always win against caller-supplied
426
+ * keys so the audit trail can't be silently overwritten.
427
+ */
428
+ meta?: Record<string, unknown>;
412
429
  };
413
430
  /**
414
431
  * Thrown by {@link rateLimiter} when `onOverflow: "error"` and the pending buffer is full.
@@ -419,24 +436,60 @@ declare class RateLimiterOverflowError extends Error {
419
436
  name: string;
420
437
  constructor(maxBuffer: number);
421
438
  }
439
+ /**
440
+ * Combined runtime state surfaced by {@link rateLimiter} alongside `droppedCount`.
441
+ * Tier 5.2 D7 widening — exposes pending-buffer occupancy and a `paused`
442
+ * flag so consumers can render backpressure (UI), feed `lens.health`, or
443
+ * gate downstream effects.
444
+ */
445
+ type RateLimiterState = {
446
+ /** Cumulative `DATA` items dropped due to overflow since this subscription cycle started. */
447
+ droppedCount: number;
448
+ /** Items currently buffered awaiting a token refill. `0` when the limiter is passing through. */
449
+ pendingCount: number;
450
+ /** `true` when at least one item is queued (the limiter is actively throttling). */
451
+ paused: boolean;
452
+ };
422
453
  /** Bundle returned by {@link rateLimiter}. */
423
454
  type RateLimiterBundle<T> = {
424
455
  /** The throttled stream — at most `maxEvents` `DATA` per `windowNs`. */
425
456
  node: Node<T>;
426
457
  /**
427
- * Reactive companion: count of `DATA` items dropped since subscription start.
458
+ * Reactive companion: count of `DATA` items dropped since the producer
459
+ * activated.
428
460
  *
429
461
  * - Increments on every drop under any overflow policy (`drop-newest`,
430
462
  * `drop-oldest`). The `error` policy terminates the stream after a single
431
463
  * overflow, so `droppedCount` increments at most once in that path.
432
- * - Resets to `0` on terminal (`COMPLETE` / `ERROR` / `TEARDOWN`) — i.e. the
433
- * counter scopes to the active subscription cycle.
464
+ * - **Lifecycle scoping (qa A1 + EC7):** the counter retains its final
465
+ * value through terminal (`COMPLETE` / `ERROR` / `TEARDOWN`) so consumers
466
+ * see the final drop count, not zero. The closure-held counter resets to
467
+ * `0` only when the producer fn re-runs — which only happens on a new
468
+ * subscription cycle, and only if the producer was constructed with
469
+ * `resubscribable: true`. The default `rateLimiter` producer is NOT
470
+ * resubscribable, so a single producer-fn run is the typical lifetime.
434
471
  * - Producer-pattern note: this companion is invisible to `describe()`
435
472
  * traversal from `node` (effect-mirror limitation; same shape as
436
473
  * `withBreaker.breakerState` and `withStatus.status`). Surface it via
437
474
  * `node.meta.droppedCount` if you need it in topology snapshots.
438
475
  */
439
476
  droppedCount: Node<number>;
477
+ /**
478
+ * Reactive companion: combined `{droppedCount, pendingCount, paused}` view.
479
+ *
480
+ * - `pendingCount` reflects the live buffer occupancy and updates on every
481
+ * push / shift / overflow drop; `paused` is shorthand for
482
+ * `pendingCount > 0`.
483
+ * - Equality-deduped — re-emits only when one of the three fields actually
484
+ * changes (so a busy steady-state where every DATA passes immediately
485
+ * produces one `paused: false` emission, not one per DATA).
486
+ * - **Lifecycle scoping (qa EC7):** same contract as `droppedCount` —
487
+ * retains its final value through terminal; resets to the initial
488
+ * `{droppedCount: 0, pendingCount: 0, paused: false}` only on a new
489
+ * producer-fn run (resubscribable upstream required).
490
+ * - Same producer-pattern caveat as `droppedCount` re: `describe()` visibility.
491
+ */
492
+ rateLimitState: Node<RateLimiterState>;
440
493
  };
441
494
  /**
442
495
  * Token-bucket rate limiter: at most `maxEvents` `DATA` values per `windowNs`.
@@ -519,6 +572,7 @@ type WithStatusBundle<T> = {
519
572
  */
520
573
  declare function withStatus<T>(src: Node<T>, options?: {
521
574
  initialStatus?: StatusValue;
575
+ meta?: Record<string, unknown>;
522
576
  }): WithStatusBundle<T>;
523
577
  /**
524
578
  * Thrown by {@link timeout} when no `DATA` arrives within the deadline.
@@ -562,7 +616,9 @@ type FallbackInput<T> = T | Node<T> | PromiseLike<T> | AsyncIterable<T>;
562
616
  *
563
617
  * @category extra
564
618
  */
565
- declare function fallback<T>(source: Node<T>, fb: FallbackInput<T>): Node<T>;
619
+ declare function fallback<T>(source: Node<T>, fb: FallbackInput<T>, options?: {
620
+ meta?: Record<string, unknown>;
621
+ }): Node<T>;
566
622
  /**
567
623
  * Emits `ERROR` with {@link TimeoutError} if no `DATA` arrives within the deadline.
568
624
  *
@@ -588,6 +644,8 @@ declare function fallback<T>(source: Node<T>, fb: FallbackInput<T>): Node<T>;
588
644
  *
589
645
  * @category extra
590
646
  */
591
- declare function timeout<T>(source: Node<T>, timeoutNs: number): Node<T>;
647
+ declare function timeout<T>(source: Node<T>, timeoutNs: number, options?: {
648
+ meta?: Record<string, unknown>;
649
+ }): Node<T>;
592
650
 
593
- export { type BackoffPreset as B, type CircuitState as C, type ExponentialBackoffOptions as E, type FallbackInput as F, type JitterMode as J, NS_PER_MS as N, type RateLimiterOptions as R, type StatusValue as S, TimeoutError as T, type WithBreakerBundle as W, type CircuitBreakerOptions as a, type RetryOptions as b, NS_PER_SEC as c, type BackoffStrategy as d, type CircuitBreaker as e, CircuitOpenError as f, RateLimiterOverflowError as g, type RateLimiterOverflowPolicy as h, type TokenBucket as i, type WithStatusBundle as j, circuitBreaker as k, constant as l, decorrelatedJitter as m, exponential as n, fallback as o, fibonacci as p, linear as q, rateLimiter as r, resolveBackoffPreset as s, retry as t, timeout as u, tokenBucket as v, withBreaker as w, withMaxAttempts as x, withStatus as y };
651
+ export { type BackoffPreset as B, type CircuitState as C, type ExponentialBackoffOptions as E, type FallbackInput as F, type JitterMode as J, NS_PER_MS as N, type RateLimiterState as R, type StatusValue as S, TimeoutError as T, type WithBreakerBundle as W, type RateLimiterOptions as a, type CircuitBreakerOptions as b, type RetryOptions as c, NS_PER_SEC as d, type BackoffStrategy as e, type CircuitBreaker as f, CircuitOpenError as g, RateLimiterOverflowError as h, type RateLimiterOverflowPolicy as i, type TokenBucket as j, type WithStatusBundle as k, circuitBreaker as l, constant as m, decorrelatedJitter as n, exponential as o, fallback as p, fibonacci as q, linear as r, rateLimiter as s, resolveBackoffPreset as t, retry as u, timeout as v, tokenBucket as w, withBreaker as x, withMaxAttempts as y, withStatus as z };
@@ -1,5 +1,5 @@
1
- import { G as Graph } from './graph-30XSgtVX.js';
2
- import { M as MeasurementAdapter } from './reactive-layout-DkTXxtSy.js';
1
+ import { G as Graph } from './graph-BkIkog4h.js';
2
+ import { M as MeasurementAdapter } from './reactive-layout-KJj4E2dT.js';
3
3
 
4
4
  /**
5
5
  * Three-pane demo shell (roadmap §7.2).
@@ -1,8 +1,8 @@
1
1
  import { N as Node } from './node-BYInONRr.cjs';
2
- import { B as BaseAuditRecord } from './index-DINuaZlJ.cjs';
2
+ import { B as BaseAuditRecord } from './index-DVDapw2k.cjs';
3
3
  import { a as ReactiveLogBundle } from './reactive-log-_zeEnB9H.cjs';
4
4
  import { AppendLogStorageTier } from './extra/storage-tiers.cjs';
5
- import { a as GraphOptions, G as Graph } from './graph-BUwMAxJI.cjs';
5
+ import { a as GraphOptions, G as Graph } from './graph-E6likq7w.cjs';
6
6
 
7
7
  /**
8
8
  * CQRS patterns (roadmap §4.5).