@xynogen/pix-optimizer 1.1.4 → 1.1.6

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/src/rtk.ts CHANGED
@@ -300,32 +300,19 @@ export function rtk(
300
300
  syncStatus(ctx);
301
301
  });
302
302
 
303
- // -- Subcommand handler (dispatched by the merged /opt router) --
303
+ // -- Overlay value handler (called by the /optimizer overlay) --
304
304
 
305
305
  async function run(
306
- args: string,
306
+ value: string,
307
307
  ctx: ExtensionCommandContext,
308
308
  ): Promise<void> {
309
- const arg = args.trim().toLowerCase();
310
- if (arg === "on") enabled = true;
311
- else if (arg === "off") enabled = false;
312
- else enabled = !enabled; // bare toggles
309
+ enabled = value === "on";
313
310
 
314
311
  await checkRtkAvailability();
315
312
  syncStatus(ctx);
316
313
  ctx.ui.notify(`RTK rewriting ${enabled ? "on" : "off"}.`, "info");
317
314
  }
318
315
 
319
- function complete(prefix: string) {
320
- const items = [
321
- { value: "on", label: "on", description: "Force RTK rewriting on" },
322
- { value: "off", label: "off", description: "Force RTK rewriting off" },
323
- ];
324
- const n = prefix.trim().toLowerCase();
325
- const filtered = items.filter((i) => i.value.startsWith(n));
326
- return filtered.length > 0 ? filtered : null;
327
- }
328
-
329
316
  // Rewrite bash commands to add rtk prefix.
330
317
  //
331
318
  // The SDK fires a single `tool_call` event for every tool. The bash variant
@@ -373,8 +360,9 @@ export function rtk(
373
360
 
374
361
  return {
375
362
  name: "rtk",
376
- help: "rtk [on|off] — prefix shell commands with rtk (token-optimized)",
363
+ help: "rtk — prefix shell commands with rtk (token-optimized)",
364
+ values: ["off", "on"],
365
+ current: () => (enabled ? "on" : "off"),
377
366
  run,
378
- complete,
379
367
  };
380
368
  }
package/src/status.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * status.ts — shared status-bar indicator for the optimizer suite.
3
3
  *
4
- * caveman / rtk / json each toggle independently, but they're all the same
4
+ * caveman / rtk / toon / 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
  * instead of three. Each tool reports its on/off state into a single registry;
7
7
  * the cell renders only the icons whose tool is currently enabled, in a fixed
@@ -18,26 +18,22 @@ import type {
18
18
  ThemeColor,
19
19
  } from "@earendil-works/pi-coding-agent";
20
20
 
21
- /** Argument-completion item shape used by the merged /opt command. */
22
- export interface CompletionItem {
23
- value: string;
24
- label: string;
25
- description: string;
26
- }
27
-
28
21
  /**
29
- * Each optimizer tool (caveman/rtk/json) exposes a handle so the single `/opt`
30
- * router can dispatch subcommands to it without knowing its internals.
22
+ * Each optimizer tool (caveman/rtk/toon/ponytail) exposes a handle so the
23
+ * single `/optimizer` overlay can render one row per tool and apply value
24
+ * changes without knowing the tool's internals.
31
25
  */
32
26
  export interface OptimizerHandle {
33
- /** Subcommand name, e.g. "caveman" / "rtk" / "toon". */
27
+ /** Tool name, e.g. "caveman" / "rtk" / "toon". */
34
28
  name: OptimizerTool;
35
- /** One-line help shown by `/opt` with no args. */
29
+ /** One-line summary shown in the overlay row. */
36
30
  help: string;
37
- /** Handle `/opt <name> <args>`. `args` is everything after the name. */
38
- run(args: string, ctx: ExtensionCommandContext): Promise<void> | void;
39
- /** Completions for the second token (`/opt <name> <prefix>`). */
40
- complete(prefix: string): CompletionItem[] | null;
31
+ /** Cyclable values for this tool's overlay row, in display order. */
32
+ values: readonly string[];
33
+ /** Current value string (must be one of `values`). */
34
+ current(): string;
35
+ /** Apply a chosen value (persists + repaints status). `value` is one of `values`. */
36
+ run(value: string, ctx: ExtensionCommandContext): Promise<void> | void;
41
37
  }
42
38
 
43
39
  /** Stable status-bar key shared by every optimizer tool. */
@@ -94,6 +90,11 @@ export function renderStatus(
94
90
  export class OptimizerStatus {
95
91
  private states: Partial<Record<OptimizerTool, boolean>> = {};
96
92
 
93
+ /** Current enabled state for one tool (undefined until first set). */
94
+ get(tool: OptimizerTool): boolean | undefined {
95
+ return this.states[tool];
96
+ }
97
+
97
98
  /** Update one tool's enabled state and repaint the shared cell. */
98
99
  set(
99
100
  tool: OptimizerTool,