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
package/dist/notifications.js
CHANGED
|
@@ -1,48 +1,8 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const path = getNotificationsPath();
|
|
7
|
-
if (!existsSync(path))
|
|
8
|
-
return { version: 1, notifications: [] };
|
|
9
|
-
try {
|
|
10
|
-
const raw = readFileSync(path, "utf8");
|
|
11
|
-
const parsed = JSON.parse(raw);
|
|
12
|
-
if (parsed.version !== 1 || !Array.isArray(parsed.notifications)) {
|
|
13
|
-
return { version: 1, notifications: [] };
|
|
14
|
-
}
|
|
15
|
-
return parsed;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return { version: 1, notifications: [] };
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function saveState(state) {
|
|
22
|
-
writeJsonAtomic(getNotificationsPath(), state);
|
|
23
|
-
}
|
|
24
|
-
export function addNotification(input) {
|
|
25
|
-
const now = input.createdAt ?? new Date().toISOString();
|
|
26
|
-
const state = loadState();
|
|
27
|
-
const record = {
|
|
28
|
-
id: randomUUID(),
|
|
29
|
-
title: input.title.trim() || "aimux",
|
|
30
|
-
subtitle: input.subtitle?.trim() || undefined,
|
|
31
|
-
body: input.body.trim() || input.title.trim() || "aimux",
|
|
32
|
-
sessionId: input.sessionId?.trim() || undefined,
|
|
33
|
-
targetKey: normalizeTargetKey(input),
|
|
34
|
-
targetKind: normalizeTargetKind(input),
|
|
35
|
-
kind: input.kind?.trim() || undefined,
|
|
36
|
-
unread: input.unread ?? true,
|
|
37
|
-
cleared: false,
|
|
38
|
-
createdAt: now,
|
|
39
|
-
updatedAt: now,
|
|
40
|
-
dedupeKey: input.dedupeKey?.trim() || undefined,
|
|
41
|
-
};
|
|
42
|
-
state.notifications.unshift(record);
|
|
43
|
-
saveState(state);
|
|
44
|
-
return record;
|
|
45
|
-
}
|
|
2
|
+
import { deriveRuntimeExchangeIndexes } from "./runtime-core/exchange-derived.js";
|
|
3
|
+
import { createRuntimeExchangeStore, } from "./runtime-core/exchange-store.js";
|
|
4
|
+
const PROJECT_NOTIFICATION_PARTICIPANT = "project";
|
|
5
|
+
const NOTIFICATION_TAG = "notification";
|
|
46
6
|
function normalizeTargetKey(input) {
|
|
47
7
|
const targetKey = input.targetKey?.trim();
|
|
48
8
|
if (targetKey)
|
|
@@ -53,39 +13,127 @@ function normalizeTargetKey(input) {
|
|
|
53
13
|
function normalizeTargetKind(input) {
|
|
54
14
|
if (input.targetKind)
|
|
55
15
|
return input.targetKind;
|
|
56
|
-
return input.sessionId?.trim() ? "session" :
|
|
16
|
+
return input.sessionId?.trim() ? "session" : "generic";
|
|
57
17
|
}
|
|
58
|
-
function
|
|
59
|
-
|
|
18
|
+
function metadataString(message, key) {
|
|
19
|
+
const value = message?.metadata?.[key];
|
|
20
|
+
return typeof value === "string" && value.trim() ? value : undefined;
|
|
60
21
|
}
|
|
61
|
-
|
|
62
|
-
|
|
22
|
+
function metadataBoolean(message, key) {
|
|
23
|
+
return message?.metadata?.[key] === true;
|
|
24
|
+
}
|
|
25
|
+
function notificationThreadId(targetKey) {
|
|
63
26
|
if (!targetKey)
|
|
64
|
-
return
|
|
27
|
+
return `notification-${randomUUID()}`;
|
|
28
|
+
return `notification-${Buffer.from(targetKey).toString("base64url")}`;
|
|
29
|
+
}
|
|
30
|
+
function threadLatestMessage(exchange, threadId) {
|
|
31
|
+
return exchange.messages
|
|
32
|
+
.filter((message) => message.threadId === threadId)
|
|
33
|
+
.sort((a, b) => b.ts.localeCompare(a.ts))[0];
|
|
34
|
+
}
|
|
35
|
+
function entryForThread(exchange, thread) {
|
|
36
|
+
return exchange.inbox.find((entry) => entry.subjectKind === "thread" && entry.subjectId === thread.id);
|
|
37
|
+
}
|
|
38
|
+
function notificationRecord(exchange, thread, message) {
|
|
39
|
+
const entry = entryForThread(exchange, thread);
|
|
40
|
+
const sessionId = metadataString(message, "notificationSessionId");
|
|
41
|
+
const targetKey = metadataString(message, "notificationTargetKey");
|
|
42
|
+
const targetKind = metadataString(message, "notificationTargetKind");
|
|
43
|
+
return {
|
|
44
|
+
id: metadataString(message, "notificationRecordId") ?? thread.id,
|
|
45
|
+
title: thread.title,
|
|
46
|
+
subtitle: metadataString(message, "notificationSubtitle"),
|
|
47
|
+
body: message.body,
|
|
48
|
+
sessionId,
|
|
49
|
+
targetKey,
|
|
50
|
+
targetKind,
|
|
51
|
+
kind: metadataString(message, "notificationKind"),
|
|
52
|
+
unread: Boolean(entry && entry.state !== "done"),
|
|
53
|
+
cleared: metadataBoolean(message, "notificationCleared"),
|
|
54
|
+
createdAt: thread.createdAt,
|
|
55
|
+
updatedAt: thread.updatedAt,
|
|
56
|
+
dedupeKey: metadataString(message, "notificationDedupeKey"),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function notificationRecords(exchange = createRuntimeExchangeStore().read()) {
|
|
60
|
+
return exchange.threads
|
|
61
|
+
.filter((thread) => thread.tags?.includes(NOTIFICATION_TAG))
|
|
62
|
+
.map((thread) => {
|
|
63
|
+
const message = threadLatestMessage(exchange, thread.id);
|
|
64
|
+
return message ? notificationRecord(exchange, thread, message) : undefined;
|
|
65
|
+
})
|
|
66
|
+
.filter((record) => Boolean(record))
|
|
67
|
+
.sort((a, b) => b.createdAt.localeCompare(a.createdAt));
|
|
68
|
+
}
|
|
69
|
+
function writeNotification(input) {
|
|
65
70
|
const now = input.createdAt ?? new Date().toISOString();
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
71
|
+
const sessionId = input.sessionId?.trim() || undefined;
|
|
72
|
+
const targetKey = normalizeTargetKey(input);
|
|
73
|
+
const targetKind = normalizeTargetKind(input);
|
|
74
|
+
const threadId = input.replaceTarget ? notificationThreadId(targetKey) : notificationThreadId();
|
|
75
|
+
const participantId = sessionId ?? PROJECT_NOTIFICATION_PARTICIPANT;
|
|
76
|
+
const thread = {
|
|
77
|
+
id: threadId,
|
|
69
78
|
title: input.title.trim() || "aimux",
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
sessionId: input.sessionId?.trim() || undefined,
|
|
73
|
-
targetKey,
|
|
74
|
-
targetKind: normalizeTargetKind(input),
|
|
75
|
-
kind: input.kind?.trim() || undefined,
|
|
76
|
-
unread: input.unread ?? true,
|
|
77
|
-
cleared: false,
|
|
79
|
+
kind: "conversation",
|
|
80
|
+
status: "open",
|
|
78
81
|
createdAt: now,
|
|
79
82
|
updatedAt: now,
|
|
80
|
-
|
|
83
|
+
createdBy: "aimux",
|
|
84
|
+
participants: ["aimux", participantId],
|
|
85
|
+
lastMessageId: `message-${threadId}`,
|
|
86
|
+
unreadBy: input.unread === false ? [] : [participantId],
|
|
87
|
+
tags: [NOTIFICATION_TAG],
|
|
81
88
|
};
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
const message = {
|
|
90
|
+
id: `message-${threadId}`,
|
|
91
|
+
threadId,
|
|
92
|
+
ts: now,
|
|
93
|
+
from: "aimux",
|
|
94
|
+
to: [participantId],
|
|
95
|
+
kind: "note",
|
|
96
|
+
body: input.body.trim() || input.title.trim() || "aimux",
|
|
97
|
+
metadata: {
|
|
98
|
+
notificationRecordId: randomUUID(),
|
|
99
|
+
notificationSubtitle: input.subtitle?.trim() || null,
|
|
100
|
+
notificationSessionId: sessionId ?? null,
|
|
101
|
+
notificationTargetKey: targetKey ?? null,
|
|
102
|
+
notificationTargetKind: targetKind ?? null,
|
|
103
|
+
notificationKind: input.kind?.trim() || null,
|
|
104
|
+
notificationDedupeKey: input.dedupeKey?.trim() || null,
|
|
105
|
+
notificationCleared: false,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
let record;
|
|
109
|
+
createRuntimeExchangeStore().update((exchange) => {
|
|
110
|
+
const next = deriveRuntimeExchangeIndexes({
|
|
111
|
+
...exchange,
|
|
112
|
+
generatedAt: now,
|
|
113
|
+
threads: [...exchange.threads.filter((existing) => existing.id !== threadId), thread],
|
|
114
|
+
messages: [...exchange.messages.filter((existing) => existing.threadId !== threadId), message],
|
|
115
|
+
});
|
|
116
|
+
const inbox = input.unread === false
|
|
117
|
+
? next.inbox.map((entry) => entry.subjectKind === "thread" && entry.subjectId === threadId
|
|
118
|
+
? { ...entry, state: "done" }
|
|
119
|
+
: entry)
|
|
120
|
+
: next.inbox;
|
|
121
|
+
const updated = { ...next, inbox };
|
|
122
|
+
record = notificationRecord(updated, thread, message);
|
|
123
|
+
return updated;
|
|
124
|
+
});
|
|
125
|
+
if (!record)
|
|
126
|
+
throw new Error("failed to write notification");
|
|
84
127
|
return record;
|
|
85
128
|
}
|
|
129
|
+
export function addNotification(input) {
|
|
130
|
+
return writeNotification(input);
|
|
131
|
+
}
|
|
132
|
+
export function upsertNotification(input) {
|
|
133
|
+
return writeNotification({ ...input, replaceTarget: Boolean(normalizeTargetKey(input)) });
|
|
134
|
+
}
|
|
86
135
|
export function listNotifications(opts) {
|
|
87
|
-
|
|
88
|
-
return state.notifications.filter((record) => {
|
|
136
|
+
return notificationRecords().filter((record) => {
|
|
89
137
|
if (!opts?.includeCleared && record.cleared)
|
|
90
138
|
return false;
|
|
91
139
|
if (opts?.unreadOnly && !record.unread)
|
|
@@ -96,49 +144,63 @@ export function listNotifications(opts) {
|
|
|
96
144
|
});
|
|
97
145
|
}
|
|
98
146
|
export function markNotificationsRead(opts) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
const now = new Date().toISOString();
|
|
102
|
-
state.notifications = state.notifications.map((record) => {
|
|
147
|
+
const store = createRuntimeExchangeStore();
|
|
148
|
+
const records = notificationRecords(store.read()).filter((record) => {
|
|
103
149
|
if (record.cleared || !record.unread)
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
...record,
|
|
112
|
-
unread: false,
|
|
113
|
-
updatedAt: now,
|
|
114
|
-
};
|
|
150
|
+
return false;
|
|
151
|
+
if (opts?.id && record.id !== opts.id)
|
|
152
|
+
return false;
|
|
153
|
+
if (opts?.sessionId && record.sessionId !== opts.sessionId)
|
|
154
|
+
return false;
|
|
155
|
+
return true;
|
|
115
156
|
});
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
157
|
+
if (records.length === 0)
|
|
158
|
+
return 0;
|
|
159
|
+
const threadIds = new Set(records
|
|
160
|
+
.map((record) => {
|
|
161
|
+
const exchange = store.read();
|
|
162
|
+
return exchange.threads.find((thread) => {
|
|
163
|
+
const message = threadLatestMessage(exchange, thread.id);
|
|
164
|
+
return message && notificationRecord(exchange, thread, message).id === record.id;
|
|
165
|
+
})?.id;
|
|
166
|
+
})
|
|
167
|
+
.filter((id) => Boolean(id)));
|
|
168
|
+
store.update((exchange) => ({
|
|
169
|
+
...exchange,
|
|
170
|
+
inbox: exchange.inbox.map((entry) => entry.subjectKind === "thread" && threadIds.has(entry.subjectId) ? { ...entry, state: "done" } : entry),
|
|
171
|
+
}));
|
|
172
|
+
return records.length;
|
|
119
173
|
}
|
|
120
174
|
export function clearNotifications(opts) {
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const now = new Date().toISOString();
|
|
124
|
-
state.notifications = state.notifications.map((record) => {
|
|
175
|
+
const store = createRuntimeExchangeStore();
|
|
176
|
+
const records = notificationRecords(store.read()).filter((record) => {
|
|
125
177
|
if (record.cleared)
|
|
126
|
-
return
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
131
|
-
|
|
178
|
+
return false;
|
|
179
|
+
if (opts?.id && record.id !== opts.id)
|
|
180
|
+
return false;
|
|
181
|
+
if (opts?.sessionId && record.sessionId !== opts.sessionId)
|
|
182
|
+
return false;
|
|
183
|
+
return true;
|
|
184
|
+
});
|
|
185
|
+
if (records.length === 0)
|
|
186
|
+
return 0;
|
|
187
|
+
const recordIds = new Set(records.map((record) => record.id));
|
|
188
|
+
store.update((exchange) => {
|
|
189
|
+
const threadIds = new Set(exchange.threads
|
|
190
|
+
.map((thread) => {
|
|
191
|
+
const message = threadLatestMessage(exchange, thread.id);
|
|
192
|
+
return message && recordIds.has(notificationRecord(exchange, thread, message).id) ? thread.id : undefined;
|
|
193
|
+
})
|
|
194
|
+
.filter((id) => Boolean(id)));
|
|
132
195
|
return {
|
|
133
|
-
...
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
196
|
+
...exchange,
|
|
197
|
+
messages: exchange.messages.map((message) => message.threadId && threadIds.has(message.threadId)
|
|
198
|
+
? { ...message, metadata: { ...(message.metadata ?? {}), notificationCleared: true } }
|
|
199
|
+
: message),
|
|
200
|
+
inbox: exchange.inbox.map((entry) => entry.subjectKind === "thread" && threadIds.has(entry.subjectId) ? { ...entry, state: "done" } : entry),
|
|
137
201
|
};
|
|
138
202
|
});
|
|
139
|
-
|
|
140
|
-
saveState(state);
|
|
141
|
-
return changed;
|
|
203
|
+
return records.length;
|
|
142
204
|
}
|
|
143
205
|
export function unreadNotificationCount(opts) {
|
|
144
206
|
return listNotifications({ unreadOnly: true, sessionId: opts?.sessionId }).length;
|
|
@@ -163,4 +225,3 @@ export function summarizeUnreadNotificationsBySession() {
|
|
|
163
225
|
}
|
|
164
226
|
return summaries;
|
|
165
227
|
}
|
|
166
|
-
//# sourceMappingURL=notifications.js.map
|
package/dist/notify.d.ts
CHANGED
|
@@ -8,3 +8,7 @@ export declare function notifyError(sessionId: string, message?: string): void;
|
|
|
8
8
|
/** Notify that an agent completed (exited cleanly) */
|
|
9
9
|
export declare function notifyComplete(sessionId: string): void;
|
|
10
10
|
export declare function notifyAlert(event: AlertEvent): void;
|
|
11
|
+
export declare function notifyRemoteClientConnected(input: {
|
|
12
|
+
title?: unknown;
|
|
13
|
+
body?: unknown;
|
|
14
|
+
}): void;
|
package/dist/notify.js
CHANGED
|
@@ -38,6 +38,15 @@ function send(title, message) {
|
|
|
38
38
|
}
|
|
39
39
|
debug(`notification: ${message}`, "notify");
|
|
40
40
|
}
|
|
41
|
+
function sendSecurity(title, message) {
|
|
42
|
+
if (process.platform === "darwin") {
|
|
43
|
+
sendMacNotification(title, message);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
notifier.notify({ title, message, sound: true });
|
|
47
|
+
}
|
|
48
|
+
debug(`security notification: ${message}`, "notify");
|
|
49
|
+
}
|
|
41
50
|
/** Notify that an agent is waiting for input */
|
|
42
51
|
export function notifyPrompt(sessionId) {
|
|
43
52
|
if (!getNotifyConfig().onPrompt)
|
|
@@ -77,4 +86,8 @@ export function notifyAlert(event) {
|
|
|
77
86
|
return;
|
|
78
87
|
send(event.title || "aimux", event.message || event.sessionId || event.kind);
|
|
79
88
|
}
|
|
80
|
-
|
|
89
|
+
export function notifyRemoteClientConnected(input) {
|
|
90
|
+
const title = typeof input.title === "string" && input.title.trim().length > 0 ? input.title : "aimux remote access";
|
|
91
|
+
const body = typeof input.body === "string" && input.body.trim().length > 0 ? input.body : "Remote client connected";
|
|
92
|
+
sendSecurity(title, body);
|
|
93
|
+
}
|
package/dist/orchestration.js
CHANGED
package/dist/paths.d.ts
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Two locations:
|
|
5
5
|
* - In-repo: {repoRoot}/.aimux/ → agent-facing shared artifacts
|
|
6
|
-
* (config, team, plans, context, history, tasks, status, threads
|
|
6
|
+
* (config, team, plans, context, history, tasks, status, threads)
|
|
7
7
|
* - Global: ~/.aimux/projects/<project-id>/ → runtime-private state
|
|
8
8
|
* (recordings, metadata, instance ownership, statusline internals, offline state)
|
|
9
|
+
* Override with AIMUX_HOME for isolated dev/runtime lanes.
|
|
9
10
|
*
|
|
10
11
|
* Must call `await initPaths(cwd)` once at startup before using sync path functions.
|
|
11
12
|
*/
|
|
@@ -21,23 +22,49 @@ export declare function getProjectId(): string;
|
|
|
21
22
|
export declare function getProjectIdFor(cwd: string): string;
|
|
22
23
|
export declare function getProjectStateDirFor(cwd: string): string;
|
|
23
24
|
export declare function getProjectStateDirById(projectId: string): string;
|
|
25
|
+
export interface ReadOnlyProjectPaths {
|
|
26
|
+
repoRoot: string;
|
|
27
|
+
projectId: string;
|
|
28
|
+
projectStateDir: string;
|
|
29
|
+
localAimuxDir: string;
|
|
30
|
+
statePath: string;
|
|
31
|
+
runtimeTopologyPath: string;
|
|
32
|
+
runtimeExchangePath: string;
|
|
33
|
+
metadataPath: string;
|
|
34
|
+
notificationContextPath: string;
|
|
35
|
+
dashboardOperationFailuresPath: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve aimux project paths without initializing or registering the project.
|
|
39
|
+
* Use this for diagnostics that must not create directories, migrate files, or
|
|
40
|
+
* update project registry state as a side effect.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getReadOnlyProjectPathsFor(cwd: string): ReadOnlyProjectPaths;
|
|
24
43
|
export declare function getGlobalAimuxDir(): string;
|
|
25
44
|
export declare function getDaemonDir(): string;
|
|
45
|
+
export declare function getAuthPath(): string;
|
|
26
46
|
export declare function getDaemonInfoPath(): string;
|
|
27
47
|
export declare function getDaemonStatePath(): string;
|
|
48
|
+
export declare function getDaemonLogsDir(): string;
|
|
49
|
+
export declare function getDaemonLogPath(): string;
|
|
50
|
+
export declare function getDaemonStdioLogPath(): string;
|
|
28
51
|
export declare function getProjectStateDir(): string;
|
|
52
|
+
export declare function getProjectLogsDir(): string;
|
|
53
|
+
export declare function getProjectLogPath(): string;
|
|
54
|
+
export declare function getProjectServiceStdioLogPath(): string;
|
|
55
|
+
export declare function getProjectLogsDirFor(cwd: string): string;
|
|
56
|
+
export declare function getProjectLogPathFor(cwd: string): string;
|
|
57
|
+
export declare function getProjectServiceStdioLogPathFor(cwd: string): string;
|
|
29
58
|
export declare function getStatePath(): string;
|
|
30
|
-
export declare function getGraveyardPath(): string;
|
|
31
|
-
export declare function getWorktreeGraveyardPath(): string;
|
|
32
59
|
export declare function getContextDir(): string;
|
|
33
60
|
export declare function getContextPathForDate(date: Date): string;
|
|
34
61
|
export declare function getHistoryDir(): string;
|
|
35
62
|
export declare function getRecordingsDir(): string;
|
|
36
63
|
export declare function getTasksDir(): string;
|
|
37
64
|
export declare function getStatusDir(): string;
|
|
38
|
-
export declare function getInstancesPath(): string;
|
|
39
65
|
export declare function getMetadataPath(): string;
|
|
40
|
-
export declare function
|
|
66
|
+
export declare function getRuntimeTopologyPath(): string;
|
|
67
|
+
export declare function getRuntimeExchangePath(): string;
|
|
41
68
|
export declare function getNotificationContextPath(): string;
|
|
42
69
|
export declare function getMetadataEndpointPath(): string;
|
|
43
70
|
export declare function getDashboardUiStatePath(): string;
|
|
@@ -49,8 +76,6 @@ export declare function getProjectTeamPath(): string;
|
|
|
49
76
|
export declare function getPlansDir(): string;
|
|
50
77
|
export declare function getThreadsDir(): string;
|
|
51
78
|
export declare function getAttachmentsDir(): string;
|
|
52
|
-
export declare function getSessionMessagesDir(): string;
|
|
53
|
-
export declare function getSessionInputOperationsDir(): string;
|
|
54
79
|
/** Escape hatch for cross-worktree operations. Prefer the no-arg variants above. */
|
|
55
80
|
export declare function getAimuxDirFor(cwd: string): string;
|
|
56
81
|
export declare function getGlobalConfigPath(): string;
|
package/dist/paths.js
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Two locations:
|
|
5
5
|
* - In-repo: {repoRoot}/.aimux/ → agent-facing shared artifacts
|
|
6
|
-
* (config, team, plans, context, history, tasks, status, threads
|
|
6
|
+
* (config, team, plans, context, history, tasks, status, threads)
|
|
7
7
|
* - Global: ~/.aimux/projects/<project-id>/ → runtime-private state
|
|
8
8
|
* (recordings, metadata, instance ownership, statusline internals, offline state)
|
|
9
|
+
* Override with AIMUX_HOME for isolated dev/runtime lanes.
|
|
9
10
|
*
|
|
10
11
|
* Must call `await initPaths(cwd)` once at startup before using sync path functions.
|
|
11
12
|
*/
|
|
12
13
|
import { createHash } from "node:crypto";
|
|
13
14
|
import { execSync } from "node:child_process";
|
|
14
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync
|
|
15
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
15
16
|
import { join, basename, resolve, dirname, sep } from "node:path";
|
|
16
17
|
import { homedir } from "node:os";
|
|
17
18
|
// ── Cached state (populated by initPaths) ──────────────────────────
|
|
@@ -31,8 +32,17 @@ function resolveRepoRoot(cwd) {
|
|
|
31
32
|
return resolvedCwd.slice(0, markerIndex);
|
|
32
33
|
}
|
|
33
34
|
try {
|
|
35
|
+
// Strip inherited GIT_* env so the command honors `cwd` even when invoked
|
|
36
|
+
// from a context (e.g. git hook) where the parent set GIT_DIR/GIT_WORK_TREE.
|
|
37
|
+
const env = { ...process.env };
|
|
38
|
+
delete env.GIT_DIR;
|
|
39
|
+
delete env.GIT_WORK_TREE;
|
|
40
|
+
delete env.GIT_INDEX_FILE;
|
|
41
|
+
delete env.GIT_OBJECT_DIRECTORY;
|
|
42
|
+
delete env.GIT_COMMON_DIR;
|
|
34
43
|
const gitCommonDir = execSync("git rev-parse --git-common-dir", {
|
|
35
44
|
cwd,
|
|
45
|
+
env,
|
|
36
46
|
encoding: "utf-8",
|
|
37
47
|
stdio: ["pipe", "pipe", "pipe"],
|
|
38
48
|
}).trim();
|
|
@@ -66,7 +76,6 @@ export async function initPaths(cwd) {
|
|
|
66
76
|
}
|
|
67
77
|
writeFileSync(join(projectDir, "project-root.txt"), `${_repoRoot}\n`);
|
|
68
78
|
ensureLocalSharedDirs();
|
|
69
|
-
migrateAgentFacingStateToLocal();
|
|
70
79
|
registerProject();
|
|
71
80
|
}
|
|
72
81
|
export function getRepoRoot() {
|
|
@@ -86,32 +95,88 @@ export function getProjectStateDirFor(cwd) {
|
|
|
86
95
|
export function getProjectStateDirById(projectId) {
|
|
87
96
|
return join(getGlobalAimuxDir(), "projects", projectId);
|
|
88
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolve aimux project paths without initializing or registering the project.
|
|
100
|
+
* Use this for diagnostics that must not create directories, migrate files, or
|
|
101
|
+
* update project registry state as a side effect.
|
|
102
|
+
*/
|
|
103
|
+
export function getReadOnlyProjectPathsFor(cwd) {
|
|
104
|
+
const repoRoot = resolveRepoRoot(cwd);
|
|
105
|
+
const projectId = computeProjectId(repoRoot);
|
|
106
|
+
const projectStateDir = join(getGlobalAimuxDir(), "projects", projectId);
|
|
107
|
+
const localAimuxDir = join(repoRoot, ".aimux");
|
|
108
|
+
return {
|
|
109
|
+
repoRoot,
|
|
110
|
+
projectId,
|
|
111
|
+
projectStateDir,
|
|
112
|
+
localAimuxDir,
|
|
113
|
+
statePath: join(projectStateDir, "state.json"),
|
|
114
|
+
runtimeTopologyPath: join(projectStateDir, "runtime-topology.yaml"),
|
|
115
|
+
runtimeExchangePath: join(projectStateDir, "runtime-exchange.yaml"),
|
|
116
|
+
metadataPath: join(projectStateDir, "metadata.json"),
|
|
117
|
+
notificationContextPath: join(projectStateDir, "notification-context.json"),
|
|
118
|
+
dashboardOperationFailuresPath: join(projectStateDir, "dashboard-operation-failures.json"),
|
|
119
|
+
};
|
|
120
|
+
}
|
|
89
121
|
// ── Global paths (~/.aimux/...) ────────────────────────────────────
|
|
90
|
-
|
|
122
|
+
function resolveAimuxHome() {
|
|
123
|
+
const override = process.env.AIMUX_HOME?.trim();
|
|
124
|
+
if (!override)
|
|
125
|
+
return join(homedir(), ".aimux");
|
|
126
|
+
if (override === "~")
|
|
127
|
+
return homedir();
|
|
128
|
+
if (override.startsWith("~/"))
|
|
129
|
+
return resolve(homedir(), override.slice(2));
|
|
130
|
+
return resolve(override);
|
|
131
|
+
}
|
|
91
132
|
export function getGlobalAimuxDir() {
|
|
92
|
-
return
|
|
133
|
+
return resolveAimuxHome();
|
|
93
134
|
}
|
|
94
135
|
export function getDaemonDir() {
|
|
95
136
|
return join(getGlobalAimuxDir(), "daemon");
|
|
96
137
|
}
|
|
138
|
+
export function getAuthPath() {
|
|
139
|
+
return join(getGlobalAimuxDir(), "auth.json");
|
|
140
|
+
}
|
|
97
141
|
export function getDaemonInfoPath() {
|
|
98
142
|
return join(getDaemonDir(), "daemon.json");
|
|
99
143
|
}
|
|
100
144
|
export function getDaemonStatePath() {
|
|
101
145
|
return join(getDaemonDir(), "state.json");
|
|
102
146
|
}
|
|
147
|
+
export function getDaemonLogsDir() {
|
|
148
|
+
return join(getDaemonDir(), "logs");
|
|
149
|
+
}
|
|
150
|
+
export function getDaemonLogPath() {
|
|
151
|
+
return join(getDaemonLogsDir(), "daemon.jsonl");
|
|
152
|
+
}
|
|
153
|
+
export function getDaemonStdioLogPath() {
|
|
154
|
+
return join(getDaemonLogsDir(), "daemon-stdio.log");
|
|
155
|
+
}
|
|
103
156
|
export function getProjectStateDir() {
|
|
104
157
|
assertInitialized();
|
|
105
158
|
return join(getGlobalAimuxDir(), "projects", _projectId);
|
|
106
159
|
}
|
|
107
|
-
export function
|
|
108
|
-
return join(getProjectStateDir(), "
|
|
160
|
+
export function getProjectLogsDir() {
|
|
161
|
+
return join(getProjectStateDir(), "logs");
|
|
162
|
+
}
|
|
163
|
+
export function getProjectLogPath() {
|
|
164
|
+
return join(getProjectLogsDir(), "aimux.jsonl");
|
|
165
|
+
}
|
|
166
|
+
export function getProjectServiceStdioLogPath() {
|
|
167
|
+
return join(getProjectLogsDir(), "project-service-stdio.log");
|
|
168
|
+
}
|
|
169
|
+
export function getProjectLogsDirFor(cwd) {
|
|
170
|
+
return join(getProjectStateDirFor(cwd), "logs");
|
|
109
171
|
}
|
|
110
|
-
export function
|
|
111
|
-
return join(
|
|
172
|
+
export function getProjectLogPathFor(cwd) {
|
|
173
|
+
return join(getProjectLogsDirFor(cwd), "aimux.jsonl");
|
|
112
174
|
}
|
|
113
|
-
export function
|
|
114
|
-
return join(
|
|
175
|
+
export function getProjectServiceStdioLogPathFor(cwd) {
|
|
176
|
+
return join(getProjectLogsDirFor(cwd), "project-service-stdio.log");
|
|
177
|
+
}
|
|
178
|
+
export function getStatePath() {
|
|
179
|
+
return join(getProjectStateDir(), "state.json");
|
|
115
180
|
}
|
|
116
181
|
export function getContextDir() {
|
|
117
182
|
return join(getLocalAimuxDir(), "context");
|
|
@@ -134,14 +199,14 @@ export function getTasksDir() {
|
|
|
134
199
|
export function getStatusDir() {
|
|
135
200
|
return join(getLocalAimuxDir(), "status");
|
|
136
201
|
}
|
|
137
|
-
export function getInstancesPath() {
|
|
138
|
-
return join(getProjectStateDir(), "instances.json");
|
|
139
|
-
}
|
|
140
202
|
export function getMetadataPath() {
|
|
141
203
|
return join(getProjectStateDir(), "metadata.json");
|
|
142
204
|
}
|
|
143
|
-
export function
|
|
144
|
-
return join(getProjectStateDir(), "
|
|
205
|
+
export function getRuntimeTopologyPath() {
|
|
206
|
+
return join(getProjectStateDir(), "runtime-topology.yaml");
|
|
207
|
+
}
|
|
208
|
+
export function getRuntimeExchangePath() {
|
|
209
|
+
return join(getProjectStateDir(), "runtime-exchange.yaml");
|
|
145
210
|
}
|
|
146
211
|
export function getNotificationContextPath() {
|
|
147
212
|
return join(getProjectStateDir(), "notification-context.json");
|
|
@@ -178,12 +243,6 @@ export function getThreadsDir() {
|
|
|
178
243
|
export function getAttachmentsDir() {
|
|
179
244
|
return join(getLocalAimuxDir(), "attachments");
|
|
180
245
|
}
|
|
181
|
-
export function getSessionMessagesDir() {
|
|
182
|
-
return join(getLocalAimuxDir(), "session-messages");
|
|
183
|
-
}
|
|
184
|
-
export function getSessionInputOperationsDir() {
|
|
185
|
-
return join(getLocalAimuxDir(), "session-input-ops");
|
|
186
|
-
}
|
|
187
246
|
/** Escape hatch for cross-worktree operations. Prefer the no-arg variants above. */
|
|
188
247
|
export function getAimuxDirFor(cwd) {
|
|
189
248
|
return join(resolveRepoRoot(cwd), ".aimux");
|
|
@@ -191,45 +250,10 @@ export function getAimuxDirFor(cwd) {
|
|
|
191
250
|
function ensureLocalSharedDirs() {
|
|
192
251
|
const localDir = getLocalAimuxDir();
|
|
193
252
|
mkdirSync(localDir, { recursive: true });
|
|
194
|
-
for (const subdir of [
|
|
195
|
-
"plans",
|
|
196
|
-
"context",
|
|
197
|
-
"history",
|
|
198
|
-
"tasks",
|
|
199
|
-
"status",
|
|
200
|
-
"threads",
|
|
201
|
-
"attachments",
|
|
202
|
-
"session-messages",
|
|
203
|
-
"session-input-ops",
|
|
204
|
-
]) {
|
|
253
|
+
for (const subdir of ["plans", "context", "history", "status", "attachments"]) {
|
|
205
254
|
mkdirSync(join(localDir, subdir), { recursive: true });
|
|
206
255
|
}
|
|
207
256
|
}
|
|
208
|
-
function migrateDirIfNeeded(globalSubdir, localDir) {
|
|
209
|
-
const source = join(getProjectStateDir(), globalSubdir);
|
|
210
|
-
if (!existsSync(source) || !existsSync(localDir))
|
|
211
|
-
return;
|
|
212
|
-
const hasLocalEntries = (() => {
|
|
213
|
-
try {
|
|
214
|
-
return readdirSync(localDir).length > 0;
|
|
215
|
-
}
|
|
216
|
-
catch {
|
|
217
|
-
return false;
|
|
218
|
-
}
|
|
219
|
-
})();
|
|
220
|
-
if (hasLocalEntries)
|
|
221
|
-
return;
|
|
222
|
-
try {
|
|
223
|
-
cpSync(source, localDir, { recursive: true, force: false });
|
|
224
|
-
}
|
|
225
|
-
catch { }
|
|
226
|
-
}
|
|
227
|
-
function migrateAgentFacingStateToLocal() {
|
|
228
|
-
migrateDirIfNeeded("context", getContextDir());
|
|
229
|
-
migrateDirIfNeeded("history", getHistoryDir());
|
|
230
|
-
migrateDirIfNeeded("tasks", getTasksDir());
|
|
231
|
-
migrateDirIfNeeded("status", getStatusDir());
|
|
232
|
-
}
|
|
233
257
|
// ── Global non-project paths ───────────────────────────────────────
|
|
234
258
|
export function getGlobalConfigPath() {
|
|
235
259
|
return join(getGlobalAimuxDir(), "config.json");
|
|
@@ -283,4 +307,3 @@ export function removeProject(id) {
|
|
|
283
307
|
registry.projects = registry.projects.filter((p) => p.id !== id);
|
|
284
308
|
saveRegistry(registry);
|
|
285
309
|
}
|
|
286
|
-
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type PendingDashboardActionKind = PendingSessionActionKind | PendingServiceActionKind | PendingWorktreeActionKind;
|
|
2
|
+
export type PendingSessionActionKind = "creating" | "forking" | "migrating" | "starting" | "stopping" | "graveyarding" | "renaming";
|
|
3
|
+
export type PendingServiceActionKind = "creating" | "starting" | "stopping" | "removing";
|
|
4
|
+
export type PendingWorktreeActionKind = "creating" | "removing" | "graveyarding";
|
|
5
|
+
export declare function isBlockingPendingDashboardActionKind(kind: string | null | undefined): kind is PendingDashboardActionKind;
|