aimux-cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +743 -0
- package/bin/aimux +2 -0
- package/dist/agent-events.d.ts +20 -0
- package/dist/agent-events.js +2 -0
- package/dist/agent-events.js.map +1 -0
- package/dist/agent-message-parts.d.ts +17 -0
- package/dist/agent-message-parts.js +31 -0
- package/dist/agent-message-parts.js.map +1 -0
- package/dist/agent-output-parser.d.ts +16 -0
- package/dist/agent-output-parser.js +229 -0
- package/dist/agent-output-parser.js.map +1 -0
- package/dist/agent-tracker.d.ts +9 -0
- package/dist/agent-tracker.js +144 -0
- package/dist/agent-tracker.js.map +1 -0
- package/dist/agent-watcher.d.ts +15 -0
- package/dist/agent-watcher.js +2 -0
- package/dist/agent-watcher.js.map +1 -0
- package/dist/attachment-store.d.ts +35 -0
- package/dist/attachment-store.js +129 -0
- package/dist/attachment-store.js.map +1 -0
- package/dist/builtin-metadata-watchers.d.ts +2 -0
- package/dist/builtin-metadata-watchers.js +275 -0
- package/dist/builtin-metadata-watchers.js.map +1 -0
- package/dist/claude-hooks.d.ts +29 -0
- package/dist/claude-hooks.js +106 -0
- package/dist/claude-hooks.js.map +1 -0
- package/dist/config.d.ts +78 -0
- package/dist/config.js +172 -0
- package/dist/config.js.map +1 -0
- package/dist/context/compactor.d.ts +20 -0
- package/dist/context/compactor.js +212 -0
- package/dist/context/compactor.js.map +1 -0
- package/dist/context/context-bridge.d.ts +67 -0
- package/dist/context/context-bridge.js +471 -0
- package/dist/context/context-bridge.js.map +1 -0
- package/dist/context/context-file.d.ts +11 -0
- package/dist/context/context-file.js +93 -0
- package/dist/context/context-file.js.map +1 -0
- package/dist/context/history.d.ts +40 -0
- package/dist/context/history.js +108 -0
- package/dist/context/history.js.map +1 -0
- package/dist/daemon.d.ts +39 -0
- package/dist/daemon.js +344 -0
- package/dist/daemon.js.map +1 -0
- package/dist/dashboard-session-registry.d.ts +47 -0
- package/dist/dashboard-session-registry.js +161 -0
- package/dist/dashboard-session-registry.js.map +1 -0
- package/dist/dashboard-state.d.ts +18 -0
- package/dist/dashboard-state.js +26 -0
- package/dist/dashboard-state.js.map +1 -0
- package/dist/dashboard.d.ts +118 -0
- package/dist/dashboard.js +91 -0
- package/dist/dashboard.js.map +1 -0
- package/dist/debug.d.ts +7 -0
- package/dist/debug.js +41 -0
- package/dist/debug.js.map +1 -0
- package/dist/fast-control.d.ts +45 -0
- package/dist/fast-control.js +174 -0
- package/dist/fast-control.js.map +1 -0
- package/dist/hotkeys.d.ts +44 -0
- package/dist/hotkeys.js +118 -0
- package/dist/hotkeys.js.map +1 -0
- package/dist/http-client.d.ts +10 -0
- package/dist/http-client.js +54 -0
- package/dist/http-client.js.map +1 -0
- package/dist/instance-directory.d.ts +32 -0
- package/dist/instance-directory.js +82 -0
- package/dist/instance-directory.js.map +1 -0
- package/dist/instance-registry.d.ts +38 -0
- package/dist/instance-registry.js +208 -0
- package/dist/instance-registry.js.map +1 -0
- package/dist/key-parser.d.ts +30 -0
- package/dist/key-parser.js +272 -0
- package/dist/key-parser.js.map +1 -0
- package/dist/last-used.d.ts +31 -0
- package/dist/last-used.js +93 -0
- package/dist/last-used.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +2483 -0
- package/dist/main.js.map +1 -0
- package/dist/metadata-server.d.ts +268 -0
- package/dist/metadata-server.js +1379 -0
- package/dist/metadata-server.js.map +1 -0
- package/dist/metadata-store.d.ts +80 -0
- package/dist/metadata-store.js +87 -0
- package/dist/metadata-store.js.map +1 -0
- package/dist/multiplexer.d.ts +471 -0
- package/dist/multiplexer.js +5714 -0
- package/dist/multiplexer.js.map +1 -0
- package/dist/notification-context.d.ts +18 -0
- package/dist/notification-context.js +68 -0
- package/dist/notification-context.js.map +1 -0
- package/dist/notifications.d.ts +38 -0
- package/dist/notifications.js +111 -0
- package/dist/notifications.js.map +1 -0
- package/dist/notify.d.ts +10 -0
- package/dist/notify.js +62 -0
- package/dist/notify.js.map +1 -0
- package/dist/orchestration-actions.d.ts +76 -0
- package/dist/orchestration-actions.js +310 -0
- package/dist/orchestration-actions.js.map +1 -0
- package/dist/orchestration-dispatcher.d.ts +22 -0
- package/dist/orchestration-dispatcher.js +49 -0
- package/dist/orchestration-dispatcher.js.map +1 -0
- package/dist/orchestration-routing.d.ts +20 -0
- package/dist/orchestration-routing.js +78 -0
- package/dist/orchestration-routing.js.map +1 -0
- package/dist/orchestration.d.ts +26 -0
- package/dist/orchestration.js +110 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/osc-notifications.d.ts +15 -0
- package/dist/osc-notifications.js +180 -0
- package/dist/osc-notifications.js.map +1 -0
- package/dist/paths.d.ts +55 -0
- package/dist/paths.js +259 -0
- package/dist/paths.js.map +1 -0
- package/dist/plugin-runtime.d.ts +46 -0
- package/dist/plugin-runtime.js +180 -0
- package/dist/plugin-runtime.js.map +1 -0
- package/dist/project-events.d.ts +36 -0
- package/dist/project-events.js +63 -0
- package/dist/project-events.js.map +1 -0
- package/dist/project-scanner.d.ts +38 -0
- package/dist/project-scanner.js +243 -0
- package/dist/project-scanner.js.map +1 -0
- package/dist/project-service-manifest.d.ts +18 -0
- package/dist/project-service-manifest.js +56 -0
- package/dist/project-service-manifest.js.map +1 -0
- package/dist/recency.d.ts +2 -0
- package/dist/recency.js +34 -0
- package/dist/recency.js.map +1 -0
- package/dist/recorder.d.ts +14 -0
- package/dist/recorder.js +130 -0
- package/dist/recorder.js.map +1 -0
- package/dist/session-bootstrap.d.ts +45 -0
- package/dist/session-bootstrap.js +436 -0
- package/dist/session-bootstrap.js.map +1 -0
- package/dist/session-message-history.d.ts +27 -0
- package/dist/session-message-history.js +105 -0
- package/dist/session-message-history.js.map +1 -0
- package/dist/session-runtime.d.ts +44 -0
- package/dist/session-runtime.js +56 -0
- package/dist/session-runtime.js.map +1 -0
- package/dist/session-semantics.d.ts +35 -0
- package/dist/session-semantics.js +110 -0
- package/dist/session-semantics.js.map +1 -0
- package/dist/status-detector.d.ts +17 -0
- package/dist/status-detector.js +67 -0
- package/dist/status-detector.js.map +1 -0
- package/dist/statusline-model.d.ts +103 -0
- package/dist/statusline-model.js +177 -0
- package/dist/statusline-model.js.map +1 -0
- package/dist/task-dispatcher.d.ts +63 -0
- package/dist/task-dispatcher.js +210 -0
- package/dist/task-dispatcher.js.map +1 -0
- package/dist/task-workflow.d.ts +13 -0
- package/dist/task-workflow.js +153 -0
- package/dist/task-workflow.js.map +1 -0
- package/dist/tasks.d.ts +60 -0
- package/dist/tasks.js +120 -0
- package/dist/tasks.js.map +1 -0
- package/dist/team.d.ts +28 -0
- package/dist/team.js +91 -0
- package/dist/team.js.map +1 -0
- package/dist/terminal-host.d.ts +10 -0
- package/dist/terminal-host.js +52 -0
- package/dist/terminal-host.js.map +1 -0
- package/dist/threads.d.ts +61 -0
- package/dist/threads.js +200 -0
- package/dist/threads.js.map +1 -0
- package/dist/tmux-doctor.d.ts +47 -0
- package/dist/tmux-doctor.js +112 -0
- package/dist/tmux-doctor.js.map +1 -0
- package/dist/tmux-runtime-manager.d.ts +164 -0
- package/dist/tmux-runtime-manager.js +794 -0
- package/dist/tmux-runtime-manager.js.map +1 -0
- package/dist/tmux-session-transport.d.ts +31 -0
- package/dist/tmux-session-transport.js +115 -0
- package/dist/tmux-session-transport.js.map +1 -0
- package/dist/tmux-statusline.d.ts +17 -0
- package/dist/tmux-statusline.js +166 -0
- package/dist/tmux-statusline.js.map +1 -0
- package/dist/tool-output-watchers.d.ts +10 -0
- package/dist/tool-output-watchers.js +190 -0
- package/dist/tool-output-watchers.js.map +1 -0
- package/dist/tui/render/box.d.ts +1 -0
- package/dist/tui/render/box.js +20 -0
- package/dist/tui/render/box.js.map +1 -0
- package/dist/tui/render/text.d.ts +8 -0
- package/dist/tui/render/text.js +92 -0
- package/dist/tui/render/text.js.map +1 -0
- package/dist/tui/screens/dashboard-renderers.d.ts +23 -0
- package/dist/tui/screens/dashboard-renderers.js +411 -0
- package/dist/tui/screens/dashboard-renderers.js.map +1 -0
- package/dist/tui/screens/overlay-renderers.d.ts +10 -0
- package/dist/tui/screens/overlay-renderers.js +274 -0
- package/dist/tui/screens/overlay-renderers.js.map +1 -0
- package/dist/tui/screens/subscreen-renderers.d.ts +9 -0
- package/dist/tui/screens/subscreen-renderers.js +327 -0
- package/dist/tui/screens/subscreen-renderers.js.map +1 -0
- package/dist/workflow.d.ts +19 -0
- package/dist/workflow.js +111 -0
- package/dist/workflow.js.map +1 -0
- package/dist/worktree.d.ts +23 -0
- package/dist/worktree.js +101 -0
- package/dist/worktree.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { renderOverlayBox } from "../render/box.js";
|
|
2
|
+
export function renderServiceInputOverlay(ctx) {
|
|
3
|
+
const cols = process.stdout.columns ?? 80;
|
|
4
|
+
const rows = process.stdout.rows ?? 24;
|
|
5
|
+
const lines = [
|
|
6
|
+
"Create service:",
|
|
7
|
+
"",
|
|
8
|
+
` Command: ${ctx.serviceInputBuffer}_`,
|
|
9
|
+
"",
|
|
10
|
+
" Empty command opens an interactive shell",
|
|
11
|
+
" [Enter] create [Esc] cancel",
|
|
12
|
+
];
|
|
13
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "blue"));
|
|
14
|
+
}
|
|
15
|
+
export function renderLabelInputOverlay(ctx) {
|
|
16
|
+
const cols = process.stdout.columns ?? 80;
|
|
17
|
+
const rows = process.stdout.rows ?? 24;
|
|
18
|
+
const lines = ["Name agent:", "", ` Name: ${ctx.labelInputBuffer}_`, "", " [Enter] save [Esc] cancel"];
|
|
19
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "blue"));
|
|
20
|
+
}
|
|
21
|
+
export function renderWorktreeListOverlay(ctx) {
|
|
22
|
+
const cols = process.stdout.columns ?? 80;
|
|
23
|
+
const rows = process.stdout.rows ?? 24;
|
|
24
|
+
let worktrees = [];
|
|
25
|
+
try {
|
|
26
|
+
worktrees = ctx.listAllWorktrees().filter((wt) => !wt.isBare);
|
|
27
|
+
}
|
|
28
|
+
catch { }
|
|
29
|
+
const lines = ["Worktree Management:", ""];
|
|
30
|
+
if (worktrees.length === 0) {
|
|
31
|
+
lines.push(" No worktrees found.");
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
for (let i = 0; i < worktrees.length; i++) {
|
|
35
|
+
const wt = worktrees[i];
|
|
36
|
+
const isMain = i === 0 ? " \x1b[2m(main)\x1b[0m" : "";
|
|
37
|
+
lines.push(` [${i + 1}] ${wt.name} (${wt.branch})${isMain}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
lines.push("");
|
|
41
|
+
lines.push(" [1-9] remove [Esc] back");
|
|
42
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "blue"));
|
|
43
|
+
}
|
|
44
|
+
export function renderWorktreeRemoveConfirmOverlay(ctx) {
|
|
45
|
+
const confirm = ctx.worktreeRemoveConfirm;
|
|
46
|
+
if (!confirm)
|
|
47
|
+
return;
|
|
48
|
+
const cols = process.stdout.columns ?? 80;
|
|
49
|
+
const rows = process.stdout.rows ?? 24;
|
|
50
|
+
const lines = [
|
|
51
|
+
`Remove worktree "${confirm.name}"?`,
|
|
52
|
+
"",
|
|
53
|
+
` Path: ${confirm.path}`,
|
|
54
|
+
" This runs: git worktree remove --force",
|
|
55
|
+
"",
|
|
56
|
+
" [y] yes [n/Esc] cancel",
|
|
57
|
+
];
|
|
58
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "red"));
|
|
59
|
+
}
|
|
60
|
+
export function renderDashboardBusyOverlay(ctx) {
|
|
61
|
+
const busy = ctx.dashboardBusyState;
|
|
62
|
+
if (!busy)
|
|
63
|
+
return;
|
|
64
|
+
const cols = process.stdout.columns ?? 80;
|
|
65
|
+
const rows = process.stdout.rows ?? 24;
|
|
66
|
+
const spinner = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"][busy.spinnerFrame % 10];
|
|
67
|
+
const elapsed = ((Date.now() - busy.startedAt) / 1000).toFixed(1);
|
|
68
|
+
const lines = [`${spinner} ${busy.title}`, "", ...busy.lines, "", ` Elapsed: ${elapsed}s`, "", " Please wait"];
|
|
69
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "blue"));
|
|
70
|
+
}
|
|
71
|
+
export function renderDashboardErrorOverlay(ctx) {
|
|
72
|
+
const error = ctx.dashboardErrorState;
|
|
73
|
+
if (!error)
|
|
74
|
+
return;
|
|
75
|
+
const cols = process.stdout.columns ?? 80;
|
|
76
|
+
const rows = process.stdout.rows ?? 24;
|
|
77
|
+
const bodyWidth = Math.max(24, Math.min(cols - 12, 84));
|
|
78
|
+
const wrap = (label, value) => {
|
|
79
|
+
const wrapped = ctx.wrapText(ctx.stripAnsi(String(value ?? "")), Math.max(12, bodyWidth - label.length - 2));
|
|
80
|
+
return wrapped.map((line, index) => index === 0 ? `${label} ${line}` : `${" ".repeat(label.length + 1)}${line}`);
|
|
81
|
+
};
|
|
82
|
+
const messageLines = error.lines.flatMap((line) => wrap(" ", line)).slice(0, Math.max(4, rows - 10));
|
|
83
|
+
const lines = [ctx.stripAnsi(error.title), "", ...messageLines, "", "[Esc/Enter] dismiss"];
|
|
84
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "red"));
|
|
85
|
+
}
|
|
86
|
+
export function renderNotificationPanel(ctx) {
|
|
87
|
+
const panel = ctx.notificationPanelState;
|
|
88
|
+
if (!panel)
|
|
89
|
+
return;
|
|
90
|
+
const cols = process.stdout.columns ?? 80;
|
|
91
|
+
const rows = process.stdout.rows ?? 24;
|
|
92
|
+
const title = "Notifications";
|
|
93
|
+
const header = [`${title}`, "", " [↑↓] select [r] read [c] clear [C] clear all [Esc] close", ""];
|
|
94
|
+
const items = panel.entries.length === 0
|
|
95
|
+
? [" No notifications."]
|
|
96
|
+
: panel.entries.map((entry, index) => {
|
|
97
|
+
const marker = index === panel.index ? "▸" : " ";
|
|
98
|
+
const state = entry.unread ? "unread" : "read";
|
|
99
|
+
const session = entry.sessionId ? ` (${entry.sessionId})` : "";
|
|
100
|
+
const time = entry.createdAt.replace("T", " ").slice(5, 16);
|
|
101
|
+
return ` ${marker} ${entry.title}${session} · ${state} · ${time}`;
|
|
102
|
+
});
|
|
103
|
+
const selected = panel.entries[panel.index];
|
|
104
|
+
const details = selected
|
|
105
|
+
? [
|
|
106
|
+
"Details",
|
|
107
|
+
"",
|
|
108
|
+
...ctx.wrapKeyValue("Title", selected.title, 56),
|
|
109
|
+
...(selected.subtitle ? ctx.wrapKeyValue("Subtitle", selected.subtitle, 56) : []),
|
|
110
|
+
...ctx.wrapKeyValue("Body", selected.body, 56),
|
|
111
|
+
...(selected.sessionId ? ctx.wrapKeyValue("Session", selected.sessionId, 56) : []),
|
|
112
|
+
...(selected.kind ? ctx.wrapKeyValue("Kind", selected.kind, 56) : []),
|
|
113
|
+
]
|
|
114
|
+
: ["Details", "", " No notification selected."];
|
|
115
|
+
const lines = [...header, ...items];
|
|
116
|
+
const height = Math.min(rows - 6, Math.max(10, Math.min(22, lines.length + 2)));
|
|
117
|
+
const width = Math.min(cols - 8, 100);
|
|
118
|
+
const leftWidth = Math.max(34, Math.floor(width * 0.5));
|
|
119
|
+
const rightWidth = Math.max(24, width - leftWidth - 3);
|
|
120
|
+
const startRow = Math.max(1, Math.floor((rows - height) / 2));
|
|
121
|
+
const startCol = Math.max(2, Math.floor((cols - width) / 2));
|
|
122
|
+
const listHeight = height - 2;
|
|
123
|
+
const listVisible = lines.slice(0, listHeight);
|
|
124
|
+
while (listVisible.length < listHeight)
|
|
125
|
+
listVisible.push("");
|
|
126
|
+
const detailVisible = details.slice(0, listHeight);
|
|
127
|
+
while (detailVisible.length < listHeight)
|
|
128
|
+
detailVisible.push("");
|
|
129
|
+
let output = "\x1b7";
|
|
130
|
+
for (let i = 0; i < height; i++) {
|
|
131
|
+
output += `\x1b[${startRow + i};${startCol}H`;
|
|
132
|
+
if (i === 0 || i === height - 1) {
|
|
133
|
+
output += `\x1b[48;5;236;38;5;255m${" ".repeat(width)}\x1b[0m`;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const left = ctx.truncatePlain(ctx.stripAnsi(listVisible[i - 1] ?? ""), leftWidth).padEnd(leftWidth);
|
|
137
|
+
const right = ctx.truncatePlain(ctx.stripAnsi(detailVisible[i - 1] ?? ""), rightWidth).padEnd(rightWidth);
|
|
138
|
+
output += `\x1b[48;5;236;38;5;255m ${left} │ ${right} \x1b[0m`;
|
|
139
|
+
}
|
|
140
|
+
output += "\x1b8";
|
|
141
|
+
process.stdout.write(output);
|
|
142
|
+
}
|
|
143
|
+
export function renderHelpOverlay(_ctx) {
|
|
144
|
+
const cols = process.stdout.columns ?? 80;
|
|
145
|
+
const rows = process.stdout.rows ?? 24;
|
|
146
|
+
const allLines = [
|
|
147
|
+
"Help",
|
|
148
|
+
"",
|
|
149
|
+
"Tmux mode",
|
|
150
|
+
" Dashboard lives in a managed tmux dashboard window",
|
|
151
|
+
" Each agent runs in its own tmux window",
|
|
152
|
+
" Use normal tmux window navigation inside agents",
|
|
153
|
+
" Run aimux with no args to return to the dashboard window",
|
|
154
|
+
"",
|
|
155
|
+
"Dashboard mode",
|
|
156
|
+
" Ctrl+A ? show help",
|
|
157
|
+
" Ctrl+A c new agent",
|
|
158
|
+
" Ctrl+A x stop agent",
|
|
159
|
+
" Ctrl+A w create worktree",
|
|
160
|
+
" Ctrl+A W worktree list",
|
|
161
|
+
" Ctrl+A v request review",
|
|
162
|
+
" Ctrl+A 1-9 focus numbered agent",
|
|
163
|
+
" Ctrl+A d return to dashboard window",
|
|
164
|
+
" arrows / j k n p navigate",
|
|
165
|
+
" Enter open, resume, or takeover",
|
|
166
|
+
" a activity",
|
|
167
|
+
" y workflow",
|
|
168
|
+
" p plans",
|
|
169
|
+
" r name agent",
|
|
170
|
+
" m migrate agent",
|
|
171
|
+
" g graveyard",
|
|
172
|
+
" q quit",
|
|
173
|
+
"",
|
|
174
|
+
"Esc, Enter, or ? to close",
|
|
175
|
+
];
|
|
176
|
+
const visibleRows = rows;
|
|
177
|
+
const maxContentRows = Math.max(6, visibleRows - 2);
|
|
178
|
+
let lines = [...allLines];
|
|
179
|
+
if (lines.length > maxContentRows) {
|
|
180
|
+
const closeLine = lines[lines.length - 1];
|
|
181
|
+
const available = Math.max(4, maxContentRows - 2);
|
|
182
|
+
lines = [...lines.slice(0, available), "...", closeLine];
|
|
183
|
+
}
|
|
184
|
+
const ellipsizeEnd = (s, max) => {
|
|
185
|
+
if (max <= 0)
|
|
186
|
+
return "";
|
|
187
|
+
if (s.length <= max)
|
|
188
|
+
return s;
|
|
189
|
+
if (max <= 1)
|
|
190
|
+
return "…";
|
|
191
|
+
return `${s.slice(0, max - 1)}…`;
|
|
192
|
+
};
|
|
193
|
+
const contentWidth = Math.max(36, Math.min(cols - 6, Math.max(...lines.map((line) => line.length))));
|
|
194
|
+
const boxWidth = contentWidth + 4;
|
|
195
|
+
const boxHeight = lines.length + 2;
|
|
196
|
+
const startRow = Math.max(1, Math.floor((visibleRows - boxHeight) / 2));
|
|
197
|
+
const startCol = Math.max(1, Math.floor((cols - boxWidth) / 2));
|
|
198
|
+
let output = "\x1b7";
|
|
199
|
+
for (let i = 0; i < boxHeight; i++) {
|
|
200
|
+
const row = startRow + i;
|
|
201
|
+
output += `\x1b[${row};${startCol}H`;
|
|
202
|
+
if (i === 0 || i === boxHeight - 1) {
|
|
203
|
+
output += `\x1b[44;97m${" ".repeat(boxWidth)}\x1b[0m`;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
const line = ellipsizeEnd(lines[i - 1] ?? "", contentWidth);
|
|
207
|
+
output += `\x1b[44;97m ${line.padEnd(contentWidth)} \x1b[0m`;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
output += "\x1b8";
|
|
211
|
+
process.stdout.write(output);
|
|
212
|
+
}
|
|
213
|
+
export function renderSwitcherOverlay(ctx) {
|
|
214
|
+
const cols = process.stdout.columns ?? 80;
|
|
215
|
+
const rows = process.stdout.rows ?? 24;
|
|
216
|
+
const list = ctx.getSwitcherList();
|
|
217
|
+
const ellipsizeEnd = (s, max) => {
|
|
218
|
+
if (max <= 0)
|
|
219
|
+
return "";
|
|
220
|
+
if (s.length <= max)
|
|
221
|
+
return s;
|
|
222
|
+
if (max <= 1)
|
|
223
|
+
return "…";
|
|
224
|
+
return `${s.slice(0, max - 1)}…`;
|
|
225
|
+
};
|
|
226
|
+
const lines = ["Switch Agent:"];
|
|
227
|
+
for (let i = 0; i < list.length; i++) {
|
|
228
|
+
const s = list[i];
|
|
229
|
+
const wtPath = ctx.sessionWorktreePaths.get(s.id);
|
|
230
|
+
const wtLabel = wtPath ? ` (${wtPath.split("/").pop()})` : "";
|
|
231
|
+
const current = s.id === ctx.sessions[ctx.activeIndex]?.id ? " (current)" : "";
|
|
232
|
+
const pointer = i === ctx.switcherIndex ? "▸ " : " ";
|
|
233
|
+
lines.push(`${pointer}${s.command}:${s.id}${wtLabel}${current}`);
|
|
234
|
+
}
|
|
235
|
+
lines.push("");
|
|
236
|
+
lines.push(" [s] cycle Enter confirm [x] stop Esc cancel");
|
|
237
|
+
const contentWidth = Math.max(20, Math.min(cols - 6, Math.max(...lines.map((l) => l.length))));
|
|
238
|
+
const boxWidth = contentWidth + 4;
|
|
239
|
+
const startRow = Math.max(1, Math.floor((rows - lines.length - 2) / 2));
|
|
240
|
+
const startCol = Math.max(1, Math.floor((cols - boxWidth) / 2));
|
|
241
|
+
let output = "\x1b7";
|
|
242
|
+
for (let i = 0; i < lines.length + 2; i++) {
|
|
243
|
+
const row = startRow + i;
|
|
244
|
+
output += `\x1b[${row};${startCol}H`;
|
|
245
|
+
if (i === 0 || i === lines.length + 1) {
|
|
246
|
+
output += `\x1b[44;97m${"─".repeat(boxWidth)}\x1b[0m`;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
const line = ellipsizeEnd(lines[i - 1], contentWidth);
|
|
250
|
+
output += `\x1b[44;97m ${line.padEnd(contentWidth)} \x1b[0m`;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
output += "\x1b8";
|
|
254
|
+
process.stdout.write(output);
|
|
255
|
+
}
|
|
256
|
+
export function renderMigratePickerOverlay(ctx) {
|
|
257
|
+
const cols = process.stdout.columns ?? 80;
|
|
258
|
+
const rows = process.stdout.rows ?? 24;
|
|
259
|
+
const session = ctx.sessions[ctx.activeIndex];
|
|
260
|
+
if (!session)
|
|
261
|
+
return;
|
|
262
|
+
const currentWt = ctx.sessionWorktreePaths.get(session.id);
|
|
263
|
+
const lines = [`Migrate "${session.id}" to:`, ""];
|
|
264
|
+
for (let i = 0; i < ctx.migratePickerWorktrees.length; i++) {
|
|
265
|
+
const wt = ctx.migratePickerWorktrees[i];
|
|
266
|
+
const isCurrent = wt.path === currentWt || (!currentWt && wt.name === "(main)");
|
|
267
|
+
const marker = isCurrent ? " (current)" : "";
|
|
268
|
+
lines.push(` [${i + 1}] ${wt.name}${marker}`);
|
|
269
|
+
}
|
|
270
|
+
lines.push("");
|
|
271
|
+
lines.push(" [Esc] cancel");
|
|
272
|
+
process.stdout.write(renderOverlayBox(lines, cols, rows, "blue"));
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=overlay-renderers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-renderers.js","sourceRoot":"","sources":["../../../src/tui/screens/overlay-renderers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,yBAAyB,CAAC,GAAQ;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAC1C,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG;QACZ,iBAAiB;QACjB,EAAE;QACF,cAAc,GAA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AC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function renderWorkflowScreen(ctx: any): void;
|
|
2
|
+
export declare function renderWorkflowDetails(ctx: any, width: number, height: number): string[];
|
|
3
|
+
export declare function renderActivityScreen(ctx: any): void;
|
|
4
|
+
export declare function renderThreadsScreen(ctx: any): void;
|
|
5
|
+
export declare function renderThreadDetails(ctx: any, width: number, height: number): string[];
|
|
6
|
+
export declare function renderGraveyardScreen(ctx: any): void;
|
|
7
|
+
export declare function renderGraveyardDetails(ctx: any, width: number, height: number): string[];
|
|
8
|
+
export declare function renderPlansScreen(ctx: any): void;
|
|
9
|
+
export declare function renderPlanDetails(ctx: any, width: number, height: number): string[];
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
export function renderWorkflowScreen(ctx) {
|
|
2
|
+
const { cols, rows } = ctx.getViewportSize();
|
|
3
|
+
const header = [];
|
|
4
|
+
header.push("");
|
|
5
|
+
header.push(ctx.centerInWidth(`\x1b[1maimux\x1b[0m — workflow \x1b[2m[${ctx.describeWorkflowFilter()}]\x1b[0m`, cols));
|
|
6
|
+
header.push(ctx.centerInWidth("─".repeat(Math.min(50, cols - 4)), cols));
|
|
7
|
+
header.push("");
|
|
8
|
+
const footer = ctx.centerInWidth("[↑↓] select [f] filter [Tab] details [d/a/y/t/p/g] screens [s] reply [a] accept [b] block [c/x] complete [P] approve [J] changes [E] reopen [Enter] thread [Esc] dashboard [q] quit", cols);
|
|
9
|
+
const viewportHeight = rows - header.length - 2;
|
|
10
|
+
const twoPane = cols >= 110 && ctx.dashboardState.detailsSidebarVisible;
|
|
11
|
+
const listLines = [];
|
|
12
|
+
if (ctx.workflowEntries.length === 0) {
|
|
13
|
+
listLines.push(" Workflow");
|
|
14
|
+
listLines.push(" No open task/review/handoff workflow items.");
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
listLines.push(" Workflow");
|
|
18
|
+
for (let i = 0; i < ctx.workflowEntries.length; i++) {
|
|
19
|
+
const entry = ctx.workflowEntries[i];
|
|
20
|
+
const selected = i === ctx.workflowIndex;
|
|
21
|
+
const marker = selected ? "\x1b[33m▸\x1b[0m " : " ";
|
|
22
|
+
const pending = entry.pendingDeliveries > 0 ? ` \x1b[31m⇢ ${entry.pendingDeliveries}\x1b[0m` : "";
|
|
23
|
+
const unread = (entry.thread.unreadBy?.length ?? 0) > 0 ? ` \x1b[36m${entry.thread.unreadBy.length}\x1b[0m` : "";
|
|
24
|
+
const family = entry.familyTaskIds.length > 1 ? ` \x1b[35m⤳${entry.familyTaskIds.length}\x1b[0m` : "";
|
|
25
|
+
const latest = entry.latestMessage?.body
|
|
26
|
+
? ` \x1b[2m· ${ctx.truncatePlain(entry.latestMessage.body, 28)}\x1b[0m`
|
|
27
|
+
: "";
|
|
28
|
+
listLines.push(`${marker}[${i + 1}] ${entry.displayTitle} \x1b[2m(${entry.thread.kind})\x1b[0m — ${entry.stateLabel}${family}${unread}${pending}${latest}${selected ? " \x1b[33m◀\x1b[0m" : ""}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const focusLine = ctx.workflowEntries.length === 0 ? 1 : ctx.workflowIndex + 1;
|
|
32
|
+
const body = ctx.composeSplitScreen(listLines, renderWorkflowDetails(ctx, Math.max(28, cols - Math.floor(cols * 0.56) - 3), viewportHeight), cols, viewportHeight, focusLine, twoPane);
|
|
33
|
+
ctx.writeFrame("\x1b[2J\x1b[H" +
|
|
34
|
+
[...header, ...body, ctx.centerInWidth("─".repeat(Math.min(cols - 4, 72)), cols), footer].join("\r\n"));
|
|
35
|
+
}
|
|
36
|
+
export function renderWorkflowDetails(ctx, width, height) {
|
|
37
|
+
const entry = ctx.workflowEntries[ctx.workflowIndex];
|
|
38
|
+
if (!entry)
|
|
39
|
+
return new Array(height).fill("");
|
|
40
|
+
const lines = [];
|
|
41
|
+
lines.push("\x1b[1mWorkflow\x1b[0m");
|
|
42
|
+
lines.push(...ctx.wrapKeyValue("Title", entry.displayTitle, width));
|
|
43
|
+
lines.push(...ctx.wrapKeyValue("Kind", entry.thread.kind, width));
|
|
44
|
+
lines.push(...ctx.wrapKeyValue("State", entry.stateLabel, width));
|
|
45
|
+
if (entry.task) {
|
|
46
|
+
lines.push(...ctx.wrapKeyValue("Task Status", entry.task.status, width));
|
|
47
|
+
if (entry.task.type === "review" && entry.task.reviewStatus) {
|
|
48
|
+
lines.push(...ctx.wrapKeyValue("Review", entry.task.reviewStatus, width));
|
|
49
|
+
}
|
|
50
|
+
if (entry.familyTaskIds.length > 1) {
|
|
51
|
+
lines.push(...ctx.wrapKeyValue("Workflow Root", entry.familyRootTaskId ?? entry.task.id, width));
|
|
52
|
+
lines.push(...ctx.wrapKeyValue("Chain Size", String(entry.familyTaskIds.length), width));
|
|
53
|
+
lines.push(...ctx.wrapKeyValue("Chain", entry.familyTaskIds.join(" → "), width));
|
|
54
|
+
}
|
|
55
|
+
lines.push(...ctx.wrapKeyValue("Prompt", entry.task.prompt, width));
|
|
56
|
+
if (entry.task.result)
|
|
57
|
+
lines.push(...ctx.wrapKeyValue("Result", entry.task.result, width));
|
|
58
|
+
if (entry.task.error)
|
|
59
|
+
lines.push(...ctx.wrapKeyValue("Error", entry.task.error, width));
|
|
60
|
+
}
|
|
61
|
+
if (entry.thread.owner)
|
|
62
|
+
lines.push(...ctx.wrapKeyValue("Owner", entry.thread.owner, width));
|
|
63
|
+
if ((entry.thread.waitingOn?.length ?? 0) > 0) {
|
|
64
|
+
lines.push(...ctx.wrapKeyValue("Waiting On", entry.thread.waitingOn.join(", "), width));
|
|
65
|
+
}
|
|
66
|
+
if (entry.pendingDeliveries > 0) {
|
|
67
|
+
lines.push(...ctx.wrapKeyValue("Pending Delivery", entry.latestPendingRecipients.join(", "), width));
|
|
68
|
+
}
|
|
69
|
+
if (entry.thread.taskId)
|
|
70
|
+
lines.push(...ctx.wrapKeyValue("Task", entry.thread.taskId, width));
|
|
71
|
+
lines.push("");
|
|
72
|
+
lines.push("\x1b[1mLatest\x1b[0m");
|
|
73
|
+
if (entry.latestMessage) {
|
|
74
|
+
lines.push(...ctx.wrapKeyValue(`${entry.latestMessage.from} [${entry.latestMessage.kind}]`, entry.latestMessage.body, width));
|
|
75
|
+
}
|
|
76
|
+
while (lines.length < height)
|
|
77
|
+
lines.push("");
|
|
78
|
+
return lines.slice(0, height);
|
|
79
|
+
}
|
|
80
|
+
export function renderActivityScreen(ctx) {
|
|
81
|
+
const { cols, rows } = ctx.getViewportSize();
|
|
82
|
+
const header = [];
|
|
83
|
+
header.push("");
|
|
84
|
+
header.push(ctx.centerInWidth("\x1b[1maimux\x1b[0m — activity", cols));
|
|
85
|
+
header.push(ctx.centerInWidth("─".repeat(Math.min(50, cols - 4)), cols));
|
|
86
|
+
header.push("");
|
|
87
|
+
const footer = ctx.centerInWidth("[↑↓] select [Tab] details [d/a/y/t/p/g] screens [1-9/Enter] focus [u] next attention [Esc] dashboard [q] quit", cols);
|
|
88
|
+
const viewportHeight = rows - header.length - 2;
|
|
89
|
+
const twoPane = cols >= 110 && ctx.dashboardState.detailsSidebarVisible;
|
|
90
|
+
const listLines = [];
|
|
91
|
+
if (ctx.activityEntries.length === 0) {
|
|
92
|
+
listLines.push(" Activity");
|
|
93
|
+
listLines.push(" No sessions currently need attention.");
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
listLines.push(" Activity");
|
|
97
|
+
for (let i = 0; i < ctx.activityEntries.length; i++) {
|
|
98
|
+
const entry = ctx.activityEntries[i];
|
|
99
|
+
const selected = i === ctx.activityIndex;
|
|
100
|
+
const marker = selected ? "\x1b[33m▸\x1b[0m " : " ";
|
|
101
|
+
const identity = entry.label ?? entry.command;
|
|
102
|
+
const roleTag = entry.role ? ` \x1b[36m(${entry.role})\x1b[0m` : "";
|
|
103
|
+
const wt = entry.worktreeName
|
|
104
|
+
? ` \x1b[2m· ${ctx.truncatePlain(entry.worktreeName, 18)}${entry.worktreeBranch ? `@${ctx.truncatePlain(entry.worktreeBranch, 18)}` : ""}\x1b[0m`
|
|
105
|
+
: "";
|
|
106
|
+
const state = entry.attention && entry.attention !== "normal" ? entry.attention : (entry.activity ?? entry.status);
|
|
107
|
+
const unseen = (entry.unseenCount ?? 0) > 0 ? ` \x1b[36m${entry.unseenCount}\x1b[0m` : "";
|
|
108
|
+
const service = entry.services?.[0]
|
|
109
|
+
? ` \x1b[2m· ${entry.services[0].port ? `:${entry.services[0].port}` : ctx.truncatePlain(entry.services[0].url ?? "", 16)}\x1b[0m`
|
|
110
|
+
: "";
|
|
111
|
+
listLines.push(`${marker}[${i + 1}] ${identity}${roleTag} — ${state}${unseen}${wt}${service}${selected ? " \x1b[33m◀\x1b[0m" : ""}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const focusLine = ctx.activityEntries.length === 0 ? 1 : ctx.activityIndex + 1;
|
|
115
|
+
const body = ctx.composeSplitScreen(listLines, ctx.renderSessionDetails(ctx.activityEntries[ctx.activityIndex], Math.max(28, cols - Math.floor(cols * 0.56) - 3), viewportHeight), cols, viewportHeight, focusLine, twoPane);
|
|
116
|
+
ctx.writeFrame("\x1b[2J\x1b[H" +
|
|
117
|
+
[...header, ...body, ctx.centerInWidth("─".repeat(Math.min(cols - 4, 72)), cols), footer].join("\r\n"));
|
|
118
|
+
}
|
|
119
|
+
export function renderThreadsScreen(ctx) {
|
|
120
|
+
const { cols, rows } = ctx.getViewportSize();
|
|
121
|
+
const header = [];
|
|
122
|
+
header.push("");
|
|
123
|
+
header.push(ctx.centerInWidth("\x1b[1maimux\x1b[0m — threads", cols));
|
|
124
|
+
header.push(ctx.centerInWidth("─".repeat(Math.min(50, cols - 4)), cols));
|
|
125
|
+
header.push("");
|
|
126
|
+
const footer = ctx.centerInWidth("[↑↓] select [Tab] details [d/a/y/t/p/g] screens [s] reply [a] accept [c] complete [b/o/x] state [Enter] jump [r] refresh [Esc] dashboard [q] quit", cols);
|
|
127
|
+
const viewportHeight = rows - header.length - 2;
|
|
128
|
+
const twoPane = cols >= 110 && ctx.dashboardState.detailsSidebarVisible;
|
|
129
|
+
const listLines = [];
|
|
130
|
+
if (ctx.threadEntries.length === 0) {
|
|
131
|
+
listLines.push(" Threads");
|
|
132
|
+
listLines.push(" No orchestration threads yet.");
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
listLines.push(" Threads");
|
|
136
|
+
for (let i = 0; i < ctx.threadEntries.length; i++) {
|
|
137
|
+
const entry = ctx.threadEntries[i];
|
|
138
|
+
const selected = i === ctx.threadIndex;
|
|
139
|
+
const marker = selected ? "\x1b[33m▸\x1b[0m " : " ";
|
|
140
|
+
const unread = (entry.thread.unreadBy?.length ?? 0) > 0 ? ` \x1b[36m${entry.thread.unreadBy.length}\x1b[0m` : "";
|
|
141
|
+
const waiting = (entry.thread.waitingOn?.length ?? 0) > 0 ? ` \x1b[35m→ ${entry.thread.waitingOn.join(",")}\x1b[0m` : "";
|
|
142
|
+
const pending = entry.pendingDeliveries > 0 ? ` \x1b[31m⇢ ${entry.pendingDeliveries}\x1b[0m` : "";
|
|
143
|
+
const latest = entry.latestMessage?.body
|
|
144
|
+
? ` \x1b[2m· ${ctx.truncatePlain(entry.latestMessage.body, 34)}\x1b[0m`
|
|
145
|
+
: "";
|
|
146
|
+
listLines.push(`${marker}[${i + 1}] ${entry.displayTitle} \x1b[2m(${entry.thread.kind})\x1b[0m — ${entry.thread.status}${unread}${waiting}${pending}${latest}${selected ? " \x1b[33m◀\x1b[0m" : ""}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const focusLine = ctx.threadEntries.length === 0 ? 1 : ctx.threadIndex + 1;
|
|
150
|
+
const body = ctx.composeSplitScreen(listLines, renderThreadDetails(ctx, Math.max(28, cols - Math.floor(cols * 0.56) - 3), viewportHeight), cols, viewportHeight, focusLine, twoPane);
|
|
151
|
+
ctx.writeFrame("\x1b[2J\x1b[H" +
|
|
152
|
+
[...header, ...body, ctx.centerInWidth("─".repeat(Math.min(cols - 4, 72)), cols), footer].join("\r\n"));
|
|
153
|
+
}
|
|
154
|
+
export function renderThreadDetails(ctx, width, height) {
|
|
155
|
+
const entry = ctx.threadEntries[ctx.threadIndex];
|
|
156
|
+
if (!entry)
|
|
157
|
+
return new Array(height).fill("");
|
|
158
|
+
const lines = [];
|
|
159
|
+
lines.push("\x1b[1mDetails\x1b[0m");
|
|
160
|
+
lines.push(...ctx.wrapKeyValue("Title", entry.displayTitle, width));
|
|
161
|
+
lines.push(...ctx.wrapKeyValue("Kind", entry.thread.kind, width));
|
|
162
|
+
lines.push(...ctx.wrapKeyValue("Status", entry.thread.status, width));
|
|
163
|
+
lines.push(...ctx.wrapKeyValue("Created By", entry.thread.createdBy, width));
|
|
164
|
+
lines.push(...ctx.wrapKeyValue("Participants", entry.thread.participants.join(", "), width));
|
|
165
|
+
if (entry.thread.owner)
|
|
166
|
+
lines.push(...ctx.wrapKeyValue("Owner", entry.thread.owner, width));
|
|
167
|
+
if (entry.thread.kind === "handoff") {
|
|
168
|
+
lines.push(...ctx.wrapKeyValue("Handoff", ctx.describeHandoffState(entry.thread), width));
|
|
169
|
+
}
|
|
170
|
+
if ((entry.thread.waitingOn?.length ?? 0) > 0) {
|
|
171
|
+
lines.push(...ctx.wrapKeyValue("Waiting On", entry.thread.waitingOn.join(", "), width));
|
|
172
|
+
}
|
|
173
|
+
if ((entry.thread.unreadBy?.length ?? 0) > 0) {
|
|
174
|
+
lines.push(...ctx.wrapKeyValue("Unread By", entry.thread.unreadBy.join(", "), width));
|
|
175
|
+
}
|
|
176
|
+
if (entry.pendingDeliveries > 0) {
|
|
177
|
+
lines.push(...ctx.wrapKeyValue("Pending Delivery", entry.latestPendingRecipients.join(", "), width));
|
|
178
|
+
}
|
|
179
|
+
if (entry.thread.taskId)
|
|
180
|
+
lines.push(...ctx.wrapKeyValue("Task", entry.thread.taskId, width));
|
|
181
|
+
if (entry.thread.worktreePath)
|
|
182
|
+
lines.push(...ctx.wrapKeyValue("Worktree", entry.thread.worktreePath, width));
|
|
183
|
+
lines.push("");
|
|
184
|
+
lines.push("\x1b[1mMessages\x1b[0m");
|
|
185
|
+
const messages = ctx.readMessages(entry.thread.id).slice(-Math.max(3, height - lines.length));
|
|
186
|
+
for (const message of messages) {
|
|
187
|
+
const prefix = `${message.from}${message.to?.length ? ` → ${message.to.join(", ")}` : ""} [${message.kind}]`;
|
|
188
|
+
const delivered = message.deliveredTo ?? [];
|
|
189
|
+
const pending = (message.to ?? []).filter((recipient) => !(message.deliveredTo ?? []).includes(recipient));
|
|
190
|
+
const statusParts = [];
|
|
191
|
+
if (delivered.length > 0) {
|
|
192
|
+
statusParts.push(pending.length > 0 ? `delivered ${delivered.join(", ")}` : `delivered to ${delivered.join(", ")}`);
|
|
193
|
+
}
|
|
194
|
+
if (pending.length > 0) {
|
|
195
|
+
statusParts.push(`pending ${pending.join(", ")}`);
|
|
196
|
+
}
|
|
197
|
+
const suffix = statusParts.length > 0 ? ` (${statusParts.join("; ")})` : "";
|
|
198
|
+
lines.push(...ctx.wrapKeyValue(prefix, `${message.body}${suffix}`, width));
|
|
199
|
+
}
|
|
200
|
+
while (lines.length < height)
|
|
201
|
+
lines.push("");
|
|
202
|
+
return lines.slice(0, height);
|
|
203
|
+
}
|
|
204
|
+
export function renderGraveyardScreen(ctx) {
|
|
205
|
+
const { cols, rows } = ctx.getViewportSize();
|
|
206
|
+
const header = [];
|
|
207
|
+
header.push("");
|
|
208
|
+
header.push(ctx.centerInWidth("\x1b[1maimux\x1b[0m — graveyard", cols));
|
|
209
|
+
header.push(ctx.centerInWidth("─".repeat(Math.min(50, cols - 4)), cols));
|
|
210
|
+
header.push("");
|
|
211
|
+
const footer = ctx.centerInWidth("[↑↓] select [Tab] details [d/a/y/t/p/g] screens [1-9/Enter] resurrect [Esc] dashboard [q] quit", cols);
|
|
212
|
+
const viewportHeight = rows - header.length - 2;
|
|
213
|
+
const twoPane = cols >= 110 && ctx.dashboardState.detailsSidebarVisible;
|
|
214
|
+
const listLines = [];
|
|
215
|
+
if (ctx.graveyardEntries.length === 0) {
|
|
216
|
+
listLines.push(" Graveyard");
|
|
217
|
+
listLines.push(" (empty)");
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
listLines.push(" Graveyard");
|
|
221
|
+
for (let i = 0; i < ctx.graveyardEntries.length; i++) {
|
|
222
|
+
const s = ctx.graveyardEntries[i];
|
|
223
|
+
const bsid = s.backendSessionId ? ` (${s.backendSessionId.slice(0, 8)}…)` : "";
|
|
224
|
+
const identity = s.label ? ` — ${s.label}` : "";
|
|
225
|
+
const headline = s.headline ? ` · ${s.headline}` : "";
|
|
226
|
+
const marker = i === ctx.graveyardIndex ? "\x1b[33m▸\x1b[0m " : " ";
|
|
227
|
+
listLines.push(` ${marker}[${i + 1}] ${s.command}:${s.id}${bsid}${identity}${headline}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const focusLine = ctx.graveyardEntries.length === 0 ? 1 : ctx.graveyardIndex + 1;
|
|
231
|
+
const body = ctx.composeSplitScreen(listLines, renderGraveyardDetails(ctx, Math.max(28, cols - Math.floor(cols * 0.56) - 3), viewportHeight), cols, viewportHeight, focusLine, twoPane);
|
|
232
|
+
ctx.writeFrame("\x1b[2J\x1b[H" +
|
|
233
|
+
[...header, ...body, ctx.centerInWidth("─".repeat(Math.min(cols - 4, 52)), cols), footer].join("\r\n"));
|
|
234
|
+
}
|
|
235
|
+
export function renderGraveyardDetails(ctx, width, height) {
|
|
236
|
+
const selected = ctx.graveyardEntries[ctx.graveyardIndex];
|
|
237
|
+
if (!selected)
|
|
238
|
+
return new Array(height).fill("");
|
|
239
|
+
const lines = [];
|
|
240
|
+
const worktreeName = selected.worktreePath ? ctx.basename(selected.worktreePath) : undefined;
|
|
241
|
+
lines.push("\x1b[1mDetails\x1b[0m");
|
|
242
|
+
lines.push(...ctx.wrapKeyValue("Agent", selected.label ?? selected.id, width));
|
|
243
|
+
lines.push(...ctx.wrapKeyValue("Session", selected.id, width));
|
|
244
|
+
lines.push(...ctx.wrapKeyValue("Tool", selected.tool, width));
|
|
245
|
+
lines.push(...ctx.wrapKeyValue("Config", selected.toolConfigKey, width));
|
|
246
|
+
lines.push(...ctx.wrapKeyValue("Status", "offline", width));
|
|
247
|
+
if (worktreeName)
|
|
248
|
+
lines.push(...ctx.wrapKeyValue("Worktree", worktreeName, width));
|
|
249
|
+
if (selected.worktreePath)
|
|
250
|
+
lines.push(...ctx.wrapKeyValue("Path", selected.worktreePath, width));
|
|
251
|
+
if (selected.backendSessionId)
|
|
252
|
+
lines.push(...ctx.wrapKeyValue("Backend", selected.backendSessionId, width));
|
|
253
|
+
if (selected.headline)
|
|
254
|
+
lines.push(...ctx.wrapKeyValue("Headline", selected.headline, width));
|
|
255
|
+
if (selected.command)
|
|
256
|
+
lines.push(...ctx.wrapKeyValue("Command", selected.command, width));
|
|
257
|
+
if (selected.args?.length)
|
|
258
|
+
lines.push(...ctx.wrapKeyValue("Args", selected.args.join(" "), width));
|
|
259
|
+
while (lines.length < height)
|
|
260
|
+
lines.push("");
|
|
261
|
+
return lines.slice(0, height);
|
|
262
|
+
}
|
|
263
|
+
function buildPlanPreview(ctx, content, width, maxLines) {
|
|
264
|
+
const body = content.replace(/^---\n[\s\S]*?\n---\n?/, "").trim();
|
|
265
|
+
const rawLines = body.length > 0 ? body.split(/\r?\n/) : ["(empty)"];
|
|
266
|
+
const preview = [];
|
|
267
|
+
for (const line of rawLines) {
|
|
268
|
+
if (preview.length >= maxLines)
|
|
269
|
+
break;
|
|
270
|
+
const normalized = line.length > width ? `${line.slice(0, Math.max(0, width - 1))}…` : line;
|
|
271
|
+
preview.push(normalized);
|
|
272
|
+
}
|
|
273
|
+
return preview;
|
|
274
|
+
}
|
|
275
|
+
export function renderPlansScreen(ctx) {
|
|
276
|
+
const { cols, rows } = ctx.getViewportSize();
|
|
277
|
+
const header = [];
|
|
278
|
+
header.push("");
|
|
279
|
+
header.push(ctx.centerInWidth("\x1b[1maimux\x1b[0m — plans", cols));
|
|
280
|
+
header.push(ctx.centerInWidth("─".repeat(Math.min(50, cols - 4)), cols));
|
|
281
|
+
header.push("");
|
|
282
|
+
const footer = ctx.centerInWidth("[↑↓] select [Tab] details [d/a/y/t/p/g] screens [e/Enter] edit [r] refresh [Esc] dashboard [q] quit", cols);
|
|
283
|
+
const viewportHeight = rows - header.length - 2;
|
|
284
|
+
const twoPane = cols >= 110 && ctx.dashboardState.detailsSidebarVisible;
|
|
285
|
+
const listLines = [];
|
|
286
|
+
if (ctx.planEntries.length === 0) {
|
|
287
|
+
listLines.push(" No plan files found in .aimux/plans/");
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
listLines.push(" Plans");
|
|
291
|
+
for (let i = 0; i < ctx.planEntries.length; i++) {
|
|
292
|
+
const plan = ctx.planEntries[i];
|
|
293
|
+
const selected = i === ctx.planIndex;
|
|
294
|
+
const marker = selected ? "\x1b[33m▸\x1b[0m " : " ";
|
|
295
|
+
const identity = plan.label ?? plan.tool ?? "unknown";
|
|
296
|
+
const worktree = plan.worktree ?? "main";
|
|
297
|
+
const updated = plan.updatedAt ? ` · ${plan.updatedAt.replace("T", " ").slice(0, 16)}` : "";
|
|
298
|
+
listLines.push(`${marker}[${i + 1}] ${identity} \x1b[2m(${plan.sessionId})\x1b[0m · ${worktree}${updated}`);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
const focusLine = ctx.planEntries.length === 0 ? 0 : ctx.planIndex + 1;
|
|
302
|
+
const body = ctx.composeSplitScreen(listLines, renderPlanDetails(ctx, Math.max(28, cols - Math.floor(cols * 0.56) - 3), viewportHeight), cols, viewportHeight, focusLine, twoPane);
|
|
303
|
+
ctx.writeFrame("\x1b[2J\x1b[H" +
|
|
304
|
+
[...header, ...body, ctx.centerInWidth("─".repeat(Math.min(cols - 4, 56)), cols), footer].join("\r\n"));
|
|
305
|
+
}
|
|
306
|
+
export function renderPlanDetails(ctx, width, height) {
|
|
307
|
+
const selectedPlan = ctx.planEntries[ctx.planIndex];
|
|
308
|
+
if (!selectedPlan)
|
|
309
|
+
return new Array(height).fill("");
|
|
310
|
+
const lines = [];
|
|
311
|
+
lines.push("\x1b[1mDetails\x1b[0m");
|
|
312
|
+
lines.push(...ctx.wrapKeyValue("Agent", `${selectedPlan.label ?? selectedPlan.tool ?? "unknown"} (${selectedPlan.sessionId})`, width));
|
|
313
|
+
lines.push(...ctx.wrapKeyValue("Tool", selectedPlan.tool ?? "unknown", width));
|
|
314
|
+
lines.push(...ctx.wrapKeyValue("Worktree", selectedPlan.worktree ?? "main", width));
|
|
315
|
+
if (selectedPlan.updatedAt)
|
|
316
|
+
lines.push(...ctx.wrapKeyValue("Updated", selectedPlan.updatedAt, width));
|
|
317
|
+
lines.push(...ctx.wrapKeyValue("File", `.aimux/plans/${selectedPlan.sessionId}.md`, width));
|
|
318
|
+
lines.push("");
|
|
319
|
+
lines.push("\x1b[1mPreview\x1b[0m");
|
|
320
|
+
for (const previewLine of buildPlanPreview(ctx, selectedPlan.content, width, Math.max(4, height - lines.length))) {
|
|
321
|
+
lines.push(previewLine);
|
|
322
|
+
}
|
|
323
|
+
while (lines.length < height)
|
|
324
|
+
lines.push("");
|
|
325
|
+
return lines.slice(0, height);
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=subscreen-renderers.js.map
|