@wrongstack/cli 0.297.0 → 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/{acp-A5OSIU2P.js → acp-S4LZQB66.js} +91 -23
- package/dist/{auth-CJWQJVRH.js → auth-NLLGEYQR.js} +3 -3
- package/dist/boot/governance-evidence-candidate.d.ts +3 -0
- package/dist/boot/governance-shadow-bridge.d.ts +19 -0
- package/dist/boot/governance-trace-context.d.ts +64 -0
- package/dist/boot/tui-session-resume.d.ts +10 -1
- package/dist/chimera-leader-wake.d.ts +57 -0
- package/dist/chimera-reviewer-policy.d.ts +89 -1
- package/dist/chimera-subagent-ladder.d.ts +72 -0
- package/dist/{chunk-AZESNNIC.js → chunk-4HH3YGG4.js} +3 -3
- package/dist/{chunk-IHBYBYGA.js → chunk-A6Q5KGLV.js} +51 -18
- package/dist/{chunk-ABXK4VVY.js → chunk-ARWGQUB3.js} +2 -1
- package/dist/{chunk-7JABKXET.js → chunk-C5GH4YBL.js} +1018 -175
- package/dist/{chunk-TADVX644.js → chunk-GO3TJICK.js} +11 -2
- package/dist/{chunk-JBTFWWKV.js → chunk-I2BM6FK6.js} +9 -4
- package/dist/{chunk-AXVZMEWG.js → chunk-I5MEUFDI.js} +2 -2
- package/dist/chunk-U3SS4NRH.js +10 -0
- package/dist/{chunk-QZKWRNIP.js → chunk-V3XH6XBJ.js} +12 -9
- package/dist/{cli-main-GOY5YGVL.js → cli-main-TJEU4OUY.js} +954 -268
- package/dist/cli-main-helpers.d.ts +42 -2
- package/dist/{execution-A4PGK4XV.js → execution-INOV5P7N.js} +1236 -652
- package/dist/execution-chimera-cascade.d.ts +7 -1
- package/dist/execution-chimera-review.d.ts +35 -0
- package/dist/fleet/host-types.d.ts +6 -1
- package/dist/fleet-statusline.d.ts +1 -0
- package/dist/governance-V2Z42RBE.js +65 -0
- package/dist/governance-hq-telemetry.d.ts +17 -0
- package/dist/{hq-GBPGXIR5.js → hq-WO6CLUSI.js} +2 -2
- package/dist/hq-server/auth.d.ts +33 -2
- package/dist/hq-server/login-attempt-store.d.ts +73 -0
- package/dist/hq-server/routes/auth-handlers.d.ts +73 -5
- package/dist/hq-server/routes.d.ts +5 -5
- package/dist/hq-server/types.d.ts +36 -2
- package/dist/hq-server/utils.d.ts +51 -6
- package/dist/{hq-server-YQUUMTPU.js → hq-server-6TSAORAC.js} +2 -2
- package/dist/hq-server.d.ts +10 -0
- package/dist/index.js +49 -21
- package/dist/live-settings-input.d.ts +1 -1
- package/dist/settings-menu.d.ts +1 -1
- package/dist/slash-commands/fallback.d.ts +2 -0
- package/dist/slash-commands/goal-refiner.d.ts +1 -1
- package/dist/subcommands/handlers/acp-connection-gate.d.ts +20 -0
- package/dist/subcommands/handlers/governance.d.ts +8 -0
- package/dist/{update-YC4TYW2Y.js → update-MV6TUACD.js} +3 -3
- package/dist/utils/win32-cmd.d.ts +9 -6
- package/dist/{version-help-DROHZRW6.js → version-help-ASKQYXDJ.js} +2 -2
- package/dist/{webui-server-XKFUOKMJ.js → webui-server-PCLSXX6L.js} +10 -3
- package/dist/wiring/brain-and-orchestration.d.ts +2 -0
- package/dist/wiring/provider-runtime-setup.d.ts +2 -2
- package/package.json +23 -22
- package/dist/acp-A5OSIU2P.js.map +0 -7
- package/dist/acp-registry-cache.d.ts.map +0 -1
- package/dist/acp-server-agent.d.ts.map +0 -1
- package/dist/arg-parser.d.ts.map +0 -1
- package/dist/audit-2ZSFGNIF.js.map +0 -7
- package/dist/auth-CJWQJVRH.js.map +0 -7
- package/dist/auth-menu/add-provider.d.ts.map +0 -1
- package/dist/auth-menu/anthropic-oauth.d.ts.map +0 -1
- package/dist/auth-menu/auth-menu-audit.d.ts.map +0 -1
- package/dist/auth-menu/direct.d.ts.map +0 -1
- package/dist/auth-menu/github-copilot-oauth.d.ts.map +0 -1
- package/dist/auth-menu/helpers.d.ts.map +0 -1
- package/dist/auth-menu/index.d.ts.map +0 -1
- package/dist/auth-menu/local-presets.d.ts.map +0 -1
- package/dist/auth-menu/local.d.ts.map +0 -1
- package/dist/auth-menu/loopback-server.d.ts.map +0 -1
- package/dist/auth-menu/oauth-menu.d.ts.map +0 -1
- package/dist/auth-menu/openai-codex-oauth.d.ts.map +0 -1
- package/dist/auth-menu/panel-service.d.ts.map +0 -1
- package/dist/auth-menu/provider-menu.d.ts.map +0 -1
- package/dist/auth-menu/shared.d.ts.map +0 -1
- package/dist/auth-menu/top-menu.d.ts.map +0 -1
- package/dist/auth-menu/types.d.ts.map +0 -1
- package/dist/auth-menu.d.ts.map +0 -1
- package/dist/bench-7ZDWSNEF.js.map +0 -7
- package/dist/boot/auto-discover-providers.d.ts.map +0 -1
- package/dist/boot/brain-decision-log.d.ts.map +0 -1
- package/dist/boot/config-backup-recovery.d.ts.map +0 -1
- package/dist/boot/container-wiring.d.ts.map +0 -1
- package/dist/boot/dispatch-singleshot.d.ts.map +0 -1
- package/dist/boot/dispatch-tui.d.ts.map +0 -1
- package/dist/boot/dispatch-webui.d.ts.map +0 -1
- package/dist/boot/event-wiring.d.ts.map +0 -1
- package/dist/boot/execution-mode.d.ts.map +0 -1
- package/dist/boot/launch-banner.d.ts.map +0 -1
- package/dist/boot/launch-menu.d.ts.map +0 -1
- package/dist/boot/short-circuit-desktop.d.ts.map +0 -1
- package/dist/boot/short-circuit-flags.d.ts.map +0 -1
- package/dist/boot/short-circuit-hq.d.ts.map +0 -1
- package/dist/boot/simpleui-full-auto.d.ts.map +0 -1
- package/dist/boot/system-prompt-builder.d.ts.map +0 -1
- package/dist/boot/system-prompt.d.ts.map +0 -1
- package/dist/boot/tool-registry.d.ts.map +0 -1
- package/dist/boot/tui-coordinator-callbacks.d.ts.map +0 -1
- package/dist/boot/tui-coordinator-setup.d.ts.map +0 -1
- package/dist/boot/tui-debug-stream.d.ts.map +0 -1
- package/dist/boot/tui-goal-wiring.d.ts.map +0 -1
- package/dist/boot/tui-live-sessions.d.ts.map +0 -1
- package/dist/boot/tui-project-picker-callback.d.ts.map +0 -1
- package/dist/boot/tui-project-spawn.d.ts.map +0 -1
- package/dist/boot/tui-project-switch.d.ts.map +0 -1
- package/dist/boot/tui-runtime-state.d.ts.map +0 -1
- package/dist/boot/tui-sdd-callback.d.ts.map +0 -1
- package/dist/boot/tui-session-resume.d.ts.map +0 -1
- package/dist/boot/tui-settings-adapter.d.ts.map +0 -1
- package/dist/boot-config.d.ts.map +0 -1
- package/dist/boot.d.ts.map +0 -1
- package/dist/brain-menu/panel-service.d.ts.map +0 -1
- package/dist/chimera-review-task.d.ts.map +0 -1
- package/dist/chimera-reviewer-policy.d.ts.map +0 -1
- package/dist/chronicle-QQEQFSSE.js.map +0 -7
- package/dist/chunk-5N34EWJR.js.map +0 -7
- package/dist/chunk-66T43Q4Y.js.map +0 -7
- package/dist/chunk-7JABKXET.js.map +0 -7
- package/dist/chunk-7OCVIDC7.js.map +0 -7
- package/dist/chunk-ABXK4VVY.js.map +0 -7
- package/dist/chunk-AXVZMEWG.js.map +0 -7
- package/dist/chunk-AZESNNIC.js.map +0 -7
- package/dist/chunk-BGFM3PD7.js.map +0 -7
- package/dist/chunk-DPJZQCVP.js.map +0 -7
- package/dist/chunk-F4PEGAJZ.js.map +0 -7
- package/dist/chunk-IHBYBYGA.js.map +0 -7
- package/dist/chunk-JBSQ7ONN.js.map +0 -7
- package/dist/chunk-JBTFWWKV.js.map +0 -7
- package/dist/chunk-JUHRI6OV.js.map +0 -7
- package/dist/chunk-JW75HY4F.js.map +0 -7
- package/dist/chunk-OP47B3IX.js.map +0 -7
- package/dist/chunk-PJHET45A.js.map +0 -7
- package/dist/chunk-Q5GTM25S.js.map +0 -7
- package/dist/chunk-QD544J2B.js.map +0 -7
- package/dist/chunk-QUNHS6O3.js.map +0 -7
- package/dist/chunk-QZKWRNIP.js.map +0 -7
- package/dist/chunk-TADVX644.js.map +0 -7
- package/dist/chunk-TGDHN4LM.js.map +0 -7
- package/dist/chunk-TYO2OVAD.js.map +0 -7
- package/dist/chunk-VCYZ3WZV.js.map +0 -7
- package/dist/chunk-VJUEZZYB.js +0 -29
- package/dist/chunk-VJUEZZYB.js.map +0 -7
- package/dist/chunk-WHOIR577.js.map +0 -7
- package/dist/chunk-XJXDOF63.js.map +0 -7
- package/dist/chunk-XTIXVJXP.js.map +0 -7
- package/dist/chunk-XWEGWYDU.js.map +0 -7
- package/dist/chunk-YWUPHRGB.js.map +0 -7
- package/dist/cli-bundled-prompts.d.ts.map +0 -1
- package/dist/cli-bundled-skills.d.ts.map +0 -1
- package/dist/cli-context.d.ts.map +0 -1
- package/dist/cli-entry-main.d.ts.map +0 -1
- package/dist/cli-entry-point.d.ts.map +0 -1
- package/dist/cli-eternal-flag.d.ts.map +0 -1
- package/dist/cli-main-GOY5YGVL.js.map +0 -7
- package/dist/cli-main-helpers.d.ts.map +0 -1
- package/dist/cli-main.d.ts.map +0 -1
- package/dist/cli-update-notice.d.ts.map +0 -1
- package/dist/config-doctor.d.ts.map +0 -1
- package/dist/config-history.d.ts.map +0 -1
- package/dist/context-limit.d.ts.map +0 -1
- package/dist/context-overflow-diagnostic.d.ts.map +0 -1
- package/dist/diag-doctor-OQ3AA63O.js.map +0 -7
- package/dist/diff-renderer.d.ts.map +0 -1
- package/dist/execute-deps.d.ts.map +0 -1
- package/dist/execution-A4PGK4XV.js.map +0 -7
- package/dist/execution-chimera-ask.d.ts.map +0 -1
- package/dist/execution-chimera-cascade.d.ts.map +0 -1
- package/dist/execution-cleanup.d.ts.map +0 -1
- package/dist/execution-kanban-dispatch.d.ts.map +0 -1
- package/dist/execution-repl-fleet-callbacks.d.ts.map +0 -1
- package/dist/execution-storage-observability.d.ts.map +0 -1
- package/dist/execution-tui-next-step-callbacks.d.ts.map +0 -1
- package/dist/execution.d.ts.map +0 -1
- package/dist/export-TPORYVRZ.js.map +0 -7
- package/dist/fleet/host-acp-runner-cache.d.ts.map +0 -1
- package/dist/fleet/host-acp.d.ts.map +0 -1
- package/dist/fleet/host-concurrency.d.ts.map +0 -1
- package/dist/fleet/host-context.d.ts.map +0 -1
- package/dist/fleet/host-director-builder.d.ts.map +0 -1
- package/dist/fleet/host-director-event-bridges.d.ts.map +0 -1
- package/dist/fleet/host-director-services.d.ts.map +0 -1
- package/dist/fleet/host-event-bridge.d.ts.map +0 -1
- package/dist/fleet/host-helpers.d.ts.map +0 -1
- package/dist/fleet/host-learning-tracker.d.ts.map +0 -1
- package/dist/fleet/host-learning.d.ts.map +0 -1
- package/dist/fleet/host-lifecycle-events.d.ts.map +0 -1
- package/dist/fleet/host-paths.d.ts.map +0 -1
- package/dist/fleet/host-provider.d.ts.map +0 -1
- package/dist/fleet/host-session-writer.d.ts.map +0 -1
- package/dist/fleet/host-shadow-pass.d.ts.map +0 -1
- package/dist/fleet/host-spawn-types.d.ts.map +0 -1
- package/dist/fleet/host-status.d.ts.map +0 -1
- package/dist/fleet/host-subagent-factory.d.ts.map +0 -1
- package/dist/fleet/host-supervisor.d.ts.map +0 -1
- package/dist/fleet/host-task-result-report.d.ts.map +0 -1
- package/dist/fleet/host-types.d.ts.map +0 -1
- package/dist/fleet/host.d.ts.map +0 -1
- package/dist/fleet/routing.d.ts.map +0 -1
- package/dist/fleet/status-broadcast.d.ts.map +0 -1
- package/dist/fleet/supervisor-registry.d.ts.map +0 -1
- package/dist/fleet-statusline.d.ts.map +0 -1
- package/dist/goal-host.d.ts.map +0 -1
- package/dist/hooks-wiring.d.ts.map +0 -1
- package/dist/hq-GBPGXIR5.js.map +0 -7
- package/dist/hq-command-controller.d.ts.map +0 -1
- package/dist/hq-publisher.d.ts.map +0 -1
- package/dist/hq-recovery-html.d.ts.map +0 -1
- package/dist/hq-server/audit-actor.d.ts.map +0 -1
- package/dist/hq-server/auth-state.d.ts.map +0 -1
- package/dist/hq-server/auth.d.ts.map +0 -1
- package/dist/hq-server/preflight.d.ts.map +0 -1
- package/dist/hq-server/project-root.d.ts.map +0 -1
- package/dist/hq-server/routes/auth-handlers.d.ts.map +0 -1
- package/dist/hq-server/routes/session-handlers.d.ts.map +0 -1
- package/dist/hq-server/routes/system-handlers.d.ts.map +0 -1
- package/dist/hq-server/routes.d.ts.map +0 -1
- package/dist/hq-server/snapshot.d.ts.map +0 -1
- package/dist/hq-server/startup.d.ts.map +0 -1
- package/dist/hq-server/trust-boundary.d.ts.map +0 -1
- package/dist/hq-server/types.d.ts.map +0 -1
- package/dist/hq-server/utils.d.ts.map +0 -1
- package/dist/hq-server/ws.d.ts.map +0 -1
- package/dist/hq-server-YQUUMTPU.js.map +0 -7
- package/dist/hq-server.d.ts.map +0 -1
- package/dist/hq-static-serve.d.ts.map +0 -1
- package/dist/hq-ttl-U2FAYFAT.js.map +0 -7
- package/dist/hq-tunnel-RFKGC4HI.js.map +0 -7
- package/dist/hq-tunnel.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/init-E2NDDOHI.js.map +0 -7
- package/dist/input-reader.d.ts.map +0 -1
- package/dist/kanban-dispatch-route.d.ts.map +0 -1
- package/dist/kanban-hq-sync.d.ts.map +0 -1
- package/dist/kanban-run-mirror-EKVNGXWW.js.map +0 -7
- package/dist/launch-hints.d.ts.map +0 -1
- package/dist/live-settings-input.d.ts.map +0 -1
- package/dist/mailbox-bridge-bootstrap.d.ts.map +0 -1
- package/dist/mailbox-serve-DBOOOOWZ.js.map +0 -7
- package/dist/mcp-CYLPUEHC.js.map +0 -7
- package/dist/mcp-serve.d.ts.map +0 -1
- package/dist/modeldiag-HENYJ4N7.js.map +0 -7
- package/dist/multi-agent.d.ts.map +0 -1
- package/dist/next-task-predictor.d.ts.map +0 -1
- package/dist/permission-prompt.d.ts.map +0 -1
- package/dist/permissions-FNYLZIL4.js.map +0 -7
- package/dist/picker-key-state.d.ts.map +0 -1
- package/dist/picker-model-picker.d.ts.map +0 -1
- package/dist/picker-ui.d.ts.map +0 -1
- package/dist/picker.d.ts.map +0 -1
- package/dist/plugin-api-factory.d.ts.map +0 -1
- package/dist/plugin-management.d.ts.map +0 -1
- package/dist/plugin-usage-OU6X6LM3.js.map +0 -7
- package/dist/plugins-4LJ5IUBI.js.map +0 -7
- package/dist/pre-launch/launch-prompts.d.ts.map +0 -1
- package/dist/pre-launch/project-check.d.ts.map +0 -1
- package/dist/pre-launch.d.ts.map +0 -1
- package/dist/preflight.d.ts.map +0 -1
- package/dist/profile-config-path.d.ts.map +0 -1
- package/dist/project-BLQ3ALVL.js.map +0 -7
- package/dist/project-manifest-GE25PW4S.js.map +0 -7
- package/dist/project-picker-BOCWHBXP.js.map +0 -7
- package/dist/project-picker.d.ts.map +0 -1
- package/dist/projects-XE76NFNZ.js.map +0 -7
- package/dist/provider-config-utils.d.ts.map +0 -1
- package/dist/provider-helpers.d.ts.map +0 -1
- package/dist/provider-id.d.ts.map +0 -1
- package/dist/providers-models-GDELBHZK.js.map +0 -7
- package/dist/quick-VIO2BEHS.js.map +0 -7
- package/dist/renderer.d.ts.map +0 -1
- package/dist/repl-auto-proceed.d.ts.map +0 -1
- package/dist/repl-client-registration.d.ts.map +0 -1
- package/dist/repl-input.d.ts.map +0 -1
- package/dist/repl-options.d.ts.map +0 -1
- package/dist/repl-rendering.d.ts.map +0 -1
- package/dist/repl-suggestions.d.ts.map +0 -1
- package/dist/repl.d.ts.map +0 -1
- package/dist/replay-KCTXNMZQ.js.map +0 -7
- package/dist/rewind-EJMVFVLS.js.map +0 -7
- package/dist/sdd-runtime-AIJCJGWC.js.map +0 -7
- package/dist/services/autonomy-mode.d.ts.map +0 -1
- package/dist/services/commit-message.d.ts.map +0 -1
- package/dist/services/dispatch-classifier.d.ts.map +0 -1
- package/dist/services/mcp-management.d.ts.map +0 -1
- package/dist/services/project-facts.d.ts.map +0 -1
- package/dist/services/project-manifest.d.ts.map +0 -1
- package/dist/services/sdd/project-context.d.ts.map +0 -1
- package/dist/services/sdd/spec-detection.d.ts.map +0 -1
- package/dist/services/sdd/state.d.ts.map +0 -1
- package/dist/services/sdd/task-manager.d.ts.map +0 -1
- package/dist/services/sdd-runtime.d.ts.map +0 -1
- package/dist/services/statusline-config.d.ts.map +0 -1
- package/dist/services/suggestion-store.d.ts.map +0 -1
- package/dist/session-event-wiring.d.ts.map +0 -1
- package/dist/session-stats.d.ts.map +0 -1
- package/dist/sessions-config-NLCMK3BY.js.map +0 -7
- package/dist/settings-menu.d.ts.map +0 -1
- package/dist/shutdown-cleanup.d.ts.map +0 -1
- package/dist/simpleui-dist-JIFGUJO7.js.map +0 -7
- package/dist/simpleui-dist.d.ts.map +0 -1
- package/dist/slash-commands/acp.d.ts.map +0 -1
- package/dist/slash-commands/agent-improve.d.ts.map +0 -1
- package/dist/slash-commands/agents.d.ts.map +0 -1
- package/dist/slash-commands/audit.d.ts.map +0 -1
- package/dist/slash-commands/auth.d.ts.map +0 -1
- package/dist/slash-commands/autonomy.d.ts.map +0 -1
- package/dist/slash-commands/brain.d.ts.map +0 -1
- package/dist/slash-commands/btw.d.ts.map +0 -1
- package/dist/slash-commands/clear.d.ts.map +0 -1
- package/dist/slash-commands/codebase-reindex.d.ts.map +0 -1
- package/dist/slash-commands/collab.d.ts.map +0 -1
- package/dist/slash-commands/command-context.d.ts.map +0 -1
- package/dist/slash-commands/commit-llm.d.ts.map +0 -1
- package/dist/slash-commands/compact.d.ts.map +0 -1
- package/dist/slash-commands/context.d.ts.map +0 -1
- package/dist/slash-commands/coordinator.d.ts.map +0 -1
- package/dist/slash-commands/delegate.d.ts.map +0 -1
- package/dist/slash-commands/design.d.ts.map +0 -1
- package/dist/slash-commands/dev.d.ts.map +0 -1
- package/dist/slash-commands/diag-stats.d.ts.map +0 -1
- package/dist/slash-commands/dispatch-llm.d.ts.map +0 -1
- package/dist/slash-commands/doctor.d.ts.map +0 -1
- package/dist/slash-commands/enhance.d.ts.map +0 -1
- package/dist/slash-commands/ensemble.d.ts.map +0 -1
- package/dist/slash-commands/f-keys.d.ts.map +0 -1
- package/dist/slash-commands/fallback.d.ts.map +0 -1
- package/dist/slash-commands/fix-classifier.d.ts.map +0 -1
- package/dist/slash-commands/fix.d.ts.map +0 -1
- package/dist/slash-commands/fleet.d.ts.map +0 -1
- package/dist/slash-commands/git.d.ts.map +0 -1
- package/dist/slash-commands/gitid.d.ts.map +0 -1
- package/dist/slash-commands/goal-refiner.d.ts.map +0 -1
- package/dist/slash-commands/goal.d.ts.map +0 -1
- package/dist/slash-commands/health.d.ts.map +0 -1
- package/dist/slash-commands/help.d.ts.map +0 -1
- package/dist/slash-commands/helpers.d.ts.map +0 -1
- package/dist/slash-commands/hq.d.ts.map +0 -1
- package/dist/slash-commands/index.d.ts.map +0 -1
- package/dist/slash-commands/init.d.ts.map +0 -1
- package/dist/slash-commands/interrupt.d.ts.map +0 -1
- package/dist/slash-commands/kanban-agent-helpers.d.ts.map +0 -1
- package/dist/slash-commands/kanban-format.d.ts.map +0 -1
- package/dist/slash-commands/kanban-help.d.ts.map +0 -1
- package/dist/slash-commands/kanban.d.ts.map +0 -1
- package/dist/slash-commands/mailbox-demo.d.ts.map +0 -1
- package/dist/slash-commands/mailbox-serve.d.ts.map +0 -1
- package/dist/slash-commands/mailbox.d.ts.map +0 -1
- package/dist/slash-commands/mcp-utils.d.ts.map +0 -1
- package/dist/slash-commands/mcp.d.ts.map +0 -1
- package/dist/slash-commands/memory-compact.d.ts.map +0 -1
- package/dist/slash-commands/memory-flags.d.ts.map +0 -1
- package/dist/slash-commands/memory-formatters.d.ts.map +0 -1
- package/dist/slash-commands/memory.d.ts.map +0 -1
- package/dist/slash-commands/metrics.d.ts.map +0 -1
- package/dist/slash-commands/mode.d.ts.map +0 -1
- package/dist/slash-commands/modelcaps.d.ts.map +0 -1
- package/dist/slash-commands/models.d.ts.map +0 -1
- package/dist/slash-commands/mouse.d.ts.map +0 -1
- package/dist/slash-commands/next.d.ts.map +0 -1
- package/dist/slash-commands/plan.d.ts.map +0 -1
- package/dist/slash-commands/plugin.d.ts.map +0 -1
- package/dist/slash-commands/profile.d.ts.map +0 -1
- package/dist/slash-commands/project-utils.d.ts.map +0 -1
- package/dist/slash-commands/project.d.ts.map +0 -1
- package/dist/slash-commands/provider-status.d.ts.map +0 -1
- package/dist/slash-commands/prune.d.ts.map +0 -1
- package/dist/slash-commands/refiner.d.ts.map +0 -1
- package/dist/slash-commands/review.d.ts.map +0 -1
- package/dist/slash-commands/sdd/rendering.d.ts.map +0 -1
- package/dist/slash-commands/sdd-command-helpers.d.ts.map +0 -1
- package/dist/slash-commands/sdd-format.d.ts.map +0 -1
- package/dist/slash-commands/sdd.d.ts.map +0 -1
- package/dist/slash-commands/security.d.ts.map +0 -1
- package/dist/slash-commands/session.d.ts.map +0 -1
- package/dist/slash-commands/setmodel.d.ts.map +0 -1
- package/dist/slash-commands/settings.d.ts.map +0 -1
- package/dist/slash-commands/shadow.d.ts.map +0 -1
- package/dist/slash-commands/slash-deep-help.d.ts.map +0 -1
- package/dist/slash-commands/spawn-agents.d.ts.map +0 -1
- package/dist/slash-commands/statusline.d.ts.map +0 -1
- package/dist/slash-commands/suggest.d.ts.map +0 -1
- package/dist/slash-commands/suggestion-store.d.ts.map +0 -1
- package/dist/slash-commands/supervisor.d.ts.map +0 -1
- package/dist/slash-commands/surfaces.d.ts.map +0 -1
- package/dist/slash-commands/tasks.d.ts.map +0 -1
- package/dist/slash-commands/techstack.d.ts.map +0 -1
- package/dist/slash-commands/telegram-pairing.d.ts.map +0 -1
- package/dist/slash-commands/telegram-settings.d.ts.map +0 -1
- package/dist/slash-commands/telegram-setup.d.ts.map +0 -1
- package/dist/slash-commands/todos.d.ts.map +0 -1
- package/dist/slash-commands/tool.d.ts.map +0 -1
- package/dist/slash-commands/tools.d.ts.map +0 -1
- package/dist/slash-commands/tuneup.d.ts.map +0 -1
- package/dist/slash-commands/working-dir.d.ts.map +0 -1
- package/dist/slash-commands/worktree.d.ts.map +0 -1
- package/dist/slash-commands/yolo.d.ts.map +0 -1
- package/dist/spinner.d.ts.map +0 -1
- package/dist/subcommands/contracts.d.ts.map +0 -1
- package/dist/subcommands/handlers/acp.d.ts.map +0 -1
- package/dist/subcommands/handlers/audit.d.ts.map +0 -1
- package/dist/subcommands/handlers/auth-local-help.d.ts.map +0 -1
- package/dist/subcommands/handlers/auth.d.ts.map +0 -1
- package/dist/subcommands/handlers/bench-run-help.d.ts.map +0 -1
- package/dist/subcommands/handlers/bench.d.ts.map +0 -1
- package/dist/subcommands/handlers/chronicle.d.ts.map +0 -1
- package/dist/subcommands/handlers/config-history.d.ts.map +0 -1
- package/dist/subcommands/handlers/diag-doctor.d.ts.map +0 -1
- package/dist/subcommands/handlers/export.d.ts.map +0 -1
- package/dist/subcommands/handlers/helpers.d.ts.map +0 -1
- package/dist/subcommands/handlers/hq.d.ts.map +0 -1
- package/dist/subcommands/handlers/init.d.ts.map +0 -1
- package/dist/subcommands/handlers/mailbox-serve.d.ts.map +0 -1
- package/dist/subcommands/handlers/mcp.d.ts.map +0 -1
- package/dist/subcommands/handlers/model-smoke-test.d.ts.map +0 -1
- package/dist/subcommands/handlers/modeldiag-profiles.d.ts.map +0 -1
- package/dist/subcommands/handlers/modeldiag.d.ts.map +0 -1
- package/dist/subcommands/handlers/models-add-help.d.ts.map +0 -1
- package/dist/subcommands/handlers/per-subcommand-deep-help-table.d.ts.map +0 -1
- package/dist/subcommands/handlers/per-subcommand-help-data.d.ts.map +0 -1
- package/dist/subcommands/handlers/per-subcommand-help-table.d.ts.map +0 -1
- package/dist/subcommands/handlers/per-subcommand-help-types.d.ts.map +0 -1
- package/dist/subcommands/handlers/per-subcommand-help.d.ts.map +0 -1
- package/dist/subcommands/handlers/permissions.d.ts.map +0 -1
- package/dist/subcommands/handlers/plugin-usage.d.ts.map +0 -1
- package/dist/subcommands/handlers/project.d.ts.map +0 -1
- package/dist/subcommands/handlers/projects.d.ts.map +0 -1
- package/dist/subcommands/handlers/providers-models.d.ts.map +0 -1
- package/dist/subcommands/handlers/quick.d.ts.map +0 -1
- package/dist/subcommands/handlers/replay.d.ts.map +0 -1
- package/dist/subcommands/handlers/rewind.d.ts.map +0 -1
- package/dist/subcommands/handlers/sessions-config.d.ts.map +0 -1
- package/dist/subcommands/handlers/sessions-fleet.d.ts.map +0 -1
- package/dist/subcommands/handlers/tools-skills.d.ts.map +0 -1
- package/dist/subcommands/handlers/update.d.ts.map +0 -1
- package/dist/subcommands/handlers/version-help.d.ts.map +0 -1
- package/dist/subcommands/index.d.ts.map +0 -1
- package/dist/theme.d.ts.map +0 -1
- package/dist/tools-skills-UNKLOB7M.js.map +0 -7
- package/dist/tui-thinking-word.d.ts.map +0 -1
- package/dist/tuneup.d.ts.map +0 -1
- package/dist/update-YC4TYW2Y.js.map +0 -7
- package/dist/update-check-UMYTOH7Z.js.map +0 -7
- package/dist/update-check.d.ts.map +0 -1
- package/dist/utils/delay-format.d.ts.map +0 -1
- package/dist/utils/hq-ttl.d.ts.map +0 -1
- package/dist/utils/win32-cmd.d.ts.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/version-help-DROHZRW6.js.map +0 -7
- package/dist/version.d.ts.map +0 -1
- package/dist/webui-server/client-registration.d.ts.map +0 -1
- package/dist/webui-server/connection-handler.d.ts.map +0 -1
- package/dist/webui-server/context-breakdown.d.ts.map +0 -1
- package/dist/webui-server/contracts.d.ts.map +0 -1
- package/dist/webui-server/cost-helpers.d.ts.map +0 -1
- package/dist/webui-server/kanban-host-adapter.d.ts.map +0 -1
- package/dist/webui-server/kanban-run-mirror.d.ts.map +0 -1
- package/dist/webui-server/kanban-supervisor.d.ts.map +0 -1
- package/dist/webui-server/lifecycle.d.ts.map +0 -1
- package/dist/webui-server/listen-helpers.d.ts.map +0 -1
- package/dist/webui-server/logger-shim.d.ts.map +0 -1
- package/dist/webui-server/node-pty-loader.d.ts.map +0 -1
- package/dist/webui-server/prefs-seeding.d.ts.map +0 -1
- package/dist/webui-server/privileged-actions.d.ts.map +0 -1
- package/dist/webui-server/provider-config.d.ts.map +0 -1
- package/dist/webui-server/session-start-payload.d.ts.map +0 -1
- package/dist/webui-server/setup-events.d.ts.map +0 -1
- package/dist/webui-server/static-serve.d.ts.map +0 -1
- package/dist/webui-server/stream-coalescer.d.ts.map +0 -1
- package/dist/webui-server/terminal-log-view.d.ts.map +0 -1
- package/dist/webui-server-XKFUOKMJ.js.map +0 -7
- package/dist/webui-server-options.d.ts.map +0 -1
- package/dist/webui-server.d.ts.map +0 -1
- package/dist/wiring/brain-and-orchestration.d.ts.map +0 -1
- package/dist/wiring/codebase-index.d.ts.map +0 -1
- package/dist/wiring/command-host-adapters.d.ts.map +0 -1
- package/dist/wiring/command-host-state.d.ts.map +0 -1
- package/dist/wiring/controllers.d.ts.map +0 -1
- package/dist/wiring/dep-watcher-bridge.d.ts.map +0 -1
- package/dist/wiring/dep-watcher.d.ts.map +0 -1
- package/dist/wiring/design-studio.d.ts.map +0 -1
- package/dist/wiring/director-setup.d.ts.map +0 -1
- package/dist/wiring/eternal-command-handlers.d.ts.map +0 -1
- package/dist/wiring/fleet-command-handlers.d.ts.map +0 -1
- package/dist/wiring/hq-telemetry.d.ts.map +0 -1
- package/dist/wiring/lifecycle-plugins.d.ts.map +0 -1
- package/dist/wiring/mailbox-bridge-bootstrap.d.ts.map +0 -1
- package/dist/wiring/management-tools.d.ts.map +0 -1
- package/dist/wiring/metrics.d.ts.map +0 -1
- package/dist/wiring/pipeline.d.ts.map +0 -1
- package/dist/wiring/plugins.d.ts.map +0 -1
- package/dist/wiring/provider-runtime-setup.d.ts.map +0 -1
- package/dist/wiring/provider-runtime.d.ts.map +0 -1
- package/dist/wiring/provider-status.d.ts.map +0 -1
- package/dist/wiring/provider-utility-tools.d.ts.map +0 -1
- package/dist/wiring/provider.d.ts.map +0 -1
- package/dist/wiring/replay.d.ts.map +0 -1
- package/dist/wiring/runtime-controller-deps.d.ts.map +0 -1
- package/dist/wiring/runtime-dispatch-state.d.ts.map +0 -1
- package/dist/wiring/runtime-lifecycle-deps.d.ts.map +0 -1
- package/dist/wiring/runtime-picker-deps.d.ts.map +0 -1
- package/dist/wiring/sage.d.ts.map +0 -1
- package/dist/wiring/sdd-handlers.d.ts.map +0 -1
- package/dist/wiring/security-command.d.ts.map +0 -1
- package/dist/wiring/session-command-handlers.d.ts.map +0 -1
- package/dist/wiring/session-registry.d.ts.map +0 -1
- package/dist/wiring/session.d.ts.map +0 -1
- package/dist/wiring/slash-commands.d.ts.map +0 -1
- package/dist/wiring/to-execute-deps.d.ts.map +0 -1
- package/dist/wiring/tools.d.ts.map +0 -1
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runProjectPicker
|
|
3
3
|
} from "./chunk-5N34EWJR.js";
|
|
4
|
+
import {
|
|
5
|
+
ensureProjectDataDir,
|
|
6
|
+
findProject,
|
|
7
|
+
generateSlug,
|
|
8
|
+
loadManifest,
|
|
9
|
+
saveManifest
|
|
10
|
+
} from "./chunk-JUHRI6OV.js";
|
|
4
11
|
import {
|
|
5
12
|
createHqCommandDispatcher
|
|
6
13
|
} from "./chunk-OP47B3IX.js";
|
|
@@ -16,7 +23,7 @@ import {
|
|
|
16
23
|
persistTelegramConfig,
|
|
17
24
|
removeSuggestions,
|
|
18
25
|
setSuggestions
|
|
19
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-V3XH6XBJ.js";
|
|
20
27
|
import {
|
|
21
28
|
startCliHqConnection
|
|
22
29
|
} from "./chunk-JW75HY4F.js";
|
|
@@ -33,13 +40,6 @@ import {
|
|
|
33
40
|
import {
|
|
34
41
|
setupPlugins
|
|
35
42
|
} from "./chunk-QUNHS6O3.js";
|
|
36
|
-
import {
|
|
37
|
-
ensureProjectDataDir,
|
|
38
|
-
findProject,
|
|
39
|
-
generateSlug,
|
|
40
|
-
loadManifest,
|
|
41
|
-
saveManifest
|
|
42
|
-
} from "./chunk-JUHRI6OV.js";
|
|
43
43
|
import {
|
|
44
44
|
PLUGIN_AUDIT_ENTRIES,
|
|
45
45
|
runPluginManagementCommand
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
detectProjectFacts,
|
|
50
50
|
makeConfirmAwaiter,
|
|
51
51
|
renderAgentsTemplate
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-A6Q5KGLV.js";
|
|
53
53
|
import "./chunk-QD544J2B.js";
|
|
54
54
|
import {
|
|
55
55
|
fmtTaskResultLine,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
} from "./chunk-XJXDOF63.js";
|
|
62
62
|
import {
|
|
63
63
|
buildWin32CmdShimInvocation
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-U3SS4NRH.js";
|
|
65
65
|
import {
|
|
66
66
|
checkForUpdate
|
|
67
67
|
} from "./chunk-F4PEGAJZ.js";
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
loadCachedAcpRegistry,
|
|
71
71
|
refreshAcpRegistry,
|
|
72
72
|
setupProvider
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-4HH3YGG4.js";
|
|
74
74
|
import {
|
|
75
75
|
addCustomProvider,
|
|
76
76
|
addKeyForCatalogProvider,
|
|
@@ -80,7 +80,7 @@ import {
|
|
|
80
80
|
runClaudeOAuthLogin,
|
|
81
81
|
runCopilotOAuthLogin,
|
|
82
82
|
validateFamily
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-I2BM6FK6.js";
|
|
84
84
|
import {
|
|
85
85
|
LOCAL_LLM_PRESETS,
|
|
86
86
|
parseSpawnFlags
|
|
@@ -90,7 +90,7 @@ import {
|
|
|
90
90
|
} from "./chunk-66T43Q4Y.js";
|
|
91
91
|
import {
|
|
92
92
|
runCodexOAuthLogin
|
|
93
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-GO3TJICK.js";
|
|
94
94
|
import {
|
|
95
95
|
activeLabel,
|
|
96
96
|
loadConfigProviders,
|
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
} from "./chunk-7OCVIDC7.js";
|
|
111
111
|
|
|
112
112
|
// src/cli-main.ts
|
|
113
|
-
import * as
|
|
113
|
+
import * as path31 from "node:path";
|
|
114
114
|
import { FLEET_ROSTER as FLEET_ROSTER5, mailboxSessionTag as mailboxSessionTag5 } from "@wrongstack/core/coordination";
|
|
115
115
|
import { gatedEnhancerReasoning } from "@wrongstack/core/execution";
|
|
116
116
|
import { TOKENS as TOKENS9 } from "@wrongstack/core/kernel";
|
|
@@ -787,7 +787,7 @@ function resolveTaskConcurrency() {
|
|
|
787
787
|
var WORKTREE_PHASE_CONCURRENCY = 4;
|
|
788
788
|
var MAX_CMD_OUTPUT = 2e5;
|
|
789
789
|
function gitText(args, cwd) {
|
|
790
|
-
return new Promise((
|
|
790
|
+
return new Promise((resolve8, reject) => {
|
|
791
791
|
let child;
|
|
792
792
|
try {
|
|
793
793
|
child = spawn("git", args, {
|
|
@@ -812,8 +812,8 @@ function gitText(args, cwd) {
|
|
|
812
812
|
};
|
|
813
813
|
child.stdout?.on("data", emit);
|
|
814
814
|
child.stderr?.on("data", emit);
|
|
815
|
-
child.on("error", () =>
|
|
816
|
-
child.on("close", (code) =>
|
|
815
|
+
child.on("error", () => resolve8({ code: 1, out: chunks.join("") }));
|
|
816
|
+
child.on("close", (code) => resolve8({ code: code ?? 1, out: chunks.join("").trim() }));
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
async function isGitRepo(cwd) {
|
|
@@ -862,7 +862,7 @@ function runCmd(cmd, args, cwd, shell = false) {
|
|
|
862
862
|
});
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
|
-
return new Promise((
|
|
865
|
+
return new Promise((resolve8, reject) => {
|
|
866
866
|
const chunks = [];
|
|
867
867
|
let child;
|
|
868
868
|
try {
|
|
@@ -885,11 +885,11 @@ function runCmd(cmd, args, cwd, shell = false) {
|
|
|
885
885
|
};
|
|
886
886
|
child.stdout?.on("data", append);
|
|
887
887
|
child.stderr?.on("data", append);
|
|
888
|
-
child.on("error", (e) =>
|
|
888
|
+
child.on("error", (e) => resolve8({ code: 1, out: `${chunks.join("")}${String(e)}` }));
|
|
889
889
|
child.on("close", (code) => {
|
|
890
890
|
let out = chunks.join("");
|
|
891
891
|
if (out.length > MAX_CMD_OUTPUT) out = out.slice(-MAX_CMD_OUTPUT);
|
|
892
|
-
|
|
892
|
+
resolve8({ code: code ?? 1, out: out.trim() });
|
|
893
893
|
});
|
|
894
894
|
});
|
|
895
895
|
}
|
|
@@ -1447,9 +1447,385 @@ async function launchEternalFromFlag(deps) {
|
|
|
1447
1447
|
}
|
|
1448
1448
|
|
|
1449
1449
|
// src/cli-main-helpers.ts
|
|
1450
|
+
import { getSharedProjectMailbox } from "@wrongstack/core/coordination";
|
|
1451
|
+
import { createGovernanceMutationSnapshotBridge } from "@wrongstack/runtime/governance-mutation-snapshot-bridge";
|
|
1452
|
+
import { sanitizeGovernanceMessage } from "@wrongstack/runtime/governance-sanitize";
|
|
1453
|
+
|
|
1454
|
+
// src/boot/governance-evidence-candidate.ts
|
|
1450
1455
|
import {
|
|
1451
|
-
|
|
1452
|
-
|
|
1456
|
+
createGovernanceEvidenceCandidate,
|
|
1457
|
+
GOVERNANCE_EVIDENCE_CANDIDATE_SCHEMA_VERSION
|
|
1458
|
+
} from "@wrongstack/runtime/governance-bootstrap";
|
|
1459
|
+
|
|
1460
|
+
// src/boot/governance-shadow-bridge.ts
|
|
1461
|
+
var SHADOW_SOURCE = "wrongstack.cli.shadow.v1";
|
|
1462
|
+
function optional(key, value) {
|
|
1463
|
+
return value === void 0 ? {} : { [key]: value };
|
|
1464
|
+
}
|
|
1465
|
+
function createGovernanceShadowBridge(input) {
|
|
1466
|
+
const disposers = [];
|
|
1467
|
+
let closed = false;
|
|
1468
|
+
let warned = false;
|
|
1469
|
+
const warnOnce = (message, context) => {
|
|
1470
|
+
if (warned || closed) return;
|
|
1471
|
+
warned = true;
|
|
1472
|
+
input.logger.warn(message, context);
|
|
1473
|
+
};
|
|
1474
|
+
const observe = (observation) => {
|
|
1475
|
+
if (closed) return;
|
|
1476
|
+
try {
|
|
1477
|
+
void input.sink.observe(observation).then(
|
|
1478
|
+
(result) => {
|
|
1479
|
+
if (!result.recorded) {
|
|
1480
|
+
warnOnce("governance: shadow observation was not recorded", {
|
|
1481
|
+
code: result.code,
|
|
1482
|
+
message: result.message
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
(error) => {
|
|
1487
|
+
warnOnce("governance: shadow observation failed open", {
|
|
1488
|
+
message: error instanceof Error ? error.message : String(error)
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1492
|
+
} catch (error) {
|
|
1493
|
+
warnOnce("governance: shadow observation failed open", {
|
|
1494
|
+
message: error instanceof Error ? error.message : String(error)
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
const on = (event, map) => {
|
|
1499
|
+
disposers.push(input.events.on(event, (payload) => observe(map(payload))));
|
|
1500
|
+
};
|
|
1501
|
+
const traced = (payload, taskId, boardId) => ({
|
|
1502
|
+
...payload,
|
|
1503
|
+
trace: input.trace.snapshot(taskId, boardId)
|
|
1504
|
+
});
|
|
1505
|
+
on("agent.run.started", (event) => ({
|
|
1506
|
+
taskId: event.ctx.currentKanbanTaskId ?? null,
|
|
1507
|
+
category: "status_changed",
|
|
1508
|
+
observedAt: event.at,
|
|
1509
|
+
payload: traced(
|
|
1510
|
+
{
|
|
1511
|
+
entity: "agent_run",
|
|
1512
|
+
observer: SHADOW_SOURCE,
|
|
1513
|
+
phase: "started",
|
|
1514
|
+
model: event.model,
|
|
1515
|
+
...optional("sessionId", event.sessionId),
|
|
1516
|
+
...optional("agentId", event.ctx.agentId),
|
|
1517
|
+
...optional("agentName", event.ctx.agentName),
|
|
1518
|
+
...optional("traceId", event.ctx.traceId)
|
|
1519
|
+
},
|
|
1520
|
+
event.ctx.currentKanbanTaskId ?? null,
|
|
1521
|
+
event.ctx.currentKanbanBoardId
|
|
1522
|
+
)
|
|
1523
|
+
}));
|
|
1524
|
+
on("agent.run.completed", (event) => ({
|
|
1525
|
+
taskId: event.ctx.currentKanbanTaskId ?? null,
|
|
1526
|
+
category: "status_changed",
|
|
1527
|
+
observedAt: event.at,
|
|
1528
|
+
payload: traced(
|
|
1529
|
+
{
|
|
1530
|
+
entity: "agent_run",
|
|
1531
|
+
observer: SHADOW_SOURCE,
|
|
1532
|
+
phase: "completed",
|
|
1533
|
+
status: event.status,
|
|
1534
|
+
iterations: event.iterations,
|
|
1535
|
+
durationMs: event.durationMs,
|
|
1536
|
+
...optional("sessionId", event.sessionId),
|
|
1537
|
+
...optional("agentId", event.ctx.agentId),
|
|
1538
|
+
...optional("agentName", event.ctx.agentName),
|
|
1539
|
+
...optional("traceId", event.ctx.traceId)
|
|
1540
|
+
},
|
|
1541
|
+
event.ctx.currentKanbanTaskId ?? null,
|
|
1542
|
+
event.ctx.currentKanbanBoardId
|
|
1543
|
+
)
|
|
1544
|
+
}));
|
|
1545
|
+
on("agent.run.error", (event) => ({
|
|
1546
|
+
taskId: event.ctx.currentKanbanTaskId ?? null,
|
|
1547
|
+
category: "failure_reported",
|
|
1548
|
+
observedAt: event.at,
|
|
1549
|
+
payload: traced(
|
|
1550
|
+
{
|
|
1551
|
+
entity: "agent_run",
|
|
1552
|
+
observer: SHADOW_SOURCE,
|
|
1553
|
+
phase: "error",
|
|
1554
|
+
durationMs: event.durationMs,
|
|
1555
|
+
errorName: event.err.name,
|
|
1556
|
+
...optional("sessionId", event.sessionId),
|
|
1557
|
+
...optional("agentId", event.ctx.agentId),
|
|
1558
|
+
...optional("agentName", event.ctx.agentName),
|
|
1559
|
+
...optional("traceId", event.ctx.traceId)
|
|
1560
|
+
},
|
|
1561
|
+
event.ctx.currentKanbanTaskId ?? null,
|
|
1562
|
+
event.ctx.currentKanbanBoardId
|
|
1563
|
+
)
|
|
1564
|
+
}));
|
|
1565
|
+
on("tool.started", (event) => ({
|
|
1566
|
+
taskId: event.taskId ?? null,
|
|
1567
|
+
category: "tool_invoked",
|
|
1568
|
+
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1569
|
+
payload: traced(
|
|
1570
|
+
{
|
|
1571
|
+
phase: "started",
|
|
1572
|
+
observer: SHADOW_SOURCE,
|
|
1573
|
+
toolCallId: event.id,
|
|
1574
|
+
toolName: event.name,
|
|
1575
|
+
...optional("sessionId", event.sessionId),
|
|
1576
|
+
...optional("traceId", event.traceId),
|
|
1577
|
+
...optional("agentId", event.agentId),
|
|
1578
|
+
...optional("agentName", event.agentName),
|
|
1579
|
+
...optional("boardId", event.boardId),
|
|
1580
|
+
...optional("provider", event.provider),
|
|
1581
|
+
...optional("model", event.model)
|
|
1582
|
+
},
|
|
1583
|
+
event.taskId ?? null,
|
|
1584
|
+
event.boardId
|
|
1585
|
+
)
|
|
1586
|
+
}));
|
|
1587
|
+
on("permission.evaluated", (event) => ({
|
|
1588
|
+
taskId: event.taskId ?? null,
|
|
1589
|
+
category: "tool_invoked",
|
|
1590
|
+
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1591
|
+
payload: traced(
|
|
1592
|
+
{
|
|
1593
|
+
phase: "authorized",
|
|
1594
|
+
observer: SHADOW_SOURCE,
|
|
1595
|
+
toolCallId: event.id,
|
|
1596
|
+
toolName: event.name,
|
|
1597
|
+
inputHash: event.inputHash,
|
|
1598
|
+
policyDecision: event.policyDecision,
|
|
1599
|
+
effectiveDecision: event.effectiveDecision,
|
|
1600
|
+
decisionSource: event.decisionSource,
|
|
1601
|
+
yoloEnabled: event.yoloEnabled,
|
|
1602
|
+
capabilityDowngraded: event.capabilityDowngraded,
|
|
1603
|
+
...optional("sessionId", event.sessionId),
|
|
1604
|
+
...optional("traceId", event.traceId),
|
|
1605
|
+
...optional("agentId", event.agentId),
|
|
1606
|
+
...optional("riskTier", event.riskTier),
|
|
1607
|
+
...optional("boundaryDecision", event.boundaryDecision),
|
|
1608
|
+
...optional("boardId", event.boardId),
|
|
1609
|
+
...optional("provider", event.provider),
|
|
1610
|
+
...optional("model", event.model)
|
|
1611
|
+
},
|
|
1612
|
+
event.taskId ?? null,
|
|
1613
|
+
event.boardId
|
|
1614
|
+
)
|
|
1615
|
+
}));
|
|
1616
|
+
on("tool.executed", (event) => ({
|
|
1617
|
+
taskId: event.taskId ?? null,
|
|
1618
|
+
category: "tool_invoked",
|
|
1619
|
+
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1620
|
+
payload: traced(
|
|
1621
|
+
{
|
|
1622
|
+
phase: "completed",
|
|
1623
|
+
observer: SHADOW_SOURCE,
|
|
1624
|
+
toolName: event.name,
|
|
1625
|
+
durationMs: event.durationMs,
|
|
1626
|
+
ok: event.ok,
|
|
1627
|
+
...optional("mutating", event.mutating),
|
|
1628
|
+
...optional("toolCallId", event.id),
|
|
1629
|
+
...optional("sessionId", event.sessionId),
|
|
1630
|
+
...optional("traceId", event.traceId),
|
|
1631
|
+
...optional("agentId", event.agentId),
|
|
1632
|
+
...optional("agentName", event.agentName),
|
|
1633
|
+
...optional("outputBytes", event.outputBytes),
|
|
1634
|
+
...optional("outputTokens", event.outputTokens),
|
|
1635
|
+
...optional("outputLines", event.outputLines),
|
|
1636
|
+
...optional("boardId", event.boardId),
|
|
1637
|
+
...optional("provider", event.provider),
|
|
1638
|
+
...optional("model", event.model)
|
|
1639
|
+
},
|
|
1640
|
+
event.taskId ?? null,
|
|
1641
|
+
event.boardId
|
|
1642
|
+
)
|
|
1643
|
+
}));
|
|
1644
|
+
on("tool.executed", (event) => {
|
|
1645
|
+
const trace = input.trace.snapshot(event.taskId ?? null, event.boardId);
|
|
1646
|
+
return {
|
|
1647
|
+
taskId: event.taskId ?? null,
|
|
1648
|
+
category: "evidence_candidate",
|
|
1649
|
+
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1650
|
+
payload: {
|
|
1651
|
+
observer: SHADOW_SOURCE,
|
|
1652
|
+
...createGovernanceEvidenceCandidate(trace, {
|
|
1653
|
+
toolCallId: event.id,
|
|
1654
|
+
toolName: event.name,
|
|
1655
|
+
ok: event.ok,
|
|
1656
|
+
durationMs: event.durationMs,
|
|
1657
|
+
outputBytes: event.outputBytes,
|
|
1658
|
+
outputTokens: event.outputTokens,
|
|
1659
|
+
outputLines: event.outputLines
|
|
1660
|
+
}),
|
|
1661
|
+
trace
|
|
1662
|
+
}
|
|
1663
|
+
};
|
|
1664
|
+
});
|
|
1665
|
+
on("checkpoint.written", (event) => {
|
|
1666
|
+
input.trace.updateWorkspaceCheckpoint(event.promptIndex, event.ts, event.workspaceCheckpoint);
|
|
1667
|
+
return {
|
|
1668
|
+
taskId: null,
|
|
1669
|
+
category: "status_changed",
|
|
1670
|
+
observedAt: event.ts,
|
|
1671
|
+
payload: traced(
|
|
1672
|
+
{
|
|
1673
|
+
entity: "workspace_checkpoint",
|
|
1674
|
+
observer: SHADOW_SOURCE,
|
|
1675
|
+
phase: "captured",
|
|
1676
|
+
promptIndex: event.promptIndex,
|
|
1677
|
+
fileCount: event.fileCount
|
|
1678
|
+
},
|
|
1679
|
+
null
|
|
1680
|
+
)
|
|
1681
|
+
};
|
|
1682
|
+
});
|
|
1683
|
+
disposers.push(
|
|
1684
|
+
input.events.on("storage.write", (event) => {
|
|
1685
|
+
if (event.store !== "plan" || event.outcome !== "success" || !input.trace.matchesPlanPath(event.filePath)) {
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
void input.trace.refreshPlan().then((plan) => {
|
|
1689
|
+
observe({
|
|
1690
|
+
taskId: null,
|
|
1691
|
+
category: "plan_updated",
|
|
1692
|
+
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1693
|
+
payload: traced(
|
|
1694
|
+
{
|
|
1695
|
+
entity: "session_plan",
|
|
1696
|
+
observer: SHADOW_SOURCE,
|
|
1697
|
+
phase: "persisted",
|
|
1698
|
+
plan
|
|
1699
|
+
},
|
|
1700
|
+
null
|
|
1701
|
+
)
|
|
1702
|
+
});
|
|
1703
|
+
});
|
|
1704
|
+
})
|
|
1705
|
+
);
|
|
1706
|
+
return Object.freeze({
|
|
1707
|
+
close: () => {
|
|
1708
|
+
if (closed) return;
|
|
1709
|
+
closed = true;
|
|
1710
|
+
for (const dispose of disposers.splice(0)) dispose();
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
|
|
1715
|
+
// src/boot/governance-trace-context.ts
|
|
1716
|
+
import { createHash } from "node:crypto";
|
|
1717
|
+
import * as fs from "node:fs/promises";
|
|
1718
|
+
import * as path from "node:path";
|
|
1719
|
+
var MAX_GOVERNANCE_PLAN_BYTES = 1024 * 1024;
|
|
1720
|
+
var MAX_GOVERNANCE_ACTIVE_STEP_IDS = 128;
|
|
1721
|
+
var DEFAULT_DEPENDENCIES = {
|
|
1722
|
+
readFile: (filePath) => fs.readFile(filePath, "utf8"),
|
|
1723
|
+
now: () => (/* @__PURE__ */ new Date()).toISOString()
|
|
1724
|
+
};
|
|
1725
|
+
function normalizedPath(input) {
|
|
1726
|
+
const resolved = path.resolve(input);
|
|
1727
|
+
return process.platform === "win32" ? resolved.toLowerCase() : resolved;
|
|
1728
|
+
}
|
|
1729
|
+
function validTimestamp(value) {
|
|
1730
|
+
return typeof value === "string" && Number.isFinite(Date.parse(value));
|
|
1731
|
+
}
|
|
1732
|
+
function planTrace(raw, observedAt) {
|
|
1733
|
+
let parsed;
|
|
1734
|
+
try {
|
|
1735
|
+
parsed = JSON.parse(raw);
|
|
1736
|
+
} catch {
|
|
1737
|
+
return Object.freeze({ state: "invalid" });
|
|
1738
|
+
}
|
|
1739
|
+
if (!parsed || typeof parsed !== "object") return Object.freeze({ state: "invalid" });
|
|
1740
|
+
const record = parsed;
|
|
1741
|
+
if (record["version"] !== 1 || !Array.isArray(record["items"])) {
|
|
1742
|
+
return Object.freeze({ state: "invalid" });
|
|
1743
|
+
}
|
|
1744
|
+
const statuses = { open: 0, in_progress: 0, done: 0 };
|
|
1745
|
+
const activeStepIds = [];
|
|
1746
|
+
for (const entry of record["items"]) {
|
|
1747
|
+
if (!entry || typeof entry !== "object") return Object.freeze({ state: "invalid" });
|
|
1748
|
+
const item = entry;
|
|
1749
|
+
const id = item["id"];
|
|
1750
|
+
const status = item["status"];
|
|
1751
|
+
if (typeof id !== "string" || status !== "open" && status !== "in_progress" && status !== "done") {
|
|
1752
|
+
return Object.freeze({ state: "invalid" });
|
|
1753
|
+
}
|
|
1754
|
+
statuses[status]++;
|
|
1755
|
+
if (status === "in_progress" && activeStepIds.length < MAX_GOVERNANCE_ACTIVE_STEP_IDS) {
|
|
1756
|
+
activeStepIds.push(id);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
return Object.freeze({
|
|
1760
|
+
state: "available",
|
|
1761
|
+
schemaVersion: 1,
|
|
1762
|
+
fingerprint: createHash("sha256").update(raw, "utf8").digest("hex"),
|
|
1763
|
+
...validTimestamp(record["updatedAt"]) ? { updatedAt: record["updatedAt"] } : {},
|
|
1764
|
+
observedAt,
|
|
1765
|
+
itemCount: record["items"].length,
|
|
1766
|
+
openCount: statuses.open,
|
|
1767
|
+
inProgressCount: statuses.in_progress,
|
|
1768
|
+
doneCount: statuses.done,
|
|
1769
|
+
activeStepIds: Object.freeze(activeStepIds),
|
|
1770
|
+
activeStepIdsTruncated: statuses.in_progress > activeStepIds.length
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
var LiveGovernanceTraceContext = class {
|
|
1774
|
+
#sessionId;
|
|
1775
|
+
#planPath;
|
|
1776
|
+
#dependencies;
|
|
1777
|
+
#plan = Object.freeze({ state: "missing" });
|
|
1778
|
+
#workspace = Object.freeze({ state: "not_captured" });
|
|
1779
|
+
#planGeneration = 0;
|
|
1780
|
+
constructor(sessionId, planPath, dependencies) {
|
|
1781
|
+
this.#sessionId = sessionId;
|
|
1782
|
+
this.#planPath = normalizedPath(planPath);
|
|
1783
|
+
this.#dependencies = dependencies;
|
|
1784
|
+
}
|
|
1785
|
+
matchesPlanPath(candidate) {
|
|
1786
|
+
return normalizedPath(candidate) === this.#planPath;
|
|
1787
|
+
}
|
|
1788
|
+
async refreshPlan() {
|
|
1789
|
+
const generation = ++this.#planGeneration;
|
|
1790
|
+
this.#plan = Object.freeze({ state: "refreshing", observedAt: this.#dependencies.now() });
|
|
1791
|
+
let next;
|
|
1792
|
+
try {
|
|
1793
|
+
const raw = await this.#dependencies.readFile(this.#planPath);
|
|
1794
|
+
next = Buffer.byteLength(raw, "utf8") > MAX_GOVERNANCE_PLAN_BYTES ? Object.freeze({ state: "unreadable" }) : planTrace(raw, this.#dependencies.now());
|
|
1795
|
+
} catch (error) {
|
|
1796
|
+
next = Object.freeze({
|
|
1797
|
+
state: error.code === "ENOENT" ? "missing" : "unreadable"
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
if (generation === this.#planGeneration) this.#plan = next;
|
|
1801
|
+
return this.#plan;
|
|
1802
|
+
}
|
|
1803
|
+
updateWorkspaceCheckpoint(promptIndex, observedAt, checkpoint) {
|
|
1804
|
+
this.#workspace = checkpoint ? Object.freeze({
|
|
1805
|
+
state: "captured",
|
|
1806
|
+
promptIndex,
|
|
1807
|
+
manifestHash: checkpoint.manifestHash,
|
|
1808
|
+
baseHead: checkpoint.baseHead,
|
|
1809
|
+
entryCount: checkpoint.entryCount,
|
|
1810
|
+
unresolvedCount: checkpoint.unresolvedCount,
|
|
1811
|
+
capturedAt: checkpoint.capturedAt,
|
|
1812
|
+
coverage: checkpoint.coverage
|
|
1813
|
+
}) : Object.freeze({ state: "unavailable", promptIndex, observedAt });
|
|
1814
|
+
}
|
|
1815
|
+
snapshot(taskId, boardId) {
|
|
1816
|
+
return Object.freeze({
|
|
1817
|
+
sessionId: this.#sessionId,
|
|
1818
|
+
task: taskId ? Object.freeze({ scope: "kanban_task", taskId, boardId: boardId ?? null }) : Object.freeze({ scope: "session" }),
|
|
1819
|
+
plan: this.#plan,
|
|
1820
|
+
workspace: this.#workspace
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
async function createGovernanceTraceContext(input, dependencies = DEFAULT_DEPENDENCIES) {
|
|
1825
|
+
const context = new LiveGovernanceTraceContext(input.sessionId, input.planPath, dependencies);
|
|
1826
|
+
await context.refreshPlan();
|
|
1827
|
+
return context;
|
|
1828
|
+
}
|
|
1453
1829
|
|
|
1454
1830
|
// src/context-limit.ts
|
|
1455
1831
|
import { toErrorMessage } from "@wrongstack/core/utils";
|
|
@@ -1565,6 +1941,98 @@ function positiveNumber(value) {
|
|
|
1565
1941
|
}
|
|
1566
1942
|
|
|
1567
1943
|
// src/cli-main-helpers.ts
|
|
1944
|
+
var WRONGSTACK_GOVERNANCE_ENV = "WRONGSTACK_GOVERNANCE";
|
|
1945
|
+
var DEFAULT_GOVERNANCE_DEPENDENCIES = {
|
|
1946
|
+
load: () => import("@wrongstack/runtime/governance-bootstrap")
|
|
1947
|
+
};
|
|
1948
|
+
function governanceRuntimeEnabled(environment) {
|
|
1949
|
+
return environment[WRONGSTACK_GOVERNANCE_ENV]?.trim() === "1";
|
|
1950
|
+
}
|
|
1951
|
+
async function bootstrapCliGovernance(options, dependencies = DEFAULT_GOVERNANCE_DEPENDENCIES) {
|
|
1952
|
+
if (!governanceRuntimeEnabled(options.environment)) {
|
|
1953
|
+
return Object.freeze({ mode: "disabled", reason: "feature_flag_off" });
|
|
1954
|
+
}
|
|
1955
|
+
let loaded;
|
|
1956
|
+
try {
|
|
1957
|
+
loaded = await dependencies.load();
|
|
1958
|
+
} catch (error) {
|
|
1959
|
+
return Object.freeze({
|
|
1960
|
+
mode: "legacy",
|
|
1961
|
+
code: "module_unavailable",
|
|
1962
|
+
phase: "bootstrap",
|
|
1963
|
+
message: sanitizeGovernanceMessage(error instanceof Error ? error.message : String(error)),
|
|
1964
|
+
cleanup: "not_required"
|
|
1965
|
+
});
|
|
1966
|
+
}
|
|
1967
|
+
try {
|
|
1968
|
+
return await loaded.bootstrapGovernanceRuntime({
|
|
1969
|
+
projectRoot: options.projectRoot,
|
|
1970
|
+
projectId: options.projectId,
|
|
1971
|
+
adminClientId: options.adminClientId,
|
|
1972
|
+
modelClientId: options.modelClientId,
|
|
1973
|
+
modelCapabilities: options.modelCapabilities,
|
|
1974
|
+
...options.adminTtlMs === void 0 ? {} : { adminTtlMs: options.adminTtlMs },
|
|
1975
|
+
...options.modelTtlMs === void 0 ? {} : { modelTtlMs: options.modelTtlMs },
|
|
1976
|
+
...options.timeoutMs === void 0 ? {} : { timeoutMs: options.timeoutMs },
|
|
1977
|
+
...options.existingAdmin === void 0 ? {} : { existingAdmin: options.existingAdmin }
|
|
1978
|
+
});
|
|
1979
|
+
} catch (error) {
|
|
1980
|
+
return Object.freeze({
|
|
1981
|
+
mode: "legacy",
|
|
1982
|
+
code: "bootstrap_failed",
|
|
1983
|
+
phase: "bootstrap",
|
|
1984
|
+
message: sanitizeGovernanceMessage(error instanceof Error ? error.message : String(error)),
|
|
1985
|
+
cleanup: "unavailable"
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
async function setupCliGovernance(input) {
|
|
1990
|
+
const result = await bootstrapCliGovernance({
|
|
1991
|
+
environment: process.env,
|
|
1992
|
+
projectRoot: input.projectRoot,
|
|
1993
|
+
projectId: input.projectId,
|
|
1994
|
+
adminClientId: `cli-control-${process.pid}-${input.sessionId}`,
|
|
1995
|
+
modelClientId: `cli-model-${input.sessionId}`,
|
|
1996
|
+
modelCapabilities: ["task_read", "command_submit", "shadow_observe"]
|
|
1997
|
+
});
|
|
1998
|
+
if (result.mode === "governed") {
|
|
1999
|
+
const snapshot = result.handle.snapshot();
|
|
2000
|
+
input.contextMeta["governance"] = snapshot;
|
|
2001
|
+
input.logger.info(`governance: ${snapshot.source} session-scoped control plane`);
|
|
2002
|
+
const trace = await createGovernanceTraceContext({
|
|
2003
|
+
sessionId: input.sessionId,
|
|
2004
|
+
planPath: input.planPath
|
|
2005
|
+
});
|
|
2006
|
+
const shadow = createGovernanceShadowBridge({
|
|
2007
|
+
events: input.events,
|
|
2008
|
+
sink: result.handle,
|
|
2009
|
+
logger: input.logger,
|
|
2010
|
+
trace
|
|
2011
|
+
});
|
|
2012
|
+
const mutationSnapshots = createGovernanceMutationSnapshotBridge({
|
|
2013
|
+
events: input.events,
|
|
2014
|
+
sink: result.handle,
|
|
2015
|
+
captureWorkspaceCheckpoint: input.captureWorkspaceCheckpoint,
|
|
2016
|
+
logger: input.logger
|
|
2017
|
+
});
|
|
2018
|
+
return Object.freeze({
|
|
2019
|
+
installToolBoundary: (pipelines) => mutationSnapshots.installToolBoundary(pipelines),
|
|
2020
|
+
close: async () => {
|
|
2021
|
+
await mutationSnapshots.close();
|
|
2022
|
+
shadow.close();
|
|
2023
|
+
return result.handle.close();
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
} else if (result.mode === "legacy") {
|
|
2027
|
+
input.contextMeta["governance"] = result;
|
|
2028
|
+
input.logger.warn(`governance: legacy fallback (${result.code})`, {
|
|
2029
|
+
phase: result.phase,
|
|
2030
|
+
cleanup: result.cleanup,
|
|
2031
|
+
message: result.message
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
return void 0;
|
|
2035
|
+
}
|
|
1568
2036
|
function createTeardownEventRegistrar(events, teardownHandlers) {
|
|
1569
2037
|
return (event, handler) => {
|
|
1570
2038
|
events.on(event, handler);
|
|
@@ -1941,13 +2409,13 @@ function wireSessionEvents(deps) {
|
|
|
1941
2409
|
// src/session-stats.ts
|
|
1942
2410
|
import { color as color4 } from "@wrongstack/core/utils";
|
|
1943
2411
|
var SESSION_STATS_MAX_PATHS = 1e4;
|
|
1944
|
-
function addBoundedPath(set,
|
|
1945
|
-
if (set.has(
|
|
2412
|
+
function addBoundedPath(set, path32) {
|
|
2413
|
+
if (set.has(path32)) return;
|
|
1946
2414
|
if (set.size >= SESSION_STATS_MAX_PATHS) {
|
|
1947
2415
|
const oldest = set.values().next().value;
|
|
1948
2416
|
if (oldest !== void 0) set.delete(oldest);
|
|
1949
2417
|
}
|
|
1950
|
-
set.add(
|
|
2418
|
+
set.add(path32);
|
|
1951
2419
|
}
|
|
1952
2420
|
var SessionStats = class {
|
|
1953
2421
|
tokenCounter;
|
|
@@ -1986,11 +2454,11 @@ var SessionStats = class {
|
|
|
1986
2454
|
if (tool.name === "bash") this.bashCommands++;
|
|
1987
2455
|
else if (tool.name === "fetch") this.fetches++;
|
|
1988
2456
|
if (!tool.ok) return;
|
|
1989
|
-
const
|
|
1990
|
-
if (tool.name === "read" &&
|
|
1991
|
-
else if (tool.name === "edit" &&
|
|
1992
|
-
else if (tool.name === "write" &&
|
|
1993
|
-
addBoundedPath(this.writtenPaths,
|
|
2457
|
+
const path32 = typeof input?.path === "string" ? input.path : void 0;
|
|
2458
|
+
if (tool.name === "read" && path32) addBoundedPath(this.readPaths, path32);
|
|
2459
|
+
else if (tool.name === "edit" && path32) addBoundedPath(this.editedPaths, path32);
|
|
2460
|
+
else if (tool.name === "write" && path32) {
|
|
2461
|
+
addBoundedPath(this.writtenPaths, path32);
|
|
1994
2462
|
const content = typeof input?.content === "string" ? input.content : "";
|
|
1995
2463
|
this.bytesWritten += Buffer.byteLength(content, "utf8");
|
|
1996
2464
|
}
|
|
@@ -2223,15 +2691,15 @@ import {
|
|
|
2223
2691
|
import { wstackGlobalRoot } from "@wrongstack/core/utils";
|
|
2224
2692
|
|
|
2225
2693
|
// src/fleet/host-helpers.ts
|
|
2226
|
-
import * as
|
|
2694
|
+
import * as path2 from "node:path";
|
|
2227
2695
|
import {
|
|
2228
2696
|
makeSubagentResultTool
|
|
2229
2697
|
} from "@wrongstack/core/coordination";
|
|
2230
2698
|
import { ToolCapabilities, WIDE_SUBAGENT_CAPABILITIES } from "@wrongstack/core/security";
|
|
2231
2699
|
import { makePreferSideConflictResolver } from "@wrongstack/sdd";
|
|
2232
2700
|
function isInsideDirectory(root, candidate) {
|
|
2233
|
-
const relative5 =
|
|
2234
|
-
return relative5 === "" || !relative5.startsWith("..") && !
|
|
2701
|
+
const relative5 = path2.relative(path2.resolve(root), path2.resolve(candidate));
|
|
2702
|
+
return relative5 === "" || !relative5.startsWith("..") && !path2.isAbsolute(relative5);
|
|
2235
2703
|
}
|
|
2236
2704
|
function isAgentAvailable(schedule, at = /* @__PURE__ */ new Date()) {
|
|
2237
2705
|
const parts = new Intl.DateTimeFormat("en-US", {
|
|
@@ -2508,19 +2976,19 @@ function emitHostLifecycleCompleted(events, sessionId, taskId, result) {
|
|
|
2508
2976
|
}
|
|
2509
2977
|
|
|
2510
2978
|
// src/fleet/host-paths.ts
|
|
2511
|
-
import * as
|
|
2979
|
+
import * as path3 from "node:path";
|
|
2512
2980
|
function applyFleetRootDefaults(opts) {
|
|
2513
2981
|
if (opts.fleetRoot && !opts.manifestPath) {
|
|
2514
|
-
opts.manifestPath =
|
|
2982
|
+
opts.manifestPath = path3.join(opts.fleetRoot, "fleet.json");
|
|
2515
2983
|
}
|
|
2516
2984
|
if (opts.fleetRoot && !opts.sharedScratchpadPath) {
|
|
2517
|
-
opts.sharedScratchpadPath =
|
|
2985
|
+
opts.sharedScratchpadPath = path3.join(opts.fleetRoot, "shared");
|
|
2518
2986
|
}
|
|
2519
2987
|
if (opts.fleetRoot && !opts.sessionsRoot) {
|
|
2520
|
-
opts.sessionsRoot =
|
|
2988
|
+
opts.sessionsRoot = path3.join(opts.fleetRoot, "subagents");
|
|
2521
2989
|
}
|
|
2522
2990
|
if (opts.fleetRoot && !opts.stateCheckpointPath) {
|
|
2523
|
-
opts.stateCheckpointPath =
|
|
2991
|
+
opts.stateCheckpointPath = path3.join(opts.fleetRoot, "director-state.json");
|
|
2524
2992
|
}
|
|
2525
2993
|
}
|
|
2526
2994
|
|
|
@@ -2685,7 +3153,7 @@ function registerCoordinatorLifecycleHandlers(input) {
|
|
|
2685
3153
|
// src/fleet/host-subagent-factory.ts
|
|
2686
3154
|
import { randomUUID } from "node:crypto";
|
|
2687
3155
|
import { existsSync, statSync } from "node:fs";
|
|
2688
|
-
import * as
|
|
3156
|
+
import * as path5 from "node:path";
|
|
2689
3157
|
import {
|
|
2690
3158
|
Agent,
|
|
2691
3159
|
Context,
|
|
@@ -2715,7 +3183,7 @@ import { EventBus } from "@wrongstack/core/kernel";
|
|
|
2715
3183
|
import { AutoApprovePermissionPolicy } from "@wrongstack/core/security";
|
|
2716
3184
|
|
|
2717
3185
|
// src/fleet/host-event-bridge.ts
|
|
2718
|
-
import * as
|
|
3186
|
+
import * as path4 from "node:path";
|
|
2719
3187
|
var BRIDGE_TEXT_CAP = 360;
|
|
2720
3188
|
var BRIDGE_OUTPUT_CAP = 4096;
|
|
2721
3189
|
function compactText(value, cap = BRIDGE_TEXT_CAP) {
|
|
@@ -2822,8 +3290,8 @@ function installSubagentEventBridge(opts) {
|
|
|
2822
3290
|
if (e.event.type !== "file_changed") return;
|
|
2823
3291
|
const rawPath = e.event.path ?? (typeof e.event.data?.["path"] === "string" ? e.event.data["path"] : void 0);
|
|
2824
3292
|
if (!rawPath) return;
|
|
2825
|
-
const filePath =
|
|
2826
|
-
|
|
3293
|
+
const filePath = path4.normalize(
|
|
3294
|
+
path4.isAbsolute(rawPath) ? rawPath : path4.resolve(projectRoot, rawPath)
|
|
2827
3295
|
);
|
|
2828
3296
|
hostEvents.emit("file.activity", {
|
|
2829
3297
|
filePath,
|
|
@@ -3121,8 +3589,8 @@ function createHostSubagentFactory(config, host) {
|
|
|
3121
3589
|
availabilityNotice = `${message} This protected system role may continue, but should minimize non-urgent work.`;
|
|
3122
3590
|
}
|
|
3123
3591
|
}
|
|
3124
|
-
const assignedCheckout = subCfg.cwd &&
|
|
3125
|
-
let subCwd = projectCfg?.cwd ?
|
|
3592
|
+
const assignedCheckout = subCfg.cwd && path5.isAbsolute(subCfg.cwd) ? subCfg.cwd : host.deps.projectRoot;
|
|
3593
|
+
let subCwd = projectCfg?.cwd ? path5.resolve(assignedCheckout, projectCfg.cwd) : effectiveCfg.cwd ?? host.deps.cwd;
|
|
3126
3594
|
if (projectCfg?.cwd && !isInsideDirectory(assignedCheckout, subCwd)) {
|
|
3127
3595
|
throw new Error(
|
|
3128
3596
|
`Agent "${effectiveCfg.role ?? effectiveCfg.name}" cwd escapes its assigned checkout.`
|
|
@@ -3260,6 +3728,7 @@ ${audienceMemory.map((text) => `- ${text}`).join("\n")}`
|
|
|
3260
3728
|
});
|
|
3261
3729
|
installDesignStudioMiddleware({ pipelines, ctx });
|
|
3262
3730
|
installSubagentAutoCompaction(pipelines, ctx, config.context, events);
|
|
3731
|
+
host.deps.installToolBoundary?.(pipelines);
|
|
3263
3732
|
const agent = new Agent({
|
|
3264
3733
|
container: host.deps.container,
|
|
3265
3734
|
tools: baseRegistry,
|
|
@@ -3638,7 +4107,7 @@ function createHostStatusBroadcaster(input) {
|
|
|
3638
4107
|
|
|
3639
4108
|
// src/fleet/host-director-builder.ts
|
|
3640
4109
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
3641
|
-
import * as
|
|
4110
|
+
import * as path6 from "node:path";
|
|
3642
4111
|
import {
|
|
3643
4112
|
DEFAULT_MAX_FLEET_SPAWNS,
|
|
3644
4113
|
FleetManager,
|
|
@@ -3670,7 +4139,7 @@ function prepareHostDirectorRuntime(input) {
|
|
|
3670
4139
|
const fleetLifecycle = config.fleet?.lifecycle;
|
|
3671
4140
|
const configuredIdleTimeoutMs = opts.subagentIdleTimeoutMs ?? fleetLifecycle?.idleTimeoutMs;
|
|
3672
4141
|
const subagentIdleTimeoutMs = typeof configuredIdleTimeoutMs === "number" && Number.isFinite(configuredIdleTimeoutMs) && configuredIdleTimeoutMs >= 0 ? configuredIdleTimeoutMs : 3e5;
|
|
3673
|
-
const defaultScratchpad = opts.sharedScratchpadPath || (opts.sessionsRoot && opts.directorRunId ?
|
|
4142
|
+
const defaultScratchpad = opts.sharedScratchpadPath || (opts.sessionsRoot && opts.directorRunId ? path6.join(opts.sessionsRoot, opts.directorRunId, "shared") : void 0);
|
|
3674
4143
|
const worktreePolicy = resolveFleetWorktreePolicy(config);
|
|
3675
4144
|
const worktrees = worktreePolicy.enabled === false || worktreePolicy.mode === "off" ? void 0 : new WorktreeManager2({
|
|
3676
4145
|
projectRoot: deps.projectRoot,
|
|
@@ -4553,7 +5022,8 @@ function setupBrainAndOrchestration(deps) {
|
|
|
4553
5022
|
maxConcurrent,
|
|
4554
5023
|
effectiveMaxContextRef,
|
|
4555
5024
|
mcpRegistry,
|
|
4556
|
-
sessResult
|
|
5025
|
+
sessResult,
|
|
5026
|
+
installToolBoundary
|
|
4557
5027
|
} = deps;
|
|
4558
5028
|
const profileConfigPath = activeProfileConfigPath(wpaths, config);
|
|
4559
5029
|
const brainCfg = resolveBrainConfigDefaults(config.brain, {
|
|
@@ -4739,7 +5209,8 @@ function setupBrainAndOrchestration(deps) {
|
|
|
4739
5209
|
projectRoot,
|
|
4740
5210
|
cwd,
|
|
4741
5211
|
skillLoader,
|
|
4742
|
-
secretScrubber: container.resolve(TOKENS6.SecretScrubber)
|
|
5212
|
+
secretScrubber: container.resolve(TOKENS6.SecretScrubber),
|
|
5213
|
+
...installToolBoundary ? { installToolBoundary } : {}
|
|
4743
5214
|
},
|
|
4744
5215
|
{
|
|
4745
5216
|
manifestPath,
|
|
@@ -4860,9 +5331,9 @@ import { FLEET_ROSTER as FLEET_ROSTER3 } from "@wrongstack/core/coordination";
|
|
|
4860
5331
|
import { SddRunRegistry } from "@wrongstack/sdd";
|
|
4861
5332
|
|
|
4862
5333
|
// src/services/statusline-config.ts
|
|
4863
|
-
import * as
|
|
5334
|
+
import * as fs2 from "node:fs/promises";
|
|
4864
5335
|
import * as os from "node:os";
|
|
4865
|
-
import * as
|
|
5336
|
+
import * as path7 from "node:path";
|
|
4866
5337
|
import { atomicWrite, resolveWstackPaths } from "@wrongstack/core/utils";
|
|
4867
5338
|
import { ERROR_CODES, FsError } from "@wrongstack/core/types";
|
|
4868
5339
|
import { toErrorMessage as toErrorMessage3 } from "@wrongstack/core/utils";
|
|
@@ -4934,7 +5405,7 @@ function isMissingKnownStatuslineKeys(value) {
|
|
|
4934
5405
|
}
|
|
4935
5406
|
async function loadStatuslineConfig() {
|
|
4936
5407
|
try {
|
|
4937
|
-
const raw = await
|
|
5408
|
+
const raw = await fs2.readFile(resolveConfigPath(), "utf8");
|
|
4938
5409
|
return normalizeStatuslineConfig(JSON.parse(raw));
|
|
4939
5410
|
} catch {
|
|
4940
5411
|
return { ...DEFAULTS };
|
|
@@ -4942,7 +5413,7 @@ async function loadStatuslineConfig() {
|
|
|
4942
5413
|
}
|
|
4943
5414
|
async function ensureStatuslineConfig() {
|
|
4944
5415
|
try {
|
|
4945
|
-
const raw = await
|
|
5416
|
+
const raw = await fs2.readFile(resolveConfigPath(), "utf8");
|
|
4946
5417
|
const parsed = JSON.parse(raw);
|
|
4947
5418
|
const config = normalizeStatuslineConfig(parsed);
|
|
4948
5419
|
if (isMissingKnownStatuslineKeys(parsed)) await saveStatuslineConfig(config);
|
|
@@ -4959,7 +5430,7 @@ async function ensureStatuslineConfig() {
|
|
|
4959
5430
|
async function saveStatuslineConfig(config) {
|
|
4960
5431
|
const configPath = resolveConfigPath();
|
|
4961
5432
|
try {
|
|
4962
|
-
await
|
|
5433
|
+
await fs2.mkdir(path7.dirname(configPath), { recursive: true });
|
|
4963
5434
|
await atomicWrite(configPath, JSON.stringify(config, null, 2));
|
|
4964
5435
|
} catch (error) {
|
|
4965
5436
|
throw new FsError({
|
|
@@ -5146,7 +5617,7 @@ async function spawnAgent(director, role, task, maxIterations) {
|
|
|
5146
5617
|
}
|
|
5147
5618
|
|
|
5148
5619
|
// src/wiring/dep-watcher.ts
|
|
5149
|
-
import * as
|
|
5620
|
+
import * as path8 from "node:path";
|
|
5150
5621
|
import { startTechStackConsumer } from "@wrongstack/core/coordination";
|
|
5151
5622
|
import {
|
|
5152
5623
|
getSharedProjectMailbox as getSharedProjectMailbox6,
|
|
@@ -5157,7 +5628,7 @@ function setupDepWatcherConsumers(deps) {
|
|
|
5157
5628
|
let techStackConsumerDispose;
|
|
5158
5629
|
if (dwCfg?.["enabled"] === true) {
|
|
5159
5630
|
try {
|
|
5160
|
-
const projectDir =
|
|
5631
|
+
const projectDir = path8.join(globalRoot, "projects", projectSlug);
|
|
5161
5632
|
const tsMailbox = getSharedProjectMailbox6(projectDir, events);
|
|
5162
5633
|
const fileAuthorOpts = {
|
|
5163
5634
|
storageDir: projectDir,
|
|
@@ -5190,7 +5661,7 @@ function setupDepWatcherConsumers(deps) {
|
|
|
5190
5661
|
let pkgOutdatedDispose;
|
|
5191
5662
|
if (dwCfg?.["enabled"] === true) {
|
|
5192
5663
|
try {
|
|
5193
|
-
const projectDir =
|
|
5664
|
+
const projectDir = path8.join(globalRoot, "projects", projectSlug);
|
|
5194
5665
|
const pkgMailbox = getSharedProjectMailbox6(projectDir, events);
|
|
5195
5666
|
const pkgTrackerOpts = {
|
|
5196
5667
|
storageDir: projectDir,
|
|
@@ -5233,7 +5704,7 @@ function setupDepWatcherConsumers(deps) {
|
|
|
5233
5704
|
}
|
|
5234
5705
|
|
|
5235
5706
|
// src/wiring/dep-watcher-bridge.ts
|
|
5236
|
-
import * as
|
|
5707
|
+
import * as path9 from "node:path";
|
|
5237
5708
|
import {
|
|
5238
5709
|
attachDepWatcherBridge,
|
|
5239
5710
|
getSharedProjectMailbox as getSharedProjectMailbox7
|
|
@@ -5245,7 +5716,7 @@ function setupDepWatcherBridge(deps) {
|
|
|
5245
5716
|
let depWatcherDispose;
|
|
5246
5717
|
if (dwCfg?.["enabled"] === true) {
|
|
5247
5718
|
try {
|
|
5248
|
-
const projectDir =
|
|
5719
|
+
const projectDir = path9.join(wpaths.globalRoot, "projects", wpaths.projectSlug);
|
|
5249
5720
|
const dwMailbox = getSharedProjectMailbox7(projectDir, events);
|
|
5250
5721
|
depWatcherDispose = attachDepWatcherBridge({
|
|
5251
5722
|
events,
|
|
@@ -5269,7 +5740,7 @@ function setupDepWatcherBridge(deps) {
|
|
|
5269
5740
|
}
|
|
5270
5741
|
|
|
5271
5742
|
// src/wiring/director-setup.ts
|
|
5272
|
-
import * as
|
|
5743
|
+
import * as path10 from "node:path";
|
|
5273
5744
|
import { expectDefined as expectDefined2 } from "@wrongstack/core/utils";
|
|
5274
5745
|
import { createAgentMonitorService } from "@wrongstack/core/coordination";
|
|
5275
5746
|
import { sessionScopedPath as sessionScopedPath2 } from "@wrongstack/core/utils";
|
|
@@ -5310,15 +5781,15 @@ function setupDirectorAndAutonomy(deps) {
|
|
|
5310
5781
|
}
|
|
5311
5782
|
};
|
|
5312
5783
|
const fleetRoot = directorMode ? sessionScopedPath2(wpaths.projectSessions, session.id, "") : void 0;
|
|
5313
|
-
const manifestPath = directorMode ? typeof process.env["WRONGSTACK_FLEET_MANIFEST"] === "string" ? process.env["WRONGSTACK_FLEET_MANIFEST"] :
|
|
5314
|
-
const sharedScratchpadPath = directorMode ?
|
|
5315
|
-
const subagentSessionsRoot = directorMode ?
|
|
5316
|
-
const stateCheckpointPath = directorMode ?
|
|
5784
|
+
const manifestPath = directorMode ? typeof process.env["WRONGSTACK_FLEET_MANIFEST"] === "string" ? process.env["WRONGSTACK_FLEET_MANIFEST"] : path10.join(expectDefined2(fleetRoot), "fleet.json") : void 0;
|
|
5785
|
+
const sharedScratchpadPath = directorMode ? path10.join(expectDefined2(fleetRoot), "shared") : void 0;
|
|
5786
|
+
const subagentSessionsRoot = directorMode ? path10.join(expectDefined2(fleetRoot), "subagents") : void 0;
|
|
5787
|
+
const stateCheckpointPath = directorMode ? path10.join(expectDefined2(fleetRoot), "director-state.json") : void 0;
|
|
5317
5788
|
const fleetRootForPromotion = sessionScopedPath2(wpaths.projectSessions, session.id, "");
|
|
5318
5789
|
const agentMonitor = createAgentMonitorService({
|
|
5319
5790
|
events,
|
|
5320
5791
|
sessionId: session.id,
|
|
5321
|
-
transcriptsDir:
|
|
5792
|
+
transcriptsDir: path10.join(fleetRootForPromotion, "subagents", "transcripts"),
|
|
5322
5793
|
maxEntriesPerAgent: 500,
|
|
5323
5794
|
streamEnabled: false
|
|
5324
5795
|
});
|
|
@@ -5403,12 +5874,14 @@ function createEternalCommandHandlers(input) {
|
|
|
5403
5874
|
}
|
|
5404
5875
|
|
|
5405
5876
|
// src/wiring/fleet-command-handlers.ts
|
|
5406
|
-
import
|
|
5407
|
-
import * as
|
|
5408
|
-
import
|
|
5409
|
-
import {
|
|
5877
|
+
import { createReadStream } from "node:fs";
|
|
5878
|
+
import * as fs3 from "node:fs/promises";
|
|
5879
|
+
import * as path11 from "node:path";
|
|
5880
|
+
import { createInterface } from "node:readline";
|
|
5410
5881
|
import { FLEET_ROSTER as FLEET_ROSTER4 } from "@wrongstack/core/coordination";
|
|
5411
5882
|
import { loadDirectorState } from "@wrongstack/core/storage";
|
|
5883
|
+
import { AgentError as AgentError3 } from "@wrongstack/core/types";
|
|
5884
|
+
import { color as color6, expectDefined as expectDefined3 } from "@wrongstack/core/utils";
|
|
5412
5885
|
function createFleetCommandHandlers(input) {
|
|
5413
5886
|
return {
|
|
5414
5887
|
onSpawn: async (description, options) => {
|
|
@@ -5622,8 +6095,9 @@ async function killFleet2(director) {
|
|
|
5622
6095
|
}
|
|
5623
6096
|
return killed;
|
|
5624
6097
|
}
|
|
6098
|
+
var MAX_INLINE_RAW_TRANSCRIPT_BYTES = 2 * 1024 * 1024;
|
|
5625
6099
|
async function readFleetLog(fleetRoot, subagentId, mode) {
|
|
5626
|
-
const transcripts = await findTranscripts(
|
|
6100
|
+
const transcripts = await findTranscripts(path11.join(fleetRoot, "subagents"));
|
|
5627
6101
|
if (transcripts === null) {
|
|
5628
6102
|
return "No fleet transcripts on disk \u2014 no subagents have been spawned for this session.";
|
|
5629
6103
|
}
|
|
@@ -5650,30 +6124,39 @@ async function readFleetLog(fleetRoot, subagentId, mode) {
|
|
|
5650
6124
|
].join("\n");
|
|
5651
6125
|
}
|
|
5652
6126
|
const transcript = expectDefined3(matches[0]);
|
|
5653
|
-
|
|
5654
|
-
|
|
6127
|
+
if (mode === "raw") {
|
|
6128
|
+
if (transcript.size > MAX_INLINE_RAW_TRANSCRIPT_BYTES) {
|
|
6129
|
+
return [
|
|
6130
|
+
`Transcript is ${(transcript.size / 1024 / 1024).toFixed(1)} MiB; refusing to load it into chat history.`,
|
|
6131
|
+
`Read it directly from: ${transcript.file}`,
|
|
6132
|
+
`Inline raw limit: ${MAX_INLINE_RAW_TRANSCRIPT_BYTES / 1024 / 1024} MiB.`
|
|
6133
|
+
].join("\n");
|
|
6134
|
+
}
|
|
6135
|
+
return fs3.readFile(transcript.file, "utf8");
|
|
6136
|
+
}
|
|
6137
|
+
return summarizeTranscript(transcript);
|
|
5655
6138
|
}
|
|
5656
6139
|
async function findTranscripts(root) {
|
|
5657
6140
|
let runIds;
|
|
5658
6141
|
try {
|
|
5659
|
-
runIds = await
|
|
6142
|
+
runIds = await fs3.readdir(root);
|
|
5660
6143
|
} catch {
|
|
5661
6144
|
return null;
|
|
5662
6145
|
}
|
|
5663
6146
|
const byRun = await Promise.all(
|
|
5664
6147
|
runIds.map(async (runId) => {
|
|
5665
|
-
const directory =
|
|
6148
|
+
const directory = path11.join(root, runId);
|
|
5666
6149
|
let files;
|
|
5667
6150
|
try {
|
|
5668
|
-
files = await
|
|
6151
|
+
files = await fs3.readdir(directory);
|
|
5669
6152
|
} catch {
|
|
5670
6153
|
return [];
|
|
5671
6154
|
}
|
|
5672
6155
|
const found = await Promise.all(
|
|
5673
6156
|
files.filter((file) => file.endsWith(".jsonl")).map(async (file) => {
|
|
5674
|
-
const fullPath =
|
|
6157
|
+
const fullPath = path11.join(directory, file);
|
|
5675
6158
|
try {
|
|
5676
|
-
const stat5 = await
|
|
6159
|
+
const stat5 = await fs3.stat(fullPath);
|
|
5677
6160
|
return {
|
|
5678
6161
|
runId,
|
|
5679
6162
|
subagentId: file.replace(/\.jsonl$/, ""),
|
|
@@ -5690,35 +6173,52 @@ async function findTranscripts(root) {
|
|
|
5690
6173
|
);
|
|
5691
6174
|
return byRun.flat();
|
|
5692
6175
|
}
|
|
5693
|
-
function summarizeTranscript(transcript
|
|
5694
|
-
const lines = raw.split("\n").filter((line) => line.trim());
|
|
6176
|
+
async function summarizeTranscript(transcript) {
|
|
5695
6177
|
const counts = {};
|
|
5696
6178
|
const tools = /* @__PURE__ */ new Map();
|
|
5697
6179
|
let firstUser = null;
|
|
5698
6180
|
let lastResponse = null;
|
|
5699
6181
|
let iterations = 0;
|
|
5700
|
-
|
|
6182
|
+
let eventCount = 0;
|
|
6183
|
+
let streamError;
|
|
6184
|
+
const stream = createReadStream(transcript.file, { encoding: "utf8" });
|
|
6185
|
+
const lines = createInterface({ input: stream, crlfDelay: Infinity });
|
|
6186
|
+
try {
|
|
5701
6187
|
try {
|
|
5702
|
-
const
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
6188
|
+
for await (const line of lines) {
|
|
6189
|
+
if (!line.trim()) continue;
|
|
6190
|
+
try {
|
|
6191
|
+
const event = JSON.parse(line);
|
|
6192
|
+
eventCount++;
|
|
6193
|
+
counts[event.type] = (counts[event.type] ?? 0) + 1;
|
|
6194
|
+
if (event.type === "user_input" && !firstUser)
|
|
6195
|
+
firstUser = eventText(event.content).slice(0, 120);
|
|
6196
|
+
if (event.type === "llm_response") {
|
|
6197
|
+
const text = eventText(event.content);
|
|
6198
|
+
if (text) lastResponse = text.slice(0, 240);
|
|
6199
|
+
iterations++;
|
|
6200
|
+
}
|
|
6201
|
+
if (event.type === "tool_use" && event.name) {
|
|
6202
|
+
tools.set(event.name, (tools.get(event.name) ?? 0) + 1);
|
|
6203
|
+
}
|
|
6204
|
+
} catch {
|
|
6205
|
+
}
|
|
5712
6206
|
}
|
|
5713
|
-
} catch {
|
|
6207
|
+
} catch (err) {
|
|
6208
|
+
streamError = err;
|
|
5714
6209
|
}
|
|
6210
|
+
} finally {
|
|
6211
|
+
lines.close();
|
|
6212
|
+
stream.destroy();
|
|
5715
6213
|
}
|
|
6214
|
+
const degradedNote = streamError ? color6.dim(` (summary truncated: ${streamError.message ?? "stream error"})`) : null;
|
|
5716
6215
|
const breakdown = tools.size > 0 ? [...tools.entries()].sort((a, b) => b[1] - a[1]).map(([name, count]) => `${name}\xD7${count}`).join(", ") : "(none)";
|
|
5717
6216
|
const output = [
|
|
5718
6217
|
color6.bold(`Subagent ${transcript.subagentId}`) + color6.dim(` (run ${transcript.runId})`),
|
|
5719
|
-
` ${
|
|
6218
|
+
` ${eventCount} events \xB7 ${iterations} llm iterations \xB7 ${(transcript.size / 1024).toFixed(1)} KB`,
|
|
5720
6219
|
` tools: ${breakdown}`
|
|
5721
6220
|
];
|
|
6221
|
+
if (degradedNote) output.push(degradedNote);
|
|
5722
6222
|
if (firstUser) output.push("", color6.dim(" task:"), ` ${firstUser}`);
|
|
5723
6223
|
if (lastResponse) output.push("", color6.dim(" last response:"), ` ${lastResponse}`);
|
|
5724
6224
|
output.push("", color6.dim(" event mix:"));
|
|
@@ -5738,7 +6238,7 @@ function eventText(content) {
|
|
|
5738
6238
|
async function retryInterruptedTasks(input, taskId) {
|
|
5739
6239
|
const director = await input.multiAgentHost.ensureDirector();
|
|
5740
6240
|
if (!director) return "Director is not available.";
|
|
5741
|
-
const prior = await loadDirectorState(
|
|
6241
|
+
const prior = await loadDirectorState(path11.join(input.fleetRoot, "director-state.json"));
|
|
5742
6242
|
if (!prior) return "No prior director-state.json found \u2014 nothing to retry.";
|
|
5743
6243
|
const interrupted = prior.tasks.filter(
|
|
5744
6244
|
(task) => task.status === "running" || task.status === "pending"
|
|
@@ -5795,7 +6295,7 @@ async function retryInterruptedTasks(input, taskId) {
|
|
|
5795
6295
|
}
|
|
5796
6296
|
|
|
5797
6297
|
// src/wiring/hq-telemetry.ts
|
|
5798
|
-
import * as
|
|
6298
|
+
import * as path12 from "node:path";
|
|
5799
6299
|
import {
|
|
5800
6300
|
startBrainTelemetryBridge,
|
|
5801
6301
|
startCostTelemetryBridge,
|
|
@@ -5804,6 +6304,97 @@ import {
|
|
|
5804
6304
|
startToolTelemetryBridge,
|
|
5805
6305
|
startWorktreeTelemetryBridge
|
|
5806
6306
|
} from "@wrongstack/core/hq";
|
|
6307
|
+
|
|
6308
|
+
// src/governance-hq-telemetry.ts
|
|
6309
|
+
import {
|
|
6310
|
+
readGovernanceDaemonOperatorStatus
|
|
6311
|
+
} from "@wrongstack/runtime/governance-bootstrap";
|
|
6312
|
+
var GOVERNANCE_HQ_SNAPSHOT_INTERVAL_MS = 15e3;
|
|
6313
|
+
function unavailableAction(code) {
|
|
6314
|
+
return code === "broker_missing" ? "observe" : "investigate";
|
|
6315
|
+
}
|
|
6316
|
+
function projectGovernanceHqSnapshot(projectId, observedAt, result) {
|
|
6317
|
+
if (!result.available) {
|
|
6318
|
+
return {
|
|
6319
|
+
schemaVersion: 1,
|
|
6320
|
+
projectId,
|
|
6321
|
+
observedAt,
|
|
6322
|
+
available: false,
|
|
6323
|
+
signal: {
|
|
6324
|
+
level: "unavailable",
|
|
6325
|
+
code: result.code,
|
|
6326
|
+
operatorAction: unavailableAction(result.code),
|
|
6327
|
+
executionDisposition: "continue"
|
|
6328
|
+
}
|
|
6329
|
+
};
|
|
6330
|
+
}
|
|
6331
|
+
const status = result.status;
|
|
6332
|
+
return {
|
|
6333
|
+
schemaVersion: 1,
|
|
6334
|
+
projectId,
|
|
6335
|
+
observedAt,
|
|
6336
|
+
available: true,
|
|
6337
|
+
signal: {
|
|
6338
|
+
level: status.signal.level,
|
|
6339
|
+
code: status.signal.code,
|
|
6340
|
+
operatorAction: status.signal.operatorAction,
|
|
6341
|
+
executionDisposition: "continue"
|
|
6342
|
+
},
|
|
6343
|
+
daemon: { pid: status.pid, startedAt: status.startedAt },
|
|
6344
|
+
attachmentBroker: status.attachmentBroker === null ? null : {
|
|
6345
|
+
state: status.attachmentBroker.state,
|
|
6346
|
+
health: status.attachmentBroker.health,
|
|
6347
|
+
consecutiveFailures: status.attachmentBroker.consecutiveFailures,
|
|
6348
|
+
pendingRevocations: status.attachmentBroker.pendingRevocations,
|
|
6349
|
+
auditHealthy: status.attachmentBroker.auditHealthy,
|
|
6350
|
+
...status.attachmentBroker.expiresAt ? { expiresAt: status.attachmentBroker.expiresAt } : {},
|
|
6351
|
+
...status.attachmentBroker.nextActionAt ? { nextActionAt: status.attachmentBroker.nextActionAt } : {}
|
|
6352
|
+
}
|
|
6353
|
+
};
|
|
6354
|
+
}
|
|
6355
|
+
function startGovernanceHqTelemetry(options) {
|
|
6356
|
+
const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
|
|
6357
|
+
const readStatus = options.readStatus ?? readGovernanceDaemonOperatorStatus;
|
|
6358
|
+
let stopped = false;
|
|
6359
|
+
let inFlight = false;
|
|
6360
|
+
const publish = async () => {
|
|
6361
|
+
if (stopped || inFlight) return;
|
|
6362
|
+
inFlight = true;
|
|
6363
|
+
try {
|
|
6364
|
+
let result;
|
|
6365
|
+
try {
|
|
6366
|
+
result = await readStatus(options.projectRoot);
|
|
6367
|
+
} catch {
|
|
6368
|
+
result = {
|
|
6369
|
+
available: false,
|
|
6370
|
+
code: "connection_failed",
|
|
6371
|
+
message: "Governance status reader failed."
|
|
6372
|
+
};
|
|
6373
|
+
}
|
|
6374
|
+
if (stopped) return;
|
|
6375
|
+
const payload = projectGovernanceHqSnapshot(
|
|
6376
|
+
options.publisher.project.projectId,
|
|
6377
|
+
now(),
|
|
6378
|
+
result
|
|
6379
|
+
);
|
|
6380
|
+
options.publisher.publishEvent({ type: "governance.snapshot", payload });
|
|
6381
|
+
} finally {
|
|
6382
|
+
inFlight = false;
|
|
6383
|
+
}
|
|
6384
|
+
};
|
|
6385
|
+
void publish();
|
|
6386
|
+
const timer = setInterval(
|
|
6387
|
+
() => void publish(),
|
|
6388
|
+
options.intervalMs ?? GOVERNANCE_HQ_SNAPSHOT_INTERVAL_MS
|
|
6389
|
+
);
|
|
6390
|
+
timer.unref?.();
|
|
6391
|
+
return () => {
|
|
6392
|
+
stopped = true;
|
|
6393
|
+
clearInterval(timer);
|
|
6394
|
+
};
|
|
6395
|
+
}
|
|
6396
|
+
|
|
6397
|
+
// src/wiring/hq-telemetry.ts
|
|
5807
6398
|
function setupHqTelemetry(deps) {
|
|
5808
6399
|
const {
|
|
5809
6400
|
events,
|
|
@@ -5833,7 +6424,7 @@ function setupHqTelemetry(deps) {
|
|
|
5833
6424
|
const hqConnection = startCliHqConnection({
|
|
5834
6425
|
clientKind: tuiOwnsScreen ? "tui" : "cli",
|
|
5835
6426
|
projectRoot,
|
|
5836
|
-
projectName:
|
|
6427
|
+
projectName: path12.basename(projectRoot),
|
|
5837
6428
|
appConfig: config,
|
|
5838
6429
|
onCommand: hqOnCommand,
|
|
5839
6430
|
capabilities: [
|
|
@@ -5860,7 +6451,7 @@ function setupHqTelemetry(deps) {
|
|
|
5860
6451
|
events,
|
|
5861
6452
|
sessionId: session.id,
|
|
5862
6453
|
projectRoot,
|
|
5863
|
-
projectName:
|
|
6454
|
+
projectName: path12.basename(projectRoot),
|
|
5864
6455
|
globalRoot,
|
|
5865
6456
|
writer: session,
|
|
5866
6457
|
// biome-ignore lint/suspicious/noExplicitAny: initialAgents shape
|
|
@@ -5880,6 +6471,10 @@ function setupHqTelemetry(deps) {
|
|
|
5880
6471
|
);
|
|
5881
6472
|
} catch {
|
|
5882
6473
|
}
|
|
6474
|
+
try {
|
|
6475
|
+
stopHqAuxBridges.push(startGovernanceHqTelemetry({ publisher, projectRoot }));
|
|
6476
|
+
} catch {
|
|
6477
|
+
}
|
|
5883
6478
|
try {
|
|
5884
6479
|
publisher.publishEvent({
|
|
5885
6480
|
type: "mcp.health.snapshot",
|
|
@@ -5976,7 +6571,7 @@ function setupHqTelemetry(deps) {
|
|
|
5976
6571
|
}
|
|
5977
6572
|
|
|
5978
6573
|
// src/wiring/lifecycle-plugins.ts
|
|
5979
|
-
import * as
|
|
6574
|
+
import * as path15 from "node:path";
|
|
5980
6575
|
import { getSharedProjectMailbox as getSharedProjectMailbox8 } from "@wrongstack/core/coordination";
|
|
5981
6576
|
import { countShellHooks, HookRegistry, HookRunner, shellHooksEqual } from "@wrongstack/core/hooks";
|
|
5982
6577
|
import { allServers } from "@wrongstack/core/infrastructure";
|
|
@@ -6051,8 +6646,8 @@ function installDesignStudio(deps) {
|
|
|
6051
6646
|
|
|
6052
6647
|
// src/wiring/metrics.ts
|
|
6053
6648
|
import { constants as fsConstants, writeFileSync } from "node:fs";
|
|
6054
|
-
import * as
|
|
6055
|
-
import * as
|
|
6649
|
+
import * as fs4 from "node:fs/promises";
|
|
6650
|
+
import * as path13 from "node:path";
|
|
6056
6651
|
import {
|
|
6057
6652
|
DefaultHealthRegistry,
|
|
6058
6653
|
InMemoryMetricsSink,
|
|
@@ -6198,7 +6793,7 @@ function setupMetrics(params) {
|
|
|
6198
6793
|
name: "session-store",
|
|
6199
6794
|
check: async () => {
|
|
6200
6795
|
try {
|
|
6201
|
-
await
|
|
6796
|
+
await fs4.access(wpaths.projectSessions, fsConstants.R_OK | fsConstants.W_OK);
|
|
6202
6797
|
return { status: "healthy" };
|
|
6203
6798
|
} catch {
|
|
6204
6799
|
return { status: "unhealthy", detail: "session storage is not readable and writable" };
|
|
@@ -6209,7 +6804,7 @@ function setupMetrics(params) {
|
|
|
6209
6804
|
name: "project-storage",
|
|
6210
6805
|
check: async () => {
|
|
6211
6806
|
try {
|
|
6212
|
-
await
|
|
6807
|
+
await fs4.access(wpaths.projectDir, fsConstants.R_OK | fsConstants.W_OK);
|
|
6213
6808
|
return { status: "healthy" };
|
|
6214
6809
|
} catch {
|
|
6215
6810
|
return { status: "unhealthy", detail: "project storage is not readable and writable" };
|
|
@@ -6223,7 +6818,7 @@ function setupMetrics(params) {
|
|
|
6223
6818
|
const dumpMetrics = () => {
|
|
6224
6819
|
if (!metricsSink) return;
|
|
6225
6820
|
try {
|
|
6226
|
-
const out =
|
|
6821
|
+
const out = path13.join(wpaths.projectSessions, "metrics.json");
|
|
6227
6822
|
const snap = metricsSink.snapshot();
|
|
6228
6823
|
writeFileSync(out, JSON.stringify(snap, null, 2));
|
|
6229
6824
|
} catch {
|
|
@@ -6271,11 +6866,11 @@ import { wstackGlobalRoot as wstackGlobalRoot2 } from "@wrongstack/core/utils";
|
|
|
6271
6866
|
|
|
6272
6867
|
// src/mailbox-bridge-bootstrap.ts
|
|
6273
6868
|
import { spawn as spawn2 } from "node:child_process";
|
|
6274
|
-
import * as
|
|
6869
|
+
import * as path14 from "node:path";
|
|
6275
6870
|
import { readLiveLock } from "@wrongstack/core/coordination";
|
|
6276
6871
|
var MAILBOX_BRIDGE_BOOTSTRAP_TIMEOUT_MS = 5e3;
|
|
6277
6872
|
async function tryAcquireMailboxBridge(opts) {
|
|
6278
|
-
const lockPath =
|
|
6873
|
+
const lockPath = path14.join(opts.projectDir, ".mailbox-bridge.lock");
|
|
6279
6874
|
const spawnFn = opts.spawnFn ?? defaultSpawn;
|
|
6280
6875
|
const existing = await readLiveLock(opts.projectDir);
|
|
6281
6876
|
if (existing.kind === "live") {
|
|
@@ -6714,7 +7309,7 @@ async function setupLifecycleAndPlugins(deps) {
|
|
|
6714
7309
|
});
|
|
6715
7310
|
agent.extensions.register(createLifecycleHooksExtension(hookRunner));
|
|
6716
7311
|
const mcpTokenStore = new MCPVaultTokenStore(
|
|
6717
|
-
|
|
7312
|
+
path15.join(wpaths.projectDir, "mcp-auth.json"),
|
|
6718
7313
|
vault
|
|
6719
7314
|
);
|
|
6720
7315
|
const mcpAuthorizationManager = new MCPAuthorizationManager({ store: mcpTokenStore });
|
|
@@ -6810,7 +7405,7 @@ async function setupLifecycleAndPlugins(deps) {
|
|
|
6810
7405
|
}
|
|
6811
7406
|
|
|
6812
7407
|
// src/wiring/management-tools.ts
|
|
6813
|
-
import * as
|
|
7408
|
+
import * as fs5 from "node:fs/promises";
|
|
6814
7409
|
import { createFallbackManageTools, createPluginManagerTool } from "@wrongstack/core/tools";
|
|
6815
7410
|
function registerCliManagementTools({
|
|
6816
7411
|
toolRegistry,
|
|
@@ -6821,23 +7416,23 @@ function registerCliManagementTools({
|
|
|
6821
7416
|
const fallbackManageTools = createFallbackManageTools({
|
|
6822
7417
|
getConfig: () => configStore.get(),
|
|
6823
7418
|
updateConfig: async (mutate) => {
|
|
6824
|
-
const raw = await
|
|
7419
|
+
const raw = await fs5.readFile(profileConfigPath, "utf8").catch(() => "{}");
|
|
6825
7420
|
const parsed = JSON.parse(raw);
|
|
6826
7421
|
mutate(parsed);
|
|
6827
|
-
await
|
|
7422
|
+
await fs5.writeFile(profileConfigPath, JSON.stringify(parsed, null, 2), { mode: 384 });
|
|
6828
7423
|
configStore.update(parsed);
|
|
6829
7424
|
},
|
|
6830
7425
|
// Interactive key entry for REPL mode reads a line from stdin without echo.
|
|
6831
7426
|
...stdinInteractive ? {
|
|
6832
7427
|
requestInput: async (prompt) => {
|
|
6833
|
-
const { createInterface } = await import("node:readline");
|
|
6834
|
-
const rl =
|
|
6835
|
-
return new Promise((
|
|
7428
|
+
const { createInterface: createInterface2 } = await import("node:readline");
|
|
7429
|
+
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
7430
|
+
return new Promise((resolve8) => {
|
|
6836
7431
|
rl.question(`
|
|
6837
7432
|
${prompt}
|
|
6838
7433
|
> `, (answer) => {
|
|
6839
7434
|
rl.close();
|
|
6840
|
-
|
|
7435
|
+
resolve8(answer);
|
|
6841
7436
|
});
|
|
6842
7437
|
});
|
|
6843
7438
|
}
|
|
@@ -6883,9 +7478,13 @@ ${prompt}
|
|
|
6883
7478
|
|
|
6884
7479
|
// src/wiring/provider-runtime-setup.ts
|
|
6885
7480
|
import { createFallbackModelExtension as createFallbackModelExtension2 } from "@wrongstack/core/agent";
|
|
7481
|
+
import {
|
|
7482
|
+
readProviderSnapshot,
|
|
7483
|
+
SessionMemoryConsolidator,
|
|
7484
|
+
watchProviderConfig
|
|
7485
|
+
} from "@wrongstack/core/storage";
|
|
6886
7486
|
import { withCatalogCapabilities as withCatalogCapabilities2 } from "@wrongstack/providers";
|
|
6887
7487
|
import { getSageService } from "@wrongstack/sage";
|
|
6888
|
-
import { readProviderSnapshot, SessionMemoryConsolidator, watchProviderConfig } from "@wrongstack/core/storage";
|
|
6889
7488
|
function serializeProviderRuntimeSnapshot(snapshot) {
|
|
6890
7489
|
return JSON.stringify(snapshot);
|
|
6891
7490
|
}
|
|
@@ -6985,6 +7584,7 @@ function setupProviderRuntime(deps) {
|
|
|
6985
7584
|
});
|
|
6986
7585
|
const ROUTING_FIELDS = [
|
|
6987
7586
|
"fallbackModels",
|
|
7587
|
+
"fallbackBridge",
|
|
6988
7588
|
"fallbackProfiles",
|
|
6989
7589
|
"favoriteModels",
|
|
6990
7590
|
"favoriteModelsOnly",
|
|
@@ -7021,6 +7621,7 @@ function setupProviderRuntime(deps) {
|
|
|
7021
7621
|
...snap.apiKey !== void 0 ? { apiKey: snap.apiKey } : merged.apiKey !== void 0 ? { apiKey: merged.apiKey } : {},
|
|
7022
7622
|
...snap.baseUrl !== void 0 ? { baseUrl: snap.baseUrl } : merged.baseUrl !== void 0 ? { baseUrl: merged.baseUrl } : {},
|
|
7023
7623
|
...snap.fallbackModels !== void 0 ? { fallbackModels: snap.fallbackModels } : merged.fallbackModels !== void 0 ? { fallbackModels: merged.fallbackModels } : {},
|
|
7624
|
+
...snap.fallbackBridge !== void 0 ? { fallbackBridge: snap.fallbackBridge } : merged.fallbackBridge !== void 0 ? { fallbackBridge: merged.fallbackBridge } : {},
|
|
7024
7625
|
...snap.fallbackProfiles !== void 0 ? { fallbackProfiles: snap.fallbackProfiles } : merged.fallbackProfiles !== void 0 ? { fallbackProfiles: merged.fallbackProfiles } : {},
|
|
7025
7626
|
...snap.favoriteModels !== void 0 ? { favoriteModels: snap.favoriteModels } : merged.favoriteModels !== void 0 ? { favoriteModels: merged.favoriteModels } : {},
|
|
7026
7627
|
...snap.favoriteModelsOnly !== void 0 ? { favoriteModelsOnly: snap.favoriteModelsOnly } : merged.favoriteModelsOnly !== void 0 ? { favoriteModelsOnly: merged.favoriteModelsOnly } : {},
|
|
@@ -7092,14 +7693,14 @@ function setupProviderRuntime(deps) {
|
|
|
7092
7693
|
}
|
|
7093
7694
|
|
|
7094
7695
|
// src/wiring/provider-status.ts
|
|
7095
|
-
import * as
|
|
7696
|
+
import * as fs6 from "node:fs/promises";
|
|
7096
7697
|
import { ProviderModelStatusTracker } from "@wrongstack/core/coordination";
|
|
7097
7698
|
import { atomicWrite as atomicWrite2, withFileLock } from "@wrongstack/core/utils";
|
|
7098
7699
|
async function setupProviderStatus(input) {
|
|
7099
7700
|
const tracker = new ProviderModelStatusTracker({ events: input.events });
|
|
7100
7701
|
const statusFile = input.paths.profileProviderStatus(input.paths.profileName);
|
|
7101
7702
|
try {
|
|
7102
|
-
const saved = JSON.parse(await
|
|
7703
|
+
const saved = JSON.parse(await fs6.readFile(statusFile, "utf8"));
|
|
7103
7704
|
const restored = tracker.restoreSnapshot(saved);
|
|
7104
7705
|
if (restored > 0) input.logger.info(`Restored ${restored} provider waiting-room entries`);
|
|
7105
7706
|
} catch (error) {
|
|
@@ -7111,7 +7712,7 @@ async function setupProviderStatus(input) {
|
|
|
7111
7712
|
tracker.sweepExpired();
|
|
7112
7713
|
if (syncRunning) return;
|
|
7113
7714
|
syncRunning = true;
|
|
7114
|
-
void
|
|
7715
|
+
void fs6.readFile(statusFile, "utf8").then((raw) => tracker.restoreSnapshot(JSON.parse(raw))).catch((error) => warnUnlessMissing(input.logger, "sync", error)).finally(() => {
|
|
7115
7716
|
syncRunning = false;
|
|
7116
7717
|
});
|
|
7117
7718
|
}, 3e4);
|
|
@@ -7126,7 +7727,7 @@ async function setupProviderStatus(input) {
|
|
|
7126
7727
|
await withFileLock(statusFile, async () => {
|
|
7127
7728
|
let statuses = [];
|
|
7128
7729
|
try {
|
|
7129
|
-
const current = JSON.parse(await
|
|
7730
|
+
const current = JSON.parse(await fs6.readFile(statusFile, "utf8"));
|
|
7130
7731
|
if (Array.isArray(current.statuses)) statuses = current.statuses;
|
|
7131
7732
|
} catch (error) {
|
|
7132
7733
|
if (error.code !== "ENOENT") throw error;
|
|
@@ -7359,7 +7960,7 @@ function applyLiveSettings(input, settings) {
|
|
|
7359
7960
|
import { getToolDescriptionMode } from "@wrongstack/core/utils";
|
|
7360
7961
|
|
|
7361
7962
|
// src/wiring/codebase-index.ts
|
|
7362
|
-
import * as
|
|
7963
|
+
import * as path16 from "node:path";
|
|
7363
7964
|
import {
|
|
7364
7965
|
cancelPendingReindexes,
|
|
7365
7966
|
enqueueReindex,
|
|
@@ -7405,9 +8006,9 @@ async function setupCodebaseIndexing(deps) {
|
|
|
7405
8006
|
const fp = payload.toolUse.input?.path;
|
|
7406
8007
|
if (typeof fp === "string" && fp.length > 0) {
|
|
7407
8008
|
const activeRoot = payload.ctx.projectRoot;
|
|
7408
|
-
const abs =
|
|
7409
|
-
const rel =
|
|
7410
|
-
const inside = rel !== ".." && !rel.startsWith(`..${
|
|
8009
|
+
const abs = path16.resolve(payload.ctx.cwd, fp);
|
|
8010
|
+
const rel = path16.relative(activeRoot, abs);
|
|
8011
|
+
const inside = rel !== ".." && !rel.startsWith(`..${path16.sep}`) && !path16.isAbsolute(rel);
|
|
7411
8012
|
if (inside && isIndexableFile(abs)) {
|
|
7412
8013
|
enqueueReindex({ projectRoot: activeRoot, files: [abs], debounceMs, onError });
|
|
7413
8014
|
}
|
|
@@ -7464,7 +8065,8 @@ function setupSage(deps) {
|
|
|
7464
8065
|
verifyOnMutation: cfg?.hygiene?.autoOnFileChange,
|
|
7465
8066
|
triggers: cfg?.inject?.triggers,
|
|
7466
8067
|
tracker: injectionTracker,
|
|
7467
|
-
events: deps.events
|
|
8068
|
+
events: deps.events,
|
|
8069
|
+
getSessionId: deps.getSessionId
|
|
7468
8070
|
})
|
|
7469
8071
|
);
|
|
7470
8072
|
}
|
|
@@ -7841,12 +8443,12 @@ function createSddHandlers(deps) {
|
|
|
7841
8443
|
const sddApi = await import("@wrongstack/sdd");
|
|
7842
8444
|
let worktrees;
|
|
7843
8445
|
if (process.env["WRONGSTACK_SDD_WORKTREES"] !== "0") {
|
|
7844
|
-
const inGit = await new Promise((
|
|
8446
|
+
const inGit = await new Promise((resolve8) => {
|
|
7845
8447
|
let resolved = false;
|
|
7846
8448
|
const settle = (v) => {
|
|
7847
8449
|
if (resolved) return;
|
|
7848
8450
|
resolved = true;
|
|
7849
|
-
|
|
8451
|
+
resolve8(v);
|
|
7850
8452
|
};
|
|
7851
8453
|
try {
|
|
7852
8454
|
const child = spawn3("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
@@ -8023,7 +8625,7 @@ function createSddHandlers(deps) {
|
|
|
8023
8625
|
|
|
8024
8626
|
// src/wiring/session.ts
|
|
8025
8627
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
8026
|
-
import * as
|
|
8628
|
+
import * as path17 from "node:path";
|
|
8027
8629
|
import { Context as Context2 } from "@wrongstack/core/agent";
|
|
8028
8630
|
import { ProviderCacheLedger } from "@wrongstack/core/infrastructure";
|
|
8029
8631
|
import {
|
|
@@ -8102,7 +8704,7 @@ async function setupSession(params) {
|
|
|
8102
8704
|
const sessionId = expectDefined4(session?.id, "active session id");
|
|
8103
8705
|
const sessionDir = sessionScopedPath3(wpaths.projectSessions, sessionId, "");
|
|
8104
8706
|
const attachments = new DefaultAttachmentStore({
|
|
8105
|
-
spoolDir:
|
|
8707
|
+
spoolDir: path17.join(sessionDir, "attachments")
|
|
8106
8708
|
});
|
|
8107
8709
|
const ctxSignal = new AbortController().signal;
|
|
8108
8710
|
const traceId = randomBytes2(16).toString("hex");
|
|
@@ -8210,7 +8812,7 @@ async function setupSession(params) {
|
|
|
8210
8812
|
if (resumeId) {
|
|
8211
8813
|
try {
|
|
8212
8814
|
const fleetRoot = sessionDir;
|
|
8213
|
-
dirState = await loadDirectorState2(
|
|
8815
|
+
dirState = await loadDirectorState2(path17.join(fleetRoot, "director-state.json"));
|
|
8214
8816
|
if (dirState) {
|
|
8215
8817
|
const tCounts = {};
|
|
8216
8818
|
for (const t of dirState.tasks) tCounts[t.status] = (tCounts[t.status] ?? 0) + 1;
|
|
@@ -8665,7 +9267,7 @@ async function disposeSession(input) {
|
|
|
8665
9267
|
}
|
|
8666
9268
|
}
|
|
8667
9269
|
async function checkUncommittedChanges(projectRoot) {
|
|
8668
|
-
const result = await new Promise((
|
|
9270
|
+
const result = await new Promise((resolve8, reject) => {
|
|
8669
9271
|
const child = spawn4("git", ["status", "--porcelain"], {
|
|
8670
9272
|
cwd: projectRoot,
|
|
8671
9273
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -8677,7 +9279,7 @@ async function checkUncommittedChanges(projectRoot) {
|
|
|
8677
9279
|
stdout += data;
|
|
8678
9280
|
});
|
|
8679
9281
|
child.on("error", reject);
|
|
8680
|
-
child.on("close", (code) =>
|
|
9282
|
+
child.on("close", (code) => resolve8({ stdout, code: code ?? 0 }));
|
|
8681
9283
|
});
|
|
8682
9284
|
if (!result.stdout.trim()) return void 0;
|
|
8683
9285
|
const count = result.stdout.split("\n").filter(Boolean).length;
|
|
@@ -8724,7 +9326,7 @@ function formatDiagnostics(input) {
|
|
|
8724
9326
|
|
|
8725
9327
|
// src/wiring/session-registry.ts
|
|
8726
9328
|
import { execFile } from "node:child_process";
|
|
8727
|
-
import * as
|
|
9329
|
+
import * as path18 from "node:path";
|
|
8728
9330
|
async function setupSessionRegistry(deps) {
|
|
8729
9331
|
const { wpaths, projectRoot, session, context, tuiOwnsScreen, events } = deps;
|
|
8730
9332
|
let tracker;
|
|
@@ -8734,9 +9336,9 @@ async function setupSessionRegistry(deps) {
|
|
|
8734
9336
|
try {
|
|
8735
9337
|
const { getSessionRegistry: getSessionRegistry2, AgentStatusTracker, FleetNotifier } = await import("@wrongstack/core/storage");
|
|
8736
9338
|
const registry = getSessionRegistry2(wpaths.globalRoot);
|
|
8737
|
-
const projectSlug =
|
|
8738
|
-
const projectName =
|
|
8739
|
-
let gitBranch = await new Promise((
|
|
9339
|
+
const projectSlug = path18.basename(wpaths.projectDir);
|
|
9340
|
+
const projectName = path18.basename(projectRoot);
|
|
9341
|
+
let gitBranch = await new Promise((resolve8) => {
|
|
8740
9342
|
execFile(
|
|
8741
9343
|
"git",
|
|
8742
9344
|
["rev-parse", "--abbrev-ref", "HEAD"],
|
|
@@ -8747,7 +9349,7 @@ async function setupSessionRegistry(deps) {
|
|
|
8747
9349
|
windowsHide: true,
|
|
8748
9350
|
maxBuffer: 64 * 1024
|
|
8749
9351
|
},
|
|
8750
|
-
(error, stdout) =>
|
|
9352
|
+
(error, stdout) => resolve8(error ? void 0 : stdout.trim() || void 0)
|
|
8751
9353
|
);
|
|
8752
9354
|
});
|
|
8753
9355
|
if (gitBranch === "HEAD") gitBranch = void 0;
|
|
@@ -9743,7 +10345,7 @@ ${color13.dim("YOLO enabled; tool calls run without approval unless an explicit
|
|
|
9743
10345
|
|
|
9744
10346
|
// src/slash-commands/brain.ts
|
|
9745
10347
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
9746
|
-
import { readFile as
|
|
10348
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
9747
10349
|
import { color as color14 } from "@wrongstack/core/utils";
|
|
9748
10350
|
import { parseModelRef } from "@wrongstack/core/agent";
|
|
9749
10351
|
var RISK_LEVELS = /* @__PURE__ */ new Set(["off", "low", "medium", "high", "all"]);
|
|
@@ -10104,7 +10706,7 @@ function buildBrainCommand(opts) {
|
|
|
10104
10706
|
const n = Math.max(1, Math.min(100, Number.parseInt(rest[0] ?? "15", 10) || 15));
|
|
10105
10707
|
let raw;
|
|
10106
10708
|
try {
|
|
10107
|
-
raw = await
|
|
10709
|
+
raw = await readFile7(ledgerPath, "utf8");
|
|
10108
10710
|
} catch {
|
|
10109
10711
|
const msg3 = `No ledger entries yet (${ledgerPath}).`;
|
|
10110
10712
|
opts.renderer.write(msg3);
|
|
@@ -10972,7 +11574,7 @@ function buildCompactCommand(opts) {
|
|
|
10972
11574
|
}
|
|
10973
11575
|
|
|
10974
11576
|
// src/slash-commands/context.ts
|
|
10975
|
-
import * as
|
|
11577
|
+
import * as fs7 from "node:fs/promises";
|
|
10976
11578
|
import { atomicWrite as atomicWrite3, color as color18, getContextBreakdown, repairToolUseAdjacency } from "@wrongstack/core/utils";
|
|
10977
11579
|
import { formatContextWindowModeList, getContextWindowMode, resolveContextWindowPolicy as resolveContextWindowPolicy2 } from "@wrongstack/core/types";
|
|
10978
11580
|
function buildContextCommand(opts) {
|
|
@@ -11308,7 +11910,7 @@ async function persistContextConfig(opts, patch) {
|
|
|
11308
11910
|
const configPath = activeProfileConfigPath(opts.paths, opts.configStore.get());
|
|
11309
11911
|
let raw = "{}";
|
|
11310
11912
|
try {
|
|
11311
|
-
raw = await
|
|
11913
|
+
raw = await fs7.readFile(configPath, "utf8");
|
|
11312
11914
|
} catch (err) {
|
|
11313
11915
|
if (err.code !== "ENOENT") {
|
|
11314
11916
|
return `Could not read ${configPath}: ${err.message}`;
|
|
@@ -11706,9 +12308,23 @@ function listRoles() {
|
|
|
11706
12308
|
}
|
|
11707
12309
|
|
|
11708
12310
|
// src/slash-commands/design.ts
|
|
11709
|
-
import * as
|
|
11710
|
-
import * as
|
|
11711
|
-
import {
|
|
12311
|
+
import * as fs8 from "node:fs/promises";
|
|
12312
|
+
import * as path19 from "node:path";
|
|
12313
|
+
import {
|
|
12314
|
+
applyTokenOverrides,
|
|
12315
|
+
clearActiveKit,
|
|
12316
|
+
clearPersistedActiveKit,
|
|
12317
|
+
getDesignKitLoader,
|
|
12318
|
+
getDesignState,
|
|
12319
|
+
isDesignStack,
|
|
12320
|
+
loadActiveKit,
|
|
12321
|
+
materializeTokens,
|
|
12322
|
+
recordOverrides,
|
|
12323
|
+
resolveMaterializeTarget,
|
|
12324
|
+
resolveSemanticTune,
|
|
12325
|
+
setActiveKit,
|
|
12326
|
+
setDesignOverrides
|
|
12327
|
+
} from "@wrongstack/core/design";
|
|
11712
12328
|
import { color as color20 } from "@wrongstack/core/utils";
|
|
11713
12329
|
function parseOverridePairs(tokens) {
|
|
11714
12330
|
const out = {};
|
|
@@ -11792,7 +12408,9 @@ ${color20.dim("Pin one with /design <kit-id> [stack].")}`
|
|
|
11792
12408
|
};
|
|
11793
12409
|
const patch = resolveSemanticTune(tune);
|
|
11794
12410
|
if (Object.keys(patch).length === 0) {
|
|
11795
|
-
return {
|
|
12411
|
+
return {
|
|
12412
|
+
message: 'Usage: /design tune radius=lg density=compact font="\u2026" motion=snappy'
|
|
12413
|
+
};
|
|
11796
12414
|
}
|
|
11797
12415
|
const merged = await recordOverrides(opts.projectRoot, patch, (/* @__PURE__ */ new Date()).toISOString());
|
|
11798
12416
|
if (!merged) {
|
|
@@ -11819,7 +12437,9 @@ ${menu}` };
|
|
|
11819
12437
|
await clearPersistedActiveKit(opts.projectRoot);
|
|
11820
12438
|
if (ctx) setActiveKit(ctx, kit2.id, stack2, {});
|
|
11821
12439
|
return {
|
|
11822
|
-
message: color20.green(
|
|
12440
|
+
message: color20.green(
|
|
12441
|
+
`Swapped to design kit "${kit2.name}" (${kit2.id}). Old overrides dropped.`
|
|
12442
|
+
),
|
|
11823
12443
|
runText: `design use ${kit2.id}${stack2 ? ` --stack ${stack2}` : ""}`,
|
|
11824
12444
|
metadata: { designKit: kit2.id, ...stack2 ? { designStack: stack2 } : {} }
|
|
11825
12445
|
};
|
|
@@ -11841,10 +12461,15 @@ ${menu}` };
|
|
|
11841
12461
|
kitId: active2.kit,
|
|
11842
12462
|
outPath
|
|
11843
12463
|
});
|
|
11844
|
-
|
|
12464
|
+
let abs;
|
|
11845
12465
|
try {
|
|
11846
|
-
await
|
|
11847
|
-
|
|
12466
|
+
abs = await resolveMaterializeTarget(result.path, opts.projectRoot);
|
|
12467
|
+
} catch (e) {
|
|
12468
|
+
return { message: e.message };
|
|
12469
|
+
}
|
|
12470
|
+
try {
|
|
12471
|
+
await fs8.mkdir(path19.dirname(abs), { recursive: true });
|
|
12472
|
+
await fs8.writeFile(abs, result.content);
|
|
11848
12473
|
} catch (e) {
|
|
11849
12474
|
return { message: `Failed to write ${result.path}: ${e.message}` };
|
|
11850
12475
|
}
|
|
@@ -11891,7 +12516,7 @@ The following characters are not allowed: ; & | < > ^ $ , ( ) { } [ ] ! # % ' "
|
|
|
11891
12516
|
}
|
|
11892
12517
|
}
|
|
11893
12518
|
function runCommand(cmd, cwd, timeout) {
|
|
11894
|
-
return new Promise((
|
|
12519
|
+
return new Promise((resolve8) => {
|
|
11895
12520
|
validateCommand(cmd);
|
|
11896
12521
|
const opts = {
|
|
11897
12522
|
cwd,
|
|
@@ -11904,7 +12529,7 @@ function runCommand(cmd, cwd, timeout) {
|
|
|
11904
12529
|
shell: process.platform === "win32"
|
|
11905
12530
|
};
|
|
11906
12531
|
execFile2(cmd, [], opts, (error, stdout, stderr) => {
|
|
11907
|
-
|
|
12532
|
+
resolve8({
|
|
11908
12533
|
stdout,
|
|
11909
12534
|
stderr,
|
|
11910
12535
|
exitCode: typeof error?.code === "number" ? error.code : 0,
|
|
@@ -12011,13 +12636,13 @@ function buildStatsCommand(opts) {
|
|
|
12011
12636
|
}
|
|
12012
12637
|
|
|
12013
12638
|
// src/slash-commands/doctor.ts
|
|
12014
|
-
import * as
|
|
12015
|
-
import * as
|
|
12639
|
+
import * as fs9 from "node:fs/promises";
|
|
12640
|
+
import * as path20 from "node:path";
|
|
12016
12641
|
import { atomicWrite as atomicWrite4, color as color22 } from "@wrongstack/core/utils";
|
|
12017
12642
|
|
|
12018
12643
|
// src/config-doctor.ts
|
|
12019
|
-
import { validateAgainstSchema } from "@wrongstack/core/utils";
|
|
12020
12644
|
import { isSecretField } from "@wrongstack/core/security";
|
|
12645
|
+
import { validateAgainstSchema } from "@wrongstack/core/utils";
|
|
12021
12646
|
var KNOWN_TOP_LEVEL_KEYS = [
|
|
12022
12647
|
"version",
|
|
12023
12648
|
"provider",
|
|
@@ -12038,6 +12663,7 @@ var KNOWN_TOP_LEVEL_KEYS = [
|
|
|
12038
12663
|
"acp",
|
|
12039
12664
|
"agents",
|
|
12040
12665
|
"fallbackModels",
|
|
12666
|
+
"fallbackBridge",
|
|
12041
12667
|
"fallbackProfiles",
|
|
12042
12668
|
"fallbackAuto",
|
|
12043
12669
|
"hooks",
|
|
@@ -12069,7 +12695,12 @@ var KNOWN_TOP_LEVEL_KEYS = [
|
|
|
12069
12695
|
];
|
|
12070
12696
|
var BOOLEAN_FIELDS = ["hints", "debugStream", "yolo", "nextPrediction"];
|
|
12071
12697
|
var AUTONOMY_ENUMS = {
|
|
12072
|
-
|
|
12698
|
+
// Parity with `AutonomyMode` (cli/src/services/autonomy-mode.ts) and the
|
|
12699
|
+
// TUI settings picker; the persist layer (`pref-helpers.ts`) now
|
|
12700
|
+
// round-trips all five modes instead of silently dropping 'eternal' /
|
|
12701
|
+
// 'eternal-parallel', and the doctor must accept them too or it would
|
|
12702
|
+
// flag a config that the rest of the system happily writes.
|
|
12703
|
+
defaultMode: ["off", "suggest", "auto", "eternal", "eternal-parallel"],
|
|
12073
12704
|
enhanceLanguage: ["original", "english"]
|
|
12074
12705
|
};
|
|
12075
12706
|
var AUTONOMY_BOOLEANS = ["enhance"];
|
|
@@ -12430,17 +13061,17 @@ function diagnoseConfig(cfg, plugins = []) {
|
|
|
12430
13061
|
function scanPlaintextSecrets(node, prefix, findings) {
|
|
12431
13062
|
if (!isPlainObject(node)) return;
|
|
12432
13063
|
for (const [key, value] of Object.entries(node)) {
|
|
12433
|
-
const
|
|
13064
|
+
const path32 = prefix ? `${prefix}.${key}` : key;
|
|
12434
13065
|
if (typeof value === "string") {
|
|
12435
13066
|
if (value.length > 0 && isSecretField(key) && !value.startsWith(ENC_PREFIX)) {
|
|
12436
13067
|
findings.push({
|
|
12437
|
-
path:
|
|
13068
|
+
path: path32,
|
|
12438
13069
|
problem: "looks like a plaintext secret (not vault-encrypted) \u2014 it will be encrypted on next boot",
|
|
12439
13070
|
severity: "warning"
|
|
12440
13071
|
});
|
|
12441
13072
|
}
|
|
12442
13073
|
} else if (isPlainObject(value)) {
|
|
12443
|
-
scanPlaintextSecrets(value,
|
|
13074
|
+
scanPlaintextSecrets(value, path32, findings);
|
|
12444
13075
|
}
|
|
12445
13076
|
}
|
|
12446
13077
|
}
|
|
@@ -12482,11 +13113,11 @@ function buildDoctorCommand(opts) {
|
|
|
12482
13113
|
return ` ${icon} ${color22.cyan(f.path)} \u2014 ${f.problem}${fix}`;
|
|
12483
13114
|
}
|
|
12484
13115
|
async function findParsableBackup(file) {
|
|
12485
|
-
const dir =
|
|
12486
|
-
const base =
|
|
13116
|
+
const dir = path20.dirname(file);
|
|
13117
|
+
const base = path20.basename(file);
|
|
12487
13118
|
const candidates = [`${base}.last`];
|
|
12488
13119
|
try {
|
|
12489
|
-
const siblings = await
|
|
13120
|
+
const siblings = await fs9.readdir(dir);
|
|
12490
13121
|
candidates.push(
|
|
12491
13122
|
...siblings.filter((f) => f.startsWith(`${base}.`) && f.endsWith(".bak")).sort().reverse()
|
|
12492
13123
|
);
|
|
@@ -12494,7 +13125,7 @@ function buildDoctorCommand(opts) {
|
|
|
12494
13125
|
}
|
|
12495
13126
|
for (const name of candidates) {
|
|
12496
13127
|
try {
|
|
12497
|
-
const raw = await
|
|
13128
|
+
const raw = await fs9.readFile(path20.join(dir, name), "utf8");
|
|
12498
13129
|
JSON.parse(raw);
|
|
12499
13130
|
return { name, raw };
|
|
12500
13131
|
} catch {
|
|
@@ -12547,7 +13178,7 @@ function buildDoctorCommand(opts) {
|
|
|
12547
13178
|
for (const target of targets) {
|
|
12548
13179
|
let raw;
|
|
12549
13180
|
try {
|
|
12550
|
-
raw = await
|
|
13181
|
+
raw = await fs9.readFile(target.file, "utf8");
|
|
12551
13182
|
} catch {
|
|
12552
13183
|
if (!target.isProject) {
|
|
12553
13184
|
lines.push(
|
|
@@ -12615,7 +13246,7 @@ function buildDoctorCommand(opts) {
|
|
|
12615
13246
|
await atomicWrite4(target.file, JSON.stringify(report.fixed, null, 2));
|
|
12616
13247
|
if (!target.isProject) {
|
|
12617
13248
|
try {
|
|
12618
|
-
const homeFn = () =>
|
|
13249
|
+
const homeFn = () => path20.dirname(path20.dirname(target.file));
|
|
12619
13250
|
await appendHistory(
|
|
12620
13251
|
parsed,
|
|
12621
13252
|
report.fixed,
|
|
@@ -12860,7 +13491,7 @@ function buildFKeyAliasCommands(opts) {
|
|
|
12860
13491
|
}
|
|
12861
13492
|
|
|
12862
13493
|
// src/slash-commands/fallback.ts
|
|
12863
|
-
import * as
|
|
13494
|
+
import * as fs10 from "node:fs/promises";
|
|
12864
13495
|
import {
|
|
12865
13496
|
normalizeModelRef,
|
|
12866
13497
|
parseModelRef as parseModelRef2,
|
|
@@ -12904,7 +13535,7 @@ async function patchGlobalConfig(globalConfigPath, mutate) {
|
|
|
12904
13535
|
let raw = "{}";
|
|
12905
13536
|
let fileExists2 = true;
|
|
12906
13537
|
try {
|
|
12907
|
-
raw = await
|
|
13538
|
+
raw = await fs10.readFile(globalConfigPath, "utf8");
|
|
12908
13539
|
} catch (err) {
|
|
12909
13540
|
if (err.code !== "ENOENT") throw err;
|
|
12910
13541
|
fileExists2 = false;
|
|
@@ -12936,6 +13567,8 @@ function buildFallbackCommand(opts) {
|
|
|
12936
13567
|
" /fallback add <model> Append a model on the leader provider",
|
|
12937
13568
|
" /fallback remove <n|ref> Remove by 1-based index or exact reference",
|
|
12938
13569
|
" /fallback clear Empty the explicit chain",
|
|
13570
|
+
" /fallback bridge set <provider/model> Set the first continuity route",
|
|
13571
|
+
" /fallback bridge clear Disable the continuity route",
|
|
12939
13572
|
" /fallback auto on|off Toggle the auto-derived smart default",
|
|
12940
13573
|
" /fallback profile set <name> <ref,ref,...> Create or replace a named chain",
|
|
12941
13574
|
" /fallback profile use <name> Make a profile the leader fallback chain",
|
|
@@ -12954,12 +13587,14 @@ function buildFallbackCommand(opts) {
|
|
|
12954
13587
|
const explicit = config.fallbackModels ?? [];
|
|
12955
13588
|
const profiles = config.fallbackProfiles ?? {};
|
|
12956
13589
|
const favorites = config.favoriteModels ?? [];
|
|
13590
|
+
const bridge = config.fallbackBridge?.trim();
|
|
12957
13591
|
const auto = config.fallbackAuto !== false;
|
|
12958
13592
|
const filteredReason = (ref) => refInactiveReason(ref, config);
|
|
12959
13593
|
const lines = [
|
|
12960
13594
|
`${color24.bold("WrongStack")} ${color24.dim("\u2014 Fallback chain")}`,
|
|
12961
13595
|
"",
|
|
12962
13596
|
` ${color24.bold("leader")} ${color24.cyan(`${config.provider}/${config.model}`)}`,
|
|
13597
|
+
` ${color24.bold("bridge")} ${bridge ? color24.cyan(bridge) : color24.dim("(disabled)")} ${color24.dim("/fallback bridge set <provider/model>")}`,
|
|
12963
13598
|
""
|
|
12964
13599
|
];
|
|
12965
13600
|
if (explicit.length > 0) {
|
|
@@ -13038,6 +13673,37 @@ function buildFallbackCommand(opts) {
|
|
|
13038
13673
|
const globalConfigPath = activeProfileConfigPath(opts.paths, config);
|
|
13039
13674
|
const explicit = [...config.fallbackModels ?? []];
|
|
13040
13675
|
try {
|
|
13676
|
+
if (sub === "bridge") {
|
|
13677
|
+
const action = (parts[1] ?? "").toLowerCase();
|
|
13678
|
+
if (action === "clear" || action === "off") {
|
|
13679
|
+
await patchGlobalConfig(globalConfigPath, (cfg) => {
|
|
13680
|
+
delete cfg.fallbackBridge;
|
|
13681
|
+
});
|
|
13682
|
+
opts.configStore.update({ fallbackBridge: "" });
|
|
13683
|
+
return { message: `${color24.green("\u2713")} continuity bridge disabled` };
|
|
13684
|
+
}
|
|
13685
|
+
if (action !== "set") {
|
|
13686
|
+
return {
|
|
13687
|
+
message: `${color24.amber("Usage:")} /fallback bridge set <provider/model> | clear`
|
|
13688
|
+
};
|
|
13689
|
+
}
|
|
13690
|
+
const ref = normalizeRef(parts.slice(2).join(" "));
|
|
13691
|
+
const parsed = parseModelRef2(ref);
|
|
13692
|
+
if (!ref || !parsed.provider || !parsed.model) {
|
|
13693
|
+
return {
|
|
13694
|
+
message: `${color24.amber("Usage:")} /fallback bridge set <provider/model>`
|
|
13695
|
+
};
|
|
13696
|
+
}
|
|
13697
|
+
const invalid = refInvalidReason(ref, config);
|
|
13698
|
+
if (invalid) {
|
|
13699
|
+
return { message: `${color24.red("Cannot set bridge")}: "${ref}" \u2014 ${invalid}` };
|
|
13700
|
+
}
|
|
13701
|
+
const decrypted = await patchGlobalConfig(globalConfigPath, (cfg) => {
|
|
13702
|
+
cfg.fallbackBridge = ref;
|
|
13703
|
+
});
|
|
13704
|
+
opts.configStore.update({ fallbackBridge: decrypted.fallbackBridge });
|
|
13705
|
+
return { message: `${color24.green("\u2713")} continuity bridge \u2192 ${color24.cyan(ref)}` };
|
|
13706
|
+
}
|
|
13041
13707
|
if (sub === "add") {
|
|
13042
13708
|
const ref = normalizeRef(parts.slice(1).join(" "));
|
|
13043
13709
|
if (!ref) {
|
|
@@ -14600,7 +15266,7 @@ import { assessCommitSafety } from "@wrongstack/core/coordination";
|
|
|
14600
15266
|
import { color as color27, toErrorMessage as toErrorMessage14 } from "@wrongstack/core/utils";
|
|
14601
15267
|
async function runGit(args, cwd) {
|
|
14602
15268
|
try {
|
|
14603
|
-
return await new Promise((
|
|
15269
|
+
return await new Promise((resolve8, reject) => {
|
|
14604
15270
|
const child = spawn5("git", args, {
|
|
14605
15271
|
cwd,
|
|
14606
15272
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -14618,7 +15284,7 @@ async function runGit(args, cwd) {
|
|
|
14618
15284
|
child.on("error", (err) => {
|
|
14619
15285
|
reject(new Error(`Failed to run git: ${err.message}`));
|
|
14620
15286
|
});
|
|
14621
|
-
child.on("close", (code) =>
|
|
15287
|
+
child.on("close", (code) => resolve8({ stdout, stderr, code: code ?? 0 }));
|
|
14622
15288
|
});
|
|
14623
15289
|
} catch (err) {
|
|
14624
15290
|
throw new Error(toErrorMessage14(err));
|
|
@@ -14920,7 +15586,7 @@ ${color27.dim("(dry-run)")}`
|
|
|
14920
15586
|
}
|
|
14921
15587
|
|
|
14922
15588
|
// src/slash-commands/gitid.ts
|
|
14923
|
-
import * as
|
|
15589
|
+
import * as fs11 from "node:fs/promises";
|
|
14924
15590
|
import { toErrorMessage as toErrorMessage15 } from "@wrongstack/core/utils";
|
|
14925
15591
|
import { atomicWrite as atomicWrite6, color as color28, configureChildEnvGitIdentity as configureChildEnvGitIdentity2, getChildEnvGitIdentity } from "@wrongstack/core/utils";
|
|
14926
15592
|
import { ConfigError as ConfigError2 } from "@wrongstack/core/types";
|
|
@@ -14932,7 +15598,7 @@ async function patchGlobalConfig2(globalConfigPath, mutate) {
|
|
|
14932
15598
|
let raw = "{}";
|
|
14933
15599
|
let fileExists2 = true;
|
|
14934
15600
|
try {
|
|
14935
|
-
raw = await
|
|
15601
|
+
raw = await fs11.readFile(globalConfigPath, "utf8");
|
|
14936
15602
|
} catch (err) {
|
|
14937
15603
|
if (err.code !== "ENOENT") throw err;
|
|
14938
15604
|
fileExists2 = false;
|
|
@@ -15069,7 +15735,7 @@ function buildGitIdCommand(opts) {
|
|
|
15069
15735
|
|
|
15070
15736
|
// src/slash-commands/goal.ts
|
|
15071
15737
|
import * as fsp from "node:fs/promises";
|
|
15072
|
-
import * as
|
|
15738
|
+
import * as path21 from "node:path";
|
|
15073
15739
|
import { ConfigError as ConfigError3 } from "@wrongstack/core/types";
|
|
15074
15740
|
import { PhaseStore as PhaseStore2 } from "@wrongstack/core/goal";
|
|
15075
15741
|
function getStore(opts) {
|
|
@@ -15121,7 +15787,7 @@ function formatPhaseList(graph) {
|
|
|
15121
15787
|
}
|
|
15122
15788
|
async function gatherProjectContext2(projectRoot) {
|
|
15123
15789
|
try {
|
|
15124
|
-
const raw = await fsp.readFile(
|
|
15790
|
+
const raw = await fsp.readFile(path21.join(projectRoot, "package.json"), "utf8");
|
|
15125
15791
|
const pkg = JSON.parse(raw);
|
|
15126
15792
|
const parts = [
|
|
15127
15793
|
`Project: ${String(pkg.name ?? "unknown")}`,
|
|
@@ -15395,8 +16061,8 @@ function buildHelpCommand(opts) {
|
|
|
15395
16061
|
}
|
|
15396
16062
|
|
|
15397
16063
|
// src/slash-commands/init.ts
|
|
15398
|
-
import * as
|
|
15399
|
-
import * as
|
|
16064
|
+
import * as fs12 from "node:fs/promises";
|
|
16065
|
+
import * as path22 from "node:path";
|
|
15400
16066
|
import { color as color30 } from "@wrongstack/core/utils";
|
|
15401
16067
|
function buildInitCommand(opts) {
|
|
15402
16068
|
return {
|
|
@@ -15405,24 +16071,24 @@ function buildInitCommand(opts) {
|
|
|
15405
16071
|
description: "Create or update .wrongstack/AGENTS.md project context for the system prompt.",
|
|
15406
16072
|
async run(_args, ctx) {
|
|
15407
16073
|
const root = ctx?.projectRoot ?? opts.projectRoot ?? process.cwd();
|
|
15408
|
-
const dir =
|
|
15409
|
-
const file =
|
|
16074
|
+
const dir = path22.join(root, ".wrongstack");
|
|
16075
|
+
const file = path22.join(dir, "AGENTS.md");
|
|
15410
16076
|
const isFirstInit = !await fileExists(file);
|
|
15411
16077
|
const detected = await detectProjectFacts(root);
|
|
15412
16078
|
const body = renderAgentsTemplate(detected);
|
|
15413
|
-
await
|
|
16079
|
+
await fs12.mkdir(dir, { recursive: true });
|
|
15414
16080
|
let backedUp = false;
|
|
15415
16081
|
if (!isFirstInit) {
|
|
15416
16082
|
try {
|
|
15417
|
-
await
|
|
16083
|
+
await fs12.copyFile(file, `${file}.bak`);
|
|
15418
16084
|
backedUp = true;
|
|
15419
16085
|
} catch {
|
|
15420
16086
|
}
|
|
15421
16087
|
}
|
|
15422
|
-
await
|
|
16088
|
+
await fs12.writeFile(file, body, "utf8");
|
|
15423
16089
|
let nodePkg = false;
|
|
15424
16090
|
try {
|
|
15425
|
-
await
|
|
16091
|
+
await fs12.access(path22.join(root, "package.json"));
|
|
15426
16092
|
nodePkg = true;
|
|
15427
16093
|
} catch {
|
|
15428
16094
|
}
|
|
@@ -15460,7 +16126,7 @@ function buildInitCommand(opts) {
|
|
|
15460
16126
|
}
|
|
15461
16127
|
async function fileExists(filePath) {
|
|
15462
16128
|
try {
|
|
15463
|
-
await
|
|
16129
|
+
await fs12.access(filePath);
|
|
15464
16130
|
return true;
|
|
15465
16131
|
} catch {
|
|
15466
16132
|
return false;
|
|
@@ -17112,9 +17778,9 @@ function buildMailboxDemoCommand(opts) {
|
|
|
17112
17778
|
|
|
17113
17779
|
// src/slash-commands/mailbox-serve.ts
|
|
17114
17780
|
import { spawn as spawn6 } from "node:child_process";
|
|
17115
|
-
import * as
|
|
17781
|
+
import * as fs13 from "node:fs/promises";
|
|
17116
17782
|
import * as os2 from "node:os";
|
|
17117
|
-
import * as
|
|
17783
|
+
import * as path23 from "node:path";
|
|
17118
17784
|
import { resolveProjectDir as resolveProjectDir5 } from "@wrongstack/core/coordination";
|
|
17119
17785
|
import { wstackGlobalRoot as wstackGlobalRoot5 } from "@wrongstack/core/utils";
|
|
17120
17786
|
function buildMailboxServeCommand(opts) {
|
|
@@ -17156,8 +17822,8 @@ function buildMailboxServeCommand(opts) {
|
|
|
17156
17822
|
}
|
|
17157
17823
|
const cwd = opts.paths?.projectDir ?? opts.cwd;
|
|
17158
17824
|
const projectDir = resolveProjectDir5(cwd, wstackGlobalRoot5());
|
|
17159
|
-
const tokenPath =
|
|
17160
|
-
const pidFile =
|
|
17825
|
+
const tokenPath = path23.join(projectDir, ".mailbox.token");
|
|
17826
|
+
const pidFile = path23.join(os2.tmpdir(), `wstack-mailbox-bridge-${path23.basename(projectDir)}.pid`);
|
|
17161
17827
|
const cliEntry = process.argv[1];
|
|
17162
17828
|
const isWin = process.platform === "win32";
|
|
17163
17829
|
let wstackCmd;
|
|
@@ -17184,7 +17850,7 @@ function buildMailboxServeCommand(opts) {
|
|
|
17184
17850
|
});
|
|
17185
17851
|
child.unref();
|
|
17186
17852
|
try {
|
|
17187
|
-
await
|
|
17853
|
+
await fs13.writeFile(pidFile, String(child.pid ?? ""), { mode: 384 });
|
|
17188
17854
|
} catch {
|
|
17189
17855
|
}
|
|
17190
17856
|
const head = [];
|
|
@@ -19198,7 +19864,7 @@ ${targetMode.description}`
|
|
|
19198
19864
|
}
|
|
19199
19865
|
|
|
19200
19866
|
// src/slash-commands/modelcaps.ts
|
|
19201
|
-
import * as
|
|
19867
|
+
import * as fs14 from "node:fs/promises";
|
|
19202
19868
|
import { color as color36 } from "@wrongstack/core/utils";
|
|
19203
19869
|
function fmtTokens(n) {
|
|
19204
19870
|
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
@@ -19275,7 +19941,7 @@ function buildModelCapsCommand(opts) {
|
|
|
19275
19941
|
}
|
|
19276
19942
|
let providers;
|
|
19277
19943
|
try {
|
|
19278
|
-
const raw = await
|
|
19944
|
+
const raw = await fs14.readFile(cachePath, "utf8");
|
|
19279
19945
|
const parsed = JSON.parse(raw);
|
|
19280
19946
|
const payload = parsed.payload ?? parsed;
|
|
19281
19947
|
providers = Object.entries(payload).map(([id, p]) => ({
|
|
@@ -19358,7 +20024,7 @@ function buildModelCapsCommand(opts) {
|
|
|
19358
20024
|
}
|
|
19359
20025
|
|
|
19360
20026
|
// src/slash-commands/models.ts
|
|
19361
|
-
import * as
|
|
20027
|
+
import * as fs15 from "node:fs/promises";
|
|
19362
20028
|
import { toErrorMessage as toErrorMessage18 } from "@wrongstack/core/utils";
|
|
19363
20029
|
import { atomicWrite as atomicWrite7, color as color37 } from "@wrongstack/core/utils";
|
|
19364
20030
|
import { ConfigError as ConfigError4, ToolValidationError as ToolValidationError4 } from "@wrongstack/core/types";
|
|
@@ -19368,7 +20034,7 @@ async function patchProfileConfig(mutate, profileConfigPath) {
|
|
|
19368
20034
|
let raw = "{}";
|
|
19369
20035
|
let fileExists2 = true;
|
|
19370
20036
|
try {
|
|
19371
|
-
raw = await
|
|
20037
|
+
raw = await fs15.readFile(targetPath, "utf8");
|
|
19372
20038
|
} catch (err) {
|
|
19373
20039
|
if (err.code !== "ENOENT") throw err;
|
|
19374
20040
|
fileExists2 = false;
|
|
@@ -20048,7 +20714,7 @@ function buildPluginCommand(opts) {
|
|
|
20048
20714
|
}
|
|
20049
20715
|
|
|
20050
20716
|
// src/slash-commands/profile.ts
|
|
20051
|
-
import * as
|
|
20717
|
+
import * as path24 from "node:path";
|
|
20052
20718
|
import { atomicWrite as atomicWrite8, color as color39 } from "@wrongstack/core/utils";
|
|
20053
20719
|
import { readJsonObjectFile as readJsonObjectFile2 } from "@wrongstack/core/utils";
|
|
20054
20720
|
var INVALID_NAME_PATTERN = /[/\\:._]/g;
|
|
@@ -20184,8 +20850,8 @@ async function copyProfile(wpaths, nameArg, activeProfile, renderer) {
|
|
|
20184
20850
|
return { message: msg2 };
|
|
20185
20851
|
}
|
|
20186
20852
|
const destPath = wpaths.profileConfig(safe);
|
|
20187
|
-
const srcDir =
|
|
20188
|
-
const destDir =
|
|
20853
|
+
const srcDir = path24.dirname(srcPath);
|
|
20854
|
+
const destDir = path24.dirname(destPath);
|
|
20189
20855
|
const { access: access8, cp } = await import("node:fs/promises");
|
|
20190
20856
|
try {
|
|
20191
20857
|
await access8(destDir);
|
|
@@ -22230,7 +22896,7 @@ async function killSession(sessionId, confirm) {
|
|
|
22230
22896
|
}
|
|
22231
22897
|
|
|
22232
22898
|
// src/slash-commands/setmodel.ts
|
|
22233
|
-
import * as
|
|
22899
|
+
import * as fs16 from "node:fs/promises";
|
|
22234
22900
|
import { toErrorMessage as toErrorMessage21 } from "@wrongstack/core/utils";
|
|
22235
22901
|
import { AGENT_CATALOG as AGENT_CATALOG2, AGENTS_BY_PHASE as AGENTS_BY_PHASE3 } from "@wrongstack/core/agent-catalog";
|
|
22236
22902
|
import { atomicWrite as atomicWrite9, color as color44, expectDefined as expectDefined8 } from "@wrongstack/core/utils";
|
|
@@ -22312,7 +22978,7 @@ async function patchProfileConfig2(mutate, profileConfigPath) {
|
|
|
22312
22978
|
let raw = "{}";
|
|
22313
22979
|
let fileExists2 = true;
|
|
22314
22980
|
try {
|
|
22315
|
-
raw = await
|
|
22981
|
+
raw = await fs16.readFile(targetPath, "utf8");
|
|
22316
22982
|
} catch (err) {
|
|
22317
22983
|
if (err.code !== "ENOENT") throw err;
|
|
22318
22984
|
fileExists2 = false;
|
|
@@ -22774,14 +23440,14 @@ function buildSetModelCommand(opts) {
|
|
|
22774
23440
|
// src/slash-commands/suggest.ts
|
|
22775
23441
|
import { execFile as execFile3 } from "node:child_process";
|
|
22776
23442
|
import { access as access4 } from "node:fs/promises";
|
|
22777
|
-
import * as
|
|
23443
|
+
import * as path25 from "node:path";
|
|
22778
23444
|
import { color as color45 } from "@wrongstack/core/utils";
|
|
22779
23445
|
import { parseNextSteps } from "@wrongstack/tools/next-steps";
|
|
22780
23446
|
import { toErrorMessage as toErrorMessage22 } from "@wrongstack/core/utils";
|
|
22781
23447
|
function readGitStatus(projectRoot, includeBranch) {
|
|
22782
23448
|
const args = ["status", "--short"];
|
|
22783
23449
|
if (includeBranch) args.push("--branch");
|
|
22784
|
-
return new Promise((
|
|
23450
|
+
return new Promise((resolve8) => {
|
|
22785
23451
|
execFile3(
|
|
22786
23452
|
"git",
|
|
22787
23453
|
args,
|
|
@@ -22792,7 +23458,7 @@ function readGitStatus(projectRoot, includeBranch) {
|
|
|
22792
23458
|
windowsHide: true,
|
|
22793
23459
|
maxBuffer: 1024 * 1024
|
|
22794
23460
|
},
|
|
22795
|
-
(error, stdout) =>
|
|
23461
|
+
(error, stdout) => resolve8(error ? "" : stdout.trim())
|
|
22796
23462
|
);
|
|
22797
23463
|
});
|
|
22798
23464
|
}
|
|
@@ -22947,7 +23613,7 @@ async function generateHeuristicSuggestions(opts) {
|
|
|
22947
23613
|
}
|
|
22948
23614
|
}
|
|
22949
23615
|
const root = opts.projectRoot;
|
|
22950
|
-
const has = async (...rel) => (await Promise.all(rel.map((item) => pathExists2(
|
|
23616
|
+
const has = async (...rel) => (await Promise.all(rel.map((item) => pathExists2(path25.join(root, item))))).some(Boolean);
|
|
22951
23617
|
const [hasNode, hasDocker, hasMake, hasPython, hasCi] = await Promise.all([
|
|
22952
23618
|
has("package.json"),
|
|
22953
23619
|
has("Dockerfile", "docker-compose.yml", "compose.yaml"),
|
|
@@ -23482,9 +24148,9 @@ function buildMouseCommand(_opts) {
|
|
|
23482
24148
|
|
|
23483
24149
|
// src/slash-commands/project.ts
|
|
23484
24150
|
import { spawn as spawn7 } from "node:child_process";
|
|
23485
|
-
import * as
|
|
24151
|
+
import * as fs17 from "node:fs/promises";
|
|
23486
24152
|
import { createRequire } from "node:module";
|
|
23487
|
-
import * as
|
|
24153
|
+
import * as path26 from "node:path";
|
|
23488
24154
|
import {
|
|
23489
24155
|
color as color47,
|
|
23490
24156
|
ensureProjectGitignore,
|
|
@@ -23692,13 +24358,13 @@ async function listProjectsCommand(opts, ctx) {
|
|
|
23692
24358
|
return { message: lines.join("\n") };
|
|
23693
24359
|
}
|
|
23694
24360
|
async function addProjectCommand(opts, ctx, targetPath, displayName) {
|
|
23695
|
-
const resolved =
|
|
24361
|
+
const resolved = path26.resolve(ctx?.projectRoot ?? ctx?.cwd ?? process.cwd(), targetPath);
|
|
23696
24362
|
try {
|
|
23697
|
-
await
|
|
24363
|
+
await fs17.access(resolved);
|
|
23698
24364
|
} catch {
|
|
23699
24365
|
return { message: color47.red(`Directory not found: ${resolved}`) };
|
|
23700
24366
|
}
|
|
23701
|
-
const stat5 = await
|
|
24367
|
+
const stat5 = await fs17.stat(resolved);
|
|
23702
24368
|
if (!stat5.isDirectory()) {
|
|
23703
24369
|
return { message: color47.red(`Not a directory: ${resolved}`) };
|
|
23704
24370
|
}
|
|
@@ -23709,7 +24375,7 @@ async function addProjectCommand(opts, ctx, targetPath, displayName) {
|
|
|
23709
24375
|
message: color47.yellow(`Project already registered: "${existing.name}" (${existing.slug})`)
|
|
23710
24376
|
};
|
|
23711
24377
|
}
|
|
23712
|
-
const name = displayName?.trim() ||
|
|
24378
|
+
const name = displayName?.trim() || path26.basename(resolved);
|
|
23713
24379
|
const slug = generateSlug(resolved);
|
|
23714
24380
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
23715
24381
|
await ensureProjectDataDir(slug, opts.paths?.globalConfig);
|
|
@@ -23762,13 +24428,13 @@ async function removeProjectCommand(opts, _ctx, slugOrName) {
|
|
|
23762
24428
|
};
|
|
23763
24429
|
}
|
|
23764
24430
|
async function switchProjectCommand(opts, ctx, target, displayName) {
|
|
23765
|
-
const resolved =
|
|
24431
|
+
const resolved = path26.resolve(ctx?.projectRoot ?? ctx?.cwd ?? process.cwd(), target);
|
|
23766
24432
|
try {
|
|
23767
|
-
await
|
|
24433
|
+
await fs17.access(resolved);
|
|
23768
24434
|
} catch {
|
|
23769
24435
|
return { message: color47.red(`Directory not found: ${resolved}`) };
|
|
23770
24436
|
}
|
|
23771
|
-
const stat5 = await
|
|
24437
|
+
const stat5 = await fs17.stat(resolved);
|
|
23772
24438
|
if (!stat5.isDirectory()) {
|
|
23773
24439
|
return { message: color47.red(`Not a directory: ${resolved}`) };
|
|
23774
24440
|
}
|
|
@@ -23776,9 +24442,9 @@ async function switchProjectCommand(opts, ctx, target, displayName) {
|
|
|
23776
24442
|
try {
|
|
23777
24443
|
const req = createRequire(import.meta.url);
|
|
23778
24444
|
const pkgPath = req.resolve("@wrongstack/cli/package.json");
|
|
23779
|
-
const pkgDir =
|
|
23780
|
-
cliPath =
|
|
23781
|
-
await
|
|
24445
|
+
const pkgDir = path26.dirname(pkgPath);
|
|
24446
|
+
cliPath = path26.join(pkgDir, "dist", "index.js");
|
|
24447
|
+
await fs17.access(cliPath);
|
|
23782
24448
|
} catch {
|
|
23783
24449
|
cliPath = process.argv[1] ?? "";
|
|
23784
24450
|
if (!cliPath) {
|
|
@@ -23794,13 +24460,13 @@ async function switchProjectCommand(opts, ctx, target, displayName) {
|
|
|
23794
24460
|
if (existing) {
|
|
23795
24461
|
existing.lastSeen = (/* @__PURE__ */ new Date()).toISOString();
|
|
23796
24462
|
} else {
|
|
23797
|
-
const name = displayName?.trim() ||
|
|
24463
|
+
const name = displayName?.trim() || path26.basename(resolved);
|
|
23798
24464
|
const slug = generateSlug(resolved);
|
|
23799
24465
|
manifest.projects.push({ name, root: resolved, slug, lastSeen: (/* @__PURE__ */ new Date()).toISOString() });
|
|
23800
24466
|
await ensureProjectDataDir(slug, opts.paths?.globalConfig);
|
|
23801
24467
|
}
|
|
23802
24468
|
await saveManifest(manifest, opts.paths?.globalConfig);
|
|
23803
|
-
const targetName = displayName?.trim() ||
|
|
24469
|
+
const targetName = displayName?.trim() || path26.basename(resolved);
|
|
23804
24470
|
const canSwitch = await confirmProjectSwitch(opts, targetName);
|
|
23805
24471
|
if (!canSwitch) return { message: "" };
|
|
23806
24472
|
const nodeExe = process.execPath;
|
|
@@ -23916,9 +24582,9 @@ async function spawnInProject(opts, _ctx, root, projectName) {
|
|
|
23916
24582
|
try {
|
|
23917
24583
|
const req = createRequire(import.meta.url);
|
|
23918
24584
|
const pkgPath = req.resolve("@wrongstack/cli/package.json");
|
|
23919
|
-
const pkgDir =
|
|
23920
|
-
cliPath =
|
|
23921
|
-
await
|
|
24585
|
+
const pkgDir = path26.dirname(pkgPath);
|
|
24586
|
+
cliPath = path26.join(pkgDir, "dist", "index.js");
|
|
24587
|
+
await fs17.access(cliPath);
|
|
23922
24588
|
} catch {
|
|
23923
24589
|
cliPath = process.argv[1] ?? "";
|
|
23924
24590
|
if (!cliPath) {
|
|
@@ -23934,7 +24600,7 @@ async function spawnInProject(opts, _ctx, root, projectName) {
|
|
|
23934
24600
|
if (existing) {
|
|
23935
24601
|
existing.lastSeen = (/* @__PURE__ */ new Date()).toISOString();
|
|
23936
24602
|
} else {
|
|
23937
|
-
const name = projectName ||
|
|
24603
|
+
const name = projectName || path26.basename(root);
|
|
23938
24604
|
const slug = generateSlug(root);
|
|
23939
24605
|
manifest.projects.push({ name, root, slug, lastSeen: (/* @__PURE__ */ new Date()).toISOString() });
|
|
23940
24606
|
await ensureProjectDataDir(slug, opts.paths?.globalConfig);
|
|
@@ -23966,9 +24632,9 @@ async function handleNewSession(_opts, _ctx) {
|
|
|
23966
24632
|
try {
|
|
23967
24633
|
const req = createRequire(import.meta.url);
|
|
23968
24634
|
const pkgPath = req.resolve("@wrongstack/cli/package.json");
|
|
23969
|
-
const pkgDir =
|
|
23970
|
-
cliPath =
|
|
23971
|
-
await
|
|
24635
|
+
const pkgDir = path26.dirname(pkgPath);
|
|
24636
|
+
cliPath = path26.join(pkgDir, "dist", "index.js");
|
|
24637
|
+
await fs17.access(cliPath);
|
|
23972
24638
|
} catch {
|
|
23973
24639
|
cliPath = process.argv[1] ?? "";
|
|
23974
24640
|
if (!cliPath) {
|
|
@@ -24028,9 +24694,9 @@ async function handlePrevSessions(opts, _ctx) {
|
|
|
24028
24694
|
// src/slash-commands/review.ts
|
|
24029
24695
|
import { spawn as spawn8 } from "node:child_process";
|
|
24030
24696
|
import * as fsp3 from "node:fs/promises";
|
|
24031
|
-
import * as
|
|
24697
|
+
import * as path27 from "node:path";
|
|
24032
24698
|
async function runGit2(args, cwd) {
|
|
24033
|
-
return new Promise((
|
|
24699
|
+
return new Promise((resolve8) => {
|
|
24034
24700
|
const child = spawn8("git", args, {
|
|
24035
24701
|
cwd,
|
|
24036
24702
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -24041,8 +24707,8 @@ async function runGit2(args, cwd) {
|
|
|
24041
24707
|
child.stdout?.on("data", (d) => {
|
|
24042
24708
|
stdout += d;
|
|
24043
24709
|
});
|
|
24044
|
-
child.on("error", () =>
|
|
24045
|
-
child.on("close", (code) =>
|
|
24710
|
+
child.on("error", () => resolve8({ stdout, code: 1 }));
|
|
24711
|
+
child.on("close", (code) => resolve8({ stdout, code: code ?? 0 }));
|
|
24046
24712
|
});
|
|
24047
24713
|
}
|
|
24048
24714
|
async function getChangedFiles(cwd) {
|
|
@@ -24098,7 +24764,7 @@ function buildReviewCommand(opts) {
|
|
|
24098
24764
|
if (f.path.startsWith(".wrongstack/")) continue;
|
|
24099
24765
|
if (fileFilter && !f.path.toLowerCase().includes(fileFilter)) continue;
|
|
24100
24766
|
try {
|
|
24101
|
-
await fsp3.access(
|
|
24767
|
+
await fsp3.access(path27.join(cwd, f.path));
|
|
24102
24768
|
existing.push(f);
|
|
24103
24769
|
} catch {
|
|
24104
24770
|
}
|
|
@@ -24112,7 +24778,7 @@ function buildReviewCommand(opts) {
|
|
|
24112
24778
|
const filesWithContent = [];
|
|
24113
24779
|
for (const f of existing.slice(0, limit)) {
|
|
24114
24780
|
try {
|
|
24115
|
-
const content = await fsp3.readFile(
|
|
24781
|
+
const content = await fsp3.readFile(path27.join(cwd, f.path), "utf8");
|
|
24116
24782
|
filesWithContent.push({ ...f, content });
|
|
24117
24783
|
} catch {
|
|
24118
24784
|
}
|
|
@@ -24354,7 +25020,7 @@ function buildSettingsCommand(opts) {
|
|
|
24354
25020
|
` auto-proceed max iters: ${color48.cyan(String(au?.autoProceedMaxIterations ?? "unlimited"))} ${color48.dim("change: /settings auto-proceed-max-iterations <n>")}`,
|
|
24355
25021
|
` title animation: ${titleAnimation ? color48.cyan("on") : color48.dim("off")} ${color48.dim("change: /settings title-animation on|off")}`,
|
|
24356
25022
|
` thinking word: ${color48.cyan(au?.thinkingWord ?? "thinking")} ${color48.dim("change: /settings thinking-word <word>")}`,
|
|
24357
|
-
` statusline mode: ${color48.cyan(au?.statuslineMode ?? "
|
|
25023
|
+
` statusline mode: ${color48.cyan(au?.statuslineMode ?? "minimum")} ${color48.dim("change: /settings statusline minimum|detailed|no-color")}`,
|
|
24358
25024
|
` animation style: ${color48.cyan(au?.animationStyle ?? "rainbow")} ${color48.dim("change: /settings animation rainbow|wave|pulse|dots|breathe|cycle")}`,
|
|
24359
25025
|
` read symbols: ${au?.readAdvancedMode === true ? color48.cyan("on") : color48.dim("off")} ${color48.dim("change: /settings read-symbols on|off")}`,
|
|
24360
25026
|
` reasoning mode: ${color48.cyan(reasoningMode)} ${color48.dim("change: /settings reasoning auto|on|off")}`,
|
|
@@ -25548,6 +26214,9 @@ function buildStatuslineCommand(deps) {
|
|
|
25548
26214
|
"Available items:",
|
|
25549
26215
|
...ALL_CONFIG_KEYS.map((k) => ` ${k.padEnd(12)} ${ITEM_DESCRIPTIONS[k]}`),
|
|
25550
26216
|
"",
|
|
26217
|
+
"Density mode (minimum/detailed/no-color) is a separate setting \u2014 see /settings.",
|
|
26218
|
+
"These toggles set chip eligibility in any mode; some chips only render in detailed mode.",
|
|
26219
|
+
"",
|
|
25551
26220
|
"Persistent across sessions (saved to ~/.wrongstack/profiles/<active>/statusline.json)."
|
|
25552
26221
|
].join("\n"),
|
|
25553
26222
|
async run(args) {
|
|
@@ -26059,36 +26728,36 @@ ${formatTaskProgress(file.tasks)}`;
|
|
|
26059
26728
|
}
|
|
26060
26729
|
|
|
26061
26730
|
// src/slash-commands/techstack.ts
|
|
26062
|
-
import * as
|
|
26063
|
-
import * as
|
|
26731
|
+
import * as fs18 from "node:fs/promises";
|
|
26732
|
+
import * as path28 from "node:path";
|
|
26064
26733
|
import { color as color51 } from "@wrongstack/core/utils";
|
|
26065
26734
|
import { toErrorMessage as toErrorMessage25 } from "@wrongstack/core/utils";
|
|
26066
26735
|
async function discoverPackageFiles(projectRoot) {
|
|
26067
26736
|
const files = [];
|
|
26068
|
-
const rootPkg =
|
|
26737
|
+
const rootPkg = path28.join(projectRoot, "package.json");
|
|
26069
26738
|
try {
|
|
26070
|
-
await
|
|
26739
|
+
await fs18.access(rootPkg);
|
|
26071
26740
|
files.push(rootPkg);
|
|
26072
26741
|
} catch {
|
|
26073
26742
|
}
|
|
26074
|
-
const workspaceFile =
|
|
26743
|
+
const workspaceFile = path28.join(projectRoot, "pnpm-workspace.yaml");
|
|
26075
26744
|
try {
|
|
26076
|
-
await
|
|
26077
|
-
const content = await
|
|
26745
|
+
await fs18.access(workspaceFile);
|
|
26746
|
+
const content = await fs18.readFile(workspaceFile, "utf8");
|
|
26078
26747
|
const globMatch = /packages?:\s*\[([^\]]+)\]/s.exec(content);
|
|
26079
26748
|
const rawGlobs = globMatch?.[1];
|
|
26080
26749
|
if (!rawGlobs) return files;
|
|
26081
26750
|
const globs = rawGlobs.split(/[\s,]+/).filter(Boolean).map((g) => g.replace(/['"]/g, ""));
|
|
26082
26751
|
for (const g of globs) {
|
|
26083
26752
|
const dirPrefix = g.replace(/\/?\*$/, "").replace(/\/\*$/, "");
|
|
26084
|
-
const dir =
|
|
26753
|
+
const dir = path28.join(projectRoot, dirPrefix);
|
|
26085
26754
|
try {
|
|
26086
|
-
const entries = await
|
|
26755
|
+
const entries = await fs18.readdir(dir, { withFileTypes: true });
|
|
26087
26756
|
for (const e of entries) {
|
|
26088
26757
|
if (!e.isDirectory()) continue;
|
|
26089
|
-
const subPkg =
|
|
26758
|
+
const subPkg = path28.join(dir, e.name, "package.json");
|
|
26090
26759
|
try {
|
|
26091
|
-
await
|
|
26760
|
+
await fs18.access(subPkg);
|
|
26092
26761
|
files.push(subPkg);
|
|
26093
26762
|
} catch {
|
|
26094
26763
|
}
|
|
@@ -26101,7 +26770,7 @@ async function discoverPackageFiles(projectRoot) {
|
|
|
26101
26770
|
return files;
|
|
26102
26771
|
}
|
|
26103
26772
|
function buildTechStackTask(opts) {
|
|
26104
|
-
const pkgList = opts.packageFiles.map((f) => ` - ${
|
|
26773
|
+
const pkgList = opts.packageFiles.map((f) => ` - ${path28.relative(opts.projectRoot, f)}`).join("\n");
|
|
26105
26774
|
const header = opts.isInit ? [
|
|
26106
26775
|
"## Tech Stack Audit \u2014 First-Time Project Init",
|
|
26107
26776
|
"",
|
|
@@ -27355,9 +28024,9 @@ ${lines.join("\n")}${extra}
|
|
|
27355
28024
|
}
|
|
27356
28025
|
|
|
27357
28026
|
// src/slash-commands/tuneup.ts
|
|
27358
|
-
import * as
|
|
28027
|
+
import * as fs19 from "node:fs/promises";
|
|
27359
28028
|
import * as os3 from "node:os";
|
|
27360
|
-
import * as
|
|
28029
|
+
import * as path29 from "node:path";
|
|
27361
28030
|
import { atomicWrite as atomicWrite10, color as color56 } from "@wrongstack/core/utils";
|
|
27362
28031
|
|
|
27363
28032
|
// src/tuneup.ts
|
|
@@ -27959,13 +28628,13 @@ async function gatherMemoryFiles(opts) {
|
|
|
27959
28628
|
const candidates = [
|
|
27960
28629
|
{ label: "user memory", file: paths.globalMemory, committed: false },
|
|
27961
28630
|
{ label: "project AGENTS.md", file: paths.inProjectAgentsFile, committed: true },
|
|
27962
|
-
{ label: "root CLAUDE.md", file:
|
|
27963
|
-
{ label: "root AGENTS.md", file:
|
|
28631
|
+
{ label: "root CLAUDE.md", file: path29.join(opts.projectRoot, "CLAUDE.md"), committed: true },
|
|
28632
|
+
{ label: "root AGENTS.md", file: path29.join(opts.projectRoot, "AGENTS.md"), committed: true }
|
|
27964
28633
|
];
|
|
27965
28634
|
const out = [];
|
|
27966
28635
|
for (const c of candidates) {
|
|
27967
28636
|
try {
|
|
27968
|
-
const content = await
|
|
28637
|
+
const content = await fs19.readFile(c.file, "utf8");
|
|
27969
28638
|
out.push({ label: c.label, path: c.file, content, committed: c.committed });
|
|
27970
28639
|
} catch {
|
|
27971
28640
|
}
|
|
@@ -27983,7 +28652,7 @@ async function gatherTrust(opts) {
|
|
|
27983
28652
|
const file = opts.paths?.projectTrust;
|
|
27984
28653
|
if (!file) return void 0;
|
|
27985
28654
|
try {
|
|
27986
|
-
const raw = await
|
|
28655
|
+
const raw = await fs19.readFile(file, "utf8");
|
|
27987
28656
|
const parsed = JSON.parse(raw);
|
|
27988
28657
|
if (parsed && typeof parsed === "object") return parsed;
|
|
27989
28658
|
} catch {
|
|
@@ -27994,7 +28663,7 @@ async function gatherConfigIssues(opts) {
|
|
|
27994
28663
|
if (!opts.paths) return 0;
|
|
27995
28664
|
const file = activeProfileConfigPath(opts.paths, opts.configStore.get());
|
|
27996
28665
|
try {
|
|
27997
|
-
const raw = await
|
|
28666
|
+
const raw = await fs19.readFile(file, "utf8");
|
|
27998
28667
|
const parsed = JSON.parse(raw);
|
|
27999
28668
|
return diagnoseConfig(parsed).findings.length;
|
|
28000
28669
|
} catch {
|
|
@@ -28012,14 +28681,14 @@ async function gatherSessionBytes(opts) {
|
|
|
28012
28681
|
}
|
|
28013
28682
|
async function dirSize(dir) {
|
|
28014
28683
|
let total = 0;
|
|
28015
|
-
const entries = await
|
|
28684
|
+
const entries = await fs19.readdir(dir, { withFileTypes: true });
|
|
28016
28685
|
for (const e of entries) {
|
|
28017
|
-
const full =
|
|
28686
|
+
const full = path29.join(dir, e.name);
|
|
28018
28687
|
if (e.isDirectory()) {
|
|
28019
28688
|
total += await dirSize(full);
|
|
28020
28689
|
} else if (e.isFile()) {
|
|
28021
28690
|
try {
|
|
28022
|
-
total += (await
|
|
28691
|
+
total += (await fs19.stat(full)).size;
|
|
28023
28692
|
} catch {
|
|
28024
28693
|
}
|
|
28025
28694
|
}
|
|
@@ -28032,7 +28701,7 @@ async function applyActions(actions, opts) {
|
|
|
28032
28701
|
const file = activeProfileConfigPath(opts.paths, opts.configStore.get());
|
|
28033
28702
|
let raw = "{}";
|
|
28034
28703
|
try {
|
|
28035
|
-
raw = await
|
|
28704
|
+
raw = await fs19.readFile(file, "utf8");
|
|
28036
28705
|
} catch {
|
|
28037
28706
|
}
|
|
28038
28707
|
let parsed;
|
|
@@ -28084,7 +28753,7 @@ async function applyActions(actions, opts) {
|
|
|
28084
28753
|
}
|
|
28085
28754
|
await atomicWrite10(file, JSON.stringify(parsed, null, 2));
|
|
28086
28755
|
try {
|
|
28087
|
-
const homeFn = () =>
|
|
28756
|
+
const homeFn = () => path29.dirname(path29.dirname(file));
|
|
28088
28757
|
await appendHistory(JSON.parse(raw), parsed, "tuneup auto-fix", homeFn, file);
|
|
28089
28758
|
} catch {
|
|
28090
28759
|
}
|
|
@@ -28188,8 +28857,8 @@ function summaryLine(findings, fixable, handoffs, power) {
|
|
|
28188
28857
|
}
|
|
28189
28858
|
|
|
28190
28859
|
// src/slash-commands/working-dir.ts
|
|
28191
|
-
import * as
|
|
28192
|
-
import * as
|
|
28860
|
+
import * as fs20 from "node:fs/promises";
|
|
28861
|
+
import * as path30 from "node:path";
|
|
28193
28862
|
import { color as color57 } from "@wrongstack/core/utils";
|
|
28194
28863
|
import { toErrorMessage as toErrorMessage28 } from "@wrongstack/core/utils";
|
|
28195
28864
|
function buildWorkingDirCommand(_opts) {
|
|
@@ -28214,7 +28883,7 @@ function buildWorkingDirCommand(_opts) {
|
|
|
28214
28883
|
}
|
|
28215
28884
|
const trimmed = args.trim();
|
|
28216
28885
|
if (!trimmed) {
|
|
28217
|
-
const rel2 =
|
|
28886
|
+
const rel2 = path30.relative(ctx.projectRoot, ctx.workingDir) || ".";
|
|
28218
28887
|
return {
|
|
28219
28888
|
message: [
|
|
28220
28889
|
`Working directory: ${color57.bold(ctx.workingDir)}`,
|
|
@@ -28223,10 +28892,10 @@ function buildWorkingDirCommand(_opts) {
|
|
|
28223
28892
|
].join("\n")
|
|
28224
28893
|
};
|
|
28225
28894
|
}
|
|
28226
|
-
const resolved =
|
|
28227
|
-
const root =
|
|
28228
|
-
const rel =
|
|
28229
|
-
if (rel.startsWith("..") ||
|
|
28895
|
+
const resolved = path30.isAbsolute(trimmed) ? path30.resolve(trimmed) : path30.resolve(ctx.projectRoot, trimmed);
|
|
28896
|
+
const root = path30.resolve(ctx.projectRoot);
|
|
28897
|
+
const rel = path30.relative(root, resolved);
|
|
28898
|
+
if (rel.startsWith("..") || path30.isAbsolute(rel)) {
|
|
28230
28899
|
return {
|
|
28231
28900
|
message: color57.red(
|
|
28232
28901
|
`Directory "${trimmed}" is outside the project root.
|
|
@@ -28236,7 +28905,7 @@ function buildWorkingDirCommand(_opts) {
|
|
|
28236
28905
|
};
|
|
28237
28906
|
}
|
|
28238
28907
|
try {
|
|
28239
|
-
const stat5 = await
|
|
28908
|
+
const stat5 = await fs20.stat(resolved);
|
|
28240
28909
|
if (!stat5.isDirectory()) {
|
|
28241
28910
|
return { message: color57.red(`Not a directory: ${resolved}`) };
|
|
28242
28911
|
}
|
|
@@ -28251,8 +28920,8 @@ function buildWorkingDirCommand(_opts) {
|
|
|
28251
28920
|
message: color57.red(toErrorMessage28(err))
|
|
28252
28921
|
};
|
|
28253
28922
|
}
|
|
28254
|
-
const prevRel =
|
|
28255
|
-
const newRel =
|
|
28923
|
+
const prevRel = path30.relative(ctx.projectRoot, previous) || ".";
|
|
28924
|
+
const newRel = path30.relative(ctx.projectRoot, resolved) || ".";
|
|
28256
28925
|
return {
|
|
28257
28926
|
message: [
|
|
28258
28927
|
color57.green(` \u2713 ${prevRel} \u2192 ${color57.bold(newRel)}`),
|
|
@@ -28566,7 +29235,7 @@ async function runInteractive(cliCtx) {
|
|
|
28566
29235
|
globalInstructions: wpaths.globalInstructions,
|
|
28567
29236
|
inProjectInstructions: wpaths.inProjectInstructions
|
|
28568
29237
|
},
|
|
28569
|
-
pathJoiner: { join: (a, b) =>
|
|
29238
|
+
pathJoiner: { join: (a, b) => path31.join(a, b) },
|
|
28570
29239
|
systemPromptBuilderToken: TOKENS9.SystemPromptBuilder
|
|
28571
29240
|
});
|
|
28572
29241
|
const toolRegistry = new ToolRegistry2();
|
|
@@ -28644,7 +29313,7 @@ async function runInteractive(cliCtx) {
|
|
|
28644
29313
|
sessionId,
|
|
28645
29314
|
projectSlug: wpaths.projectSlug,
|
|
28646
29315
|
projectRoot,
|
|
28647
|
-
projectName:
|
|
29316
|
+
projectName: path31.basename(projectRoot),
|
|
28648
29317
|
workingDir: cwd,
|
|
28649
29318
|
clientType: flags.webui || flags.simpleui ? "webui" : tuiOwnsScreen ? "tui" : "cli",
|
|
28650
29319
|
pid: process.pid,
|
|
@@ -28653,13 +29322,20 @@ async function runInteractive(cliCtx) {
|
|
|
28653
29322
|
return async () => sessionRegistry.unregister();
|
|
28654
29323
|
}
|
|
28655
29324
|
});
|
|
28656
|
-
const session = sessResult
|
|
29325
|
+
const { context, planPath, session } = sessResult;
|
|
28657
29326
|
sessionRef.current = session;
|
|
28658
|
-
const
|
|
29327
|
+
const governanceHandle = await setupCliGovernance({
|
|
29328
|
+
projectRoot,
|
|
29329
|
+
projectId: wpaths.projectSlug,
|
|
29330
|
+
sessionId: session.id,
|
|
29331
|
+
contextMeta: context.meta,
|
|
29332
|
+
logger,
|
|
29333
|
+
events,
|
|
29334
|
+
planPath,
|
|
29335
|
+
captureWorkspaceCheckpoint: async () => sessionStore.captureWorkspaceCheckpoint?.(session.id, 0)
|
|
29336
|
+
});
|
|
28659
29337
|
configureSimpleUiRuntimeContext(context.meta, flags);
|
|
28660
|
-
const attachments = sessResult
|
|
28661
|
-
const queueStore = sessResult.queueStore;
|
|
28662
|
-
const planPath = sessResult.planPath;
|
|
29338
|
+
const { attachments, queueStore } = sessResult;
|
|
28663
29339
|
const detachTodosCheckpoint = sessResult.detachTodosCheckpoint;
|
|
28664
29340
|
const priorFleetState = sessResult.priorFleetState;
|
|
28665
29341
|
memoryStore.withTraceId(sessResult.traceId);
|
|
@@ -28713,6 +29389,7 @@ async function runInteractive(cliCtx) {
|
|
|
28713
29389
|
}
|
|
28714
29390
|
}
|
|
28715
29391
|
});
|
|
29392
|
+
governanceHandle?.installToolBoundary(pipelines);
|
|
28716
29393
|
const {
|
|
28717
29394
|
autoCompactor,
|
|
28718
29395
|
effectiveMaxContextRef,
|
|
@@ -28865,7 +29542,8 @@ async function runInteractive(cliCtx) {
|
|
|
28865
29542
|
mcpRegistry,
|
|
28866
29543
|
sessResult,
|
|
28867
29544
|
modeId,
|
|
28868
|
-
statusTracker
|
|
29545
|
+
statusTracker,
|
|
29546
|
+
...governanceHandle ? { installToolBoundary: governanceHandle.installToolBoundary } : {}
|
|
28869
29547
|
});
|
|
28870
29548
|
const { hqCommandController } = setupHqTelemetry({
|
|
28871
29549
|
events,
|
|
@@ -29128,7 +29806,7 @@ async function runInteractive(cliCtx) {
|
|
|
29128
29806
|
onEvent: evOn
|
|
29129
29807
|
});
|
|
29130
29808
|
const savedProviderCfg = config.providers?.[config.provider];
|
|
29131
|
-
const { execute } = await import("./execution-
|
|
29809
|
+
const { execute } = await import("./execution-INOV5P7N.js");
|
|
29132
29810
|
const stopHeapWatchdog = startSharedHeapWatchdog({
|
|
29133
29811
|
collectStats: () => {
|
|
29134
29812
|
const hqQueue = hqPublisherRef.current?.getQueueStats();
|
|
@@ -29346,10 +30024,18 @@ async function runInteractive(cliCtx) {
|
|
|
29346
30024
|
logger
|
|
29347
30025
|
})
|
|
29348
30026
|
})
|
|
29349
|
-
).finally(() =>
|
|
30027
|
+
).finally(async () => {
|
|
30028
|
+
const governanceCleanup = await governanceHandle?.close();
|
|
30029
|
+
if (governanceCleanup && !governanceCleanup.ok) {
|
|
30030
|
+
logger.warn(`governance: ${governanceCleanup.action} cleanup failed`, {
|
|
30031
|
+
message: governanceCleanup.message
|
|
30032
|
+
});
|
|
30033
|
+
}
|
|
30034
|
+
memoryStore.dispose();
|
|
30035
|
+
});
|
|
29350
30036
|
}
|
|
29351
30037
|
export {
|
|
29352
30038
|
CLI_VERSION,
|
|
29353
30039
|
runInteractive
|
|
29354
30040
|
};
|
|
29355
|
-
//# sourceMappingURL=cli-main-
|
|
30041
|
+
//# sourceMappingURL=cli-main-TJEU4OUY.js.map
|