@graphrefly/ts 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +197 -117
- package/dist/actions-types-CH-XCU9O.d.cts +657 -0
- package/dist/actions-types-w2iPQTkv.d.ts +657 -0
- package/dist/adapters/index.cjs +5157 -2951
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +207 -70
- package/dist/adapters/index.d.ts +207 -70
- package/dist/adapters/index.js +3738 -1688
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/nestjs/microservices.cjs +841 -0
- package/dist/adapters/nestjs/microservices.cjs.map +1 -0
- package/dist/adapters/nestjs/microservices.d.cts +45 -0
- package/dist/adapters/nestjs/microservices.d.ts +45 -0
- package/dist/adapters/nestjs/microservices.js +206 -0
- package/dist/adapters/nestjs/microservices.js.map +1 -0
- package/dist/adapters/nestjs/native.cjs +1391 -0
- package/dist/adapters/nestjs/native.cjs.map +1 -0
- package/dist/adapters/nestjs/native.d.cts +111 -0
- package/dist/adapters/nestjs/native.d.ts +111 -0
- package/dist/adapters/nestjs/native.js +577 -0
- package/dist/adapters/nestjs/native.js.map +1 -0
- package/dist/adapters/nestjs/websockets.cjs +924 -0
- package/dist/adapters/nestjs/websockets.cjs.map +1 -0
- package/dist/adapters/nestjs/websockets.d.cts +47 -0
- package/dist/adapters/nestjs/websockets.d.ts +47 -0
- package/dist/adapters/nestjs/websockets.js +286 -0
- package/dist/adapters/nestjs/websockets.js.map +1 -0
- package/dist/adapters/nestjs.cjs +1085 -0
- package/dist/adapters/nestjs.cjs.map +1 -0
- package/dist/adapters/nestjs.d.cts +385 -0
- package/dist/adapters/nestjs.d.ts +385 -0
- package/dist/adapters/nestjs.js +112 -0
- package/dist/adapters/nestjs.js.map +1 -0
- package/dist/adapters/observe-storage.d.cts +3 -3
- package/dist/adapters/observe-storage.d.ts +3 -3
- package/dist/adapters/observe-storage.js +4 -4
- package/dist/adapters/react.cjs.map +1 -1
- package/dist/adapters/react.d.cts +2 -2
- package/dist/adapters/react.d.ts +2 -2
- package/dist/adapters/react.js +1 -1
- package/dist/adapters/solid.cjs.map +1 -1
- package/dist/adapters/solid.d.cts +2 -2
- package/dist/adapters/solid.d.ts +2 -2
- package/dist/adapters/solid.js +1 -1
- package/dist/adapters/svelte.cjs.map +1 -1
- package/dist/adapters/svelte.d.cts +2 -2
- package/dist/adapters/svelte.d.ts +2 -2
- package/dist/adapters/svelte.js +1 -1
- package/dist/adapters/vue.cjs.map +1 -1
- package/dist/adapters/vue.d.cts +2 -2
- package/dist/adapters/vue.d.ts +2 -2
- package/dist/adapters/vue.js +1 -1
- package/dist/{agent-runtime-BesGDZcB.d.ts → agent-runtime-types-core-CKwrBDyi.d.ts} +171 -320
- package/dist/{agent-runtime-DZTJ3C-p.d.cts → agent-runtime-types-core-bfl4m0vM.d.cts} +171 -320
- package/dist/agent-runtime-types-tool-BLPV3azj.d.cts +695 -0
- package/dist/agent-runtime-types-tool-hwqvVqNt.d.ts +695 -0
- package/dist/agentic-memory-retention-CLwI76JK.d.ts +14 -0
- package/dist/agentic-memory-retention-Cz8GR6ie.d.cts +14 -0
- package/dist/{agentic-memory-DfuVZ-lY.d.cts → agentic-memory-types-JDr7MPhh.d.cts} +13 -57
- package/dist/{agentic-memory-BmRCvh0d.d.ts → agentic-memory-types-khYJgzKL.d.ts} +13 -57
- package/dist/{capability-admission-B0BzqAm5.d.cts → capability-admission-B8RNFyaZ.d.cts} +3 -3
- package/dist/{capability-admission-g0mn9hpq.d.ts → capability-admission-Dkw1Xz3r.d.ts} +3 -3
- package/dist/chunk-2KUAG2GZ.js +9693 -0
- package/dist/chunk-2KUAG2GZ.js.map +1 -0
- package/dist/{chunk-CZNV3VXM.js → chunk-3J7UPZL5.js} +11 -11
- package/dist/{chunk-HKK2JD7Z.js → chunk-3LYI6ADX.js} +12 -125
- package/dist/chunk-3LYI6ADX.js.map +1 -0
- package/dist/{chunk-YXMZ2N6J.js → chunk-4M37FH2I.js} +1071 -1025
- package/dist/chunk-4M37FH2I.js.map +1 -0
- package/dist/{chunk-YDSIVHRR.js → chunk-4NWSNI4K.js} +1598 -1584
- package/dist/chunk-4NWSNI4K.js.map +1 -0
- package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
- package/dist/{chunk-SS2A464I.js → chunk-54WPEODM.js} +3 -3
- package/dist/chunk-54WPEODM.js.map +1 -0
- package/dist/chunk-6E76H4OU.js +132 -0
- package/dist/chunk-6E76H4OU.js.map +1 -0
- package/dist/chunk-7GOTIIQ7.js +819 -0
- package/dist/chunk-7GOTIIQ7.js.map +1 -0
- package/dist/{chunk-V7CIJE4B.js → chunk-DKFWDTVY.js} +92 -9
- package/dist/chunk-DKFWDTVY.js.map +1 -0
- package/dist/{chunk-FBUU43PM.js → chunk-E4QCH32M.js} +448 -446
- package/dist/chunk-E4QCH32M.js.map +1 -0
- package/dist/{chunk-XKXWK2KP.js → chunk-GXU6WFEJ.js} +1157 -1021
- package/dist/chunk-GXU6WFEJ.js.map +1 -0
- package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
- package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
- package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
- package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
- package/dist/chunk-K7FB3JTD.js.map +1 -0
- package/dist/{chunk-43BKLFZU.js → chunk-KFURM6FM.js} +10 -10
- package/dist/{chunk-H75VXTGT.js → chunk-L6LDXRWE.js} +3 -3
- package/dist/{chunk-H75VXTGT.js.map → chunk-L6LDXRWE.js.map} +1 -1
- package/dist/chunk-MCOFHMUU.js +4131 -0
- package/dist/chunk-MCOFHMUU.js.map +1 -0
- package/dist/chunk-MQEQMS7B.js +1009 -0
- package/dist/chunk-MQEQMS7B.js.map +1 -0
- package/dist/chunk-MTELVIYR.js +1421 -0
- package/dist/chunk-MTELVIYR.js.map +1 -0
- package/dist/{chunk-3JR3EDB2.js → chunk-NNDIFUKX.js} +121 -115
- package/dist/chunk-NNDIFUKX.js.map +1 -0
- package/dist/{chunk-2747WN4Y.js → chunk-PUSRRALM.js} +3 -3
- package/dist/{chunk-QFY4AFY4.js → chunk-PVC7WDKI.js} +58 -52
- package/dist/chunk-PVC7WDKI.js.map +1 -0
- package/dist/{chunk-VTHLCFN4.js → chunk-RAHNUYA5.js} +2 -2
- package/dist/chunk-TQPCAIQI.js +612 -0
- package/dist/chunk-TQPCAIQI.js.map +1 -0
- package/dist/{chunk-IXZBUWSP.js → chunk-UEMN5URK.js} +2 -2
- package/dist/chunk-WOS7RJYZ.js +1320 -0
- package/dist/chunk-WOS7RJYZ.js.map +1 -0
- package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
- package/dist/composition/index.cjs +1228 -1076
- package/dist/composition/index.cjs.map +1 -1
- package/dist/composition/index.d.cts +3 -3
- package/dist/composition/index.d.ts +3 -3
- package/dist/composition/index.js +4 -4
- package/dist/core/index.cjs +1198 -1046
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +23 -2
- package/dist/core/index.d.ts +23 -2
- package/dist/core/index.js +2 -2
- package/dist/cqrs/index.d.cts +3 -3
- package/dist/cqrs/index.d.ts +3 -3
- package/dist/cqrs/messaging.d.cts +4 -4
- package/dist/cqrs/messaging.d.ts +4 -4
- package/dist/cqrs/work-queue.d.cts +5 -5
- package/dist/cqrs/work-queue.d.ts +5 -5
- package/dist/data-structures/index.cjs +1226 -1074
- package/dist/data-structures/index.cjs.map +1 -1
- package/dist/data-structures/index.d.cts +8 -7
- package/dist/data-structures/index.d.ts +8 -7
- package/dist/data-structures/index.js +6 -5
- package/dist/{describe-DYMw_l1C.d.cts → describe-BumQ-3_0.d.cts} +1 -1
- package/dist/{describe-BpyJuWkw.d.ts → describe-cYr_Z5zm.d.ts} +1 -1
- package/dist/executors/tool-provider-adapters.cjs +3091 -0
- package/dist/executors/tool-provider-adapters.cjs.map +1 -0
- package/dist/executors/tool-provider-adapters.d.cts +174 -0
- package/dist/executors/tool-provider-adapters.d.ts +174 -0
- package/dist/executors/tool-provider-adapters.js +1336 -0
- package/dist/executors/tool-provider-adapters.js.map +1 -0
- package/dist/executors/tool-provider-runtime.cjs +5178 -0
- package/dist/executors/tool-provider-runtime.cjs.map +1 -0
- package/dist/executors/tool-provider-runtime.d.cts +17 -0
- package/dist/executors/tool-provider-runtime.d.ts +17 -0
- package/dist/executors/tool-provider-runtime.js +15 -0
- package/dist/executors/tool-provider-runtime.js.map +1 -0
- package/dist/executors/tool-provider.cjs +6392 -0
- package/dist/executors/tool-provider.cjs.map +1 -0
- package/dist/executors/tool-provider.d.cts +60 -0
- package/dist/executors/tool-provider.d.ts +60 -0
- package/dist/executors/tool-provider.js +89 -0
- package/dist/executors/tool-provider.js.map +1 -0
- package/dist/executors/work-queue.d.cts +6 -6
- package/dist/executors/work-queue.d.ts +6 -6
- package/dist/graph/index.cjs +1499 -1341
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +9 -8
- package/dist/graph/index.d.ts +9 -8
- package/dist/graph/index.js +23 -22
- package/dist/{graph-DCEWh4T2.d.cts → graph-C1C-wb0L.d.cts} +266 -137
- package/dist/{graph-D-1-SQeC.d.ts → graph-CS0b4V9B.d.ts} +266 -137
- package/dist/{index-72VZC0-E.d.cts → index-DLrNopda.d.cts} +151 -10
- package/dist/{index-Bmxeu0nK.d.ts → index-DzJni3_6.d.ts} +151 -10
- package/dist/index.cjs +3397 -3140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +110 -109
- package/dist/inspection/boundary.d.cts +4 -4
- package/dist/inspection/boundary.d.ts +4 -4
- package/dist/measurements-BWAnochv.d.ts +294 -0
- package/dist/measurements-B_gJfD8h.d.cts +294 -0
- package/dist/messaging/index.cjs +57 -51
- package/dist/messaging/index.cjs.map +1 -1
- package/dist/messaging/index.d.cts +11 -276
- package/dist/messaging/index.d.ts +11 -276
- package/dist/messaging/index.js +1 -1
- package/dist/operators/index.cjs +1228 -1076
- package/dist/operators/index.cjs.map +1 -1
- package/dist/operators/index.d.cts +5 -5
- package/dist/operators/index.d.ts +5 -5
- package/dist/operators/index.js +5 -5
- package/dist/orchestration/index.cjs +8844 -6071
- package/dist/orchestration/index.cjs.map +1 -1
- package/dist/orchestration/index.d.cts +171 -224
- package/dist/orchestration/index.d.ts +171 -224
- package/dist/orchestration/index.js +42 -991
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/messaging.d.cts +5 -8
- package/dist/orchestration/messaging.d.ts +5 -8
- package/dist/orchestration/work-queue.cjs +1243 -5
- package/dist/orchestration/work-queue.cjs.map +1 -1
- package/dist/orchestration/work-queue.d.cts +121 -10
- package/dist/orchestration/work-queue.d.ts +121 -10
- package/dist/orchestration/work-queue.js +1067 -4
- package/dist/orchestration/work-queue.js.map +1 -1
- package/dist/patterns/event-flow.cjs +6 -20
- package/dist/patterns/event-flow.cjs.map +1 -1
- package/dist/patterns/event-flow.d.cts +4 -4
- package/dist/patterns/event-flow.d.ts +4 -4
- package/dist/patterns/event-flow.js +2 -2
- package/dist/patterns/index.cjs +453 -465
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +6 -5
- package/dist/patterns/index.d.ts +6 -5
- package/dist/patterns/index.js +3 -3
- package/dist/process-types-BB7oRhX3.d.cts +200 -0
- package/dist/process-types-QNhyoYJ8.d.ts +200 -0
- package/dist/{reactive-collection-DNV0-gFi.d.cts → reactive-collection-BYlWvtnp.d.cts} +4 -34
- package/dist/{reactive-collection-BAmfrGjd.d.ts → reactive-collection-efOEdGFN.d.ts} +4 -34
- package/dist/{reactive-collection-storage-BNEldDyi.d.cts → reactive-collection-storage-BjoLsoiC.d.cts} +5 -5
- package/dist/{reactive-collection-storage-YZsAQsWK.d.ts → reactive-collection-storage-DwW6UuK_.d.ts} +5 -5
- package/dist/{reactive-map-DRD1LJ2H.d.cts → reactive-map-BHacbIqz.d.cts} +7 -2
- package/dist/{reactive-map-EsDiCmJk.d.ts → reactive-map-DN4Jyqnf.d.ts} +7 -2
- package/dist/render/index.d.cts +2 -2
- package/dist/render/index.d.ts +2 -2
- package/dist/scheduled-readiness-BmqXxnzX.d.ts +91 -0
- package/dist/scheduled-readiness-CYSw7KDE.d.cts +91 -0
- package/dist/semantic-memory-graph-B_LwbM-E.d.cts +30 -0
- package/dist/semantic-memory-graph-rsFNNhwn.d.ts +30 -0
- package/dist/{semantic-memory-graph-DKuNzuWw.d.cts → semantic-memory-graph-types-Y73bbwVI.d.cts} +2 -28
- package/dist/{semantic-memory-graph-uwbwJdhe.d.ts → semantic-memory-graph-types-safmPkuX.d.ts} +2 -28
- package/dist/solutions/index.cjs +6353 -6169
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +12 -10
- package/dist/solutions/index.d.ts +12 -10
- package/dist/solutions/index.js +5 -5
- package/dist/solutions/reactive-layout/browser/index.cjs +116 -108
- package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/browser/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/browser/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/browser/index.js +3 -3
- package/dist/solutions/reactive-layout/index.cjs +3578 -3350
- package/dist/solutions/reactive-layout/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/index.d.cts +32 -576
- package/dist/solutions/reactive-layout/index.d.ts +32 -576
- package/dist/solutions/reactive-layout/index.js +65 -5
- package/dist/solutions/reactive-layout/node-canvas/index.cjs +127 -117
- package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/node-canvas/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.js +3 -3
- package/dist/solutions/reactive-layout/react-native/index.cjs +127 -117
- package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/react-native/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.js +3 -3
- package/dist/solutions/reactive-layout/skia/index.cjs +127 -117
- package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/skia/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/skia/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/skia/index.js +3 -3
- package/dist/solutions/work-item/actions.cjs +1609 -1428
- package/dist/solutions/work-item/actions.cjs.map +1 -1
- package/dist/solutions/work-item/actions.d.cts +23 -184
- package/dist/solutions/work-item/actions.d.ts +23 -184
- package/dist/solutions/work-item/actions.js +1558 -934
- package/dist/solutions/work-item/actions.js.map +1 -1
- package/dist/solutions/work-item/scheduling.cjs +9181 -1838
- package/dist/solutions/work-item/scheduling.cjs.map +1 -1
- package/dist/solutions/work-item/scheduling.d.cts +1763 -328
- package/dist/solutions/work-item/scheduling.d.ts +1763 -328
- package/dist/solutions/work-item/scheduling.js +117 -3
- package/dist/solutions/work-item/work-queue.d.cts +7 -7
- package/dist/solutions/work-item/work-queue.d.ts +7 -7
- package/dist/sources/browser.cjs +1318 -1083
- package/dist/sources/browser.cjs.map +1 -1
- package/dist/sources/browser.d.cts +22 -6
- package/dist/sources/browser.d.ts +22 -6
- package/dist/sources/browser.js +4 -4
- package/dist/sources/browser.js.map +1 -1
- package/dist/sources/index.cjs +1318 -1083
- package/dist/sources/index.cjs.map +1 -1
- package/dist/sources/index.d.cts +4 -4
- package/dist/sources/index.d.ts +4 -4
- package/dist/sources/index.js +4 -4
- package/dist/sources/node.d.cts +3 -3
- package/dist/sources/node.d.ts +3 -3
- package/dist/storage/browser.cjs +16 -0
- package/dist/storage/browser.cjs.map +1 -1
- package/dist/storage/browser.js +3 -3
- package/dist/storage/index.cjs +16 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +5 -4
- package/dist/storage/index.d.ts +5 -4
- package/dist/storage/index.js +6 -6
- package/dist/storage/node.cjs +16 -0
- package/dist/storage/node.cjs.map +1 -1
- package/dist/storage/node.js +3 -3
- package/dist/{store-C-joM4gh.d.ts → store-6_CHF6Ge.d.ts} +1 -1
- package/dist/{store-CNJwmT-h.d.cts → store-BljX8RkQ.d.cts} +1 -1
- package/dist/types-BAw2QVVE.d.cts +274 -0
- package/dist/types-BUbbbh4f.d.cts +34 -0
- package/dist/types-CMnzoL54.d.cts +457 -0
- package/dist/{types-CcPIn7sy.d.cts → types-CTN3XoMl.d.cts} +57 -108
- package/dist/types-CV_ohy5T.d.cts +357 -0
- package/dist/{types-BsJvElYZ.d.ts → types-DChxk1vK.d.ts} +57 -108
- package/dist/types-DRu7SnLV.d.ts +274 -0
- package/dist/types-DeID_FRl.d.ts +34 -0
- package/dist/types-IhKH0hGW.d.ts +357 -0
- package/dist/types-ePlD2uyT.d.ts +457 -0
- package/dist/{work-item-runtime-qaVgsL0T.d.cts → work-item-runtime-types-BTxLskN5.d.cts} +3 -93
- package/dist/{work-item-runtime-C3M79vE9.d.ts → work-item-runtime-types-DAsZbb2y.d.ts} +3 -93
- package/dist/work-queue/index.cjs +957 -953
- package/dist/work-queue/index.cjs.map +1 -1
- package/dist/work-queue/index.d.cts +9 -357
- package/dist/work-queue/index.d.ts +9 -357
- package/dist/work-queue/index.js +957 -953
- package/dist/work-queue/index.js.map +1 -1
- package/package.json +611 -513
- package/dist/chunk-3JR3EDB2.js.map +0 -1
- package/dist/chunk-4VLAQHZI.js.map +0 -1
- package/dist/chunk-6XAIOL3X.js +0 -2407
- package/dist/chunk-6XAIOL3X.js.map +0 -1
- package/dist/chunk-FBUU43PM.js.map +0 -1
- package/dist/chunk-HKK2JD7Z.js.map +0 -1
- package/dist/chunk-PC3BTTBE.js +0 -3217
- package/dist/chunk-PC3BTTBE.js.map +0 -1
- package/dist/chunk-QFY4AFY4.js.map +0 -1
- package/dist/chunk-SS2A464I.js.map +0 -1
- package/dist/chunk-V7CIJE4B.js.map +0 -1
- package/dist/chunk-XKXWK2KP.js.map +0 -1
- package/dist/chunk-YDSIVHRR.js.map +0 -1
- package/dist/chunk-YXMZ2N6J.js.map +0 -1
- /package/dist/{chunk-CZNV3VXM.js.map → chunk-3J7UPZL5.js.map} +0 -0
- /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
- /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
- /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
- /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
- /package/dist/{chunk-43BKLFZU.js.map → chunk-KFURM6FM.js.map} +0 -0
- /package/dist/{chunk-2747WN4Y.js.map → chunk-PUSRRALM.js.map} +0 -0
- /package/dist/{chunk-VTHLCFN4.js.map → chunk-RAHNUYA5.js.map} +0 -0
- /package/dist/{chunk-IXZBUWSP.js.map → chunk-UEMN5URK.js.map} +0 -0
- /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/orchestration/agent-runtime-outcome-view.ts","../src/orchestration/agent-runtime-tool-provider-policy.ts","../src/orchestration/agent-runtime-tool-provider-input.ts"],"sourcesContent":["import { depBatch } from \"../ctx/types.js\";\nimport type { DataIssue } from \"../data/index.js\";\nimport type { Graph } from \"../graph/graph.js\";\nimport type { Node } from \"../node/node.js\";\nimport {\n\tdataIssue,\n\tprojectRuntimeFact,\n\tref,\n\tsanitizeProviderGraphVisibleRecord,\n\tuniqueSourceRefs,\n} from \"./agent-runtime-common.js\";\nimport { outcomeIssues } from \"./agent-runtime-executor-outcome.js\";\nimport type { AgentRuntimeAuditRecord } from \"./agent-runtime-types-agent.js\";\nimport type { ExecutorOutcome, SourceRef } from \"./agent-runtime-types-core.js\";\nimport type {\n\tExecutorOutcomeView,\n\tExecutorOutcomeViewBundle,\n\tExecutorOutcomeViewPolicy,\n} from \"./agent-runtime-types-tool.js\";\n\nexport function executorOutcomeViewProjector(\n\tgraph: Graph,\n\topts: {\n\t\treadonly name?: string;\n\t\treadonly outcomes: Node<ExecutorOutcome>;\n\t\treadonly policy?: ExecutorOutcomeViewPolicy;\n\t},\n): ExecutorOutcomeViewBundle {\n\tconst name = opts.name ?? \"executorOutcomeViews\";\n\tconst policy = {\n\t\taudience: opts.policy?.audience ?? \"agent-observation\",\n\t\tmaxSummaryChars: opts.policy?.maxSummaryChars ?? 512,\n\t\tincludeIssues: opts.policy?.includeIssues ?? true,\n\t\tincludeUsage: opts.policy?.includeUsage ?? false,\n\t\tincludeMetadata: opts.policy?.includeMetadata ?? false,\n\t} satisfies Required<ExecutorOutcomeViewPolicy>;\n\tconst runtime = graph.node<ExecutorOutcomeViewFact>(\n\t\t[opts.outcomes],\n\t\t(ctx) => {\n\t\t\tfor (const raw of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst outcome = raw as ExecutorOutcome;\n\t\t\t\tconst projection = executorOutcomeViewProjectionFromOutcome(outcome, policy);\n\t\t\t\tctx.down([\n\t\t\t\t\t[\"DATA\", { kind: \"view\", view: projection.view } satisfies ExecutorOutcomeViewFact],\n\t\t\t\t\t[\n\t\t\t\t\t\t\"DATA\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"audit\",\n\t\t\t\t\t\t\taudit: {\n\t\t\t\t\t\t\t\tid: `${outcome.outcomeId}:outcome-view:${policy.audience}`,\n\t\t\t\t\t\t\t\tkind: \"executor-outcome-view-projected\",\n\t\t\t\t\t\t\t\tsubjectId: outcome.requestId,\n\t\t\t\t\t\t\t\tsourceRefs: [ref(\"executor-outcome\", outcome.outcomeId)],\n\t\t\t\t\t\t\t\tmetadata: { audience: policy.audience, status: outcome.kind },\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} satisfies ExecutorOutcomeViewFact,\n\t\t\t\t\t],\n\t\t\t\t]);\n\t\t\t\tfor (const issue of projection.issues) {\n\t\t\t\t\tctx.down([[\"DATA\", { kind: \"issue\", issue } satisfies ExecutorOutcomeViewFact]]);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{ name: `${name}/runtime`, factory: \"executorOutcomeViewProjector\" },\n\t);\n\treturn {\n\t\tviews: projectRuntimeFact(graph, runtime, `${name}/views`, \"executorOutcomeViews\", (fact) =>\n\t\t\tfact.kind === \"view\" ? fact.view : undefined,\n\t\t),\n\t\tissues: projectRuntimeFact(\n\t\t\tgraph,\n\t\t\truntime,\n\t\t\t`${name}/issues`,\n\t\t\t\"executorOutcomeViewIssues\",\n\t\t\t(fact) => (fact.kind === \"issue\" ? fact.issue : undefined),\n\t\t),\n\t\taudit: projectRuntimeFact(\n\t\t\tgraph,\n\t\t\truntime,\n\t\t\t`${name}/audit`,\n\t\t\t\"executorOutcomeViewAudit\",\n\t\t\t(fact) => (fact.kind === \"audit\" ? fact.audit : undefined),\n\t\t),\n\t};\n}\n\nexport type ExecutorOutcomeViewFact =\n\t| { readonly kind: \"view\"; readonly view: ExecutorOutcomeView }\n\t| { readonly kind: \"issue\"; readonly issue: DataIssue }\n\t| { readonly kind: \"audit\"; readonly audit: AgentRuntimeAuditRecord };\n\nexport interface ExecutorOutcomeViewProjection {\n\treadonly view: ExecutorOutcomeView;\n\treadonly issues: readonly DataIssue[];\n}\n\nexport interface ExecutorOutcomeSummaryProjection {\n\treadonly summary: string;\n\treadonly truncated: boolean;\n\treadonly originalChars: number;\n\treadonly limitChars: number;\n}\n\nexport function executorOutcomeViewProjectionFromOutcome(\n\toutcome: ExecutorOutcome,\n\tpolicy: Required<ExecutorOutcomeViewPolicy>,\n): ExecutorOutcomeViewProjection {\n\tconst sourceRefs = uniqueSourceRefs([\n\t\tref(\"executor-outcome\", outcome.outcomeId),\n\t\t...(outcome.evidenceRefs ?? []),\n\t]);\n\tconst summary = projectOutcomeSummary(outcome, policy.maxSummaryChars);\n\tconst issues = Object.freeze([\n\t\t...outcomeIssues(outcome),\n\t\t...(summary.truncated ? [outcomeSummaryTruncationIssue(outcome, summary, policy)] : []),\n\t]);\n\tconst metadata = policy.includeMetadata\n\t\t? sanitizeProviderGraphVisibleRecord(outcome.metadata)\n\t\t: undefined;\n\tconst view = Object.freeze({\n\t\tkind: \"executor-outcome-view\",\n\t\tviewId: `${outcome.outcomeId}:${policy.audience}`,\n\t\taudience: policy.audience,\n\t\toutcomeId: outcome.outcomeId,\n\t\trequestId: outcome.requestId,\n\t\toperationId: outcome.operationId,\n\t\trouteId: outcome.routeId,\n\t\texecutorId: outcome.executorId,\n\t\tprofileId: outcome.profileId,\n\t\tstatus: outcome.kind,\n\t\tsummary: summary.summary,\n\t\tsummaryTruncated: summary.truncated,\n\t\tsummaryChars: summary.originalChars,\n\t\tsummaryLimitChars: summary.limitChars,\n\t\terrorKind: outcomeErrorKind(outcome),\n\t\tretryable: outcomeRetryable(outcome),\n\t\tnextActions: outcomeNextActions(outcome),\n\t\tsourceRefs,\n\t\tmaterialRefs: outcomeMaterialRefs(outcome),\n\t\tissues: policy.includeIssues && issues.length > 0 ? issues : undefined,\n\t\tusage: policy.includeUsage ? outcome.usage : undefined,\n\t\t...(metadata === undefined ? {} : { metadata }),\n\t} satisfies ExecutorOutcomeView);\n\treturn Object.freeze({ view, issues });\n}\n\nexport function projectOutcomeSummary(\n\toutcome: ExecutorOutcome,\n\tmaxChars: number,\n): ExecutorOutcomeSummaryProjection {\n\tconst summary = outcomeSummary(outcome);\n\tconst limitChars = Math.max(0, maxChars);\n\tif (summary.length <= limitChars) {\n\t\treturn Object.freeze({\n\t\t\tsummary,\n\t\t\ttruncated: false,\n\t\t\toriginalChars: summary.length,\n\t\t\tlimitChars,\n\t\t});\n\t}\n\tconst bounded =\n\t\tlimitChars <= 1\n\t\t\t? summary.slice(0, limitChars)\n\t\t\t: limitChars <= 3\n\t\t\t\t? summary.slice(0, limitChars)\n\t\t\t\t: `${summary.slice(0, limitChars - 3)}...`;\n\treturn Object.freeze({\n\t\tsummary: bounded,\n\t\ttruncated: true,\n\t\toriginalChars: summary.length,\n\t\tlimitChars,\n\t});\n}\n\nexport function outcomeSummaryTruncationIssue(\n\toutcome: ExecutorOutcome,\n\tsummary: ExecutorOutcomeSummaryProjection,\n\tpolicy: Required<ExecutorOutcomeViewPolicy>,\n): DataIssue {\n\treturn dataIssue(\n\t\t\"executor-outcome-view-summary-truncated\",\n\t\t\"ExecutorOutcome view summary was truncated; inspect material refs or the source outcome for full detail\",\n\t\t{\n\t\t\tsubjectId: outcome.requestId,\n\t\t\trefs: [ref(\"executor-outcome\", outcome.outcomeId)],\n\t\t\tseverity: \"warning\",\n\t\t\tdetails: {\n\t\t\t\taudience: policy.audience,\n\t\t\t\toutcomeId: outcome.outcomeId,\n\t\t\t\toriginalChars: summary.originalChars,\n\t\t\t\tlimitChars: summary.limitChars,\n\t\t\t},\n\t\t},\n\t);\n}\n\nexport function outcomeSummary(outcome: ExecutorOutcome): string {\n\tif (outcome.kind === \"result\") {\n\t\tif (outcome.result.summary !== undefined && outcome.result.summary.length > 0)\n\t\t\treturn outcome.result.summary;\n\t\treturn `Executor result '${outcome.result.kind}' is available via source refs`;\n\t}\n\tif (outcome.kind === \"failure\") return outcome.error.message;\n\tif (outcome.kind === \"blocked\") {\n\t\tconst needKinds = outcome.needs.map((need) => need.kind).join(\", \");\n\t\treturn needKinds.length > 0 ? `Executor blocked: ${needKinds}` : \"Executor blocked\";\n\t}\n\tif (outcome.kind === \"timeout\") {\n\t\treturn outcome.timeoutMs === undefined\n\t\t\t? \"Executor timed out\"\n\t\t\t: `Executor timed out after ${outcome.timeoutMs}ms`;\n\t}\n\treturn outcome.reason ?? \"Executor canceled\";\n}\n\nexport function outcomeErrorKind(outcome: ExecutorOutcome): string | undefined {\n\tif (outcome.kind === \"failure\") return outcome.error.code;\n\tif (outcome.kind === \"timeout\") return \"timeout\";\n\tif (outcome.kind === \"blocked\") return outcome.needs[0]?.kind ?? \"blocked\";\n\tif (outcome.kind === \"canceled\") return \"canceled\";\n\treturn undefined;\n}\n\nexport function outcomeRetryable(outcome: ExecutorOutcome): boolean | undefined {\n\tif (outcome.kind === \"failure\" || outcome.kind === \"timeout\") return outcome.retryable;\n\treturn undefined;\n}\n\nexport function outcomeNextActions(outcome: ExecutorOutcome): readonly string[] | undefined {\n\tif (outcome.kind === \"blocked\") return Object.freeze(outcome.needs.map((need) => need.kind));\n\tif ((outcome.kind === \"failure\" || outcome.kind === \"timeout\") && outcome.retryable === true) {\n\t\treturn Object.freeze([\"retry-or-route\"]);\n\t}\n\treturn undefined;\n}\n\nexport function outcomeMaterialRefs(outcome: ExecutorOutcome): readonly SourceRef[] | undefined {\n\tconst refs =\n\t\toutcome.kind === \"result\"\n\t\t\t? [...(outcome.result.refs ?? [])]\n\t\t\t: outcome.kind === \"blocked\"\n\t\t\t\t? outcome.needs.flatMap((need) => [...(need.refs ?? [])])\n\t\t\t\t: [];\n\treturn refs.length === 0 ? undefined : uniqueSourceRefs(refs);\n}\n","import { depBatch } from \"../ctx/types.js\";\nimport type { DataIssue } from \"../data/index.js\";\nimport type { Graph } from \"../graph/graph.js\";\nimport type { Node } from \"../node/node.js\";\nimport {\n\tdataIssue,\n\tforbiddenDataKeys,\n\tforbiddenGraphVisibleMaterialIssues,\n\tforbiddenProviderRawMaterialKeys,\n\tforEachDepBatch,\n\tisRecord,\n\tprojectRuntimeFact,\n\tref,\n\tsanitizeProviderGraphVisibleRecord,\n\tunlockedToolProviderPolicyOverrides,\n} from \"./agent-runtime-common.js\";\nimport type { AgentRuntimeAuditRecord } from \"./agent-runtime-types-agent.js\";\nimport type {\n\tAgentRequestFact,\n\tAgentRequestIssued,\n\tExecutorProfile,\n\tExecutorRoute,\n\tSourceRef,\n} from \"./agent-runtime-types-core.js\";\nimport type {\n\tLocalBuiltinToolProviderCatalogOptions,\n\tToolCallInput,\n\tToolProviderApprovalPolicy,\n\tToolProviderArtifactPolicy,\n\tToolProviderCatalog,\n\tToolProviderCatalogEntry,\n\tToolProviderExecutionPolicy,\n\tToolProviderFilesystemPolicy,\n\tToolProviderNetworkPolicy,\n\tToolProviderPathRule,\n\tToolProviderPolicyResolution,\n\tToolProviderPolicyResolutionBundle,\n\tToolProviderPolicyResolutionStatus,\n\tToolProviderRedactionPolicy,\n\tToolProviderSizeCapacityPolicy,\n\tToolProviderSizeLimit,\n\tToolProviderTimeoutPolicy,\n} from \"./agent-runtime-types-tool.js\";\n\nexport function localBuiltinToolProviderCatalog(\n\topts: LocalBuiltinToolProviderCatalogOptions = {},\n): ToolProviderCatalog {\n\tconst providerId = opts.providerId ?? \"local-builtin\";\n\tconst executorId = opts.executorId ?? `${providerId}:tool-executor`;\n\tconst profileId = opts.profileId ?? `${providerId}:tool-profile`;\n\tconst tools =\n\t\topts.tools ??\n\t\t([\n\t\t\t{ toolName: \"document/read-doc\", operation: \"read\" },\n\t\t\t{ toolName: \"file.read\", operation: \"read\" },\n\t\t\t{ toolName: \"file.edit/apply-patch\", operation: \"edit\" },\n\t\t\t{ toolName: \"bash.run\", operation: \"run\" },\n\t\t\t{ toolName: \"url.fetch\", operation: \"fetch\" },\n\t\t\t{ toolName: \"date.now\", operation: \"read\" },\n\t\t\t{ toolName: \"weather.fetch\", operation: \"fetch\" },\n\t\t\t{ toolName: \"calculator/eval\", operation: \"eval\" },\n\t\t] satisfies readonly Omit<\n\t\t\tToolProviderCatalogEntry,\n\t\t\t\"kind\" | \"providerId\" | \"inputKind\" | \"profileId\" | \"executorId\"\n\t\t>[]);\n\tconst candidatePolicies: readonly unknown[] = opts.policies?.map((policy) =>\n\t\tObject.freeze(policy),\n\t) ?? [\n\t\tdefaultLocalBuiltinToolProviderExecutionPolicy({\n\t\t\tproviderId,\n\t\t\tprofileId,\n\t\t\ttools,\n\t\t\toverrides: opts.policyOverrides,\n\t\t}),\n\t];\n\tconst policyIssues = Object.freeze(\n\t\tcandidatePolicies.flatMap((policy) => [\n\t\t\t...validateToolProviderExecutionPolicy(policy),\n\t\t\t...validateToolProviderPolicyProviderScope(policy, providerId),\n\t\t]),\n\t);\n\tconst policies = Object.freeze(\n\t\tcandidatePolicies\n\t\t\t.filter((policy) => isPublishableToolProviderExecutionPolicy(policy, providerId))\n\t\t\t.map((policy) => Object.freeze(policy)),\n\t);\n\tconst policyRefs = Object.freeze(\n\t\tpolicies.map((policy) => ref(\"tool-provider-execution-policy\", policy.policyId)),\n\t);\n\tconst catalogInputIssues = Object.freeze([\n\t\t...forbiddenGraphVisibleMaterialIssues(\n\t\t\topts.metadata,\n\t\t\tref(\"tool-provider-catalog\", providerId),\n\t\t\t\"catalog-metadata\",\n\t\t),\n\t\t...forbiddenGraphVisibleMaterialIssues(\n\t\t\topts.capabilities,\n\t\t\tref(\"executor-profile\", profileId),\n\t\t\t\"profile-capabilities\",\n\t\t),\n\t\t...forbiddenGraphVisibleMaterialIssues(\n\t\t\topts.limits,\n\t\t\tref(\"executor-profile\", profileId),\n\t\t\t\"profile-limits\",\n\t\t),\n\t\t...tools.flatMap((tool) => [\n\t\t\t...forbiddenGraphVisibleMaterialIssues(\n\t\t\t\ttool.metadata,\n\t\t\t\tref(\"tool\", tool.toolName),\n\t\t\t\t\"tool-metadata\",\n\t\t\t),\n\t\t\t...forbiddenGraphVisibleMaterialIssues(\n\t\t\t\ttool.capabilities,\n\t\t\t\tref(\"tool\", tool.toolName),\n\t\t\t\t\"tool-capabilities\",\n\t\t\t),\n\t\t\t...forbiddenGraphVisibleMaterialIssues(\n\t\t\t\ttool.limits,\n\t\t\t\tref(\"tool\", tool.toolName),\n\t\t\t\t\"tool-limits\",\n\t\t\t),\n\t\t]),\n\t]);\n\tconst toolEntries = tools.map((tool) => {\n\t\tconst toolPolicyRefs = policyRefsForTool(policies, profileId, tool);\n\t\treturn Object.freeze({\n\t\t\t...tool,\n\t\t\tkind: \"tool-catalog-entry\",\n\t\t\tproviderId,\n\t\t\tinputKind: \"tool-call\",\n\t\t\tprofileId,\n\t\t\texecutorId,\n\t\t\tcapabilities: sanitizeProviderGraphVisibleRecord(tool.capabilities),\n\t\t\tlimits: sanitizeProviderGraphVisibleRecord(tool.limits),\n\t\t\tpolicyRefs: toolPolicyRefs,\n\t\t\tmetadata: sanitizeProviderGraphVisibleRecord(tool.metadata),\n\t\t} satisfies ToolProviderCatalogEntry);\n\t});\n\tconst profilePolicyRefs = policyRefsForProfile(policies, profileId);\n\tconst issues = Object.freeze([...policyIssues, ...catalogInputIssues]);\n\treturn Object.freeze({\n\t\tkind: \"tool-provider-catalog\",\n\t\tproviderId,\n\t\tproviderKind: \"local-builtin\",\n\t\tstatus: issues.length === 0 ? \"ready\" : \"misconfigured\",\n\t\tprofiles: Object.freeze([\n\t\t\tObject.freeze({\n\t\t\t\tprofileId,\n\t\t\t\texecutorId,\n\t\t\t\tkind: \"tool\",\n\t\t\t\tacceptedInputKinds: Object.freeze([\"tool-call\"]),\n\t\t\t\tacceptedResultKinds: Object.freeze(\n\t\t\t\t\tArray.from(new Set(toolEntries.flatMap((tool) => tool.resultKinds ?? []))),\n\t\t\t\t),\n\t\t\t\tcapabilities: Object.freeze({\n\t\t\t\t\ttoolNames: Object.freeze(toolEntries.map((tool) => tool.toolName)),\n\t\t\t\t\t...(sanitizeProviderGraphVisibleRecord(opts.capabilities) ?? {}),\n\t\t\t\t}),\n\t\t\t\tlimits: sanitizeProviderGraphVisibleRecord(opts.limits),\n\t\t\t\tpolicyRefs: profilePolicyRefs,\n\t\t\t\tmetadata: sanitizeProviderGraphVisibleRecord(opts.metadata),\n\t\t\t} satisfies ExecutorProfile),\n\t\t]),\n\t\ttools: Object.freeze(toolEntries),\n\t\tpolicies,\n\t\tpolicyRefs,\n\t\tissues: issues.length === 0 ? undefined : issues,\n\t\tmetadata: sanitizeProviderGraphVisibleRecord(opts.metadata),\n\t});\n}\n\nexport function validateToolProviderExecutionPolicy(policy: unknown): readonly DataIssue[] {\n\tconst issues: DataIssue[] = [];\n\tif (!isRecord(policy)) {\n\t\treturn Object.freeze([\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-invalid-shape\",\n\t\t\t\t\"Tool provider policy must be a data object.\",\n\t\t\t\t{ refs: [ref(\"tool-provider-execution-policy\", \"<invalid>\")] },\n\t\t\t),\n\t\t]);\n\t}\n\tconst policyId = typeof policy.policyId === \"string\" ? policy.policyId : \"\";\n\tconst providerId = typeof policy.providerId === \"string\" ? policy.providerId : \"\";\n\tconst policyRef = ref(\"tool-provider-execution-policy\", policyId || \"<missing>\");\n\tif (policy.kind !== \"tool-provider-execution-policy\") {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-invalid-kind\",\n\t\t\t\t\"ToolProviderExecutionPolicy.kind must be tool-provider-execution-policy.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef] },\n\t\t\t),\n\t\t);\n\t}\n\tif (!policyId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-missing-policy-id\",\n\t\t\t\t\"Tool provider policy is missing policyId.\",\n\t\t\t\t{\n\t\t\t\t\trefs: [policyRef],\n\t\t\t\t},\n\t\t\t),\n\t\t);\n\t}\n\tif (!providerId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-missing-provider-id\",\n\t\t\t\t\"Tool provider policy is missing providerId.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef] },\n\t\t\t),\n\t\t);\n\t}\n\tif (\n\t\tpolicy.sizeCapacity === undefined &&\n\t\tpolicy.timeout === undefined &&\n\t\tpolicy.redaction === undefined &&\n\t\tpolicy.filesystem === undefined &&\n\t\tpolicy.approval === undefined &&\n\t\tpolicy.artifacts === undefined &&\n\t\tpolicy.network === undefined\n\t) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-missing-material\",\n\t\t\t\t\"Tool provider policy has no D360 policy material sections.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef] },\n\t\t\t),\n\t\t);\n\t}\n\tif (policy.sizeCapacity !== undefined && !isRecord(policy.sizeCapacity)) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-invalid-size-capacity\",\n\t\t\t\t\"Tool provider size-capacity policy must be a data object.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef] },\n\t\t\t),\n\t\t);\n\t}\n\tconst limits = isRecord(policy.sizeCapacity) ? policy.sizeCapacity.limits : undefined;\n\tif (isRecord(policy.sizeCapacity) && !Array.isArray(limits)) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-invalid-size-capacity\",\n\t\t\t\t\"Tool provider size-capacity limits must be an array.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef] },\n\t\t\t),\n\t\t);\n\t}\n\tfor (const [index, rawLimit] of (Array.isArray(limits) ? limits : []).entries()) {\n\t\tif (!isRecord(rawLimit)) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-invalid-size-limit\",\n\t\t\t\t\t\"Tool provider size-capacity limit must be a data object.\",\n\t\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { index } },\n\t\t\t\t),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tconst limit = rawLimit as Partial<ToolProviderSizeLimit>;\n\t\tif (typeof limit.unit !== \"string\" || limit.unit.length === 0) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-invalid-size-limit\",\n\t\t\t\t\t\"Tool provider size-capacity limit unit must be a non-empty string.\",\n\t\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { index } },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\tlimit.softLimit !== undefined &&\n\t\t\t(typeof limit.softLimit !== \"number\" ||\n\t\t\t\t!Number.isFinite(limit.softLimit) ||\n\t\t\t\tlimit.softLimit < 0)\n\t\t) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-invalid-size-limit\",\n\t\t\t\t\t\"Tool provider size-capacity softLimit must be a finite non-negative number.\",\n\t\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { index, unit: limit.unit } },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\tlimit.hardLimit !== undefined &&\n\t\t\t(typeof limit.hardLimit !== \"number\" ||\n\t\t\t\t!Number.isFinite(limit.hardLimit) ||\n\t\t\t\tlimit.hardLimit < 0)\n\t\t) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-invalid-size-limit\",\n\t\t\t\t\t\"Tool provider size-capacity hardLimit must be a finite non-negative number.\",\n\t\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { index, unit: limit.unit } },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tif (\n\t\t\ttypeof limit.softLimit === \"number\" &&\n\t\t\tNumber.isFinite(limit.softLimit) &&\n\t\t\ttypeof limit.hardLimit === \"number\" &&\n\t\t\tNumber.isFinite(limit.hardLimit) &&\n\t\t\tlimit.softLimit > limit.hardLimit\n\t\t) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-invalid-size-limit\",\n\t\t\t\t\t\"Tool provider size-capacity softLimit must not exceed hardLimit.\",\n\t\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { index, unit: limit.unit } },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\tif (policy.timeout !== undefined && !isRecord(policy.timeout)) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-invalid-timeout\",\n\t\t\t\t\"Tool provider timeout policy must be a data object.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef] },\n\t\t\t),\n\t\t);\n\t}\n\tfor (const [field, value] of Object.entries(isRecord(policy.timeout) ? policy.timeout : {})) {\n\t\tif (field.endsWith(\"TimeoutMs\") || field === \"timeoutMs\") {\n\t\t\tif (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n\t\t\t\tissues.push(\n\t\t\t\t\tdataIssue(\n\t\t\t\t\t\t\"tool-provider-policy-invalid-timeout\",\n\t\t\t\t\t\t\"Tool provider timeout values must be finite non-negative numbers.\",\n\t\t\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { field } },\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\tfor (const forbidden of [\n\t\t...forbiddenDataKeys(policy),\n\t\t...forbiddenProviderRawMaterialKeys(policy),\n\t]) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-policy-forbidden-runtime-material\",\n\t\t\t\t\"Tool provider policy must not contain runtime-private adapter material.\",\n\t\t\t\t{ subjectId: policyId, refs: [policyRef], details: { reason: forbidden.reason } },\n\t\t\t),\n\t\t);\n\t}\n\treturn Object.freeze(issues);\n}\n\nexport function resolveToolProviderExecutionPolicies(opts: {\n\treadonly request: AgentRequestIssued;\n\treadonly routes?: readonly ExecutorRoute[];\n\treadonly catalogs?: readonly ToolProviderCatalog[];\n}): readonly ToolProviderPolicyResolution[] {\n\tconst request = opts.request;\n\tconst toolCall = toolCallFromRequest(request);\n\tconst baseSourceRefs = Object.freeze([ref(\"agent-request\", request.requestId)]);\n\tif (toolCall === undefined) {\n\t\treturn Object.freeze([\n\t\t\tObject.freeze({\n\t\t\t\tkind: \"tool-provider-policy-resolution\",\n\t\t\t\tresolutionId: `${request.requestId}:${request.operationId}:tool-policy:missing-tool-call`,\n\t\t\t\tstatus: \"missing-tool-call\",\n\t\t\t\trequestId: request.requestId,\n\t\t\t\toperationId: request.operationId,\n\t\t\t\tissues: Object.freeze([\n\t\t\t\t\tdataIssue(\n\t\t\t\t\t\t\"tool-provider-policy-missing-tool-call\",\n\t\t\t\t\t\t\"Tool provider policy resolution requires AgentRequest input.value to be a ToolCallInput.\",\n\t\t\t\t\t\t{ subjectId: request.requestId, refs: baseSourceRefs },\n\t\t\t\t\t),\n\t\t\t\t]),\n\t\t\t\tsourceRefs: baseSourceRefs,\n\t\t\t} satisfies ToolProviderPolicyResolution),\n\t\t]);\n\t}\n\tconst routes = (opts.routes ?? []).filter(\n\t\t(route) => route.requestId === request.requestId && route.operationId === request.operationId,\n\t);\n\tif (routes.length === 0) {\n\t\treturn Object.freeze([\n\t\t\tObject.freeze({\n\t\t\t\tkind: \"tool-provider-policy-resolution\",\n\t\t\t\tresolutionId: `${request.requestId}:${request.operationId}:tool-policy:pending-route`,\n\t\t\t\tstatus: \"pending-route\",\n\t\t\t\trequestId: request.requestId,\n\t\t\t\toperationId: request.operationId,\n\t\t\t\ttoolName: toolCall.toolName,\n\t\t\t\toperation: toolCall.operation,\n\t\t\t\tsourceRefs: baseSourceRefs,\n\t\t\t} satisfies ToolProviderPolicyResolution),\n\t\t]);\n\t}\n\treturn Object.freeze(\n\t\troutes.map((route) =>\n\t\t\tObject.freeze(\n\t\t\t\tresolveToolProviderPolicyForRoute(request, route, toolCall, opts.catalogs ?? []),\n\t\t\t),\n\t\t),\n\t);\n}\n\nexport function toolProviderPolicyResolutionProjector(\n\tgraph: Graph,\n\topts: {\n\t\treadonly name?: string;\n\t\treadonly requestFacts: Node<AgentRequestFact>;\n\t\treadonly executorRoutes?: readonly Node<ExecutorRoute>[];\n\t\treadonly toolProviderCatalogs?: readonly Node<ToolProviderCatalog>[];\n\t},\n): ToolProviderPolicyResolutionBundle {\n\tconst name = opts.name ?? \"toolProviderPolicyResolution\";\n\tconst routeDeps = opts.executorRoutes ?? [];\n\tconst catalogDeps = opts.toolProviderCatalogs ?? [];\n\tconst routeStart = 1;\n\tconst catalogStart = routeStart + routeDeps.length;\n\tconst runtime = graph.node<ToolProviderPolicyResolutionFact>(\n\t\t[opts.requestFacts, ...routeDeps, ...catalogDeps],\n\t\t(ctx) => {\n\t\t\tconst state = ctx.state.get<ToolProviderPolicyResolutionState>() ?? {\n\t\t\t\trequests: new Map<string, AgentRequestIssued>(),\n\t\t\t\troutes: new Map<string, ExecutorRoute>(),\n\t\t\t\tcatalogs: new Map<string, ToolProviderCatalog>(),\n\t\t\t\temittedKeys: new Set<string>(),\n\t\t\t\tauditSeq: 0,\n\t\t\t};\n\t\t\tfor (const raw of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst fact = raw as AgentRequestFact;\n\t\t\t\tif (fact.kind === \"issued\" && fact.input?.inputKind === \"tool-call\") {\n\t\t\t\t\tstate.requests.set(fact.requestId, fact);\n\t\t\t\t}\n\t\t\t}\n\t\t\tforEachDepBatch(ctx, routeStart, routeDeps.length, (raw) => {\n\t\t\t\tconst route = raw as ExecutorRoute;\n\t\t\t\tstate.routes.set(route.routeId, route);\n\t\t\t});\n\t\t\tforEachDepBatch(ctx, catalogStart, catalogDeps.length, (raw) => {\n\t\t\t\tconst catalog = raw as ToolProviderCatalog;\n\t\t\t\tstate.catalogs.set(catalog.providerId, catalog);\n\t\t\t});\n\t\t\tfor (const request of state.requests.values()) {\n\t\t\t\tconst resolutions = resolveToolProviderExecutionPolicies({\n\t\t\t\t\trequest,\n\t\t\t\t\troutes: Array.from(state.routes.values()),\n\t\t\t\t\tcatalogs: Array.from(state.catalogs.values()),\n\t\t\t\t});\n\t\t\t\tfor (const resolution of resolutions) {\n\t\t\t\t\tconst key = stableToolProviderPolicyResolutionKey(resolution);\n\t\t\t\t\tif (state.emittedKeys.has(key)) continue;\n\t\t\t\t\tstate.emittedKeys.add(key);\n\t\t\t\t\tctx.down([\n\t\t\t\t\t\t[\"DATA\", { kind: \"resolution\", resolution } satisfies ToolProviderPolicyResolutionFact],\n\t\t\t\t\t]);\n\t\t\t\t\tfor (const issue of resolution.issues ?? []) {\n\t\t\t\t\t\tctx.down([\n\t\t\t\t\t\t\t[\"DATA\", { kind: \"issue\", issue } satisfies ToolProviderPolicyResolutionFact],\n\t\t\t\t\t\t]);\n\t\t\t\t\t}\n\t\t\t\t\tstate.auditSeq += 1;\n\t\t\t\t\tctx.down([\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"DATA\",\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tkind: \"audit\",\n\t\t\t\t\t\t\t\taudit: {\n\t\t\t\t\t\t\t\t\tid: `${name}:audit:${state.auditSeq}`,\n\t\t\t\t\t\t\t\t\tkind: \"tool-provider-policy-resolution\",\n\t\t\t\t\t\t\t\t\tsubjectId: request.requestId,\n\t\t\t\t\t\t\t\t\tsourceRefs: resolution.sourceRefs,\n\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\tstatus: resolution.status,\n\t\t\t\t\t\t\t\t\t\trouteId: resolution.routeId,\n\t\t\t\t\t\t\t\t\t\tproviderId: resolution.providerId,\n\t\t\t\t\t\t\t\t\t\tprofileId: resolution.profileId,\n\t\t\t\t\t\t\t\t\t\ttoolName: resolution.toolName,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} satisfies ToolProviderPolicyResolutionFact,\n\t\t\t\t\t\t],\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tctx.state.set(state);\n\t\t},\n\t\t{ name: `${name}/runtime`, factory: \"toolProviderPolicyResolutionProjector\", partial: true },\n\t);\n\tconst resolutions = projectRuntimeFact(\n\t\tgraph,\n\t\truntime,\n\t\t`${name}/resolutions`,\n\t\t\"toolProviderPolicyResolutions\",\n\t\t(fact) => (fact.kind === \"resolution\" ? fact.resolution : undefined),\n\t);\n\tconst issues = projectRuntimeFact(\n\t\tgraph,\n\t\truntime,\n\t\t`${name}/issues`,\n\t\t\"toolProviderPolicyResolutionIssues\",\n\t\t(fact) => (fact.kind === \"issue\" ? fact.issue : undefined),\n\t);\n\tconst audit = projectRuntimeFact(\n\t\tgraph,\n\t\truntime,\n\t\t`${name}/audit`,\n\t\t\"toolProviderPolicyResolutionAudit\",\n\t\t(fact) => (fact.kind === \"audit\" ? fact.audit : undefined),\n\t);\n\treturn { resolutions, issues, audit };\n}\n\nexport type ToolProviderPolicyResolutionFact =\n\t| { readonly kind: \"resolution\"; readonly resolution: ToolProviderPolicyResolution }\n\t| { readonly kind: \"issue\"; readonly issue: DataIssue }\n\t| { readonly kind: \"audit\"; readonly audit: AgentRuntimeAuditRecord };\n\nexport interface ToolProviderPolicyResolutionState {\n\trequests: Map<string, AgentRequestIssued>;\n\troutes: Map<string, ExecutorRoute>;\n\tcatalogs: Map<string, ToolProviderCatalog>;\n\temittedKeys: Set<string>;\n\tauditSeq: number;\n}\n\nexport function isPublishableToolProviderExecutionPolicy(\n\tpolicy: unknown,\n\tproviderId?: string,\n): policy is ToolProviderExecutionPolicy {\n\treturn (\n\t\tisRecord(policy) &&\n\t\tpolicy.kind === \"tool-provider-execution-policy\" &&\n\t\ttypeof policy.policyId === \"string\" &&\n\t\tpolicy.policyId.length > 0 &&\n\t\ttypeof policy.providerId === \"string\" &&\n\t\tpolicy.providerId.length > 0 &&\n\t\t(providerId === undefined || policy.providerId === providerId) &&\n\t\tvalidateToolProviderExecutionPolicy(policy).length === 0\n\t);\n}\n\nexport function validateToolProviderPolicyProviderScope(\n\tpolicy: unknown,\n\tproviderId: string,\n): readonly DataIssue[] {\n\tif (!isRecord(policy)) return [];\n\tif (policy.providerId === undefined || policy.providerId === providerId) return [];\n\treturn Object.freeze([\n\t\tdataIssue(\n\t\t\t\"tool-provider-policy-provider-mismatch\",\n\t\t\t\"Tool provider policy providerId must match the catalog providerId.\",\n\t\t\t{\n\t\t\t\tsubjectId: typeof policy.policyId === \"string\" ? policy.policyId : undefined,\n\t\t\t\trefs: [\n\t\t\t\t\tref(\n\t\t\t\t\t\t\"tool-provider-execution-policy\",\n\t\t\t\t\t\ttypeof policy.policyId === \"string\" && policy.policyId.length > 0\n\t\t\t\t\t\t\t? policy.policyId\n\t\t\t\t\t\t\t: \"<missing>\",\n\t\t\t\t\t),\n\t\t\t\t\tref(\"tool-provider-catalog\", providerId),\n\t\t\t\t],\n\t\t\t},\n\t\t),\n\t]);\n}\n\nexport function policyRefsForProfile(\n\tpolicies: readonly ToolProviderExecutionPolicy[],\n\tprofileId: string,\n): readonly SourceRef[] {\n\treturn Object.freeze(\n\t\tpolicies\n\t\t\t.filter((policy) => policyAppliesToProfile(policy, profileId))\n\t\t\t.map((policy) => ref(\"tool-provider-execution-policy\", policy.policyId)),\n\t);\n}\n\nexport function policyRefsForTool(\n\tpolicies: readonly ToolProviderExecutionPolicy[],\n\tprofileId: string,\n\ttool: Omit<\n\t\tToolProviderCatalogEntry,\n\t\t\"kind\" | \"providerId\" | \"inputKind\" | \"profileId\" | \"executorId\"\n\t>,\n): readonly SourceRef[] {\n\treturn Object.freeze(\n\t\tpolicies\n\t\t\t.filter((policy) => policyAppliesToProfile(policy, profileId))\n\t\t\t.filter((policy) => policyAppliesToOptionalScope(policy.toolNames, tool.toolName))\n\t\t\t.filter((policy) => policyAppliesToOptionalScope(policy.operations, tool.operation))\n\t\t\t.map((policy) => ref(\"tool-provider-execution-policy\", policy.policyId)),\n\t);\n}\n\nexport function policyAppliesToProfile(\n\tpolicy: ToolProviderExecutionPolicy,\n\tprofileId: string,\n): boolean {\n\treturn policyAppliesToOptionalScope(policy.profileIds, profileId);\n}\n\nexport function policyAppliesToOptionalScope(\n\tscope: readonly string[] | undefined,\n\tvalue: string | undefined,\n): boolean {\n\treturn (\n\t\tscope === undefined || scope.length === 0 || (value !== undefined && scope.includes(value))\n\t);\n}\n\nexport function toolCallFromRequest(request: AgentRequestIssued): ToolCallInput | undefined {\n\tconst value = request.input?.value;\n\tif (request.input?.inputKind !== \"tool-call\" || !isRecord(value)) return undefined;\n\tif (\n\t\tvalue.kind !== \"tool-call\" ||\n\t\ttypeof value.toolName !== \"string\" ||\n\t\tvalue.toolName.length === 0\n\t) {\n\t\treturn undefined;\n\t}\n\treturn value as unknown as ToolCallInput;\n}\n\nexport function resolveToolProviderPolicyForRoute(\n\trequest: AgentRequestIssued,\n\troute: ExecutorRoute,\n\ttoolCall: ToolCallInput,\n\tcatalogs: readonly ToolProviderCatalog[],\n): ToolProviderPolicyResolution {\n\tconst sourceRefs = Object.freeze([\n\t\tref(\"agent-request\", request.requestId),\n\t\tref(\"executor-route\", route.routeId),\n\t]);\n\tconst matchingCatalogs = catalogs.filter((catalog) => catalogHasRouteProfile(catalog, route));\n\tif (matchingCatalogs.length === 0) {\n\t\treturn policyResolutionWithIssue({\n\t\t\trequest,\n\t\t\troute,\n\t\t\ttoolCall,\n\t\t\tstatus: \"missing-catalog\",\n\t\t\tsourceRefs,\n\t\t\tissue: dataIssue(\n\t\t\t\t\"tool-provider-policy-missing-catalog\",\n\t\t\t\t`No tool provider catalog exposes route profile '${route.profileId}'.`,\n\t\t\t\t{ subjectId: request.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t});\n\t}\n\tif (matchingCatalogs.length > 1) {\n\t\treturn policyResolutionWithIssue({\n\t\t\trequest,\n\t\t\troute,\n\t\t\ttoolCall,\n\t\t\tstatus: \"ambiguous-catalog\",\n\t\t\tsourceRefs,\n\t\t\tissue: dataIssue(\n\t\t\t\t\"tool-provider-policy-ambiguous-catalog\",\n\t\t\t\t`Multiple tool provider catalogs expose route profile '${route.profileId}'.`,\n\t\t\t\t{\n\t\t\t\t\tsubjectId: request.requestId,\n\t\t\t\t\trefs: [\n\t\t\t\t\t\t...sourceRefs,\n\t\t\t\t\t\t...matchingCatalogs.map((catalog) => ref(\"tool-provider-catalog\", catalog.providerId)),\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t),\n\t\t});\n\t}\n\tconst catalog = matchingCatalogs[0];\n\tif (catalog === undefined) throw new Error(\"unreachable catalog match\");\n\tconst tool = catalog.tools.find(\n\t\t(entry) =>\n\t\t\tentry.profileId === route.profileId &&\n\t\t\tentry.executorId === route.executorId &&\n\t\t\tentry.toolName === toolCall.toolName &&\n\t\t\t(entry.operation === undefined ||\n\t\t\t\ttoolCall.operation === undefined ||\n\t\t\t\tentry.operation === toolCall.operation),\n\t);\n\tif (tool === undefined) {\n\t\treturn policyResolutionWithIssue({\n\t\t\trequest,\n\t\t\troute,\n\t\t\ttoolCall,\n\t\t\tstatus: \"missing-tool\",\n\t\t\tsourceRefs,\n\t\t\tproviderId: catalog.providerId,\n\t\t\tissue: dataIssue(\n\t\t\t\t\"tool-provider-policy-missing-tool\",\n\t\t\t\t`Tool provider catalog '${catalog.providerId}' does not expose requested tool '${toolCall.toolName}'.`,\n\t\t\t\t{\n\t\t\t\t\tsubjectId: request.requestId,\n\t\t\t\t\trefs: [...sourceRefs, ref(\"tool-provider-catalog\", catalog.providerId)],\n\t\t\t\t},\n\t\t\t),\n\t\t});\n\t}\n\tconst policyRefs = policyRefsForResolution(catalog, route, tool);\n\tif (policyRefs.length === 0) {\n\t\treturn policyResolutionWithIssue({\n\t\t\trequest,\n\t\t\troute,\n\t\t\ttoolCall,\n\t\t\tstatus: \"missing-policy\",\n\t\t\tsourceRefs,\n\t\t\tproviderId: catalog.providerId,\n\t\t\tissue: dataIssue(\n\t\t\t\t\"tool-provider-policy-missing-policy-ref\",\n\t\t\t\t`Tool '${tool.toolName}' has no D360 policy refs on its entry, profile, or catalog.`,\n\t\t\t\t{\n\t\t\t\t\tsubjectId: request.requestId,\n\t\t\t\t\trefs: [...sourceRefs, ref(\"tool-provider-catalog\", catalog.providerId)],\n\t\t\t\t},\n\t\t\t),\n\t\t});\n\t}\n\tconst issues = policyIssuesForRefs(catalog, policyRefs, request, sourceRefs);\n\tconst status = issues.length === 0 ? \"resolved\" : \"invalid-policy\";\n\treturn Object.freeze({\n\t\tkind: \"tool-provider-policy-resolution\",\n\t\tresolutionId: `${request.requestId}:${request.operationId}:${route.routeId}:tool-policy`,\n\t\tstatus,\n\t\trequestId: request.requestId,\n\t\toperationId: request.operationId,\n\t\trouteId: route.routeId,\n\t\tproviderId: catalog.providerId,\n\t\texecutorId: route.executorId,\n\t\tprofileId: route.profileId,\n\t\ttoolName: toolCall.toolName,\n\t\toperation: toolCall.operation,\n\t\tpolicyRefs,\n\t\tissues: issues.length === 0 ? undefined : Object.freeze(issues),\n\t\tsourceRefs: Object.freeze([...sourceRefs, ref(\"tool-provider-catalog\", catalog.providerId)]),\n\t} satisfies ToolProviderPolicyResolution);\n}\n\nexport function catalogHasRouteProfile(\n\tcatalog: ToolProviderCatalog,\n\troute: ExecutorRoute,\n): boolean {\n\treturn catalog.profiles.some(\n\t\t(profile) => profile.profileId === route.profileId && profile.executorId === route.executorId,\n\t);\n}\n\nexport function policyRefsForResolution(\n\tcatalog: ToolProviderCatalog,\n\troute: ExecutorRoute,\n\ttool: ToolProviderCatalogEntry,\n): readonly SourceRef[] {\n\tconst profile = catalog.profiles.find(\n\t\t(candidate) =>\n\t\t\tcandidate.profileId === route.profileId && candidate.executorId === route.executorId,\n\t);\n\treturn Object.freeze([\n\t\t...(tool.policyRefs ?? []),\n\t\t...((tool.policyRefs?.length ?? 0) === 0 ? (profile?.policyRefs ?? []) : []),\n\t\t...((tool.policyRefs?.length ?? 0) === 0 && (profile?.policyRefs?.length ?? 0) === 0\n\t\t\t? (catalog.policyRefs ?? [])\n\t\t\t: []),\n\t]);\n}\n\nexport function policyIssuesForRefs(\n\tcatalog: ToolProviderCatalog,\n\tpolicyRefs: readonly SourceRef[],\n\trequest: AgentRequestIssued,\n\tsourceRefs: readonly SourceRef[],\n): readonly DataIssue[] {\n\tconst policiesById = new Map((catalog.policies ?? []).map((policy) => [policy.policyId, policy]));\n\tconst issues: DataIssue[] = [];\n\tfor (const policyRef of policyRefs) {\n\t\tif (policyRef.kind !== \"tool-provider-execution-policy\") {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-invalid-ref-kind\",\n\t\t\t\t\t\"Tool provider policy refs must point at ToolProviderExecutionPolicy facts.\",\n\t\t\t\t\t{ subjectId: request.requestId, refs: [...sourceRefs, policyRef] },\n\t\t\t\t),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tconst policy = policiesById.get(policyRef.id);\n\t\tif (policy === undefined) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-policy-ref-missing-material\",\n\t\t\t\t\t`Tool provider policy ref '${policyRef.id}' has no policy material in catalog '${catalog.providerId}'.`,\n\t\t\t\t\t{ subjectId: request.requestId, refs: [...sourceRefs, policyRef] },\n\t\t\t\t),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tissues.push(...validateToolProviderExecutionPolicy(policy));\n\t\tissues.push(...validateToolProviderPolicyProviderScope(policy, catalog.providerId));\n\t}\n\treturn Object.freeze(issues);\n}\n\nexport function policyResolutionWithIssue(opts: {\n\treadonly request: AgentRequestIssued;\n\treadonly route: ExecutorRoute;\n\treadonly toolCall: ToolCallInput;\n\treadonly status: ToolProviderPolicyResolutionStatus;\n\treadonly sourceRefs: readonly SourceRef[];\n\treadonly issue: DataIssue;\n\treadonly providerId?: string;\n}): ToolProviderPolicyResolution {\n\treturn Object.freeze({\n\t\tkind: \"tool-provider-policy-resolution\",\n\t\tresolutionId: `${opts.request.requestId}:${opts.request.operationId}:${opts.route.routeId}:tool-policy:${opts.status}`,\n\t\tstatus: opts.status,\n\t\trequestId: opts.request.requestId,\n\t\toperationId: opts.request.operationId,\n\t\trouteId: opts.route.routeId,\n\t\tproviderId: opts.providerId,\n\t\texecutorId: opts.route.executorId,\n\t\tprofileId: opts.route.profileId,\n\t\ttoolName: opts.toolCall.toolName,\n\t\toperation: opts.toolCall.operation,\n\t\tissues: Object.freeze([opts.issue]),\n\t\tsourceRefs: opts.sourceRefs,\n\t} satisfies ToolProviderPolicyResolution);\n}\n\nexport function stableToolProviderPolicyResolutionKey(\n\tresolution: ToolProviderPolicyResolution,\n): string {\n\treturn JSON.stringify({\n\t\tid: resolution.resolutionId,\n\t\tstatus: resolution.status,\n\t\tpolicyRefs:\n\t\t\tresolution.policyRefs?.map((policyRef) => `${policyRef.kind}:${policyRef.id}`) ?? [],\n\t\tissues: resolution.issues?.map((issue) => issue.code) ?? [],\n\t});\n}\n\nexport function defaultLocalBuiltinToolProviderExecutionPolicy(opts: {\n\treadonly providerId: string;\n\treadonly profileId: string;\n\treadonly tools: readonly Omit<\n\t\tToolProviderCatalogEntry,\n\t\t\"kind\" | \"providerId\" | \"inputKind\" | \"profileId\" | \"executorId\"\n\t>[];\n\treadonly overrides?: Partial<\n\t\tOmit<ToolProviderExecutionPolicy, \"kind\" | \"policyId\" | \"providerId\">\n\t>;\n}): ToolProviderExecutionPolicy {\n\tconst toolNames = Object.freeze(Array.from(new Set(opts.tools.map((tool) => tool.toolName))));\n\tconst operations = Object.freeze(\n\t\tArray.from(new Set(opts.tools.map((tool) => tool.operation).filter((op) => op !== undefined))),\n\t);\n\tconst hasUrlFetch = toolNames.includes(\"url.fetch\");\n\tconst filesystemToolNames = toolNames.filter(\n\t\t(toolName) =>\n\t\t\ttoolName.startsWith(\"file.\") || toolName.startsWith(\"document/\") || toolName === \"bash.run\",\n\t);\n\tconst approvalToolNames = toolNames.filter(\n\t\t(toolName) => toolName === \"file.edit/apply-patch\" || toolName === \"bash.run\",\n\t);\n\tconst approvalOperations = operations.filter(\n\t\t(operation) => operation === \"edit\" || operation === \"run\",\n\t);\n\tconst policy = {\n\t\tkind: \"tool-provider-execution-policy\",\n\t\tpolicyId: `${opts.providerId}:policy:default`,\n\t\tproviderId: opts.providerId,\n\t\tprofileIds: Object.freeze([opts.profileId]),\n\t\ttoolNames,\n\t\toperations,\n\t\tsizeCapacity: Object.freeze({\n\t\t\tlimits: Object.freeze([\n\t\t\t\tObject.freeze({\n\t\t\t\t\tunit: \"chars\",\n\t\t\t\t\tsoftLimit: 16_384,\n\t\t\t\t\thardLimit: 65_536,\n\t\t\t\t\tperRequest: true,\n\t\t\t\t\tmeasurementSource: \"adapter-estimated\",\n\t\t\t\t} satisfies ToolProviderSizeLimit),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tunit: \"bytes\",\n\t\t\t\t\tsoftLimit: 1_048_576,\n\t\t\t\t\thardLimit: 8_388_608,\n\t\t\t\t\tperArtifact: true,\n\t\t\t\t\tmeasurementSource: \"adapter-measured\",\n\t\t\t\t} satisfies ToolProviderSizeLimit),\n\t\t\t\tObject.freeze({\n\t\t\t\t\tunit: \"lines\",\n\t\t\t\t\tsoftLimit: 2_000,\n\t\t\t\t\thardLimit: 10_000,\n\t\t\t\t\tperStream: true,\n\t\t\t\t\tmeasurementSource: \"adapter-measured\",\n\t\t\t\t} satisfies ToolProviderSizeLimit),\n\t\t\t]),\n\t\t} satisfies ToolProviderSizeCapacityPolicy),\n\t\ttimeout: Object.freeze({\n\t\t\ttimeoutMs: 30_000,\n\t\t\tidleTimeoutMs: 5_000,\n\t\t} satisfies ToolProviderTimeoutPolicy),\n\t\tredaction: Object.freeze({\n\t\t\tmode: \"summary\",\n\t\t\tsensitivity: Object.freeze([\"private-material\", \"auth-material\", \"personal-data\"]),\n\t\t\tsummaryMaxChars: 512,\n\t\t} satisfies ToolProviderRedactionPolicy),\n\t\t...(filesystemToolNames.length > 0\n\t\t\t? {\n\t\t\t\t\tfilesystem: Object.freeze({\n\t\t\t\t\t\tcwd: \".\",\n\t\t\t\t\t\tallowRead: true,\n\t\t\t\t\t\tallowWrite: false,\n\t\t\t\t\t\tfollowSymlinks: false,\n\t\t\t\t\t\tsourceRefs: Object.freeze(filesystemToolNames.map((toolName) => ref(\"tool\", toolName))),\n\t\t\t\t\t\tpathRules: Object.freeze([\n\t\t\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\t\t\teffect: \"allow\",\n\t\t\t\t\t\t\t\tpath: \".\",\n\t\t\t\t\t\t\t\toperation: \"read\",\n\t\t\t\t\t\t\t\treason: \"Default local builtin catalog is workspace-relative data material.\",\n\t\t\t\t\t\t\t} satisfies ToolProviderPathRule),\n\t\t\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\t\t\teffect: \"deny\",\n\t\t\t\t\t\t\t\tglob: \"**/.env*\",\n\t\t\t\t\t\t\t\treason: \"D360 policies keep private material outside catalog DATA.\",\n\t\t\t\t\t\t\t} satisfies ToolProviderPathRule),\n\t\t\t\t\t\t]),\n\t\t\t\t\t} satisfies ToolProviderFilesystemPolicy),\n\t\t\t\t}\n\t\t\t: {}),\n\t\t...(hasUrlFetch\n\t\t\t? {\n\t\t\t\t\tnetwork: Object.freeze({\n\t\t\t\t\t\tmode: \"custom\",\n\t\t\t\t\t\tprotocols: Object.freeze([\"https:\"]),\n\t\t\t\t\t\tallowedHosts: Object.freeze([\"*\"]),\n\t\t\t\t\t\tsourceRefs: Object.freeze([ref(\"tool\", \"url.fetch\")]),\n\t\t\t\t\t} satisfies ToolProviderNetworkPolicy),\n\t\t\t\t}\n\t\t\t: {}),\n\t\tapproval: Object.freeze({\n\t\t\tmode: approvalToolNames.length > 0 ? \"require\" : \"auto\",\n\t\t\t...(approvalToolNames.length > 0\n\t\t\t\t? { requiredForToolNames: Object.freeze(approvalToolNames) }\n\t\t\t\t: {}),\n\t\t\t...(approvalOperations.length > 0\n\t\t\t\t? { requiredForOperations: Object.freeze(approvalOperations) }\n\t\t\t\t: {}),\n\t\t} satisfies ToolProviderApprovalPolicy),\n\t\tartifacts: Object.freeze({\n\t\t\tdefaultDataMode: \"summary\",\n\t\t\tartifactKinds: Object.freeze([\n\t\t\t\t\"text\",\n\t\t\t\t\"markdown\",\n\t\t\t\t\"file\",\n\t\t\t\t\"stdout\",\n\t\t\t\t\"stderr\",\n\t\t\t\t\"tool-output\",\n\t\t\t\t\"provider-raw\",\n\t\t\t]),\n\t\t\tinlineLimits: Object.freeze([\n\t\t\t\tObject.freeze({\n\t\t\t\t\tunit: \"chars\",\n\t\t\t\t\thardLimit: 4_096,\n\t\t\t\t\tperArtifact: true,\n\t\t\t\t\tmeasurementSource: \"adapter-estimated\",\n\t\t\t\t} satisfies ToolProviderSizeLimit),\n\t\t\t]),\n\t\t\trequireDigest: false,\n\t\t} satisfies ToolProviderArtifactPolicy),\n\t\tsourceRefs: Object.freeze([ref(\"decision\", \"D360\"), ref(\"tool-provider\", opts.providerId)]),\n\t\tmetadata: Object.freeze({\n\t\t\tdescription: \"Default data-only policy material for local builtin tools.\",\n\t\t}),\n\t\t...unlockedToolProviderPolicyOverrides(opts.overrides),\n\t} satisfies ToolProviderExecutionPolicy;\n\treturn Object.freeze(policy);\n}\n","import { depBatch } from \"../ctx/types.js\";\nimport type { DataIssue } from \"../data/index.js\";\nimport type { Graph } from \"../graph/graph.js\";\nimport type { Node } from \"../node/node.js\";\nimport {\n\tdataIssue,\n\tforbiddenAdapterInputMaterialIssues,\n\tforEachDepBatch,\n\tprojectRuntimeFact,\n\tref,\n\tsanitizeAdapterInputIssue,\n\tsanitizeAdapterInputSourceRefs,\n\tstableJsonStringify,\n} from \"./agent-runtime-common.js\";\nimport {\n\ttoolCallFromRequest,\n\tvalidateToolProviderExecutionPolicy,\n\tvalidateToolProviderPolicyProviderScope,\n} from \"./agent-runtime-tool-provider-policy.js\";\nimport type { AgentRuntimeAuditRecord } from \"./agent-runtime-types-agent.js\";\nimport type {\n\tAgentRequestFact,\n\tAgentRequestInput,\n\tAgentRequestIssued,\n\tExecutorRoute,\n\tSourceRef,\n} from \"./agent-runtime-types-core.js\";\nimport type {\n\tToolCallInput,\n\tToolProviderAdapterInput,\n\tToolProviderAdapterInputBundle,\n\tToolProviderAdapterInputStatus,\n\tToolProviderCatalog,\n\tToolProviderCatalogEntry,\n\tToolProviderExecutionPolicy,\n\tToolProviderPolicyResolution,\n} from \"./agent-runtime-types-tool.js\";\n\nexport function buildToolProviderAdapterInputs(opts: {\n\treadonly requests: readonly AgentRequestIssued[];\n\treadonly routes?: readonly ExecutorRoute[];\n\treadonly catalogs?: readonly ToolProviderCatalog[];\n\treadonly resolutions: readonly ToolProviderPolicyResolution[];\n}): readonly ToolProviderAdapterInput[] {\n\tconst requestsById = new Map(opts.requests.map((request) => [request.requestId, request]));\n\tconst routesById = new Map((opts.routes ?? []).map((route) => [route.routeId, route]));\n\tconst catalogsById = new Map(\n\t\t(opts.catalogs ?? []).map((catalog) => [catalog.providerId, catalog]),\n\t);\n\treturn Object.freeze(\n\t\topts.resolutions.map((resolution) =>\n\t\t\tbuildToolProviderAdapterInput({\n\t\t\t\tresolution,\n\t\t\t\trequest: requestsById.get(resolution.requestId),\n\t\t\t\troute: resolution.routeId === undefined ? undefined : routesById.get(resolution.routeId),\n\t\t\t\tcatalog:\n\t\t\t\t\tresolution.providerId === undefined ? undefined : catalogsById.get(resolution.providerId),\n\t\t\t}),\n\t\t),\n\t);\n}\n\nexport function toolProviderAdapterInputProjector(\n\tgraph: Graph,\n\topts: {\n\t\treadonly name?: string;\n\t\treadonly requestFacts: Node<AgentRequestFact>;\n\t\treadonly executorRoutes?: readonly Node<ExecutorRoute>[];\n\t\treadonly toolProviderCatalogs?: readonly Node<ToolProviderCatalog>[];\n\t\treadonly policyResolutions: readonly Node<ToolProviderPolicyResolution>[];\n\t},\n): ToolProviderAdapterInputBundle {\n\tconst name = opts.name ?? \"toolProviderAdapterInput\";\n\tconst routeDeps = opts.executorRoutes ?? [];\n\tconst catalogDeps = opts.toolProviderCatalogs ?? [];\n\tconst routeStart = 1;\n\tconst catalogStart = routeStart + routeDeps.length;\n\tconst resolutionStart = catalogStart + catalogDeps.length;\n\tconst runtime = graph.node<ToolProviderAdapterInputFact>(\n\t\t[opts.requestFacts, ...routeDeps, ...catalogDeps, ...opts.policyResolutions],\n\t\t(ctx) => {\n\t\t\tconst state = ctx.state.get<ToolProviderAdapterInputState>() ?? {\n\t\t\t\trequests: new Map<string, AgentRequestIssued>(),\n\t\t\t\troutes: new Map<string, ExecutorRoute>(),\n\t\t\t\tcatalogs: new Map<string, ToolProviderCatalog>(),\n\t\t\t\tresolutions: new Map<string, ToolProviderPolicyResolution>(),\n\t\t\t\temittedKeys: new Set<string>(),\n\t\t\t\tauditSeq: 0,\n\t\t\t};\n\t\t\tfor (const raw of depBatch(ctx, 0) ?? []) {\n\t\t\t\tconst fact = raw as AgentRequestFact;\n\t\t\t\tif (fact.kind === \"issued\" && fact.input?.inputKind === \"tool-call\") {\n\t\t\t\t\tstate.requests.set(fact.requestId, fact);\n\t\t\t\t}\n\t\t\t}\n\t\t\tforEachDepBatch(ctx, routeStart, routeDeps.length, (raw) => {\n\t\t\t\tconst route = raw as ExecutorRoute;\n\t\t\t\tstate.routes.set(route.routeId, route);\n\t\t\t});\n\t\t\tforEachDepBatch(ctx, catalogStart, catalogDeps.length, (raw) => {\n\t\t\t\tconst catalog = raw as ToolProviderCatalog;\n\t\t\t\tstate.catalogs.set(catalog.providerId, catalog);\n\t\t\t});\n\t\t\tforEachDepBatch(ctx, resolutionStart, opts.policyResolutions.length, (raw) => {\n\t\t\t\tconst resolution = raw as ToolProviderPolicyResolution;\n\t\t\t\tstate.resolutions.set(resolution.resolutionId, resolution);\n\t\t\t});\n\t\t\tconst inputs = buildToolProviderAdapterInputs({\n\t\t\t\trequests: Array.from(state.requests.values()),\n\t\t\t\troutes: Array.from(state.routes.values()),\n\t\t\t\tcatalogs: Array.from(state.catalogs.values()),\n\t\t\t\tresolutions: Array.from(state.resolutions.values()),\n\t\t\t});\n\t\t\tfor (const input of inputs) {\n\t\t\t\tconst key = stableToolProviderAdapterInputKey(input);\n\t\t\t\tif (state.emittedKeys.has(key)) continue;\n\t\t\t\tstate.emittedKeys.add(key);\n\t\t\t\tctx.down([[\"DATA\", { kind: \"input\", input } satisfies ToolProviderAdapterInputFact]]);\n\t\t\t\tfor (const issue of input.issues ?? []) {\n\t\t\t\t\tctx.down([[\"DATA\", { kind: \"issue\", issue } satisfies ToolProviderAdapterInputFact]]);\n\t\t\t\t}\n\t\t\t\tstate.auditSeq += 1;\n\t\t\t\tctx.down([\n\t\t\t\t\t[\n\t\t\t\t\t\t\"DATA\",\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkind: \"audit\",\n\t\t\t\t\t\t\taudit: {\n\t\t\t\t\t\t\t\tid: `${name}:audit:${state.auditSeq}`,\n\t\t\t\t\t\t\t\tkind: \"tool-provider-adapter-input\",\n\t\t\t\t\t\t\t\tsubjectId: input.requestId,\n\t\t\t\t\t\t\t\tsourceRefs: input.sourceRefs,\n\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\tstatus: input.status,\n\t\t\t\t\t\t\t\t\trouteId: input.routeId,\n\t\t\t\t\t\t\t\t\tproviderId: input.providerId,\n\t\t\t\t\t\t\t\t\tprofileId: input.profileId,\n\t\t\t\t\t\t\t\t\ttoolName: input.toolName,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t} satisfies ToolProviderAdapterInputFact,\n\t\t\t\t\t],\n\t\t\t\t]);\n\t\t\t}\n\t\t\tctx.state.set(state);\n\t\t},\n\t\t{ name: `${name}/runtime`, factory: \"toolProviderAdapterInputProjector\", partial: true },\n\t);\n\tconst inputs = projectRuntimeFact(\n\t\tgraph,\n\t\truntime,\n\t\t`${name}/inputs`,\n\t\t\"toolProviderAdapterInputs\",\n\t\t(fact) => (fact.kind === \"input\" ? fact.input : undefined),\n\t);\n\tconst issues = projectRuntimeFact(\n\t\tgraph,\n\t\truntime,\n\t\t`${name}/issues`,\n\t\t\"toolProviderAdapterInputIssues\",\n\t\t(fact) => (fact.kind === \"issue\" ? fact.issue : undefined),\n\t);\n\tconst audit = projectRuntimeFact(\n\t\tgraph,\n\t\truntime,\n\t\t`${name}/audit`,\n\t\t\"toolProviderAdapterInputAudit\",\n\t\t(fact) => (fact.kind === \"audit\" ? fact.audit : undefined),\n\t);\n\treturn { inputs, issues, audit };\n}\n\nexport type ToolProviderAdapterInputFact =\n\t| { readonly kind: \"input\"; readonly input: ToolProviderAdapterInput }\n\t| { readonly kind: \"issue\"; readonly issue: DataIssue }\n\t| { readonly kind: \"audit\"; readonly audit: AgentRuntimeAuditRecord };\n\nexport interface ToolProviderAdapterInputState {\n\trequests: Map<string, AgentRequestIssued>;\n\troutes: Map<string, ExecutorRoute>;\n\tcatalogs: Map<string, ToolProviderCatalog>;\n\tresolutions: Map<string, ToolProviderPolicyResolution>;\n\temittedKeys: Set<string>;\n\tauditSeq: number;\n}\n\nexport function buildToolProviderAdapterInput(opts: {\n\treadonly resolution: ToolProviderPolicyResolution;\n\treadonly request?: AgentRequestIssued;\n\treadonly route?: ExecutorRoute;\n\treadonly catalog?: ToolProviderCatalog;\n}): ToolProviderAdapterInput {\n\tconst { resolution, request, route, catalog } = opts;\n\tconst sourceRefs = sanitizeAdapterInputSourceRefs([\n\t\tref(\"tool-provider-policy-resolution\", resolution.resolutionId),\n\t\t...(resolution.sourceRefs ?? []),\n\t\t...(resolution.routeId === undefined ? [] : [ref(\"executor-route\", resolution.routeId)]),\n\t\t...(resolution.providerId === undefined\n\t\t\t? []\n\t\t\t: [ref(\"tool-provider-catalog\", resolution.providerId)]),\n\t\t...(resolution.policyRefs ?? []),\n\t]);\n\tconst issues: DataIssue[] = (resolution.issues ?? []).map((issue) =>\n\t\tsanitizeAdapterInputIssue(issue),\n\t);\n\tlet statusOverride: Exclude<ToolProviderAdapterInputStatus, \"ready\"> | undefined;\n\tif (request === undefined) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-missing-request\",\n\t\t\t\t\"Tool provider adapter input requires the issued AgentRequest fact.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tif (request !== undefined && request.requestId !== resolution.requestId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-request\",\n\t\t\t\t\"Tool provider adapter input request identity does not match its policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tif (request !== undefined && request.operationId !== resolution.operationId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-request-operation\",\n\t\t\t\t\"Tool provider adapter input request operationId does not match its policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tif (resolution.routeId !== undefined && route === undefined) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-missing-route\",\n\t\t\t\t\"Tool provider adapter input requires the selected ExecutorRoute fact.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tif (route !== undefined) {\n\t\tissues.push(...routeIdentityIssuesForAdapterInput(route, resolution, request, sourceRefs));\n\t}\n\tif (resolution.providerId !== undefined && catalog === undefined) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-missing-catalog\",\n\t\t\t\t\"Tool provider adapter input requires the selected ToolProviderCatalog fact.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tif (catalog !== undefined && catalog.status !== undefined && catalog.status !== \"ready\") {\n\t\tstatusOverride = \"invalid-policy\";\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-catalog-unavailable\",\n\t\t\t\t\"Tool provider adapter input requires a ready ToolProviderCatalog.\",\n\t\t\t\t{\n\t\t\t\t\tsubjectId: resolution.requestId,\n\t\t\t\t\trefs: [...sourceRefs, ref(\"tool-provider-catalog\", catalog.providerId)],\n\t\t\t\t\tdetails: { status: catalog.status },\n\t\t\t\t},\n\t\t\t),\n\t\t);\n\t\tissues.push(...(catalog.issues ?? []).map((issue) => sanitizeAdapterInputIssue(issue)));\n\t}\n\tconst toolCall = request === undefined ? undefined : toolCallFromRequest(request);\n\tif (request !== undefined && toolCall === undefined) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-missing-tool-call\",\n\t\t\t\t\"Tool provider adapter input requires AgentRequest input.value to be a ToolCallInput.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tconst tool =\n\t\tcatalog === undefined || route === undefined || toolCall === undefined\n\t\t\t? undefined\n\t\t\t: selectedToolForAdapterInput(catalog, route, toolCall);\n\tif (resolution.status === \"resolved\" && tool === undefined) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-missing-tool\",\n\t\t\t\t\"Tool provider adapter input requires the selected catalog tool entry.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tconst policies =\n\t\tcatalog === undefined\n\t\t\t? []\n\t\t\t: selectedPoliciesForAdapterInput(catalog, resolution.policyRefs ?? []);\n\tif (resolution.status === \"resolved\" && (resolution.policyRefs?.length ?? 0) === 0) {\n\t\tstatusOverride = \"missing-policy\";\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-missing-policy-ref\",\n\t\t\t\t\"Ready tool provider adapter input requires at least one D360 policy ref.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs: sourceRefs },\n\t\t\t),\n\t\t);\n\t}\n\tif (catalog !== undefined) {\n\t\tfor (const issue of policyMaterialIssuesForAdapterInput(catalog, resolution, sourceRefs)) {\n\t\t\tstatusOverride ??= \"invalid-policy\";\n\t\t\tissues.push(issue);\n\t\t}\n\t}\n\tfor (const policy of policies) {\n\t\tissues.push(...validateToolProviderExecutionPolicy(policy));\n\t\tif (catalog !== undefined)\n\t\t\tissues.push(...validateToolProviderPolicyProviderScope(policy, catalog.providerId));\n\t}\n\tif (request?.input !== undefined) {\n\t\tissues.push(\n\t\t\t...forbiddenAdapterInputMaterialIssues(\n\t\t\t\trequest.input,\n\t\t\t\tref(\"agent-request\", request.requestId),\n\t\t\t\t\"request-input\",\n\t\t\t),\n\t\t);\n\t}\n\tif (route !== undefined) {\n\t\tissues.push(\n\t\t\t...forbiddenAdapterInputMaterialIssues(\n\t\t\t\troute.allowedParams,\n\t\t\t\tref(\"executor-route\", route.routeId),\n\t\t\t\t\"route-allowed-params\",\n\t\t\t),\n\t\t\t...forbiddenAdapterInputMaterialIssues(\n\t\t\t\troute.metadata,\n\t\t\t\tref(\"executor-route\", route.routeId),\n\t\t\t\t\"route-metadata\",\n\t\t\t),\n\t\t);\n\t}\n\tif (tool !== undefined) {\n\t\tconst toolRef = ref(\"tool\", tool.toolName);\n\t\tissues.push(\n\t\t\t...forbiddenAdapterInputMaterialIssues(tool.capabilities, toolRef, \"tool-capabilities\"),\n\t\t\t...forbiddenAdapterInputMaterialIssues(tool.limits, toolRef, \"tool-limits\"),\n\t\t\t...forbiddenAdapterInputMaterialIssues(tool.metadata, toolRef, \"tool-metadata\"),\n\t\t);\n\t}\n\tfor (const policy of policies) {\n\t\tissues.push(\n\t\t\t...forbiddenAdapterInputMaterialIssues(\n\t\t\t\tpolicy,\n\t\t\t\tref(\"tool-provider-execution-policy\", policy.policyId),\n\t\t\t\t\"policy-material\",\n\t\t\t),\n\t\t);\n\t}\n\tconst status =\n\t\tresolution.status === \"resolved\"\n\t\t\t? issues.length === 0\n\t\t\t\t? \"ready\"\n\t\t\t\t: (statusOverride ?? \"invalid-policy\")\n\t\t\t: resolution.status;\n\tconst ready = status === \"ready\";\n\tconst candidate = {\n\t\tkind: \"tool-provider-adapter-input\",\n\t\tadapterInputId: `${resolution.requestId}:${resolution.operationId}:${resolution.routeId ?? resolution.resolutionId}:adapter-input`,\n\t\tstatus,\n\t\trequestId: resolution.requestId,\n\t\toperationId: resolution.operationId,\n\t\teffectRunId: request?.effectRunId,\n\t\tagentRunId: request?.agentRunId,\n\t\trouteId: resolution.routeId,\n\t\tproviderId: resolution.providerId,\n\t\texecutorId: resolution.executorId,\n\t\tprofileId: resolution.profileId,\n\t\ttoolName: resolution.toolName,\n\t\toperation: resolution.operation,\n\t\tinput: ready ? (request?.input as AgentRequestInput<ToolCallInput> | undefined) : undefined,\n\t\ttoolCall: ready ? toolCall : undefined,\n\t\troute: ready ? route : undefined,\n\t\ttool: ready ? tool : undefined,\n\t\tpolicies: ready ? Object.freeze(policies) : undefined,\n\t\tpolicyRefs: sanitizeAdapterInputSourceRefs(resolution.policyRefs ?? []),\n\t\tsourceRefs,\n\t\tissues: issues.length === 0 ? undefined : Object.freeze(issues),\n\t\tmetadata: { resolutionId: resolution.resolutionId },\n\t} satisfies ToolProviderAdapterInput;\n\tif (ready) {\n\t\tconst candidateIssues = forbiddenAdapterInputMaterialIssues(\n\t\t\tcandidate,\n\t\t\tref(\"tool-provider-adapter-input\", candidate.adapterInputId),\n\t\t\t\"adapter-input\",\n\t\t);\n\t\tif (candidateIssues.length > 0) {\n\t\t\tconst blockedIssues = Object.freeze([...issues, ...candidateIssues]);\n\t\t\treturn Object.freeze({\n\t\t\t\t...candidate,\n\t\t\t\tstatus: \"invalid-policy\",\n\t\t\t\tinput: undefined,\n\t\t\t\ttoolCall: undefined,\n\t\t\t\troute: undefined,\n\t\t\t\ttool: undefined,\n\t\t\t\tpolicies: undefined,\n\t\t\t\tissues: blockedIssues,\n\t\t\t} satisfies ToolProviderAdapterInput);\n\t\t}\n\t}\n\treturn Object.freeze(candidate);\n}\n\nexport function selectedToolForAdapterInput(\n\tcatalog: ToolProviderCatalog,\n\troute: ExecutorRoute,\n\ttoolCall: ToolCallInput,\n): ToolProviderCatalogEntry | undefined {\n\treturn catalog.tools.find(\n\t\t(entry) =>\n\t\t\tentry.profileId === route.profileId &&\n\t\t\tentry.executorId === route.executorId &&\n\t\t\tentry.toolName === toolCall.toolName &&\n\t\t\t(entry.operation === undefined ||\n\t\t\t\ttoolCall.operation === undefined ||\n\t\t\t\tentry.operation === toolCall.operation),\n\t);\n}\n\nexport function selectedPoliciesForAdapterInput(\n\tcatalog: ToolProviderCatalog,\n\tpolicyRefs: readonly SourceRef[],\n): ToolProviderExecutionPolicy[] {\n\tconst policiesById = new Map((catalog.policies ?? []).map((policy) => [policy.policyId, policy]));\n\tconst policies: ToolProviderExecutionPolicy[] = [];\n\tfor (const policyRef of policyRefs) {\n\t\tif (policyRef.kind !== \"tool-provider-execution-policy\") continue;\n\t\tconst policy = policiesById.get(policyRef.id);\n\t\tif (policy !== undefined) policies.push(policy);\n\t}\n\treturn policies;\n}\n\nexport function routeIdentityIssuesForAdapterInput(\n\troute: ExecutorRoute,\n\tresolution: ToolProviderPolicyResolution,\n\trequest: AgentRequestIssued | undefined,\n\tsourceRefs: readonly SourceRef[],\n): readonly DataIssue[] {\n\tconst issues: DataIssue[] = [];\n\tconst refs = [...sourceRefs, ref(\"executor-route\", route.routeId)];\n\tif (route.requestId !== resolution.requestId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-request\",\n\t\t\t\t\"ExecutorRoute requestId does not match the tool provider policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (route.operationId !== resolution.operationId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-operation\",\n\t\t\t\t\"ExecutorRoute operationId does not match the tool provider policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (resolution.routeId !== undefined && route.routeId !== resolution.routeId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-id\",\n\t\t\t\t\"ExecutorRoute routeId does not match the tool provider policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (resolution.executorId !== undefined && route.executorId !== resolution.executorId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-executor\",\n\t\t\t\t\"ExecutorRoute executorId does not match the tool provider policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (resolution.profileId !== undefined && route.profileId !== resolution.profileId) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-profile\",\n\t\t\t\t\"ExecutorRoute profileId does not match the tool provider policy resolution.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (\n\t\trequest !== undefined &&\n\t\troute.inputId !== undefined &&\n\t\troute.inputId !== request.input?.inputId\n\t) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-input\",\n\t\t\t\t\"ExecutorRoute inputId does not match the issued AgentRequest input.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (route.inputKind !== undefined && route.inputKind !== \"tool-call\") {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-invalid-route-input-kind\",\n\t\t\t\t\"Tool provider adapter input requires ExecutorRoute.inputKind to be tool-call when present.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\tif (\n\t\trequest !== undefined &&\n\t\troute.inputKind !== undefined &&\n\t\trequest.input?.inputKind !== undefined &&\n\t\troute.inputKind !== request.input.inputKind\n\t) {\n\t\tissues.push(\n\t\t\tdataIssue(\n\t\t\t\t\"tool-provider-adapter-input-stale-route-input-kind\",\n\t\t\t\t\"ExecutorRoute inputKind does not match the issued AgentRequest input.\",\n\t\t\t\t{ subjectId: resolution.requestId, refs },\n\t\t\t),\n\t\t);\n\t}\n\treturn Object.freeze(issues);\n}\n\nexport function policyMaterialIssuesForAdapterInput(\n\tcatalog: ToolProviderCatalog,\n\tresolution: ToolProviderPolicyResolution,\n\tsourceRefs: readonly SourceRef[],\n): readonly DataIssue[] {\n\tconst policiesById = new Map((catalog.policies ?? []).map((policy) => [policy.policyId, policy]));\n\tconst issues: DataIssue[] = [];\n\tfor (const policyRef of resolution.policyRefs ?? []) {\n\t\tif (policyRef.kind !== \"tool-provider-execution-policy\") {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-adapter-input-invalid-policy-ref-kind\",\n\t\t\t\t\t\"Tool provider adapter input policy refs must point at ToolProviderExecutionPolicy facts.\",\n\t\t\t\t\t{ subjectId: resolution.requestId, refs: [...sourceRefs, policyRef] },\n\t\t\t\t),\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\t\tif (!policiesById.has(policyRef.id)) {\n\t\t\tissues.push(\n\t\t\t\tdataIssue(\n\t\t\t\t\t\"tool-provider-adapter-input-policy-ref-missing-material\",\n\t\t\t\t\t\"Tool provider adapter input policy ref has no selected policy material.\",\n\t\t\t\t\t{ subjectId: resolution.requestId, refs: [...sourceRefs, policyRef] },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\treturn Object.freeze(issues);\n}\n\nexport function stableToolProviderAdapterInputKey(input: ToolProviderAdapterInput): string {\n\treturn stableJsonStringify({\n\t\tid: input.adapterInputId,\n\t\tstatus: input.status,\n\t\tpolicyRefs: input.policyRefs?.map((policyRef) => `${policyRef.kind}:${policyRef.id}`) ?? [],\n\t\tissues: input.issues?.map((issue) => issue.code) ?? [],\n\t\tinput,\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBO,SAAS,6BACf,OACA,MAK4B;AAC5B,QAAM,OAAO,KAAK,QAAQ;AAC1B,QAAM,SAAS;AAAA,IACd,UAAU,KAAK,QAAQ,YAAY;AAAA,IACnC,iBAAiB,KAAK,QAAQ,mBAAmB;AAAA,IACjD,eAAe,KAAK,QAAQ,iBAAiB;AAAA,IAC7C,cAAc,KAAK,QAAQ,gBAAgB;AAAA,IAC3C,iBAAiB,KAAK,QAAQ,mBAAmB;AAAA,EAClD;AACA,QAAM,UAAU,MAAM;AAAA,IACrB,CAAC,KAAK,QAAQ;AAAA,IACd,CAAC,QAAQ;AACR,iBAAW,OA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OAAO,MAAM;AAC5B;AAEO,SAAS,oCACf,SACA,YACA,YACuB;AACvB,QAAM,eAAe,IAAI,KAAK,QAAQ,YAAY,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,UAAU,MAAM,CAAC,CAAC;AAChG,QAAM,SAAsB,CAAC;AAC7B,aAAW,aAAa,WAAW,cAAc,CAAC,GAAG;AACpD,QAAI,UAAU,SAAS,kCAAkC;AACxD,aAAO;AAAA,QACN;AAAA,UACC;AAAA,UACA;AAAA,UACA,EAAE,WAAW,WAAW,WAAW,MAAM,CAAC,GAAG,YAAY,SAAS,EAAE;AAAA,QACrE;AAAA,MACD;AACA;AAAA,IACD;AACA,QAAI,CAAC,aAAa,IAAI,UAAU,EAAE,GAAG;AACpC,aAAO;AAAA,QACN;AAAA,UACC;AAAA,UACA;AAAA,UACA,EAAE,WAAW,WAAW,WAAW,MAAM,CAAC,GAAG,YAAY,SAAS,EAAE;AAAA,QACrE;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACA,SAAO,OAAO,OAAO,MAAM;AAC5B;AAEO,SAAS,kCAAkC,OAAyC;AAC1F,SAAO,oBAAoB;AAAA,IAC1B,IAAI,MAAM;AAAA,IACV,QAAQ,MAAM;AAAA,IACd,YAAY,MAAM,YAAY,IAAI,CAAC,cAAc,GAAG,UAAU,IAAI,IAAI,UAAU,EAAE,EAAE,KAAK,CAAC;AAAA,IAC1F,QAAQ,MAAM,QAAQ,IAAI,CAAC,UAAU,MAAM,IAAI,KAAK,CAAC;AAAA,IACrD;AAAA,EACD,CAAC;AACF;","names":["resolutions","catalog","inputs"]}
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
checkpointValue,
|
|
6
6
|
initNodeWithCore,
|
|
7
7
|
toCheckpointJson
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-54WPEODM.js";
|
|
9
9
|
import {
|
|
10
10
|
EnvironmentDrivers,
|
|
11
11
|
Node,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
subscriberCountOfNode,
|
|
24
24
|
withEnvironmentDrivers,
|
|
25
25
|
withNodeCore
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GXU6WFEJ.js";
|
|
27
27
|
import {
|
|
28
28
|
depCount,
|
|
29
29
|
depLatest
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
assertStrictJsonObject,
|
|
38
38
|
stableJsonString,
|
|
39
39
|
strictCanonicalJsonBytes
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-K7FB3JTD.js";
|
|
41
41
|
|
|
42
42
|
// src/graph/blueprint.ts
|
|
43
43
|
var GRAPH_BLUEPRINT_VERSION = "graphrefly.blueprint.v1";
|
|
@@ -313,28 +313,110 @@ function cloneTopologyValue(value, seen) {
|
|
|
313
313
|
return out;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
// src/graph/graph.ts
|
|
316
|
+
// src/graph/graph-lifecycle.ts
|
|
317
317
|
var restoreRegistrars = /* @__PURE__ */ new WeakMap();
|
|
318
318
|
var lifecycleRegistrars = /* @__PURE__ */ new WeakMap();
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
|
|
320
|
+
// src/graph/graph-support.ts
|
|
321
|
+
function isNonAuthoritativeCollectionHelperMeta(meta) {
|
|
322
|
+
return meta?.kind === "collection_delta" || meta?.kind === "collection_intent" || meta?.kind === "collection_policy_apply" || meta?.kind === "collection_snapshot" || meta?.kind === "collection_snapshot_prep";
|
|
321
323
|
}
|
|
322
|
-
function
|
|
323
|
-
if (
|
|
324
|
-
throw new Error(`${label} has been released from its graph lifecycle (D122)`);
|
|
325
|
-
}
|
|
326
|
-
const existing = nodeOwner(n);
|
|
327
|
-
if (existing !== void 0 && existing !== owner) {
|
|
324
|
+
function assertCheckpointQuiescentStatus(status, id, op) {
|
|
325
|
+
if (status === "pending" || status === "dirty") {
|
|
328
326
|
throw new Error(
|
|
329
|
-
`${
|
|
327
|
+
`${op}: node '${id}' has non-quiescent status '${status}' that cannot be checkpoint-restored yet`
|
|
330
328
|
);
|
|
331
329
|
}
|
|
332
330
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
331
|
+
function topologyPathMatches(eventPath, path) {
|
|
332
|
+
return eventPath === path || eventPath.startsWith(`${path}::`);
|
|
333
|
+
}
|
|
334
|
+
function prefixTopologyPath(prefix, path) {
|
|
335
|
+
return `${prefix}::${path}`;
|
|
336
|
+
}
|
|
337
|
+
function cloneTopologyEvent(event) {
|
|
338
|
+
const deps = Object.freeze([...event.deps]);
|
|
339
|
+
const prevDeps = event.prevDeps === void 0 ? void 0 : Object.freeze([...event.prevDeps]);
|
|
340
|
+
return Object.freeze({
|
|
341
|
+
kind: event.kind,
|
|
342
|
+
path: event.path,
|
|
343
|
+
deps,
|
|
344
|
+
...prevDeps !== void 0 ? { prevDeps } : {},
|
|
345
|
+
...event.factory !== void 0 ? { factory: event.factory } : {},
|
|
346
|
+
seq: event.seq
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function checkpointFactory(name, node, unregistered, restore, meta) {
|
|
350
|
+
const state = checkpointStateOfNode(node);
|
|
351
|
+
if (unregistered) {
|
|
352
|
+
return {
|
|
353
|
+
kind: "local-only",
|
|
354
|
+
name,
|
|
355
|
+
reason: "node is an unregistered live dependency auto-discovered from topology"
|
|
356
|
+
};
|
|
336
357
|
}
|
|
337
|
-
|
|
358
|
+
if (restore === void 0 && typeof meta?.kind === "string" && meta.kind.startsWith("collection_")) {
|
|
359
|
+
return {
|
|
360
|
+
kind: "local-only",
|
|
361
|
+
name,
|
|
362
|
+
reason: "collection helper node has no backend checkpoint restore metadata"
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
if (restore !== void 0) {
|
|
366
|
+
const out = {
|
|
367
|
+
kind: "registry-ref",
|
|
368
|
+
ref: toCheckpointJson(restore.ref, `${name}.factory.ref`)
|
|
369
|
+
};
|
|
370
|
+
if (restore.config !== void 0)
|
|
371
|
+
out.config = toCheckpointJson(restore.config, `${name}.factory.config`);
|
|
372
|
+
if (restore.configVersion !== void 0)
|
|
373
|
+
out.configVersion = toCheckpointJson(restore.configVersion, `${name}.factory.configVersion`);
|
|
374
|
+
return out;
|
|
375
|
+
}
|
|
376
|
+
if (state.handle !== null) {
|
|
377
|
+
return {
|
|
378
|
+
kind: "local-only",
|
|
379
|
+
name,
|
|
380
|
+
reason: "node uses a function body; first-cut checkpoints do not serialize local functions"
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
return { kind: "registry-ref", ref: name };
|
|
384
|
+
}
|
|
385
|
+
function explainSubset(snap, chain) {
|
|
386
|
+
const fwd = /* @__PURE__ */ new Map();
|
|
387
|
+
const rev = /* @__PURE__ */ new Map();
|
|
388
|
+
const push = (map, k, v) => {
|
|
389
|
+
const a = map.get(k);
|
|
390
|
+
if (a) a.push(v);
|
|
391
|
+
else map.set(k, [v]);
|
|
392
|
+
};
|
|
393
|
+
for (const e of snap.edges) {
|
|
394
|
+
push(fwd, e.from, e.to);
|
|
395
|
+
push(rev, e.to, e.from);
|
|
396
|
+
}
|
|
397
|
+
const reach = (start, adj) => {
|
|
398
|
+
const seen = /* @__PURE__ */ new Set([start]);
|
|
399
|
+
const stack = [start];
|
|
400
|
+
while (stack.length > 0) {
|
|
401
|
+
const cur = stack.pop();
|
|
402
|
+
for (const nxt of adj.get(cur) ?? []) {
|
|
403
|
+
if (!seen.has(nxt)) {
|
|
404
|
+
seen.add(nxt);
|
|
405
|
+
stack.push(nxt);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return seen;
|
|
410
|
+
};
|
|
411
|
+
const onPath = new Set([...reach(chain.from, fwd)].filter((id) => reach(chain.to, rev).has(id)));
|
|
412
|
+
return {
|
|
413
|
+
...snap.name !== void 0 ? { name: snap.name } : {},
|
|
414
|
+
nodes: snap.nodes.filter((n) => onPath.has(n.id)),
|
|
415
|
+
edges: snap.edges.filter((e) => onPath.has(e.from) && onPath.has(e.to))
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/graph/graph-topology-group.ts
|
|
338
420
|
var GraphTopologyGroup = class {
|
|
339
421
|
name;
|
|
340
422
|
_graph;
|
|
@@ -395,6 +477,27 @@ var GraphTopologyGroup = class {
|
|
|
395
477
|
}
|
|
396
478
|
}
|
|
397
479
|
};
|
|
480
|
+
|
|
481
|
+
// src/graph/graph.ts
|
|
482
|
+
function nodeOwner(n) {
|
|
483
|
+
return getNodeOwner(n);
|
|
484
|
+
}
|
|
485
|
+
function assertGraphLocalNode(owner, n, label) {
|
|
486
|
+
if (isNodeRuntimeReleased(n)) {
|
|
487
|
+
throw new Error(`${label} has been released from its graph lifecycle (D122)`);
|
|
488
|
+
}
|
|
489
|
+
const existing = nodeOwner(n);
|
|
490
|
+
if (existing !== void 0 && existing !== owner) {
|
|
491
|
+
throw new Error(
|
|
492
|
+
`${label} belongs to a different graph; cross-graph deps require a wire bridge`
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
var StateNode = class extends Node {
|
|
497
|
+
set(v) {
|
|
498
|
+
this.down([["DATA", v]]);
|
|
499
|
+
}
|
|
500
|
+
};
|
|
398
501
|
var Graph = class {
|
|
399
502
|
name;
|
|
400
503
|
_dispatcher;
|
|
@@ -1060,103 +1163,6 @@ var Graph = class {
|
|
|
1060
1163
|
return out;
|
|
1061
1164
|
}
|
|
1062
1165
|
};
|
|
1063
|
-
function isNonAuthoritativeCollectionHelperMeta(meta) {
|
|
1064
|
-
return meta?.kind === "collection_delta" || meta?.kind === "collection_intent" || meta?.kind === "collection_policy_apply" || meta?.kind === "collection_snapshot" || meta?.kind === "collection_snapshot_prep";
|
|
1065
|
-
}
|
|
1066
|
-
function assertCheckpointQuiescentStatus(status, id, op) {
|
|
1067
|
-
if (status === "pending" || status === "dirty") {
|
|
1068
|
-
throw new Error(
|
|
1069
|
-
`${op}: node '${id}' has non-quiescent status '${status}' that cannot be checkpoint-restored yet`
|
|
1070
|
-
);
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
function topologyPathMatches(eventPath, path) {
|
|
1074
|
-
return eventPath === path || eventPath.startsWith(`${path}::`);
|
|
1075
|
-
}
|
|
1076
|
-
function prefixTopologyPath(prefix, path) {
|
|
1077
|
-
return `${prefix}::${path}`;
|
|
1078
|
-
}
|
|
1079
|
-
function cloneTopologyEvent(event) {
|
|
1080
|
-
const deps = Object.freeze([...event.deps]);
|
|
1081
|
-
const prevDeps = event.prevDeps === void 0 ? void 0 : Object.freeze([...event.prevDeps]);
|
|
1082
|
-
return Object.freeze({
|
|
1083
|
-
kind: event.kind,
|
|
1084
|
-
path: event.path,
|
|
1085
|
-
deps,
|
|
1086
|
-
...prevDeps !== void 0 ? { prevDeps } : {},
|
|
1087
|
-
...event.factory !== void 0 ? { factory: event.factory } : {},
|
|
1088
|
-
seq: event.seq
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
function checkpointFactory(name, node, unregistered, restore, meta) {
|
|
1092
|
-
const state = checkpointStateOfNode(node);
|
|
1093
|
-
if (unregistered) {
|
|
1094
|
-
return {
|
|
1095
|
-
kind: "local-only",
|
|
1096
|
-
name,
|
|
1097
|
-
reason: "node is an unregistered live dependency auto-discovered from topology"
|
|
1098
|
-
};
|
|
1099
|
-
}
|
|
1100
|
-
if (restore === void 0 && typeof meta?.kind === "string" && meta.kind.startsWith("collection_")) {
|
|
1101
|
-
return {
|
|
1102
|
-
kind: "local-only",
|
|
1103
|
-
name,
|
|
1104
|
-
reason: "collection helper node has no backend checkpoint restore metadata"
|
|
1105
|
-
};
|
|
1106
|
-
}
|
|
1107
|
-
if (restore !== void 0) {
|
|
1108
|
-
const out = {
|
|
1109
|
-
kind: "registry-ref",
|
|
1110
|
-
ref: toCheckpointJson(restore.ref, `${name}.factory.ref`)
|
|
1111
|
-
};
|
|
1112
|
-
if (restore.config !== void 0)
|
|
1113
|
-
out.config = toCheckpointJson(restore.config, `${name}.factory.config`);
|
|
1114
|
-
if (restore.configVersion !== void 0)
|
|
1115
|
-
out.configVersion = toCheckpointJson(restore.configVersion, `${name}.factory.configVersion`);
|
|
1116
|
-
return out;
|
|
1117
|
-
}
|
|
1118
|
-
if (state.handle !== null) {
|
|
1119
|
-
return {
|
|
1120
|
-
kind: "local-only",
|
|
1121
|
-
name,
|
|
1122
|
-
reason: "node uses a function body; first-cut checkpoints do not serialize local functions"
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
return { kind: "registry-ref", ref: name };
|
|
1126
|
-
}
|
|
1127
|
-
function explainSubset(snap, chain) {
|
|
1128
|
-
const fwd = /* @__PURE__ */ new Map();
|
|
1129
|
-
const rev = /* @__PURE__ */ new Map();
|
|
1130
|
-
const push = (map, k, v) => {
|
|
1131
|
-
const a = map.get(k);
|
|
1132
|
-
if (a) a.push(v);
|
|
1133
|
-
else map.set(k, [v]);
|
|
1134
|
-
};
|
|
1135
|
-
for (const e of snap.edges) {
|
|
1136
|
-
push(fwd, e.from, e.to);
|
|
1137
|
-
push(rev, e.to, e.from);
|
|
1138
|
-
}
|
|
1139
|
-
const reach = (start, adj) => {
|
|
1140
|
-
const seen = /* @__PURE__ */ new Set([start]);
|
|
1141
|
-
const stack = [start];
|
|
1142
|
-
while (stack.length > 0) {
|
|
1143
|
-
const cur = stack.pop();
|
|
1144
|
-
for (const nxt of adj.get(cur) ?? []) {
|
|
1145
|
-
if (!seen.has(nxt)) {
|
|
1146
|
-
seen.add(nxt);
|
|
1147
|
-
stack.push(nxt);
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
return seen;
|
|
1152
|
-
};
|
|
1153
|
-
const onPath = new Set([...reach(chain.from, fwd)].filter((id) => reach(chain.to, rev).has(id)));
|
|
1154
|
-
return {
|
|
1155
|
-
...snap.name !== void 0 ? { name: snap.name } : {},
|
|
1156
|
-
nodes: snap.nodes.filter((n) => onPath.has(n.id)),
|
|
1157
|
-
edges: snap.edges.filter((e) => onPath.has(e.from) && onPath.has(e.to))
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
1166
|
function graph(opts = {}) {
|
|
1161
1167
|
return new Graph(opts);
|
|
1162
1168
|
}
|
|
@@ -1186,4 +1192,4 @@ export {
|
|
|
1186
1192
|
restoreStateNodeInGraph,
|
|
1187
1193
|
restoreNodeInGraph
|
|
1188
1194
|
};
|
|
1189
|
-
//# sourceMappingURL=chunk-
|
|
1195
|
+
//# sourceMappingURL=chunk-NNDIFUKX.js.map
|