@tanstack/ai-anthropic 0.15.9 → 0.15.10

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 (54) hide show
  1. package/dist/esm/adapters/summarize.d.ts +41 -0
  2. package/dist/esm/adapters/summarize.js +18 -0
  3. package/dist/esm/adapters/summarize.js.map +1 -0
  4. package/dist/esm/adapters/text.d.ts +92 -0
  5. package/dist/esm/adapters/text.js +851 -0
  6. package/dist/esm/adapters/text.js.map +1 -0
  7. package/dist/esm/index.d.ts +9 -0
  8. package/dist/esm/index.js +15 -0
  9. package/dist/esm/index.js.map +1 -0
  10. package/dist/esm/message-types.d.ts +84 -0
  11. package/dist/esm/model-meta.d.ts +410 -0
  12. package/dist/esm/model-meta.js +81 -0
  13. package/dist/esm/model-meta.js.map +1 -0
  14. package/dist/esm/text/text-provider-options.d.ts +258 -0
  15. package/dist/esm/text/text-provider-options.js +30 -0
  16. package/dist/esm/text/text-provider-options.js.map +1 -0
  17. package/dist/esm/tools/bash-tool.d.ts +8 -0
  18. package/dist/esm/tools/bash-tool.js +17 -0
  19. package/dist/esm/tools/bash-tool.js.map +1 -0
  20. package/dist/esm/tools/code-execution-tool.d.ts +34 -0
  21. package/dist/esm/tools/code-execution-tool.js +39 -0
  22. package/dist/esm/tools/code-execution-tool.js.map +1 -0
  23. package/dist/esm/tools/computer-use-tool.d.ts +8 -0
  24. package/dist/esm/tools/computer-use-tool.js +17 -0
  25. package/dist/esm/tools/computer-use-tool.js.map +1 -0
  26. package/dist/esm/tools/custom-tool.d.ts +26 -0
  27. package/dist/esm/tools/custom-tool.js +34 -0
  28. package/dist/esm/tools/custom-tool.js.map +1 -0
  29. package/dist/esm/tools/index.d.ts +17 -0
  30. package/dist/esm/tools/index.js +22 -0
  31. package/dist/esm/tools/index.js.map +1 -0
  32. package/dist/esm/tools/memory-tool.d.ts +8 -0
  33. package/dist/esm/tools/memory-tool.js +20 -0
  34. package/dist/esm/tools/memory-tool.js.map +1 -0
  35. package/dist/esm/tools/text-editor-tool.d.ts +8 -0
  36. package/dist/esm/tools/text-editor-tool.js +19 -0
  37. package/dist/esm/tools/text-editor-tool.js.map +1 -0
  38. package/dist/esm/tools/tool-converter.d.ts +27 -0
  39. package/dist/esm/tools/tool-converter.js +35 -0
  40. package/dist/esm/tools/tool-converter.js.map +1 -0
  41. package/dist/esm/tools/web-fetch-tool.d.ts +8 -0
  42. package/dist/esm/tools/web-fetch-tool.js +21 -0
  43. package/dist/esm/tools/web-fetch-tool.js.map +1 -0
  44. package/dist/esm/tools/web-search-tool.d.ts +8 -0
  45. package/dist/esm/tools/web-search-tool.js +63 -0
  46. package/dist/esm/tools/web-search-tool.js.map +1 -0
  47. package/dist/esm/usage.d.ts +25 -0
  48. package/dist/esm/usage.js +35 -0
  49. package/dist/esm/usage.js.map +1 -0
  50. package/dist/esm/utils/client.d.ts +17 -0
  51. package/dist/esm/utils/client.js +20 -0
  52. package/dist/esm/utils/client.js.map +1 -0
  53. package/dist/esm/utils/index.d.ts +1 -0
  54. package/package.json +4 -4
@@ -0,0 +1,258 @@
1
+ import { BetaContextManagementConfig, BetaToolChoiceAny, BetaToolChoiceAuto, BetaToolChoiceTool } from '@anthropic-ai/sdk/resources/beta/messages/messages';
2
+ import { CacheControlEphemeral } from '@anthropic-ai/sdk/resources';
3
+ import { AnthropicContainerSkill, AnthropicTool } from '../tools.js';
4
+ import { MessageParam, TextBlockParam } from '@anthropic-ai/sdk/resources/messages';
5
+ /**
6
+ * Per-prompt metadata Anthropic understands on `systemPrompts` entries.
7
+ *
8
+ * Used via the structured form of `systemPrompts`:
9
+ *
10
+ * @example
11
+ * import type { AnthropicSystemPromptMetadata } from '@tanstack/ai-anthropic'
12
+ *
13
+ * chat({
14
+ * adapter: anthropicText(),
15
+ * model: 'claude-sonnet-4-6',
16
+ * systemPrompts: [
17
+ * {
18
+ * content: 'Stable instructions — cache me.',
19
+ * metadata: { cache_control: { type: 'ephemeral' } } satisfies AnthropicSystemPromptMetadata,
20
+ * },
21
+ * 'Volatile per-request instruction.',
22
+ * ],
23
+ * })
24
+ */
25
+ export interface AnthropicSystemPromptMetadata {
26
+ /**
27
+ * Anthropic prompt-caching control applied to this system prompt's
28
+ * `TextBlockParam`.
29
+ *
30
+ * @see https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
31
+ */
32
+ cache_control?: CacheControlEphemeral;
33
+ }
34
+ export interface AnthropicContainerOptions {
35
+ /**
36
+ * Container identifier for reuse across requests.
37
+ * Container parameters with skills to be loaded.
38
+ */
39
+ container?: {
40
+ id: string | null;
41
+ /**
42
+ * List of skills to load into the container.
43
+ *
44
+ * @deprecated Configure skills on the `code_execution` tool instead:
45
+ * `codeExecutionTool(config, { skills })`. The adapter lifts those into
46
+ * `container.skills` and attaches the required beta headers. Setting
47
+ * skills here bypasses the beta-header wiring and may stop working.
48
+ */
49
+ skills: Array<AnthropicContainerSkill> | null;
50
+ } | null;
51
+ }
52
+ export interface AnthropicContextManagementOptions {
53
+ /**
54
+ * Context management configuration.
55
+
56
+ This allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.
57
+ */
58
+ context_management?: BetaContextManagementConfig | null;
59
+ }
60
+ export interface AnthropicMCPOptions {
61
+ /**
62
+ * MCP servers to be utilized in this request
63
+ * Maximum of 20 servers
64
+ */
65
+ mcp_servers?: Array<MCPServer>;
66
+ }
67
+ export interface AnthropicServiceTierOptions {
68
+ /**
69
+ * Determines whether to use priority capacity (if available) or standard capacity for this request.
70
+ */
71
+ service_tier?: 'auto' | 'standard_only';
72
+ }
73
+ export interface AnthropicStopSequencesOptions {
74
+ /**
75
+ * Custom text sequences that will cause the model to stop generating.
76
+
77
+ Anthropic models will normally stop when they have naturally completed their turn, which will result in a response stop_reason of "end_turn".
78
+
79
+ If you want the model to stop generating when it encounters custom strings of text, you can use the stop_sequences parameter. If the model encounters one of the custom sequences, the response stop_reason value will be "stop_sequence" and the response stop_sequence value will contain the matched stop sequence.
80
+ */
81
+ stop_sequences?: Array<string>;
82
+ }
83
+ export interface AnthropicThinkingOptions {
84
+ /**
85
+ * Configuration for enabling Claude's extended thinking.
86
+
87
+ When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.
88
+ */
89
+ thinking?: {
90
+ /**
91
+ * Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.
92
+
93
+ Must be ≥1024 and less than max_tokens
94
+ */
95
+ budget_tokens: number;
96
+ type: 'enabled';
97
+ } | {
98
+ type: 'disabled';
99
+ };
100
+ }
101
+ export interface AnthropicAdaptiveThinkingOptions {
102
+ /**
103
+ * Configuration for Claude's adaptive thinking (Opus 4.6+).
104
+ *
105
+ * In adaptive mode, Claude dynamically decides when and how much to think.
106
+ * Use the effort parameter to control thinking depth.
107
+ * `thinking: {type: "enabled"}` with `budget_tokens` is deprecated on Opus 4.6.
108
+ */
109
+ thinking?: {
110
+ type: 'adaptive';
111
+ /**
112
+ * Controls what (if any) thinking content is streamed back.
113
+ *
114
+ * - `'summarized'`: stream summarized thinking via `thinking_delta`
115
+ * events (the user-visible reasoning text).
116
+ * - `'omitted'`: stream the thinking block's `signature_delta` only
117
+ * (no reasoning text reaches the client).
118
+ *
119
+ * On Claude Opus 4.6 the default is `'summarized'`. On
120
+ * Claude Opus 4.7 the default flipped to `'omitted'` — callers
121
+ * must set `'summarized'` explicitly to get the reasoning text.
122
+ */
123
+ display?: 'summarized' | 'omitted';
124
+ } | {
125
+ /**
126
+ * @deprecated Use `type: 'adaptive'` with the effort parameter on Opus 4.6+.
127
+ */
128
+ budget_tokens: number;
129
+ type: 'enabled';
130
+ } | {
131
+ type: 'disabled';
132
+ };
133
+ }
134
+ export interface AnthropicEffortOptions {
135
+ /**
136
+ * Controls the thinking depth for adaptive thinking mode (Opus 4.6+).
137
+ *
138
+ * - `max`: Absolute highest capability
139
+ * - `high`: Default - Claude will almost always think
140
+ * - `medium`: Balanced cost-quality
141
+ * - `low`: May skip thinking for simpler problems
142
+ */
143
+ effort?: 'max' | 'high' | 'medium' | 'low';
144
+ }
145
+ export interface AnthropicOutputConfigOptions {
146
+ /**
147
+ * Output configuration for the model's response.
148
+ *
149
+ * On Claude 4.7+ the top-level `effort` field was relocated under
150
+ * `output_config.effort`, and `thinking: { type: 'enabled', budget_tokens }`
151
+ * was replaced by `thinking: { type: 'adaptive' }` paired with
152
+ * `output_config.effort`. Earlier models continue to accept the legacy
153
+ * top-level `effort` / `thinking.type: 'enabled'` shape.
154
+ *
155
+ * The engine also writes `output_config.format` here when the caller
156
+ * passes `outputSchema` to a Claude 4.5+ adapter (issue #605 native
157
+ * combined mode). Both fields coexist: user-supplied `effort` is
158
+ * preserved when the engine adds `format`.
159
+ */
160
+ output_config?: {
161
+ effort?: 'low' | 'medium' | 'high' | 'max' | null;
162
+ };
163
+ }
164
+ export interface AnthropicToolChoiceOptions {
165
+ tool_choice?: BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceAuto;
166
+ }
167
+ export interface AnthropicSamplingOptions {
168
+ /**
169
+ * Only sample from the top K options for each subsequent token.
170
+
171
+ Used to remove "long tail" low probability responses.
172
+ Recommended for advanced use cases only. You usually only need to use temperature.
173
+
174
+ Required range: x >= 0
175
+ */
176
+ top_k?: number;
177
+ /**
178
+ * Amount of randomness injected into the response.
179
+ * Either use this or top_p, but not both.
180
+ * Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.
181
+ * @default 1.0
182
+ */
183
+ temperature?: number;
184
+ /**
185
+ * Use nucleus sampling.
186
+ *
187
+ * In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by top_p. You should either alter temperature or top_p, but not both.
188
+ */
189
+ top_p?: number;
190
+ /**
191
+ * The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate. Required by the API; the adapter defaults to 1024 when omitted.
192
+ * Range x >= 1.
193
+ */
194
+ max_tokens?: number;
195
+ }
196
+ export type ExternalTextProviderOptions = AnthropicContainerOptions & AnthropicContextManagementOptions & AnthropicMCPOptions & AnthropicServiceTierOptions & AnthropicStopSequencesOptions & AnthropicThinkingOptions & AnthropicToolChoiceOptions & AnthropicSamplingOptions & Partial<AnthropicAdaptiveThinkingOptions> & Partial<AnthropicEffortOptions> & Partial<AnthropicOutputConfigOptions>;
197
+ export interface InternalTextProviderOptions extends ExternalTextProviderOptions {
198
+ model: string;
199
+ messages: Array<MessageParam>;
200
+ /**
201
+ * The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate.
202
+ * Range x >= 1.
203
+ */
204
+ max_tokens: number;
205
+ /**
206
+ * Whether to incrementally stream the response using server-sent events.
207
+ */
208
+ stream?: boolean;
209
+ /**
210
+ * System prompt — built by the adapter from the user-facing
211
+ * `systemPrompts: Array<string>` on the chat call. This field is internal:
212
+ * users should pass system prompts via `systemPrompts`, not via
213
+ * `modelOptions`.
214
+ *
215
+ * A system prompt is a way of providing context and instructions to Claude,
216
+ * such as specifying a particular goal or role.
217
+ */
218
+ system?: string | Array<TextBlockParam>;
219
+ tools?: Array<AnthropicTool>;
220
+ /**
221
+ * Schema-constrained final answer in a single Messages request (issue
222
+ * #605). Set by the engine when the adapter declared
223
+ * `supportsCombinedToolsAndSchema` and a caller passed `outputSchema`
224
+ * to `chat()`. The model emits tool calls during the agent loop and a
225
+ * schema-matching JSON message on the natural final turn — no separate
226
+ * finalization round-trip needed.
227
+ *
228
+ * The SDK type (`BetaOutputConfig`) currently exposes only `effort`;
229
+ * `format` is accepted at runtime per the deprecation notice on the
230
+ * older `output_format` field
231
+ * (https://platform.claude.com/docs/en/build-with-claude/structured-outputs).
232
+ * We type it explicitly here so the adapter call site doesn't need a
233
+ * cast.
234
+ */
235
+ output_config?: {
236
+ effort?: 'low' | 'medium' | 'high' | 'max' | null;
237
+ format?: {
238
+ type: 'json_schema';
239
+ schema: Record<string, unknown>;
240
+ };
241
+ };
242
+ }
243
+ export interface CacheControl {
244
+ type: 'ephemeral';
245
+ ttl: '5m' | '1h';
246
+ }
247
+ interface MCPServer {
248
+ name: string;
249
+ url: string;
250
+ type: 'url';
251
+ authorization_token?: string | null;
252
+ tool_configuration: {
253
+ allowed_tools?: Array<string> | null;
254
+ enabled?: boolean | null;
255
+ } | null;
256
+ }
257
+ export declare const validateTextProviderOptions: (options: InternalTextProviderOptions) => void;
258
+ export {};
@@ -0,0 +1,30 @@
1
+ const validateTopPandTemperature = (options) => {
2
+ if (options.top_p !== void 0 && options.temperature !== void 0) {
3
+ throw new Error("You should either set top_p or temperature, but not both.");
4
+ }
5
+ };
6
+ const validateThinking = (options) => {
7
+ const thinking = options.thinking;
8
+ if (thinking && thinking.type === "enabled") {
9
+ if (thinking.budget_tokens < 1024) {
10
+ throw new Error("thinking.budget_tokens must be at least 1024.");
11
+ }
12
+ if (thinking.budget_tokens >= options.max_tokens) {
13
+ throw new Error("thinking.budget_tokens must be less than max_tokens.");
14
+ }
15
+ }
16
+ };
17
+ const validateMaxTokens = (options) => {
18
+ if (options.max_tokens < 1) {
19
+ throw new Error("max_tokens must be at least 1.");
20
+ }
21
+ };
22
+ const validateTextProviderOptions = (options) => {
23
+ validateTopPandTemperature(options);
24
+ validateThinking(options);
25
+ validateMaxTokens(options);
26
+ };
27
+ export {
28
+ validateTextProviderOptions
29
+ };
30
+ //# sourceMappingURL=text-provider-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-provider-options.js","sources":["../../../src/text/text-provider-options.ts"],"sourcesContent":["import type {\n BetaContextManagementConfig,\n BetaToolChoiceAny,\n BetaToolChoiceAuto,\n BetaToolChoiceTool,\n} from '@anthropic-ai/sdk/resources/beta/messages/messages'\nimport type { CacheControlEphemeral } from '@anthropic-ai/sdk/resources'\nimport type { AnthropicContainerSkill, AnthropicTool } from '../tools'\nimport type {\n MessageParam,\n TextBlockParam,\n} from '@anthropic-ai/sdk/resources/messages'\n\n/**\n * Per-prompt metadata Anthropic understands on `systemPrompts` entries.\n *\n * Used via the structured form of `systemPrompts`:\n *\n * @example\n * import type { AnthropicSystemPromptMetadata } from '@tanstack/ai-anthropic'\n *\n * chat({\n * adapter: anthropicText(),\n * model: 'claude-sonnet-4-6',\n * systemPrompts: [\n * {\n * content: 'Stable instructions — cache me.',\n * metadata: { cache_control: { type: 'ephemeral' } } satisfies AnthropicSystemPromptMetadata,\n * },\n * 'Volatile per-request instruction.',\n * ],\n * })\n */\nexport interface AnthropicSystemPromptMetadata {\n /**\n * Anthropic prompt-caching control applied to this system prompt's\n * `TextBlockParam`.\n *\n * @see https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching\n */\n cache_control?: CacheControlEphemeral\n}\n\nexport interface AnthropicContainerOptions {\n /**\n * Container identifier for reuse across requests.\n * Container parameters with skills to be loaded.\n */\n container?: {\n id: string | null\n /**\n * List of skills to load into the container.\n *\n * @deprecated Configure skills on the `code_execution` tool instead:\n * `codeExecutionTool(config, { skills })`. The adapter lifts those into\n * `container.skills` and attaches the required beta headers. Setting\n * skills here bypasses the beta-header wiring and may stop working.\n */\n skills: Array<AnthropicContainerSkill> | null\n } | null\n}\n\nexport interface AnthropicContextManagementOptions {\n /**\n * Context management configuration.\n\nThis allows you to control how Claude manages context across multiple requests, such as whether to clear function results or not.\n */\n context_management?: BetaContextManagementConfig | null\n}\n\nexport interface AnthropicMCPOptions {\n /**\n * MCP servers to be utilized in this request\n * Maximum of 20 servers\n */\n mcp_servers?: Array<MCPServer>\n}\n\nexport interface AnthropicServiceTierOptions {\n /**\n * Determines whether to use priority capacity (if available) or standard capacity for this request.\n */\n service_tier?: 'auto' | 'standard_only'\n}\n\nexport interface AnthropicStopSequencesOptions {\n /**\n * Custom text sequences that will cause the model to stop generating.\n\nAnthropic models will normally stop when they have naturally completed their turn, which will result in a response stop_reason of \"end_turn\".\n\nIf you want the model to stop generating when it encounters custom strings of text, you can use the stop_sequences parameter. If the model encounters one of the custom sequences, the response stop_reason value will be \"stop_sequence\" and the response stop_sequence value will contain the matched stop sequence.\n */\n stop_sequences?: Array<string>\n}\n\nexport interface AnthropicThinkingOptions {\n /**\n * Configuration for enabling Claude's extended thinking.\n\nWhen enabled, responses include thinking content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your max_tokens limit.\n */\n thinking?:\n | {\n /**\n* Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality.\n\nMust be ≥1024 and less than max_tokens\n*/\n budget_tokens: number\n\n type: 'enabled'\n }\n | {\n type: 'disabled'\n }\n}\n\nexport interface AnthropicAdaptiveThinkingOptions {\n /**\n * Configuration for Claude's adaptive thinking (Opus 4.6+).\n *\n * In adaptive mode, Claude dynamically decides when and how much to think.\n * Use the effort parameter to control thinking depth.\n * `thinking: {type: \"enabled\"}` with `budget_tokens` is deprecated on Opus 4.6.\n */\n thinking?:\n | {\n type: 'adaptive'\n /**\n * Controls what (if any) thinking content is streamed back.\n *\n * - `'summarized'`: stream summarized thinking via `thinking_delta`\n * events (the user-visible reasoning text).\n * - `'omitted'`: stream the thinking block's `signature_delta` only\n * (no reasoning text reaches the client).\n *\n * On Claude Opus 4.6 the default is `'summarized'`. On\n * Claude Opus 4.7 the default flipped to `'omitted'` — callers\n * must set `'summarized'` explicitly to get the reasoning text.\n */\n display?: 'summarized' | 'omitted'\n }\n | {\n /**\n * @deprecated Use `type: 'adaptive'` with the effort parameter on Opus 4.6+.\n */\n budget_tokens: number\n type: 'enabled'\n }\n | {\n type: 'disabled'\n }\n}\n\nexport interface AnthropicEffortOptions {\n /**\n * Controls the thinking depth for adaptive thinking mode (Opus 4.6+).\n *\n * - `max`: Absolute highest capability\n * - `high`: Default - Claude will almost always think\n * - `medium`: Balanced cost-quality\n * - `low`: May skip thinking for simpler problems\n */\n effort?: 'max' | 'high' | 'medium' | 'low'\n}\n\nexport interface AnthropicOutputConfigOptions {\n /**\n * Output configuration for the model's response.\n *\n * On Claude 4.7+ the top-level `effort` field was relocated under\n * `output_config.effort`, and `thinking: { type: 'enabled', budget_tokens }`\n * was replaced by `thinking: { type: 'adaptive' }` paired with\n * `output_config.effort`. Earlier models continue to accept the legacy\n * top-level `effort` / `thinking.type: 'enabled'` shape.\n *\n * The engine also writes `output_config.format` here when the caller\n * passes `outputSchema` to a Claude 4.5+ adapter (issue #605 native\n * combined mode). Both fields coexist: user-supplied `effort` is\n * preserved when the engine adds `format`.\n */\n output_config?: {\n effort?: 'low' | 'medium' | 'high' | 'max' | null\n }\n}\n\nexport interface AnthropicToolChoiceOptions {\n tool_choice?: BetaToolChoiceAny | BetaToolChoiceTool | BetaToolChoiceAuto\n}\n\nexport interface AnthropicSamplingOptions {\n /**\n * Only sample from the top K options for each subsequent token.\n\nUsed to remove \"long tail\" low probability responses.\nRecommended for advanced use cases only. You usually only need to use temperature.\n\nRequired range: x >= 0\n */\n top_k?: number\n /**\n * Amount of randomness injected into the response.\n * Either use this or top_p, but not both.\n * Defaults to 1.0. Ranges from 0.0 to 1.0. Use temperature closer to 0.0 for analytical / multiple choice, and closer to 1.0 for creative and generative tasks.\n * @default 1.0\n */\n temperature?: number\n /**\n * Use nucleus sampling.\n *\n * In nucleus sampling, we compute the cumulative distribution over all the options for each subsequent token in decreasing probability order and cut it off once it reaches a particular probability specified by top_p. You should either alter temperature or top_p, but not both.\n */\n top_p?: number\n /**\n * The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate. Required by the API; the adapter defaults to 1024 when omitted.\n * Range x >= 1.\n */\n max_tokens?: number\n}\n\nexport type ExternalTextProviderOptions = AnthropicContainerOptions &\n AnthropicContextManagementOptions &\n AnthropicMCPOptions &\n AnthropicServiceTierOptions &\n AnthropicStopSequencesOptions &\n AnthropicThinkingOptions &\n AnthropicToolChoiceOptions &\n AnthropicSamplingOptions &\n Partial<AnthropicAdaptiveThinkingOptions> &\n Partial<AnthropicEffortOptions> &\n Partial<AnthropicOutputConfigOptions>\n\nexport interface InternalTextProviderOptions extends ExternalTextProviderOptions {\n model: string\n\n messages: Array<MessageParam>\n\n /**\n * The maximum number of tokens to generate before stopping. This parameter only specifies the absolute maximum number of tokens to generate.\n * Range x >= 1.\n */\n max_tokens: number\n /**\n * Whether to incrementally stream the response using server-sent events.\n */\n stream?: boolean\n /**\n * System prompt — built by the adapter from the user-facing\n * `systemPrompts: Array<string>` on the chat call. This field is internal:\n * users should pass system prompts via `systemPrompts`, not via\n * `modelOptions`.\n *\n * A system prompt is a way of providing context and instructions to Claude,\n * such as specifying a particular goal or role.\n */\n system?: string | Array<TextBlockParam>\n\n tools?: Array<AnthropicTool>\n\n /**\n * Schema-constrained final answer in a single Messages request (issue\n * #605). Set by the engine when the adapter declared\n * `supportsCombinedToolsAndSchema` and a caller passed `outputSchema`\n * to `chat()`. The model emits tool calls during the agent loop and a\n * schema-matching JSON message on the natural final turn — no separate\n * finalization round-trip needed.\n *\n * The SDK type (`BetaOutputConfig`) currently exposes only `effort`;\n * `format` is accepted at runtime per the deprecation notice on the\n * older `output_format` field\n * (https://platform.claude.com/docs/en/build-with-claude/structured-outputs).\n * We type it explicitly here so the adapter call site doesn't need a\n * cast.\n */\n output_config?: {\n effort?: 'low' | 'medium' | 'high' | 'max' | null\n format?: {\n type: 'json_schema'\n schema: Record<string, unknown>\n }\n }\n}\n\nconst validateTopPandTemperature = (options: InternalTextProviderOptions) => {\n if (options.top_p !== undefined && options.temperature !== undefined) {\n throw new Error('You should either set top_p or temperature, but not both.')\n }\n}\n\nexport interface CacheControl {\n type: 'ephemeral'\n ttl: '5m' | '1h'\n}\n\nconst validateThinking = (options: InternalTextProviderOptions) => {\n const thinking = options.thinking\n if (thinking && thinking.type === 'enabled') {\n if (thinking.budget_tokens < 1024) {\n throw new Error('thinking.budget_tokens must be at least 1024.')\n }\n if (thinking.budget_tokens >= options.max_tokens) {\n throw new Error('thinking.budget_tokens must be less than max_tokens.')\n }\n }\n}\n\ninterface MCPServer {\n name: string\n url: string\n type: 'url'\n authorization_token?: string | null\n tool_configuration: {\n allowed_tools?: Array<string> | null\n enabled?: boolean | null\n } | null\n}\n\nconst validateMaxTokens = (options: InternalTextProviderOptions) => {\n if (options.max_tokens < 1) {\n throw new Error('max_tokens must be at least 1.')\n }\n}\n\nexport const validateTextProviderOptions = (\n options: InternalTextProviderOptions,\n) => {\n validateTopPandTemperature(options)\n validateThinking(options)\n validateMaxTokens(options)\n}\n"],"names":[],"mappings":"AA6RA,MAAM,6BAA6B,CAAC,YAAyC;AAC3E,MAAI,QAAQ,UAAU,UAAa,QAAQ,gBAAgB,QAAW;AACpE,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC7E;AACF;AAOA,MAAM,mBAAmB,CAAC,YAAyC;AACjE,QAAM,WAAW,QAAQ;AACzB,MAAI,YAAY,SAAS,SAAS,WAAW;AAC3C,QAAI,SAAS,gBAAgB,MAAM;AACjC,YAAM,IAAI,MAAM,+CAA+C;AAAA,IACjE;AACA,QAAI,SAAS,iBAAiB,QAAQ,YAAY;AAChD,YAAM,IAAI,MAAM,sDAAsD;AAAA,IACxE;AAAA,EACF;AACF;AAaA,MAAM,oBAAoB,CAAC,YAAyC;AAClE,MAAI,QAAQ,aAAa,GAAG;AAC1B,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACF;AAEO,MAAM,8BAA8B,CACzC,YACG;AACH,6BAA2B,OAAO;AAClC,mBAAiB,OAAO;AACxB,oBAAkB,OAAO;AAC3B;"}
@@ -0,0 +1,8 @@
1
+ import { BetaToolBash20241022, BetaToolBash20250124 } from '@anthropic-ai/sdk/resources/beta';
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type BashToolConfig = BetaToolBash20241022 | BetaToolBash20250124;
4
+ /** @deprecated Renamed to `BashToolConfig`. Will be removed in a future release. */
5
+ export type BashTool = BashToolConfig;
6
+ export type AnthropicBashTool = ProviderTool<'anthropic', 'bash'>;
7
+ export declare function convertBashToolToAdapterFormat(tool: Tool): BashToolConfig;
8
+ export declare function bashTool(config: BashToolConfig): AnthropicBashTool;
@@ -0,0 +1,17 @@
1
+ import { brandProviderTool } from "@tanstack/ai";
2
+ function convertBashToolToAdapterFormat(tool) {
3
+ const metadata = tool.metadata;
4
+ return metadata;
5
+ }
6
+ function bashTool(config) {
7
+ return brandProviderTool({
8
+ name: "bash",
9
+ description: "",
10
+ metadata: config
11
+ });
12
+ }
13
+ export {
14
+ bashTool,
15
+ convertBashToolToAdapterFormat
16
+ };
17
+ //# sourceMappingURL=bash-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bash-tool.js","sources":["../../../src/tools/bash-tool.ts"],"sourcesContent":["import { brandProviderTool } from '@tanstack/ai'\nimport type {\n BetaToolBash20241022,\n BetaToolBash20250124,\n} from '@anthropic-ai/sdk/resources/beta'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type BashToolConfig = BetaToolBash20241022 | BetaToolBash20250124\n\n/** @deprecated Renamed to `BashToolConfig`. Will be removed in a future release. */\nexport type BashTool = BashToolConfig\n\nexport type AnthropicBashTool = ProviderTool<'anthropic', 'bash'>\n\nexport function convertBashToolToAdapterFormat(tool: Tool): BashToolConfig {\n const metadata = tool.metadata as BashToolConfig\n return metadata\n}\n\nexport function bashTool(config: BashToolConfig): AnthropicBashTool {\n return brandProviderTool<AnthropicBashTool>({\n name: 'bash',\n description: '',\n metadata: config,\n })\n}\n"],"names":[],"mappings":";AAcO,SAAS,+BAA+B,MAA4B;AACzE,QAAM,WAAW,KAAK;AACtB,SAAO;AACT;AAEO,SAAS,SAAS,QAA2C;AAClE,SAAO,kBAAqC;AAAA,IAC1C,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA,CACX;AACH;"}
@@ -0,0 +1,34 @@
1
+ import { BetaCodeExecutionTool20250522, BetaCodeExecutionTool20250825 } from '@anthropic-ai/sdk/resources/beta';
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type CodeExecutionToolConfig = BetaCodeExecutionTool20250522 | BetaCodeExecutionTool20250825;
4
+ /** @deprecated Renamed to `CodeExecutionToolConfig`. Will be removed in a future release. */
5
+ export type CodeExecutionTool = CodeExecutionToolConfig;
6
+ /**
7
+ * A hosted/managed Anthropic Skill reference. Lifted by the text adapter into
8
+ * the top-level `container.skills` request param (NOT serialized into the
9
+ * `tools[]` entry). Requires the `code_execution` tool to be enabled.
10
+ */
11
+ export interface AnthropicContainerSkill {
12
+ /** 1–64 characters. */
13
+ skill_id: string;
14
+ type: 'anthropic' | 'custom';
15
+ /** Skill version, or `'latest'` (default) when omitted. */
16
+ version?: string;
17
+ }
18
+ export interface CodeExecutionToolOptions {
19
+ /** Hosted skills to load into the code-execution container (max 8). */
20
+ skills?: Array<AnthropicContainerSkill>;
21
+ }
22
+ export type AnthropicCodeExecutionTool = ProviderTool<'anthropic', 'code_execution'>;
23
+ export declare function convertCodeExecutionToolToAdapterFormat(tool: Tool): CodeExecutionToolConfig;
24
+ /**
25
+ * Reads the SDK tool config attached to a `code_execution` tool, if any.
26
+ * Used by the text adapter to select the version-aware code-execution beta.
27
+ */
28
+ export declare function readCodeExecutionConfig(tool: Tool): CodeExecutionToolConfig | undefined;
29
+ /**
30
+ * Reads the hosted skills attached to a `code_execution` tool, if any.
31
+ * Used by the text adapter to build the top-level `container.skills` param.
32
+ */
33
+ export declare function readCodeExecutionSkills(tool: Tool): Array<AnthropicContainerSkill> | undefined;
34
+ export declare function codeExecutionTool(config: CodeExecutionToolConfig, options?: CodeExecutionToolOptions): AnthropicCodeExecutionTool;
@@ -0,0 +1,39 @@
1
+ import { brandProviderTool } from "@tanstack/ai";
2
+ function convertCodeExecutionToolToAdapterFormat(tool) {
3
+ return readCodeExecutionConfig(tool);
4
+ }
5
+ function readCodeExecutionConfig(tool) {
6
+ return tool.metadata?.config;
7
+ }
8
+ function readCodeExecutionSkills(tool) {
9
+ return tool.metadata?.skills;
10
+ }
11
+ function codeExecutionTool(config, options = {}) {
12
+ const { skills } = options;
13
+ if (skills) {
14
+ if (skills.length > 8) {
15
+ throw new Error("code_execution supports at most 8 skills per request.");
16
+ }
17
+ for (const skill of skills) {
18
+ if (skill.skill_id.length < 1 || skill.skill_id.length > 64) {
19
+ throw new Error("skill_id must be between 1 and 64 characters.");
20
+ }
21
+ }
22
+ }
23
+ const metadata = {
24
+ config,
25
+ ...skills && { skills }
26
+ };
27
+ return brandProviderTool({
28
+ name: "code_execution",
29
+ description: "",
30
+ metadata
31
+ });
32
+ }
33
+ export {
34
+ codeExecutionTool,
35
+ convertCodeExecutionToolToAdapterFormat,
36
+ readCodeExecutionConfig,
37
+ readCodeExecutionSkills
38
+ };
39
+ //# sourceMappingURL=code-execution-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-execution-tool.js","sources":["../../../src/tools/code-execution-tool.ts"],"sourcesContent":["import { brandProviderTool } from '@tanstack/ai'\nimport type {\n BetaCodeExecutionTool20250522,\n BetaCodeExecutionTool20250825,\n} from '@anthropic-ai/sdk/resources/beta'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type CodeExecutionToolConfig =\n | BetaCodeExecutionTool20250522\n | BetaCodeExecutionTool20250825\n\n/** @deprecated Renamed to `CodeExecutionToolConfig`. Will be removed in a future release. */\nexport type CodeExecutionTool = CodeExecutionToolConfig\n\n/**\n * A hosted/managed Anthropic Skill reference. Lifted by the text adapter into\n * the top-level `container.skills` request param (NOT serialized into the\n * `tools[]` entry). Requires the `code_execution` tool to be enabled.\n */\nexport interface AnthropicContainerSkill {\n /** 1–64 characters. */\n skill_id: string\n type: 'anthropic' | 'custom'\n /** Skill version, or `'latest'` (default) when omitted. */\n version?: string\n}\n\nexport interface CodeExecutionToolOptions {\n /** Hosted skills to load into the code-execution container (max 8). */\n skills?: Array<AnthropicContainerSkill>\n}\n\ninterface CodeExecutionToolMetadata {\n config: CodeExecutionToolConfig\n skills?: Array<AnthropicContainerSkill>\n}\n\nexport type AnthropicCodeExecutionTool = ProviderTool<\n 'anthropic',\n 'code_execution'\n>\n\nexport function convertCodeExecutionToolToAdapterFormat(\n tool: Tool,\n): CodeExecutionToolConfig {\n // The converter is only called for real `code_execution` tools, so a\n // non-undefined config is expected — but read via optional chaining so an\n // absent metadata object doesn't throw.\n return readCodeExecutionConfig(tool) as CodeExecutionToolConfig\n}\n\n/**\n * Reads the SDK tool config attached to a `code_execution` tool, if any.\n * Used by the text adapter to select the version-aware code-execution beta.\n */\nexport function readCodeExecutionConfig(\n tool: Tool,\n): CodeExecutionToolConfig | undefined {\n return (tool.metadata as CodeExecutionToolMetadata | undefined)?.config\n}\n\n/**\n * Reads the hosted skills attached to a `code_execution` tool, if any.\n * Used by the text adapter to build the top-level `container.skills` param.\n */\nexport function readCodeExecutionSkills(\n tool: Tool,\n): Array<AnthropicContainerSkill> | undefined {\n return (tool.metadata as CodeExecutionToolMetadata | undefined)?.skills\n}\n\nexport function codeExecutionTool(\n config: CodeExecutionToolConfig,\n options: CodeExecutionToolOptions = {},\n): AnthropicCodeExecutionTool {\n const { skills } = options\n if (skills) {\n if (skills.length > 8) {\n throw new Error('code_execution supports at most 8 skills per request.')\n }\n for (const skill of skills) {\n if (skill.skill_id.length < 1 || skill.skill_id.length > 64) {\n throw new Error('skill_id must be between 1 and 64 characters.')\n }\n }\n }\n const metadata: CodeExecutionToolMetadata = {\n config,\n ...(skills && { skills }),\n }\n return brandProviderTool<AnthropicCodeExecutionTool>({\n name: 'code_execution',\n description: '',\n metadata,\n })\n}\n"],"names":[],"mappings":";AA0CO,SAAS,wCACd,MACyB;AAIzB,SAAO,wBAAwB,IAAI;AACrC;AAMO,SAAS,wBACd,MACqC;AACrC,SAAQ,KAAK,UAAoD;AACnE;AAMO,SAAS,wBACd,MAC4C;AAC5C,SAAQ,KAAK,UAAoD;AACnE;AAEO,SAAS,kBACd,QACA,UAAoC,IACR;AAC5B,QAAM,EAAE,WAAW;AACnB,MAAI,QAAQ;AACV,QAAI,OAAO,SAAS,GAAG;AACrB,YAAM,IAAI,MAAM,uDAAuD;AAAA,IACzE;AACA,eAAW,SAAS,QAAQ;AAC1B,UAAI,MAAM,SAAS,SAAS,KAAK,MAAM,SAAS,SAAS,IAAI;AAC3D,cAAM,IAAI,MAAM,+CAA+C;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AACA,QAAM,WAAsC;AAAA,IAC1C;AAAA,IACA,GAAI,UAAU,EAAE,OAAA;AAAA,EAAO;AAEzB,SAAO,kBAA8C;AAAA,IACnD,MAAM;AAAA,IACN,aAAa;AAAA,IACb;AAAA,EAAA,CACD;AACH;"}
@@ -0,0 +1,8 @@
1
+ import { BetaToolComputerUse20241022, BetaToolComputerUse20250124 } from '@anthropic-ai/sdk/resources/beta';
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type ComputerUseToolConfig = BetaToolComputerUse20241022 | BetaToolComputerUse20250124;
4
+ /** @deprecated Renamed to `ComputerUseToolConfig`. Will be removed in a future release. */
5
+ export type ComputerUseTool = ComputerUseToolConfig;
6
+ export type AnthropicComputerUseTool = ProviderTool<'anthropic', 'computer_use'>;
7
+ export declare function convertComputerUseToolToAdapterFormat(tool: Tool): ComputerUseToolConfig;
8
+ export declare function computerUseTool(config: ComputerUseToolConfig): AnthropicComputerUseTool;
@@ -0,0 +1,17 @@
1
+ import { brandProviderTool } from "@tanstack/ai";
2
+ function convertComputerUseToolToAdapterFormat(tool) {
3
+ const metadata = tool.metadata;
4
+ return metadata;
5
+ }
6
+ function computerUseTool(config) {
7
+ return brandProviderTool({
8
+ name: "computer",
9
+ description: "",
10
+ metadata: config
11
+ });
12
+ }
13
+ export {
14
+ computerUseTool,
15
+ convertComputerUseToolToAdapterFormat
16
+ };
17
+ //# sourceMappingURL=computer-use-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computer-use-tool.js","sources":["../../../src/tools/computer-use-tool.ts"],"sourcesContent":["import { brandProviderTool } from '@tanstack/ai'\nimport type {\n BetaToolComputerUse20241022,\n BetaToolComputerUse20250124,\n} from '@anthropic-ai/sdk/resources/beta'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type ComputerUseToolConfig =\n | BetaToolComputerUse20241022\n | BetaToolComputerUse20250124\n\n/** @deprecated Renamed to `ComputerUseToolConfig`. Will be removed in a future release. */\nexport type ComputerUseTool = ComputerUseToolConfig\n\nexport type AnthropicComputerUseTool = ProviderTool<'anthropic', 'computer_use'>\n\nexport function convertComputerUseToolToAdapterFormat(\n tool: Tool,\n): ComputerUseToolConfig {\n const metadata = tool.metadata as ComputerUseToolConfig\n return metadata\n}\n\nexport function computerUseTool(\n config: ComputerUseToolConfig,\n): AnthropicComputerUseTool {\n return brandProviderTool<AnthropicComputerUseTool>({\n name: 'computer',\n description: '',\n metadata: config,\n })\n}\n"],"names":[],"mappings":";AAgBO,SAAS,sCACd,MACuB;AACvB,QAAM,WAAW,KAAK;AACtB,SAAO;AACT;AAEO,SAAS,gBACd,QAC0B;AAC1B,SAAO,kBAA4C;AAAA,IACjD,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA,CACX;AACH;"}
@@ -0,0 +1,26 @@
1
+ import { SchemaInput, Tool } from '@tanstack/ai';
2
+ import { CacheControl } from '../text/text-provider-options.js';
3
+ export interface CustomToolConfig {
4
+ /**
5
+ * The name of the tool.
6
+ */
7
+ name: string;
8
+ type: 'custom';
9
+ /**
10
+ * A brief description of what the tool does. Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.
11
+ */
12
+ description: string;
13
+ /**
14
+ * This defines the shape of the input that your tool accepts and that the model will produce.
15
+ */
16
+ input_schema: {
17
+ type: 'object';
18
+ properties: Record<string, any> | null;
19
+ required?: Array<string> | null;
20
+ };
21
+ cache_control?: CacheControl | null;
22
+ }
23
+ /** @deprecated Renamed to `CustomToolConfig`. Will be removed in a future release. */
24
+ export type CustomTool = CustomToolConfig;
25
+ export declare function convertCustomToolToAdapterFormat(tool: Tool): CustomToolConfig;
26
+ export declare function customTool(name: string, description: string, inputSchema: SchemaInput, cacheControl?: CacheControl | null): Tool;
@@ -0,0 +1,34 @@
1
+ function convertCustomToolToAdapterFormat(tool) {
2
+ const metadata = tool.metadata || {};
3
+ const jsonSchema = tool.inputSchema ?? {
4
+ properties: {},
5
+ required: []
6
+ };
7
+ const inputSchema = {
8
+ type: "object",
9
+ properties: jsonSchema.properties || null,
10
+ required: jsonSchema.required || null
11
+ };
12
+ return {
13
+ name: tool.name,
14
+ type: "custom",
15
+ description: tool.description,
16
+ input_schema: inputSchema,
17
+ cache_control: metadata.cacheControl || null
18
+ };
19
+ }
20
+ function customTool(name, description, inputSchema, cacheControl) {
21
+ return {
22
+ name,
23
+ description,
24
+ inputSchema,
25
+ metadata: {
26
+ cacheControl
27
+ }
28
+ };
29
+ }
30
+ export {
31
+ convertCustomToolToAdapterFormat,
32
+ customTool
33
+ };
34
+ //# sourceMappingURL=custom-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-tool.js","sources":["../../../src/tools/custom-tool.ts"],"sourcesContent":["import type { JSONSchema, SchemaInput, Tool } from '@tanstack/ai'\nimport type { CacheControl } from '../text/text-provider-options'\n\nexport interface CustomToolConfig {\n /**\n * The name of the tool.\n */\n name: string\n type: 'custom'\n /**\n * A brief description of what the tool does. Tool descriptions should be as detailed as possible. The more information that the model has about what the tool is and how to use it, the better it will perform. You can use natural language descriptions to reinforce important aspects of the tool input JSON schema.\n */\n description: string\n /**\n * This defines the shape of the input that your tool accepts and that the model will produce.\n */\n input_schema: {\n type: 'object'\n properties: Record<string, any> | null\n required?: Array<string> | null\n }\n\n cache_control?: CacheControl | null\n}\n\n/** @deprecated Renamed to `CustomToolConfig`. Will be removed in a future release. */\nexport type CustomTool = CustomToolConfig\n\nexport function convertCustomToolToAdapterFormat(tool: Tool): CustomToolConfig {\n const metadata =\n (tool.metadata as { cacheControl?: CacheControl | null } | undefined) || {}\n\n const jsonSchema = (tool.inputSchema ?? {\n type: 'object',\n properties: {},\n required: [],\n }) as JSONSchema\n\n const inputSchema = {\n type: 'object' as const,\n properties: jsonSchema.properties || null,\n required: jsonSchema.required || null,\n }\n\n return {\n name: tool.name,\n type: 'custom',\n description: tool.description,\n input_schema: inputSchema,\n cache_control: metadata.cacheControl || null,\n }\n}\n\nexport function customTool(\n name: string,\n description: string,\n inputSchema: SchemaInput,\n cacheControl?: CacheControl | null,\n): Tool {\n return {\n name,\n description,\n inputSchema,\n metadata: {\n cacheControl,\n },\n }\n}\n"],"names":[],"mappings":"AA4BO,SAAS,iCAAiC,MAA8B;AAC7E,QAAM,WACH,KAAK,YAAmE,CAAA;AAE3E,QAAM,aAAc,KAAK,eAAe;AAAA,IAEtC,YAAY,CAAA;AAAA,IACZ,UAAU,CAAA;AAAA,EAAC;AAGb,QAAM,cAAc;AAAA,IAClB,MAAM;AAAA,IACN,YAAY,WAAW,cAAc;AAAA,IACrC,UAAU,WAAW,YAAY;AAAA,EAAA;AAGnC,SAAO;AAAA,IACL,MAAM,KAAK;AAAA,IACX,MAAM;AAAA,IACN,aAAa,KAAK;AAAA,IAClB,cAAc;AAAA,IACd,eAAe,SAAS,gBAAgB;AAAA,EAAA;AAE5C;AAEO,SAAS,WACd,MACA,aACA,aACA,cACM;AACN,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU;AAAA,MACR;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -0,0 +1,17 @@
1
+ import { BashTool } from './bash-tool.js';
2
+ import { CodeExecutionTool } from './code-execution-tool.js';
3
+ import { ComputerUseTool } from './computer-use-tool.js';
4
+ import { CustomTool } from './custom-tool.js';
5
+ import { MemoryTool } from './memory-tool.js';
6
+ import { TextEditorTool } from './text-editor-tool.js';
7
+ import { WebFetchTool } from './web-fetch-tool.js';
8
+ import { WebSearchTool } from './web-search-tool.js';
9
+ export { bashTool, type AnthropicBashTool, type BashToolConfig, type BashTool, } from './bash-tool.js';
10
+ export { codeExecutionTool, convertCodeExecutionToolToAdapterFormat, readCodeExecutionConfig, readCodeExecutionSkills, type AnthropicCodeExecutionTool, type AnthropicContainerSkill, type CodeExecutionToolConfig, type CodeExecutionToolOptions, type CodeExecutionTool, } from './code-execution-tool.js';
11
+ export { computerUseTool, type AnthropicComputerUseTool, type ComputerUseToolConfig, type ComputerUseTool, } from './computer-use-tool.js';
12
+ export { customTool, type CustomToolConfig, type CustomTool, } from './custom-tool.js';
13
+ export { memoryTool, type AnthropicMemoryTool, type MemoryToolConfig, type MemoryTool, } from './memory-tool.js';
14
+ export { textEditorTool, type AnthropicTextEditorTool, type TextEditorToolConfig, type TextEditorTool, } from './text-editor-tool.js';
15
+ export { webFetchTool, type AnthropicWebFetchTool, type WebFetchToolConfig, type WebFetchTool, } from './web-fetch-tool.js';
16
+ export { webSearchTool, type AnthropicWebSearchTool, type WebSearchToolConfig, type WebSearchTool, } from './web-search-tool.js';
17
+ export type AnthropicTool = BashTool | CodeExecutionTool | ComputerUseTool | CustomTool | MemoryTool | TextEditorTool | WebFetchTool | WebSearchTool;
@@ -0,0 +1,22 @@
1
+ import { bashTool } from "./bash-tool.js";
2
+ import { codeExecutionTool, convertCodeExecutionToolToAdapterFormat, readCodeExecutionConfig, readCodeExecutionSkills } from "./code-execution-tool.js";
3
+ import { computerUseTool } from "./computer-use-tool.js";
4
+ import { customTool } from "./custom-tool.js";
5
+ import { memoryTool } from "./memory-tool.js";
6
+ import { textEditorTool } from "./text-editor-tool.js";
7
+ import { webFetchTool } from "./web-fetch-tool.js";
8
+ import { webSearchTool } from "./web-search-tool.js";
9
+ export {
10
+ bashTool,
11
+ codeExecutionTool,
12
+ computerUseTool,
13
+ convertCodeExecutionToolToAdapterFormat,
14
+ customTool,
15
+ memoryTool,
16
+ readCodeExecutionConfig,
17
+ readCodeExecutionSkills,
18
+ textEditorTool,
19
+ webFetchTool,
20
+ webSearchTool
21
+ };
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ import { BetaMemoryTool20250818 } from '@anthropic-ai/sdk/resources/beta';
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type MemoryToolConfig = BetaMemoryTool20250818;
4
+ /** @deprecated Renamed to `MemoryToolConfig`. Will be removed in a future release. */
5
+ export type MemoryTool = MemoryToolConfig;
6
+ export type AnthropicMemoryTool = ProviderTool<'anthropic', 'memory'>;
7
+ export declare function convertMemoryToolToAdapterFormat(tool: Tool): MemoryToolConfig;
8
+ export declare function memoryTool(config?: MemoryToolConfig): AnthropicMemoryTool;
@@ -0,0 +1,20 @@
1
+ import { brandProviderTool } from "@tanstack/ai";
2
+ function convertMemoryToolToAdapterFormat(tool) {
3
+ const metadata = tool.metadata;
4
+ return {
5
+ type: "memory_20250818",
6
+ ...metadata
7
+ };
8
+ }
9
+ function memoryTool(config) {
10
+ return brandProviderTool({
11
+ name: "memory",
12
+ description: "",
13
+ metadata: config
14
+ });
15
+ }
16
+ export {
17
+ convertMemoryToolToAdapterFormat,
18
+ memoryTool
19
+ };
20
+ //# sourceMappingURL=memory-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-tool.js","sources":["../../../src/tools/memory-tool.ts"],"sourcesContent":["import { brandProviderTool } from '@tanstack/ai'\nimport type { BetaMemoryTool20250818 } from '@anthropic-ai/sdk/resources/beta'\nimport type { ProviderTool, Tool } from '@tanstack/ai'\n\nexport type MemoryToolConfig = BetaMemoryTool20250818\n\n/** @deprecated Renamed to `MemoryToolConfig`. Will be removed in a future release. */\nexport type MemoryTool = MemoryToolConfig\n\nexport type AnthropicMemoryTool = ProviderTool<'anthropic', 'memory'>\n\nexport function convertMemoryToolToAdapterFormat(tool: Tool): MemoryToolConfig {\n const metadata = tool.metadata as Omit<MemoryToolConfig, 'type'>\n return {\n type: 'memory_20250818',\n ...metadata,\n }\n}\n\nexport function memoryTool(config?: MemoryToolConfig): AnthropicMemoryTool {\n return brandProviderTool<AnthropicMemoryTool>({\n name: 'memory',\n description: '',\n metadata: config,\n })\n}\n"],"names":[],"mappings":";AAWO,SAAS,iCAAiC,MAA8B;AAC7E,QAAM,WAAW,KAAK;AACtB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,GAAG;AAAA,EAAA;AAEP;AAEO,SAAS,WAAW,QAAgD;AACzE,SAAO,kBAAuC;AAAA,IAC5C,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EAAA,CACX;AACH;"}
@@ -0,0 +1,8 @@
1
+ import { ToolTextEditor20250124, ToolTextEditor20250429, ToolTextEditor20250728 } from '@anthropic-ai/sdk/resources/messages';
2
+ import { ProviderTool, Tool } from '@tanstack/ai';
3
+ export type TextEditorToolConfig = ToolTextEditor20250124 | ToolTextEditor20250429 | ToolTextEditor20250728;
4
+ /** @deprecated Renamed to `TextEditorToolConfig`. Will be removed in a future release. */
5
+ export type TextEditorTool = TextEditorToolConfig;
6
+ export type AnthropicTextEditorTool = ProviderTool<'anthropic', 'text_editor'>;
7
+ export declare function convertTextEditorToolToAdapterFormat(tool: Tool): TextEditorToolConfig;
8
+ export declare function textEditorTool<T extends TextEditorToolConfig>(config: T): AnthropicTextEditorTool;