Ding, Shuo 8dc5354fa4 feat: implement streaming chat, skill routing, and SAFe PI planning tools
- Add /api/chat/stream endpoint with Server-Sent Events (SSE) for real-time message streaming
  * Implement StreamEvent types (thought, tool_call, tool_result, final, error)
  * Add StreamEventCallback mechanism for event propagation
  * Create StreamChatHandler in webui/bot with proper HTTP headers and flushing

- Implement LLM-based skill router for intelligent capability selection
  * Add optional routerLLM client for semantic routing
  * Implement routeSkillsWithLLM() to match user intent to available skills
  * Add matchSkillsByName() for fuzzy skill matching
  * Update buildUnifiedSystemPrompt() to use routed skills

- Add streaming support to ReAct pipeline
  * Implement runUnifiedReActStream() for streaming thought/action/observation
  * Emit StreamEvent at each ReAct step
  * Support callback error handling in streaming mode

- Integrate three new DevOps tools
  * tools/filedoc: Extract document content from file_id via OpenAI
  * tools/giteaticket: Create Gitea issues from PI plan items with SAFe metadata
  * tools/piplan: Publish PI planning blueprints with dependency tracking

- Add SAFe PI Planning skill
  * Implement PM/SA/RTE (iron triangle) workflow
  * Support for Feature, Enabler, and Dependency definition
  * Automatic task decomposition and Gitea integration

- Create frontend integration documentation
  * Complete SSE protocol specification
  * TypeScript fetch + ReadableStream example
  * LLM-ready refactoring template for other projects

- Simplify file handling
  * Remove legacy file context structures and dual-mode processing
  * Consolidate file operations into UploadAndCacheFiles()
  * Remove FilePromptMode configuration and related complexity

- Update configuration
  * Add Router model support (LLM_ROUTER_MODEL)
  * Add Gitea configuration (BaseURL, Token, Owner, Repo)
  * WebSearch and additional tool infrastructure

Tests: All 22 test packages passing, 8/8 webui tests including 3 new stream tests
2026-03-11 17:58:19 +08:00
2026-02-21 23:01:39 +08:00

LaodingBot (MVP)

Go-based personal Telegram Agent with:

  • Telegram polling transport
  • OpenAI-compatible LLM client
  • SQLite conversation memory + simple compression
  • Tool registry with built-in file, shell, and git tools
  • Default-deny security policy via allowlists
  • Soul markdown loading for bot personality
  • Skills markdown loading for capability context
  • ReAct decision loop with automatic tool execution

Now supports mutually exclusive message channels:

  • telegram (long polling)
  • feishu (official SDK websocket long connection)

Quick Start

  1. Prepare env variables (see configs/env.sample).
    • The app auto-loads configs/env (or .env) if present.
    • You can also set CONFIG_ENV_FILE=/path/to/env.
    • Process environment variables override file values.
  2. Choose exactly one channel with MESSAGE_CHANNEL=telegram|feishu.
    • If telegram: set TELEGRAM_BOT_TOKEN, keep FEISHU_* empty.
    • If feishu: set FEISHU_APP_ID and FEISHU_APP_SECRET, keep TELEGRAM_BOT_TOKEN empty.
  3. Set log level with LOG_LEVEL=debug|info|warn|error.
    • To inspect full skill/tool execution content and detailed ReAct step traces, use LOG_LEVEL=debug.
  4. Configure knowledge and reasoning:
    • SOUL_PATH for bot personality markdown.
    • SKILLS_DIR for skills markdown directory.
    • REACT_MAX_STEPS for maximum ReAct steps.
  5. Create runtime directories:
mkdir -p data workspace
  1. Run:
go mod tidy
go run ./cmd/bot

Telegram Usage

  • Normal text enters unified agent pipeline:
    1. Receive message and load recent memory context
    2. Match relevant skill(s) from skills/
    3. If no skill matched, respond via direct LLM
    4. If skill matched, run ReAct and call tools (shell / file / git) only when needed
    5. Return final answer
  • No /tool ... command is required for normal use.

Feishu Usage

  • Bot uses Feishu official SDK long connection (ws) to subscribe im.message.receive_v1 text events.
  • Received text is forwarded to the same agent pipeline and replied back to the same chat.

Knowledge Files

  • Soul file default path: bot_context/soul.md
  • Skills directory default path: skills/
  • Skill format uses subdirectories: skills/<skill_name>/skill.md

Security Notes

  • shell only allows commands listed in ALLOWED_COMMANDS.
  • file only allows paths inside ALLOWED_DIRS.
  • git only allows common git subcommands and runs inside WORK_DIR.
  • Working directory for shell is limited by WORK_DIR.

Next Iteration

  • Add skill runtime (process-level hot-plug via RPC)
  • Add bootstrap pipeline (generate -> vet/test -> sandbox run -> register)
  • Add approval gate for risky commands
Description
No description provided
Readme 13 MiB
Languages
Go 99.4%
Shell 0.3%
Dockerfile 0.3%