opencode-cmux 0.1.0 → 0.1.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/README.md +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -13
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# opencode-cmux
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/opencode-cmux)
|
|
4
|
+
|
|
3
5
|
OpenCode plugin that bridges OpenCode events to cmux notifications and sidebar metadata.
|
|
4
6
|
|
|
5
7
|
## Requirements
|
|
@@ -10,13 +12,7 @@ OpenCode plugin that bridges OpenCode events to cmux notifications and sidebar m
|
|
|
10
12
|
|
|
11
13
|
## Installation
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Install the package and add it to `~/.config/opencode/opencode.json`:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install -g opencode-cmux
|
|
19
|
-
```
|
|
15
|
+
Add to `~/.config/opencode/opencode.json`:
|
|
20
16
|
|
|
21
17
|
```json
|
|
22
18
|
{
|
|
@@ -24,6 +20,8 @@ npm install -g opencode-cmux
|
|
|
24
20
|
}
|
|
25
21
|
```
|
|
26
22
|
|
|
23
|
+
OpenCode will download the package automatically on next start.
|
|
24
|
+
|
|
27
25
|
### Local / development
|
|
28
26
|
|
|
29
27
|
Build the package, then symlink the output directly into OpenCode's plugin directory:
|
|
@@ -32,6 +30,8 @@ Build the package, then symlink the output directly into OpenCode's plugin direc
|
|
|
32
30
|
ln -sf ~/path/to/opencode-cmux/dist/index.js ~/.config/opencode/plugins/cmux.js
|
|
33
31
|
```
|
|
34
32
|
|
|
33
|
+
Make sure `opencode-cmux` is **not** listed in `opencode.json` when using the symlink, to avoid loading it twice.
|
|
34
|
+
|
|
35
35
|
## What it does
|
|
36
36
|
|
|
37
37
|
| Event | cmux action |
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,QAAA,MAAM,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD,QAAA,MAAM,MAAM,EAAE,MA6Fb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -65,8 +65,9 @@ var plugin = async ({ client, $ }) => {
|
|
|
65
65
|
}
|
|
66
66
|
return {
|
|
67
67
|
async event({ event }) {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const e = event;
|
|
69
|
+
if (e.type === "session.status") {
|
|
70
|
+
const { sessionID, status } = e.properties;
|
|
70
71
|
if (status.type === "busy") {
|
|
71
72
|
await setStatus($, "opencode", "working", {
|
|
72
73
|
icon: "terminal",
|
|
@@ -90,8 +91,8 @@ var plugin = async ({ client, $ }) => {
|
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
93
|
}
|
|
93
|
-
if (
|
|
94
|
-
const sessionID =
|
|
94
|
+
if (e.type === "session.error") {
|
|
95
|
+
const sessionID = e.properties.sessionID;
|
|
95
96
|
const title = sessionID ? (await fetchSession(sessionID))?.title ?? sessionID : "unknown session";
|
|
96
97
|
await notify($, { title: `Error: ${title}` });
|
|
97
98
|
await log($, `Error in session: ${title}`, {
|
|
@@ -99,6 +100,21 @@ var plugin = async ({ client, $ }) => {
|
|
|
99
100
|
source: "opencode"
|
|
100
101
|
});
|
|
101
102
|
await clearStatus($, "opencode");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (e.type === "question.asked") {
|
|
106
|
+
const header = e.properties.questions[0]?.header ?? "Question";
|
|
107
|
+
await setStatus($, "opencode", "question", {
|
|
108
|
+
icon: "help-circle",
|
|
109
|
+
color: "#a855f7"
|
|
110
|
+
});
|
|
111
|
+
await notify($, { title: "Has a question", subtitle: header });
|
|
112
|
+
await log($, `Question: ${header}`, { level: "info", source: "opencode" });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (e.type === "question.replied" || e.type === "question.rejected") {
|
|
116
|
+
await clearStatus($, "opencode");
|
|
117
|
+
return;
|
|
102
118
|
}
|
|
103
119
|
},
|
|
104
120
|
async "permission.ask"(input) {
|
|
@@ -107,15 +123,6 @@ var plugin = async ({ client, $ }) => {
|
|
|
107
123
|
icon: "lock",
|
|
108
124
|
color: "#ef4444"
|
|
109
125
|
});
|
|
110
|
-
},
|
|
111
|
-
async "tool.execute.before"(input) {
|
|
112
|
-
if (input.tool === "ask") {
|
|
113
|
-
await notify($, { title: "Has a question" });
|
|
114
|
-
await setStatus($, "opencode", "question", {
|
|
115
|
-
icon: "help-circle",
|
|
116
|
-
color: "#a855f7"
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
126
|
}
|
|
120
127
|
};
|
|
121
128
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "opencode-cmux",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "OpenCode plugin that bridges OpenCode events to cmux notifications and sidebar metadata",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -27,6 +27,14 @@
|
|
|
27
27
|
],
|
|
28
28
|
"author": "Matteo Casonato",
|
|
29
29
|
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/0xCaso/opencode-cmux.git"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/0xCaso/opencode-cmux#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/0xCaso/opencode-cmux/issues"
|
|
37
|
+
},
|
|
30
38
|
"peerDependencies": {
|
|
31
39
|
"@opencode-ai/plugin": ">=1.0.0"
|
|
32
40
|
},
|