@graphrefly/graphrefly 0.47.1 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base/composition/index.cjs +28 -19
- package/dist/base/composition/index.cjs.map +1 -1
- package/dist/base/composition/index.d.cts +14 -5
- package/dist/base/composition/index.d.ts +14 -5
- package/dist/base/composition/index.js +9 -9
- package/dist/base/index.cjs +294 -164
- package/dist/base/index.cjs.map +1 -1
- package/dist/base/index.d.cts +2 -2
- package/dist/base/index.d.ts +2 -2
- package/dist/base/index.js +77 -72
- package/dist/base/io/index.cjs +145 -85
- package/dist/base/io/index.cjs.map +1 -1
- package/dist/base/io/index.d.cts +32 -5
- package/dist/base/io/index.d.ts +32 -5
- package/dist/base/io/index.js +5 -5
- package/dist/base/mutation/index.cjs +21 -0
- package/dist/base/mutation/index.cjs.map +1 -1
- package/dist/base/mutation/index.d.cts +23 -1
- package/dist/base/mutation/index.d.ts +23 -1
- package/dist/base/mutation/index.js +3 -1
- package/dist/base/sources/browser/index.cjs +18 -12
- package/dist/base/sources/browser/index.cjs.map +1 -1
- package/dist/base/sources/browser/index.d.cts +20 -2
- package/dist/base/sources/browser/index.d.ts +20 -2
- package/dist/base/sources/browser/index.js +18 -12
- package/dist/base/sources/browser/index.js.map +1 -1
- package/dist/base/sources/event/index.cjs +29 -1
- package/dist/base/sources/event/index.cjs.map +1 -1
- package/dist/base/sources/event/index.d.cts +67 -3
- package/dist/base/sources/event/index.d.ts +67 -3
- package/dist/base/sources/event/index.js +5 -2
- package/dist/base/sources/index.cjs +96 -50
- package/dist/base/sources/index.cjs.map +1 -1
- package/dist/base/sources/index.d.cts +1 -1
- package/dist/base/sources/index.d.ts +1 -1
- package/dist/base/sources/index.js +7 -4
- package/dist/base/sources/node/index.cjs +43 -37
- package/dist/base/sources/node/index.cjs.map +1 -1
- package/dist/base/sources/node/index.js +43 -37
- package/dist/base/sources/node/index.js.map +1 -1
- package/dist/{chunk-J5WFUEO4.js → chunk-23MAWVOJ.js} +3 -3
- package/dist/{chunk-YXCPV26R.js → chunk-3REMCHSS.js} +39 -27
- package/dist/chunk-3REMCHSS.js.map +1 -0
- package/dist/{chunk-CEVNQ74M.js → chunk-3YGXPUHW.js} +2 -2
- package/dist/{chunk-CEVNQ74M.js.map → chunk-3YGXPUHW.js.map} +1 -1
- package/dist/{chunk-EVYY4X5A.js → chunk-46X2EFQH.js} +16 -5
- package/dist/chunk-46X2EFQH.js.map +1 -0
- package/dist/{chunk-NY2PYHNC.js → chunk-5UY3PNFY.js} +12 -5
- package/dist/chunk-5UY3PNFY.js.map +1 -0
- package/dist/{chunk-RGMTUZCL.js → chunk-65OM4XLQ.js} +50 -4
- package/dist/chunk-65OM4XLQ.js.map +1 -0
- package/dist/{chunk-3PSLNJDU.js → chunk-6DQYBIHW.js} +314 -49
- package/dist/chunk-6DQYBIHW.js.map +1 -0
- package/dist/{chunk-LDCSZ72P.js → chunk-6YBER5UP.js} +3 -3
- package/dist/{chunk-LDCSZ72P.js.map → chunk-6YBER5UP.js.map} +1 -1
- package/dist/{chunk-7EGRP2VX.js → chunk-7BULJTL6.js} +2 -2
- package/dist/{chunk-7EGRP2VX.js.map → chunk-7BULJTL6.js.map} +1 -1
- package/dist/{chunk-VLAGJZSL.js → chunk-7T7WLEPM.js} +25 -4
- package/dist/chunk-7T7WLEPM.js.map +1 -0
- package/dist/{chunk-PKPO3JTZ.js → chunk-AQAKDE7F.js} +29 -11
- package/dist/chunk-AQAKDE7F.js.map +1 -0
- package/dist/{chunk-2OB3CEJS.js → chunk-B5Y5GPD5.js} +2 -2
- package/dist/{chunk-BXGZFGZ4.js → chunk-C5QD5DQX.js} +22 -1
- package/dist/chunk-C5QD5DQX.js.map +1 -0
- package/dist/{chunk-4XCHZRUJ.js → chunk-D5YGR4TP.js} +58 -7
- package/dist/chunk-D5YGR4TP.js.map +1 -0
- package/dist/{chunk-NPRP3MCV.js → chunk-DHDCOOJU.js} +2 -2
- package/dist/chunk-DHDCOOJU.js.map +1 -0
- package/dist/{chunk-MTTRCEJT.js → chunk-DVTDF5OI.js} +2 -2
- package/dist/{chunk-SOOKUYVM.js → chunk-F7EKHR32.js} +13 -9
- package/dist/chunk-F7EKHR32.js.map +1 -0
- package/dist/{chunk-A7KV5UK4.js → chunk-G7H6PN7P.js} +2 -2
- package/dist/{chunk-OCUDSN63.js → chunk-GGKHHG5Y.js} +110 -64
- package/dist/chunk-GGKHHG5Y.js.map +1 -0
- package/dist/{chunk-RAGGHLCV.js → chunk-GUNIRPEJ.js} +8 -6
- package/dist/{chunk-RAGGHLCV.js.map → chunk-GUNIRPEJ.js.map} +1 -1
- package/dist/{chunk-YJ4U2D2C.js → chunk-J5TBZFBD.js} +9 -7
- package/dist/chunk-J5TBZFBD.js.map +1 -0
- package/dist/{chunk-Y52CS6YA.js → chunk-JA67ZQG2.js} +2 -2
- package/dist/{chunk-Y52CS6YA.js.map → chunk-JA67ZQG2.js.map} +1 -1
- package/dist/{chunk-U225SKB4.js → chunk-K4ZYJ4EM.js} +569 -424
- package/dist/chunk-K4ZYJ4EM.js.map +1 -0
- package/dist/{chunk-Z4YXAUDN.js → chunk-KUFXLAEY.js} +11 -7
- package/dist/{chunk-Z4YXAUDN.js.map → chunk-KUFXLAEY.js.map} +1 -1
- package/dist/{chunk-IHTWQEDR.js → chunk-LTSI7ULC.js} +3 -3
- package/dist/{chunk-IHTWQEDR.js.map → chunk-LTSI7ULC.js.map} +1 -1
- package/dist/{chunk-DKNHAICT.js → chunk-MMHGYX44.js} +25 -9
- package/dist/chunk-MMHGYX44.js.map +1 -0
- package/dist/{chunk-K7PDZYQE.js → chunk-MQMTRKY3.js} +129 -50
- package/dist/chunk-MQMTRKY3.js.map +1 -0
- package/dist/{chunk-42FQ27MQ.js → chunk-MTODGQBR.js} +44 -179
- package/dist/chunk-MTODGQBR.js.map +1 -0
- package/dist/{chunk-O3MT7DYI.js → chunk-N6MNJNHB.js} +2 -2
- package/dist/{chunk-FVINAAKA.js → chunk-NBK6QQMG.js} +14 -13
- package/dist/{chunk-FVINAAKA.js.map → chunk-NBK6QQMG.js.map} +1 -1
- package/dist/{chunk-DM4OMPWK.js → chunk-NSA5K5G2.js} +2 -2
- package/dist/{chunk-MLTPJMH6.js → chunk-QQYULEZL.js} +2 -2
- package/dist/chunk-QSW4DFKE.js +31 -0
- package/dist/chunk-QSW4DFKE.js.map +1 -0
- package/dist/{chunk-PZWISPIQ.js → chunk-S7HN5FHL.js} +17 -11
- package/dist/chunk-S7HN5FHL.js.map +1 -0
- package/dist/{chunk-4S53H2KR.js → chunk-SUNCHMML.js} +2 -2
- package/dist/{chunk-4GYMCUDZ.js → chunk-T2U6N3FV.js} +7 -7
- package/dist/{chunk-RJOG4IJU.js → chunk-T5URUIIY.js} +50 -35
- package/dist/chunk-T5URUIIY.js.map +1 -0
- package/dist/{chunk-B4AKFXGE.js → chunk-TPTZZV25.js} +6 -6
- package/dist/chunk-TPTZZV25.js.map +1 -0
- package/dist/{chunk-BU3SEFA5.js → chunk-V46JWFGV.js} +7 -6
- package/dist/chunk-V46JWFGV.js.map +1 -0
- package/dist/{chunk-IJRR6YAI.js → chunk-VLDRAMP7.js} +18 -12
- package/dist/chunk-VLDRAMP7.js.map +1 -0
- package/dist/{chunk-6XZYT4SW.js → chunk-X6ESZDR6.js} +8 -9
- package/dist/chunk-X6ESZDR6.js.map +1 -0
- package/dist/{chunk-E5OZPDIW.js → chunk-X7BA5PWG.js} +7 -5
- package/dist/chunk-X7BA5PWG.js.map +1 -0
- package/dist/{chunk-CXANAIZU.js → chunk-XEWV254I.js} +3 -3
- package/dist/{chunk-CXANAIZU.js.map → chunk-XEWV254I.js.map} +1 -1
- package/dist/{chunk-V4Y3TM7U.js → chunk-YBJVKMTM.js} +38 -16
- package/dist/chunk-YBJVKMTM.js.map +1 -0
- package/dist/{chunk-7ADWWI2T.js → chunk-ZW32BPXV.js} +17 -6
- package/dist/chunk-ZW32BPXV.js.map +1 -0
- package/dist/compat/index.cjs +52 -5
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +1 -1
- package/dist/compat/index.d.ts +1 -1
- package/dist/compat/index.js +7 -7
- package/dist/compat/nestjs/index.cjs +52 -5
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +1 -1
- package/dist/compat/nestjs/index.d.ts +1 -1
- package/dist/compat/nestjs/index.js +4 -4
- package/dist/{fallback-Bx46zqky.d.cts → fallback-BROR6ZhO.d.cts} +1 -1
- package/dist/{fallback-pIWW8A2d.d.ts → fallback-DO80aM_3.d.ts} +1 -1
- package/dist/{index-B_p8tnvf.d.cts → index-D1z3XcF9.d.cts} +1 -0
- package/dist/{index-_HDSmPyp.d.ts → index-DZ6yua0Q.d.ts} +1 -0
- package/dist/index.cjs +2387 -1707
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +173 -150
- package/dist/index.js.map +1 -1
- package/dist/presets/ai/index.cjs +88 -26
- package/dist/presets/ai/index.cjs.map +1 -1
- package/dist/presets/ai/index.js +14 -14
- package/dist/presets/harness/index.cjs +183 -51
- package/dist/presets/harness/index.cjs.map +1 -1
- package/dist/presets/harness/index.d.cts +15 -5
- package/dist/presets/harness/index.d.ts +15 -5
- package/dist/presets/harness/index.js +26 -26
- package/dist/presets/index.cjs +298 -101
- package/dist/presets/index.cjs.map +1 -1
- package/dist/presets/index.d.cts +2 -2
- package/dist/presets/index.d.ts +2 -2
- package/dist/presets/index.js +49 -49
- package/dist/presets/inspect/index.cjs +63 -14
- package/dist/presets/inspect/index.cjs.map +1 -1
- package/dist/presets/inspect/index.d.cts +1 -1
- package/dist/presets/inspect/index.d.ts +1 -1
- package/dist/presets/inspect/index.js +6 -6
- package/dist/presets/resilience/index.cjs +64 -44
- package/dist/presets/resilience/index.cjs.map +1 -1
- package/dist/presets/resilience/index.d.cts +12 -8
- package/dist/presets/resilience/index.d.ts +12 -8
- package/dist/presets/resilience/index.js +6 -6
- package/dist/{rate-limiter-DpVbSYdH.d.cts → rate-limiter-DC26FM8J.d.cts} +10 -1
- package/dist/{rate-limiter-CEALq4N1.d.ts → rate-limiter-DyWpwpQP.d.ts} +10 -1
- package/dist/{reactive-layout-fswlBUvX.d.ts → reactive-layout-BBBWH0V_.d.cts} +85 -4
- package/dist/{reactive-layout-fswlBUvX.d.cts → reactive-layout-BBBWH0V_.d.ts} +85 -4
- package/dist/solutions/index.cjs +239 -92
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +2 -2
- package/dist/solutions/index.d.ts +2 -2
- package/dist/solutions/index.js +32 -32
- package/dist/{spawnable-5mDY501F.d.cts → spawnable-B2IlW60f.d.cts} +23 -2
- package/dist/{spawnable-D3lR0oQu.d.ts → spawnable-tttFz2Nh.d.ts} +23 -2
- package/dist/testing/index.cjs +94 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +59 -0
- package/dist/testing/index.d.ts +59 -0
- package/dist/testing/index.js +73 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/{timeout-U5O4ESK3.js → timeout-BEABACRP.js} +2 -2
- package/dist/utils/ai/browser.cjs.map +1 -1
- package/dist/utils/ai/browser.d.cts +2 -2
- package/dist/utils/ai/browser.d.ts +2 -2
- package/dist/utils/ai/browser.js +10 -10
- package/dist/utils/ai/browser.js.map +1 -1
- package/dist/utils/ai/index.cjs +291 -191
- package/dist/utils/ai/index.cjs.map +1 -1
- package/dist/utils/ai/index.d.cts +108 -12
- package/dist/utils/ai/index.d.ts +108 -12
- package/dist/utils/ai/index.js +23 -21
- package/dist/utils/ai/node.cjs.map +1 -1
- package/dist/utils/ai/node.d.cts +5 -5
- package/dist/utils/ai/node.d.ts +5 -5
- package/dist/utils/ai/node.js +3 -3
- package/dist/utils/ai/node.js.map +1 -1
- package/dist/utils/cqrs/index.cjs +29 -3
- package/dist/utils/cqrs/index.cjs.map +1 -1
- package/dist/utils/cqrs/index.d.cts +12 -7
- package/dist/utils/cqrs/index.d.ts +12 -7
- package/dist/utils/cqrs/index.js +2 -2
- package/dist/utils/demo-shell/index.cjs +45 -19
- package/dist/utils/demo-shell/index.cjs.map +1 -1
- package/dist/utils/demo-shell/index.d.cts +1 -1
- package/dist/utils/demo-shell/index.d.ts +1 -1
- package/dist/utils/demo-shell/index.js +2 -2
- package/dist/utils/domain-templates/index.cjs +1 -1
- package/dist/utils/domain-templates/index.cjs.map +1 -1
- package/dist/utils/domain-templates/index.js +3 -3
- package/dist/utils/graphspec/index.cjs +1 -1
- package/dist/utils/graphspec/index.cjs.map +1 -1
- package/dist/utils/graphspec/index.js +3 -3
- package/dist/utils/harness/index.cjs +16 -10
- package/dist/utils/harness/index.cjs.map +1 -1
- package/dist/utils/harness/index.js +1 -1
- package/dist/utils/index.cjs +1692 -1192
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +7 -7
- package/dist/utils/index.d.ts +7 -7
- package/dist/utils/index.js +77 -59
- package/dist/utils/inspect/index.cjs +52 -4
- package/dist/utils/inspect/index.cjs.map +1 -1
- package/dist/utils/inspect/index.d.cts +32 -3
- package/dist/utils/inspect/index.d.ts +32 -3
- package/dist/utils/inspect/index.js +4 -4
- package/dist/utils/job-queue/index.cjs +46 -9
- package/dist/utils/job-queue/index.cjs.map +1 -1
- package/dist/utils/job-queue/index.d.cts +33 -3
- package/dist/utils/job-queue/index.d.ts +33 -3
- package/dist/utils/job-queue/index.js +2 -2
- package/dist/utils/memory/index.cjs +570 -425
- package/dist/utils/memory/index.cjs.map +1 -1
- package/dist/utils/memory/index.d.cts +261 -33
- package/dist/utils/memory/index.d.ts +261 -33
- package/dist/utils/memory/index.js +10 -2
- package/dist/utils/messaging/index.cjs.map +1 -1
- package/dist/utils/messaging/index.d.cts +4 -3
- package/dist/utils/messaging/index.d.ts +4 -3
- package/dist/utils/messaging/index.js +2 -2
- package/dist/utils/orchestration/index.cjs +14 -3
- package/dist/utils/orchestration/index.cjs.map +1 -1
- package/dist/utils/orchestration/index.js +3 -3
- package/dist/utils/process/index.cjs +32 -2
- package/dist/utils/process/index.cjs.map +1 -1
- package/dist/utils/process/index.d.cts +4 -3
- package/dist/utils/process/index.d.ts +4 -3
- package/dist/utils/process/index.js +3 -3
- package/dist/utils/reactive-layout/index.cjs +184 -55
- package/dist/utils/reactive-layout/index.cjs.map +1 -1
- package/dist/utils/reactive-layout/index.d.cts +128 -3
- package/dist/utils/reactive-layout/index.d.ts +128 -3
- package/dist/utils/reactive-layout/index.js +16 -8
- package/dist/utils/reduction/index.cjs +1 -1
- package/dist/utils/reduction/index.cjs.map +1 -1
- package/dist/utils/reduction/index.js +2 -2
- package/dist/utils/resilience/index.cjs +64 -43
- package/dist/utils/resilience/index.cjs.map +1 -1
- package/dist/utils/resilience/index.d.cts +1 -1
- package/dist/utils/resilience/index.d.ts +1 -1
- package/dist/utils/resilience/index.js +5 -5
- package/dist/utils/surface/index.cjs +1 -1
- package/dist/utils/surface/index.cjs.map +1 -1
- package/dist/utils/surface/index.js +4 -4
- package/package.json +15 -3
- package/dist/chunk-3PSLNJDU.js.map +0 -1
- package/dist/chunk-42FQ27MQ.js.map +0 -1
- package/dist/chunk-4XCHZRUJ.js.map +0 -1
- package/dist/chunk-6XZYT4SW.js.map +0 -1
- package/dist/chunk-7ADWWI2T.js.map +0 -1
- package/dist/chunk-B4AKFXGE.js.map +0 -1
- package/dist/chunk-BU3SEFA5.js.map +0 -1
- package/dist/chunk-BXGZFGZ4.js.map +0 -1
- package/dist/chunk-DKNHAICT.js.map +0 -1
- package/dist/chunk-E5OZPDIW.js.map +0 -1
- package/dist/chunk-EVYY4X5A.js.map +0 -1
- package/dist/chunk-IJRR6YAI.js.map +0 -1
- package/dist/chunk-K7PDZYQE.js.map +0 -1
- package/dist/chunk-NPRP3MCV.js.map +0 -1
- package/dist/chunk-NY2PYHNC.js.map +0 -1
- package/dist/chunk-OCUDSN63.js.map +0 -1
- package/dist/chunk-PKPO3JTZ.js.map +0 -1
- package/dist/chunk-PZWISPIQ.js.map +0 -1
- package/dist/chunk-RGMTUZCL.js.map +0 -1
- package/dist/chunk-RJOG4IJU.js.map +0 -1
- package/dist/chunk-SOOKUYVM.js.map +0 -1
- package/dist/chunk-U225SKB4.js.map +0 -1
- package/dist/chunk-V4Y3TM7U.js.map +0 -1
- package/dist/chunk-VLAGJZSL.js.map +0 -1
- package/dist/chunk-W2BOPXTI.js +0 -1
- package/dist/chunk-YJ4U2D2C.js.map +0 -1
- package/dist/chunk-YXCPV26R.js.map +0 -1
- package/dist/timeout-U5O4ESK3.js.map +0 -1
- /package/dist/{chunk-J5WFUEO4.js.map → chunk-23MAWVOJ.js.map} +0 -0
- /package/dist/{chunk-2OB3CEJS.js.map → chunk-B5Y5GPD5.js.map} +0 -0
- /package/dist/{chunk-MTTRCEJT.js.map → chunk-DVTDF5OI.js.map} +0 -0
- /package/dist/{chunk-A7KV5UK4.js.map → chunk-G7H6PN7P.js.map} +0 -0
- /package/dist/{chunk-O3MT7DYI.js.map → chunk-N6MNJNHB.js.map} +0 -0
- /package/dist/{chunk-DM4OMPWK.js.map → chunk-NSA5K5G2.js.map} +0 -0
- /package/dist/{chunk-MLTPJMH6.js.map → chunk-QQYULEZL.js.map} +0 -0
- /package/dist/{chunk-4S53H2KR.js.map → chunk-SUNCHMML.js.map} +0 -0
- /package/dist/{chunk-4GYMCUDZ.js.map → chunk-T2U6N3FV.js.map} +0 -0
- /package/dist/{chunk-W2BOPXTI.js.map → timeout-BEABACRP.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as TokenUsage, L as LLMAdapter, g as PricingFn, a as ChatMessage, b as LLMInvokeOptions, k as ToolDefinition, c as LLMResponse, S as StreamDelta } from '../../types-BB5Lw-pB.cjs';
|
|
2
|
-
export { C as CapabilitiesRegistry, M as ModelCapabilities, d as ModelFeatures, e as ModelLimits, f as ModelPricing, P as PriceBreakdown, h as PricingRegistry, R as Rate, T as TieredRate,
|
|
1
|
+
import { i as TokenUsage, L as LLMAdapter, g as PricingFn, a as ChatMessage, b as LLMInvokeOptions, k as ToolDefinition, c as LLMResponse, S as StreamDelta, j as ToolCall } from '../../types-BB5Lw-pB.cjs';
|
|
2
|
+
export { C as CapabilitiesRegistry, M as ModelCapabilities, d as ModelFeatures, e as ModelLimits, f as ModelPricing, P as PriceBreakdown, h as PricingRegistry, R as Rate, T as TieredRate, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, p as pricingFor, r as registryPricing, z as zeroPrice } from '../../types-BB5Lw-pB.cjs';
|
|
3
3
|
import { C as CascadeExhaustionReport } from '../../cascading-baGkiihI.cjs';
|
|
4
4
|
export { A as AdapterProvider, a as AdapterTier, b as AllTiersExhaustedError, c as CascadingLlmAdapterOptions, d as CreateAdapterOptions, O as OpenAICompatAdapterOptions, e as OpenAICompatPreset, f as OpenAISdkLike, g as cascadingLlmAdapter, h as createAdapter, o as openAICompatAdapter, t as tier } from '../../cascading-baGkiihI.cjs';
|
|
5
5
|
import { Node, Actor } from '@graphrefly/pure-ts/core';
|
|
@@ -7,8 +7,8 @@ import { ReactiveLogBundle, NodeInput } from '@graphrefly/pure-ts/extra';
|
|
|
7
7
|
import { a as CircuitBreakerOptions, C as CircuitBreaker } from '../../breaker-ugSdq54q.cjs';
|
|
8
8
|
export { b as CircuitOpenError } from '../../breaker-ugSdq54q.cjs';
|
|
9
9
|
import { R as RateLimitSignal, A as AdaptiveRateLimiterBundle } from '../../adaptive-rate-limiter-Dch_xYIi.cjs';
|
|
10
|
-
import { W as WithReplayCacheOptions } from '../../fallback-
|
|
11
|
-
export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, f as fallbackAdapter, w as withReplayCache } from '../../fallback-
|
|
10
|
+
import { W as WithReplayCacheOptions } from '../../fallback-BROR6ZhO.cjs';
|
|
11
|
+
export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, f as fallbackAdapter, w as withReplayCache } from '../../fallback-BROR6ZhO.cjs';
|
|
12
12
|
import { E as Extraction } from '../../distill-De6Rnn15.cjs';
|
|
13
13
|
import { Graph } from '@graphrefly/pure-ts/graph';
|
|
14
14
|
import { TopicGraph } from '../messaging/index.cjs';
|
|
@@ -900,7 +900,7 @@ declare function llmConsolidator<TMem>(systemPrompt: string, opts: LLMConsolidat
|
|
|
900
900
|
* **Retry / replay-cache.** Stack middleware on the adapter:
|
|
901
901
|
*
|
|
902
902
|
* ```ts
|
|
903
|
-
* import { withRetry, withReplayCache } from "@graphrefly/graphrefly/
|
|
903
|
+
* import { withRetry, withReplayCache } from "@graphrefly/graphrefly/utils/ai";
|
|
904
904
|
*
|
|
905
905
|
* const adapter = withRetry(
|
|
906
906
|
* withReplayCache(baseAdapter, { keyFn: (ctx) => ctx.messages[0].content }),
|
|
@@ -1413,7 +1413,7 @@ type HandoffOptions = {
|
|
|
1413
1413
|
*
|
|
1414
1414
|
* @example Full handoff on a triage signal.
|
|
1415
1415
|
* ```ts
|
|
1416
|
-
* import { handoff, promptNode } from "@graphrefly/graphrefly/
|
|
1416
|
+
* import { handoff, promptNode } from "@graphrefly/graphrefly/utils/ai";
|
|
1417
1417
|
*
|
|
1418
1418
|
* const triage = promptNode(adapter, [userMessage], (msg) =>
|
|
1419
1419
|
* `Classify urgency of: ${msg}. Reply "high" or "normal".`);
|
|
@@ -1447,6 +1447,91 @@ type HandoffOptions = {
|
|
|
1447
1447
|
*/
|
|
1448
1448
|
declare function handoff<T>(from: NodeInput<T | null>, toFactory: (input: Node<T>) => Node<T | null>, opts?: HandoffOptions): Node<T | null>;
|
|
1449
1449
|
|
|
1450
|
+
/**
|
|
1451
|
+
* Options for {@link toolInterceptor}.
|
|
1452
|
+
*/
|
|
1453
|
+
interface ToolInterceptorOptions {
|
|
1454
|
+
readonly name?: string;
|
|
1455
|
+
/**
|
|
1456
|
+
* Kill-switch. When this reactive Node emits `false`, **every** tool call
|
|
1457
|
+
* in the wave is denied and the turn collapses to a clean no-op (RESOLVED,
|
|
1458
|
+
* not an empty-array execution). An explicit `null` / `undefined` DATA
|
|
1459
|
+
* value is pass-through ("deny when explicitly `false`"). Like
|
|
1460
|
+
* {@link ToolInterceptorOptions.allow}, a switch node that has never
|
|
1461
|
+
* emitted has **unspecified** gating — **always seed it**
|
|
1462
|
+
* (`node([], { initial: true })`). Modelled as a reactive deny-signal, NOT
|
|
1463
|
+
* a buffering `valve`: a security kill-switch must DROP denied calls,
|
|
1464
|
+
* never buffer-and-replay them after re-enable — a re-enable with no fresh
|
|
1465
|
+
* `calls` wave is a no-op (see {@link ToolInterceptorOptions.allow}).
|
|
1466
|
+
*/
|
|
1467
|
+
readonly enabled?: NodeInput<boolean>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Per-call allow predicates. A tool call is forwarded iff **every**
|
|
1470
|
+
* predicate returns `true`. A predicate that has emitted an explicit
|
|
1471
|
+
* `null` / `undefined` DATA value is pass-through (the policy author's
|
|
1472
|
+
* "not-ready, allow" signal). **Always seed each predicate node with an
|
|
1473
|
+
* `initial`** (e.g. `node([], { initial: null })` for pass-through-while-
|
|
1474
|
+
* loading, or an initial predicate fn): a predicate node that has *never*
|
|
1475
|
+
* emitted DATA has **unspecified** gating — depending on activation order
|
|
1476
|
+
* the non-partial first-run gate may hold the tool turn or pass through,
|
|
1477
|
+
* so a never-seeded policy must not be relied on either way. A predicate
|
|
1478
|
+
* that **throws** is treated as **deny** for that call (a security gate
|
|
1479
|
+
* must never fail open on a buggy policy).
|
|
1480
|
+
*
|
|
1481
|
+
* **Re-filtering is calls-driven, not predicate-driven.** A predicate (or
|
|
1482
|
+
* {@link enabled}) change *alone* never re-emits an in-flight batch — that
|
|
1483
|
+
* would replay a previously-denied batch with no LLM in the loop
|
|
1484
|
+
* (confused-deputy). The post-intercept stream only re-evaluates on a
|
|
1485
|
+
* *fresh* `calls` wave; predicate/switch updates take effect on the next
|
|
1486
|
+
* tool-call batch.
|
|
1487
|
+
*/
|
|
1488
|
+
readonly allow?: readonly NodeInput<(call: ToolCall) => boolean>[];
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Reactive tool-call **enforcement** (COMPOSITION-GUIDE §31, Composition C).
|
|
1492
|
+
* The post-generation security counterpart to `toolSelector`'s
|
|
1493
|
+
* pre-generation UX: `toolSelector` controls what's *offered* to the LLM;
|
|
1494
|
+
* `toolInterceptor` gates what's *executed* after the LLM chooses.
|
|
1495
|
+
*
|
|
1496
|
+
* Returns a transform `(calls) => Node<readonly ToolCall[]>` shaped to slot
|
|
1497
|
+
* directly into `agentLoop`'s `interceptToolCalls` splice
|
|
1498
|
+
* (`agent-loop.ts` D9). The returned node is `derived`-kind: it sees the raw
|
|
1499
|
+
* tool-call batch, applies the kill-switch then the per-call predicates, and
|
|
1500
|
+
*
|
|
1501
|
+
* - emits the surviving subset when ≥1 call passes,
|
|
1502
|
+
* - emits `[RESOLVED]` when the switch is off OR every call is denied — a
|
|
1503
|
+
* clean no-op turn, structurally identical to `toolCallsRaw`'s own
|
|
1504
|
+
* empty-batch gate, so `toolExecution`'s non-empty contract is preserved.
|
|
1505
|
+
*
|
|
1506
|
+
* Because the splice replaces the public `agent.toolCalls` view with this
|
|
1507
|
+
* node, audit / telemetry observe the post-intercept reality.
|
|
1508
|
+
*
|
|
1509
|
+
* @example
|
|
1510
|
+
* ```ts
|
|
1511
|
+
* const killSwitch = node<boolean>([], { name: "tools-enabled", initial: true });
|
|
1512
|
+
* const loop = agentLoop("agent", {
|
|
1513
|
+
* adapter,
|
|
1514
|
+
* tools: [searchTool, deleteTool],
|
|
1515
|
+
* interceptToolCalls: toolInterceptor({
|
|
1516
|
+
* enabled: killSwitch,
|
|
1517
|
+
* allow: [
|
|
1518
|
+
* // deny destructive tools unless an external policy node says ok
|
|
1519
|
+
* node([policyNode], (b, a, c) => {
|
|
1520
|
+
* const d = b.map((x, i) => x != null && x.length > 0 ? x.at(-1) : c.prevData[i]);
|
|
1521
|
+
* a.emit((call: ToolCall) => call.name !== "delete" || d[0] === true);
|
|
1522
|
+
* }, { describeKind: "derived" }),
|
|
1523
|
+
* ],
|
|
1524
|
+
* }),
|
|
1525
|
+
* });
|
|
1526
|
+
* ```
|
|
1527
|
+
*
|
|
1528
|
+
* @param opts - {@link ToolInterceptorOptions}.
|
|
1529
|
+
* @returns A `(calls) => Node` transform for `agentLoop.interceptToolCalls`.
|
|
1530
|
+
*
|
|
1531
|
+
* @category ai
|
|
1532
|
+
*/
|
|
1533
|
+
declare function toolInterceptor(opts?: ToolInterceptorOptions): (calls: Node<readonly ToolCall[]>) => Node<readonly ToolCall[]>;
|
|
1534
|
+
|
|
1450
1535
|
/**
|
|
1451
1536
|
* Options for {@link toolSelector}.
|
|
1452
1537
|
*/
|
|
@@ -1460,10 +1545,21 @@ interface ToolSelectorOptions {
|
|
|
1460
1545
|
* so the LLM sees a reactive menu instead of a frozen config.
|
|
1461
1546
|
*
|
|
1462
1547
|
* Each predicate is a `NodeInput<(tool) => boolean>`. A tool is included iff
|
|
1463
|
-
* **every** predicate returns `true`.
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1548
|
+
* **every** predicate returns `true`. An *emitted* `null` / `undefined`
|
|
1549
|
+
* predicate DATA value is pass-through — the tool isn't excluded on its
|
|
1550
|
+
* basis ("deny when explicitly `false`, not when not-yet-ready"). **Always
|
|
1551
|
+
* seed each predicate node with an `initial`** (e.g.
|
|
1552
|
+
* `node([], { initial: null })` for pass-through-while-loading, or an
|
|
1553
|
+
* initial predicate fn): a predicate node that has *never* emitted DATA
|
|
1554
|
+
* (pure SENTINEL) has **unspecified** gating — depending on activation
|
|
1555
|
+
* order it may or may not participate in the first-run gate (the open core
|
|
1556
|
+
* SENTINEL-dep first-run-gate question), so a never-seeded predicate must
|
|
1557
|
+
* not be relied on either way. Mirrors `toolInterceptor`'s *seed-an-`initial`*
|
|
1558
|
+
* contract — but NOT its throwing-predicate behaviour: a constraint that
|
|
1559
|
+
* *throws* tears the wave with an ERROR (no fail-closed catch), because
|
|
1560
|
+
* selection is not a security boundary (a loud surface beats a silent
|
|
1561
|
+
* deny here; pair with `toolInterceptor` for enforcement).
|
|
1562
|
+
* Predicate updates recompute the selected set.
|
|
1467
1563
|
*
|
|
1468
1564
|
* Pairs with `toolInterceptor` (§D9 / §31): **selection** controls what's
|
|
1469
1565
|
* offered to the LLM (pre-generation UX); **interception** gates what's
|
|
@@ -1477,7 +1573,7 @@ interface ToolSelectorOptions {
|
|
|
1477
1573
|
* const data = batchData.map((batch, i) => batch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i]);
|
|
1478
1574
|
* actions.emit((data[0] as CostMeter).total < BUDGET);
|
|
1479
1575
|
* }, { describeKind: "derived" });
|
|
1480
|
-
* const canDestroy =
|
|
1576
|
+
* const canDestroy = node<boolean>([], { name: "destructive-allowed", initial: false });
|
|
1481
1577
|
* const tools = toolSelector(registry.schemas, [
|
|
1482
1578
|
* node([hasBudget], (batchData, actions, ctx) => {
|
|
1483
1579
|
* const data = batchData.map((batch, i) => batch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i]);
|
|
@@ -1774,4 +1870,4 @@ type GraphDefValidation = {
|
|
|
1774
1870
|
*/
|
|
1775
1871
|
declare function validateGraphDef(def: unknown): GraphDefValidation;
|
|
1776
1872
|
|
|
1777
|
-
export { type AdapterStats, type AdmissionScore3DOptions, type AdmissionScoredOptions, type AdmissionScores, type AdmissionThresholds, type AnthropicAdapterOptions, type AnthropicSdkLike, type BudgetCaps, BudgetExhaustedError, type BudgetTotals, type CallStatsEvent, CascadeExhaustionReport, ChatMessage, type ContentDecision, type ContentGateOptions, type CostMeterOptions, type CostMeterReading, type DryRunAdapterOptions, type ExtractedToolCall, type FrozenContextOptions, type GatedStreamHandle, type GatedStreamOptions, type GaugesAsContextOptions, type GoogleAdapterOptions, type GoogleSdkLike, type GoogleSdkRequestConfig, type GoogleSdkRequestParams, type GraphDefValidation, type GraphFromSpecOptions, type HandoffOptions, type HttpErrorLike, type KeywordFlag, type KeywordFlagExtractorOptions, type KnobsAsToolsResult, LLMAdapter, type LLMBudgetGateBundle, type LLMConsolidatorOptions, type LLMExtractorOptions, LLMInvokeOptions, LLMResponse, LLMTimeoutError, type McpToolSchema, type OpenAIToolSchema, PricingFn, type PromptCallOptions, type PromptNodeOptions, type RedactorOptions, type ResilientAdapterBundle, type ResilientAdapterOptions, type StampedDelta, type StrategyOperation, type StrategyPlan, StreamDelta, type StreamingPromptNodeHandle, type StreamingPromptNodeOptions, type SuggestStrategyOptions, type SystemPromptHandle, TokenUsage, ToolDefinition, type ToolSelectorOptions, type WithBreakerOptions, type WithBudgetGateOptions, type WithDryRunBundle, type WithDryRunOptions, type WithRateLimiterOptions, WithReplayCacheOptions, type WithRetryOptions, admissionFilter3D, admissionScored, anthropicAdapter, contentGate, costMeterExtractor, dryRunAdapter, frozenContext, gatedStream, gaugesAsContext, googleAdapter, graphFromSpec, graphFromSpecReactive, handoff, keywordFlagExtractor, knobsAsTools, llmConsolidator, llmExtractor, observableAdapter, parseRateLimitFromError, promptCall, promptNode, redactor, resilientAdapter, streamExtractor, streamingPromptNode, suggestStrategy, suggestStrategyReactive, systemPromptBuilder, toolCallExtractor, toolSelector, validateGraphDef, withBudgetGate, withDryRun, withLLMBreaker, withLLMTimeout, withRateLimiter, withRetry };
|
|
1873
|
+
export { type AdapterStats, type AdmissionScore3DOptions, type AdmissionScoredOptions, type AdmissionScores, type AdmissionThresholds, type AnthropicAdapterOptions, type AnthropicSdkLike, type BudgetCaps, BudgetExhaustedError, type BudgetTotals, type CallStatsEvent, CascadeExhaustionReport, ChatMessage, type ContentDecision, type ContentGateOptions, type CostMeterOptions, type CostMeterReading, type DryRunAdapterOptions, type ExtractedToolCall, type FrozenContextOptions, type GatedStreamHandle, type GatedStreamOptions, type GaugesAsContextOptions, type GoogleAdapterOptions, type GoogleSdkLike, type GoogleSdkRequestConfig, type GoogleSdkRequestParams, type GraphDefValidation, type GraphFromSpecOptions, type HandoffOptions, type HttpErrorLike, type KeywordFlag, type KeywordFlagExtractorOptions, type KnobsAsToolsResult, LLMAdapter, type LLMBudgetGateBundle, type LLMConsolidatorOptions, type LLMExtractorOptions, LLMInvokeOptions, LLMResponse, LLMTimeoutError, type McpToolSchema, type OpenAIToolSchema, PricingFn, type PromptCallOptions, type PromptNodeOptions, type RedactorOptions, type ResilientAdapterBundle, type ResilientAdapterOptions, type StampedDelta, type StrategyOperation, type StrategyPlan, StreamDelta, type StreamingPromptNodeHandle, type StreamingPromptNodeOptions, type SuggestStrategyOptions, type SystemPromptHandle, TokenUsage, ToolCall, ToolDefinition, type ToolInterceptorOptions, type ToolSelectorOptions, type WithBreakerOptions, type WithBudgetGateOptions, type WithDryRunBundle, type WithDryRunOptions, type WithRateLimiterOptions, WithReplayCacheOptions, type WithRetryOptions, admissionFilter3D, admissionScored, anthropicAdapter, contentGate, costMeterExtractor, dryRunAdapter, frozenContext, gatedStream, gaugesAsContext, googleAdapter, graphFromSpec, graphFromSpecReactive, handoff, keywordFlagExtractor, knobsAsTools, llmConsolidator, llmExtractor, observableAdapter, parseRateLimitFromError, promptCall, promptNode, redactor, resilientAdapter, streamExtractor, streamingPromptNode, suggestStrategy, suggestStrategyReactive, systemPromptBuilder, toolCallExtractor, toolInterceptor, toolSelector, validateGraphDef, withBudgetGate, withDryRun, withLLMBreaker, withLLMTimeout, withRateLimiter, withRetry };
|
package/dist/utils/ai/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as TokenUsage, L as LLMAdapter, g as PricingFn, a as ChatMessage, b as LLMInvokeOptions, k as ToolDefinition, c as LLMResponse, S as StreamDelta } from '../../types-BB5Lw-pB.js';
|
|
2
|
-
export { C as CapabilitiesRegistry, M as ModelCapabilities, d as ModelFeatures, e as ModelLimits, f as ModelPricing, P as PriceBreakdown, h as PricingRegistry, R as Rate, T as TieredRate,
|
|
1
|
+
import { i as TokenUsage, L as LLMAdapter, g as PricingFn, a as ChatMessage, b as LLMInvokeOptions, k as ToolDefinition, c as LLMResponse, S as StreamDelta, j as ToolCall } from '../../types-BB5Lw-pB.js';
|
|
2
|
+
export { C as CapabilitiesRegistry, M as ModelCapabilities, d as ModelFeatures, e as ModelLimits, f as ModelPricing, P as PriceBreakdown, h as PricingRegistry, R as Rate, T as TieredRate, l as composePricing, m as computePrice, n as createCapabilitiesRegistry, o as createPricingRegistry, p as pricingFor, r as registryPricing, z as zeroPrice } from '../../types-BB5Lw-pB.js';
|
|
3
3
|
import { C as CascadeExhaustionReport } from '../../cascading-CSSbKGrJ.js';
|
|
4
4
|
export { A as AdapterProvider, a as AdapterTier, b as AllTiersExhaustedError, c as CascadingLlmAdapterOptions, d as CreateAdapterOptions, O as OpenAICompatAdapterOptions, e as OpenAICompatPreset, f as OpenAISdkLike, g as cascadingLlmAdapter, h as createAdapter, o as openAICompatAdapter, t as tier } from '../../cascading-CSSbKGrJ.js';
|
|
5
5
|
import { Node, Actor } from '@graphrefly/pure-ts/core';
|
|
@@ -7,8 +7,8 @@ import { ReactiveLogBundle, NodeInput } from '@graphrefly/pure-ts/extra';
|
|
|
7
7
|
import { a as CircuitBreakerOptions, C as CircuitBreaker } from '../../breaker-C9skL3d8.js';
|
|
8
8
|
export { b as CircuitOpenError } from '../../breaker-C9skL3d8.js';
|
|
9
9
|
import { R as RateLimitSignal, A as AdaptiveRateLimiterBundle } from '../../adaptive-rate-limiter-Dch_xYIi.js';
|
|
10
|
-
import { W as WithReplayCacheOptions } from '../../fallback-
|
|
11
|
-
export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, f as fallbackAdapter, w as withReplayCache } from '../../fallback-
|
|
10
|
+
import { W as WithReplayCacheOptions } from '../../fallback-DO80aM_3.js';
|
|
11
|
+
export { F as FallbackAdapterOptions, a as FallbackFixture, b as FallbackMissError, c as FallbackMissPolicy, R as ReplayCacheKeyContext, d as ReplayCacheMissError, e as ReplayCacheMode, f as fallbackAdapter, w as withReplayCache } from '../../fallback-DO80aM_3.js';
|
|
12
12
|
import { E as Extraction } from '../../distill-De6Rnn15.js';
|
|
13
13
|
import { Graph } from '@graphrefly/pure-ts/graph';
|
|
14
14
|
import { TopicGraph } from '../messaging/index.js';
|
|
@@ -900,7 +900,7 @@ declare function llmConsolidator<TMem>(systemPrompt: string, opts: LLMConsolidat
|
|
|
900
900
|
* **Retry / replay-cache.** Stack middleware on the adapter:
|
|
901
901
|
*
|
|
902
902
|
* ```ts
|
|
903
|
-
* import { withRetry, withReplayCache } from "@graphrefly/graphrefly/
|
|
903
|
+
* import { withRetry, withReplayCache } from "@graphrefly/graphrefly/utils/ai";
|
|
904
904
|
*
|
|
905
905
|
* const adapter = withRetry(
|
|
906
906
|
* withReplayCache(baseAdapter, { keyFn: (ctx) => ctx.messages[0].content }),
|
|
@@ -1413,7 +1413,7 @@ type HandoffOptions = {
|
|
|
1413
1413
|
*
|
|
1414
1414
|
* @example Full handoff on a triage signal.
|
|
1415
1415
|
* ```ts
|
|
1416
|
-
* import { handoff, promptNode } from "@graphrefly/graphrefly/
|
|
1416
|
+
* import { handoff, promptNode } from "@graphrefly/graphrefly/utils/ai";
|
|
1417
1417
|
*
|
|
1418
1418
|
* const triage = promptNode(adapter, [userMessage], (msg) =>
|
|
1419
1419
|
* `Classify urgency of: ${msg}. Reply "high" or "normal".`);
|
|
@@ -1447,6 +1447,91 @@ type HandoffOptions = {
|
|
|
1447
1447
|
*/
|
|
1448
1448
|
declare function handoff<T>(from: NodeInput<T | null>, toFactory: (input: Node<T>) => Node<T | null>, opts?: HandoffOptions): Node<T | null>;
|
|
1449
1449
|
|
|
1450
|
+
/**
|
|
1451
|
+
* Options for {@link toolInterceptor}.
|
|
1452
|
+
*/
|
|
1453
|
+
interface ToolInterceptorOptions {
|
|
1454
|
+
readonly name?: string;
|
|
1455
|
+
/**
|
|
1456
|
+
* Kill-switch. When this reactive Node emits `false`, **every** tool call
|
|
1457
|
+
* in the wave is denied and the turn collapses to a clean no-op (RESOLVED,
|
|
1458
|
+
* not an empty-array execution). An explicit `null` / `undefined` DATA
|
|
1459
|
+
* value is pass-through ("deny when explicitly `false`"). Like
|
|
1460
|
+
* {@link ToolInterceptorOptions.allow}, a switch node that has never
|
|
1461
|
+
* emitted has **unspecified** gating — **always seed it**
|
|
1462
|
+
* (`node([], { initial: true })`). Modelled as a reactive deny-signal, NOT
|
|
1463
|
+
* a buffering `valve`: a security kill-switch must DROP denied calls,
|
|
1464
|
+
* never buffer-and-replay them after re-enable — a re-enable with no fresh
|
|
1465
|
+
* `calls` wave is a no-op (see {@link ToolInterceptorOptions.allow}).
|
|
1466
|
+
*/
|
|
1467
|
+
readonly enabled?: NodeInput<boolean>;
|
|
1468
|
+
/**
|
|
1469
|
+
* Per-call allow predicates. A tool call is forwarded iff **every**
|
|
1470
|
+
* predicate returns `true`. A predicate that has emitted an explicit
|
|
1471
|
+
* `null` / `undefined` DATA value is pass-through (the policy author's
|
|
1472
|
+
* "not-ready, allow" signal). **Always seed each predicate node with an
|
|
1473
|
+
* `initial`** (e.g. `node([], { initial: null })` for pass-through-while-
|
|
1474
|
+
* loading, or an initial predicate fn): a predicate node that has *never*
|
|
1475
|
+
* emitted DATA has **unspecified** gating — depending on activation order
|
|
1476
|
+
* the non-partial first-run gate may hold the tool turn or pass through,
|
|
1477
|
+
* so a never-seeded policy must not be relied on either way. A predicate
|
|
1478
|
+
* that **throws** is treated as **deny** for that call (a security gate
|
|
1479
|
+
* must never fail open on a buggy policy).
|
|
1480
|
+
*
|
|
1481
|
+
* **Re-filtering is calls-driven, not predicate-driven.** A predicate (or
|
|
1482
|
+
* {@link enabled}) change *alone* never re-emits an in-flight batch — that
|
|
1483
|
+
* would replay a previously-denied batch with no LLM in the loop
|
|
1484
|
+
* (confused-deputy). The post-intercept stream only re-evaluates on a
|
|
1485
|
+
* *fresh* `calls` wave; predicate/switch updates take effect on the next
|
|
1486
|
+
* tool-call batch.
|
|
1487
|
+
*/
|
|
1488
|
+
readonly allow?: readonly NodeInput<(call: ToolCall) => boolean>[];
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Reactive tool-call **enforcement** (COMPOSITION-GUIDE §31, Composition C).
|
|
1492
|
+
* The post-generation security counterpart to `toolSelector`'s
|
|
1493
|
+
* pre-generation UX: `toolSelector` controls what's *offered* to the LLM;
|
|
1494
|
+
* `toolInterceptor` gates what's *executed* after the LLM chooses.
|
|
1495
|
+
*
|
|
1496
|
+
* Returns a transform `(calls) => Node<readonly ToolCall[]>` shaped to slot
|
|
1497
|
+
* directly into `agentLoop`'s `interceptToolCalls` splice
|
|
1498
|
+
* (`agent-loop.ts` D9). The returned node is `derived`-kind: it sees the raw
|
|
1499
|
+
* tool-call batch, applies the kill-switch then the per-call predicates, and
|
|
1500
|
+
*
|
|
1501
|
+
* - emits the surviving subset when ≥1 call passes,
|
|
1502
|
+
* - emits `[RESOLVED]` when the switch is off OR every call is denied — a
|
|
1503
|
+
* clean no-op turn, structurally identical to `toolCallsRaw`'s own
|
|
1504
|
+
* empty-batch gate, so `toolExecution`'s non-empty contract is preserved.
|
|
1505
|
+
*
|
|
1506
|
+
* Because the splice replaces the public `agent.toolCalls` view with this
|
|
1507
|
+
* node, audit / telemetry observe the post-intercept reality.
|
|
1508
|
+
*
|
|
1509
|
+
* @example
|
|
1510
|
+
* ```ts
|
|
1511
|
+
* const killSwitch = node<boolean>([], { name: "tools-enabled", initial: true });
|
|
1512
|
+
* const loop = agentLoop("agent", {
|
|
1513
|
+
* adapter,
|
|
1514
|
+
* tools: [searchTool, deleteTool],
|
|
1515
|
+
* interceptToolCalls: toolInterceptor({
|
|
1516
|
+
* enabled: killSwitch,
|
|
1517
|
+
* allow: [
|
|
1518
|
+
* // deny destructive tools unless an external policy node says ok
|
|
1519
|
+
* node([policyNode], (b, a, c) => {
|
|
1520
|
+
* const d = b.map((x, i) => x != null && x.length > 0 ? x.at(-1) : c.prevData[i]);
|
|
1521
|
+
* a.emit((call: ToolCall) => call.name !== "delete" || d[0] === true);
|
|
1522
|
+
* }, { describeKind: "derived" }),
|
|
1523
|
+
* ],
|
|
1524
|
+
* }),
|
|
1525
|
+
* });
|
|
1526
|
+
* ```
|
|
1527
|
+
*
|
|
1528
|
+
* @param opts - {@link ToolInterceptorOptions}.
|
|
1529
|
+
* @returns A `(calls) => Node` transform for `agentLoop.interceptToolCalls`.
|
|
1530
|
+
*
|
|
1531
|
+
* @category ai
|
|
1532
|
+
*/
|
|
1533
|
+
declare function toolInterceptor(opts?: ToolInterceptorOptions): (calls: Node<readonly ToolCall[]>) => Node<readonly ToolCall[]>;
|
|
1534
|
+
|
|
1450
1535
|
/**
|
|
1451
1536
|
* Options for {@link toolSelector}.
|
|
1452
1537
|
*/
|
|
@@ -1460,10 +1545,21 @@ interface ToolSelectorOptions {
|
|
|
1460
1545
|
* so the LLM sees a reactive menu instead of a frozen config.
|
|
1461
1546
|
*
|
|
1462
1547
|
* Each predicate is a `NodeInput<(tool) => boolean>`. A tool is included iff
|
|
1463
|
-
* **every** predicate returns `true`.
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1548
|
+
* **every** predicate returns `true`. An *emitted* `null` / `undefined`
|
|
1549
|
+
* predicate DATA value is pass-through — the tool isn't excluded on its
|
|
1550
|
+
* basis ("deny when explicitly `false`, not when not-yet-ready"). **Always
|
|
1551
|
+
* seed each predicate node with an `initial`** (e.g.
|
|
1552
|
+
* `node([], { initial: null })` for pass-through-while-loading, or an
|
|
1553
|
+
* initial predicate fn): a predicate node that has *never* emitted DATA
|
|
1554
|
+
* (pure SENTINEL) has **unspecified** gating — depending on activation
|
|
1555
|
+
* order it may or may not participate in the first-run gate (the open core
|
|
1556
|
+
* SENTINEL-dep first-run-gate question), so a never-seeded predicate must
|
|
1557
|
+
* not be relied on either way. Mirrors `toolInterceptor`'s *seed-an-`initial`*
|
|
1558
|
+
* contract — but NOT its throwing-predicate behaviour: a constraint that
|
|
1559
|
+
* *throws* tears the wave with an ERROR (no fail-closed catch), because
|
|
1560
|
+
* selection is not a security boundary (a loud surface beats a silent
|
|
1561
|
+
* deny here; pair with `toolInterceptor` for enforcement).
|
|
1562
|
+
* Predicate updates recompute the selected set.
|
|
1467
1563
|
*
|
|
1468
1564
|
* Pairs with `toolInterceptor` (§D9 / §31): **selection** controls what's
|
|
1469
1565
|
* offered to the LLM (pre-generation UX); **interception** gates what's
|
|
@@ -1477,7 +1573,7 @@ interface ToolSelectorOptions {
|
|
|
1477
1573
|
* const data = batchData.map((batch, i) => batch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i]);
|
|
1478
1574
|
* actions.emit((data[0] as CostMeter).total < BUDGET);
|
|
1479
1575
|
* }, { describeKind: "derived" });
|
|
1480
|
-
* const canDestroy =
|
|
1576
|
+
* const canDestroy = node<boolean>([], { name: "destructive-allowed", initial: false });
|
|
1481
1577
|
* const tools = toolSelector(registry.schemas, [
|
|
1482
1578
|
* node([hasBudget], (batchData, actions, ctx) => {
|
|
1483
1579
|
* const data = batchData.map((batch, i) => batch != null && batch.length > 0 ? batch.at(-1) : ctx.prevData[i]);
|
|
@@ -1774,4 +1870,4 @@ type GraphDefValidation = {
|
|
|
1774
1870
|
*/
|
|
1775
1871
|
declare function validateGraphDef(def: unknown): GraphDefValidation;
|
|
1776
1872
|
|
|
1777
|
-
export { type AdapterStats, type AdmissionScore3DOptions, type AdmissionScoredOptions, type AdmissionScores, type AdmissionThresholds, type AnthropicAdapterOptions, type AnthropicSdkLike, type BudgetCaps, BudgetExhaustedError, type BudgetTotals, type CallStatsEvent, CascadeExhaustionReport, ChatMessage, type ContentDecision, type ContentGateOptions, type CostMeterOptions, type CostMeterReading, type DryRunAdapterOptions, type ExtractedToolCall, type FrozenContextOptions, type GatedStreamHandle, type GatedStreamOptions, type GaugesAsContextOptions, type GoogleAdapterOptions, type GoogleSdkLike, type GoogleSdkRequestConfig, type GoogleSdkRequestParams, type GraphDefValidation, type GraphFromSpecOptions, type HandoffOptions, type HttpErrorLike, type KeywordFlag, type KeywordFlagExtractorOptions, type KnobsAsToolsResult, LLMAdapter, type LLMBudgetGateBundle, type LLMConsolidatorOptions, type LLMExtractorOptions, LLMInvokeOptions, LLMResponse, LLMTimeoutError, type McpToolSchema, type OpenAIToolSchema, PricingFn, type PromptCallOptions, type PromptNodeOptions, type RedactorOptions, type ResilientAdapterBundle, type ResilientAdapterOptions, type StampedDelta, type StrategyOperation, type StrategyPlan, StreamDelta, type StreamingPromptNodeHandle, type StreamingPromptNodeOptions, type SuggestStrategyOptions, type SystemPromptHandle, TokenUsage, ToolDefinition, type ToolSelectorOptions, type WithBreakerOptions, type WithBudgetGateOptions, type WithDryRunBundle, type WithDryRunOptions, type WithRateLimiterOptions, WithReplayCacheOptions, type WithRetryOptions, admissionFilter3D, admissionScored, anthropicAdapter, contentGate, costMeterExtractor, dryRunAdapter, frozenContext, gatedStream, gaugesAsContext, googleAdapter, graphFromSpec, graphFromSpecReactive, handoff, keywordFlagExtractor, knobsAsTools, llmConsolidator, llmExtractor, observableAdapter, parseRateLimitFromError, promptCall, promptNode, redactor, resilientAdapter, streamExtractor, streamingPromptNode, suggestStrategy, suggestStrategyReactive, systemPromptBuilder, toolCallExtractor, toolSelector, validateGraphDef, withBudgetGate, withDryRun, withLLMBreaker, withLLMTimeout, withRateLimiter, withRetry };
|
|
1873
|
+
export { type AdapterStats, type AdmissionScore3DOptions, type AdmissionScoredOptions, type AdmissionScores, type AdmissionThresholds, type AnthropicAdapterOptions, type AnthropicSdkLike, type BudgetCaps, BudgetExhaustedError, type BudgetTotals, type CallStatsEvent, CascadeExhaustionReport, ChatMessage, type ContentDecision, type ContentGateOptions, type CostMeterOptions, type CostMeterReading, type DryRunAdapterOptions, type ExtractedToolCall, type FrozenContextOptions, type GatedStreamHandle, type GatedStreamOptions, type GaugesAsContextOptions, type GoogleAdapterOptions, type GoogleSdkLike, type GoogleSdkRequestConfig, type GoogleSdkRequestParams, type GraphDefValidation, type GraphFromSpecOptions, type HandoffOptions, type HttpErrorLike, type KeywordFlag, type KeywordFlagExtractorOptions, type KnobsAsToolsResult, LLMAdapter, type LLMBudgetGateBundle, type LLMConsolidatorOptions, type LLMExtractorOptions, LLMInvokeOptions, LLMResponse, LLMTimeoutError, type McpToolSchema, type OpenAIToolSchema, PricingFn, type PromptCallOptions, type PromptNodeOptions, type RedactorOptions, type ResilientAdapterBundle, type ResilientAdapterOptions, type StampedDelta, type StrategyOperation, type StrategyPlan, StreamDelta, type StreamingPromptNodeHandle, type StreamingPromptNodeOptions, type SuggestStrategyOptions, type SystemPromptHandle, TokenUsage, ToolCall, ToolDefinition, type ToolInterceptorOptions, type ToolSelectorOptions, type WithBreakerOptions, type WithBudgetGateOptions, type WithDryRunBundle, type WithDryRunOptions, type WithRateLimiterOptions, WithReplayCacheOptions, type WithRetryOptions, admissionFilter3D, admissionScored, anthropicAdapter, contentGate, costMeterExtractor, dryRunAdapter, frozenContext, gatedStream, gaugesAsContext, googleAdapter, graphFromSpec, graphFromSpecReactive, handoff, keywordFlagExtractor, knobsAsTools, llmConsolidator, llmExtractor, observableAdapter, parseRateLimitFromError, promptCall, promptNode, redactor, resilientAdapter, streamExtractor, streamingPromptNode, suggestStrategy, suggestStrategyReactive, systemPromptBuilder, toolCallExtractor, toolInterceptor, toolSelector, validateGraphDef, withBudgetGate, withDryRun, withLLMBreaker, withLLMTimeout, withRateLimiter, withRetry };
|
package/dist/utils/ai/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
suggestStrategyReactive,
|
|
30
30
|
systemPromptBuilder,
|
|
31
31
|
toolCallExtractor,
|
|
32
|
+
toolInterceptor,
|
|
32
33
|
toolSelector,
|
|
33
34
|
validateGraphDef,
|
|
34
35
|
withBudgetGate,
|
|
@@ -38,9 +39,10 @@ import {
|
|
|
38
39
|
withRateLimiter,
|
|
39
40
|
withRetry,
|
|
40
41
|
zeroPrice
|
|
41
|
-
} from "../../chunk-
|
|
42
|
-
import "../../chunk-
|
|
43
|
-
import "../../chunk-
|
|
42
|
+
} from "../../chunk-MQMTRKY3.js";
|
|
43
|
+
import "../../chunk-B5Y5GPD5.js";
|
|
44
|
+
import "../../chunk-LTSI7ULC.js";
|
|
45
|
+
import "../../chunk-ZW32BPXV.js";
|
|
44
46
|
import {
|
|
45
47
|
AllTiersExhaustedError,
|
|
46
48
|
anthropicAdapter,
|
|
@@ -49,19 +51,18 @@ import {
|
|
|
49
51
|
googleAdapter,
|
|
50
52
|
openAICompatAdapter,
|
|
51
53
|
tier
|
|
52
|
-
} from "../../chunk-
|
|
54
|
+
} from "../../chunk-T2U6N3FV.js";
|
|
53
55
|
import {
|
|
54
56
|
CircuitOpenError
|
|
55
|
-
} from "../../chunk-
|
|
56
|
-
import "../../chunk-
|
|
57
|
+
} from "../../chunk-T5URUIIY.js";
|
|
58
|
+
import "../../chunk-GUNIRPEJ.js";
|
|
57
59
|
import {
|
|
58
60
|
FallbackMissError,
|
|
59
61
|
ReplayCacheMissError,
|
|
60
62
|
dryRunAdapter,
|
|
61
63
|
fallbackAdapter,
|
|
62
64
|
withReplayCache
|
|
63
|
-
} from "../../chunk-
|
|
64
|
-
import "../../chunk-IHTWQEDR.js";
|
|
65
|
+
} from "../../chunk-XEWV254I.js";
|
|
65
66
|
import {
|
|
66
67
|
ChatStreamGraph,
|
|
67
68
|
MemoryRetrievalGraph,
|
|
@@ -80,23 +81,23 @@ import {
|
|
|
80
81
|
promptNode,
|
|
81
82
|
toolExecution,
|
|
82
83
|
toolRegistry
|
|
83
|
-
} from "../../chunk-
|
|
84
|
-
import "../../chunk-
|
|
85
|
-
import "../../chunk-
|
|
84
|
+
} from "../../chunk-3REMCHSS.js";
|
|
85
|
+
import "../../chunk-K4ZYJ4EM.js";
|
|
86
|
+
import "../../chunk-DHDCOOJU.js";
|
|
87
|
+
import "../../chunk-F7EKHR32.js";
|
|
88
|
+
import "../../chunk-JA67ZQG2.js";
|
|
89
|
+
import "../../chunk-KUFXLAEY.js";
|
|
90
|
+
import "../../chunk-TSBFTJKM.js";
|
|
91
|
+
import "../../chunk-P5LBT622.js";
|
|
86
92
|
import {
|
|
87
93
|
DEFAULT_DECAY_RATE
|
|
88
94
|
} from "../../chunk-QMBYUVRL.js";
|
|
89
95
|
import "../../chunk-FMPF42Q4.js";
|
|
90
|
-
import "../../chunk-
|
|
91
|
-
import "../../chunk-
|
|
92
|
-
import "../../chunk-
|
|
93
|
-
import "../../chunk-
|
|
94
|
-
import "../../chunk-
|
|
95
|
-
import "../../chunk-SOOKUYVM.js";
|
|
96
|
-
import "../../chunk-Y52CS6YA.js";
|
|
97
|
-
import "../../chunk-Z4YXAUDN.js";
|
|
98
|
-
import "../../chunk-TSBFTJKM.js";
|
|
99
|
-
import "../../chunk-P5LBT622.js";
|
|
96
|
+
import "../../chunk-C5QD5DQX.js";
|
|
97
|
+
import "../../chunk-V46JWFGV.js";
|
|
98
|
+
import "../../chunk-G7H6PN7P.js";
|
|
99
|
+
import "../../chunk-MMHGYX44.js";
|
|
100
|
+
import "../../chunk-N6MNJNHB.js";
|
|
100
101
|
import "../../chunk-AZDQPQ3V.js";
|
|
101
102
|
export {
|
|
102
103
|
AllTiersExhaustedError,
|
|
@@ -158,6 +159,7 @@ export {
|
|
|
158
159
|
tier,
|
|
159
160
|
toolCallExtractor,
|
|
160
161
|
toolExecution,
|
|
162
|
+
toolInterceptor,
|
|
161
163
|
toolRegistry,
|
|
162
164
|
toolSelector,
|
|
163
165
|
validateGraphDef,
|