lsd-pi 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/README.md +2 -1
- package/dist/headless-ui.js +2 -0
- package/dist/onboarding.js +11 -8
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +14 -0
- package/dist/resources/extensions/async-jobs/await-tool.js +14 -0
- package/dist/resources/extensions/async-jobs/cancel-job-tool.js +7 -0
- package/dist/resources/extensions/cache-timer/index.js +5 -0
- package/dist/resources/extensions/codex-rotate/IMPLEMENTATION.md +18 -13
- package/dist/resources/extensions/codex-rotate/README.md +9 -3
- package/dist/resources/extensions/codex-rotate/commands.js +15 -8
- package/dist/resources/extensions/codex-rotate/index.js +17 -8
- package/dist/resources/extensions/memory/auto-extract.js +196 -80
- package/dist/resources/extensions/memory/dream.js +86 -19
- package/dist/resources/extensions/shared/rtk.js +89 -87
- package/dist/resources/extensions/subagent/index.js +33 -7
- package/dist/startup-model-validation.js +12 -2
- package/dist/update-check.js +2 -2
- package/dist/update-cmd.js +3 -3
- package/dist/welcome-screen.js +43 -14
- package/package.json +3 -2
- package/packages/pi-coding-agent/dist/core/agent-session.clear-queue.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session.clear-queue.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.clear-queue.test.js +46 -0
- package/packages/pi-coding-agent/dist/core/agent-session.clear-queue.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +8 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +43 -4
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +3 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/keybindings.js +2 -0
- package/packages/pi-coding-agent/dist/core/keybindings.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/pty-executor.d.ts +48 -0
- package/packages/pi-coding-agent/dist/core/pty-executor.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/pty-executor.js +173 -0
- package/packages/pi-coding-agent/dist/core/pty-executor.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +16 -3
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +18 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tool-approval.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tool-approval.js +2 -2
- package/packages/pi-coding-agent/dist/core/tool-approval.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/tools/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/index.js +23 -2
- package/packages/pi-coding-agent/dist/core/tools/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/pty.d.ts +50 -0
- package/packages/pi-coding-agent/dist/core/tools/pty.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/tools/pty.js +289 -0
- package/packages/pi-coding-agent/dist/core/tools/pty.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +3 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +36 -22
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts +3 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js +23 -62
- package/packages/pi-coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js +1 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js +1 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/embedded-terminal.d.ts +39 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/embedded-terminal.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/embedded-terminal.js +182 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/embedded-terminal.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts +6 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js +36 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js +2 -4
- package/packages/pi-coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts +1 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +106 -77
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts +2 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js +4 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +11 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +49 -13
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.js +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/extension-ui-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +3 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +27 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +251 -39
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +2 -2
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/terminal-screen.d.ts +10 -0
- package/packages/pi-coding-agent/dist/utils/terminal-screen.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/terminal-screen.js +67 -0
- package/packages/pi-coding-agent/dist/utils/terminal-screen.js.map +1 -0
- package/packages/pi-coding-agent/dist/utils/terminal-serializer.d.ts +7 -0
- package/packages/pi-coding-agent/dist/utils/terminal-serializer.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/utils/terminal-serializer.js +67 -0
- package/packages/pi-coding-agent/dist/utils/terminal-serializer.js.map +1 -0
- package/packages/pi-coding-agent/package.json +9 -4
- package/packages/pi-coding-agent/src/core/agent-session.clear-queue.test.ts +50 -0
- package/packages/pi-coding-agent/src/core/agent-session.ts +50 -4
- package/packages/pi-coding-agent/src/core/extensions/types.ts +1 -1
- package/packages/pi-coding-agent/src/core/keybindings.ts +4 -1
- package/packages/pi-coding-agent/src/core/pty-executor.ts +229 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +16 -3
- package/packages/pi-coding-agent/src/core/settings-manager.ts +27 -0
- package/packages/pi-coding-agent/src/core/tool-approval.ts +2 -2
- package/packages/pi-coding-agent/src/core/tools/index.ts +35 -2
- package/packages/pi-coding-agent/src/core/tools/pty.ts +354 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +37 -24
- package/packages/pi-coding-agent/src/modes/interactive/components/bash-execution.ts +22 -70
- package/packages/pi-coding-agent/src/modes/interactive/components/branch-summary-message.ts +1 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/compaction-summary-message.ts +1 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/embedded-terminal.ts +224 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/settings-selector.ts +45 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts +2 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +104 -81
- package/packages/pi-coding-agent/src/modes/interactive/components/user-message.ts +5 -19
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +55 -13
- package/packages/pi-coding-agent/src/modes/interactive/controllers/extension-ui-controller.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +2 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +3 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +296 -48
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +2 -2
- package/packages/pi-coding-agent/src/utils/terminal-screen.ts +77 -0
- package/packages/pi-coding-agent/src/utils/terminal-serializer.ts +72 -0
- package/packages/pi-tui/dist/components/__tests__/editor-dropped-image.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/editor-dropped-image.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/editor-dropped-image.test.js +105 -0
- package/packages/pi-tui/dist/components/__tests__/editor-dropped-image.test.js.map +1 -0
- package/packages/pi-tui/dist/components/editor.d.ts +4 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +57 -3
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/loader.d.ts +26 -6
- package/packages/pi-tui/dist/components/loader.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/loader.js +178 -18
- package/packages/pi-tui/dist/components/loader.js.map +1 -1
- package/packages/pi-tui/src/components/editor.ts +65 -3
- package/packages/pi-tui/src/components/loader.ts +196 -19
- package/pkg/dist/modes/interactive/theme/themes.js +2 -2
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/async-jobs/async-bash-tool.ts +13 -0
- package/src/resources/extensions/async-jobs/await-tool.ts +13 -0
- package/src/resources/extensions/async-jobs/cancel-job-tool.ts +8 -0
- package/src/resources/extensions/cache-timer/index.ts +102 -96
- package/src/resources/extensions/codex-rotate/IMPLEMENTATION.md +18 -13
- package/src/resources/extensions/codex-rotate/README.md +9 -3
- package/src/resources/extensions/codex-rotate/commands.ts +335 -329
- package/src/resources/extensions/codex-rotate/index.ts +85 -75
- package/src/resources/extensions/memory/auto-extract.ts +330 -204
- package/src/resources/extensions/memory/dream.ts +88 -21
- package/src/resources/extensions/memory/tests/auto-extract.test.ts +200 -144
- package/src/resources/extensions/shared/rtk.js +112 -0
- package/src/resources/extensions/subagent/index.ts +35 -6
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded PTY terminal for user-triggered bash commands.
|
|
3
|
+
* Renders a framed terminal surface and forwards keystrokes to a PTY handle.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { decodeKittyPrintable, matchesKey, parseKey, type Focusable, type TUI } from "@gsd/pi-tui";
|
|
7
|
+
import { truncateToWidth, visibleWidth } from "@gsd/pi-tui";
|
|
8
|
+
import type { PtyExecutionHandle } from "../../../core/pty-executor.js";
|
|
9
|
+
import { createHeadlessTerminal, snapshotTerminalLines, type HeadlessTerminal } from "../../../utils/terminal-screen.js";
|
|
10
|
+
import { theme } from "../theme/theme.js";
|
|
11
|
+
|
|
12
|
+
type ToolOutputMode = "minimal" | "normal";
|
|
13
|
+
|
|
14
|
+
export class EmbeddedTerminalComponent implements Focusable {
|
|
15
|
+
public focused = false;
|
|
16
|
+
|
|
17
|
+
private command: string;
|
|
18
|
+
private status: "running" | "complete" | "cancelled" | "error" = "running";
|
|
19
|
+
private exitCode: number | undefined;
|
|
20
|
+
private focusKeyLabel: string;
|
|
21
|
+
private renderedLines: string[] = [];
|
|
22
|
+
private rawOutput = "";
|
|
23
|
+
private terminal: HeadlessTerminal;
|
|
24
|
+
private terminalWriteChain: Promise<void> = Promise.resolve();
|
|
25
|
+
private handle?: PtyExecutionHandle;
|
|
26
|
+
private releaseFocus?: () => void;
|
|
27
|
+
private statusOverride?: string;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
command: string,
|
|
31
|
+
_ui: TUI,
|
|
32
|
+
_renderMode: ToolOutputMode,
|
|
33
|
+
focusKeyLabel: string,
|
|
34
|
+
_excludeFromContext = false,
|
|
35
|
+
) {
|
|
36
|
+
this.command = command;
|
|
37
|
+
this.focusKeyLabel = focusKeyLabel;
|
|
38
|
+
this.terminal = createHeadlessTerminal();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setHandle(handle: PtyExecutionHandle, releaseFocus: () => void): void {
|
|
42
|
+
this.handle = handle;
|
|
43
|
+
this.releaseFocus = releaseFocus;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setScreenText(text: string): void {
|
|
47
|
+
this.rawOutput = text;
|
|
48
|
+
this.renderedLines = text ? text.split("\n") : [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
setStatusOverride(text: string | undefined): void {
|
|
52
|
+
this.statusOverride = text;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
resize(cols: number, rows: number): void {
|
|
56
|
+
const safeCols = Math.max(20, cols);
|
|
57
|
+
const safeRows = Math.max(5, rows);
|
|
58
|
+
this.handle?.resize(safeCols, safeRows);
|
|
59
|
+
this.terminal.resize(safeCols, safeRows);
|
|
60
|
+
this.renderedLines = snapshotTerminalLines(this.terminal);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
setExpanded(_expanded: boolean): void {
|
|
64
|
+
// Interactive terminals are always rendered expanded for now.
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setRenderMode(_mode: ToolOutputMode): void {
|
|
68
|
+
// Interactive terminals are always rendered expanded for now.
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
appendOutput(chunk: string): void {
|
|
72
|
+
this.rawOutput += chunk;
|
|
73
|
+
this.terminalWriteChain = this.terminalWriteChain.then(
|
|
74
|
+
() =>
|
|
75
|
+
new Promise<void>((resolve) => {
|
|
76
|
+
this.terminal.write(chunk, () => {
|
|
77
|
+
this.renderedLines = snapshotTerminalLines(this.terminal);
|
|
78
|
+
resolve();
|
|
79
|
+
});
|
|
80
|
+
}),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
setComplete(exitCode: number | undefined, cancelled: boolean): void {
|
|
85
|
+
this.exitCode = exitCode;
|
|
86
|
+
this.status = cancelled
|
|
87
|
+
? "cancelled"
|
|
88
|
+
: exitCode !== undefined && exitCode !== 0
|
|
89
|
+
? "error"
|
|
90
|
+
: "complete";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
getOutput(): string {
|
|
94
|
+
return this.rawOutput;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
handleInput(data: string): void {
|
|
98
|
+
if (matchesKey(data, "escape") || matchesKey(data, "tab")) {
|
|
99
|
+
this.releaseFocus?.();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const kittyPrintable = decodeKittyPrintable(data);
|
|
104
|
+
if (kittyPrintable !== undefined) {
|
|
105
|
+
this.handle?.write(kittyPrintable);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const key = parseKey(data);
|
|
110
|
+
switch (key) {
|
|
111
|
+
case "enter":
|
|
112
|
+
case "shift+enter":
|
|
113
|
+
this.handle?.write("\r");
|
|
114
|
+
return;
|
|
115
|
+
case "shift+tab":
|
|
116
|
+
case "tab":
|
|
117
|
+
this.handle?.write("\t");
|
|
118
|
+
return;
|
|
119
|
+
case "backspace":
|
|
120
|
+
case "shift+backspace":
|
|
121
|
+
this.handle?.write("\x7f");
|
|
122
|
+
return;
|
|
123
|
+
case "up":
|
|
124
|
+
this.handle?.write("\x1b[A");
|
|
125
|
+
return;
|
|
126
|
+
case "down":
|
|
127
|
+
this.handle?.write("\x1b[B");
|
|
128
|
+
return;
|
|
129
|
+
case "right":
|
|
130
|
+
this.handle?.write("\x1b[C");
|
|
131
|
+
return;
|
|
132
|
+
case "left":
|
|
133
|
+
this.handle?.write("\x1b[D");
|
|
134
|
+
return;
|
|
135
|
+
case "ctrl+c":
|
|
136
|
+
this.handle?.write("\x03");
|
|
137
|
+
return;
|
|
138
|
+
case "ctrl+d":
|
|
139
|
+
this.handle?.write("\x04");
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (data.length === 1 && data >= " " && data !== "\x7f") {
|
|
144
|
+
this.handle?.write(data);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
invalidate(): void {
|
|
149
|
+
// No-op; render reads directly from current state.
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
render(width: number): string[] {
|
|
153
|
+
const innerWidth = Math.max(10, width - 2);
|
|
154
|
+
const frameColor = this.status === "error"
|
|
155
|
+
? "error"
|
|
156
|
+
: this.focused
|
|
157
|
+
? "success"
|
|
158
|
+
: "success";
|
|
159
|
+
const border = (text: string) => theme.fg(frameColor, text);
|
|
160
|
+
|
|
161
|
+
const lines: string[] = [];
|
|
162
|
+
lines.push(border(`╭${"─".repeat(innerWidth)}╮`));
|
|
163
|
+
|
|
164
|
+
for (const line of this.buildBodyLines(innerWidth)) {
|
|
165
|
+
const content = truncateToWidth(line, innerWidth, "", true);
|
|
166
|
+
lines.push(`${border("│")}${content}${border("│")}`);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
lines.push(border(`╰${"─".repeat(innerWidth)}╯`));
|
|
170
|
+
return lines;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private buildBodyLines(innerWidth: number): string[] {
|
|
174
|
+
const body: string[] = [];
|
|
175
|
+
body.push(this.buildHeaderText(innerWidth));
|
|
176
|
+
body.push("");
|
|
177
|
+
|
|
178
|
+
if (this.renderedLines.length > 0) {
|
|
179
|
+
body.push(...this.renderedLines);
|
|
180
|
+
} else if (this.status === "running") {
|
|
181
|
+
body.push(theme.fg("dim", "Terminal waiting for output…"));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
body.push("");
|
|
185
|
+
body.push(this.buildStatusText(innerWidth));
|
|
186
|
+
return body;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private buildHeaderText(innerWidth: number): string {
|
|
190
|
+
const prefix = this.focused
|
|
191
|
+
? theme.fg("success", theme.bold(" TERMINAL "))
|
|
192
|
+
: theme.fg("success", " terminal ");
|
|
193
|
+
const command = theme.bold(`$ ${this.command}`);
|
|
194
|
+
const hint = this.focused
|
|
195
|
+
? theme.fg("muted", "Tab/Esc return · Shift+Tab sends Tab")
|
|
196
|
+
: theme.fg("muted", `${this.focusKeyLabel} focus`);
|
|
197
|
+
|
|
198
|
+
const left = `${prefix} ${command}`;
|
|
199
|
+
const leftWidth = visibleWidth(left);
|
|
200
|
+
const hintWidth = visibleWidth(hint);
|
|
201
|
+
if (leftWidth + 2 + hintWidth <= innerWidth) {
|
|
202
|
+
return left + " ".repeat(innerWidth - leftWidth - hintWidth) + hint;
|
|
203
|
+
}
|
|
204
|
+
return truncateToWidth(`${left} ${hint}`, innerWidth, "...");
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private buildStatusText(innerWidth: number): string {
|
|
208
|
+
let statusText: string;
|
|
209
|
+
if (this.status === "running") {
|
|
210
|
+
statusText = this.statusOverride
|
|
211
|
+
? this.statusOverride
|
|
212
|
+
: this.focused
|
|
213
|
+
? theme.fg("success", theme.bold("INPUT CAPTURED")) + theme.fg("muted", " — typing goes to the terminal")
|
|
214
|
+
: theme.fg("muted", `Press ${this.focusKeyLabel} to focus this terminal`);
|
|
215
|
+
} else if (this.status === "cancelled") {
|
|
216
|
+
statusText = theme.fg("warning", "(cancelled)");
|
|
217
|
+
} else if (this.status === "error") {
|
|
218
|
+
statusText = theme.fg("error", `(exit ${this.exitCode})`);
|
|
219
|
+
} else {
|
|
220
|
+
statusText = theme.fg("success", "(done)");
|
|
221
|
+
}
|
|
222
|
+
return truncateToWidth(statusText, innerWidth, "...");
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -35,6 +35,7 @@ export interface SettingsConfig {
|
|
|
35
35
|
enableSkillCommands: boolean;
|
|
36
36
|
codexRotate: boolean;
|
|
37
37
|
cacheTimer: boolean;
|
|
38
|
+
pinLastPrompt: boolean;
|
|
38
39
|
steeringMode: "all" | "one-at-a-time";
|
|
39
40
|
followUpMode: "all" | "one-at-a-time";
|
|
40
41
|
transport: Transport;
|
|
@@ -58,6 +59,8 @@ export interface SettingsConfig {
|
|
|
58
59
|
toolOutputMode: "minimal" | "normal";
|
|
59
60
|
rtk: boolean;
|
|
60
61
|
editorScheme: "auto" | "vscode" | "cursor" | "zed" | "jetbrains" | "sublime" | "file";
|
|
62
|
+
autoDream: boolean;
|
|
63
|
+
autoMemory: boolean;
|
|
61
64
|
sandboxEnabled?: boolean;
|
|
62
65
|
sandboxNetworkMode?: "allow" | "ask" | "deny";
|
|
63
66
|
classifierModelSubmenu?: (currentValue: string, done: (selectedValue?: string) => void) => Component;
|
|
@@ -71,6 +74,8 @@ export interface SettingsCallbacks {
|
|
|
71
74
|
onClassifierModelChange: (modelRef: string) => void;
|
|
72
75
|
onBudgetSubagentModelChange: (modelRef: string) => void;
|
|
73
76
|
onPlanModeReasoningModelChange: (modelRef: string) => void;
|
|
77
|
+
onAutoDreamChange: (enabled: boolean) => void;
|
|
78
|
+
onAutoMemoryChange: (enabled: boolean) => void;
|
|
74
79
|
onSandboxEnabledChange?: (enabled: boolean) => void;
|
|
75
80
|
onSandboxNetworkModeChange?: (mode: "allow" | "ask" | "deny") => void;
|
|
76
81
|
onShowImagesChange: (enabled: boolean) => void;
|
|
@@ -79,6 +84,7 @@ export interface SettingsCallbacks {
|
|
|
79
84
|
onEnableSkillCommandsChange: (enabled: boolean) => void;
|
|
80
85
|
onCodexRotateChange: (enabled: boolean) => void;
|
|
81
86
|
onCacheTimerChange: (enabled: boolean) => void;
|
|
87
|
+
onPinLastPromptChange: (enabled: boolean) => void;
|
|
82
88
|
onSteeringModeChange: (mode: "all" | "one-at-a-time") => void;
|
|
83
89
|
onFollowUpModeChange: (mode: "all" | "one-at-a-time") => void;
|
|
84
90
|
onTransportChange: (transport: Transport) => void;
|
|
@@ -427,6 +433,36 @@ export class SettingsSelectorComponent extends Container {
|
|
|
427
433
|
values: ["true", "false"],
|
|
428
434
|
});
|
|
429
435
|
|
|
436
|
+
// Pin last prompt toggle (insert after cache-timer)
|
|
437
|
+
const cacheTimerIdx = items.findIndex((item) => item.id === "cache-timer");
|
|
438
|
+
items.splice(cacheTimerIdx + 1, 0, {
|
|
439
|
+
id: "pin-last-prompt",
|
|
440
|
+
label: "Pin last prompt",
|
|
441
|
+
description: "Show your last sent message above the editor so you remember the topic",
|
|
442
|
+
currentValue: config.pinLastPrompt ? "true" : "false",
|
|
443
|
+
values: ["true", "false"],
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
// Auto-dream toggle (insert after pin-last-prompt)
|
|
447
|
+
const pinLastPromptIdx = items.findIndex((item) => item.id === "pin-last-prompt");
|
|
448
|
+
items.splice(pinLastPromptIdx + 1, 0, {
|
|
449
|
+
id: "auto-dream",
|
|
450
|
+
label: "Auto dream",
|
|
451
|
+
description: "Automatically consolidate and refine memory after sessions",
|
|
452
|
+
currentValue: config.autoDream ? "true" : "false",
|
|
453
|
+
values: ["true", "false"],
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// Auto-memory toggle (insert after auto-dream)
|
|
457
|
+
const autoDreamIdx = items.findIndex((item) => item.id === "auto-dream");
|
|
458
|
+
items.splice(autoDreamIdx + 1, 0, {
|
|
459
|
+
id: "auto-memory",
|
|
460
|
+
label: "Auto memory",
|
|
461
|
+
description: "Automatically extract and save memories from session transcripts",
|
|
462
|
+
currentValue: config.autoMemory ? "true" : "false",
|
|
463
|
+
values: ["true", "false"],
|
|
464
|
+
});
|
|
465
|
+
|
|
430
466
|
// RTK toggle (insert after cache-timer)
|
|
431
467
|
const cacheTimerIndex = items.findIndex((item) => item.id === "cache-timer");
|
|
432
468
|
items.splice(cacheTimerIndex + 1, 0, {
|
|
@@ -549,6 +585,15 @@ export class SettingsSelectorComponent extends Container {
|
|
|
549
585
|
case "cache-timer":
|
|
550
586
|
callbacks.onCacheTimerChange(newValue === "true");
|
|
551
587
|
break;
|
|
588
|
+
case "pin-last-prompt":
|
|
589
|
+
callbacks.onPinLastPromptChange(newValue === "true");
|
|
590
|
+
break;
|
|
591
|
+
case "auto-dream":
|
|
592
|
+
callbacks.onAutoDreamChange(newValue === "true");
|
|
593
|
+
break;
|
|
594
|
+
case "auto-memory":
|
|
595
|
+
callbacks.onAutoMemoryChange(newValue === "true");
|
|
596
|
+
break;
|
|
552
597
|
case "rtk":
|
|
553
598
|
callbacks.onRtkChange(newValue === "true");
|
|
554
599
|
break;
|
package/packages/pi-coding-agent/src/modes/interactive/components/skill-invocation-message.ts
CHANGED
|
@@ -44,11 +44,10 @@ export class SkillInvocationMessageComponent extends Box {
|
|
|
44
44
|
}),
|
|
45
45
|
);
|
|
46
46
|
} else {
|
|
47
|
-
// Collapsed: single line - [skill] name
|
|
47
|
+
// Collapsed: single line - [skill] name
|
|
48
48
|
const line =
|
|
49
49
|
theme.fg("customMessageLabel", `\x1b[1m[skill]\x1b[22m `) +
|
|
50
|
-
theme.fg("customMessageText", this.skillBlock.name)
|
|
51
|
-
theme.fg("dim", ` (${editorKey("expandTools")} to expand)`);
|
|
50
|
+
theme.fg("customMessageText", this.skillBlock.name);
|
|
52
51
|
this.addChild(new Text(line, 0, 0));
|
|
53
52
|
}
|
|
54
53
|
}
|