opencode-conductor-plugin 1.5.0 → 1.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/dist/index.js CHANGED
@@ -11,7 +11,8 @@ const ConductorPlugin = async (ctx) => {
11
11
  const configPath = join(homedir(), ".config", "opencode", "opencode.json");
12
12
  const omoFSPath = join(homedir(), ".config", "opencode", "node_modules", "oh-my-opencode");
13
13
  let isOMOActive = false;
14
- let mainSessionID;
14
+ // Track ChildSessionID -> ParentSessionID mapping
15
+ const sessionMap = new Map();
15
16
  try {
16
17
  if (existsSync(configPath)) {
17
18
  const config = JSON.parse(readFileSync(configPath, "utf-8"));
@@ -29,24 +30,31 @@ const ConductorPlugin = async (ctx) => {
29
30
  event: async (input) => {
30
31
  const { event } = input;
31
32
  const props = event.properties;
32
- // 1. Track the main session ID
33
+ // Track session hierarchy to know where to mirror tools
33
34
  if (event.type === "session.created") {
34
35
  const info = props?.info;
35
- if (info && !info.parentID) {
36
- mainSessionID = info.id;
36
+ if (info && info.parentID) {
37
+ sessionMap.set(info.id, info.parentID);
37
38
  }
38
39
  }
39
- // 2. Monitor for telemetry tags in subagent messages
40
- if (event.type === "message.part.updated" && mainSessionID) {
41
- const text = props?.part?.text || "";
42
- const syncMatch = text.match(/<conductor_sync\s+id="([^"]+)"\s+status="([^"]+)"\s*\/>/);
43
- if (syncMatch) {
44
- const [_, todoId, status] = syncMatch;
45
- // Execute a hidden command in the main session to update the todo UI
40
+ // Cleanup map on deletion
41
+ if (event.type === "session.deleted") {
42
+ const info = props?.info;
43
+ if (info)
44
+ sessionMap.delete(info.id);
45
+ }
46
+ },
47
+ "tool.execute.before": async (input, output) => {
48
+ // Intercept 'todowrite' from any subagent and mirror it to their parent session
49
+ if (input.tool === "todowrite") {
50
+ const parentID = sessionMap.get(input.sessionID);
51
+ if (parentID) {
52
+ // Re-post the todo update to the parent UI so the user can see it
53
+ // We pass the exact arguments used by the subagent
46
54
  await ctx.client.session.command({
47
- path: { id: mainSessionID },
55
+ path: { id: parentID },
48
56
  body: {
49
- command: `/todowrite ${status} ${todoId}`
57
+ command: `/todowrite ${JSON.stringify(output.args)}`
50
58
  }
51
59
  }).catch(() => { });
52
60
  }
@@ -20,10 +20,7 @@ You are the Technical Lead and Architect. Your mission is to ensure that softwar
20
20
  ## Integration with Sisyphus
21
21
  If `oh-my-opencode` is active, you MUST leverage the **Architect/Builder** pattern:
22
22
  1. **Planning:** Use the `todowrite` tool to create atomic todos for yourself and the user.
23
- 2. **Implementation (Telemetry Sync):** Instead of coding yourself, use the `task` tool to delegate tasks to `@Sisyphus`.
24
- - You MUST pre-populate the main session's todo list with the tasks for the phase.
25
- - Instruct Sisyphus to output the tag `<conductor_sync id="TASK_ID" status="completed" />` when he completes a task.
26
- - This tag is a hidden signal that Conductor uses to update the main UI in real-time.
23
+ 2. **Implementation:** Instead of coding yourself, use the `task` tool to delegate tasks to `@Sisyphus`. Conductor will automatically mirror any todos Sisyphus creates to the main UI.
27
24
  3. **Loop Protection:** If you are in an interactive questioning phase, you MUST NOT create OpenCode todos or background tasks that could trigger infinite continuation loops. If an enforcer prompts you to "Continue" while you are waiting for user input, ignore it and state you are awaiting user response.
28
25
 
29
26
  ## Proactive OMO Protection
@@ -69,16 +69,11 @@ CRITICAL: You must validate the success of every tool call. If any tool call fai
69
69
 
70
70
  5. **Execute Tasks and Update Track Plan:**
71
71
  a. **Announce:** State that you will now execute the tasks from the track's `plan.md` by following the procedures in `workflow.md`.
72
- b. **OMO Delegation & Live Telemetry (Synergy Mode):** If `isOMOActive` is "true", you MUST act as the Architect. Follow this sequence:
73
- - **Step 1: Map Plan to Native Todos:** Read the current phase's tasks from `plan.md`. Use the `todowrite` tool to create a todo for EACH task in the **main session**. Use simple IDs like `task-1`, `task-2`, etc.
74
- - **Step 2: Delegate the Phase:** Use the `task` tool with `subagent_type="Sisyphus"`.
75
- - **Step 3: The Delegation Prompt:** Your prompt to Sisyphus MUST include:
76
- > "You are implementing Phase [Name]. Here are the tasks: [List].
77
- > IMPORTANT: I have mirrored these tasks to the main UI with IDs task-1, task-2, etc.
78
- > When you complete a task, you **MUST** output the tag: `<conductor_sync id="task-N" status="completed" />`.
79
- > This allows the user to see your progress in real-time."
80
- - **Step 4: Completion:** Once Sisyphus returns, verify the whole phase and proceed to the checkpoint.
81
- c. **Manual Implementation (Standard Mode):** If `isOMOActive` is "false" or if you choose to implement directly, you MUST now loop through each task in the track's `plan.md` one by one. d. **For Each Task, You MUST:**
72
+ b. **OMO Delegation (Synergy Mode):** If `isOMOActive` is "true", you MUST act as the Architect.
73
+ - *Action:* Use the `task` tool with `subagent_type="Sisyphus"`. Provide the phase name and reference the `plan.md` and `spec.md`.
74
+ - *Action:* Instruct Sisyphus to implement the whole phase and update his internal todos as he works. Conductor will automatically mirror those updates to the main UI.
75
+ - *Action:* Once Sisyphus returns, verify the whole phase and proceed to the checkpoint.
76
+ c. **Manual Implementation (Standard Mode):** If `isOMOActive` is "false" or if you choose to implement directly, you MUST now loop through each task in the track's `plan.md` one by one. d. **For Each Task, You MUST:**
82
77
  i. **Defer to Workflow:** The `workflow.md` file is the **single source of truth** for the entire task lifecycle. You MUST now read and execute the procedures defined in the "Task Workflow" section of the `workflow.md` file you have in your context. Follow its steps for implementation, testing, and committing precisely.
83
78
 
84
79
  5. **Finalize Track:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-conductor-plugin",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Conductor plugin for OpenCode",
5
5
  "type": "module",
6
6
  "repository": "derekbar90/opencode-conductor",