@towles/tool 0.0.104 → 0.0.105
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/package.json +1 -1
- package/src/commands/agentboard.ts +30 -9
package/package.json
CHANGED
|
@@ -18,9 +18,7 @@ const RUN_SHELL_LINE = "run-shell 'tt agentboard init'";
|
|
|
18
18
|
const MARKER = "# agentboard";
|
|
19
19
|
|
|
20
20
|
function findTmuxConf(): string | null {
|
|
21
|
-
const candidates = [
|
|
22
|
-
resolve(process.env.HOME ?? "~", ".config/tmux/tmux.conf"),
|
|
23
|
-
];
|
|
21
|
+
const candidates = [resolve(process.env.HOME ?? "~", ".config/tmux/tmux.conf")];
|
|
24
22
|
for (const path of candidates) {
|
|
25
23
|
try {
|
|
26
24
|
const real = existsSync(path) ? path : null;
|
|
@@ -281,13 +279,31 @@ function init(): void {
|
|
|
281
279
|
|
|
282
280
|
// Bind keybindings via command table "agentboard"
|
|
283
281
|
tmux("bind-key", "-T", "prefix", key, "switch-client", "-T", "agentboard");
|
|
284
|
-
tmux(
|
|
285
|
-
|
|
282
|
+
tmux(
|
|
283
|
+
"bind-key",
|
|
284
|
+
"-T",
|
|
285
|
+
"agentboard",
|
|
286
|
+
TMUX_BINDINGS.toggle,
|
|
287
|
+
"run-shell",
|
|
288
|
+
"tt agentboard run --toggle",
|
|
289
|
+
);
|
|
290
|
+
tmux(
|
|
291
|
+
"bind-key",
|
|
292
|
+
"-T",
|
|
293
|
+
"agentboard",
|
|
294
|
+
TMUX_BINDINGS.focus,
|
|
295
|
+
"run-shell",
|
|
296
|
+
"tt agentboard run --focus",
|
|
297
|
+
);
|
|
286
298
|
|
|
287
299
|
// Number keys 1-9 switch to session by index
|
|
288
300
|
for (let i = 1; i <= 9; i++) {
|
|
289
301
|
tmux(
|
|
290
|
-
"bind-key",
|
|
302
|
+
"bind-key",
|
|
303
|
+
"-T",
|
|
304
|
+
"agentboard",
|
|
305
|
+
String(i),
|
|
306
|
+
"run-shell",
|
|
291
307
|
`curl -s -X POST 'http://${host}:${port}/switch-index?index=${i}' -d "$(tmux display-message -p '#{q:client_tty}|#{q:session_name}|#{q:window_id}')" >/dev/null 2>&1 || true`,
|
|
292
308
|
);
|
|
293
309
|
}
|
|
@@ -298,7 +314,8 @@ function init(): void {
|
|
|
298
314
|
return `run-shell -b "curl -s -X POST http://${host}:${port}${path}${bodyArg} >/dev/null 2>&1 || true"`;
|
|
299
315
|
};
|
|
300
316
|
const focusBody = "#{q:client_tty}|#{q:session_name}|#{q:window_id}";
|
|
301
|
-
const resizeBody =
|
|
317
|
+
const resizeBody =
|
|
318
|
+
"#{q:pane_id}|#{q:session_name}|#{q:window_id}|#{q:pane_width}|#{q:window_width}";
|
|
302
319
|
|
|
303
320
|
tmux("set-hook", "-g", "client-session-changed", hookPost("/focus", focusBody));
|
|
304
321
|
tmux("set-hook", "-g", "after-select-window", hookPost("/ensure-sidebar", focusBody));
|
|
@@ -308,7 +325,9 @@ function init(): void {
|
|
|
308
325
|
async function runToggle(): Promise<void> {
|
|
309
326
|
if (!(await ensureServerUp())) process.exit(0);
|
|
310
327
|
const ctx = tmuxContext();
|
|
311
|
-
await fetch(`http://${SERVER_HOST}:${SERVER_PORT}/toggle`, { method: "POST", body: ctx }).catch(
|
|
328
|
+
await fetch(`http://${SERVER_HOST}:${SERVER_PORT}/toggle`, { method: "POST", body: ctx }).catch(
|
|
329
|
+
() => {},
|
|
330
|
+
);
|
|
312
331
|
resetTmuxKeys();
|
|
313
332
|
}
|
|
314
333
|
|
|
@@ -327,7 +346,9 @@ async function runFocus(): Promise<void> {
|
|
|
327
346
|
// Otherwise, ensure server + toggle sidebar on
|
|
328
347
|
if (!(await ensureServerUp())) process.exit(0);
|
|
329
348
|
const ctx = tmuxContext();
|
|
330
|
-
await fetch(`http://${SERVER_HOST}:${SERVER_PORT}/toggle`, { method: "POST", body: ctx }).catch(
|
|
349
|
+
await fetch(`http://${SERVER_HOST}:${SERVER_PORT}/toggle`, { method: "POST", body: ctx }).catch(
|
|
350
|
+
() => {},
|
|
351
|
+
);
|
|
331
352
|
|
|
332
353
|
// Wait for sidebar pane to appear
|
|
333
354
|
for (let i = 0; i < 20; i++) {
|