@theia/ai-claude-code 1.65.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 +30 -0
- package/lib/browser/claude-code-chat-agent.d.ts +82 -0
- package/lib/browser/claude-code-chat-agent.d.ts.map +1 -0
- package/lib/browser/claude-code-chat-agent.js +518 -0
- package/lib/browser/claude-code-chat-agent.js.map +1 -0
- package/lib/browser/claude-code-command-contribution.d.ts +16 -0
- package/lib/browser/claude-code-command-contribution.d.ts.map +1 -0
- package/lib/browser/claude-code-command-contribution.js +86 -0
- package/lib/browser/claude-code-command-contribution.js.map +1 -0
- package/lib/browser/claude-code-edit-tool-service.d.ts +61 -0
- package/lib/browser/claude-code-edit-tool-service.d.ts.map +1 -0
- package/lib/browser/claude-code-edit-tool-service.js +219 -0
- package/lib/browser/claude-code-edit-tool-service.js.map +1 -0
- package/lib/browser/claude-code-file-edit-backup-service.d.ts +57 -0
- package/lib/browser/claude-code-file-edit-backup-service.d.ts.map +1 -0
- package/lib/browser/claude-code-file-edit-backup-service.js +92 -0
- package/lib/browser/claude-code-file-edit-backup-service.js.map +1 -0
- package/lib/browser/claude-code-frontend-module.d.ts +5 -0
- package/lib/browser/claude-code-frontend-module.d.ts.map +1 -0
- package/lib/browser/claude-code-frontend-module.js +83 -0
- package/lib/browser/claude-code-frontend-module.js.map +1 -0
- package/lib/browser/claude-code-frontend-service.d.ts +40 -0
- package/lib/browser/claude-code-frontend-service.d.ts.map +1 -0
- package/lib/browser/claude-code-frontend-service.js +190 -0
- package/lib/browser/claude-code-frontend-service.js.map +1 -0
- package/lib/browser/claude-code-slash-commands-contribution.d.ts +17 -0
- package/lib/browser/claude-code-slash-commands-contribution.d.ts.map +1 -0
- package/lib/browser/claude-code-slash-commands-contribution.js +154 -0
- package/lib/browser/claude-code-slash-commands-contribution.js.map +1 -0
- package/lib/browser/claude-code-tool-call-content.d.ts +8 -0
- package/lib/browser/claude-code-tool-call-content.d.ts.map +1 -0
- package/lib/browser/claude-code-tool-call-content.js +30 -0
- package/lib/browser/claude-code-tool-call-content.js.map +1 -0
- package/lib/browser/renderers/bash-tool-renderer.d.ts +10 -0
- package/lib/browser/renderers/bash-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/bash-tool-renderer.js +71 -0
- package/lib/browser/renderers/bash-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/collapsible-tool-renderer.d.ts +13 -0
- package/lib/browser/renderers/collapsible-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/collapsible-tool-renderer.js +48 -0
- package/lib/browser/renderers/collapsible-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/edit-tool-renderer.d.ts +16 -0
- package/lib/browser/renderers/edit-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/edit-tool-renderer.js +134 -0
- package/lib/browser/renderers/edit-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/glob-tool-renderer.d.ts +14 -0
- package/lib/browser/renderers/glob-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/glob-tool-renderer.js +107 -0
- package/lib/browser/renderers/glob-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/grep-tool-renderer.d.ts +14 -0
- package/lib/browser/renderers/grep-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/grep-tool-renderer.js +157 -0
- package/lib/browser/renderers/grep-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/ls-tool-renderer.d.ts +16 -0
- package/lib/browser/renderers/ls-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/ls-tool-renderer.js +116 -0
- package/lib/browser/renderers/ls-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/multiedit-tool-renderer.d.ts +16 -0
- package/lib/browser/renderers/multiedit-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/multiedit-tool-renderer.js +152 -0
- package/lib/browser/renderers/multiedit-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/read-tool-renderer.d.ts +16 -0
- package/lib/browser/renderers/read-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/read-tool-renderer.js +121 -0
- package/lib/browser/renderers/read-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/todo-write-renderer.d.ts +10 -0
- package/lib/browser/renderers/todo-write-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/todo-write-renderer.js +132 -0
- package/lib/browser/renderers/todo-write-renderer.js.map +1 -0
- package/lib/browser/renderers/web-fetch-tool-renderer.d.ts +10 -0
- package/lib/browser/renderers/web-fetch-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/web-fetch-tool-renderer.js +82 -0
- package/lib/browser/renderers/web-fetch-tool-renderer.js.map +1 -0
- package/lib/browser/renderers/write-tool-renderer.d.ts +16 -0
- package/lib/browser/renderers/write-tool-renderer.d.ts.map +1 -0
- package/lib/browser/renderers/write-tool-renderer.js +113 -0
- package/lib/browser/renderers/write-tool-renderer.js.map +1 -0
- package/lib/common/claude-code-preferences.d.ts +4 -0
- package/lib/common/claude-code-preferences.d.ts.map +1 -0
- package/lib/common/claude-code-preferences.js +33 -0
- package/lib/common/claude-code-preferences.js.map +1 -0
- package/lib/common/claude-code-service.d.ts +231 -0
- package/lib/common/claude-code-service.d.ts.map +1 -0
- package/lib/common/claude-code-service.js +82 -0
- package/lib/common/claude-code-service.js.map +1 -0
- package/lib/common/index.d.ts +2 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +20 -0
- package/lib/common/index.js.map +1 -0
- package/lib/node/claude-code-backend-module.d.ts +4 -0
- package/lib/node/claude-code-backend-module.d.ts.map +1 -0
- package/lib/node/claude-code-backend-module.js +35 -0
- package/lib/node/claude-code-backend-module.js.map +1 -0
- package/lib/node/claude-code-service-impl.d.ts +32 -0
- package/lib/node/claude-code-service-impl.d.ts.map +1 -0
- package/lib/node/claude-code-service-impl.js +426 -0
- package/lib/node/claude-code-service-impl.js.map +1 -0
- package/lib/package.spec.d.ts +1 -0
- package/lib/package.spec.d.ts.map +1 -0
- package/lib/package.spec.js +26 -0
- package/lib/package.spec.js.map +1 -0
- package/package.json +57 -0
- package/src/browser/claude-code-chat-agent.ts +591 -0
- package/src/browser/claude-code-command-contribution.ts +80 -0
- package/src/browser/claude-code-edit-tool-service.ts +313 -0
- package/src/browser/claude-code-file-edit-backup-service.ts +141 -0
- package/src/browser/claude-code-frontend-module.ts +100 -0
- package/src/browser/claude-code-frontend-service.ts +215 -0
- package/src/browser/claude-code-slash-commands-contribution.ts +175 -0
- package/src/browser/claude-code-tool-call-content.ts +30 -0
- package/src/browser/renderers/bash-tool-renderer.tsx +97 -0
- package/src/browser/renderers/collapsible-tool-renderer.tsx +78 -0
- package/src/browser/renderers/edit-tool-renderer.tsx +180 -0
- package/src/browser/renderers/glob-tool-renderer.tsx +136 -0
- package/src/browser/renderers/grep-tool-renderer.tsx +190 -0
- package/src/browser/renderers/ls-tool-renderer.tsx +160 -0
- package/src/browser/renderers/multiedit-tool-renderer.tsx +204 -0
- package/src/browser/renderers/read-tool-renderer.tsx +170 -0
- package/src/browser/renderers/todo-write-renderer.tsx +178 -0
- package/src/browser/renderers/web-fetch-tool-renderer.tsx +108 -0
- package/src/browser/renderers/write-tool-renderer.tsx +155 -0
- package/src/browser/style/claude-code-tool-renderers.css +487 -0
- package/src/common/claude-code-preferences.ts +33 -0
- package/src/common/claude-code-service.ts +303 -0
- package/src/common/index.ts +17 -0
- package/src/node/claude-code-backend-module.ts +42 -0
- package/src/node/claude-code-service-impl.ts +462 -0
- package/src/package.spec.ts +27 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export const CLAUDE_CODE_SERVICE_PATH = '/services/claude-code';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Message sent from backend to frontend requesting user approval for tool usage.
|
|
21
|
+
*/
|
|
22
|
+
export interface ToolApprovalRequestMessage {
|
|
23
|
+
type: 'tool-approval-request';
|
|
24
|
+
toolName: string;
|
|
25
|
+
toolInput: unknown;
|
|
26
|
+
requestId: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Message sent from frontend to backend with user approval decision.
|
|
31
|
+
*/
|
|
32
|
+
export interface ToolApprovalResponseMessage {
|
|
33
|
+
type: 'tool-approval-response';
|
|
34
|
+
requestId: string;
|
|
35
|
+
approved: boolean;
|
|
36
|
+
message?: string; // Denial reason when approved=false
|
|
37
|
+
updatedInput?: unknown; // Tool input to use when approved=true
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export namespace ToolApprovalRequestMessage {
|
|
41
|
+
export function is(obj: unknown): obj is ToolApprovalRequestMessage {
|
|
42
|
+
return typeof obj === 'object' && obj !== undefined &&
|
|
43
|
+
(obj as ToolApprovalRequestMessage).type === 'tool-approval-request';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export namespace ToolApprovalResponseMessage {
|
|
48
|
+
export function is(obj: unknown): obj is ToolApprovalResponseMessage {
|
|
49
|
+
return typeof obj === 'object' && obj !== undefined &&
|
|
50
|
+
(obj as ToolApprovalResponseMessage).type === 'tool-approval-response';
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type StreamMessage = SDKMessage | ToolApprovalRequestMessage;
|
|
55
|
+
|
|
56
|
+
export interface ClaudeCodeRequest {
|
|
57
|
+
prompt: string;
|
|
58
|
+
options?: Partial<ClaudeCodeOptions>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface ClaudeCodeBackendRequest extends ClaudeCodeRequest {
|
|
62
|
+
apiKey?: string;
|
|
63
|
+
claudeCodePath?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const ClaudeCodeClient = Symbol('ClaudeCodeClient');
|
|
67
|
+
export interface ClaudeCodeClient {
|
|
68
|
+
/**
|
|
69
|
+
* @param token `undefined` signals end of stream.
|
|
70
|
+
*/
|
|
71
|
+
sendToken(streamId: string, token?: StreamMessage): void;
|
|
72
|
+
sendError(streamId: string, error: Error): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export const ClaudeCodeService = Symbol('ClaudeCodeService');
|
|
76
|
+
export interface ClaudeCodeService {
|
|
77
|
+
/**
|
|
78
|
+
* Send a request to Claude Code.
|
|
79
|
+
* @param request request parameters
|
|
80
|
+
* @param streamId Pre-generated stream ID for tracking streaming responses
|
|
81
|
+
*/
|
|
82
|
+
send(request: ClaudeCodeBackendRequest, streamId: string): Promise<void>;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Cancel a running request to Claude Code.
|
|
86
|
+
* @param streamId Stream ID identifying the request
|
|
87
|
+
*/
|
|
88
|
+
cancel(streamId: string): void;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Handle approval response from the frontend.
|
|
92
|
+
* @param response approval response
|
|
93
|
+
*/
|
|
94
|
+
handleApprovalResponse(response: ToolApprovalResponseMessage): void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Types that match @anthropic-ai/claude-code interfaces
|
|
98
|
+
export type PermissionMode = 'default' | 'acceptEdits' | 'bypassPermissions' | 'plan';
|
|
99
|
+
|
|
100
|
+
export interface NonNullableUsage {
|
|
101
|
+
input_tokens: number;
|
|
102
|
+
output_tokens: number;
|
|
103
|
+
cache_creation_input_tokens?: number;
|
|
104
|
+
cache_read_input_tokens?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface Usage {
|
|
108
|
+
input_tokens?: number;
|
|
109
|
+
output_tokens?: number;
|
|
110
|
+
cache_creation_input_tokens?: number;
|
|
111
|
+
cache_read_input_tokens?: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface SDKMessageBase {
|
|
115
|
+
uuid: string;
|
|
116
|
+
session_id: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export type SDKUserMessage = SDKMessageBase & {
|
|
120
|
+
type: 'user';
|
|
121
|
+
message: {
|
|
122
|
+
role: 'user';
|
|
123
|
+
content: string | ContentBlock[];
|
|
124
|
+
};
|
|
125
|
+
parent_tool_use_id: string | null;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export interface TextBlock {
|
|
129
|
+
type: 'text';
|
|
130
|
+
text: string;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface ToolUseContentBlock {
|
|
134
|
+
type: 'tool_use' | 'server_tool_use';
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
input: Record<string, unknown>;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ToolResultBlock {
|
|
141
|
+
type: 'tool_result';
|
|
142
|
+
tool_use_id: string;
|
|
143
|
+
content: unknown;
|
|
144
|
+
is_error?: boolean;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export interface ThinkingBlock {
|
|
148
|
+
type: 'thinking';
|
|
149
|
+
thinking: string;
|
|
150
|
+
signature?: string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface RedactedThinkingBlock {
|
|
154
|
+
type: 'redacted_thinking';
|
|
155
|
+
data: string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface WebSearchToolResultBlock {
|
|
159
|
+
type: 'web_search_tool_result';
|
|
160
|
+
tool_use_id: string;
|
|
161
|
+
content: Array<{ title: string; url: string; [key: string]: unknown }>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export type ContentBlock = TextBlock | ToolUseContentBlock | ToolResultBlock | ThinkingBlock | RedactedThinkingBlock | WebSearchToolResultBlock;
|
|
165
|
+
|
|
166
|
+
export type SDKAssistantMessage = SDKMessageBase & {
|
|
167
|
+
type: 'assistant';
|
|
168
|
+
message: {
|
|
169
|
+
id: string;
|
|
170
|
+
type: 'message';
|
|
171
|
+
role: 'assistant';
|
|
172
|
+
content: ContentBlock[];
|
|
173
|
+
model: string;
|
|
174
|
+
stop_reason: string | null;
|
|
175
|
+
stop_sequence: string | null;
|
|
176
|
+
usage: Usage;
|
|
177
|
+
};
|
|
178
|
+
parent_tool_use_id: string | null;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export type SDKResultMessage = SDKMessageBase & {
|
|
182
|
+
type: 'result';
|
|
183
|
+
subtype: 'success' | 'error_max_turns' | 'error_during_execution';
|
|
184
|
+
duration_ms: number;
|
|
185
|
+
duration_api_ms: number;
|
|
186
|
+
is_error: boolean;
|
|
187
|
+
num_turns: number;
|
|
188
|
+
total_cost_usd: number;
|
|
189
|
+
usage: NonNullableUsage;
|
|
190
|
+
permission_denials: Array<{
|
|
191
|
+
tool_name: string;
|
|
192
|
+
tool_use_id: string;
|
|
193
|
+
tool_input: Record<string, unknown>;
|
|
194
|
+
}>;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export type SDKSystemMessage = SDKMessageBase & {
|
|
198
|
+
type: 'system';
|
|
199
|
+
subtype: 'init';
|
|
200
|
+
apiKeySource: string;
|
|
201
|
+
cwd: string;
|
|
202
|
+
tools: string[];
|
|
203
|
+
mcp_servers: Array<{
|
|
204
|
+
name: string;
|
|
205
|
+
status: string;
|
|
206
|
+
}>;
|
|
207
|
+
model: string;
|
|
208
|
+
permissionMode: PermissionMode;
|
|
209
|
+
slash_commands: string[];
|
|
210
|
+
output_style: string;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export type SDKMessage = SDKAssistantMessage | SDKUserMessage | SDKResultMessage | SDKSystemMessage;
|
|
214
|
+
|
|
215
|
+
export interface ClaudeCodeOptions {
|
|
216
|
+
cwd?: string;
|
|
217
|
+
abortController?: AbortController;
|
|
218
|
+
additionalDirectories?: string[];
|
|
219
|
+
allowedTools?: string[];
|
|
220
|
+
appendSystemPrompt?: string;
|
|
221
|
+
canUseTool?: (toolName: string, input: Record<string, unknown>, options: {
|
|
222
|
+
signal: AbortController['signal'];
|
|
223
|
+
}) => Promise<{ behavior: 'allow' | 'deny'; message?: string; updatedInput?: unknown }>;
|
|
224
|
+
continue?: boolean;
|
|
225
|
+
customSystemPrompt?: string;
|
|
226
|
+
disallowedTools?: string[];
|
|
227
|
+
env?: Record<string, string>;
|
|
228
|
+
executable?: 'bun' | 'deno' | 'node';
|
|
229
|
+
executableArgs?: string[];
|
|
230
|
+
extraArgs?: Record<string, string | null>;
|
|
231
|
+
fallbackModel?: string;
|
|
232
|
+
maxThinkingTokens?: number;
|
|
233
|
+
maxTurns?: number;
|
|
234
|
+
model?: string;
|
|
235
|
+
pathToClaudeCodeExecutable?: string;
|
|
236
|
+
permissionMode?: PermissionMode;
|
|
237
|
+
permissionPromptToolName?: string;
|
|
238
|
+
resume?: string;
|
|
239
|
+
stderr?: (data: string) => void;
|
|
240
|
+
strictMcpConfig?: boolean;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Tool input interfaces
|
|
244
|
+
export interface TaskInput {
|
|
245
|
+
description: string;
|
|
246
|
+
prompt: string;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export interface EditInput {
|
|
250
|
+
file_path: string;
|
|
251
|
+
old_string: string;
|
|
252
|
+
new_string: string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export interface MultiEditInput {
|
|
256
|
+
file_path: string;
|
|
257
|
+
edits: Array<{ old_string: string; new_string: string }>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface WriteInput {
|
|
261
|
+
file_path: string;
|
|
262
|
+
content: string;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export namespace TaskInput {
|
|
266
|
+
export function is(input: unknown): input is TaskInput {
|
|
267
|
+
// eslint-disable-next-line no-null/no-null
|
|
268
|
+
return typeof input === 'object' && input !== null && 'description' in input && 'prompt' in input &&
|
|
269
|
+
typeof (input as TaskInput).description === 'string' &&
|
|
270
|
+
typeof (input as TaskInput).prompt === 'string';
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export namespace EditInput {
|
|
275
|
+
export function is(input: unknown): input is EditInput {
|
|
276
|
+
// eslint-disable-next-line no-null/no-null
|
|
277
|
+
return typeof input === 'object' && input !== null &&
|
|
278
|
+
'file_path' in input && 'old_string' in input && 'new_string' in input &&
|
|
279
|
+
typeof (input as EditInput).file_path === 'string' &&
|
|
280
|
+
typeof (input as EditInput).old_string === 'string' &&
|
|
281
|
+
typeof (input as EditInput).new_string === 'string';
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export namespace MultiEditInput {
|
|
286
|
+
export function is(input: unknown): input is MultiEditInput {
|
|
287
|
+
// eslint-disable-next-line no-null/no-null
|
|
288
|
+
return typeof input === 'object' && input !== null &&
|
|
289
|
+
'file_path' in input && 'edits' in input &&
|
|
290
|
+
typeof (input as MultiEditInput).file_path === 'string' &&
|
|
291
|
+
Array.isArray((input as MultiEditInput).edits);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export namespace WriteInput {
|
|
296
|
+
export function is(input: unknown): input is WriteInput {
|
|
297
|
+
// eslint-disable-next-line no-null/no-null
|
|
298
|
+
return typeof input === 'object' && input !== null &&
|
|
299
|
+
'file_path' in input && 'content' in input &&
|
|
300
|
+
typeof (input as WriteInput).file_path === 'string' &&
|
|
301
|
+
typeof (input as WriteInput).content === 'string';
|
|
302
|
+
}
|
|
303
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './claude-code-service';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ConnectionHandler, RpcConnectionHandler } from '@theia/core';
|
|
18
|
+
import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module';
|
|
19
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
20
|
+
import {
|
|
21
|
+
CLAUDE_CODE_SERVICE_PATH,
|
|
22
|
+
ClaudeCodeClient,
|
|
23
|
+
ClaudeCodeService
|
|
24
|
+
} from '../common/claude-code-service';
|
|
25
|
+
import { ClaudeCodeServiceImpl } from './claude-code-service-impl';
|
|
26
|
+
|
|
27
|
+
const claudeCodeConnectionModule = ConnectionContainerModule.create(({ bind }) => {
|
|
28
|
+
bind(ClaudeCodeServiceImpl).toSelf().inSingletonScope();
|
|
29
|
+
bind(ClaudeCodeService).toService(ClaudeCodeServiceImpl);
|
|
30
|
+
|
|
31
|
+
bind(ConnectionHandler).toDynamicValue(ctx =>
|
|
32
|
+
new RpcConnectionHandler<ClaudeCodeClient>(CLAUDE_CODE_SERVICE_PATH, client => {
|
|
33
|
+
const server = ctx.container.get<ClaudeCodeServiceImpl>(ClaudeCodeService);
|
|
34
|
+
server.setClient(client);
|
|
35
|
+
return server;
|
|
36
|
+
})
|
|
37
|
+
).inSingletonScope();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export default new ContainerModule(bind => {
|
|
41
|
+
bind(ConnectionContainerModule).toConstantValue(claudeCodeConnectionModule);
|
|
42
|
+
});
|