Commit Graph

371 Commits

Author SHA1 Message Date
hailin d1993a1175 feat: add auto-login with token restore on app startup
App 启动时从 SecureStorage 读取已存储的 JWT,解析用户信息自动恢复登录状态,
无需每次重新输入密码。Token 过期则自动尝试 refresh,refresh 失败才跳转登录页。

- 新增 tryRestoreSession() 从 JWT payload 解码用户信息
- 新增 _isTokenExpired() 检查 token 是否过期(预留 60s 缓冲)
- refreshToken() 成功后恢复 AuthState + tenant 上下文
- 新增 /splash 启动页,尝试恢复后决定跳转 dashboard 或 login

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 01:47:20 -08:00
hailin 8015154a3e feat: replace default Flutter icon with iAgent robot logo
使用项目自有的绿色机器人 SVG logo 生成各分辨率 Android 启动图标,
替换默认的 Flutter 蓝色纸飞机。支持 Android Adaptive Icon(白底 + 机器人前景)。
同时生成 iOS 图标。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 01:41:36 -08:00
hailin 3d9b25391e fix: enable core library desugaring for flutter_local_notifications
flutter_local_notifications 插件依赖 java.time API,需要启用 Android core
library desugaring 才能在低版本设备上运行。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 01:24:38 -08:00
hailin 092a561867 feat: 完成 iAgent App 三大功能 + 修复租户上下文
## 功能一:设置页(完整实现)
- 新增浅色主题(lightTheme),支持深色/浅色/跟随系统三种模式
- app.dart 接入 themeMode 动态切换
- 设置页完整重写:个人信息编辑、修改密码、主题切换、通知开关
- 新增 settings_remote_datasource 对接后端 admin/settings API
- settings_providers 新增 AccountProfileNotifier 管理远程个人资料

## 功能二:语音通话(音频集成)
- 添加 flutter_sound 依赖,创建 PcmPlayer 流式 PCM 播放器
- agent_call_page 替换空壳:真实麦克风采集(record + GTCRN 降噪)
- 真实 PCM 16kHz 流式播放,基于 RMS 能量驱动波形动画
- 修复 WebSocket URL 路径:/ws/voice/ → /api/v1/voice/ws/
- voice_repository_impl 支持后端返回相对路径自动拼接

## 功能三:推送通知(WebSocket MVP)
- 添加 flutter_local_notifications + socket_io_client 依赖
- 创建 AppNotification 实体、NotificationService(Socket.IO 连接 comm-service)
- 通知 providers:列表管理 + 未读计数
- 登录后自动连接通知服务,登出断开
- 底部导航 Alerts 标签添加未读角标(Badge)
- AndroidManifest 添加 POST_NOTIFICATIONS 权限
- main.dart 初始化本地通知插件

## 修复:租户上下文未初始化(500错误)
- 根因:登录后未设置 currentTenantIdProvider,导致 X-Tenant-Id 头缺失
- Flutter 端:login() 成功后从 JWT 设置 tenantId,logout 时清除
- 后端:tenant-context.middleware 增加 JWT tenantId 回退逻辑
- AuthUser 模型新增 tenantId 字段解析

新增 5 个文件,修改 16 个文件,添加 3 个依赖包

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 01:10:52 -08:00
hailin 6a293d734b chore: 提交 Flutter 项目默认 README
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 22:12:27 -08:00
hailin 51430adafc fix: 修复登录问题 — 重置用户密码 + 配置生产环境API地址
问题排查过程:
  1. 用户 hailin@it0.com 存在于 public.users,is_active=true
  2. 直接调用 auth-service login 接口返回 401 Invalid credentials
  3. 确认是密码不匹配 — 将密码重置为 admin123 (与 admin 账号相同)
  4. 重置后登录成功,Kong Gateway 路由也正常

App配置修改:
  - development: 端口从 8000 改为 18000 (匹配 Kong 映射)
  - production: 指向服务器 http://154.84.135.121:18000
  - 默认使用 production 配置 (之前是 development)

登录凭据:
  - admin@it0.com / admin123 (管理员)
  - hailin@it0.com / admin123 (运维员,请登录后修改密码)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:56:38 -08:00
hailin 68d0c9d6f7 fix: 移除logo白色背景 + 优化登录页面UI和中文化
Logo修复:
  - 移除 logo.svg 中的白色背景矩形 (fill="#ffffff")
  - Logo 现在为透明背景,在深色主题上正确显示

登录页面优化:
  - 添加 "iAgent" 品牌标题 (28px, bold, 带字间距)
  - 副标题改为中文 "服务器集群运维智能体"
  - 表单中文化: 邮箱/密码/登录
  - 错误提示改为带背景色的卡片样式 (红色图标+文字)
  - 添加邮箱输入框 placeholder (user@example.com)
  - 密码框支持回车提交
  - 底部提示: "账号由管理员在后台创建或通过邀请链接注册"
  - 限制表单最大宽度 360px,外层改用 SingleChildScrollView 防溢出

用户账号说明:
  App 端不提供自助注册功能,用户账号通过以下方式创建:
  1. 管理员在 Web 后台 (用户管理页) 直接创建
  2. 管理员发送邀请链接,用户通过链接注册
  3. 通过 Web 端自助注册 (可选填公司名创建新租户)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:42:42 -08:00
hailin 5d12ada262 fix: 添加 assets/images/.gitkeep 保留空目录,修复构建报错
问题: pubspec.yaml 声明了 assets/images/ 目录,但该目录为空。
Git 不追踪空目录,其他机器 clone 后缺少此目录,导致:
"Error: unable to find directory entry in pubspec.yaml: assets\images\"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:31:29 -08:00
hailin 4e1b75483d fix: 修复 .gitignore 误忽略 Flutter data/models/ 源码导致构建失败
问题描述:
  在其他机器上构建报错:
  "Error when reading 'lib/features/auth/data/models/auth_response.dart': 系统找不到指定的路径"
  导致 AuthUser、AuthResponse 等类型找不到,编译失败。

根本原因:
  根目录 .gitignore 第75行 "models/" 规则本意是忽略 ML 模型大文件,
  但该规则匹配了所有目录名为 models/ 的路径,包括 Flutter 项目中
  DDD 架构的 data/models/ 源码目录(共 11 个 models/ 目录、10 个 .dart 文件)。
  这些文件在本地存在但从未被 Git 追踪,其他机器 pull 后缺失这些文件。

修复内容:
  1. 修改 .gitignore: 将宽泛的 "models/" 替换为精确的规则
     - packages/services/voice-service/models/ — voice-service 下载的 ML 模型
     - *.pt, *.pth, *.safetensors — PyTorch/HuggingFace 模型二进制文件
     - 不再影响 Flutter 的 data/models/ 源码目录

  2. 提交之前被忽略的 10 个 Flutter model 文件:
     - auth/data/models/auth_response.dart — 登录响应 (accessToken, refreshToken, user)
     - chat/data/models/chat_message_model.dart — 聊天消息模型
     - chat/data/models/session_model.dart — 会话模型
     - chat/data/models/stream_event_model.dart — SSE 流事件模型
     - servers/data/models/server_model.dart — 服务器状态模型
     - approvals/data/models/approval_model.dart — 审批请求模型
     - alerts/data/models/alert_event_model.dart — 告警事件模型
     - agent_call/data/models/voice_session_model.dart — 语音会话模型
     - standing_orders/data/models/standing_order_model.dart — 常设指令模型
     - tasks/data/models/task_model.dart — 任务模型

  3. 同时提交:
     - it0_app/test/widget_test.dart — Flutter 默认测试
     - packages/services/voice-service/src/models/__init__.py — Python 模块初始化

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:29:03 -08:00
hailin 913267fb9d fix: 提交完整的Android项目配置文件,修复跨机器构建失败
问题描述:
  在其他机器 (C:\Users\ph) 上执行 flutter build apk 时报错:
  "Build failed due to use of deleted Android v1 embedding."
  原因是 Android 项目配置文件未被提交到 Git 仓库。

根本原因:
  之前重新生成 Android 项目(从 speech_to_text 迁移到 record 包)时,
  新生成的 Android 构建文件只在本地存在,未提交到远程仓库。
  其他机器 clone/pull 后缺少这些文件,导致构建失败。

本次提交包含的文件:
  Android 构建配置:
  - android/settings.gradle.kts — Gradle 插件配置 (AGP 8.11.1, Kotlin 2.2.20)
  - android/build.gradle.kts — 根项目 Gradle 配置
  - android/app/build.gradle.kts — 应用模块配置 (namespace: com.iagent.it0_app, Java 17)
  - android/gradle.properties — JVM 参数 (8G heap), AndroidX 启用
  - android/gradle/wrapper/gradle-wrapper.properties — Gradle 8.14

  Android 清单与入口:
  - android/app/src/main/AndroidManifest.xml — 主清单 (v2 embedding, INTERNET+RECORD_AUDIO权限, cleartext允许)
  - android/app/src/debug/AndroidManifest.xml — Debug 清单
  - android/app/src/profile/AndroidManifest.xml — Profile 清单
  - android/app/src/main/kotlin/.../MainActivity.kt — FlutterActivity (v2 embedding)

  Android 资源:
  - res/drawable/ — 启动画面背景
  - res/mipmap-*/ — 应用图标 (hdpi~xxxhdpi)
  - res/values/ — 主题样式 (LaunchTheme + NormalTheme, 含夜间模式)

  Flutter 项目元数据:
  - .gitignore — Flutter 项目忽略规则
  - .metadata — Flutter SDK 版本追踪
  - android/.gitignore — Android 构建产物忽略规则

构建要求:
  - Flutter SDK >= 3.38.0 (pubspec.lock 约束)
  - 其他机器需执行: flutter clean && flutter pub get 后重新构建

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 16:17:18 -08:00
hailin a568558585 feat: replace speech_to_text with GTCRN ML noise reduction + backend STT
Replace traditional on-device speech_to_text with a modern pipeline:
- Record audio via `record` package with hardware noise suppression
- Apply GTCRN neural denoising (sherpa-onnx, ICASSP 2024, 48K params)
- Trim silence, POST to backend /voice/transcribe (faster-whisper)

Changes:
- Add /transcribe endpoint to voice-service for audio file upload
- Add SpeechEnhancer wrapper for sherpa-onnx GTCRN model (523KB)
- Rewrite chat_page.dart voice input: record → denoise → transcribe
- Keep NoiseReducer.trimSilence for silence removal only
- Upgrade record to v6.2.0, add sherpa_onnx, path_provider

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 07:59:15 -08:00
hailin 39c0d83424 feat: rename app from IT0 to iAgent (我智能体)
Web Admin:
- Update browser title to "iAgent Admin Console"
- Translation: en appTitle "iAgent", zh appTitle "我智能体"
- Sidebar: en "iAgent Admin", zh "我智能体"
- Settings placeholder: "iAgent Platform" / "我智能体平台"
- Update alt tags on logo images

Flutter:
- MaterialApp title: "iAgent"
- Chat: "Ask iAgent..." / "Start a conversation with iAgent"
- Terminal: "iAgent Remote Terminal"
- Agent call: "iAgent Calling" / "iAgent"

Logo SVG: text changed from "AI AGENT" to "iAgent"

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 06:39:40 -08:00
hailin 04150f41f5 fix: copy public/ directory in web-admin Dockerfile for static assets
Next.js standalone mode does not include the public/ directory automatically.
The favicon and logo SVGs were returning 404 because they were not copied
to the production image.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 06:28:45 -08:00
hailin 2f228e4591 feat: integrate robot logo into web admin and Flutter app
- Add logo.svg (green robot character) to project root
- Web admin: replace text "IT" badge with SVG logo in sidebar
- Web admin: add logo image to login, register, invite pages
- Web admin: add SVG favicon and apple-touch-icon metadata
- Flutter: add flutter_svg dependency, replace text "IT0" with logo on login page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 06:17:08 -08:00
hailin 660616b08b feat: add multi-language (i18n) support to web admin with Chinese and English
- Add react-i18next with browser language auto-detection and localStorage persistence
- Create Zustand locale store with UI language selector in Settings > General
- Add 17 translation namespace files for both English and Chinese (34 JSON files)
- Convert all 37 pages (auth, admin, settings) to use useTranslation hooks
- Convert sidebar and topbar layout components to i18n

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 04:56:04 -08:00
hailin a7c6aae8c6 feat: add user dropdown menu with sign-out to top bar
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:59:28 -08:00
hailin 89955f6db8 fix: remove SQL comment lines before splitting to prevent filtering CREATE TABLE statements
The previous approach split by semicolons then filtered statements starting
with '--', which incorrectly removed entire CREATE TABLE blocks that had
comment headers (e.g., '-- Agent Sessions\nCREATE TABLE...').

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:26:37 -08:00
hailin 7ff012cd91 fix: use underscores in tenant slug for valid PostgreSQL schema names
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:23:14 -08:00
hailin 34caa25c71 fix: copy SQL migrations to service dist path for schema provisioning
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:21:32 -08:00
hailin 895b361bd8 fix: copy SQL migration templates to Docker dist for schema provisioning
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:19:19 -08:00
hailin 55b521ca5c fix: correct JSX nesting in tenant detail page
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:13:09 -08:00
hailin 5d81667ddd feat: add dual tenant registration (self-service + invitation)
Backend:
- Enhanced register endpoint to accept companyName for self-service
  tenant creation with schema provisioning and admin user setup
- Added TenantInvite entity with token-based invitation system
- Added invite CRUD endpoints to TenantController (create/list/revoke)
- Added public endpoints for invite validation and acceptance

Frontend:
- Created registration page with optional organization name field
- Created invitation acceptance page at /invite/[token]
- Added invite management UI to tenant detail page
- Updated login page with link to registration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 03:10:18 -08:00
hailin 9a33cef951 feat: redesign sidebar with icons, collapse toggle, and improved theme
- Add lucide icons to all navigation items
- Collapsible sidebar with icon-only mode and tooltips
- Narrower sidebar (w-60 vs w-64), compact top bar (h-12 vs h-14)
- Better search bar UX in top bar with keyboard shortcut hint
- Refined dark theme with better contrast and separation
- Custom thin scrollbar styling
- Backdrop blur for sidebar and top bar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 02:09:28 -08:00
hailin 7dbd2c1414 feat: add settings, roles, permissions, and metrics controllers
Implement remaining backend controllers for all web admin menu pages:
- SettingsController: general, notification, theme, account, API keys
- RoleController: CRUD roles with permission assignment
- PermissionController: permission matrix for RBAC management
- MetricsController: server metrics overview and per-server data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 01:03:34 -08:00
hailin 8f89b8121c fix: format tenant API response to match frontend DTO
Map flat quota fields to nested quota object and add userCount field
to match the frontend's expected Tenant interface.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:41:19 -08:00
hailin 3816d6841d fix: add users endpoint, admin route, and fix agent-config paths
- Add UsersController to auth-service for user CRUD (GET/POST/PUT/DELETE /api/v1/auth/users)
- Add Kong route /api/v1/admin -> auth-service for tenant management
- Remove AuthGuard from TenantController (Kong handles JWT)
- Fix frontend agent-config API paths from /api/v1/agent/config to /api/v1/agent-config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:35:57 -08:00
hailin 52b85f085e fix: decode JWT in middleware to populate req.user for RolesGuard
Kong validates the JWT but doesn't populate req.user on the backend.
The middleware now decodes the JWT payload to extract user info (id,
email, tenantId, roles) so RolesGuard can check role-based access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:25:32 -08:00
hailin f393a07092 fix: correct alert-rules API paths and remove audit ACL plugin
- Frontend alert-rules paths changed from /monitoring/alert-rules to
  /monitor/alerts/rules to match backend routes
- Removed Kong ACL plugin on audit-routes (JWT auth is sufficient)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:21:50 -08:00
hailin e98cf26587 fix: add missing columns to tenant schema template (runbook.updated_at, contact.role)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:18:46 -08:00
hailin e0ef15df1e fix: add SnakeNamingStrategy for TypeORM to match snake_case DB columns
TypeORM entities use camelCase properties (tenantId, passwordHash) but
database tables use snake_case columns (tenant_id, password_hash). The
naming strategy automatically converts between the two conventions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:10:08 -08:00
hailin a72cbd3778 fix: use any types in TenantContextMiddleware to avoid express dependency
The @it0/database package doesn't have @types/express, causing build
failures. Use any types for req/res/next parameters instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 00:00:55 -08:00
hailin 5b6e7ee363 fix: add TenantContextMiddleware to initialize tenant context from X-Tenant-Id header
All services using TenantAwareRepository require AsyncLocalStorage tenant
context to set the correct PostgreSQL search_path. The middleware reads
X-Tenant-Id from request headers and wraps the request with
TenantContextService.run(), using schema naming convention it0_t_{tenantId}.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 23:58:01 -08:00
hailin 806113554b fix: remove AuthGuard('jwt') from all service controllers
Kong handles JWT validation at the gateway level. Service-level
AuthGuard('jwt') fails because services don't register a Passport
JWT strategy (only auth-service does). Removed from 17 controllers
across ops, inventory, monitor, comm, audit, and agent services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 23:42:37 -08:00
hailin c710303b60 fix: per-service JWT in Kong, fix auth-service tenant-aware repos
- Replace global JWT plugin with per-service JWT (skip auth-service)
  to fix auth routes being blocked by global JWT in DB-less mode
- Fix UserRepository and ApiKeyRepository to use standard TypeORM
  instead of TenantAwareRepository (users are global, not per-schema)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 23:31:32 -08:00
hailin 7dd7de4a22 fix: use COPY --chmod for Kong entrypoint (non-root image)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 23:24:37 -08:00
hailin 48e47975ca fix: configure Kong JWT auth flow with consumer credentials
- Add kid claim to auth-service JWT for Kong validation
- Add Kong consumer with JWT credential (shared secret via env)
- Add agent-config route to Kong for /api/v1/agent-config
- Kong Dockerfile uses entrypoint script to inject JWT_SECRET at runtime
- Fix frontend login path (/auth/login → /api/v1/auth/login)
- Extract tenantId from JWT on login and store as current_tenant
- Add auth guard in admin layout (redirect to /login if no token)
- Pass JWT_SECRET env var to Kong container in docker-compose

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 23:20:06 -08:00
hailin 28131491e2 fix: set API_BASE_URL at Docker build time for Next.js inlining
Next.js replaces process.env.X with build-time values via
DefinePlugin, even in server-side route handlers. Without
the env var set during build, it always falls back to
localhost:8000 which doesn't work inside Docker.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:59:47 -08:00
hailin e5dcfa6113 feat: configure it0.szaiai.com and it0api.szaiai.com domains
- Update Kong CORS origins to allow it0.szaiai.com
- Update WebSocket URL to wss://it0api.szaiai.com
- Fix proxy route to read API_BASE_URL at request time
  (was being inlined at build time by Next.js standalone)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:54:17 -08:00
hailin 74e4c55277 fix: read API_BASE_URL at request time in proxy route
The module-level const was being inlined at build time by Next.js
standalone bundler, causing the proxy to always use localhost:8000
instead of the Docker runtime env var api-gateway:8000.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:45:57 -08:00
hailin d8cb2a9c6f fix: use standard TypeORM repos and header-based tenant extraction
- Replace TenantAwareRepository with standard @InjectRepository
  (TenantAwareRepository requires AsyncLocalStorage tenant context
  middleware which agent-service does not have)
- Replace @TenantId() decorator with @Headers('x-tenant-id')
  for direct HTTP header extraction
- Return defaults gracefully when no tenant is selected

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:41:30 -08:00
hailin f897cfe240 fix: remove AuthGuard('jwt') from agent-service controllers
Agent-service does not have a registered Passport JWT strategy —
JWT validation is handled by Kong API gateway. The AuthGuard was
causing 500 "Unknown authentication strategy" errors on all
new controller endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:36:46 -08:00
hailin 5ee1227800 feat: add backend controllers for agent config, skills, and hooks
Implement missing REST API endpoints that the web-admin frontend
pages were calling but had no backend support:

- GET/POST/PUT /api/v1/agent-config (engine, prompt, turns, budget, tools)
- GET/POST/PUT/DELETE /api/v1/agent/skills (CRUD for agent skills)
- GET/POST/PUT/DELETE /api/v1/agent/hooks (CRUD for hook scripts)

Each endpoint includes entity, repository, service, and controller
layers following the existing DDD + tenant-aware patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:26:25 -08:00
hailin 8b92abcce9 fix: handle undefined from eventQueue.shift() in SDK engine
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:10:43 -08:00
hailin e0185743ec fix: update pnpm-lock.yaml for @anthropic-ai/claude-agent-sdk dependency
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 22:07:21 -08:00
hailin c75ad27771 feat: add Claude Agent SDK engine with multi-tenant support
Add @anthropic-ai/claude-agent-sdk as a third engine (pure additive, no changes
to existing CLI/API engines). Includes full frontend admin page.

Backend (agent-service):
- ClaudeAgentSdkEngine: implements AgentEnginePort using SDK's query() API
- ApprovalGate: L2 tool approval with configurable auto-approve timeout (default 120s)
- TenantAgentConfig entity: per-tenant billing mode, encrypted API key, timeout, tool lists
- AllowedToolsResolverService: RBAC-based tool whitelist (admin/operator/viewer)
- TenantAgentConfigController: REST endpoints for admin config management
- Default subscription billing (operator's Claude login, no API key needed)
- Optional per-tenant API key with AES-256-GCM encryption

Frontend (web-admin):
- SDK Config page at /agent-config/sdk with billing, timeout, tool permissions
- Sidebar navigation entry under Agent Config
- React Query key for tenant SDK config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:38:30 -08:00
hailin 67d5a13c0c fix: set compose project name to 'it0' for consistent image naming
Changes image names from docker-{service} to it0-{service}.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:57:42 -08:00
hailin 259838ae88 fix: set HOSTNAME=0.0.0.0 for Next.js standalone to bind all interfaces
Next.js standalone server binds to container hostname by default,
making it unreachable from 127.0.0.1 for healthchecks and from
Docker port forwarding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:52:37 -08:00
hailin 83da374bbb fix: use 127.0.0.1 in web-admin healthcheck to avoid IPv6 resolution
Node.js 18 resolves 'localhost' to ::1 (IPv6) but Next.js standalone
only binds to 0.0.0.0 (IPv4), causing Connection Refused.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 02:49:51 -08:00
hailin a06b489a1e fix: load voice models in background thread to unblock startup
Model downloads (Whisper, Kokoro, Silero VAD) are synchronous blocking
calls that prevent uvicorn from completing startup and responding to
healthchecks. Move all model loading to a daemon thread so the server
starts immediately.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:26:06 -08:00
hailin 3702fa3f52 fix: make voice-service startup graceful and fix device config
- Wrap model loading in try/except so server starts even if models fail
- Fix device env var mapping (unified 'device' field instead of 'whisper_device')
- Default Whisper model to 'base' instead of 'large-v3' (3GB) for CPU deployment
- Increase healthcheck start_period to 120s for model download time

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 00:20:12 -08:00