@opencoop/opencode-plugin 1.1.2 → 1.2.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.d.ts +5 -4
- package/dist/index.js +7 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { PluginModule } from "@opencode-ai/plugin";
|
|
2
1
|
import { OpenCOOPServer } from "./server/mcp-server.js";
|
|
3
|
-
declare
|
|
4
|
-
|
|
2
|
+
declare const plugin: {
|
|
3
|
+
id: string;
|
|
4
|
+
setup: () => Promise<void>;
|
|
5
|
+
};
|
|
5
6
|
export default plugin;
|
|
6
|
-
export { OpenCOOPServer
|
|
7
|
+
export { OpenCOOPServer };
|
|
7
8
|
export type { ServerConfig } from "./types/index.js";
|
package/dist/index.js
CHANGED
|
@@ -3,28 +3,11 @@ import { logger } from "./utils/logger.js";
|
|
|
3
3
|
import { OpenCOOPServer } from "./server/mcp-server.js";
|
|
4
4
|
let serverInstance = null;
|
|
5
5
|
let serverReady = false;
|
|
6
|
-
function
|
|
7
|
-
return new Promise((resolve) => {
|
|
8
|
-
const start = Date.now();
|
|
9
|
-
const check = () => {
|
|
10
|
-
if (serverReady) {
|
|
11
|
-
resolve(true);
|
|
12
|
-
}
|
|
13
|
-
else if (Date.now() - start > timeoutMs) {
|
|
14
|
-
resolve(false);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
setTimeout(check, 100);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
check();
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
const server = async (input, options) => {
|
|
6
|
+
async function startServer() {
|
|
24
7
|
console.log("[OpenCOOP] Plugin loading...");
|
|
25
8
|
logger.info("OpenCOOP plugin loading...");
|
|
26
9
|
try {
|
|
27
|
-
const config = await loadConfig(
|
|
10
|
+
const config = await loadConfig();
|
|
28
11
|
const port = config.port || 31313;
|
|
29
12
|
serverInstance = new OpenCOOPServer(config);
|
|
30
13
|
await serverInstance.startHttp(port);
|
|
@@ -38,26 +21,13 @@ const server = async (input, options) => {
|
|
|
38
21
|
console.error("[OpenCOOP] Failed to start:", msg);
|
|
39
22
|
logger.error("Failed to start OpenCOOP: %s", msg);
|
|
40
23
|
}
|
|
41
|
-
|
|
42
|
-
dispose: async () => {
|
|
43
|
-
serverReady = false;
|
|
44
|
-
logger.info("OpenCOOP plugin disposing...");
|
|
45
|
-
if (serverInstance) {
|
|
46
|
-
try {
|
|
47
|
-
await serverInstance.stop();
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
// Ignore
|
|
51
|
-
}
|
|
52
|
-
serverInstance = null;
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
};
|
|
24
|
+
}
|
|
57
25
|
const plugin = {
|
|
58
26
|
id: "opencoop",
|
|
59
|
-
|
|
27
|
+
setup: async () => {
|
|
28
|
+
await startServer();
|
|
29
|
+
},
|
|
60
30
|
};
|
|
61
31
|
export default plugin;
|
|
62
|
-
export { OpenCOOPServer
|
|
32
|
+
export { OpenCOOPServer };
|
|
63
33
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,IAAI,cAAc,GAA0B,IAAI,CAAC;AACjD,IAAI,WAAW,GAAG,KAAK,CAAC;AAExB,KAAK,UAAU,WAAW;IACxB,OAAO,CAAC,GAAG,CAAC,8BA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