opencode-auto-resume 1.0.17 → 1.0.18

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 +21 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -12489,7 +12489,8 @@ var AutoResumePlugin = async (ctx, options) => {
12489
12489
  lastSubagentCheckAt: 0,
12490
12490
  interruptedContinueCount: 0,
12491
12491
  recentToolCalls: [],
12492
- toolLoopAttempts: 0
12492
+ toolLoopAttempts: 0,
12493
+ isSubagent: false
12493
12494
  };
12494
12495
  sessions.set(sid, w);
12495
12496
  }
@@ -12724,7 +12725,9 @@ var AutoResumePlugin = async (ctx, options) => {
12724
12725
  w.gaveUp = false;
12725
12726
  w.orphanWatchStartAt = null;
12726
12727
  w.aborting = false;
12727
- w.toolTextRecovered = false;
12728
+ if (w.isSubagent) {
12729
+ w.toolTextRecovered = false;
12730
+ }
12728
12731
  w.toolTextAttempts = 0;
12729
12732
  w.continueTimestamps = [];
12730
12733
  w.idleSince = null;
@@ -13182,11 +13185,20 @@ var AutoResumePlugin = async (ctx, options) => {
13182
13185
  const lone = getLoneBusySession();
13183
13186
  if (lone && lone.w.orphanWatchStartAt === null) {
13184
13187
  lone.w.orphanWatchStartAt = Date.now();
13188
+ w.isSubagent = true;
13185
13189
  log("info", `Subagent finished, parent ${short(lone.sid)} stuck. Orphan watch (${subagentWaitMs / 1000}s).`);
13186
13190
  }
13187
13191
  }
13188
13192
  prevBusyCount = currentBusy;
13189
13193
  log("debug", `${short(sid)} -> idle (${currentBusy})${statusType === "interrupted" ? " (interrupted)" : ""}`);
13194
+ if (!w.isSubagent) {
13195
+ const todos = w.todos || [];
13196
+ const hasOpenTodos = todos.some((t) => t.status === "pending" || t.status === "in_progress");
13197
+ if (hasOpenTodos && currentBusy === 1 && !w.toolTextRecovered) {
13198
+ await log("info", `${short(sid)} - idle with ${todos.filter((t) => t.status === "pending" || t.status === "in_progress").length} open todos. Sending continue...`);
13199
+ tryResume(sid, w, "Idle with open todos");
13200
+ }
13201
+ }
13190
13202
  if (!w.toolTextRecovered && w.toolTextAttempts < maxRetries) {
13191
13203
  if (w.toolTextTimer)
13192
13204
  clearTimeout(w.toolTextTimer);
@@ -13315,12 +13327,14 @@ var AutoResumePlugin = async (ctx, options) => {
13315
13327
  execute: async (_args, ctx2) => {
13316
13328
  const w = sessions.get(ctx2.sessionID);
13317
13329
  if (w) {
13318
- w.toolTextRecovered = true;
13319
- if (w.toolTextTimer) {
13320
- clearTimeout(w.toolTextTimer);
13321
- w.toolTextTimer = null;
13330
+ if (!w.isSubagent) {
13331
+ w.toolTextRecovered = true;
13332
+ if (w.toolTextTimer) {
13333
+ clearTimeout(w.toolTextTimer);
13334
+ w.toolTextTimer = null;
13335
+ }
13322
13336
  }
13323
- log("info", `${short(ctx2.sessionID)} - task_complete called, agent done`);
13337
+ log("info", `${short(ctx2.sessionID)} - task_complete called, ${w.isSubagent ? "subagent" : "agent"} done`);
13324
13338
  }
13325
13339
  return "Task completion acknowledged. No further continuation will be sent.";
13326
13340
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-auto-resume",
3
- "version": "1.0.17",
3
+ "version": "1.0.18",
4
4
  "description": "OpenCode plugin that automatically resumes stalled LLM sessions when thinking/streaming freezes mid-generation.",
5
5
  "keywords": [
6
6
  "opencode",