@cotal-ai/connector-opencode 0.72.1 → 0.76.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.
- package/dist/index.js +6 -6
- package/dist/launch.d.ts.map +1 -1
- package/dist/launch.js +13 -5
- package/dist/plugin/index.js +718 -254
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin2.d.ts.map +1 -1
- package/dist/serve.js +13 -5
- package/package.json +3 -3
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuCA,OAAO,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAuCA,OAAO,EAIL,SAAS,EAqBV,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,MA2wCnB,CAAC"}
|
package/dist/plugin2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin2.d.ts","sourceRoot":"","sources":["../src/plugin2.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin2.d.ts","sourceRoot":"","sources":["../src/plugin2.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAiB7D;;;;;;8EAM8E;AAC9E,eAAO,MAAM,oBAAoB,QAAS,CAAC;AAoC3C,4CAA4C;AAC5C,wBAAsB,UAAU,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CA4T7F"}
|
package/dist/serve.js
CHANGED
|
@@ -3,7 +3,7 @@ import { execFileSync, spawn } from "node:child_process";
|
|
|
3
3
|
import { createServer } from "node:net";
|
|
4
4
|
import { once } from "node:events";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
|
-
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, rmdirSync, rmSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { delimiter, join } from "node:path";
|
|
8
8
|
|
|
9
9
|
// src/opencode-line.ts
|
|
@@ -70,15 +70,18 @@ function processCommand(pid) {
|
|
|
70
70
|
return void 0;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
73
|
+
function pidAlive(pid) {
|
|
75
74
|
try {
|
|
76
75
|
process.kill(pid, 0);
|
|
76
|
+
return true;
|
|
77
77
|
} catch {
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
|
+
}
|
|
81
|
+
function isLiveOpencodeServe(pid) {
|
|
82
|
+
if (!Number.isInteger(pid) || pid <= 0 || !pidAlive(pid)) return false;
|
|
80
83
|
const cmd = processCommand(pid);
|
|
81
|
-
if (!cmd) return
|
|
84
|
+
if (!cmd) return pidAlive(pid);
|
|
82
85
|
return /\bserve\b/.test(cmd) && (/(?:^|[\\/\s])opencode(?:\.exe)?(?:\s|$)/i.test(cmd) || /--hostname\s+127\.0\.0\.1\b/.test(cmd) && /--port\s+\d+\b/.test(cmd));
|
|
83
86
|
}
|
|
84
87
|
async function launch(tuiArgv, serveEnv) {
|
|
@@ -92,7 +95,12 @@ async function launch(tuiArgv, serveEnv) {
|
|
|
92
95
|
const pidFile = join(agentHome, "serve.pid");
|
|
93
96
|
let recorded;
|
|
94
97
|
try {
|
|
95
|
-
|
|
98
|
+
try {
|
|
99
|
+
recorded = readFileSync(pidFile, "utf8");
|
|
100
|
+
} catch (e) {
|
|
101
|
+
if (e.code !== "EISDIR") throw e;
|
|
102
|
+
rmdirSync(pidFile);
|
|
103
|
+
}
|
|
96
104
|
} catch (e) {
|
|
97
105
|
if (e.code !== "ENOENT") throw e;
|
|
98
106
|
}
|
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.
|
|
4
|
+
"version": "0.76.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.
|
|
25
|
-
"@cotal-ai/core": "0.
|
|
24
|
+
"@cotal-ai/connector-core": "0.76.0",
|
|
25
|
+
"@cotal-ai/core": "0.76.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",
|