Files
plugins/packages/zed/package.json
T
yetone 3920b745d9 zed 0.1.18: name each request's thread and prompt, as Zed's editor does (#731)
Zed's editor sends CompletionBody with thread_id (the agent thread's id,
a UUID made once per thread) and prompt_id (a new UUID per message the
user sends, kept through the tool calls answering it): zed
crates/cloud_llm_client/src/cloud_llm_client.rs CompletionBody,
crates/language_models_cloud (the Google path sends both),
crates/agent/src/thread.rs advance_prompt_id. The plugin, and the
retired built-in before it, sent neither, so to Zed's cloud every
request was a thread of its own. Yezike-yyy's Gemini 4 Argon
conversation read cache_read 0 on 11 requests of 180k-230k input tokens,
where Zed's docs say Argon bills implicit cache hits.

- a chat.headers hook names a Zed request's session in
  x-magpie-zed-session; the loader's fetch now keeps a Request's
  headers, and complete() reads the header and sends it no further.
- thread_id is a UUID hashed (per-process salt) from the account and the
  session, else the first user message; prompt_id from the thread and
  the count of user messages with text (tool results don't count), on
  all four APIs (Messages, Responses, chat completions, Gemini).
- usage mapping was checked and is right: magpie reads Gemini's
  cachedContentTokenCount through the plugin's passthrough.

Run (mote, bun 1.4.2): packages/zed `bun test` 78 pass 0 fail;
`bun run check` at the repo root, exit 0.
Broken by hand: the new thread-id.test.mjs against the old index.mjs,
7 of 7 red; the loader dropping a Request's headers, its test red;
tool-result turns counted as prompts, the Gemini test red.
Not tried: no Zed account, so no real request; whether Zed's cloud uses
thread_id or prompt_id for Gemini's implicit cache is not known (its
server is closed source). The reporter is asked to retest.
2026-11-05 00:52:08 +08:00

13 lines
556 B
JSON

{
"name": "@magpie-community/opencode-zed-auth",
"version": "0.1.18",
"description": "Sign in to a Zed subscription (Zed Pro, trial, student, business) from OpenCode or magpie",
"type": "module",
"main": "./opencode.mjs",
"exports": { ".": "./opencode2.mjs" },
"files": ["index.mjs", "opencode.mjs", "opencode2.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "zed"],
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/zed" }
}