Files
plugins/packages/factory/package.json
T
yetone 0437abbe30 factory 0.1.22: Claude Code's restored-context turn after /compact reaches Factory adapted (#68, Vigilans)
After /compact, Claude Code 2.1.280 sends the files it restores and the
session's runtime context as one system text block with no reminder
wrappers and no opening token marker: restored-file notes ("Note: <path> was
read before the last conversation was summarized…"), "Called the Read tool
with the following input: {…}" and its result, "# Environment\nYou have been
invoked in the following environment:", the model line, token and date.
The reporter's bisect shows Factory 403s on each of those fixed fragments,
and 0.1.21 matched none of them: SYSTEM_ENV_CONTEXT is anchored at the
block's start, COMPACT_READ / COMPACT_FILE need a standalone wrapped
reminder, and the token-prefixed bundle path needs a leading token marker.

restoredContext recognizes the complete turn: its first paragraph is a
generated restored-file note or Read call (as COMPACT_FILE / COMPACT_READ
would match it wrapped), and a later paragraph, before any hook output, is
the generated environment paragraph or a token marker. Then
announcedContext adapts every paragraph from the first on, with the
existing compat spellings (Previously read file…, # Runtime context / The
session environment is:, Current model name / Model ID / Model knowledge
cutoff) and the lossless JSON encoding of Read results; everything else
stays byte-for-byte. It runs for system-role strings and text blocks and
for the same block folded into user text. An adapted turn no longer opens
with the generated note, so a second pass is byte-for-byte.

Quoted, incomplete (no environment or token), hook-owned and assistant
forms are left untouched.

Run: bun test (packages/factory: 116 pass; repo: 1010 pass, 0 fail),
bun scripts/check.mjs (all pass). The two new tests use the issue's literal
fragments (several notes, Read call + result, environment, model line with
claude-opus-5-5[1m], token, date); the adapting one fails on 0.1.21's
index.mjs, and removing the env/token requirement, the hook guard, the
user-text path or starting at paragraph 1 each turns a test red. PR #66
applied on top passes too (119 factory tests). Stubbed fetch only; no
request was sent to Factory (no Factory account here).
2026-10-10 03:37:05 +08:00

12 lines
499 B
JSON

{
"name": "@magpie-community/opencode-factory-auth",
"version": "0.1.22",
"description": "Sign in to a Factory (Droid) subscription from OpenCode or magpie",
"type": "module",
"main": "./index.mjs",
"files": ["index.mjs", "anthropic-tools.mjs", "README.md"],
"keywords": ["opencode", "opencode-plugin", "magpie", "factory", "droid"],
"license": "MIT",
"repository": { "type": "git", "url": "git+https://github.com/magpie-community/plugins.git", "directory": "packages/factory" }
}