100 Commits
Author SHA1 Message Date
7418andClaude Opus 4.6 7bb47f88af chore: bump version to 0.36.0
Feishu bridge V2 release:
- Streaming cards with CardKit v2 API
- Tool call progress display
- Permission approval buttons via card.action.trigger
- /cwd project switcher
- Simplified settings (removed encryptKey, verificationToken, renderMode, etc.)
- Card creation race condition fix
- Updated website docs and handover docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 16:52:27 +08:00
7418andClaude Opus 4.6 16b0006f98 docs: add Worktree isolation rules to CLAUDE.md
Add safety rules for git worktree workflows:
- Changes scoped to worktree only
- No cross-worktree commits or push
- Port isolation for dev server
- No cross-directory file edits
- Check untracked files before merge

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 16:51:51 +08:00
7418andClaude Opus 4.6 73434653c1 docs: update Feishu bridge setup guide for V2
- Add card.action.trigger callback requirement under Events & Callbacks
- Add long connection mode note (no Encrypt Key / Verification Token needed)
- Expand permissions table: cardkit:card:write/read, im:message:update,
  im:message.reactions:read/write_only, and optional future permissions
- Update CodePilot config section to reflect simplified UI (2 cards)
- Update message format section for streaming cards, tool progress, thinking state
- Add troubleshooting for permission buttons and streaming cards
- Sync English and Chinese versions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 16:30:31 +08:00
7418 1420c05cd9 Merge branch 'codex/feishu-remote-v2' 2026-03-14 16:30:20 +08:00
7418andClaude Opus 4.6 7cc9c90242 refactor: simplify Feishu settings, fix card race conditions, update docs
Settings cleanup:
- Remove encryptKey/verificationToken (WSClient handles auth internally)
- Remove renderMode/blockStreaming toggles (streaming always enabled)
- Remove footer toggles (always show status + elapsed)
- Simplify FeishuConfig type, always-on cardStreamConfig
- Merge UI into 2 cards (credentials + access/behavior) with dirty-state save buttons

Bug fixes:
- Fix card creation race: cardCreatePromise awaited before finalize/interrupt
- Fix tool-first turns: onToolEvent bootstraps card when no text precedes tools
- Fix /cwd picker: source from channel_bindings (not chat_sessions), filter active only
- Remove stale renderMode reference in bridge-manager /status

Docs:
- Update bridge-system.md: Feishu data flow, design decisions 13-18, V2 status, settings table
- Add design decision 18: single-operator model for /cwd picker scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 16:30:15 +08:00
7418andClaude Opus 4.6 cdb4155771 feat: Feishu chat bridge — strip MCP residuals, enhance streaming cards, add tool progress
Phase 1: Strip Feishu MCP residuals
- Remove 'feishu' server entry from .mcp.json
- Remove @codepilot/feishu-mcp and packages/feishu-mcp from package-lock.json
- General MCP infrastructure (McpManager, /api/plugins/mcp) preserved

Phase 2: Streaming card improvements
- card-controller.ts: Add thinking state (💭 Thinking...), tool call progress
  display (🔄/✅/❌), better finalize with status footer (✅/⚠️/❌ + elapsed time),
  markdown optimization on final card, proper sequence numbering for setStreamingMode
- conversation-engine.ts: Add OnToolEvent callback type, fire tool_use/tool_result
  events during stream consumption
- bridge-manager.ts: Wire tool event tracking to card controller, pass proper status
  (completed/interrupted/error) to finalize, render errors in card when streaming

Phase 3: Typing indicator & UX
- Change reaction emoji from 'OnIt' to 'Typing' (OpenClaw convention)
- Improve /help and /start command output with grouped sections
- Export optimizeMarkdown() for reuse in card-controller

types.ts:
- Add ToolCallInfo interface for card tool progress
- Add updateToolCalls?() and setThinking?() to CardStreamController

Tests: 374 pass, 0 fail
TypeScript: clean (npx tsc --noEmit)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 11:30:58 +08:00
7418andClaude Opus 4.6 647fa041d1 feat: improve Feishu messaging — markdown rendering, card styling, reaction lifecycle
outbound.ts:
- Switch from msg_type 'text' to 'post' with {tag: 'md'} for markdown rendering
- Add optimizeMarkdown(): heading demotion, table spacing, code block padding, image key stripping
- Redesign permission card: blue header with lock icon, notation-sized timeout hint,
  column_set button layout (Schema V2 compatible, 'action' tag deprecated)
- Add addReaction/removeReaction for emoji acknowledgment lifecycle

index.ts:
- Implement onMessageStart: add 'OnIt' emoji on message receipt
- Implement onMessageEnd: remove reaction after response sent
- Track lastMessageIdByChat for reaction targeting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 11:10:01 +08:00
7418andClaude Opus 4.6 9ca9bce788 fix: feishu card action 200340 and bridge session lock cleanup
Feishu card button clicks:
- Add encryptKey/verificationToken to FeishuConfig for EventDispatcher
- Gateway monkey-patch: rewrite type="card" → "event" for WSClient
- Gateway safeCardActionHandler: 2.5s timeout guarantee with fallback toast
- Embed chatId in button value (Feishu card.action.trigger has no open_chat_id)
- Support both callback_data and action/operation_id button value formats
- Domain resolution: 'feishu' → Domain.Feishu, 'lark' → Domain.Lark

Bridge reliability:
- Clear sessionLocks and activeTasks on bridge stop() to prevent
  stuck sessions after restart (processWithSessionLock chains to
  unresolved promises from previous bridge lifecycle)

Settings UI:
- Add encryptKey and verificationToken fields to Feishu settings
- Mask encryptKey in GET, skip masked values in PUT
- Add i18n strings (marked as optional for WSClient mode)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 09:55:03 +08:00
7418 16d2f1af5d chore: restore feishu worktree snapshot 2026-03-13 18:29:20 +08:00
7418andClaude Opus 4.6 e6f333567d fix: prevent false positive Claude Code conflict on Windows
Windows installers create multiple entry points in the same directory
(e.g. claude.exe + claude, claude.cmd + claude). These are variants for
different shells, not separate installations. Deduplicate by directory +
base name stripped of executable extensions (.exe/.cmd/.bat).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:57:09 +08:00
7418andClaude Opus 4.6 a187f320ec chore: bump version to 0.35.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:25:46 +08:00
7418andClaude Opus 4.6 8372a3f548 docs: update website docs with Setup Center and Claude Code conflict guide
- installation.mdx: expand "First Launch" into detailed Setup Center walkthrough
  covering CLI detection, provider configuration, and project directory setup
- installation.mdx: add "Claude Code Conflicts" section with detection logic,
  uninstall commands per install type, and recommended installation method
- faq.mdx: add troubleshooting entries for CLI not detected, multi-version
  conflicts, and Setup Center auto-open behavior
- providers.mdx: mention ANTHROPIC_AUTH_TOKEN alongside API_KEY for env detection

All changes in both English and Chinese versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:24:31 +08:00
7418andClaude Opus 4.6 8154130035 feat: add Setup Center onboarding and move commit/push to Git panel
Add a skippable first-use Setup Center that guides users through three
prerequisites: Claude Code CLI detection, API provider configuration,
and default project directory selection. Replace passive fail-then-hint
patterns with proactive guidance and actionable error recovery.

Setup Center (13 new files):
- SetupCenter overlay with 4 cards (Welcome, ClaudeCode, Provider, ProjectDir)
- Auto-close only when user completes last card in current session
- Re-openable from Settings > General > "首次设置引导"
- Claude Code conflict detection with per-install-type uninstall commands
- Provider detection covers DB providers, env vars, and legacy app-settings token
- ANTHROPIC_BASE_URL excluded from credential check (not a real credential)
- skipped != completed: /chat still prompts for provider after skip

Project directory:
- Validation via /api/files/browse before trusting saved paths
- Fallback chain: localStorage → setup_default_project → empty state
- Cross-component sync via project-directory-changed CustomEvent

Toast system:
- Global showToast() API with success/error/warning/info types
- FIFO eviction (max 3), action button support

Git panel:
- Move Commit + Push buttons from UnifiedTopBar into GitStatusSection
- Push enabled for new branches (backend auto-handles -u origin)

Other:
- Windows top-bar safe zone (138px spacer for caption buttons)
- Cross-platform path splitting with /[\\/]/ regex
- Platform-aware file manager name (Finder/Explorer/Files)
- ~80 new i18n keys (en + zh)
- Handover doc: docs/handover/onboarding-setup-center.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 15:19:52 +08:00
7418andClaude Opus 4.6 e6d707fe21 docs: update bridge handover and mobile remote control plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 02:39:47 +08:00
7418andClaude Opus 4.6 132bfcebc0 fix: disable terminal UI, fix hydration mismatch
- Remove terminal button from UnifiedTopBar and TerminalDrawer rendering
  Terminal feature disabled until proper node-pty + xterm.js integration
- Fix ChatListPanel hydration mismatch: chatListOpenRaw/chatListWidth
  used window-dependent initializers causing SSR/client divergence
- Improve TerminalInstance for future use: stable useEffect deps,
  ANSI rendering via ansi-to-react, focus management
- Clear CLAUDECODE env var in terminal-manager to allow nested sessions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 02:26:57 +08:00
7418andClaude Opus 4.6 4326269817 chore: bump version to 0.34.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 01:28:48 +08:00
7418andClaude Opus 4.6 006862a0bb fix: esbuild compiles JSDoc node-pty into node - pty; causing startup crash
Root cause: esbuild 0.27.3 misparses `node-pty` inside JSDoc comments as a
code expression `node - pty` (subtraction). This produces a bare
`ReferenceError: node is not defined` at app.asar/dist-electron/main.js:35
on startup.

Fixes:
- terminal-manager.ts: replace JSDoc block with line comments and remove all
  literal `node-pty` strings (reference docs/handover instead)
- build-electron.mjs: clean dist-electron/ before every build to prevent
  stale artifact contamination in app.asar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 01:28:15 +08:00
7418andClaude Opus 4.6 d2bfa4b523 chore: bump version to 0.34.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:50:57 +08:00
7418andClaude Opus 4.6 4e01902368 fix: Volcengine model list pollution + missing by-cwd route
- provider-catalog: getDefaultModelsForProvider() now returns preset's
  defaultModels even when empty, instead of falling through to
  ANTHROPIC_DEFAULT_MODELS. Fixes Volcengine (defaultModels: []) incorrectly
  showing Sonnet/Opus/Haiku.
- providers/models route: remove DEFAULT_MODELS fallback when both DB and
  catalog are empty — providers like Volcengine that require user-specified
  model names should show only those models.
- Add missing src/app/api/chat/sessions/by-cwd/route.ts that was untracked;
  without it worktree switching would 404 in release builds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:47:03 +08:00
7418andClaude Opus 4.6 0eabed8c27 feat: Git integration, terminal, unified layout — full Phase 1-5 implementation
**Layout refactor (Phase 1):**
- UnifiedTopBar replacing Header.tsx — chat title editing, project folder,
  commit/push split button, Git branch+dirty badge, terminal/file-tree toggles
- PanelZone renders FileTree, GitPanel, PreviewPanel side-by-side on the right
- Independent panel toggle states in PanelContext
- ResizeHandle unified across all panels
- Removed old RightPanel, Header, DocPreview components

**Git backend (Phase 2):**
- src/lib/git/service.ts — execFile-based Git operations with timeout + injection safety
- API routes: status, branches, checkout, log, commit, push, commit-detail, worktrees, derive
- Worktree derive creates DB session inheriting source session settings

**Git frontend (Phase 3):**
- GitPanel with 4 collapsible sections: Status, Branches, History, Worktrees
- CommitDialog with commit vs commit-and-push modes
- GitBranchSelector with inline error, worktree-occupied branches disabled
- GitWorktreeSection with switch-to/derive actions, current/dirty indicators
- useGitStatus polled in AppShell, derived into context (no redundant setState)

**Terminal (Phase 4):**
- electron/terminal-manager.ts — child_process.spawn fallback (PTY upgrade documented)
- IPC handlers + TerminalDrawer/TerminalInstance components

**Polish (Phase 5):**
- Push inline feedback with 4s auto-dismiss
- Branch detection fix, commit diff exit-code handling
- Removed redundant git state: currentBranch/gitDirtyCount now derived, not setState
- useTerminal isElectron uses lazy initializer instead of effect
- i18n keys (en + zh), user tutorial docs, handover document

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 00:38:00 +08:00
7418andClaude Opus 4.6 b22cf5d186 chore: bump version to 0.33.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 21:29:25 +08:00
7418andClaude Opus 4.6 e2a0f49843 fix: CAS lock for assistant trigger, LIKE escape, provider options race
Assistant trigger CAS (P1):
- hook-triggered route: added expectedOwner param for compare-and-swap —
  rejects if current owner doesn't match, closing the race where two tabs
  both clear then both claim the lock
- useAssistantTrigger: clear sends expectedOwner (stale session), set sends
  expectedOwner: null; non-2xx responses now bail instead of falling through
- Server-side completion (chat/route.ts): only clears lock if owner matches
  current sessionId, preventing completed sessions from wiping active locks
- Compensation branch: clear now passes expectedOwner to avoid bypassing CAS

Image-gen LIKE escape (P2):
- db.ts: escape backslashes before % and _ since ESCAPE '\' makes \ the
  escape char — prevents Windows paths / escaped JSON from corrupting the
  LIKE pattern and silently falling back to prompt-prefix matching

Provider options fetch race (P2):
- page.tsx + ChatView.tsx: provider options fetch now uses AbortController
  with cleanup on dependency change — prevents stale slow responses from
  overwriting the current provider's thinking/context_1m state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 21:29:10 +08:00
7418andClaude Opus 4.6 7b48ee1d2a feat: plugin system — real manifest discovery and SDK integration
- New plugin-discovery.ts: scans ~/.claude/plugins/marketplaces/ and
  external_plugins/, reads .claude-plugin/plugin.json manifests, merges
  enabledPlugins across user/project/local settings layers with write
  escalation to local when higher layers override
- Rewrite /api/plugins and /api/plugins/[id] to use real plugin manifests
  with name@marketplace composite keys, blocklist, and multi-layer
  enable/disable with CAS-style write escalation
- SDK plugin loading delegated to SDK itself (no explicit queryOptions.plugins)
  — ensures parity with Claude CLI's settingSources resolution
- Extended init meta forwarding (plugins, mcp_servers, output_style) in
  claude-client.ts and useSSEStream.ts
- Per-provider plugin cache in agent-sdk-capabilities.ts with
  getCachedPlugins/setCachedPlugins
- Skills route: provider-scoped plugin cache lookup via sessionId param,
  external_plugins commands scan, loaded status annotation
- Updated PluginInfo type with marketplace, location, author, capability flags

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 21:28:25 +08:00
7418andClaude Opus 4.6 857e9fc413 refactor: Electron install wizard, connection status, and platform detection
- Rewrite install-check-prerequisites with multi-path Claude CLI detection
  (native, bun, homebrew, npm) and structured result reporting
- Improve InstallWizard with step-by-step progress and better error handling
- Enhance ConnectionStatus with detailed status display and invalidation
- Add /api/claude-status/invalidate route for cache-busting
- Expand platform.ts with richer detection utilities
- Add onInitMeta handler in stream-session-manager
- Update electron.d.ts types for new IPC channels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:27:35 +08:00
7418andClaude Opus 4.6 2a0451329b fix: cross-session assistant trigger guard — heartbeat liveness detection
- Replace fixed-timeout stale detection with localStorage heartbeat mechanism
- Heartbeat writes {sid, ts} every 10s; isOwnerAlive checks sid matches AND freshness
- Stop heartbeat when triggered stream completes (useEffect on !isStreaming)
- removeHeartbeatIfOwned: only delete key if it still belongs to this session
  (prevents new owner's heartbeat from being wiped by old session's cleanup)
- Export clearOnboardingHeartbeat with optional sessionId parameter
- hook-triggered route sets/clears hookTriggeredAt alongside hookTriggeredSessionId
- MiniMax model auto-correction: reset model when not in current provider's list

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:27:00 +08:00
7418andClaude Opus 4.6 8cce9889eb fix: Design Agent session isolation, image write-back robustness, and new-session flow
Image reference store session-scoped:
- Rewrite image-ref-store.ts: all keys/functions now scoped by sessionId
- Thread sessionId through MessageList → StreamingMessage/MessageItem → ImageGenConfirmation
- ChatView loads last-generated images for current session on mount

Image write-back robustness:
- Remove localStorage caching from ImageGenConfirmation (root cause of stale results)
- Add rawRequestBlock for exact content matching in DB fallback query
- updateMessageBySessionAndHint prefers exact block match, falls back to prompt hint
- PUT route passes raw_request_block to DB function
- Add retry-after-3s when first PUT fails and no messageId available
- Exclude already-completed messages (NOT LIKE image-gen-result) from update query

New session page (/chat) fix:
- Add createdSessionId state, set after session creation, pass to MessageList
- Prevents first-message image-gen-request from inheriting stale panel sessionId

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:26:34 +08:00
7418andClaude Opus 4.6 cc3cae6868 feat: per-provider options (thinking mode, 1M context) and SDK betas integration
- Add ProviderOptionsSection component for per-provider thinking_mode and context_1m
- Store options in options_json column (DB providers) or settings table (env provider)
- Add /api/providers/options GET/PUT route
- Fix SDK integration: use `betas` (not `betaHeaders`) for context-1m-2025-08-07
- ChatView and /chat page always reset thinkingMode on provider change (isolation fix)
- Auto-correct model when switching providers if model not in new provider's list
- Add i18n keys for provider options in both en.ts and zh.ts
- Update test fixtures with options_json field
- Remove unused lastAssistantText variable in claude-client.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 17:26:00 +08:00
7418andClaude Opus 4.6 e694d75f10 chore: bump version to 0.32.1
Patch release for UI governance refactor:
- ESLint governance rules (native controls, icon imports, component size limits)
- Unified icon entry via ui/icon.tsx (86+ Phosphor icons)
- Semantic color token system (status-success/warning/error/info)
- Component splits: MessageInput, ChatView, ProviderManager, AppShell, ChatListPanel, AssistantWorkspaceSection
- Native HTML controls migrated to ui/ components across 38 files
- Excluded 资料/ from lint scope, rebuilt better-sqlite3 for ARM

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 01:34:04 +08:00
7418andClaude Opus 4.6 5d7850a180 refactor: complete UI governance — lint rules, icon/color unification, component splits
Design pattern & component consistency governance across 120 files:

ESLint governance (eslint.config.mjs):
- Enforce ui/ components over native HTML controls (warn)
- Ban Lucide imports (error), require Phosphor via ui/icon.tsx (warn)
- Component file size limit 500 lines (warn, skip blanks+comments)
- Patterns layer isolation (error: no hooks/lib imports)
- Exclude 资料/ from lint scope

Icon unification (ui/icon.tsx):
- Unified barrel export with 86+ Phosphor icons
- Decoupled types/index.ts from icon library (generic IconComponent type)
- Separated command data (lib/constants/commands.ts) from icons (command-icons.ts)

Color token system (globals.css):
- Added semantic status tokens: success/warning/error/info with muted/foreground/border variants
- Migrated 39 files from raw green/red/orange/amber/blue to semantic tokens
- grep-based lint:colors script covers green/emerald/red/orange/yellow/amber/blue

Component splits (all under 500 lines):
- MessageInput 1659→444: MessageInputParts, SlashCommandPopover, 7 hooks, 2 libs
- ChatView ~850→419: useStreamSubscription, useAssistantTrigger
- ProviderManager 1081→406: provider-presets, PresetConnectDialog, useProviderModels
- AppShell 527→470: useUpdateChecker
- AssistantWorkspaceSection 908→499: WorkspaceTabPanels/ConfirmDialogs/StatusCards
- ChatListPanel 677→484: SessionListItem, ProjectGroupHeader, chat-list-utils

Other:
- Migrated 80 native HTML controls to ui/ components across 38 files
- Fixed 22 hook dependency / set-state-in-effect issues
- Cleaned 7 dead code warnings
- Rebuilt better-sqlite3 for ARM architecture
- Added handover doc: docs/handover/ui-governance.md

Lint status: 0 errors 0 warnings on touched files; typecheck pass; 374/374 tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 01:02:28 +08:00
7418andClaude Opus 4.6 61667fc55d refactor: extract MessageInput sub-components (PR7 — partial)
Extract 4 self-contained sub-components from MessageInput.tsx:
- SlashCommandPopover (243L): slash command filtering, rendering, selection
- CliToolsPopover (128L): CLI tool selection with search/filter
- ModelSelectorDropdown (150L): provider/model selector dropdown
- EffortSelectorDropdown (75L): thinking effort level selector

All components have clean props interfaces ready for integration.
MessageInput.tsx wiring deferred to follow-up — the file's 1,659 lines
of tightly coupled state make this a careful, incremental process.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:00:26 +08:00
7418andClaude Opus 4.6 ba51d7fc98 refactor: unify CodeBlock — keep Shiki, remove Prism version (PR6)
Merge chat/CodeBlock.tsx (Prism via react-syntax-highlighter) into
ai-elements/code-block.tsx (Shiki):

- Port collapse/expand (COLLAPSE_THRESHOLD=20, VISIBLE_LINES=10) from Prism version
- Port InlineCode component export
- Port "Copy as Markdown" functionality
- Update ToolCallBlock.tsx import to use ai-elements/code-block
- Delete src/components/chat/CodeBlock.tsx

Note: react-syntax-highlighter still used by DocPreview and FilePreview,
so dependency not removed yet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:57:12 +08:00
7418andClaude Opus 4.6 c153cf26e6 feat: add Design System page + Playwright visual regression tests (PR8)
Design System page (/design-system):
- Showcases all pattern components: SettingsCard, FieldRow, StatusBanner,
  EmptyState, IconAction, SectionPage
- Includes Button variants, Input, Select, Switch, Badge primitives
- Each section has data-section attribute for targeted screenshots

Visual regression tests (npm run test:visual):
- Full design system page screenshot
- Individual section screenshots (buttons, status banners, cards, field rows)
- Settings page screenshot
- Uses maxDiffPixelRatio: 0.01 for tight regression detection

Infrastructure:
- Add test:visual script to package.json
- Update playwright.config.ts with screenshot comparison defaults

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:56:21 +08:00
7418andClaude Opus 4.6 cfc4db1507 refactor: extract data logic into reusable hooks (PR5)
New hooks:
- useSettings: generic settings CRUD (fetch/save with loading/saving states)
- useBridgeAdapter: bridge adapter settings + verify flow
- useBridgeStatus: bridge status polling + start/stop control
- useAccountInfo: Claude SDK account info fetching

Refactored components:
- GeneralSection: replace inline fetchAccountInfo with useAccountInfo hook
- BridgeSection: replace inline fetchStatus/startBridge/stopBridge + polling
  interval with useBridgeStatus hook (removed ~50 lines)

The remaining bridge adapter sections (Telegram/Discord/Feishu/QQ) can be
migrated to useBridgeAdapter in a follow-up — hooks are ready for adoption.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:53:57 +08:00
7418andClaude Opus 4.6 27bf396cd3 refactor: migrate all Lucide icons to Phosphor + remove lucide-react (PR4)
Unified icon library:
- Create src/components/ui/icon.tsx as centralized icon re-export + size constants
- Migrate all 20+ files from lucide-react to @phosphor-icons/react
- Remove lucide-react from package.json dependencies
- Upgrade ESLint lucide-react rule from warn → error

Icon mappings applied:
  CheckIcon → Check, ChevronDown → CaretDown, ChevronUp → CaretUp,
  ChevronRight → CaretRight, X → X, Search → MagnifyingGlass,
  Loader2 → SpinnerGap, CornerDownLeft → ArrowElbowDownLeft,
  Image → Image, Brain → Brain, Terminal → Terminal, Book → Book,
  Dot → DotOutline, Circle → Circle

Files migrated: ui/ (6), ai-elements/ (11), layout/ (3)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:51:38 +08:00
7418andClaude Opus 4.6 d9f2e6d614 refactor: replace inline layout patterns with SettingsCard/FieldRow/StatusBanner (PR3)
Settings pages:
- GeneralSection: 3 inline cards → SettingsCard, 3 field rows → FieldRow,
  warning banner → StatusBanner
- AppearanceSection: card → SettingsCard, mode/family rows → FieldRow,
  native <button> in ThemeModePills → Button, UIPreview buttons → Button

Bridge pages:
- BridgeSection: 5 inline cards → SettingsCard, master toggle/autostart → FieldRow,
  active hint → StatusBanner
- TelegramBridgeSection: 3 cards → SettingsCard, verify result → StatusBanner
- DiscordBridgeSection: 4 cards → SettingsCard, require mention/stream → FieldRow,
  verify result → StatusBanner
- FeishuBridgeSection: 4 cards → SettingsCard, require mention → FieldRow,
  verify result → StatusBanner
- QqBridgeSection: 4 cards → SettingsCard, image toggle → FieldRow,
  verify result → StatusBanner

Pure UI replacement — no data logic changes. All files retain identical
behavior and visual output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:50:20 +08:00
7418andClaude Opus 4.6 6ea323b92f feat: add reusable pattern components (PR2)
Create src/components/patterns/ with 6 pure-presentation components
that abstract repeated layout patterns from settings/bridge pages:

- SettingsCard: rounded card with optional title/description
- FieldRow: label+description left, control right, optional separator
- SectionPage: max-width page container with consistent spacing
- StatusBanner: success/warning/error/info inline status messages
- EmptyState: centered empty state with icon, title, description, action
- IconAction: ghost icon button with optional tooltip wrapper

All components are zero-side-effect, only import from React and @/lib/utils
(plus ui/button and ui/tooltip for IconAction).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:45:32 +08:00
7418andClaude Opus 4.6 2b8c7cba53 chore: establish UI governance infrastructure (PR1)
- Add .editorconfig for consistent formatting (2-space indent, LF, UTF-8)
- Add docs/ui-governance.md defining 4-layer architecture, icon strategy,
  color token rules, component size limits, and new primitive approval flow
- Update eslint.config.mjs with governance rules:
  - warn on native <button/input/select/textarea> in business components
  - warn on lucide-react imports (prefer @phosphor-icons/react)
  - warn on component files exceeding 500 lines
  - error on data logic imports in patterns/ layer
- Update components.json iconLibrary from "hugeicons" to "phosphor"

Note: 4 pre-existing test failures (assistant-workspace, db-shutdown,
provider-resolver, timezone-boundaries) unrelated to this change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:43:40 +08:00
7418andClaude Opus 4.6 45193de8af chore: bump version to 0.32.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 20:03:31 +08:00
7418andClaude Opus 4.6 16edf9f59c feat: CLI Tools — curated tool catalog, detection, install, chat awareness
New sidebar page for managing system CLI tools (ffmpeg, jq, ripgrep, yt-dlp, pandoc).

Core modules:
- cli-tools-catalog.ts: static catalog of 6 curated tools + EXTRA_WELL_KNOWN_BINS
- cli-tools-detect.ts: system detection via which/where + --version (2min cache)
- cli-tools-context.ts: builds <available_cli_tools> block for chat system prompt

API routes:
- GET /api/cli-tools/catalog, /installed, /[id]/status, /[id]/detail
- POST /api/cli-tools/[id]/install (SSE streaming), /[id]/describe (AI gen)

UI components:
- CliToolsManager: installed + recommended sections with grid layout
- CliToolCard: two variants (installed/recommended) with status badges
- CliToolDetailDialog: intro, use cases, guide steps, example prompts
- CliToolInstallDialog: SSE-based install progress with live terminal log

Chat integration:
- Chat input toolbar: Terminal icon opens CLI tool picker popover
- System prompt injection: buildCliToolsContext() in /api/chat
- MessageInput: CLI popover with search, keyboard nav, locale-aware prefill
- NavRail + ChatListPanel: frosted glass (bg-sidebar/80 backdrop-blur-xl)
- SlashCommandButton: Lightning icon, unified 16px toolbar icons
- input-group: shadow-md → shadow-sm
- Model selector: searchable popover with provider grouping

Docs:
- docs/handover/cli-tools.md + apps/site/content/docs/{en,zh}/cli-tools.mdx

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 19:56:29 +08:00
7418andClaude Opus 4.6 4e603323c4 fix: user bubble color not rendering — use Tailwind v4 variable syntax
The bg-[var(--user-bubble)] arbitrary value syntax wasn't working with
Tailwind v4's Lightning CSS pipeline. Switch to bg-(--user-bubble) which
is Tailwind v4's native CSS variable reference syntax.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:49:51 +08:00
7418andClaude Opus 4.6 18a77dc915 fix: file tree attachment on Electron + model selection follows session
File tree "+" button (Bug 1):
- Replace fragile fetch/blob attachment bridge with @filepath text insertion
- Works identically on web and Electron (pure text, no /api/files/raw fetch)
- Remove unused mimeFromFilename helper

Model selection follows session (Bug 2):
- page.tsx: include model/provider_id in session creation request
- [id]/page.tsx: add sessionInfoLoaded gate — ChatView only mounts after
  session metadata is fetched, preventing stale localStorage fallback
- SplitColumn.tsx: same sessionInfoLoaded gate for split-pane mode
- ChatView.tsx: useEffect sync only overrides model/provider when props
  are non-empty; empty = genuinely no model saved (old/imported sessions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:46:34 +08:00
7418andClaude Opus 4.6 e5a48ca6af feat: migrate icon library from Hugeicons to Phosphor + UI polish
Icon library migration:
- Replace @hugeicons/react with @phosphor-icons/react across 60+ components
  (Phosphor supports 6 weight variants: thin/light/regular/bold/fill/duotone)
- Update apps/site (marketing) to use Phosphor icons
- Remove leftover svg.hugeicons CSS rules from globals.css

UI improvements:
- NavRail: selected tab icons use filled weight, unselected use regular
- User chat bubble: dark bg + white text in light mode, light bg + dark text
  in dark mode (new --user-bubble / --user-bubble-foreground CSS variables)
- Fix expand/collapse icons: use CaretRight (triangle) instead of ArrowRight
  in file-tree.tsx and tool-actions-group.tsx

Lint fixes:
- Fix eslint react-hooks/static-components in CodeBlock, ToolCallBlock,
  tool-actions-group — use createElement() instead of PascalCase variable
- Fix react-hooks/rules-of-hooks in MessageItem — move early return after hooks
- Fix react-hooks/set-state-in-effect in GalleryDetail — use ref pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:12:12 +08:00
7418andClaude Opus 4.6 5adeb3548e docs: add official documentation links to all READMEs
Link to codepilot.sh docs (en + zh) for Providers, MCP, Skills,
Bridge, Assistant Workspace, Installation, and FAQ.
Updated English, Chinese, and Japanese READMEs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 01:02:51 +08:00
7418andClaude Opus 4.6 5e18acb63d feat: provider auth style selector & edit UX improvements
- Anthropic Third-party API: add API Key / Auth Token selector in connect dialog
  with proper extra_env injection and auth style detection
- Edit mode: reuse PresetConnectDialog for matched providers instead of generic
  ProviderForm, showing only relevant fields consistent with connect experience
- Edit mode: show masked key (dots) instead of empty field; switching auth style
  clears key and requires re-entry; switching back restores masked value
- Edit mode: expose headers_json, env_overrides_json, notes in advanced section
  so all fields remain visible and editable
- Edit mode: role_models_json merge logic preserves unseen roles (reasoning, small)
  while allowing clearing of visible mapping fields
- Dialog: add max-h-[calc(100vh-4rem)] + overflow-y-auto to DialogContent base;
  remove overflow-hidden from preset dialog so scrolling actually works
- Connected provider badge: detect ANTHROPIC_AUTH_TOKEN in extra_env to show
  correct "Auth Token" vs "API Key" label
- i18n: add provider.authToken, provider.authStyle keys (en + zh)
- Bump version to 0.31.0

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:57:40 +08:00
7418andClaude Opus 4.6 ac6f5f891a fix: remove conflicting bridge.mdx that hid bridge sub-pages in en docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:55:22 +08:00
7418andClaude Opus 4.6 d360b53bde docs: translate full Chinese docs to English — match structure and content
- Rewrite index.mdx as proper getting started guide
- New: chat.mdx (modes, permissions, context management)
- New: skills.mdx (categories, marketplace, local skills)
- New: design-agent.mdx (single/batch image generation)
- New: gallery.mdx (browsing, filtering, detail view)
- Rewrite providers.mdx — CLI env auth, cc switch caveat, API Key vs
  Auth Token, Chinese provider presets, model mapping, priority chain
- Rewrite mcp.mdx — three transport types, dual view modes
- Rewrite assistant-workspace.mdx — align with Settings > Assistant tab
- Rewrite faq.mdx — comprehensive Q&A
- Bridge split into 5 pages: overview + Telegram + Discord + Feishu + QQ
- Flatten single-page folders to remove sidebar expand arrows
- Update meta.json with new pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:48:55 +08:00
7418andClaude Opus 4.6 0197ceec4e docs: 服务商配置补充 API Key / Auth Token 认证类型选择说明
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:45:51 +08:00
7418andClaude Opus 4.6 c67f3ef82b docs: 重写中文文档 — 全量覆盖功能、中文 UI 标签、桥接分页
- 重写 index.mdx 为真正的快速开始指南,链接服务商配置
- 新增 chat.mdx(对话模式、权限、上下文管理)
- 新增 skills.mdx(技能分类、市场、本地管理)
- 新增 design-agent.mdx(单张/批量图片生成、参考图、连续编辑)
- 新增 gallery.mdx(素材库浏览、筛选、详情操作)
- 重写 providers.mdx — CLI 环境认证 vs 手动添加、cc switch 不生效说明、
  国内服务商预设、Anthropic 第三方模型映射、服务商优先级链
- 重写 mcp.mdx — 三种传输类型(stdio/SSE/HTTP)、列表+JSON 双视图
- 重写 assistant-workspace.mdx — 对齐实际设置>助理标签页
- 重写 faq.mdx — 更全面的问答覆盖
- 桥接拆分为 5 页:总览(斜杠命令、全局设置) + Telegram + Discord + 飞书 + QQ
- Discord 开发者模式获取 ID 说明移入配置流程
- 飞书长连接模式启动顺序说明
- 所有 UI 按钮/菜单名称改为中文翻译(设置、服务商、技能、桥接等)
- 扁平化无子页面的 folder/index.mdx → page.mdx,消除侧边栏多余展开三角

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:13:16 +08:00
7418andClaude Opus 4.6 9fae911760 fix: dark mode button visibility — RainbowButton and DownloadButton
- RainbowButton: dark mode text white→dark for contrast on white bg
- DownloadButton: dark mode invert to white bg + dark text

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 23:21:45 +08:00
7418andClaude Opus 4.6 464ee64a52 fix: download button dark mode — invert colors for visibility
Light: dark bg + white text. Dark: white bg + dark text.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 23:16:51 +08:00
7418andClaude Opus 4.6 386224d7d9 fix: download button use fixed colors for consistent visibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 22:27:55 +08:00
7418andClaude Opus 4.6 6e666b1297 feat: SEO optimization, favicons, and dark mode download button fix
- Add comprehensive metadata: Open Graph, Twitter Card, keywords, robots
- Add per-page metadata with i18n alternates for homepage (en/zh)
- Add robots.ts, sitemap.ts (dynamic from docs), manifest.ts
- Add favicon (icon.png 32px), apple-icon.png (180px), PWA icons (192/512px)
- Add og-image.png (1200x630) for social sharing
- Update site.config.ts with canonical URL and improved description
- Fix DownloadButton dark mode: white-on-white text → dark:bg-white dark:text-black

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 22:03:52 +08:00
7418andClaude Opus 4.6 3f56edc4c8 fix: upgrade next 15.3.3 → 15.3.6 to resolve CVE-2025-66478
Vercel blocks deployment of vulnerable Next.js versions.
15.3.6 is the patched release for the App Router vulnerability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:12:00 +08:00
7418andClaude Opus 4.6 3b87e56134 fix: site build/deploy blockers — local fonts, lint cleanup, Vercel compat
- Replace next/font/google with next/font/local to eliminate build-time
  dependency on fonts.googleapis.com (Inter + Geist self-hosted in repo)
- Centralize font definitions in src/lib/fonts.ts, single entry point
- Remove unused Geist import and AnimatePresence import (lint warnings)
- Delete unused community/download placeholder pages (build errors)
- Add outputFileTracingRoot for monorepo vendor chunk resolution
- Make root prepare script CI-safe (husky graceful fallback)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:59:39 +08:00
7418andClaude Opus 4.6 1359758fbf feat: add marketing site and docs app (apps/site)
- Homepage with hero section (typewriter animation, ChatDemo, FlickeringGrid),
  features section, open-source section (GitHub stars), FAQ accordion, final CTA
- Docs powered by fumadocs-ui with i18n (en/zh), custom top nav bar with
  search, GitHub link, and language switcher
- Marketing content system with typed en/zh content files
- Custom components: RainbowButton, ScrollNav, ChatDemo animation
- Docs pages: Getting Started, Installation, Providers, MCP, Bridge,
  Assistant Workspace, FAQ
- DownloadButton MDX component linking to GitHub Releases
- Monorepo workspace config (apps/*, packages/*)
- Fix FAQ accordion lint (pure CSS grid-template-rows animation, no useEffect)
- Fix RainbowButton empty interface lint error

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 20:25:57 +08:00
7418andClaude Opus 4.6 9b2793c9d3 chore: bump version to 0.30.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 12:56:55 +08:00
7418andClaude Opus 4.6 281e7f9502 fix: skills/MCP/completion system overhaul — separate skill kinds, fix MCP remote servers, deduplicate completion processing
Skills system:
- Replace `CommandBadge.isSkill: boolean` with `kind: SkillKind` (agent_skill | slash_command | sdk_command | codepilot_command)
- handleSubmit dispatches by kind: agent_skill retains skill name in prompt, slash/sdk commands pass through to SDK, codepilot commands expand via COMMAND_PROMPTS
- Popover groups commands into Commands / Slash Commands / Agent Skills
- API `/api/skills` returns `kind` field; `displayOverride` persisted through full chain (frontend → API → DB)
- Forward SDK `system:init` slash_commands/skills metadata to frontend via SSE

MCP management:
- Fix remote server (SSE/HTTP) creation: validate `url` instead of `command`
- Fix dual-config read/write asymmetry: PUT routes servers by `_source` to correct file (~/.claude.json vs ~/.claude/settings.json)
- DELETE checks both config files; POST checks both for name collision
- McpManager preserves `_source` tags on edit/rename; JSON editor only manages settings.json servers

Completion processing:
- Extract core logic into `onboarding-processor.ts` and `checkin-processor.ts` (shared by route handlers and server-side detection)
- Remove frontend `detectAssistantCompletion` from ChatView — server-side path in `finally` block is now the single source of truth
- Replace hard-coded `fetch("http://localhost:PORT/...")` with direct function imports
- Both processors are internally idempotent (check state before processing)

Other:
- `settingSources` always includes 'user' so SDK loads ~/.claude/skills/
- Add 24 unit tests for SkillKind dispatch logic
- Add onboarding-completion extraction tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 12:49:43 +08:00
7418andClaude Opus 4.6 789b453e92 fix: onboarding stability, invalid JSON from hooks, file tree race conditions
Issue 1 — Onboarding re-triggering after completion:
- ChatView.tsx: fence regex now tolerates CRLF, trailing whitespace, leading
  whitespace before closing fence; JSON.parse input trimmed
- ChatView.tsx: hookTriggeredSessionId only cleared when backend returns ok
- assistant-workspace.ts: saveState uses atomic write (tmp + rename)

Issue 2 — "CLI output was not valid JSON" during document reads:
- claude-client.ts: remove all SDK hooks (Notification + PostToolUse) to
  eliminate hook_callback control_request transport that corrupts stdout
- claude-client.ts: TodoWrite sync moved to message stream — tool_use records
  pending input, tool_result emits task_update only on success
- claude-client.ts: notifications derived from system/task_notification and
  result/is_error messages; Telegram forwarding preserved via notifyGeneric

Issue 3 — File tree not updating on project switch:
- FileTree.tsx: AbortController cancels in-flight requests on directory change;
  abort fires before empty-directory early return to prevent stale overwrites;
  error state distinguishes empty dir from load failure; loading always reset
- page.tsx: clear workingDirectory immediately on session switch
- SplitColumn.tsx: clear workingDirectory when active column has no directory

Tests: 9 new tests for fence parsing, atomic write, corrupted state fallback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 21:27:54 +08:00
7418andClaude Opus 4.6 f76e4747cd feat: unified provider resolver with protocol-based dispatch
Extract provider resolution logic into two new modules:
- provider-catalog.ts: vendor presets, default model catalogs, protocol definitions
- provider-resolver.ts: unified resolution for all consumers (Claude SDK, AI SDK, model listing)

DB migration:
- Add protocol, headers_json, env_overrides_json, role_models_json columns to api_providers
- Create provider_models table for per-provider model catalog

Consumer refactoring:
- claude-client.ts: replace inline env-building with toClaudeCodeEnv()
- text-generator.ts: replace inline config with toAiSdkConfig()
- conversation-engine.ts, onboarding, checkin, plan routes: use shared resolveProvider()
- /api/providers/models: read from catalog + provider_models table

UI improvements:
- Merge confusing "Custom API (Anthropic-compatible)" into "Anthropic Third-party API"
- Add 3-field model name mapping (sonnet/opus/haiku) in advanced options
- ProviderForm.tsx: support new fields (protocol, env_overrides, role_models)

Bug fixes:
- Protect auth credentials from being deleted by legacy extra_env empty-string overrides
- Fix env var names: ANTHROPIC_DEFAULT_SONNET → ANTHROPIC_DEFAULT_SONNET_MODEL (SDK convention)

Tests: 229/229 passed. Verified with aiberm (no mapping) and pipellm (with mapping).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 20:30:35 +08:00
7418andClaude Opus 4.6 4dc787c4a4 chore: bump version to 0.29.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:55:59 +08:00
7418andClaude Opus 4.6 94528edac9 fix: use local timezone for date-based features (check-in, usage stats)
Root cause: `new Date().toISOString().slice(0, 10)` returns UTC date,
causing date-based features to be off by up to ±1 day for non-UTC users.

Check-in / assistant workspace:
- Add `getLocalDateString()` utility, replace all UTC date comparisons
- Schema v2→v3 migration: normalize lastCheckInDate only when it matches
  UTC today (ambiguous window); leave past dates untouched so check-in
  triggers correctly after upgrade
- Runtime compat in `needsDailyCheckIn`: accept UTC today as fallback
  for edge cases the migration cannot catch
- `needsDailyCheckIn(state, now?)` accepts optional time for testability

Usage stats:
- Replace single-offset SQL bucketing (`DATE(datetime(..., '+N minutes'))`)
  with JS-side per-row aggregation using `getLocalDateString(new Date(utc))`
- Date methods account for historical DST offset at each message's timestamp
- `getTokenUsageStats(days, now?)` accepts optional time to pin window start
- Window boundary via `localDayStartAsUTC()` is already DST-aware

Tests (new file: timezone-boundaries.test.ts, 22 tests):
- getLocalDateString at UTC+9/UTC-5/UTC boundaries with fixed timestamps
- needsDailyCheckIn: compat suppression, clearly-past trigger, local match
- v2→v3 migration: targeted normalization, past-date preservation, null safe
- localDayStartAsUTC: UTC+8/UTC-5 midnight boundaries
- Usage stats bucketing: UTC+9 cross-day, summary window, DST spring-forward
- All usage stats tests use pinned `now` — no time-bomb from fixed test data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:55:29 +08:00
7418andClaude Opus 4.6 4da188bfe5 feat: theme family system with 12 color palettes + NavRail redesign
Theme system:
- Two-layer architecture: mode (light/dark/system via next-themes) + theme family (color palette via CSS variables)
- 12 theme families: Default, GitHub, Rosé Pine, Tokyo Night, Everforest, Nord, Kanagawa, Night Owl, Poimandres, Vesper, Horizon, SynthWave '84
- Per-family code block highlighting for Prism, HLJS, and Shiki (no more generic oneLight/oneDark fallback)
- Anti-FOUC: synchronous script in <head> reads localStorage and sets data-theme-family before paint
- Theme JSON files in themes/ directory, auto-discovered by server-side loader
- OKLCH color space for all values; CSS specificity html[data-theme-family] beats :root

UI changes:
- NavRail: moved Settings to bottom (replacing theme toggle), removed light/dark toggle button
- Settings: merged General controls into one card with dividers; Appearance section with live Shiki code preview
- Replaced hardcoded blue-500/blue-600 with primary/primary-foreground across 19 components
- Appearance settings: pill mode selector (light/dark/system), theme family dropdown, live code preview

New files:
- src/lib/theme/{types,loader,render-css,context,code-themes}.ts — core theme infrastructure
- src/components/layout/ThemeFamilyProvider.tsx — client context provider
- src/components/settings/AppearanceSection.tsx — appearance settings UI
- src/hooks/useAppTheme.ts — combined theme hook
- themes/*.json — 12 theme family definitions
- docs/handover/theme-system.md — handover documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 11:15:01 +08:00
7418andClaude Opus 4.6 7ad66f82c4 fix: correct README factual errors and add user-facing content
P1 fixes:
- Replace "Extensions page" with actual MCP + Skills sidebar pages
- Update signing status: macOS is signed (not notarized), Win/Linux unsigned
- Fix Gatekeeper warning description to match signed-but-unnotarized state

P2 fixes:
- Correct Assistant Workspace file locations: soul.md/user.md/claude.md/memory.md
  are at workspace root, .assistant/ is state-only subdirectory
- Translate "Why CodePilot" section to full Japanese (was English regression)
- Add provider auth path clarification (CLI/env optional vs custom required)
- Add specific page names in First Launch (Settings > Providers, Settings > Assistant, MCP, Skills)

Missing content:
- Add structured Documentation section with user guides and developer docs
- Add FAQ section covering: claude not found, no models after provider config,
  dev vs electron:dev, workspace file locations, Bridge platform tokens
- Sync all additions across EN, CN, JA

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 15:51:35 +08:00
7418andClaude Opus 4.6 a249fb9c4f docs: rewrite READMEs from dev memo to user-facing landing page
- Replace 17-item flat feature list with "Why CodePilot" benefit paragraphs
- Add Quick Links nav bar, First Launch guide, and 3 grouped capability tables
- Collapse ~120-line installation troubleshooting into <details> blocks
- Remove Tech Stack and Project Structure (already in ARCHITECTURE.md)
- Move WeChat QR from hero to Community section
- Add Documentation section linking to ARCHITECTURE.md and docs/
- README_CN.md: full Chinese translation, identical structure
- README_JA.md: Japanese headings/tables, English kept for narrative sections

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 15:32:42 +08:00
7418andClaude Opus 4.6 1e0958f598 feat: QQ bridge channel + SDK crash resilience fixes
QQ Bridge Adapter (new):
- qq-api.ts: AppAccessToken, WebSocket Gateway, heartbeat, passive reply,
  msg_seq auto-increment — pure QQ protocol layer
- qq-adapter.ts: BaseChannelAdapter impl with WebSocket lifecycle,
  C2C_MESSAGE_CREATE handling, image download (base64), dedup, reconnect
- Settings UI (QqBridgeSection.tsx) + API routes (/api/settings/qq)
- i18n keys for en/zh, PLATFORM_LIMITS qq: 2000

replyToMessageId threading:
- bridge-manager.ts: thread msg.messageId through all deliver/command/
  permission paths — required for QQ passive reply (msg_id mandatory)
- permission-broker.ts: accept and forward replyToMessageId

SDK crash resilience (bug fix):
- bridge-manager.ts: check hasError BEFORE saving sdkSessionId — the SDK
  may emit a session_id before crashing, and saving that broken ID caused
  ALL subsequent messages to fail by repeatedly resuming a corrupted session
- claude-client.ts: always clear sdk_session_id on crash, even for fresh
  sessions (SDK can persist a new ID via status event before dying)
- conversation-engine.ts: attach filePath to file objects after disk write
  so streamClaude() reuses on-disk copies (prevents duplicate writes,
  matches desktop route behavior)

QQ permission handling (P1 fix):
- permission-broker.ts: for channels without inline button support (QQ),
  render text-based /perm allow|deny|allow_session commands instead of
  invisible inlineButtons that would deadlock the stream

QQ passive reply budget (P2 fix):
- bridge-manager.ts: QQ-specific delivery limits chunks to 3 max,
  truncates with notice to avoid exhausting passive reply quota
- delivery-layer.ts: export chunkText for reuse

Error message improvement:
- claude-client.ts: when exit code 1 with image files, hint "Provider may
  not support image/vision input" instead of generic auth/network message

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 22:24:54 +08:00
7418andClaude Opus 4.6 c18776f4ca feat: integrate Claude Agent SDK capabilities — model/command discovery, effort/thinking, MCP runtime, file rewind, structured output
Systematically integrate high-value SDK capabilities while preserving the
multi-provider architecture:

SDK capability discovery (per-provider cache):
- agent-sdk-capabilities.ts: cache models, commands, account info, MCP status
  per provider via Map<providerId, cache> to prevent cross-provider pollution
- claude-client.ts: fire-and-forget captureCapabilities() after query() init
- providers/models: merge SDK models with static defaults
- skills: merge SDK slash commands with filesystem skills

Query options passthrough:
- thinking (adaptive/enabled/disabled), effort (low/medium/high/max),
  outputFormat, agents, enableFileCheckpointing
- /chat page.tsx: first-message path now includes effort/thinking (was missing)
- stream-session-manager: passes effort/thinking in POST body

Graceful interrupt:
- /api/chat/interrupt: conversation.interrupt() before abort fallback
- stream-session-manager: tries interrupt first, aborts after 2s timeout

MCP runtime management:
- /api/plugins/mcp/status: live status from active Query, auto-resolves
  providerId from session DB record (prevents wrong-provider cache writes)
- /api/plugins/mcp/reconnect + toggle: reconnect/enable/disable servers
- McpManager + McpServerList: runtime status indicators with action buttons

File checkpointing & rewind:
- enableFileCheckpointing=true for code mode by default
- rewind_point SSE: only emitted for prompt-level user messages
  (parent_tool_use_id===null) and skips autoTrigger turns
- /api/chat/rewind: dry-run preview + actual rewind via rewindFiles()
- MessageList: RewindButton with dry-run preview

Structured output:
- /api/chat/structured: reads SDKResultSuccess.structured_output as primary
  path, text fallback only when absent

Account info & thinking config:
- /api/sdk/account: cached account info display
- Settings: thinking_mode in ALLOWED_KEYS, thinking mode selector in UI
- Effort selector in MessageInput with lifted state pattern

New files: 11 route handlers + 2 lib modules + 1 test file
Modified files: 18 (types, client, manager, UI components, i18n)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 18:22:05 +08:00
7418andClaude Opus 4.6 6c02c135fe fix: composer UI polish and permission selector improvements
Slash command:
- Fix first-click bug: set textarea.value and cursor position before
  calling handleInputChange so selectionStart reads correctly
- Move slash button to right of + (attach) button
- Simplify icon from CommandLineIcon to plain "/" text

Composer action bar:
- Move Agent toggle and permission selector to left side (was centered)
- Adjust spacing: reduce input padding, increase bottom margin

Permission selector:
- Add dropdown arrow indicator (ArrowDown01Icon)
- Change full_access color from orange to red (icon + text + background)
- Check res.ok before updating UI state (prevent false success)
- Make sessionId optional to support /chat new session page
- Log warnings on PATCH failure instead of silent catch

New chat page (/chat):
- Add ChatPermissionSelector with local state before session exists
- Pass permission_profile in session creation payload
- Backend createSession() now accepts and writes permission_profile

Context usage indicator:
- Reduce circle size from 22px to 16px
- Change used-portion color to dark gray (zinc-600/400)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 16:03:19 +08:00
7418andClaude Opus 4.6 111fa8c92e feat: refactor composer to two-layer layout, add session permission & context indicator
Composer restructure:
- MessageInput internal footer now only contains: file button, model
  selector, slash command button, and send button
- Removed mode toggle (Code/Plan) from composer area (logic preserved)
- New ChatComposerActionBar below input with three slots: left (Design
  Agent), center (permission selector), right (context indicator)

New components:
- SlashCommandButton: inserts `/` at cursor, reuses existing slash
  command detection and popover logic
- ChatPermissionSelector: session-level permission toggle (default /
  full_access) with danger confirmation dialog
- ContextUsageIndicator: SVG donut chart showing context usage ratio
  with HoverCard displaying model, tokens, cache stats
- ChatComposerActionBar: slot-based container for action bar items

Session permission (permission_profile):
- DB: new column on chat_sessions, default 'default'
- API: PATCH sessions supports updating permission_profile
- Chat API: bypassPermissions = global setting OR session full_access
- PermissionPrompt: auto-approves and hides when full_access
- Claude client: combines global and per-session bypass flags

Bridge integration:
- permission-broker: auto-approves permissions for full_access sessions
  without sending IM notifications
- conversation-engine: passes bypassPermissions to SDK for full_access
- PATCH route: auto-approves pending bridge permissions on switch to
  full_access

Other:
- ImageGenToggle relabeled to "Design Agent" / "设计 Agent"
- New model-context.ts with MODEL_CONTEXT_WINDOWS lookup
- Provider models API returns optional contextWindow field
- New useContextUsage hook for token usage calculation
- i18n: added composer.*, permission.*, context.* keys (en + zh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:55:38 +08:00
7418andClaude Opus 4.6 9695825007 chore: bump version to 0.27.1
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:24:20 +08:00
7418andClaude Opus 4.6 c07a604271 fix: address code review findings — snapshot dedup, workspace hooks, permission params, Windows health check
ChatView.tsx (P2): snapshot consumption now calls detectAssistantCompletion()
so assistant workspace onboarding/check-in state updates even when the
stream completes while ChatView is unmounted.

ChatView.tsx (P2): replace local temp-message append with a DB re-fetch
on snapshot consumption to avoid duplicate messages (backend already
persists the reply in route.ts).

page.tsx (P3): add updatedInput and denyMessage parameters to
handlePermissionResponse so AskUserQuestion answers and ExitPlanMode
custom deny messages are forwarded to the permission API on the
first-message page.

electron/main.ts: fix Windows startup timeout by forcing IPv4 (family:4)
in health check HTTP request and improving error diagnostics.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:24:19 +08:00
7418andClaude Opus 4.6 5eedb5bacc fix: resolve 7 bugs — idle output, permission scroll, file selector, drag area, input reset, markdown tables, panel collapse
- ChatView: consume unconsumed stream snapshots on mount so output
  appears after idle without needing a conversation switch
- PermissionPrompt: extract permission UI from StreamingMessage into a
  fixed-position component at the bottom of ChatView, preventing
  permission popups from scrolling off-screen during long responses
- StreamingMessage/MessageList: remove ~409 lines of permission UI code
  now handled by PermissionPrompt
- AssistantWorkspaceSection: fix macOS Electron file selector by using
  the correct IPC API (window.electronAPI.dialog.openFolder)
- AppShell: increase title bar drag region from h-5 to h-10 (#152)
- ChatView: add key={sessionId} on MessageInput to reset input state
  when switching conversations (#176)
- UpdateDialog: add remark-gfm plugin and table component mappings for
  proper GFM markdown rendering in release notes (#117)
- RightPanel: add border and top margin to collapsed panel toggle for
  visibility (#116)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:24:19 +08:00
7418andClaude Opus 4.6 94fdd36d27 feat: assistant workspace V2 — indexing, retrieval, security hardening & workspace switching
Assistant Workspace V2:
- Markdown indexing engine (incremental manifest + chunks JSONL)
- Keyword retrieval with CJK bigram support and hotset boosting
- Directory taxonomy inference and evolution suggestions
- Workspace config management (.assistant/config.json)
- Organize API: capture, classify, move, archive, suggest-evolution

Workspace switching:
- Inspect API (GET /api/workspace/inspect) for pre-switch validation
- Two-phase switching with confirmation dialogs (5 workspace statuses)
- Atomic save: init/reset runs before setSetting(), rollback on failure
- Auto-navigate to new/reused session after switch
- Mismatch banner in ChatView (only for former assistant sessions)
- Debounced path validation with visual indicators

Security hardening:
- Completion fence (onboarding-complete/checkin-complete) only processes
  when session.workingDirectory === assistant_workspace_path (frontend)
  AND session.working_directory === workspacePath (backend double-check)
- assertContained() in workspace-organizer: rejects absolute paths, ~/,
  ../ traversal, and symlink escapes for captureNote/moveFile
- organize API validates all path params at entry (validateRelativePath)
- captureDefault sanitized to relative path on onboarding write
- R_OK + W_OK validation on GET settings, session creation, and PUT

Bug fixes:
- hookTriggeredSessionId now read before auto-trigger; allows retry if
  session has no messages (previous trigger failed silently)
- workspace-switched event listener matches oldPath (not just != newPath)
  so normal project chats never show the mismatch banner
- Daily check-in card hidden when onboarding not complete
- Refresh docs now calls generateRootDocs() + generateDirectoryDocs()
- Banner "Open" button reuses latest session (checkin mode) instead of
  always creating new onboarding session

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 00:37:02 +08:00
7418andClaude Opus 4.6 19aba25c8f feat: assistant workspace — persistent AI personality & memory via Markdown files (#165)
Add "Assistant Workspace" feature that lets users designate a directory
(e.g. Obsidian vault) containing 4 Markdown files (soul.md, user.md,
memory.md, claude.md) to define AI personality, user profile, long-term
memory, and execution rules. These files are automatically injected into
the system prompt for assistant project sessions.

Core library (src/lib/assistant-workspace.ts):
- Workspace validation, initialization with template files
- File loading with 8000-char truncation, XML prompt assembly (40k limit)
- State management via .assistant/state.json
- Directory docs generation (README.ai.md + PATH.ai.md)
- Case-insensitive file name fallback (soul.md → SOUL.md)

System prompt injection (src/app/api/chat/route.ts):
- Scoped to sessions where working_directory === workspace path
- Workspace prompt prepended before session-level system prompt
- Onboarding/check-in instructions injected as <assistant-project-task>
- autoTrigger flag skips user message save and title update

Chat-based onboarding (10 questions) & daily check-in (3 questions):
- AI conducts conversation, outputs structured completion code blocks
- Frontend detects onboarding-complete/checkin-complete blocks
- Backend calls Claude API to generate file content from answers
- Fallback to raw answers if API call fails

Auto-trigger pipeline:
- Mount trigger (500ms delay) + focus fallback in MessageInput
- assistantTriggerFiredRef prevents duplicate triggers per mount
- hookTriggeredSessionId in state.json prevents cross-reload duplicates
- Daily check-in only triggers in the most recent workspace session
- hookTriggeredSessionId cleared via __clear__ sentinel after completion

API endpoints:
- GET/PUT /api/settings/workspace — path CRUD + file status
- POST /api/workspace/session — create (onboarding) or reuse (check-in)
- POST /api/workspace/onboarding — AI-generate soul.md + user.md
- POST /api/workspace/checkin — AI-update memory.md + user.md
- POST /api/workspace/hook-triggered — set/clear trigger guard
- GET /api/workspace/latest-session — latest session lookup
- POST /api/workspace/docs — refresh directory documentation

UI:
- Settings "Assistant" tab with workspace path, file status, controls
- Violet badge on workspace project group in ChatListPanel
- useAssistantWorkspace hook for state queries

Also includes:
- 102 passing tests (16 new regression tests for workspace logic)
- i18n keys for en.ts and zh.ts
- Handover documentation and execution plan

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 20:31:42 +08:00
7418andClaude Opus 4.6 113e15e2f4 feat: Discord bridge adapter — 完整实现 Discord 作为第三个桥接渠道
新增文件:
- discord-adapter.ts: 基于 discord.js v14 的适配器,支持 DM/频道消息、
  按钮交互、流式预览(edit-based)、@提及过滤(兼容角色 mention)、
  图片附件下载、!→/ 命令归一化、消息去重、typing indicator
- markdown/discord.ts: Discord 2000 字符分段,代码块围栏自动平衡
- API routes: settings CRUD(Token 掩码)+ verify(Discord REST 验证)
- DiscordBridgeSection.tsx: 设置 UI(凭据、授权、服务器策略、配置指南含 ID 获取方法)
- discord-bridge.test.ts: 22 项单元测试(chunking/auth/command/HTML 转换)

修改文件:
- bridge-manager.ts: Discord 分段投递 + channel-aware stream config
  (Discord 默认 1500ms/40chars/1900max vs Telegram 700ms/20/3900)
- BridgeLayout/BridgeSection: Discord 渠道开关和侧栏入口
- bridge/settings/route.ts: 新增 14 个 Discord 设置键
- next.config.ts: serverExternalPackages 添加 discord.js/zlib-sync
- i18n: 中英文完整翻译(30+ keys)
- docs/handover/bridge-system.md: Discord 架构文档

依赖:discord.js ^14.18.0, zlib-sync ^0.1.9

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 23:32:46 +08:00
7418andClaude Opus 4.6 538cc1b7fd docs: 工程质量保障体系执行计划文档
- 新建 completed/engineering-quality-assurance.md:记录 Harness Engineering
  全部 5 个已完成 Phase 和 4 个未实现 Phase 的详细内容
- 更新 exec-plans/README.md 索引

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 21:08:49 +08:00
7418andClaude Opus 4.6 935e3d030c fix: i18n 品牌名修正 — Claude → CodePilot
- en.ts / zh.ts: messageList.claudeChat 和 emptyDescription 中的
  "Claude" 改为 "CodePilot",与应用品牌一致

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 21:00:52 +08:00
7418andClaude Opus 4.6 a8e1bca9d3 chore: bump version to v0.25.1
工程化改进版本:
- 激活验证闭环(pre-commit hook + CI gate + npm test scripts)
- CLAUDE.md 改造 + ARCHITECTURE.md 架构导航
- 执行计划体系 + 技术债务追踪
- chrome-devtools MCP 集成 + UI 验证规则

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:54:53 +08:00
7418andClaude Opus 4.6 a7104aa4eb chore: 集成 chrome-devtools MCP + UI 验证规则
.mcp.json(新建):
- 添加 chrome-devtools MCP server(stdio 模式,npx chrome-devtools-mcp@latest)
- 签入仓库使团队成员 clone 后自动启用

CLAUDE.md:
- 新增"UI 改动必须用 CDP 验证"规则:
  修改组件/样式/布局后,通过 chrome-devtools MCP 截图确认渲染正确、
  检查 console 无报错、模拟交互验证、响应式布局用 device emulation 验证

目的:建立 UI 改动的自动化视觉验证闭环,
AI 修改前端代码后自动启动浏览器截图检查,而非仅靠 typecheck 判断正确性。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:50:18 +08:00
7418andClaude Opus 4.6 62dbecd5dc docs: 执行计划体系 + 技术债务追踪 + CLAUDE.md 执行计划规则
docs/exec-plans/(新建目录):
- README.md — 执行计划规范、模板、何时需要写执行计划
- active/context-storage-migration.md — 从 research/ 迁移,标注 Phase 0-3 进度状态
  (Phase 0 部分完成:sdk_cwd 上线;projects 表和 canUpdateSdkCwd 未实现)
- tech-debt-tracker.md — 4 项已知技术债务(ESLint 存量 error、内存态注册表、
  固定 50 条 fallback、Phase 0 剩余项)

CLAUDE.md:
- 新增"执行计划"区块:中大型功能必须先写执行计划再开工
- 文档区块增加 exec-plans/ 索引

ARCHITECTURE.md:
- 关键文档索引增加执行计划和技术债务条目

docs/research/README.md:
- context-storage-migration-plan 条目增加交叉引用指向执行文档

docs/CLAUDE.md:
- 增加 exec-plans/ 目录说明和文档分类规则

目的:确保 AI 后续会话能自动遵循执行计划流程,
读取进度状态而不需要重新口头解释历史。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:44:12 +08:00
7418andClaude Opus 4.6 e0c38af4fa docs: CLAUDE.md 改造为路由层 + 新建 ARCHITECTURE.md
CLAUDE.md:
- 顶部增加指向 ARCHITECTURE.md 的导航
- 新增"改动自查"区块(i18n / 数据库 / 类型 / 文档四项检查)
- 文档区块增加 ARCHITECTURE.md 索引
- 保持所有原有规则不变,仅重组结构使其更清晰

ARCHITECTURE.md(新建,~120 行):
- 技术栈概述(Electron 40 + Next.js 16 + SQLite)
- 目录结构地图(src/ 下所有一级目录及关键文件职责)
- 数据流图(用户输入 → API → SDK → SSE → 渲染 → 持久化)
- Bridge 数据流图(IM → Adapter → Router → Engine → Delivery → IM)
- 数据库 12 张表索引
- Bridge 子系统核心组件说明
- 新增功能标准触及点清单(类型/数据库/API/页面/组件/Hook/i18n/Bridge)
- 关键文档索引(handover + research)
- 技术栈速查表

目的:减少每次 Claude Code 会话的探索成本,直接跳转到正确位置。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:38:52 +08:00
7418andClaude Opus 4.6 99c4931b12 chore: 激活验证闭环 — pre-commit hook + CI gate + npm test scripts
三层质量保障闭环:

package.json:
- 新增 typecheck / test:unit / test:smoke / test:e2e / test / prepare 脚本
- 新增 lint-staged 配置(仅对暂存 .ts/.tsx 文件运行 eslint --fix)
- 新增 devDependencies: husky, lint-staged, tsx

.husky/pre-commit:
- 依次执行 lint-staged → tsc --noEmit → 单元测试
- 任一步骤失败即阻止提交

src/__tests__/e2e/smoke.spec.ts:
- 5 个 Playwright @smoke 测试覆盖核心路由 (/, /chat, /plugins, /plugins/mcp, /settings)
- 检查 HTTP 状态、Next.js 错误覆盖层、标题、console 错误
- 复用已有 helpers (goToChat, goToPlugins, goToMCP, goToSettings, collectConsoleErrors, filterCriticalErrors)

.github/workflows/build.yml:
- 新增 lint-test job (ubuntu-latest): lint → typecheck → unit tests
- 新增 pull_request 触发器
- 三个 build job 添加 needs: [lint-test],lint-test 失败则不构建
- lint 步骤暂设 continue-on-error(存量 4 个 lint error 待修复)

CLAUDE.md:
- 新增"自检命令"区块,说明 test / test:smoke / test:e2e 用途

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:33:01 +08:00
7418andClaude Opus 4.6 243724a765 feat: 飞书(Feishu/Lark)Bridge 适配器 + 发布 v0.25.0
新增飞书 IM 通道,通过 @larksuiteoapi/node-sdk WSClient 接收消息、REST Client 发送回复。

适配器核心 (feishu-adapter.ts):
- WSClient 长连接接收 im.message.receive_v1 事件
- 消息去重 (message_id LRU 1000)、授权校验、群聊策略 (open/allowlist/disabled)
- @提及检测 (bot open_id/user_id/union_id 匹配)
- 图片/文件/音频/视频/富文本(post) 下载 → base64 FileAttachment
- Typing 指示器 (Openclaw 方案: emoji reaction)
- /perm 文本命令处理权限审批

渲染策略 (markdown/feishu.ts):
- 代码块/表格 → schema 2.0 interactive card (markdown 元素)
- 纯文本 → post (md tag), 支持粗体/斜体/行内代码/链接
- 权限卡片 → schema 2.0 card + /perm 文本命令 (无按钮, 见下方决策)
- 每层降级: card → post → text

关键决策 — 权限交互无按钮:
- 飞书 card.action.trigger 回调需 HTTP webhook, WSClient 不支持
- schema 2.0 不支持 action 标签 (错误码 200861)
- schema 1.0 按钮可渲染但点击报 200340 (无 webhook 端点)
- Openclaw 用 http.createServer + Lark.adaptDefault 解决, CodePilot 桌面端无公网端点
- 最终方案: 格式化卡片 + /perm 文本命令, 用户复制发送即可审批

其他变更:
- permission-broker.ts: permissionRequestId 去重 (30s TTL)
- telegram-bot.ts: bridge 模式互斥 (globalThis 标志)
- bridge-manager.ts: 飞书渲染分发 (deliverResponse feishu 分支)
- UI: FeishuBridgeSection 设置页 + 侧边栏入口 + 通道开关
- i18n: 中英文飞书配置文案
- 交接文档: bridge-system.md 更新飞书架构、数据流、6 项设计决策

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 19:03:13 +08:00
7418andClaude Opus 4.6 b1a043a995 feat: Telegram 流式预览(sendMessageDraft)+ 出站渲染解耦 + 投递容错
Bridge 新增"边生成边显示"能力,利用 Telegram Bot API 9.5 的
sendMessageDraft 在私聊中以草稿形式流式展示 Claude 生成进度。
架构上抽象为通道级可选能力,便于后续扩展到其他 IM。

types.ts
- 新增 PreviewCapabilities、StreamingPreviewState 接口

channel-adapter.ts
- BaseChannelAdapter 新增三个可选方法:
  getPreviewCapabilities / sendPreview / endPreview
- sendPreview 返回 'sent'|'skip'|'degrade' 三态,
  区分瞬时失败(跳过)和永久失败(降级)

telegram-utils.ts
- 新增 sendMessageDraft() API 封装(plain text,截断到 4096)

telegram-adapter.ts
- 实现 getPreviewCapabilities: 开关检查 + 私聊/群聊检测 + 降级状态
- 实现 sendPreview: 调 sendMessageDraft,400/404 永久降级,429 仅跳过
- 实现 endPreview: 空操作
- stop() 清空 previewDegraded Set

conversation-engine.ts
- 新增 OnPartialText 回调类型
- processMessage / consumeStream 透传 onPartialText 参数
- 使用独立 previewText 变量(只累积、不因 tool_use 清零),
  避免预览文本在工具调用后回退/抖动

bridge-manager.ts
- 流式预览状态机:generateDraftId / getStreamConfig / flushPreview
  节流闭包(间隔+最小增量+trailing-edge timer),finally 清理
- flushPreview 仅在 'degrade' 时降级,'skip'/网络错误不降级
- 新增 deliverResponse() 按 channelType 分发渲染:
  Telegram → markdownToTelegramChunks + deliverRendered
  其他 IM → deliver() 纯文本(内部自动分块)
  解除 handleMessage 对 Telegram 渲染的硬编码依赖

delivery-layer.ts
- deliverRendered: chunk 失败后继续投递剩余 chunk(不中断),
  追发截断提示通知用户,返回 ok:false 标识不完整投递
- deliver: 保持原有 fail-fast 行为(短消息无需跳过)

route.ts (bridge/settings)
- BRIDGE_SETTING_KEYS 白名单追加 5 个流式配置项

docs/handover/bridge-system.md
- 更新目录结构、数据流、设计决策(#12 流式预览)、设置项表

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 23:20:47 +08:00
7418 6dfe23a9a9 fix: 修复百炼 API key 配置并发布 v0.23.1 2026-03-03 16:36:10 +08:00
7418andClaude Sonnet 4.6 5413eb55ba refactor: 简化 macOS 构建 — 只签名不公证,禁用原生热更新
CI (.github/workflows/build.yml):
- 删除 mac_notarize 输入、notarization strategy/credentials 步骤
- 双架构回归单步构建,统一 -c.mac.notarize=false
- 证书缺失时硬失败,不 fallback ad-hoc
- 上传产物移除 blockmap / latest-mac.yml
- release 收集资产移除 blockmap / yml 元数据

electron-builder.yml:
- mac.notarize 固定为 false

Electron 主进程 (main.ts):
- 移除 initAutoUpdater / setUpdaterWindow 调用和 import

Preload (preload.ts):
- 移除 updater bridge,不再暴露 electronAPI.updater

Updater (updater.ts):
- 恢复为 no-op stub

前端 AppShell 无需改动 — isNativeUpdater 运行时检测 updater 不存在,
自动走 /api/app/updates 浏览器模式(全量下载链接)。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 13:27:35 +08:00
7418andClaude Sonnet 4.6 5629da9571 fix: arm64 打包脚本改用 if/else 分支替代 EXTRA_ARGS 数组
bash 数组展开在 GitHub Actions 中不稳定,
改为 NOTARIZE 变量 + if/else 直接调用不同命令行。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 11:45:10 +08:00
7418andClaude Sonnet 4.6 db86644c7e feat: macOS 双架构分离构建 — x64 只签名,arm64 签名+条件公证
CI:
- 拆分为 x64 和 arm64 两个独立构建步骤
- x64: 签名但不公证(-c.mac.notarize=false),timeout 15min
- arm64: 签名 + 按版本号条件公证(vX.Y.0 公证,vX.Y.Z 只签名),timeout 35min
- 先跑 x64,stash 产物后跑 arm64,确保 latest-mac.yml 来自 arm64

Electron:
- electron/main.ts: darwin+x64 跳过 initAutoUpdater
- electron/preload.ts: darwin+x64 不暴露 updater bridge
- 前端 AppShell 已有运行时检测(!!window.electronAPI?.updater),
  x64 自动 fallback 到 browser 模式更新检查

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 11:35:50 +08:00
7418andClaude Sonnet 4.6 2c76b04729 feat: macOS 公证策略 — 大版本公证,小版本只签名
- workflow_dispatch 新增 mac_notarize 输入(auto/on/off)
- auto 模式:vX.Y.0 签名+公证,vX.Y.Z(Z>0) 只签名不公证
- 打包超时调整为 35 分钟,notarize=false 时传 -c.mac.notarize=false
- 凭证校验步骤仅在需要公证时执行

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 11:17:28 +08:00
7418andClaude Sonnet 4.6 0ac424f408 fix: macOS 打包步骤添加 25 分钟超时限制
避免 notarization 排队无限等待消耗 CI 额度。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 11:08:37 +08:00
7418andClaude Sonnet 4.6 f50a8879db fix: macOS 打包步骤添加 notarization 重试(最多 3 次)
Apple notarization 服务偶发网络超时,加递增间隔重试(60s/120s)。
同时启用 DEBUG=electron-notarize* 方便排查 notarization 日志。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 09:56:42 +08:00
7418andClaude Sonnet 4.6 c24dedcffe fix: CI 添加 notarization 凭证预校验步骤
在打包前用 xcrun notarytool history 验证 APPLE_ID / APP_SPECIFIC_PASSWORD / TEAM_ID
凭证组合是否有效,提前暴露凭证配置问题。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 01:30:09 +08:00
7418andClaude Sonnet 4.6 8749adaeb9 fix: CI 证书解码去除换行 + openssl 预校验
printf + tr -d 去除 base64 中可能的 \r\n,
openssl pkcs12 -noout 在签名前验证 .p12 格式和密码正确。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 01:14:42 +08:00
7418andClaude Sonnet 4.6 261d17c059 fix: CI 解码 base64 证书为 .p12 文件后传给 CSC_LINK
electron-builder 把 base64 字符串当文件路径解析导致构建失败。
改为先 base64 --decode 写入 /tmp/cert.p12,CSC_LINK 指向文件路径。
同时加 HAS_CERT 环境变量控制签名/验证步骤的条件执行。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 00:57:57 +08:00
7418andClaude Sonnet 4.6 0e38e4460e feat: macOS Developer ID 签名 + notarization + 原生热更新
签名 & 公证:
- build/entitlements.mac.plist, build/entitlements.mac.inherit.plist — Electron hardened runtime 所需权限(JIT、unsigned memory、disable library validation)
- electron-builder.yml — 启用 hardenedRuntime、entitlements、notarize: true
- scripts/after-sign.js — 环境变量 + codesign -d 双重检测,有 Developer ID 时跳过 ad-hoc;无证书时 fallback ad-hoc
- .github/workflows/build.yml — 映射签名 secrets(MAC_CERT_P12_BASE64 等),验证步骤断言 Developer ID Authority + TeamIdentifier,遍历双架构 .app

原生热更新:
- electron/updater.ts — 从 no-op 重写为完整 electron-updater 实现(autoDownload:false, IPC handlers, 启动 10s 延迟检查)
- electron/preload.ts — 恢复 updater IPC bridge
- src/components/layout/AppShell.tsx — 运行时检测 native updater,useEffect 监听 updater:status 事件,native 优先 + browser fallback

其他:
- README_CN.md — 更新自动更新功能描述
- package.json — 版本号升至 0.23.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 00:46:51 +08:00
7418andClaude Opus 4.6 ddb2c00a8c fix: Skills API 增加项目级 .claude/skills 扫描
列表接口 (route.ts):
- 新增 getProjectSkillsDir + scanProjectSkills 扫描 .claude/skills/*/SKILL.md
- 解析 YAML front matter 取 name/description,source 为 "project"
- 与 project commands 去重(commands 优先)

按名查找接口 ([name]/route.ts):
- findSkillFile 查找链路扩展:project commands → project skills → global → installed
- 支持目录名直接匹配和 front matter name 匹配
- GET 对 SKILL.md 从 front matter 取 description
- PUT 增加 cwd 参数支持

修复与 Agent SDK 的目录约定不一致问题:SDK 会加载项目级
.claude/skills,但本项目 API 之前只扫 commands 目录和用户级 skills。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 17:30:57 +08:00
7418andClaude Opus 4.6 5dda2ea1e3 fix: CI release 步骤处理含空格的文件名
Windows 安装包文件名 "CodePilot Setup x.x.x.exe" 含空格,
$FILES 变量展开时被 bash word splitting 拆成多个参数导致
gh release create 找不到文件。改用 bash 数组 + "${FILES[@]}"
安全展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:55:51 +08:00
7418andClaude Opus 4.6 38e7c96daa feat: Telegram Bridge 出站消息 Markdown 渲染
新增三层 Markdown → Telegram HTML 渲染管线:

markdown/ir.ts — markdown-it 解析 Markdown 为中间表示 (MarkdownIR)
  - 支持 bold/italic/strikethrough/code/code_block/blockquote/links/lists/headings/tables/hr
  - 表格使用 code-block 模式渲染为 ASCII 表格(<pre> 保留对齐)
  - HTML 内联 <br> 标签转换为换行符

markdown/render.ts — 通用标记渲染器
  - boundary tracking + LIFO stack 处理嵌套样式

markdown/telegram.ts — Telegram 专用渲染器
  - 样式映射到 Telegram HTML 标签 (b/i/s/code/pre+code/blockquote/a)
  - 文件引用保护:README.md/main.go 等不被误识别为 URL
  - render-first 分片:按渲染后 HTML 长度分片,超限时按比例重分割

delivery-layer.ts — 新增 deliverRendered() 接收预渲染 chunks
  - HTML + plain text 双通道,解析失败自动降级纯文本
  - sendWithRetry 支持 plainFallback 参数

bridge-manager.ts — Claude 回复改用 markdownToTelegramChunks + deliverRendered
  - 命令响应和错误消息保持 escapeHtml + deliver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 14:38:12 +08:00
7418andClaude Opus 4.6 8526b58d59 docs: 更新 bridge 交接文档 — 图片接收能力
- 目录结构增加 telegram-media.ts
- 数据流图补充图片/相册处理路径
- 设计决策 #2 补充连续水位推进机制
- 新增决策 #9(图片接收)和 #10(DB 格式统一)
- 设置项表增加 image_enabled 和 max_image_size

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:06:48 +08:00
7418andClaude Opus 4.6 69d33df5b6 fix: Bridge 图片消息在桌面端聊天记录中回显
conversation-engine 保存用户消息时,复用桌面端 chat route 的存储格式:
- 将 base64 图片写入 .codepilot-uploads/ 目录
- 用 <!--files:[{id,name,type,size,filePath}]--> 格式嵌入消息 content
- 桌面 UI 的 MessageItem.parseMessageFiles() 可直接解析并通过
  FileAttachmentDisplay + /api/uploads 渲染图片

将 getSession() 调用提前到 addMessage 之前,确保 workingDirectory 可用。
写入失败时降级为 [N image(s) attached] 文本指示。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 12:58:50 +08:00
7418andClaude Opus 4.6 887870c343 fix: Telegram 图片接收 — offset 安全、caption 兜底、拒绝通知
P1a: caption-only 消息丢失
- poll loop 文本提取统一为 m.text ?? m.caption ?? ''
- 修复 image_enabled=false 时带 caption 的图片消息被跳过的回归

P1b: offset 越序风险
- markUpdateProcessed 改为连续水位推进(contiguous walk),
  不再直接跳到 updateId+1,避免越过尚未 flush 的相册 ID
- flushMediaGroup 成功入队后预注册所有 buffered ID 到 recentUpdateIds,
  保证 ack 时水位能连续推过整个相册

P2: 图片拒绝通知
- telegram-media: 统一返回 MediaDownloadResult { attachment, rejected, rejectedMessage }
  reject code 覆盖 too_large | unsupported_type | download_failed
  所有超限检查点(file_size/content-length/buffer)均返回可读文案
- telegram-adapter: processSingleImageMessage/flushMediaGroup 收集拒绝结果后
  直接通过 this.send() 发送通知到 Telegram,禁止静默丢弃

P3: 清理 lint warning
- 移除未使用的 escapeHtml import、QueueEntry interface
- 移除 downloadFileById 未使用的 expectedSize 参数

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 12:53:55 +08:00