opencode-beads 0.5.5 → 0.6.0
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 +1 -1
- package/package.json +1 -1
- package/src/plugin.ts +42 -0
- package/vendor/commands/audit.md +1 -1
- package/vendor/commands/import.md +8 -26
- package/vendor/commands/workflow.md +1 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/src/plugin.ts
CHANGED
|
@@ -14,6 +14,9 @@ import { BEADS_GUIDANCE, loadAgent, loadCommands } from "./vendor";
|
|
|
14
14
|
|
|
15
15
|
type OpencodeClient = PluginInput["client"];
|
|
16
16
|
|
|
17
|
+
/** Name of the plugin's own task agent. Always receives beads context. */
|
|
18
|
+
const BEADS_TASK_AGENT = "beads-task-agent";
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Get the current model/agent context for a session by querying messages.
|
|
19
22
|
*
|
|
@@ -94,6 +97,34 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
94
97
|
|
|
95
98
|
const injectedSessions = new Set<string>();
|
|
96
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Check if an agent should receive beads context injection.
|
|
102
|
+
*
|
|
103
|
+
* Queries the agent list from OpenCode and checks whether the agent is a
|
|
104
|
+
* subagent. Subagents (like `explore` and `general`) are invoked for
|
|
105
|
+
* specific tasks and shouldn't be polluted with beads context — it wastes
|
|
106
|
+
* tokens and can cause them to attempt pointless bd/git operations.
|
|
107
|
+
*
|
|
108
|
+
* Primary agents (`build`, `plan`) are user-facing and benefit from issue
|
|
109
|
+
* awareness. The plugin's own `beads-task-agent` is an explicit exception.
|
|
110
|
+
*
|
|
111
|
+
* Queries fresh each time rather than caching, since agents can change
|
|
112
|
+
* mid-session (config edits, other plugins). This only runs once per
|
|
113
|
+
* session (gated by injectedSessions), so the overhead is negligible.
|
|
114
|
+
*/
|
|
115
|
+
async function shouldInject(agentName: string | undefined): Promise<boolean> {
|
|
116
|
+
if (!agentName || agentName === BEADS_TASK_AGENT) return true;
|
|
117
|
+
|
|
118
|
+
const response = await client.app.agents().catch(() => undefined);
|
|
119
|
+
const agent = response?.data?.find((a) => a.name === agentName);
|
|
120
|
+
if (agent) {
|
|
121
|
+
return agent.mode === "primary" || agent.mode === "all";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Query failed or agent not in the list — inject as safe fallback
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
97
128
|
return {
|
|
98
129
|
"chat.message": async (_input, output) => {
|
|
99
130
|
const sessionID = output.message.sessionID;
|
|
@@ -101,6 +132,13 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
101
132
|
// Skip if already injected this session
|
|
102
133
|
if (injectedSessions.has(sessionID)) return;
|
|
103
134
|
|
|
135
|
+
// Skip subagents — they're invoked for specific tasks and shouldn't
|
|
136
|
+
// waste tokens on beads context (except our own beads-task-agent)
|
|
137
|
+
if (!(await shouldInject(output.message.agent))) {
|
|
138
|
+
injectedSessions.add(sessionID);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
104
142
|
// Check if beads-context was already injected (handles plugin reload/reconnection)
|
|
105
143
|
try {
|
|
106
144
|
const existing = await client.session.messages({
|
|
@@ -140,6 +178,10 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
140
178
|
if (event.type === "session.compacted") {
|
|
141
179
|
const sessionID = event.properties.sessionID;
|
|
142
180
|
const context = await getSessionContext(client, sessionID);
|
|
181
|
+
|
|
182
|
+
// Skip re-injection for subagents
|
|
183
|
+
if (!(await shouldInject(context?.agent))) return;
|
|
184
|
+
|
|
143
185
|
await injectBeadsContext(client, $, sessionID, context);
|
|
144
186
|
}
|
|
145
187
|
},
|
package/vendor/commands/audit.md
CHANGED
|
@@ -23,6 +23,6 @@ Each line is one event. Labeling is done by appending a new `"label"` event refe
|
|
|
23
23
|
## Notes
|
|
24
24
|
|
|
25
25
|
- Audit entries are **append-only** (no in-place edits).
|
|
26
|
-
- `bd
|
|
26
|
+
- `bd dolt push` includes `.beads/interactions.jsonl` in the commit allowlist.
|
|
27
27
|
|
|
28
28
|
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Import issues from JSONL format
|
|
3
|
-
argument-hint:
|
|
2
|
+
description: Import issues from JSONL format (removed)
|
|
3
|
+
argument-hint: (removed)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`bd import` has been **removed**.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Migration
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- **From file**: `bd import -i issues.jsonl`
|
|
12
|
-
- **Preview**: `bd import -i issues.jsonl --dry-run`
|
|
13
|
-
|
|
14
|
-
## Behavior
|
|
15
|
-
|
|
16
|
-
- **Existing issues** (same ID): Updated with new data
|
|
17
|
-
- **New issues**: Created
|
|
18
|
-
- **Same-ID scenarios**: With hash-based IDs (v0.20.1+), same ID = same issue being updated (not a collision)
|
|
19
|
-
|
|
20
|
-
## Preview Changes
|
|
21
|
-
|
|
22
|
-
Use `--dry-run` to see what will change before importing:
|
|
10
|
+
If you need to import issues from a JSONL file, use `bd init` with the `--from-jsonl` flag:
|
|
23
11
|
|
|
24
12
|
```bash
|
|
25
|
-
bd
|
|
26
|
-
# Shows: new issues, updates, exact matches
|
|
13
|
+
bd init <prefix> --from-jsonl issues.jsonl
|
|
27
14
|
```
|
|
28
15
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
Dolt is the primary storage backend, so manual import is rarely needed. Use `bd import` when you need to load data from an external JSONL file or migrate from a legacy JSONL-based setup.
|
|
32
|
-
|
|
33
|
-
## Options
|
|
16
|
+
## Note
|
|
34
17
|
|
|
35
|
-
|
|
36
|
-
- **--strict**: Fail on dependency errors instead of warnings
|
|
18
|
+
Dolt is the primary storage backend. Manual JSONL import is no longer supported as a standalone command.
|
|
@@ -39,7 +39,7 @@ After closing, check if other work became ready:
|
|
|
39
39
|
- **Priority levels**: 0=critical, 1=high, 2=medium, 3=low, 4=backlog
|
|
40
40
|
- **Issue types**: bug, feature, task, epic, chore
|
|
41
41
|
- **Dependencies**: Use `blocks` for hard dependencies, `related` for soft links
|
|
42
|
-
- **Auto-sync**: Changes are stored in Dolt and synced via `bd
|
|
42
|
+
- **Auto-sync**: Changes are stored in Dolt and synced via `bd dolt push` / `bd dolt pull`
|
|
43
43
|
|
|
44
44
|
## Available Commands
|
|
45
45
|
- `/beads:ready` - Find unblocked work
|