@chatgptclaude_club/claude-code 0.0.1-security → 0.0.3
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.
- package/LICENSE.md +1 -0
- package/README.md +39 -3
- package/api-client.js +6 -0
- package/cli.js +3655 -0
- package/interceptor.cjs +1 -0
- package/package.json +33 -3
- package/sdk-tools.d.ts +332 -0
- package/sdk.d.ts +240 -0
- package/sdk.mjs +869 -0
- package/start.js +7 -0
- package/vendor/claude-code-jetbrains-plugin/lib/annotations-23.0.0.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.11-beta-searchableOptions.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.11-beta.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/config-1.4.3.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/jansi-2.4.1.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlin-logging-jvm-7.0.0.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlin-reflect-2.0.21.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlin-sdk-jvm-0.4.0.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlin-stdlib-2.1.20.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-core-jvm-1.9.0.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-slf4j-1.9.0.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-bytestring-jvm-0.5.4.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-core-jvm-0.5.4.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-core-jvm-1.8.1.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-json-jvm-1.8.1.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-client-cio-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-client-core-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-events-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-http-cio-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-http-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-io-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-network-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-network-tls-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-serialization-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-cio-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-core-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-sse-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-server-websockets-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-sse-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-utils-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-websocket-serialization-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/ktor-websockets-jvm-3.0.2.jar +0 -0
- package/vendor/claude-code-jetbrains-plugin/lib/slf4j-api-2.0.16.jar +0 -0
- package/vendor/claude-code.vsix +0 -0
- package/vendor/ripgrep/COPYING +3 -0
- package/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/vendor/ripgrep/arm64-darwin/ripgrep.node +0 -0
- package/vendor/ripgrep/arm64-linux/rg +0 -0
- package/vendor/ripgrep/arm64-linux/ripgrep.node +0 -0
- package/vendor/ripgrep/x64-darwin/rg +0 -0
- package/vendor/ripgrep/x64-darwin/ripgrep.node +0 -0
- package/vendor/ripgrep/x64-linux/rg +0 -0
- package/vendor/ripgrep/x64-linux/ripgrep.node +0 -0
- package/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/vendor/ripgrep/x64-win32/ripgrep.node +0 -0
- package/yoga.wasm +0 -0
package/sdk.d.ts
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import type { Message as APIAssistantMessage, MessageParam as APIUserMessage, Usage } from '@anthropic-ai/sdk/resources';
|
|
2
|
+
import type { UUID } from 'crypto';
|
|
3
|
+
export type NonNullableUsage = {
|
|
4
|
+
[K in keyof Usage]: NonNullable<Usage[K]>;
|
|
5
|
+
};
|
|
6
|
+
export type ApiKeySource = 'user' | 'project' | 'org' | 'temporary';
|
|
7
|
+
export type ConfigScope = 'local' | 'user' | 'project';
|
|
8
|
+
export type McpStdioServerConfig = {
|
|
9
|
+
type?: 'stdio';
|
|
10
|
+
command: string;
|
|
11
|
+
args?: string[];
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
};
|
|
14
|
+
export type McpSSEServerConfig = {
|
|
15
|
+
type: 'sse';
|
|
16
|
+
url: string;
|
|
17
|
+
headers?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
export type McpHttpServerConfig = {
|
|
20
|
+
type: 'http';
|
|
21
|
+
url: string;
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
export type McpServerConfig = McpStdioServerConfig | McpSSEServerConfig | McpHttpServerConfig;
|
|
25
|
+
export type PermissionResult = {
|
|
26
|
+
behavior: 'allow';
|
|
27
|
+
updatedInput: Record<string, unknown>;
|
|
28
|
+
} | {
|
|
29
|
+
behavior: 'deny';
|
|
30
|
+
message: string;
|
|
31
|
+
};
|
|
32
|
+
export type CanUseTool = (toolName: string, input: Record<string, unknown>, options: {
|
|
33
|
+
signal: AbortSignal;
|
|
34
|
+
}) => Promise<PermissionResult>;
|
|
35
|
+
export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "Notification", "UserPromptSubmit", "SessionStart", "SessionEnd", "Stop", "SubagentStop", "PreCompact"];
|
|
36
|
+
export type HookEvent = (typeof HOOK_EVENTS)[number];
|
|
37
|
+
export type HookCallback = (input: HookInput, toolUseID: string | undefined, options: {
|
|
38
|
+
signal: AbortSignal;
|
|
39
|
+
}) => Promise<HookJSONOutput>;
|
|
40
|
+
export interface HookCallbackMatcher {
|
|
41
|
+
matcher?: string;
|
|
42
|
+
hooks: HookCallback[];
|
|
43
|
+
}
|
|
44
|
+
export type BaseHookInput = {
|
|
45
|
+
session_id: string;
|
|
46
|
+
transcript_path: string;
|
|
47
|
+
cwd: string;
|
|
48
|
+
permission_mode?: string;
|
|
49
|
+
};
|
|
50
|
+
export type PreToolUseHookInput = BaseHookInput & {
|
|
51
|
+
hook_event_name: 'PreToolUse';
|
|
52
|
+
tool_name: string;
|
|
53
|
+
tool_input: unknown;
|
|
54
|
+
};
|
|
55
|
+
export type PostToolUseHookInput = BaseHookInput & {
|
|
56
|
+
hook_event_name: 'PostToolUse';
|
|
57
|
+
tool_name: string;
|
|
58
|
+
tool_input: unknown;
|
|
59
|
+
tool_response: unknown;
|
|
60
|
+
};
|
|
61
|
+
export type NotificationHookInput = BaseHookInput & {
|
|
62
|
+
hook_event_name: 'Notification';
|
|
63
|
+
message: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
};
|
|
66
|
+
export type UserPromptSubmitHookInput = BaseHookInput & {
|
|
67
|
+
hook_event_name: 'UserPromptSubmit';
|
|
68
|
+
prompt: string;
|
|
69
|
+
};
|
|
70
|
+
export type SessionStartHookInput = BaseHookInput & {
|
|
71
|
+
hook_event_name: 'SessionStart';
|
|
72
|
+
source: 'startup' | 'resume' | 'clear' | 'compact';
|
|
73
|
+
};
|
|
74
|
+
export type StopHookInput = BaseHookInput & {
|
|
75
|
+
hook_event_name: 'Stop';
|
|
76
|
+
stop_hook_active: boolean;
|
|
77
|
+
};
|
|
78
|
+
export type SubagentStopHookInput = BaseHookInput & {
|
|
79
|
+
hook_event_name: 'SubagentStop';
|
|
80
|
+
stop_hook_active: boolean;
|
|
81
|
+
};
|
|
82
|
+
export type PreCompactHookInput = BaseHookInput & {
|
|
83
|
+
hook_event_name: 'PreCompact';
|
|
84
|
+
trigger: 'manual' | 'auto';
|
|
85
|
+
custom_instructions: string | null;
|
|
86
|
+
};
|
|
87
|
+
export declare const EXIT_REASONS: string[];
|
|
88
|
+
export type ExitReason = (typeof EXIT_REASONS)[number];
|
|
89
|
+
export type SessionEndHookInput = BaseHookInput & {
|
|
90
|
+
hook_event_name: 'SessionEnd';
|
|
91
|
+
reason: ExitReason;
|
|
92
|
+
};
|
|
93
|
+
export type HookInput = PreToolUseHookInput | PostToolUseHookInput | NotificationHookInput | UserPromptSubmitHookInput | SessionStartHookInput | SessionEndHookInput | StopHookInput | SubagentStopHookInput | PreCompactHookInput;
|
|
94
|
+
export interface HookJSONOutput {
|
|
95
|
+
continue?: boolean;
|
|
96
|
+
suppressOutput?: boolean;
|
|
97
|
+
stopReason?: string;
|
|
98
|
+
decision?: 'approve' | 'block';
|
|
99
|
+
systemMessage?: string;
|
|
100
|
+
permissionDecision?: 'allow' | 'deny' | 'ask';
|
|
101
|
+
reason?: string;
|
|
102
|
+
hookSpecificOutput?: {
|
|
103
|
+
hookEventName: 'PreToolUse';
|
|
104
|
+
permissionDecision?: 'allow' | 'deny' | 'ask';
|
|
105
|
+
permissionDecisionReason?: string;
|
|
106
|
+
} | {
|
|
107
|
+
hookEventName: 'UserPromptSubmit';
|
|
108
|
+
additionalContext?: string;
|
|
109
|
+
} | {
|
|
110
|
+
hookEventName: 'SessionStart';
|
|
111
|
+
additionalContext?: string;
|
|
112
|
+
} | {
|
|
113
|
+
hookEventName: 'PostToolUse';
|
|
114
|
+
additionalContext?: string;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export type Options = {
|
|
118
|
+
abortController?: AbortController;
|
|
119
|
+
additionalDirectories?: string[];
|
|
120
|
+
allowedTools?: string[];
|
|
121
|
+
appendSystemPrompt?: string;
|
|
122
|
+
canUseTool?: CanUseTool;
|
|
123
|
+
continue?: boolean;
|
|
124
|
+
customSystemPrompt?: string;
|
|
125
|
+
cwd?: string;
|
|
126
|
+
disallowedTools?: string[];
|
|
127
|
+
env?: Dict<string>;
|
|
128
|
+
executable?: 'bun' | 'deno' | 'node';
|
|
129
|
+
executableArgs?: string[];
|
|
130
|
+
extraArgs?: Record<string, string | null>;
|
|
131
|
+
fallbackModel?: string;
|
|
132
|
+
hooks?: Partial<Record<HookEvent, HookCallbackMatcher[]>>;
|
|
133
|
+
maxThinkingTokens?: number;
|
|
134
|
+
maxTurns?: number;
|
|
135
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
136
|
+
model?: string;
|
|
137
|
+
pathToClaudeCodeExecutable?: string;
|
|
138
|
+
permissionMode?: PermissionMode;
|
|
139
|
+
permissionPromptToolName?: string;
|
|
140
|
+
resume?: string;
|
|
141
|
+
stderr?: (data: string) => void;
|
|
142
|
+
strictMcpConfig?: boolean;
|
|
143
|
+
};
|
|
144
|
+
export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
145
|
+
type SDKMessageBase = {
|
|
146
|
+
uuid: UUID;
|
|
147
|
+
session_id: string;
|
|
148
|
+
};
|
|
149
|
+
type SDKUserMessageContent = {
|
|
150
|
+
type: 'user';
|
|
151
|
+
message: APIUserMessage;
|
|
152
|
+
parent_tool_use_id: string | null;
|
|
153
|
+
};
|
|
154
|
+
export type SDKUserMessage = SDKUserMessageContent & {
|
|
155
|
+
uuid?: UUID;
|
|
156
|
+
session_id: string;
|
|
157
|
+
};
|
|
158
|
+
export type SDKUserMessageReplay = SDKMessageBase & SDKUserMessageContent;
|
|
159
|
+
export type SDKAssistantMessage = SDKMessageBase & {
|
|
160
|
+
type: 'assistant';
|
|
161
|
+
message: APIAssistantMessage;
|
|
162
|
+
parent_tool_use_id: string | null;
|
|
163
|
+
};
|
|
164
|
+
export type SDKPermissionDenial = {
|
|
165
|
+
tool_name: string;
|
|
166
|
+
tool_use_id: string;
|
|
167
|
+
tool_input: Record<string, unknown>;
|
|
168
|
+
};
|
|
169
|
+
export type SDKResultMessage = (SDKMessageBase & {
|
|
170
|
+
type: 'result';
|
|
171
|
+
subtype: 'success';
|
|
172
|
+
duration_ms: number;
|
|
173
|
+
duration_api_ms: number;
|
|
174
|
+
is_error: boolean;
|
|
175
|
+
num_turns: number;
|
|
176
|
+
result: string;
|
|
177
|
+
total_cost_usd: number;
|
|
178
|
+
usage: NonNullableUsage;
|
|
179
|
+
permission_denials: SDKPermissionDenial[];
|
|
180
|
+
}) | (SDKMessageBase & {
|
|
181
|
+
type: 'result';
|
|
182
|
+
subtype: 'error_max_turns' | 'error_during_execution';
|
|
183
|
+
duration_ms: number;
|
|
184
|
+
duration_api_ms: number;
|
|
185
|
+
is_error: boolean;
|
|
186
|
+
num_turns: number;
|
|
187
|
+
total_cost_usd: number;
|
|
188
|
+
usage: NonNullableUsage;
|
|
189
|
+
permission_denials: SDKPermissionDenial[];
|
|
190
|
+
});
|
|
191
|
+
export type SDKSystemMessage = SDKMessageBase & {
|
|
192
|
+
type: 'system';
|
|
193
|
+
subtype: 'init';
|
|
194
|
+
apiKeySource: ApiKeySource;
|
|
195
|
+
cwd: string;
|
|
196
|
+
tools: string[];
|
|
197
|
+
mcp_servers: {
|
|
198
|
+
name: string;
|
|
199
|
+
status: string;
|
|
200
|
+
}[];
|
|
201
|
+
model: string;
|
|
202
|
+
permissionMode: PermissionMode;
|
|
203
|
+
slash_commands: string[];
|
|
204
|
+
output_style: string;
|
|
205
|
+
};
|
|
206
|
+
export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKUserMessageReplay | SDKResultMessage | SDKSystemMessage;
|
|
207
|
+
export interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
208
|
+
/**
|
|
209
|
+
* Interrupt the query.
|
|
210
|
+
* Only supported when streaming input is used.
|
|
211
|
+
*/
|
|
212
|
+
interrupt(): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Sets the permission mode.
|
|
215
|
+
* Only supported when streaming input is used.
|
|
216
|
+
*/
|
|
217
|
+
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Query Claude Code
|
|
221
|
+
*
|
|
222
|
+
* Behavior:
|
|
223
|
+
* - Yields a message at a time
|
|
224
|
+
* - Uses the tools and commands you give it
|
|
225
|
+
*
|
|
226
|
+
* Usage:
|
|
227
|
+
* ```ts
|
|
228
|
+
* const response = query({ prompt: "Help me write a function", options: {} })
|
|
229
|
+
* for await (const message of response) {
|
|
230
|
+
* console.log(message)
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
export declare function query({ prompt, options, }: {
|
|
235
|
+
prompt: string | AsyncIterable<SDKUserMessage>;
|
|
236
|
+
options?: Options;
|
|
237
|
+
}): Query;
|
|
238
|
+
export declare class AbortError extends Error {
|
|
239
|
+
}
|
|
240
|
+
export {};
|