@graphrefly/graphrefly 0.39.0 → 0.40.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 (215) 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-7JRF5YEK.js → chunk-2BX4NB34.js} +1 -1
  4. package/dist/{chunk-TFPZLQ5H.js → chunk-2DMKW2AD.js} +1 -1
  5. package/dist/{chunk-7NZMZJMW.js → chunk-2QXRYP7Q.js} +1 -1
  6. package/dist/{chunk-NQI2C36M.js → chunk-32N3JALT.js} +1 -1
  7. package/dist/{chunk-CGDMTXSY.js → chunk-6I726LZU.js} +1 -1
  8. package/dist/{chunk-S2U57TFC.js → chunk-6VWBPSSY.js} +1 -1
  9. package/dist/chunk-6XVD5TZV.js +1 -0
  10. package/dist/{chunk-VJJLIEAL.js → chunk-756D5TFD.js} +1 -1
  11. package/dist/{chunk-XQ55HO5N.js → chunk-7Q4ZD3YW.js} +1 -1
  12. package/dist/{chunk-ZOX3LBRV.js → chunk-B7LCDQEV.js} +1 -1
  13. package/dist/{chunk-IA7DUNGB.js → chunk-CKFQS2CJ.js} +1 -1
  14. package/dist/{chunk-R75BMDLA.js → chunk-ECQRP2UT.js} +1 -1
  15. package/dist/{chunk-L7WY6TZS.js → chunk-FHRBBHJN.js} +1 -1
  16. package/dist/{chunk-JNMC2WJ6.js → chunk-I2DEVPMU.js} +1 -1
  17. package/dist/chunk-INQFTVZA.js +61 -0
  18. package/dist/{chunk-N7UIBZCW.js → chunk-J63M5U46.js} +1 -1
  19. package/dist/{chunk-7SD73DS6.js → chunk-JKBOIJ22.js} +1 -1
  20. package/dist/chunk-K2Z7UENB.js +1 -0
  21. package/dist/{chunk-INH6FS2G.js → chunk-LCGAVGGV.js} +1 -1
  22. package/dist/{chunk-LQNOXGET.js → chunk-LYM4PBMV.js} +1 -1
  23. package/dist/{chunk-KD4NHLMU.js → chunk-MNZIKXK4.js} +1 -1
  24. package/dist/{chunk-RF3QZP6D.js → chunk-N43XM7BM.js} +1 -1
  25. package/dist/{chunk-5XRI6RM3.js → chunk-OSZ22J7O.js} +1 -1
  26. package/dist/{chunk-WHIZM6JV.js → chunk-PPUYQ66A.js} +1 -1
  27. package/dist/{chunk-SC7BQDNP.js → chunk-QSK3RRII.js} +1 -1
  28. package/dist/chunk-RZJDIV2G.js +1 -0
  29. package/dist/{chunk-HX3EGQ5Z.js → chunk-SSCGRYJ2.js} +1 -1
  30. package/dist/chunk-SVFKHUCW.js +1 -0
  31. package/dist/chunk-TSOYJ743.js +1 -0
  32. package/dist/{chunk-HAWKGIXM.js → chunk-UWA6D7UF.js} +1 -1
  33. package/dist/{chunk-GX5LSSRE.js → chunk-VMF23LGB.js} +1 -1
  34. package/dist/{chunk-5LK7XMEV.js → chunk-WL6LFPJB.js} +1 -1
  35. package/dist/{chunk-D47YVDR5.js → chunk-WUT362QV.js} +1 -1
  36. package/dist/{chunk-INHC33EH.js → chunk-XJLYLLIJ.js} +1 -1
  37. package/dist/{chunk-GEAO3TL3.js → chunk-XW4YDF6G.js} +1 -1
  38. package/dist/{chunk-XEUANKBO.js → chunk-YKD7WUYJ.js} +1 -1
  39. package/dist/{chunk-AU7YTQX7.js → chunk-YXDRGKXP.js} +1 -1
  40. package/dist/{chunk-7QFRK3N3.js → chunk-Z4F3DOWS.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-xZYcDqFH.d.cts → index-BTHOTC0Q.d.cts} +2 -2
  79. package/dist/{index-jr6PuSBt.d.ts → index-BaA-xpSw.d.ts} +2 -2
  80. package/dist/{index-FVoPvhAu.d.cts → index-Bd91Nmf4.d.cts} +2 -2
  81. package/dist/{index-PqbnoScQ.d.ts → index-BgjS2b8N.d.ts} +2 -2
  82. package/dist/{index-DCbE8fFM.d.cts → index-BiHUBEKq.d.cts} +2 -2
  83. package/dist/{index-DlgHqQxW.d.cts → index-BilOa6AE.d.cts} +6 -32
  84. package/dist/{index-DoYc8BWK.d.cts → index-BmSQLAZo.d.cts} +2 -2
  85. package/dist/{index-DlrWu9Hs.d.cts → index-C-dkXOpB.d.cts} +1 -1
  86. package/dist/{index-C7VV_qOs.d.ts → index-C5cQ7Gfx.d.ts} +2 -2
  87. package/dist/{index-CPhBvRJU.d.ts → index-C6ZUaos7.d.ts} +1 -1
  88. package/dist/{index-PlJ3MraE.d.ts → index-CAP3UGsq.d.ts} +1 -1
  89. package/dist/{index-B41Asm7D.d.ts → index-CD2dBMet.d.ts} +2 -2
  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-iTX5IqSP.d.ts → index-D1IEZUsj.d.ts} +5 -5
  102. package/dist/{index-CWHtYmSh.d.cts → index-D4uimgee.d.cts} +1 -1
  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-mNwgxC21.d.cts → index-DJ_MPOJ5.d.cts} +5 -5
  106. package/dist/{index-DyM4tFAe.d.cts → index-DQQCOIt8.d.cts} +2 -2
  107. package/dist/{index-BJ26eEjs.d.cts → index-DVAlsmEU.d.cts} +2 -2
  108. package/dist/{index-DINuaZlJ.d.cts → index-DVDapw2k.d.cts} +1 -1
  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-B9fmw5n2.d.ts → index-I1cCY3ZI.d.ts} +5 -3
  115. package/dist/{index-C19qqa38.d.ts → index-IUCY0OFN.d.ts} +2 -2
  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 +1 -1
  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.d.cts +3 -3
  159. package/dist/patterns/job-queue/index.d.ts +3 -3
  160. package/dist/patterns/job-queue/index.js +1 -1
  161. package/dist/patterns/lens/index.cjs +3 -3
  162. package/dist/patterns/lens/index.d.cts +3 -4
  163. package/dist/patterns/lens/index.d.ts +3 -4
  164. package/dist/patterns/lens/index.js +1 -1
  165. package/dist/patterns/memory/index.cjs +1 -1
  166. package/dist/patterns/memory/index.d.cts +3 -3
  167. package/dist/patterns/memory/index.d.ts +3 -3
  168. package/dist/patterns/memory/index.js +1 -1
  169. package/dist/patterns/messaging/index.d.cts +2 -2
  170. package/dist/patterns/messaging/index.d.ts +2 -2
  171. package/dist/patterns/messaging/index.js +1 -1
  172. package/dist/patterns/orchestration/index.d.cts +3 -3
  173. package/dist/patterns/orchestration/index.d.ts +3 -3
  174. package/dist/patterns/orchestration/index.js +1 -1
  175. package/dist/patterns/process/index.d.cts +4 -4
  176. package/dist/patterns/process/index.d.ts +4 -4
  177. package/dist/patterns/process/index.js +1 -1
  178. package/dist/patterns/reactive-layout/index.d.cts +3 -3
  179. package/dist/patterns/reactive-layout/index.d.ts +3 -3
  180. package/dist/patterns/reactive-layout/index.js +1 -1
  181. package/dist/patterns/reduction/index.d.cts +2 -2
  182. package/dist/patterns/reduction/index.d.ts +2 -2
  183. package/dist/patterns/reduction/index.js +1 -1
  184. package/dist/patterns/refine-loop/index.d.cts +3 -3
  185. package/dist/patterns/refine-loop/index.d.ts +3 -3
  186. package/dist/patterns/refine-loop/index.js +1 -1
  187. package/dist/patterns/resilient-pipeline/index.cjs +3 -1
  188. package/dist/patterns/resilient-pipeline/index.d.cts +7 -3
  189. package/dist/patterns/resilient-pipeline/index.d.ts +7 -3
  190. package/dist/patterns/resilient-pipeline/index.js +1 -1
  191. package/dist/patterns/surface/index.d.cts +3 -3
  192. package/dist/patterns/surface/index.d.ts +3 -3
  193. package/dist/patterns/surface/index.js +1 -1
  194. package/dist/{pipeline-graph-D8vKcO_p.d.ts → pipeline-graph-CB4La-UW.d.ts} +2 -2
  195. package/dist/{pipeline-graph-BQPr2Lqs.d.cts → pipeline-graph-MWrQZXCq.d.cts} +2 -2
  196. package/dist/{reactive-layout-8CSc0tiA.d.cts → reactive-layout-BtZfUKuL.d.cts} +1 -1
  197. package/dist/{reactive-layout-DkTXxtSy.d.ts → reactive-layout-KJj4E2dT.d.ts} +1 -1
  198. package/dist/{reactive-map-B2qfD3hb.d.cts → reactive-map-6P_k3AQM.d.cts} +1 -1
  199. package/dist/{reactive-map-jFIsE6Kt.d.ts → reactive-map-CjXByDV-.d.ts} +1 -1
  200. package/dist/{resilience-HTF2LBRS.js → resilience-S33JV6XC.js} +1 -1
  201. package/dist/{topology-tree-B5Ngw3j0.d.cts → topology-tree-3LBKFsUo.d.cts} +1 -1
  202. package/dist/{topology-tree-BtvbgMXJ.d.ts → topology-tree-mF7Emqzm.d.ts} +1 -1
  203. package/package.json +1 -1
  204. package/dist/chunk-73PBQNST.js +0 -1
  205. package/dist/chunk-A6ZSKGUG.js +0 -1
  206. package/dist/chunk-EWF7KCDJ.js +0 -61
  207. package/dist/chunk-IUB4NYI2.js +0 -1
  208. package/dist/chunk-MC4UYY2X.js +0 -1
  209. package/dist/chunk-ZJ7SM3G2.js +0 -1
  210. package/dist/index-BEHmxORq.d.ts +0 -135
  211. package/dist/index-BM9szD8n.d.cts +0 -113
  212. package/dist/index-BskfDoZ_.d.ts +0 -113
  213. package/dist/index-CIRG8Hxp.d.cts +0 -135
  214. package/dist/index-Cey6VTnX.d.ts +0 -166
  215. package/dist/index-CpLpJb6A.d.cts +0 -166
@@ -1,8 +1,8 @@
1
1
  import { N as Node } from './node-BYInONRr.js';
2
- import { B as BaseAuditRecord } from './index-CusEP3Sv.js';
2
+ import { B as BaseAuditRecord } from './index-BQ1fR4li.js';
3
3
  import { a as ReactiveLogBundle } from './reactive-log-BlAsPLl2.js';
4
4
  import { AppendLogStorageTier } from './extra/storage-tiers.js';
5
- import { a as GraphOptions, G as Graph } from './graph-30XSgtVX.js';
5
+ import { a as GraphOptions, G as Graph } from './graph-BkIkog4h.js';
6
6
 
7
7
  /**
8
8
  * CQRS patterns (roadmap §4.5).
@@ -0,0 +1,128 @@
1
+ import { N as Node } from './node-BYInONRr.cjs';
2
+ import { b as GraphDescribeOutput, G as Graph } from './graph-E6likq7w.cjs';
3
+ import { w as watchTopologyTree } from './topology-tree-3LBKFsUo.cjs';
4
+
5
+ /**
6
+ * Reactive graph observability preset (Tier 5.3 reshape — Session A.4 lock).
7
+ *
8
+ * `graphLens(target)` is a thin compositor (~30 LOC of glue) over two
9
+ * already-shipped reactive primitives:
10
+ *
11
+ * - `target.describe({ reactive: true })` — live topology snapshot.
12
+ * - `target.observe({ reactive: true, tiers: ["data"] })` — coalesced data
13
+ * changesets per outermost batch flush.
14
+ *
15
+ * It returns three Nodes plus a dispose function:
16
+ *
17
+ * - `topology: Node<GraphDescribeOutput>` — the live describe snapshot,
18
+ * re-emitting on every settle of the target tree (structural change,
19
+ * error/complete/teardown transition).
20
+ * - `health: Node<HealthReport>` — `{ok, problems[]}` aggregated from the
21
+ * live describe; `ok=false` when any node enters `"errored"` status,
22
+ * with `upstreamCause` walked backward through deps.
23
+ * - `flow: Node<ReadonlyMap<string, FlowEntry>>` — per-path DATA counters
24
+ * accumulating as `target.observe({reactive: true, tiers: ["data"]})`
25
+ * delivers changesets. The map is reconciled against `topology` on each
26
+ * topology change so removed nodes drop their entries.
27
+ *
28
+ * Pre-Tier-5.3 shipped a `LensGraph` class with `stats` / `health` / `flow`
29
+ * (as a `ReactiveMapBundle`) / `why(from, to)` / `flowEntryNode(...)`. The
30
+ * surface collapsed because every concern was already a one-liner over
31
+ * `describe({reactive:true})` + `observe({reactive:true, tiers})` once those
32
+ * landed in Tier 1.5.1 / 1.5.2 — the class added no protocol-level concept,
33
+ * just glue. Callers who need topology stats compose a derived over
34
+ * `topology` directly; callers who need a causal chain call
35
+ * `target.explain(from, to, { reactive: true })`.
36
+ *
37
+ * The transitive topology-subscription helper {@link watchTopologyTree} is
38
+ * re-exported here for downstream factories that need full-tree dynamic
39
+ * coverage without taking a dep on `graph/`.
40
+ *
41
+ * @module
42
+ */
43
+
44
+ /** A single health problem entry. */
45
+ interface HealthProblem {
46
+ path: string;
47
+ /** V1 only reports `"errored"`. Future versions may add `"completed"`, `"disconnected"`. */
48
+ status: "errored";
49
+ /** First errored upstream ancestor along the dep chain, when one exists and is distinct from `path`. */
50
+ upstreamCause?: string;
51
+ }
52
+ /** Aggregate health snapshot. `ok=true` iff `problems.length === 0`. */
53
+ interface HealthReport {
54
+ ok: boolean;
55
+ problems: readonly HealthProblem[];
56
+ }
57
+ /** Per-path flow entry stored in the {@link GraphLensView.flow} map. */
58
+ interface FlowEntry {
59
+ path: string;
60
+ /** Cumulative DATA emissions observed since the lens activated. */
61
+ count: number;
62
+ /** Monotonic ns at the most recent DATA emission for this path, or `null` if none yet. */
63
+ lastUpdate_ns: number | null;
64
+ }
65
+ /** Output of {@link graphLens}. */
66
+ interface GraphLensView {
67
+ /** Live describe snapshot. Re-emits on structural change AND status transitions. */
68
+ topology: Node<GraphDescribeOutput>;
69
+ /** Live `{ok, problems[]}`. Aggregated from `topology`; equality-deduped. */
70
+ health: Node<HealthReport>;
71
+ /** Per-path DATA counter map. Re-emits per outermost batch flush. */
72
+ flow: Node<ReadonlyMap<string, FlowEntry>>;
73
+ /**
74
+ * Tear down the underlying `describe({reactive:true})` subscription.
75
+ * The `flow` node activates lazily; subscribing-then-unsubscribing reclaims
76
+ * its observe stream automatically. Call `dispose()` once when finished.
77
+ */
78
+ dispose(): void;
79
+ }
80
+ /** Build a `HealthReport` from a fresh `GraphDescribeOutput`. */
81
+ declare function computeHealthReport(described: GraphDescribeOutput): HealthReport;
82
+ /** Structural equality for {@link HealthReport} — used as the `health` derived's `equals`. */
83
+ declare function healthReportEqual(a: HealthReport, b: HealthReport): boolean;
84
+ /**
85
+ * Reactive observability preset over a target {@link Graph}.
86
+ *
87
+ * @param target - The graph to observe.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const g = new Graph("app");
92
+ * g.add(state(0, { name: "counter" }), { name: "counter" });
93
+ *
94
+ * const lens = graphLens(g);
95
+ * lens.topology.subscribe((msgs) => console.log("topology:", msgs));
96
+ * lens.health.subscribe((msgs) => console.log("health:", msgs));
97
+ * lens.flow.subscribe((msgs) => {
98
+ * for (const [type, payload] of msgs) {
99
+ * if (type === DATA) console.log("flow map size:", (payload as ReadonlyMap<string, FlowEntry>).size);
100
+ * }
101
+ * });
102
+ *
103
+ * // Causal chains: use the underlying primitive directly — `graphLens` no
104
+ * // longer wraps it, since `graph.explain({ reactive: true })` already
105
+ * // provides everything the old `lens.why()` did.
106
+ * const why = g.explain("counter", "consumer", { reactive: true });
107
+ *
108
+ * // Tear down when done.
109
+ * lens.dispose();
110
+ * ```
111
+ *
112
+ * @category observability
113
+ */
114
+ declare function graphLens(target: Graph): GraphLensView;
115
+
116
+ type index_FlowEntry = FlowEntry;
117
+ type index_GraphLensView = GraphLensView;
118
+ type index_HealthProblem = HealthProblem;
119
+ type index_HealthReport = HealthReport;
120
+ declare const index_computeHealthReport: typeof computeHealthReport;
121
+ declare const index_graphLens: typeof graphLens;
122
+ declare const index_healthReportEqual: typeof healthReportEqual;
123
+ declare const index_watchTopologyTree: typeof watchTopologyTree;
124
+ declare namespace index {
125
+ export { type index_FlowEntry as FlowEntry, type index_GraphLensView as GraphLensView, type index_HealthProblem as HealthProblem, type index_HealthReport as HealthReport, index_computeHealthReport as computeHealthReport, index_graphLens as graphLens, index_healthReportEqual as healthReportEqual, index_watchTopologyTree as watchTopologyTree };
126
+ }
127
+
128
+ export { type FlowEntry as F, type GraphLensView as G, type HealthProblem as H, type HealthReport as a, computeHealthReport as c, graphLens as g, healthReportEqual as h, index as i };
@@ -1,12 +1,12 @@
1
1
  import { i as index$2 } from './index-CoM4rzyB.js';
2
2
  import { i as index$3 } from './index-yLt-aPMp.js';
3
- import { i as index$4 } from './index-C7VV_qOs.js';
3
+ import { i as index$4 } from './index-C5cQ7Gfx.js';
4
4
  import { i as index$5 } from './index-2n8Eai6M.js';
5
5
  import { N as Node } from './node-BYInONRr.js';
6
6
  import { i as index$6 } from './index-B2RUoIUz.js';
7
7
  import { i as index$7 } from './index-Ctb7_2sG.js';
8
8
  import { i as index$8 } from './index-BJSZxSFX.js';
9
- import { i as index$9 } from './index-CPhBvRJU.js';
9
+ import { i as index$9 } from './index-C6ZUaos7.js';
10
10
 
11
11
  /**
12
12
  * Options for creating signals.
@@ -1,12 +1,12 @@
1
1
  import { i as index$2 } from './index-DYTBbF8T.cjs';
2
2
  import { i as index$3 } from './index-CL7oilfm.cjs';
3
- import { i as index$4 } from './index-FVoPvhAu.cjs';
3
+ import { i as index$4 } from './index-Bd91Nmf4.cjs';
4
4
  import { i as index$5 } from './index-D3ayz3hy.cjs';
5
5
  import { N as Node } from './node-BYInONRr.cjs';
6
6
  import { i as index$6 } from './index-DOBLxOti.cjs';
7
7
  import { i as index$7 } from './index-PgwvGWa1.cjs';
8
8
  import { i as index$8 } from './index-z8WFPVI8.cjs';
9
- import { i as index$9 } from './index-DIHcMLr6.cjs';
9
+ import { i as index$9 } from './index-CgnCFhr2.cjs';
10
10
 
11
11
  /**
12
12
  * Options for creating signals.
@@ -0,0 +1,230 @@
1
+ import { f as factoryTag, p as placeholderArgs } from './meta-Ct9nqQS5.cjs';
2
+ import { N as Node } from './node-BYInONRr.cjs';
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-DGTo1yka.cjs';
4
+ import { G as Graph, a as GraphOptions } from './graph-E6likq7w.cjs';
5
+ import { B as BudgetConstraint } from './budget-gate-DiP_nK0n.cjs';
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,6 +1,6 @@
1
- import { j as CompileSpecOptions, G as GraphSpec, c as GraphSpecCatalog, C as CatalogFnEntry, a as CatalogSourceEntry, b as ConfigFieldSchema, F as FnFactory, d as GraphSpecFeedbackEdge, e as GraphSpecNode, f as GraphSpecTemplate, g as GraphSpecTemplateRef, h as GraphSpecValidation, S as SourceFactory } from './index-DlrWu9Hs.cjs';
2
- import { G as Graph, p as GraphNodeFactory, n as GraphDiffResult } from './graph-BUwMAxJI.cjs';
3
- import { KvStorageTier } from './extra/storage-tiers.cjs';
1
+ import { j as CompileSpecOptions, G as GraphSpec, c as GraphSpecCatalog, C as CatalogFnEntry, a as CatalogSourceEntry, b as ConfigFieldSchema, F as FnFactory, d as GraphSpecFeedbackEdge, e as GraphSpecNode, f as GraphSpecTemplate, g as GraphSpecTemplateRef, h as GraphSpecValidation, S as SourceFactory } from './index-DhLyOHYZ.js';
2
+ import { G as Graph, p as GraphNodeFactory, n as GraphDiffResult } from './graph-BkIkog4h.js';
3
+ import { KvStorageTier } from './extra/storage-tiers.js';
4
4
 
5
5
  /**
6
6
  * Surface: create a graph from a {@link GraphSpec} (§9.3-core).
@@ -1,4 +1,4 @@
1
- import { G as Graph } from './graph-BUwMAxJI.cjs';
1
+ import { G as Graph } from './graph-E6likq7w.cjs';
2
2
 
3
3
  /** Zustand-compatible Store API. */
4
4
  interface StoreApi<T> {
@@ -1,6 +1,6 @@
1
1
  import { A as Actor, N as Node, P as PolicyRuleData, G as GuardAction } from './node-BYInONRr.js';
2
- import { G as Graph, a as GraphOptions, c as GraphPersistSnapshot } from './graph-30XSgtVX.js';
3
- import { T as TopicGraph } from './index-DszPlZzK.js';
2
+ import { G as Graph, a as GraphOptions, c as GraphPersistSnapshot } from './graph-BkIkog4h.js';
3
+ import { T as TopicGraph } from './index-40ZT4MHj.js';
4
4
 
5
5
  /**
6
6
  * Audit, policy enforcement, and compliance export (roadmap §9.2).
@@ -1,5 +1,5 @@
1
1
  import { N as Node } from './node-BYInONRr.cjs';
2
- import { G as Graph, a as GraphOptions } from './graph-BUwMAxJI.cjs';
2
+ import { G as Graph, a as GraphOptions } from './graph-E6likq7w.cjs';
3
3
  import { a as ReactiveLogBundle } from './reactive-log-_zeEnB9H.cjs';
4
4
  import { AppendLogStorageTier } from './extra/storage-tiers.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
- import { G as Graph } from './graph-BUwMAxJI.cjs';
2
- import { M as MeasurementAdapter } from './reactive-layout-8CSc0tiA.cjs';
1
+ import { G as Graph } from './graph-E6likq7w.cjs';
2
+ import { M as MeasurementAdapter } from './reactive-layout-BtZfUKuL.cjs';
3
3
 
4
4
  /**
5
5
  * Three-pane demo shell (roadmap §7.2).
@@ -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 };