Commit Graph

5271 Commits

Author SHA1 Message Date
DrSmoothl
2e3dd44ee9 Refactor chat stream handling to use BotChatSession
- Updated imports and references from ChatStream to BotChatSession across multiple files.
- Adjusted method signatures and internal logic to accommodate the new session management.
- Ensured compatibility with existing functionality while improving code clarity and maintainability.
2026-03-07 00:57:37 +08:00
UnCLAS-Prommer
8712fc0d05 移除多余内容 2026-03-06 23:07:31 +08:00
UnCLAS-Prommer
c2b75a03d7 数据库模型字段添加;数据模型添加;utils_message传参控制 2026-03-06 22:45:47 +08:00
DrSmoothl
baae2df154 feat: 集成新版本插件运行时,支持事件桥接与命令处理 2026-03-06 16:37:56 +08:00
DrSmoothl
d5cf4c9b8b refactor: 添加类型注解以增强代码可读性和类型安全 2026-03-06 12:35:31 +08:00
DrSmoothl
c6afa97060 补全新版插件系统的类型注解 2026-03-06 12:17:00 +08:00
DrSmoothl
1cd366bc09 refactor: 优化代码结构,简化条件判断和异常处理 2026-03-06 12:00:00 +08:00
DrSmoothl
2f21cd00bc feat: Enhance plugin runtime with new component registry and workflow executor
- Introduced `ComponentRegistry` for managing plugin components with support for registration, enabling/disabling, and querying by type and plugin.
- Added `EventDispatcher` to handle event distribution to registered event handlers, supporting both blocking and non-blocking execution.
- Implemented `WorkflowExecutor` to manage a linear workflow execution across multiple stages, including command routing and error handling.
- Created `ManifestValidator` for validating plugin manifests against required fields and version compatibility.
- Updated `RPCClient` to use `MsgPackCodec` for message encoding.
- Enhanced `PluginRunner` to support lifecycle hooks for plugins, including `on_load` and `on_unload`.
- Added sys.path isolation to restrict plugin access to only necessary directories.
2026-03-06 11:55:59 +08:00
DrSmoothl
61dc15a513 feat(plugin-runtime): add plugin isolation IPC infrastructure
- Protocol layer: Envelope model with Pydantic schema, MsgPack/JSON codecs, unified error codes
- Transport layer: cross-platform IPC abstraction with 4-byte length-prefixed framing (UDS + TCP fallback)
- Host: RPC server, policy engine, circuit breaker, capability service, supervisor with hot-reload
- Runner: RPC client, plugin loader, process entry point
- Tests: 16 passing tests covering protocol, transport, host, and E2E handshake
2026-03-06 02:01:30 +08:00
DrSmoothl
10d5c81268 feat: 添加 .coderabbit.yaml 配置文件以支持代码检查和格式化 2026-03-06 00:49:02 +08:00
DrSmoothl
8f41e25696 fix(dashboard): resolve TS build errors in a11y changes
- Fix duplicate className attr in EmojiDialogs.tsx
- Replace animated.div with animated('div') in expression-reviewer and zoomable-chart to fix React 19 children type error
- Fix malformed i18n JSON (a11y namespace was outside root object)
2026-03-05 22:10:32 +08:00
DrSmoothl
e3cfca17a6 chore: add bunfig.toml and remove package-lock.json 2026-03-05 21:57:43 +08:00
DrSmoothl
c658b2314d feat(a11y): apply ARIA roles, landmarks, focus management, touch targets and contrast fixes across components 2026-03-05 21:57:36 +08:00
DrSmoothl
c12d1ca42a feat(a11y): add a11y infrastructure — skip-nav, announcer, touch CSS, eslint-jsx-a11y 2026-03-05 21:57:27 +08:00
DrSmoothl
34bd115fa1 efactor(network): centralize port validation and enforce strict configured ports
add a shared port checker utility for availability and conflict detection
migrate WebUI, message server, and additional API server to use the new module
fail fast with clear error hints when a configured port is occupied (no auto-increment)
2026-03-04 22:14:53 +08:00
DrSmoothl
2a33fd1121 refactor(llm): enable hot-reload for model config and client runtime
make LLM task config resolution dynamic in LLMRequest
load model clients on demand from latest config
clear client instance cache on config reload
remove stale module-level model_config usage in llm_api
add hot-reload tests for LLM/config watcher flow
2026-03-04 21:56:50 +08:00
DrSmoothl
b3a81754e6 feat(config): harden file watcher hot-reload flow and add test coverage
refactor FileWatcher to subscription-based dispatch with path/change filters
add callback timeout, failure cooldown, auto-retry loop, and runtime stats
strengthen ConfigManager hot-reload with throttling, timeout guard, and watcher stats logging
add pytest suites for watcher behavior and config hot-reload edge cases
2026-03-04 21:39:26 +08:00
DrSmoothl
5cccdf6715 feat(llm): 添加响应格式转换功能,支持JSON_SCHEMA输出 2026-03-04 21:11:10 +08:00
UnCLAS-Prommer
81bc25dba8 Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-03-04 21:06:53 +08:00
UnCLAS-Prommer
d03dc3601e 消息构建器:将消息转换为可读消息;其对应的测试文件 2026-03-04 21:01:51 +08:00
DrSmoothl
a65a40f85f feat(dashboard): add i18n support with zh/en/ja/ko locales
- Add react-i18next + i18next + i18next-browser-languagedetector
- Create i18n config (singleton import) with zh/en/ja/ko JSON locale files
- Add language switcher Globe dropdown in Header topbar
- Replace all hardcoded Chinese strings in:
  - Layout (Header, Sidebar, NavItem, Layout, constants)
  - Settings (index, AppearanceTab, SecurityTab, OtherTab, AboutTab)
  - Auth page (auth.tsx)
  - Search dialog (searchItems via useMemo + t())
  - Restart overlay (getStatusConfig accepts t param)
  - Error boundary (ErrorFallback, ErrorDetails function components)
  - HTTP warning banner
- localStorage key: maibot-locale
- Compatible with Electron
2026-03-03 20:50:06 +08:00
DrSmoothl
5cc34f24c0 fix(.gitignore): add dist-electron and .sisyphus to ignored files 2026-03-03 01:25:12 +08:00
DrSmoothl
4561cd91b8 fix(electron): use named Schema import from electron-store v8+ 2026-03-03 01:19:37 +08:00
晴猫
46babf7294 添加TODO注释以提醒测试trigger_tracker方法 2026-03-03 02:18:59 +09:00
晴猫
71a5acbac5 优化ReflectTracker逻辑,确保在追踪时表达不为None,简化代码并增强可读性 2026-03-03 02:18:04 +09:00
晴猫
efaff7ac60 实现追踪检查逻辑,添加消息数量和LLM判断,更新表达并持久化到数据库 2026-03-03 02:18:04 +09:00
DrSmoothl
c6545afa2e fix(package): format target configurations and update electron-store version 2026-03-03 01:16:04 +08:00
DrSmoothl
65774f3afc feat(electron): add Electron UI components and layout integration 2026-03-03 00:57:50 +08:00
DrSmoothl
fc394f4412 feat(electron): adapt renderer API and WebSocket layer for dynamic backend URL 2026-03-03 00:57:50 +08:00
DrSmoothl
b5cc361ce9 feat(electron): add main process, preload, store, protocol, and type definitions
- Add ElectronAPI type definitions and runtime contract (isElectron guard)
- Add electron-store with backend connection data model
- Add centralized API base URL utility (api-base.ts)
- Implement app:// custom protocol with API proxy
- Implement preload script with full contextBridge API
- Complete main process: BrowserWindow config, IPC handlers, window controls
- Register app:// scheme as privileged for secure renderer access
2026-03-03 00:57:50 +08:00
DrSmoothl
e6862e227b feat(electron): scaffold electron-vite project structure
Initialize Wave 1 Electron integration with:
- electron v40.6.1, electron-vite v5.0.0, electron-builder v26.8.1
- Main entry point: electron/main/index.ts with app:// protocol registration
- Preload placeholder: electron/preload/index.ts for Wave 2 IPC
- electron.vite.config.ts with unified renderer chunk splitting strategy
- tsconfig.electron.json with ESNext module support
- Updated package.json with electron dependencies and scripts:
  - electron:dev, electron:build, electron:preview
- All original scripts (dev, build, test, etc) remain unchanged
- TypeScript compilation verified: tsc --noEmit passes
- Ready for Wave 2: IPC bridge and contextBridge exposure
2026-03-03 00:57:50 +08:00
晴猫
91765400f6 修复脚本注释,添加macOS支持,重构依赖管理和服务控制逻辑 2026-03-03 01:13:52 +09:00
UnCLAS-Prommer
c16ced765e 适配db的修改;MessageComponent更新 2026-03-02 20:37:15 +08:00
UnCLAS-Prommer
3f93d93b9a 补上default 2026-03-02 20:34:52 +08:00
UnCLAS-Prommer
0751ac5066 Merge branch 'r-dev' of github.com:Mai-with-u/MaiBot into r-dev 2026-03-02 17:23:45 +08:00
UnCLAS-Prommer
e200b5b581 给Expression系统的一些准备文件 2026-03-02 17:18:13 +08:00
DrSmoothl
ba47069dfe refactor(types): eliminate all as any type assertions (30 → 0)
- Replace MouseEvent-only handlers with MouseEvent | KeyboardEvent unions in multi-select and ChatTabBar
- Define LegacyInstalledPlugin type for backward compatibility in plugin-api
- Create getTokenValue() helper for type-safe theme token access in AppearanceTab
- Define ModelConfig interface for model configuration type safety in modelProvider
- All modifications maintain exact business logic equivalence
- Build passes with zero TypeScript errors (bun run build )
- LSP diagnostics clean on all modified files
2026-03-01 21:33:40 +08:00
DrSmoothl
c45ee1a98e refactor(routes): review and fix config/bot/ directory (T16)
- Fixed import order in bot.tsx, ChatSection.tsx and Hook files
- Replaced 'as any' with specific type assertions (ExpressionConfig, PersonalityConfig, etc.)
- All files now comply with AGENTS.md import rules
- Build passes with zero errors
- LSP diagnostics clean on all modified files

Changes:
- bot.tsx: Reorganized imports (React first, then third-party, then @/, then ./)
- ChatSection.tsx: Fixed import order
- *SectionHook.tsx (4 files): Added type imports, replaced 'as any' with typed assertions

Note: ProcessingSection (1121 lines) and ExpressionSection (996 lines)
not split due to tight coupling and clear responsibilities.
2026-03-01 21:17:17 +08:00
DrSmoothl
763412e483 refactor(routes): split knowledge-graph.tsx into modular knowledge-graph/ directory (T19d) 2026-03-01 21:05:40 +08:00
DrSmoothl
c8e93d4d50 refactor(routes): split emoji.tsx into modular emoji/ directory (T19c) 2026-03-01 20:52:27 +08:00
DrSmoothl
31856422d1 refactor(routes): split jargon.tsx into modular jargon/ directory (T19b)
- 拆分 jargon.tsx (1064行) 为 5 个模块化文件
  - index.tsx (460行) - 主容器 + 17 个 useState
  - JargonDialogs.tsx (527行) - 5 个对话框组件
  - JargonList.tsx (255行) - 表格+卡片双视图
  - types.ts (17行) - StatsData 类型定义
  - index.ts (1行) - barrel 导出
- 保留所有功能:CRUD、搜索、筛选、批量操作、分页
- 统一 API 错误处理模式
- 响应式设计完整保留(桌面端表格 + 移动端卡片)
- 构建验证通过,零错误

Wave 4 - Task 19b (jargon)
2026-03-01 20:42:49 +08:00
DrSmoothl
bacb5b19cd refactor(routes): split expression.tsx into modular expression/ directory
- Split 1212-line monolithic file into 6 modular files
- Extracted types, dialogs, list view into separate modules
- Main index.tsx (468 lines) handles state management and API integration
- All CRUD operations, stats, review, search, pagination preserved
- Build passes with zero TypeScript errors (3.77s)
2026-03-01 20:23:53 +08:00
DrSmoothl
7866443c9c refactor(routes): modernize auth, setup, person routes
- auth.tsx: 统一错误处理,使用 parseResponse<T>
- setup/api.ts: 重构 12 个函数使用 ApiResponse 模式
- person.tsx: 优化 imports,使用 import type 语法
- 构建验证通过
- 功能完全等价
2026-03-01 20:11:32 +08:00
DrSmoothl
e9a081d46b refactor(react19): replace Context.Provider with Context value={}
- 升级 6 个文件的 Context 语法为 React 19 标准
- ThemeProviderContext, ChartContext, AnimationContext, TourContext, AssetStoreContext, RestartContext
- 构建验证通过
- 功能完全等价
2026-03-01 20:02:04 +08:00
DrSmoothl
e1f9936561 refactor(config): split modelProvider.tsx into modular directory
- 拆分为 7 个文件:index.ts (barrel), types.ts, utils.ts, 3 个组件, index.tsx (主页面 895行)
- 所有子组件 < 500 行
- 构建零错误
- 功能完全等价
2026-03-01 19:58:18 +08:00
DrSmoothl
b800011ed7 refactor(config): split ChatSection.tsx into sub-components
- 将 ChatSection.tsx (610行) 拆分为 4 个子组件
- TimeRangePicker.tsx: 时间范围选择器组件
- RulePreview.tsx: 规则预览组件
- RuleEditor.tsx: 规则编辑器组件
- RuleList.tsx: 规则列表组件
- ChatSection.tsx 重构为主容器组件 (197行)
- 功能完全不变,构建零错误
- 遵循具名导出规范

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-01 19:41:47 +08:00
DrSmoothl
c53840006d refactor(lib): split plugin-api.ts into plugin-api/ directory
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-01 19:35:36 +08:00
DrSmoothl
feb2b89917 refactor(routes): split plugins.tsx into modular plugins/ directory
- Extract types.ts: Plugin types and category name mapping
- Extract PluginCard.tsx: Single plugin card component
- Extract MarketplaceTab.tsx: All plugins marketplace view
- Extract InstalledTab.tsx: Installed plugins view
- Extract InstallDialog.tsx: Plugin installation dialog with branch selection
- Create index.tsx: Main PluginsPage with WebSocket state management
- Delete original 1244-line plugins.tsx
- Maintain full functionality, zero logic changes
- Build verified: bun run build passes with zero errors
2026-03-01 19:30:47 +08:00
DrSmoothl
f334d9882d refactor(dashboard): split chat.tsx into modular chat/ directory
- Extract types, utils, and components into separate files
- types.ts: All interfaces and type definitions (107 lines)
- utils.ts: Pure utility functions (50 lines)
- MessageRenderer.tsx: Message rendering components (96 lines)
- VirtualIdentityDialog.tsx: Virtual identity dialog (206 lines)
- ChatTabBar.tsx: Tab bar component (79 lines)
- index.tsx: Main ChatPage component (1147 lines)
- Update router import path to chat/index
- Fix TypeScript type imports per verbatimModuleSyntax
- Build passes with zero errors
2026-03-01 19:19:22 +08:00
DrSmoothl
34b05e4e16 fix(hooks): remove duplicate save calls in useAutoSave legacy 2026-03-01 19:09:08 +08:00