@lune_99/pi-core-theme 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/README.md +24 -20
- package/docs/reference.md +55 -18
- package/docs/theme-palettes.png +0 -0
- package/docs/theme-palettes.svg +27 -6
- package/package.json +10 -7
- package/src/extension.ts +3 -1
- package/src/feature/context.ts +101 -189
- package/src/header.ts +2 -1
- package/src/index.ts +13 -2
- package/src/palettes/index.ts +18 -0
- package/src/palettes/pi-core-claude-code.json +110 -0
- package/src/palettes/pi-core-codex.json +108 -0
- package/src/palettes/pi-core-cursor.json +111 -0
- package/src/renderer/activity-card.ts +1 -1
- package/src/renderer/cards.ts +24 -39
- package/src/renderer/index.ts +7 -1
- package/src/renderer/markdown-enhance.ts +29 -20
- package/src/renderer/tool/activity.ts +13 -5
- package/src/renderer/tool/diff/shiki-highlight.ts +4 -1
- package/src/renderer/tool/output.ts +5 -2
- package/src/renderer/tool/presentation.ts +5 -2
- package/src/renderer/tool/summary.ts +12 -0
- package/src/renderer/transcript.ts +4 -15
- package/src/settings.ts +1 -1
- package/src/startup-agents.ts +80 -0
- package/src/ui/call-list.ts +7 -2
- package/src/ui/context-browser.ts +214 -0
- package/src/ui/hover.ts +28 -14
- package/src/ui/link-hover.ts +226 -0
- package/src/ui/output-panel.ts +13 -178
- package/src/ui/text-panel.ts +357 -0
- package/src/utils/format-tokens.ts +5 -0
- package/src/utils/links.ts +67 -0
- package/src/ui/preview.ts +0 -195
package/src/feature/context.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCurrentSystemMessage,
|
|
3
|
+
getCurrentTools,
|
|
4
|
+
getSystemMessageText,
|
|
5
|
+
} from "@earendil-works/pi-ai";
|
|
1
6
|
import {
|
|
2
7
|
estimateTokens,
|
|
3
|
-
|
|
4
|
-
type BuildSystemPromptOptions,
|
|
8
|
+
type ContextUsage,
|
|
5
9
|
type ExtensionAPI,
|
|
6
10
|
type ExtensionCommandContext,
|
|
7
|
-
type ToolInfo,
|
|
8
11
|
} from "@earendil-works/pi-coding-agent";
|
|
9
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
formatContextOverview,
|
|
14
|
+
showContextBrowser,
|
|
15
|
+
type ContextCategory,
|
|
16
|
+
} from "../ui/context-browser.ts";
|
|
17
|
+
export { formatTokens } from "../utils/format-tokens.ts";
|
|
18
|
+
|
|
10
19
|
type PreviewKey =
|
|
11
20
|
| "systemPrompt"
|
|
12
21
|
| "memoryFiles"
|
|
@@ -15,37 +24,8 @@ type PreviewKey =
|
|
|
15
24
|
| "toolResults"
|
|
16
25
|
| "contextFiles";
|
|
17
26
|
export type ContextPart = { label: string; tokens: number };
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const text = typeof value === "string" ? value : JSON.stringify(value);
|
|
21
|
-
return Math.max(0, Math.ceil(text.length / 4));
|
|
22
|
-
};
|
|
23
|
-
function systemMessageTokens(message: {
|
|
24
|
-
content?: unknown;
|
|
25
|
-
sections?: Record<string, string | null> | null;
|
|
26
|
-
}): number {
|
|
27
|
-
let chars = typeof message.content === "string" ? message.content.length : 0;
|
|
28
|
-
for (const section of Object.values(message.sections ?? {})) {
|
|
29
|
-
if (typeof section === "string") chars += section.length;
|
|
30
|
-
}
|
|
31
|
-
return Math.ceil(chars / 4);
|
|
32
|
-
}
|
|
33
|
-
function normalizeLineEndings(text: string): string {
|
|
34
|
-
return text.replace(/\r\n?/g, "\n");
|
|
35
|
-
}
|
|
36
|
-
function embeddedTokens(prompt: string, chunk: string): number {
|
|
37
|
-
if (!chunk || !prompt.includes(chunk)) return 0;
|
|
38
|
-
return tokenEstimate(chunk);
|
|
39
|
-
}
|
|
40
|
-
export function formatTokens(tokens: number): string {
|
|
41
|
-
if (tokens < 1000) return String(tokens);
|
|
42
|
-
if (tokens < 100000) return `${(tokens / 1000).toFixed(1)}k`;
|
|
43
|
-
return `${Math.round(tokens / 1000)}k`;
|
|
44
|
-
}
|
|
45
|
-
type ContextBreakdown = {
|
|
46
|
-
parts: ContextPart[];
|
|
47
|
-
previews: Record<PreviewKey, string>;
|
|
48
|
-
};
|
|
27
|
+
type ContextBreakdown = { parts: ContextPart[]; previews: Record<PreviewKey, string> };
|
|
28
|
+
|
|
49
29
|
function previewValue(value: unknown): string {
|
|
50
30
|
if (typeof value === "string") return value;
|
|
51
31
|
const text = JSON.stringify(
|
|
@@ -58,139 +38,87 @@ function previewValue(value: unknown): string {
|
|
|
58
38
|
);
|
|
59
39
|
return `\`\`\`json\n${text}\n\`\`\``;
|
|
60
40
|
}
|
|
41
|
+
|
|
61
42
|
export function collectContextBreakdown(
|
|
62
|
-
ctx: ExtensionCommandContext,
|
|
63
|
-
allTools: ToolInfo[],
|
|
64
|
-
activeTools: readonly string[],
|
|
43
|
+
ctx: Pick<ExtensionCommandContext, "sessionManager">,
|
|
65
44
|
): ContextBreakdown {
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
const
|
|
45
|
+
const projection = ctx.sessionManager.buildSessionProjection();
|
|
46
|
+
const system = getCurrentSystemMessage(projection.messages);
|
|
47
|
+
const tools = getCurrentTools(projection.messages);
|
|
48
|
+
let systemTokens = 0;
|
|
49
|
+
let memoryTokens = 0;
|
|
50
|
+
let skillsTokens = 0;
|
|
51
|
+
let toolDefinitionTokens = 0;
|
|
52
|
+
let systemPrompt = "";
|
|
53
|
+
let memory = "";
|
|
54
|
+
let skills = "";
|
|
55
|
+
if (system) {
|
|
56
|
+
const { project_context, ...withoutMemory } = system.sections ?? {};
|
|
57
|
+
const { skills: skillsSection, ...withoutSkills } = withoutMemory;
|
|
58
|
+
memory = project_context ?? "";
|
|
59
|
+
skills = skillsSection ?? "";
|
|
60
|
+
const prompt = { ...system, toolsAdded: undefined };
|
|
61
|
+
const promptWithoutMemory = { ...prompt, sections: withoutMemory };
|
|
62
|
+
const promptWithoutSkills = { ...prompt, sections: withoutSkills };
|
|
63
|
+
// Differences preserve Pi's rounding across the complete prompt, including full tool declarations.
|
|
64
|
+
toolDefinitionTokens = estimateTokens(system) - estimateTokens(prompt);
|
|
65
|
+
memoryTokens = estimateTokens(prompt) - estimateTokens(promptWithoutMemory);
|
|
66
|
+
skillsTokens = estimateTokens(promptWithoutMemory) - estimateTokens(promptWithoutSkills);
|
|
67
|
+
systemTokens = estimateTokens(promptWithoutSkills);
|
|
68
|
+
systemPrompt = getSystemMessageText(promptWithoutSkills);
|
|
69
|
+
}
|
|
69
70
|
const toolResultPreview: string[] = [];
|
|
70
71
|
const contextPreview: string[] = [];
|
|
71
|
-
const systemPromptPreview: string[] = [];
|
|
72
|
-
let toolDefinitionTokens = 0;
|
|
73
72
|
let toolResultTokens = 0;
|
|
74
73
|
let contextTokens = 0;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
for (const tool of allTools) {
|
|
84
|
-
if (!selectedTools.has(tool.name)) continue;
|
|
85
|
-
const definition = {
|
|
86
|
-
name: tool.name,
|
|
87
|
-
description: tool.description,
|
|
88
|
-
parameters: tool.parameters,
|
|
89
|
-
};
|
|
90
|
-
toolDefinitionTokens += tokenEstimate(definition);
|
|
91
|
-
toolDefinitionPreview.push(`## Definition: ${tool.name}\n\n${previewValue(definition)}`);
|
|
92
|
-
}
|
|
93
|
-
let memoryTokens = 0;
|
|
94
|
-
let skillsTokens = 0;
|
|
95
|
-
for (const projected of ctx.sessionManager.buildSessionProjection().entries) {
|
|
96
|
-
const source = projected.sourceEntry;
|
|
97
|
-
for (const message of projected.messages) {
|
|
98
|
-
if (message.role === "system") {
|
|
99
|
-
systemTokens += systemMessageTokens(message);
|
|
100
|
-
const sections = (message.sections ?? {}) as Record<string, string | null>;
|
|
101
|
-
const projectContext =
|
|
102
|
-
typeof sections.project_context === "string"
|
|
103
|
-
? normalizeLineEndings(sections.project_context)
|
|
104
|
-
: "";
|
|
105
|
-
for (const file of contextFiles) {
|
|
106
|
-
const chunk = `<project_instructions path="${file.path}">\n${normalizeLineEndings(file.content)}\n</project_instructions>`;
|
|
107
|
-
memoryTokens += embeddedTokens(projectContext, chunk);
|
|
108
|
-
systemTokens -= embeddedTokens(projectContext, chunk);
|
|
109
|
-
}
|
|
110
|
-
const skillsSection =
|
|
111
|
-
typeof sections.skills === "string"
|
|
112
|
-
? normalizeLineEndings(sections.skills)
|
|
113
|
-
: "";
|
|
114
|
-
skillsTokens += embeddedTokens(skillsSection, skillsText);
|
|
115
|
-
systemTokens -= embeddedTokens(skillsSection, skillsText);
|
|
116
|
-
systemPromptPreview.push(
|
|
117
|
-
(source.type === "compaction"
|
|
118
|
-
? "## System prompt snapshot at compaction\n\n"
|
|
119
|
-
: "## System prompt update\n\n") +
|
|
120
|
-
previewValue({
|
|
121
|
-
content: message.content,
|
|
122
|
-
sections: message.sections,
|
|
123
|
-
toolsAdded: (message.toolsAdded ?? []).map(
|
|
124
|
-
(tool: { name?: string }) => tool?.name,
|
|
125
|
-
),
|
|
126
|
-
toolsRemoved: (message.toolsRemoved ?? []).map(
|
|
127
|
-
(tool: { name?: string }) => tool?.name,
|
|
128
|
-
),
|
|
129
|
-
}),
|
|
130
|
-
);
|
|
131
|
-
} else if (message.role === "assistant") {
|
|
132
|
-
contextTokens += estimateTokens(message);
|
|
133
|
-
for (const block of message.content) {
|
|
134
|
-
if (block.type === "toolCall") {
|
|
135
|
-
contextPreview.push(
|
|
136
|
-
`## Assistant tool call: ${block.name}\n\n${previewValue(block.arguments)}`,
|
|
137
|
-
);
|
|
138
|
-
} else if (block.type === "text") {
|
|
139
|
-
contextPreview.push(`## Assistant\n\n${block.text}`);
|
|
140
|
-
} else if (block.type === "thinking") {
|
|
141
|
-
contextPreview.push(`## Assistant thinking\n\n${block.thinking}`);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} else if (message.role === "toolResult") {
|
|
145
|
-
toolResultTokens += estimateTokens(message);
|
|
146
|
-
toolResultPreview.push(
|
|
147
|
-
`## Result: ${message.toolName}\n\n${previewValue(message.content)}`,
|
|
148
|
-
);
|
|
149
|
-
} else if (message.role === "bashExecution") {
|
|
150
|
-
contextTokens += estimateTokens(message);
|
|
151
|
-
contextPreview.push(
|
|
152
|
-
`## Bash\n\nCommand:\n\n${previewValue(message.command)}\n\nOutput:\n\n${previewValue(message.output)}`,
|
|
153
|
-
);
|
|
154
|
-
} else if (message.role === "branchSummary" || message.role === "compactionSummary") {
|
|
155
|
-
contextTokens += estimateTokens(message);
|
|
156
|
-
contextPreview.push(`## ${message.role}\n\n${message.summary}`);
|
|
157
|
-
} else {
|
|
158
|
-
contextTokens += estimateTokens(message);
|
|
159
|
-
contextPreview.push(`## ${message.role}\n\n${previewValue(message.content)}`);
|
|
160
|
-
}
|
|
74
|
+
for (const message of projection.messages) {
|
|
75
|
+
if (message.role === "system") continue;
|
|
76
|
+
if (message.role === "toolResult") {
|
|
77
|
+
toolResultTokens += estimateTokens(message);
|
|
78
|
+
toolResultPreview.push(
|
|
79
|
+
`## Result: ${message.toolName}\n\n${previewValue(message.content)}`,
|
|
80
|
+
);
|
|
81
|
+
continue;
|
|
161
82
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
83
|
+
contextTokens += estimateTokens(message);
|
|
84
|
+
if (message.role === "assistant") {
|
|
85
|
+
for (const block of message.content) {
|
|
86
|
+
if (block.type === "toolCall")
|
|
87
|
+
contextPreview.push(
|
|
88
|
+
`## Assistant tool call: ${block.name}\n\n${previewValue(block.arguments)}`,
|
|
89
|
+
);
|
|
90
|
+
else if (block.type === "text")
|
|
91
|
+
contextPreview.push(`## Assistant\n\n${block.text}`);
|
|
92
|
+
else if (block.type === "thinking")
|
|
93
|
+
contextPreview.push(`## Assistant thinking\n\n${block.thinking}`);
|
|
94
|
+
}
|
|
95
|
+
} else if (message.role === "bashExecution") {
|
|
96
|
+
contextPreview.push(
|
|
97
|
+
`## Bash\n\nCommand:\n\n${previewValue(message.command)}\n\nOutput:\n\n${previewValue(message.output)}`,
|
|
98
|
+
);
|
|
99
|
+
} else if (message.role === "branchSummary" || message.role === "compactionSummary") {
|
|
100
|
+
contextPreview.push(`## ${message.role}\n\n${message.summary}`);
|
|
101
|
+
} else {
|
|
102
|
+
contextPreview.push(`## ${message.role}\n\n${previewValue(message.content)}`);
|
|
169
103
|
}
|
|
170
|
-
skillsTokens = embeddedTokens(prompt, skillsText);
|
|
171
|
-
systemTokens -= memoryTokens + skillsTokens;
|
|
172
104
|
}
|
|
173
|
-
systemTokens = Math.max(0, systemTokens);
|
|
174
105
|
return {
|
|
175
106
|
parts: [
|
|
176
107
|
{ label: "System prompt", tokens: systemTokens },
|
|
177
108
|
{ label: "Memory", tokens: memoryTokens },
|
|
178
109
|
{ label: "Skills", tokens: skillsTokens },
|
|
179
|
-
{
|
|
180
|
-
label: "Tools definition",
|
|
181
|
-
tokens: toolDefinitionTokens,
|
|
182
|
-
},
|
|
110
|
+
{ label: "Tool definitions", tokens: toolDefinitionTokens },
|
|
183
111
|
{ label: "Tool results", tokens: toolResultTokens },
|
|
184
|
-
{ label: "
|
|
185
|
-
]
|
|
112
|
+
{ label: "Messages", tokens: contextTokens },
|
|
113
|
+
],
|
|
186
114
|
previews: {
|
|
187
|
-
systemPrompt:
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
115
|
+
systemPrompt: systemPrompt || "No system prompt in the current context.",
|
|
116
|
+
memoryFiles: memory || "No memory files in context.",
|
|
117
|
+
skills: skills || "No skills in context.",
|
|
118
|
+
tools:
|
|
119
|
+
tools
|
|
120
|
+
.map((tool) => `## Definition: ${tool.name}\n\n${previewValue(tool)}`)
|
|
121
|
+
.join("\n\n") || "No active tool definitions.",
|
|
194
122
|
toolResults:
|
|
195
123
|
toolResultPreview.join("\n\n") || "No tool results in the current context.",
|
|
196
124
|
contextFiles: contextPreview.join("\n\n") || "No conversation context.",
|
|
@@ -209,47 +137,31 @@ export default function contextUsageExtension(
|
|
|
209
137
|
ctx.ui.notify("Enable Core theme in /lune-core-settings core-theme", "warning");
|
|
210
138
|
return;
|
|
211
139
|
}
|
|
212
|
-
const breakdown = collectContextBreakdown(ctx
|
|
213
|
-
const estimate = breakdown.parts.reduce((sum, part) => sum + part.tokens, 0);
|
|
140
|
+
const breakdown = collectContextBreakdown(ctx);
|
|
214
141
|
const usage = ctx.getContextUsage();
|
|
215
|
-
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
142
|
+
// Match Dock: unknown usage stays unknown, including the interval after compaction.
|
|
143
|
+
const summary: ContextUsage = {
|
|
144
|
+
tokens: usage?.tokens ?? null,
|
|
145
|
+
contextWindow: usage?.contextWindow ?? ctx.model?.contextWindow ?? 0,
|
|
146
|
+
percent: usage?.percent ?? null,
|
|
147
|
+
};
|
|
148
|
+
const keys: PreviewKey[] = [
|
|
149
|
+
"systemPrompt",
|
|
150
|
+
"memoryFiles",
|
|
151
|
+
"skills",
|
|
152
|
+
"tools",
|
|
153
|
+
"toolResults",
|
|
154
|
+
"contextFiles",
|
|
155
|
+
];
|
|
156
|
+
const categories: ContextCategory[] = breakdown.parts.map((part, index) => ({
|
|
157
|
+
...part,
|
|
158
|
+
content: breakdown.previews[keys[index]!],
|
|
159
|
+
}));
|
|
232
160
|
if (ctx.mode !== "tui") {
|
|
233
|
-
ctx.ui.notify(
|
|
161
|
+
ctx.ui.notify(formatContextOverview(summary, categories), "info");
|
|
234
162
|
return;
|
|
235
163
|
}
|
|
236
|
-
|
|
237
|
-
["systemPrompt", "System prompt"],
|
|
238
|
-
["memoryFiles", "Memory"],
|
|
239
|
-
["skills", "Skills"],
|
|
240
|
-
["tools", "Tool definitions"],
|
|
241
|
-
["toolResults", "Tool results"],
|
|
242
|
-
["contextFiles", "Messages"],
|
|
243
|
-
];
|
|
244
|
-
const items: InspectorItem[] = [
|
|
245
|
-
{ label: "Overview", content: overview },
|
|
246
|
-
...labels.map(([key, label], index) => ({
|
|
247
|
-
label,
|
|
248
|
-
content: breakdown.previews[key],
|
|
249
|
-
detail: `${formatTokens(breakdown.parts[index]!.tokens)} estimated tokens`,
|
|
250
|
-
})),
|
|
251
|
-
];
|
|
252
|
-
await showInspector(ctx, "LUNE · Context", items, subtitle);
|
|
164
|
+
await showContextBrowser(ctx, summary, categories);
|
|
253
165
|
},
|
|
254
166
|
});
|
|
255
167
|
}
|
package/src/header.ts
CHANGED
|
@@ -173,7 +173,7 @@ export function createLuneHeader(
|
|
|
173
173
|
[
|
|
174
174
|
hint(keyText("app.tools.expand"), expanded ? "less" : "more"),
|
|
175
175
|
hint(keyText("app.interrupt"), "interrupt"),
|
|
176
|
-
hint(
|
|
176
|
+
hint("@", "files and sessions"),
|
|
177
177
|
],
|
|
178
178
|
];
|
|
179
179
|
|
|
@@ -203,6 +203,7 @@ export function createLuneHeader(
|
|
|
203
203
|
hint(keyText("app.exit"), "exit on empty editor"),
|
|
204
204
|
hint(keyText("app.suspend"), "suspend"),
|
|
205
205
|
hint(keyText("app.thinking.cycle"), "cycle thinking level"),
|
|
206
|
+
hint(keyText("app.model.select"), "select model"),
|
|
206
207
|
hint(
|
|
207
208
|
[keyText("app.model.cycleForward"), keyText("app.model.cycleBackward")]
|
|
208
209
|
.filter(Boolean)
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { SettingsBinding, SettingsView } from "@lune_99/pi-lune-extensions-
|
|
|
3
3
|
import type { HeaderFactory, StartupHeader } from "./startup-header.ts";
|
|
4
4
|
import type { SessionHandoff } from "./session-handoff.ts";
|
|
5
5
|
import { createLuneHeader, type HeaderOptions } from "./header.ts";
|
|
6
|
+
import { installStartupAgents } from "./startup-agents.ts";
|
|
6
7
|
import { config, setConfig } from "./config/config.ts";
|
|
7
8
|
import type { themeSettings } from "./settings.ts";
|
|
8
9
|
import { capturePalette, createPalette } from "./palette.ts";
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
WriteExecutionMetadataStore,
|
|
18
19
|
} from "./renderer/tool/diff/write-execution.ts";
|
|
19
20
|
|
|
20
|
-
/** Settings owns activation;
|
|
21
|
+
/** Settings owns activation; headless sessions never mount appearance or transcript renderers. */
|
|
21
22
|
export function registerTheme(
|
|
22
23
|
pi: ExtensionAPI,
|
|
23
24
|
settings: SettingsBinding<typeof themeSettings.schema>,
|
|
@@ -25,13 +26,20 @@ export function registerTheme(
|
|
|
25
26
|
continuity: {
|
|
26
27
|
startupHeader?: Pick<StartupHeader, "claim">;
|
|
27
28
|
handoff?: SessionHandoff;
|
|
29
|
+
interactiveMode?: { prototype: object };
|
|
28
30
|
} = {},
|
|
29
31
|
) {
|
|
30
|
-
const { startupHeader, handoff } = continuity;
|
|
32
|
+
const { startupHeader, handoff, interactiveMode } = continuity;
|
|
31
33
|
const headerFactory: HeaderFactory = (_tui, theme) => createLuneHeader(theme, header);
|
|
32
34
|
let release: (() => void) | undefined;
|
|
33
35
|
let disposed = false;
|
|
34
36
|
let enabledInTui = false;
|
|
37
|
+
let currentContext: ExtensionContext | undefined;
|
|
38
|
+
const startupAgents = installStartupAgents({
|
|
39
|
+
interactiveMode,
|
|
40
|
+
events: pi.events,
|
|
41
|
+
getTheme: () => (enabledInTui ? currentContext?.ui.theme : undefined),
|
|
42
|
+
});
|
|
35
43
|
const writeMetadata = new WriteExecutionMetadataStore();
|
|
36
44
|
const rendererHost = createThemeRendererHost(pi, writeMetadata, () =>
|
|
37
45
|
header.keyText("app.tools.expand"),
|
|
@@ -52,6 +60,7 @@ export function registerTheme(
|
|
|
52
60
|
const mount = (context: ExtensionContext, view: SettingsView<typeof themeSettings.schema>) => {
|
|
53
61
|
unmount();
|
|
54
62
|
if (disposed || view.signal.aborted || context.mode !== "tui") return;
|
|
63
|
+
currentContext = context;
|
|
55
64
|
// The header and palette already on screen came from the startup swap or the previous
|
|
56
65
|
// instance; apply() only changes them if settings disagree.
|
|
57
66
|
const adopted = handoff?.adopt() ?? {};
|
|
@@ -204,6 +213,7 @@ export function registerTheme(
|
|
|
204
213
|
stop();
|
|
205
214
|
if (writeTimer) clearTimeout(writeTimer);
|
|
206
215
|
enabledInTui = false;
|
|
216
|
+
currentContext = undefined;
|
|
207
217
|
if (paletteMounted) {
|
|
208
218
|
paletteMounted = false;
|
|
209
219
|
context.ui.setWidget(paletteWidgetKey, undefined);
|
|
@@ -231,6 +241,7 @@ export function registerTheme(
|
|
|
231
241
|
disposed = true;
|
|
232
242
|
unsubscribe();
|
|
233
243
|
unmount();
|
|
244
|
+
startupAgents.dispose();
|
|
234
245
|
},
|
|
235
246
|
};
|
|
236
247
|
}
|
package/src/palettes/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import aurora from "./pi-core-aurora.json" with { type: "json" };
|
|
2
|
+
import claudeCode from "./pi-core-claude-code.json" with { type: "json" };
|
|
3
|
+
import codex from "./pi-core-codex.json" with { type: "json" };
|
|
4
|
+
import cursor from "./pi-core-cursor.json" with { type: "json" };
|
|
2
5
|
import dark from "./pi-core-dark.json" with { type: "json" };
|
|
3
6
|
import dawn from "./pi-core-dawn.json" with { type: "json" };
|
|
4
7
|
import eclipse from "./pi-core-eclipse.json" with { type: "json" };
|
|
@@ -57,6 +60,21 @@ export const palettes = {
|
|
|
57
60
|
description: "Pine teal on sage mist",
|
|
58
61
|
definition: mist,
|
|
59
62
|
},
|
|
63
|
+
"pi-core-claude-code": {
|
|
64
|
+
label: "Lune Core Claude Code",
|
|
65
|
+
description: "Claude Code-style clay orange on warm charcoal",
|
|
66
|
+
definition: claudeCode,
|
|
67
|
+
},
|
|
68
|
+
"pi-core-cursor": {
|
|
69
|
+
label: "Lune Core Cursor",
|
|
70
|
+
description: "Cursor-style pastel syntax on graphite",
|
|
71
|
+
definition: cursor,
|
|
72
|
+
},
|
|
73
|
+
"pi-core-codex": {
|
|
74
|
+
label: "Lune Core Codex",
|
|
75
|
+
description: "Codex-style cyan and magenta on black",
|
|
76
|
+
definition: codex,
|
|
77
|
+
},
|
|
60
78
|
} as const satisfies Record<string, PaletteEntry>;
|
|
61
79
|
|
|
62
80
|
export type PaletteName = keyof typeof palettes;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://pi.dev/schemas/theme.schema.json",
|
|
3
|
+
"name": "pi-core-claude-code",
|
|
4
|
+
"vars": {
|
|
5
|
+
"bg": "#1f1e1d",
|
|
6
|
+
"panel": "#262624",
|
|
7
|
+
"surface": "#30302e",
|
|
8
|
+
"border": "#4a4843",
|
|
9
|
+
"borderMuted": "#363532",
|
|
10
|
+
"text": "#faf9f5",
|
|
11
|
+
"muted": "#c2c0b6",
|
|
12
|
+
"dim": "#9c9a92",
|
|
13
|
+
"comment": "#85837b",
|
|
14
|
+
"punctuation": "#a6a49b",
|
|
15
|
+
"variable": "#e8e6dc",
|
|
16
|
+
"heading": "#eb9f7f",
|
|
17
|
+
"accent": "#d97757",
|
|
18
|
+
"accentBright": "#eb9f7f",
|
|
19
|
+
"type": "#7fc4b8",
|
|
20
|
+
"moonDeep": "#b65a3c",
|
|
21
|
+
"seaGlass": "#4eba65",
|
|
22
|
+
"string": "#a3cf94",
|
|
23
|
+
"rose": "#ff6b80",
|
|
24
|
+
"halo": "#ffc107",
|
|
25
|
+
"lavender": "#b1b9f9",
|
|
26
|
+
"violet": "#af87ff",
|
|
27
|
+
"bash": "#fd5db1",
|
|
28
|
+
"phase1": "#b65a3c",
|
|
29
|
+
"phase2": "#d97757",
|
|
30
|
+
"phase3": "#eb9f7f",
|
|
31
|
+
"phase4": "#f4c1a8",
|
|
32
|
+
"phase5": "#fbe6da",
|
|
33
|
+
"moon1": "#fbe6da",
|
|
34
|
+
"moon2": "#f4c1a8",
|
|
35
|
+
"moon3": "#eb9f7f",
|
|
36
|
+
"moon4": "#d97757",
|
|
37
|
+
"moon5": "#b65a3c",
|
|
38
|
+
"selectedBg": "#3d302a",
|
|
39
|
+
"searchMatchBg": "#57392c",
|
|
40
|
+
"userMessageBg": "#2c2b29",
|
|
41
|
+
"customMessageBg": "#292a35",
|
|
42
|
+
"toolPendingBg": "#242321",
|
|
43
|
+
"toolSuccessBg": "#1f2a21",
|
|
44
|
+
"toolErrorBg": "#33201f"
|
|
45
|
+
},
|
|
46
|
+
"colors": {
|
|
47
|
+
"accent": "accent",
|
|
48
|
+
"border": "border",
|
|
49
|
+
"borderAccent": "accent",
|
|
50
|
+
"borderMuted": "borderMuted",
|
|
51
|
+
"success": "seaGlass",
|
|
52
|
+
"error": "rose",
|
|
53
|
+
"warning": "halo",
|
|
54
|
+
"muted": "muted",
|
|
55
|
+
"dim": "dim",
|
|
56
|
+
"text": "text",
|
|
57
|
+
"thinkingText": "muted",
|
|
58
|
+
"selectedBg": "selectedBg",
|
|
59
|
+
"userMessageBg": "userMessageBg",
|
|
60
|
+
"userMessageText": "text",
|
|
61
|
+
"customMessageBg": "customMessageBg",
|
|
62
|
+
"customMessageText": "text",
|
|
63
|
+
"customMessageLabel": "lavender",
|
|
64
|
+
"toolPendingBg": "toolPendingBg",
|
|
65
|
+
"toolSuccessBg": "toolSuccessBg",
|
|
66
|
+
"toolErrorBg": "toolErrorBg",
|
|
67
|
+
"toolTitle": "text",
|
|
68
|
+
"toolOutput": "muted",
|
|
69
|
+
"mdHeading": "heading",
|
|
70
|
+
"mdLink": "lavender",
|
|
71
|
+
"mdLinkUrl": "dim",
|
|
72
|
+
"mdCode": "lavender",
|
|
73
|
+
"mdCodeBlock": "text",
|
|
74
|
+
"mdCodeBlockBorder": "borderMuted",
|
|
75
|
+
"mdQuote": "muted",
|
|
76
|
+
"mdQuoteBorder": "moonDeep",
|
|
77
|
+
"mdHr": "borderMuted",
|
|
78
|
+
"mdListBullet": "accent",
|
|
79
|
+
"toolDiffAdded": "seaGlass",
|
|
80
|
+
"toolDiffRemoved": "rose",
|
|
81
|
+
"toolDiffContext": "muted",
|
|
82
|
+
"syntaxComment": "comment",
|
|
83
|
+
"syntaxKeyword": "violet",
|
|
84
|
+
"syntaxFunction": "accentBright",
|
|
85
|
+
"syntaxVariable": "variable",
|
|
86
|
+
"syntaxString": "string",
|
|
87
|
+
"syntaxNumber": "halo",
|
|
88
|
+
"syntaxType": "type",
|
|
89
|
+
"syntaxOperator": "muted",
|
|
90
|
+
"syntaxPunctuation": "punctuation",
|
|
91
|
+
"thinkingOff": "comment",
|
|
92
|
+
"thinkingMinimal": "dim",
|
|
93
|
+
"thinkingLow": "phase1",
|
|
94
|
+
"thinkingMedium": "phase2",
|
|
95
|
+
"thinkingHigh": "phase3",
|
|
96
|
+
"thinkingXhigh": "phase4",
|
|
97
|
+
"thinkingMax": "phase5",
|
|
98
|
+
"bashMode": "bash",
|
|
99
|
+
"scrollbarThumb": "dim",
|
|
100
|
+
"scrollbarTrack": "borderMuted",
|
|
101
|
+
"searchMatchBg": "searchMatchBg",
|
|
102
|
+
"searchMatchText": "text"
|
|
103
|
+
},
|
|
104
|
+
"export": {
|
|
105
|
+
"pageBg": "bg",
|
|
106
|
+
"cardBg": "panel",
|
|
107
|
+
"infoBg": "surface"
|
|
108
|
+
},
|
|
109
|
+
"appearance": "dark"
|
|
110
|
+
}
|