Files
opencode-manager/backend/package.json
T
Chris Scott 549e0ac7b2 feat: add model state persistence and improve model selection sync (#209)
* feat: add persistent model state storage with database backend

- Create opencode_model_state table for storing user model preferences
- Implement database-backed model state management (recent, favorite, variant)
- Add atomic JSON file utilities with file locking for concurrent safety
- Migrate providers routes from file-based to database storage
- Add backfill migration to preserve existing model.json data
- Include comprehensive tests for model-state and atomic-json modules
- Refactor useSessionAgent hook to simplify agent/model resolution logic
- Update getFileApiUrl to use consistent query parameter approach

* fix: include workspace dependencies in Docker image

* fix: overlay workspace node_modules after source to prevent layer overwrite

* fix: ensure model state table exists for existing databases

* feat: add model state persistence and improve model selection sync

- Add setActiveModel to modelStore and useModelSelection for direct model updates
- Sync session agent model/variant to store when messages load
- Include model, agent, and variant in optimistic user messages
- Fix useSessionAgent to check isFetching during message loading
- Update env.ts to use getter for BASE_PATH for dynamic resolution
- Fix test environment variable from OPENCODE_WORKSPACE_PATH to WORKSPACE_PATH
2026-04-29 21:44:47 -04:00

51 lines
1.4 KiB
JSON

{
"name": "backend",
"module": "index.ts",
"type": "module",
"private": true,
"scripts": {
"dev": "bun --watch-path src --watch src/index.ts",
"start": "bun src/index.ts",
"build": "bun build src/index.ts --outdir=dist --target=bun",
"typecheck": "tsc --noEmit",
"test": "bun test src/",
"test:vitest": "vitest",
"test:all": "bun test src/ && vitest test/",
"test:ui": "vitest --ui",
"test:watch": "vitest --watch",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --ext .ts --fix"
},
"dependencies": {
"@better-auth/passkey": "^1.4.17",
"@hono/node-server": "^1.19.5",
"@opencode-manager/shared": "workspace:*",
"archiver": "^7.0.1",
"better-auth": "^1.4.17",
"croner": "^10.0.1",
"dotenv": "^17.2.3",
"eventsource": "^4.1.0",
"hono": "^4.11.7",
"jsonc-parser": "^3.3.1",
"web-push": "^3.6.7",
"zod": "^4.1.12"
},
"devDependencies": {
"@eslint/js": "^9.36.0",
"@types/archiver": "^7.0.0",
"@types/better-sqlite3": "^7.6.13",
"@types/bun": "latest",
"@types/eventsource": "^3.0.0",
"@types/web-push": "^3.6.4",
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"better-sqlite3": "^12.9.0",
"eslint": "^9.39.1",
"typescript-eslint": "^8.45.0",
"vitest": "^3.2.4"
},
"peerDependencies": {
"typescript": "^5"
}
}