@chucky.cloud/sdk 0.2.7 → 0.3.0

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 (94) hide show
  1. package/dist/browser.cjs +1361 -0
  2. package/dist/browser.cjs.map +1 -0
  3. package/dist/browser.d.cts +1 -0
  4. package/dist/browser.d.ts +1 -8
  5. package/dist/browser.js +1278 -11
  6. package/dist/browser.js.map +1 -1
  7. package/dist/index.cjs +1361 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.cts +1973 -0
  10. package/dist/index.d.ts +1953 -48
  11. package/dist/index.js +1278 -72
  12. package/dist/index.js.map +1 -1
  13. package/dist/node.cjs +1361 -0
  14. package/dist/node.cjs.map +1 -0
  15. package/dist/node.d.cts +1 -0
  16. package/dist/node.d.ts +1 -8
  17. package/dist/node.js +1278 -10
  18. package/dist/node.js.map +1 -1
  19. package/package.json +13 -7
  20. package/dist/browser.d.ts.map +0 -1
  21. package/dist/client/ChuckyClient.d.ts +0 -141
  22. package/dist/client/ChuckyClient.d.ts.map +0 -1
  23. package/dist/client/ChuckyClient.js +0 -209
  24. package/dist/client/ChuckyClient.js.map +0 -1
  25. package/dist/client/Session.d.ts +0 -167
  26. package/dist/client/Session.d.ts.map +0 -1
  27. package/dist/client/Session.js +0 -392
  28. package/dist/client/Session.js.map +0 -1
  29. package/dist/client/index.d.ts +0 -10
  30. package/dist/client/index.d.ts.map +0 -1
  31. package/dist/client/index.js +0 -9
  32. package/dist/client/index.js.map +0 -1
  33. package/dist/index.d.ts.map +0 -1
  34. package/dist/node.d.ts.map +0 -1
  35. package/dist/tools/McpServer.d.ts +0 -117
  36. package/dist/tools/McpServer.d.ts.map +0 -1
  37. package/dist/tools/McpServer.js +0 -142
  38. package/dist/tools/McpServer.js.map +0 -1
  39. package/dist/tools/index.d.ts +0 -9
  40. package/dist/tools/index.d.ts.map +0 -1
  41. package/dist/tools/index.js +0 -8
  42. package/dist/tools/index.js.map +0 -1
  43. package/dist/tools/tool.d.ts +0 -146
  44. package/dist/tools/tool.d.ts.map +0 -1
  45. package/dist/tools/tool.js +0 -232
  46. package/dist/tools/tool.js.map +0 -1
  47. package/dist/transport/Transport.d.ts +0 -82
  48. package/dist/transport/Transport.d.ts.map +0 -1
  49. package/dist/transport/Transport.js +0 -47
  50. package/dist/transport/Transport.js.map +0 -1
  51. package/dist/transport/WebSocketTransport.d.ts +0 -78
  52. package/dist/transport/WebSocketTransport.d.ts.map +0 -1
  53. package/dist/transport/WebSocketTransport.js +0 -258
  54. package/dist/transport/WebSocketTransport.js.map +0 -1
  55. package/dist/transport/index.d.ts +0 -10
  56. package/dist/transport/index.d.ts.map +0 -1
  57. package/dist/transport/index.js +0 -8
  58. package/dist/transport/index.js.map +0 -1
  59. package/dist/types/index.d.ts +0 -12
  60. package/dist/types/index.d.ts.map +0 -1
  61. package/dist/types/index.js +0 -8
  62. package/dist/types/index.js.map +0 -1
  63. package/dist/types/messages.d.ts +0 -327
  64. package/dist/types/messages.d.ts.map +0 -1
  65. package/dist/types/messages.js +0 -133
  66. package/dist/types/messages.js.map +0 -1
  67. package/dist/types/options.d.ts +0 -212
  68. package/dist/types/options.d.ts.map +0 -1
  69. package/dist/types/options.js +0 -8
  70. package/dist/types/options.js.map +0 -1
  71. package/dist/types/results.d.ts +0 -186
  72. package/dist/types/results.d.ts.map +0 -1
  73. package/dist/types/results.js +0 -7
  74. package/dist/types/results.js.map +0 -1
  75. package/dist/types/token.d.ts +0 -124
  76. package/dist/types/token.d.ts.map +0 -1
  77. package/dist/types/token.js +0 -7
  78. package/dist/types/token.js.map +0 -1
  79. package/dist/types/tools.d.ts +0 -234
  80. package/dist/types/tools.d.ts.map +0 -1
  81. package/dist/types/tools.js +0 -31
  82. package/dist/types/tools.js.map +0 -1
  83. package/dist/utils/errors.d.ts +0 -80
  84. package/dist/utils/errors.d.ts.map +0 -1
  85. package/dist/utils/errors.js +0 -158
  86. package/dist/utils/errors.js.map +0 -1
  87. package/dist/utils/index.d.ts +0 -8
  88. package/dist/utils/index.d.ts.map +0 -1
  89. package/dist/utils/index.js +0 -8
  90. package/dist/utils/index.js.map +0 -1
  91. package/dist/utils/token.d.ts +0 -104
  92. package/dist/utils/token.d.ts.map +0 -1
  93. package/dist/utils/token.js +0 -209
  94. package/dist/utils/token.js.map +0 -1
@@ -1,8 +0,0 @@
1
- /**
2
- * SDK Options Types
3
- *
4
- * These types define all configuration options for sessions and prompts.
5
- * Designed for both browser and Node.js environments.
6
- */
7
- export {};
8
- //# sourceMappingURL=options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/types/options.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -1,186 +0,0 @@
1
- /**
2
- * Result Types
3
- *
4
- * Types for responses from sessions and prompts.
5
- */
6
- /**
7
- * Message role
8
- */
9
- export type MessageRole = 'user' | 'assistant' | 'system';
10
- /**
11
- * Content block types
12
- */
13
- export type ContentBlockType = 'text' | 'tool_use' | 'tool_result' | 'thinking' | 'image';
14
- /**
15
- * Text content block
16
- */
17
- export interface TextBlock {
18
- type: 'text';
19
- text: string;
20
- }
21
- /**
22
- * Tool use content block
23
- */
24
- export interface ToolUseBlock {
25
- type: 'tool_use';
26
- id: string;
27
- name: string;
28
- input: Record<string, unknown>;
29
- }
30
- /**
31
- * Tool result content block
32
- */
33
- export interface ToolResultBlock {
34
- type: 'tool_result';
35
- tool_use_id: string;
36
- content: string | Array<{
37
- type: 'text';
38
- text: string;
39
- }>;
40
- is_error?: boolean;
41
- }
42
- /**
43
- * Thinking content block (extended thinking)
44
- */
45
- export interface ThinkingBlock {
46
- type: 'thinking';
47
- thinking: string;
48
- }
49
- /**
50
- * Image content block
51
- */
52
- export interface ImageBlock {
53
- type: 'image';
54
- source: {
55
- type: 'base64';
56
- media_type: string;
57
- data: string;
58
- };
59
- }
60
- /**
61
- * Union type for all content blocks
62
- */
63
- export type ContentBlock = TextBlock | ToolUseBlock | ToolResultBlock | ThinkingBlock | ImageBlock;
64
- /**
65
- * A message in the conversation
66
- */
67
- export interface Message {
68
- /** Message role */
69
- role: MessageRole;
70
- /** Message content */
71
- content: ContentBlock[] | string;
72
- }
73
- /**
74
- * Usage statistics
75
- */
76
- export interface Usage {
77
- /** Input tokens used */
78
- input_tokens: number;
79
- /** Output tokens generated */
80
- output_tokens: number;
81
- /** Cache creation input tokens */
82
- cache_creation_input_tokens?: number;
83
- /** Cache read input tokens */
84
- cache_read_input_tokens?: number;
85
- }
86
- /**
87
- * Cost breakdown
88
- */
89
- export interface CostBreakdown {
90
- /** Input cost in USD */
91
- input_cost_usd: number;
92
- /** Output cost in USD */
93
- output_cost_usd: number;
94
- /** Total cost in USD */
95
- total_cost_usd: number;
96
- }
97
- /**
98
- * Session result (returned when session completes)
99
- */
100
- export interface SessionResult {
101
- /** Result type */
102
- type: 'result';
103
- /** Result subtype */
104
- subtype?: 'success' | 'error' | 'interrupted';
105
- /** Final response text */
106
- text?: string;
107
- /** Conversation messages */
108
- messages?: Message[];
109
- /** Total cost in USD */
110
- total_cost_usd?: number;
111
- /** Session duration in seconds */
112
- duration_secs?: number;
113
- /** Number of conversation turns */
114
- turn_count?: number;
115
- /** Usage statistics */
116
- usage?: Usage;
117
- /** Session ID (for resuming) */
118
- session_id?: string;
119
- /** Error message (if subtype is 'error') */
120
- error?: string;
121
- }
122
- /**
123
- * Prompt result (returned from one-shot prompts)
124
- */
125
- export interface PromptResult {
126
- /** Result type */
127
- type: 'result';
128
- /** Result subtype */
129
- subtype?: 'success' | 'error';
130
- /** Response text */
131
- text?: string;
132
- /** Structured output (if outputFormat was specified) */
133
- output?: unknown;
134
- /** Total cost in USD */
135
- total_cost_usd?: number;
136
- /** Duration in seconds */
137
- duration_secs?: number;
138
- /** Usage statistics */
139
- usage?: Usage;
140
- /** Error message (if subtype is 'error') */
141
- error?: string;
142
- }
143
- /**
144
- * Streaming message event
145
- */
146
- export interface StreamEvent {
147
- /** Event type */
148
- type: 'message_start' | 'content_block_start' | 'content_block_delta' | 'content_block_stop' | 'message_delta' | 'message_stop' | 'tool_use' | 'tool_result' | 'error';
149
- /** Event data */
150
- data: unknown;
151
- }
152
- /**
153
- * Partial message (during streaming)
154
- */
155
- export interface PartialMessage {
156
- /** Message role */
157
- role: MessageRole;
158
- /** Partial content accumulated so far */
159
- content: ContentBlock[];
160
- /** Whether the message is complete */
161
- complete: boolean;
162
- }
163
- /**
164
- * Session state
165
- */
166
- export type SessionState = 'idle' | 'initializing' | 'ready' | 'processing' | 'waiting_tool' | 'completed' | 'error';
167
- /**
168
- * Session info (returned when connecting/resuming)
169
- */
170
- export interface SessionInfo {
171
- /** Session ID */
172
- sessionId?: string;
173
- /** Current state */
174
- state?: SessionState;
175
- /** Number of messages in conversation */
176
- messageCount?: number;
177
- /** Session creation time (ISO 8601) */
178
- createdAt?: string;
179
- /** Last activity time (ISO 8601) */
180
- lastActivityAt?: string;
181
- /** Model being used */
182
- model?: string;
183
- /** Available tools */
184
- tools?: string[];
185
- }
186
- //# sourceMappingURL=results.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../src/types/results.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,UAAU,GACV,aAAa,GACb,UAAU,GACV,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;C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;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,IAAI,EAAE,WAAW,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,sCAAsC;IACtC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,cAAc,GACd,OAAO,GACP,YAAY,GACZ,cAAc,GACd,WAAW,GACX,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Result Types
3
- *
4
- * Types for responses from sessions and prompts.
5
- */
6
- export {};
7
- //# sourceMappingURL=results.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/types/results.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,124 +0,0 @@
1
- /**
2
- * Budget Token Types
3
- *
4
- * Types for JWT tokens used for authentication and budget control.
5
- */
6
- /**
7
- * Budget window types
8
- */
9
- export type BudgetWindow = 'hour' | 'day' | 'week' | 'month';
10
- /**
11
- * Budget configuration in a token
12
- */
13
- export interface TokenBudget {
14
- /** AI budget in microdollars (1 USD = 1,000,000 microdollars) */
15
- ai: number;
16
- /** Compute budget in seconds */
17
- compute: number;
18
- /** Budget window period */
19
- window: BudgetWindow;
20
- /** When current period started (ISO 8601) */
21
- windowStart: string;
22
- }
23
- /**
24
- * Permission configuration in a token
25
- */
26
- export interface TokenPermissions {
27
- /** Allowed tool names */
28
- tools?: string[];
29
- /** Blocked tool names */
30
- blockedTools?: string[];
31
- /** Maximum turns per conversation */
32
- maxTurns?: number;
33
- /** Model restriction */
34
- model?: string;
35
- }
36
- /**
37
- * SDK configuration overrides in a token
38
- * When present, these values SUPERSEDE options provided by the SDK client
39
- */
40
- export interface TokenSdkConfig {
41
- /** Model to use */
42
- model?: string;
43
- /** System prompt */
44
- systemPrompt?: string;
45
- /** Tools configuration */
46
- tools?: unknown;
47
- /** Allowed tools */
48
- allowedTools?: string[];
49
- /** Disallowed tools */
50
- disallowedTools?: string[];
51
- /** Maximum turns */
52
- maxTurns?: number;
53
- /** Maximum budget in USD */
54
- maxBudgetUsd?: number;
55
- /** Maximum thinking tokens */
56
- maxThinkingTokens?: number;
57
- /** Permission mode */
58
- permissionMode?: string;
59
- /** Allow dangerous skip permissions */
60
- allowDangerouslySkipPermissions?: boolean;
61
- /** MCP servers configuration */
62
- mcpServers?: unknown[];
63
- /** Agents configuration */
64
- agents?: unknown;
65
- /** Betas configuration */
66
- betas?: string[];
67
- /** Output format */
68
- outputFormat?: string;
69
- /** Environment variables */
70
- env?: Record<string, string>;
71
- }
72
- /**
73
- * Budget token payload (JWT claims)
74
- */
75
- export interface BudgetTokenPayload {
76
- /** User ID - unique identifier for the end user */
77
- sub: string;
78
- /** Project/Issuer ID - identifies which project */
79
- iss: string;
80
- /** Token expiry timestamp (Unix seconds) */
81
- exp: number;
82
- /** Issued at timestamp (Unix seconds) */
83
- iat?: number;
84
- /** Budget declaration */
85
- budget: TokenBudget;
86
- /** Permission configuration (optional) */
87
- permissions?: TokenPermissions;
88
- /** SDK config overrides (optional) */
89
- sdkConfig?: TokenSdkConfig;
90
- }
91
- /**
92
- * Options for creating a budget token
93
- */
94
- export interface CreateTokenOptions {
95
- /** User ID */
96
- userId: string;
97
- /** Project/Issuer ID (UUID) */
98
- projectId: string;
99
- /** HMAC secret key for signing */
100
- secret: string;
101
- /** Token expiry duration in seconds (default: 3600 = 1 hour) */
102
- expiresIn?: number;
103
- /** Budget configuration */
104
- budget: TokenBudget;
105
- /** Permission configuration */
106
- permissions?: TokenPermissions;
107
- /** SDK config overrides */
108
- sdkConfig?: TokenSdkConfig;
109
- }
110
- /**
111
- * Decoded token result
112
- */
113
- export interface DecodedToken {
114
- /** Token header */
115
- header: {
116
- alg: string;
117
- typ: string;
118
- };
119
- /** Token payload */
120
- payload: BudgetTokenPayload;
121
- /** Token signature (base64url) */
122
- signature: string;
123
- }
124
- //# sourceMappingURL=token.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB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IAClB,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,2BAA2B;IAC3B,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,mBAAmB;IACnB,MAAM,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,oBAAoB;IACpB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Budget Token Types
3
- *
4
- * Types for JWT tokens used for authentication and budget control.
5
- */
6
- export {};
7
- //# sourceMappingURL=token.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/types/token.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1,234 +0,0 @@
1
- /**
2
- * Tool Definition Types
3
- *
4
- * Types for defining tools that can be executed by Claude.
5
- * Supports both server-side and browser-side execution.
6
- */
7
- /**
8
- * JSON Schema property types
9
- */
10
- export type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
11
- /**
12
- * JSON Schema property definition
13
- */
14
- export interface JsonSchemaProperty {
15
- /** Property type */
16
- type: JsonSchemaType;
17
- /** Human-readable description */
18
- description?: string;
19
- /** Enumeration of allowed values */
20
- enum?: string[];
21
- /** Default value */
22
- default?: unknown;
23
- /** For arrays: schema of array items */
24
- items?: JsonSchemaProperty;
25
- /** For objects: nested properties */
26
- properties?: Record<string, JsonSchemaProperty>;
27
- /** For objects: required property names */
28
- required?: string[];
29
- /** Minimum value (for numbers) */
30
- minimum?: number;
31
- /** Maximum value (for numbers) */
32
- maximum?: number;
33
- /** Minimum length (for strings/arrays) */
34
- minLength?: number;
35
- /** Maximum length (for strings/arrays) */
36
- maxLength?: number;
37
- /** Pattern (for strings) */
38
- pattern?: string;
39
- }
40
- /**
41
- * JSON Schema for tool input
42
- */
43
- export interface ToolInputSchema {
44
- /** Always 'object' for tool inputs */
45
- type: 'object';
46
- /** Property definitions */
47
- properties: Record<string, JsonSchemaProperty>;
48
- /** Required property names */
49
- required?: string[];
50
- /** Allow additional properties */
51
- additionalProperties?: boolean;
52
- }
53
- /**
54
- * Tool content types for results
55
- */
56
- export type ToolContentType = 'text' | 'image' | 'resource';
57
- /**
58
- * Text content in tool result (MCP format)
59
- */
60
- export interface ToolTextContent {
61
- type: 'text';
62
- text: string;
63
- }
64
- /**
65
- * Image content in tool result (MCP format)
66
- */
67
- export interface ToolImageContent {
68
- type: 'image';
69
- /** Base64-encoded image data */
70
- data: string;
71
- /** MIME type (e.g., 'image/png') */
72
- mimeType: string;
73
- }
74
- /**
75
- * Resource content in tool result
76
- */
77
- export interface ResourceContent {
78
- type: 'resource';
79
- /** Resource URI */
80
- uri: string;
81
- /** MIME type */
82
- mimeType?: string;
83
- /** Resource text content */
84
- text?: string;
85
- /** Resource binary data (base64) */
86
- blob?: string;
87
- }
88
- /**
89
- * Union type for all tool content
90
- */
91
- export type ToolContent = ToolTextContent | ToolImageContent | ResourceContent;
92
- /**
93
- * Tool execution result
94
- */
95
- export interface ToolResult {
96
- /** Result content */
97
- content: ToolContent[];
98
- /** Whether this is an error result */
99
- isError?: boolean;
100
- }
101
- /**
102
- * Where the tool should be executed
103
- */
104
- export type ToolExecutionLocation = 'server' | 'browser';
105
- /**
106
- * Tool handler function type
107
- */
108
- export type ToolHandler<TInput = Record<string, unknown>> = (input: TInput) => ToolResult | Promise<ToolResult>;
109
- /**
110
- * Tool definition
111
- */
112
- export interface ToolDefinition<TInput = Record<string, unknown>> {
113
- /** Unique tool name */
114
- name: string;
115
- /** Human-readable description of what the tool does */
116
- description: string;
117
- /** JSON Schema defining the input parameters */
118
- inputSchema: ToolInputSchema;
119
- /**
120
- * Where the tool should be executed
121
- * @default 'server'
122
- */
123
- executeIn?: ToolExecutionLocation;
124
- /**
125
- * Handler function (required for browser tools, optional for server tools)
126
- */
127
- handler?: ToolHandler<TInput>;
128
- }
129
- /**
130
- * MCP Server with client-side tools (handlers run in your app)
131
- * This is our custom format - bridge converts to SDK format
132
- */
133
- export interface McpClientToolsServer {
134
- /** Server name */
135
- name: string;
136
- /** Server version */
137
- version?: string;
138
- /** Tools with handlers that execute client-side */
139
- tools: ToolDefinition[];
140
- }
141
- /**
142
- * MCP Stdio server configuration
143
- */
144
- export interface McpStdioServerConfig {
145
- /** Server name */
146
- name: string;
147
- /** Server type */
148
- type?: 'stdio';
149
- /** Command to run */
150
- command: string;
151
- /** Command arguments */
152
- args?: string[];
153
- /** Environment variables */
154
- env?: Record<string, string>;
155
- }
156
- /**
157
- * MCP SSE server configuration
158
- */
159
- export interface McpSSEServerConfig {
160
- /** Server name */
161
- name: string;
162
- /** Server type */
163
- type: 'sse';
164
- /** SSE endpoint URL */
165
- url: string;
166
- /** Request headers */
167
- headers?: Record<string, string>;
168
- }
169
- /**
170
- * MCP HTTP server configuration
171
- */
172
- export interface McpHttpServerConfig {
173
- /** Server name */
174
- name: string;
175
- /** Server type */
176
- type: 'http';
177
- /** HTTP endpoint URL */
178
- url: string;
179
- /** Request headers */
180
- headers?: Record<string, string>;
181
- }
182
- /**
183
- * MCP Server definition - all supported server types
184
- * Array format - bridge converts to Record<string, config> for official SDK
185
- */
186
- export type McpServerDefinition = McpClientToolsServer | McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig;
187
- /**
188
- * Type guard for client-side tools server
189
- */
190
- export declare function isClientToolsServer(server: McpServerDefinition): server is McpClientToolsServer;
191
- /**
192
- * Type guard for stdio server
193
- */
194
- export declare function isStdioServer(server: McpServerDefinition): server is McpStdioServerConfig;
195
- /**
196
- * Type guard for SSE server
197
- */
198
- export declare function isSSEServer(server: McpServerDefinition): server is McpSSEServerConfig;
199
- /**
200
- * Type guard for HTTP server
201
- */
202
- export declare function isHttpServer(server: McpServerDefinition): server is McpHttpServerConfig;
203
- /**
204
- * Tool preset configuration
205
- */
206
- export interface ToolPreset {
207
- type: 'preset';
208
- preset: 'claude_code';
209
- }
210
- /**
211
- * Tools configuration - either allowlist of names or preset
212
- */
213
- export type ToolsConfig = string[] | ToolPreset;
214
- /**
215
- * Tool call from the model
216
- */
217
- export interface ToolCall {
218
- /** Unique call ID */
219
- callId: string;
220
- /** Tool name */
221
- toolName: string;
222
- /** Input arguments */
223
- input: Record<string, unknown>;
224
- }
225
- /**
226
- * Tool call response
227
- */
228
- export interface ToolCallResponse {
229
- /** Call ID (must match the tool call) */
230
- callId: string;
231
- /** Tool execution result */
232
- result: ToolResult;
233
- }
234
- //# sourceMappingURL=tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,QAAQ,GACR,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oBAAoB;IACpB,IAAI,EAAE,cAAc,CAAC;IACrB,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wCAAwC;IACxC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,k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,CAAC;IACf,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,MAAM,EAAE,UAAU,CAAC;CACpB"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Tool Definition Types
3
- *
4
- * Types for defining tools that can be executed by Claude.
5
- * Supports both server-side and browser-side execution.
6
- */
7
- /**
8
- * Type guard for client-side tools server
9
- */
10
- export function isClientToolsServer(server) {
11
- return 'tools' in server;
12
- }
13
- /**
14
- * Type guard for stdio server
15
- */
16
- export function isStdioServer(server) {
17
- return 'command' in server;
18
- }
19
- /**
20
- * Type guard for SSE server
21
- */
22
- export function isSSEServer(server) {
23
- return 'type' in server && server.type === 'sse';
24
- }
25
- /**
26
- * Type guard for HTTP server
27
- */
28
- export function isHttpServer(server) {
29
- return 'type' in server && server.type === 'http';
30
- }
31
- //# sourceMappingURL=tools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoNH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA2B;IAC7D,OAAO,OAAO,IAAI,MAAM,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAA2B;IACvD,OAAO,SAAS,IAAI,MAAM,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAA2B;IACrD,OAAO,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,CAAC;AACnD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAA2B;IACtD,OAAO,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC;AACpD,CAAC"}