@prevalentware/opencode-goal-plugin 0.1.14 → 0.1.16
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 +25 -2
- package/package.json +10 -2
- package/src/tui.tsx +9 -3
package/README.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
# OpenCode Goal Plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@prevalentware/opencode-goal-plugin)
|
|
4
|
+
[](https://github.com/prevalentWare/opencode-goal-plugin)
|
|
5
|
+
[](LICENSE)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
OpenCode Goal Plugin adds Codex-style long-running goal mode to OpenCode. It gives AI coding agents a `/goal` slash command, persistent goal state, completion evidence, idle continuation, and a terminal UI goal indicator so an OpenCode session can keep working toward one explicit objective until it is complete, blocked, or cleared.
|
|
8
|
+
|
|
9
|
+
If you are searching for an OpenCode goal plugin, goal mode for OpenCode, or a way to keep an OpenCode AI coding agent focused on a long-running task, this package is the npm plugin for that workflow.
|
|
10
|
+
|
|
11
|
+
Links:
|
|
12
|
+
|
|
13
|
+
- npm package: [`@prevalentware/opencode-goal-plugin`](https://www.npmjs.com/package/@prevalentware/opencode-goal-plugin)
|
|
14
|
+
- GitHub repository: [`prevalentWare/opencode-goal-plugin`](https://github.com/prevalentWare/opencode-goal-plugin)
|
|
15
|
+
- OpenCode plugin command: `opencode plugin @prevalentware/opencode-goal-plugin`
|
|
16
|
+
|
|
17
|
+
The OpenCode Goal Plugin adds:
|
|
6
18
|
|
|
7
19
|
- `/goal <objective>` as an OpenCode command for TUI, desktop, and web.
|
|
8
20
|
- A sidebar goal indicator with status, elapsed time, and objective.
|
|
@@ -12,6 +24,17 @@ This plugin adds:
|
|
|
12
24
|
- Optional automatic continuation on `session.idle`.
|
|
13
25
|
- Compaction context so active goals are preserved when OpenCode summarizes a long session.
|
|
14
26
|
|
|
27
|
+
## Why Use This OpenCode Goal Plugin?
|
|
28
|
+
|
|
29
|
+
Use this plugin when you want OpenCode to behave more like a goal-driven coding agent instead of a one-prompt assistant. A goal stays visible, survives session compaction, can continue automatically when the session becomes idle, and can only be closed with explicit evidence or a concrete blocker.
|
|
30
|
+
|
|
31
|
+
Common use cases:
|
|
32
|
+
|
|
33
|
+
- Keep an OpenCode agent focused during long refactors, migrations, reviews, or test-fixing sessions.
|
|
34
|
+
- Track one explicit objective across TUI, desktop, and web OpenCode surfaces.
|
|
35
|
+
- Require completion evidence before a goal is marked done.
|
|
36
|
+
- Preserve the current goal when OpenCode summarizes or compacts a long conversation.
|
|
37
|
+
|
|
15
38
|
## Install
|
|
16
39
|
|
|
17
40
|
Install locally for the current OpenCode project:
|
package/package.json
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prevalentware/opencode-goal-plugin",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Codex-style long-running goal mode for
|
|
3
|
+
"version": "0.1.16",
|
|
4
|
+
"description": "OpenCode goal plugin that adds Codex-style long-running goal mode, /goal commands, persistence, and TUI status for AI coding agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
7
7
|
"opencode-plugin",
|
|
8
|
+
"opencode goal plugin",
|
|
9
|
+
"opencode goal mode",
|
|
10
|
+
"opencode ai",
|
|
8
11
|
"goal",
|
|
12
|
+
"goal-mode",
|
|
13
|
+
"slash-command",
|
|
14
|
+
"coding-agent",
|
|
15
|
+
"ai-agent",
|
|
16
|
+
"developer-tools",
|
|
9
17
|
"agent",
|
|
10
18
|
"tui"
|
|
11
19
|
],
|
package/src/tui.tsx
CHANGED
|
@@ -37,6 +37,8 @@ type GoalSessionState = {
|
|
|
37
37
|
messageIndex: number
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
const goalCache = new Map<string, GoalSnapshot>()
|
|
41
|
+
|
|
40
42
|
function currentSessionID(api: TuiPluginApi) {
|
|
41
43
|
const route = api.route.current
|
|
42
44
|
if (route.name !== "session") return undefined
|
|
@@ -175,7 +177,7 @@ function parseGoalToolOutput(part: GoalToolPart): GoalSnapshot | null | undefine
|
|
|
175
177
|
}
|
|
176
178
|
}
|
|
177
179
|
|
|
178
|
-
function goalStateFromSession(api: TuiPluginApi, sessionID: string): GoalSessionState {
|
|
180
|
+
export function goalStateFromSession(api: TuiPluginApi, sessionID: string): GoalSessionState {
|
|
179
181
|
const messages = [...api.state.session.messages(sessionID)] as SessionMessage[]
|
|
180
182
|
for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex -= 1) {
|
|
181
183
|
const message = messages[messageIndex]
|
|
@@ -183,10 +185,14 @@ function goalStateFromSession(api: TuiPluginApi, sessionID: string): GoalSession
|
|
|
183
185
|
const parts = [...api.state.part(message.id)].reverse() as GoalToolPart[]
|
|
184
186
|
for (const part of parts) {
|
|
185
187
|
const goal = parseGoalToolOutput(part)
|
|
186
|
-
if (goal !== undefined)
|
|
188
|
+
if (goal !== undefined) {
|
|
189
|
+
if (goal) goalCache.set(sessionID, goal)
|
|
190
|
+
else goalCache.delete(sessionID)
|
|
191
|
+
return { goal, messageIndex }
|
|
192
|
+
}
|
|
187
193
|
}
|
|
188
194
|
}
|
|
189
|
-
return { goal: null, messageIndex: -1 }
|
|
195
|
+
return { goal: goalCache.get(sessionID) ?? null, messageIndex: -1 }
|
|
190
196
|
}
|
|
191
197
|
|
|
192
198
|
function goalFromSession(api: TuiPluginApi, sessionID: string) {
|