opencode-conductor-plugin 1.4.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 +37 -10
- package/dist/prompts/agent/conductor.md +1 -2
- package/dist/prompts/implement.toml +5 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,28 +11,55 @@ 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
|
+
// Track ChildSessionID -> ParentSessionID mapping
|
|
15
|
+
const sessionMap = new Map();
|
|
14
16
|
try {
|
|
15
17
|
if (existsSync(configPath)) {
|
|
16
18
|
const config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
17
|
-
// Check both "plugin" and "plugins" keys for robustness
|
|
18
19
|
const plugins = config.plugin || config.plugins || [];
|
|
19
20
|
isOMOActive = plugins.some((p) => (typeof p === "string" && p.includes("oh-my-opencode")) ||
|
|
20
21
|
(p && typeof p === "object" && p.name?.includes("oh-my-opencode")));
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
// Double check filesystem if config check didn't find it
|
|
27
|
-
if (!isOMOActive) {
|
|
24
|
+
catch (e) { }
|
|
25
|
+
if (!isOMOActive)
|
|
28
26
|
isOMOActive = existsSync(omoFSPath);
|
|
29
|
-
}
|
|
30
27
|
console.log(`[Conductor] Plugin tools loaded. (Synergy: ${isOMOActive ? "Enabled" : "Disabled"})`);
|
|
31
|
-
if (!isOMOActive) {
|
|
32
|
-
console.log(`[Conductor] Debug: Checked ${configPath} and ${omoFSPath}`);
|
|
33
|
-
}
|
|
34
28
|
const extendedCtx = { ...ctx, isOMOActive };
|
|
35
29
|
return {
|
|
30
|
+
event: async (input) => {
|
|
31
|
+
const { event } = input;
|
|
32
|
+
const props = event.properties;
|
|
33
|
+
// Track session hierarchy to know where to mirror tools
|
|
34
|
+
if (event.type === "session.created") {
|
|
35
|
+
const info = props?.info;
|
|
36
|
+
if (info && info.parentID) {
|
|
37
|
+
sessionMap.set(info.id, info.parentID);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
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
|
|
54
|
+
await ctx.client.session.command({
|
|
55
|
+
path: { id: parentID },
|
|
56
|
+
body: {
|
|
57
|
+
command: `/todowrite ${JSON.stringify(output.args)}`
|
|
58
|
+
}
|
|
59
|
+
}).catch(() => { });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
36
63
|
config: async (config) => {
|
|
37
64
|
// 1. Enable delegation to Sisyphus by making it a subagent-capable agent
|
|
38
65
|
if (config.agent?.["Sisyphus"] && config.agent["Sisyphus"].mode === "primary") {
|
|
@@ -20,8 +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:** 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:** 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.
|
|
25
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.
|
|
26
25
|
|
|
27
26
|
## Proactive OMO Protection
|
|
@@ -69,11 +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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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:**
|
|
77
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.
|
|
78
78
|
|
|
79
79
|
5. **Finalize Track:**
|