21 Commits

Author SHA1 Message Date
075b92f231 fix: truncate long text content before sending to Feishu
Feishu API rejects messages with content exceeding ~64KB with error
230001 "invalid message content". Added truncation at 60,000 characters
to prevent this, with a notice appended to truncated content.
2026-04-08 08:42:56 +08:00
02a7fa68c6 docs: update implementation log with tools registration
- Add tools registration section in session.rs
- Add update log table with all commits
2026-04-08 08:32:51 +08:00
98bc9739c6 feat(gateway): register all tools in SessionManager
- Register FileReadTool, FileWriteTool, FileEditTool, BashTool
- Register HttpRequestTool with allow-all domains for testing
- Register WebFetchTool
- CalculatorTool already registered
2026-04-08 08:32:06 +08:00
b13bb8c556 docs: add implementation log for tools
Document all implemented tools and mechanisms:
- SchemaCleanr for cross-provider schema normalization
- Tool trait enhancements (read_only, concurrency_safe, exclusive)
- file_read, file_write, file_edit, bash, http_request, web_fetch
2026-04-07 23:52:40 +08:00
8936e70a12 feat(tools): add web_fetch tool for HTML content extraction
- Fetch URL and extract readable text
- HTML to plain text conversion
- Removes scripts, styles, and HTML tags
- Decodes HTML entities
- JSON pretty printing
- SSRF protection
- Includes 6 unit tests
2026-04-07 23:52:06 +08:00
1581732ef9 feat(tools): add http_request tool with security features
- HTTP client with GET/POST/PUT/DELETE/PATCH support
- Domain allowlist for security
- SSRF protection (blocks private IPs, localhost)
- Response size limit and truncation
- Timeout control
- Includes 8 unit tests
2026-04-07 23:49:15 +08:00
68e3663c2f feat(tools): add bash tool with safety guards
- Execute shell commands with timeout
- Safety guards block dangerous commands (rm -rf, fork bombs)
- Output truncation for large outputs
- Working directory support
- Includes 7 unit tests
2026-04-07 23:47:44 +08:00
f3187ceddd feat(tools): add file_edit tool with fuzzy matching
- Edit file by replacing old_text with new_text
- Supports multiline edits
- Fuzzy line-based matching for minor differences
- replace_all option for batch replacement
- Includes 5 unit tests
2026-04-07 23:46:34 +08:00
16b052bd21 feat(tools): add file_write tool with directory creation
- Write content to file, creating parent directories if needed
- Overwrites existing files
- Includes 5 unit tests
2026-04-07 23:44:45 +08:00
a9e7aabed4 feat(tools): add file_read tool with pagination support
- Read file contents with offset/limit pagination
- Returns numbered lines for easy reference
- Handles binary files as base64 encoded
- Supports directory restriction for security
- Includes 4 unit tests
2026-04-07 23:43:47 +08:00
d5b6cd24fc feat(tools): add SchemaCleanr for cross-provider schema normalization
- Add SchemaCleanr with CleaningStrategy enum (Gemini, Anthropic, OpenAI, Conservative)
- Support cleaning JSON schemas for different LLM provider compatibility
- Add $ref resolution, anyOf/oneOf flattening, const-to-enum conversion
- Add read_only, concurrency_safe, exclusive methods to Tool trait
- Add comprehensive unit tests for all schema cleaning features
2026-04-07 23:41:20 +08:00
2dada36bc6 feat: introduce multimodal content handling with media support
- Added ContentBlock enum for multimodal content representation (text, image).
- Enhanced ChatMessage struct to include media references.
- Updated InboundMessage and OutboundMessage to use MediaItem for media handling.
- Implemented media download and upload functionality in FeishuChannel.
- Modified message processing in the gateway to handle media items.
- Improved logging for message processing and media handling in debug mode.
- Refactored message serialization for LLM providers to support content blocks.
2026-04-07 23:09:31 +08:00
a051f83050 Refactor AgentLoop to manage history externally via SessionManager
- Removed internal history management from AgentLoop.
- Updated process method to accept conversation history as a parameter.
- Adjusted continue_with_tool_results to work with external history.
- Added OutboundDispatcher for handling outbound messages from MessageBus.
- Introduced InboundMessage and OutboundMessage structs for message handling.
- Updated Channel trait to include message handling and publishing to MessageBus.
- Refactored Session to manage chat histories instead of AgentLoop instances.
- Enhanced GatewayState to start message processing loops for inbound and outbound messages.
2026-04-07 21:53:37 +08:00
9834bd75cf feat: add calculator tool and integrate with agent loop
- Introduced a new CalculatorTool for performing various arithmetic and statistical calculations.
- Enhanced the AgentLoop to support tool execution, including handling tool calls in the process flow.
- Updated ChatMessage structure to include optional fields for tool call identification and names.
- Modified the Session and SessionManager to manage tool registrations and pass them to agents.
- Updated the OpenAIProvider to serialize tool-related message fields.
- Added a ToolRegistry for managing multiple tools and their definitions.
- Implemented tests for the CalculatorTool to ensure functionality and correctness.
2026-04-06 23:43:45 +08:00
4ed2f986a1 添加 tracing 日志支持,替换 println! 输出,增强错误处理和调试信息 2026-04-06 23:11:41 +08:00
09899ddb91 添加日志模块,初始化日志记录功能,设置日志目录为 ~/.picobot/logs,支持每日轮换 2026-04-06 22:51:50 +08:00
34ab439067 重构消息处理逻辑,添加 MessageHandler trait,支持多用户会话,更新 FeishuChannel 和 SessionManager,增强错误处理 2026-04-06 22:38:41 +08:00
04736f9f46 添加 Feishu 通道支持,重构配置以包含通道设置,更新依赖项,增强错误处理 2026-04-06 18:43:53 +08:00
35d201f206 重构项目结构,添加代理、网关和客户端模块,更新配置以支持默认网关设置,增强错误处理,添加 WebSocket 支持 2026-04-06 16:36:17 +08:00
8b1e6e7e06 实现基本的模型调用 2026-04-05 17:11:42 +08:00
5dc13ea7ce first commit 2026-04-05 14:59:23 +08:00