mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-02 05:54:44 +00:00
refactor(agent): replace any-typed Tool alias with ToolDefinition from pi-coding-agent
This commit is contained in:
@@ -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')
|
||||||
|
|||||||
Reference in New Issue
Block a user