## 功能说明
用户通过语音或文字说「帮我招募一只小龙虾」,iAgent 全程引导完成
OpenClaw 实例创建 + 钉钉 OAuth 一键授权绑定。
## 核心设计
- 语音场景 (claude_agent_sdk): Claude 通过 Bash/wget 调用内部 HTTP
端点触发 OAuth,绕开 ToolExecutor 限制,两引擎均兼容
- 文字场景 (claude_api): 使用 initiate_dingtalk_binding 自定义工具,
通过 uiEvent 机制传递 OAuth URL
## agent-service 变更
- agent-engine.port.ts: EngineStreamEvent 联合类型新增 oauth_prompt
- allowed-tools-resolver.service.ts: initiate_dingtalk_binding 加入
ALL_SDK_TOOLS / admin / operator 工具白名单
- tool-executor.ts: 新增 executeInitiateDingTalkBinding(),调用内部
oauth/init 端点获取 OAuth URL,返回 uiEvent
- claude-api-engine.ts: 在 tool_result 之后检查 result.uiEvent 并
yield 出去;buildToolDefinitions 注册 initiate_dingtalk_binding schema
- system-prompt-builder.ts:
- SystemPromptContext 新增 sessionId? 字段
- 语音 session (sessionId 存在) → Step 3 使用 wget 调用
POST /sessions/{sessionId}/dingtalk/oauth-trigger(两引擎通用)
- 文字 session (无 sessionId) → Step 3 调用 initiate_dingtalk_binding
工具(claude_api 专用)
- voice-session.controller.ts:
- 注入 AgentStreamGateway / DingTalkRouterService / AgentInstanceRepository
- startVoiceSession: 提前确定 sessionId,在 build() 前传入,使系统
提示能内嵌正确的端点 URL
- 新增 POST :sessionId/dingtalk/oauth-trigger — 无 JWT(内部端点,
由 Claude Bash 工具调用),sessionId 作为能力令牌;生成 OAuth URL
并通过 gateway.emitStreamEvent 直接推送 oauth_prompt 事件到 WS 流
## voice-agent 变更
- agent.py: 构造 AgentServiceLLM 时传入 room=ctx.room
- agent_llm.py:
- __init__ 增加 room 参数,存储为 self._room
- 新增 _publish_oauth_prompt(evt_data): null-safe,通过 LiveKit
publish_data(topic="oauth_prompt") 推送到 Flutter
- _do_inject_voice / _do_inject / _do_stream_voice / _do_stream:
处理 oauth_prompt 事件 → asyncio.create_task(_publish_oauth_prompt)
- 替换已弃用的 asyncio.ensure_future / get_event_loop().create_task
→ asyncio.create_task(Python 3.10+ 兼容)
## Flutter 变更
- agent_call_page.dart: DataReceivedEvent 监听 topic="oauth_prompt",
解析 url/instanceName,弹出 _showOAuthBottomSheet(深色主题,🦞
图标,「立即授权」按钮 launchUrl externalApplication)
- stream_event.dart: 新增 OAuthPromptEvent(url, instanceId, instanceName)
- stream_event_model.dart: toEntity() 新增 'oauth_prompt' case
- chat_message.dart: MessageType 枚举新增 oauthPrompt
- chat_providers.dart: _handleStreamEvent 新增 OAuthPromptEvent case,
生成 type=oauthPrompt 的 ChatMessage(metadata 含 url/instanceName)
- chat_page.dart: 新增 oauthPrompt 时间线节点 + _OAuthPromptCard 组件
(「立即授权」按钮,launchUrl externalApplication);import url_launcher
## 修复的关键 Bug
1. [严重] initiate_dingtalk_binding 只对 claude_api 有效,语音默认用
claude_agent_sdk → 新 wget 端点两引擎均可用
2. [严重] 文字聊天页面不处理 oauth_prompt 事件(静默丢弃)→ 补全
Flutter 4 处代码(entity/model/provider/page)
3. [中] _publish_oauth_prompt 缺 local_participant null 检查 → 已修复
4. [轻] asyncio.ensure_future / get_event_loop() 弃用警告 → 已修复
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
||
|---|---|---|
| deploy | ||
| docs | ||
| it0-web-admin | ||
| it0_app | ||
| packages | ||
| scripts | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| Dockerfile.service | ||
| OPENCLAW_INTEGRATION_PLAN.md | ||
| README.md | ||
| entrypoint.sh | ||
| logo.svg | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| tsconfig.base.json | ||
| turbo.json | ||
README.md
IT0 — AI-Powered Server Cluster Operations Platform
Intelligent operations platform that combines AI agents with human oversight for managing server clusters.
Architecture
- Backend: NestJS microservices (TypeScript) with DDD + Clean Architecture
- Mobile: Flutter app with Riverpod state management
- Web Admin: Next.js dashboard with Zustand + React Query
- Voice: Python service for voice-based interaction (STT/TTS/VAD)
Services
| Service | Description |
|---|---|
| auth-service | Authentication, RBAC, API key management |
| agent-service | AI agent orchestration (Claude CLI + API) |
| inventory-service | Server, cluster, credential management |
| monitor-service | Metrics collection, alerting, health checks |
| ops-service | Task execution, approvals, standing orders |
| comm-service | Multi-channel notifications, escalation |
| audit-service | Audit logging, compliance trail |
| voice-service | Voice pipeline (Python) |
Quick Start
# Backend
pnpm install
pnpm dev
# Flutter
cd it0_app && flutter pub get && flutter run
# Web Admin
cd it0-web-admin && pnpm install && pnpm dev
Tech Stack
- Runtime: Node.js 20+, Dart 3.x, Python 3.11+
- Database: PostgreSQL (schema-per-tenant)
- Cache/Events: Redis Streams
- AI: Anthropic Claude (CLI + API)
- Build: pnpm workspaces + Turborepo