opencode-conductor-plugin 1.4.0 → 1.5.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,28 +11,47 @@ 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
15
  try {
15
16
  if (existsSync(configPath)) {
16
17
  const config = JSON.parse(readFileSync(configPath, "utf-8"));
17
- // Check both "plugin" and "plugins" keys for robustness
18
18
  const plugins = config.plugin || config.plugins || [];
19
19
  isOMOActive = plugins.some((p) => (typeof p === "string" && p.includes("oh-my-opencode")) ||
20
20
  (p && typeof p === "object" && p.name?.includes("oh-my-opencode")));
21
21
  }
22
22
  }
23
- catch (e) {
24
- // Silent fail on JSON parse
25
- }
26
- // Double check filesystem if config check didn't find it
27
- if (!isOMOActive) {
23
+ catch (e) { }
24
+ if (!isOMOActive)
28
25
  isOMOActive = existsSync(omoFSPath);
29
- }
30
26
  console.log(`[Conductor] Plugin tools loaded. (Synergy: ${isOMOActive ? "Enabled" : "Disabled"})`);
31
- if (!isOMOActive) {
32
- console.log(`[Conductor] Debug: Checked ${configPath} and ${omoFSPath}`);
33
- }
34
27
  const extendedCtx = { ...ctx, isOMOActive };
35
28
  return {
29
+ event: async (input) => {
30
+ const { event } = input;
31
+ const props = event.properties;
32
+ // 1. Track the main session ID
33
+ if (event.type === "session.created") {
34
+ const info = props?.info;
35
+ if (info && !info.parentID) {
36
+ mainSessionID = info.id;
37
+ }
38
+ }
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
46
+ await ctx.client.session.command({
47
+ path: { id: mainSessionID },
48
+ body: {
49
+ command: `/todowrite ${status} ${todoId}`
50
+ }
51
+ }).catch(() => { });
52
+ }
53
+ }
54
+ },
36
55
  config: async (config) => {
37
56
  // 1. Enable delegation to Sisyphus by making it a subagent-capable agent
38
57
  if (config.agent?.["Sisyphus"] && config.agent["Sisyphus"].mode === "primary") {
@@ -20,8 +20,10 @@ 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:** Instead of coding yourself, use the `task` tool to delegate tasks to `@Sisyphus`.
24
- - *Example:* `task(subagent_type="Sisyphus", prompt="Implement feature X using spec in file Y. Follow workflow Z.")`
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.
25
27
  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.
26
28
 
27
29
  ## Proactive OMO Protection
@@ -69,11 +69,16 @@ 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 (Synergy Mode):** If `isOMOActive` is "true", you SHOULD consider yourself the Architect. Instead of implementing every code change yourself, you MUST delegate the granular TDD loops for each task to Sisyphus using the `task` tool.
73
- - *Action:* For each task, announce: "Delegating implementation of task [Name] to Sisyphus."
74
- - *Action:* Use the `task` tool with `subagent_type="Sisyphus"`. Provide the task description and reference the `spec.md` and `workflow.md` in the prompt.
75
- - *Action:* Once Sisyphus completes the task, you verify it against the plan and move to the next.
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:**
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:**
77
82
  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.
78
83
 
79
84
  5. **Finalize Track:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-conductor-plugin",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Conductor plugin for OpenCode",
5
5
  "type": "module",
6
6
  "repository": "derekbar90/opencode-conductor",