@magpie-community/opencode-cursor-auth 0.2.39 → 0.2.40

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/README.md CHANGED
@@ -99,7 +99,10 @@ plugin's `fetch` answers them on Cursor's agent API:
99
99
 
100
100
  Tool results can continue a retained Run in the same plugin process. The owner
101
101
  uses the same session/cache key and first user message as `conversation_id`, so
102
- Task subagents sharing their parent's session can run independently. Retention
102
+ Task subagents sharing their parent's session can run independently. A new
103
+ user turn whose earlier native calls all have their results gets a retained Run
104
+ of its own, with those calls as imported history; while any of them is still
105
+ pending, the turn goes stateless. Retention
103
106
  waits at most 120 seconds for a result batch and 15 minutes for a Run's total
104
107
  lifetime. A continuation arriving with less than 10 minutes of that lifetime
105
108
  left rebuilds from supplied history on a fresh Run before submitting results
@@ -796,7 +796,15 @@ export class NativeSessionPool {
796
796
  }
797
797
  // Pending ancestors, new input, and terminal old handles are ordinary
798
798
  // imported history, even while a parent Run is still awaiting its results.
799
- if (chat.messages.some((m) => m?.tool_calls?.some((c) => HANDLE.test(c?.id ?? "")))) return fallback("historical native calls")
799
+ // A fresh user turn whose old native calls all have results imports them
800
+ // into a NEW owner; those results are never submitted to their old exec.
801
+ const historical = chat.messages.flatMap((m) => (m?.tool_calls ?? []).filter((c) => HANDLE.test(c?.id ?? "")))
802
+ if (historical.length) {
803
+ const answered = new Set(chat.messages.filter((m) => m?.role === "tool").map((m) => m.tool_call_id))
804
+ const last = chat.messages.at(-1)
805
+ const freshTurn = last?.role === "user" && !toolAttachment(last)
806
+ if (!freshTurn || historical.some((c) => !answered.has(c.id))) return fallback("historical native calls")
807
+ }
800
808
  if (selector && this.selectors.has(account + ":" + selector)) return fallback("owner busy")
801
809
  return { account, selector, controls, selected: !!selector, chat }
802
810
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-cursor-auth",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "description": "Cursor subscriptions (Pro, Pro+, Ultra, Teams) in OpenCode and magpie, through the API cursor-agent talks to",
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",