@chucky.cloud/sdk 0.1.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.
- package/README.md +330 -0
- package/dist/browser.d.ts +8 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +12 -0
- package/dist/browser.js.map +1 -0
- package/dist/client/ChuckyClient.d.ts +187 -0
- package/dist/client/ChuckyClient.d.ts.map +1 -0
- package/dist/client/ChuckyClient.js +232 -0
- package/dist/client/ChuckyClient.js.map +1 -0
- package/dist/client/Session.d.ts +146 -0
- package/dist/client/Session.d.ts.map +1 -0
- package/dist/client/Session.js +405 -0
- package/dist/client/Session.js.map +1 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +8 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +8 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +11 -0
- package/dist/node.js.map +1 -0
- package/dist/tools/McpServer.d.ts +117 -0
- package/dist/tools/McpServer.d.ts.map +1 -0
- package/dist/tools/McpServer.js +142 -0
- package/dist/tools/McpServer.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/tool.d.ts +146 -0
- package/dist/tools/tool.d.ts.map +1 -0
- package/dist/tools/tool.js +232 -0
- package/dist/tools/tool.js.map +1 -0
- package/dist/transport/Transport.d.ts +82 -0
- package/dist/transport/Transport.d.ts.map +1 -0
- package/dist/transport/Transport.js +45 -0
- package/dist/transport/Transport.js.map +1 -0
- package/dist/transport/WebSocketTransport.d.ts +78 -0
- package/dist/transport/WebSocketTransport.d.ts.map +1 -0
- package/dist/transport/WebSocketTransport.js +253 -0
- package/dist/transport/WebSocketTransport.js.map +1 -0
- package/dist/transport/index.d.ts +10 -0
- package/dist/transport/index.d.ts.map +1 -0
- package/dist/transport/index.js +8 -0
- package/dist/transport/index.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/messages.d.ts +195 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/messages.js +70 -0
- package/dist/types/messages.js.map +1 -0
- package/dist/types/options.d.ts +210 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +8 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/results.d.ts +182 -0
- package/dist/types/results.d.ts.map +1 -0
- package/dist/types/results.js +7 -0
- package/dist/types/results.js.map +1 -0
- package/dist/types/token.d.ts +124 -0
- package/dist/types/token.d.ts.map +1 -0
- package/dist/types/token.js +7 -0
- package/dist/types/token.js.map +1 -0
- package/dist/types/tools.d.ts +160 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +8 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/errors.d.ts +80 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +158 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/token.d.ts +93 -0
- package/dist/utils/token.d.ts.map +1 -0
- package/dist/utils/token.js +195 -0
- package/dist/utils/token.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helpers for creating and decoding JWT tokens for authentication.
|
|
5
|
+
* These are primarily for server-side use (Node.js).
|
|
6
|
+
*/
|
|
7
|
+
import type { CreateTokenOptions, DecodedToken, TokenBudget } from '../types/token.js';
|
|
8
|
+
/**
|
|
9
|
+
* Create a budget token (JWT) for authenticating with Chucky
|
|
10
|
+
*
|
|
11
|
+
* @param options - Token creation options
|
|
12
|
+
* @returns Signed JWT token
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Server-side token creation
|
|
17
|
+
* const token = await createToken({
|
|
18
|
+
* userId: 'user-123',
|
|
19
|
+
* projectId: '550e8400-e29b-41d4-a716-446655440000',
|
|
20
|
+
* secret: 'your-hmac-secret',
|
|
21
|
+
* budget: {
|
|
22
|
+
* ai: 1_000_000, // $1 in microdollars
|
|
23
|
+
* compute: 3600, // 1 hour
|
|
24
|
+
* window: 'day',
|
|
25
|
+
* windowStart: new Date().toISOString(),
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function createToken(options: CreateTokenOptions): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Decode a token without verification
|
|
33
|
+
*
|
|
34
|
+
* @param token - JWT token to decode
|
|
35
|
+
* @returns Decoded token parts
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const decoded = decodeToken(token);
|
|
40
|
+
* console.log(decoded.payload.sub); // User ID
|
|
41
|
+
* console.log(decoded.payload.budget); // Budget limits
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function decodeToken(token: string): DecodedToken;
|
|
45
|
+
/**
|
|
46
|
+
* Verify a token signature
|
|
47
|
+
*
|
|
48
|
+
* @param token - JWT token to verify
|
|
49
|
+
* @param secret - HMAC secret for verification
|
|
50
|
+
* @returns True if signature is valid
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* const isValid = await verifyToken(token, 'your-hmac-secret');
|
|
55
|
+
* if (!isValid) {
|
|
56
|
+
* throw new Error('Invalid token');
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function verifyToken(token: string, secret: string): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Check if a token is expired
|
|
63
|
+
*
|
|
64
|
+
* @param token - JWT token to check
|
|
65
|
+
* @returns True if token is expired
|
|
66
|
+
*/
|
|
67
|
+
export declare function isTokenExpired(token: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Create a simple budget configuration
|
|
70
|
+
*
|
|
71
|
+
* @param options - Budget options
|
|
72
|
+
* @returns Budget configuration
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const budget = createBudget({
|
|
77
|
+
* aiDollars: 1.00, // $1 AI budget
|
|
78
|
+
* computeHours: 1, // 1 hour compute
|
|
79
|
+
* window: 'day',
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function createBudget(options: {
|
|
84
|
+
/** AI budget in dollars */
|
|
85
|
+
aiDollars: number;
|
|
86
|
+
/** Compute budget in hours */
|
|
87
|
+
computeHours: number;
|
|
88
|
+
/** Budget window */
|
|
89
|
+
window: 'hour' | 'day' | 'week' | 'month';
|
|
90
|
+
/** Window start (default: now) */
|
|
91
|
+
windowStart?: Date;
|
|
92
|
+
}): TokenBudget;
|
|
93
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/utils/token.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAEV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAkF3B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsC9E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAYvD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUjF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE;IACpC,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB;IACpB,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAC1C,kCAAkC;IAClC,WAAW,CAAC,EAAE,IAAI,CAAC;CACpB,GAAG,WAAW,CAOd"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token Utilities
|
|
3
|
+
*
|
|
4
|
+
* Helpers for creating and decoding JWT tokens for authentication.
|
|
5
|
+
* These are primarily for server-side use (Node.js).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base64URL encode a string
|
|
9
|
+
*/
|
|
10
|
+
function base64UrlEncode(data) {
|
|
11
|
+
let base64;
|
|
12
|
+
if (typeof data === 'string') {
|
|
13
|
+
// Use TextEncoder for string
|
|
14
|
+
const bytes = new TextEncoder().encode(data);
|
|
15
|
+
base64 = btoa(String.fromCharCode(...bytes));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
base64 = btoa(String.fromCharCode(...data));
|
|
19
|
+
}
|
|
20
|
+
return base64
|
|
21
|
+
.replace(/\+/g, '-')
|
|
22
|
+
.replace(/\//g, '_')
|
|
23
|
+
.replace(/=+$/, '');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Base64URL decode a string
|
|
27
|
+
*/
|
|
28
|
+
function base64UrlDecode(str) {
|
|
29
|
+
const base64 = str.replace(/-/g, '+').replace(/_/g, '/');
|
|
30
|
+
const padding = '='.repeat((4 - (base64.length % 4)) % 4);
|
|
31
|
+
const bytes = atob(base64 + padding);
|
|
32
|
+
return bytes;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get crypto implementation (browser or Node.js)
|
|
36
|
+
*/
|
|
37
|
+
async function getCrypto() {
|
|
38
|
+
if (typeof crypto !== 'undefined' && crypto.subtle) {
|
|
39
|
+
return crypto;
|
|
40
|
+
}
|
|
41
|
+
// Node.js: use webcrypto
|
|
42
|
+
const nodeCrypto = await import('crypto');
|
|
43
|
+
return nodeCrypto.webcrypto;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create HMAC-SHA256 signature
|
|
47
|
+
*/
|
|
48
|
+
async function createHmacSignature(secret, data) {
|
|
49
|
+
const { subtle } = await getCrypto();
|
|
50
|
+
const keyData = new TextEncoder().encode(secret);
|
|
51
|
+
const key = await subtle.importKey('raw', keyData, { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
|
|
52
|
+
const signature = await subtle.sign('HMAC', key, new TextEncoder().encode(data));
|
|
53
|
+
return base64UrlEncode(new Uint8Array(signature));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Verify HMAC-SHA256 signature
|
|
57
|
+
*/
|
|
58
|
+
async function verifyHmacSignature(secret, data, signature) {
|
|
59
|
+
const expectedSignature = await createHmacSignature(secret, data);
|
|
60
|
+
return signature === expectedSignature;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Create a budget token (JWT) for authenticating with Chucky
|
|
64
|
+
*
|
|
65
|
+
* @param options - Token creation options
|
|
66
|
+
* @returns Signed JWT token
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* // Server-side token creation
|
|
71
|
+
* const token = await createToken({
|
|
72
|
+
* userId: 'user-123',
|
|
73
|
+
* projectId: '550e8400-e29b-41d4-a716-446655440000',
|
|
74
|
+
* secret: 'your-hmac-secret',
|
|
75
|
+
* budget: {
|
|
76
|
+
* ai: 1_000_000, // $1 in microdollars
|
|
77
|
+
* compute: 3600, // 1 hour
|
|
78
|
+
* window: 'day',
|
|
79
|
+
* windowStart: new Date().toISOString(),
|
|
80
|
+
* },
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export async function createToken(options) {
|
|
85
|
+
const { userId, projectId, secret, expiresIn = 3600, budget, permissions, sdkConfig, } = options;
|
|
86
|
+
const now = Math.floor(Date.now() / 1000);
|
|
87
|
+
const payload = {
|
|
88
|
+
sub: userId,
|
|
89
|
+
iss: projectId,
|
|
90
|
+
iat: now,
|
|
91
|
+
exp: now + expiresIn,
|
|
92
|
+
budget,
|
|
93
|
+
...(permissions && { permissions }),
|
|
94
|
+
...(sdkConfig && { sdkConfig }),
|
|
95
|
+
};
|
|
96
|
+
// Create header
|
|
97
|
+
const header = {
|
|
98
|
+
alg: 'HS256',
|
|
99
|
+
typ: 'JWT',
|
|
100
|
+
};
|
|
101
|
+
// Encode header and payload
|
|
102
|
+
const encodedHeader = base64UrlEncode(JSON.stringify(header));
|
|
103
|
+
const encodedPayload = base64UrlEncode(JSON.stringify(payload));
|
|
104
|
+
// Create signature
|
|
105
|
+
const signatureInput = `${encodedHeader}.${encodedPayload}`;
|
|
106
|
+
const signature = await createHmacSignature(secret, signatureInput);
|
|
107
|
+
return `${encodedHeader}.${encodedPayload}.${signature}`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Decode a token without verification
|
|
111
|
+
*
|
|
112
|
+
* @param token - JWT token to decode
|
|
113
|
+
* @returns Decoded token parts
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const decoded = decodeToken(token);
|
|
118
|
+
* console.log(decoded.payload.sub); // User ID
|
|
119
|
+
* console.log(decoded.payload.budget); // Budget limits
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export function decodeToken(token) {
|
|
123
|
+
const parts = token.split('.');
|
|
124
|
+
if (parts.length !== 3) {
|
|
125
|
+
throw new Error('Invalid token format');
|
|
126
|
+
}
|
|
127
|
+
const [encodedHeader, encodedPayload, signature] = parts;
|
|
128
|
+
const header = JSON.parse(base64UrlDecode(encodedHeader));
|
|
129
|
+
const payload = JSON.parse(base64UrlDecode(encodedPayload));
|
|
130
|
+
return { header, payload, signature };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Verify a token signature
|
|
134
|
+
*
|
|
135
|
+
* @param token - JWT token to verify
|
|
136
|
+
* @param secret - HMAC secret for verification
|
|
137
|
+
* @returns True if signature is valid
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* const isValid = await verifyToken(token, 'your-hmac-secret');
|
|
142
|
+
* if (!isValid) {
|
|
143
|
+
* throw new Error('Invalid token');
|
|
144
|
+
* }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
export async function verifyToken(token, secret) {
|
|
148
|
+
const parts = token.split('.');
|
|
149
|
+
if (parts.length !== 3) {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
const [encodedHeader, encodedPayload, signature] = parts;
|
|
153
|
+
const signatureInput = `${encodedHeader}.${encodedPayload}`;
|
|
154
|
+
return verifyHmacSignature(secret, signatureInput, signature);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if a token is expired
|
|
158
|
+
*
|
|
159
|
+
* @param token - JWT token to check
|
|
160
|
+
* @returns True if token is expired
|
|
161
|
+
*/
|
|
162
|
+
export function isTokenExpired(token) {
|
|
163
|
+
try {
|
|
164
|
+
const decoded = decodeToken(token);
|
|
165
|
+
const now = Math.floor(Date.now() / 1000);
|
|
166
|
+
return decoded.payload.exp < now;
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Create a simple budget configuration
|
|
174
|
+
*
|
|
175
|
+
* @param options - Budget options
|
|
176
|
+
* @returns Budget configuration
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const budget = createBudget({
|
|
181
|
+
* aiDollars: 1.00, // $1 AI budget
|
|
182
|
+
* computeHours: 1, // 1 hour compute
|
|
183
|
+
* window: 'day',
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export function createBudget(options) {
|
|
188
|
+
return {
|
|
189
|
+
ai: Math.floor(options.aiDollars * 1_000_000), // Convert to microdollars
|
|
190
|
+
compute: Math.floor(options.computeHours * 3600), // Convert to seconds
|
|
191
|
+
window: options.window,
|
|
192
|
+
windowStart: (options.windowStart || new Date()).toISOString(),
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/utils/token.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;GAEG;AACH,SAAS,eAAe,CAAC,IAAyB;IAChD,IAAI,MAAc,CAAC;IAEnB,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,6BAA6B;QAC7B,MAAM,KAAK,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,MAAM;SACV,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,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AG,WAAW,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QAC1C,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,YAAY,CAAC,OAS5B;IACC,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,EAAE,0BAA0B;QACzE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,qBAAqB;QACvE,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE;KAC/D,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@chucky.cloud/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SDK for interacting with Chucky sandbox - supports both browser and Node.js",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./browser": {
|
|
15
|
+
"import": "./dist/browser.js",
|
|
16
|
+
"types": "./dist/browser.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./node": {
|
|
19
|
+
"import": "./dist/node.js",
|
|
20
|
+
"types": "./dist/node.d.ts"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc",
|
|
29
|
+
"dev": "tsc --watch",
|
|
30
|
+
"clean": "rm -rf dist",
|
|
31
|
+
"prepublishOnly": "npm run build",
|
|
32
|
+
"typecheck": "tsc --noEmit"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"chucky",
|
|
36
|
+
"claude",
|
|
37
|
+
"anthropic",
|
|
38
|
+
"ai",
|
|
39
|
+
"sdk",
|
|
40
|
+
"agent"
|
|
41
|
+
],
|
|
42
|
+
"author": "Chucky Cloud",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"ws": "^8.18.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.10.10",
|
|
49
|
+
"@types/ws": "^8.5.13",
|
|
50
|
+
"typescript": "^5.7.3"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"zod": "^3.0.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"zod": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": ">=18.0.0"
|
|
62
|
+
}
|
|
63
|
+
}
|