@xynogen/pix-optimizer 1.1.26 → 1.1.28
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/package.json +1 -1
- package/src/opt.ts +6 -5
- package/src/rtk.ts +7 -16
- package/src/status.ts +3 -3
package/package.json
CHANGED
package/src/opt.ts
CHANGED
|
@@ -73,6 +73,7 @@ export function registerOptCommand(
|
|
|
73
73
|
pi.registerCommand("optimizer", {
|
|
74
74
|
description: "pix-optimizer: caveman / rtk / ponytail tools",
|
|
75
75
|
handler: async (_args, ctx) => {
|
|
76
|
+
// SAFETY: Runtime UI supports custom overlays beyond the published command context type.
|
|
76
77
|
const ui = ctx.ui as unknown as {
|
|
77
78
|
theme: {
|
|
78
79
|
fg(c: string, t: string): string;
|
|
@@ -114,8 +115,8 @@ export function registerOptCommand(
|
|
|
114
115
|
done: (v: null) => void,
|
|
115
116
|
) => {
|
|
116
117
|
const guide = (key: string, action: string) =>
|
|
117
|
-
theme.fg("text", key) + theme.fg("
|
|
118
|
-
const guideSep = theme.fg("
|
|
118
|
+
theme.fg("text", key) + theme.fg("muted", ` ${action}`);
|
|
119
|
+
const guideSep = theme.fg("muted", " · ");
|
|
119
120
|
let selected = 0;
|
|
120
121
|
const pager = new ModalPager();
|
|
121
122
|
|
|
@@ -138,14 +139,14 @@ export function registerOptCommand(
|
|
|
138
139
|
const on = handles[tool].current() !== "off";
|
|
139
140
|
const sel = i === selected;
|
|
140
141
|
const cursor = sel ? theme.fg("accent", "→") : " ";
|
|
141
|
-
const glyph = theme.fg(on ? "accent" : "
|
|
142
|
+
const glyph = theme.fg(on ? "accent" : "muted", toolIcon(tool));
|
|
142
143
|
const name = theme.fg(
|
|
143
144
|
sel ? "accent" : on ? "text" : "muted",
|
|
144
145
|
tool.padEnd(nameWidth),
|
|
145
146
|
);
|
|
146
147
|
const cur = handles[tool].current();
|
|
147
|
-
const value = theme.fg(on ? "success" : "
|
|
148
|
-
const bar = theme.fg(on ? "accent" : "
|
|
148
|
+
const value = theme.fg(on ? "success" : "muted", cur.padEnd(valueWidth));
|
|
149
|
+
const bar = theme.fg(on ? "accent" : "muted", levelBar(cur, handles[tool].values));
|
|
149
150
|
return `${cursor} ${glyph} ${name} ${value} ${bar}`;
|
|
150
151
|
});
|
|
151
152
|
const result = frameModal({
|
package/src/rtk.ts
CHANGED
|
@@ -90,15 +90,6 @@ export function applyRtkRewrite(
|
|
|
90
90
|
return true;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
const RTK_SYSTEM_PROMPT = `# RTK — token-optimized command wrapper
|
|
94
|
-
|
|
95
|
-
Prefix shell commands with \`rtk\` (e.g. \`rtk git status\`). RTK compacts output for git, gh, cargo, npm/pnpm/yarn/bun, tsc, lint, vitest/jest/playwright, docker, kubectl, ls, grep, prisma — and passes anything else through unchanged, so it's always safe.
|
|
96
|
-
|
|
97
|
-
Prefix EVERY segment in a chain, not just the first:
|
|
98
|
-
\`rtk git add . && rtk git commit -m "msg" && rtk git push\`
|
|
99
|
-
|
|
100
|
-
RTK also has filtering subcommands the auto-rewriter won't add — reach for these yourself when useful: \`rtk err <cmd>\` (errors only), \`rtk summary <cmd>\`, \`rtk log <file>\` (dedup), \`rtk json <file>\` (structure), \`rtk test <cmd>\` (failures only), \`rtk gain\` (savings stats).`;
|
|
101
|
-
|
|
102
93
|
// Commands that should be prefixed with rtk
|
|
103
94
|
const RTK_COMMANDS = new Set([
|
|
104
95
|
"git",
|
|
@@ -256,15 +247,15 @@ export function rtk(pi: ExtensionAPI, status: OptimizerStatus): OptimizerHandle
|
|
|
256
247
|
return rtkStatus;
|
|
257
248
|
};
|
|
258
249
|
|
|
259
|
-
//
|
|
260
|
-
|
|
261
|
-
|
|
250
|
+
// Detect sudo_run tool availability. No system-prompt injection — the
|
|
251
|
+
// tool_call rewrite hook adds the rtk prefix on its own, so we keep zero
|
|
252
|
+
// always-on context cost (ponytail: manual `rtk err`/`rtk summary`/`rtk
|
|
253
|
+
// test` subcommands are no longer advertised to the model; re-add a prompt
|
|
254
|
+
// here if you want those surfaced).
|
|
255
|
+
pi.on("before_agent_start", (event) => {
|
|
262
256
|
const tools: string[] = event.systemPromptOptions?.selectedTools ?? [];
|
|
263
257
|
hasSudoRunTool = tools.includes("sudo_run");
|
|
264
|
-
|
|
265
|
-
if (!enabled) return undefined;
|
|
266
|
-
const existing = event.systemPrompt ?? "";
|
|
267
|
-
return { systemPrompt: `${RTK_SYSTEM_PROMPT}\n\n${existing}` };
|
|
258
|
+
return undefined;
|
|
268
259
|
});
|
|
269
260
|
|
|
270
261
|
// Keep the status indicator in sync across the agent lifecycle. Probe
|
package/src/status.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* caveman / rtk / ponytail each toggle independently, but they're all the same
|
|
5
5
|
* class of thing (token-optimization tools), so they share ONE status cell.
|
|
6
6
|
* Each tool reports its on/off state into a single registry; the cell renders
|
|
7
|
-
* all three icons in a fixed order — accent-colored when enabled,
|
|
7
|
+
* all three icons in a fixed order — accent-colored when enabled, muted when
|
|
8
8
|
* disabled. The cell is never empty.
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -62,7 +62,7 @@ const TOOL_ORDER: readonly OptimizerTool[] = ["caveman", "rtk", "ponytail"];
|
|
|
62
62
|
/** Theme color for enabled icons. */
|
|
63
63
|
const ENABLED_COLOR: ThemeColor = "accent";
|
|
64
64
|
/** Theme color for disabled icons. */
|
|
65
|
-
const DISABLED_COLOR: ThemeColor = "
|
|
65
|
+
const DISABLED_COLOR: ThemeColor = "muted";
|
|
66
66
|
|
|
67
67
|
/** Colorizer: maps a (theme color, text) pair to a rendered string. */
|
|
68
68
|
export type Colorize = (color: ThemeColor, text: string) => string;
|
|
@@ -70,7 +70,7 @@ export type Colorize = (color: ThemeColor, text: string) => string;
|
|
|
70
70
|
/**
|
|
71
71
|
* Build the colored status string for a set of tool states. ALL tool icons are
|
|
72
72
|
* always shown in TOOL_ORDER; each is accent-colored when its tool is enabled
|
|
73
|
-
* and
|
|
73
|
+
* and muted when disabled. Glyphs resolve against the active global icon mode
|
|
74
74
|
* (see /pix). `color` applies the theme color (e.g. theme.fg).
|
|
75
75
|
*
|
|
76
76
|
* Pure + exported for tests (pass a tagging colorizer to assert per-icon color).
|