pantheon-opencode 1.1.1-beta.1 → 1.1.1-beta.11

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.
@@ -1,143 +1,609 @@
1
- // src/index.tsx
2
- import { createMemo, createSignal, Show, For } from "solid-js";
3
- import { jsx, jsxs } from "@opentui/solid/jsx-runtime";
4
- async function readVersion(api) {
5
- try {
6
- const wt = api.state.path?.worktree ?? "";
7
- const fp = wt ? `${wt}/package.json` : "package.json";
8
- const r = await api.client.file.read({ query: { path: fp } });
9
- const m = String(r?.content ?? "").match(/"version":\s*"([^"]+)"/);
10
- if (m?.[1]) return m[1];
11
- } catch {
12
- }
13
- return "5.0.0";
14
- }
15
- var AGENTS = [
16
- "zeus",
17
- "athena",
18
- "apollo",
19
- "hermes",
20
- "aphrodite",
21
- "demeter",
22
- "themis",
23
- "prometheus",
24
- "hephaestus",
25
- "nyx",
26
- "gaia",
27
- "iris",
28
- "mnemosyne",
29
- "talos"
1
+ import { createComponent, createElement, createTextNode, effect, insert, insertNode, memo, setProp } from "@opentui/solid";
2
+ import { For, Show, createMemo, createResource, createSignal, onCleanup, onMount } from "solid-js";
3
+ //#region src/index.tsx
4
+ /** @jsxImportSource @opentui/solid */
5
+ const BAR_WIDTH = 20;
6
+ const COMMANDS = [
7
+ {
8
+ name: "/pantheon",
9
+ desc: "Council synthesis"
10
+ },
11
+ {
12
+ name: "/pantheon-status",
13
+ desc: "System status"
14
+ },
15
+ {
16
+ name: "/pantheon-audit",
17
+ desc: "Full audit"
18
+ },
19
+ {
20
+ name: "/pantheon-bg",
21
+ desc: "List background tasks"
22
+ },
23
+ {
24
+ name: "/pantheon-cancel",
25
+ desc: "Cancel task"
26
+ },
27
+ {
28
+ name: "/pantheon-deepwork",
29
+ desc: "Deep work mode"
30
+ },
31
+ {
32
+ name: "/pantheon-focus",
33
+ desc: "Focus on scope"
34
+ },
35
+ {
36
+ name: "/pantheon-remember",
37
+ desc: "Memory store/recall"
38
+ },
39
+ {
40
+ name: "/pantheon-search",
41
+ desc: "Memory search"
42
+ },
43
+ {
44
+ name: "/pantheon-consolidate",
45
+ desc: "Merge memories"
46
+ },
47
+ {
48
+ name: "/pantheon-forget",
49
+ desc: "Compress memories"
50
+ }
30
51
  ];
31
- var CMDS = [
32
- "/pantheon",
33
- "/pantheon-status",
34
- "/pantheon-audit",
35
- "/pantheon-bg",
36
- "/pantheon-deepwork",
37
- "/pantheon-focus",
38
- "/pantheon-remember",
39
- "/pantheon-search",
40
- "/pantheon-forget"
52
+ const AGENTS = [
53
+ {
54
+ name: "zeus",
55
+ tier: "default",
56
+ role: "Orchestrator"
57
+ },
58
+ {
59
+ name: "athena",
60
+ tier: "premium",
61
+ role: "Strategic planner"
62
+ },
63
+ {
64
+ name: "apollo",
65
+ tier: "fast",
66
+ role: "Codebase discovery"
67
+ },
68
+ {
69
+ name: "hermes",
70
+ tier: "default",
71
+ role: "Backend"
72
+ },
73
+ {
74
+ name: "aphrodite",
75
+ tier: "default",
76
+ role: "Frontend"
77
+ },
78
+ {
79
+ name: "demeter",
80
+ tier: "default",
81
+ role: "Database"
82
+ },
83
+ {
84
+ name: "themis",
85
+ tier: "premium",
86
+ role: "Quality & security"
87
+ },
88
+ {
89
+ name: "prometheus",
90
+ tier: "default",
91
+ role: "Infrastructure"
92
+ },
93
+ {
94
+ name: "hephaestus",
95
+ tier: "default",
96
+ role: "AI pipelines"
97
+ },
98
+ {
99
+ name: "nyx",
100
+ tier: "fast",
101
+ role: "Observability"
102
+ },
103
+ {
104
+ name: "gaia",
105
+ tier: "fast",
106
+ role: "Remote sensing"
107
+ },
108
+ {
109
+ name: "iris",
110
+ tier: "fast",
111
+ role: "GitHub operations"
112
+ },
113
+ {
114
+ name: "mnemosyne",
115
+ tier: "fast",
116
+ role: "Memory bank"
117
+ },
118
+ {
119
+ name: "talos",
120
+ tier: "fast",
121
+ role: "Hotfixes"
122
+ }
41
123
  ];
42
- function PantheonPanel(props) {
43
- const [showSub, setShowSub] = createSignal(false);
44
- const [showCmd, setShowCmd] = createSignal(false);
45
- const [showAg, setShowAg] = createSignal(false);
46
- const [showCfg, setShowCfg] = createSignal(false);
47
- const [showMem, setShowMem] = createSignal(false);
48
- const branch = createMemo(() => {
49
- const b = props.api.state.vcs?.branch;
50
- return b ? `\u2387 ${b}` : null;
51
- });
52
- return /* @__PURE__ */ jsxs("box", { flexDirection: "column", width: "100%", children: [
53
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.accent, attributes: { bold: true }, children: [
54
- "Pantheon v",
55
- props.version
56
- ] }),
57
- /* @__PURE__ */ jsx(Show, { when: branch(), children: (b) => /* @__PURE__ */ jsx("box", { marginTop: 1, children: /* @__PURE__ */ jsx("text", { fg: props.api.theme.current.textMuted, children: b() }) }) }),
58
- /* @__PURE__ */ jsxs("box", { marginTop: 0, onMouseDown: () => setShowSub((x) => !x), children: [
59
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.text, attributes: { bold: true }, children: [
60
- showSub() ? "\u25BC " : "\u25B6 ",
61
- "Subagents"
62
- ] }),
63
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
64
- " (",
65
- props.api.state.session.count(),
66
- ")"
67
- ] })
68
- ] }),
69
- /* @__PURE__ */ jsx(Show, { when: showSub(), children: /* @__PURE__ */ jsx("box", { marginLeft: 1, children: /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
70
- "sessions: ",
71
- props.api.state.session.count()
72
- ] }) }) }),
73
- /* @__PURE__ */ jsxs("box", { marginTop: 0, onMouseDown: () => setShowCmd((x) => !x), children: [
74
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.text, attributes: { bold: true }, children: [
75
- showCmd() ? "\u25BC " : "\u25B6 ",
76
- "Commands"
77
- ] }),
78
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
79
- " (",
80
- CMDS.length,
81
- ")"
82
- ] })
83
- ] }),
84
- /* @__PURE__ */ jsx(Show, { when: showCmd(), children: /* @__PURE__ */ jsx("box", { marginLeft: 1, flexDirection: "column", children: /* @__PURE__ */ jsx(For, { each: CMDS, children: (cmd) => /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
85
- "\xB7",
86
- " ",
87
- cmd
88
- ] }) }) }) }),
89
- /* @__PURE__ */ jsxs("box", { marginTop: 0, onMouseDown: () => setShowAg((x) => !x), children: [
90
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.text, attributes: { bold: true }, children: [
91
- showAg() ? "\u25BC " : "\u25B6 ",
92
- "Agents"
93
- ] }),
94
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
95
- " (",
96
- AGENTS.length,
97
- ")"
98
- ] })
99
- ] }),
100
- /* @__PURE__ */ jsx(Show, { when: showAg(), children: /* @__PURE__ */ jsx("box", { marginLeft: 1, flexDirection: "column", children: /* @__PURE__ */ jsx(For, { each: AGENTS, children: (a) => /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
101
- "\xB7",
102
- " ",
103
- a
104
- ] }) }) }) }),
105
- /* @__PURE__ */ jsx("box", { marginTop: 0, onMouseDown: () => setShowCfg((x) => !x), children: /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.text, attributes: { bold: true }, children: [
106
- showCfg() ? "\u25BC " : "\u25B6 ",
107
- "Config"
108
- ] }) }),
109
- /* @__PURE__ */ jsx(Show, { when: showCfg(), children: /* @__PURE__ */ jsxs("box", { marginLeft: 1, flexDirection: "column", children: [
110
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
111
- "MCPs: ",
112
- props.api.state.config?.mcp ? Object.keys(props.api.state.config.mcp).length : 0
113
- ] }),
114
- /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.textMuted, children: [
115
- "Compaction: ",
116
- props.api.state.config?.compaction?.auto ? "ON" : "OFF"
117
- ] })
118
- ] }) }),
119
- /* @__PURE__ */ jsx("box", { marginTop: 0, onMouseDown: () => setShowMem((x) => !x), children: /* @__PURE__ */ jsxs("text", { fg: props.api.theme.current.text, attributes: { bold: true }, children: [
120
- showMem() ? "\u25BC " : "\u25B6 ",
121
- "Memory"
122
- ] }) }),
123
- /* @__PURE__ */ jsx(Show, { when: showMem(), children: /* @__PURE__ */ jsx("box", { marginLeft: 1, children: /* @__PURE__ */ jsx("text", { fg: props.api.theme.current.textMuted, children: props.api.state.memory?.entries > 0 ? `Entries: ${props.api.state.memory.entries}` : "(no data)" }) }) })
124
- ] });
124
+ function safeNum(v) {
125
+ return typeof v === "number" && Number.isFinite(v) ? v : 0;
126
+ }
127
+ function fmtInt(n) {
128
+ return Intl.NumberFormat("en-US").format(Math.max(0, Math.round(n)));
129
+ }
130
+ function fmtCost(v) {
131
+ if (v <= 0) return "";
132
+ if (v < .01) return "<$0.01";
133
+ return `$${v.toFixed(2)}`;
134
+ }
135
+ function msgTokens(msg) {
136
+ const t = msg?.tokens ?? msg?.info?.tokens ?? {};
137
+ return safeNum(t.input) + safeNum(t.output) + safeNum(t.reasoning) + safeNum(t?.cache?.read) + safeNum(t?.cache?.write);
138
+ }
139
+ function msgCost(src) {
140
+ for (const c of [
141
+ src?.cost,
142
+ src?.info?.cost,
143
+ src?.usage?.cost
144
+ ]) if (typeof c === "number" && c > 0) return c;
145
+ return 0;
146
+ }
147
+ function buildBar(pct) {
148
+ const filled = Math.max(0, Math.min(BAR_WIDTH, Math.round(Math.max(0, Math.min(100, pct)) / 100 * BAR_WIDTH)));
149
+ return "█".repeat(filled) + "░".repeat(BAR_WIDTH - filled);
150
+ }
151
+ async function detectVersion(api) {
152
+ try {
153
+ const wt = api.state.path?.worktree ?? "";
154
+ const fp = wt ? `${wt}/package.json` : "package.json";
155
+ const result = await api.client.file.read({ query: { path: fp } });
156
+ const match = String(result?.content ?? "").match(/"version":\s*"([^"]+)"/);
157
+ if (match?.[1]) return match[1];
158
+ } catch {}
159
+ try {
160
+ const proc = api.client?.process;
161
+ if (typeof proc?.exec === "function") {
162
+ const r = await proc.exec({
163
+ command: "git",
164
+ args: [
165
+ "describe",
166
+ "--tags",
167
+ "--always"
168
+ ],
169
+ timeoutMs: 3e3
170
+ });
171
+ const tag = (r.stdout ?? r.output ?? "").trim().replace(/^v/, "").replace(/-\d+-g[0-9a-f]+$/, "");
172
+ if (tag && tag !== "5.0.0") return tag;
173
+ }
174
+ } catch {}
175
+ try {
176
+ const proc = api.client?.process;
177
+ if (typeof proc?.exec === "function") {
178
+ const r = await proc.exec({
179
+ command: "opencode",
180
+ args: ["--version"],
181
+ timeoutMs: 3e3
182
+ });
183
+ const ver = (r.stdout ?? r.output ?? "").trim().replace(/^v/, "");
184
+ if (ver) return ver;
185
+ }
186
+ } catch {}
187
+ return null;
188
+ }
189
+ function ContextBar(props) {
190
+ const messages = createMemo(() => {
191
+ try {
192
+ return props.api.state.session.messages(props.sessionID) ?? [];
193
+ } catch {
194
+ return [];
195
+ }
196
+ });
197
+ const usage = createMemo(() => {
198
+ const lastAssistant = [...messages()].reverse().find((m) => {
199
+ return (m?.role ?? m?.info?.role) === "assistant" && safeNum(m?.tokens?.output) > 0;
200
+ });
201
+ if (!lastAssistant) return null;
202
+ const tokens = msgTokens(lastAssistant);
203
+ const pid = lastAssistant?.providerID ?? lastAssistant?.info?.providerID;
204
+ const mid = lastAssistant?.modelID ?? lastAssistant?.info?.modelID;
205
+ const ctxLimit = safeNum((pid ? (props.api.state.provider ?? []).find((p) => p.id === pid) : null)?.models?.[mid ?? ""]?.limit?.context);
206
+ return {
207
+ tokens,
208
+ limit: ctxLimit > 0 ? ctxLimit : 2e5,
209
+ percent: ctxLimit > 0 ? Math.round(tokens / ctxLimit * 100) : 0
210
+ };
211
+ });
212
+ const totalCost = createMemo(() => {
213
+ const state = props.api.state.session?.get?.(props.sessionID);
214
+ const fromState = msgCost(state);
215
+ if (fromState > 0) return fromState;
216
+ return messages().reduce((sum, m) => sum + msgCost(m), 0);
217
+ });
218
+ const theme = () => props.api.theme.current;
219
+ return createComponent(Show, {
220
+ get when() {
221
+ return usage();
222
+ },
223
+ children: (u) => {
224
+ const pct = u().percent;
225
+ const c = theme();
226
+ const barColor = pct >= 90 ? c.error : pct >= 70 ? c.warning : c.accent;
227
+ const costStr = fmtCost(totalCost());
228
+ return (() => {
229
+ var _el$ = createElement("box"), _el$2 = createElement("box"), _el$3 = createElement("text"), _el$5 = createElement("text"), _el$6 = createElement("text"), _el$7 = createElement("text");
230
+ insertNode(_el$, _el$2);
231
+ insertNode(_el$, _el$7);
232
+ setProp(_el$, "flexDirection", "column");
233
+ insertNode(_el$2, _el$3);
234
+ insertNode(_el$2, _el$5);
235
+ insertNode(_el$2, _el$6);
236
+ setProp(_el$2, "flexDirection", "row");
237
+ setProp(_el$2, "gap", 1);
238
+ insertNode(_el$3, createTextNode(`Context`));
239
+ setProp(_el$3, "attributes", { bold: true });
240
+ setProp(_el$5, "fg", barColor);
241
+ insert(_el$5, () => buildBar(pct));
242
+ setProp(_el$6, "fg", barColor);
243
+ insert(_el$6, `${pct}%`);
244
+ insert(_el$7, () => `${fmtInt(u().tokens)} / ${fmtInt(u().limit)} tok${costStr ? ` ${costStr}` : ""}`);
245
+ effect((_p$) => {
246
+ var _v$ = c.text, _v$2 = c.textMuted;
247
+ _v$ !== _p$.e && (_p$.e = setProp(_el$3, "fg", _v$, _p$.e));
248
+ _v$2 !== _p$.t && (_p$.t = setProp(_el$7, "fg", _v$2, _p$.t));
249
+ return _p$;
250
+ }, {
251
+ e: void 0,
252
+ t: void 0
253
+ });
254
+ return _el$;
255
+ })();
256
+ }
257
+ });
258
+ }
259
+ function SessionRow(props) {
260
+ const theme = () => props.api.theme.current;
261
+ const status = createMemo(() => {
262
+ try {
263
+ const s = props.api.state.session?.status?.(props.session.id);
264
+ if (s?.type) return s.type;
265
+ } catch {}
266
+ return null;
267
+ });
268
+ const statusIcon = createMemo(() => {
269
+ switch (status()) {
270
+ case "busy": return "● ";
271
+ case "retry": return "⚠ ";
272
+ default: return "";
273
+ }
274
+ });
275
+ return (() => {
276
+ var _el$8 = createElement("text");
277
+ insert(_el$8, () => `${statusIcon()}${props.session?.id?.slice(0, 8) ?? "????"}... ${props.session?.title?.slice(0, 26) ?? "(untitled)"}`);
278
+ effect((_$p) => setProp(_el$8, "fg", theme().textMuted, _$p));
279
+ return _el$8;
280
+ })();
125
281
  }
126
- function createSlot(api) {
127
- const version = createMemo(() => readVersion(api));
128
- return {
129
- order: 900,
130
- slots: {
131
- sidebar_content(_ctx, input) {
132
- return /* @__PURE__ */ jsx(PantheonPanel, { api, version: version() });
133
- }
134
- }
135
- };
282
+ function View(props) {
283
+ const [showCommands, setShowCommands] = createSignal(false);
284
+ const [showAgents, setShowAgents] = createSignal(false);
285
+ const [showConfig, setShowConfig] = createSignal(false);
286
+ const [showSessions, setShowSessions] = createSignal(false);
287
+ const theme = () => props.api.theme.current;
288
+ const branch = createMemo(() => props.api.state.vcs?.branch ? `\u2387 ${props.api.state.vcs.branch}` : null);
289
+ const [sessionList, { refetch: refetchSessions }] = createResource(async () => {
290
+ try {
291
+ return await props.api.client?.session?.list?.({ limit: 100 }) ?? { data: [] };
292
+ } catch {
293
+ return { data: [] };
294
+ }
295
+ });
296
+ const totalSessions = createMemo(() => {
297
+ const result = sessionList();
298
+ if (!result) return 0;
299
+ const data = result.data ?? result;
300
+ if (!Array.isArray(data)) return 0;
301
+ return data.filter((s) => !s.parentID).length;
302
+ });
303
+ const recentSessions = createMemo(() => {
304
+ const result = sessionList();
305
+ if (!result) return [];
306
+ const data = result.data ?? result;
307
+ if (!Array.isArray(data)) return [];
308
+ return data.filter((s) => !s.parentID && s.id !== props.sessionID).sort((a, b) => {
309
+ const ta = a.time?.updated ?? a.updated ?? 0;
310
+ return (b.time?.updated ?? b.updated ?? 0) - ta;
311
+ }).slice(0, 8);
312
+ });
313
+ const [memoryCount, setMemoryCount] = createSignal(null);
314
+ onMount(() => {
315
+ const cleanup = [];
316
+ try {
317
+ cleanup.push(props.api.event.on("session.status", refetchSessions));
318
+ cleanup.push(props.api.event.on("session.created", refetchSessions));
319
+ cleanup.push(props.api.event.on("session.updated", refetchSessions));
320
+ cleanup.push(props.api.event.on("session.deleted", refetchSessions));
321
+ } catch {}
322
+ try {
323
+ const ev = props.api.event;
324
+ if (typeof ev?.on === "function") {
325
+ cleanup.push(ev.on("memory.created", () => setMemoryCount((c) => c !== null ? c + 1 : 1)));
326
+ cleanup.push(ev.on("memory.deleted", () => setMemoryCount((c) => c !== null ? Math.max(0, c - 1) : 0)));
327
+ }
328
+ } catch {}
329
+ onCleanup(() => cleanup.forEach((fn) => fn()));
330
+ });
331
+ const configSummary = createMemo(() => {
332
+ const cfg = props.api.state.config;
333
+ if (!cfg) return null;
334
+ return {
335
+ mcpCount: cfg.mcp ? Object.keys(cfg.mcp).length : 0,
336
+ pluginCount: Array.isArray(cfg.plugin) ? cfg.plugin.length : 0,
337
+ autoCompaction: cfg.compaction?.auto === true
338
+ };
339
+ });
340
+ const HR = () => (() => {
341
+ var _el$9 = createElement("text");
342
+ insertNode(_el$9, createTextNode(`────────────────────────────`));
343
+ effect((_$p) => setProp(_el$9, "fg", theme().textMuted, _$p));
344
+ return _el$9;
345
+ })();
346
+ return (() => {
347
+ var _el$1 = createElement("box"), _el$10 = createElement("text"), _el$11 = createElement("box"), _el$12 = createElement("text"), _el$13 = createElement("text"), _el$15 = createElement("box"), _el$16 = createElement("text"), _el$17 = createElement("text"), _el$19 = createElement("box"), _el$20 = createElement("text"), _el$21 = createElement("text"), _el$23 = createElement("box"), _el$24 = createElement("text"), _el$25 = createElement("box"), _el$26 = createElement("text");
348
+ insertNode(_el$1, _el$10);
349
+ insertNode(_el$1, _el$11);
350
+ insertNode(_el$1, _el$15);
351
+ insertNode(_el$1, _el$19);
352
+ insertNode(_el$1, _el$23);
353
+ insertNode(_el$1, _el$25);
354
+ setProp(_el$1, "flexDirection", "column");
355
+ setProp(_el$1, "width", "100%");
356
+ setProp(_el$10, "attributes", { bold: true });
357
+ insert(_el$10, () => `Pantheon${props.version ? ` v${props.version}` : ""}`);
358
+ insert(_el$1, createComponent(Show, {
359
+ get when() {
360
+ return branch();
361
+ },
362
+ children: (b) => (() => {
363
+ var _el$27 = createElement("text");
364
+ insert(_el$27, b);
365
+ effect((_$p) => setProp(_el$27, "fg", theme().textMuted, _$p));
366
+ return _el$27;
367
+ })()
368
+ }), _el$11);
369
+ insert(_el$1, createComponent(HR, {}), _el$11);
370
+ insert(_el$1, createComponent(ContextBar, {
371
+ get api() {
372
+ return props.api;
373
+ },
374
+ get sessionID() {
375
+ return props.sessionID;
376
+ }
377
+ }), _el$11);
378
+ insert(_el$1, createComponent(HR, {}), _el$11);
379
+ insertNode(_el$11, _el$12);
380
+ insertNode(_el$11, _el$13);
381
+ setProp(_el$11, "onMouseDown", () => setShowSessions((x) => !x));
382
+ setProp(_el$12, "attributes", { bold: true });
383
+ insert(_el$12, () => `${showSessions() ? "▼" : "▶"} Sessions`);
384
+ insert(_el$13, () => ` (${String(totalSessions())})`);
385
+ insert(_el$1, createComponent(Show, {
386
+ get when() {
387
+ return showSessions();
388
+ },
389
+ get children() {
390
+ return createComponent(Show, {
391
+ get when() {
392
+ return recentSessions().length > 0;
393
+ },
394
+ get fallback() {
395
+ return (() => {
396
+ var _el$28 = createElement("box"), _el$29 = createElement("text");
397
+ insertNode(_el$28, _el$29);
398
+ setProp(_el$28, "marginLeft", 1);
399
+ insertNode(_el$29, createTextNode(`No recent sessions`));
400
+ effect((_$p) => setProp(_el$29, "fg", theme().textMuted, _$p));
401
+ return _el$28;
402
+ })();
403
+ },
404
+ get children() {
405
+ var _el$14 = createElement("box");
406
+ setProp(_el$14, "marginLeft", 1);
407
+ setProp(_el$14, "flexDirection", "column");
408
+ insert(_el$14, createComponent(For, {
409
+ get each() {
410
+ return recentSessions();
411
+ },
412
+ children: (ses) => createComponent(SessionRow, {
413
+ get api() {
414
+ return props.api;
415
+ },
416
+ session: ses
417
+ })
418
+ }));
419
+ return _el$14;
420
+ }
421
+ });
422
+ }
423
+ }), _el$15);
424
+ insertNode(_el$15, _el$16);
425
+ insertNode(_el$15, _el$17);
426
+ setProp(_el$15, "onMouseDown", () => setShowCommands((x) => !x));
427
+ setProp(_el$16, "attributes", { bold: true });
428
+ insert(_el$16, () => `${showCommands() ? "▼" : "▶"} Commands`);
429
+ insert(_el$17, () => ` (${String(COMMANDS.length)})`);
430
+ insert(_el$1, createComponent(Show, {
431
+ get when() {
432
+ return showCommands();
433
+ },
434
+ get children() {
435
+ var _el$18 = createElement("box");
436
+ setProp(_el$18, "marginLeft", 1);
437
+ setProp(_el$18, "flexDirection", "column");
438
+ insert(_el$18, createComponent(For, {
439
+ each: COMMANDS,
440
+ children: (cmd) => (() => {
441
+ var _el$31 = createElement("box"), _el$32 = createElement("text"), _el$33 = createElement("text");
442
+ insertNode(_el$31, _el$32);
443
+ insertNode(_el$31, _el$33);
444
+ setProp(_el$31, "onMouseDown", (e) => {
445
+ e.stopPropagation();
446
+ try {
447
+ const cmdApi = props.api.command;
448
+ const cmdName = cmd.name.replace("/", "");
449
+ if (cmdApi?.trigger?.(cmdName)) return;
450
+ } catch {}
451
+ props.api.ui?.toast?.({
452
+ title: "Command",
453
+ message: `Type ${cmd.name} in chat`
454
+ });
455
+ });
456
+ insert(_el$32, () => cmd.name);
457
+ insert(_el$33, () => ` \u2014 ${cmd.desc}`);
458
+ effect((_p$) => {
459
+ var _v$10 = cmd.name === "/pantheon" ? theme().accent : theme().textMuted, _v$11 = theme().textMuted;
460
+ _v$10 !== _p$.e && (_p$.e = setProp(_el$32, "fg", _v$10, _p$.e));
461
+ _v$11 !== _p$.t && (_p$.t = setProp(_el$33, "fg", _v$11, _p$.t));
462
+ return _p$;
463
+ }, {
464
+ e: void 0,
465
+ t: void 0
466
+ });
467
+ return _el$31;
468
+ })()
469
+ }));
470
+ return _el$18;
471
+ }
472
+ }), _el$19);
473
+ insertNode(_el$19, _el$20);
474
+ insertNode(_el$19, _el$21);
475
+ setProp(_el$19, "onMouseDown", () => setShowAgents((x) => !x));
476
+ setProp(_el$20, "attributes", { bold: true });
477
+ insert(_el$20, () => `${showAgents() ? "▼" : "▶"} Agents`);
478
+ insert(_el$21, () => ` (${String(AGENTS.length)})`);
479
+ insert(_el$1, createComponent(Show, {
480
+ get when() {
481
+ return showAgents();
482
+ },
483
+ get children() {
484
+ var _el$22 = createElement("box");
485
+ setProp(_el$22, "marginLeft", 1);
486
+ setProp(_el$22, "flexDirection", "column");
487
+ insert(_el$22, createComponent(For, {
488
+ each: AGENTS,
489
+ children: (agent) => (() => {
490
+ var _el$34 = createElement("box"), _el$35 = createElement("text"), _el$36 = createElement("text");
491
+ insertNode(_el$34, _el$35);
492
+ insertNode(_el$34, _el$36);
493
+ insert(_el$35, () => `${agent.tier === "premium" ? "✦ " : "· "}${agent.name}`);
494
+ insert(_el$36, () => ` \u2014 ${agent.role}`);
495
+ effect((_p$) => {
496
+ var _v$12 = agent.tier === "premium" ? theme().accent : theme().textMuted, _v$13 = theme().textMuted;
497
+ _v$12 !== _p$.e && (_p$.e = setProp(_el$35, "fg", _v$12, _p$.e));
498
+ _v$13 !== _p$.t && (_p$.t = setProp(_el$36, "fg", _v$13, _p$.t));
499
+ return _p$;
500
+ }, {
501
+ e: void 0,
502
+ t: void 0
503
+ });
504
+ return _el$34;
505
+ })()
506
+ }));
507
+ return _el$22;
508
+ }
509
+ }), _el$23);
510
+ insertNode(_el$23, _el$24);
511
+ setProp(_el$23, "onMouseDown", () => setShowConfig((x) => !x));
512
+ setProp(_el$24, "attributes", { bold: true });
513
+ insert(_el$24, () => `${showConfig() ? "▼" : "▶"} Config`);
514
+ insert(_el$1, createComponent(Show, {
515
+ get when() {
516
+ return showConfig();
517
+ },
518
+ get children() {
519
+ return createComponent(Show, {
520
+ get when() {
521
+ return configSummary();
522
+ },
523
+ get fallback() {
524
+ return (() => {
525
+ var _el$37 = createElement("box"), _el$38 = createElement("text");
526
+ insertNode(_el$37, _el$38);
527
+ setProp(_el$37, "marginLeft", 1);
528
+ insertNode(_el$38, createTextNode(`No config data`));
529
+ effect((_$p) => setProp(_el$38, "fg", theme().textMuted, _$p));
530
+ return _el$37;
531
+ })();
532
+ },
533
+ children: (cfg) => (() => {
534
+ var _el$40 = createElement("box"), _el$41 = createElement("text"), _el$42 = createElement("text");
535
+ insertNode(_el$40, _el$41);
536
+ insertNode(_el$40, _el$42);
537
+ setProp(_el$40, "marginLeft", 1);
538
+ setProp(_el$40, "flexDirection", "column");
539
+ insert(_el$41, () => `MCP: ${String(cfg().mcpCount)} Plugins: ${String(cfg().pluginCount)}`);
540
+ insert(_el$42, () => `Auto-compaction: ${cfg().autoCompaction ? "ON" : "OFF"}`);
541
+ effect((_p$) => {
542
+ var _v$14 = theme().textMuted, _v$15 = theme().textMuted;
543
+ _v$14 !== _p$.e && (_p$.e = setProp(_el$41, "fg", _v$14, _p$.e));
544
+ _v$15 !== _p$.t && (_p$.t = setProp(_el$42, "fg", _v$15, _p$.t));
545
+ return _p$;
546
+ }, {
547
+ e: void 0,
548
+ t: void 0
549
+ });
550
+ return _el$40;
551
+ })()
552
+ });
553
+ }
554
+ }), _el$25);
555
+ insertNode(_el$25, _el$26);
556
+ setProp(_el$25, "marginTop", 1);
557
+ insert(_el$26, (() => {
558
+ var _c$ = memo(() => memoryCount() !== null);
559
+ return () => _c$() ? `Memory: ${fmtInt(memoryCount())} entries` : "Memory: N/A";
560
+ })());
561
+ effect((_p$) => {
562
+ var _v$3 = theme().accent, _v$4 = theme().text, _v$5 = theme().textMuted, _v$6 = theme().text, _v$7 = theme().textMuted, _v$8 = theme().text, _v$9 = theme().textMuted, _v$0 = theme().text, _v$1 = theme().textMuted;
563
+ _v$3 !== _p$.e && (_p$.e = setProp(_el$10, "fg", _v$3, _p$.e));
564
+ _v$4 !== _p$.t && (_p$.t = setProp(_el$12, "fg", _v$4, _p$.t));
565
+ _v$5 !== _p$.a && (_p$.a = setProp(_el$13, "fg", _v$5, _p$.a));
566
+ _v$6 !== _p$.o && (_p$.o = setProp(_el$16, "fg", _v$6, _p$.o));
567
+ _v$7 !== _p$.i && (_p$.i = setProp(_el$17, "fg", _v$7, _p$.i));
568
+ _v$8 !== _p$.n && (_p$.n = setProp(_el$20, "fg", _v$8, _p$.n));
569
+ _v$9 !== _p$.s && (_p$.s = setProp(_el$21, "fg", _v$9, _p$.s));
570
+ _v$0 !== _p$.h && (_p$.h = setProp(_el$24, "fg", _v$0, _p$.h));
571
+ _v$1 !== _p$.r && (_p$.r = setProp(_el$26, "fg", _v$1, _p$.r));
572
+ return _p$;
573
+ }, {
574
+ e: void 0,
575
+ t: void 0,
576
+ a: void 0,
577
+ o: void 0,
578
+ i: void 0,
579
+ n: void 0,
580
+ s: void 0,
581
+ h: void 0,
582
+ r: void 0
583
+ });
584
+ return _el$1;
585
+ })();
136
586
  }
137
- var tui = async (api) => {
138
- api.slots.register(createSlot(api));
587
+ const tui = async (api, _options, _meta) => {
588
+ const version = await detectVersion(api);
589
+ api.slots.register({
590
+ order: 900,
591
+ slots: { sidebar_content(_ctx, props) {
592
+ return createComponent(View, {
593
+ api,
594
+ get sessionID() {
595
+ return props.session_id;
596
+ },
597
+ version
598
+ });
599
+ } }
600
+ });
139
601
  };
140
- var index_default = { id: "pantheon.tui", tui };
141
- export {
142
- index_default as default
602
+ const plugin = {
603
+ id: "pantheon.tui",
604
+ tui
143
605
  };
606
+ //#endregion
607
+ export { plugin as default };
608
+
609
+ //# sourceMappingURL=tui.js.map