@graphrefly/ts 0.0.1 → 0.0.2
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/dist/actions-types-CSC3NMDl.d.ts +657 -0
- package/dist/actions-types-wl9Mgkmr.d.cts +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-DZTJ3C-p.d.cts → agent-runtime-types-core-CaXfKNtY.d.cts} +171 -320
- package/dist/{agent-runtime-BesGDZcB.d.ts → agent-runtime-types-core-hU299uIC.d.ts} +171 -320
- package/dist/agent-runtime-types-tool-BEpSINol.d.ts +695 -0
- package/dist/agent-runtime-types-tool-DninPEzk.d.cts +695 -0
- package/dist/agentic-memory-retention-BmGX368S.d.ts +14 -0
- package/dist/agentic-memory-retention-Ih1qhX9Z.d.cts +14 -0
- package/dist/{agentic-memory-BmRCvh0d.d.ts → agentic-memory-types-CVSUS6XR.d.ts} +13 -57
- package/dist/{agentic-memory-DfuVZ-lY.d.cts → agentic-memory-types-FnnYlVUs.d.cts} +13 -57
- package/dist/{capability-admission-g0mn9hpq.d.ts → capability-admission-BW2CziT6.d.ts} +3 -3
- package/dist/{capability-admission-B0BzqAm5.d.cts → capability-admission-lwSecxXs.d.cts} +3 -3
- package/dist/chunk-2KUAG2GZ.js +9693 -0
- package/dist/chunk-2KUAG2GZ.js.map +1 -0
- package/dist/chunk-2NJP6GO4.js +1320 -0
- package/dist/chunk-2NJP6GO4.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-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-IXZBUWSP.js → chunk-7HZRJMN6.js} +2 -2
- package/dist/{chunk-SS2A464I.js → chunk-CJIFGJQG.js} +3 -3
- package/dist/{chunk-V7CIJE4B.js → chunk-CX6B6PO2.js} +92 -9
- package/dist/chunk-CX6B6PO2.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-HKK2JD7Z.js → chunk-ECURQ3HD.js} +12 -125
- package/dist/chunk-ECURQ3HD.js.map +1 -0
- package/dist/{chunk-3JR3EDB2.js → chunk-EOKT4QFF.js} +121 -115
- package/dist/chunk-EOKT4QFF.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-H75VXTGT.js → chunk-L6LDXRWE.js} +3 -3
- package/dist/{chunk-H75VXTGT.js.map → chunk-L6LDXRWE.js.map} +1 -1
- package/dist/{chunk-YXMZ2N6J.js → chunk-M7J6Z4IJ.js} +1071 -1025
- package/dist/chunk-M7J6Z4IJ.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-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-XKXWK2KP.js → chunk-SHZDP2MQ.js} +1157 -1021
- package/dist/chunk-SHZDP2MQ.js.map +1 -0
- package/dist/{chunk-CZNV3VXM.js → chunk-SIDJO2T4.js} +11 -11
- package/dist/chunk-STXRMPW4.js +4131 -0
- package/dist/chunk-STXRMPW4.js.map +1 -0
- package/dist/{chunk-2747WN4Y.js → chunk-TPND5MJS.js} +3 -3
- package/dist/chunk-TQPCAIQI.js +612 -0
- package/dist/chunk-TQPCAIQI.js.map +1 -0
- package/dist/{chunk-43BKLFZU.js → chunk-YDWBXXQZ.js} +10 -10
- 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 +1 -1
- package/dist/core/index.d.ts +1 -1
- 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-BpyJuWkw.d.ts → describe-B_A5fbXH.d.ts} +1 -1
- package/dist/{describe-DYMw_l1C.d.cts → describe-CQRrkv-Q.d.cts} +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-CWK3HLPB.d.cts} +133 -131
- package/dist/{graph-D-1-SQeC.d.ts → graph-ho5sotHP.d.ts} +133 -131
- package/dist/{index-Bmxeu0nK.d.ts → index-CQWcE0Dw.d.ts} +18 -4
- package/dist/{index-72VZC0-E.d.cts → index-DHA1i67c.d.cts} +18 -4
- 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-C0mAvWU1.d.cts +164 -0
- package/dist/measurements-OMpCeBwh.d.ts +164 -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-C9uMYz3i.d.ts +200 -0
- package/dist/process-types-h3uRlzDc.d.cts +200 -0
- package/dist/{reactive-collection-DNV0-gFi.d.cts → reactive-collection-B9R0Bl1P.d.cts} +4 -34
- package/dist/{reactive-collection-BAmfrGjd.d.ts → reactive-collection-BXFrH0U2.d.ts} +4 -34
- package/dist/{reactive-collection-storage-BNEldDyi.d.cts → reactive-collection-storage-BLGv8Xp8.d.cts} +5 -5
- package/dist/{reactive-collection-storage-YZsAQsWK.d.ts → reactive-collection-storage-a4zD3665.d.ts} +5 -5
- package/dist/{reactive-map-DRD1LJ2H.d.cts → reactive-map-C_8sOfdS.d.cts} +3 -2
- package/dist/{reactive-map-EsDiCmJk.d.ts → reactive-map-jle5dnok.d.ts} +3 -2
- package/dist/render/index.d.cts +2 -2
- package/dist/render/index.d.ts +2 -2
- package/dist/scheduled-readiness-5rwQlyjV.d.ts +91 -0
- package/dist/scheduled-readiness-DpRY8jI0.d.cts +91 -0
- package/dist/semantic-memory-graph-C2ZUwIlq.d.ts +30 -0
- package/dist/semantic-memory-graph-DlZBD_Eu.d.cts +30 -0
- package/dist/{semantic-memory-graph-DKuNzuWw.d.cts → semantic-memory-graph-types-BvzdqmkY.d.cts} +2 -28
- package/dist/{semantic-memory-graph-uwbwJdhe.d.ts → semantic-memory-graph-types-Ci-OtahO.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 +4 -4
- package/dist/sources/browser.d.ts +4 -4
- package/dist/sources/browser.js +4 -4
- 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-BmtEs9mG.d.ts} +1 -1
- package/dist/{store-CNJwmT-h.d.cts → store-PAAsYvML.d.cts} +1 -1
- package/dist/types-BRNKoFHj.d.ts +357 -0
- package/dist/{types-CcPIn7sy.d.cts → types-BS6CyR-x.d.cts} +27 -108
- package/dist/types-BWK2ay3e.d.cts +457 -0
- package/dist/types-BXKSAoE1.d.cts +357 -0
- package/dist/types-BaPpZItj.d.ts +457 -0
- package/dist/types-BhveCMg5.d.cts +274 -0
- package/dist/{types-BsJvElYZ.d.ts → types-C9NOgNJw.d.ts} +27 -108
- package/dist/types-CTsQ8Ww4.d.ts +274 -0
- package/dist/types-DL_05n2M.d.ts +34 -0
- package/dist/types-XDoqxYO9.d.cts +34 -0
- package/dist/{work-item-runtime-C3M79vE9.d.ts → work-item-runtime-types-BqtWnSCS.d.ts} +3 -93
- package/dist/{work-item-runtime-qaVgsL0T.d.cts → work-item-runtime-types-CHO03AKh.d.cts} +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 +603 -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-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-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
- /package/dist/{chunk-IXZBUWSP.js.map → chunk-7HZRJMN6.js.map} +0 -0
- /package/dist/{chunk-SS2A464I.js.map → chunk-CJIFGJQG.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-VTHLCFN4.js.map → chunk-RAHNUYA5.js.map} +0 -0
- /package/dist/{chunk-CZNV3VXM.js.map → chunk-SIDJO2T4.js.map} +0 -0
- /package/dist/{chunk-2747WN4Y.js.map → chunk-TPND5MJS.js.map} +0 -0
- /package/dist/{chunk-43BKLFZU.js.map → chunk-YDWBXXQZ.js.map} +0 -0
- /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
strictCanonicalJsonBytes,
|
|
18
18
|
strictJsonCodec
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-K7FB3JTD.js";
|
|
20
20
|
|
|
21
21
|
// src/batch/boundary.ts
|
|
22
22
|
var depth = 0;
|
|
@@ -731,7 +731,33 @@ function makeDepBookkeeping(depCount) {
|
|
|
731
731
|
};
|
|
732
732
|
}
|
|
733
733
|
|
|
734
|
-
// src/node/
|
|
734
|
+
// src/node/protocol-guards.ts
|
|
735
|
+
function terminalView(t) {
|
|
736
|
+
return t === void 0 ? false : t;
|
|
737
|
+
}
|
|
738
|
+
function normalizePullDemand(demand) {
|
|
739
|
+
if (typeof demand !== "object" || demand === null || Array.isArray(demand)) {
|
|
740
|
+
throw new Error("ctx.up: PULL requires { pullId, params? } demand payload (D269)");
|
|
741
|
+
}
|
|
742
|
+
const pullId = demand.pullId;
|
|
743
|
+
if (typeof pullId !== "string" && typeof pullId !== "symbol") {
|
|
744
|
+
throw new Error("ctx.up: PULL demand requires a string or symbol pullId (D269)");
|
|
745
|
+
}
|
|
746
|
+
const params = demand.params;
|
|
747
|
+
return params === void 0 ? { pullId } : { pullId, params };
|
|
748
|
+
}
|
|
749
|
+
function validateDownPayloads(msgs) {
|
|
750
|
+
for (const m of msgs) {
|
|
751
|
+
if (m[0] === "DATA" && m[1] === void 0) {
|
|
752
|
+
throw new Error("down: DATA requires a non-SENTINEL payload (R-data-payload)");
|
|
753
|
+
}
|
|
754
|
+
if (m[0] === "ERROR" && isInvalidErrorPayload(m[1])) {
|
|
755
|
+
throw new Error("down: ERROR requires a non-SENTINEL, non-boolean payload (R-data-payload)");
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// src/node/runtime-accessors.ts
|
|
735
761
|
var constructingCore;
|
|
736
762
|
var constructingEnvironment;
|
|
737
763
|
var ownerTokens = /* @__PURE__ */ new WeakMap();
|
|
@@ -752,6 +778,11 @@ function withNodeCore(core, create) {
|
|
|
752
778
|
constructingCore = prev;
|
|
753
779
|
}
|
|
754
780
|
}
|
|
781
|
+
function takeConstructingNodeCore() {
|
|
782
|
+
const core = constructingCore;
|
|
783
|
+
constructingCore = void 0;
|
|
784
|
+
return core;
|
|
785
|
+
}
|
|
755
786
|
function withEnvironmentDrivers(environment, create) {
|
|
756
787
|
const prev = constructingEnvironment;
|
|
757
788
|
constructingEnvironment = environment;
|
|
@@ -761,6 +792,11 @@ function withEnvironmentDrivers(environment, create) {
|
|
|
761
792
|
constructingEnvironment = prev;
|
|
762
793
|
}
|
|
763
794
|
}
|
|
795
|
+
function takeConstructingEnvironmentDrivers() {
|
|
796
|
+
const environment = constructingEnvironment;
|
|
797
|
+
constructingEnvironment = void 0;
|
|
798
|
+
return environment;
|
|
799
|
+
}
|
|
764
800
|
function getNodeOwner(n) {
|
|
765
801
|
return ownerTokens.get(n);
|
|
766
802
|
}
|
|
@@ -798,31 +834,1016 @@ function isNodeActiveForRelease(n) {
|
|
|
798
834
|
function isNodeRuntimeReleased(n) {
|
|
799
835
|
return releasedNodes.has(n);
|
|
800
836
|
}
|
|
801
|
-
|
|
802
|
-
|
|
837
|
+
|
|
838
|
+
// src/node/node-context-runtime.ts
|
|
839
|
+
function nodeBuildCtx(self) {
|
|
840
|
+
const kind = self._slot.handle ? self._slot.dispatcher.poolKind(self._slot.handle.poolId) : "sync";
|
|
841
|
+
if (kind === "sync") {
|
|
842
|
+
if (self._syncCtx === null) self._syncCtx = self._makeCtx();
|
|
843
|
+
self._refreshCtx(self._syncCtx);
|
|
844
|
+
return self._syncCtx;
|
|
845
|
+
}
|
|
846
|
+
return self._makeCtx({
|
|
847
|
+
waveData: self._dep.waveData.map((waves) => waves.map((w) => [...w])),
|
|
848
|
+
terminal: self._dep.terminalInput.map(terminalView),
|
|
849
|
+
latest: [...self._dep.prev]
|
|
850
|
+
});
|
|
803
851
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
806
|
-
|
|
852
|
+
function nodeMakeCtx(self, snapshot) {
|
|
853
|
+
const ctx = {
|
|
854
|
+
// Wave-owner boundary (D47): a SYNC fn's emit nests under the public entry that drove
|
|
855
|
+
// it (cheap inc/dec, no early drain); an ASYNC-pool fn re-enters here from its stashed
|
|
856
|
+
// ctx at depth 0, so this is the boundary that drains any rewireNext it issued.
|
|
857
|
+
up: (msgs, towardDep) => {
|
|
858
|
+
if (self._released) return;
|
|
859
|
+
enterWave();
|
|
860
|
+
try {
|
|
861
|
+
self._up(msgs, towardDep);
|
|
862
|
+
} finally {
|
|
863
|
+
exitWave();
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
down: (msgs) => {
|
|
867
|
+
if (self._released) return;
|
|
868
|
+
enterWave();
|
|
869
|
+
try {
|
|
870
|
+
self._down(msgs);
|
|
871
|
+
} finally {
|
|
872
|
+
exitWave();
|
|
873
|
+
}
|
|
874
|
+
},
|
|
875
|
+
waveData: snapshot?.waveData ?? self._dep.waveData,
|
|
876
|
+
terminal: snapshot?.terminal ?? self._dep.terminalInput.map(terminalView),
|
|
877
|
+
state: self._makeState(),
|
|
878
|
+
onDeactivation: (fn) => {
|
|
879
|
+
if (self._released) return;
|
|
880
|
+
self._hooks.onDeactivation.push(fn);
|
|
881
|
+
},
|
|
882
|
+
onInvalidate: (fn) => {
|
|
883
|
+
if (self._released) return;
|
|
884
|
+
self._hooks.onInvalidate.push(fn);
|
|
885
|
+
},
|
|
886
|
+
environment: () => self._slot.environment,
|
|
887
|
+
// R-rewire-deferred (D47): defer a self-dep-set mutation to the committed boundary.
|
|
888
|
+
rewireNext: {
|
|
889
|
+
subscribeDep: (dep, fn) => self._requestRewireNext({ kind: "add", dep, fn }),
|
|
890
|
+
unsubscribeDep: (dep, fn) => self._requestRewireNext({ kind: "remove", dep, fn }),
|
|
891
|
+
replaceDeps: (deps, fn) => self._requestRewireNext({ kind: "set", deps, fn })
|
|
892
|
+
},
|
|
893
|
+
// R-up-routing / R-pull (D269): deferred up — route a control/demand wave (e.g. PULL)
|
|
894
|
+
// up the declared cone at the committed boundary. The SELF-demand path: an
|
|
895
|
+
// immediate ctx.up whose delivery loops back re-enters this fn (D37 / R-reentrancy).
|
|
896
|
+
upNext: (msgs, towardDep) => self._requestUpNext(msgs, towardDep),
|
|
897
|
+
...self._control.activePull === void 0 ? {} : { pull: self._control.activePull },
|
|
898
|
+
[CTX_DEP_CACHE]: { latest: snapshot?.latest ?? self._dep.prev },
|
|
899
|
+
[CTX_NODE_BINDING]: {
|
|
900
|
+
dispatcher: self._slot.dispatcher,
|
|
901
|
+
create: (factory) => withEnvironmentDrivers(self._slot.environment, () => withNodeCore(self._core, factory))
|
|
902
|
+
}
|
|
903
|
+
};
|
|
904
|
+
if (self._slot.dynamic) {
|
|
905
|
+
ctx.track = (i) => ctx[CTX_DEP_CACHE]?.latest[i];
|
|
807
906
|
}
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
907
|
+
return ctx;
|
|
908
|
+
}
|
|
909
|
+
function nodeRefreshCtx(self, ctx) {
|
|
910
|
+
ctx.waveData = self._dep.waveData;
|
|
911
|
+
ctx.terminal = self._dep.terminalInput.map(terminalView);
|
|
912
|
+
if (self._control.activePull === void 0) {
|
|
913
|
+
delete ctx.pull;
|
|
914
|
+
} else {
|
|
915
|
+
ctx.pull = self._control.activePull;
|
|
916
|
+
}
|
|
917
|
+
ctx[CTX_DEP_CACHE] = { latest: self._dep.prev };
|
|
918
|
+
}
|
|
919
|
+
function nodeMakeState(self) {
|
|
920
|
+
return {
|
|
921
|
+
get: () => self._privateState.value,
|
|
922
|
+
set: (v) => {
|
|
923
|
+
self._privateState.value = v;
|
|
924
|
+
},
|
|
925
|
+
persist: (on = true) => {
|
|
926
|
+
self._privateState.persist = on;
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// src/node/node-input-runtime.ts
|
|
932
|
+
function nodeRecordDepProjection(self, idx, delivery) {
|
|
933
|
+
const token = delivery?.wave ?? {};
|
|
934
|
+
if (self._dep.waveTokens[idx] !== token) {
|
|
935
|
+
self._dep.waveData[idx].push([]);
|
|
936
|
+
self._dep.waveTokens[idx] = token;
|
|
937
|
+
}
|
|
938
|
+
return self._dep.waveData[idx][self._dep.waveData[idx].length - 1];
|
|
939
|
+
}
|
|
940
|
+
function nodeDepProjectionHasData(self, idx) {
|
|
941
|
+
const projection = self._dep.waveData[idx][self._dep.waveData[idx].length - 1];
|
|
942
|
+
return projection?.some((v) => v !== SENTINEL) ?? false;
|
|
943
|
+
}
|
|
944
|
+
function nodeReceiveFromDep(self, idx, msg, delivery) {
|
|
945
|
+
if (self._released) return;
|
|
946
|
+
const t = msg[0];
|
|
947
|
+
if (t === "START") return;
|
|
948
|
+
const isLastInDeliveredWave = delivery?.last ?? true;
|
|
949
|
+
if (self._value.terminal !== void 0) {
|
|
950
|
+
if (t === "TEARDOWN") self._down([["TEARDOWN"]]);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (t === "INVALIDATE") {
|
|
954
|
+
const projection = self._recordDepProjection(idx, delivery);
|
|
955
|
+
projection.push(SENTINEL);
|
|
956
|
+
if (projection.some((v) => v !== SENTINEL) && isLastInDeliveredWave) self._maybeRun();
|
|
957
|
+
self._dep.prev[idx] = SENTINEL;
|
|
958
|
+
self._dep.hasData[idx] = false;
|
|
959
|
+
self._dep.batch[idx] = null;
|
|
960
|
+
if (self._dep.dirty[idx]) {
|
|
961
|
+
self._dep.dirty[idx] = false;
|
|
962
|
+
self._wave.pending--;
|
|
963
|
+
}
|
|
964
|
+
if (self._control.pausedDepWaveOccurred && self._dep.batch.every((b) => b === null)) {
|
|
965
|
+
self._control.pausedDepWaveOccurred = false;
|
|
966
|
+
}
|
|
967
|
+
const hadData = self._value.hasData;
|
|
968
|
+
self._invalidate();
|
|
969
|
+
if (self._wave.pending === 0 && self._wave.emittedDirtyThisWave) {
|
|
970
|
+
if (!hadData) self._down([["RESOLVED"]]);
|
|
971
|
+
else self._wave.emittedDirtyThisWave = false;
|
|
972
|
+
}
|
|
973
|
+
self._fireOwedDemandIfReady();
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
if (isTerminal(t)) {
|
|
977
|
+
const isError = t === "ERROR";
|
|
978
|
+
const errPayload = isError ? msg[1] : void 0;
|
|
979
|
+
self._dep.terminal[idx] = isError ? errPayload : true;
|
|
980
|
+
self._dep.terminalInput[idx] = isError ? errPayload : true;
|
|
981
|
+
self._releaseDepDirty(idx);
|
|
982
|
+
const ranValueBeforeTerminal = self._depProjectionHasData(idx) && isLastInDeliveredWave;
|
|
983
|
+
if (ranValueBeforeTerminal) self._maybeRun();
|
|
984
|
+
if (isError && self._slot.errorWhenDepsError) {
|
|
985
|
+
self._down([["ERROR", errPayload]]);
|
|
986
|
+
} else if (self._slot.terminalAsRealInput) {
|
|
987
|
+
if (ranValueBeforeTerminal) {
|
|
988
|
+
self._fireOwedDemandIfReady();
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
self._maybeRun();
|
|
992
|
+
} else if (self._slot.completeWhenDepsComplete && self._allDepsTerminal()) {
|
|
993
|
+
self._down([["COMPLETE"]]);
|
|
994
|
+
} else {
|
|
995
|
+
self._settleAfterAbsorbedTerminal();
|
|
996
|
+
}
|
|
997
|
+
self._fireOwedDemandIfReady();
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
1000
|
+
if (t === "TEARDOWN") {
|
|
1001
|
+
self._down([["TEARDOWN"]]);
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
if (t === "DIRTY") {
|
|
1005
|
+
if (!self._dep.dirty[idx]) {
|
|
1006
|
+
self._dep.dirty[idx] = true;
|
|
1007
|
+
self._wave.pending++;
|
|
1008
|
+
self._dep.tier[idx] = 2;
|
|
1009
|
+
self._markDirty();
|
|
1010
|
+
}
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (t === "DATA") {
|
|
1014
|
+
const v = msg[1];
|
|
1015
|
+
self._recordDepProjection(idx, delivery).push(v);
|
|
1016
|
+
const b = self._dep.batch[idx];
|
|
1017
|
+
if (b === null) self._dep.batch[idx] = [v];
|
|
1018
|
+
else b.push(v);
|
|
1019
|
+
self._dep.prev[idx] = v;
|
|
1020
|
+
self._dep.hasData[idx] = true;
|
|
1021
|
+
self._dep.tier[idx] = 3;
|
|
1022
|
+
if (self._dep.dirty[idx]) {
|
|
1023
|
+
self._dep.dirty[idx] = false;
|
|
1024
|
+
self._wave.pending--;
|
|
1025
|
+
}
|
|
1026
|
+
if (isLastInDeliveredWave) self._maybeRun();
|
|
1027
|
+
self._fireOwedDemandIfReady();
|
|
1028
|
+
return;
|
|
1029
|
+
}
|
|
1030
|
+
if (t === "RESOLVED") {
|
|
1031
|
+
self._recordDepProjection(idx, delivery);
|
|
1032
|
+
self._dep.tier[idx] = 3;
|
|
1033
|
+
if (self._dep.dirty[idx]) {
|
|
1034
|
+
self._dep.dirty[idx] = false;
|
|
1035
|
+
self._wave.pending--;
|
|
1036
|
+
}
|
|
1037
|
+
if (isLastInDeliveredWave) self._maybeRun();
|
|
1038
|
+
self._fireOwedDemandIfReady();
|
|
1039
|
+
return;
|
|
811
1040
|
}
|
|
812
|
-
const params = demand.params;
|
|
813
|
-
return params === void 0 ? { pullId } : { pullId, params };
|
|
814
1041
|
}
|
|
815
|
-
function
|
|
1042
|
+
function nodeReleaseDepDirty(self, idx) {
|
|
1043
|
+
if (self._dep.dirty[idx]) {
|
|
1044
|
+
self._dep.dirty[idx] = false;
|
|
1045
|
+
self._wave.pending--;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
function nodeSettleAfterAbsorbedTerminal(self) {
|
|
1049
|
+
if (self._wave.pending !== 0 || !self._wave.emittedDirtyThisWave) return;
|
|
1050
|
+
const sawData = self._dep.batch.some((b) => b !== null && b.length > 0);
|
|
1051
|
+
if (sawData) self._maybeRun();
|
|
1052
|
+
if (self._wave.emittedDirtyThisWave) self._down([["RESOLVED"]]);
|
|
1053
|
+
}
|
|
1054
|
+
function nodeMarkDirty(self) {
|
|
1055
|
+
self._value.status = "dirty";
|
|
1056
|
+
if (self._isPullQuiet()) return;
|
|
1057
|
+
if (!self._wave.emittedDirtyThisWave) {
|
|
1058
|
+
self._wave.emittedDirtyThisWave = true;
|
|
1059
|
+
self._emitToSubs(["DIRTY"]);
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
function nodeMaybeRun(self) {
|
|
1063
|
+
if (self._wave.inDepMutation) {
|
|
1064
|
+
self._wave.rewireRunPending = true;
|
|
1065
|
+
return;
|
|
1066
|
+
}
|
|
1067
|
+
if (self._slot.pausable === true && (self._isPaused() || self._isPullQuiet())) {
|
|
1068
|
+
self._control.pausedDepWaveOccurred = true;
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
self._tryRun();
|
|
1072
|
+
}
|
|
1073
|
+
function nodeSettleRewire(self) {
|
|
1074
|
+
if (self._slot.pausable === true && self._isPaused()) {
|
|
1075
|
+
self._control.pausedDepWaveOccurred = true;
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
if (self._wave.pending > 0) return;
|
|
1079
|
+
if (self._slot.handle === null) {
|
|
1080
|
+
self._passthroughEmit();
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
if (!self._wave.hasCalledFnOnce && !(self._slot.partial || self._allDepsSettled())) return;
|
|
1084
|
+
self._markDirty();
|
|
1085
|
+
self._runWave();
|
|
1086
|
+
}
|
|
1087
|
+
function nodeTryRun(self) {
|
|
1088
|
+
if (self._wave.pending > 0) return;
|
|
1089
|
+
if (self._slot.handle === null) {
|
|
1090
|
+
self._passthroughEmit();
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
if (!self._wave.hasCalledFnOnce) {
|
|
1094
|
+
if (self._slot.partial || self._allDepsSettled()) self._runWave();
|
|
1095
|
+
return;
|
|
1096
|
+
}
|
|
1097
|
+
self._runWave();
|
|
1098
|
+
}
|
|
1099
|
+
function nodeAllDepsSettled(self) {
|
|
1100
|
+
for (let i = 0; i < self._slot.deps.length; i++) {
|
|
1101
|
+
if (self._dep.hasData[i]) continue;
|
|
1102
|
+
if (self._slot.terminalAsRealInput && self._dep.terminal[i] !== void 0) continue;
|
|
1103
|
+
return false;
|
|
1104
|
+
}
|
|
1105
|
+
return true;
|
|
1106
|
+
}
|
|
1107
|
+
function nodePassthroughEmit(self) {
|
|
1108
|
+
const b = self._dep.batch[0];
|
|
1109
|
+
if (b !== null && b.length > 0) {
|
|
1110
|
+
self._down([["DATA", b[b.length - 1]]]);
|
|
1111
|
+
} else if (self._wave.emittedDirtyThisWave) {
|
|
1112
|
+
self._down([["RESOLVED"]]);
|
|
1113
|
+
}
|
|
1114
|
+
self._dep.batch[0] = null;
|
|
1115
|
+
self._wave.emittedDirtyThisWave = false;
|
|
1116
|
+
}
|
|
1117
|
+
function nodeRunWave(self) {
|
|
1118
|
+
if (self._wave.insideRunWave)
|
|
1119
|
+
throw new Error(
|
|
1120
|
+
"synchronous feedback cycle: node fn re-entered its own wave (R-reentrancy / D37)"
|
|
1121
|
+
);
|
|
1122
|
+
self._wave.hasCalledFnOnce = true;
|
|
1123
|
+
self._hooks.onInvalidate = [];
|
|
1124
|
+
self._hooks.onDeactivation = [];
|
|
1125
|
+
const ctx = self._buildCtx();
|
|
1126
|
+
const wasDirty = self._wave.emittedDirtyThisWave;
|
|
1127
|
+
self._wave.emittedSettleThisWave = false;
|
|
1128
|
+
self._wave.insideRunWave = true;
|
|
1129
|
+
try {
|
|
1130
|
+
self._slot.dispatcher.invoke(self._slot.handle, ctx);
|
|
1131
|
+
} finally {
|
|
1132
|
+
self._wave.insideRunWave = false;
|
|
1133
|
+
}
|
|
1134
|
+
if (wasDirty && !self._wave.emittedSettleThisWave && self._value.terminal === void 0 && !self._isAsyncPool()) {
|
|
1135
|
+
self._down([["RESOLVED"]]);
|
|
1136
|
+
}
|
|
1137
|
+
for (let i = 0; i < self._dep.batch.length; i++) {
|
|
1138
|
+
self._dep.batch[i] = null;
|
|
1139
|
+
self._dep.waveData[i] = [];
|
|
1140
|
+
self._dep.waveTokens[i] = void 0;
|
|
1141
|
+
self._dep.terminalInput[i] = void 0;
|
|
1142
|
+
}
|
|
1143
|
+
self._wave.emittedDirtyThisWave = false;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
// src/node/node-runtime-host.ts
|
|
1147
|
+
function nodeRuntimeHost(node2) {
|
|
1148
|
+
return node2;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// src/node/node-lifecycle-runtime.ts
|
|
1152
|
+
function nodeActivate(self) {
|
|
1153
|
+
self._lifecycle.activated = true;
|
|
1154
|
+
const seedRestoredDeps = self._restoredActivationPending;
|
|
1155
|
+
self._restoredActivationPending = false;
|
|
1156
|
+
self._dep.unsubs = new Array(self._slot.deps.length);
|
|
1157
|
+
self._dep.idxBoxes = new Array(self._slot.deps.length);
|
|
1158
|
+
for (const dep of self._slot.deps) self._subscribeDepAt(dep, { seedRestored: seedRestoredDeps });
|
|
1159
|
+
if (self._slot.deps.length === 0 && self._slot.handle !== null && !self._wave.hasCalledFnOnce) {
|
|
1160
|
+
self._runWave();
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
function nodeSubscribeDepAt(self, depNode, opts = {}) {
|
|
1164
|
+
const idx0 = self._slot.deps.indexOf(depNode);
|
|
1165
|
+
const box = { v: idx0 };
|
|
1166
|
+
let ignoreInitialPush = opts.seedRestored === true;
|
|
1167
|
+
if (ignoreInitialPush && idx0 !== -1) {
|
|
1168
|
+
self._seedRestoredDepAt(idx0, depNode);
|
|
1169
|
+
const dep = nodeRuntimeHost(depNode);
|
|
1170
|
+
if (dep._value.terminal !== void 0 && !dep._slot.resubscribable) {
|
|
1171
|
+
self._dep.unsubs[idx0] = () => {
|
|
1172
|
+
};
|
|
1173
|
+
self._dep.idxBoxes[idx0] = box;
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
const unsub = depNode.subscribe((msg, delivery) => {
|
|
1178
|
+
if (ignoreInitialPush && delivery === void 0) return;
|
|
1179
|
+
if (ignoreInitialPush) ignoreInitialPush = false;
|
|
1180
|
+
if (box.v === -1) return;
|
|
1181
|
+
self._receiveFromDep(box.v, msg, delivery);
|
|
1182
|
+
});
|
|
1183
|
+
if (ignoreInitialPush && idx0 !== -1 && box.v !== -1) self._seedRestoredDepAt(idx0, depNode);
|
|
1184
|
+
ignoreInitialPush = false;
|
|
1185
|
+
if (idx0 !== -1) {
|
|
1186
|
+
self._dep.unsubs[idx0] = unsub;
|
|
1187
|
+
self._dep.idxBoxes[idx0] = box;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function nodeSeedRestoredDepAt(self, idx, depNode) {
|
|
1191
|
+
const dep = nodeRuntimeHost(depNode);
|
|
1192
|
+
const seedData = dep._value.hasData && !dep._slot.pull;
|
|
1193
|
+
self._dep.batch[idx] = null;
|
|
1194
|
+
self._dep.waveData[idx] = [];
|
|
1195
|
+
self._dep.waveTokens[idx] = void 0;
|
|
1196
|
+
self._dep.prev[idx] = seedData ? dep._value.cache : SENTINEL;
|
|
1197
|
+
self._dep.hasData[idx] = seedData;
|
|
1198
|
+
self._dep.dirty[idx] = false;
|
|
1199
|
+
self._dep.tier[idx] = seedData ? 3 : 0;
|
|
1200
|
+
self._dep.terminal[idx] = dep._value.terminal;
|
|
1201
|
+
self._dep.terminalInput[idx] = void 0;
|
|
1202
|
+
}
|
|
1203
|
+
function nodeDeactivate(self) {
|
|
1204
|
+
self._lifecycle.activated = false;
|
|
1205
|
+
for (const u of self._dep.unsubs) if (u) u();
|
|
1206
|
+
self._dep.unsubs = [];
|
|
1207
|
+
self._dep.idxBoxes = [];
|
|
1208
|
+
for (const fn of self._hooks.onDeactivation) fn();
|
|
1209
|
+
self._hooks.onDeactivation = [];
|
|
1210
|
+
self._hooks.onInvalidate = [];
|
|
1211
|
+
const isCompute = self._slot.handle !== null || self._slot.deps.length > 0;
|
|
1212
|
+
if (isCompute) {
|
|
1213
|
+
self._value.cache = SENTINEL;
|
|
1214
|
+
self._value.hasData = false;
|
|
1215
|
+
self._value.status = "sentinel";
|
|
1216
|
+
}
|
|
1217
|
+
self._resetDepState();
|
|
1218
|
+
self._wave.hasCalledFnOnce = false;
|
|
1219
|
+
self._control.pauseLockset.clear();
|
|
1220
|
+
self._control.pauseBuffer = [];
|
|
1221
|
+
self._control.pausedDepWaveOccurred = false;
|
|
1222
|
+
self._control.demandOwed = void 0;
|
|
1223
|
+
self._control.activePull = void 0;
|
|
1224
|
+
self._control.pullDirtyOwed = false;
|
|
1225
|
+
self._value.replayRing = [];
|
|
1226
|
+
if (!self._privateState.persist) self._privateState.value = SENTINEL;
|
|
1227
|
+
}
|
|
1228
|
+
function nodeSubscriberCount(self) {
|
|
1229
|
+
return self._lifecycle.subscribers.size;
|
|
1230
|
+
}
|
|
1231
|
+
function nodeIsRuntimeQuiescentForRelease(self) {
|
|
1232
|
+
return !self._released && self._value.status !== "dirty" && self._value.status !== "pending" && self._wave.pending === 0 && !self._wave.insideRunWave && !self._wave.inDepMutation && !self._wave.rewireRunPending && !self._wave.batchDirtyOwed && self._dep.dirty.every((dirty) => !dirty) && self._control.pauseBuffer.length === 0 && !self._control.pausedDepWaveOccurred && self._control.demandOwed === void 0 && self._control.activePull === void 0 && !self._control.inDeliverDemand && self._control.pauseLockset.size === 0;
|
|
1233
|
+
}
|
|
1234
|
+
function nodeReleaseRuntime(self) {
|
|
1235
|
+
if (self._released) return;
|
|
1236
|
+
self._released = true;
|
|
1237
|
+
const node2 = self;
|
|
1238
|
+
releasedNodes.add(node2);
|
|
1239
|
+
let releaseError;
|
|
1240
|
+
const recordReleaseError = (error) => {
|
|
1241
|
+
if (releaseError === void 0) releaseError = error;
|
|
1242
|
+
};
|
|
1243
|
+
self._lifecycle.activated = false;
|
|
1244
|
+
for (const u of self._dep.unsubs) {
|
|
1245
|
+
try {
|
|
1246
|
+
u();
|
|
1247
|
+
} catch (error) {
|
|
1248
|
+
recordReleaseError(error);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
for (const fn of self._hooks.onDeactivation) {
|
|
1252
|
+
try {
|
|
1253
|
+
fn();
|
|
1254
|
+
} catch (error) {
|
|
1255
|
+
recordReleaseError(error);
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
self._dep.unsubs = [];
|
|
1259
|
+
self._dep.idxBoxes = [];
|
|
1260
|
+
self._lifecycle.subscribers.clear();
|
|
1261
|
+
if (self._slot.handle !== null) {
|
|
1262
|
+
self._slot.dispatcher.unregister(self._slot.handle);
|
|
1263
|
+
self._slot.handle = null;
|
|
1264
|
+
}
|
|
1265
|
+
self._slot.deps = [];
|
|
1266
|
+
self._dep.batch = [];
|
|
1267
|
+
self._dep.waveData = [];
|
|
1268
|
+
self._dep.waveTokens = [];
|
|
1269
|
+
self._dep.prev = [];
|
|
1270
|
+
self._dep.hasData = [];
|
|
1271
|
+
self._dep.dirty = [];
|
|
1272
|
+
self._dep.tier = [];
|
|
1273
|
+
self._dep.terminal = [];
|
|
1274
|
+
self._dep.terminalInput = [];
|
|
1275
|
+
self._value.cache = SENTINEL;
|
|
1276
|
+
self._value.hasData = false;
|
|
1277
|
+
self._value.status = "sentinel";
|
|
1278
|
+
self._value.terminal = void 0;
|
|
1279
|
+
self._value.replayRing = [];
|
|
1280
|
+
self._privateState.value = SENTINEL;
|
|
1281
|
+
self._privateState.persist = false;
|
|
1282
|
+
self._syncCtx = null;
|
|
1283
|
+
self._resetDepState();
|
|
1284
|
+
self._hooks.onDeactivation = [];
|
|
1285
|
+
self._hooks.onInvalidate = [];
|
|
1286
|
+
self._control.pauseLockset.clear();
|
|
1287
|
+
self._control.pauseBuffer = [];
|
|
1288
|
+
self._control.pausedDepWaveOccurred = false;
|
|
1289
|
+
self._control.demandOwed = void 0;
|
|
1290
|
+
self._control.activePull = void 0;
|
|
1291
|
+
self._control.pullDirtyOwed = false;
|
|
1292
|
+
self._restoredActivationPending = false;
|
|
1293
|
+
checkpointReaders.delete(node2);
|
|
1294
|
+
restoreWriters.delete(node2);
|
|
1295
|
+
runtimeReleasers.delete(node2);
|
|
1296
|
+
runtimeQuiescenceReaders.delete(node2);
|
|
1297
|
+
subscriberCountReaders.delete(node2);
|
|
1298
|
+
activationReaders.delete(node2);
|
|
1299
|
+
ownerTokens.delete(node2);
|
|
1300
|
+
topologyDepsChangedObservers.delete(node2);
|
|
1301
|
+
self._core.releaseSlot(self._id);
|
|
1302
|
+
if (releaseError !== void 0) throw releaseError;
|
|
1303
|
+
}
|
|
1304
|
+
function nodeResetDepState(self) {
|
|
1305
|
+
const n = self._slot.deps.length;
|
|
1306
|
+
for (let i = 0; i < n; i++) {
|
|
1307
|
+
self._dep.batch[i] = null;
|
|
1308
|
+
self._dep.waveData[i] = [];
|
|
1309
|
+
self._dep.waveTokens[i] = void 0;
|
|
1310
|
+
self._dep.prev[i] = SENTINEL;
|
|
1311
|
+
self._dep.hasData[i] = false;
|
|
1312
|
+
self._dep.dirty[i] = false;
|
|
1313
|
+
self._dep.tier[i] = 0;
|
|
1314
|
+
self._dep.terminal[i] = void 0;
|
|
1315
|
+
self._dep.terminalInput[i] = void 0;
|
|
1316
|
+
}
|
|
1317
|
+
self._wave.pending = 0;
|
|
1318
|
+
self._wave.emittedDirtyThisWave = false;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
// src/node/node-output-runtime.ts
|
|
1322
|
+
function nodeDown(self, msgs) {
|
|
1323
|
+
if (self._released) return;
|
|
1324
|
+
validateDownPayloads(msgs);
|
|
1325
|
+
const deliveryWave = {};
|
|
1326
|
+
const assertVersionDataCompatible = (wave) => {
|
|
1327
|
+
for (const m of wave) {
|
|
1328
|
+
if (m[0] === "DATA") assertNodeVersionDataCompatible(self._version.policy, m[1]);
|
|
1329
|
+
}
|
|
1330
|
+
};
|
|
1331
|
+
const snapshotVersionData = (wave) => wave.map(
|
|
1332
|
+
(m) => m[0] === "DATA" ? ["DATA", snapshotNodeVersionData(self._version.policy, m[1])] : m
|
|
1333
|
+
);
|
|
1334
|
+
assertVersionDataCompatible(msgs);
|
|
1335
|
+
if (self._value.terminal !== void 0) {
|
|
1336
|
+
if (!msgs.some((m) => m[0] === "TEARDOWN")) return;
|
|
1337
|
+
self._value.hasTorndown = true;
|
|
1338
|
+
if (self._slot.resetOnTeardown) {
|
|
1339
|
+
self._value.cache = SENTINEL;
|
|
1340
|
+
self._value.hasData = false;
|
|
1341
|
+
}
|
|
1342
|
+
self._emitToSubs(["TEARDOWN"], { wave: deliveryWave, last: true });
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
let sorted = [...msgs].sort((a, b) => messageTier(a[0]) - messageTier(b[0]));
|
|
1346
|
+
const firstInvalidate = sorted.findIndex((m) => m[0] === "INVALIDATE");
|
|
1347
|
+
if (firstInvalidate !== -1) {
|
|
1348
|
+
sorted = sorted.filter((m, i) => m[0] !== "INVALIDATE" || i === firstInvalidate);
|
|
1349
|
+
}
|
|
1350
|
+
const hasTeardown = sorted.some((m) => m[0] === "TEARDOWN");
|
|
1351
|
+
const hasTerminal = sorted.some((m) => m[0] === "COMPLETE" || m[0] === "ERROR");
|
|
1352
|
+
if (hasTeardown && !hasTerminal && self._value.terminal === void 0 && !self._value.hasTorndown) {
|
|
1353
|
+
sorted = [["COMPLETE"], ...sorted];
|
|
1354
|
+
}
|
|
1355
|
+
if (!self._wave.insideRunWave && currentBatch()) {
|
|
1356
|
+
const deferred = snapshotVersionData(sorted.filter((m) => isDeferredTier(m[0])));
|
|
1357
|
+
if (deferred.length > 0) {
|
|
1358
|
+
if (!self._wave.emittedDirtyThisWave) {
|
|
1359
|
+
self._wave.emittedDirtyThisWave = true;
|
|
1360
|
+
self._value.status = "dirty";
|
|
1361
|
+
self._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
|
|
1362
|
+
}
|
|
1363
|
+
self._wave.batchDirtyOwed = true;
|
|
1364
|
+
deferToBatch(self, deferred);
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
if (self._shouldBufferOnPause()) {
|
|
1369
|
+
const buffered = snapshotVersionData(sorted.filter((m) => isPauseBufferedTier(m[0])));
|
|
1370
|
+
if (buffered.length > 0) {
|
|
1371
|
+
self._wave.emittedSettleThisWave = true;
|
|
1372
|
+
self._control.pauseBuffer.push(buffered);
|
|
1373
|
+
}
|
|
1374
|
+
sorted = sorted.filter((m) => !isPauseBufferedTier(m[0]));
|
|
1375
|
+
if (sorted.length === 0) return;
|
|
1376
|
+
}
|
|
1377
|
+
let dataCount = 0;
|
|
1378
|
+
let hasTier3 = false;
|
|
1379
|
+
let hasResolved = false;
|
|
1380
|
+
for (const m of sorted) {
|
|
1381
|
+
if (m[0] === "DATA") dataCount++;
|
|
1382
|
+
if (m[0] === "RESOLVED") hasResolved = true;
|
|
1383
|
+
if (isValueTier(m[0])) hasTier3 = true;
|
|
1384
|
+
}
|
|
1385
|
+
if (dataCount >= 1 && hasResolved) {
|
|
1386
|
+
throw new Error(
|
|
1387
|
+
"down: a wave cannot mix DATA and RESOLVED (tier-3 exclusivity, R-resolved-undirty)"
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
const plannedVersions = new Array(sorted.length);
|
|
1391
|
+
if (dataCount > 0) {
|
|
1392
|
+
let plannedVersion = self._version.value;
|
|
1393
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
1394
|
+
const m = sorted[i];
|
|
1395
|
+
if (m[0] !== "DATA") continue;
|
|
1396
|
+
plannedVersion = advanceNodeVersion(plannedVersion, self._version.policy, m[1]);
|
|
1397
|
+
plannedVersions[i] = plannedVersion;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
if (hasTier3 && (!self._wave.insideRunWave || self._control.pullDirtyOwed) && !self._wave.emittedDirtyThisWave) {
|
|
1401
|
+
self._wave.emittedDirtyThisWave = true;
|
|
1402
|
+
self._value.status = "dirty";
|
|
1403
|
+
self._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
|
|
1404
|
+
}
|
|
1405
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
1406
|
+
const m = sorted[i];
|
|
1407
|
+
const delivery = { wave: deliveryWave, last: i === sorted.length - 1 };
|
|
1408
|
+
if (isDeferredTier(m[0])) self._wave.emittedSettleThisWave = true;
|
|
1409
|
+
if (m[0] === "DIRTY") {
|
|
1410
|
+
if (!self._wave.emittedDirtyThisWave) {
|
|
1411
|
+
self._wave.emittedDirtyThisWave = true;
|
|
1412
|
+
self._value.status = "dirty";
|
|
1413
|
+
self._emitToSubs(["DIRTY"], delivery);
|
|
1414
|
+
}
|
|
1415
|
+
continue;
|
|
1416
|
+
}
|
|
1417
|
+
if (m[0] === "DATA") {
|
|
1418
|
+
const v = m[1];
|
|
1419
|
+
self._value.cache = v;
|
|
1420
|
+
self._value.hasData = true;
|
|
1421
|
+
self._value.status = "settled";
|
|
1422
|
+
self._version.value = plannedVersions[i];
|
|
1423
|
+
if (self._slot.replayN > 0) {
|
|
1424
|
+
self._value.replayRing.push(v);
|
|
1425
|
+
if (self._value.replayRing.length > self._slot.replayN) self._value.replayRing.shift();
|
|
1426
|
+
}
|
|
1427
|
+
self._emitToSubs(["DATA", v], delivery);
|
|
1428
|
+
continue;
|
|
1429
|
+
}
|
|
1430
|
+
if (m[0] === "RESOLVED") {
|
|
1431
|
+
self._value.status = self._value.hasData ? "resolved" : "sentinel";
|
|
1432
|
+
self._emitToSubs(["RESOLVED"], delivery);
|
|
1433
|
+
continue;
|
|
1434
|
+
}
|
|
1435
|
+
if (m[0] === "INVALIDATE") {
|
|
1436
|
+
self._invalidate(delivery);
|
|
1437
|
+
continue;
|
|
1438
|
+
}
|
|
1439
|
+
if (m[0] === "COMPLETE") {
|
|
1440
|
+
if (self._value.terminal !== void 0) continue;
|
|
1441
|
+
self._value.terminal = true;
|
|
1442
|
+
self._control.pauseBuffer = [];
|
|
1443
|
+
self._value.status = "completed";
|
|
1444
|
+
self._emitToSubs(["COMPLETE"], delivery);
|
|
1445
|
+
continue;
|
|
1446
|
+
}
|
|
1447
|
+
if (m[0] === "ERROR") {
|
|
1448
|
+
if (self._value.terminal !== void 0) continue;
|
|
1449
|
+
self._value.terminal = m[1];
|
|
1450
|
+
self._control.pauseBuffer = [];
|
|
1451
|
+
self._value.status = "errored";
|
|
1452
|
+
self._emitToSubs(["ERROR", m[1]], delivery);
|
|
1453
|
+
continue;
|
|
1454
|
+
}
|
|
1455
|
+
if (m[0] === "TEARDOWN") {
|
|
1456
|
+
self._value.hasTorndown = true;
|
|
1457
|
+
if (self._slot.resetOnTeardown) {
|
|
1458
|
+
self._value.cache = SENTINEL;
|
|
1459
|
+
self._value.hasData = false;
|
|
1460
|
+
}
|
|
1461
|
+
self._emitToSubs(["TEARDOWN"], delivery);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
if (!self._wave.insideRunWave) self._wave.emittedDirtyThisWave = false;
|
|
1465
|
+
}
|
|
1466
|
+
function nodeUp(self, msgs, towardDep, route) {
|
|
1467
|
+
if (self._released) return;
|
|
1468
|
+
const routeState = route ?? { demandFired: /* @__PURE__ */ new Map() };
|
|
816
1469
|
for (const m of msgs) {
|
|
817
|
-
if (m[0]
|
|
818
|
-
throw new Error(
|
|
1470
|
+
if (!isUpAllowed(m[0])) {
|
|
1471
|
+
throw new Error(
|
|
1472
|
+
`ctx.up: ${m[0]} is down-only (tier ${messageTier(m[0])}); up carries control tiers only (R-ctx-up)`
|
|
1473
|
+
);
|
|
819
1474
|
}
|
|
820
|
-
|
|
821
|
-
|
|
1475
|
+
}
|
|
1476
|
+
for (const m of msgs) {
|
|
1477
|
+
if (m[0] === "PAUSE") {
|
|
1478
|
+
self._pauseAcquire(m[1]);
|
|
1479
|
+
} else if (m[0] === "RESUME") {
|
|
1480
|
+
if (self._control.pauseLockset.has(m[1])) {
|
|
1481
|
+
self._pauseRelease(m[1]);
|
|
1482
|
+
} else {
|
|
1483
|
+
self._forwardUp(m, towardDep, routeState);
|
|
1484
|
+
}
|
|
1485
|
+
} else if (m[0] === "PULL") {
|
|
1486
|
+
const demand = normalizePullDemand(m[1]);
|
|
1487
|
+
if (self._slot.pull && demand.pullId === self._slot.pullLock) {
|
|
1488
|
+
if (!self._markDemandRouted(demand.pullId, routeState)) self._onDemand(demand);
|
|
1489
|
+
} else {
|
|
1490
|
+
self._forwardUp(["PULL", demand], towardDep, routeState);
|
|
1491
|
+
}
|
|
1492
|
+
} else if (self._slot.deps.length === 0) {
|
|
1493
|
+
if (m[0] === "INVALIDATE") self._down([["INVALIDATE"]]);
|
|
1494
|
+
} else {
|
|
1495
|
+
self._forwardUp(m, towardDep, routeState);
|
|
822
1496
|
}
|
|
823
1497
|
}
|
|
824
1498
|
}
|
|
825
|
-
|
|
1499
|
+
function nodeMarkDemandRouted(self, lockId, route) {
|
|
1500
|
+
let holders = route.demandFired.get(lockId);
|
|
1501
|
+
if (holders === void 0) {
|
|
1502
|
+
holders = /* @__PURE__ */ new Set();
|
|
1503
|
+
route.demandFired.set(lockId, holders);
|
|
1504
|
+
}
|
|
1505
|
+
const node2 = self;
|
|
1506
|
+
if (holders.has(node2)) return true;
|
|
1507
|
+
holders.add(node2);
|
|
1508
|
+
return false;
|
|
1509
|
+
}
|
|
1510
|
+
function nodeForwardUp(self, m, towardDep, route) {
|
|
1511
|
+
if (self._slot.deps.length === 0) return;
|
|
1512
|
+
if (towardDep !== void 0) {
|
|
1513
|
+
const d = self._slot.deps[towardDep];
|
|
1514
|
+
if (d !== void 0) nodeRuntimeHost(d)._up([m], void 0, route);
|
|
1515
|
+
} else {
|
|
1516
|
+
for (const dep of self._slot.deps) nodeRuntimeHost(dep)._up([m], void 0, route);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
function nodeIsPaused(self) {
|
|
1520
|
+
return self._control.pauseLockset.size > 0;
|
|
1521
|
+
}
|
|
1522
|
+
function nodeHasBoundaryPauseLock(self) {
|
|
1523
|
+
if (self._slot.pausable === false) return false;
|
|
1524
|
+
return self._control.pauseLockset.size > 0;
|
|
1525
|
+
}
|
|
1526
|
+
function nodeIsAsyncPool(self) {
|
|
1527
|
+
return self._slot.handle !== null && self._slot.dispatcher.poolKind(self._slot.handle.poolId) === "async";
|
|
1528
|
+
}
|
|
1529
|
+
function nodePauseAcquire(self, lockId) {
|
|
1530
|
+
self._control.pauseLockset.add(lockId);
|
|
1531
|
+
}
|
|
1532
|
+
function nodePauseRelease(self, lockId) {
|
|
1533
|
+
if (!self._control.pauseLockset.has(lockId)) return;
|
|
1534
|
+
self._control.pauseLockset.delete(lockId);
|
|
1535
|
+
if (self._slot.pull && self._control.demandOwed !== void 0) self._fireOwedDemandIfReady();
|
|
1536
|
+
if (self._hasBoundaryPauseLock()) return;
|
|
1537
|
+
scheduleBoundaryDrain(self._core);
|
|
1538
|
+
if (self._slot.pull) return;
|
|
1539
|
+
self._onResume();
|
|
1540
|
+
}
|
|
1541
|
+
function nodeOnResume(self) {
|
|
1542
|
+
if (self._value.terminal !== void 0) {
|
|
1543
|
+
self._control.pauseBuffer = [];
|
|
1544
|
+
self._control.pausedDepWaveOccurred = false;
|
|
1545
|
+
self._control.demandOwed = void 0;
|
|
1546
|
+
self._control.activePull = void 0;
|
|
1547
|
+
self._control.pullDirtyOwed = false;
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
if (self._control.pauseBuffer.length > 0) {
|
|
1551
|
+
const buf = self._control.pauseBuffer;
|
|
1552
|
+
self._control.pauseBuffer = [];
|
|
1553
|
+
for (const wave of buf) self._down(wave);
|
|
1554
|
+
}
|
|
1555
|
+
if (self._control.pausedDepWaveOccurred) {
|
|
1556
|
+
self._control.pausedDepWaveOccurred = false;
|
|
1557
|
+
self._tryRun();
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
function nodeCanFireDemand(self) {
|
|
1561
|
+
if (self._value.terminal !== void 0 || self._wave.pending > 0) return false;
|
|
1562
|
+
return self._control.pauseLockset.size === 0;
|
|
1563
|
+
}
|
|
1564
|
+
function nodeDeliverPullDemand(self, demand) {
|
|
1565
|
+
self._control.demandOwed = void 0;
|
|
1566
|
+
self._control.activePull = demand;
|
|
1567
|
+
self._control.inDeliverDemand = true;
|
|
1568
|
+
try {
|
|
1569
|
+
self._firePullDemand();
|
|
1570
|
+
} finally {
|
|
1571
|
+
self._control.activePull = void 0;
|
|
1572
|
+
self._control.inDeliverDemand = false;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
function nodeOnDemand(self, demand) {
|
|
1576
|
+
if (self._control.inDeliverDemand) return;
|
|
1577
|
+
if (self._canFireDemand()) self._deliverPullDemand(demand);
|
|
1578
|
+
else self._control.demandOwed = demand;
|
|
1579
|
+
}
|
|
1580
|
+
function nodeFirePullDemand(self) {
|
|
1581
|
+
let drainedBuffer = false;
|
|
1582
|
+
if (self._control.pauseBuffer.length > 0) {
|
|
1583
|
+
const buf = self._control.pauseBuffer;
|
|
1584
|
+
self._control.pauseBuffer = [];
|
|
1585
|
+
for (const wave of buf) self._down(wave);
|
|
1586
|
+
drainedBuffer = true;
|
|
1587
|
+
}
|
|
1588
|
+
if (drainedBuffer) return;
|
|
1589
|
+
if (self._control.pausedDepWaveOccurred) {
|
|
1590
|
+
const gated = self._slot.handle !== null && !self._wave.hasCalledFnOnce && !(self._slot.partial || self._allDepsSettled());
|
|
1591
|
+
if (self._wave.pending > 0 || gated) return;
|
|
1592
|
+
self._control.pausedDepWaveOccurred = false;
|
|
1593
|
+
self._wave.emittedDirtyThisWave = false;
|
|
1594
|
+
self._control.pullDirtyOwed = true;
|
|
1595
|
+
try {
|
|
1596
|
+
self._tryRun();
|
|
1597
|
+
} finally {
|
|
1598
|
+
self._control.pullDirtyOwed = false;
|
|
1599
|
+
}
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
if (self._slot.handle !== null) {
|
|
1603
|
+
if (!self._wave.hasCalledFnOnce && !(self._slot.partial || self._allDepsSettled())) return;
|
|
1604
|
+
self._wave.emittedDirtyThisWave = false;
|
|
1605
|
+
self._control.pullDirtyOwed = true;
|
|
1606
|
+
try {
|
|
1607
|
+
self._runWave();
|
|
1608
|
+
} finally {
|
|
1609
|
+
self._control.pullDirtyOwed = false;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
function nodeFireOwedDemandIfReady(self) {
|
|
1614
|
+
if (self._control.inDeliverDemand) return;
|
|
1615
|
+
if (self._slot.pull && self._control.demandOwed !== void 0 && self._canFireDemand()) {
|
|
1616
|
+
self._deliverPullDemand(self._control.demandOwed);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
function nodeShouldBufferOnPause(self) {
|
|
1620
|
+
if (self._slot.pausable === false) return false;
|
|
1621
|
+
if (!self._isPaused() && !self._isPullQuiet()) return false;
|
|
1622
|
+
if (self._slot.pausable === "resumeAll") return true;
|
|
1623
|
+
if (!self._wave.insideRunWave && self._isAsyncPool() && self._slot.deps.length > 0) return true;
|
|
1624
|
+
return false;
|
|
1625
|
+
}
|
|
1626
|
+
function nodeInvalidate(self, delivery) {
|
|
1627
|
+
if (!self._value.hasData) return;
|
|
1628
|
+
self._value.cache = SENTINEL;
|
|
1629
|
+
self._value.hasData = false;
|
|
1630
|
+
self._value.status = "sentinel";
|
|
1631
|
+
self._value.replayRing = [];
|
|
1632
|
+
for (const fn of self._hooks.onInvalidate) fn();
|
|
1633
|
+
self._emitToSubs(["INVALIDATE"], delivery);
|
|
1634
|
+
}
|
|
1635
|
+
function nodeAllDepsTerminal(self) {
|
|
1636
|
+
if (self._slot.deps.length === 0) return false;
|
|
1637
|
+
for (const tm of self._dep.terminal) if (tm === void 0) return false;
|
|
1638
|
+
return true;
|
|
1639
|
+
}
|
|
1640
|
+
function nodeResetLifecycle(self) {
|
|
1641
|
+
for (const u of self._dep.unsubs) if (u) u();
|
|
1642
|
+
self._dep.unsubs = [];
|
|
1643
|
+
self._dep.idxBoxes = [];
|
|
1644
|
+
self._lifecycle.subscribers.clear();
|
|
1645
|
+
self._lifecycle.activated = false;
|
|
1646
|
+
self._value.terminal = void 0;
|
|
1647
|
+
self._value.hasTorndown = false;
|
|
1648
|
+
self._wave.hasCalledFnOnce = false;
|
|
1649
|
+
self._resetDepState();
|
|
1650
|
+
self._control.pauseLockset.clear();
|
|
1651
|
+
self._control.pauseBuffer = [];
|
|
1652
|
+
self._control.pausedDepWaveOccurred = false;
|
|
1653
|
+
self._control.demandOwed = void 0;
|
|
1654
|
+
self._control.activePull = void 0;
|
|
1655
|
+
self._control.pullDirtyOwed = false;
|
|
1656
|
+
self._value.replayRing = [];
|
|
1657
|
+
const isCompute = self._slot.handle !== null || self._slot.deps.length > 0;
|
|
1658
|
+
if (isCompute) {
|
|
1659
|
+
self._value.cache = SENTINEL;
|
|
1660
|
+
self._value.hasData = false;
|
|
1661
|
+
self._value.status = "sentinel";
|
|
1662
|
+
} else {
|
|
1663
|
+
self._value.status = self._value.hasData ? "settled" : "sentinel";
|
|
1664
|
+
}
|
|
1665
|
+
if (!self._privateState.persist) self._privateState.value = SENTINEL;
|
|
1666
|
+
}
|
|
1667
|
+
function nodeEmitToSubs(self, msg, delivery) {
|
|
1668
|
+
if (self._released) return;
|
|
1669
|
+
const subs = [...self._lifecycle.subscribers];
|
|
1670
|
+
for (const sink of subs) sink(msg, delivery);
|
|
1671
|
+
}
|
|
1672
|
+
function nodeCommitBatchedWave(self, wave) {
|
|
1673
|
+
self._wave.batchDirtyOwed = false;
|
|
1674
|
+
self._down(wave);
|
|
1675
|
+
}
|
|
1676
|
+
function nodeRollbackBatched(self) {
|
|
1677
|
+
if (self._wave.batchDirtyOwed) {
|
|
1678
|
+
self._wave.batchDirtyOwed = false;
|
|
1679
|
+
self._wave.emittedDirtyThisWave = false;
|
|
1680
|
+
self._value.status = self._value.hasData ? "settled" : "sentinel";
|
|
1681
|
+
self._emitToSubs(["RESOLVED"]);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
function nodeDeferBoundary(self, fn, batchToken) {
|
|
1685
|
+
deferRewire(self._core, fn, {
|
|
1686
|
+
batchToken,
|
|
1687
|
+
isReady: () => !self._hasBoundaryPauseLock()
|
|
1688
|
+
});
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// src/node/node-rewire-runtime.ts
|
|
1692
|
+
function nodeRequestRewireNext(self, op) {
|
|
1693
|
+
deferRewire(self._core, () => self._applyRewireNext(op), {
|
|
1694
|
+
batchToken: currentBoundaryBatchToken(),
|
|
1695
|
+
isReady: () => !self._hasBoundaryPauseLock()
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
function nodeRequestUpNext(self, msgs, towardDep) {
|
|
1699
|
+
deferRewire(
|
|
1700
|
+
self._core,
|
|
1701
|
+
() => {
|
|
1702
|
+
if (!self._released) self._up(msgs, towardDep);
|
|
1703
|
+
},
|
|
1704
|
+
{
|
|
1705
|
+
batchToken: currentBoundaryBatchToken(),
|
|
1706
|
+
isReady: () => !self._hasBoundaryPauseLock()
|
|
1707
|
+
}
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
function nodeApplyRewireNext(self, op) {
|
|
1711
|
+
if (self._released) return;
|
|
1712
|
+
try {
|
|
1713
|
+
if (op.kind === "add") {
|
|
1714
|
+
const next = self._slot.deps.includes(op.dep) ? [...self._slot.deps] : [...self._slot.deps, op.dep];
|
|
1715
|
+
self._rewire(next, op.fn, { allowTerminalOwner: true });
|
|
1716
|
+
} else if (op.kind === "remove") {
|
|
1717
|
+
self._rewire(
|
|
1718
|
+
self._slot.deps.filter((d) => d !== op.dep),
|
|
1719
|
+
op.fn,
|
|
1720
|
+
{ allowTerminalOwner: true }
|
|
1721
|
+
);
|
|
1722
|
+
} else {
|
|
1723
|
+
self._rewire(self._dedupDeps(op.deps), op.fn, { allowTerminalOwner: true });
|
|
1724
|
+
}
|
|
1725
|
+
} catch (e) {
|
|
1726
|
+
self._down([["ERROR", errorPayload(e, "rewireNext op failed")]]);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
function nodeRewire(self, newDeps, fn, opts = {}) {
|
|
1730
|
+
const node2 = self;
|
|
1731
|
+
if (self._value.terminal !== void 0 && !opts.allowTerminalOwner)
|
|
1732
|
+
throw new Error(
|
|
1733
|
+
"rewire: node is terminal (completed/errored) \u2014 cannot rewire (R-rewire / D42)"
|
|
1734
|
+
);
|
|
1735
|
+
if (self._wave.insideRunWave)
|
|
1736
|
+
throw new Error(
|
|
1737
|
+
"rewire: mid-fn topology mutation \u2014 a fn mutating its own deps mid-wave is the feedback cycle (R-rewire / D37)"
|
|
1738
|
+
);
|
|
1739
|
+
if (self._wave.inDepMutation)
|
|
1740
|
+
throw new Error(
|
|
1741
|
+
"rewire: reentrant dep mutation \u2014 another replaceDeps/subscribeDep/unsubscribeDep is in flight (R-rewire)"
|
|
1742
|
+
);
|
|
1743
|
+
if (newDeps.includes(node2)) throw new Error("rewire: self-dependency rejected (R-rewire / D42)");
|
|
1744
|
+
const oldDeps = self._slot.deps;
|
|
1745
|
+
const added = newDeps.filter((d) => !oldDeps.includes(d));
|
|
1746
|
+
for (const d of added) {
|
|
1747
|
+
if (self._reachableUpstream(d, node2))
|
|
1748
|
+
throw new Error(
|
|
1749
|
+
"rewire: would create a cycle \u2014 dep already transitively depends on this node (R-rewire / D42)"
|
|
1750
|
+
);
|
|
1751
|
+
const dep = nodeRuntimeHost(d);
|
|
1752
|
+
if (dep._value.terminal !== void 0 && !dep._slot.resubscribable)
|
|
1753
|
+
throw new Error(
|
|
1754
|
+
"rewire: cannot add a non-resubscribable terminal dep \u2014 would wedge (R-rewire / D42)"
|
|
1755
|
+
);
|
|
1756
|
+
self._assertRewireDepOwner(d);
|
|
1757
|
+
}
|
|
1758
|
+
if (deferAfterBatchForTarget(node2, () => {
|
|
1759
|
+
self._rewire(newDeps, fn, { ...opts, allowTerminalOwner: true });
|
|
1760
|
+
})) {
|
|
1761
|
+
return true;
|
|
1762
|
+
}
|
|
1763
|
+
if (!self._lifecycle.activated) self._restoredActivationPending = false;
|
|
1764
|
+
self._wave.inDepMutation = true;
|
|
1765
|
+
self._wave.rewireRunPending = false;
|
|
1766
|
+
let zeroDepUnDirty = false;
|
|
1767
|
+
try {
|
|
1768
|
+
const oldHandle = self._slot.handle;
|
|
1769
|
+
self._slot.handle = self._slot.dispatcher.register(fn, self._slot.pool);
|
|
1770
|
+
if (oldHandle !== null) self._slot.dispatcher.unregister(oldHandle);
|
|
1771
|
+
const removed = oldDeps.filter((d) => !newDeps.includes(d));
|
|
1772
|
+
let removedDirtyContributor = false;
|
|
1773
|
+
for (const d of removed) {
|
|
1774
|
+
const oldIdx = oldDeps.indexOf(d);
|
|
1775
|
+
if (self._dep.dirty[oldIdx]) {
|
|
1776
|
+
removedDirtyContributor = true;
|
|
1777
|
+
self._wave.pending--;
|
|
1778
|
+
}
|
|
1779
|
+
if (self._lifecycle.activated) {
|
|
1780
|
+
const box = self._dep.idxBoxes[oldIdx];
|
|
1781
|
+
if (box) box.v = -1;
|
|
1782
|
+
const unsub = self._dep.unsubs[oldIdx];
|
|
1783
|
+
if (unsub) unsub();
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
const n = newDeps.length;
|
|
1787
|
+
const newBatch = new Array(n).fill(null);
|
|
1788
|
+
const newPrev = new Array(n).fill(SENTINEL);
|
|
1789
|
+
const newHasData = new Array(n).fill(false);
|
|
1790
|
+
const newDirty = new Array(n).fill(false);
|
|
1791
|
+
const newTier = new Array(n).fill(0);
|
|
1792
|
+
const newTerminal = new Array(n).fill(void 0);
|
|
1793
|
+
const newTerminalInput = new Array(n).fill(void 0);
|
|
1794
|
+
const newUnsubs = new Array(n);
|
|
1795
|
+
const newBoxes = new Array(n);
|
|
1796
|
+
for (let j = 0; j < n; j++) {
|
|
1797
|
+
const oldIdx = oldDeps.indexOf(newDeps[j]);
|
|
1798
|
+
if (oldIdx !== -1) {
|
|
1799
|
+
newBatch[j] = self._dep.batch[oldIdx];
|
|
1800
|
+
newPrev[j] = self._dep.prev[oldIdx];
|
|
1801
|
+
newHasData[j] = self._dep.hasData[oldIdx];
|
|
1802
|
+
newDirty[j] = self._dep.dirty[oldIdx];
|
|
1803
|
+
newTier[j] = self._dep.tier[oldIdx];
|
|
1804
|
+
newTerminal[j] = self._dep.terminal[oldIdx];
|
|
1805
|
+
newUnsubs[j] = self._dep.unsubs[oldIdx];
|
|
1806
|
+
const box = self._dep.idxBoxes[oldIdx];
|
|
1807
|
+
if (box) box.v = j;
|
|
1808
|
+
newBoxes[j] = box;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
self._slot.deps = newDeps;
|
|
1812
|
+
self._dep.batch = newBatch;
|
|
1813
|
+
self._dep.prev = newPrev;
|
|
1814
|
+
self._dep.hasData = newHasData;
|
|
1815
|
+
self._dep.dirty = newDirty;
|
|
1816
|
+
self._dep.tier = newTier;
|
|
1817
|
+
self._dep.terminal = newTerminal;
|
|
1818
|
+
self._dep.terminalInput = newTerminalInput;
|
|
1819
|
+
self._dep.unsubs = newUnsubs;
|
|
1820
|
+
self._dep.idxBoxes = newBoxes;
|
|
1821
|
+
self._dep.waveData = newDeps.map(() => []);
|
|
1822
|
+
self._dep.waveTokens = new Array(newDeps.length).fill(void 0);
|
|
1823
|
+
self._syncCtx = null;
|
|
1824
|
+
if (self._lifecycle.activated) {
|
|
1825
|
+
for (const d of added) self._subscribeDepAt(d);
|
|
1826
|
+
}
|
|
1827
|
+
notifyTopologyDepsChanged(node2, oldDeps, newDeps);
|
|
1828
|
+
if (removedDirtyContributor && self._wave.pending === 0 && self._value.status === "dirty") {
|
|
1829
|
+
if (newDeps.length > 0) self._wave.rewireRunPending = true;
|
|
1830
|
+
else zeroDepUnDirty = true;
|
|
1831
|
+
}
|
|
1832
|
+
} finally {
|
|
1833
|
+
self._wave.inDepMutation = false;
|
|
1834
|
+
}
|
|
1835
|
+
if (self._wave.rewireRunPending) {
|
|
1836
|
+
self._wave.rewireRunPending = false;
|
|
1837
|
+
self._settleRewire();
|
|
1838
|
+
} else if (zeroDepUnDirty) {
|
|
1839
|
+
if (self._wave.emittedDirtyThisWave) self._down([["RESOLVED"]]);
|
|
1840
|
+
else self._value.status = self._value.hasData ? "settled" : "sentinel";
|
|
1841
|
+
}
|
|
1842
|
+
return false;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
// src/node/node.ts
|
|
1846
|
+
var Node = class _Node {
|
|
826
1847
|
_core;
|
|
827
1848
|
_id;
|
|
828
1849
|
_slot;
|
|
@@ -843,12 +1864,56 @@ var Node = class {
|
|
|
843
1864
|
set _syncCtx(ctx) {
|
|
844
1865
|
this._syncCtxState.value = ctx;
|
|
845
1866
|
}
|
|
1867
|
+
static _retainIndirectRuntimeMethods(node2) {
|
|
1868
|
+
void node2._dep;
|
|
1869
|
+
void node2._hooks;
|
|
1870
|
+
void node2._restoredActivationPending;
|
|
1871
|
+
void node2._requestRewireNext;
|
|
1872
|
+
void node2._requestUpNext;
|
|
1873
|
+
void node2._applyRewireNext;
|
|
1874
|
+
void node2._reachableUpstream;
|
|
1875
|
+
void node2._assertRewireDepOwner;
|
|
1876
|
+
void node2._subscribeDepAt;
|
|
1877
|
+
void node2._seedRestoredDepAt;
|
|
1878
|
+
void node2._recordDepProjection;
|
|
1879
|
+
void node2._depProjectionHasData;
|
|
1880
|
+
void node2._receiveFromDep;
|
|
1881
|
+
void node2._releaseDepDirty;
|
|
1882
|
+
void node2._settleAfterAbsorbedTerminal;
|
|
1883
|
+
void node2._markDirty;
|
|
1884
|
+
void node2._maybeRun;
|
|
1885
|
+
void node2._settleRewire;
|
|
1886
|
+
void node2._tryRun;
|
|
1887
|
+
void node2._allDepsSettled;
|
|
1888
|
+
void node2._passthroughEmit;
|
|
1889
|
+
void node2._runWave;
|
|
1890
|
+
void node2._buildCtx;
|
|
1891
|
+
void node2._makeCtx;
|
|
1892
|
+
void node2._refreshCtx;
|
|
1893
|
+
void node2._makeState;
|
|
1894
|
+
void node2._markDemandRouted;
|
|
1895
|
+
void node2._forwardUp;
|
|
1896
|
+
void node2._isPullQuiet;
|
|
1897
|
+
void node2._isPaused;
|
|
1898
|
+
void node2._hasBoundaryPauseLock;
|
|
1899
|
+
void node2._isAsyncPool;
|
|
1900
|
+
void node2._pauseAcquire;
|
|
1901
|
+
void node2._pauseRelease;
|
|
1902
|
+
void node2._onResume;
|
|
1903
|
+
void node2._canFireDemand;
|
|
1904
|
+
void node2._deliverPullDemand;
|
|
1905
|
+
void node2._onDemand;
|
|
1906
|
+
void node2._firePullDemand;
|
|
1907
|
+
void node2._fireOwedDemandIfReady;
|
|
1908
|
+
void node2._shouldBufferOnPause;
|
|
1909
|
+
void node2._invalidate;
|
|
1910
|
+
void node2._allDepsTerminal;
|
|
1911
|
+
void node2._emitToSubs;
|
|
1912
|
+
}
|
|
846
1913
|
constructor(deps, handleOrFn, opts = {}) {
|
|
847
|
-
const core =
|
|
848
|
-
constructingCore = void 0;
|
|
1914
|
+
const core = takeConstructingNodeCore();
|
|
849
1915
|
const dispatcher = opts.dispatcher ?? defaultDispatcher;
|
|
850
|
-
const environment =
|
|
851
|
-
constructingEnvironment = void 0;
|
|
1916
|
+
const environment = takeConstructingEnvironmentDrivers() ?? EnvironmentDrivers.empty();
|
|
852
1917
|
const pool = opts.pool ?? "sync";
|
|
853
1918
|
const pausable = opts.pausable ?? true;
|
|
854
1919
|
const pullLock = opts.pullId;
|
|
@@ -1019,6 +2084,7 @@ var Node = class {
|
|
|
1019
2084
|
runtimeQuiescenceReaders.set(this, () => this._isRuntimeQuiescentForRelease());
|
|
1020
2085
|
subscriberCountReaders.set(this, () => this._subscriberCount());
|
|
1021
2086
|
activationReaders.set(this, () => this._lifecycle.activated);
|
|
2087
|
+
_Node._retainIndirectRuntimeMethods(this);
|
|
1022
2088
|
}
|
|
1023
2089
|
/** R-pull (D55/D272): true while a pull node is not serving a PULL demand pulse. */
|
|
1024
2090
|
_isPullQuiet() {
|
|
@@ -1123,58 +2189,6 @@ var Node = class {
|
|
|
1123
2189
|
exitWave();
|
|
1124
2190
|
}
|
|
1125
2191
|
}
|
|
1126
|
-
// ── deferred self-rewire (R-rewire-deferred / D47): ctx.rewireNext drain support ──
|
|
1127
|
-
/**
|
|
1128
|
-
* Enqueue a deferred self-rewire op (issued from this node's fn via `ctx.rewireNext`).
|
|
1129
|
-
* Applied at the committed wave boundary (boundary.ts drain), never in place — the in-fn
|
|
1130
|
-
* immediate path (`subscribeDep`/`replaceDeps`/`unsubscribeDep`) still throws mid-run (D37/R-reentrancy).
|
|
1131
|
-
*/
|
|
1132
|
-
_requestRewireNext(op) {
|
|
1133
|
-
deferRewire(this._core, () => this._applyRewireNext(op), {
|
|
1134
|
-
batchToken: currentBoundaryBatchToken(),
|
|
1135
|
-
isReady: () => !this._hasBoundaryPauseLock()
|
|
1136
|
-
});
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Enqueue a deferred up-going control/demand wave (R-up-routing / R-pull / D269): at the committed wave
|
|
1140
|
-
* boundary, route `msgs` up from THIS node (broadcast, or up the single `towardDep` edge). The
|
|
1141
|
-
* deferred form of `ctx.up` — the SELF-demand path: a consumer issues `ctx.upNext([[PULL,
|
|
1142
|
-
* { pullId }]])` to demand a dep it ALSO reads; the demand applies at the boundary (not mid-fn), so
|
|
1143
|
-
* the pull node's delivery loops back as a FRESH wave rather than re-entering the consumer (D37 /
|
|
1144
|
-
* R-reentrancy). Rides the same R-rewire-deferred (D47) drain as ctx.rewireNext.
|
|
1145
|
-
*/
|
|
1146
|
-
_requestUpNext(msgs, towardDep) {
|
|
1147
|
-
deferRewire(
|
|
1148
|
-
this._core,
|
|
1149
|
-
() => {
|
|
1150
|
-
if (!this._released) this._up(msgs, towardDep);
|
|
1151
|
-
},
|
|
1152
|
-
{
|
|
1153
|
-
batchToken: currentBoundaryBatchToken(),
|
|
1154
|
-
isReady: () => !this._hasBoundaryPauseLock()
|
|
1155
|
-
}
|
|
1156
|
-
);
|
|
1157
|
-
}
|
|
1158
|
-
/** Apply one queued self-rewire at the boundary (drain thunk). */
|
|
1159
|
-
_applyRewireNext(op) {
|
|
1160
|
-
if (this._released) return;
|
|
1161
|
-
try {
|
|
1162
|
-
if (op.kind === "add") {
|
|
1163
|
-
const next = this._slot.deps.includes(op.dep) ? [...this._slot.deps] : [...this._slot.deps, op.dep];
|
|
1164
|
-
this._rewire(next, op.fn, { allowTerminalOwner: true });
|
|
1165
|
-
} else if (op.kind === "remove") {
|
|
1166
|
-
this._rewire(
|
|
1167
|
-
this._slot.deps.filter((d) => d !== op.dep),
|
|
1168
|
-
op.fn,
|
|
1169
|
-
{ allowTerminalOwner: true }
|
|
1170
|
-
);
|
|
1171
|
-
} else {
|
|
1172
|
-
this._rewire(this._dedupDeps(op.deps), op.fn, { allowTerminalOwner: true });
|
|
1173
|
-
}
|
|
1174
|
-
} catch (e) {
|
|
1175
|
-
this._down([["ERROR", errorPayload(e, "rewireNext op failed")]]);
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
2192
|
// ── rewire (R-rewire / D42): intra-graph runtime topology mutation ──
|
|
1179
2193
|
/**
|
|
1180
2194
|
* Replace this node's deps atomically (surgical, Option-C). Requires an explicit
|
|
@@ -1202,6 +2216,15 @@ var Node = class {
|
|
|
1202
2216
|
fn
|
|
1203
2217
|
);
|
|
1204
2218
|
}
|
|
2219
|
+
_requestRewireNext(op) {
|
|
2220
|
+
nodeRequestRewireNext(nodeRuntimeHost(this), op);
|
|
2221
|
+
}
|
|
2222
|
+
_requestUpNext(msgs, towardDep) {
|
|
2223
|
+
nodeRequestUpNext(nodeRuntimeHost(this), msgs, towardDep);
|
|
2224
|
+
}
|
|
2225
|
+
_applyRewireNext(op) {
|
|
2226
|
+
nodeApplyRewireNext(nodeRuntimeHost(this), op);
|
|
2227
|
+
}
|
|
1205
2228
|
_dedupDeps(deps) {
|
|
1206
2229
|
const seen = /* @__PURE__ */ new Set();
|
|
1207
2230
|
const out = [];
|
|
@@ -1212,7 +2235,6 @@ var Node = class {
|
|
|
1212
2235
|
}
|
|
1213
2236
|
return out;
|
|
1214
2237
|
}
|
|
1215
|
-
/** Is `target` reachable upstream from `from` (following deps)? Cycle-prevention DFS. */
|
|
1216
2238
|
_reachableUpstream(from, target) {
|
|
1217
2239
|
const seen = /* @__PURE__ */ new Set();
|
|
1218
2240
|
const stack = [from];
|
|
@@ -1222,1057 +2244,171 @@ var Node = class {
|
|
|
1222
2244
|
if (n === target) return true;
|
|
1223
2245
|
if (seen.has(n)) continue;
|
|
1224
2246
|
seen.add(n);
|
|
1225
|
-
for (const d of n._slot.deps) stack.push(d);
|
|
2247
|
+
for (const d of nodeRuntimeHost(n)._slot.deps) stack.push(d);
|
|
1226
2248
|
}
|
|
1227
2249
|
return false;
|
|
1228
2250
|
}
|
|
1229
2251
|
_assertRewireDepOwner(dep) {
|
|
1230
2252
|
const selfOwner = getNodeOwner(this);
|
|
1231
2253
|
const depOwner = getNodeOwner(dep);
|
|
1232
|
-
if (selfOwner !== void 0 && depOwner !== void 0 && selfOwner !== depOwner)
|
|
2254
|
+
if (selfOwner !== void 0 && depOwner !== void 0 && selfOwner !== depOwner)
|
|
1233
2255
|
throw new Error(
|
|
1234
2256
|
"rewire: dep belongs to a different graph; cross-graph deps require a wire bridge (D22 / R-graph-domain)"
|
|
1235
2257
|
);
|
|
1236
|
-
}
|
|
1237
2258
|
}
|
|
1238
2259
|
_rewire(newDeps, fn, opts = {}) {
|
|
1239
|
-
|
|
1240
|
-
throw new Error(
|
|
1241
|
-
"rewire: node is terminal (completed/errored) \u2014 cannot rewire (R-rewire / D42)"
|
|
1242
|
-
);
|
|
1243
|
-
if (this._wave.insideRunWave)
|
|
1244
|
-
throw new Error(
|
|
1245
|
-
"rewire: mid-fn topology mutation \u2014 a fn mutating its own deps mid-wave is the feedback cycle (R-rewire / D37)"
|
|
1246
|
-
);
|
|
1247
|
-
if (this._wave.inDepMutation)
|
|
1248
|
-
throw new Error(
|
|
1249
|
-
"rewire: reentrant dep mutation \u2014 another replaceDeps/subscribeDep/unsubscribeDep is in flight (R-rewire)"
|
|
1250
|
-
);
|
|
1251
|
-
if (newDeps.includes(this))
|
|
1252
|
-
throw new Error("rewire: self-dependency rejected (R-rewire / D42)");
|
|
1253
|
-
const oldDeps = this._slot.deps;
|
|
1254
|
-
const added = newDeps.filter((d) => !oldDeps.includes(d));
|
|
1255
|
-
for (const d of added) {
|
|
1256
|
-
if (this._reachableUpstream(d, this))
|
|
1257
|
-
throw new Error(
|
|
1258
|
-
"rewire: would create a cycle \u2014 dep already transitively depends on this node (R-rewire / D42)"
|
|
1259
|
-
);
|
|
1260
|
-
if (d._value.terminal !== void 0 && !d._slot.resubscribable)
|
|
1261
|
-
throw new Error(
|
|
1262
|
-
"rewire: cannot add a non-resubscribable terminal dep \u2014 would wedge (R-rewire / D42)"
|
|
1263
|
-
);
|
|
1264
|
-
this._assertRewireDepOwner(d);
|
|
1265
|
-
}
|
|
1266
|
-
if (deferAfterBatchForTarget(this, () => {
|
|
1267
|
-
this._rewire(newDeps, fn, { ...opts, allowTerminalOwner: true });
|
|
1268
|
-
})) {
|
|
1269
|
-
return true;
|
|
1270
|
-
}
|
|
1271
|
-
if (!this._lifecycle.activated) this._restoredActivationPending = false;
|
|
1272
|
-
this._wave.inDepMutation = true;
|
|
1273
|
-
this._wave.rewireRunPending = false;
|
|
1274
|
-
let zeroDepUnDirty = false;
|
|
1275
|
-
try {
|
|
1276
|
-
const oldHandle = this._slot.handle;
|
|
1277
|
-
this._slot.handle = this._slot.dispatcher.register(fn, this._slot.pool);
|
|
1278
|
-
if (oldHandle !== null) this._slot.dispatcher.unregister(oldHandle);
|
|
1279
|
-
const removed = oldDeps.filter((d) => !newDeps.includes(d));
|
|
1280
|
-
let removedDirtyContributor = false;
|
|
1281
|
-
for (const d of removed) {
|
|
1282
|
-
const oldIdx = oldDeps.indexOf(d);
|
|
1283
|
-
if (this._dep.dirty[oldIdx]) {
|
|
1284
|
-
removedDirtyContributor = true;
|
|
1285
|
-
this._wave.pending--;
|
|
1286
|
-
}
|
|
1287
|
-
if (this._lifecycle.activated) {
|
|
1288
|
-
const box = this._dep.idxBoxes[oldIdx];
|
|
1289
|
-
if (box) box.v = -1;
|
|
1290
|
-
const unsub = this._dep.unsubs[oldIdx];
|
|
1291
|
-
if (unsub) unsub();
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
const n = newDeps.length;
|
|
1295
|
-
const newBatch = new Array(n).fill(null);
|
|
1296
|
-
const newPrev = new Array(n).fill(SENTINEL);
|
|
1297
|
-
const newHasData = new Array(n).fill(false);
|
|
1298
|
-
const newDirty = new Array(n).fill(false);
|
|
1299
|
-
const newTier = new Array(n).fill(0);
|
|
1300
|
-
const newTerminal = new Array(n).fill(void 0);
|
|
1301
|
-
const newTerminalInput = new Array(n).fill(void 0);
|
|
1302
|
-
const newUnsubs = new Array(n);
|
|
1303
|
-
const newBoxes = new Array(n);
|
|
1304
|
-
for (let j = 0; j < n; j++) {
|
|
1305
|
-
const oldIdx = oldDeps.indexOf(newDeps[j]);
|
|
1306
|
-
if (oldIdx !== -1) {
|
|
1307
|
-
newBatch[j] = this._dep.batch[oldIdx];
|
|
1308
|
-
newPrev[j] = this._dep.prev[oldIdx];
|
|
1309
|
-
newHasData[j] = this._dep.hasData[oldIdx];
|
|
1310
|
-
newDirty[j] = this._dep.dirty[oldIdx];
|
|
1311
|
-
newTier[j] = this._dep.tier[oldIdx];
|
|
1312
|
-
newTerminal[j] = this._dep.terminal[oldIdx];
|
|
1313
|
-
newUnsubs[j] = this._dep.unsubs[oldIdx];
|
|
1314
|
-
const box = this._dep.idxBoxes[oldIdx];
|
|
1315
|
-
if (box) box.v = j;
|
|
1316
|
-
newBoxes[j] = box;
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
this._slot.deps = newDeps;
|
|
1320
|
-
this._dep.batch = newBatch;
|
|
1321
|
-
this._dep.prev = newPrev;
|
|
1322
|
-
this._dep.hasData = newHasData;
|
|
1323
|
-
this._dep.dirty = newDirty;
|
|
1324
|
-
this._dep.tier = newTier;
|
|
1325
|
-
this._dep.terminal = newTerminal;
|
|
1326
|
-
this._dep.terminalInput = newTerminalInput;
|
|
1327
|
-
this._dep.unsubs = newUnsubs;
|
|
1328
|
-
this._dep.idxBoxes = newBoxes;
|
|
1329
|
-
this._dep.waveData = newDeps.map(() => []);
|
|
1330
|
-
this._dep.waveTokens = new Array(newDeps.length).fill(void 0);
|
|
1331
|
-
this._syncCtx = null;
|
|
1332
|
-
if (this._lifecycle.activated) {
|
|
1333
|
-
for (const d of added) this._subscribeDepAt(d);
|
|
1334
|
-
}
|
|
1335
|
-
notifyTopologyDepsChanged(this, oldDeps, newDeps);
|
|
1336
|
-
if (removedDirtyContributor && this._wave.pending === 0 && this._value.status === "dirty") {
|
|
1337
|
-
if (newDeps.length > 0) this._wave.rewireRunPending = true;
|
|
1338
|
-
else zeroDepUnDirty = true;
|
|
1339
|
-
}
|
|
1340
|
-
} finally {
|
|
1341
|
-
this._wave.inDepMutation = false;
|
|
1342
|
-
}
|
|
1343
|
-
if (this._wave.rewireRunPending) {
|
|
1344
|
-
this._wave.rewireRunPending = false;
|
|
1345
|
-
this._settleRewire();
|
|
1346
|
-
} else if (zeroDepUnDirty) {
|
|
1347
|
-
if (this._wave.emittedDirtyThisWave) this._down([["RESOLVED"]]);
|
|
1348
|
-
else this._value.status = this._value.hasData ? "settled" : "sentinel";
|
|
1349
|
-
}
|
|
1350
|
-
return false;
|
|
2260
|
+
return nodeRewire(nodeRuntimeHost(this), newDeps, fn, opts);
|
|
1351
2261
|
}
|
|
1352
2262
|
// ── activation / deactivation (lazy; R-rom-ram) ──
|
|
1353
2263
|
_activate() {
|
|
1354
|
-
this
|
|
1355
|
-
const seedRestoredDeps = this._restoredActivationPending;
|
|
1356
|
-
this._restoredActivationPending = false;
|
|
1357
|
-
this._dep.unsubs = new Array(this._slot.deps.length);
|
|
1358
|
-
this._dep.idxBoxes = new Array(this._slot.deps.length);
|
|
1359
|
-
for (const dep of this._slot.deps)
|
|
1360
|
-
this._subscribeDepAt(dep, { seedRestored: seedRestoredDeps });
|
|
1361
|
-
if (this._slot.deps.length === 0 && this._slot.handle !== null && !this._wave.hasCalledFnOnce) {
|
|
1362
|
-
this._runWave();
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Subscribe to a dep. The dispatch callback reads the dep's CURRENT index from a
|
|
1367
|
-
* mutable box (O(1)); a surgical rewire that reorders kept deps just updates the box
|
|
1368
|
-
* (R-rewire Option-C / D42) — no re-subscribe, no per-message indexOf scan. A removed
|
|
1369
|
-
* dep's box is set to -1 so any stale in-flight callback drops (drain).
|
|
1370
|
-
*/
|
|
1371
|
-
_subscribeDepAt(depNode, opts = {}) {
|
|
1372
|
-
const idx0 = this._slot.deps.indexOf(depNode);
|
|
1373
|
-
const box = { v: idx0 };
|
|
1374
|
-
let ignoreInitialPush = opts.seedRestored === true;
|
|
1375
|
-
if (ignoreInitialPush && idx0 !== -1) {
|
|
1376
|
-
this._seedRestoredDepAt(idx0, depNode);
|
|
1377
|
-
if (depNode._value.terminal !== void 0 && !depNode._slot.resubscribable) {
|
|
1378
|
-
this._dep.unsubs[idx0] = () => {
|
|
1379
|
-
};
|
|
1380
|
-
this._dep.idxBoxes[idx0] = box;
|
|
1381
|
-
return;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
const unsub = depNode.subscribe((msg, delivery) => {
|
|
1385
|
-
if (ignoreInitialPush && delivery === void 0) return;
|
|
1386
|
-
if (ignoreInitialPush) ignoreInitialPush = false;
|
|
1387
|
-
if (box.v === -1) return;
|
|
1388
|
-
this._receiveFromDep(box.v, msg, delivery);
|
|
1389
|
-
});
|
|
1390
|
-
if (ignoreInitialPush && idx0 !== -1 && box.v !== -1) this._seedRestoredDepAt(idx0, depNode);
|
|
1391
|
-
ignoreInitialPush = false;
|
|
1392
|
-
if (idx0 !== -1) {
|
|
1393
|
-
this._dep.unsubs[idx0] = unsub;
|
|
1394
|
-
this._dep.idxBoxes[idx0] = box;
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
_seedRestoredDepAt(idx, depNode) {
|
|
1398
|
-
const seedData = depNode._value.hasData && !depNode._slot.pull;
|
|
1399
|
-
this._dep.batch[idx] = null;
|
|
1400
|
-
this._dep.waveData[idx] = [];
|
|
1401
|
-
this._dep.waveTokens[idx] = void 0;
|
|
1402
|
-
this._dep.prev[idx] = seedData ? depNode._value.cache : SENTINEL;
|
|
1403
|
-
this._dep.hasData[idx] = seedData;
|
|
1404
|
-
this._dep.dirty[idx] = false;
|
|
1405
|
-
this._dep.tier[idx] = seedData ? 3 : 0;
|
|
1406
|
-
this._dep.terminal[idx] = depNode._value.terminal;
|
|
1407
|
-
this._dep.terminalInput[idx] = void 0;
|
|
2264
|
+
nodeActivate(nodeRuntimeHost(this));
|
|
1408
2265
|
}
|
|
1409
2266
|
_deactivate() {
|
|
1410
|
-
this
|
|
1411
|
-
for (const u of this._dep.unsubs) if (u) u();
|
|
1412
|
-
this._dep.unsubs = [];
|
|
1413
|
-
this._dep.idxBoxes = [];
|
|
1414
|
-
for (const fn of this._hooks.onDeactivation) fn();
|
|
1415
|
-
this._hooks.onDeactivation = [];
|
|
1416
|
-
this._hooks.onInvalidate = [];
|
|
1417
|
-
const isCompute = this._slot.handle !== null || this._slot.deps.length > 0;
|
|
1418
|
-
if (isCompute) {
|
|
1419
|
-
this._value.cache = SENTINEL;
|
|
1420
|
-
this._value.hasData = false;
|
|
1421
|
-
this._value.status = "sentinel";
|
|
1422
|
-
}
|
|
1423
|
-
this._resetDepState();
|
|
1424
|
-
this._wave.hasCalledFnOnce = false;
|
|
1425
|
-
this._control.pauseLockset.clear();
|
|
1426
|
-
this._control.pauseBuffer = [];
|
|
1427
|
-
this._control.pausedDepWaveOccurred = false;
|
|
1428
|
-
this._control.demandOwed = void 0;
|
|
1429
|
-
this._control.activePull = void 0;
|
|
1430
|
-
this._control.pullDirtyOwed = false;
|
|
1431
|
-
this._value.replayRing = [];
|
|
1432
|
-
if (!this._privateState.persist) this._privateState.value = SENTINEL;
|
|
2267
|
+
nodeDeactivate(nodeRuntimeHost(this));
|
|
1433
2268
|
}
|
|
1434
2269
|
_assertNotReleased(op) {
|
|
1435
2270
|
if (this._released)
|
|
1436
2271
|
throw new Error(`${op}: node has been released from its graph lifecycle (D122)`);
|
|
1437
2272
|
}
|
|
1438
2273
|
_subscriberCount() {
|
|
1439
|
-
return this
|
|
2274
|
+
return nodeSubscriberCount(nodeRuntimeHost(this));
|
|
1440
2275
|
}
|
|
1441
2276
|
_isRuntimeQuiescentForRelease() {
|
|
1442
|
-
return
|
|
2277
|
+
return nodeIsRuntimeQuiescentForRelease(nodeRuntimeHost(this));
|
|
1443
2278
|
}
|
|
1444
2279
|
_releaseRuntime() {
|
|
1445
|
-
|
|
1446
|
-
this._released = true;
|
|
1447
|
-
releasedNodes.add(this);
|
|
1448
|
-
let releaseError;
|
|
1449
|
-
const recordReleaseError = (error) => {
|
|
1450
|
-
if (releaseError === void 0) releaseError = error;
|
|
1451
|
-
};
|
|
1452
|
-
this._lifecycle.activated = false;
|
|
1453
|
-
for (const u of this._dep.unsubs) {
|
|
1454
|
-
try {
|
|
1455
|
-
u();
|
|
1456
|
-
} catch (error) {
|
|
1457
|
-
recordReleaseError(error);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
for (const fn of this._hooks.onDeactivation) {
|
|
1461
|
-
try {
|
|
1462
|
-
fn();
|
|
1463
|
-
} catch (error) {
|
|
1464
|
-
recordReleaseError(error);
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
this._dep.unsubs = [];
|
|
1468
|
-
this._dep.idxBoxes = [];
|
|
1469
|
-
this._lifecycle.subscribers.clear();
|
|
1470
|
-
if (this._slot.handle !== null) {
|
|
1471
|
-
this._slot.dispatcher.unregister(this._slot.handle);
|
|
1472
|
-
this._slot.handle = null;
|
|
1473
|
-
}
|
|
1474
|
-
this._slot.deps = [];
|
|
1475
|
-
this._dep.batch = [];
|
|
1476
|
-
this._dep.waveData = [];
|
|
1477
|
-
this._dep.waveTokens = [];
|
|
1478
|
-
this._dep.prev = [];
|
|
1479
|
-
this._dep.hasData = [];
|
|
1480
|
-
this._dep.dirty = [];
|
|
1481
|
-
this._dep.tier = [];
|
|
1482
|
-
this._dep.terminal = [];
|
|
1483
|
-
this._dep.terminalInput = [];
|
|
1484
|
-
this._value.cache = SENTINEL;
|
|
1485
|
-
this._value.hasData = false;
|
|
1486
|
-
this._value.status = "sentinel";
|
|
1487
|
-
this._value.terminal = void 0;
|
|
1488
|
-
this._value.replayRing = [];
|
|
1489
|
-
this._privateState.value = SENTINEL;
|
|
1490
|
-
this._privateState.persist = false;
|
|
1491
|
-
this._syncCtx = null;
|
|
1492
|
-
this._resetDepState();
|
|
1493
|
-
this._hooks.onDeactivation = [];
|
|
1494
|
-
this._hooks.onInvalidate = [];
|
|
1495
|
-
this._control.pauseLockset.clear();
|
|
1496
|
-
this._control.pauseBuffer = [];
|
|
1497
|
-
this._control.pausedDepWaveOccurred = false;
|
|
1498
|
-
this._control.demandOwed = void 0;
|
|
1499
|
-
this._control.activePull = void 0;
|
|
1500
|
-
this._control.pullDirtyOwed = false;
|
|
1501
|
-
this._restoredActivationPending = false;
|
|
1502
|
-
checkpointReaders.delete(this);
|
|
1503
|
-
restoreWriters.delete(this);
|
|
1504
|
-
runtimeReleasers.delete(this);
|
|
1505
|
-
runtimeQuiescenceReaders.delete(this);
|
|
1506
|
-
subscriberCountReaders.delete(this);
|
|
1507
|
-
activationReaders.delete(this);
|
|
1508
|
-
ownerTokens.delete(this);
|
|
1509
|
-
topologyDepsChangedObservers.delete(this);
|
|
1510
|
-
this._core.releaseSlot(this._id);
|
|
1511
|
-
if (releaseError !== void 0) throw releaseError;
|
|
2280
|
+
nodeReleaseRuntime(nodeRuntimeHost(this));
|
|
1512
2281
|
}
|
|
1513
2282
|
_resetDepState() {
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
this._dep.dirty[i] = false;
|
|
1522
|
-
this._dep.tier[i] = 0;
|
|
1523
|
-
this._dep.terminal[i] = void 0;
|
|
1524
|
-
this._dep.terminalInput[i] = void 0;
|
|
1525
|
-
}
|
|
1526
|
-
this._wave.pending = 0;
|
|
1527
|
-
this._wave.emittedDirtyThisWave = false;
|
|
2283
|
+
nodeResetDepState(nodeRuntimeHost(this));
|
|
2284
|
+
}
|
|
2285
|
+
_subscribeDepAt(depNode, opts = {}) {
|
|
2286
|
+
nodeSubscribeDepAt(nodeRuntimeHost(this), depNode, opts);
|
|
2287
|
+
}
|
|
2288
|
+
_seedRestoredDepAt(idx, depNode) {
|
|
2289
|
+
nodeSeedRestoredDepAt(nodeRuntimeHost(this), idx, depNode);
|
|
1528
2290
|
}
|
|
1529
|
-
// ── upstream wave receive (two-phase + diamond) ──
|
|
1530
2291
|
_recordDepProjection(idx, delivery) {
|
|
1531
|
-
|
|
1532
|
-
if (this._dep.waveTokens[idx] !== token) {
|
|
1533
|
-
this._dep.waveData[idx].push([]);
|
|
1534
|
-
this._dep.waveTokens[idx] = token;
|
|
1535
|
-
}
|
|
1536
|
-
return this._dep.waveData[idx][this._dep.waveData[idx].length - 1];
|
|
2292
|
+
return nodeRecordDepProjection(nodeRuntimeHost(this), idx, delivery);
|
|
1537
2293
|
}
|
|
1538
2294
|
_depProjectionHasData(idx) {
|
|
1539
|
-
|
|
1540
|
-
return projection?.some((v) => v !== SENTINEL) ?? false;
|
|
2295
|
+
return nodeDepProjectionHasData(nodeRuntimeHost(this), idx);
|
|
1541
2296
|
}
|
|
1542
2297
|
_receiveFromDep(idx, msg, delivery) {
|
|
1543
|
-
|
|
1544
|
-
const t = msg[0];
|
|
1545
|
-
if (t === "START") return;
|
|
1546
|
-
const isLastInDeliveredWave = delivery?.last ?? true;
|
|
1547
|
-
if (this._value.terminal !== void 0) {
|
|
1548
|
-
if (t === "TEARDOWN") this._down([["TEARDOWN"]]);
|
|
1549
|
-
return;
|
|
1550
|
-
}
|
|
1551
|
-
if (t === "INVALIDATE") {
|
|
1552
|
-
const projection = this._recordDepProjection(idx, delivery);
|
|
1553
|
-
projection.push(SENTINEL);
|
|
1554
|
-
if (projection.some((v) => v !== SENTINEL) && isLastInDeliveredWave) this._maybeRun();
|
|
1555
|
-
this._dep.prev[idx] = SENTINEL;
|
|
1556
|
-
this._dep.hasData[idx] = false;
|
|
1557
|
-
this._dep.batch[idx] = null;
|
|
1558
|
-
if (this._dep.dirty[idx]) {
|
|
1559
|
-
this._dep.dirty[idx] = false;
|
|
1560
|
-
this._wave.pending--;
|
|
1561
|
-
}
|
|
1562
|
-
if (this._control.pausedDepWaveOccurred && this._dep.batch.every((b) => b === null)) {
|
|
1563
|
-
this._control.pausedDepWaveOccurred = false;
|
|
1564
|
-
}
|
|
1565
|
-
const hadData = this._value.hasData;
|
|
1566
|
-
this._invalidate();
|
|
1567
|
-
if (this._wave.pending === 0 && this._wave.emittedDirtyThisWave) {
|
|
1568
|
-
if (!hadData) this._down([["RESOLVED"]]);
|
|
1569
|
-
else this._wave.emittedDirtyThisWave = false;
|
|
1570
|
-
}
|
|
1571
|
-
this._fireOwedDemandIfReady();
|
|
1572
|
-
return;
|
|
1573
|
-
}
|
|
1574
|
-
if (isTerminal(t)) {
|
|
1575
|
-
const isError = t === "ERROR";
|
|
1576
|
-
const errPayload = isError ? msg[1] : void 0;
|
|
1577
|
-
this._dep.terminal[idx] = isError ? errPayload : true;
|
|
1578
|
-
this._dep.terminalInput[idx] = isError ? errPayload : true;
|
|
1579
|
-
this._releaseDepDirty(idx);
|
|
1580
|
-
const ranValueBeforeTerminal = this._depProjectionHasData(idx) && isLastInDeliveredWave;
|
|
1581
|
-
if (ranValueBeforeTerminal) this._maybeRun();
|
|
1582
|
-
if (isError && this._slot.errorWhenDepsError) {
|
|
1583
|
-
this._down([["ERROR", errPayload]]);
|
|
1584
|
-
} else if (this._slot.terminalAsRealInput) {
|
|
1585
|
-
if (ranValueBeforeTerminal) {
|
|
1586
|
-
this._fireOwedDemandIfReady();
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
|
-
this._maybeRun();
|
|
1590
|
-
} else if (this._slot.completeWhenDepsComplete && this._allDepsTerminal()) {
|
|
1591
|
-
this._down([["COMPLETE"]]);
|
|
1592
|
-
} else {
|
|
1593
|
-
this._settleAfterAbsorbedTerminal();
|
|
1594
|
-
}
|
|
1595
|
-
this._fireOwedDemandIfReady();
|
|
1596
|
-
return;
|
|
1597
|
-
}
|
|
1598
|
-
if (t === "TEARDOWN") {
|
|
1599
|
-
this._down([["TEARDOWN"]]);
|
|
1600
|
-
return;
|
|
1601
|
-
}
|
|
1602
|
-
if (t === "DIRTY") {
|
|
1603
|
-
if (!this._dep.dirty[idx]) {
|
|
1604
|
-
this._dep.dirty[idx] = true;
|
|
1605
|
-
this._wave.pending++;
|
|
1606
|
-
this._dep.tier[idx] = 2;
|
|
1607
|
-
this._markDirty();
|
|
1608
|
-
}
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
if (t === "DATA") {
|
|
1612
|
-
const v = msg[1];
|
|
1613
|
-
this._recordDepProjection(idx, delivery).push(v);
|
|
1614
|
-
const b = this._dep.batch[idx];
|
|
1615
|
-
if (b === null) this._dep.batch[idx] = [v];
|
|
1616
|
-
else b.push(v);
|
|
1617
|
-
this._dep.prev[idx] = v;
|
|
1618
|
-
this._dep.hasData[idx] = true;
|
|
1619
|
-
this._dep.tier[idx] = 3;
|
|
1620
|
-
if (this._dep.dirty[idx]) {
|
|
1621
|
-
this._dep.dirty[idx] = false;
|
|
1622
|
-
this._wave.pending--;
|
|
1623
|
-
}
|
|
1624
|
-
if (isLastInDeliveredWave) this._maybeRun();
|
|
1625
|
-
this._fireOwedDemandIfReady();
|
|
1626
|
-
return;
|
|
1627
|
-
}
|
|
1628
|
-
if (t === "RESOLVED") {
|
|
1629
|
-
this._recordDepProjection(idx, delivery);
|
|
1630
|
-
this._dep.tier[idx] = 3;
|
|
1631
|
-
if (this._dep.dirty[idx]) {
|
|
1632
|
-
this._dep.dirty[idx] = false;
|
|
1633
|
-
this._wave.pending--;
|
|
1634
|
-
}
|
|
1635
|
-
if (isLastInDeliveredWave) this._maybeRun();
|
|
1636
|
-
this._fireOwedDemandIfReady();
|
|
1637
|
-
return;
|
|
1638
|
-
}
|
|
2298
|
+
nodeReceiveFromDep(nodeRuntimeHost(this), idx, msg, delivery);
|
|
1639
2299
|
}
|
|
1640
|
-
/**
|
|
1641
|
-
* R-terminal-settles-dirty (B35): release a dep's outstanding in-wave DIRTY contribution.
|
|
1642
|
-
* A settle-class event for that dep (DATA/RESOLVED inline above, INVALIDATE, and now
|
|
1643
|
-
* COMPLETE/ERROR) clears its dirty flag + decrements _pending. No-op if the dep already
|
|
1644
|
-
* settled this wave (DATA/RESOLVED ran first) — so the normal DATA-then-COMPLETE flow is
|
|
1645
|
-
* unaffected. This makes the exactly-one-settle invariant a single, shared step.
|
|
1646
|
-
*/
|
|
1647
2300
|
_releaseDepDirty(idx) {
|
|
1648
|
-
|
|
1649
|
-
this._dep.dirty[idx] = false;
|
|
1650
|
-
this._wave.pending--;
|
|
1651
|
-
}
|
|
2301
|
+
nodeReleaseDepDirty(nodeRuntimeHost(this), idx);
|
|
1652
2302
|
}
|
|
1653
|
-
/**
|
|
1654
|
-
* R-terminal-settles-dirty (B35): settle a node whose dirtied dep was released by an ABSORBED
|
|
1655
|
-
* terminal that is NOT a real input (a plain derived/effect — the common default-node case when
|
|
1656
|
-
* one of several deps completes while others stay live). Runs only when the release drained
|
|
1657
|
-
* _pending while the node still owes a downstream settle (it broadcast DIRTY this wave):
|
|
1658
|
-
* - if some OTHER dep delivered real DATA this wave (a value occurred) → recompute (→ DATA);
|
|
1659
|
-
* - else the terminal's signalled change did not materialise (no value) → one undirty RESOLVED
|
|
1660
|
-
* (R-resolved-undirty), keeping the cache (a terminal, unlike INVALIDATE, leaves the value).
|
|
1661
|
-
* A terminalAsRealInput node instead recomputes unconditionally (its fn reads the terminal).
|
|
1662
|
-
*/
|
|
1663
2303
|
_settleAfterAbsorbedTerminal() {
|
|
1664
|
-
|
|
1665
|
-
const sawData = this._dep.batch.some((b) => b !== null && b.length > 0);
|
|
1666
|
-
if (sawData) this._maybeRun();
|
|
1667
|
-
if (this._wave.emittedDirtyThisWave) this._down([["RESOLVED"]]);
|
|
2304
|
+
nodeSettleAfterAbsorbedTerminal(nodeRuntimeHost(this));
|
|
1668
2305
|
}
|
|
1669
2306
|
_markDirty() {
|
|
1670
|
-
this
|
|
1671
|
-
if (this._isPullQuiet()) return;
|
|
1672
|
-
if (!this._wave.emittedDirtyThisWave) {
|
|
1673
|
-
this._wave.emittedDirtyThisWave = true;
|
|
1674
|
-
this._emitToSubs(["DIRTY"]);
|
|
1675
|
-
}
|
|
2307
|
+
nodeMarkDirty(nodeRuntimeHost(this));
|
|
1676
2308
|
}
|
|
1677
2309
|
_maybeRun() {
|
|
1678
|
-
|
|
1679
|
-
this._wave.rewireRunPending = true;
|
|
1680
|
-
return;
|
|
1681
|
-
}
|
|
1682
|
-
if (this._slot.pausable === true && (this._isPaused() || this._isPullQuiet())) {
|
|
1683
|
-
this._control.pausedDepWaveOccurred = true;
|
|
1684
|
-
return;
|
|
1685
|
-
}
|
|
1686
|
-
this._tryRun();
|
|
2310
|
+
nodeMaybeRun(nodeRuntimeHost(this));
|
|
1687
2311
|
}
|
|
1688
|
-
/**
|
|
1689
|
-
* R-rewire atomic settle (after a rewire that warrants a recompute): emit a proper
|
|
1690
|
-
* two-phase DIRTY→DATA wave (R-dirty-before-data — a rewire-triggered settle is a wave),
|
|
1691
|
-
* once, with every added dep already wired. Mirrors _maybeRun/_tryRun's pause + gate +
|
|
1692
|
-
* pending guards, then injects the phase-1 DIRTY the added dep's [START,DATA] handshake
|
|
1693
|
-
* did not carry.
|
|
1694
|
-
*/
|
|
1695
2312
|
_settleRewire() {
|
|
1696
|
-
|
|
1697
|
-
this._control.pausedDepWaveOccurred = true;
|
|
1698
|
-
return;
|
|
1699
|
-
}
|
|
1700
|
-
if (this._wave.pending > 0) return;
|
|
1701
|
-
if (this._slot.handle === null) {
|
|
1702
|
-
this._passthroughEmit();
|
|
1703
|
-
return;
|
|
1704
|
-
}
|
|
1705
|
-
if (!this._wave.hasCalledFnOnce && !(this._slot.partial || this._allDepsSettled())) return;
|
|
1706
|
-
this._markDirty();
|
|
1707
|
-
this._runWave();
|
|
2313
|
+
nodeSettleRewire(nodeRuntimeHost(this));
|
|
1708
2314
|
}
|
|
1709
2315
|
_tryRun() {
|
|
1710
|
-
|
|
1711
|
-
if (this._slot.handle === null) {
|
|
1712
|
-
this._passthroughEmit();
|
|
1713
|
-
return;
|
|
1714
|
-
}
|
|
1715
|
-
if (!this._wave.hasCalledFnOnce) {
|
|
1716
|
-
if (this._slot.partial || this._allDepsSettled()) this._runWave();
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
this._runWave();
|
|
2316
|
+
nodeTryRun(nodeRuntimeHost(this));
|
|
1720
2317
|
}
|
|
1721
2318
|
_allDepsSettled() {
|
|
1722
|
-
|
|
1723
|
-
if (this._dep.hasData[i]) continue;
|
|
1724
|
-
if (this._slot.terminalAsRealInput && this._dep.terminal[i] !== void 0) continue;
|
|
1725
|
-
return false;
|
|
1726
|
-
}
|
|
1727
|
-
return true;
|
|
2319
|
+
return nodeAllDepsSettled(nodeRuntimeHost(this));
|
|
1728
2320
|
}
|
|
1729
2321
|
_passthroughEmit() {
|
|
1730
|
-
|
|
1731
|
-
if (b !== null && b.length > 0) {
|
|
1732
|
-
this._down([["DATA", b[b.length - 1]]]);
|
|
1733
|
-
} else if (this._wave.emittedDirtyThisWave) {
|
|
1734
|
-
this._down([["RESOLVED"]]);
|
|
1735
|
-
}
|
|
1736
|
-
this._dep.batch[0] = null;
|
|
1737
|
-
this._wave.emittedDirtyThisWave = false;
|
|
2322
|
+
nodePassthroughEmit(nodeRuntimeHost(this));
|
|
1738
2323
|
}
|
|
1739
2324
|
_runWave() {
|
|
1740
|
-
|
|
1741
|
-
throw new Error(
|
|
1742
|
-
"synchronous feedback cycle: node fn re-entered its own wave (R-reentrancy / D37)"
|
|
1743
|
-
);
|
|
1744
|
-
this._wave.hasCalledFnOnce = true;
|
|
1745
|
-
this._hooks.onInvalidate = [];
|
|
1746
|
-
this._hooks.onDeactivation = [];
|
|
1747
|
-
const ctx = this._buildCtx();
|
|
1748
|
-
const wasDirty = this._wave.emittedDirtyThisWave;
|
|
1749
|
-
this._wave.emittedSettleThisWave = false;
|
|
1750
|
-
this._wave.insideRunWave = true;
|
|
1751
|
-
try {
|
|
1752
|
-
this._slot.dispatcher.invoke(this._slot.handle, ctx);
|
|
1753
|
-
} finally {
|
|
1754
|
-
this._wave.insideRunWave = false;
|
|
1755
|
-
}
|
|
1756
|
-
if (wasDirty && !this._wave.emittedSettleThisWave && this._value.terminal === void 0 && !this._isAsyncPool()) {
|
|
1757
|
-
this._down([["RESOLVED"]]);
|
|
1758
|
-
}
|
|
1759
|
-
for (let i = 0; i < this._dep.batch.length; i++) {
|
|
1760
|
-
this._dep.batch[i] = null;
|
|
1761
|
-
this._dep.waveData[i] = [];
|
|
1762
|
-
this._dep.waveTokens[i] = void 0;
|
|
1763
|
-
this._dep.terminalInput[i] = void 0;
|
|
1764
|
-
}
|
|
1765
|
-
this._wave.emittedDirtyThisWave = false;
|
|
2325
|
+
nodeRunWave(nodeRuntimeHost(this));
|
|
1766
2326
|
}
|
|
1767
|
-
// ── ctx construction (L3-Q5: sync = node-stable reused ctx; async = per-invocation) ──
|
|
1768
2327
|
_buildCtx() {
|
|
1769
|
-
|
|
1770
|
-
if (kind === "sync") {
|
|
1771
|
-
if (this._syncCtx === null) this._syncCtx = this._makeCtx();
|
|
1772
|
-
this._refreshCtx(this._syncCtx);
|
|
1773
|
-
return this._syncCtx;
|
|
1774
|
-
}
|
|
1775
|
-
return this._makeCtx({
|
|
1776
|
-
waveData: this._dep.waveData.map((waves) => waves.map((w) => [...w])),
|
|
1777
|
-
terminal: this._dep.terminalInput.map(terminalView),
|
|
1778
|
-
latest: [...this._dep.prev]
|
|
1779
|
-
});
|
|
2328
|
+
return nodeBuildCtx(nodeRuntimeHost(this));
|
|
1780
2329
|
}
|
|
1781
2330
|
_makeCtx(snapshot) {
|
|
1782
|
-
|
|
1783
|
-
// Wave-owner boundary (D47): a SYNC fn's emit nests under the public entry that drove
|
|
1784
|
-
// it (cheap inc/dec, no early drain); an ASYNC-pool fn re-enters here from its stashed
|
|
1785
|
-
// ctx at depth 0, so this is the boundary that drains any rewireNext it issued.
|
|
1786
|
-
up: (msgs, towardDep) => {
|
|
1787
|
-
if (this._released) return;
|
|
1788
|
-
enterWave();
|
|
1789
|
-
try {
|
|
1790
|
-
this._up(msgs, towardDep);
|
|
1791
|
-
} finally {
|
|
1792
|
-
exitWave();
|
|
1793
|
-
}
|
|
1794
|
-
},
|
|
1795
|
-
down: (msgs) => {
|
|
1796
|
-
if (this._released) return;
|
|
1797
|
-
enterWave();
|
|
1798
|
-
try {
|
|
1799
|
-
this._down(msgs);
|
|
1800
|
-
} finally {
|
|
1801
|
-
exitWave();
|
|
1802
|
-
}
|
|
1803
|
-
},
|
|
1804
|
-
waveData: snapshot?.waveData ?? this._dep.waveData,
|
|
1805
|
-
terminal: snapshot?.terminal ?? this._dep.terminalInput.map(terminalView),
|
|
1806
|
-
state: this._makeState(),
|
|
1807
|
-
onDeactivation: (fn) => {
|
|
1808
|
-
if (this._released) return;
|
|
1809
|
-
this._hooks.onDeactivation.push(fn);
|
|
1810
|
-
},
|
|
1811
|
-
onInvalidate: (fn) => {
|
|
1812
|
-
if (this._released) return;
|
|
1813
|
-
this._hooks.onInvalidate.push(fn);
|
|
1814
|
-
},
|
|
1815
|
-
environment: () => this._slot.environment,
|
|
1816
|
-
// R-rewire-deferred (D47): defer a self-dep-set mutation to the committed boundary.
|
|
1817
|
-
rewireNext: {
|
|
1818
|
-
subscribeDep: (dep, fn) => this._requestRewireNext({ kind: "add", dep, fn }),
|
|
1819
|
-
unsubscribeDep: (dep, fn) => this._requestRewireNext({ kind: "remove", dep, fn }),
|
|
1820
|
-
replaceDeps: (deps, fn) => this._requestRewireNext({ kind: "set", deps, fn })
|
|
1821
|
-
},
|
|
1822
|
-
// R-up-routing / R-pull (D269): deferred up — route a control/demand wave (e.g. PULL)
|
|
1823
|
-
// up the declared cone at the committed boundary. The SELF-demand path: an
|
|
1824
|
-
// immediate ctx.up whose delivery loops back re-enters this fn (D37 / R-reentrancy).
|
|
1825
|
-
upNext: (msgs, towardDep) => this._requestUpNext(msgs, towardDep),
|
|
1826
|
-
...this._control.activePull === void 0 ? {} : { pull: this._control.activePull },
|
|
1827
|
-
[CTX_DEP_CACHE]: { latest: snapshot?.latest ?? this._dep.prev },
|
|
1828
|
-
[CTX_NODE_BINDING]: {
|
|
1829
|
-
dispatcher: this._slot.dispatcher,
|
|
1830
|
-
create: (factory) => withEnvironmentDrivers(this._slot.environment, () => withNodeCore(this._core, factory))
|
|
1831
|
-
}
|
|
1832
|
-
};
|
|
1833
|
-
if (this._slot.dynamic) {
|
|
1834
|
-
ctx.track = (i) => ctx[CTX_DEP_CACHE]?.latest[i];
|
|
1835
|
-
}
|
|
1836
|
-
return ctx;
|
|
2331
|
+
return nodeMakeCtx(nodeRuntimeHost(this), snapshot);
|
|
1837
2332
|
}
|
|
1838
2333
|
_refreshCtx(ctx) {
|
|
1839
|
-
ctx
|
|
1840
|
-
ctx.terminal = this._dep.terminalInput.map(terminalView);
|
|
1841
|
-
if (this._control.activePull === void 0) {
|
|
1842
|
-
delete ctx.pull;
|
|
1843
|
-
} else {
|
|
1844
|
-
ctx.pull = this._control.activePull;
|
|
1845
|
-
}
|
|
1846
|
-
ctx[CTX_DEP_CACHE] = { latest: this._dep.prev };
|
|
2334
|
+
nodeRefreshCtx(nodeRuntimeHost(this), ctx);
|
|
1847
2335
|
}
|
|
1848
2336
|
_makeState() {
|
|
1849
|
-
return
|
|
1850
|
-
get: () => this._privateState.value,
|
|
1851
|
-
set: (v) => {
|
|
1852
|
-
this._privateState.value = v;
|
|
1853
|
-
},
|
|
1854
|
-
persist: (on = true) => {
|
|
1855
|
-
this._privateState.persist = on;
|
|
1856
|
-
}
|
|
1857
|
-
};
|
|
2337
|
+
return nodeMakeState(nodeRuntimeHost(this));
|
|
1858
2338
|
}
|
|
1859
2339
|
// ── downstream emission pipeline (the unified waist) ──
|
|
1860
2340
|
_down(msgs) {
|
|
1861
|
-
|
|
1862
|
-
validateDownPayloads(msgs);
|
|
1863
|
-
const deliveryWave = {};
|
|
1864
|
-
const assertVersionDataCompatible = (wave) => {
|
|
1865
|
-
for (const m of wave) {
|
|
1866
|
-
if (m[0] === "DATA") assertNodeVersionDataCompatible(this._version.policy, m[1]);
|
|
1867
|
-
}
|
|
1868
|
-
};
|
|
1869
|
-
const snapshotVersionData = (wave) => wave.map(
|
|
1870
|
-
(m) => m[0] === "DATA" ? ["DATA", snapshotNodeVersionData(this._version.policy, m[1])] : m
|
|
1871
|
-
);
|
|
1872
|
-
assertVersionDataCompatible(msgs);
|
|
1873
|
-
if (this._value.terminal !== void 0) {
|
|
1874
|
-
if (!msgs.some((m) => m[0] === "TEARDOWN")) return;
|
|
1875
|
-
this._value.hasTorndown = true;
|
|
1876
|
-
if (this._slot.resetOnTeardown) {
|
|
1877
|
-
this._value.cache = SENTINEL;
|
|
1878
|
-
this._value.hasData = false;
|
|
1879
|
-
}
|
|
1880
|
-
this._emitToSubs(["TEARDOWN"], { wave: deliveryWave, last: true });
|
|
1881
|
-
return;
|
|
1882
|
-
}
|
|
1883
|
-
let sorted = [...msgs].sort((a, b) => messageTier(a[0]) - messageTier(b[0]));
|
|
1884
|
-
const firstInvalidate = sorted.findIndex((m) => m[0] === "INVALIDATE");
|
|
1885
|
-
if (firstInvalidate !== -1) {
|
|
1886
|
-
sorted = sorted.filter((m, i) => m[0] !== "INVALIDATE" || i === firstInvalidate);
|
|
1887
|
-
}
|
|
1888
|
-
const hasTeardown = sorted.some((m) => m[0] === "TEARDOWN");
|
|
1889
|
-
const hasTerminal = sorted.some((m) => m[0] === "COMPLETE" || m[0] === "ERROR");
|
|
1890
|
-
if (hasTeardown && !hasTerminal && this._value.terminal === void 0 && !this._value.hasTorndown) {
|
|
1891
|
-
sorted = [["COMPLETE"], ...sorted];
|
|
1892
|
-
}
|
|
1893
|
-
if (!this._wave.insideRunWave && currentBatch()) {
|
|
1894
|
-
const deferred = snapshotVersionData(sorted.filter((m) => isDeferredTier(m[0])));
|
|
1895
|
-
if (deferred.length > 0) {
|
|
1896
|
-
if (!this._wave.emittedDirtyThisWave) {
|
|
1897
|
-
this._wave.emittedDirtyThisWave = true;
|
|
1898
|
-
this._value.status = "dirty";
|
|
1899
|
-
this._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
|
|
1900
|
-
}
|
|
1901
|
-
this._wave.batchDirtyOwed = true;
|
|
1902
|
-
deferToBatch(this, deferred);
|
|
1903
|
-
return;
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
if (this._shouldBufferOnPause()) {
|
|
1907
|
-
const buffered = snapshotVersionData(sorted.filter((m) => isPauseBufferedTier(m[0])));
|
|
1908
|
-
if (buffered.length > 0) {
|
|
1909
|
-
this._wave.emittedSettleThisWave = true;
|
|
1910
|
-
this._control.pauseBuffer.push(buffered);
|
|
1911
|
-
}
|
|
1912
|
-
sorted = sorted.filter((m) => !isPauseBufferedTier(m[0]));
|
|
1913
|
-
if (sorted.length === 0) return;
|
|
1914
|
-
}
|
|
1915
|
-
let dataCount = 0;
|
|
1916
|
-
let hasTier3 = false;
|
|
1917
|
-
let hasResolved = false;
|
|
1918
|
-
for (const m of sorted) {
|
|
1919
|
-
if (m[0] === "DATA") dataCount++;
|
|
1920
|
-
if (m[0] === "RESOLVED") hasResolved = true;
|
|
1921
|
-
if (isValueTier(m[0])) hasTier3 = true;
|
|
1922
|
-
}
|
|
1923
|
-
if (dataCount >= 1 && hasResolved) {
|
|
1924
|
-
throw new Error(
|
|
1925
|
-
"down: a wave cannot mix DATA and RESOLVED (tier-3 exclusivity, R-resolved-undirty)"
|
|
1926
|
-
);
|
|
1927
|
-
}
|
|
1928
|
-
const plannedVersions = new Array(sorted.length);
|
|
1929
|
-
if (dataCount > 0) {
|
|
1930
|
-
let plannedVersion = this._version.value;
|
|
1931
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
1932
|
-
const m = sorted[i];
|
|
1933
|
-
if (m[0] !== "DATA") continue;
|
|
1934
|
-
plannedVersion = advanceNodeVersion(plannedVersion, this._version.policy, m[1]);
|
|
1935
|
-
plannedVersions[i] = plannedVersion;
|
|
1936
|
-
}
|
|
1937
|
-
}
|
|
1938
|
-
if (hasTier3 && (!this._wave.insideRunWave || this._control.pullDirtyOwed) && !this._wave.emittedDirtyThisWave) {
|
|
1939
|
-
this._wave.emittedDirtyThisWave = true;
|
|
1940
|
-
this._value.status = "dirty";
|
|
1941
|
-
this._emitToSubs(["DIRTY"], { wave: deliveryWave, last: false });
|
|
1942
|
-
}
|
|
1943
|
-
for (let i = 0; i < sorted.length; i++) {
|
|
1944
|
-
const m = sorted[i];
|
|
1945
|
-
const delivery = { wave: deliveryWave, last: i === sorted.length - 1 };
|
|
1946
|
-
if (isDeferredTier(m[0])) this._wave.emittedSettleThisWave = true;
|
|
1947
|
-
if (m[0] === "DIRTY") {
|
|
1948
|
-
if (!this._wave.emittedDirtyThisWave) {
|
|
1949
|
-
this._wave.emittedDirtyThisWave = true;
|
|
1950
|
-
this._value.status = "dirty";
|
|
1951
|
-
this._emitToSubs(["DIRTY"], delivery);
|
|
1952
|
-
}
|
|
1953
|
-
continue;
|
|
1954
|
-
}
|
|
1955
|
-
if (m[0] === "DATA") {
|
|
1956
|
-
const v = m[1];
|
|
1957
|
-
this._value.cache = v;
|
|
1958
|
-
this._value.hasData = true;
|
|
1959
|
-
this._value.status = "settled";
|
|
1960
|
-
this._version.value = plannedVersions[i];
|
|
1961
|
-
if (this._slot.replayN > 0) {
|
|
1962
|
-
this._value.replayRing.push(v);
|
|
1963
|
-
if (this._value.replayRing.length > this._slot.replayN) this._value.replayRing.shift();
|
|
1964
|
-
}
|
|
1965
|
-
this._emitToSubs(["DATA", v], delivery);
|
|
1966
|
-
continue;
|
|
1967
|
-
}
|
|
1968
|
-
if (m[0] === "RESOLVED") {
|
|
1969
|
-
this._value.status = this._value.hasData ? "resolved" : "sentinel";
|
|
1970
|
-
this._emitToSubs(["RESOLVED"], delivery);
|
|
1971
|
-
continue;
|
|
1972
|
-
}
|
|
1973
|
-
if (m[0] === "INVALIDATE") {
|
|
1974
|
-
this._invalidate(delivery);
|
|
1975
|
-
continue;
|
|
1976
|
-
}
|
|
1977
|
-
if (m[0] === "COMPLETE") {
|
|
1978
|
-
if (this._value.terminal !== void 0) continue;
|
|
1979
|
-
this._value.terminal = true;
|
|
1980
|
-
this._control.pauseBuffer = [];
|
|
1981
|
-
this._value.status = "completed";
|
|
1982
|
-
this._emitToSubs(["COMPLETE"], delivery);
|
|
1983
|
-
continue;
|
|
1984
|
-
}
|
|
1985
|
-
if (m[0] === "ERROR") {
|
|
1986
|
-
if (this._value.terminal !== void 0) continue;
|
|
1987
|
-
this._value.terminal = m[1];
|
|
1988
|
-
this._control.pauseBuffer = [];
|
|
1989
|
-
this._value.status = "errored";
|
|
1990
|
-
this._emitToSubs(["ERROR", m[1]], delivery);
|
|
1991
|
-
continue;
|
|
1992
|
-
}
|
|
1993
|
-
if (m[0] === "TEARDOWN") {
|
|
1994
|
-
this._value.hasTorndown = true;
|
|
1995
|
-
if (this._slot.resetOnTeardown) {
|
|
1996
|
-
this._value.cache = SENTINEL;
|
|
1997
|
-
this._value.hasData = false;
|
|
1998
|
-
}
|
|
1999
|
-
this._emitToSubs(["TEARDOWN"], delivery);
|
|
2000
|
-
}
|
|
2001
|
-
}
|
|
2002
|
-
if (!this._wave.insideRunWave) this._wave.emittedDirtyThisWave = false;
|
|
2341
|
+
nodeDown(nodeRuntimeHost(this), msgs);
|
|
2003
2342
|
}
|
|
2004
2343
|
_up(msgs, towardDep, route) {
|
|
2005
|
-
|
|
2006
|
-
const routeState = route ?? { demandFired: /* @__PURE__ */ new Map() };
|
|
2007
|
-
for (const m of msgs) {
|
|
2008
|
-
if (!isUpAllowed(m[0])) {
|
|
2009
|
-
throw new Error(
|
|
2010
|
-
`ctx.up: ${m[0]} is down-only (tier ${messageTier(m[0])}); up carries control tiers only (R-ctx-up)`
|
|
2011
|
-
);
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
for (const m of msgs) {
|
|
2015
|
-
if (m[0] === "PAUSE") {
|
|
2016
|
-
this._pauseAcquire(m[1]);
|
|
2017
|
-
} else if (m[0] === "RESUME") {
|
|
2018
|
-
if (this._control.pauseLockset.has(m[1])) {
|
|
2019
|
-
this._pauseRelease(m[1]);
|
|
2020
|
-
} else {
|
|
2021
|
-
this._forwardUp(m, towardDep, routeState);
|
|
2022
|
-
}
|
|
2023
|
-
} else if (m[0] === "PULL") {
|
|
2024
|
-
const demand = normalizePullDemand(m[1]);
|
|
2025
|
-
if (this._slot.pull && demand.pullId === this._slot.pullLock) {
|
|
2026
|
-
if (!this._markDemandRouted(demand.pullId, routeState)) this._onDemand(demand);
|
|
2027
|
-
} else {
|
|
2028
|
-
this._forwardUp(["PULL", demand], towardDep, routeState);
|
|
2029
|
-
}
|
|
2030
|
-
} else if (this._slot.deps.length === 0) {
|
|
2031
|
-
if (m[0] === "INVALIDATE") this._down([["INVALIDATE"]]);
|
|
2032
|
-
} else {
|
|
2033
|
-
this._forwardUp(m, towardDep, routeState);
|
|
2034
|
-
}
|
|
2035
|
-
}
|
|
2344
|
+
nodeUp(nodeRuntimeHost(this), msgs, towardDep, route);
|
|
2036
2345
|
}
|
|
2037
2346
|
_markDemandRouted(lockId, route) {
|
|
2038
|
-
|
|
2039
|
-
if (holders === void 0) {
|
|
2040
|
-
holders = /* @__PURE__ */ new Set();
|
|
2041
|
-
route.demandFired.set(lockId, holders);
|
|
2042
|
-
}
|
|
2043
|
-
if (holders.has(this)) return true;
|
|
2044
|
-
holders.add(this);
|
|
2045
|
-
return false;
|
|
2347
|
+
return nodeMarkDemandRouted(nodeRuntimeHost(this), lockId, route);
|
|
2046
2348
|
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Forward one up-going control message toward deps (R-up-routing): up the single declared edge
|
|
2049
|
-
* `towardDep` (directed — prunes other branches; only meaningful on the issuer's FIRST hop) or
|
|
2050
|
-
* broadcast up ALL deps. A depless source has no deps → the message DROPS here (the terminus —
|
|
2051
|
-
* e.g. a cone-routed PULL whose pullId no node up this cone holds, R-up-at-source). Recursive
|
|
2052
|
-
* forwarding carries the same per-wave route state and no `towardDep` → broadcast beyond the
|
|
2053
|
-
* first hop.
|
|
2054
|
-
*/
|
|
2055
2349
|
_forwardUp(m, towardDep, route) {
|
|
2056
|
-
|
|
2057
|
-
if (towardDep !== void 0) {
|
|
2058
|
-
const d = this._slot.deps[towardDep];
|
|
2059
|
-
if (d !== void 0) d._up([m], void 0, route);
|
|
2060
|
-
} else {
|
|
2061
|
-
for (const dep of this._slot.deps) dep._up([m], void 0, route);
|
|
2062
|
-
}
|
|
2350
|
+
nodeForwardUp(nodeRuntimeHost(this), m, towardDep, route);
|
|
2063
2351
|
}
|
|
2064
|
-
// ── PAUSE/RESUME lockset (R-pause-lockset) + modes (R-pause-modes) ──
|
|
2065
2352
|
_isPaused() {
|
|
2066
|
-
return this
|
|
2353
|
+
return nodeIsPaused(nodeRuntimeHost(this));
|
|
2067
2354
|
}
|
|
2068
2355
|
_hasBoundaryPauseLock() {
|
|
2069
|
-
|
|
2070
|
-
return this._control.pauseLockset.size > 0;
|
|
2356
|
+
return nodeHasBoundaryPauseLock(nodeRuntimeHost(this));
|
|
2071
2357
|
}
|
|
2072
2358
|
_isAsyncPool() {
|
|
2073
|
-
return
|
|
2359
|
+
return nodeIsAsyncPool(nodeRuntimeHost(this));
|
|
2074
2360
|
}
|
|
2075
2361
|
_pauseAcquire(lockId) {
|
|
2076
|
-
this
|
|
2362
|
+
nodePauseAcquire(nodeRuntimeHost(this), lockId);
|
|
2077
2363
|
}
|
|
2078
2364
|
_pauseRelease(lockId) {
|
|
2079
|
-
|
|
2080
|
-
this._control.pauseLockset.delete(lockId);
|
|
2081
|
-
if (this._slot.pull && this._control.demandOwed !== void 0) this._fireOwedDemandIfReady();
|
|
2082
|
-
if (this._hasBoundaryPauseLock()) return;
|
|
2083
|
-
scheduleBoundaryDrain(this._core);
|
|
2084
|
-
if (this._slot.pull) return;
|
|
2085
|
-
this._onResume();
|
|
2365
|
+
nodePauseRelease(nodeRuntimeHost(this), lockId);
|
|
2086
2366
|
}
|
|
2087
2367
|
_onResume() {
|
|
2088
|
-
|
|
2089
|
-
this._control.pauseBuffer = [];
|
|
2090
|
-
this._control.pausedDepWaveOccurred = false;
|
|
2091
|
-
this._control.demandOwed = void 0;
|
|
2092
|
-
this._control.activePull = void 0;
|
|
2093
|
-
this._control.pullDirtyOwed = false;
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
2096
|
-
if (this._control.pauseBuffer.length > 0) {
|
|
2097
|
-
const buf = this._control.pauseBuffer;
|
|
2098
|
-
this._control.pauseBuffer = [];
|
|
2099
|
-
for (const wave of buf) this._down(wave);
|
|
2100
|
-
}
|
|
2101
|
-
if (this._control.pausedDepWaveOccurred) {
|
|
2102
|
-
this._control.pausedDepWaveOccurred = false;
|
|
2103
|
-
this._tryRun();
|
|
2104
|
-
}
|
|
2368
|
+
nodeOnResume(nodeRuntimeHost(this));
|
|
2105
2369
|
}
|
|
2106
|
-
/**
|
|
2107
|
-
* R-pull (D269): can this pull node fire a demand NOW? — not terminal, settle-ready (_pending===0),
|
|
2108
|
-
* and no OTHER (non-pullId) lock holds it paused. The gate that decides fire-now vs OWE.
|
|
2109
|
-
*/
|
|
2110
2370
|
_canFireDemand() {
|
|
2111
|
-
|
|
2112
|
-
return this._control.pauseLockset.size === 0;
|
|
2371
|
+
return nodeCanFireDemand(nodeRuntimeHost(this));
|
|
2113
2372
|
}
|
|
2114
|
-
/**
|
|
2115
|
-
* R-pull (D269/D272): deliver ONE demand pulse — install activePull so the demand wave may
|
|
2116
|
-
* emit, fire it, then clear activePull so the node is quiet again (1:1).
|
|
2117
|
-
*/
|
|
2118
2373
|
_deliverPullDemand(demand) {
|
|
2119
|
-
this
|
|
2120
|
-
this._control.activePull = demand;
|
|
2121
|
-
this._control.inDeliverDemand = true;
|
|
2122
|
-
try {
|
|
2123
|
-
this._firePullDemand();
|
|
2124
|
-
} finally {
|
|
2125
|
-
this._control.activePull = void 0;
|
|
2126
|
-
this._control.inDeliverDemand = false;
|
|
2127
|
-
}
|
|
2374
|
+
nodeDeliverPullDemand(nodeRuntimeHost(this), demand);
|
|
2128
2375
|
}
|
|
2129
|
-
/**
|
|
2130
|
-
* R-pull (D269): a cone-routed PULL of THIS node's pullId arrived (R-up-routing) = a DEMAND.
|
|
2131
|
-
* Fire immediately if able; else OWE it — pin-5 (a dep DIRTY in flight, _pending>0) or F4/F5 (an
|
|
2132
|
-
* external PAUSE lock co-holds the node) — and fire when the node next becomes able. A demand
|
|
2133
|
-
* arriving WHILE a delivery is in flight (synchronous re-entry) is DROPPED (1:1, QA guard).
|
|
2134
|
-
*/
|
|
2135
2376
|
_onDemand(demand) {
|
|
2136
|
-
|
|
2137
|
-
if (this._canFireDemand()) this._deliverPullDemand(demand);
|
|
2138
|
-
else this._control.demandOwed = demand;
|
|
2377
|
+
nodeOnDemand(nodeRuntimeHost(this), demand);
|
|
2139
2378
|
}
|
|
2140
|
-
/**
|
|
2141
|
-
* R-pull (D55): service ONE demand. Delivery content = the orthogonal pausable mode:
|
|
2142
|
-
* - 'resumeAll' → drain the buffered BACKLOG (each `_down` re-synthesizes a leading DIRTY, so
|
|
2143
|
-
* the per-entry replay is DIRTY-before-DATA — R-pause-modes per-entry arrival order);
|
|
2144
|
-
* - true → deliver the coalesced LATEST as ONE DIRTY-before-DATA wave (pin 2: the quiet absorb
|
|
2145
|
-
* suppressed the dep's original DIRTY, so the demand wave restores it before the value).
|
|
2146
|
-
* Neither branch fires when nothing changed since the last demand → the demand is SILENT.
|
|
2147
|
-
* Called by `_deliverPullDemand` only when settle-ready; the caller has released the pullId, so
|
|
2148
|
-
* `_markDirty` relays the leading DIRTY (not absorbed).
|
|
2149
|
-
*/
|
|
2150
2379
|
_firePullDemand() {
|
|
2151
|
-
|
|
2152
|
-
if (this._control.pauseBuffer.length > 0) {
|
|
2153
|
-
const buf = this._control.pauseBuffer;
|
|
2154
|
-
this._control.pauseBuffer = [];
|
|
2155
|
-
for (const wave of buf) this._down(wave);
|
|
2156
|
-
drainedBuffer = true;
|
|
2157
|
-
}
|
|
2158
|
-
if (drainedBuffer) return;
|
|
2159
|
-
if (this._control.pausedDepWaveOccurred) {
|
|
2160
|
-
const gated = this._slot.handle !== null && !this._wave.hasCalledFnOnce && !(this._slot.partial || this._allDepsSettled());
|
|
2161
|
-
if (this._wave.pending > 0 || gated) return;
|
|
2162
|
-
this._control.pausedDepWaveOccurred = false;
|
|
2163
|
-
this._wave.emittedDirtyThisWave = false;
|
|
2164
|
-
this._control.pullDirtyOwed = true;
|
|
2165
|
-
try {
|
|
2166
|
-
this._tryRun();
|
|
2167
|
-
} finally {
|
|
2168
|
-
this._control.pullDirtyOwed = false;
|
|
2169
|
-
}
|
|
2170
|
-
return;
|
|
2171
|
-
}
|
|
2172
|
-
if (this._slot.handle !== null) {
|
|
2173
|
-
if (!this._wave.hasCalledFnOnce && !(this._slot.partial || this._allDepsSettled())) return;
|
|
2174
|
-
this._wave.emittedDirtyThisWave = false;
|
|
2175
|
-
this._control.pullDirtyOwed = true;
|
|
2176
|
-
try {
|
|
2177
|
-
this._runWave();
|
|
2178
|
-
} finally {
|
|
2179
|
-
this._control.pullDirtyOwed = false;
|
|
2180
|
-
}
|
|
2181
|
-
}
|
|
2380
|
+
nodeFirePullDemand(nodeRuntimeHost(this));
|
|
2182
2381
|
}
|
|
2183
|
-
/**
|
|
2184
|
-
* R-pull (D269): fire a demand that was OWED (deferred at demand time) once the node becomes
|
|
2185
|
-
* able — called from the dep-settle arms (DATA/RESOLVED/INVALIDATE/terminal drain _pending, pin-5
|
|
2186
|
-
* + B1/F6) and from `_pauseRelease` (an external PAUSE lock releases, F4/F5).
|
|
2187
|
-
*/
|
|
2188
2382
|
_fireOwedDemandIfReady() {
|
|
2189
|
-
|
|
2190
|
-
if (this._slot.pull && this._control.demandOwed !== void 0 && this._canFireDemand()) {
|
|
2191
|
-
this._deliverPullDemand(this._control.demandOwed);
|
|
2192
|
-
}
|
|
2383
|
+
nodeFireOwedDemandIfReady(nodeRuntimeHost(this));
|
|
2193
2384
|
}
|
|
2194
|
-
/** Should an outgoing settle slice be deferred into the pause buffer? */
|
|
2195
2385
|
_shouldBufferOnPause() {
|
|
2196
|
-
|
|
2197
|
-
if (!this._isPaused() && !this._isPullQuiet()) return false;
|
|
2198
|
-
if (this._slot.pausable === "resumeAll") return true;
|
|
2199
|
-
if (!this._wave.insideRunWave && this._isAsyncPool() && this._slot.deps.length > 0) return true;
|
|
2200
|
-
return false;
|
|
2386
|
+
return nodeShouldBufferOnPause(nodeRuntimeHost(this));
|
|
2201
2387
|
}
|
|
2202
|
-
/** R-invalidate-idempotent: clear cache + flush + cascade; no-op if nothing cached. */
|
|
2203
2388
|
_invalidate(delivery) {
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
this._value.hasData = false;
|
|
2207
|
-
this._value.status = "sentinel";
|
|
2208
|
-
this._value.replayRing = [];
|
|
2209
|
-
for (const fn of this._hooks.onInvalidate) fn();
|
|
2210
|
-
this._emitToSubs(["INVALIDATE"], delivery);
|
|
2211
|
-
}
|
|
2212
|
-
// B42 (R-deps-terminal): ALL deps TERMINAL = every dep has reached COMPLETE *or* an ABSORBED
|
|
2213
|
-
// ERROR. Block only on a LIVE dep (_depTerminal[i] === undefined); an errored dep (terminal = the
|
|
2214
|
-
// error payload, which R-data-payload guarantees is !== undefined and non-boolean) COUNTS as
|
|
2215
|
-
// terminal-done. Was
|
|
2216
|
-
// `tm !== true`, which wedged a node whose errorWhenDepsError:false dep ERRORed (it never
|
|
2217
|
-
// auto-completed even after every other dep completed). Drives the completeWhenDepsComplete cascade.
|
|
2389
|
+
nodeInvalidate(nodeRuntimeHost(this), delivery);
|
|
2390
|
+
}
|
|
2218
2391
|
_allDepsTerminal() {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2392
|
+
return nodeAllDepsTerminal(nodeRuntimeHost(this));
|
|
2393
|
+
}
|
|
2394
|
+
_emitToSubs(msg, delivery) {
|
|
2395
|
+
nodeEmitToSubs(nodeRuntimeHost(this), msg, delivery);
|
|
2222
2396
|
}
|
|
2223
2397
|
/** R-terminal: resubscribable reset clears terminal + dep state + re-arms the gate. */
|
|
2224
2398
|
_resetLifecycle() {
|
|
2225
|
-
|
|
2226
|
-
this._dep.unsubs = [];
|
|
2227
|
-
this._dep.idxBoxes = [];
|
|
2228
|
-
this._lifecycle.subscribers.clear();
|
|
2229
|
-
this._lifecycle.activated = false;
|
|
2230
|
-
this._value.terminal = void 0;
|
|
2231
|
-
this._value.hasTorndown = false;
|
|
2232
|
-
this._wave.hasCalledFnOnce = false;
|
|
2233
|
-
this._resetDepState();
|
|
2234
|
-
this._control.pauseLockset.clear();
|
|
2235
|
-
this._control.pauseBuffer = [];
|
|
2236
|
-
this._control.pausedDepWaveOccurred = false;
|
|
2237
|
-
this._control.demandOwed = void 0;
|
|
2238
|
-
this._control.activePull = void 0;
|
|
2239
|
-
this._control.pullDirtyOwed = false;
|
|
2240
|
-
this._value.replayRing = [];
|
|
2241
|
-
const isCompute = this._slot.handle !== null || this._slot.deps.length > 0;
|
|
2242
|
-
if (isCompute) {
|
|
2243
|
-
this._value.cache = SENTINEL;
|
|
2244
|
-
this._value.hasData = false;
|
|
2245
|
-
this._value.status = "sentinel";
|
|
2246
|
-
} else {
|
|
2247
|
-
this._value.status = this._value.hasData ? "settled" : "sentinel";
|
|
2248
|
-
}
|
|
2249
|
-
if (!this._privateState.persist) this._privateState.value = SENTINEL;
|
|
2250
|
-
}
|
|
2251
|
-
_emitToSubs(msg, delivery) {
|
|
2252
|
-
if (this._released) return;
|
|
2253
|
-
const subs = [...this._lifecycle.subscribers];
|
|
2254
|
-
for (const sink of subs) sink(msg, delivery);
|
|
2399
|
+
nodeResetLifecycle(nodeRuntimeHost(this));
|
|
2255
2400
|
}
|
|
2256
2401
|
/** Batch commit (R-batch-coalesce): deliver the deferred tier-3 wave now. */
|
|
2257
2402
|
__commitBatchedWave(wave) {
|
|
2258
|
-
this
|
|
2259
|
-
this._down(wave);
|
|
2403
|
+
nodeCommitBatchedWave(nodeRuntimeHost(this), wave);
|
|
2260
2404
|
}
|
|
2261
2405
|
/** Batch rollback: balance the immediate DIRTY with a RESOLVED so downstream un-dirties. */
|
|
2262
2406
|
__rollbackBatched() {
|
|
2263
|
-
|
|
2264
|
-
this._wave.batchDirtyOwed = false;
|
|
2265
|
-
this._wave.emittedDirtyThisWave = false;
|
|
2266
|
-
this._value.status = this._value.hasData ? "settled" : "sentinel";
|
|
2267
|
-
this._emitToSubs(["RESOLVED"]);
|
|
2268
|
-
}
|
|
2407
|
+
nodeRollbackBatched(nodeRuntimeHost(this));
|
|
2269
2408
|
}
|
|
2270
2409
|
/** B49: enqueue a committed-boundary task on this node's graph-local core. */
|
|
2271
2410
|
__deferBoundary(fn, batchToken) {
|
|
2272
|
-
|
|
2273
|
-
batchToken,
|
|
2274
|
-
isReady: () => !this._hasBoundaryPauseLock()
|
|
2275
|
-
});
|
|
2411
|
+
nodeDeferBoundary(nodeRuntimeHost(this), fn, batchToken);
|
|
2276
2412
|
}
|
|
2277
2413
|
};
|
|
2278
2414
|
function node(deps = [], handleOrFn = null, opts = {}) {
|
|
@@ -2290,8 +2426,6 @@ export {
|
|
|
2290
2426
|
EnvironmentDrivers,
|
|
2291
2427
|
fetchHttpDriver,
|
|
2292
2428
|
domWebSocketDriver,
|
|
2293
|
-
defaultNodeVersionHash,
|
|
2294
|
-
validateNodeVersionJson,
|
|
2295
2429
|
withNodeCore,
|
|
2296
2430
|
withEnvironmentDrivers,
|
|
2297
2431
|
getNodeOwner,
|
|
@@ -2304,8 +2438,10 @@ export {
|
|
|
2304
2438
|
subscriberCountOfNode,
|
|
2305
2439
|
isNodeActiveForRelease,
|
|
2306
2440
|
isNodeRuntimeReleased,
|
|
2441
|
+
defaultNodeVersionHash,
|
|
2442
|
+
validateNodeVersionJson,
|
|
2307
2443
|
Node,
|
|
2308
2444
|
node,
|
|
2309
2445
|
dynamicNode
|
|
2310
2446
|
};
|
|
2311
|
-
//# sourceMappingURL=chunk-
|
|
2447
|
+
//# sourceMappingURL=chunk-SHZDP2MQ.js.map
|