Data flow inversion:
- Add getHistoryForAgent() in conversations.ts — Agent now reads
history directly from SQLite instead of receiving it from frontend
- Remove historyMessages parameter from agent:runStream IPC chain,
add maxHistoryRounds for configurable context window
- Frontend (useAIChat.ts) pre-creates conversation before Agent call,
removes history message collection logic
IPC fixes:
- Restore llm:chat and llm:chatStream handlers using pi-ai's
completeSimple/streamSimple (P0-1: SQLLab compatibility)
- Send agent:complete with aborted flag in all abort paths to prevent
hanging Promises in renderer (P0-2)
- Fix createConversation parameter order to match preload/data layer
contract: (sessionId, title?) instead of (title, sessionId?) (P1)
Preload/frontend:
- Update preload API signatures and type declarations
- Use shared types for TokenUsage and AgentRuntimeStatus
- Add electron/shared/types.ts as single source of truth for
TokenUsage and AgentRuntimeStatus across main/preload/renderer
- Refactor ChatStatusBar.vue to use shared types and i18n keys
instead of hardcoded phase text mappings
- Add phaseShort translations for zh-CN and en-US
- Delete monolithic registry.ts (−1185 lines)
- Add tools/definitions/ with 12 individual tool files + index.ts,
each using AgentTool interface and TypeBox schemas
- Add tools/utils/ with shared helpers (format.ts, schemas.ts, time-params.ts)
- Rewrite tools/index.ts to provide getAllTools() factory
- Clean up tools/types.ts, keep only ToolContext and OwnerInfo
- Use i18n keys for tool descriptions, preserve Chinese as comments
- Refactor llm/index.ts: remove chat()/chatStream() wrappers, inline
provider info from deleted service files, add buildPiModel() for
direct pi-ai model construction
- Migrate summary/index.ts to use pi-ai's completeSimple directly
- Migrate rag/pipeline/semantic.ts to use pi-ai's completeSimple directly