@janvitos/pi-plan-build 0.1.14 → 0.1.15
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 +1 -1
- package/index.ts +17 -0
- package/package.json +1 -1
- package/utils.ts +17 -0
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 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; 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
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
|
}
|