@plannotator/opencode 0.5.0-beta.1 → 0.5.0-beta.2
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 +970 -0
- package/package.json +4 -5
- package/index.ts +0 -105
- package/plannotator.html +0 -458
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plannotator/opencode",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
4
|
"description": "Plannotator plugin for OpenCode - interactive plan review with visual annotation",
|
|
5
5
|
"author": "backnotprop",
|
|
6
6
|
"license": "BSL-1.1",
|
|
@@ -21,14 +21,13 @@
|
|
|
21
21
|
"ai-agent",
|
|
22
22
|
"coding-agent"
|
|
23
23
|
],
|
|
24
|
-
"main": "index.
|
|
24
|
+
"main": "dist/index.js",
|
|
25
25
|
"files": [
|
|
26
|
-
"
|
|
27
|
-
"plannotator.html",
|
|
26
|
+
"dist",
|
|
28
27
|
"README.md"
|
|
29
28
|
],
|
|
30
29
|
"scripts": {
|
|
31
|
-
"build": "cp ../hook/dist/index.html ./plannotator.html",
|
|
30
|
+
"build": "cp ../hook/dist/index.html ./plannotator.html && bun build index.ts --outfile dist/index.js --target bun --external @opencode-ai/plugin",
|
|
32
31
|
"prepublishOnly": "bun run build"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
package/index.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plannotator Plugin for OpenCode
|
|
3
|
-
*
|
|
4
|
-
* Provides a Claude Code-style planning experience with interactive plan review.
|
|
5
|
-
* When the agent calls submit_plan, the Plannotator UI opens for the user to
|
|
6
|
-
* annotate, approve, or request changes to the plan.
|
|
7
|
-
*
|
|
8
|
-
* Environment variables:
|
|
9
|
-
* PLANNOTATOR_REMOTE - Set to "1" or "true" for remote mode (devcontainer, SSH)
|
|
10
|
-
* PLANNOTATOR_PORT - Fixed port to use (default: random locally, 19432 for remote)
|
|
11
|
-
*
|
|
12
|
-
* @packageDocumentation
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { type Plugin, tool } from "@opencode-ai/plugin";
|
|
16
|
-
import {
|
|
17
|
-
startPlannotatorServer,
|
|
18
|
-
handleServerReady,
|
|
19
|
-
} from "@plannotator/server";
|
|
20
|
-
|
|
21
|
-
// @ts-ignore - Bun import attribute for text
|
|
22
|
-
import indexHtml from "./plannotator.html" with { type: "text" };
|
|
23
|
-
const htmlContent = indexHtml as unknown as string;
|
|
24
|
-
|
|
25
|
-
export const PlannotatorPlugin: Plugin = async (ctx) => {
|
|
26
|
-
return {
|
|
27
|
-
"experimental.chat.system.transform": async (_input, output) => {
|
|
28
|
-
output.system.push(`
|
|
29
|
-
## Plan Submission
|
|
30
|
-
|
|
31
|
-
When you have completed your plan, you MUST call the \`submit_plan\` tool to submit it for user review.
|
|
32
|
-
The user will be able to:
|
|
33
|
-
- Review your plan visually in a dedicated UI
|
|
34
|
-
- Annotate specific sections with feedback
|
|
35
|
-
- Approve the plan to proceed with implementation
|
|
36
|
-
- Request changes with detailed feedback
|
|
37
|
-
|
|
38
|
-
If your plan is rejected, you will receive the user's annotated feedback. Revise your plan
|
|
39
|
-
based on their feedback and call submit_plan again.
|
|
40
|
-
|
|
41
|
-
Do NOT proceed with implementation until your plan is approved.
|
|
42
|
-
`);
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
tool: {
|
|
46
|
-
submit_plan: tool({
|
|
47
|
-
description:
|
|
48
|
-
"Submit your completed plan for interactive user review. The user can annotate, approve, or request changes. Call this when you have finished creating your implementation plan.",
|
|
49
|
-
args: {
|
|
50
|
-
plan: tool.schema
|
|
51
|
-
.string()
|
|
52
|
-
.describe("The complete implementation plan in markdown format"),
|
|
53
|
-
summary: tool.schema
|
|
54
|
-
.string()
|
|
55
|
-
.describe("A brief 1-2 sentence summary of what the plan accomplishes"),
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
async execute(args, _context) {
|
|
59
|
-
const server = await startPlannotatorServer({
|
|
60
|
-
plan: args.plan,
|
|
61
|
-
origin: "opencode",
|
|
62
|
-
htmlContent,
|
|
63
|
-
onReady: (url, isRemote, port) => {
|
|
64
|
-
handleServerReady(url, isRemote, port);
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const result = await server.waitForDecision();
|
|
69
|
-
await Bun.sleep(1500);
|
|
70
|
-
server.stop();
|
|
71
|
-
|
|
72
|
-
if (result.approved) {
|
|
73
|
-
try {
|
|
74
|
-
await ctx.client.tui.executeCommand({
|
|
75
|
-
body: { command: "agent_cycle" },
|
|
76
|
-
});
|
|
77
|
-
} catch {
|
|
78
|
-
// Silently fail - agent switching is optional
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return `Plan approved! Switching to build mode.
|
|
82
|
-
|
|
83
|
-
Your plan has been approved by the user. You may now proceed with implementation.
|
|
84
|
-
|
|
85
|
-
Plan Summary: ${args.summary}`;
|
|
86
|
-
} else {
|
|
87
|
-
return `Plan needs revision.
|
|
88
|
-
|
|
89
|
-
The user has requested changes to your plan. Please review their feedback below and revise your plan accordingly.
|
|
90
|
-
|
|
91
|
-
## User Feedback
|
|
92
|
-
|
|
93
|
-
${result.feedback}
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
Please revise your plan based on this feedback and call \`submit_plan\` again when ready.`;
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
}),
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export default PlannotatorPlugin;
|