mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-07-03 12:27:41 +08:00
`LifecycleManager.allReady()` was holding `await Promise.allSettled(_doAllReady)`,
making every `onAllReady` body a synchronous bootstrap dependency. This
contradicted the hook's JSDoc ("post-bootstrap supplement, not a critical
initialization gate") and gave any in-hook deferred work an oversize blast
radius — a 60 s wait inside one service stalled `ALL_SERVICES_READY` and
delayed bootstrap completion.
Align the implementation with the JSDoc:
- `allReady()` becomes `void`. It synchronously invokes every initialized
service's `_doAllReady()`, attaches an async `.catch` that re-emits
`SERVICE_ERROR`, then emits `ALL_SERVICES_READY` immediately.
- `Application.bootstrap()` drops its `await` on `allReady()`.
- `LifecycleManager` tests adjusted: drop redundant `await`s, rewrite
`resolves.toBeUndefined()` as `not.toThrow()`, drain microtasks before
asserting on the now-async `SERVICE_ERROR` emit, and add a test
exercising the fire-and-forget contract with a never-resolving hook.
`ALL_SERVICES_READY` now fires when hooks are *invoked*, not when they
complete. Docs reflect the contract change: a "Hook vs Event" comparison
in `lifecycle-overview.md`, two new Common Mistakes in
`lifecycle-decision-guide.md`, and an `onAllReady` business-work pattern
template in `lifecycle-usage.md` showing the \`setTimeout\` + signal +
\`onStop\` join model used by JobManager.
Cherry Studio Documentation
Guides
| Document | Description |
|---|---|
| Development Setup | Development environment setup |
| Contributing | How to contribute code |
| Branching Strategy | Git branching workflow |
| Test Plan | Test plan and release channels |
| i18n Guide | Internationalization guide |
| Logging Guide | How to use the logger service |
| Middleware | How to write AI Provider middleware |
References
Architecture
| Document | Description |
|---|---|
| Architecture Overview | System-wide architecture, process model, data flow |
AI Core
| Document | Description |
|---|---|
| AI Core Architecture | Complete data flow and architecture from user input to LLM response |
Data System
| Document | Description |
|---|---|
| Data System Overview | System selection, architecture, and patterns |
| Boot Config Overview | Early boot configuration system |
| Boot Config Schema Guide | Adding new boot config keys |
| Cache Overview | Three-tier caching architecture and design invariants |
| Cache Usage | useCache hooks, direct API, Main-process subscriptions |
| Cache Schema Guide | Adding new cache keys (fixed and template) |
| Preference Overview | User settings management |
| Preference Usage | usePreference hook examples |
| Preference Schema Guide | Adding new preference keys |
| DataApi Overview | Business data API architecture |
| DataApi in Renderer | useQuery/useMutation patterns |
| DataApi in Main | Handlers, Services, Repositories |
| API Design Guidelines | RESTful design rules |
| API Types | API type system, schemas, error handling |
| Database Patterns | DB naming, schema patterns |
| Layered Preset Pattern | Presets with user overrides |
| V2 Migration Guide | Migration system |
Lifecycle System
| Document | Description |
|---|---|
| Lifecycle Overview | Architecture, decision guides, usage |
| Application Overview | Application bootstrap and shutdown |
| Lifecycle Internals | Phases, hooks, states |
| Lifecycle Usage | Full usage guide with examples |
| Lifecycle Decision Guide | Lifecycle vs singleton decision |
| Lifecycle Migration Guide | Migrating old services |
Messaging
| Document | Description |
|---|---|
| Message System | Message lifecycle, state management, operations |
Knowledge
| Document | Description |
|---|---|
| KnowledgeService | Concurrency control and workload management |
CherryClaw (Autonomous Agent)
| Document | Description |
|---|---|
| CherryClaw Overview | Architecture, memory system, API |
| Channel System | IM integration (Telegram, etc.) |
| Claw MCP Server | Built-in MCP tools (cron, notify, skills, memory) |
| Scheduler | Task-based polling scheduler |
Components
| Document | Description |
|---|---|
| CodeBlockView | Code block view component |
| Image Preview | Image preview components |
| Code Execution | Python code execution via Pyodide |
Other
| Document | Description |
|---|---|
| App Upgrade Config | Application upgrade configuration |
| Feishu Notify | Feishu notification integration |
| Fuzzy Search | Fuzzy search implementation |
| LAN Transfer Protocol | LAN file transfer protocol spec |