Replace ChatLab-only reader with @openchatlab/parser in the server
import pipeline. Add streamImport() function for full-format streaming
parse + database write. Update CLI import command to use new pipeline
and add 'chatlab formats' command to list supported formats.
Move all 14+ format parsers (QQ, WeChat, Telegram, WhatsApp, LINE,
Discord, Instagram, etc.) from electron/main/parser/ to packages/parser/
as a standalone shared package. Electron's parser module becomes a thin
re-export wrapper. This enables the server to use the same parser for
CLI serve Web import functionality.
Phase 3A.3: Enable chatlab serve to host the Web SPA frontend
alongside the HTTP API, creating a complete local web experience.
- Add --web [dir] option to chatlab serve (defaults to dist-web/)
- Use @fastify/static for efficient static file serving
- SPA history fallback via setNotFoundHandler -> index.html
- Skip web hosting gracefully if dist-web/ doesn't exist
- Add webRoot option to HttpServerOptions / startHttpServer
Phase 3A.2: Create vite.web.config.mts for building the CLI serve
Web SPA independently from the Electron build pipeline.
- __IS_ELECTRON__ = false, __IS_BROWSER_STANDALONE__ = false
- Output to dist-web/ (gitignored)
- Dev proxy: /_web and /api -> localhost:3400 (chatlab serve)
- Resolve aliases for @electron/shared and @electron/preload
(type-only imports, erased at build time)
- npm scripts: dev:web, build:web
- Same manualChunks strategy as Electron renderer build
Phase 3A.1: Create the HTTP bridge between the Vue SPA frontend
and chatlab serve backend for the CLI serve Web version.
Server side (packages/server):
- Add /_web/ route group (routes/web.ts) with no auth requirement,
covering: sessions CRUD, time range, member-activity/hourly/daily/
weekday/message-type stats, members CRUD+pagination+merge+history,
SQL Lab execute+schema.
- Skip auth hook for /_web/ prefix (same-origin internal API).
- Add getTimeRange() to @openchatlab/core basic queries.
Client side (src/adapters):
- FetchAdapter wrapping all /_web/ endpoints with proper HTTP verbs,
TimeFilter query param serialization, and error handling.
- Unimplemented analysis methods (catchphrase, mention, cluster, etc.)
throw descriptive errors for progressive enhancement.
- Wire FetchAdapter into adapter factory (non-Electron, non-browser).
Phase 3.0.3: Systematically replace all data-query window.chatApi
calls across 24 files with getAdapter() from the new adapter layer.
Replaced categories:
- Session CRUD (getSessions, getSession, deleteSession, renameSession)
- Statistics (getMemberActivity, getHourlyActivity, getDailyActivity,
getWeekdayActivity, getMessageTypeDistribution, getAvailableYears)
- Member management (getMembers, getMembersPaginated, updateMemberAliases,
mergeMembers, deleteMember, getMemberNameHistory)
- Social analysis (getMentionAnalysis, getLaughAnalysis,
getCatchphraseAnalysis, getLanguagePreferenceAnalysis,
getRelationshipStats)
- SQL Lab (executeSQL, getSchema)
Remaining window.chatApi calls are Electron-specific operations
(import, migration, file dialog, demo, export) that will be handled
separately with IS_ELECTRON guards in future phases.
Also adds initAdapter() call in App.vue onMounted to bootstrap the
adapter before any data loading occurs.
Implement self-contained ChatLab format reader (JSON and JSONL) and
database importer in packages/server/src/import/. Supports full import
(new session) and incremental import (dedup via platform_message_id or
content hash). Includes FTS index creation and member upsert.
CLI: chatlab import <file> [--session-id <id>] [--dry-run]
Implement 'chatlab serve' CLI command with --port, --host, --token options.
Auto-generates and persists Bearer token on first run. Supports graceful
shutdown via SIGINT/SIGTERM. Verified: auth rejection, status endpoint,
session listing all working.
queryMessages supports keyword, time range, senderId filtering with
full pagination (total, page, totalPages). getMembersDetailed returns
accountName and groupNickname fields for HTTP API export compatibility.
Add rebuild-native.sh script that compiles better-sqlite3 in an isolated
temp directory for system Node.js, storing the binary at packages/server/native/.
DatabaseManager and openBetterSqliteDatabase now accept nativeBinding option.
CLI auto-detects non-Electron environment and uses the isolated binary.
Phase 2.2: add chatlab mcp command that starts an MCP stdio server.
Registers 8 tools from @openchatlab/tools and 3 resources (sessions
list, session meta, session schema). Compatible with Claude Desktop
and Cursor MCP client configuration.
The root project's electron-rebuild compiles better-sqlite3 for
Electron's Node ABI, making it incompatible with system Node.js.
Add a convenience script to rebuild for the current Node version.
Phase 1.7: add DatabaseManager to @openchatlab/node-runtime that handles
opening, caching, listing, and closing chat session databases using the
DatabaseAdapter and PathProvider interfaces from core.
Phase 1.4: extract session, basic stats, and message query functions
from electron/main/worker/query/ into @openchatlab/core. All functions
accept DatabaseAdapter parameter instead of relying on global state.
Includes: session meta/overview, member activity, hourly/daily/weekday
stats, message type stats, LIKE search, recent messages, member list,
and readonly SQL execution.
Phase 1.3: implement PathProvider for CLI/service mode using
~/.chatlab/data/ as default data directory with CHATLAB_DATA_DIR
environment variable override support.
Phase 1.2: create @openchatlab/node-runtime package with better-sqlite3
adapter that implements the DatabaseAdapter interface from core. Also add
pragma() method to the DatabaseAdapter interface.
Phase 1.1 of CLI/Web transformation: create the platform-agnostic core
package with DatabaseAdapter, PathProvider, NotificationBus interfaces
and query filter utilities extracted from worker/core/dbCore.ts.