42 Commits
Author SHA1 Message Date
digua eadadda071 feat(electron): add persistent UI scale setting 2026-09-28 16:59:25 +08:00
digua 35880228b7 feat(electron): add Windows close-to-tray behavior 2026-08-07 20:29:37 +08:00
digua 62b7104f1f feat(import): add safe batch coordinator 2026-07-31 20:22:50 +08:00
digua 4155386676 fix(import): generate session index once 2026-07-31 17:22:05 +08:00
digua 860bf52d62 feat(analytics): add privacy-safe product telemetry
Add self-hosted Umami reporting alongside existing telemetry across Desktop and CLI Web.

Track normalized startup, import, feature, and AI usage with a stable anonymous ID and strict privacy allowlists. Keep incremental usage platform-independent and preserve accurate failure classifications and platform metadata across import paths.
2026-07-29 14:28:48 +08:00
xyz-225648andClaude 84b371e73d feat(security): 新增桌面端应用锁
新增 4 位 PIN、手动锁定、启动锁定和系统闲置锁定。

新增主进程与 preload 能力、桌面端设置面板、全局锁屏覆盖层及四语言界面。

Fixes #190

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-18 11:49:09 +08:00
digua 61d42b2500 fix(import): harden automatic incremental imports 2026-07-13 01:01:42 +08:00
digua 6dc35722c0 fix(import): disambiguate ChatLab reimports 2026-07-13 01:01:42 +08:00
digua 3e6f036826 feat(electron): enable automatic incremental imports 2026-07-13 01:01:42 +08:00
digua b346b51eee refactor(sync): share automation routes across runtimes 2026-07-02 10:35:02 +08:00
digua 70ada5031c fix(ai): share AI log opening route 2026-07-02 10:35:02 +08:00
diguaandClaude Sonnet 4.6 aff59c7503 feat(import): wire Google Chat archive sources into CLI, Electron and frontend
Add archive reader, Google Chat resolver and source manager in node-runtime.
Expose prepared archive sources via CLI HTTP route and Electron IPC.
Add frontend service adapters and an import selection flow with i18n support
for all four locales. Fix rescanning on repeated archive imports.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-24 18:10:30 +08:00
diguaandClaude Sonnet 4.6 c8cccbefd4 feat(analytics): track CLI web daily active users via shared AnalyticsService
- Extract shared AnalyticsService to packages/node-runtime using direct
  Aptabase HTTP API (removes @aptabase/electron dependency)
- Add POST /_web/telemetry/track route for generic event reporting
- Desktop: migrate analytics.json from userData to systemDir (~/.chatlab/),
  trigger daily active from renderer via new IPC so user-selected locale is used
- CLI: inject APTABASE_APP_KEY at build time, create AnalyticsService on
  server start, report app_active with platform: cli-web
- Both platforms report user-selected locale via platform service abstraction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-23 22:58:22 +08:00
diguaandCursor cc4e67bd24 refactor(data): remove pluginCompute plugin-compute path
图表已统一走缓存端点,pluginCompute 不再被任何调用方使用,移除其全链路实现。
pluginQuery 保留供消息浏览/搜索/分页与 session-index 等通用 SQL 访问。

- 删除 ElectronDataAdapter(已无覆写),electron registry 直接使用 FetchDataAdapter
- 移除 IPC handler、preload API/类型、worker dispatch 与 workerManager 导出中的 pluginCompute

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 23:54:12 +08:00
digua 6ec736c05a feat(export): simplify message export and support multiple formats 2026-06-10 22:18:20 +08:00
digua c2295e317f refactor: align ai chat and segment identifiers 2026-06-07 20:27:27 +08:00
CEQ151 8f785ee0a8 fix(desktop): smooth Windows title bar overlay 2026-06-05 11:12:42 +08:00
digua 218c3c9ee9 feat(ai): group desensitize rules 2026-06-04 14:37:12 +08:00
digua 04c97ca9cf fix(data): defer data directory migration until restart 2026-06-03 00:46:34 +08:00
digua eea1dad907 fix(electron): offload chart plugin compute to worker 2026-06-02 15:41:21 +08:00
digua bf14c68899 refactor(ai): migrate remaining AI IPC to shared HTTP routes 2026-06-02 15:41:21 +08:00
digua 7dcc37e714 refactor(electron): remove session index IPC 2026-06-02 15:41:21 +08:00
digua 1af644e4ab refactor(ai): migrate streaming to shared HTTP SSE
Squash Phase 2-2 streaming migration: frontend stream service, LLM SSE route, Agent SSE route, and IPC/preload cleanup.
2026-06-02 15:41:21 +08:00
diguaandCursor 769115240e feat(cache): migrate cache routes to shared HTTP package
Create CacheServiceAdapter + FetchCacheAdapter service layer and move
7 cache routes (info, clear, data-dir, import-log, save-to-downloads,
open-dir, show-in-folder) to @openchatlab/http-routes. Inject platform
callbacks (shell.openPath, showItemInFolder) via HttpRouteContext.
Frontend calls converge from window.cacheApi to useCacheService().
Electron IPC retains only selectDataDir/setDataDir (native dialog).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor fcca22a8dc refactor(ai): remove orphaned AI conversation/message IPC handlers
Migrate conversation/message CRUD and debug queries from IPC to HTTP
by having ElectronAIAdapter extend FetchAIAdapter. Remove 18 dead
handlers (14 CRUD + 3 debug + 1 compressContext) from ipc/ai.ts and
slim down preload AiApi to IPC-only methods (filtering, export, tool
testing, desensitize rules, native shell).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor ae90db63a5 feat(merge): migrate merge routes from IPC to shared HTTP package
Unify the merge workflow (parse/conflicts/execute/clear/export-for-merge)
across CLI, Electron, and web-serve into a single set of shared routes in
@openchatlab/http-routes.

Key changes:
- Move MergeSessionCache from CLI to node-runtime shared package
- Add dual-mode parse route (multipart upload for web, JSON filePath for Electron)
- Integrate merge routes into Electron internal API server with @fastify/multipart
- Create installMergeShims() with filePath-to-handle mapping for frontend
- Remove Electron merge IPC handlers, merger module, and preload bridges (~790 lines deleted)
- Address CodeX review: CHAT_DB_TABLES in openDatabase, no chatApi patching,
  outputName sanitization, resp.ok checks, @fastify/multipart in desktop deps

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor 3ab162162b feat(ai): migrate AI CRUD routes to shared package and establish frontend service layer
Extract LLM config, assistant, skill, conversation and summary CRUD
routes from CLI-specific ai.ts into @openchatlab/http-routes, enabling
Electron Internal Server to serve AI endpoints via shared routes.

Frontend service layer:
- Create src/services/{llm,assistant,skill}/ with typed adapters
- Migrate all window.llmApi/assistantApi/skillApi calls to service layer
- Clean up Electron preload: remove CRUD bridges, keep only streaming IPC

Shared AI routes (packages/http-routes):
- ai-llm: config CRUD, provider registry, model catalog, custom store
- ai-assistants: CRUD, import/reimport, tool catalog
- ai-skills: CRUD, import/reimport, builtin catalog
- ai-conversations: conversation/message/debug CRUD
- ai-summaries: summary generation with LLM config injection
- Add requireAi fail-fast option to registerSharedRoutes

Backend improvements:
- Extract CustomProviderStore/CustomModelStore to node-runtime
- Fix authProfile persistence (onApiKeyCreated returns profileName)
- Reuse AI manager singletons in Electron (avoid dual instances)
- Prevent plaintext API key leakage in addConfig response
- Add authProfile regression tests

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
diguaandCursor f9b5b6b13d refactor: consolidate IPC bridge to native-only
Remove business IPC handlers/preload APIs that are now served by
Internal HTTP Server: preferences, NLP, data queries, message search,
analytics, members, SQL lab. Migrate chart modules from window.*Api
direct calls to useDataService() and NLP components to HTTP.

Make Internal Server a hard dependency, delete ElectronDataAdapter/
MessageAdapter/PreferencesAdapter and IPC fallback path. Retain IPC
only for native capabilities: file import, AI/LLM, session-index
summaries, agent streaming.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
digua 96a9d143c4 feat(electron): add internal http server for renderer adapters 2026-06-02 15:41:21 +08:00
diguaandCursor 9bc0c4279d refactor(ui): simplify model button and optimize session index loading
- StatusBar model button: show model name instead of provider, click opens
  settings directly (scrolls to default model section), remove dropdown
- SessionIndexSection: replace N serial pluginQuery calls with single batch
  API (GET /_web/sessions/index-stats), add IntersectionObserver lazy loading
- Full-stack implementation: CLI route, Electron IPC/Worker, frontend adapters

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 10:28:29 +08:00
diguaandClaude Opus 4.8 a31c672474 feat(ai): add per-model thinking level selector in chat status bar
Adds a lightbulb button next to the model switcher in ChatStatusBar
that lets users choose the thinking intensity for each reasoning model,
with the choice remembered per model slot (configId:modelId).

Key changes:
- packages/core/src/ai/thinking.ts (new): per-model-type thinking level
  table inspired by cherry-studio's MODEL_SUPPORTED_REASONING_EFFORT.
  Covers Qwen/GLM (on/off), DeepSeek V4 (high/max), o-series
  (low/medium/high), gpt-5.x (minimal–xhigh), Kimi/Doubao/Grok and a
  default bucket. Exports getSupportedThinkingLevels, isReasoningModel,
  getThinkingCompat.
- packages/node-runtime/src/ai/llm-builder.ts: inferReasoning now calls
  getThinkingCompat() which sets compat.supportsReasoningEffort and
  compat.thinkingLevelMap so pi-ai can inject the correct request param
  (reasoning_effort for OpenAI/DeepSeek, enable_thinking for Qwen/GLM).
- packages/node-runtime/src/ai/agent/types.ts + core.ts: AgentCoreOptions
  gains an optional thinkingLevel; core.ts:93 uses clampThinkingLevel()
  (from pi-ai) to honour it safely.
- Full transparent pass-through: desktop Agent → IPC handler → preload
  → agentApi.runStream; CLI HTTP route → runServerAgent → runAgentCore.
- src/stores/prompt.ts: thinkingLevels Record<configId:modelId,
  ThinkingLevel> persisted in backendPersist; getThinkingLevel/
  setThinkingLevel helpers.
- src/stores/aiChat.ts: reads current model slot and passes remembered
  level to both sendMessage and editCurrentRoundOnly runStream calls.
- ChatStatusBar.vue: UPopover thinking selector appears only for
  reasoning models, shows only the levels that model supports, highlights
  current choice, hides for non-reasoning models.
- 46 tests passing (26 new in thinking.test.ts + 20 in llm-builder).

Scope: openai-completions path only (Qwen, DeepSeek, OpenAI, xAI, Kimi,
Doubao, SiliconFlow, OpenRouter…). Anthropic/Gemini native thinking is
out of scope for this version.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 10:28:29 +08:00
diguaandClaude Opus 4.8 1716cf392f refactor(ai): replace manual reasoning switches with auto-inference
Remove the "Reasoning Model" and "Disable Thinking Mode" toggles from
the model config dialog. These switches were injecting `enable_thinking`
(a Qwen/DashScope-specific request parameter) into all providers,
causing 400 errors on OpenAI, Anthropic, Gemini, and other official
services.

Replace with automatic inference in buildPiModel:
- reasoning: true when the model's catalog capabilities include
  'reasoning'; falls back to a model-name heuristic for unlisted
  custom/self-hosted models (qwen3, qwq, deepseek-r, o1/o3, etc.).
- compat.thinkingFormat 'qwen': only set when reasoning is true AND
  the model is from the qwen provider or the model id contains
  "qwen"/"qwq". All other providers get compat: undefined and will
  never receive enable_thinking.

This means official reasoning models (o3, deepseek-reasoner, etc.) now
automatically get thinkingLevel:'medium', and self-hosted Qwen3
models continue to work as before — without any manual toggle.

Behavior change: models with 'reasoning' in their catalog capabilities
now default to thinkingLevel:'medium' (previously always 'off' unless
the manual switch was enabled).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-31 10:28:29 +08:00
diguaandCursor fdb6d8f648 feat(import): update demo data sources to 4 files
Switch from 2 demo files (group + private) to 4 files:
- demo-group.json
- demo-private-A-cuilan.json
- demo-private-B-wukong.json
- demo-private-C-spider.json

Update DemoImportResult.privateSessionId to privateSessionIds array
to support multiple private chat demos.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 14:19:42 +08:00
diguaandCursor 6224ca996e refactor(ai): replace branching with edit-and-regenerate model
Remove the message branching/tree system in favor of a simpler editing model:
- Default: edit a message and only regenerate the current round's AI response
- Optional: overwrite all subsequent messages when editing

Key changes:
- Backend: add updateMessageContent, deleteAndRelinkMessage, insertMessageAfter,
  deleteMessagesFrom, forkConversation; remove createMessageBranch, switchMessageBranch
- Platform layer: add IPC/HTTP handlers for new methods across Electron and CLI
- Frontend store: refactor editMessageAndRegenerate with two modes
- UI: replace branch navigation with "overwrite subsequent" checkbox,
  auto-resizing edit textarea
- Fix insertMessageAfter missing debug_context from pendingDebugContextMap
- Update tests to cover new editing methods

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 14:19:42 +08:00
CEQ151 d3c62c4f9d feat(ai): support editable message branches 2026-05-30 14:19:42 +08:00
diguaandCursor 6727ff609c feat(ai): add summary strategy with brief and standard detail levels
Support two summary strategies (brief/standard) for AI-generated session
summaries. Users can choose their preferred detail level in Settings > AI >
Session Index. Standard (default) produces richer summaries covering people,
events, and key details.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 23:47:27 +08:00
diguaandClaude Sonnet 4.6 10a2677d74 feat(home): refactor import area and add API/auto-sync import methods
Restructure import components into dedicated import/ directory with new
ImportTabSelector, ApiImportCard, and AutoSyncCard components. Add demo
import, entry animation, and tutorial links to home page. Update i18n
translations for all locales. Add chatApi init guard in registry and
defaultPath to DataDirInfo preload interface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 23:19:47 +08:00
digua a5bbff34e4 feat(sync): use incremental session index after pull sync
After pull-sync imports new messages, generate session index incrementally
instead of full regeneration. This preserves existing sessions and their
summaries, only processing newly imported (unindexed) messages.

Adds generateIncremental method across the full stack:
- core: already had generateIncrementalSessionIndex
- node-runtime: expose generateIncrementalIndex
- CLI: add POST /_web/sessions/:id/generate-incremental-index route
- Electron: add session:generateIncremental IPC handler
- Frontend: add generateIncremental to SessionIndexAdapter interface
2026-05-23 16:28:50 +08:00
digua 7d5c541933 feat(sync): add option to delete imported chats when removing subscription
- Show confirmation dialog with two choices: keep data or delete imported chats
- Backend supports deleteData param across CLI routes and Electron IPC
- DataSourceManager.removeSession now returns the removed session info
- Add i18n strings for the delete confirmation dialog (zh-CN/en-US/ja-JP/zh-TW)
2026-05-23 16:28:50 +08:00
diguaandCursor 9421662a52 feat(import): support unified directory import for Electron and Web
Add directory import support for multi-file formats (e.g. shuakami chunked-jsonl).
Users can select or drag-and-drop a directory via the "Import Folder" checkbox.

- Add `findEntryFileInDirectory()` to parser layer for format-agnostic entry file discovery
- Add `importDirectory` method to ImportAdapter interface
- Implement FetchImportAdapter.importDirectory with multi-file FormData upload
- Add `POST /_web/import-directory` CLI route with directory reconstruction
- Add `chat:importDirectory` IPC handler in Electron main process
- Enhance FileDropZone with `directory` prop and drag-and-drop directory support
- Refactor FetchImportAdapter to extract reusable `consumeSseStream` helper

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 10:20:39 +08:00
digua 08260499f8 feat: migrate localStorage to backend storage with declarative persist plugin
- Add backendPersist Pinia plugin for declarative preferences.json persistence
- Move Preferences types to @openchatlab/shared-types (single source of truth)
- Migrate sessionGapThreshold from localStorage to config.toml [ui]
- Migrate chatlab_filter_history from localStorage to preferences.json
- Fix stale localStorage locale read in i18n/index.ts
- Simplify usePreferencesSync (172 → 75 lines) by delegating to plugin

Adding a new backend-synced preference now only requires 3 changes:
1. shared-types interface  2. node-runtime DEFAULTS  3. store backendPersist.pick
2026-05-19 22:42:00 +08:00
digua b12c07dc32 refactor: extract Electron shell to apps/desktop/
Move Electron-specific code (main, preload, shared) and configs
(electron.vite, electron-builder) into apps/desktop/ to prepare
for multi-platform support (Web Browser standalone).

- Create apps/desktop/ with dedicated package.json and tsconfig
- Split Electron deps (electron, electron-updater, better-sqlite3,
  etc.) from shared frontend deps in root package.json
- Declare better-sqlite3 and @node-rs/jieba in packages/node-runtime
- Add stream-json to packages/parser where it belongs
- Update all path aliases (@electron/* → apps/desktop/*) in tsconfig,
  vite configs, and relative imports in preload/main
- Keep slim root tsconfig.node.json as shared base for packages
- Update CI/CD release workflow for new directory layout
- Fix pre-existing type errors (pi-ai Model generic, SQLLabTab
  LLMChatStreamChunk, filter.test.ts empty methods)
2026-05-19 00:31:00 +08:00