{"version":3,"file":"types.cjs","names":["z"],"sources":["../../src/tools/types.ts"],"sourcesContent":["import Anthropic from \"@anthropic-ai/sdk\";\nimport { z } from \"zod/v4\";\n\n/**\n * Memory tool command types as defined by Anthropic's memory tool API.\n * @beta\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/memory-tool\n */\n\n// Zod schemas for memory commands\nexport const Memory20250818ViewCommandSchema = z.object({\n  command: z.literal(\"view\"),\n  path: z.string(),\n});\n\nexport const Memory20250818CreateCommandSchema = z.object({\n  command: z.literal(\"create\"),\n  path: z.string(),\n  file_text: z.string(),\n});\n\nexport const Memory20250818StrReplaceCommandSchema = z.object({\n  command: z.literal(\"str_replace\"),\n  path: z.string(),\n  old_str: z.string(),\n  new_str: z.string(),\n});\n\nexport const Memory20250818InsertCommandSchema = z.object({\n  command: z.literal(\"insert\"),\n  path: z.string(),\n  insert_line: z.number(),\n  insert_text: z.string(),\n});\n\nexport const Memory20250818DeleteCommandSchema = z.object({\n  command: z.literal(\"delete\"),\n  path: z.string(),\n});\n\nexport const Memory20250818RenameCommandSchema = z.object({\n  command: z.literal(\"rename\"),\n  old_path: z.string(),\n  new_path: z.string(),\n});\n\n// Discriminated union schema for all memory commands\nexport const Memory20250818CommandSchema = z.discriminatedUnion(\"command\", [\n  Memory20250818ViewCommandSchema,\n  Memory20250818CreateCommandSchema,\n  Memory20250818StrReplaceCommandSchema,\n  Memory20250818InsertCommandSchema,\n  Memory20250818DeleteCommandSchema,\n  Memory20250818RenameCommandSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type Memory20250818ViewCommand = z.infer<\n  typeof Memory20250818ViewCommandSchema\n>;\nexport type Memory20250818CreateCommand = z.infer<\n  typeof Memory20250818CreateCommandSchema\n>;\nexport type Memory20250818StrReplaceCommand = z.infer<\n  typeof Memory20250818StrReplaceCommandSchema\n>;\nexport type Memory20250818InsertCommand = z.infer<\n  typeof Memory20250818InsertCommandSchema\n>;\nexport type Memory20250818DeleteCommand = z.infer<\n  typeof Memory20250818DeleteCommandSchema\n>;\nexport type Memory20250818RenameCommand = z.infer<\n  typeof Memory20250818RenameCommandSchema\n>;\n\nexport type Memory20250818Command = z.infer<typeof Memory20250818CommandSchema>;\n\n/**\n * Options for creating a memory tool.\n */\nexport interface MemoryTool20250818Options {\n  /**\n   * Optional execute function that handles memory command execution.\n   * In LangChain, this is typically handled separately when processing tool calls,\n   * but this option is provided for compatibility with the AI SDK pattern.\n   * Note: This option is currently unused but reserved for future use.\n   */\n  execute: (action: Memory20250818Command) => Promise<string> | string;\n}\n\n/**\n * Memory tool type definition.\n */\nexport type MemoryTool20250818 = Anthropic.Beta.BetaMemoryTool20250818;\n\n/**\n * Text editor tool command types for Claude 4.x models.\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/text-editor-tool\n */\n\n// Zod schemas for text editor commands\nexport const TextEditor20250728ViewCommandSchema = z.object({\n  command: z.literal(\"view\"),\n  path: z.string(),\n  view_range: z.tuple([z.number(), z.number()]).optional(),\n});\n\nexport const TextEditor20250728StrReplaceCommandSchema = z.object({\n  command: z.literal(\"str_replace\"),\n  path: z.string(),\n  old_str: z.string(),\n  new_str: z.string(),\n});\n\nexport const TextEditor20250728CreateCommandSchema = z.object({\n  command: z.literal(\"create\"),\n  path: z.string(),\n  file_text: z.string(),\n});\n\nexport const TextEditor20250728InsertCommandSchema = z.object({\n  command: z.literal(\"insert\"),\n  path: z.string(),\n  insert_line: z.number(),\n  new_str: z.string(),\n});\n\n// Discriminated union schema for all text editor commands\nexport const TextEditor20250728CommandSchema = z.discriminatedUnion(\"command\", [\n  TextEditor20250728ViewCommandSchema,\n  TextEditor20250728StrReplaceCommandSchema,\n  TextEditor20250728CreateCommandSchema,\n  TextEditor20250728InsertCommandSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type TextEditor20250728ViewCommand = z.infer<\n  typeof TextEditor20250728ViewCommandSchema\n>;\nexport type TextEditor20250728StrReplaceCommand = z.infer<\n  typeof TextEditor20250728StrReplaceCommandSchema\n>;\nexport type TextEditor20250728CreateCommand = z.infer<\n  typeof TextEditor20250728CreateCommandSchema\n>;\nexport type TextEditor20250728InsertCommand = z.infer<\n  typeof TextEditor20250728InsertCommandSchema\n>;\nexport type TextEditor20250728Command = z.infer<\n  typeof TextEditor20250728CommandSchema\n>;\n\n/**\n * Computer use tool action types for Claude Opus 4.5.\n * Includes zoom action which is not available in earlier versions.\n * @see https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool\n */\nexport type Computer20251124Action =\n  | Computer20250124Action\n  | ComputerZoomAction;\n\n/**\n * Computer use tool action types for Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.\n * @see https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool\n */\nexport type Computer20250124Action =\n  | ComputerScreenshotAction\n  | ComputerLeftClickAction\n  | ComputerRightClickAction\n  | ComputerMiddleClickAction\n  | ComputerDoubleClickAction\n  | ComputerTripleClickAction\n  | ComputerLeftClickDragAction\n  | ComputerLeftMouseDownAction\n  | ComputerLeftMouseUpAction\n  | ComputerScrollAction\n  | ComputerTypeAction\n  | ComputerKeyAction\n  | ComputerMouseMoveAction\n  | ComputerHoldKeyAction\n  | ComputerWaitAction;\n\n// Zod schemas for computer actions\nconst coordinateSchema = z.tuple([z.number(), z.number()]);\n\nexport const ComputerScreenshotActionSchema = z.object({\n  action: z.literal(\"screenshot\"),\n});\n\nexport const ComputerLeftClickActionSchema = z.object({\n  action: z.literal(\"left_click\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerRightClickActionSchema = z.object({\n  action: z.literal(\"right_click\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerMiddleClickActionSchema = z.object({\n  action: z.literal(\"middle_click\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerDoubleClickActionSchema = z.object({\n  action: z.literal(\"double_click\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerTripleClickActionSchema = z.object({\n  action: z.literal(\"triple_click\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerLeftClickDragActionSchema = z.object({\n  action: z.literal(\"left_click_drag\"),\n  start_coordinate: coordinateSchema,\n  end_coordinate: coordinateSchema,\n});\n\nexport const ComputerLeftMouseDownActionSchema = z.object({\n  action: z.literal(\"left_mouse_down\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerLeftMouseUpActionSchema = z.object({\n  action: z.literal(\"left_mouse_up\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerScrollActionSchema = z.object({\n  action: z.literal(\"scroll\"),\n  coordinate: coordinateSchema,\n  scroll_direction: z.enum([\"up\", \"down\", \"left\", \"right\"]),\n  scroll_amount: z.number(),\n});\n\nexport const ComputerTypeActionSchema = z.object({\n  action: z.literal(\"type\"),\n  text: z.string(),\n});\n\nexport const ComputerKeyActionSchema = z.object({\n  action: z.literal(\"key\"),\n  key: z.string(),\n});\n\nexport const ComputerMouseMoveActionSchema = z.object({\n  action: z.literal(\"mouse_move\"),\n  coordinate: coordinateSchema,\n});\n\nexport const ComputerHoldKeyActionSchema = z.object({\n  action: z.literal(\"hold_key\"),\n  key: z.string(),\n});\n\nexport const ComputerWaitActionSchema = z.object({\n  action: z.literal(\"wait\"),\n  duration: z.number().optional(),\n});\n\nexport const ComputerZoomActionSchema = z.object({\n  action: z.literal(\"zoom\"),\n  region: z.tuple([z.number(), z.number(), z.number(), z.number()]),\n});\n\n// Discriminated union schemas\nexport const Computer20250124ActionSchema = z.discriminatedUnion(\"action\", [\n  ComputerScreenshotActionSchema,\n  ComputerLeftClickActionSchema,\n  ComputerRightClickActionSchema,\n  ComputerMiddleClickActionSchema,\n  ComputerDoubleClickActionSchema,\n  ComputerTripleClickActionSchema,\n  ComputerLeftClickDragActionSchema,\n  ComputerLeftMouseDownActionSchema,\n  ComputerLeftMouseUpActionSchema,\n  ComputerScrollActionSchema,\n  ComputerTypeActionSchema,\n  ComputerKeyActionSchema,\n  ComputerMouseMoveActionSchema,\n  ComputerHoldKeyActionSchema,\n  ComputerWaitActionSchema,\n]);\n\nexport const Computer20251124ActionSchema = z.discriminatedUnion(\"action\", [\n  ComputerScreenshotActionSchema,\n  ComputerLeftClickActionSchema,\n  ComputerRightClickActionSchema,\n  ComputerMiddleClickActionSchema,\n  ComputerDoubleClickActionSchema,\n  ComputerTripleClickActionSchema,\n  ComputerLeftClickDragActionSchema,\n  ComputerLeftMouseDownActionSchema,\n  ComputerLeftMouseUpActionSchema,\n  ComputerScrollActionSchema,\n  ComputerTypeActionSchema,\n  ComputerKeyActionSchema,\n  ComputerMouseMoveActionSchema,\n  ComputerHoldKeyActionSchema,\n  ComputerWaitActionSchema,\n  ComputerZoomActionSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type ComputerScreenshotAction = z.infer<\n  typeof ComputerScreenshotActionSchema\n>;\n\nexport type ComputerLeftClickAction = z.infer<\n  typeof ComputerLeftClickActionSchema\n>;\n\nexport type ComputerRightClickAction = z.infer<\n  typeof ComputerRightClickActionSchema\n>;\n\nexport type ComputerMiddleClickAction = z.infer<\n  typeof ComputerMiddleClickActionSchema\n>;\n\nexport type ComputerDoubleClickAction = z.infer<\n  typeof ComputerDoubleClickActionSchema\n>;\n\nexport type ComputerTripleClickAction = z.infer<\n  typeof ComputerTripleClickActionSchema\n>;\n\nexport type ComputerLeftClickDragAction = z.infer<\n  typeof ComputerLeftClickDragActionSchema\n>;\n\nexport type ComputerLeftMouseDownAction = z.infer<\n  typeof ComputerLeftMouseDownActionSchema\n>;\n\nexport type ComputerLeftMouseUpAction = z.infer<\n  typeof ComputerLeftMouseUpActionSchema\n>;\n\nexport type ComputerScrollAction = z.infer<typeof ComputerScrollActionSchema>;\n\nexport type ComputerTypeAction = z.infer<typeof ComputerTypeActionSchema>;\n\nexport type ComputerKeyAction = z.infer<typeof ComputerKeyActionSchema>;\n\nexport type ComputerMouseMoveAction = z.infer<\n  typeof ComputerMouseMoveActionSchema\n>;\n\nexport type ComputerHoldKeyAction = z.infer<typeof ComputerHoldKeyActionSchema>;\n\nexport type ComputerWaitAction = z.infer<typeof ComputerWaitActionSchema>;\n\nexport type ComputerZoomAction = z.infer<typeof ComputerZoomActionSchema>;\n\n/**\n * Bash tool command types for Claude 4 models and Claude 3.7.\n * @see https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/bash-tool\n */\n\n// Zod schemas for bash commands\nexport const Bash20250124ExecuteCommandSchema = z.object({\n  command: z.string().describe(\"The bash command to run\"),\n});\n\nexport const Bash20250124RestartCommandSchema = z.object({\n  restart: z.literal(true).describe(\"Set to true to restart the bash session\"),\n});\n\n// Union schema for all bash commands\nexport const Bash20250124CommandSchema = z.union([\n  Bash20250124ExecuteCommandSchema,\n  Bash20250124RestartCommandSchema,\n]);\n\n// TypeScript types derived from Zod schemas\nexport type Bash20250124ExecuteCommand = z.infer<\n  typeof Bash20250124ExecuteCommandSchema\n>;\nexport type Bash20250124RestartCommand = z.infer<\n  typeof Bash20250124RestartCommandSchema\n>;\nexport type Bash20250124Command = z.infer<typeof Bash20250124CommandSchema>;\n"],"mappings":";;;;;;;;AAUA,MAAa,kCAAkCA,OAAAA,EAAE,OAAO;CACtD,SAASA,OAAAA,EAAE,QAAQ,OAAO;CAC1B,MAAMA,OAAAA,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAa,oCAAoCA,OAAAA,EAAE,OAAO;CACxD,SAASA,OAAAA,EAAE,QAAQ,SAAS;CAC5B,MAAMA,OAAAA,EAAE,QAAQ;CAChB,WAAWA,OAAAA,EAAE,QAAQ;CACtB,CAAC;AAEF,MAAa,wCAAwCA,OAAAA,EAAE,OAAO;CAC5D,SAASA,OAAAA,EAAE,QAAQ,cAAc;CACjC,MAAMA,OAAAA,EAAE,QAAQ;CAChB,SAASA,OAAAA,EAAE,QAAQ;CACnB,SAASA,OAAAA,EAAE,QAAQ;CACpB,CAAC;AAEF,MAAa,oCAAoCA,OAAAA,EAAE,OAAO;CACxD,SAASA,OAA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