Commit Graph
45 Commits
Author SHA1 Message Date
yetone a41a8d3a57 cursor 0.2.20: the MCP server the caller's tools go to Cursor under is "tools", not "magpie"
What goes to Cursor named magpie in four places: the dynamic tool catalog
in the system prompt ('The MCP namespace "magpie" has the tools below' and
each <call> entry's "namespace":"magpie"), every CallDynamicTool call in
the history (args.namespace), each McpToolDefinition's provider_identifier
(field 4), and the server answered for mcp_state_exec_args (name and
identifier). magpie's LESSONS.md rule: text added to a vendor's prompt
names neither magpie nor the vendor's limits, with the care a header
change gets (5d33f060b / 3c4f8f9ae).

cursor-agent names a user's MCP server by its mcp.json label
(providerIdentifier = serverName) and a call by "<label>-<tool>"; read in
cursor-agent 2026.10.01-e373342. The plugin now does the same with the
generic label "tools" (NS), in all four places. Calls are read back under
NAMESPACES = ["tools", "magpie"]: a "<ns>-<tool>" name without field 5 is
stripped of either prefix, and a native exec's provider/server is accepted
as either, so a native session begun on 0.2.19 still has its calls served.
The non-native history is rebuilt from the caller's messages each request,
so it carries the new name at once.

Siblings in other packages that still name magpie upstream, filed, not
changed here: commandcode User-Agent and x-project-slug (#352), kimi-work
User-Agent (#353), qoder business.name (#354), autoclaw device_id (#355),
kimi-desktop's instructions tag (#356), opendesign's host fallback (#357),
layerfs tool descriptions (#358). Left alone as not upstream: X-Magpie-*
response headers, the x-magpie-cursor-session hook header (never sent to
Cursor), magpie_native/magpie_deferred usage fields, sign-in messages.

Test: upstream-words.test.mjs builds a Run (buildRun) from a conversation
with tools and a tool call, and checks that the catalog, every transcript
blob, the request bytes and the mcp_state answer contain no /magpie/i, and
that a call is read back as both "tools-read" and "magpie-read". Red on
the old index.mjs (2 of 3 fail: catalog, mcp_state); green now.
conversation, reasoning and native-test-wire expectations moved to
"tools"; native-e2e still sends provider "magpie", so the old name is
covered on the native path.

Run at this tree:
- bun test in packages/cursor: 279 pass, 0 fail (17 files).
- bun scripts/check.mjs: every package ok.
- Live, owner's Cursor account, sandbox HOME (scratchpad), the plugin's
  loader.fetch with one read_file tool, http2 writes scanned for "magpie":
  auto: turn 1 called read_file {"path":"notes.txt"}, turn 2 with the
  result answered "Pelican"; 0 chunks named magpie (the old index.mjs
  under the same scan: 2). grok-4.7-fast: the same two turns, 0 chunks.
  claude-4.6-sonnet: 429, not in this plan's weekly usage.
Not tried: a native session resumed across the upgrade against real Cursor
(covered by native-e2e's "magpie" provider against the fake server only).
2026-10-24 16:54:42 +08:00
yetone c845b17e9c cursor: http1.test counts a Run when its first message comes, not when its stream is read (#272)
Cause: the fake agent counted runs++ when the server's "stream" event
fired. In the region test the first Run stalls (mode "stall"), the plugin
gives up at H2.wait and goes on over HTTP/1.1, and the test then sets
mode "answer". On a loaded machine the server can read the stalled Run's
HEADERS only after that switch, so the stale stream was taken as a second
Run: ag.runs 2, expected 1. "Runs kept on HTTP/1.1 try HTTP/2 again once
H2.retryAfter has passed" has the same stall-then-answer shape. The plugin
is right; the fake miscounted. A Run now counts once its first message
arrives (the plugin writes it only after the head, so a stream whose
client gave up never brings one), and a stream already destroyed when it
is read isn't answered.

Run on macOS arm64, bun 1.4.2:
- Injected: the fake held the first stream and emitted it the moment the
  test set mode "answer". origin/main's test: red, Expected 1 Received 2,
  the issue's output. With this change: green. The retryAfter test under
  the same injection: red on origin/main, green now.
- Loaded: 8 parallel `bun test --rerun-each 15 packages/cursor/http1.test.mjs`
  at load average ~50: 8 x 240 pass, 0 fail.
- `HOME=$(mktemp -d) bun test` from the root: 1920 pass, 0 fail.
  `bun scripts/check.mjs`: ok.
Test-only, no version bump.
2026-10-21 07:39:22 +08:00
nicegui 0a2496bb3a cursor 0.2.19: conflicting native batch counts rebuild once from history before any output (#207, nicegui)
A Cursor native Run whose step lists two different tool counts (a Codex-to-Cursor failover hit "inconsistent native tool count") now retires the owner instead of throwing. When no native result was submitted to that Run and no Chat output was exposed, the request is rebuilt once from Chat history (the same stateless rebuild the missing-count case uses), with reason=inconsistent-batch-count in X-Magpie-Cursor-Continuity. A Run that had a result submitted, or a stream that already sent output, still returns the error. The decoder stops reading the failed Run at once. Cursor 0.2.19.

Reviewed at c43b93c (on main 0b58032, clean). Run there, HOME and XDG in a sandbox dir:
- packages/cursor `bun test`: 275 pass, 1 fail. The fail is latency.test "events never show in time", red 6 of 6 on untouched main 0b58032 under load average ~270; filed as #210.
- `bun scripts/check.mjs cursor`: ok.
- native-e2e -t "conflicting count": 4 pass. With index.mjs and native-session.mjs from main: 3 of 4 red (JSON and stream rebuild, submitted-result guard). With retentionIneligible forced true: the submitted-result test goes red.
- The fake Cursor is the test's HTTP/2 server on 127.0.0.1; no real account used. The conflict is injected; why Cursor sent two counts is still unknown.
2026-10-17 21:17:45 +08:00
yetone 2ea25b925b cursor: the latency test's far events show once their step has answered, and a step's wait is counted in asks, not ms (#159, #162, #165)
#159 and #162: the "far from Cursor" fake showed a Run's usage event
SHOWS (225 ms scaled) after the Run's stream closed. The step's wait
takes its last look about 180 ms after that close, so only ~45 ms stood
between "the event is not there yet" (what the test means) and "the
event is already there" (the step owns it and the sum moves). A loaded
machine eats 45 ms. #162's title guessed an earlier test's cached
usage; it was the step's own event showing inside its wait.

The fake now holds a far Run's event until the step whose Run it is has
answered, and shows it at once if that step already has: the state the
test is about, not a duration.

#165: test 1 bounded each step's wait in milliseconds, which load
stretches. Each wait asks once and the round trip is most of it, so the
bound is now at most 2 asks per step (its own event, plus what earlier
steps owe).

Run (bun 1.4.2, load average 280-295 throughout):
- Old test, cause injected by showing the event earlier (SHOWS - 50 ms):
  #159's failure; SHOWS - 80 ms: #162's. New test with the same
  injections: green.
- packages/cursor/latency.test.mjs: 9 of 9 green.
- packages/cursor whole package (HOME=$(mktemp -d) bun test): 3 of 3,
  272 pass, 0 fail.
- Broken by hand in index.mjs, each turned the new test red: the step
  waiting for its own event removed; owed() not gathering at the end;
  the ask bound raised (a step asking 3+ times).
Not run: the whole-repo suite (test-only change in one file).
2026-10-16 19:11:56 +08:00
yetone 0c35adbf03 cursor 0.2.18: a failed tool result tells Cursor isError, and a refused keychain read is not asked again for ten minutes
Two things magpie's built-in Cursor did that the plugin didn't, ahead of
the built-in's retirement:

- The stateless path (conversation) sent every tool result with
  isError false. A chat tool message with is_error: true (what magpie now
  sends for a failed tool, as the built-in's cursorResult told Cursor
  isError) is marked isError, as the native path already did.
- cliToken ran `security` on every call. It now reads the Keychain as the
  built-in's cursorKeychainToken (internal/provider/cursor.go; magpie
  #746, #2408): a read is kept 10s; a read that failed with anything but
  exit 44 (no such item) may have been a dialog the user said no to, and
  is not asked again for 10 minutes; reads go one at a time, so callers
  at once share one run. A sign-in and the read after `cursor-agent
  status` read afresh, as forgetCursorStatus / cursorTokenOf(true) did.
  README's "read on every request" says so now.

What was run (bun 1.4.2, macOS, load average ~280-300):
- parity.test.mjs (new, 5 tests): green. Broken by hand, each watched
  red, then restored: is_error ignored (1 red), cache check removed
  (3 red), denied backoff at 10s (1 red), exit 44 treated as refusal
  (1 red), no read serialisation (1 red).
- `security find-generic-password` for a missing item gives execFile
  err.code 44 (number) on this Mac, as the mapping assumes.
- Full `bun test` in packages/cursor, 7 runs: 272/272 green in 4; the
  other 3 red only in latency.test.mjs ("events never show in time",
  #159; "nothing naming the session", #162), which the change doesn't
  touch. On clean origin/main aec06bd, latency.test.mjs alone is red
  too, including "far from Cursor ... cache and all" (filed as #165).
- Not tried: a real Keychain dialog denial; the backoff is checked with
  a fake `security`.
2026-10-16 17:36:57 +08:00
yetone 3dbaa0b16f cursor 0.2.17: a tool-result continuation in a Run's last minute rebuilds before writing results, not 502 at the lifetime (#157, nicegui)
Run at this commit: packages/cursor `bun test` (isolated HOME) 267 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-16 15:40:48 +08:00
nicegui 0b821908bc cursor: a tool-result continuation in a Run's last minute rebuilds before writing results, not 502 at the lifetime (#157, nicegui)
The 15-minute absolute lifetime spans all of a retained Run's tool
roundtrips. A tool-result continuation that arrives with no more than
min(60s, lifetime/10) left now retires the owner (410 "retired before
lifetime deadline") and rebuilds from the supplied history before writing
any result, instead of resuming and failing mid-segment with "native Run
lifetime expired". Replays of an already submitted batch keep their path.
Merging main resolved a conflict with a7614aa (#143): expireIn sets
expiresAt as well as the timer.

Reviewed at 75e481a (nicegui's 6f03753 plus the merge of main):
- packages/cursor `bun test` (isolated HOME) 267 pass, 0 fail, three
  times; `bun scripts/check.mjs` ok; PR CI run 38868447170 green, attempt 1.
- The near-expiry test fails on the source without the reserve check.
- Near-deadline injected by shifting Date.now() from the owner's
  expiresAt, not by waiting: 62s left resumes on the same Run (1 Run, 1
  result written); 59s and 0.5s left rebuild (2 Runs, no result written).
  With the check removed by hand, 59s and 0.5s go red.
2026-10-16 15:39:10 +08:00
yetone a7614aa2ff cursor: the lifetime-expiry test brings a Run's lifetime in after its first answer, not before it starts (#143)
The native retention test set NATIVE_LIMITS.lifetime = 65 before the
first ask. The lifetime counts from the Run's start, so on a loaded
machine the first Run expired before it answered: 410 where the test
wants 200. NativeSession now sets its deadline through expireIn(ms), the
constructor giving it the whole lifetime as before, and the lifetime case
calls owner.expireIn(65) after the first answer. The resultWait case
still sets its limit up front, since that wait counts from the answer.
The plugin's behaviour is unchanged, so there is no version bump.

Run:
- Injected: on the old test, a lifetime of 0–10 ms is red ("Expected: 200
  Received: 410"); 15 ms and up is green. The new test is green.
- HOME=$(mktemp -d) bun test, whole repo: 10 runs in a row, 0 fail
  each. On current main 2dd4328 plus this change: 1609 pass, 0 fail.
- bun test packages/cursor/latency.test.mjs 8 runs: green with this
  change. On main without it, 1 red in 8 runs. That red is
  "events never show in time" at load ~120, filed as #159. It is not
  this test. grok's login flake from an earlier run is #160.
2026-10-16 15:30:52 +08:00
yetone 2dd4328d5a cursor 0.2.16: a multi-step turn's last step reports its own share of usage, and a step's calls get batchWait from the latest one (#156, #155)
Run at this commit: packages/cursor `bun test` (isolated HOME) 266 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-16 15:09:25 +08:00
yetone c7c6498d85 cursor: a multi-step turn's last step reports its own share of usage, and a step's calls get batchWait from the latest one (#156 erzay, #155 midmirror)
#156: a native Run of N tool steps ended with TurnEndedUpdate's totals as
the final step's prompt_tokens (1,105,934 on erzay's ~21-step turn, where
the real context was ~61K), and Codex compacted at once. The final step
now keeps its last model call's share, max(that call's chars/4 prompt
estimate, turn total / model calls), split proportionally across input,
cache read and cache write; the rest goes into usage.magpie_deferred
(merged with any settled stateless debt), so magpie still bills the whole
turn. On erzay's numbers that is ~52.7K reported, ~1.05M deferred.

#155: waitForBatch armed once, at a step's first call, so a step whose
calls arrive one by one as the model writes them (13 calls, 9 long-arg)
failed 502 "did not complete its declared native tool batch" ~30s after
the first call even though it never paused that long. The deadline now
restarts on every call, answered call, count and text/reasoning frame.

Run at this commit: packages/cursor `bun test` (isolated HOME) 266 pass,
0 fail, three times; `bun scripts/check.mjs` ok. The three new tests fail
on 4e64f26's source (prompt 1105934; sealed step failed at 300ms; stall
failed 303ms after the first call instead of after the latest).
2026-10-16 15:09:25 +08:00
yetone 2b67811af8 cursor 0.2.15: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Run at this commit: packages/cursor `bun test` (isolated HOME) 263 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-15 17:51:41 +08:00
yetone 1bf9113390 cursor: calls the bridge answers itself count toward Cursor's tool count, and KV replies wait for a slow link instead of failing the Run (#142, Evopower)
Cursor's tool_requests_listed (InteractionUpdate 27) counts every call of
the model's step, and is sent after them. That count includes calls the
plugin answers itself: a tool the request doesn't have (0.2.14's native
path refuses those) and Cursor's get_mcp_tools (exec 36). 0.2.14 counted
only the calls it accepted. A step with a refused call then either waited
30s for a call that never came (502 "did not complete its declared native
tool batch") or met the next step's count with the stale one (502
"inconsistent native tool count", the reporter's error). The stateless
decoder had the same miscount and hung. Both paths now count answered
calls toward the step and end a step whose calls were all answered without
one.

503 "native outbound messages limit reached": a long history goes out as
one blob per message, and Cursor asks for every blob at once. The native
transport caps its pending writes at 256 messages / 16 MiB and failed the
Run when a slow link backed them up past that. KV replies now wait for
room (NATIVE_LIMITS.writeWait, 30s) and fail only if the link doesn't
drain for that long. The stateless path writes directly and has no cap.

The fixtures are real Cursor frames captured on 2026-10-15 (model auto,
cursor-agent's agent.v1): get_mcp_tools plus a refused WebSearch in one
step followed by read_file, which gave 0.2.14 the reporter's exact
"inconsistent native tool count"; and read_file, refused WebSearch,
read_file under a count of 3, which gave 0.2.14 the batch timeout.

Run at this commit (on origin/main 43d93b0):
- packages/cursor `bun test` (isolated HOME): 263 pass, 0 fail.
- `bun scripts/check.mjs`: every package ok.
- Broken by hand: with native-session.mjs and index.mjs reverted to
  0.2.14, the new tests fail with "inconsistent native tool count",
  "native outbound messages limit reached", the batch wait, and the
  stateless decoder's hang; 4 of 5 red (the stateless mixed case passes
  on 0.2.14, which hands WebSearch to the caller there).
- Real Cursor, before the fix: the captures above reproduced both 502s
  through the plugin's native path. The 503 was not reproduced on a real
  link (my queue peaked at 160 of 256); it is reproduced in the test with
  a 16-message bound and a slow fake write.
- Real Cursor, after the fix (owner's account, model auto, the mixed
  prompt): native path 3 of 3 runs 200 with read_file a.txt and b.txt
  (WebSearch refused to the model), stateless 3 of 3 runs 200; a native
  Run with 1200 history messages 200.
- Not proven: the reporter's empty replies. They are likely the turns
  after these failures and are not addressed separately.
2026-10-15 17:51:41 +08:00
yetone e543ab1ae8 cursor 0.2.14: Run tool calls stay on one native Cursor session, and a tool past Cursor's limit resumes stateless, not as a failed turn (#135, nicegui)
Run at this commit: packages/cursor `bun test` (isolated HOME) 258 pass, 0 fail; `bun scripts/check.mjs` ok. Version bump only.
2026-10-15 13:40:06 +08:00
nicegui 33cdf7c1a8 cursor: Run tool calls stay on one native Cursor session and resume stateless after a long tool, not a failed turn (#135, nicegui)
Cursor's Run (native) calls stay on one Cursor session across a tool result. With them, a tool that runs longer than Cursor's limit resumes stateless, not as a failed turn. The session pool lives in native-session.mjs. It applies to a conversation's first user turn, and a new user turn goes stateless (see the README). X-Magpie-Cursor-Continuity says which path a request took.

The dashboard-usage ledger counts two distinct events in one response that share a millisecond, as main did. Only timestamps claimed by earlier fetches are left out. A new deferred-usage test covers it.

Run at the reviewed head 398aeddc0186cfc38189b1f05577b181aa2d587d (merge base 5d5d86e; main has no packages/cursor change since):
- packages/cursor `bun test` 3 times: 258 pass, 0 fail each time.
- `bun test latency` 12 times with fresh HOMEs: 12/12 pass.
- Broken by hand: putting back `if (claimed.has(key + "\0" + ev.timestamp) || at >= before()) continue` makes the new test "distinct same-millisecond events in one response are billed together, not again on later fetches" fail (2 pass, 1 fail). The head's line passes.
- `bun scripts/check.mjs`: all packages pass.
- `npm pack`, extracted into a fresh dir: index.mjs, native-session.mjs, package.json, README.md. `import("./index.mjs")` exports CursorAuthPlugin and _internal, and native-session.mjs imports.
- CI: test and on-npm green.

Not tried: a real Cursor account. The owner's stored plugin sign-in has no access token. The author reports a real Claude Code run through an isolated gateway: a child resumed stateless after a 125s tool, and all 6 requests returned 200.
2026-10-15 13:39:14 +08:00
yetone 3351e47715 cursor 0.2.13: a Run cancelled while it opens is closed upstream (#130), and dashboard usage is counted per account (#131)
#130: a cancel that landed between the HTTP/2 head and runOnce's abort
listener left the Run streaming upstream with its heartbeat, for nobody.
#131: claimed/owed/flights are keyed by account and conversation, so one
account's Run no longer collects another's debt from its own dashboard.

Run at this commit: full `bun test` (isolated HOME) 1292 pass, 0 fail;
`bun scripts/check.mjs` ok. Version bump only.
2026-10-15 04:15:31 +08:00
nicegui 7c49260ac1 cursor: isolate dashboard usage accounting by account (#131)
Cursor's dashboard usage accounting is kept per account, not per conversation.

claimed, owed and flights were keyed by conversation_id alone. When one
conversation's steps ran on two accounts (magpie moving a session between
Cursor accounts), account B's Run collected A's debt from B's own dashboard:
B's own event was counted as A's earlier Run's usage (magpie_deferred) and
B's turn-ending step polled for a debt its dashboard can't have. The keys
are now sha256(token) + conversation_id (usageKey), used by collect, owe,
ledger and the flights cleanup alike. A token change starts a new identity,
as misses/unreadable already were keyed.

Reviewed at 19bbdf8d7162735d7ddafd015d8dfadbb233c3bd, then merged main
(ca6415f, #130) into the branch at 74578e51e4214b75056746aa81ecc8fcba104ed2;
the only conflict was the _internal export line (both openH2 and usageKey
kept). Diff against main unchanged (168+/34-).
- full `bun test` (isolated HOME/TMPDIR): at 19bbdf8 1267 pass/0 fail; at
  74578e5 (with #130) 1292 pass/0 fail; `bun scripts/check.mjs` ok; PR CI
  green at 74578e5.
- own test: A owes one Run on conv, the next step runs on B whose dashboard
  shows B's own event. On main B's owed(true) returns B's event as A's debt
  and polls B's dashboard; here it returns null with no request, and A later
  collects its own event.
- broke by hand: usageKey back to conversation alone fails the three new
  stepusage tests.
Not tried: real Cursor accounts. A conversation moving accounts leaves the
first account's collected-but-unreported carry under that account (expires
after owedFor) instead of reporting it on the other account's row.
2026-10-15 04:15:03 +08:00
nicegui ca6415f959 cursor: cancel and clean up stateless Run transports (#130)
A Chat cancelled while its Run opens is closed upstream, not left running.

Before, a cancel that landed after the HTTP/2 head arrived but before runOnce
subscribed to the signal was never seen ({once:true} listener added to an
already-aborted signal): the Run kept streaming upstream for nobody with its
5s heartbeat interval, and the session was never closed. open/openH2/openH1
now check the signal at each hand-off, close what arrived, and remove their
abort listeners; runOnce checks again before starting the heartbeat. HTTP/1's
write callback now waits for its BidiAppend, so backpressure and close see
the pending upload. A cancelled open answers 410 instead of 502.

Reviewed at a4e1db1b0d734c1a1b15c1fe0cafb0f9cb5313c0 (on main 5fc0a75):
- full `bun test` (isolated HOME/TMPDIR): 1288 pass, 0 fail (main: 1265/0);
  `bun scripts/check.mjs` ok.
- own plugin-level test (fake HTTP/2 session, abort a microtask after the
  200 head, upstream never ends): on main the request hangs, req never
  closed or destroyed; at this head it answers at once, req closed once.
- broke by hand: dropping runOnce's aborted check fails "the plugin: head
  abort ..."; reverting the H1 write callback to an immediate cb() fails
  three openH1 append tests.
- checked: destroying the H1 Duplex with a write in flight emits no
  'error' (bun and node); 410 "the request was cancelled" doesn't match
  magpie's modelRetired words.
Not tried: a real Cursor account or a real proxy (offline fakes only).
2026-10-15 04:13:01 +08:00
yetone f2f4ff4014 cursor 0.2.12: Grok Bot is among magpie's three panel rings ahead of an On-demand with no limit (yetone/magpie#2213, Morganwan90)
The usage windows went Cursor Models, Other Models, On-demand, Grok Bot,
Total. magpie's tray panel draws an account's first three, so on an
account that may spend on-demand without a limit, the On-demand ring
(always 0%, only a dollar figure) pushed Grok Bot out, while an account
with no on-demand showed Bot third.

An On-demand with no limit (aside) now goes after Bot, beside Total. One
with a limit keeps its third place ahead of Bot: it is the window that
can stop the account's requests, with the pools aside.

Run: bun test in packages/cursor (89 pass), bun scripts/check.mjs (all
packages ok). The new test fails on 0.2.11's index.mjs (Bot fourth,
On-demand third). Not tried with a real Cursor account that has Grok Bot
and on-demand.
2026-10-14 23:22:05 +08:00
geoqiao 4aae1ce7b9 cursor 0.2.11: a step's usage is its own; what it collected of earlier steps is magpie_deferred (#101)
A tool step whose usage event shows after its wait reports 0, and the
conversation's next step collects it. That step used to add it to its own
prompt_tokens, which clients read as context occupancy: pi saw 366940 tokens
(181270 + 185670) on a 300k window and compacted, though 185670 were in use.

Now a step's standard usage fields are its own Run's only. What it collected
of earlier steps goes in usage.magpie_deferred (prompt_tokens,
completion_tokens, cached_tokens, cache_write_tokens), which magpie bills with
the step (yetone/magpie PR) and clients ignore. ledger() also splits collected
events by timestamp: an event stamped from the Run's start on (less 1 s) is
the Run's own; earlier ones and carried counts are deferred. Before, a late
event of an earlier Run could land in a step's own count through gather().

Verified: bun test on packages/cursor, 88 pass (86 before, plus
deferred-usage.test.mjs); bun scripts/check.mjs. With the old index.mjs the
new test fails with Expected 185670, Received 366940. Against real Cursor
(composer-2.5, STEP_WAIT shortened to force late events, 2 rounds) the
deferred totals matched the dashboard's usage events token for token.
The repo-wide bun test has 2 failures in packages/trae that fail the same on
9074723 without this change.
2026-10-13 14:51:26 +08:00
yetone a885a16190 cursor 0.2.10: a Team member with no limit of their own spends the team's on-demand pool, which is shown and counted as the limit, not as unlimited (yetone/magpie#1868)
PaSSw0rds' Team account has on-demand turned on for the whole
organization: spendLimitUsage has no individualLimit, pooledLimit
"45120000" and pooledRemaining "38785730" are int64 strings, pooledUsed
6334270 a number, and GetHardLimit answers {"hardLimit": 451200} with or
without a team id. onDemandOf read that as "unlimited", as cursor-agent's
own usage view does, so the On-demand row showed only the member's own
$198.55 at 0%, and a spent team pool never counted the account used up.

Now a team member with no individualLimit and a pooledLimit > 0 gets a
fixed On-demand window on the pool: used = pooledUsed / pooledLimit,
display "$63,342.70 / $451,200.00 (you: $198.55)", not aside, so magpie
stops routing to it when the pool is spent. A hard limit that forbids
on-demand still reads as disabled; a team with no pool and a hard limit
still reads as unlimited. Dollar figures group thousands.

Run: bun test in packages/cursor (86 pass), bun scripts/check.mjs (exit 0).
The new test, built from the payloads quoted in yetone/magpie#1476, fails
on the old index.mjs (On-demand "$198.55", used 0, aside) and on a fix
that shows the member's spend against the pool instead of the pool's own.
Not tried against a real Team account.
2026-10-13 06:00:37 +08:00
yetone 6579c01711 cursor 0.2.9: when the default's own branch stops short, an id of it asked past that goes as its nearest, not the default's id at the effort asked (#55)
With the default on the branch without thinking (thinking=false, low to
high) and xhigh only with thinking, claude-opus-5-low asked at xhigh went
as the default's slug with effort=xhigh: an id and parameters at odds.
branch() returned early whenever what was asked differed from the default
in the effort alone.

Decided: that early return now holds only when no variant at all is named
for the effort asked, so claude-opus-5-5-xhigh (no xhigh variant
anywhere) still goes at xhigh as a listed model does, and an effort
another branch has makes the default's branch go to its nearest.

Run: the new test (the issue's picker, plus every id x effort x fast
agreeing with its parameters) fails on the old index.mjs and passes here;
HOME=$(mktemp -d) bun test for the repo, 1154 pass 0 fail; bun
scripts/check.mjs green. Not seen on a real account (as the issue says).
2026-10-13 04:45:03 +08:00
yetone 08614da5c5 cursor 0.2.8: an empty reply says what the Run sent before it (#60, congee949)
An "an empty reply" (502) said nothing of why, so #60's 14 empty replies
on grok-4.7-fast over seven days can't be told apart: a turn of thinking
only, a turn spent asking for Cursor's own tools (which the plugin
refuses), something Cursor now sends that decode doesn't read, or an end
frame that carried words without a Connect code (which failure() treated
as a clean end and dropped). Its message now names them, e.g.

  an empty reply (Cursor ended the turn; after 31 chars of thinking, no
  text and no tool call; Cursor counted 41 output tokens; Cursor's own
  tools asked for and refused: #14; try again)

and, when the stream itself ended, the end frame's JSON (cut at 300
chars). Field numbers are agent.v1's. Status, retry and behaviour are
unchanged: magpie's gateway retries on the 502, not on the words.

Run: HOME=<tmp> bun test, 1103 pass, 0 fail (a first run under load
average 16 had 7 bun 5s timeouts in other packages' CLI/login tests,
#65's class; the rerun was green); bun scripts/check.mjs cursor passes.
The two decode tests go red with the old index.mjs. Through the plugin's
loader against a local HTTP/2 fake Run (thinking, an own-tool exec,
TurnEnded, no text): the unstreamed 502 and the streamed error frame
both carry the message above. Not tried against real Cursor: no cause is
proved; this is to name it on the next occurrence.
2026-10-12 18:14:57 +08:00
yetone 379ec96615 cursor 0.2.7: an assistant turn's reasoning_content is kept across a tool continuation (#82, nicegui)
Releases #82 (126b105): a Chat request's assistant reasoning_content (or
reasoning) goes into the next Run's transcript as an AI SDK reasoning part,
beside the text and tool calls, also when a turn's parallel calls are split
over two assistant messages; the input estimate counts it.

Run: bun test packages/cursor (83 pass), bun scripts/check.mjs. Live with a
real Cursor Pro account through this fetch: a tool continuation carrying
reasoning_content answered 200 on auto, claude-haiku-5-5-thinking and
gpt-5.5.
2026-10-11 19:03:32 +08:00
niceguiandluolingpeng 126b105df1 fix(cursor): preserve assistant reasoning across tool continuations (#82)
Co-authored-by: luolingpeng <luolingpeng@lovart.ai>
2026-10-11 19:02:58 +08:00
yetone a298e5430f cursor 0.2.6: an account that may spend on-demand is not used up when its included usage is (fottencity on Discord)
A Cursor team (or personal plan) with on-demand spend allowed keeps being
served once Cursor Models / Other Models reach 100% of the included usage.
The usage read gave only those pools, so magpie counted the account used
up: smart routing put it last, and any failure while a pool read 100%
rested it until the billing period renewed (held to 8 days).

usage now also reads GetHardLimit and the period's spendLimitUsage, and
derives the On-demand state exactly as cursor-agent 2026.10.01's usage
view does (fixed limit, unlimited, disabled, unavailable). When on-demand
is fixed or unlimited, the pools are still shown but marked aside, and an
On-demand window ($used / $limit) is the allowance: used up at its limit,
never when there is none (then aside too). Disabled or not known: the
pools are the allowance, as before. Bot stays before Total.

Verified: bun test (77 pass); the three new on-demand tests fail on the
old index.mjs (pools not aside, no On-demand window); bun
scripts/check.mjs cursor. Fixture shapes come from cursor-agent's own
protobuf schema (GetCurrentPeriodUsageResponse.SpendLimitUsage,
GetHardLimitResponse); not tried against a real enterprise account.
2026-10-10 15:09:34 +08:00
Morgan 6bed2c1c32 cursor 0.2.5: a Cursor account with a Grok Bot allowance shows it on its Usage card (#64)
Grok Bot has an allowance of its own, apart from Cursor's monthly usage,
and it shows on cursor.com's dashboard only. auth.usage now also reads
https://cursor.com/api/dashboard/get-sand-usage-status with the sign-in
as the dashboard session (WorkosCursorSessionToken, as Cursor's dashboard
and CodexBar's CursorSandUsage.swift send it), and adds a "Grok Bot"
window: a paid grant with its weekly reset, a live trial as
"Grok Bot (trial)" without one. The window is aside, so Bot running out
never stops Cursor model requests, and it comes before Total so it is
among the Usage card's three rings. No grant, an expired trial, a
non-2xx, a redirect (not followed), a hang past 5 s or a reply that
isn't JSON each leave Cursor's own windows as they were.

Rebased onto main after cursor 0.2.4 (7516d63); package version is 0.2.5.
Optional pins for the 5 s AbortSignal.timeout and the Origin header are
not in this commit (Codex CLI unavailable for the edits); the runtime
guards stay.

Tests: usagePercent 130 is shown as 100 (and -5 as 0), and a 307 to a
login page is refused rather than followed; each fails with its guard
removed from botUsage.

HOME=$(mktemp -d) bun test packages/cursor: 73 pass, 0 fail.
HOME=$(mktemp -d) bun test (whole repo, on this commit atop main
7516d63): 1033 pass, 0 fail. bun scripts/check.mjs: all 15 ok. Checked
by hand once before an earlier squash: a Free Cursor account linked to
SuperGrok showed the Bot ring in magpie. Not tried with a paid Cursor
grant.
2026-10-10 11:49:29 +08:00
yetone 7516d636d8 cursor 0.2.4: a model asked for by its bare name (grok-4.7) counts in the pool its sized ids (grok-4.7@256k) are in (Will on Discord)
The model list offers Grok 4.7 only at its context sizes, grok-4.7@256k
and grok-4.7@500k, while a routing group picked before the list had sizes
still asks for bare grok-4.7, which named() runs at its default size.
usage() built the Cursor Models window's models (and Other Models'
notModels) from the listed ids only, so magpie counted bare grok-4.7 in
Other Models: used up, 0% left on the Routing page, ranked last, while
Cursor Models had ~84% left. The pool now also names each listed id's
bare name; inPool still decides which pool it is in.

magpie 99009b93 makes the same match on its side for every plugin (a bare
id and its id@size count as one); this release covers magpie versions
before it.

Verified: the new usage.test.mjs case fails on 0.2.3's index.mjs ("Grok
4.7" counted false/true) and passes now; packages/cursor 67 pass;
check.mjs green. The whole-repo bun test needs HOME=$(mktemp -d) (CI does
it), not run here that way.
2026-10-10 10:58:09 +08:00
kazecreator 5b67ff41aa cursor 0.2.3: a Run HTTP/2 can't open goes over HTTP/1.1, as RunSSE + BidiAppend on api2 (#59, kazecreator)
Where a proxy or network blocks HTTP/2, a Cursor Run goes over HTTP/1.1 on api2: RunSSE down, a BidiAppend for each client message up. A failure that says HTTP/2 itself can't be had keeps later Runs on HTTP/1.1 for 10 minutes; a refused connection or a reset stream falls back for that Run only. Reviewed at f5c11b7, merged onto 0437abb: cursor 66 pass, whole repo 1026 pass, check.mjs all 15; each guarded piece broken by hand turns http1.test.mjs red.
2026-10-10 09:33:23 +08:00
yetone fb253f91d5 cursor 0.2.2: a model listed at a size Cursor has a fast variant of says fast: true (yetone/magpie#1360, loosheng)
0.2.0 stopped listing a model's -fast one and takes fast as the request's
service_tier, so magpie, which offered its Fast switch (the agent picker's
lightning, a group member's 标准速度/快速) for a model with a -fast one,
offered it for none. The runtime model now says fast: true when a variant
the account is served at that context size has fast=true (Opus 5.5 @ 300k,
Composer 2.5, Grok 4.7), and nothing otherwise (a size with no fast variant,
a model with no fast parameter, an account the usable list doesn't serve the
fast variants). Requests are unchanged.

Tested: new context.test.mjs case, which fails on 0.2.1 (no model says
fast); the whole package (50 tests) and scripts/check.mjs pass. Not tried
with a real Cursor account.
2026-10-09 05:14:56 +08:00
geoqiao cf0de01e2a cursor 0.2.1: an id 0.1.x listed, at an effort only its other branch has, goes as its own branch's nearest, not as the default's id with parameters that contradict it (review of #51) (#54)
An old id names a branch of a model's variants (claude-opus-5 is the Opus 5
without thinking). When the effort asked for exists only in the other branch,
no variant matched and the request went as the default's legacySlug with the
parameters it had been given: cursor/claude-opus-5 at xhigh went as
claude-opus-5-thinking-high with thinking=false, effort=xhigh. On this
account Opus 5 without thinking stops at high, so it happens today: 40 of
5040 old id × effort × fast combinations, all claude-opus-5. 0.1.11 sent
claude-opus-5-high there.

Now, for an old id, a request no variant matches goes as the variant of
its own branch (every parameter but the effort as asked) at the nearest
effort it has (branch()): claude-opus-5 at xhigh or max is claude-opus-5-high,
-fast at xhigh is claude-opus-5-high-fast, as 0.1.11 sent them. Where the
default differs from what is asked in the effort alone, the effort still goes
as asked. A listed id is not changed.

context.test.mjs adds a picker shaped like this account's Opus 5 and checks
those cases and that every id sent agrees with its parameters (which holds
where the default's branch is complete, as in this picker; see Not covered);
it fails on 8cd5a0f's index.mjs. HOME=$(mktemp -d) bun test packages/cursor:
49 pass, 0 fail; check.mjs cursor passes. Offline against this account's
picker and usable list: the contradicting requests go from 40 to 0.

With a real Cursor account, this version installed into magpie (packed from
this code plus one temporary line logging what request() returns):
cursor/claude-opus-5 at reasoning_effort xhigh (max_tokens 16) went as
claude-opus-5-high with thinking=false, context=300k, effort=high,
fast=false, maxMode=false, and answered 200 ("ok", 14 in / 4 out, 5.2s;
magpie's usage log: effort xhigh, status 200). On 0.2.0 the contradicting
request cursor/claude-opus-5-low at xhigh also answered 200, so it failed
silently.

Not covered. branch() steps aside when what is asked differs from the
default variant in the effort alone, so that an effort goes as asked, as
for a listed model (the existing claude-opus-5-5-xhigh test expects
effort=xhigh). So when the branch that stops short is the default's own,
the request still goes as the default's slug with the effort asked: with a
default of m-high (no thinking, low to high) and a thinking branch up to
max, m at xhigh goes as m-high with effort=xhigh. Dropping that early
return fixes it (effort=high) and changes that one assertion; left for the
maintainer to decide. On this account no model's default branch is the
shorter one (of 20 models with two or more branches, only non-default
branches stop short: claude-opus-5's without thinking, and gpt-5.4's fast
one after the usable list).
2026-10-09 00:25:32 +08:00
geoqiao 8cd5a0fad8 cursor 0.2.0: the list is Cursor's picker, a model once per context size with that window; effort and fast are the request's (#51)
* cursor 0.2.0: the list is Cursor's picker, a model once for each context size with that window (claude-opus-5-5@300k, @1m), and effort and fast are the request's, sent as the variant's parameters

The usable list (AgentService/GetUsableModels) names a model once for each effort and speed, and the window was read off the name: 1M when it said 1M, else 200K. The names say 1M of models Cursor serves at 300K outside Max Mode ("Claude Opus 5.5 1M"), and nothing of the 300K Sonnet and Haiku or the 256K Grok have, so on this account 110 of 153 names gave a wrong window: Opus too large, Sonnet, Haiku and Grok too small, and the agents compacted at the wrong point. The request carried no context parameter either, so the window Cursor ran at was its own choice, not the one magpie reported. The same id could go to a 300K and a 1M variant.

Now the list is Cursor's model picker alone (AiService/AvailableModels, asked as the CLI asks it: useModelParameters, doNotUseMarkdown), the way pi-cursor-sdk lists Cursor's catalog. A model with a context parameter is offered once for each size, as <model>@<size> named "<name> @ <size>", its window that many tokens; one without is offered once, its window Cursor's contextTokenLimit (Max Mode's for a model served only there), 200K when Cursor gives none. Effort is not a model of its own: the model's efforts (effort / reasoning_effort / reasoning; extra-high is xhigh) are its variants, the request's reasoning_effort is fitted to the nearest and sent as that parameter, and none turns a Claude's thinking off. Fast is not one either: a service_tier of priority or fast sends fast=true, anything else fast=false, so it is paid for only when asked. A request goes as the variant those parameters pick, by the variant's legacySlug (claude-opus-5-5-medium): the agent API refuses the picker's base name with 502 "AI Model Not Found: Model name is not valid". It goes in Max Mode when that variant is Max Mode's (a 1M size; Opus 300K with fast), or, with no variant for the size, when the size is over Cursor's limit outside it; the "Max Mode Required" retry stays. Hidden, Tab-only and chat-only models stay out, as in the CLI.

The ids change (cursor/claude-opus-5-5 is cursor/claude-opus-5-5@300k; the -fast, -low and -thinking models are gone), so 0.2.0: a model picked in magpie or an agent's config has to be picked again. An id the list doesn't have goes to Cursor as it is named, with the default window. poolBase and firstParty take the @size off, so usage pools as before (grok-4.7@256k Cursor Models, claude-opus-5-5@300k Other Models).

context.test.mjs (new) covers the list, the windows, the variants and the request's parameters and mode; maxmode.test.mjs (rewritten) checks what reaches a fake agent API; usage.test.mjs adds the sized ids. HOME=$(mktemp -d) bun test: 45 pass, 0 fail; check.mjs cursor passes. Tried with a real Cursor account: claude-opus-5-5@300k goes as claude-opus-5-5-medium with context=300k and answers, grok-4.6 as cursor-grok-4.6-high, and pi -p --model magpie/cursor/claude-opus-5-5@300k answers; the base name got the 502 above.

* cursor 0.2.0: an id 0.1.x listed still runs as the variant it stood for, and a variant the account hasn't got is neither offered nor asked for (review of #51)

An id the new list doesn't have went to Cursor as it was named. The ids 0.1.11 listed are families of the variants' own ids (claude-opus-5-5, claude-opus-5-5-fast, claude-haiku-5-5-thinking, cursor-grok-4.6), and they are saved in agents' configs, magpie's picks and routing groups: request(raw, "claude-opus-5-5", "high") was {id: "claude-opus-5-5", params: [], maxMode: false}, the bare name the agent API answers 502 "AI Model Not Found" for, with the effort dropped.

Now an id the list doesn't have is read as one of Cursor's own (named): a variant's legacySlug is that variant; a family of them, taken apart as 0.1.x's splitID did, is the family's variant nearest the default, fast for a -fast family, thinking as the family says, at the effort the id names when the request names none; the picker's name for a model, one of its legacySlugs or idAliases, is its default. Each is at the variant's context size, the default's when two sizes share the id. The request's reasoning_effort and service_tier count as for a listed model. The family is tried before the picker's name, so claude-haiku-5-5 stays the Claude without thinking it was in 0.1.11 where Cursor has variants named so; where it has none it is the model's default. Anything else still goes as it is named.

The usable list (AgentService/GetUsableModels) is read again, beside the picker: a variant whose legacySlug isn't in it is dropped, the model's efforts and sizes are the ones its remaining variants have, and a request no remaining variant matches goes as the nearest of them, not as the default's id with parameters the account hasn't got. A model the usable list has nothing of is the picker's alone (GLM-5.3, as 0.1.7 found) and is kept whole; a usable list Cursor can't give leaves the picker as it is.

answerOf's comment says what pick does with no service_tier (fast off). context.test.mjs checks the PICKER_SKIP names stay out (claude-4.5-haiku, claude-haiku-4-5), each id 0.1.11's offered() gives for the fixture's slugs, variant ids and a model's legacy slug, and the usable list's filter; maxmode.test.mjs checks claude-opus-5-5 reaches the fake agent API as claude-opus-5-5-medium. On b33ec2f's index.mjs the three new context tests and that maxmode test fail. HOME=$(mktemp -d) bun test: 48 pass, 0 fail; check.mjs cursor passes. Not tried with a real Cursor account, and not read against cursor-agent's source (neither is on this machine): the old-id rules follow the review's description and 0.1.11's splitID.
2026-10-08 22:03:11 +08:00
yetone 78780b81be cursor 0.1.11: a turn's parallel tool calls split over two consecutive assistant messages keep their results (yetone/magpie#1275)
An agent can send one turn's tool calls in two assistant messages in a
row, answered together after. conversation() answered the first
message's calls at the second one: toolu_a went to Cursor as "Tool use
was interrupted and did not produce a result." and its real result A!
was dropped. joinSplitCalls now joins an assistant message onto an
assistant message before it that made tool calls, as Anthropic reads
consecutive assistant messages and as magpie's built-in does since
7067fce5, so the calls are pending together. A call of the split turn that
really went unanswered is still answered for; two text-only assistant
messages stay two; the caller's messages are not changed.

split-calls.test.mjs is #1275's request in Chat form: 3 of its 5 tests fail
on 0.1.10 (trace user assistant(toolu_a) tool(toolu_a=interrupted)
assistant(toolu_b) tool(toolu_b=B!)) and pass now. HOME=$(mktemp -d) bun
test (43 pass, 0 fail) and bun scripts/check.mjs pass. Not tried against
a real Cursor account.
2026-10-08 16:54:30 +08:00
yetone 288c6bc9c9 cursor 0.1.10: far from Cursor a conversation's tool steps add up to what Cursor counted, cache included (yetone/magpie#1053, #33). The tool-step usage-event wait of 0.1.9 (first ask at 1.5 s, every 0.5 s, up to 6 s) never met an event on the reporter's network (Windows, mainland China: a GetFilteredUsageEvents round trip of ~4.2 s, the event 4–5 s after the Run closes), so tool steps were counted as their whole prompt estimated with no cache (fable 13/13 steps, 0% cached; opus 27%) where Cursor counted 95–99%, and every tool step waited the full 6 s. A tool step's Run is now owed by its conversation (only when a conversation_id names the session): the step counts every event of the conversation's owed Runs that shows within the same wait, its own or earlier ones, and says 0 used when none has; the conversation's next Runs collect the rest in the background from 5 s after the owed Run closed, and a step that ends the turn waits for whatever is still owed (in-flight collections, then a poll for the rest). Events are claimed once, by count, so the conversation's prompt, cache read, cache write and output add up to Cursor's dashboard, some of it a step late. After 3 steps in a row left something owed an account's tool steps stop waiting (asked again every 10th). A Run that fails after collecting gives it back; an account that can't read its events (4xx) and a Run with no session id are estimated as before. latency.test.mjs runs whole conversations through the plugin against a fake Cursor with the reporter's latency scaled 1/20 and the reporter's literal events (in 2 / cacheRead 63457 / cacheWrite 3081, in 2 / 66538 / 14756, in 4 / 67872 / 2392): on 0.1.9 the 3-step conversation sums to 137936 prompt / 131329 cached instead of 218104 / 197867, and skipped steps still wait the full window (292 ms > 150); both pass now, 20 of 20 runs, and stepusage + latency pass with --rerun-each 20. HOME=$(mktemp -d) bun test: 682 pass, 0 fail; check.mjs cursor passes. Not tried with a real Cursor account on a high-latency network. 2026-10-07 03:17:08 +08:00
yetone 10bf7c4364 cursor 0.1.9: a step that calls tools reports what it used, the cache included (yetone/magpie#676) — Cursor tells a turn's usage (TurnEndedUpdate) only once the client has run the tools and sent their results in the same Run, and the caller runs them after the Run is closed, so a tool step had none: its input was estimated with no cache (2395 / 0 where Cursor counted 4265, 4224 of them cached). After the calls it sends only the checkpoint (no token details) and heartbeats, and a cancelled Run ends with an error and no usage. Every Run is counted in the dashboard's usage events (DashboardService/GetFilteredUsageEvents) by its conversation_id, input apart from the cache read and written, as TurnEndedUpdate does; one shows about 2.5 s after the Run closes. So a tool step with no TurnEnded closes the Run, then looks for its event (after 1.5 s, every 0.5 s, up to 6 s): its conversation's, no older than the Run, not already counted; else the estimate as before. stepusage.test.mjs fails on the old code and passes. Tried with the real Cursor account through a sandbox magpie's plugin host: grok-4.7-fast tool calls report 6186 in, 6144 cached, 121 out (0.1.8: 5057 estimated, 0 cached); streamed too. 2026-10-03 21:10:20 +08:00
yetone 93aa1671aa cursor: write each catalog entry as its CallDynamicTool call; a thinking-only turn is an empty reply (#11)
GLM-5.3 read the catalog's <tool name=...> entries as tools of its own and
called them by bare names, which went nowhere. Each entry is now the
CallDynamicTool call itself (namespace, toolName, arguments) — the change
infinitr0us proposed in #11, thanks! A turn that ends with only thinking,
no text and no tool call, is answered as an empty reply so the client asks
again, as the stream's end already did. 0.1.8.
2026-10-03 08:39:01 +08:00
yetone 8f25b63718 publish from GitHub Actions with npm's trusted publishing, no one-time password [skip ci]
.github/workflows/publish.yml runs the tests (in a throwaway HOME) and
scripts/publish.sh on each package.json change pushed to main, or by hand;
npm's OIDC exchange stands in for a token and an OTP. Every package now
names magpie-community/plugins' publish.yml as its trusted publisher on
npmjs.com, and gets the repository field npm checks it against.
2026-10-03 00:00:23 +08:00
yetone 3ae3e4393e cursor 0.1.7: a model Cursor serves only in Max Mode is asked for in Max Mode, and the models Cursor's picker offers beyond the CLI's list (GLM-5.3, GLM-5.3 Flash) are listed (ARNO on Discord: "Cursor: Max Mode Required: The model "gpt-5.6-luna-low" requires Max Mode to be enabled"; "cursor provider 里少了 glm-5.3 和 glm-5.3-flash")
The Run's model went as ModelDetails and RequestedModel with its id alone, never max_mode (ModelDetails field 7, RequestedModel field 2), so a model Cursor serves only in Max Mode was refused. cursor-agent (2026.10.01) turns Max Mode on for such a model itself: requiresMaxMode is supportsNonMaxMode === false or a variant's isMaxMode in AiService/AvailableModels, and a usable model's own maxMode is kept. Now the list notes Max Mode from GetUsableModels' maxMode and from the picker (AvailableModels with useModelParameters, as the CLI asks for it), the Run sends it, and a model neither says it of is asked once more in Max Mode when Cursor answers "Max Mode Required" (the CLI's MAX_MODE_REQUIRED), and in Max Mode from then on. An account Max Mode isn't open to gets Cursor's own answer.

The list was GetUsableModels alone, which is `cursor-agent models`; Cursor's picker offers models it leaves out. The picker's models that no usable id, name or slug names are added: one per variant with a legacy slug, else the model by its name with its default variant's parameters, sent as RequestedModel.parameters; hidden, chat-only, Tab-only and non-agent models, and the four the CLI drops, stay out. A picker Cursor can't give leaves the list as it was.

The tests now import nonet.mjs first: fetch and HTTP/2 reach only this machine, so a test without its fake, or work still running after it, can't send a token to Cursor. maxmode.test.mjs (fake API and agent API: the list with GLM-5.3 and its Flash and Max Mode marked, the picker down, the Run's max_mode and parameters, the retry after Cursor's refusal) fails without the change (5 of 5) and passes with it; bun test packages/cursor (27 pass) and bun scripts/check.mjs pass. No request was made to Cursor.
2026-10-02 22:10:35 +08:00
yetone 15e66f6792 cursor 0.1.6: a conversation's Runs keep one conversation_id, so Grok's and Opus's prompt cache on Cursor sticks, and Cursor's usage no longer counts the cache twice (#6, the port of yetone/magpie#498's 0f415708 the plugin missed)
buildRun gave every Run a new random AgentRunRequest.conversation_id, so Cursor's backend sent each turn to whichever machine and the prompt cache hit only by chance (congee949: cache_read 0, 1152, 0, 0, 0, 0 over six turns of one Grok conversation). The id is now made as the built-in's cursorConversation makes it: a UUID hashed from what names the session — the request's prompt_cache_key (Codex's thread id), else the session magpie (or OpenCode) tells the new chat.headers hook, which the hook hands the loader's fetch in x-magpie-cursor-session and which goes no further — together with the conversation's first user message, so subagents under one session are conversations of their own. With nothing naming the session it stays random per Run: magpie's own "magpie-<24 hex>" session, made of the first message alone when the agent names none, is taken as none, as the built-in's nativeSessionOf does. The hook only marks requests to cursor, as every plugin's chat.headers sees every provider's.

TurnEndedUpdate.input_tokens counts the whole prompt, the cache read and written included; it was taken as the uncached input and the cache added again for prompt_tokens. Now, as cursorUsage: input = max(input_tokens - cache_read - cache_write, 0), reasoning_tokens (field 5) given as completion_tokens_details.reasoning_tokens. The prompt is guessed only when Cursor counted nothing at all, not when it was all read from the cache.

conversation.test.mjs runs the plugin against a fake Cursor (its API a stand-in fetch, the agent API an HTTP/2 server on 127.0.0.1, any other connection refused): a session's turns keep one id, another session or another first message gets its own, prompt_cache_key wins over the host's session, no session gives a new id each Run, the hook leaves other providers alone, and the issue's numbers come out counted once. All five fail against 0.1.5.
2026-10-02 21:50:13 +08:00
yetone 01aee5da28 all: a usage read says what it means for the sign-in, and a renewal clears the mark whatever follows, as the built-ins did (要保证插件跟内置的所有逻辑都要一模一样) — auth.usage returns signIn on every path: expired where the built-in's quota read marked the account (Zed's /users/me 401, Factory's and MiMo's refused renewals, Qoder's refused job refresh), renewed after a renewal, which took the mark off, kept everywhere else, so magpie no longer guesses from the words 'sign in again' (Kiro's, Devin's and ZCode's usage errors marked accounts their built-ins never did) nor clears on a clean read. A request after a renewal says renewed on any status; one without says kept, as the built-ins cleared only on renewal. Kiro, Cursor, Devin, Command Code, WorkBuddy, Grok and ZCode, whose built-ins never marked an account, say kept on every answer. New tests fail against 85d7dd0's index.mjs. 2026-10-01 04:53:29 +08:00
yetone 85d7dd0d0a all: each plugin fails with its built-in's status and marks the sign-in as it did, through X-Magpie-Sign-In (要保证插件跟内置的所有逻辑都要一模一样) — Factory's and MiMo's refused renewals are the built-ins' 502 marked expired, not 401s; Qoder's vendor 403 is the built-in's 401 kept, its model list's failure a 400, its job refresh refused marked expired; Zed's retried 401 is a 401 kept, not a 403; Kiro's unreachable refresh a 401 kept; Cursor's expired trial a 401 kept; a vendor 401 WorkBuddy, Grok, Devin, Command Code and ZCode passed on no longer marks the account, as their built-ins never did, and Grok and MiMo no longer retry what their built-ins sent once. Messages take the built-ins' words. New tests fail against the previous index.mjs. 2026-10-01 04:47:03 +08:00
yetone 3d94a667f6 cursor 0.1.4: an error Cursor gives no words for is worded as magpie's built-in words it, Go's status text ("Payment Required", "Too Many Requests", "Unauthorized — sign in to Cursor again"), where it read "HTTP 402": a 402 now reads as the credit refusal it is to magpie's routing, as the built-in's did. Statuses were already the built-in's (resource_exhausted/quota/rate limit/usage limit 429 "usage limit reached: …", too long 400, invalid_argument 400, unavailable 503, permission_denied 403, other codes 502, pre-content stream errors answered with their status); errors.test.mjs checks them all 2026-10-01 03:43:39 +08:00
yetone befd071701 cursor 0.1.3: the card names the plan as cursor-agent about does (GetPlanInfo's planName, kept an hour); only a token or session run out is a 401, as magpie marks the account lapsed on one; errors no longer start with "Cursor: ", which magpie adds; a model list Cursor couldn't give fails instead of shrinking to the configured few 2026-10-01 02:52:43 +08:00
yetone c8f4d448df Parity with magpie's built-ins: a failed sign-in says why, CLI-backed Command Code and Devin accounts follow the CLI's key, Factory's refused renewal is a 401 in the caller's API shape
- every {type:"failed"} carries an error reason magpie shows
- commandcode/devin: accounts taken from the CLI are marked metadata.cli and re-read its credentials on each request, usage and models
- factory: a refused refresh answers 401 authentication_error (Anthropic shape on /llm/a/, OpenAI's elsewhere) instead of throwing; the whoami back-off is per account; 403 hints name the account to sign in again
- versions: factory/devin/commandcode/cursor/kiro/mimo/zed/zcode 0.1.2, workbuddy 0.1.3
2026-10-01 00:55:50 +08:00
yetone 0f61665ff8 cursor 0.1.1: usage shows as magpie's built-in did — plan, period, windows and what they count, balancecursor 2026-09-30 23:03:08 +08:00
yetone d7385c87c4 cursor: Cursor — cursor-agent's browser sign-in (PKCE poll), its existing sign-in or an API key; agent.v1 Run over HTTP/2 as magpie's gateway does it, with tool calls; tried with real requests. README lists every package so far 2026-09-30 17:17:06 +08:00