@wrongstack/core 0.284.0 → 0.285.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-status-tracker.d.ts +74 -0
- package/dist/agent-status-tracker.d.ts.map +1 -0
- package/dist/autophase/auto-phase-planner.d.ts +79 -0
- package/dist/autophase/auto-phase-planner.d.ts.map +1 -0
- package/dist/autophase/auto-phase-runner.d.ts +79 -0
- package/dist/autophase/auto-phase-runner.d.ts.map +1 -0
- package/dist/autophase/checkpoint.d.ts +49 -0
- package/dist/autophase/checkpoint.d.ts.map +1 -0
- package/dist/autophase/index.d.ts +9 -0
- package/dist/autophase/index.d.ts.map +1 -0
- package/dist/autophase/phase-graph-builder.d.ts +46 -0
- package/dist/autophase/phase-graph-builder.d.ts.map +1 -0
- package/dist/autophase/phase-orchestrator.d.ts +150 -0
- package/dist/autophase/phase-orchestrator.d.ts.map +1 -0
- package/dist/autophase/phase-store.d.ts +29 -0
- package/dist/autophase/phase-store.d.ts.map +1 -0
- package/dist/autophase/types.d.ts +329 -0
- package/dist/autophase/types.d.ts.map +1 -0
- package/dist/boot.d.ts +73 -0
- package/dist/boot.d.ts.map +1 -0
- package/dist/coordination/adaptive-concurrency.d.ts +63 -0
- package/dist/coordination/adaptive-concurrency.d.ts.map +1 -0
- package/dist/coordination/agent-bridge.d.ts +24 -0
- package/dist/coordination/agent-bridge.d.ts.map +1 -0
- package/dist/coordination/agent-monitor.d.ts +100 -0
- package/dist/coordination/agent-monitor.d.ts.map +1 -0
- package/dist/coordination/agent-subagent-runner.d.ts +74 -0
- package/dist/coordination/agent-subagent-runner.d.ts.map +1 -0
- package/dist/coordination/agents/agent-prompts.d.ts +2 -0
- package/dist/coordination/agents/agent-prompts.d.ts.map +1 -0
- package/dist/coordination/agents/index.d.ts +35 -0
- package/dist/coordination/agents/index.d.ts.map +1 -0
- package/dist/coordination/agents/phase1-discovery.d.ts +4 -0
- package/dist/coordination/agents/phase1-discovery.d.ts.map +1 -0
- package/dist/coordination/agents/phase2-planning.d.ts +4 -0
- package/dist/coordination/agents/phase2-planning.d.ts.map +1 -0
- package/dist/coordination/agents/phase3-build.d.ts +4 -0
- package/dist/coordination/agents/phase3-build.d.ts.map +1 -0
- package/dist/coordination/agents/phase3-techstack.d.ts +13 -0
- package/dist/coordination/agents/phase3-techstack.d.ts.map +1 -0
- package/dist/coordination/agents/phase4-verify.d.ts +4 -0
- package/dist/coordination/agents/phase4-verify.d.ts.map +1 -0
- package/dist/coordination/agents/phase5-review.d.ts +4 -0
- package/dist/coordination/agents/phase5-review.d.ts.map +1 -0
- package/dist/coordination/agents/phase6-domain.d.ts +4 -0
- package/dist/coordination/agents/phase6-domain.d.ts.map +1 -0
- package/dist/coordination/agents/phase7-knowledge.d.ts +4 -0
- package/dist/coordination/agents/phase7-knowledge.d.ts.map +1 -0
- package/dist/coordination/agents/phase8-delivery.d.ts +4 -0
- package/dist/coordination/agents/phase8-delivery.d.ts.map +1 -0
- package/dist/coordination/agents/phase9-meta.d.ts +4 -0
- package/dist/coordination/agents/phase9-meta.d.ts.map +1 -0
- package/dist/coordination/agents/types.d.ts +79 -0
- package/dist/coordination/agents/types.d.ts.map +1 -0
- package/dist/coordination/agents.d.ts +8 -0
- package/dist/coordination/agents.d.ts.map +1 -0
- package/dist/coordination/auto-extend.d.ts +46 -0
- package/dist/coordination/auto-extend.d.ts.map +1 -0
- package/dist/coordination/autonomous-brain.d.ts +154 -0
- package/dist/coordination/autonomous-brain.d.ts.map +1 -0
- package/dist/coordination/autonomous-coordinator.d.ts +239 -0
- package/dist/coordination/autonomous-coordinator.d.ts.map +1 -0
- package/dist/coordination/brain-monitor.d.ts +74 -0
- package/dist/coordination/brain-monitor.d.ts.map +1 -0
- package/dist/coordination/brain.d.ts +104 -0
- package/dist/coordination/brain.d.ts.map +1 -0
- package/dist/coordination/change-manager.d.ts +151 -0
- package/dist/coordination/change-manager.d.ts.map +1 -0
- package/dist/coordination/checkpoint-wiring.d.ts +61 -0
- package/dist/coordination/checkpoint-wiring.d.ts.map +1 -0
- package/dist/coordination/collab-bus.d.ts +132 -0
- package/dist/coordination/collab-bus.d.ts.map +1 -0
- package/dist/coordination/collab-debug.d.ts +302 -0
- package/dist/coordination/collab-debug.d.ts.map +1 -0
- package/dist/coordination/commit-safety.d.ts +72 -0
- package/dist/coordination/commit-safety.d.ts.map +1 -0
- package/dist/coordination/consensus-protocol.d.ts +106 -0
- package/dist/coordination/consensus-protocol.d.ts.map +1 -0
- package/dist/coordination/coordinator/error-classifier.d.ts +15 -0
- package/dist/coordination/coordinator/error-classifier.d.ts.map +1 -0
- package/dist/coordination/delegate-tool.d.ts +101 -0
- package/dist/coordination/delegate-tool.d.ts.map +1 -0
- package/dist/coordination/dep-watcher-bridge.d.ts +47 -0
- package/dist/coordination/dep-watcher-bridge.d.ts.map +1 -0
- package/dist/coordination/dep-watcher.d.ts +74 -0
- package/dist/coordination/dep-watcher.d.ts.map +1 -0
- package/dist/coordination/director/director-errors.d.ts +29 -0
- package/dist/coordination/director/director-errors.d.ts.map +1 -0
- package/dist/coordination/director-construction.d.ts +90 -0
- package/dist/coordination/director-construction.d.ts.map +1 -0
- package/dist/coordination/director-prompts.d.ts +119 -0
- package/dist/coordination/director-prompts.d.ts.map +1 -0
- package/dist/coordination/director-session.d.ts +68 -0
- package/dist/coordination/director-session.d.ts.map +1 -0
- package/dist/coordination/director-tools.d.ts +65 -0
- package/dist/coordination/director-tools.d.ts.map +1 -0
- package/dist/coordination/director.d.ts +802 -0
- package/dist/coordination/director.d.ts.map +1 -0
- package/dist/coordination/dispatcher.d.ts +82 -0
- package/dist/coordination/dispatcher.d.ts.map +1 -0
- package/dist/coordination/file-author-tracker.d.ts +76 -0
- package/dist/coordination/file-author-tracker.d.ts.map +1 -0
- package/dist/coordination/fleet-bus.d.ts +122 -0
- package/dist/coordination/fleet-bus.d.ts.map +1 -0
- package/dist/coordination/fleet-event-validation.d.ts +10 -0
- package/dist/coordination/fleet-event-validation.d.ts.map +1 -0
- package/dist/coordination/fleet-manager.d.ts +234 -0
- package/dist/coordination/fleet-manager.d.ts.map +1 -0
- package/dist/coordination/fleet-spawn.d.ts +102 -0
- package/dist/coordination/fleet-spawn.d.ts.map +1 -0
- package/dist/coordination/fleet-status-tool.d.ts +36 -0
- package/dist/coordination/fleet-status-tool.d.ts.map +1 -0
- package/dist/coordination/fleet-supervisor.d.ts +157 -0
- package/dist/coordination/fleet-supervisor.d.ts.map +1 -0
- package/dist/coordination/fleet.d.ts +96 -0
- package/dist/coordination/fleet.d.ts.map +1 -0
- package/dist/coordination/global-mailbox.d.ts +234 -0
- package/dist/coordination/global-mailbox.d.ts.map +1 -0
- package/dist/coordination/icoordinator.d.ts +97 -0
- package/dist/coordination/icoordinator.d.ts.map +1 -0
- package/dist/coordination/ifleet-manager.d.ts +177 -0
- package/dist/coordination/ifleet-manager.d.ts.map +1 -0
- package/dist/coordination/in-memory-transport.d.ts +12 -0
- package/dist/coordination/in-memory-transport.d.ts.map +1 -0
- package/dist/coordination/index.d.ts +78 -2587
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +739 -254
- package/dist/coordination/index.js.map +7 -1
- package/dist/coordination/knowledge-graph.d.ts +217 -0
- package/dist/coordination/knowledge-graph.d.ts.map +1 -0
- package/dist/coordination/large-answer-store.d.ts +61 -0
- package/dist/coordination/large-answer-store.d.ts.map +1 -0
- package/dist/coordination/mail-tools.d.ts +34 -0
- package/dist/coordination/mail-tools.d.ts.map +1 -0
- package/dist/coordination/mailbox-actions.d.ts +68 -0
- package/dist/coordination/mailbox-actions.d.ts.map +1 -0
- package/dist/coordination/mailbox-health.d.ts +131 -0
- package/dist/coordination/mailbox-health.d.ts.map +1 -0
- package/dist/coordination/mailbox-hooks.d.ts +55 -0
- package/dist/coordination/mailbox-hooks.d.ts.map +1 -0
- package/dist/coordination/mailbox-tool.d.ts +75 -0
- package/dist/coordination/mailbox-tool.d.ts.map +1 -0
- package/dist/{mailbox-types-BGZWrYTJ.d.ts → coordination/mailbox-types.d.ts} +37 -22
- package/dist/coordination/mailbox-types.d.ts.map +1 -0
- package/dist/coordination/mailbox.d.ts +69 -0
- package/dist/coordination/mailbox.d.ts.map +1 -0
- package/dist/coordination/model-matrix.d.ts +98 -0
- package/dist/coordination/model-matrix.d.ts.map +1 -0
- package/dist/coordination/multi-agent-coordinator.d.ts +202 -0
- package/dist/coordination/multi-agent-coordinator.d.ts.map +1 -0
- package/dist/coordination/null-fleet-bus.d.ts +10 -0
- package/dist/coordination/null-fleet-bus.d.ts.map +1 -0
- package/dist/coordination/package-author-tracker.d.ts +87 -0
- package/dist/coordination/package-author-tracker.d.ts.map +1 -0
- package/dist/coordination/package-outdated-watcher.d.ts +83 -0
- package/dist/coordination/package-outdated-watcher.d.ts.map +1 -0
- package/dist/coordination/single-instance-mailbox.d.ts +154 -0
- package/dist/coordination/single-instance-mailbox.d.ts.map +1 -0
- package/dist/coordination/spawn-budget.d.ts +6 -0
- package/dist/coordination/spawn-budget.d.ts.map +1 -0
- package/dist/coordination/subagent-budget.d.ts +323 -0
- package/dist/coordination/subagent-budget.d.ts.map +1 -0
- package/dist/coordination/subagent-nicknames.d.ts +42 -0
- package/dist/coordination/subagent-nicknames.d.ts.map +1 -0
- package/dist/coordination/subagent-result-tool.d.ts +20 -0
- package/dist/coordination/subagent-result-tool.d.ts.map +1 -0
- package/dist/coordination/task-auctioneer.d.ts +143 -0
- package/dist/coordination/task-auctioneer.d.ts.map +1 -0
- package/dist/coordination/task-dag.d.ts +147 -0
- package/dist/coordination/task-dag.d.ts.map +1 -0
- package/dist/coordination/techstack-mailbox-consumer.d.ts +50 -0
- package/dist/coordination/techstack-mailbox-consumer.d.ts.map +1 -0
- package/dist/coordination/transport.d.ts +2 -0
- package/dist/coordination/transport.d.ts.map +1 -0
- package/dist/coordination/worktree-task-runner.d.ts +45 -0
- package/dist/coordination/worktree-task-runner.d.ts.map +1 -0
- package/dist/core/agent-internals.d.ts +41 -0
- package/dist/core/agent-internals.d.ts.map +1 -0
- package/dist/core/agent-loop.d.ts +18 -0
- package/dist/core/agent-loop.d.ts.map +1 -0
- package/dist/core/agent-response.d.ts +21 -0
- package/dist/core/agent-response.d.ts.map +1 -0
- package/dist/core/agent-tools.d.ts +21 -0
- package/dist/core/agent-tools.d.ts.map +1 -0
- package/dist/core/agent-types.d.ts +95 -0
- package/dist/core/agent-types.d.ts.map +1 -0
- package/dist/core/agent.d.ts +54 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/btw.d.ts +40 -0
- package/dist/core/btw.d.ts.map +1 -0
- package/dist/core/context.d.ts +269 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/continue-intent.d.ts +92 -0
- package/dist/core/continue-intent.d.ts.map +1 -0
- package/dist/core/continue-to-next-iteration.d.ts +96 -0
- package/dist/core/continue-to-next-iteration.d.ts.map +1 -0
- package/dist/core/conversation-state.d.ts +96 -0
- package/dist/core/conversation-state.d.ts.map +1 -0
- package/dist/core/fallback-model.d.ts +94 -0
- package/dist/core/fallback-model.d.ts.map +1 -0
- package/dist/core/fleet-pulse.d.ts +42 -0
- package/dist/core/fleet-pulse.d.ts.map +1 -0
- package/dist/core/input-builder.d.ts +95 -0
- package/dist/core/input-builder.d.ts.map +1 -0
- package/dist/core/instruction-bundle.d.ts +22 -0
- package/dist/core/instruction-bundle.d.ts.map +1 -0
- package/dist/core/iteration-limit.d.ts +35 -0
- package/dist/core/iteration-limit.d.ts.map +1 -0
- package/dist/core/mailbox-loop.d.ts +63 -0
- package/dist/core/mailbox-loop.d.ts.map +1 -0
- package/dist/core/modes/brief.d.ts +2 -0
- package/dist/core/modes/brief.d.ts.map +1 -0
- package/dist/core/modes/default.d.ts +8 -0
- package/dist/core/modes/default.d.ts.map +1 -0
- package/dist/core/modes/teach.d.ts +2 -0
- package/dist/core/modes/teach.d.ts.map +1 -0
- package/dist/core/provider-runner.d.ts +24 -0
- package/dist/core/provider-runner.d.ts.map +1 -0
- package/dist/core/queued-messages.d.ts +55 -0
- package/dist/core/queued-messages.d.ts.map +1 -0
- package/dist/core/run-env.d.ts +49 -0
- package/dist/core/run-env.d.ts.map +1 -0
- package/dist/core/streaming-response-builder.d.ts +78 -0
- package/dist/core/streaming-response-builder.d.ts.map +1 -0
- package/dist/core/system-prompt-builder.d.ts +213 -0
- package/dist/core/system-prompt-builder.d.ts.map +1 -0
- package/dist/defaults/index.d.ts +68 -158
- package/dist/defaults/index.d.ts.map +1 -0
- package/dist/defaults/index.js +1257 -819
- package/dist/defaults/index.js.map +7 -1
- package/dist/execution/auto-compaction-middleware.d.ts +123 -0
- package/dist/execution/auto-compaction-middleware.d.ts.map +1 -0
- package/dist/execution/autonomous-runner.d.ts +55 -0
- package/dist/execution/autonomous-runner.d.ts.map +1 -0
- package/dist/execution/autonomy-brain.d.ts +90 -0
- package/dist/execution/autonomy-brain.d.ts.map +1 -0
- package/dist/execution/autonomy-prompt-contributor.d.ts +39 -0
- package/dist/execution/autonomy-prompt-contributor.d.ts.map +1 -0
- package/dist/execution/compaction-core.d.ts +103 -0
- package/dist/execution/compaction-core.d.ts.map +1 -0
- package/dist/execution/compactor.d.ts +56 -0
- package/dist/execution/compactor.d.ts.map +1 -0
- package/dist/execution/design-color.d.ts +31 -0
- package/dist/execution/design-color.d.ts.map +1 -0
- package/dist/execution/design-detect.d.ts +96 -0
- package/dist/execution/design-detect.d.ts.map +1 -0
- package/dist/execution/design-kit-loader.d.ts +53 -0
- package/dist/execution/design-kit-loader.d.ts.map +1 -0
- package/dist/execution/design-materialize.d.ts +32 -0
- package/dist/execution/design-materialize.d.ts.map +1 -0
- package/dist/execution/design-project-store.d.ts +57 -0
- package/dist/execution/design-project-store.d.ts.map +1 -0
- package/dist/execution/design-verify.d.ts +44 -0
- package/dist/execution/design-verify.d.ts.map +1 -0
- package/dist/execution/error-handler.d.ts +34 -0
- package/dist/execution/error-handler.d.ts.map +1 -0
- package/dist/{parallel-eternal-engine-HUrtePLd.d.ts → execution/eternal-autonomy.d.ts} +10 -225
- package/dist/execution/eternal-autonomy.d.ts.map +1 -0
- package/dist/execution/goal-preamble.d.ts +2 -0
- package/dist/execution/goal-preamble.d.ts.map +1 -0
- package/dist/execution/index.d.ts +21 -180
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/index.js +465 -180
- package/dist/execution/index.js.map +7 -1
- package/dist/execution/intelligent-compactor.d.ts +85 -0
- package/dist/execution/intelligent-compactor.d.ts.map +1 -0
- package/dist/execution/model-runtime.d.ts +75 -0
- package/dist/execution/model-runtime.d.ts.map +1 -0
- package/dist/execution/parallel-eternal-engine.d.ts +130 -0
- package/dist/execution/parallel-eternal-engine.d.ts.map +1 -0
- package/dist/execution/prompt-enhancer.d.ts +12 -13
- package/dist/execution/prompt-enhancer.d.ts.map +1 -0
- package/dist/execution/prompt-enhancer.js +13 -7
- package/dist/execution/prompt-enhancer.js.map +7 -1
- package/dist/execution/prompt-loader.d.ts +52 -0
- package/dist/execution/prompt-loader.d.ts.map +1 -0
- package/dist/execution/provider-runner-impl.d.ts +14 -0
- package/dist/execution/provider-runner-impl.d.ts.map +1 -0
- package/dist/execution/regex-patterns.d.ts +7 -0
- package/dist/execution/regex-patterns.d.ts.map +1 -0
- package/dist/execution/retry-policy.d.ts +35 -0
- package/dist/execution/retry-policy.d.ts.map +1 -0
- package/dist/execution/selective-compactor.d.ts +94 -0
- package/dist/execution/selective-compactor.d.ts.map +1 -0
- package/dist/execution/skill-loader.d.ts +43 -0
- package/dist/execution/skill-loader.d.ts.map +1 -0
- package/dist/execution/strategy-compactor.d.ts +43 -0
- package/dist/execution/strategy-compactor.d.ts.map +1 -0
- package/dist/execution/tool-executor.d.ts +112 -0
- package/dist/execution/tool-executor.d.ts.map +1 -0
- package/dist/extension/extension-points.d.ts +121 -0
- package/dist/extension/extension-points.d.ts.map +1 -0
- package/dist/extension/index.d.ts +3 -10
- package/dist/extension/index.d.ts.map +1 -0
- package/dist/extension/index.js +59 -5
- package/dist/extension/index.js.map +7 -1
- package/dist/extension/registry.d.ts +86 -0
- package/dist/extension/registry.d.ts.map +1 -0
- package/dist/fleet-notifier.d.ts +28 -0
- package/dist/fleet-notifier.d.ts.map +1 -0
- package/dist/hooks/http-executor.d.ts +11 -0
- package/dist/hooks/http-executor.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/registry.d.ts +71 -0
- package/dist/hooks/registry.d.ts.map +1 -0
- package/dist/hooks/runner.d.ts +65 -0
- package/dist/hooks/runner.d.ts.map +1 -0
- package/dist/hooks/shell-executor.d.ts +33 -0
- package/dist/hooks/shell-executor.d.ts.map +1 -0
- package/dist/hooks/shell-hooks-equal.d.ts +15 -0
- package/dist/hooks/shell-hooks-equal.d.ts.map +1 -0
- package/dist/hq/agent-bridge.d.ts +27 -0
- package/dist/hq/agent-bridge.d.ts.map +1 -0
- package/dist/hq/alerts.d.ts +67 -0
- package/dist/hq/alerts.d.ts.map +1 -0
- package/dist/hq/auth-store.d.ts +161 -0
- package/dist/hq/auth-store.d.ts.map +1 -0
- package/dist/hq/brain-bridge.d.ts +37 -0
- package/dist/hq/brain-bridge.d.ts.map +1 -0
- package/dist/hq/commands.d.ts +122 -0
- package/dist/hq/commands.d.ts.map +1 -0
- package/dist/hq/cost-bridge.d.ts +36 -0
- package/dist/hq/cost-bridge.d.ts.map +1 -0
- package/dist/hq/factory.d.ts +66 -0
- package/dist/hq/factory.d.ts.map +1 -0
- package/dist/hq/fleet-bridge.d.ts +39 -0
- package/dist/hq/fleet-bridge.d.ts.map +1 -0
- package/dist/hq/index.d.ts +18 -816
- package/dist/hq/index.d.ts.map +1 -0
- package/dist/hq/index.js +417 -122
- package/dist/hq/index.js.map +7 -1
- package/dist/hq/mailbox-mapper.d.ts +27 -0
- package/dist/hq/mailbox-mapper.d.ts.map +1 -0
- package/dist/hq/persistence.d.ts +121 -0
- package/dist/hq/persistence.d.ts.map +1 -0
- package/dist/hq/protocol.d.ts +560 -0
- package/dist/hq/protocol.d.ts.map +1 -0
- package/dist/hq/publisher.d.ts +177 -0
- package/dist/hq/publisher.d.ts.map +1 -0
- package/dist/hq/redaction.d.ts +30 -0
- package/dist/hq/redaction.d.ts.map +1 -0
- package/dist/hq/session-bridge.d.ts +29 -0
- package/dist/hq/session-bridge.d.ts.map +1 -0
- package/dist/hq/tool-bridge.d.ts +41 -0
- package/dist/hq/tool-bridge.d.ts.map +1 -0
- package/dist/hq/transcript-mapper.d.ts +36 -0
- package/dist/hq/transcript-mapper.d.ts.map +1 -0
- package/dist/hq/worktree-bridge.d.ts +34 -0
- package/dist/hq/worktree-bridge.d.ts.map +1 -0
- package/dist/index.d.ts +108 -2872
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2724 -1344
- package/dist/index.js.map +7 -1
- package/dist/infrastructure/context-manager.d.ts +92 -0
- package/dist/infrastructure/context-manager.d.ts.map +1 -0
- package/dist/infrastructure/index.d.ts +6 -64
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +39 -12
- package/dist/infrastructure/index.js.map +7 -1
- package/dist/infrastructure/logger.d.ts +99 -0
- package/dist/infrastructure/logger.d.ts.map +1 -0
- package/dist/infrastructure/mcp-servers.d.ts +83 -0
- package/dist/infrastructure/mcp-servers.d.ts.map +1 -0
- package/dist/{path-resolver-CMS5307d.d.ts → infrastructure/path-resolver.d.ts} +3 -5
- package/dist/infrastructure/path-resolver.d.ts.map +1 -0
- package/dist/infrastructure/token-counter.d.ts +57 -0
- package/dist/infrastructure/token-counter.d.ts.map +1 -0
- package/dist/kernel/container.d.ts +84 -0
- package/dist/kernel/container.d.ts.map +1 -0
- package/dist/{events-Bgnh43r9.d.ts → kernel/events.d.ts} +112 -206
- package/dist/kernel/events.d.ts.map +1 -0
- package/dist/kernel/index.d.ts +6 -107
- package/dist/kernel/index.d.ts.map +1 -0
- package/dist/kernel/index.js +56 -4
- package/dist/kernel/index.js.map +7 -1
- package/dist/kernel/pipeline.d.ts +105 -0
- package/dist/kernel/pipeline.d.ts.map +1 -0
- package/dist/kernel/run-controller.d.ts +55 -0
- package/dist/kernel/run-controller.d.ts.map +1 -0
- package/dist/kernel/tokens.d.ts +53 -0
- package/dist/kernel/tokens.d.ts.map +1 -0
- package/dist/mailbox-attach.d.ts +27 -0
- package/dist/mailbox-attach.d.ts.map +1 -0
- package/dist/middleware/collab-pause.d.ts +73 -0
- package/dist/middleware/collab-pause.d.ts.map +1 -0
- package/dist/models/codex-catalog.d.ts +41 -0
- package/dist/models/codex-catalog.d.ts.map +1 -0
- package/dist/models/index.d.ts +8 -163
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +150 -51
- package/dist/models/index.js.map +7 -1
- package/dist/models/llm-selector.d.ts +47 -0
- package/dist/models/llm-selector.d.ts.map +1 -0
- package/dist/models/mode-store.d.ts +22 -0
- package/dist/models/mode-store.d.ts.map +1 -0
- package/dist/models/model-intelligence.d.ts +56 -0
- package/dist/models/model-intelligence.d.ts.map +1 -0
- package/dist/models/model-router.d.ts +100 -0
- package/dist/models/model-router.d.ts.map +1 -0
- package/dist/models/models-registry.d.ts +106 -0
- package/dist/models/models-registry.d.ts.map +1 -0
- package/dist/models/provider-model-resolve.d.ts +69 -0
- package/dist/models/provider-model-resolve.d.ts.map +1 -0
- package/dist/observability/event-bridge.d.ts +10 -0
- package/dist/observability/event-bridge.d.ts.map +1 -0
- package/dist/observability/health.d.ts +18 -0
- package/dist/observability/health.d.ts.map +1 -0
- package/dist/observability/index.d.ts +9 -354
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +21 -8
- package/dist/observability/index.js.map +7 -1
- package/dist/observability/metrics.d.ts +26 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/otel-tracer.d.ts +41 -0
- package/dist/observability/otel-tracer.d.ts.map +1 -0
- package/dist/observability/otlp-metrics.d.ts +111 -0
- package/dist/observability/otlp-metrics.d.ts.map +1 -0
- package/dist/observability/otlp-traces.d.ts +95 -0
- package/dist/observability/otlp-traces.d.ts.map +1 -0
- package/dist/observability/prometheus.d.ts +49 -0
- package/dist/observability/prometheus.d.ts.map +1 -0
- package/dist/observability/tracer.d.ts +9 -0
- package/dist/observability/tracer.d.ts.map +1 -0
- package/dist/plugin/api.d.ts +226 -0
- package/dist/plugin/api.d.ts.map +1 -0
- package/dist/plugin/loader.d.ts +73 -0
- package/dist/plugin/loader.d.ts.map +1 -0
- package/dist/plugins/chimera-plugin.d.ts +37 -0
- package/dist/plugins/chimera-plugin.d.ts.map +1 -0
- package/dist/plugins/git-plugin.d.ts +15 -0
- package/dist/plugins/git-plugin.d.ts.map +1 -0
- package/dist/plugins/observability-plugin.d.ts +19 -0
- package/dist/plugins/observability-plugin.d.ts.map +1 -0
- package/dist/plugins/plan-plugin.d.ts +16 -0
- package/dist/plugins/plan-plugin.d.ts.map +1 -0
- package/dist/plugins/prompts-plugin.d.ts +26 -0
- package/dist/plugins/prompts-plugin.d.ts.map +1 -0
- package/dist/plugins/security-plugin.d.ts +19 -0
- package/dist/plugins/security-plugin.d.ts.map +1 -0
- package/dist/plugins/skills-plugin.d.ts +42 -0
- package/dist/plugins/skills-plugin.d.ts.map +1 -0
- package/dist/plugins/sync-plugin.d.ts +22 -0
- package/dist/plugins/sync-plugin.d.ts.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/prompt-installer.d.ts +50 -0
- package/dist/prompts/prompt-installer.d.ts.map +1 -0
- package/dist/prompts/prompt-manifest-store.d.ts +18 -0
- package/dist/prompts/prompt-manifest-store.d.ts.map +1 -0
- package/dist/registry/provider-registry.d.ts +51 -0
- package/dist/registry/provider-registry.d.ts.map +1 -0
- package/dist/registry/slash-command-registry.d.ts +61 -0
- package/dist/registry/slash-command-registry.d.ts.map +1 -0
- package/dist/registry/tool-registry.d.ts +154 -0
- package/dist/registry/tool-registry.d.ts.map +1 -0
- package/dist/replay/hash.d.ts +31 -0
- package/dist/replay/hash.d.ts.map +1 -0
- package/dist/replay/replay-provider-runner.d.ts +53 -0
- package/dist/replay/replay-provider-runner.d.ts.map +1 -0
- package/dist/{index-CbyuOE5y.d.ts → security/capabilities.d.ts} +31 -34
- package/dist/security/capabilities.d.ts.map +1 -0
- package/dist/security/config-secrets.d.ts +25 -0
- package/dist/security/config-secrets.d.ts.map +1 -0
- package/dist/security/index.d.ts +6 -8
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +102 -381
- package/dist/security/index.js.map +7 -1
- package/dist/security/permission-policy.d.ts +153 -0
- package/dist/security/permission-policy.d.ts.map +1 -0
- package/dist/security/secret-scrubber.d.ts +14 -0
- package/dist/security/secret-scrubber.d.ts.map +1 -0
- package/dist/security/secret-vault.d.ts +87 -0
- package/dist/security/secret-vault.d.ts.map +1 -0
- package/dist/security/yolo-risk.d.ts +11 -0
- package/dist/security/yolo-risk.d.ts.map +1 -0
- package/dist/{session-registry-Dvg7i_IA.d.ts → session-registry.d.ts} +8 -9
- package/dist/session-registry.d.ts.map +1 -0
- package/dist/skills/foreign-sources.d.ts +59 -0
- package/dist/skills/foreign-sources.d.ts.map +1 -0
- package/dist/skills/frontmatter.d.ts +44 -0
- package/dist/skills/frontmatter.d.ts.map +1 -0
- package/dist/skills/github-fetcher.d.ts +38 -0
- package/dist/skills/github-fetcher.d.ts.map +1 -0
- package/dist/skills/index.d.ts +11 -582
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +81 -43
- package/dist/skills/index.js.map +7 -1
- package/dist/skills/limits.d.ts +92 -0
- package/dist/skills/limits.d.ts.map +1 -0
- package/dist/skills/manifest-store.d.ts +42 -0
- package/dist/skills/manifest-store.d.ts.map +1 -0
- package/dist/skills/registry/github-direct-adapter.d.ts +17 -0
- package/dist/skills/registry/github-direct-adapter.d.ts.map +1 -0
- package/dist/skills/registry/registry-adapter.d.ts +84 -0
- package/dist/skills/registry/registry-adapter.d.ts.map +1 -0
- package/dist/skills/registry/skills-sh-adapter.d.ts +13 -0
- package/dist/skills/registry/skills-sh-adapter.d.ts.map +1 -0
- package/dist/skills/skill-generator.d.ts +82 -0
- package/dist/skills/skill-generator.d.ts.map +1 -0
- package/dist/skills/skill-installer.d.ts +124 -0
- package/dist/skills/skill-installer.d.ts.map +1 -0
- package/dist/storage/annotations-store.d.ts +118 -0
- package/dist/storage/annotations-store.d.ts.map +1 -0
- package/dist/storage/attachment-store.d.ts +31 -0
- package/dist/storage/attachment-store.d.ts.map +1 -0
- package/dist/storage/cloud-sync.d.ts +44 -0
- package/dist/storage/cloud-sync.d.ts.map +1 -0
- package/dist/storage/completed-work-checkpoint.d.ts +11 -0
- package/dist/storage/completed-work-checkpoint.d.ts.map +1 -0
- package/dist/storage/config-loader.d.ts +104 -0
- package/dist/storage/config-loader.d.ts.map +1 -0
- package/dist/storage/config-migration.d.ts +87 -0
- package/dist/storage/config-migration.d.ts.map +1 -0
- package/dist/storage/config-store.d.ts +22 -0
- package/dist/storage/config-store.d.ts.map +1 -0
- package/dist/{director-state-CMS_bMs4.d.ts → storage/director-state.d.ts} +28 -8
- package/dist/storage/director-state.d.ts.map +1 -0
- package/dist/storage/file-session-writer.d.ts +169 -0
- package/dist/storage/file-session-writer.d.ts.map +1 -0
- package/dist/{goal-store-Datpp-ar.d.ts → storage/goal-store.d.ts} +26 -19
- package/dist/storage/goal-store.d.ts.map +1 -0
- package/dist/storage/index.d.ts +39 -1031
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +655 -300
- package/dist/storage/index.js.map +7 -1
- package/dist/storage/input-history-store.d.ts +56 -0
- package/dist/storage/input-history-store.d.ts.map +1 -0
- package/dist/storage/memory-backend.d.ts +66 -0
- package/dist/storage/memory-backend.d.ts.map +1 -0
- package/dist/storage/memory-consolidator.d.ts +50 -0
- package/dist/storage/memory-consolidator.d.ts.map +1 -0
- package/dist/storage/memory-graph-backend.d.ts +117 -0
- package/dist/storage/memory-graph-backend.d.ts.map +1 -0
- package/dist/storage/memory-store.d.ts +119 -0
- package/dist/storage/memory-store.d.ts.map +1 -0
- package/dist/storage/plan-store.d.ts +78 -0
- package/dist/storage/plan-store.d.ts.map +1 -0
- package/dist/storage/plan-templates.d.ts +21 -0
- package/dist/storage/plan-templates.d.ts.map +1 -0
- package/dist/storage/prompt-store.d.ts +37 -0
- package/dist/storage/prompt-store.d.ts.map +1 -0
- package/dist/storage/prompt-usage-store.d.ts +29 -0
- package/dist/storage/prompt-usage-store.d.ts.map +1 -0
- package/dist/storage/provider-config-watcher.d.ts +34 -0
- package/dist/storage/provider-config-watcher.d.ts.map +1 -0
- package/dist/storage/queue-store.d.ts +37 -0
- package/dist/storage/queue-store.d.ts.map +1 -0
- package/dist/storage/recovery-lock.d.ts +79 -0
- package/dist/storage/recovery-lock.d.ts.map +1 -0
- package/dist/storage/replay-log-store.d.ts +97 -0
- package/dist/storage/replay-log-store.d.ts.map +1 -0
- package/dist/storage/session-analyzer.d.ts +48 -0
- package/dist/storage/session-analyzer.d.ts.map +1 -0
- package/dist/storage/session-checkpoint-cas.d.ts +37 -0
- package/dist/storage/session-checkpoint-cas.d.ts.map +1 -0
- package/dist/{session-event-bridge-D_z_mBwk.d.ts → storage/session-event-bridge.d.ts} +14 -15
- package/dist/storage/session-event-bridge.d.ts.map +1 -0
- package/dist/storage/session-helpers.d.ts +9 -0
- package/dist/storage/session-helpers.d.ts.map +1 -0
- package/dist/storage/session-id.d.ts +18 -0
- package/dist/storage/session-id.d.ts.map +1 -0
- package/dist/storage/session-reader.d.ts +21 -0
- package/dist/storage/session-reader.d.ts.map +1 -0
- package/dist/storage/session-recovery.d.ts +93 -0
- package/dist/storage/session-recovery.d.ts.map +1 -0
- package/dist/storage/session-resume-validation.d.ts +6 -0
- package/dist/storage/session-resume-validation.d.ts.map +1 -0
- package/dist/storage/session-rewinder.d.ts +21 -0
- package/dist/storage/session-rewinder.d.ts.map +1 -0
- package/dist/storage/session-store.d.ts +210 -0
- package/dist/storage/session-store.d.ts.map +1 -0
- package/dist/storage/session-summary.d.ts +12 -0
- package/dist/storage/session-summary.d.ts.map +1 -0
- package/dist/storage/session-tool-call-ends.d.ts +5 -0
- package/dist/storage/session-tool-call-ends.d.ts.map +1 -0
- package/dist/storage/storage-concurrency.d.ts +2 -0
- package/dist/storage/storage-concurrency.d.ts.map +1 -0
- package/dist/storage/task-store.d.ts +33 -0
- package/dist/storage/task-store.d.ts.map +1 -0
- package/dist/storage/todos-checkpoint.d.ts +39 -0
- package/dist/storage/todos-checkpoint.d.ts.map +1 -0
- package/dist/storage/tool-audit-log.d.ts +141 -0
- package/dist/storage/tool-audit-log.d.ts.map +1 -0
- package/dist/tasking/index.d.ts +3 -124
- package/dist/tasking/index.d.ts.map +1 -0
- package/dist/tasking/index.js +57 -4
- package/dist/tasking/index.js.map +7 -1
- package/dist/tasking/task-store.d.ts +22 -0
- package/dist/tasking/task-store.d.ts.map +1 -0
- package/dist/tasking/task-tracker.d.ts +102 -0
- package/dist/tasking/task-tracker.d.ts.map +1 -0
- package/dist/tools/index.d.ts +2 -59
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +93 -14
- package/dist/tools/index.js.map +7 -1
- package/dist/tools/mcp-control.d.ts +53 -0
- package/dist/tools/mcp-control.d.ts.map +1 -0
- package/dist/tools/mcp-use.d.ts +24 -0
- package/dist/tools/mcp-use.d.ts.map +1 -0
- package/dist/types/agent-bridge.d.ts +42 -0
- package/dist/types/agent-bridge.d.ts.map +1 -0
- package/dist/types/attachment.d.ts +54 -0
- package/dist/types/attachment.d.ts.map +1 -0
- package/dist/types/autonomy.d.ts +5 -0
- package/dist/types/autonomy.d.ts.map +1 -0
- package/dist/types/blocks.d.ts +76 -0
- package/dist/types/blocks.d.ts.map +1 -0
- package/dist/{compactor-DQLL4HTo.d.ts → types/compactor.d.ts} +5 -7
- package/dist/types/compactor.d.ts.map +1 -0
- package/dist/{config-MRqn1V-u.d.ts → types/config.d.ts} +135 -354
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/context-evidence.d.ts +68 -0
- package/dist/types/context-evidence.d.ts.map +1 -0
- package/dist/types/context-window.d.ts +35 -0
- package/dist/types/context-window.d.ts.map +1 -0
- package/dist/{default-config-B79_gJYv.d.ts → types/default-config.d.ts} +10 -11
- package/dist/types/default-config.d.ts.map +1 -0
- package/dist/types/design-kit.d.ts +91 -0
- package/dist/types/design-kit.d.ts.map +1 -0
- package/dist/{retry-policy-CQ7KwXJa.d.ts → types/error-handler.d.ts} +5 -12
- package/dist/types/error-handler.d.ts.map +1 -0
- package/dist/types/errors.d.ts +277 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/hooks.d.ts +167 -0
- package/dist/types/hooks.d.ts.map +1 -0
- package/dist/types/index.d.ts +40 -244
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +90 -12
- package/dist/types/index.js.map +7 -1
- package/dist/{input-reader-E-ffP2ee.d.ts → types/input-reader.d.ts} +3 -4
- package/dist/types/input-reader.d.ts.map +1 -0
- package/dist/{logger-B63L5bTg.d.ts → types/logger.d.ts} +3 -4
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/memory.d.ts +89 -0
- package/dist/types/memory.d.ts.map +1 -0
- package/dist/types/messages.d.ts +24 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/mode-prompts.d.ts +2 -0
- package/dist/types/mode-prompts.d.ts.map +1 -0
- package/dist/{mode-CZlO9iU1.d.ts → types/mode.d.ts} +6 -7
- package/dist/types/mode.d.ts.map +1 -0
- package/dist/types/models-registry.d.ts +105 -0
- package/dist/types/models-registry.d.ts.map +1 -0
- package/dist/types/multi-agent.d.ts +435 -0
- package/dist/types/multi-agent.d.ts.map +1 -0
- package/dist/{observability-D-HZN_mF.d.ts → types/observability.d.ts} +12 -13
- package/dist/types/observability.d.ts.map +1 -0
- package/dist/{path-resolver-CPRj4bFY.d.ts → types/path-resolver.d.ts} +2 -3
- package/dist/types/path-resolver.d.ts.map +1 -0
- package/dist/{permission-ByDKXEcG.d.ts → types/permission.d.ts} +8 -9
- package/dist/types/permission.d.ts.map +1 -0
- package/dist/types/plugin.d.ts +385 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/prompt-registry.d.ts +81 -0
- package/dist/types/prompt-registry.d.ts.map +1 -0
- package/dist/{prompt-DLd35n4Q.d.ts → types/prompt.d.ts} +14 -15
- package/dist/types/prompt.d.ts.map +1 -0
- package/dist/{provider-runner-ChL-kVg6.d.ts → types/provider-runner.d.ts} +9 -10
- package/dist/types/provider-runner.d.ts.map +1 -0
- package/dist/types/provider.d.ts +387 -0
- package/dist/types/provider.d.ts.map +1 -0
- package/dist/types/renderer.d.ts +23 -0
- package/dist/types/renderer.d.ts.map +1 -0
- package/dist/types/retry-policy.d.ts +7 -0
- package/dist/types/retry-policy.d.ts.map +1 -0
- package/dist/types/secret-scrubber.d.ts +5 -0
- package/dist/types/secret-scrubber.d.ts.map +1 -0
- package/dist/{secret-vault-BAKpgFw_.d.ts → types/secret-vault.d.ts} +13 -7
- package/dist/types/secret-vault.d.ts.map +1 -0
- package/dist/{selector-D8O6B_Rm.d.ts → types/selector.d.ts} +4 -6
- package/dist/types/selector.d.ts.map +1 -0
- package/dist/types/session-reader.d.ts +81 -0
- package/dist/types/session-reader.d.ts.map +1 -0
- package/dist/{session-rewinder-C9HnMkhP.d.ts → types/session-rewinder.d.ts} +5 -6
- package/dist/types/session-rewinder.d.ts.map +1 -0
- package/dist/types/session.d.ts +650 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/side-effect.d.ts +34 -0
- package/dist/types/side-effect.d.ts.map +1 -0
- package/dist/{skill-DHniprNl.d.ts → types/skill.d.ts} +4 -5
- package/dist/types/skill.d.ts.map +1 -0
- package/dist/types/slash-command.d.ts +59 -0
- package/dist/types/slash-command.d.ts.map +1 -0
- package/dist/types/spec.d.ts +77 -0
- package/dist/types/spec.d.ts.map +1 -0
- package/dist/types/system-prompt-contributor.d.ts +20 -0
- package/dist/types/system-prompt-contributor.d.ts.map +1 -0
- package/dist/types/system-prompt.d.ts +51 -0
- package/dist/types/system-prompt.d.ts.map +1 -0
- package/dist/{task-graph-CH3acNQ7.d.ts → types/task-graph.d.ts} +21 -22
- package/dist/types/task-graph.d.ts.map +1 -0
- package/dist/types/token-counter.d.ts +42 -0
- package/dist/types/token-counter.d.ts.map +1 -0
- package/dist/types/tool-executor.d.ts +133 -0
- package/dist/types/tool-executor.d.ts.map +1 -0
- package/dist/types/tool-markers.d.ts +23 -0
- package/dist/types/tool-markers.d.ts.map +1 -0
- package/dist/types/tool.d.ts +245 -0
- package/dist/types/tool.d.ts.map +1 -0
- package/dist/types/utility-types.d.ts +31 -0
- package/dist/types/utility-types.d.ts.map +1 -0
- package/dist/utils/assert-never.d.ts +14 -0
- package/dist/utils/assert-never.d.ts.map +1 -0
- package/dist/utils/atomic-write.d.ts +12 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/child-env.d.ts +67 -0
- package/dist/utils/child-env.d.ts.map +1 -0
- package/dist/utils/color.d.ts +20 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/config-json.d.ts +14 -0
- package/dist/utils/config-json.d.ts.map +1 -0
- package/dist/utils/context-evidence.d.ts +47 -0
- package/dist/utils/context-evidence.d.ts.map +1 -0
- package/dist/utils/deep-merge.d.ts +64 -0
- package/dist/utils/deep-merge.d.ts.map +1 -0
- package/dist/utils/diff.d.ts +11 -0
- package/dist/utils/diff.d.ts.map +1 -0
- package/dist/utils/error.d.ts +2 -3
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +3 -3
- package/dist/utils/error.js.map +7 -1
- package/dist/utils/expect-defined.d.ts +2 -3
- package/dist/utils/expect-defined.d.ts.map +1 -0
- package/dist/utils/expect-defined.js +3 -3
- package/dist/utils/expect-defined.js.map +7 -1
- package/dist/utils/glob-expand.d.ts +10 -0
- package/dist/utils/glob-expand.d.ts.map +1 -0
- package/dist/utils/glob-match.d.ts +4 -0
- package/dist/utils/glob-match.d.ts.map +1 -0
- package/dist/utils/index.d.ts +37 -920
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +242 -33
- package/dist/utils/index.js.map +7 -1
- package/dist/utils/instruction-file.d.ts +3 -0
- package/dist/utils/instruction-file.d.ts.map +1 -0
- package/dist/utils/ip-guard.d.ts +34 -0
- package/dist/utils/ip-guard.d.ts.map +1 -0
- package/dist/utils/json-repair.d.ts +23 -0
- package/dist/utils/json-repair.d.ts.map +1 -0
- package/dist/utils/json-schema-validate.d.ts +42 -0
- package/dist/utils/json-schema-validate.d.ts.map +1 -0
- package/dist/utils/lru-cache.d.ts +29 -0
- package/dist/utils/lru-cache.d.ts.map +1 -0
- package/dist/utils/merge-custom-models.d.ts +12 -0
- package/dist/utils/merge-custom-models.d.ts.map +1 -0
- package/dist/utils/merge-models-payload.d.ts +20 -0
- package/dist/utils/merge-models-payload.d.ts.map +1 -0
- package/dist/utils/message-invariants.d.ts +22 -0
- package/dist/utils/message-invariants.d.ts.map +1 -0
- package/dist/utils/newline-normalize.d.ts +5 -0
- package/dist/utils/newline-normalize.d.ts.map +1 -0
- package/dist/utils/regex-guard.d.ts +21 -0
- package/dist/utils/regex-guard.d.ts.map +1 -0
- package/dist/utils/safe-json.d.ts +31 -0
- package/dist/utils/safe-json.d.ts.map +1 -0
- package/dist/utils/session-scoped-path.d.ts +13 -0
- package/dist/utils/session-scoped-path.d.ts.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/slug.d.ts +13 -0
- package/dist/utils/slug.d.ts.map +1 -0
- package/dist/utils/string.d.ts +9 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/task-format.d.ts +22 -0
- package/dist/utils/task-format.d.ts.map +1 -0
- package/dist/utils/term.d.ts +133 -0
- package/dist/utils/term.d.ts.map +1 -0
- package/dist/utils/todos-format.d.ts +30 -0
- package/dist/utils/todos-format.d.ts.map +1 -0
- package/dist/utils/token-estimate.d.ts +112 -0
- package/dist/utils/token-estimate.d.ts.map +1 -0
- package/dist/utils/tool-description-mode.d.ts +28 -0
- package/dist/utils/tool-description-mode.d.ts.map +1 -0
- package/dist/utils/tool-output-serializer.d.ts +40 -0
- package/dist/utils/tool-output-serializer.d.ts.map +1 -0
- package/dist/utils/tool-result-render-mode.d.ts +55 -0
- package/dist/utils/tool-result-render-mode.d.ts.map +1 -0
- package/dist/utils/tool-subject.d.ts +5 -0
- package/dist/utils/tool-subject.d.ts.map +1 -0
- package/dist/utils/tool-wire-compact.d.ts +28 -0
- package/dist/utils/tool-wire-compact.d.ts.map +1 -0
- package/dist/utils/ulid.d.ts +11 -0
- package/dist/utils/ulid.d.ts.map +1 -0
- package/dist/{wstack-paths-C3K40Qst.d.ts → utils/wstack-paths.d.ts} +7 -8
- package/dist/utils/wstack-paths.d.ts.map +1 -0
- package/dist/worktree/index.d.ts +2 -0
- package/dist/worktree/index.d.ts.map +1 -0
- package/dist/{worktree-manager-DzwxKE35.d.ts → worktree/worktree-manager.d.ts} +19 -13
- package/dist/worktree/worktree-manager.d.ts.map +1 -0
- package/instructions/autonomy/active-mission.md +2 -4
- package/instructions/sections/tool/delegation-full.md +1 -1
- package/package.json +4 -5
- package/skills/node-modern/SKILL.md +2 -2
- package/skills/plugin-author/SKILL.md +9 -16
- package/dist/dispatcher-types.d-BBeXBQgS.d.ts +0 -66
- package/dist/global-mailbox-sZwyI6CS.d.ts +0 -959
- package/dist/index--Gm41aBJ.d.ts +0 -671
- package/dist/mcp-servers-DEV4s6Ks.d.ts +0 -259
- package/dist/multi-agent-coordinator-4RCRZKjN.d.ts +0 -1770
- package/dist/null-fleet-bus-CFoNVQEK.d.ts +0 -2127
- package/dist/pipeline-DGDyIohT.d.ts +0 -331
- package/dist/provider-model-resolve-o2hHLs79.d.ts +0 -263
- package/dist/secret-scrubber-3MHDDAtm.d.ts +0 -6
- package/dist/secret-vault-DxohkUBc.d.ts +0 -272
- package/dist/session-reader-7Esxrkpw.d.ts +0 -155
- package/dist/task-format-GX0B1mMC.d.ts +0 -23
- package/dist/todos-checkpoint-FY7PjmMx.d.ts +0 -850
- package/dist/tool-BNlnIJvo.d.ts +0 -2190
- package/dist/tool-executor-CckSCM5E.d.ts +0 -906
package/dist/hq/index.js
CHANGED
|
@@ -1,56 +1,71 @@
|
|
|
1
|
-
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
2
|
-
import * as syncFs from 'fs';
|
|
3
|
-
import * as os from 'os';
|
|
4
|
-
import { hostname } from 'os';
|
|
5
|
-
import * as path2 from 'path';
|
|
6
|
-
import { basename } from 'path';
|
|
7
|
-
import * as fsp from 'fs/promises';
|
|
8
|
-
|
|
9
1
|
// src/hq/protocol.ts
|
|
10
2
|
var HQ_PROTOCOL_VERSION = 1;
|
|
11
3
|
var DEFAULT_HQ_REDACTION_POLICY = {
|
|
12
|
-
rawContent:
|
|
13
|
-
toolArgs: "
|
|
14
|
-
paths: "
|
|
4
|
+
rawContent: true,
|
|
5
|
+
toolArgs: "full",
|
|
6
|
+
paths: "full"
|
|
15
7
|
};
|
|
8
|
+
var HQ_TRANSCRIPT_TEXT_CAP = 16e3;
|
|
16
9
|
var KNOWN_HQ_CLIENT_FRAME_TYPES = /* @__PURE__ */ new Set([
|
|
17
10
|
"client.hello",
|
|
18
11
|
"client.event",
|
|
19
12
|
"client.command_poll",
|
|
20
13
|
"client.command_ack"
|
|
21
14
|
]);
|
|
15
|
+
var HQ_CLIENT_KINDS = /* @__PURE__ */ new Set(["tui", "repl", "webui", "cli", "unknown"]);
|
|
16
|
+
var HQ_WORKSPACE_KINDS = /* @__PURE__ */ new Set(["git", "directory", "unknown"]);
|
|
17
|
+
var HQ_CLIENT_CAPABILITIES = /* @__PURE__ */ new Set([
|
|
18
|
+
"telemetry.publish",
|
|
19
|
+
"session.summary",
|
|
20
|
+
"fleet.summary",
|
|
21
|
+
"mailbox.summary",
|
|
22
|
+
"control.receive"
|
|
23
|
+
]);
|
|
24
|
+
var HQ_COMMAND_ACK_STATUSES = /* @__PURE__ */ new Set([
|
|
25
|
+
"accepted",
|
|
26
|
+
"completed",
|
|
27
|
+
"failed",
|
|
28
|
+
"rejected"
|
|
29
|
+
]);
|
|
22
30
|
function hasStringType(x) {
|
|
23
31
|
return typeof x === "object" && x !== null && typeof x.type === "string";
|
|
24
32
|
}
|
|
25
33
|
function isHqClientIdentity(x) {
|
|
26
34
|
if (typeof x !== "object" || x === null) return false;
|
|
27
35
|
const v = x;
|
|
28
|
-
return typeof v.clientId === "string" && typeof v.kind === "string" && typeof v.machineId === "string" && typeof v.startedAt === "string";
|
|
36
|
+
return typeof v.clientId === "string" && typeof v.kind === "string" && HQ_CLIENT_KINDS.has(v.kind) && typeof v.machineId === "string" && typeof v.startedAt === "string";
|
|
29
37
|
}
|
|
30
38
|
function isHqProjectIdentity(x) {
|
|
31
39
|
if (typeof x !== "object" || x === null) return false;
|
|
32
40
|
const v = x;
|
|
33
|
-
return typeof v.projectId === "string" && typeof v.projectRoot === "string" && typeof v.projectName === "string" && typeof v.machineId === "string" && typeof v.workspaceKind === "string";
|
|
41
|
+
return typeof v.projectId === "string" && typeof v.projectRoot === "string" && typeof v.projectName === "string" && typeof v.machineId === "string" && typeof v.workspaceKind === "string" && HQ_WORKSPACE_KINDS.has(v.workspaceKind);
|
|
42
|
+
}
|
|
43
|
+
function isHqRedactionPolicy(x) {
|
|
44
|
+
if (typeof x !== "object" || x === null) return false;
|
|
45
|
+
const v = x;
|
|
46
|
+
return typeof v.rawContent === "boolean" && (v.toolArgs === "none" || v.toolArgs === "summary" || v.toolArgs === "redacted" || v.toolArgs === "full") && (v.paths === "none" || v.paths === "project-relative" || v.paths === "redacted" || v.paths === "full");
|
|
34
47
|
}
|
|
35
48
|
function isHqClientHelloPayload(x) {
|
|
36
49
|
if (typeof x !== "object" || x === null) return false;
|
|
37
50
|
const v = x;
|
|
38
|
-
return typeof v.protocolVersion === "number" && isHqClientIdentity(v.client) && isHqProjectIdentity(v.project) && Array.isArray(v.capabilities)
|
|
51
|
+
return typeof v.protocolVersion === "number" && isHqClientIdentity(v.client) && isHqProjectIdentity(v.project) && Array.isArray(v.capabilities) && v.capabilities.every(
|
|
52
|
+
(capability) => typeof capability === "string" && HQ_CLIENT_CAPABILITIES.has(capability)
|
|
53
|
+
) && (v.redactionPolicy === void 0 || isHqRedactionPolicy(v.redactionPolicy));
|
|
39
54
|
}
|
|
40
55
|
function isHqEventEnvelope(x) {
|
|
41
56
|
if (typeof x !== "object" || x === null) return false;
|
|
42
57
|
const v = x;
|
|
43
|
-
return typeof v.id === "string" && typeof v.type === "string" &&
|
|
58
|
+
return typeof v.id === "string" && typeof v.type === "string" && v.schemaVersion === HQ_PROTOCOL_VERSION && typeof v.timestamp === "string" && typeof v.clientId === "string" && typeof v.projectId === "string" && Number.isSafeInteger(v.seq) && v.seq >= 0 && Object.hasOwn(v, "payload");
|
|
44
59
|
}
|
|
45
60
|
function isHqClientCommandPollMessage(x) {
|
|
46
61
|
if (typeof x !== "object" || x === null) return false;
|
|
47
62
|
const v = x;
|
|
48
|
-
return typeof v.clientId === "string" && typeof v.projectId === "string";
|
|
63
|
+
return typeof v.clientId === "string" && typeof v.projectId === "string" && (v.afterCommandId === void 0 || typeof v.afterCommandId === "string") && (v.limit === void 0 || Number.isSafeInteger(v.limit) && v.limit > 0 && v.limit <= 200);
|
|
49
64
|
}
|
|
50
65
|
function isHqClientCommandAckMessage(x) {
|
|
51
66
|
if (typeof x !== "object" || x === null) return false;
|
|
52
67
|
const v = x;
|
|
53
|
-
return typeof v.clientId === "string" && typeof v.projectId === "string" && typeof v.commandId === "string" && typeof v.status === "string";
|
|
68
|
+
return typeof v.clientId === "string" && typeof v.projectId === "string" && typeof v.commandId === "string" && typeof v.status === "string" && HQ_COMMAND_ACK_STATUSES.has(v.status) && (v.message === void 0 || typeof v.message === "string");
|
|
54
69
|
}
|
|
55
70
|
function parseHqFrame(raw) {
|
|
56
71
|
let parsed;
|
|
@@ -83,7 +98,13 @@ function parseHqFrame(raw) {
|
|
|
83
98
|
}
|
|
84
99
|
return {
|
|
85
100
|
ok: true,
|
|
86
|
-
frame: {
|
|
101
|
+
frame: {
|
|
102
|
+
type: "client.command_poll",
|
|
103
|
+
clientId: obj.clientId,
|
|
104
|
+
projectId: obj.projectId,
|
|
105
|
+
...typeof obj.afterCommandId === "string" ? { afterCommandId: obj.afterCommandId } : {},
|
|
106
|
+
...typeof obj.limit === "number" ? { limit: obj.limit } : {}
|
|
107
|
+
}
|
|
87
108
|
};
|
|
88
109
|
case "client.command_ack":
|
|
89
110
|
if (!isHqClientCommandAckMessage(obj)) {
|
|
@@ -118,7 +139,8 @@ var KNOWN_HQ_EVENT_PAYLOAD_TYPES = /* @__PURE__ */ new Set([
|
|
|
118
139
|
"worktree.event",
|
|
119
140
|
"tool.started",
|
|
120
141
|
"tool.completed",
|
|
121
|
-
"session.usage"
|
|
142
|
+
"session.usage",
|
|
143
|
+
"client.heartbeat"
|
|
122
144
|
]);
|
|
123
145
|
function isHqMailboxMessageSummary(x) {
|
|
124
146
|
if (typeof x !== "object" || x === null) return false;
|
|
@@ -293,6 +315,11 @@ function isHqUsagePayload(x) {
|
|
|
293
315
|
if (typeof x !== "object" || x === null) return false;
|
|
294
316
|
return !Array.isArray(x);
|
|
295
317
|
}
|
|
318
|
+
function isHqClientHeartbeatPayload(x) {
|
|
319
|
+
if (typeof x !== "object" || x === null || Array.isArray(x)) return false;
|
|
320
|
+
const v = x;
|
|
321
|
+
return typeof v.uptimeMs === "number" && (v.activeSessionId === void 0 || typeof v.activeSessionId === "string") && (v.activeRunId === void 0 || typeof v.activeRunId === "string") && typeof v.status === "string" && (v.status === "active" || v.status === "idle" || v.status === "stale" || v.status === "error") && (v.activeSubagents === void 0 || typeof v.activeSubagents === "number") && (v.queuedTasks === void 0 || typeof v.queuedTasks === "number");
|
|
322
|
+
}
|
|
296
323
|
function parseHqEventPayload(eventType, payload) {
|
|
297
324
|
if (!KNOWN_HQ_EVENT_PAYLOAD_TYPES.has(eventType)) {
|
|
298
325
|
return { ok: true, payload };
|
|
@@ -322,6 +349,8 @@ function parseHqEventPayload(eventType, payload) {
|
|
|
322
349
|
return isHqToolCompletedPayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
323
350
|
case "session.usage":
|
|
324
351
|
return isHqUsagePayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
352
|
+
case "client.heartbeat":
|
|
353
|
+
return isHqClientHeartbeatPayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
325
354
|
default: {
|
|
326
355
|
const _exhaustive = eventType;
|
|
327
356
|
return _exhaustive;
|
|
@@ -548,6 +577,8 @@ var RAW_CONTENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
548
577
|
"prompts",
|
|
549
578
|
"completion",
|
|
550
579
|
"response",
|
|
580
|
+
"text",
|
|
581
|
+
"partialText",
|
|
551
582
|
"assistantMessage",
|
|
552
583
|
"userMessage",
|
|
553
584
|
"stdout",
|
|
@@ -555,6 +586,7 @@ var RAW_CONTENT_KEYS = /* @__PURE__ */ new Set([
|
|
|
555
586
|
"output",
|
|
556
587
|
"toolInput",
|
|
557
588
|
"toolOutput",
|
|
589
|
+
"outputSummary",
|
|
558
590
|
"body",
|
|
559
591
|
"mailboxBody",
|
|
560
592
|
"messageBody",
|
|
@@ -595,12 +627,34 @@ var PATH_KEYS = /* @__PURE__ */ new Set([
|
|
|
595
627
|
"workingDirectory"
|
|
596
628
|
]);
|
|
597
629
|
var defaultScrubber = new DefaultSecretScrubber();
|
|
598
|
-
function
|
|
630
|
+
function resolveHqRedactionPolicy(policy) {
|
|
599
631
|
return {
|
|
600
632
|
...DEFAULT_HQ_REDACTION_POLICY,
|
|
601
633
|
...policy
|
|
602
634
|
};
|
|
603
635
|
}
|
|
636
|
+
function tightenHqRedactionPolicy(publisherPolicy, operatorPolicy) {
|
|
637
|
+
if (operatorPolicy === void 0) return publisherPolicy;
|
|
638
|
+
const toolRank = {
|
|
639
|
+
none: 0,
|
|
640
|
+
summary: 1,
|
|
641
|
+
redacted: 2,
|
|
642
|
+
full: 3
|
|
643
|
+
};
|
|
644
|
+
const pathRank = {
|
|
645
|
+
none: 0,
|
|
646
|
+
redacted: 0,
|
|
647
|
+
"project-relative": 1,
|
|
648
|
+
full: 2
|
|
649
|
+
};
|
|
650
|
+
const requestedToolArgs = operatorPolicy.toolArgs;
|
|
651
|
+
const requestedPaths = operatorPolicy.paths;
|
|
652
|
+
return {
|
|
653
|
+
rawContent: publisherPolicy.rawContent && (operatorPolicy.rawContent === void 0 || operatorPolicy.rawContent),
|
|
654
|
+
toolArgs: requestedToolArgs !== void 0 && toolRank[requestedToolArgs] < toolRank[publisherPolicy.toolArgs] ? requestedToolArgs : publisherPolicy.toolArgs,
|
|
655
|
+
paths: requestedPaths !== void 0 && pathRank[requestedPaths] < pathRank[publisherPolicy.paths] ? requestedPaths : publisherPolicy.paths
|
|
656
|
+
};
|
|
657
|
+
}
|
|
604
658
|
function isPlainObject(value) {
|
|
605
659
|
return Object.prototype.toString.call(value) === "[object Object]";
|
|
606
660
|
}
|
|
@@ -618,7 +672,7 @@ function normalizePathForCompare(value) {
|
|
|
618
672
|
return value.replace(/\\/g, "/").replace(/\/+$/g, "");
|
|
619
673
|
}
|
|
620
674
|
function redactPath(value, projectRoot, policy) {
|
|
621
|
-
if (policy.paths === "full") return
|
|
675
|
+
if (policy.paths === "full") return value;
|
|
622
676
|
if (policy.paths === "none" || policy.paths === "redacted") return REDACTED_PATH_REPLACEMENT;
|
|
623
677
|
const normalizedValue = normalizePathForCompare(value);
|
|
624
678
|
if (!projectRoot) return normalizedValue.split("/").at(-1) ?? REDACTED_PATH_REPLACEMENT;
|
|
@@ -629,17 +683,17 @@ function redactPath(value, projectRoot, policy) {
|
|
|
629
683
|
}
|
|
630
684
|
return normalizedValue.split("/").at(-1) ?? REDACTED_PATH_REPLACEMENT;
|
|
631
685
|
}
|
|
632
|
-
function summarizeString(value, maxSummaryLength) {
|
|
633
|
-
const scrubbed = defaultScrubber.scrub(value);
|
|
686
|
+
function summarizeString(value, maxSummaryLength, scrub) {
|
|
687
|
+
const scrubbed = scrub ? defaultScrubber.scrub(value) : value;
|
|
634
688
|
if (scrubbed.length <= maxSummaryLength) return scrubbed;
|
|
635
689
|
return `${scrubbed.slice(0, maxSummaryLength)}\u2026[truncated:${scrubbed.length - maxSummaryLength}]`;
|
|
636
690
|
}
|
|
637
691
|
function scrubAndTruncateHqPreview(value, maxLength = 280) {
|
|
638
692
|
if (typeof value !== "string" || value.length === 0) return void 0;
|
|
639
|
-
return summarizeString(value, maxLength);
|
|
693
|
+
return summarizeString(value, maxLength, true);
|
|
640
694
|
}
|
|
641
695
|
function visitValue(value, options, key) {
|
|
642
|
-
if (key !== void 0 && isSensitiveKey(key)) {
|
|
696
|
+
if (!options.policy.rawContent && key !== void 0 && isSensitiveKey(key)) {
|
|
643
697
|
return { value: SENSITIVE_FIELD_REPLACEMENT, redacted: true };
|
|
644
698
|
}
|
|
645
699
|
if (typeof value === "string") {
|
|
@@ -650,7 +704,7 @@ function visitValue(value, options, key) {
|
|
|
650
704
|
if (!options.policy.rawContent && key !== void 0 && isRawContentKey(key)) {
|
|
651
705
|
return { value: RAW_CONTENT_REPLACEMENT, redacted: true };
|
|
652
706
|
}
|
|
653
|
-
const scrubbed = summarizeString(value, options.maxSummaryLength);
|
|
707
|
+
const scrubbed = summarizeString(value, options.maxSummaryLength, !options.policy.rawContent);
|
|
654
708
|
return { value: scrubbed, redacted: scrubbed !== value };
|
|
655
709
|
}
|
|
656
710
|
if (value === null || typeof value !== "object") return { value, redacted: false };
|
|
@@ -677,7 +731,7 @@ function visitValue(value, options, key) {
|
|
|
677
731
|
}
|
|
678
732
|
function redactHqValue(value, options = {}) {
|
|
679
733
|
const result = visitValue(value, {
|
|
680
|
-
policy:
|
|
734
|
+
policy: resolveHqRedactionPolicy(options.policy),
|
|
681
735
|
...options.projectRoot !== void 0 ? { projectRoot: options.projectRoot } : {},
|
|
682
736
|
maxSummaryLength: options.maxSummaryLength ?? 500,
|
|
683
737
|
seen: /* @__PURE__ */ new WeakSet()
|
|
@@ -693,7 +747,8 @@ function redactHqEvent(event, options = {}) {
|
|
|
693
747
|
return { value: nextEvent, redacted: payload.redacted };
|
|
694
748
|
}
|
|
695
749
|
function summarizeHqToolArgs(value, options = {}) {
|
|
696
|
-
const policy =
|
|
750
|
+
const policy = resolveHqRedactionPolicy(options.policy);
|
|
751
|
+
if (policy.toolArgs === "full") return value;
|
|
697
752
|
if (policy.toolArgs === "none") return "[REDACTED:hq_tool_args]";
|
|
698
753
|
if (policy.toolArgs === "redacted") return redactHqValue(value, options).value;
|
|
699
754
|
if (value === null || typeof value !== "object") return redactHqValue(value, options).value;
|
|
@@ -704,7 +759,7 @@ function summarizeHqToolArgs(value, options = {}) {
|
|
|
704
759
|
if (isSensitiveKey(key)) {
|
|
705
760
|
summary[key] = SENSITIVE_FIELD_REPLACEMENT;
|
|
706
761
|
} else if (typeof item === "string") {
|
|
707
|
-
summary[key] = isPathKey(key) ? redactPath(item, options.projectRoot, policy) : summarizeString(item, 120);
|
|
762
|
+
summary[key] = isPathKey(key) ? redactPath(item, options.projectRoot, policy) : summarizeString(item, 120, true);
|
|
708
763
|
} else if (Array.isArray(item)) {
|
|
709
764
|
summary[key] = `[array:${item.length}]`;
|
|
710
765
|
} else if (item !== null && typeof item === "object") {
|
|
@@ -720,9 +775,12 @@ function summarizeHqToolArgs(value, options = {}) {
|
|
|
720
775
|
// src/hq/mailbox-mapper.ts
|
|
721
776
|
function previewText(value, maxLength, policy) {
|
|
722
777
|
if (value === void 0 || value.length === 0) return void 0;
|
|
723
|
-
|
|
724
|
-
if (
|
|
725
|
-
|
|
778
|
+
if (policy?.rawContent === false) return "[REDACTED:hq_raw_content]";
|
|
779
|
+
if (policy?.rawContent === true) {
|
|
780
|
+
if (value.length <= maxLength) return value;
|
|
781
|
+
return `${value.slice(0, maxLength)}\u2026`;
|
|
782
|
+
}
|
|
783
|
+
return scrubAndTruncateHqPreview(value, maxLength);
|
|
726
784
|
}
|
|
727
785
|
function readCount(message) {
|
|
728
786
|
return Object.keys(message.readBy).length;
|
|
@@ -823,6 +881,10 @@ function createMailboxEventPayload(input) {
|
|
|
823
881
|
...input.summary !== void 0 ? { summary: previewText(input.summary, input.previewLength ?? 160, input.redactionPolicy) ?? "" } : {}
|
|
824
882
|
};
|
|
825
883
|
}
|
|
884
|
+
|
|
885
|
+
// src/hq/publisher.ts
|
|
886
|
+
import { randomUUID } from "node:crypto";
|
|
887
|
+
var TRANSCRIPT_EVENT_TYPES = /* @__PURE__ */ new Set(["session.transcript", "agent.message"]);
|
|
826
888
|
var OPEN_STATE = 1;
|
|
827
889
|
var CONNECT_WARN_AFTER_FAILURES = 5;
|
|
828
890
|
var DEFAULT_RECONNECT_BASE_MS = 1e3;
|
|
@@ -831,6 +893,7 @@ var DEFAULT_DISCOVERY_POLL_MS = 5e3;
|
|
|
831
893
|
var DEFAULT_MAX_QUEUED_MESSAGES = 2e3;
|
|
832
894
|
var DEFAULT_COMMAND_POLL_INTERVAL_MS = 2e3;
|
|
833
895
|
var DEFAULT_COMMAND_POLL_LIMIT = 25;
|
|
896
|
+
var DEFAULT_HEARTBEAT_INTERVAL_MS = 25e3;
|
|
834
897
|
function defaultSocketFactory(url) {
|
|
835
898
|
const WebSocketCtor = globalThis.WebSocket;
|
|
836
899
|
if (WebSocketCtor === void 0) {
|
|
@@ -877,6 +940,7 @@ var HqPublisher = class {
|
|
|
877
940
|
this.reconnectBaseMs = options.reconnectBaseMs ?? DEFAULT_RECONNECT_BASE_MS;
|
|
878
941
|
this.reconnectMaxMs = options.reconnectMaxMs ?? DEFAULT_RECONNECT_MAX_MS;
|
|
879
942
|
this.maxQueuedMessages = options.maxQueuedMessages ?? DEFAULT_MAX_QUEUED_MESSAGES;
|
|
943
|
+
this.resolvedRedactionPolicy = resolveHqRedactionPolicy(options.redactionPolicy);
|
|
880
944
|
}
|
|
881
945
|
options;
|
|
882
946
|
socketFactory;
|
|
@@ -887,6 +951,7 @@ var HqPublisher = class {
|
|
|
887
951
|
reconnectBaseMs;
|
|
888
952
|
reconnectMaxMs;
|
|
889
953
|
maxQueuedMessages;
|
|
954
|
+
resolvedRedactionPolicy;
|
|
890
955
|
socket = null;
|
|
891
956
|
seq = 0;
|
|
892
957
|
queue = [];
|
|
@@ -896,6 +961,7 @@ var HqPublisher = class {
|
|
|
896
961
|
lastAttempt = null;
|
|
897
962
|
reconnectTimer = null;
|
|
898
963
|
commandPollTimer = null;
|
|
964
|
+
heartbeatTimer = null;
|
|
899
965
|
lastCommandId;
|
|
900
966
|
connect() {
|
|
901
967
|
if (this.socket !== null || this.stopped) return;
|
|
@@ -926,6 +992,7 @@ var HqPublisher = class {
|
|
|
926
992
|
this.reconnectAttempt = 0;
|
|
927
993
|
this.sendHelloNow();
|
|
928
994
|
this.flushQueue();
|
|
995
|
+
this.startHeartbeat();
|
|
929
996
|
if (this.options.onCommand !== void 0) {
|
|
930
997
|
this.startCommandPolling();
|
|
931
998
|
this.pollCommands();
|
|
@@ -940,6 +1007,7 @@ var HqPublisher = class {
|
|
|
940
1007
|
removeSocketListener(socket, "close", onCloseOrError);
|
|
941
1008
|
removeSocketListener(socket, "error", onCloseOrError);
|
|
942
1009
|
this.stopCommandPolling();
|
|
1010
|
+
this.stopHeartbeat();
|
|
943
1011
|
if (this.socket === socket) this.socket = null;
|
|
944
1012
|
this.scheduleReconnect();
|
|
945
1013
|
};
|
|
@@ -956,6 +1024,7 @@ var HqPublisher = class {
|
|
|
956
1024
|
this.reconnectTimer = null;
|
|
957
1025
|
}
|
|
958
1026
|
this.stopCommandPolling();
|
|
1027
|
+
this.stopHeartbeat();
|
|
959
1028
|
this.queue = [];
|
|
960
1029
|
const socket = this.socket;
|
|
961
1030
|
this.socket = null;
|
|
@@ -973,13 +1042,19 @@ var HqPublisher = class {
|
|
|
973
1042
|
...options.sessionId !== void 0 ? { sessionId: options.sessionId } : {},
|
|
974
1043
|
...options.runId !== void 0 ? { runId: options.runId } : {}
|
|
975
1044
|
});
|
|
976
|
-
|
|
977
|
-
|
|
1045
|
+
const maxSummaryLength = options.maxSummaryLength ?? (TRANSCRIPT_EVENT_TYPES.has(options.type) ? HQ_TRANSCRIPT_TEXT_CAP : void 0);
|
|
1046
|
+
const redacted = redactHqEvent(event, {
|
|
1047
|
+
policy: this.resolvedRedactionPolicy,
|
|
1048
|
+
projectRoot: this.options.project.projectRoot,
|
|
1049
|
+
...maxSummaryLength !== void 0 ? { maxSummaryLength } : {}
|
|
1050
|
+
}).value;
|
|
1051
|
+
this.sendFrame({ type: "client.event", event: redacted });
|
|
1052
|
+
return redacted;
|
|
978
1053
|
}
|
|
979
1054
|
async publishMailboxSnapshot(mailbox, options) {
|
|
980
1055
|
const payload = await createMailboxSnapshotPayloadFromMailbox(mailbox, {
|
|
981
1056
|
...options,
|
|
982
|
-
|
|
1057
|
+
redactionPolicy: this.resolvedRedactionPolicy
|
|
983
1058
|
});
|
|
984
1059
|
return this.publishEvent({
|
|
985
1060
|
type: "mailbox.snapshot",
|
|
@@ -996,7 +1071,7 @@ var HqPublisher = class {
|
|
|
996
1071
|
...input.agent !== void 0 ? { agent: input.agent } : {},
|
|
997
1072
|
...input.summary !== void 0 ? { summary: input.summary } : {},
|
|
998
1073
|
...input.previewLength !== void 0 ? { previewLength: input.previewLength } : {},
|
|
999
|
-
|
|
1074
|
+
redactionPolicy: this.resolvedRedactionPolicy
|
|
1000
1075
|
});
|
|
1001
1076
|
return this.publishEvent({
|
|
1002
1077
|
type: "mailbox.event",
|
|
@@ -1013,6 +1088,10 @@ var HqPublisher = class {
|
|
|
1013
1088
|
get project() {
|
|
1014
1089
|
return this.options.project;
|
|
1015
1090
|
}
|
|
1091
|
+
/** Effective publisher-side policy applied before any event leaves this process. */
|
|
1092
|
+
get redactionPolicy() {
|
|
1093
|
+
return this.resolvedRedactionPolicy;
|
|
1094
|
+
}
|
|
1016
1095
|
/** Publish a live session/terminal snapshot (state + agents). */
|
|
1017
1096
|
publishSessionSnapshot(payload, opts) {
|
|
1018
1097
|
return this.publishEvent({
|
|
@@ -1076,7 +1155,8 @@ var HqPublisher = class {
|
|
|
1076
1155
|
protocolVersion: HQ_PROTOCOL_VERSION,
|
|
1077
1156
|
client: this.options.client,
|
|
1078
1157
|
project: this.options.project,
|
|
1079
|
-
capabilities: this.capabilities
|
|
1158
|
+
capabilities: this.capabilities,
|
|
1159
|
+
redactionPolicy: this.resolvedRedactionPolicy
|
|
1080
1160
|
}
|
|
1081
1161
|
};
|
|
1082
1162
|
}
|
|
@@ -1124,6 +1204,30 @@ var HqPublisher = class {
|
|
|
1124
1204
|
clearInterval(this.commandPollTimer);
|
|
1125
1205
|
this.commandPollTimer = null;
|
|
1126
1206
|
}
|
|
1207
|
+
startHeartbeat() {
|
|
1208
|
+
if (this.heartbeatTimer !== null) return;
|
|
1209
|
+
this.heartbeatTimer = setInterval(
|
|
1210
|
+
() => this.publishHeartbeat(),
|
|
1211
|
+
this.options.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS
|
|
1212
|
+
);
|
|
1213
|
+
this.heartbeatTimer.unref?.();
|
|
1214
|
+
}
|
|
1215
|
+
stopHeartbeat() {
|
|
1216
|
+
if (this.heartbeatTimer === null) return;
|
|
1217
|
+
clearInterval(this.heartbeatTimer);
|
|
1218
|
+
this.heartbeatTimer = null;
|
|
1219
|
+
}
|
|
1220
|
+
publishHeartbeat() {
|
|
1221
|
+
const startedAt = Date.parse(this.options.client.startedAt);
|
|
1222
|
+
const now = Date.parse(this.now());
|
|
1223
|
+
this.publishEvent({
|
|
1224
|
+
type: "client.heartbeat",
|
|
1225
|
+
payload: {
|
|
1226
|
+
uptimeMs: Number.isFinite(startedAt) && Number.isFinite(now) ? Math.max(0, now - startedAt) : 0,
|
|
1227
|
+
status: "idle"
|
|
1228
|
+
}
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1127
1231
|
async handleServerMessage(event) {
|
|
1128
1232
|
const message = this.parseServerMessage(event);
|
|
1129
1233
|
if (message?.type !== "hq.command_batch") return;
|
|
@@ -1215,13 +1319,32 @@ var HqPublisher = class {
|
|
|
1215
1319
|
this.reconnectTimer.unref?.();
|
|
1216
1320
|
}
|
|
1217
1321
|
};
|
|
1322
|
+
|
|
1323
|
+
// src/hq/factory.ts
|
|
1324
|
+
import { createHash as createHash2, randomUUID as randomUUID4 } from "node:crypto";
|
|
1325
|
+
import * as fs3 from "node:fs";
|
|
1326
|
+
import { hostname } from "node:os";
|
|
1327
|
+
import { basename as basename5 } from "node:path";
|
|
1328
|
+
|
|
1329
|
+
// src/coordination/global-mailbox.ts
|
|
1330
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
1331
|
+
import * as fsp from "node:fs/promises";
|
|
1332
|
+
import * as path4 from "node:path";
|
|
1333
|
+
|
|
1334
|
+
// src/utils/atomic-write.ts
|
|
1335
|
+
import { randomBytes } from "node:crypto";
|
|
1336
|
+
import * as fs from "node:fs/promises";
|
|
1337
|
+
import * as path3 from "node:path";
|
|
1338
|
+
|
|
1339
|
+
// src/utils/session-scoped-path.ts
|
|
1340
|
+
import * as path from "node:path";
|
|
1218
1341
|
function sessionScopedPath(dir, sessionId, suffix) {
|
|
1219
1342
|
if (!sessionId || sessionId.includes("\\") || sessionId.includes("..")) {
|
|
1220
1343
|
throw invalid(sessionId);
|
|
1221
1344
|
}
|
|
1222
|
-
const resolved =
|
|
1223
|
-
const rel =
|
|
1224
|
-
if (rel.startsWith("..") ||
|
|
1345
|
+
const resolved = path.resolve(dir, `${sessionId}${suffix}`);
|
|
1346
|
+
const rel = path.relative(path.resolve(dir), resolved);
|
|
1347
|
+
if (rel.startsWith("..") || path.isAbsolute(rel)) {
|
|
1225
1348
|
throw invalid(sessionId);
|
|
1226
1349
|
}
|
|
1227
1350
|
return resolved;
|
|
@@ -1234,6 +1357,11 @@ function invalid(sessionId) {
|
|
|
1234
1357
|
context: { reason: "path_traversal" }
|
|
1235
1358
|
});
|
|
1236
1359
|
}
|
|
1360
|
+
|
|
1361
|
+
// src/utils/wstack-paths.ts
|
|
1362
|
+
import { createHash } from "node:crypto";
|
|
1363
|
+
import * as os from "node:os";
|
|
1364
|
+
import * as path2 from "node:path";
|
|
1237
1365
|
function projectHash(absRoot) {
|
|
1238
1366
|
return createHash("sha256").update(path2.resolve(absRoot)).digest("hex").slice(0, 12);
|
|
1239
1367
|
}
|
|
@@ -1307,9 +1435,61 @@ function resolveWstackPaths(opts) {
|
|
|
1307
1435
|
|
|
1308
1436
|
// src/types/errors.ts
|
|
1309
1437
|
var ERROR_CODES = {
|
|
1438
|
+
// Provider
|
|
1439
|
+
PROVIDER_RATE_LIMITED: "PROVIDER_RATE_LIMITED",
|
|
1440
|
+
PROVIDER_AUTH_FAILED: "PROVIDER_AUTH_FAILED",
|
|
1441
|
+
PROVIDER_OVERLOADED: "PROVIDER_OVERLOADED",
|
|
1442
|
+
PROVIDER_INVALID_REQUEST: "PROVIDER_INVALID_REQUEST",
|
|
1443
|
+
PROVIDER_SERVER_ERROR: "PROVIDER_SERVER_ERROR",
|
|
1444
|
+
PROVIDER_NETWORK_ERROR: "PROVIDER_NETWORK_ERROR",
|
|
1445
|
+
PROVIDER_CONTEXT_OVERFLOW: "PROVIDER_CONTEXT_OVERFLOW",
|
|
1446
|
+
// Tool
|
|
1447
|
+
TOOL_NOT_FOUND: "TOOL_NOT_FOUND",
|
|
1448
|
+
TOOL_PERMISSION_DENIED: "TOOL_PERMISSION_DENIED",
|
|
1449
|
+
TOOL_EXECUTION_FAILED: "TOOL_EXECUTION_FAILED",
|
|
1450
|
+
TOOL_TIMEOUT: "TOOL_TIMEOUT",
|
|
1451
|
+
TOOL_INPUT_INVALID: "TOOL_INPUT_INVALID",
|
|
1452
|
+
// Config
|
|
1453
|
+
CONFIG_INVALID: "CONFIG_INVALID",
|
|
1454
|
+
CONFIG_NOT_FOUND: "CONFIG_NOT_FOUND",
|
|
1455
|
+
CONFIG_PARSE_FAILED: "CONFIG_PARSE_FAILED",
|
|
1456
|
+
CONFIG_MIGRATION_NEEDED: "CONFIG_MIGRATION_NEEDED",
|
|
1457
|
+
// Plugin
|
|
1458
|
+
PLUGIN_LOAD_FAILED: "PLUGIN_LOAD_FAILED",
|
|
1459
|
+
PLUGIN_API_MISMATCH: "PLUGIN_API_MISMATCH",
|
|
1460
|
+
PLUGIN_MISSING_DEPENDENCY: "PLUGIN_MISSING_DEPENDENCY",
|
|
1461
|
+
// Agent
|
|
1462
|
+
AGENT_ITERATION_LIMIT: "AGENT_ITERATION_LIMIT",
|
|
1463
|
+
AGENT_CONTEXT_OVERFLOW: "AGENT_CONTEXT_OVERFLOW",
|
|
1464
|
+
AGENT_ABORTED: "AGENT_ABORTED",
|
|
1465
|
+
AGENT_RUN_FAILED: "AGENT_RUN_FAILED",
|
|
1466
|
+
// Session
|
|
1467
|
+
SESSION_NOT_FOUND: "SESSION_NOT_FOUND",
|
|
1468
|
+
SESSION_CORRUPTED: "SESSION_CORRUPTED",
|
|
1469
|
+
SESSION_WRITE_FAILED: "SESSION_WRITE_FAILED",
|
|
1470
|
+
// Container / Registry
|
|
1471
|
+
CONTAINER_TOKEN_ALREADY_BOUND: "CONTAINER_TOKEN_ALREADY_BOUND",
|
|
1472
|
+
CONTAINER_TOKEN_NOT_BOUND: "CONTAINER_TOKEN_NOT_BOUND",
|
|
1473
|
+
CONTAINER_CIRCULAR_DEPENDENCY: "CONTAINER_CIRCULAR_DEPENDENCY",
|
|
1474
|
+
REGISTRY_DUPLICATE: "REGISTRY_DUPLICATE",
|
|
1475
|
+
REGISTRY_NOT_FOUND: "REGISTRY_NOT_FOUND",
|
|
1476
|
+
REGISTRY_INVALID: "REGISTRY_INVALID",
|
|
1310
1477
|
// File system
|
|
1311
1478
|
FS_READ_FAILED: "FS_READ_FAILED",
|
|
1312
|
-
|
|
1479
|
+
FS_WRITE_FAILED: "FS_WRITE_FAILED",
|
|
1480
|
+
FS_MKDIR_FAILED: "FS_MKDIR_FAILED",
|
|
1481
|
+
FS_DELETE_FAILED: "FS_DELETE_FAILED",
|
|
1482
|
+
FS_ATOMIC_WRITE_FAILED: "FS_ATOMIC_WRITE_FAILED",
|
|
1483
|
+
// SDD (Spec-Driven Development)
|
|
1484
|
+
SDD_VALIDATION_FAILED: "SDD_VALIDATION_FAILED",
|
|
1485
|
+
SDD_PARSE_FAILED: "SDD_PARSE_FAILED",
|
|
1486
|
+
SDD_INVALID_STATE: "SDD_INVALID_STATE",
|
|
1487
|
+
SDD_NOT_READY: "SDD_NOT_READY",
|
|
1488
|
+
// General
|
|
1489
|
+
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
1490
|
+
PARSE_FAILED: "PARSE_FAILED",
|
|
1491
|
+
UNKNOWN: "UNKNOWN"
|
|
1492
|
+
};
|
|
1313
1493
|
var WrongStackError = class extends Error {
|
|
1314
1494
|
code;
|
|
1315
1495
|
subsystem;
|
|
@@ -1357,17 +1537,17 @@ var FsError = class extends WrongStackError {
|
|
|
1357
1537
|
|
|
1358
1538
|
// src/utils/atomic-write.ts
|
|
1359
1539
|
async function atomicWrite(targetPath, content, opts = {}) {
|
|
1360
|
-
const dir =
|
|
1361
|
-
await
|
|
1362
|
-
const tmp =
|
|
1540
|
+
const dir = path3.dirname(targetPath);
|
|
1541
|
+
await fs.mkdir(dir, { recursive: true });
|
|
1542
|
+
const tmp = path3.join(dir, `.${path3.basename(targetPath)}.${randomBytes(6).toString("hex")}.tmp`);
|
|
1363
1543
|
try {
|
|
1364
1544
|
if (typeof content === "string") {
|
|
1365
|
-
await
|
|
1545
|
+
await fs.writeFile(tmp, content, { flag: "wx", encoding: opts.encoding ?? "utf8" });
|
|
1366
1546
|
} else {
|
|
1367
|
-
await
|
|
1547
|
+
await fs.writeFile(tmp, content, { flag: "wx" });
|
|
1368
1548
|
}
|
|
1369
1549
|
try {
|
|
1370
|
-
const fh = await
|
|
1550
|
+
const fh = await fs.open(tmp, "r+");
|
|
1371
1551
|
try {
|
|
1372
1552
|
await fh.sync();
|
|
1373
1553
|
} finally {
|
|
@@ -1377,53 +1557,53 @@ async function atomicWrite(targetPath, content, opts = {}) {
|
|
|
1377
1557
|
}
|
|
1378
1558
|
let mode;
|
|
1379
1559
|
try {
|
|
1380
|
-
const stat4 = await
|
|
1560
|
+
const stat4 = await fs.stat(targetPath);
|
|
1381
1561
|
mode = stat4.mode & 511;
|
|
1382
1562
|
} catch {
|
|
1383
1563
|
mode = opts.mode;
|
|
1384
1564
|
}
|
|
1385
1565
|
if (mode !== void 0) {
|
|
1386
|
-
await
|
|
1566
|
+
await fs.chmod(tmp, mode);
|
|
1387
1567
|
}
|
|
1388
1568
|
await renameWithRetry(tmp, targetPath);
|
|
1389
1569
|
if (mode !== void 0 && process.platform === "win32") {
|
|
1390
1570
|
try {
|
|
1391
|
-
await
|
|
1571
|
+
await fs.chmod(targetPath, mode);
|
|
1392
1572
|
} catch {
|
|
1393
1573
|
}
|
|
1394
1574
|
}
|
|
1395
1575
|
} catch (err) {
|
|
1396
1576
|
try {
|
|
1397
|
-
await
|
|
1577
|
+
await fs.unlink(tmp);
|
|
1398
1578
|
} catch {
|
|
1399
1579
|
}
|
|
1400
1580
|
throw err;
|
|
1401
1581
|
}
|
|
1402
1582
|
}
|
|
1403
1583
|
async function withFileLock(targetPath, fn, opts = {}) {
|
|
1404
|
-
const dir =
|
|
1405
|
-
await
|
|
1406
|
-
const lockPath =
|
|
1584
|
+
const dir = path3.dirname(targetPath);
|
|
1585
|
+
await fs.mkdir(dir, { recursive: true });
|
|
1586
|
+
const lockPath = path3.join(dir, `.${path3.basename(targetPath)}.lock`);
|
|
1407
1587
|
const timeoutMs = opts.timeoutMs ?? 5e3;
|
|
1408
1588
|
const staleMs = opts.staleMs ?? 3e4;
|
|
1409
1589
|
const started = Date.now();
|
|
1410
1590
|
let handle;
|
|
1411
1591
|
for (; ; ) {
|
|
1412
1592
|
try {
|
|
1413
|
-
handle = await
|
|
1593
|
+
handle = await fs.open(lockPath, "wx");
|
|
1414
1594
|
await handle.writeFile(`${process.pid}:${Date.now()}`);
|
|
1415
1595
|
break;
|
|
1416
1596
|
} catch (err) {
|
|
1417
1597
|
const code = err.code;
|
|
1418
1598
|
if (code === "ENOENT") {
|
|
1419
|
-
await
|
|
1599
|
+
await fs.mkdir(dir, { recursive: true });
|
|
1420
1600
|
continue;
|
|
1421
1601
|
}
|
|
1422
1602
|
if (code !== "EEXIST") throw err;
|
|
1423
1603
|
try {
|
|
1424
|
-
const stat4 = await
|
|
1604
|
+
const stat4 = await fs.stat(lockPath);
|
|
1425
1605
|
if (Date.now() - stat4.mtimeMs > staleMs) {
|
|
1426
|
-
await
|
|
1606
|
+
await fs.unlink(lockPath);
|
|
1427
1607
|
continue;
|
|
1428
1608
|
}
|
|
1429
1609
|
} catch {
|
|
@@ -1448,7 +1628,7 @@ async function withFileLock(targetPath, fn, opts = {}) {
|
|
|
1448
1628
|
} catch {
|
|
1449
1629
|
}
|
|
1450
1630
|
try {
|
|
1451
|
-
await
|
|
1631
|
+
await fs.unlink(lockPath);
|
|
1452
1632
|
} catch {
|
|
1453
1633
|
}
|
|
1454
1634
|
}
|
|
@@ -1456,14 +1636,14 @@ async function withFileLock(targetPath, fn, opts = {}) {
|
|
|
1456
1636
|
var TRANSIENT_RENAME_CODES = /* @__PURE__ */ new Set(["EPERM", "EBUSY", "EACCES", "ENOTEMPTY"]);
|
|
1457
1637
|
async function renameWithRetry(from, to) {
|
|
1458
1638
|
if (process.platform !== "win32") {
|
|
1459
|
-
await
|
|
1639
|
+
await fs.rename(from, to);
|
|
1460
1640
|
return;
|
|
1461
1641
|
}
|
|
1462
1642
|
const delays = [10, 25, 60, 120, 250];
|
|
1463
1643
|
let lastErr;
|
|
1464
1644
|
for (let i = 0; i <= delays.length; i++) {
|
|
1465
1645
|
try {
|
|
1466
|
-
await
|
|
1646
|
+
await fs.rename(from, to);
|
|
1467
1647
|
return;
|
|
1468
1648
|
} catch (err) {
|
|
1469
1649
|
lastErr = err;
|
|
@@ -1554,14 +1734,14 @@ var GlobalMailbox = class {
|
|
|
1554
1734
|
* @param hqPublisher — optional HQ publisher, or getter, for cross-project telemetry
|
|
1555
1735
|
*/
|
|
1556
1736
|
constructor(projectDir, events, hqPublisher) {
|
|
1557
|
-
this.messagePath =
|
|
1558
|
-
this.registryPath =
|
|
1559
|
-
this.clientRegistryPath =
|
|
1737
|
+
this.messagePath = path4.join(projectDir, MAILBOX_FILE);
|
|
1738
|
+
this.registryPath = path4.join(projectDir, "_mailbox.registry.json");
|
|
1739
|
+
this.clientRegistryPath = path4.join(projectDir, CLIENT_REGISTRY_FILE);
|
|
1560
1740
|
this._events = events;
|
|
1561
1741
|
this._hqPublisher = hqPublisher;
|
|
1562
1742
|
}
|
|
1563
1743
|
get hqMailboxId() {
|
|
1564
|
-
return `${
|
|
1744
|
+
return `${path4.basename(path4.dirname(this.messagePath))}:mailbox`;
|
|
1565
1745
|
}
|
|
1566
1746
|
get hqPublisher() {
|
|
1567
1747
|
return typeof this._hqPublisher === "function" ? this._hqPublisher() : this._hqPublisher;
|
|
@@ -1582,7 +1762,7 @@ var GlobalMailbox = class {
|
|
|
1582
1762
|
async send(input) {
|
|
1583
1763
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
1584
1764
|
const msg = {
|
|
1585
|
-
id:
|
|
1765
|
+
id: randomUUID2(),
|
|
1586
1766
|
from: input.from,
|
|
1587
1767
|
// "all" is an accepted spelling of the broadcast address — canonical
|
|
1588
1768
|
// form on disk is '*' so every query/checker matches it.
|
|
@@ -1598,7 +1778,7 @@ var GlobalMailbox = class {
|
|
|
1598
1778
|
taskContext: input.taskContext
|
|
1599
1779
|
};
|
|
1600
1780
|
const line = JSON.stringify(msg) + LINE_SEPARATOR;
|
|
1601
|
-
await fsp.mkdir(
|
|
1781
|
+
await fsp.mkdir(path4.dirname(this.messagePath), { recursive: true });
|
|
1602
1782
|
await withFileLock(this.messagePath, async () => {
|
|
1603
1783
|
await fsp.appendFile(this.messagePath, line, "utf8");
|
|
1604
1784
|
const { mtimeMs, size } = await this._statMessageFile();
|
|
@@ -2259,7 +2439,7 @@ var GlobalMailbox = class {
|
|
|
2259
2439
|
this._messageCacheSize = size;
|
|
2260
2440
|
}
|
|
2261
2441
|
async _ensureRegistry() {
|
|
2262
|
-
await fsp.mkdir(
|
|
2442
|
+
await fsp.mkdir(path4.dirname(this.registryPath), { recursive: true });
|
|
2263
2443
|
}
|
|
2264
2444
|
async _readRegistry(opts) {
|
|
2265
2445
|
if (!opts?.fresh && this._registryCache && Date.now() - this._registryCacheAt < REGISTRY_CACHE_TTL_MS) {
|
|
@@ -2308,13 +2488,13 @@ var GlobalMailbox = class {
|
|
|
2308
2488
|
for (const [id, agent] of registry) {
|
|
2309
2489
|
obj[id] = agent;
|
|
2310
2490
|
}
|
|
2311
|
-
const tmp = `${this.registryPath}.${
|
|
2491
|
+
const tmp = `${this.registryPath}.${randomUUID2().slice(0, 8)}.tmp`;
|
|
2312
2492
|
await fsp.writeFile(tmp, JSON.stringify(obj), "utf8");
|
|
2313
2493
|
await fsp.rename(tmp, this.registryPath);
|
|
2314
2494
|
}
|
|
2315
2495
|
// ── Client registry internals ───────────────────────────────────────────
|
|
2316
2496
|
async _ensureClientRegistry() {
|
|
2317
|
-
await fsp.mkdir(
|
|
2497
|
+
await fsp.mkdir(path4.dirname(this.clientRegistryPath), { recursive: true });
|
|
2318
2498
|
}
|
|
2319
2499
|
async _readClientRegistry(opts) {
|
|
2320
2500
|
if (!opts?.fresh && this._clientRegistryCache && Date.now() - this._clientRegistryCacheAt < REGISTRY_CACHE_TTL_MS) {
|
|
@@ -2353,19 +2533,25 @@ var GlobalMailbox = class {
|
|
|
2353
2533
|
for (const [id, client] of registry) {
|
|
2354
2534
|
obj[id] = client;
|
|
2355
2535
|
}
|
|
2356
|
-
const tmp = `${this.clientRegistryPath}.${
|
|
2536
|
+
const tmp = `${this.clientRegistryPath}.${randomUUID2().slice(0, 8)}.tmp`;
|
|
2357
2537
|
await fsp.writeFile(tmp, JSON.stringify(obj), "utf8");
|
|
2358
2538
|
await fsp.rename(tmp, this.clientRegistryPath);
|
|
2359
2539
|
}
|
|
2360
2540
|
};
|
|
2541
|
+
|
|
2542
|
+
// src/hq/auth-store.ts
|
|
2543
|
+
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
2544
|
+
import * as fs2 from "node:fs/promises";
|
|
2545
|
+
import * as syncFs from "node:fs";
|
|
2546
|
+
import * as path5 from "node:path";
|
|
2361
2547
|
var HQ_AUTH_FILE_VERSION = 1;
|
|
2362
2548
|
function defaultHqDataDir() {
|
|
2363
|
-
return
|
|
2549
|
+
return path5.join(wstackGlobalRoot(), "hq");
|
|
2364
2550
|
}
|
|
2365
2551
|
function resolveHqDataDir(override, env = process.env) {
|
|
2366
2552
|
const raw = override ?? env["WRONGSTACK_HQ_DATA_DIR"]?.trim();
|
|
2367
2553
|
if (!raw) return defaultHqDataDir();
|
|
2368
|
-
return
|
|
2554
|
+
return path5.isAbsolute(raw) ? path5.resolve(raw) : path5.resolve(process.cwd(), raw);
|
|
2369
2555
|
}
|
|
2370
2556
|
function tokenHasCapability(token, capability) {
|
|
2371
2557
|
if (token === void 0) return false;
|
|
@@ -2379,10 +2565,10 @@ function emptyHqAuthFile() {
|
|
|
2379
2565
|
};
|
|
2380
2566
|
}
|
|
2381
2567
|
function hqAuthFilePath(dataDir) {
|
|
2382
|
-
return
|
|
2568
|
+
return path5.join(dataDir, "auth.json");
|
|
2383
2569
|
}
|
|
2384
2570
|
function hqRuntimeFilePath(dataDir) {
|
|
2385
|
-
return
|
|
2571
|
+
return path5.join(dataDir, "runtime.json");
|
|
2386
2572
|
}
|
|
2387
2573
|
async function writeHqRuntimeFile(dataDir, file) {
|
|
2388
2574
|
const payload = {
|
|
@@ -2419,7 +2605,7 @@ async function readHqAuthFile(dataDir, opts = {}) {
|
|
|
2419
2605
|
const file = hqAuthFilePath(dataDir);
|
|
2420
2606
|
let raw;
|
|
2421
2607
|
try {
|
|
2422
|
-
raw = await
|
|
2608
|
+
raw = await fs2.readFile(file, "utf8");
|
|
2423
2609
|
} catch (err) {
|
|
2424
2610
|
if (err.code === "ENOENT") return emptyHqAuthFile();
|
|
2425
2611
|
opts.warn?.(`HQ auth file read failed at ${file}: ${err.message}`);
|
|
@@ -2452,7 +2638,7 @@ async function writeHqAuthFile(dataDir, file) {
|
|
|
2452
2638
|
async function ensureHqFirstRunAuthFile(dataDir, opts = {}) {
|
|
2453
2639
|
const file = hqAuthFilePath(dataDir);
|
|
2454
2640
|
try {
|
|
2455
|
-
await
|
|
2641
|
+
await fs2.access(file);
|
|
2456
2642
|
return { authFile: await readHqAuthFile(dataDir, opts), created: false };
|
|
2457
2643
|
} catch (err) {
|
|
2458
2644
|
if (err.code !== "ENOENT") {
|
|
@@ -2460,8 +2646,8 @@ async function ensureHqFirstRunAuthFile(dataDir, opts = {}) {
|
|
|
2460
2646
|
return { authFile: await readHqAuthFile(dataDir, opts), created: false };
|
|
2461
2647
|
}
|
|
2462
2648
|
}
|
|
2463
|
-
const browserToken = mintHqToken("first-run browser");
|
|
2464
|
-
const clientToken = mintHqToken("first-run client");
|
|
2649
|
+
const browserToken = { ...mintHqToken("first-run browser"), capabilities: ["control.enqueue"] };
|
|
2650
|
+
const clientToken = { ...mintHqToken("first-run client"), capabilities: ["telemetry.publish"] };
|
|
2465
2651
|
const authFile = {
|
|
2466
2652
|
version: HQ_AUTH_FILE_VERSION,
|
|
2467
2653
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -2480,8 +2666,8 @@ async function mutateHqAuthFile(dataDir, mutator, opts = {}) {
|
|
|
2480
2666
|
function mintHqToken(label) {
|
|
2481
2667
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2482
2668
|
return {
|
|
2483
|
-
id:
|
|
2484
|
-
token:
|
|
2669
|
+
id: randomUUID3(),
|
|
2670
|
+
token: randomUUID3().replace(/-/g, "") + randomUUID3().replace(/-/g, ""),
|
|
2485
2671
|
...label ? { label } : {},
|
|
2486
2672
|
createdAt: now
|
|
2487
2673
|
};
|
|
@@ -2494,7 +2680,7 @@ function watchHqAuthFile(dataDir, onChange, opts = {}) {
|
|
|
2494
2680
|
let closed = false;
|
|
2495
2681
|
let watcher;
|
|
2496
2682
|
try {
|
|
2497
|
-
watcher = syncFs.watch(
|
|
2683
|
+
watcher = syncFs.watch(path5.dirname(file), { recursive: false });
|
|
2498
2684
|
} catch (err) {
|
|
2499
2685
|
opts.warn?.(`HQ auth watcher could not start: ${err.message}`);
|
|
2500
2686
|
return { close: () => {
|
|
@@ -2518,7 +2704,7 @@ function watchHqAuthFile(dataDir, onChange, opts = {}) {
|
|
|
2518
2704
|
watcher.on("change", (eventType, filename) => {
|
|
2519
2705
|
const name = typeof filename === "string" ? filename : "";
|
|
2520
2706
|
if (eventType === "rename" || eventType === "change") {
|
|
2521
|
-
if (!name || name === "auth.json" || name ===
|
|
2707
|
+
if (!name || name === "auth.json" || name === path5.basename(file)) {
|
|
2522
2708
|
trigger();
|
|
2523
2709
|
}
|
|
2524
2710
|
}
|
|
@@ -2545,7 +2731,7 @@ function discoverLocalHqEndpoint(options = {}) {
|
|
|
2545
2731
|
}
|
|
2546
2732
|
function readFirstClientTokenFromAuthFile(dataDir) {
|
|
2547
2733
|
try {
|
|
2548
|
-
const raw =
|
|
2734
|
+
const raw = fs3.readFileSync(hqAuthFilePath(dataDir), "utf8");
|
|
2549
2735
|
const parsed = JSON.parse(raw);
|
|
2550
2736
|
return parsed.clientTokens?.find((t) => t.token.trim().length > 0)?.token;
|
|
2551
2737
|
} catch {
|
|
@@ -2578,6 +2764,10 @@ function resolveHqConfig(options = {}) {
|
|
|
2578
2764
|
const url = envUrl || configUrl;
|
|
2579
2765
|
const localFallbackToken = !url || isLoopbackHqUrl(url) ? readFirstClientTokenFromAuthFile(dataDir) : void 0;
|
|
2580
2766
|
const token = explicitToken || localFallbackToken;
|
|
2767
|
+
const rawContentEnv = env["WRONGSTACK_HQ_RAW_CONTENT"]?.trim();
|
|
2768
|
+
const explicitRawContent = rawContentEnv ? rawContentEnv === "1" : fileConfig?.rawContent;
|
|
2769
|
+
const projectAliasEnv = env["WRONGSTACK_HQ_PROJECT_ALIAS"]?.trim();
|
|
2770
|
+
const projectAlias = projectAliasEnv || fileConfig?.projectAlias;
|
|
2581
2771
|
if (!url) {
|
|
2582
2772
|
if (enabled === false) return void 0;
|
|
2583
2773
|
return {
|
|
@@ -2585,33 +2775,34 @@ function resolveHqConfig(options = {}) {
|
|
|
2585
2775
|
enabled: true,
|
|
2586
2776
|
discover: true,
|
|
2587
2777
|
dataDir,
|
|
2588
|
-
|
|
2778
|
+
rawContent: explicitRawContent ?? true,
|
|
2779
|
+
...token ? { token } : {},
|
|
2780
|
+
...projectAlias ? { projectAlias } : {}
|
|
2589
2781
|
};
|
|
2590
2782
|
}
|
|
2591
|
-
const
|
|
2592
|
-
const projectAliasEnv = env["WRONGSTACK_HQ_PROJECT_ALIAS"]?.trim();
|
|
2783
|
+
const rawContent = explicitRawContent ?? true;
|
|
2593
2784
|
return {
|
|
2594
2785
|
url,
|
|
2595
2786
|
...token ? { token } : {},
|
|
2596
2787
|
...enabled !== void 0 ? { enabled } : {},
|
|
2597
|
-
...
|
|
2598
|
-
...
|
|
2788
|
+
...rawContent !== void 0 ? { rawContent } : {},
|
|
2789
|
+
...projectAlias ? { projectAlias } : {}
|
|
2599
2790
|
};
|
|
2600
2791
|
}
|
|
2601
2792
|
function stableMachineId() {
|
|
2602
|
-
return
|
|
2793
|
+
return createHash2("sha256").update(hostname()).digest("hex").slice(0, 12);
|
|
2603
2794
|
}
|
|
2604
2795
|
function deriveProjectId(projectRoot) {
|
|
2605
|
-
return
|
|
2796
|
+
return createHash2("sha256").update(projectRoot).digest("hex").slice(0, 12);
|
|
2606
2797
|
}
|
|
2607
2798
|
function createHqPublisherFromEnv(options) {
|
|
2608
2799
|
const config = options.config ?? resolveHqConfig({ config: options.appConfig?.hq });
|
|
2609
2800
|
if (!config || config.enabled === false) return void 0;
|
|
2610
2801
|
const machineId = options.machineId ?? stableMachineId();
|
|
2611
2802
|
const host = options.hostnameOverride ?? hostname();
|
|
2612
|
-
const projectName = options.projectName ?? config.projectAlias ?? (
|
|
2803
|
+
const projectName = options.projectName ?? config.projectAlias ?? (basename5(options.projectRoot) || "unknown");
|
|
2613
2804
|
const client = {
|
|
2614
|
-
clientId: `${machineId}:${options.clientKind}:${process.pid}`,
|
|
2805
|
+
clientId: `${machineId}:${options.clientKind}:${process.pid}:${randomUUID4().slice(0, 8)}`,
|
|
2615
2806
|
kind: options.clientKind,
|
|
2616
2807
|
machineId,
|
|
2617
2808
|
...host ? { hostname: host } : {},
|
|
@@ -2704,6 +2895,10 @@ function startAgentMonitorEventBridge(opts) {
|
|
|
2704
2895
|
};
|
|
2705
2896
|
}
|
|
2706
2897
|
|
|
2898
|
+
// src/hq/session-bridge.ts
|
|
2899
|
+
import * as fs4 from "node:fs";
|
|
2900
|
+
import * as fsp2 from "node:fs/promises";
|
|
2901
|
+
|
|
2707
2902
|
// src/hq/transcript-mapper.ts
|
|
2708
2903
|
function blocksToText(content) {
|
|
2709
2904
|
if (typeof content === "string") return content;
|
|
@@ -2852,6 +3047,8 @@ var VALID_AGENT_STATUS = /* @__PURE__ */ new Set([
|
|
|
2852
3047
|
"waiting_user",
|
|
2853
3048
|
"error"
|
|
2854
3049
|
]);
|
|
3050
|
+
var MAX_TRANSCRIPT_BATCH_ENTRIES = 32;
|
|
3051
|
+
var MAX_TRANSCRIPT_BATCH_BYTES = 512 * 1024;
|
|
2855
3052
|
function toAgentSummary(a) {
|
|
2856
3053
|
const status = VALID_AGENT_STATUS.has(a.status) ? a.status : "idle";
|
|
2857
3054
|
return {
|
|
@@ -2923,6 +3120,37 @@ function startSessionTelemetryBridge(opts) {
|
|
|
2923
3120
|
} catch {
|
|
2924
3121
|
}
|
|
2925
3122
|
}
|
|
3123
|
+
function publishTranscriptEntries(entries) {
|
|
3124
|
+
let batch = [];
|
|
3125
|
+
let batchFromSeq = seqEmitted;
|
|
3126
|
+
const publishBatch = () => {
|
|
3127
|
+
if (batch.length === 0) return;
|
|
3128
|
+
try {
|
|
3129
|
+
publisher.publishTranscriptAppend({
|
|
3130
|
+
sessionId: opts.sessionId,
|
|
3131
|
+
fromSeq: batchFromSeq,
|
|
3132
|
+
entries: batch
|
|
3133
|
+
});
|
|
3134
|
+
} catch {
|
|
3135
|
+
}
|
|
3136
|
+
seqEmitted += batch.length;
|
|
3137
|
+
batch = [];
|
|
3138
|
+
batchFromSeq = seqEmitted;
|
|
3139
|
+
};
|
|
3140
|
+
for (const entry of entries) {
|
|
3141
|
+
const candidate = [...batch, entry];
|
|
3142
|
+
const candidatePayload = {
|
|
3143
|
+
sessionId: opts.sessionId,
|
|
3144
|
+
fromSeq: batchFromSeq,
|
|
3145
|
+
entries: candidate
|
|
3146
|
+
};
|
|
3147
|
+
const tooManyEntries = candidate.length > MAX_TRANSCRIPT_BATCH_ENTRIES;
|
|
3148
|
+
const tooLarge = batch.length > 0 && Buffer.byteLength(JSON.stringify(candidatePayload), "utf8") > MAX_TRANSCRIPT_BATCH_BYTES;
|
|
3149
|
+
if (tooManyEntries || tooLarge) publishBatch();
|
|
3150
|
+
batch.push(entry);
|
|
3151
|
+
}
|
|
3152
|
+
publishBatch();
|
|
3153
|
+
}
|
|
2926
3154
|
const offAgents = opts.events?.on("session.agents_updated", (payload) => {
|
|
2927
3155
|
agents = payload.agents.map(toAgentSummary);
|
|
2928
3156
|
lastActivityAt = now();
|
|
@@ -2938,7 +3166,7 @@ function startSessionTelemetryBridge(opts) {
|
|
|
2938
3166
|
function setupWatcher() {
|
|
2939
3167
|
if (disposed || watcher) return;
|
|
2940
3168
|
try {
|
|
2941
|
-
const nextWatcher =
|
|
3169
|
+
const nextWatcher = fs4.watch(sessionFile, () => {
|
|
2942
3170
|
if (watchPending || disposed) return;
|
|
2943
3171
|
watchPending = true;
|
|
2944
3172
|
setTimeout(() => {
|
|
@@ -2962,12 +3190,12 @@ function startSessionTelemetryBridge(opts) {
|
|
|
2962
3190
|
if (disposed || tailing) return;
|
|
2963
3191
|
tailing = true;
|
|
2964
3192
|
try {
|
|
2965
|
-
const stat4 = await
|
|
3193
|
+
const stat4 = await fsp2.stat(sessionFile).catch(() => null);
|
|
2966
3194
|
if (disposed) return;
|
|
2967
3195
|
if (!stat4) return;
|
|
2968
3196
|
setupWatcher();
|
|
2969
3197
|
if (stat4.size <= offset) return;
|
|
2970
|
-
const fd = await
|
|
3198
|
+
const fd = await fsp2.open(sessionFile, "r");
|
|
2971
3199
|
try {
|
|
2972
3200
|
if (disposed) return;
|
|
2973
3201
|
const len = stat4.size - offset;
|
|
@@ -2990,15 +3218,7 @@ function startSessionTelemetryBridge(opts) {
|
|
|
2990
3218
|
for (const entry of mapSessionEventToEntries(obj)) entries.push(entry);
|
|
2991
3219
|
}
|
|
2992
3220
|
if (entries.length > 0) {
|
|
2993
|
-
|
|
2994
|
-
publisher.publishTranscriptAppend({
|
|
2995
|
-
sessionId: opts.sessionId,
|
|
2996
|
-
fromSeq: seqEmitted,
|
|
2997
|
-
entries
|
|
2998
|
-
});
|
|
2999
|
-
} catch {
|
|
3000
|
-
}
|
|
3001
|
-
seqEmitted += entries.length;
|
|
3221
|
+
publishTranscriptEntries(entries);
|
|
3002
3222
|
lastActivityAt = now();
|
|
3003
3223
|
}
|
|
3004
3224
|
} finally {
|
|
@@ -3306,6 +3526,7 @@ function startToolTelemetryBridge(opts) {
|
|
|
3306
3526
|
toolName: p.name,
|
|
3307
3527
|
...p.input !== void 0 ? {
|
|
3308
3528
|
inputSummary: summarizeHqToolArgs(p.input, {
|
|
3529
|
+
policy: publisher.redactionPolicy,
|
|
3309
3530
|
...opts.projectRoot !== void 0 ? { projectRoot: opts.projectRoot } : {}
|
|
3310
3531
|
})
|
|
3311
3532
|
} : {}
|
|
@@ -3327,7 +3548,7 @@ function startToolTelemetryBridge(opts) {
|
|
|
3327
3548
|
toolName: p.name,
|
|
3328
3549
|
status: p.ok ? "success" : "error",
|
|
3329
3550
|
durationMs: p.durationMs,
|
|
3330
|
-
...p.output !== void 0 && p.output.length > 0 ? { outputSummary: truncateForSummary(p.output) } : {}
|
|
3551
|
+
...p.output !== void 0 && p.output.length > 0 ? { outputSummary: truncateForSummary(p.output, publisher.redactionPolicy) } : {}
|
|
3331
3552
|
};
|
|
3332
3553
|
publisher.publishEvent({
|
|
3333
3554
|
type: "tool.completed",
|
|
@@ -3344,9 +3565,13 @@ function startToolTelemetryBridge(opts) {
|
|
|
3344
3565
|
inFlight.clear();
|
|
3345
3566
|
};
|
|
3346
3567
|
}
|
|
3347
|
-
function truncateForSummary(output, max = 280) {
|
|
3348
|
-
|
|
3349
|
-
|
|
3568
|
+
function truncateForSummary(output, policy, max = 280) {
|
|
3569
|
+
const resolved = resolveHqRedactionPolicy(policy);
|
|
3570
|
+
if (resolved.rawContent) {
|
|
3571
|
+
if (output.length <= max) return output;
|
|
3572
|
+
return `${output.slice(0, max)}\u2026[truncated:${output.length - max}]`;
|
|
3573
|
+
}
|
|
3574
|
+
return scrubAndTruncateHqPreview(output, max) ?? "";
|
|
3350
3575
|
}
|
|
3351
3576
|
|
|
3352
3577
|
// src/hq/cost-bridge.ts
|
|
@@ -3375,6 +3600,10 @@ function startCostTelemetryBridge(opts) {
|
|
|
3375
3600
|
off();
|
|
3376
3601
|
};
|
|
3377
3602
|
}
|
|
3603
|
+
|
|
3604
|
+
// src/hq/persistence.ts
|
|
3605
|
+
import * as fs5 from "node:fs/promises";
|
|
3606
|
+
import * as path6 from "node:path";
|
|
3378
3607
|
var DEFAULT_EVENT_LOG_MAX_LINES = 5e4;
|
|
3379
3608
|
var DEFAULT_EVENT_LOG_ROTATE_KEEP = 2e4;
|
|
3380
3609
|
var HqEventLog = class {
|
|
@@ -3385,7 +3614,7 @@ var HqEventLog = class {
|
|
|
3385
3614
|
lineCount = 0;
|
|
3386
3615
|
counted = false;
|
|
3387
3616
|
constructor(opts) {
|
|
3388
|
-
this.filePath =
|
|
3617
|
+
this.filePath = path6.join(opts.dataDir, "events.jsonl");
|
|
3389
3618
|
this.maxLines = opts.maxLines ?? DEFAULT_EVENT_LOG_MAX_LINES;
|
|
3390
3619
|
this.rotateKeep = opts.rotateKeep ?? DEFAULT_EVENT_LOG_ROTATE_KEEP;
|
|
3391
3620
|
}
|
|
@@ -3405,7 +3634,7 @@ var HqEventLog = class {
|
|
|
3405
3634
|
this.counted = true;
|
|
3406
3635
|
}
|
|
3407
3636
|
const line = JSON.stringify(event) + "\n";
|
|
3408
|
-
await
|
|
3637
|
+
await fs5.appendFile(this.filePath, line, { encoding: "utf8" });
|
|
3409
3638
|
this.lineCount += 1;
|
|
3410
3639
|
if (this.lineCount >= this.maxLines) {
|
|
3411
3640
|
await this.rotate();
|
|
@@ -3414,7 +3643,7 @@ var HqEventLog = class {
|
|
|
3414
3643
|
async rotate() {
|
|
3415
3644
|
await withFileLock(this.filePath, async () => {
|
|
3416
3645
|
try {
|
|
3417
|
-
const content = await
|
|
3646
|
+
const content = await fs5.readFile(this.filePath, "utf8");
|
|
3418
3647
|
const lines = content.split("\n").filter((l) => l.length > 0);
|
|
3419
3648
|
if (lines.length <= this.rotateKeep) {
|
|
3420
3649
|
this.lineCount = lines.length;
|
|
@@ -3429,7 +3658,7 @@ var HqEventLog = class {
|
|
|
3429
3658
|
}
|
|
3430
3659
|
async countLines() {
|
|
3431
3660
|
try {
|
|
3432
|
-
const content = await
|
|
3661
|
+
const content = await fs5.readFile(this.filePath, "utf8");
|
|
3433
3662
|
return content.split("\n").filter((l) => l.length > 0).length;
|
|
3434
3663
|
} catch {
|
|
3435
3664
|
return 0;
|
|
@@ -3442,7 +3671,7 @@ var HqEventLog = class {
|
|
|
3442
3671
|
async recent(limit, typeFilter) {
|
|
3443
3672
|
let content;
|
|
3444
3673
|
try {
|
|
3445
|
-
content = await
|
|
3674
|
+
content = await fs5.readFile(this.filePath, "utf8");
|
|
3446
3675
|
} catch {
|
|
3447
3676
|
return [];
|
|
3448
3677
|
}
|
|
@@ -3469,7 +3698,7 @@ var HqSnapshotStore = class {
|
|
|
3469
3698
|
filePath;
|
|
3470
3699
|
writeChain = Promise.resolve();
|
|
3471
3700
|
constructor(opts) {
|
|
3472
|
-
this.filePath =
|
|
3701
|
+
this.filePath = path6.join(opts.dataDir, "snapshot.json");
|
|
3473
3702
|
}
|
|
3474
3703
|
/** Persist a snapshot. Best-effort, never rejects. */
|
|
3475
3704
|
save(snapshot) {
|
|
@@ -3484,7 +3713,7 @@ var HqSnapshotStore = class {
|
|
|
3484
3713
|
/** Read the last persisted snapshot, or `null` if none. */
|
|
3485
3714
|
async load() {
|
|
3486
3715
|
try {
|
|
3487
|
-
const content = await
|
|
3716
|
+
const content = await fs5.readFile(this.filePath, "utf8");
|
|
3488
3717
|
return JSON.parse(content);
|
|
3489
3718
|
} catch {
|
|
3490
3719
|
return null;
|
|
@@ -3498,7 +3727,7 @@ var HqTimeseriesStore = class {
|
|
|
3498
3727
|
buckets = /* @__PURE__ */ new Map();
|
|
3499
3728
|
flushChain = Promise.resolve();
|
|
3500
3729
|
constructor(opts) {
|
|
3501
|
-
this.filePath =
|
|
3730
|
+
this.filePath = path6.join(opts.dataDir, "timeseries.jsonl");
|
|
3502
3731
|
this.bucketMs = opts.bucketMs ?? 5 * 60 * 1e3;
|
|
3503
3732
|
this.maxBuckets = opts.maxBuckets ?? 2016;
|
|
3504
3733
|
}
|
|
@@ -3542,7 +3771,7 @@ var HqTimeseriesStore = class {
|
|
|
3542
3771
|
async flushInternal(toWrite) {
|
|
3543
3772
|
const lines = toWrite.map((b) => JSON.stringify(b)).join("\n") + "\n";
|
|
3544
3773
|
await withFileLock(this.filePath, async () => {
|
|
3545
|
-
await
|
|
3774
|
+
await fs5.appendFile(this.filePath, lines, { encoding: "utf8" });
|
|
3546
3775
|
});
|
|
3547
3776
|
const sorted = Array.from(this.buckets.keys()).sort((a, b) => a - b);
|
|
3548
3777
|
while (this.buckets.size > this.maxBuckets) {
|
|
@@ -3561,7 +3790,7 @@ var HqTimeseriesStore = class {
|
|
|
3561
3790
|
async load() {
|
|
3562
3791
|
let content;
|
|
3563
3792
|
try {
|
|
3564
|
-
content = await
|
|
3793
|
+
content = await fs5.readFile(this.filePath, "utf8");
|
|
3565
3794
|
} catch {
|
|
3566
3795
|
return;
|
|
3567
3796
|
}
|
|
@@ -3680,6 +3909,15 @@ var HqCommandAuditLog = class {
|
|
|
3680
3909
|
const entry = this.entries.find((e) => e.commandId === commandId);
|
|
3681
3910
|
if (entry) Object.assign(entry, patch);
|
|
3682
3911
|
}
|
|
3912
|
+
/** Update only when the command belongs to the authenticated client. */
|
|
3913
|
+
updateForClient(commandId, clientId, patch) {
|
|
3914
|
+
const entry = this.entries.find(
|
|
3915
|
+
(candidate) => candidate.commandId === commandId && candidate.clientId === clientId
|
|
3916
|
+
);
|
|
3917
|
+
if (!entry) return false;
|
|
3918
|
+
Object.assign(entry, patch);
|
|
3919
|
+
return true;
|
|
3920
|
+
}
|
|
3683
3921
|
recent(limit = 200) {
|
|
3684
3922
|
return this.entries.slice(-limit);
|
|
3685
3923
|
}
|
|
@@ -3837,7 +4075,64 @@ function toAlertMessage(alert) {
|
|
|
3837
4075
|
timestamp: new Date(alert.lastFiredAt).toISOString()
|
|
3838
4076
|
};
|
|
3839
4077
|
}
|
|
3840
|
-
|
|
3841
|
-
|
|
4078
|
+
export {
|
|
4079
|
+
DEFAULT_HQ_REDACTION_POLICY,
|
|
4080
|
+
HQ_AUTH_FILE_VERSION,
|
|
4081
|
+
HQ_COMMAND_TYPES,
|
|
4082
|
+
HQ_PROTOCOL_VERSION,
|
|
4083
|
+
HQ_TRANSCRIPT_TEXT_CAP,
|
|
4084
|
+
HqAlertEngine,
|
|
4085
|
+
HqCommandAuditLog,
|
|
4086
|
+
HqEventLog,
|
|
4087
|
+
HqPublisher,
|
|
4088
|
+
HqSnapshotStore,
|
|
4089
|
+
HqTimeseriesStore,
|
|
4090
|
+
buildTranscriptFromEvents,
|
|
4091
|
+
createGlobalMailbox,
|
|
4092
|
+
createHqEventEnvelope,
|
|
4093
|
+
createHqPersistence,
|
|
4094
|
+
createHqPublisherFromEnv,
|
|
4095
|
+
createMailboxEventPayload,
|
|
4096
|
+
createMailboxSnapshotPayload,
|
|
4097
|
+
createMailboxSnapshotPayloadFromMailbox,
|
|
4098
|
+
defaultHqDataDir,
|
|
4099
|
+
discoverLocalHqEndpoint,
|
|
4100
|
+
emptyHqAuthFile,
|
|
4101
|
+
ensureHqFirstRunAuthFile,
|
|
4102
|
+
hqAuthFilePath,
|
|
4103
|
+
hqRuntimeFilePath,
|
|
4104
|
+
mapMailboxAgentToHqSummary,
|
|
4105
|
+
mapMailboxMessageToHqSummary,
|
|
4106
|
+
mapSessionEventToEntries,
|
|
4107
|
+
mergeToolResults,
|
|
4108
|
+
mintHqBrowserToken,
|
|
4109
|
+
mintHqToken,
|
|
4110
|
+
mutateHqAuthFile,
|
|
4111
|
+
parseHqEventPayload,
|
|
4112
|
+
parseHqFrame,
|
|
4113
|
+
readHqAuthFile,
|
|
4114
|
+
readHqRuntimeFileSync,
|
|
4115
|
+
redactHqEvent,
|
|
4116
|
+
redactHqValue,
|
|
4117
|
+
resolveHqConfig,
|
|
4118
|
+
resolveHqConfigFromEnv,
|
|
4119
|
+
resolveHqDataDir,
|
|
4120
|
+
resolveHqRedactionPolicy,
|
|
4121
|
+
scrubAndTruncateHqPreview,
|
|
4122
|
+
startAgentMonitorEventBridge,
|
|
4123
|
+
startBrainTelemetryBridge,
|
|
4124
|
+
startCostTelemetryBridge,
|
|
4125
|
+
startFleetTelemetryBridge,
|
|
4126
|
+
startSessionTelemetryBridge,
|
|
4127
|
+
startToolTelemetryBridge,
|
|
4128
|
+
startWorktreeTelemetryBridge,
|
|
4129
|
+
summarizeHqToolArgs,
|
|
4130
|
+
tightenHqRedactionPolicy,
|
|
4131
|
+
toAlertMessage,
|
|
4132
|
+
tokenHasCapability,
|
|
4133
|
+
validateHqCommand,
|
|
4134
|
+
watchHqAuthFile,
|
|
4135
|
+
writeHqAuthFile,
|
|
4136
|
+
writeHqRuntimeFile
|
|
4137
|
+
};
|
|
3842
4138
|
//# sourceMappingURL=index.js.map
|
|
3843
|
-
//# sourceMappingURL=index.js.map
|