chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
*
|
||||
* How it works:
|
||||
* - registerTool() with the same name as a built-in replaces it entirely
|
||||
* - We create instances of the original tools via createReadTool(), etc.
|
||||
* and delegate execute() to them
|
||||
* - We create the original definitions via createReadToolDefinition(), etc.
|
||||
* and override only their renderers
|
||||
* - renderCall() controls what's shown when the tool is invoked
|
||||
* - renderResult() controls what's shown after execution completes
|
||||
* - renderShell: "self" lets a tool render its own outer shell instead of
|
||||
@@ -26,23 +26,21 @@
|
||||
*/
|
||||
|
||||
import type { BashToolDetails, EditToolDetails, ExtensionAPI, ReadToolDetails } from "@earendil-works/pi-coding-agent";
|
||||
import { createBashTool, createEditTool, createReadTool, createWriteTool } from "@earendil-works/pi-coding-agent";
|
||||
import {
|
||||
createBashToolDefinition,
|
||||
createEditToolDefinition,
|
||||
createReadToolDefinition,
|
||||
createWriteToolDefinition,
|
||||
} from "@earendil-works/pi-coding-agent";
|
||||
import { Text } from "@earendil-works/pi-tui";
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
const cwd = process.cwd();
|
||||
|
||||
// --- Read tool: show path and line count ---
|
||||
const originalRead = createReadTool(cwd);
|
||||
const originalRead = createReadToolDefinition(cwd);
|
||||
pi.registerTool({
|
||||
name: "read",
|
||||
label: "read",
|
||||
description: originalRead.description,
|
||||
parameters: originalRead.parameters,
|
||||
|
||||
async execute(toolCallId, params, signal, onUpdate) {
|
||||
return originalRead.execute(toolCallId, params, signal, onUpdate);
|
||||
},
|
||||
...originalRead,
|
||||
|
||||
renderCall(args, theme, _context) {
|
||||
let text = theme.fg("toolTitle", theme.bold("read "));
|
||||
@@ -92,16 +90,9 @@ export default function (pi: ExtensionAPI) {
|
||||
});
|
||||
|
||||
// --- Bash tool: show command and exit code ---
|
||||
const originalBash = createBashTool(cwd);
|
||||
const originalBash = createBashToolDefinition(cwd);
|
||||
pi.registerTool({
|
||||
name: "bash",
|
||||
label: "bash",
|
||||
description: originalBash.description,
|
||||
parameters: originalBash.parameters,
|
||||
|
||||
async execute(toolCallId, params, signal, onUpdate) {
|
||||
return originalBash.execute(toolCallId, params, signal, onUpdate);
|
||||
},
|
||||
...originalBash,
|
||||
|
||||
renderCall(args, theme, _context) {
|
||||
let text = theme.fg("toolTitle", theme.bold("$ "));
|
||||
@@ -151,17 +142,9 @@ export default function (pi: ExtensionAPI) {
|
||||
});
|
||||
|
||||
// --- Edit tool: show path and diff stats ---
|
||||
const originalEdit = createEditTool(cwd);
|
||||
const originalEdit = createEditToolDefinition(cwd);
|
||||
pi.registerTool({
|
||||
name: "edit",
|
||||
label: "edit",
|
||||
description: originalEdit.description,
|
||||
parameters: originalEdit.parameters,
|
||||
renderShell: "self",
|
||||
|
||||
async execute(toolCallId, params, signal, onUpdate) {
|
||||
return originalEdit.execute(toolCallId, params, signal, onUpdate);
|
||||
},
|
||||
...originalEdit,
|
||||
|
||||
renderCall(args, theme, _context) {
|
||||
let text = theme.fg("toolTitle", theme.bold("edit "));
|
||||
@@ -216,16 +199,9 @@ export default function (pi: ExtensionAPI) {
|
||||
});
|
||||
|
||||
// --- Write tool: show path and size ---
|
||||
const originalWrite = createWriteTool(cwd);
|
||||
const originalWrite = createWriteToolDefinition(cwd);
|
||||
pi.registerTool({
|
||||
name: "write",
|
||||
label: "write",
|
||||
description: originalWrite.description,
|
||||
parameters: originalWrite.parameters,
|
||||
|
||||
async execute(toolCallId, params, signal, onUpdate) {
|
||||
return originalWrite.execute(toolCallId, params, signal, onUpdate);
|
||||
},
|
||||
...originalWrite,
|
||||
|
||||
renderCall(args, theme, _context) {
|
||||
let text = theme.fg("toolTitle", theme.bold("write "));
|
||||
|
||||
Reference in New Issue
Block a user