@oh-my-pi/pi-coding-agent 11.8.2 → 11.9.0
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/CHANGELOG.md +42 -0
- package/docs/tui.md +9 -9
- package/package.json +7 -7
- package/src/capability/mcp.ts +9 -0
- package/src/cli/file-processor.ts +8 -13
- package/src/cli/oclif-help.ts +1 -1
- package/src/cli.ts +14 -0
- package/src/commit/git/index.ts +16 -16
- package/src/config/file-lock.ts +1 -1
- package/src/config/keybindings.ts +11 -11
- package/src/config/model-registry.ts +31 -66
- package/src/config/settings.ts +88 -95
- package/src/config.ts +2 -2
- package/src/cursor.ts +4 -4
- package/src/debug/index.ts +28 -28
- package/src/discovery/builtin.ts +48 -0
- package/src/discovery/codex.ts +5 -13
- package/src/discovery/cursor.ts +2 -7
- package/src/discovery/mcp-json.ts +33 -0
- package/src/exa/mcp-client.ts +2 -2
- package/src/exa/websets.ts +2 -2
- package/src/export/html/index.ts +3 -3
- package/src/export/ttsr.ts +27 -27
- package/src/extensibility/custom-tools/loader.ts +9 -9
- package/src/extensibility/extensions/runner.ts +64 -64
- package/src/extensibility/hooks/runner.ts +46 -46
- package/src/extensibility/plugins/manager.ts +49 -49
- package/src/extensibility/slash-commands.ts +1 -0
- package/src/index.ts +0 -3
- package/src/internal-urls/router.ts +5 -5
- package/src/ipy/kernel.ts +61 -57
- package/src/lsp/client.ts +1 -1
- package/src/lsp/clients/biome-client.ts +2 -2
- package/src/lsp/clients/lsp-linter-client.ts +7 -7
- package/src/lsp/index.ts +9 -9
- package/src/mcp/config-writer.ts +194 -0
- package/src/mcp/config.ts +20 -6
- package/src/mcp/index.ts +4 -0
- package/src/mcp/loader.ts +6 -0
- package/src/mcp/manager.ts +139 -50
- package/src/mcp/oauth-discovery.ts +274 -0
- package/src/mcp/oauth-flow.ts +229 -0
- package/src/mcp/tool-bridge.ts +20 -20
- package/src/mcp/transports/http.ts +107 -66
- package/src/mcp/transports/stdio.ts +74 -59
- package/src/mcp/types.ts +15 -1
- package/src/modes/components/assistant-message.ts +25 -25
- package/src/modes/components/bash-execution.ts +51 -51
- package/src/modes/components/bordered-loader.ts +7 -7
- package/src/modes/components/branch-summary-message.ts +7 -7
- package/src/modes/components/compaction-summary-message.ts +7 -7
- package/src/modes/components/countdown-timer.ts +15 -15
- package/src/modes/components/custom-editor.ts +22 -22
- package/src/modes/components/custom-message.ts +21 -21
- package/src/modes/components/dynamic-border.ts +3 -3
- package/src/modes/components/extensions/extension-dashboard.ts +72 -72
- package/src/modes/components/extensions/extension-list.ts +99 -97
- package/src/modes/components/extensions/inspector-panel.ts +26 -26
- package/src/modes/components/footer.ts +36 -36
- package/src/modes/components/history-search.ts +52 -52
- package/src/modes/components/hook-editor.ts +20 -20
- package/src/modes/components/hook-input.ts +20 -20
- package/src/modes/components/hook-message.ts +22 -22
- package/src/modes/components/hook-selector.ts +52 -52
- package/src/modes/components/index.ts +0 -1
- package/src/modes/components/login-dialog.ts +57 -57
- package/src/modes/components/mcp-add-wizard.ts +1286 -0
- package/src/modes/components/model-selector.ts +173 -173
- package/src/modes/components/oauth-selector.ts +45 -45
- package/src/modes/components/plugin-settings.ts +52 -52
- package/src/modes/components/python-execution.ts +53 -53
- package/src/modes/components/queue-mode-selector.ts +7 -7
- package/src/modes/components/read-tool-group.ts +23 -23
- package/src/modes/components/session-selector.ts +40 -37
- package/src/modes/components/settings-selector.ts +80 -80
- package/src/modes/components/show-images-selector.ts +7 -7
- package/src/modes/components/skill-message.ts +27 -27
- package/src/modes/components/status-line-segment-editor.ts +81 -81
- package/src/modes/components/status-line.ts +73 -73
- package/src/modes/components/theme-selector.ts +11 -11
- package/src/modes/components/thinking-selector.ts +7 -7
- package/src/modes/components/todo-display.ts +19 -19
- package/src/modes/components/todo-reminder.ts +9 -9
- package/src/modes/components/tool-execution.ts +212 -216
- package/src/modes/components/tree-selector.ts +144 -144
- package/src/modes/components/ttsr-notification.ts +17 -17
- package/src/modes/components/user-message-selector.ts +18 -18
- package/src/modes/components/welcome.ts +10 -10
- package/src/modes/controllers/command-controller.ts +0 -7
- package/src/modes/controllers/event-controller.ts +23 -23
- package/src/modes/controllers/extension-ui-controller.ts +13 -13
- package/src/modes/controllers/input-controller.ts +12 -9
- package/src/modes/controllers/mcp-command-controller.ts +1223 -0
- package/src/modes/interactive-mode.ts +240 -241
- package/src/modes/rpc/rpc-client.ts +77 -77
- package/src/modes/rpc/rpc-mode.ts +5 -5
- package/src/modes/theme/theme.ts +113 -113
- package/src/modes/types.ts +1 -1
- package/src/patch/index.ts +45 -45
- package/src/prompts/tools/task.md +22 -2
- package/src/sdk.ts +1 -0
- package/src/session/agent-session.ts +512 -476
- package/src/session/agent-storage.ts +72 -75
- package/src/session/auth-storage.ts +186 -252
- package/src/session/history-storage.ts +36 -38
- package/src/session/session-manager.ts +300 -299
- package/src/session/session-storage.ts +65 -90
- package/src/ssh/connection-manager.ts +9 -9
- package/src/system-prompt.ts +2 -3
- package/src/task/agents.ts +1 -1
- package/src/task/executor.ts +28 -40
- package/src/task/index.ts +13 -12
- package/src/task/subprocess-tool-registry.ts +5 -5
- package/src/task/worktree.ts +8 -5
- package/src/tools/ask.ts +7 -7
- package/src/tools/bash.ts +15 -10
- package/src/tools/browser.ts +130 -127
- package/src/tools/calculator.ts +46 -46
- package/src/tools/context.ts +9 -9
- package/src/tools/exit-plan-mode.ts +5 -5
- package/src/tools/fetch.ts +5 -5
- package/src/tools/find.ts +16 -16
- package/src/tools/grep.ts +12 -24
- package/src/tools/index.ts +1 -1
- package/src/tools/notebook.ts +6 -6
- package/src/tools/output-meta.ts +10 -2
- package/src/tools/python.ts +12 -11
- package/src/tools/read.ts +17 -17
- package/src/tools/ssh.ts +9 -9
- package/src/tools/submit-result.ts +13 -13
- package/src/tools/todo-write.ts +6 -6
- package/src/tools/write.ts +10 -10
- package/src/tui/output-block.ts +6 -6
- package/src/tui/utils.ts +9 -9
- package/src/utils/event-bus.ts +13 -11
- package/src/utils/frontmatter.ts +1 -1
- package/src/utils/ignore-files.ts +1 -1
- package/src/web/search/index.ts +5 -5
- package/src/web/search/providers/anthropic.ts +7 -2
- package/examples/hooks/snake.ts +0 -342
- package/src/modes/components/armin.ts +0 -379
|
@@ -7,8 +7,8 @@ import { DynamicBorder } from "./dynamic-border";
|
|
|
7
7
|
* Themes must be pre-loaded and passed to the constructor.
|
|
8
8
|
*/
|
|
9
9
|
export class ThemeSelectorComponent extends Container {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
#selectList: SelectList;
|
|
11
|
+
#onPreview: (themeName: string) => void;
|
|
12
12
|
|
|
13
13
|
constructor(
|
|
14
14
|
currentTheme: string,
|
|
@@ -18,7 +18,7 @@ export class ThemeSelectorComponent extends Container {
|
|
|
18
18
|
onPreview: (themeName: string) => void,
|
|
19
19
|
) {
|
|
20
20
|
super();
|
|
21
|
-
this
|
|
21
|
+
this.#onPreview = onPreview;
|
|
22
22
|
|
|
23
23
|
// Create select items from provided themes
|
|
24
24
|
const themeItems: SelectItem[] = themes.map(name => ({
|
|
@@ -31,33 +31,33 @@ export class ThemeSelectorComponent extends Container {
|
|
|
31
31
|
this.addChild(new DynamicBorder());
|
|
32
32
|
|
|
33
33
|
// Create selector
|
|
34
|
-
this
|
|
34
|
+
this.#selectList = new SelectList(themeItems, 10, getSelectListTheme());
|
|
35
35
|
|
|
36
36
|
// Preselect current theme
|
|
37
37
|
const currentIndex = themes.indexOf(currentTheme);
|
|
38
38
|
if (currentIndex !== -1) {
|
|
39
|
-
this
|
|
39
|
+
this.#selectList.setSelectedIndex(currentIndex);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
this
|
|
42
|
+
this.#selectList.onSelect = item => {
|
|
43
43
|
onSelect(item.value);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
this
|
|
46
|
+
this.#selectList.onCancel = () => {
|
|
47
47
|
onCancel();
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
this
|
|
51
|
-
this
|
|
50
|
+
this.#selectList.onSelectionChange = item => {
|
|
51
|
+
this.#onPreview(item.value);
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
this.addChild(this
|
|
54
|
+
this.addChild(this.#selectList);
|
|
55
55
|
|
|
56
56
|
// Add bottom border
|
|
57
57
|
this.addChild(new DynamicBorder());
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
getSelectList(): SelectList {
|
|
61
|
-
return this
|
|
61
|
+
return this.#selectList;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -16,7 +16,7 @@ const LEVEL_DESCRIPTIONS: Record<ThinkingLevel, string> = {
|
|
|
16
16
|
* Component that renders a thinking level selector with borders
|
|
17
17
|
*/
|
|
18
18
|
export class ThinkingSelectorComponent extends Container {
|
|
19
|
-
|
|
19
|
+
#selectList: SelectList;
|
|
20
20
|
|
|
21
21
|
constructor(
|
|
22
22
|
currentLevel: ThinkingLevel,
|
|
@@ -36,29 +36,29 @@ export class ThinkingSelectorComponent extends Container {
|
|
|
36
36
|
this.addChild(new DynamicBorder());
|
|
37
37
|
|
|
38
38
|
// Create selector
|
|
39
|
-
this
|
|
39
|
+
this.#selectList = new SelectList(thinkingLevels, thinkingLevels.length, getSelectListTheme());
|
|
40
40
|
|
|
41
41
|
// Preselect current level
|
|
42
42
|
const currentIndex = thinkingLevels.findIndex(item => item.value === currentLevel);
|
|
43
43
|
if (currentIndex !== -1) {
|
|
44
|
-
this
|
|
44
|
+
this.#selectList.setSelectedIndex(currentIndex);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
this
|
|
47
|
+
this.#selectList.onSelect = item => {
|
|
48
48
|
onSelect(item.value as ThinkingLevel);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
this
|
|
51
|
+
this.#selectList.onCancel = () => {
|
|
52
52
|
onCancel();
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
this.addChild(this
|
|
55
|
+
this.addChild(this.#selectList);
|
|
56
56
|
|
|
57
57
|
// Add bottom border
|
|
58
58
|
this.addChild(new DynamicBorder());
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
getSelectList(): SelectList {
|
|
62
|
-
return this
|
|
62
|
+
return this.#selectList;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -27,17 +27,17 @@ async function loadTodoFile(filePath: string): Promise<TodoFile | null> {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export class TodoDisplayComponent {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
todos: TodoItem[] = [];
|
|
31
|
+
#expanded = false;
|
|
32
|
+
#visible = false;
|
|
33
|
+
#cached: RenderCache | undefined;
|
|
34
34
|
|
|
35
35
|
constructor(private readonly sessionFile: string | null) {}
|
|
36
36
|
|
|
37
37
|
async loadTodos(): Promise<void> {
|
|
38
38
|
if (!this.sessionFile) {
|
|
39
39
|
this.todos = [];
|
|
40
|
-
this
|
|
40
|
+
this.#visible = false;
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -45,36 +45,36 @@ export class TodoDisplayComponent {
|
|
|
45
45
|
const todoPath = path.join(artifactsDir, TODO_FILE_NAME);
|
|
46
46
|
const data = await loadTodoFile(todoPath);
|
|
47
47
|
this.todos = data?.todos ?? [];
|
|
48
|
-
this
|
|
49
|
-
this
|
|
48
|
+
this.#visible = this.todos.length > 0;
|
|
49
|
+
this.#cached = undefined;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
setTodos(todos: TodoItem[]): void {
|
|
53
53
|
this.todos = todos;
|
|
54
|
-
this
|
|
55
|
-
this
|
|
54
|
+
this.#visible = this.todos.length > 0;
|
|
55
|
+
this.#cached = undefined;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
setExpanded(expanded: boolean): void {
|
|
59
|
-
this
|
|
60
|
-
this
|
|
59
|
+
this.#expanded = expanded;
|
|
60
|
+
this.#cached = undefined;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
isVisible(): boolean {
|
|
64
|
-
return this
|
|
64
|
+
return this.#visible;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
render(width: number): string[] {
|
|
68
|
-
if (!this
|
|
68
|
+
if (!this.#visible || this.todos.length === 0) {
|
|
69
69
|
return [];
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
const key = new Hasher().bool(this
|
|
73
|
-
if (this
|
|
72
|
+
const key = new Hasher().bool(this.#expanded).u32(width).digest();
|
|
73
|
+
if (this.#cached?.key === key) return this.#cached.lines;
|
|
74
74
|
|
|
75
75
|
const lines: string[] = [];
|
|
76
|
-
const maxItems = this
|
|
77
|
-
const hasMore = !this
|
|
76
|
+
const maxItems = this.#expanded ? this.todos.length : Math.min(5, this.todos.length);
|
|
77
|
+
const hasMore = !this.#expanded && this.todos.length > 5;
|
|
78
78
|
|
|
79
79
|
for (let i = 0; i < maxItems; i++) {
|
|
80
80
|
const todo = this.todos[i];
|
|
@@ -102,12 +102,12 @@ export class TodoDisplayComponent {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
const result = lines.map(l => truncateToWidth(l, width, Ellipsis.Omit));
|
|
105
|
-
this
|
|
105
|
+
this.#cached = { key, lines: result };
|
|
106
106
|
return result;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
getRenderedComponent(): Text | null {
|
|
110
|
-
if (!this
|
|
110
|
+
if (!this.#visible) return null;
|
|
111
111
|
const lines = this.render(80);
|
|
112
112
|
return new Text(lines.join("\n"), 0, 0);
|
|
113
113
|
}
|
|
@@ -7,7 +7,7 @@ import type { TodoItem } from "../../tools/todo-write";
|
|
|
7
7
|
* Shows when the agent stops with incomplete todos.
|
|
8
8
|
*/
|
|
9
9
|
export class TodoReminderComponent extends Container {
|
|
10
|
-
|
|
10
|
+
#box: Box;
|
|
11
11
|
|
|
12
12
|
constructor(
|
|
13
13
|
private readonly todos: TodoItem[],
|
|
@@ -18,23 +18,23 @@ export class TodoReminderComponent extends Container {
|
|
|
18
18
|
|
|
19
19
|
this.addChild(new Spacer(1));
|
|
20
20
|
|
|
21
|
-
this
|
|
22
|
-
this.addChild(this
|
|
21
|
+
this.#box = new Box(1, 1, t => theme.inverse(theme.fg("warning", t)));
|
|
22
|
+
this.addChild(this.#box);
|
|
23
23
|
|
|
24
|
-
this
|
|
24
|
+
this.#rebuild();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
this
|
|
27
|
+
#rebuild(): void {
|
|
28
|
+
this.#box.clear();
|
|
29
29
|
|
|
30
30
|
const count = this.todos.length;
|
|
31
31
|
const label = count === 1 ? "todo" : "todos";
|
|
32
32
|
const header = `${theme.icon.warning} ${count} incomplete ${label} - reminder ${this.attempt}/${this.maxAttempts}`;
|
|
33
33
|
|
|
34
|
-
this
|
|
35
|
-
this
|
|
34
|
+
this.#box.addChild(new Text(header, 0, 0));
|
|
35
|
+
this.#box.addChild(new Spacer(1));
|
|
36
36
|
|
|
37
37
|
const todoList = this.todos.map(t => ` ${theme.checkbox.unchecked} ${t.content}`).join("\n");
|
|
38
|
-
this
|
|
38
|
+
this.#box.addChild(new Text(theme.italic(todoList), 0, 0));
|
|
39
39
|
}
|
|
40
40
|
}
|