Skip to content

Commit e47c2ee

Browse files
authored
fix(app): wire auto compaction to OpenCode (anomalyco#1180)
* fix(app): wire auto compaction to OpenCode * fix(app): unblock auto compaction toggle * refactor(app): unify reload required flow --------- Co-authored-by: src-opn <[email protected]>
1 parent 4e63d68 commit e47c2ee

14 files changed

Lines changed: 477 additions & 262 deletions

File tree

‎ARCHITECTURE.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,33 @@ Tauri or other native shell behavior remains the fallback or shell boundary for:
8585

8686
If an agent needs one of the server-owned behaviors above and only a Tauri path exists, treat that as an architecture gap to close rather than a parallel capability surface to preserve.
8787

88+
## Reload-required flow
89+
90+
OpenWork uses a single reload-required flow for changes that only take effect when OpenCode restarts.
91+
92+
Key pieces:
93+
94+
- `createSystemState()` owns the raw queued-reload state.
95+
- `reloadPending()` means a reload is currently queued for the active workspace.
96+
- `markReloadRequired(reason, trigger)` queues the reload and records the source that caused it.
97+
- `app.tsx` exposes `reloadRequired(...sources)` as a small helper for UI filtering. It is used to decide whether the shared reload popup should show for a given trigger type.
98+
99+
Use this flow when a change mutates startup-loaded OpenCode inputs, for example:
100+
101+
- `opencode.json`
102+
- `.opencode/skills/**`
103+
- `.opencode/agents/**`
104+
- `.opencode/commands/**`
105+
- MCP definitions or plugin lists that OpenCode only loads at startup
106+
107+
Do not invent a separate reload banner per feature. New UI that needs restart semantics should:
108+
109+
1. perform the config or filesystem mutation
110+
2. call `markReloadRequired(...)`
111+
3. rely on the shared reload popup to explain and execute the restart path
112+
113+
Current examples that should use this shared flow include MCP changes, auto context compaction, default model changes, authorized folder updates, plugin changes, and other `opencode.json` writes.
114+
88115
## opencode primitives
89116
how to pick the right extension abstraction for
90117
@opencode

0 commit comments

Comments
 (0)