@cotal-ai/connector-opencode 0.67.0 → 0.69.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.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuCA,OAAO,EAGL,SAAS,EAoBV,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,qBAAqB,CAAC;AAgBzE;;;0EAG0E;AAC1E,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAC1D,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAC5D;iEACiE;AACjE,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAChD;;gCAEgC;AAChC,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C;;0EAE0E;AAC1E,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAElF;AACD,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYnH;AA8BD;;;;GAIG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqB1G;AACD,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,SAAS,CAQZ;AAED,eAAO,MAAM,KAAK,EAAE,MAkwCnB,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuCA,OAAO,EAGL,SAAS,EAoBV,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAK,EAAE,MAAM,EAAyB,MAAM,qBAAqB,CAAC;AAgBzE;;;0EAG0E;AAC1E,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAC1D,gGAAgG;AAChG,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAC5D;iEACiE;AACjE,eAAO,MAAM,UAAU,wBAAwB,CAAC;AAChD;;gCAEgC;AAChC,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAC5C;;0EAE0E;AAC1E,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAElF;AACD,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYnH;AA8BD;;;;GAIG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqB1G;AACD,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,GAAG,SAAS,CAQZ;AAED,eAAO,MAAM,KAAK,EAAE,MA8vCnB,CAAC"}
package/dist/serve.js CHANGED
@@ -31,7 +31,7 @@ function resolveOpencodeBin() {
31
31
  }
32
32
  var BIN = resolveOpencodeBin();
33
33
  var USERNAME = "opencode";
34
- var SECRET = randomBytes(24).toString("hex");
34
+ var SECRET = process.env.OPENCODE_SERVER_PASSWORD || randomBytes(24).toString("hex");
35
35
  async function freePort() {
36
36
  const srv = createServer();
37
37
  srv.listen(0, "127.0.0.1");
@@ -40,16 +40,16 @@ async function freePort() {
40
40
  await new Promise((r) => srv.close(() => r()));
41
41
  return port;
42
42
  }
43
- async function killServe(serve) {
44
- if (serve.exitCode !== null || serve.signalCode !== null) return;
45
- serve.kill("SIGTERM");
43
+ async function terminate(child) {
44
+ if (child.exitCode !== null || child.signalCode !== null) return;
45
+ child.kill("SIGTERM");
46
46
  const dead = await Promise.race([
47
- once(serve, "exit").then(() => true),
47
+ once(child, "exit").then(() => true),
48
48
  new Promise((r) => setTimeout(() => r(false), 3e3))
49
49
  ]);
50
50
  if (!dead) {
51
- serve.kill("SIGKILL");
52
- await once(serve, "exit");
51
+ child.kill("SIGKILL");
52
+ await once(child, "exit");
53
53
  }
54
54
  }
55
55
  function processCommand(pid) {
@@ -151,14 +151,14 @@ async function main() {
151
151
  `[cotal-connector] serve: agent session never came up (~60s) \u2014 aborting. Check the boot log above for plugin/mesh errors (OPENCODE_DB=${dbPath})
152
152
  `
153
153
  );
154
- await killServe(serve);
154
+ await terminate(serve);
155
155
  process.exit(1);
156
156
  }
157
157
  if (process.env.COTAL_SERVE_HEADLESS?.trim() === "1") {
158
- process.stdout.write(`[cotal-serve] ${JSON.stringify({ port: Number(port), session: id, password: SECRET })}
158
+ process.stdout.write(`[cotal-serve] ${JSON.stringify({ port: Number(port), session: id })}
159
159
  `);
160
160
  for (const sig of ["SIGINT", "SIGTERM"])
161
- process.on(sig, () => void killServe(serve).then(() => process.exit(0)));
161
+ process.on(sig, () => void terminate(serve).then(() => process.exit(0)));
162
162
  return;
163
163
  }
164
164
  const tuiEnv = {
@@ -170,14 +170,15 @@ async function main() {
170
170
  delete tuiEnv.OPENCODE_CONFIG_CONTENT;
171
171
  for (const k of Object.keys(tuiEnv)) if (k.startsWith("COTAL_")) delete tuiEnv[k];
172
172
  attached = true;
173
- const tui = line === 2 ? spawn(BIN, ["--server", url, "--session", id], { env: tuiEnv, stdio: "inherit" }) : spawn(BIN, ["attach", url, "--session", id, "--password", SECRET], { env: tuiEnv, stdio: "inherit" });
173
+ const tui = line === 2 ? spawn(BIN, ["--server", url, "--session", id], { env: tuiEnv, stdio: "inherit" }) : spawn(BIN, ["attach", url, "--session", id], { env: tuiEnv, stdio: "inherit" });
174
174
  for (const sig of ["SIGINT", "SIGTERM"])
175
175
  process.on(sig, () => {
176
176
  tui.kill(sig);
177
177
  serve.kill(sig);
178
178
  });
179
+ serve.on("exit", () => void terminate(tui));
179
180
  tui.on("exit", (code, signal) => {
180
- void killServe(serve).then(() => process.exit(code ?? (signal ? 1 : 0)));
181
+ void terminate(serve).then(() => process.exit(code ?? (signal ? 1 : 0)));
181
182
  });
182
183
  }
183
184
  void main();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cotal-ai/connector-opencode",
3
3
  "description": "Cotal connector for OpenCode: a native in-process plugin that joins a session to the mesh.",
4
- "version": "0.67.0",
4
+ "version": "0.69.0",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -21,8 +21,8 @@
21
21
  "@cotal-ai/core": ">=0.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@cotal-ai/connector-core": "0.67.0",
25
- "@cotal-ai/core": "0.67.0",
24
+ "@cotal-ai/connector-core": "0.69.0",
25
+ "@cotal-ai/core": "0.69.0",
26
26
  "@cotal-ai/smoke-kit": "0.0.0",
27
27
  "@nats-io/transport-node": "^3.4.0",
28
28
  "@opencode-ai/plugin": "^1.16.2",