@graphrefly/graphrefly 0.25.0 → 0.27.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 (231) hide show
  1. package/README.md +8 -0
  2. package/dist/ai-CaR_912Q.d.cts +1033 -0
  3. package/dist/ai-WlRltJV7.d.ts +1033 -0
  4. package/dist/audit-ClmqGOCx.d.cts +245 -0
  5. package/dist/audit-DRlSzBu9.d.ts +245 -0
  6. package/dist/{chunk-QOWVNWOC.js → chunk-3ZWCKRHX.js} +27 -25
  7. package/dist/{chunk-QOWVNWOC.js.map → chunk-3ZWCKRHX.js.map} +1 -1
  8. package/dist/chunk-APFNLIRG.js +62 -0
  9. package/dist/chunk-APFNLIRG.js.map +1 -0
  10. package/dist/chunk-AT5LKYNL.js +395 -0
  11. package/dist/chunk-AT5LKYNL.js.map +1 -0
  12. package/dist/{chunk-IAHGTNOZ.js → chunk-BQ6RQQFF.js} +351 -2095
  13. package/dist/chunk-BQ6RQQFF.js.map +1 -0
  14. package/dist/{chunk-L2GLW2U7.js → chunk-BVZYTZ5H.js} +9 -103
  15. package/dist/chunk-BVZYTZ5H.js.map +1 -0
  16. package/dist/{chunk-EVR6UFUV.js → chunk-DST5DKZS.js} +19 -15
  17. package/dist/{chunk-EVR6UFUV.js.map → chunk-DST5DKZS.js.map} +1 -1
  18. package/dist/{chunk-TKE3JGOH.js → chunk-GTE6PWRZ.js} +5 -692
  19. package/dist/chunk-GTE6PWRZ.js.map +1 -0
  20. package/dist/chunk-HXZEYDUR.js +94 -0
  21. package/dist/chunk-HXZEYDUR.js.map +1 -0
  22. package/dist/chunk-J22W6HV3.js +107 -0
  23. package/dist/chunk-J22W6HV3.js.map +1 -0
  24. package/dist/{chunk-PY4XCDLR.js → chunk-J2VBW3DZ.js} +6 -95
  25. package/dist/chunk-J2VBW3DZ.js.map +1 -0
  26. package/dist/{chunk-HWPIFSW2.js → chunk-JSCT3CR4.js} +6 -4
  27. package/dist/{chunk-HWPIFSW2.js.map → chunk-JSCT3CR4.js.map} +1 -1
  28. package/dist/chunk-JWBCY4NC.js +330 -0
  29. package/dist/chunk-JWBCY4NC.js.map +1 -0
  30. package/dist/chunk-K2AUJHVP.js +2251 -0
  31. package/dist/chunk-K2AUJHVP.js.map +1 -0
  32. package/dist/chunk-MJ2NKQQL.js +119 -0
  33. package/dist/chunk-MJ2NKQQL.js.map +1 -0
  34. package/dist/chunk-N6UR7YVY.js +198 -0
  35. package/dist/chunk-N6UR7YVY.js.map +1 -0
  36. package/dist/chunk-NC6S43JJ.js +456 -0
  37. package/dist/chunk-NC6S43JJ.js.map +1 -0
  38. package/dist/chunk-OFVJBJXR.js +98 -0
  39. package/dist/chunk-OFVJBJXR.js.map +1 -0
  40. package/dist/chunk-OHISZPOJ.js +97 -0
  41. package/dist/chunk-OHISZPOJ.js.map +1 -0
  42. package/dist/chunk-OU5CQKNW.js +102 -0
  43. package/dist/chunk-OU5CQKNW.js.map +1 -0
  44. package/dist/{chunk-XOFWRC73.js → chunk-PF7GRZMW.js} +316 -21
  45. package/dist/chunk-PF7GRZMW.js.map +1 -0
  46. package/dist/{chunk-5DJTTKX3.js → chunk-PHOUUNK7.js} +74 -111
  47. package/dist/chunk-PHOUUNK7.js.map +1 -0
  48. package/dist/chunk-RNHBMHKA.js +1665 -0
  49. package/dist/chunk-RNHBMHKA.js.map +1 -0
  50. package/dist/chunk-SX52TAR4.js +110 -0
  51. package/dist/chunk-SX52TAR4.js.map +1 -0
  52. package/dist/{chunk-H4RVA4VE.js → chunk-VYPWMZ6H.js} +2 -2
  53. package/dist/chunk-WBZOVTYK.js +171 -0
  54. package/dist/chunk-WBZOVTYK.js.map +1 -0
  55. package/dist/chunk-WKNUIZOY.js +354 -0
  56. package/dist/chunk-WKNUIZOY.js.map +1 -0
  57. package/dist/chunk-X3VMZYBT.js +713 -0
  58. package/dist/chunk-X3VMZYBT.js.map +1 -0
  59. package/dist/chunk-X5R3GL6H.js +525 -0
  60. package/dist/chunk-X5R3GL6H.js.map +1 -0
  61. package/dist/chunk-XGPU467M.js +136 -0
  62. package/dist/chunk-XGPU467M.js.map +1 -0
  63. package/dist/compat/index.cjs +7656 -0
  64. package/dist/compat/index.cjs.map +1 -0
  65. package/dist/compat/index.d.cts +18 -0
  66. package/dist/compat/index.d.ts +18 -0
  67. package/dist/compat/index.js +50 -0
  68. package/dist/compat/index.js.map +1 -0
  69. package/dist/compat/jotai/index.cjs +2048 -0
  70. package/dist/compat/jotai/index.cjs.map +1 -0
  71. package/dist/compat/jotai/index.d.cts +2 -0
  72. package/dist/compat/jotai/index.d.ts +2 -0
  73. package/dist/compat/jotai/index.js +9 -0
  74. package/dist/compat/jotai/index.js.map +1 -0
  75. package/dist/compat/nanostores/index.cjs +2175 -0
  76. package/dist/compat/nanostores/index.cjs.map +1 -0
  77. package/dist/compat/nanostores/index.d.cts +2 -0
  78. package/dist/compat/nanostores/index.d.ts +2 -0
  79. package/dist/compat/nanostores/index.js +23 -0
  80. package/dist/compat/nanostores/index.js.map +1 -0
  81. package/dist/compat/nestjs/index.cjs +350 -16
  82. package/dist/compat/nestjs/index.cjs.map +1 -1
  83. package/dist/compat/nestjs/index.d.cts +6 -6
  84. package/dist/compat/nestjs/index.d.ts +6 -6
  85. package/dist/compat/nestjs/index.js +11 -9
  86. package/dist/compat/react/index.cjs +141 -0
  87. package/dist/compat/react/index.cjs.map +1 -0
  88. package/dist/compat/react/index.d.cts +2 -0
  89. package/dist/compat/react/index.d.ts +2 -0
  90. package/dist/compat/react/index.js +12 -0
  91. package/dist/compat/react/index.js.map +1 -0
  92. package/dist/compat/solid/index.cjs +128 -0
  93. package/dist/compat/solid/index.cjs.map +1 -0
  94. package/dist/compat/solid/index.d.cts +2 -0
  95. package/dist/compat/solid/index.d.ts +2 -0
  96. package/dist/compat/solid/index.js +12 -0
  97. package/dist/compat/solid/index.js.map +1 -0
  98. package/dist/compat/svelte/index.cjs +131 -0
  99. package/dist/compat/svelte/index.cjs.map +1 -0
  100. package/dist/compat/svelte/index.d.cts +2 -0
  101. package/dist/compat/svelte/index.d.ts +2 -0
  102. package/dist/compat/svelte/index.js +12 -0
  103. package/dist/compat/svelte/index.js.map +1 -0
  104. package/dist/compat/vue/index.cjs +146 -0
  105. package/dist/compat/vue/index.cjs.map +1 -0
  106. package/dist/compat/vue/index.d.cts +3 -0
  107. package/dist/compat/vue/index.d.ts +3 -0
  108. package/dist/compat/vue/index.js +12 -0
  109. package/dist/compat/vue/index.js.map +1 -0
  110. package/dist/compat/zustand/index.cjs +4931 -0
  111. package/dist/compat/zustand/index.cjs.map +1 -0
  112. package/dist/compat/zustand/index.d.cts +5 -0
  113. package/dist/compat/zustand/index.d.ts +5 -0
  114. package/dist/compat/zustand/index.js +12 -0
  115. package/dist/compat/zustand/index.js.map +1 -0
  116. package/dist/composite-C7PcQvcs.d.cts +303 -0
  117. package/dist/composite-aUCvjZVR.d.ts +303 -0
  118. package/dist/core/index.cjs +53 -4
  119. package/dist/core/index.cjs.map +1 -1
  120. package/dist/core/index.d.cts +4 -3
  121. package/dist/core/index.d.ts +4 -3
  122. package/dist/core/index.js +26 -24
  123. package/dist/demo-shell-BDkOptd6.d.ts +102 -0
  124. package/dist/demo-shell-Crid1WdR.d.cts +102 -0
  125. package/dist/extra/index.cjs +222 -110
  126. package/dist/extra/index.cjs.map +1 -1
  127. package/dist/extra/index.d.cts +6 -4
  128. package/dist/extra/index.d.ts +6 -4
  129. package/dist/extra/index.js +72 -65
  130. package/dist/extra/sources.cjs +2486 -0
  131. package/dist/extra/sources.cjs.map +1 -0
  132. package/dist/extra/sources.d.cts +465 -0
  133. package/dist/extra/sources.d.ts +465 -0
  134. package/dist/extra/sources.js +57 -0
  135. package/dist/extra/sources.js.map +1 -0
  136. package/dist/graph/index.cjs +408 -14
  137. package/dist/graph/index.cjs.map +1 -1
  138. package/dist/graph/index.d.cts +5 -5
  139. package/dist/graph/index.d.ts +5 -5
  140. package/dist/graph/index.js +13 -5
  141. package/dist/{graph-D-3JIQme.d.cts → graph-CCwGKLCm.d.ts} +195 -4
  142. package/dist/{graph-B6NFqv3z.d.ts → graph-DNCrvZSn.d.cts} +195 -4
  143. package/dist/index-3lsddbbS.d.ts +86 -0
  144. package/dist/index-B1tloyhO.d.cts +34 -0
  145. package/dist/{index-CYkjxu3s.d.ts → index-B6D3QNSA.d.ts} +33 -4
  146. package/dist/index-B6EhDnjH.d.cts +37 -0
  147. package/dist/index-B9B7_HEY.d.ts +37 -0
  148. package/dist/{index-Ds23Wvou.d.ts → index-BHlKbUwO.d.cts} +131 -883
  149. package/dist/{index-DiobMNwE.d.ts → index-BPVt8kqc.d.ts} +3 -3
  150. package/dist/index-BaSM3aYt.d.ts +195 -0
  151. package/dist/index-BuEoe-Qu.d.ts +121 -0
  152. package/dist/{index-Ch0IpIO0.d.cts → index-BwfLUNw4.d.ts} +131 -883
  153. package/dist/index-ByQxazQJ.d.cts +86 -0
  154. package/dist/index-C0svESO4.d.ts +127 -0
  155. package/dist/{index-OXImXMq6.d.ts → index-C8oil6M6.d.ts} +18 -196
  156. package/dist/{index-DKE1EATr.d.cts → index-CI3DprxP.d.cts} +18 -196
  157. package/dist/{index-AMWewNDe.d.cts → index-CO8uBlUh.d.cts} +33 -4
  158. package/dist/index-CxFrXH4m.d.ts +45 -0
  159. package/dist/index-D8wS_PeY.d.cts +121 -0
  160. package/dist/index-DO_6JN9Z.d.cts +127 -0
  161. package/dist/index-DVGiGFGT.d.cts +195 -0
  162. package/dist/index-DYme44FM.d.cts +44 -0
  163. package/dist/{index-J7Kc0oIQ.d.cts → index-DlLp-2Xn.d.cts} +3 -3
  164. package/dist/index-Dzk2hrlR.d.ts +44 -0
  165. package/dist/index-VHqptjhu.d.cts +45 -0
  166. package/dist/index-VdHQMPy1.d.ts +36 -0
  167. package/dist/index-Xi3u0HCQ.d.cts +36 -0
  168. package/dist/index-wEn0eFe8.d.ts +34 -0
  169. package/dist/index.cjs +1780 -176
  170. package/dist/index.cjs.map +1 -1
  171. package/dist/index.d.cts +784 -2082
  172. package/dist/index.d.ts +784 -2082
  173. package/dist/index.js +955 -4349
  174. package/dist/index.js.map +1 -1
  175. package/dist/memory-C6Z2tGpC.d.cts +139 -0
  176. package/dist/memory-li6FL5RM.d.ts +139 -0
  177. package/dist/messaging-Gt4LPbyA.d.cts +269 -0
  178. package/dist/messaging-XDoYablx.d.ts +269 -0
  179. package/dist/{meta-DWbkoq1s.d.cts → meta-BxCA7rcr.d.cts} +1 -1
  180. package/dist/{meta-CnkLA_43.d.ts → meta-CbznRPYJ.d.ts} +1 -1
  181. package/dist/{node-B-f-Lu-k.d.cts → node-BmerH3kS.d.cts} +26 -1
  182. package/dist/{node-B-f-Lu-k.d.ts → node-BmerH3kS.d.ts} +26 -1
  183. package/dist/{observable-uP-wy_uK.d.ts → observable-BgGUwcqp.d.ts} +1 -1
  184. package/dist/{observable-DBnrwcar.d.cts → observable-DJt_AxzQ.d.cts} +1 -1
  185. package/dist/patterns/ai.cjs +7930 -0
  186. package/dist/patterns/ai.cjs.map +1 -0
  187. package/dist/patterns/ai.d.cts +10 -0
  188. package/dist/patterns/ai.d.ts +10 -0
  189. package/dist/patterns/ai.js +71 -0
  190. package/dist/patterns/ai.js.map +1 -0
  191. package/dist/patterns/audit.cjs +5805 -0
  192. package/dist/patterns/audit.cjs.map +1 -0
  193. package/dist/patterns/audit.d.cts +6 -0
  194. package/dist/patterns/audit.d.ts +6 -0
  195. package/dist/patterns/audit.js +29 -0
  196. package/dist/patterns/audit.js.map +1 -0
  197. package/dist/patterns/demo-shell.cjs +5604 -0
  198. package/dist/patterns/demo-shell.cjs.map +1 -0
  199. package/dist/patterns/demo-shell.d.cts +6 -0
  200. package/dist/patterns/demo-shell.d.ts +6 -0
  201. package/dist/patterns/demo-shell.js +15 -0
  202. package/dist/patterns/demo-shell.js.map +1 -0
  203. package/dist/patterns/memory.cjs +5283 -0
  204. package/dist/patterns/memory.cjs.map +1 -0
  205. package/dist/patterns/memory.d.cts +5 -0
  206. package/dist/patterns/memory.d.ts +5 -0
  207. package/dist/patterns/memory.js +20 -0
  208. package/dist/patterns/memory.js.map +1 -0
  209. package/dist/patterns/reactive-layout/index.cjs +355 -13
  210. package/dist/patterns/reactive-layout/index.cjs.map +1 -1
  211. package/dist/patterns/reactive-layout/index.d.cts +6 -5
  212. package/dist/patterns/reactive-layout/index.d.ts +6 -5
  213. package/dist/patterns/reactive-layout/index.js +15 -12
  214. package/dist/reactive-layout-MQP--J3F.d.cts +183 -0
  215. package/dist/reactive-layout-u5Ulnqag.d.ts +183 -0
  216. package/dist/{storage-BuTdpCI1.d.cts → storage-CMjUUuxn.d.ts} +10 -2
  217. package/dist/{storage-F2X1U1x0.d.ts → storage-DdWlZo6U.d.cts} +10 -2
  218. package/dist/sugar-CCOxXK1e.d.ts +201 -0
  219. package/dist/sugar-D02n5JjF.d.cts +201 -0
  220. package/package.json +63 -3
  221. package/dist/chunk-5DJTTKX3.js.map +0 -1
  222. package/dist/chunk-IAHGTNOZ.js.map +0 -1
  223. package/dist/chunk-L2GLW2U7.js.map +0 -1
  224. package/dist/chunk-MW4VAKAO.js +0 -47
  225. package/dist/chunk-MW4VAKAO.js.map +0 -1
  226. package/dist/chunk-PY4XCDLR.js.map +0 -1
  227. package/dist/chunk-TKE3JGOH.js.map +0 -1
  228. package/dist/chunk-XOFWRC73.js.map +0 -1
  229. package/dist/index-BJB7t9gg.d.cts +0 -392
  230. package/dist/index-C-TXEa7C.d.ts +0 -392
  231. /package/dist/{chunk-H4RVA4VE.js.map → chunk-VYPWMZ6H.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,2026 +1,41 @@
1
- import { N as Node, a as NodeOptions, b as NodeActions, A as Actor } from './node-B-f-Lu-k.cjs';
2
- export { C as COMPLETE, c as COMPLETE_MSG, d as COMPLETE_ONLY_BATCH, D as DATA, e as DEFAULT_ACTOR, f as DIRTY, g as DIRTY_MSG, h as DIRTY_ONLY_BATCH, i as DepRecord, E as ERROR, F as FnCtx, G as GlobalInspectorEvent, j as GlobalInspectorHook, k as GraphReFlyConfig, l as GuardAction, m as GuardDenied, n as GuardDeniedDetails, H as HashFn, I as INVALIDATE, o as INVALIDATE_MSG, p as INVALIDATE_ONLY_BATCH, M as Message, q as MessageContext, r as MessageTypeRegistration, s as MessageTypeRegistrationInput, t as Messages, u as NodeCtx, v as NodeDescribeKind, w as NodeFn, x as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, P as NodeVersionInfo, Q as OnMessageHandler, R as OnSubscribeHandler, S as PAUSE, T as PolicyAllow, U as PolicyDeny, V as PolicyRuleData, W as RESOLVED, X as RESOLVED_MSG, Y as RESOLVED_ONLY_BATCH, Z as RESUME, _ as START, $ as START_MSG, a0 as SubscribeContext, a1 as TEARDOWN, a2 as TEARDOWN_MSG, a3 as TEARDOWN_ONLY_BATCH, a4 as V0, a5 as V1, a6 as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from './node-B-f-Lu-k.cjs';
3
- import { i as index$b, c as cqrs } from './index-J7Kc0oIQ.cjs';
4
- import { Ref, WatchSource } from 'vue';
5
- import { G as Graph, a as GraphOptions, b as GraphAttachStorageOptions, c as GraphProfileResult, d as GraphProfileOptions } from './graph-D-3JIQme.cjs';
6
- export { D as DescribeFilter, e as GRAPH_META_SEGMENT, f as GraphActorOptions, g as GraphCheckpointRecord, h as GraphDescribeOptions, i as GraphDescribeOutput, j as GraphDiagramDirection, k as GraphDiagramOptions, l as GraphDiffChange, m as GraphDiffResult, n as GraphFactoryContext, o as GraphNodeFactory, p as GraphObserveAll, q as GraphObserveOne, r as GraphPersistSnapshot, s as GraphVersionChange, t as GraphWALDiff, N as NodeProfile, O as ObserveDetail, u as ObserveEvent, v as ObserveOptions, w as ObserveResult, x as ObserveTheme, y as ObserveThemeName, R as ReachableDirection, z as ReachableOptions, T as TraceEntry, A as diffForWAL, B as graphProfile, C as reachable } from './graph-D-3JIQme.cjs';
7
- import { D as DerivedFn } from './index-BJB7t9gg.cjs';
8
- export { A as AutoTrackOptions, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as batch, i as core, e as derived, f as downWithBatch, g as dynamicNode, h as effect, j as isBatching, m as monotonicNs, p as pipe, k as producer, s as state, w as wallClockNs } from './index-BJB7t9gg.cjs';
9
- import { N as NodeInput, D as DistillBundle, E as Extraction } from './index-Ch0IpIO0.cjs';
10
- export { A as AckableMessage, a as AdapterHandlers, b as AsyncSourceOpts, B as BackoffPreset, c as BackoffStrategy, d as BatchMessage, e as BridgeMessage, f as BufferedSinkHandle, g as BundleTriad, C as CSVRow, h as CacheEvictionPolicy, i as CascadingCache, j as CascadingCacheOptions, k as CheckpointToRedisOptions, l as CheckpointToS3Options, m as CircuitBreaker, n as CircuitBreakerOptions, o as CircuitOpenError, p as CircuitState, q as ClickHouseClientLike, r as ClickHouseInsertClientLike, s as ClickHouseRow, t as CronSchedule, u as DistillOptions, v as DrizzleQueryLike, w as EmitTriad, x as ErrorMessage, y as EventTargetLike, z as ExponentialBackoffOptions, F as ExternalBundleOptions, G as ExternalRegister, H as FSEvent, I as FSEventType, J as FallbackInput, K as FileWriterLike, L as FromCSVOptions, M as FromClickHouseWatchOptions, O as FromCronOptions, P as FromDrizzleOptions, Q as FromFSWatchOptions, R as FromGitHookOptions, S as FromHTTPOptions, T as FromHTTPPollOptions, U as FromHTTPStreamOptions, V as FromKafkaOptions, W as FromKyselyOptions, X as FromMCPOptions, Y as FromNATSOptions, Z as FromNDJSONOptions, _ as FromOTelOptions, $ as FromPrismaOptions, a0 as FromPrometheusOptions, a1 as FromPulsarOptions, a2 as FromRabbitMQOptions, a3 as FromRedisStreamOptions, a4 as FromSSEOptions, a5 as FromSqliteOptions, a6 as FromStatsDOptions, a7 as FromSyslogOptions, a8 as FromWebSocketReconnectOptions, a9 as GitEvent, aa as GitHookType, ab as HTTPBundle, ac as IndexBackend, ad as IndexRow, ae as InitMessage, af as JitterMode, ag as KafkaConsumerLike, ah as KafkaMessage, ai as KafkaProducerLike, aj as KyselyQueryLike, ak as ListBackend, al as LogBackend, am as LokiClientLike, an as LokiStream, ao as MCPClientLike, ap as MapBackend, aq as MergeMapOptions, ar as MongoCollectionLike, as as NATSClientLike, at as NATSMessage, au as NATSSubscriptionLike, av as NS_PER_MS, aw as NS_PER_SEC, ax as NativeIndexBackend, ay as NativeListBackend, az as NativeLogBackend, aA as NativeMapBackend, aB as NativeMapBackendOptions, aC as NativePubSubBackend, aD as OTelBundle, aE as OTelLog, aF as OTelMetric, aG as OTelRegister, aH as OTelSpan, aI as PostgresClientLike, aJ as PrismaModelLike, aK as PrometheusMetric, aL as PubSubBackend, aM as PubSubHub, aN as PubSubHubOptions, aO as PulsarConsumerLike, aP as PulsarMessage, aQ as PulsarProducerLike, aR as RabbitMQChannelLike, aS as RabbitMQMessage, aT as RateLimiterOptions, aU as RateLimiterOverflowError, aV as RateLimiterOverflowPolicy, aW as ReactiveCounterBundle, aX as ReactiveIndexBundle, aY as ReactiveIndexOptions, aZ as ReactiveListBundle, a_ as ReactiveListOptions, a$ as ReactiveLogBundle, b0 as ReactiveLogOptions, b1 as ReactiveMapBundle, b2 as ReactiveMapOptions, b3 as ReactiveSinkBackpressureOptions, b4 as ReactiveSinkConfig, b5 as ReactiveSinkHandle, b6 as ReactiveSinkOptions, b7 as ReactiveSinkRetryOptions, b8 as ReadyMessage, b9 as RedisCheckpointClientLike, ba as RedisClientLike, bb as RedisStreamEntry, bc as ResettableTimer, bd as RetryOptions, be as RetrySourceOptions, bf as S3ClientLike, bg as SSEEvent, bh as SignalMessage, bi as SinkFailure, bj as SinkHandle, bk as SinkTransportError, bl as SqliteDbLike, bm as SqliteIterableDbLike, bn as StatsDMetric, bo as StatsDRegister, bp as StatusValue, bq as SyslogMessage, br as SyslogRegister, bs as TapObserver, bt as TempoClientLike, bu as ThrottleOptions, bv as TimeoutError, bw as ToCSVOptions, bx as ToClickHouseOptions, by as ToFileOptions, bz as ToHTTPOptions, bA as ToKafkaOptions, bB as ToLokiOptions, bC as ToMongoOptions, bD as ToNATSOptions, bE as ToPostgresOptions, bF as ToPulsarOptions, bG as ToRabbitMQOptions, bH as ToRedisStreamOptions, bI as ToS3Options, bJ as ToSSEOptions, bK as ToSqliteOptions, bL as ToTempoOptions, bM as ToWebSocketOptions, bN as TokenBucket, bO as UpsertOptions, bP as ValueMessage, bQ as VerifiableBundle, bR as VerifiableOptions, bS as VerifyValue, bT as WatermarkController, bU as WatermarkOptions, bV as WebSocketLike, bW as WebSocketMessageEventLike, bX as WebSocketRegister, bY as WebhookRegister, bZ as WithBreakerBundle, b_ as WithStatusBundle, b$ as WorkerBridge, c0 as WorkerBridgeOptions, c1 as WorkerSelfHandle, c2 as WorkerSelfOptions, c3 as WorkerTransport, c4 as audit, c5 as buffer, c6 as bufferCount, c7 as bufferTime, c8 as cached, c9 as cascadingCache, ca as catchError, cb as checkpointToRedis, cc as checkpointToS3, cd as circuitBreaker, ce as combine, cf as combineLatest, cg as concat, ch as concatMap, ci as constant, cj as createTransport, ck as createWatermarkController, cl as csvRows, cm as debounce, cn as debounceTime, co as decorrelatedJitter, cp as delay, cq as deserializeError, cr as distill, cs as distinctUntilChanged, ct as elementAt, cu as empty, cv as escapeRegexChar, cw as exhaustMap, cx as exponential, cy as externalBundle, cz as externalProducer, cA as extra, cB as fallback, cC as fibonacci, cD as filter, cE as find, cF as first, cG as firstValueFrom, cH as firstWhere, cI as flatMap, cJ as forEach, cK as fromAny, cL as fromAsyncIter, cM as fromCSV, cN as fromClickHouseWatch, cO as fromCron, cP as fromDrizzle, cQ as fromEvent, cR as fromFSWatch, cS as fromGitHook, cT as fromHTTP, cU as fromHTTPPoll, cV as fromHTTPStream, cW as fromIter, cX as fromKafka, cY as fromKysely, cZ as fromMCP, c_ as fromNATS, c$ as fromNDJSON, d0 as fromOTel, d1 as fromPrisma, d2 as fromPrometheus, d3 as fromPromise, d4 as fromPulsar, d5 as fromRabbitMQ, d6 as fromRaf, d7 as fromRedisStream, d8 as fromSSE, d9 as fromSqlite, da as fromSqliteCursor, db as fromStatsD, dc as fromSyslog, dd as fromTimer, de as fromWebSocket, df as fromWebSocketReconnect, dg as fromWebhook, dh as globToRegExp, di as interval, dj as keepalive, dk as last, dl as linear, dm as lru, dn as map, dp as matchesAnyPattern, dq as matchesCron, dr as merge, ds as mergeMap, dt as nameToSignal, du as ndjsonRows, dv as never, dw as of, dx as pairwise, dy as parseCron, dz as parsePrometheusText, dA as parseStatsD, dB as parseSyslog, dC as pausable, dD as pubsub, dE as race, dF as rateLimiter, dG as reactiveCounter, dH as reactiveIndex, dI as reactiveList, dJ as reactiveLog, dK as reactiveMap, dL as reactiveSink, dM as reduce, dN as repeat, dO as replay, dP as rescue, dQ as resolveBackoffPreset, dR as retry, dS as retrySource, dT as sample, dU as scan, dV as serializeError, dW as share, dX as shareReplay, dY as signalToName, dZ as skip, d_ as switchMap, d$ as take, e0 as takeUntil, e1 as takeWhile, e2 as tap, e3 as throttle, e4 as throttleTime, e5 as throwError, e6 as timeout, e7 as toArray, e8 as toCSV, e9 as toClickHouse, ea as toFile, eb as toHTTP, ec as toKafka, ed as toLoki, ee as toMongo, ef as toNATS, eg as toPostgres, eh as toPulsar, ei as toRabbitMQ, ej as toReadableStream, ek as toRedisStream, el as toS3, em as toSSE, en as toSSEBytes, eo as toSqlite, ep as toTempo, eq as toWebSocket, er as tokenBucket, es as valve, et as verifiable, eu as window, ev as windowCount, ew as windowTime, ex as withBreaker, ey as withLatestFrom, ez as withMaxAttempts, eA as withStatus, eB as workerBridge, eC as workerSelf, eD as zip } from './index-Ch0IpIO0.cjs';
11
- export { E as ENVELOPE_VERSION, a as EvictedSubgraphInfo, b as EvictionPolicy, G as GraphCodec, J as JsonCodec, L as LazyGraphCodec, O as SIZEOF_OVERHEAD, S as SIZEOF_SYMBOL, W as WALEntry, c as createDagCborCodec, d as createDagCborZstdCodec, e as decodeEnvelope, f as encodeEnvelope, i as graph, r as registerBuiltinCodecs, g as replayWAL, s as sizeof } from './index-AMWewNDe.cjs';
12
- import { S as StorageHandle, a as StorageTier } from './storage-BuTdpCI1.cjs';
13
- export { I as IndexedDbStorageSpec, d as dictStorage, f as fileStorage, b as fromIDBRequest, c as fromIDBTransaction, i as indexedDbStorage, m as memoryStorage, s as sqliteStorage } from './storage-BuTdpCI1.cjs';
14
- import { M as MeasurementAdapter, i as index$c } from './index-DKE1EATr.cjs';
15
- export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from './meta-DWbkoq1s.cjs';
16
- export { T as ToObservableOptions, t as toObservable } from './observable-DBnrwcar.cjs';
1
+ export { i as compat, a as signals } from './index-D8wS_PeY.cjs';
2
+ export { b as batch, i as core, d as downWithBatch, a as isBatching, m as monotonicNs, w as wallClockNs } from './index-DVGiGFGT.cjs';
3
+ import { S as StatusValue, C as CircuitState, R as RateLimiterOptions, a as CircuitBreakerOptions, b as RetryOptions, F as FallbackInput, N as NS_PER_MS, c as NS_PER_SEC } from './index-BHlKbUwO.cjs';
4
+ export { A as AckableMessage, d as AdapterHandlers, B as BackoffPreset, e as BackoffStrategy, f as BatchMessage, g as BridgeMessage, h as BufferedSinkHandle, i as BundleTriad, j as CSVRow, k as CacheEvictionPolicy, l as CascadingCache, m as CascadingCacheOptions, n as CheckpointToRedisOptions, o as CheckpointToS3Options, p as CircuitBreaker, q as CircuitOpenError, r as ClickHouseClientLike, s as ClickHouseInsertClientLike, t as ClickHouseRow, u as CronSchedule, D as DrizzleQueryLike, E as EmitTriad, v as ErrorMessage, w as ExponentialBackoffOptions, x as ExternalBundleOptions, y as ExternalRegister, z as FSEvent, G as FSEventType, H as FileWriterLike, I as FromCSVOptions, J as FromClickHouseWatchOptions, K as FromDrizzleOptions, L as FromFSWatchOptions, M as FromGitHookOptions, O as FromHTTPOptions, P as FromHTTPPollOptions, Q as FromHTTPStreamOptions, T as FromKafkaOptions, U as FromKyselyOptions, V as FromMCPOptions, W as FromNATSOptions, X as FromNDJSONOptions, Y as FromOTelOptions, Z as FromPrismaOptions, _ as FromPrometheusOptions, $ as FromPulsarOptions, a0 as FromRabbitMQOptions, a1 as FromRedisStreamOptions, a2 as FromSSEOptions, a3 as FromSqliteOptions, a4 as FromStatsDOptions, a5 as FromSyslogOptions, a6 as FromWebSocketReconnectOptions, a7 as GitEvent, a8 as GitHookType, a9 as HTTPBundle, aa as IndexBackend, ab as IndexRow, ac as InitMessage, ad as JitterMode, ae as KafkaConsumerLike, af as KafkaMessage, ag as KafkaProducerLike, ah as KyselyQueryLike, ai as ListBackend, aj as LogBackend, ak as LokiClientLike, al as LokiStream, am as MCPClientLike, an as MergeMapOptions, ao as MongoCollectionLike, ap as NATSClientLike, aq as NATSMessage, ar as NATSSubscriptionLike, as as NativeIndexBackend, at as NativeListBackend, au as NativeLogBackend, av as NativePubSubBackend, aw as OTelBundle, ax as OTelLog, ay as OTelMetric, az as OTelRegister, aA as OTelSpan, aB as PostgresClientLike, aC as PrismaModelLike, aD as PrometheusMetric, aE as PubSubBackend, aF as PubSubHub, aG as PubSubHubOptions, aH as PulsarConsumerLike, aI as PulsarMessage, aJ as PulsarProducerLike, aK as RabbitMQChannelLike, aL as RabbitMQMessage, aM as RateLimiterOverflowError, aN as RateLimiterOverflowPolicy, aO as ReactiveIndexBundle, aP as ReactiveIndexOptions, aQ as ReactiveListBundle, aR as ReactiveListOptions, aS as ReactiveLogBundle, aT as ReactiveLogOptions, aU as ReactiveSinkBackpressureOptions, aV as ReactiveSinkConfig, aW as ReactiveSinkHandle, aX as ReactiveSinkOptions, aY as ReactiveSinkRetryOptions, aZ as ReadyMessage, a_ as RedisCheckpointClientLike, a$ as RedisClientLike, b0 as RedisStreamEntry, b1 as ResettableTimer, b2 as RetrySourceOptions, b3 as S3ClientLike, b4 as SSEEvent, b5 as SignalMessage, b6 as SinkFailure, b7 as SinkHandle, b8 as SinkTransportError, b9 as SqliteDbLike, ba as SqliteIterableDbLike, bb as StatsDMetric, bc as StatsDRegister, bd as SyslogMessage, be as SyslogRegister, bf as TapObserver, bg as TempoClientLike, bh as ThrottleOptions, bi as TimeoutError, bj as ToCSVOptions, bk as ToClickHouseOptions, bl as ToFileOptions, bm as ToHTTPOptions, bn as ToKafkaOptions, bo as ToLokiOptions, bp as ToMongoOptions, bq as ToNATSOptions, br as ToPostgresOptions, bs as ToPulsarOptions, bt as ToRabbitMQOptions, bu as ToRedisStreamOptions, bv as ToS3Options, bw as ToSSEOptions, bx as ToSqliteOptions, by as ToTempoOptions, bz as ToWebSocketOptions, bA as TokenBucket, bB as UpsertOptions, bC as ValueMessage, bD as WatermarkController, bE as WatermarkOptions, bF as WebSocketLike, bG as WebSocketMessageEventLike, bH as WebSocketRegister, bI as WebhookRegister, bJ as WithBreakerBundle, bK as WithStatusBundle, bL as WorkerBridge, bM as WorkerBridgeOptions, bN as WorkerSelfHandle, bO as WorkerSelfOptions, bP as WorkerTransport, bQ as audit, bR as buffer, bS as bufferCount, bT as bufferTime, bU as cascadingCache, bV as catchError, bW as checkpointToRedis, bX as checkpointToS3, bY as circuitBreaker, bZ as combine, b_ as combineLatest, b$ as concat, c0 as concatMap, c1 as constant, c2 as createTransport, c3 as createWatermarkController, c4 as csvRows, c5 as debounce, c6 as debounceTime, c7 as decorrelatedJitter, c8 as delay, c9 as deserializeError, ca as distinctUntilChanged, cb as elementAt, cc as exhaustMap, cd as exponential, ce as externalBundle, cf as externalProducer, cg as extra, ch as fallback, ci as fibonacci, cj as filter, ck as find, cl as first, cm as flatMap, cn as fromCSV, co as fromClickHouseWatch, cp as fromDrizzle, cq as fromFSWatch, cr as fromGitHook, cs as fromHTTP, ct as fromHTTPPoll, cu as fromHTTPStream, cv as fromKafka, cw as fromKysely, cx as fromMCP, cy as fromNATS, cz as fromNDJSON, cA as fromOTel, cB as fromPrisma, cC as fromPrometheus, cD as fromPulsar, cE as fromRabbitMQ, cF as fromRedisStream, cG as fromSSE, cH as fromSqlite, cI as fromSqliteCursor, cJ as fromStatsD, cK as fromSyslog, cL as fromWebSocket, cM as fromWebSocketReconnect, cN as fromWebhook, cO as interval, cP as last, cQ as linear, cR as lru, cS as map, cT as matchesCron, cU as merge, cV as mergeMap, cW as nameToSignal, cX as ndjsonRows, cY as pairwise, cZ as parseCron, c_ as parsePrometheusText, c$ as parseStatsD, d0 as parseSyslog, d1 as pausable, d2 as pubsub, d3 as race, d4 as rateLimiter, d5 as reactiveIndex, d6 as reactiveList, d7 as reactiveLog, d8 as reactiveSink, d9 as reduce, da as repeat, db as rescue, dc as resolveBackoffPreset, dd as retry, de as retrySource, df as sample, dg as scan, dh as serializeError, di as signalToName, dj as skip, dk as switchMap, dl as take, dm as takeUntil, dn as takeWhile, dp as tap, dq as throttle, dr as throttleTime, ds as timeout, dt as toCSV, du as toClickHouse, dv as toFile, dw as toHTTP, dx as toKafka, dy as toLoki, dz as toMongo, dA as toNATS, dB as toPostgres, dC as toPulsar, dD as toRabbitMQ, dE as toReadableStream, dF as toRedisStream, dG as toS3, dH as toSSE, dI as toSSEBytes, dJ as toSqlite, dK as toTempo, dL as toWebSocket, dM as tokenBucket, dN as valve, dO as window, dP as windowCount, dQ as windowTime, dR as withBreaker, dS as withLatestFrom, dT as withMaxAttempts, dU as withStatus, dV as workerBridge, dW as workerSelf, dX as zip } from './index-BHlKbUwO.cjs';
5
+ import { w as watchTopologyTree } from './index-CO8uBlUh.cjs';
6
+ export { E as ENVELOPE_VERSION, a as EvictedSubgraphInfo, b as EvictionPolicy, G as GraphCodec, J as JsonCodec, L as LazyGraphCodec, O as SIZEOF_OVERHEAD, S as SIZEOF_SYMBOL, W as WALEntry, c as createDagCborCodec, d as createDagCborZstdCodec, e as decodeEnvelope, f as encodeEnvelope, i as graph, r as registerBuiltinCodecs, g as replayWAL, s as sizeof } from './index-CO8uBlUh.cjs';
7
+ import { L as LLMAdapter, G as GateController, a as ai, o as orchestration } from './ai-CaR_912Q.cjs';
8
+ import { P as PolicyEnforcerGraph, a as PolicyViolation, b as audit } from './audit-ClmqGOCx.cjs';
9
+ import { c as cqrs } from './index-DlLp-2Xn.cjs';
10
+ export { i as nestjs } from './index-DlLp-2Xn.cjs';
11
+ import { d as demoShell } from './demo-shell-Crid1WdR.cjs';
12
+ import { N as Node, P as PolicyRuleData, A as Actor, a as NodeOptions } from './node-BmerH3kS.cjs';
13
+ export { C as COMPLETE, b as COMPLETE_MSG, c as COMPLETE_ONLY_BATCH, D as DATA, d as DEFAULT_ACTOR, e as DIRTY, f as DIRTY_MSG, g as DIRTY_ONLY_BATCH, h as DepRecord, E as ERROR, F as FnCtx, G as GlobalInspectorEvent, i as GlobalInspectorHook, j as GraphReFlyConfig, k as GuardAction, l as GuardDenied, m as GuardDeniedDetails, H as HashFn, I as INVALIDATE, n as INVALIDATE_MSG, o as INVALIDATE_ONLY_BATCH, M as Message, p as MessageContext, q as MessageTypeRegistration, r as MessageTypeRegistrationInput, s as Messages, t as NodeActions, u as NodeCtx, v as NodeDescribeKind, w as NodeFn, x as NodeFnCleanup, y as NodeGuard, z as NodeImpl, B as NodeInspectorHook, J as NodeInspectorHookEvent, K as NodeSink, L as NodeStatus, O as NodeTransportOptions, Q as NodeVersionInfo, R as OnMessageHandler, S as OnSubscribeHandler, T as PAUSE, U as PolicyAllow, V as PolicyDeny, W as RESOLVED, X as RESOLVED_MSG, Y as RESOLVED_ONLY_BATCH, Z as RESUME, _ as START, $ as START_MSG, a0 as SubscribeContext, a1 as TEARDOWN, a2 as TEARDOWN_MSG, a3 as TEARDOWN_ONLY_BATCH, a4 as V0, a5 as V1, a6 as VersioningLevel, a7 as VersioningOptions, a8 as accessHintForGuard, a9 as advanceVersion, aa as configure, ab as createVersioning, ac as defaultConfig, ad as defaultHash, ae as isV1, af as node, ag as normalizeActor, ah as policy, ai as policyFromRules, aj as registerBuiltins } from './node-BmerH3kS.cjs';
14
+ import { G as GraphOptions, a as Graph, b as GraphDescribeOptions, c as GraphDescribeOutput, D as DescribeFilter, d as GraphProfileResult, e as GraphProfileOptions, C as CausalChain, f as GraphNodeFactory, g as GraphDiffResult } from './graph-DNCrvZSn.cjs';
15
+ export { h as CausalStep, E as ExplainPathOptions, i as GRAPH_META_SEGMENT, j as GraphActorOptions, k as GraphAttachStorageOptions, l as GraphCheckpointRecord, m as GraphDiagramDirection, n as GraphDiagramOptions, o as GraphDiffChange, p as GraphFactoryContext, q as GraphObserveAll, r as GraphObserveOne, s as GraphPersistSnapshot, t as GraphVersionChange, u as GraphWALDiff, N as NodeProfile, O as ObserveDetail, v as ObserveEvent, w as ObserveOptions, x as ObserveResult, y as ObserveTheme, z as ObserveThemeName, R as ReachableDirection, A as ReachableOptions, S as SNAPSHOT_VERSION, T as TopologyEvent, B as TraceEntry, F as diffForWAL, H as explainPath, I as graphProfile, J as reachable } from './graph-DNCrvZSn.cjs';
16
+ import { T as TopicGraph, m as messaging } from './messaging-Gt4LPbyA.cjs';
17
+ import { R as ReactiveMapBundle } from './composite-C7PcQvcs.cjs';
18
+ export { D as DistillBundle, a as DistillOptions, E as Extraction, M as MapBackend, N as NativeMapBackend, b as NativeMapBackendOptions, c as ReactiveMapOptions, V as VerifiableBundle, d as VerifiableOptions, e as VerifyValue, f as distill, r as reactiveMap, v as verifiable } from './composite-C7PcQvcs.cjs';
19
+ import { m as memory } from './memory-C6Z2tGpC.cjs';
20
+ import { i as index$3 } from './index-CI3DprxP.cjs';
21
+ import { S as StorageTier } from './storage-DdWlZo6U.cjs';
22
+ export { I as IndexedDbStorageSpec, a as StorageHandle, d as dictStorage, f as fileStorage, b as fromIDBRequest, c as fromIDBTransaction, i as indexedDbStorage, m as memoryStorage, s as sqliteStorage } from './storage-DdWlZo6U.cjs';
23
+ export { AsyncSourceOpts, EventTargetLike, FromCronOptions, NodeInput, ReactiveCounterBundle, cached, empty, escapeRegexChar, firstValueFrom, firstWhere, forEach, fromAny, fromAsyncIter, fromCron, fromEvent, fromIter, fromPromise, fromRaf, fromTimer, globToRegExp, keepalive, matchesAnyPattern, never, of, reactiveCounter, replay, share, shareReplay, throwError, toArray } from './extra/sources.cjs';
24
+ export { A as AutoTrackOptions, D as DerivedFn, a as DynamicFn, E as EffectFn, P as PipeOperator, b as ProducerFn, T as TrackFn, c as autoTrackNode, d as derived, e as dynamicNode, f as effect, p as pipe, g as producer, s as state } from './sugar-D02n5JjF.cjs';
25
+ export { D as DescribeDetail, a as DescribeField, b as DescribeNodeOutput, r as resolveDescribeFields } from './meta-BxCA7rcr.cjs';
26
+ export { T as ToObservableOptions, t as toObservable } from './observable-DJt_AxzQ.cjs';
27
+ export { i as jotai } from './index-ByQxazQJ.cjs';
28
+ export { i as nanostores } from './index-DO_6JN9Z.cjs';
29
+ export { i as react } from './index-DYme44FM.cjs';
30
+ export { i as solid } from './index-Xi3u0HCQ.cjs';
31
+ export { i as svelte } from './index-VHqptjhu.cjs';
32
+ export { i as vue } from './index-B1tloyhO.cjs';
33
+ export { i as zustand } from './index-B6EhDnjH.cjs';
17
34
  import '@nestjs/common';
18
35
  import '@nestjs/core';
36
+ import './reactive-layout-MQP--J3F.cjs';
19
37
  import 'rxjs';
20
-
21
- /**
22
- * Options for creating an atom.
23
- *
24
- * @category compat
25
- */
26
- interface AtomOptions {
27
- /** Optional identifier for the underlying node. */
28
- name?: string;
29
- /** Optional companion meta nodes. */
30
- meta?: Record<string, unknown>;
31
- }
32
- /**
33
- * A read-only Jotai-compatible atom.
34
- *
35
- * @category compat
36
- */
37
- interface ReadableAtom<T> {
38
- /** Returns the current cached value. */
39
- get(): T;
40
- /** Subscribes to value changes. Returns an unsubscribe function. */
41
- subscribe(callback: (value: T) => void): () => void;
42
- /** Access to companion meta nodes. */
43
- readonly meta: Record<string, Node>;
44
- /** @internal The underlying GraphReFly node. */
45
- _node: Node<T>;
46
- }
47
- /**
48
- * A writable Jotai-compatible atom.
49
- *
50
- * @category compat
51
- */
52
- interface WritableAtom<T> extends ReadableAtom<T> {
53
- /** Sets a new value. */
54
- set(value: T): void;
55
- /** Updates the value using a transformation function. */
56
- update(fn: (current: T) => T): void;
57
- }
58
- /** Function type for reading other atoms inside a derived atom. */
59
- type GetFn = <V>(a: ReadableAtom<V>) => V;
60
- /** Function type for writing to other atoms inside a writable derived atom. */
61
- type SetFn = <V>(a: WritableAtom<V>, value: V) => void;
62
- /** Function that computes the atom's value. */
63
- type ReadFn<T> = (get: GetFn) => T;
64
- /** Function that handles writes to the atom. */
65
- type WriteFn<T> = (get: GetFn, set: SetFn, value: T) => void;
66
- /**
67
- * Creates a Jotai-compatible atom built on GraphReFly primitives.
68
- *
69
- * Supports three overloads:
70
- * 1. `atom(initial)` — Writable primitive atom (wraps `state()`).
71
- * 2. `atom(read)` — Read-only derived atom (wraps `dynamicNode()`).
72
- * 3. `atom(read, write)` — Writable derived atom.
73
- *
74
- * @param initialOrRead - Initial value or a read function.
75
- * @param writeOrOptions - Write function or options object.
76
- * @param options - Optional configuration.
77
- * @returns WritableAtom or ReadableAtom.
78
- *
79
- * @example
80
- * ```ts
81
- * const count = atom(0);
82
- * count.set(1);
83
- * const doubled = atom((get) => get(count)! * 2);
84
- * ```
85
- *
86
- * @category compat
87
- */
88
- declare function atom$1<T>(initial: T, options?: AtomOptions): WritableAtom<T>;
89
- declare function atom$1<T>(read: ReadFn<T>, options?: AtomOptions): ReadableAtom<T>;
90
- declare function atom$1<T>(read: ReadFn<T>, write: WriteFn<T>, options?: AtomOptions): WritableAtom<T>;
91
-
92
- type index$a_AtomOptions = AtomOptions;
93
- type index$a_GetFn = GetFn;
94
- type index$a_ReadFn<T> = ReadFn<T>;
95
- type index$a_ReadableAtom<T> = ReadableAtom<T>;
96
- type index$a_SetFn = SetFn;
97
- type index$a_WritableAtom<T> = WritableAtom<T>;
98
- type index$a_WriteFn<T> = WriteFn<T>;
99
- declare namespace index$a {
100
- export { type index$a_AtomOptions as AtomOptions, type index$a_GetFn as GetFn, type index$a_ReadFn as ReadFn, type index$a_ReadableAtom as ReadableAtom, type index$a_SetFn as SetFn, type index$a_WritableAtom as WritableAtom, type index$a_WriteFn as WriteFn, atom$1 as atom };
101
- }
102
-
103
- /**
104
- * A Nanostores-compatible atom.
105
- *
106
- * @category compat
107
- */
108
- interface NanoAtom<T> {
109
- /** Get current value. */
110
- get(): T;
111
- /** Set a new value (writable atoms only). */
112
- set(value: T): void;
113
- /** Subscribe to value changes. Callback receives the new value.
114
- * Returns unsubscribe function. Called immediately with current value. */
115
- subscribe(cb: (value: T) => void): () => void;
116
- /** Listen to value changes (no immediate call). Returns unsubscribe. */
117
- listen(cb: (value: T) => void): () => void;
118
- /** The underlying GraphReFly node. */
119
- readonly _node: Node<T>;
120
- }
121
- /**
122
- * A Nanostores-compatible computed store.
123
- *
124
- * @category compat
125
- */
126
- interface NanoComputed<T> {
127
- /** Get current value. */
128
- get(): T;
129
- /** Subscribe to value changes. Called immediately with current value.
130
- * Returns unsubscribe function. */
131
- subscribe(cb: (value: T) => void): () => void;
132
- /** Listen to value changes (no immediate call). Returns unsubscribe. */
133
- listen(cb: (value: T) => void): () => void;
134
- /** The underlying GraphReFly node. */
135
- readonly _node: Node<T>;
136
- }
137
- /**
138
- * A Nanostores-compatible map.
139
- *
140
- * @category compat
141
- */
142
- interface NanoMap<T extends Record<string, unknown>> extends NanoAtom<T> {
143
- /** Set a single key. */
144
- setKey<K extends keyof T>(key: K, value: T[K]): void;
145
- }
146
- /**
147
- * Creates a nanostores-compatible atom.
148
- *
149
- * @param initial - Initial value.
150
- * @returns `NanoAtom<T>`
151
- *
152
- * @category compat
153
- */
154
- declare function atom<T>(initial: T): NanoAtom<T>;
155
- /**
156
- * Creates a nanostores-compatible computed store.
157
- *
158
- * @param stores - One or more atoms/computed stores.
159
- * @param fn - Compute function.
160
- * @returns `NanoComputed<T>`
161
- *
162
- * @category compat
163
- */
164
- declare function computed<T, A>(storeA: NanoAtom<A> | NanoComputed<A>, fn: (a: A) => T): NanoComputed<T>;
165
- declare function computed<T, A, B>(stores: [NanoAtom<A> | NanoComputed<A>, NanoAtom<B> | NanoComputed<B>], fn: (a: A, b: B) => T): NanoComputed<T>;
166
- declare function computed<T, A, B, C>(stores: [
167
- NanoAtom<A> | NanoComputed<A>,
168
- NanoAtom<B> | NanoComputed<B>,
169
- NanoAtom<C> | NanoComputed<C>
170
- ], fn: (a: A, b: B, c: C) => T): NanoComputed<T>;
171
- /**
172
- * Creates a nanostores-compatible map.
173
- *
174
- * @param initial - Initial object value.
175
- * @returns `NanoMap<T>`
176
- *
177
- * @category compat
178
- */
179
- declare function map<T extends Record<string, unknown>>(initial: T): NanoMap<T>;
180
- /**
181
- * Returns the current value of the store.
182
- *
183
- * @category compat
184
- */
185
- declare function getValue<T>(store: NanoAtom<T> | NanoComputed<T>): T;
186
- /**
187
- * Adds a listener for the store start (first listener connected).
188
- *
189
- * @category compat
190
- */
191
- declare function onStart(store: NanoAtom<any> | NanoComputed<any>, cb: () => void): void;
192
- /**
193
- * Adds a listener for the store stop (last listener disconnected).
194
- *
195
- * @category compat
196
- */
197
- declare function onStop(store: NanoAtom<any> | NanoComputed<any>, cb: () => void): void;
198
- /**
199
- * Adds a listener for the store mount (first listener connected).
200
- *
201
- * @returns A cleanup function called when the last listener is removed.
202
- * @category compat
203
- */
204
- declare function onMount(store: NanoAtom<any> | NanoComputed<any>, cb: () => (() => void) | undefined): void;
205
- /**
206
- * Batches multiple store updates.
207
- *
208
- * @category compat
209
- */
210
- declare function action<Args extends any[], Return>(_store: NanoAtom<any> | NanoComputed<any>, _name: string, fn: (...args: Args) => Return): (...args: Args) => Return;
211
-
212
- type index$9_NanoAtom<T> = NanoAtom<T>;
213
- type index$9_NanoComputed<T> = NanoComputed<T>;
214
- type index$9_NanoMap<T extends Record<string, unknown>> = NanoMap<T>;
215
- declare const index$9_action: typeof action;
216
- declare const index$9_atom: typeof atom;
217
- declare const index$9_computed: typeof computed;
218
- declare const index$9_getValue: typeof getValue;
219
- declare const index$9_map: typeof map;
220
- declare const index$9_onMount: typeof onMount;
221
- declare const index$9_onStart: typeof onStart;
222
- declare const index$9_onStop: typeof onStop;
223
- declare namespace index$9 {
224
- export { type index$9_NanoAtom as NanoAtom, type index$9_NanoComputed as NanoComputed, type index$9_NanoMap as NanoMap, index$9_action as action, index$9_atom as atom, index$9_computed as computed, index$9_getValue as getValue, index$9_map as map, index$9_onMount as onMount, index$9_onStart as onStart, index$9_onStop as onStop };
225
- }
226
-
227
- /**
228
- * Subscribe to a read-only `Node<T>` as a React value. Re-renders on node value settlement.
229
- * Subscription lifecycle is tied to React mount/unmount (not node terminal messages).
230
- *
231
- * @param node - Any `Node<T>`.
232
- * @returns `T | undefined` — the current node value, kept in sync via `useSyncExternalStore`.
233
- */
234
- declare function useSubscribe$3<T>(node: Node<T>): T | undefined | null;
235
- /**
236
- * Bind a writable `Node<T>` as a React `[value, setter]` tuple.
237
- * Setting the value always pushes `[[DIRTY], [DATA, value]]`, including `value === undefined`.
238
- * Subscription lifecycle is tied to React mount/unmount (not node terminal messages).
239
- *
240
- * @param node - A `Node<T>` (e.g. state node).
241
- * @returns `[T | undefined, (value: T) => void]` — current value and setter function.
242
- */
243
- declare function useStore$3<T>(node: Node<T>): [T | undefined | null, (value: T) => void];
244
- /** Maps a key to an object of nodes. Used by `useSubscribeRecord`. */
245
- type NodeFactory$3<K, R extends Record<string, any>> = (key: K) => {
246
- [P in keyof R]: Node<R[P]>;
247
- };
248
- /**
249
- * Subscribe to a dynamic set of keyed node records.
250
- * Re-subscribes all per-key fields whenever `keysNode` changes.
251
- * Key re-sync is gated to settled batches (`messageTier >= 3`) to avoid DIRTY-phase churn.
252
- * Guaranteed to clean up strictly with React hook lifecycle, utilizing no global mappings.
253
- *
254
- * @param keysNode - Node of current keys (e.g. node IDs)
255
- * @param factory - Function returning `{ [field]: Node<V> }` for each key.
256
- * @returns `Record<K, R>` — snapshot of resolved values for all keys.
257
- */
258
- declare function useSubscribeRecord$3<K extends string, R extends Record<string, any>>(keysNode: Node<K[]>, factory: NodeFactory$3<K, R>): Record<K, R>;
259
-
260
- declare namespace index$8 {
261
- export { type NodeFactory$3 as NodeFactory, useStore$3 as useStore, useSubscribe$3 as useSubscribe, useSubscribeRecord$3 as useSubscribeRecord };
262
- }
263
-
264
- /**
265
- * Options for creating signals.
266
- *
267
- * @category compat
268
- */
269
- interface SignalOptions {
270
- /** Optional identifier for the underlying node. */
271
- name?: string;
272
- /** Custom equality function for change detection. */
273
- equals?: (a: any, b: any) => boolean;
274
- }
275
- /**
276
- * Common interface for all reactive signals.
277
- *
278
- * @category compat
279
- */
280
- interface AnySignal<T> {
281
- /** Returns the current value of the signal. */
282
- get(): T;
283
- /** @internal The underlying GraphReFly node. */
284
- _node: Node<T>;
285
- }
286
- /**
287
- * TC39 `Signal.State` — a writable signal backed by a GraphReFly `state` node.
288
- * Automatically registers itself as a dependency if read inside a `Computed`.
289
- *
290
- * @example
291
- * ```ts
292
- * const count = new Signal.State(0);
293
- * count.get(); // 0
294
- * count.set(1);
295
- * count.get(); // 1
296
- * ```
297
- */
298
- declare class SignalState<T> implements AnySignal<T> {
299
- /** @internal */
300
- _node: Node<T>;
301
- private readonly _equals;
302
- constructor(initial: T, opts?: SignalOptions);
303
- get(): T;
304
- set(value: T): void;
305
- }
306
- /**
307
- * TC39 `Signal.Computed` — a read-only signal backed by `dynamicNode`.
308
- * Automatically tracks dependencies when `get()` is called on other signals
309
- * during its computation.
310
- *
311
- * @example
312
- * ```ts
313
- * const count = new Signal.State(0);
314
- * const doubled = new Signal.Computed(() => count.get() * 2);
315
- * ```
316
- */
317
- declare class SignalComputed<T> implements AnySignal<T> {
318
- /** @internal */
319
- _node: Node<T>;
320
- constructor(computation: () => T, opts?: SignalOptions);
321
- get(): T;
322
- }
323
- /**
324
- * TC39 Signals-compatible namespace. Wraps GraphReFly primitives.
325
- * Provides auto-tracking conforming to the TS39 signals proposal.
326
- *
327
- * @category compat
328
- */
329
- declare const Signal: {
330
- readonly State: typeof SignalState;
331
- readonly Computed: typeof SignalComputed;
332
- /**
333
- * Subscribes to changes on a signal.
334
- * Returns an unsubscribe callback.
335
- *
336
- * @example
337
- * ```ts
338
- * const count = new Signal.State(0);
339
- * const unsub = Signal.sub(count, v => console.log(v));
340
- * ```
341
- */
342
- readonly sub: <T>(signal: AnySignal<T>, callback: ((value: T) => void) | {
343
- data?: (value: T) => void;
344
- error?: (err: unknown) => void;
345
- complete?: () => void;
346
- }) => (() => void);
347
- };
348
-
349
- type index$7_AnySignal<T> = AnySignal<T>;
350
- declare const index$7_Signal: typeof Signal;
351
- type index$7_SignalComputed<T> = SignalComputed<T>;
352
- declare const index$7_SignalComputed: typeof SignalComputed;
353
- type index$7_SignalOptions = SignalOptions;
354
- type index$7_SignalState<T> = SignalState<T>;
355
- declare const index$7_SignalState: typeof SignalState;
356
- declare namespace index$7 {
357
- export { type index$7_AnySignal as AnySignal, index$7_Signal as Signal, index$7_SignalComputed as SignalComputed, type index$7_SignalOptions as SignalOptions, index$7_SignalState as SignalState };
358
- }
359
-
360
- /** Solid accessor function — returns current value when called. */
361
- type Accessor<T> = () => T;
362
- /**
363
- * Subscribe to a `Node<T>` as a Solid signal. Auto-cleans up with the owning scope.
364
- * Subscription lifecycle is tied to Solid scope cleanup (not node terminal messages).
365
- */
366
- declare function useSubscribe$2<T>(node: Node<T>): Accessor<T | undefined | null>;
367
- /**
368
- * Bind a writable `Node<T>` as a Solid resource tuple `[accessor, setter]`.
369
- * Setter always forwards `[[DIRTY], [DATA, value]]`, including `value === undefined`.
370
- * Subscription lifecycle is tied to Solid scope cleanup (not node terminal messages).
371
- */
372
- declare function useStore$2<T>(node: Node<T>): [Accessor<T | undefined | null>, (v: T) => void];
373
- /** Maps a key to an object of nodes. Used by `useSubscribeRecord`. */
374
- type NodeFactory$2<K, R extends Record<string, any>> = (key: K) => {
375
- [P in keyof R]: Node<R[P]>;
376
- };
377
- /**
378
- * Subscribe to a dynamic set of keyed node records as a Solid accessor.
379
- * Re-subscribes all per-key fields whenever `keys` changes.
380
- * Key re-sync is gated to settled batches (`messageTier >= 3`) to avoid DIRTY-phase churn.
381
- */
382
- declare function useSubscribeRecord$2<K extends string, R extends Record<string, any>>(keysNode: Node<K[]>, factory: NodeFactory$2<K, R>): Accessor<Record<K, R>>;
383
-
384
- type index$6_Accessor<T> = Accessor<T>;
385
- declare namespace index$6 {
386
- export { type index$6_Accessor as Accessor, type NodeFactory$2 as NodeFactory, useStore$2 as useStore, useSubscribe$2 as useSubscribe, useSubscribeRecord$2 as useSubscribeRecord };
387
- }
388
-
389
- /** Svelte store contract — implements the minimal `subscribe` method. */
390
- interface SvelteReadable<T> {
391
- subscribe(run: (value: T) => void): () => void;
392
- }
393
- /** Svelte writable store contract. */
394
- interface SvelteWritable<T> extends SvelteReadable<T> {
395
- set(value: T): void;
396
- update(updater: (value: T) => T): void;
397
- }
398
- /**
399
- * Subscribe to a `Node<T>` as a Svelte readable store (implements Svelte store contract).
400
- * Subscription lifecycle is tied to Svelte store unsubscription (not node terminal messages).
401
- */
402
- declare function useSubscribe$1<T>(node: Node<T>): SvelteReadable<T | undefined | null>;
403
- /**
404
- * Bind a writable `Node<T>` as a Svelte writable store.
405
- * Reads and writes adapt seamlessly.
406
- * Setter/update always forward `[[DIRTY], [DATA, value]]`, including `value === undefined`.
407
- * Subscription lifecycle is tied to Svelte store unsubscription (not node terminal messages).
408
- */
409
- declare function useStore$1<T>(node: Node<T>): SvelteWritable<T | undefined | null>;
410
- /** Maps a key to an object of nodes. Used by `useSubscribeRecord`. */
411
- type NodeFactory$1<K, R extends Record<string, any>> = (key: K) => {
412
- [P in keyof R]: Node<R[P]>;
413
- };
414
- /**
415
- * Subscribe to a dynamic keyed record of nodes as a Svelte readable store.
416
- * Re-subscribes all per-key fields whenever `keysNode` changes.
417
- * Key re-sync is gated to settled batches (`messageTier >= 3`) to avoid DIRTY-phase churn.
418
- */
419
- declare function useSubscribeRecord$1<K extends string, R extends Record<string, any>>(keysNode: Node<K[]>, factory: NodeFactory$1<K, R>): SvelteReadable<Record<K, R>>;
420
-
421
- type index$5_SvelteReadable<T> = SvelteReadable<T>;
422
- type index$5_SvelteWritable<T> = SvelteWritable<T>;
423
- declare namespace index$5 {
424
- export { type NodeFactory$1 as NodeFactory, type index$5_SvelteReadable as SvelteReadable, type index$5_SvelteWritable as SvelteWritable, useStore$1 as useStore, useSubscribe$1 as useSubscribe, useSubscribeRecord$1 as useSubscribeRecord };
425
- }
426
-
427
- /**
428
- * Subscribe to a read-only `Node<T>` as a Vue `Ref<T>`. Auto-unsubscribes on scope disposal.
429
- * Subscription lifecycle is tied to Vue scope disposal (not node terminal messages).
430
- */
431
- declare function useSubscribe<T>(node: Node<T>): Readonly<Ref<T | undefined | null>>;
432
- /**
433
- * Bind a writable `Node<T>` as a Vue `Ref<T>`. Reads and writes are bidirectional.
434
- * Value sets always dispatch `[[DIRTY], [DATA, value]]`, including `value === undefined`.
435
- * Subscription lifecycle is tied to Vue scope disposal (not node terminal messages).
436
- */
437
- declare function useStore<T>(node: Node<T>): Ref<T | undefined | null>;
438
- /** Maps a key to an object of nodes. Used by `useSubscribeRecord` factory. */
439
- type NodeFactory<K, R extends Record<string, any>> = (key: K) => {
440
- [P in keyof R]: Node<R[P]>;
441
- };
442
- /**
443
- * Subscribe to a dynamic set of keyed node records. When keys change,
444
- * old subscriptions are torn down and new ones created automatically.
445
- * Must be called during Vue `setup()`.
446
- */
447
- declare function useSubscribeRecord<K extends string, R extends Record<string, any>>(keys: WatchSource<K[] | undefined>, factory: NodeFactory<K, R>): Readonly<Ref<Record<K, R>>>;
448
-
449
- type index$4_NodeFactory<K, R extends Record<string, any>> = NodeFactory<K, R>;
450
- declare const index$4_useStore: typeof useStore;
451
- declare const index$4_useSubscribe: typeof useSubscribe;
452
- declare const index$4_useSubscribeRecord: typeof useSubscribeRecord;
453
- declare namespace index$4 {
454
- export { type index$4_NodeFactory as NodeFactory, index$4_useStore as useStore, index$4_useSubscribe as useSubscribe, index$4_useSubscribeRecord as useSubscribeRecord };
455
- }
456
-
457
- /** Zustand-compatible Store API. */
458
- interface StoreApi<T> {
459
- getState: () => T;
460
- setState: (partial: T | Partial<T> | ((state: T) => T | Partial<T>), replace?: boolean) => void;
461
- getInitialState: () => T;
462
- subscribe: (listener: (state: T, prevState: T) => void) => () => void;
463
- destroy: () => void;
464
- }
465
- /** Function type for initializing the store. */
466
- type StateCreator<T> = (set: StoreApi<T>["setState"], get: StoreApi<T>["getState"], api: StoreApi<T>) => T;
467
- /**
468
- * Creates a Zustand-compatible store backed by a GraphReFly state node.
469
- * returns an object that is both a Graph and a StoreApi.
470
- *
471
- * @example
472
- * ```ts
473
- * const store = create((set) => ({
474
- * count: 0,
475
- * inc: () => set((s) => ({ count: s.count + 1 }))
476
- * }));
477
- * store.getState().inc();
478
- * ```
479
- *
480
- * @category compat
481
- */
482
- declare function create<T extends object>(initializer: StateCreator<T>): Graph & StoreApi<T>;
483
-
484
- type index$3_StateCreator<T> = StateCreator<T>;
485
- type index$3_StoreApi<T> = StoreApi<T>;
486
- declare const index$3_create: typeof create;
487
- declare namespace index$3 {
488
- export { type index$3_StateCreator as StateCreator, type index$3_StoreApi as StoreApi, index$3_create as create };
489
- }
490
-
491
- /**
492
- * Compat layer: compatibility wrappers for other state management libraries (Phase 5.1b).
493
- *
494
- * Framework adapters are optional peers. Install only what you use:
495
- * - `@graphrefly/graphrefly-ts/compat/react` -> `react`, `react-dom`
496
- * - `@graphrefly/graphrefly-ts/compat/vue` -> `vue`
497
- * - `@graphrefly/graphrefly-ts/compat/svelte` -> `svelte`
498
- * - `@graphrefly/graphrefly-ts/compat/solid` -> `solid-js`
499
- */
500
-
501
- declare namespace index$2 {
502
- export { index$a as jotai, index$9 as nanostores, index$b as nestjs, index$8 as react, index$7 as signals, index$6 as solid, index$5 as svelte, index$4 as vue, index$3 as zustand };
503
- }
504
-
505
- /**
506
- * Memory patterns (roadmap §4.3).
507
- *
508
- * Domain-layer helpers composed from GraphRefly primitives. `vectorIndex` uses
509
- * an exact-search backend by default; an HNSW adapter can be injected as an
510
- * optional dependency.
511
- */
512
-
513
- type CollectionPolicy = "fifo" | "lru";
514
- type VectorBackend = "flat" | "hnsw";
515
- type LightCollectionEntry<T> = {
516
- readonly id: string;
517
- readonly value: T;
518
- readonly createdAtNs: number;
519
- readonly lastAccessNs: number;
520
- };
521
- type LightCollectionOptions = {
522
- name?: string;
523
- maxSize?: number;
524
- policy?: CollectionPolicy;
525
- };
526
- type LightCollectionBundle<T> = {
527
- readonly entries: Node<ReadonlyMap<string, LightCollectionEntry<T>>>;
528
- upsert: (id: string, value: T) => void;
529
- remove: (id: string) => void;
530
- clear: () => void;
531
- get: (id: string) => T | undefined;
532
- has: (id: string) => boolean;
533
- };
534
- type CollectionEntry<T> = LightCollectionEntry<T> & {
535
- readonly baseScore: number;
536
- };
537
- type RankedCollectionEntry<T> = CollectionEntry<T> & {
538
- readonly score: number;
539
- };
540
- type CollectionOptions<T> = {
541
- maxSize?: number;
542
- policy?: CollectionPolicy;
543
- /**
544
- * Produces a base score at insert/update time.
545
- */
546
- score?: (value: T) => number;
547
- /**
548
- * Exponential decay rate per second. 0 disables decay.
549
- */
550
- decayRate?: number;
551
- /**
552
- * Minimum score floor after decay.
553
- */
554
- minScore?: number;
555
- };
556
- type CollectionGraph<T> = Graph & {
557
- upsert: (id: string, value: T, opts?: {
558
- score?: number;
559
- }) => void;
560
- remove: (id: string) => void;
561
- clear: () => void;
562
- getItem: (id: string) => CollectionEntry<T> | undefined;
563
- };
564
- type VectorRecord<TMeta> = {
565
- readonly id: string;
566
- readonly vector: readonly number[];
567
- readonly meta?: TMeta;
568
- };
569
- type VectorSearchResult<TMeta> = {
570
- readonly id: string;
571
- readonly score: number;
572
- readonly meta?: TMeta;
573
- };
574
- type HnswAdapter<TMeta> = {
575
- upsert: (id: string, vector: readonly number[], meta?: TMeta) => void;
576
- remove: (id: string) => void;
577
- clear: () => void;
578
- search: (query: readonly number[], k: number) => ReadonlyArray<VectorSearchResult<TMeta>>;
579
- };
580
- type VectorIndexOptions<TMeta> = {
581
- backend?: VectorBackend;
582
- dimension?: number;
583
- /**
584
- * Optional dependency seam for HNSW.
585
- */
586
- hnswFactory?: () => HnswAdapter<TMeta>;
587
- };
588
- type VectorIndexBundle<TMeta> = {
589
- readonly backend: VectorBackend;
590
- readonly entries: Node<ReadonlyMap<string, VectorRecord<TMeta>>>;
591
- upsert: (id: string, vector: readonly number[], meta?: TMeta) => void;
592
- remove: (id: string) => void;
593
- clear: () => void;
594
- search: (query: readonly number[], k?: number) => ReadonlyArray<VectorSearchResult<TMeta>>;
595
- };
596
- type KnowledgeEdge<TRelation extends string = string> = {
597
- readonly from: string;
598
- readonly to: string;
599
- readonly relation: TRelation;
600
- readonly weight: number;
601
- };
602
- type KnowledgeGraphGraph<TEntity, TRelation extends string = string> = Graph & {
603
- upsertEntity: (id: string, value: TEntity) => void;
604
- removeEntity: (id: string) => void;
605
- link: (from: string, to: string, relation: TRelation, weight?: number) => void;
606
- unlink: (from: string, to: string, relation?: TRelation) => void;
607
- related: (id: string, relation?: TRelation) => ReadonlyArray<KnowledgeEdge<TRelation>>;
608
- };
609
- declare function decay(baseScore: number, ageSeconds: number, ratePerSecond: number, minScore?: number): number;
610
- declare function lightCollection<T>(opts?: LightCollectionOptions): LightCollectionBundle<T>;
611
- declare function collection<T>(name: string, opts?: CollectionOptions<T>): CollectionGraph<T>;
612
- declare function vectorIndex<TMeta>(opts?: VectorIndexOptions<TMeta>): VectorIndexBundle<TMeta>;
613
- declare function knowledgeGraph<TEntity, TRelation extends string = string>(name: string): KnowledgeGraphGraph<TEntity, TRelation>;
614
-
615
- type memory_CollectionEntry<T> = CollectionEntry<T>;
616
- type memory_CollectionGraph<T> = CollectionGraph<T>;
617
- type memory_CollectionOptions<T> = CollectionOptions<T>;
618
- type memory_CollectionPolicy = CollectionPolicy;
619
- type memory_HnswAdapter<TMeta> = HnswAdapter<TMeta>;
620
- type memory_KnowledgeEdge<TRelation extends string = string> = KnowledgeEdge<TRelation>;
621
- type memory_KnowledgeGraphGraph<TEntity, TRelation extends string = string> = KnowledgeGraphGraph<TEntity, TRelation>;
622
- type memory_LightCollectionBundle<T> = LightCollectionBundle<T>;
623
- type memory_LightCollectionEntry<T> = LightCollectionEntry<T>;
624
- type memory_LightCollectionOptions = LightCollectionOptions;
625
- type memory_RankedCollectionEntry<T> = RankedCollectionEntry<T>;
626
- type memory_VectorBackend = VectorBackend;
627
- type memory_VectorIndexBundle<TMeta> = VectorIndexBundle<TMeta>;
628
- type memory_VectorIndexOptions<TMeta> = VectorIndexOptions<TMeta>;
629
- type memory_VectorRecord<TMeta> = VectorRecord<TMeta>;
630
- type memory_VectorSearchResult<TMeta> = VectorSearchResult<TMeta>;
631
- declare const memory_collection: typeof collection;
632
- declare const memory_decay: typeof decay;
633
- declare const memory_knowledgeGraph: typeof knowledgeGraph;
634
- declare const memory_lightCollection: typeof lightCollection;
635
- declare const memory_vectorIndex: typeof vectorIndex;
636
- declare namespace memory {
637
- export { type memory_CollectionEntry as CollectionEntry, type memory_CollectionGraph as CollectionGraph, type memory_CollectionOptions as CollectionOptions, type memory_CollectionPolicy as CollectionPolicy, type memory_HnswAdapter as HnswAdapter, type memory_KnowledgeEdge as KnowledgeEdge, type memory_KnowledgeGraphGraph as KnowledgeGraphGraph, type memory_LightCollectionBundle as LightCollectionBundle, type memory_LightCollectionEntry as LightCollectionEntry, type memory_LightCollectionOptions as LightCollectionOptions, type memory_RankedCollectionEntry as RankedCollectionEntry, type memory_VectorBackend as VectorBackend, type memory_VectorIndexBundle as VectorIndexBundle, type memory_VectorIndexOptions as VectorIndexOptions, type memory_VectorRecord as VectorRecord, type memory_VectorSearchResult as VectorSearchResult, memory_collection as collection, memory_decay as decay, memory_knowledgeGraph as knowledgeGraph, memory_lightCollection as lightCollection, memory_vectorIndex as vectorIndex };
638
- }
639
-
640
- /**
641
- * Messaging patterns (roadmap §4.2).
642
- *
643
- * Pulsar-inspired messaging features modeled as graph factories:
644
- * - `topic()` for append-only topic streams
645
- * - `subscription()` for cursor-based consumers
646
- * - `jobQueue()` for queue claim/ack flow
647
- */
648
-
649
- type TopicOptions = {
650
- graph?: GraphOptions;
651
- retainedLimit?: number;
652
- };
653
- declare class TopicGraph<T> extends Graph {
654
- private readonly _log;
655
- readonly events: Node<readonly T[]>;
656
- /**
657
- * Most recently published value, or `null` when the topic has no entries
658
- * yet. Spec §5.12 reserves `undefined` as the protocol-internal "never
659
- * sent DATA" sentinel — `null` is the idiomatic "empty / no value" signal
660
- * for domain nodes. F7.
661
- *
662
- * **Caveat when `T` itself includes `null`** (e.g., `topic<number | null>`):
663
- * `latest === null` is ambiguous — it could mean "no publish yet" OR "a
664
- * `null` value was published". Use {@link hasLatest} to disambiguate, or
665
- * observe {@link events} directly and track length yourself.
666
- */
667
- readonly latest: Node<T | null>;
668
- /**
669
- * Reactive `true` once the topic has at least one published entry.
670
- * Disambiguates "`null` never published" from "`null` was published" when
671
- * `T` includes `null`.
672
- */
673
- readonly hasLatest: Node<boolean>;
674
- constructor(name: string, opts?: TopicOptions);
675
- publish(value: T): void;
676
- retained(): readonly T[];
677
- }
678
- type SubscriptionOptions = {
679
- graph?: GraphOptions;
680
- cursor?: number;
681
- };
682
- declare class SubscriptionGraph<T> extends Graph {
683
- readonly source: Node<readonly T[]>;
684
- readonly cursor: Node<number>;
685
- readonly available: Node<readonly T[]>;
686
- /**
687
- * Reference to the upstream topic graph. Intentionally NOT mounted
688
- * under this subscription: a subscription is a VIEW over an
689
- * externally-owned topic. Double-mounting (e.g. hub-owned topic +
690
- * sub-mount here) would make either-side teardown leave the other
691
- * holding a dead reference. Node-level `derived([topicEvents], …)`
692
- * still wires the data dependency across graph boundaries. D1(e).
693
- */
694
- readonly topic: TopicGraph<T>;
695
- constructor(name: string, topicGraph: TopicGraph<T>, opts?: SubscriptionOptions);
696
- ack(count?: number): number;
697
- pull(limit?: number, opts?: {
698
- ack?: boolean;
699
- }): readonly T[];
700
- }
701
- type JobState = "queued" | "inflight";
702
- type JobEnvelope<T> = {
703
- id: string;
704
- payload: T;
705
- attempts: number;
706
- metadata: Readonly<Record<string, unknown>>;
707
- state: JobState;
708
- };
709
- type JobQueueOptions = {
710
- graph?: GraphOptions;
711
- };
712
- declare class JobQueueGraph<T> extends Graph {
713
- private readonly _pending;
714
- private readonly _jobs;
715
- private _seq;
716
- readonly pending: Node<readonly string[]>;
717
- readonly jobs: Node<ReadonlyMap<string, JobEnvelope<T>>>;
718
- readonly depth: Node<number>;
719
- constructor(name: string, opts?: JobQueueOptions);
720
- enqueue(payload: T, opts?: {
721
- id?: string;
722
- metadata?: Record<string, unknown>;
723
- }): string;
724
- claim(limit?: number): readonly JobEnvelope<T>[];
725
- ack(id: string): boolean;
726
- nack(id: string, opts?: {
727
- requeue?: boolean;
728
- }): boolean;
729
- }
730
- type JobFlowOptions = {
731
- graph?: GraphOptions;
732
- stages?: readonly string[];
733
- maxPerPump?: number;
734
- };
735
- declare class JobFlowGraph<T> extends Graph {
736
- private readonly _stageNames;
737
- private readonly _queues;
738
- private readonly _completed;
739
- readonly completed: Node<readonly JobEnvelope<T>[]>;
740
- readonly completedCount: Node<number>;
741
- constructor(name: string, opts?: JobFlowOptions);
742
- stages(): readonly string[];
743
- queue(stage: string): JobQueueGraph<T>;
744
- enqueue(payload: T, opts?: {
745
- id?: string;
746
- metadata?: Record<string, unknown>;
747
- }): string;
748
- retainedCompleted(): readonly JobEnvelope<T>[];
749
- }
750
- type TopicBridgeOptions<TIn, TOut> = {
751
- graph?: GraphOptions;
752
- cursor?: number;
753
- maxPerPump?: number;
754
- map?: (value: TIn) => TOut | undefined;
755
- };
756
- declare class TopicBridgeGraph<TIn, TOut = TIn> extends Graph {
757
- private readonly _sourceSub;
758
- private readonly _target;
759
- readonly bridgedCount: Node<number>;
760
- constructor(name: string, sourceTopic: TopicGraph<TIn>, targetTopic: TopicGraph<TOut>, opts?: TopicBridgeOptions<TIn, TOut>);
761
- }
762
- type MessagingHubOptions = {
763
- graph?: GraphOptions;
764
- /**
765
- * Default `TopicOptions` applied to every topic created via `topic(name)`
766
- * without explicit options. Per-call opts override. Default: `{}`
767
- * (unbounded retention per topic unless `retainedLimit` is set per call).
768
- */
769
- defaultTopicOptions?: TopicOptions;
770
- };
771
- /**
772
- * Lazy Pulsar-inspired topic registry. Manages a named set of {@link TopicGraph}
773
- * instances with retention + cursor semantics. Topics are created on first
774
- * access; `removeTopic(name)` unmounts and tears down via {@link Graph.remove}.
775
- *
776
- * **Relationship to `pubsub()` in `src/extra/pubsub.ts`:** `pubsub` is a
777
- * lightweight last-value state hub (no retention, no cursors). `MessagingHubGraph`
778
- * is the full messaging hub — retained message logs, cursor-based subscriptions,
779
- * and pattern-layer lifecycle management.
780
- *
781
- * @category patterns
782
- */
783
- declare class MessagingHubGraph extends Graph {
784
- private readonly _topics;
785
- private _version;
786
- private readonly _defaultTopicOptions;
787
- constructor(name: string, opts?: MessagingHubOptions);
788
- /** Monotonic counter advancing on topic create/remove. */
789
- get version(): number;
790
- /** Number of topics currently in the hub. */
791
- get size(): number;
792
- /** Checks topic existence without creating. */
793
- has(name: string): boolean;
794
- /** Iterator over topic names. */
795
- topicNames(): IterableIterator<string>;
796
- /**
797
- * Returns the {@link TopicGraph} for `name`, creating lazily on first call.
798
- * Subsequent calls with the same name return the same instance (options on
799
- * repeat calls are ignored — the topic is already configured).
800
- */
801
- topic<T = unknown>(name: string, opts?: TopicOptions): TopicGraph<T>;
802
- /**
803
- * Publishes a value to the topic, lazily creating it on first publish.
804
- *
805
- * **Late-subscriber caveat:** the topic is created lazily, so subscribers
806
- * that attach AFTER a publish only see the retained window (governed by
807
- * `retainedLimit` on `TopicOptions` / `defaultTopicOptions`). If
808
- * `retainedLimit === 0` is set explicitly, early publishes are
809
- * effectively dropped — prefer an unset `retainedLimit` (unbounded
810
- * retention) or subscribe before publishing when late-subscribers matter.
811
- */
812
- publish<T = unknown>(name: string, value: T): void;
813
- /**
814
- * Bulk publish — issues all publishes inside one outer batch. New topics
815
- * are created on demand. No-op if `entries` yields nothing.
816
- *
817
- * **Iterable consumption (F6):** `entries` is consumed once (single-pass)
818
- * INSIDE the batch frame. If the iterator throws mid-way, the batch is
819
- * discarded and NO publishes are visible to subscribers (all-or-nothing).
820
- * Pass an array or `Set` for multi-shot callers.
821
- */
822
- publishMany(entries: Iterable<[string, unknown]>): void;
823
- /**
824
- * Creates a {@link SubscriptionGraph} over a named topic. The topic is
825
- * lazily created if missing. Subscription lifecycle is owned by the caller —
826
- * the hub does NOT mount the subscription.
827
- *
828
- * @param subName - Local name for the subscription graph.
829
- * @param topicName - Hub topic to subscribe to.
830
- * @param opts - `SubscriptionOptions` (initial cursor, etc.).
831
- */
832
- subscribe<T = unknown>(subName: string, topicName: string, opts?: SubscriptionOptions): SubscriptionGraph<T>;
833
- /**
834
- * Unmounts and tears down the topic's graph. Returns `true` if the topic
835
- * existed. Subscribers receive `TEARDOWN` via {@link Graph.remove}.
836
- */
837
- removeTopic(name: string): boolean;
838
- }
839
- /**
840
- * Creates a Pulsar-inspired topic graph (append-only retained stream + latest value).
841
- */
842
- declare function topic<T>(name: string, opts?: TopicOptions): TopicGraph<T>;
843
- /**
844
- * Creates a lazy Pulsar-inspired messaging hub. Topics are created on first access
845
- * via `hub.topic(name)`; `hub.publish(name, value)` shortcuts through the registry.
846
- *
847
- * @example
848
- * ```ts
849
- * import { messagingHub } from "@graphrefly/graphrefly-ts";
850
- *
851
- * const hub = messagingHub("main", { defaultTopicOptions: { retainedLimit: 256 } });
852
- * hub.publish("orders", { id: 1 });
853
- * hub.publishMany([["shipments", { id: 1 }], ["orders", { id: 2 }]]);
854
- * const sub = hub.subscribe("orders-worker", "orders", { cursor: 0 });
855
- * ```
856
- */
857
- declare function messagingHub(name: string, opts?: MessagingHubOptions): MessagingHubGraph;
858
- /**
859
- * Creates a cursor-based subscription graph over a topic.
860
- */
861
- declare function subscription<T>(name: string, topicGraph: TopicGraph<T>, opts?: SubscriptionOptions): SubscriptionGraph<T>;
862
- /**
863
- * Creates a Pulsar-inspired job queue graph with claim/ack/nack workflow.
864
- */
865
- declare function jobQueue<T>(name: string, opts?: JobQueueOptions): JobQueueGraph<T>;
866
- /**
867
- * Creates an autonomous multi-stage queue chain graph.
868
- */
869
- declare function jobFlow<T>(name: string, opts?: JobFlowOptions): JobFlowGraph<T>;
870
- /**
871
- * Creates an autonomous cursor-based topic relay graph.
872
- */
873
- declare function topicBridge<TIn, TOut = TIn>(name: string, sourceTopic: TopicGraph<TIn>, targetTopic: TopicGraph<TOut>, opts?: TopicBridgeOptions<TIn, TOut>): TopicBridgeGraph<TIn, TOut>;
874
-
875
- type messaging_JobEnvelope<T> = JobEnvelope<T>;
876
- type messaging_JobFlowGraph<T> = JobFlowGraph<T>;
877
- declare const messaging_JobFlowGraph: typeof JobFlowGraph;
878
- type messaging_JobFlowOptions = JobFlowOptions;
879
- type messaging_JobQueueGraph<T> = JobQueueGraph<T>;
880
- declare const messaging_JobQueueGraph: typeof JobQueueGraph;
881
- type messaging_JobQueueOptions = JobQueueOptions;
882
- type messaging_JobState = JobState;
883
- type messaging_MessagingHubGraph = MessagingHubGraph;
884
- declare const messaging_MessagingHubGraph: typeof MessagingHubGraph;
885
- type messaging_MessagingHubOptions = MessagingHubOptions;
886
- type messaging_SubscriptionGraph<T> = SubscriptionGraph<T>;
887
- declare const messaging_SubscriptionGraph: typeof SubscriptionGraph;
888
- type messaging_SubscriptionOptions = SubscriptionOptions;
889
- type messaging_TopicBridgeGraph<TIn, TOut = TIn> = TopicBridgeGraph<TIn, TOut>;
890
- declare const messaging_TopicBridgeGraph: typeof TopicBridgeGraph;
891
- type messaging_TopicBridgeOptions<TIn, TOut> = TopicBridgeOptions<TIn, TOut>;
892
- type messaging_TopicGraph<T> = TopicGraph<T>;
893
- declare const messaging_TopicGraph: typeof TopicGraph;
894
- type messaging_TopicOptions = TopicOptions;
895
- declare const messaging_jobFlow: typeof jobFlow;
896
- declare const messaging_jobQueue: typeof jobQueue;
897
- declare const messaging_messagingHub: typeof messagingHub;
898
- declare const messaging_subscription: typeof subscription;
899
- declare const messaging_topic: typeof topic;
900
- declare const messaging_topicBridge: typeof topicBridge;
901
- declare namespace messaging {
902
- export { type messaging_JobEnvelope as JobEnvelope, messaging_JobFlowGraph as JobFlowGraph, type messaging_JobFlowOptions as JobFlowOptions, messaging_JobQueueGraph as JobQueueGraph, type messaging_JobQueueOptions as JobQueueOptions, type messaging_JobState as JobState, messaging_MessagingHubGraph as MessagingHubGraph, type messaging_MessagingHubOptions as MessagingHubOptions, messaging_SubscriptionGraph as SubscriptionGraph, type messaging_SubscriptionOptions as SubscriptionOptions, messaging_TopicBridgeGraph as TopicBridgeGraph, type messaging_TopicBridgeOptions as TopicBridgeOptions, messaging_TopicGraph as TopicGraph, type messaging_TopicOptions as TopicOptions, messaging_jobFlow as jobFlow, messaging_jobQueue as jobQueue, messaging_messagingHub as messagingHub, messaging_subscription as subscription, messaging_topic as topic, messaging_topicBridge as topicBridge };
903
- }
904
-
905
- /**
906
- * Orchestration patterns (roadmap §4.1).
907
- *
908
- * Domain-layer helpers that build workflow shapes on top of core + extra primitives.
909
- * Exported under the `patterns.orchestration` namespace to avoid collisions with
910
- * Phase 2 operator names (for example `gate`, `forEach`).
911
- */
912
-
913
- type StepRef$1 = string | Node<unknown>;
914
- type OrchestrationMeta = {
915
- orchestration?: true;
916
- orchestration_type?: string;
917
- };
918
- type OrchestrationStepOptions = Omit<NodeOptions<unknown>, "describeKind" | "name" | "meta"> & {
919
- deps?: ReadonlyArray<StepRef$1>;
920
- meta?: Record<string, unknown> & OrchestrationMeta;
921
- };
922
- type BranchResult<T> = {
923
- branch: "then" | "else";
924
- value: T;
925
- };
926
- type SensorControls<T> = {
927
- node: Node<T>;
928
- push(value: T): void;
929
- error(err: unknown): void;
930
- complete(): void;
931
- };
932
- type LoopOptions = Omit<OrchestrationStepOptions, "deps"> & {
933
- iterations?: number | StepRef$1;
934
- };
935
- type WaitOptions = Omit<OrchestrationStepOptions, "deps">;
936
- type SubPipelineBuilder = (sub: Graph) => void;
937
- /**
938
- * Creates an orchestration graph container.
939
- */
940
- declare function pipeline(name: string, opts?: GraphOptions): Graph;
941
- /**
942
- * Registers a workflow task node.
943
- */
944
- declare function task<T>(graph: Graph, name: string, run: DerivedFn<T>, opts?: OrchestrationStepOptions): Node<T>;
945
- /**
946
- * Emits tagged branch outcomes (`then` / `else`) for each source value.
947
- */
948
- declare function branch<T>(graph: Graph, name: string, source: StepRef$1, predicate: (value: T) => boolean, opts?: Omit<OrchestrationStepOptions, "deps">): Node<BranchResult<T>>;
949
- /**
950
- * Forwards source values only while `control` is truthy.
951
- */
952
- declare function valve<T>(graph: Graph, name: string, source: StepRef$1, control: StepRef$1, opts?: Omit<OrchestrationStepOptions, "deps">): Node<T>;
953
- type ApprovalOptions = Omit<OrchestrationStepOptions, "deps"> & {
954
- isApproved?: (value: unknown) => boolean;
955
- };
956
- /**
957
- * Human/LLM approval gate over a source value.
958
- */
959
- declare function approval<T>(graph: Graph, name: string, source: StepRef$1, approver: StepRef$1, opts?: ApprovalOptions): Node<T>;
960
- interface GateOptions {
961
- /** Maximum queue size. Oldest values are FIFO-dropped when exceeded. Default: Infinity. */
962
- maxPending?: number;
963
- /** Start in open mode (auto-approve). Default: false. */
964
- startOpen?: boolean;
965
- meta?: Record<string, unknown>;
966
- }
967
- /** Control surface returned by {@link gate}. */
968
- interface GateController<T> {
969
- /** The output node registered in the graph (subscribe to receive approved values). */
970
- node: Node<T>;
971
- /** Reactive queue of values waiting for approval. */
972
- pending: Node<T[]>;
973
- /** Derived count of pending items. */
974
- count: Node<number>;
975
- /** Whether the gate is currently open (auto-approving). */
976
- isOpen: Node<boolean>;
977
- /** Approve and forward the next `count` pending values (default: 1). */
978
- approve(count?: number): void;
979
- /** Reject (discard) the next `count` pending values (default: 1). */
980
- reject(count?: number): void;
981
- /**
982
- * Transform and forward `count` pending values (default: 1).
983
- * `fn` receives `(value, index, pending)` — Array.map-style.
984
- */
985
- modify(fn: (value: T, index: number, pending: readonly T[]) => T, count?: number): void;
986
- /** Flush all pending values and auto-approve future values. */
987
- open(): void;
988
- /** Re-enable manual gating (stop auto-approving). */
989
- close(): void;
990
- }
991
- /**
992
- * Human-in-the-loop gate: queues incoming values from `source` and lets an external
993
- * controller {@link GateController.approve approve}, {@link GateController.reject reject},
994
- * or {@link GateController.modify modify} them before forwarding downstream.
995
- *
996
- * Observable surfaces (`pending`, `count`, `isOpen`) are reactive nodes registered in
997
- * the graph. The gate output node is also registered.
998
- */
999
- declare function gate<T>(graph: Graph, name: string, source: StepRef$1, opts?: GateOptions): GateController<T>;
1000
- /**
1001
- * Registers a workflow side-effect step that runs `run` for each upstream
1002
- * DATA value.
1003
- *
1004
- * `run` receives the full `NodeActions` and is the **sole emission point** —
1005
- * call `actions.emit(v)` or `actions.down(msgs)` inside `run` to produce
1006
- * downstream output. If `run` does not emit, this step acts as a pure
1007
- * side-effect sink (graph-observable but no output). Throwing inside `run`
1008
- * terminates the step with ERROR.
1009
- */
1010
- declare function forEach<T>(graph: Graph, name: string, source: StepRef$1, run: (value: T, actions: NodeActions) => void, opts?: Omit<OrchestrationStepOptions, "deps">): Node<T>;
1011
- /**
1012
- * Registers a join step that emits a tuple of latest dependency values.
1013
- */
1014
- declare function join<T extends readonly unknown[]>(graph: Graph, name: string, deps: {
1015
- [K in keyof T]: StepRef$1;
1016
- }, opts?: Omit<OrchestrationStepOptions, "deps">): Node<T>;
1017
- /**
1018
- * Registers a loop step that applies `iterate` to each source value N times.
1019
- */
1020
- declare function loop<T>(graph: Graph, name: string, source: StepRef$1, iterate: (value: T, iteration: number, actions: NodeActions) => T, opts?: LoopOptions): Node<T>;
1021
- /**
1022
- * Mounts and returns a child workflow graph.
1023
- */
1024
- declare function subPipeline(graph: Graph, name: string, childOrBuild?: Graph | SubPipelineBuilder, opts?: GraphOptions): Graph;
1025
- /**
1026
- * Registers a producer-style sensor source and returns imperative controls.
1027
- */
1028
- declare function sensor<T>(graph: Graph, name: string, initial?: T, opts?: Omit<NodeOptions<unknown>, "name" | "describeKind" | "meta"> & {
1029
- meta?: Record<string, unknown>;
1030
- }): SensorControls<T>;
1031
- /**
1032
- * Registers a delayed-forwarding step (value-level wait).
1033
- */
1034
- declare function wait<T>(graph: Graph, name: string, source: StepRef$1, ms: number, opts?: WaitOptions): Node<T>;
1035
- /**
1036
- * Registers an error-recovery step for a source.
1037
- */
1038
- declare function onFailure<T>(graph: Graph, name: string, source: StepRef$1, recover: (err: unknown, actions: NodeActions) => T, opts?: Omit<OrchestrationStepOptions, "deps">): Node<T>;
1039
-
1040
- type orchestration_ApprovalOptions = ApprovalOptions;
1041
- type orchestration_BranchResult<T> = BranchResult<T>;
1042
- type orchestration_GateController<T> = GateController<T>;
1043
- type orchestration_GateOptions = GateOptions;
1044
- type orchestration_LoopOptions = LoopOptions;
1045
- type orchestration_OrchestrationStepOptions = OrchestrationStepOptions;
1046
- type orchestration_SensorControls<T> = SensorControls<T>;
1047
- type orchestration_SubPipelineBuilder = SubPipelineBuilder;
1048
- type orchestration_WaitOptions = WaitOptions;
1049
- declare const orchestration_approval: typeof approval;
1050
- declare const orchestration_branch: typeof branch;
1051
- declare const orchestration_forEach: typeof forEach;
1052
- declare const orchestration_gate: typeof gate;
1053
- declare const orchestration_join: typeof join;
1054
- declare const orchestration_loop: typeof loop;
1055
- declare const orchestration_onFailure: typeof onFailure;
1056
- declare const orchestration_pipeline: typeof pipeline;
1057
- declare const orchestration_sensor: typeof sensor;
1058
- declare const orchestration_subPipeline: typeof subPipeline;
1059
- declare const orchestration_task: typeof task;
1060
- declare const orchestration_valve: typeof valve;
1061
- declare const orchestration_wait: typeof wait;
1062
- declare namespace orchestration {
1063
- export { type orchestration_ApprovalOptions as ApprovalOptions, type orchestration_BranchResult as BranchResult, type orchestration_GateController as GateController, type orchestration_GateOptions as GateOptions, type orchestration_LoopOptions as LoopOptions, type orchestration_OrchestrationStepOptions as OrchestrationStepOptions, type orchestration_SensorControls as SensorControls, type StepRef$1 as StepRef, type orchestration_SubPipelineBuilder as SubPipelineBuilder, type orchestration_WaitOptions as WaitOptions, orchestration_approval as approval, orchestration_branch as branch, orchestration_forEach as forEach, orchestration_gate as gate, orchestration_join as join, orchestration_loop as loop, orchestration_onFailure as onFailure, orchestration_pipeline as pipeline, orchestration_sensor as sensor, orchestration_subPipeline as subPipeline, orchestration_task as task, orchestration_valve as valve, orchestration_wait as wait };
1064
- }
1065
-
1066
- /**
1067
- * AI surface patterns (roadmap §4.4).
1068
- *
1069
- * Domain-layer factories for LLM-backed agents, chat, tool registries, and
1070
- * agentic memory. Composed from core + extra + Phase 3–4.3 primitives.
1071
- */
1072
-
1073
- /** A single chat message in a conversation. */
1074
- type ChatMessage = {
1075
- readonly role: "system" | "user" | "assistant" | "tool";
1076
- readonly content: string;
1077
- readonly name?: string;
1078
- readonly toolCallId?: string;
1079
- readonly toolCalls?: readonly ToolCall[];
1080
- readonly metadata?: Record<string, unknown>;
1081
- };
1082
- /** A tool invocation request from an LLM. */
1083
- type ToolCall = {
1084
- readonly id: string;
1085
- readonly name: string;
1086
- readonly arguments: Record<string, unknown>;
1087
- };
1088
- /** The response from an LLM invocation. */
1089
- type LLMResponse = {
1090
- readonly content: string;
1091
- readonly toolCalls?: readonly ToolCall[];
1092
- readonly usage?: {
1093
- readonly inputTokens: number;
1094
- readonly outputTokens: number;
1095
- };
1096
- readonly finishReason?: string;
1097
- readonly metadata?: Record<string, unknown>;
1098
- };
1099
- /** Provider-agnostic LLM client adapter protocol. */
1100
- type LLMAdapter = {
1101
- invoke(messages: readonly ChatMessage[], opts?: LLMInvokeOptions): NodeInput<LLMResponse>;
1102
- stream(messages: readonly ChatMessage[], opts?: LLMInvokeOptions): AsyncIterable<string>;
1103
- };
1104
- type LLMInvokeOptions = {
1105
- model?: string;
1106
- temperature?: number;
1107
- maxTokens?: number;
1108
- tools?: readonly ToolDefinition[];
1109
- systemPrompt?: string;
1110
- signal?: AbortSignal;
1111
- };
1112
- /** A tool definition for LLM consumption. */
1113
- type ToolDefinition = {
1114
- readonly name: string;
1115
- readonly description: string;
1116
- readonly parameters: Record<string, unknown>;
1117
- readonly handler: (args: Record<string, unknown>) => NodeInput<unknown>;
1118
- /**
1119
- * V0 version of the backing node at `knobsAsTools()` call time (§6.0b).
1120
- * Snapshot — re-call `knobsAsTools()` to refresh.
1121
- */
1122
- readonly version?: {
1123
- id: string;
1124
- version: number;
1125
- };
1126
- };
1127
- type AgentLoopStatus = "idle" | "thinking" | "acting" | "done" | "error";
1128
- /**
1129
- * A single chunk from any streaming source (LLM tokens, WebSocket, SSE, file tail).
1130
- * Generic enough for any streaming source, not just LLM.
1131
- */
1132
- type StreamChunk = {
1133
- /** Identifier for the stream source (adapter name, URL, etc.). */
1134
- readonly source: string;
1135
- /** This chunk's content. */
1136
- readonly token: string;
1137
- /** Full accumulated text so far. */
1138
- readonly accumulated: string;
1139
- /** 0-based chunk counter. */
1140
- readonly index: number;
1141
- };
1142
- type FromLLMOptions = {
1143
- name?: string;
1144
- model?: string;
1145
- temperature?: number;
1146
- maxTokens?: number;
1147
- tools?: readonly ToolDefinition[];
1148
- systemPrompt?: string;
1149
- };
1150
- /**
1151
- * Reactive LLM invocation adapter. Returns a derived node that re-invokes
1152
- * the LLM whenever the messages dep changes.
1153
- *
1154
- * Uses `switchMap` internally — new invocations cancel stale in-flight ones.
1155
- */
1156
- declare function fromLLM(adapter: LLMAdapter, messages: NodeInput<readonly ChatMessage[]>, opts?: FromLLMOptions): Node<LLMResponse | null>;
1157
- type StreamingPromptNodeOptions = {
1158
- name?: string;
1159
- model?: string;
1160
- temperature?: number;
1161
- maxTokens?: number;
1162
- /** Output format — `"json"` attempts JSON.parse on the final accumulated text. Default: `"text"`. */
1163
- format?: "text" | "json";
1164
- systemPrompt?: string;
1165
- };
1166
- /**
1167
- * Bundle returned by {@link streamingPromptNode}.
1168
- */
1169
- type StreamingPromptNodeHandle<T> = {
1170
- /** Final parsed result (emits once per invocation, after stream completes). */
1171
- output: Node<T | null>;
1172
- /** Live stream topic — subscribe to `stream.latest` or `stream.events` for chunks. */
1173
- stream: TopicGraph<StreamChunk>;
1174
- /** Tear down the keepalive subscription and release resources. */
1175
- dispose: () => void;
1176
- };
1177
- /**
1178
- * Streaming LLM transform: wraps a prompt template + adapter into a reactive
1179
- * streaming pipeline. Re-invokes the LLM whenever any dep changes; the
1180
- * previous in-flight stream is canceled automatically via `switchMap`.
1181
- *
1182
- * Each token chunk is published to a {@link TopicGraph} as a {@link StreamChunk}.
1183
- * Extractors can mount on the topic independently (see {@link streamExtractor}).
1184
- * Zero overhead if nobody subscribes to the stream topic.
1185
- *
1186
- * The `output` node emits the final parsed result (like {@link promptNode}).
1187
- * The async boundary is handled by `fromAny` (spec §5.10 compliant).
1188
- */
1189
- declare function streamingPromptNode<T = string>(adapter: LLMAdapter, deps: readonly Node<unknown>[], prompt: string | ((...depValues: unknown[]) => string), opts?: StreamingPromptNodeOptions): StreamingPromptNodeHandle<T>;
1190
- /**
1191
- * Mounts an extractor function on a streaming topic. Returns a derived node
1192
- * that emits extracted values as chunks arrive.
1193
- *
1194
- * `extractFn` receives the accumulated text from the latest chunk and returns
1195
- * the extracted value, or `null` if nothing detected yet. This is the building
1196
- * block for keyword flags, tool call detection, cost metering, etc.
1197
- *
1198
- * @param streamTopic - The stream topic to extract from.
1199
- * @param extractFn - `(accumulated: string) => T | null`.
1200
- * @param opts - Optional name.
1201
- * @returns Derived node emitting extracted values.
1202
- */
1203
- declare function streamExtractor<T>(streamTopic: TopicGraph<StreamChunk>, extractFn: (accumulated: string) => T | null, opts?: {
1204
- name?: string;
1205
- /**
1206
- * Optional structural equals for the extractor output. When two
1207
- * consecutive chunks produce structurally-equal outputs, the framework
1208
- * emits `RESOLVED` instead of `DATA`, saving downstream work. Default:
1209
- * reference equality (`Object.is`). The library cannot know your
1210
- * output shape — supply this when your `extractFn` returns structured
1211
- * objects or arrays.
1212
- */
1213
- equals?: (a: T | null, b: T | null) => boolean;
1214
- }): Node<T | null>;
1215
- /** A keyword match detected in the stream. */
1216
- type KeywordFlag = {
1217
- readonly label: string;
1218
- readonly pattern: RegExp;
1219
- readonly match: string;
1220
- readonly position: number;
1221
- };
1222
- type KeywordFlagExtractorOptions = {
1223
- patterns: readonly {
1224
- pattern: RegExp;
1225
- label: string;
1226
- }[];
1227
- name?: string;
1228
- /**
1229
- * Maximum length of any pattern's literal text. Used as an overlap window
1230
- * when cursoring through the accumulated stream so matches that span
1231
- * chunk boundaries aren't missed. Default: 128.
1232
- */
1233
- maxPatternLength?: number;
1234
- };
1235
- /**
1236
- * Mounts a keyword-flag extractor on a streaming topic. Scans accumulated text
1237
- * for all configured patterns and emits an array of matches.
1238
- *
1239
- * Use cases: design invariant violations (`setTimeout`, `EventEmitter`), PII
1240
- * detection (SSN, email, phone), toxicity keywords, off-track reasoning.
1241
- *
1242
- * **Streaming optimization.** Maintains a cursor across chunks in `ctx.store`
1243
- * so each chunk scans only the delta region `accumulated.slice(scannedTo -
1244
- * maxPatternLength)` — not the full string. Default structural equals
1245
- * suppresses DATA emission when no new flags were found this chunk.
1246
- */
1247
- declare function keywordFlagExtractor(streamTopic: TopicGraph<StreamChunk>, opts: KeywordFlagExtractorOptions): Node<readonly KeywordFlag[]>;
1248
- /** A tool call detected in the stream. */
1249
- type ExtractedToolCall = {
1250
- readonly name: string;
1251
- readonly arguments: Record<string, unknown>;
1252
- readonly raw: string;
1253
- readonly startIndex: number;
1254
- };
1255
- /**
1256
- * Mounts a tool-call extractor on a streaming topic. Scans accumulated text
1257
- * for complete JSON objects containing `"name"` and `"arguments"` keys (the
1258
- * standard tool_call shape). Partial JSON is ignored until the closing brace.
1259
- *
1260
- * Feeds into the tool interception chain for reactive tool gating mid-stream.
1261
- *
1262
- * **Streaming optimization.** Maintains a cursor (`scanFrom`) in `ctx.store`
1263
- * so each chunk resumes brace-scanning from the position after the last
1264
- * complete parse (or the last incomplete open brace). Already-parsed objects
1265
- * are not re-parsed. Default structural equals suppresses DATA emission when
1266
- * no new tool call completed this chunk.
1267
- */
1268
- declare function toolCallExtractor(streamTopic: TopicGraph<StreamChunk>, opts?: {
1269
- name?: string;
1270
- }): Node<readonly ExtractedToolCall[]>;
1271
- /** A cost meter reading from the stream. */
1272
- type CostMeterReading = {
1273
- readonly chunkCount: number;
1274
- readonly charCount: number;
1275
- readonly estimatedTokens: number;
1276
- };
1277
- type CostMeterOptions = {
1278
- /** Characters per token approximation. Default: 4 (GPT-family). */
1279
- charsPerToken?: number;
1280
- name?: string;
1281
- };
1282
- /**
1283
- * Mounts a cost meter on a streaming topic. Counts chunks, characters, and
1284
- * estimates token count. Compose with `budgetGate` for hard-stop when LLM
1285
- * output exceeds budget mid-generation.
1286
- *
1287
- * Default structural equals suppresses DATA emission when two consecutive
1288
- * readings are identical (same chunk count + char count + token estimate).
1289
- */
1290
- declare function costMeterExtractor(streamTopic: TopicGraph<StreamChunk>, opts?: CostMeterOptions): Node<CostMeterReading>;
1291
- /** Options for {@link redactor}. */
1292
- type RedactorOptions = {
1293
- name?: string;
1294
- };
1295
- /**
1296
- * Stream extractor that replaces matched patterns in the accumulated text.
1297
- *
1298
- * Returns a derived node emitting a sanitized `StreamChunk` on every chunk:
1299
- * `accumulated` and `token` have matched substrings replaced by `replaceFn`.
1300
- * The default `replaceFn` replaces with `"[REDACTED]"`.
1301
- *
1302
- * Compose with `contentGate` for in-flight safety pipelines.
1303
- *
1304
- * @param streamTopic - Streaming topic to monitor.
1305
- * @param patterns - Array of RegExps to match against accumulated text.
1306
- * @param replaceFn - Replacement producer (default: always `"[REDACTED]"`).
1307
- */
1308
- declare function redactor(streamTopic: TopicGraph<StreamChunk>, patterns: RegExp[], replaceFn?: (match: string, pattern: RegExp) => string, opts?: RedactorOptions): Node<StreamChunk>;
1309
- /** Content safety decision. */
1310
- type ContentDecision = "allow" | "block" | "review";
1311
- /** Options for {@link contentGate}. */
1312
- type ContentGateOptions = {
1313
- /**
1314
- * Hard-block threshold multiplier (default 1.5).
1315
- * Scores above `threshold * hardMultiplier` emit `"block"`.
1316
- * Scores between `threshold` and that emit `"review"`.
1317
- */
1318
- hardMultiplier?: number;
1319
- name?: string;
1320
- };
1321
- /**
1322
- * Derived node that classifies accumulated stream text as `"allow"`,
1323
- * `"review"`, or `"block"` based on a classifier score.
1324
- *
1325
- * Emits a three-way decision on every new chunk:
1326
- * - `"allow"` — score below `threshold`
1327
- * - `"review"` — score in `[threshold, threshold × hardMultiplier)`
1328
- * - `"block"` — score at or above `threshold × hardMultiplier`
1329
- *
1330
- * Wire the output into a `valve` (automatic) or `gate` (human approval).
1331
- * This node does not itself control flow — it just classifies.
1332
- *
1333
- * @param streamTopic - Streaming topic to classify.
1334
- * @param classifier - `(accumulated: string) => number` scoring function, or
1335
- * a `Node<number>` for live scores.
1336
- * @param threshold - Score at which output becomes "review" or "block".
1337
- */
1338
- declare function contentGate(streamTopic: TopicGraph<StreamChunk>, classifier: ((accumulated: string) => number) | Node<number>, threshold: number, opts?: ContentGateOptions): Node<ContentDecision>;
1339
- type GatedStreamOptions = StreamingPromptNodeOptions & {
1340
- /** Gate options (maxPending, startOpen). */
1341
- gate?: Omit<GateOptions, "meta">;
1342
- };
1343
- /**
1344
- * Bundle returned by {@link gatedStream}.
1345
- */
1346
- type GatedStreamHandle<T> = {
1347
- /** Final parsed result (after gate approval). */
1348
- output: Node<T | null>;
1349
- /** Live stream topic — subscribe to `stream.latest` for chunks. */
1350
- stream: TopicGraph<StreamChunk>;
1351
- /** Gate controller — approve, reject (aborts in-flight stream), modify. */
1352
- gate: GateController<T | null>;
1353
- /** Tear down everything. */
1354
- dispose: () => void;
1355
- };
1356
- /**
1357
- * Streaming LLM transform with human-in-the-loop gate integration.
1358
- *
1359
- * Composes {@link streamingPromptNode} with {@link gate} so that:
1360
- * - `gate.reject()` discards the pending value **and** aborts the in-flight
1361
- * stream (cancels the `AbortController`).
1362
- * - `gate.modify()` transforms the pending value before forwarding downstream.
1363
- * - `gate.approve()` forwards the final result as normal.
1364
- *
1365
- * The abort-on-reject works by toggling an internal cancel signal that causes
1366
- * the `switchMap` inside `streamingPromptNode` to restart with an empty message
1367
- * list, which triggers the `AbortController.abort()` in the async generator's
1368
- * `finally` block.
1369
- */
1370
- declare function gatedStream<T = string>(graph: Graph, name: string, adapter: LLMAdapter, deps: readonly Node<unknown>[], prompt: string | ((...depValues: unknown[]) => string), opts?: GatedStreamOptions): GatedStreamHandle<T>;
1371
- type PromptNodeOptions = {
1372
- name?: string;
1373
- model?: string;
1374
- temperature?: number;
1375
- maxTokens?: number;
1376
- /** Output format — `"json"` attempts JSON.parse on the response. Default: `"text"`. */
1377
- format?: "text" | "json";
1378
- /** Number of retries on transient errors. Default: 0. */
1379
- retries?: number;
1380
- /** Cache LLM responses for identical inputs. Default: false. */
1381
- cache?: boolean;
1382
- systemPrompt?: string;
1383
- meta?: Record<string, unknown>;
1384
- };
1385
- /**
1386
- * Universal LLM transform: wraps a prompt template + model adapter into a reactive derived node.
1387
- * Re-invokes the LLM whenever any dep changes. Suitable for triage, QA, hypothesis, parity, etc.
1388
- *
1389
- * @param adapter - LLM adapter (provider-agnostic).
1390
- * @param deps - Input nodes whose values feed the prompt.
1391
- * @param prompt - Static string or template function receiving dep values.
1392
- * @param opts - Optional configuration.
1393
- * @returns `Node` emitting LLM responses (string or parsed JSON).
1394
- */
1395
- declare function promptNode<T = string>(adapter: LLMAdapter, deps: readonly Node<unknown>[], prompt: string | ((...depValues: unknown[]) => string), opts?: PromptNodeOptions): Node<T | null>;
1396
- type ChatStreamOptions = {
1397
- graph?: GraphOptions;
1398
- maxMessages?: number;
1399
- };
1400
- declare class ChatStreamGraph extends Graph {
1401
- private readonly _log;
1402
- readonly messages: Node<readonly ChatMessage[]>;
1403
- readonly latest: Node<ChatMessage | null>;
1404
- readonly messageCount: Node<number>;
1405
- constructor(name: string, opts?: ChatStreamOptions);
1406
- append(role: ChatMessage["role"], content: string, extra?: Partial<ChatMessage>): void;
1407
- appendToolResult(callId: string, content: string): void;
1408
- clear(): void;
1409
- allMessages(): readonly ChatMessage[];
1410
- }
1411
- declare function chatStream(name: string, opts?: ChatStreamOptions): ChatStreamGraph;
1412
- type ToolRegistryOptions = {
1413
- graph?: GraphOptions;
1414
- };
1415
- declare class ToolRegistryGraph extends Graph {
1416
- readonly definitions: Node<ReadonlyMap<string, ToolDefinition>>;
1417
- readonly schemas: Node<readonly ToolDefinition[]>;
1418
- constructor(name: string, opts?: ToolRegistryOptions);
1419
- register(tool: ToolDefinition): void;
1420
- unregister(name: string): void;
1421
- execute(name: string, args: Record<string, unknown>): Promise<unknown>;
1422
- getDefinition(name: string): ToolDefinition | undefined;
1423
- }
1424
- declare function toolRegistry(name: string, opts?: ToolRegistryOptions): ToolRegistryGraph;
1425
- /**
1426
- * Assembles a system prompt from reactive sections. Each section is a
1427
- * `NodeInput<string>` — the prompt updates when any section changes.
1428
- */
1429
- type SystemPromptHandle = Node<string> & {
1430
- dispose: () => void;
1431
- };
1432
- declare function systemPromptBuilder(sections: readonly NodeInput<string>[], opts?: {
1433
- separator?: string;
1434
- name?: string;
1435
- }): SystemPromptHandle;
1436
- type LLMExtractorOptions = {
1437
- adapter: LLMAdapter;
1438
- model?: string;
1439
- temperature?: number;
1440
- maxTokens?: number;
1441
- };
1442
- /**
1443
- * Returns an `extractFn` callback for `distill()` that invokes an LLM to
1444
- * extract structured memories from raw input.
1445
- *
1446
- * The system prompt should instruct the LLM to return JSON matching
1447
- * `Extraction<TMem>` shape: `{ upsert: [{ key, value }], remove?: [key] }`.
1448
- */
1449
- declare function llmExtractor<TRaw, TMem>(systemPrompt: string, opts: LLMExtractorOptions): (raw: TRaw, existing: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
1450
- type LLMConsolidatorOptions = LLMExtractorOptions;
1451
- /**
1452
- * Returns a `consolidateFn` callback for `distill()` that invokes an LLM to
1453
- * cluster and merge related memories.
1454
- */
1455
- declare function llmConsolidator<TMem>(systemPrompt: string, opts: LLMConsolidatorOptions): (entries: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
1456
- /** Scores for the three admission dimensions. Each 0–1. */
1457
- type AdmissionScores = {
1458
- readonly persistence: number;
1459
- readonly structure: number;
1460
- readonly personalValue: number;
1461
- };
1462
- type AdmissionScore3DOptions = {
1463
- /** Custom scoring function. Default: rule-based (all dimensions 0.5). */
1464
- scoreFn?: (raw: unknown) => AdmissionScores;
1465
- /** Minimum persistence score to admit (default 0.3). */
1466
- persistenceThreshold?: number;
1467
- /** Minimum personalValue score to admit (default 0.3). */
1468
- personalValueThreshold?: number;
1469
- /** Require structure score > 0 to admit (default false). */
1470
- requireStructured?: boolean;
1471
- };
1472
- /**
1473
- * Creates a 3D admission filter function compatible with `agentMemory`'s
1474
- * `admissionFilter` option. Scores each candidate on persistence, structure,
1475
- * and personalValue, then applies thresholds.
1476
- */
1477
- declare function admissionFilter3D(opts?: AdmissionScore3DOptions): (raw: unknown) => boolean;
1478
- type MemoryTier = "permanent" | "active" | "archived";
1479
- type MemoryTiersOptions<TMem> = {
1480
- /** Exponential decay rate per second for active tier.
1481
- * Default: 7-day half-life ≈ ln(2)/(7×86400) ≈ 0.00000114. */
1482
- decayRate?: number;
1483
- /** Max entries in the active tier before archiving lowest-scored (default 1000). */
1484
- maxActive?: number;
1485
- /** Score threshold below which active entries get archived (default 0.1). */
1486
- archiveThreshold?: number;
1487
- /** Predicate: true → entry belongs in permanent tier (default: never). */
1488
- permanentFilter?: (key: string, mem: TMem) => boolean;
1489
- /** Storage tier for the archive. Omit to disable archiving. */
1490
- archiveTier?: StorageTier;
1491
- /** Options forwarded to `graph.attachStorage` for the archive tier. */
1492
- archiveStorageOptions?: GraphAttachStorageOptions;
1493
- };
1494
- type MemoryTiersBundle<TMem> = {
1495
- /** Permanent tier: never evicted. */
1496
- readonly permanent: LightCollectionBundle<TMem>;
1497
- /** Active entries node (reactive, holds ReadonlyMap). */
1498
- readonly activeEntries: Node<unknown>;
1499
- /** Archive storage handle (null if no tier configured). */
1500
- readonly archiveHandle: StorageHandle | null;
1501
- /** Classify a key into its current tier. */
1502
- tierOf: (key: string) => MemoryTier;
1503
- /** Move a key to the permanent tier. */
1504
- markPermanent: (key: string, value: TMem) => void;
1505
- };
1506
- type RetrievalQuery = {
1507
- readonly text?: string;
1508
- readonly vector?: readonly number[];
1509
- readonly entityIds?: readonly string[];
1510
- };
1511
- type RetrievalPipelineOptions<TMem> = {
1512
- /** Max candidates from vector search (default 20). */
1513
- topK?: number;
1514
- /** KG expansion depth in hops (default 1). */
1515
- graphDepth?: number;
1516
- /** Token budget for final packing (default 2000). */
1517
- budget?: number;
1518
- /** Cost function for budget packing. */
1519
- cost: (mem: TMem) => number;
1520
- /** Score function for ranking. */
1521
- score: (mem: TMem, context: unknown) => number;
1522
- };
1523
- /** A single entry in the retrieval result, with causal trace metadata. */
1524
- type RetrievalEntry<TMem> = {
1525
- readonly key: string;
1526
- readonly value: TMem;
1527
- readonly score: number;
1528
- readonly sources: ReadonlyArray<"vector" | "graph" | "store">;
1529
- };
1530
- /** Causal trace for a retrieval run. */
1531
- type RetrievalTrace<TMem> = {
1532
- readonly vectorCandidates: ReadonlyArray<VectorSearchResult<TMem>>;
1533
- readonly graphExpanded: ReadonlyArray<string>;
1534
- readonly ranked: ReadonlyArray<RetrievalEntry<TMem>>;
1535
- readonly packed: ReadonlyArray<RetrievalEntry<TMem>>;
1536
- };
1537
- type AgentMemoryOptions<TMem = unknown> = {
1538
- graph?: GraphOptions;
1539
- /** LLM adapter for extraction and consolidation. */
1540
- adapter?: LLMAdapter;
1541
- /** System prompt for the extractor LLM. */
1542
- extractPrompt?: string;
1543
- /** Custom extractFn (overrides adapter + extractPrompt). */
1544
- extractFn?: (raw: unknown, existing: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
1545
- /** System prompt for the consolidation LLM. */
1546
- consolidatePrompt?: string;
1547
- /** Custom consolidateFn (overrides adapter + consolidatePrompt). */
1548
- consolidateFn?: (entries: ReadonlyMap<string, TMem>) => NodeInput<Extraction<TMem>>;
1549
- /** Reactive trigger for consolidation (caller supplies e.g. `fromTimer`). */
1550
- consolidateTrigger?: NodeInput<unknown>;
1551
- /** Score function for budget packing (required). */
1552
- score: (mem: TMem, context: unknown) => number;
1553
- /** Cost function for budget packing (required). */
1554
- cost: (mem: TMem) => number;
1555
- /** Token budget for compact view (default 2000). */
1556
- budget?: number;
1557
- /** Context node for scoring. */
1558
- context?: NodeInput<unknown>;
1559
- /** Admission filter (default: admit all). */
1560
- admissionFilter?: (candidate: unknown) => boolean;
1561
- /** Vector index dimensions (> 0 enables vector index for retrieval). */
1562
- vectorDimensions?: number;
1563
- /** Extract embedding vector from a memory entry (enables vector index). */
1564
- embedFn?: (mem: TMem) => readonly number[] | undefined;
1565
- /** Enable knowledge graph for entity/relation tracking. */
1566
- enableKnowledgeGraph?: boolean;
1567
- /** Extract entities and relations from a memory entry. */
1568
- entityFn?: (key: string, mem: TMem) => {
1569
- entities?: Array<{
1570
- id: string;
1571
- value: unknown;
1572
- }>;
1573
- relations?: Array<{
1574
- from: string;
1575
- to: string;
1576
- relation: string;
1577
- weight?: number;
1578
- }>;
1579
- } | undefined;
1580
- /** 3-tier storage configuration. Omit to use single-tier (existing behavior). */
1581
- tiers?: MemoryTiersOptions<TMem>;
1582
- /** Retrieval pipeline configuration. Requires vector index or knowledge graph. */
1583
- retrieval?: {
1584
- /** Max candidates from vector search (default 20). */
1585
- topK?: number;
1586
- /** KG expansion depth in hops (default 1). */
1587
- graphDepth?: number;
1588
- };
1589
- /** Periodic reflection/consolidation configuration. */
1590
- reflection?: {
1591
- /** Interval in ms between consolidation runs (default 300_000 = 5 min). */
1592
- interval?: number;
1593
- /** Enable/disable periodic reflection (default true when consolidateFn is available). */
1594
- enabled?: boolean;
1595
- };
1596
- };
1597
- type AgentMemoryGraph<TMem = unknown> = Graph & {
1598
- readonly distillBundle: DistillBundle<TMem>;
1599
- readonly compact: Node<Array<{
1600
- key: string;
1601
- value: TMem;
1602
- score: number;
1603
- }>>;
1604
- readonly size: Node<number>;
1605
- /** Vector index bundle (null if not enabled). */
1606
- readonly vectors: VectorIndexBundle<TMem> | null;
1607
- /** Knowledge graph (null if not enabled). */
1608
- readonly kg: KnowledgeGraphGraph<unknown, string> | null;
1609
- /** Memory tiers bundle (null if not configured). */
1610
- readonly memoryTiers: MemoryTiersBundle<TMem> | null;
1611
- /** Retrieval result node (null if no retrieval pipeline configured). */
1612
- readonly retrieval: Node<ReadonlyArray<RetrievalEntry<TMem>>> | null;
1613
- /** Latest retrieval trace for observability (null if no retrieval pipeline). */
1614
- readonly retrievalTrace: Node<RetrievalTrace<TMem> | null> | null;
1615
- /**
1616
- * Execute a retrieval query (null if no retrieval pipeline).
1617
- *
1618
- * **Synchronous consumer API** — returns the result immediately and batch-writes
1619
- * `retrieval` and `retrievalTrace` state nodes for observers. Reads the store
1620
- * snapshot and context value **at call time** (external-boundary read).
1621
- *
1622
- * **Do not call from inside a reactive fn body** (derived fn, subscribe callback,
1623
- * effect body). The cache reads would become transitive protocol violations and
1624
- * may observe wave-progressive rather than wave-final state.
1625
- *
1626
- * **Caller-batch caveat:** if invoked inside a caller's `batch(() => ...)` alongside
1627
- * upstream store mutations, the store snapshot reflects what has been committed to
1628
- * `store.entries.cache` at call time. State-backed stores update cache synchronously
1629
- * so batched inserts are visible; derived-backed store transforms may defer. If you
1630
- * need fresh state after batched mutations, call `retrieve` after the batch returns.
1631
- */
1632
- readonly retrieve: ((query: RetrievalQuery) => ReadonlyArray<RetrievalEntry<TMem>>) | null;
1633
- };
1634
- declare function agentMemory<TMem = unknown>(name: string, source: NodeInput<unknown>, opts: AgentMemoryOptions<TMem>): AgentMemoryGraph<TMem>;
1635
- type AgentLoopOptions = {
1636
- graph?: GraphOptions;
1637
- adapter: LLMAdapter;
1638
- tools?: readonly ToolDefinition[];
1639
- systemPrompt?: string;
1640
- maxTurns?: number;
1641
- stopWhen?: (response: LLMResponse) => boolean;
1642
- onToolCall?: (call: ToolCall) => void;
1643
- maxMessages?: number;
1644
- model?: string;
1645
- temperature?: number;
1646
- maxTokens?: number;
1647
- };
1648
- declare class AgentLoopGraph extends Graph {
1649
- readonly chat: ChatStreamGraph;
1650
- readonly tools: ToolRegistryGraph;
1651
- readonly status: Node<AgentLoopStatus>;
1652
- readonly turnCount: Node<number>;
1653
- readonly lastResponse: Node<LLMResponse | null>;
1654
- private readonly _statusState;
1655
- private readonly _turnCountState;
1656
- private readonly _adapter;
1657
- private readonly _maxTurns;
1658
- private readonly _stopWhen?;
1659
- private readonly _onToolCall?;
1660
- private readonly _systemPrompt?;
1661
- private readonly _model?;
1662
- private readonly _temperature?;
1663
- private readonly _maxTokens?;
1664
- private _running;
1665
- private _abortController;
1666
- constructor(name: string, opts: AgentLoopOptions);
1667
- /**
1668
- * Start the agent loop with a user message. The loop runs reactively:
1669
- * think (LLM call) → act (tool execution) → repeat until done.
1670
- *
1671
- * Messages accumulate across calls. Call `chat.clear()` before `run()`
1672
- * to reset conversation history.
1673
- */
1674
- run(userMessage: string): Promise<LLMResponse | null>;
1675
- private _invokeLLM;
1676
- private _shouldStop;
1677
- destroy(): void;
1678
- }
1679
- declare function agentLoop(name: string, opts: AgentLoopOptions): AgentLoopGraph;
1680
- /** OpenAI function-calling tool schema. */
1681
- type OpenAIToolSchema = {
1682
- readonly type: "function";
1683
- readonly function: {
1684
- readonly name: string;
1685
- readonly description: string;
1686
- readonly parameters: Record<string, unknown>;
1687
- };
1688
- };
1689
- /** MCP (Model Context Protocol) tool schema. */
1690
- type McpToolSchema = {
1691
- readonly name: string;
1692
- readonly description: string;
1693
- readonly inputSchema: Record<string, unknown>;
1694
- };
1695
- /** Result of {@link knobsAsTools}. */
1696
- type KnobsAsToolsResult = {
1697
- /** OpenAI function-calling tool schemas. */
1698
- readonly openai: readonly OpenAIToolSchema[];
1699
- /** MCP tool schemas. */
1700
- readonly mcp: readonly McpToolSchema[];
1701
- /** GraphReFly ToolDefinitions with handlers that call `graph.set()`. */
1702
- readonly definitions: readonly ToolDefinition[];
1703
- };
1704
- /**
1705
- * Derive tool schemas from a graph's writable (knob) nodes.
1706
- *
1707
- * Knobs are state nodes whose `meta.access` is `"llm"`, `"both"`, or absent
1708
- * (default: writable). Each knob becomes a tool that calls `graph.set()`.
1709
- *
1710
- * Speaks **domain language** (spec §5.4): the returned schemas use node names
1711
- * and meta descriptions — no protocol internals exposed.
1712
- *
1713
- * @param graph - The graph to introspect.
1714
- * @param actor - Optional actor for guard-scoped describe.
1715
- * @returns OpenAI, MCP, and GraphReFly tool schemas.
1716
- */
1717
- declare function knobsAsTools(graph: Graph, actor?: Actor): KnobsAsToolsResult;
1718
- type GaugesAsContextOptions = {
1719
- /** Group gauges by `meta.tags` (default true). */
1720
- groupByTags?: boolean;
1721
- /** Separator between gauge lines (default "\n"). */
1722
- separator?: string;
1723
- /**
1724
- * V0 delta mode (§6.0b): only include nodes whose `v.version` exceeds
1725
- * the corresponding entry in this map. Nodes without V0 or not in the
1726
- * map are always included. Callers maintain this map across calls.
1727
- *
1728
- * The `id` field guards against node replacement: if a node is removed
1729
- * and re-added under the same name (new id), it is always included.
1730
- */
1731
- sinceVersion?: ReadonlyMap<string, {
1732
- id: string;
1733
- version: number;
1734
- }>;
1735
- };
1736
- /**
1737
- * Format a graph's readable (gauge) nodes as a context string for LLM
1738
- * system prompts.
1739
- *
1740
- * Gauges are nodes with `meta.description` or `meta.format`. Values are
1741
- * formatted using `meta.format` and `meta.unit` hints.
1742
- *
1743
- * @param graph - The graph to introspect.
1744
- * @param actor - Optional actor for guard-scoped describe.
1745
- * @param options - Formatting options.
1746
- * @returns A formatted string ready for system prompt injection.
1747
- */
1748
- declare function gaugesAsContext(graph: Graph, actor?: Actor, options?: GaugesAsContextOptions): string;
1749
- /** Validation result from {@link validateGraphDef}. */
1750
- type GraphDefValidation = {
1751
- readonly valid: boolean;
1752
- readonly errors: readonly string[];
1753
- };
1754
- /**
1755
- * Validate an LLM-generated graph definition before passing to
1756
- * `Graph.fromSnapshot()`.
1757
- *
1758
- * Checks:
1759
- * - Required fields: `name`, `nodes`, `edges`
1760
- * - Node types are valid enum values
1761
- * - Edge `from`/`to` reference existing nodes
1762
- * - No duplicate edge entries
1763
- *
1764
- * @param def - The graph definition to validate (parsed JSON).
1765
- * @returns Validation result with errors array.
1766
- */
1767
- declare function validateGraphDef(def: unknown): GraphDefValidation;
1768
- type GraphFromSpecOptions = {
1769
- model?: string;
1770
- temperature?: number;
1771
- maxTokens?: number;
1772
- /** Callback to construct topology before values are applied (passed to `Graph.fromSnapshot`). */
1773
- build?: (g: Graph) => void;
1774
- /** Extra instructions appended to the system prompt. */
1775
- systemPromptExtra?: string;
1776
- };
1777
- /**
1778
- * Ask an LLM to compose a Graph from a natural-language description.
1779
- *
1780
- * The LLM returns a JSON graph definition which is validated and then
1781
- * constructed via `Graph.fromSnapshot()`.
1782
- *
1783
- * @param naturalLanguage - The problem/use-case description.
1784
- * @param adapter - LLM adapter for the generation call.
1785
- * @param opts - Model options and optional `build` callback for node factories.
1786
- * @returns A constructed Graph.
1787
- * @throws On invalid LLM output or validation failure.
1788
- */
1789
- declare function graphFromSpec(naturalLanguage: string, adapter: LLMAdapter, opts?: GraphFromSpecOptions): Promise<Graph>;
1790
- /** A single operation in a strategy plan. */
1791
- type StrategyOperation = {
1792
- readonly type: "add_node";
1793
- readonly name: string;
1794
- readonly nodeType: string;
1795
- readonly meta?: Record<string, unknown>;
1796
- readonly initial?: unknown;
1797
- } | {
1798
- readonly type: "remove_node";
1799
- readonly name: string;
1800
- } | {
1801
- readonly type: "connect";
1802
- readonly from: string;
1803
- readonly to: string;
1804
- } | {
1805
- readonly type: "disconnect";
1806
- readonly from: string;
1807
- readonly to: string;
1808
- } | {
1809
- readonly type: "set_value";
1810
- readonly name: string;
1811
- readonly value: unknown;
1812
- } | {
1813
- readonly type: "update_meta";
1814
- readonly name: string;
1815
- readonly key: string;
1816
- readonly value: unknown;
1817
- };
1818
- /** Structured strategy plan returned by {@link suggestStrategy}. */
1819
- type StrategyPlan = {
1820
- readonly summary: string;
1821
- readonly operations: readonly StrategyOperation[];
1822
- readonly reasoning: string;
1823
- };
1824
- type SuggestStrategyOptions = {
1825
- model?: string;
1826
- temperature?: number;
1827
- maxTokens?: number;
1828
- actor?: Actor;
1829
- };
1830
- /**
1831
- * Ask an LLM to analyze a graph and suggest topology/parameter changes
1832
- * to solve a stated problem.
1833
- *
1834
- * Returns a structured plan — does NOT auto-apply. The caller reviews
1835
- * and selectively applies operations.
1836
- *
1837
- * @param graph - The graph to analyze.
1838
- * @param problem - Natural-language problem statement.
1839
- * @param adapter - LLM adapter for the analysis call.
1840
- * @param opts - Model and actor options.
1841
- * @returns A structured strategy plan.
1842
- * @throws On invalid LLM output.
1843
- */
1844
- declare function suggestStrategy(graph: Graph, problem: string, adapter: LLMAdapter, opts?: SuggestStrategyOptions): Promise<StrategyPlan>;
1845
-
1846
- type ai_AdmissionScore3DOptions = AdmissionScore3DOptions;
1847
- type ai_AdmissionScores = AdmissionScores;
1848
- type ai_AgentLoopGraph = AgentLoopGraph;
1849
- declare const ai_AgentLoopGraph: typeof AgentLoopGraph;
1850
- type ai_AgentLoopOptions = AgentLoopOptions;
1851
- type ai_AgentLoopStatus = AgentLoopStatus;
1852
- type ai_AgentMemoryGraph<TMem = unknown> = AgentMemoryGraph<TMem>;
1853
- type ai_AgentMemoryOptions<TMem = unknown> = AgentMemoryOptions<TMem>;
1854
- type ai_ChatMessage = ChatMessage;
1855
- type ai_ChatStreamGraph = ChatStreamGraph;
1856
- declare const ai_ChatStreamGraph: typeof ChatStreamGraph;
1857
- type ai_ChatStreamOptions = ChatStreamOptions;
1858
- type ai_ContentDecision = ContentDecision;
1859
- type ai_ContentGateOptions = ContentGateOptions;
1860
- type ai_CostMeterOptions = CostMeterOptions;
1861
- type ai_CostMeterReading = CostMeterReading;
1862
- type ai_ExtractedToolCall = ExtractedToolCall;
1863
- type ai_FromLLMOptions = FromLLMOptions;
1864
- type ai_GatedStreamHandle<T> = GatedStreamHandle<T>;
1865
- type ai_GatedStreamOptions = GatedStreamOptions;
1866
- type ai_GaugesAsContextOptions = GaugesAsContextOptions;
1867
- type ai_GraphDefValidation = GraphDefValidation;
1868
- type ai_GraphFromSpecOptions = GraphFromSpecOptions;
1869
- type ai_KeywordFlag = KeywordFlag;
1870
- type ai_KeywordFlagExtractorOptions = KeywordFlagExtractorOptions;
1871
- type ai_KnobsAsToolsResult = KnobsAsToolsResult;
1872
- type ai_LLMAdapter = LLMAdapter;
1873
- type ai_LLMConsolidatorOptions = LLMConsolidatorOptions;
1874
- type ai_LLMExtractorOptions = LLMExtractorOptions;
1875
- type ai_LLMInvokeOptions = LLMInvokeOptions;
1876
- type ai_LLMResponse = LLMResponse;
1877
- type ai_McpToolSchema = McpToolSchema;
1878
- type ai_MemoryTier = MemoryTier;
1879
- type ai_MemoryTiersBundle<TMem> = MemoryTiersBundle<TMem>;
1880
- type ai_MemoryTiersOptions<TMem> = MemoryTiersOptions<TMem>;
1881
- type ai_OpenAIToolSchema = OpenAIToolSchema;
1882
- type ai_PromptNodeOptions = PromptNodeOptions;
1883
- type ai_RedactorOptions = RedactorOptions;
1884
- type ai_RetrievalEntry<TMem> = RetrievalEntry<TMem>;
1885
- type ai_RetrievalPipelineOptions<TMem> = RetrievalPipelineOptions<TMem>;
1886
- type ai_RetrievalQuery = RetrievalQuery;
1887
- type ai_RetrievalTrace<TMem> = RetrievalTrace<TMem>;
1888
- type ai_StrategyOperation = StrategyOperation;
1889
- type ai_StrategyPlan = StrategyPlan;
1890
- type ai_StreamChunk = StreamChunk;
1891
- type ai_StreamingPromptNodeHandle<T> = StreamingPromptNodeHandle<T>;
1892
- type ai_StreamingPromptNodeOptions = StreamingPromptNodeOptions;
1893
- type ai_SuggestStrategyOptions = SuggestStrategyOptions;
1894
- type ai_SystemPromptHandle = SystemPromptHandle;
1895
- type ai_ToolCall = ToolCall;
1896
- type ai_ToolDefinition = ToolDefinition;
1897
- type ai_ToolRegistryGraph = ToolRegistryGraph;
1898
- declare const ai_ToolRegistryGraph: typeof ToolRegistryGraph;
1899
- type ai_ToolRegistryOptions = ToolRegistryOptions;
1900
- declare const ai_admissionFilter3D: typeof admissionFilter3D;
1901
- declare const ai_agentLoop: typeof agentLoop;
1902
- declare const ai_agentMemory: typeof agentMemory;
1903
- declare const ai_chatStream: typeof chatStream;
1904
- declare const ai_contentGate: typeof contentGate;
1905
- declare const ai_costMeterExtractor: typeof costMeterExtractor;
1906
- declare const ai_fromLLM: typeof fromLLM;
1907
- declare const ai_gatedStream: typeof gatedStream;
1908
- declare const ai_gaugesAsContext: typeof gaugesAsContext;
1909
- declare const ai_graphFromSpec: typeof graphFromSpec;
1910
- declare const ai_keywordFlagExtractor: typeof keywordFlagExtractor;
1911
- declare const ai_knobsAsTools: typeof knobsAsTools;
1912
- declare const ai_llmConsolidator: typeof llmConsolidator;
1913
- declare const ai_llmExtractor: typeof llmExtractor;
1914
- declare const ai_promptNode: typeof promptNode;
1915
- declare const ai_redactor: typeof redactor;
1916
- declare const ai_streamExtractor: typeof streamExtractor;
1917
- declare const ai_streamingPromptNode: typeof streamingPromptNode;
1918
- declare const ai_suggestStrategy: typeof suggestStrategy;
1919
- declare const ai_systemPromptBuilder: typeof systemPromptBuilder;
1920
- declare const ai_toolCallExtractor: typeof toolCallExtractor;
1921
- declare const ai_toolRegistry: typeof toolRegistry;
1922
- declare const ai_validateGraphDef: typeof validateGraphDef;
1923
- declare namespace ai {
1924
- export { type ai_AdmissionScore3DOptions as AdmissionScore3DOptions, type ai_AdmissionScores as AdmissionScores, ai_AgentLoopGraph as AgentLoopGraph, type ai_AgentLoopOptions as AgentLoopOptions, type ai_AgentLoopStatus as AgentLoopStatus, type ai_AgentMemoryGraph as AgentMemoryGraph, type ai_AgentMemoryOptions as AgentMemoryOptions, type ai_ChatMessage as ChatMessage, ai_ChatStreamGraph as ChatStreamGraph, type ai_ChatStreamOptions as ChatStreamOptions, type ai_ContentDecision as ContentDecision, type ai_ContentGateOptions as ContentGateOptions, type ai_CostMeterOptions as CostMeterOptions, type ai_CostMeterReading as CostMeterReading, type ai_ExtractedToolCall as ExtractedToolCall, type ai_FromLLMOptions as FromLLMOptions, type ai_GatedStreamHandle as GatedStreamHandle, type ai_GatedStreamOptions as GatedStreamOptions, type ai_GaugesAsContextOptions as GaugesAsContextOptions, type ai_GraphDefValidation as GraphDefValidation, type ai_GraphFromSpecOptions as GraphFromSpecOptions, type ai_KeywordFlag as KeywordFlag, type ai_KeywordFlagExtractorOptions as KeywordFlagExtractorOptions, type ai_KnobsAsToolsResult as KnobsAsToolsResult, type ai_LLMAdapter as LLMAdapter, type ai_LLMConsolidatorOptions as LLMConsolidatorOptions, type ai_LLMExtractorOptions as LLMExtractorOptions, type ai_LLMInvokeOptions as LLMInvokeOptions, type ai_LLMResponse as LLMResponse, type ai_McpToolSchema as McpToolSchema, type ai_MemoryTier as MemoryTier, type ai_MemoryTiersBundle as MemoryTiersBundle, type ai_MemoryTiersOptions as MemoryTiersOptions, type ai_OpenAIToolSchema as OpenAIToolSchema, type ai_PromptNodeOptions as PromptNodeOptions, type ai_RedactorOptions as RedactorOptions, type ai_RetrievalEntry as RetrievalEntry, type ai_RetrievalPipelineOptions as RetrievalPipelineOptions, type ai_RetrievalQuery as RetrievalQuery, type ai_RetrievalTrace as RetrievalTrace, type ai_StrategyOperation as StrategyOperation, type ai_StrategyPlan as StrategyPlan, type ai_StreamChunk as StreamChunk, type ai_StreamingPromptNodeHandle as StreamingPromptNodeHandle, type ai_StreamingPromptNodeOptions as StreamingPromptNodeOptions, type ai_SuggestStrategyOptions as SuggestStrategyOptions, type ai_SystemPromptHandle as SystemPromptHandle, type ai_ToolCall as ToolCall, type ai_ToolDefinition as ToolDefinition, ai_ToolRegistryGraph as ToolRegistryGraph, type ai_ToolRegistryOptions as ToolRegistryOptions, ai_admissionFilter3D as admissionFilter3D, ai_agentLoop as agentLoop, ai_agentMemory as agentMemory, ai_chatStream as chatStream, ai_contentGate as contentGate, ai_costMeterExtractor as costMeterExtractor, ai_fromLLM as fromLLM, ai_gatedStream as gatedStream, ai_gaugesAsContext as gaugesAsContext, ai_graphFromSpec as graphFromSpec, ai_keywordFlagExtractor as keywordFlagExtractor, ai_knobsAsTools as knobsAsTools, ai_llmConsolidator as llmConsolidator, ai_llmExtractor as llmExtractor, ai_promptNode as promptNode, ai_redactor as redactor, ai_streamExtractor as streamExtractor, ai_streamingPromptNode as streamingPromptNode, ai_suggestStrategy as suggestStrategy, ai_systemPromptBuilder as systemPromptBuilder, ai_toolCallExtractor as toolCallExtractor, ai_toolRegistry as toolRegistry, ai_validateGraphDef as validateGraphDef };
1925
- }
1926
-
1927
- /**
1928
- * Three-pane demo shell (roadmap §7.2).
1929
- *
1930
- * A `Graph("demo-shell")` that dogfoods reactive coordination for the
1931
- * main/side split layout with synchronized cross-highlighting.
1932
- *
1933
- * **Zero framework dependency** — framework bindings wrap pane components only.
1934
- * The shell graph is headless and fully testable.
1935
- */
1936
-
1937
- /** Identifies which pane is the source of a hover event. */
1938
- type HoverPaneType = "visual" | "graph" | "code";
1939
- /** Cross-highlighting hover target. `null` means nothing hovered. */
1940
- type HoverTarget = {
1941
- pane: HoverPaneType;
1942
- id: string;
1943
- } | null;
1944
- /** Which pane is full-screened (null = normal layout). */
1945
- type FullscreenPane = "main" | "graph" | "code" | null;
1946
- /**
1947
- * Cross-referencing registry: maps node paths to code line numbers and
1948
- * visual element selectors. Provided by each demo's `store.ts`.
1949
- */
1950
- type NodeRegistry = Map<string, {
1951
- codeLine: number;
1952
- visualSelector: string;
1953
- }>;
1954
- /** Callbacks for cross-highlighting effect nodes. */
1955
- type HighlightCallbacks = {
1956
- /** Called when code-scroll highlight target changes. */
1957
- codeScroll?: (line: number | null) => void;
1958
- /** Called when visual highlight target changes. */
1959
- visual?: (selector: string | null) => void;
1960
- /** Called when graph highlight target changes. */
1961
- graph?: (nodeId: string | null) => void;
1962
- };
1963
- /** Label dimensions for graph node sizing. */
1964
- type GraphLabelSize = {
1965
- width: number;
1966
- height: number;
1967
- };
1968
- /** Options for {@link demoShell}. */
1969
- type DemoShellOptions = {
1970
- /** Initial main/side split ratio (0–1). Default: `0.65`. */
1971
- mainRatio?: number;
1972
- /** Initial graph/code vertical split in the side pane (0–1). Default: `0.5`. */
1973
- sideSplit?: number;
1974
- /** Initial viewport width in pixels. Default: `1280`. */
1975
- viewportWidth?: number;
1976
- /** Cross-referencing registry for hover→code/visual/graph mapping. */
1977
- nodeRegistry?: NodeRegistry;
1978
- /** Measurement adapter for layout engine integration. When provided, enables layout/* derived nodes. */
1979
- adapter?: MeasurementAdapter;
1980
- /** Font string for layout measurement. Default: `"14px monospace"`. */
1981
- layoutFont?: string;
1982
- /** Callbacks for cross-highlighting effect nodes. When provided, creates effect nodes visible in describe(). */
1983
- onHighlight?: HighlightCallbacks;
1984
- };
1985
- /** Return type of {@link demoShell}. */
1986
- type DemoShellHandle = {
1987
- /** The demo-shell graph. */
1988
- graph: Graph;
1989
- setMainRatio(ratio: number): void;
1990
- setSideSplit(ratio: number): void;
1991
- setFullscreen(pane: FullscreenPane): void;
1992
- setViewportWidth(width: number): void;
1993
- setHoverTarget(target: HoverTarget): void;
1994
- setDemoGraph(g: Graph | null): void;
1995
- bumpGraphTick(): void;
1996
- selectNode(path: string | null): void;
1997
- setMetaDebug(on: boolean): void;
1998
- /** Set code text for layout/code-lines measurement (requires adapter). */
1999
- setCodeText(text: string): void;
2000
- /** Atomic multi-set — wraps core `batch()` for glitch-free updates. */
2001
- batch(fn: () => void): void;
2002
- destroy(): void;
2003
- };
2004
- /**
2005
- * Creates the three-pane demo shell graph (roadmap §7.2).
2006
- *
2007
- * All coordination is reactive — no polling, no imperative triggers.
2008
- * Framework bindings subscribe to named nodes and drive `state` inputs.
2009
- */
2010
- declare function demoShell(opts?: DemoShellOptions): DemoShellHandle;
2011
-
2012
- type demoShell$1_DemoShellHandle = DemoShellHandle;
2013
- type demoShell$1_DemoShellOptions = DemoShellOptions;
2014
- type demoShell$1_FullscreenPane = FullscreenPane;
2015
- type demoShell$1_GraphLabelSize = GraphLabelSize;
2016
- type demoShell$1_HighlightCallbacks = HighlightCallbacks;
2017
- type demoShell$1_HoverPaneType = HoverPaneType;
2018
- type demoShell$1_HoverTarget = HoverTarget;
2019
- type demoShell$1_NodeRegistry = NodeRegistry;
2020
- declare const demoShell$1_demoShell: typeof demoShell;
2021
- declare namespace demoShell$1 {
2022
- export { type demoShell$1_DemoShellHandle as DemoShellHandle, type demoShell$1_DemoShellOptions as DemoShellOptions, type demoShell$1_FullscreenPane as FullscreenPane, type demoShell$1_GraphLabelSize as GraphLabelSize, type demoShell$1_HighlightCallbacks as HighlightCallbacks, type demoShell$1_HoverPaneType as HoverPaneType, type demoShell$1_HoverTarget as HoverTarget, type demoShell$1_NodeRegistry as NodeRegistry, demoShell$1_demoShell as demoShell };
2023
- }
38
+ import 'vue';
2024
39
 
2025
40
  /**
2026
41
  * Domain templates (roadmap §8.2).
@@ -2565,6 +580,135 @@ declare namespace graphspec {
2565
580
  export { type graphspec_CatalogFnEntry as CatalogFnEntry, type graphspec_CatalogSourceEntry as CatalogSourceEntry, type graphspec_CompileSpecOptions as CompileSpecOptions, type graphspec_ConfigFieldSchema as ConfigFieldSchema, type graphspec_FnFactory as FnFactory, type graphspec_GraphSpec as GraphSpec, type graphspec_GraphSpecCatalog as GraphSpecCatalog, type graphspec_GraphSpecFeedbackEdge as GraphSpecFeedbackEdge, type graphspec_GraphSpecNode as GraphSpecNode, type graphspec_GraphSpecTemplate as GraphSpecTemplate, type graphspec_GraphSpecTemplateRef as GraphSpecTemplateRef, type graphspec_GraphSpecValidation as GraphSpecValidation, type graphspec_LLMComposeOptions as LLMComposeOptions, type graphspec_LLMRefineOptions as LLMRefineOptions, type graphspec_SourceFactory as SourceFactory, type graphspec_SpecDiffEntry as SpecDiffEntry, type graphspec_SpecDiffResult as SpecDiffResult, graphspec_compileSpec as compileSpec, graphspec_decompileGraph as decompileGraph, graphspec_extractFnFactory as extractFnFactory, graphspec_extractSourceFactory as extractSourceFactory, graphspec_generateCatalogPrompt as generateCatalogPrompt, graphspec_isRichFnEntry as isRichFnEntry, graphspec_isRichSourceEntry as isRichSourceEntry, graphspec_llmCompose as llmCompose, graphspec_llmRefine as llmRefine, graphspec_specDiff as specDiff, graphspec_validateSpec as validateSpec, graphspec_validateSpecAgainstCatalog as validateSpecAgainstCatalog };
2566
581
  }
2567
582
 
583
+ /**
584
+ * Composable safety layer (roadmap §9.0b).
585
+ *
586
+ * {@link guardedExecution} wraps any {@link Graph} with:
587
+ *
588
+ * - {@link policyEnforcer} — reactive ABAC, policies stored as a `Node` so
589
+ * LLMs / humans can update them at runtime. Now with full transitive
590
+ * dynamic coverage via `watchTopologyTree`.
591
+ * - Scoped {@link GuardedExecutionGraph.scopedDescribe} — delegates to
592
+ * `target.describe({actor})` so callers see only what the actor is
593
+ * allowed to see.
594
+ * - The enforcer's `violations` topic is republished as `violations` on
595
+ * the wrapper, composable with {@link graphLens}.`health` alerts.
596
+ *
597
+ * V1 scope: policies + actor + scoped describe. Budget-as-option is NOT
598
+ * in V1 — it requires a cost-tracking design that hasn't landed yet.
599
+ * Callers who need a budget limit today append a budget-aware
600
+ * {@link PolicyRuleData} to the policies list (check current cost and
601
+ * `deny` when exhausted).
602
+ *
603
+ * @module
604
+ */
605
+
606
+ /** Options for {@link guardedExecution}. */
607
+ interface GuardedExecutionOptions {
608
+ /**
609
+ * Policies enforced against every guarded write. Static list or a live
610
+ * `Node<readonly PolicyRuleData[]>` (LLM-updatable).
611
+ *
612
+ * **Deny-by-default gotcha:** the underlying `policyFromRules()` denies any
613
+ * action that matches no rule. An empty policies list in `mode: "enforce"`
614
+ * therefore blocks EVERY write AND every `observe` through the stacked
615
+ * guard — including `scopedDescribe()`. If you want a permissive base, add
616
+ * at least `{ effect: "allow", action: "*" }` and layer deny rules on top.
617
+ * In `mode: "audit"` no guards are stacked, so empty policies are safe.
618
+ */
619
+ policies: readonly PolicyRuleData[] | Node<readonly PolicyRuleData[]>;
620
+ /**
621
+ * Actor whose perspective drives {@link GuardedExecutionGraph.scopedDescribe}
622
+ * and {@link GuardedExecutionGraph.describe} — when omitted, callers must
623
+ * pass `{actor}` explicitly or they get the target's raw describe.
624
+ */
625
+ actor?: Actor;
626
+ /**
627
+ * `"enforce"` (default) — push guards onto target nodes so disallowed
628
+ * writes throw {@link GuardDenied}.
629
+ * `"audit"` — record would-be denials to the `violations` topic without
630
+ * blocking writes.
631
+ */
632
+ mode?: "audit" | "enforce";
633
+ /** Ring-buffer cap for the `violations` topic. Default 1000 (inherited from policyEnforcer). */
634
+ violationsLimit?: number;
635
+ /** Wrapper graph name. Default `${target.name}_guarded`. */
636
+ name?: string;
637
+ /** Wrapper graph options. */
638
+ graph?: GraphOptions;
639
+ }
640
+ /**
641
+ * Wrapper over a target {@link Graph} providing reactive ABAC + scoped
642
+ * describe. Mounts a {@link PolicyEnforcerGraph} under `enforcer`.
643
+ *
644
+ * @category patterns
645
+ */
646
+ declare class GuardedExecutionGraph extends Graph {
647
+ readonly enforcer: PolicyEnforcerGraph;
648
+ readonly violations: TopicGraph<PolicyViolation>;
649
+ private readonly _target;
650
+ private readonly _defaultActor;
651
+ constructor(target: Graph, opts: GuardedExecutionOptions);
652
+ /**
653
+ * Describe the **target** graph scoped to the configured actor. Returns
654
+ * only nodes the actor is permitted to see (via the target's node guards
655
+ * filtering `describe()` via `actor`).
656
+ *
657
+ * Pass `{actor}` in opts to override the configured actor for this call.
658
+ * Pass any standard {@link GraphDescribeOptions} fields (`detail`,
659
+ * `fields`, `filter`) — they apply to the target's describe.
660
+ *
661
+ * **Mode interaction:**
662
+ * - In `mode: "enforce"` (default), the enforcer stacks a policy-derived
663
+ * guard on every target node. `scopedDescribe({actor})` then filters by
664
+ * the AND of per-node guards AND the stacked policy guard.
665
+ * - In `mode: "audit"`, NO guards are stacked — `scopedDescribe` filters
666
+ * purely by the target's pre-existing per-node guards. If a target has
667
+ * no node-level guards, the policy rules you pass have no effect on
668
+ * visibility (they only populate the `violations` topic on writes).
669
+ */
670
+ scopedDescribe(opts?: Omit<GraphDescribeOptions, "actor"> & {
671
+ actor?: Actor;
672
+ }): GraphDescribeOutput;
673
+ /** The wrapped graph (escape hatch for tooling). */
674
+ get target(): Graph;
675
+ }
676
+ /**
677
+ * Wrap a {@link Graph} with {@link policyEnforcer} plus a scoped describe
678
+ * lens. Returns a {@link GuardedExecutionGraph} that can be mounted, diffed,
679
+ * or composed with {@link graphLens}.
680
+ *
681
+ * @param target - The graph to guard.
682
+ * @param opts - See {@link GuardedExecutionOptions}.
683
+ *
684
+ * @example
685
+ * ```ts
686
+ * const guarded = guardedExecution(app, {
687
+ * actor: { type: "human", id: "alice" },
688
+ * policies: [
689
+ * { effect: "allow", action: "read", actorType: "human" },
690
+ * { effect: "deny", action: "write", pathPattern: "system::*" },
691
+ * ],
692
+ * mode: "enforce",
693
+ * });
694
+ *
695
+ * const view = guarded.scopedDescribe({ detail: "standard" });
696
+ * guarded.violations.events.subscribe(msgs => console.log("violations:", msgs));
697
+ * ```
698
+ *
699
+ * @category patterns
700
+ */
701
+ declare function guardedExecution(target: Graph, opts: GuardedExecutionOptions): GuardedExecutionGraph;
702
+
703
+ declare const guardedExecution$1_DescribeFilter: typeof DescribeFilter;
704
+ type guardedExecution$1_GuardedExecutionGraph = GuardedExecutionGraph;
705
+ declare const guardedExecution$1_GuardedExecutionGraph: typeof GuardedExecutionGraph;
706
+ type guardedExecution$1_GuardedExecutionOptions = GuardedExecutionOptions;
707
+ declare const guardedExecution$1_guardedExecution: typeof guardedExecution;
708
+ declare namespace guardedExecution$1 {
709
+ export { guardedExecution$1_DescribeFilter as DescribeFilter, guardedExecution$1_GuardedExecutionGraph as GuardedExecutionGraph, type guardedExecution$1_GuardedExecutionOptions as GuardedExecutionOptions, guardedExecution$1_guardedExecution as guardedExecution };
710
+ }
711
+
2568
712
  /**
2569
713
  * Harness wiring types (roadmap §9.0).
2570
714
  *
@@ -3118,66 +1262,223 @@ declare function harnessTrace(harness: HarnessGraph, opts?: HarnessTraceOptions)
3118
1262
  * @module
3119
1263
  */
3120
1264
 
3121
- type index$1_CodeChange = CodeChange;
3122
- type index$1_CodeChangeBridgeOptions = CodeChangeBridgeOptions;
3123
- declare const index$1_DEFAULT_DECAY_RATE: typeof DEFAULT_DECAY_RATE;
3124
- declare const index$1_DEFAULT_QUEUE_CONFIGS: typeof DEFAULT_QUEUE_CONFIGS;
3125
- declare const index$1_DEFAULT_SEVERITY_WEIGHTS: typeof DEFAULT_SEVERITY_WEIGHTS;
3126
- type index$1_ErrorClass = ErrorClass;
3127
- type index$1_ErrorClassifier = ErrorClassifier;
3128
- type index$1_EvalDelta = EvalDelta;
3129
- type index$1_EvalIntakeBridgeOptions = EvalIntakeBridgeOptions;
3130
- type index$1_EvalJudgeScore = EvalJudgeScore;
3131
- type index$1_EvalResult = EvalResult;
3132
- type index$1_EvalTaskDelta = EvalTaskDelta;
3133
- type index$1_EvalTaskResult = EvalTaskResult;
3134
- type index$1_ExecuteOutput = ExecuteOutput;
3135
- type index$1_ExecutionResult = ExecutionResult;
3136
- type index$1_HarnessGraph = HarnessGraph;
3137
- declare const index$1_HarnessGraph: typeof HarnessGraph;
3138
- type index$1_HarnessLoopOptions = HarnessLoopOptions;
3139
- type index$1_HarnessProfileResult = HarnessProfileResult;
3140
- type index$1_HarnessTraceHandle = HarnessTraceHandle;
3141
- type index$1_HarnessTraceOptions = HarnessTraceOptions;
3142
- type index$1_IntakeBridgeOptions = IntakeBridgeOptions;
3143
- type index$1_IntakeItem = IntakeItem;
3144
- type index$1_IntakeSource = IntakeSource;
3145
- type index$1_Intervention = Intervention;
3146
- type index$1_LintError = LintError;
3147
- type index$1_NotifyEffectOptions = NotifyEffectOptions;
3148
- type index$1_NotifyTransport<T> = NotifyTransport<T>;
3149
- type index$1_PrioritySignals = PrioritySignals;
3150
- declare const index$1_QUEUE_NAMES: typeof QUEUE_NAMES;
3151
- type index$1_QueueConfig = QueueConfig;
3152
- type index$1_QueueRoute = QueueRoute;
3153
- type index$1_RootCause = RootCause;
3154
- type index$1_Severity = Severity;
3155
- type index$1_StrategyEntry = StrategyEntry;
3156
- type index$1_StrategyKey = StrategyKey;
3157
- type index$1_StrategyModelBundle = StrategyModelBundle;
3158
- type index$1_StrategySnapshot = StrategySnapshot;
3159
- type index$1_TestFailure = TestFailure;
3160
- type index$1_TraceDetail = TraceDetail;
3161
- type index$1_TraceEvent = TraceEvent;
3162
- type index$1_TraceEventType = TraceEventType;
3163
- type index$1_TriagedItem = TriagedItem;
3164
- type index$1_VerifyResult = VerifyResult;
3165
- declare const index$1_affectedTaskFilter: typeof affectedTaskFilter;
3166
- declare const index$1_beforeAfterCompare: typeof beforeAfterCompare;
3167
- declare const index$1_codeChangeBridge: typeof codeChangeBridge;
3168
- declare const index$1_createIntakeBridge: typeof createIntakeBridge;
3169
- declare const index$1_defaultErrorClassifier: typeof defaultErrorClassifier;
3170
- declare const index$1_evalIntakeBridge: typeof evalIntakeBridge;
3171
- declare const index$1_evalSource: typeof evalSource;
3172
- declare const index$1_harnessLoop: typeof harnessLoop;
3173
- declare const index$1_harnessProfile: typeof harnessProfile;
3174
- declare const index$1_harnessTrace: typeof harnessTrace;
3175
- declare const index$1_notifyEffect: typeof notifyEffect;
3176
- declare const index$1_priorityScore: typeof priorityScore;
3177
- declare const index$1_strategyKey: typeof strategyKey;
3178
- declare const index$1_strategyModel: typeof strategyModel;
3179
- declare namespace index$1 {
3180
- export { type index$1_CodeChange as CodeChange, type index$1_CodeChangeBridgeOptions as CodeChangeBridgeOptions, index$1_DEFAULT_DECAY_RATE as DEFAULT_DECAY_RATE, index$1_DEFAULT_QUEUE_CONFIGS as DEFAULT_QUEUE_CONFIGS, index$1_DEFAULT_SEVERITY_WEIGHTS as DEFAULT_SEVERITY_WEIGHTS, type index$1_ErrorClass as ErrorClass, type index$1_ErrorClassifier as ErrorClassifier, type index$1_EvalDelta as EvalDelta, type index$1_EvalIntakeBridgeOptions as EvalIntakeBridgeOptions, type index$1_EvalJudgeScore as EvalJudgeScore, type index$1_EvalResult as EvalResult, type index$1_EvalTaskDelta as EvalTaskDelta, type index$1_EvalTaskResult as EvalTaskResult, type index$1_ExecuteOutput as ExecuteOutput, type index$1_ExecutionResult as ExecutionResult, index$1_HarnessGraph as HarnessGraph, type index$1_HarnessLoopOptions as HarnessLoopOptions, type index$1_HarnessProfileResult as HarnessProfileResult, type index$1_HarnessTraceHandle as HarnessTraceHandle, type index$1_HarnessTraceOptions as HarnessTraceOptions, type index$1_IntakeBridgeOptions as IntakeBridgeOptions, type index$1_IntakeItem as IntakeItem, type index$1_IntakeSource as IntakeSource, type index$1_Intervention as Intervention, type index$1_LintError as LintError, type index$1_NotifyEffectOptions as NotifyEffectOptions, type index$1_NotifyTransport as NotifyTransport, type index$1_PrioritySignals as PrioritySignals, index$1_QUEUE_NAMES as QUEUE_NAMES, type index$1_QueueConfig as QueueConfig, type index$1_QueueRoute as QueueRoute, type index$1_RootCause as RootCause, type index$1_Severity as Severity, type index$1_StrategyEntry as StrategyEntry, type index$1_StrategyKey as StrategyKey, type index$1_StrategyModelBundle as StrategyModelBundle, type index$1_StrategySnapshot as StrategySnapshot, type index$1_TestFailure as TestFailure, type index$1_TraceDetail as TraceDetail, type index$1_TraceEvent as TraceEvent, type index$1_TraceEventType as TraceEventType, type index$1_TriagedItem as TriagedItem, type index$1_VerifyResult as VerifyResult, index$1_affectedTaskFilter as affectedTaskFilter, index$1_beforeAfterCompare as beforeAfterCompare, index$1_codeChangeBridge as codeChangeBridge, index$1_createIntakeBridge as createIntakeBridge, index$1_defaultErrorClassifier as defaultErrorClassifier, index$1_evalIntakeBridge as evalIntakeBridge, index$1_evalSource as evalSource, index$1_harnessLoop as harnessLoop, index$1_harnessProfile as harnessProfile, index$1_harnessTrace as harnessTrace, index$1_notifyEffect as notifyEffect, index$1_priorityScore as priorityScore, index$1_strategyKey as strategyKey, index$1_strategyModel as strategyModel };
1265
+ type index$2_CodeChange = CodeChange;
1266
+ type index$2_CodeChangeBridgeOptions = CodeChangeBridgeOptions;
1267
+ declare const index$2_DEFAULT_DECAY_RATE: typeof DEFAULT_DECAY_RATE;
1268
+ declare const index$2_DEFAULT_QUEUE_CONFIGS: typeof DEFAULT_QUEUE_CONFIGS;
1269
+ declare const index$2_DEFAULT_SEVERITY_WEIGHTS: typeof DEFAULT_SEVERITY_WEIGHTS;
1270
+ type index$2_ErrorClass = ErrorClass;
1271
+ type index$2_ErrorClassifier = ErrorClassifier;
1272
+ type index$2_EvalDelta = EvalDelta;
1273
+ type index$2_EvalIntakeBridgeOptions = EvalIntakeBridgeOptions;
1274
+ type index$2_EvalJudgeScore = EvalJudgeScore;
1275
+ type index$2_EvalResult = EvalResult;
1276
+ type index$2_EvalTaskDelta = EvalTaskDelta;
1277
+ type index$2_EvalTaskResult = EvalTaskResult;
1278
+ type index$2_ExecuteOutput = ExecuteOutput;
1279
+ type index$2_ExecutionResult = ExecutionResult;
1280
+ type index$2_HarnessGraph = HarnessGraph;
1281
+ declare const index$2_HarnessGraph: typeof HarnessGraph;
1282
+ type index$2_HarnessLoopOptions = HarnessLoopOptions;
1283
+ type index$2_HarnessProfileResult = HarnessProfileResult;
1284
+ type index$2_HarnessTraceHandle = HarnessTraceHandle;
1285
+ type index$2_HarnessTraceOptions = HarnessTraceOptions;
1286
+ type index$2_IntakeBridgeOptions = IntakeBridgeOptions;
1287
+ type index$2_IntakeItem = IntakeItem;
1288
+ type index$2_IntakeSource = IntakeSource;
1289
+ type index$2_Intervention = Intervention;
1290
+ type index$2_LintError = LintError;
1291
+ type index$2_NotifyEffectOptions = NotifyEffectOptions;
1292
+ type index$2_NotifyTransport<T> = NotifyTransport<T>;
1293
+ type index$2_PrioritySignals = PrioritySignals;
1294
+ declare const index$2_QUEUE_NAMES: typeof QUEUE_NAMES;
1295
+ type index$2_QueueConfig = QueueConfig;
1296
+ type index$2_QueueRoute = QueueRoute;
1297
+ type index$2_RootCause = RootCause;
1298
+ type index$2_Severity = Severity;
1299
+ type index$2_StrategyEntry = StrategyEntry;
1300
+ type index$2_StrategyKey = StrategyKey;
1301
+ type index$2_StrategyModelBundle = StrategyModelBundle;
1302
+ type index$2_StrategySnapshot = StrategySnapshot;
1303
+ type index$2_TestFailure = TestFailure;
1304
+ type index$2_TraceDetail = TraceDetail;
1305
+ type index$2_TraceEvent = TraceEvent;
1306
+ type index$2_TraceEventType = TraceEventType;
1307
+ type index$2_TriagedItem = TriagedItem;
1308
+ type index$2_VerifyResult = VerifyResult;
1309
+ declare const index$2_affectedTaskFilter: typeof affectedTaskFilter;
1310
+ declare const index$2_beforeAfterCompare: typeof beforeAfterCompare;
1311
+ declare const index$2_codeChangeBridge: typeof codeChangeBridge;
1312
+ declare const index$2_createIntakeBridge: typeof createIntakeBridge;
1313
+ declare const index$2_defaultErrorClassifier: typeof defaultErrorClassifier;
1314
+ declare const index$2_evalIntakeBridge: typeof evalIntakeBridge;
1315
+ declare const index$2_evalSource: typeof evalSource;
1316
+ declare const index$2_harnessLoop: typeof harnessLoop;
1317
+ declare const index$2_harnessProfile: typeof harnessProfile;
1318
+ declare const index$2_harnessTrace: typeof harnessTrace;
1319
+ declare const index$2_notifyEffect: typeof notifyEffect;
1320
+ declare const index$2_priorityScore: typeof priorityScore;
1321
+ declare const index$2_strategyKey: typeof strategyKey;
1322
+ declare const index$2_strategyModel: typeof strategyModel;
1323
+ declare namespace index$2 {
1324
+ export { type index$2_CodeChange as CodeChange, type index$2_CodeChangeBridgeOptions as CodeChangeBridgeOptions, index$2_DEFAULT_DECAY_RATE as DEFAULT_DECAY_RATE, index$2_DEFAULT_QUEUE_CONFIGS as DEFAULT_QUEUE_CONFIGS, index$2_DEFAULT_SEVERITY_WEIGHTS as DEFAULT_SEVERITY_WEIGHTS, type index$2_ErrorClass as ErrorClass, type index$2_ErrorClassifier as ErrorClassifier, type index$2_EvalDelta as EvalDelta, type index$2_EvalIntakeBridgeOptions as EvalIntakeBridgeOptions, type index$2_EvalJudgeScore as EvalJudgeScore, type index$2_EvalResult as EvalResult, type index$2_EvalTaskDelta as EvalTaskDelta, type index$2_EvalTaskResult as EvalTaskResult, type index$2_ExecuteOutput as ExecuteOutput, type index$2_ExecutionResult as ExecutionResult, index$2_HarnessGraph as HarnessGraph, type index$2_HarnessLoopOptions as HarnessLoopOptions, type index$2_HarnessProfileResult as HarnessProfileResult, type index$2_HarnessTraceHandle as HarnessTraceHandle, type index$2_HarnessTraceOptions as HarnessTraceOptions, type index$2_IntakeBridgeOptions as IntakeBridgeOptions, type index$2_IntakeItem as IntakeItem, type index$2_IntakeSource as IntakeSource, type index$2_Intervention as Intervention, type index$2_LintError as LintError, type index$2_NotifyEffectOptions as NotifyEffectOptions, type index$2_NotifyTransport as NotifyTransport, type index$2_PrioritySignals as PrioritySignals, index$2_QUEUE_NAMES as QUEUE_NAMES, type index$2_QueueConfig as QueueConfig, type index$2_QueueRoute as QueueRoute, type index$2_RootCause as RootCause, type index$2_Severity as Severity, type index$2_StrategyEntry as StrategyEntry, type index$2_StrategyKey as StrategyKey, type index$2_StrategyModelBundle as StrategyModelBundle, type index$2_StrategySnapshot as StrategySnapshot, type index$2_TestFailure as TestFailure, type index$2_TraceDetail as TraceDetail, type index$2_TraceEvent as TraceEvent, type index$2_TraceEventType as TraceEventType, type index$2_TriagedItem as TriagedItem, type index$2_VerifyResult as VerifyResult, index$2_affectedTaskFilter as affectedTaskFilter, index$2_beforeAfterCompare as beforeAfterCompare, index$2_codeChangeBridge as codeChangeBridge, index$2_createIntakeBridge as createIntakeBridge, index$2_defaultErrorClassifier as defaultErrorClassifier, index$2_evalIntakeBridge as evalIntakeBridge, index$2_evalSource as evalSource, index$2_harnessLoop as harnessLoop, index$2_harnessProfile as harnessProfile, index$2_harnessTrace as harnessTrace, index$2_notifyEffect as notifyEffect, index$2_priorityScore as priorityScore, index$2_strategyKey as strategyKey, index$2_strategyModel as strategyModel };
1325
+ }
1326
+
1327
+ /** Aggregate topology stats emitted by {@link LensGraph.stats}. */
1328
+ interface TopologyStats {
1329
+ /** Total primary nodes across this graph and all transitively mounted subgraphs. */
1330
+ nodeCount: number;
1331
+ /** Total directed edges (derived from deps; no duplicates). */
1332
+ edgeCount: number;
1333
+ /** Count of mounted subgraphs (transitive). */
1334
+ subgraphCount: number;
1335
+ /** Qualified paths with no upstream deps (source nodes). Sorted. */
1336
+ sources: readonly string[];
1337
+ /** Qualified paths with no downstream consumers in-graph (sink nodes). Sorted. */
1338
+ sinks: readonly string[];
1339
+ /** Longest path from any source to any sink (in edges). `0` for empty graphs. */
1340
+ depth: number;
1341
+ /** `true` if the dep DAG contains a cycle (feedback edge). */
1342
+ hasCycles: boolean;
1343
+ }
1344
+ /** A single health problem entry. */
1345
+ interface HealthProblem {
1346
+ path: string;
1347
+ /** V1 only reports `"errored"`. Future versions may add `"completed"`, `"disconnected"`. */
1348
+ status: "errored";
1349
+ /** First errored upstream ancestor along the dep chain, when one exists and is distinct from `path`. */
1350
+ upstreamCause?: string;
1351
+ }
1352
+ /** Aggregate health snapshot. `ok=true` iff `problems.length === 0`. */
1353
+ interface HealthReport {
1354
+ ok: boolean;
1355
+ problems: readonly HealthProblem[];
1356
+ }
1357
+ /** One per-path flow entry stored in {@link LensGraph.flow}. */
1358
+ interface FlowEntry {
1359
+ path: string;
1360
+ /** Cumulative DATA emissions observed since the lens activated. */
1361
+ count: number;
1362
+ /** `monotonicNs()` at the most recent DATA emission, or `null` if none yet. */
1363
+ lastUpdate_ns: number | null;
1364
+ }
1365
+ /** Options for {@link graphLens}. */
1366
+ interface GraphLensOptions {
1367
+ name?: string;
1368
+ graph?: GraphOptions;
1369
+ /**
1370
+ * Limit which node paths `flow` tracks. When omitted, every path in
1371
+ * `target.describe()` is observed. Recommended for graphs with hundreds
1372
+ * of nodes since each tracked path adds one observe-event dispatch per
1373
+ * DATA emission.
1374
+ */
1375
+ pathFilter?: (path: string) => boolean;
1376
+ /**
1377
+ * LRU cap on the {@link LensGraph.flow} map. When set, the flow tracker
1378
+ * evicts least-recently-used paths (by insertion / set order) once the
1379
+ * entry count exceeds this bound. Omit for unbounded (not recommended
1380
+ * for long-running graphs with churning paths). Passed through to the
1381
+ * underlying {@link reactiveMap}'s `maxSize`.
1382
+ */
1383
+ maxFlowPaths?: number;
1384
+ }
1385
+ /**
1386
+ * Reactive observability surface for a target {@link Graph}.
1387
+ * See {@link graphLens}.
1388
+ *
1389
+ * @category observability
1390
+ */
1391
+ declare class LensGraph extends Graph {
1392
+ /**
1393
+ * Aggregate structural stats — `nodeCount`, `edgeCount`, `sources`,
1394
+ * `sinks`, `depth`, `hasCycles`, `subgraphCount`. Recomputes on every
1395
+ * structural change via {@link watchTopologyTree} (transitive).
1396
+ *
1397
+ * Named `stats` (not `topology`) because `Graph.topology` already names
1398
+ * the raw `TopologyEvent` stream on every graph including `LensGraph`;
1399
+ * giving the lens its own `topology` accessor with an incompatible
1400
+ * `Node<TopologyStats>` type would break Liskov substitutability.
1401
+ */
1402
+ readonly stats: Node<TopologyStats>;
1403
+ readonly health: Node<HealthReport>;
1404
+ /**
1405
+ * Per-path flow tracker — a live {@link ReactiveMapBundle} keyed by
1406
+ * qualified path. Use `.get(path)` / `.has(path)` / `.size` for O(1)
1407
+ * sync queries; subscribe to `.entries` for a reactive snapshot of the
1408
+ * whole map. Lazy — the snapshot is materialized only while `.entries`
1409
+ * has subscribers.
1410
+ *
1411
+ * Shape intentionally differs from `stats` / `health` (which are plain
1412
+ * `Node<Report>`) because `flow` is a keyed collection, not a single
1413
+ * aggregate value. The map shape exposes cheaper queries than any
1414
+ * snapshot-based design.
1415
+ */
1416
+ readonly flow: ReactiveMapBundle<string, FlowEntry>;
1417
+ private readonly _target;
1418
+ constructor(target: Graph, opts?: GraphLensOptions);
1419
+ /**
1420
+ * Live causal chain from `from` to `to`. Recomputes whenever the target
1421
+ * mutates. Disposed automatically when the lens is destroyed.
1422
+ *
1423
+ * **Lifetime note:** every call to `why()` registers a lens-owned disposer
1424
+ * that runs on `lens.destroy()`. The returned `dispose` function releases
1425
+ * the internal subscription but does NOT remove the lens-owned disposer —
1426
+ * so heavy calling (e.g. per render frame) accumulates no-op disposers
1427
+ * until lens teardown. Cache the returned handle for long-lived queries.
1428
+ *
1429
+ * @param from - Qualified path of the upstream endpoint.
1430
+ * @param to - Qualified path of the downstream endpoint.
1431
+ * @param opts - See {@link reactiveExplainPath}.
1432
+ */
1433
+ why(from: string, to: string, opts?: {
1434
+ maxDepth?: number;
1435
+ name?: string;
1436
+ findCycle?: boolean;
1437
+ }): {
1438
+ node: Node<CausalChain>;
1439
+ dispose: () => void;
1440
+ };
1441
+ /** Reference to the lensed graph. */
1442
+ get target(): Graph;
1443
+ }
1444
+ /**
1445
+ * Create a reactive observability lens over a {@link Graph}. Returns a
1446
+ * {@link LensGraph} with three reactive surfaces (`stats`, `health`, `flow`)
1447
+ * plus the `why(from, to)` method.
1448
+ *
1449
+ * The returned graph is detached. Mount it via `target.mount("lens", lens)`
1450
+ * if you want it to appear in the target's `describe()`, or keep it standalone.
1451
+ *
1452
+ * @param target - The graph to observe.
1453
+ * @param opts - See {@link GraphLensOptions}.
1454
+ *
1455
+ * @example
1456
+ * ```ts
1457
+ * const g = new Graph("app");
1458
+ * g.add("counter", state(0));
1459
+ * const lens = graphLens(g);
1460
+ * lens.stats.subscribe((msgs) => console.log(msgs[0]?.[1])); // TopologyStats
1461
+ * // Flow queries — O(1) without subscribing to snapshots:
1462
+ * lens.flow.get("counter"); // FlowEntry | undefined
1463
+ * lens.flow.size; // number
1464
+ * lens.flow.entries.subscribe(...); // reactive snapshot, lazy-materialized
1465
+ * ```
1466
+ *
1467
+ * @category observability
1468
+ */
1469
+ declare function graphLens(target: Graph, opts?: GraphLensOptions): LensGraph;
1470
+
1471
+ type lens_FlowEntry = FlowEntry;
1472
+ type lens_GraphLensOptions = GraphLensOptions;
1473
+ type lens_HealthProblem = HealthProblem;
1474
+ type lens_HealthReport = HealthReport;
1475
+ type lens_LensGraph = LensGraph;
1476
+ declare const lens_LensGraph: typeof LensGraph;
1477
+ type lens_TopologyStats = TopologyStats;
1478
+ declare const lens_graphLens: typeof graphLens;
1479
+ declare const lens_watchTopologyTree: typeof watchTopologyTree;
1480
+ declare namespace lens {
1481
+ export { type lens_FlowEntry as FlowEntry, type lens_GraphLensOptions as GraphLensOptions, type lens_HealthProblem as HealthProblem, type lens_HealthReport as HealthReport, lens_LensGraph as LensGraph, type lens_TopologyStats as TopologyStats, lens_graphLens as graphLens, lens_watchTopologyTree as watchTopologyTree };
3181
1482
  }
3182
1483
 
3183
1484
  /**
@@ -3399,20 +1700,421 @@ declare namespace reduction {
3399
1700
  export { type reduction_BudgetConstraint as BudgetConstraint, type reduction_BudgetGateOptions as BudgetGateOptions, type reduction_EffectivenessEntry as EffectivenessEntry, type reduction_EffectivenessSnapshot as EffectivenessSnapshot, type reduction_EffectivenessTrackerBundle as EffectivenessTrackerBundle, type reduction_EffectivenessTrackerOptions as EffectivenessTrackerOptions, type reduction_FeedbackOptions as FeedbackOptions, type reduction_FunnelOptions as FunnelOptions, type reduction_FunnelStage as FunnelStage, type reduction_ScoredItem as ScoredItem, type reduction_ScorerOptions as ScorerOptions, type reduction_StepRef as StepRef, type reduction_StratifyOptions as StratifyOptions, type reduction_StratifyRule as StratifyRule, reduction_budgetGate as budgetGate, reduction_effectivenessTracker as effectivenessTracker, reduction_feedback as feedback, reduction_funnel as funnel, reduction_scorer as scorer, reduction_stratify as stratify };
3400
1701
  }
3401
1702
 
1703
+ /**
1704
+ * Resilience composition with correct nesting order (roadmap §9.0b).
1705
+ *
1706
+ * {@link resilientPipeline} composes the resilience primitives from
1707
+ * `extra/resilience.ts` in the order discovered during the §9.1 eval runs:
1708
+ *
1709
+ * ```text
1710
+ * rateLimit → budget → breaker → timeout → retry → fallback → status
1711
+ * ```
1712
+ *
1713
+ * Note on retry/timeout ordering: `timeout` is applied BEFORE `retry` so each
1714
+ * retry attempt resubscribes to a fresh deadline (per-attempt semantics). If
1715
+ * `timeout` wrapped `retry`, a single deadline would apply to the entire
1716
+ * retry chain — not what callers expect.
1717
+ *
1718
+ * Every step is optional — omit the option and that layer is skipped. The
1719
+ * returned bundle exposes the final `Node<T>` plus the status/error/breaker
1720
+ * companions so callers can wire them into dashboards, alerts, or
1721
+ * {@link graphLens}.
1722
+ *
1723
+ * Subsumes the pre-1.0 `resilientFetch` template — that template becomes a
1724
+ * preconfigured instance of this factory for the HTTP fetch case.
1725
+ *
1726
+ * @module
1727
+ */
1728
+
1729
+ /** Options for {@link resilientPipeline}. Every field is optional — omit to skip that layer. */
1730
+ interface ResilientPipelineOptions<T> {
1731
+ /** Admission control — at most `maxEvents` DATA per `windowNs`. See {@link rateLimiter}. */
1732
+ rateLimit?: RateLimiterOptions;
1733
+ /** Cost/constraint gate. See {@link budgetGate}. */
1734
+ budget?: ReadonlyArray<BudgetConstraint>;
1735
+ /** Circuit breaker — fail-fast when the downstream resource is unhealthy. See {@link circuitBreaker}. */
1736
+ breaker?: CircuitBreakerOptions;
1737
+ /**
1738
+ * Behavior when the breaker is open:
1739
+ * - `"skip"` — emit RESOLVED (default, lets downstream drop the beat)
1740
+ * - `"error"` — emit a `CircuitOpenError` so `retry`/`fallback` can react
1741
+ *
1742
+ * Only used when `breaker` is provided.
1743
+ */
1744
+ breakerOnOpen?: "skip" | "error";
1745
+ /** Retry policy on terminal ERROR. See {@link retry}. */
1746
+ retry?: RetryOptions;
1747
+ /**
1748
+ * Per-attempt deadline in milliseconds. Converted to ns internally. Omit to skip the timeout wrap.
1749
+ *
1750
+ * Specified in ms (not ns) because callers consistently think in millisecond deadlines;
1751
+ * retry/breaker/ratelimit options take ns to match their primitives exactly.
1752
+ */
1753
+ timeoutMs?: number;
1754
+ /** Final fallback value emitted on terminal ERROR after retry exhausts. See {@link fallback}. */
1755
+ fallback?: FallbackInput<T>;
1756
+ /** Initial status reported by the status node. Default `"pending"`. */
1757
+ initialStatus?: StatusValue;
1758
+ }
1759
+ /** Output bundle of {@link resilientPipeline}. */
1760
+ interface ResilientPipelineBundle<T> {
1761
+ /** The final resilient node. Subscribe to this for DATA emissions. */
1762
+ node: Node<T>;
1763
+ /** Live status: `"pending" | "active" | "completed" | "errored"`. */
1764
+ status: Node<StatusValue>;
1765
+ /** Last error payload, or `null` when not errored. */
1766
+ error: Node<unknown | null>;
1767
+ /** Breaker state when `opts.breaker` was provided; `undefined` otherwise. */
1768
+ breakerState: Node<CircuitState> | undefined;
1769
+ }
1770
+ /**
1771
+ * Compose a resilient pipeline around `source` in the canonical nesting
1772
+ * order — `rateLimit → budget → breaker → timeout → retry → fallback → status`.
1773
+ * Omit any option to skip that layer.
1774
+ *
1775
+ * @param source - Upstream node to wrap.
1776
+ * @param opts - See {@link ResilientPipelineOptions}. All fields optional.
1777
+ *
1778
+ * @example
1779
+ * ```ts
1780
+ * const safeFetch = resilientPipeline(fetchNode, {
1781
+ * rateLimit: { maxEvents: 10, windowNs: NS_PER_SEC },
1782
+ * breaker: { failureThreshold: 5 },
1783
+ * retry: { count: 3, backoff: "exponential" },
1784
+ * timeoutMs: 10_000,
1785
+ * fallback: null,
1786
+ * });
1787
+ * safeFetch.status.subscribe(msgs => console.log(msgs));
1788
+ * ```
1789
+ *
1790
+ * @category patterns
1791
+ */
1792
+ declare function resilientPipeline<T>(source: Node<T>, opts?: ResilientPipelineOptions<T>): ResilientPipelineBundle<T>;
1793
+
1794
+ declare const resilientPipeline$1_NS_PER_MS: typeof NS_PER_MS;
1795
+ declare const resilientPipeline$1_NS_PER_SEC: typeof NS_PER_SEC;
1796
+ type resilientPipeline$1_ResilientPipelineBundle<T> = ResilientPipelineBundle<T>;
1797
+ type resilientPipeline$1_ResilientPipelineOptions<T> = ResilientPipelineOptions<T>;
1798
+ declare const resilientPipeline$1_resilientPipeline: typeof resilientPipeline;
1799
+ declare namespace resilientPipeline$1 {
1800
+ export { resilientPipeline$1_NS_PER_MS as NS_PER_MS, resilientPipeline$1_NS_PER_SEC as NS_PER_SEC, type resilientPipeline$1_ResilientPipelineBundle as ResilientPipelineBundle, type resilientPipeline$1_ResilientPipelineOptions as ResilientPipelineOptions, resilientPipeline$1_resilientPipeline as resilientPipeline };
1801
+ }
1802
+
1803
+ /**
1804
+ * Surface: create a graph from a {@link GraphSpec} (§9.3-core).
1805
+ *
1806
+ * Thin wrapper over {@link compileSpec} that converts the two failure modes
1807
+ * ({@link validateSpec} structural errors, and catalog-aware validation
1808
+ * errors) into typed {@link SurfaceError} throws. Consumers are MCP/CLI
1809
+ * wrappers, not end-user graph code — those should import `compileSpec`
1810
+ * directly.
1811
+ *
1812
+ * @module
1813
+ */
1814
+
1815
+ /** Options for {@link createGraph}. Same shape as {@link CompileSpecOptions}. */
1816
+ type CreateGraphOptions = CompileSpecOptions;
1817
+ /**
1818
+ * Build a {@link Graph} from a parsed {@link GraphSpec} with surface-layer
1819
+ * error typing.
1820
+ *
1821
+ * @throws {SurfaceError} `invalid-spec` for structural errors;
1822
+ * `catalog-error` when fn/source names or config don't match the catalog.
1823
+ */
1824
+ declare function createGraph(spec: GraphSpec, opts?: CreateGraphOptions): Graph;
1825
+
1826
+ /**
1827
+ * Typed errors for the surface layer (§9.3-core).
1828
+ *
1829
+ * The surface layer is consumed by `@graphrefly/mcp-server` and
1830
+ * `@graphrefly/cli`. Both have native error channels (MCP's `isError` flag,
1831
+ * CLI's exit codes), so surface functions throw a {@link SurfaceError}
1832
+ * carrying a structured code + details payload that wrappers can map to
1833
+ * their native shape. No `Result` envelope — keep the callsite idiom
1834
+ * `try/catch` and let each wrapper surface the error its own way.
1835
+ *
1836
+ * @module
1837
+ */
1838
+ /** Structured error codes emitted by the surface layer. JSON-safe. */
1839
+ type SurfaceErrorCode = "invalid-spec" | "graph-not-found" | "graph-exists" | "snapshot-not-found" | "node-not-found" | "reduce-timeout" | "catalog-error" | "restore-failed" | "snapshot-failed" | "tier-no-list" | "internal-error";
1840
+ /** JSON-safe shape surfaces should echo back through the wrapper. */
1841
+ interface SurfaceErrorPayload {
1842
+ code: SurfaceErrorCode;
1843
+ message: string;
1844
+ /** Optional structured detail; must be JSON-safe. */
1845
+ details?: Readonly<Record<string, unknown>>;
1846
+ }
1847
+ /**
1848
+ * Thrown by surface layer functions on failure. `code` is the stable
1849
+ * machine-readable identifier; `details` carries structured context
1850
+ * (e.g. `validateSpec` errors, missing path name). Both fields round-trip
1851
+ * through `toJSON()` for wrappers that serialize errors over the wire.
1852
+ */
1853
+ declare class SurfaceError extends Error {
1854
+ readonly code: SurfaceErrorCode;
1855
+ readonly details?: Readonly<Record<string, unknown>>;
1856
+ constructor(code: SurfaceErrorCode, message: string, details?: Readonly<Record<string, unknown>>);
1857
+ /**
1858
+ * JSON-safe payload for wire serialization. Defensively validates
1859
+ * `details` — if it can't be round-tripped through `JSON.stringify`
1860
+ * (cyclic refs, `BigInt`, `Error` instance not pre-toJSON'd), the
1861
+ * payload falls back to `{code, message}` only rather than crashing
1862
+ * the MCP/CLI wrapper when it serializes this error onto the wire.
1863
+ */
1864
+ toJSON(): SurfaceErrorPayload;
1865
+ }
1866
+ /** Wrap any thrown value as a SurfaceError. Idempotent on existing SurfaceError. */
1867
+ declare function asSurfaceError(err: unknown, fallbackCode?: SurfaceErrorCode): SurfaceError;
1868
+
1869
+ /**
1870
+ * Surface: one-shot `input → pipeline → output` (§9.3-core).
1871
+ *
1872
+ * `runReduction` compiles a {@link GraphSpec}, pushes an input value to a
1873
+ * named state node, awaits the first post-push DATA emission on a named
1874
+ * output, then disposes the graph. Stateless per call — no graphId, no
1875
+ * registry.
1876
+ *
1877
+ * Named `runReduction` (not `reduce`) to avoid collision with the
1878
+ * reactive {@link reduce} operator in `extra/operators.ts`. The MCP tool
1879
+ * name (`graphrefly_reduce`) and CLI subcommand (`graphrefly reduce`) use
1880
+ * the short form; the library export carries the verb.
1881
+ *
1882
+ * The subscribe-before-push ordering is deliberate. `graph.set` propagates
1883
+ * synchronously for sync derived/operator chains; for async sources
1884
+ * (`fromPromise`, `fromAsyncIter`, LLM adapters) the first post-push DATA
1885
+ * arrives on a later tick. Subscribing before the push catches both, and
1886
+ * skipping the priming push-on-subscribe emission avoids resolving with the
1887
+ * stale pre-push cache (spec §2.2).
1888
+ *
1889
+ * @module
1890
+ */
1891
+
1892
+ /** Options for {@link reduce}. */
1893
+ interface ReduceOptions {
1894
+ /** Fn/source catalog for {@link createGraph}. */
1895
+ catalog?: GraphSpecCatalog;
1896
+ /** Path of the state node that receives the input. Default `"input"`. */
1897
+ inputPath?: string;
1898
+ /** Path of the node whose first post-push DATA is the result. Default `"output"`. */
1899
+ outputPath?: string;
1900
+ /** Hard deadline in milliseconds. Default `30_000`. */
1901
+ timeoutMs?: number;
1902
+ }
1903
+ /**
1904
+ * Run a spec as a one-shot reduction: `input → graph → output`.
1905
+ *
1906
+ * Resolves on the first `[DATA, v]` **or** `[RESOLVED]` emitted by
1907
+ * `outputPath` after the input push. The RESOLVED path handles spec
1908
+ * §1.3.3 equals-substitution (output recomputed to a value equal to its
1909
+ * cache, so the graph skips the DATA push) by returning `outputNode.cache`
1910
+ * — the caller always gets the settled value, never hangs on idempotent
1911
+ * inputs.
1912
+ *
1913
+ * @throws {SurfaceError} `invalid-spec` / `catalog-error` (propagated from
1914
+ * {@link createGraph}), `node-not-found` when `inputPath`/`outputPath`
1915
+ * can't be resolved, `reduce-timeout` when `timeoutMs` elapses without
1916
+ * a post-push emission, or the ERROR payload from the graph re-thrown
1917
+ * as `internal-error`.
1918
+ */
1919
+ declare function runReduction(spec: GraphSpec, input: unknown, opts?: ReduceOptions): Promise<unknown>;
1920
+
1921
+ /**
1922
+ * Surface: snapshot save/restore/diff/list over {@link StorageTier} (§9.3-core).
1923
+ *
1924
+ * One-shot snapshot management for stateless callers (MCP tools, CLI
1925
+ * commands) layered on the existing multi-tier auto-checkpoint substrate.
1926
+ * A saved snapshot is a `mode: "full"` {@link GraphCheckpointRecord} with
1927
+ * `seq: 0` — byte-identical to the baseline anchor
1928
+ * {@link Graph.attachStorage} writes on its first flush. An
1929
+ * auto-checkpointed graph can therefore be restored through this surface,
1930
+ * and a surface-saved snapshot can be picked up by `attachStorage({
1931
+ * autoRestore: true })`.
1932
+ *
1933
+ * The wire envelope stays at {@link SNAPSHOT_WIRE_VERSION}; no new format.
1934
+ *
1935
+ * @module
1936
+ */
1937
+
1938
+ /**
1939
+ * Current envelope version. Re-exported from `graph.ts` so the one-shot
1940
+ * surface path and `Graph.attachStorage` write byte-identical
1941
+ * `format_version` fields — no silent wire drift.
1942
+ */
1943
+ declare const SNAPSHOT_WIRE_VERSION = 1;
1944
+ /** Shape returned by {@link saveSnapshot}. */
1945
+ interface SaveSnapshotResult {
1946
+ snapshotId: string;
1947
+ timestamp_ns: number;
1948
+ }
1949
+ /** Options for {@link restoreSnapshot}. */
1950
+ interface RestoreSnapshotOptions {
1951
+ /** Passthrough to `Graph.fromSnapshot`. First matching pattern wins. */
1952
+ factories?: Record<string, GraphNodeFactory>;
1953
+ }
1954
+ /**
1955
+ * Write a graph's current state as a one-shot `mode: "full"` record.
1956
+ *
1957
+ * Uses the same {@link GraphCheckpointRecord} envelope as
1958
+ * {@link Graph.attachStorage} so the two persistence paths interoperate.
1959
+ *
1960
+ * @throws {SurfaceError} `snapshot-failed` when the tier's `save` throws.
1961
+ */
1962
+ declare function saveSnapshot(graph: Graph, snapshotId: string, tier: StorageTier): Promise<SaveSnapshotResult>;
1963
+ /**
1964
+ * Load a snapshot from a tier and materialize it as a new {@link Graph}.
1965
+ *
1966
+ * Uses {@link Graph.fromSnapshot} to reconstruct topology; pass
1967
+ * `factories` when the graph includes non-state nodes that the default
1968
+ * hydrator can't rebuild on its own.
1969
+ *
1970
+ * **Requires a `mode: "full"` record.** Surface-written snapshots from
1971
+ * {@link saveSnapshot} always qualify. Records written by
1972
+ * {@link Graph.attachStorage} with `compactEvery > 1` may be
1973
+ * `mode: "diff"` between compacts — those throw `restore-failed` until
1974
+ * the tier's next compact flush (or until Phase 8.7 WAL replay lands).
1975
+ * If you need interop during development, either call
1976
+ * {@link saveSnapshot} explicitly (always full) or configure
1977
+ * `attachStorage({compactEvery: 1})`.
1978
+ *
1979
+ * @throws {SurfaceError} `snapshot-not-found` on miss; `restore-failed`
1980
+ * when the payload shape doesn't match, when the record is
1981
+ * `mode: "diff"`, or when `Graph.fromSnapshot` rejects.
1982
+ */
1983
+ declare function restoreSnapshot(snapshotId: string, tier: StorageTier, opts?: RestoreSnapshotOptions): Promise<Graph>;
1984
+ /**
1985
+ * Load two snapshots and compute a {@link GraphDiffResult} via static
1986
+ * {@link Graph.diff}. Returns the audit shape (structural + value diff,
1987
+ * no payload); use {@link diffForWAL} directly for WAL-oriented diffs.
1988
+ *
1989
+ * @throws {SurfaceError} `snapshot-not-found` on either miss.
1990
+ */
1991
+ declare function diffSnapshots(snapshotIdA: string, snapshotIdB: string, tier: StorageTier): Promise<GraphDiffResult>;
1992
+ /**
1993
+ * Enumerate snapshot ids on a tier.
1994
+ *
1995
+ * **Scope caveat:** returns every key on the tier, not just those
1996
+ * written by {@link saveSnapshot}. When the same tier also backs
1997
+ * {@link Graph.attachStorage} (for auto-checkpoints keyed by
1998
+ * `graph.name`), those names appear in this list too. Wrappers that
1999
+ * want a namespaced snapshot store should use a dedicated tier or
2000
+ * encode an id prefix on write. Tracked in `docs/optimizations.md`
2001
+ * under "surface `listSnapshots` namespacing".
2002
+ *
2003
+ * @throws {SurfaceError} `tier-no-list` when the tier does not implement
2004
+ * the optional `list()` method. Check `typeof tier.list === "function"`
2005
+ * before calling if you want to branch on capability.
2006
+ */
2007
+ declare function listSnapshots(tier: StorageTier): Promise<readonly string[]>;
2008
+ /**
2009
+ * Delete a snapshot from a tier.
2010
+ *
2011
+ * Silent on miss (clear semantics). `tier.clear` is optional — throws
2012
+ * `snapshot-failed` when the tier is append-only.
2013
+ *
2014
+ * @throws {SurfaceError} `snapshot-failed` when `clear` is unsupported
2015
+ * or throws.
2016
+ */
2017
+ declare function deleteSnapshot(snapshotId: string, tier: StorageTier): Promise<void>;
2018
+
2019
+ /**
2020
+ * Surface layer (§9.3-core) — shared, JSON-safe operations consumed by
2021
+ * `@graphrefly/mcp-server` and `@graphrefly/cli`.
2022
+ *
2023
+ * The surface is a thin projection of existing Graph APIs (`describe`,
2024
+ * `observe`, `explain`, `snapshot`, `restore`, static `diff`), plus two
2025
+ * genuinely new operations:
2026
+ *
2027
+ * 1. {@link createGraph} — `compileSpec` wrapped with typed surface errors.
2028
+ * 2. {@link reduce} — one-shot `input → pipeline → output`.
2029
+ *
2030
+ * Snapshot persistence reuses the {@link StorageTier} substrate introduced
2031
+ * for `Graph.attachStorage`, so one-shot snapshots and auto-checkpoints
2032
+ * share the {@link GraphCheckpointRecord} envelope. No new wire format.
2033
+ *
2034
+ * Errors throw as {@link SurfaceError} — wrappers map to their native
2035
+ * error channel (MCP `isError`, CLI exit code). No `Result<T, E>` wrapper.
2036
+ *
2037
+ * @module
2038
+ */
2039
+
2040
+ type index$1_CatalogFnEntry = CatalogFnEntry;
2041
+ type index$1_CatalogSourceEntry = CatalogSourceEntry;
2042
+ type index$1_ConfigFieldSchema = ConfigFieldSchema;
2043
+ type index$1_CreateGraphOptions = CreateGraphOptions;
2044
+ type index$1_FnFactory = FnFactory;
2045
+ type index$1_GraphSpec = GraphSpec;
2046
+ type index$1_GraphSpecCatalog = GraphSpecCatalog;
2047
+ type index$1_GraphSpecFeedbackEdge = GraphSpecFeedbackEdge;
2048
+ type index$1_GraphSpecNode = GraphSpecNode;
2049
+ type index$1_GraphSpecTemplate = GraphSpecTemplate;
2050
+ type index$1_GraphSpecTemplateRef = GraphSpecTemplateRef;
2051
+ type index$1_GraphSpecValidation = GraphSpecValidation;
2052
+ type index$1_ReduceOptions = ReduceOptions;
2053
+ type index$1_RestoreSnapshotOptions = RestoreSnapshotOptions;
2054
+ declare const index$1_SNAPSHOT_WIRE_VERSION: typeof SNAPSHOT_WIRE_VERSION;
2055
+ type index$1_SaveSnapshotResult = SaveSnapshotResult;
2056
+ type index$1_SourceFactory = SourceFactory;
2057
+ type index$1_SurfaceError = SurfaceError;
2058
+ declare const index$1_SurfaceError: typeof SurfaceError;
2059
+ type index$1_SurfaceErrorCode = SurfaceErrorCode;
2060
+ type index$1_SurfaceErrorPayload = SurfaceErrorPayload;
2061
+ declare const index$1_asSurfaceError: typeof asSurfaceError;
2062
+ declare const index$1_createGraph: typeof createGraph;
2063
+ declare const index$1_deleteSnapshot: typeof deleteSnapshot;
2064
+ declare const index$1_diffSnapshots: typeof diffSnapshots;
2065
+ declare const index$1_listSnapshots: typeof listSnapshots;
2066
+ declare const index$1_restoreSnapshot: typeof restoreSnapshot;
2067
+ declare const index$1_runReduction: typeof runReduction;
2068
+ declare const index$1_saveSnapshot: typeof saveSnapshot;
2069
+ declare namespace index$1 {
2070
+ export { type index$1_CatalogFnEntry as CatalogFnEntry, type index$1_CatalogSourceEntry as CatalogSourceEntry, type index$1_ConfigFieldSchema as ConfigFieldSchema, type index$1_CreateGraphOptions as CreateGraphOptions, type index$1_FnFactory as FnFactory, type index$1_GraphSpec as GraphSpec, type index$1_GraphSpecCatalog as GraphSpecCatalog, type index$1_GraphSpecFeedbackEdge as GraphSpecFeedbackEdge, type index$1_GraphSpecNode as GraphSpecNode, type index$1_GraphSpecTemplate as GraphSpecTemplate, type index$1_GraphSpecTemplateRef as GraphSpecTemplateRef, type index$1_GraphSpecValidation as GraphSpecValidation, type index$1_ReduceOptions as ReduceOptions, type index$1_RestoreSnapshotOptions as RestoreSnapshotOptions, index$1_SNAPSHOT_WIRE_VERSION as SNAPSHOT_WIRE_VERSION, type index$1_SaveSnapshotResult as SaveSnapshotResult, type index$1_SourceFactory as SourceFactory, index$1_SurfaceError as SurfaceError, type index$1_SurfaceErrorCode as SurfaceErrorCode, type index$1_SurfaceErrorPayload as SurfaceErrorPayload, index$1_asSurfaceError as asSurfaceError, index$1_createGraph as createGraph, index$1_deleteSnapshot as deleteSnapshot, index$1_diffSnapshots as diffSnapshots, index$1_listSnapshots as listSnapshots, index$1_restoreSnapshot as restoreSnapshot, index$1_runReduction as runReduction, index$1_saveSnapshot as saveSnapshot };
2071
+ }
2072
+
3402
2073
  /**
3403
2074
  * Patterns layer: domain/solution helpers (Phase 4+).
3404
2075
  */
3405
2076
 
2077
+ type index_CatalogFnEntry = CatalogFnEntry;
2078
+ type index_CatalogSourceEntry = CatalogSourceEntry;
2079
+ type index_ConfigFieldSchema = ConfigFieldSchema;
2080
+ type index_CreateGraphOptions = CreateGraphOptions;
2081
+ type index_FnFactory = FnFactory;
2082
+ type index_GraphSpec = GraphSpec;
2083
+ type index_GraphSpecCatalog = GraphSpecCatalog;
2084
+ type index_GraphSpecFeedbackEdge = GraphSpecFeedbackEdge;
2085
+ type index_GraphSpecNode = GraphSpecNode;
2086
+ type index_GraphSpecTemplate = GraphSpecTemplate;
2087
+ type index_GraphSpecTemplateRef = GraphSpecTemplateRef;
2088
+ type index_GraphSpecValidation = GraphSpecValidation;
2089
+ type index_ReduceOptions = ReduceOptions;
2090
+ type index_RestoreSnapshotOptions = RestoreSnapshotOptions;
2091
+ declare const index_SNAPSHOT_WIRE_VERSION: typeof SNAPSHOT_WIRE_VERSION;
2092
+ type index_SaveSnapshotResult = SaveSnapshotResult;
2093
+ type index_SourceFactory = SourceFactory;
2094
+ type index_SurfaceError = SurfaceError;
2095
+ declare const index_SurfaceError: typeof SurfaceError;
2096
+ type index_SurfaceErrorCode = SurfaceErrorCode;
2097
+ type index_SurfaceErrorPayload = SurfaceErrorPayload;
3406
2098
  declare const index_ai: typeof ai;
2099
+ declare const index_asSurfaceError: typeof asSurfaceError;
3407
2100
  declare const index_cqrs: typeof cqrs;
2101
+ declare const index_createGraph: typeof createGraph;
2102
+ declare const index_deleteSnapshot: typeof deleteSnapshot;
2103
+ declare const index_demoShell: typeof demoShell;
2104
+ declare const index_diffSnapshots: typeof diffSnapshots;
3408
2105
  declare const index_domainTemplates: typeof domainTemplates;
3409
2106
  declare const index_graphspec: typeof graphspec;
2107
+ declare const index_lens: typeof lens;
2108
+ declare const index_listSnapshots: typeof listSnapshots;
3410
2109
  declare const index_memory: typeof memory;
3411
2110
  declare const index_messaging: typeof messaging;
3412
2111
  declare const index_orchestration: typeof orchestration;
3413
2112
  declare const index_reduction: typeof reduction;
2113
+ declare const index_restoreSnapshot: typeof restoreSnapshot;
2114
+ declare const index_runReduction: typeof runReduction;
2115
+ declare const index_saveSnapshot: typeof saveSnapshot;
3414
2116
  declare namespace index {
3415
- export { index_ai as ai, index_cqrs as cqrs, demoShell$1 as demoShell, index_domainTemplates as domainTemplates, index_graphspec as graphspec, index$1 as harness, index$c as layout, index_memory as memory, index_messaging as messaging, index_orchestration as orchestration, index_reduction as reduction };
2117
+ export { type index_CatalogFnEntry as CatalogFnEntry, type index_CatalogSourceEntry as CatalogSourceEntry, type index_ConfigFieldSchema as ConfigFieldSchema, type index_CreateGraphOptions as CreateGraphOptions, type index_FnFactory as FnFactory, type index_GraphSpec as GraphSpec, type index_GraphSpecCatalog as GraphSpecCatalog, type index_GraphSpecFeedbackEdge as GraphSpecFeedbackEdge, type index_GraphSpecNode as GraphSpecNode, type index_GraphSpecTemplate as GraphSpecTemplate, type index_GraphSpecTemplateRef as GraphSpecTemplateRef, type index_GraphSpecValidation as GraphSpecValidation, type index_ReduceOptions as ReduceOptions, type index_RestoreSnapshotOptions as RestoreSnapshotOptions, index_SNAPSHOT_WIRE_VERSION as SNAPSHOT_WIRE_VERSION, type index_SaveSnapshotResult as SaveSnapshotResult, type index_SourceFactory as SourceFactory, index_SurfaceError as SurfaceError, type index_SurfaceErrorCode as SurfaceErrorCode, type index_SurfaceErrorPayload as SurfaceErrorPayload, audit as accountability, index_ai as ai, index_asSurfaceError as asSurfaceError, index_cqrs as cqrs, index_createGraph as createGraph, index_deleteSnapshot as deleteSnapshot, index_demoShell as demoShell, index_diffSnapshots as diffSnapshots, index_domainTemplates as domainTemplates, index_graphspec as graphspec, guardedExecution$1 as guarded, index$2 as harness, index$3 as layout, index_lens as lens, index_listSnapshots as listSnapshots, index_memory as memory, index_messaging as messaging, index_orchestration as orchestration, index_reduction as reduction, resilientPipeline$1 as resilientPipeline, index_restoreSnapshot as restoreSnapshot, index_runReduction as runReduction, index_saveSnapshot as saveSnapshot, index$1 as surface };
3416
2118
  }
3417
2119
 
3418
2120
  /**
@@ -3420,4 +2122,4 @@ declare namespace index {
3420
2122
  */
3421
2123
  declare const version = "0.0.0";
3422
2124
 
3423
- export { Actor, DerivedFn, DistillBundle, Extraction, Graph, GraphAttachStorageOptions, GraphOptions, GraphProfileOptions, GraphProfileResult, Node, NodeActions, NodeInput, NodeOptions, StorageHandle, StorageTier, ai, index$2 as compat, cqrs, demoShell$1 as demoShell, domainTemplates, graphspec, index$1 as harness, index$a as jotai, index$c as layout, memory, messaging, index$9 as nanostores, index$b as nestjs, orchestration, index as patterns, index$8 as react, reduction, index$7 as signals, index$6 as solid, index$5 as svelte, version, index$4 as vue, index$3 as zustand };
2125
+ export { Actor, type CatalogFnEntry, type CatalogSourceEntry, CausalChain, CircuitBreakerOptions, CircuitState, type ConfigFieldSchema, type CreateGraphOptions, DescribeFilter, FallbackInput, type FnFactory, Graph, GraphDescribeOptions, GraphDescribeOutput, GraphDiffResult, GraphNodeFactory, GraphOptions, GraphProfileOptions, GraphProfileResult, type GraphSpec, type GraphSpecCatalog, type GraphSpecFeedbackEdge, type GraphSpecNode, type GraphSpecTemplate, type GraphSpecTemplateRef, type GraphSpecValidation, NS_PER_MS, NS_PER_SEC, Node, NodeOptions, PolicyRuleData, RateLimiterOptions, ReactiveMapBundle, type ReduceOptions, type RestoreSnapshotOptions, RetryOptions, SNAPSHOT_WIRE_VERSION, type SaveSnapshotResult, type SourceFactory, StatusValue, StorageTier, SurfaceError, type SurfaceErrorCode, type SurfaceErrorPayload, audit as accountability, ai, asSurfaceError, cqrs, createGraph, deleteSnapshot, demoShell, diffSnapshots, domainTemplates, graphspec, guardedExecution$1 as guarded, index$2 as harness, index$3 as layout, lens, listSnapshots, memory, messaging, orchestration, index as patterns, reduction, resilientPipeline$1 as resilientPipeline, restoreSnapshot, runReduction, saveSnapshot, index$1 as surface, version, watchTopologyTree };