@magpie-community/opencode-cursor-auth 0.2.36 → 0.2.37

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
@@ -101,9 +101,12 @@ 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
102
  Task subagents sharing their parent's session can run independently. Retention
103
103
  waits at most 120 seconds for a result batch and 15 minutes for a Run's total
104
- lifetime. A continuation arriving in the last minute of that lifetime rebuilds
105
- from supplied history before submitting results to the old Run. The absolute
106
- deadline still applies to an active segment; it is never extended by activity.
104
+ lifetime. A continuation arriving with less than 10 minutes of that lifetime
105
+ left rebuilds from supplied history on a fresh Run before submitting results
106
+ to the old one, since one step can be a long answer. The absolute deadline
107
+ still applies to an active segment; it is never extended by activity. A Run
108
+ cut by it mid-answer ends with `native Run lifetime expired: the Run timed
109
+ out; retry your request`, words agents ask again on.
107
110
  The pool holds at most 8 owners per account and 32 per process, with
108
111
  bounded history, blobs, arguments, and pending writes. When pending writes
109
112
  reach their bound (a long history asks for its blobs at once, and a slow link
@@ -8,6 +8,13 @@ import { join } from "node:path"
8
8
  export const NATIVE_LIMITS = {
9
9
  resultWait: 120_000,
10
10
  lifetime: 15 * 60_000,
11
+ // How much of the lifetime a retained Run must have left to take a tool
12
+ // batch's results and go on; with less, the step starts on a fresh Run
13
+ // from the supplied history. One step can be a long answer: a Pi turn on
14
+ // grok-4.7 went on with 494 s left and was still answering at the
15
+ // deadline (plugins#616, yetone/magpie#4419). At most two thirds of the
16
+ // lifetime, so a short one set in a test still has room to continue.
17
+ continueReserve: 10 * 60_000,
11
18
  batchWait: 30_000,
12
19
  // How long a stateless step whose calls came waits for Cursor's count of
13
20
  // them (update 27) with nothing but heartbeats before it hands the calls
@@ -728,6 +735,13 @@ class Segment {
728
735
  }
729
736
  }
730
737
 
738
+ // What a Run cut at its absolute deadline says. It most often lands
739
+ // mid-answer, the 200 long sent, so the agent reads only these words; the
740
+ // conversation is not lost (asked again, the history goes on a fresh Run),
741
+ // and they say so in words agents retry on: "timed out" (Pi, magpie's
742
+ // passingSaid) and "retry your request" (plugins#616, yetone/magpie#4419).
743
+ export const LIFETIME_EXPIRED = "native Run lifetime expired: the Run timed out; retry your request"
744
+
731
745
  export class NativeSessionPool {
732
746
  constructor(limits = NATIVE_LIMITS) {
733
747
  this.limits = limits
@@ -769,7 +783,7 @@ export class NativeSessionPool {
769
783
  // A retained Run's absolute timer spans all tool roundtrips. Rebuild
770
784
  // near its deadline before writing this batch: otherwise a new Chat
771
785
  // segment can lose its transport after already exposing output.
772
- const reserve = Math.min(60_000, owner.limits.lifetime / 10)
786
+ const reserve = Math.min(owner.limits.continueReserve, owner.limits.lifetime * 2 / 3)
773
787
  if (owner.expiresAt - Date.now() <= reserve) {
774
788
  owner.fail({ status: 410, message: "native Run retired before lifetime deadline" }, "expired")
775
789
  return fallback("owner near lifetime deadline")
@@ -867,7 +881,7 @@ class NativeSession {
867
881
  expireIn(ms) {
868
882
  clearTimeout(this.lifetimeTimer)
869
883
  this.expiresAt = Date.now() + ms
870
- this.lifetimeTimer = later(() => this.fail({ status: 410, message: "native Run lifetime expired" }, "expired"), ms)
884
+ this.lifetimeTimer = later(() => this.fail({ status: 410, message: LIFETIME_EXPIRED }, "expired"), ms)
871
885
  }
872
886
  retain(n) {
873
887
  if (this.retainedBytes + n > this.limits.outputBytes) invalid("native output/history retention limit reached", 503)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-cursor-auth",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
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": "./index.mjs",