@prevalentware/opencode-goal-plugin 0.1.48 → 0.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -83,7 +83,7 @@ For manual installation, add the package to both V1 config files.
83
83
 
84
84
  ### OpenCode 2 Beta
85
85
 
86
- Use this section only when running `opencode2`. Plugin release `0.1.30` and newer supports OpenCode 2 preview `0.0.0-next-17055` while remaining compatible with OpenCode 1.
86
+ Use this section only when running `opencode2`. Plugin releases from the `feat/v2-adaptation` line support OpenCode 2 beta `0.0.0-beta-19425` (the current `@opencode/cli@beta` / `@opencode/plugin@beta` contract) while remaining compatible with OpenCode 1.
87
87
 
88
88
  Add the package to both V2 plugin lists:
89
89
 
@@ -105,7 +105,7 @@ Add the package to both V2 plugin lists:
105
105
 
106
106
  OpenCode 2 does not read the V1 `tui.json` file. The server entrypoint comes from `opencode.json`, while the sidebar and palette integration come from `~/.config/opencode/cli.json`.
107
107
 
108
- OpenCode 2 plugin APIs are still beta. This package pins its V2 development contract to the preview version above; later previews may require a compatible plugin update. V2 currently supports the goal command, tools, persistent state, usage accounting, idle continuation, Plan-mode safety, and TUI sidebar/palette integration. Goal-specific compaction context and recovery of already-running child sessions after a plugin restart remain V1-only because the current V2 plugin context does not expose equivalent hooks or history queries.
108
+ OpenCode 2 plugin APIs are still beta. This package pins its V2 development contract to the beta version above; later previews may require a compatible plugin update. V2 currently supports the goal command, tools, persistent state, usage accounting, idle continuation, Plan-mode safety, TUI sidebar/palette integration, goal compaction context, and transcript-based task recovery. Goal compaction context is injected through the V2 `session.compaction` hook on hosts that provide it (newer than beta-19425); on older betas the registration degrades to a no-op. After a plugin or server restart, V2 rebuilds Task-subagent deferral state by replaying each non-closed goal session's persisted transcript, because the V2 plugin context exposes no live child-session query; children that leave no finalized tool entry in the transcript are only observed through live events.
109
109
 
110
110
  ## Options
111
111
 
@@ -124,6 +124,7 @@ In OpenCode 1, server options use the package-and-options tuple in `opencode.jso
124
124
  "max_turn_time": 300,
125
125
  "max_task_block_seconds": 900,
126
126
  "max_prompt_failures": 3,
127
+ "locale": "zh-CN",
127
128
  "default_token_budget": 200000,
128
129
  "max_goal_duration_seconds": 1800,
129
130
  "no_progress_token_threshold": 50,
@@ -147,6 +148,7 @@ In OpenCode 2, use the plugin object form instead:
147
148
  "options": {
148
149
  "auto_continue": true,
149
150
  "max_auto_turns": 25,
151
+ "locale": "zh-CN",
150
152
  "default_token_budget": 200000,
151
153
  "restricted_agents": ["plan"]
152
154
  }
@@ -155,6 +157,22 @@ In OpenCode 2, use the plugin object form instead:
155
157
  }
156
158
  ```
157
159
 
160
+ For OpenCode 1, server and TUI plugins are configured separately. To force the TUI to the same locale, use the same
161
+ option in `tui.json`:
162
+
163
+ ```json
164
+ {
165
+ "plugin": [
166
+ [
167
+ "@prevalentware/opencode-goal-plugin",
168
+ {
169
+ "locale": "zh-CN"
170
+ }
171
+ ]
172
+ ]
173
+ }
174
+ ```
175
+
158
176
  Defaults:
159
177
 
160
178
  - `auto_continue`: `true`
@@ -169,6 +187,8 @@ Defaults:
169
187
  - `max_goal_duration_seconds`: unset by default; when set, new goals inherit this elapsed-time safety limit.
170
188
  - `no_progress_token_threshold`: `50`; output-token floor used to judge whether a goal continuation turn made progress.
171
189
  - `max_no_progress_turns`: `2`; consecutive low-progress goal continuation turns before pausing. Only turns produced by a reserved goal continuation count — ordinary low-output assistant messages (for example short tool-call-only turns from PTY or status checks) never increment this counter.
190
+ - `locale`: `"en"` by default. Set `"zh-CN"` for Simplified Chinese, or `"auto"` to detect `LC_ALL`, then `LANG`, then
191
+ the OS/JavaScript runtime locale. Unsupported explicit locales fall back to English.
172
192
  - `register_command`: `true`; registers `/goal`, `/pause_goal`, and `/resume_goal`.
173
193
  - `command_name`: `"goal"`; renames the main goal command only. The reserved names `pause_goal` and `resume_goal` fall back to `goal` so the standalone controls remain available.
174
194
  - `restricted_agents`: `["plan"]`; agents (matched case-insensitively) treated as planning-only for goal execution.
@@ -293,6 +313,6 @@ OpenCode plugin modules are target-specific. This package exports separate modul
293
313
  }
294
314
  ```
295
315
 
296
- Codex goal mode has deeper runtime integration for thread lifecycle control. This plugin implements the same workflow using OpenCode plugin hooks. Token usage is read from OpenCode step-finish usage when available and falls back to message token metadata or text estimation when exact usage is unavailable. Continuation is driven by V2 `session.execution.succeeded` events and legacy `session.idle` / `session.status` idle notifications, never by intermediate model-step completion. V2 execution starts arm busy tracking; native `session.retry.scheduled` events cancel plugin recovery while OpenCode retries. Terminal execution transport failures use bounded recovery, while interruptions (user, shutdown, or superseded) cancel local timers without starting another turn or charging a prompt failure. Interrupted or non-transport-failed executions remain suppressed until the host starts a new execution; this does not change the persisted goal status. Use `/pause_goal` for a durable pause. Each V2 plugin instance handles goal events only for its own location while still observing cross-location child task lifecycles. The optional `max_turn_time` watchdog can retry one goal continuation prompt when a model turn remains busy, without consuming the goal's auto-turn or no-progress budgets; recognized transport failures do count toward the prompt-failure ceiling. By default, continuation is deferred while OpenCode Task child sessions are active or their terminal result still needs an orchestrator turn, bounded by the `max_task_block_seconds` ceiling so an unobservable child cannot stall a goal indefinitely. During compaction, the plugin disables OpenCode's generic synthetic auto-continue while an active goal exists so the goal-specific continuation prompt remains authoritative.
316
+ Codex goal mode has deeper runtime integration for thread lifecycle control. This plugin implements the same workflow using OpenCode plugin hooks. Token usage is read from OpenCode step-finish usage when available and falls back to message token metadata or text estimation when exact usage is unavailable. Continuation is driven by V2 `session.execution.succeeded` events and legacy `session.idle` / `session.status` idle notifications, never by intermediate model-step completion. V2 execution starts arm busy tracking; native `session.retry.scheduled` events cancel plugin recovery while OpenCode retries. Terminal execution transport failures use bounded recovery, while interruptions (user, shutdown, or superseded) cancel local timers without starting another turn or charging a prompt failure. Interrupted or non-transport-failed executions remain suppressed until the host starts a new execution; this does not change the persisted goal status. Use `/pause_goal` for a durable pause. Each V2 plugin instance handles goal events only for its own location while still observing cross-location child task lifecycles. The optional `max_turn_time` watchdog can retry one goal continuation prompt when a model turn remains busy, without consuming the goal's auto-turn or no-progress budgets; recognized transport failures do count toward the prompt-failure ceiling. By default, continuation is deferred while OpenCode Task child sessions are active or their terminal result still needs an orchestrator turn, bounded by the `max_task_block_seconds` ceiling so an unobservable child cannot stall a goal indefinitely. During compaction on OpenCode 1, the plugin disables OpenCode's generic synthetic auto-continue while an active goal exists so the goal-specific continuation prompt remains authoritative; on OpenCode 2, compaction runs inside the session's execution flow, so the plugin instead injects the goal snapshot through the `session.compaction` hook where the host provides it.
297
317
 
298
318
  The goal sidebar shows the current status, elapsed time, token usage, auto-continue count, latest checkpoint, latest status message, stop reason, and objective when a goal is active, paused, or safety-limited. Closed goals remain visible briefly through the latest tool state as achieved or unmet.