feat: 重构为 Monorepo 架构并实现 HTTP Server
架构变更: - 采用 pnpm workspaces 实现 Monorepo 结构 - 将现有代码迁移到 packages/core - 新增 packages/server HTTP 服务层 Server 功能: - REST API: 会话管理、工具管理、配置管理 - WebSocket: 实时双向通信支持 - SSE: 服务端事件推送 - Hono + Bun 作为运行时 API 端点: - GET/POST /api/sessions - 会话 CRUD - GET/POST /api/sessions/:id/messages - 消息管理 - GET /api/sessions/:id/events - SSE 事件流 - WS /api/ws/:sessionId - WebSocket 连接 - GET/POST /api/tools - 工具管理 - GET/PUT /api/config - 配置管理
This commit is contained in:
+18
-43
@@ -1,60 +1,35 @@
|
||||
{
|
||||
"name": "ai-terminal-assistant",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "A terminal-based AI coding assistant powered by Claude",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
"ai-assist": "./dist/index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "tsc && mkdir -p dist/tools/descriptions && cp -r src/tools/descriptions/* dist/tools/descriptions/",
|
||||
"start": "node dist/index.js",
|
||||
"dev": "tsx src/index.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
"build": "pnpm -r build",
|
||||
"dev": "pnpm -r --parallel dev",
|
||||
"test": "pnpm -r test",
|
||||
"test:coverage": "pnpm -r test:coverage",
|
||||
"lint": "pnpm -r lint",
|
||||
"clean": "pnpm -r exec rm -rf dist node_modules",
|
||||
"server:start": "pnpm --filter @ai-assistant/server start",
|
||||
"server:dev": "pnpm --filter @ai-assistant/server start:dev"
|
||||
},
|
||||
"keywords": [
|
||||
"ai",
|
||||
"cli",
|
||||
"assistant",
|
||||
"claude",
|
||||
"terminal"
|
||||
"terminal",
|
||||
"monorepo"
|
||||
],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@ai-sdk/anthropic": "^2.0.54",
|
||||
"@ai-sdk/deepseek": "^1.0.31",
|
||||
"@ai-sdk/openai": "^2.0.80",
|
||||
"@tavily/core": "^0.6.0",
|
||||
"ai": "^5.0.108",
|
||||
"chalk": "^5.3.0",
|
||||
"commander": "^12.1.0",
|
||||
"inquirer": "^12.0.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"minimatch": "^10.1.1",
|
||||
"ora": "^8.1.0",
|
||||
"qwen-ai-provider-v5": "^1.0.2",
|
||||
"simple-git": "^3.30.0",
|
||||
"tree-sitter-bash": "^0.25.1",
|
||||
"uuid": "^13.0.0",
|
||||
"vscode-jsonrpc": "^8.2.1",
|
||||
"vscode-languageserver-protocol": "^3.17.5",
|
||||
"web-tree-sitter": "^0.25.10",
|
||||
"yaml": "^2.8.2",
|
||||
"zod": "^4.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@vitest/coverage-v8": "^4.0.15",
|
||||
"tsx": "^4.19.0",
|
||||
"typescript": "^5.6.0",
|
||||
"vitest": "^4.0.15"
|
||||
}
|
||||
"typescript": "^5.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0",
|
||||
"pnpm": ">=8.0.0"
|
||||
},
|
||||
"packageManager": "pnpm@9.0.0"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "@ai-assistant/core",
|
||||
"version": "1.0.0",
|
||||
"description": "Core engine for AI terminal assistant - Agent, Tools, LSP, Checkpoint",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
},
|
||||
"./agent": {
|
||||
"types": "./dist/core/agent.d.ts",
|
||||
"import": "./dist/core/agent.js"
|
||||
},
|
||||
"./tools": {
|
||||
"types": "./dist/tools/index.d.ts",
|
||||
"import": "./dist/tools/index.js"
|
||||
},
|
||||
"./editors": {
|
||||
"types": "./dist/editors/index.d.ts",
|
||||
"import": "./dist/editors/index.js"
|
||||
},
|
||||
"./lsp": {
|
||||
"types": "./dist/lsp/index.d.ts",
|
||||
"import": "./dist/lsp/index.js"
|
||||
},
|
||||
"./checkpoint": {
|
||||
"types": "./dist/checkpoint/index.d.ts",
|
||||
"import": "./dist/checkpoint/index.js"
|
||||
},
|
||||
"./hooks": {
|
||||
"types": "./dist/hooks/index.d.ts",
|
||||
"import": "./dist/hooks/index.js"
|
||||
},
|
||||
"./types": {
|
||||
"types": "./dist/types/index.d.ts",
|
||||
"import": "./dist/types/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc && cp -r src/tools/descriptions dist/tools/",
|
||||
"dev": "tsc --watch",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest",
|
||||
"test:coverage": "vitest run --coverage"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ai-sdk/anthropic": "^2.0.54",
|
||||
"@ai-sdk/deepseek": "^1.0.31",
|
||||
"@ai-sdk/openai": "^2.0.80",
|
||||
"@tavily/core": "^0.6.0",
|
||||
"ai": "^5.0.108",
|
||||
"chalk": "^5.3.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"minimatch": "^10.1.1",
|
||||
"qwen-ai-provider-v5": "^1.0.2",
|
||||
"simple-git": "^3.30.0",
|
||||
"tree-sitter-bash": "^0.25.1",
|
||||
"uuid": "^13.0.0",
|
||||
"vscode-jsonrpc": "^8.2.1",
|
||||
"vscode-languageserver-protocol": "^3.17.5",
|
||||
"web-tree-sitter": "^0.25.10",
|
||||
"yaml": "^2.8.2",
|
||||
"zod": "^4.1.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@vitest/coverage-v8": "^4.0.15",
|
||||
"typescript": "^5.6.0",
|
||||
"vitest": "^4.0.15"
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user