opencode-agent-ghost-panel 0.1.8 → 0.1.10

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.
Files changed (2) hide show
  1. package/index.js +99 -99
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -43,114 +43,114 @@ function executeAgp(args) {
43
43
  });
44
44
  }
45
45
 
46
- // 定义 AGP 工具
47
- export const agpDiff = tool({
48
- description: "在 tmux 新窗口显示 git diff(带语法高亮)",
49
- args: {
50
- file: z.string().optional().describe("文件路径(可选,默认当前目录)")
51
- },
52
- execute: async (args, context) => {
53
- try {
54
- const cmdArgs = ["diff"];
55
- if (args.file) {
56
- cmdArgs.push("--file", args.file);
46
+ // OpenCode 插件入口 - 只导出一个 Plugin 函数
47
+ export const AgentGhostPanel = async (ctx) => {
48
+ // 定义所有 AGP 工具
49
+ const agpDiff = tool({
50
+ description: "在 tmux 新窗口显示 git diff(带语法高亮)",
51
+ args: {
52
+ file: z.string().optional().describe("文件路径(可选,默认当前目录)")
53
+ },
54
+ execute: async (args) => {
55
+ try {
56
+ const cmdArgs = ["diff"];
57
+ if (args.file) {
58
+ cmdArgs.push("--file", args.file);
59
+ }
60
+ const result = await executeAgp(cmdArgs);
61
+ return `✅ ${result}`;
62
+ } catch (error) {
63
+ return `❌ 执行失败: ${error}`;
57
64
  }
58
- const result = await executeAgp(cmdArgs);
59
- return `✅ ${result}`;
60
- } catch (error) {
61
- return `❌ 执行失败: ${error}`;
62
65
  }
63
- }
64
- });
65
-
66
- export const agpLogs = tool({
67
- description: "实时监控日志文件",
68
- args: {
69
- file: z.string().describe("日志文件路径")
70
- },
71
- execute: async (args, context) => {
72
- try {
73
- const result = await executeAgp(["logs", args.file]);
74
- return `✅ ${result}`;
75
- } catch (error) {
76
- return `❌ 执行失败: ${error}`;
66
+ });
67
+
68
+ const agpLogs = tool({
69
+ description: "实时监控日志文件",
70
+ args: {
71
+ file: z.string().describe("日志文件路径")
72
+ },
73
+ execute: async (args) => {
74
+ try {
75
+ const result = await executeAgp(["logs", args.file]);
76
+ return `✅ ${result}`;
77
+ } catch (error) {
78
+ return `❌ 执行失败: ${error}`;
79
+ }
77
80
  }
78
- }
79
- });
80
-
81
- export const agpInteractive = tool({
82
- description: "打开交互式终端(用于 ssh、sudo 等需要用户输入的命令)",
83
- args: {
84
- command: z.string().optional().describe("初始命令(可选)")
85
- },
86
- execute: async (args, context) => {
87
- try {
88
- const cmdArgs = ["interactive"];
89
- if (args.command) {
90
- cmdArgs.push(args.command);
81
+ });
82
+
83
+ const agpInteractive = tool({
84
+ description: "打开交互式终端(用于 ssh、sudo 等需要用户输入的命令)",
85
+ args: {
86
+ command: z.string().optional().describe("初始命令(可选)")
87
+ },
88
+ execute: async (args) => {
89
+ try {
90
+ const cmdArgs = ["interactive"];
91
+ if (args.command) {
92
+ cmdArgs.push(args.command);
93
+ }
94
+ const result = await executeAgp(cmdArgs);
95
+ return `✅ ${result}`;
96
+ } catch (error) {
97
+ return `❌ 执行失败: ${error}`;
91
98
  }
92
- const result = await executeAgp(cmdArgs);
93
- return `✅ ${result}`;
94
- } catch (error) {
95
- return `❌ 执行失败: ${error}`;
96
99
  }
97
- }
98
- });
99
-
100
- export const agpStatus = tool({
101
- description: "查看 AGP 守护进程状态",
102
- args: {},
103
- execute: async (args, context) => {
104
- try {
105
- const result = await executeAgp(["status"]);
106
- return result;
107
- } catch (error) {
108
- return `❌ AGP 未运行。请先运行: agp start`;
100
+ });
101
+
102
+ const agpStatus = tool({
103
+ description: "查看 AGP 守护进程状态",
104
+ args: {},
105
+ execute: async () => {
106
+ try {
107
+ const result = await executeAgp(["status"]);
108
+ return result;
109
+ } catch (error) {
110
+ return `❌ AGP 未运行。请先运行: agp start`;
111
+ }
109
112
  }
110
- }
111
- });
112
-
113
- export const agpSessions = tool({
114
- description: "列出所有 tmux 会话",
115
- args: {},
116
- execute: async (args, context) => {
117
- try {
118
- const result = await executeAgp(["sessions"]);
119
- return result;
120
- } catch (error) {
121
- return `❌ 执行失败: ${error}`;
113
+ });
114
+
115
+ const agpSessions = tool({
116
+ description: "列出所有 tmux 会话",
117
+ args: {},
118
+ execute: async () => {
119
+ try {
120
+ const result = await executeAgp(["sessions"]);
121
+ return result;
122
+ } catch (error) {
123
+ return `❌ 执行失败: ${error}`;
124
+ }
122
125
  }
123
- }
124
- });
125
-
126
- export const agpStart = tool({
127
- description: "启动 AGP 守护进程",
128
- args: {},
129
- execute: async (args, context) => {
130
- try {
131
- const result = await executeAgp(["start"]);
132
- return result;
133
- } catch (error) {
134
- return `❌ 启动失败: ${error}`;
126
+ });
127
+
128
+ const agpStart = tool({
129
+ description: "启动 AGP 守护进程",
130
+ args: {},
131
+ execute: async () => {
132
+ try {
133
+ const result = await executeAgp(["start"]);
134
+ return result;
135
+ } catch (error) {
136
+ return `❌ 启动失败: ${error}`;
137
+ }
135
138
  }
136
- }
137
- });
138
-
139
- export const agpStop = tool({
140
- description: "停止 AGP 守护进程",
141
- args: {},
142
- execute: async (args, context) => {
143
- try {
144
- const result = await executeAgp(["stop"]);
145
- return result;
146
- } catch (error) {
147
- return `❌ 停止失败: ${error}`;
139
+ });
140
+
141
+ const agpStop = tool({
142
+ description: "停止 AGP 守护进程",
143
+ args: {},
144
+ execute: async () => {
145
+ try {
146
+ const result = await executeAgp(["stop"]);
147
+ return result;
148
+ } catch (error) {
149
+ return `❌ 停止失败: ${error}`;
150
+ }
148
151
  }
149
- }
150
- });
152
+ });
151
153
 
152
- // OpenCode 插件入口 - 必须是 async function
153
- export default async function(input) {
154
154
  return {
155
155
  tool: {
156
156
  "agp-diff": agpDiff,
@@ -162,4 +162,4 @@ export default async function(input) {
162
162
  "agp-stop": agpStop
163
163
  }
164
164
  };
165
- }
165
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-agent-ghost-panel",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Agent Ghost Panel Plugin for OpenCode",
5
5
  "main": "index.js",
6
6
  "type": "module",