refactor(agent): replace any-typed Tool alias with ToolDefinition from pi-coding-agent

This commit is contained in:
yiling
2026-05-20 14:30:58 +08:00
parent 8160df0198
commit e87ca5bb23
+2 -4
View File
@@ -10,6 +10,7 @@ import {
SessionManager, SessionManager,
SettingsManager, SettingsManager,
defineTool, defineTool,
type ToolDefinition,
} from '@mariozechner/pi-coding-agent' } from '@mariozechner/pi-coding-agent'
import { Type, type TSchema } from '@sinclair/typebox' import { Type, type TSchema } from '@sinclair/typebox'
import * as fs from 'fs' import * as fs from 'fs'
@@ -21,9 +22,6 @@ import { createSandboxedBashTool } from './tools/sandboxed-bash'
import { Usage } from '@/services/ai/provider/provider' import { Usage } from '@/services/ai/provider/provider'
import { SandboxManager } from '@anthropic-ai/sandbox-runtime' import { SandboxManager } from '@anthropic-ai/sandbox-runtime'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Tool = any
export interface AutofillField { export interface AutofillField {
id: string id: string
config: PrismaJson.FieldConfig config: PrismaJson.FieldConfig
@@ -72,7 +70,7 @@ export class AgentExecutor {
agentsInstruction: string, agentsInstruction: string,
sessionId?: string, sessionId?: string,
userId?: string, userId?: string,
tools: Tool[] = [], tools: ToolDefinition[] = [],
): Promise<{ text: string; usage: Usage; sessionId: string }> { ): Promise<{ text: string; usage: Usage; sessionId: string }> {
const t = await this.getTeam(teamId) const t = await this.getTeam(teamId)
if (!t) throw new Error('failed to get team') if (!t) throw new Error('failed to get team')