opencode-auto-resume 1.0.22 → 1.0.23

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 +23 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -10745,7 +10745,7 @@ class JSONSchemaGenerator {
10745
10745
  if (val === undefined) {
10746
10746
  if (this.unrepresentable === "throw") {
10747
10747
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
10748
- } else {}
10748
+ }
10749
10749
  } else if (typeof val === "bigint") {
10750
10750
  if (this.unrepresentable === "throw") {
10751
10751
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -13162,6 +13162,17 @@ var AutoResumePlugin = async (ctx, options) => {
13162
13162
  const now = Date.now();
13163
13163
  const numBusy = busyCount();
13164
13164
  for (const [sid, w] of sessions) {
13165
+ try {
13166
+ const listResponse = await ctx.client.session.list();
13167
+ const allSessions = extractMessages(listResponse);
13168
+ const realSession2 = allSessions.find((s) => s.id === sid);
13169
+ const realStatus = realSession2?.status;
13170
+ if (realStatus && realStatus !== w.status) {
13171
+ w.status = realStatus;
13172
+ if (realStatus === "busy")
13173
+ w.idleSince = null;
13174
+ }
13175
+ } catch {}
13165
13176
  if (w.status !== "busy")
13166
13177
  continue;
13167
13178
  if (w.userCancelled)
@@ -13207,9 +13218,19 @@ var AutoResumePlugin = async (ctx, options) => {
13207
13218
  continue;
13208
13219
  w.lastSubagentCheckAt = now;
13209
13220
  if (w.lastActivityAt > 0 && now - w.lastActivityAt > subagentWaitMs) {
13221
+ try {
13222
+ const listResponse = await ctx.client.session.list();
13223
+ const allSessions = extractMessages(listResponse);
13224
+ const realStatus = realSession?.status;
13225
+ if (realStatus === "busy") {
13226
+ await log("debug", `Session ${short(sid)} is still busy (real status), skipping abort`);
13227
+ w.lastSubagentCheckAt = now;
13228
+ continue;
13229
+ }
13230
+ } catch {}
13210
13231
  const hasActiveTool = await checkSessionHasActiveTool(sid);
13211
13232
  if (hasActiveTool) {
13212
- await log("debug", `Parent ${short(sid)} has active tool call, skipping abort check`);
13233
+ await log("debug", `Session ${short(sid)} has active tool call, skipping abort check`);
13213
13234
  w.lastSubagentCheckAt = now;
13214
13235
  continue;
13215
13236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-auto-resume",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "description": "OpenCode plugin that automatically resumes stalled LLM sessions when thinking/streaming freezes mid-generation.",
5
5
  "keywords": [
6
6
  "opencode",