@graphrefly/ts 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -117
- package/dist/actions-types-CH-XCU9O.d.cts +657 -0
- package/dist/actions-types-w2iPQTkv.d.ts +657 -0
- package/dist/adapters/index.cjs +5157 -2951
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +207 -70
- package/dist/adapters/index.d.ts +207 -70
- package/dist/adapters/index.js +3738 -1688
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/nestjs/microservices.cjs +841 -0
- package/dist/adapters/nestjs/microservices.cjs.map +1 -0
- package/dist/adapters/nestjs/microservices.d.cts +45 -0
- package/dist/adapters/nestjs/microservices.d.ts +45 -0
- package/dist/adapters/nestjs/microservices.js +206 -0
- package/dist/adapters/nestjs/microservices.js.map +1 -0
- package/dist/adapters/nestjs/native.cjs +1391 -0
- package/dist/adapters/nestjs/native.cjs.map +1 -0
- package/dist/adapters/nestjs/native.d.cts +111 -0
- package/dist/adapters/nestjs/native.d.ts +111 -0
- package/dist/adapters/nestjs/native.js +577 -0
- package/dist/adapters/nestjs/native.js.map +1 -0
- package/dist/adapters/nestjs/websockets.cjs +924 -0
- package/dist/adapters/nestjs/websockets.cjs.map +1 -0
- package/dist/adapters/nestjs/websockets.d.cts +47 -0
- package/dist/adapters/nestjs/websockets.d.ts +47 -0
- package/dist/adapters/nestjs/websockets.js +286 -0
- package/dist/adapters/nestjs/websockets.js.map +1 -0
- package/dist/adapters/nestjs.cjs +1085 -0
- package/dist/adapters/nestjs.cjs.map +1 -0
- package/dist/adapters/nestjs.d.cts +385 -0
- package/dist/adapters/nestjs.d.ts +385 -0
- package/dist/adapters/nestjs.js +112 -0
- package/dist/adapters/nestjs.js.map +1 -0
- package/dist/adapters/observe-storage.d.cts +3 -3
- package/dist/adapters/observe-storage.d.ts +3 -3
- package/dist/adapters/observe-storage.js +4 -4
- package/dist/adapters/react.cjs.map +1 -1
- package/dist/adapters/react.d.cts +2 -2
- package/dist/adapters/react.d.ts +2 -2
- package/dist/adapters/react.js +1 -1
- package/dist/adapters/solid.cjs.map +1 -1
- package/dist/adapters/solid.d.cts +2 -2
- package/dist/adapters/solid.d.ts +2 -2
- package/dist/adapters/solid.js +1 -1
- package/dist/adapters/svelte.cjs.map +1 -1
- package/dist/adapters/svelte.d.cts +2 -2
- package/dist/adapters/svelte.d.ts +2 -2
- package/dist/adapters/svelte.js +1 -1
- package/dist/adapters/vue.cjs.map +1 -1
- package/dist/adapters/vue.d.cts +2 -2
- package/dist/adapters/vue.d.ts +2 -2
- package/dist/adapters/vue.js +1 -1
- package/dist/{agent-runtime-BesGDZcB.d.ts → agent-runtime-types-core-CKwrBDyi.d.ts} +171 -320
- package/dist/{agent-runtime-DZTJ3C-p.d.cts → agent-runtime-types-core-bfl4m0vM.d.cts} +171 -320
- package/dist/agent-runtime-types-tool-BLPV3azj.d.cts +695 -0
- package/dist/agent-runtime-types-tool-hwqvVqNt.d.ts +695 -0
- package/dist/agentic-memory-retention-CLwI76JK.d.ts +14 -0
- package/dist/agentic-memory-retention-Cz8GR6ie.d.cts +14 -0
- package/dist/{agentic-memory-DfuVZ-lY.d.cts → agentic-memory-types-JDr7MPhh.d.cts} +13 -57
- package/dist/{agentic-memory-BmRCvh0d.d.ts → agentic-memory-types-khYJgzKL.d.ts} +13 -57
- package/dist/{capability-admission-B0BzqAm5.d.cts → capability-admission-B8RNFyaZ.d.cts} +3 -3
- package/dist/{capability-admission-g0mn9hpq.d.ts → capability-admission-Dkw1Xz3r.d.ts} +3 -3
- package/dist/chunk-2KUAG2GZ.js +9693 -0
- package/dist/chunk-2KUAG2GZ.js.map +1 -0
- package/dist/{chunk-CZNV3VXM.js → chunk-3J7UPZL5.js} +11 -11
- package/dist/{chunk-HKK2JD7Z.js → chunk-3LYI6ADX.js} +12 -125
- package/dist/chunk-3LYI6ADX.js.map +1 -0
- package/dist/{chunk-YXMZ2N6J.js → chunk-4M37FH2I.js} +1071 -1025
- package/dist/chunk-4M37FH2I.js.map +1 -0
- package/dist/{chunk-YDSIVHRR.js → chunk-4NWSNI4K.js} +1598 -1584
- package/dist/chunk-4NWSNI4K.js.map +1 -0
- package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
- package/dist/{chunk-SS2A464I.js → chunk-54WPEODM.js} +3 -3
- package/dist/chunk-54WPEODM.js.map +1 -0
- package/dist/chunk-6E76H4OU.js +132 -0
- package/dist/chunk-6E76H4OU.js.map +1 -0
- package/dist/chunk-7GOTIIQ7.js +819 -0
- package/dist/chunk-7GOTIIQ7.js.map +1 -0
- package/dist/{chunk-V7CIJE4B.js → chunk-DKFWDTVY.js} +92 -9
- package/dist/chunk-DKFWDTVY.js.map +1 -0
- package/dist/{chunk-FBUU43PM.js → chunk-E4QCH32M.js} +448 -446
- package/dist/chunk-E4QCH32M.js.map +1 -0
- package/dist/{chunk-XKXWK2KP.js → chunk-GXU6WFEJ.js} +1157 -1021
- package/dist/chunk-GXU6WFEJ.js.map +1 -0
- package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
- package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
- package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
- package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
- package/dist/chunk-K7FB3JTD.js.map +1 -0
- package/dist/{chunk-43BKLFZU.js → chunk-KFURM6FM.js} +10 -10
- package/dist/{chunk-H75VXTGT.js → chunk-L6LDXRWE.js} +3 -3
- package/dist/{chunk-H75VXTGT.js.map → chunk-L6LDXRWE.js.map} +1 -1
- package/dist/chunk-MCOFHMUU.js +4131 -0
- package/dist/chunk-MCOFHMUU.js.map +1 -0
- package/dist/chunk-MQEQMS7B.js +1009 -0
- package/dist/chunk-MQEQMS7B.js.map +1 -0
- package/dist/chunk-MTELVIYR.js +1421 -0
- package/dist/chunk-MTELVIYR.js.map +1 -0
- package/dist/{chunk-3JR3EDB2.js → chunk-NNDIFUKX.js} +121 -115
- package/dist/chunk-NNDIFUKX.js.map +1 -0
- package/dist/{chunk-2747WN4Y.js → chunk-PUSRRALM.js} +3 -3
- package/dist/{chunk-QFY4AFY4.js → chunk-PVC7WDKI.js} +58 -52
- package/dist/chunk-PVC7WDKI.js.map +1 -0
- package/dist/{chunk-VTHLCFN4.js → chunk-RAHNUYA5.js} +2 -2
- package/dist/chunk-TQPCAIQI.js +612 -0
- package/dist/chunk-TQPCAIQI.js.map +1 -0
- package/dist/{chunk-IXZBUWSP.js → chunk-UEMN5URK.js} +2 -2
- package/dist/chunk-WOS7RJYZ.js +1320 -0
- package/dist/chunk-WOS7RJYZ.js.map +1 -0
- package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
- package/dist/composition/index.cjs +1228 -1076
- package/dist/composition/index.cjs.map +1 -1
- package/dist/composition/index.d.cts +3 -3
- package/dist/composition/index.d.ts +3 -3
- package/dist/composition/index.js +4 -4
- package/dist/core/index.cjs +1198 -1046
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +23 -2
- package/dist/core/index.d.ts +23 -2
- package/dist/core/index.js +2 -2
- package/dist/cqrs/index.d.cts +3 -3
- package/dist/cqrs/index.d.ts +3 -3
- package/dist/cqrs/messaging.d.cts +4 -4
- package/dist/cqrs/messaging.d.ts +4 -4
- package/dist/cqrs/work-queue.d.cts +5 -5
- package/dist/cqrs/work-queue.d.ts +5 -5
- package/dist/data-structures/index.cjs +1226 -1074
- package/dist/data-structures/index.cjs.map +1 -1
- package/dist/data-structures/index.d.cts +8 -7
- package/dist/data-structures/index.d.ts +8 -7
- package/dist/data-structures/index.js +6 -5
- package/dist/{describe-DYMw_l1C.d.cts → describe-BumQ-3_0.d.cts} +1 -1
- package/dist/{describe-BpyJuWkw.d.ts → describe-cYr_Z5zm.d.ts} +1 -1
- package/dist/executors/tool-provider-adapters.cjs +3091 -0
- package/dist/executors/tool-provider-adapters.cjs.map +1 -0
- package/dist/executors/tool-provider-adapters.d.cts +174 -0
- package/dist/executors/tool-provider-adapters.d.ts +174 -0
- package/dist/executors/tool-provider-adapters.js +1336 -0
- package/dist/executors/tool-provider-adapters.js.map +1 -0
- package/dist/executors/tool-provider-runtime.cjs +5178 -0
- package/dist/executors/tool-provider-runtime.cjs.map +1 -0
- package/dist/executors/tool-provider-runtime.d.cts +17 -0
- package/dist/executors/tool-provider-runtime.d.ts +17 -0
- package/dist/executors/tool-provider-runtime.js +15 -0
- package/dist/executors/tool-provider-runtime.js.map +1 -0
- package/dist/executors/tool-provider.cjs +6392 -0
- package/dist/executors/tool-provider.cjs.map +1 -0
- package/dist/executors/tool-provider.d.cts +60 -0
- package/dist/executors/tool-provider.d.ts +60 -0
- package/dist/executors/tool-provider.js +89 -0
- package/dist/executors/tool-provider.js.map +1 -0
- package/dist/executors/work-queue.d.cts +6 -6
- package/dist/executors/work-queue.d.ts +6 -6
- package/dist/graph/index.cjs +1499 -1341
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +9 -8
- package/dist/graph/index.d.ts +9 -8
- package/dist/graph/index.js +23 -22
- package/dist/{graph-DCEWh4T2.d.cts → graph-C1C-wb0L.d.cts} +266 -137
- package/dist/{graph-D-1-SQeC.d.ts → graph-CS0b4V9B.d.ts} +266 -137
- package/dist/{index-72VZC0-E.d.cts → index-DLrNopda.d.cts} +151 -10
- package/dist/{index-Bmxeu0nK.d.ts → index-DzJni3_6.d.ts} +151 -10
- package/dist/index.cjs +3397 -3140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +110 -109
- package/dist/inspection/boundary.d.cts +4 -4
- package/dist/inspection/boundary.d.ts +4 -4
- package/dist/measurements-BWAnochv.d.ts +294 -0
- package/dist/measurements-B_gJfD8h.d.cts +294 -0
- package/dist/messaging/index.cjs +57 -51
- package/dist/messaging/index.cjs.map +1 -1
- package/dist/messaging/index.d.cts +11 -276
- package/dist/messaging/index.d.ts +11 -276
- package/dist/messaging/index.js +1 -1
- package/dist/operators/index.cjs +1228 -1076
- package/dist/operators/index.cjs.map +1 -1
- package/dist/operators/index.d.cts +5 -5
- package/dist/operators/index.d.ts +5 -5
- package/dist/operators/index.js +5 -5
- package/dist/orchestration/index.cjs +8844 -6071
- package/dist/orchestration/index.cjs.map +1 -1
- package/dist/orchestration/index.d.cts +171 -224
- package/dist/orchestration/index.d.ts +171 -224
- package/dist/orchestration/index.js +42 -991
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/messaging.d.cts +5 -8
- package/dist/orchestration/messaging.d.ts +5 -8
- package/dist/orchestration/work-queue.cjs +1243 -5
- package/dist/orchestration/work-queue.cjs.map +1 -1
- package/dist/orchestration/work-queue.d.cts +121 -10
- package/dist/orchestration/work-queue.d.ts +121 -10
- package/dist/orchestration/work-queue.js +1067 -4
- package/dist/orchestration/work-queue.js.map +1 -1
- package/dist/patterns/event-flow.cjs +6 -20
- package/dist/patterns/event-flow.cjs.map +1 -1
- package/dist/patterns/event-flow.d.cts +4 -4
- package/dist/patterns/event-flow.d.ts +4 -4
- package/dist/patterns/event-flow.js +2 -2
- package/dist/patterns/index.cjs +453 -465
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +6 -5
- package/dist/patterns/index.d.ts +6 -5
- package/dist/patterns/index.js +3 -3
- package/dist/process-types-BB7oRhX3.d.cts +200 -0
- package/dist/process-types-QNhyoYJ8.d.ts +200 -0
- package/dist/{reactive-collection-DNV0-gFi.d.cts → reactive-collection-BYlWvtnp.d.cts} +4 -34
- package/dist/{reactive-collection-BAmfrGjd.d.ts → reactive-collection-efOEdGFN.d.ts} +4 -34
- package/dist/{reactive-collection-storage-BNEldDyi.d.cts → reactive-collection-storage-BjoLsoiC.d.cts} +5 -5
- package/dist/{reactive-collection-storage-YZsAQsWK.d.ts → reactive-collection-storage-DwW6UuK_.d.ts} +5 -5
- package/dist/{reactive-map-DRD1LJ2H.d.cts → reactive-map-BHacbIqz.d.cts} +7 -2
- package/dist/{reactive-map-EsDiCmJk.d.ts → reactive-map-DN4Jyqnf.d.ts} +7 -2
- package/dist/render/index.d.cts +2 -2
- package/dist/render/index.d.ts +2 -2
- package/dist/scheduled-readiness-BmqXxnzX.d.ts +91 -0
- package/dist/scheduled-readiness-CYSw7KDE.d.cts +91 -0
- package/dist/semantic-memory-graph-B_LwbM-E.d.cts +30 -0
- package/dist/semantic-memory-graph-rsFNNhwn.d.ts +30 -0
- package/dist/{semantic-memory-graph-DKuNzuWw.d.cts → semantic-memory-graph-types-Y73bbwVI.d.cts} +2 -28
- package/dist/{semantic-memory-graph-uwbwJdhe.d.ts → semantic-memory-graph-types-safmPkuX.d.ts} +2 -28
- package/dist/solutions/index.cjs +6353 -6169
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +12 -10
- package/dist/solutions/index.d.ts +12 -10
- package/dist/solutions/index.js +5 -5
- package/dist/solutions/reactive-layout/browser/index.cjs +116 -108
- package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/browser/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/browser/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/browser/index.js +3 -3
- package/dist/solutions/reactive-layout/index.cjs +3578 -3350
- package/dist/solutions/reactive-layout/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/index.d.cts +32 -576
- package/dist/solutions/reactive-layout/index.d.ts +32 -576
- package/dist/solutions/reactive-layout/index.js +65 -5
- package/dist/solutions/reactive-layout/node-canvas/index.cjs +127 -117
- package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/node-canvas/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.js +3 -3
- package/dist/solutions/reactive-layout/react-native/index.cjs +127 -117
- package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/react-native/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.js +3 -3
- package/dist/solutions/reactive-layout/skia/index.cjs +127 -117
- package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/skia/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/skia/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/skia/index.js +3 -3
- package/dist/solutions/work-item/actions.cjs +1609 -1428
- package/dist/solutions/work-item/actions.cjs.map +1 -1
- package/dist/solutions/work-item/actions.d.cts +23 -184
- package/dist/solutions/work-item/actions.d.ts +23 -184
- package/dist/solutions/work-item/actions.js +1558 -934
- package/dist/solutions/work-item/actions.js.map +1 -1
- package/dist/solutions/work-item/scheduling.cjs +9181 -1838
- package/dist/solutions/work-item/scheduling.cjs.map +1 -1
- package/dist/solutions/work-item/scheduling.d.cts +1763 -328
- package/dist/solutions/work-item/scheduling.d.ts +1763 -328
- package/dist/solutions/work-item/scheduling.js +117 -3
- package/dist/solutions/work-item/work-queue.d.cts +7 -7
- package/dist/solutions/work-item/work-queue.d.ts +7 -7
- package/dist/sources/browser.cjs +1318 -1083
- package/dist/sources/browser.cjs.map +1 -1
- package/dist/sources/browser.d.cts +22 -6
- package/dist/sources/browser.d.ts +22 -6
- package/dist/sources/browser.js +4 -4
- package/dist/sources/browser.js.map +1 -1
- package/dist/sources/index.cjs +1318 -1083
- package/dist/sources/index.cjs.map +1 -1
- package/dist/sources/index.d.cts +4 -4
- package/dist/sources/index.d.ts +4 -4
- package/dist/sources/index.js +4 -4
- package/dist/sources/node.d.cts +3 -3
- package/dist/sources/node.d.ts +3 -3
- package/dist/storage/browser.cjs +16 -0
- package/dist/storage/browser.cjs.map +1 -1
- package/dist/storage/browser.js +3 -3
- package/dist/storage/index.cjs +16 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +5 -4
- package/dist/storage/index.d.ts +5 -4
- package/dist/storage/index.js +6 -6
- package/dist/storage/node.cjs +16 -0
- package/dist/storage/node.cjs.map +1 -1
- package/dist/storage/node.js +3 -3
- package/dist/{store-C-joM4gh.d.ts → store-6_CHF6Ge.d.ts} +1 -1
- package/dist/{store-CNJwmT-h.d.cts → store-BljX8RkQ.d.cts} +1 -1
- package/dist/types-BAw2QVVE.d.cts +274 -0
- package/dist/types-BUbbbh4f.d.cts +34 -0
- package/dist/types-CMnzoL54.d.cts +457 -0
- package/dist/{types-CcPIn7sy.d.cts → types-CTN3XoMl.d.cts} +57 -108
- package/dist/types-CV_ohy5T.d.cts +357 -0
- package/dist/{types-BsJvElYZ.d.ts → types-DChxk1vK.d.ts} +57 -108
- package/dist/types-DRu7SnLV.d.ts +274 -0
- package/dist/types-DeID_FRl.d.ts +34 -0
- package/dist/types-IhKH0hGW.d.ts +357 -0
- package/dist/types-ePlD2uyT.d.ts +457 -0
- package/dist/{work-item-runtime-qaVgsL0T.d.cts → work-item-runtime-types-BTxLskN5.d.cts} +3 -93
- package/dist/{work-item-runtime-C3M79vE9.d.ts → work-item-runtime-types-DAsZbb2y.d.ts} +3 -93
- package/dist/work-queue/index.cjs +957 -953
- package/dist/work-queue/index.cjs.map +1 -1
- package/dist/work-queue/index.d.cts +9 -357
- package/dist/work-queue/index.d.ts +9 -357
- package/dist/work-queue/index.js +957 -953
- package/dist/work-queue/index.js.map +1 -1
- package/package.json +611 -513
- package/dist/chunk-3JR3EDB2.js.map +0 -1
- package/dist/chunk-4VLAQHZI.js.map +0 -1
- package/dist/chunk-6XAIOL3X.js +0 -2407
- package/dist/chunk-6XAIOL3X.js.map +0 -1
- package/dist/chunk-FBUU43PM.js.map +0 -1
- package/dist/chunk-HKK2JD7Z.js.map +0 -1
- package/dist/chunk-PC3BTTBE.js +0 -3217
- package/dist/chunk-PC3BTTBE.js.map +0 -1
- package/dist/chunk-QFY4AFY4.js.map +0 -1
- package/dist/chunk-SS2A464I.js.map +0 -1
- package/dist/chunk-V7CIJE4B.js.map +0 -1
- package/dist/chunk-XKXWK2KP.js.map +0 -1
- package/dist/chunk-YDSIVHRR.js.map +0 -1
- package/dist/chunk-YXMZ2N6J.js.map +0 -1
- /package/dist/{chunk-CZNV3VXM.js.map → chunk-3J7UPZL5.js.map} +0 -0
- /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
- /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
- /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
- /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
- /package/dist/{chunk-43BKLFZU.js.map → chunk-KFURM6FM.js.map} +0 -0
- /package/dist/{chunk-2747WN4Y.js.map → chunk-PUSRRALM.js.map} +0 -0
- /package/dist/{chunk-VTHLCFN4.js.map → chunk-RAHNUYA5.js.map} +0 -0
- /package/dist/{chunk-IXZBUWSP.js.map → chunk-UEMN5URK.js.map} +0 -0
- /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/blueprint.ts","../src/graph/describe.ts","../src/graph/graph-lifecycle.ts","../src/graph/graph-support.ts","../src/graph/graph-topology-group.ts","../src/graph/graph.ts"],"sourcesContent":["/**\n * GraphBlueprint first slice (D173/D177).\n *\n * A blueprint is read-only audit/collaboration evidence over graph.topology(). It is not an\n * authoring spec, checkpoint, restore input, hash owner, or collaboration ownership artifact.\n */\n\nimport {\n\tassertStrictJsonObject,\n\ttype StrictJsonObject,\n\ttype StrictJsonValue,\n\tstableJsonString,\n\tstrictCanonicalJsonBytes,\n} from \"../json/codec.js\";\nimport type { GraphTopologyEdge, GraphTopologySnapshot } from \"./describe.js\";\n\nexport const GRAPH_BLUEPRINT_VERSION = \"graphrefly.blueprint.v1\" as const;\n\nexport type GraphBlueprintJson = StrictJsonValue;\n\nexport type GraphBlueprintProvenance = StrictJsonObject;\n\nexport interface NormalizedGraphTopologyNode {\n\treadonly id: string;\n\treadonly name?: string;\n\treadonly factory: string;\n\treadonly deps: readonly string[];\n\treadonly meta?: Readonly<Record<string, GraphBlueprintJson>>;\n}\n\nexport interface NormalizedGraphTopologySnapshot {\n\treadonly name?: string;\n\treadonly nodes: readonly NormalizedGraphTopologyNode[];\n\treadonly edges: readonly GraphTopologyEdge[];\n\treadonly subgraphs?: readonly NormalizedGraphTopologySnapshot[];\n}\n\nexport type GraphBlueprintDiagnosticCode = \"dangling-dep\" | \"duplicate-node-id\" | \"island-node\";\n\nexport interface GraphBlueprintDiagnosticIssue {\n\treadonly severity: \"warning\" | \"error\";\n\treadonly code: GraphBlueprintDiagnosticCode;\n\treadonly message: string;\n\treadonly nodeId?: string;\n\treadonly from?: string;\n\treadonly to?: string;\n}\n\nexport interface GraphBlueprintDiagnostics {\n\treadonly ok: boolean;\n\treadonly issues: readonly GraphBlueprintDiagnosticIssue[];\n}\n\nexport type GraphBlueprintHashInput = \"strictCanonicalTopologyBytes\";\n\nexport interface GraphBlueprintHash {\n\treadonly kind: \"topology\";\n\treadonly algorithm: string;\n\treadonly input: GraphBlueprintHashInput;\n\treadonly value: string;\n}\n\nexport interface GraphBlueprintHashOptions {\n\treadonly algorithm: string;\n\treadonly hash: (bytes: Uint8Array) => string | Promise<string>;\n}\n\nexport interface GraphBlueprint {\n\treadonly version: typeof GRAPH_BLUEPRINT_VERSION;\n\treadonly topology: NormalizedGraphTopologySnapshot;\n\treadonly diagnostics?: GraphBlueprintDiagnostics;\n\treadonly provenance?: GraphBlueprintProvenance;\n\treadonly hash?: GraphBlueprintHash;\n}\n\nexport interface GraphBlueprintOptions {\n\t/** Include graph-local structural diagnostics over the normalized topology. */\n\treadonly diagnostics?: boolean;\n\t/** Caller-supplied provenance only; environment enrichment stays outside Graph core (D177). */\n\treadonly provenance?: GraphBlueprintProvenance;\n}\n\nexport function normalizeTopologyMeta(\n\tmeta: Record<string, unknown>,\n\tlabel = \"meta\",\n\tkind = \"graph meta\",\n): Readonly<Record<string, GraphBlueprintJson>> {\n\ttry {\n\t\treturn assertStrictJsonObject(meta, label);\n\t} catch (error) {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthrow new TypeError(`${label}: ${kind} must be strict JSON-compatible data (D177): ${message}`);\n\t}\n}\n\nexport function normalizeTopology(\n\tsnapshot: GraphTopologySnapshot | NormalizedGraphTopologySnapshot,\n): NormalizedGraphTopologySnapshot {\n\treturn normalizeTopologySnapshot(snapshot as GraphTopologySnapshot, new WeakSet<object>(), \"$\");\n}\n\nfunction normalizeTopologySnapshot(\n\tsnapshot: GraphTopologySnapshot,\n\tseen: WeakSet<object>,\n\tpath: string,\n): NormalizedGraphTopologySnapshot {\n\tif (snapshot === null || typeof snapshot !== \"object\") {\n\t\tthrow new TypeError(`normalizeTopology: snapshot at ${path} must be an object`);\n\t}\n\tif (seen.has(snapshot)) {\n\t\tthrow new TypeError(`normalizeTopology: circular subgraph reference at ${path}`);\n\t}\n\tseen.add(snapshot);\n\ttry {\n\t\tconst nodes = mapDense(snapshot.nodes, `${path}.nodes`, (node, index) => {\n\t\t\tconst nodePath = `${path}.nodes[${index}]`;\n\t\t\tassertTopologyObject(node, nodePath);\n\t\t\tconst id = topologyString(node.id, `${nodePath}.id`);\n\t\t\tconst factory = topologyString(node.factory, `${nodePath}.factory`);\n\t\t\tconst out: NormalizedGraphTopologyNode = {\n\t\t\t\tid,\n\t\t\t\tfactory,\n\t\t\t\tdeps: mapDense(node.deps, `${labelForNode(id)}.deps`, (dep, depIndex) =>\n\t\t\t\t\ttopologyString(dep, `${labelForNode(id)}.deps[${depIndex}]`),\n\t\t\t\t),\n\t\t\t};\n\t\t\tif (node.name !== undefined) {\n\t\t\t\t(out as { name?: string }).name = topologyString(node.name, `${nodePath}.name`);\n\t\t\t}\n\t\t\tif (node.meta !== undefined) {\n\t\t\t\t(out as { meta?: Readonly<Record<string, GraphBlueprintJson>> }).meta =\n\t\t\t\t\tnormalizeTopologyMeta(node.meta, `${labelForNode(id)}.meta`);\n\t\t\t}\n\t\t\treturn out;\n\t\t}).sort(compareNodes);\n\t\tconst out: NormalizedGraphTopologySnapshot = {\n\t\t\tnodes,\n\t\t\tedges: deriveEdges(nodes),\n\t\t};\n\t\tif (snapshot.name !== undefined) {\n\t\t\t(out as { name?: string }).name = topologyString(snapshot.name, `${path}.name`);\n\t\t}\n\t\tif (snapshot.subgraphs !== undefined) {\n\t\t\t(out as { subgraphs?: readonly NormalizedGraphTopologySnapshot[] }).subgraphs = mapDense(\n\t\t\t\tsnapshot.subgraphs,\n\t\t\t\t`${path}.subgraphs`,\n\t\t\t\t(subgraph, index) =>\n\t\t\t\t\tnormalizeTopologySnapshot(subgraph, seen, `${path}.subgraphs[${index}]`),\n\t\t\t).sort(compareTopologies);\n\t\t}\n\t\treturn out;\n\t} finally {\n\t\tseen.delete(snapshot);\n\t}\n}\n\nfunction mapDense<T, U>(\n\tvalues: readonly T[],\n\tpath: string,\n\tmapper: (value: T, index: number) => U,\n): U[] {\n\tif (!Array.isArray(values)) {\n\t\tthrow new TypeError(`normalizeTopology: ${path} must be an array`);\n\t}\n\tconst out: U[] = [];\n\tfor (let i = 0; i < values.length; i += 1) {\n\t\tif (!(i in values)) {\n\t\t\tthrow new TypeError(`normalizeTopology: sparse array hole at ${path}[${i}]`);\n\t\t}\n\t\tout.push(mapper(values[i] as T, i));\n\t}\n\treturn out;\n}\n\nfunction assertTopologyObject(\n\tvalue: unknown,\n\tpath: string,\n): asserts value is Record<string, unknown> {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new TypeError(`normalizeTopology: ${path} must be an object`);\n\t}\n}\n\nfunction topologyString(value: unknown, path: string): string {\n\tif (typeof value !== \"string\") {\n\t\tthrow new TypeError(`normalizeTopology: ${path} must be a string`);\n\t}\n\treturn value;\n}\n\nexport function canonicalTopologyJson(\n\tsnapshot: GraphTopologySnapshot | NormalizedGraphTopologySnapshot,\n): string {\n\treturn stableJsonString(normalizeTopology(snapshot as GraphTopologySnapshot));\n}\n\nexport function canonicalTopologyBytes(\n\tsnapshot: GraphTopologySnapshot | NormalizedGraphTopologySnapshot,\n): Uint8Array {\n\treturn strictCanonicalJsonBytes(normalizeTopology(snapshot as GraphTopologySnapshot));\n}\n\nexport function withBlueprintHash(\n\tblueprint: GraphBlueprint,\n\toptions: GraphBlueprintHashOptions,\n): GraphBlueprint | Promise<GraphBlueprint> {\n\tif (typeof options.algorithm !== \"string\" || options.algorithm.length === 0) {\n\t\tthrow new TypeError(\"withBlueprintHash: algorithm must be a non-empty string\");\n\t}\n\tconst topology = normalizeTopology(blueprint.topology);\n\tconst withHash = (value: string): GraphBlueprint => {\n\t\tif (typeof value !== \"string\" || value.length === 0) {\n\t\t\tthrow new TypeError(\"withBlueprintHash: hash value must be a non-empty string\");\n\t\t}\n\t\treturn {\n\t\t\t...blueprint,\n\t\t\ttopology,\n\t\t\thash: {\n\t\t\t\tkind: \"topology\",\n\t\t\t\talgorithm: options.algorithm,\n\t\t\t\tinput: \"strictCanonicalTopologyBytes\",\n\t\t\t\tvalue,\n\t\t\t},\n\t\t};\n\t};\n\tconst value = options.hash(canonicalTopologyBytes(topology));\n\tif (typeof value !== \"string\" || value.length === 0) {\n\t\tconst maybeThenable = value as { then?: unknown } | null | undefined;\n\t\tif (\n\t\t\tmaybeThenable === null ||\n\t\t\tmaybeThenable === undefined ||\n\t\t\ttypeof maybeThenable.then !== \"function\"\n\t\t) {\n\t\t\tthrow new TypeError(\"withBlueprintHash: hash value must be a non-empty string\");\n\t\t}\n\t\treturn (value as Promise<string>).then(withHash);\n\t}\n\treturn withHash(value);\n}\n\nexport function withBlueprintProvenance(\n\tblueprint: GraphBlueprint,\n\tprovenance: GraphBlueprintProvenance,\n): GraphBlueprint {\n\treturn {\n\t\t...blueprint,\n\t\tprovenance: normalizeTopologyMeta(provenance, \"graph blueprint provenance\", \"provenance\"),\n\t};\n}\n\nexport function graphBlueprintDiagnostics(\n\ttopology: NormalizedGraphTopologySnapshot,\n): GraphBlueprintDiagnostics {\n\tconst issues: GraphBlueprintDiagnosticIssue[] = [];\n\tcollectDiagnostics(topology, issues);\n\tissues.sort(compareIssues);\n\treturn { ok: !issues.some((issue) => issue.severity === \"error\"), issues };\n}\n\nfunction collectDiagnostics(\n\ttopology: NormalizedGraphTopologySnapshot,\n\tissues: GraphBlueprintDiagnosticIssue[],\n): void {\n\tconst seen = new Set<string>();\n\tconst duplicateIds = new Set<string>();\n\tfor (const node of topology.nodes) {\n\t\tif (seen.has(node.id)) duplicateIds.add(node.id);\n\t\tseen.add(node.id);\n\t}\n\tfor (const id of duplicateIds) {\n\t\tissues.push({\n\t\t\tseverity: \"error\",\n\t\t\tcode: \"duplicate-node-id\",\n\t\t\tnodeId: id,\n\t\t\tmessage: `duplicate topology node id '${id}'`,\n\t\t});\n\t}\n\n\tconst dependents = new Map<string, number>();\n\tfor (const node of topology.nodes) dependents.set(node.id, 0);\n\tfor (const node of topology.nodes) {\n\t\tfor (const dep of node.deps) {\n\t\t\tif (!seen.has(dep)) {\n\t\t\t\tissues.push({\n\t\t\t\t\tseverity: \"error\",\n\t\t\t\t\tcode: \"dangling-dep\",\n\t\t\t\t\tnodeId: node.id,\n\t\t\t\t\tfrom: dep,\n\t\t\t\t\tto: node.id,\n\t\t\t\t\tmessage: `node '${node.id}' depends on missing node '${dep}'`,\n\t\t\t\t});\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tdependents.set(dep, (dependents.get(dep) ?? 0) + 1);\n\t\t}\n\t}\n\tfor (const node of topology.nodes) {\n\t\tif (node.deps.length === 0 && (dependents.get(node.id) ?? 0) === 0) {\n\t\t\tissues.push({\n\t\t\t\tseverity: \"warning\",\n\t\t\t\tcode: \"island-node\",\n\t\t\t\tnodeId: node.id,\n\t\t\t\tmessage: `node '${node.id}' has no deps and no dependents`,\n\t\t\t});\n\t\t}\n\t}\n\n\tfor (const subgraph of topology.subgraphs ?? []) collectDiagnostics(subgraph, issues);\n}\n\nfunction deriveEdges(nodes: readonly NormalizedGraphTopologyNode[]): GraphTopologyEdge[] {\n\tconst seen = new Set<string>();\n\tconst edges: GraphTopologyEdge[] = [];\n\tfor (const node of nodes) {\n\t\tfor (const from of node.deps) {\n\t\t\tconst key = `${from}\\0${node.id}`;\n\t\t\tif (seen.has(key)) continue;\n\t\t\tseen.add(key);\n\t\t\tedges.push({ from, to: node.id });\n\t\t}\n\t}\n\treturn edges.sort(compareEdges);\n}\n\nfunction labelForNode(id: string): string {\n\treturn id === \"\" ? \"node\" : `node '${id}'`;\n}\n\nfunction compareText(a: string, b: string): number {\n\treturn a < b ? -1 : a > b ? 1 : 0;\n}\n\nfunction compareNodes(a: NormalizedGraphTopologyNode, b: NormalizedGraphTopologyNode): number {\n\treturn compareText(a.id, b.id);\n}\n\nfunction compareEdges(a: GraphTopologyEdge, b: GraphTopologyEdge): number {\n\treturn compareText(a.from, b.from) || compareText(a.to, b.to);\n}\n\nfunction compareTopologies(\n\ta: NormalizedGraphTopologySnapshot,\n\tb: NormalizedGraphTopologySnapshot,\n): number {\n\treturn compareText(stableJsonString(a), stableJsonString(b));\n}\n\nfunction compareIssues(a: GraphBlueprintDiagnosticIssue, b: GraphBlueprintDiagnosticIssue): number {\n\treturn (\n\t\tcompareText(a.code, b.code) ||\n\t\tcompareText(a.nodeId ?? \"\", b.nodeId ?? \"\") ||\n\t\tcompareText(a.from ?? \"\", b.from ?? \"\") ||\n\t\tcompareText(a.to ?? \"\", b.to ?? \"\")\n\t);\n}\n","/**\n * topology()/describe() snapshot shapes (R-describe / D39 / D51 / D173).\n *\n * topology() is the current pure-structure snapshot direction (D173). describe()\n * remains the richer developer inspection snapshot over the same live topology\n * truth source, adding runtime status/value/version fields.\n */\n\nimport type { Status } from \"../node/node.js\";\nimport type { NodeVersion } from \"../node/versioning.js\";\n\nexport interface GraphTopologyNode {\n\t/** Stable mount-aware `::` path (auto-numbered when unnamed). Edge key. */\n\tid: string;\n\t/** Optional debug name. */\n\tname?: string;\n\t/** Operator/verb real name (D6/L1.5 — \"map\"/\"state\", not \"derived\"). */\n\tfactory: string;\n\t/** Dep ids (R-edges-derived: edges are a pure fn of live deps). */\n\tdeps: string[];\n\t/** Static annotations attached via g.* opts (R-meta-presentation). */\n\tmeta?: Record<string, unknown>;\n}\n\nexport interface GraphTopologyEdge {\n\tfrom: string;\n\tto: string;\n}\n\nexport interface GraphTopologySnapshot {\n\tname?: string;\n\tnodes: GraphTopologyNode[];\n\tedges: GraphTopologyEdge[];\n\tsubgraphs?: GraphTopologySnapshot[];\n}\n\nexport interface DescribeNode extends GraphTopologyNode {\n\t/** R-status-enum (7). */\n\tstatus: Status;\n\t/** Cache snapshot at call time; field ABSENT = SENTINEL / never-emitted. */\n\tvalue?: unknown;\n\t/** D109 node runtime version metadata; absent when versioning:false. */\n\tversion?: NodeVersion;\n}\n\nexport interface DescribeEdge extends GraphTopologyEdge {}\n\nexport interface DescribeSnapshot extends GraphTopologySnapshot {\n\tname?: string;\n\tnodes: DescribeNode[];\n\tedges: DescribeEdge[];\n\tsubgraphs?: DescribeSnapshot[];\n}\n\nexport interface DescribeOpts {\n\t/** Causal-chain mode: filter to nodes on a path from→to (R-describe). */\n\texplain?: { from: string; to: string };\n}\n\n/** Project a rich describe snapshot into the D173 pure-structure topology shape. */\nexport function topologyFromDescribe(snapshot: DescribeSnapshot): GraphTopologySnapshot {\n\tconst nodes = snapshot.nodes.map((node) => {\n\t\tconst topologyNode: GraphTopologyNode = {\n\t\t\tid: node.id,\n\t\t\tfactory: node.factory,\n\t\t\tdeps: [...node.deps],\n\t\t};\n\t\tif (node.name !== undefined) topologyNode.name = node.name;\n\t\tif (node.meta !== undefined) topologyNode.meta = cloneTopologyMeta(node.meta);\n\t\treturn topologyNode;\n\t});\n\tconst out: GraphTopologySnapshot = {\n\t\tnodes,\n\t\tedges: snapshot.edges.map((edge) => ({ from: edge.from, to: edge.to })),\n\t};\n\tif (snapshot.name !== undefined) out.name = snapshot.name;\n\tif (snapshot.subgraphs !== undefined)\n\t\tout.subgraphs = snapshot.subgraphs.map(topologyFromDescribe);\n\treturn out;\n}\n\nfunction cloneTopologyMeta(meta: Record<string, unknown>): Record<string, unknown> {\n\treturn cloneTopologyValue(meta, new WeakMap()) as Record<string, unknown>;\n}\n\nfunction cloneTopologyValue(value: unknown, seen: WeakMap<object, unknown>): unknown {\n\tif (value === null) return null;\n\tconst kind = typeof value;\n\tif (kind === \"string\" || kind === \"boolean\") return value;\n\tif (kind === \"number\") {\n\t\tif (!Number.isFinite(value)) {\n\t\t\tthrow new Error(\"topology(): meta must be finite JSON-compatible data (D39/D173)\");\n\t\t}\n\t\treturn value;\n\t}\n\tif (kind !== \"object\") {\n\t\tthrow new Error(\"topology(): meta must be JSON-compatible data (D39/D173)\");\n\t}\n\tconst objectValue = value as object;\n\tconst cached = seen.get(objectValue);\n\tif (cached !== undefined) return cached;\n\tif (Array.isArray(value)) {\n\t\tconst out = new Array<unknown>(value.length);\n\t\tseen.set(objectValue, out);\n\t\tfor (let i = 0; i < value.length; i += 1) {\n\t\t\tif (!(i in value)) {\n\t\t\t\tthrow new Error(\"topology(): meta arrays must be dense JSON-compatible data (D39/D173)\");\n\t\t\t}\n\t\t\tout[i] = cloneTopologyValue(value[i], seen);\n\t\t}\n\t\treturn out;\n\t}\n\tconst proto = Object.getPrototypeOf(objectValue);\n\tif (proto !== Object.prototype && proto !== null) {\n\t\tthrow new Error(\"topology(): meta must be plain JSON-compatible data (D39/D173)\");\n\t}\n\tconst out: Record<string, unknown> = {};\n\tseen.set(objectValue, out);\n\tfor (const [key, item] of Object.entries(value as Record<string, unknown>))\n\t\tout[key] = cloneTopologyValue(item, seen);\n\treturn out;\n}\n","import type { NodeFn } from \"../ctx/types.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Graph, StateNode } from \"./graph.js\";\nimport type { SugarOpts } from \"./graph-types.js\";\n\nexport interface GraphRestoreRegistrar {\n\tstateNode<T>(id: string, opts?: SugarOpts<T>): StateNode<T>;\n\tnode<T>(\n\t\tid: string,\n\t\tfactory: string,\n\t\tdeps: readonly Node<unknown>[],\n\t\tfn: NodeFn | null,\n\t\topts?: SugarOpts<T>,\n\t): Node<T>;\n}\n\nexport const restoreRegistrars = new WeakMap<Graph, GraphRestoreRegistrar>();\n\nexport interface GraphLifecycleRegistrar {\n\tassertRegisteredNode(node: Node<unknown>, label: string): void;\n\treleaseNodes(nodes: readonly Node<unknown>[], opts?: { reason?: string }): void;\n}\n\nexport const lifecycleRegistrars = new WeakMap<Graph, GraphLifecycleRegistrar>();\n","import { checkpointStateOfNode, type Node } from \"../node/node.js\";\nimport { type GraphCheckpointFactory, toCheckpointJson } from \"./checkpoint.js\";\nimport type { DescribeSnapshot } from \"./describe.js\";\nimport type { TopologyEvent } from \"./inspect.js\";\n\nexport function isNonAuthoritativeCollectionHelperMeta(\n\tmeta: Record<string, unknown> | undefined,\n): boolean {\n\treturn (\n\t\tmeta?.kind === \"collection_delta\" ||\n\t\tmeta?.kind === \"collection_intent\" ||\n\t\tmeta?.kind === \"collection_policy_apply\" ||\n\t\tmeta?.kind === \"collection_snapshot\" ||\n\t\tmeta?.kind === \"collection_snapshot_prep\"\n\t);\n}\n\nexport function assertCheckpointQuiescentStatus(status: string, id: string, op: string): void {\n\tif (status === \"pending\" || status === \"dirty\") {\n\t\tthrow new Error(\n\t\t\t`${op}: node '${id}' has non-quiescent status '${status}' that cannot be checkpoint-restored yet`,\n\t\t);\n\t}\n}\n\nexport function topologyPathMatches(eventPath: string, path: string): boolean {\n\treturn eventPath === path || eventPath.startsWith(`${path}::`);\n}\n\nexport function prefixTopologyPath(prefix: string, path: string): string {\n\treturn `${prefix}::${path}`;\n}\n\nexport function cloneTopologyEvent(event: TopologyEvent): TopologyEvent {\n\tconst deps = Object.freeze([...event.deps]);\n\tconst prevDeps = event.prevDeps === undefined ? undefined : Object.freeze([...event.prevDeps]);\n\treturn Object.freeze({\n\t\tkind: event.kind,\n\t\tpath: event.path,\n\t\tdeps,\n\t\t...(prevDeps !== undefined ? { prevDeps } : {}),\n\t\t...(event.factory !== undefined ? { factory: event.factory } : {}),\n\t\tseq: event.seq,\n\t});\n}\n\nexport function checkpointFactory(\n\tname: string,\n\tnode: Node<unknown>,\n\tunregistered: boolean,\n\trestore?: { ref: string; config?: unknown; configVersion?: unknown },\n\tmeta?: Record<string, unknown>,\n): GraphCheckpointFactory {\n\tconst state = checkpointStateOfNode(node);\n\tif (unregistered) {\n\t\treturn {\n\t\t\tkind: \"local-only\",\n\t\t\tname,\n\t\t\treason: \"node is an unregistered live dependency auto-discovered from topology\",\n\t\t};\n\t}\n\tif (\n\t\trestore === undefined &&\n\t\ttypeof meta?.kind === \"string\" &&\n\t\tmeta.kind.startsWith(\"collection_\")\n\t) {\n\t\treturn {\n\t\t\tkind: \"local-only\",\n\t\t\tname,\n\t\t\treason: \"collection helper node has no backend checkpoint restore metadata\",\n\t\t};\n\t}\n\tif (restore !== undefined) {\n\t\tconst out: GraphCheckpointFactory = {\n\t\t\tkind: \"registry-ref\",\n\t\t\tref: toCheckpointJson(restore.ref, `${name}.factory.ref`) as string,\n\t\t};\n\t\tif (restore.config !== undefined)\n\t\t\tout.config = toCheckpointJson(restore.config, `${name}.factory.config`);\n\t\tif (restore.configVersion !== undefined)\n\t\t\tout.configVersion = toCheckpointJson(restore.configVersion, `${name}.factory.configVersion`);\n\t\treturn out;\n\t}\n\tif (state.handle !== null) {\n\t\treturn {\n\t\t\tkind: \"local-only\",\n\t\t\tname,\n\t\t\treason: \"node uses a function body; first-cut checkpoints do not serialize local functions\",\n\t\t};\n\t}\n\treturn { kind: \"registry-ref\", ref: name };\n}\n\n/** Filter a snapshot to the causal chain from→to (forward-reachable(from) ∩ back-reachable(to)). */\nexport function explainSubset(\n\tsnap: DescribeSnapshot,\n\tchain: { from: string; to: string },\n): DescribeSnapshot {\n\tconst fwd = new Map<string, string[]>();\n\tconst rev = new Map<string, string[]>();\n\tconst push = (map: Map<string, string[]>, k: string, v: string): void => {\n\t\tconst a = map.get(k);\n\t\tif (a) a.push(v);\n\t\telse map.set(k, [v]);\n\t};\n\tfor (const e of snap.edges) {\n\t\tpush(fwd, e.from, e.to);\n\t\tpush(rev, e.to, e.from);\n\t}\n\tconst reach = (start: string, adj: Map<string, string[]>): Set<string> => {\n\t\tconst seen = new Set<string>([start]);\n\t\tconst stack = [start];\n\t\twhile (stack.length > 0) {\n\t\t\tconst cur = stack.pop() as string;\n\t\t\tfor (const nxt of adj.get(cur) ?? []) {\n\t\t\t\tif (!seen.has(nxt)) {\n\t\t\t\t\tseen.add(nxt);\n\t\t\t\t\tstack.push(nxt);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn seen;\n\t};\n\tconst onPath = new Set([...reach(chain.from, fwd)].filter((id) => reach(chain.to, rev).has(id)));\n\treturn {\n\t\t...(snap.name !== undefined ? { name: snap.name } : {}),\n\t\tnodes: snap.nodes.filter((n) => onPath.has(n.id)),\n\t\tedges: snap.edges.filter((e) => onPath.has(e.from) && onPath.has(e.to)),\n\t};\n}\n","import type { NodeFn } from \"../ctx/types.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { Graph, StateNode } from \"./graph.js\";\nimport { lifecycleRegistrars } from \"./graph-lifecycle.js\";\nimport type { DerivedFn, EffectFn, SugarOpts } from \"./graph-types.js\";\nimport type { Operator } from \"./operators.js\";\n\nexport interface TopologyGroupOptions {\n\t/** Optional inspection/release reason label for this graph-owned topology group. */\n\tname?: string;\n}\n\nexport interface TopologyGroupReleaseOptions {\n\t/** Optional diagnostic reason. No protocol/control messages are synthesized. */\n\treason?: string;\n}\n\n/**\n * Graph-owned D152 release group: a label over ordinary graph-registered nodes.\n * The graph registry remains the source of truth; helper-local membership is only\n * a memo for atomic quiescent release.\n */\nexport interface TopologyGroup {\n\treadonly name?: string;\n\treadonly released: boolean;\n\tadd<T extends Node<unknown>>(node: T): T;\n\tnode<T = unknown>(\n\t\tdeps?: readonly Node<unknown>[],\n\t\tfn?: NodeFn | null,\n\t\topts?: SugarOpts<T>,\n\t): Node<T>;\n\tstate<T>(initial: T, opts?: SugarOpts<T>): StateNode<T>;\n\tproducer<T = unknown>(fn: NodeFn, opts?: SugarOpts<T>): Node<T>;\n\tderived<const D extends readonly Node<unknown>[], T>(\n\t\tdeps: D,\n\t\tfn: DerivedFn<D, T>,\n\t\topts?: SugarOpts<T>,\n\t): Node<T>;\n\teffect<const D extends readonly Node<unknown>[]>(\n\t\tdeps: D,\n\t\tfn: EffectFn<D>,\n\t\topts?: SugarOpts<void>,\n\t): Node<void>;\n\tinitNode<TIn, TOut>(\n\t\top: Operator<TIn, TOut>,\n\t\tdeps: readonly Node<TIn>[],\n\t\topts?: SugarOpts<TOut>,\n\t): Node<TOut>;\n\trelease(opts?: TopologyGroupReleaseOptions): void;\n}\n\nexport class GraphTopologyGroup implements TopologyGroup {\n\treadonly name?: string;\n\tprivate readonly _graph: Graph;\n\tprivate readonly _members: Node<unknown>[] = [];\n\tprivate _released = false;\n\n\tconstructor(graph: Graph, opts: TopologyGroupOptions = {}) {\n\t\tthis._graph = graph;\n\t\tthis.name = opts.name;\n\t}\n\n\tget released(): boolean {\n\t\treturn this._released;\n\t}\n\n\tadd<T extends Node<unknown>>(node: T): T {\n\t\tthis._assertLive();\n\t\tconst lifecycle = lifecycleRegistrars.get(this._graph);\n\t\tif (lifecycle === undefined) throw new Error(\"topologyGroup: graph lifecycle unavailable\");\n\t\tlifecycle.assertRegisteredNode(node, `topology group '${this.name ?? \"group\"}' member`);\n\t\tif (!this._members.includes(node)) this._members.push(node);\n\t\treturn node;\n\t}\n\n\tnode<T = unknown>(\n\t\tdeps: readonly Node<unknown>[] = [],\n\t\tfn: NodeFn | null = null,\n\t\topts: SugarOpts<T> = {},\n\t): Node<T> {\n\t\tthis._assertLive();\n\t\treturn this.add(this._graph.node(deps, fn, opts));\n\t}\n\n\tstate<T>(initial: T, opts: SugarOpts<T> = {}): StateNode<T> {\n\t\tthis._assertLive();\n\t\treturn this.add(this._graph.state(initial, opts));\n\t}\n\n\tproducer<T = unknown>(fn: NodeFn, opts: SugarOpts<T> = {}): Node<T> {\n\t\tthis._assertLive();\n\t\treturn this.add(this._graph.producer(fn, opts));\n\t}\n\n\tderived<const D extends readonly Node<unknown>[], T>(\n\t\tdeps: D,\n\t\tfn: DerivedFn<D, T>,\n\t\topts: SugarOpts<T> = {},\n\t): Node<T> {\n\t\tthis._assertLive();\n\t\treturn this.add(this._graph.derived(deps, fn, opts));\n\t}\n\n\teffect<const D extends readonly Node<unknown>[]>(\n\t\tdeps: D,\n\t\tfn: EffectFn<D>,\n\t\topts: SugarOpts<void> = {},\n\t): Node<void> {\n\t\tthis._assertLive();\n\t\treturn this.add(this._graph.effect(deps, fn, opts));\n\t}\n\n\tinitNode<TIn, TOut>(\n\t\top: Operator<TIn, TOut>,\n\t\tdeps: readonly Node<TIn>[],\n\t\topts: SugarOpts<TOut> = {},\n\t): Node<TOut> {\n\t\tthis._assertLive();\n\t\treturn this.add(this._graph.initNode(op, deps, opts));\n\t}\n\n\trelease(opts: TopologyGroupReleaseOptions = {}): void {\n\t\tif (this._released) return;\n\t\tconst lifecycle = lifecycleRegistrars.get(this._graph);\n\t\tif (lifecycle === undefined) throw new Error(\"topologyGroup: graph lifecycle unavailable\");\n\t\tlifecycle.releaseNodes([...this._members], {\n\t\t\treason: opts.reason ?? this.name,\n\t\t});\n\t\tthis._members.length = 0;\n\t\tthis._released = true;\n\t}\n\n\tprivate _assertLive(): void {\n\t\tif (this._released) {\n\t\t\tthrow new Error(`topology group '${this.name ?? \"group\"}' has been released (D152)`);\n\t\t}\n\t}\n}\n","/**\n * The Graph layer (CSP-2): convenience + inspection entry (D5 / R-graph-role).\n *\n * g.* sugar desugars to dispatcher.register + Node and auto-registers into the graph\n * inspection index (D27: sugar→ctx-fn conversion lives strictly here; the substrate node\n * only ever sees `(ctx)=>void`). The Graph owns naming, describe, mount, and the D30\n * value-level throw→ERROR boundary. The bare node()/dispatcher stay inspection-free\n * (R-node-thin).\n *\n * Canonical authority: ~/src/graphrefly — D3/D5/D27/D30/D36/D37/D39, R-graph-role,\n * R-describe, R-fn-contract, R-edges-derived, R-meta-presentation.\n */\n\nimport { type BatchCtx, batch as batchRun } from \"../batch/batch.js\";\nimport { type Ctx, depCount, depLatest, type NodeFn } from \"../ctx/types.js\";\nimport { type Dispatcher, defaultDispatcher } from \"../dispatcher/index.js\";\nimport { NodeCore } from \"../node/core.js\";\nimport {\n\tcheckpointStateOfNode,\n\tgetNodeOwner,\n\tisNodeActiveForRelease,\n\tisNodeRuntimeQuiescentForRelease,\n\tisNodeRuntimeReleased,\n\tNode,\n\ttype NodeOptions,\n\treleaseRuntimeOfNode,\n\tsetNodeOwner,\n\tsetNodeTopologyDepsChangedObserver,\n\tsubscriberCountOfNode,\n\twithEnvironmentDrivers,\n\twithNodeCore,\n} from \"../node/node.js\";\nimport type { NodeVersioningPolicy } from \"../node/versioning.js\";\nimport { errorPayload, messageTier, SENTINEL } from \"../protocol/messages.js\";\nimport {\n\tGRAPH_BLUEPRINT_VERSION,\n\ttype GraphBlueprint,\n\ttype GraphBlueprintOptions,\n\tgraphBlueprintDiagnostics,\n\tnormalizeTopology,\n\tnormalizeTopologyMeta,\n} from \"./blueprint.js\";\nimport {\n\tcheckpointBackendStateOfNode,\n\tcheckpointTerminal,\n\tcheckpointValue,\n\tGRAPH_CHECKPOINT_VERSION,\n\ttype GraphCheckpoint,\n\ttype GraphCheckpointFactory,\n\ttype GraphCheckpointJson,\n\ttype GraphCheckpointNode,\n\ttoCheckpointJson,\n} from \"./checkpoint.js\";\nimport {\n\ttype DescribeEdge,\n\ttype DescribeNode,\n\ttype DescribeOpts,\n\ttype DescribeSnapshot,\n\ttype GraphTopologySnapshot,\n\ttopologyFromDescribe,\n} from \"./describe.js\";\nimport { EnvironmentDrivers } from \"./environment.js\";\nimport { lifecycleRegistrars, restoreRegistrars } from \"./graph-lifecycle.js\";\nimport {\n\tassertCheckpointQuiescentStatus,\n\tcheckpointFactory,\n\tcloneTopologyEvent,\n\texplainSubset,\n\tisNonAuthoritativeCollectionHelperMeta,\n\tprefixTopologyPath,\n\ttopologyPathMatches,\n} from \"./graph-support.js\";\nimport {\n\tGraphTopologyGroup,\n\ttype TopologyGroup,\n\ttype TopologyGroupOptions,\n} from \"./graph-topology-group.js\";\nimport type { DepValues, DerivedFn, EffectFn, GraphOptions, SugarOpts } from \"./graph-types.js\";\nimport type {\n\tNodeProfile,\n\tObserveStream,\n\tProfile,\n\tTopologyEvent,\n\tTopologyStream,\n} from \"./inspect.js\";\nimport { initNodeWithCore, type Operator } from \"./operators.js\";\n\nexport type {\n\tTopologyGroup,\n\tTopologyGroupOptions,\n\tTopologyGroupReleaseOptions,\n} from \"./graph-topology-group.js\";\nexport type { DerivedFn, EffectFn, GraphOptions, SugarOpts } from \"./graph-types.js\";\n\ninterface Entry {\n\tnode: Node<unknown>;\n\tid: string;\n\tname?: string;\n\tfactory: string;\n\tdeps: readonly Node<unknown>[];\n\tmeta?: Record<string, unknown>;\n\trestore?: { ref: string; config?: unknown; configVersion?: unknown };\n}\n\ninterface TopologyObserver {\n\tpath?: string;\n\tsink(event: TopologyEvent): void;\n}\n\ninterface MountedGraph {\n\tat: string;\n\tgraph: Graph;\n\ttopologyUnsub?: () => void;\n}\n\nfunction nodeOwner(n: Node<unknown>): Graph | undefined {\n\treturn getNodeOwner(n) as Graph | undefined;\n}\n\nexport function assertGraphLocalNode(owner: Graph, n: Node<unknown>, label: string): void {\n\tif (isNodeRuntimeReleased(n)) {\n\t\tthrow new Error(`${label} has been released from its graph lifecycle (D122)`);\n\t}\n\tconst existing = nodeOwner(n);\n\tif (existing !== undefined && existing !== owner) {\n\t\tthrow new Error(\n\t\t\t`${label} belongs to a different graph; cross-graph deps require a wire bridge`,\n\t\t);\n\t}\n}\n\n/**\n * A state node (L4-Q1): a manual source whose `.set(v)` is `node.down([[DATA, v]])` sugar.\n * Extends the substrate Node so it is usable as a dep AND carries the graph-layer `.set`.\n *\n * @example\n * ```ts\n * import { graph } from \"@graphrefly/ts\";\n *\n * const count = graph().state(0);\n * count.set(1);\n * ```\n * @category graph\n */\nexport class StateNode<T> extends Node<T> {\n\tset(v: T): void {\n\t\tthis.down([[\"DATA\", v]]);\n\t}\n}\n\n/**\n * Own a single graph-local topology, lifecycle, inspection index, and dispatcher boundary.\n *\n * @example\n * ```ts\n * import { graph } from \"@graphrefly/ts\";\n *\n * const g = graph({ name: \"counter\" });\n * const count = g.state(0, { name: \"count\" });\n * const doubled = g.derived([count], ([value]) => value * 2, { name: \"doubled\" });\n * ```\n * @remarks **Graph-local:** Cross-graph dependencies require a wire bridge; direct deps stay inside\n * one graph ownership domain.\n * @category graph\n */\nexport class Graph {\n\treadonly name?: string;\n\tprivate readonly _dispatcher: Dispatcher;\n\tprivate readonly _versioning: NodeVersioningPolicy | undefined;\n\tprivate readonly _environment: EnvironmentDrivers;\n\tprivate readonly _core = new NodeCore();\n\tprivate readonly _entries = new Map<Node<unknown>, Entry>();\n\tprivate readonly _byId = new Map<string, Node<unknown>>();\n\tprivate readonly _retiredIds = new Set<string>();\n\tprivate readonly _mounts: MountedGraph[] = [];\n\tprivate _seq = 0;\n\tprivate _clock = 0; // graph-local monotonic clock for observe seq (D26)\n\tprivate _topologyObserverSeq = 0;\n\tprivate readonly _topologyObservers = new Map<number, TopologyObserver>();\n\tprivate _topologyDelivering = false;\n\tprivate readonly _topologyQueue: TopologyEvent[] = [];\n\t// D51: stable synthetic ids for unregistered live deps (runtime *Map inners) auto-discovered by\n\t// describe(). WeakMap-cached so successive describes agree + the inner's id is freed when it is.\n\t// A dedicated counter (NOT _seq) so a describe() call never perturbs registered-node id numbering.\n\tprivate _synthSeq = 0;\n\tprivate readonly _synthIds = new WeakMap<Node<unknown>, string>();\n\n\tconstructor(opts: GraphOptions = {}) {\n\t\tthis.name = opts.name;\n\t\tthis._dispatcher = opts.dispatcher ?? defaultDispatcher;\n\t\tthis._versioning = opts.versioning;\n\t\tthis._environment = opts.environment ?? EnvironmentDrivers.empty();\n\t\tif (opts.profile) this._dispatcher.setRecording(true);\n\t\trestoreRegistrars.set(this, {\n\t\t\tstateNode: <T = unknown>(id: string, stateOpts: SugarOpts<T> = {}) => {\n\t\t\t\tconst n = this._construct(() => new StateNode<T>([], null, this._nodeOpts(stateOpts)));\n\t\t\t\tthis._addWithId(n, \"state\", [], stateOpts, id);\n\t\t\t\treturn n;\n\t\t\t},\n\t\t\tnode: <T = unknown>(\n\t\t\t\tid: string,\n\t\t\t\tfactory: string,\n\t\t\t\tdeps: readonly Node<unknown>[],\n\t\t\t\tfn: NodeFn | null,\n\t\t\t\tnodeOpts: SugarOpts<T> = {},\n\t\t\t) => {\n\t\t\t\tthis._assertDepsLocal(deps, `dep of restored '${id}'`);\n\t\t\t\tconst n = this._construct(() => new Node<T>([...deps], fn, this._nodeOpts(nodeOpts)));\n\t\t\t\tthis._addWithId(n, factory, deps, nodeOpts, id);\n\t\t\t\treturn n;\n\t\t\t},\n\t\t});\n\t\tlifecycleRegistrars.set(this, {\n\t\t\tassertRegisteredNode: (node, label) => this._assertRegisteredNode(node, label),\n\t\t\treleaseNodes: (nodes, releaseOpts) => this._releaseNodes(nodes, releaseOpts),\n\t\t});\n\t}\n\n\t// ── registration / inspection index ──\n\n\tprivate _add<T>(\n\t\tn: Node<T>,\n\t\tfactory: string,\n\t\tdeps: readonly Node<unknown>[],\n\t\topts: SugarOpts<T>,\n\t): Node<T> {\n\t\tconst id = opts.name ?? `${factory}#${this._seq++}`;\n\t\treturn this._addWithId(n, factory, deps, opts, id);\n\t}\n\n\tprivate _addWithId<T>(\n\t\tn: Node<T>,\n\t\tfactory: string,\n\t\tdeps: readonly Node<unknown>[],\n\t\topts: SugarOpts<T>,\n\t\tid: string,\n\t): Node<T> {\n\t\tassertGraphLocalNode(this, n as Node<unknown>, `graph node '${opts.name ?? factory}'`);\n\t\tfor (const dep of deps) assertGraphLocalNode(this, dep, `dep of '${opts.name ?? factory}'`);\n\t\tif (this._byId.has(id)) {\n\t\t\tthrow new Error(`graph: duplicate node id '${id}' (checkpoint/describe ids must be unique)`);\n\t\t}\n\t\tif (this._retiredIds.has(id)) {\n\t\t\tthrow new Error(`graph: node id '${id}' was released and cannot be reused (D152/D153)`);\n\t\t}\n\t\tconst meta =\n\t\t\topts.meta === undefined\n\t\t\t\t? undefined\n\t\t\t\t: (normalizeTopologyMeta(opts.meta, `graph node '${id}' meta`) as Record<string, unknown>);\n\t\tthis._entries.set(n as Node<unknown>, {\n\t\t\tnode: n as Node<unknown>,\n\t\t\tid,\n\t\t\tname: opts.name,\n\t\t\tfactory,\n\t\t\tdeps,\n\t\t\tmeta,\n\t\t\trestore: opts.restore,\n\t\t});\n\t\tsetNodeOwner(n as Node<unknown>, this);\n\t\tthis._byId.set(id, n as Node<unknown>);\n\t\tsetNodeTopologyDepsChangedObserver(n as Node<unknown>, (_node, prevDeps, nextDeps) => {\n\t\t\tthis._emitTopologyDepsChanged(n as Node<unknown>, prevDeps, nextDeps);\n\t\t});\n\t\tconst seqMatch = /#(\\d+)$/.exec(id);\n\t\tif (seqMatch) this._seq = Math.max(this._seq, Number(seqMatch[1]) + 1);\n\t\tthis._emitTopologyNodeRegistered(n as Node<unknown>);\n\t\treturn n;\n\t}\n\n\tprivate _assertDepsLocal(deps: readonly Node<unknown>[], label: string): void {\n\t\tfor (const dep of deps) assertGraphLocalNode(this, dep, label);\n\t}\n\n\tprivate _assertRegisteredNode(node: Node<unknown>, label: string): void {\n\t\tassertGraphLocalNode(this, node, label);\n\t\tif (!this._entries.has(node)) {\n\t\t\tthrow new Error(`${label} is not a registered graph node (D152)`);\n\t\t}\n\t}\n\n\tprivate _nodeOpts<T>(opts: SugarOpts<T>): NodeOptions<T> {\n\t\tif (opts.meta !== undefined) {\n\t\t\tnormalizeTopologyMeta(opts.meta, `graph node '${opts.name ?? opts.factory ?? \"node\"}' meta`);\n\t\t}\n\t\t// strip graph-only fields; inject the bound dispatcher\n\t\tconst { name: _n, meta: _m, restore: _r, ...rest } = opts;\n\t\treturn {\n\t\t\t...rest,\n\t\t\tversioning: rest.versioning ?? this._versioning,\n\t\t\tdispatcher: this._dispatcher,\n\t\t};\n\t}\n\n\tprivate _construct<TNode extends Node<unknown>>(create: () => TNode): TNode {\n\t\treturn withEnvironmentDrivers(this._environment, () => withNodeCore(this._core, create));\n\t}\n\n\t/** Look up a registered node by its id. */\n\tfind(id: string): Node<unknown> | undefined {\n\t\tconst local = this._byId.get(id);\n\t\tif (local !== undefined) return local;\n\t\tconst separator = id.indexOf(\"::\");\n\t\tif (separator < 0) return undefined;\n\t\tconst mountPath = id.slice(0, separator);\n\t\tconst childPath = id.slice(separator + 2);\n\t\treturn this._mounts.find((mount) => mount.at === mountPath)?.graph.find(childPath);\n\t}\n\n\tprivate _releaseNodes(nodes: readonly Node<unknown>[], _opts: { reason?: string } = {}): void {\n\t\tconst seen = new Set<Node<unknown>>();\n\t\tconst entries: Array<{ node: Node<unknown>; entry: Entry }> = [];\n\t\tfor (const node of nodes) {\n\t\t\tif (seen.has(node)) continue;\n\t\t\tseen.add(node);\n\t\t\tconst entry = this._entries.get(node);\n\t\t\tif (entry === undefined) continue;\n\t\t\tentries.push({ node, entry });\n\t\t}\n\t\tconst releaseSet = new Set(entries.map(({ node }) => node));\n\t\tconst releaseIds = new Map(entries.map(({ node, entry }) => [node, entry.id] as const));\n\t\tfor (const entry of this._entries.values()) {\n\t\t\tif (releaseSet.has(entry.node)) continue;\n\t\t\tfor (const dep of entry.node.deps) {\n\t\t\t\tif (!releaseSet.has(dep)) continue;\n\t\t\t\tconst depId = releaseIds.get(dep) ?? dep.name ?? dep.factory ?? \"released node\";\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`graph: cannot release node group; '${entry.id}' still depends on '${depId}' (D122)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tfor (const { node, entry } of entries) {\n\t\t\tif (!isNodeRuntimeQuiescentForRelease(node)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`graph: cannot release node group; '${entry.id}' is not runtime-quiescent (D124)`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tlet internalSubscribers = 0;\n\t\t\tfor (const { node: dependent } of entries) {\n\t\t\t\tif (dependent === node || !isNodeActiveForRelease(dependent)) continue;\n\t\t\t\tfor (const dep of dependent.deps) {\n\t\t\t\t\tif (dep === node) internalSubscribers += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (subscriberCountOfNode(node) > internalSubscribers) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`graph: cannot release node group; '${entry.id}' still has live subscribers (D124)`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\tconst releasedEvents =\n\t\t\tthis._topologyObservers.size === 0\n\t\t\t\t? []\n\t\t\t\t: entries.map(({ node, entry }) => ({\n\t\t\t\t\t\tpath: entry.id,\n\t\t\t\t\t\tfactory: entry.factory,\n\t\t\t\t\t\tdeps: this._topologyDeps(node.deps),\n\t\t\t\t\t}));\n\t\tfor (const { node, entry } of entries) {\n\t\t\tthis._entries.delete(node);\n\t\t\tthis._byId.delete(entry.id);\n\t\t\tthis._retiredIds.add(entry.id);\n\t\t}\n\t\tlet releaseError: unknown;\n\t\tfor (const { node } of entries) {\n\t\t\ttry {\n\t\t\t\treleaseRuntimeOfNode(node);\n\t\t\t} catch (error) {\n\t\t\t\tif (releaseError === undefined) releaseError = error;\n\t\t\t}\n\t\t}\n\t\tfor (const event of releasedEvents) this._emitTopologyNodeReleased(event);\n\t\tif (releaseError !== undefined) throw releaseError;\n\t}\n\n\t// ── 8 verbs (core: node/state/batch + sugar: producer/derived/effect/mount) ──\n\n\t/** ctx-level power surface: a raw `(ctx)=>void` fn (or a passthrough/state when null). */\n\tnode<T = unknown>(\n\t\tdeps: readonly Node<unknown>[] = [],\n\t\tfn: NodeFn | null = null,\n\t\topts: SugarOpts<T> = {},\n\t): Node<T> {\n\t\tthis._assertDepsLocal(deps, `dep of '${opts.name ?? \"node\"}'`);\n\t\tconst n = this._construct(() => new Node<T>(deps as Node<unknown>[], fn, this._nodeOpts(opts)));\n\t\treturn this._add(n, opts.factory ?? \"node\", deps, opts);\n\t}\n\n\t/** A manual source with `.set(v)` (L4-Q1). */\n\tstate<T>(initial: T, opts: SugarOpts<T> = {}): StateNode<T> {\n\t\tconst n = this._construct(\n\t\t\t() => new StateNode<T>([], null, { ...this._nodeOpts(opts), initial }),\n\t\t);\n\t\tthis._add(n, \"state\", [], opts);\n\t\treturn n;\n\t}\n\n\t/** ctx-level depless source; its fn runs on activation (R-rom-ram). */\n\tproducer<T = unknown>(fn: NodeFn, opts: SugarOpts<T> = {}): Node<T> {\n\t\tconst n = this._construct(() => new Node<T>([], fn, this._nodeOpts(opts)));\n\t\treturn this._add(n, \"producer\", [], opts);\n\t}\n\n\t/** value-level pure transform: deps → value (D27 wrapped; D30 throw→ERROR). */\n\tderived<const D extends readonly Node<unknown>[], T>(\n\t\tdeps: D,\n\t\tfn: DerivedFn<D, T>,\n\t\topts: SugarOpts<T> = {},\n\t): Node<T> {\n\t\tthis._assertDepsLocal(deps, `dep of '${opts.name ?? \"derived\"}'`);\n\t\tconst ctxFn: NodeFn = (ctx: Ctx) => {\n\t\t\ttry {\n\t\t\t\tconst args = Array.from({ length: depCount(ctx) }, (_, i) =>\n\t\t\t\t\tdepLatest(ctx, i),\n\t\t\t\t) as DepValues<D>;\n\t\t\t\tconst result = fn(...args);\n\t\t\t\tif (result !== undefined) ctx.down([[\"DATA\", result]]);\n\t\t\t} catch (e) {\n\t\t\t\tctx.down([[\"ERROR\", errorPayload(e, \"derived threw without a valid error payload\")]]); // D30: value-level throw → graph-layer ERROR\n\t\t\t}\n\t\t};\n\t\tconst n = this._construct(() => new Node<T>([...deps], ctxFn, this._nodeOpts(opts)));\n\t\treturn this._add(n, \"derived\", deps, opts);\n\t}\n\n\t/** value-level sink: deps → effect; return value (a fn) becomes onDeactivation (D28). */\n\teffect<const D extends readonly Node<unknown>[]>(\n\t\tdeps: D,\n\t\tfn: EffectFn<D>,\n\t\topts: SugarOpts<void> = {},\n\t): Node<void> {\n\t\tthis._assertDepsLocal(deps, `dep of '${opts.name ?? \"effect\"}'`);\n\t\t// effect cleanup = deactivation-only (D28 / Flag 3): the LATEST returned cleanup\n\t\t// fires ONCE when the effect deactivates (not between re-runs — onRerun was cut).\n\t\t// R-cleanup-hooks per-run lifecycle (D28 clarification / C-14): the substrate clears\n\t\t// the hook list before EACH fn run, so the effect re-registers its returned cleanup\n\t\t// every run — only the latest run's registration is live (or none, if the latest run\n\t\t// returned void). No st.registered/ctx.state bookkeeping; re-registering every run is\n\t\t// safe (the per-run clear prevents accumulation).\n\t\tconst ctxFn: NodeFn = (ctx: Ctx) => {\n\t\t\ttry {\n\t\t\t\tconst args = Array.from({ length: depCount(ctx) }, (_, i) =>\n\t\t\t\t\tdepLatest(ctx, i),\n\t\t\t\t) as DepValues<D>;\n\t\t\t\tconst cleanup = fn(...args);\n\t\t\t\tif (typeof cleanup === \"function\") ctx.onDeactivation(cleanup);\n\t\t\t} catch (e) {\n\t\t\t\tctx.down([[\"ERROR\", errorPayload(e, \"effect threw without a valid error payload\")]]);\n\t\t\t}\n\t\t};\n\t\tconst n = this._construct(() => new Node<void>([...deps], ctxFn, this._nodeOpts(opts)));\n\t\treturn this._add(n, \"effect\", deps, opts);\n\t}\n\n\t/** Declarative batch (D12): one wave, success→commit / throw→rollback. */\n\tbatch<T>(fn: (bctx: BatchCtx) => T): T {\n\t\treturn batchRun(fn);\n\t}\n\n\t/** Embed a child graph addressable under `at` (R-mount; mount has no deps). */\n\tmount(child: Graph, opts: { at: string }): void {\n\t\tconst mount = { at: opts.at, graph: child };\n\t\tthis._mounts.push(mount);\n\t\tif (this._topologyObservers.size > 0) this._ensureMountedTopologyForwarders();\n\t\tthis._emitTopologyMountChanged(opts.at);\n\t}\n\n\t// ── operator funnel (D43): instantiate any free-standing Operator (node sugar, D6/L1.5) ──\n\t// g.initNode is the single graph-bound entry for the whole operator/source catalog (D40):\n\t// it delegates to the FREE initNode (graph/operators.ts — the D30 throw→ERROR boundary +\n\t// dispatcher binding live there) and records the operator's REAL factory name in the\n\t// inspection index (_add) so describe shows it (D6/R-describe) while the node stays thin\n\t// (R-node-thin). Operators are free-standing factory definitions (graph/operators.ts,\n\t// graph/sources.ts) usable bare via the free initNode(); this funnel is the inspectable\n\t// path. Replaces the per-operator methods.\n\n\t/**\n\t * Instantiate an operator (or source) factory as a registered graph node. `deps` are\n\t * type-checked against the operator's input element type; the output type flows from the\n\t * operator. A source is a depless operator — pass `[]`. Caller `opts` (name/meta/behavioral\n\t * overrides) win over the operator's baked-in `opts`.\n\t */\n\tinitNode<TIn, TOut>(\n\t\top: Operator<TIn, TOut>,\n\t\tdeps: readonly Node<TIn>[],\n\t\topts: SugarOpts<TOut> = {},\n\t): Node<TOut> {\n\t\tconst entryOpts =\n\t\t\top.restore !== undefined && !(\"restore\" in opts) ? { ...opts, restore: op.restore } : opts;\n\t\tfor (const dep of deps as readonly Node<unknown>[])\n\t\t\tassertGraphLocalNode(this, dep, `dep of '${entryOpts.name ?? op.factory}'`);\n\t\t// Node<T> is invariant (T appears in NodeOptions.initial); widen the typed deps to the\n\t\t// erased Node surface the free initNode / _add accept (same cast the old methods used).\n\t\tconst erased = deps as readonly Node<unknown>[];\n\t\tconst n = withEnvironmentDrivers(this._environment, () =>\n\t\t\tinitNodeWithCore(this._core, op, erased, this._nodeOpts(entryOpts)),\n\t\t);\n\t\treturn this._add(n, op.factory, erased, entryOpts);\n\t}\n\n\t/**\n\t * Graph-owned activation root for internal helper nodes. This is the sanctioned keepalive shape:\n\t * a graph, not a helper closure, owns the subscription and returns the release handle.\n\t */\n\tretain<T>(node: Node<T>, opts: { reason?: string } = {}): () => void {\n\t\tassertGraphLocalNode(this, node as Node<unknown>, opts.reason ?? \"retained node\");\n\t\treturn node.subscribe(() => {});\n\t}\n\n\t/**\n\t * D152 graph-owned topology/release group. Members are ordinary registered graph nodes;\n\t * release is quiescent-only and removes ids atomically without synthesizing protocol messages.\n\t */\n\ttopologyGroup(opts: TopologyGroupOptions = {}): TopologyGroup {\n\t\treturn new GraphTopologyGroup(this, opts);\n\t}\n\n\t// ── inspection: describe / observe / profile (D39) ──\n\n\t/** Live point-in-time structure snapshot (R-describe / D39 / D51). `_prefix` carries the mount path. */\n\tdescribe(opts: DescribeOpts = {}, _prefix = \"\"): DescribeSnapshot {\n\t\t// D51: edges derive from each node's CURRENT/LIVE deps (entry.node.deps, NOT the\n\t\t// construction-time entry.deps), so a rewire (C-8 immediate / C-11 *Map deferred) is\n\t\t// reflected and every edge is a real current subscription (D3). A live dep absent from this\n\t\t// graph's index (a runtime *Map inner / bare fromAny node) is AUTO-DISCOVERED as a snapshot\n\t\t// node with a synthesized stable id (B2). B38 extends this to transitive live-reachability:\n\t\t// discovered unregistered nodes are recursively expanded through their own live deps.\n\t\tconst discovered = new Map<Node<unknown>, string>(); // unregistered live dep → synth local id\n\t\tconst localId = (n: Node<unknown>): string => {\n\t\t\tconst e = this._entries.get(n);\n\t\t\tif (e) return `${_prefix}${e.id}`;\n\t\t\t// unregistered: a stable synthetic id, cached so successive describes + both call sites\n\t\t\t// agree; the `~` prefix can't collide with a registered name or `factory#seq`.\n\t\t\tlet sid = this._synthIds.get(n);\n\t\t\tif (sid === undefined) {\n\t\t\t\t// the `~` prefix avoids the registered `name`/`factory#seq` space; guard the\n\t\t\t\t// pathological case of a user node literally named `~factory#n` (bump until free).\n\t\t\t\tdo {\n\t\t\t\t\tsid = `~${n.factory ?? \"?\"}#${this._synthSeq++}`;\n\t\t\t\t} while (this._byId.has(sid));\n\t\t\t\tthis._synthIds.set(n, sid);\n\t\t\t}\n\t\t\tdiscovered.set(n, sid);\n\t\t\treturn `${_prefix}${sid}`;\n\t\t};\n\t\tconst nodes: DescribeNode[] = [];\n\t\tconst edges: DescribeEdge[] = [];\n\t\t// pass 1: registered nodes, reading LIVE deps (localId records any unregistered inner).\n\t\tfor (const entry of this._entries.values()) {\n\t\t\tconst id = `${_prefix}${entry.id}`;\n\t\t\tconst liveIds = entry.node.deps.map(localId);\n\t\t\tconst dnode: DescribeNode = {\n\t\t\t\tid,\n\t\t\t\tfactory: entry.factory,\n\t\t\t\tstatus: entry.node.status,\n\t\t\t\tdeps: liveIds,\n\t\t\t};\n\t\t\tif (entry.name !== undefined) dnode.name = entry.name;\n\t\t\tif (entry.node.cache !== undefined) dnode.value = entry.node.cache; // absent = SENTINEL\n\t\t\tif (entry.node.version !== undefined) dnode.version = entry.node.version;\n\t\t\tif (entry.meta !== undefined) dnode.meta = entry.meta;\n\t\t\tnodes.push(dnode);\n\t\t\tfor (const from of liveIds) edges.push({ from, to: id });\n\t\t}\n\t\t// pass 2: recursively emit auto-discovered unregistered nodes (D51+B38). localId() may add\n\t\t// further unregistered deps to `discovered` while this loop runs; a visited set keeps each\n\t\t// discovered node emitted once (stable ids via _synthIds).\n\t\tconst visited = new Set<Node<unknown>>();\n\t\tconst queue: Node<unknown>[] = [...discovered.keys()];\n\t\tfor (let i = 0; i < queue.length; i += 1) {\n\t\t\tconst inner = queue[i];\n\t\t\tif (visited.has(inner)) continue;\n\t\t\tvisited.add(inner);\n\t\t\tconst sid = discovered.get(inner);\n\t\t\tif (sid === undefined) continue;\n\t\t\tconst liveIds = inner.deps.map(localId);\n\t\t\tfor (const dep of inner.deps) {\n\t\t\t\tif (!this._entries.has(dep) && !visited.has(dep)) queue.push(dep);\n\t\t\t}\n\t\t\tconst dnode: DescribeNode = {\n\t\t\t\tid: `${_prefix}${sid}`,\n\t\t\t\tfactory: inner.factory ?? \"?\",\n\t\t\t\tstatus: inner.status,\n\t\t\t\tdeps: liveIds,\n\t\t\t};\n\t\t\tif (inner.cache !== undefined) dnode.value = inner.cache;\n\t\t\tif (inner.version !== undefined) dnode.version = inner.version;\n\t\t\tnodes.push(dnode);\n\t\t\tfor (const from of liveIds) edges.push({ from, to: dnode.id });\n\t\t}\n\t\tconst snap: DescribeSnapshot = { nodes, edges };\n\t\tif (this.name !== undefined) snap.name = this.name;\n\t\tif (this._mounts.length > 0) {\n\t\t\tsnap.subgraphs = this._mounts.map((m) => m.graph.describe({}, `${_prefix}${m.at}::`));\n\t\t}\n\t\treturn opts.explain ? explainSubset(snap, opts.explain) : snap;\n\t}\n\n\t/**\n\t * D173 pure-structure topology snapshot over the same live truth source as describe().\n\t * Runtime status/value/version remain on describe(); blueprint metadata is a later envelope.\n\t */\n\ttopology(): GraphTopologySnapshot {\n\t\treturn topologyFromDescribe(this.describe());\n\t}\n\n\t/**\n\t * D177 synchronous audit/collaboration envelope over the pure topology snapshot.\n\t * Hashing and environment provenance enrichment stay in pure helpers outside Graph core.\n\t */\n\tblueprint(opts: GraphBlueprintOptions = {}): GraphBlueprint {\n\t\tconst topology = normalizeTopology(this.topology());\n\t\tconst out: GraphBlueprint = {\n\t\t\tversion: GRAPH_BLUEPRINT_VERSION,\n\t\t\ttopology,\n\t\t};\n\t\tif (opts.diagnostics) {\n\t\t\t(out as { diagnostics?: ReturnType<typeof graphBlueprintDiagnostics> }).diagnostics =\n\t\t\t\tgraphBlueprintDiagnostics(topology);\n\t\t}\n\t\tif (opts.provenance !== undefined) {\n\t\t\t(out as { provenance?: GraphBlueprint[\"provenance\"] }).provenance = normalizeTopologyMeta(\n\t\t\t\topts.provenance,\n\t\t\t\t\"graph blueprint provenance\",\n\t\t\t\t\"provenance\",\n\t\t\t);\n\t\t}\n\t\treturn out;\n\t}\n\n\tprivate _observeTargets(path?: string): Array<[string, Node<unknown>]> {\n\t\tconst all: Array<[string, Node<unknown>]> = [...this._entries.values()].map((e) => [\n\t\t\te.id,\n\t\t\te.node,\n\t\t]);\n\t\tif (path === undefined) return all; // whole graph\n\t\tconst exact = this._byId.get(path);\n\t\tif (exact) return [[path, exact]]; // single node\n\t\treturn all.filter(([id]) => id.startsWith(`${path}::`)); // subtree (mount-aware :: boundary, QA A-1)\n\t}\n\n\t/**\n\t * observe(path?) = read-only enveloped EGRESS (R-observe / D39). NOT a graph node — it\n\t * taps the target node(s) via subscribe and forwards each Message as an ObserveEvent.\n\t * No path = whole graph; an exact id = a single node; otherwise a `::`-prefix subtree.\n\t */\n\t// NOTE (R-observe/D19): observe is a real, lazily-ACTIVATING subscriber — observing a\n\t// cold node runs its fn (and activates upstream); whole-graph observe() activates the\n\t// graph. \"Read-only\" means it never emits/mutates node state, NOT that it avoids\n\t// activation. Use it knowing inspection of a cold graph wakes it.\n\tobserve(path?: string): ObserveStream {\n\t\tconst targets = this._observeTargets(path);\n\t\treturn {\n\t\t\tsubscribe: (sink) => {\n\t\t\t\tconst unsubs = targets.map(([id, n]) =>\n\t\t\t\t\tn.subscribe((msg) => {\n\t\t\t\t\t\tsink({ path: id, msg, tier: messageTier(msg[0]), seq: this._clock++ });\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\treturn () => {\n\t\t\t\t\tfor (const u of unsubs) u();\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\t/**\n\t * D145 observeTopology(path?) = read-only graph lifecycle egress over the existing\n\t * graph registry. It is not a graph node, does not subscribe to nodes, and emits no DATA.\n\t */\n\tobserveTopology(path?: string): TopologyStream {\n\t\treturn {\n\t\t\tsubscribe: (sink) => {\n\t\t\t\tconst id = this._topologyObserverSeq++;\n\t\t\t\tthis._topologyObservers.set(id, { path, sink });\n\t\t\t\tthis._ensureMountedTopologyForwarders();\n\t\t\t\treturn () => {\n\t\t\t\t\tthis._topologyObservers.delete(id);\n\t\t\t\t\tif (this._topologyObservers.size === 0) this._releaseMountedTopologyForwarders();\n\t\t\t\t};\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate _idForTopologyNode(n: Node<unknown>): string {\n\t\tconst e = this._entries.get(n);\n\t\tif (e) return e.id;\n\t\tlet sid = this._synthIds.get(n);\n\t\tif (sid === undefined) {\n\t\t\tdo {\n\t\t\t\tsid = `~${n.factory ?? \"?\"}#${this._synthSeq++}`;\n\t\t\t} while (this._byId.has(sid));\n\t\t\tthis._synthIds.set(n, sid);\n\t\t}\n\t\treturn sid;\n\t}\n\n\tprivate _topologyDeps(deps: readonly Node<unknown>[]): string[] {\n\t\treturn deps.map((dep) => this._idForTopologyNode(dep));\n\t}\n\n\tprivate _emitTopologyNodeRegistered(node: Node<unknown>): void {\n\t\tif (this._topologyObservers.size === 0) return;\n\t\tconst entry = this._entries.get(node);\n\t\tif (entry === undefined) return;\n\t\tthis._emitTopologyEvent({\n\t\t\tkind: \"node-registered\",\n\t\t\tpath: entry.id,\n\t\t\tfactory: entry.factory,\n\t\t\tdeps: this._topologyDeps(node.deps),\n\t\t\tseq: this._clock++,\n\t\t});\n\t}\n\n\tprivate _emitTopologyDepsChanged(\n\t\tnode: Node<unknown>,\n\t\tprevDeps: readonly Node<unknown>[],\n\t\tnextDeps: readonly Node<unknown>[],\n\t): void {\n\t\tif (this._topologyObservers.size === 0) return;\n\t\tconst entry = this._entries.get(node);\n\t\tif (entry === undefined) return;\n\t\tthis._emitTopologyEvent({\n\t\t\tkind: \"deps-changed\",\n\t\t\tpath: entry.id,\n\t\t\tprevDeps: this._topologyDeps(prevDeps),\n\t\t\tdeps: this._topologyDeps(nextDeps),\n\t\t\tseq: this._clock++,\n\t\t});\n\t}\n\n\tprivate _emitTopologyNodeReleased(event: {\n\t\tpath: string;\n\t\tfactory: string;\n\t\tdeps: readonly string[];\n\t}): void {\n\t\tif (this._topologyObservers.size === 0) return;\n\t\tthis._emitTopologyEvent({\n\t\t\tkind: \"node-released\",\n\t\t\tpath: event.path,\n\t\t\tfactory: event.factory,\n\t\t\tdeps: [...event.deps],\n\t\t\tseq: this._clock++,\n\t\t});\n\t}\n\n\tprivate _emitTopologyMountChanged(path: string): void {\n\t\tif (this._topologyObservers.size === 0) return;\n\t\tthis._emitTopologyEvent({\n\t\t\tkind: \"mount-changed\",\n\t\t\tpath,\n\t\t\tfactory: \"mount\",\n\t\t\tdeps: [],\n\t\t\tseq: this._clock++,\n\t\t});\n\t}\n\n\tprivate _ensureMountedTopologyForwarders(): void {\n\t\tif (this._topologyObservers.size === 0) return;\n\t\tfor (const mount of this._mounts) {\n\t\t\tif (mount.topologyUnsub !== undefined) continue;\n\t\t\tconst mountPath = mount.at;\n\t\t\tmount.topologyUnsub = mount.graph.observeTopology().subscribe((event) => {\n\t\t\t\tthis._emitMountedTopologyEvent(mountPath, event);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate _releaseMountedTopologyForwarders(): void {\n\t\tfor (const mount of this._mounts) {\n\t\t\tmount.topologyUnsub?.();\n\t\t\tmount.topologyUnsub = undefined;\n\t\t}\n\t}\n\n\tprivate _emitMountedTopologyEvent(mountPath: string, event: TopologyEvent): void {\n\t\tif (this._topologyObservers.size === 0) return;\n\t\tthis._emitTopologyEvent({\n\t\t\tkind: event.kind,\n\t\t\tpath: prefixTopologyPath(mountPath, event.path),\n\t\t\tdeps: event.deps.map((dep) => prefixTopologyPath(mountPath, dep)),\n\t\t\t...(event.prevDeps !== undefined\n\t\t\t\t? { prevDeps: event.prevDeps.map((dep) => prefixTopologyPath(mountPath, dep)) }\n\t\t\t\t: {}),\n\t\t\t...(event.factory !== undefined ? { factory: event.factory } : {}),\n\t\t\tseq: this._clock++,\n\t\t});\n\t}\n\n\tprivate _emitTopologyEvent(event: TopologyEvent): void {\n\t\tif (this._topologyDelivering) {\n\t\t\tthis._topologyQueue.push(event);\n\t\t\treturn;\n\t\t}\n\t\tthis._topologyDelivering = true;\n\t\ttry {\n\t\t\tlet current: TopologyEvent | undefined = event;\n\t\t\twhile (current !== undefined) {\n\t\t\t\tconst observers = [...this._topologyObservers.entries()];\n\t\t\t\tfor (const [id, observer] of observers) {\n\t\t\t\t\tif (this._topologyObservers.get(id) !== observer) continue;\n\t\t\t\t\tif (observer.path !== undefined && !topologyPathMatches(current.path, observer.path))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tobserver.sink(cloneTopologyEvent(current));\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// D145 egress is read-only inspection; observer failure must not veto a\n\t\t\t\t\t\t// graph registry/rewire mutation that already committed.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcurrent = this._topologyQueue.shift();\n\t\t\t}\n\t\t} finally {\n\t\t\tthis._topologyDelivering = false;\n\t\t}\n\t}\n\n\t/**\n\t * profile() = accumulated-counter snapshot (R-profile / D39). invokes + duration are\n\t * dispatcher-backed (the invoke funnel, F-DISPATCH-ALL) — counters never live on the\n\t * thin node (R-node-thin). Requires `graph({ profile: true })` (opt-in, F-PERF).\n\t */\n\tprofile(): Profile {\n\t\tconst nodes: Record<string, NodeProfile> = {};\n\t\tlet totalInvokes = 0;\n\t\tfor (const e of this._entries.values()) {\n\t\t\tconst h = e.node.handle;\n\t\t\tconst stat = h ? this._dispatcher.statFor(h) : undefined;\n\t\t\tconst invokes = stat?.invokes ?? 0;\n\t\t\tnodes[e.id] = {\n\t\t\t\tinvokes,\n\t\t\t\ttotalDurationNs: stat?.totalDurationNs ?? 0,\n\t\t\t\tlastDurationNs: stat?.lastDurationNs ?? 0,\n\t\t\t\tstatus: e.node.status,\n\t\t\t};\n\t\t\t// graph-scoped (QA D-2): sum THIS graph's nodes, NOT the dispatcher-global\n\t\t\t// counter (which would leak invokes from other graphs sharing the dispatcher).\n\t\t\ttotalInvokes += invokes;\n\t\t}\n\t\treturn { totalInvokes, nodes };\n\t}\n\n\t/** Versioned graph lifecycle checkpoint (R-snapshot / D83 / D90). Pure capture, no storage I/O. */\n\tcheckpoint(): GraphCheckpoint {\n\t\treturn this._checkpoint(\"\", new WeakSet());\n\t}\n\n\tprivate _checkpoint(_prefix: string, stack: WeakSet<Graph>): GraphCheckpoint {\n\t\tif (stack.has(this)) {\n\t\t\tthrow new Error(\"checkpoint: cyclic graph mount detected\");\n\t\t}\n\t\tstack.add(this);\n\t\tconst discovered = new Map<Node<unknown>, string>();\n\t\tconst localId = (n: Node<unknown>): string => {\n\t\t\tconst e = this._entries.get(n);\n\t\t\tif (e) return `${_prefix}${e.id}`;\n\t\t\tlet sid = this._synthIds.get(n);\n\t\t\tif (sid === undefined) {\n\t\t\t\tdo {\n\t\t\t\t\tsid = `~${n.factory ?? \"?\"}#${this._synthSeq++}`;\n\t\t\t\t} while (this._byId.has(sid));\n\t\t\t\tthis._synthIds.set(n, sid);\n\t\t\t}\n\t\t\tdiscovered.set(n, sid);\n\t\t\treturn `${_prefix}${sid}`;\n\t\t};\n\t\tconst nodes: GraphCheckpointNode[] = [];\n\t\tconst edges: DescribeEdge[] = [];\n\t\tfor (const entry of this._entries.values()) {\n\t\t\tconst id = `${_prefix}${entry.id}`;\n\t\t\tconst liveIds = entry.node.deps.map(localId);\n\t\t\tnodes.push(\n\t\t\t\tthis._checkpointNode(entry.node, id, {\n\t\t\t\t\tname: entry.name,\n\t\t\t\t\tfactory: checkpointFactory(entry.factory, entry.node, false, entry.restore, entry.meta),\n\t\t\t\t\tdeps: liveIds,\n\t\t\t\t\tmeta: entry.meta,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tfor (const from of liveIds) edges.push({ from, to: id });\n\t\t}\n\t\tconst visited = new Set<Node<unknown>>();\n\t\tconst queue: Node<unknown>[] = [...discovered.keys()];\n\t\tfor (let i = 0; i < queue.length; i += 1) {\n\t\t\tconst inner = queue[i];\n\t\t\tif (visited.has(inner)) continue;\n\t\t\tvisited.add(inner);\n\t\t\tconst sid = discovered.get(inner);\n\t\t\tif (sid === undefined) continue;\n\t\t\tconst liveIds = inner.deps.map(localId);\n\t\t\tfor (const dep of inner.deps) {\n\t\t\t\tif (!this._entries.has(dep) && !visited.has(dep)) queue.push(dep);\n\t\t\t}\n\t\t\tconst id = `${_prefix}${sid}`;\n\t\t\tnodes.push(\n\t\t\t\tthis._checkpointNode(inner, id, {\n\t\t\t\t\tfactory: checkpointFactory(inner.factory ?? \"?\", inner, true),\n\t\t\t\t\tdeps: liveIds,\n\t\t\t\t}),\n\t\t\t);\n\t\t\tfor (const from of liveIds) edges.push({ from, to: id });\n\t\t}\n\t\tconst checkpoint: GraphCheckpoint = {\n\t\t\tversion: GRAPH_CHECKPOINT_VERSION,\n\t\t\tnodes,\n\t\t\tedges,\n\t\t};\n\t\tif (this.name !== undefined) checkpoint.name = this.name;\n\t\tif (this._mounts.length > 0) {\n\t\t\tcheckpoint.mounts = this._mounts.map((m) => ({\n\t\t\t\tat: m.at,\n\t\t\t\tcheckpoint: m.graph._checkpoint(\"\", stack),\n\t\t\t}));\n\t\t}\n\t\tstack.delete(this);\n\t\treturn toCheckpointJson(checkpoint, \"checkpoint\") as unknown as GraphCheckpoint;\n\t}\n\n\tprivate _checkpointNode(\n\t\tnode: Node<unknown>,\n\t\tid: string,\n\t\topts: {\n\t\t\tname?: string;\n\t\t\tfactory: GraphCheckpointFactory;\n\t\t\tdeps: string[];\n\t\t\tmeta?: Record<string, unknown>;\n\t\t},\n\t): GraphCheckpointNode {\n\t\tconst state = checkpointStateOfNode(node);\n\t\tassertCheckpointQuiescentStatus(node.status, id, \"checkpoint\");\n\t\tconst nonAuthoritativeCollectionHelper = isNonAuthoritativeCollectionHelperMeta(opts.meta);\n\t\tconst out: GraphCheckpointNode = {\n\t\t\tid,\n\t\t\tfactory: opts.factory,\n\t\t\tstatus: node.status,\n\t\t\tdeps: opts.deps,\n\t\t\tvalue: nonAuthoritativeCollectionHelper\n\t\t\t\t? { kind: \"SENTINEL\" }\n\t\t\t\t: checkpointValue(state.cache, state.hasData, `${id}.value`),\n\t\t\tterminal: checkpointTerminal(state.terminal, `${id}.terminal`),\n\t\t\tlifecycle: { activated: state.activated, hasCalledFnOnce: state.hasCalledFnOnce },\n\t\t\tctxState: {\n\t\t\t\tpersist: state.ctxState.persist,\n\t\t\t\tvalue: nonAuthoritativeCollectionHelper\n\t\t\t\t\t? { kind: \"SENTINEL\" }\n\t\t\t\t\t: checkpointValue(\n\t\t\t\t\t\t\tstate.ctxState.value,\n\t\t\t\t\t\t\tstate.ctxState.value !== SENTINEL,\n\t\t\t\t\t\t\t`${id}.ctxState`,\n\t\t\t\t\t\t),\n\t\t\t},\n\t\t};\n\t\tif (opts.name !== undefined) out.name = opts.name;\n\t\tconst backendState = checkpointBackendStateOfNode(node, `${id}.backendState`);\n\t\tif (backendState !== undefined) out.backendState = backendState;\n\t\tif (state.version !== undefined) out.version = state.version;\n\t\tif (opts.meta !== undefined)\n\t\t\tout.meta = toCheckpointJson(opts.meta, `${id}.meta`) as {\n\t\t\t\t[key: string]: GraphCheckpointJson;\n\t\t\t};\n\t\treturn out;\n\t}\n}\n\n/**\n * Construct a graph with graph-local topology, lifecycle, and inspection ownership.\n *\n * @param opts - Optional graph name, dispatcher, versioning policy, environment drivers, and\n * profiling switch.\n * @returns A `Graph` instance whose sugar methods create graph-registered nodes.\n * @example\n * ```ts\n * import { graph } from \"@graphrefly/ts\";\n *\n * const g = graph({ name: \"counter\" });\n * const count = g.state(0, { name: \"count\" });\n * const doubled = g.derived([count], ([value]) => value * 2);\n * ```\n * @category graph\n */\nexport function graph(opts: GraphOptions = {}): Graph {\n\treturn new Graph(opts);\n}\n\n/** @internal D122 graph-owned ephemeral node-group release. */\nexport function releaseGraphNodes(\n\tgraph: Graph,\n\tnodes: readonly Node<unknown>[],\n\topts: { reason?: string } = {},\n): void {\n\tconst registrar = lifecycleRegistrars.get(graph);\n\tif (registrar === undefined) throw new Error(\"graph: unknown lifecycle registrar\");\n\tregistrar.releaseNodes(nodes, opts);\n}\n\n/** @internal D94 descriptor path: register a restored state node without widening Graph. */\nexport function restoreStateNodeInGraph<T = unknown>(\n\tgraph: Graph,\n\tid: string,\n\topts: SugarOpts<T> = {},\n): StateNode<T> {\n\tconst registrar = restoreRegistrars.get(graph);\n\tif (registrar === undefined) throw new Error(\"restoreGraph: unknown graph restore registrar\");\n\treturn registrar.stateNode(id, opts);\n}\n\n/** @internal D94 descriptor path: register a restored ctx-level node without widening Graph. */\nexport function restoreNodeInGraph<T = unknown>(\n\tgraph: Graph,\n\tid: string,\n\tfactory: string,\n\tdeps: readonly Node<unknown>[],\n\tfn: NodeFn | null,\n\topts: SugarOpts<T> = {},\n): Node<T> {\n\tconst registrar = restoreRegistrars.get(graph);\n\tif (registrar === undefined) throw new Error(\"restoreGraph: unknown graph restore registrar\");\n\treturn registrar.node(id, factory, deps, fn, opts);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,IAAM,0BAA0B;AAkEhC,SAAS,sBACf,MACA,QAAQ,QACR,OAAO,cACwC;AAC/C,MAAI;AACH,WAAO,uBAAuB,MAAM,KAAK;AAAA,EAC1C,SAAS,OAAO;AACf,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,UAAM,IAAI,UAAU,GAAG,KAAK,KAAK,IAAI,gDAAgD,OAAO,EAAE;AAAA,EAC/F;AACD;AAEO,SAAS,kBACf,UACkC;AAClC,SAAO,0BAA0B,UAAmC,oBAAI,QAAgB,GAAG,GAAG;AAC/F;AAEA,SAAS,0BACR,UACA,MACA,MACkC;AAClC,MAAI,aAAa,QAAQ,OAAO,aAAa,UAAU;AACtD,UAAM,IAAI,UAAU,kCAAkC,IAAI,oBAAoB;AAAA,EAC/E;AACA,MAAI,KAAK,IAAI,QAAQ,GAAG;AACvB,UAAM,IAAI,UAAU,qDAAqD,IAAI,EAAE;AAAA,EAChF;AACA,OAAK,IAAI,QAAQ;AACjB,MAAI;AACH,UAAM,QAAQ,SAAS,SAAS,OAAO,GAAG,IAAI,UAAU,CAAC,MAAM,UAAU;AACxE,YAAM,WAAW,GAAG,IAAI,UAAU,KAAK;AACvC,2BAAqB,MAAM,QAAQ;AACnC,YAAM,KAAK,eAAe,KAAK,IAAI,GAAG,QAAQ,KAAK;AACnD,YAAM,UAAU,eAAe,KAAK,SAAS,GAAG,QAAQ,UAAU;AAClE,YAAMA,OAAmC;AAAA,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CAAC,GACZ;AACV,QAAM,YAAY,kBAAkB,IAAIA,MAAK;AAC7C,MAAI,cAAc,OAAW,OAAM,IAAI,MAAM,+CAA+C;AAC5F,SAAO,UAAU,KAAK,IAAI,SAAS,MAAM,IAAI,IAAI;AAClD;","names":["out","value","out","graph","graph"]}
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
interval,
|
|
7
7
|
of,
|
|
8
8
|
timer
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DKFWDTVY.js";
|
|
10
10
|
import {
|
|
11
11
|
filter,
|
|
12
12
|
initNode,
|
|
13
13
|
map,
|
|
14
14
|
merge
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-54WPEODM.js";
|
|
16
16
|
import {
|
|
17
17
|
CTX_NODE_BINDING,
|
|
18
18
|
depBatch,
|
|
@@ -459,4 +459,4 @@ export {
|
|
|
459
459
|
timeout,
|
|
460
460
|
bufferTime
|
|
461
461
|
};
|
|
462
|
-
//# sourceMappingURL=chunk-
|
|
462
|
+
//# sourceMappingURL=chunk-PUSRRALM.js.map
|
|
@@ -7,7 +7,59 @@ import {
|
|
|
7
7
|
depBatch
|
|
8
8
|
} from "./chunk-WQIA3GFB.js";
|
|
9
9
|
|
|
10
|
-
// src/messaging/
|
|
10
|
+
// src/messaging/utils.ts
|
|
11
|
+
function pullParams(pull) {
|
|
12
|
+
return isObjectRecord(pull?.params) ? pull.params : {};
|
|
13
|
+
}
|
|
14
|
+
function publishCommand(commandNode, command) {
|
|
15
|
+
commandNode.down([["DATA", command]]);
|
|
16
|
+
return command;
|
|
17
|
+
}
|
|
18
|
+
function makeTopicState() {
|
|
19
|
+
return { closed: false, headSeq: 1, nextSeq: 1, messages: [] };
|
|
20
|
+
}
|
|
21
|
+
function uniqueTopics(topics) {
|
|
22
|
+
const unique = [...new Set(topics)];
|
|
23
|
+
if (unique.length !== topics.length) throw new Error("messageBus: duplicate topic");
|
|
24
|
+
for (const topic of unique) assertTopicKey(topic, "messageBus");
|
|
25
|
+
return Object.freeze(unique.sort());
|
|
26
|
+
}
|
|
27
|
+
function assertTopicKey(topic, owner) {
|
|
28
|
+
const error = validateTopicKey(topic, owner);
|
|
29
|
+
if (error !== void 0) throw new Error(error);
|
|
30
|
+
}
|
|
31
|
+
function validateTopicKey(topic, owner) {
|
|
32
|
+
if (typeof topic !== "string" || topic.length === 0)
|
|
33
|
+
return `${owner}: topic must be a non-empty string`;
|
|
34
|
+
return void 0;
|
|
35
|
+
}
|
|
36
|
+
function assertNonEmpty(value, owner) {
|
|
37
|
+
if (typeof value !== "string" || value.length === 0)
|
|
38
|
+
throw new Error(`${owner}: must be a non-empty string`);
|
|
39
|
+
}
|
|
40
|
+
function positiveLimit(limit) {
|
|
41
|
+
if (limit === void 0) return 100;
|
|
42
|
+
if (!Number.isInteger(limit) || limit < 1)
|
|
43
|
+
throw new Error("messageBus: limit must be a positive integer");
|
|
44
|
+
return limit;
|
|
45
|
+
}
|
|
46
|
+
function isPositiveSeq(value) {
|
|
47
|
+
return Number.isInteger(value) && value >= 1;
|
|
48
|
+
}
|
|
49
|
+
function isObjectRecord(value) {
|
|
50
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
51
|
+
}
|
|
52
|
+
function commandTopic(command) {
|
|
53
|
+
return isObjectRecord(command) && typeof command.topic === "string" ? command.topic : void 0;
|
|
54
|
+
}
|
|
55
|
+
function commandIdOf(command) {
|
|
56
|
+
return isObjectRecord(command) && typeof command.commandId === "string" ? command.commandId : void 0;
|
|
57
|
+
}
|
|
58
|
+
function idempotencyKey(topic, key) {
|
|
59
|
+
return `${topic}\0${key}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/messaging/event-message.ts
|
|
11
63
|
function eventMessage(type, payload, opts) {
|
|
12
64
|
assertNonEmpty(type, "eventMessage.type");
|
|
13
65
|
assertNonEmpty(opts.id, "eventMessage.id");
|
|
@@ -53,6 +105,8 @@ function eventIssue(message) {
|
|
|
53
105
|
source: "messageBus.eventMessage"
|
|
54
106
|
};
|
|
55
107
|
}
|
|
108
|
+
|
|
109
|
+
// src/messaging/types.ts
|
|
56
110
|
var PROMPTS_TOPIC = "prompts";
|
|
57
111
|
var RESPONSES_TOPIC = "responses";
|
|
58
112
|
var INJECTIONS_TOPIC = "injections";
|
|
@@ -69,6 +123,8 @@ var STANDARD_TOPICS = Object.freeze([
|
|
|
69
123
|
CONTEXT_TOPIC,
|
|
70
124
|
TODOS_TOPIC
|
|
71
125
|
]);
|
|
126
|
+
|
|
127
|
+
// src/messaging/index.ts
|
|
72
128
|
function messageBus(graph, opts = {}) {
|
|
73
129
|
const name = opts.name ?? "messageBus";
|
|
74
130
|
const initialTopics = uniqueTopics(opts.topics ?? []);
|
|
@@ -809,56 +865,6 @@ function ensureSubscription(state, opts) {
|
|
|
809
865
|
function getSubscription(state, topic, subscriptionId) {
|
|
810
866
|
return state.subscriptions.get(`${topic}\0${subscriptionId}`);
|
|
811
867
|
}
|
|
812
|
-
function pullParams(pull) {
|
|
813
|
-
return isObjectRecord(pull?.params) ? pull.params : {};
|
|
814
|
-
}
|
|
815
|
-
function publishCommand(commandNode, command) {
|
|
816
|
-
commandNode.down([["DATA", command]]);
|
|
817
|
-
return command;
|
|
818
|
-
}
|
|
819
|
-
function makeTopicState() {
|
|
820
|
-
return { closed: false, headSeq: 1, nextSeq: 1, messages: [] };
|
|
821
|
-
}
|
|
822
|
-
function uniqueTopics(topics) {
|
|
823
|
-
const unique = [...new Set(topics)];
|
|
824
|
-
if (unique.length !== topics.length) throw new Error("messageBus: duplicate topic");
|
|
825
|
-
for (const topic of unique) assertTopicKey(topic, "messageBus");
|
|
826
|
-
return Object.freeze(unique.sort());
|
|
827
|
-
}
|
|
828
|
-
function assertTopicKey(topic, owner) {
|
|
829
|
-
const error = validateTopicKey(topic, owner);
|
|
830
|
-
if (error !== void 0) throw new Error(error);
|
|
831
|
-
}
|
|
832
|
-
function validateTopicKey(topic, owner) {
|
|
833
|
-
if (typeof topic !== "string" || topic.length === 0)
|
|
834
|
-
return `${owner}: topic must be a non-empty string`;
|
|
835
|
-
return void 0;
|
|
836
|
-
}
|
|
837
|
-
function assertNonEmpty(value, owner) {
|
|
838
|
-
if (typeof value !== "string" || value.length === 0)
|
|
839
|
-
throw new Error(`${owner}: must be a non-empty string`);
|
|
840
|
-
}
|
|
841
|
-
function positiveLimit(limit) {
|
|
842
|
-
if (limit === void 0) return 100;
|
|
843
|
-
if (!Number.isInteger(limit) || limit < 1)
|
|
844
|
-
throw new Error("messageBus: limit must be a positive integer");
|
|
845
|
-
return limit;
|
|
846
|
-
}
|
|
847
|
-
function isPositiveSeq(value) {
|
|
848
|
-
return Number.isInteger(value) && value >= 1;
|
|
849
|
-
}
|
|
850
|
-
function isObjectRecord(value) {
|
|
851
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
852
|
-
}
|
|
853
|
-
function commandTopic(command) {
|
|
854
|
-
return isObjectRecord(command) && typeof command.topic === "string" ? command.topic : void 0;
|
|
855
|
-
}
|
|
856
|
-
function commandIdOf(command) {
|
|
857
|
-
return isObjectRecord(command) && typeof command.commandId === "string" ? command.commandId : void 0;
|
|
858
|
-
}
|
|
859
|
-
function idempotencyKey(topic, key) {
|
|
860
|
-
return `${topic}\0${key}`;
|
|
861
|
-
}
|
|
862
868
|
|
|
863
869
|
export {
|
|
864
870
|
eventMessage,
|
|
@@ -876,4 +882,4 @@ export {
|
|
|
876
882
|
fromTopic,
|
|
877
883
|
toTopic
|
|
878
884
|
};
|
|
879
|
-
//# sourceMappingURL=chunk-
|
|
885
|
+
//# sourceMappingURL=chunk-PVC7WDKI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/messaging/utils.ts","../src/messaging/event-message.ts","../src/messaging/types.ts","../src/messaging/index.ts"],"sourcesContent":["import type { Node } from \"../node/node.js\";\nimport type { PullDemand } from \"../protocol/messages.js\";\nimport type { MessageBusCommand } from \"./types.js\";\n\nexport function pullParams<T>(pull: PullDemand | undefined): T {\n\treturn (isObjectRecord(pull?.params) ? pull.params : {}) as T;\n}\n\nexport function publishCommand<T extends MessageBusCommand>(\n\tcommandNode: Node<MessageBusCommand>,\n\tcommand: T,\n): T {\n\tcommandNode.down([[\"DATA\", command]]);\n\treturn command;\n}\n\nexport function makeTopicState(): {\n\tclosed: boolean;\n\theadSeq: number;\n\tnextSeq: number;\n\tmessages: [];\n} {\n\treturn { closed: false, headSeq: 1, nextSeq: 1, messages: [] };\n}\n\nexport function uniqueTopics(topics: readonly string[]): readonly string[] {\n\tconst unique = [...new Set(topics)];\n\tif (unique.length !== topics.length) throw new Error(\"messageBus: duplicate topic\");\n\tfor (const topic of unique) assertTopicKey(topic, \"messageBus\");\n\treturn Object.freeze(unique.sort());\n}\n\nexport function assertTopicKey(topic: string, owner: string): void {\n\tconst error = validateTopicKey(topic, owner);\n\tif (error !== undefined) throw new Error(error);\n}\n\nexport function validateTopicKey(topic: string, owner: string): string | undefined {\n\tif (typeof topic !== \"string\" || topic.length === 0)\n\t\treturn `${owner}: topic must be a non-empty string`;\n\treturn undefined;\n}\n\nexport function assertNonEmpty(value: string, owner: string): void {\n\tif (typeof value !== \"string\" || value.length === 0)\n\t\tthrow new Error(`${owner}: must be a non-empty string`);\n}\n\nexport function positiveLimit(limit: number | undefined): number {\n\tif (limit === undefined) return 100;\n\tif (!Number.isInteger(limit) || limit < 1)\n\t\tthrow new Error(\"messageBus: limit must be a positive integer\");\n\treturn limit;\n}\n\nexport function isPositiveSeq(value: unknown): value is number {\n\treturn Number.isInteger(value) && (value as number) >= 1;\n}\n\nexport function isObjectRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nexport function commandTopic(command: unknown): string | undefined {\n\treturn isObjectRecord(command) && typeof command.topic === \"string\" ? command.topic : undefined;\n}\n\nexport function commandIdOf(command: unknown): string | undefined {\n\treturn isObjectRecord(command) && typeof command.commandId === \"string\"\n\t\t? command.commandId\n\t\t: undefined;\n}\n\nexport function idempotencyKey(topic: string, key: string): string {\n\treturn `${topic}\\u0000${key}`;\n}\n","import type { DataIssue } from \"../data/index.js\";\nimport type { EventMessage, EventMessageOptions } from \"./types.js\";\nimport { assertNonEmpty, isObjectRecord } from \"./utils.js\";\n\nexport function eventMessage<T>(\n\ttype: string,\n\tpayload: T,\n\topts: EventMessageOptions,\n): EventMessage<T> {\n\tassertNonEmpty(type, \"eventMessage.type\");\n\tassertNonEmpty(opts.id, \"eventMessage.id\");\n\treturn {\n\t\tid: opts.id,\n\t\ttype,\n\t\tpayload,\n\t\t...(opts.key === undefined ? {} : { key: opts.key }),\n\t\t...(opts.subjectId === undefined ? {} : { subjectId: opts.subjectId }),\n\t\t...(opts.correlationId === undefined ? {} : { correlationId: opts.correlationId }),\n\t\t...(opts.causationId === undefined ? {} : { causationId: opts.causationId }),\n\t\t...(opts.occurredAtMs === undefined ? {} : { occurredAtMs: opts.occurredAtMs }),\n\t\t...(opts.actor === undefined ? {} : { actor: opts.actor }),\n\t\t...(opts.evidenceRefs === undefined ? {} : { evidenceRefs: opts.evidenceRefs }),\n\t\t...(opts.schema === undefined ? {} : { schema: opts.schema }),\n\t\t...(opts.metadata === undefined ? {} : { metadata: opts.metadata }),\n\t};\n}\n\nexport function isEventMessage(value: unknown): value is EventMessage {\n\treturn eventMessageIssue(value) === undefined;\n}\n\nexport function eventMessageIssue(value: unknown): DataIssue | undefined {\n\tif (!isObjectRecord(value)) {\n\t\treturn eventIssue(\"event message must be an object\");\n\t}\n\tif (typeof value.id !== \"string\" || value.id.length === 0) {\n\t\treturn eventIssue(\"event message id must be a non-empty string\");\n\t}\n\tif (typeof value.type !== \"string\" || value.type.length === 0) {\n\t\treturn eventIssue(\"event message type must be a non-empty string\");\n\t}\n\tif (!(\"payload\" in value)) {\n\t\treturn eventIssue(\"event message payload field is required\");\n\t}\n\treturn undefined;\n}\n\nfunction eventIssue(message: string): DataIssue {\n\treturn {\n\t\tkind: \"issue\",\n\t\tcode: \"malformed-event-message\",\n\t\tmessage,\n\t\tseverity: \"error\",\n\t\tsource: \"messageBus.eventMessage\",\n\t};\n}\n","import type { DataIssue } from \"../data/index.js\";\nimport type { Node } from \"../node/node.js\";\nimport type { LockId } from \"../protocol/messages.js\";\n\nexport interface MessageEnvelope<T = unknown> {\n\treadonly topic: string;\n\treadonly seq: number;\n\treadonly payload: T;\n\treadonly key?: string;\n\treadonly idempotencyKey?: string;\n\treadonly timestampMs: number;\n\treadonly commandId?: string;\n}\n\n/** Minimal JSON Schema vocabulary for passive topic payload descriptions (D125/D132). */\nexport interface JsonSchema {\n\treadonly type?:\n\t\t| \"string\"\n\t\t| \"number\"\n\t\t| \"integer\"\n\t\t| \"boolean\"\n\t\t| \"object\"\n\t\t| \"array\"\n\t\t| \"null\"\n\t\t| readonly (\"string\" | \"number\" | \"integer\" | \"boolean\" | \"object\" | \"array\" | \"null\")[];\n\treadonly properties?: Readonly<Record<string, JsonSchema>>;\n\treadonly required?: readonly string[];\n\treadonly additionalProperties?: boolean | JsonSchema;\n\treadonly items?: JsonSchema | readonly JsonSchema[];\n\treadonly enum?: readonly unknown[];\n\treadonly const?: unknown;\n\treadonly $ref?: string;\n\treadonly definitions?: Readonly<Record<string, JsonSchema>>;\n\treadonly description?: string;\n\treadonly title?: string;\n}\n\n/** Passive envelope for payloads that cross topic, agent, or graph boundaries. */\nexport interface TopicMessage<T = unknown> {\n\treadonly id: string;\n\treadonly schema?: JsonSchema;\n\treadonly expiresAt?: string;\n\treadonly correlationId?: string;\n\treadonly payload: T;\n}\n\n/** Passive domain event vocabulary for messageBus/eventFlow composition (D329). */\nexport interface EventMessage<T = unknown> {\n\treadonly id: string;\n\treadonly type: string;\n\treadonly payload: T;\n\treadonly key?: string;\n\treadonly subjectId?: string;\n\treadonly correlationId?: string;\n\treadonly causationId?: string;\n\treadonly occurredAtMs?: number;\n\treadonly actor?: string;\n\treadonly evidenceRefs?: readonly string[];\n\treadonly schema?: JsonSchema;\n\treadonly metadata?: Readonly<Record<string, unknown>>;\n}\n\nexport interface EventMessageOptions {\n\treadonly id: string;\n\treadonly key?: string;\n\treadonly subjectId?: string;\n\treadonly correlationId?: string;\n\treadonly causationId?: string;\n\treadonly occurredAtMs?: number;\n\treadonly actor?: string;\n\treadonly evidenceRefs?: readonly string[];\n\treadonly schema?: JsonSchema;\n\treadonly metadata?: Readonly<Record<string, unknown>>;\n}\n\nexport const PROMPTS_TOPIC = \"prompts\";\nexport const RESPONSES_TOPIC = \"responses\";\nexport const INJECTIONS_TOPIC = \"injections\";\nexport const DEFERRED_TOPIC = \"deferred\";\nexport const SPAWNS_TOPIC = \"spawns\";\nexport const CONTEXT_TOPIC = \"context\";\nexport const TODOS_TOPIC = \"todos\";\n\nexport const STANDARD_TOPICS = Object.freeze([\n\tPROMPTS_TOPIC,\n\tRESPONSES_TOPIC,\n\tINJECTIONS_TOPIC,\n\tDEFERRED_TOPIC,\n\tSPAWNS_TOPIC,\n\tCONTEXT_TOPIC,\n\tTODOS_TOPIC,\n] as const);\n\nexport type StandardTopic = (typeof STANDARD_TOPICS)[number];\n\nexport type MessageBusTopicPolicy = \"strict\" | \"create-as-fact\";\n\nexport interface MessageBusRetentionPolicy {\n\t/** Count retention. Trimming advances headSeq and never rewrites seq (D284). */\n\treadonly maxMessages?: number;\n}\n\nexport interface MessageBusDedupePolicy {\n\t/** Duplicate commandId emits status and never publishes a second retained message (D284). */\n\treadonly commandId?: \"status\" | \"issue\";\n}\n\nexport interface MessageBusOptions<TTopic extends string = string> {\n\treadonly topics?: readonly TTopic[];\n\treadonly name?: string;\n\treadonly now?: () => number;\n\treadonly topicPolicy?: MessageBusTopicPolicy;\n\treadonly retention?: MessageBusRetentionPolicy;\n\treadonly dedupe?: MessageBusDedupePolicy;\n}\n\nexport type MessageBusCommand<T = unknown> =\n\t| {\n\t\t\treadonly kind: \"ensure-topic\";\n\t\t\treadonly topic: string;\n\t\t\treadonly commandId?: string;\n\t }\n\t| {\n\t\t\treadonly kind: \"close-topic\";\n\t\t\treadonly topic: string;\n\t\t\treadonly commandId?: string;\n\t }\n\t| {\n\t\t\treadonly kind: \"publish\";\n\t\t\treadonly topic: string;\n\t\t\treadonly payload: T;\n\t\t\treadonly key?: string;\n\t\t\treadonly commandId?: string;\n\t\t\treadonly idempotencyKey?: string;\n\t }\n\t| {\n\t\t\treadonly kind: \"topic-policy\";\n\t\t\treadonly topicPolicy: MessageBusTopicPolicy;\n\t\t\treadonly commandId?: string;\n\t }\n\t| {\n\t\t\treadonly kind: \"ack\";\n\t\t\treadonly topic: string;\n\t\t\treadonly subscriptionId: string;\n\t\t\treadonly seq: number;\n\t\t\treadonly commandId?: string;\n\t }\n\t| {\n\t\t\treadonly kind: \"seek\";\n\t\t\treadonly topic: string;\n\t\t\treadonly subscriptionId: string;\n\t\t\treadonly nextSeq: number;\n\t\t\treadonly commandId?: string;\n\t }\n\t| {\n\t\t\treadonly kind: \"close-subscription\";\n\t\t\treadonly topic: string;\n\t\t\treadonly subscriptionId: string;\n\t\t\treadonly commandId?: string;\n\t };\n\nexport type MessageBusMessage<T = unknown> = MessageEnvelope<T>;\n\nexport interface MessageBusStatus {\n\treadonly kind:\n\t\t| \"topic-created\"\n\t\t| \"topic-closed\"\n\t\t| \"message-published\"\n\t\t| \"retention-trimmed\"\n\t\t| \"duplicate-command\"\n\t\t| \"subscription-acked\"\n\t\t| \"subscription-sought\"\n\t\t| \"subscription-closed\"\n\t\t| \"command-rejected\"\n\t\t| \"projection-ready\"\n\t\t| \"projection-partial\";\n\treadonly topic?: string;\n\treadonly seq?: number;\n\treadonly headSeq?: number;\n\treadonly subscriptionId?: string;\n\treadonly nextSeq?: number;\n\treadonly commandId?: string;\n\treadonly issueCode?: string;\n\treadonly timestampMs: number;\n\treadonly details?: unknown;\n}\n\nexport interface MessageBusCatalogEntry {\n\treadonly topic: string;\n\treadonly closed: boolean;\n\treadonly headSeq: number;\n\treadonly nextSeq: number;\n\treadonly messageCount: number;\n}\n\nexport interface MessageBusCatalogPage {\n\treadonly topics: readonly MessageBusCatalogEntry[];\n\treadonly nextAfterTopic?: string;\n\treadonly hasMore: boolean;\n}\n\nexport interface MessageBusDeadLetterEntry<T = unknown> {\n\treadonly entrySeq: number;\n\treadonly topic?: string;\n\treadonly command?: MessageBusCommand<T>;\n\treadonly message?: MessageBusMessage<T>;\n\treadonly issue: DataIssue;\n\treadonly timestampMs: number;\n}\n\nexport interface MessageBusDeadLetterPage<T = unknown> {\n\treadonly entries: readonly MessageBusDeadLetterEntry<T>[];\n\treadonly nextAfterEntrySeq?: number;\n\treadonly hasMore: boolean;\n}\n\nexport interface MessageBusTopicPage<T = unknown> {\n\treadonly topic: string;\n\treadonly messages: readonly MessageBusMessage<T>[];\n\treadonly fromSeq: number;\n\treadonly throughSeq?: number;\n\treadonly nextAfterSeq?: number;\n\treadonly hasMore: boolean;\n}\n\nexport interface MessageBusCursor {\n\treadonly topic: string;\n\treadonly subscriptionId: string;\n\treadonly nextSeq: number;\n\treadonly closed: boolean;\n\treadonly retentionGap: boolean;\n\treadonly headSeq: number;\n}\n\nexport interface MessageBusAvailablePage<T = unknown> {\n\treadonly topic: string;\n\treadonly subscriptionId: string;\n\treadonly cursor: MessageBusCursor;\n\treadonly messages: readonly MessageBusMessage<T>[];\n\treadonly fromSeq: number;\n\treadonly throughSeq?: number;\n\treadonly nextAfterSeq?: number;\n\treadonly hasMore: boolean;\n}\n\nexport interface MessageBusPageParams {\n\treadonly limit?: number;\n}\n\nexport interface MessageBusCatalogParams extends MessageBusPageParams {\n\treadonly afterTopic?: string;\n\treadonly includeClosed?: boolean;\n}\n\nexport interface MessageBusDeadLetterParams extends MessageBusPageParams {\n\treadonly afterEntrySeq?: number;\n\treadonly topic?: string;\n\treadonly code?: string;\n}\n\nexport interface MessageBusTopicParams extends MessageBusPageParams {\n\treadonly afterSeq?: number;\n}\n\nexport interface MessageBusAvailableParams extends MessageBusPageParams {\n\treadonly afterSeq?: number;\n}\n\nexport interface MessageBusPullProjection<TPage> {\n\treadonly snapshot: Node<TPage>;\n\treadonly snapshotPullId: LockId;\n\treadonly status: Node<MessageBusStatus>;\n\treadonly issues: Node<DataIssue>;\n}\n\nexport interface MessageBusTopicProjection<T = unknown>\n\textends MessageBusPullProjection<MessageBusTopicPage<T>> {}\n\nexport interface MessageBusSubscription<T = unknown> {\n\treadonly available: Node<MessageBusAvailablePage<T>>;\n\treadonly availablePullId: LockId;\n\treadonly cursor: Node<MessageBusCursor>;\n\treadonly status: Node<MessageBusStatus>;\n\treadonly issues: Node<DataIssue>;\n\tack(seq: number, opts?: { commandId?: string }): MessageBusCommand;\n\tseek(nextSeq: number, opts?: { commandId?: string }): MessageBusCommand;\n\tclose(opts?: { commandId?: string }): MessageBusCommand;\n}\n\nexport interface MessageBus<TTopic extends string = string> {\n\treadonly commands: Node<MessageBusCommand>;\n\treadonly messages: Node<MessageBusMessage>;\n\treadonly status: Node<MessageBusStatus>;\n\treadonly issues: Node<DataIssue>;\n\tensureTopic(topic: TTopic | string, opts?: { commandId?: string }): MessageBusCommand;\n\tcloseTopic(topic: TTopic | string, opts?: { commandId?: string }): MessageBusCommand;\n\tpublish<T = unknown>(\n\t\ttopic: TTopic | string,\n\t\tpayload: T,\n\t\topts?: { key?: string; commandId?: string; idempotencyKey?: string },\n\t): MessageBusCommand<T>;\n\ttopic<T = unknown>(\n\t\ttopic: TTopic | string,\n\t\topts?: { name?: string },\n\t): MessageBusTopicProjection<T>;\n\tcatalog(opts?: { name?: string }): MessageBusPullProjection<MessageBusCatalogPage>;\n\tdeadLetter<T = unknown>(opts?: {\n\t\tname?: string;\n\t}): MessageBusPullProjection<MessageBusDeadLetterPage<T>>;\n\tsubscription<T = unknown>(opts: {\n\t\ttopic: TTopic | string;\n\t\tsubscriptionId: string;\n\t\tfrom?: \"earliest\" | \"latest\" | number;\n\t\tname?: string;\n\t}): MessageBusSubscription<T>;\n}\n\nexport interface ToTopicOptions {\n\treadonly name?: string;\n\treadonly keyOf?: (value: unknown) => string | undefined;\n\treadonly commandIdOf?: (value: unknown) => string | undefined;\n}\n\nexport interface ToTopicBundle<T> {\n\treadonly commands: Node<MessageBusCommand<T>>;\n\trelease(): void;\n}\n","/**\n * Reusable application-infrastructure messaging namespace.\n *\n * D279/D282/D284/D285/D276: messageBus is a retained topic-log plus independent\n * subscription-cursor substrate. DynamicHub is intentionally retired; do not add aliases.\n */\n\nimport { depBatch, type NodeFn } from \"../ctx/types.js\";\nimport type { DataIssue } from \"../data/index.js\";\nimport type { Graph } from \"../graph/graph.js\";\nimport type { Node } from \"../node/node.js\";\nimport {\n\tattachMessageBusCommandSource,\n\tgetMessageBusState,\n\tregisterMessageBusState,\n} from \"./internal.js\";\nimport type {\n\tMessageBusState,\n\tRuntimeEvent,\n\tSubscriptionState,\n\tTopicState,\n} from \"./runtime-types.js\";\nimport type {\n\tMessageBus,\n\tMessageBusAvailablePage,\n\tMessageBusAvailableParams,\n\tMessageBusCatalogPage,\n\tMessageBusCatalogParams,\n\tMessageBusCommand,\n\tMessageBusCursor,\n\tMessageBusDeadLetterEntry,\n\tMessageBusDeadLetterPage,\n\tMessageBusDeadLetterParams,\n\tMessageBusMessage,\n\tMessageBusOptions,\n\tMessageBusStatus,\n\tMessageBusTopicPage,\n\tMessageBusTopicParams,\n\tToTopicBundle,\n\tToTopicOptions,\n} from \"./types.js\";\nimport {\n\tassertNonEmpty,\n\tassertTopicKey,\n\tcommandIdOf,\n\tcommandTopic,\n\tidempotencyKey,\n\tisObjectRecord,\n\tisPositiveSeq,\n\tmakeTopicState,\n\tpositiveLimit,\n\tpublishCommand,\n\tpullParams,\n\tuniqueTopics,\n\tvalidateTopicKey,\n} from \"./utils.js\";\n\nexport {\n\teventMessage,\n\teventMessageIssue,\n\tisEventMessage,\n} from \"./event-message.js\";\nexport type {\n\tEventMessage,\n\tEventMessageOptions,\n\tJsonSchema,\n\tMessageBus,\n\tMessageBusAvailablePage,\n\tMessageBusAvailableParams,\n\tMessageBusCatalogEntry,\n\tMessageBusCatalogPage,\n\tMessageBusCatalogParams,\n\tMessageBusCommand,\n\tMessageBusCursor,\n\tMessageBusDeadLetterEntry,\n\tMessageBusDeadLetterPage,\n\tMessageBusDeadLetterParams,\n\tMessageBusDedupePolicy,\n\tMessageBusMessage,\n\tMessageBusOptions,\n\tMessageBusPageParams,\n\tMessageBusPullProjection,\n\tMessageBusRetentionPolicy,\n\tMessageBusStatus,\n\tMessageBusSubscription,\n\tMessageBusTopicPage,\n\tMessageBusTopicParams,\n\tMessageBusTopicPolicy,\n\tMessageBusTopicProjection,\n\tMessageEnvelope,\n\tStandardTopic,\n\tTopicMessage,\n\tToTopicBundle,\n\tToTopicOptions,\n} from \"./types.js\";\nexport {\n\tCONTEXT_TOPIC,\n\tDEFERRED_TOPIC,\n\tINJECTIONS_TOPIC,\n\tPROMPTS_TOPIC,\n\tRESPONSES_TOPIC,\n\tSPAWNS_TOPIC,\n\tSTANDARD_TOPICS,\n\tTODOS_TOPIC,\n} from \"./types.js\";\n\nexport function messageBus<TTopic extends string>(\n\tgraph: Graph,\n\topts: MessageBusOptions<TTopic> = {},\n): MessageBus<TTopic> {\n\tconst name = opts.name ?? \"messageBus\";\n\tconst initialTopics = uniqueTopics(opts.topics ?? []);\n\tconst commandSources: Node<MessageBusCommand>[] = [];\n\tconst commandBody: NodeFn = (ctx) => {\n\t\tfor (let i = 0; i < commandSources.length; i++) {\n\t\t\tfor (const command of depBatch(ctx, i) ?? []) ctx.down([[\"DATA\", command]]);\n\t\t}\n\t};\n\tconst commands = graph.node<MessageBusCommand>([], commandBody, {\n\t\tname: `${name}/commands`,\n\t\tfactory: \"messageBusCommands\",\n\t\tcompleteWhenDepsComplete: false,\n\t\terrorWhenDepsError: false,\n\t});\n\tconst state: MessageBusState = {\n\t\tgraph,\n\t\tname,\n\t\tnow: opts.now ?? Date.now,\n\t\ttopicPolicy: opts.topicPolicy ?? \"strict\",\n\t\tretention: opts.retention ?? {},\n\t\tdedupe: opts.dedupe ?? { commandId: \"status\" },\n\t\ttopics: new Map(initialTopics.map((topic) => [topic, makeTopicState()])),\n\t\tsubscriptions: new Map(),\n\t\tseenCommandIds: new Set(),\n\t\tseenIdempotencyKeys: new Set(),\n\t\tdeadLetters: [],\n\t\tdeadLetterSeq: 0,\n\t\tcommandSources,\n\t\tcommandBody,\n\t};\n\tconst runtime = graph.node<RuntimeEvent>(\n\t\t[commands],\n\t\t(ctx) => {\n\t\t\tfor (const command of depBatch(ctx, 0) ?? []) {\n\t\t\t\tfor (const event of reduceMessageBusCommand(state, command as MessageBusCommand)) {\n\t\t\t\t\tctx.down([[\"DATA\", event]]);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: `${name}/runtime`,\n\t\t\tfactory: \"messageBusRuntime\",\n\t\t\tcompleteWhenDepsComplete: false,\n\t\t\terrorWhenDepsError: false,\n\t\t},\n\t);\n\tgraph.retain(runtime, { reason: `${name}.messageBus.runtime` });\n\tconst messages = graph.node<MessageBusMessage>(\n\t\t[runtime],\n\t\t(ctx) => {\n\t\t\tfor (const event of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst typed = event as RuntimeEvent;\n\t\t\t\tif (typed.kind === \"message\") ctx.down([[\"DATA\", typed.message]]);\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: `${name}/messages`,\n\t\t\tfactory: \"messageBusMessages\",\n\t\t\tcompleteWhenDepsComplete: false,\n\t\t\terrorWhenDepsError: false,\n\t\t},\n\t);\n\tconst status = graph.node<MessageBusStatus>(\n\t\t[runtime],\n\t\t(ctx) => {\n\t\t\tfor (const event of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst typed = event as RuntimeEvent;\n\t\t\t\tif (typed.kind === \"status\") ctx.down([[\"DATA\", typed.status]]);\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: `${name}/status`,\n\t\t\tfactory: \"messageBusStatus\",\n\t\t\tcompleteWhenDepsComplete: false,\n\t\t\terrorWhenDepsError: false,\n\t\t},\n\t);\n\tconst issues = graph.node<DataIssue>(\n\t\t[runtime],\n\t\t(ctx) => {\n\t\t\tfor (const event of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst typed = event as RuntimeEvent;\n\t\t\t\tif (typed.kind === \"issue\") ctx.down([[\"DATA\", typed.issue]]);\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: `${name}/issues`,\n\t\t\tfactory: \"messageBusIssues\",\n\t\t\tcompleteWhenDepsComplete: false,\n\t\t\terrorWhenDepsError: false,\n\t\t},\n\t);\n\n\tconst bus: MessageBus<TTopic> = {\n\t\tcommands,\n\t\tmessages,\n\t\tstatus,\n\t\tissues,\n\t\tensureTopic(topic, commandOpts = {}) {\n\t\t\treturn publishCommand(commands, {\n\t\t\t\tkind: \"ensure-topic\",\n\t\t\t\ttopic,\n\t\t\t\t...(commandOpts.commandId === undefined ? {} : { commandId: commandOpts.commandId }),\n\t\t\t});\n\t\t},\n\t\tcloseTopic(topic, commandOpts = {}) {\n\t\t\treturn publishCommand(commands, {\n\t\t\t\tkind: \"close-topic\",\n\t\t\t\ttopic,\n\t\t\t\t...(commandOpts.commandId === undefined ? {} : { commandId: commandOpts.commandId }),\n\t\t\t});\n\t\t},\n\t\tpublish<T = unknown>(\n\t\t\ttopic: TTopic | string,\n\t\t\tpayload: T,\n\t\t\tpublishOpts: { key?: string; commandId?: string; idempotencyKey?: string } = {},\n\t\t) {\n\t\t\treturn publishCommand(commands, {\n\t\t\t\tkind: \"publish\",\n\t\t\t\ttopic,\n\t\t\t\tpayload,\n\t\t\t\t...(publishOpts.key === undefined ? {} : { key: publishOpts.key }),\n\t\t\t\t...(publishOpts.commandId === undefined ? {} : { commandId: publishOpts.commandId }),\n\t\t\t\t...(publishOpts.idempotencyKey === undefined\n\t\t\t\t\t? {}\n\t\t\t\t\t: { idempotencyKey: publishOpts.idempotencyKey }),\n\t\t\t});\n\t\t},\n\t\ttopic<T = unknown>(topic: TTopic | string, projectionOpts: { name?: string } = {}) {\n\t\t\tassertTopicKey(topic, \"messageBus.topic\");\n\t\t\tconst snapshotPullId = Symbol(`${name}/${topic}/topicSnapshot`);\n\t\t\tconst snapshot = graph.node<MessageBusTopicPage<T>>(\n\t\t\t\t[messages],\n\t\t\t\t(ctx) => {\n\t\t\t\t\tconst params = pullParams<MessageBusTopicParams>(ctx.pull);\n\t\t\t\t\tctx.down([[\"DATA\", topicPage<T>(state, topic, params)]]);\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: projectionOpts.name ?? `${name}/${topic}/topic`,\n\t\t\t\t\tfactory: \"messageBusTopicProjection\",\n\t\t\t\t\tmeta: { topic },\n\t\t\t\t\tpullId: snapshotPullId,\n\t\t\t\t\tpartial: true,\n\t\t\t\t\tcompleteWhenDepsComplete: false,\n\t\t\t\t\terrorWhenDepsError: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { snapshot, snapshotPullId, status, issues };\n\t\t},\n\t\tcatalog(projectionOpts: { name?: string } = {}) {\n\t\t\tconst snapshotPullId = Symbol(`${name}/catalogSnapshot`);\n\t\t\tconst snapshot = graph.node<MessageBusCatalogPage>(\n\t\t\t\t[runtime],\n\t\t\t\t(ctx) => {\n\t\t\t\t\tconst params = pullParams<MessageBusCatalogParams>(ctx.pull);\n\t\t\t\t\tctx.down([[\"DATA\", catalogPage(state, params)]]);\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: projectionOpts.name ?? `${name}/catalog`,\n\t\t\t\t\tfactory: \"messageBusCatalog\",\n\t\t\t\t\tpullId: snapshotPullId,\n\t\t\t\t\tpartial: true,\n\t\t\t\t\tcompleteWhenDepsComplete: false,\n\t\t\t\t\terrorWhenDepsError: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { snapshot, snapshotPullId, status, issues };\n\t\t},\n\t\tdeadLetter<T = unknown>(projectionOpts: { name?: string } = {}) {\n\t\t\tconst snapshotPullId = Symbol(`${name}/deadLetterSnapshot`);\n\t\t\tconst snapshot = graph.node<MessageBusDeadLetterPage<T>>(\n\t\t\t\t[runtime],\n\t\t\t\t(ctx) => {\n\t\t\t\t\tconst params = pullParams<MessageBusDeadLetterParams>(ctx.pull);\n\t\t\t\t\tctx.down([[\"DATA\", deadLetterPage<T>(state, params)]]);\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: projectionOpts.name ?? `${name}/deadLetter`,\n\t\t\t\t\tfactory: \"messageBusDeadLetter\",\n\t\t\t\t\tpullId: snapshotPullId,\n\t\t\t\t\tpartial: true,\n\t\t\t\t\tcompleteWhenDepsComplete: false,\n\t\t\t\t\terrorWhenDepsError: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn { snapshot, snapshotPullId, status, issues };\n\t\t},\n\t\tsubscription<T = unknown>(subscriptionOpts: {\n\t\t\ttopic: TTopic | string;\n\t\t\tsubscriptionId: string;\n\t\t\tfrom?: \"earliest\" | \"latest\" | number;\n\t\t\tname?: string;\n\t\t}) {\n\t\t\tassertTopicKey(subscriptionOpts.topic, \"messageBus.subscription\");\n\t\t\tassertNonEmpty(subscriptionOpts.subscriptionId, \"messageBus.subscriptionId\");\n\t\t\tconst sub = ensureSubscription(state, {\n\t\t\t\ttopic: subscriptionOpts.topic,\n\t\t\t\tsubscriptionId: subscriptionOpts.subscriptionId,\n\t\t\t\tfrom: subscriptionOpts.from ?? \"earliest\",\n\t\t\t});\n\t\t\tconst availablePullId = Symbol(\n\t\t\t\t`${name}/${subscriptionOpts.topic}/${subscriptionOpts.subscriptionId}/available`,\n\t\t\t);\n\t\t\tconst projectionName =\n\t\t\t\tsubscriptionOpts.name ??\n\t\t\t\t`${name}/${subscriptionOpts.topic}/${subscriptionOpts.subscriptionId}`;\n\t\t\tconst available = graph.node<MessageBusAvailablePage<T>>(\n\t\t\t\t[messages, status],\n\t\t\t\t(ctx) => {\n\t\t\t\t\tconst params = pullParams<MessageBusAvailableParams>(ctx.pull);\n\t\t\t\t\tctx.down([[\"DATA\", availablePage<T>(state, sub, params)]]);\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: `${projectionName}/available`,\n\t\t\t\t\tfactory: \"messageBusSubscriptionAvailable\",\n\t\t\t\t\tmeta: { topic: subscriptionOpts.topic, subscriptionId: subscriptionOpts.subscriptionId },\n\t\t\t\t\tpullId: availablePullId,\n\t\t\t\t\tpartial: true,\n\t\t\t\t\tcompleteWhenDepsComplete: false,\n\t\t\t\t\terrorWhenDepsError: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\tconst cursor = graph.node<MessageBusCursor>(\n\t\t\t\t[status],\n\t\t\t\t(ctx) => {\n\t\t\t\t\tfor (const fact of depBatch(ctx, 0) ?? []) {\n\t\t\t\t\t\tconst typed = fact as MessageBusStatus;\n\t\t\t\t\t\tconst subscriptionMoved =\n\t\t\t\t\t\t\ttyped.topic === sub.topic &&\n\t\t\t\t\t\t\ttyped.subscriptionId === sub.subscriptionId &&\n\t\t\t\t\t\t\t(typed.kind === \"subscription-acked\" ||\n\t\t\t\t\t\t\t\ttyped.kind === \"subscription-sought\" ||\n\t\t\t\t\t\t\t\ttyped.kind === \"subscription-closed\");\n\t\t\t\t\t\tconst retentionMoved = typed.topic === sub.topic && typed.kind === \"retention-trimmed\";\n\t\t\t\t\t\tif (subscriptionMoved || retentionMoved) {\n\t\t\t\t\t\t\tctx.down([[\"DATA\", cursorSnapshot(state, sub)]]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: `${projectionName}/cursor`,\n\t\t\t\t\tfactory: \"messageBusSubscriptionCursor\",\n\t\t\t\t\tcompleteWhenDepsComplete: false,\n\t\t\t\t\terrorWhenDepsError: false,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tavailable,\n\t\t\t\tavailablePullId,\n\t\t\t\tcursor,\n\t\t\t\tstatus,\n\t\t\t\tissues,\n\t\t\t\tack(seq, commandOpts = {}) {\n\t\t\t\t\treturn publishCommand(commands, {\n\t\t\t\t\t\tkind: \"ack\",\n\t\t\t\t\t\ttopic: sub.topic,\n\t\t\t\t\t\tsubscriptionId: sub.subscriptionId,\n\t\t\t\t\t\tseq,\n\t\t\t\t\t\t...(commandOpts.commandId === undefined ? {} : { commandId: commandOpts.commandId }),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tseek(nextSeq, commandOpts = {}) {\n\t\t\t\t\treturn publishCommand(commands, {\n\t\t\t\t\t\tkind: \"seek\",\n\t\t\t\t\t\ttopic: sub.topic,\n\t\t\t\t\t\tsubscriptionId: sub.subscriptionId,\n\t\t\t\t\t\tnextSeq,\n\t\t\t\t\t\t...(commandOpts.commandId === undefined ? {} : { commandId: commandOpts.commandId }),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tclose(commandOpts = {}) {\n\t\t\t\t\treturn publishCommand(commands, {\n\t\t\t\t\t\tkind: \"close-subscription\",\n\t\t\t\t\t\ttopic: sub.topic,\n\t\t\t\t\t\tsubscriptionId: sub.subscriptionId,\n\t\t\t\t\t\t...(commandOpts.commandId === undefined ? {} : { commandId: commandOpts.commandId }),\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n\tregisterMessageBusState(bus, state);\n\treturn bus;\n}\n\nexport function fromTopic<T = unknown, TTopic extends string = string>(\n\tbus: MessageBus<TTopic>,\n\ttopic: TTopic | string,\n): Node<MessageBusTopicPage<T>> {\n\treturn bus.topic<T>(topic).snapshot;\n}\n\nexport function toTopic<T, TTopic extends string>(\n\tgraph: Graph,\n\tsource: Node<T>,\n\tbus: MessageBus<TTopic>,\n\ttopic: TTopic | string,\n\topts: ToTopicOptions = {},\n): ToTopicBundle<T> {\n\tconst state = getMessageBusState(bus);\n\tif (state === undefined) throw new Error(\"toTopic: unknown message bus implementation\");\n\tif (state.graph !== graph) throw new Error(\"toTopic: bus and source graph must match\");\n\tassertTopicKey(topic, \"toTopic\");\n\tconst commands = graph.node<MessageBusCommand<T>>(\n\t\t[source],\n\t\t(ctx) => {\n\t\t\tfor (const value of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst key = opts.keyOf?.(value);\n\t\t\t\tconst commandId = opts.commandIdOf?.(value);\n\t\t\t\tctx.down([\n\t\t\t\t\t[\n\t\t\t\t\t\t\"DATA\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"publish\",\n\t\t\t\t\t\t\ttopic,\n\t\t\t\t\t\t\tpayload: value as T,\n\t\t\t\t\t\t\t...(key === undefined ? {} : { key }),\n\t\t\t\t\t\t\t...(commandId === undefined ? {} : { commandId }),\n\t\t\t\t\t\t} satisfies MessageBusCommand<T>,\n\t\t\t\t\t],\n\t\t\t\t]);\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: opts.name ?? `${state.name}/${topic}/toTopic`,\n\t\t\tfactory: \"toTopic\",\n\t\t\tmeta: { topic },\n\t\t\tcompleteWhenDepsComplete: false,\n\t\t\terrorWhenDepsError: false,\n\t\t},\n\t);\n\tconst releaseSource = attachMessageBusCommandSource(\n\t\tgraph,\n\t\tbus,\n\t\tcommands as Node<MessageBusCommand>,\n\t);\n\tlet released = false;\n\treturn {\n\t\tcommands,\n\t\trelease() {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\treleaseSource();\n\t\t},\n\t};\n}\n\nfunction reduceMessageBusCommand(\n\tstate: MessageBusState,\n\tcommand: MessageBusCommand,\n): RuntimeEvent[] {\n\tconst malformed = validateCommand(command);\n\tif (malformed !== undefined) return rejectCommand(state, command, malformed);\n\tif (command.commandId !== undefined) {\n\t\tif (state.seenCommandIds.has(command.commandId)) {\n\t\t\treturn duplicateCommandEvents(state, command, \"duplicate commandId\");\n\t\t}\n\t\tstate.seenCommandIds.add(command.commandId);\n\t}\n\tif (\n\t\tcommand.kind === \"publish\" &&\n\t\tcommand.idempotencyKey !== undefined &&\n\t\tstate.seenIdempotencyKeys.has(idempotencyKey(command.topic, command.idempotencyKey))\n\t) {\n\t\treturn duplicateCommandEvents(state, command, \"duplicate idempotencyKey\");\n\t}\n\tswitch (command.kind) {\n\t\tcase \"ensure-topic\":\n\t\t\treturn ensureTopic(state, command.topic, command.commandId);\n\t\tcase \"close-topic\": {\n\t\t\tconst topic = state.topics.get(command.topic);\n\t\t\tif (topic === undefined) {\n\t\t\t\treturn issueEvents(state, command, \"unknown-topic\", `unknown topic '${command.topic}'`);\n\t\t\t}\n\t\t\ttopic.closed = true;\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tkind: \"status\",\n\t\t\t\t\tstatus: statusFact(state, \"topic-closed\", {\n\t\t\t\t\t\ttopic: command.topic,\n\t\t\t\t\t\tcommandId: command.commandId,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\tcase \"topic-policy\":\n\t\t\tstate.topicPolicy = command.topicPolicy;\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tkind: \"status\",\n\t\t\t\t\tstatus: statusFact(state, \"projection-ready\", {\n\t\t\t\t\t\tcommandId: command.commandId,\n\t\t\t\t\t\tdetails: { topicPolicy: command.topicPolicy },\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t];\n\t\tcase \"publish\":\n\t\t\treturn publishMessage(state, command);\n\t\tcase \"ack\":\n\t\t\treturn ackSubscription(state, command);\n\t\tcase \"seek\":\n\t\t\treturn seekSubscription(state, command);\n\t\tcase \"close-subscription\":\n\t\t\treturn closeSubscription(state, command);\n\t}\n}\n\nfunction publishMessage(\n\tstate: MessageBusState,\n\tcommand: Extract<MessageBusCommand, { kind: \"publish\" }>,\n): RuntimeEvent[] {\n\tlet topic = state.topics.get(command.topic);\n\tconst events: RuntimeEvent[] = [];\n\tif (topic === undefined) {\n\t\tif (state.topicPolicy !== \"create-as-fact\") {\n\t\t\treturn issueEvents(state, command, \"unknown-topic\", `unknown topic '${command.topic}'`);\n\t\t}\n\t\tevents.push(...ensureTopic(state, command.topic, command.commandId));\n\t\ttopic = state.topics.get(command.topic);\n\t}\n\tif (topic === undefined)\n\t\treturn issueEvents(state, command, \"unknown-topic\", `unknown topic '${command.topic}'`);\n\tif (topic.closed)\n\t\treturn issueEvents(state, command, \"closed-topic\", `closed topic '${command.topic}'`);\n\tconst message: MessageBusMessage = {\n\t\ttopic: command.topic,\n\t\tseq: topic.nextSeq++,\n\t\tpayload: command.payload,\n\t\ttimestampMs: state.now(),\n\t\t...(command.key === undefined ? {} : { key: command.key }),\n\t\t...(command.idempotencyKey === undefined ? {} : { idempotencyKey: command.idempotencyKey }),\n\t\t...(command.commandId === undefined ? {} : { commandId: command.commandId }),\n\t};\n\tif (command.idempotencyKey !== undefined) {\n\t\tstate.seenIdempotencyKeys.add(idempotencyKey(command.topic, command.idempotencyKey));\n\t}\n\ttopic.messages.push(message);\n\tevents.push({ kind: \"message\", message });\n\tevents.push({\n\t\tkind: \"status\",\n\t\tstatus: statusFact(state, \"message-published\", {\n\t\t\ttopic: command.topic,\n\t\t\tseq: message.seq,\n\t\t\tcommandId: command.commandId,\n\t\t}),\n\t});\n\tevents.push(...trimRetention(state, command.topic, topic));\n\treturn events;\n}\n\nfunction ensureTopic(state: MessageBusState, topic: string, commandId?: string): RuntimeEvent[] {\n\tassertTopicKey(topic, \"messageBus\");\n\tif (!state.topics.has(topic)) state.topics.set(topic, makeTopicState());\n\treturn [\n\t\t{\n\t\t\tkind: \"status\",\n\t\t\tstatus: statusFact(state, \"topic-created\", { topic, commandId }),\n\t\t},\n\t];\n}\n\nfunction trimRetention(\n\tstate: MessageBusState,\n\ttopicName: string,\n\ttopic: TopicState,\n): RuntimeEvent[] {\n\tconst max = state.retention.maxMessages;\n\tif (max === undefined || topic.messages.length <= max) return [];\n\tif (!Number.isInteger(max) || max < 1) {\n\t\treturn issueEvents(\n\t\t\tstate,\n\t\t\t{ kind: \"publish\", topic: topicName, payload: undefined },\n\t\t\t\"policy-rejected\",\n\t\t\t\"retention.maxMessages must be a positive integer\",\n\t\t);\n\t}\n\tconst trimCount = topic.messages.length - max;\n\ttopic.messages.splice(0, trimCount);\n\ttopic.headSeq = topic.messages[0]?.seq ?? topic.nextSeq;\n\tconst events: RuntimeEvent[] = [\n\t\t{\n\t\t\tkind: \"status\",\n\t\t\tstatus: statusFact(state, \"retention-trimmed\", {\n\t\t\t\ttopic: topicName,\n\t\t\t\theadSeq: topic.headSeq,\n\t\t\t\tdetails: { trimCount },\n\t\t\t}),\n\t\t},\n\t];\n\tfor (const sub of state.subscriptions.values()) {\n\t\tif (sub.closed || sub.topic !== topicName || sub.nextSeq >= topic.headSeq) continue;\n\t\tsub.retentionGap = true;\n\t\tevents.push(\n\t\t\t...issueEvents(\n\t\t\t\tstate,\n\t\t\t\t{\n\t\t\t\t\tkind: \"seek\",\n\t\t\t\t\ttopic: topicName,\n\t\t\t\t\tsubscriptionId: sub.subscriptionId,\n\t\t\t\t\tnextSeq: sub.nextSeq,\n\t\t\t\t},\n\t\t\t\t\"retention-gap\",\n\t\t\t\t`subscription '${sub.subscriptionId}' is before retained headSeq`,\n\t\t\t),\n\t\t);\n\t}\n\treturn events;\n}\n\nfunction ackSubscription(\n\tstate: MessageBusState,\n\tcommand: Extract<MessageBusCommand, { kind: \"ack\" }>,\n): RuntimeEvent[] {\n\tconst topic = state.topics.get(command.topic);\n\tif (topic === undefined)\n\t\treturn issueEvents(state, command, \"unknown-topic\", `unknown topic '${command.topic}'`);\n\tconst sub = getSubscription(state, command.topic, command.subscriptionId);\n\tif (sub === undefined)\n\t\treturn issueEvents(\n\t\t\tstate,\n\t\t\tcommand,\n\t\t\t\"unknown-subscription\",\n\t\t\t`unknown subscription '${command.subscriptionId}'`,\n\t\t);\n\tif (sub.closed)\n\t\treturn issueEvents(state, command, \"subscription-closed\", \"subscription is closed\");\n\tif (sub.retentionGap)\n\t\treturn issueEvents(state, command, \"retention-gap\", \"subscription must seek before ack\");\n\tif (command.seq < sub.nextSeq)\n\t\treturn issueEvents(state, command, \"source-cursor-stale\", \"ack is behind subscription cursor\");\n\tif (command.seq >= topic.nextSeq)\n\t\treturn issueEvents(state, command, \"cursor-out-of-range\", \"ack is beyond topic tail\");\n\tsub.nextSeq = Math.max(sub.nextSeq, command.seq + 1);\n\treturn [\n\t\t{\n\t\t\tkind: \"status\",\n\t\t\tstatus: statusFact(state, \"subscription-acked\", {\n\t\t\t\ttopic: command.topic,\n\t\t\t\tsubscriptionId: command.subscriptionId,\n\t\t\t\tnextSeq: sub.nextSeq,\n\t\t\t\tcommandId: command.commandId,\n\t\t\t}),\n\t\t},\n\t];\n}\n\nfunction seekSubscription(\n\tstate: MessageBusState,\n\tcommand: Extract<MessageBusCommand, { kind: \"seek\" }>,\n): RuntimeEvent[] {\n\tconst topic = state.topics.get(command.topic);\n\tif (topic === undefined)\n\t\treturn issueEvents(state, command, \"unknown-topic\", `unknown topic '${command.topic}'`);\n\tconst sub = getSubscription(state, command.topic, command.subscriptionId);\n\tif (sub === undefined)\n\t\treturn issueEvents(\n\t\t\tstate,\n\t\t\tcommand,\n\t\t\t\"unknown-subscription\",\n\t\t\t`unknown subscription '${command.subscriptionId}'`,\n\t\t);\n\tif (sub.closed)\n\t\treturn issueEvents(state, command, \"subscription-closed\", \"subscription is closed\");\n\tif (command.nextSeq < topic.headSeq)\n\t\treturn issueEvents(state, command, \"retention-gap\", \"seek is before retained headSeq\");\n\tif (command.nextSeq > topic.nextSeq)\n\t\treturn issueEvents(state, command, \"cursor-out-of-range\", \"seek is beyond topic tail\");\n\tsub.nextSeq = command.nextSeq;\n\tsub.retentionGap = false;\n\treturn [\n\t\t{\n\t\t\tkind: \"status\",\n\t\t\tstatus: statusFact(state, \"subscription-sought\", {\n\t\t\t\ttopic: command.topic,\n\t\t\t\tsubscriptionId: command.subscriptionId,\n\t\t\t\tnextSeq: sub.nextSeq,\n\t\t\t\tcommandId: command.commandId,\n\t\t\t}),\n\t\t},\n\t];\n}\n\nfunction closeSubscription(\n\tstate: MessageBusState,\n\tcommand: Extract<MessageBusCommand, { kind: \"close-subscription\" }>,\n): RuntimeEvent[] {\n\tif (!state.topics.has(command.topic))\n\t\treturn issueEvents(state, command, \"unknown-topic\", `unknown topic '${command.topic}'`);\n\tconst sub = getSubscription(state, command.topic, command.subscriptionId);\n\tif (sub === undefined)\n\t\treturn issueEvents(\n\t\t\tstate,\n\t\t\tcommand,\n\t\t\t\"unknown-subscription\",\n\t\t\t`unknown subscription '${command.subscriptionId}'`,\n\t\t);\n\tsub.closed = true;\n\treturn [\n\t\t{\n\t\t\tkind: \"status\",\n\t\t\tstatus: statusFact(state, \"subscription-closed\", {\n\t\t\t\ttopic: command.topic,\n\t\t\t\tsubscriptionId: command.subscriptionId,\n\t\t\t\tnextSeq: sub.nextSeq,\n\t\t\t\tcommandId: command.commandId,\n\t\t\t}),\n\t\t},\n\t];\n}\n\nfunction issueEvents(\n\tstate: MessageBusState,\n\tcommand: unknown,\n\tcode: string,\n\tmessage: string,\n): RuntimeEvent[] {\n\tconst topic = commandTopic(command);\n\tconst commandId = commandIdOf(command);\n\tconst issue: DataIssue = {\n\t\tkind: \"issue\",\n\t\tcode,\n\t\tmessage,\n\t\tseverity: \"error\",\n\t\tsource: \"messageBus\",\n\t\tdetails: command,\n\t\tmetadata: topic === undefined ? undefined : { topic },\n\t};\n\tconst entry: MessageBusDeadLetterEntry = {\n\t\tentrySeq: ++state.deadLetterSeq,\n\t\t...(topic === undefined ? {} : { topic }),\n\t\t...(isObjectRecord(command) ? { command: command as MessageBusCommand } : {}),\n\t\tissue,\n\t\ttimestampMs: state.now(),\n\t};\n\tstate.deadLetters.push(entry);\n\treturn [\n\t\t{ kind: \"issue\", issue },\n\t\t{ kind: \"dead-letter\", entry },\n\t\t{\n\t\t\tkind: \"status\",\n\t\t\tstatus: statusFact(state, \"command-rejected\", {\n\t\t\t\ttopic,\n\t\t\t\tcommandId,\n\t\t\t\tissueCode: code,\n\t\t\t}),\n\t\t},\n\t];\n}\n\nfunction rejectCommand(state: MessageBusState, command: unknown, reason: string): RuntimeEvent[] {\n\treturn issueEvents(state, command, \"malformed-command\", reason);\n}\n\nfunction duplicateCommandEvents(\n\tstate: MessageBusState,\n\tcommand: MessageBusCommand,\n\tmessage: string,\n): RuntimeEvent[] {\n\tconst status = statusFact(state, \"duplicate-command\", {\n\t\ttopic: \"topic\" in command ? command.topic : undefined,\n\t\tcommandId: command.commandId,\n\t});\n\tif (state.dedupe.commandId === \"issue\") {\n\t\treturn [\n\t\t\t{ kind: \"status\", status },\n\t\t\t...issueEvents(state, command, \"duplicate-command\", message),\n\t\t];\n\t}\n\treturn [{ kind: \"status\", status }];\n}\n\nfunction statusFact(\n\tstate: MessageBusState,\n\tkind: MessageBusStatus[\"kind\"],\n\tfields: Partial<MessageBusStatus>,\n): MessageBusStatus {\n\treturn {\n\t\tkind,\n\t\ttimestampMs: state.now(),\n\t\t...(fields.topic === undefined ? {} : { topic: fields.topic }),\n\t\t...(fields.seq === undefined ? {} : { seq: fields.seq }),\n\t\t...(fields.headSeq === undefined ? {} : { headSeq: fields.headSeq }),\n\t\t...(fields.subscriptionId === undefined ? {} : { subscriptionId: fields.subscriptionId }),\n\t\t...(fields.nextSeq === undefined ? {} : { nextSeq: fields.nextSeq }),\n\t\t...(fields.commandId === undefined ? {} : { commandId: fields.commandId }),\n\t\t...(fields.issueCode === undefined ? {} : { issueCode: fields.issueCode }),\n\t\t...(fields.details === undefined ? {} : { details: fields.details }),\n\t};\n}\n\nfunction validateCommand(command: unknown): string | undefined {\n\tif (!isObjectRecord(command)) return \"command must be an object\";\n\tif (typeof command.kind !== \"string\") return \"command kind is required\";\n\tif (!isMessageBusCommandKind(command.kind)) return `unknown command kind '${command.kind}'`;\n\tif (\"topic\" in command) {\n\t\tif (typeof command.topic !== \"string\") return \"messageBus: topic must be a non-empty string\";\n\t\tconst topicError = validateTopicKey(command.topic, \"messageBus\");\n\t\tif (topicError !== undefined) return topicError;\n\t}\n\tif (\"subscriptionId\" in command && typeof command.subscriptionId !== \"string\") {\n\t\treturn \"subscriptionId must be a string\";\n\t}\n\tif (command.kind === \"publish\" && command.payload === undefined)\n\t\treturn \"publish payload is required\";\n\tif (command.kind === \"ack\" && !isPositiveSeq(command.seq))\n\t\treturn \"ack seq must be a positive integer\";\n\tif (command.kind === \"seek\" && !isPositiveSeq(command.nextSeq)) {\n\t\treturn \"seek nextSeq must be a positive integer\";\n\t}\n\tif (\n\t\tcommand.kind === \"topic-policy\" &&\n\t\tcommand.topicPolicy !== \"strict\" &&\n\t\tcommand.topicPolicy !== \"create-as-fact\"\n\t) {\n\t\treturn \"topicPolicy is not recognized\";\n\t}\n\treturn undefined;\n}\n\nfunction isMessageBusCommandKind(kind: string): kind is MessageBusCommand[\"kind\"] {\n\treturn (\n\t\tkind === \"ensure-topic\" ||\n\t\tkind === \"close-topic\" ||\n\t\tkind === \"publish\" ||\n\t\tkind === \"topic-policy\" ||\n\t\tkind === \"ack\" ||\n\t\tkind === \"seek\" ||\n\t\tkind === \"close-subscription\"\n\t);\n}\n\nfunction catalogPage(\n\tstate: MessageBusState,\n\tparams: MessageBusCatalogParams,\n): MessageBusCatalogPage {\n\tconst limit = positiveLimit(params.limit);\n\tconst topics = [...state.topics.entries()]\n\t\t.filter(\n\t\t\t([topic, value]) =>\n\t\t\t\t(params.includeClosed ? true : !value.closed) &&\n\t\t\t\t(params.afterTopic === undefined || topic > params.afterTopic),\n\t\t)\n\t\t.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n\tconst page = topics.slice(0, limit);\n\tconst hasMore = topics.length > limit;\n\treturn {\n\t\ttopics: page.map(([topic, value]) => ({\n\t\t\ttopic,\n\t\t\tclosed: value.closed,\n\t\t\theadSeq: value.headSeq,\n\t\t\tnextSeq: value.nextSeq,\n\t\t\tmessageCount: value.messages.length,\n\t\t})),\n\t\t...(hasMore && page.length > 0 ? { nextAfterTopic: page[page.length - 1]?.[0] } : {}),\n\t\thasMore,\n\t};\n}\n\nfunction topicPage<T>(\n\tstate: MessageBusState,\n\ttopicName: string,\n\tparams: MessageBusTopicParams,\n): MessageBusTopicPage<T> {\n\tconst topic = state.topics.get(topicName);\n\tconst start = params.afterSeq === undefined ? (topic?.headSeq ?? 1) : params.afterSeq + 1;\n\tconst all = (topic?.messages ?? []).filter((message) => message.seq >= start);\n\tconst limit = positiveLimit(params.limit);\n\tconst messages = all.slice(0, limit) as MessageBusMessage<T>[];\n\tconst hasMore = all.length > limit;\n\treturn {\n\t\ttopic: topicName,\n\t\tmessages,\n\t\tfromSeq: start,\n\t\t...(messages.length > 0 ? { throughSeq: messages[messages.length - 1]?.seq } : {}),\n\t\t...(hasMore && messages.length > 0 ? { nextAfterSeq: messages[messages.length - 1]?.seq } : {}),\n\t\thasMore,\n\t};\n}\n\nfunction availablePage<T>(\n\tstate: MessageBusState,\n\tsub: SubscriptionState,\n\tparams: MessageBusAvailableParams,\n): MessageBusAvailablePage<T> {\n\tconst cursor = cursorSnapshot(state, sub);\n\tconst start = params.afterSeq === undefined ? sub.nextSeq : params.afterSeq + 1;\n\tconst topic = state.topics.get(sub.topic);\n\tconst all = sub.retentionGap\n\t\t? []\n\t\t: (topic?.messages ?? []).filter((message) => message.seq >= start);\n\tconst limit = positiveLimit(params.limit);\n\tconst messages = all.slice(0, limit) as MessageBusMessage<T>[];\n\tconst hasMore = all.length > limit;\n\treturn {\n\t\ttopic: sub.topic,\n\t\tsubscriptionId: sub.subscriptionId,\n\t\tcursor,\n\t\tmessages,\n\t\tfromSeq: start,\n\t\t...(messages.length > 0 ? { throughSeq: messages[messages.length - 1]?.seq } : {}),\n\t\t...(hasMore && messages.length > 0 ? { nextAfterSeq: messages[messages.length - 1]?.seq } : {}),\n\t\thasMore,\n\t};\n}\n\nfunction deadLetterPage<T>(\n\tstate: MessageBusState,\n\tparams: MessageBusDeadLetterParams,\n): MessageBusDeadLetterPage<T> {\n\tconst limit = positiveLimit(params.limit);\n\tconst entries = state.deadLetters.filter((entry) => {\n\t\tif (params.afterEntrySeq !== undefined && entry.entrySeq <= params.afterEntrySeq) return false;\n\t\tif (params.topic !== undefined && entry.topic !== params.topic) return false;\n\t\tif (params.code !== undefined && entry.issue.code !== params.code) return false;\n\t\treturn true;\n\t});\n\tconst page = entries.slice(0, limit) as MessageBusDeadLetterEntry<T>[];\n\tconst hasMore = entries.length > limit;\n\treturn {\n\t\tentries: page,\n\t\t...(hasMore && page.length > 0 ? { nextAfterEntrySeq: page[page.length - 1]?.entrySeq } : {}),\n\t\thasMore,\n\t};\n}\n\nfunction cursorSnapshot(state: MessageBusState, sub: SubscriptionState): MessageBusCursor {\n\tconst topic = state.topics.get(sub.topic);\n\treturn {\n\t\ttopic: sub.topic,\n\t\tsubscriptionId: sub.subscriptionId,\n\t\tnextSeq: sub.nextSeq,\n\t\tclosed: sub.closed,\n\t\tretentionGap: sub.retentionGap,\n\t\theadSeq: topic?.headSeq ?? 1,\n\t};\n}\n\nfunction ensureSubscription(\n\tstate: MessageBusState,\n\topts: { topic: string; subscriptionId: string; from: \"earliest\" | \"latest\" | number },\n): SubscriptionState {\n\tconst key = `${opts.topic}\\u0000${opts.subscriptionId}`;\n\tconst existing = state.subscriptions.get(key);\n\tif (existing !== undefined) return existing;\n\tconst topic = state.topics.get(opts.topic);\n\tconst nextSeq =\n\t\topts.from === \"earliest\"\n\t\t\t? (topic?.headSeq ?? 1)\n\t\t\t: opts.from === \"latest\"\n\t\t\t\t? (topic?.nextSeq ?? 1)\n\t\t\t\t: opts.from;\n\tconst sub: SubscriptionState = {\n\t\ttopic: opts.topic,\n\t\tsubscriptionId: opts.subscriptionId,\n\t\tnextSeq,\n\t\tclosed: false,\n\t\tretentionGap: topic !== undefined && nextSeq < topic.headSeq,\n\t};\n\tstate.subscriptions.set(key, sub);\n\treturn sub;\n}\n\nfunction getSubscription(\n\tstate: MessageBusState,\n\ttopic: string,\n\tsubscriptionId: string,\n): SubscriptionState | undefined {\n\treturn state.subscriptions.get(`${topic}\\u0000${subscriptionId}`);\n}\n"],"mappings":";;;;;;;;;;AAIO,SAAS,WAAc,MAAiC;AAC9D,SAAQ,eAAe,MAAM,MAAM,IAAI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IACb,QAAQ,IAAI;AAAA,IACZ,cAAc,IAAI;AAAA,IAClB,SAAS,OAAO,WAAW;AAAA,EAC5B;AACD;AAEA,SAAS,mBACR,OACA,MACoB;AACpB,QAAM,MAAM,GAAG,KAAK,KAAK,KAAS,KAAK,cAAc;AACrD,QAAM,WAAW,MAAM,cAAc,IAAI,GAAG;AAC5C,MAAI,aAAa,OAAW,QAAO;AACnC,QAAM,QAAQ,MAAM,OAAO,IAAI,KAAK,KAAK;AACzC,QAAM,UACL,KAAK,SAAS,aACV,OAAO,WAAW,IACnB,KAAK,SAAS,WACZ,OAAO,WAAW,IACnB,KAAK;AACV,QAAM,MAAyB;AAAA,IAC9B,OAAO,KAAK;AAAA,IACZ,gBAAgB,KAAK;AAAA,IACrB;AAAA,IACA,QAAQ;AAAA,IACR,cAAc,UAAU,UAAa,UAAU,MAAM;AAAA,EACtD;AACA,QAAM,cAAc,IAAI,KAAK,GAAG;AAChC,SAAO;AACR;AAEA,SAAS,gBACR,OACA,OACA,gBACgC;AAChC,SAAO,MAAM,cAAc,IAAI,GAAG,KAAK,KAAS,cAAc,EAAE;AACjE;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
eventMessageIssue
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PVC7WDKI.js";
|
|
4
4
|
import {
|
|
5
5
|
depBatch
|
|
6
6
|
} from "./chunk-WQIA3GFB.js";
|
|
@@ -365,4 +365,4 @@ export {
|
|
|
365
365
|
eventFlow,
|
|
366
366
|
eventFlowProjection
|
|
367
367
|
};
|
|
368
|
-
//# sourceMappingURL=chunk-
|
|
368
|
+
//# sourceMappingURL=chunk-RAHNUYA5.js.map
|