@oh-my-pi/pi-coding-agent 11.8.3 → 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.
@@ -34,6 +34,14 @@ import { renderStatusLine } from "../../tui";
34
34
  import { convertToPng } from "../../utils/image-convert";
35
35
  import { renderDiff } from "./diff";
36
36
 
37
+ function ensureInvalidate(component: unknown): Component {
38
+ const c = component as { render: Component["render"]; invalidate?: () => void };
39
+ if (!c.invalidate) {
40
+ c.invalidate = () => {};
41
+ }
42
+ return c as Component;
43
+ }
44
+
37
45
  export interface ToolExecutionOptions {
38
46
  showImages?: boolean; // default: true (only used if terminal supports images)
39
47
  editFuzzyThreshold?: number;
@@ -353,12 +361,7 @@ export class ToolExecutionComponent extends Container {
353
361
  try {
354
362
  const callComponent = tool.renderCall(this.#args, theme);
355
363
  if (callComponent) {
356
- // Ensure component has invalidate() method for Component interface
357
- const component = callComponent as any;
358
- if (!component.invalidate) {
359
- component.invalidate = () => {};
360
- }
361
- this.#contentBox.addChild(component);
364
+ this.#contentBox.addChild(ensureInvalidate(callComponent));
362
365
  }
363
366
  } catch (err) {
364
367
  logger.warn("Tool renderer failed", { tool: this.#toolName, error: String(err) });
@@ -390,12 +393,7 @@ export class ToolExecutionComponent extends Container {
390
393
  this.#args,
391
394
  );
392
395
  if (resultComponent) {
393
- // Ensure component has invalidate() method for Component interface
394
- const component = resultComponent as any;
395
- if (!component.invalidate) {
396
- component.invalidate = () => {};
397
- }
398
- this.#contentBox.addChild(component);
396
+ this.#contentBox.addChild(ensureInvalidate(resultComponent));
399
397
  }
400
398
  } catch (err) {
401
399
  logger.warn("Tool renderer failed", { tool: this.#toolName, error: String(err) });
@@ -425,12 +423,7 @@ export class ToolExecutionComponent extends Container {
425
423
  try {
426
424
  const callComponent = renderer.renderCall(this.#args, theme, this.#renderState);
427
425
  if (callComponent) {
428
- // Ensure component has invalidate() method for Component interface
429
- const component = callComponent as any;
430
- if (!component.invalidate) {
431
- component.invalidate = () => {};
432
- }
433
- this.#contentBox.addChild(component);
426
+ this.#contentBox.addChild(ensureInvalidate(callComponent));
434
427
  }
435
428
  } catch (err) {
436
429
  logger.warn("Tool renderer failed", { tool: this.#toolName, error: String(err) });
@@ -457,12 +450,7 @@ export class ToolExecutionComponent extends Container {
457
450
  this.#args, // Pass args for tools that need them
458
451
  );
459
452
  if (resultComponent) {
460
- // Ensure component has invalidate() method for Component interface
461
- const component = resultComponent as any;
462
- if (!component.invalidate) {
463
- component.invalidate = () => {};
464
- }
465
- this.#contentBox.addChild(component);
453
+ this.#contentBox.addChild(ensureInvalidate(resultComponent));
466
454
  }
467
455
  } catch (err) {
468
456
  logger.warn("Tool renderer failed", { tool: this.#toolName, error: String(err) });
@@ -333,6 +333,14 @@ export class InputController {
333
333
  return;
334
334
  }
335
335
 
336
+ // Handle MCP server management commands
337
+ if (text === "/mcp" || text.startsWith("/mcp ")) {
338
+ this.ctx.editor.addToHistory(text);
339
+ this.ctx.editor.setText("");
340
+ await this.ctx.handleMCPCommand(text);
341
+ return;
342
+ }
343
+
336
344
  // Handle skill commands (/skill:name [args])
337
345
  if (text.startsWith("/skill:")) {
338
346
  const spaceIndex = text.indexOf(" ");