@anthodev/pi-tools-style 0.1.4 → 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.
@@ -1,4 +1,4 @@
1
- import type { Theme, ThemeColor } from "@earendil-works/pi-coding-agent";
1
+ import type { Theme } from "@earendil-works/pi-coding-agent";
2
2
 
3
3
  export type ToolCategory =
4
4
  | "execute"
@@ -9,22 +9,9 @@ export type ToolCategory =
9
9
  | "orchestrate"
10
10
  | "other";
11
11
 
12
- export type BorderStyle = (value: string) => string;
13
12
  type ThemeProvider = () => Theme;
14
13
 
15
14
  const THEME_PROVIDER_KEY = Symbol.for("pi-tools-style:theme-provider");
16
- const DIM = "\u001b[2m";
17
- const RESET_DIM = "\u001b[22m";
18
-
19
- const CATEGORY_THEME_COLOR: Record<ToolCategory, ThemeColor> = {
20
- execute: "bashMode",
21
- external: "syntaxType",
22
- inspect: "mdLink",
23
- interact: "accent",
24
- mutate: "warning",
25
- orchestrate: "customMessageLabel",
26
- other: "borderMuted",
27
- };
28
15
 
29
16
  const EXTERNAL_NAMESPACES = new Set([
30
17
  "api",
@@ -117,18 +104,6 @@ export function classifyTool(toolName: string): ToolCategory {
117
104
  return "other";
118
105
  }
119
106
 
120
- export function createToolBorderStyle(toolName: string): BorderStyle {
121
- return createCategoryBorderStyle(classifyTool(toolName));
122
- }
123
-
124
- export function createCategoryBorderStyle(category: ToolCategory): BorderStyle {
125
- const theme = readTheme();
126
- if (!theme) return dimBorder;
127
-
128
- const color = CATEGORY_THEME_COLOR[category];
129
- return (value) => theme.fg(color, value);
130
- }
131
-
132
107
  export function setThemeProvider(provider: ThemeProvider | undefined): void {
133
108
  if (provider) {
134
109
  Reflect.set(globalThis, THEME_PROVIDER_KEY, provider);
@@ -137,7 +112,8 @@ export function setThemeProvider(provider: ThemeProvider | undefined): void {
137
112
  Reflect.deleteProperty(globalThis, THEME_PROVIDER_KEY);
138
113
  }
139
114
 
140
- function readTheme(): Theme | undefined {
115
+ /** Current public session theme; shell falls back to native until a provider is bound. */
116
+ export function getToolTheme(): Theme | undefined {
141
117
  const provider = Reflect.get(globalThis, THEME_PROVIDER_KEY) as
142
118
  | ThemeProvider
143
119
  | undefined;
@@ -158,6 +134,3 @@ function normalizeToolName(toolName: string): string {
158
134
  .toLowerCase();
159
135
  }
160
136
 
161
- function dimBorder(value: string): string {
162
- return `${DIM}${value}${RESET_DIM}`;
163
- }