feat: Implement Worker Service with session management and SDK integration

- Added WorkerService to handle long-running HTTP service with session management.
- Implemented endpoints for initializing, observing, finalizing, checking status, and deleting sessions.
- Integrated with Claude SDK for processing observations and generating responses.
- Added port allocator utility to dynamically find available ports for the service.
- Configured TypeScript settings for the project.
This commit is contained in:
Alex Newman
2025-10-17 15:59:36 -04:00
parent d6462919cb
commit 372854948c
57 changed files with 7055 additions and 6649 deletions
+20 -5
View File
@@ -13,7 +13,7 @@
"knowledge-graph",
"transcript",
"typescript",
"bun"
"nodejs"
],
"author": "Alex Newman",
"license": "SEE LICENSE IN LICENSE",
@@ -31,22 +31,37 @@
},
"type": "module",
"engines": {
"bun": ">=1.0.0"
"node": ">=18.0.0"
},
"scripts": {
"build": "node scripts/build-hooks.js",
"build:hooks": "node scripts/build-hooks.js",
"publish:npm": "node scripts/publish.js",
"prepublishOnly": "npm run build",
"test": "bun test tests/",
"test:context": "echo '{\"session_id\":\"test-'$(date +%s)'\",\"cwd\":\"'$(pwd)'\",\"source\":\"startup\"}' | bun scripts/hooks/context-hook.js 2>/dev/null",
"test:context:verbose": "echo '{\"session_id\":\"test-'$(date +%s)'\",\"cwd\":\"'$(pwd)'\",\"source\":\"startup\"}' | bun scripts/hooks/context-hook.js"
"test": "node --test tests/",
"test:context": "echo '{\"session_id\":\"test-'$(date +%s)'\",\"cwd\":\"'$(pwd)'\",\"source\":\"startup\"}' | node claude-mem/scripts/context-hook.js 2>/dev/null",
"test:context:verbose": "echo '{\"session_id\":\"test-'$(date +%s)'\",\"cwd\":\"'$(pwd)'\",\"source\":\"startup\"}' | node claude-mem/scripts/context-hook.js",
"worker:start": "pm2 start ecosystem.config.cjs",
"worker:stop": "pm2 stop claude-mem-worker",
"worker:restart": "pm2 restart claude-mem-worker",
"worker:logs": "pm2 logs claude-mem-worker",
"worker:status": "pm2 status claude-mem-worker"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.1.0",
"better-sqlite3": "^11.0.0",
"express": "^4.18.2",
"glob": "^11.0.3",
"handlebars": "^4.7.8"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.8",
"@types/express": "^4.17.21",
"@types/node": "^20.0.0",
"esbuild": "^0.20.0",
"pm2": "^5.3.0",
"typescript": "^5.3.0"
},
"files": [
"hooks",
"scripts",