@oh-my-pi/pi-coding-agent 14.8.0 → 14.8.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-coding-agent",
4
- "version": "14.8.0",
4
+ "version": "14.8.1",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -46,12 +46,12 @@
46
46
  "dependencies": {
47
47
  "@agentclientprotocol/sdk": "0.21.0",
48
48
  "@mozilla/readability": "^0.6.0",
49
- "@oh-my-pi/omp-stats": "14.8.0",
50
- "@oh-my-pi/pi-agent-core": "14.8.0",
51
- "@oh-my-pi/pi-ai": "14.8.0",
52
- "@oh-my-pi/pi-natives": "14.8.0",
53
- "@oh-my-pi/pi-tui": "14.8.0",
54
- "@oh-my-pi/pi-utils": "14.8.0",
49
+ "@oh-my-pi/omp-stats": "14.8.1",
50
+ "@oh-my-pi/pi-agent-core": "14.8.1",
51
+ "@oh-my-pi/pi-ai": "14.8.1",
52
+ "@oh-my-pi/pi-natives": "14.8.1",
53
+ "@oh-my-pi/pi-tui": "14.8.1",
54
+ "@oh-my-pi/pi-utils": "14.8.1",
55
55
  "@puppeteer/browsers": "^2.13.0",
56
56
  "@sinclair/typebox": "^0.34.49",
57
57
  "@types/turndown": "5.0.6",
@@ -22,7 +22,7 @@ import type {
22
22
  } from "@oh-my-pi/pi-ai";
23
23
  import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/utils/oauth/types";
24
24
  import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
25
- import type { AutocompleteItem, Component, EditorComponent, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
25
+ import type { AutocompleteItem, Component, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
26
26
  import type { Static, TSchema } from "@sinclair/typebox";
27
27
  import type { Rule } from "../../capability/rule";
28
28
  import type { KeybindingsManager } from "../../config/keybindings";
@@ -31,6 +31,7 @@ import type { EditToolDetails } from "../../edit";
31
31
  import type { PythonResult } from "../../eval/py/executor";
32
32
  import type { BashResult } from "../../exec/bash-executor";
33
33
  import type { ExecOptions, ExecResult } from "../../exec/exec";
34
+ import type { CustomEditor } from "../../modes/components/custom-editor";
34
35
  import type { Theme } from "../../modes/theme/theme";
35
36
  import type { CompactionPreparation, CompactionResult } from "../../session/compaction";
36
37
  import type { CustomMessage } from "../../session/messages";
@@ -170,9 +171,15 @@ export interface ExtensionUIContext {
170
171
  editorOptions?: { promptStyle?: boolean },
171
172
  ): Promise<string | undefined>;
172
173
 
173
- /** Set a custom editor component via factory function, or undefined to restore the default editor. */
174
+ /**
175
+ * Set a custom editor component via factory function, or `undefined` to restore the default editor.
176
+ *
177
+ * The factory must return a {@link CustomEditor} subclass. Plain `EditorComponent`/`Editor`
178
+ * instances do not implement the action-keys, escape callbacks, and custom-key-handler surface
179
+ * required by interactive mode.
180
+ */
174
181
  setEditorComponent(
175
- factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => EditorComponent) | undefined,
182
+ factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined,
176
183
  ): void;
177
184
 
178
185
  /** Get the current theme for styling. */
@@ -68,7 +68,7 @@ export class ExtensionUiController {
68
68
  },
69
69
  setFooter: () => {},
70
70
  setHeader: () => {},
71
- setEditorComponent: () => {},
71
+ setEditorComponent: factory => this.ctx.setEditorComponent(factory),
72
72
  getToolsExpanded: () => this.ctx.toolOutputExpanded,
73
73
  setToolsExpanded: expanded => this.ctx.setToolsExpanded(expanded),
74
74
  };
@@ -13,7 +13,7 @@ import {
13
13
  modelsAreEqual,
14
14
  type UsageReport,
15
15
  } from "@oh-my-pi/pi-ai";
16
- import type { Component, SlashCommand } from "@oh-my-pi/pi-tui";
16
+ import type { Component, EditorTheme, SlashCommand } from "@oh-my-pi/pi-tui";
17
17
  import {
18
18
  Container,
19
19
  clearRenderCache,
@@ -1317,11 +1317,50 @@ export class InteractiveMode implements InteractiveModeContext {
1317
1317
  initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void {
1318
1318
  this.#extensionUiController.initializeHookRunner(uiContext, hasUI);
1319
1319
  }
1320
-
1321
1320
  createBackgroundUiContext(): ExtensionUIContext {
1322
1321
  return this.#extensionUiController.createBackgroundUiContext();
1323
1322
  }
1324
1323
 
1324
+ setEditorComponent(
1325
+ factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined,
1326
+ ): void {
1327
+ const previousEditor = this.editor;
1328
+ const previousText = previousEditor.getText();
1329
+ const nextEditor = factory
1330
+ ? factory(this.ui, getEditorTheme(), this.keybindings)
1331
+ : new CustomEditor(getEditorTheme());
1332
+
1333
+ nextEditor.setUseTerminalCursor(this.ui.getShowHardwareCursor());
1334
+ nextEditor.setAutocompleteMaxVisible(this.settings.get("autocompleteMaxVisible"));
1335
+ nextEditor.onAutocompleteCancel = () => {
1336
+ this.ui.requestRender(true);
1337
+ };
1338
+ nextEditor.onAutocompleteUpdate = () => {
1339
+ this.ui.requestRender();
1340
+ };
1341
+ nextEditor.setMaxHeight(this.#computeEditorMaxHeight());
1342
+ if (this.historyStorage) {
1343
+ nextEditor.setHistoryStorage(this.historyStorage);
1344
+ }
1345
+ nextEditor.setText(previousText);
1346
+
1347
+ this.editorContainer.clear();
1348
+ this.editor = nextEditor;
1349
+ this.editorContainer.addChild(nextEditor);
1350
+ this.ui.setFocus(nextEditor);
1351
+
1352
+ this.#inputController.setupKeyHandlers();
1353
+ this.#inputController.setupEditorSubmitHandler();
1354
+
1355
+ void this.refreshSlashCommandState().catch(error => {
1356
+ logger.warn("Failed to refresh slash command state for custom editor", { error: String(error) });
1357
+ });
1358
+
1359
+ this.updateEditorBorderColor();
1360
+ this.updateEditorTopBorder();
1361
+ this.ui.requestRender();
1362
+ }
1363
+
1325
1364
  // Event handling
1326
1365
  async handleBackgroundEvent(event: AgentSessionEvent): Promise<void> {
1327
1366
  await this.#eventController.handleBackgroundEvent(event);
@@ -169,6 +169,9 @@ export class PromptActionAutocompleteProvider implements AutocompleteProvider {
169
169
  getInlineHint(lines: string[], cursorLine: number, cursorCol: number): string | null {
170
170
  return this.#baseProvider.getInlineHint?.(lines, cursorLine, cursorCol) ?? null;
171
171
  }
172
+ trySyncSlashCompletion(textBeforeCursor: string): { items: AutocompleteItem[]; prefix: string } | null {
173
+ return this.#baseProvider.trySyncSlashCompletion?.(textBeforeCursor) ?? null;
174
+ }
172
175
  }
173
176
 
174
177
  export function createPromptActionAutocompleteProvider(
@@ -1,6 +1,6 @@
1
1
  import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
2
2
  import type { AssistantMessage, ImageContent, Message, UsageReport } from "@oh-my-pi/pi-ai";
3
- import type { Component, Container, Loader, Spacer, Text, TUI } from "@oh-my-pi/pi-tui";
3
+ import type { Component, Container, EditorTheme, Loader, Spacer, Text, TUI } from "@oh-my-pi/pi-tui";
4
4
  import type { KeybindingsManager } from "../config/keybindings";
5
5
  import type { Settings } from "../config/settings";
6
6
  import type {
@@ -131,6 +131,9 @@ export interface InteractiveModeContext {
131
131
  setToolUIContext(uiContext: ExtensionUIContext, hasUI: boolean): void;
132
132
  initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void;
133
133
  createBackgroundUiContext(): ExtensionUIContext;
134
+ setEditorComponent(
135
+ factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined,
136
+ ): void;
134
137
 
135
138
  // Event handling
136
139
  handleBackgroundEvent(event: AgentSessionEvent): Promise<void>;