feat(auth): add authentication routes and user token handling

- Implemented user authentication routes in `auth.ts` for fetching current user info and admin verification.
- Added caching mechanism for user tokens to improve performance.
- Created middleware for admin authentication.

feat(opencode): create OpenCode client route

- Added `opencode-cnb` route for creating OpenCode clients with session management.
- Integrated OpenCode SDK for client operations and session handling.

refactor(client): encapsulate OpenCode client creation

- Created a utility function `getClient` in `client.ts` to initialize OpenCode clients.

test(opencode): add tests for OpenCode routes

- Implemented test cases for OpenCode routes in `list.ts` to validate functionality.
- Created common utilities for testing in `common.ts`.
This commit is contained in:
xiongxiao
2026-03-13 04:04:47 +08:00
committed by cnb
parent bd0ce0058e
commit 8d85e83418
11 changed files with 440 additions and 335 deletions

View File

@@ -54,13 +54,13 @@
"@kevisual/use-config": "^1.0.30",
"@opencode-ai/plugin": "^1.2.24",
"@types/bun": "^1.3.10",
"@types/node": "^25.4.0",
"@types/node": "^25.5.0",
"@types/send": "^1.2.1",
"@types/ws": "^8.18.1",
"chalk": "^5.6.2",
"commander": "^14.0.3",
"cross-env": "^10.1.0",
"dayjs": "^1.11.19",
"dayjs": "^1.11.20",
"dotenv": "^17.3.1",
"get-port": "^7.1.0",
"nanoid": "^5.1.6",
@@ -76,7 +76,7 @@
"access": "public"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.1007.0",
"@aws-sdk/client-s3": "^3.1008.0",
"@kevisual/js-filter": "^0.0.6",
"@kevisual/oss": "^0.0.20",
"@kevisual/video-tools": "^0.0.13",