@janvitos/pi-plan-build 0.1.14 → 0.1.16

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/README.md CHANGED
@@ -8,7 +8,7 @@ A global [Pi coding agent](https://github.com/badlogic/pi-mono) extension that a
8
8
 
9
9
  - New sessions start in **Build** mode.
10
10
  - Bare `Tab` cycles **Build → Plan → Build**, while active autocomplete dropdowns retain Pi's normal Tab completion.
11
- - The composer uses OpenCode prompt-inspired blue/orange mode colors on the top and left borders, complemented by Pi's border color on the right and bottom borders; rounded corners close the frame while matching their adjoining horizontal border colors. It also includes a mode/model/thinking metadata row. The model is shown as `model-id [provider]` (for example, `gpt-5.6-luna [openai]`), with the model ID inheriting the terminal foreground like unselected entries in `/model` and the provider using the footer's dim text color. The footer keeps the remaining path and usage stats without duplicating model metadata.
11
+ - The composer uses OpenCode prompt-inspired blue/orange mode colors on the rounded top-left border and left rail, complemented by Pi's border color on the right rail and rounded bottom-right border; the frame leaves open gaps at the top right and bottom left. It also includes a mode/model/thinking metadata row; cycling the thinking level updates this row without adding a duplicate status above the composer. The model is shown as `model-id [provider]` (for example, `gpt-5.6-luna [openai]`), with the model ID inheriting the terminal foreground like unselected entries in `/model` and the provider using the footer's dim text color. The footer keeps the remaining path and usage stats without duplicating model metadata.
12
12
  - `/plan`, `/build`, and the `--plan` startup flag.
13
13
  - Per-session plans at `~/.pi/agent/plans/<session-id>.md`.
14
14
  - In Plan mode, built-in `edit` and `write` are restricted to the exact plan file.
package/index.ts CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  isAllowedPlanMutation,
29
29
  makePlanPath,
30
30
  nextMode,
31
+ nextThinkingLevel,
31
32
  PLAN_EXIT_APPROVE_CHOICE,
32
33
  PLAN_EXIT_FRESH_CHOICE,
33
34
  PLAN_EXIT_STAY_ACKNOWLEDGEMENT,
@@ -477,6 +478,8 @@ export default function planBuildModes(pi: ExtensionAPI): void {
477
478
  const promptHistory = event.reason === "startup" ? [] : extractPromptHistory(ctx.sessionManager.getBranch());
478
479
  class ModeEditor extends CustomEditor {
479
480
  onCycle?: () => void;
481
+ onCycleThinking?: () => void;
482
+ matchesThinkingCycle?: (data: string) => boolean;
480
483
 
481
484
  requestModeRender(): void {
482
485
  this.tui.requestRender();
@@ -508,6 +511,11 @@ export default function planBuildModes(pi: ExtensionAPI): void {
508
511
  }
509
512
 
510
513
  override handleInput(data: string): void {
514
+ if (this.matchesThinkingCycle?.(data)) {
515
+ if (this.onExtensionShortcut?.(data)) return;
516
+ this.onCycleThinking?.();
517
+ return;
518
+ }
511
519
  if (matchesKey(data, Key.tab) && !this.isShowingAutocomplete()) {
512
520
  this.onCycle?.();
513
521
  return;
@@ -522,6 +530,15 @@ export default function planBuildModes(pi: ExtensionAPI): void {
522
530
  editor.onCycle = () => {
523
531
  if (currentContext) void selectMode(nextMode(selectedMode), currentContext, "manual");
524
532
  };
533
+ editor.matchesThinkingCycle = (data) =>
534
+ keybindings.matches(data, "app.thinking.cycle") &&
535
+ !keybindings.matches(data, "tui.editor.historyPrevious") &&
536
+ !keybindings.matches(data, "tui.editor.historyNext");
537
+ editor.onCycleThinking = () => {
538
+ const level = nextThinkingLevel(pi.getThinkingLevel(), ctx.model);
539
+ if (level) pi.setThinkingLevel(level);
540
+ editor.requestModeRender();
541
+ };
525
542
  return editor;
526
543
  });
527
544
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janvitos/pi-plan-build",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Plan safely, approve explicitly, then implement here or in a clean session.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/utils.ts CHANGED
@@ -17,6 +17,23 @@ export interface PromptMetadataOptions {
17
17
  modelProvider?: string;
18
18
  }
19
19
 
20
+ export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
21
+ const THINKING_LEVELS: ThinkingLevel[] = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
22
+
23
+ export function nextThinkingLevel(
24
+ current: ThinkingLevel,
25
+ model: { reasoning: boolean; thinkingLevelMap?: Partial<Record<ThinkingLevel, unknown>> } | undefined,
26
+ ): ThinkingLevel | undefined {
27
+ if (!model?.reasoning) return undefined;
28
+ const available = THINKING_LEVELS.filter((level) => {
29
+ const mapped = model.thinkingLevelMap?.[level];
30
+ if (mapped === null) return false;
31
+ return level !== "xhigh" && level !== "max" || mapped !== undefined;
32
+ });
33
+ const currentIndex = available.indexOf(current);
34
+ return available[(currentIndex + 1) % available.length];
35
+ }
36
+
20
37
  function formatModeColor(mode: Mode, text: string): string {
21
38
  return `\x1b[${MODE_LABELS[mode].color}m${text}${ANSI_RESET}`;
22
39
  }
@@ -27,7 +44,7 @@ export function formatModeRail(mode: Mode): string {
27
44
 
28
45
  export function formatModeTopBorder(mode: Mode, width: number): string {
29
46
  if (width <= 1) return "";
30
- return formatModeColor(mode, `╭${"─".repeat(width - 2)}╮`);
47
+ return formatModeColor(mode, `╭${"─".repeat(width - 2)}`);
31
48
  }
32
49
 
33
50
  export function formatModeMetadata(
@@ -95,7 +112,7 @@ export function renderModeComposer(
95
112
  .slice(1, bottomBorderIndex)
96
113
  .map((line) => addRightRail(leftRailPrefix + line.slice(reservedPrefix.length)));
97
114
  const bottomBorder = lineWidth.truncate(lines[bottomBorderIndex]!, width)
98
- .replace(/^((?:\x1b\[[0-?]*[ -/]*[@-~])*)./u, "$1")
115
+ .replace(/^((?:\x1b\[[0-?]*[ -/]*[@-~])*)./u, "$1 ")
99
116
  .replace(/.(?=(?:\x1b\[[0-?]*[ -/]*[@-~])*$)/u, "╯");
100
117
  return [
101
118
  topBorder,