Skip to content

Commit 7ecb94a

Browse files
ralphstodomingoclaude
andcommitted
fix(workspace): refresh the CLI help snapshot; mark precedence server-side only
The new `--integrations` flag is longer than any existing root option, so yargs re-wraps the whole option table — the snapshot churn is realignment plus the one new row. Verified whitespace-normalised: the only new content is that flag's own description. Also record why this module must never be imported from a TUI plugin. Plugins load in a separate module realm in the same process, so such an import is a different instance sharing neither module state nor `globalThis`: it would typecheck, unit-test green, and return an empty precedence forever. Only the event bus crosses, which is why the inventory line is published as a TUI event rather than read directly. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RM9xasTNbk2k1eqhpF1Hp5
1 parent 8a3a7ab commit 7ecb94a

2 files changed

Lines changed: 377 additions & 263 deletions

File tree

packages/opencode/src/altimate/workspace/precedence.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
// 4. Redirect. A shadowed call returns a result naming the exact engine key. Nothing
2626
// executes and there is no fallback.
2727
//
28+
// SERVER-SIDE ONLY. The TUI plugin runtime loads plugins in a separate module realm
29+
// in the same process: an import from there is a different instance, sharing neither
30+
// module state nor `globalThis`. Importing this module from a plugin would typecheck,
31+
// unit-test green, and return an empty precedence forever — `bySession` would simply
32+
// be a different, always-empty map. Only the event bus crosses that boundary, which is
33+
// why the inventory line is published as a TUI event rather than read directly. Anything
34+
// on the TUI side that needs this state must cross the bus or re-derive it.
35+
//
2836
// Precedence is a pure function of the materialised set, so it is re-derived every
2937
// turn from the live MCP tool map (`refresh`) rather than cached at attach. That is
3038
// what keeps it correct when an engine's tool set changes under us — `MCP.tools()` is

0 commit comments

Comments
 (0)