Devin's prompt cache lasts 5 minutes and has no longer TTL to ask for. A switch, "Keep the cache warm" (cache_keepalive, off by default, with zh, zh-TW, ja and de labels), keeps it as the CLI's cache_keepalive.rs does: after a reply that read or wrote the cache, whatever it stopped for, the same GetChatMessage goes again every 285 s with one more user prompt, "continue", and max_tokens 1. The request's bytes are encoded once, and the ping is them with that prompt and field 8's max_tokens. - A conversation is session + Claude Code agent id (when the headers reach the plugin) + a hash of the instructions, tool names and first user message; its next real request stops its pings, so a subagent never stops its lead's. - Stops on 401, 402, 429, two pings in a row reading under half their prompt from the cache, the most pings (6), the switch going off, and process exit. Timers are unref'd. At most 32 conversations are kept. - Options cacheKeepaliveInterval (30-299 s) and cacheKeepaliveMaxPings (1-50); OpenCode, which has no switch, takes cacheKeepalive: true. - README says the cost (each ping is a cache read of the whole context, spent whether the user comes back or not) and why it is off. Run (mote, HOME=$(mktemp -d)): - bun test packages/devin: 170 pass, 0 fail (14 new in keepalive.test.mjs). - Whole repo bun test: 4520 pass, 9 skip, 1 fail: gcp-ai's "a lock held by another process is waited for, then taken" (ENOENT in abandoned()'s stat, a race in lib/lock.mjs; passes 3 of 3 alone), filed as #594. - bun scripts/check.mjs: ok. - The new tests against the old index.mjs: 14 of 14 fail. Broken by hand, each red in the test named for it: no cancel on the next request, no agent id in the key, no prefix hash, no stop on 401/402/429, no miss count, no cap, no unref, max_tokens kept, pings after a reply that touched no cache. Real account (the owner's Devin sign-in read, nothing written, sandbox HOME, this Mac): claude-sonnet-5-5-low, an 11k-token prompt wrote 10,984 to the cache; one ping 287 s later read 10,984 from it (cacheWrite 3, output 1) and, at max 1, stopped. Not tried: more than one ping or a long Claude Code session; the OpenCode 2 (v2) path, which has no keepalive. magpie doesn't pass x-claude-code-session-id / x-claude-code-agent-id to a plugin's fetch, so under magpie the key rests on the prefix hash (a lead and a subagent differ there; two sessions with the same prefix share one keepalive).
13 lines
504 B
JSON
13 lines
504 B
JSON
{
|
|
"name": "@magpie-community/opencode-devin-auth",
|
|
"version": "0.1.30",
|
|
"description": "Devin subscriptions (the devin CLI's account) in OpenCode and magpie",
|
|
"type": "module",
|
|
"main": "./index.mjs",
|
|
"exports": "./index.mjs",
|
|
"files": ["index.mjs", "README.md"],
|
|
"keywords": ["opencode", "opencode-plugin", "magpie", "devin", "windsurf"],
|
|
"license": "MIT",
|
|
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/devin" }
|
|
}
|