feat(coding-agent): type ToolCallEvent.input per tool
Matches ToolResultEvent pattern with typed inputs via discriminated union. - Export *ToolInput types from tool schemas - Add *ToolCallEvent interfaces for each built-in tool - Add isToolCallEventType() guard with overloads for built-ins Direct narrowing (event.toolName === "bash") doesn't work due to CustomToolCallEvent.toolName: string overlapping with literals. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import { createWriteStream, existsSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import type { AgentTool } from "@mariozechner/pi-agent-core";
|
||||
import { Type } from "@sinclair/typebox";
|
||||
import { type Static, Type } from "@sinclair/typebox";
|
||||
import { spawn } from "child_process";
|
||||
import { getShellConfig, getShellEnv, killProcessTree } from "../../utils/shell.js";
|
||||
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationResult, truncateTail } from "./truncate.js";
|
||||
@@ -21,6 +21,8 @@ const bashSchema = Type.Object({
|
||||
timeout: Type.Optional(Type.Number({ description: "Timeout in seconds (optional, no default timeout)" })),
|
||||
});
|
||||
|
||||
export type BashToolInput = Static<typeof bashSchema>;
|
||||
|
||||
export interface BashToolDetails {
|
||||
truncation?: TruncationResult;
|
||||
fullOutputPath?: string;
|
||||
|
||||
Reference in New Issue
Block a user