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