@graphrefly/ts 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -0
- package/dist/actions-types-CSC3NMDl.d.ts +657 -0
- package/dist/actions-types-wl9Mgkmr.d.cts +657 -0
- package/dist/adapters/index.cjs +5219 -2974
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +204 -192
- package/dist/adapters/index.d.ts +204 -192
- package/dist/adapters/index.js +3685 -1833
- 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 +4 -4
- package/dist/adapters/observe-storage.d.ts +4 -4
- package/dist/adapters/observe-storage.js +5 -4
- package/dist/adapters/observe-storage.js.map +1 -1
- package/dist/adapters/react.cjs +166 -0
- package/dist/adapters/react.cjs.map +1 -0
- package/dist/adapters/react.d.cts +31 -0
- package/dist/adapters/react.d.ts +31 -0
- package/dist/adapters/react.js +51 -0
- package/dist/adapters/react.js.map +1 -0
- package/dist/adapters/solid.cjs +157 -0
- package/dist/adapters/solid.cjs.map +1 -0
- package/dist/adapters/solid.d.cts +26 -0
- package/dist/adapters/solid.d.ts +26 -0
- package/dist/adapters/solid.js +48 -0
- package/dist/adapters/solid.js.map +1 -0
- package/dist/adapters/svelte.cjs +148 -0
- package/dist/adapters/svelte.cjs.map +1 -0
- package/dist/adapters/svelte.d.cts +31 -0
- package/dist/adapters/svelte.d.ts +31 -0
- package/dist/adapters/svelte.js +46 -0
- package/dist/adapters/svelte.js.map +1 -0
- package/dist/adapters/vue.cjs +155 -0
- package/dist/adapters/vue.cjs.map +1 -0
- package/dist/adapters/vue.d.cts +26 -0
- package/dist/adapters/vue.d.ts +26 -0
- package/dist/adapters/vue.js +46 -0
- package/dist/adapters/vue.js.map +1 -0
- package/dist/agent-runtime-types-core-CaXfKNtY.d.cts +406 -0
- package/dist/agent-runtime-types-core-hU299uIC.d.ts +406 -0
- package/dist/agent-runtime-types-tool-BEpSINol.d.ts +695 -0
- package/dist/agent-runtime-types-tool-DninPEzk.d.cts +695 -0
- package/dist/agentic-memory-retention-BmGX368S.d.ts +14 -0
- package/dist/agentic-memory-retention-Ih1qhX9Z.d.cts +14 -0
- package/dist/agentic-memory-types-CVSUS6XR.d.ts +473 -0
- package/dist/agentic-memory-types-FnnYlVUs.d.cts +473 -0
- package/dist/capability-admission-BW2CziT6.d.ts +102 -0
- package/dist/capability-admission-lwSecxXs.d.cts +102 -0
- package/dist/chunk-2KUAG2GZ.js +9693 -0
- package/dist/chunk-2KUAG2GZ.js.map +1 -0
- package/dist/chunk-2NJP6GO4.js +1320 -0
- package/dist/chunk-2NJP6GO4.js.map +1 -0
- package/dist/{chunk-GDL26N2T.js → chunk-3KN7NJDR.js} +2 -2
- package/dist/{chunk-COHO25CZ.js → chunk-4NWSNI4K.js} +2232 -1672
- package/dist/chunk-4NWSNI4K.js.map +1 -0
- package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
- package/dist/chunk-6E76H4OU.js +132 -0
- package/dist/chunk-6E76H4OU.js.map +1 -0
- package/dist/chunk-7GOTIIQ7.js +819 -0
- package/dist/chunk-7GOTIIQ7.js.map +1 -0
- package/dist/{chunk-D6BG7U6A.js → chunk-7HZRJMN6.js} +3 -3
- package/dist/{chunk-SCRFRCGR.js → chunk-BSQGE5PS.js} +1 -1
- package/dist/{chunk-PKVBHGBM.js → chunk-CJIFGJQG.js} +7 -7
- package/dist/{chunk-G4M3NHRJ.js → chunk-CX6B6PO2.js} +93 -10
- package/dist/chunk-CX6B6PO2.js.map +1 -0
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/chunk-DGUM43GV.js.map +1 -0
- package/dist/{chunk-JIMUDQN3.js → chunk-E4QCH32M.js} +449 -447
- package/dist/chunk-E4QCH32M.js.map +1 -0
- package/dist/{chunk-RIIOUTGM.js → chunk-ECURQ3HD.js} +19 -129
- package/dist/chunk-ECURQ3HD.js.map +1 -0
- package/dist/{chunk-2ILL7HQI.js → chunk-EOKT4QFF.js} +134 -128
- package/dist/chunk-EOKT4QFF.js.map +1 -0
- package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
- package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
- package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
- package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
- package/dist/chunk-K7FB3JTD.js.map +1 -0
- package/dist/chunk-L6LDXRWE.js +219 -0
- package/dist/chunk-L6LDXRWE.js.map +1 -0
- package/dist/chunk-M7J6Z4IJ.js +1930 -0
- package/dist/chunk-M7J6Z4IJ.js.map +1 -0
- package/dist/chunk-MQEQMS7B.js +1009 -0
- package/dist/chunk-MQEQMS7B.js.map +1 -0
- package/dist/chunk-MTELVIYR.js +1421 -0
- package/dist/chunk-MTELVIYR.js.map +1 -0
- package/dist/chunk-PVC7WDKI.js +885 -0
- package/dist/chunk-PVC7WDKI.js.map +1 -0
- package/dist/chunk-RAHNUYA5.js +368 -0
- package/dist/chunk-RAHNUYA5.js.map +1 -0
- package/dist/{chunk-DK554R7P.js → chunk-S6HXABGL.js} +2 -1
- package/dist/chunk-S6HXABGL.js.map +1 -0
- package/dist/{chunk-I3IHOHCJ.js → chunk-SHZDP2MQ.js} +1181 -1001
- package/dist/chunk-SHZDP2MQ.js.map +1 -0
- package/dist/{chunk-Y3ZLRGHC.js → chunk-SIDJO2T4.js} +16 -16
- package/dist/chunk-STXRMPW4.js +4131 -0
- package/dist/chunk-STXRMPW4.js.map +1 -0
- package/dist/{chunk-JR4IKCR2.js → chunk-TPND5MJS.js} +5 -5
- package/dist/chunk-TQPCAIQI.js +612 -0
- package/dist/chunk-TQPCAIQI.js.map +1 -0
- package/dist/chunk-UT3MHJCW.js +49 -0
- package/dist/chunk-UT3MHJCW.js.map +1 -0
- package/dist/{chunk-TEW47IVR.js → chunk-VPEFSDME.js} +2 -2
- package/dist/{chunk-SWTLEQL6.js → chunk-WQIA3GFB.js} +2 -2
- package/dist/chunk-WQIA3GFB.js.map +1 -0
- package/dist/{chunk-DJC4CHLQ.js → chunk-YDWBXXQZ.js} +5 -5
- package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
- package/dist/composition/index.cjs +1256 -1059
- package/dist/composition/index.cjs.map +1 -1
- package/dist/composition/index.d.cts +4 -4
- package/dist/composition/index.d.ts +4 -4
- package/dist/composition/index.js +7 -6
- package/dist/core/index.cjs +1218 -1021
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +5 -4
- package/dist/cqrs/index.cjs.map +1 -1
- package/dist/cqrs/index.d.cts +4 -4
- package/dist/cqrs/index.d.ts +4 -4
- package/dist/cqrs/index.js +3 -2
- package/dist/cqrs/index.js.map +1 -1
- package/dist/cqrs/messaging.cjs +312 -0
- package/dist/cqrs/messaging.cjs.map +1 -0
- package/dist/cqrs/messaging.d.cts +57 -0
- package/dist/cqrs/messaging.d.ts +57 -0
- package/dist/cqrs/messaging.js +274 -0
- package/dist/cqrs/messaging.js.map +1 -0
- package/dist/cqrs/work-queue.cjs +329 -0
- package/dist/cqrs/work-queue.cjs.map +1 -0
- package/dist/cqrs/work-queue.d.cts +90 -0
- package/dist/cqrs/work-queue.d.ts +90 -0
- package/dist/cqrs/work-queue.js +292 -0
- package/dist/cqrs/work-queue.js.map +1 -0
- package/dist/data/index.cjs +19 -0
- package/dist/data/index.cjs.map +1 -0
- package/dist/data/index.d.cts +36 -0
- package/dist/data/index.d.ts +36 -0
- package/dist/data/index.js +1 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data-structures/index.cjs +1252 -1052
- package/dist/data-structures/index.cjs.map +1 -1
- package/dist/data-structures/index.d.cts +9 -8
- package/dist/data-structures/index.d.ts +9 -8
- package/dist/data-structures/index.js +9 -7
- package/dist/{describe-BZb7AS2y.d.ts → describe-B_A5fbXH.d.ts} +1 -1
- package/dist/{describe-Ciu8SUnN.d.cts → describe-CQRrkv-Q.d.cts} +1 -1
- package/dist/executors/tool-provider-adapters.cjs +3091 -0
- package/dist/executors/tool-provider-adapters.cjs.map +1 -0
- package/dist/executors/tool-provider-adapters.d.cts +174 -0
- package/dist/executors/tool-provider-adapters.d.ts +174 -0
- package/dist/executors/tool-provider-adapters.js +1336 -0
- package/dist/executors/tool-provider-adapters.js.map +1 -0
- package/dist/executors/tool-provider-runtime.cjs +5178 -0
- package/dist/executors/tool-provider-runtime.cjs.map +1 -0
- package/dist/executors/tool-provider-runtime.d.cts +17 -0
- package/dist/executors/tool-provider-runtime.d.ts +17 -0
- package/dist/executors/tool-provider-runtime.js +15 -0
- package/dist/executors/tool-provider-runtime.js.map +1 -0
- package/dist/executors/tool-provider.cjs +6392 -0
- package/dist/executors/tool-provider.cjs.map +1 -0
- package/dist/executors/tool-provider.d.cts +60 -0
- package/dist/executors/tool-provider.d.ts +60 -0
- package/dist/executors/tool-provider.js +89 -0
- package/dist/executors/tool-provider.js.map +1 -0
- package/dist/executors/work-queue.cjs +342 -0
- package/dist/executors/work-queue.cjs.map +1 -0
- package/dist/executors/work-queue.d.cts +90 -0
- package/dist/executors/work-queue.d.ts +90 -0
- package/dist/executors/work-queue.js +306 -0
- package/dist/executors/work-queue.js.map +1 -0
- package/dist/graph/index.cjs +1536 -1324
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +10 -9
- package/dist/graph/index.d.ts +10 -9
- package/dist/graph/index.js +22 -20
- package/dist/{graph-s23RbbFO.d.cts → graph-CWK3HLPB.d.cts} +134 -132
- package/dist/{graph-DfdF9zy4.d.ts → graph-ho5sotHP.d.ts} +134 -132
- package/dist/{index-SnzZu3x7.d.ts → index-CQWcE0Dw.d.ts} +18 -4
- package/dist/{index-CAEmLCYF.d.cts → index-DHA1i67c.d.cts} +18 -4
- package/dist/index.cjs +3331 -3020
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +114 -108
- package/dist/inspection/boundary.cjs +98 -0
- package/dist/inspection/boundary.cjs.map +1 -0
- package/dist/inspection/boundary.d.cts +61 -0
- package/dist/inspection/boundary.d.ts +61 -0
- package/dist/inspection/boundary.js +75 -0
- package/dist/inspection/boundary.js.map +1 -0
- package/dist/measurements-C0mAvWU1.d.cts +164 -0
- package/dist/measurements-OMpCeBwh.d.ts +164 -0
- package/dist/{messages-BZqrGGm1.d.ts → messages-CAzUPPJM.d.cts} +10 -5
- package/dist/{messages-BZqrGGm1.d.cts → messages-CAzUPPJM.d.ts} +10 -5
- package/dist/messaging/index.cjs +756 -619
- package/dist/messaging/index.cjs.map +1 -1
- package/dist/messaging/index.d.cts +17 -226
- package/dist/messaging/index.d.ts +17 -226
- package/dist/messaging/index.js +19 -749
- package/dist/messaging/index.js.map +1 -1
- package/dist/operators/index.cjs +1256 -1059
- package/dist/operators/index.cjs.map +1 -1
- package/dist/operators/index.d.cts +6 -6
- package/dist/operators/index.d.ts +6 -6
- package/dist/operators/index.js +9 -8
- package/dist/orchestration/index.cjs +8664 -2617
- package/dist/orchestration/index.cjs.map +1 -1
- package/dist/orchestration/index.d.cts +171 -221
- package/dist/orchestration/index.d.ts +171 -221
- package/dist/orchestration/index.js +74 -982
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/messaging.cjs +314 -0
- package/dist/orchestration/messaging.cjs.map +1 -0
- package/dist/orchestration/messaging.d.cts +56 -0
- package/dist/orchestration/messaging.d.ts +56 -0
- package/dist/orchestration/messaging.js +276 -0
- package/dist/orchestration/messaging.js.map +1 -0
- package/dist/orchestration/work-queue.cjs +1500 -0
- package/dist/orchestration/work-queue.cjs.map +1 -0
- package/dist/orchestration/work-queue.d.cts +196 -0
- package/dist/orchestration/work-queue.d.ts +196 -0
- package/dist/orchestration/work-queue.js +1289 -0
- package/dist/orchestration/work-queue.js.map +1 -0
- package/dist/patterns/event-flow.cjs +433 -0
- package/dist/patterns/event-flow.cjs.map +1 -0
- package/dist/patterns/event-flow.d.cts +115 -0
- package/dist/patterns/event-flow.d.ts +115 -0
- package/dist/patterns/event-flow.js +14 -0
- package/dist/patterns/event-flow.js.map +1 -0
- package/dist/patterns/index.cjs +748 -355
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +9 -5
- package/dist/patterns/index.d.ts +9 -5
- package/dist/patterns/index.js +13 -4
- package/dist/process-types-C9uMYz3i.d.ts +200 -0
- package/dist/process-types-h3uRlzDc.d.cts +200 -0
- package/dist/{reactive-collection-BxBqtIOE.d.cts → reactive-collection-B9R0Bl1P.d.cts} +11 -41
- package/dist/{reactive-collection-Cb1II1Fi.d.ts → reactive-collection-BXFrH0U2.d.ts} +11 -41
- package/dist/{reactive-collection-storage-D-KmjE0J.d.cts → reactive-collection-storage-BLGv8Xp8.d.cts} +5 -5
- package/dist/{reactive-collection-storage-BNiEc-Gd.d.ts → reactive-collection-storage-a4zD3665.d.ts} +5 -5
- package/dist/{reactive-map-BcB4KsQR.d.ts → reactive-map-C_8sOfdS.d.cts} +7 -6
- package/dist/{reactive-map-D-g3dv8I.d.cts → reactive-map-jle5dnok.d.ts} +7 -6
- package/dist/render/index.d.cts +3 -3
- package/dist/render/index.d.ts +3 -3
- package/dist/render/index.js +1 -0
- package/dist/scheduled-readiness-5rwQlyjV.d.ts +91 -0
- package/dist/scheduled-readiness-DpRY8jI0.d.cts +91 -0
- package/dist/semantic-memory-graph-C2ZUwIlq.d.ts +30 -0
- package/dist/semantic-memory-graph-DlZBD_Eu.d.cts +30 -0
- package/dist/{semantic-memory-graph-BYoIlP35.d.cts → semantic-memory-graph-types-BvzdqmkY.d.cts} +2 -28
- package/dist/{semantic-memory-graph-CxyXLms3.d.ts → semantic-memory-graph-types-Ci-OtahO.d.ts} +2 -28
- package/dist/solutions/index.cjs +6788 -2128
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +15 -519
- package/dist/solutions/index.d.ts +15 -519
- package/dist/solutions/index.js +91 -7
- package/dist/solutions/reactive-layout/browser/index.cjs +457 -0
- package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/browser/index.d.cts +44 -0
- package/dist/solutions/reactive-layout/browser/index.d.ts +44 -0
- package/dist/solutions/reactive-layout/browser/index.js +69 -0
- package/dist/solutions/reactive-layout/browser/index.js.map +1 -0
- package/dist/solutions/reactive-layout/index.cjs +4494 -0
- package/dist/solutions/reactive-layout/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/index.d.cts +37 -0
- package/dist/solutions/reactive-layout/index.d.ts +37 -0
- package/dist/solutions/reactive-layout/index.js +146 -0
- package/dist/solutions/reactive-layout/index.js.map +1 -0
- package/dist/solutions/reactive-layout/node-canvas/index.cjs +555 -0
- package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/node-canvas/index.d.cts +54 -0
- package/dist/solutions/reactive-layout/node-canvas/index.d.ts +54 -0
- package/dist/solutions/reactive-layout/node-canvas/index.js +131 -0
- package/dist/solutions/reactive-layout/node-canvas/index.js.map +1 -0
- package/dist/solutions/reactive-layout/react-native/index.cjs +504 -0
- package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/react-native/index.d.cts +51 -0
- package/dist/solutions/reactive-layout/react-native/index.d.ts +51 -0
- package/dist/solutions/reactive-layout/react-native/index.js +77 -0
- package/dist/solutions/reactive-layout/react-native/index.js.map +1 -0
- package/dist/solutions/reactive-layout/skia/index.cjs +557 -0
- package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -0
- package/dist/solutions/reactive-layout/skia/index.d.cts +64 -0
- package/dist/solutions/reactive-layout/skia/index.d.ts +64 -0
- package/dist/solutions/reactive-layout/skia/index.js +70 -0
- package/dist/solutions/reactive-layout/skia/index.js.map +1 -0
- package/dist/solutions/work-item/actions.cjs +2345 -0
- package/dist/solutions/work-item/actions.cjs.map +1 -0
- package/dist/solutions/work-item/actions.d.cts +40 -0
- package/dist/solutions/work-item/actions.d.ts +40 -0
- package/dist/solutions/work-item/actions.js +2078 -0
- package/dist/solutions/work-item/actions.js.map +1 -0
- package/dist/solutions/work-item/scheduling.cjs +9797 -0
- package/dist/solutions/work-item/scheduling.cjs.map +1 -0
- package/dist/solutions/work-item/scheduling.d.cts +1868 -0
- package/dist/solutions/work-item/scheduling.d.ts +1868 -0
- package/dist/solutions/work-item/scheduling.js +146 -0
- package/dist/solutions/work-item/scheduling.js.map +1 -0
- package/dist/solutions/work-item/work-queue.cjs +306 -0
- package/dist/solutions/work-item/work-queue.cjs.map +1 -0
- package/dist/solutions/work-item/work-queue.d.cts +71 -0
- package/dist/solutions/work-item/work-queue.d.ts +71 -0
- package/dist/solutions/work-item/work-queue.js +270 -0
- package/dist/solutions/work-item/work-queue.js.map +1 -0
- package/dist/sources/browser.cjs +1399 -1052
- package/dist/sources/browser.cjs.map +1 -1
- package/dist/sources/browser.d.cts +33 -6
- package/dist/sources/browser.d.ts +33 -6
- package/dist/sources/browser.js +73 -6
- package/dist/sources/browser.js.map +1 -1
- package/dist/sources/index.cjs +1345 -1065
- package/dist/sources/index.cjs.map +1 -1
- package/dist/sources/index.d.cts +5 -5
- package/dist/sources/index.d.ts +5 -5
- package/dist/sources/index.js +7 -6
- package/dist/sources/node.cjs.map +1 -1
- package/dist/sources/node.d.cts +4 -4
- package/dist/sources/node.d.ts +4 -4
- package/dist/sources/node.js +2 -1
- package/dist/sources/node.js.map +1 -1
- package/dist/storage/browser.cjs +16 -0
- package/dist/storage/browser.cjs.map +1 -1
- package/dist/storage/browser.js +4 -3
- package/dist/storage/browser.js.map +1 -1
- package/dist/storage/index.cjs +16 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +6 -5
- package/dist/storage/index.d.ts +6 -5
- package/dist/storage/index.js +10 -9
- package/dist/storage/node.cjs +16 -0
- package/dist/storage/node.cjs.map +1 -1
- package/dist/storage/node.js +4 -3
- package/dist/storage/node.js.map +1 -1
- package/dist/store-BmtEs9mG.d.ts +123 -0
- package/dist/store-PAAsYvML.d.cts +123 -0
- package/dist/testing/index.cjs +1 -0
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +3 -2
- package/dist/types-BRNKoFHj.d.ts +357 -0
- package/dist/{types-h12mNYbq.d.ts → types-BS6CyR-x.d.cts} +49 -130
- package/dist/types-BWK2ay3e.d.cts +457 -0
- package/dist/types-BXKSAoE1.d.cts +357 -0
- package/dist/types-BaPpZItj.d.ts +457 -0
- package/dist/types-BhveCMg5.d.cts +274 -0
- package/dist/{types-bNMSWKqF.d.cts → types-C9NOgNJw.d.ts} +49 -130
- package/dist/types-CTsQ8Ww4.d.ts +274 -0
- package/dist/types-DL_05n2M.d.ts +34 -0
- package/dist/types-XDoqxYO9.d.cts +34 -0
- package/dist/work-item-runtime-types-BqtWnSCS.d.ts +138 -0
- package/dist/work-item-runtime-types-CHO03AKh.d.cts +138 -0
- package/dist/work-queue/index.cjs +1136 -0
- package/dist/work-queue/index.cjs.map +1 -0
- package/dist/work-queue/index.d.cts +21 -0
- package/dist/work-queue/index.d.ts +21 -0
- package/dist/work-queue/index.js +1082 -0
- package/dist/work-queue/index.js.map +1 -0
- package/package.json +603 -249
- package/dist/chunk-2ILL7HQI.js.map +0 -1
- package/dist/chunk-4VLAQHZI.js.map +0 -1
- package/dist/chunk-COHO25CZ.js.map +0 -1
- package/dist/chunk-DK554R7P.js.map +0 -1
- package/dist/chunk-G4M3NHRJ.js.map +0 -1
- package/dist/chunk-I3IHOHCJ.js.map +0 -1
- package/dist/chunk-JIMUDQN3.js.map +0 -1
- package/dist/chunk-RIIOUTGM.js.map +0 -1
- package/dist/chunk-SWTLEQL6.js.map +0 -1
- /package/dist/{chunk-GDL26N2T.js.map → chunk-3KN7NJDR.js.map} +0 -0
- /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
- /package/dist/{chunk-D6BG7U6A.js.map → chunk-7HZRJMN6.js.map} +0 -0
- /package/dist/{chunk-SCRFRCGR.js.map → chunk-BSQGE5PS.js.map} +0 -0
- /package/dist/{chunk-PKVBHGBM.js.map → chunk-CJIFGJQG.js.map} +0 -0
- /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
- /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
- /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
- /package/dist/{chunk-Y3ZLRGHC.js.map → chunk-SIDJO2T4.js.map} +0 -0
- /package/dist/{chunk-JR4IKCR2.js.map → chunk-TPND5MJS.js.map} +0 -0
- /package/dist/{chunk-TEW47IVR.js.map → chunk-VPEFSDME.js.map} +0 -0
- /package/dist/{chunk-DJC4CHLQ.js.map → chunk-YDWBXXQZ.js.map} +0 -0
- /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
|
@@ -0,0 +1,1421 @@
|
|
|
1
|
+
import {
|
|
2
|
+
outcomeIssues
|
|
3
|
+
} from "./chunk-7GOTIIQ7.js";
|
|
4
|
+
import {
|
|
5
|
+
dataIssue,
|
|
6
|
+
forEachDepBatch,
|
|
7
|
+
forbiddenAdapterInputMaterialIssues,
|
|
8
|
+
forbiddenDataKeys,
|
|
9
|
+
forbiddenGraphVisibleMaterialIssues,
|
|
10
|
+
forbiddenProviderRawMaterialKeys,
|
|
11
|
+
isRecord,
|
|
12
|
+
projectRuntimeFact,
|
|
13
|
+
ref,
|
|
14
|
+
sanitizeAdapterInputIssue,
|
|
15
|
+
sanitizeAdapterInputSourceRefs,
|
|
16
|
+
sanitizeProviderGraphVisibleRecord,
|
|
17
|
+
stableJsonStringify,
|
|
18
|
+
uniqueSourceRefs,
|
|
19
|
+
unlockedToolProviderPolicyOverrides
|
|
20
|
+
} from "./chunk-TQPCAIQI.js";
|
|
21
|
+
import {
|
|
22
|
+
depBatch
|
|
23
|
+
} from "./chunk-WQIA3GFB.js";
|
|
24
|
+
|
|
25
|
+
// src/orchestration/agent-runtime-outcome-view.ts
|
|
26
|
+
function executorOutcomeViewProjector(graph, opts) {
|
|
27
|
+
const name = opts.name ?? "executorOutcomeViews";
|
|
28
|
+
const policy = {
|
|
29
|
+
audience: opts.policy?.audience ?? "agent-observation",
|
|
30
|
+
maxSummaryChars: opts.policy?.maxSummaryChars ?? 512,
|
|
31
|
+
includeIssues: opts.policy?.includeIssues ?? true,
|
|
32
|
+
includeUsage: opts.policy?.includeUsage ?? false,
|
|
33
|
+
includeMetadata: opts.policy?.includeMetadata ?? false
|
|
34
|
+
};
|
|
35
|
+
const runtime = graph.node(
|
|
36
|
+
[opts.outcomes],
|
|
37
|
+
(ctx) => {
|
|
38
|
+
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
39
|
+
const outcome = raw;
|
|
40
|
+
const projection = executorOutcomeViewProjectionFromOutcome(outcome, policy);
|
|
41
|
+
ctx.down([
|
|
42
|
+
["DATA", { kind: "view", view: projection.view }],
|
|
43
|
+
[
|
|
44
|
+
"DATA",
|
|
45
|
+
{
|
|
46
|
+
kind: "audit",
|
|
47
|
+
audit: {
|
|
48
|
+
id: `${outcome.outcomeId}:outcome-view:${policy.audience}`,
|
|
49
|
+
kind: "executor-outcome-view-projected",
|
|
50
|
+
subjectId: outcome.requestId,
|
|
51
|
+
sourceRefs: [ref("executor-outcome", outcome.outcomeId)],
|
|
52
|
+
metadata: { audience: policy.audience, status: outcome.kind }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
]);
|
|
57
|
+
for (const issue of projection.issues) {
|
|
58
|
+
ctx.down([["DATA", { kind: "issue", issue }]]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{ name: `${name}/runtime`, factory: "executorOutcomeViewProjector" }
|
|
63
|
+
);
|
|
64
|
+
return {
|
|
65
|
+
views: projectRuntimeFact(
|
|
66
|
+
graph,
|
|
67
|
+
runtime,
|
|
68
|
+
`${name}/views`,
|
|
69
|
+
"executorOutcomeViews",
|
|
70
|
+
(fact) => fact.kind === "view" ? fact.view : void 0
|
|
71
|
+
),
|
|
72
|
+
issues: projectRuntimeFact(
|
|
73
|
+
graph,
|
|
74
|
+
runtime,
|
|
75
|
+
`${name}/issues`,
|
|
76
|
+
"executorOutcomeViewIssues",
|
|
77
|
+
(fact) => fact.kind === "issue" ? fact.issue : void 0
|
|
78
|
+
),
|
|
79
|
+
audit: projectRuntimeFact(
|
|
80
|
+
graph,
|
|
81
|
+
runtime,
|
|
82
|
+
`${name}/audit`,
|
|
83
|
+
"executorOutcomeViewAudit",
|
|
84
|
+
(fact) => fact.kind === "audit" ? fact.audit : void 0
|
|
85
|
+
)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function executorOutcomeViewProjectionFromOutcome(outcome, policy) {
|
|
89
|
+
const sourceRefs = uniqueSourceRefs([
|
|
90
|
+
ref("executor-outcome", outcome.outcomeId),
|
|
91
|
+
...outcome.evidenceRefs ?? []
|
|
92
|
+
]);
|
|
93
|
+
const summary = projectOutcomeSummary(outcome, policy.maxSummaryChars);
|
|
94
|
+
const issues = Object.freeze([
|
|
95
|
+
...outcomeIssues(outcome),
|
|
96
|
+
...summary.truncated ? [outcomeSummaryTruncationIssue(outcome, summary, policy)] : []
|
|
97
|
+
]);
|
|
98
|
+
const metadata = policy.includeMetadata ? sanitizeProviderGraphVisibleRecord(outcome.metadata) : void 0;
|
|
99
|
+
const view = Object.freeze({
|
|
100
|
+
kind: "executor-outcome-view",
|
|
101
|
+
viewId: `${outcome.outcomeId}:${policy.audience}`,
|
|
102
|
+
audience: policy.audience,
|
|
103
|
+
outcomeId: outcome.outcomeId,
|
|
104
|
+
requestId: outcome.requestId,
|
|
105
|
+
operationId: outcome.operationId,
|
|
106
|
+
routeId: outcome.routeId,
|
|
107
|
+
executorId: outcome.executorId,
|
|
108
|
+
profileId: outcome.profileId,
|
|
109
|
+
status: outcome.kind,
|
|
110
|
+
summary: summary.summary,
|
|
111
|
+
summaryTruncated: summary.truncated,
|
|
112
|
+
summaryChars: summary.originalChars,
|
|
113
|
+
summaryLimitChars: summary.limitChars,
|
|
114
|
+
errorKind: outcomeErrorKind(outcome),
|
|
115
|
+
retryable: outcomeRetryable(outcome),
|
|
116
|
+
nextActions: outcomeNextActions(outcome),
|
|
117
|
+
sourceRefs,
|
|
118
|
+
materialRefs: outcomeMaterialRefs(outcome),
|
|
119
|
+
issues: policy.includeIssues && issues.length > 0 ? issues : void 0,
|
|
120
|
+
usage: policy.includeUsage ? outcome.usage : void 0,
|
|
121
|
+
...metadata === void 0 ? {} : { metadata }
|
|
122
|
+
});
|
|
123
|
+
return Object.freeze({ view, issues });
|
|
124
|
+
}
|
|
125
|
+
function projectOutcomeSummary(outcome, maxChars) {
|
|
126
|
+
const summary = outcomeSummary(outcome);
|
|
127
|
+
const limitChars = Math.max(0, maxChars);
|
|
128
|
+
if (summary.length <= limitChars) {
|
|
129
|
+
return Object.freeze({
|
|
130
|
+
summary,
|
|
131
|
+
truncated: false,
|
|
132
|
+
originalChars: summary.length,
|
|
133
|
+
limitChars
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const bounded = limitChars <= 1 ? summary.slice(0, limitChars) : limitChars <= 3 ? summary.slice(0, limitChars) : `${summary.slice(0, limitChars - 3)}...`;
|
|
137
|
+
return Object.freeze({
|
|
138
|
+
summary: bounded,
|
|
139
|
+
truncated: true,
|
|
140
|
+
originalChars: summary.length,
|
|
141
|
+
limitChars
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function outcomeSummaryTruncationIssue(outcome, summary, policy) {
|
|
145
|
+
return dataIssue(
|
|
146
|
+
"executor-outcome-view-summary-truncated",
|
|
147
|
+
"ExecutorOutcome view summary was truncated; inspect material refs or the source outcome for full detail",
|
|
148
|
+
{
|
|
149
|
+
subjectId: outcome.requestId,
|
|
150
|
+
refs: [ref("executor-outcome", outcome.outcomeId)],
|
|
151
|
+
severity: "warning",
|
|
152
|
+
details: {
|
|
153
|
+
audience: policy.audience,
|
|
154
|
+
outcomeId: outcome.outcomeId,
|
|
155
|
+
originalChars: summary.originalChars,
|
|
156
|
+
limitChars: summary.limitChars
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function outcomeSummary(outcome) {
|
|
162
|
+
if (outcome.kind === "result") {
|
|
163
|
+
if (outcome.result.summary !== void 0 && outcome.result.summary.length > 0)
|
|
164
|
+
return outcome.result.summary;
|
|
165
|
+
return `Executor result '${outcome.result.kind}' is available via source refs`;
|
|
166
|
+
}
|
|
167
|
+
if (outcome.kind === "failure") return outcome.error.message;
|
|
168
|
+
if (outcome.kind === "blocked") {
|
|
169
|
+
const needKinds = outcome.needs.map((need) => need.kind).join(", ");
|
|
170
|
+
return needKinds.length > 0 ? `Executor blocked: ${needKinds}` : "Executor blocked";
|
|
171
|
+
}
|
|
172
|
+
if (outcome.kind === "timeout") {
|
|
173
|
+
return outcome.timeoutMs === void 0 ? "Executor timed out" : `Executor timed out after ${outcome.timeoutMs}ms`;
|
|
174
|
+
}
|
|
175
|
+
return outcome.reason ?? "Executor canceled";
|
|
176
|
+
}
|
|
177
|
+
function outcomeErrorKind(outcome) {
|
|
178
|
+
if (outcome.kind === "failure") return outcome.error.code;
|
|
179
|
+
if (outcome.kind === "timeout") return "timeout";
|
|
180
|
+
if (outcome.kind === "blocked") return outcome.needs[0]?.kind ?? "blocked";
|
|
181
|
+
if (outcome.kind === "canceled") return "canceled";
|
|
182
|
+
return void 0;
|
|
183
|
+
}
|
|
184
|
+
function outcomeRetryable(outcome) {
|
|
185
|
+
if (outcome.kind === "failure" || outcome.kind === "timeout") return outcome.retryable;
|
|
186
|
+
return void 0;
|
|
187
|
+
}
|
|
188
|
+
function outcomeNextActions(outcome) {
|
|
189
|
+
if (outcome.kind === "blocked") return Object.freeze(outcome.needs.map((need) => need.kind));
|
|
190
|
+
if ((outcome.kind === "failure" || outcome.kind === "timeout") && outcome.retryable === true) {
|
|
191
|
+
return Object.freeze(["retry-or-route"]);
|
|
192
|
+
}
|
|
193
|
+
return void 0;
|
|
194
|
+
}
|
|
195
|
+
function outcomeMaterialRefs(outcome) {
|
|
196
|
+
const refs = outcome.kind === "result" ? [...outcome.result.refs ?? []] : outcome.kind === "blocked" ? outcome.needs.flatMap((need) => [...need.refs ?? []]) : [];
|
|
197
|
+
return refs.length === 0 ? void 0 : uniqueSourceRefs(refs);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// src/orchestration/agent-runtime-tool-provider-policy.ts
|
|
201
|
+
function localBuiltinToolProviderCatalog(opts = {}) {
|
|
202
|
+
const providerId = opts.providerId ?? "local-builtin";
|
|
203
|
+
const executorId = opts.executorId ?? `${providerId}:tool-executor`;
|
|
204
|
+
const profileId = opts.profileId ?? `${providerId}:tool-profile`;
|
|
205
|
+
const tools = opts.tools ?? [
|
|
206
|
+
{ toolName: "document/read-doc", operation: "read" },
|
|
207
|
+
{ toolName: "file.read", operation: "read" },
|
|
208
|
+
{ toolName: "file.edit/apply-patch", operation: "edit" },
|
|
209
|
+
{ toolName: "bash.run", operation: "run" },
|
|
210
|
+
{ toolName: "url.fetch", operation: "fetch" },
|
|
211
|
+
{ toolName: "date.now", operation: "read" },
|
|
212
|
+
{ toolName: "weather.fetch", operation: "fetch" },
|
|
213
|
+
{ toolName: "calculator/eval", operation: "eval" }
|
|
214
|
+
];
|
|
215
|
+
const candidatePolicies = opts.policies?.map(
|
|
216
|
+
(policy) => Object.freeze(policy)
|
|
217
|
+
) ?? [
|
|
218
|
+
defaultLocalBuiltinToolProviderExecutionPolicy({
|
|
219
|
+
providerId,
|
|
220
|
+
profileId,
|
|
221
|
+
tools,
|
|
222
|
+
overrides: opts.policyOverrides
|
|
223
|
+
})
|
|
224
|
+
];
|
|
225
|
+
const policyIssues = Object.freeze(
|
|
226
|
+
candidatePolicies.flatMap((policy) => [
|
|
227
|
+
...validateToolProviderExecutionPolicy(policy),
|
|
228
|
+
...validateToolProviderPolicyProviderScope(policy, providerId)
|
|
229
|
+
])
|
|
230
|
+
);
|
|
231
|
+
const policies = Object.freeze(
|
|
232
|
+
candidatePolicies.filter((policy) => isPublishableToolProviderExecutionPolicy(policy, providerId)).map((policy) => Object.freeze(policy))
|
|
233
|
+
);
|
|
234
|
+
const policyRefs = Object.freeze(
|
|
235
|
+
policies.map((policy) => ref("tool-provider-execution-policy", policy.policyId))
|
|
236
|
+
);
|
|
237
|
+
const catalogInputIssues = Object.freeze([
|
|
238
|
+
...forbiddenGraphVisibleMaterialIssues(
|
|
239
|
+
opts.metadata,
|
|
240
|
+
ref("tool-provider-catalog", providerId),
|
|
241
|
+
"catalog-metadata"
|
|
242
|
+
),
|
|
243
|
+
...forbiddenGraphVisibleMaterialIssues(
|
|
244
|
+
opts.capabilities,
|
|
245
|
+
ref("executor-profile", profileId),
|
|
246
|
+
"profile-capabilities"
|
|
247
|
+
),
|
|
248
|
+
...forbiddenGraphVisibleMaterialIssues(
|
|
249
|
+
opts.limits,
|
|
250
|
+
ref("executor-profile", profileId),
|
|
251
|
+
"profile-limits"
|
|
252
|
+
),
|
|
253
|
+
...tools.flatMap((tool) => [
|
|
254
|
+
...forbiddenGraphVisibleMaterialIssues(
|
|
255
|
+
tool.metadata,
|
|
256
|
+
ref("tool", tool.toolName),
|
|
257
|
+
"tool-metadata"
|
|
258
|
+
),
|
|
259
|
+
...forbiddenGraphVisibleMaterialIssues(
|
|
260
|
+
tool.capabilities,
|
|
261
|
+
ref("tool", tool.toolName),
|
|
262
|
+
"tool-capabilities"
|
|
263
|
+
),
|
|
264
|
+
...forbiddenGraphVisibleMaterialIssues(
|
|
265
|
+
tool.limits,
|
|
266
|
+
ref("tool", tool.toolName),
|
|
267
|
+
"tool-limits"
|
|
268
|
+
)
|
|
269
|
+
])
|
|
270
|
+
]);
|
|
271
|
+
const toolEntries = tools.map((tool) => {
|
|
272
|
+
const toolPolicyRefs = policyRefsForTool(policies, profileId, tool);
|
|
273
|
+
return Object.freeze({
|
|
274
|
+
...tool,
|
|
275
|
+
kind: "tool-catalog-entry",
|
|
276
|
+
providerId,
|
|
277
|
+
inputKind: "tool-call",
|
|
278
|
+
profileId,
|
|
279
|
+
executorId,
|
|
280
|
+
capabilities: sanitizeProviderGraphVisibleRecord(tool.capabilities),
|
|
281
|
+
limits: sanitizeProviderGraphVisibleRecord(tool.limits),
|
|
282
|
+
policyRefs: toolPolicyRefs,
|
|
283
|
+
metadata: sanitizeProviderGraphVisibleRecord(tool.metadata)
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
const profilePolicyRefs = policyRefsForProfile(policies, profileId);
|
|
287
|
+
const issues = Object.freeze([...policyIssues, ...catalogInputIssues]);
|
|
288
|
+
return Object.freeze({
|
|
289
|
+
kind: "tool-provider-catalog",
|
|
290
|
+
providerId,
|
|
291
|
+
providerKind: "local-builtin",
|
|
292
|
+
status: issues.length === 0 ? "ready" : "misconfigured",
|
|
293
|
+
profiles: Object.freeze([
|
|
294
|
+
Object.freeze({
|
|
295
|
+
profileId,
|
|
296
|
+
executorId,
|
|
297
|
+
kind: "tool",
|
|
298
|
+
acceptedInputKinds: Object.freeze(["tool-call"]),
|
|
299
|
+
acceptedResultKinds: Object.freeze(
|
|
300
|
+
Array.from(new Set(toolEntries.flatMap((tool) => tool.resultKinds ?? [])))
|
|
301
|
+
),
|
|
302
|
+
capabilities: Object.freeze({
|
|
303
|
+
toolNames: Object.freeze(toolEntries.map((tool) => tool.toolName)),
|
|
304
|
+
...sanitizeProviderGraphVisibleRecord(opts.capabilities) ?? {}
|
|
305
|
+
}),
|
|
306
|
+
limits: sanitizeProviderGraphVisibleRecord(opts.limits),
|
|
307
|
+
policyRefs: profilePolicyRefs,
|
|
308
|
+
metadata: sanitizeProviderGraphVisibleRecord(opts.metadata)
|
|
309
|
+
})
|
|
310
|
+
]),
|
|
311
|
+
tools: Object.freeze(toolEntries),
|
|
312
|
+
policies,
|
|
313
|
+
policyRefs,
|
|
314
|
+
issues: issues.length === 0 ? void 0 : issues,
|
|
315
|
+
metadata: sanitizeProviderGraphVisibleRecord(opts.metadata)
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function validateToolProviderExecutionPolicy(policy) {
|
|
319
|
+
const issues = [];
|
|
320
|
+
if (!isRecord(policy)) {
|
|
321
|
+
return Object.freeze([
|
|
322
|
+
dataIssue(
|
|
323
|
+
"tool-provider-policy-invalid-shape",
|
|
324
|
+
"Tool provider policy must be a data object.",
|
|
325
|
+
{ refs: [ref("tool-provider-execution-policy", "<invalid>")] }
|
|
326
|
+
)
|
|
327
|
+
]);
|
|
328
|
+
}
|
|
329
|
+
const policyId = typeof policy.policyId === "string" ? policy.policyId : "";
|
|
330
|
+
const providerId = typeof policy.providerId === "string" ? policy.providerId : "";
|
|
331
|
+
const policyRef = ref("tool-provider-execution-policy", policyId || "<missing>");
|
|
332
|
+
if (policy.kind !== "tool-provider-execution-policy") {
|
|
333
|
+
issues.push(
|
|
334
|
+
dataIssue(
|
|
335
|
+
"tool-provider-policy-invalid-kind",
|
|
336
|
+
"ToolProviderExecutionPolicy.kind must be tool-provider-execution-policy.",
|
|
337
|
+
{ subjectId: policyId, refs: [policyRef] }
|
|
338
|
+
)
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
if (!policyId) {
|
|
342
|
+
issues.push(
|
|
343
|
+
dataIssue(
|
|
344
|
+
"tool-provider-policy-missing-policy-id",
|
|
345
|
+
"Tool provider policy is missing policyId.",
|
|
346
|
+
{
|
|
347
|
+
refs: [policyRef]
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
if (!providerId) {
|
|
353
|
+
issues.push(
|
|
354
|
+
dataIssue(
|
|
355
|
+
"tool-provider-policy-missing-provider-id",
|
|
356
|
+
"Tool provider policy is missing providerId.",
|
|
357
|
+
{ subjectId: policyId, refs: [policyRef] }
|
|
358
|
+
)
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
if (policy.sizeCapacity === void 0 && policy.timeout === void 0 && policy.redaction === void 0 && policy.filesystem === void 0 && policy.approval === void 0 && policy.artifacts === void 0 && policy.network === void 0) {
|
|
362
|
+
issues.push(
|
|
363
|
+
dataIssue(
|
|
364
|
+
"tool-provider-policy-missing-material",
|
|
365
|
+
"Tool provider policy has no D360 policy material sections.",
|
|
366
|
+
{ subjectId: policyId, refs: [policyRef] }
|
|
367
|
+
)
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
if (policy.sizeCapacity !== void 0 && !isRecord(policy.sizeCapacity)) {
|
|
371
|
+
issues.push(
|
|
372
|
+
dataIssue(
|
|
373
|
+
"tool-provider-policy-invalid-size-capacity",
|
|
374
|
+
"Tool provider size-capacity policy must be a data object.",
|
|
375
|
+
{ subjectId: policyId, refs: [policyRef] }
|
|
376
|
+
)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
const limits = isRecord(policy.sizeCapacity) ? policy.sizeCapacity.limits : void 0;
|
|
380
|
+
if (isRecord(policy.sizeCapacity) && !Array.isArray(limits)) {
|
|
381
|
+
issues.push(
|
|
382
|
+
dataIssue(
|
|
383
|
+
"tool-provider-policy-invalid-size-capacity",
|
|
384
|
+
"Tool provider size-capacity limits must be an array.",
|
|
385
|
+
{ subjectId: policyId, refs: [policyRef] }
|
|
386
|
+
)
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
for (const [index, rawLimit] of (Array.isArray(limits) ? limits : []).entries()) {
|
|
390
|
+
if (!isRecord(rawLimit)) {
|
|
391
|
+
issues.push(
|
|
392
|
+
dataIssue(
|
|
393
|
+
"tool-provider-policy-invalid-size-limit",
|
|
394
|
+
"Tool provider size-capacity limit must be a data object.",
|
|
395
|
+
{ subjectId: policyId, refs: [policyRef], details: { index } }
|
|
396
|
+
)
|
|
397
|
+
);
|
|
398
|
+
continue;
|
|
399
|
+
}
|
|
400
|
+
const limit = rawLimit;
|
|
401
|
+
if (typeof limit.unit !== "string" || limit.unit.length === 0) {
|
|
402
|
+
issues.push(
|
|
403
|
+
dataIssue(
|
|
404
|
+
"tool-provider-policy-invalid-size-limit",
|
|
405
|
+
"Tool provider size-capacity limit unit must be a non-empty string.",
|
|
406
|
+
{ subjectId: policyId, refs: [policyRef], details: { index } }
|
|
407
|
+
)
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
if (limit.softLimit !== void 0 && (typeof limit.softLimit !== "number" || !Number.isFinite(limit.softLimit) || limit.softLimit < 0)) {
|
|
411
|
+
issues.push(
|
|
412
|
+
dataIssue(
|
|
413
|
+
"tool-provider-policy-invalid-size-limit",
|
|
414
|
+
"Tool provider size-capacity softLimit must be a finite non-negative number.",
|
|
415
|
+
{ subjectId: policyId, refs: [policyRef], details: { index, unit: limit.unit } }
|
|
416
|
+
)
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
if (limit.hardLimit !== void 0 && (typeof limit.hardLimit !== "number" || !Number.isFinite(limit.hardLimit) || limit.hardLimit < 0)) {
|
|
420
|
+
issues.push(
|
|
421
|
+
dataIssue(
|
|
422
|
+
"tool-provider-policy-invalid-size-limit",
|
|
423
|
+
"Tool provider size-capacity hardLimit must be a finite non-negative number.",
|
|
424
|
+
{ subjectId: policyId, refs: [policyRef], details: { index, unit: limit.unit } }
|
|
425
|
+
)
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
if (typeof limit.softLimit === "number" && Number.isFinite(limit.softLimit) && typeof limit.hardLimit === "number" && Number.isFinite(limit.hardLimit) && limit.softLimit > limit.hardLimit) {
|
|
429
|
+
issues.push(
|
|
430
|
+
dataIssue(
|
|
431
|
+
"tool-provider-policy-invalid-size-limit",
|
|
432
|
+
"Tool provider size-capacity softLimit must not exceed hardLimit.",
|
|
433
|
+
{ subjectId: policyId, refs: [policyRef], details: { index, unit: limit.unit } }
|
|
434
|
+
)
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (policy.timeout !== void 0 && !isRecord(policy.timeout)) {
|
|
439
|
+
issues.push(
|
|
440
|
+
dataIssue(
|
|
441
|
+
"tool-provider-policy-invalid-timeout",
|
|
442
|
+
"Tool provider timeout policy must be a data object.",
|
|
443
|
+
{ subjectId: policyId, refs: [policyRef] }
|
|
444
|
+
)
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
for (const [field, value] of Object.entries(isRecord(policy.timeout) ? policy.timeout : {})) {
|
|
448
|
+
if (field.endsWith("TimeoutMs") || field === "timeoutMs") {
|
|
449
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
450
|
+
issues.push(
|
|
451
|
+
dataIssue(
|
|
452
|
+
"tool-provider-policy-invalid-timeout",
|
|
453
|
+
"Tool provider timeout values must be finite non-negative numbers.",
|
|
454
|
+
{ subjectId: policyId, refs: [policyRef], details: { field } }
|
|
455
|
+
)
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
for (const forbidden of [
|
|
461
|
+
...forbiddenDataKeys(policy),
|
|
462
|
+
...forbiddenProviderRawMaterialKeys(policy)
|
|
463
|
+
]) {
|
|
464
|
+
issues.push(
|
|
465
|
+
dataIssue(
|
|
466
|
+
"tool-provider-policy-forbidden-runtime-material",
|
|
467
|
+
"Tool provider policy must not contain runtime-private adapter material.",
|
|
468
|
+
{ subjectId: policyId, refs: [policyRef], details: { reason: forbidden.reason } }
|
|
469
|
+
)
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
return Object.freeze(issues);
|
|
473
|
+
}
|
|
474
|
+
function resolveToolProviderExecutionPolicies(opts) {
|
|
475
|
+
const request = opts.request;
|
|
476
|
+
const toolCall = toolCallFromRequest(request);
|
|
477
|
+
const baseSourceRefs = Object.freeze([ref("agent-request", request.requestId)]);
|
|
478
|
+
if (toolCall === void 0) {
|
|
479
|
+
return Object.freeze([
|
|
480
|
+
Object.freeze({
|
|
481
|
+
kind: "tool-provider-policy-resolution",
|
|
482
|
+
resolutionId: `${request.requestId}:${request.operationId}:tool-policy:missing-tool-call`,
|
|
483
|
+
status: "missing-tool-call",
|
|
484
|
+
requestId: request.requestId,
|
|
485
|
+
operationId: request.operationId,
|
|
486
|
+
issues: Object.freeze([
|
|
487
|
+
dataIssue(
|
|
488
|
+
"tool-provider-policy-missing-tool-call",
|
|
489
|
+
"Tool provider policy resolution requires AgentRequest input.value to be a ToolCallInput.",
|
|
490
|
+
{ subjectId: request.requestId, refs: baseSourceRefs }
|
|
491
|
+
)
|
|
492
|
+
]),
|
|
493
|
+
sourceRefs: baseSourceRefs
|
|
494
|
+
})
|
|
495
|
+
]);
|
|
496
|
+
}
|
|
497
|
+
const routes = (opts.routes ?? []).filter(
|
|
498
|
+
(route) => route.requestId === request.requestId && route.operationId === request.operationId
|
|
499
|
+
);
|
|
500
|
+
if (routes.length === 0) {
|
|
501
|
+
return Object.freeze([
|
|
502
|
+
Object.freeze({
|
|
503
|
+
kind: "tool-provider-policy-resolution",
|
|
504
|
+
resolutionId: `${request.requestId}:${request.operationId}:tool-policy:pending-route`,
|
|
505
|
+
status: "pending-route",
|
|
506
|
+
requestId: request.requestId,
|
|
507
|
+
operationId: request.operationId,
|
|
508
|
+
toolName: toolCall.toolName,
|
|
509
|
+
operation: toolCall.operation,
|
|
510
|
+
sourceRefs: baseSourceRefs
|
|
511
|
+
})
|
|
512
|
+
]);
|
|
513
|
+
}
|
|
514
|
+
return Object.freeze(
|
|
515
|
+
routes.map(
|
|
516
|
+
(route) => Object.freeze(
|
|
517
|
+
resolveToolProviderPolicyForRoute(request, route, toolCall, opts.catalogs ?? [])
|
|
518
|
+
)
|
|
519
|
+
)
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
function toolProviderPolicyResolutionProjector(graph, opts) {
|
|
523
|
+
const name = opts.name ?? "toolProviderPolicyResolution";
|
|
524
|
+
const routeDeps = opts.executorRoutes ?? [];
|
|
525
|
+
const catalogDeps = opts.toolProviderCatalogs ?? [];
|
|
526
|
+
const routeStart = 1;
|
|
527
|
+
const catalogStart = routeStart + routeDeps.length;
|
|
528
|
+
const runtime = graph.node(
|
|
529
|
+
[opts.requestFacts, ...routeDeps, ...catalogDeps],
|
|
530
|
+
(ctx) => {
|
|
531
|
+
const state = ctx.state.get() ?? {
|
|
532
|
+
requests: /* @__PURE__ */ new Map(),
|
|
533
|
+
routes: /* @__PURE__ */ new Map(),
|
|
534
|
+
catalogs: /* @__PURE__ */ new Map(),
|
|
535
|
+
emittedKeys: /* @__PURE__ */ new Set(),
|
|
536
|
+
auditSeq: 0
|
|
537
|
+
};
|
|
538
|
+
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
539
|
+
const fact = raw;
|
|
540
|
+
if (fact.kind === "issued" && fact.input?.inputKind === "tool-call") {
|
|
541
|
+
state.requests.set(fact.requestId, fact);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
forEachDepBatch(ctx, routeStart, routeDeps.length, (raw) => {
|
|
545
|
+
const route = raw;
|
|
546
|
+
state.routes.set(route.routeId, route);
|
|
547
|
+
});
|
|
548
|
+
forEachDepBatch(ctx, catalogStart, catalogDeps.length, (raw) => {
|
|
549
|
+
const catalog = raw;
|
|
550
|
+
state.catalogs.set(catalog.providerId, catalog);
|
|
551
|
+
});
|
|
552
|
+
for (const request of state.requests.values()) {
|
|
553
|
+
const resolutions2 = resolveToolProviderExecutionPolicies({
|
|
554
|
+
request,
|
|
555
|
+
routes: Array.from(state.routes.values()),
|
|
556
|
+
catalogs: Array.from(state.catalogs.values())
|
|
557
|
+
});
|
|
558
|
+
for (const resolution of resolutions2) {
|
|
559
|
+
const key = stableToolProviderPolicyResolutionKey(resolution);
|
|
560
|
+
if (state.emittedKeys.has(key)) continue;
|
|
561
|
+
state.emittedKeys.add(key);
|
|
562
|
+
ctx.down([
|
|
563
|
+
["DATA", { kind: "resolution", resolution }]
|
|
564
|
+
]);
|
|
565
|
+
for (const issue of resolution.issues ?? []) {
|
|
566
|
+
ctx.down([
|
|
567
|
+
["DATA", { kind: "issue", issue }]
|
|
568
|
+
]);
|
|
569
|
+
}
|
|
570
|
+
state.auditSeq += 1;
|
|
571
|
+
ctx.down([
|
|
572
|
+
[
|
|
573
|
+
"DATA",
|
|
574
|
+
{
|
|
575
|
+
kind: "audit",
|
|
576
|
+
audit: {
|
|
577
|
+
id: `${name}:audit:${state.auditSeq}`,
|
|
578
|
+
kind: "tool-provider-policy-resolution",
|
|
579
|
+
subjectId: request.requestId,
|
|
580
|
+
sourceRefs: resolution.sourceRefs,
|
|
581
|
+
metadata: {
|
|
582
|
+
status: resolution.status,
|
|
583
|
+
routeId: resolution.routeId,
|
|
584
|
+
providerId: resolution.providerId,
|
|
585
|
+
profileId: resolution.profileId,
|
|
586
|
+
toolName: resolution.toolName
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
]
|
|
591
|
+
]);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
ctx.state.set(state);
|
|
595
|
+
},
|
|
596
|
+
{ name: `${name}/runtime`, factory: "toolProviderPolicyResolutionProjector", partial: true }
|
|
597
|
+
);
|
|
598
|
+
const resolutions = projectRuntimeFact(
|
|
599
|
+
graph,
|
|
600
|
+
runtime,
|
|
601
|
+
`${name}/resolutions`,
|
|
602
|
+
"toolProviderPolicyResolutions",
|
|
603
|
+
(fact) => fact.kind === "resolution" ? fact.resolution : void 0
|
|
604
|
+
);
|
|
605
|
+
const issues = projectRuntimeFact(
|
|
606
|
+
graph,
|
|
607
|
+
runtime,
|
|
608
|
+
`${name}/issues`,
|
|
609
|
+
"toolProviderPolicyResolutionIssues",
|
|
610
|
+
(fact) => fact.kind === "issue" ? fact.issue : void 0
|
|
611
|
+
);
|
|
612
|
+
const audit = projectRuntimeFact(
|
|
613
|
+
graph,
|
|
614
|
+
runtime,
|
|
615
|
+
`${name}/audit`,
|
|
616
|
+
"toolProviderPolicyResolutionAudit",
|
|
617
|
+
(fact) => fact.kind === "audit" ? fact.audit : void 0
|
|
618
|
+
);
|
|
619
|
+
return { resolutions, issues, audit };
|
|
620
|
+
}
|
|
621
|
+
function isPublishableToolProviderExecutionPolicy(policy, providerId) {
|
|
622
|
+
return isRecord(policy) && policy.kind === "tool-provider-execution-policy" && typeof policy.policyId === "string" && policy.policyId.length > 0 && typeof policy.providerId === "string" && policy.providerId.length > 0 && (providerId === void 0 || policy.providerId === providerId) && validateToolProviderExecutionPolicy(policy).length === 0;
|
|
623
|
+
}
|
|
624
|
+
function validateToolProviderPolicyProviderScope(policy, providerId) {
|
|
625
|
+
if (!isRecord(policy)) return [];
|
|
626
|
+
if (policy.providerId === void 0 || policy.providerId === providerId) return [];
|
|
627
|
+
return Object.freeze([
|
|
628
|
+
dataIssue(
|
|
629
|
+
"tool-provider-policy-provider-mismatch",
|
|
630
|
+
"Tool provider policy providerId must match the catalog providerId.",
|
|
631
|
+
{
|
|
632
|
+
subjectId: typeof policy.policyId === "string" ? policy.policyId : void 0,
|
|
633
|
+
refs: [
|
|
634
|
+
ref(
|
|
635
|
+
"tool-provider-execution-policy",
|
|
636
|
+
typeof policy.policyId === "string" && policy.policyId.length > 0 ? policy.policyId : "<missing>"
|
|
637
|
+
),
|
|
638
|
+
ref("tool-provider-catalog", providerId)
|
|
639
|
+
]
|
|
640
|
+
}
|
|
641
|
+
)
|
|
642
|
+
]);
|
|
643
|
+
}
|
|
644
|
+
function policyRefsForProfile(policies, profileId) {
|
|
645
|
+
return Object.freeze(
|
|
646
|
+
policies.filter((policy) => policyAppliesToProfile(policy, profileId)).map((policy) => ref("tool-provider-execution-policy", policy.policyId))
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
function policyRefsForTool(policies, profileId, tool) {
|
|
650
|
+
return Object.freeze(
|
|
651
|
+
policies.filter((policy) => policyAppliesToProfile(policy, profileId)).filter((policy) => policyAppliesToOptionalScope(policy.toolNames, tool.toolName)).filter((policy) => policyAppliesToOptionalScope(policy.operations, tool.operation)).map((policy) => ref("tool-provider-execution-policy", policy.policyId))
|
|
652
|
+
);
|
|
653
|
+
}
|
|
654
|
+
function policyAppliesToProfile(policy, profileId) {
|
|
655
|
+
return policyAppliesToOptionalScope(policy.profileIds, profileId);
|
|
656
|
+
}
|
|
657
|
+
function policyAppliesToOptionalScope(scope, value) {
|
|
658
|
+
return scope === void 0 || scope.length === 0 || value !== void 0 && scope.includes(value);
|
|
659
|
+
}
|
|
660
|
+
function toolCallFromRequest(request) {
|
|
661
|
+
const value = request.input?.value;
|
|
662
|
+
if (request.input?.inputKind !== "tool-call" || !isRecord(value)) return void 0;
|
|
663
|
+
if (value.kind !== "tool-call" || typeof value.toolName !== "string" || value.toolName.length === 0) {
|
|
664
|
+
return void 0;
|
|
665
|
+
}
|
|
666
|
+
return value;
|
|
667
|
+
}
|
|
668
|
+
function resolveToolProviderPolicyForRoute(request, route, toolCall, catalogs) {
|
|
669
|
+
const sourceRefs = Object.freeze([
|
|
670
|
+
ref("agent-request", request.requestId),
|
|
671
|
+
ref("executor-route", route.routeId)
|
|
672
|
+
]);
|
|
673
|
+
const matchingCatalogs = catalogs.filter((catalog2) => catalogHasRouteProfile(catalog2, route));
|
|
674
|
+
if (matchingCatalogs.length === 0) {
|
|
675
|
+
return policyResolutionWithIssue({
|
|
676
|
+
request,
|
|
677
|
+
route,
|
|
678
|
+
toolCall,
|
|
679
|
+
status: "missing-catalog",
|
|
680
|
+
sourceRefs,
|
|
681
|
+
issue: dataIssue(
|
|
682
|
+
"tool-provider-policy-missing-catalog",
|
|
683
|
+
`No tool provider catalog exposes route profile '${route.profileId}'.`,
|
|
684
|
+
{ subjectId: request.requestId, refs: sourceRefs }
|
|
685
|
+
)
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
if (matchingCatalogs.length > 1) {
|
|
689
|
+
return policyResolutionWithIssue({
|
|
690
|
+
request,
|
|
691
|
+
route,
|
|
692
|
+
toolCall,
|
|
693
|
+
status: "ambiguous-catalog",
|
|
694
|
+
sourceRefs,
|
|
695
|
+
issue: dataIssue(
|
|
696
|
+
"tool-provider-policy-ambiguous-catalog",
|
|
697
|
+
`Multiple tool provider catalogs expose route profile '${route.profileId}'.`,
|
|
698
|
+
{
|
|
699
|
+
subjectId: request.requestId,
|
|
700
|
+
refs: [
|
|
701
|
+
...sourceRefs,
|
|
702
|
+
...matchingCatalogs.map((catalog2) => ref("tool-provider-catalog", catalog2.providerId))
|
|
703
|
+
]
|
|
704
|
+
}
|
|
705
|
+
)
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
const catalog = matchingCatalogs[0];
|
|
709
|
+
if (catalog === void 0) throw new Error("unreachable catalog match");
|
|
710
|
+
const tool = catalog.tools.find(
|
|
711
|
+
(entry) => entry.profileId === route.profileId && entry.executorId === route.executorId && entry.toolName === toolCall.toolName && (entry.operation === void 0 || toolCall.operation === void 0 || entry.operation === toolCall.operation)
|
|
712
|
+
);
|
|
713
|
+
if (tool === void 0) {
|
|
714
|
+
return policyResolutionWithIssue({
|
|
715
|
+
request,
|
|
716
|
+
route,
|
|
717
|
+
toolCall,
|
|
718
|
+
status: "missing-tool",
|
|
719
|
+
sourceRefs,
|
|
720
|
+
providerId: catalog.providerId,
|
|
721
|
+
issue: dataIssue(
|
|
722
|
+
"tool-provider-policy-missing-tool",
|
|
723
|
+
`Tool provider catalog '${catalog.providerId}' does not expose requested tool '${toolCall.toolName}'.`,
|
|
724
|
+
{
|
|
725
|
+
subjectId: request.requestId,
|
|
726
|
+
refs: [...sourceRefs, ref("tool-provider-catalog", catalog.providerId)]
|
|
727
|
+
}
|
|
728
|
+
)
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
const policyRefs = policyRefsForResolution(catalog, route, tool);
|
|
732
|
+
if (policyRefs.length === 0) {
|
|
733
|
+
return policyResolutionWithIssue({
|
|
734
|
+
request,
|
|
735
|
+
route,
|
|
736
|
+
toolCall,
|
|
737
|
+
status: "missing-policy",
|
|
738
|
+
sourceRefs,
|
|
739
|
+
providerId: catalog.providerId,
|
|
740
|
+
issue: dataIssue(
|
|
741
|
+
"tool-provider-policy-missing-policy-ref",
|
|
742
|
+
`Tool '${tool.toolName}' has no D360 policy refs on its entry, profile, or catalog.`,
|
|
743
|
+
{
|
|
744
|
+
subjectId: request.requestId,
|
|
745
|
+
refs: [...sourceRefs, ref("tool-provider-catalog", catalog.providerId)]
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
const issues = policyIssuesForRefs(catalog, policyRefs, request, sourceRefs);
|
|
751
|
+
const status = issues.length === 0 ? "resolved" : "invalid-policy";
|
|
752
|
+
return Object.freeze({
|
|
753
|
+
kind: "tool-provider-policy-resolution",
|
|
754
|
+
resolutionId: `${request.requestId}:${request.operationId}:${route.routeId}:tool-policy`,
|
|
755
|
+
status,
|
|
756
|
+
requestId: request.requestId,
|
|
757
|
+
operationId: request.operationId,
|
|
758
|
+
routeId: route.routeId,
|
|
759
|
+
providerId: catalog.providerId,
|
|
760
|
+
executorId: route.executorId,
|
|
761
|
+
profileId: route.profileId,
|
|
762
|
+
toolName: toolCall.toolName,
|
|
763
|
+
operation: toolCall.operation,
|
|
764
|
+
policyRefs,
|
|
765
|
+
issues: issues.length === 0 ? void 0 : Object.freeze(issues),
|
|
766
|
+
sourceRefs: Object.freeze([...sourceRefs, ref("tool-provider-catalog", catalog.providerId)])
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
function catalogHasRouteProfile(catalog, route) {
|
|
770
|
+
return catalog.profiles.some(
|
|
771
|
+
(profile) => profile.profileId === route.profileId && profile.executorId === route.executorId
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
function policyRefsForResolution(catalog, route, tool) {
|
|
775
|
+
const profile = catalog.profiles.find(
|
|
776
|
+
(candidate) => candidate.profileId === route.profileId && candidate.executorId === route.executorId
|
|
777
|
+
);
|
|
778
|
+
return Object.freeze([
|
|
779
|
+
...tool.policyRefs ?? [],
|
|
780
|
+
...(tool.policyRefs?.length ?? 0) === 0 ? profile?.policyRefs ?? [] : [],
|
|
781
|
+
...(tool.policyRefs?.length ?? 0) === 0 && (profile?.policyRefs?.length ?? 0) === 0 ? catalog.policyRefs ?? [] : []
|
|
782
|
+
]);
|
|
783
|
+
}
|
|
784
|
+
function policyIssuesForRefs(catalog, policyRefs, request, sourceRefs) {
|
|
785
|
+
const policiesById = new Map((catalog.policies ?? []).map((policy) => [policy.policyId, policy]));
|
|
786
|
+
const issues = [];
|
|
787
|
+
for (const policyRef of policyRefs) {
|
|
788
|
+
if (policyRef.kind !== "tool-provider-execution-policy") {
|
|
789
|
+
issues.push(
|
|
790
|
+
dataIssue(
|
|
791
|
+
"tool-provider-policy-invalid-ref-kind",
|
|
792
|
+
"Tool provider policy refs must point at ToolProviderExecutionPolicy facts.",
|
|
793
|
+
{ subjectId: request.requestId, refs: [...sourceRefs, policyRef] }
|
|
794
|
+
)
|
|
795
|
+
);
|
|
796
|
+
continue;
|
|
797
|
+
}
|
|
798
|
+
const policy = policiesById.get(policyRef.id);
|
|
799
|
+
if (policy === void 0) {
|
|
800
|
+
issues.push(
|
|
801
|
+
dataIssue(
|
|
802
|
+
"tool-provider-policy-ref-missing-material",
|
|
803
|
+
`Tool provider policy ref '${policyRef.id}' has no policy material in catalog '${catalog.providerId}'.`,
|
|
804
|
+
{ subjectId: request.requestId, refs: [...sourceRefs, policyRef] }
|
|
805
|
+
)
|
|
806
|
+
);
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
issues.push(...validateToolProviderExecutionPolicy(policy));
|
|
810
|
+
issues.push(...validateToolProviderPolicyProviderScope(policy, catalog.providerId));
|
|
811
|
+
}
|
|
812
|
+
return Object.freeze(issues);
|
|
813
|
+
}
|
|
814
|
+
function policyResolutionWithIssue(opts) {
|
|
815
|
+
return Object.freeze({
|
|
816
|
+
kind: "tool-provider-policy-resolution",
|
|
817
|
+
resolutionId: `${opts.request.requestId}:${opts.request.operationId}:${opts.route.routeId}:tool-policy:${opts.status}`,
|
|
818
|
+
status: opts.status,
|
|
819
|
+
requestId: opts.request.requestId,
|
|
820
|
+
operationId: opts.request.operationId,
|
|
821
|
+
routeId: opts.route.routeId,
|
|
822
|
+
providerId: opts.providerId,
|
|
823
|
+
executorId: opts.route.executorId,
|
|
824
|
+
profileId: opts.route.profileId,
|
|
825
|
+
toolName: opts.toolCall.toolName,
|
|
826
|
+
operation: opts.toolCall.operation,
|
|
827
|
+
issues: Object.freeze([opts.issue]),
|
|
828
|
+
sourceRefs: opts.sourceRefs
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
function stableToolProviderPolicyResolutionKey(resolution) {
|
|
832
|
+
return JSON.stringify({
|
|
833
|
+
id: resolution.resolutionId,
|
|
834
|
+
status: resolution.status,
|
|
835
|
+
policyRefs: resolution.policyRefs?.map((policyRef) => `${policyRef.kind}:${policyRef.id}`) ?? [],
|
|
836
|
+
issues: resolution.issues?.map((issue) => issue.code) ?? []
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
function defaultLocalBuiltinToolProviderExecutionPolicy(opts) {
|
|
840
|
+
const toolNames = Object.freeze(Array.from(new Set(opts.tools.map((tool) => tool.toolName))));
|
|
841
|
+
const operations = Object.freeze(
|
|
842
|
+
Array.from(new Set(opts.tools.map((tool) => tool.operation).filter((op) => op !== void 0)))
|
|
843
|
+
);
|
|
844
|
+
const hasUrlFetch = toolNames.includes("url.fetch");
|
|
845
|
+
const filesystemToolNames = toolNames.filter(
|
|
846
|
+
(toolName) => toolName.startsWith("file.") || toolName.startsWith("document/") || toolName === "bash.run"
|
|
847
|
+
);
|
|
848
|
+
const approvalToolNames = toolNames.filter(
|
|
849
|
+
(toolName) => toolName === "file.edit/apply-patch" || toolName === "bash.run"
|
|
850
|
+
);
|
|
851
|
+
const approvalOperations = operations.filter(
|
|
852
|
+
(operation) => operation === "edit" || operation === "run"
|
|
853
|
+
);
|
|
854
|
+
const policy = {
|
|
855
|
+
kind: "tool-provider-execution-policy",
|
|
856
|
+
policyId: `${opts.providerId}:policy:default`,
|
|
857
|
+
providerId: opts.providerId,
|
|
858
|
+
profileIds: Object.freeze([opts.profileId]),
|
|
859
|
+
toolNames,
|
|
860
|
+
operations,
|
|
861
|
+
sizeCapacity: Object.freeze({
|
|
862
|
+
limits: Object.freeze([
|
|
863
|
+
Object.freeze({
|
|
864
|
+
unit: "chars",
|
|
865
|
+
softLimit: 16384,
|
|
866
|
+
hardLimit: 65536,
|
|
867
|
+
perRequest: true,
|
|
868
|
+
measurementSource: "adapter-estimated"
|
|
869
|
+
}),
|
|
870
|
+
Object.freeze({
|
|
871
|
+
unit: "bytes",
|
|
872
|
+
softLimit: 1048576,
|
|
873
|
+
hardLimit: 8388608,
|
|
874
|
+
perArtifact: true,
|
|
875
|
+
measurementSource: "adapter-measured"
|
|
876
|
+
}),
|
|
877
|
+
Object.freeze({
|
|
878
|
+
unit: "lines",
|
|
879
|
+
softLimit: 2e3,
|
|
880
|
+
hardLimit: 1e4,
|
|
881
|
+
perStream: true,
|
|
882
|
+
measurementSource: "adapter-measured"
|
|
883
|
+
})
|
|
884
|
+
])
|
|
885
|
+
}),
|
|
886
|
+
timeout: Object.freeze({
|
|
887
|
+
timeoutMs: 3e4,
|
|
888
|
+
idleTimeoutMs: 5e3
|
|
889
|
+
}),
|
|
890
|
+
redaction: Object.freeze({
|
|
891
|
+
mode: "summary",
|
|
892
|
+
sensitivity: Object.freeze(["private-material", "auth-material", "personal-data"]),
|
|
893
|
+
summaryMaxChars: 512
|
|
894
|
+
}),
|
|
895
|
+
...filesystemToolNames.length > 0 ? {
|
|
896
|
+
filesystem: Object.freeze({
|
|
897
|
+
cwd: ".",
|
|
898
|
+
allowRead: true,
|
|
899
|
+
allowWrite: false,
|
|
900
|
+
followSymlinks: false,
|
|
901
|
+
sourceRefs: Object.freeze(filesystemToolNames.map((toolName) => ref("tool", toolName))),
|
|
902
|
+
pathRules: Object.freeze([
|
|
903
|
+
Object.freeze({
|
|
904
|
+
effect: "allow",
|
|
905
|
+
path: ".",
|
|
906
|
+
operation: "read",
|
|
907
|
+
reason: "Default local builtin catalog is workspace-relative data material."
|
|
908
|
+
}),
|
|
909
|
+
Object.freeze({
|
|
910
|
+
effect: "deny",
|
|
911
|
+
glob: "**/.env*",
|
|
912
|
+
reason: "D360 policies keep private material outside catalog DATA."
|
|
913
|
+
})
|
|
914
|
+
])
|
|
915
|
+
})
|
|
916
|
+
} : {},
|
|
917
|
+
...hasUrlFetch ? {
|
|
918
|
+
network: Object.freeze({
|
|
919
|
+
mode: "custom",
|
|
920
|
+
protocols: Object.freeze(["https:"]),
|
|
921
|
+
allowedHosts: Object.freeze(["*"]),
|
|
922
|
+
sourceRefs: Object.freeze([ref("tool", "url.fetch")])
|
|
923
|
+
})
|
|
924
|
+
} : {},
|
|
925
|
+
approval: Object.freeze({
|
|
926
|
+
mode: approvalToolNames.length > 0 ? "require" : "auto",
|
|
927
|
+
...approvalToolNames.length > 0 ? { requiredForToolNames: Object.freeze(approvalToolNames) } : {},
|
|
928
|
+
...approvalOperations.length > 0 ? { requiredForOperations: Object.freeze(approvalOperations) } : {}
|
|
929
|
+
}),
|
|
930
|
+
artifacts: Object.freeze({
|
|
931
|
+
defaultDataMode: "summary",
|
|
932
|
+
artifactKinds: Object.freeze([
|
|
933
|
+
"text",
|
|
934
|
+
"markdown",
|
|
935
|
+
"file",
|
|
936
|
+
"stdout",
|
|
937
|
+
"stderr",
|
|
938
|
+
"tool-output",
|
|
939
|
+
"provider-raw"
|
|
940
|
+
]),
|
|
941
|
+
inlineLimits: Object.freeze([
|
|
942
|
+
Object.freeze({
|
|
943
|
+
unit: "chars",
|
|
944
|
+
hardLimit: 4096,
|
|
945
|
+
perArtifact: true,
|
|
946
|
+
measurementSource: "adapter-estimated"
|
|
947
|
+
})
|
|
948
|
+
]),
|
|
949
|
+
requireDigest: false
|
|
950
|
+
}),
|
|
951
|
+
sourceRefs: Object.freeze([ref("decision", "D360"), ref("tool-provider", opts.providerId)]),
|
|
952
|
+
metadata: Object.freeze({
|
|
953
|
+
description: "Default data-only policy material for local builtin tools."
|
|
954
|
+
}),
|
|
955
|
+
...unlockedToolProviderPolicyOverrides(opts.overrides)
|
|
956
|
+
};
|
|
957
|
+
return Object.freeze(policy);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
// src/orchestration/agent-runtime-tool-provider-input.ts
|
|
961
|
+
function buildToolProviderAdapterInputs(opts) {
|
|
962
|
+
const requestsById = new Map(opts.requests.map((request) => [request.requestId, request]));
|
|
963
|
+
const routesById = new Map((opts.routes ?? []).map((route) => [route.routeId, route]));
|
|
964
|
+
const catalogsById = new Map(
|
|
965
|
+
(opts.catalogs ?? []).map((catalog) => [catalog.providerId, catalog])
|
|
966
|
+
);
|
|
967
|
+
return Object.freeze(
|
|
968
|
+
opts.resolutions.map(
|
|
969
|
+
(resolution) => buildToolProviderAdapterInput({
|
|
970
|
+
resolution,
|
|
971
|
+
request: requestsById.get(resolution.requestId),
|
|
972
|
+
route: resolution.routeId === void 0 ? void 0 : routesById.get(resolution.routeId),
|
|
973
|
+
catalog: resolution.providerId === void 0 ? void 0 : catalogsById.get(resolution.providerId)
|
|
974
|
+
})
|
|
975
|
+
)
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
function toolProviderAdapterInputProjector(graph, opts) {
|
|
979
|
+
const name = opts.name ?? "toolProviderAdapterInput";
|
|
980
|
+
const routeDeps = opts.executorRoutes ?? [];
|
|
981
|
+
const catalogDeps = opts.toolProviderCatalogs ?? [];
|
|
982
|
+
const routeStart = 1;
|
|
983
|
+
const catalogStart = routeStart + routeDeps.length;
|
|
984
|
+
const resolutionStart = catalogStart + catalogDeps.length;
|
|
985
|
+
const runtime = graph.node(
|
|
986
|
+
[opts.requestFacts, ...routeDeps, ...catalogDeps, ...opts.policyResolutions],
|
|
987
|
+
(ctx) => {
|
|
988
|
+
const state = ctx.state.get() ?? {
|
|
989
|
+
requests: /* @__PURE__ */ new Map(),
|
|
990
|
+
routes: /* @__PURE__ */ new Map(),
|
|
991
|
+
catalogs: /* @__PURE__ */ new Map(),
|
|
992
|
+
resolutions: /* @__PURE__ */ new Map(),
|
|
993
|
+
emittedKeys: /* @__PURE__ */ new Set(),
|
|
994
|
+
auditSeq: 0
|
|
995
|
+
};
|
|
996
|
+
for (const raw of depBatch(ctx, 0) ?? []) {
|
|
997
|
+
const fact = raw;
|
|
998
|
+
if (fact.kind === "issued" && fact.input?.inputKind === "tool-call") {
|
|
999
|
+
state.requests.set(fact.requestId, fact);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
forEachDepBatch(ctx, routeStart, routeDeps.length, (raw) => {
|
|
1003
|
+
const route = raw;
|
|
1004
|
+
state.routes.set(route.routeId, route);
|
|
1005
|
+
});
|
|
1006
|
+
forEachDepBatch(ctx, catalogStart, catalogDeps.length, (raw) => {
|
|
1007
|
+
const catalog = raw;
|
|
1008
|
+
state.catalogs.set(catalog.providerId, catalog);
|
|
1009
|
+
});
|
|
1010
|
+
forEachDepBatch(ctx, resolutionStart, opts.policyResolutions.length, (raw) => {
|
|
1011
|
+
const resolution = raw;
|
|
1012
|
+
state.resolutions.set(resolution.resolutionId, resolution);
|
|
1013
|
+
});
|
|
1014
|
+
const inputs2 = buildToolProviderAdapterInputs({
|
|
1015
|
+
requests: Array.from(state.requests.values()),
|
|
1016
|
+
routes: Array.from(state.routes.values()),
|
|
1017
|
+
catalogs: Array.from(state.catalogs.values()),
|
|
1018
|
+
resolutions: Array.from(state.resolutions.values())
|
|
1019
|
+
});
|
|
1020
|
+
for (const input of inputs2) {
|
|
1021
|
+
const key = stableToolProviderAdapterInputKey(input);
|
|
1022
|
+
if (state.emittedKeys.has(key)) continue;
|
|
1023
|
+
state.emittedKeys.add(key);
|
|
1024
|
+
ctx.down([["DATA", { kind: "input", input }]]);
|
|
1025
|
+
for (const issue of input.issues ?? []) {
|
|
1026
|
+
ctx.down([["DATA", { kind: "issue", issue }]]);
|
|
1027
|
+
}
|
|
1028
|
+
state.auditSeq += 1;
|
|
1029
|
+
ctx.down([
|
|
1030
|
+
[
|
|
1031
|
+
"DATA",
|
|
1032
|
+
{
|
|
1033
|
+
kind: "audit",
|
|
1034
|
+
audit: {
|
|
1035
|
+
id: `${name}:audit:${state.auditSeq}`,
|
|
1036
|
+
kind: "tool-provider-adapter-input",
|
|
1037
|
+
subjectId: input.requestId,
|
|
1038
|
+
sourceRefs: input.sourceRefs,
|
|
1039
|
+
metadata: {
|
|
1040
|
+
status: input.status,
|
|
1041
|
+
routeId: input.routeId,
|
|
1042
|
+
providerId: input.providerId,
|
|
1043
|
+
profileId: input.profileId,
|
|
1044
|
+
toolName: input.toolName
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
]
|
|
1049
|
+
]);
|
|
1050
|
+
}
|
|
1051
|
+
ctx.state.set(state);
|
|
1052
|
+
},
|
|
1053
|
+
{ name: `${name}/runtime`, factory: "toolProviderAdapterInputProjector", partial: true }
|
|
1054
|
+
);
|
|
1055
|
+
const inputs = projectRuntimeFact(
|
|
1056
|
+
graph,
|
|
1057
|
+
runtime,
|
|
1058
|
+
`${name}/inputs`,
|
|
1059
|
+
"toolProviderAdapterInputs",
|
|
1060
|
+
(fact) => fact.kind === "input" ? fact.input : void 0
|
|
1061
|
+
);
|
|
1062
|
+
const issues = projectRuntimeFact(
|
|
1063
|
+
graph,
|
|
1064
|
+
runtime,
|
|
1065
|
+
`${name}/issues`,
|
|
1066
|
+
"toolProviderAdapterInputIssues",
|
|
1067
|
+
(fact) => fact.kind === "issue" ? fact.issue : void 0
|
|
1068
|
+
);
|
|
1069
|
+
const audit = projectRuntimeFact(
|
|
1070
|
+
graph,
|
|
1071
|
+
runtime,
|
|
1072
|
+
`${name}/audit`,
|
|
1073
|
+
"toolProviderAdapterInputAudit",
|
|
1074
|
+
(fact) => fact.kind === "audit" ? fact.audit : void 0
|
|
1075
|
+
);
|
|
1076
|
+
return { inputs, issues, audit };
|
|
1077
|
+
}
|
|
1078
|
+
function buildToolProviderAdapterInput(opts) {
|
|
1079
|
+
const { resolution, request, route, catalog } = opts;
|
|
1080
|
+
const sourceRefs = sanitizeAdapterInputSourceRefs([
|
|
1081
|
+
ref("tool-provider-policy-resolution", resolution.resolutionId),
|
|
1082
|
+
...resolution.sourceRefs ?? [],
|
|
1083
|
+
...resolution.routeId === void 0 ? [] : [ref("executor-route", resolution.routeId)],
|
|
1084
|
+
...resolution.providerId === void 0 ? [] : [ref("tool-provider-catalog", resolution.providerId)],
|
|
1085
|
+
...resolution.policyRefs ?? []
|
|
1086
|
+
]);
|
|
1087
|
+
const issues = (resolution.issues ?? []).map(
|
|
1088
|
+
(issue) => sanitizeAdapterInputIssue(issue)
|
|
1089
|
+
);
|
|
1090
|
+
let statusOverride;
|
|
1091
|
+
if (request === void 0) {
|
|
1092
|
+
issues.push(
|
|
1093
|
+
dataIssue(
|
|
1094
|
+
"tool-provider-adapter-input-missing-request",
|
|
1095
|
+
"Tool provider adapter input requires the issued AgentRequest fact.",
|
|
1096
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1097
|
+
)
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
if (request !== void 0 && request.requestId !== resolution.requestId) {
|
|
1101
|
+
issues.push(
|
|
1102
|
+
dataIssue(
|
|
1103
|
+
"tool-provider-adapter-input-stale-request",
|
|
1104
|
+
"Tool provider adapter input request identity does not match its policy resolution.",
|
|
1105
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1106
|
+
)
|
|
1107
|
+
);
|
|
1108
|
+
}
|
|
1109
|
+
if (request !== void 0 && request.operationId !== resolution.operationId) {
|
|
1110
|
+
issues.push(
|
|
1111
|
+
dataIssue(
|
|
1112
|
+
"tool-provider-adapter-input-stale-request-operation",
|
|
1113
|
+
"Tool provider adapter input request operationId does not match its policy resolution.",
|
|
1114
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1115
|
+
)
|
|
1116
|
+
);
|
|
1117
|
+
}
|
|
1118
|
+
if (resolution.routeId !== void 0 && route === void 0) {
|
|
1119
|
+
issues.push(
|
|
1120
|
+
dataIssue(
|
|
1121
|
+
"tool-provider-adapter-input-missing-route",
|
|
1122
|
+
"Tool provider adapter input requires the selected ExecutorRoute fact.",
|
|
1123
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1124
|
+
)
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
1127
|
+
if (route !== void 0) {
|
|
1128
|
+
issues.push(...routeIdentityIssuesForAdapterInput(route, resolution, request, sourceRefs));
|
|
1129
|
+
}
|
|
1130
|
+
if (resolution.providerId !== void 0 && catalog === void 0) {
|
|
1131
|
+
issues.push(
|
|
1132
|
+
dataIssue(
|
|
1133
|
+
"tool-provider-adapter-input-missing-catalog",
|
|
1134
|
+
"Tool provider adapter input requires the selected ToolProviderCatalog fact.",
|
|
1135
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1136
|
+
)
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
if (catalog !== void 0 && catalog.status !== void 0 && catalog.status !== "ready") {
|
|
1140
|
+
statusOverride = "invalid-policy";
|
|
1141
|
+
issues.push(
|
|
1142
|
+
dataIssue(
|
|
1143
|
+
"tool-provider-adapter-input-catalog-unavailable",
|
|
1144
|
+
"Tool provider adapter input requires a ready ToolProviderCatalog.",
|
|
1145
|
+
{
|
|
1146
|
+
subjectId: resolution.requestId,
|
|
1147
|
+
refs: [...sourceRefs, ref("tool-provider-catalog", catalog.providerId)],
|
|
1148
|
+
details: { status: catalog.status }
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1151
|
+
);
|
|
1152
|
+
issues.push(...(catalog.issues ?? []).map((issue) => sanitizeAdapterInputIssue(issue)));
|
|
1153
|
+
}
|
|
1154
|
+
const toolCall = request === void 0 ? void 0 : toolCallFromRequest(request);
|
|
1155
|
+
if (request !== void 0 && toolCall === void 0) {
|
|
1156
|
+
issues.push(
|
|
1157
|
+
dataIssue(
|
|
1158
|
+
"tool-provider-adapter-input-missing-tool-call",
|
|
1159
|
+
"Tool provider adapter input requires AgentRequest input.value to be a ToolCallInput.",
|
|
1160
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1161
|
+
)
|
|
1162
|
+
);
|
|
1163
|
+
}
|
|
1164
|
+
const tool = catalog === void 0 || route === void 0 || toolCall === void 0 ? void 0 : selectedToolForAdapterInput(catalog, route, toolCall);
|
|
1165
|
+
if (resolution.status === "resolved" && tool === void 0) {
|
|
1166
|
+
issues.push(
|
|
1167
|
+
dataIssue(
|
|
1168
|
+
"tool-provider-adapter-input-missing-tool",
|
|
1169
|
+
"Tool provider adapter input requires the selected catalog tool entry.",
|
|
1170
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1171
|
+
)
|
|
1172
|
+
);
|
|
1173
|
+
}
|
|
1174
|
+
const policies = catalog === void 0 ? [] : selectedPoliciesForAdapterInput(catalog, resolution.policyRefs ?? []);
|
|
1175
|
+
if (resolution.status === "resolved" && (resolution.policyRefs?.length ?? 0) === 0) {
|
|
1176
|
+
statusOverride = "missing-policy";
|
|
1177
|
+
issues.push(
|
|
1178
|
+
dataIssue(
|
|
1179
|
+
"tool-provider-adapter-input-missing-policy-ref",
|
|
1180
|
+
"Ready tool provider adapter input requires at least one D360 policy ref.",
|
|
1181
|
+
{ subjectId: resolution.requestId, refs: sourceRefs }
|
|
1182
|
+
)
|
|
1183
|
+
);
|
|
1184
|
+
}
|
|
1185
|
+
if (catalog !== void 0) {
|
|
1186
|
+
for (const issue of policyMaterialIssuesForAdapterInput(catalog, resolution, sourceRefs)) {
|
|
1187
|
+
statusOverride ??= "invalid-policy";
|
|
1188
|
+
issues.push(issue);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
for (const policy of policies) {
|
|
1192
|
+
issues.push(...validateToolProviderExecutionPolicy(policy));
|
|
1193
|
+
if (catalog !== void 0)
|
|
1194
|
+
issues.push(...validateToolProviderPolicyProviderScope(policy, catalog.providerId));
|
|
1195
|
+
}
|
|
1196
|
+
if (request?.input !== void 0) {
|
|
1197
|
+
issues.push(
|
|
1198
|
+
...forbiddenAdapterInputMaterialIssues(
|
|
1199
|
+
request.input,
|
|
1200
|
+
ref("agent-request", request.requestId),
|
|
1201
|
+
"request-input"
|
|
1202
|
+
)
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
if (route !== void 0) {
|
|
1206
|
+
issues.push(
|
|
1207
|
+
...forbiddenAdapterInputMaterialIssues(
|
|
1208
|
+
route.allowedParams,
|
|
1209
|
+
ref("executor-route", route.routeId),
|
|
1210
|
+
"route-allowed-params"
|
|
1211
|
+
),
|
|
1212
|
+
...forbiddenAdapterInputMaterialIssues(
|
|
1213
|
+
route.metadata,
|
|
1214
|
+
ref("executor-route", route.routeId),
|
|
1215
|
+
"route-metadata"
|
|
1216
|
+
)
|
|
1217
|
+
);
|
|
1218
|
+
}
|
|
1219
|
+
if (tool !== void 0) {
|
|
1220
|
+
const toolRef = ref("tool", tool.toolName);
|
|
1221
|
+
issues.push(
|
|
1222
|
+
...forbiddenAdapterInputMaterialIssues(tool.capabilities, toolRef, "tool-capabilities"),
|
|
1223
|
+
...forbiddenAdapterInputMaterialIssues(tool.limits, toolRef, "tool-limits"),
|
|
1224
|
+
...forbiddenAdapterInputMaterialIssues(tool.metadata, toolRef, "tool-metadata")
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
for (const policy of policies) {
|
|
1228
|
+
issues.push(
|
|
1229
|
+
...forbiddenAdapterInputMaterialIssues(
|
|
1230
|
+
policy,
|
|
1231
|
+
ref("tool-provider-execution-policy", policy.policyId),
|
|
1232
|
+
"policy-material"
|
|
1233
|
+
)
|
|
1234
|
+
);
|
|
1235
|
+
}
|
|
1236
|
+
const status = resolution.status === "resolved" ? issues.length === 0 ? "ready" : statusOverride ?? "invalid-policy" : resolution.status;
|
|
1237
|
+
const ready = status === "ready";
|
|
1238
|
+
const candidate = {
|
|
1239
|
+
kind: "tool-provider-adapter-input",
|
|
1240
|
+
adapterInputId: `${resolution.requestId}:${resolution.operationId}:${resolution.routeId ?? resolution.resolutionId}:adapter-input`,
|
|
1241
|
+
status,
|
|
1242
|
+
requestId: resolution.requestId,
|
|
1243
|
+
operationId: resolution.operationId,
|
|
1244
|
+
effectRunId: request?.effectRunId,
|
|
1245
|
+
agentRunId: request?.agentRunId,
|
|
1246
|
+
routeId: resolution.routeId,
|
|
1247
|
+
providerId: resolution.providerId,
|
|
1248
|
+
executorId: resolution.executorId,
|
|
1249
|
+
profileId: resolution.profileId,
|
|
1250
|
+
toolName: resolution.toolName,
|
|
1251
|
+
operation: resolution.operation,
|
|
1252
|
+
input: ready ? request?.input : void 0,
|
|
1253
|
+
toolCall: ready ? toolCall : void 0,
|
|
1254
|
+
route: ready ? route : void 0,
|
|
1255
|
+
tool: ready ? tool : void 0,
|
|
1256
|
+
policies: ready ? Object.freeze(policies) : void 0,
|
|
1257
|
+
policyRefs: sanitizeAdapterInputSourceRefs(resolution.policyRefs ?? []),
|
|
1258
|
+
sourceRefs,
|
|
1259
|
+
issues: issues.length === 0 ? void 0 : Object.freeze(issues),
|
|
1260
|
+
metadata: { resolutionId: resolution.resolutionId }
|
|
1261
|
+
};
|
|
1262
|
+
if (ready) {
|
|
1263
|
+
const candidateIssues = forbiddenAdapterInputMaterialIssues(
|
|
1264
|
+
candidate,
|
|
1265
|
+
ref("tool-provider-adapter-input", candidate.adapterInputId),
|
|
1266
|
+
"adapter-input"
|
|
1267
|
+
);
|
|
1268
|
+
if (candidateIssues.length > 0) {
|
|
1269
|
+
const blockedIssues = Object.freeze([...issues, ...candidateIssues]);
|
|
1270
|
+
return Object.freeze({
|
|
1271
|
+
...candidate,
|
|
1272
|
+
status: "invalid-policy",
|
|
1273
|
+
input: void 0,
|
|
1274
|
+
toolCall: void 0,
|
|
1275
|
+
route: void 0,
|
|
1276
|
+
tool: void 0,
|
|
1277
|
+
policies: void 0,
|
|
1278
|
+
issues: blockedIssues
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
return Object.freeze(candidate);
|
|
1283
|
+
}
|
|
1284
|
+
function selectedToolForAdapterInput(catalog, route, toolCall) {
|
|
1285
|
+
return catalog.tools.find(
|
|
1286
|
+
(entry) => entry.profileId === route.profileId && entry.executorId === route.executorId && entry.toolName === toolCall.toolName && (entry.operation === void 0 || toolCall.operation === void 0 || entry.operation === toolCall.operation)
|
|
1287
|
+
);
|
|
1288
|
+
}
|
|
1289
|
+
function selectedPoliciesForAdapterInput(catalog, policyRefs) {
|
|
1290
|
+
const policiesById = new Map((catalog.policies ?? []).map((policy) => [policy.policyId, policy]));
|
|
1291
|
+
const policies = [];
|
|
1292
|
+
for (const policyRef of policyRefs) {
|
|
1293
|
+
if (policyRef.kind !== "tool-provider-execution-policy") continue;
|
|
1294
|
+
const policy = policiesById.get(policyRef.id);
|
|
1295
|
+
if (policy !== void 0) policies.push(policy);
|
|
1296
|
+
}
|
|
1297
|
+
return policies;
|
|
1298
|
+
}
|
|
1299
|
+
function routeIdentityIssuesForAdapterInput(route, resolution, request, sourceRefs) {
|
|
1300
|
+
const issues = [];
|
|
1301
|
+
const refs = [...sourceRefs, ref("executor-route", route.routeId)];
|
|
1302
|
+
if (route.requestId !== resolution.requestId) {
|
|
1303
|
+
issues.push(
|
|
1304
|
+
dataIssue(
|
|
1305
|
+
"tool-provider-adapter-input-stale-route-request",
|
|
1306
|
+
"ExecutorRoute requestId does not match the tool provider policy resolution.",
|
|
1307
|
+
{ subjectId: resolution.requestId, refs }
|
|
1308
|
+
)
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1311
|
+
if (route.operationId !== resolution.operationId) {
|
|
1312
|
+
issues.push(
|
|
1313
|
+
dataIssue(
|
|
1314
|
+
"tool-provider-adapter-input-stale-route-operation",
|
|
1315
|
+
"ExecutorRoute operationId does not match the tool provider policy resolution.",
|
|
1316
|
+
{ subjectId: resolution.requestId, refs }
|
|
1317
|
+
)
|
|
1318
|
+
);
|
|
1319
|
+
}
|
|
1320
|
+
if (resolution.routeId !== void 0 && route.routeId !== resolution.routeId) {
|
|
1321
|
+
issues.push(
|
|
1322
|
+
dataIssue(
|
|
1323
|
+
"tool-provider-adapter-input-stale-route-id",
|
|
1324
|
+
"ExecutorRoute routeId does not match the tool provider policy resolution.",
|
|
1325
|
+
{ subjectId: resolution.requestId, refs }
|
|
1326
|
+
)
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
if (resolution.executorId !== void 0 && route.executorId !== resolution.executorId) {
|
|
1330
|
+
issues.push(
|
|
1331
|
+
dataIssue(
|
|
1332
|
+
"tool-provider-adapter-input-stale-route-executor",
|
|
1333
|
+
"ExecutorRoute executorId does not match the tool provider policy resolution.",
|
|
1334
|
+
{ subjectId: resolution.requestId, refs }
|
|
1335
|
+
)
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
if (resolution.profileId !== void 0 && route.profileId !== resolution.profileId) {
|
|
1339
|
+
issues.push(
|
|
1340
|
+
dataIssue(
|
|
1341
|
+
"tool-provider-adapter-input-stale-route-profile",
|
|
1342
|
+
"ExecutorRoute profileId does not match the tool provider policy resolution.",
|
|
1343
|
+
{ subjectId: resolution.requestId, refs }
|
|
1344
|
+
)
|
|
1345
|
+
);
|
|
1346
|
+
}
|
|
1347
|
+
if (request !== void 0 && route.inputId !== void 0 && route.inputId !== request.input?.inputId) {
|
|
1348
|
+
issues.push(
|
|
1349
|
+
dataIssue(
|
|
1350
|
+
"tool-provider-adapter-input-stale-route-input",
|
|
1351
|
+
"ExecutorRoute inputId does not match the issued AgentRequest input.",
|
|
1352
|
+
{ subjectId: resolution.requestId, refs }
|
|
1353
|
+
)
|
|
1354
|
+
);
|
|
1355
|
+
}
|
|
1356
|
+
if (route.inputKind !== void 0 && route.inputKind !== "tool-call") {
|
|
1357
|
+
issues.push(
|
|
1358
|
+
dataIssue(
|
|
1359
|
+
"tool-provider-adapter-input-invalid-route-input-kind",
|
|
1360
|
+
"Tool provider adapter input requires ExecutorRoute.inputKind to be tool-call when present.",
|
|
1361
|
+
{ subjectId: resolution.requestId, refs }
|
|
1362
|
+
)
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
if (request !== void 0 && route.inputKind !== void 0 && request.input?.inputKind !== void 0 && route.inputKind !== request.input.inputKind) {
|
|
1366
|
+
issues.push(
|
|
1367
|
+
dataIssue(
|
|
1368
|
+
"tool-provider-adapter-input-stale-route-input-kind",
|
|
1369
|
+
"ExecutorRoute inputKind does not match the issued AgentRequest input.",
|
|
1370
|
+
{ subjectId: resolution.requestId, refs }
|
|
1371
|
+
)
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
return Object.freeze(issues);
|
|
1375
|
+
}
|
|
1376
|
+
function policyMaterialIssuesForAdapterInput(catalog, resolution, sourceRefs) {
|
|
1377
|
+
const policiesById = new Map((catalog.policies ?? []).map((policy) => [policy.policyId, policy]));
|
|
1378
|
+
const issues = [];
|
|
1379
|
+
for (const policyRef of resolution.policyRefs ?? []) {
|
|
1380
|
+
if (policyRef.kind !== "tool-provider-execution-policy") {
|
|
1381
|
+
issues.push(
|
|
1382
|
+
dataIssue(
|
|
1383
|
+
"tool-provider-adapter-input-invalid-policy-ref-kind",
|
|
1384
|
+
"Tool provider adapter input policy refs must point at ToolProviderExecutionPolicy facts.",
|
|
1385
|
+
{ subjectId: resolution.requestId, refs: [...sourceRefs, policyRef] }
|
|
1386
|
+
)
|
|
1387
|
+
);
|
|
1388
|
+
continue;
|
|
1389
|
+
}
|
|
1390
|
+
if (!policiesById.has(policyRef.id)) {
|
|
1391
|
+
issues.push(
|
|
1392
|
+
dataIssue(
|
|
1393
|
+
"tool-provider-adapter-input-policy-ref-missing-material",
|
|
1394
|
+
"Tool provider adapter input policy ref has no selected policy material.",
|
|
1395
|
+
{ subjectId: resolution.requestId, refs: [...sourceRefs, policyRef] }
|
|
1396
|
+
)
|
|
1397
|
+
);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
return Object.freeze(issues);
|
|
1401
|
+
}
|
|
1402
|
+
function stableToolProviderAdapterInputKey(input) {
|
|
1403
|
+
return stableJsonStringify({
|
|
1404
|
+
id: input.adapterInputId,
|
|
1405
|
+
status: input.status,
|
|
1406
|
+
policyRefs: input.policyRefs?.map((policyRef) => `${policyRef.kind}:${policyRef.id}`) ?? [],
|
|
1407
|
+
issues: input.issues?.map((issue) => issue.code) ?? [],
|
|
1408
|
+
input
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
export {
|
|
1413
|
+
executorOutcomeViewProjector,
|
|
1414
|
+
localBuiltinToolProviderCatalog,
|
|
1415
|
+
validateToolProviderExecutionPolicy,
|
|
1416
|
+
resolveToolProviderExecutionPolicies,
|
|
1417
|
+
toolProviderPolicyResolutionProjector,
|
|
1418
|
+
buildToolProviderAdapterInputs,
|
|
1419
|
+
toolProviderAdapterInputProjector
|
|
1420
|
+
};
|
|
1421
|
+
//# sourceMappingURL=chunk-MTELVIYR.js.map
|