Commit Graph
100 Commits
Author SHA1 Message Date
diguaandCursor a75fd0186d feat(cli): add --require-auth flag for /_web/* API protection
When enabled, all /_web/* routes require Bearer token authentication,
same as /api/v1/*. This hardens security for server/headless/public
deployments where the same-origin assumption doesn't hold.

- Add `require_auth` field to config schema (default: false)
- Add `setRequireAuth()` to auth hook, conditionally enforce auth on /_web/*
- Support `--require-auth` in both `chatlab start` and `--daemon` mode
- Read from config.api.require_auth or CLI flag override

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-02 15:41:21 +08:00
digua a6039d95ab release: v0.23.1 2026-06-01 11:23:00 +08:00
diguaandClaude Sonnet 4.6 d83c21caa2 docs: improve README for both end-users and developers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 17:01:13 +08:00
diguaandClaude Sonnet 4.6 9853c33e0b fix(cli): improve port-check error handling
- isPortAvailable 只将 EADDRINUSE 映射为 false,其他错误(EACCES/
  EADDRNOTAVAIL 等)通过 reject 抛出,避免误报"端口被占用"
- 将端口预检移入 startup try/catch 块内,确保所有绑定错误都走
  统一的 "Startup failed" 报错路径,不产生未处理的 Promise rejection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 1b596d664f fix(ui): fix sidebar tooltip placement and API for Nuxt UI v4
Nuxt UI v4 废弃 :popper="{ placement }",改为 :content="{ side }",
旧写法被忽略导致 tooltip 一律显示在下方。

- 展开态按钮(收起、搜索、排序、管理)→ side: bottom
- 折叠态元素(会话项、SidebarButton)→ side: right
- SidebarButton 重构:UTooltip 只包折叠态 div,避免 Reka UI as-child
  在 v-if/v-else 切换时 trigger 引用错乱导致 tooltip 位置错误

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 69d887c7e2 fix(ui): fix TitleBar dark mode red background and z-index layering
1. 移除 :global(.dark) + 子选择器写法(Vue scoped 编译时选择器泄漏导致
   html.dark { background: #e81123 } 使网页外背景变红),改用 CSS 变量
   + 独立非 scoped <style> 块覆盖深色模式
2. 将 z-index 从 30 提升至 40,使 TitleBar 高于 PageHeader 的
   titlebar-drag-cover (z-30),同时低于 header-actions (z-40, 后挂载),
   三层层叠关系正确:drag-cover < TitleBar ≤ header-actions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 b01c6c7e7a fix(daemon): use bin/chatlab.mjs as launchd/systemd entry point
dist/cli.mjs 只导出 run() 而不调用它,直接运行会立即静默退出(exit 0)。
bin/chatlab.mjs 才是真正调用 run() 的可执行入口,与 npm bin 字段一致。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 8c98daa654 feat(cli): pre-check port availability before startup with friendly error
启动前主动探测端口是否可用,被占用时立即给出可操作的引导(换端口 / lsof 命令),
避免先初始化 DB/路由后才抛 EADDRINUSE 的延迟报错体验。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 0a916e4b17 fix(types): use AIMessageRole type for message role params & strengthen conversation test assertion
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 c1e317a38a feat(cli): add clb as a short alias for the chatlab command
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
diguaandClaude Sonnet 4.6 b96ec69730 fix(cli): add /_proxy/chatlab.fun reverse proxy for web mode
在 Web 生产模式(chatlab start)下,浏览器无法直连 chatlab.fun(CORS 限制),
导致首页底部社交链接(如小红书)及云端助手/技能预设拉取失败。
Vite dev proxy 已有对应配置,但生产 Fastify server 缺少该代理,现补全。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 16:56:08 +08:00
digua d1637b41b8 feat(ui): optimize page header and toolbar layout 2026-05-31 16:56:08 +08:00
digua 066564c64e release: v0.23.0 2026-05-31 14:01:13 +08:00
diguaandClaude Sonnet 4.6 9db9614246 fix(build): export getAllIndexStats from query index & add pre-release checks to changelog skill
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 14:01:13 +08:00
diguaandClaude Sonnet 4.6 334544880f fix(ai): enable thinking for effort-based models when 'auto' is selected
When the user selects 'auto' thinking level for an effort-based reasoning
model (Kimi, Doubao) that has thinkingLevelMap but no thinkingFormat,
the previous code fell through to `return undefined`, causing pi-agent-core
to treat it as 'off' and send reasoning_effort:'none' to the API —
silently disabling thinking.

pi-ai's clampThinkingLevel only covers EXTENDED_THINKING_LEVELS (no 'auto'),
so 'auto' cannot be forwarded verbatim. Return 'high' instead, matching
the behavior for thinkingFormat models, to at least enable reasoning.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:28:29 +08:00
diguaandClaude Sonnet 4.6 7558eed5a5 fix(ai): fall back to heuristic for non-builtin custom models in inferReasoning
Custom models auto-saved by ensureCustomProvidersAndModels carry only
capabilities:['chat'], so inferReasoning was returning reasoning=false
even for models like qwen3:8b whose names match the reasoning heuristic.
The UI still showed thinking levels via getSupportedThinkingLevels, but
selections were silently ignored by the backend.

Fix: for non-builtin (builtin=false) model definitions, also apply the
name/provider heuristic as a fallback alongside the capabilities check.
Builtin catalog models remain authoritative.

Adds a regression test covering the exact findModelFn shape produced by
ensureCustomProvidersAndModels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:28:29 +08:00
diguaandCursor 999ce58007 fix(ai): use active slot modelId for thinking level and context window computation
The supportedThinkingLevels, modelContextWindow, and model name display
were reading from config.model (static config value) instead of the
slot's modelId (actual user-selected model). This caused the thinking
selector to show/hide incorrectly when users switched models.

Also fix HTTP utils sending Content-Type: application/json with empty
body when body is null (e.g. setFastModel(null)), which caused Fastify
to return 400.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 10:28:29 +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
diguaandCursor 783d61f742 feat(ai): upgrade thinking level control with default/auto options and broader model coverage
- Add 'default' option (no reasoning params sent, model uses native behavior)
- Add 'auto' option for models that natively support it (deepseek_hybrid, kimi, doubao)
- Expand model recognition with regex coverage for 15+ model families
- Add Gemini 2.5+ thinking level support via native Google provider
- Simplify deepseek_hybrid options to ['default', 'off', 'auto'] aligned with Cherry Studio
- Use primary theme color for thinking selector instead of hardcoded blue
- Update docs with thinking control architecture section

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 886642c1a4 feat: split message view into type/time analysis tabs with enriched profile cards
Split the monolithic MessageView into two focused modules:
- TypeAnalysisView: type distribution, text depth analysis, length distributions
- TimeAnalysisView: hourly/weekday/monthly/yearly distributions, member trend, heatmap, calendar

Each tab has a redesigned narrative profile card with rich insights:
- TypeProfileCard: date range, total messages, non-text breakdown pills, 4 metric cards
- TimeProfileCard: active days narrative, time personality labels (multi-dimensional), 4 metric cards

Also: reduce responseLatency font size in RelationshipView for better readability.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-31 10:28:29 +08:00
diguaandClaude Sonnet 4.6 affb7a50e4 fix(daemon): quote ExecStart argv to handle paths with spaces on Linux
Wraps each argument in double quotes when building the systemd unit's
ExecStart= line, so installs under paths containing spaces (e.g. home
directories with spaces, nvm paths) no longer cause systemd to
mis-tokenize the command and fail to start the service.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 14:19:42 +08:00
diguaandCursor 969406915f feat(ai): add confirmation dialog before regenerating all session indexes
Warn users that regeneration will clear all existing AI summaries.
Uses the same UModal pattern as other confirmation dialogs in settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 14:19:42 +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 b3c2b20a9f fix(ai): make message editing safe against data loss and stale state
- insertMessageAfter: update active_message_id when appending to tail
  so the new reply is on the active path after reload
- editAndOverwriteAll: add hasConfig + abort checks before
  deleteMessagesFrom to prevent data loss when LLM is unconfigured or
  a concurrent request starts
- editCurrentRoundOnly: defer all DB mutations until after stream
  completes; on abort/error only in-memory state is restored
- sync in-memory parentId after relinking so follow-up edits send the
  correct historyLeafMessageId

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-30 14:19:42 +08:00
digua ce1065e295 docs(api): rename API import to API push 2026-05-30 14:19:42 +08:00
digua e78c8f9368 feat(ai): add fork conversation UI button on AI replies 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
digua 3a8f61fdf0 fix(cli): start web dev backend with start command 2026-05-30 14:19:42 +08:00
diguaandClaude Sonnet 4.6 0e03295258 feat(cli): add daemon mode via start --daemon, stop, and status commands
- Replace 6-subcommand daemon group with simpler top-level design:
  chatlab start --daemon  install as system service (launchd/systemd)
  chatlab stop            uninstall service and disable auto-start
  chatlab status          show resident service status
- Drop temporary background process layer; daemon = system service only
- Store port/host meta in ~/.chatlab/daemon.json for status display
- Fix --no-open description: Web UI still runs, only browser is suppressed
- Update quick-start docs (cn/en/tw) to reflect new commands

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 14:19:42 +08:00
diguaandClaude Sonnet 4.6 6cdc040ce8 feat(cli): replace serve/web commands with unified start command
- Add `chatlab start` with --headless (API-only) and --no-open flags
- Remove redundant `serve` and `web` commands
- Update fetch adapter comments to reference chatlab start
- Add chatlab start usage examples to quick-start docs (cn/en/tw)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 14:19:42 +08:00
digua 8e01121b7a release: v0.22.1 2026-05-29 15:07:02 +08:00
diguaandClaude Opus 4.8 a653b5be6d docs: restructure docs nav and move quick-start under usage
- Move quick-start.md to usage/ across cn/en/tw
- Switch locale index pages from home to doc layout
- Add Baidu analytics script and adjust nav doc links

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-29 14:35:48 +08:00
digua 45dfa5026f fix(session-index): honor selected session IDs in CLI batch summary generation 2026-05-27 23:47:27 +08:00
digua 46204db9b8 fix(ai): revalidate credentials when base URL changes in openai-compat mode 2026-05-27 23:47:27 +08:00
digua 61380f53cc style(ui): optimize chat record list density and message bubble style 2026-05-27 23:47:27 +08:00
diguaandCursor 88ab0ae172 fix(ai): correct apiKeySet detection and prevent stale key reuse
- Fix apiKeySet reporting false positives for local no-key configs by
  resolving the actual key via resolveApiKey and excluding placeholders
- Prevent editing a config from reusing an incompatible API key when
  provider or connection mode has changed
- Pass summary strategy to single-session generation for consistency

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 23:47:27 +08:00
digua a9b8599417 refactor(i18n): move session index keys from storage to ai namespace 2026-05-27 23:47:27 +08:00
diguaandCursor 6faeee3042 fix(ui): make batch summary stop button respond immediately
Previously clicking stop would only take effect after the current LLM
request finished. Now the UI state updates instantly while the in-flight
request completes silently in the background.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 23:47:27 +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
diguaandCursor eaff16d555 fix(cli): wire up batch summary generation in CLI Web to fix page freeze
- Implement generateSummary/checkCanGenerateSummary in FetchSessionIndexAdapter
  via existing HTTP endpoints instead of stubs that returned instantly
- Add checkCanGenerate service function in summary-service.ts
- Add POST /_web/sessions/:id/summaries/check-can-generate route

The page froze because stub methods returned synchronously, causing a tight
loop of hundreds of Vue reactive updates without any network delay.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 23:47:27 +08:00
diguaandCursor 63e101feb4 fix(cli): fix third-party service misidentified as local when editing in CLI Web
- Add apiKeySet field to GET /_web/ai/llm/configs response
- Allow saving in edit mode without re-entering API key when key already set
- Skip API key validation on save when editing with existing key unchanged
- Show edit-mode placeholder hint on API Key input
- Add missing customModels/disableThinking/isReasoningModel to CLI route types

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-27 23:47:27 +08:00
digua 1aee8133a3 release: v0.22.0 2026-05-26 23:29:34 +08:00
digua bc3871c9b1 fix(settings): remove broken web update action 2026-05-26 23:19:47 +08:00
digua 8a54568cd4 style(ui): optimize sidebar density and enhance dark mode contrast for tab selectors 2026-05-26 23:19:47 +08:00
digua 3565cad5a9 feat(sidebar): add logo and update toggle icon to panel-right 2026-05-26 23:19:47 +08:00
digua d2c0edd389 fix(cli): continue web serve after data warning 2026-05-26 23:19:47 +08:00
digua 44e0517890 fix(home): restore shared quick start buttons 2026-05-26 23:19:47 +08:00
diguaandClaude Sonnet 4.6 7738b47ab7 refactor: migrate documentation links from chatlab.fun to docs.chatlab.fun
Update links pointing to documentation pages (usage guides, format specs,
troubleshooting, API docs) across README, source code, and i18n files to
use docs.chatlab.fun. Main site links (homepage, roadmap, community,
assets) remain unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 23:19:47 +08:00
digua c736fdc93b fix(cli): disable web self update execution 2026-05-26 23:19:47 +08:00
diguaandClaude Sonnet 4.6 5a524b8abf fix: correct i18n key path and replace deprecated ECharts api.style()
- ChatExplorer.vue: fix `ai.assistant.systemPrompt` → `ai.assistant.config.systemPrompt`
  (missing 'config' level in key path caused vue-i18n missing-key warnings)
- OverviewIdentityCard.vue: replace deprecated `api.style()` with
  `api.visual('color')` + literal style object (ECharts 6.x deprecation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 23:19:47 +08:00
digua 8ae8ff6cda fix(cli): avoid shell for file manager actions 2026-05-26 23:19:47 +08:00
digua 19a45f9e5f fix: protect self update and migration retry 2026-05-26 23:19:47 +08:00
diguaandClaude Sonnet 4.6 e05016c512 refactor(settings): move session index to AI settings and reorder tabs
Move SessionIndexSection from StorageTab to AISettingsTab (placed above
export settings), rename label from "会话管理" to "会话索引" across all
locales, swap automation tab before data management tab, and simplify
StorageTab by removing its now-unnecessary SubTabs navigation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 23:19:47 +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
diguaandCursor 6c3d36e7df feat(ai): upgrade pi-ai from @mariozechner 0.54 to @earendil-works 0.74
- Replace @mariozechner/pi-ai and pi-agent-core with @earendil-works scope
- Adapt to AgentTool.execute() params type change (Record → unknown)
- Migrate Agent constructor to use initialState for systemPrompt/tools/messages
- Update onPayload callback signature to include model parameter
- Filter finalMessages with isPiMessage() for new AgentMessage union type
- Use state.errorMessage instead of deprecated state.error

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 23:19:47 +08:00
diguaandCursor 0ba9ae04a6 chore: migrate workspace packages to ESM
- Add "type": "module" to all workspace package.json files
- Replace __dirname with import.meta.url-based resolveCliPath() helper
- Convert stream-json/stream-chain CJS named imports to default + destructure
  for ESM compatibility
- Use createRequire() for @node-rs/jieba native module loading in ESM context

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 23:19:47 +08:00
digua 83151fd8e7 fix(cli): improve update checker with async cache, keypress UX, and dev bypass 2026-05-26 23:19:47 +08:00
digua a105d7ab8e feat(cli): implement update checking and auto-update for CLI and CLI Web 2026-05-26 23:19:47 +08:00
diguaandCursor 1a35d2bb9a fix(cli): add merge API shims for CLI Web batch manage
CLI Web was missing chatApi.exportSessionsToTempFiles,
chatApi.cleanupTempExportFiles and the entire mergeApi shim,
causing "not a function" errors when merging sessions in
Settings > Data Management.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 23:19:47 +08:00
diguaandCursor 6ec03d330f fix(electron): prevent unified migration from reverting data dir changes
The unified directory migration (needsUnifiedDirMigration) would
re-trigger after a user changed their data directory, overwriting
config.toml back to the old Electron path.

Root cause: no persistent flag tracking whether the migration had
already completed. If old databases remained (cleanup failure or
timing), it would re-detect and re-run.

Fix:
- Add `electron_migration_done` flag to config.toml [data] section
- Set flag after migrateToUnifiedDirs succeeds and in setCustomDataDir
- Check flag at start of needsUnifiedDirMigration to skip if done
- Add "migrate to default" button when data is at non-default path
- Fix NLP directory path: move from userDataDir to systemDir (~/.chatlab/nlp)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 23:19:47 +08:00
diguaandCursor 8819dff62c feat(cli): implement storage management for CLI Web
CLI Web's Settings > Storage Management was completely non-functional
(stub cacheApi returning empty data). This adds real HTTP endpoints
and wires the frontend to use them.

Backend (cache.ts):
- GET /_web/cache/info — scan databases/ai/cache/logs directory sizes
- POST /_web/cache/clear — clear cache or logs directory (allowlist)
- POST /_web/cache/open-dir — open directory in system file manager
- GET /_web/cache/data-dir — return current data directory path
- GET /_web/cache/latest-import-log — find latest import log file

Frontend:
- Replace cacheApi stubs with real HTTP calls in registry.ts
- Hide data directory migration UI in CLI Web (IS_ELECTRON guard)
- Add "Open Root Dir" button for ~/.chatlab/ in header area

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 23:19:47 +08:00
digua 9e88dcbd09 feat(changelog): bundle changelogs locally 2026-05-26 23:19:47 +08:00
digua ab90e06089 chore(docs): isolate docs workspace dependencies 2026-05-23 23:59:40 +08:00
digua 7a6d0e9586 docs: restructure public documentation site 2026-05-23 23:38:02 +08:00
digua c8d218251d feat(docs): add standalone VitePress docs site 2026-05-23 23:38:02 +08:00
digua 2d714857ef chore(changelog): move release changelogs out of docs 2026-05-23 23:38:02 +08:00
diguaandClaude Sonnet 4.6 8564db7241 release: v0.21.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 16:37:59 +08:00
diguaandClaude Sonnet 4.6 fa123bab49 fix: keep forced index modal open on generation failure
Move auto-close logic from finally to success path so the modal
remains open for retry when generate() fails in force mode.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 16:28:50 +08:00
diguaandClaude Sonnet 4.6 53e0d21ec7 fix(sync): prevent data loss on small pages and validate retry import results
P1: Small terminal pages with hasMore=false were incorrectly treated as
empty based on file size alone, causing valid messages to be silently
dropped. Now checks actual message content via fileContainsMessages().

P1: Retry import results were not validated, so import failures (including
needFullResync) were masked as success. Now properly handles all failure
cases and tracks retryHasMore to exit the retry loop correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 16:28:50 +08:00
digua 92c8a795f9 fix(ui): spin sync icon in-place instead of showing separate loader
Replace UButton :loading with animate-spin on the arrow-path icon itself.
The sync button's icon now rotates when syncing, and the button is disabled.
The "sync all" button is also disabled when any session is syncing.
2026-05-23 16:28:50 +08:00
digua 811bb3c09a fix: prevent SessionIndexModal from blocking empty sessions 2026-05-23 16:28:50 +08:00
digua cb516daea0 fix(sync): raise page limit from 50 to 5000 for large chat histories
50 pages (50k messages) was too low for groups with 100k+ messages.
Raise to 5000 pages (5M messages) as a safety valve while allowing
full-sync to complete in a single pull cycle for most conversations.
2026-05-23 16:28:50 +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 fcfa5d0167 fix(sync): auto-generate session index after pull sync completes
After importing messages via pull sync, automatically generate session
index for the affected sessions. This ensures the timeline and session
overview are immediately available without manual index generation.
2026-05-23 16:28:50 +08:00
digua 9cf6ac7725 fix(sync): refresh sidebar session list after pull completes or data deleted
After a sync finishes (triggerPull/triggerPullAll/onPullResult), reload the
session list so newly imported chats appear in the sidebar immediately.
Also refresh after removing a subscription with deleteData=true so the
deleted session disappears from the sidebar.
2026-05-23 16:28:50 +08:00
digua b952ebc8bf fix(sync): fetch all sessions when remote server lacks pagination support
When the remote server doesn't return a `page` field and the result count
equals the requested limit, automatically re-fetch with limit=5000 to get
the complete session list instead of showing truncated results.
2026-05-23 16:28:50 +08:00
digua 4cd60aa0c1 docs: update Pull protocol to since+nextSince pagination model
- Change Accept header to application/json (NDJSON reserved for future)
- Remove offset/end request params, recommend since+limit only
- Mark hasMore+nextSince as required sync fields
- Move nextOffset/watermark to "protocol reserved" section
- Add cold-start retry explanation and pagination flow example
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
digua 31fc9be1ed fix(sync): improve pull reliability with retry logic and simplified pagination
- Add multi-retry (3 attempts, 2s/3s/5s delays) for cold-start empty responses
- Remove unused offset/end parameters from fetch URL construction
- Fix Accept header to application/json only (avoids content negotiation issues)
- Add PullProgress type and progress tracking in PullEngine
- Export progress via getProgress() for frontend polling
2026-05-23 16:28:50 +08:00
diguaandClaude Sonnet 4.6 f55fb9cf00 fix(desktop): fall back to package version when app.getVersion returns 0.0.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 16:28:50 +08:00
digua 5aaf1ce331 fix(sync): validate DB schema in sessionExists to prevent "no such table: message" error
sessionExists() previously only checked file existence, causing pull sync
to enter incremental import path on invalid/empty DB files. Now validates
that the message table exists, and maps schema errors to needFullResync
as a safety fallback.
2026-05-23 16:28:50 +08:00
digua 795d10d8c9 feat(changelog): add icon and i18n for ci change type 2026-05-23 16:28:50 +08:00
diguaandClaude Sonnet 4.6 2d342865ff feat(capture): add per-version screenshot to ChangelogModal and make markdown list fix opt-in
Add a hover-triggered CaptureButton to each expanded changelog entry so
users can screenshot individual version notes. Make the @zumer/snapdom
markdown list compatibility fix opt-in via a new `markdownFix` option
(default false), so custom-styled lists like changelog bullets are no
longer disrupted during capture.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 16:28:50 +08:00
digua b984b79bc9 release: v0.21.0 2026-05-22 14:45:17 +08:00
diguaandClaude Sonnet 4.6 dc5ab71521 ci(release): centralize version metadata and split CLI build into dedicated job
Extract version/tag/prerelease detection into a shared prepare_release job,
split CLI packaging into its own build-cli artifact, switch publish-cli to
download the pre-built artifact instead of rebuilding inline, pin pnpm install
with --frozen-lockfile, and fix changelog summary lookup to match by version
instead of always selecting the first entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 22:59:13 +08:00
digua 1171fec7d0 docs(changelog): clarify platform-specific entries 2026-05-21 22:50:03 +08:00
digua 3a2d4e753a refactor(mcp): trim exposed tool registry 2026-05-21 22:38:10 +08:00
digua 5db4b3bf9d fix(import): harden directory import path handling 2026-05-21 22:26:55 +08:00
digua 56902fea1c ci(release): publish CLI package from release workflow 2026-05-21 21:59:10 +08:00
digua 1e7325197c fix(web): preserve session not-found and member history behavior 2026-05-22 10:20:39 +08:00
diguaandCursor 5f76e65359 fix(sync): prevent race condition when adding new subscriptions
When a pullAllSessions was already running, the reloadTimer triggered
by adding sessions would be skipped by the source-level concurrency
lock, causing newly added sessions to wait until the next scheduled
interval (up to 60 minutes) before syncing.

Fix: trigger individual per-session pulls via triggerPull(sourceId,
sessionId) which bypasses the source-level lock, ensuring immediate
sync for newly added sessions regardless of concurrent pulls.

Also includes: connection pre-check on data source add, removal of
duplicate "browse remote sessions" button, hiding "other" session
types, and full resync fix for deleted local sessions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 10:20:39 +08:00
diguaandCursor dd3cb10414 refactor(services): unify CLI Web and Electron service layer
Extract shared business logic from monolithic web.ts into reusable
services in @openchatlab/node-runtime (session, member, index, summary,
export), using SessionRuntimeAdapter to abstract platform differences.
Split web.ts into 12 domain-specific route modules under routes/web/.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 10:20:39 +08:00
diguaandCursor 808b9026f2 fix(ai): parse MiniMax streaming <think> tags as thinking events
MiniMax models embed thinking content as <think> tags in the content
field rather than using a separate reasoning field. Add a streaming
think-tag parser that detects these tags in real-time during streaming
and routes them to the thinking UI instead of displaying raw tags.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 10:20:39 +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
diguaandCursor 8bb904fb22 fix(import): support incremental import in CLI web mode
The IncrementalImportModal was Electron-only: showOpenDialog returned
canceled in web mode and FetchImportAdapter threw notSupported for both
analyzeIncrementalImport and incrementalImport despite CLI routes
already existing. Fix by using FileDropZone's built-in file input for
file selection and implementing the two fetch adapter methods via
FormData upload + SSE streaming.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 10:20:39 +08:00
digua 04427a98d8 chore(cli): prepare npm release docs 2026-05-22 10:20:39 +08:00
digua 6fa92bc2e4 chore(mcp): prepare npm publish 2026-05-22 10:20:39 +08:00
digua d1737c7e8d chore: update npm config 2026-05-22 10:20:39 +08:00