@boostecom/provider 0.0.1
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.
- package/README.md +90 -0
- package/dist/index.cjs +2522 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +848 -0
- package/dist/index.d.ts +848 -0
- package/dist/index.js +2484 -0
- package/dist/index.js.map +1 -0
- package/docs/content/README.md +337 -0
- package/docs/content/agent-teams.mdx +324 -0
- package/docs/content/api.mdx +757 -0
- package/docs/content/best-practices.mdx +624 -0
- package/docs/content/examples.mdx +675 -0
- package/docs/content/guide.mdx +516 -0
- package/docs/content/index.mdx +99 -0
- package/docs/content/installation.mdx +246 -0
- package/docs/content/skills.mdx +548 -0
- package/docs/content/troubleshooting.mdx +588 -0
- package/docs/examples/README.md +499 -0
- package/docs/examples/abort-signal.ts +125 -0
- package/docs/examples/agent-teams.ts +122 -0
- package/docs/examples/basic-usage.ts +73 -0
- package/docs/examples/check-cli.ts +51 -0
- package/docs/examples/conversation-history.ts +69 -0
- package/docs/examples/custom-config.ts +90 -0
- package/docs/examples/generate-object-constraints.ts +209 -0
- package/docs/examples/generate-object.ts +211 -0
- package/docs/examples/hooks-callbacks.ts +63 -0
- package/docs/examples/images.ts +76 -0
- package/docs/examples/integration-test.ts +241 -0
- package/docs/examples/limitations.ts +150 -0
- package/docs/examples/logging-custom-logger.ts +99 -0
- package/docs/examples/logging-default.ts +55 -0
- package/docs/examples/logging-disabled.ts +74 -0
- package/docs/examples/logging-verbose.ts +64 -0
- package/docs/examples/long-running-tasks.ts +179 -0
- package/docs/examples/message-injection.ts +210 -0
- package/docs/examples/mid-stream-injection.ts +126 -0
- package/docs/examples/run-all-examples.sh +48 -0
- package/docs/examples/sdk-tools-callbacks.ts +49 -0
- package/docs/examples/skills-discovery.ts +144 -0
- package/docs/examples/skills-management.ts +140 -0
- package/docs/examples/stream-object.ts +80 -0
- package/docs/examples/streaming.ts +52 -0
- package/docs/examples/structured-output-repro.ts +227 -0
- package/docs/examples/tool-management.ts +215 -0
- package/docs/examples/tool-streaming.ts +132 -0
- package/docs/examples/zod4-compatibility-test.ts +290 -0
- package/docs/src/claude-code-language-model.test.ts +3883 -0
- package/docs/src/claude-code-language-model.ts +2586 -0
- package/docs/src/claude-code-provider.test.ts +97 -0
- package/docs/src/claude-code-provider.ts +179 -0
- package/docs/src/convert-to-claude-code-messages.images.test.ts +104 -0
- package/docs/src/convert-to-claude-code-messages.test.ts +193 -0
- package/docs/src/convert-to-claude-code-messages.ts +419 -0
- package/docs/src/errors.test.ts +213 -0
- package/docs/src/errors.ts +216 -0
- package/docs/src/index.test.ts +49 -0
- package/docs/src/index.ts +98 -0
- package/docs/src/logger.integration.test.ts +164 -0
- package/docs/src/logger.test.ts +184 -0
- package/docs/src/logger.ts +65 -0
- package/docs/src/map-claude-code-finish-reason.test.ts +120 -0
- package/docs/src/map-claude-code-finish-reason.ts +60 -0
- package/docs/src/mcp-helpers.test.ts +71 -0
- package/docs/src/mcp-helpers.ts +123 -0
- package/docs/src/message-injection.test.ts +460 -0
- package/docs/src/types.ts +447 -0
- package/docs/src/validation.test.ts +558 -0
- package/docs/src/validation.ts +360 -0
- package/package.json +124 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
import { LanguageModelV3, ProviderV3, APICallError, LoadAPIKeyError } from '@ai-sdk/provider';
|
|
2
|
+
import { PermissionMode, SdkBeta, SdkPluginConfig, SandboxSettings, Options, McpServerConfig, CanUseTool, AgentMcpServerSpec, SpawnOptions, SpawnedProcess, Query, SdkMcpToolDefinition, McpSdkServerConfigWithInstance } from '@anthropic-ai/claude-agent-sdk';
|
|
3
|
+
export { AgentMcpServerSpec, CanUseTool, HookCallback, HookCallbackMatcher, HookEvent, HookInput, HookJSONOutput, McpSdkServerConfigWithInstance, McpServerConfig, OutputFormat, PermissionBehavior, PermissionResult, PermissionRuleValue, PermissionUpdate, PostToolUseHookInput, PreToolUseHookInput, Query, SessionEndHookInput, SessionStartHookInput, SpawnOptions, SpawnedProcess, TaskCompletedHookInput, TeammateIdleHookInput, UserPromptSubmitHookInput, createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
|
|
4
|
+
import { ZodObject, ZodRawShape } from 'zod';
|
|
5
|
+
|
|
6
|
+
type StreamingInputMode = 'auto' | 'always' | 'off';
|
|
7
|
+
/**
|
|
8
|
+
* Logger interface for custom logging.
|
|
9
|
+
* Allows consumers to provide their own logging implementation
|
|
10
|
+
* or disable logging entirely.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const customLogger: Logger = {
|
|
15
|
+
* debug: (message) => myLoggingService.debug(message),
|
|
16
|
+
* info: (message) => myLoggingService.info(message),
|
|
17
|
+
* warn: (message) => myLoggingService.warn(message),
|
|
18
|
+
* error: (message) => myLoggingService.error(message),
|
|
19
|
+
* };
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
interface Logger {
|
|
23
|
+
/**
|
|
24
|
+
* Log a debug message. Only logged when verbose mode is enabled.
|
|
25
|
+
* Used for detailed execution tracing and troubleshooting.
|
|
26
|
+
*/
|
|
27
|
+
debug: (message: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Log an informational message. Only logged when verbose mode is enabled.
|
|
30
|
+
* Used for general execution flow information.
|
|
31
|
+
*/
|
|
32
|
+
info: (message: string) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Log a warning message.
|
|
35
|
+
*/
|
|
36
|
+
warn: (message: string) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Log an error message.
|
|
39
|
+
*/
|
|
40
|
+
error: (message: string) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Configuration settings for Claude Code SDK behavior.
|
|
44
|
+
* These settings control how the CLI executes, what permissions it has,
|
|
45
|
+
* and which tools are available during conversations.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const settings: ClaudeCodeSettings = {
|
|
50
|
+
* maxTurns: 10,
|
|
51
|
+
* permissionMode: 'auto',
|
|
52
|
+
* cwd: '/path/to/project',
|
|
53
|
+
* allowedTools: ['Read', 'LS'],
|
|
54
|
+
* disallowedTools: ['Bash(rm:*)']
|
|
55
|
+
* };
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
interface ClaudeCodeSettings {
|
|
59
|
+
/**
|
|
60
|
+
* Custom path to Claude Code SDK executable
|
|
61
|
+
* @default 'claude' (uses system PATH)
|
|
62
|
+
*/
|
|
63
|
+
pathToClaudeCodeExecutable?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Custom system prompt to use
|
|
66
|
+
*/
|
|
67
|
+
customSystemPrompt?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Append additional content to the system prompt
|
|
70
|
+
*/
|
|
71
|
+
appendSystemPrompt?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Agent SDK system prompt configuration. Preferred over legacy fields.
|
|
74
|
+
* - string: custom system prompt
|
|
75
|
+
* - preset object: Claude Code preset, with optional append
|
|
76
|
+
*/
|
|
77
|
+
systemPrompt?: string | {
|
|
78
|
+
type: 'preset';
|
|
79
|
+
preset: 'claude_code';
|
|
80
|
+
append?: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Maximum number of turns for the conversation
|
|
84
|
+
*/
|
|
85
|
+
maxTurns?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Maximum thinking tokens for the model
|
|
88
|
+
*/
|
|
89
|
+
maxThinkingTokens?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Working directory for CLI operations
|
|
92
|
+
*/
|
|
93
|
+
cwd?: string;
|
|
94
|
+
/**
|
|
95
|
+
* JavaScript runtime to use
|
|
96
|
+
* @default 'node' (or 'bun' if Bun is detected)
|
|
97
|
+
*/
|
|
98
|
+
executable?: 'bun' | 'deno' | 'node';
|
|
99
|
+
/**
|
|
100
|
+
* Additional arguments for the JavaScript runtime
|
|
101
|
+
*/
|
|
102
|
+
executableArgs?: string[];
|
|
103
|
+
/**
|
|
104
|
+
* Permission mode for tool usage
|
|
105
|
+
* @default 'default'
|
|
106
|
+
*/
|
|
107
|
+
permissionMode?: PermissionMode;
|
|
108
|
+
/**
|
|
109
|
+
* Custom tool name for permission prompts
|
|
110
|
+
*/
|
|
111
|
+
permissionPromptToolName?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Continue the most recent conversation
|
|
114
|
+
*/
|
|
115
|
+
continue?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Resume a specific session by ID
|
|
118
|
+
*/
|
|
119
|
+
resume?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Use a specific session ID for this query.
|
|
122
|
+
* Allows deterministic session identifiers for tracking and correlation.
|
|
123
|
+
*/
|
|
124
|
+
sessionId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Tools to explicitly allow during execution
|
|
127
|
+
* Examples: ['Read', 'LS', 'Bash(git log:*)']
|
|
128
|
+
*/
|
|
129
|
+
allowedTools?: string[];
|
|
130
|
+
/**
|
|
131
|
+
* Tools to disallow during execution
|
|
132
|
+
* Examples: ['Write', 'Edit', 'Bash(rm:*)']
|
|
133
|
+
*/
|
|
134
|
+
disallowedTools?: string[];
|
|
135
|
+
/**
|
|
136
|
+
* Enable Agent SDK beta features.
|
|
137
|
+
*/
|
|
138
|
+
betas?: SdkBeta[];
|
|
139
|
+
/**
|
|
140
|
+
* Allow bypassing permissions when using permissionMode: 'bypassPermissions'.
|
|
141
|
+
*/
|
|
142
|
+
allowDangerouslySkipPermissions?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Enable file checkpointing for rewind support.
|
|
145
|
+
*/
|
|
146
|
+
enableFileCheckpointing?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Maximum budget in USD for the query.
|
|
149
|
+
*/
|
|
150
|
+
maxBudgetUsd?: number;
|
|
151
|
+
/**
|
|
152
|
+
* Load custom plugins from local paths.
|
|
153
|
+
*/
|
|
154
|
+
plugins?: SdkPluginConfig[];
|
|
155
|
+
/**
|
|
156
|
+
* Resume session at a specific message UUID.
|
|
157
|
+
*/
|
|
158
|
+
resumeSessionAt?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Configure sandbox behavior programmatically.
|
|
161
|
+
*/
|
|
162
|
+
sandbox?: SandboxSettings;
|
|
163
|
+
/**
|
|
164
|
+
* Tool configuration (array of tool names or Claude Code preset).
|
|
165
|
+
*/
|
|
166
|
+
tools?: Options['tools'];
|
|
167
|
+
/**
|
|
168
|
+
* MCP server configuration
|
|
169
|
+
*/
|
|
170
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
171
|
+
/**
|
|
172
|
+
* Filesystem settings sources to load (CLAUDE.md, settings.json, etc.)
|
|
173
|
+
* When omitted, the Agent SDK loads no filesystem settings.
|
|
174
|
+
*
|
|
175
|
+
* Required for Skills support - skills are loaded from these sources.
|
|
176
|
+
* @example ['user', 'project']
|
|
177
|
+
*/
|
|
178
|
+
settingSources?: Array<'user' | 'project' | 'local'>;
|
|
179
|
+
/**
|
|
180
|
+
* Hook callbacks for lifecycle events (e.g., PreToolUse, PostToolUse).
|
|
181
|
+
* Note: typed loosely to support multiple SDK versions.
|
|
182
|
+
*/
|
|
183
|
+
hooks?: Partial<Record<string, Array<{
|
|
184
|
+
matcher?: string;
|
|
185
|
+
hooks: Array<(...args: unknown[]) => Promise<unknown>>;
|
|
186
|
+
}>>>;
|
|
187
|
+
/**
|
|
188
|
+
* Dynamic permission callback invoked before a tool is executed.
|
|
189
|
+
* Allows runtime approval/denial and optional input mutation.
|
|
190
|
+
*/
|
|
191
|
+
canUseTool?: CanUseTool;
|
|
192
|
+
/**
|
|
193
|
+
* Controls whether to send streaming input to the SDK (enables canUseTool).
|
|
194
|
+
* - 'auto' (default): stream when canUseTool is provided
|
|
195
|
+
* - 'always': always stream
|
|
196
|
+
* - 'off': never stream (legacy behavior)
|
|
197
|
+
*/
|
|
198
|
+
streamingInput?: StreamingInputMode;
|
|
199
|
+
/**
|
|
200
|
+
* Enable verbose logging for debugging
|
|
201
|
+
*/
|
|
202
|
+
verbose?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Enable programmatic debug logging from the SDK.
|
|
205
|
+
*/
|
|
206
|
+
debug?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Path to a file for SDK debug log output.
|
|
209
|
+
*/
|
|
210
|
+
debugFile?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Custom logger for handling warnings and errors.
|
|
213
|
+
* - Set to `false` to disable all logging
|
|
214
|
+
* - Provide a Logger object to use custom logging
|
|
215
|
+
* - Leave undefined to use console (default)
|
|
216
|
+
*
|
|
217
|
+
* @default console
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* // Disable logging
|
|
221
|
+
* const settings = { logger: false };
|
|
222
|
+
*
|
|
223
|
+
* // Custom logger
|
|
224
|
+
* const settings = {
|
|
225
|
+
* logger: {
|
|
226
|
+
* warn: (msg) => myLogger.warn(msg),
|
|
227
|
+
* error: (msg) => myLogger.error(msg),
|
|
228
|
+
* }
|
|
229
|
+
* };
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
logger?: Logger | false;
|
|
233
|
+
/**
|
|
234
|
+
* Environment variables to set
|
|
235
|
+
*/
|
|
236
|
+
env?: Record<string, string | undefined>;
|
|
237
|
+
/**
|
|
238
|
+
* Additional directories Claude can access.
|
|
239
|
+
*/
|
|
240
|
+
additionalDirectories?: string[];
|
|
241
|
+
/**
|
|
242
|
+
* Programmatically defined subagents.
|
|
243
|
+
*/
|
|
244
|
+
agents?: Record<string, {
|
|
245
|
+
/** Natural language description of when to use this agent */
|
|
246
|
+
description: string;
|
|
247
|
+
/** Array of allowed tool names. If omitted, inherits all tools from parent */
|
|
248
|
+
tools?: string[];
|
|
249
|
+
/** Array of tool names to explicitly disallow for this agent */
|
|
250
|
+
disallowedTools?: string[];
|
|
251
|
+
/** The agent's system prompt */
|
|
252
|
+
prompt: string;
|
|
253
|
+
/** Model to use for this agent. If omitted or 'inherit', uses the main model */
|
|
254
|
+
model?: 'sonnet' | 'opus' | 'haiku' | 'inherit';
|
|
255
|
+
/** MCP servers available to this agent (server names or inline configs) */
|
|
256
|
+
mcpServers?: AgentMcpServerSpec[];
|
|
257
|
+
/** Experimental: Critical reminder added to system prompt */
|
|
258
|
+
criticalSystemReminder_EXPERIMENTAL?: string;
|
|
259
|
+
}>;
|
|
260
|
+
/**
|
|
261
|
+
* Include partial message events from the SDK stream.
|
|
262
|
+
*/
|
|
263
|
+
includePartialMessages?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Model to use if primary fails.
|
|
266
|
+
*/
|
|
267
|
+
fallbackModel?: string;
|
|
268
|
+
/**
|
|
269
|
+
* When resuming, fork to a new session ID instead of continuing the original.
|
|
270
|
+
*/
|
|
271
|
+
forkSession?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Callback for stderr output from the underlying process.
|
|
274
|
+
*/
|
|
275
|
+
stderr?: (data: string) => void;
|
|
276
|
+
/**
|
|
277
|
+
* Enforce strict MCP validation.
|
|
278
|
+
*/
|
|
279
|
+
strictMcpConfig?: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Additional CLI arguments.
|
|
282
|
+
*/
|
|
283
|
+
extraArgs?: Record<string, string | null>;
|
|
284
|
+
/**
|
|
285
|
+
* When false, disables session persistence to disk.
|
|
286
|
+
* Sessions will not be saved to ~/.claude/projects/ and cannot be resumed later.
|
|
287
|
+
* Useful for ephemeral or automated workflows where session history is not needed.
|
|
288
|
+
* @default true
|
|
289
|
+
*/
|
|
290
|
+
persistSession?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Custom function to spawn the Claude Code process.
|
|
293
|
+
* Use this to run Claude Code in VMs, containers, or remote environments.
|
|
294
|
+
*/
|
|
295
|
+
spawnClaudeCodeProcess?: (options: SpawnOptions) => SpawnedProcess;
|
|
296
|
+
/**
|
|
297
|
+
* Escape hatch for Agent SDK options. Overrides explicit settings.
|
|
298
|
+
* Provider-managed fields (e.g. model, abortController, prompt, outputFormat)
|
|
299
|
+
* are ignored if supplied here.
|
|
300
|
+
*/
|
|
301
|
+
sdkOptions?: Partial<Options>;
|
|
302
|
+
/**
|
|
303
|
+
* Maximum size (in characters) for tool results sent to the client stream.
|
|
304
|
+
* The interior Claude Code process retains full data; this only affects client stream.
|
|
305
|
+
* Tool results exceeding this size will be truncated with a `...[truncated N chars]` suffix.
|
|
306
|
+
* @default 10000
|
|
307
|
+
*/
|
|
308
|
+
maxToolResultSize?: number;
|
|
309
|
+
/**
|
|
310
|
+
* Callback invoked when the Query object is created.
|
|
311
|
+
* Use this to access the Query for advanced features like mid-stream
|
|
312
|
+
* message injection via `query.streamInput()`.
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* const model = claudeCode('sonnet', {
|
|
317
|
+
* onQueryCreated: (query) => {
|
|
318
|
+
* // Store query for later injection
|
|
319
|
+
* myQueryStore.set(sessionId, query);
|
|
320
|
+
* }
|
|
321
|
+
* });
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
onQueryCreated?: (query: Query) => void;
|
|
325
|
+
/**
|
|
326
|
+
* Callback invoked when streaming input mode starts.
|
|
327
|
+
* Provides a MessageInjector that can be used to inject messages mid-session.
|
|
328
|
+
*
|
|
329
|
+
* This enables supervisor patterns where you can redirect or interrupt
|
|
330
|
+
* the agent during execution.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* const model = claudeCode("haiku", {
|
|
335
|
+
* streamingInput: "always",
|
|
336
|
+
* onStreamStart: (injector) => {
|
|
337
|
+
* // Store the injector for later use
|
|
338
|
+
* supervisorInjector = injector;
|
|
339
|
+
* }
|
|
340
|
+
* });
|
|
341
|
+
*
|
|
342
|
+
* // Later, inject a message mid-session:
|
|
343
|
+
* supervisorInjector.inject("STOP! Change of plans...");
|
|
344
|
+
* ```
|
|
345
|
+
*/
|
|
346
|
+
onStreamStart?: (injector: MessageInjector) => void;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Controller for injecting messages into an active Claude Code session.
|
|
350
|
+
* Obtained via the onStreamStart callback.
|
|
351
|
+
*/
|
|
352
|
+
interface MessageInjector {
|
|
353
|
+
/**
|
|
354
|
+
* Inject a user message into the current session.
|
|
355
|
+
* The message will be queued and sent to the agent mid-turn.
|
|
356
|
+
*
|
|
357
|
+
* @param content - The message content to inject
|
|
358
|
+
* @param onResult - Optional callback invoked when delivery status is known:
|
|
359
|
+
* - `delivered: true` if the message was sent to the agent
|
|
360
|
+
* - `delivered: false` if the session ended before the message could be delivered
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* // Fire-and-forget
|
|
365
|
+
* injector.inject("STOP! Cancel the current task.");
|
|
366
|
+
*
|
|
367
|
+
* // With delivery tracking
|
|
368
|
+
* injector.inject("Change of plans!", (delivered) => {
|
|
369
|
+
* if (!delivered) {
|
|
370
|
+
* console.log("Message not delivered - session ended first");
|
|
371
|
+
* // Handle retry via session resume, etc.
|
|
372
|
+
* }
|
|
373
|
+
* });
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
inject(content: string, onResult?: (delivered: boolean) => void): void;
|
|
377
|
+
/**
|
|
378
|
+
* Signal that no more messages will be injected.
|
|
379
|
+
* Call this when the session should be allowed to complete normally.
|
|
380
|
+
*/
|
|
381
|
+
close(): void;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Options for creating a Claude Code language model instance.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```typescript
|
|
389
|
+
* const model = new ClaudeCodeLanguageModel({
|
|
390
|
+
* id: 'opus',
|
|
391
|
+
* settings: {
|
|
392
|
+
* maxTurns: 10,
|
|
393
|
+
* permissionMode: 'auto'
|
|
394
|
+
* }
|
|
395
|
+
* });
|
|
396
|
+
* ```
|
|
397
|
+
*/
|
|
398
|
+
interface ClaudeCodeLanguageModelOptions {
|
|
399
|
+
/**
|
|
400
|
+
* The model identifier to use.
|
|
401
|
+
* Can be 'opus', 'sonnet', 'haiku', or a custom model string.
|
|
402
|
+
*/
|
|
403
|
+
id: ClaudeCodeModelId;
|
|
404
|
+
/**
|
|
405
|
+
* Optional settings to configure the model behavior.
|
|
406
|
+
*/
|
|
407
|
+
settings?: ClaudeCodeSettings;
|
|
408
|
+
/**
|
|
409
|
+
* Validation warnings from settings validation.
|
|
410
|
+
* Used internally to pass warnings from provider.
|
|
411
|
+
*/
|
|
412
|
+
settingsValidationWarnings?: string[];
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Supported Claude model identifiers.
|
|
416
|
+
* - 'opus': Claude Opus (most capable)
|
|
417
|
+
* - 'sonnet': Claude Sonnet (balanced performance)
|
|
418
|
+
* - 'haiku': Claude Haiku (fastest, most cost-effective)
|
|
419
|
+
* - Custom string: Any full model identifier (e.g., 'claude-opus-4-5', 'claude-sonnet-4-5-20250514')
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```typescript
|
|
423
|
+
* const opusModel = claudeCode('opus');
|
|
424
|
+
* const sonnetModel = claudeCode('sonnet');
|
|
425
|
+
* const haikuModel = claudeCode('haiku');
|
|
426
|
+
* const customModel = claudeCode('claude-opus-4-5');
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
type ClaudeCodeModelId = 'opus' | 'sonnet' | 'haiku' | (string & {});
|
|
430
|
+
/**
|
|
431
|
+
* Language model implementation for Claude Code SDK.
|
|
432
|
+
* This class implements the AI SDK's LanguageModelV3 interface to provide
|
|
433
|
+
* integration with Claude models through the Claude Agent SDK.
|
|
434
|
+
*
|
|
435
|
+
* Features:
|
|
436
|
+
* - Supports streaming and non-streaming generation
|
|
437
|
+
* - Native structured outputs via SDK's outputFormat (guaranteed schema compliance)
|
|
438
|
+
* - Manages CLI sessions for conversation continuity
|
|
439
|
+
* - Provides detailed error handling and retry logic
|
|
440
|
+
*
|
|
441
|
+
* Limitations:
|
|
442
|
+
* - Image inputs require streaming mode
|
|
443
|
+
* - Some parameters like temperature and max tokens are not supported by the CLI
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```typescript
|
|
447
|
+
* const model = new ClaudeCodeLanguageModel({
|
|
448
|
+
* id: 'opus',
|
|
449
|
+
* settings: { maxTurns: 5 }
|
|
450
|
+
* });
|
|
451
|
+
*
|
|
452
|
+
* const result = await model.doGenerate({
|
|
453
|
+
* prompt: [{ role: 'user', content: 'Hello!' }],
|
|
454
|
+
* mode: { type: 'regular' }
|
|
455
|
+
* });
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
declare class ClaudeCodeLanguageModel implements LanguageModelV3 {
|
|
459
|
+
readonly specificationVersion: "v3";
|
|
460
|
+
readonly defaultObjectGenerationMode: "json";
|
|
461
|
+
readonly supportsImageUrls = false;
|
|
462
|
+
readonly supportedUrls: {};
|
|
463
|
+
readonly supportsStructuredOutputs = true;
|
|
464
|
+
static readonly UNKNOWN_TOOL_NAME = "unknown-tool";
|
|
465
|
+
private static readonly MAX_TOOL_INPUT_SIZE;
|
|
466
|
+
private static readonly MAX_TOOL_INPUT_WARN;
|
|
467
|
+
private static readonly MAX_DELTA_CALC_SIZE;
|
|
468
|
+
readonly modelId: ClaudeCodeModelId;
|
|
469
|
+
readonly settings: ClaudeCodeSettings;
|
|
470
|
+
private sessionId?;
|
|
471
|
+
private modelValidationWarning?;
|
|
472
|
+
private settingsValidationWarnings;
|
|
473
|
+
private logger;
|
|
474
|
+
constructor(options: ClaudeCodeLanguageModelOptions);
|
|
475
|
+
get provider(): string;
|
|
476
|
+
private getModel;
|
|
477
|
+
private getSanitizedSdkOptions;
|
|
478
|
+
private getEffectiveResume;
|
|
479
|
+
private extractToolUses;
|
|
480
|
+
private extractToolResults;
|
|
481
|
+
private extractToolErrors;
|
|
482
|
+
private serializeToolInput;
|
|
483
|
+
private checkInputSize;
|
|
484
|
+
private normalizeToolResult;
|
|
485
|
+
private generateAllWarnings;
|
|
486
|
+
private createQueryOptions;
|
|
487
|
+
private handleClaudeCodeError;
|
|
488
|
+
private setSessionId;
|
|
489
|
+
doGenerate(options: Parameters<LanguageModelV3['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV3['doGenerate']>>>;
|
|
490
|
+
doStream(options: Parameters<LanguageModelV3['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV3['doStream']>>>;
|
|
491
|
+
private serializeWarningsForMetadata;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Claude Code provider interface that extends the AI SDK's ProviderV3.
|
|
496
|
+
* Provides methods to create language models for interacting with Claude via the CLI.
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* ```typescript
|
|
500
|
+
* import { claudeCode } from '@boostecom/provider';
|
|
501
|
+
*
|
|
502
|
+
* // Create a model instance
|
|
503
|
+
* const model = claudeCode('opus');
|
|
504
|
+
*
|
|
505
|
+
* // Or use the explicit methods
|
|
506
|
+
* const chatModel = claudeCode.chat('sonnet');
|
|
507
|
+
* const languageModel = claudeCode.languageModel('opus', { maxTurns: 10 });
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
interface ClaudeCodeProvider extends ProviderV3 {
|
|
511
|
+
/**
|
|
512
|
+
* Creates a language model instance for the specified model ID.
|
|
513
|
+
* This is a shorthand for calling `languageModel()`.
|
|
514
|
+
*
|
|
515
|
+
* @param modelId - The Claude model to use ('opus' or 'sonnet')
|
|
516
|
+
* @param settings - Optional settings to configure the model
|
|
517
|
+
* @returns A language model instance
|
|
518
|
+
*/
|
|
519
|
+
(modelId: ClaudeCodeModelId, settings?: ClaudeCodeSettings): LanguageModelV3;
|
|
520
|
+
/**
|
|
521
|
+
* Creates a language model instance for text generation.
|
|
522
|
+
*
|
|
523
|
+
* @param modelId - The Claude model to use ('opus' or 'sonnet')
|
|
524
|
+
* @param settings - Optional settings to configure the model
|
|
525
|
+
* @returns A language model instance
|
|
526
|
+
*/
|
|
527
|
+
languageModel(modelId: ClaudeCodeModelId, settings?: ClaudeCodeSettings): LanguageModelV3;
|
|
528
|
+
/**
|
|
529
|
+
* Alias for `languageModel()` to maintain compatibility with AI SDK patterns.
|
|
530
|
+
*
|
|
531
|
+
* @param modelId - The Claude model to use ('opus' or 'sonnet')
|
|
532
|
+
* @param settings - Optional settings to configure the model
|
|
533
|
+
* @returns A language model instance
|
|
534
|
+
*/
|
|
535
|
+
chat(modelId: ClaudeCodeModelId, settings?: ClaudeCodeSettings): LanguageModelV3;
|
|
536
|
+
imageModel(modelId: string): never;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Configuration options for creating a Claude Code provider instance.
|
|
540
|
+
* These settings will be applied as defaults to all models created by the provider.
|
|
541
|
+
*
|
|
542
|
+
* @example
|
|
543
|
+
* ```typescript
|
|
544
|
+
* const provider = createClaudeCode({
|
|
545
|
+
* defaultSettings: {
|
|
546
|
+
* maxTurns: 5,
|
|
547
|
+
* cwd: '/path/to/project'
|
|
548
|
+
* }
|
|
549
|
+
* });
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
interface ClaudeCodeProviderSettings {
|
|
553
|
+
/**
|
|
554
|
+
* Default settings to use for all models created by this provider.
|
|
555
|
+
* Individual model settings will override these defaults.
|
|
556
|
+
*/
|
|
557
|
+
defaultSettings?: ClaudeCodeSettings;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Creates a Claude Code provider instance with the specified configuration.
|
|
561
|
+
* The provider can be used to create language models for interacting with Claude 4 models.
|
|
562
|
+
*
|
|
563
|
+
* @param options - Provider configuration options
|
|
564
|
+
* @returns Claude Code provider instance
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```typescript
|
|
568
|
+
* const provider = createClaudeCode({
|
|
569
|
+
* defaultSettings: {
|
|
570
|
+
* permissionMode: 'bypassPermissions',
|
|
571
|
+
* maxTurns: 10
|
|
572
|
+
* }
|
|
573
|
+
* });
|
|
574
|
+
*
|
|
575
|
+
* const model = provider('opus');
|
|
576
|
+
* ```
|
|
577
|
+
*/
|
|
578
|
+
declare function createClaudeCode(options?: ClaudeCodeProviderSettings): ClaudeCodeProvider;
|
|
579
|
+
/**
|
|
580
|
+
* Default Claude Code provider instance.
|
|
581
|
+
* Pre-configured provider for quick usage without custom settings.
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* ```typescript
|
|
585
|
+
* import { claudeCode } from '@boostecom/provider';
|
|
586
|
+
* import { generateText } from 'ai';
|
|
587
|
+
*
|
|
588
|
+
* const { text } = await generateText({
|
|
589
|
+
* model: claudeCode('sonnet'),
|
|
590
|
+
* prompt: 'Hello, Claude!'
|
|
591
|
+
* });
|
|
592
|
+
* ```
|
|
593
|
+
*/
|
|
594
|
+
declare const claudeCode: ClaudeCodeProvider;
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Optional annotations for content items, per MCP specification.
|
|
598
|
+
* Validated against MCP SDK schema version 2025-06-18.
|
|
599
|
+
*/
|
|
600
|
+
type ContentAnnotations = {
|
|
601
|
+
/** Intended audience(s) for this content */
|
|
602
|
+
audience?: ('user' | 'assistant')[];
|
|
603
|
+
/** Priority hint (0 = least important, 1 = most important) */
|
|
604
|
+
priority?: number;
|
|
605
|
+
/** ISO 8601 timestamp of last modification */
|
|
606
|
+
lastModified?: string;
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
609
|
+
* MCP tool annotations for hinting tool behavior to the model.
|
|
610
|
+
* Derived from the SDK's SdkMcpToolDefinition type to stay in sync
|
|
611
|
+
* with the upstream MCP ToolAnnotations definition.
|
|
612
|
+
*/
|
|
613
|
+
type ToolAnnotations = NonNullable<SdkMcpToolDefinition['annotations']>;
|
|
614
|
+
/**
|
|
615
|
+
* Convenience helper to create an SDK MCP server from a simple tool map.
|
|
616
|
+
* Each tool provides a description, a Zod object schema, and a handler.
|
|
617
|
+
*
|
|
618
|
+
* Type definition validated against MCP SDK specification version 2025-06-18.
|
|
619
|
+
* See: https://modelcontextprotocol.io/specification/2025-06-18/server/tools
|
|
620
|
+
*/
|
|
621
|
+
type MinimalCallToolResult = {
|
|
622
|
+
content: Array<{
|
|
623
|
+
/** Text content */
|
|
624
|
+
type: 'text';
|
|
625
|
+
/** The text content (plain text or structured format like JSON) */
|
|
626
|
+
text: string;
|
|
627
|
+
annotations?: ContentAnnotations;
|
|
628
|
+
_meta?: Record<string, unknown>;
|
|
629
|
+
[key: string]: unknown;
|
|
630
|
+
} | {
|
|
631
|
+
/** Image content (base64-encoded) */
|
|
632
|
+
type: 'image';
|
|
633
|
+
/** Base64-encoded image data */
|
|
634
|
+
data: string;
|
|
635
|
+
/** MIME type of the image (e.g., image/png, image/jpeg) */
|
|
636
|
+
mimeType: string;
|
|
637
|
+
annotations?: ContentAnnotations;
|
|
638
|
+
_meta?: Record<string, unknown>;
|
|
639
|
+
[key: string]: unknown;
|
|
640
|
+
} | {
|
|
641
|
+
/** Audio content (base64-encoded) */
|
|
642
|
+
type: 'audio';
|
|
643
|
+
/** Base64-encoded audio data */
|
|
644
|
+
data: string;
|
|
645
|
+
/** MIME type of the audio (e.g., audio/wav, audio/mp3) */
|
|
646
|
+
mimeType: string;
|
|
647
|
+
annotations?: ContentAnnotations;
|
|
648
|
+
_meta?: Record<string, unknown>;
|
|
649
|
+
[key: string]: unknown;
|
|
650
|
+
} | {
|
|
651
|
+
/** Embedded resource with full content (text or blob) */
|
|
652
|
+
type: 'resource';
|
|
653
|
+
/** Resource contents - either text or blob variant */
|
|
654
|
+
resource: {
|
|
655
|
+
uri: string;
|
|
656
|
+
_meta?: Record<string, unknown>;
|
|
657
|
+
[key: string]: unknown;
|
|
658
|
+
} & ({
|
|
659
|
+
text: string;
|
|
660
|
+
mimeType?: string;
|
|
661
|
+
} | {
|
|
662
|
+
blob: string;
|
|
663
|
+
mimeType: string;
|
|
664
|
+
});
|
|
665
|
+
annotations?: ContentAnnotations;
|
|
666
|
+
_meta?: Record<string, unknown>;
|
|
667
|
+
[key: string]: unknown;
|
|
668
|
+
} | {
|
|
669
|
+
/** Resource link (reference only - no embedded content) */
|
|
670
|
+
type: 'resource_link';
|
|
671
|
+
/** URI of the resource */
|
|
672
|
+
uri: string;
|
|
673
|
+
/** Human-readable name (required per MCP spec) */
|
|
674
|
+
name: string;
|
|
675
|
+
/** Optional description of what this resource represents */
|
|
676
|
+
description?: string;
|
|
677
|
+
/** MIME type of the resource, if known */
|
|
678
|
+
mimeType?: string;
|
|
679
|
+
annotations?: ContentAnnotations;
|
|
680
|
+
_meta?: Record<string, unknown>;
|
|
681
|
+
[key: string]: unknown;
|
|
682
|
+
}>;
|
|
683
|
+
isError?: boolean;
|
|
684
|
+
structuredContent?: Record<string, unknown>;
|
|
685
|
+
_meta?: Record<string, unknown>;
|
|
686
|
+
[key: string]: unknown;
|
|
687
|
+
};
|
|
688
|
+
declare function createCustomMcpServer<Tools extends Record<string, {
|
|
689
|
+
description: string;
|
|
690
|
+
inputSchema: ZodObject<ZodRawShape>;
|
|
691
|
+
handler: (args: Record<string, unknown>, extra: unknown) => Promise<MinimalCallToolResult>;
|
|
692
|
+
annotations?: ToolAnnotations;
|
|
693
|
+
}>>(config: {
|
|
694
|
+
name: string;
|
|
695
|
+
version?: string;
|
|
696
|
+
tools: Tools;
|
|
697
|
+
}): McpSdkServerConfigWithInstance;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Metadata associated with Claude Code SDK errors.
|
|
701
|
+
* Provides additional context about command execution failures.
|
|
702
|
+
*/
|
|
703
|
+
interface ClaudeCodeErrorMetadata {
|
|
704
|
+
/**
|
|
705
|
+
* Error code from the CLI process (e.g., 'ENOENT', 'ETIMEDOUT').
|
|
706
|
+
*/
|
|
707
|
+
code?: string;
|
|
708
|
+
/**
|
|
709
|
+
* Exit code from the Claude Code SDK process.
|
|
710
|
+
* Common codes:
|
|
711
|
+
* - 401: Authentication error
|
|
712
|
+
* - 1: General error
|
|
713
|
+
*/
|
|
714
|
+
exitCode?: number;
|
|
715
|
+
/**
|
|
716
|
+
* Standard error output from the CLI process.
|
|
717
|
+
*/
|
|
718
|
+
stderr?: string;
|
|
719
|
+
/**
|
|
720
|
+
* Excerpt from the prompt that caused the error.
|
|
721
|
+
* Limited to first 200 characters for debugging.
|
|
722
|
+
*/
|
|
723
|
+
promptExcerpt?: string;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Creates an APICallError with Claude Code specific metadata.
|
|
727
|
+
* Used for general CLI execution errors.
|
|
728
|
+
*
|
|
729
|
+
* @param options - Error details and metadata
|
|
730
|
+
* @param options.message - Human-readable error message
|
|
731
|
+
* @param options.code - Error code from the CLI process
|
|
732
|
+
* @param options.exitCode - Exit code from the CLI
|
|
733
|
+
* @param options.stderr - Standard error output
|
|
734
|
+
* @param options.promptExcerpt - Excerpt of the prompt that caused the error
|
|
735
|
+
* @param options.isRetryable - Whether the error is potentially retryable
|
|
736
|
+
* @returns An APICallError instance with Claude Code metadata
|
|
737
|
+
*
|
|
738
|
+
* @example
|
|
739
|
+
* ```typescript
|
|
740
|
+
* throw createAPICallError({
|
|
741
|
+
* message: 'Claude Code SDK failed',
|
|
742
|
+
* code: 'ENOENT',
|
|
743
|
+
* isRetryable: true
|
|
744
|
+
* });
|
|
745
|
+
* ```
|
|
746
|
+
*/
|
|
747
|
+
declare function createAPICallError({ message, code, exitCode, stderr, promptExcerpt, isRetryable, }: ClaudeCodeErrorMetadata & {
|
|
748
|
+
message: string;
|
|
749
|
+
isRetryable?: boolean;
|
|
750
|
+
}): APICallError;
|
|
751
|
+
/**
|
|
752
|
+
* Creates an authentication error for Claude Code SDK login failures.
|
|
753
|
+
*
|
|
754
|
+
* @param options - Error configuration
|
|
755
|
+
* @param options.message - Error message describing the authentication failure
|
|
756
|
+
* @returns A LoadAPIKeyError instance
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* ```typescript
|
|
760
|
+
* throw createAuthenticationError({
|
|
761
|
+
* message: 'Please run "claude login" to authenticate'
|
|
762
|
+
* });
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
declare function createAuthenticationError({ message }: {
|
|
766
|
+
message: string;
|
|
767
|
+
}): LoadAPIKeyError;
|
|
768
|
+
/**
|
|
769
|
+
* Creates a timeout error for Claude Code SDK operations.
|
|
770
|
+
*
|
|
771
|
+
* @param options - Timeout error details
|
|
772
|
+
* @param options.message - Error message describing the timeout
|
|
773
|
+
* @param options.promptExcerpt - Excerpt of the prompt that timed out
|
|
774
|
+
* @param options.timeoutMs - Timeout duration in milliseconds
|
|
775
|
+
* @returns An APICallError instance configured as a timeout error
|
|
776
|
+
*
|
|
777
|
+
* @example
|
|
778
|
+
* ```typescript
|
|
779
|
+
* throw createTimeoutError({
|
|
780
|
+
* message: 'Request timed out after 2 minutes',
|
|
781
|
+
* timeoutMs: 120000
|
|
782
|
+
* });
|
|
783
|
+
* ```
|
|
784
|
+
*/
|
|
785
|
+
declare function createTimeoutError({ message, promptExcerpt, timeoutMs, }: {
|
|
786
|
+
message: string;
|
|
787
|
+
promptExcerpt?: string;
|
|
788
|
+
timeoutMs?: number;
|
|
789
|
+
}): APICallError;
|
|
790
|
+
/**
|
|
791
|
+
* Checks if an error is an authentication error.
|
|
792
|
+
* Returns true for LoadAPIKeyError instances or APICallError with exit code 401.
|
|
793
|
+
*
|
|
794
|
+
* @param error - The error to check
|
|
795
|
+
* @returns True if the error is an authentication error
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* ```typescript
|
|
799
|
+
* try {
|
|
800
|
+
* await model.generate(...);
|
|
801
|
+
* } catch (error) {
|
|
802
|
+
* if (isAuthenticationError(error)) {
|
|
803
|
+
* console.log('Please authenticate with Claude Code SDK');
|
|
804
|
+
* }
|
|
805
|
+
* }
|
|
806
|
+
* ```
|
|
807
|
+
*/
|
|
808
|
+
declare function isAuthenticationError(error: unknown): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Checks if an error is a timeout error.
|
|
811
|
+
* Returns true for APICallError instances with code 'TIMEOUT'.
|
|
812
|
+
*
|
|
813
|
+
* @param error - The error to check
|
|
814
|
+
* @returns True if the error is a timeout error
|
|
815
|
+
*
|
|
816
|
+
* @example
|
|
817
|
+
* ```typescript
|
|
818
|
+
* try {
|
|
819
|
+
* await model.generate(...);
|
|
820
|
+
* } catch (error) {
|
|
821
|
+
* if (isTimeoutError(error)) {
|
|
822
|
+
* console.log('Request timed out, consider retrying');
|
|
823
|
+
* }
|
|
824
|
+
* }
|
|
825
|
+
* ```
|
|
826
|
+
*/
|
|
827
|
+
declare function isTimeoutError(error: unknown): boolean;
|
|
828
|
+
/**
|
|
829
|
+
* Extracts Claude Code error metadata from an error object.
|
|
830
|
+
*
|
|
831
|
+
* @param error - The error to extract metadata from
|
|
832
|
+
* @returns The error metadata if available, undefined otherwise
|
|
833
|
+
*
|
|
834
|
+
* @example
|
|
835
|
+
* ```typescript
|
|
836
|
+
* try {
|
|
837
|
+
* await model.generate(...);
|
|
838
|
+
* } catch (error) {
|
|
839
|
+
* const metadata = getErrorMetadata(error);
|
|
840
|
+
* if (metadata?.exitCode === 401) {
|
|
841
|
+
* console.log('Authentication required');
|
|
842
|
+
* }
|
|
843
|
+
* }
|
|
844
|
+
* ```
|
|
845
|
+
*/
|
|
846
|
+
declare function getErrorMetadata(error: unknown): ClaudeCodeErrorMetadata | undefined;
|
|
847
|
+
|
|
848
|
+
export { type ClaudeCodeErrorMetadata, ClaudeCodeLanguageModel, type ClaudeCodeLanguageModelOptions, type ClaudeCodeModelId, type ClaudeCodeProvider, type ClaudeCodeProviderSettings, type ClaudeCodeSettings, type Logger, type MessageInjector, type MinimalCallToolResult, type ToolAnnotations, claudeCode, createAPICallError, createAuthenticationError, createClaudeCode, createCustomMcpServer, createTimeoutError, getErrorMetadata, isAuthenticationError, isTimeoutError };
|