opencode-auto-resume 1.2.2 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.js +12 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12849,6 +12849,7 @@ var AutoResumePlugin = async (ctx, options) => {
12849
12849
  pendingRecoveryReason: null,
12850
12850
  pendingRecoveryAt: 0,
12851
12851
  recoveryAttempts: 0,
12852
+ recoveryContinueInFlight: false,
12852
12853
  watchdogRetryGuard: false,
12853
12854
  unknownToolErrors: new Map,
12854
12855
  unknownToolSuggestionSent: false,
@@ -13092,6 +13093,7 @@ var AutoResumePlugin = async (ctx, options) => {
13092
13093
  const retryBackoffMs = backoffMs(w.recoveryAttempts, baseBackoffMs, maxBackoffMs);
13093
13094
  await log("info", `Retrying recovery on ${short(sid)}: attempt=${w.recoveryAttempts}, backoffMs=${retryBackoffMs}`);
13094
13095
  dbg(`Retrying recovery on ${short(sid)}: recoveryAttempts=${w.recoveryAttempts}, backoffMs=${retryBackoffMs}, pendingRecoveryReason=${w.pendingRecoveryReason}`);
13096
+ w.recoveryContinueInFlight = true;
13095
13097
  try {
13096
13098
  await sendContinuePrompt(sid, continuePrompt, w);
13097
13099
  } catch (err) {
@@ -13559,14 +13561,13 @@ var AutoResumePlugin = async (ctx, options) => {
13559
13561
  w.pendingRecoveryReason = null;
13560
13562
  w.pendingRecoveryAt = 0;
13561
13563
  w.recoveryAttempts = 0;
13564
+ w.recoveryContinueInFlight = false;
13562
13565
  w.watchdogRetryGuard = false;
13563
13566
  }
13564
13567
  function resetBusyFlags(w) {
13565
- w.resumeAttempts = 0;
13566
13568
  w.lastRetryAt = 0;
13567
13569
  w.pendingTools = 0;
13568
13570
  w.pendingCommands = 0;
13569
- w.gaveUp = false;
13570
13571
  w.orphanWatchStartAt = null;
13571
13572
  w.aborting = false;
13572
13573
  w.toolTextRecovered = false;
@@ -13581,7 +13582,7 @@ var AutoResumePlugin = async (ctx, options) => {
13581
13582
  w.pendingRecovery = false;
13582
13583
  w.pendingRecoveryReason = null;
13583
13584
  w.pendingRecoveryAt = 0;
13584
- w.recoveryAttempts = 0;
13585
+ w.recoveryContinueInFlight = false;
13585
13586
  w.watchdogRetryGuard = false;
13586
13587
  if (w.toolTextTimer) {
13587
13588
  clearTimeout(w.toolTextTimer);
@@ -13974,6 +13975,7 @@ var AutoResumePlugin = async (ctx, options) => {
13974
13975
  return false;
13975
13976
  if (w.oocLocked)
13976
13977
  return false;
13978
+ w.aborting = true;
13977
13979
  const idleSec = Math.round((Date.now() - (w.orphanWatchStartAt ?? w.lastActivityAt)) / 1000);
13978
13980
  await log("info", `Abort+Resume on ${short(sid)} (${idleSec}s idle). Aborting...`);
13979
13981
  w.pluginAbortInFlight = true;
@@ -13999,6 +14001,7 @@ var AutoResumePlugin = async (ctx, options) => {
13999
14001
  return false;
14000
14002
  }
14001
14003
  try {
14004
+ w.recoveryContinueInFlight = false;
14002
14005
  await sendContinuePrompt(sid, continuePrompt, w);
14003
14006
  await log("info", `${short(sid)} - abort+continue done`);
14004
14007
  w.orphanWatchStartAt = null;
@@ -14234,6 +14237,7 @@ var AutoResumePlugin = async (ctx, options) => {
14234
14237
  dbg(`Recovery timing on ${short(sid)}: detectionToAttemptMs=${Date.now() - w.pendingRecoveryAt}`);
14235
14238
  w.recoveryAttempts++;
14236
14239
  dbg(`State transition on ${short(sid)}: recoveryAttempts=${w.recoveryAttempts - 1} -> ${w.recoveryAttempts}`);
14240
+ w.recoveryContinueInFlight = true;
14237
14241
  try {
14238
14242
  await sendContinuePrompt(sid, continuePrompt, w);
14239
14243
  } catch (err) {
@@ -14328,6 +14332,11 @@ var AutoResumePlugin = async (ctx, options) => {
14328
14332
  if (w.pendingRecovery) {
14329
14333
  dbg(`Pending recovery cleared on ${short(sid)}: reason=session-busy`);
14330
14334
  }
14335
+ if (w.recoveryContinueInFlight) {
14336
+ w.recoveryAttempts = 0;
14337
+ w.recoveryContinueInFlight = false;
14338
+ dbg(`Recovery succeeded on ${short(sid)}: recoveryAttempts reset to 0`);
14339
+ }
14331
14340
  if (w.continuing) {
14332
14341
  dbg(`busy on ${short(sid)} via recovery prompt - preserving resumeAttempts=${w.resumeAttempts} gaveUp=${w.gaveUp}`);
14333
14342
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-auto-resume",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "OpenCode plugin that automatically resumes stalled LLM sessions when thinking/streaming freezes mid-generation.",
5
5
  "keywords": [
6
6
  "opencode",