@exreve/exk 1.0.77 → 1.0.78
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/dist/cli/claudeBackend.js +28 -0
- package/dist/ttc-cli.tar.gz +0 -0
- package/package.json +1 -1
|
@@ -169,6 +169,34 @@ export class ClaudeBackend {
|
|
|
169
169
|
return CACHED_CLAUDE_PATH;
|
|
170
170
|
}
|
|
171
171
|
async *executePrompt(prompt, config) {
|
|
172
|
+
const { cwd, apiKey, model, env, settings, signal, attachmentDir, routingSessionId, routingPromptId, resumeSessionId } = config;
|
|
173
|
+
// Retry config for 529 overloaded errors
|
|
174
|
+
const MAX_RETRIES = 2;
|
|
175
|
+
const RETRY_DELAY_MS = 3000;
|
|
176
|
+
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
177
|
+
if (attempt > 0) {
|
|
178
|
+
console.log(`[ClaudeBackend] Retry ${attempt}/${MAX_RETRIES} after 529 delay...`);
|
|
179
|
+
await new Promise(r => setTimeout(r, RETRY_DELAY_MS * attempt));
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const stream = this._executePromptOnce(prompt, {
|
|
183
|
+
cwd, apiKey, model, env, settings, signal, attachmentDir, routingSessionId, routingPromptId, resumeSessionId,
|
|
184
|
+
});
|
|
185
|
+
for await (const event of stream) {
|
|
186
|
+
yield event;
|
|
187
|
+
}
|
|
188
|
+
return; // Success — exit retry loop
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
const is529 = err?.message?.includes('529') || err?.message?.includes('overloaded_error');
|
|
192
|
+
if (!is529 || attempt === MAX_RETRIES) {
|
|
193
|
+
throw err; // Not retryable or out of retries
|
|
194
|
+
}
|
|
195
|
+
console.log(`[ClaudeBackend] 529 overloaded detected, will retry: ${err.message}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async *_executePromptOnce(prompt, config) {
|
|
172
200
|
const { cwd, apiKey, model, env, settings, signal, attachmentDir, routingSessionId, routingPromptId, resumeSessionId } = config;
|
|
173
201
|
// Build MCP server for this query
|
|
174
202
|
const mcpServer = createModuleMcpServer({
|
package/dist/ttc-cli.tar.gz
CHANGED
|
Binary file
|