@wrongstack/core 0.296.4 → 0.298.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/chronicle/index.js +126 -22
- package/dist/chronicle/project-server-client.d.ts +12 -0
- package/dist/chronicle/project-server-protocol.d.ts +22 -0
- package/dist/chronicle/project-server.js +1076 -283
- package/dist/coordination/agents/index.js +136 -1
- package/dist/coordination/agents/role-skills.d.ts +3 -2
- package/dist/coordination/brain-cache.d.ts +14 -0
- package/dist/coordination/brain-trace.d.ts +2 -1
- package/dist/coordination/director/director-task-registry.d.ts +12 -0
- package/dist/coordination/fleet-supervisor.d.ts +21 -0
- package/dist/coordination/index.d.ts +23 -21
- package/dist/coordination/index.js +16514 -15945
- package/dist/coordination/mail-tools.d.ts +3 -3
- package/dist/coordination/mailbox-credential-store.d.ts +22 -2
- package/dist/coordination/mailbox-credential-throttle.d.ts +63 -0
- package/dist/coordination/mailbox-http-router.d.ts +6 -0
- package/dist/coordination/mailbox-project-server-client.d.ts +16 -0
- package/dist/coordination/mailbox-project-server-protocol.d.ts +43 -5
- package/dist/coordination/mailbox-project-server.js +1270 -289
- package/dist/coordination/provider-status-tracker.d.ts +2 -0
- package/dist/coordination/remote-mailbox-credential-store.d.ts +5 -5
- package/dist/coordination/remote-mailbox.d.ts +30 -4
- package/dist/coordination/sqlite-mailbox-credentials.d.ts +11 -0
- package/dist/core/context.d.ts +5 -5
- package/dist/core/fallback-profile-manager.d.ts +14 -0
- package/dist/core/index.js +624 -168
- package/dist/core/instruction-bundle.d.ts +12 -0
- package/dist/core/system-prompt-builder.d.ts +14 -0
- package/dist/core/system-prompt-skill-bodies.d.ts +1 -1
- package/dist/core/system-prompt-skill-text.d.ts +1 -2
- package/dist/defaults/index.js +2393 -1302
- package/dist/design/index.js +47 -8
- package/dist/execution/design-materialize.d.ts +22 -0
- package/dist/execution/index.js +582 -285
- package/dist/execution/skill-loader.d.ts +10 -1
- package/dist/execution/tool-error-taxonomy.d.ts +31 -0
- package/dist/execution/tool-executor.d.ts +1 -0
- package/dist/goal/index.js +71 -17
- package/dist/goal/phase-store.d.ts +7 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hq/auth-audit.d.ts +6 -0
- package/dist/hq/auth-store.d.ts +59 -3
- package/dist/hq/index.js +680 -163
- package/dist/hq/kanban-store.d.ts +3 -0
- package/dist/hq/persistence/event-log.d.ts +25 -0
- package/dist/hq/persistence.d.ts +1 -1
- package/dist/hq/protocol/browser.d.ts +2 -1
- package/dist/hq/protocol/client.d.ts +18 -1
- package/dist/hq/protocol/core.d.ts +5 -16
- package/dist/hq/protocol/envelope.d.ts +29 -0
- package/dist/hq/protocol/governance.d.ts +34 -0
- package/dist/hq/protocol/peer.d.ts +55 -0
- package/dist/hq/protocol/project.d.ts +3 -0
- package/dist/hq/protocol/resume.d.ts +56 -0
- package/dist/hq/protocol.d.ts +11 -8
- package/dist/hq/protocol.js +675 -0
- package/dist/hq/publisher.d.ts +31 -2
- package/dist/hq/session-bridge.d.ts +8 -0
- package/dist/index.js +7197 -4006
- package/dist/infrastructure/index.js +198 -101
- package/dist/kernel/events/session-events.d.ts +3 -0
- package/dist/kernel/events/tool-events.d.ts +3 -1
- package/dist/models/index.js +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.js +103 -5
- package/dist/observability/metrics.d.ts +37 -0
- package/dist/observability/prometheus.d.ts +11 -0
- package/dist/plugin/index.d.ts +5 -1
- package/dist/plugin/index.js +965 -511
- package/dist/plugins/auto-review-plugin.d.ts +6 -0
- package/dist/plugins/review-store-maintenance.d.ts +26 -0
- package/dist/plugins/review-types.d.ts +6 -0
- package/dist/security/capabilities.d.ts +45 -1
- package/dist/security/error-sanitize.d.ts +49 -0
- package/dist/security/file-permissions.d.ts +41 -0
- package/dist/security/index.d.ts +9 -6
- package/dist/security/index.js +3007 -2032
- package/dist/security/permission-policy.d.ts +55 -3
- package/dist/security/secret-vault.d.ts +17 -0
- package/dist/security/totp.d.ts +86 -0
- package/dist/skills/frontmatter.d.ts +12 -1
- package/dist/skills/github-fetcher.d.ts +48 -0
- package/dist/skills/index.js +137 -26
- package/dist/skills/limits.d.ts +19 -0
- package/dist/skills/skill-installer.d.ts +13 -0
- package/dist/storage/file-session-writer.d.ts +23 -0
- package/dist/storage/index.js +1140 -905
- package/dist/storage/provider-config-watcher.d.ts +1 -0
- package/dist/storage/session-helpers.d.ts +1 -0
- package/dist/storage/session-reader.d.ts +0 -7
- package/dist/storage/session-store/types.d.ts +12 -1
- package/dist/storage/session-store.d.ts +11 -2
- package/dist/storage/session-workspace-checkpoints.d.ts +5 -0
- package/dist/tools/fallback-manage-tools.d.ts +6 -0
- package/dist/tools/index.js +305 -133
- package/dist/tools/mcp-use.d.ts +1 -1
- package/dist/types/blocks.d.ts +7 -0
- package/dist/types/config/autonomy.d.ts +12 -3
- package/dist/types/config/mcp-features.d.ts +15 -1
- package/dist/types/config/root.d.ts +10 -4
- package/dist/types/context-window.d.ts +15 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/observability.d.ts +13 -0
- package/dist/types/secret-vault.d.ts +8 -0
- package/dist/types/session.d.ts +42 -0
- package/dist/types/skill.d.ts +56 -0
- package/dist/types/tool-executor.d.ts +2 -0
- package/dist/utils/continuous-memory-profiler.d.ts +35 -0
- package/dist/utils/env-typed.d.ts +64 -0
- package/dist/utils/glob-match.d.ts +21 -1
- package/dist/utils/heap-watchdog-types.d.ts +62 -0
- package/dist/utils/heap-watchdog.d.ts +15 -34
- package/dist/utils/heap-watchdog.js +592 -18
- package/dist/utils/incoming-images.d.ts +19 -0
- package/dist/utils/index.d.ts +15 -11
- package/dist/utils/index.js +1425 -545
- package/dist/utils/memory-flight-recorder.d.ts +47 -0
- package/dist/utils/path-segment.d.ts +29 -0
- package/dist/utils/tool-name.d.ts +34 -0
- package/dist/utils/win32-cmd.d.ts +25 -0
- package/dist/worktree/index.js +5 -0
- package/package.json +11 -3
- package/skills/chimera/SKILL.md +16 -4
- package/skills/data-governance/SKILL.md +92 -0
- package/skills/wrongstack-kanban/SKILL.md +129 -0
- package/skills/wrongstack-kanban/agents/openai.yaml +4 -0
- package/skills/wrongstack-mailbox-mcp/SKILL.md +72 -0
- package/skills/wrongstack-mailbox-mcp/agents/openai.yaml +4 -0
- package/dist/agent-status-helpers.d.ts.map +0 -1
- package/dist/agent-status-tracker.d.ts.map +0 -1
- package/dist/boot.d.ts.map +0 -1
- package/dist/chronicle/context.d.ts.map +0 -1
- package/dist/chronicle/decision-adapter.d.ts.map +0 -1
- package/dist/chronicle/domain-adapter.d.ts.map +0 -1
- package/dist/chronicle/event-hash.d.ts.map +0 -1
- package/dist/chronicle/file-observer.d.ts.map +0 -1
- package/dist/chronicle/health-monitor.d.ts.map +0 -1
- package/dist/chronicle/identity.d.ts.map +0 -1
- package/dist/chronicle/index.d.ts.map +0 -1
- package/dist/chronicle/index.js.map +0 -7
- package/dist/chronicle/journal.d.ts.map +0 -1
- package/dist/chronicle/legacy-journal-import.d.ts.map +0 -1
- package/dist/chronicle/metrics-store.d.ts.map +0 -1
- package/dist/chronicle/partition-filename.d.ts.map +0 -1
- package/dist/chronicle/partition-range-cache.d.ts.map +0 -1
- package/dist/chronicle/process-adapter.d.ts.map +0 -1
- package/dist/chronicle/project-access.d.ts.map +0 -1
- package/dist/chronicle/project-server-client.d.ts.map +0 -1
- package/dist/chronicle/project-server-endpoint.d.ts.map +0 -1
- package/dist/chronicle/project-server-protocol.d.ts.map +0 -1
- package/dist/chronicle/project-server.d.ts.map +0 -1
- package/dist/chronicle/project-server.js.map +0 -7
- package/dist/chronicle/prompt-manifest.d.ts.map +0 -1
- package/dist/chronicle/provider-adapter.d.ts.map +0 -1
- package/dist/chronicle/query.d.ts.map +0 -1
- package/dist/chronicle/review-adapter.d.ts.map +0 -1
- package/dist/chronicle/rollup-adapter.d.ts.map +0 -1
- package/dist/chronicle/sink.d.ts.map +0 -1
- package/dist/chronicle/sqlite-journal.d.ts.map +0 -1
- package/dist/chronicle/sqlite-query.d.ts.map +0 -1
- package/dist/chronicle/stream-adapter.d.ts.map +0 -1
- package/dist/chronicle/tool-adapter.d.ts.map +0 -1
- package/dist/chronicle/types.d.ts.map +0 -1
- package/dist/coordination/adaptive-concurrency.d.ts.map +0 -1
- package/dist/coordination/agent-bridge.d.ts.map +0 -1
- package/dist/coordination/agent-monitor.d.ts.map +0 -1
- package/dist/coordination/agent-subagent-runner.d.ts.map +0 -1
- package/dist/coordination/agents/agent-prompts.d.ts.map +0 -1
- package/dist/coordination/agents/index.d.ts.map +0 -1
- package/dist/coordination/agents/index.js.map +0 -7
- package/dist/coordination/agents/phase1-discovery.d.ts.map +0 -1
- package/dist/coordination/agents/phase2-planning.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-build.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-techstack.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-wave1-platform.d.ts.map +0 -1
- package/dist/coordination/agents/phase3-wave2-meta.d.ts.map +0 -1
- package/dist/coordination/agents/phase4-verify.d.ts.map +0 -1
- package/dist/coordination/agents/phase5-review.d.ts.map +0 -1
- package/dist/coordination/agents/phase6-domain.d.ts.map +0 -1
- package/dist/coordination/agents/phase7-knowledge.d.ts.map +0 -1
- package/dist/coordination/agents/phase8-delivery.d.ts.map +0 -1
- package/dist/coordination/agents/phase8-wave3-products.d.ts.map +0 -1
- package/dist/coordination/agents/phase9-meta.d.ts.map +0 -1
- package/dist/coordination/agents/phase9-wave4-platform-meta.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-config-validation.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-consolidation.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-files.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-identity-types.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-identity.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-knowledge-manifests.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-entries.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-normalize.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-policy.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-learning-structured.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-paths.d.ts.map +0 -1
- package/dist/coordination/agents/project-agent-profile.d.ts.map +0 -1
- package/dist/coordination/agents/role-skills.d.ts.map +0 -1
- package/dist/coordination/agents/types.d.ts.map +0 -1
- package/dist/coordination/agents.d.ts.map +0 -1
- package/dist/coordination/auto-extend.d.ts.map +0 -1
- package/dist/coordination/autonomous-brain.d.ts.map +0 -1
- package/dist/coordination/autonomous-coordinator.d.ts.map +0 -1
- package/dist/coordination/brain-cache.d.ts.map +0 -1
- package/dist/coordination/brain-heuristics.d.ts.map +0 -1
- package/dist/coordination/brain-ledger.d.ts.map +0 -1
- package/dist/coordination/brain-monitor.d.ts.map +0 -1
- package/dist/coordination/brain-rules.d.ts.map +0 -1
- package/dist/coordination/brain-telemetry.d.ts.map +0 -1
- package/dist/coordination/brain-trace.d.ts.map +0 -1
- package/dist/coordination/brain.d.ts.map +0 -1
- package/dist/coordination/change-manager.d.ts.map +0 -1
- package/dist/coordination/checkpoint-wiring.d.ts.map +0 -1
- package/dist/coordination/collab-bus.d.ts.map +0 -1
- package/dist/coordination/collab-debug-types.d.ts.map +0 -1
- package/dist/coordination/collab-debug.d.ts.map +0 -1
- package/dist/coordination/collab-director-host.d.ts.map +0 -1
- package/dist/coordination/commit-safety.d.ts.map +0 -1
- package/dist/coordination/consensus-protocol.d.ts.map +0 -1
- package/dist/coordination/coordinator/error-classifier.d.ts.map +0 -1
- package/dist/coordination/delegate-tool.d.ts.map +0 -1
- package/dist/coordination/dep-watcher-bridge.d.ts.map +0 -1
- package/dist/coordination/dep-watcher.d.ts.map +0 -1
- package/dist/coordination/director/director-btw-notes.d.ts.map +0 -1
- package/dist/coordination/director/director-budget-policy.d.ts.map +0 -1
- package/dist/coordination/director/director-collab.d.ts.map +0 -1
- package/dist/coordination/director/director-errors.d.ts.map +0 -1
- package/dist/coordination/director/director-task-registry.d.ts.map +0 -1
- package/dist/coordination/director/director-toolset.d.ts.map +0 -1
- package/dist/coordination/director-basic-tools.d.ts.map +0 -1
- package/dist/coordination/director-collab-tools.d.ts.map +0 -1
- package/dist/coordination/director-host-contracts.d.ts.map +0 -1
- package/dist/coordination/director-input-helpers.d.ts.map +0 -1
- package/dist/coordination/director-kanban-queue-helpers.d.ts.map +0 -1
- package/dist/coordination/director-options.d.ts.map +0 -1
- package/dist/coordination/director-prompts.d.ts.map +0 -1
- package/dist/coordination/director-quality-gate-tool.d.ts.map +0 -1
- package/dist/coordination/director-session.d.ts.map +0 -1
- package/dist/coordination/director-spawn-model.d.ts.map +0 -1
- package/dist/coordination/director-tools.d.ts.map +0 -1
- package/dist/coordination/director.d.ts.map +0 -1
- package/dist/coordination/dispatcher.d.ts.map +0 -1
- package/dist/coordination/file-author-tracker.d.ts.map +0 -1
- package/dist/coordination/fleet-bus.d.ts.map +0 -1
- package/dist/coordination/fleet-event-validation.d.ts.map +0 -1
- package/dist/coordination/fleet-manager.d.ts.map +0 -1
- package/dist/coordination/fleet-spawn.d.ts.map +0 -1
- package/dist/coordination/fleet-status-tool.d.ts.map +0 -1
- package/dist/coordination/fleet-supervisor.d.ts.map +0 -1
- package/dist/coordination/fleet.d.ts.map +0 -1
- package/dist/coordination/global-mailbox-completion.d.ts.map +0 -1
- package/dist/coordination/global-mailbox-paths.d.ts.map +0 -1
- package/dist/coordination/icoordinator.d.ts.map +0 -1
- package/dist/coordination/ifleet-manager.d.ts.map +0 -1
- package/dist/coordination/in-memory-transport.d.ts.map +0 -1
- package/dist/coordination/index.d.ts.map +0 -1
- package/dist/coordination/index.js.map +0 -7
- package/dist/coordination/knowledge-graph.d.ts.map +0 -1
- package/dist/coordination/large-answer-store.d.ts.map +0 -1
- package/dist/coordination/mail-tools.d.ts.map +0 -1
- package/dist/coordination/mailbox-actions.d.ts.map +0 -1
- package/dist/coordination/mailbox-auth-types.d.ts.map +0 -1
- package/dist/coordination/mailbox-codecs.d.ts.map +0 -1
- package/dist/coordination/mailbox-constants.d.ts.map +0 -1
- package/dist/coordination/mailbox-credential-store.d.ts.map +0 -1
- package/dist/coordination/mailbox-events.d.ts.map +0 -1
- package/dist/coordination/mailbox-health.d.ts.map +0 -1
- package/dist/coordination/mailbox-hooks.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-auth.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-rate-limit.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-router.d.ts.map +0 -1
- package/dist/coordination/mailbox-http-validation.d.ts.map +0 -1
- package/dist/coordination/mailbox-message-codec.d.ts.map +0 -1
- package/dist/coordination/mailbox-parse-state.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server-client.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server-endpoint.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server-protocol.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server.d.ts.map +0 -1
- package/dist/coordination/mailbox-project-server.js.map +0 -7
- package/dist/coordination/mailbox-receipt-folding.d.ts.map +0 -1
- package/dist/coordination/mailbox-registry-codec.d.ts.map +0 -1
- package/dist/coordination/mailbox-retention-state.d.ts.map +0 -1
- package/dist/coordination/mailbox-status-mappers.d.ts.map +0 -1
- package/dist/coordination/mailbox-tool.d.ts.map +0 -1
- package/dist/coordination/mailbox-type-properties.d.ts.map +0 -1
- package/dist/coordination/mailbox-types.d.ts.map +0 -1
- package/dist/coordination/model-matrix.d.ts.map +0 -1
- package/dist/coordination/multi-agent-coordinator.d.ts.map +0 -1
- package/dist/coordination/multi-agent-timeout.d.ts.map +0 -1
- package/dist/coordination/null-fleet-bus.d.ts.map +0 -1
- package/dist/coordination/package-author-tracker.d.ts.map +0 -1
- package/dist/coordination/package-outdated-watcher.d.ts.map +0 -1
- package/dist/coordination/provider-status-tracker.d.ts.map +0 -1
- package/dist/coordination/remote-mailbox-credential-store.d.ts.map +0 -1
- package/dist/coordination/remote-mailbox.d.ts.map +0 -1
- package/dist/coordination/single-instance-mailbox.d.ts.map +0 -1
- package/dist/coordination/spawn-budget.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-compaction.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-credentials.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-rows.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox-schema.d.ts.map +0 -1
- package/dist/coordination/sqlite-mailbox.d.ts.map +0 -1
- package/dist/coordination/subagent-budget.d.ts.map +0 -1
- package/dist/coordination/subagent-nicknames.d.ts.map +0 -1
- package/dist/coordination/subagent-result-tool.d.ts.map +0 -1
- package/dist/coordination/task-auctioneer.d.ts.map +0 -1
- package/dist/coordination/task-dag.d.ts.map +0 -1
- package/dist/coordination/techstack-mailbox-consumer.d.ts.map +0 -1
- package/dist/coordination/transport.d.ts.map +0 -1
- package/dist/coordination/worktree-task-runner.d.ts.map +0 -1
- package/dist/core/agent-internals.d.ts.map +0 -1
- package/dist/core/agent-loop.d.ts.map +0 -1
- package/dist/core/agent-response.d.ts.map +0 -1
- package/dist/core/agent-tools.d.ts.map +0 -1
- package/dist/core/agent-types.d.ts.map +0 -1
- package/dist/core/agent.d.ts.map +0 -1
- package/dist/core/btw.d.ts.map +0 -1
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/continue-intent.d.ts.map +0 -1
- package/dist/core/continue-to-next-iteration.d.ts.map +0 -1
- package/dist/core/conversation-state.d.ts.map +0 -1
- package/dist/core/fallback-model.d.ts.map +0 -1
- package/dist/core/fallback-profile-manager.d.ts.map +0 -1
- package/dist/core/fleet-pulse.d.ts.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -7
- package/dist/core/input-builder.d.ts.map +0 -1
- package/dist/core/instruction-bundle.d.ts.map +0 -1
- package/dist/core/iteration-limit.d.ts.map +0 -1
- package/dist/core/mailbox-loop.d.ts.map +0 -1
- package/dist/core/model-availability-calendar.d.ts.map +0 -1
- package/dist/core/model-ref.d.ts.map +0 -1
- package/dist/core/model-ref.js.map +0 -7
- package/dist/core/modes/brief.d.ts.map +0 -1
- package/dist/core/modes/default.d.ts.map +0 -1
- package/dist/core/modes/teach.d.ts.map +0 -1
- package/dist/core/provider-runner.d.ts.map +0 -1
- package/dist/core/queued-messages.d.ts.map +0 -1
- package/dist/core/request-provider-binding.d.ts.map +0 -1
- package/dist/core/run-env.d.ts.map +0 -1
- package/dist/core/streaming-response-builder.d.ts.map +0 -1
- package/dist/core/system-prompt-blocks.d.ts.map +0 -1
- package/dist/core/system-prompt-builder.d.ts.map +0 -1
- package/dist/core/system-prompt-environment-probes.d.ts.map +0 -1
- package/dist/core/system-prompt-environment.d.ts.map +0 -1
- package/dist/core/system-prompt-memory-skills.d.ts.map +0 -1
- package/dist/core/system-prompt-plan.d.ts.map +0 -1
- package/dist/core/system-prompt-shell.d.ts.map +0 -1
- package/dist/core/system-prompt-skill-bodies.d.ts.map +0 -1
- package/dist/core/system-prompt-skill-text.d.ts.map +0 -1
- package/dist/defaults/index.d.ts.map +0 -1
- package/dist/defaults/index.js.map +0 -7
- package/dist/design/index.d.ts.map +0 -1
- package/dist/design/index.js.map +0 -7
- package/dist/execution/auto-compaction-middleware.d.ts.map +0 -1
- package/dist/execution/autonomous-runner.d.ts.map +0 -1
- package/dist/execution/autonomy-brain.d.ts.map +0 -1
- package/dist/execution/autonomy-prompt-contributor.d.ts.map +0 -1
- package/dist/execution/brain-chain.d.ts.map +0 -1
- package/dist/execution/brain-circuit.d.ts.map +0 -1
- package/dist/execution/brain-evaluation.d.ts.map +0 -1
- package/dist/execution/brain-runtime-constants.d.ts.map +0 -1
- package/dist/execution/brain-runtime.d.ts.map +0 -1
- package/dist/execution/compaction-core.d.ts.map +0 -1
- package/dist/execution/compaction-scoring.d.ts.map +0 -1
- package/dist/execution/compaction-summary-cache.d.ts.map +0 -1
- package/dist/execution/compactor.d.ts.map +0 -1
- package/dist/execution/council-brain.d.ts.map +0 -1
- package/dist/execution/council-orchestrator.d.ts.map +0 -1
- package/dist/execution/council-personas.d.ts.map +0 -1
- package/dist/execution/council-profiles.d.ts.map +0 -1
- package/dist/execution/council-prompts.d.ts.map +0 -1
- package/dist/execution/council-resolution.d.ts.map +0 -1
- package/dist/execution/design-color.d.ts.map +0 -1
- package/dist/execution/design-detect.d.ts.map +0 -1
- package/dist/execution/design-kit-loader.d.ts.map +0 -1
- package/dist/execution/design-materialize.d.ts.map +0 -1
- package/dist/execution/design-project-store.d.ts.map +0 -1
- package/dist/execution/design-tune.d.ts.map +0 -1
- package/dist/execution/design-verify.d.ts.map +0 -1
- package/dist/execution/enhance-recovery.d.ts.map +0 -1
- package/dist/execution/error-handler.d.ts.map +0 -1
- package/dist/execution/eternal-autonomy-types.d.ts.map +0 -1
- package/dist/execution/eternal-autonomy.d.ts.map +0 -1
- package/dist/execution/goal-preamble.d.ts.map +0 -1
- package/dist/execution/index.d.ts.map +0 -1
- package/dist/execution/index.js.map +0 -7
- package/dist/execution/intelligent-compactor.d.ts.map +0 -1
- package/dist/execution/model-runtime.d.ts.map +0 -1
- package/dist/execution/one-shot-llm.d.ts.map +0 -1
- package/dist/execution/parallel-eternal-engine.d.ts.map +0 -1
- package/dist/execution/prompt-enhancer.d.ts.map +0 -1
- package/dist/execution/prompt-enhancer.js.map +0 -7
- package/dist/execution/prompt-loader.d.ts.map +0 -1
- package/dist/execution/provider-runner-impl.d.ts.map +0 -1
- package/dist/execution/regex-patterns.d.ts.map +0 -1
- package/dist/execution/retry-policy.d.ts.map +0 -1
- package/dist/execution/selective-compactor.d.ts.map +0 -1
- package/dist/execution/skill-loader.d.ts.map +0 -1
- package/dist/execution/strategy-compactor.d.ts.map +0 -1
- package/dist/execution/subagent-compaction.d.ts.map +0 -1
- package/dist/execution/tool-executor-logging.d.ts.map +0 -1
- package/dist/execution/tool-executor-results.d.ts.map +0 -1
- package/dist/execution/tool-executor-stream.d.ts.map +0 -1
- package/dist/execution/tool-executor-support.d.ts.map +0 -1
- package/dist/execution/tool-executor.d.ts.map +0 -1
- package/dist/extension/extension-points.d.ts.map +0 -1
- package/dist/extension/index.d.ts.map +0 -1
- package/dist/extension/index.js.map +0 -7
- package/dist/extension/registry.d.ts.map +0 -1
- package/dist/fleet-notifier.d.ts.map +0 -1
- package/dist/goal/checkpoint.d.ts.map +0 -1
- package/dist/goal/goal-assessor.d.ts.map +0 -1
- package/dist/goal/goal-planner.d.ts.map +0 -1
- package/dist/goal/goal-runner.d.ts.map +0 -1
- package/dist/goal/index.d.ts.map +0 -1
- package/dist/goal/index.js.map +0 -7
- package/dist/goal/phase-board-mutations.d.ts.map +0 -1
- package/dist/goal/phase-graph-builder.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-integration.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-queries.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-runtime.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator-types.d.ts.map +0 -1
- package/dist/goal/phase-orchestrator.d.ts.map +0 -1
- package/dist/goal/phase-store.d.ts.map +0 -1
- package/dist/goal/types.d.ts.map +0 -1
- package/dist/hooks/http-executor.d.ts.map +0 -1
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js.map +0 -7
- package/dist/hooks/registry.d.ts.map +0 -1
- package/dist/hooks/runner.d.ts.map +0 -1
- package/dist/hooks/shell-executor.d.ts.map +0 -1
- package/dist/hooks/shell-hooks-equal.d.ts.map +0 -1
- package/dist/hq/alerts.d.ts.map +0 -1
- package/dist/hq/auth-audit.d.ts.map +0 -1
- package/dist/hq/auth-store.d.ts.map +0 -1
- package/dist/hq/bootstrap-store.d.ts.map +0 -1
- package/dist/hq/brain-bridge.d.ts.map +0 -1
- package/dist/hq/bridge-context.d.ts.map +0 -1
- package/dist/hq/commands.d.ts.map +0 -1
- package/dist/hq/cost-bridge.d.ts.map +0 -1
- package/dist/hq/exposure.d.ts.map +0 -1
- package/dist/hq/factory.d.ts.map +0 -1
- package/dist/hq/fleet-bridge.d.ts.map +0 -1
- package/dist/hq/index.d.ts.map +0 -1
- package/dist/hq/index.js.map +0 -7
- package/dist/hq/kanban-store.d.ts.map +0 -1
- package/dist/hq/mailbox-mapper.d.ts.map +0 -1
- package/dist/hq/persistence/event-log.d.ts.map +0 -1
- package/dist/hq/persistence/jsonl-io.d.ts.map +0 -1
- package/dist/hq/persistence/simple-log.d.ts.map +0 -1
- package/dist/hq/persistence/snapshot-store.d.ts.map +0 -1
- package/dist/hq/persistence/timeseries-store.d.ts.map +0 -1
- package/dist/hq/persistence.d.ts.map +0 -1
- package/dist/hq/protocol/brain.d.ts.map +0 -1
- package/dist/hq/protocol/browser.d.ts.map +0 -1
- package/dist/hq/protocol/client.d.ts.map +0 -1
- package/dist/hq/protocol/core.d.ts.map +0 -1
- package/dist/hq/protocol/fleet.d.ts.map +0 -1
- package/dist/hq/protocol/kanban.d.ts.map +0 -1
- package/dist/hq/protocol/mailbox.d.ts.map +0 -1
- package/dist/hq/protocol/mcp.d.ts.map +0 -1
- package/dist/hq/protocol/project.d.ts.map +0 -1
- package/dist/hq/protocol/session.d.ts.map +0 -1
- package/dist/hq/protocol/tool.d.ts.map +0 -1
- package/dist/hq/protocol.d.ts.map +0 -1
- package/dist/hq/publisher.d.ts.map +0 -1
- package/dist/hq/redaction.d.ts.map +0 -1
- package/dist/hq/session-bridge.d.ts.map +0 -1
- package/dist/hq/tool-bridge.d.ts.map +0 -1
- package/dist/hq/transcript-mapper.d.ts.map +0 -1
- package/dist/hq/worktree-bridge.d.ts.map +0 -1
- package/dist/hq/write-queues.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/infrastructure/context-manager.d.ts.map +0 -1
- package/dist/infrastructure/index.d.ts.map +0 -1
- package/dist/infrastructure/index.js.map +0 -7
- package/dist/infrastructure/logger.d.ts.map +0 -1
- package/dist/infrastructure/mcp-servers.d.ts.map +0 -1
- package/dist/infrastructure/path-resolver.d.ts.map +0 -1
- package/dist/infrastructure/provider-cache-ledger.d.ts.map +0 -1
- package/dist/infrastructure/token-counter.d.ts.map +0 -1
- package/dist/kernel/container.d.ts.map +0 -1
- package/dist/kernel/events/agent-events.d.ts.map +0 -1
- package/dist/kernel/events/brain-events.d.ts.map +0 -1
- package/dist/kernel/events/file-events.d.ts.map +0 -1
- package/dist/kernel/events/fleet-events.d.ts.map +0 -1
- package/dist/kernel/events/memory-events.d.ts.map +0 -1
- package/dist/kernel/events/network-events.d.ts.map +0 -1
- package/dist/kernel/events/process-events.d.ts.map +0 -1
- package/dist/kernel/events/provider-events.d.ts.map +0 -1
- package/dist/kernel/events/sdd-events.d.ts.map +0 -1
- package/dist/kernel/events/session-events.d.ts.map +0 -1
- package/dist/kernel/events/tool-events.d.ts.map +0 -1
- package/dist/kernel/events/worktree-events.d.ts.map +0 -1
- package/dist/kernel/events.d.ts.map +0 -1
- package/dist/kernel/index.d.ts.map +0 -1
- package/dist/kernel/index.js.map +0 -7
- package/dist/kernel/pipeline.d.ts.map +0 -1
- package/dist/kernel/run-controller.d.ts.map +0 -1
- package/dist/kernel/tokens.d.ts.map +0 -1
- package/dist/mailbox-attach.d.ts.map +0 -1
- package/dist/middleware/collab-pause.d.ts.map +0 -1
- package/dist/models/alibaba-token-plan-catalog.d.ts.map +0 -1
- package/dist/models/codex-catalog.d.ts.map +0 -1
- package/dist/models/index.d.ts.map +0 -1
- package/dist/models/index.js.map +0 -7
- package/dist/models/llm-selector.d.ts.map +0 -1
- package/dist/models/mode-store.d.ts.map +0 -1
- package/dist/models/model-intelligence.d.ts.map +0 -1
- package/dist/models/model-router.d.ts.map +0 -1
- package/dist/models/models-registry.d.ts.map +0 -1
- package/dist/models/provider-model-resolve.d.ts.map +0 -1
- package/dist/notifications/index.d.ts.map +0 -1
- package/dist/notifications/index.js.map +0 -7
- package/dist/notifications/notifier-impl.d.ts.map +0 -1
- package/dist/notifications/notifier.d.ts.map +0 -1
- package/dist/notifications/types.d.ts.map +0 -1
- package/dist/observability/event-bridge.d.ts.map +0 -1
- package/dist/observability/health.d.ts.map +0 -1
- package/dist/observability/index.d.ts.map +0 -1
- package/dist/observability/index.js.map +0 -7
- package/dist/observability/metrics.d.ts.map +0 -1
- package/dist/observability/network-telemetry.d.ts.map +0 -1
- package/dist/observability/otel-tracer.d.ts.map +0 -1
- package/dist/observability/otlp-metrics.d.ts.map +0 -1
- package/dist/observability/otlp-traces.d.ts.map +0 -1
- package/dist/observability/process-telemetry.d.ts.map +0 -1
- package/dist/observability/prometheus.d.ts.map +0 -1
- package/dist/observability/redact-command.d.ts.map +0 -1
- package/dist/observability/tracer.d.ts.map +0 -1
- package/dist/plugin/api.d.ts.map +0 -1
- package/dist/plugin/config.d.ts.map +0 -1
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js.map +0 -7
- package/dist/plugin/loader.d.ts.map +0 -1
- package/dist/plugins/auto-review-plugin.d.ts.map +0 -1
- package/dist/plugins/chimera-plugin.d.ts.map +0 -1
- package/dist/plugins/prompts-plugin.d.ts.map +0 -1
- package/dist/plugins/review-claim-registry.d.ts.map +0 -1
- package/dist/plugins/review-context-builder.d.ts.map +0 -1
- package/dist/plugins/review-finding-commands.d.ts.map +0 -1
- package/dist/plugins/review-finding-integration.d.ts.map +0 -1
- package/dist/plugins/review-finding-parser.d.ts.map +0 -1
- package/dist/plugins/review-finding-store.d.ts.map +0 -1
- package/dist/plugins/review-finding-types.d.ts.map +0 -1
- package/dist/plugins/review-report-integration.d.ts.map +0 -1
- package/dist/plugins/review-report-store.d.ts.map +0 -1
- package/dist/plugins/review-report-types.d.ts.map +0 -1
- package/dist/plugins/review-types.d.ts.map +0 -1
- package/dist/plugins/skills-plugin.d.ts.map +0 -1
- package/dist/plugins/sync-plugin.d.ts.map +0 -1
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/prompt-installer.d.ts.map +0 -1
- package/dist/prompts/prompt-manifest-store.d.ts.map +0 -1
- package/dist/registry/index.d.ts.map +0 -1
- package/dist/registry/index.js.map +0 -7
- package/dist/registry/provider-registry.d.ts.map +0 -1
- package/dist/registry/slash-command-registry.d.ts.map +0 -1
- package/dist/registry/tool-registry.d.ts.map +0 -1
- package/dist/replay/hash.d.ts.map +0 -1
- package/dist/replay/index.d.ts.map +0 -1
- package/dist/replay/index.js.map +0 -7
- package/dist/replay/replay-provider-runner.d.ts.map +0 -1
- package/dist/security/capabilities.d.ts.map +0 -1
- package/dist/security/config-secrets.d.ts.map +0 -1
- package/dist/security/directory-permission-policy.d.ts.map +0 -1
- package/dist/security/directory-policy-schema.d.ts.map +0 -1
- package/dist/security/index.d.ts.map +0 -1
- package/dist/security/index.js.map +0 -7
- package/dist/security/kanban-boundary.d.ts.map +0 -1
- package/dist/security/permission-policy-schema.d.ts.map +0 -1
- package/dist/security/permission-policy.d.ts.map +0 -1
- package/dist/security/readonly-permission-policy.d.ts.map +0 -1
- package/dist/security/secret-scrubber.d.ts.map +0 -1
- package/dist/security/secret-vault.d.ts.map +0 -1
- package/dist/security/trust-boundary.d.ts.map +0 -1
- package/dist/security/yolo-risk.d.ts.map +0 -1
- package/dist/session-registry-atomic-file.d.ts.map +0 -1
- package/dist/session-registry-types.d.ts.map +0 -1
- package/dist/session-registry.d.ts.map +0 -1
- package/dist/skills/foreign-sources.d.ts.map +0 -1
- package/dist/skills/frontmatter.d.ts.map +0 -1
- package/dist/skills/github-fetcher.d.ts.map +0 -1
- package/dist/skills/index.d.ts.map +0 -1
- package/dist/skills/index.js.map +0 -7
- package/dist/skills/limits.d.ts.map +0 -1
- package/dist/skills/manifest-store.d.ts.map +0 -1
- package/dist/skills/registry/github-direct-adapter.d.ts.map +0 -1
- package/dist/skills/registry/registry-adapter.d.ts.map +0 -1
- package/dist/skills/registry/skills-sh-adapter.d.ts.map +0 -1
- package/dist/skills/skill-generator.d.ts.map +0 -1
- package/dist/skills/skill-installer.d.ts.map +0 -1
- package/dist/storage/annotations-store.d.ts.map +0 -1
- package/dist/storage/attachment-store.d.ts.map +0 -1
- package/dist/storage/cloud-sync.d.ts.map +0 -1
- package/dist/storage/completed-work-checkpoint.d.ts.map +0 -1
- package/dist/storage/config-loader/bootstrap.d.ts.map +0 -1
- package/dist/storage/config-loader/default-repair.d.ts.map +0 -1
- package/dist/storage/config-loader/defaults.d.ts.map +0 -1
- package/dist/storage/config-loader/diagnostics.d.ts.map +0 -1
- package/dist/storage/config-loader/env-overrides.d.ts.map +0 -1
- package/dist/storage/config-loader/in-project-policy.d.ts.map +0 -1
- package/dist/storage/config-loader/inline-provider-models.d.ts.map +0 -1
- package/dist/storage/config-loader/legacy-sage-migration.d.ts.map +0 -1
- package/dist/storage/config-loader/path-identity.d.ts.map +0 -1
- package/dist/storage/config-loader/types.d.ts.map +0 -1
- package/dist/storage/config-loader/validation.d.ts.map +0 -1
- package/dist/storage/config-loader.d.ts.map +0 -1
- package/dist/storage/config-migration.d.ts.map +0 -1
- package/dist/storage/config-store.d.ts.map +0 -1
- package/dist/storage/director-state.d.ts.map +0 -1
- package/dist/storage/file-session-writer.d.ts.map +0 -1
- package/dist/storage/goal-coordination.d.ts.map +0 -1
- package/dist/storage/goal-kanban.d.ts.map +0 -1
- package/dist/storage/goal-store.d.ts.map +0 -1
- package/dist/storage/index.d.ts.map +0 -1
- package/dist/storage/index.js.map +0 -7
- package/dist/storage/input-history-store.d.ts.map +0 -1
- package/dist/storage/memory-backend.d.ts.map +0 -1
- package/dist/storage/memory-consolidator.d.ts.map +0 -1
- package/dist/storage/memory-graph-backend.d.ts.map +0 -1
- package/dist/storage/plan-store.d.ts.map +0 -1
- package/dist/storage/plan-templates.d.ts.map +0 -1
- package/dist/storage/prompt-store.d.ts.map +0 -1
- package/dist/storage/prompt-usage-store.d.ts.map +0 -1
- package/dist/storage/provider-config-watcher.d.ts.map +0 -1
- package/dist/storage/queue-store.d.ts.map +0 -1
- package/dist/storage/recovery-lock.d.ts.map +0 -1
- package/dist/storage/replay-log-store.d.ts.map +0 -1
- package/dist/storage/session-analyzer.d.ts.map +0 -1
- package/dist/storage/session-checkpoint-cas.d.ts.map +0 -1
- package/dist/storage/session-event-bridge.d.ts.map +0 -1
- package/dist/storage/session-helpers.d.ts.map +0 -1
- package/dist/storage/session-id-resolver.d.ts.map +0 -1
- package/dist/storage/session-id.d.ts.map +0 -1
- package/dist/storage/session-read-scrubber.d.ts.map +0 -1
- package/dist/storage/session-reader.d.ts.map +0 -1
- package/dist/storage/session-recovery.d.ts.map +0 -1
- package/dist/storage/session-resume-validation.d.ts.map +0 -1
- package/dist/storage/session-rewind-apply.d.ts.map +0 -1
- package/dist/storage/session-rewinder.d.ts.map +0 -1
- package/dist/storage/session-store/delete-session-artifacts.d.ts.map +0 -1
- package/dist/storage/session-store/delete-session-guards.d.ts.map +0 -1
- package/dist/storage/session-store/directory-scan.d.ts.map +0 -1
- package/dist/storage/session-store/directory-session-files.d.ts.map +0 -1
- package/dist/storage/session-store/events.d.ts.map +0 -1
- package/dist/storage/session-store/fork-session.d.ts.map +0 -1
- package/dist/storage/session-store/index-reader.d.ts.map +0 -1
- package/dist/storage/session-store/load-cache.d.ts.map +0 -1
- package/dist/storage/session-store/load-session-data.d.ts.map +0 -1
- package/dist/storage/session-store/paths.d.ts.map +0 -1
- package/dist/storage/session-store/prune-helpers.d.ts.map +0 -1
- package/dist/storage/session-store/replay.d.ts.map +0 -1
- package/dist/storage/session-store/search-events.d.ts.map +0 -1
- package/dist/storage/session-store/shard-manifest.d.ts.map +0 -1
- package/dist/storage/session-store/summary-builder.d.ts.map +0 -1
- package/dist/storage/session-store/summary-header.d.ts.map +0 -1
- package/dist/storage/session-store/types.d.ts.map +0 -1
- package/dist/storage/session-store.d.ts.map +0 -1
- package/dist/storage/session-summary.d.ts.map +0 -1
- package/dist/storage/session-tool-call-ends.d.ts.map +0 -1
- package/dist/storage/session-writer-scrubber.d.ts.map +0 -1
- package/dist/storage/session-writer-truncate.d.ts.map +0 -1
- package/dist/storage/storage-concurrency.d.ts.map +0 -1
- package/dist/storage/task-store.d.ts.map +0 -1
- package/dist/storage/todos-checkpoint.d.ts.map +0 -1
- package/dist/storage/tool-audit-log.d.ts.map +0 -1
- package/dist/tasking/index.d.ts.map +0 -1
- package/dist/tasking/index.js.map +0 -7
- package/dist/tasking/task-store.d.ts.map +0 -1
- package/dist/tasking/task-tracker.d.ts.map +0 -1
- package/dist/tools/council-tool.d.ts.map +0 -1
- package/dist/tools/fallback-chain-manage-tool.d.ts.map +0 -1
- package/dist/tools/fallback-favorite-manage-tool.d.ts.map +0 -1
- package/dist/tools/fallback-manage-helpers.d.ts.map +0 -1
- package/dist/tools/fallback-manage-tool-options.d.ts.map +0 -1
- package/dist/tools/fallback-manage-tools.d.ts.map +0 -1
- package/dist/tools/fallback-model-ref-parse.d.ts.map +0 -1
- package/dist/tools/fallback-provider-key-store.d.ts.map +0 -1
- package/dist/tools/fallback-system-config-view-tool.d.ts.map +0 -1
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js.map +0 -7
- package/dist/tools/mcp-control.d.ts.map +0 -1
- package/dist/tools/mcp-use.d.ts.map +0 -1
- package/dist/tools/one-shot-llm-tool.d.ts.map +0 -1
- package/dist/tools/plugin-manager.d.ts.map +0 -1
- package/dist/types/agent-bridge.d.ts.map +0 -1
- package/dist/types/attachment.d.ts.map +0 -1
- package/dist/types/autonomy.d.ts.map +0 -1
- package/dist/types/blocks.d.ts.map +0 -1
- package/dist/types/compactor.d.ts.map +0 -1
- package/dist/types/config/autonomy.d.ts.map +0 -1
- package/dist/types/config/context.d.ts.map +0 -1
- package/dist/types/config/fleet-chat.d.ts.map +0 -1
- package/dist/types/config/mcp-features.d.ts.map +0 -1
- package/dist/types/config/providers.d.ts.map +0 -1
- package/dist/types/config/root.d.ts.map +0 -1
- package/dist/types/config/runtime.d.ts.map +0 -1
- package/dist/types/config/skills-fleet-brain.d.ts.map +0 -1
- package/dist/types/config/tools.d.ts.map +0 -1
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/context-evidence.d.ts.map +0 -1
- package/dist/types/context-window.d.ts.map +0 -1
- package/dist/types/council.d.ts.map +0 -1
- package/dist/types/default-config.d.ts.map +0 -1
- package/dist/types/design-kit.d.ts.map +0 -1
- package/dist/types/error-handler.d.ts.map +0 -1
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/file-event-record.d.ts.map +0 -1
- package/dist/types/hooks.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -7
- package/dist/types/input-reader.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/memory.d.ts.map +0 -1
- package/dist/types/messages.d.ts.map +0 -1
- package/dist/types/mode-prompts.d.ts.map +0 -1
- package/dist/types/mode.d.ts.map +0 -1
- package/dist/types/models-registry.d.ts.map +0 -1
- package/dist/types/multi-agent.d.ts.map +0 -1
- package/dist/types/observability.d.ts.map +0 -1
- package/dist/types/one-shot-llm.d.ts.map +0 -1
- package/dist/types/path-resolver.d.ts.map +0 -1
- package/dist/types/permission.d.ts.map +0 -1
- package/dist/types/plugin.d.ts.map +0 -1
- package/dist/types/prompt-registry.d.ts.map +0 -1
- package/dist/types/prompt.d.ts.map +0 -1
- package/dist/types/provider-runner.d.ts.map +0 -1
- package/dist/types/provider.d.ts.map +0 -1
- package/dist/types/quota-regex.d.ts.map +0 -1
- package/dist/types/renderer.d.ts.map +0 -1
- package/dist/types/retry-policy.d.ts.map +0 -1
- package/dist/types/secret-scrubber.d.ts.map +0 -1
- package/dist/types/secret-vault.d.ts.map +0 -1
- package/dist/types/selector.d.ts.map +0 -1
- package/dist/types/session-markers.d.ts.map +0 -1
- package/dist/types/session-markers.js.map +0 -7
- package/dist/types/session-reader.d.ts.map +0 -1
- package/dist/types/session-rewinder.d.ts.map +0 -1
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/side-effect.d.ts.map +0 -1
- package/dist/types/skill.d.ts.map +0 -1
- package/dist/types/slash-command.d.ts.map +0 -1
- package/dist/types/spec.d.ts.map +0 -1
- package/dist/types/system-prompt-contributor.d.ts.map +0 -1
- package/dist/types/system-prompt.d.ts.map +0 -1
- package/dist/types/task-graph.d.ts.map +0 -1
- package/dist/types/token-counter.d.ts.map +0 -1
- package/dist/types/tool-executor.d.ts.map +0 -1
- package/dist/types/tool-markers.d.ts.map +0 -1
- package/dist/types/tool.d.ts.map +0 -1
- package/dist/types/utility-types.d.ts.map +0 -1
- package/dist/utils/assert-never.d.ts.map +0 -1
- package/dist/utils/atomic-write.d.ts.map +0 -1
- package/dist/utils/cache-key.d.ts.map +0 -1
- package/dist/utils/child-env.d.ts.map +0 -1
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/compaction-preview.d.ts.map +0 -1
- package/dist/utils/config-backup.d.ts.map +0 -1
- package/dist/utils/config-json.d.ts.map +0 -1
- package/dist/utils/connectivity.d.ts.map +0 -1
- package/dist/utils/context-breakdown.d.ts.map +0 -1
- package/dist/utils/context-evidence.d.ts.map +0 -1
- package/dist/utils/crash-shield.d.ts.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/diff.d.ts.map +0 -1
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -7
- package/dist/utils/expect-defined.d.ts.map +0 -1
- package/dist/utils/expect-defined.js.map +0 -7
- package/dist/utils/glob-expand.d.ts.map +0 -1
- package/dist/utils/glob-match.d.ts.map +0 -1
- package/dist/utils/heap-watchdog.d.ts.map +0 -1
- package/dist/utils/heap-watchdog.js.map +0 -7
- package/dist/utils/incoming-images.d.ts.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -7
- package/dist/utils/instruction-file.d.ts.map +0 -1
- package/dist/utils/ip-guard.d.ts.map +0 -1
- package/dist/utils/json-repair.d.ts.map +0 -1
- package/dist/utils/json-schema-validate.d.ts.map +0 -1
- package/dist/utils/lru-cache.d.ts.map +0 -1
- package/dist/utils/merge-custom-models.d.ts.map +0 -1
- package/dist/utils/merge-models-payload.d.ts.map +0 -1
- package/dist/utils/message-invariants.d.ts.map +0 -1
- package/dist/utils/newline-normalize.d.ts.map +0 -1
- package/dist/utils/perf-profile.d.ts.map +0 -1
- package/dist/utils/pid.d.ts.map +0 -1
- package/dist/utils/project-identity.d.ts.map +0 -1
- package/dist/utils/project-watch.d.ts.map +0 -1
- package/dist/utils/regex-guard.d.ts.map +0 -1
- package/dist/utils/safe-json.d.ts.map +0 -1
- package/dist/utils/sage-output-block.d.ts.map +0 -1
- package/dist/utils/session-scoped-path.d.ts.map +0 -1
- package/dist/utils/sleep.d.ts.map +0 -1
- package/dist/utils/slug.d.ts.map +0 -1
- package/dist/utils/socket-path.d.ts.map +0 -1
- package/dist/utils/sqlite-warning.d.ts.map +0 -1
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/task-format.d.ts.map +0 -1
- package/dist/utils/term.d.ts.map +0 -1
- package/dist/utils/todos-format.d.ts.map +0 -1
- package/dist/utils/token-estimate.d.ts.map +0 -1
- package/dist/utils/tool-description-mode.d.ts.map +0 -1
- package/dist/utils/tool-output-serializer.d.ts.map +0 -1
- package/dist/utils/tool-result-render-mode.d.ts.map +0 -1
- package/dist/utils/tool-subject.d.ts.map +0 -1
- package/dist/utils/tool-wire-compact.d.ts.map +0 -1
- package/dist/utils/tree-kill.d.ts.map +0 -1
- package/dist/utils/tree-kill.js.map +0 -7
- package/dist/utils/ulid.d.ts.map +0 -1
- package/dist/utils/walk-ignore.d.ts.map +0 -1
- package/dist/utils/wstack-paths.d.ts.map +0 -1
- package/dist/worktree/index.d.ts.map +0 -1
- package/dist/worktree/index.js.map +0 -7
- package/dist/worktree/worktree-git.d.ts.map +0 -1
- package/dist/worktree/worktree-managed-ops.d.ts.map +0 -1
- package/dist/worktree/worktree-manager.d.ts.map +0 -1
- package/dist/worktree/worktree-types.d.ts.map +0 -1
package/dist/hq/index.js
CHANGED
|
@@ -1,10 +1,83 @@
|
|
|
1
|
-
// src/hq/protocol/
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
// src/hq/protocol/governance.ts
|
|
2
|
+
var SIGNAL_LEVELS = /* @__PURE__ */ new Set([
|
|
3
|
+
"healthy",
|
|
4
|
+
"notice",
|
|
5
|
+
"warning",
|
|
6
|
+
"unavailable"
|
|
7
|
+
]);
|
|
8
|
+
var SIGNAL_CODES = /* @__PURE__ */ new Set([
|
|
9
|
+
"attachment_broker_healthy",
|
|
10
|
+
"attachment_broker_initializing",
|
|
11
|
+
"attachment_broker_status_unavailable",
|
|
12
|
+
"attachment_broker_degraded",
|
|
13
|
+
"attachment_broker_audit_unhealthy",
|
|
14
|
+
"attachment_broker_revocation_pending",
|
|
15
|
+
"attachment_broker_stopped",
|
|
16
|
+
"broker_missing",
|
|
17
|
+
"broker_invalid",
|
|
18
|
+
"connection_failed",
|
|
19
|
+
"request_rejected",
|
|
20
|
+
"unexpected_response"
|
|
21
|
+
]);
|
|
22
|
+
var OPERATOR_ACTIONS = /* @__PURE__ */ new Set(["none", "observe", "investigate"]);
|
|
23
|
+
var BROKER_STATES = /* @__PURE__ */ new Set(["idle", "active", "retry_wait", "stopped"]);
|
|
24
|
+
var BROKER_HEALTH = /* @__PURE__ */ new Set(["initializing", "healthy", "degraded", "stopped"]);
|
|
25
|
+
function isNonNegativeInteger(value) {
|
|
26
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
27
|
+
}
|
|
28
|
+
function hasOnlyKeys(value, allowed) {
|
|
29
|
+
const allowedKeys = new Set(allowed);
|
|
30
|
+
return Object.keys(value).every((key) => allowedKeys.has(key));
|
|
31
|
+
}
|
|
32
|
+
function isHqGovernanceSnapshotPayload(value) {
|
|
33
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
34
|
+
const payload = value;
|
|
35
|
+
if (!hasOnlyKeys(payload, [
|
|
36
|
+
"schemaVersion",
|
|
37
|
+
"projectId",
|
|
38
|
+
"observedAt",
|
|
39
|
+
"available",
|
|
40
|
+
"signal",
|
|
41
|
+
"daemon",
|
|
42
|
+
"attachmentBroker"
|
|
43
|
+
]) || payload.schemaVersion !== 1 || typeof payload.projectId !== "string" || payload.projectId.length === 0 || typeof payload.observedAt !== "string" || typeof payload.available !== "boolean" || typeof payload.signal !== "object" || payload.signal === null || Array.isArray(payload.signal)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const signal = payload.signal;
|
|
47
|
+
if (!hasOnlyKeys(signal, ["level", "code", "operatorAction", "executionDisposition"]) || !SIGNAL_LEVELS.has(signal.level) || !SIGNAL_CODES.has(signal.code) || !OPERATOR_ACTIONS.has(signal.operatorAction) || signal.executionDisposition !== "continue") {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
if (payload.available === false && (signal.level !== "unavailable" || payload.daemon !== void 0 || payload.attachmentBroker !== void 0) || payload.available === true && signal.level === "unavailable") {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
if (payload.daemon !== void 0) {
|
|
54
|
+
if (typeof payload.daemon !== "object" || payload.daemon === null || Array.isArray(payload.daemon)) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const daemon = payload.daemon;
|
|
58
|
+
if (!hasOnlyKeys(daemon, ["pid", "startedAt"]) || !isNonNegativeInteger(daemon.pid) || typeof daemon.startedAt !== "string") {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (payload.attachmentBroker !== void 0 && payload.attachmentBroker !== null) {
|
|
63
|
+
if (typeof payload.attachmentBroker !== "object" || Array.isArray(payload.attachmentBroker)) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const broker = payload.attachmentBroker;
|
|
67
|
+
if (!hasOnlyKeys(broker, [
|
|
68
|
+
"state",
|
|
69
|
+
"health",
|
|
70
|
+
"consecutiveFailures",
|
|
71
|
+
"pendingRevocations",
|
|
72
|
+
"auditHealthy",
|
|
73
|
+
"expiresAt",
|
|
74
|
+
"nextActionAt"
|
|
75
|
+
]) || !BROKER_STATES.has(broker.state) || !BROKER_HEALTH.has(broker.health) || !isNonNegativeInteger(broker.consecutiveFailures) || !isNonNegativeInteger(broker.pendingRevocations) || typeof broker.auditHealthy !== "boolean" || broker.expiresAt !== void 0 && typeof broker.expiresAt !== "string" || broker.nextActionAt !== void 0 && typeof broker.nextActionAt !== "string") {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
8
81
|
|
|
9
82
|
// src/hq/protocol/kanban.ts
|
|
10
83
|
var HQ_KANBAN_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
@@ -47,13 +120,54 @@ function isTombstone(value) {
|
|
|
47
120
|
return typeof record.boardId === "string" && HQ_KANBAN_ID_PATTERN.test(record.boardId) && typeof record.revision === "number" && Number.isSafeInteger(record.revision) && record.revision >= 0 && typeof record.deletedAt === "string" && Number.isFinite(Date.parse(record.deletedAt));
|
|
48
121
|
}
|
|
49
122
|
|
|
50
|
-
// src/hq/protocol/
|
|
123
|
+
// src/hq/protocol/peer.ts
|
|
124
|
+
var HQ_PEER_REHYDRATE_REASONS = /* @__PURE__ */ new Set([
|
|
125
|
+
"graceful",
|
|
126
|
+
"crash",
|
|
127
|
+
"heartbeat-timeout",
|
|
128
|
+
"auth-revoked"
|
|
129
|
+
]);
|
|
130
|
+
var HQ_PEER_REHYDRATE_HINT_MAX_CHARS = 280;
|
|
131
|
+
var HQ_BROWSER_PEER_RESUME_CLIENT_ID = "__hq_peer__";
|
|
132
|
+
function isStringOrUndefined(x) {
|
|
133
|
+
return x === void 0 || typeof x === "string";
|
|
134
|
+
}
|
|
135
|
+
function isHqPeerRehydratePayload(x) {
|
|
136
|
+
if (typeof x !== "object" || x === null || Array.isArray(x)) return false;
|
|
137
|
+
const v = x;
|
|
138
|
+
if (typeof v.projectId !== "string" || v.projectId.length === 0) return false;
|
|
139
|
+
if (typeof v.machineId !== "string" || v.machineId.length === 0) return false;
|
|
140
|
+
if (typeof v.leaderClientId !== "string" || v.leaderClientId.length === 0) return false;
|
|
141
|
+
if (typeof v.previousLeaderHandle !== "string" || v.previousLeaderHandle.length === 0) return false;
|
|
142
|
+
if (typeof v.reason !== "string" || !HQ_PEER_REHYDRATE_REASONS.has(v.reason)) return false;
|
|
143
|
+
if (typeof v.detectedAt !== "string" || !Number.isFinite(Date.parse(v.detectedAt))) return false;
|
|
144
|
+
if (!isStringOrUndefined(v.rehydrateHint)) return false;
|
|
145
|
+
if (v.rehydrateHint !== void 0 && v.rehydrateHint.length > HQ_PEER_REHYDRATE_HINT_MAX_CHARS) return false;
|
|
146
|
+
if (!isStringOrUndefined(v.rehydrateCommandId)) return false;
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
function isHqPeerLostPayload(x) {
|
|
150
|
+
if (typeof x !== "object" || x === null || Array.isArray(x)) return false;
|
|
151
|
+
const v = x;
|
|
152
|
+
if (typeof v.projectId !== "string" || v.projectId.length === 0) return false;
|
|
153
|
+
if (typeof v.machineId !== "string" || v.machineId.length === 0) return false;
|
|
154
|
+
if (typeof v.leaderClientId !== "string" || v.leaderClientId.length === 0) return false;
|
|
155
|
+
if (typeof v.previousLeaderHandle !== "string" || v.previousLeaderHandle.length === 0) return false;
|
|
156
|
+
if (typeof v.reason !== "string" || !HQ_PEER_REHYDRATE_REASONS.has(v.reason)) return false;
|
|
157
|
+
if (typeof v.detectedAt !== "string" || !Number.isFinite(Date.parse(v.detectedAt))) return false;
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// src/hq/protocol/envelope.ts
|
|
51
162
|
var HQ_PROTOCOL_VERSION = 1;
|
|
163
|
+
|
|
164
|
+
// src/hq/protocol/core.ts
|
|
52
165
|
var KNOWN_HQ_CLIENT_FRAME_TYPES = /* @__PURE__ */ new Set([
|
|
53
166
|
"client.hello",
|
|
54
167
|
"client.event",
|
|
55
168
|
"client.command_poll",
|
|
56
|
-
"client.command_ack"
|
|
169
|
+
"client.command_ack",
|
|
170
|
+
"client.resume"
|
|
57
171
|
]);
|
|
58
172
|
var HQ_CLIENT_KINDS = /* @__PURE__ */ new Set([
|
|
59
173
|
"tui",
|
|
@@ -118,6 +232,11 @@ function isHqClientCommandAckMessage(x) {
|
|
|
118
232
|
const v = x;
|
|
119
233
|
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");
|
|
120
234
|
}
|
|
235
|
+
function isHqClientResumeMessage(x) {
|
|
236
|
+
if (typeof x !== "object" || x === null) return false;
|
|
237
|
+
const v = x;
|
|
238
|
+
return typeof v.type === "string" && v.type === "client.resume" && Number.isSafeInteger(v.lastSeqSeen) && v.lastSeqSeen >= 0 && (v.clientId === void 0 || typeof v.clientId === "string") && (v.projectId === void 0 || typeof v.projectId === "string");
|
|
239
|
+
}
|
|
121
240
|
function parseHqFrame(raw) {
|
|
122
241
|
let parsed;
|
|
123
242
|
try {
|
|
@@ -172,6 +291,19 @@ function parseHqFrame(raw) {
|
|
|
172
291
|
...typeof obj.message === "string" ? { message: obj.message } : {}
|
|
173
292
|
}
|
|
174
293
|
};
|
|
294
|
+
case "client.resume":
|
|
295
|
+
if (!isHqClientResumeMessage(obj)) {
|
|
296
|
+
return { ok: false, reason: "malformed" };
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
ok: true,
|
|
300
|
+
frame: {
|
|
301
|
+
type: "client.resume",
|
|
302
|
+
lastSeqSeen: obj.lastSeqSeen,
|
|
303
|
+
...typeof obj.clientId === "string" ? { clientId: obj.clientId } : {},
|
|
304
|
+
...typeof obj.projectId === "string" ? { projectId: obj.projectId } : {}
|
|
305
|
+
}
|
|
306
|
+
};
|
|
175
307
|
default: {
|
|
176
308
|
const _exhaustive = obj.type;
|
|
177
309
|
return _exhaustive;
|
|
@@ -194,7 +326,10 @@ var KNOWN_HQ_EVENT_PAYLOAD_TYPES = /* @__PURE__ */ new Set([
|
|
|
194
326
|
"session.usage",
|
|
195
327
|
"client.heartbeat",
|
|
196
328
|
"mcp.health.snapshot",
|
|
197
|
-
"mcp.operation"
|
|
329
|
+
"mcp.operation",
|
|
330
|
+
"governance.snapshot",
|
|
331
|
+
"peer.rehydrate",
|
|
332
|
+
"peer.lost"
|
|
198
333
|
]);
|
|
199
334
|
function isHqMcpLatencySummary(x) {
|
|
200
335
|
if (typeof x !== "object" || x === null) return false;
|
|
@@ -458,6 +593,12 @@ function parseHqEventPayload(eventType, payload) {
|
|
|
458
593
|
return isHqMcpHealthSnapshotPayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
459
594
|
case "mcp.operation":
|
|
460
595
|
return isHqMcpOperationPayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
596
|
+
case "governance.snapshot":
|
|
597
|
+
return isHqGovernanceSnapshotPayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
598
|
+
case "peer.rehydrate":
|
|
599
|
+
return isHqPeerRehydratePayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
600
|
+
case "peer.lost":
|
|
601
|
+
return isHqPeerLostPayload(payload) ? { ok: true, payload } : { ok: false, reason: "malformed-payload" };
|
|
461
602
|
default: {
|
|
462
603
|
const _exhaustive = eventType;
|
|
463
604
|
return _exhaustive;
|
|
@@ -479,8 +620,42 @@ function createHqEventEnvelope(input) {
|
|
|
479
620
|
};
|
|
480
621
|
}
|
|
481
622
|
|
|
623
|
+
// src/hq/protocol/resume.ts
|
|
624
|
+
var HQ_RESUME_GAP_MAX_ENVELOPES = 1e3;
|
|
625
|
+
var HQ_RESUME_GAP_MAX_BYTES = 1048576;
|
|
626
|
+
var HQ_RESUME_GAP_MAX_STALE_MS = 24 * 60 * 60 * 1e3;
|
|
627
|
+
function isHqResumeGapMessage(x) {
|
|
628
|
+
if (typeof x !== "object" || x === null || Array.isArray(x)) return false;
|
|
629
|
+
const v = x;
|
|
630
|
+
if (v.type !== "hq.resume_gap") return false;
|
|
631
|
+
if (!Number.isSafeInteger(v.lastSeqSeen) || v.lastSeqSeen < 0) return false;
|
|
632
|
+
if (!Array.isArray(v.envelopes)) return false;
|
|
633
|
+
if (v.envelopes.length > HQ_RESUME_GAP_MAX_ENVELOPES) return false;
|
|
634
|
+
if (typeof v.truncated !== "boolean") return false;
|
|
635
|
+
return true;
|
|
636
|
+
}
|
|
637
|
+
function isHqResumeRejectMessage(x) {
|
|
638
|
+
if (typeof x !== "object" || x === null || Array.isArray(x)) return false;
|
|
639
|
+
const v = x;
|
|
640
|
+
if (v.type !== "hq.resume_reject") return false;
|
|
641
|
+
if (v.reason !== "gap_too_large" && v.reason !== "last_seen_too_old" && v.reason !== "log_unavailable") {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
if (typeof v.detectedAt !== "string" || !Number.isFinite(Date.parse(v.detectedAt))) return false;
|
|
645
|
+
return true;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
// src/hq/protocol/tool.ts
|
|
649
|
+
var DEFAULT_HQ_REDACTION_POLICY = {
|
|
650
|
+
rawContent: true,
|
|
651
|
+
toolArgs: "full",
|
|
652
|
+
paths: "full"
|
|
653
|
+
};
|
|
654
|
+
var HQ_TRANSCRIPT_TEXT_CAP = 16e3;
|
|
655
|
+
|
|
482
656
|
// src/hq/publisher.ts
|
|
483
657
|
import { randomUUID } from "node:crypto";
|
|
658
|
+
import * as v8 from "node:v8";
|
|
484
659
|
|
|
485
660
|
// src/coordination/mailbox-types.ts
|
|
486
661
|
var SESSION_RECIPIENT_PREFIX = "@session:";
|
|
@@ -491,61 +666,71 @@ var PATTERNS = [
|
|
|
491
666
|
// strings don't trigger false positives.
|
|
492
667
|
{
|
|
493
668
|
type: "anthropic_key",
|
|
494
|
-
regex: /(?<![A-Za-z0-9])sk-ant-api\d+-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9])/g
|
|
669
|
+
regex: /(?<![A-Za-z0-9])sk-ant-api\d+-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9])/g,
|
|
670
|
+
anchor: "sk-ant-"
|
|
495
671
|
},
|
|
496
|
-
{ type: "openai_key", regex: /(?<![A-Za-z0-9])sk-(?:proj-)?[A-Za-z0-9_-]{20,}(?![A-Za-z0-9])/g },
|
|
497
|
-
{ type: "github_pat", regex: /(?<![A-Za-z0-9])ghp_[A-Za-z0-9]{36,}(?![A-Za-z0-9])/g },
|
|
498
|
-
{ type: "github_pat_v2", regex: /(?<![A-Za-z0-9])github_pat_[A-Za-z0-9_]{50,}(?![A-Za-z0-9])/g },
|
|
499
|
-
{ type: "aws_access_key", regex: /(?<![A-Za-z0-9])AKIA[0-9A-Z]{16}(?![A-Za-z0-9])/g },
|
|
500
|
-
{ type: "gcp_key", regex: /(?<![A-Za-z0-9])AIza[0-9A-Za-z_-]{35}(?![A-Za-z0-9])/g },
|
|
501
|
-
{ type: "slack_token", regex: /(?<![A-Za-z0-9-])xox[abpos]-[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g },
|
|
672
|
+
{ type: "openai_key", regex: /(?<![A-Za-z0-9])sk-(?:proj-)?[A-Za-z0-9_-]{20,}(?![A-Za-z0-9])/g, anchor: "sk-" },
|
|
673
|
+
{ type: "github_pat", regex: /(?<![A-Za-z0-9])ghp_[A-Za-z0-9]{36,}(?![A-Za-z0-9])/g, anchor: "ghp_" },
|
|
674
|
+
{ type: "github_pat_v2", regex: /(?<![A-Za-z0-9])github_pat_[A-Za-z0-9_]{50,}(?![A-Za-z0-9])/g, anchor: "github_pat_" },
|
|
675
|
+
{ type: "aws_access_key", regex: /(?<![A-Za-z0-9])AKIA[0-9A-Z]{16}(?![A-Za-z0-9])/g, anchor: "AKIA" },
|
|
676
|
+
{ type: "gcp_key", regex: /(?<![A-Za-z0-9])AIza[0-9A-Za-z_-]{35}(?![A-Za-z0-9])/g, anchor: "AIza" },
|
|
677
|
+
{ type: "slack_token", regex: /(?<![A-Za-z0-9-])xox[abpos]-[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g, anchor: "xox" },
|
|
502
678
|
{
|
|
503
679
|
type: "stripe_key",
|
|
504
|
-
regex: /(?<![A-Za-z0-9])sk_(?:live|test)_[A-Za-z0-9]{24,}(?![A-Za-z0-9])/g
|
|
680
|
+
regex: /(?<![A-Za-z0-9])sk_(?:live|test)_[A-Za-z0-9]{24,}(?![A-Za-z0-9])/g,
|
|
681
|
+
anchor: "sk_"
|
|
505
682
|
},
|
|
506
683
|
{
|
|
507
684
|
type: "twilio_sid",
|
|
508
|
-
regex: /(?<![A-Za-z0-9])AC[a-f0-9]{32}(?![A-Za-z0-9])/g
|
|
685
|
+
regex: /(?<![A-Za-z0-9])AC[a-f0-9]{32}(?![A-Za-z0-9])/g,
|
|
686
|
+
anchor: "AC"
|
|
509
687
|
},
|
|
510
688
|
{
|
|
511
689
|
type: "telegram_bot_token",
|
|
512
690
|
// Telegram tokens are of the form bot<digits>:<alphanum> in URL paths
|
|
513
|
-
regex: /\/bot\d+:[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g
|
|
691
|
+
regex: /\/bot\d+:[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
692
|
+
anchor: "/bot"
|
|
514
693
|
},
|
|
515
694
|
{
|
|
516
695
|
type: "jwt",
|
|
517
696
|
// Anchored: look for literal "eyJ" which is unambiguous for JWT header
|
|
518
|
-
regex: /(?<![A-Za-z0-9/+=])eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}(?![A-Za-z0-9/+=])/g
|
|
697
|
+
regex: /(?<![A-Za-z0-9/+=])eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}(?![A-Za-z0-9/+=])/g,
|
|
698
|
+
anchor: "eyJ"
|
|
519
699
|
},
|
|
520
700
|
{
|
|
521
701
|
type: "private_key",
|
|
522
702
|
// Anchored: start must be BEGIN, end must be END with no extra dashes after END
|
|
523
|
-
regex: /(?:^|\n)-----BEGIN (?:RSA|EC|OPENSSH|DSA|PGP)? ?PRIVATE KEY-----[\s\S]*?-----END[^-]*-----(?:\n|$)/g
|
|
703
|
+
regex: /(?:^|\n)-----BEGIN (?:RSA|EC|OPENSSH|DSA|PGP)? ?PRIVATE KEY-----[\s\S]*?-----END[^-]*-----(?:\n|$)/g,
|
|
704
|
+
anchor: "-----BEGIN"
|
|
524
705
|
},
|
|
525
|
-
{ type: "mongodb_uri", regex: /mongodb(?:\+srv)?:\/\/[^\s"'`]+/g },
|
|
526
|
-
{ type: "postgres_uri", regex: /postgres(?:ql)?:\/\/[^\s"'`]+/g },
|
|
527
|
-
{ type: "mysql_uri", regex: /mysql:\/\/[^\s"'`]+/g },
|
|
528
|
-
{ type: "redis_uri", regex: /redis:\/\/[^\s"'`]+/g },
|
|
706
|
+
{ type: "mongodb_uri", regex: /mongodb(?:\+srv)?:\/\/[^\s"'`]+/g, anchor: "mongodb" },
|
|
707
|
+
{ type: "postgres_uri", regex: /postgres(?:ql)?:\/\/[^\s"'`]+/g, anchor: "postgres" },
|
|
708
|
+
{ type: "mysql_uri", regex: /mysql:\/\/[^\s"'`]+/g, anchor: "mysql://" },
|
|
709
|
+
{ type: "redis_uri", regex: /redis:\/\/[^\s"'`]+/g, anchor: "redis://" },
|
|
529
710
|
// AI/ML provider keys — modern LLM services with well-known prefixes
|
|
530
711
|
{
|
|
531
712
|
type: "huggingface_token",
|
|
532
713
|
// HuggingFace tokens: hf_ followed by 34 alphanumeric chars
|
|
533
|
-
regex: /(?<![A-Za-z0-9])hf_[A-Za-z0-9]{34}(?![A-Za-z0-9])/g
|
|
714
|
+
regex: /(?<![A-Za-z0-9])hf_[A-Za-z0-9]{34}(?![A-Za-z0-9])/g,
|
|
715
|
+
anchor: "hf_"
|
|
534
716
|
},
|
|
535
717
|
{
|
|
536
718
|
type: "replicate_token",
|
|
537
719
|
// Replicate tokens: r8_ followed by 40+ alphanumeric chars
|
|
538
|
-
regex: /(?<![A-Za-z0-9])r8_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g
|
|
720
|
+
regex: /(?<![A-Za-z0-9])r8_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g,
|
|
721
|
+
anchor: "r8_"
|
|
539
722
|
},
|
|
540
723
|
{
|
|
541
724
|
type: "perplexity_key",
|
|
542
725
|
// Perplexity API keys: pplx- followed by 40+ alphanumeric chars
|
|
543
|
-
regex: /(?<![A-Za-z0-9])pplx-[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g
|
|
726
|
+
regex: /(?<![A-Za-z0-9])pplx-[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g,
|
|
727
|
+
anchor: "pplx-"
|
|
544
728
|
},
|
|
545
729
|
{
|
|
546
730
|
type: "groq_key",
|
|
547
731
|
// Groq API keys: gsk_ followed by 40+ alphanumeric chars
|
|
548
|
-
regex: /(?<![A-Za-z0-9])gsk_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g
|
|
732
|
+
regex: /(?<![A-Za-z0-9])gsk_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g,
|
|
733
|
+
anchor: "gsk_"
|
|
549
734
|
},
|
|
550
735
|
{
|
|
551
736
|
type: "bearer_token",
|
|
@@ -558,7 +743,8 @@ var PATTERNS = [
|
|
|
558
743
|
// tokens sharing a single delimiter (`Bearer a… Bearer b…`) must both be
|
|
559
744
|
// redacted. A consuming trailing delimiter would eat the separator the
|
|
560
745
|
// next match needs for its leading anchor, leaking the second token.
|
|
561
|
-
regex: /(?:^|[^A-Za-z0-9_.~+/-])Bearer\s+[A-Za-z0-9._~+/-]{12,512}=*(?=$|[^A-Za-z0-9_.~+/-])/g
|
|
746
|
+
regex: /(?:^|[^A-Za-z0-9_.~+/-])Bearer\s+[A-Za-z0-9._~+/-]{12,512}=*(?=$|[^A-Za-z0-9_.~+/-])/g,
|
|
747
|
+
anchor: "Bearer"
|
|
562
748
|
},
|
|
563
749
|
{
|
|
564
750
|
type: "high_entropy_env",
|
|
@@ -574,7 +760,89 @@ var PATTERNS = [
|
|
|
574
760
|
// replacement so the separator between adjacent secrets is preserved
|
|
575
761
|
// rather than collapsed. Capture groups are therefore: 1=leading
|
|
576
762
|
// delimiter, 2=key name, 3=value.
|
|
577
|
-
regex: /(^|\s)([A-Z_]{4,}(?:KEY|TOKEN|SECRET|PASSWORD|PWD))\s*[:=]\s*['"]?([A-Za-z0-9_/+=-]{20,512})['"]?(?=\s|$)/g
|
|
763
|
+
regex: /(^|\s)([A-Z_]{4,}(?:KEY|TOKEN|SECRET|PASSWORD|PWD))\s*[:=]\s*['"]?([A-Za-z0-9_/+=-]{20,512})['"]?(?=\s|$)/g,
|
|
764
|
+
anchor: ["KEY", "TOKEN", "SECRET", "PASSWORD", "PWD"]
|
|
765
|
+
},
|
|
766
|
+
// ── Ported from packages/plugins credential-patterns.ts (WS-034) ─────────
|
|
767
|
+
// The plugin runtime carried 37 patterns while this scrubber — the one that
|
|
768
|
+
// guards session JSONL, chronicle, HQ broadcast, WebUI events and the auth
|
|
769
|
+
// audit — carried 22. The plugin side already had a parity test; it just did
|
|
770
|
+
// not cover core. Most consequential: WrongStack mints `gho_` tokens itself
|
|
771
|
+
// in the Copilot OAuth flow, and `gh[ousr]_` was absent here.
|
|
772
|
+
{
|
|
773
|
+
type: "github_oauth_token",
|
|
774
|
+
regex: /(?<![A-Za-z0-9])gh[ousr]_[A-Za-z0-9]{36,}(?![A-Za-z0-9])/g,
|
|
775
|
+
anchor: ["gho_", "ghu_", "ghs_", "ghr_"]
|
|
776
|
+
},
|
|
777
|
+
{
|
|
778
|
+
type: "gitlab_pat",
|
|
779
|
+
regex: /(?<![A-Za-z0-9])glpat-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
780
|
+
anchor: "glpat-"
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
type: "gitlab_runner_token",
|
|
784
|
+
regex: /(?<![A-Za-z0-9])glrt-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
785
|
+
anchor: "glrt-"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
type: "npm_token",
|
|
789
|
+
regex: /(?<![A-Za-z0-9])npm_[A-Za-z0-9]{36}(?![A-Za-z0-9])/g,
|
|
790
|
+
anchor: "npm_"
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
type: "slack_app_token",
|
|
794
|
+
regex: /(?<![A-Za-z0-9-])xapp-\d-[A-Za-z0-9-]{10,}(?![A-Za-z0-9-])/g,
|
|
795
|
+
anchor: "xapp-"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
type: "slack_webhook",
|
|
799
|
+
regex: /https:\/\/hooks\.slack\.com\/services\/T[A-Za-z0-9_-]+\/B[A-Za-z0-9_-]+\/[A-Za-z0-9]{16,}/g,
|
|
800
|
+
anchor: "hooks.slack.com"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
type: "sendgrid_key",
|
|
804
|
+
regex: /(?<![A-Za-z0-9])SG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
805
|
+
anchor: "SG."
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
type: "digitalocean_token",
|
|
809
|
+
regex: /(?<![A-Za-z0-9])dop_v1_[a-f0-9]{64}(?![A-Za-z0-9])/g,
|
|
810
|
+
anchor: "dop_v1_"
|
|
811
|
+
},
|
|
812
|
+
{
|
|
813
|
+
type: "doppler_token",
|
|
814
|
+
regex: /(?<![A-Za-z0-9])dp\.(?:pt|st|sa|scim|audit)\.[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g,
|
|
815
|
+
anchor: "dp."
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
type: "shopify_token",
|
|
819
|
+
regex: /(?<![A-Za-z0-9])shp(?:at|ca|pa|ss)_[a-fA-F0-9]{32}(?![A-Za-z0-9])/g,
|
|
820
|
+
anchor: "shp"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
type: "docker_pat",
|
|
824
|
+
regex: /(?<![A-Za-z0-9])dckr_pat_[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
825
|
+
anchor: "dckr_pat_"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
type: "linear_key",
|
|
829
|
+
regex: /(?<![A-Za-z0-9])lin_api_[A-Za-z0-9]{40,}(?![A-Za-z0-9])/g,
|
|
830
|
+
anchor: "lin_api_"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
type: "atlassian_token",
|
|
834
|
+
regex: /(?<![A-Za-z0-9])ATATT3[A-Za-z0-9_\-=]{40,}(?![A-Za-z0-9_\-=])/g,
|
|
835
|
+
anchor: "ATATT3"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
type: "square_token",
|
|
839
|
+
regex: /(?<![A-Za-z0-9])(?:sq0(?:atp|csp)-|EAAA)[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
840
|
+
anchor: ["sq0atp-", "sq0csp-", "EAAA"]
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
type: "google_oauth_client_secret",
|
|
844
|
+
regex: /(?<![A-Za-z0-9_-])GOCSPX-[A-Za-z0-9_-]{20,}(?![A-Za-z0-9_-])/g,
|
|
845
|
+
anchor: "GOCSPX-"
|
|
578
846
|
}
|
|
579
847
|
];
|
|
580
848
|
var SIMPLE_PATTERNS = PATTERNS.filter((p) => p.type !== "high_entropy_env");
|
|
@@ -583,32 +851,32 @@ var HIGH_ENTROPY_REGEX = PATTERNS.find((p) => p.type === "high_entropy_env").reg
|
|
|
583
851
|
var COMBINED_REPLACEMENTS = SIMPLE_PATTERNS.map((p) => `[REDACTED:${p.type}]`);
|
|
584
852
|
var SCRUB_CHUNK_BYTES = 64 * 1024;
|
|
585
853
|
var SCRUB_OVERLAP_BYTES = 1024;
|
|
854
|
+
var PATTERN_ANCHORS = [
|
|
855
|
+
...new Set(
|
|
856
|
+
PATTERNS.flatMap(
|
|
857
|
+
(pattern) => typeof pattern.anchor === "string" ? [pattern.anchor] : [...pattern.anchor]
|
|
858
|
+
)
|
|
859
|
+
)
|
|
860
|
+
];
|
|
861
|
+
var JSON_KEY_ANCHORS = [
|
|
862
|
+
'"apiKey"',
|
|
863
|
+
'"api_key"',
|
|
864
|
+
'"token"',
|
|
865
|
+
'"secret"',
|
|
866
|
+
'"password"',
|
|
867
|
+
'"authorization"',
|
|
868
|
+
'"bearer"',
|
|
869
|
+
'"private_key"',
|
|
870
|
+
'"access_token"',
|
|
871
|
+
'"refresh_token"',
|
|
872
|
+
'"client_secret"'
|
|
873
|
+
];
|
|
874
|
+
var ALL_ANCHORS = [...PATTERN_ANCHORS, ...JSON_KEY_ANCHORS];
|
|
586
875
|
function hasCredentialAnchors(text) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
text.includes("github_pat_") || // GitHub PAT v2
|
|
592
|
-
text.includes("eyJ") || // JWT
|
|
593
|
-
text.includes("AKIA") || // AWS access key
|
|
594
|
-
text.includes("AIza") || // GCP service key
|
|
595
|
-
text.includes("xox") || // Slack token (xoxa/xoxb/xoxp/xoxo/xoxs)
|
|
596
|
-
text.includes("Bearer ") || // Bearer token (space suffix reduces false positives)
|
|
597
|
-
text.includes("/bot") || // Telegram bot token (URL path pattern)
|
|
598
|
-
text.includes("hf_") || // HuggingFace token
|
|
599
|
-
text.includes("r8_") || // Replicate token
|
|
600
|
-
text.includes("pplx-") || // Perplexity API key
|
|
601
|
-
text.includes("gsk_") || // Groq API key
|
|
602
|
-
text.includes("_KEY=") || // High-entropy env vars: API_KEY=, SECRET_KEY=, ...
|
|
603
|
-
text.includes("_TOKEN=") || // ACCESS_TOKEN=, AUTH_TOKEN=, ...
|
|
604
|
-
text.includes("_SECRET=") || // API_SECRET=, CLIENT_SECRET=, ...
|
|
605
|
-
text.includes("_PASSWORD=") || // DB_PASSWORD=, ROOT_PASSWORD=, ...
|
|
606
|
-
text.includes("mongodb://") || text.includes("mongodb+srv://") || text.includes("postgres://") || text.includes("postgresql://") || text.includes("mysql://") || text.includes("redis://") || // JSON-style credential keys: tool outputs often serialise objects as
|
|
607
|
-
// raw JSON strings rather than parsed objects. The value may not start
|
|
608
|
-
// with a recognisable prefix (sk-, ghp_, etc.), so we anchor on common
|
|
609
|
-
// key names. The `"` prefix avoids matching prose that happens to mention
|
|
610
|
-
// these words — JSON serialisation always quotes string keys.
|
|
611
|
-
text.includes('"apiKey"') || text.includes('"api_key"') || text.includes('"token"') || text.includes('"secret"') || text.includes('"password"') || text.includes('"authorization"') || text.includes('"bearer"') || text.includes('"private_key"') || text.includes('"access_token"') || text.includes('"refresh_token"') || text.includes('"client_secret"');
|
|
876
|
+
for (const anchor of ALL_ANCHORS) {
|
|
877
|
+
if (text.includes(anchor)) return true;
|
|
878
|
+
}
|
|
879
|
+
return false;
|
|
612
880
|
}
|
|
613
881
|
var DefaultSecretScrubber = class {
|
|
614
882
|
scrub(text) {
|
|
@@ -812,7 +1080,7 @@ function scrubAndTruncateHqPreview(value, maxLength = 280) {
|
|
|
812
1080
|
return summarizeString(value, maxLength, true);
|
|
813
1081
|
}
|
|
814
1082
|
function visitValue(value, options, key) {
|
|
815
|
-
if (
|
|
1083
|
+
if (key !== void 0 && isSensitiveKey(key)) {
|
|
816
1084
|
return { value: SENSITIVE_FIELD_REPLACEMENT, redacted: true };
|
|
817
1085
|
}
|
|
818
1086
|
if (typeof value === "string") {
|
|
@@ -823,7 +1091,7 @@ function visitValue(value, options, key) {
|
|
|
823
1091
|
if (!options.preserveRawContentKeys && !options.policy.rawContent && key !== void 0 && isRawContentKey(key)) {
|
|
824
1092
|
return { value: RAW_CONTENT_REPLACEMENT, redacted: true };
|
|
825
1093
|
}
|
|
826
|
-
const scrubbed = summarizeString(value, options.maxSummaryLength,
|
|
1094
|
+
const scrubbed = summarizeString(value, options.maxSummaryLength, true);
|
|
827
1095
|
return { value: scrubbed, redacted: scrubbed !== value };
|
|
828
1096
|
}
|
|
829
1097
|
if (value === null || typeof value !== "object") return { value, redacted: false };
|
|
@@ -875,7 +1143,7 @@ function redactHqEvent(event, options = {}) {
|
|
|
875
1143
|
}
|
|
876
1144
|
function summarizeHqToolArgs(value, options = {}) {
|
|
877
1145
|
const policy = resolveHqRedactionPolicy(options.policy);
|
|
878
|
-
if (policy.toolArgs === "full") return value;
|
|
1146
|
+
if (policy.toolArgs === "full") return redactHqValue(value, options).value;
|
|
879
1147
|
if (policy.toolArgs === "none") return "[REDACTED:hq_tool_args]";
|
|
880
1148
|
if (policy.toolArgs === "redacted") return redactHqValue(value, options).value;
|
|
881
1149
|
if (value === null || typeof value !== "object") return redactHqValue(value, options).value;
|
|
@@ -1030,9 +1298,19 @@ var DEFAULT_RECONNECT_BASE_MS = 1e3;
|
|
|
1030
1298
|
var DEFAULT_RECONNECT_MAX_MS = 3e4;
|
|
1031
1299
|
var DEFAULT_DISCOVERY_POLL_MS = 5e3;
|
|
1032
1300
|
var DEFAULT_MAX_QUEUED_MESSAGES = 2e3;
|
|
1301
|
+
var DEFAULT_MAX_QUEUED_BYTES = Math.min(
|
|
1302
|
+
16 * 1024 * 1024,
|
|
1303
|
+
Math.floor(v8.getHeapStatistics().heap_size_limit * 0.1)
|
|
1304
|
+
);
|
|
1033
1305
|
var DEFAULT_COMMAND_POLL_INTERVAL_MS = 500;
|
|
1034
1306
|
var DEFAULT_COMMAND_POLL_LIMIT = 25;
|
|
1035
1307
|
var DEFAULT_HEARTBEAT_INTERVAL_MS = 25e3;
|
|
1308
|
+
function queuedFrameCoalesceKey(frame) {
|
|
1309
|
+
if (frame.type !== "client.event" || !frame.event.type.endsWith(".snapshot")) {
|
|
1310
|
+
return void 0;
|
|
1311
|
+
}
|
|
1312
|
+
return [frame.event.type, frame.event.sessionId ?? "", frame.event.runId ?? ""].join("|");
|
|
1313
|
+
}
|
|
1036
1314
|
function defaultSocketFactory(url) {
|
|
1037
1315
|
const WebSocketCtor = globalThis.WebSocket;
|
|
1038
1316
|
if (WebSocketCtor === void 0) {
|
|
@@ -1079,6 +1357,7 @@ var HqPublisher = class {
|
|
|
1079
1357
|
this.reconnectBaseMs = options.reconnectBaseMs ?? DEFAULT_RECONNECT_BASE_MS;
|
|
1080
1358
|
this.reconnectMaxMs = options.reconnectMaxMs ?? DEFAULT_RECONNECT_MAX_MS;
|
|
1081
1359
|
this.maxQueuedMessages = options.maxQueuedMessages ?? DEFAULT_MAX_QUEUED_MESSAGES;
|
|
1360
|
+
this.maxQueuedBytes = options.maxQueuedBytes ?? DEFAULT_MAX_QUEUED_BYTES;
|
|
1082
1361
|
this.resolvedRedactionPolicy = resolveHqRedactionPolicy(options.redactionPolicy);
|
|
1083
1362
|
this.logger = options.logger;
|
|
1084
1363
|
}
|
|
@@ -1091,11 +1370,26 @@ var HqPublisher = class {
|
|
|
1091
1370
|
reconnectBaseMs;
|
|
1092
1371
|
reconnectMaxMs;
|
|
1093
1372
|
maxQueuedMessages;
|
|
1373
|
+
maxQueuedBytes;
|
|
1094
1374
|
resolvedRedactionPolicy;
|
|
1095
1375
|
logger;
|
|
1096
1376
|
socket = null;
|
|
1097
1377
|
seq = 0;
|
|
1098
1378
|
queue = [];
|
|
1379
|
+
queueBytes = 0;
|
|
1380
|
+
/**
|
|
1381
|
+
* Cumulative count of frames dropped by the bounded outbound queue when the
|
|
1382
|
+
* count/byte cap is exceeded while HQ is unreachable. Lifetime statistic —
|
|
1383
|
+
* intentionally NOT reset on close()/reconnect, so it reflects total
|
|
1384
|
+
* telemetry loss to overflow for this publisher instance.
|
|
1385
|
+
*/
|
|
1386
|
+
droppedFrames = 0;
|
|
1387
|
+
/** Cumulative UTF-8 bytes of frames dropped on overflow (see droppedFrames). */
|
|
1388
|
+
droppedBytes = 0;
|
|
1389
|
+
/** Obsolete state snapshots replaced in-place while HQ was unreachable. */
|
|
1390
|
+
coalescedFrames = 0;
|
|
1391
|
+
/** UTF-8 bytes released by snapshot coalescing. */
|
|
1392
|
+
coalescedBytes = 0;
|
|
1099
1393
|
stopped = false;
|
|
1100
1394
|
reconnectAttempt = 0;
|
|
1101
1395
|
connectWarningEmitted = false;
|
|
@@ -1174,6 +1468,7 @@ var HqPublisher = class {
|
|
|
1174
1468
|
this.stopCommandPolling();
|
|
1175
1469
|
this.stopHeartbeat();
|
|
1176
1470
|
this.queue = [];
|
|
1471
|
+
this.queueBytes = 0;
|
|
1177
1472
|
const socket = this.socket;
|
|
1178
1473
|
this.socket = null;
|
|
1179
1474
|
socket?.close(1e3, "hq publisher closed");
|
|
@@ -1240,6 +1535,18 @@ var HqPublisher = class {
|
|
|
1240
1535
|
get redactionPolicy() {
|
|
1241
1536
|
return this.resolvedRedactionPolicy;
|
|
1242
1537
|
}
|
|
1538
|
+
/** Current outbound queue pressure — useful for flow control in telemetry bridges. */
|
|
1539
|
+
getQueueStats() {
|
|
1540
|
+
return {
|
|
1541
|
+
entries: this.queue.length,
|
|
1542
|
+
bytes: this.queueBytes,
|
|
1543
|
+
maxBytes: this.maxQueuedBytes,
|
|
1544
|
+
droppedFrames: this.droppedFrames,
|
|
1545
|
+
droppedBytes: this.droppedBytes,
|
|
1546
|
+
coalescedFrames: this.coalescedFrames,
|
|
1547
|
+
coalescedBytes: this.coalescedBytes
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1243
1550
|
/** Publish a live session/terminal snapshot (state + agents). */
|
|
1244
1551
|
publishSessionSnapshot(payload, opts) {
|
|
1245
1552
|
return this.publishEvent({
|
|
@@ -1323,12 +1630,43 @@ var HqPublisher = class {
|
|
|
1323
1630
|
socket.send(serialized);
|
|
1324
1631
|
return;
|
|
1325
1632
|
}
|
|
1326
|
-
this.enqueue(serialized);
|
|
1633
|
+
this.enqueue(serialized, queuedFrameCoalesceKey(frame));
|
|
1327
1634
|
this.connect();
|
|
1328
1635
|
}
|
|
1329
|
-
enqueue(serialized) {
|
|
1330
|
-
|
|
1331
|
-
this.
|
|
1636
|
+
enqueue(serialized, coalesceKey) {
|
|
1637
|
+
const bytes = Buffer.byteLength(serialized, "utf8");
|
|
1638
|
+
if (bytes > this.maxQueuedBytes) {
|
|
1639
|
+
this.droppedFrames += 1;
|
|
1640
|
+
this.droppedBytes += bytes;
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
if (coalesceKey !== void 0) {
|
|
1644
|
+
let existingIndex = -1;
|
|
1645
|
+
for (let index = this.queue.length - 1; index >= 0; index -= 1) {
|
|
1646
|
+
if (this.queue[index]?.coalesceKey === coalesceKey) {
|
|
1647
|
+
existingIndex = index;
|
|
1648
|
+
break;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
if (existingIndex !== -1) {
|
|
1652
|
+
const [obsolete] = this.queue.splice(existingIndex, 1);
|
|
1653
|
+
if (obsolete !== void 0) {
|
|
1654
|
+
this.queueBytes -= obsolete.bytes;
|
|
1655
|
+
this.coalescedFrames += 1;
|
|
1656
|
+
this.coalescedBytes += obsolete.bytes;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
while ((this.queue.length >= this.maxQueuedMessages || this.queueBytes + bytes > this.maxQueuedBytes) && this.queue.length > 0) {
|
|
1661
|
+
const dropped = this.queue.shift();
|
|
1662
|
+
if (dropped !== void 0) {
|
|
1663
|
+
this.queueBytes -= dropped.bytes;
|
|
1664
|
+
this.droppedFrames += 1;
|
|
1665
|
+
this.droppedBytes += dropped.bytes;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
this.queue.push({ serialized, bytes, coalesceKey });
|
|
1669
|
+
this.queueBytes += bytes;
|
|
1332
1670
|
}
|
|
1333
1671
|
/** Batch-dequeue up to 50 frames at a time, yielding to the microtask
|
|
1334
1672
|
* queue between batches so we don't starve the event loop on reconnect. */
|
|
@@ -1336,7 +1674,11 @@ var HqPublisher = class {
|
|
|
1336
1674
|
const socket = this.socket;
|
|
1337
1675
|
if (socket?.readyState !== OPEN_STATE || this.queue.length === 0) return;
|
|
1338
1676
|
const batch = this.queue.splice(0, 50);
|
|
1339
|
-
for (const frame of batch)
|
|
1677
|
+
for (const frame of batch) {
|
|
1678
|
+
socket.send(frame.serialized);
|
|
1679
|
+
this.queueBytes -= frame.bytes;
|
|
1680
|
+
}
|
|
1681
|
+
this.queueBytes = Math.max(0, this.queueBytes);
|
|
1340
1682
|
if (this.queue.length > 0) setImmediate(() => this.flushQueue());
|
|
1341
1683
|
}
|
|
1342
1684
|
startCommandPolling() {
|
|
@@ -1673,10 +2015,51 @@ function isMissingFileError(error) {
|
|
|
1673
2015
|
|
|
1674
2016
|
// src/hq/auth-store.ts
|
|
1675
2017
|
import { createHash as createHash2, randomBytes, randomUUID as randomUUID2, scrypt, timingSafeEqual } from "node:crypto";
|
|
1676
|
-
import * as fs3 from "node:fs/promises";
|
|
1677
2018
|
import * as syncFs from "node:fs";
|
|
2019
|
+
import * as fs3 from "node:fs/promises";
|
|
1678
2020
|
import * as path4 from "node:path";
|
|
1679
2021
|
|
|
2022
|
+
// src/security/file-permissions.ts
|
|
2023
|
+
import { chmod } from "node:fs/promises";
|
|
2024
|
+
var SECRET_FILE_MODE = 384;
|
|
2025
|
+
async function restrictFilePermissions(filePath, opts) {
|
|
2026
|
+
const label = opts?.label ?? "file-permissions";
|
|
2027
|
+
const warn = opts?.warn ?? ((msg) => console.warn(msg));
|
|
2028
|
+
if (process.platform === "win32") {
|
|
2029
|
+
try {
|
|
2030
|
+
const { execFile } = await import("node:child_process");
|
|
2031
|
+
const { promisify } = await import("node:util");
|
|
2032
|
+
const execFileAsync = promisify(execFile);
|
|
2033
|
+
const user = windowsAccountName();
|
|
2034
|
+
if (!user) {
|
|
2035
|
+
warn(
|
|
2036
|
+
`[${label}] Could not determine the current Windows user for ${filePath}; skipping icacls hardening.`
|
|
2037
|
+
);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
await execFileAsync("icacls", [filePath, "/inheritance:r", "/grant:r", `${user}:(F)`], {
|
|
2041
|
+
windowsHide: true
|
|
2042
|
+
});
|
|
2043
|
+
} catch {
|
|
2044
|
+
warn(
|
|
2045
|
+
`[${label}] Could not restrict permissions on ${filePath} \u2014 it may be readable by other users on this system.`
|
|
2046
|
+
);
|
|
2047
|
+
}
|
|
2048
|
+
} else {
|
|
2049
|
+
try {
|
|
2050
|
+
await chmod(filePath, SECRET_FILE_MODE);
|
|
2051
|
+
} catch {
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
function windowsAccountName() {
|
|
2056
|
+
const username = process.env.USERNAME || process.env.USER;
|
|
2057
|
+
if (!username || username.includes("\0")) return void 0;
|
|
2058
|
+
const domain = process.env.USERDOMAIN;
|
|
2059
|
+
if (domain && !domain.includes("\0")) return `${domain}\\${username}`;
|
|
2060
|
+
return username;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
1680
2063
|
// src/utils/wstack-paths.ts
|
|
1681
2064
|
import { createHash } from "node:crypto";
|
|
1682
2065
|
import * as fs2 from "node:fs";
|
|
@@ -1806,11 +2189,31 @@ function resolveWstackPaths(opts) {
|
|
|
1806
2189
|
}
|
|
1807
2190
|
|
|
1808
2191
|
// src/hq/auth-audit.ts
|
|
1809
|
-
import { appendFileSync, mkdirSync } from "node:fs";
|
|
2192
|
+
import { appendFileSync, readFileSync as readFileSync3, mkdirSync } from "node:fs";
|
|
1810
2193
|
import * as path3 from "node:path";
|
|
1811
2194
|
function hqAuthAuditPath(dataDir) {
|
|
1812
2195
|
return path3.join(dataDir, "auth-audit.jsonl");
|
|
1813
2196
|
}
|
|
2197
|
+
function readHqAuthAuditTail(dataDir, maxEntries = 50) {
|
|
2198
|
+
const filePath = hqAuthAuditPath(dataDir);
|
|
2199
|
+
let content;
|
|
2200
|
+
try {
|
|
2201
|
+
content = readFileSync3(filePath, "utf8");
|
|
2202
|
+
} catch {
|
|
2203
|
+
return [];
|
|
2204
|
+
}
|
|
2205
|
+
const lines = content.trimEnd().split("\n");
|
|
2206
|
+
const tail = lines.slice(-maxEntries);
|
|
2207
|
+
const entries = [];
|
|
2208
|
+
for (const line of tail) {
|
|
2209
|
+
if (!line) continue;
|
|
2210
|
+
try {
|
|
2211
|
+
entries.push(JSON.parse(line));
|
|
2212
|
+
} catch {
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
return entries.reverse();
|
|
2216
|
+
}
|
|
1814
2217
|
function appendHqAuthAudit(dataDir, entry, options) {
|
|
1815
2218
|
try {
|
|
1816
2219
|
mkdirSync(dataDir, { recursive: true });
|
|
@@ -1838,6 +2241,20 @@ function resolveHqDataDir(override, env = process.env) {
|
|
|
1838
2241
|
if (!raw) return defaultHqDataDir();
|
|
1839
2242
|
return path4.isAbsolute(raw) ? path4.resolve(raw) : path4.resolve(process.cwd(), raw);
|
|
1840
2243
|
}
|
|
2244
|
+
function hqTokenVerifier(secret) {
|
|
2245
|
+
return createHash2("sha256").update(secret, "utf8").digest("hex");
|
|
2246
|
+
}
|
|
2247
|
+
function hqTokenKey(token) {
|
|
2248
|
+
if (token.verifier !== void 0 && token.verifier.length > 0) return token.verifier;
|
|
2249
|
+
return token.token ? hqTokenVerifier(token.token) : "";
|
|
2250
|
+
}
|
|
2251
|
+
function hashBrowserToken(token) {
|
|
2252
|
+
if (token.verifier !== void 0 && token.verifier.length > 0) {
|
|
2253
|
+
return token.token ? { ...token, token: "" } : token;
|
|
2254
|
+
}
|
|
2255
|
+
if (!token.token) return token;
|
|
2256
|
+
return { ...token, verifier: hqTokenVerifier(token.token), token: "" };
|
|
2257
|
+
}
|
|
1841
2258
|
function isTokenExpired(token, at = Date.now(), clockSkewMs = 0) {
|
|
1842
2259
|
if (token === void 0) return false;
|
|
1843
2260
|
const expiresAt = token.expiresAt;
|
|
@@ -1871,6 +2288,9 @@ function hqAuthContentHash(file) {
|
|
|
1871
2288
|
...file.clientTokens !== void 0 ? { clientTokens: file.clientTokens.map(redactToken) } : {},
|
|
1872
2289
|
...file.passwordHash !== void 0 ? { passwordHash: REDACTED } : {},
|
|
1873
2290
|
...file.cookieSecret !== void 0 ? { cookieSecret: REDACTED } : {},
|
|
2291
|
+
...file.totpSecret !== void 0 ? { totpSecret: REDACTED } : {},
|
|
2292
|
+
...file.totpPendingSecret !== void 0 ? { totpPendingSecret: REDACTED } : {},
|
|
2293
|
+
...file.totpRecoveryCodes !== void 0 ? { totpRecoveryCodes: file.totpRecoveryCodes.map(() => REDACTED) } : {},
|
|
1874
2294
|
...file.alertRules !== void 0 ? { alertRules: file.alertRules } : {}
|
|
1875
2295
|
};
|
|
1876
2296
|
const payload = JSON.stringify(projection);
|
|
@@ -1890,8 +2310,10 @@ async function writeHqRuntimeFile(dataDir, file) {
|
|
|
1890
2310
|
...file,
|
|
1891
2311
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1892
2312
|
};
|
|
1893
|
-
|
|
1894
|
-
|
|
2313
|
+
const target = hqRuntimeFilePath(dataDir);
|
|
2314
|
+
await atomicWrite(target, `${JSON.stringify(payload, null, 2)}
|
|
2315
|
+
`, { mode: SECRET_FILE_MODE });
|
|
2316
|
+
await restrictFilePermissions(target, { label: "hq-runtime" });
|
|
1895
2317
|
}
|
|
1896
2318
|
function isProcessAlive(pid) {
|
|
1897
2319
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -1904,7 +2326,9 @@ function isProcessAlive(pid) {
|
|
|
1904
2326
|
}
|
|
1905
2327
|
function readHqRuntimeFileSync(dataDir) {
|
|
1906
2328
|
try {
|
|
1907
|
-
const parsed = JSON.parse(
|
|
2329
|
+
const parsed = JSON.parse(
|
|
2330
|
+
syncFs.readFileSync(hqRuntimeFilePath(dataDir), "utf8")
|
|
2331
|
+
);
|
|
1908
2332
|
if (typeof parsed.url !== "string" || parsed.url.trim().length === 0) return void 0;
|
|
1909
2333
|
if (typeof parsed.pid === "number" && !isProcessAlive(parsed.pid)) return void 0;
|
|
1910
2334
|
return {
|
|
@@ -1947,10 +2371,17 @@ async function writeHqAuthFile(dataDir, file) {
|
|
|
1947
2371
|
const payload = {
|
|
1948
2372
|
...file,
|
|
1949
2373
|
version: HQ_AUTH_FILE_VERSION,
|
|
1950
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2374
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2375
|
+
// WS-044: browser secrets never touch the disk. Any legacy cleartext in
|
|
2376
|
+
// the incoming file is converted here, so the first write after an
|
|
2377
|
+
// upgrade migrates the whole list — no separate migration step to forget
|
|
2378
|
+
// to run, and no window where an old file stays cleartext because nothing
|
|
2379
|
+
// happened to rewrite it.
|
|
2380
|
+
...file.browserTokens !== void 0 ? { browserTokens: file.browserTokens.map(hashBrowserToken) } : {}
|
|
1951
2381
|
};
|
|
1952
2382
|
await atomicWrite(target, `${JSON.stringify(payload, null, 2)}
|
|
1953
|
-
`, { mode:
|
|
2383
|
+
`, { mode: SECRET_FILE_MODE });
|
|
2384
|
+
await restrictFilePermissions(target, { label: "hq-auth" });
|
|
1954
2385
|
}
|
|
1955
2386
|
async function ensureHqFirstRunAuthFile(dataDir, opts = {}) {
|
|
1956
2387
|
const file = hqAuthFilePath(dataDir);
|
|
@@ -2156,6 +2587,7 @@ function discoverLocalHqEndpoint(options = {}) {
|
|
|
2156
2587
|
const dataDir = resolveHqDataDir(options.dataDir, options.env ?? process.env);
|
|
2157
2588
|
const runtime = readHqRuntimeFileSync(dataDir);
|
|
2158
2589
|
if (runtime === void 0) return void 0;
|
|
2590
|
+
if (!isLoopbackHqUrl(runtime.url)) return void 0;
|
|
2159
2591
|
const token = readFirstClientTokenFromAuthFile(dataDir);
|
|
2160
2592
|
return { url: runtime.url, ...token ? { token } : {} };
|
|
2161
2593
|
}
|
|
@@ -2685,97 +3117,125 @@ function startSessionTelemetryBridge(opts) {
|
|
|
2685
3117
|
publishSnapshot();
|
|
2686
3118
|
});
|
|
2687
3119
|
publishSnapshot(true);
|
|
2688
|
-
let
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
let watcher = null;
|
|
2693
|
-
let watchPending = false;
|
|
2694
|
-
function setupWatcher() {
|
|
2695
|
-
if (disposed || watcher) return;
|
|
2696
|
-
try {
|
|
2697
|
-
const nextWatcher = fs5.watch(sessionFile, () => {
|
|
2698
|
-
if (watchPending || disposed) return;
|
|
2699
|
-
watchPending = true;
|
|
2700
|
-
setTimeout(() => {
|
|
2701
|
-
watchPending = false;
|
|
2702
|
-
void tail();
|
|
2703
|
-
}, 25);
|
|
2704
|
-
});
|
|
2705
|
-
nextWatcher.on("error", () => {
|
|
2706
|
-
try {
|
|
2707
|
-
nextWatcher.close();
|
|
2708
|
-
} catch {
|
|
2709
|
-
}
|
|
2710
|
-
if (watcher === nextWatcher) watcher = null;
|
|
2711
|
-
});
|
|
2712
|
-
watcher = nextWatcher;
|
|
2713
|
-
} catch {
|
|
2714
|
-
watcher = null;
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
async function tail() {
|
|
2718
|
-
if (disposed || tailing) return;
|
|
2719
|
-
tailing = true;
|
|
2720
|
-
try {
|
|
2721
|
-
const stat3 = await fsp.stat(sessionFile).catch(() => null);
|
|
3120
|
+
let prevOnAppend;
|
|
3121
|
+
if (opts.writer?.setOnAppend) {
|
|
3122
|
+
prevOnAppend = opts.writer.onAppend;
|
|
3123
|
+
opts.writer.setOnAppend((event) => {
|
|
2722
3124
|
if (disposed) return;
|
|
2723
|
-
if (!stat3) return;
|
|
2724
|
-
setupWatcher();
|
|
2725
|
-
if (stat3.size <= offset) return;
|
|
2726
|
-
const fd = await fsp.open(sessionFile, "r");
|
|
2727
3125
|
try {
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
partial += buf.toString("utf8");
|
|
2734
|
-
const lines = partial.split("\n");
|
|
2735
|
-
partial = lines.pop() ?? "";
|
|
2736
|
-
const entries = [];
|
|
2737
|
-
for (const line of lines) {
|
|
2738
|
-
const trimmed = line.trim();
|
|
2739
|
-
if (!trimmed) continue;
|
|
2740
|
-
let obj;
|
|
2741
|
-
try {
|
|
2742
|
-
obj = JSON.parse(trimmed);
|
|
2743
|
-
} catch {
|
|
2744
|
-
continue;
|
|
2745
|
-
}
|
|
2746
|
-
for (const entry of mapSessionEventToEntries(obj)) entries.push(entry);
|
|
2747
|
-
}
|
|
3126
|
+
prevOnAppend?.(event);
|
|
3127
|
+
} catch {
|
|
3128
|
+
}
|
|
3129
|
+
try {
|
|
3130
|
+
const entries = mapSessionEventToEntries(event);
|
|
2748
3131
|
if (entries.length > 0) {
|
|
2749
3132
|
publishTranscriptEntries(entries);
|
|
2750
3133
|
lastActivityAt = now();
|
|
2751
3134
|
}
|
|
2752
|
-
}
|
|
2753
|
-
await fd.close();
|
|
3135
|
+
} catch {
|
|
2754
3136
|
}
|
|
2755
|
-
}
|
|
2756
|
-
} finally {
|
|
2757
|
-
tailing = false;
|
|
2758
|
-
}
|
|
3137
|
+
});
|
|
2759
3138
|
}
|
|
3139
|
+
let seqEmitted = 0;
|
|
3140
|
+
let watcher = null;
|
|
3141
|
+
let tailTimer = null;
|
|
2760
3142
|
const snapshotTimer = setInterval(() => publishSnapshot(true), opts.snapshotIntervalMs ?? 2500);
|
|
2761
3143
|
snapshotTimer.unref?.();
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
3144
|
+
if (!opts.writer?.setOnAppend) {
|
|
3145
|
+
let setupWatcher2 = function() {
|
|
3146
|
+
if (disposed || watcher) return;
|
|
3147
|
+
try {
|
|
3148
|
+
const nextWatcher = fs5.watch(sessionFile, () => {
|
|
3149
|
+
if (watchPending || disposed) return;
|
|
3150
|
+
watchPending = true;
|
|
3151
|
+
setTimeout(() => {
|
|
3152
|
+
watchPending = false;
|
|
3153
|
+
void tail();
|
|
3154
|
+
}, 25);
|
|
3155
|
+
});
|
|
3156
|
+
nextWatcher.on("error", () => {
|
|
3157
|
+
try {
|
|
3158
|
+
nextWatcher.close();
|
|
3159
|
+
} catch {
|
|
3160
|
+
}
|
|
3161
|
+
if (watcher === nextWatcher) watcher = null;
|
|
3162
|
+
});
|
|
3163
|
+
watcher = nextWatcher;
|
|
3164
|
+
} catch {
|
|
3165
|
+
watcher = null;
|
|
3166
|
+
}
|
|
3167
|
+
}, scheduleTail2 = function() {
|
|
3168
|
+
if (disposed) return;
|
|
3169
|
+
tailTimer = setTimeout(
|
|
3170
|
+
() => {
|
|
3171
|
+
void tail().finally(scheduleTail2);
|
|
3172
|
+
},
|
|
3173
|
+
watcher ? relaxedTailMs : fastTailMs
|
|
3174
|
+
);
|
|
3175
|
+
tailTimer.unref?.();
|
|
3176
|
+
};
|
|
3177
|
+
var setupWatcher = setupWatcher2, scheduleTail = scheduleTail2;
|
|
3178
|
+
let offset = 0;
|
|
3179
|
+
let partial = "";
|
|
3180
|
+
let tailing = false;
|
|
3181
|
+
let watchPending = false;
|
|
3182
|
+
async function tail() {
|
|
3183
|
+
if (disposed || tailing) return;
|
|
3184
|
+
tailing = true;
|
|
3185
|
+
try {
|
|
3186
|
+
const stat3 = await fsp.stat(sessionFile).catch(() => null);
|
|
3187
|
+
if (disposed) return;
|
|
3188
|
+
if (!stat3) return;
|
|
3189
|
+
setupWatcher2();
|
|
3190
|
+
if (stat3.size <= offset) return;
|
|
3191
|
+
const fd = await fsp.open(sessionFile, "r");
|
|
3192
|
+
try {
|
|
3193
|
+
if (disposed) return;
|
|
3194
|
+
const len = stat3.size - offset;
|
|
3195
|
+
const buf = Buffer.allocUnsafe(len);
|
|
3196
|
+
const { bytesRead } = await fd.read(buf, 0, len, offset);
|
|
3197
|
+
const actualBuf = bytesRead < len ? buf.subarray(0, bytesRead) : buf;
|
|
3198
|
+
offset += bytesRead;
|
|
3199
|
+
partial += actualBuf.toString("utf8");
|
|
3200
|
+
const lines = partial.split("\n");
|
|
3201
|
+
partial = lines.pop() ?? "";
|
|
3202
|
+
const entries = [];
|
|
3203
|
+
for (const line of lines) {
|
|
3204
|
+
const trimmed = line.trim();
|
|
3205
|
+
if (!trimmed) continue;
|
|
3206
|
+
let obj;
|
|
3207
|
+
try {
|
|
3208
|
+
obj = JSON.parse(trimmed);
|
|
3209
|
+
} catch {
|
|
3210
|
+
continue;
|
|
3211
|
+
}
|
|
3212
|
+
for (const entry of mapSessionEventToEntries(obj)) entries.push(entry);
|
|
3213
|
+
}
|
|
3214
|
+
if (entries.length > 0) {
|
|
3215
|
+
publishTranscriptEntries(entries);
|
|
3216
|
+
lastActivityAt = now();
|
|
3217
|
+
}
|
|
3218
|
+
} finally {
|
|
3219
|
+
await fd.close();
|
|
3220
|
+
}
|
|
3221
|
+
} catch {
|
|
3222
|
+
} finally {
|
|
3223
|
+
tailing = false;
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
const fastTailMs = opts.transcriptIntervalMs ?? 500;
|
|
3227
|
+
const relaxedTailMs = opts.transcriptFallbackIntervalMs ?? (opts.transcriptIntervalMs !== void 0 ? opts.transcriptIntervalMs : 5e3);
|
|
3228
|
+
void tail().finally(scheduleTail2);
|
|
2774
3229
|
}
|
|
2775
|
-
void tail().finally(scheduleTail);
|
|
2776
3230
|
return () => {
|
|
2777
3231
|
if (disposed) return;
|
|
2778
3232
|
disposed = true;
|
|
3233
|
+
if (opts.writer?.setOnAppend) {
|
|
3234
|
+
try {
|
|
3235
|
+
opts.writer.setOnAppend(prevOnAppend);
|
|
3236
|
+
} catch {
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
2779
3239
|
offAgents?.();
|
|
2780
3240
|
if (watcher) {
|
|
2781
3241
|
try {
|
|
@@ -3121,11 +3581,8 @@ function startToolTelemetryBridge(opts) {
|
|
|
3121
3581
|
}
|
|
3122
3582
|
function truncateForSummary(output, policy, max = 280) {
|
|
3123
3583
|
const resolved = resolveHqRedactionPolicy(policy);
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
return `${output.slice(0, max)}\u2026[truncated:${output.length - max}]`;
|
|
3127
|
-
}
|
|
3128
|
-
return scrubAndTruncateHqPreview(output, max) ?? "";
|
|
3584
|
+
const limit = resolved.rawContent ? Math.max(max, HQ_TRANSCRIPT_TEXT_CAP) : max;
|
|
3585
|
+
return scrubAndTruncateHqPreview(output, limit) ?? "";
|
|
3129
3586
|
}
|
|
3130
3587
|
|
|
3131
3588
|
// src/hq/cost-bridge.ts
|
|
@@ -3247,6 +3704,7 @@ var BestEffortLatestQueue = class {
|
|
|
3247
3704
|
};
|
|
3248
3705
|
|
|
3249
3706
|
// src/hq/kanban-store.ts
|
|
3707
|
+
var MAX_HQ_KANBAN_CACHE_PROJECTS = 32;
|
|
3250
3708
|
var HqKanbanStore = class {
|
|
3251
3709
|
dirPath;
|
|
3252
3710
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -3257,14 +3715,18 @@ var HqKanbanStore = class {
|
|
|
3257
3715
|
}
|
|
3258
3716
|
async load(projectId) {
|
|
3259
3717
|
const cached = this.cache.get(projectId);
|
|
3260
|
-
if (cached !== void 0)
|
|
3718
|
+
if (cached !== void 0) {
|
|
3719
|
+
this.cache.delete(projectId);
|
|
3720
|
+
this.cache.set(projectId, cached);
|
|
3721
|
+
return structuredClone(cached);
|
|
3722
|
+
}
|
|
3261
3723
|
try {
|
|
3262
3724
|
const content = await fs6.readFile(this.filePath(projectId), "utf8");
|
|
3263
3725
|
const snapshot = JSON.parse(content);
|
|
3264
3726
|
if (!isHqKanbanSnapshotPayload(snapshot) || snapshot.projectId !== projectId) {
|
|
3265
3727
|
return emptyKanbanSnapshot(projectId);
|
|
3266
3728
|
}
|
|
3267
|
-
this.
|
|
3729
|
+
this.setCached(projectId, snapshot);
|
|
3268
3730
|
return structuredClone(snapshot);
|
|
3269
3731
|
} catch {
|
|
3270
3732
|
return emptyKanbanSnapshot(projectId);
|
|
@@ -3279,11 +3741,13 @@ var HqKanbanStore = class {
|
|
|
3279
3741
|
() => {
|
|
3280
3742
|
if (this.mergeChains.get(incoming.projectId) === next) {
|
|
3281
3743
|
this.mergeChains.delete(incoming.projectId);
|
|
3744
|
+
this.trimCache();
|
|
3282
3745
|
}
|
|
3283
3746
|
},
|
|
3284
3747
|
() => {
|
|
3285
3748
|
if (this.mergeChains.get(incoming.projectId) === next) {
|
|
3286
3749
|
this.mergeChains.delete(incoming.projectId);
|
|
3750
|
+
this.trimCache();
|
|
3287
3751
|
}
|
|
3288
3752
|
}
|
|
3289
3753
|
);
|
|
@@ -3292,7 +3756,8 @@ var HqKanbanStore = class {
|
|
|
3292
3756
|
async mergeNow(incoming) {
|
|
3293
3757
|
const current = await this.load(incoming.projectId);
|
|
3294
3758
|
const records = /* @__PURE__ */ new Map();
|
|
3295
|
-
for (const record of [...current.boards, ...current.tombstones])
|
|
3759
|
+
for (const record of [...current.boards, ...current.tombstones])
|
|
3760
|
+
records.set(record.boardId, record);
|
|
3296
3761
|
for (const record of [...incoming.boards, ...incoming.tombstones]) {
|
|
3297
3762
|
const existing = records.get(record.boardId);
|
|
3298
3763
|
if (existing === void 0 || compareKanbanRecord(record, existing) > 0) {
|
|
@@ -3311,8 +3776,15 @@ var HqKanbanStore = class {
|
|
|
3311
3776
|
}
|
|
3312
3777
|
merged.boards.sort((a, b) => a.boardId.localeCompare(b.boardId));
|
|
3313
3778
|
merged.tombstones.sort((a, b) => a.boardId.localeCompare(b.boardId));
|
|
3314
|
-
this.
|
|
3315
|
-
this.writer(incoming.projectId)
|
|
3779
|
+
this.setCached(incoming.projectId, merged);
|
|
3780
|
+
const writer = this.writer(incoming.projectId);
|
|
3781
|
+
writer.enqueue(merged);
|
|
3782
|
+
void writer.drain().then(() => {
|
|
3783
|
+
if (this.writers.get(incoming.projectId) === writer) {
|
|
3784
|
+
this.writers.delete(incoming.projectId);
|
|
3785
|
+
this.trimCache();
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3316
3788
|
return structuredClone(merged);
|
|
3317
3789
|
}
|
|
3318
3790
|
async drain() {
|
|
@@ -3330,6 +3802,21 @@ var HqKanbanStore = class {
|
|
|
3330
3802
|
}
|
|
3331
3803
|
return writer;
|
|
3332
3804
|
}
|
|
3805
|
+
setCached(projectId, snapshot) {
|
|
3806
|
+
this.cache.delete(projectId);
|
|
3807
|
+
this.cache.set(projectId, snapshot);
|
|
3808
|
+
this.trimCache(projectId);
|
|
3809
|
+
}
|
|
3810
|
+
trimCache(protectedProjectId) {
|
|
3811
|
+
if (this.cache.size <= MAX_HQ_KANBAN_CACHE_PROJECTS) return;
|
|
3812
|
+
for (const projectId of this.cache.keys()) {
|
|
3813
|
+
if (this.cache.size <= MAX_HQ_KANBAN_CACHE_PROJECTS) break;
|
|
3814
|
+
if (projectId === protectedProjectId || this.writers.has(projectId) || this.mergeChains.has(projectId)) {
|
|
3815
|
+
continue;
|
|
3816
|
+
}
|
|
3817
|
+
this.cache.delete(projectId);
|
|
3818
|
+
}
|
|
3819
|
+
}
|
|
3333
3820
|
filePath(projectId) {
|
|
3334
3821
|
const safe = createHash4("sha256").update(projectId).digest("hex");
|
|
3335
3822
|
return path6.join(this.dirPath, `${safe}.json`);
|
|
@@ -3540,11 +4027,25 @@ async function countNonEmptyLines(filePath) {
|
|
|
3540
4027
|
// src/hq/persistence/event-log.ts
|
|
3541
4028
|
var DEFAULT_EVENT_LOG_MAX_LINES = 5e4;
|
|
3542
4029
|
var DEFAULT_EVENT_LOG_ROTATE_KEEP = 2e4;
|
|
3543
|
-
var DEFAULT_EVENT_LOG_MAX_BYTES =
|
|
3544
|
-
var DEFAULT_EVENT_LOG_ROTATE_KEEP_BYTES =
|
|
4030
|
+
var DEFAULT_EVENT_LOG_MAX_BYTES = 32 * 1024 * 1024;
|
|
4031
|
+
var DEFAULT_EVENT_LOG_ROTATE_KEEP_BYTES = 16 * 1024 * 1024;
|
|
3545
4032
|
var RECENT_TAIL_SCAN_BYTES = 1024 * 1024;
|
|
3546
4033
|
var FILTERED_RECENT_TAIL_SCAN_BYTES = 256 * 1024;
|
|
3547
4034
|
var BULK_PREFIX_READ_CAP = 8 * 1024 * 1024;
|
|
4035
|
+
var HQ_EVENT_LOG_PRESETS = Object.freeze({
|
|
4036
|
+
vps8: { maxBytes: 8 * 1024 * 1024, rotateKeepBytes: 2 * 1024 * 1024 },
|
|
4037
|
+
vps32: { maxBytes: 32 * 1024 * 1024, rotateKeepBytes: 16 * 1024 * 1024 },
|
|
4038
|
+
desktop: { maxBytes: 64 * 1024 * 1024, rotateKeepBytes: 24 * 1024 * 1024 }
|
|
4039
|
+
});
|
|
4040
|
+
function hqEventLogPresetFields(preset) {
|
|
4041
|
+
const fields = HQ_EVENT_LOG_PRESETS[preset];
|
|
4042
|
+
if (fields === void 0) {
|
|
4043
|
+
throw new Error(
|
|
4044
|
+
`Unknown HqEventLogPreset: ${String(preset)}. Allowed: ${Object.keys(HQ_EVENT_LOG_PRESETS).join(", ")}.`
|
|
4045
|
+
);
|
|
4046
|
+
}
|
|
4047
|
+
return fields;
|
|
4048
|
+
}
|
|
3548
4049
|
var HqEventLog = class {
|
|
3549
4050
|
filePath;
|
|
3550
4051
|
maxLines;
|
|
@@ -3575,7 +4076,7 @@ var HqEventLog = class {
|
|
|
3575
4076
|
async appendInternal(events) {
|
|
3576
4077
|
await this.ensureLineCount();
|
|
3577
4078
|
const lines = events.map((event) => JSON.stringify(event)).join("\n") + "\n";
|
|
3578
|
-
await fs8.appendFile(this.filePath, lines, { encoding: "utf8" });
|
|
4079
|
+
await fs8.appendFile(this.filePath, lines, { encoding: "utf8", mode: SECRET_FILE_MODE });
|
|
3579
4080
|
this.lineCount += events.length;
|
|
3580
4081
|
this.byteCount += Buffer.byteLength(lines, "utf8");
|
|
3581
4082
|
if (this.lineCount >= this.maxLines || this.byteCount >= this.maxBytes) {
|
|
@@ -3994,7 +4495,7 @@ var HqTimeseriesStore = class {
|
|
|
3994
4495
|
const lines = snapshot.samples.map((bucket) => JSON.stringify(bucket)).join("\n") + "\n";
|
|
3995
4496
|
await withFileLock(this.filePath, async () => {
|
|
3996
4497
|
this.diskLineCount ??= await countNonEmptyLines(this.filePath);
|
|
3997
|
-
await fs11.appendFile(this.filePath, lines, { encoding: "utf8" });
|
|
4498
|
+
await fs11.appendFile(this.filePath, lines, { encoding: "utf8", mode: SECRET_FILE_MODE });
|
|
3998
4499
|
this.diskLineCount += snapshot.samples.length;
|
|
3999
4500
|
const compactAt = Math.max(this.maxBuckets + 1, this.maxBuckets * 4);
|
|
4000
4501
|
if (this.diskLineCount >= compactAt) {
|
|
@@ -4514,9 +5015,16 @@ export {
|
|
|
4514
5015
|
DEFAULT_HQ_REDACTION_POLICY,
|
|
4515
5016
|
HQ_AUTH_CONTENT_HASH_REDACTED,
|
|
4516
5017
|
HQ_AUTH_FILE_VERSION,
|
|
5018
|
+
HQ_BROWSER_PEER_RESUME_CLIENT_ID,
|
|
4517
5019
|
HQ_CLI_DEFAULT_HOST,
|
|
4518
5020
|
HQ_COMMAND_TYPES,
|
|
5021
|
+
HQ_EVENT_LOG_PRESETS,
|
|
5022
|
+
HQ_PEER_REHYDRATE_HINT_MAX_CHARS,
|
|
5023
|
+
HQ_PEER_REHYDRATE_REASONS,
|
|
4519
5024
|
HQ_PROTOCOL_VERSION,
|
|
5025
|
+
HQ_RESUME_GAP_MAX_BYTES,
|
|
5026
|
+
HQ_RESUME_GAP_MAX_ENVELOPES,
|
|
5027
|
+
HQ_RESUME_GAP_MAX_STALE_MS,
|
|
4520
5028
|
HQ_TRANSCRIPT_TEXT_CAP,
|
|
4521
5029
|
HqAlertEngine,
|
|
4522
5030
|
HqBootstrapCodeStore,
|
|
@@ -4548,8 +5056,16 @@ export {
|
|
|
4548
5056
|
hqAuthAuditPath,
|
|
4549
5057
|
hqAuthContentHash,
|
|
4550
5058
|
hqAuthFilePath,
|
|
5059
|
+
hqEventLogPresetFields,
|
|
4551
5060
|
hqRuntimeFilePath,
|
|
5061
|
+
hqTokenKey,
|
|
5062
|
+
hqTokenVerifier,
|
|
5063
|
+
isHqGovernanceSnapshotPayload,
|
|
4552
5064
|
isHqKanbanSnapshotPayload,
|
|
5065
|
+
isHqPeerLostPayload,
|
|
5066
|
+
isHqPeerRehydratePayload,
|
|
5067
|
+
isHqResumeGapMessage,
|
|
5068
|
+
isHqResumeRejectMessage,
|
|
4553
5069
|
isLoopbackHost,
|
|
4554
5070
|
isOpenMode,
|
|
4555
5071
|
isTokenExpired,
|
|
@@ -4564,6 +5080,7 @@ export {
|
|
|
4564
5080
|
mutateHqAuthFile,
|
|
4565
5081
|
parseHqEventPayload,
|
|
4566
5082
|
parseHqFrame,
|
|
5083
|
+
readHqAuthAuditTail,
|
|
4567
5084
|
readHqAuthFile,
|
|
4568
5085
|
readHqRuntimeFileSync,
|
|
4569
5086
|
redactHqEvent,
|