@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.
- package/CHANGELOG.md +42 -0
- package/package.json +7 -7
- package/src/capability/mcp.ts +9 -0
- package/src/config/file-lock.ts +1 -1
- package/src/discovery/builtin.ts +48 -0
- package/src/discovery/mcp-json.ts +33 -0
- package/src/extensibility/slash-commands.ts +1 -0
- package/src/index.ts +0 -2
- 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 +92 -3
- package/src/mcp/oauth-discovery.ts +274 -0
- package/src/mcp/oauth-flow.ts +229 -0
- package/src/mcp/tool-bridge.ts +8 -8
- package/src/mcp/transports/http.ts +76 -35
- package/src/mcp/transports/stdio.ts +31 -16
- package/src/mcp/types.ts +15 -1
- package/src/modes/components/mcp-add-wizard.ts +1286 -0
- package/src/modes/components/tool-execution.ts +12 -24
- package/src/modes/controllers/input-controller.ts +8 -0
- package/src/modes/controllers/mcp-command-controller.ts +1223 -0
- package/src/modes/interactive-mode.ts +6 -0
- package/src/modes/types.ts +1 -0
- package/src/sdk.ts +1 -0
- package/src/session/agent-session.ts +49 -0
- package/src/system-prompt.ts +2 -3
- package/src/task/executor.ts +26 -38
- package/src/task/worktree.ts +8 -5
- package/src/tools/bash.ts +8 -4
- package/src/tools/browser.ts +7 -4
- package/src/tools/grep.ts +1 -13
- package/src/tools/index.ts +1 -1
- package/src/utils/event-bus.ts +3 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(" ");
|