claudish 14.20.1 → 14.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5508,7 +5508,7 @@ var init_env_placeholder = __esm(() => {
5508
5508
  });
5509
5509
 
5510
5510
  // src/version.ts
5511
- var VERSION = "14.20.1";
5511
+ var VERSION = "14.20.2";
5512
5512
 
5513
5513
  // src/redact.ts
5514
5514
  function isPlaceholder(value) {
@@ -13989,7 +13989,7 @@ var init_bundled_recommended_list = __esm(() => {
13989
13989
  }
13990
13990
  }
13991
13991
  },
13992
- fetchedAt: "2026-11-12T05:06:43.487Z",
13992
+ fetchedAt: "2026-11-12T05:36:20.546Z",
13993
13993
  format: 1,
13994
13994
  recommendations: {
13995
13995
  contractVersion: 3,
@@ -0,0 +1,1219 @@
1
+ // src/herdr/app-mod/main.ts
2
+ import { createHash } from "crypto";
3
+ import { h_flex, v_flex } from "gpui-base";
4
+ import { View, div } from "gpui-kit";
5
+ import {
6
+ closeOverlay,
7
+ exec,
8
+ hc,
9
+ home,
10
+ layout,
11
+ openOverlay,
12
+ props,
13
+ readTextFile,
14
+ run,
15
+ terminals,
16
+ theme,
17
+ watchFolder
18
+ } from "herdr";
19
+
20
+ // src/herdr/state-map.ts
21
+ var HERDR_TEXT_MAX = 80;
22
+ var TERMINAL_STATES = new Set([
23
+ "COMPLETED",
24
+ "FAILED",
25
+ "TIMEOUT",
26
+ "CANCELLED",
27
+ "EMPTY"
28
+ ]);
29
+ function clipText(s, max = HERDR_TEXT_MAX) {
30
+ let out = "";
31
+ for (const ch of s) {
32
+ const code = ch.codePointAt(0) ?? 0;
33
+ out += code < 32 || code >= 127 && code <= 159 ? " " : ch;
34
+ }
35
+ out = out.replace(/\s+/g, " ").trim();
36
+ if ([...out].length <= max)
37
+ return out;
38
+ return `${[...out].slice(0, max - 1).join("")}…`;
39
+ }
40
+ function shortModel(model) {
41
+ if (!model)
42
+ return "claudish";
43
+ const at = model.lastIndexOf("@");
44
+ return at >= 0 && at < model.length - 1 ? model.slice(at + 1) : model;
45
+ }
46
+ var HC_ERROR_STATES = new Set(["FAILED", "TIMEOUT"]);
47
+
48
+ // src/herdr/app-mod/model.ts
49
+ var MOD_NAME = "claudish";
50
+ var FEED_TERMINAL = "claudish-feed";
51
+ var VIEW_TERMINAL_PREFIX = "claudish-view-";
52
+ var VIEW_WINDOW_KEY = "claudish-view";
53
+ var POLL_MS = 2000;
54
+ var LIVENESS_MS = 15000;
55
+ var PATH_HEAD = [
56
+ "$HOME/.bun/bin",
57
+ "$HOME/.local/bin",
58
+ "/opt/homebrew/bin",
59
+ "/usr/local/bin"
60
+ ];
61
+ var HC_NAME_RE = /^[a-z0-9_-]{1,32}$/;
62
+ function parseRelayStamp(r) {
63
+ const o = r;
64
+ if (!o || typeof o.pid !== "number" || typeof o.start36 !== "string")
65
+ return null;
66
+ return {
67
+ pid: o.pid,
68
+ start36: o.start36,
69
+ version: typeof o.version === "string" ? o.version : null
70
+ };
71
+ }
72
+ function isFeedShape(v) {
73
+ const o = v;
74
+ return Boolean(o) && Array.isArray(o?.servers) && Array.isArray(o?.items);
75
+ }
76
+ function parseFeed(text) {
77
+ if (!text)
78
+ return null;
79
+ try {
80
+ const v = JSON.parse(text);
81
+ if (!isFeedShape(v))
82
+ return null;
83
+ return {
84
+ relay: parseRelayStamp(v.relay),
85
+ servers: v.servers,
86
+ items: v.items,
87
+ history: Array.isArray(v.history) ? v.history : []
88
+ };
89
+ } catch {
90
+ return null;
91
+ }
92
+ }
93
+ function parseListing(stdout) {
94
+ const feed = parseFeed(stdout.trim());
95
+ return feed ? { servers: feed.servers, items: feed.items, history: feed.history } : null;
96
+ }
97
+ function sameRelay(a, b) {
98
+ return Boolean(a && b && a.pid === b.pid && a.start36 === b.start36);
99
+ }
100
+ function viewTerminalName(target, sha256Hex) {
101
+ const name = `${VIEW_TERMINAL_PREFIX}${sha256Hex(target).slice(0, 12)}`;
102
+ if (!HC_NAME_RE.test(name))
103
+ throw new Error(`not an hc terminal name: ${name}`);
104
+ return name;
105
+ }
106
+ function claudishArgv(install, args) {
107
+ return [
108
+ "/usr/bin/env",
109
+ `PATH=${install.pathEnv}`,
110
+ `CLAUDISH_PANE_ROOT=${install.root}`,
111
+ install.path,
112
+ ...args
113
+ ];
114
+ }
115
+ function hcRunArgs(name, cwd, argv) {
116
+ return [
117
+ "run",
118
+ "--bg",
119
+ "--json",
120
+ "--no-parent",
121
+ "--no-notify",
122
+ "--rm",
123
+ "--name",
124
+ name,
125
+ "--cwd",
126
+ cwd,
127
+ "--",
128
+ ...argv
129
+ ];
130
+ }
131
+ function feedRunArgs(install, home) {
132
+ return hcRunArgs(FEED_TERMINAL, home, claudishArgv(install, ["view", "--feed"]));
133
+ }
134
+ function viewRunArgs(install, target, name, home) {
135
+ return hcRunArgs(name, home, claudishArgv(install, ["view", target, "--front-end", "herdr-core"]));
136
+ }
137
+ function parseHcRun(r) {
138
+ let body;
139
+ try {
140
+ body = JSON.parse(r.stdout.trim() || r.stderr.trim());
141
+ } catch {
142
+ body = null;
143
+ }
144
+ if (r.code === 0 && typeof body?.address === "string")
145
+ return { kind: "started", address: body.address };
146
+ if (body?.error?.kind === "name_taken")
147
+ return { kind: "name_taken" };
148
+ const message = typeof body?.error?.message === "string" ? body.error.message : (r.stderr || r.stdout).trim() || `hc exited ${r.code}`;
149
+ return { kind: "failed", message: clipText(message, 160) };
150
+ }
151
+ function parseTranscriptRun(r, version) {
152
+ if (r?.code === 2)
153
+ return {
154
+ kind: "error",
155
+ message: `${version} cannot read transcripts: bun install -g claudish@latest`
156
+ };
157
+ let body = {};
158
+ try {
159
+ body = JSON.parse(r?.stdout ?? "");
160
+ } catch {
161
+ body = {};
162
+ }
163
+ if (r?.code !== 0 || !Array.isArray(body.lines)) {
164
+ const said = typeof body.error?.message === "string" ? body.error.message : null;
165
+ return {
166
+ kind: "error",
167
+ message: `no transcript: ${said ?? (r?.stderr.trim() || "claudish did not answer")}`
168
+ };
169
+ }
170
+ return {
171
+ kind: "page",
172
+ lines: body.lines,
173
+ cursor: typeof body.cursor === "string" ? body.cursor : null,
174
+ more: body.more === true,
175
+ final: body.final === true
176
+ };
177
+ }
178
+ function liveTerminal(list, name) {
179
+ return list.find((t) => t.name === name && (t.state ?? "live") === "live") ?? null;
180
+ }
181
+ function viewWindowSpec(address, target, title) {
182
+ return {
183
+ kind: "window",
184
+ key: VIEW_WINDOW_KEY,
185
+ width: 0.62,
186
+ height: 0.72,
187
+ layout: {
188
+ type: "column",
189
+ children: [
190
+ {
191
+ type: "block",
192
+ size: { px: 28 },
193
+ content: { mod: MOD_NAME, props: { role: "titlebar", terminal: address, target, title } }
194
+ },
195
+ { type: "block", content: { terminal: address } }
196
+ ]
197
+ }
198
+ };
199
+ }
200
+ function isPanel(node) {
201
+ const role = node.content?.props?.role;
202
+ return node.content?.mod === MOD_NAME && (role === undefined || role === "panel");
203
+ }
204
+ function pathToPanel(node) {
205
+ if (!node || typeof node !== "object")
206
+ return null;
207
+ if (isPanel(node))
208
+ return [node];
209
+ for (const child of [...node.children ?? [], ...node.floating ?? []]) {
210
+ const below = pathToPanel(child);
211
+ if (below)
212
+ return [node, ...below];
213
+ }
214
+ return null;
215
+ }
216
+ function panelNodeId(layout) {
217
+ const path = pathToPanel(layout);
218
+ return path?.[path.length - 1]?.id ?? null;
219
+ }
220
+ function isPanelVisible(layout) {
221
+ const path = pathToPanel(layout);
222
+ if (!path)
223
+ return true;
224
+ return path.every((node, i) => {
225
+ if (node.hidden)
226
+ return false;
227
+ const next = path[i + 1];
228
+ return !(node.type === "stack" && next && node.active !== undefined && node.active !== next.id);
229
+ });
230
+ }
231
+
232
+ // src/herdr/app-mod/runs.ts
233
+ var STATE_LOOK = {
234
+ STARTING: { code: "NEW", tone: "run", group: "running" },
235
+ RUNNING: { code: "RUN", tone: "run", group: "running" },
236
+ AWAITING_INPUT: { code: "ASK", tone: "ask", group: "needs you" },
237
+ AWAITING_PERMISSION: { code: "ASK", tone: "ask", group: "needs you" },
238
+ COMPLETED: { code: "END", tone: "done", group: "done" },
239
+ FAILED: { code: "ERR", tone: "fail", group: "failed" },
240
+ TIMEOUT: { code: "TMO", tone: "fail", group: "failed" },
241
+ EMPTY: { code: "NIL", tone: "fail", group: "failed" },
242
+ CANCELLED: { code: "STP", tone: "stopped", group: "stopped" }
243
+ };
244
+ var GROUP_ORDER = ["running", "needs you", "done", "failed", "stopped"];
245
+ var TERMINAL = new Set([
246
+ "COMPLETED",
247
+ "FAILED",
248
+ "TIMEOUT",
249
+ "CANCELLED",
250
+ "EMPTY"
251
+ ]);
252
+ var DASH = "—";
253
+ var EARLIER_MIN_TABS = 1;
254
+ var RUN_TAB_PX = 150;
255
+ var RUN_STRIP_RESERVE_PX = 110;
256
+ function isRowItem(item) {
257
+ return item.kind === "session" || item.kind === "team_slot";
258
+ }
259
+ function runStartMs(runId) {
260
+ const parts = runId.split("-");
261
+ if (parts.length < 3)
262
+ return null;
263
+ const ms = Number.parseInt(parts[parts.length - 2] ?? "", 36);
264
+ return Number.isFinite(ms) && ms > 1577836800000 && ms < 4102444800000 ? ms : null;
265
+ }
266
+ function count(n) {
267
+ if (n === null)
268
+ return DASH;
269
+ const a = Math.abs(n);
270
+ if (a < 1000)
271
+ return String(Math.round(n));
272
+ if (a < 9950)
273
+ return `${(n / 1000).toFixed(1)}k`;
274
+ if (a < 999500)
275
+ return `${Math.round(n / 1000)}k`;
276
+ return `${(n / 1e6).toFixed(1)}M`;
277
+ }
278
+ function runtime(ms) {
279
+ if (ms === null || !Number.isFinite(ms))
280
+ return DASH;
281
+ const s = Math.max(0, Math.floor(ms / 1000));
282
+ const m = Math.floor(s / 60);
283
+ const h = Math.floor(m / 60);
284
+ const d = Math.floor(h / 24);
285
+ if (s < 60)
286
+ return `${s}s`;
287
+ if (m < 60)
288
+ return `${m}m`;
289
+ if (h < 10)
290
+ return `${h}h${String(m % 60).padStart(2, "0")}m`;
291
+ if (h < 24)
292
+ return `${h}h`;
293
+ if (d < 10)
294
+ return `${d}d${String(h % 24).padStart(2, "0")}h`;
295
+ return `${Math.min(d, 999)}d`;
296
+ }
297
+ function dollars(usd) {
298
+ if (!Number.isFinite(usd) || usd < 0)
299
+ return DASH;
300
+ if (usd === 0)
301
+ return "$0";
302
+ if (usd < 0.01)
303
+ return "<$0.01";
304
+ return usd < 10 ? `$${usd.toFixed(2)}` : usd < 100 ? `$${usd.toFixed(1)}` : `$${Math.round(usd)}`;
305
+ }
306
+ function billing(item) {
307
+ if (item.cost_usd === 0 || item.cost_usd === null && /native/i.test(item.provider ?? ""))
308
+ return "SUB";
309
+ return item.cost_usd === null ? DASH : dollars(item.cost_usd);
310
+ }
311
+ function providerLabel(provider) {
312
+ return (provider ?? "").replace(/\s*\(native\)\s*$/i, "") || DASH;
313
+ }
314
+ function agentOf(item) {
315
+ return item.agent ?? item.agent_requested ?? null;
316
+ }
317
+ function elapsedOf(item, runStart, now) {
318
+ if (item.kind === "session")
319
+ return runtime(item.elapsed_seconds * 1000);
320
+ if (runStart === null)
321
+ return DASH;
322
+ if (!TERMINAL.has(item.state))
323
+ return runtime(now - runStart);
324
+ const last = item.last_activity_at ? Date.parse(item.last_activity_at) : Number.NaN;
325
+ return Number.isFinite(last) ? runtime(last - runStart) : DASH;
326
+ }
327
+ function answerLine(item) {
328
+ const text = [...item.recent ?? []].reverse().find((s) => s.kind === "text");
329
+ return text ? text.summary : null;
330
+ }
331
+ function stepLine(item) {
332
+ const step = item.recent?.at(-1);
333
+ if (!step)
334
+ return item.activity;
335
+ if (!step.tool)
336
+ return step.summary;
337
+ return step.summary ? `${step.tool}: ${step.summary}` : step.tool;
338
+ }
339
+ function noteOf(item) {
340
+ const terminal = TERMINAL.has(item.state);
341
+ const why = item.reason_detail ?? item.reason;
342
+ if (terminal && item.state !== "COMPLETED" && why)
343
+ return { note: clipText(why, 160), error: true };
344
+ const line = (terminal ? answerLine(item) : stepLine(item)) ?? item.prompt_summary ?? "";
345
+ return { note: clipText(line, 160), error: false };
346
+ }
347
+ function rowOf(item, runStart, now, recordOnly) {
348
+ const look = STATE_LOOK[item.state] ?? STATE_LOOK.FAILED;
349
+ const terminal = TERMINAL.has(item.state);
350
+ const { note, error } = noteOf(item);
351
+ return {
352
+ target: item.target,
353
+ slot: item.kind === "team_slot" ? item.slot : "··",
354
+ state: item.state,
355
+ code: look.code,
356
+ tone: look.tone,
357
+ elapsed: elapsedOf(item, runStart, now),
358
+ model: shortModel(item.model),
359
+ provider: providerLabel(item.provider),
360
+ tokens: item.tokens_in === null && item.tokens_out === null ? DASH : `↑${count(item.tokens_in)} ↓${count(item.tokens_out)}`,
361
+ tools: `ƒ ${item.tool_calls}`,
362
+ turns: `↻ ${item.turns_completed}`,
363
+ billing: billing(item),
364
+ agent: agentOf(item),
365
+ note,
366
+ error,
367
+ finished: terminal,
368
+ noScreen: terminal && item.state !== "COMPLETED" && item.turns_completed === 0 && item.tool_calls === 0 && (item.tokens_in ?? 0) === 0,
369
+ recordOnly,
370
+ reason: item.reason,
371
+ reasonDetail: item.reason_detail,
372
+ modelSpec: item.model,
373
+ providerName: item.provider,
374
+ recordsPath: item.kind === "team_slot" ? `${item.run_path}/` : `~/.claudish/sessions/${item.session_id}/`
375
+ };
376
+ }
377
+ function toneOf(rows) {
378
+ if (rows.some((r) => r.tone === "ask"))
379
+ return "ask";
380
+ if (rows.some((r) => r.tone === "run"))
381
+ return "run";
382
+ if (rows.some((r) => r.tone === "done"))
383
+ return "done";
384
+ if (rows.length > 0 && rows.every((r) => r.tone === "stopped"))
385
+ return "stopped";
386
+ return "fail";
387
+ }
388
+ function countsOf(rows) {
389
+ const n = new Map;
390
+ for (const r of rows) {
391
+ const g = STATE_LOOK[r.state]?.group ?? "failed";
392
+ n.set(g, (n.get(g) ?? 0) + 1);
393
+ }
394
+ return GROUP_ORDER.filter((g) => n.has(g)).map((g) => `${n.get(g)} ${g}`).join(" · ");
395
+ }
396
+ function nameOf(item) {
397
+ if (item.kind === "session")
398
+ return `s:${item.session_id.slice(0, 4)}`;
399
+ const parts = item.run_path.split("/").filter(Boolean);
400
+ const last = parts.at(-1) ?? item.run_id;
401
+ return last === "judging" && parts.length > 1 ? `${parts.at(-2)} judges` : last;
402
+ }
403
+ function sharedValue(values) {
404
+ const set = new Set(values);
405
+ return set.size === 1 ? [...set][0] : null;
406
+ }
407
+ function runOf(key, list, now, recordOnly) {
408
+ const first = list[0];
409
+ const startedAt = first.kind === "team_slot" ? runStartMs(first.run_id) : Date.parse(first.started_at);
410
+ const start = startedAt !== null && Number.isFinite(startedAt) ? startedAt : null;
411
+ const rows = list.map((item) => rowOf(item, start, now, recordOnly.has(item.target))).sort((a, b) => Number(a.finished) - Number(b.finished) || a.slot.localeCompare(b.slot));
412
+ const differ = new Set(rows.map((r) => r.agent)).size > 1;
413
+ const agent = sharedValue(rows.map((r) => r.agent));
414
+ const taskType = sharedValue(list.map((i) => i.task_type ?? null));
415
+ const meta = [taskType, agent ? `agent ${agent}` : null].filter(Boolean).join(" · ");
416
+ for (const r of rows)
417
+ r.agent = differ ? r.agent ?? DASH : null;
418
+ return {
419
+ key,
420
+ kind: first.kind === "team_slot" ? "team" : "session",
421
+ name: nameOf(first),
422
+ startedAt: start,
423
+ tone: toneOf(rows),
424
+ counts: countsOf(rows),
425
+ meta: meta || null,
426
+ rows
427
+ };
428
+ }
429
+ function runsOf(items, now, recordOnly = new Set) {
430
+ const groups = new Map;
431
+ for (const item of items) {
432
+ if (!isRowItem(item))
433
+ continue;
434
+ const key = item.kind === "team_slot" ? item.run_id : item.target;
435
+ groups.set(key, [...groups.get(key) ?? [], item]);
436
+ }
437
+ return [...groups].map(([key, list]) => runOf(key, list, now, recordOnly)).sort((a, b) => (b.startedAt ?? 0) - (a.startedAt ?? 0));
438
+ }
439
+ function maxRunTabs(width) {
440
+ return Math.max(EARLIER_MIN_TABS, Math.floor((width - RUN_STRIP_RESERVE_PX) / RUN_TAB_PX));
441
+ }
442
+ function runTabs(runs, selected, max, now) {
443
+ const fit = Math.max(EARLIER_MIN_TABS, max);
444
+ const tab = (r) => ({
445
+ key: r.key,
446
+ name: r.name,
447
+ tone: r.tone,
448
+ age: r === runs[0] ? "latest" : r.startedAt === null ? "" : `${runtime(now - r.startedAt)} ago`,
449
+ selected: r.key === selected
450
+ });
451
+ const shown = runs.slice(0, fit);
452
+ const at = runs.findIndex((r) => r.key === selected);
453
+ if (at >= fit)
454
+ shown[fit - 1] = runs[at];
455
+ const keys = new Set(shown.map((r) => r.key));
456
+ return { tabs: shown.map(tab), earlier: runs.filter((r) => !keys.has(r.key)).map(tab) };
457
+ }
458
+ function sessionTabs(run, selected) {
459
+ return run.rows.map((r) => ({
460
+ target: r.target,
461
+ label: `${r.slot} ${clipText(r.model, 18)}`,
462
+ tone: r.tone,
463
+ selected: r.target === selected
464
+ }));
465
+ }
466
+ function footerLine(row, mode) {
467
+ if (mode === "text")
468
+ return `read only · transcript of slot ${row.slot}`;
469
+ if (row.noScreen)
470
+ return "read only · no screen: the reason and records are shown";
471
+ if (row.recordOnly)
472
+ return "read only · from its records: no running claudish holds it";
473
+ if (!row.finished)
474
+ return `read only · live screen of slot ${row.slot}; focusing it takes the view`;
475
+ return "read only · finished: a replay of the real interface";
476
+ }
477
+ function tilde(path, home) {
478
+ return home && path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
479
+ }
480
+ function failureCard(row, home) {
481
+ return [
482
+ "This session ended before Claude Code started, so it has no screen to replay.",
483
+ "",
484
+ `reason ${row.reason ?? row.state.toLowerCase()}`,
485
+ `detail ${row.reasonDetail ?? "none recorded"}`,
486
+ `model ${row.modelSpec} → ${row.providerName ?? "provider unknown"}`,
487
+ `records ${tilde(row.recordsPath, home)}`
488
+ ];
489
+ }
490
+ function recordCard(row, home) {
491
+ return [
492
+ "No running claudish MCP server holds this run any more, so its screen cannot be shown.",
493
+ "Text shows its conversation.",
494
+ "",
495
+ `state ${row.state.toLowerCase()}${row.reason ? ` (${row.reason})` : ""}`,
496
+ `model ${row.modelSpec} → ${row.providerName ?? "provider unknown"}`,
497
+ `records ${tilde(row.recordsPath, home)}`
498
+ ];
499
+ }
500
+ var SPEAKER = {
501
+ user: "user",
502
+ assistant: "asst",
503
+ tool: "tool",
504
+ task_file: "task",
505
+ system: "sys ",
506
+ error: "err "
507
+ };
508
+ function transcriptText(lines) {
509
+ const out = [];
510
+ for (const l of lines) {
511
+ if (l.cont && out.length > 0)
512
+ out[out.length - 1] += l.text;
513
+ else
514
+ out.push(`${SPEAKER[l.kind] ?? " "} ${l.text}`);
515
+ }
516
+ return out;
517
+ }
518
+
519
+ // src/herdr/app-mod/controller.ts
520
+ var TRANSCRIPT_MS = 2000;
521
+ var TRANSCRIPT_PAGES = 10;
522
+ var RELAY_RESTART_MS = 2000;
523
+
524
+ class PanelSeat {
525
+ owner = null;
526
+ waiters = [];
527
+ take(who) {
528
+ if (this.owner === null)
529
+ this.owner = who;
530
+ return this.owner === who;
531
+ }
532
+ release(who) {
533
+ if (this.owner !== who)
534
+ return;
535
+ this.owner = null;
536
+ const waiters = this.waiters;
537
+ this.waiters = [];
538
+ for (const w of waiters)
539
+ w();
540
+ }
541
+ freed() {
542
+ return new Promise((resolve) => this.waiters.push(resolve));
543
+ }
544
+ }
545
+ var INSTALL_LINE = "claudish is not installed: bun install -g claudish";
546
+ function updateLine(version) {
547
+ return `${version} has no view command: bun install -g claudish@latest`;
548
+ }
549
+
550
+ class PanelController {
551
+ host;
552
+ phase = "booting";
553
+ message = null;
554
+ install = null;
555
+ items = [];
556
+ history = [];
557
+ servers = [];
558
+ feedMode = "relay";
559
+ selected = null;
560
+ view = null;
561
+ visible = false;
562
+ pickedRun = null;
563
+ focus = null;
564
+ mode = "screen";
565
+ earlierOpen = false;
566
+ width = 320;
567
+ transcripts = new Map;
568
+ kept = [];
569
+ relayNotice = null;
570
+ livenessDueAt = 0;
571
+ deadRelay = null;
572
+ sawFeedTerminal = false;
573
+ waiters = [];
574
+ constructor(host) {
575
+ this.host = host;
576
+ }
577
+ get feedPath() {
578
+ return this.install ? `${this.install.root}/feed/feed.json` : null;
579
+ }
580
+ get feedDir() {
581
+ return this.install ? `${this.install.root}/feed` : null;
582
+ }
583
+ async boot() {
584
+ const probe = await this.host.exec("/bin/sh", [
585
+ "-c",
586
+ `PATH="${PATH_HEAD.join(":")}:$PATH"; export PATH; command -v claudish && printf '%s\\n' "$PATH"`
587
+ ]).catch(() => null);
588
+ const [path, pathEnv] = (probe?.code === 0 ? probe.stdout : "").trim().split(`
589
+ `);
590
+ if (!path?.startsWith("/") || !pathEnv)
591
+ return this.missing();
592
+ const partial = { path, pathEnv, root: "", version: "" };
593
+ const version = await this.run(partial, ["--version"], false);
594
+ if (!version)
595
+ return this.missing();
596
+ const root = await this.run(partial, ["view", "--print-root"], false);
597
+ if (!root)
598
+ return this.missing(updateLine(version.trim()));
599
+ this.install = { path, pathEnv, root: root.trim(), version: version.trim() };
600
+ this.phase = "ready";
601
+ this.message = "starting";
602
+ }
603
+ setVisible(visible) {
604
+ if (visible === this.visible)
605
+ return;
606
+ this.visible = visible;
607
+ if (visible)
608
+ this.livenessDueAt = 0;
609
+ this.wake();
610
+ }
611
+ noteTerminals(list) {
612
+ const live = liveTerminal(list, FEED_TERMINAL) !== null;
613
+ if (live)
614
+ this.sawFeedTerminal = true;
615
+ else if (this.sawFeedTerminal) {
616
+ this.sawFeedTerminal = false;
617
+ this.livenessDueAt = 0;
618
+ this.wake();
619
+ }
620
+ }
621
+ changed() {
622
+ return new Promise((resolve) => this.waiters.push(resolve));
623
+ }
624
+ nextWaitMs() {
625
+ const base = this.feedMode === "poll" ? POLL_MS : Math.max(0, this.livenessDueAt - this.host.now());
626
+ return this.followingTranscript() ? Math.min(base, TRANSCRIPT_MS) : base;
627
+ }
628
+ allItems() {
629
+ const seen = new Set;
630
+ const out = [];
631
+ for (const item of [...this.items, ...this.history, ...this.kept]) {
632
+ if (seen.has(item.target))
633
+ continue;
634
+ seen.add(item.target);
635
+ out.push(item);
636
+ }
637
+ return out;
638
+ }
639
+ runs() {
640
+ const held = new Set(this.items.map((i) => i.target));
641
+ const recordOnly = new Set(this.allItems().map((i) => i.target).filter((t) => !held.has(t)));
642
+ return runsOf(this.allItems(), this.host.now(), recordOnly);
643
+ }
644
+ currentRun() {
645
+ const runs = this.runs();
646
+ return runs.find((r) => r.key === this.pickedRun) ?? runs[0] ?? null;
647
+ }
648
+ currentRow() {
649
+ const run = this.currentRun();
650
+ return run?.rows.find((r) => r.target === this.focus) ?? run?.rows[0] ?? null;
651
+ }
652
+ maxTabs() {
653
+ return maxRunTabs(this.width);
654
+ }
655
+ async selectRun(key) {
656
+ this.pickedRun = key;
657
+ this.earlierOpen = false;
658
+ this.focus = this.runs().find((r) => r.key === key)?.rows[0]?.target ?? null;
659
+ await this.show();
660
+ }
661
+ async selectSlot(target) {
662
+ const run = this.runs().find((r) => r.rows.some((row) => row.target === target));
663
+ if (run)
664
+ this.pickedRun = run.key;
665
+ this.focus = target;
666
+ await this.show();
667
+ }
668
+ async setMode(mode) {
669
+ this.mode = mode;
670
+ await this.show();
671
+ }
672
+ toggleEarlier() {
673
+ this.earlierOpen = !this.earlierOpen;
674
+ }
675
+ transcriptLines() {
676
+ const row = this.currentRow();
677
+ if (!row)
678
+ return [];
679
+ const t = this.transcripts.get(row.target);
680
+ if (t?.error)
681
+ return [t.error];
682
+ if (t && t.lines.length > 0)
683
+ return transcriptText(t.lines);
684
+ if (row.noScreen)
685
+ return ["no transcript: the session ended before Claude Code started"];
686
+ return [t?.final ? "no transcript: nothing was recorded" : "reading the transcript…"];
687
+ }
688
+ async show() {
689
+ const row = this.currentRow();
690
+ if (!row)
691
+ return;
692
+ if (this.mode === "text") {
693
+ await this.readTranscript(row.target);
694
+ return;
695
+ }
696
+ if (row.noScreen || row.recordOnly) {
697
+ if (this.view)
698
+ this.host.killTerminal(this.view.address);
699
+ this.view = null;
700
+ this.selected = null;
701
+ return;
702
+ }
703
+ await this.select(row.target);
704
+ }
705
+ followingTranscript() {
706
+ if (this.mode !== "text" || !this.visible || this.phase !== "ready")
707
+ return false;
708
+ const row = this.currentRow();
709
+ const t = row ? this.transcripts.get(row.target) : undefined;
710
+ return Boolean(row && !row.noScreen && !row.recordOnly && !t?.final && !t?.error);
711
+ }
712
+ async readTranscript(target) {
713
+ if (!this.install)
714
+ return;
715
+ const t = this.transcripts.get(target) ?? {
716
+ lines: [],
717
+ cursor: null,
718
+ final: false,
719
+ error: null,
720
+ readAt: 0
721
+ };
722
+ this.transcripts.set(target, t);
723
+ t.readAt = this.host.now();
724
+ for (let page = 0;page < TRANSCRIPT_PAGES; page++) {
725
+ const args = ["view", "--transcript", target, ...t.cursor ? ["--since", t.cursor] : []];
726
+ const argv = claudishArgv(this.install, args);
727
+ const r = await this.host.exec(argv[0], argv.slice(1)).catch(() => null);
728
+ const answer = parseTranscriptRun(r, this.install.version);
729
+ if (answer.kind === "error") {
730
+ t.error = answer.message;
731
+ return;
732
+ }
733
+ t.error = null;
734
+ t.lines.push(...answer.lines);
735
+ t.cursor = answer.cursor ?? t.cursor;
736
+ t.final = answer.final;
737
+ if (!answer.more)
738
+ return;
739
+ }
740
+ }
741
+ get watching() {
742
+ return this.phase === "ready" && this.visible && this.feedMode === "relay";
743
+ }
744
+ async tick() {
745
+ if (this.phase !== "ready" || !this.visible)
746
+ return;
747
+ let checked = false;
748
+ if (this.host.now() >= this.livenessDueAt) {
749
+ await this.checkRelay();
750
+ checked = true;
751
+ }
752
+ if (this.feedMode === "relay" && !await this.readFeed() && !checked)
753
+ await this.checkRelay();
754
+ if (this.feedMode === "poll" && !await this.readFreshFeed())
755
+ await this.pollList();
756
+ const row = this.currentRow();
757
+ const t = row ? this.transcripts.get(row.target) : undefined;
758
+ if (row && this.followingTranscript() && this.host.now() - (t?.readAt ?? 0) >= TRANSCRIPT_MS)
759
+ await this.readTranscript(row.target);
760
+ }
761
+ async select(target) {
762
+ if (!this.install)
763
+ return;
764
+ const name = viewTerminalName(target, (s) => this.host.sha256Hex(s));
765
+ const prev = this.view;
766
+ if (prev && prev.name !== name) {
767
+ this.host.killTerminal(prev.address);
768
+ this.view = null;
769
+ }
770
+ let address = liveTerminal(this.host.terminals(), name)?.address ?? null;
771
+ if (address) {
772
+ await this.host.hc(["keys", address, "enter"]).catch(() => null);
773
+ } else
774
+ address = await this.startViewer(target, name);
775
+ if (!address)
776
+ return;
777
+ this.view = { target, name, address };
778
+ this.selected = target;
779
+ const run = this.runs().find((r) => r.rows.some((row) => row.target === target));
780
+ const row = run?.rows.find((r) => r.target === target);
781
+ const item = this.allItems().find((i) => i.target === target);
782
+ const fallback = item ? item.model ?? target : target;
783
+ const title = run && row ? `${run.name} · ${row.slot} · ${row.model}` : fallback;
784
+ this.host.openOverlay(viewWindowSpec(address, target, title));
785
+ }
786
+ closeViews() {
787
+ const killed = new Set;
788
+ if (this.view) {
789
+ this.host.killTerminal(this.view.address);
790
+ killed.add(this.view.address);
791
+ }
792
+ for (const t of this.host.terminals())
793
+ if (t.name?.startsWith(VIEW_TERMINAL_PREFIX) && !killed.has(t.address))
794
+ this.host.killTerminal(t.address);
795
+ this.view = null;
796
+ }
797
+ missing(message = INSTALL_LINE) {
798
+ this.phase = "missing";
799
+ this.message = message;
800
+ }
801
+ wake() {
802
+ const waiters = this.waiters;
803
+ this.waiters = [];
804
+ for (const w of waiters)
805
+ w();
806
+ }
807
+ async run(install, args, withRoot = true) {
808
+ const argv = withRoot ? claudishArgv(install, args) : ["/usr/bin/env", `PATH=${install.pathEnv}`, install.path, ...args];
809
+ const r = await this.host.exec(argv[0], argv.slice(1)).catch(() => null);
810
+ return r && r.code === 0 ? r.stdout : null;
811
+ }
812
+ async checkRelay() {
813
+ if (!this.install)
814
+ return;
815
+ this.livenessDueAt = this.host.now() + LIVENESS_MS;
816
+ const argv = claudishArgv(this.install, ["view", "--feed-check"]);
817
+ const r = await this.host.exec(argv[0], argv.slice(1)).catch(() => null);
818
+ let check = {};
819
+ try {
820
+ check = JSON.parse(r?.stdout ?? "");
821
+ } catch {
822
+ check = {};
823
+ }
824
+ const stamp = parseRelayStamp(check.relay);
825
+ if (check.alive === true) {
826
+ const want = typeof check.version === "string" ? check.version : null;
827
+ if (want && stamp && stamp.version !== want)
828
+ await this.replaceRelay(stamp, want);
829
+ return;
830
+ }
831
+ if (this.feedMode === "relay") {
832
+ this.items = [];
833
+ this.servers = [];
834
+ this.message = "reconnecting";
835
+ }
836
+ this.deadRelay = stamp;
837
+ this.feedMode = "poll";
838
+ await this.startRelay();
839
+ }
840
+ async replaceRelay(stamp, want) {
841
+ this.deadRelay = stamp;
842
+ this.feedMode = "poll";
843
+ const term = liveTerminal(this.host.terminals(), FEED_TERMINAL);
844
+ if (!term) {
845
+ this.relayNotice = `an older feed relay (pid ${stamp.pid}) still runs; polling until it exits`;
846
+ this.message = this.relayNotice;
847
+ return;
848
+ }
849
+ this.host.killTerminal(term.address);
850
+ this.relayNotice = `restarting the feed relay for claudish ${want}`;
851
+ this.message = this.relayNotice;
852
+ this.livenessDueAt = this.host.now() + RELAY_RESTART_MS;
853
+ await this.startRelay();
854
+ }
855
+ async startRelay() {
856
+ if (!this.install)
857
+ return;
858
+ const r = await this.host.hc(feedRunArgs(this.install, this.host.home())).catch((e) => ({ code: 1, stdout: "", stderr: String(e) }));
859
+ const out = parseHcRun(r);
860
+ if (out.kind === "failed")
861
+ this.message = `feed relay did not start: ${out.message}`;
862
+ }
863
+ async readFeed() {
864
+ const feed = await this.loadFeed();
865
+ if (!feed)
866
+ return false;
867
+ this.apply(feed);
868
+ return true;
869
+ }
870
+ async readFreshFeed() {
871
+ const feed = await this.loadFeed();
872
+ if (!feed?.relay || sameRelay(feed.relay, this.deadRelay))
873
+ return false;
874
+ this.feedMode = "relay";
875
+ this.deadRelay = null;
876
+ this.relayNotice = null;
877
+ this.apply(feed);
878
+ return true;
879
+ }
880
+ async loadFeed() {
881
+ const path = this.feedPath;
882
+ if (!path)
883
+ return null;
884
+ return parseFeed(await this.host.readTextFile(path).catch(() => null));
885
+ }
886
+ async pollList() {
887
+ if (!this.install)
888
+ return;
889
+ const out = await this.run(this.install, ["view", "--list", "--json", "--include-finished"]) ?? await this.run(this.install, ["view", "--list", "--json"]);
890
+ const listing = out ? parseListing(out) : null;
891
+ if (!listing)
892
+ return;
893
+ this.apply(listing);
894
+ }
895
+ apply(feed) {
896
+ const shown = new Set(this.currentRun()?.rows.map((r) => r.target) ?? []);
897
+ const before = this.allItems().filter((i) => shown.has(i.target));
898
+ this.servers = feed.servers;
899
+ this.items = feed.items;
900
+ this.history = feed.history;
901
+ const listed = new Set([...this.items, ...this.history].map((i) => i.target));
902
+ this.kept = before.filter((i) => !listed.has(i.target));
903
+ this.message = this.relayNotice ?? this.emptyMessage();
904
+ }
905
+ emptyMessage() {
906
+ if (this.servers.length === 0)
907
+ return this.history.length > 0 ? "no claudish MCP server is running · runs shown from their records" : "no claudish MCP server is running";
908
+ return this.allItems().length > 0 ? null : "no sessions";
909
+ }
910
+ async startViewer(target, name) {
911
+ if (!this.install)
912
+ return null;
913
+ const r = await this.host.hc(viewRunArgs(this.install, target, name, this.host.home())).catch((e) => ({ code: 1, stdout: "", stderr: String(e) }));
914
+ const out = parseHcRun(r);
915
+ if (out.kind === "started")
916
+ return out.address;
917
+ if (out.kind === "name_taken") {
918
+ const got = await this.host.hc(["get", name, "--json"]).catch(() => null);
919
+ try {
920
+ const address = JSON.parse(got?.stdout ?? "").address;
921
+ if (typeof address === "string")
922
+ return address;
923
+ } catch {}
924
+ }
925
+ this.message = `could not open ${target}: ${out.kind === "failed" ? out.message : "name taken"}`;
926
+ return null;
927
+ }
928
+ }
929
+
930
+ // src/herdr/app-mod/palette.ts
931
+ var LIGHT = {
932
+ run: "#1D4ED8",
933
+ ask: "#92400E",
934
+ done: "#166534",
935
+ fail: "#B91C1C",
936
+ stopped: "#8F94AC",
937
+ model: "#4338CA",
938
+ tools: "#0D9488",
939
+ loops: "#7C3AED",
940
+ cost: "#A16207"
941
+ };
942
+ var DARK = {
943
+ run: "#89B4FA",
944
+ ask: "#FFB454",
945
+ done: "#22E06B",
946
+ fail: "#FF4D5E",
947
+ stopped: "#5A5E78",
948
+ model: "#5B6CE0",
949
+ tools: "#4FD6BE",
950
+ loops: "#B794F6",
951
+ cost: "#FFD479"
952
+ };
953
+ var SNOW = "#FFFFFF";
954
+ var INK = "#0B0B12";
955
+ function rgb(hex) {
956
+ const m = /^#([0-9a-f]{6})/i.exec(hex);
957
+ if (!m)
958
+ return null;
959
+ const n = Number.parseInt(m[1], 16);
960
+ return [n >> 16 & 255, n >> 8 & 255, n & 255];
961
+ }
962
+ function hex([r, g, b]) {
963
+ return `#${[r, g, b].map((v) => Math.round(v).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
964
+ }
965
+ function mix(a, b, t) {
966
+ const x = rgb(a) ?? [0, 0, 0];
967
+ const y = rgb(b) ?? [0, 0, 0];
968
+ return hex([x[0] + (y[0] - x[0]) * t, x[1] + (y[1] - x[1]) * t, x[2] + (y[2] - x[2]) * t]);
969
+ }
970
+ function luminance(c) {
971
+ const lin = (v) => {
972
+ const s = v / 255;
973
+ return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
974
+ };
975
+ const [r, g, b] = rgb(c) ?? [0, 0, 0];
976
+ return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
977
+ }
978
+ function contrast(a, b) {
979
+ const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
980
+ return (hi + 0.05) / (lo + 0.05);
981
+ }
982
+ function inkOn(fill) {
983
+ return contrast(SNOW, fill) >= contrast(INK, fill) ? SNOW : INK;
984
+ }
985
+ function build(hues, light) {
986
+ const solid = {};
987
+ const quiet = {};
988
+ for (const [k, h] of Object.entries(hues)) {
989
+ solid[k] = { fg: inkOn(h), bg: h };
990
+ quiet[k] = light ? { fg: mix(h, "#000000", 0.38), bg: mix(h, SNOW, 0.82) } : { fg: SNOW, bg: mix(h, "#000000", 0.55) };
991
+ }
992
+ return {
993
+ solid,
994
+ quiet,
995
+ text: hues,
996
+ tokensIn: light ? { fg: INK, bg: "#CDFFD3" } : { fg: SNOW, bg: "#0F592A" },
997
+ tokensOut: light ? { fg: INK, bg: "#95FFA6" } : { fg: SNOW, bg: "#16803D" },
998
+ mark: light ? "#C2410C" : "#E0875A"
999
+ };
1000
+ }
1001
+ var LIGHT_PALETTE = build(LIGHT, true);
1002
+ var DARK_PALETTE = build(DARK, false);
1003
+ function paletteFor(background) {
1004
+ return background && rgb(background) && luminance(background) > 0.4 ? LIGHT_PALETTE : DARK_PALETTE;
1005
+ }
1006
+
1007
+ // src/herdr/app-mod/main.ts
1008
+ var host = {
1009
+ exec: (command, args, options) => exec(command, args, options),
1010
+ hc: (args) => hc(args),
1011
+ readTextFile: (path) => readTextFile(path),
1012
+ terminals: () => terminals(),
1013
+ openOverlay: (spec) => openOverlay(spec),
1014
+ killTerminal: (address) => {
1015
+ run("terminal.kill", { terminal: address });
1016
+ },
1017
+ home: () => home(),
1018
+ sha256Hex: (s) => createHash("sha256").update(s).digest("hex"),
1019
+ now: () => Date.now()
1020
+ };
1021
+ var seat = new PanelSeat;
1022
+ function roleOf() {
1023
+ const role = props()?.role;
1024
+ return role === "titlebar" || role === "toggle" ? role : "panel";
1025
+ }
1026
+ function colour(t, name, fallback) {
1027
+ const v = t[name];
1028
+ return typeof v === "string" && v.startsWith("#") ? v : fallback;
1029
+ }
1030
+ function chip(text, ink, opts = {}) {
1031
+ return div().px(6).py(1).flex_none().when(opts.minW !== undefined, (el) => el.min_w(opts.minW)).bg(ink.bg).text_color(ink.fg).when(opts.bold === true, (el) => el.font_bold()).whitespace_nowrap().child(text);
1032
+ }
1033
+
1034
+ class ClaudishPanel extends View {
1035
+ role = "panel";
1036
+ ctl = null;
1037
+ standby = false;
1038
+ init(_props, cx) {
1039
+ this.role = roleOf();
1040
+ if (this.role !== "panel")
1041
+ return;
1042
+ if (seat.take(this)) {
1043
+ this.startPanel(cx);
1044
+ return;
1045
+ }
1046
+ this.standby = true;
1047
+ cx.spawn(async (cx) => {
1048
+ while (!seat.take(this))
1049
+ await seat.freed();
1050
+ this.standby = false;
1051
+ this.startPanel(cx);
1052
+ cx.notify();
1053
+ });
1054
+ }
1055
+ startPanel(cx) {
1056
+ const ctl = new PanelController(host);
1057
+ this.ctl = ctl;
1058
+ cx.spawn(async (cx) => {
1059
+ await ctl.boot();
1060
+ cx.notify();
1061
+ let pendingWatch = null;
1062
+ for (;; ) {
1063
+ if (!ctl.visible || ctl.phase !== "ready") {
1064
+ await ctl.changed();
1065
+ continue;
1066
+ }
1067
+ await ctl.tick();
1068
+ cx.notify();
1069
+ const waits = [
1070
+ cx.sleep(Math.max(250, ctl.nextWaitMs())),
1071
+ ctl.changed()
1072
+ ];
1073
+ const dir = ctl.feedDir;
1074
+ if (ctl.watching && dir) {
1075
+ pendingWatch ??= watchFolder(dir).catch(() => null).finally(() => {
1076
+ pendingWatch = null;
1077
+ });
1078
+ waits.push(pendingWatch);
1079
+ }
1080
+ await Promise.race(waits);
1081
+ }
1082
+ });
1083
+ }
1084
+ async close() {
1085
+ this.ctl?.closeViews();
1086
+ seat.release(this);
1087
+ }
1088
+ render(cx) {
1089
+ if (this.role === "titlebar")
1090
+ return this.renderTitlebar();
1091
+ if (this.role === "toggle")
1092
+ return this.renderToggle();
1093
+ const ctl = this.ctl;
1094
+ if (ctl) {
1095
+ ctl.setVisible(isPanelVisible(layout()));
1096
+ ctl.noteTerminals(terminals());
1097
+ }
1098
+ return this.renderPanel(cx, ctl);
1099
+ }
1100
+ act(cx, action) {
1101
+ const ctl = this.ctl;
1102
+ if (!ctl)
1103
+ return;
1104
+ cx.spawn(async (cx) => {
1105
+ await action(ctl);
1106
+ cx.notify();
1107
+ });
1108
+ }
1109
+ renderPanel(cx, ctl) {
1110
+ const t = theme();
1111
+ const p = paletteFor(t.background);
1112
+ const panel = v_flex().id("claudish-panel").size_full().bg(colour(t, "chrome", colour(t, "surface", "#1B1D22"))).text_size(13).on_size_change((size) => {
1113
+ if (ctl)
1114
+ ctl.width = size.width;
1115
+ });
1116
+ if (this.standby || !ctl) {
1117
+ const why = this.standby ? "claudish is open in another panel" : "starting";
1118
+ return panel.child(div().px(14).py(10).text_color(colour(t, "muted", "#9AA0AB")).child(why));
1119
+ }
1120
+ const current = ctl.currentRun();
1121
+ const row = ctl.currentRow();
1122
+ const tabs = runTabs(ctl.runs(), current?.key ?? null, ctl.maxTabs(), Date.now());
1123
+ panel.child(this.runStrip(cx, ctl, tabs, t, p));
1124
+ if (ctl.earlierOpen && tabs.earlier.length > 0)
1125
+ panel.child(this.earlierList(cx, tabs.earlier, t, p));
1126
+ if (ctl.message)
1127
+ panel.child(div().px(14).py(6).text_size(12).text_color(colour(t, "muted", "#9AA0AB")).child(ctl.message));
1128
+ if (current) {
1129
+ panel.child(this.runHeader(current, t, p));
1130
+ panel.child(this.rowList(cx, current, row, t, p));
1131
+ panel.child(this.sessionStrip(cx, ctl, current, row, t, p));
1132
+ }
1133
+ panel.child(this.screenArea(cx, ctl, row, t));
1134
+ if (row)
1135
+ panel.child(div().px(14).py(6).border_t(1).border_color(colour(t, "border", "#2C2F37")).text_size(12).text_color(colour(t, "dim", "#6F7581")).truncate().child(footerLine(row, ctl.mode)));
1136
+ return panel;
1137
+ }
1138
+ tab(id, selected, t, onClick, children) {
1139
+ return h_flex().id(id).px(12).py(7).gap(6).flex_none().items_center().cursor_pointer().border_r(1).border_color(colour(t, "border", "#2C2F37")).when(selected, (el) => el.bg(colour(t, "selected", "#262A33")).font_bold().border_b(2).border_color(colour(t, "accent", "#6F9CE8"))).hover((s) => s.bg(colour(t, "hover", "#23262D"))).on_click((_e, cx) => onClick(cx)).children(children);
1140
+ }
1141
+ dot(tone, p) {
1142
+ return div().text_color(p.text[tone]).child("●");
1143
+ }
1144
+ runStrip(cx, ctl, tabs, t, p) {
1145
+ const strip = h_flex().id("claudish-runs").w_full().overflow_hidden().border_b(1).border_color(colour(t, "border", "#2C2F37")).bg(colour(t, "surface", "#17191D"));
1146
+ for (const r of tabs.tabs)
1147
+ strip.child(this.tab(`run-${r.key}`, r.selected, t, (cx) => this.act(cx, (c) => c.selectRun(r.key)), [
1148
+ this.dot(r.tone, p),
1149
+ div().truncate().max_w(160).child(r.name),
1150
+ div().text_color(colour(t, "dim", "#7D8390")).text_size(12).child(r.age)
1151
+ ]));
1152
+ strip.child(div().flex_1());
1153
+ if (tabs.earlier.length > 0)
1154
+ strip.child(this.tab("runs-earlier", ctl.earlierOpen, t, (cx) => this.act(cx, (c) => c.toggleEarlier()), [div().child(`+${tabs.earlier.length} earlier`)]));
1155
+ return strip;
1156
+ }
1157
+ earlierList(cx, earlier, t, p) {
1158
+ return v_flex().id("claudish-earlier").max_h(220).overflow_y_scrollbar().border_b(1).border_color(colour(t, "border", "#2C2F37")).children(earlier.map((r) => h_flex().id(`earlier-${r.key}`).px(14).py(5).gap(8).items_center().cursor_pointer().hover((s) => s.bg(colour(t, "hover", "#23262D"))).on_click((_e, cx) => this.act(cx, (c) => c.selectRun(r.key))).child(this.dot(r.tone, p)).child(div().flex_1().truncate().child(r.name)).child(div().text_color(colour(t, "dim", "#7D8390")).text_size(12).child(r.age))));
1159
+ }
1160
+ runHeader(current, t, p) {
1161
+ const muted = colour(t, "dim", "#7D8390");
1162
+ return h_flex().px(14).pt(10).pb(4).gap(10).items_center().child(div().flex_none().font_bold().text_color(p.mark).child("◆ claudish")).child(div().flex_none().font_bold().child(current.name)).child(div().flex_none().text_color(muted).child(current.counts)).when(current.meta !== null, (el) => el.child(div().truncate().text_color(muted).child(current.meta ?? "")));
1163
+ }
1164
+ rowList(cx, current, selected, t, p) {
1165
+ return v_flex().id("claudish-rows").px(14).pt(4).pb(10).gap(4).max_h(240).overflow_y_scrollbar().children(current.rows.map((r) => this.bandRow(r, r.target === selected?.target, t, p)));
1166
+ }
1167
+ bandRow(r, selected, t, p) {
1168
+ const [tokensIn, tokensOut] = r.tokens.includes(" ↓") ? [r.tokens.slice(0, r.tokens.indexOf(" ↓")), r.tokens.slice(r.tokens.indexOf(" ↓") + 1)] : [r.tokens, null];
1169
+ return h_flex().id(`row-${r.target}`).px(4).py(3).gap(6).items_center().rounded(4).overflow_hidden().cursor_pointer().when(selected, (el) => el.bg(colour(t, "selected", "#262A33")).border_1().border_color(colour(t, "border", "#3A4150"))).hover((s) => s.bg(colour(t, "hover", "#23262D"))).on_click((_e, cx) => this.act(cx, (c) => c.selectSlot(r.target))).child(div().w(22).flex_none().text_color(colour(t, "dim", "#8A909B")).child(r.slot)).child(chip(r.code, p.solid[r.tone], { bold: true, minW: 40 })).child(div().w(44).flex_none().text_right().text_color(p.text[r.tone]).child(r.elapsed)).child(h_flex().flex_none().child(chip(r.model, p.solid.model, { bold: true })).child(chip(r.provider, p.quiet.model))).child(h_flex().flex_none().child(chip(tokensIn, p.tokensIn)).when(tokensOut !== null, (el) => el.child(chip(tokensOut ?? "", p.tokensOut))).child(chip(r.tools, p.quiet.tools, { bold: true })).child(chip(r.turns, p.quiet.loops, { bold: true })).child(chip(r.billing, p.quiet.cost, { bold: true }))).when(r.agent !== null, (el) => el.child(div().flex_none().px(6).border_1().border_color(colour(t, "border", "#3A4150")).text_color(colour(t, "muted", "#9AA0AB")).child(r.agent ?? ""))).child(div().flex_1().min_w(0).truncate().text_color(r.error ? p.text.fail : colour(t, "muted", "#9AA0AB")).child(r.note));
1170
+ }
1171
+ sessionStrip(cx, ctl, current, row, t, p) {
1172
+ const strip = h_flex().id("claudish-sessions").w_full().items_center().overflow_hidden().border_t(1).border_b(1).border_color(colour(t, "border", "#2C2F37")).bg(colour(t, "surface", "#17191D"));
1173
+ for (const s of sessionTabs(current, row?.target ?? null))
1174
+ strip.child(this.tab(`session-${s.target}`, s.selected, t, (cx) => this.act(cx, (c) => c.selectSlot(s.target)), [this.dot(s.tone, p), div().whitespace_nowrap().child(s.label)]));
1175
+ strip.child(div().flex_1());
1176
+ const toggle = h_flex().mx(10).flex_none().rounded(6).overflow_hidden().border_1().border_color(colour(t, "border", "#343842"));
1177
+ for (const mode of ["screen", "text"])
1178
+ toggle.child(div().id(`mode-${mode}`).px(12).py(4).cursor_pointer().when(ctl.mode === mode, (el) => el.bg(colour(t, "selected", "#262A33")).font_bold()).hover((s) => s.bg(colour(t, "hover", "#23262D"))).on_click((_e, cx) => this.act(cx, (c) => c.setMode(mode))).child(mode === "screen" ? "Screen" : "Text"));
1179
+ return strip.child(toggle);
1180
+ }
1181
+ screenArea(cx, ctl, row, t) {
1182
+ const area = v_flex().id("claudish-screen").flex_1().min_h(160).px(16).py(14).bg(colour(t, "background", "#101114")).text_color(colour(t, "foreground", "#CFD2D8")).font_family("JetBrains Mono").text_size(12).overflow_y_scrollbar();
1183
+ const lines = (text) => text.map((l, i) => div().id(`line-${i}`).whitespace_nowrap().child(l === "" ? " " : l));
1184
+ if (!row)
1185
+ return area.child(div().text_color(colour(t, "muted", "#9AA0AB")).child("no runs yet"));
1186
+ if (ctl.mode === "text")
1187
+ return area.children(lines(ctl.transcriptLines()));
1188
+ if (row.noScreen)
1189
+ return area.children(lines(failureCard(row, home())));
1190
+ if (row.recordOnly)
1191
+ return area.children(lines(recordCard(row, home())));
1192
+ const open = ctl.view?.target === row.target;
1193
+ const say = open ? row.finished ? "The replay of this session is open in the claudish window." : "The live screen of this session is open in the claudish window." : "This session's screen is not open.";
1194
+ return area.child(div().child(say)).child(div().child(" ")).child(div().id("open-screen").flex_none().px(12).py(5).rounded(6).border_1().border_color(colour(t, "accent", "#6F9CE8")).text_color(colour(t, "accent", "#6F9CE8")).cursor_pointer().on_click((_e, cx) => this.act(cx, (c) => c.selectSlot(row.target))).child(open ? "Bring the window back" : row.finished ? "Open the replay" : "Open the live screen"));
1195
+ }
1196
+ renderTitlebar() {
1197
+ const t = theme();
1198
+ const p = props() ?? {};
1199
+ const terminal = typeof p.terminal === "string" ? p.terminal : null;
1200
+ const overlay = typeof p.overlay === "string" ? p.overlay : null;
1201
+ return h_flex().size_full().px(10).gap(8).items_center().bg(t.surface).border_b(1).border_color(t.border).text_size(12).child(div().flex_1().truncate().text_color(t.foreground).child(`claudish · ${String(p.title ?? "")}`)).child(div().text_color(t.dim).child("read only · Enter takes the view")).child(div().id("claudish-close").px(6).cursor_pointer().text_color(t.muted).hover((s) => s.text_color(t.foreground)).on_click(() => {
1202
+ if (terminal)
1203
+ run("terminal.kill", { terminal });
1204
+ else if (overlay)
1205
+ closeOverlay(overlay);
1206
+ }).child("✕"));
1207
+ }
1208
+ renderToggle() {
1209
+ const t = theme();
1210
+ return div().id("claudish-toggle").px(8).cursor_pointer().text_color(t.muted).hover((s) => s.text_color(t.foreground)).on_click(() => {
1211
+ const id = panelNodeId(layout());
1212
+ if (id)
1213
+ run("layout.toggle", { id });
1214
+ }).child("claudish");
1215
+ }
1216
+ }
1217
+ export {
1218
+ ClaudishPanel as default
1219
+ };
@@ -0,0 +1 @@
1
+ { "place": "right", "size": 320, "title": "claudish" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudish",
3
- "version": "14.20.1",
3
+ "version": "14.20.2",
4
4
  "description": "Run Claude Code with any model - OpenRouter, Ollama, LM Studio & local models",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,6 +54,7 @@
54
54
  "files": [
55
55
  "dist/",
56
56
  "bin/",
57
+ "herdr-app-mod/",
57
58
  "AI_AGENT_GUIDE.md",
58
59
  "skills/"
59
60
  ],
@@ -73,10 +74,10 @@
73
74
  "ai"
74
75
  ],
75
76
  "optionalDependencies": {
76
- "@claudish/magmux-darwin-arm64": "14.20.1",
77
- "@claudish/magmux-darwin-x64": "14.20.1",
78
- "@claudish/magmux-linux-arm64": "14.20.1",
79
- "@claudish/magmux-linux-x64": "14.20.1"
77
+ "@claudish/magmux-darwin-arm64": "14.20.2",
78
+ "@claudish/magmux-darwin-x64": "14.20.2",
79
+ "@claudish/magmux-linux-arm64": "14.20.2",
80
+ "@claudish/magmux-linux-x64": "14.20.2"
80
81
  },
81
82
  "author": "Jack Rudenko <i@madappgang.com>",
82
83
  "license": "MIT",