aimux-cli 0.1.16 → 0.1.19
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/README.md +184 -67
- package/bin/aimux-dev +10 -0
- package/dist/agent-events.js +0 -1
- package/dist/agent-output-parser.js +0 -1
- package/dist/agent-prompt-delivery.js +0 -1
- package/dist/agent-tracker.js +0 -1
- package/dist/agent-watcher.js +0 -1
- package/dist/alert-display.d.ts +21 -0
- package/dist/alert-display.js +85 -0
- package/dist/atomic-write.js +0 -1
- package/dist/attachment-store.d.ts +0 -7
- package/dist/attachment-store.js +2 -87
- package/dist/builtin-metadata-watchers.js +4 -5
- package/dist/claude-hooks.d.ts +1 -0
- package/dist/claude-hooks.js +25 -1
- package/dist/config.d.ts +19 -13
- package/dist/config.js +28 -15
- package/dist/connection-targets.d.ts +8 -0
- package/dist/connection-targets.js +27 -0
- package/dist/context/compactor.js +0 -1
- package/dist/context/context-bridge.js +0 -1
- package/dist/context/context-file.js +0 -1
- package/dist/context/history.js +0 -1
- package/dist/credentials.d.ts +12 -0
- package/dist/credentials.js +48 -0
- package/dist/daemon.d.ts +23 -0
- package/dist/daemon.js +391 -67
- package/dist/dashboard/command-spec.js +0 -1
- package/dist/dashboard/feedback.js +0 -1
- package/dist/dashboard/index.d.ts +13 -10
- package/dist/dashboard/index.js +3 -27
- package/dist/dashboard/operation-failures.js +0 -1
- package/dist/dashboard/order.d.ts +22 -0
- package/dist/dashboard/order.js +54 -0
- package/dist/dashboard/pending-actions.d.ts +39 -10
- package/dist/dashboard/pending-actions.js +166 -37
- package/dist/dashboard/quick-jump.d.ts +2 -1
- package/dist/dashboard/quick-jump.js +7 -5
- package/dist/dashboard/runtime-evidence.js +0 -1
- package/dist/dashboard/session-actions.d.ts +4 -4
- package/dist/dashboard/session-actions.js +1 -2
- package/dist/dashboard/session-registry.d.ts +4 -3
- package/dist/dashboard/session-registry.js +16 -51
- package/dist/dashboard/sort.js +0 -1
- package/dist/dashboard/state.d.ts +1 -1
- package/dist/dashboard/state.js +0 -1
- package/dist/dashboard/targets.js +0 -1
- package/dist/dashboard/ui-state-store.d.ts +16 -1
- package/dist/dashboard/ui-state-store.js +73 -3
- package/dist/debug-state.d.ts +97 -0
- package/dist/debug-state.js +540 -0
- package/dist/debug.d.ts +38 -0
- package/dist/debug.js +219 -16
- package/dist/default-plugins/gh-pr-context.d.ts +2 -1
- package/dist/default-plugins/gh-pr-context.js +17 -12
- package/dist/default-plugins/transcript-length.js +15 -3
- package/dist/fast-control.js +37 -20
- package/dist/hotkeys.js +0 -1
- package/dist/http-client.js +31 -3
- package/dist/key-parser.js +0 -1
- package/dist/last-used.js +0 -1
- package/dist/local-ui-server.d.ts +22 -0
- package/dist/local-ui-server.js +185 -0
- package/dist/login-flow.d.ts +7 -0
- package/dist/login-flow.js +119 -0
- package/dist/main.js +821 -152
- package/dist/managed-launch-env.js +14 -1
- package/dist/metadata-server.d.ts +36 -36
- package/dist/metadata-server.js +638 -138
- package/dist/metadata-store.d.ts +4 -1
- package/dist/metadata-store.js +30 -3
- package/dist/multiplexer/agent-io-methods.d.ts +2 -10
- package/dist/multiplexer/agent-io-methods.js +12 -44
- package/dist/multiplexer/archives.js +8 -10
- package/dist/multiplexer/dashboard-actions-methods.js +0 -1
- package/dist/multiplexer/dashboard-control.js +45 -14
- package/dist/multiplexer/dashboard-interaction.d.ts +8 -2
- package/dist/multiplexer/dashboard-interaction.js +187 -29
- package/dist/multiplexer/dashboard-model.d.ts +10 -3
- package/dist/multiplexer/dashboard-model.js +417 -36
- package/dist/multiplexer/dashboard-ops.d.ts +9 -7
- package/dist/multiplexer/dashboard-ops.js +178 -69
- package/dist/multiplexer/dashboard-state-methods.d.ts +2 -1
- package/dist/multiplexer/dashboard-state-methods.js +3 -3
- package/dist/multiplexer/dashboard-tail-methods.d.ts +22 -10
- package/dist/multiplexer/dashboard-tail-methods.js +164 -48
- package/dist/multiplexer/dashboard-view-methods.d.ts +1 -1
- package/dist/multiplexer/dashboard-view-methods.js +23 -9
- package/dist/multiplexer/graveyard-view-model.d.ts +9 -1
- package/dist/multiplexer/graveyard-view-model.js +39 -1
- package/dist/multiplexer/index.d.ts +15 -12
- package/dist/multiplexer/index.js +64 -44
- package/dist/multiplexer/navigation.js +0 -1
- package/dist/multiplexer/notifications.js +107 -25
- package/dist/multiplexer/persistence-methods.d.ts +31 -4
- package/dist/multiplexer/persistence-methods.js +304 -309
- package/dist/multiplexer/runtime-lifecycle-methods.d.ts +8 -10
- package/dist/multiplexer/runtime-lifecycle-methods.js +104 -87
- package/dist/multiplexer/runtime-state.d.ts +8 -10
- package/dist/multiplexer/runtime-state.js +82 -146
- package/dist/multiplexer/runtime-sync.d.ts +2 -10
- package/dist/multiplexer/runtime-sync.js +3 -19
- package/dist/multiplexer/service-state-snapshot.d.ts +2 -4
- package/dist/multiplexer/service-state-snapshot.js +4 -52
- package/dist/multiplexer/services.d.ts +1 -0
- package/dist/multiplexer/services.js +55 -6
- package/dist/multiplexer/session-capture.d.ts +1 -0
- package/dist/multiplexer/session-capture.js +23 -0
- package/dist/multiplexer/session-launch.d.ts +4 -1
- package/dist/multiplexer/session-launch.js +152 -64
- package/dist/multiplexer/session-runtime-core.d.ts +8 -20
- package/dist/multiplexer/session-runtime-core.js +40 -136
- package/dist/multiplexer/subscreens.js +10 -4
- package/dist/multiplexer/tool-picker.js +0 -1
- package/dist/multiplexer/worktree-graveyard.d.ts +0 -1
- package/dist/multiplexer/worktree-graveyard.js +15 -17
- package/dist/multiplexer/worktrees.js +96 -41
- package/dist/notification-context.js +8 -5
- package/dist/notifications.js +163 -102
- package/dist/notify.d.ts +4 -0
- package/dist/notify.js +14 -1
- package/dist/orchestration-actions.js +0 -1
- package/dist/orchestration-routing.js +0 -1
- package/dist/orchestration.js +0 -1
- package/dist/osc-notifications.js +0 -1
- package/dist/paths.d.ts +32 -7
- package/dist/paths.js +82 -59
- package/dist/pending-actions.d.ts +5 -0
- package/dist/pending-actions.js +13 -0
- package/dist/plugin-runtime.js +9 -3
- package/dist/project-events.d.ts +1 -10
- package/dist/project-events.js +0 -11
- package/dist/project-scanner.d.ts +2 -3
- package/dist/project-scanner.js +58 -130
- package/dist/project-service-manifest.d.ts +1 -3
- package/dist/project-service-manifest.js +1 -4
- package/dist/recency.js +0 -1
- package/dist/recorder.js +0 -1
- package/dist/relay-client.d.ts +30 -0
- package/dist/relay-client.js +190 -0
- package/dist/remote-access.d.ts +16 -0
- package/dist/remote-access.js +90 -0
- package/dist/runtime-core/exchange-derived.d.ts +2 -0
- package/dist/runtime-core/exchange-derived.js +153 -0
- package/dist/runtime-core/exchange-import.d.ts +24 -0
- package/dist/runtime-core/exchange-import.js +317 -0
- package/dist/runtime-core/exchange-store.d.ts +157 -0
- package/dist/runtime-core/exchange-store.js +452 -0
- package/dist/runtime-core/topology-services.d.ts +38 -0
- package/dist/runtime-core/topology-services.js +170 -0
- package/dist/runtime-core/topology-sessions.d.ts +52 -0
- package/dist/runtime-core/topology-sessions.js +238 -0
- package/dist/runtime-core/topology-store.d.ts +171 -0
- package/dist/runtime-core/topology-store.js +419 -0
- package/dist/runtime-core/topology-worktrees.d.ts +60 -0
- package/dist/runtime-core/topology-worktrees.js +199 -0
- package/dist/runtime-migration.d.ts +69 -0
- package/dist/runtime-migration.js +398 -0
- package/dist/session-bootstrap.d.ts +8 -6
- package/dist/session-bootstrap.js +51 -159
- package/dist/session-runtime.d.ts +2 -0
- package/dist/session-runtime.js +1 -1
- package/dist/session-semantics.d.ts +12 -4
- package/dist/session-semantics.js +14 -1
- package/dist/shell-args.js +0 -1
- package/dist/shell-hooks.js +32 -11
- package/dist/shell-state.d.ts +2 -0
- package/dist/shell-state.js +26 -2
- package/dist/status-detector.js +0 -1
- package/dist/statusline-model.d.ts +10 -2
- package/dist/statusline-model.js +106 -31
- package/dist/task-workflow.d.ts +6 -9
- package/dist/task-workflow.js +37 -85
- package/dist/tasks.d.ts +6 -33
- package/dist/tasks.js +46 -89
- package/dist/team.d.ts +29 -0
- package/dist/team.js +40 -1
- package/dist/terminal-host.js +0 -1
- package/dist/threads.d.ts +6 -35
- package/dist/threads.js +89 -99
- package/dist/tmux/doctor.js +0 -1
- package/dist/tmux/inbox-popup.js +37 -16
- package/dist/tmux/runtime-manager.d.ts +3 -0
- package/dist/tmux/runtime-manager.js +21 -5
- package/dist/tmux/session-transport.js +0 -1
- package/dist/tmux/statusline-cache.js +0 -1
- package/dist/tmux/statusline.js +49 -10
- package/dist/tmux/switcher.js +0 -1
- package/dist/tmux/window-open.js +1 -3
- package/dist/tool-output-watchers.d.ts +0 -18
- package/dist/tool-output-watchers.js +0 -323
- package/dist/tui/render/box.js +0 -1
- package/dist/tui/render/text.js +0 -1
- package/dist/tui/screens/dashboard-renderers.js +37 -26
- package/dist/tui/screens/overlay-renderers.d.ts +2 -0
- package/dist/tui/screens/overlay-renderers.js +37 -2
- package/dist/tui/screens/subscreen-renderers.js +7 -1
- package/dist/workflow.js +0 -1
- package/dist/worktree.js +17 -1
- package/dist-ui/_expo/static/css/web-30453ede1678c16acb08b97e83e8646d.css +1 -0
- package/dist-ui/_expo/static/js/web/entry-477c745b2adc79367a4380ecf07d9ff6.js +14620 -0
- package/dist-ui/assets/assets/images/icon.a5413dcd2e811c9f2317d01a28118d8a.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png +0 -0
- package/dist-ui/assets/node_modules/@react-navigation/elements/lib/module/assets/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png +0 -0
- package/dist-ui/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png +0 -0
- package/dist-ui/favicon.ico +0 -0
- package/dist-ui/index.html +38 -0
- package/dist-ui/metadata.json +1 -0
- package/package.json +29 -12
- package/dist/agent-events.js.map +0 -1
- package/dist/agent-message-parts.d.ts +0 -17
- package/dist/agent-message-parts.js +0 -31
- package/dist/agent-message-parts.js.map +0 -1
- package/dist/agent-output-parser.js.map +0 -1
- package/dist/agent-prompt-delivery.js.map +0 -1
- package/dist/agent-tracker.js.map +0 -1
- package/dist/agent-watcher.js.map +0 -1
- package/dist/atomic-write.js.map +0 -1
- package/dist/attachment-store.js.map +0 -1
- package/dist/builtin-metadata-watchers.js.map +0 -1
- package/dist/claude-hooks.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/context/compactor.js.map +0 -1
- package/dist/context/context-bridge.js.map +0 -1
- package/dist/context/context-file.js.map +0 -1
- package/dist/context/history.js.map +0 -1
- package/dist/daemon.js.map +0 -1
- package/dist/dashboard/command-spec.js.map +0 -1
- package/dist/dashboard/feedback.js.map +0 -1
- package/dist/dashboard/index.js.map +0 -1
- package/dist/dashboard/operation-failures.js.map +0 -1
- package/dist/dashboard/pending-actions.js.map +0 -1
- package/dist/dashboard/quick-jump.js.map +0 -1
- package/dist/dashboard/runtime-evidence.js.map +0 -1
- package/dist/dashboard/session-actions.js.map +0 -1
- package/dist/dashboard/session-registry.js.map +0 -1
- package/dist/dashboard/sort.js.map +0 -1
- package/dist/dashboard/state.js.map +0 -1
- package/dist/dashboard/targets.js.map +0 -1
- package/dist/dashboard/ui-state-store.js.map +0 -1
- package/dist/debug.js.map +0 -1
- package/dist/default-plugins/gh-pr-context.js.map +0 -1
- package/dist/default-plugins/transcript-length.js.map +0 -1
- package/dist/fast-control.js.map +0 -1
- package/dist/hotkeys.js.map +0 -1
- package/dist/http-client.js.map +0 -1
- package/dist/instance-directory.d.ts +0 -32
- package/dist/instance-directory.js +0 -82
- package/dist/instance-directory.js.map +0 -1
- package/dist/instance-registry.d.ts +0 -39
- package/dist/instance-registry.js +0 -208
- package/dist/instance-registry.js.map +0 -1
- package/dist/key-parser.js.map +0 -1
- package/dist/last-used.js.map +0 -1
- package/dist/main.js.map +0 -1
- package/dist/managed-launch-env.js.map +0 -1
- package/dist/metadata-server.js.map +0 -1
- package/dist/metadata-store.js.map +0 -1
- package/dist/multiplexer/agent-io-methods.js.map +0 -1
- package/dist/multiplexer/archives.js.map +0 -1
- package/dist/multiplexer/dashboard-actions-methods.js.map +0 -1
- package/dist/multiplexer/dashboard-control.js.map +0 -1
- package/dist/multiplexer/dashboard-interaction.js.map +0 -1
- package/dist/multiplexer/dashboard-model.js.map +0 -1
- package/dist/multiplexer/dashboard-ops.js.map +0 -1
- package/dist/multiplexer/dashboard-state-methods.js.map +0 -1
- package/dist/multiplexer/dashboard-tail-methods.js.map +0 -1
- package/dist/multiplexer/dashboard-view-methods.js.map +0 -1
- package/dist/multiplexer/graveyard-view-model.js.map +0 -1
- package/dist/multiplexer/index.js.map +0 -1
- package/dist/multiplexer/navigation.js.map +0 -1
- package/dist/multiplexer/notifications.js.map +0 -1
- package/dist/multiplexer/persistence-methods.js.map +0 -1
- package/dist/multiplexer/runtime-lifecycle-methods.js.map +0 -1
- package/dist/multiplexer/runtime-state.js.map +0 -1
- package/dist/multiplexer/runtime-sync.js.map +0 -1
- package/dist/multiplexer/service-state-snapshot.js.map +0 -1
- package/dist/multiplexer/services.js.map +0 -1
- package/dist/multiplexer/session-actions.d.ts +0 -40
- package/dist/multiplexer/session-actions.js +0 -110
- package/dist/multiplexer/session-actions.js.map +0 -1
- package/dist/multiplexer/session-launch.js.map +0 -1
- package/dist/multiplexer/session-runtime-core.js.map +0 -1
- package/dist/multiplexer/subscreens.js.map +0 -1
- package/dist/multiplexer/tool-picker.js.map +0 -1
- package/dist/multiplexer/worktree-graveyard.js.map +0 -1
- package/dist/multiplexer/worktrees.js.map +0 -1
- package/dist/notification-context.js.map +0 -1
- package/dist/notifications.js.map +0 -1
- package/dist/notify.js.map +0 -1
- package/dist/orchestration-actions.js.map +0 -1
- package/dist/orchestration-dispatcher.d.ts +0 -25
- package/dist/orchestration-dispatcher.js +0 -59
- package/dist/orchestration-dispatcher.js.map +0 -1
- package/dist/orchestration-routing.js.map +0 -1
- package/dist/orchestration.js.map +0 -1
- package/dist/osc-notifications.js.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/plugin-runtime.js.map +0 -1
- package/dist/project-events.js.map +0 -1
- package/dist/project-scanner.js.map +0 -1
- package/dist/project-service-manifest.js.map +0 -1
- package/dist/recency.js.map +0 -1
- package/dist/recorder.js.map +0 -1
- package/dist/session-bootstrap.js.map +0 -1
- package/dist/session-input-operations.d.ts +0 -19
- package/dist/session-input-operations.js +0 -46
- package/dist/session-input-operations.js.map +0 -1
- package/dist/session-message-history.d.ts +0 -27
- package/dist/session-message-history.js +0 -105
- package/dist/session-message-history.js.map +0 -1
- package/dist/session-runtime.js.map +0 -1
- package/dist/session-semantics.js.map +0 -1
- package/dist/shell-args.js.map +0 -1
- package/dist/shell-hooks.js.map +0 -1
- package/dist/shell-state.js.map +0 -1
- package/dist/status-detector.js.map +0 -1
- package/dist/statusline-model.js.map +0 -1
- package/dist/task-dispatcher.d.ts +0 -64
- package/dist/task-dispatcher.js +0 -213
- package/dist/task-dispatcher.js.map +0 -1
- package/dist/task-workflow.js.map +0 -1
- package/dist/tasks.js.map +0 -1
- package/dist/team.js.map +0 -1
- package/dist/terminal-host.js.map +0 -1
- package/dist/threads.js.map +0 -1
- package/dist/tmux/doctor.js.map +0 -1
- package/dist/tmux/inbox-popup.js.map +0 -1
- package/dist/tmux/runtime-manager.js.map +0 -1
- package/dist/tmux/session-transport.js.map +0 -1
- package/dist/tmux/statusline-cache.js.map +0 -1
- package/dist/tmux/statusline.js.map +0 -1
- package/dist/tmux/switcher.js.map +0 -1
- package/dist/tmux/window-open.js.map +0 -1
- package/dist/tool-output-watchers.js.map +0 -1
- package/dist/tui/render/box.js.map +0 -1
- package/dist/tui/render/text.js.map +0 -1
- package/dist/tui/screens/dashboard-renderers.js.map +0 -1
- package/dist/tui/screens/overlay-renderers.js.map +0 -1
- package/dist/tui/screens/subscreen-renderers.js.map +0 -1
- package/dist/workflow.js.map +0 -1
- package/dist/worktree.js.map +0 -1
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { getReadOnlyProjectPathsFor } from "./paths.js";
|
|
5
|
+
import { TmuxRuntimeManager } from "./tmux/runtime-manager.js";
|
|
6
|
+
import { listWorktrees } from "./worktree.js";
|
|
7
|
+
import { RuntimeTopologyStore } from "./runtime-core/topology-store.js";
|
|
8
|
+
import { RuntimeExchangeStore } from "./runtime-core/exchange-store.js";
|
|
9
|
+
function asObject(value) {
|
|
10
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
11
|
+
return undefined;
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function asArray(value) {
|
|
15
|
+
return Array.isArray(value) ? value : [];
|
|
16
|
+
}
|
|
17
|
+
function getString(record, key) {
|
|
18
|
+
const value = record?.[key];
|
|
19
|
+
return typeof value === "string" ? value : undefined;
|
|
20
|
+
}
|
|
21
|
+
function readJson(path) {
|
|
22
|
+
if (!existsSync(path))
|
|
23
|
+
return { status: "missing", path };
|
|
24
|
+
try {
|
|
25
|
+
return { status: "found", path, value: JSON.parse(readFileSync(path, "utf8")) };
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return {
|
|
29
|
+
status: "error",
|
|
30
|
+
path,
|
|
31
|
+
error: err instanceof Error ? err.message : String(err),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function readRuntimeTopology(path) {
|
|
36
|
+
if (!existsSync(path))
|
|
37
|
+
return { status: "missing", path };
|
|
38
|
+
try {
|
|
39
|
+
return { status: "found", path, value: new RuntimeTopologyStore(path).read() };
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return {
|
|
43
|
+
status: "error",
|
|
44
|
+
path,
|
|
45
|
+
error: err instanceof Error ? err.message : String(err),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function readRuntimeExchange(path) {
|
|
50
|
+
if (!existsSync(path))
|
|
51
|
+
return { status: "missing", path };
|
|
52
|
+
try {
|
|
53
|
+
return { status: "found", path, value: new RuntimeExchangeStore(path).read() };
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
return {
|
|
57
|
+
status: "error",
|
|
58
|
+
path,
|
|
59
|
+
error: err instanceof Error ? err.message : String(err),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function normalizePathLike(value) {
|
|
64
|
+
if (value === "~")
|
|
65
|
+
return homedir();
|
|
66
|
+
if (value.startsWith("~/"))
|
|
67
|
+
return resolve(homedir(), value.slice(2));
|
|
68
|
+
return resolve(value);
|
|
69
|
+
}
|
|
70
|
+
function looksPathLike(value) {
|
|
71
|
+
return value.includes("/") || value.startsWith("~");
|
|
72
|
+
}
|
|
73
|
+
function matchesString(candidate, target) {
|
|
74
|
+
if (!candidate)
|
|
75
|
+
return false;
|
|
76
|
+
if (candidate === target)
|
|
77
|
+
return true;
|
|
78
|
+
if (looksPathLike(candidate) || looksPathLike(target)) {
|
|
79
|
+
return normalizePathLike(candidate) === normalizePathLike(target);
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
function serviceCanonical(id, worktreePath) {
|
|
84
|
+
return id ? `service:${id}` : `service:${worktreePath ?? "unknown"}`;
|
|
85
|
+
}
|
|
86
|
+
function sessionCanonical(id, backendSessionId) {
|
|
87
|
+
if (id)
|
|
88
|
+
return `session:${id}`;
|
|
89
|
+
if (backendSessionId)
|
|
90
|
+
return `backend-session:${backendSessionId}`;
|
|
91
|
+
return "session:unknown";
|
|
92
|
+
}
|
|
93
|
+
function worktreeCanonical(path, name) {
|
|
94
|
+
return `worktree:${path ?? name ?? "unknown"}`;
|
|
95
|
+
}
|
|
96
|
+
function addMatch(matches, seen, match) {
|
|
97
|
+
const key = `${match.canonicalKey}:${match.source}:${match.kind}:${match.id ?? ""}:${match.backendSessionId ?? ""}`;
|
|
98
|
+
if (seen.has(key))
|
|
99
|
+
return;
|
|
100
|
+
seen.add(key);
|
|
101
|
+
matches.push(match);
|
|
102
|
+
}
|
|
103
|
+
function sourceUnavailable(reason) {
|
|
104
|
+
return { status: "unavailable", reason };
|
|
105
|
+
}
|
|
106
|
+
function filterSavedState(source, target, matches, seen) {
|
|
107
|
+
if (source.status !== "found")
|
|
108
|
+
return { ...source, value: undefined };
|
|
109
|
+
const root = asObject(source.value);
|
|
110
|
+
const services = asArray(root?.services).filter((entry) => {
|
|
111
|
+
const record = asObject(entry);
|
|
112
|
+
const id = getString(record, "id");
|
|
113
|
+
const worktreePath = getString(record, "worktreePath");
|
|
114
|
+
const cwd = getString(record, "cwd");
|
|
115
|
+
const label = getString(record, "label");
|
|
116
|
+
const matched = matchesString(id, target) ||
|
|
117
|
+
matchesString(worktreePath, target) ||
|
|
118
|
+
matchesString(cwd, target) ||
|
|
119
|
+
matchesString(label, target);
|
|
120
|
+
if (matched) {
|
|
121
|
+
addMatch(matches, seen, {
|
|
122
|
+
canonicalKey: serviceCanonical(id, worktreePath),
|
|
123
|
+
kind: "service",
|
|
124
|
+
source: "savedState",
|
|
125
|
+
id,
|
|
126
|
+
worktreePath,
|
|
127
|
+
label,
|
|
128
|
+
raw: entry,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return matched;
|
|
132
|
+
});
|
|
133
|
+
return { status: "found", path: source.path, value: { services } };
|
|
134
|
+
}
|
|
135
|
+
function filterMetadata(source, target, matches, seen) {
|
|
136
|
+
if (source.status !== "found")
|
|
137
|
+
return { ...source, value: undefined };
|
|
138
|
+
const sessionsRecord = asObject(asObject(source.value)?.sessions);
|
|
139
|
+
const sessions = Object.entries(sessionsRecord ?? {})
|
|
140
|
+
.filter(([sessionId, entry]) => {
|
|
141
|
+
const record = asObject(entry);
|
|
142
|
+
const context = asObject(record?.context);
|
|
143
|
+
const worktreePath = getString(context, "worktreePath");
|
|
144
|
+
const worktreeName = getString(context, "worktreeName");
|
|
145
|
+
const branch = getString(context, "branch");
|
|
146
|
+
const cwd = getString(context, "cwd");
|
|
147
|
+
const matched = matchesString(sessionId, target) ||
|
|
148
|
+
matchesString(worktreePath, target) ||
|
|
149
|
+
matchesString(worktreeName, target) ||
|
|
150
|
+
matchesString(branch, target) ||
|
|
151
|
+
matchesString(cwd, target);
|
|
152
|
+
if (matched) {
|
|
153
|
+
addMatch(matches, seen, {
|
|
154
|
+
canonicalKey: sessionCanonical(sessionId),
|
|
155
|
+
kind: "session",
|
|
156
|
+
source: "metadata",
|
|
157
|
+
id: sessionId,
|
|
158
|
+
worktreePath,
|
|
159
|
+
worktreeName,
|
|
160
|
+
raw: entry,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return matched;
|
|
164
|
+
})
|
|
165
|
+
.map(([sessionId, entry]) => ({ sessionId, ...(asObject(entry) ?? {}) }));
|
|
166
|
+
return { status: "found", path: source.path, value: { sessions } };
|
|
167
|
+
}
|
|
168
|
+
const DEBUG_STATE_SOURCE_ROLES = {
|
|
169
|
+
savedState: {
|
|
170
|
+
role: "legacy",
|
|
171
|
+
authority: "runtime-topology.yaml for services",
|
|
172
|
+
note: "legacy service snapshot evidence; it must not create lifecycle truth",
|
|
173
|
+
},
|
|
174
|
+
runtimeTopology: {
|
|
175
|
+
role: "authority",
|
|
176
|
+
authority: "runtime-topology.yaml",
|
|
177
|
+
note: "authoritative agents, services, worktrees, lifecycle, graveyard, and bindings",
|
|
178
|
+
},
|
|
179
|
+
metadata: {
|
|
180
|
+
role: "projection",
|
|
181
|
+
authority: "runtime-topology.yaml and runtime-exchange.yaml",
|
|
182
|
+
note: "decorates known sessions only; hidden lifecycle and backend identity fields are ignored",
|
|
183
|
+
},
|
|
184
|
+
tmux: {
|
|
185
|
+
role: "substrate",
|
|
186
|
+
authority: "runtime-topology.yaml",
|
|
187
|
+
note: "live tmux window evidence and repair input, not durable lifecycle authority",
|
|
188
|
+
},
|
|
189
|
+
gitWorktrees: {
|
|
190
|
+
role: "substrate",
|
|
191
|
+
authority: "runtime-topology.yaml for aimux worktree lifecycle",
|
|
192
|
+
note: "git worktree substrate evidence; aimux lifecycle state lives in topology",
|
|
193
|
+
},
|
|
194
|
+
graveyard: {
|
|
195
|
+
role: "authority",
|
|
196
|
+
authority: "runtime-topology.yaml",
|
|
197
|
+
note: "filtered topology sessions with graveyard status",
|
|
198
|
+
},
|
|
199
|
+
worktreeGraveyard: {
|
|
200
|
+
role: "authority",
|
|
201
|
+
authority: "runtime-topology.yaml",
|
|
202
|
+
note: "topology-owned worktree graveyard entries; git path existence gates resurrection",
|
|
203
|
+
},
|
|
204
|
+
notifications: {
|
|
205
|
+
role: "projection",
|
|
206
|
+
authority: "runtime-exchange.yaml",
|
|
207
|
+
note: "notification rows are exchange threads/messages/inbox entries tagged as notifications",
|
|
208
|
+
},
|
|
209
|
+
operationFailures: {
|
|
210
|
+
role: "projection",
|
|
211
|
+
authority: "runtime-topology.yaml plus operation execution results",
|
|
212
|
+
note: "dashboard-facing failure projection, not lifecycle authority",
|
|
213
|
+
},
|
|
214
|
+
runtimeRows: {
|
|
215
|
+
role: "unavailable",
|
|
216
|
+
note: "live runtime-only view unavailable to standalone debug-state",
|
|
217
|
+
},
|
|
218
|
+
pendingActions: {
|
|
219
|
+
role: "unavailable",
|
|
220
|
+
note: "in-memory dashboard optimism unavailable to standalone debug-state",
|
|
221
|
+
},
|
|
222
|
+
dashboardSnapshot: {
|
|
223
|
+
role: "unavailable",
|
|
224
|
+
note: "project-service/dashboard projection unavailable to standalone debug-state",
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
function filterTmux(tmuxWindows, paths, target, matches, seen) {
|
|
228
|
+
let windows = tmuxWindows;
|
|
229
|
+
if (!windows) {
|
|
230
|
+
try {
|
|
231
|
+
windows = new TmuxRuntimeManager().listProjectManagedWindows(paths.repoRoot);
|
|
232
|
+
}
|
|
233
|
+
catch (err) {
|
|
234
|
+
return {
|
|
235
|
+
status: "error",
|
|
236
|
+
error: err instanceof Error ? err.message : String(err),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (windows instanceof Error)
|
|
241
|
+
return { status: "error", error: windows.message };
|
|
242
|
+
const filtered = windows.filter((entry) => {
|
|
243
|
+
const metadata = entry.metadata;
|
|
244
|
+
const matched = matchesString(metadata.sessionId, target) ||
|
|
245
|
+
matchesString(metadata.backendSessionId, target) ||
|
|
246
|
+
matchesString(metadata.worktreePath, target) ||
|
|
247
|
+
matchesString(metadata.label, target) ||
|
|
248
|
+
matchesString(metadata.launchCommandLine, target) ||
|
|
249
|
+
matchesString(entry.target.windowName, target);
|
|
250
|
+
if (matched) {
|
|
251
|
+
addMatch(matches, seen, {
|
|
252
|
+
canonicalKey: metadata.kind === "service"
|
|
253
|
+
? serviceCanonical(metadata.sessionId, metadata.worktreePath)
|
|
254
|
+
: sessionCanonical(metadata.sessionId, metadata.backendSessionId),
|
|
255
|
+
kind: "tmux-window",
|
|
256
|
+
source: "tmux",
|
|
257
|
+
id: metadata.sessionId,
|
|
258
|
+
backendSessionId: metadata.backendSessionId,
|
|
259
|
+
worktreePath: metadata.worktreePath,
|
|
260
|
+
label: metadata.label,
|
|
261
|
+
raw: entry,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
return matched;
|
|
265
|
+
});
|
|
266
|
+
return { status: "found", value: { windows: filtered } };
|
|
267
|
+
}
|
|
268
|
+
function filterGitWorktrees(worktreesInput, paths, target, matches, seen) {
|
|
269
|
+
let worktrees = worktreesInput;
|
|
270
|
+
if (!worktrees) {
|
|
271
|
+
try {
|
|
272
|
+
worktrees = listWorktrees(paths.repoRoot);
|
|
273
|
+
}
|
|
274
|
+
catch (err) {
|
|
275
|
+
return {
|
|
276
|
+
status: "error",
|
|
277
|
+
error: err instanceof Error ? err.message : String(err),
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (worktrees instanceof Error)
|
|
282
|
+
return { status: "error", error: worktrees.message };
|
|
283
|
+
const filtered = worktrees.filter((entry) => {
|
|
284
|
+
const matched = matchesString(entry.name, target) || matchesString(entry.path, target) || matchesString(entry.branch, target);
|
|
285
|
+
if (matched) {
|
|
286
|
+
addMatch(matches, seen, {
|
|
287
|
+
canonicalKey: worktreeCanonical(entry.path, entry.name),
|
|
288
|
+
kind: "worktree",
|
|
289
|
+
source: "gitWorktrees",
|
|
290
|
+
worktreePath: entry.path,
|
|
291
|
+
worktreeName: entry.name,
|
|
292
|
+
raw: entry,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
return matched;
|
|
296
|
+
});
|
|
297
|
+
return { status: "found", value: { worktrees: filtered } };
|
|
298
|
+
}
|
|
299
|
+
function filterGraveyard(source, target, matches, seen) {
|
|
300
|
+
if (source.status !== "found")
|
|
301
|
+
return { ...source, value: undefined };
|
|
302
|
+
const root = source.value;
|
|
303
|
+
const entries = asArray(Array.isArray(root) ? root : asObject(root)?.sessions).filter((entry) => {
|
|
304
|
+
const record = asObject(entry);
|
|
305
|
+
const status = getString(record, "status");
|
|
306
|
+
if (status && status !== "graveyard")
|
|
307
|
+
return false;
|
|
308
|
+
const id = getString(record, "id");
|
|
309
|
+
const backendSessionId = getString(record, "backendSessionId");
|
|
310
|
+
const worktreePath = getString(record, "worktreePath");
|
|
311
|
+
const label = getString(record, "label");
|
|
312
|
+
const matched = matchesString(id, target) ||
|
|
313
|
+
matchesString(backendSessionId, target) ||
|
|
314
|
+
matchesString(worktreePath, target) ||
|
|
315
|
+
matchesString(label, target);
|
|
316
|
+
if (matched) {
|
|
317
|
+
addMatch(matches, seen, {
|
|
318
|
+
canonicalKey: sessionCanonical(id, backendSessionId),
|
|
319
|
+
kind: "session",
|
|
320
|
+
source: "graveyard",
|
|
321
|
+
id,
|
|
322
|
+
backendSessionId,
|
|
323
|
+
worktreePath,
|
|
324
|
+
label,
|
|
325
|
+
raw: entry,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return matched;
|
|
329
|
+
});
|
|
330
|
+
return { status: "found", path: source.path, value: { entries } };
|
|
331
|
+
}
|
|
332
|
+
function filterRuntimeTopology(source, target, matches, seen) {
|
|
333
|
+
if (source.status !== "found")
|
|
334
|
+
return { ...source, value: undefined };
|
|
335
|
+
const topology = source.value;
|
|
336
|
+
const sessions = topology.sessions.filter((entry) => {
|
|
337
|
+
const id = entry.id;
|
|
338
|
+
const backendSessionId = entry.backendSessionId;
|
|
339
|
+
const worktreePath = entry.worktreePath;
|
|
340
|
+
const label = entry.label;
|
|
341
|
+
const matched = matchesString(id, target) ||
|
|
342
|
+
matchesString(backendSessionId, target) ||
|
|
343
|
+
matchesString(worktreePath, target) ||
|
|
344
|
+
matchesString(label, target);
|
|
345
|
+
if (matched) {
|
|
346
|
+
addMatch(matches, seen, {
|
|
347
|
+
canonicalKey: sessionCanonical(id, backendSessionId),
|
|
348
|
+
kind: backendSessionId === target && id !== target ? "backend-session" : "session",
|
|
349
|
+
source: "runtimeTopology",
|
|
350
|
+
id,
|
|
351
|
+
backendSessionId,
|
|
352
|
+
worktreePath,
|
|
353
|
+
label,
|
|
354
|
+
raw: entry,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
return matched;
|
|
358
|
+
});
|
|
359
|
+
const services = topology.services.filter((entry) => {
|
|
360
|
+
const matched = matchesString(entry.id, target) ||
|
|
361
|
+
matchesString(entry.worktreePath, target) ||
|
|
362
|
+
matchesString(entry.cwd, target) ||
|
|
363
|
+
matchesString(entry.label, target) ||
|
|
364
|
+
matchesString(entry.launchCommandLine, target);
|
|
365
|
+
if (matched) {
|
|
366
|
+
addMatch(matches, seen, {
|
|
367
|
+
canonicalKey: serviceCanonical(entry.id, entry.worktreePath),
|
|
368
|
+
kind: "service",
|
|
369
|
+
source: "runtimeTopology",
|
|
370
|
+
id: entry.id,
|
|
371
|
+
worktreePath: entry.worktreePath,
|
|
372
|
+
label: entry.label,
|
|
373
|
+
raw: entry,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
return matched;
|
|
377
|
+
});
|
|
378
|
+
const worktrees = topology.worktrees.filter((entry) => {
|
|
379
|
+
const matched = matchesString(entry.name, target) || matchesString(entry.path, target) || matchesString(entry.branch, target);
|
|
380
|
+
if (matched) {
|
|
381
|
+
addMatch(matches, seen, {
|
|
382
|
+
canonicalKey: worktreeCanonical(entry.path, entry.name),
|
|
383
|
+
kind: "worktree",
|
|
384
|
+
source: "runtimeTopology",
|
|
385
|
+
worktreePath: entry.path,
|
|
386
|
+
worktreeName: entry.name,
|
|
387
|
+
raw: entry,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
return matched;
|
|
391
|
+
});
|
|
392
|
+
return { status: "found", path: source.path, value: { sessions, services, worktrees } };
|
|
393
|
+
}
|
|
394
|
+
function filterWorktreeGraveyard(source, target, matches, seen) {
|
|
395
|
+
if (source.status !== "found")
|
|
396
|
+
return { ...source, value: undefined };
|
|
397
|
+
const entries = asArray(source.value).filter((entry) => {
|
|
398
|
+
const record = asObject(entry);
|
|
399
|
+
const name = getString(record, "name");
|
|
400
|
+
const path = getString(record, "path");
|
|
401
|
+
const branch = getString(record, "branch");
|
|
402
|
+
const agents = asArray(record?.agents);
|
|
403
|
+
const services = asArray(record?.services);
|
|
404
|
+
const childMatched = [...agents, ...services].some((child) => {
|
|
405
|
+
const childRecord = asObject(child);
|
|
406
|
+
return (matchesString(getString(childRecord, "id"), target) ||
|
|
407
|
+
matchesString(getString(childRecord, "backendSessionId"), target));
|
|
408
|
+
});
|
|
409
|
+
const matched = childMatched || matchesString(name, target) || matchesString(path, target) || matchesString(branch, target);
|
|
410
|
+
if (matched) {
|
|
411
|
+
addMatch(matches, seen, {
|
|
412
|
+
canonicalKey: worktreeCanonical(path, name),
|
|
413
|
+
kind: "worktree",
|
|
414
|
+
source: "worktreeGraveyard",
|
|
415
|
+
worktreePath: path,
|
|
416
|
+
worktreeName: name,
|
|
417
|
+
raw: entry,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
return matched;
|
|
421
|
+
});
|
|
422
|
+
return { status: "found", path: source.path, value: { entries } };
|
|
423
|
+
}
|
|
424
|
+
function filterNotifications(source, target, matches, seen) {
|
|
425
|
+
if (source.status !== "found")
|
|
426
|
+
return { ...source, value: undefined };
|
|
427
|
+
const exchange = source.value;
|
|
428
|
+
if (!exchange)
|
|
429
|
+
return { ...source, value: { notifications: [] } };
|
|
430
|
+
const messagesByThread = new Map(exchange.messages.map((message) => [message.threadId, message]));
|
|
431
|
+
const notifications = exchange.threads.filter((entry) => {
|
|
432
|
+
if (!entry.tags?.includes("notification"))
|
|
433
|
+
return false;
|
|
434
|
+
const message = messagesByThread.get(entry.id);
|
|
435
|
+
const sessionId = typeof message?.metadata?.notificationSessionId === "string" ? message.metadata.notificationSessionId : undefined;
|
|
436
|
+
const targetKey = typeof message?.metadata?.notificationTargetKey === "string" ? message.metadata.notificationTargetKey : undefined;
|
|
437
|
+
const id = typeof message?.metadata?.notificationRecordId === "string" ? message.metadata.notificationRecordId : entry.id;
|
|
438
|
+
const matched = matchesString(sessionId, target) || matchesString(targetKey, target) || matchesString(id, target);
|
|
439
|
+
if (matched) {
|
|
440
|
+
addMatch(matches, seen, {
|
|
441
|
+
canonicalKey: `notification:${id ?? targetKey ?? sessionId ?? "unknown"}`,
|
|
442
|
+
kind: "notification",
|
|
443
|
+
source: "runtimeExchange",
|
|
444
|
+
id,
|
|
445
|
+
raw: entry,
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
return matched;
|
|
449
|
+
});
|
|
450
|
+
return { status: "found", path: source.path, value: { notifications } };
|
|
451
|
+
}
|
|
452
|
+
function filterOperationFailures(source, target, matches, seen) {
|
|
453
|
+
if (source.status !== "found")
|
|
454
|
+
return { ...source, value: undefined };
|
|
455
|
+
const failures = asArray(asObject(source.value)?.failures).filter((entry) => {
|
|
456
|
+
const record = asObject(entry);
|
|
457
|
+
const id = getString(record, "id");
|
|
458
|
+
const targetId = getString(record, "targetId");
|
|
459
|
+
const worktreePath = getString(record, "worktreePath");
|
|
460
|
+
const worktreeName = getString(record, "worktreeName");
|
|
461
|
+
const matched = matchesString(id, target) ||
|
|
462
|
+
matchesString(targetId, target) ||
|
|
463
|
+
matchesString(worktreePath, target) ||
|
|
464
|
+
matchesString(worktreeName, target);
|
|
465
|
+
if (matched) {
|
|
466
|
+
addMatch(matches, seen, {
|
|
467
|
+
canonicalKey: `operation-failure:${id ?? targetId ?? worktreePath ?? "unknown"}`,
|
|
468
|
+
kind: "operation-failure",
|
|
469
|
+
source: "operationFailures",
|
|
470
|
+
id,
|
|
471
|
+
worktreePath,
|
|
472
|
+
worktreeName,
|
|
473
|
+
raw: entry,
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
return matched;
|
|
477
|
+
});
|
|
478
|
+
return { status: "found", path: source.path, value: { failures } };
|
|
479
|
+
}
|
|
480
|
+
function resolveStatus(matches) {
|
|
481
|
+
const canonicalKeys = new Set(matches.map((match) => match.canonicalKey));
|
|
482
|
+
if (canonicalKeys.size === 0)
|
|
483
|
+
return { status: "missing", entityCount: 0 };
|
|
484
|
+
if (canonicalKeys.size === 1)
|
|
485
|
+
return { status: "matched", entityCount: 1 };
|
|
486
|
+
return { status: "ambiguous", entityCount: canonicalKeys.size };
|
|
487
|
+
}
|
|
488
|
+
export function buildDebugStateReport(options) {
|
|
489
|
+
const cwd = options.cwd ?? process.cwd();
|
|
490
|
+
const paths = options.paths ?? getReadOnlyProjectPathsFor(cwd);
|
|
491
|
+
const matches = [];
|
|
492
|
+
const seen = new Set();
|
|
493
|
+
const target = options.target;
|
|
494
|
+
const savedState = filterSavedState(readJson(paths.statePath), target, matches, seen);
|
|
495
|
+
const rawRuntimeTopology = readRuntimeTopology(paths.runtimeTopologyPath);
|
|
496
|
+
const rawRuntimeExchange = readRuntimeExchange(paths.runtimeExchangePath);
|
|
497
|
+
const runtimeTopology = filterRuntimeTopology(rawRuntimeTopology, target, matches, seen);
|
|
498
|
+
const metadata = filterMetadata(readJson(paths.metadataPath), target, matches, seen);
|
|
499
|
+
const tmux = filterTmux(options.tmuxWindows, paths, target, matches, seen);
|
|
500
|
+
const gitWorktrees = filterGitWorktrees(options.worktrees, paths, target, matches, seen);
|
|
501
|
+
const graveyard = filterGraveyard(runtimeTopology, target, matches, seen);
|
|
502
|
+
const worktreeGraveyard = filterWorktreeGraveyard(rawRuntimeTopology.status === "found"
|
|
503
|
+
? { status: "found", path: rawRuntimeTopology.path, value: rawRuntimeTopology.value?.worktreeGraveyard ?? [] }
|
|
504
|
+
: rawRuntimeTopology, target, matches, seen);
|
|
505
|
+
const notifications = filterNotifications(rawRuntimeExchange, target, matches, seen);
|
|
506
|
+
const operationFailures = filterOperationFailures(readJson(paths.dashboardOperationFailuresPath), target, matches, seen);
|
|
507
|
+
const resolution = resolveStatus(matches);
|
|
508
|
+
return {
|
|
509
|
+
version: 1,
|
|
510
|
+
target,
|
|
511
|
+
project: {
|
|
512
|
+
repoRoot: paths.repoRoot,
|
|
513
|
+
projectId: paths.projectId,
|
|
514
|
+
projectStateDir: paths.projectStateDir,
|
|
515
|
+
localAimuxDir: paths.localAimuxDir,
|
|
516
|
+
},
|
|
517
|
+
targetResolution: {
|
|
518
|
+
...resolution,
|
|
519
|
+
matches,
|
|
520
|
+
},
|
|
521
|
+
sourceRoles: DEBUG_STATE_SOURCE_ROLES,
|
|
522
|
+
sources: {
|
|
523
|
+
savedState,
|
|
524
|
+
runtimeTopology,
|
|
525
|
+
metadata,
|
|
526
|
+
tmux,
|
|
527
|
+
gitWorktrees,
|
|
528
|
+
graveyard,
|
|
529
|
+
worktreeGraveyard,
|
|
530
|
+
notifications,
|
|
531
|
+
operationFailures,
|
|
532
|
+
runtimeRows: sourceUnavailable("standalone debug-state does not attach to the live project runtime"),
|
|
533
|
+
pendingActions: sourceUnavailable("pending actions are in-memory dashboard state"),
|
|
534
|
+
dashboardSnapshot: sourceUnavailable("dashboard snapshot requires project-service/dashboard runtime"),
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
export function renderDebugStateReport(report) {
|
|
539
|
+
return JSON.stringify(report, null, 2);
|
|
540
|
+
}
|
package/dist/debug.d.ts
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
import type { LoggingConfig, LogLevel } from "./config.js";
|
|
2
|
+
export interface LoggingRuntimeConfig extends LoggingConfig {
|
|
3
|
+
path: string;
|
|
4
|
+
processKind: "cli" | "daemon" | "project-service" | "test" | string;
|
|
5
|
+
projectId?: string;
|
|
6
|
+
projectRoot?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LoggingCliOptions {
|
|
9
|
+
debug?: boolean;
|
|
10
|
+
trace?: boolean;
|
|
11
|
+
logLevel?: string;
|
|
12
|
+
logCategory?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ResolveLoggingOptions {
|
|
15
|
+
config: LoggingConfig;
|
|
16
|
+
env?: Record<string, string | undefined>;
|
|
17
|
+
cli?: LoggingCliOptions;
|
|
18
|
+
path: string;
|
|
19
|
+
processKind: LoggingRuntimeConfig["processKind"];
|
|
20
|
+
projectId?: string;
|
|
21
|
+
projectRoot?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface LogFields {
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
export declare function parseLogCategories(value: string | undefined): string[] | undefined;
|
|
27
|
+
export declare function resolveLoggingRuntimeConfig(options: ResolveLoggingOptions): LoggingRuntimeConfig;
|
|
28
|
+
export declare function configureLogging(config: Partial<LoggingRuntimeConfig>): LoggingRuntimeConfig;
|
|
29
|
+
export declare function getLoggingConfig(): LoggingRuntimeConfig;
|
|
30
|
+
export declare function resetLoggingForTests(): void;
|
|
31
|
+
export declare function logAt(level: LogLevel, message: string, category?: string, fields?: LogFields): void;
|
|
32
|
+
export declare const log: {
|
|
33
|
+
error: (message: string, category?: string, fields?: LogFields) => void;
|
|
34
|
+
warn: (message: string, category?: string, fields?: LogFields) => void;
|
|
35
|
+
info: (message: string, category?: string, fields?: LogFields) => void;
|
|
36
|
+
debug: (message: string, category?: string, fields?: LogFields) => void;
|
|
37
|
+
trace: (message: string, category?: string, fields?: LogFields) => void;
|
|
38
|
+
};
|
|
1
39
|
export declare function debug(msg: string, category?: string): void;
|
|
2
40
|
export declare function debugContext(action: string, file: string, sizeBytes: number): void;
|
|
3
41
|
export declare function debugCompact(sessionCount: number, totalTurns: number): void;
|