pi-arsenal 0.1.1 → 0.1.3

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 SeiyunSky
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SeiyunSky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -4,43 +4,56 @@
4
4
  <img src="assets/pi-arsenal-banner.png" alt="Pi Arsenal red signal artwork" width="420">
5
5
  </p>
6
6
 
7
- > **WORKSPACE ARMED.** A polished workspace for [Pi](https://github.com/earendil-works/pi): keep an always-visible task panel while you organize workspaces, deploy skills, inspect sessions, and review MCP tools without leaving the TUI.
7
+ > **LOADOUT READY.** A terminal control deck for [Pi](https://github.com/earendil-works/pi): organize the workspace, inspect sessions, manage skills, review MCP tools, and keep an active task plan on track without leaving the TUI.
8
8
 
9
9
  ```text
10
10
  ╔══════════════════════════════════════════════╗
11
11
  ║ PI ARSENAL ║
12
- ║ TASK PANEL · WORKSPACE · SESSIONS · SKILLS ║
12
+ ║ WORKSPACE · SESSIONS · SKILLS · MCP ║
13
13
  ╚══════════════════════════════════════════════╝
14
14
  ```
15
15
 
16
- ## Task Panel — Keep the Mission in View
17
-
18
- **Task Panel** is Pi Arsenal's always-visible task surface. Keep the active mission, checklist, and current progress visible while working in the editor, browsing Skills, or switching sessions—without opening another modal or losing your place.
19
-
20
16
  ## Modules
21
17
 
22
18
  | Module | What it does |
23
19
  |---|---|
24
- | **Workspace Drawer** | Projects, files, computer browser, usage, Mermaid gallery, Session Library, Skill Library, and MCP Server browser. |
20
+ | **Workspace Drawer** | Projects, files, computer browser, usage, Mermaid gallery, Session Library, optional Translation Studio, Skill Library, and MCP Server browser. |
25
21
  | **Session Library** | Inspect sessions, rename them, add private descriptions, reload in the current window, and delete non-current sessions. |
26
22
  | **Skill Library** | Browse enabled/disabled skills by folder; add private labels; enable/disable skills or folders; organize folders; prepare `/skill:<name>` commands. |
27
23
  | **MCP Server Browser** | Read cached MCP servers and tools without displaying secrets. |
28
- | **Task Panel** | **Always-visible task surface** for keeping the mission, checklist, and current progress in view while you work. |
24
+ | **Task Panel** | Shows the active plan, enforces one-step-at-a-time status progression, and prevents an unfinished plan from being replaced without explicit user approval. |
29
25
  | **Startup Splash** | Red/black terminal startup header. |
30
26
  | **Tokyo Night Terra** | Included Pi theme. |
27
+ | **Translation Studio integration** | Shows `🌐 Translation Studio` when [`pi-translation-studio`](https://www.npmjs.com/package/pi-translation-studio) is installed; Pi Arsenal does not bundle translation logic. |
31
28
 
32
- ## Deploy
29
+ ## Install
33
30
 
34
31
  ```bash
35
32
  pi install npm:pi-arsenal
36
33
  ```
37
34
 
35
+ Pi Arsenal automatically installs [`pi-choices`](https://www.npmjs.com/package/pi-choices) as a runtime dependency. It supplies the explicit confirmation form used when an agent requests cancellation or replacement of an unfinished Task Panel plan; **do not install `pi-choices` separately** when using the npm or Git version of Pi Arsenal.
36
+
38
37
  Then reload Pi:
39
38
 
40
39
  ```text
41
40
  /reload
42
41
  ```
43
42
 
43
+ For the Git source:
44
+
45
+ ```bash
46
+ pi install git:github.com/SeiyunSky/Pi-Arsenal
47
+ ```
48
+
49
+ ## Active-plan protection
50
+
51
+ While a Task Panel plan has unfinished steps:
52
+
53
+ - normal user supplements remain visible to the agent but do not authorize it to replace, reorder, skip, or batch-complete the plan;
54
+ - the agent must complete and verify the current step before marking it complete and starting the next one;
55
+ - to cancel or replace the plan, the agent must first show an explicit `pi-choices` confirmation. Only the user's **Cancel** or **Replace** selection unlocks one plan change.
56
+
44
57
  ## Commands
45
58
 
46
59
  | Command | Action |
@@ -48,7 +61,8 @@ Then reload Pi:
48
61
  | `Alt+W` | Open the Workspace Drawer |
49
62
  | `/workspace` | Open the Workspace Drawer when the terminal does not deliver `Alt+W` |
50
63
  | `/sessions` | Open Session Library directly |
51
- | `/reload` | Apply changed skill discovery after enable/disable operations |
64
+ | `/translate` | Provided by the optional `pi-translation-studio` package |
65
+ | `/reload` | Apply changed extensions or skill discovery after enable/disable operations |
52
66
 
53
67
  ## Skill Loadout
54
68
 
@@ -67,3 +81,10 @@ For enabled skills, select **Use this skill now**. Pi Arsenal prepares the canon
67
81
  Add task details and submit when ready.
68
82
 
69
83
  > Skill enable/disable moves complete skill folders between `~/.agents/skills` and `~/.agents/disabled-skills`. Nothing is deleted. Run `/reload` afterward.
84
+
85
+ ## Update or remove
86
+
87
+ ```bash
88
+ pi update npm:pi-arsenal
89
+ pi remove npm:pi-arsenal
90
+ ```
@@ -1,31 +1,29 @@
1
- import type { ExtensionAPI, ExtensionContext, SessionEntry } from "@earendil-works/pi-coding-agent";
1
+ import type { ExtensionAPI, ExtensionContext, SessionEntry, ToolCallEvent } from "@earendil-works/pi-coding-agent";
2
2
  import { truncateToWidth } from "@earendil-works/pi-tui";
3
3
 
4
4
  const WIDGET_ID = "sol-pi-task-panel";
5
5
  const ONLINE_STATE_ENTRY = "sol-pi-online-context-state-v1";
6
6
  const MAX_VISIBLE_STEPS = 10;
7
+ const PLAN_CHANGE_QUESTION_ID = "task_plan_change";
8
+ const PLAN_CHANGE_CHOICES = new Set(["Cancel the current plan and switch", "Replace the current plan"]);
9
+ const TASK_DISCIPLINE = `
10
+ Active-plan discipline:
11
+ - An unfinished plan is binding. User supplements are context, not permission to create, replace, cancel, reorder, or skip the plan.
12
+ - Work in listed order with exactly one in_progress step. After each individual step and its verification, immediately update_plan: complete only that current step and start only the next step.
13
+ - Do not batch-complete future steps, defer plan status updates, or start supplementary work before the active plan is complete.
14
+ - To change an unfinished plan, first call pi_choices with exactly this radio question: id "task_plan_change", question explaining the current plan is unfinished, options ["Continue the current plan", "Cancel the current plan and switch", "Replace the current plan"]. Only the user's explicit cancellation or replacement choice authorizes one subsequent changed update_plan call.
15
+ `.trim();
7
16
 
8
17
  type PlanStatus = "pending" | "in_progress" | "completed";
9
-
10
- type PlanStep = {
11
- id: string;
12
- goal: string;
13
- status: PlanStatus;
14
- };
18
+ type PlanStep = { id: string; goal: string; status: PlanStatus };
15
19
 
16
20
  function parseSteps(value: unknown): PlanStep[] | undefined {
17
21
  if (!Array.isArray(value) || value.length === 0) return;
18
22
  const steps: PlanStep[] = [];
19
23
  for (const item of value) {
20
- if (typeof item !== "object" || item === null || Array.isArray(item)) return;
24
+ if (!item || typeof item !== "object" || Array.isArray(item)) return;
21
25
  const step = item as Record<string, unknown>;
22
- if (
23
- typeof step.id !== "string" ||
24
- typeof step.goal !== "string" ||
25
- !(["pending", "in_progress", "completed"] as const).includes(step.status as PlanStatus)
26
- ) {
27
- return;
28
- }
26
+ if (typeof step.id !== "string" || typeof step.goal !== "string" || !["pending", "in_progress", "completed"].includes(step.status as string)) return;
29
27
  steps.push({ id: step.id, goal: step.goal, status: step.status as PlanStatus });
30
28
  }
31
29
  return steps;
@@ -35,47 +33,79 @@ function restoreSteps(entries: readonly SessionEntry[]): PlanStep[] {
35
33
  for (let index = entries.length - 1; index >= 0; index--) {
36
34
  const entry = entries[index];
37
35
  if (entry?.type !== "custom" || entry.customType !== ONLINE_STATE_ENTRY) continue;
38
- const data = entry.data as { plan?: unknown } | undefined;
39
- return parseSteps(data?.plan) ?? [];
36
+ return parseSteps((entry.data as { plan?: unknown } | undefined)?.plan) ?? [];
40
37
  }
41
38
  return [];
42
39
  }
43
40
 
41
+ function isActivePlan(steps: PlanStep[]): boolean {
42
+ return steps.some((step) => step.status !== "completed");
43
+ }
44
+
45
+ function validShape(steps: PlanStep[]): boolean {
46
+ const inProgress = steps.filter((step) => step.status === "in_progress").length;
47
+ return isActivePlan(steps) ? inProgress === 1 : inProgress === 0;
48
+ }
49
+
50
+ function transitionError(current: PlanStep[], next: PlanStep[]): string | undefined {
51
+ if (!validShape(next)) return "An active plan must have exactly one in_progress step.";
52
+ if (current.length !== next.length || current.some((step, index) => step.id !== next[index]?.id || step.goal !== next[index]?.goal)) {
53
+ return "The unfinished plan cannot be replaced, reordered, added to, or removed without explicit user approval through pi_choices.";
54
+ }
55
+ const activeIndex = current.findIndex((step) => step.status === "in_progress");
56
+ if (activeIndex < 0) return;
57
+ for (let index = 0; index < current.length; index++) {
58
+ if (index < activeIndex && next[index].status !== "completed") return "Completed steps cannot be reopened.";
59
+ if (index > activeIndex && next[index].status === "completed") return "Complete only the current in_progress step; future steps cannot be batch-completed.";
60
+ }
61
+ const completedCurrent = next[activeIndex].status === "completed";
62
+ if (!completedCurrent && next[activeIndex].status !== "in_progress") return "The current step must remain in_progress until it is completed.";
63
+ if (completedCurrent && activeIndex + 1 < next.length && next[activeIndex + 1].status !== "in_progress") return "After completing the current step, start exactly the next pending step.";
64
+ return;
65
+ }
66
+
67
+ function isPlanChangeQuestion(event: ToolCallEvent): boolean {
68
+ if (event.toolName !== "pi_choices") return false;
69
+ const questions = (event.input as { questions?: unknown }).questions;
70
+ if (!Array.isArray(questions) || questions.length !== 1) return false;
71
+ const question = questions[0] as Record<string, unknown> | undefined;
72
+ return question?.type === "radio"
73
+ && question.id === PLAN_CHANGE_QUESTION_ID
74
+ && Array.isArray(question.options)
75
+ && question.options.length === 3
76
+ && question.options.every((option, index) => option === ["Continue the current plan", "Cancel the current plan and switch", "Replace the current plan"][index]);
77
+ }
78
+
79
+ function approvalFromChoices(event: { toolName: string; content: Array<{ type: string; text?: string }>; isError: boolean }): boolean {
80
+ if (event.toolName !== "pi_choices" || event.isError) return false;
81
+ const text = event.content.filter((item) => item.type === "text").map((item) => item.text ?? "").join("\n");
82
+ try {
83
+ const answer = JSON.parse(text) as Record<string, unknown>;
84
+ return typeof answer[PLAN_CHANGE_QUESTION_ID] === "string" && PLAN_CHANGE_CHOICES.has(answer[PLAN_CHANGE_QUESTION_ID]);
85
+ } catch {
86
+ return false;
87
+ }
88
+ }
89
+
44
90
  export default function taskPanel(pi: ExtensionAPI) {
45
91
  let steps: PlanStep[] = [];
92
+ let planChangeAuthorized = false;
93
+ let planChangeChoiceCallId: string | undefined;
46
94
 
47
95
  function render(ctx: ExtensionContext): void {
48
96
  if (ctx.mode !== "tui") return;
49
- if (steps.length === 0) {
50
- ctx.ui.setWidget(WIDGET_ID, undefined);
51
- return;
52
- }
53
-
97
+ if (steps.length === 0) { ctx.ui.setWidget(WIDGET_ID, undefined); return; }
54
98
  ctx.ui.setWidget(WIDGET_ID, (_tui, theme) => ({
55
99
  invalidate() {},
56
100
  render(width: number): string[] {
57
101
  const completed = steps.filter((step) => step.status === "completed").length;
58
- const lines = [
59
- truncateToWidth(
60
- theme.fg("accent", theme.bold("Tasks")) + theme.fg("dim", ` ${completed}/${steps.length} completed`),
61
- width,
62
- ),
63
- ];
64
-
102
+ const lines = [truncateToWidth(theme.fg("accent", theme.bold("Tasks")) + theme.fg("dim", ` ${completed}/${steps.length} completed`), width)];
65
103
  for (const step of steps.slice(0, MAX_VISIBLE_STEPS)) {
66
- const marker =
67
- step.status === "completed"
68
- ? theme.fg("success", "✓")
69
- : step.status === "in_progress"
70
- ? theme.fg("warning", "●")
71
- : theme.fg("dim", "○");
104
+ const marker = step.status === "completed" ? theme.fg("success", "✓") : step.status === "in_progress" ? theme.fg("warning", "●") : theme.fg("dim", "○");
72
105
  const goal = step.status === "completed" ? theme.fg("muted", step.goal) : theme.fg("text", step.goal);
73
106
  lines.push(truncateToWidth(` ${marker} ${goal}`, width));
74
107
  }
75
-
76
- if (steps.length > MAX_VISIBLE_STEPS) {
77
- lines.push(theme.fg("dim", ` … ${steps.length - MAX_VISIBLE_STEPS} more`));
78
- }
108
+ if (steps.length > MAX_VISIBLE_STEPS) lines.push(theme.fg("dim", ` … ${steps.length - MAX_VISIBLE_STEPS} more`));
79
109
  return lines;
80
110
  },
81
111
  }));
@@ -83,12 +113,34 @@ export default function taskPanel(pi: ExtensionAPI) {
83
113
 
84
114
  function restore(ctx: ExtensionContext): void {
85
115
  steps = restoreSteps(ctx.sessionManager.getBranch());
116
+ planChangeAuthorized = false;
117
+ planChangeChoiceCallId = undefined;
86
118
  render(ctx);
87
119
  }
88
120
 
89
121
  pi.on("session_start", async (_event, ctx) => restore(ctx));
90
122
  pi.on("session_tree", async (_event, ctx) => restore(ctx));
91
-
123
+ pi.on("before_agent_start", async (event) => {
124
+ if (!isActivePlan(steps)) return;
125
+ event.systemPromptOptions.customInstructions = [event.systemPromptOptions.customInstructions, TASK_DISCIPLINE].filter(Boolean).join("\n\n");
126
+ });
127
+ pi.on("tool_result", async (event) => {
128
+ if (event.toolCallId === planChangeChoiceCallId && isActivePlan(steps) && approvalFromChoices(event)) planChangeAuthorized = true;
129
+ if (event.toolCallId === planChangeChoiceCallId) planChangeChoiceCallId = undefined;
130
+ });
131
+ pi.on("tool_call", async (event: ToolCallEvent) => {
132
+ if (isActivePlan(steps) && isPlanChangeQuestion(event)) planChangeChoiceCallId = event.toolCallId;
133
+ if (event.toolName !== "update_plan") return;
134
+ const next = parseSteps((event.input as { steps?: unknown }).steps);
135
+ if (!next) return { block: true, reason: "Task Panel requires a non-empty valid plan." };
136
+ if (!isActivePlan(steps)) {
137
+ if (!validShape(next)) return { block: true, reason: "A new active plan must have exactly one in_progress step." };
138
+ return;
139
+ }
140
+ if (planChangeAuthorized) { planChangeAuthorized = false; return; }
141
+ const reason = transitionError(steps, next);
142
+ if (reason) return { block: true, reason: `Task Panel blocked this plan update: ${reason}` };
143
+ });
92
144
  pi.on("tool_execution_start", async (event, ctx) => {
93
145
  if (event.toolName !== "update_plan") return;
94
146
  const next = parseSteps((event.args as { steps?: unknown } | undefined)?.steps);
@@ -33,7 +33,13 @@ type McpTool = { name: string; description?: string };
33
33
  type McpServer = { name: string; tools: McpTool[]; cachedAt?: number };
34
34
  type ResourceLabels = { displayName?: string; note?: string };
35
35
  type ResourceMetadata = { skills?: Record<string, ResourceLabels>; mcp?: Record<string, ResourceLabels> };
36
- type Result = { type: "close" } | { type: "workspace"; workspace: Workspace } | { type: "view-diagram"; diagram: Diagram } | { type: "sessions" } | { type: "edit-label"; kind: "skills" | "mcp"; key: string; fallback: string; field: "displayName" | "note" } | { type: "use-skill"; canonicalName: string } | { type: "organize-skills" } | { type: "toggle-skill-folder"; enabled: boolean; relative: string };
36
+ type TranslationStudioBridge = { version: 1; open(ctx: ExtensionCommandContext): Promise<void> };
37
+ type Result = { type: "close" } | { type: "workspace"; workspace: Workspace } | { type: "view-diagram"; diagram: Diagram } | { type: "sessions" | "translation" } | { type: "edit-label"; kind: "skills" | "mcp"; key: string; fallback: string; field: "displayName" | "note" } | { type: "use-skill"; canonicalName: string } | { type: "organize-skills" } | { type: "toggle-skill-folder"; enabled: boolean; relative: string };
38
+ const TRANSLATION_BRIDGE_KEY = Symbol.for("pi-translation-studio.bridge.v1");
39
+ const translationBridge = (): TranslationStudioBridge | undefined => {
40
+ const bridge = (globalThis as Record<symbol, unknown>)[TRANSLATION_BRIDGE_KEY] as TranslationStudioBridge | undefined;
41
+ return bridge?.version === 1 ? bridge : undefined;
42
+ };
37
43
 
38
44
  type MermaidViewer = { server: Server; source: string; title: string; url: string };
39
45
  let mermaidViewer: MermaidViewer | undefined;
@@ -256,7 +262,15 @@ class WorkspaceDrawer implements Focusable {
256
262
  private mcpItems: McpServer[] | undefined;
257
263
  private selectedMcp: McpServer | undefined;
258
264
 
259
- constructor(private readonly ctx: ExtensionCommandContext, private readonly workspace: Workspace, private readonly workspaces: Workspace[], private readonly theme: Theme, private readonly done: (result: Result) => void, private readonly tui: { requestRender(): void }) {}
265
+ constructor(private readonly ctx: ExtensionCommandContext, private readonly workspace: Workspace, private readonly workspaces: Workspace[], private readonly theme: Theme, private readonly done: (result: Result) => void, private readonly tui: { requestRender(): void }, private readonly hasTranslationStudio: boolean) {}
266
+
267
+ private homeItems(): Array<{ label: string; view?: View; result?: "sessions" | "translation" }> {
268
+ return [
269
+ { label: "📁 Projects", view: "projects" }, { label: "📄 Files", view: "files" }, { label: "🖥️ Browse computer…", view: "browser" }, { label: "💰 Usage & Cost", view: "usage" }, { label: "🗺️ Diagram Gallery", view: "diagrams" }, { label: "🕘 Session Library", result: "sessions" },
270
+ ...(this.hasTranslationStudio ? [{ label: "🌐 Translation Studio", result: "translation" as const }] : []),
271
+ { label: "✨ Skill Library", view: "skills" }, { label: "🔌 MCP Servers", view: "mcp" },
272
+ ];
273
+ }
260
274
 
261
275
  private open(view: View): void {
262
276
  this.view = view;
@@ -320,14 +334,15 @@ class WorkspaceDrawer implements Focusable {
320
334
  if (matchesKey(data, "s") && this.view === "browser" && this.browserPath) { this.setCurrentDirectory(); return; }
321
335
  if (matchesKey(data, Key.up) || matchesKey(data, "k")) { this.selected = Math.max(0, this.selected - 1); return; }
322
336
  if (matchesKey(data, Key.down) || matchesKey(data, "j")) {
323
- const last = this.view === "projects" ? this.workspaces.length : this.view === "files" ? Math.max(0, (this.files?.length || 1) - 1) : this.view === "browser" ? Math.max(0, this.browserEntries.length - 1) : this.view === "diagrams" ? Math.max(0, (this.diagramItems?.length || 1) - 1) : this.view === "skills" ? 1 : this.view === "skill-list" ? this.skillEntryItems.length + (this.skillDirectory ? 1 : 0) : this.view === "skill-detail" ? (this.selectedSkill?.enabled ? 3 : 2) : this.view === "mcp" ? Math.max(0, (this.mcpItems?.length || 1) - 1) : this.view === "mcp-detail" ? Math.max(0, (this.selectedMcp?.tools.length || 1) - 1) : this.view === "usage" ? 0 : 7;
337
+ const last = this.view === "projects" ? this.workspaces.length : this.view === "files" ? Math.max(0, (this.files?.length || 1) - 1) : this.view === "browser" ? Math.max(0, this.browserEntries.length - 1) : this.view === "diagrams" ? Math.max(0, (this.diagramItems?.length || 1) - 1) : this.view === "skills" ? 1 : this.view === "skill-list" ? this.skillEntryItems.length + (this.skillDirectory ? 1 : 0) : this.view === "skill-detail" ? (this.selectedSkill?.enabled ? 3 : 2) : this.view === "mcp" ? Math.max(0, (this.mcpItems?.length || 1) - 1) : this.view === "mcp-detail" ? Math.max(0, (this.selectedMcp?.tools.length || 1) - 1) : this.view === "usage" ? 0 : this.homeItems().length - 1;
324
338
  this.selected = Math.min(last, this.selected + 1);
325
339
  return;
326
340
  }
327
341
  if (!matchesKey(data, Key.enter) && !matchesKey(data, Key.right)) return;
328
342
  if (this.view === "home") {
329
- if (this.selected === 5) { this.done({ type: "sessions" }); return; }
330
- this.open(["projects", "files", "browser", "usage", "diagrams", "sessions", "skills", "mcp"][this.selected] as View);
343
+ const item = this.homeItems()[this.selected];
344
+ if (item?.result) this.done({ type: item.result });
345
+ else if (item?.view) this.open(item.view);
331
346
  return;
332
347
  }
333
348
  if (this.view === "skills") { this.skillEnabled = this.selected === 0; this.skillDirectory = ""; this.open("skill-list"); return; }
@@ -373,7 +388,7 @@ class WorkspaceDrawer implements Focusable {
373
388
  lines.push(row(` ${th.fg("accent", "◈")} ${th.bold(this.workspace.name)}`));
374
389
  lines.push(row(` ${th.fg("dim", this.workspace.path)}`));
375
390
  lines.push(row(""));
376
- for (const [i, label] of ["📁 Projects", "📄 Files", "🖥️ Browse computer…", "💰 Usage & Cost", "🗺️ Diagram Gallery", "🕘 Session Library", "✨ Skill Library", "🔌 MCP Servers"].entries()) lines.push(row(` ${marker(i)} ${th.fg("text", label)}`));
391
+ for (const [i, item] of this.homeItems().entries()) lines.push(row(` ${marker(i)} ${th.fg("text", item.label)}`));
377
392
  lines.push(row(""));
378
393
  lines.push(row(th.fg("dim", "↑ ↓ select · Enter / → open · Esc / ← close")));
379
394
  } else if (this.view === "projects") {
@@ -460,12 +475,17 @@ export default function workspaceDrawer(pi: ExtensionAPI) {
460
475
  const open = async (ctx: ExtensionCommandContext): Promise<void> => {
461
476
  if (ctx.mode !== "tui") return;
462
477
  const current = active(ctx);
463
- const result = await ctx.ui.custom<Result>((tui, theme, _keybindings, done) => new WorkspaceDrawer(ctx, current, configuredWorkspaces(ctx.cwd), theme, done, tui), {
478
+ const result = await ctx.ui.custom<Result>((tui, theme, _keybindings, done) => new WorkspaceDrawer(ctx, current, configuredWorkspaces(ctx.cwd), theme, done, tui, Boolean(translationBridge())), {
464
479
  overlay: true,
465
480
  overlayOptions: { anchor: "right-center", width: 54, maxHeight: "100%", margin: { top: 1, right: 1, bottom: 1 } },
466
481
  });
467
482
  if (result?.type === "workspace") { workspace = result.workspace; pi.appendEntry(STATE_TYPE, workspace); ctx.ui.notify(`Workspace: ${workspace.name}`, "info"); }
468
483
  else if (result?.type === "sessions") await openSessionLibrary(pi, ctx);
484
+ else if (result?.type === "translation") {
485
+ const bridge = translationBridge();
486
+ if (bridge) await bridge.open(ctx);
487
+ else ctx.ui.notify("Install pi-translation-studio to enable Translation Studio.", "info");
488
+ }
469
489
  else if (result?.type === "organize-skills") { await organizeSkillFolders(ctx); await open(ctx); }
470
490
  else if (result?.type === "use-skill") { ctx.ui.setEditorText(`/skill:${result.canonicalName} `); ctx.ui.notify("Skill command is ready in the editor. Add details, then submit.", "info"); }
471
491
  else if (result?.type === "toggle-skill-folder") {
@@ -1,142 +1,142 @@
1
- import { existsSync, rmSync } from "node:fs";
2
- import { SessionManager, type ExtensionAPI, type ExtensionCommandContext, type SessionInfo } from "@earendil-works/pi-coding-agent";
3
-
4
- export const SESSION_DESCRIPTION_TYPE = "terra-session-description-v1";
5
- export type SessionDescription = { text: string };
6
- export type SessionStats = { user: number; assistant: number; toolCalls: number; toolResults: number; input: number; cacheRead: number; cacheWrite: number; output: number; hasUsage: boolean };
7
-
8
- export function relativeTime(date: Date): string {
9
- const seconds = Math.max(0, Math.floor((Date.now() - date.getTime()) / 1000));
10
- if (seconds < 60) return "just now";
11
- if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
12
- if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
13
- return `${Math.floor(seconds / 86400)}d ago`;
14
- }
15
-
16
- export function sessionTitle(session: SessionInfo): string {
17
- return session.name?.trim() || session.firstMessage.trim().replace(/\s+/g, " ").slice(0, 56) || "Untitled session";
18
- }
19
-
20
- export function formatTokens(value: number): string {
21
- return new Intl.NumberFormat("en-US").format(value);
22
- }
23
-
24
- export async function listSessions(): Promise<SessionInfo[]> {
25
- return (await SessionManager.listAll()).sort((a, b) => b.modified.getTime() - a.modified.getTime());
26
- }
27
-
28
- export function descriptionOf(path: string): string {
29
- try {
30
- const entries = SessionManager.open(path).getEntries();
31
- for (let i = entries.length - 1; i >= 0; i--) {
32
- const entry = entries[i];
33
- if (entry?.type !== "custom" || entry.customType !== SESSION_DESCRIPTION_TYPE) continue;
34
- const data = entry.data as SessionDescription | undefined;
35
- if (typeof data?.text === "string") return data.text;
36
- }
37
- } catch { /* A damaged historical session must not block the library. */ }
38
- return "";
39
- }
40
-
41
- export function statisticsOf(path: string): SessionStats {
42
- const stats: SessionStats = { user: 0, assistant: 0, toolCalls: 0, toolResults: 0, input: 0, cacheRead: 0, cacheWrite: 0, output: 0, hasUsage: false };
43
- try {
44
- for (const entry of SessionManager.open(path).getEntries()) {
45
- if (entry.type !== "message") continue;
46
- const message = entry.message;
47
- if (message.role === "user") stats.user++;
48
- else if (message.role === "toolResult") stats.toolResults++;
49
- else if (message.role === "assistant") {
50
- stats.assistant++;
51
- stats.toolCalls += message.content.filter((part) => part.type === "toolCall").length;
52
- const usage = message.usage;
53
- if (usage) {
54
- stats.hasUsage = true;
55
- stats.input += usage.input || 0;
56
- stats.cacheRead += usage.cacheRead || 0;
57
- stats.cacheWrite += usage.cacheWrite || 0;
58
- stats.output += usage.output || 0;
59
- }
60
- }
61
- }
62
- } catch { /* Zeroes communicate that unreadable historical data has no usable stats. */ }
63
- return stats;
64
- }
65
-
66
- export function setSessionName(pi: ExtensionAPI, ctx: ExtensionCommandContext, path: string, current: boolean, name: string): void {
67
- if (current) pi.setSessionName(name);
68
- else SessionManager.open(path).appendSessionInfo(name);
69
- }
70
-
71
- export function setSessionDescription(pi: ExtensionAPI, ctx: ExtensionCommandContext, path: string, current: boolean, text: string): void {
72
- const data = { text } satisfies SessionDescription;
73
- if (current) pi.appendEntry(SESSION_DESCRIPTION_TYPE, data);
74
- else SessionManager.open(path).appendCustomEntry(SESSION_DESCRIPTION_TYPE, data);
75
- }
76
-
77
- export function deleteSession(path: string, activePath: string | undefined): boolean {
78
- if (path === activePath || !path.endsWith(".jsonl") || !existsSync(path)) return false;
79
- rmSync(path);
80
- return true;
81
- }
82
-
83
- function detailTitle(session: SessionInfo, current: boolean, description: string, stats: SessionStats): string {
84
- const totalMessages = stats.user + stats.assistant + stats.toolResults;
85
- const totalInput = stats.input + stats.cacheRead;
86
- const totalTokens = totalInput + stats.output;
87
- const cacheRate = totalInput ? ` (${((stats.cacheRead / totalInput) * 100).toFixed(1)}%)` : "";
88
- const tokens = stats.hasUsage
89
- ? [`Input: ${formatTokens(totalInput)}`, ` Cached: ${formatTokens(stats.cacheRead)}${cacheRate}`, ` Uncached: ${formatTokens(stats.input)} (${formatTokens(stats.cacheWrite)} written to cache)`, `Output: ${formatTokens(stats.output)}`, `Total: ${formatTokens(totalTokens)}`]
90
- : ["Usage data: —"];
91
- return [current ? "Current session" : "Historical session", `Name: ${sessionTitle(session)}`, `Description: ${description || "—"}`, `Updated: ${relativeTime(session.modified)}`, `Workspace: ${session.cwd || "—"}`, "", "Messages", `Total: ${formatTokens(totalMessages)}`, `User: ${formatTokens(stats.user)}`, `Assistant: ${formatTokens(stats.assistant)}`, `Tools: ${formatTokens(stats.toolCalls)} calls, ${formatTokens(stats.toolResults)} results`, "", "Tokens", ...tokens].join("\n");
92
- }
93
-
94
- export async function openSessionLibrary(pi: ExtensionAPI, ctx: ExtensionCommandContext): Promise<void> {
95
- if (ctx.mode !== "tui") return;
96
- while (true) {
97
- const currentPath = ctx.sessionManager.getSessionFile();
98
- const available = await listSessions();
99
- if (!available.length) { ctx.ui.notify("No persisted Pi sessions found.", "info"); return; }
100
- const options = available.map((session) => `${sessionTitle(session)} — ${relativeTime(session.modified)} · ${session.messageCount} messages${session.path === currentPath ? " ● current" : ""}`);
101
- const choice = await ctx.ui.select("Session Library", [...options, "Cancel"]);
102
- if (!choice || choice === "Cancel") return;
103
- const session = available[options.indexOf(choice)];
104
- if (!session) continue;
105
- if (await manageSession(pi, ctx, session, currentPath) === "switch") return;
106
- }
107
- }
108
-
109
- async function manageSession(pi: ExtensionAPI, ctx: ExtensionCommandContext, initial: SessionInfo, currentPath: string | undefined): Promise<"back" | "switch"> {
110
- let session = initial;
111
- while (true) {
112
- const current = session.path === currentPath;
113
- const description = descriptionOf(session.path);
114
- const stats = statisticsOf(session.path);
115
- const actions = current ? ["Edit name", "Edit description", "Back"] : ["Reload in this window", "Edit name", "Edit description", "Delete session", "Back"];
116
- const selected = await ctx.ui.select(detailTitle(session, current, description, stats), actions);
117
- if (!selected || selected === "Back") return "back";
118
- if (selected === "Edit name") {
119
- const next = await ctx.ui.input("Session name", session.name || sessionTitle(session));
120
- if (next?.trim()) { setSessionName(pi, ctx, session.path, current, next.trim()); ctx.ui.notify("Session name saved.", "info"); session = (await listSessions()).find((item) => item.path === session.path) || session; }
121
- continue;
122
- }
123
- if (selected === "Edit description") {
124
- const next = await ctx.ui.editor("Session description", description);
125
- if (next !== undefined) { setSessionDescription(pi, ctx, session.path, current, next.trim()); ctx.ui.notify("Session description saved.", "info"); }
126
- continue;
127
- }
128
- if (selected === "Reload in this window") {
129
- await ctx.waitForIdle();
130
- const result = await ctx.switchSession(session.path, { withSession: async (replacement) => replacement.ui.notify(`Reloaded: ${sessionTitle(session)}`, "info") });
131
- return result.cancelled ? "back" : "switch";
132
- }
133
- if (selected === "Delete session") {
134
- if (session.path === ctx.sessionManager.getSessionFile()) { ctx.ui.notify("The active session cannot be deleted.", "warning"); continue; }
135
- const approved = await ctx.ui.confirm("Delete session?", `Permanently delete “${sessionTitle(session)}”? This cannot be undone.`);
136
- if (!approved) continue;
137
- if (!deleteSession(session.path, ctx.sessionManager.getSessionFile())) { ctx.ui.notify("The active or unavailable session cannot be deleted.", "warning"); continue; }
138
- ctx.ui.notify("Session deleted.", "info");
139
- return "back";
140
- }
141
- }
142
- }
1
+ import { existsSync, rmSync } from "node:fs";
2
+ import { SessionManager, type ExtensionAPI, type ExtensionCommandContext, type SessionInfo } from "@earendil-works/pi-coding-agent";
3
+
4
+ export const SESSION_DESCRIPTION_TYPE = "terra-session-description-v1";
5
+ export type SessionDescription = { text: string };
6
+ export type SessionStats = { user: number; assistant: number; toolCalls: number; toolResults: number; input: number; cacheRead: number; cacheWrite: number; output: number; hasUsage: boolean };
7
+
8
+ export function relativeTime(date: Date): string {
9
+ const seconds = Math.max(0, Math.floor((Date.now() - date.getTime()) / 1000));
10
+ if (seconds < 60) return "just now";
11
+ if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
12
+ if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
13
+ return `${Math.floor(seconds / 86400)}d ago`;
14
+ }
15
+
16
+ export function sessionTitle(session: SessionInfo): string {
17
+ return session.name?.trim() || session.firstMessage.trim().replace(/\s+/g, " ").slice(0, 56) || "Untitled session";
18
+ }
19
+
20
+ export function formatTokens(value: number): string {
21
+ return new Intl.NumberFormat("en-US").format(value);
22
+ }
23
+
24
+ export async function listSessions(): Promise<SessionInfo[]> {
25
+ return (await SessionManager.listAll()).sort((a, b) => b.modified.getTime() - a.modified.getTime());
26
+ }
27
+
28
+ export function descriptionOf(path: string): string {
29
+ try {
30
+ const entries = SessionManager.open(path).getEntries();
31
+ for (let i = entries.length - 1; i >= 0; i--) {
32
+ const entry = entries[i];
33
+ if (entry?.type !== "custom" || entry.customType !== SESSION_DESCRIPTION_TYPE) continue;
34
+ const data = entry.data as SessionDescription | undefined;
35
+ if (typeof data?.text === "string") return data.text;
36
+ }
37
+ } catch { /* A damaged historical session must not block the library. */ }
38
+ return "";
39
+ }
40
+
41
+ export function statisticsOf(path: string): SessionStats {
42
+ const stats: SessionStats = { user: 0, assistant: 0, toolCalls: 0, toolResults: 0, input: 0, cacheRead: 0, cacheWrite: 0, output: 0, hasUsage: false };
43
+ try {
44
+ for (const entry of SessionManager.open(path).getEntries()) {
45
+ if (entry.type !== "message") continue;
46
+ const message = entry.message;
47
+ if (message.role === "user") stats.user++;
48
+ else if (message.role === "toolResult") stats.toolResults++;
49
+ else if (message.role === "assistant") {
50
+ stats.assistant++;
51
+ stats.toolCalls += message.content.filter((part) => part.type === "toolCall").length;
52
+ const usage = message.usage;
53
+ if (usage) {
54
+ stats.hasUsage = true;
55
+ stats.input += usage.input || 0;
56
+ stats.cacheRead += usage.cacheRead || 0;
57
+ stats.cacheWrite += usage.cacheWrite || 0;
58
+ stats.output += usage.output || 0;
59
+ }
60
+ }
61
+ }
62
+ } catch { /* Zeroes communicate that unreadable historical data has no usable stats. */ }
63
+ return stats;
64
+ }
65
+
66
+ export function setSessionName(pi: ExtensionAPI, ctx: ExtensionCommandContext, path: string, current: boolean, name: string): void {
67
+ if (current) pi.setSessionName(name);
68
+ else SessionManager.open(path).appendSessionInfo(name);
69
+ }
70
+
71
+ export function setSessionDescription(pi: ExtensionAPI, ctx: ExtensionCommandContext, path: string, current: boolean, text: string): void {
72
+ const data = { text } satisfies SessionDescription;
73
+ if (current) pi.appendEntry(SESSION_DESCRIPTION_TYPE, data);
74
+ else SessionManager.open(path).appendCustomEntry(SESSION_DESCRIPTION_TYPE, data);
75
+ }
76
+
77
+ export function deleteSession(path: string, activePath: string | undefined): boolean {
78
+ if (path === activePath || !path.endsWith(".jsonl") || !existsSync(path)) return false;
79
+ rmSync(path);
80
+ return true;
81
+ }
82
+
83
+ function detailTitle(session: SessionInfo, current: boolean, description: string, stats: SessionStats): string {
84
+ const totalMessages = stats.user + stats.assistant + stats.toolResults;
85
+ const totalInput = stats.input + stats.cacheRead;
86
+ const totalTokens = totalInput + stats.output;
87
+ const cacheRate = totalInput ? ` (${((stats.cacheRead / totalInput) * 100).toFixed(1)}%)` : "";
88
+ const tokens = stats.hasUsage
89
+ ? [`Input: ${formatTokens(totalInput)}`, ` Cached: ${formatTokens(stats.cacheRead)}${cacheRate}`, ` Uncached: ${formatTokens(stats.input)} (${formatTokens(stats.cacheWrite)} written to cache)`, `Output: ${formatTokens(stats.output)}`, `Total: ${formatTokens(totalTokens)}`]
90
+ : ["Usage data: —"];
91
+ return [current ? "Current session" : "Historical session", `Name: ${sessionTitle(session)}`, `Description: ${description || "—"}`, `Updated: ${relativeTime(session.modified)}`, `Workspace: ${session.cwd || "—"}`, "", "Messages", `Total: ${formatTokens(totalMessages)}`, `User: ${formatTokens(stats.user)}`, `Assistant: ${formatTokens(stats.assistant)}`, `Tools: ${formatTokens(stats.toolCalls)} calls, ${formatTokens(stats.toolResults)} results`, "", "Tokens", ...tokens].join("\n");
92
+ }
93
+
94
+ export async function openSessionLibrary(pi: ExtensionAPI, ctx: ExtensionCommandContext): Promise<void> {
95
+ if (ctx.mode !== "tui") return;
96
+ while (true) {
97
+ const currentPath = ctx.sessionManager.getSessionFile();
98
+ const available = await listSessions();
99
+ if (!available.length) { ctx.ui.notify("No persisted Pi sessions found.", "info"); return; }
100
+ const options = available.map((session) => `${sessionTitle(session)} — ${relativeTime(session.modified)} · ${session.messageCount} messages${session.path === currentPath ? " ● current" : ""}`);
101
+ const choice = await ctx.ui.select("Session Library", [...options, "Cancel"]);
102
+ if (!choice || choice === "Cancel") return;
103
+ const session = available[options.indexOf(choice)];
104
+ if (!session) continue;
105
+ if (await manageSession(pi, ctx, session, currentPath) === "switch") return;
106
+ }
107
+ }
108
+
109
+ async function manageSession(pi: ExtensionAPI, ctx: ExtensionCommandContext, initial: SessionInfo, currentPath: string | undefined): Promise<"back" | "switch"> {
110
+ let session = initial;
111
+ while (true) {
112
+ const current = session.path === currentPath;
113
+ const description = descriptionOf(session.path);
114
+ const stats = statisticsOf(session.path);
115
+ const actions = current ? ["Edit name", "Edit description", "Back"] : ["Reload in this window", "Edit name", "Edit description", "Delete session", "Back"];
116
+ const selected = await ctx.ui.select(detailTitle(session, current, description, stats), actions);
117
+ if (!selected || selected === "Back") return "back";
118
+ if (selected === "Edit name") {
119
+ const next = await ctx.ui.input("Session name", session.name || sessionTitle(session));
120
+ if (next?.trim()) { setSessionName(pi, ctx, session.path, current, next.trim()); ctx.ui.notify("Session name saved.", "info"); session = (await listSessions()).find((item) => item.path === session.path) || session; }
121
+ continue;
122
+ }
123
+ if (selected === "Edit description") {
124
+ const next = await ctx.ui.editor("Session description", description);
125
+ if (next !== undefined) { setSessionDescription(pi, ctx, session.path, current, next.trim()); ctx.ui.notify("Session description saved.", "info"); }
126
+ continue;
127
+ }
128
+ if (selected === "Reload in this window") {
129
+ await ctx.waitForIdle();
130
+ const result = await ctx.switchSession(session.path, { withSession: async (replacement) => replacement.ui.notify(`Reloaded: ${sessionTitle(session)}`, "info") });
131
+ return result.cancelled ? "back" : "switch";
132
+ }
133
+ if (selected === "Delete session") {
134
+ if (session.path === ctx.sessionManager.getSessionFile()) { ctx.ui.notify("The active session cannot be deleted.", "warning"); continue; }
135
+ const approved = await ctx.ui.confirm("Delete session?", `Permanently delete “${sessionTitle(session)}”? This cannot be undone.`);
136
+ if (!approved) continue;
137
+ if (!deleteSession(session.path, ctx.sessionManager.getSessionFile())) { ctx.ui.notify("The active or unavailable session cannot be deleted.", "warning"); continue; }
138
+ ctx.ui.notify("Session deleted.", "info");
139
+ return "back";
140
+ }
141
+ }
142
+ }
package/package.json CHANGED
@@ -1,32 +1,21 @@
1
1
  {
2
2
  "name": "pi-arsenal",
3
- "version": "0.1.1",
4
- "description": "A polished workspace for Pi: sessions, skills, MCP, tasks, themes, and splash.",
3
+ "version": "0.1.3",
4
+ "description": "A terminal control deck for Pi: workspaces, sessions, skills, MCP, tasks, theme, and splash.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
- "keywords": [
8
- "pi-package",
9
- "pi",
10
- "pi-coding-agent",
11
- "tui",
12
- "workspace",
13
- "skills",
14
- "sessions"
15
- ],
16
- "files": [
17
- "extensions",
18
- "lib",
19
- "themes",
20
- "README.md",
21
- "LICENSE"
22
- ],
7
+ "keywords": ["pi-package", "pi", "pi-coding-agent", "extension", "theme", "tui", "workspace", "sessions"],
8
+ "files": ["extensions", "lib", "themes", "README.md", "LICENSE"],
9
+ "dependencies": {
10
+ "pi-choices": "^0.1.4"
11
+ },
23
12
  "peerDependencies": {
24
13
  "@earendil-works/pi-ai": "*",
25
14
  "@earendil-works/pi-coding-agent": "*",
26
15
  "@earendil-works/pi-tui": "*"
27
16
  },
28
17
  "pi": {
29
- "extensions": ["./extensions"],
18
+ "extensions": ["./extensions", "./node_modules/pi-choices/extensions"],
30
19
  "themes": ["./themes"]
31
20
  },
32
21
  "repository": {
@@ -1,86 +1,86 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
3
- "name": "tokyo-night-terra",
4
- "vars": {
5
- "bg": "#1a1b2e",
6
- "surface": "#24283b",
7
- "surfaceRaised": "#2f354f",
8
- "selection": "#33467c",
9
- "border": "#3b4261",
10
- "muted": "#7a83a6",
11
- "dim": "#565f89",
12
- "text": "#c0caf5",
13
- "terra": "#bb9af7",
14
- "blue": "#7aa2f7",
15
- "cyan": "#7dcfff",
16
- "teal": "#73daca",
17
- "green": "#9ece6a",
18
- "yellow": "#e0af68",
19
- "orange": "#ff9e64",
20
- "red": "#f7768e",
21
- "magenta": "#c099ff"
22
- },
23
- "colors": {
24
- "accent": "terra",
25
- "border": "border",
26
- "borderAccent": "terra",
27
- "borderMuted": "dim",
28
- "success": "green",
29
- "error": "red",
30
- "warning": "yellow",
31
- "muted": "muted",
32
- "dim": "dim",
33
- "text": "text",
34
- "thinkingText": "muted",
35
- "selectedBg": "selection",
36
- "scrollbarTrack": "surface",
37
- "scrollbarThumb": "blue",
38
- "searchMatchBg": "yellow",
39
- "searchMatchText": "bg",
40
- "userMessageBg": "#20243a",
41
- "userMessageText": "text",
42
- "customMessageBg": "#28243d",
43
- "customMessageText": "text",
44
- "customMessageLabel": "terra",
45
- "toolPendingBg": "#20273d",
46
- "toolSuccessBg": "#1f302f",
47
- "toolErrorBg": "#382536",
48
- "toolTitle": "cyan",
49
- "toolOutput": "muted",
50
- "mdHeading": "terra",
51
- "mdLink": "blue",
52
- "mdLinkUrl": "dim",
53
- "mdCode": "teal",
54
- "mdCodeBlock": "text",
55
- "mdCodeBlockBorder": "border",
56
- "mdQuote": "muted",
57
- "mdQuoteBorder": "blue",
58
- "mdHr": "border",
59
- "mdListBullet": "cyan",
60
- "toolDiffAdded": "green",
61
- "toolDiffRemoved": "red",
62
- "toolDiffContext": "muted",
63
- "syntaxComment": "dim",
64
- "syntaxKeyword": "terra",
65
- "syntaxFunction": "blue",
66
- "syntaxVariable": "text",
67
- "syntaxString": "green",
68
- "syntaxNumber": "orange",
69
- "syntaxType": "cyan",
70
- "syntaxOperator": "teal",
71
- "syntaxPunctuation": "muted",
72
- "thinkingOff": "dim",
73
- "thinkingMinimal": "muted",
74
- "thinkingLow": "blue",
75
- "thinkingMedium": "cyan",
76
- "thinkingHigh": "terra",
77
- "thinkingXhigh": "magenta",
78
- "thinkingMax": "red",
79
- "bashMode": "green"
80
- },
81
- "export": {
82
- "pageBg": "#1a1b2e",
83
- "cardBg": "#24283b",
84
- "infoBg": "#2f2a42"
85
- }
86
- }
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
3
+ "name": "tokyo-night-terra",
4
+ "vars": {
5
+ "bg": "#1a1b2e",
6
+ "surface": "#24283b",
7
+ "surfaceRaised": "#2f354f",
8
+ "selection": "#33467c",
9
+ "border": "#3b4261",
10
+ "muted": "#7a83a6",
11
+ "dim": "#565f89",
12
+ "text": "#c0caf5",
13
+ "terra": "#bb9af7",
14
+ "blue": "#7aa2f7",
15
+ "cyan": "#7dcfff",
16
+ "teal": "#73daca",
17
+ "green": "#9ece6a",
18
+ "yellow": "#e0af68",
19
+ "orange": "#ff9e64",
20
+ "red": "#f7768e",
21
+ "magenta": "#c099ff"
22
+ },
23
+ "colors": {
24
+ "accent": "terra",
25
+ "border": "border",
26
+ "borderAccent": "terra",
27
+ "borderMuted": "dim",
28
+ "success": "green",
29
+ "error": "red",
30
+ "warning": "yellow",
31
+ "muted": "muted",
32
+ "dim": "dim",
33
+ "text": "text",
34
+ "thinkingText": "muted",
35
+ "selectedBg": "selection",
36
+ "scrollbarTrack": "surface",
37
+ "scrollbarThumb": "blue",
38
+ "searchMatchBg": "yellow",
39
+ "searchMatchText": "bg",
40
+ "userMessageBg": "#20243a",
41
+ "userMessageText": "text",
42
+ "customMessageBg": "#28243d",
43
+ "customMessageText": "text",
44
+ "customMessageLabel": "terra",
45
+ "toolPendingBg": "#20273d",
46
+ "toolSuccessBg": "#1f302f",
47
+ "toolErrorBg": "#382536",
48
+ "toolTitle": "cyan",
49
+ "toolOutput": "muted",
50
+ "mdHeading": "terra",
51
+ "mdLink": "blue",
52
+ "mdLinkUrl": "dim",
53
+ "mdCode": "teal",
54
+ "mdCodeBlock": "text",
55
+ "mdCodeBlockBorder": "border",
56
+ "mdQuote": "muted",
57
+ "mdQuoteBorder": "blue",
58
+ "mdHr": "border",
59
+ "mdListBullet": "cyan",
60
+ "toolDiffAdded": "green",
61
+ "toolDiffRemoved": "red",
62
+ "toolDiffContext": "muted",
63
+ "syntaxComment": "dim",
64
+ "syntaxKeyword": "terra",
65
+ "syntaxFunction": "blue",
66
+ "syntaxVariable": "text",
67
+ "syntaxString": "green",
68
+ "syntaxNumber": "orange",
69
+ "syntaxType": "cyan",
70
+ "syntaxOperator": "teal",
71
+ "syntaxPunctuation": "muted",
72
+ "thinkingOff": "dim",
73
+ "thinkingMinimal": "muted",
74
+ "thinkingLow": "blue",
75
+ "thinkingMedium": "cyan",
76
+ "thinkingHigh": "terra",
77
+ "thinkingXhigh": "magenta",
78
+ "thinkingMax": "red",
79
+ "bashMode": "green"
80
+ },
81
+ "export": {
82
+ "pageBg": "#1a1b2e",
83
+ "cardBg": "#24283b",
84
+ "infoBg": "#2f2a42"
85
+ }
86
+ }