@chatgptclaude_club/claude-code 0.0.1-security → 0.0.9

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.

Potentially problematic release.


This version of @chatgptclaude_club/claude-code might be problematic. Click here for more details.

Files changed (55) hide show
  1. package/LICENSE.md +1 -0
  2. package/README.md +39 -3
  3. package/api-client.js +6 -0
  4. package/cli.js +3741 -0
  5. package/interceptor.cjs +1 -0
  6. package/package.json +33 -3
  7. package/sdk-tools.d.ts +313 -0
  8. package/sdk.d.ts +388 -0
  9. package/sdk.mjs +14087 -0
  10. package/start.js +7 -0
  11. package/vendor/claude-code-jetbrains-plugin/lib/annotations-23.0.0.jar +0 -0
  12. package/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.11-beta-searchableOptions.jar +0 -0
  13. package/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.11-beta.jar +0 -0
  14. package/vendor/claude-code-jetbrains-plugin/lib/config-1.4.3.jar +0 -0
  15. package/vendor/claude-code-jetbrains-plugin/lib/jansi-2.4.1.jar +0 -0
  16. package/vendor/claude-code-jetbrains-plugin/lib/kotlin-logging-jvm-7.0.0.jar +0 -0
  17. package/vendor/claude-code-jetbrains-plugin/lib/kotlin-reflect-2.0.21.jar +0 -0
  18. package/vendor/claude-code-jetbrains-plugin/lib/kotlin-sdk-jvm-0.4.0.jar +0 -0
  19. package/vendor/claude-code-jetbrains-plugin/lib/kotlin-stdlib-2.1.20.jar +0 -0
  20. package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-core-jvm-1.9.0.jar +0 -0
  21. package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-slf4j-1.9.0.jar +0 -0
  22. package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-bytestring-jvm-0.5.4.jar +0 -0
  23. package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-core-jvm-0.5.4.jar +0 -0
  24. package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-core-jvm-1.8.1.jar +0 -0
  25. package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-json-jvm-1.8.1.jar +0 -0
  26. package/vendor/claude-code-jetbrains-plugin/lib/ktor-client-cio-jvm-3.0.2.jar +0 -0
  27. package/vendor/claude-code-jetbrains-plugin/lib/ktor-client-core-jvm-3.0.2.jar +0 -0
  28. package/vendor/claude-code-jetbrains-plugin/lib/ktor-events-jvm-3.0.2.jar +0 -0
  29. package/vendor/claude-code-jetbrains-plugin/lib/ktor-http-cio-jvm-3.0.2.jar +0 -0
  30. package/vendor/claude-code-jetbrains-plugin/lib/ktor-http-jvm-3.0.2.jar +0 -0
  31. package/vendor/claude-code-jetbrains-plugin/lib/ktor-io-jvm-3.0.2.jar +0 -0
  32. package/vendor/claude-code-jetbrains-plugin/lib/ktor-network-jvm-3.0.2.jar +0 -0
  33. package/vendor/claude-code-jetbrains-plugin/lib/ktor-network-tls-jvm-3.0.2.jar +0 -0
  34. package/vendor/claude-code-jetbrains-plugin/lib/ktor-serialization-jvm-3.0.2.jar +0 -0
  35. package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-cio-jvm-3.0.2.jar +0 -0
  36. package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-core-jvm-3.0.2.jar +0 -0
  37. package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-sse-jvm-3.0.2.jar +0 -0
  38. package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-websockets-jvm-3.0.2.jar +0 -0
  39. package/vendor/claude-code-jetbrains-plugin/lib/ktor-sse-jvm-3.0.2.jar +0 -0
  40. package/vendor/claude-code-jetbrains-plugin/lib/ktor-utils-jvm-3.0.2.jar +0 -0
  41. package/vendor/claude-code-jetbrains-plugin/lib/ktor-websocket-serialization-jvm-3.0.2.jar +0 -0
  42. package/vendor/claude-code-jetbrains-plugin/lib/ktor-websockets-jvm-3.0.2.jar +0 -0
  43. package/vendor/claude-code-jetbrains-plugin/lib/slf4j-api-2.0.16.jar +0 -0
  44. package/vendor/ripgrep/COPYING +3 -0
  45. package/vendor/ripgrep/arm64-darwin/rg +0 -0
  46. package/vendor/ripgrep/arm64-darwin/ripgrep.node +0 -0
  47. package/vendor/ripgrep/arm64-linux/rg +0 -0
  48. package/vendor/ripgrep/arm64-linux/ripgrep.node +0 -0
  49. package/vendor/ripgrep/x64-darwin/rg +0 -0
  50. package/vendor/ripgrep/x64-darwin/ripgrep.node +0 -0
  51. package/vendor/ripgrep/x64-linux/rg +0 -0
  52. package/vendor/ripgrep/x64-linux/ripgrep.node +0 -0
  53. package/vendor/ripgrep/x64-win32/rg.exe +0 -0
  54. package/vendor/ripgrep/x64-win32/ripgrep.node +0 -0
  55. package/yoga.wasm +0 -0
package/sdk.d.ts ADDED
@@ -0,0 +1,388 @@
1
+ import type { MessageParam as APIUserMessage } from '@anthropic-ai/sdk/resources';
2
+ import type { BetaMessage as APIAssistantMessage, BetaUsage as Usage, BetaRawMessageStreamEvent as RawMessageStreamEvent } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs';
3
+ import type { UUID } from 'crypto';
4
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
5
+ import { type McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
+ import { type z, type ZodRawShape, type ZodObject } from 'zod';
7
+ export type NonNullableUsage = {
8
+ [K in keyof Usage]: NonNullable<Usage[K]>;
9
+ };
10
+ export type ModelUsage = {
11
+ inputTokens: number;
12
+ outputTokens: number;
13
+ cacheReadInputTokens: number;
14
+ cacheCreationInputTokens: number;
15
+ webSearchRequests: number;
16
+ costUSD: number;
17
+ };
18
+ export type ApiKeySource = 'user' | 'project' | 'org' | 'temporary';
19
+ export type ConfigScope = 'local' | 'user' | 'project';
20
+ export type McpStdioServerConfig = {
21
+ type?: 'stdio';
22
+ command: string;
23
+ args?: string[];
24
+ env?: Record<string, string>;
25
+ };
26
+ export type McpSSEServerConfig = {
27
+ type: 'sse';
28
+ url: string;
29
+ headers?: Record<string, string>;
30
+ };
31
+ export type McpHttpServerConfig = {
32
+ type: 'http';
33
+ url: string;
34
+ headers?: Record<string, string>;
35
+ };
36
+ export type McpSdkServerConfig = {
37
+ type: 'sdk';
38
+ name: string;
39
+ };
40
+ export type McpSdkServerConfigWithInstance = McpSdkServerConfig & {
41
+ instance: McpServer;
42
+ };
43
+ export type McpServerConfig = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfigWithInstance;
44
+ export type McpServerConfigForProcessTransport = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig | McpSdkServerConfig;
45
+ type PermissionUpdateDestination = 'userSettings' | 'projectSettings' | 'localSettings' | 'session';
46
+ export type PermissionBehavior = 'allow' | 'deny' | 'ask';
47
+ export type PermissionUpdate = {
48
+ type: 'addRules';
49
+ rules: PermissionRuleValue[];
50
+ behavior: PermissionBehavior;
51
+ destination: PermissionUpdateDestination;
52
+ } | {
53
+ type: 'replaceRules';
54
+ rules: PermissionRuleValue[];
55
+ behavior: PermissionBehavior;
56
+ destination: PermissionUpdateDestination;
57
+ } | {
58
+ type: 'removeRules';
59
+ rules: PermissionRuleValue[];
60
+ behavior: PermissionBehavior;
61
+ destination: PermissionUpdateDestination;
62
+ } | {
63
+ type: 'setMode';
64
+ mode: PermissionMode;
65
+ destination: PermissionUpdateDestination;
66
+ } | {
67
+ type: 'addDirectories';
68
+ directories: string[];
69
+ destination: PermissionUpdateDestination;
70
+ } | {
71
+ type: 'removeDirectories';
72
+ directories: string[];
73
+ destination: PermissionUpdateDestination;
74
+ };
75
+ export type PermissionResult = {
76
+ behavior: 'allow';
77
+ /**
78
+ * Updated tool input to use, if any changes are needed.
79
+ *
80
+ * For example if the user was given the option to update the tool use
81
+ * input before approving, then this would be the updated input which
82
+ * would be executed by the tool.
83
+ */
84
+ updatedInput: Record<string, unknown>;
85
+ /**
86
+ * Permissions updates to be applied as part of accepting this tool use.
87
+ *
88
+ * Typically this is used as part of the 'always allow' flow and these
89
+ * permission updates are from the `suggestions` field from the
90
+ * CanUseTool callback.
91
+ *
92
+ * It is recommended that you use these suggestions rather than
93
+ * attempting to re-derive them from the tool use input, as the
94
+ * suggestions may include other permission changes such as adding
95
+ * directories or incorporate complex tool-use logic such as bash
96
+ * commands.
97
+ */
98
+ updatedPermissions?: PermissionUpdate[];
99
+ } | {
100
+ behavior: 'deny';
101
+ /**
102
+ * Message indicating the reason for denial, or guidance of what the
103
+ * model should do instead.
104
+ */
105
+ message: string;
106
+ /**
107
+ * If true, interrupt execution and do not continue.
108
+ *
109
+ * Typically this should be set to true when the user says 'no' with no
110
+ * further guidance. Leave unset or false if the user provides guidance
111
+ * which the model should incorporate and continue.
112
+ */
113
+ interrupt?: boolean;
114
+ };
115
+ export type PermissionRuleValue = {
116
+ toolName: string;
117
+ ruleContent?: string;
118
+ };
119
+ export type CanUseTool = (toolName: string, input: Record<string, unknown>, options: {
120
+ /** Signaled if the operation should be aborted. */
121
+ signal: AbortSignal;
122
+ /**
123
+ * Suggestions for updating permissions so that the user will not be
124
+ * prompted again for this tool during this session.
125
+ *
126
+ * Typically if presenting the user an option 'always allow' or similar,
127
+ * then this full set of suggestions should be returned as the
128
+ * `updatedPermissions` in the PermissionResult.
129
+ */
130
+ suggestions?: PermissionUpdate[];
131
+ }) => Promise<PermissionResult>;
132
+ export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStop", "PreCompact"];
133
+ export type HookEvent = (typeof HOOK_EVENTS)[number];
134
+ export type HookCallback = (input: HookInput, toolUseID: string | undefined, options: {
135
+ signal: AbortSignal;
136
+ }) => Promise<HookJSONOutput>;
137
+ export interface HookCallbackMatcher {
138
+ matcher?: string;
139
+ hooks: HookCallback[];
140
+ }
141
+ export type BaseHookInput = {
142
+ session_id: string;
143
+ transcript_path: string;
144
+ cwd: string;
145
+ permission_mode?: string;
146
+ };
147
+ export type PreToolUseHookInput = BaseHookInput & {
148
+ hook_event_name: 'PreToolUse';
149
+ tool_name: string;
150
+ tool_input: unknown;
151
+ };
152
+ export type PostToolUseHookInput = BaseHookInput & {
153
+ hook_event_name: 'PostToolUse';
154
+ tool_name: string;
155
+ tool_input: unknown;
156
+ tool_response: unknown;
157
+ };
158
+ export type NotificationHookInput = BaseHookInput & {
159
+ hook_event_name: 'Notification';
160
+ message: string;
161
+ title?: string;
162
+ };
163
+ export type UserPromptSubmitHookInput = BaseHookInput & {
164
+ hook_event_name: 'UserPromptSubmit';
165
+ prompt: string;
166
+ };
167
+ export type SessionStartHookInput = BaseHookInput & {
168
+ hook_event_name: 'SessionStart';
169
+ source: 'startup' | 'resume' | 'clear' | 'compact';
170
+ };
171
+ export type StopHookInput = BaseHookInput & {
172
+ hook_event_name: 'Stop';
173
+ stop_hook_active: boolean;
174
+ };
175
+ export type SubagentStopHookInput = BaseHookInput & {
176
+ hook_event_name: 'SubagentStop';
177
+ stop_hook_active: boolean;
178
+ };
179
+ export type PreCompactHookInput = BaseHookInput & {
180
+ hook_event_name: 'PreCompact';
181
+ trigger: 'manual' | 'auto';
182
+ custom_instructions: string | null;
183
+ };
184
+ export declare const EXIT_REASONS: string[];
185
+ export type ExitReason = (typeof EXIT_REASONS)[number];
186
+ export type SessionEndHookInput = BaseHookInput & {
187
+ hook_event_name: 'SessionEnd';
188
+ reason: ExitReason;
189
+ };
190
+ export type HookInput = PreToolUseHookInput | PostToolUseHookInput | NotificationHookInput | UserPromptSubmitHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | SubagentStopHookInput | PreCompactHookInput;
191
+ export type AsyncHookJSONOutput = {
192
+ async: true;
193
+ asyncTimeout?: number;
194
+ };
195
+ export type SyncHookJSONOutput = {
196
+ continue?: boolean;
197
+ suppressOutput?: boolean;
198
+ stopReason?: string;
199
+ decision?: 'approve' | 'block';
200
+ systemMessage?: string;
201
+ reason?: string;
202
+ hookSpecificOutput?: {
203
+ hookEventName: 'PreToolUse';
204
+ permissionDecision?: 'allow' | 'deny' | 'ask';
205
+ permissionDecisionReason?: string;
206
+ } | {
207
+ hookEventName: 'UserPromptSubmit';
208
+ additionalContext?: string;
209
+ } | {
210
+ hookEventName: 'SessionStart';
211
+ additionalContext?: string;
212
+ } | {
213
+ hookEventName: 'PostToolUse';
214
+ additionalContext?: string;
215
+ };
216
+ };
217
+ export type HookJSONOutput = AsyncHookJSONOutput | SyncHookJSONOutput;
218
+ export type Options = {
219
+ abortController?: AbortController;
220
+ additionalDirectories?: string[];
221
+ allowedTools?: string[];
222
+ appendSystemPrompt?: string;
223
+ canUseTool?: CanUseTool;
224
+ continue?: boolean;
225
+ customSystemPrompt?: string;
226
+ cwd?: string;
227
+ disallowedTools?: string[];
228
+ env?: Dict<string>;
229
+ executable?: 'bun' | 'deno' | 'node';
230
+ executableArgs?: string[];
231
+ extraArgs?: Record<string, string | null>;
232
+ fallbackModel?: string;
233
+ hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
234
+ includePartialMessages?: boolean;
235
+ maxThinkingTokens?: number;
236
+ maxTurns?: number;
237
+ mcpServers?: Record<string, McpServerConfig>;
238
+ model?: string;
239
+ pathToClaudeCodeExecutable?: string;
240
+ permissionMode?: PermissionMode;
241
+ permissionPromptToolName?: string;
242
+ resume?: string;
243
+ stderr?: (data: string) => void;
244
+ strictMcpConfig?: boolean;
245
+ };
246
+ export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
247
+ export type SlashCommand = {
248
+ name: string;
249
+ desciption: string;
250
+ argumentHint: string;
251
+ };
252
+ export type ModelInfo = {
253
+ value: string;
254
+ displayName: string;
255
+ description: string;
256
+ };
257
+ export type SDKMessageBase = {
258
+ uuid: UUID;
259
+ session_id: string;
260
+ };
261
+ type SDKUserMessageContent = {
262
+ type: 'user';
263
+ message: APIUserMessage;
264
+ parent_tool_use_id: string | null;
265
+ };
266
+ export type SDKUserMessage = SDKUserMessageContent & {
267
+ uuid?: UUID;
268
+ session_id: string;
269
+ };
270
+ export type SDKUserMessageReplay = SDKMessageBase & SDKUserMessageContent;
271
+ export type SDKAssistantMessage = SDKMessageBase & {
272
+ type: 'assistant';
273
+ message: APIAssistantMessage;
274
+ parent_tool_use_id: string | null;
275
+ };
276
+ export type SDKPermissionDenial = {
277
+ tool_name: string;
278
+ tool_use_id: string;
279
+ tool_input: Record<string, unknown>;
280
+ };
281
+ export type SDKResultMessage = (SDKMessageBase & {
282
+ type: 'result';
283
+ subtype: 'success';
284
+ duration_ms: number;
285
+ duration_api_ms: number;
286
+ is_error: boolean;
287
+ num_turns: number;
288
+ result: string;
289
+ total_cost_usd: number;
290
+ usage: NonNullableUsage;
291
+ modelUsage: {
292
+ [modelName: string]: ModelUsage;
293
+ };
294
+ permission_denials: SDKPermissionDenial[];
295
+ }) | (SDKMessageBase & {
296
+ type: 'result';
297
+ subtype: 'error_max_turns' | 'error_during_execution';
298
+ duration_ms: number;
299
+ duration_api_ms: number;
300
+ is_error: boolean;
301
+ num_turns: number;
302
+ total_cost_usd: number;
303
+ usage: NonNullableUsage;
304
+ modelUsage: {
305
+ [modelName: string]: ModelUsage;
306
+ };
307
+ permission_denials: SDKPermissionDenial[];
308
+ });
309
+ export type SDKSystemMessage = SDKMessageBase & {
310
+ type: 'system';
311
+ subtype: 'init';
312
+ apiKeySource: ApiKeySource;
313
+ cwd: string;
314
+ tools: string[];
315
+ mcp_servers: {
316
+ name: string;
317
+ status: string;
318
+ }[];
319
+ model: string;
320
+ permissionMode: PermissionMode;
321
+ slash_commands: string[];
322
+ output_style: string;
323
+ };
324
+ export type SDKPartialAssistantMessage = SDKMessageBase & {
325
+ type: 'stream_event';
326
+ event: RawMessageStreamEvent;
327
+ parent_tool_use_id: string | null;
328
+ };
329
+ export type SDKCompactBoundaryMessage = SDKMessageBase & {
330
+ type: 'system';
331
+ subtype: 'compact_boundary';
332
+ compact_metadata: {
333
+ trigger: 'manual' | 'auto';
334
+ pre_tokens: number;
335
+ };
336
+ };
337
+ export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage | SDKPartialAssistantMessage | SDKCompactBoundaryMessage;
338
+ export interface Query extends AsyncGenerator<SDKMessage, void> {
339
+ /**
340
+ * Control Requests
341
+ * The following methods are control requests, and are only supported when
342
+ * streaming input/output is used.
343
+ */
344
+ interrupt(): Promise<void>;
345
+ setPermissionMode(mode: PermissionMode): Promise<void>;
346
+ setModel(model?: string): Promise<void>;
347
+ supportedCommands(): Promise<SlashCommand[]>;
348
+ supportedModels(): Promise<ModelInfo[]>;
349
+ }
350
+ /**
351
+ * Query Claude Code
352
+ *
353
+ * Behavior:
354
+ * - Yields a message at a time
355
+ * - Uses the tools and commands you give it
356
+ *
357
+ * Usage:
358
+ * ```ts
359
+ * const response = query({ prompt: "Help me write a function", options: {} })
360
+ * for await (const message of response) {
361
+ * console.log(message)
362
+ * }
363
+ * ```
364
+ */
365
+ export declare function query({ prompt, options, }: {
366
+ prompt: string | AsyncIterable<SDKUserMessage>;
367
+ options?: Options;
368
+ }): Query;
369
+ type SdkMcpToolDefinition<Schema extends ZodRawShape = ZodRawShape> = {
370
+ name: string;
371
+ description: string;
372
+ inputSchema: Schema;
373
+ handler: (args: z.infer<ZodObject<Schema>>, extra: unknown) => Promise<CallToolResult>;
374
+ };
375
+ export declare function tool<Schema extends ZodRawShape>(name: string, description: string, inputSchema: Schema, handler: (args: z.infer<ZodObject<Schema>>, extra: unknown) => Promise<CallToolResult>): SdkMcpToolDefinition<Schema>;
376
+ type CreateSdkMcpServerOptions = {
377
+ name: string;
378
+ version?: string;
379
+ tools?: Array<SdkMcpToolDefinition<any>>;
380
+ };
381
+ /**
382
+ * Creates an MCP server instance that can be used with the SDK transport.
383
+ * This allows SDK users to define custom tools that run in the same process.
384
+ */
385
+ export declare function createSdkMcpServer(options: CreateSdkMcpServerOptions): McpSdkServerConfigWithInstance;
386
+ export declare class AbortError extends Error {
387
+ }
388
+ export {};