agentgui 1.0.11 → 1.0.12
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/acp-launcher.js +1 -56
- package/package.json +1 -1
package/acp-launcher.js
CHANGED
|
@@ -219,62 +219,7 @@ export default class ACPConnection {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
async _sendPrintPrompt(prompt) {
|
|
222
|
-
|
|
223
|
-
let apiKey;
|
|
224
|
-
try { apiKey = fs.readFileSync(API_KEY_PATH, 'utf-8').trim(); }
|
|
225
|
-
catch (e) { throw new Error('No API key found at ' + API_KEY_PATH); }
|
|
226
|
-
|
|
227
|
-
const body = JSON.stringify({
|
|
228
|
-
model: 'claude-sonnet-4-20250514',
|
|
229
|
-
max_tokens: 4096,
|
|
230
|
-
system: RIPPLEUI_SYSTEM_PROMPT,
|
|
231
|
-
messages: [{ role: 'user', content: text }],
|
|
232
|
-
stream: true,
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
const res = await fetch(API_URL, {
|
|
236
|
-
method: 'POST',
|
|
237
|
-
headers: {
|
|
238
|
-
'Content-Type': 'application/json',
|
|
239
|
-
'x-api-key': apiKey,
|
|
240
|
-
'anthropic-version': '2023-06-01',
|
|
241
|
-
},
|
|
242
|
-
body,
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
if (!res.ok) {
|
|
246
|
-
const errText = await res.text();
|
|
247
|
-
throw new Error(`Anthropic API ${res.status}: ${errText.substring(0, 200)}`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
let fullText = '';
|
|
251
|
-
const reader = res.body.getReader();
|
|
252
|
-
const decoder = new TextDecoder();
|
|
253
|
-
let buf = '';
|
|
254
|
-
|
|
255
|
-
while (true) {
|
|
256
|
-
const { done, value } = await reader.read();
|
|
257
|
-
if (done) break;
|
|
258
|
-
buf += decoder.decode(value, { stream: true });
|
|
259
|
-
const lines = buf.split('\n');
|
|
260
|
-
buf = lines.pop() || '';
|
|
261
|
-
for (const line of lines) {
|
|
262
|
-
if (!line.startsWith('data: ')) continue;
|
|
263
|
-
const data = line.slice(6);
|
|
264
|
-
if (data === '[DONE]') continue;
|
|
265
|
-
try {
|
|
266
|
-
const evt = JSON.parse(data);
|
|
267
|
-
if (evt.type === 'content_block_delta' && evt.delta?.text) {
|
|
268
|
-
fullText += evt.delta.text;
|
|
269
|
-
if (this.onUpdate) {
|
|
270
|
-
this.onUpdate({ update: { sessionUpdate: 'agent_message_chunk', content: { text: evt.delta.text } } });
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
} catch (_) {}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
return { stopReason: 'end_turn', result: fullText };
|
|
222
|
+
throw new Error('Claude Code uses OAuth and requires the ACP bridge. The fallback to direct API calls is not supported because OAuth tokens cannot be used with the Anthropic API directly. Please ensure claude-code-acp is available in your PATH.');
|
|
278
223
|
}
|
|
279
224
|
|
|
280
225
|
isRunning() {
|