Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
326 commits
Select commit Hold shift + click to select a range
186fb71
feat(16-02): migrate node-executor.ts to shared-infra shared layer
Jun 21, 2026
3b226a7
feat(16-02): migrate runtime.ts to shared-infra shared layer
Jun 21, 2026
7cf5d61
docs(16-02): complete node-executor and runtime migration plan summary
Jun 21, 2026
53b606b
chore: merge executor worktree (worktree-agent-acba36c4926848ce0)
Jun 21, 2026
ae2605a
feat(16-03): inject span trace into workflow execution steps
Jun 22, 2026
81fa964
feat(16-03): render span hierarchy in ExecutionPanel
Jun 22, 2026
4a97d2b
chore: merge 16-03 worktree with conflict resolution and span import fix
Jun 22, 2026
6c11d8f
fix(16): review fixes — restore regressions and harden parallel execu…
Jun 22, 2026
24defdd
feat: align parallel worker UI with delegated task richness
Jun 22, 2026
0881666
feat: wire parallel task tool into runtime and ChatArea detail view
Jun 22, 2026
8998151
chore: migrate Claude.md from GSD to gstack workflow references
Jun 22, 2026
b21fe78
fix: restore parallelBatches on session reload from DB
Jun 22, 2026
7a3de32
fix: resolve agentSlug collision in parallel batch + add task_end sum…
Jun 22, 2026
b98be9b
fix: filter tool-call arg tokens from parallel worker textBuffer
Jun 23, 2026
8966d70
feat: Phase 4 visual polish + parallel worker UI alignment
Jun 23, 2026
ef6224e
fix: resolve textarea slash command rendering bugs and type safety
Jun 23, 2026
39e533d
chore: add gstack skill routing rules to CLAUDE.md
Jun 23, 2026
9503c45
Merge remote-tracking branch 'github/master' into dev
Jun 23, 2026
1bde4ed
feat: add image upload infrastructure (types, DB, IPC, runtime)
Jun 23, 2026
d30a0ce
feat: image paste UI, lightbox preview, and toast theme fix
Jun 23, 2026
d464170
fix: SVG XSS guard, App.test matchMedia mock, TaskPanel batches null …
Jun 24, 2026
2cae7af
feat: move ApprovalModeSelector from TaskPanel to composer toolbar
Jun 24, 2026
005b839
feat: TaskPanel 改为悬浮弹出面板,优化 UI 细节
Jun 24, 2026
37a1390
Add file panel and untrack local agent state
Jun 26, 2026
0f38b02
feat: 文件管理能力补足——核心操作、编辑、MD 预览与性能优化 (#7)
Jun 27, 2026
9d526a9
fix: 系统设置 autoSave 开关、多标签编辑、MD 代码块渲染
Jun 27, 2026
20c804f
fix: tab 栏隐藏滚动条,MD 切换按钮移至 breadcrumb 栏
Jun 27, 2026
bb9e64d
feat: 文件类型彩色图标、层级面包屑、双级展收按钮 (#16)
Jun 27, 2026
2462220
feat: 文件面板按钮固定右侧、删除文件树头部、UI 优化
Jun 27, 2026
7bf9859
Deepen composer input module
Jun 27, 2026
30cf071
Deepen composer input controller
Jun 27, 2026
6f20f00
Deepen composer input surface and submission
Jun 28, 2026
70b9581
Extract conversation timeline projection
Jun 28, 2026
9b6fc2f
Add product guide and task panel transition
Jun 28, 2026
395b782
Replace lucide file icons with Material Icon Theme SVGs
Jun 28, 2026
e5b9c2a
Skip redundant directory fetch when cached data exists
Jun 28, 2026
0f466c8
Fix 8 failing CI tests in node-executor and sessionStore
Jun 28, 2026
caa3839
Fix Windows CI: tilde in 8.3 short paths falsely rejected
Jun 28, 2026
f8b2059
Fix path-safety cross-platform: split on both / and \ separators
Jun 28, 2026
78c305d
Extract activity panel projection
Jun 29, 2026
12c615f
Extract conversation viewport surface
Jun 29, 2026
9220bca
Extract conversation welcome surface
Jun 29, 2026
a751dbb
Extract model selection surface
Jun 29, 2026
0aaab3e
Extract conversation composer dock
Jun 29, 2026
13475ba
Extract conversation runtime projection
Jun 29, 2026
e09ccf7
Extract conversation workspace read model
Jun 30, 2026
0e7e6d1
Finalize conversation workspace shell
Jun 30, 2026
0356253
feat: add Obscura browser tool
Jun 30, 2026
de1f45d
build: prune Obscura resources per platform
Jun 30, 2026
28c4234
Implement OKF knowledge search
Jun 30, 2026
fb5821d
Implement knowledge entry CRUD
Jun 30, 2026
30c793d
Implement knowledge base skill
Jun 30, 2026
0f72dc7
Align knowledge base entries with OKF
Jun 30, 2026
5d40324
feat: align skills with Claude Code semantics
Jul 1, 2026
f11ed47
polish skills visibility controls
Jul 1, 2026
7b30b6e
feat: finish Claude Code-style skills
Jul 1, 2026
9547d4b
Document PDF parsing spike decisions
Jul 1, 2026
6150862
Complete PDF parsing spike report
Jul 1, 2026
af55082
Implement Marker PDF parse jobs
Jul 1, 2026
9f29329
Implement PDF parsing skill recovery workflow
Jul 2, 2026
5c7ecfe
Align skill invocation metadata and tool gating
Jul 3, 2026
5f9766f
Fix PDF parsing skill entrypoints
Jul 3, 2026
e10e38e
Make PDF skill CLI baseline parse synchronous
Jul 3, 2026
141d146
Add context button to chat composer
Jul 3, 2026
f8cacf2
Add PDF recovery capability discovery
Jul 3, 2026
f96dc97
Fix PDF recovery capability discovery review findings
Jul 4, 2026
5aeb20c
Preserve Windows marker command backslashes
Jul 4, 2026
1b6df0d
Add embedding pipeline design docs for issue #26
Jul 4, 2026
1f29834
Harden PDF parsing skill runtime
Jul 4, 2026
3f5ada0
Implement local embedding pipeline
Jul 4, 2026
34b9c9b
Fix embedding pipeline packaging and downloads
Jul 4, 2026
afc0f98
Keep PDF parse artifact images readable
Jul 4, 2026
9870abd
Fix PDF parse weak source locations
Jul 4, 2026
e8df802
Fix PDF parsing skill P2 edge cases
Jul 4, 2026
c5531d2
Implement MCP server exclusions
Jul 4, 2026
30d85cd
Implement PDF recovery viable routes
Jul 4, 2026
495d544
Implement project scene selection
Jul 5, 2026
3b97a53
Implement research paper library
Jul 5, 2026
7e8c157
Implement crawler skill
Jul 5, 2026
8db1e03
Add paper collection workflow
Jul 5, 2026
04c9e8f
Implement paper search and collection split
Jul 6, 2026
331e49d
fix(renderer): align task panel button with file panel toggle button …
Jul 6, 2026
648b214
Update paper collection cache contracts
Jul 6, 2026
cddbcd6
Refine paper search enrichment and skill runtime tests
Jul 6, 2026
955b5cc
Fix paper skill runtime fallback
Jul 6, 2026
54d464f
Add paper reading artifact reuse
Jul 6, 2026
ea65a1a
Remove unused embedding infrastructure
Jul 7, 2026
04c611c
Fix streamed think tag leakage
Jul 7, 2026
9fc5882
Add MiniMax Token Plan AI subscription with Claude-protocol text runt…
Jul 9, 2026
9aff83e
Add Token Plan media tools and always-on text for MiniMax.
Jul 9, 2026
93e8a79
Add Grok and Codex OAuth integrations
Jul 10, 2026
6cb6b6e
Add OAuth media and reasoning controls
Jul 10, 2026
28a03b5
Fix media link DOM nesting
Jul 10, 2026
8521dec
Add typed IPC contract skeleton with knowledge-domain pilot (#115)
Jul 10, 2026
3ae61e3
Migrate db core domain to the typed IPC contract (#116)
Jul 10, 2026
93b2216
Migrate db extended domain to the typed IPC contract (#117)
Jul 10, 2026
ecda009
feat(renderer): improve model selector with Radix UI, provider logos,…
Jul 10, 2026
51e9b60
fix(renderer): conditional trigger onClick handler for test environme…
Jul 10, 2026
21ad5c2
Migrate llm/deepagents domain with dynamic channel factories (#118)
Jul 10, 2026
488876c
Migrate workflow domain to the typed IPC contract (#119)
Jul 10, 2026
d7b06f3
Migrate fs and commands domains to the typed IPC contract (#120)
Jul 10, 2026
34ac4c8
Migrate remaining domains, completing the invoke contract (#121)
Jul 10, 2026
3e0b1cc
Delete the ElectronAPI hand-copy; window is typed from preload (#122)
Jul 10, 2026
d29f93f
Declare @types/react and @types/react-dom as devDependencies
Jul 10, 2026
ba191cb
Fix all 98 pre-existing main-process tsc errors
Jul 10, 2026
7c792a1
Zero out renderer tsc errors and add a typecheck script
Jul 10, 2026
be9f67d
Retire the deprecated db:getSkillVersions channel
Jul 10, 2026
5b4aab7
feat(renderer): refine model selector interactions
Jul 10, 2026
06122eb
feat(renderer): refine workspace entry surfaces
Jul 10, 2026
7fba6ac
Sync dev into refactor/ipc-contract before final merge back
Jul 10, 2026
a250f53
Fix ContextButton active-state assertion to match current styling
Jul 10, 2026
78561ca
Extract shared markdown parts: AlertBlock, CodeBlock, textAlignClass
Jul 10, 2026
2c4182c
Merge remote dev: model selector + sidebar + dashboard + markdown ref…
Jul 11, 2026
69d0be5
docs: redefine the CDF UI system
Jul 11, 2026
9fcf2e0
Introduce typedCrud helper and migrate 4 delete channels (#111 T1)
Jul 11, 2026
f191cb8
Migrate 4 read-only channels to typedCrud (#111 T2)
Jul 11, 2026
b1af8f2
Migrate remaining write/delete channels and retire agentInstances (#1…
Jul 11, 2026
16f803f
Merge refactor/ipc-handlers-layers: typedCrud helper, 11 channels mig…
Jul 11, 2026
d7326be
feat(ui): implement CDF workbench redesign
Jul 11, 2026
7bea312
Address code-review findings on the typedCrud batch (#111)
Jul 11, 2026
d335db9
Runtime Stream Projection: core skeleton + text/reasoning backpressur…
Jul 11, 2026
ff5d397
Runtime Stream Projection: tool calls, delegated tasks, correlation (…
Jul 11, 2026
e89ff76
fix(ui): refine workspace navigation and cards
Jul 11, 2026
1e22ba1
fix(ui): polish interaction and accessibility details
Jul 11, 2026
28f67f0
fix(ui): refine selection and card alignment
Jul 11, 2026
509b866
feat: migrate xAI video generation to background jobs (#124)
Jul 11, 2026
ae68e14
feat: add safe background video job management (#125)
Jul 11, 2026
3c7652b
Runtime Stream Projection: turn-end protocol + shell takeover (#107 S3)
Jul 11, 2026
963f47f
Log cleanup, ADR-0053, CONTEXT.md term (#107 S4)
Jul 11, 2026
0b23b39
Differential flow verification: old vs new byte-identical (#107)
Jul 11, 2026
62a79a5
Sync dev into refactor/runtime-stream-projection before merge back
Jul 11, 2026
142ea65
feat: resume agents for completed background jobs
Jul 11, 2026
1a924d1
test: match model menu width classes exactly
Jul 11, 2026
9182325
feat: add MiniMax Hailuo background video jobs (#127)
Jul 11, 2026
2efbfc3
feat: add xAI first-frame video snapshots (#128)
Jul 11, 2026
934a7d8
docs: define session-hosted workflow model
Jul 11, 2026
cfc2324
feat: add MiniMax first-frame video jobs (#130)
Jul 11, 2026
dcd06b4
feat: finish async video job retention and validation (#129 #131)
Jul 11, 2026
b1d05dd
fix: separate background job delivery and bound task list
Jul 11, 2026
626f34b
revert: keep background job delivery in conversation flow
Jul 11, 2026
5a8ac70
fix(renderer): resolve timeline turn splitting and message folding fo…
Jul 11, 2026
d0233b4
style(renderer): beautify capability job event card and resolve styli…
Jul 11, 2026
ac228c1
style(renderer): refactor capability job event card to enforce max-wi…
Jul 11, 2026
b105990
style(renderer): wrap capability job card in message bubble with robu…
Jul 11, 2026
7cc68eb
style(renderer): remove left border from capability job card as reque…
Jul 11, 2026
13e3c65
style(renderer): beautify media elements by removing container boxes,…
Jul 11, 2026
e99ea3b
style(renderer): remove margin-bottom from FoldedBlockCard to elimina…
Jul 11, 2026
088b15a
style(renderer): streamline capability job card to single status line…
Jul 11, 2026
73dc64a
style(renderer): adjust padding-bottom of capability job notification…
Jul 11, 2026
3fb545c
style(renderer): remove border outline from video element
Jul 11, 2026
1cd5f78
style(renderer): render video using native aspect ratio and remove si…
Jul 11, 2026
f8a1c51
style(renderer): remove table card container borders, box shadows, an…
Jul 11, 2026
0a935bf
style(renderer): implement custom audio player matching desk theme de…
Jul 11, 2026
9a7b4c4
style(renderer): customize audio player range slider WebKit styles fo…
Jul 11, 2026
9e01804
style(renderer): render user message metadata below bubble and place …
Jul 11, 2026
618ca7b
feat: stream background continuations into conversations
Jul 11, 2026
c25de6e
refactor(capabilities): extract shared capability route resolver and …
Jul 11, 2026
55c40eb
fix: keep continuation run identity in projection
Jul 11, 2026
9b35953
fix: preserve background streams across conversation switches
Jul 12, 2026
d488a5f
fix: drop approval gate from parallel workers lacking a checkpointer
Jul 12, 2026
0fa3eb6
fix: make cdf-file media seekable for replay and moov-at-end mp4
Jul 12, 2026
38261bd
style: optimize sidebar layout and scrollbar, hide delete icons and c…
Jul 12, 2026
fd70990
fix: hide scrollbar in slash commands popup and fix list keyboard scr…
Jul 12, 2026
1507ab5
feat: replace workflow graph editor with staged runs
Jul 12, 2026
5567366
fix: keep workflow runs alive on transient stream termination
Jul 12, 2026
f899bc7
fix: stop subagent task failures showing as UNKNOWN terminated
Jul 12, 2026
b6b3838
feat: add Conversation Runtime Registry and fix workflow task projection
Jul 12, 2026
8383dec
fix: enforce Conversation Runtime ownership
Jul 12, 2026
cdfb3f6
test: cover background Conversation ownership
Jul 12, 2026
fe3fafd
feat: protect active Conversations from deletion
Jul 12, 2026
6e88e13
pi-agent: 实现 Registry 剩余迁移
Jul 12, 2026
06c2a44
Merge branch 'pi-agent-8a276c5e-5ad6-46e' into dev
Jul 12, 2026
cb8cb8e
fix: complete runtime reconciliation safeguards
Jul 12, 2026
79d89cc
fix: harden runtime identity reconciliation
Jul 12, 2026
14625b9
style: fix UI container focus ring issues and enhance user chat bubbl…
Jul 12, 2026
215ebcd
style: unify settings headers layout to description-only and upgrade …
Jul 12, 2026
7845e11
refactor: split shared types by domain (#113)
Jul 12, 2026
450b769
style(renderer): simplify and polish SkillAttributionCard UI
Jul 13, 2026
0dcbf8e
style: redesign ContextModal with premium Local Field Desk visual theme
Jul 13, 2026
dd74da2
style: fix warning card Ledger Edge layout crescent shadow rendering bug
Jul 13, 2026
fc85a0d
feat: add first-class delegated agent runs (#146)
Jul 13, 2026
4e70639
feat: route parallel tasks through delegated run coordinator (#147)
Jul 13, 2026
122e3be
feat: complete delegated approvals and workflow routing
Jul 14, 2026
d230a22
fix: persist workflow stage identity (#133)
Jul 14, 2026
148d89d
feat: centralize conversation working state lifecycle (#163)
Jul 14, 2026
35a19d2
fix: clean working state on conversation and project deletion (#164)
Jul 14, 2026
d05bdd6
fix: reconcile orphan working state at startup (#165)
Jul 14, 2026
9993459
test: harden working state cleanup lifecycle (#164 #165)
Jul 14, 2026
7bbb7b4
feat: add working state storage maintenance (#166 #167)
Jul 14, 2026
5fd0bf0
fix: harden working state compaction recovery (#168)
Jul 14, 2026
bcd262e
test: cover interrupted working state rebuilds (#168)
Jul 14, 2026
e142368
fix: restore rollback after interrupted install (#168)
Jul 14, 2026
7c334c6
test: verify rebuild exits mid-vacuum (#168)
Jul 14, 2026
3d9f480
feat: enable storage optimization in system settings (#169)
Jul 14, 2026
bbc24aa
fix: stop storage polling during shutdown (#169)
Jul 14, 2026
199d04a
fix: defer Conversation Working State cleanup
Jul 14, 2026
1867542
feat(renderer): redesign Markdown CodeBlock with syntax highlighting,…
Jul 14, 2026
a87817e
fix(scene): remove heavy focus-visible ring on paper search input
Jul 14, 2026
2b20509
fix(scene): force remove all focus and focus-visible ring styles on p…
Jul 14, 2026
d46106b
style: remove project-wide focus-visible vermillion outlines
Jul 14, 2026
6c41c08
feat(workflow): add placeholder to workflow name input field in Stage…
Jul 14, 2026
5f2d7c3
style(workflow): redesign workflow list cards to optimize layout and …
Jul 14, 2026
d7eadd1
feat(agents): protect project Master Agent (#171)
Jul 14, 2026
99e4da2
feat(agents): snapshot Master scene prompts (#172)
Jul 14, 2026
24bec6f
feat(workflow): bind runs to Project Master (#173)
Jul 14, 2026
9e3a85b
feat(skills): add Scene exposure registry (#174)
Jul 14, 2026
9cc4fa5
feat(skills): apply Global Scene exposure (#175)
Jul 14, 2026
a717546
feat(conversation): snapshot Skill catalogs (#176)
Jul 14, 2026
b9f01fa
feat(skills): remove override behavior (#177)
Jul 15, 2026
f2672e9
pi-agent: 收口技能覆盖重构
Jul 15, 2026
2ec60a7
fix(skills): complete #178 override removal regressions
Jul 15, 2026
c62c8d5
fix(skills): restore #178 type safety
Jul 15, 2026
0a99951
fix: close #170 runtime snapshot gaps
Jul 15, 2026
98913bf
fix(runtime): preserve Master provider fallback (#170)
Jul 15, 2026
e84f315
fix: complete #170 final review repairs
Jul 15, 2026
9480c4e
fix: address #170 final review findings
Jul 15, 2026
597536d
fix: align legacy conversations with Master (#170)
Jul 15, 2026
c7e2526
fix(renderer): refine paper library interactions
Jul 15, 2026
b130094
feat(skills): add Manuscript Review Skill (#179)
Jul 15, 2026
cfa20b0
feat(skills): add Academic Style Revision Skill (#180)
Jul 15, 2026
45cb741
feat(research): integrate Research Workflow Skills (#181)
Jul 15, 2026
9de9269
fix(research): address #34 review findings
Jul 15, 2026
961b360
fix(skills): make static materialization concurrency-safe (#179)
Jul 15, 2026
dd2da24
fix(skills): publish immutable research Skill packages (#179)
Jul 15, 2026
009f42d
docs: record domain and architecture decisions
Jul 15, 2026
f6e1444
Stop tracking docs/ and keep it local-only.
Jul 15, 2026
526a1a9
feat(agents): establish global agent catalog (#183)
Jul 15, 2026
09cff43
feat(agents): complete global library runtime (#184-#190)
Jul 16, 2026
9e7d248
fix(agents): address global library review findings
Jul 16, 2026
ab82821
fix(agents): localize catalog operation failures
Jul 16, 2026
9f677ef
fix(agents): isolate prompt loading state
Jul 16, 2026
d5a0b40
feat(file-panel): edit Excalidraw diagrams (#191)
Jul 18, 2026
7e04501
fix(chat): address hydration error and enable image zoom for assistan…
Jul 19, 2026
19ffdb8
feat(flow-diagrams): add Agent editing and artifacts (#192-#196)
Jul 19, 2026
765cbda
fix(flow-diagrams): address safety and refresh review findings
Jul 19, 2026
48c417e
fix(flow-diagrams): coordinate autosave and official export
Jul 19, 2026
3e07a8b
fix(flow-diagrams): preserve concurrent editor changes
Jul 19, 2026
6b1aa48
fix(flow-diagrams): isolate unresolved editor conflicts
Jul 19, 2026
58eaa51
fix(flow-diagrams): block navigation during reload conflicts
Jul 19, 2026
1cc583e
fix(flow-diagrams): preserve external source mutations
Jul 19, 2026
7f0f773
fix(flow-diagrams): make source replacement compare-and-swap
Jul 19, 2026
fd0d731
fix(flow-diagrams): keep replacement publication atomic
Jul 19, 2026
a73bed3
fix(file-panel): restore Excalidraw resize and icon
Jul 19, 2026
b13381e
fix(flow-diagrams): harden revisions and rollback
Jul 19, 2026
281355b
test: invoke esbuild cross-platform
Jul 19, 2026
2f5af00
fix: ensure workflow runs select a default model
Jul 19, 2026
74d8565
fix: align agent model selection with conversations
Jul 19, 2026
9ea7c80
fix(workflow): expose run model failures and selection
Jul 19, 2026
8ba5d5a
fix(workflow): recover interrupted conversation runs
Jul 19, 2026
db4c4fc
docs: remove obsolete root research notes
Jul 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ out/
# electron-vite
*.local

# Generated Excalidraw self-hosted assets
src/renderer/public/excalidraw-assets/

# OS
.DS_Store
Thumbs.db
Expand All @@ -44,10 +47,16 @@ electron-log-*
# Local assistant and project planning state
.antigravitycli/
.claude/
.codex/
.agents/
.pi/
.planning/
.github/skills/
.impeccable/
.impeccable-ref/

# Local domain docs / research / spikes (not pushed to remote)
docs/

# TypeScript cache
*.tsbuildinfo
Expand Down
155 changes: 155 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# AGENTS.md

本文件是给 Codex、Claude、Cursor 等代码代理使用的项目工作指南。请优先遵守本文件;更细的项目说明和设计约定分别参考 `README.md`、`DESIGN.md`。`Claude.md` 仅作为指向本文件的兼容入口,不承载额外规则。

## 沟通与工作原则

- 必须使用中文与用户沟通。
- 先读代码和现有文档,再修改。不要凭记忆假设项目结构、命令或 API。
- 只做用户请求范围内的修改。不要顺手重构、改格式、清理无关代码或调整无关文档。
- 优先采用现有模式、组件、store、IPC 结构和测试风格;不要为了单次需求引入新抽象。
- 修改前明确目标和验证方式;修改后运行与变更范围匹配的测试或构建。
- 工作流应与变更风险匹配:简单局部修复遵循“定位、可重复验证、最小改动、定向验证”的最小闭环;不要为了流程增加无关分解、重复审查或大范围验证。
- 工作区可能已有用户改动。不要回滚、覆盖或整理非本次任务产生的改动。
- `.codex/`、`.planning/` 等本地代理/规划状态目录不再纳入版本控制;不要主动重新添加或提交这些目录。

## 项目定位

CDF 是一个离线优先的 Electron 桌面端 Agent 工作站,不是普通聊天页。用户在本地组织任务、上下文、Agent、能力、工作流、过程和产物。

核心技术栈:

- Electron + electron-vite
- React 19 + TypeScript + Vite
- Tailwind CSS v4 + Radix UI + Lucide React
- Zustand
- React Flow / `@xyflow/react`
- LangChain、LangGraph、deepagents、MCP adapter
- `better-sqlite3`、`electron-store`
- Vitest 4 + Testing Library

## 目录约定

- `src/main/`:Electron 主进程、IPC、数据库、LLM、deepagent、工作流运行时。
- `src/preload/`:`contextBridge` 预加载脚本。渲染进程能力必须从这里安全暴露。
- `src/renderer/src/`:React 渲染进程、组件、hooks、stores、样式和 i18n。
- `src/shared/`:主进程与渲染进程共享类型和常量。
- `resources/`:应用资源。
- `patches/`:`patch-package` 补丁。
- `scripts/`:项目脚本。

## 常用命令

使用 `pnpm`,不要切换到 npm/yarn。项目要求 Node.js `>=22`,包管理器为 `pnpm@11.5.1`。

```bash
pnpm install
pnpm run dev:electron
pnpm run dev
pnpm test
pnpm run test:watch
pnpm run build
pnpm run preview
```

命令说明:

- `pnpm run dev:electron`:推荐的开发启动命令,会先把 `better-sqlite3` rebuild 到 Electron ABI。
- `pnpm run dev`:更快,但要求原生模块已经是 Electron ABI。
- `pnpm test`:全量 Vitest,`pretest` 会把 `better-sqlite3` rebuild 到 Node ABI。
- 跑过 `pnpm test` 后,如需启动应用,优先使用 `pnpm run dev:electron`,避免 ABI 不匹配。
- 单测可按文件或名称过滤,例如 `pnpm test src/main/deepagent/agent-tools.test.ts` 或 `pnpm test -t "case name"`。

## 代码风格

- TypeScript 使用严格模式;保持类型边界清晰,避免无意义的 `any`。
- 遵循当前文件风格。仓库中部分文件使用分号,部分文件不使用;编辑时以局部文件风格为准。
- 优先使用命名清晰的小函数;只有在能减少真实复杂度时才新增抽象。
- 主进程可使用 Node API;渲染进程不要直接使用 Node/Electron 能力。
- 共享跨进程类型放在 `src/shared/`,不要在 renderer 和 main 之间复制类型定义。
- 日志沿用现有 `src/main/logger.ts` 模式;不要用大量临时 `console.log` 留在主进程代码中。
- i18n 文案需同步维护 `src/renderer/src/i18n/locales/en-US.json` 与 `zh-CN.json`,不要只改一种语言。

## Electron 与安全边界

- 保持 `contextIsolation: true`,保持 `nodeIntegration: false`。
- 渲染进程需要主进程能力时,通过 `src/preload/index.ts` 和 IPC 暴露最小 API。
- 不要引入 `remote` 模块或同步 IPC。
- 文件系统、shell、MCP、网络和模型调用等高权限能力应留在 `src/main/`。
- 离线优先是产品约束。新增功能默认本地存储、可本地运行;外部网络依赖必须是显式、可配置、可失败降级的。

## 前端与设计约定

- 遵守 `DESIGN.md`:CDF 是工作站界面,不是 SaaS dashboard、聊天气泡页或 hero landing。
- 使用现有设计 token:`--bg-*`、`--text-*`、`--accent`、`--border`、`--block-*` 等。
- Light 主题是奶白画布 + 粉彩 color block + single-shot magenta accent;Dark 主题是冷黑画布 + violet accent。
- 不要随意新增颜色、阴影体系或装饰性渐变。色彩用于焦点、状态、协作和风险信号。
- UI 组件优先复用 `src/renderer/src/components/ui/`、Radix、Lucide React 和现有组件模式。
- 图标按钮优先使用 `lucide-react`;复杂交互要有可访问的 label/title。
- 保持桌面生产力工具的信息密度和稳定布局,避免营销页式大卡片堆叠。

## 状态、数据与工作流

- 渲染进程全局状态优先使用已有 Zustand store。
- SQLite 和长期本地数据逻辑放在主进程,避免 renderer 直接持久化关键业务数据。
- 工作流相关代码集中在 `src/main/workflow/` 和 `src/renderer/src/components/WorkflowEditor/`。
- deepagent 相关代码集中在 `src/main/deepagent/`;修改 provider、tool、runtime 行为时必须检查相邻测试。

## 测试策略

- 测试文件与源码同目录,使用 `.test.ts` 或 `.test.tsx`。
- `src/main/**/*.test.ts` 在 node 环境运行,可 mock Electron、访问 Node API 和 `better-sqlite3`。
- `src/renderer/**/*.test.{ts,tsx}` 在 jsdom 环境运行,使用 Testing Library。
- 组件测试优先验证用户可见行为,不要过度绑定 DOM 内部结构。
- 修 bug 时优先补一个能失败的回归测试,再修到通过。
- 修改 IPC、数据库、deepagent、工作流运行时或共享类型时,至少跑相关单测;影响面不清时跑 `pnpm test`。
- 交付前如条件允许跑 `pnpm run build`,尤其是改到 Electron/Vite 配置、preload、共享类型或跨进程调用时。

## 原生模块 ABI 注意事项

本项目依赖 `better-sqlite3`。Node.js 测试环境和 Electron 运行环境需要不同 ABI:

- `pnpm test` 前的 `pretest` 会 rebuild 到 Node ABI。
- `pnpm run dev:electron` 和 `postinstall` 会 rebuild 到 Electron ABI。
- 如果测试后开发启动失败,先运行 `pnpm run dev:electron`,不要手动替换依赖或删除 lockfile。

## 依赖与配置

- 不要手动编辑 `pnpm-lock.yaml`,除非确实变更依赖并通过 `pnpm install` 更新。
- 不要移除 `patches/` 中的补丁,除非已经验证上游依赖不再需要。
- 不要提交本地代理状态目录,例如 `.codex/`、`.claude/`、`.agents/`、`.planning/`、`.pi/`、`.impeccable/`。
- 修改 `electron.vite.config.ts`、`vitest.config.ts` 或 TypeScript 配置时,要同步考虑 main、preload、renderer 三个构建目标。
- Renderer alias:
- `@` 指向 `src/renderer/src`
- `@shared` 指向 `src/shared`

## 版本与发布

项目存在两套版本号,不要混用:

- 产品发布版本:以 git tag 为准,例如 `v0.1.x`,只在 `master` 分支打 annotated tag。

除非用户明确要求,不要 bump `package.json` 的 `version`,不要创建 commit、branch、tag 或 release。

## 提交前检查清单

- 变更是否严格对应用户请求?
- 是否保留了用户已有未提交改动?
- 是否遵守 Electron 安全边界和离线优先约束?
- 是否同步了中英文 i18n 文案?
- 是否为新增或修复行为补了必要测试?
- 是否运行了最小必要验证命令,并在最终回复中说明结果?

## Agent skills

### Issue tracker

Issues 追踪在 GitHub Issues(仓库 suntianc/CDF),外部 PR 不纳入分诊。详见 `docs/agents/issue-tracker.md`。

### Triage labels

使用默认标签词汇(needs-triage / needs-info / ready-for-agent / ready-for-human / wontfix)。详见 `docs/agents/triage-labels.md`。

### Domain docs

单一上下文布局——根目录一个 `CONTEXT.md` + `docs/adr/`。详见 `docs/agents/domain.md`。
Loading
Loading