@langchain/anthropic 1.2.3 → 1.3.0-dev-1765432861398

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.md +620 -3
  2. package/dist/chat_models.cjs +8 -5
  3. package/dist/chat_models.cjs.map +1 -1
  4. package/dist/chat_models.d.cts +13 -16
  5. package/dist/chat_models.d.cts.map +1 -0
  6. package/dist/chat_models.d.ts +13 -16
  7. package/dist/chat_models.d.ts.map +1 -0
  8. package/dist/chat_models.js +7 -4
  9. package/dist/chat_models.js.map +1 -1
  10. package/dist/index.cjs +3 -1
  11. package/dist/index.d.cts +12 -2
  12. package/dist/index.d.ts +12 -2
  13. package/dist/index.js +2 -1
  14. package/dist/tools/bash.cjs +95 -0
  15. package/dist/tools/bash.cjs.map +1 -0
  16. package/dist/tools/bash.d.cts +99 -0
  17. package/dist/tools/bash.d.cts.map +1 -0
  18. package/dist/tools/bash.d.ts +99 -0
  19. package/dist/tools/bash.d.ts.map +1 -0
  20. package/dist/tools/bash.js +94 -0
  21. package/dist/tools/bash.js.map +1 -0
  22. package/dist/tools/codeExecution.cjs +70 -0
  23. package/dist/tools/codeExecution.cjs.map +1 -0
  24. package/dist/tools/codeExecution.d.cts +75 -0
  25. package/dist/tools/codeExecution.d.cts.map +1 -0
  26. package/dist/tools/codeExecution.d.ts +75 -0
  27. package/dist/tools/codeExecution.d.ts.map +1 -0
  28. package/dist/tools/codeExecution.js +69 -0
  29. package/dist/tools/codeExecution.js.map +1 -0
  30. package/dist/tools/computer.cjs +161 -0
  31. package/dist/tools/computer.cjs.map +1 -0
  32. package/dist/tools/computer.d.cts +289 -0
  33. package/dist/tools/computer.d.cts.map +1 -0
  34. package/dist/tools/computer.d.ts +289 -0
  35. package/dist/tools/computer.d.ts.map +1 -0
  36. package/dist/tools/computer.js +159 -0
  37. package/dist/tools/computer.js.map +1 -0
  38. package/dist/tools/index.cjs +28 -0
  39. package/dist/tools/index.cjs.map +1 -0
  40. package/dist/tools/index.d.cts +28 -0
  41. package/dist/tools/index.d.cts.map +1 -0
  42. package/dist/tools/index.d.ts +28 -0
  43. package/dist/tools/index.d.ts.map +1 -0
  44. package/dist/tools/index.js +28 -0
  45. package/dist/tools/index.js.map +1 -0
  46. package/dist/tools/mcpToolset.cjs +111 -0
  47. package/dist/tools/mcpToolset.cjs.map +1 -0
  48. package/dist/tools/mcpToolset.d.cts +141 -0
  49. package/dist/tools/mcpToolset.d.cts.map +1 -0
  50. package/dist/tools/mcpToolset.d.ts +141 -0
  51. package/dist/tools/mcpToolset.d.ts.map +1 -0
  52. package/dist/tools/mcpToolset.js +110 -0
  53. package/dist/tools/mcpToolset.js.map +1 -0
  54. package/dist/tools/memory.cjs +56 -0
  55. package/dist/tools/memory.cjs.map +1 -0
  56. package/dist/tools/memory.d.cts +92 -0
  57. package/dist/tools/memory.d.cts.map +1 -0
  58. package/dist/tools/memory.d.ts +92 -0
  59. package/dist/tools/memory.d.ts.map +1 -0
  60. package/dist/tools/memory.js +55 -0
  61. package/dist/tools/memory.js.map +1 -0
  62. package/dist/tools/textEditor.cjs +79 -0
  63. package/dist/tools/textEditor.cjs.map +1 -0
  64. package/dist/tools/textEditor.d.cts +114 -0
  65. package/dist/tools/textEditor.d.cts.map +1 -0
  66. package/dist/tools/textEditor.d.ts +114 -0
  67. package/dist/tools/textEditor.d.ts.map +1 -0
  68. package/dist/tools/textEditor.js +78 -0
  69. package/dist/tools/textEditor.js.map +1 -0
  70. package/dist/tools/toolSearch.cjs +110 -0
  71. package/dist/tools/toolSearch.cjs.map +1 -0
  72. package/dist/tools/toolSearch.d.cts +108 -0
  73. package/dist/tools/toolSearch.d.cts.map +1 -0
  74. package/dist/tools/toolSearch.d.ts +108 -0
  75. package/dist/tools/toolSearch.d.ts.map +1 -0
  76. package/dist/tools/toolSearch.js +108 -0
  77. package/dist/tools/toolSearch.js.map +1 -0
  78. package/dist/tools/types.cjs +204 -0
  79. package/dist/tools/types.cjs.map +1 -0
  80. package/dist/tools/types.d.cts +366 -0
  81. package/dist/tools/types.d.cts.map +1 -0
  82. package/dist/tools/types.d.ts +366 -0
  83. package/dist/tools/types.d.ts.map +1 -0
  84. package/dist/tools/types.js +199 -0
  85. package/dist/tools/types.js.map +1 -0
  86. package/dist/tools/webFetch.cjs +70 -0
  87. package/dist/tools/webFetch.cjs.map +1 -0
  88. package/dist/tools/webFetch.d.cts +96 -0
  89. package/dist/tools/webFetch.d.cts.map +1 -0
  90. package/dist/tools/webFetch.d.ts +96 -0
  91. package/dist/tools/webFetch.d.ts.map +1 -0
  92. package/dist/tools/webFetch.js +69 -0
  93. package/dist/tools/webFetch.js.map +1 -0
  94. package/dist/tools/webSearch.cjs +57 -0
  95. package/dist/tools/webSearch.cjs.map +1 -0
  96. package/dist/tools/webSearch.d.cts +84 -0
  97. package/dist/tools/webSearch.d.cts.map +1 -0
  98. package/dist/tools/webSearch.d.ts +84 -0
  99. package/dist/tools/webSearch.d.ts.map +1 -0
  100. package/dist/tools/webSearch.js +56 -0
  101. package/dist/tools/webSearch.js.map +1 -0
  102. package/dist/types.d.cts +2 -3
  103. package/dist/types.d.cts.map +1 -0
  104. package/dist/types.d.ts +2 -3
  105. package/dist/types.d.ts.map +1 -0
  106. package/dist/utils/prompts.d.cts.map +1 -0
  107. package/dist/utils/prompts.d.ts.map +1 -0
  108. package/dist/utils/tools.cjs +9 -2
  109. package/dist/utils/tools.cjs.map +1 -1
  110. package/dist/utils/tools.js +13 -6
  111. package/dist/utils/tools.js.map +1 -1
  112. package/package.json +8 -7
@@ -0,0 +1,161 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_types = require('./types.cjs');
3
+ const __langchain_core_tools = require_rolldown_runtime.__toESM(require("@langchain/core/tools"));
4
+
5
+ //#region src/tools/computer.ts
6
+ const TOOL_NAME = "computer";
7
+ /**
8
+ * Creates an Anthropic computer use tool for Claude Opus 4.5 that provides
9
+ * screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
10
+ *
11
+ * The computer use tool enables Claude to interact with desktop environments through:
12
+ * - **Screenshot capture**: See what's currently displayed on screen
13
+ * - **Mouse control**: Click, drag, and move the cursor
14
+ * - **Keyboard input**: Type text and use keyboard shortcuts
15
+ * - **Zoom**: View specific screen regions at full resolution (when enabled)
16
+ *
17
+ * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine
18
+ * or container with minimal privileges. Avoid giving access to sensitive data.
19
+ *
20
+ * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}
21
+ *
22
+ * @example
23
+ * ```typescript
24
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
25
+ *
26
+ * const llm = new ChatAnthropic({
27
+ * model: "claude-opus-4-5-20251101",
28
+ * clientOptions: {
29
+ * defaultHeaders: {
30
+ * "anthropic-beta": "computer-use-2025-11-24",
31
+ * },
32
+ * },
33
+ * });
34
+ *
35
+ * const computer = tools.computer_20251124({
36
+ * displayWidthPx: 1024,
37
+ * displayHeightPx: 768,
38
+ * displayNumber: 1,
39
+ * enableZoom: true,
40
+ * execute: async (action) => {
41
+ * if (action.action === "screenshot") {
42
+ * // Capture and return base64-encoded screenshot
43
+ * return captureScreenshot();
44
+ * }
45
+ * if (action.action === "left_click") {
46
+ * // Click at the specified coordinates
47
+ * await click(action.coordinate[0], action.coordinate[1]);
48
+ * return captureScreenshot();
49
+ * }
50
+ * // Handle other actions...
51
+ * },
52
+ * });
53
+ *
54
+ * const llmWithComputer = llm.bindTools([computer]);
55
+ * const response = await llmWithComputer.invoke(
56
+ * "Save a picture of a cat to my desktop."
57
+ * );
58
+ * ```
59
+ *
60
+ * @param options - Configuration options for the computer use tool
61
+ * @returns The computer use tool object that can be passed to `bindTools`
62
+ */
63
+ function computer_20251124(options) {
64
+ const name = TOOL_NAME;
65
+ const computerTool = (0, __langchain_core_tools.tool)(options.execute, {
66
+ name,
67
+ schema: require_types.Computer20251124ActionSchema
68
+ });
69
+ computerTool.extras = {
70
+ ...computerTool.extras ?? {},
71
+ providerToolDefinition: {
72
+ type: "computer_20251124",
73
+ name,
74
+ display_width_px: options.displayWidthPx,
75
+ display_height_px: options.displayHeightPx,
76
+ ...options.displayNumber !== void 0 && { display_number: options.displayNumber },
77
+ ...options.enableZoom !== void 0 && { enable_zoom: options.enableZoom }
78
+ }
79
+ };
80
+ return computerTool;
81
+ }
82
+ /**
83
+ * Creates an Anthropic computer use tool that provides screenshot capabilities and mouse/keyboard control
84
+ * for autonomous desktop interaction.
85
+ *
86
+ * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.
87
+ *
88
+ * The computer use tool enables Claude to interact with desktop environments through:
89
+ * - **Screenshot capture**: See what's currently displayed on screen
90
+ * - **Mouse control**: Click, drag, and move the cursor
91
+ * - **Keyboard input**: Type text and use keyboard shortcuts
92
+ *
93
+ * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine
94
+ * or container with minimal privileges. Avoid giving access to sensitive data.
95
+ *
96
+ * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
101
+ *
102
+ * const llm = new ChatAnthropic({
103
+ * model: "claude-sonnet-4-5-20250929",
104
+ * clientOptions: {
105
+ * defaultHeaders: {
106
+ * "anthropic-beta": "computer-use-2025-01-24",
107
+ * },
108
+ * },
109
+ * });
110
+ *
111
+ * const computer = tools.computer_20250124({
112
+ * displayWidthPx: 1024,
113
+ * displayHeightPx: 768,
114
+ * displayNumber: 1,
115
+ * execute: async (action) => {
116
+ * if (action.action === "screenshot") {
117
+ * // Capture and return base64-encoded screenshot
118
+ * return captureScreenshot();
119
+ * }
120
+ * if (action.action === "left_click") {
121
+ * // Click at the specified coordinates
122
+ * await click(action.coordinate[0], action.coordinate[1]);
123
+ * return captureScreenshot();
124
+ * }
125
+ * // Handle other actions...
126
+ * },
127
+ * });
128
+ *
129
+ * const llmWithComputer = llm.bindTools([computer]);
130
+ * const response = await llmWithComputer.invoke(
131
+ * "Save a picture of a cat to my desktop."
132
+ * );
133
+ * ```
134
+ *
135
+ * @param options - Configuration options for the computer use tool
136
+ * @returns The computer use tool object that can be passed to `bindTools`
137
+ */
138
+ function computer_20250124(options) {
139
+ const name = TOOL_NAME;
140
+ const computerTool = (0, __langchain_core_tools.tool)(options.execute, {
141
+ name,
142
+ description: "A tool for interacting with the computer",
143
+ schema: require_types.Computer20250124ActionSchema
144
+ });
145
+ computerTool.extras = {
146
+ ...computerTool.extras ?? {},
147
+ providerToolDefinition: {
148
+ type: "computer_20250124",
149
+ name,
150
+ display_width_px: options.displayWidthPx,
151
+ display_height_px: options.displayHeightPx,
152
+ ...options.displayNumber !== void 0 && { display_number: options.displayNumber }
153
+ }
154
+ };
155
+ return computerTool;
156
+ }
157
+
158
+ //#endregion
159
+ exports.computer_20250124 = computer_20250124;
160
+ exports.computer_20251124 = computer_20251124;
161
+ //# sourceMappingURL=computer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computer.cjs","names":["options: Computer20251124Options","Computer20251124ActionSchema","options: Computer20250124Options","Computer20250124ActionSchema"],"sources":["../../src/tools/computer.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport Anthropic from \"@anthropic-ai/sdk\";\nimport { tool } from \"@langchain/core/tools\";\nimport { ToolMessage } from \"@langchain/core/messages\";\nimport type { DynamicStructuredTool, ToolRuntime } from \"@langchain/core/tools\";\n\nimport type {\n Computer20251124Action,\n Computer20250124Action,\n} from \"./types.js\";\nimport {\n Computer20251124ActionSchema,\n Computer20250124ActionSchema,\n} from \"./types.js\";\n\nconst TOOL_NAME = \"computer\";\n\nexport type ComputerUseReturnType =\n | string\n | Promise<string>\n | ToolMessage<any>\n | Promise<ToolMessage<any>>;\n\n/**\n * Options for the computer use tool (Claude Opus 4.5 only version).\n *\n * @template TState - The type of the state schema (when used with `ReactAgent`)\n * @template TContext - The type of the context schema (when used with `ReactAgent`)\n */\nexport interface Computer20251124Options<TState = any, TContext = any> {\n /**\n * The width of the display in pixels.\n */\n displayWidthPx: number;\n /**\n * The height of the display in pixels.\n */\n displayHeightPx: number;\n /**\n * Optional display number for X11 environments.\n */\n displayNumber?: number;\n /**\n * Enable zoom action for detailed screen region inspection.\n * When enabled, Claude can zoom into specific screen regions.\n * @default false\n */\n enableZoom?: boolean;\n /**\n * Optional execute function that handles computer action execution.\n * This function receives the action input and should return the result\n * (typically a base64-encoded screenshot or action confirmation).\n */\n execute?: (\n args: Computer20251124Action,\n runtime: ToolRuntime<TState, TContext>\n ) => ComputerUseReturnType;\n}\n\n/**\n * Creates an Anthropic computer use tool for Claude Opus 4.5 that provides\n * screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * The computer use tool enables Claude to interact with desktop environments through:\n * - **Screenshot capture**: See what's currently displayed on screen\n * - **Mouse control**: Click, drag, and move the cursor\n * - **Keyboard input**: Type text and use keyboard shortcuts\n * - **Zoom**: View specific screen regions at full resolution (when enabled)\n *\n * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine\n * or container with minimal privileges. Avoid giving access to sensitive data.\n *\n * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const llm = new ChatAnthropic({\n * model: \"claude-opus-4-5-20251101\",\n * clientOptions: {\n * defaultHeaders: {\n * \"anthropic-beta\": \"computer-use-2025-11-24\",\n * },\n * },\n * });\n *\n * const computer = tools.computer_20251124({\n * displayWidthPx: 1024,\n * displayHeightPx: 768,\n * displayNumber: 1,\n * enableZoom: true,\n * execute: async (action) => {\n * if (action.action === \"screenshot\") {\n * // Capture and return base64-encoded screenshot\n * return captureScreenshot();\n * }\n * if (action.action === \"left_click\") {\n * // Click at the specified coordinates\n * await click(action.coordinate[0], action.coordinate[1]);\n * return captureScreenshot();\n * }\n * // Handle other actions...\n * },\n * });\n *\n * const llmWithComputer = llm.bindTools([computer]);\n * const response = await llmWithComputer.invoke(\n * \"Save a picture of a cat to my desktop.\"\n * );\n * ```\n *\n * @param options - Configuration options for the computer use tool\n * @returns The computer use tool object that can be passed to `bindTools`\n */\nexport function computer_20251124(options: Computer20251124Options) {\n const name = TOOL_NAME;\n const computerTool = tool(\n options.execute as (\n input: unknown,\n runtime: ToolRuntime<unknown, unknown>\n ) => ComputerUseReturnType,\n {\n name,\n schema: Computer20251124ActionSchema,\n }\n );\n\n computerTool.extras = {\n ...(computerTool.extras ?? {}),\n providerToolDefinition: {\n type: \"computer_20251124\",\n name,\n display_width_px: options.displayWidthPx,\n display_height_px: options.displayHeightPx,\n ...(options.displayNumber !== undefined && {\n display_number: options.displayNumber,\n }),\n ...(options.enableZoom !== undefined && {\n enable_zoom: options.enableZoom,\n }),\n } satisfies Anthropic.Beta.BetaToolComputerUse20251124,\n };\n\n return computerTool as DynamicStructuredTool<\n typeof Computer20251124ActionSchema,\n Computer20251124Action,\n any,\n ToolMessage<any>\n >;\n}\n\n/**\n * Options for the computer use tool.\n *\n * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.\n */\nexport interface Computer20250124Options<TState = any, TContext = any> {\n /**\n * The width of the display in pixels.\n */\n displayWidthPx: number;\n /**\n * The height of the display in pixels.\n */\n displayHeightPx: number;\n /**\n * Optional display number for X11 environments.\n */\n displayNumber?: number;\n /**\n * Optional execute function that handles computer action execution.\n * This function receives the action input and should return the result\n * (typically a base64-encoded screenshot or action confirmation).\n */\n execute?: (\n args: Computer20250124Action,\n runtime: ToolRuntime<TState, TContext>\n ) => ComputerUseReturnType;\n}\n\n/**\n * Creates an Anthropic computer use tool that provides screenshot capabilities and mouse/keyboard control\n * for autonomous desktop interaction.\n *\n * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.\n *\n * The computer use tool enables Claude to interact with desktop environments through:\n * - **Screenshot capture**: See what's currently displayed on screen\n * - **Mouse control**: Click, drag, and move the cursor\n * - **Keyboard input**: Type text and use keyboard shortcuts\n *\n * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine\n * or container with minimal privileges. Avoid giving access to sensitive data.\n *\n * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const llm = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * clientOptions: {\n * defaultHeaders: {\n * \"anthropic-beta\": \"computer-use-2025-01-24\",\n * },\n * },\n * });\n *\n * const computer = tools.computer_20250124({\n * displayWidthPx: 1024,\n * displayHeightPx: 768,\n * displayNumber: 1,\n * execute: async (action) => {\n * if (action.action === \"screenshot\") {\n * // Capture and return base64-encoded screenshot\n * return captureScreenshot();\n * }\n * if (action.action === \"left_click\") {\n * // Click at the specified coordinates\n * await click(action.coordinate[0], action.coordinate[1]);\n * return captureScreenshot();\n * }\n * // Handle other actions...\n * },\n * });\n *\n * const llmWithComputer = llm.bindTools([computer]);\n * const response = await llmWithComputer.invoke(\n * \"Save a picture of a cat to my desktop.\"\n * );\n * ```\n *\n * @param options - Configuration options for the computer use tool\n * @returns The computer use tool object that can be passed to `bindTools`\n */\nexport function computer_20250124(options: Computer20250124Options) {\n const name = TOOL_NAME;\n const computerTool = tool(\n options.execute as (\n input: unknown,\n runtime: ToolRuntime<unknown, unknown>\n ) => ComputerUseReturnType,\n {\n name,\n description: \"A tool for interacting with the computer\",\n schema: Computer20250124ActionSchema,\n }\n );\n\n computerTool.extras = {\n ...(computerTool.extras ?? {}),\n providerToolDefinition: {\n type: \"computer_20250124\",\n name,\n display_width_px: options.displayWidthPx,\n display_height_px: options.displayHeightPx,\n ...(options.displayNumber !== undefined && {\n display_number: options.displayNumber,\n }),\n } satisfies Anthropic.Beta.BetaToolComputerUse20250124,\n };\n\n return computerTool as DynamicStructuredTool<\n typeof Computer20250124ActionSchema,\n Computer20250124Action,\n any,\n ComputerUseReturnType\n >;\n}\n"],"mappings":";;;;;AAeA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGlB,SAAgB,kBAAkBA,SAAkC;CAClE,MAAM,OAAO;CACb,MAAM,gDACJ,QAAQ,SAIR;EACE;EACA,QAAQC;CACT,EACF;CAED,aAAa,SAAS;EACpB,GAAI,aAAa,UAAU,CAAE;EAC7B,wBAAwB;GACtB,MAAM;GACN;GACA,kBAAkB,QAAQ;GAC1B,mBAAmB,QAAQ;GAC3B,GAAI,QAAQ,kBAAkB,UAAa,EACzC,gBAAgB,QAAQ,cACzB;GACD,GAAI,QAAQ,eAAe,UAAa,EACtC,aAAa,QAAQ,WACtB;EACF;CACF;AAED,QAAO;AAMR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuFD,SAAgB,kBAAkBC,SAAkC;CAClE,MAAM,OAAO;CACb,MAAM,gDACJ,QAAQ,SAIR;EACE;EACA,aAAa;EACb,QAAQC;CACT,EACF;CAED,aAAa,SAAS;EACpB,GAAI,aAAa,UAAU,CAAE;EAC7B,wBAAwB;GACtB,MAAM;GACN;GACA,kBAAkB,QAAQ;GAC1B,mBAAmB,QAAQ;GAC3B,GAAI,QAAQ,kBAAkB,UAAa,EACzC,gBAAgB,QAAQ,cACzB;EACF;CACF;AAED,QAAO;AAMR"}
@@ -0,0 +1,289 @@
1
+ import { Computer20250124Action, Computer20251124Action } from "./types.cjs";
2
+ import { ToolMessage } from "@langchain/core/messages";
3
+ import * as zod46 from "zod";
4
+ import * as zod_v4_core9 from "zod/v4/core";
5
+ import { DynamicStructuredTool, ToolRuntime } from "@langchain/core/tools";
6
+
7
+ //#region src/tools/computer.d.ts
8
+ type ComputerUseReturnType = string | Promise<string> | ToolMessage<any> | Promise<ToolMessage<any>>;
9
+ /**
10
+ * Options for the computer use tool (Claude Opus 4.5 only version).
11
+ *
12
+ * @template TState - The type of the state schema (when used with `ReactAgent`)
13
+ * @template TContext - The type of the context schema (when used with `ReactAgent`)
14
+ */
15
+ interface Computer20251124Options<TState = any, TContext = any> {
16
+ /**
17
+ * The width of the display in pixels.
18
+ */
19
+ displayWidthPx: number;
20
+ /**
21
+ * The height of the display in pixels.
22
+ */
23
+ displayHeightPx: number;
24
+ /**
25
+ * Optional display number for X11 environments.
26
+ */
27
+ displayNumber?: number;
28
+ /**
29
+ * Enable zoom action for detailed screen region inspection.
30
+ * When enabled, Claude can zoom into specific screen regions.
31
+ * @default false
32
+ */
33
+ enableZoom?: boolean;
34
+ /**
35
+ * Optional execute function that handles computer action execution.
36
+ * This function receives the action input and should return the result
37
+ * (typically a base64-encoded screenshot or action confirmation).
38
+ */
39
+ execute?: (args: Computer20251124Action, runtime: ToolRuntime<TState, TContext>) => ComputerUseReturnType;
40
+ }
41
+ /**
42
+ * Creates an Anthropic computer use tool for Claude Opus 4.5 that provides
43
+ * screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
44
+ *
45
+ * The computer use tool enables Claude to interact with desktop environments through:
46
+ * - **Screenshot capture**: See what's currently displayed on screen
47
+ * - **Mouse control**: Click, drag, and move the cursor
48
+ * - **Keyboard input**: Type text and use keyboard shortcuts
49
+ * - **Zoom**: View specific screen regions at full resolution (when enabled)
50
+ *
51
+ * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine
52
+ * or container with minimal privileges. Avoid giving access to sensitive data.
53
+ *
54
+ * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
59
+ *
60
+ * const llm = new ChatAnthropic({
61
+ * model: "claude-opus-4-5-20251101",
62
+ * clientOptions: {
63
+ * defaultHeaders: {
64
+ * "anthropic-beta": "computer-use-2025-11-24",
65
+ * },
66
+ * },
67
+ * });
68
+ *
69
+ * const computer = tools.computer_20251124({
70
+ * displayWidthPx: 1024,
71
+ * displayHeightPx: 768,
72
+ * displayNumber: 1,
73
+ * enableZoom: true,
74
+ * execute: async (action) => {
75
+ * if (action.action === "screenshot") {
76
+ * // Capture and return base64-encoded screenshot
77
+ * return captureScreenshot();
78
+ * }
79
+ * if (action.action === "left_click") {
80
+ * // Click at the specified coordinates
81
+ * await click(action.coordinate[0], action.coordinate[1]);
82
+ * return captureScreenshot();
83
+ * }
84
+ * // Handle other actions...
85
+ * },
86
+ * });
87
+ *
88
+ * const llmWithComputer = llm.bindTools([computer]);
89
+ * const response = await llmWithComputer.invoke(
90
+ * "Save a picture of a cat to my desktop."
91
+ * );
92
+ * ```
93
+ *
94
+ * @param options - Configuration options for the computer use tool
95
+ * @returns The computer use tool object that can be passed to `bindTools`
96
+ */
97
+ declare function computer_20251124(options: Computer20251124Options): DynamicStructuredTool<zod46.ZodDiscriminatedUnion<[zod46.ZodObject<{
98
+ action: zod46.ZodLiteral<"screenshot">;
99
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
100
+ action: zod46.ZodLiteral<"left_click">;
101
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
102
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
103
+ action: zod46.ZodLiteral<"right_click">;
104
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
105
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
106
+ action: zod46.ZodLiteral<"middle_click">;
107
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
108
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
109
+ action: zod46.ZodLiteral<"double_click">;
110
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
111
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
112
+ action: zod46.ZodLiteral<"triple_click">;
113
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
114
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
115
+ action: zod46.ZodLiteral<"left_click_drag">;
116
+ start_coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
117
+ end_coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
118
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
119
+ action: zod46.ZodLiteral<"left_mouse_down">;
120
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
121
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
122
+ action: zod46.ZodLiteral<"left_mouse_up">;
123
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
124
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
125
+ action: zod46.ZodLiteral<"scroll">;
126
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
127
+ scroll_direction: zod46.ZodEnum<{
128
+ down: "down";
129
+ left: "left";
130
+ right: "right";
131
+ up: "up";
132
+ }>;
133
+ scroll_amount: zod46.ZodNumber;
134
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
135
+ action: zod46.ZodLiteral<"type">;
136
+ text: zod46.ZodString;
137
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
138
+ action: zod46.ZodLiteral<"key">;
139
+ key: zod46.ZodString;
140
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
141
+ action: zod46.ZodLiteral<"mouse_move">;
142
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
143
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
144
+ action: zod46.ZodLiteral<"hold_key">;
145
+ key: zod46.ZodString;
146
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
147
+ action: zod46.ZodLiteral<"wait">;
148
+ duration: zod46.ZodOptional<zod46.ZodNumber>;
149
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
150
+ action: zod46.ZodLiteral<"zoom">;
151
+ region: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber, zod46.ZodNumber, zod46.ZodNumber], null>;
152
+ }, zod_v4_core9.$strip>], "action">, Computer20251124Action, any, ToolMessage<any>>;
153
+ /**
154
+ * Options for the computer use tool.
155
+ *
156
+ * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.
157
+ */
158
+ interface Computer20250124Options<TState = any, TContext = any> {
159
+ /**
160
+ * The width of the display in pixels.
161
+ */
162
+ displayWidthPx: number;
163
+ /**
164
+ * The height of the display in pixels.
165
+ */
166
+ displayHeightPx: number;
167
+ /**
168
+ * Optional display number for X11 environments.
169
+ */
170
+ displayNumber?: number;
171
+ /**
172
+ * Optional execute function that handles computer action execution.
173
+ * This function receives the action input and should return the result
174
+ * (typically a base64-encoded screenshot or action confirmation).
175
+ */
176
+ execute?: (args: Computer20250124Action, runtime: ToolRuntime<TState, TContext>) => ComputerUseReturnType;
177
+ }
178
+ /**
179
+ * Creates an Anthropic computer use tool that provides screenshot capabilities and mouse/keyboard control
180
+ * for autonomous desktop interaction.
181
+ *
182
+ * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.
183
+ *
184
+ * The computer use tool enables Claude to interact with desktop environments through:
185
+ * - **Screenshot capture**: See what's currently displayed on screen
186
+ * - **Mouse control**: Click, drag, and move the cursor
187
+ * - **Keyboard input**: Type text and use keyboard shortcuts
188
+ *
189
+ * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine
190
+ * or container with minimal privileges. Avoid giving access to sensitive data.
191
+ *
192
+ * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * import { ChatAnthropic, tools } from "@langchain/anthropic";
197
+ *
198
+ * const llm = new ChatAnthropic({
199
+ * model: "claude-sonnet-4-5-20250929",
200
+ * clientOptions: {
201
+ * defaultHeaders: {
202
+ * "anthropic-beta": "computer-use-2025-01-24",
203
+ * },
204
+ * },
205
+ * });
206
+ *
207
+ * const computer = tools.computer_20250124({
208
+ * displayWidthPx: 1024,
209
+ * displayHeightPx: 768,
210
+ * displayNumber: 1,
211
+ * execute: async (action) => {
212
+ * if (action.action === "screenshot") {
213
+ * // Capture and return base64-encoded screenshot
214
+ * return captureScreenshot();
215
+ * }
216
+ * if (action.action === "left_click") {
217
+ * // Click at the specified coordinates
218
+ * await click(action.coordinate[0], action.coordinate[1]);
219
+ * return captureScreenshot();
220
+ * }
221
+ * // Handle other actions...
222
+ * },
223
+ * });
224
+ *
225
+ * const llmWithComputer = llm.bindTools([computer]);
226
+ * const response = await llmWithComputer.invoke(
227
+ * "Save a picture of a cat to my desktop."
228
+ * );
229
+ * ```
230
+ *
231
+ * @param options - Configuration options for the computer use tool
232
+ * @returns The computer use tool object that can be passed to `bindTools`
233
+ */
234
+ declare function computer_20250124(options: Computer20250124Options): DynamicStructuredTool<zod46.ZodDiscriminatedUnion<[zod46.ZodObject<{
235
+ action: zod46.ZodLiteral<"screenshot">;
236
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
237
+ action: zod46.ZodLiteral<"left_click">;
238
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
239
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
240
+ action: zod46.ZodLiteral<"right_click">;
241
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
242
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
243
+ action: zod46.ZodLiteral<"middle_click">;
244
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
245
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
246
+ action: zod46.ZodLiteral<"double_click">;
247
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
248
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
249
+ action: zod46.ZodLiteral<"triple_click">;
250
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
251
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
252
+ action: zod46.ZodLiteral<"left_click_drag">;
253
+ start_coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
254
+ end_coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
255
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
256
+ action: zod46.ZodLiteral<"left_mouse_down">;
257
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
258
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
259
+ action: zod46.ZodLiteral<"left_mouse_up">;
260
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
261
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
262
+ action: zod46.ZodLiteral<"scroll">;
263
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
264
+ scroll_direction: zod46.ZodEnum<{
265
+ down: "down";
266
+ left: "left";
267
+ right: "right";
268
+ up: "up";
269
+ }>;
270
+ scroll_amount: zod46.ZodNumber;
271
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
272
+ action: zod46.ZodLiteral<"type">;
273
+ text: zod46.ZodString;
274
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
275
+ action: zod46.ZodLiteral<"key">;
276
+ key: zod46.ZodString;
277
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
278
+ action: zod46.ZodLiteral<"mouse_move">;
279
+ coordinate: zod46.ZodTuple<[zod46.ZodNumber, zod46.ZodNumber], null>;
280
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
281
+ action: zod46.ZodLiteral<"hold_key">;
282
+ key: zod46.ZodString;
283
+ }, zod_v4_core9.$strip>, zod46.ZodObject<{
284
+ action: zod46.ZodLiteral<"wait">;
285
+ duration: zod46.ZodOptional<zod46.ZodNumber>;
286
+ }, zod_v4_core9.$strip>], "action">, Computer20250124Action, any, ComputerUseReturnType>;
287
+ //#endregion
288
+ export { Computer20250124Options, Computer20251124Options, ComputerUseReturnType, computer_20250124, computer_20251124 };
289
+ //# sourceMappingURL=computer.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computer.d.cts","names":["zod_v4_core9","ToolMessage","DynamicStructuredTool","ToolRuntime","Computer20251124Action","Computer20250124Action","ComputerUseReturnType","Promise","Computer20251124Options","TState","TContext","computer_20251124","zod46","ZodLiteral","$strip","ZodObject","ZodNumber","ZodTuple","ZodEnum","ZodString","ZodOptional","ZodDiscriminatedUnion","Computer20250124Options","computer_20250124"],"sources":["../../src/tools/computer.d.ts"],"sourcesContent":["import { ToolMessage } from \"@langchain/core/messages\";\nimport type { DynamicStructuredTool, ToolRuntime } from \"@langchain/core/tools\";\nimport type { Computer20251124Action, Computer20250124Action } from \"./types.js\";\nexport type ComputerUseReturnType = string | Promise<string> | ToolMessage<any> | Promise<ToolMessage<any>>;\n/**\n * Options for the computer use tool (Claude Opus 4.5 only version).\n *\n * @template TState - The type of the state schema (when used with `ReactAgent`)\n * @template TContext - The type of the context schema (when used with `ReactAgent`)\n */\nexport interface Computer20251124Options<TState = any, TContext = any> {\n /**\n * The width of the display in pixels.\n */\n displayWidthPx: number;\n /**\n * The height of the display in pixels.\n */\n displayHeightPx: number;\n /**\n * Optional display number for X11 environments.\n */\n displayNumber?: number;\n /**\n * Enable zoom action for detailed screen region inspection.\n * When enabled, Claude can zoom into specific screen regions.\n * @default false\n */\n enableZoom?: boolean;\n /**\n * Optional execute function that handles computer action execution.\n * This function receives the action input and should return the result\n * (typically a base64-encoded screenshot or action confirmation).\n */\n execute?: (args: Computer20251124Action, runtime: ToolRuntime<TState, TContext>) => ComputerUseReturnType;\n}\n/**\n * Creates an Anthropic computer use tool for Claude Opus 4.5 that provides\n * screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * The computer use tool enables Claude to interact with desktop environments through:\n * - **Screenshot capture**: See what's currently displayed on screen\n * - **Mouse control**: Click, drag, and move the cursor\n * - **Keyboard input**: Type text and use keyboard shortcuts\n * - **Zoom**: View specific screen regions at full resolution (when enabled)\n *\n * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine\n * or container with minimal privileges. Avoid giving access to sensitive data.\n *\n * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const llm = new ChatAnthropic({\n * model: \"claude-opus-4-5-20251101\",\n * clientOptions: {\n * defaultHeaders: {\n * \"anthropic-beta\": \"computer-use-2025-11-24\",\n * },\n * },\n * });\n *\n * const computer = tools.computer_20251124({\n * displayWidthPx: 1024,\n * displayHeightPx: 768,\n * displayNumber: 1,\n * enableZoom: true,\n * execute: async (action) => {\n * if (action.action === \"screenshot\") {\n * // Capture and return base64-encoded screenshot\n * return captureScreenshot();\n * }\n * if (action.action === \"left_click\") {\n * // Click at the specified coordinates\n * await click(action.coordinate[0], action.coordinate[1]);\n * return captureScreenshot();\n * }\n * // Handle other actions...\n * },\n * });\n *\n * const llmWithComputer = llm.bindTools([computer]);\n * const response = await llmWithComputer.invoke(\n * \"Save a picture of a cat to my desktop.\"\n * );\n * ```\n *\n * @param options - Configuration options for the computer use tool\n * @returns The computer use tool object that can be passed to `bindTools`\n */\nexport declare function computer_20251124(options: Computer20251124Options): DynamicStructuredTool<import(\"zod\").ZodDiscriminatedUnion<[import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"screenshot\">;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"right_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"middle_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"double_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"triple_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_click_drag\">;\n start_coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n end_coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_mouse_down\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_mouse_up\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"scroll\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n scroll_direction: import(\"zod\").ZodEnum<{\n down: \"down\";\n left: \"left\";\n right: \"right\";\n up: \"up\";\n }>;\n scroll_amount: import(\"zod\").ZodNumber;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"type\">;\n text: import(\"zod\").ZodString;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"key\">;\n key: import(\"zod\").ZodString;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"mouse_move\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"hold_key\">;\n key: import(\"zod\").ZodString;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"wait\">;\n duration: import(\"zod\").ZodOptional<import(\"zod\").ZodNumber>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"zoom\">;\n region: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber, import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>], \"action\">, Computer20251124Action, any, ToolMessage<any>>;\n/**\n * Options for the computer use tool.\n *\n * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.\n */\nexport interface Computer20250124Options<TState = any, TContext = any> {\n /**\n * The width of the display in pixels.\n */\n displayWidthPx: number;\n /**\n * The height of the display in pixels.\n */\n displayHeightPx: number;\n /**\n * Optional display number for X11 environments.\n */\n displayNumber?: number;\n /**\n * Optional execute function that handles computer action execution.\n * This function receives the action input and should return the result\n * (typically a base64-encoded screenshot or action confirmation).\n */\n execute?: (args: Computer20250124Action, runtime: ToolRuntime<TState, TContext>) => ComputerUseReturnType;\n}\n/**\n * Creates an Anthropic computer use tool that provides screenshot capabilities and mouse/keyboard control\n * for autonomous desktop interaction.\n *\n * Supported models: Claude Sonnet 4.5, Haiku 4.5, Opus 4.1, Sonnet 4, Opus 4, and Sonnet 3.7 versions.\n *\n * The computer use tool enables Claude to interact with desktop environments through:\n * - **Screenshot capture**: See what's currently displayed on screen\n * - **Mouse control**: Click, drag, and move the cursor\n * - **Keyboard input**: Type text and use keyboard shortcuts\n *\n * @warning Computer use is a beta feature with unique risks. Use a dedicated virtual machine\n * or container with minimal privileges. Avoid giving access to sensitive data.\n *\n * @see {@link https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool | Anthropic Computer Use Documentation}\n *\n * @example\n * ```typescript\n * import { ChatAnthropic, tools } from \"@langchain/anthropic\";\n *\n * const llm = new ChatAnthropic({\n * model: \"claude-sonnet-4-5-20250929\",\n * clientOptions: {\n * defaultHeaders: {\n * \"anthropic-beta\": \"computer-use-2025-01-24\",\n * },\n * },\n * });\n *\n * const computer = tools.computer_20250124({\n * displayWidthPx: 1024,\n * displayHeightPx: 768,\n * displayNumber: 1,\n * execute: async (action) => {\n * if (action.action === \"screenshot\") {\n * // Capture and return base64-encoded screenshot\n * return captureScreenshot();\n * }\n * if (action.action === \"left_click\") {\n * // Click at the specified coordinates\n * await click(action.coordinate[0], action.coordinate[1]);\n * return captureScreenshot();\n * }\n * // Handle other actions...\n * },\n * });\n *\n * const llmWithComputer = llm.bindTools([computer]);\n * const response = await llmWithComputer.invoke(\n * \"Save a picture of a cat to my desktop.\"\n * );\n * ```\n *\n * @param options - Configuration options for the computer use tool\n * @returns The computer use tool object that can be passed to `bindTools`\n */\nexport declare function computer_20250124(options: Computer20250124Options): DynamicStructuredTool<import(\"zod\").ZodDiscriminatedUnion<[import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"screenshot\">;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"right_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"middle_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"double_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"triple_click\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_click_drag\">;\n start_coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n end_coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_mouse_down\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"left_mouse_up\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"scroll\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n scroll_direction: import(\"zod\").ZodEnum<{\n down: \"down\";\n left: \"left\";\n right: \"right\";\n up: \"up\";\n }>;\n scroll_amount: import(\"zod\").ZodNumber;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"type\">;\n text: import(\"zod\").ZodString;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"key\">;\n key: import(\"zod\").ZodString;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"mouse_move\">;\n coordinate: import(\"zod\").ZodTuple<[import(\"zod\").ZodNumber, import(\"zod\").ZodNumber], null>;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"hold_key\">;\n key: import(\"zod\").ZodString;\n}, import(\"zod/v4/core\").$strip>, import(\"zod\").ZodObject<{\n action: import(\"zod\").ZodLiteral<\"wait\">;\n duration: import(\"zod\").ZodOptional<import(\"zod\").ZodNumber>;\n}, import(\"zod/v4/core\").$strip>], \"action\">, Computer20250124Action, any, ComputerUseReturnType>;\n//# sourceMappingURL=computer.d.ts.map"],"mappings":";;;;;;;KAGYM,qBAAAA,YAAiCC,kBAAkBN,mBAAmBM,QAAQN;;;;AAA1F;;;AAA0FA,UAOzEO,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