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,784 @@
|
|
|
1
|
+
// src/ui/conversation-native-reader.ts
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
var isCustomMessageContent = (content) => typeof content === "string" || Array.isArray(content);
|
|
4
|
+
var customMessageFromEntry = (entry) => ({
|
|
5
|
+
role: "custom",
|
|
6
|
+
customType: entry.customType,
|
|
7
|
+
content: entry.content,
|
|
8
|
+
display: entry.display,
|
|
9
|
+
...entry.details !== void 0 ? { details: entry.details } : {},
|
|
10
|
+
...entry.attribution !== void 0 ? { attribution: entry.attribution } : {},
|
|
11
|
+
timestamp: new Date(entry.timestamp).getTime()
|
|
12
|
+
});
|
|
13
|
+
var compactionSummaryMessage = (entry) => ({
|
|
14
|
+
role: "compactionSummary",
|
|
15
|
+
summary: entry.summary,
|
|
16
|
+
...entry.shortSummary !== void 0 ? { shortSummary: entry.shortSummary } : {},
|
|
17
|
+
tokensBefore: entry.tokensBefore,
|
|
18
|
+
...entry.tokensAfter !== void 0 ? { tokensAfter: entry.tokensAfter } : {},
|
|
19
|
+
...entry.method !== void 0 ? { method: entry.method } : {},
|
|
20
|
+
...entry.warning !== void 0 ? { warning: entry.warning } : {},
|
|
21
|
+
timestamp: new Date(entry.timestamp).getTime()
|
|
22
|
+
});
|
|
23
|
+
var branchSummaryMessage = (entry) => ({
|
|
24
|
+
role: "branchSummary",
|
|
25
|
+
summary: entry.summary,
|
|
26
|
+
fromId: entry.fromId,
|
|
27
|
+
timestamp: new Date(entry.timestamp).getTime()
|
|
28
|
+
});
|
|
29
|
+
var buildContextEntries = (entries, leafId, byId) => {
|
|
30
|
+
const path = [];
|
|
31
|
+
const seen = /* @__PURE__ */ new Set();
|
|
32
|
+
let current = byId.get(leafId);
|
|
33
|
+
while (current && !seen.has(current.id)) {
|
|
34
|
+
seen.add(current.id);
|
|
35
|
+
path.push(current);
|
|
36
|
+
current = current.parentId ? byId.get(current.parentId) : void 0;
|
|
37
|
+
}
|
|
38
|
+
path.reverse();
|
|
39
|
+
let compactionIdx = -1;
|
|
40
|
+
for (let index = 0; index < path.length; index++) {
|
|
41
|
+
if (path[index]?.type === "compaction") compactionIdx = index;
|
|
42
|
+
}
|
|
43
|
+
if (compactionIdx < 0) return path;
|
|
44
|
+
const compaction = path[compactionIdx];
|
|
45
|
+
const keptStart = path.findIndex((candidate) => candidate.id === compaction.firstKeptEntryId);
|
|
46
|
+
const kept = keptStart >= 0 ? path.slice(keptStart, compactionIdx) : [];
|
|
47
|
+
return [compaction, ...kept, ...path.slice(compactionIdx + 1)];
|
|
48
|
+
};
|
|
49
|
+
var buildSessionContext = (entries, leafId, byId) => {
|
|
50
|
+
const messages = [];
|
|
51
|
+
let activeSummaryEmitted = false;
|
|
52
|
+
for (const entry of buildContextEntries(entries, leafId, byId)) {
|
|
53
|
+
if (entry.type === "message") {
|
|
54
|
+
messages.push(entry.message);
|
|
55
|
+
} else if (entry.type === "compaction") {
|
|
56
|
+
if (activeSummaryEmitted) continue;
|
|
57
|
+
activeSummaryEmitted = true;
|
|
58
|
+
messages.push(compactionSummaryMessage(entry));
|
|
59
|
+
} else if (entry.type === "custom_message") {
|
|
60
|
+
if (isCustomMessageContent(entry.content)) messages.push(customMessageFromEntry(entry));
|
|
61
|
+
} else if (entry.type === "branch_summary" && entry.summary) {
|
|
62
|
+
messages.push(branchSummaryMessage(entry));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { messages };
|
|
66
|
+
};
|
|
67
|
+
var INITIAL_PAGE_BYTES = 256 * 1024;
|
|
68
|
+
var OLDER_PAGE_BYTES = 256 * 1024;
|
|
69
|
+
var GROWTH_PAGE_BYTES = 1024 * 1024;
|
|
70
|
+
var MAX_PAGE_BYTES = 64 * 1024 * 1024;
|
|
71
|
+
var CLASSIFY_PROBE_BYTES = 4096;
|
|
72
|
+
var SESSION_CLASSIFY_SCAN_LINES = 8;
|
|
73
|
+
var MAX_ERROR_CHARS = 200;
|
|
74
|
+
var emptyUsage = () => ({
|
|
75
|
+
input: 0,
|
|
76
|
+
output: 0,
|
|
77
|
+
cacheRead: 0,
|
|
78
|
+
cacheWrite: 0,
|
|
79
|
+
totalTokens: 0,
|
|
80
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
81
|
+
});
|
|
82
|
+
var parseRecord = (raw) => {
|
|
83
|
+
try {
|
|
84
|
+
const parsed = JSON.parse(raw);
|
|
85
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return void 0;
|
|
86
|
+
return parsed;
|
|
87
|
+
} catch {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var isSessionEntry = (value) => typeof value === "object" && value !== null && typeof value.type === "string" && typeof value.id === "string" && (value.parentId === null || typeof value.parentId === "string");
|
|
92
|
+
var messageFingerprint = (message) => {
|
|
93
|
+
if ("content" in message) return JSON.stringify(message.content);
|
|
94
|
+
if ("summary" in message) return JSON.stringify(message.summary);
|
|
95
|
+
return "";
|
|
96
|
+
};
|
|
97
|
+
var messageKey = (message) => {
|
|
98
|
+
if (message.role === "toolResult") return `toolResult:${message.toolCallId}`;
|
|
99
|
+
if (message.role === "assistant") {
|
|
100
|
+
const calls = message.content.filter((block) => block.type === "toolCall").map((block) => block.id);
|
|
101
|
+
if (calls.length > 0) return `assistant:${message.timestamp}:calls:${calls.join(",")}`;
|
|
102
|
+
}
|
|
103
|
+
return `${message.role}:${message.timestamp}:${messageFingerprint(message)}`;
|
|
104
|
+
};
|
|
105
|
+
var clipError = (error) => {
|
|
106
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
107
|
+
return text.length > MAX_ERROR_CHARS ? `${text.slice(0, MAX_ERROR_CHARS)}\u2026` : text;
|
|
108
|
+
};
|
|
109
|
+
var readBackwardPage = (descriptor, end, budget, includeFinalPartialLine) => {
|
|
110
|
+
let windowBudget = Math.min(Math.max(budget, 1), MAX_PAGE_BYTES);
|
|
111
|
+
for (; ; ) {
|
|
112
|
+
const candidate = Math.max(0, end - windowBudget);
|
|
113
|
+
const buffer = Buffer.allocUnsafe(end - candidate);
|
|
114
|
+
const bytesRead = fs.readSync(descriptor, buffer, 0, buffer.length, candidate);
|
|
115
|
+
const data = buffer.subarray(0, Math.max(0, bytesRead));
|
|
116
|
+
if (data.length === 0) return { start: candidate, end: candidate, records: [] };
|
|
117
|
+
const firstNewline = data.indexOf(10);
|
|
118
|
+
if (firstNewline === -1) {
|
|
119
|
+
if (candidate === 0) {
|
|
120
|
+
const raw = data.toString("utf8").replace(/\r$/, "");
|
|
121
|
+
return { start: 0, end, records: raw ? [raw] : [] };
|
|
122
|
+
}
|
|
123
|
+
if (windowBudget >= MAX_PAGE_BYTES) return { start: end, end, records: [] };
|
|
124
|
+
windowBudget = Math.min(windowBudget * 2, MAX_PAGE_BYTES);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
const alignStart = candidate > 0 ? firstNewline + 1 : 0;
|
|
128
|
+
const records = [];
|
|
129
|
+
let lineStart = alignStart;
|
|
130
|
+
let lastComplete = alignStart;
|
|
131
|
+
for (let index = alignStart; index < data.length; index++) {
|
|
132
|
+
if (data[index] !== 10) continue;
|
|
133
|
+
const raw = data.subarray(lineStart, index).toString("utf8").replace(/\r$/, "");
|
|
134
|
+
if (raw) records.push(raw);
|
|
135
|
+
lineStart = index + 1;
|
|
136
|
+
lastComplete = lineStart;
|
|
137
|
+
}
|
|
138
|
+
if (records.length === 0 && candidate > 0) {
|
|
139
|
+
if (windowBudget >= MAX_PAGE_BYTES) return { start: end, end, records: [] };
|
|
140
|
+
windowBudget = Math.min(windowBudget * 2, MAX_PAGE_BYTES);
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
let endOffset = end;
|
|
144
|
+
if (lastComplete < data.length) {
|
|
145
|
+
const tail = data.subarray(lastComplete).toString("utf8").replace(/\r$/, "");
|
|
146
|
+
if (includeFinalPartialLine && tail && parseRecord(tail)) {
|
|
147
|
+
records.push(tail);
|
|
148
|
+
} else {
|
|
149
|
+
endOffset = candidate + lastComplete;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { start: candidate + alignStart, end: endOffset, records };
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
var readForwardPage = (descriptor, start, size, budget) => {
|
|
156
|
+
let windowBudget = Math.min(Math.max(budget, 1), MAX_PAGE_BYTES);
|
|
157
|
+
for (; ; ) {
|
|
158
|
+
const limit = Math.min(size, start + windowBudget);
|
|
159
|
+
if (limit <= start) return { start, end: start, records: [] };
|
|
160
|
+
const buffer = Buffer.allocUnsafe(limit - start);
|
|
161
|
+
const bytesRead = fs.readSync(descriptor, buffer, 0, buffer.length, start);
|
|
162
|
+
const data = buffer.subarray(0, Math.max(0, bytesRead));
|
|
163
|
+
if (data.length === 0) return { start, end: start, records: [] };
|
|
164
|
+
const records = [];
|
|
165
|
+
let lineStart = 0;
|
|
166
|
+
let lastComplete = 0;
|
|
167
|
+
for (let index = 0; index < data.length; index++) {
|
|
168
|
+
if (data[index] !== 10) continue;
|
|
169
|
+
const raw = data.subarray(lineStart, index).toString("utf8").replace(/\r$/, "");
|
|
170
|
+
if (raw) records.push(raw);
|
|
171
|
+
lineStart = index + 1;
|
|
172
|
+
lastComplete = lineStart;
|
|
173
|
+
}
|
|
174
|
+
if (lastComplete < data.length) {
|
|
175
|
+
const tail = data.subarray(lastComplete).toString("utf8").replace(/\r$/, "");
|
|
176
|
+
if (limit >= size && tail && parseRecord(tail)) {
|
|
177
|
+
records.push(tail);
|
|
178
|
+
lastComplete = data.length;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (lastComplete === 0 && limit < size) {
|
|
182
|
+
if (windowBudget >= MAX_PAGE_BYTES) return { start, end: start, records: [] };
|
|
183
|
+
windowBudget = Math.min(windowBudget * 2, MAX_PAGE_BYTES);
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
return { start, end: start + lastComplete, records };
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var classifyFile = (filePath) => {
|
|
190
|
+
let descriptor;
|
|
191
|
+
try {
|
|
192
|
+
const noFollow = typeof fs.constants.O_NOFOLLOW === "number" ? fs.constants.O_NOFOLLOW : 0;
|
|
193
|
+
descriptor = fs.openSync(filePath, fs.constants.O_RDONLY | noFollow);
|
|
194
|
+
const stat = fs.fstatSync(descriptor);
|
|
195
|
+
if (!stat.isFile()) return "unreadable";
|
|
196
|
+
const buffer = Buffer.allocUnsafe(Math.max(1, Math.min(CLASSIFY_PROBE_BYTES, stat.size)));
|
|
197
|
+
const bytesRead = fs.readSync(descriptor, buffer, 0, buffer.length, 0);
|
|
198
|
+
const head = buffer.subarray(0, Math.max(0, bytesRead)).toString("utf8");
|
|
199
|
+
for (const line of head.split("\n").slice(0, SESSION_CLASSIFY_SCAN_LINES)) {
|
|
200
|
+
const parsed = parseRecord(line);
|
|
201
|
+
if (!parsed) continue;
|
|
202
|
+
if (parsed.type === "session") return "session";
|
|
203
|
+
if (parsed.type !== "title") break;
|
|
204
|
+
}
|
|
205
|
+
return "events";
|
|
206
|
+
} catch {
|
|
207
|
+
return "unreadable";
|
|
208
|
+
} finally {
|
|
209
|
+
if (descriptor !== void 0) closeQuietly(descriptor);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
var openDescriptor = (filePath) => {
|
|
213
|
+
try {
|
|
214
|
+
const noFollow = typeof fs.constants.O_NOFOLLOW === "number" ? fs.constants.O_NOFOLLOW : 0;
|
|
215
|
+
const descriptor = fs.openSync(filePath, fs.constants.O_RDONLY | noFollow);
|
|
216
|
+
const stat = fs.fstatSync(descriptor);
|
|
217
|
+
if (!stat.isFile()) {
|
|
218
|
+
closeQuietly(descriptor);
|
|
219
|
+
return { error: "not a regular file" };
|
|
220
|
+
}
|
|
221
|
+
return { descriptor, size: stat.size };
|
|
222
|
+
} catch (error) {
|
|
223
|
+
return { error: clipError(error) };
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var closeQuietly = (descriptor) => {
|
|
227
|
+
try {
|
|
228
|
+
fs.closeSync(descriptor);
|
|
229
|
+
} catch {
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
var NativeConversationReader = class {
|
|
233
|
+
#sourceId = "";
|
|
234
|
+
#status = "";
|
|
235
|
+
#sessionFile;
|
|
236
|
+
#eventsFile;
|
|
237
|
+
#entries = [];
|
|
238
|
+
#entryIds = /* @__PURE__ */ new Set();
|
|
239
|
+
#byId = /* @__PURE__ */ new Map();
|
|
240
|
+
#sessionEntryIds = /* @__PURE__ */ new Set();
|
|
241
|
+
#eventEntryIds = /* @__PURE__ */ new Set();
|
|
242
|
+
#sessionLeafId;
|
|
243
|
+
#eventLeafId;
|
|
244
|
+
#sessionId;
|
|
245
|
+
#streamed = /* @__PURE__ */ new Map();
|
|
246
|
+
#streamedOrder = [];
|
|
247
|
+
#partial;
|
|
248
|
+
#eventRecords = [];
|
|
249
|
+
#pendingMessages;
|
|
250
|
+
#partialArgsRaw = /* @__PURE__ */ new Map();
|
|
251
|
+
#tools = /* @__PURE__ */ new Map();
|
|
252
|
+
#windows = /* @__PURE__ */ new Map();
|
|
253
|
+
#followed = true;
|
|
254
|
+
#revision = 0;
|
|
255
|
+
#error;
|
|
256
|
+
#snapshot;
|
|
257
|
+
/** Last transcript produced; undefined before the first successful read. */
|
|
258
|
+
get last() {
|
|
259
|
+
return this.#snapshot;
|
|
260
|
+
}
|
|
261
|
+
read(source, followLatest = true) {
|
|
262
|
+
const sourceId = typeof source?.id === "string" ? source.id : "";
|
|
263
|
+
const status = typeof source?.status === "string" ? source.status : "";
|
|
264
|
+
const explicitSession = typeof source?.sessionFile === "string" && source.sessionFile ? source.sessionFile : void 0;
|
|
265
|
+
const explicitEvents = typeof source?.eventsFile === "string" && source.eventsFile ? source.eventsFile : void 0;
|
|
266
|
+
const logFile = typeof source?.logFile === "string" ? source.logFile : void 0;
|
|
267
|
+
let sessionFile = explicitSession;
|
|
268
|
+
let eventsFile = explicitEvents;
|
|
269
|
+
let logUnresolved = false;
|
|
270
|
+
if (logFile && logFile !== explicitSession && logFile !== explicitEvents) {
|
|
271
|
+
const kind = classifyFile(logFile);
|
|
272
|
+
if (kind === "session") sessionFile ??= logFile;
|
|
273
|
+
else if (kind === "events") eventsFile ??= logFile;
|
|
274
|
+
else logUnresolved = true;
|
|
275
|
+
}
|
|
276
|
+
if (sourceId !== this.#sourceId || sessionFile !== this.#sessionFile) {
|
|
277
|
+
this.#resetPaths(sourceId, status, sessionFile, eventsFile);
|
|
278
|
+
} else {
|
|
279
|
+
this.#status = status;
|
|
280
|
+
if (eventsFile !== this.#eventsFile) {
|
|
281
|
+
this.#eventsFile = eventsFile;
|
|
282
|
+
this.#resetEventsState();
|
|
283
|
+
this.#revision += 1;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (logUnresolved) {
|
|
287
|
+
this.#windows.set("events", { head: 0, tail: 0, size: 0, hasOlder: false, unavailable: true });
|
|
288
|
+
this.#setError(logFile ?? "source log unreadable");
|
|
289
|
+
}
|
|
290
|
+
this.#followed = followLatest !== false;
|
|
291
|
+
this.#ingest(this.#followed);
|
|
292
|
+
return this.#snapshot ?? this.#buildSnapshot();
|
|
293
|
+
}
|
|
294
|
+
/** Load older whole-record pages of history. Repeated calls load all of it. */
|
|
295
|
+
loadOlder(pages = 1) {
|
|
296
|
+
if (!this.#snapshot) return void 0;
|
|
297
|
+
for (let page = 0; page < Math.max(1, pages); page++) {
|
|
298
|
+
let progressed = false;
|
|
299
|
+
for (const [kind, filePath] of this.#windowFiles()) {
|
|
300
|
+
if (this.#loadOlderFile(kind, filePath)) progressed = true;
|
|
301
|
+
}
|
|
302
|
+
if (!progressed) break;
|
|
303
|
+
}
|
|
304
|
+
this.#revision += 1;
|
|
305
|
+
this.#snapshot = this.#buildSnapshot();
|
|
306
|
+
return this.#snapshot;
|
|
307
|
+
}
|
|
308
|
+
/** Consume any records newer than the current window (used when pinned). */
|
|
309
|
+
loadNewer() {
|
|
310
|
+
if (!this.#snapshot) return void 0;
|
|
311
|
+
this.#followed = true;
|
|
312
|
+
this.#ingest(true);
|
|
313
|
+
return this.#snapshot ?? void 0;
|
|
314
|
+
}
|
|
315
|
+
/** Drop the current windows and re-read from the tail of both files. */
|
|
316
|
+
loadLatest() {
|
|
317
|
+
if (!this.#snapshot) return void 0;
|
|
318
|
+
for (const [kind, filePath] of this.#windowFiles()) this.#initWindow(kind, filePath);
|
|
319
|
+
this.#followed = true;
|
|
320
|
+
this.#ingest(true);
|
|
321
|
+
return this.#snapshot ?? void 0;
|
|
322
|
+
}
|
|
323
|
+
/** Drop all cached state for a clean re-read. */
|
|
324
|
+
clear() {
|
|
325
|
+
this.#resetPaths("", "", void 0, void 0);
|
|
326
|
+
}
|
|
327
|
+
#windowFiles() {
|
|
328
|
+
const files = [];
|
|
329
|
+
if (this.#sessionFile) files.push(["session", this.#sessionFile]);
|
|
330
|
+
if (this.#eventsFile) files.push(["events", this.#eventsFile]);
|
|
331
|
+
return files;
|
|
332
|
+
}
|
|
333
|
+
#setError(detail) {
|
|
334
|
+
this.#error = clipError(detail);
|
|
335
|
+
}
|
|
336
|
+
#resetPaths(sourceId, status, sessionFile, eventsFile) {
|
|
337
|
+
this.#sourceId = sourceId;
|
|
338
|
+
this.#status = status;
|
|
339
|
+
this.#sessionFile = sessionFile;
|
|
340
|
+
this.#eventsFile = eventsFile;
|
|
341
|
+
this.#entries = [];
|
|
342
|
+
this.#entryIds.clear();
|
|
343
|
+
this.#byId.clear();
|
|
344
|
+
this.#sessionEntryIds.clear();
|
|
345
|
+
this.#eventEntryIds.clear();
|
|
346
|
+
this.#sessionLeafId = void 0;
|
|
347
|
+
this.#eventLeafId = void 0;
|
|
348
|
+
this.#sessionId = void 0;
|
|
349
|
+
this.#eventRecords = [];
|
|
350
|
+
this.#resetStreamingState();
|
|
351
|
+
this.#windows.clear();
|
|
352
|
+
this.#revision = 0;
|
|
353
|
+
this.#error = void 0;
|
|
354
|
+
this.#snapshot = void 0;
|
|
355
|
+
for (const [kind, filePath] of this.#windowFiles()) this.#initWindow(kind, filePath);
|
|
356
|
+
}
|
|
357
|
+
#resetStreamingState() {
|
|
358
|
+
this.#pendingMessages = void 0;
|
|
359
|
+
this.#streamed.clear();
|
|
360
|
+
this.#streamedOrder = [];
|
|
361
|
+
this.#partial = void 0;
|
|
362
|
+
this.#partialArgsRaw.clear();
|
|
363
|
+
this.#tools.clear();
|
|
364
|
+
}
|
|
365
|
+
#resetEventsState() {
|
|
366
|
+
this.#eventRecords = [];
|
|
367
|
+
this.#resetStreamingState();
|
|
368
|
+
this.#eventLeafId = void 0;
|
|
369
|
+
for (const id of this.#eventEntryIds) {
|
|
370
|
+
if (this.#sessionEntryIds.has(id)) continue;
|
|
371
|
+
this.#entryIds.delete(id);
|
|
372
|
+
const entry = this.#byId.get(id);
|
|
373
|
+
if (entry) {
|
|
374
|
+
this.#byId.delete(id);
|
|
375
|
+
const index = this.#entries.indexOf(entry);
|
|
376
|
+
if (index >= 0) this.#entries.splice(index, 1);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
this.#eventEntryIds.clear();
|
|
380
|
+
this.#windows.delete("events");
|
|
381
|
+
this.#error = void 0;
|
|
382
|
+
if (this.#eventsFile) this.#initWindow("events", this.#eventsFile);
|
|
383
|
+
}
|
|
384
|
+
#initWindow(kind, filePath) {
|
|
385
|
+
const opened = openDescriptor(filePath);
|
|
386
|
+
if (!opened || "error" in opened) {
|
|
387
|
+
this.#windows.set(kind, {
|
|
388
|
+
head: 0,
|
|
389
|
+
tail: 0,
|
|
390
|
+
size: 0,
|
|
391
|
+
hasOlder: false,
|
|
392
|
+
unavailable: true
|
|
393
|
+
});
|
|
394
|
+
if (opened && "error" in opened) this.#setError(`${filePath}: ${opened.error}`);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
try {
|
|
398
|
+
const page = readBackwardPage(opened.descriptor, opened.size, INITIAL_PAGE_BYTES, kind === "events");
|
|
399
|
+
this.#applyRecords(kind, page.records, true);
|
|
400
|
+
this.#windows.set(kind, {
|
|
401
|
+
head: page.start,
|
|
402
|
+
tail: page.end,
|
|
403
|
+
size: opened.size,
|
|
404
|
+
hasOlder: page.start > 0,
|
|
405
|
+
unavailable: false
|
|
406
|
+
});
|
|
407
|
+
} catch (error) {
|
|
408
|
+
this.#windows.set(kind, {
|
|
409
|
+
head: 0,
|
|
410
|
+
tail: 0,
|
|
411
|
+
size: 0,
|
|
412
|
+
hasOlder: false,
|
|
413
|
+
unavailable: true
|
|
414
|
+
});
|
|
415
|
+
this.#setError(`${filePath}: ${clipError(error)}`);
|
|
416
|
+
} finally {
|
|
417
|
+
closeQuietly(opened.descriptor);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
#loadOlderFile(kind, filePath) {
|
|
421
|
+
const window = this.#windows.get(kind);
|
|
422
|
+
if (!window || !window.hasOlder || window.head <= 0) return false;
|
|
423
|
+
const opened = openDescriptor(filePath);
|
|
424
|
+
if (!opened) return false;
|
|
425
|
+
if ("error" in opened) {
|
|
426
|
+
window.unavailable = true;
|
|
427
|
+
this.#setError(`${filePath}: ${opened.error}`);
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
try {
|
|
431
|
+
const page = readBackwardPage(opened.descriptor, window.head, OLDER_PAGE_BYTES, false);
|
|
432
|
+
if (page.start >= window.head) return false;
|
|
433
|
+
this.#applyRecords(kind, page.records, false);
|
|
434
|
+
window.head = page.start;
|
|
435
|
+
window.hasOlder = page.start > 0;
|
|
436
|
+
window.unavailable = false;
|
|
437
|
+
return true;
|
|
438
|
+
} finally {
|
|
439
|
+
closeQuietly(opened.descriptor);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
#growFile(kind, filePath, followLatest) {
|
|
443
|
+
const window = this.#windows.get(kind);
|
|
444
|
+
if (!window) return false;
|
|
445
|
+
const opened = openDescriptor(filePath);
|
|
446
|
+
if (!opened) return false;
|
|
447
|
+
if ("error" in opened) {
|
|
448
|
+
window.unavailable = true;
|
|
449
|
+
this.#setError(`${filePath}: ${opened.error}`);
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
452
|
+
try {
|
|
453
|
+
window.size = opened.size;
|
|
454
|
+
window.unavailable = false;
|
|
455
|
+
if (!followLatest || opened.size <= window.tail) return false;
|
|
456
|
+
const page = readForwardPage(opened.descriptor, window.tail, opened.size, GROWTH_PAGE_BYTES);
|
|
457
|
+
if (page.end <= window.tail) return false;
|
|
458
|
+
this.#applyRecords(kind, page.records, true);
|
|
459
|
+
window.tail = Math.max(window.tail, page.end);
|
|
460
|
+
return true;
|
|
461
|
+
} finally {
|
|
462
|
+
closeQuietly(opened.descriptor);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
#ingest(followLatest) {
|
|
466
|
+
let changed = false;
|
|
467
|
+
for (const [kind, filePath] of this.#windowFiles()) {
|
|
468
|
+
if (this.#growFile(kind, filePath, followLatest)) changed = true;
|
|
469
|
+
}
|
|
470
|
+
if (changed) this.#revision += 1;
|
|
471
|
+
this.#snapshot = this.#buildSnapshot();
|
|
472
|
+
}
|
|
473
|
+
#applyRecords(kind, records, updateLeaf) {
|
|
474
|
+
const parsed = records.map(parseRecord).filter((record) => record !== void 0);
|
|
475
|
+
if (kind === "session") {
|
|
476
|
+
for (const record of parsed) this.#applySessionRecord(record, updateLeaf);
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (updateLeaf) {
|
|
480
|
+
this.#eventRecords.push(...parsed);
|
|
481
|
+
for (const record of parsed) this.#applyEventRecord(record);
|
|
482
|
+
} else {
|
|
483
|
+
this.#eventRecords = [...parsed, ...this.#eventRecords];
|
|
484
|
+
this.#resetStreamingState();
|
|
485
|
+
this.#eventLeafId = void 0;
|
|
486
|
+
for (const record of this.#eventRecords) this.#applyEventRecord(record);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
#applySessionRecord(record, updateLeaf) {
|
|
490
|
+
if (record.type === "session") {
|
|
491
|
+
if (typeof record.id === "string") this.#sessionId = record.id;
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
if (!isSessionEntry(record)) return;
|
|
495
|
+
this.#appendEntry(record, "session", updateLeaf);
|
|
496
|
+
}
|
|
497
|
+
// Entry list order is irrelevant: path construction walks byId from the leaf,
|
|
498
|
+
// so older pages and live folds can append in any order.
|
|
499
|
+
#appendEntry(entry, origin, updateLeaf = true) {
|
|
500
|
+
if (this.#entryIds.has(entry.id)) {
|
|
501
|
+
const existing = this.#byId.get(entry.id);
|
|
502
|
+
if (existing) Object.assign(existing, entry);
|
|
503
|
+
(origin === "session" ? this.#sessionEntryIds : this.#eventEntryIds).add(entry.id);
|
|
504
|
+
if (updateLeaf) {
|
|
505
|
+
if (origin === "session") this.#sessionLeafId = entry.id;
|
|
506
|
+
else this.#eventLeafId = entry.id;
|
|
507
|
+
}
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
this.#entryIds.add(entry.id);
|
|
511
|
+
this.#byId.set(entry.id, entry);
|
|
512
|
+
(origin === "session" ? this.#sessionEntryIds : this.#eventEntryIds).add(entry.id);
|
|
513
|
+
this.#entries.push(entry);
|
|
514
|
+
if (!updateLeaf) return;
|
|
515
|
+
if (origin === "session") this.#sessionLeafId = entry.id;
|
|
516
|
+
else this.#eventLeafId = entry.id;
|
|
517
|
+
}
|
|
518
|
+
#applyEventRecord(event) {
|
|
519
|
+
switch (event.type) {
|
|
520
|
+
case "queue_update": {
|
|
521
|
+
const strings = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
522
|
+
this.#pendingMessages = { steering: strings(event.steering), followUp: strings(event.followUp) };
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
case "message_start": {
|
|
526
|
+
const message = event.message;
|
|
527
|
+
if (!message || typeof message !== "object") return;
|
|
528
|
+
if (message.role === "assistant") {
|
|
529
|
+
this.#partial = {
|
|
530
|
+
...message,
|
|
531
|
+
content: message.content.map((part) => ({ ...part })),
|
|
532
|
+
usage: message.usage ?? emptyUsage(),
|
|
533
|
+
stopReason: message.stopReason ?? "stop"
|
|
534
|
+
};
|
|
535
|
+
} else {
|
|
536
|
+
this.#foldMessage(message);
|
|
537
|
+
}
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
case "message_update":
|
|
541
|
+
this.#applyPartialDelta(event);
|
|
542
|
+
return;
|
|
543
|
+
case "message_end": {
|
|
544
|
+
const message = event.message;
|
|
545
|
+
if (!message || typeof message !== "object") return;
|
|
546
|
+
if (message.role === "assistant") {
|
|
547
|
+
this.#partial = void 0;
|
|
548
|
+
this.#partialArgsRaw.clear();
|
|
549
|
+
}
|
|
550
|
+
this.#foldMessage(message);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
case "tool_execution_start": {
|
|
554
|
+
if (typeof event.toolCallId !== "string") return;
|
|
555
|
+
const args = event.args;
|
|
556
|
+
this.#tools.set(event.toolCallId, {
|
|
557
|
+
toolCallId: event.toolCallId,
|
|
558
|
+
toolName: typeof event.toolName === "string" ? event.toolName : "",
|
|
559
|
+
...args !== void 0 ? { args } : {},
|
|
560
|
+
status: "running",
|
|
561
|
+
executionStarted: true,
|
|
562
|
+
argsComplete: true
|
|
563
|
+
});
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
case "tool_execution_update": {
|
|
567
|
+
const tool = this.#toolFor(event);
|
|
568
|
+
if (!tool) return;
|
|
569
|
+
const partial = event.partialResult;
|
|
570
|
+
if (partial && typeof partial === "object") {
|
|
571
|
+
tool.partial = {
|
|
572
|
+
...Array.isArray(partial.content) ? { content: partial.content } : {},
|
|
573
|
+
...partial.details !== void 0 ? { details: partial.details } : {}
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
case "tool_execution_end": {
|
|
579
|
+
const tool = this.#toolFor(event);
|
|
580
|
+
if (!tool) return;
|
|
581
|
+
const result = event.result;
|
|
582
|
+
if (result && typeof result === "object") {
|
|
583
|
+
tool.result = {
|
|
584
|
+
...Array.isArray(result.content) ? { content: result.content } : {},
|
|
585
|
+
...result.details !== void 0 ? { details: result.details } : {}
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
tool.isError = event.isError === true;
|
|
589
|
+
tool.status = event.isError === true ? "failed" : "completed";
|
|
590
|
+
tool.executionStarted = true;
|
|
591
|
+
tool.argsComplete = true;
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
case "turn_end": {
|
|
595
|
+
const message = event.message;
|
|
596
|
+
if (message && typeof message === "object") this.#foldMessage(message);
|
|
597
|
+
if (Array.isArray(event.toolResults)) {
|
|
598
|
+
for (const result of event.toolResults) {
|
|
599
|
+
if (result && typeof result === "object") this.#foldMessage(result);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
case "agent_end": {
|
|
605
|
+
if (!Array.isArray(event.messages)) return;
|
|
606
|
+
for (const message of event.messages) {
|
|
607
|
+
if (message && typeof message === "object") this.#foldMessage(message);
|
|
608
|
+
}
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
case "entry_appended": {
|
|
612
|
+
if (isSessionEntry(event.entry)) this.#appendEntry(event.entry, "events");
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
default:
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
#toolFor(event) {
|
|
620
|
+
if (typeof event.toolCallId !== "string") return void 0;
|
|
621
|
+
return this.#tools.get(event.toolCallId);
|
|
622
|
+
}
|
|
623
|
+
#applyPartialDelta(event) {
|
|
624
|
+
const delta = event.assistantMessageEvent;
|
|
625
|
+
if (!delta || typeof delta !== "object") return;
|
|
626
|
+
if (!this.#partial) {
|
|
627
|
+
this.#partial = {
|
|
628
|
+
role: "assistant",
|
|
629
|
+
content: [],
|
|
630
|
+
api: "",
|
|
631
|
+
provider: "",
|
|
632
|
+
model: "",
|
|
633
|
+
usage: emptyUsage(),
|
|
634
|
+
stopReason: "stop",
|
|
635
|
+
timestamp: Date.now()
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
const partial = this.#partial;
|
|
639
|
+
if (event.usage && typeof event.usage === "object") {
|
|
640
|
+
partial.usage = event.usage;
|
|
641
|
+
}
|
|
642
|
+
const contentIndex = typeof delta.contentIndex === "number" ? delta.contentIndex : 0;
|
|
643
|
+
switch (delta.type) {
|
|
644
|
+
case "text_start":
|
|
645
|
+
partial.content[contentIndex] = { type: "text", text: "" };
|
|
646
|
+
return;
|
|
647
|
+
case "text_delta": {
|
|
648
|
+
const block = partial.content[contentIndex];
|
|
649
|
+
const text = typeof delta.delta === "string" ? delta.delta : "";
|
|
650
|
+
partial.content[contentIndex] = {
|
|
651
|
+
type: "text",
|
|
652
|
+
text: (block?.type === "text" ? block.text : "") + text
|
|
653
|
+
};
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
case "text_end": {
|
|
657
|
+
if (typeof delta.content === "string") {
|
|
658
|
+
partial.content[contentIndex] = { type: "text", text: delta.content };
|
|
659
|
+
}
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
case "thinking_start":
|
|
663
|
+
partial.content[contentIndex] = { type: "thinking", thinking: "" };
|
|
664
|
+
return;
|
|
665
|
+
case "thinking_delta": {
|
|
666
|
+
const block = partial.content[contentIndex];
|
|
667
|
+
const text = typeof delta.delta === "string" ? delta.delta : "";
|
|
668
|
+
partial.content[contentIndex] = {
|
|
669
|
+
type: "thinking",
|
|
670
|
+
thinking: (block?.type === "thinking" ? block.thinking : "") + text
|
|
671
|
+
};
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
case "thinking_end": {
|
|
675
|
+
if (typeof delta.content === "string") {
|
|
676
|
+
partial.content[contentIndex] = { type: "thinking", thinking: delta.content };
|
|
677
|
+
}
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
case "toolcall_start": {
|
|
681
|
+
this.#partialArgsRaw.delete(contentIndex);
|
|
682
|
+
partial.content[contentIndex] = {
|
|
683
|
+
type: "toolCall",
|
|
684
|
+
id: typeof delta.id === "string" ? delta.id : "",
|
|
685
|
+
name: typeof delta.toolName === "string" ? delta.toolName : "",
|
|
686
|
+
arguments: {}
|
|
687
|
+
};
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
690
|
+
case "toolcall_delta": {
|
|
691
|
+
const raw = typeof delta.delta === "string" ? delta.delta : "";
|
|
692
|
+
if (!raw) return;
|
|
693
|
+
const accumulated = (this.#partialArgsRaw.get(contentIndex) ?? "") + raw;
|
|
694
|
+
this.#partialArgsRaw.set(contentIndex, accumulated);
|
|
695
|
+
const parsed = parseRecord(accumulated);
|
|
696
|
+
const block = partial.content[contentIndex];
|
|
697
|
+
if (block?.type === "toolCall" && parsed) block.arguments = parsed;
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
case "toolcall_end": {
|
|
701
|
+
const toolCall = delta.toolCall;
|
|
702
|
+
if (toolCall && typeof toolCall === "object") partial.content[contentIndex] = toolCall;
|
|
703
|
+
this.#partialArgsRaw.delete(contentIndex);
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
default:
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
#foldMessage(message) {
|
|
711
|
+
if (!message || typeof message !== "object" || typeof message.role !== "string") return;
|
|
712
|
+
const key = messageKey(message);
|
|
713
|
+
if (this.#streamed.has(key)) return;
|
|
714
|
+
this.#streamed.set(key, message);
|
|
715
|
+
this.#streamedOrder.push(key);
|
|
716
|
+
}
|
|
717
|
+
#buildSnapshot() {
|
|
718
|
+
const sessionWindow = this.#windows.get("session");
|
|
719
|
+
const eventsWindow = this.#windows.get("events");
|
|
720
|
+
const hasMore = (sessionWindow?.hasOlder ?? false) || (eventsWindow?.hasOlder ?? false);
|
|
721
|
+
const hasNewer = !this.#followed && (sessionWindow !== void 0 && sessionWindow.tail < sessionWindow.size || eventsWindow !== void 0 && eventsWindow.tail < eventsWindow.size);
|
|
722
|
+
const leafId = this.#sessionLeafId ?? this.#eventLeafId ?? null;
|
|
723
|
+
const pathComplete = leafId !== null && this.#pathReachesRoot(leafId);
|
|
724
|
+
const historyComplete = !hasMore && pathComplete && (sessionWindow?.head ?? 0) === 0 && (eventsWindow?.head ?? 0) === 0;
|
|
725
|
+
const activeEntries = leafId !== null ? buildContextEntries(this.#entries, leafId, this.#byId) : [];
|
|
726
|
+
const sessionMessages = leafId !== null ? buildSessionContext(this.#entries, leafId, this.#byId).messages : [];
|
|
727
|
+
const persisted = new Set(this.#entries.flatMap((entry) => entry.type === "message" ? [messageKey(entry.message)] : []));
|
|
728
|
+
const streamed = this.#streamedOrder.filter((key) => !persisted.has(key)).map((key) => this.#streamed.get(key)).filter((message) => message !== void 0);
|
|
729
|
+
const messages = [...sessionMessages, ...streamed];
|
|
730
|
+
const entries = leafId !== null ? activeEntries.map((entry) => ({
|
|
731
|
+
entryId: entry.id,
|
|
732
|
+
parentId: entry.parentId,
|
|
733
|
+
entryType: entry.type,
|
|
734
|
+
timestamp: entry.timestamp,
|
|
735
|
+
...entry.type === "message" ? { message: entry.message } : {},
|
|
736
|
+
entry
|
|
737
|
+
})) : [];
|
|
738
|
+
const tools = [...this.#tools.values()].map((tool) => ({ ...tool }));
|
|
739
|
+
const partialAssistant = this.#partial ? { ...this.#partial, content: [...this.#partial.content] } : void 0;
|
|
740
|
+
const unavailable = {};
|
|
741
|
+
if (sessionWindow?.unavailable) unavailable.sessionFile = true;
|
|
742
|
+
if (eventsWindow?.unavailable) unavailable.eventsFile = true;
|
|
743
|
+
return {
|
|
744
|
+
messages,
|
|
745
|
+
revision: this.#revision,
|
|
746
|
+
entries,
|
|
747
|
+
streaming: {
|
|
748
|
+
active: partialAssistant !== void 0 || tools.some((tool) => tool.status === "running"),
|
|
749
|
+
...partialAssistant ? { partialAssistant } : {},
|
|
750
|
+
tools
|
|
751
|
+
},
|
|
752
|
+
...this.#pendingMessages ? { pendingMessages: { steering: [...this.#pendingMessages.steering], followUp: [...this.#pendingMessages.followUp] } } : {},
|
|
753
|
+
leafId,
|
|
754
|
+
sourceId: this.#sourceId,
|
|
755
|
+
status: this.#status,
|
|
756
|
+
...this.#sessionFile ? { sessionFile: this.#sessionFile } : {},
|
|
757
|
+
...this.#eventsFile ? { eventsFile: this.#eventsFile } : {},
|
|
758
|
+
...this.#sessionId ? { sessionId: this.#sessionId } : {},
|
|
759
|
+
historyComplete,
|
|
760
|
+
hasMore,
|
|
761
|
+
hasNewer,
|
|
762
|
+
...Object.keys(unavailable).length > 0 ? { unavailable } : {},
|
|
763
|
+
...Object.keys(unavailable).length > 0 && this.#error ? { error: this.#error } : {},
|
|
764
|
+
updatedAt: Date.now()
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
#pathReachesRoot(leafId) {
|
|
768
|
+
let current = this.#byId.get(leafId);
|
|
769
|
+
if (!current) return false;
|
|
770
|
+
const guard = /* @__PURE__ */ new Set();
|
|
771
|
+
while (current.parentId !== null) {
|
|
772
|
+
if (guard.has(current.id)) return true;
|
|
773
|
+
guard.add(current.id);
|
|
774
|
+
const parent = this.#byId.get(current.parentId);
|
|
775
|
+
if (!parent) return false;
|
|
776
|
+
current = parent;
|
|
777
|
+
}
|
|
778
|
+
return true;
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
export {
|
|
782
|
+
NativeConversationReader
|
|
783
|
+
};
|
|
784
|
+
//# sourceMappingURL=conversation-native-reader.js.map
|