@openspoon/subtask2 0.1.16 → 0.2.1
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 +179 -96
- package/dist/commands.d.ts +7 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +66 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +43 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +195 -173
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +18 -0
- package/dist/logger.js.map +1 -0
- package/dist/parser.d.ts +6 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +50 -0
- package/dist/parser.js.map +1 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,121 +1,89 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# A stronger opencode /command handler
|
|
2
4
|
|
|
3
|
-
### TL:DR -
|
|
5
|
+
### TL:DR - More agency, control and capabilities for commands
|
|
6
|
+
|
|
7
|
+
This plugin affects how opencode handles slash commands with additional frontmatter parameters and enables parallel command execution as well as chaining. It's simple to use and designed to allow better orchestration, steerability and longevity of the agentic loop. Compose as simple or complex a workflow as you want. If you already know how opencode commands work, you'll be right at home.
|
|
8
|
+
|
|
9
|
+
### Key features
|
|
4
10
|
|
|
5
|
-
|
|
11
|
+
- `return` instruct the main session on **command/subtask(s)** results - \_can be chained, supports /commands
|
|
12
|
+
- `parallel` run subtasks concurrently - _only parent's `return` applies when all are done_
|
|
13
|
+
- `command` extra command to run alongside the main one - _forced into a subtask_
|
|
14
|
+
- `arguments` pass arguments with command frontmatter or `||` message pipe
|
|
6
15
|
|
|
7
|
-
|
|
8
|
-
- `parallel` run multiple subtasks concurrently (accepts arguments)
|
|
16
|
+
#### ⚠️ Pending PR
|
|
9
17
|
|
|
10
|
-
|
|
18
|
+
Requires [this PR](https://github.com/sst/opencode/pull/6478) for `parallel` and `subtask:false` command features, as well as proper model inheritance (piping the right model and agent to the right subtask and back) to work.
|
|
11
19
|
|
|
12
20
|
---
|
|
13
21
|
|
|
14
22
|
<details>
|
|
15
|
-
<summary><strong>
|
|
23
|
+
<summary><strong>Feature documentation</strong> (click to expand)</summary>
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
### 1. `return` - Command return instructions or the old 'look again' trick
|
|
26
|
+
|
|
27
|
+
Tell the main agent exactly what to do after a command completes, supports chaining and triggering other commands.
|
|
18
28
|
|
|
19
29
|
```yaml
|
|
20
30
|
---
|
|
21
|
-
description: multi-model ensemble, 3 models plan in parallel, best ideas unified
|
|
22
|
-
model: github-copilot/claude-opus-4.5
|
|
23
31
|
subtask: true
|
|
24
|
-
|
|
25
|
-
return:
|
|
26
|
-
- Compare all 3 plans and validate each directly against the codebase. Pick the best ideas from each and create a unified implementation plan.
|
|
27
|
-
- Feed the implementation plan to a review subagent, let's poke holes.
|
|
32
|
+
return: Look again, challenge the findings, then implement the valid fixes.
|
|
28
33
|
---
|
|
29
|
-
|
|
30
|
-
> $ARGUMENTS
|
|
34
|
+
Review the PR# $ARGUMENTS for bugs.
|
|
31
35
|
```
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
For multiple sequential prompts, use an array:
|
|
34
38
|
|
|
35
39
|
```yaml
|
|
36
40
|
---
|
|
37
|
-
description: two-step implementation planning and validation
|
|
38
|
-
agent: build
|
|
39
41
|
subtask: true
|
|
40
42
|
return:
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
+
- Implement the fix
|
|
44
|
+
- Run the tests
|
|
43
45
|
---
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
You MUST consider alternative paths and keep researching until you are confident you found the BEST possible implementation
|
|
47
|
-
|
|
48
|
-
BEST often means simple, lean, clean, low surface and coupling
|
|
49
|
-
Make it practical, maintainable and not overly abstracted
|
|
50
|
-
|
|
51
|
-
Follow your heart
|
|
52
|
-
> DO NOT OVERENGINEER SHIT
|
|
53
|
-
|
|
54
|
-
USER INPUT
|
|
55
|
-
$ARGUMENTS
|
|
46
|
+
Find the bug in auth.ts
|
|
56
47
|
```
|
|
57
48
|
|
|
58
|
-
**
|
|
49
|
+
**Trigger commands in return** using `/command args` syntax:
|
|
59
50
|
|
|
60
51
|
```yaml
|
|
61
52
|
---
|
|
62
|
-
description: design, implement, test, document
|
|
63
|
-
agent: build
|
|
64
|
-
model: github-copilot/claude-opus-4.5
|
|
65
53
|
subtask: true
|
|
66
54
|
return:
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
- Run the test suite and fix any failures.
|
|
55
|
+
- /validate-plan the output above
|
|
56
|
+
- /implement-plan
|
|
57
|
+
- Run the tests and fix any failures
|
|
71
58
|
---
|
|
72
|
-
|
|
73
|
-
> $ARGUMENTS
|
|
59
|
+
Design the auth system for $ARGUMENTS
|
|
74
60
|
```
|
|
75
61
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<summary><strong>Feature documentation</strong> (click to expand)</summary>
|
|
62
|
+
- **First** `return` replaces (cf 3. Subtask `return` fallback) opencode's "summarize" message (for `subtask: true`) or fires as follow-up (for non-subtasks)
|
|
63
|
+
- **Any additional** `return` fire sequentially after each LLM turn completes
|
|
64
|
+
- **Commands** (starting with `/`) are executed as full commands with their own `parallel` and `return`
|
|
80
65
|
|
|
81
|
-
###
|
|
66
|
+
### 2. `parallel` - Run multiple subtasks concurrently ⚠️ **PENDING PR** (ignored for now)
|
|
82
67
|
|
|
83
|
-
|
|
68
|
+
Spawn additional command subtasks alongside the main one:
|
|
84
69
|
|
|
85
70
|
```yaml
|
|
86
71
|
---
|
|
87
72
|
subtask: true
|
|
88
|
-
|
|
73
|
+
parallel:
|
|
74
|
+
- /security-review
|
|
75
|
+
- /perf-review
|
|
76
|
+
return:
|
|
77
|
+
- Synthesize all review results and create a unified action plan
|
|
78
|
+
- Critically review the plan directly against the codebase, then revise or implement
|
|
89
79
|
---
|
|
90
|
-
Review
|
|
80
|
+
Review this code for correctness.
|
|
91
81
|
```
|
|
92
82
|
|
|
93
|
-
|
|
83
|
+
You can also use `/command args` syntax for inline arguments:
|
|
94
84
|
|
|
95
85
|
```yaml
|
|
96
|
-
|
|
97
|
-
subtask: true
|
|
98
|
-
return: [Implement the fix, Run the tests]
|
|
99
|
-
---
|
|
100
|
-
Find the bug in auth.ts
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
- **First return** replaces opencode's "summarize" message (for subtasks) or fires as follow-up (for non-subtasks)
|
|
104
|
-
- **Additional returns** fire sequentially after each LLM turn completes
|
|
105
|
-
|
|
106
|
-
**Note:** For non-subtask commands, requires opencode with `command.execute.before` hook (pending PR).
|
|
107
|
-
|
|
108
|
-
### 2. `parallel` - Run multiple subtasks concurrently ⚠️ **PENDING PR** (ignored for now)
|
|
109
|
-
|
|
110
|
-
Spawn additional command subtasks alongside the main one:
|
|
111
|
-
|
|
112
|
-
```yaml
|
|
113
|
-
---
|
|
114
|
-
subtask: true
|
|
115
|
-
parallel: security-review, perf-review
|
|
116
|
-
return: Synthesize all review results and create a unified action plan.
|
|
117
|
-
---
|
|
118
|
-
Review this code for correctness.
|
|
86
|
+
parallel: /security-review focus on auth, /perf-review check db queries
|
|
119
87
|
```
|
|
120
88
|
|
|
121
89
|
This runs 3 subtasks in parallel:
|
|
@@ -124,9 +92,9 @@ This runs 3 subtasks in parallel:
|
|
|
124
92
|
2. `security-review` command
|
|
125
93
|
3. `perf-review` command
|
|
126
94
|
|
|
127
|
-
When ALL complete, the main
|
|
95
|
+
When ALL complete, the main session gets the `return` prompt.
|
|
128
96
|
|
|
129
|
-
|
|
97
|
+
### With custom arguments per command
|
|
130
98
|
|
|
131
99
|
```bash
|
|
132
100
|
/mycommand main args || parallel1 args || parallel2 args
|
|
@@ -142,7 +110,7 @@ parallel:
|
|
|
142
110
|
arguments: authentication flow
|
|
143
111
|
- command: research-codebase
|
|
144
112
|
arguments: auth middleware implementation
|
|
145
|
-
- security-audit
|
|
113
|
+
- /security-audit
|
|
146
114
|
return: Synthesize all findings into an implementation plan.
|
|
147
115
|
---
|
|
148
116
|
Design a new auth system for $ARGUMENTS
|
|
@@ -152,48 +120,159 @@ Design a new auth system for $ARGUMENTS
|
|
|
152
120
|
- `research-codebase` gets "auth middleware implementation"
|
|
153
121
|
- `security-audit` inherits the main command's `$ARGUMENTS`
|
|
154
122
|
|
|
155
|
-
**Note:** Parallel commands are forced into subtasks regardless of their own `subtask` setting. Their `return` are ignored
|
|
123
|
+
**Note:** Parallel commands are forced into subtasks regardless of their own `subtask` setting. Their `return` are ignored - only the parent's `return` applies. Nested parallels are automatically flattened (max depth: 5).
|
|
156
124
|
|
|
157
|
-
**Tip:**
|
|
125
|
+
**Tip:** You can also pass arguments inline using `||` separator:
|
|
158
126
|
|
|
159
|
-
```
|
|
160
|
-
|
|
127
|
+
```bash
|
|
128
|
+
/mycommand main args || parallel1 args || parallel2 args || return-cmd1 args || return-cmd2 args
|
|
161
129
|
```
|
|
162
130
|
|
|
163
|
-
|
|
131
|
+
Pipe segments map in order: main → parallels → return commands (only `/command` items, not prompts).
|
|
164
132
|
|
|
165
|
-
**Tip:**
|
|
133
|
+
**Tip:** For all commands to inherit the main `$ARGUMENTS`:
|
|
166
134
|
|
|
167
|
-
```
|
|
168
|
-
/
|
|
135
|
+
```yaml
|
|
136
|
+
parallel: /research-docs, /research-codebase, /security-audit
|
|
169
137
|
```
|
|
170
138
|
|
|
171
|
-
|
|
139
|
+
#### Priority: pipe args > frontmatter args > inherit main args
|
|
172
140
|
|
|
173
|
-
### 3.
|
|
141
|
+
### 3. Subtask `return` fallback and custom defaults
|
|
174
142
|
|
|
175
|
-
|
|
143
|
+
Once a **subtask** is completed, opencode injects a prompt in the main session and tells the agent to "summarize" the subtask result
|
|
176
144
|
|
|
177
|
-
For `subtask: true` commands
|
|
145
|
+
For `subtask: true` commands, this plugin replaces the opencode generic "summarize" message with the `return` prompt. If undefined and `"replace_generic": true`, subtask2 uses:
|
|
146
|
+
|
|
147
|
+
> Challenge and validate the task output. Verify assumptions, identify gaps or errors, then continue with the next logical step.
|
|
178
148
|
|
|
179
149
|
Configure in `~/.config/opencode/subtask2.jsonc`:
|
|
180
150
|
|
|
181
151
|
```jsonc
|
|
182
152
|
{
|
|
183
153
|
// Replace generic prompt when no 'return' is specified
|
|
184
|
-
"replace_generic": true,
|
|
154
|
+
"replace_generic": true, // defaults to true
|
|
185
155
|
|
|
186
156
|
// Custom fallback (optional - has built-in default)
|
|
187
|
-
"generic_return": "
|
|
157
|
+
"generic_return": "custom return prompt"
|
|
188
158
|
}
|
|
189
159
|
```
|
|
190
160
|
|
|
191
|
-
#### Priority
|
|
161
|
+
#### Priority: `return` param > config `generic_return` > built-in default > opencode original
|
|
162
|
+
|
|
163
|
+
</details>
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><strong>Some examples</strong> (click to expand)</summary>
|
|
167
|
+
|
|
168
|
+
**Parallel subtask with different models (A/B/C plan comparison)**
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
---
|
|
172
|
+
description: multi-model ensemble, 3 models plan in parallel, best ideas unified
|
|
173
|
+
model: github-copilot/claude-opus-4.5
|
|
174
|
+
subtask: true
|
|
175
|
+
parallel: /plan-gemini, /plan-gpt
|
|
176
|
+
return:
|
|
177
|
+
- Compare all 3 plans and validate each directly against the codebase. Pick the best ideas from each and create a unified implementation plan.
|
|
178
|
+
- /review-plan focus on simplicity and correctness
|
|
179
|
+
---
|
|
180
|
+
Plan the implementation for the following feature
|
|
181
|
+
> $ARGUMENTS
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Isolated "Plan" mode**
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
---
|
|
188
|
+
description: two-step implementation planning and validation
|
|
189
|
+
agent: build
|
|
190
|
+
subtask: true
|
|
191
|
+
return:
|
|
192
|
+
- Challenge, verify and validate the plan by reviewing the codebase directly. Then approve, revise, or reject the plan. Implement if solid
|
|
193
|
+
- Take a step back, review what was done/planned for correctness, revise if needed
|
|
194
|
+
---
|
|
195
|
+
In this session you WILL ONLY PLAN AND NOT IMPLEMENT. You are to take the `USER INPUT` and research the codebase until you have gathered enough knowledge to elaborate a full fledged implementation plan
|
|
196
|
+
|
|
197
|
+
You MUST consider alternative paths and keep researching until you are confident you found the BEST possible implementation
|
|
198
|
+
|
|
199
|
+
BEST often means simple, lean, clean, low surface and coupling
|
|
200
|
+
Make it practical, maintainable and not overly abstracted
|
|
201
|
+
|
|
202
|
+
Follow your heart
|
|
203
|
+
> DO NOT OVERENGINEER SHIT
|
|
204
|
+
|
|
205
|
+
USER INPUT
|
|
206
|
+
$ARGUMENTS
|
|
207
|
+
```
|
|
192
208
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
209
|
+
**Multi-step workflow**
|
|
210
|
+
|
|
211
|
+
```yaml
|
|
212
|
+
---
|
|
213
|
+
description: design, implement, test, document
|
|
214
|
+
agent: build
|
|
215
|
+
model: github-copilot/claude-opus-4.5
|
|
216
|
+
subtask: true
|
|
217
|
+
return:
|
|
218
|
+
- Implement the component following the conceptual design specifications.
|
|
219
|
+
- Write comprehensive unit tests for all edge cases.
|
|
220
|
+
- Update the documentation and add usage examples.
|
|
221
|
+
- Run the test suite and fix any failures.
|
|
222
|
+
---
|
|
223
|
+
Conceptually design a React modal component with the following requirements
|
|
224
|
+
> $ARGUMENTS
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
</details>
|
|
228
|
+
|
|
229
|
+
<details>
|
|
230
|
+
<summary><strong>Demo files</strong> (click to expand)</summary>
|
|
231
|
+
|
|
232
|
+
Prompt used in the demo:
|
|
233
|
+
`/subtask2 10 || pipe2 || pipe3 || pipe4 || pipe5`
|
|
234
|
+
|
|
235
|
+
`subtask2.md`
|
|
236
|
+
|
|
237
|
+
```yaml
|
|
238
|
+
---
|
|
239
|
+
description: subtask2 plugin test command
|
|
240
|
+
agent: build
|
|
241
|
+
subtask: true
|
|
242
|
+
parallel: /subtask2-parallel-test PARALLEL
|
|
243
|
+
return:
|
|
244
|
+
- say the phrase "THE RETURN PROMPT MADE ME SAY THIS" and do NOTHING else
|
|
245
|
+
- say the phrase "YOU CAN CHAIN PROMPTS, COMMANDS, OR SUBTASKS - NO LIMITS" and do NOTHING else
|
|
246
|
+
- /subtask2-nested-parallel CHAINED-COMMAND-SUBTASK # <--THIS
|
|
247
|
+
---
|
|
248
|
+
please count to $ARGUMENTS
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`subtask2-parallel-test.md`
|
|
252
|
+
|
|
253
|
+
```yaml
|
|
254
|
+
---
|
|
255
|
+
agent: plan
|
|
256
|
+
model: github-copilot/grok-code-fast-1
|
|
257
|
+
parallel: /subtask2-nested-parallel NESTED-PARALLEL
|
|
258
|
+
subtask: true
|
|
259
|
+
---
|
|
260
|
+
say the word "$ARGUMENTS" 3 times
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
`subtask2-nested-parallel.md`
|
|
264
|
+
|
|
265
|
+
```yaml
|
|
266
|
+
---
|
|
267
|
+
agent: explore
|
|
268
|
+
model: github-copilot/gpt-4.1
|
|
269
|
+
subtask: true
|
|
270
|
+
return:
|
|
271
|
+
- say the phrase "COMPOSE AS SIMPLE OR COMPLEX A WORKFLOW AS YOU WANT" and do NOTHING else
|
|
272
|
+
- /subtask2-parallel-test LAST CALL
|
|
273
|
+
---
|
|
274
|
+
say the word "$ARGUMENTS" 3 times
|
|
275
|
+
```
|
|
197
276
|
|
|
198
277
|
</details>
|
|
199
278
|
|
|
@@ -206,3 +285,7 @@ To install, add subtask2 to your opencode config plugin array
|
|
|
206
285
|
"plugins": ["@openspoon/subtask2"]
|
|
207
286
|
}
|
|
208
287
|
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+

|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CommandConfig } from "./types";
|
|
2
|
+
export declare function loadCommandFile(name: string): Promise<{
|
|
3
|
+
content: string;
|
|
4
|
+
path: string;
|
|
5
|
+
} | null>;
|
|
6
|
+
export declare function buildManifest(): Promise<Record<string, CommandConfig>>;
|
|
7
|
+
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../commands.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAG3C,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CAAC,CA4BjD;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAkC5E"}
|
package/dist/commands.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="bun-types" />
|
|
2
|
+
import { parseFrontmatter, getTemplateBody, parseParallelConfig } from "./parser";
|
|
3
|
+
export async function loadCommandFile(name) {
|
|
4
|
+
const home = Bun.env.HOME ?? "";
|
|
5
|
+
const dirs = [
|
|
6
|
+
`${home}/.config/opencode/command`,
|
|
7
|
+
`${Bun.env.PWD ?? "."}/.opencode/command`,
|
|
8
|
+
];
|
|
9
|
+
for (const dir of dirs) {
|
|
10
|
+
// Try direct path first, then search subdirs
|
|
11
|
+
const directPath = `${dir}/${name}.md`;
|
|
12
|
+
try {
|
|
13
|
+
const file = Bun.file(directPath);
|
|
14
|
+
if (await file.exists()) {
|
|
15
|
+
return { content: await file.text(), path: directPath };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch { }
|
|
19
|
+
// Search subdirs for name.md
|
|
20
|
+
try {
|
|
21
|
+
const glob = new Bun.Glob(`**/${name}.md`);
|
|
22
|
+
for await (const match of glob.scan(dir)) {
|
|
23
|
+
const fullPath = `${dir}/${match}`;
|
|
24
|
+
const content = await Bun.file(fullPath).text();
|
|
25
|
+
return { content, path: fullPath };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch { }
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
export async function buildManifest() {
|
|
33
|
+
const manifest = {};
|
|
34
|
+
const home = Bun.env.HOME ?? "";
|
|
35
|
+
const dirs = [
|
|
36
|
+
`${home}/.config/opencode/command`,
|
|
37
|
+
`${Bun.env.PWD ?? "."}/.opencode/command`,
|
|
38
|
+
];
|
|
39
|
+
for (const dir of dirs) {
|
|
40
|
+
try {
|
|
41
|
+
const glob = new Bun.Glob("**/*.md");
|
|
42
|
+
for await (const file of glob.scan(dir)) {
|
|
43
|
+
const name = file.replace(/\.md$/, "").split("/").pop();
|
|
44
|
+
const content = await Bun.file(`${dir}/${file}`).text();
|
|
45
|
+
const fm = parseFrontmatter(content);
|
|
46
|
+
const returnVal = fm.return;
|
|
47
|
+
const returnArr = returnVal
|
|
48
|
+
? Array.isArray(returnVal)
|
|
49
|
+
? returnVal
|
|
50
|
+
: [returnVal]
|
|
51
|
+
: [];
|
|
52
|
+
const parallelArr = parseParallelConfig(fm.parallel);
|
|
53
|
+
manifest[name] = {
|
|
54
|
+
return: returnArr,
|
|
55
|
+
parallel: parallelArr,
|
|
56
|
+
agent: fm.agent,
|
|
57
|
+
description: fm.description,
|
|
58
|
+
template: getTemplateBody(content),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch { }
|
|
63
|
+
}
|
|
64
|
+
return manifest;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
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I,CAAC,GAAG;oBACf,MAAM,EAAE,SAAS;oBACjB,QAAQ,EAAE,WAAW;oBACrB,KAAK,EAAE,EAAE,CAAC,KAA2B;oBACrC,WAAW,EAAE,EAAE,CAAC,WAAiC;oBACjD,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC;iBACnC,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;IACZ,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,cAAc,oCAAoC,CAAC;AAgBhE,wBAAsB,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CA+B1D"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="bun-types" />
|
|
2
|
+
export const DEFAULT_PROMPT = "say GENERIC_REPLACEMENT 5 times";
|
|
3
|
+
const CONFIG_PATH = `${Bun.env.HOME ?? ""}/.config/opencode/subtask2.jsonc`;
|
|
4
|
+
function isValidConfig(obj) {
|
|
5
|
+
if (typeof obj !== "object" || obj === null)
|
|
6
|
+
return false;
|
|
7
|
+
const cfg = obj;
|
|
8
|
+
if (typeof cfg.replace_generic !== "boolean")
|
|
9
|
+
return false;
|
|
10
|
+
if (cfg.generic_return !== undefined &&
|
|
11
|
+
typeof cfg.generic_return !== "string")
|
|
12
|
+
return false;
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
export async function loadConfig() {
|
|
16
|
+
const defaultConfig = {
|
|
17
|
+
replace_generic: true,
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
const file = Bun.file(CONFIG_PATH);
|
|
21
|
+
if (await file.exists()) {
|
|
22
|
+
const text = await file.text();
|
|
23
|
+
const stripped = text
|
|
24
|
+
.replace(/\/\/.*$/gm, "")
|
|
25
|
+
.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
26
|
+
const parsed = JSON.parse(stripped);
|
|
27
|
+
if (isValidConfig(parsed)) {
|
|
28
|
+
return parsed;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch { }
|
|
33
|
+
await Bun.write(CONFIG_PATH, `{
|
|
34
|
+
// Replace OpenCode's generic "Summarize..." prompt when no return is specified
|
|
35
|
+
"replace_generic": true
|
|
36
|
+
|
|
37
|
+
// Custom prompt to use (uses subtask2 substitution prompt by default)
|
|
38
|
+
// "generic_return": "Challenge and validate the task tool output above. Verify assumptions, identify gaps or errors, then continue with the next logical step."
|
|
39
|
+
}
|
|
40
|
+
`);
|
|
41
|
+
return defaultConfig;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../config.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAInC,MAAM,CAAC,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAEhE,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,kCAAkC,CAAC;AAE5E,SAAS,aAAa,CAAC,GAAY;IACjC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC1D,MAAM,GAAG,GAAG,GAA8B,CAAC;IAC3C,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC3D,IACE,GAAG,CAAC,cAAc,KAAK,SAAS;QAChC,OAAO,GAAG,CAAC,cAAc,KAAK,QAAQ;QAEtC,OAAO,KAAK,CAAC;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU;IAC9B,MAAM,aAAa,GAAmB;QACpC,eAAe,EAAE,IAAI;KACtB,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACnC,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YACxB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YAC/B,MAAM,QAAQ,GAAG,IAAI;iBAClB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;iBACxB,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;YACpC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1B,OAAO,MAAM,CAAC;YAChB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IAEV,MAAM,GAAG,CAAC,KAAK,CACb,WAAW,EACX;;;;;;;CAOH,CACE,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAiHhD,QAAA,MAAM,MAAM,EAAE,MAmRb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,124 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return false;
|
|
7
|
-
const cfg = obj;
|
|
8
|
-
if (typeof cfg.replace_generic !== "boolean")
|
|
9
|
-
return false;
|
|
10
|
-
if (cfg.generic_return !== undefined && typeof cfg.generic_return !== "string")
|
|
11
|
-
return false;
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
async function loadConfig() {
|
|
15
|
-
const defaultConfig = {
|
|
16
|
-
replace_generic: true,
|
|
17
|
-
};
|
|
18
|
-
try {
|
|
19
|
-
const file = Bun.file(CONFIG_PATH);
|
|
20
|
-
if (await file.exists()) {
|
|
21
|
-
const text = await file.text();
|
|
22
|
-
const stripped = text
|
|
23
|
-
.replace(/\/\/.*$/gm, "")
|
|
24
|
-
.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
25
|
-
const parsed = JSON.parse(stripped);
|
|
26
|
-
if (isValidConfig(parsed)) {
|
|
27
|
-
return parsed;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch { }
|
|
32
|
-
await Bun.write(CONFIG_PATH, `{
|
|
33
|
-
// Replace OpenCode's generic "Summarize..." prompt when no return is specified
|
|
34
|
-
"replace_generic": true
|
|
35
|
-
|
|
36
|
-
// Custom prompt to use (uses subtask2 substitution prompt by default)
|
|
37
|
-
// "generic_return": "Challenge and validate the task tool output above. Verify assumptions, identify gaps or errors, then continue with the next logical step."
|
|
38
|
-
}
|
|
39
|
-
`);
|
|
40
|
-
return defaultConfig;
|
|
41
|
-
}
|
|
42
|
-
function parseFrontmatter(content) {
|
|
43
|
-
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
44
|
-
if (!match)
|
|
45
|
-
return {};
|
|
46
|
-
try {
|
|
47
|
-
return YAML.parse(match[1]) ?? {};
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function getTemplateBody(content) {
|
|
54
|
-
const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
|
|
55
|
-
return match ? match[1].trim() : content.trim();
|
|
56
|
-
}
|
|
57
|
-
async function loadCommandFile(name) {
|
|
58
|
-
const home = Bun.env.HOME ?? "";
|
|
59
|
-
const dirs = [
|
|
60
|
-
`${home}/.config/opencode/command`,
|
|
61
|
-
`${Bun.env.PWD ?? "."}/.opencode/command`,
|
|
62
|
-
];
|
|
63
|
-
for (const dir of dirs) {
|
|
64
|
-
const path = `${dir}/${name}.md`;
|
|
65
|
-
try {
|
|
66
|
-
const file = Bun.file(path);
|
|
67
|
-
if (await file.exists()) {
|
|
68
|
-
return { content: await file.text(), path };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch { }
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
async function buildManifest() {
|
|
76
|
-
const manifest = {};
|
|
77
|
-
const home = Bun.env.HOME ?? "";
|
|
78
|
-
const dirs = [
|
|
79
|
-
`${home}/.config/opencode/command`,
|
|
80
|
-
`${Bun.env.PWD ?? "."}/.opencode/command`,
|
|
81
|
-
];
|
|
82
|
-
for (const dir of dirs) {
|
|
83
|
-
try {
|
|
84
|
-
const glob = new Bun.Glob("*.md");
|
|
85
|
-
for await (const file of glob.scan(dir)) {
|
|
86
|
-
const name = file.replace(/\.md$/, "");
|
|
87
|
-
const content = await Bun.file(`${dir}/${file}`).text();
|
|
88
|
-
const fm = parseFrontmatter(content);
|
|
89
|
-
const returnVal = fm.return;
|
|
90
|
-
const returnArr = returnVal ? (Array.isArray(returnVal) ? returnVal : [returnVal]) : [];
|
|
91
|
-
const parallel = fm.parallel;
|
|
92
|
-
let parallelArr = [];
|
|
93
|
-
if (parallel) {
|
|
94
|
-
if (Array.isArray(parallel)) {
|
|
95
|
-
parallelArr = parallel.map((p) => {
|
|
96
|
-
if (typeof p === "string") {
|
|
97
|
-
return { command: p.trim() };
|
|
98
|
-
}
|
|
99
|
-
if (typeof p === "object" && p.command) {
|
|
100
|
-
return { command: p.command, arguments: p.arguments };
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
}).filter((p) => p !== null);
|
|
104
|
-
}
|
|
105
|
-
else if (typeof parallel === "string") {
|
|
106
|
-
parallelArr = parallel.split(",").map((s) => ({ command: s.trim() })).filter((p) => p.command);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
manifest[name] = {
|
|
110
|
-
return: returnArr,
|
|
111
|
-
parallel: parallelArr,
|
|
112
|
-
agent: fm.agent,
|
|
113
|
-
description: fm.description,
|
|
114
|
-
template: getTemplateBody(content),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
catch { }
|
|
119
|
-
}
|
|
120
|
-
return manifest;
|
|
121
|
-
}
|
|
1
|
+
import { loadConfig, DEFAULT_PROMPT } from "./config";
|
|
2
|
+
import { parseFrontmatter, getTemplateBody, parseParallelConfig, } from "./parser";
|
|
3
|
+
import { loadCommandFile, buildManifest } from "./commands";
|
|
4
|
+
import { log, clearLog } from "./logger";
|
|
5
|
+
// Session state
|
|
122
6
|
let configs = {};
|
|
123
7
|
let pluginConfig = { replace_generic: true };
|
|
124
8
|
let client = null;
|
|
@@ -126,20 +10,143 @@ const callState = new Map();
|
|
|
126
10
|
const returnState = new Map();
|
|
127
11
|
const pendingReturns = new Map();
|
|
128
12
|
const pendingNonSubtaskReturns = new Map();
|
|
13
|
+
const pipedArgsQueue = new Map();
|
|
14
|
+
const returnArgsState = pipedArgsQueue; // alias for backward compat
|
|
15
|
+
const sessionMainCommand = new Map();
|
|
16
|
+
const executedReturns = new Set();
|
|
129
17
|
let hasActiveSubtask = false;
|
|
130
18
|
const OPENCODE_GENERIC = "Summarize the task tool output above and continue with your task.";
|
|
19
|
+
async function flattenParallels(parallels, mainArgs, sessionID, visited = new Set(), depth = 0, maxDepth = 5) {
|
|
20
|
+
if (depth > maxDepth)
|
|
21
|
+
return [];
|
|
22
|
+
const queue = pipedArgsQueue.get(sessionID) ?? [];
|
|
23
|
+
log(`flattenParallels called:`, {
|
|
24
|
+
depth,
|
|
25
|
+
parallels: parallels.map((p) => `${p.command}${p.arguments ? ` (args: ${p.arguments})` : ""}`),
|
|
26
|
+
mainArgs,
|
|
27
|
+
queueRemaining: [...queue],
|
|
28
|
+
});
|
|
29
|
+
const parts = [];
|
|
30
|
+
for (let i = 0; i < parallels.length; i++) {
|
|
31
|
+
const parallelCmd = parallels[i];
|
|
32
|
+
if (visited.has(parallelCmd.command))
|
|
33
|
+
continue;
|
|
34
|
+
visited.add(parallelCmd.command);
|
|
35
|
+
const cmdFile = await loadCommandFile(parallelCmd.command);
|
|
36
|
+
if (!cmdFile)
|
|
37
|
+
continue;
|
|
38
|
+
const fm = parseFrontmatter(cmdFile.content);
|
|
39
|
+
let template = getTemplateBody(cmdFile.content);
|
|
40
|
+
// Priority: piped arg (from queue) > frontmatter args > main args
|
|
41
|
+
const pipeArg = queue.shift();
|
|
42
|
+
const args = pipeArg ?? parallelCmd.arguments ?? mainArgs;
|
|
43
|
+
log(`Parallel ${parallelCmd.command}: using args="${args}" (pipeArg=${pipeArg}, fmArg=${parallelCmd.arguments}, mainArgs=${mainArgs})`);
|
|
44
|
+
template = template.replace(/\$ARGUMENTS/g, args);
|
|
45
|
+
// Parse model string "provider/model" into {providerID, modelID}
|
|
46
|
+
let model;
|
|
47
|
+
if (typeof fm.model === "string" && fm.model.includes("/")) {
|
|
48
|
+
const [providerID, ...rest] = fm.model.split("/");
|
|
49
|
+
model = { providerID, modelID: rest.join("/") };
|
|
50
|
+
}
|
|
51
|
+
parts.push({
|
|
52
|
+
type: "subtask",
|
|
53
|
+
agent: fm.agent || "general",
|
|
54
|
+
model,
|
|
55
|
+
description: fm.description || `Parallel: ${parallelCmd.command}`,
|
|
56
|
+
command: parallelCmd.command,
|
|
57
|
+
prompt: template,
|
|
58
|
+
});
|
|
59
|
+
// Recursively flatten nested parallels
|
|
60
|
+
const nestedParallel = fm.parallel;
|
|
61
|
+
if (nestedParallel) {
|
|
62
|
+
const nestedArr = parseParallelConfig(nestedParallel);
|
|
63
|
+
if (nestedArr.length) {
|
|
64
|
+
const nestedParts = await flattenParallels(nestedArr, args, sessionID, visited, depth + 1, maxDepth);
|
|
65
|
+
parts.push(...nestedParts);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return parts;
|
|
70
|
+
}
|
|
131
71
|
const plugin = async (ctx) => {
|
|
132
72
|
configs = await buildManifest();
|
|
133
73
|
pluginConfig = await loadConfig();
|
|
134
74
|
client = ctx.client;
|
|
75
|
+
clearLog();
|
|
76
|
+
log("Plugin initialized, configs:", Object.keys(configs));
|
|
77
|
+
// Helper to execute a return item (command or prompt)
|
|
78
|
+
async function executeReturn(item, sessionID) {
|
|
79
|
+
log(`executeReturn called: item=${item}, sessionID=${sessionID}`);
|
|
80
|
+
// Dedup check to prevent double execution
|
|
81
|
+
const key = `${sessionID}:${item}`;
|
|
82
|
+
if (executedReturns.has(key)) {
|
|
83
|
+
log(`executeReturn skipped (already executed): ${key}`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
executedReturns.add(key);
|
|
87
|
+
if (item.startsWith("/")) {
|
|
88
|
+
// Parse /command args syntax
|
|
89
|
+
const [cmdName, ...argParts] = item.slice(1).split(/\s+/);
|
|
90
|
+
let args = argParts.join(" ");
|
|
91
|
+
const inlineArgs = args;
|
|
92
|
+
// Check if we have piped args for this return command
|
|
93
|
+
const returnArgs = returnArgsState.get(sessionID);
|
|
94
|
+
log(`executeReturn /command: cmdName=${cmdName}, inlineArgs="${inlineArgs}", returnArgsState=`, returnArgs);
|
|
95
|
+
if (returnArgs?.length) {
|
|
96
|
+
const pipeArg = returnArgs.shift();
|
|
97
|
+
if (!returnArgs.length)
|
|
98
|
+
returnArgsState.delete(sessionID);
|
|
99
|
+
if (pipeArg)
|
|
100
|
+
args = pipeArg;
|
|
101
|
+
log(`executeReturn: using pipeArg="${pipeArg}" instead of inlineArgs`);
|
|
102
|
+
}
|
|
103
|
+
log(`executeReturn: final args="${args}"`);
|
|
104
|
+
// Update main command to this chained command so its own return is processed
|
|
105
|
+
log(`executeReturn: setting mainCmd to ${cmdName} for session ${sessionID}`);
|
|
106
|
+
sessionMainCommand.set(sessionID, cmdName);
|
|
107
|
+
try {
|
|
108
|
+
await client.session.command({
|
|
109
|
+
path: { id: sessionID },
|
|
110
|
+
body: { command: cmdName, arguments: args || "" },
|
|
111
|
+
});
|
|
112
|
+
log(`executeReturn: command ${cmdName} completed`);
|
|
113
|
+
}
|
|
114
|
+
catch (e) {
|
|
115
|
+
log(`executeReturn: command ${cmdName} FAILED:`, e);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
log(`executeReturn: sending prompt: ${item.substring(0, 50)}...`);
|
|
120
|
+
await client.session.promptAsync({
|
|
121
|
+
path: { id: sessionID },
|
|
122
|
+
body: { parts: [{ type: "text", text: item }] },
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
135
126
|
return {
|
|
136
127
|
"command.execute.before": async (input, output) => {
|
|
137
128
|
const cmd = input.command;
|
|
138
129
|
const config = configs[cmd];
|
|
139
|
-
|
|
130
|
+
sessionMainCommand.set(input.sessionID, cmd);
|
|
131
|
+
log(`command.execute.before: cmd=${cmd}, sessionID=${input.sessionID}, hasConfig=${!!config}`);
|
|
132
|
+
// Parse pipe-separated arguments: main || arg1 || arg2 || arg3 ...
|
|
140
133
|
const argSegments = input.arguments.split("||").map((s) => s.trim());
|
|
141
134
|
const mainArgs = argSegments[0] || "";
|
|
142
|
-
|
|
135
|
+
// Store ALL piped args (after main) in a shared queue
|
|
136
|
+
const allPipedArgs = argSegments.slice(1);
|
|
137
|
+
log(`Pipe args parsing:`, {
|
|
138
|
+
fullArgs: input.arguments,
|
|
139
|
+
argSegments,
|
|
140
|
+
mainArgs,
|
|
141
|
+
allPipedArgs,
|
|
142
|
+
configParallel: config?.parallel,
|
|
143
|
+
configReturn: config?.return,
|
|
144
|
+
});
|
|
145
|
+
// Store piped args for consumption by parallels and return commands
|
|
146
|
+
if (allPipedArgs.length) {
|
|
147
|
+
pipedArgsQueue.set(input.sessionID, allPipedArgs);
|
|
148
|
+
log(`Stored pipedArgsQueue for session ${input.sessionID}:`, allPipedArgs);
|
|
149
|
+
}
|
|
143
150
|
// Fix main command's parts to use only mainArgs (not the full pipe string)
|
|
144
151
|
if (argSegments.length > 1) {
|
|
145
152
|
for (const part of output.parts) {
|
|
@@ -158,40 +165,34 @@ const plugin = async (ctx) => {
|
|
|
158
165
|
}
|
|
159
166
|
if (!config?.parallel?.length)
|
|
160
167
|
return;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (!cmdFile)
|
|
165
|
-
continue;
|
|
166
|
-
const fm = parseFrontmatter(cmdFile.content);
|
|
167
|
-
let template = getTemplateBody(cmdFile.content);
|
|
168
|
-
// Priority: pipe args > frontmatter args > main args
|
|
169
|
-
const args = parallelArgs[i] ?? parallelCmd.arguments ?? mainArgs;
|
|
170
|
-
template = template.replace(/\$ARGUMENTS/g, args);
|
|
171
|
-
// Parse model string "provider/model" into {providerID, modelID}
|
|
172
|
-
let model;
|
|
173
|
-
if (typeof fm.model === "string" && fm.model.includes("/")) {
|
|
174
|
-
const [providerID, ...rest] = fm.model.split("/");
|
|
175
|
-
model = { providerID, modelID: rest.join("/") };
|
|
176
|
-
}
|
|
177
|
-
output.parts.push({
|
|
178
|
-
type: "subtask",
|
|
179
|
-
agent: fm.agent || "general",
|
|
180
|
-
model,
|
|
181
|
-
description: fm.description || `Parallel: ${parallelCmd.command}`,
|
|
182
|
-
command: parallelCmd.command,
|
|
183
|
-
prompt: template,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
168
|
+
// Recursively flatten all nested parallels
|
|
169
|
+
const parallelParts = await flattenParallels(config.parallel, mainArgs, input.sessionID);
|
|
170
|
+
output.parts.push(...parallelParts);
|
|
186
171
|
},
|
|
187
172
|
"tool.execute.before": async (input, output) => {
|
|
188
173
|
if (input.tool !== "task")
|
|
189
174
|
return;
|
|
190
175
|
hasActiveSubtask = true;
|
|
191
176
|
const cmd = output.args?.command;
|
|
177
|
+
let mainCmd = sessionMainCommand.get(input.sessionID);
|
|
178
|
+
// If mainCmd is not set (command.execute.before didn't fire - no PR),
|
|
179
|
+
// set the first subtask command as the main command
|
|
180
|
+
if (!mainCmd && cmd && configs[cmd]) {
|
|
181
|
+
sessionMainCommand.set(input.sessionID, cmd);
|
|
182
|
+
mainCmd = cmd;
|
|
183
|
+
log(`tool.execute.before: no mainCmd set, setting to ${cmd} (fallback for non-PR)`);
|
|
184
|
+
// Also set up return state since command.execute.before didn't run
|
|
185
|
+
if (configs[cmd].return.length > 1) {
|
|
186
|
+
returnState.set(input.sessionID, [...configs[cmd].return.slice(1)]);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
log(`tool.execute.before: cmd=${cmd}, mainCmd=${mainCmd}, sessionID=${input.sessionID}`);
|
|
192
190
|
if (cmd && configs[cmd]) {
|
|
191
|
+
if (cmd === mainCmd) {
|
|
192
|
+
pendingNonSubtaskReturns.delete(input.sessionID);
|
|
193
|
+
}
|
|
193
194
|
callState.set(input.callID, cmd);
|
|
194
|
-
if (configs[cmd].return.length > 1) {
|
|
195
|
+
if (cmd === mainCmd && configs[cmd].return.length > 1) {
|
|
195
196
|
returnState.set(input.sessionID, [...configs[cmd].return.slice(1)]);
|
|
196
197
|
}
|
|
197
198
|
}
|
|
@@ -201,53 +202,74 @@ const plugin = async (ctx) => {
|
|
|
201
202
|
return;
|
|
202
203
|
const cmd = callState.get(input.callID);
|
|
203
204
|
callState.delete(input.callID);
|
|
204
|
-
|
|
205
|
+
const mainCmd = sessionMainCommand.get(input.sessionID);
|
|
206
|
+
log(`tool.execute.after: cmd=${cmd}, mainCmd=${mainCmd}, hasReturn=${!!(cmd && configs[cmd]?.return?.length)}`);
|
|
207
|
+
if (cmd && cmd === mainCmd && configs[cmd]?.return?.length) {
|
|
208
|
+
log(`Setting pendingReturn for session ${input.sessionID}: ${configs[cmd].return[0]}`);
|
|
205
209
|
pendingReturns.set(input.sessionID, configs[cmd].return[0]);
|
|
206
210
|
}
|
|
207
211
|
},
|
|
208
|
-
"experimental.chat.messages.transform": async (
|
|
209
|
-
|
|
212
|
+
"experimental.chat.messages.transform": async (input, output) => {
|
|
213
|
+
log(`messages.transform called, pendingReturns keys:`, Array.from(pendingReturns.keys()), `message count: ${output.messages.length}`);
|
|
214
|
+
// Find the LAST message with OPENCODE_GENERIC
|
|
215
|
+
let lastGenericPart = null;
|
|
216
|
+
let lastGenericMsgIndex = -1;
|
|
217
|
+
for (let i = 0; i < output.messages.length; i++) {
|
|
218
|
+
const msg = output.messages[i];
|
|
210
219
|
for (const part of msg.parts) {
|
|
211
220
|
if (part.type === "text" && part.text === OPENCODE_GENERIC) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
lastGenericPart = part;
|
|
222
|
+
lastGenericMsgIndex = i;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (lastGenericPart) {
|
|
227
|
+
log(`Found LAST OPENCODE_GENERIC at msg[${lastGenericMsgIndex}]`);
|
|
228
|
+
// Check for pending return
|
|
229
|
+
for (const [sessionID, returnPrompt] of pendingReturns) {
|
|
230
|
+
log(`Replacing with pendingReturn for session=${sessionID}, returnPrompt=${returnPrompt}`);
|
|
231
|
+
if (returnPrompt.startsWith("/")) {
|
|
232
|
+
lastGenericPart.text = "";
|
|
233
|
+
log(`Set part.text to empty string, will execute command`);
|
|
234
|
+
executeReturn(returnPrompt, sessionID).catch(console.error);
|
|
223
235
|
}
|
|
236
|
+
else {
|
|
237
|
+
lastGenericPart.text = returnPrompt;
|
|
238
|
+
log(`Set part.text to: "${lastGenericPart.text}", verification: ${lastGenericPart.text === returnPrompt}`);
|
|
239
|
+
}
|
|
240
|
+
pendingReturns.delete(sessionID);
|
|
241
|
+
hasActiveSubtask = false;
|
|
242
|
+
log(`After replacement, pendingReturns keys:`, Array.from(pendingReturns.keys()));
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
// No pending return found, use generic replacement if configured
|
|
246
|
+
log(`No pendingReturn found, hasActiveSubtask=${hasActiveSubtask}`);
|
|
247
|
+
if (hasActiveSubtask && pluginConfig.replace_generic) {
|
|
248
|
+
log(`Using default replacement: ${pluginConfig.generic_return ?? DEFAULT_PROMPT}`);
|
|
249
|
+
lastGenericPart.text = pluginConfig.generic_return ?? DEFAULT_PROMPT;
|
|
250
|
+
hasActiveSubtask = false;
|
|
251
|
+
return;
|
|
224
252
|
}
|
|
225
253
|
}
|
|
226
254
|
},
|
|
227
255
|
"experimental.text.complete": async (input) => {
|
|
228
|
-
// Handle non-subtask command returns
|
|
256
|
+
// Handle non-subtask command returns
|
|
229
257
|
const pendingReturn = pendingNonSubtaskReturns.get(input.sessionID);
|
|
230
258
|
if (pendingReturn?.length && client) {
|
|
231
259
|
const next = pendingReturn.shift();
|
|
232
260
|
if (!pendingReturn.length)
|
|
233
261
|
pendingNonSubtaskReturns.delete(input.sessionID);
|
|
234
|
-
|
|
235
|
-
path: { id: input.sessionID },
|
|
236
|
-
body: { parts: [{ type: "text", text: next }] },
|
|
237
|
-
});
|
|
262
|
+
executeReturn(next, input.sessionID).catch(console.error);
|
|
238
263
|
return;
|
|
239
264
|
}
|
|
240
|
-
// Handle remaining returns
|
|
265
|
+
// Handle remaining returns
|
|
241
266
|
const remaining = returnState.get(input.sessionID);
|
|
242
267
|
if (!remaining?.length || !client)
|
|
243
268
|
return;
|
|
244
269
|
const next = remaining.shift();
|
|
245
270
|
if (!remaining.length)
|
|
246
271
|
returnState.delete(input.sessionID);
|
|
247
|
-
|
|
248
|
-
path: { id: input.sessionID },
|
|
249
|
-
body: { parts: [{ type: "text", text: next }] },
|
|
250
|
-
});
|
|
272
|
+
executeReturn(next, input.sessionID).catch(console.error);
|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CAAC;YAChC,IAAI,CAAC,SAAS,CAAC,MAAM;gBAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAC3D,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../logger.ts"],"names":[],"mappings":"AAUA,wBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,QAMrC;AAED,wBAAgB,QAAQ,SAEvB"}
|
package/dist/logger.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { appendFileSync, mkdirSync, existsSync, writeFileSync } from "fs";
|
|
2
|
+
const LOG_DIR = `${process.env.HOME}/.config/opencode/plugin/subtask2/logs`;
|
|
3
|
+
const LOG_FILE = `${LOG_DIR}/debug.log`;
|
|
4
|
+
// Ensure log directory exists
|
|
5
|
+
if (!existsSync(LOG_DIR)) {
|
|
6
|
+
mkdirSync(LOG_DIR, { recursive: true });
|
|
7
|
+
}
|
|
8
|
+
export function log(...args) {
|
|
9
|
+
const timestamp = new Date().toISOString();
|
|
10
|
+
const message = args
|
|
11
|
+
.map((a) => (typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)))
|
|
12
|
+
.join(" ");
|
|
13
|
+
appendFileSync(LOG_FILE, `[${timestamp}] ${message}\n`);
|
|
14
|
+
}
|
|
15
|
+
export function clearLog() {
|
|
16
|
+
writeFileSync(LOG_FILE, "");
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAE1E,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,wCAAwC,CAAC;AAC5E,MAAM,QAAQ,GAAG,GAAG,OAAO,YAAY,CAAC;AAExC,8BAA8B;AAC9B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,GAAG,IAAe;IACpC,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAI;SACjB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5E,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,cAAc,CAAC,QAAQ,EAAE,IAAI,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ParallelCommand } from "./types";
|
|
2
|
+
export declare function parseFrontmatter(content: string): Record<string, unknown>;
|
|
3
|
+
export declare function getTemplateBody(content: string): string;
|
|
4
|
+
export declare function parseParallelItem(p: unknown): ParallelCommand | null;
|
|
5
|
+
export declare function parseParallelConfig(parallel: unknown): ParallelCommand[];
|
|
6
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAE7C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQzE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGvD;AAGD,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAcpE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,GAAG,eAAe,EAAE,CAexE"}
|
package/dist/parser.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import YAML from "yaml";
|
|
2
|
+
export function parseFrontmatter(content) {
|
|
3
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
4
|
+
if (!match)
|
|
5
|
+
return {};
|
|
6
|
+
try {
|
|
7
|
+
return YAML.parse(match[1]) ?? {};
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function getTemplateBody(content) {
|
|
14
|
+
const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
|
|
15
|
+
return match ? match[1].trim() : content.trim();
|
|
16
|
+
}
|
|
17
|
+
// Parse a parallel item - handles "/cmd args" syntax, plain "cmd", or {command, arguments} object
|
|
18
|
+
export function parseParallelItem(p) {
|
|
19
|
+
if (typeof p === "string") {
|
|
20
|
+
const trimmed = p.trim();
|
|
21
|
+
if (trimmed.startsWith("/")) {
|
|
22
|
+
// Parse /command args syntax
|
|
23
|
+
const [cmdName, ...argParts] = trimmed.slice(1).split(/\s+/);
|
|
24
|
+
return { command: cmdName, arguments: argParts.join(" ") || undefined };
|
|
25
|
+
}
|
|
26
|
+
return { command: trimmed };
|
|
27
|
+
}
|
|
28
|
+
if (typeof p === "object" && p !== null && p.command) {
|
|
29
|
+
return { command: p.command, arguments: p.arguments };
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
export function parseParallelConfig(parallel) {
|
|
34
|
+
if (!parallel)
|
|
35
|
+
return [];
|
|
36
|
+
if (Array.isArray(parallel)) {
|
|
37
|
+
return parallel
|
|
38
|
+
.map(parseParallelItem)
|
|
39
|
+
.filter((p) => p !== null);
|
|
40
|
+
}
|
|
41
|
+
if (typeof parallel === "string") {
|
|
42
|
+
// Split by comma, parse each
|
|
43
|
+
return parallel
|
|
44
|
+
.split(",")
|
|
45
|
+
.map(parseParallelItem)
|
|
46
|
+
.filter((p) => p !== null);
|
|
47
|
+
}
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../parser.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IACtB,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AAClD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AAC;aACtB,MAAM,CAAC,CAAC,CAAC,EAAwB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ParallelCommand {
|
|
2
|
+
command: string;
|
|
3
|
+
arguments?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CommandConfig {
|
|
6
|
+
return: string[];
|
|
7
|
+
parallel: ParallelCommand[];
|
|
8
|
+
agent?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
template?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Subtask2Config {
|
|
13
|
+
replace_generic: boolean;
|
|
14
|
+
generic_return?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SubtaskPart {
|
|
17
|
+
type: "subtask";
|
|
18
|
+
agent: string;
|
|
19
|
+
model?: {
|
|
20
|
+
providerID: string;
|
|
21
|
+
modelID: string;
|
|
22
|
+
};
|
|
23
|
+
description: string;
|
|
24
|
+
command: string;
|
|
25
|
+
prompt: string;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@openspoon/subtask2",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Opencode plugin for enhanced subtask control with return context and prompt chaining",
|
|
7
7
|
"main": "./dist/index.js",
|