@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,1320 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adapterRuntimeIssue,
|
|
3
|
+
agentRequestStatusForExecutorOutcome,
|
|
4
|
+
buildToolProviderExecutorOutcome,
|
|
5
|
+
defaultToolProviderAdapterEvidenceRefs,
|
|
6
|
+
normalizeToolProviderAdapterBindings,
|
|
7
|
+
outcomeIssues,
|
|
8
|
+
runRequestIdentityIssues,
|
|
9
|
+
toolProviderAdapterRunProjectorInternal
|
|
10
|
+
} from "./chunk-7GOTIIQ7.js";
|
|
11
|
+
import {
|
|
12
|
+
boundPublicText,
|
|
13
|
+
canonicalPublicSourceRefs,
|
|
14
|
+
dataIssue,
|
|
15
|
+
isPlainRecord,
|
|
16
|
+
isRecord,
|
|
17
|
+
maxPublicMetadataStringChars,
|
|
18
|
+
publicMaterialForbiddenKeys,
|
|
19
|
+
ref,
|
|
20
|
+
sanitizeAdapterInputIssue,
|
|
21
|
+
sanitizeAdapterInputSourceRefs,
|
|
22
|
+
sanitizeGraphVisibleRecord,
|
|
23
|
+
sanitizeProviderGraphVisibleRecord,
|
|
24
|
+
stableStringHash
|
|
25
|
+
} from "./chunk-TQPCAIQI.js";
|
|
26
|
+
import {
|
|
27
|
+
PolicyInputs,
|
|
28
|
+
selectRetentionVictims,
|
|
29
|
+
trimHeadOverflow
|
|
30
|
+
} from "./chunk-6E76H4OU.js";
|
|
31
|
+
import {
|
|
32
|
+
Node
|
|
33
|
+
} from "./chunk-SHZDP2MQ.js";
|
|
34
|
+
|
|
35
|
+
// src/orchestration/agent-runtime-adapter-retention.ts
|
|
36
|
+
var RuntimeRetentionIndex = class {
|
|
37
|
+
items = /* @__PURE__ */ new Map();
|
|
38
|
+
get size() {
|
|
39
|
+
return this.items.size;
|
|
40
|
+
}
|
|
41
|
+
get(key) {
|
|
42
|
+
return this.items.get(key);
|
|
43
|
+
}
|
|
44
|
+
has(key) {
|
|
45
|
+
return this.items.has(key);
|
|
46
|
+
}
|
|
47
|
+
set(key, entry, value) {
|
|
48
|
+
const item = { key, entry, value };
|
|
49
|
+
this.items.set(key, item);
|
|
50
|
+
return item;
|
|
51
|
+
}
|
|
52
|
+
delete(key) {
|
|
53
|
+
const item = this.items.get(key);
|
|
54
|
+
if (item !== void 0) this.items.delete(key);
|
|
55
|
+
return item;
|
|
56
|
+
}
|
|
57
|
+
trimFifo(maxSize) {
|
|
58
|
+
const items = Array.from(this.items.values()).sort(
|
|
59
|
+
(a, b) => a.entry.sequence - b.entry.sequence
|
|
60
|
+
);
|
|
61
|
+
return trimHeadOverflow(items, { maxSize }).map((item) => this.delete(item.key)).filter((item) => item !== void 0);
|
|
62
|
+
}
|
|
63
|
+
trimScored(maxSize, score) {
|
|
64
|
+
const scored = [];
|
|
65
|
+
for (const item of this.items.values()) {
|
|
66
|
+
let value;
|
|
67
|
+
try {
|
|
68
|
+
value = score(item.entry);
|
|
69
|
+
} catch {
|
|
70
|
+
return { invalid: "threw" };
|
|
71
|
+
}
|
|
72
|
+
if (!Number.isFinite(value)) return { invalid: "non-finite" };
|
|
73
|
+
scored.push({ entry: item, score: value });
|
|
74
|
+
}
|
|
75
|
+
const victims = selectRetentionVictims(scored, { maxSize }).map(
|
|
76
|
+
(item) => this.delete(item.key)
|
|
77
|
+
);
|
|
78
|
+
return {
|
|
79
|
+
victims: victims.filter((item) => item !== void 0)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var toolProviderAdapterRuntimeRetentionIndexes = Object.freeze([
|
|
84
|
+
"adapterInputs",
|
|
85
|
+
"runRequests",
|
|
86
|
+
"executions",
|
|
87
|
+
"runStatuses",
|
|
88
|
+
"runIssues",
|
|
89
|
+
"retentionEvidence"
|
|
90
|
+
]);
|
|
91
|
+
function toolProviderAdapterRuntimeRetentionIndex(value) {
|
|
92
|
+
return toolProviderAdapterRuntimeRetentionIndexes.find((index) => index === value);
|
|
93
|
+
}
|
|
94
|
+
function isNodeOpt(value) {
|
|
95
|
+
return value instanceof Node;
|
|
96
|
+
}
|
|
97
|
+
function retentionIndexSourceRef(index) {
|
|
98
|
+
return { kind: "tool-provider-adapter-runtime-retention-index", id: index };
|
|
99
|
+
}
|
|
100
|
+
function runtimeEvidenceSourceRefs(index, refs = []) {
|
|
101
|
+
return canonicalPublicSourceRefs([...refs, retentionIndexSourceRef(index)]);
|
|
102
|
+
}
|
|
103
|
+
function runtimeEvidenceMetadata(index, opts = {}) {
|
|
104
|
+
return {
|
|
105
|
+
index,
|
|
106
|
+
...opts.key === void 0 ? {} : { key: runtimeDiagnosticKey(opts.key) },
|
|
107
|
+
...opts.extra ?? {}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function runtimeDiagnosticKey(key) {
|
|
111
|
+
return `key:${stableStringHash(key)}:${key.length}`;
|
|
112
|
+
}
|
|
113
|
+
var maxRuntimeRetentionScorerStringChars = 256;
|
|
114
|
+
function runtimeRetentionScorerEntry(index, entry) {
|
|
115
|
+
if (!isPlainRecord(entry) || publicMaterialForbiddenKeys(entry, "provider").length > 0) {
|
|
116
|
+
throw new TypeError(`unsafe ${index} retention scorer entry`);
|
|
117
|
+
}
|
|
118
|
+
const bounded = {};
|
|
119
|
+
for (const value of Object.values(entry)) {
|
|
120
|
+
if (value !== void 0 && typeof value !== "string" && typeof value !== "number") {
|
|
121
|
+
throw new TypeError(`unsafe ${index} retention scorer entry`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const [key, value] of Object.entries(entry)) {
|
|
125
|
+
bounded[key] = key === "key" && typeof value === "string" ? runtimeDiagnosticKey(value) : typeof value === "string" && value.length > maxRuntimeRetentionScorerStringChars ? `bounded:${stableStringHash(value)}:${value.length}` : value;
|
|
126
|
+
}
|
|
127
|
+
return Object.freeze(bounded);
|
|
128
|
+
}
|
|
129
|
+
function retentionPolicyMaxSize(policy) {
|
|
130
|
+
return policy?.maxSize;
|
|
131
|
+
}
|
|
132
|
+
function retentionPolicyMode(policy) {
|
|
133
|
+
if (policy === void 0) return void 0;
|
|
134
|
+
return "score" in policy && policy.score !== void 0 ? "score" : "fifo";
|
|
135
|
+
}
|
|
136
|
+
function buildRetentionPolicyReaders(graph, name, retention) {
|
|
137
|
+
const inputs = new PolicyInputs();
|
|
138
|
+
const readers = /* @__PURE__ */ new Map();
|
|
139
|
+
const statics = /* @__PURE__ */ new Map();
|
|
140
|
+
for (const index of toolProviderAdapterRuntimeRetentionIndexes) {
|
|
141
|
+
const policy = retention?.[index];
|
|
142
|
+
const maxSize = retentionPolicyMaxSize(policy);
|
|
143
|
+
if (maxSize === void 0) {
|
|
144
|
+
statics.set(index, void 0);
|
|
145
|
+
readers.set(index, inputs.add(void 0));
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const node = isNodeOpt(maxSize) ? maxSize : graph.node([], null, {
|
|
149
|
+
name: `${name}/retentionPolicy/${index}/maxSize`,
|
|
150
|
+
factory: "toolProviderAdapterRuntimeRetentionPolicy.maxSize",
|
|
151
|
+
initial: maxSize
|
|
152
|
+
});
|
|
153
|
+
if (!isNodeOpt(maxSize)) statics.set(index, maxSize);
|
|
154
|
+
readers.set(index, inputs.add(node));
|
|
155
|
+
}
|
|
156
|
+
return { inputs, readers, statics };
|
|
157
|
+
}
|
|
158
|
+
function readRetentionPolicyFact(ctx, retention, readers, current) {
|
|
159
|
+
const policies = /* @__PURE__ */ new Map();
|
|
160
|
+
const issues = [];
|
|
161
|
+
for (const index of toolProviderAdapterRuntimeRetentionIndexes) {
|
|
162
|
+
const raw = retention?.[index];
|
|
163
|
+
if (raw === void 0) continue;
|
|
164
|
+
const reader = readers.readers.get(index);
|
|
165
|
+
const previous = current?.policies.get(index)?.maxSize ?? readers.statics.get(index);
|
|
166
|
+
const maxSize = reader?.read(ctx, previous);
|
|
167
|
+
const issue = validateRuntimeRetentionPolicy(index, raw, maxSize);
|
|
168
|
+
if (issue !== void 0) {
|
|
169
|
+
issues.push(issue);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
policies.set(index, {
|
|
173
|
+
maxSize,
|
|
174
|
+
mode: retentionPolicyMode(raw) ?? "fifo"
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
return {
|
|
178
|
+
kind: "tool-provider-adapter-runtime-retention-policy",
|
|
179
|
+
policies,
|
|
180
|
+
...issues.length === 0 ? {} : { issues: Object.freeze(issues) }
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function validateRuntimeRetentionPolicy(index, policy, maxSize) {
|
|
184
|
+
if ("score" in policy && policy.score !== void 0 && typeof policy.score !== "function")
|
|
185
|
+
return invalidRetentionPolicyIssue(index, "score must be a function");
|
|
186
|
+
if (!("score" in policy) || policy.score === void 0) {
|
|
187
|
+
const order = policy.order ?? "fifo";
|
|
188
|
+
if (order !== "fifo") return invalidRetentionPolicyIssue(index, "order must be fifo");
|
|
189
|
+
}
|
|
190
|
+
if (maxSize === void 0 || !Number.isSafeInteger(maxSize) || maxSize < 1)
|
|
191
|
+
return invalidRetentionPolicyIssue(index, "maxSize must be a safe integer >= 1");
|
|
192
|
+
return void 0;
|
|
193
|
+
}
|
|
194
|
+
function invalidRetentionPolicyIssue(index, reason) {
|
|
195
|
+
return dataIssue(
|
|
196
|
+
"tool-provider-adapter-runtime-invalid-retention-policy",
|
|
197
|
+
"Tool provider adapter runtime retention policy is invalid; last-known-good policy remains active.",
|
|
198
|
+
{
|
|
199
|
+
subjectId: index,
|
|
200
|
+
refs: [retentionIndexSourceRef(index)],
|
|
201
|
+
details: { index, reason },
|
|
202
|
+
severity: "warning"
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
function adapterInputRetentionEntry(key, sequence, input, insertedAtMs) {
|
|
207
|
+
return Object.freeze({
|
|
208
|
+
key,
|
|
209
|
+
sequence,
|
|
210
|
+
...insertedAtMs === void 0 ? {} : { insertedAtMs },
|
|
211
|
+
adapterInputId: input.adapterInputId,
|
|
212
|
+
requestId: input.requestId,
|
|
213
|
+
operationId: input.operationId,
|
|
214
|
+
...input.routeId === void 0 ? {} : { routeId: input.routeId },
|
|
215
|
+
...input.providerId === void 0 ? {} : { providerId: input.providerId },
|
|
216
|
+
...input.executorId === void 0 ? {} : { executorId: input.executorId },
|
|
217
|
+
...input.profileId === void 0 ? {} : { profileId: input.profileId },
|
|
218
|
+
status: input.status
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function runRequestRetentionEntry(key, sequence, request) {
|
|
222
|
+
return Object.freeze({
|
|
223
|
+
key,
|
|
224
|
+
sequence,
|
|
225
|
+
...request.requestedAtMs === void 0 ? {} : { requestedAtMs: request.requestedAtMs },
|
|
226
|
+
adapterInputId: request.adapterInputId,
|
|
227
|
+
runId: request.runId,
|
|
228
|
+
attempt: request.attempt,
|
|
229
|
+
requestId: request.requestId,
|
|
230
|
+
operationId: request.operationId,
|
|
231
|
+
...request.routeId === void 0 ? {} : { routeId: request.routeId },
|
|
232
|
+
...request.providerId === void 0 ? {} : { providerId: request.providerId },
|
|
233
|
+
...request.executorId === void 0 ? {} : { executorId: request.executorId },
|
|
234
|
+
...request.profileId === void 0 ? {} : { profileId: request.profileId },
|
|
235
|
+
reason: request.reason
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function executionRetentionEntry(key, sequence, request, status, occurredAtMs, outcomeId) {
|
|
239
|
+
return Object.freeze({
|
|
240
|
+
key,
|
|
241
|
+
sequence,
|
|
242
|
+
...occurredAtMs === void 0 ? {} : { occurredAtMs },
|
|
243
|
+
adapterInputId: request.adapterInputId,
|
|
244
|
+
runId: request.runId,
|
|
245
|
+
attempt: request.attempt,
|
|
246
|
+
requestId: request.requestId,
|
|
247
|
+
operationId: request.operationId,
|
|
248
|
+
...request.routeId === void 0 ? {} : { routeId: request.routeId },
|
|
249
|
+
...request.providerId === void 0 ? {} : { providerId: request.providerId },
|
|
250
|
+
...request.executorId === void 0 ? {} : { executorId: request.executorId },
|
|
251
|
+
...request.profileId === void 0 ? {} : { profileId: request.profileId },
|
|
252
|
+
...outcomeId === void 0 ? {} : { outcomeId },
|
|
253
|
+
status,
|
|
254
|
+
reason: request.reason
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function runStatusRetentionEntry(key, sequence, status, occurredAtMs) {
|
|
258
|
+
const issueCode = status.issues?.[0]?.code;
|
|
259
|
+
return Object.freeze({
|
|
260
|
+
key,
|
|
261
|
+
sequence,
|
|
262
|
+
...occurredAtMs === void 0 ? {} : { occurredAtMs },
|
|
263
|
+
adapterInputId: status.adapterInputId,
|
|
264
|
+
runId: status.runId,
|
|
265
|
+
...status.attempt === void 0 ? {} : { attempt: status.attempt },
|
|
266
|
+
...status.requestId === void 0 ? {} : { requestId: status.requestId },
|
|
267
|
+
...status.operationId === void 0 ? {} : { operationId: status.operationId },
|
|
268
|
+
status: status.status,
|
|
269
|
+
...status.outcomeId === void 0 ? {} : { outcomeId: status.outcomeId },
|
|
270
|
+
...issueCode === void 0 ? {} : { issueCode }
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function runIssueRetentionEntry(key, sequence, issue, occurredAtMs, context = {}) {
|
|
274
|
+
return Object.freeze({
|
|
275
|
+
key,
|
|
276
|
+
sequence,
|
|
277
|
+
...occurredAtMs === void 0 ? {} : { occurredAtMs },
|
|
278
|
+
...context.adapterInputId === void 0 ? {} : { adapterInputId: context.adapterInputId },
|
|
279
|
+
...context.runId === void 0 ? {} : { runId: context.runId },
|
|
280
|
+
...context.attempt === void 0 ? {} : { attempt: context.attempt },
|
|
281
|
+
...context.requestId === void 0 ? {} : { requestId: context.requestId },
|
|
282
|
+
...context.operationId === void 0 ? {} : { operationId: context.operationId },
|
|
283
|
+
issueCode: issue.code,
|
|
284
|
+
...issue.severity === void 0 ? {} : { severity: issue.severity },
|
|
285
|
+
...issue.subjectId === void 0 ? {} : { subjectId: issue.subjectId }
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function retentionEvidenceEntry(key, sequence, opts) {
|
|
289
|
+
return Object.freeze({
|
|
290
|
+
key,
|
|
291
|
+
sequence,
|
|
292
|
+
...opts.occurredAtMs === void 0 ? {} : { occurredAtMs: opts.occurredAtMs },
|
|
293
|
+
adapterInputId: opts.adapterInputId,
|
|
294
|
+
evidenceKind: opts.evidenceKind,
|
|
295
|
+
...opts.attemptHighWater === void 0 ? {} : { attemptHighWater: opts.attemptHighWater },
|
|
296
|
+
reason: opts.reason
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// src/orchestration/agent-runtime-adapter-runtime-execute.ts
|
|
301
|
+
function runAdapterRuntimeRequest(ctx, request) {
|
|
302
|
+
if (ctx.isDisposed()) return;
|
|
303
|
+
const input = ctx.adapterInputs.get(request.adapterInputId)?.value;
|
|
304
|
+
if (input === void 0) {
|
|
305
|
+
const missingInputClassification = ctx.classifyRunRequestReplayEvidence(request);
|
|
306
|
+
ctx.publishReplayClassification(request, missingInputClassification);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
if (input.status !== "ready") {
|
|
310
|
+
const issue = dataIssue(
|
|
311
|
+
"tool-provider-adapter-runtime-input-not-ready",
|
|
312
|
+
"Tool provider adapter runtime requires a ready adapter input.",
|
|
313
|
+
{
|
|
314
|
+
subjectId: input.requestId,
|
|
315
|
+
refs: [ref("tool-provider-adapter-input", input.adapterInputId)],
|
|
316
|
+
details: { status: input.status }
|
|
317
|
+
}
|
|
318
|
+
);
|
|
319
|
+
ctx.publishIssue(issue);
|
|
320
|
+
ctx.publishRunStatus(request, "stale-request", [issue]);
|
|
321
|
+
ctx.publishStatus(input, "blocked", [issue]);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const requestIssues = runRequestIdentityIssues(request, input);
|
|
325
|
+
if (requestIssues.length > 0) {
|
|
326
|
+
for (const issue of requestIssues) ctx.publishIssue(issue);
|
|
327
|
+
ctx.publishRunStatus(request, "mismatched-request", requestIssues);
|
|
328
|
+
ctx.publishStatus(input, "blocked", requestIssues);
|
|
329
|
+
ctx.publishAudit(input, "tool-provider-adapter-runtime-run-request-rejected", {
|
|
330
|
+
runId: request.runId,
|
|
331
|
+
attempt: request.attempt,
|
|
332
|
+
issueCodes: requestIssues.map((issue) => issue.code)
|
|
333
|
+
});
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
if (ctx.executions.has(ctx.executionCoordinate(request))) {
|
|
337
|
+
ctx.startExecutionProof(request);
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const classification = ctx.classifyRunRequestReplayEvidence(request, input);
|
|
341
|
+
if (ctx.publishReplayClassification(request, classification)) return;
|
|
342
|
+
if (!ctx.startExecutionProof(request)) return;
|
|
343
|
+
const binding = input.providerId === void 0 ? void 0 : ctx.bindings.get(input.providerId);
|
|
344
|
+
if (binding === void 0) {
|
|
345
|
+
const issue = dataIssue(
|
|
346
|
+
"tool-provider-adapter-runtime-missing-binding",
|
|
347
|
+
"Tool provider adapter runtime requires a matching runtime-private binding.",
|
|
348
|
+
{
|
|
349
|
+
subjectId: input.requestId,
|
|
350
|
+
refs: [ref("tool-provider-adapter-input", input.adapterInputId)],
|
|
351
|
+
details: { providerId: input.providerId }
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
ctx.publishOutcome(
|
|
355
|
+
input,
|
|
356
|
+
{
|
|
357
|
+
kind: "blocked",
|
|
358
|
+
needs: [
|
|
359
|
+
{
|
|
360
|
+
kind: "tool-provider-binding",
|
|
361
|
+
message: "Matching runtime-private tool provider binding is unavailable.",
|
|
362
|
+
...input.providerId === void 0 ? {} : { refs: [ref("tool-provider", input.providerId)] }
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
issues: [issue]
|
|
366
|
+
},
|
|
367
|
+
request
|
|
368
|
+
);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
ctx.publishRunStatus(request, "started");
|
|
372
|
+
ctx.publishStatus(input, "in-flight");
|
|
373
|
+
ctx.publishAudit(input, "tool-provider-adapter-runtime-started", {
|
|
374
|
+
providerId: binding.providerId,
|
|
375
|
+
runId: request.runId,
|
|
376
|
+
attempt: request.attempt,
|
|
377
|
+
reason: request.reason
|
|
378
|
+
});
|
|
379
|
+
let result;
|
|
380
|
+
try {
|
|
381
|
+
result = binding.run(input, {
|
|
382
|
+
runId: request.runId,
|
|
383
|
+
attempt: request.attempt,
|
|
384
|
+
reason: request.reason,
|
|
385
|
+
sourceRefs: request.sourceRefs ?? input.sourceRefs ?? [],
|
|
386
|
+
now: ctx.now
|
|
387
|
+
});
|
|
388
|
+
} catch (error) {
|
|
389
|
+
ctx.publishRuntimeFailure(input, request, "tool-provider-adapter-runtime-threw", error);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (isThenableResult(result)) {
|
|
393
|
+
ctx.publishRuntimeFailure(
|
|
394
|
+
input,
|
|
395
|
+
request,
|
|
396
|
+
"tool-provider-adapter-runtime-async-result-unsupported",
|
|
397
|
+
new Error("Tool provider adapter runtime bindings must return synchronously.")
|
|
398
|
+
);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
ctx.publishOutcome(input, result, request);
|
|
402
|
+
}
|
|
403
|
+
function isThenableResult(value) {
|
|
404
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") return false;
|
|
405
|
+
try {
|
|
406
|
+
return typeof value.then === "function";
|
|
407
|
+
} catch {
|
|
408
|
+
return true;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// src/orchestration/agent-runtime-adapter-runtime-retention-gaps.ts
|
|
413
|
+
function retentionGapIssueCode(gapKind) {
|
|
414
|
+
switch (gapKind) {
|
|
415
|
+
case "evidence-horizon":
|
|
416
|
+
return "tool-provider-adapter-runtime-retention-evidence-gap";
|
|
417
|
+
case "evidence-horizon-closed":
|
|
418
|
+
return "tool-provider-adapter-runtime-retention-evidence-horizon-closed";
|
|
419
|
+
case "adapter-input-trimmed":
|
|
420
|
+
case "execution-proof-trimmed":
|
|
421
|
+
return "tool-provider-adapter-runtime-retention-gap";
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function retentionGapMessage(gapKind) {
|
|
425
|
+
switch (gapKind) {
|
|
426
|
+
case "evidence-horizon":
|
|
427
|
+
return "Tool provider adapter runtime retention evidence horizon no longer proves this request is fresh.";
|
|
428
|
+
case "evidence-horizon-closed":
|
|
429
|
+
return "Tool provider adapter runtime retention evidence horizon is closed; this request must fail closed.";
|
|
430
|
+
case "adapter-input-trimmed":
|
|
431
|
+
return "Tool provider adapter runtime retention removed the requested adapter input proof.";
|
|
432
|
+
case "execution-proof-trimmed":
|
|
433
|
+
return "Tool provider adapter runtime retention removed execution proof needed to safely replay this request.";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function retentionGapEvidenceKind(gapKind) {
|
|
437
|
+
switch (gapKind) {
|
|
438
|
+
case "adapter-input-trimmed":
|
|
439
|
+
return "adapter-input-trimmed";
|
|
440
|
+
case "execution-proof-trimmed":
|
|
441
|
+
return "execution-high-water";
|
|
442
|
+
case "evidence-horizon":
|
|
443
|
+
case "evidence-horizon-closed":
|
|
444
|
+
return void 0;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
function publishAdapterRuntimeRetentionGap(ctx, request, classification) {
|
|
448
|
+
const { index, gapKind } = classification;
|
|
449
|
+
const key = classification.key ?? request.adapterInputId;
|
|
450
|
+
const issueCode = retentionGapIssueCode(gapKind);
|
|
451
|
+
const evidenceKind = retentionGapEvidenceKind(gapKind);
|
|
452
|
+
const sourceRefs = runtimeEvidenceSourceRefs(index, [
|
|
453
|
+
ref("tool-provider-adapter-run", request.runId),
|
|
454
|
+
ref("tool-provider-adapter-input", request.adapterInputId)
|
|
455
|
+
]);
|
|
456
|
+
const metadata = runtimeEvidenceMetadata(index, {
|
|
457
|
+
key,
|
|
458
|
+
extra: {
|
|
459
|
+
gapKind,
|
|
460
|
+
...evidenceKind === void 0 ? {} : { evidenceKind }
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
const issue = dataIssue(issueCode, retentionGapMessage(gapKind), {
|
|
464
|
+
subjectId: request.adapterInputId,
|
|
465
|
+
refs: sourceRefs,
|
|
466
|
+
details: {
|
|
467
|
+
index,
|
|
468
|
+
adapterInputId: request.adapterInputId,
|
|
469
|
+
runId: request.runId,
|
|
470
|
+
attempt: request.attempt,
|
|
471
|
+
issueCode,
|
|
472
|
+
gapKind,
|
|
473
|
+
key: runtimeDiagnosticKey(key),
|
|
474
|
+
...evidenceKind === void 0 ? {} : { evidenceKind }
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
ctx.publishIssue(issue);
|
|
478
|
+
ctx.publishRunStatus(request, "retention-gap", [issue]);
|
|
479
|
+
ctx.publishRuntimeStatus({
|
|
480
|
+
status: "retention-gap",
|
|
481
|
+
index,
|
|
482
|
+
key,
|
|
483
|
+
adapterInputId: request.adapterInputId,
|
|
484
|
+
runId: request.runId,
|
|
485
|
+
attempt: request.attempt,
|
|
486
|
+
issueCode: issue.code,
|
|
487
|
+
sourceRefs,
|
|
488
|
+
metadata
|
|
489
|
+
});
|
|
490
|
+
ctx.publishRuntimeAudit("tool-provider-adapter-runtime-retention-gap", {
|
|
491
|
+
subjectId: request.adapterInputId,
|
|
492
|
+
sourceRefs,
|
|
493
|
+
issueCode: issue.code,
|
|
494
|
+
metadata
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
function publishAdapterRuntimeRetentionEvidenceGlobalFailClosed(ctx, victim) {
|
|
498
|
+
const sourceRefs = runtimeEvidenceSourceRefs("retentionEvidence");
|
|
499
|
+
const metadata = runtimeEvidenceMetadata("retentionEvidence", {
|
|
500
|
+
key: victim.key,
|
|
501
|
+
extra: {
|
|
502
|
+
evidenceKind: victim.value.evidenceKind,
|
|
503
|
+
gapKind: "evidence-horizon-closed"
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
const issue = dataIssue(
|
|
507
|
+
"tool-provider-adapter-runtime-retention-evidence-horizon-closed",
|
|
508
|
+
"Tool provider adapter runtime retention evidence closed-marker horizon overflowed; future requests fail closed until runtime reset.",
|
|
509
|
+
{
|
|
510
|
+
subjectId: victim.value.adapterInputId,
|
|
511
|
+
refs: sourceRefs,
|
|
512
|
+
details: {
|
|
513
|
+
index: "retentionEvidence",
|
|
514
|
+
key: runtimeDiagnosticKey(victim.key),
|
|
515
|
+
gapKind: "evidence-horizon-closed"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
);
|
|
519
|
+
ctx.publishIssue(issue, false);
|
|
520
|
+
ctx.publishRuntimeStatus({
|
|
521
|
+
status: "retention-gap",
|
|
522
|
+
index: "retentionEvidence",
|
|
523
|
+
key: victim.key,
|
|
524
|
+
adapterInputId: victim.value.adapterInputId,
|
|
525
|
+
...victim.value.attemptHighWater === void 0 ? {} : { attempt: victim.value.attemptHighWater },
|
|
526
|
+
issueCode: issue.code,
|
|
527
|
+
sourceRefs,
|
|
528
|
+
metadata
|
|
529
|
+
});
|
|
530
|
+
ctx.publishRuntimeAudit("tool-provider-adapter-runtime-retention-evidence-horizon-closed", {
|
|
531
|
+
subjectId: victim.value.adapterInputId,
|
|
532
|
+
sourceRefs,
|
|
533
|
+
issueCode: issue.code,
|
|
534
|
+
metadata
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
// src/orchestration/agent-runtime-adapter-runtime-state.ts
|
|
539
|
+
function createAdapterRuntimeRetentionIndexes() {
|
|
540
|
+
return {
|
|
541
|
+
adapterInputs: new RuntimeRetentionIndex(),
|
|
542
|
+
runRequests: new RuntimeRetentionIndex(),
|
|
543
|
+
executions: new RuntimeRetentionIndex(),
|
|
544
|
+
runStatuses: new RuntimeRetentionIndex(),
|
|
545
|
+
runIssues: new RuntimeRetentionIndex(),
|
|
546
|
+
retentionEvidence: new RuntimeRetentionIndex(),
|
|
547
|
+
closedRetentionEvidence: new RuntimeRetentionIndex()
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
function createAdapterRuntimeOutputNodes(graph, name) {
|
|
551
|
+
return {
|
|
552
|
+
outcomes: graph.node([], null, {
|
|
553
|
+
name: `${name}/outcomes`,
|
|
554
|
+
factory: "toolProviderAdapterRuntimeOutcomes"
|
|
555
|
+
}),
|
|
556
|
+
runStatus: graph.node([], null, {
|
|
557
|
+
name: `${name}/runStatus`,
|
|
558
|
+
factory: "toolProviderAdapterRuntimeRunStatus"
|
|
559
|
+
}),
|
|
560
|
+
status: graph.node([], null, {
|
|
561
|
+
name: `${name}/status`,
|
|
562
|
+
factory: "toolProviderAdapterRuntimeStatus"
|
|
563
|
+
}),
|
|
564
|
+
runtimeStatus: graph.node([], null, {
|
|
565
|
+
name: `${name}/runtimeStatus`,
|
|
566
|
+
factory: "toolProviderAdapterRuntimeStatus"
|
|
567
|
+
}),
|
|
568
|
+
issues: graph.node([], null, {
|
|
569
|
+
name: `${name}/issues`,
|
|
570
|
+
factory: "toolProviderAdapterRuntimeIssues"
|
|
571
|
+
}),
|
|
572
|
+
audit: graph.node([], null, {
|
|
573
|
+
name: `${name}/audit`,
|
|
574
|
+
factory: "toolProviderAdapterRuntimeAudit"
|
|
575
|
+
})
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// src/orchestration/agent-runtime-adapter-runtime.ts
|
|
580
|
+
function attachToolProviderAdapterRuntime(graph, opts) {
|
|
581
|
+
const name = opts.name ?? "toolProviderAdapterRuntime";
|
|
582
|
+
const bindings = normalizeToolProviderAdapterBindings(opts.bindings);
|
|
583
|
+
const retentionReaders = buildRetentionPolicyReaders(graph, name, opts.retention);
|
|
584
|
+
const retentionPolicy = graph.node(
|
|
585
|
+
retentionReaders.inputs.deps,
|
|
586
|
+
(ctx) => {
|
|
587
|
+
const current = ctx.state.get();
|
|
588
|
+
const fact = readRetentionPolicyFact(ctx, opts.retention, retentionReaders, current);
|
|
589
|
+
ctx.state.set(fact);
|
|
590
|
+
ctx.down([["DATA", fact]]);
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
name: `${name}/retentionPolicy`,
|
|
594
|
+
factory: "toolProviderAdapterRuntimeRetentionPolicy",
|
|
595
|
+
partial: true
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
const {
|
|
599
|
+
adapterInputs,
|
|
600
|
+
runRequests,
|
|
601
|
+
executions,
|
|
602
|
+
runStatuses,
|
|
603
|
+
runIssues,
|
|
604
|
+
retentionEvidence,
|
|
605
|
+
closedRetentionEvidence
|
|
606
|
+
} = createAdapterRuntimeRetentionIndexes();
|
|
607
|
+
const executionHighWaterByInput = /* @__PURE__ */ new Map();
|
|
608
|
+
const trimmedAdapterInputIds = /* @__PURE__ */ new Set();
|
|
609
|
+
const projectorInputDropById = /* @__PURE__ */ new Map();
|
|
610
|
+
let retentionEvidenceHorizonExceeded = false;
|
|
611
|
+
const { outcomes, runStatus, status, runtimeStatus, issues, audit } = createAdapterRuntimeOutputNodes(graph, name);
|
|
612
|
+
let disposed = false;
|
|
613
|
+
let auditSeq = 0;
|
|
614
|
+
let retentionSeq = 0;
|
|
615
|
+
let effectiveRetention = {};
|
|
616
|
+
function nowMs() {
|
|
617
|
+
return opts.now?.();
|
|
618
|
+
}
|
|
619
|
+
function nextRetentionSequence() {
|
|
620
|
+
retentionSeq += 1;
|
|
621
|
+
return retentionSeq;
|
|
622
|
+
}
|
|
623
|
+
function publishRuntimeStatus(fact) {
|
|
624
|
+
const occurredAtMs = nowMs();
|
|
625
|
+
const { sourceRefs: rawSourceRefs, metadata: rawMetadata, key: rawKey, ...statusFields } = fact;
|
|
626
|
+
const sourceRefs = rawSourceRefs === void 0 ? void 0 : sanitizeAdapterInputSourceRefs(rawSourceRefs);
|
|
627
|
+
const metadata = sanitizeProviderGraphVisibleRecord(rawMetadata, opts.publicText);
|
|
628
|
+
const key = rawKey === void 0 ? void 0 : boundPublicText(
|
|
629
|
+
runtimeDiagnosticKey(rawKey),
|
|
630
|
+
maxPublicMetadataStringChars(opts.publicText)
|
|
631
|
+
).text;
|
|
632
|
+
runtimeStatus.down([
|
|
633
|
+
[
|
|
634
|
+
"DATA",
|
|
635
|
+
{
|
|
636
|
+
kind: "tool-provider-adapter-runtime-status",
|
|
637
|
+
...occurredAtMs === void 0 ? {} : { occurredAtMs },
|
|
638
|
+
...statusFields,
|
|
639
|
+
...key === void 0 ? {} : { key },
|
|
640
|
+
...sourceRefs === void 0 ? {} : { sourceRefs },
|
|
641
|
+
...metadata === void 0 ? {} : { metadata }
|
|
642
|
+
}
|
|
643
|
+
]
|
|
644
|
+
]);
|
|
645
|
+
}
|
|
646
|
+
function publishRuntimeAudit(kind, auditOpts = {}) {
|
|
647
|
+
auditSeq += 1;
|
|
648
|
+
const metadata = sanitizeProviderGraphVisibleRecord(auditOpts.metadata, opts.publicText);
|
|
649
|
+
audit.down([
|
|
650
|
+
[
|
|
651
|
+
"DATA",
|
|
652
|
+
{
|
|
653
|
+
id: `${name}:audit:${auditSeq}`,
|
|
654
|
+
kind,
|
|
655
|
+
...auditOpts.subjectId === void 0 ? {} : { subjectId: auditOpts.subjectId },
|
|
656
|
+
...auditOpts.sourceRefs === void 0 ? {} : { sourceRefs: sanitizeAdapterInputSourceRefs(auditOpts.sourceRefs) },
|
|
657
|
+
...auditOpts.issueCode === void 0 ? {} : { issueCode: auditOpts.issueCode },
|
|
658
|
+
...metadata === void 0 ? {} : { metadata }
|
|
659
|
+
}
|
|
660
|
+
]
|
|
661
|
+
]);
|
|
662
|
+
}
|
|
663
|
+
function trackRunIssue(issue, emittedKey, dropKey) {
|
|
664
|
+
const sequence = nextRetentionSequence();
|
|
665
|
+
const key = emittedKey ?? `${sequence}:${issue.code}:${issue.subjectId ?? ""}`;
|
|
666
|
+
runIssues.set(key, runIssueRetentionEntry(key, sequence, issue, nowMs()), {
|
|
667
|
+
fact: issue,
|
|
668
|
+
dropKey
|
|
669
|
+
});
|
|
670
|
+
trimRunIssues();
|
|
671
|
+
}
|
|
672
|
+
function publishIssue(issue, track = true) {
|
|
673
|
+
issues.down([["DATA", sanitizeAdapterInputIssue(issue)]]);
|
|
674
|
+
if (track) trackRunIssue(issue);
|
|
675
|
+
}
|
|
676
|
+
function publishRunStatus(request, nextStatus, statusIssues, outcomeId) {
|
|
677
|
+
const statusFact = {
|
|
678
|
+
kind: "tool-provider-adapter-run-status",
|
|
679
|
+
runId: request.runId,
|
|
680
|
+
adapterInputId: request.adapterInputId,
|
|
681
|
+
requestId: request.requestId,
|
|
682
|
+
operationId: request.operationId,
|
|
683
|
+
status: nextStatus,
|
|
684
|
+
attempt: request.attempt,
|
|
685
|
+
outcomeId,
|
|
686
|
+
issues: statusIssues,
|
|
687
|
+
sourceRefs: sanitizeAdapterInputSourceRefs(request.sourceRefs ?? []),
|
|
688
|
+
metadata: sanitizeGraphVisibleRecord(
|
|
689
|
+
{
|
|
690
|
+
providerId: request.providerId,
|
|
691
|
+
routeId: request.routeId,
|
|
692
|
+
reason: request.reason
|
|
693
|
+
},
|
|
694
|
+
opts.publicText
|
|
695
|
+
)
|
|
696
|
+
};
|
|
697
|
+
runStatus.down([["DATA", statusFact]]);
|
|
698
|
+
trackRunStatus(statusFact);
|
|
699
|
+
}
|
|
700
|
+
function trackRunStatus(statusFact, emittedKey, dropKey) {
|
|
701
|
+
const sequence = nextRetentionSequence();
|
|
702
|
+
const key = emittedKey ?? `${sequence}:${statusFact.runId}:${statusFact.status}`;
|
|
703
|
+
runStatuses.set(key, runStatusRetentionEntry(key, sequence, statusFact, nowMs()), {
|
|
704
|
+
fact: statusFact,
|
|
705
|
+
dropKey
|
|
706
|
+
});
|
|
707
|
+
trimRunStatuses();
|
|
708
|
+
}
|
|
709
|
+
function retentionScore(index) {
|
|
710
|
+
const policy = opts.retention?.[index];
|
|
711
|
+
return typeof policy?.score === "function" ? policy.score : void 0;
|
|
712
|
+
}
|
|
713
|
+
function trimRuntimeIndex(indexName, store, config, onVictim) {
|
|
714
|
+
if (config?.maxSize === void 0) return;
|
|
715
|
+
let victims;
|
|
716
|
+
if (config.mode === "score") {
|
|
717
|
+
const score = retentionScore(indexName);
|
|
718
|
+
if (score === void 0) return;
|
|
719
|
+
const selected = store.trimScored(config.maxSize, (entry) => {
|
|
720
|
+
return score(runtimeRetentionScorerEntry(indexName, entry));
|
|
721
|
+
});
|
|
722
|
+
if (selected.invalid !== void 0) {
|
|
723
|
+
publishRetentionScoreInvalid(indexName, selected.invalid);
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
victims = selected.victims ?? [];
|
|
727
|
+
} else {
|
|
728
|
+
victims = store.trimFifo(config.maxSize);
|
|
729
|
+
}
|
|
730
|
+
for (const victim of victims) {
|
|
731
|
+
onVictim?.(victim);
|
|
732
|
+
publishRetentionTrimmed(indexName, victim.key, victim.entry);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function trackAdapterInputTrimmedEvidence(adapterInputId) {
|
|
736
|
+
trimmedAdapterInputIds.add(adapterInputId);
|
|
737
|
+
const sequence = nextRetentionSequence();
|
|
738
|
+
const key = `adapter-input-trimmed:${adapterInputId}`;
|
|
739
|
+
const entry = retentionEvidenceEntry(key, sequence, {
|
|
740
|
+
adapterInputId,
|
|
741
|
+
evidenceKind: "adapter-input-trimmed",
|
|
742
|
+
occurredAtMs: nowMs(),
|
|
743
|
+
reason: "adapter-input-retention"
|
|
744
|
+
});
|
|
745
|
+
retentionEvidence.set(key, entry, entry);
|
|
746
|
+
trimRetentionEvidence();
|
|
747
|
+
}
|
|
748
|
+
function trackExecutionHighWaterEvidence(adapterInputId, attempt) {
|
|
749
|
+
const previous = executionHighWaterByInput.get(adapterInputId) ?? 0;
|
|
750
|
+
const attemptHighWater = Math.max(previous, attempt);
|
|
751
|
+
executionHighWaterByInput.set(adapterInputId, attemptHighWater);
|
|
752
|
+
const sequence = nextRetentionSequence();
|
|
753
|
+
const key = `execution-high-water:${adapterInputId}`;
|
|
754
|
+
const entry = retentionEvidenceEntry(key, sequence, {
|
|
755
|
+
adapterInputId,
|
|
756
|
+
evidenceKind: "execution-high-water",
|
|
757
|
+
occurredAtMs: nowMs(),
|
|
758
|
+
attemptHighWater,
|
|
759
|
+
reason: "execution-proof-retention"
|
|
760
|
+
});
|
|
761
|
+
retentionEvidence.set(key, entry, entry);
|
|
762
|
+
trimRetentionEvidence();
|
|
763
|
+
}
|
|
764
|
+
function retentionEvidenceClosedKey(adapterInputId) {
|
|
765
|
+
return `closed:${adapterInputId}`;
|
|
766
|
+
}
|
|
767
|
+
function isRetentionEvidenceClosed(adapterInputId) {
|
|
768
|
+
return retentionEvidenceHorizonExceeded || closedRetentionEvidence.has(retentionEvidenceClosedKey(adapterInputId));
|
|
769
|
+
}
|
|
770
|
+
function classifyRunRequestReplayEvidence(request, input) {
|
|
771
|
+
if (isRetentionEvidenceClosed(request.adapterInputId)) {
|
|
772
|
+
return {
|
|
773
|
+
kind: "retention-gap",
|
|
774
|
+
index: "retentionEvidence",
|
|
775
|
+
gapKind: "evidence-horizon-closed",
|
|
776
|
+
key: retentionEvidenceClosedKey(request.adapterInputId)
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
if (input === void 0 && trimmedAdapterInputIds.has(request.adapterInputId)) {
|
|
780
|
+
return {
|
|
781
|
+
kind: "retention-gap",
|
|
782
|
+
index: "adapterInputs",
|
|
783
|
+
gapKind: "adapter-input-trimmed",
|
|
784
|
+
key: `adapter-input-trimmed:${request.adapterInputId}`
|
|
785
|
+
};
|
|
786
|
+
}
|
|
787
|
+
const highWater = executionHighWaterByInput.get(request.adapterInputId) ?? 0;
|
|
788
|
+
if (highWater >= request.attempt) {
|
|
789
|
+
return {
|
|
790
|
+
kind: "retention-gap",
|
|
791
|
+
index: "executions",
|
|
792
|
+
gapKind: "execution-proof-trimmed",
|
|
793
|
+
key: `execution-high-water:${request.adapterInputId}`
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
if (input === void 0) return { kind: "missing-input" };
|
|
797
|
+
return { kind: "fresh" };
|
|
798
|
+
}
|
|
799
|
+
function classifyRetainedRunRequestReplayEvidence(request) {
|
|
800
|
+
return classifyRunRequestReplayEvidence(request);
|
|
801
|
+
}
|
|
802
|
+
function dropProjectorInput(adapterInputId) {
|
|
803
|
+
projectorInputDropById.get(adapterInputId)?.();
|
|
804
|
+
projectorInputDropById.delete(adapterInputId);
|
|
805
|
+
}
|
|
806
|
+
function closeRetentionEvidenceHorizon(victim) {
|
|
807
|
+
const key = retentionEvidenceClosedKey(victim.value.adapterInputId);
|
|
808
|
+
const sequence = nextRetentionSequence();
|
|
809
|
+
const entry = retentionEvidenceEntry(key, sequence, {
|
|
810
|
+
adapterInputId: victim.value.adapterInputId,
|
|
811
|
+
evidenceKind: victim.value.evidenceKind,
|
|
812
|
+
occurredAtMs: nowMs(),
|
|
813
|
+
...victim.value.attemptHighWater === void 0 ? {} : { attemptHighWater: victim.value.attemptHighWater },
|
|
814
|
+
reason: victim.value.reason
|
|
815
|
+
});
|
|
816
|
+
closedRetentionEvidence.set(key, entry, entry);
|
|
817
|
+
trimClosedRetentionEvidence();
|
|
818
|
+
}
|
|
819
|
+
function trimClosedRetentionEvidence() {
|
|
820
|
+
const maxSize = effectiveRetention.retentionEvidence?.maxSize;
|
|
821
|
+
if (maxSize === void 0) return;
|
|
822
|
+
const victims = closedRetentionEvidence.trimFifo(maxSize);
|
|
823
|
+
for (const victim of victims) {
|
|
824
|
+
const firstGlobalClosure = !retentionEvidenceHorizonExceeded;
|
|
825
|
+
if (firstGlobalClosure) retentionEvidenceHorizonExceeded = true;
|
|
826
|
+
publishRetentionTrimmed("retentionEvidence", victim.key, victim.entry);
|
|
827
|
+
if (firstGlobalClosure) {
|
|
828
|
+
publishRetentionEvidenceGlobalFailClosed(victim);
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
function trimAdapterInputs() {
|
|
833
|
+
trimRuntimeIndex("adapterInputs", adapterInputs, effectiveRetention.adapterInputs, (victim) => {
|
|
834
|
+
dropProjectorInput(victim.value.adapterInputId);
|
|
835
|
+
trackAdapterInputTrimmedEvidence(victim.value.adapterInputId);
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
function trimRunRequests() {
|
|
839
|
+
trimRuntimeIndex("runRequests", runRequests, effectiveRetention.runRequests, (victim) => {
|
|
840
|
+
victim.value.dropKey?.();
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
function trimExecutions() {
|
|
844
|
+
trimRuntimeIndex("executions", executions, effectiveRetention.executions, (victim) => {
|
|
845
|
+
trackExecutionHighWaterEvidence(victim.value.adapterInputId, victim.value.attempt);
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
function trimRunStatuses() {
|
|
849
|
+
trimRuntimeIndex("runStatuses", runStatuses, effectiveRetention.runStatuses, (victim) => {
|
|
850
|
+
victim.value.dropKey?.();
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
function trimRunIssues() {
|
|
854
|
+
trimRuntimeIndex("runIssues", runIssues, effectiveRetention.runIssues, (victim) => {
|
|
855
|
+
victim.value.dropKey?.();
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
function trimRetentionEvidence() {
|
|
859
|
+
trimRuntimeIndex(
|
|
860
|
+
"retentionEvidence",
|
|
861
|
+
retentionEvidence,
|
|
862
|
+
effectiveRetention.retentionEvidence,
|
|
863
|
+
(victim) => {
|
|
864
|
+
closeRetentionEvidenceHorizon(victim);
|
|
865
|
+
if (victim.value.evidenceKind === "adapter-input-trimmed") {
|
|
866
|
+
trimmedAdapterInputIds.delete(victim.value.adapterInputId);
|
|
867
|
+
} else {
|
|
868
|
+
executionHighWaterByInput.delete(victim.value.adapterInputId);
|
|
869
|
+
}
|
|
870
|
+
adapterInputs.delete(victim.value.adapterInputId);
|
|
871
|
+
dropProjectorInput(victim.value.adapterInputId);
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
function trimAllRetentionIndexes() {
|
|
876
|
+
trimAdapterInputs();
|
|
877
|
+
trimRunRequests();
|
|
878
|
+
trimExecutions();
|
|
879
|
+
trimRunStatuses();
|
|
880
|
+
trimRunIssues();
|
|
881
|
+
trimRetentionEvidence();
|
|
882
|
+
}
|
|
883
|
+
function publishRetentionTrimmed(index, key, entry) {
|
|
884
|
+
const record = isRecord(entry) ? entry : {};
|
|
885
|
+
const evidenceKind = typeof record.evidenceKind === "string" ? record.evidenceKind : void 0;
|
|
886
|
+
const code = index === "retentionEvidence" ? "tool-provider-adapter-runtime-retention-evidence-trimmed" : "tool-provider-adapter-runtime-retention-trimmed";
|
|
887
|
+
const issue = dataIssue(
|
|
888
|
+
code,
|
|
889
|
+
index === "retentionEvidence" ? "Tool provider adapter runtime retention trimmed replay proof evidence and closed the affected horizon." : "Tool provider adapter runtime retention trimmed a runtime-private index entry.",
|
|
890
|
+
{
|
|
891
|
+
subjectId: typeof record.adapterInputId === "string" ? record.adapterInputId : typeof record.key === "string" ? runtimeDiagnosticKey(record.key) : index,
|
|
892
|
+
refs: runtimeEvidenceSourceRefs(index),
|
|
893
|
+
details: runtimeEvidenceMetadata(index, { key }),
|
|
894
|
+
severity: "info"
|
|
895
|
+
}
|
|
896
|
+
);
|
|
897
|
+
publishIssue(issue, false);
|
|
898
|
+
const sourceRefs = runtimeEvidenceSourceRefs(index);
|
|
899
|
+
const metadata = runtimeEvidenceMetadata(index, {
|
|
900
|
+
key,
|
|
901
|
+
extra: evidenceKind === void 0 ? {} : { evidenceKind }
|
|
902
|
+
});
|
|
903
|
+
publishRuntimeStatus({
|
|
904
|
+
status: "retention-trimmed",
|
|
905
|
+
index,
|
|
906
|
+
key,
|
|
907
|
+
...typeof record.adapterInputId === "string" ? { adapterInputId: record.adapterInputId } : {},
|
|
908
|
+
...typeof record.runId === "string" ? { runId: record.runId } : {},
|
|
909
|
+
...typeof record.attempt === "number" ? { attempt: record.attempt } : {},
|
|
910
|
+
issueCode: issue.code,
|
|
911
|
+
sourceRefs,
|
|
912
|
+
metadata
|
|
913
|
+
});
|
|
914
|
+
publishRuntimeAudit("tool-provider-adapter-runtime-retention-trimmed", {
|
|
915
|
+
subjectId: issue.subjectId,
|
|
916
|
+
sourceRefs,
|
|
917
|
+
issueCode: issue.code,
|
|
918
|
+
metadata
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
function publishRetentionScoreInvalid(index, reason) {
|
|
922
|
+
const issue = dataIssue(
|
|
923
|
+
"tool-provider-adapter-retention-score-invalid",
|
|
924
|
+
"Tool provider adapter runtime retention scorer returned invalid material; last-known-good policy remains active.",
|
|
925
|
+
{
|
|
926
|
+
subjectId: index,
|
|
927
|
+
refs: runtimeEvidenceSourceRefs(index),
|
|
928
|
+
details: runtimeEvidenceMetadata(index, { extra: { reason } }),
|
|
929
|
+
severity: "warning"
|
|
930
|
+
}
|
|
931
|
+
);
|
|
932
|
+
publishIssue(issue, index !== "runIssues");
|
|
933
|
+
const sourceRefs = runtimeEvidenceSourceRefs(index);
|
|
934
|
+
const metadata = runtimeEvidenceMetadata(index, { extra: { reason } });
|
|
935
|
+
publishRuntimeStatus({
|
|
936
|
+
status: "invalid-retention-policy",
|
|
937
|
+
index,
|
|
938
|
+
issueCode: issue.code,
|
|
939
|
+
sourceRefs,
|
|
940
|
+
metadata
|
|
941
|
+
});
|
|
942
|
+
publishRuntimeAudit("tool-provider-adapter-runtime-invalid-retention-policy", {
|
|
943
|
+
subjectId: index,
|
|
944
|
+
sourceRefs,
|
|
945
|
+
issueCode: issue.code,
|
|
946
|
+
metadata
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
function applyRetentionPolicyFact(fact) {
|
|
950
|
+
const invalidIndexes = /* @__PURE__ */ new Set();
|
|
951
|
+
if (fact.issues !== void 0 && fact.issues.length > 0) {
|
|
952
|
+
for (const issue of fact.issues) {
|
|
953
|
+
publishIssue(issue);
|
|
954
|
+
const index = toolProviderAdapterRuntimeRetentionIndex(issue.subjectId);
|
|
955
|
+
if (index !== void 0) invalidIndexes.add(index);
|
|
956
|
+
publishRuntimeStatus({
|
|
957
|
+
status: "invalid-retention-policy",
|
|
958
|
+
...index === void 0 ? {} : { index },
|
|
959
|
+
issueCode: issue.code,
|
|
960
|
+
...index === void 0 ? {} : { sourceRefs: runtimeEvidenceSourceRefs(index) }
|
|
961
|
+
});
|
|
962
|
+
publishRuntimeAudit("tool-provider-adapter-runtime-invalid-retention-policy", {
|
|
963
|
+
...issue.subjectId === void 0 ? {} : { subjectId: issue.subjectId },
|
|
964
|
+
...index === void 0 ? {} : { sourceRefs: runtimeEvidenceSourceRefs(index) },
|
|
965
|
+
issueCode: issue.code
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
const adapterInputsPolicy = fact.policies.get("adapterInputs");
|
|
970
|
+
const runRequestsPolicy = fact.policies.get("runRequests");
|
|
971
|
+
const executionsPolicy = fact.policies.get("executions");
|
|
972
|
+
const runStatusesPolicy = fact.policies.get("runStatuses");
|
|
973
|
+
const runIssuesPolicy = fact.policies.get("runIssues");
|
|
974
|
+
const retentionEvidencePolicy = fact.policies.get("retentionEvidence");
|
|
975
|
+
effectiveRetention = {
|
|
976
|
+
...invalidIndexes.has("adapterInputs") ? effectiveRetention.adapterInputs === void 0 ? {} : { adapterInputs: effectiveRetention.adapterInputs } : adapterInputsPolicy === void 0 ? {} : { adapterInputs: adapterInputsPolicy },
|
|
977
|
+
...invalidIndexes.has("runRequests") ? effectiveRetention.runRequests === void 0 ? {} : { runRequests: effectiveRetention.runRequests } : runRequestsPolicy === void 0 ? {} : { runRequests: runRequestsPolicy },
|
|
978
|
+
...invalidIndexes.has("executions") ? effectiveRetention.executions === void 0 ? {} : { executions: effectiveRetention.executions } : executionsPolicy === void 0 ? {} : { executions: executionsPolicy },
|
|
979
|
+
...invalidIndexes.has("runStatuses") ? effectiveRetention.runStatuses === void 0 ? {} : { runStatuses: effectiveRetention.runStatuses } : runStatusesPolicy === void 0 ? {} : { runStatuses: runStatusesPolicy },
|
|
980
|
+
...invalidIndexes.has("runIssues") ? effectiveRetention.runIssues === void 0 ? {} : { runIssues: effectiveRetention.runIssues } : runIssuesPolicy === void 0 ? {} : { runIssues: runIssuesPolicy },
|
|
981
|
+
...invalidIndexes.has("retentionEvidence") ? effectiveRetention.retentionEvidence === void 0 ? {} : { retentionEvidence: effectiveRetention.retentionEvidence } : retentionEvidencePolicy === void 0 ? {} : { retentionEvidence: retentionEvidencePolicy }
|
|
982
|
+
};
|
|
983
|
+
trimAllRetentionIndexes();
|
|
984
|
+
}
|
|
985
|
+
function publishStatus(input, nextStatus, statusIssues) {
|
|
986
|
+
if (input.effectRunId === void 0) return;
|
|
987
|
+
const metadata = sanitizeGraphVisibleRecord({
|
|
988
|
+
adapterInputId: input.adapterInputId,
|
|
989
|
+
providerId: input.providerId,
|
|
990
|
+
toolName: input.toolName
|
|
991
|
+
});
|
|
992
|
+
status.down([
|
|
993
|
+
[
|
|
994
|
+
"DATA",
|
|
995
|
+
{
|
|
996
|
+
kind: "status",
|
|
997
|
+
requestId: input.requestId,
|
|
998
|
+
operationId: input.operationId,
|
|
999
|
+
effectRunId: input.effectRunId,
|
|
1000
|
+
status: nextStatus,
|
|
1001
|
+
sourceRefs: defaultToolProviderAdapterEvidenceRefs(input),
|
|
1002
|
+
...statusIssues === void 0 ? {} : { issues: statusIssues },
|
|
1003
|
+
...metadata === void 0 ? {} : { metadata }
|
|
1004
|
+
}
|
|
1005
|
+
]
|
|
1006
|
+
]);
|
|
1007
|
+
}
|
|
1008
|
+
function publishAudit(input, kind, metadata, issueCode) {
|
|
1009
|
+
auditSeq += 1;
|
|
1010
|
+
const cleanMetadata = sanitizeGraphVisibleRecord({
|
|
1011
|
+
adapterInputId: input.adapterInputId,
|
|
1012
|
+
providerId: input.providerId,
|
|
1013
|
+
toolName: input.toolName,
|
|
1014
|
+
...metadata
|
|
1015
|
+
});
|
|
1016
|
+
audit.down([
|
|
1017
|
+
[
|
|
1018
|
+
"DATA",
|
|
1019
|
+
{
|
|
1020
|
+
id: `${name}:audit:${auditSeq}`,
|
|
1021
|
+
kind,
|
|
1022
|
+
subjectId: input.requestId,
|
|
1023
|
+
sourceRefs: defaultToolProviderAdapterEvidenceRefs(input),
|
|
1024
|
+
...issueCode === void 0 ? {} : { issueCode },
|
|
1025
|
+
...cleanMetadata === void 0 ? {} : { metadata: cleanMetadata }
|
|
1026
|
+
}
|
|
1027
|
+
]
|
|
1028
|
+
]);
|
|
1029
|
+
}
|
|
1030
|
+
function publishOutcome(input, result, request) {
|
|
1031
|
+
if (disposed) return;
|
|
1032
|
+
let outcome;
|
|
1033
|
+
try {
|
|
1034
|
+
outcome = buildToolProviderExecutorOutcome(input, result, {
|
|
1035
|
+
attempt: request.attempt,
|
|
1036
|
+
runId: request.runId,
|
|
1037
|
+
occurredAtMs: opts.now?.(),
|
|
1038
|
+
publicText: opts.publicText
|
|
1039
|
+
});
|
|
1040
|
+
} catch (error) {
|
|
1041
|
+
const issue = adapterRuntimeIssue(
|
|
1042
|
+
input,
|
|
1043
|
+
"tool-provider-adapter-runtime-invalid-input",
|
|
1044
|
+
error
|
|
1045
|
+
);
|
|
1046
|
+
publishIssue(issue);
|
|
1047
|
+
publishRunStatus(request, "failure", [issue]);
|
|
1048
|
+
publishStatus(input, "failed", [issue]);
|
|
1049
|
+
publishAudit(input, "tool-provider-adapter-runtime-invalid-input", void 0, issue.code);
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
outcomes.down([["DATA", outcome]]);
|
|
1053
|
+
const execution = executions.get(executionCoordinate(request));
|
|
1054
|
+
if (execution !== void 0) {
|
|
1055
|
+
executions.set(
|
|
1056
|
+
execution.key,
|
|
1057
|
+
executionRetentionEntry(
|
|
1058
|
+
execution.key,
|
|
1059
|
+
execution.entry.sequence,
|
|
1060
|
+
request,
|
|
1061
|
+
outcome.kind,
|
|
1062
|
+
outcome.occurredAtMs,
|
|
1063
|
+
outcome.outcomeId
|
|
1064
|
+
),
|
|
1065
|
+
request
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
const publishedIssueKeys = /* @__PURE__ */ new Set();
|
|
1069
|
+
for (const issue of outcome.issues ?? []) {
|
|
1070
|
+
publishedIssueKeys.add(`${issue.code}:${issue.message}`);
|
|
1071
|
+
publishIssue(issue);
|
|
1072
|
+
}
|
|
1073
|
+
if (outcome.kind === "failure" && !publishedIssueKeys.has(`${outcome.error.code}:${outcome.error.message}`)) {
|
|
1074
|
+
publishIssue(outcome.error);
|
|
1075
|
+
}
|
|
1076
|
+
const statusIssues = outcomeIssues(outcome);
|
|
1077
|
+
publishStatus(
|
|
1078
|
+
input,
|
|
1079
|
+
agentRequestStatusForExecutorOutcome(outcome),
|
|
1080
|
+
statusIssues.length === 0 ? void 0 : statusIssues
|
|
1081
|
+
);
|
|
1082
|
+
publishRunStatus(
|
|
1083
|
+
request,
|
|
1084
|
+
outcome.kind,
|
|
1085
|
+
statusIssues.length === 0 ? void 0 : statusIssues,
|
|
1086
|
+
outcome.outcomeId
|
|
1087
|
+
);
|
|
1088
|
+
publishAudit(input, "tool-provider-adapter-runtime-finished", {
|
|
1089
|
+
status: outcome.kind,
|
|
1090
|
+
outcomeId: outcome.outcomeId,
|
|
1091
|
+
runId: request.runId,
|
|
1092
|
+
attempt: request.attempt
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
function publishRuntimeFailure(input, request, code, error) {
|
|
1096
|
+
const issue = adapterRuntimeIssue(input, code, error);
|
|
1097
|
+
publishOutcome(
|
|
1098
|
+
input,
|
|
1099
|
+
{
|
|
1100
|
+
kind: "failure",
|
|
1101
|
+
error: issue,
|
|
1102
|
+
retryable: false,
|
|
1103
|
+
issues: [issue]
|
|
1104
|
+
},
|
|
1105
|
+
request
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
function executionCoordinate(request) {
|
|
1109
|
+
return `${request.adapterInputId}:${request.attempt}`;
|
|
1110
|
+
}
|
|
1111
|
+
function trackRunRequest(request, emittedKey, dropKey) {
|
|
1112
|
+
const sequence = nextRetentionSequence();
|
|
1113
|
+
runRequests.set(emittedKey, runRequestRetentionEntry(emittedKey, sequence, request), {
|
|
1114
|
+
fact: request,
|
|
1115
|
+
dropKey
|
|
1116
|
+
});
|
|
1117
|
+
trimRunRequests();
|
|
1118
|
+
}
|
|
1119
|
+
function startExecutionProof(request) {
|
|
1120
|
+
const coordinate = executionCoordinate(request);
|
|
1121
|
+
const existing = executions.get(coordinate);
|
|
1122
|
+
if (existing !== void 0) {
|
|
1123
|
+
if (existing.value.runId !== request.runId) {
|
|
1124
|
+
const issue = dataIssue(
|
|
1125
|
+
"tool-provider-adapter-runtime-duplicate-execution-coordinate",
|
|
1126
|
+
"Tool provider adapter runtime requires one visible runId per adapterInputId and attempt.",
|
|
1127
|
+
{
|
|
1128
|
+
subjectId: request.adapterInputId,
|
|
1129
|
+
refs: [ref("tool-provider-adapter-run", request.runId)],
|
|
1130
|
+
details: {
|
|
1131
|
+
adapterInputId: request.adapterInputId,
|
|
1132
|
+
attempt: request.attempt
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
);
|
|
1136
|
+
publishIssue(issue);
|
|
1137
|
+
publishRunStatus(request, "mismatched-request", [issue]);
|
|
1138
|
+
publishRuntimeAudit("tool-provider-adapter-runtime-duplicate-execution-coordinate", {
|
|
1139
|
+
subjectId: request.adapterInputId,
|
|
1140
|
+
sourceRefs: [ref("tool-provider-adapter-run", request.runId)],
|
|
1141
|
+
issueCode: issue.code,
|
|
1142
|
+
metadata: {
|
|
1143
|
+
adapterInputId: request.adapterInputId,
|
|
1144
|
+
attempt: request.attempt,
|
|
1145
|
+
key: runtimeDiagnosticKey(coordinate)
|
|
1146
|
+
}
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
return false;
|
|
1150
|
+
}
|
|
1151
|
+
const sequence = nextRetentionSequence();
|
|
1152
|
+
executions.set(
|
|
1153
|
+
coordinate,
|
|
1154
|
+
executionRetentionEntry(coordinate, sequence, request, "started", nowMs()),
|
|
1155
|
+
request
|
|
1156
|
+
);
|
|
1157
|
+
trimExecutions();
|
|
1158
|
+
const classification = classifyRunRequestReplayEvidence(
|
|
1159
|
+
request,
|
|
1160
|
+
adapterInputs.get(request.adapterInputId)?.value
|
|
1161
|
+
);
|
|
1162
|
+
if (classification.kind !== "fresh") {
|
|
1163
|
+
executions.delete(coordinate);
|
|
1164
|
+
publishReplayClassification(request, classification);
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
return true;
|
|
1168
|
+
}
|
|
1169
|
+
function publishReplayClassification(request, classification) {
|
|
1170
|
+
if (classification.kind === "fresh") return false;
|
|
1171
|
+
if (classification.kind === "missing-input") {
|
|
1172
|
+
const issueCode = "tool-provider-adapter-runtime-missing-input";
|
|
1173
|
+
const issue = dataIssue(
|
|
1174
|
+
issueCode,
|
|
1175
|
+
"Tool provider adapter runtime requires the requested adapter input.",
|
|
1176
|
+
{
|
|
1177
|
+
subjectId: request.adapterInputId,
|
|
1178
|
+
refs: [ref("tool-provider-adapter-run", request.runId)],
|
|
1179
|
+
details: {
|
|
1180
|
+
adapterInputId: request.adapterInputId,
|
|
1181
|
+
runId: request.runId,
|
|
1182
|
+
attempt: request.attempt,
|
|
1183
|
+
issueCode
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
publishIssue(issue);
|
|
1188
|
+
publishRunStatus(request, "missing-input", [issue]);
|
|
1189
|
+
return true;
|
|
1190
|
+
}
|
|
1191
|
+
publishRetentionGap(request, classification);
|
|
1192
|
+
return true;
|
|
1193
|
+
}
|
|
1194
|
+
function publishRetentionGap(request, classification) {
|
|
1195
|
+
publishAdapterRuntimeRetentionGap(
|
|
1196
|
+
{ publishIssue, publishRunStatus, publishRuntimeStatus, publishRuntimeAudit },
|
|
1197
|
+
request,
|
|
1198
|
+
classification
|
|
1199
|
+
);
|
|
1200
|
+
}
|
|
1201
|
+
function publishRetentionEvidenceGlobalFailClosed(victim) {
|
|
1202
|
+
publishAdapterRuntimeRetentionEvidenceGlobalFailClosed(
|
|
1203
|
+
{ publishIssue, publishRunStatus, publishRuntimeStatus, publishRuntimeAudit },
|
|
1204
|
+
victim
|
|
1205
|
+
);
|
|
1206
|
+
}
|
|
1207
|
+
function runRequest(request) {
|
|
1208
|
+
runAdapterRuntimeRequest(
|
|
1209
|
+
{
|
|
1210
|
+
isDisposed: () => disposed,
|
|
1211
|
+
adapterInputs,
|
|
1212
|
+
executions,
|
|
1213
|
+
bindings,
|
|
1214
|
+
now: opts.now,
|
|
1215
|
+
classifyRunRequestReplayEvidence,
|
|
1216
|
+
publishReplayClassification,
|
|
1217
|
+
startExecutionProof,
|
|
1218
|
+
executionCoordinate,
|
|
1219
|
+
publishIssue,
|
|
1220
|
+
publishRunStatus,
|
|
1221
|
+
publishStatus,
|
|
1222
|
+
publishAudit,
|
|
1223
|
+
publishOutcome,
|
|
1224
|
+
publishRuntimeFailure
|
|
1225
|
+
},
|
|
1226
|
+
request
|
|
1227
|
+
);
|
|
1228
|
+
}
|
|
1229
|
+
const unsubscribeRetentionPolicy = retentionPolicy.subscribe((msg) => {
|
|
1230
|
+
if (msg[0] === "DATA") applyRetentionPolicyFact(msg[1]);
|
|
1231
|
+
});
|
|
1232
|
+
const unsubscribeInputs = opts.inputs.subscribe((msg) => {
|
|
1233
|
+
if (msg[0] !== "DATA") return;
|
|
1234
|
+
const input = msg[1];
|
|
1235
|
+
if (isRetentionEvidenceClosed(input.adapterInputId)) {
|
|
1236
|
+
adapterInputs.delete(input.adapterInputId);
|
|
1237
|
+
dropProjectorInput(input.adapterInputId);
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
if (trimmedAdapterInputIds.delete(input.adapterInputId)) {
|
|
1241
|
+
retentionEvidence.delete(`adapter-input-trimmed:${input.adapterInputId}`);
|
|
1242
|
+
}
|
|
1243
|
+
const sequence = nextRetentionSequence();
|
|
1244
|
+
adapterInputs.set(
|
|
1245
|
+
input.adapterInputId,
|
|
1246
|
+
adapterInputRetentionEntry(input.adapterInputId, sequence, input, nowMs()),
|
|
1247
|
+
input
|
|
1248
|
+
);
|
|
1249
|
+
trimAdapterInputs();
|
|
1250
|
+
});
|
|
1251
|
+
const runProjector = toolProviderAdapterRunProjectorInternal(graph, {
|
|
1252
|
+
name: `${name}/runs`,
|
|
1253
|
+
inputs: opts.inputs,
|
|
1254
|
+
runRequests: opts.runRequests,
|
|
1255
|
+
autoRunReadyInputs: opts.autoRunReadyInputs,
|
|
1256
|
+
now: opts.now,
|
|
1257
|
+
publicText: opts.publicText,
|
|
1258
|
+
privateRetentionHooks: {
|
|
1259
|
+
onRunRequestKey(entry) {
|
|
1260
|
+
trackRunRequest(entry.request, entry.key, entry.dropKey);
|
|
1261
|
+
},
|
|
1262
|
+
onRunStatusKey(entry) {
|
|
1263
|
+
trackRunStatus(entry.status, entry.key, entry.dropKey);
|
|
1264
|
+
},
|
|
1265
|
+
onRunIssueKey(entry) {
|
|
1266
|
+
trackRunIssue(entry.issue, entry.key, entry.dropKey);
|
|
1267
|
+
},
|
|
1268
|
+
onAdapterInputKey(entry) {
|
|
1269
|
+
if (isRetentionEvidenceClosed(entry.adapterInputId) || !adapterInputs.has(entry.adapterInputId)) {
|
|
1270
|
+
entry.dropInput();
|
|
1271
|
+
projectorInputDropById.delete(entry.adapterInputId);
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
projectorInputDropById.set(entry.adapterInputId, entry.dropInput);
|
|
1275
|
+
},
|
|
1276
|
+
classifyRetainedRunRequestReplayEvidence
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1279
|
+
const unsubscribeRunProjectorStatus = runProjector.status.subscribe((msg) => {
|
|
1280
|
+
if (msg[0] === "DATA") {
|
|
1281
|
+
const statusFact = msg[1];
|
|
1282
|
+
runStatus.down([["DATA", statusFact]]);
|
|
1283
|
+
}
|
|
1284
|
+
});
|
|
1285
|
+
const unsubscribeRunProjectorIssues = runProjector.issues.subscribe((msg) => {
|
|
1286
|
+
if (msg[0] === "DATA") publishIssue(msg[1], false);
|
|
1287
|
+
});
|
|
1288
|
+
const unsubscribeRunProjectorAudit = runProjector.audit.subscribe((msg) => {
|
|
1289
|
+
if (msg[0] === "DATA") audit.down([["DATA", msg[1]]]);
|
|
1290
|
+
});
|
|
1291
|
+
const unsubscribeRunRequests = runProjector.requests.subscribe((msg) => {
|
|
1292
|
+
if (msg[0] !== "DATA") return;
|
|
1293
|
+
const request = msg[1];
|
|
1294
|
+
runRequest(request);
|
|
1295
|
+
});
|
|
1296
|
+
return {
|
|
1297
|
+
runRequests: runProjector.requests,
|
|
1298
|
+
runStatus,
|
|
1299
|
+
runtimeStatus,
|
|
1300
|
+
outcomes,
|
|
1301
|
+
status,
|
|
1302
|
+
issues,
|
|
1303
|
+
audit,
|
|
1304
|
+
dispose() {
|
|
1305
|
+
if (disposed) return;
|
|
1306
|
+
disposed = true;
|
|
1307
|
+
unsubscribeRetentionPolicy();
|
|
1308
|
+
unsubscribeInputs();
|
|
1309
|
+
unsubscribeRunProjectorStatus();
|
|
1310
|
+
unsubscribeRunProjectorIssues();
|
|
1311
|
+
unsubscribeRunProjectorAudit();
|
|
1312
|
+
unsubscribeRunRequests();
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
export {
|
|
1318
|
+
attachToolProviderAdapterRuntime
|
|
1319
|
+
};
|
|
1320
|
+
//# sourceMappingURL=chunk-2NJP6GO4.js.map
|