opencode-cmux 0.1.1 → 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.
@@ -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,MAqFb,CAAA;AAED,eAAe,MAAM,CAAA"}
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
- if (event.type === "session.status") {
69
- const { sessionID, status } = event.properties;
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 (event.type === "session.error") {
94
- const sessionID = event.properties.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.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",