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,1318 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OMP_GUEST_ENTRYPOINT,
|
|
3
|
+
transpileFabricCodeWithSourceMap
|
|
4
|
+
} from "./chunk-JHKOG5GS.js";
|
|
5
|
+
import {
|
|
6
|
+
ompBashExitMetadata
|
|
7
|
+
} from "./chunk-6X6WUU2K.js";
|
|
8
|
+
import {
|
|
9
|
+
runAbortable,
|
|
10
|
+
settleWithin
|
|
11
|
+
} from "./chunk-7TB7NXSL.js";
|
|
12
|
+
|
|
13
|
+
// src/runtime/quickjs-runtime.ts
|
|
14
|
+
import releaseSyncVariant from "@jitl/quickjs-singlefile-mjs-release-sync";
|
|
15
|
+
import { newQuickJSWASMModuleFromVariant } from "quickjs-emscripten-core";
|
|
16
|
+
import ts from "typescript";
|
|
17
|
+
|
|
18
|
+
// src/runtime/guest-stack-map.ts
|
|
19
|
+
var BASE64_VALUES = (() => {
|
|
20
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
21
|
+
const table = /* @__PURE__ */ new Map();
|
|
22
|
+
for (let index = 0; index < alphabet.length; index += 1) {
|
|
23
|
+
table.set(alphabet[index], index);
|
|
24
|
+
}
|
|
25
|
+
return table;
|
|
26
|
+
})();
|
|
27
|
+
var decodeVlqSegment = (segment) => {
|
|
28
|
+
const values = [];
|
|
29
|
+
let index = 0;
|
|
30
|
+
while (index < segment.length) {
|
|
31
|
+
let value = 0;
|
|
32
|
+
let shift = 0;
|
|
33
|
+
let continuation = true;
|
|
34
|
+
while (continuation) {
|
|
35
|
+
const digit = BASE64_VALUES.get(segment[index]);
|
|
36
|
+
if (digit === void 0) return values;
|
|
37
|
+
index += 1;
|
|
38
|
+
continuation = (digit & 32) !== 0;
|
|
39
|
+
value += (digit & 31) * 2 ** shift;
|
|
40
|
+
shift += 5;
|
|
41
|
+
}
|
|
42
|
+
values.push((value & 1) === 1 ? -(value >> 1) : value >> 1);
|
|
43
|
+
}
|
|
44
|
+
return values;
|
|
45
|
+
};
|
|
46
|
+
var decodeMappings = (mappings) => {
|
|
47
|
+
const lines = [];
|
|
48
|
+
let sourceLine = 0;
|
|
49
|
+
let sourceColumn = 0;
|
|
50
|
+
for (const line of mappings.split(";")) {
|
|
51
|
+
const segments = [];
|
|
52
|
+
let generatedColumn = 0;
|
|
53
|
+
for (const rawSegment of line.split(",")) {
|
|
54
|
+
if (!rawSegment) continue;
|
|
55
|
+
const values = decodeVlqSegment(rawSegment);
|
|
56
|
+
if (values.length < 4) continue;
|
|
57
|
+
generatedColumn += values[0];
|
|
58
|
+
sourceLine += values[2];
|
|
59
|
+
sourceColumn += values[3];
|
|
60
|
+
segments.push({ generatedColumn, sourceLine, sourceColumn });
|
|
61
|
+
}
|
|
62
|
+
lines.push(segments);
|
|
63
|
+
}
|
|
64
|
+
return lines;
|
|
65
|
+
};
|
|
66
|
+
var createGuestStackMap = (sourceMapText) => {
|
|
67
|
+
if (!sourceMapText) return void 0;
|
|
68
|
+
let mappings;
|
|
69
|
+
try {
|
|
70
|
+
const parsed = JSON.parse(sourceMapText);
|
|
71
|
+
if (typeof parsed.mappings !== "string") return void 0;
|
|
72
|
+
mappings = parsed.mappings;
|
|
73
|
+
} catch {
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
let decoded;
|
|
77
|
+
return {
|
|
78
|
+
lookup(line, column) {
|
|
79
|
+
decoded ??= decodeMappings(mappings);
|
|
80
|
+
const segments = decoded[line - 1];
|
|
81
|
+
if (!segments) return void 0;
|
|
82
|
+
const target = column - 1;
|
|
83
|
+
let best;
|
|
84
|
+
for (const segment of segments) {
|
|
85
|
+
if (segment.generatedColumn > target) break;
|
|
86
|
+
best = segment;
|
|
87
|
+
}
|
|
88
|
+
best ??= segments[0];
|
|
89
|
+
if (!best) return void 0;
|
|
90
|
+
return { line: best.sourceLine, column: best.sourceColumn + 1 };
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
var GUEST_FRAME_PATTERN = /omp-fabric-guest\.js:(\d+):(\d+)/g;
|
|
95
|
+
var remapGuestErrorText = (text, stackMap, guestLineCount) => {
|
|
96
|
+
if (!stackMap || !text.includes("omp-fabric-guest.js:")) return text;
|
|
97
|
+
return text.replace(GUEST_FRAME_PATTERN, (match, lineText, columnText) => {
|
|
98
|
+
const line = Number(lineText);
|
|
99
|
+
const mapped = stackMap.lookup(line, Number(columnText));
|
|
100
|
+
if (mapped) return `guest code:${mapped.line}:${mapped.column}`;
|
|
101
|
+
if (guestLineCount !== void 0 && line > guestLineCount) return "fabric driver";
|
|
102
|
+
return match;
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/runtime/quickjs-runtime.ts
|
|
107
|
+
var quickJsModulePromise;
|
|
108
|
+
var referencedPayloadKeys = (code) => {
|
|
109
|
+
const source = ts.createSourceFile(
|
|
110
|
+
"fabric-exec.ts",
|
|
111
|
+
`async function __fabricProgram() {
|
|
112
|
+
${code}
|
|
113
|
+
}`,
|
|
114
|
+
ts.ScriptTarget.Latest,
|
|
115
|
+
false,
|
|
116
|
+
ts.ScriptKind.TS
|
|
117
|
+
);
|
|
118
|
+
const keys = [];
|
|
119
|
+
const visit = (node) => {
|
|
120
|
+
if (ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "payloads" && !keys.includes(node.name.text)) {
|
|
121
|
+
keys.push(node.name.text);
|
|
122
|
+
}
|
|
123
|
+
ts.forEachChild(node, visit);
|
|
124
|
+
};
|
|
125
|
+
visit(source);
|
|
126
|
+
return keys;
|
|
127
|
+
};
|
|
128
|
+
var missingPayloadKeys = (code, payloads) => {
|
|
129
|
+
const provided = payloads ?? {};
|
|
130
|
+
return referencedPayloadKeys(code).filter((key) => !(key in provided));
|
|
131
|
+
};
|
|
132
|
+
var quickJsModule = () => {
|
|
133
|
+
quickJsModulePromise ??= newQuickJSWASMModuleFromVariant(releaseSyncVariant);
|
|
134
|
+
return quickJsModulePromise;
|
|
135
|
+
};
|
|
136
|
+
var GUEST_SETUP = `
|
|
137
|
+
(() => {
|
|
138
|
+
const __fabricBridge = globalThis.__fabricHostCall;
|
|
139
|
+
delete globalThis.__fabricHostCall;
|
|
140
|
+
const __successfulCalls = [];
|
|
141
|
+
const __resolvedCallRef = (ref, args) =>
|
|
142
|
+
ref === "fabric.$call" && args && typeof args.ref === "string" ? args.ref : ref;
|
|
143
|
+
const __recordSuccessfulCall = (ref, args) => {
|
|
144
|
+
__successfulCalls.push(Object.freeze({ ref: __resolvedCallRef(ref, args) }));
|
|
145
|
+
};
|
|
146
|
+
const __handoffFacts = () => {
|
|
147
|
+
const calls = Object.freeze(__successfulCalls.slice());
|
|
148
|
+
const count = (ref) => {
|
|
149
|
+
if (ref === undefined) return calls.length;
|
|
150
|
+
const refs = new Set(Array.isArray(ref) ? ref : [ref]);
|
|
151
|
+
return calls.reduce((total, call) => total + (refs.has(call.ref) ? 1 : 0), 0);
|
|
152
|
+
};
|
|
153
|
+
return Object.freeze({ calls, count });
|
|
154
|
+
};
|
|
155
|
+
const __call = async (ref, args) => {
|
|
156
|
+
const normalizedArgs = args ?? {};
|
|
157
|
+
const value = await __fabricBridge(ref, normalizedArgs);
|
|
158
|
+
__recordSuccessfulCall(ref, normalizedArgs);
|
|
159
|
+
return value;
|
|
160
|
+
};
|
|
161
|
+
const __ompToolNames = ["read","bash","edit","write","grep","find","ls"];
|
|
162
|
+
const __toolsBase = {
|
|
163
|
+
providers: () => __call("fabric.$providers", {}),
|
|
164
|
+
catalog: (args = {}) => __call("fabric.$catalog", args),
|
|
165
|
+
list: (args = {}) => __call("fabric.$list", args),
|
|
166
|
+
search: (args) => __call(
|
|
167
|
+
"fabric.$search",
|
|
168
|
+
typeof args === "string" ? { query: args } : args,
|
|
169
|
+
),
|
|
170
|
+
describe: (args) => __call("fabric.$describe", args),
|
|
171
|
+
call: (args) => __call("fabric.$call", args),
|
|
172
|
+
progress: (args) => __call("fabric.$progress", args),
|
|
173
|
+
models: () => __call("fabric.$models", {}),
|
|
174
|
+
};
|
|
175
|
+
// tools is discovery + generic calls only. The proxy keeps the seven discovery
|
|
176
|
+
// methods and turns a core-tool name (read/bash/edit/...) into an actionable
|
|
177
|
+
// error pointing at omp.<name>, so a model that writes tools.read(...) learns
|
|
178
|
+
// the fix in one turn instead of looping on "tools.read is not a function".
|
|
179
|
+
globalThis.tools = new Proxy(__toolsBase, {
|
|
180
|
+
get(target, property) {
|
|
181
|
+
if (property === "then" || typeof property === "symbol") return undefined;
|
|
182
|
+
const name = String(property);
|
|
183
|
+
if (__ompToolNames.indexOf(name) >= 0) {
|
|
184
|
+
return () => {
|
|
185
|
+
throw new Error(
|
|
186
|
+
"tools." + name + " is not available on the discovery API. tools is discovery + generic calls only (providers/catalog/list/search/describe/call/models). For the OMP core tool, call omp." + name + "(args), e.g. omp." + name + "({ ... })."
|
|
187
|
+
);
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return target[property];
|
|
191
|
+
},
|
|
192
|
+
set() { return true; },
|
|
193
|
+
deleteProperty() { return true; },
|
|
194
|
+
});
|
|
195
|
+
const __ompStringFields = { bash: "command", read: "path", ls: "path", grep: "pattern", find: "pattern" };
|
|
196
|
+
// Per-tool key aliases. The runtime normalizes them to the canonical form
|
|
197
|
+
// before the host validates args; unit-converting aliases are handled separately
|
|
198
|
+
// in __normalizeOmpArgs. This lets a model that writes { query, regex, ... }
|
|
199
|
+
// or { file } instead of { pattern } / { path } still succeeds on the first
|
|
200
|
+
// call. Keep these in sync with the OmpToolsApi overloads in guest-types.ts so
|
|
201
|
+
// the type-checker accepts the same spellings it coercion-handles at runtime.
|
|
202
|
+
const __ompArgAliases = {
|
|
203
|
+
bash: {
|
|
204
|
+
cmd: "command", shell: "command", cmdline: "command", script: "command",
|
|
205
|
+
commandLine: "command",
|
|
206
|
+
workdir: "cwd", directory: "cwd", workingDirectory: "cwd",
|
|
207
|
+
},
|
|
208
|
+
find: {
|
|
209
|
+
query: "pattern", regex: "pattern", search: "pattern", name: "pattern",
|
|
210
|
+
filename: "pattern", glob: "pattern", expression: "pattern", include: "pattern",
|
|
211
|
+
max: "limit",
|
|
212
|
+
},
|
|
213
|
+
grep: {
|
|
214
|
+
query: "pattern", regex: "pattern", search: "pattern", q: "pattern",
|
|
215
|
+
expression: "pattern", text: "pattern",
|
|
216
|
+
ic: "ignoreCase", caseInsensitive: "ignoreCase",
|
|
217
|
+
globPattern: "glob",
|
|
218
|
+
max: "limit", ctx: "context",
|
|
219
|
+
},
|
|
220
|
+
read: {
|
|
221
|
+
file: "path", absolutePath: "path", file_path: "path", filePath: "path",
|
|
222
|
+
filepath: "path", pathname: "path", target_file: "path", targetFile: "path",
|
|
223
|
+
absolute_path: "path", fileAbsolutePath: "path",
|
|
224
|
+
max: "limit", start: "offset",
|
|
225
|
+
},
|
|
226
|
+
ls: {
|
|
227
|
+
dir: "path", file: "path", folder: "path", absolutePath: "path",
|
|
228
|
+
file_path: "path", filePath: "path", filepath: "path", pathname: "path",
|
|
229
|
+
target_file: "path", targetFile: "path", absolute_path: "path",
|
|
230
|
+
fileAbsolutePath: "path", directory: "path", directoryPath: "path",
|
|
231
|
+
max: "limit",
|
|
232
|
+
},
|
|
233
|
+
edit: {
|
|
234
|
+
file: "path", absolutePath: "path", file_path: "path", filePath: "path",
|
|
235
|
+
filepath: "path", pathname: "path", target_file: "path", targetFile: "path",
|
|
236
|
+
absolute_path: "path", fileAbsolutePath: "path",
|
|
237
|
+
old: "oldText", old_string: "oldText", oldString: "oldText",
|
|
238
|
+
old_str: "oldText", oldStr: "oldText", from: "oldText",
|
|
239
|
+
old_value: "oldText", old_text: "oldText", oldContent: "oldText",
|
|
240
|
+
old_content: "oldText",
|
|
241
|
+
new: "newText", replacement: "newText", new_string: "newText",
|
|
242
|
+
newString: "newText", new_str: "newText", newStr: "newText",
|
|
243
|
+
to: "newText", new_value: "newText", new_text: "newText",
|
|
244
|
+
newContent: "newText", new_content: "newText",
|
|
245
|
+
},
|
|
246
|
+
write: {
|
|
247
|
+
file: "path", absolutePath: "path", file_path: "path", filePath: "path",
|
|
248
|
+
filepath: "path", pathname: "path", target_file: "path", targetFile: "path",
|
|
249
|
+
absolute_path: "path", fileAbsolutePath: "path",
|
|
250
|
+
contents: "content", body: "content", text: "content", data: "content",
|
|
251
|
+
fileContent: "content",
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
// Multi-arg positional order, used only when a call passes >= 2 args and the
|
|
255
|
+
// (primary, options) merge in __positionalToArgs does not apply. One-field
|
|
256
|
+
// tools (read/bash/ls) stay absent: their two-arg form is a bare string plus
|
|
257
|
+
// an options object, repaired by the merge instead of a wrong-arity (2554)
|
|
258
|
+
// type error; only a non-object second arg still fails 2554.
|
|
259
|
+
const __ompPositionalFields = {
|
|
260
|
+
grep: ["pattern", "path", "limit"],
|
|
261
|
+
find: ["pattern", "path", "limit"],
|
|
262
|
+
write: ["path", "content"],
|
|
263
|
+
edit: ["path", "oldText", "newText"],
|
|
264
|
+
};
|
|
265
|
+
// Models often pass numbers as strings ("20"); coerce the known numeric
|
|
266
|
+
// option fields so the host schema sees a number. Non-numeric strings pass
|
|
267
|
+
// through untouched and fail host validation exactly as before. Kept in sync
|
|
268
|
+
// with the numeric optionals in the OmpToolsApi overloads in guest-types.ts.
|
|
269
|
+
const __ompNumericFields = {
|
|
270
|
+
read: ["offset", "limit"],
|
|
271
|
+
bash: ["timeout"],
|
|
272
|
+
grep: ["limit", "context"],
|
|
273
|
+
find: ["limit"],
|
|
274
|
+
ls: ["limit"],
|
|
275
|
+
};
|
|
276
|
+
const __ompOptionalFields = {
|
|
277
|
+
read: ["offset", "limit"],
|
|
278
|
+
grep: ["path", "glob", "ignoreCase", "literal", "context", "limit"],
|
|
279
|
+
find: ["path", "limit"],
|
|
280
|
+
ls: ["path", "limit"],
|
|
281
|
+
};
|
|
282
|
+
// (primary, options) two-arg merge for the string-primary tools:
|
|
283
|
+
// omp.read("index.ts", { limit: 120 }) becomes { path: "index.ts", limit: 120 }.
|
|
284
|
+
// A plain-object second arg is never a valid positional value for these tools
|
|
285
|
+
// (grep/find take (pattern, path, limit) strings/numbers), so merging is
|
|
286
|
+
// unambiguous; the positional string wins the primary field on conflict. The
|
|
287
|
+
// merged object flows through the same alias, unit, and numeric normalization
|
|
288
|
+
// in __normalizeOmpArgs as any other options object.
|
|
289
|
+
const __positionalToArgs = (name, rest) => {
|
|
290
|
+
const first = rest[0];
|
|
291
|
+
const second = rest[1];
|
|
292
|
+
const primaryField = __ompStringFields[name];
|
|
293
|
+
if (
|
|
294
|
+
rest.length === 2 &&
|
|
295
|
+
typeof first === "string" &&
|
|
296
|
+
primaryField !== undefined &&
|
|
297
|
+
second !== null && typeof second === "object" && !Array.isArray(second)
|
|
298
|
+
) {
|
|
299
|
+
const merged = Object.assign({}, second);
|
|
300
|
+
merged[primaryField] = first;
|
|
301
|
+
return merged;
|
|
302
|
+
}
|
|
303
|
+
const order = __ompPositionalFields[name];
|
|
304
|
+
if (!order) return rest.length > 0 ? first : {};
|
|
305
|
+
const out = {};
|
|
306
|
+
for (let i = 0; i < rest.length && i < order.length; i++) {
|
|
307
|
+
const v = rest[i];
|
|
308
|
+
if (v !== undefined) out[order[i]] = v;
|
|
309
|
+
}
|
|
310
|
+
return out;
|
|
311
|
+
};
|
|
312
|
+
const __normalizeOmpArgs = (name, args) => {
|
|
313
|
+
const field = __ompStringFields[name];
|
|
314
|
+
if (typeof args === "string" && field) return { [field]: args };
|
|
315
|
+
if (args === null || typeof args !== "object" || Array.isArray(args)) return args;
|
|
316
|
+
const aliases = __ompArgAliases[name];
|
|
317
|
+
let out = args;
|
|
318
|
+
if (name === "bash" && "timeoutMs" in out) {
|
|
319
|
+
out = Object.assign({}, args);
|
|
320
|
+
if (!("timeout" in out)) {
|
|
321
|
+
const timeoutMs = out.timeoutMs;
|
|
322
|
+
if (timeoutMs !== null && timeoutMs !== undefined) {
|
|
323
|
+
out.timeout = Number.isFinite(Number(timeoutMs)) ? Number(timeoutMs) / 1000 : timeoutMs;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
delete out.timeoutMs;
|
|
327
|
+
}
|
|
328
|
+
// settle is a guest-only directive (settles nonzero exits instead of
|
|
329
|
+
// rejecting); strip it so it never reaches the host/bash schema.
|
|
330
|
+
if (name === "bash" && "settle" in out) {
|
|
331
|
+
if (out === args) out = Object.assign({}, args);
|
|
332
|
+
delete out.settle;
|
|
333
|
+
}
|
|
334
|
+
if (aliases) {
|
|
335
|
+
for (const alias in aliases) {
|
|
336
|
+
const canonical = aliases[alias];
|
|
337
|
+
if (alias in out) {
|
|
338
|
+
if (out === args) out = Object.assign({}, args);
|
|
339
|
+
if (!(canonical in out)) out[canonical] = out[alias];
|
|
340
|
+
delete out[alias];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
const numerics = __ompNumericFields[name];
|
|
345
|
+
if (numerics) {
|
|
346
|
+
for (const key of numerics) {
|
|
347
|
+
const value = out[key];
|
|
348
|
+
if (typeof value === "string" && value.trim() !== "" && Number.isFinite(Number(value))) {
|
|
349
|
+
if (out === args) out = Object.assign({}, args);
|
|
350
|
+
out[key] = Number(value);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
const optionalFields = __ompOptionalFields[name];
|
|
355
|
+
if (optionalFields) {
|
|
356
|
+
for (const key of optionalFields) {
|
|
357
|
+
if (out[key] !== null && out[key] !== undefined) continue;
|
|
358
|
+
if (!(key in out)) continue;
|
|
359
|
+
if (out === args) out = Object.assign({}, args);
|
|
360
|
+
delete out[key];
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (name === "edit" && Array.isArray(out.edits)) {
|
|
364
|
+
let changed = false;
|
|
365
|
+
const editAliases = __ompArgAliases.edit;
|
|
366
|
+
const edits = out.edits.map((entry) => {
|
|
367
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) return entry;
|
|
368
|
+
let edit = entry;
|
|
369
|
+
for (const alias in editAliases) {
|
|
370
|
+
const canonical = editAliases[alias];
|
|
371
|
+
if (canonical !== "oldText" && canonical !== "newText") continue;
|
|
372
|
+
if (!(alias in edit)) continue;
|
|
373
|
+
if (edit === entry) edit = Object.assign({}, entry);
|
|
374
|
+
if (!(canonical in edit)) edit[canonical] = edit[alias];
|
|
375
|
+
delete edit[alias];
|
|
376
|
+
changed = true;
|
|
377
|
+
}
|
|
378
|
+
return edit;
|
|
379
|
+
});
|
|
380
|
+
if (changed) {
|
|
381
|
+
if (out === args) out = Object.assign({}, args);
|
|
382
|
+
out.edits = edits;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (name === "edit" && !Array.isArray(out.edits) && ("oldText" in out || "newText" in out)) {
|
|
386
|
+
if (out === args) out = Object.assign({}, args);
|
|
387
|
+
const edit = {};
|
|
388
|
+
if ("oldText" in out) edit.oldText = out.oldText;
|
|
389
|
+
if ("newText" in out) edit.newText = out.newText;
|
|
390
|
+
out.edits = [edit];
|
|
391
|
+
delete out.oldText;
|
|
392
|
+
delete out.newText;
|
|
393
|
+
}
|
|
394
|
+
return out;
|
|
395
|
+
};
|
|
396
|
+
// shell/edit/write resolve envelope objects { ok, output, details }, and the
|
|
397
|
+
// type-checker deliberately suppresses property-miss (2339) diagnostics, so
|
|
398
|
+
// result.trim() on an envelope typechecks and then dies with QuickJS's terse
|
|
399
|
+
// "not a function" \u2014 an error models cannot localize (observed: misdirected
|
|
400
|
+
// debugging spirals probing unrelated globals). Guard envelopes with a proxy
|
|
401
|
+
// that throws an actionable TypeError for string-method access and iteration,
|
|
402
|
+
// naming the tool and the .output fix. Ordinary reads (ok/output/details/
|
|
403
|
+
// exitCode/error), destructuring, 'in' checks, and JSON marshaling pass through.
|
|
404
|
+
const __ompEnvelopeTools = { bash: true, edit: true, write: true };
|
|
405
|
+
const __ompEnvelopeStringTraps = new Set([
|
|
406
|
+
"anchor", "at", "big", "blink", "bold", "charAt", "charCodeAt", "codePointAt",
|
|
407
|
+
"concat", "endsWith", "fixed", "fontcolor", "fontsize", "includes", "indexOf",
|
|
408
|
+
"italics", "lastIndexOf", "length", "link", "localeCompare", "match", "matchAll",
|
|
409
|
+
"normalize", "padEnd", "padStart", "repeat", "replace", "replaceAll", "search",
|
|
410
|
+
"slice", "small", "split", "startsWith", "strike", "sub", "substr", "substring",
|
|
411
|
+
"sup", "toLocaleLowerCase", "toLocaleUpperCase", "toLowerCase", "toUpperCase",
|
|
412
|
+
"trim", "trimEnd", "trimStart",
|
|
413
|
+
]);
|
|
414
|
+
const __ompEnvelopeGuard = (name, value) => {
|
|
415
|
+
if (value === null || typeof value !== "object" || typeof value.ok !== "boolean") return value;
|
|
416
|
+
return new Proxy(value, {
|
|
417
|
+
get(target, property, receiver) {
|
|
418
|
+
if (property === Symbol.iterator || property === Symbol.asyncIterator) {
|
|
419
|
+
throw new TypeError(
|
|
420
|
+
"omp." + name + "(...) resolves an envelope { ok, output, details }, which is not iterable. " +
|
|
421
|
+
"Iterate the text instead: (await omp." + name + "(...)).output.split('\\\\n')"
|
|
422
|
+
);
|
|
423
|
+
}
|
|
424
|
+
if (typeof property === "string" && __ompEnvelopeStringTraps.has(property)) {
|
|
425
|
+
throw new TypeError(
|
|
426
|
+
"omp." + name + "(...) resolves an envelope { ok, output, details }, not a string, so ." + property +
|
|
427
|
+
" is unavailable on it. Read the text first: const out = (await omp." + name + "(...)).output; then out." + property +
|
|
428
|
+
"(...). Shell commands reject on a nonzero exit \u2014 pass settle: true to receive an ok:false envelope instead."
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
return Reflect.get(target, property, receiver);
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
};
|
|
435
|
+
// The omp proxy accepts: a bare string (primary field), an options object, a
|
|
436
|
+
// (primary, options) two-arg merge for the string-primary tools, or a
|
|
437
|
+
// positional spread mapped by __ompPositionalFields. 0/1 args preserve the
|
|
438
|
+
// legacy (args = {}) default so existing programs are unchanged.
|
|
439
|
+
globalThis.omp = new Proxy({}, {
|
|
440
|
+
get(_target, property) {
|
|
441
|
+
if (property === "then") return undefined;
|
|
442
|
+
const name = String(property);
|
|
443
|
+
// fabric_exec payload values are readable directly on the omp surface
|
|
444
|
+
// (documented for skills as payloads.<key>), while core tool names stay
|
|
445
|
+
// callables. Only shadow a payload key that actually exists.
|
|
446
|
+
const payloadValues = (typeof globalThis["payloads"] === "object" && globalThis["payloads"] !== null)
|
|
447
|
+
? globalThis["payloads"]
|
|
448
|
+
: {};
|
|
449
|
+
if (__ompToolNames.indexOf(name) < 0 && Object.prototype.hasOwnProperty.call(payloadValues, name)) {
|
|
450
|
+
return payloadValues[name];
|
|
451
|
+
}
|
|
452
|
+
return (...rest) => {
|
|
453
|
+
let args;
|
|
454
|
+
if (rest.length <= 1) {
|
|
455
|
+
const first = rest.length === 1 ? rest[0] : undefined;
|
|
456
|
+
args = first === undefined ? {} : first;
|
|
457
|
+
} else {
|
|
458
|
+
args = __positionalToArgs(name, rest);
|
|
459
|
+
}
|
|
460
|
+
// Shell tools reject on an ordinary nonzero exit; settle:true returns
|
|
461
|
+
// {ok:false, exitCode, ...} instead (opt-in). Other failures still reject.
|
|
462
|
+
const settle = name === "bash" &&
|
|
463
|
+
typeof args === "object" && args !== null && args.settle === true;
|
|
464
|
+
const call = __call("omp." + name, __normalizeOmpArgs(name, args));
|
|
465
|
+
const promise = settle ? call.catch((error) => {
|
|
466
|
+
// node-process bridge errors originate in a different VM realm.
|
|
467
|
+
const message = typeof error?.message === "string" ? error.message : String(error);
|
|
468
|
+
const exit = error?.__fabricBashExit;
|
|
469
|
+
if (!exit || !Number.isSafeInteger(exit.exitCode) || exit.exitCode <= 0 ||
|
|
470
|
+
typeof exit.output !== "string") throw error;
|
|
471
|
+
return {
|
|
472
|
+
ok: false,
|
|
473
|
+
output: exit.output,
|
|
474
|
+
details: null,
|
|
475
|
+
exitCode: exit.exitCode,
|
|
476
|
+
error: message,
|
|
477
|
+
};
|
|
478
|
+
}) : call;
|
|
479
|
+
return __ompEnvelopeTools[name] === true
|
|
480
|
+
? promise.then((value) => __ompEnvelopeGuard(name, value))
|
|
481
|
+
: promise;
|
|
482
|
+
};
|
|
483
|
+
},
|
|
484
|
+
});
|
|
485
|
+
const __payloads = (typeof globalThis["payloads"] === "object" && globalThis["payloads"] !== null) ? globalThis["payloads"] : {};
|
|
486
|
+
globalThis["payloads"] = new Proxy(__payloads, {
|
|
487
|
+
get(target, property) {
|
|
488
|
+
if (typeof property === "symbol") return undefined;
|
|
489
|
+
const name = String(property);
|
|
490
|
+
if (name === "then" || name === "toJSON" || name === "constructor") return undefined;
|
|
491
|
+
if (Object.prototype.hasOwnProperty.call(target, name)) return target[name];
|
|
492
|
+
if (__ompToolNames.indexOf(name) >= 0) {
|
|
493
|
+
throw new Error(
|
|
494
|
+
"payloads." + name + " is the payloads accessor, not a tool. For the OMP core tool, call omp." + name + "(args)."
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
const provided = Object.keys(target);
|
|
498
|
+
throw new Error(
|
|
499
|
+
"payloads." + name + " is not defined. payloads only exposes keys from the fabric_exec payloads parameter" +
|
|
500
|
+
(provided.length ? " (provided: " + provided.join(", ") + ")" : " (none provided)") +
|
|
501
|
+
". Pass payloads: { " + name + ": '...' } to use payloads." + name + "." +
|
|
502
|
+
" For large or quote-heavy content, keep it in top-level payloads and reference payloads." + name + " instead of escaping it inside code."
|
|
503
|
+
);
|
|
504
|
+
},
|
|
505
|
+
ownKeys(target) { return Reflect.ownKeys(target); },
|
|
506
|
+
getOwnPropertyDescriptor(target, prop) { return Reflect.getOwnPropertyDescriptor(target, prop); },
|
|
507
|
+
has(target, prop) { return Object.prototype.hasOwnProperty.call(target, prop); }
|
|
508
|
+
});
|
|
509
|
+
// Stable providers share a lazy dispatch proxy; the guest declarations keep
|
|
510
|
+
// their known actions typed while the registry remains the runtime authority.
|
|
511
|
+
// extensions' per-tool surface is additionally rendered from the captured
|
|
512
|
+
// catalog by guestTypeDeclarations (runtime/dynamic-guest-types.ts).
|
|
513
|
+
const __memorySelectionKeys = [
|
|
514
|
+
"indices",
|
|
515
|
+
"entryIds",
|
|
516
|
+
"operationAddresses",
|
|
517
|
+
"entryRange",
|
|
518
|
+
"index",
|
|
519
|
+
"entry_ids",
|
|
520
|
+
"operation_addresses",
|
|
521
|
+
"entry_range",
|
|
522
|
+
];
|
|
523
|
+
const __hasMemorySelection = (args) => __memorySelectionKeys.some((key) => {
|
|
524
|
+
const value = args[key];
|
|
525
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
526
|
+
return value !== undefined && value !== null;
|
|
527
|
+
});
|
|
528
|
+
const __memoryWalk = async (args, visitor) => {
|
|
529
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) {
|
|
530
|
+
throw new TypeError("memory.walk expects an expansion options object");
|
|
531
|
+
}
|
|
532
|
+
if (typeof visitor !== "function") {
|
|
533
|
+
throw new TypeError("memory.walk expects a visitor function as its second argument");
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
let request = { ...args };
|
|
537
|
+
if (Number(request.textOffset ?? request.text_offset ?? 0) !== 0) {
|
|
538
|
+
throw new TypeError("memory.walk must start at text offset 0 to yield complete entries");
|
|
539
|
+
}
|
|
540
|
+
if (!__hasMemorySelection(request)) {
|
|
541
|
+
if (request.entryOffset !== undefined || request.entry_offset !== undefined ||
|
|
542
|
+
request.textOffset !== undefined || request.text_offset !== undefined) {
|
|
543
|
+
throw new TypeError("memory.walk continuation offsets require an explicit selection");
|
|
544
|
+
}
|
|
545
|
+
if (Number(request.before ?? 0) > 0 || Number(request.after ?? 0) > 0) {
|
|
546
|
+
throw new TypeError("memory.walk before/after requires an explicit selection");
|
|
547
|
+
}
|
|
548
|
+
const head = await __call("memory.expand", request);
|
|
549
|
+
if (!head || typeof head !== "object") {
|
|
550
|
+
throw new Error("memory.expand returned an invalid metadata response");
|
|
551
|
+
}
|
|
552
|
+
if (head.error) return { visited: 0, stopped: false, error: head.error };
|
|
553
|
+
if (!Number.isSafeInteger(head.entryCount) || head.entryCount < 0) {
|
|
554
|
+
throw new Error("memory.expand metadata omitted a valid entryCount");
|
|
555
|
+
}
|
|
556
|
+
if (head.entryCount === 0) return { visited: 0, stopped: false };
|
|
557
|
+
request = {
|
|
558
|
+
...request,
|
|
559
|
+
session: head.session ?? request.session,
|
|
560
|
+
expectedSourceHash: head.sourceHash,
|
|
561
|
+
expectedLineageFingerprint: head.lineageFingerprint,
|
|
562
|
+
branches: head.branches,
|
|
563
|
+
entryRange: { first: 0, last: head.entryCount - 1 },
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
let visited = 0;
|
|
568
|
+
let pending = null;
|
|
569
|
+
let pendingStart = 0;
|
|
570
|
+
let pendingEnd = 0;
|
|
571
|
+
let pendingTotal = 0;
|
|
572
|
+
const seen = new Set([JSON.stringify({ ref: "memory.expand", args: request })]);
|
|
573
|
+
let page = await __call("memory.expand", request);
|
|
574
|
+
|
|
575
|
+
while (true) {
|
|
576
|
+
if (!page || typeof page !== "object") {
|
|
577
|
+
throw new Error("memory.expand returned an invalid page");
|
|
578
|
+
}
|
|
579
|
+
if (page.error) return { visited, stopped: false, error: page.error };
|
|
580
|
+
if (!Array.isArray(page.entries)) {
|
|
581
|
+
throw new Error("memory.expand page omitted entries");
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
for (const chunk of page.entries) {
|
|
585
|
+
if (!chunk || typeof chunk !== "object" || typeof chunk.text !== "string") {
|
|
586
|
+
throw new Error("memory.expand returned an invalid entry chunk");
|
|
587
|
+
}
|
|
588
|
+
const range = chunk.textRange;
|
|
589
|
+
if (!range || typeof range !== "object" ||
|
|
590
|
+
!Number.isSafeInteger(range.start) || !Number.isSafeInteger(range.end) ||
|
|
591
|
+
!Number.isSafeInteger(range.total) || range.start < 0 ||
|
|
592
|
+
range.end < range.start || range.total < range.end) {
|
|
593
|
+
throw new Error("memory.expand returned an invalid textRange");
|
|
594
|
+
}
|
|
595
|
+
if (chunk.text.length !== range.end - range.start) {
|
|
596
|
+
throw new Error("memory.expand entry chunk disagrees with textRange");
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if (pending === null) {
|
|
600
|
+
pending = { ...chunk, text: "" };
|
|
601
|
+
pendingStart = range.start;
|
|
602
|
+
pendingEnd = range.start;
|
|
603
|
+
pendingTotal = range.total;
|
|
604
|
+
} else if (pending.index !== chunk.index) {
|
|
605
|
+
throw new Error("memory.expand advanced before completing an entry");
|
|
606
|
+
}
|
|
607
|
+
if (range.start !== pendingEnd || range.total !== pendingTotal) {
|
|
608
|
+
throw new Error("memory.expand returned discontinuous entry chunks");
|
|
609
|
+
}
|
|
610
|
+
for (const key of Object.keys(chunk)) {
|
|
611
|
+
if (pending[key] === undefined) pending[key] = chunk[key];
|
|
612
|
+
}
|
|
613
|
+
pending.text += chunk.text;
|
|
614
|
+
pendingEnd = range.end;
|
|
615
|
+
|
|
616
|
+
if (range.complete) {
|
|
617
|
+
pending.textRange = {
|
|
618
|
+
start: pendingStart,
|
|
619
|
+
end: pendingEnd,
|
|
620
|
+
total: pendingTotal,
|
|
621
|
+
complete: true,
|
|
622
|
+
};
|
|
623
|
+
const entry = pending;
|
|
624
|
+
pending = null;
|
|
625
|
+
const keepGoing = await visitor(entry, visited);
|
|
626
|
+
visited += 1;
|
|
627
|
+
if (keepGoing === false) return { visited, stopped: true };
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (page.next === null || page.next === undefined) {
|
|
632
|
+
if (pending !== null) {
|
|
633
|
+
throw new Error("memory.expand ended before completing an entry");
|
|
634
|
+
}
|
|
635
|
+
return { visited, stopped: false };
|
|
636
|
+
}
|
|
637
|
+
if (page.next.ref !== "memory.expand" || !page.next.args ||
|
|
638
|
+
typeof page.next.args !== "object" || Array.isArray(page.next.args)) {
|
|
639
|
+
throw new Error("memory.expand returned an invalid continuation");
|
|
640
|
+
}
|
|
641
|
+
const continuationKey = JSON.stringify(page.next);
|
|
642
|
+
if (seen.has(continuationKey)) {
|
|
643
|
+
throw new Error("memory.expand returned a cyclic continuation");
|
|
644
|
+
}
|
|
645
|
+
seen.add(continuationKey);
|
|
646
|
+
page = await __call(page.next.ref, page.next.args);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
const __providerProxy = (provider, local = {}) => new Proxy(local, {
|
|
651
|
+
get(target, property) {
|
|
652
|
+
if (property === "then" || typeof property === "symbol") return undefined;
|
|
653
|
+
if (Object.prototype.hasOwnProperty.call(target, property)) return target[property];
|
|
654
|
+
return (args = {}) => __call(provider + "." + String(property), args);
|
|
655
|
+
},
|
|
656
|
+
});
|
|
657
|
+
globalThis.extensions = __providerProxy("extensions");
|
|
658
|
+
globalThis.memory = __providerProxy("memory", { walk: __memoryWalk });
|
|
659
|
+
globalThis.state = __providerProxy("state");
|
|
660
|
+
globalThis.schema = __providerProxy("schema");
|
|
661
|
+
globalThis.components = __providerProxy("components");
|
|
662
|
+
globalThis.compact = __providerProxy("compact");
|
|
663
|
+
const __createActor = async (args = {}) => {
|
|
664
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) {
|
|
665
|
+
throw new TypeError("agents.create expects an options object");
|
|
666
|
+
}
|
|
667
|
+
const request = { ...args };
|
|
668
|
+
const validWhile = request.validWhile;
|
|
669
|
+
if (validWhile !== undefined) {
|
|
670
|
+
if (typeof validWhile !== "function") {
|
|
671
|
+
throw new TypeError("agents.create validWhile must be a pure predicate function");
|
|
672
|
+
}
|
|
673
|
+
const source = Function.prototype.toString.call(validWhile);
|
|
674
|
+
if (source.trimStart().startsWith("async")) {
|
|
675
|
+
throw new TypeError("agents.create validWhile must be synchronous");
|
|
676
|
+
}
|
|
677
|
+
request.validWhile = { version: 1, source };
|
|
678
|
+
}
|
|
679
|
+
return __call("agents.create", request);
|
|
680
|
+
};
|
|
681
|
+
const __handoff = async (args = {}) => {
|
|
682
|
+
if (!args || typeof args !== "object" || Array.isArray(args)) {
|
|
683
|
+
throw new TypeError("agents.handoff expects an options object");
|
|
684
|
+
}
|
|
685
|
+
const request = { ...args };
|
|
686
|
+
const when = request.when;
|
|
687
|
+
delete request.when;
|
|
688
|
+
if (when !== undefined) {
|
|
689
|
+
if (typeof when !== "function") {
|
|
690
|
+
throw new TypeError("agents.handoff when must be a pure predicate function");
|
|
691
|
+
}
|
|
692
|
+
const decision = when(__handoffFacts());
|
|
693
|
+
if (decision && typeof decision.then === "function") {
|
|
694
|
+
throw new TypeError("agents.handoff when must return a boolean synchronously");
|
|
695
|
+
}
|
|
696
|
+
if (decision !== true) {
|
|
697
|
+
throw new Error("agents.handoff predicate returned false; no agent was started");
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return __call("agents.handoff", request);
|
|
701
|
+
};
|
|
702
|
+
globalThis.agents = Object.freeze({
|
|
703
|
+
run: (args) => __call("agents.run", args),
|
|
704
|
+
handoff: __handoff,
|
|
705
|
+
spawn: (args) => __call("agents.spawn", args),
|
|
706
|
+
wait: (args) => __call("agents.wait", args),
|
|
707
|
+
status: (args) => __call("agents.status", args),
|
|
708
|
+
list: (args = {}) => __call("agents.list", args),
|
|
709
|
+
members: (args = {}) => __call("agents.members", args),
|
|
710
|
+
self: () => __call("agents.self", {}),
|
|
711
|
+
main: () => __call("agents.main", {}),
|
|
712
|
+
peers: () => __call("agents.peers", {}),
|
|
713
|
+
subscribe: (args) => __call("agents.subscribe", args),
|
|
714
|
+
subscriptions: (args = {}) => __call("agents.subscriptions", args),
|
|
715
|
+
unsubscribe: (args) => __call("agents.unsubscribe", args),
|
|
716
|
+
models: (args = {}) => __call("agents.models", args),
|
|
717
|
+
stop: (args) => __call("agents.stop", args),
|
|
718
|
+
cleanup: (args) => __call("agents.cleanup", args),
|
|
719
|
+
create: __createActor,
|
|
720
|
+
ask: (args) => __call("agents.ask", args),
|
|
721
|
+
tell: (args) => __call("agents.tell", args),
|
|
722
|
+
steer: (args) => __call("agents.steer", args),
|
|
723
|
+
followUp: (args) => __call("agents.followUp", args),
|
|
724
|
+
setSteeringMode: (args) => __call("agents.setSteeringMode", args),
|
|
725
|
+
setFollowUpMode: (args) => __call("agents.setFollowUpMode", args),
|
|
726
|
+
actorStatus: (args) => __call("agents.actorStatus", args),
|
|
727
|
+
setModel: (args) => __call("agents.setModel", args),
|
|
728
|
+
switchModel: (args) => __call("agents.switchModel", args),
|
|
729
|
+
setThinking: (args) => __call("agents.setThinking", args),
|
|
730
|
+
setEvents: (args) => __call("agents.setEvents", args),
|
|
731
|
+
setInstructions: (args) => __call("agents.setInstructions", args),
|
|
732
|
+
actors: () => __call("agents.actors", {}),
|
|
733
|
+
messages: (args) => __call("agents.messages", args),
|
|
734
|
+
remove: (args) => __call("agents.remove", args),
|
|
735
|
+
log: (args) => __call("agents.log", args),
|
|
736
|
+
});
|
|
737
|
+
globalThis.mesh = Object.freeze({
|
|
738
|
+
self: () => __call("mesh.self", {}),
|
|
739
|
+
publish: (args) => __call("mesh.publish", args),
|
|
740
|
+
read: (args = {}) => __call("mesh.read", args),
|
|
741
|
+
members: (args = {}) => __call("mesh.members", args),
|
|
742
|
+
get: (args) => __call("mesh.get", args),
|
|
743
|
+
list: (args = {}) => __call("mesh.list", args),
|
|
744
|
+
put: (args) => __call("mesh.put", args),
|
|
745
|
+
delete: (args) => __call("mesh.delete", args),
|
|
746
|
+
});
|
|
747
|
+
// The mcp proxy itself stays schema-less \u2014 the registry validates args at
|
|
748
|
+
// dispatch \u2014 but guestTypeDeclarations renders per-server argument types from
|
|
749
|
+
// the live descriptor cache (runtime/dynamic-guest-types.ts), so known tools
|
|
750
|
+
// fail type-check on argument-shape mistakes before this proxy ever runs.
|
|
751
|
+
globalThis.mcp = new Proxy({}, {
|
|
752
|
+
get(_target, server) {
|
|
753
|
+
if (server === "then") return undefined;
|
|
754
|
+
if (server === "servers") return () => __call("mcp.$servers", {});
|
|
755
|
+
if (server === "reload") return () => __call("mcp.$reload", {});
|
|
756
|
+
if (server === "register") return (args) => __call("mcp.$register", args);
|
|
757
|
+
if (server === "call") return (args) => __call("mcp.$call", args);
|
|
758
|
+
return new Proxy({}, {
|
|
759
|
+
get(_serverTarget, tool) {
|
|
760
|
+
if (tool === "then") return undefined;
|
|
761
|
+
return (args = {}) => __call("mcp." + String(server) + "." + String(tool), args);
|
|
762
|
+
},
|
|
763
|
+
});
|
|
764
|
+
},
|
|
765
|
+
});
|
|
766
|
+
let __workflowSpentTokens = 0;
|
|
767
|
+
const __workflowBudgetTotal = Number.isFinite(globalThis.__fabricTokenBudget)
|
|
768
|
+
? Math.max(0, globalThis.__fabricTokenBudget)
|
|
769
|
+
: Number.POSITIVE_INFINITY;
|
|
770
|
+
const __recordAgentUsage = (result) => {
|
|
771
|
+
const usage = result && result.usage;
|
|
772
|
+
if (usage) __workflowSpentTokens += Number(usage.input || 0) + Number(usage.output || 0);
|
|
773
|
+
return result;
|
|
774
|
+
};
|
|
775
|
+
const __workflowAgent = async (prompt, options = {}) => {
|
|
776
|
+
if (__workflowSpentTokens >= __workflowBudgetTotal) {
|
|
777
|
+
throw new Error("Fabric workflow token budget exhausted");
|
|
778
|
+
}
|
|
779
|
+
const { label, ...agentOptions } = options;
|
|
780
|
+
const workerName = String(label || agentOptions.name || "Fabric workflow agent");
|
|
781
|
+
const result = __recordAgentUsage(await agents.run({
|
|
782
|
+
...agentOptions,
|
|
783
|
+
...(label && !agentOptions.name ? { name: label } : {}),
|
|
784
|
+
task: prompt,
|
|
785
|
+
}));
|
|
786
|
+
if (!result || result.status !== "completed") {
|
|
787
|
+
const reason = result && result.error ? result.error : "agent did not complete";
|
|
788
|
+
throw new Error(workerName + " failed: " + reason);
|
|
789
|
+
}
|
|
790
|
+
return result.value !== undefined ? result.value : result.text;
|
|
791
|
+
};
|
|
792
|
+
// Budget-aware agents.run used by council.run and rlm.query so their usage is
|
|
793
|
+
// counted in budget.spent() and the tokenBudget guard can preempt them, just
|
|
794
|
+
// like workflow.agent(). Without this, councils bypass the budget entirely.
|
|
795
|
+
const __budgetedRun = async (args) => {
|
|
796
|
+
if (__workflowSpentTokens >= __workflowBudgetTotal) {
|
|
797
|
+
throw new Error("Fabric workflow token budget exhausted");
|
|
798
|
+
}
|
|
799
|
+
return __recordAgentUsage(await agents.run(args));
|
|
800
|
+
};
|
|
801
|
+
let __nextWorkflowSpanId = 0;
|
|
802
|
+
const __workflowSpanMetadata = (kind, items, options, stageCount) => {
|
|
803
|
+
const itemCount = Array.isArray(items) ? items.length : undefined;
|
|
804
|
+
let concurrency;
|
|
805
|
+
if (kind === "parallel" && itemCount !== undefined) {
|
|
806
|
+
if (itemCount === 0) concurrency = 0;
|
|
807
|
+
else {
|
|
808
|
+
const concurrencyOpt = typeof options === "number" ? { concurrency: options } : options ?? {};
|
|
809
|
+
const requested = Number(concurrencyOpt.concurrency ?? itemCount);
|
|
810
|
+
if (Number.isFinite(requested) && requested >= 1) {
|
|
811
|
+
concurrency = Math.max(1, Math.min(itemCount, Math.floor(requested)));
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return {
|
|
816
|
+
kind,
|
|
817
|
+
...(itemCount !== undefined ? { itemCount } : {}),
|
|
818
|
+
...(stageCount !== undefined ? { stageCount } : {}),
|
|
819
|
+
...(concurrency !== undefined ? { concurrency } : {}),
|
|
820
|
+
};
|
|
821
|
+
};
|
|
822
|
+
const __withWorkflowSpan = async (metadata, body) => {
|
|
823
|
+
const id = "span-" + __nextWorkflowSpanId++;
|
|
824
|
+
await __call("fabric.$spanStart", { id, ...metadata });
|
|
825
|
+
try {
|
|
826
|
+
const value = await body();
|
|
827
|
+
await __call("fabric.$spanEnd", { id, outcome: "succeeded" });
|
|
828
|
+
return value;
|
|
829
|
+
} catch (error) {
|
|
830
|
+
try { await __call("fabric.$spanEnd", { id, outcome: "failed" }); } catch { /* preserve the workflow error */ }
|
|
831
|
+
throw error;
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
const __runParallel = async (thunks, options) => {
|
|
835
|
+
if (!Array.isArray(thunks) || thunks.some((thunk) => typeof thunk !== "function")) {
|
|
836
|
+
throw new TypeError("workflow.parallel expects an array of functions or (items, mapper)");
|
|
837
|
+
}
|
|
838
|
+
if (thunks.length === 0) return [];
|
|
839
|
+
const concurrencyOpt = typeof options === "number" ? { concurrency: options } : options ?? {};
|
|
840
|
+
const requestedConcurrency = Number(concurrencyOpt.concurrency ?? thunks.length);
|
|
841
|
+
if (!Number.isFinite(requestedConcurrency) || requestedConcurrency < 1) {
|
|
842
|
+
throw new RangeError("workflow.parallel concurrency must be a positive finite number");
|
|
843
|
+
}
|
|
844
|
+
const concurrency = Math.max(1, Math.min(thunks.length || 1, Math.floor(requestedConcurrency)));
|
|
845
|
+
const results = new Array(thunks.length);
|
|
846
|
+
let cursor = 0;
|
|
847
|
+
await Promise.all(Array.from({ length: concurrency }, async () => {
|
|
848
|
+
while (cursor < thunks.length) {
|
|
849
|
+
const index = cursor++;
|
|
850
|
+
results[index] = await thunks[index]();
|
|
851
|
+
}
|
|
852
|
+
}));
|
|
853
|
+
return results;
|
|
854
|
+
};
|
|
855
|
+
const __workflowParallel = async (items, arg2, arg3) => {
|
|
856
|
+
const options = typeof arg2 === "function" ? arg3 : arg2;
|
|
857
|
+
return __withWorkflowSpan(
|
|
858
|
+
__workflowSpanMetadata("parallel", items, options),
|
|
859
|
+
async () => {
|
|
860
|
+
if (typeof arg2 === "function") {
|
|
861
|
+
if (!Array.isArray(items)) throw new TypeError("workflow.parallel expects an array as the first argument");
|
|
862
|
+
return __runParallel(items.map((item, index) => () => arg2(item, index)), arg3);
|
|
863
|
+
}
|
|
864
|
+
return __runParallel(items, arg2);
|
|
865
|
+
},
|
|
866
|
+
);
|
|
867
|
+
};
|
|
868
|
+
const __workflowPipeline = async (items, ...stages) =>
|
|
869
|
+
__withWorkflowSpan(
|
|
870
|
+
__workflowSpanMetadata("pipeline", items, undefined, stages.length),
|
|
871
|
+
async () => {
|
|
872
|
+
if (!Array.isArray(items) || stages.some((stage) => typeof stage !== "function")) {
|
|
873
|
+
throw new TypeError("workflow.pipeline expects an array followed by stage functions");
|
|
874
|
+
}
|
|
875
|
+
return __workflowParallel(items.map((original, index) => async () => {
|
|
876
|
+
let value = original;
|
|
877
|
+
for (const stage of stages) value = await stage(value, original, index);
|
|
878
|
+
return value;
|
|
879
|
+
}));
|
|
880
|
+
},
|
|
881
|
+
);
|
|
882
|
+
globalThis.workflow = Object.freeze({
|
|
883
|
+
agent: __workflowAgent,
|
|
884
|
+
parallel: __workflowParallel,
|
|
885
|
+
pipeline: __workflowPipeline,
|
|
886
|
+
configure: (args) => __call("fabric.$configure", args),
|
|
887
|
+
phase: (nameOrInput, options = {}) => {
|
|
888
|
+
const input =
|
|
889
|
+
nameOrInput && typeof nameOrInput === "object" && !Array.isArray(nameOrInput)
|
|
890
|
+
? { ...nameOrInput }
|
|
891
|
+
: { ...options, name: nameOrInput };
|
|
892
|
+
return __call("fabric.$phase", input);
|
|
893
|
+
},
|
|
894
|
+
item: (args) => __call("fabric.$item", args),
|
|
895
|
+
event: (args) => __call("fabric.$event", args),
|
|
896
|
+
log: (...values) => print(...values),
|
|
897
|
+
budget: Object.freeze({
|
|
898
|
+
total: __workflowBudgetTotal,
|
|
899
|
+
spent: () => __workflowSpentTokens,
|
|
900
|
+
remaining: () => Math.max(0, __workflowBudgetTotal - __workflowSpentTokens),
|
|
901
|
+
}),
|
|
902
|
+
});
|
|
903
|
+
globalThis.agent = __workflowAgent;
|
|
904
|
+
globalThis.parallel = __workflowParallel;
|
|
905
|
+
globalThis.pipeline = __workflowPipeline;
|
|
906
|
+
globalThis.phase = workflow.phase;
|
|
907
|
+
globalThis.log = workflow.log;
|
|
908
|
+
globalThis.budget = workflow.budget;
|
|
909
|
+
globalThis.rlm = Object.freeze({
|
|
910
|
+
query: (args) => {
|
|
911
|
+
if (args && args.runner && args.runner !== "omp") {
|
|
912
|
+
throw new Error("rlm.query requires the OMP runner because recursive Fabric is unavailable in Claude Code");
|
|
913
|
+
}
|
|
914
|
+
return __budgetedRun({ ...args, runner: "omp", recursive: true });
|
|
915
|
+
},
|
|
916
|
+
});
|
|
917
|
+
globalThis.council = Object.freeze({
|
|
918
|
+
async run(args) {
|
|
919
|
+
const { task, roles, synthesize = true, ...agentOptions } = args;
|
|
920
|
+
const results = await Promise.all(roles.map((role) => __budgetedRun({
|
|
921
|
+
...agentOptions,
|
|
922
|
+
name: role,
|
|
923
|
+
task: "Act as the " + role + " council member. Independently analyze this task:\\n\\n" + task,
|
|
924
|
+
})));
|
|
925
|
+
if (!synthesize) return results;
|
|
926
|
+
return __budgetedRun({
|
|
927
|
+
...agentOptions,
|
|
928
|
+
name: "council-synthesizer",
|
|
929
|
+
task: "Synthesize the council's independent reports into one decision. Preserve disagreements and cite which role raised each concern.\\n\\nTask:\\n" + task + "\\n\\nReports:\\n" + JSON.stringify(results),
|
|
930
|
+
});
|
|
931
|
+
},
|
|
932
|
+
});
|
|
933
|
+
globalThis.console = Object.freeze({ log: print, info: print, warn: print, error: print });
|
|
934
|
+
const __timerCallbacks = new Map();
|
|
935
|
+
let __nextTimerId = 1;
|
|
936
|
+
globalThis.setTimeout = (callback, ms = 0) => {
|
|
937
|
+
const id = __nextTimerId++;
|
|
938
|
+
__timerCallbacks.set(id, { callback, interval: false });
|
|
939
|
+
__call("fabric.$timer", { ms }).then(() => {
|
|
940
|
+
const entry = __timerCallbacks.get(id);
|
|
941
|
+
if (!entry) return;
|
|
942
|
+
__timerCallbacks.delete(id);
|
|
943
|
+
try { entry.callback(); } catch { /* swallow timer callback errors */ }
|
|
944
|
+
});
|
|
945
|
+
return id;
|
|
946
|
+
};
|
|
947
|
+
globalThis.setInterval = (callback, ms = 0) => {
|
|
948
|
+
const id = __nextTimerId++;
|
|
949
|
+
__timerCallbacks.set(id, { callback, interval: true });
|
|
950
|
+
const schedule = () => {
|
|
951
|
+
__call("fabric.$timer", { ms }).then(() => {
|
|
952
|
+
const entry = __timerCallbacks.get(id);
|
|
953
|
+
if (!entry) return;
|
|
954
|
+
try { entry.callback(); } catch { /* swallow timer callback errors */ }
|
|
955
|
+
if (__timerCallbacks.has(id)) schedule();
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
schedule();
|
|
959
|
+
return id;
|
|
960
|
+
};
|
|
961
|
+
globalThis.clearTimeout = (id) => { __timerCallbacks.delete(id); };
|
|
962
|
+
globalThis.clearInterval = (id) => { __timerCallbacks.delete(id); };
|
|
963
|
+
})();
|
|
964
|
+
`;
|
|
965
|
+
var formatValue = (value) => {
|
|
966
|
+
if (typeof value === "string") return value;
|
|
967
|
+
if (value instanceof Error) return value.stack ?? value.message;
|
|
968
|
+
try {
|
|
969
|
+
return JSON.stringify(value);
|
|
970
|
+
} catch {
|
|
971
|
+
return String(value);
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
var jsonText = (value) => {
|
|
975
|
+
const serialized = JSON.stringify(value);
|
|
976
|
+
if (serialized === void 0) return "null";
|
|
977
|
+
return serialized;
|
|
978
|
+
};
|
|
979
|
+
var jsonHandle = (context, jsonObject, jsonParse, value) => {
|
|
980
|
+
if (value === void 0) return context.undefined;
|
|
981
|
+
if (value === null) return context.null;
|
|
982
|
+
if (typeof value === "string") return context.newString(value);
|
|
983
|
+
if (typeof value === "boolean") return value ? context.true : context.false;
|
|
984
|
+
if (typeof value === "number") {
|
|
985
|
+
return Number.isFinite(value) ? context.newNumber(value) : context.null;
|
|
986
|
+
}
|
|
987
|
+
const serialized = context.newString(jsonText(value));
|
|
988
|
+
try {
|
|
989
|
+
return context.unwrapResult(context.callFunction(jsonParse, jsonObject, serialized));
|
|
990
|
+
} finally {
|
|
991
|
+
serialized.dispose();
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
var HOST_TASK_SETTLE_GRACE_MS = 250;
|
|
995
|
+
var QUICKJS_MAX_STACK_SIZE_BYTES = 256 * 1024;
|
|
996
|
+
var QUICKJS_GC_LIST_ASSERTION = "list_empty(&rt->gc_obj_list)";
|
|
997
|
+
var disposeQuickJsContext = (context) => {
|
|
998
|
+
try {
|
|
999
|
+
context.dispose();
|
|
1000
|
+
} catch (error) {
|
|
1001
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1002
|
+
if (message.includes(QUICKJS_GC_LIST_ASSERTION) && message.includes("JS_FreeRuntime")) return;
|
|
1003
|
+
throw error;
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
var QuickJsRuntime = class {
|
|
1007
|
+
async execute(code, hostCall, options) {
|
|
1008
|
+
if (options.signal?.aborted) {
|
|
1009
|
+
return {
|
|
1010
|
+
value: void 0,
|
|
1011
|
+
logs: [],
|
|
1012
|
+
terminationReason: "aborted",
|
|
1013
|
+
error: "Execution cancelled"
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
const missingKeys = missingPayloadKeys(code, options.payloads);
|
|
1017
|
+
if (missingKeys.length > 0) {
|
|
1018
|
+
const provided = Object.keys(options.payloads ?? {});
|
|
1019
|
+
return {
|
|
1020
|
+
value: void 0,
|
|
1021
|
+
logs: [],
|
|
1022
|
+
terminationReason: "runtime_error",
|
|
1023
|
+
error: "Pre-execution check: " + missingKeys.map((key) => "payloads." + key).join(", ") + (missingKeys.length === 1 ? " is referenced in code but its key is missing from the payloads parameter" : " are referenced in code but their keys are missing from the payloads parameter") + (provided.length ? " (provided: " + provided.join(", ") + ")" : " (none provided)") + ". Add payloads: { " + missingKeys.join(": '...', ") + ": '...' } to the fabric_exec arguments, then reference the value as payloads.<key>. For large or quote-heavy content, keep it in top-level payloads and reference payloads.<key> instead of escaping it inside code."
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
if (!Number.isSafeInteger(options.memoryLimitBytes) || options.memoryLimitBytes < 1 || options.memoryLimitBytes > 4294967295) {
|
|
1027
|
+
return {
|
|
1028
|
+
value: void 0,
|
|
1029
|
+
logs: [],
|
|
1030
|
+
terminationReason: "runtime_error",
|
|
1031
|
+
error: "QuickJS memory limit must be an integer between 1 byte and 4294967295 bytes (WASM32 maximum)"
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
const module = await quickJsModule();
|
|
1035
|
+
const context = module.newContext();
|
|
1036
|
+
const runtime = context.runtime;
|
|
1037
|
+
const jsonObject = context.getProp(context.global, "JSON");
|
|
1038
|
+
const jsonParse = context.getProp(jsonObject, "parse");
|
|
1039
|
+
const executionStartedAt = Date.now();
|
|
1040
|
+
let effectiveTimeoutMs = options.timeoutMs;
|
|
1041
|
+
let executionDeadlineAt = executionStartedAt + effectiveTimeoutMs;
|
|
1042
|
+
let interruptedByDeadline = false;
|
|
1043
|
+
runtime.setMemoryLimit(options.memoryLimitBytes);
|
|
1044
|
+
runtime.setMaxStackSize(QUICKJS_MAX_STACK_SIZE_BYTES);
|
|
1045
|
+
runtime.setInterruptHandler(() => {
|
|
1046
|
+
if (options.signal?.aborted === true) return true;
|
|
1047
|
+
if (Date.now() <= executionDeadlineAt) return false;
|
|
1048
|
+
interruptedByDeadline = true;
|
|
1049
|
+
return true;
|
|
1050
|
+
});
|
|
1051
|
+
const logs = [];
|
|
1052
|
+
const maxLogChars = options.maxLogChars ?? 1e5;
|
|
1053
|
+
let logChars = 0;
|
|
1054
|
+
let logsTruncated = false;
|
|
1055
|
+
const pendingHostPromises = /* @__PURE__ */ new Set();
|
|
1056
|
+
const hostTasks = /* @__PURE__ */ new Set();
|
|
1057
|
+
const pendingTimers = /* @__PURE__ */ new Set();
|
|
1058
|
+
let closing = false;
|
|
1059
|
+
let cancelled = false;
|
|
1060
|
+
let timedOut = false;
|
|
1061
|
+
let timeout;
|
|
1062
|
+
let rejectDeadline;
|
|
1063
|
+
let abortHandler;
|
|
1064
|
+
let activePromiseHandle;
|
|
1065
|
+
let executionGate;
|
|
1066
|
+
let pendingResolution;
|
|
1067
|
+
const hostAbortController = new AbortController();
|
|
1068
|
+
const abortHostCalls = (reason) => {
|
|
1069
|
+
if (!hostAbortController.signal.aborted) {
|
|
1070
|
+
hostAbortController.abort(new Error(reason));
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
const rejectExecutionGate = (message) => {
|
|
1074
|
+
if (!executionGate || executionGate.alive === false) return;
|
|
1075
|
+
const errorHandle = context.newError(message);
|
|
1076
|
+
executionGate.reject(errorHandle);
|
|
1077
|
+
errorHandle.dispose();
|
|
1078
|
+
runtime.executePendingJobs();
|
|
1079
|
+
};
|
|
1080
|
+
const timeoutMessage = () => `Execution timed out after ${effectiveTimeoutMs}ms`;
|
|
1081
|
+
const expireDeadline = () => {
|
|
1082
|
+
if (closing || cancelled || timedOut) return;
|
|
1083
|
+
timedOut = true;
|
|
1084
|
+
const message = timeoutMessage();
|
|
1085
|
+
abortHostCalls(message);
|
|
1086
|
+
rejectExecutionGate(message);
|
|
1087
|
+
rejectDeadline?.(new Error(message));
|
|
1088
|
+
};
|
|
1089
|
+
const scheduleDeadline = () => {
|
|
1090
|
+
if (!rejectDeadline || closing || cancelled || timedOut) return;
|
|
1091
|
+
if (timeout) clearTimeout(timeout);
|
|
1092
|
+
timeout = setTimeout(expireDeadline, Math.max(0, executionDeadlineAt - Date.now()));
|
|
1093
|
+
};
|
|
1094
|
+
const extendExecutionTimeout = (ref, args) => {
|
|
1095
|
+
const requestedTimeoutMs = options.minimumTimeoutMsForHostCall?.(ref, args);
|
|
1096
|
+
if (typeof requestedTimeoutMs !== "number" || !Number.isFinite(requestedTimeoutMs)) {
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
const requestedDurationMs = Math.max(1, Math.floor(requestedTimeoutMs));
|
|
1100
|
+
const nextDeadlineAt = Date.now() + requestedDurationMs;
|
|
1101
|
+
const nextTimeoutMs = nextDeadlineAt - executionStartedAt;
|
|
1102
|
+
if (nextDeadlineAt <= executionDeadlineAt) return;
|
|
1103
|
+
effectiveTimeoutMs = nextTimeoutMs;
|
|
1104
|
+
executionDeadlineAt = nextDeadlineAt;
|
|
1105
|
+
scheduleDeadline();
|
|
1106
|
+
};
|
|
1107
|
+
try {
|
|
1108
|
+
const hostFunction = context.newFunction(
|
|
1109
|
+
"__fabricHostCall",
|
|
1110
|
+
(referenceHandle, argsHandle) => {
|
|
1111
|
+
const reference = context.getString(referenceHandle);
|
|
1112
|
+
const dumpedArgs = context.dump(argsHandle);
|
|
1113
|
+
const args = typeof dumpedArgs === "object" && dumpedArgs !== null && !Array.isArray(dumpedArgs) ? dumpedArgs : {};
|
|
1114
|
+
extendExecutionTimeout(reference, args);
|
|
1115
|
+
const promise = context.newPromise();
|
|
1116
|
+
pendingHostPromises.add(promise);
|
|
1117
|
+
void promise.settled.then(() => pendingHostPromises.delete(promise));
|
|
1118
|
+
if (reference === "fabric.$timer") {
|
|
1119
|
+
const ms = Math.max(0, Number(args.ms ?? 0));
|
|
1120
|
+
const timer = setTimeout(() => {
|
|
1121
|
+
if (closing || promise.alive === false) return;
|
|
1122
|
+
promise.resolve(context.undefined);
|
|
1123
|
+
runtime.executePendingJobs();
|
|
1124
|
+
}, ms);
|
|
1125
|
+
timer.unref?.();
|
|
1126
|
+
pendingTimers.add(timer);
|
|
1127
|
+
void promise.settled.then(() => pendingTimers.delete(timer));
|
|
1128
|
+
return promise.handle;
|
|
1129
|
+
}
|
|
1130
|
+
const task = runAbortable(
|
|
1131
|
+
hostAbortController.signal,
|
|
1132
|
+
() => hostCall(reference, args, hostAbortController.signal)
|
|
1133
|
+
).then((value2) => {
|
|
1134
|
+
if (closing || promise.alive === false) return;
|
|
1135
|
+
const handle = jsonHandle(context, jsonObject, jsonParse, value2);
|
|
1136
|
+
promise.resolve(handle);
|
|
1137
|
+
handle.dispose();
|
|
1138
|
+
}).catch((error) => {
|
|
1139
|
+
if (closing || promise.alive === false) return;
|
|
1140
|
+
const errorHandle = context.newError(
|
|
1141
|
+
error instanceof Error ? error.message : String(error)
|
|
1142
|
+
);
|
|
1143
|
+
const exit = reference === "omp.bash" ? ompBashExitMetadata(error) : void 0;
|
|
1144
|
+
if (exit) {
|
|
1145
|
+
const metadata = jsonHandle(context, jsonObject, jsonParse, exit);
|
|
1146
|
+
context.setProp(errorHandle, "__fabricBashExit", metadata);
|
|
1147
|
+
metadata.dispose();
|
|
1148
|
+
}
|
|
1149
|
+
promise.reject(errorHandle);
|
|
1150
|
+
errorHandle.dispose();
|
|
1151
|
+
}).finally(() => {
|
|
1152
|
+
if (!closing) runtime.executePendingJobs();
|
|
1153
|
+
});
|
|
1154
|
+
hostTasks.add(task);
|
|
1155
|
+
void task.finally(() => hostTasks.delete(task));
|
|
1156
|
+
return promise.handle;
|
|
1157
|
+
}
|
|
1158
|
+
);
|
|
1159
|
+
context.setProp(context.global, "__fabricHostCall", hostFunction);
|
|
1160
|
+
hostFunction.dispose();
|
|
1161
|
+
const printFunction = context.newFunction("print", (...handles) => {
|
|
1162
|
+
if (logsTruncated) return;
|
|
1163
|
+
const line = handles.map((handle) => formatValue(context.dump(handle))).join(" ");
|
|
1164
|
+
const remaining = maxLogChars - logChars;
|
|
1165
|
+
if (line.length > remaining) {
|
|
1166
|
+
if (remaining > 0) logs.push(line.slice(0, remaining));
|
|
1167
|
+
logs.push("[OMP Fabric log output truncated]");
|
|
1168
|
+
logsTruncated = true;
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
logs.push(line);
|
|
1172
|
+
logChars += line.length;
|
|
1173
|
+
});
|
|
1174
|
+
context.setProp(context.global, "print", printFunction);
|
|
1175
|
+
printFunction.dispose();
|
|
1176
|
+
const payloads = jsonHandle(context, jsonObject, jsonParse, options.payloads ?? {});
|
|
1177
|
+
context.setProp(context.global, "payloads", payloads);
|
|
1178
|
+
payloads.dispose();
|
|
1179
|
+
const tokenBudget = context.newNumber(options.tokenBudget ?? Number.POSITIVE_INFINITY);
|
|
1180
|
+
context.setProp(context.global, "__fabricTokenBudget", tokenBudget);
|
|
1181
|
+
tokenBudget.dispose();
|
|
1182
|
+
const setupResult = context.evalCode(GUEST_SETUP, "omp-fabric-setup.js");
|
|
1183
|
+
if (setupResult.error) {
|
|
1184
|
+
const deadlineExceeded = interruptedByDeadline || Date.now() > executionDeadlineAt;
|
|
1185
|
+
if (deadlineExceeded) timedOut = true;
|
|
1186
|
+
const error = options.signal?.aborted ? "Execution cancelled" : deadlineExceeded ? timeoutMessage() : formatValue(context.dump(setupResult.error));
|
|
1187
|
+
setupResult.error.dispose();
|
|
1188
|
+
abortHostCalls(error);
|
|
1189
|
+
return {
|
|
1190
|
+
value: void 0,
|
|
1191
|
+
logs,
|
|
1192
|
+
terminationReason: options.signal?.aborted ? "aborted" : deadlineExceeded ? "timed_out" : "runtime_error",
|
|
1193
|
+
error
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
setupResult.value.dispose();
|
|
1197
|
+
executionGate = context.newPromise();
|
|
1198
|
+
context.setProp(context.global, "__fabricExecutionGate", executionGate.handle);
|
|
1199
|
+
const guestBundle = options.transpiledCode === void 0 ? transpileFabricCodeWithSourceMap(code) : { code: options.transpiledCode, sourceMap: options.transpiledSourceMap };
|
|
1200
|
+
const guestStackMap = createGuestStackMap(guestBundle.sourceMap);
|
|
1201
|
+
const guestLineCount = guestBundle.code.split("\n").length;
|
|
1202
|
+
const wrappedCode = `${guestBundle.code}
|
|
1203
|
+
Promise.race([${OMP_GUEST_ENTRYPOINT}(), globalThis.__fabricExecutionGate])`;
|
|
1204
|
+
const evaluation = context.evalCode(wrappedCode, "omp-fabric-guest.js");
|
|
1205
|
+
runtime.executePendingJobs();
|
|
1206
|
+
if (evaluation.error) {
|
|
1207
|
+
const deadlineExceeded = interruptedByDeadline || Date.now() > executionDeadlineAt;
|
|
1208
|
+
if (deadlineExceeded) timedOut = true;
|
|
1209
|
+
const error = options.signal?.aborted ? "Execution cancelled" : deadlineExceeded ? timeoutMessage() : remapGuestErrorText(formatValue(context.dump(evaluation.error)), guestStackMap, guestLineCount);
|
|
1210
|
+
evaluation.error.dispose();
|
|
1211
|
+
abortHostCalls(error);
|
|
1212
|
+
return {
|
|
1213
|
+
value: void 0,
|
|
1214
|
+
logs,
|
|
1215
|
+
terminationReason: options.signal?.aborted ? "aborted" : deadlineExceeded ? "timed_out" : "runtime_error",
|
|
1216
|
+
error
|
|
1217
|
+
};
|
|
1218
|
+
}
|
|
1219
|
+
activePromiseHandle = evaluation.value;
|
|
1220
|
+
const cancellation = new Promise((_resolve, reject) => {
|
|
1221
|
+
abortHandler = () => {
|
|
1222
|
+
cancelled = true;
|
|
1223
|
+
hostAbortController.abort(options.signal?.reason);
|
|
1224
|
+
rejectExecutionGate("Execution cancelled");
|
|
1225
|
+
reject(new Error("Execution cancelled"));
|
|
1226
|
+
};
|
|
1227
|
+
if (options.signal?.aborted) abortHandler();
|
|
1228
|
+
else options.signal?.addEventListener("abort", abortHandler, { once: true });
|
|
1229
|
+
});
|
|
1230
|
+
void cancellation.catch(() => void 0);
|
|
1231
|
+
const deadline = new Promise((_resolve, reject) => {
|
|
1232
|
+
rejectDeadline = reject;
|
|
1233
|
+
scheduleDeadline();
|
|
1234
|
+
});
|
|
1235
|
+
pendingResolution = context.resolvePromise(activePromiseHandle);
|
|
1236
|
+
runtime.executePendingJobs();
|
|
1237
|
+
const resolution = await Promise.race([pendingResolution, deadline, cancellation]);
|
|
1238
|
+
pendingResolution = void 0;
|
|
1239
|
+
activePromiseHandle.dispose();
|
|
1240
|
+
activePromiseHandle = void 0;
|
|
1241
|
+
if (resolution.error) {
|
|
1242
|
+
const deadlineExceeded = timedOut || interruptedByDeadline || Date.now() > executionDeadlineAt;
|
|
1243
|
+
if (deadlineExceeded) timedOut = true;
|
|
1244
|
+
const error = options.signal?.aborted ? "Execution cancelled" : deadlineExceeded ? timeoutMessage() : remapGuestErrorText(formatValue(context.dump(resolution.error)), guestStackMap, guestLineCount);
|
|
1245
|
+
resolution.error.dispose();
|
|
1246
|
+
abortHostCalls(error);
|
|
1247
|
+
return {
|
|
1248
|
+
value: void 0,
|
|
1249
|
+
logs,
|
|
1250
|
+
terminationReason: options.signal?.aborted ? "aborted" : deadlineExceeded ? "timed_out" : "runtime_error",
|
|
1251
|
+
error
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
const value = context.dump(resolution.value);
|
|
1255
|
+
resolution.value.dispose();
|
|
1256
|
+
return { value, logs, terminationReason: "completed" };
|
|
1257
|
+
} catch (error) {
|
|
1258
|
+
const deadlineExceeded = timedOut || interruptedByDeadline || Date.now() > executionDeadlineAt;
|
|
1259
|
+
if (deadlineExceeded) timedOut = true;
|
|
1260
|
+
abortHostCalls(error instanceof Error ? error.message : String(error));
|
|
1261
|
+
return {
|
|
1262
|
+
value: void 0,
|
|
1263
|
+
logs,
|
|
1264
|
+
terminationReason: cancelled ? "aborted" : deadlineExceeded ? "timed_out" : "runtime_error",
|
|
1265
|
+
error: cancelled ? "Execution cancelled" : deadlineExceeded ? timeoutMessage() : error instanceof Error ? error.message : String(error)
|
|
1266
|
+
};
|
|
1267
|
+
} finally {
|
|
1268
|
+
if (timeout) clearTimeout(timeout);
|
|
1269
|
+
for (const timer of pendingTimers) clearTimeout(timer);
|
|
1270
|
+
if (abortHandler) options.signal?.removeEventListener("abort", abortHandler);
|
|
1271
|
+
if (hostTasks.size > 0) {
|
|
1272
|
+
const settled = await settleWithin(hostTasks, HOST_TASK_SETTLE_GRACE_MS);
|
|
1273
|
+
if (!settled) {
|
|
1274
|
+
abortHostCalls("Fabric guest execution ended before its host calls settled");
|
|
1275
|
+
await settleWithin(hostTasks, HOST_TASK_SETTLE_GRACE_MS);
|
|
1276
|
+
}
|
|
1277
|
+
runtime.executePendingJobs();
|
|
1278
|
+
}
|
|
1279
|
+
closing = true;
|
|
1280
|
+
if (timedOut || cancelled || pendingHostPromises.size > 0) {
|
|
1281
|
+
const cleanupMessage = cancelled ? "Execution cancelled" : timedOut ? timeoutMessage() : "Fabric guest execution ended before its host calls settled";
|
|
1282
|
+
if (!hostAbortController.signal.aborted) hostAbortController.abort(new Error(cleanupMessage));
|
|
1283
|
+
rejectExecutionGate(cleanupMessage);
|
|
1284
|
+
const errorHandle = context.newError(cleanupMessage);
|
|
1285
|
+
for (const promise of pendingHostPromises) promise.reject(errorHandle);
|
|
1286
|
+
errorHandle.dispose();
|
|
1287
|
+
runtime.executePendingJobs();
|
|
1288
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
1289
|
+
const settled = await Promise.race([
|
|
1290
|
+
pendingResolution ? pendingResolution.catch(() => void 0) : Promise.resolve(void 0),
|
|
1291
|
+
new Promise((resolve) => {
|
|
1292
|
+
const timer = setTimeout(() => resolve(void 0), 1e3);
|
|
1293
|
+
timer.unref?.();
|
|
1294
|
+
})
|
|
1295
|
+
]);
|
|
1296
|
+
if (settled?.error) settled.error.dispose();
|
|
1297
|
+
if (settled?.value) settled.value.dispose();
|
|
1298
|
+
for (const promise of pendingHostPromises) {
|
|
1299
|
+
if (promise.alive !== false) promise.dispose();
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
if (activePromiseHandle?.alive !== false) activePromiseHandle?.dispose();
|
|
1303
|
+
if (executionGate?.alive !== false) executionGate?.dispose();
|
|
1304
|
+
runtime.executePendingJobs();
|
|
1305
|
+
jsonParse.dispose();
|
|
1306
|
+
jsonObject.dispose();
|
|
1307
|
+
disposeQuickJsContext(context);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
};
|
|
1311
|
+
|
|
1312
|
+
export {
|
|
1313
|
+
createGuestStackMap,
|
|
1314
|
+
remapGuestErrorText,
|
|
1315
|
+
GUEST_SETUP,
|
|
1316
|
+
QuickJsRuntime
|
|
1317
|
+
};
|
|
1318
|
+
//# sourceMappingURL=chunk-5GTPD4BA.js.map
|