@op1/threads 0.1.3 → 0.1.4

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
@@ -35,7 +35,11 @@ threads_spawn({
35
35
  })
36
36
  ```
37
37
 
38
- The worker opens in a native tab without taking focus. Select that tab to read its conversation. Use `threads_list` to inspect reports and `/threads` to reopen closed worker tabs. Native `subagent` remains available for bounded tasks and role-specific reviews.
38
+ The worker opens in a native tab without taking focus. Select that tab to read its conversation. Use `threads_list` to inspect reports and `/threads` to reopen closed worker tabs.
39
+
40
+ Both the parent and managed workers can use native `subagent` for bounded tasks and role-specific reviews. The parent can mix direct subagent calls with managed threads. Each worker can work directly or delegate within its brief and inherited permissions, then review the results and submit its own combined report.
41
+
42
+ The parent writes the `task` brief. The plugin appends an explicit reminder that native delegation is optional and that workers cannot call `threads_spawn`. Include the worker's delegation budget in the brief. Use `No children` only when the task requires it, since that also rules out native subagents.
39
43
 
40
44
  ## Tools
41
45
 
package/index.ts CHANGED
@@ -38,7 +38,7 @@ export default Plugin.define({
38
38
  editor.add({
39
39
  name: "spawn",
40
40
  description:
41
- "Delegate a task to a top-level worker in an existing absolute directory. Reuse key only for identical requests. No managed grandchildren.",
41
+ "Delegate a task to a top-level worker in an existing absolute directory. Both you and the worker may use native subagent when useful. Include any delegation limits in task. Workers cannot call threads_spawn. Reuse key only for identical requests.",
42
42
  input: Spawn,
43
43
  output: WorkerView,
44
44
  options: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@op1/threads",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Visible top-level worker sessions for OpenCode V2, with native tabs and durable reports.",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -5,22 +5,30 @@ description: Spawn and monitor visible top-level OpenCode workers with op-thread
5
5
 
6
6
  # Managed sessions
7
7
 
8
- Choose the delegation mode before launching work.
8
+ Choose the delegation mode for each task. The parent can mix both modes in the same run.
9
9
 
10
10
  - Use native `subagent` for a bounded task or review.
11
11
  - Use `threads_spawn` for an independent workstream with its own visible session and assigned directory.
12
12
 
13
- Count both modes against the active protocol's delegation budget. Managed workers can use native subagents, but cannot create further managed workers. Keep every writer in its own assigned worktree. These tools do not create worktrees.
13
+ Both the parent and managed workers may use native `subagent` when useful. Delegation is optional. Managed workers cannot create further managed workers. Count both modes and workers' native subagents against the active protocol's delegation budget. Keep every writer in its own assigned worktree. These tools do not create worktrees.
14
14
 
15
15
  ## Start work
16
16
 
17
17
  1. Confirm the `threads_spawn` tool is available. If it is unavailable, use native `subagent` or report that the plugin needs activation. Do not substitute a hidden `opencode run` process.
18
18
  2. Assign an existing absolute directory and a stable task key.
19
- 3. Call `threads_spawn` with `key`, `title`, `directory`, and `task`. Include the goal, scope, relevant context, constraints, acceptance criteria, verification commands, and expected report in `task`.
19
+ 3. Call `threads_spawn` with `key`, `title`, `directory`, and `task`. Include the goal, scope, relevant context, constraints, delegation allowance, acceptance criteria, verification commands, and expected report in `task`.
20
20
  4. Save the returned worker session ID with the work unit.
21
21
 
22
22
  An identical spawn key retries the original admission. Different work requires a new key. A worker inherits the coordinator's agent, model, and permission constraints. It has a separate conversation, so include all context it needs in the task brief.
23
23
 
24
+ ## Write the delegation allowance
25
+
26
+ The parent writes `task`; the plugin appends worker instructions. Give workers the option to delegate without requiring a sub-coordinator role. Include this allowance and the worker's share of the remaining delegation budget:
27
+
28
+ > You may work directly or use native `subagent` for bounded tasks and reviews when useful. Pass your scope and constraints to subagents, review their results, and resolve outstanding work before calling `threads_report` yourself.
29
+
30
+ Use a no-delegation restriction only for a task-specific reason or an explicit user constraint, and state the reason. Being a managed worker or having bounded scope does not by itself make the worker a leaf. To limit managed-thread nesting, say `Do not call threads_spawn` rather than `No children`.
31
+
24
32
  ## Coordinate
25
33
 
26
34
  - Use `threads_list` for a progress snapshot when making a scheduling or delivery decision.
@@ -32,7 +40,7 @@ An identical spawn key retries the original admission. Different work requires a
32
40
 
33
41
  ## Finish
34
42
 
35
- The worker calls `threads_report` with a verdict, concise summary, and concrete evidence, then stops. Valid verdicts are `PASS`, `PASS WITH NOTES`, `FAIL`, and `INCONCLUSIVE`. Report partial work and blockers honestly.
43
+ The worker reviews its subagents' results and resolves outstanding work before calling `threads_report` with a combined verdict, concise summary, and concrete evidence, then stops. Native subagents return results to the worker. Valid verdicts are `PASS`, `PASS WITH NOTES`, `FAIL`, and `INCONCLUSIVE`. Report partial work and blockers honestly.
36
44
 
37
45
  A worker report is a claim to review. Run the protocol's independent verification before marking the work unit complete. An idle session or a stopped loading indicator does not establish task success.
38
46
 
package/src/threads.ts CHANGED
@@ -249,7 +249,7 @@ export function threads(
249
249
  sessionID: link.workerID,
250
250
  id: link.initialMessageID,
251
251
  delivery: "queue",
252
- text: `${input.task}\n\nYou are a managed worker assigned to ${input.directory}. Work only within the assigned scope. Do not call threads_spawn. When finished call threads_report with verdict, summary, and evidence. Runtime completion alone does not establish task success.`,
252
+ text: `${input.task}\n\nYou are a managed worker assigned to ${input.directory}. Work only within the assigned scope. You may use native subagent for bounded tasks or reviews when useful, within the brief's delegation limits and inherited permissions. Delegation is optional. Pass relevant context, scope, and constraints to each subagent. Do not call threads_spawn. Review your subagents' results and resolve any outstanding work before reporting. Only you call threads_report with the combined verdict, summary, and evidence; subagents return results to you. Runtime completion alone does not establish task success.`,
253
253
  });
254
254
  return view(await ctx.session.get({ sessionID: workerID }));
255
255
  });