File size: 1,563 Bytes
064bfd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | import { z } from 'zod/v4'
import { buildTool, type ToolDef } from '../../Tool.js'
import { lazySchema } from '../../utils/lazySchema.js'
import { VERIFY_PLAN_EXECUTION_TOOL_NAME } from './constants.js'
const inputSchema = lazySchema(() => z.strictObject({}))
type InputSchema = ReturnType<typeof inputSchema>
const outputSchema = lazySchema(() =>
z.object({
verified: z.boolean(),
message: z.string(),
}),
)
type OutputSchema = ReturnType<typeof outputSchema>
type Output = z.infer<OutputSchema>
const UNAVAILABLE_MESSAGE =
'Plan execution verification is unavailable in this reconstructed build.'
export const VerifyPlanExecutionTool = buildTool({
name: VERIFY_PLAN_EXECUTION_TOOL_NAME,
maxResultSizeChars: 4_096,
get inputSchema(): InputSchema {
return inputSchema()
},
get outputSchema(): OutputSchema {
return outputSchema()
},
isEnabled() {
return false
},
isConcurrencySafe() {
return true
},
isReadOnly() {
return true
},
async description() {
return UNAVAILABLE_MESSAGE
},
async prompt() {
return UNAVAILABLE_MESSAGE
},
mapToolResultToToolResultBlockParam(output: Output, toolUseID: string) {
return {
tool_use_id: toolUseID,
type: 'tool_result',
content: output.message,
}
},
renderToolUseMessage() {
return null
},
renderToolResultMessage() {
return null
},
async call() {
return {
data: {
verified: false,
message: UNAVAILABLE_MESSAGE,
},
}
},
} satisfies ToolDef<InputSchema, Output>)
|