@azumag/opencode-rate-limit-fallback 1.0.17 → 1.0.19
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/index.js +6 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -316,25 +316,21 @@ export const RateLimitFallback = async ({ client, directory }) => {
|
|
|
316
316
|
parts: parts,
|
|
317
317
|
model: { providerID: nextModel.providerID, modelID: nextModel.modelID },
|
|
318
318
|
};
|
|
319
|
-
//
|
|
319
|
+
// abort → promptAsync: works in TUI, fails in headless (server disposes)
|
|
320
|
+
// promptAsync → abort: fails in TUI (abort kills the new prompt too)
|
|
320
321
|
//
|
|
321
|
-
//
|
|
322
|
-
//
|
|
323
|
-
//
|
|
322
|
+
// Use abort → promptAsync as the primary path (TUI confirmed working).
|
|
323
|
+
// Headless mode (opencode run) is a known limitation — the server
|
|
324
|
+
// dispose sequence interrupts the new prompt before it can complete.
|
|
324
325
|
//
|
|
325
326
|
// promptAsync: HTTP POST /session/{id}/prompt_async → 204 (SDK sdk.gen.js).
|
|
326
|
-
// prompt (sync): blocks until generation completes → abort flag race in TUI,
|
|
327
|
-
// server dispose in headless. Do NOT use.
|
|
328
327
|
const t0 = Date.now();
|
|
329
328
|
try {
|
|
330
329
|
await client.session.abort({ path: { id: sessionID } });
|
|
331
330
|
logToFile(`abort succeeded for session ${sessionID} (${Date.now() - t0}ms)`);
|
|
332
331
|
}
|
|
333
332
|
catch (abortErr) {
|
|
334
|
-
|
|
335
|
-
// We still send promptAsync as best-effort: when the retry loop eventually
|
|
336
|
-
// completes (timeout or success), the queued prompt should be processed.
|
|
337
|
-
logToFile(`abort failed (${Date.now() - t0}ms): ${abortErr} — sending promptAsync as best-effort`);
|
|
333
|
+
logToFile(`abort failed (${Date.now() - t0}ms): ${abortErr}`);
|
|
338
334
|
}
|
|
339
335
|
const t1 = Date.now();
|
|
340
336
|
await client.session.promptAsync({
|
package/package.json
CHANGED