@e4779/pi-fabric 0.92.17-fork.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +181 -0
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/dist/activity/store.d.ts +33 -0
- package/dist/activity/store.d.ts.map +1 -0
- package/dist/activity/types.d.ts +104 -0
- package/dist/activity/types.d.ts.map +1 -0
- package/dist/actors/binding-store.d.ts +17 -0
- package/dist/actors/binding-store.d.ts.map +1 -0
- package/dist/actors/context.d.ts +13 -0
- package/dist/actors/context.d.ts.map +1 -0
- package/dist/actors/delivery-policy.d.ts +8 -0
- package/dist/actors/delivery-policy.d.ts.map +1 -0
- package/dist/actors/directory.d.ts +47 -0
- package/dist/actors/directory.d.ts.map +1 -0
- package/dist/actors/global-registry.d.ts +47 -0
- package/dist/actors/global-registry.d.ts.map +1 -0
- package/dist/actors/host-event-observer.d.ts +5 -0
- package/dist/actors/host-event-observer.d.ts.map +1 -0
- package/dist/actors/host-event-payload.d.ts +14 -0
- package/dist/actors/host-event-payload.d.ts.map +1 -0
- package/dist/actors/log-store.d.ts +22 -0
- package/dist/actors/log-store.d.ts.map +1 -0
- package/dist/actors/manager.d.ts +175 -0
- package/dist/actors/manager.d.ts.map +1 -0
- package/dist/actors/mesh-monitor.d.ts +22 -0
- package/dist/actors/mesh-monitor.d.ts.map +1 -0
- package/dist/actors/predicate.d.ts +7 -0
- package/dist/actors/predicate.d.ts.map +1 -0
- package/dist/actors/registry-store.d.ts +15 -0
- package/dist/actors/registry-store.d.ts.map +1 -0
- package/dist/actors/types.d.ts +218 -0
- package/dist/actors/types.d.ts.map +1 -0
- package/dist/agents/bash-worktree-add.d.ts +24 -0
- package/dist/agents/bash-worktree-add.d.ts.map +1 -0
- package/dist/agents/budget-ledger.d.ts +88 -0
- package/dist/agents/budget-ledger.d.ts.map +1 -0
- package/dist/agents/claude-cli.d.ts +32 -0
- package/dist/agents/claude-cli.d.ts.map +1 -0
- package/dist/agents/claude-cli.js +17 -0
- package/dist/agents/claude-cli.js.map +7 -0
- package/dist/agents/clone-first-worktree.d.ts +17 -0
- package/dist/agents/clone-first-worktree.d.ts.map +1 -0
- package/dist/agents/compact-control.d.ts +32 -0
- package/dist/agents/compact-control.d.ts.map +1 -0
- package/dist/agents/compact-control.js +129 -0
- package/dist/agents/compact-control.js.map +7 -0
- package/dist/agents/constants.d.ts +9 -0
- package/dist/agents/constants.d.ts.map +1 -0
- package/dist/agents/cow-clone.d.ts +8 -0
- package/dist/agents/cow-clone.d.ts.map +1 -0
- package/dist/agents/handoff-completion.d.ts +4 -0
- package/dist/agents/handoff-completion.d.ts.map +1 -0
- package/dist/agents/handoff.d.ts +19 -0
- package/dist/agents/handoff.d.ts.map +1 -0
- package/dist/agents/lifecycle.d.ts +32 -0
- package/dist/agents/lifecycle.d.ts.map +1 -0
- package/dist/agents/manager.d.ts +75 -0
- package/dist/agents/manager.d.ts.map +1 -0
- package/dist/agents/pi-binary.d.ts +7 -0
- package/dist/agents/pi-binary.d.ts.map +1 -0
- package/dist/agents/request.d.ts +13 -0
- package/dist/agents/request.d.ts.map +1 -0
- package/dist/agents/result.d.ts +8 -0
- package/dist/agents/result.d.ts.map +1 -0
- package/dist/agents/result.js +9 -0
- package/dist/agents/result.js.map +7 -0
- package/dist/agents/rm.d.ts +15 -0
- package/dist/agents/rm.d.ts.map +1 -0
- package/dist/agents/semaphore.d.ts +7 -0
- package/dist/agents/semaphore.d.ts.map +1 -0
- package/dist/agents/service-provider.d.ts +9 -0
- package/dist/agents/service-provider.d.ts.map +1 -0
- package/dist/agents/service-schema.d.ts +6 -0
- package/dist/agents/service-schema.d.ts.map +1 -0
- package/dist/agents/service-types.d.ts +192 -0
- package/dist/agents/service-types.d.ts.map +1 -0
- package/dist/agents/service.d.ts +36 -0
- package/dist/agents/service.d.ts.map +1 -0
- package/dist/agents/session-export.d.ts +39 -0
- package/dist/agents/session-export.d.ts.map +1 -0
- package/dist/agents/session-pins.d.ts +24 -0
- package/dist/agents/session-pins.d.ts.map +1 -0
- package/dist/agents/thinking-transfer.d.ts +39 -0
- package/dist/agents/thinking-transfer.d.ts.map +1 -0
- package/dist/agents/transports/herdr-transport.d.ts +10 -0
- package/dist/agents/transports/herdr-transport.d.ts.map +1 -0
- package/dist/agents/transports/localterm-transport.d.ts +7 -0
- package/dist/agents/transports/localterm-transport.d.ts.map +1 -0
- package/dist/agents/transports/process-transport.d.ts +7 -0
- package/dist/agents/transports/process-transport.d.ts.map +1 -0
- package/dist/agents/transports/process-utils.d.ts +33 -0
- package/dist/agents/transports/process-utils.d.ts.map +1 -0
- package/dist/agents/transports/screen-transport.d.ts +7 -0
- package/dist/agents/transports/screen-transport.d.ts.map +1 -0
- package/dist/agents/transports/tmux-transport.d.ts +7 -0
- package/dist/agents/transports/tmux-transport.d.ts.map +1 -0
- package/dist/agents/types.d.ts +280 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/veda-cli.d.ts +22 -0
- package/dist/agents/veda-cli.d.ts.map +1 -0
- package/dist/agents/veda-cli.js +13 -0
- package/dist/agents/veda-cli.js.map +7 -0
- package/dist/agents/worktree-manager.d.ts +14 -0
- package/dist/agents/worktree-manager.d.ts.map +1 -0
- package/dist/agents/worktree-paths.d.ts +5 -0
- package/dist/agents/worktree-paths.d.ts.map +1 -0
- package/dist/agents.d.ts +8 -0
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +761 -0
- package/dist/agents.js.map +7 -0
- package/dist/async-settlement.d.ts +4 -0
- package/dist/async-settlement.d.ts.map +1 -0
- package/dist/audit/details.d.ts +86 -0
- package/dist/audit/details.d.ts.map +1 -0
- package/dist/audit/index.d.ts +4 -0
- package/dist/audit/index.d.ts.map +1 -0
- package/dist/audit/projection.d.ts +20 -0
- package/dist/audit/projection.d.ts.map +1 -0
- package/dist/audit/trace.d.ts +99 -0
- package/dist/audit/trace.d.ts.map +1 -0
- package/dist/capture/catalog.d.ts +30 -0
- package/dist/capture/catalog.d.ts.map +1 -0
- package/dist/capture/interceptor.d.ts +20 -0
- package/dist/capture/interceptor.d.ts.map +1 -0
- package/dist/capture/wrapper.d.ts +15 -0
- package/dist/capture/wrapper.d.ts.map +1 -0
- package/dist/chunks/chunk-2DMJ7MEI.js +1984 -0
- package/dist/chunks/chunk-2DMJ7MEI.js.map +7 -0
- package/dist/chunks/chunk-2PZWDVJB.js +738 -0
- package/dist/chunks/chunk-2PZWDVJB.js.map +7 -0
- package/dist/chunks/chunk-2UQV52II.js +440 -0
- package/dist/chunks/chunk-2UQV52II.js.map +7 -0
- package/dist/chunks/chunk-32BNQ75J.js +1445 -0
- package/dist/chunks/chunk-32BNQ75J.js.map +7 -0
- package/dist/chunks/chunk-3H7SDWZI.js +467 -0
- package/dist/chunks/chunk-3H7SDWZI.js.map +7 -0
- package/dist/chunks/chunk-3MEHEH6B.js +41 -0
- package/dist/chunks/chunk-3MEHEH6B.js.map +7 -0
- package/dist/chunks/chunk-3QECYQGA.js +70 -0
- package/dist/chunks/chunk-3QECYQGA.js.map +7 -0
- package/dist/chunks/chunk-3WIGAX56.js +644 -0
- package/dist/chunks/chunk-3WIGAX56.js.map +7 -0
- package/dist/chunks/chunk-3YZUQESG.js +16 -0
- package/dist/chunks/chunk-3YZUQESG.js.map +7 -0
- package/dist/chunks/chunk-4JETKRFE.js +287 -0
- package/dist/chunks/chunk-4JETKRFE.js.map +7 -0
- package/dist/chunks/chunk-4SSMGBF4.js +93 -0
- package/dist/chunks/chunk-4SSMGBF4.js.map +7 -0
- package/dist/chunks/chunk-5SU3YXBS.js +15 -0
- package/dist/chunks/chunk-5SU3YXBS.js.map +7 -0
- package/dist/chunks/chunk-656HWVFU.js +409 -0
- package/dist/chunks/chunk-656HWVFU.js.map +7 -0
- package/dist/chunks/chunk-7A6NVHB5.js +1242 -0
- package/dist/chunks/chunk-7A6NVHB5.js.map +7 -0
- package/dist/chunks/chunk-7TB7NXSL.js +58 -0
- package/dist/chunks/chunk-7TB7NXSL.js.map +7 -0
- package/dist/chunks/chunk-AAHHYDTO.js +24 -0
- package/dist/chunks/chunk-AAHHYDTO.js.map +7 -0
- package/dist/chunks/chunk-ARLYAW2A.js +95 -0
- package/dist/chunks/chunk-ARLYAW2A.js.map +7 -0
- package/dist/chunks/chunk-AYBIR4YV.js +210 -0
- package/dist/chunks/chunk-AYBIR4YV.js.map +7 -0
- package/dist/chunks/chunk-BOTRGFQQ.js +87 -0
- package/dist/chunks/chunk-BOTRGFQQ.js.map +7 -0
- package/dist/chunks/chunk-CGPK5WHX.js +96 -0
- package/dist/chunks/chunk-CGPK5WHX.js.map +7 -0
- package/dist/chunks/chunk-CI56CW53.js +470 -0
- package/dist/chunks/chunk-CI56CW53.js.map +7 -0
- package/dist/chunks/chunk-CPSW2GW4.js +1466 -0
- package/dist/chunks/chunk-CPSW2GW4.js.map +7 -0
- package/dist/chunks/chunk-CQFP2RCP.js +64 -0
- package/dist/chunks/chunk-CQFP2RCP.js.map +7 -0
- package/dist/chunks/chunk-D5WKZONW.js +797 -0
- package/dist/chunks/chunk-D5WKZONW.js.map +7 -0
- package/dist/chunks/chunk-DLXPTBPL.js +151 -0
- package/dist/chunks/chunk-DLXPTBPL.js.map +7 -0
- package/dist/chunks/chunk-G4LADAYY.js +287 -0
- package/dist/chunks/chunk-G4LADAYY.js.map +7 -0
- package/dist/chunks/chunk-GXNR6NRU.js +447 -0
- package/dist/chunks/chunk-GXNR6NRU.js.map +7 -0
- package/dist/chunks/chunk-IGVDD2HT.js +10 -0
- package/dist/chunks/chunk-IGVDD2HT.js.map +7 -0
- package/dist/chunks/chunk-J2HV2URQ.js +1125 -0
- package/dist/chunks/chunk-J2HV2URQ.js.map +7 -0
- package/dist/chunks/chunk-KAD7UWT2.js +99 -0
- package/dist/chunks/chunk-KAD7UWT2.js.map +7 -0
- package/dist/chunks/chunk-KYXZJNV6.js +227 -0
- package/dist/chunks/chunk-KYXZJNV6.js.map +7 -0
- package/dist/chunks/chunk-LMAVZN7J.js +8 -0
- package/dist/chunks/chunk-LMAVZN7J.js.map +7 -0
- package/dist/chunks/chunk-M3S7XITB.js +110 -0
- package/dist/chunks/chunk-M3S7XITB.js.map +7 -0
- package/dist/chunks/chunk-MGDLRV2R.js +112 -0
- package/dist/chunks/chunk-MGDLRV2R.js.map +7 -0
- package/dist/chunks/chunk-MGWQOKBV.js +30 -0
- package/dist/chunks/chunk-MGWQOKBV.js.map +7 -0
- package/dist/chunks/chunk-N5GUXC6F.js +184 -0
- package/dist/chunks/chunk-N5GUXC6F.js.map +7 -0
- package/dist/chunks/chunk-NQOEHX62.js +215 -0
- package/dist/chunks/chunk-NQOEHX62.js.map +7 -0
- package/dist/chunks/chunk-OKOHRXGF.js +100 -0
- package/dist/chunks/chunk-OKOHRXGF.js.map +7 -0
- package/dist/chunks/chunk-OP2KTYQB.js +286 -0
- package/dist/chunks/chunk-OP2KTYQB.js.map +7 -0
- package/dist/chunks/chunk-OTCASLY2.js +52 -0
- package/dist/chunks/chunk-OTCASLY2.js.map +7 -0
- package/dist/chunks/chunk-PAN6C3JM.js +42 -0
- package/dist/chunks/chunk-PAN6C3JM.js.map +7 -0
- package/dist/chunks/chunk-PH7ZJ27F.js +6873 -0
- package/dist/chunks/chunk-PH7ZJ27F.js.map +7 -0
- package/dist/chunks/chunk-PM5I335G.js +225 -0
- package/dist/chunks/chunk-PM5I335G.js.map +7 -0
- package/dist/chunks/chunk-PSNXUZMY.js +218 -0
- package/dist/chunks/chunk-PSNXUZMY.js.map +7 -0
- package/dist/chunks/chunk-PXAICAUT.js +24 -0
- package/dist/chunks/chunk-PXAICAUT.js.map +7 -0
- package/dist/chunks/chunk-RERA6YWA.js +359 -0
- package/dist/chunks/chunk-RERA6YWA.js.map +7 -0
- package/dist/chunks/chunk-RNOPHITP.js +1720 -0
- package/dist/chunks/chunk-RNOPHITP.js.map +7 -0
- package/dist/chunks/chunk-RRGTKHXZ.js +931 -0
- package/dist/chunks/chunk-RRGTKHXZ.js.map +7 -0
- package/dist/chunks/chunk-SWB2OHYW.js +93 -0
- package/dist/chunks/chunk-SWB2OHYW.js.map +7 -0
- package/dist/chunks/chunk-T3A5GNCW.js +19 -0
- package/dist/chunks/chunk-T3A5GNCW.js.map +7 -0
- package/dist/chunks/chunk-TPLMVELH.js +118 -0
- package/dist/chunks/chunk-TPLMVELH.js.map +7 -0
- package/dist/chunks/chunk-TSRKCXNI.js +17 -0
- package/dist/chunks/chunk-TSRKCXNI.js.map +7 -0
- package/dist/chunks/chunk-U5FYOMG5.js +119 -0
- package/dist/chunks/chunk-U5FYOMG5.js.map +7 -0
- package/dist/chunks/chunk-U6CTHPZC.js +1924 -0
- package/dist/chunks/chunk-U6CTHPZC.js.map +7 -0
- package/dist/chunks/chunk-UDFDF7IY.js +1572 -0
- package/dist/chunks/chunk-UDFDF7IY.js.map +7 -0
- package/dist/chunks/chunk-UKMQK5VP.js +231 -0
- package/dist/chunks/chunk-UKMQK5VP.js.map +7 -0
- package/dist/chunks/chunk-UQ4LTUH4.js +2181 -0
- package/dist/chunks/chunk-UQ4LTUH4.js.map +7 -0
- package/dist/chunks/chunk-UTR3I23Z.js +65 -0
- package/dist/chunks/chunk-UTR3I23Z.js.map +7 -0
- package/dist/chunks/chunk-VPPIJRNZ.js +50 -0
- package/dist/chunks/chunk-VPPIJRNZ.js.map +7 -0
- package/dist/chunks/chunk-VRYEGVHR.js +195 -0
- package/dist/chunks/chunk-VRYEGVHR.js.map +7 -0
- package/dist/chunks/chunk-VRZNFNPB.js +4218 -0
- package/dist/chunks/chunk-VRZNFNPB.js.map +7 -0
- package/dist/chunks/chunk-VXZZJ44D.js +295 -0
- package/dist/chunks/chunk-VXZZJ44D.js.map +7 -0
- package/dist/chunks/chunk-W3FRE4VI.js +297 -0
- package/dist/chunks/chunk-W3FRE4VI.js.map +7 -0
- package/dist/chunks/chunk-WVH324VF.js +60 -0
- package/dist/chunks/chunk-WVH324VF.js.map +7 -0
- package/dist/chunks/chunk-X7G62ZGH.js +151 -0
- package/dist/chunks/chunk-X7G62ZGH.js.map +7 -0
- package/dist/chunks/chunk-XB3RJVT4.js +17 -0
- package/dist/chunks/chunk-XB3RJVT4.js.map +7 -0
- package/dist/chunks/chunk-XT4346N7.js +651 -0
- package/dist/chunks/chunk-XT4346N7.js.map +7 -0
- package/dist/chunks/chunk-Y7KNRAFL.js +1180 -0
- package/dist/chunks/chunk-Y7KNRAFL.js.map +7 -0
- package/dist/chunks/chunk-YK5AZ7CZ.js +692 -0
- package/dist/chunks/chunk-YK5AZ7CZ.js.map +7 -0
- package/dist/chunks/chunk-YU4O6SWQ.js +246 -0
- package/dist/chunks/chunk-YU4O6SWQ.js.map +7 -0
- package/dist/chunks/chunk-YU62DDKK.js +22 -0
- package/dist/chunks/chunk-YU62DDKK.js.map +7 -0
- package/dist/chunks/chunk-Z63R5GVN.js +121 -0
- package/dist/chunks/chunk-Z63R5GVN.js.map +7 -0
- package/dist/chunks/chunk-ZDNGXLEC.js +221 -0
- package/dist/chunks/chunk-ZDNGXLEC.js.map +7 -0
- package/dist/chunks/chunk-ZZ4LHQYJ.js +777 -0
- package/dist/chunks/chunk-ZZ4LHQYJ.js.map +7 -0
- package/dist/commands/fabric.d.ts +17 -0
- package/dist/commands/fabric.d.ts.map +1 -0
- package/dist/compaction/bounds.d.ts +23 -0
- package/dist/compaction/bounds.d.ts.map +1 -0
- package/dist/compaction/branch-details.d.ts +83 -0
- package/dist/compaction/branch-details.d.ts.map +1 -0
- package/dist/compaction/branch-summary.d.ts +9 -0
- package/dist/compaction/branch-summary.d.ts.map +1 -0
- package/dist/compaction/enrichers.d.ts +10 -0
- package/dist/compaction/enrichers.d.ts.map +1 -0
- package/dist/compaction/hook.d.ts +99 -0
- package/dist/compaction/hook.d.ts.map +1 -0
- package/dist/compaction/hook.js +22 -0
- package/dist/compaction/hook.js.map +7 -0
- package/dist/compaction/instructions.d.ts +38 -0
- package/dist/compaction/instructions.d.ts.map +1 -0
- package/dist/compaction/normalize.d.ts +83 -0
- package/dist/compaction/normalize.d.ts.map +1 -0
- package/dist/compaction/projections.d.ts +31 -0
- package/dist/compaction/projections.d.ts.map +1 -0
- package/dist/compaction/qa.d.ts +27 -0
- package/dist/compaction/qa.d.ts.map +1 -0
- package/dist/compaction/render.d.ts +10 -0
- package/dist/compaction/render.d.ts.map +1 -0
- package/dist/compaction/threshold.d.ts +5 -0
- package/dist/compaction/threshold.d.ts.map +1 -0
- package/dist/compaction/trace-events.d.ts +23 -0
- package/dist/compaction/trace-events.d.ts.map +1 -0
- package/dist/components/catalog.d.ts +25 -0
- package/dist/components/catalog.d.ts.map +1 -0
- package/dist/components/effect-policy.d.ts +21 -0
- package/dist/components/effect-policy.d.ts.map +1 -0
- package/dist/components/effect-scope.d.ts +31 -0
- package/dist/components/effect-scope.d.ts.map +1 -0
- package/dist/components/loader.d.ts +27 -0
- package/dist/components/loader.d.ts.map +1 -0
- package/dist/components/model-guidance.d.ts +48 -0
- package/dist/components/model-guidance.d.ts.map +1 -0
- package/dist/components/provider-component.d.ts +31 -0
- package/dist/components/provider-component.d.ts.map +1 -0
- package/dist/components/supervisor.d.ts +29 -0
- package/dist/components/supervisor.d.ts.map +1 -0
- package/dist/components/types.d.ts +140 -0
- package/dist/components/types.d.ts.map +1 -0
- package/dist/config-migrations.d.ts +11 -0
- package/dist/config-migrations.d.ts.map +1 -0
- package/dist/config.d.ts +282 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/core/action-arguments.d.ts +12 -0
- package/dist/core/action-arguments.d.ts.map +1 -0
- package/dist/core/action-registry.d.ts +170 -0
- package/dist/core/action-registry.d.ts.map +1 -0
- package/dist/core/action-registry.js +20 -0
- package/dist/core/action-registry.js.map +7 -0
- package/dist/core/action-repair.d.ts +15 -0
- package/dist/core/action-repair.d.ts.map +1 -0
- package/dist/core/action-result.d.ts +13 -0
- package/dist/core/action-result.d.ts.map +1 -0
- package/dist/core/agent-dir.d.ts +2 -0
- package/dist/core/agent-dir.d.ts.map +1 -0
- package/dist/core/approval-controller.d.ts +31 -0
- package/dist/core/approval-controller.d.ts.map +1 -0
- package/dist/core/atomic-write.d.ts +15 -0
- package/dist/core/atomic-write.d.ts.map +1 -0
- package/dist/core/auto-approval-classifier.d.ts +17 -0
- package/dist/core/auto-approval-classifier.d.ts.map +1 -0
- package/dist/core/call-preview.d.ts +8 -0
- package/dist/core/call-preview.d.ts.map +1 -0
- package/dist/core/child-tool-allowlist.d.ts +3 -0
- package/dist/core/child-tool-allowlist.d.ts.map +1 -0
- package/dist/core/compact-controller.d.ts +42 -0
- package/dist/core/compact-controller.d.ts.map +1 -0
- package/dist/core/core-override-guidance.d.ts +7 -0
- package/dist/core/core-override-guidance.d.ts.map +1 -0
- package/dist/core/damaged-file.d.ts +6 -0
- package/dist/core/damaged-file.d.ts.map +1 -0
- package/dist/core/direct-tool-approval.d.ts +19 -0
- package/dist/core/direct-tool-approval.d.ts.map +1 -0
- package/dist/core/effect-conflict.d.ts +3 -0
- package/dist/core/effect-conflict.d.ts.map +1 -0
- package/dist/core/file-lock.d.ts +12 -0
- package/dist/core/file-lock.d.ts.map +1 -0
- package/dist/core/kernel-skills.d.ts +3 -0
- package/dist/core/kernel-skills.d.ts.map +1 -0
- package/dist/core/model-resolution.d.ts +62 -0
- package/dist/core/model-resolution.d.ts.map +1 -0
- package/dist/core/model-usage.d.ts +8 -0
- package/dist/core/model-usage.d.ts.map +1 -0
- package/dist/core/pi-arguments.d.ts +3 -0
- package/dist/core/pi-arguments.d.ts.map +1 -0
- package/dist/core/pi-bash-error.d.ts +9 -0
- package/dist/core/pi-bash-error.d.ts.map +1 -0
- package/dist/core/pi-tools.d.ts +9 -0
- package/dist/core/pi-tools.d.ts.map +1 -0
- package/dist/core/provider-bindings.d.ts +47 -0
- package/dist/core/provider-bindings.d.ts.map +1 -0
- package/dist/core/proxy-contract.d.ts +18 -0
- package/dist/core/proxy-contract.d.ts.map +1 -0
- package/dist/core/session-context.d.ts +14 -0
- package/dist/core/session-context.d.ts.map +1 -0
- package/dist/core/shell-jobs.d.ts +99 -0
- package/dist/core/shell-jobs.d.ts.map +1 -0
- package/dist/core/skill-block.d.ts +10 -0
- package/dist/core/skill-block.d.ts.map +1 -0
- package/dist/core/skill-dir.d.ts +4 -0
- package/dist/core/skill-dir.d.ts.map +1 -0
- package/dist/core/skill-prompt.d.ts +3 -0
- package/dist/core/skill-prompt.d.ts.map +1 -0
- package/dist/core/skill-references.d.ts +7 -0
- package/dist/core/skill-references.d.ts.map +1 -0
- package/dist/core/stable-hash.d.ts +3 -0
- package/dist/core/stable-hash.d.ts.map +1 -0
- package/dist/core/system-guidance.d.ts +13 -0
- package/dist/core/system-guidance.d.ts.map +1 -0
- package/dist/core/token-math.d.ts +16 -0
- package/dist/core/token-math.d.ts.map +1 -0
- package/dist/core/tool-ownership.d.ts +47 -0
- package/dist/core/tool-ownership.d.ts.map +1 -0
- package/dist/core/tool-result-proxy.d.ts +18 -0
- package/dist/core/tool-result-proxy.d.ts.map +1 -0
- package/dist/entropy/active.d.ts +9 -0
- package/dist/entropy/active.d.ts.map +1 -0
- package/dist/entropy/compiled-store.d.ts +16 -0
- package/dist/entropy/compiled-store.d.ts.map +1 -0
- package/dist/entropy/compiled-surface.d.ts +57 -0
- package/dist/entropy/compiled-surface.d.ts.map +1 -0
- package/dist/entropy/compiler.d.ts +27 -0
- package/dist/entropy/compiler.d.ts.map +1 -0
- package/dist/entropy/corpus.d.ts +22 -0
- package/dist/entropy/corpus.d.ts.map +1 -0
- package/dist/entropy/fingerprint.d.ts +9 -0
- package/dist/entropy/fingerprint.d.ts.map +1 -0
- package/dist/entropy/index.d.ts +16 -0
- package/dist/entropy/index.d.ts.map +1 -0
- package/dist/entropy/index.js +194 -0
- package/dist/entropy/index.js.map +7 -0
- package/dist/entropy/meter.d.ts +10 -0
- package/dist/entropy/meter.d.ts.map +1 -0
- package/dist/entropy/normal-form.d.ts +40 -0
- package/dist/entropy/normal-form.d.ts.map +1 -0
- package/dist/entropy/passes.d.ts +13 -0
- package/dist/entropy/passes.d.ts.map +1 -0
- package/dist/entropy/pool-store.d.ts +15 -0
- package/dist/entropy/pool-store.d.ts.map +1 -0
- package/dist/entropy/pool.d.ts +41 -0
- package/dist/entropy/pool.d.ts.map +1 -0
- package/dist/entropy/presentation.d.ts +12 -0
- package/dist/entropy/presentation.d.ts.map +1 -0
- package/dist/entropy/sessions.d.ts +47 -0
- package/dist/entropy/sessions.d.ts.map +1 -0
- package/dist/entropy/surface.d.ts +30 -0
- package/dist/entropy/surface.d.ts.map +1 -0
- package/dist/entropy/trial.d.ts +38 -0
- package/dist/entropy/trial.d.ts.map +1 -0
- package/dist/entropy/types.d.ts +181 -0
- package/dist/entropy/types.d.ts.map +1 -0
- package/dist/execution-service.d.ts +66 -0
- package/dist/execution-service.d.ts.map +1 -0
- package/dist/fabric-exec-arguments.d.ts +7 -0
- package/dist/fabric-exec-arguments.d.ts.map +1 -0
- package/dist/fabric-exec-tool.d.ts +8 -0
- package/dist/fabric-exec-tool.d.ts.map +1 -0
- package/dist/fabric-runtime-state.d.ts +96 -0
- package/dist/fabric-runtime-state.d.ts.map +1 -0
- package/dist/fabric-runtime-state.js +11928 -0
- package/dist/fabric-runtime-state.js.map +7 -0
- package/dist/fabric-state.d.ts +95 -0
- package/dist/fabric-state.d.ts.map +1 -0
- package/dist/failure-progress.d.ts +3 -0
- package/dist/failure-progress.d.ts.map +1 -0
- package/dist/host-compatibility.d.ts +5 -0
- package/dist/host-compatibility.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6094 -0
- package/dist/index.js.map +7 -0
- package/dist/jev/auth.d.ts +5 -0
- package/dist/jev/auth.d.ts.map +1 -0
- package/dist/jev/browser.d.ts +37 -0
- package/dist/jev/browser.d.ts.map +1 -0
- package/dist/jev/browser.js +13 -0
- package/dist/jev/browser.js.map +7 -0
- package/dist/jev/client.d.ts +29 -0
- package/dist/jev/client.d.ts.map +1 -0
- package/dist/jev/client.js +11 -0
- package/dist/jev/client.js.map +7 -0
- package/dist/jev/config.d.ts +17 -0
- package/dist/jev/config.d.ts.map +1 -0
- package/dist/jev/guest-types.d.ts +2 -0
- package/dist/jev/guest-types.d.ts.map +1 -0
- package/dist/jev/manager.d.ts +36 -0
- package/dist/jev/manager.d.ts.map +1 -0
- package/dist/jev/observation.d.ts +59 -0
- package/dist/jev/observation.d.ts.map +1 -0
- package/dist/jev/observation.js +20 -0
- package/dist/jev/observation.js.map +7 -0
- package/dist/jev/types.d.ts +142 -0
- package/dist/jev/types.d.ts.map +1 -0
- package/dist/jev/validation.d.ts +8 -0
- package/dist/jev/validation.d.ts.map +1 -0
- package/dist/jev.d.ts +9 -0
- package/dist/jev.d.ts.map +1 -0
- package/dist/jev.js +49 -0
- package/dist/jev.js.map +7 -0
- package/dist/lifecycle/broker.d.ts +30 -0
- package/dist/lifecycle/broker.d.ts.map +1 -0
- package/dist/lifecycle/delivery-scheduler.d.ts +30 -0
- package/dist/lifecycle/delivery-scheduler.d.ts.map +1 -0
- package/dist/lifecycle/types.d.ts +91 -0
- package/dist/lifecycle/types.d.ts.map +1 -0
- package/dist/log-tail.d.ts +11 -0
- package/dist/log-tail.d.ts.map +1 -0
- package/dist/main-agent.d.ts +70 -0
- package/dist/main-agent.d.ts.map +1 -0
- package/dist/managed-host.d.ts +22 -0
- package/dist/managed-host.d.ts.map +1 -0
- package/dist/mcp.d.ts +9 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +21 -0
- package/dist/mcp.js.map +7 -0
- package/dist/memory/client.d.ts +31 -0
- package/dist/memory/client.d.ts.map +1 -0
- package/dist/memory/context.d.ts +114 -0
- package/dist/memory/context.d.ts.map +1 -0
- package/dist/memory/digest.d.ts +48 -0
- package/dist/memory/digest.d.ts.map +1 -0
- package/dist/memory/digest.js +7 -0
- package/dist/memory/digest.js.map +7 -0
- package/dist/memory/discovery.d.ts +43 -0
- package/dist/memory/discovery.d.ts.map +1 -0
- package/dist/memory/discovery.js +25 -0
- package/dist/memory/discovery.js.map +7 -0
- package/dist/memory/expand-service.d.ts +4 -0
- package/dist/memory/expand-service.d.ts.map +1 -0
- package/dist/memory/host-source.d.ts +60 -0
- package/dist/memory/host-source.d.ts.map +1 -0
- package/dist/memory/index.d.ts +113 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/lineage.d.ts +25 -0
- package/dist/memory/lineage.d.ts.map +1 -0
- package/dist/memory/normalize.d.ts +188 -0
- package/dist/memory/normalize.d.ts.map +1 -0
- package/dist/memory/normalize.js +26 -0
- package/dist/memory/normalize.js.map +7 -0
- package/dist/memory/portable.d.ts +66 -0
- package/dist/memory/portable.d.ts.map +1 -0
- package/dist/memory/provider.d.ts +15 -0
- package/dist/memory/provider.d.ts.map +1 -0
- package/dist/memory/recall-service.d.ts +5 -0
- package/dist/memory/recall-service.d.ts.map +1 -0
- package/dist/memory/regex.d.ts +19 -0
- package/dist/memory/regex.d.ts.map +1 -0
- package/dist/memory/request-cache.d.ts +49 -0
- package/dist/memory/request-cache.d.ts.map +1 -0
- package/dist/memory/request-context.d.ts +57 -0
- package/dist/memory/request-context.d.ts.map +1 -0
- package/dist/memory/request-limits.d.ts +8 -0
- package/dist/memory/request-limits.d.ts.map +1 -0
- package/dist/memory/search.d.ts +98 -0
- package/dist/memory/search.d.ts.map +1 -0
- package/dist/memory/search.js +24 -0
- package/dist/memory/search.js.map +7 -0
- package/dist/memory/sessions-service.d.ts +3 -0
- package/dist/memory/sessions-service.d.ts.map +1 -0
- package/dist/memory/source-observation.d.ts +28 -0
- package/dist/memory/source-observation.d.ts.map +1 -0
- package/dist/memory/tokenize.d.ts +24 -0
- package/dist/memory/tokenize.d.ts.map +1 -0
- package/dist/memory.d.ts +8 -0
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +119 -0
- package/dist/memory.js.map +7 -0
- package/dist/mesh/store.d.ts +78 -0
- package/dist/mesh/store.d.ts.map +1 -0
- package/dist/output-budget.d.ts +12 -0
- package/dist/output-budget.d.ts.map +1 -0
- package/dist/prewalk/arm.d.ts +8 -0
- package/dist/prewalk/arm.d.ts.map +1 -0
- package/dist/prewalk/controller.d.ts +66 -0
- package/dist/prewalk/controller.d.ts.map +1 -0
- package/dist/prewalk/fs-drift.d.ts +19 -0
- package/dist/prewalk/fs-drift.d.ts.map +1 -0
- package/dist/prewalk/handoff.d.ts +46 -0
- package/dist/prewalk/handoff.d.ts.map +1 -0
- package/dist/protocol.d.ts +275 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +46 -0
- package/dist/protocol.js.map +7 -0
- package/dist/providers/agents-actions.d.ts +3 -0
- package/dist/providers/agents-actions.d.ts.map +1 -0
- package/dist/providers/agents-message-router.d.ts +29 -0
- package/dist/providers/agents-message-router.d.ts.map +1 -0
- package/dist/providers/agents-progress.d.ts +18 -0
- package/dist/providers/agents-progress.d.ts.map +1 -0
- package/dist/providers/agents-provider.d.ts +51 -0
- package/dist/providers/agents-provider.d.ts.map +1 -0
- package/dist/providers/arg-normalization.d.ts +15 -0
- package/dist/providers/arg-normalization.d.ts.map +1 -0
- package/dist/providers/captured-tools-provider.d.ts +23 -0
- package/dist/providers/captured-tools-provider.d.ts.map +1 -0
- package/dist/providers/compact-provider.d.ts +14 -0
- package/dist/providers/compact-provider.d.ts.map +1 -0
- package/dist/providers/components-provider.d.ts +12 -0
- package/dist/providers/components-provider.d.ts.map +1 -0
- package/dist/providers/jev-provider.d.ts +70 -0
- package/dist/providers/jev-provider.d.ts.map +1 -0
- package/dist/providers/jev-provider.js +28 -0
- package/dist/providers/jev-provider.js.map +7 -0
- package/dist/providers/mcp-descriptor-cache.d.ts +47 -0
- package/dist/providers/mcp-descriptor-cache.d.ts.map +1 -0
- package/dist/providers/mcp-provider.d.ts +47 -0
- package/dist/providers/mcp-provider.d.ts.map +1 -0
- package/dist/providers/memory-provider.d.ts +32 -0
- package/dist/providers/memory-provider.d.ts.map +1 -0
- package/dist/providers/memory-provider.js +23 -0
- package/dist/providers/memory-provider.js.map +7 -0
- package/dist/providers/mesh-provider.d.ts +17 -0
- package/dist/providers/mesh-provider.d.ts.map +1 -0
- package/dist/providers/pi-bash-cwd.d.ts +49 -0
- package/dist/providers/pi-bash-cwd.d.ts.map +1 -0
- package/dist/providers/pi-tools-provider.d.ts +25 -0
- package/dist/providers/pi-tools-provider.d.ts.map +1 -0
- package/dist/providers/schema-provider.d.ts +15 -0
- package/dist/providers/schema-provider.d.ts.map +1 -0
- package/dist/providers/state-provider.d.ts +16 -0
- package/dist/providers/state-provider.d.ts.map +1 -0
- package/dist/providers/write-diff-limits.d.ts +5 -0
- package/dist/providers/write-diff-limits.d.ts.map +1 -0
- package/dist/providers/write-preview.d.ts +3 -0
- package/dist/providers/write-preview.d.ts.map +1 -0
- package/dist/ref-names.d.ts +2 -0
- package/dist/ref-names.d.ts.map +1 -0
- package/dist/repairs/active.d.ts +7 -0
- package/dist/repairs/active.d.ts.map +1 -0
- package/dist/repairs/apply.d.ts +7 -0
- package/dist/repairs/apply.d.ts.map +1 -0
- package/dist/repairs/catalog-digest.d.ts +5 -0
- package/dist/repairs/catalog-digest.d.ts.map +1 -0
- package/dist/repairs/classify.d.ts +10 -0
- package/dist/repairs/classify.d.ts.map +1 -0
- package/dist/repairs/compiler.d.ts +33 -0
- package/dist/repairs/compiler.d.ts.map +1 -0
- package/dist/repairs/promote.d.ts +4 -0
- package/dist/repairs/promote.d.ts.map +1 -0
- package/dist/repairs/store.d.ts +10 -0
- package/dist/repairs/store.d.ts.map +1 -0
- package/dist/repairs/types.d.ts +49 -0
- package/dist/repairs/types.d.ts.map +1 -0
- package/dist/repeat-guard.d.ts +25 -0
- package/dist/repeat-guard.d.ts.map +1 -0
- package/dist/residency/actor-client.d.ts +16 -0
- package/dist/residency/actor-client.d.ts.map +1 -0
- package/dist/residency/actor-client.js +9 -0
- package/dist/residency/actor-client.js.map +7 -0
- package/dist/residency/client.d.ts +44 -0
- package/dist/residency/client.d.ts.map +1 -0
- package/dist/residency/host.d.ts +3 -0
- package/dist/residency/host.d.ts.map +1 -0
- package/dist/residency/host.js +32 -0
- package/dist/residency/host.js.map +7 -0
- package/dist/residency/launcher-owner.d.ts +7 -0
- package/dist/residency/launcher-owner.d.ts.map +1 -0
- package/dist/residency/launcher.d.ts +3 -0
- package/dist/residency/launcher.d.ts.map +1 -0
- package/dist/residency/launcher.js +154 -0
- package/dist/residency/launcher.js.map +7 -0
- package/dist/residency/pi-entry.d.ts +3 -0
- package/dist/residency/pi-entry.d.ts.map +1 -0
- package/dist/residency/pi-entry.js +48 -0
- package/dist/residency/pi-entry.js.map +7 -0
- package/dist/residency/protocol.d.ts +122 -0
- package/dist/residency/protocol.d.ts.map +1 -0
- package/dist/run-display.d.ts +3 -0
- package/dist/run-display.d.ts.map +1 -0
- package/dist/runtime/core-override-guest-types.d.ts +15 -0
- package/dist/runtime/core-override-guest-types.d.ts.map +1 -0
- package/dist/runtime/core-override-guest-types.js +9 -0
- package/dist/runtime/core-override-guest-types.js.map +7 -0
- package/dist/runtime/core-tool-properties.d.ts +6 -0
- package/dist/runtime/core-tool-properties.d.ts.map +1 -0
- package/dist/runtime/cpython-child-source.d.ts +2 -0
- package/dist/runtime/cpython-child-source.d.ts.map +1 -0
- package/dist/runtime/cpython-linux-sandbox.d.ts +2 -0
- package/dist/runtime/cpython-linux-sandbox.d.ts.map +1 -0
- package/dist/runtime/cpython-runtime.d.ts +9 -0
- package/dist/runtime/cpython-runtime.d.ts.map +1 -0
- package/dist/runtime/cpython-runtime.js +677 -0
- package/dist/runtime/cpython-runtime.js.map +7 -0
- package/dist/runtime/dynamic-guest-types.d.ts +3 -0
- package/dist/runtime/dynamic-guest-types.d.ts.map +1 -0
- package/dist/runtime/dynamic-guest-types.js +8 -0
- package/dist/runtime/dynamic-guest-types.js.map +7 -0
- package/dist/runtime/guest-code-repair.d.ts +2 -0
- package/dist/runtime/guest-code-repair.d.ts.map +1 -0
- package/dist/runtime/guest-stack-map.d.ts +11 -0
- package/dist/runtime/guest-stack-map.d.ts.map +1 -0
- package/dist/runtime/guest-types.d.ts +40 -0
- package/dist/runtime/guest-types.d.ts.map +1 -0
- package/dist/runtime/guest-types.js +13 -0
- package/dist/runtime/guest-types.js.map +7 -0
- package/dist/runtime/kernel.d.ts +30 -0
- package/dist/runtime/kernel.d.ts.map +1 -0
- package/dist/runtime/monty-bridge.d.ts +4 -0
- package/dist/runtime/monty-bridge.d.ts.map +1 -0
- package/dist/runtime/monty-runtime.d.ts +6 -0
- package/dist/runtime/monty-runtime.d.ts.map +1 -0
- package/dist/runtime/monty-runtime.js +485 -0
- package/dist/runtime/monty-runtime.js.map +7 -0
- package/dist/runtime/monty-source.d.ts +10 -0
- package/dist/runtime/monty-source.d.ts.map +1 -0
- package/dist/runtime/monty-values.d.ts +7 -0
- package/dist/runtime/monty-values.d.ts.map +1 -0
- package/dist/runtime/node-process-child-source.d.ts +2 -0
- package/dist/runtime/node-process-child-source.d.ts.map +1 -0
- package/dist/runtime/node-process-runtime.d.ts +10 -0
- package/dist/runtime/node-process-runtime.d.ts.map +1 -0
- package/dist/runtime/node-process-runtime.js +16 -0
- package/dist/runtime/node-process-runtime.js.map +7 -0
- package/dist/runtime/orchestration.d.ts +3 -0
- package/dist/runtime/orchestration.d.ts.map +1 -0
- package/dist/runtime/python-arguments.d.ts +2 -0
- package/dist/runtime/python-arguments.d.ts.map +1 -0
- package/dist/runtime/python-error-guidance.d.ts +6 -0
- package/dist/runtime/python-error-guidance.d.ts.map +1 -0
- package/dist/runtime/quickjs-runtime.d.ts +8 -0
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -0
- package/dist/runtime/quickjs-runtime.js +15 -0
- package/dist/runtime/quickjs-runtime.js.map +7 -0
- package/dist/runtime/type-checker.d.ts +18 -0
- package/dist/runtime/type-checker.d.ts.map +1 -0
- package/dist/runtime/type-checker.js +11 -0
- package/dist/runtime/type-checker.js.map +7 -0
- package/dist/runtime/typescript-kernel.d.ts +14 -0
- package/dist/runtime/typescript-kernel.d.ts.map +1 -0
- package/dist/runtime/typescript-kernel.js +53 -0
- package/dist/runtime/typescript-kernel.js.map +7 -0
- package/dist/runtime-paths.d.ts +7 -0
- package/dist/runtime-paths.d.ts.map +1 -0
- package/dist/runtime-state-builtins.d.ts +26 -0
- package/dist/runtime-state-builtins.d.ts.map +1 -0
- package/dist/runtime-state-speculation.d.ts +16 -0
- package/dist/runtime-state-speculation.d.ts.map +1 -0
- package/dist/schema/controller.d.ts +35 -0
- package/dist/schema/controller.d.ts.map +1 -0
- package/dist/schema/policy.d.ts +2 -0
- package/dist/schema/policy.d.ts.map +1 -0
- package/dist/schema/types.d.ts +86 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/workspace.d.ts +19 -0
- package/dist/schema/workspace.d.ts.map +1 -0
- package/dist/speculation/eligibility.d.ts +22 -0
- package/dist/speculation/eligibility.d.ts.map +1 -0
- package/dist/speculation/freshness.d.ts +10 -0
- package/dist/speculation/freshness.d.ts.map +1 -0
- package/dist/speculation/partial-json.d.ts +9 -0
- package/dist/speculation/partial-json.d.ts.map +1 -0
- package/dist/speculation/python-scanner.d.ts +7 -0
- package/dist/speculation/python-scanner.d.ts.map +1 -0
- package/dist/speculation/python-scanner.js +166 -0
- package/dist/speculation/python-scanner.js.map +7 -0
- package/dist/speculation/scanner.d.ts +13 -0
- package/dist/speculation/scanner.d.ts.map +1 -0
- package/dist/speculation/scanner.js +182 -0
- package/dist/speculation/scanner.js.map +7 -0
- package/dist/speculation/store.d.ts +41 -0
- package/dist/speculation/store.d.ts.map +1 -0
- package/dist/speculation/stream-tap.d.ts +30 -0
- package/dist/speculation/stream-tap.d.ts.map +1 -0
- package/dist/speculation/types.d.ts +44 -0
- package/dist/speculation/types.d.ts.map +1 -0
- package/dist/state/complexity.d.ts +13 -0
- package/dist/state/complexity.d.ts.map +1 -0
- package/dist/state/evidence-runner.d.ts +17 -0
- package/dist/state/evidence-runner.d.ts.map +1 -0
- package/dist/state/store.d.ts +76 -0
- package/dist/state/store.d.ts.map +1 -0
- package/dist/state/types.d.ts +165 -0
- package/dist/state/types.d.ts.map +1 -0
- package/dist/storage/retention.d.ts +22 -0
- package/dist/storage/retention.d.ts.map +1 -0
- package/dist/thinking.d.ts +19 -0
- package/dist/thinking.d.ts.map +1 -0
- package/dist/topology/control-plane.d.ts +58 -0
- package/dist/topology/control-plane.d.ts.map +1 -0
- package/dist/topology/participant-directory.d.ts +33 -0
- package/dist/topology/participant-directory.d.ts.map +1 -0
- package/dist/topology/peer-settle.d.ts +51 -0
- package/dist/topology/peer-settle.d.ts.map +1 -0
- package/dist/topology/records.d.ts +6 -0
- package/dist/topology/records.d.ts.map +1 -0
- package/dist/topology/types.d.ts +89 -0
- package/dist/topology/types.d.ts.map +1 -0
- package/dist/type-error-guidance.d.ts +3 -0
- package/dist/type-error-guidance.d.ts.map +1 -0
- package/dist/ui/arc-group.d.ts +17 -0
- package/dist/ui/arc-group.d.ts.map +1 -0
- package/dist/ui/border-status-editor.d.ts +22 -0
- package/dist/ui/border-status-editor.d.ts.map +1 -0
- package/dist/ui/code-preview-shell.d.ts +11 -0
- package/dist/ui/code-preview-shell.d.ts.map +1 -0
- package/dist/ui/code-preview.d.ts +53 -0
- package/dist/ui/code-preview.d.ts.map +1 -0
- package/dist/ui/controller.d.ts +20 -0
- package/dist/ui/controller.d.ts.map +1 -0
- package/dist/ui/conversation-chrome.d.ts +16 -0
- package/dist/ui/conversation-chrome.d.ts.map +1 -0
- package/dist/ui/conversation-chrome.js +11 -0
- package/dist/ui/conversation-chrome.js.map +7 -0
- package/dist/ui/conversation-commands.d.ts +12 -0
- package/dist/ui/conversation-commands.d.ts.map +1 -0
- package/dist/ui/conversation-history.d.ts +6 -0
- package/dist/ui/conversation-history.d.ts.map +1 -0
- package/dist/ui/conversation-host.d.ts +7 -0
- package/dist/ui/conversation-host.d.ts.map +1 -0
- package/dist/ui/conversation-host.js +9 -0
- package/dist/ui/conversation-host.js.map +7 -0
- package/dist/ui/conversation-native-reader-checkpoint.d.ts +8 -0
- package/dist/ui/conversation-native-reader-checkpoint.d.ts.map +1 -0
- package/dist/ui/conversation-native-reader-replay.d.ts +10 -0
- package/dist/ui/conversation-native-reader-replay.d.ts.map +1 -0
- package/dist/ui/conversation-native-reader.d.ts +110 -0
- package/dist/ui/conversation-native-reader.d.ts.map +1 -0
- package/dist/ui/conversation-native-reader.js +1050 -0
- package/dist/ui/conversation-native-reader.js.map +7 -0
- package/dist/ui/conversation-queue-store.d.ts +14 -0
- package/dist/ui/conversation-queue-store.d.ts.map +1 -0
- package/dist/ui/conversation-queue.d.ts +244 -0
- package/dist/ui/conversation-queue.d.ts.map +1 -0
- package/dist/ui/conversation-render.d.ts +104 -0
- package/dist/ui/conversation-render.d.ts.map +1 -0
- package/dist/ui/conversation-selection.d.ts +18 -0
- package/dist/ui/conversation-selection.d.ts.map +1 -0
- package/dist/ui/conversation-shortcut.d.ts +3 -0
- package/dist/ui/conversation-shortcut.d.ts.map +1 -0
- package/dist/ui/conversation-targets.d.ts +7 -0
- package/dist/ui/conversation-targets.d.ts.map +1 -0
- package/dist/ui/conversation-targets.js +12 -0
- package/dist/ui/conversation-targets.js.map +7 -0
- package/dist/ui/conversation-transcript.d.ts +25 -0
- package/dist/ui/conversation-transcript.d.ts.map +1 -0
- package/dist/ui/conversation.d.ts +219 -0
- package/dist/ui/conversation.d.ts.map +1 -0
- package/dist/ui/conversation.js +2861 -0
- package/dist/ui/conversation.js.map +7 -0
- package/dist/ui/core-tool-render.d.ts +20 -0
- package/dist/ui/core-tool-render.d.ts.map +1 -0
- package/dist/ui/dashboard-detail.d.ts +68 -0
- package/dist/ui/dashboard-detail.d.ts.map +1 -0
- package/dist/ui/dashboard-fabric-graph.d.ts +50 -0
- package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -0
- package/dist/ui/dashboard-graph-controller.d.ts +52 -0
- package/dist/ui/dashboard-graph-controller.d.ts.map +1 -0
- package/dist/ui/dashboard-modal-controller.d.ts +36 -0
- package/dist/ui/dashboard-modal-controller.d.ts.map +1 -0
- package/dist/ui/dashboard-model.d.ts +111 -0
- package/dist/ui/dashboard-model.d.ts.map +1 -0
- package/dist/ui/dashboard-presentation.d.ts +6 -0
- package/dist/ui/dashboard-presentation.d.ts.map +1 -0
- package/dist/ui/dashboard.d.ts +156 -0
- package/dist/ui/dashboard.d.ts.map +1 -0
- package/dist/ui/dashboard.js +4622 -0
- package/dist/ui/dashboard.js.map +7 -0
- package/dist/ui/diff-background.d.ts +12 -0
- package/dist/ui/diff-background.d.ts.map +1 -0
- package/dist/ui/dynamic-border.d.ts +8 -0
- package/dist/ui/dynamic-border.d.ts.map +1 -0
- package/dist/ui/escape-halt.d.ts +11 -0
- package/dist/ui/escape-halt.d.ts.map +1 -0
- package/dist/ui/fabric-actor-delivery-selector.d.ts +17 -0
- package/dist/ui/fabric-actor-delivery-selector.d.ts.map +1 -0
- package/dist/ui/fabric-actor-tool-selector.d.ts +22 -0
- package/dist/ui/fabric-actor-tool-selector.d.ts.map +1 -0
- package/dist/ui/fabric-code-parser.d.ts +9 -0
- package/dist/ui/fabric-code-parser.d.ts.map +1 -0
- package/dist/ui/fabric-host-event-selector.d.ts +29 -0
- package/dist/ui/fabric-host-event-selector.d.ts.map +1 -0
- package/dist/ui/fabric-model-selector.d.ts +64 -0
- package/dist/ui/fabric-model-selector.d.ts.map +1 -0
- package/dist/ui/fabric-render.d.ts +113 -0
- package/dist/ui/fabric-render.d.ts.map +1 -0
- package/dist/ui/fabric-thinking-selector.d.ts +26 -0
- package/dist/ui/fabric-thinking-selector.d.ts.map +1 -0
- package/dist/ui/fabric-title-hint.d.ts +3 -0
- package/dist/ui/fabric-title-hint.d.ts.map +1 -0
- package/dist/ui/format.d.ts +9 -0
- package/dist/ui/format.d.ts.map +1 -0
- package/dist/ui/handoff-completion.d.ts +3 -0
- package/dist/ui/handoff-completion.d.ts.map +1 -0
- package/dist/ui/highlight.d.ts +69 -0
- package/dist/ui/highlight.d.ts.map +1 -0
- package/dist/ui/model-picker.d.ts +46 -0
- package/dist/ui/model-picker.d.ts.map +1 -0
- package/dist/ui/model-picker.js +17 -0
- package/dist/ui/model-picker.js.map +7 -0
- package/dist/ui/preview-lines.d.ts +16 -0
- package/dist/ui/preview-lines.d.ts.map +1 -0
- package/dist/ui/row-balance.d.ts +29 -0
- package/dist/ui/row-balance.d.ts.map +1 -0
- package/dist/ui/settings-component.d.ts +26 -0
- package/dist/ui/settings-component.d.ts.map +1 -0
- package/dist/ui/settings-rpc.d.ts +15 -0
- package/dist/ui/settings-rpc.d.ts.map +1 -0
- package/dist/ui/settings-section-context.d.ts +18 -0
- package/dist/ui/settings-section-context.d.ts.map +1 -0
- package/dist/ui/settings-sections-agents.d.ts +5 -0
- package/dist/ui/settings-sections-agents.d.ts.map +1 -0
- package/dist/ui/settings-sections-execution.d.ts +8 -0
- package/dist/ui/settings-sections-execution.d.ts.map +1 -0
- package/dist/ui/settings-sections-lifecycle.d.ts +6 -0
- package/dist/ui/settings-sections-lifecycle.d.ts.map +1 -0
- package/dist/ui/settings-sections-presentation.d.ts +6 -0
- package/dist/ui/settings-sections-presentation.d.ts.map +1 -0
- package/dist/ui/settings-sections.d.ts +12 -0
- package/dist/ui/settings-sections.d.ts.map +1 -0
- package/dist/ui/settings-submenus.d.ts +74 -0
- package/dist/ui/settings-submenus.d.ts.map +1 -0
- package/dist/ui/settings-values.d.ts +63 -0
- package/dist/ui/settings-values.d.ts.map +1 -0
- package/dist/ui/settings.d.ts +21 -0
- package/dist/ui/settings.d.ts.map +1 -0
- package/dist/ui/settings.js +1985 -0
- package/dist/ui/settings.js.map +7 -0
- package/dist/ui/shell-hang-keys.d.ts +11 -0
- package/dist/ui/shell-hang-keys.d.ts.map +1 -0
- package/dist/ui/shiki-language.d.ts +7 -0
- package/dist/ui/shiki-language.d.ts.map +1 -0
- package/dist/ui/shiki-theme.d.ts +7 -0
- package/dist/ui/shiki-theme.d.ts.map +1 -0
- package/dist/ui/snapshot.d.ts +17 -0
- package/dist/ui/snapshot.d.ts.map +1 -0
- package/dist/ui/spinner.d.ts +6 -0
- package/dist/ui/spinner.d.ts.map +1 -0
- package/dist/ui/state-file-preview.d.ts +13 -0
- package/dist/ui/state-file-preview.d.ts.map +1 -0
- package/dist/ui/structured.d.ts +9 -0
- package/dist/ui/structured.d.ts.map +1 -0
- package/dist/ui/tool-call-timing.d.ts +2 -0
- package/dist/ui/tool-call-timing.d.ts.map +1 -0
- package/dist/ui/tool-display.d.ts +8 -0
- package/dist/ui/tool-display.d.ts.map +1 -0
- package/dist/ui/topology.d.ts +162 -0
- package/dist/ui/topology.d.ts.map +1 -0
- package/dist/ui/transcript-parser.d.ts +18 -0
- package/dist/ui/transcript-parser.d.ts.map +1 -0
- package/dist/ui/transcript-reader.d.ts +10 -0
- package/dist/ui/transcript-reader.d.ts.map +1 -0
- package/dist/ui/transcript-sanitization.d.ts +14 -0
- package/dist/ui/transcript-sanitization.d.ts.map +1 -0
- package/dist/ui/transcript.d.ts +52 -0
- package/dist/ui/transcript.d.ts.map +1 -0
- package/dist/ui/types.d.ts +84 -0
- package/dist/ui/types.d.ts.map +1 -0
- package/dist/ui/widget.d.ts +16 -0
- package/dist/ui/widget.d.ts.map +1 -0
- package/dist/ui/word-diff/alignment.d.ts +6 -0
- package/dist/ui/word-diff/alignment.d.ts.map +1 -0
- package/dist/ui/word-diff/change-block.d.ts +18 -0
- package/dist/ui/word-diff/change-block.d.ts.map +1 -0
- package/dist/ui/word-diff/changed-line.d.ts +14 -0
- package/dist/ui/word-diff/changed-line.d.ts.map +1 -0
- package/dist/ui/word-diff/emphasis.d.ts +9 -0
- package/dist/ui/word-diff/emphasis.d.ts.map +1 -0
- package/dist/ui/word-diff/line-emphasis.d.ts +7 -0
- package/dist/ui/word-diff/line-emphasis.d.ts.map +1 -0
- package/dist/ui/word-diff/line-matching.d.ts +10 -0
- package/dist/ui/word-diff/line-matching.d.ts.map +1 -0
- package/dist/ui/word-diff/line-similarity.d.ts +16 -0
- package/dist/ui/word-diff/line-similarity.d.ts.map +1 -0
- package/dist/ui/word-diff/normalize.d.ts +3 -0
- package/dist/ui/word-diff/normalize.d.ts.map +1 -0
- package/dist/ui/word-diff/parse.d.ts +17 -0
- package/dist/ui/word-diff/parse.d.ts.map +1 -0
- package/dist/ui/word-diff/range-refinement.d.ts +5 -0
- package/dist/ui/word-diff/range-refinement.d.ts.map +1 -0
- package/dist/ui/word-diff/ranges.d.ts +11 -0
- package/dist/ui/word-diff/ranges.d.ts.map +1 -0
- package/dist/ui/word-diff/smart-filter.d.ts +3 -0
- package/dist/ui/word-diff/smart-filter.d.ts.map +1 -0
- package/dist/ui/word-diff/sparse-line-matching.d.ts +25 -0
- package/dist/ui/word-diff/sparse-line-matching.d.ts.map +1 -0
- package/dist/ui/word-diff/text-boundaries.d.ts +11 -0
- package/dist/ui/word-diff/text-boundaries.d.ts.map +1 -0
- package/dist/ui/word-diff/token-alignment.d.ts +9 -0
- package/dist/ui/word-diff/token-alignment.d.ts.map +1 -0
- package/dist/ui/word-diff/token-text-refinement.d.ts +4 -0
- package/dist/ui/word-diff/token-text-refinement.d.ts.map +1 -0
- package/dist/ui/word-diff/tokens.d.ts +16 -0
- package/dist/ui/word-diff/tokens.d.ts.map +1 -0
- package/dist/ui/word-diff/types.d.ts +10 -0
- package/dist/ui/word-diff/types.d.ts.map +1 -0
- package/dist/util.d.ts +3 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/worker/model-control.d.ts +14 -0
- package/dist/worker/model-control.d.ts.map +1 -0
- package/dist/worker/model-control.js +118 -0
- package/dist/worker/model-control.js.map +7 -0
- package/dist/worker/options.d.ts +3 -0
- package/dist/worker/options.d.ts.map +1 -0
- package/dist/worker/options.js +156 -0
- package/dist/worker/options.js.map +7 -0
- package/dist/worker/run-record.d.ts +22 -0
- package/dist/worker/run-record.d.ts.map +1 -0
- package/dist/worker/run-record.js +124 -0
- package/dist/worker/run-record.js.map +7 -0
- package/dist/worker/session-export.d.ts +45 -0
- package/dist/worker/session-export.d.ts.map +1 -0
- package/dist/worker/session-export.js +91 -0
- package/dist/worker/session-export.js.map +7 -0
- package/dist/worker.d.ts +3 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +1074 -0
- package/dist/worker.js.map +7 -0
- package/docs/agents.md +618 -0
- package/docs/architecture.md +141 -0
- package/docs/audit-trace.md +116 -0
- package/docs/certification.md +166 -0
- package/docs/compaction.md +345 -0
- package/docs/component-calculus.md +191 -0
- package/docs/components.md +330 -0
- package/docs/configuration.md +529 -0
- package/docs/entropy.md +214 -0
- package/docs/interface.md +210 -0
- package/docs/jev.md +289 -0
- package/docs/kernels.md +186 -0
- package/docs/memory-recall.md +664 -0
- package/docs/programmatic-compaction.md +205 -0
- package/docs/provider-component-calculus.md +378 -0
- package/docs/providers.md +163 -0
- package/docs/repairs.md +90 -0
- package/docs/residency-runtime.md +82 -0
- package/docs/schema-enforcement.md +166 -0
- package/docs/skills.md +50 -0
- package/docs/speculation.md +171 -0
- package/docs/state-layer.md +197 -0
- package/package.json +135 -0
- package/skillsets/python/fabric-advisor/SKILL.md +29 -0
- package/skillsets/python/fabric-ambient/SKILL.md +44 -0
- package/skillsets/python/fabric-ambient/references/setup.md +67 -0
- package/skillsets/python/fabric-council/SKILL.md +54 -0
- package/skillsets/python/fabric-exec/SKILL.md +74 -0
- package/skillsets/python/fabric-exec/references/agents.md +65 -0
- package/skillsets/python/fabric-exec/references/mcp.md +23 -0
- package/skillsets/python/fabric-exec/references/mesh.md +27 -0
- package/skillsets/python/fabric-fusion/SKILL.md +112 -0
- package/skillsets/python/fabric-guide/SKILL.md +29 -0
- package/skillsets/python/fabric-jev/SKILL.md +162 -0
- package/skillsets/python/fabric-rlm/SKILL.md +120 -0
- package/skillsets/python/fabric-schema/SKILL.md +55 -0
- package/skillsets/python/fabric-spec/SKILL.md +42 -0
- package/skillsets/python/fabric-supervisor/SKILL.md +37 -0
- package/skillsets/python/fabric-swarm/SKILL.md +40 -0
- package/skillsets/python/fabric-workflow/SKILL.md +62 -0
- package/skillsets/typescript/fabric-advisor/SKILL.md +29 -0
- package/skillsets/typescript/fabric-ambient/SKILL.md +44 -0
- package/skillsets/typescript/fabric-ambient/references/setup.md +90 -0
- package/skillsets/typescript/fabric-council/SKILL.md +94 -0
- package/skillsets/typescript/fabric-exec/SKILL.md +142 -0
- package/skillsets/typescript/fabric-exec/references/agents.md +218 -0
- package/skillsets/typescript/fabric-exec/references/mcp.md +49 -0
- package/skillsets/typescript/fabric-exec/references/mesh.md +51 -0
- package/skillsets/typescript/fabric-fusion/SKILL.md +332 -0
- package/skillsets/typescript/fabric-guide/SKILL.md +29 -0
- package/skillsets/typescript/fabric-jev/SKILL.md +159 -0
- package/skillsets/typescript/fabric-rlm/SKILL.md +284 -0
- package/skillsets/typescript/fabric-schema/SKILL.md +121 -0
- package/skillsets/typescript/fabric-spec/SKILL.md +42 -0
- package/skillsets/typescript/fabric-supervisor/SKILL.md +37 -0
- package/skillsets/typescript/fabric-swarm/SKILL.md +80 -0
- package/skillsets/typescript/fabric-workflow/SKILL.md +133 -0
|
@@ -0,0 +1,1466 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatFabricEffectConflict
|
|
3
|
+
} from "./chunk-LMAVZN7J.js";
|
|
4
|
+
import {
|
|
5
|
+
MAX_AUDIT_VALUE_CHARS,
|
|
6
|
+
activeQuarantinedRefNames,
|
|
7
|
+
applyActiveActionName,
|
|
8
|
+
applyActiveArgRepairs,
|
|
9
|
+
boundedPreviewValue,
|
|
10
|
+
boundedResult,
|
|
11
|
+
effectiveInputSchema,
|
|
12
|
+
failedResultError,
|
|
13
|
+
failedResultOutcome,
|
|
14
|
+
getActiveRepairCompiler,
|
|
15
|
+
isActiveQuarantine,
|
|
16
|
+
normalizeActiveArguments,
|
|
17
|
+
previewArgs,
|
|
18
|
+
previewResult,
|
|
19
|
+
repairCatalogInput,
|
|
20
|
+
validateCatalogArgs,
|
|
21
|
+
validationMessage
|
|
22
|
+
} from "./chunk-PSNXUZMY.js";
|
|
23
|
+
import {
|
|
24
|
+
runAbortable,
|
|
25
|
+
settleWithin
|
|
26
|
+
} from "./chunk-7TB7NXSL.js";
|
|
27
|
+
import {
|
|
28
|
+
FABRIC_NESTED_TOOL_CALL_ID_PREFIX
|
|
29
|
+
} from "./chunk-WVH324VF.js";
|
|
30
|
+
import {
|
|
31
|
+
FabricResolutionError,
|
|
32
|
+
FabricTraceSafeError,
|
|
33
|
+
executionOutcomeFromError
|
|
34
|
+
} from "./chunk-D5WKZONW.js";
|
|
35
|
+
import {
|
|
36
|
+
stableJsonHash
|
|
37
|
+
} from "./chunk-3YZUQESG.js";
|
|
38
|
+
|
|
39
|
+
// src/core/action-registry.ts
|
|
40
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
41
|
+
|
|
42
|
+
// src/core/action-repair.ts
|
|
43
|
+
var ACTION_SYNONYM_CLASSES = [
|
|
44
|
+
// memory.recall and its spilled search verbs.
|
|
45
|
+
["recall", "search", "find", "query", "lookup", "grep", "scan", "locate"],
|
|
46
|
+
// memory.expand / read-one-entry verbs.
|
|
47
|
+
["expand", "get", "read", "fetch", "load", "view", "show"],
|
|
48
|
+
// memory.sessions and list-style catalog reads.
|
|
49
|
+
["sessions", "list", "ls", "enumerate", "index"],
|
|
50
|
+
// state.transition / mesh.put write verbs.
|
|
51
|
+
["transition", "write", "put", "set", "save", "update", "store", "upsert", "append", "post"],
|
|
52
|
+
// agents.create family.
|
|
53
|
+
["create", "spawn", "new", "add", "make", "register"],
|
|
54
|
+
// mesh.publish family ("post" deliberately also sits in the write class,
|
|
55
|
+
// so mesh.post stays ambiguous between publish and put).
|
|
56
|
+
["publish", "send", "emit", "notify"],
|
|
57
|
+
// teardown verbs.
|
|
58
|
+
["delete", "remove", "rm", "destroy", "drop", "clear"],
|
|
59
|
+
// components.reload family.
|
|
60
|
+
["reload", "restart", "refresh", "rebuild", "reboot"],
|
|
61
|
+
// status/introspection reads ("get" is deliberately shared with the
|
|
62
|
+
// expand class: memory.get expands an entry, components.get is status).
|
|
63
|
+
["status", "info", "inspect", "health", "describe", "get"],
|
|
64
|
+
// execution verbs.
|
|
65
|
+
["run", "execute", "exec", "invoke", "call", "start", "go"],
|
|
66
|
+
// cancellation verbs.
|
|
67
|
+
["cancel", "abort", "stop", "kill", "terminate"],
|
|
68
|
+
// verification verbs.
|
|
69
|
+
["verify", "check", "validate", "assert", "confirm", "certify"],
|
|
70
|
+
// timeline reads.
|
|
71
|
+
["history", "log", "journal", "events", "timeline", "transitions"],
|
|
72
|
+
// subscription verbs.
|
|
73
|
+
["subscribe", "watch", "listen", "observe", "follow"],
|
|
74
|
+
// compact.request family.
|
|
75
|
+
["request", "begin", "initiate", "trigger", "schedule"],
|
|
76
|
+
// schema.commit family.
|
|
77
|
+
["commit", "apply", "finalize"],
|
|
78
|
+
// agents messaging pair (both declare, so spilled verbs here stay
|
|
79
|
+
// ambiguous and the failure tier enumerates ask vs tell).
|
|
80
|
+
["ask", "tell", "say", "chat"]
|
|
81
|
+
];
|
|
82
|
+
var normalizeActionForm = (name) => name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
83
|
+
var ACTION_CLASS_FORMS = ACTION_SYNONYM_CLASSES.map(
|
|
84
|
+
(cls) => new Set(cls.map(normalizeActionForm))
|
|
85
|
+
);
|
|
86
|
+
var camelTokens = (name) => name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").toLowerCase().split(/[^a-z0-9]+/).filter((token) => token.length > 0);
|
|
87
|
+
var singularActionForm = (form) => form.length > 3 && form.endsWith("s") ? form.slice(0, -1) : form;
|
|
88
|
+
var levenshtein = (left, right) => {
|
|
89
|
+
if (left === right) return 0;
|
|
90
|
+
if (left.length === 0) return right.length;
|
|
91
|
+
if (right.length === 0) return left.length;
|
|
92
|
+
let previous = new Array(right.length + 1);
|
|
93
|
+
let current = new Array(right.length + 1);
|
|
94
|
+
for (let j = 0; j <= right.length; j++) previous[j] = j;
|
|
95
|
+
for (let i = 1; i <= left.length; i++) {
|
|
96
|
+
current[0] = i;
|
|
97
|
+
for (let j = 1; j <= right.length; j++) {
|
|
98
|
+
current[j] = Math.min(
|
|
99
|
+
previous[j] + 1,
|
|
100
|
+
current[j - 1] + 1,
|
|
101
|
+
previous[j - 1] + (left[i - 1] === right[j - 1] ? 0 : 1)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const swap = previous;
|
|
105
|
+
previous = current;
|
|
106
|
+
current = swap;
|
|
107
|
+
}
|
|
108
|
+
return previous[right.length];
|
|
109
|
+
};
|
|
110
|
+
var editThreshold = (form) => form.length <= 4 ? 1 : Math.max(2, Math.floor(form.length / 4));
|
|
111
|
+
var tokenAligned = (spilled, declared) => {
|
|
112
|
+
if (spilled.length === 0 || spilled.length !== declared.length) return false;
|
|
113
|
+
return spilled.every((token, index) => {
|
|
114
|
+
const other = declared[index];
|
|
115
|
+
if (token === other) return true;
|
|
116
|
+
return token.length >= 3 && other.length >= 3 && (token.startsWith(other) || other.startsWith(token));
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
var sortNames = (names) => [...new Set(names)].sort((left, right) => left.localeCompare(right));
|
|
120
|
+
var catalogCache = /* @__PURE__ */ new WeakMap();
|
|
121
|
+
var catalogSnapshot = (declared) => {
|
|
122
|
+
const cached = catalogCache.get(declared);
|
|
123
|
+
if (cached?.forms.length === declared.length && cached.forms.every((entry, index) => entry.name === declared[index])) {
|
|
124
|
+
return cached;
|
|
125
|
+
}
|
|
126
|
+
const forms = declared.map((name) => {
|
|
127
|
+
const form = normalizeActionForm(name);
|
|
128
|
+
return { name, form, singular: singularActionForm(form), tokens: camelTokens(name) };
|
|
129
|
+
});
|
|
130
|
+
const snapshot2 = { forms, repairs: /* @__PURE__ */ new Map() };
|
|
131
|
+
catalogCache.set(declared, snapshot2);
|
|
132
|
+
return snapshot2;
|
|
133
|
+
};
|
|
134
|
+
var computeActionRepair = (catalog, actionName) => {
|
|
135
|
+
const spilledForm = normalizeActionForm(actionName);
|
|
136
|
+
if (spilledForm.length === 0) return { suggestions: [] };
|
|
137
|
+
if (catalog.some((entry) => entry.name === actionName)) return { suggestions: [] };
|
|
138
|
+
const forms = [...new Map(catalog.map((entry) => [entry.name, entry])).values()];
|
|
139
|
+
const exact = forms.filter((entry) => entry.form === spilledForm).map((entry) => entry.name);
|
|
140
|
+
if (exact.length === 1) return { repaired: exact[0], suggestions: exact };
|
|
141
|
+
if (exact.length > 1) return { suggestions: sortNames(exact) };
|
|
142
|
+
if (forms.length === 0) return { suggestions: [] };
|
|
143
|
+
const classCandidates = sortNames(ACTION_CLASS_FORMS.filter((classForms) => classForms.has(spilledForm)).flatMap(
|
|
144
|
+
(classForms) => forms.filter((entry) => classForms.has(entry.form)).map((entry) => entry.name)
|
|
145
|
+
));
|
|
146
|
+
if (classCandidates.length === 1) {
|
|
147
|
+
return { repaired: classCandidates[0], suggestions: [classCandidates[0]] };
|
|
148
|
+
}
|
|
149
|
+
if (classCandidates.length > 1) {
|
|
150
|
+
return { suggestions: sortNames(classCandidates) };
|
|
151
|
+
}
|
|
152
|
+
const spilledTokens = camelTokens(actionName);
|
|
153
|
+
const spilledSingular = singularActionForm(spilledForm);
|
|
154
|
+
const derived = [];
|
|
155
|
+
for (const entry of forms) {
|
|
156
|
+
if (entry.form === spilledForm || entry.singular === spilledSingular || spilledTokens.length > 0 && tokenAligned(spilledTokens, entry.tokens) || spilledForm.length >= 4 && entry.form.startsWith(spilledForm)) {
|
|
157
|
+
derived.push(entry.name);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (derived.length > 0) return { suggestions: sortNames(derived) };
|
|
161
|
+
const distances = forms.map((entry) => ({
|
|
162
|
+
name: entry.name,
|
|
163
|
+
distance: levenshtein(spilledForm, entry.form)
|
|
164
|
+
}));
|
|
165
|
+
const min = Math.min(...distances.map((entry) => entry.distance));
|
|
166
|
+
const threshold = editThreshold(spilledForm);
|
|
167
|
+
if (min <= threshold) {
|
|
168
|
+
const nearest = sortNames(
|
|
169
|
+
distances.filter((entry) => entry.distance === min).map((entry) => entry.name)
|
|
170
|
+
);
|
|
171
|
+
return { suggestions: nearest };
|
|
172
|
+
}
|
|
173
|
+
const suggestions = distances.filter((entry) => entry.distance <= Math.max(3, Math.floor(spilledForm.length / 2))).sort(
|
|
174
|
+
(left, right) => left.distance - right.distance || left.name.localeCompare(right.name)
|
|
175
|
+
).slice(0, 3).map((entry) => entry.name);
|
|
176
|
+
return { suggestions: sortNames(suggestions) };
|
|
177
|
+
};
|
|
178
|
+
var repairActionName = (declared, actionName) => {
|
|
179
|
+
const catalog = catalogSnapshot(declared);
|
|
180
|
+
let result = catalog.repairs.get(actionName);
|
|
181
|
+
if (!result) {
|
|
182
|
+
result = computeActionRepair(catalog.forms, actionName);
|
|
183
|
+
if (actionName.length <= 512) {
|
|
184
|
+
if (catalog.repairs.size >= 128) catalog.repairs.delete(catalog.repairs.keys().next().value);
|
|
185
|
+
catalog.repairs.set(actionName, result);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return { ...result, suggestions: [...result.suggestions] };
|
|
189
|
+
};
|
|
190
|
+
var formatUnknownActionMessage = (ref, suggestions) => suggestions.length > 0 ? `Unknown Fabric action: ${ref} (did you mean: ${suggestions.slice(0, 3).join(", ")}?)` : `Unknown Fabric action: ${ref}`;
|
|
191
|
+
|
|
192
|
+
// src/core/provider-bindings.ts
|
|
193
|
+
import { randomUUID } from "node:crypto";
|
|
194
|
+
var snapshot = (binding) => ({
|
|
195
|
+
...binding,
|
|
196
|
+
...binding.closeTask ? { closeTask: binding.closeTask } : {}
|
|
197
|
+
});
|
|
198
|
+
var FabricProviderBindings = class {
|
|
199
|
+
#current = /* @__PURE__ */ new Map();
|
|
200
|
+
#staged = /* @__PURE__ */ new Map();
|
|
201
|
+
#all = /* @__PURE__ */ new Map();
|
|
202
|
+
#generations = /* @__PURE__ */ new Map();
|
|
203
|
+
#listeners = /* @__PURE__ */ new Set();
|
|
204
|
+
subscribe(listener) {
|
|
205
|
+
this.#listeners.add(listener);
|
|
206
|
+
return () => this.#listeners.delete(listener);
|
|
207
|
+
}
|
|
208
|
+
current(name) {
|
|
209
|
+
return this.#current.get(name);
|
|
210
|
+
}
|
|
211
|
+
binding(id) {
|
|
212
|
+
const binding = this.#all.get(id);
|
|
213
|
+
return binding?.state === "closed" ? void 0 : binding;
|
|
214
|
+
}
|
|
215
|
+
has(name) {
|
|
216
|
+
return this.#current.has(name);
|
|
217
|
+
}
|
|
218
|
+
providers() {
|
|
219
|
+
return [...this.#current.values()].map((binding) => binding.provider);
|
|
220
|
+
}
|
|
221
|
+
entries() {
|
|
222
|
+
return [...this.#all.values()].filter((binding) => binding.state !== "closed");
|
|
223
|
+
}
|
|
224
|
+
mount(provider, options = {}) {
|
|
225
|
+
const current = this.#current.get(provider.name);
|
|
226
|
+
const staged = this.#staged.get(provider.name);
|
|
227
|
+
if ((current || staged) && !options.overwrite) {
|
|
228
|
+
throw new Error(`Fabric provider already registered: ${provider.name}`);
|
|
229
|
+
}
|
|
230
|
+
if (staged && options.overwrite) this.retire(staged.id);
|
|
231
|
+
const generation = (this.#generations.get(provider.name) ?? 0) + 1;
|
|
232
|
+
this.#generations.set(provider.name, generation);
|
|
233
|
+
const binding = {
|
|
234
|
+
id: randomUUID(),
|
|
235
|
+
name: provider.name,
|
|
236
|
+
generation,
|
|
237
|
+
provider,
|
|
238
|
+
state: options.staged ? "staged" : "active",
|
|
239
|
+
ownerRetained: true,
|
|
240
|
+
allowReplace: options.overwrite === true,
|
|
241
|
+
retainers: 0,
|
|
242
|
+
inFlight: 0
|
|
243
|
+
};
|
|
244
|
+
if (provider.subscribeCatalog) {
|
|
245
|
+
binding.unsubscribeCatalog = provider.subscribeCatalog(
|
|
246
|
+
() => this.notifyCatalogChanged(provider.name)
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
this.#all.set(binding.id, binding);
|
|
250
|
+
if (options.staged) {
|
|
251
|
+
this.#staged.set(binding.name, binding);
|
|
252
|
+
this.#emit({ type: "staged", binding: snapshot(binding) });
|
|
253
|
+
} else {
|
|
254
|
+
const replaced = this.#activateOne(binding);
|
|
255
|
+
if (replaced && options.overwrite) void this.releaseOwner(replaced.id).catch(() => void 0);
|
|
256
|
+
}
|
|
257
|
+
let released = false;
|
|
258
|
+
return {
|
|
259
|
+
bindingId: binding.id,
|
|
260
|
+
name: binding.name,
|
|
261
|
+
generation: binding.generation,
|
|
262
|
+
get active() {
|
|
263
|
+
return binding.state === "active";
|
|
264
|
+
},
|
|
265
|
+
retire: () => this.retire(binding.id),
|
|
266
|
+
release: async () => {
|
|
267
|
+
if (released) return binding.closeTask;
|
|
268
|
+
released = true;
|
|
269
|
+
return this.releaseOwner(binding.id);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
activate(bindingIds) {
|
|
274
|
+
const bindings = bindingIds.map((id) => {
|
|
275
|
+
const binding = this.#all.get(id);
|
|
276
|
+
if (!binding || binding.state === "closed") {
|
|
277
|
+
throw new Error(`Unknown Fabric provider binding: ${id}`);
|
|
278
|
+
}
|
|
279
|
+
if (binding.state !== "staged" && binding.state !== "active") {
|
|
280
|
+
throw new Error(`Fabric provider binding is ${binding.state}: ${binding.name}`);
|
|
281
|
+
}
|
|
282
|
+
return binding;
|
|
283
|
+
});
|
|
284
|
+
const names = /* @__PURE__ */ new Set();
|
|
285
|
+
for (const binding of bindings) {
|
|
286
|
+
if (names.has(binding.name)) {
|
|
287
|
+
throw new Error(`Cannot activate multiple Fabric bindings for provider ${binding.name}`);
|
|
288
|
+
}
|
|
289
|
+
names.add(binding.name);
|
|
290
|
+
const current = this.#current.get(binding.name);
|
|
291
|
+
if (current && current.id !== binding.id && !binding.allowReplace) {
|
|
292
|
+
throw new Error(`Fabric provider already registered: ${binding.name}`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const replaced = [];
|
|
296
|
+
for (const binding of bindings) {
|
|
297
|
+
const previous = this.#activateOne(binding);
|
|
298
|
+
if (previous && previous.id !== binding.id) {
|
|
299
|
+
replaced.push(previous.id);
|
|
300
|
+
if (binding.allowReplace) void this.releaseOwner(previous.id).catch(() => void 0);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return replaced;
|
|
304
|
+
}
|
|
305
|
+
unregister(name) {
|
|
306
|
+
const binding = this.#current.get(name);
|
|
307
|
+
if (!binding) return void 0;
|
|
308
|
+
this.retire(binding.id);
|
|
309
|
+
void this.releaseOwner(binding.id).catch(() => void 0);
|
|
310
|
+
return binding.provider;
|
|
311
|
+
}
|
|
312
|
+
retire(id) {
|
|
313
|
+
const binding = this.#all.get(id);
|
|
314
|
+
if (!binding || binding.state === "retiring" || binding.state === "closed") return;
|
|
315
|
+
if (this.#current.get(binding.name)?.id === id) this.#current.delete(binding.name);
|
|
316
|
+
if (this.#staged.get(binding.name)?.id === id) this.#staged.delete(binding.name);
|
|
317
|
+
binding.state = "retiring";
|
|
318
|
+
this.#emit({ type: "retiring", binding: snapshot(binding) });
|
|
319
|
+
void this.#maybeClose(binding).catch(() => void 0);
|
|
320
|
+
}
|
|
321
|
+
retain(ids) {
|
|
322
|
+
const retained = [];
|
|
323
|
+
try {
|
|
324
|
+
for (const id of new Set(ids)) {
|
|
325
|
+
const binding = this.#all.get(id);
|
|
326
|
+
if (!binding || binding.state === "closed") {
|
|
327
|
+
throw new Error(`Unknown Fabric provider binding: ${id}`);
|
|
328
|
+
}
|
|
329
|
+
binding.retainers++;
|
|
330
|
+
retained.push(binding);
|
|
331
|
+
}
|
|
332
|
+
} catch (error) {
|
|
333
|
+
for (const binding of retained) binding.retainers--;
|
|
334
|
+
throw error;
|
|
335
|
+
}
|
|
336
|
+
let released = false;
|
|
337
|
+
return async () => {
|
|
338
|
+
if (released) return;
|
|
339
|
+
released = true;
|
|
340
|
+
await Promise.all(retained.map(async (binding) => {
|
|
341
|
+
binding.retainers = Math.max(0, binding.retainers - 1);
|
|
342
|
+
await this.#maybeClose(binding);
|
|
343
|
+
}));
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
beginInvocation(id) {
|
|
347
|
+
const binding = this.#all.get(id);
|
|
348
|
+
if (!binding || binding.state === "closed") {
|
|
349
|
+
throw new Error(`Unknown Fabric provider binding: ${id}`);
|
|
350
|
+
}
|
|
351
|
+
binding.inFlight++;
|
|
352
|
+
let ended = false;
|
|
353
|
+
return async () => {
|
|
354
|
+
if (ended) return;
|
|
355
|
+
ended = true;
|
|
356
|
+
binding.inFlight = Math.max(0, binding.inFlight - 1);
|
|
357
|
+
await this.#maybeClose(binding);
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
notifyCatalogChanged(provider) {
|
|
361
|
+
if (this.#current.has(provider)) this.#emit({ type: "catalog", provider });
|
|
362
|
+
}
|
|
363
|
+
async close(excludedProviderNames = /* @__PURE__ */ new Set()) {
|
|
364
|
+
const tasks = [];
|
|
365
|
+
for (const binding of this.#all.values()) {
|
|
366
|
+
if (binding.state === "closed") continue;
|
|
367
|
+
if (excludedProviderNames.has(binding.name)) {
|
|
368
|
+
if (this.#current.get(binding.name)?.id === binding.id) this.#current.delete(binding.name);
|
|
369
|
+
binding.unsubscribeCatalog?.();
|
|
370
|
+
delete binding.unsubscribeCatalog;
|
|
371
|
+
binding.state = "closed";
|
|
372
|
+
this.#all.delete(binding.id);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
this.retire(binding.id);
|
|
376
|
+
binding.ownerRetained = false;
|
|
377
|
+
binding.retainers = 0;
|
|
378
|
+
tasks.push(this.#maybeClose(binding));
|
|
379
|
+
}
|
|
380
|
+
await Promise.allSettled(tasks);
|
|
381
|
+
this.#current.clear();
|
|
382
|
+
this.#staged.clear();
|
|
383
|
+
}
|
|
384
|
+
#activateOne(binding) {
|
|
385
|
+
const current = this.#current.get(binding.name);
|
|
386
|
+
if (current?.id === binding.id && binding.state === "active") return current;
|
|
387
|
+
if (current && current.id !== binding.id) this.retire(current.id);
|
|
388
|
+
if (this.#staged.get(binding.name)?.id === binding.id) this.#staged.delete(binding.name);
|
|
389
|
+
binding.state = "active";
|
|
390
|
+
this.#current.set(binding.name, binding);
|
|
391
|
+
this.#emit({ type: "activated", binding: snapshot(binding) });
|
|
392
|
+
return current;
|
|
393
|
+
}
|
|
394
|
+
async releaseOwner(id) {
|
|
395
|
+
const binding = this.#all.get(id);
|
|
396
|
+
if (!binding) return;
|
|
397
|
+
this.retire(id);
|
|
398
|
+
binding.ownerRetained = false;
|
|
399
|
+
await this.#maybeClose(binding);
|
|
400
|
+
}
|
|
401
|
+
async #maybeClose(binding) {
|
|
402
|
+
if (binding.state !== "retiring" || binding.ownerRetained || binding.retainers > 0 || binding.inFlight > 0) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
if (binding.closeTask) return binding.closeTask;
|
|
406
|
+
binding.closeTask = (async () => {
|
|
407
|
+
binding.unsubscribeCatalog?.();
|
|
408
|
+
delete binding.unsubscribeCatalog;
|
|
409
|
+
try {
|
|
410
|
+
await binding.provider.close?.();
|
|
411
|
+
} catch (error) {
|
|
412
|
+
binding.closeError = error instanceof Error ? error.message : String(error);
|
|
413
|
+
throw error;
|
|
414
|
+
} finally {
|
|
415
|
+
binding.state = "closed";
|
|
416
|
+
this.#all.delete(binding.id);
|
|
417
|
+
this.#emit({ type: "closed", binding: snapshot(binding) });
|
|
418
|
+
}
|
|
419
|
+
})();
|
|
420
|
+
return binding.closeTask;
|
|
421
|
+
}
|
|
422
|
+
#emit(event) {
|
|
423
|
+
for (const listener of [...this.#listeners]) {
|
|
424
|
+
try {
|
|
425
|
+
listener(event);
|
|
426
|
+
} catch {
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
// src/core/action-registry.ts
|
|
433
|
+
var fabricActionListLimit = (limit) => Math.max(1, Math.min(limit ?? 100, 1e3));
|
|
434
|
+
var NESTED_TOOL_CALL_ID_PREFIX = FABRIC_NESTED_TOOL_CALL_ID_PREFIX;
|
|
435
|
+
var providerNamePattern = /^[a-z][a-z0-9_-]*$/;
|
|
436
|
+
var resolveDescriptor = (provider, descriptor) => ({
|
|
437
|
+
...descriptor,
|
|
438
|
+
effect: descriptor.effect ?? (descriptor.risk === "read" ? { kind: "none", ordering: "commutative" } : { kind: "emission", ordering: "unknown" }),
|
|
439
|
+
provider: provider.name,
|
|
440
|
+
ref: `${provider.name}.${descriptor.name}`
|
|
441
|
+
});
|
|
442
|
+
var descriptorHash = stableJsonHash;
|
|
443
|
+
var actionDescriptorHash = (action) => descriptorHash({
|
|
444
|
+
ref: action.ref,
|
|
445
|
+
description: action.description,
|
|
446
|
+
inputSchema: action.inputSchema,
|
|
447
|
+
outputSchema: action.outputSchema,
|
|
448
|
+
risk: action.risk,
|
|
449
|
+
namespace: action.namespace,
|
|
450
|
+
effect: action.effect
|
|
451
|
+
});
|
|
452
|
+
var discoveryTerms = (value) => [...value.normalize("NFKC").matchAll(/[\p{L}\p{N}_]+/gu)].map((match) => match[0].toLowerCase());
|
|
453
|
+
var conflictBetween = (left, right) => {
|
|
454
|
+
if (left.kind === "none" || right.kind === "none") return void 0;
|
|
455
|
+
const resources = (effect) => [...new Set((effect.resources ?? []).filter(
|
|
456
|
+
(resource) => typeof resource === "string" && resource.length > 0
|
|
457
|
+
).map((resource) => resource.slice(0, 256)))].slice(0, 64);
|
|
458
|
+
const leftResources = resources(left);
|
|
459
|
+
const rightResources = resources(right);
|
|
460
|
+
if (leftResources.length === 0 || rightResources.length === 0) {
|
|
461
|
+
if (left.ordering === "commutative" && right.ordering === "commutative") return void 0;
|
|
462
|
+
return { resources: ["*"], reason: "unknown_resource" };
|
|
463
|
+
}
|
|
464
|
+
const rightSet = new Set(rightResources);
|
|
465
|
+
const overlap = leftResources.filter((resource) => rightSet.has(resource)).sort();
|
|
466
|
+
if (overlap.length === 0) return void 0;
|
|
467
|
+
if (left.ordering === "commutative" && right.ordering === "commutative") return void 0;
|
|
468
|
+
return { resources: overlap, reason: "shared_resource" };
|
|
469
|
+
};
|
|
470
|
+
var ActionRegistry = class {
|
|
471
|
+
constructor(toolResultProxy) {
|
|
472
|
+
this.toolResultProxy = toolResultProxy;
|
|
473
|
+
this.#providerBindings.subscribe(() => this.#speculation?.reset?.());
|
|
474
|
+
}
|
|
475
|
+
#providerBindings = new FabricProviderBindings();
|
|
476
|
+
#activeEffects = /* @__PURE__ */ new Map();
|
|
477
|
+
#unavailable = /* @__PURE__ */ new Map();
|
|
478
|
+
#speculation;
|
|
479
|
+
#speculationEligibility;
|
|
480
|
+
/**
|
|
481
|
+
* Attach the speculative-PTC runtime. Eligibility is re-checked against the
|
|
482
|
+
* resolved descriptor inside speculate(), so a config/captured-tool change
|
|
483
|
+
* cannot sneak a side-effecting ref into the store after the fact.
|
|
484
|
+
*/
|
|
485
|
+
setSpeculation(runtime, eligibility) {
|
|
486
|
+
this.#speculation = runtime;
|
|
487
|
+
this.#speculationEligibility = eligibility;
|
|
488
|
+
}
|
|
489
|
+
register(provider, options = {}) {
|
|
490
|
+
this.mount(provider, options);
|
|
491
|
+
}
|
|
492
|
+
mount(provider, options = {}) {
|
|
493
|
+
if (!providerNamePattern.test(provider.name)) {
|
|
494
|
+
throw new Error(`Invalid Fabric provider name: ${provider.name}`);
|
|
495
|
+
}
|
|
496
|
+
const lease = this.#providerBindings.mount(provider, options);
|
|
497
|
+
this.#unavailable.delete(provider.name);
|
|
498
|
+
return lease;
|
|
499
|
+
}
|
|
500
|
+
activateProviderBindings(bindingIds) {
|
|
501
|
+
return this.#providerBindings.activate(bindingIds);
|
|
502
|
+
}
|
|
503
|
+
subscribeProviderChanges(listener) {
|
|
504
|
+
return this.#providerBindings.subscribe(listener);
|
|
505
|
+
}
|
|
506
|
+
notifyCatalogChanged(provider) {
|
|
507
|
+
this.#providerBindings.notifyCatalogChanged(provider);
|
|
508
|
+
}
|
|
509
|
+
has(name) {
|
|
510
|
+
return this.#providerBindings.has(name);
|
|
511
|
+
}
|
|
512
|
+
markUnavailable(name, reason) {
|
|
513
|
+
if (!providerNamePattern.test(name)) {
|
|
514
|
+
throw new Error(`Invalid Fabric provider name: ${name}`);
|
|
515
|
+
}
|
|
516
|
+
if (this.#providerBindings.has(name)) {
|
|
517
|
+
throw new Error(`Cannot mark a registered Fabric provider unavailable: ${name}`);
|
|
518
|
+
}
|
|
519
|
+
this.#unavailable.set(name, reason);
|
|
520
|
+
}
|
|
521
|
+
unavailableProviders() {
|
|
522
|
+
return [...this.#unavailable.entries()].map(([name, reason]) => ({ name, reason })).sort((left, right) => left.name.localeCompare(right.name));
|
|
523
|
+
}
|
|
524
|
+
unregister(name) {
|
|
525
|
+
return this.#providerBindings.unregister(name);
|
|
526
|
+
}
|
|
527
|
+
providers() {
|
|
528
|
+
return this.#providerBindings.providers().map((provider) => ({ name: provider.name, description: provider.description })).sort((left, right) => left.name.localeCompare(right.name));
|
|
529
|
+
}
|
|
530
|
+
async inspectCapabilities(requirements, context) {
|
|
531
|
+
return this.#resolveCapabilities(requirements, context, false);
|
|
532
|
+
}
|
|
533
|
+
async acquireCapabilityView(requirements, context) {
|
|
534
|
+
return this.#resolveCapabilities(requirements, context, true);
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Snapshot the tool schemas backing the dynamic guest surfaces (mcp and
|
|
538
|
+
* extensions) so the type gate can reject argument-shape mistakes before
|
|
539
|
+
* the sandbox runs. Side-effect-free by construction: MCP data comes from
|
|
540
|
+
* the provider's cache-warm descriptor slice (listing would schedule
|
|
541
|
+
* background revalidation), extension data from the captured-tool catalog.
|
|
542
|
+
* Providers that cannot supply data yet simply contribute no section and
|
|
543
|
+
* the loose declarations stand for that execution.
|
|
544
|
+
*/
|
|
545
|
+
async guestTypeSources(context) {
|
|
546
|
+
const sources = {};
|
|
547
|
+
if (context.capabilityView) {
|
|
548
|
+
const actions = await this.list({ limit: 1e3 }, context);
|
|
549
|
+
const byServer = /* @__PURE__ */ new Map();
|
|
550
|
+
for (const action of actions.filter((candidate) => candidate.provider === "mcp")) {
|
|
551
|
+
const server = action.namespace;
|
|
552
|
+
if (!server || server === "management" || action.name.startsWith("$")) continue;
|
|
553
|
+
const prefix = `${server}.`;
|
|
554
|
+
const name = action.name.startsWith(prefix) ? action.name.slice(prefix.length) : action.name;
|
|
555
|
+
const tools = byServer.get(server) ?? [];
|
|
556
|
+
tools.push({ name, inputSchema: action.inputSchema });
|
|
557
|
+
byServer.set(server, tools);
|
|
558
|
+
}
|
|
559
|
+
if (byServer.size > 0) {
|
|
560
|
+
sources.mcpServers = [...byServer.entries()].map(([server, tools]) => ({
|
|
561
|
+
server,
|
|
562
|
+
tools
|
|
563
|
+
}));
|
|
564
|
+
}
|
|
565
|
+
const extensionTools = actions.filter((action) => action.provider === "extensions").map((action) => ({ name: action.name, inputSchema: action.inputSchema }));
|
|
566
|
+
if (extensionTools.length > 0) sources.extensionTools = extensionTools;
|
|
567
|
+
return sources;
|
|
568
|
+
}
|
|
569
|
+
const mcp = this.#providerBindings.current("mcp")?.provider;
|
|
570
|
+
const mcpDescriptors = mcp?.sliceDescriptors?.();
|
|
571
|
+
if (mcpDescriptors && mcpDescriptors.length > 0) {
|
|
572
|
+
const byServer = /* @__PURE__ */ new Map();
|
|
573
|
+
for (const descriptor of mcpDescriptors) {
|
|
574
|
+
const server = descriptor.namespace;
|
|
575
|
+
if (!server || server === "management" || descriptor.name.startsWith("$")) continue;
|
|
576
|
+
const prefix = `${server}.`;
|
|
577
|
+
const toolName = descriptor.name.startsWith(prefix) ? descriptor.name.slice(prefix.length) : descriptor.name;
|
|
578
|
+
let tools = byServer.get(server);
|
|
579
|
+
if (!tools) {
|
|
580
|
+
tools = /* @__PURE__ */ new Map();
|
|
581
|
+
byServer.set(server, tools);
|
|
582
|
+
}
|
|
583
|
+
tools.set(toolName, {
|
|
584
|
+
name: toolName,
|
|
585
|
+
inputSchema: effectiveInputSchema(
|
|
586
|
+
`mcp.${descriptor.name}`,
|
|
587
|
+
descriptor.inputSchema
|
|
588
|
+
)
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
if (byServer.size > 0) {
|
|
592
|
+
sources.mcpServers = [...byServer.entries()].map(([server, tools]) => ({
|
|
593
|
+
server,
|
|
594
|
+
tools: [...tools.values()]
|
|
595
|
+
}));
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
const extensions = this.#providerBindings.current("extensions")?.provider;
|
|
599
|
+
if (extensions) {
|
|
600
|
+
try {
|
|
601
|
+
const descriptors = await extensions.list({}, context);
|
|
602
|
+
if (descriptors.length > 0) {
|
|
603
|
+
sources.extensionTools = descriptors.map((descriptor) => ({
|
|
604
|
+
name: descriptor.name,
|
|
605
|
+
inputSchema: effectiveInputSchema(
|
|
606
|
+
`extensions.${descriptor.name}`,
|
|
607
|
+
descriptor.inputSchema
|
|
608
|
+
)
|
|
609
|
+
}));
|
|
610
|
+
}
|
|
611
|
+
} catch {
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return sources;
|
|
615
|
+
}
|
|
616
|
+
// The model-facing discovery view: quarantined refs hide here, and the
|
|
617
|
+
// compiled overlay teaches: listed schemas show the compiled shape so
|
|
618
|
+
// tightened enums are visible before the first call. Pass `declared: true`
|
|
619
|
+
// for the compile's base-surface truth, which keeps quarantined refs
|
|
620
|
+
// visible and schemas declared so base-digest proofs and artifact
|
|
621
|
+
// carry-forward read the live contract. Capability-view paths stay
|
|
622
|
+
// declared everywhere (see describe): committed views pin declared
|
|
623
|
+
// digests, and a surface activation must never invalidate them.
|
|
624
|
+
async listDetailed(request, context) {
|
|
625
|
+
if (context.capabilityView) {
|
|
626
|
+
const refs = Object.keys(context.capabilityView.bindings).filter((ref) => !request.provider || ref.startsWith(`${request.provider}.`)).filter((ref) => request.declared || !activeQuarantinedRefNames().has(ref)).sort();
|
|
627
|
+
const actions = await Promise.all(refs.map((ref) => this.describe(ref, context)));
|
|
628
|
+
const query = request.query?.normalize("NFKC").trim().toLowerCase();
|
|
629
|
+
const filtered = actions.filter((action) => !request.namespace || action.namespace === request.namespace).filter(
|
|
630
|
+
(action) => !query || `${action.ref} ${action.description}`.toLowerCase().includes(query)
|
|
631
|
+
);
|
|
632
|
+
const page2 = filtered.slice(0, fabricActionListLimit(request.limit));
|
|
633
|
+
return { actions: page2, total: filtered.length, truncated: filtered.length > page2.length };
|
|
634
|
+
}
|
|
635
|
+
const providers = request.provider ? [this.#requireProvider(request.provider)] : this.#providerBindings.providers();
|
|
636
|
+
const lists = await Promise.all(
|
|
637
|
+
providers.map(async (provider) => {
|
|
638
|
+
const descriptors = await provider.list(request, context);
|
|
639
|
+
return descriptors.filter(
|
|
640
|
+
(descriptor) => request.declared || !activeQuarantinedRefNames().has(`${provider.name}.${descriptor.name}`)
|
|
641
|
+
).map((descriptor) => {
|
|
642
|
+
const action = resolveDescriptor(provider, descriptor);
|
|
643
|
+
return request.declared ? action : {
|
|
644
|
+
...action,
|
|
645
|
+
inputSchema: effectiveInputSchema(
|
|
646
|
+
action.ref,
|
|
647
|
+
action.inputSchema
|
|
648
|
+
)
|
|
649
|
+
};
|
|
650
|
+
});
|
|
651
|
+
})
|
|
652
|
+
);
|
|
653
|
+
const all = lists.flat();
|
|
654
|
+
const page = all.slice(0, fabricActionListLimit(request.limit));
|
|
655
|
+
return { actions: page, total: all.length, truncated: all.length > page.length };
|
|
656
|
+
}
|
|
657
|
+
async list(request, context) {
|
|
658
|
+
const { actions } = await this.listDetailed(request, context);
|
|
659
|
+
return actions;
|
|
660
|
+
}
|
|
661
|
+
async catalog(context, options = {}) {
|
|
662
|
+
const providers = (context.capabilityView ? [...new Map(
|
|
663
|
+
Object.values(context.capabilityView.bindings).flatMap((pinned) => {
|
|
664
|
+
const binding = this.#providerBindings.binding(pinned.providerBindingId);
|
|
665
|
+
return binding ? [[binding.name, binding.provider]] : [];
|
|
666
|
+
})
|
|
667
|
+
).values()] : options.provider ? [this.#requireProvider(options.provider)] : this.#providerBindings.providers()).filter((provider) => !options.provider || provider.name === options.provider).filter((provider) => options.includeProvider?.(provider.name) ?? true).sort((left, right) => left.name.localeCompare(right.name));
|
|
668
|
+
const lists = await Promise.all(
|
|
669
|
+
providers.map(async (provider) => ({
|
|
670
|
+
provider,
|
|
671
|
+
actions: context.capabilityView ? await this.list({ provider: provider.name, limit: 1e3 }, context) : (await provider.list({}, context)).filter(
|
|
672
|
+
(descriptor) => !activeQuarantinedRefNames().has(`${provider.name}.${descriptor.name}`)
|
|
673
|
+
).map((descriptor) => resolveDescriptor(provider, descriptor))
|
|
674
|
+
}))
|
|
675
|
+
);
|
|
676
|
+
const allActions = lists.flatMap(({ actions }) => actions).sort((left, right) => left.ref.localeCompare(right.ref));
|
|
677
|
+
const limit = Math.max(1, Math.min(Math.floor(options.limit ?? 1e3), 1e3));
|
|
678
|
+
const retainedRefs = new Set(allActions.slice(0, limit).map((action) => action.ref));
|
|
679
|
+
const providerHeads = lists.map(({ provider, actions }) => {
|
|
680
|
+
const actionHeads = actions.filter((action) => retainedRefs.has(action.ref)).sort((left, right) => left.ref.localeCompare(right.ref)).map((action) => ({
|
|
681
|
+
key: `action:${action.ref}`,
|
|
682
|
+
parentKey: `provider:${provider.name}`,
|
|
683
|
+
ref: action.ref,
|
|
684
|
+
name: action.name,
|
|
685
|
+
description: action.description,
|
|
686
|
+
descriptorHash: actionDescriptorHash(action),
|
|
687
|
+
risk: action.risk,
|
|
688
|
+
...action.namespace === void 0 ? {} : { namespace: action.namespace },
|
|
689
|
+
...action.effect === void 0 ? {} : { effect: action.effect }
|
|
690
|
+
}));
|
|
691
|
+
return {
|
|
692
|
+
key: `provider:${provider.name}`,
|
|
693
|
+
parentKey: "capability:fabric",
|
|
694
|
+
name: provider.name,
|
|
695
|
+
description: provider.description,
|
|
696
|
+
descriptorHash: descriptorHash({
|
|
697
|
+
name: provider.name,
|
|
698
|
+
description: provider.description,
|
|
699
|
+
actions: actionHeads.map((action) => action.descriptorHash)
|
|
700
|
+
}),
|
|
701
|
+
actions: actionHeads
|
|
702
|
+
};
|
|
703
|
+
});
|
|
704
|
+
const indexedActions = providerHeads.reduce((total, provider) => total + provider.actions.length, 0);
|
|
705
|
+
const rootHash = descriptorHash(providerHeads.map((provider) => provider.descriptorHash));
|
|
706
|
+
return {
|
|
707
|
+
kind: "pi-fabric.capability-catalog",
|
|
708
|
+
version: 1,
|
|
709
|
+
root: {
|
|
710
|
+
key: "capability:fabric",
|
|
711
|
+
name: "Fabric capabilities",
|
|
712
|
+
description: context.capabilityView ? "Committed provider and action metadata for this execution; not historical session evidence." : "Current registered provider and action metadata for navigation; not historical session evidence.",
|
|
713
|
+
descriptorHash: rootHash
|
|
714
|
+
},
|
|
715
|
+
providers: providerHeads,
|
|
716
|
+
totalActions: allActions.length,
|
|
717
|
+
indexedActions,
|
|
718
|
+
complete: indexedActions === allActions.length,
|
|
719
|
+
reasons: indexedActions === allActions.length ? [] : ["action_limit"]
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
async search(query, context, limit = 30) {
|
|
723
|
+
const normalizedQuery = query.normalize("NFKC").trim().toLowerCase();
|
|
724
|
+
if (!normalizedQuery) return [];
|
|
725
|
+
const queryTerms = [...new Set(discoveryTerms(normalizedQuery))];
|
|
726
|
+
const listed = await this.list({ limit: 1e3 }, context);
|
|
727
|
+
return listed.map((action) => {
|
|
728
|
+
const providerDescription = this.#providerBindings.current(action.provider)?.provider.description ?? "";
|
|
729
|
+
const ref = action.ref.normalize("NFKC").toLowerCase();
|
|
730
|
+
const name = action.name.normalize("NFKC").toLowerCase();
|
|
731
|
+
const description = action.description.normalize("NFKC").toLowerCase();
|
|
732
|
+
const provider = action.provider.normalize("NFKC").toLowerCase();
|
|
733
|
+
const providerBody = providerDescription.normalize("NFKC").toLowerCase();
|
|
734
|
+
const namespace = (action.namespace ?? "").normalize("NFKC").toLowerCase();
|
|
735
|
+
const schema = JSON.stringify(action.inputSchema).normalize("NFKC").toLowerCase();
|
|
736
|
+
const tokenSets = {
|
|
737
|
+
ref: new Set(discoveryTerms(ref)),
|
|
738
|
+
name: new Set(discoveryTerms(name)),
|
|
739
|
+
description: new Set(discoveryTerms(description)),
|
|
740
|
+
provider: new Set(discoveryTerms(provider)),
|
|
741
|
+
providerBody: new Set(discoveryTerms(providerBody)),
|
|
742
|
+
namespace: new Set(discoveryTerms(namespace)),
|
|
743
|
+
schema: new Set(discoveryTerms(schema))
|
|
744
|
+
};
|
|
745
|
+
const fields = Object.values(tokenSets);
|
|
746
|
+
let score = 0;
|
|
747
|
+
if (ref === normalizedQuery) score += 1e3;
|
|
748
|
+
if (name === normalizedQuery) score += 800;
|
|
749
|
+
if (ref.startsWith(normalizedQuery)) score += 300;
|
|
750
|
+
else if (ref.includes(normalizedQuery)) score += 120;
|
|
751
|
+
if (description.includes(normalizedQuery)) score += 40;
|
|
752
|
+
if (providerBody.includes(normalizedQuery)) score += 20;
|
|
753
|
+
if (schema.includes(normalizedQuery)) score += 10;
|
|
754
|
+
let matchedTerms = 0;
|
|
755
|
+
for (const term of queryTerms) {
|
|
756
|
+
const matched = fields.some((field) => field.has(term));
|
|
757
|
+
if (!matched) continue;
|
|
758
|
+
matchedTerms += 1;
|
|
759
|
+
if (tokenSets.ref.has(term) || tokenSets.name.has(term)) score += 30;
|
|
760
|
+
if (tokenSets.provider.has(term)) score += 20;
|
|
761
|
+
if (tokenSets.description.has(term)) score += 8;
|
|
762
|
+
if (tokenSets.providerBody.has(term)) score += 4;
|
|
763
|
+
if (tokenSets.namespace.has(term)) score += 6;
|
|
764
|
+
if (tokenSets.schema.has(term)) score += 2;
|
|
765
|
+
}
|
|
766
|
+
if (queryTerms.length > 0 && matchedTerms === queryTerms.length) score += 15;
|
|
767
|
+
return { action, score };
|
|
768
|
+
}).filter((entry) => entry.score > 0).sort(
|
|
769
|
+
(left, right) => right.score - left.score || left.action.ref.localeCompare(right.action.ref)
|
|
770
|
+
).slice(0, Math.max(1, Math.min(limit, 100))).map((entry) => entry.action);
|
|
771
|
+
}
|
|
772
|
+
async describe(ref, context) {
|
|
773
|
+
if (ref.includes(".")) {
|
|
774
|
+
const { provider, actionName, expectedDescriptorHash } = this.#parseRef(
|
|
775
|
+
ref,
|
|
776
|
+
context.capabilityView
|
|
777
|
+
);
|
|
778
|
+
const resolved = await this.#resolveActionDescriptor(
|
|
779
|
+
provider,
|
|
780
|
+
actionName,
|
|
781
|
+
context,
|
|
782
|
+
context.capabilityView === void 0
|
|
783
|
+
);
|
|
784
|
+
if (!resolved.action) {
|
|
785
|
+
throw new FabricResolutionError(formatUnknownActionMessage(ref, resolved.suggestions));
|
|
786
|
+
}
|
|
787
|
+
const action = resolved.action;
|
|
788
|
+
if (expectedDescriptorHash && actionDescriptorHash(action) !== expectedDescriptorHash) {
|
|
789
|
+
throw new FabricResolutionError(`Fabric capability descriptor changed: ${ref}`);
|
|
790
|
+
}
|
|
791
|
+
return action;
|
|
792
|
+
}
|
|
793
|
+
if (context.capabilityView) {
|
|
794
|
+
const pinned = await Promise.all(
|
|
795
|
+
Object.keys(context.capabilityView.bindings).map(
|
|
796
|
+
(candidate) => this.describe(candidate, context)
|
|
797
|
+
)
|
|
798
|
+
);
|
|
799
|
+
const matches2 = pinned.filter((action) => action.name === ref);
|
|
800
|
+
if (matches2.length === 1) return matches2[0];
|
|
801
|
+
if (matches2.length > 1) {
|
|
802
|
+
throw new Error(
|
|
803
|
+
`"${ref}" matches ${matches2.length} committed Fabric actions; qualify with provider.action: ` + matches2.map((match) => match.ref).sort().join(", ")
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
throw new FabricResolutionError(`Unknown Fabric action in committed view: ${ref}`);
|
|
807
|
+
}
|
|
808
|
+
const matches = [];
|
|
809
|
+
const declaredNames = [];
|
|
810
|
+
for (const provider of this.#providerBindings.providers()) {
|
|
811
|
+
let descriptors;
|
|
812
|
+
try {
|
|
813
|
+
descriptors = await provider.list({}, context);
|
|
814
|
+
} catch {
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
for (const descriptor of descriptors) {
|
|
818
|
+
declaredNames.push(descriptor.name);
|
|
819
|
+
if (descriptor.name === ref) matches.push(resolveDescriptor(provider, descriptor));
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
if (matches.length === 1) return matches[0];
|
|
823
|
+
if (matches.length > 1) {
|
|
824
|
+
throw new Error(
|
|
825
|
+
`"${ref}" matches ${matches.length} Fabric actions; qualify with provider.action: ` + matches.map((match) => match.ref).sort().join(", ")
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
const repair = repairActionName(declaredNames, ref);
|
|
829
|
+
throw new FabricResolutionError(formatUnknownActionMessage(ref, repair.suggestions));
|
|
830
|
+
}
|
|
831
|
+
async acquireScoped(ref, args, context) {
|
|
832
|
+
const { binding, provider, actionName, expectedDescriptorHash } = this.#parseRef(
|
|
833
|
+
ref,
|
|
834
|
+
context.capabilityView
|
|
835
|
+
);
|
|
836
|
+
const endInvocation = this.#providerBindings.beginInvocation(binding.id);
|
|
837
|
+
const releaseBinding = this.#providerBindings.retain([binding.id]);
|
|
838
|
+
let retentionTransferred = false;
|
|
839
|
+
try {
|
|
840
|
+
const resolved = await this.#resolveActionDescriptor(
|
|
841
|
+
provider,
|
|
842
|
+
actionName,
|
|
843
|
+
context,
|
|
844
|
+
context.capabilityView === void 0
|
|
845
|
+
);
|
|
846
|
+
if (!resolved.action) {
|
|
847
|
+
throw new FabricResolutionError(formatUnknownActionMessage(ref, resolved.suggestions));
|
|
848
|
+
}
|
|
849
|
+
const action = resolved.action;
|
|
850
|
+
const providerActionName = resolved.repairedFrom === void 0 ? actionName : action.name;
|
|
851
|
+
if (expectedDescriptorHash && actionDescriptorHash(action) !== expectedDescriptorHash) {
|
|
852
|
+
throw new FabricResolutionError(`Fabric capability descriptor changed: ${ref}`);
|
|
853
|
+
}
|
|
854
|
+
if (action.effect?.kind !== "scoped") {
|
|
855
|
+
throw new Error(`Fabric action is not a scoped acquisition: ${ref}`);
|
|
856
|
+
}
|
|
857
|
+
if (!provider.acquire) {
|
|
858
|
+
throw new Error(`Fabric provider does not implement scoped acquisition: ${provider.name}`);
|
|
859
|
+
}
|
|
860
|
+
const effectiveSchema = effectiveInputSchema(
|
|
861
|
+
action.ref,
|
|
862
|
+
action.inputSchema
|
|
863
|
+
);
|
|
864
|
+
const catalogInput = repairCatalogInput(action.ref, effectiveSchema, args);
|
|
865
|
+
const preparedArgs = provider.prepareArguments ? await runAbortable(
|
|
866
|
+
context.signal,
|
|
867
|
+
() => provider.prepareArguments(providerActionName, catalogInput.args, context)
|
|
868
|
+
) : catalogInput.args;
|
|
869
|
+
if (typeof preparedArgs !== "object" || preparedArgs === null || Array.isArray(preparedArgs)) {
|
|
870
|
+
throw new Error(`Argument preparation for ${ref} did not return an object`);
|
|
871
|
+
}
|
|
872
|
+
const catalog = validateCatalogArgs(
|
|
873
|
+
action.ref,
|
|
874
|
+
effectiveSchema,
|
|
875
|
+
preparedArgs,
|
|
876
|
+
catalogInput.observedUnexpected
|
|
877
|
+
);
|
|
878
|
+
if (catalog.invalid) throw new Error(`Invalid arguments for ${ref}: ${catalog.invalid}`);
|
|
879
|
+
const acquired = await runAbortable(
|
|
880
|
+
context.signal,
|
|
881
|
+
() => provider.acquire(providerActionName, catalog.args, context)
|
|
882
|
+
);
|
|
883
|
+
if (!acquired || typeof acquired.dispose !== "function") {
|
|
884
|
+
throw new Error(`Scoped acquisition ${ref} did not return a disposer`);
|
|
885
|
+
}
|
|
886
|
+
let disposal;
|
|
887
|
+
retentionTransferred = true;
|
|
888
|
+
return {
|
|
889
|
+
value: acquired.value,
|
|
890
|
+
dispose: () => {
|
|
891
|
+
disposal ??= (async () => {
|
|
892
|
+
try {
|
|
893
|
+
await acquired.dispose();
|
|
894
|
+
} finally {
|
|
895
|
+
await releaseBinding();
|
|
896
|
+
}
|
|
897
|
+
})();
|
|
898
|
+
return disposal;
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
} finally {
|
|
902
|
+
await endInvocation().catch(() => void 0);
|
|
903
|
+
if (!retentionTransferred) await releaseBinding().catch(() => void 0);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
async invoke(ref, args, context) {
|
|
907
|
+
const traceOperation = context.traceOperation ?? context.trace?.issueCall(ref, args);
|
|
908
|
+
let failureStage = "resolve";
|
|
909
|
+
let audit;
|
|
910
|
+
let invocationActive = false;
|
|
911
|
+
let endBindingInvocation;
|
|
912
|
+
try {
|
|
913
|
+
const { binding, provider, actionName, expectedDescriptorHash } = this.#parseRef(
|
|
914
|
+
ref,
|
|
915
|
+
context.capabilityView
|
|
916
|
+
);
|
|
917
|
+
endBindingInvocation = this.#providerBindings.beginInvocation(binding.id);
|
|
918
|
+
const resolved = await this.#resolveActionDescriptor(
|
|
919
|
+
provider,
|
|
920
|
+
actionName,
|
|
921
|
+
context,
|
|
922
|
+
context.capabilityView === void 0
|
|
923
|
+
);
|
|
924
|
+
if (!resolved.action) {
|
|
925
|
+
throw new FabricResolutionError(formatUnknownActionMessage(ref, resolved.suggestions));
|
|
926
|
+
}
|
|
927
|
+
const action = resolved.action;
|
|
928
|
+
const providerActionName = resolved.repairedFrom === void 0 ? actionName : action.name;
|
|
929
|
+
if (expectedDescriptorHash && actionDescriptorHash(action) !== expectedDescriptorHash) {
|
|
930
|
+
throw new FabricResolutionError(`Fabric capability descriptor changed: ${ref}`);
|
|
931
|
+
}
|
|
932
|
+
traceOperation?.resolved(action.provider, action.name);
|
|
933
|
+
failureStage = "guard";
|
|
934
|
+
if (action.effect?.kind === "scoped") {
|
|
935
|
+
throw new FabricTraceSafeError(
|
|
936
|
+
`Fabric scoped action ${ref} requires a supervised acquisition context`
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
if (context.authorize) {
|
|
940
|
+
await runAbortable(context.signal, () => context.authorize(action));
|
|
941
|
+
}
|
|
942
|
+
failureStage = "prepare";
|
|
943
|
+
const effectiveSchema = effectiveInputSchema(
|
|
944
|
+
action.ref,
|
|
945
|
+
action.inputSchema
|
|
946
|
+
);
|
|
947
|
+
const catalogInput = repairCatalogInput(action.ref, effectiveSchema, args);
|
|
948
|
+
const preparedArgs = provider.prepareArguments ? await runAbortable(
|
|
949
|
+
context.signal,
|
|
950
|
+
() => provider.prepareArguments(providerActionName, catalogInput.args, context)
|
|
951
|
+
) : catalogInput.args;
|
|
952
|
+
if (typeof preparedArgs !== "object" || preparedArgs === null || Array.isArray(preparedArgs)) {
|
|
953
|
+
throw new FabricTraceSafeError(`Argument preparation for ${ref} did not return an object`);
|
|
954
|
+
}
|
|
955
|
+
failureStage = "validate";
|
|
956
|
+
const catalog = validateCatalogArgs(
|
|
957
|
+
action.ref,
|
|
958
|
+
effectiveSchema,
|
|
959
|
+
preparedArgs,
|
|
960
|
+
catalogInput.observedUnexpected
|
|
961
|
+
);
|
|
962
|
+
traceOperation?.prepared(catalog.args);
|
|
963
|
+
if (catalog.normalization) traceOperation?.normalized(catalog.normalization);
|
|
964
|
+
if (catalog.invalid) {
|
|
965
|
+
const declaredSchema = action.inputSchema;
|
|
966
|
+
const declaredProperties = typeof declaredSchema === "object" && declaredSchema !== null && !Array.isArray(declaredSchema) && typeof declaredSchema.properties === "object" && declaredSchema.properties !== null ? declaredSchema.properties : void 0;
|
|
967
|
+
const attemptArgs = {};
|
|
968
|
+
for (const [key, value2] of Object.entries(catalog.args)) {
|
|
969
|
+
const property = declaredProperties ? declaredProperties[key] : void 0;
|
|
970
|
+
const declaredEnum = typeof property === "object" && property !== null ? property.enum : void 0;
|
|
971
|
+
if (!Array.isArray(declaredEnum)) continue;
|
|
972
|
+
if (typeof value2 !== "string" && typeof value2 !== "number" && typeof value2 !== "boolean") {
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
975
|
+
if (String(value2).length > MAX_AUDIT_VALUE_CHARS) continue;
|
|
976
|
+
if (!declaredEnum.includes(value2)) continue;
|
|
977
|
+
attemptArgs[key] = value2;
|
|
978
|
+
}
|
|
979
|
+
if (Object.keys(attemptArgs).length > 0) {
|
|
980
|
+
const attempt = {
|
|
981
|
+
ref,
|
|
982
|
+
nestedToolCallId: `${NESTED_TOOL_CALL_ID_PREFIX}${randomUUID2()}`,
|
|
983
|
+
startedAt: Date.now(),
|
|
984
|
+
tool: action.name,
|
|
985
|
+
provider: action.provider,
|
|
986
|
+
args: attemptArgs,
|
|
987
|
+
success: false,
|
|
988
|
+
error: `Invalid arguments for ${ref}: ${catalog.invalid}`,
|
|
989
|
+
endedAt: Date.now(),
|
|
990
|
+
...resolved.repairedFrom !== void 0 ? { repairedFrom: resolved.repairedFrom } : {}
|
|
991
|
+
};
|
|
992
|
+
context.audits.push(attempt);
|
|
993
|
+
}
|
|
994
|
+
throw new FabricTraceSafeError(`Invalid arguments for ${ref}: ${catalog.invalid}`);
|
|
995
|
+
}
|
|
996
|
+
failureStage = "approve";
|
|
997
|
+
await runAbortable(context.signal, () => context.approve(action, catalog.args));
|
|
998
|
+
failureStage = "invoke";
|
|
999
|
+
const nestedToolCallId = `${NESTED_TOOL_CALL_ID_PREFIX}${randomUUID2()}`;
|
|
1000
|
+
const effect = action.effect;
|
|
1001
|
+
const effectConflicts = [...this.#activeEffects.values()].flatMap((active) => {
|
|
1002
|
+
const conflict = conflictBetween(effect, active.effect);
|
|
1003
|
+
return conflict ? [{ withRef: active.ref, ...conflict }] : [];
|
|
1004
|
+
}).slice(0, 32);
|
|
1005
|
+
if (effectConflicts.length > 0 && context.effectPolicy === "strict") {
|
|
1006
|
+
failureStage = "guard";
|
|
1007
|
+
throw new FabricTraceSafeError(
|
|
1008
|
+
`Fabric effect conflict for ${ref}: ${effectConflicts.map((conflict) => formatFabricEffectConflict(
|
|
1009
|
+
conflict.withRef,
|
|
1010
|
+
conflict.resources,
|
|
1011
|
+
conflict.reason
|
|
1012
|
+
)).join("; ")}`
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
const argsPreview = previewArgs(ref, catalog.args);
|
|
1016
|
+
const activeAudit = {
|
|
1017
|
+
ref,
|
|
1018
|
+
nestedToolCallId,
|
|
1019
|
+
startedAt: Date.now(),
|
|
1020
|
+
tool: action.name,
|
|
1021
|
+
provider: action.provider,
|
|
1022
|
+
args: boundedPreviewValue(
|
|
1023
|
+
argsPreview,
|
|
1024
|
+
MAX_AUDIT_VALUE_CHARS
|
|
1025
|
+
),
|
|
1026
|
+
...effectConflicts.length > 0 ? { effectConflicts } : {},
|
|
1027
|
+
...resolved.repairedFrom !== void 0 ? { repairedFrom: resolved.repairedFrom } : {}
|
|
1028
|
+
};
|
|
1029
|
+
audit = activeAudit;
|
|
1030
|
+
invocationActive = true;
|
|
1031
|
+
context.audits.push(activeAudit);
|
|
1032
|
+
context.observeInvocation?.({
|
|
1033
|
+
type: "call_start",
|
|
1034
|
+
callId: nestedToolCallId,
|
|
1035
|
+
ref,
|
|
1036
|
+
args: argsPreview
|
|
1037
|
+
});
|
|
1038
|
+
context.update(`Calling ${ref}`);
|
|
1039
|
+
this.#activeEffects.set(nestedToolCallId, { ref, effect });
|
|
1040
|
+
let servedFromSpeculation = false;
|
|
1041
|
+
let providerValue;
|
|
1042
|
+
if (this.#speculation && effect.kind === "none") {
|
|
1043
|
+
const served = await runAbortable(context.signal, () => this.#speculation.tryServe(context.parentToolCallId, ref, catalog.args, binding.id));
|
|
1044
|
+
if (served.hit) {
|
|
1045
|
+
servedFromSpeculation = true;
|
|
1046
|
+
activeAudit.speculated = true;
|
|
1047
|
+
providerValue = served.value;
|
|
1048
|
+
if (served.replay.updatedArgs !== void 0) {
|
|
1049
|
+
const replayedPreview = previewArgs(ref, served.replay.updatedArgs);
|
|
1050
|
+
activeAudit.args = boundedPreviewValue(
|
|
1051
|
+
replayedPreview,
|
|
1052
|
+
MAX_AUDIT_VALUE_CHARS
|
|
1053
|
+
);
|
|
1054
|
+
traceOperation?.prepared(served.replay.updatedArgs);
|
|
1055
|
+
context.observeInvocation?.({
|
|
1056
|
+
type: "call_args",
|
|
1057
|
+
callId: nestedToolCallId,
|
|
1058
|
+
args: replayedPreview
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
if (served.replay.media?.length) {
|
|
1062
|
+
activeAudit.media = [...activeAudit.media ?? [], ...served.replay.media];
|
|
1063
|
+
if (served.replay.mediaNote) activeAudit.mediaNote = served.replay.mediaNote;
|
|
1064
|
+
}
|
|
1065
|
+
if (served.replay.preview !== void 0) activeAudit.preview = served.replay.preview;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
let providerInvoked = false;
|
|
1069
|
+
try {
|
|
1070
|
+
if (!servedFromSpeculation) {
|
|
1071
|
+
providerInvoked = true;
|
|
1072
|
+
providerValue = await runAbortable(
|
|
1073
|
+
context.signal,
|
|
1074
|
+
() => provider.invoke(providerActionName, catalog.args, {
|
|
1075
|
+
...context,
|
|
1076
|
+
nestedToolCallId,
|
|
1077
|
+
update(message) {
|
|
1078
|
+
if (!invocationActive) return;
|
|
1079
|
+
context.update(message);
|
|
1080
|
+
context.observeInvocation?.({
|
|
1081
|
+
type: "call_update",
|
|
1082
|
+
callId: nestedToolCallId,
|
|
1083
|
+
update: { type: "progress", message }
|
|
1084
|
+
});
|
|
1085
|
+
},
|
|
1086
|
+
activity(update) {
|
|
1087
|
+
if (!invocationActive) return;
|
|
1088
|
+
context.activity?.(update);
|
|
1089
|
+
context.observeInvocation?.({
|
|
1090
|
+
type: "call_update",
|
|
1091
|
+
callId: nestedToolCallId,
|
|
1092
|
+
update
|
|
1093
|
+
});
|
|
1094
|
+
},
|
|
1095
|
+
attachMedia(blocks, note) {
|
|
1096
|
+
if (!invocationActive) return;
|
|
1097
|
+
if (!activeAudit.media) activeAudit.media = [];
|
|
1098
|
+
for (const block of blocks) activeAudit.media.push(block);
|
|
1099
|
+
if (note) activeAudit.mediaNote = note;
|
|
1100
|
+
},
|
|
1101
|
+
updateArguments(updatedArgs) {
|
|
1102
|
+
if (!invocationActive) return;
|
|
1103
|
+
const updatedPreview = previewArgs(ref, updatedArgs);
|
|
1104
|
+
activeAudit.args = boundedPreviewValue(
|
|
1105
|
+
updatedPreview,
|
|
1106
|
+
MAX_AUDIT_VALUE_CHARS
|
|
1107
|
+
);
|
|
1108
|
+
traceOperation?.prepared(updatedArgs);
|
|
1109
|
+
context.observeInvocation?.({
|
|
1110
|
+
type: "call_args",
|
|
1111
|
+
callId: nestedToolCallId,
|
|
1112
|
+
args: updatedPreview
|
|
1113
|
+
});
|
|
1114
|
+
},
|
|
1115
|
+
attachPreview(preview) {
|
|
1116
|
+
if (!invocationActive) return;
|
|
1117
|
+
activeAudit.preview = preview;
|
|
1118
|
+
}
|
|
1119
|
+
})
|
|
1120
|
+
);
|
|
1121
|
+
}
|
|
1122
|
+
} finally {
|
|
1123
|
+
if (providerInvoked && effect.kind !== "none") this.#speculation?.bumpEpoch();
|
|
1124
|
+
this.#activeEffects.delete(nestedToolCallId);
|
|
1125
|
+
}
|
|
1126
|
+
const value = this.toolResultProxy ? await runAbortable(context.signal, () => this.toolResultProxy.proxy({
|
|
1127
|
+
action,
|
|
1128
|
+
args: catalog.args,
|
|
1129
|
+
toolCallId: nestedToolCallId,
|
|
1130
|
+
value: providerValue,
|
|
1131
|
+
...context.signal ? { signal: context.signal } : {}
|
|
1132
|
+
})) : providerValue;
|
|
1133
|
+
const bounded = boundedResult(value, context.maxResultChars);
|
|
1134
|
+
const resultError = failedResultError(value);
|
|
1135
|
+
activeAudit.success = resultError === void 0;
|
|
1136
|
+
if (resultError) activeAudit.error = resultError;
|
|
1137
|
+
activeAudit.resultChars = bounded.chars;
|
|
1138
|
+
activeAudit.resultTruncated = bounded.truncated;
|
|
1139
|
+
const resultPreview = previewResult(bounded.value);
|
|
1140
|
+
activeAudit.result = boundedPreviewValue(resultPreview, MAX_AUDIT_VALUE_CHARS);
|
|
1141
|
+
activeAudit.endedAt = Date.now();
|
|
1142
|
+
context.observeInvocation?.({
|
|
1143
|
+
type: "call_end",
|
|
1144
|
+
callId: nestedToolCallId,
|
|
1145
|
+
success: resultError === void 0,
|
|
1146
|
+
result: resultPreview,
|
|
1147
|
+
...activeAudit.preview !== void 0 ? { preview: activeAudit.preview } : {},
|
|
1148
|
+
...resultError ? { error: resultError } : {}
|
|
1149
|
+
});
|
|
1150
|
+
if (resultError) {
|
|
1151
|
+
traceOperation?.fail("invoke", resultError, failedResultOutcome(value), bounded.value, {
|
|
1152
|
+
resultTruncated: bounded.truncated
|
|
1153
|
+
});
|
|
1154
|
+
} else {
|
|
1155
|
+
traceOperation?.succeed(bounded.value, { resultTruncated: bounded.truncated });
|
|
1156
|
+
}
|
|
1157
|
+
return bounded.value;
|
|
1158
|
+
} catch (error) {
|
|
1159
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1160
|
+
traceOperation?.fail(failureStage, error, executionOutcomeFromError(error, context.signal));
|
|
1161
|
+
if (audit) {
|
|
1162
|
+
audit.success = false;
|
|
1163
|
+
audit.error = message;
|
|
1164
|
+
audit.endedAt = Date.now();
|
|
1165
|
+
context.observeInvocation?.({
|
|
1166
|
+
type: "call_end",
|
|
1167
|
+
callId: audit.nestedToolCallId,
|
|
1168
|
+
success: false,
|
|
1169
|
+
error: audit.error
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
throw error;
|
|
1173
|
+
} finally {
|
|
1174
|
+
invocationActive = false;
|
|
1175
|
+
if (audit) audit.endedAt ??= Date.now();
|
|
1176
|
+
await endBindingInvocation?.().catch(() => void 0);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Prepare + pre-launch a speculative call discovered in a partially
|
|
1181
|
+
* streamed program (see src/speculation). Pure pipeline only: descriptor
|
|
1182
|
+
* resolution, the eligibility gate on the resolved action, argument
|
|
1183
|
+
* preparation, and schema validation. The compiled entropy surface gates
|
|
1184
|
+
* launches too: quarantined refs never pre-launch and overlays validate
|
|
1185
|
+
* prepared arguments, so the store never warms a call the serve path
|
|
1186
|
+
* would reject. authorize/approve/audits are skipped
|
|
1187
|
+
* because the eligibility gate restricts this path to actions that never
|
|
1188
|
+
* prompt, and the real call re-runs the full pipeline on a serve miss.
|
|
1189
|
+
* Side-channel outputs are captured into `replay` so the serve path can
|
|
1190
|
+
* project them into the real audit.
|
|
1191
|
+
*/
|
|
1192
|
+
async speculate(ref, args, context, replay) {
|
|
1193
|
+
if (!this.#speculationEligibility) return void 0;
|
|
1194
|
+
try {
|
|
1195
|
+
const { binding, provider, actionName, expectedDescriptorHash } = this.#parseRef(
|
|
1196
|
+
ref,
|
|
1197
|
+
context.capabilityView
|
|
1198
|
+
);
|
|
1199
|
+
const descriptor = await runAbortable(context.signal, () => provider.describe(actionName, context));
|
|
1200
|
+
if (!descriptor) return void 0;
|
|
1201
|
+
const action = resolveDescriptor(provider, descriptor);
|
|
1202
|
+
if (expectedDescriptorHash && actionDescriptorHash(action) !== expectedDescriptorHash) {
|
|
1203
|
+
return void 0;
|
|
1204
|
+
}
|
|
1205
|
+
if (isActiveQuarantine(provider.name, actionName, descriptor.inputSchema)) {
|
|
1206
|
+
return void 0;
|
|
1207
|
+
}
|
|
1208
|
+
if (!this.#speculationEligibility(action)) return void 0;
|
|
1209
|
+
const effectiveSchema = effectiveInputSchema(
|
|
1210
|
+
action.ref,
|
|
1211
|
+
action.inputSchema
|
|
1212
|
+
);
|
|
1213
|
+
const catalogInput = applyActiveArgRepairs(action.ref, args, effectiveSchema);
|
|
1214
|
+
const preparedArgs = provider.prepareArguments ? await runAbortable(context.signal, () => provider.prepareArguments(actionName, catalogInput, context)) : catalogInput;
|
|
1215
|
+
if (typeof preparedArgs !== "object" || preparedArgs === null || Array.isArray(preparedArgs)) {
|
|
1216
|
+
return void 0;
|
|
1217
|
+
}
|
|
1218
|
+
const repairedArgs = normalizeActiveArguments(
|
|
1219
|
+
action.ref,
|
|
1220
|
+
effectiveSchema,
|
|
1221
|
+
applyActiveArgRepairs(action.ref, preparedArgs, effectiveSchema)
|
|
1222
|
+
).args;
|
|
1223
|
+
if (validationMessage(effectiveSchema, repairedArgs)) return void 0;
|
|
1224
|
+
const nestedToolCallId = `${NESTED_TOOL_CALL_ID_PREFIX}spec-${randomUUID2()}`;
|
|
1225
|
+
return {
|
|
1226
|
+
preparedArgs: repairedArgs,
|
|
1227
|
+
bindingToken: binding.id,
|
|
1228
|
+
execute: async (signal) => {
|
|
1229
|
+
const endBindingInvocation = this.#providerBindings.beginInvocation(binding.id);
|
|
1230
|
+
try {
|
|
1231
|
+
return await runAbortable(
|
|
1232
|
+
signal,
|
|
1233
|
+
() => provider.invoke(actionName, repairedArgs, {
|
|
1234
|
+
...context,
|
|
1235
|
+
signal,
|
|
1236
|
+
nestedToolCallId,
|
|
1237
|
+
update() {
|
|
1238
|
+
},
|
|
1239
|
+
activity() {
|
|
1240
|
+
},
|
|
1241
|
+
attachMedia(blocks, note) {
|
|
1242
|
+
replay.media = [...replay.media ?? [], ...blocks];
|
|
1243
|
+
if (note) replay.mediaNote = note;
|
|
1244
|
+
},
|
|
1245
|
+
updateArguments(updatedArgs) {
|
|
1246
|
+
replay.updatedArgs = updatedArgs;
|
|
1247
|
+
},
|
|
1248
|
+
attachPreview(preview) {
|
|
1249
|
+
replay.preview = preview;
|
|
1250
|
+
}
|
|
1251
|
+
})
|
|
1252
|
+
);
|
|
1253
|
+
} finally {
|
|
1254
|
+
await endBindingInvocation().catch(() => void 0);
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
} catch {
|
|
1259
|
+
return void 0;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
async endInvocation(parentToolCallId, timeoutMs = 1e3) {
|
|
1263
|
+
this.#speculation?.onInvocationEnd?.(parentToolCallId);
|
|
1264
|
+
const providers = new Set(
|
|
1265
|
+
this.#providerBindings.entries().map((binding) => binding.provider)
|
|
1266
|
+
);
|
|
1267
|
+
const finalizers = [...providers].flatMap(
|
|
1268
|
+
(provider) => provider.invocationEnded ? [Promise.resolve().then(() => provider.invocationEnded(parentToolCallId))] : []
|
|
1269
|
+
);
|
|
1270
|
+
await settleWithin(finalizers, timeoutMs);
|
|
1271
|
+
}
|
|
1272
|
+
async close(excludedProviderNames = /* @__PURE__ */ new Set()) {
|
|
1273
|
+
await this.#providerBindings.close(excludedProviderNames);
|
|
1274
|
+
}
|
|
1275
|
+
async #resolveCapabilities(requirements, context, retain) {
|
|
1276
|
+
const normalized = /* @__PURE__ */ new Map();
|
|
1277
|
+
for (const requirement of requirements) {
|
|
1278
|
+
const ref = (typeof requirement === "string" ? requirement : requirement.ref).trim();
|
|
1279
|
+
if (!ref || ref.length > 256 || !ref.includes(".")) {
|
|
1280
|
+
throw new Error(`Fabric capability requirements must use provider.action: ${ref || "<empty>"}`);
|
|
1281
|
+
}
|
|
1282
|
+
const optional = typeof requirement === "string" ? false : requirement.optional === true;
|
|
1283
|
+
normalized.set(ref, (normalized.get(ref) ?? true) && optional);
|
|
1284
|
+
}
|
|
1285
|
+
const missing = [];
|
|
1286
|
+
const optionalMissing = [];
|
|
1287
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
1288
|
+
const temporaryReleases = [];
|
|
1289
|
+
let permanentRelease;
|
|
1290
|
+
try {
|
|
1291
|
+
for (const [ref, optional] of [...normalized].sort(
|
|
1292
|
+
([left], [right]) => left.localeCompare(right)
|
|
1293
|
+
)) {
|
|
1294
|
+
try {
|
|
1295
|
+
const { binding, provider, actionName } = this.#parseRef(ref);
|
|
1296
|
+
const release = this.#providerBindings.retain([binding.id]);
|
|
1297
|
+
temporaryReleases.push(release);
|
|
1298
|
+
const descriptor = await runAbortable(
|
|
1299
|
+
context.signal,
|
|
1300
|
+
() => provider.describe(actionName, context)
|
|
1301
|
+
);
|
|
1302
|
+
if (!descriptor) throw new FabricResolutionError(`Unknown Fabric action: ${ref}`);
|
|
1303
|
+
const action = resolveDescriptor(provider, descriptor);
|
|
1304
|
+
resolved.set(ref, {
|
|
1305
|
+
ref,
|
|
1306
|
+
provider: provider.name,
|
|
1307
|
+
providerBindingId: binding.id,
|
|
1308
|
+
generation: binding.generation,
|
|
1309
|
+
descriptorHash: actionDescriptorHash(action)
|
|
1310
|
+
});
|
|
1311
|
+
} catch (error) {
|
|
1312
|
+
if (!(error instanceof FabricResolutionError)) throw error;
|
|
1313
|
+
(optional ? optionalMissing : missing).push(ref);
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
let view;
|
|
1317
|
+
if (missing.length === 0) {
|
|
1318
|
+
const bindings = Object.fromEntries(resolved);
|
|
1319
|
+
const values = [...resolved.values()];
|
|
1320
|
+
if (retain) permanentRelease = this.#providerBindings.retain(
|
|
1321
|
+
values.map((binding) => binding.providerBindingId)
|
|
1322
|
+
);
|
|
1323
|
+
view = {
|
|
1324
|
+
id: randomUUID2(),
|
|
1325
|
+
digest: descriptorHash(values),
|
|
1326
|
+
semanticDigest: descriptorHash(
|
|
1327
|
+
values.map(({ ref, provider, descriptorHash: hash }) => ({
|
|
1328
|
+
ref,
|
|
1329
|
+
provider,
|
|
1330
|
+
descriptorHash: hash
|
|
1331
|
+
}))
|
|
1332
|
+
),
|
|
1333
|
+
bindings
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
return {
|
|
1337
|
+
satisfied: missing.length === 0,
|
|
1338
|
+
missing,
|
|
1339
|
+
optionalMissing,
|
|
1340
|
+
...view ? { view } : {},
|
|
1341
|
+
release: async () => {
|
|
1342
|
+
const release = permanentRelease;
|
|
1343
|
+
permanentRelease = void 0;
|
|
1344
|
+
await release?.();
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
} finally {
|
|
1348
|
+
await Promise.allSettled(temporaryReleases.map((release) => release()));
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
async #declaredActionNames(provider, context) {
|
|
1352
|
+
try {
|
|
1353
|
+
const descriptors = await runAbortable(context.signal, () => provider.list({}, context));
|
|
1354
|
+
return descriptors.map((descriptor) => descriptor.name);
|
|
1355
|
+
} catch {
|
|
1356
|
+
return [];
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
// Resolve a provider action descriptor, repairing a near-miss action name
|
|
1360
|
+
// (mirroring arg-normalization's prepare-stage argument repair) when the
|
|
1361
|
+
// caller is not pinned to a committed capability view. Committed views are
|
|
1362
|
+
// exact contracts: a pinned miss keeps the plain resolution error.
|
|
1363
|
+
async #resolveActionDescriptor(provider, actionName, context, allowRepair) {
|
|
1364
|
+
const descriptor = await runAbortable(
|
|
1365
|
+
context.signal,
|
|
1366
|
+
() => provider.describe(actionName, context)
|
|
1367
|
+
);
|
|
1368
|
+
if (descriptor && !isActiveQuarantine(provider.name, actionName, descriptor.inputSchema)) {
|
|
1369
|
+
return {
|
|
1370
|
+
action: resolveDescriptor(provider, descriptor),
|
|
1371
|
+
suggestions: []
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
if (!allowRepair) return { suggestions: [] };
|
|
1375
|
+
const declared = (await this.#declaredActionNames(provider, context)).filter(
|
|
1376
|
+
(name) => !activeQuarantinedRefNames().has(`${provider.name}.${name}`)
|
|
1377
|
+
);
|
|
1378
|
+
const catalogName = applyActiveActionName(provider.name, actionName, declared);
|
|
1379
|
+
if (catalogName !== actionName) {
|
|
1380
|
+
const catalogDescriptor = await runAbortable(
|
|
1381
|
+
context.signal,
|
|
1382
|
+
() => provider.describe(catalogName, context)
|
|
1383
|
+
);
|
|
1384
|
+
if (catalogDescriptor) {
|
|
1385
|
+
return {
|
|
1386
|
+
action: resolveDescriptor(provider, catalogDescriptor),
|
|
1387
|
+
suggestions: [],
|
|
1388
|
+
repairedFrom: actionName
|
|
1389
|
+
};
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
const repair = repairActionName(declared, actionName);
|
|
1393
|
+
const compiler = getActiveRepairCompiler();
|
|
1394
|
+
if (repair.repaired !== void 0) {
|
|
1395
|
+
compiler?.observeUnknownAction(provider.name, actionName, declared, {
|
|
1396
|
+
countError: false
|
|
1397
|
+
});
|
|
1398
|
+
const repairedDescriptor = await runAbortable(
|
|
1399
|
+
context.signal,
|
|
1400
|
+
() => provider.describe(repair.repaired, context)
|
|
1401
|
+
);
|
|
1402
|
+
if (repairedDescriptor) {
|
|
1403
|
+
return {
|
|
1404
|
+
action: resolveDescriptor(provider, repairedDescriptor),
|
|
1405
|
+
suggestions: [],
|
|
1406
|
+
repairedFrom: actionName
|
|
1407
|
+
};
|
|
1408
|
+
}
|
|
1409
|
+
compiler?.recordInvocationError();
|
|
1410
|
+
} else {
|
|
1411
|
+
compiler?.observeUnknownAction(provider.name, actionName, declared);
|
|
1412
|
+
}
|
|
1413
|
+
return {
|
|
1414
|
+
suggestions: repair.suggestions.map((name) => `${provider.name}.${name}`)
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1417
|
+
#parseRef(ref, view) {
|
|
1418
|
+
const separator = ref.indexOf(".");
|
|
1419
|
+
if (separator <= 0 || separator === ref.length - 1) {
|
|
1420
|
+
throw new Error(`Fabric action references must use provider.action: ${ref}`);
|
|
1421
|
+
}
|
|
1422
|
+
const providerName = ref.slice(0, separator);
|
|
1423
|
+
const pinned = view?.bindings[ref];
|
|
1424
|
+
if (view && !pinned) {
|
|
1425
|
+
throw new FabricResolutionError(`Fabric capability is outside the committed view: ${ref}`);
|
|
1426
|
+
}
|
|
1427
|
+
const binding = pinned ? this.#providerBindings.binding(pinned.providerBindingId) : this.#providerBindings.current(providerName);
|
|
1428
|
+
if (!binding || binding.name !== providerName) {
|
|
1429
|
+
if (pinned) {
|
|
1430
|
+
throw new FabricResolutionError(
|
|
1431
|
+
`Fabric capability binding is no longer available: ${ref} (${pinned.providerBindingId})`
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
this.#requireProvider(providerName);
|
|
1435
|
+
throw new FabricResolutionError(`Unknown Fabric provider: ${providerName}`);
|
|
1436
|
+
}
|
|
1437
|
+
return {
|
|
1438
|
+
binding,
|
|
1439
|
+
provider: binding.provider,
|
|
1440
|
+
actionName: ref.slice(separator + 1),
|
|
1441
|
+
...pinned ? { expectedDescriptorHash: pinned.descriptorHash } : {}
|
|
1442
|
+
};
|
|
1443
|
+
}
|
|
1444
|
+
#requireProvider(name) {
|
|
1445
|
+
const provider = this.#providerBindings.current(name)?.provider;
|
|
1446
|
+
if (provider) return provider;
|
|
1447
|
+
const unavailableReason = this.#unavailable.get(name);
|
|
1448
|
+
if (unavailableReason) {
|
|
1449
|
+
throw new FabricResolutionError(
|
|
1450
|
+
`Fabric provider "${name}" is unavailable: ${unavailableReason}`
|
|
1451
|
+
);
|
|
1452
|
+
}
|
|
1453
|
+
const registered = this.#providerBindings.providers().map((provider2) => provider2.name).sort((left, right) => left.localeCompare(right));
|
|
1454
|
+
throw new FabricResolutionError(
|
|
1455
|
+
`Unknown Fabric provider: ${name}` + (registered.length > 0 ? ` (registered providers: ${registered.join(", ")})` : "")
|
|
1456
|
+
);
|
|
1457
|
+
}
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1460
|
+
export {
|
|
1461
|
+
repairActionName,
|
|
1462
|
+
fabricActionListLimit,
|
|
1463
|
+
NESTED_TOOL_CALL_ID_PREFIX,
|
|
1464
|
+
ActionRegistry
|
|
1465
|
+
};
|
|
1466
|
+
//# sourceMappingURL=chunk-CPSW2GW4.js.map
|