From 176c82f1acca853a897d4b31be0fbf2cfb94ad03 Mon Sep 17 00:00:00 2001 From: xiongxiao Date: Fri, 13 Mar 2026 01:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=20cnb=20=E5=AF=BC=E5=87=BA=EF=BC=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20opencode=20=E5=AE=A2=E6=88=B7=E7=AB=AF=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/app.ts | 2 -- agent/routes/chat/chat.ts | 2 +- agent/routes/opencode/index.ts | 12 ++++++++++++ mod.ts | 1 - package.json | 11 ++++++----- 5 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 agent/routes/opencode/index.ts delete mode 100644 mod.ts diff --git a/agent/app.ts b/agent/app.ts index 9580434..00e1aab 100644 --- a/agent/app.ts +++ b/agent/app.ts @@ -22,8 +22,6 @@ try { process.exit(1) } await new Promise(resolve => setTimeout(resolve, 1000)) -export const cnbItem = await cnbManager.getCNB({ username: 'default' }); -export const cnb = cnbItem?.cnb; export const app = await useContextKey('app', () => { return new App({}) }) diff --git a/agent/routes/chat/chat.ts b/agent/routes/chat/chat.ts index 94dc7ef..4ad3d8c 100644 --- a/agent/routes/chat/chat.ts +++ b/agent/routes/chat/chat.ts @@ -1,5 +1,5 @@ import { runAgent } from '@kevisual/ai/agent' -import { app, notCNBCheck, cnbManager, cnb } from '../../app.ts'; +import { app, cnbManager } from '../../app.ts'; import z from 'zod'; app.route({ diff --git a/agent/routes/opencode/index.ts b/agent/routes/opencode/index.ts new file mode 100644 index 0000000..b69997a --- /dev/null +++ b/agent/routes/opencode/index.ts @@ -0,0 +1,12 @@ +import { createOpencodeClient } from "@opencode-ai/sdk" + +const client = await createOpencodeClient({ + // baseUrl: "https://yccb64t1z-100.cnb.run", + // auth: async () => { + // return 'cm9vdDozR0I2MDg5ZGpYOE5oMDFjM1FteE5DWDd0ZkI=' + // } + baseUrl: "http://localhost:4096", +}) + +const sessionList = await client.session.list() +console.log(sessionList.data) \ No newline at end of file diff --git a/mod.ts b/mod.ts deleted file mode 100644 index 148c52e..0000000 --- a/mod.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './src/index.ts' \ No newline at end of file diff --git a/package.json b/package.json index a148550..c48b37c 100644 --- a/package.json +++ b/package.json @@ -32,19 +32,19 @@ "devDependencies": { "@ai-sdk/openai-compatible": "^2.0.35", "@kevisual/ai": "^0.0.28", - "@kevisual/api": "^0.0.62", + "@kevisual/api": "^0.0.64", "@kevisual/code-builder": "^0.0.6", "@kevisual/context": "^0.0.8", "@kevisual/dts": "^0.0.4", - "@kevisual/remote-app": "^0.0.6", + "@kevisual/remote-app": "^0.0.7", "@kevisual/types": "^0.0.12", "@opencode-ai/plugin": "^1.2.24", "@types/bun": "^1.3.10", - "@types/node": "^25.4.0", + "@types/node": "^25.5.0", "@types/ws": "^8.18.1", "ai": "^6.0.116", "commander": "^14.0.3", - "dayjs": "^1.11.19", + "dayjs": "^1.11.20", "dotenv": "^17.3.1" }, "publishConfig": { @@ -57,6 +57,7 @@ "@kevisual/query": "^0.0.53", "@kevisual/router": "^0.1.1", "@kevisual/use-config": "^1.0.30", + "@opencode-ai/sdk": "^1.2.24", "es-toolkit": "^1.45.1", "nanoid": "^5.1.6", "unstorage": "^1.17.4", @@ -64,7 +65,7 @@ "zod": "^4.3.6" }, "exports": { - ".": "./mod.ts", + ".": "./src/index.ts", "./opencode": "./dist/opencode.js", "./keep": "./dist/keep.js", "./keep.ts": "./src/keep.ts",