fix(plugin): bound all session.messages() calls with limit:50
The legacy OpenCode session messages endpoint hydrates the ENTIRE session into memory when no query.limit is provided. On huge sessions (10k+ messages) — exactly when Magic Context's compaction shines — this defeats the plugin's purpose by loading all persisted messages into RAM just to extract the latest assistant text from a helper subagent. All 9 production callsites only need: - The latest assistant message from a helper subagent (historian, compressor, dreamer, sidekick, key-files, user-memory) — 1 user prompt + a few assistant steps typically <10 messages. - Recent tail of the main session for conflict-warning cleanup — scanned backwards from the end, breaks on first non-warning user. Both fit comfortably in limit:50 with massive headroom. Pi-side uses sessionManager.getBranch() directly and has zero session.messages() calls — no Pi change needed. Added session-messages-bounded.test.ts as a static source-scan regression guard so future callsites without `limit` are caught at test time with a clear error message pointing at the offending file. Reported by the OpenCode agent during cross-team session.messages audit. Verified plugin 1428 tests, Pi+CLI 371 tests, typecheck clean.
U
ualtinok committed
e279aaf9ce05290e4a158f285930723bab379302
Parent: bd96a2d