Skip to main content

Morphir Daemon

The Morphir Daemon is a long-running service that manages workspaces, projects, builds, and provides IDE integration.

Tracking​

TypeReferences
Beadsmorphir-l75 (caching), morphir-n6b (analyzer), morphir-369 (SQLite VFS)
GitHub Issues#392 (pipeline types), #393 (diagnostics), #394 (JSON output), #400 (analyzer), #401 (caching)
Discussions#88 (package manager)

Overview​

The daemon provides:

  • Workspace Management: Multi-project development with shared dependencies
  • Build Orchestration: Coordinated builds in dependency order
  • File Watching: Automatic recompilation on source changes
  • IDE Integration: Language server protocol support
  • Package Publishing: Pack and publish to registries

Documents​

DocumentStatusDescription
LifecycleDraftWorkspace creation, opening, closing
ProjectsDraftProject management within a workspace
DependenciesDraftDependency resolution and caching
BuildDraftBuild orchestration and diagnostics
WatchingDraftFile system watching for incremental builds
PackagesDraftPackage format, registry backends, publishing
ConfigurationDraftmorphir.toml system overview
Workspace ConfigDraftMulti-project workspace configuration
CLI InteractionDraftCLI-daemon communication and lifecycle

Architecture​

workspace-root/
├── morphir.toml # Workspace configuration
├── .morphir/ # Workspace-level cache and state
│ ├── deps/ # Resolved dependencies (shared)
│ └── cache/ # Build cache
├── packages/
│ ├── core/ # Project: my-org/core
│ │ ├── morphir.toml
│ │ └── src/
│ ├── domain/ # Project: my-org/domain
│ │ ├── morphir.toml
│ │ └── src/
│ └── api/ # Project: my-org/api
│ ├── morphir.toml
│ └── src/

Key Concepts​

Workspace vs Project​

ConceptScopeConfiguration
WorkspaceMultiple projectsmorphir.toml with [workspace] section
ProjectSingle packagemorphir.toml with [project] section

Both use the same morphir.toml file format. The presence of [workspace] section enables workspace mode.

Workspace States​

StateDescription
closedWorkspace is not active
initializingWorkspace is being loaded
openWorkspace is ready for operations
errorWorkspace has unrecoverable errors

Project States​

StateDescription
unloadedProject metadata loaded, IR not compiled
loadingProject is being compiled
readyProject IR is loaded and valid
staleSource files changed, needs recompilation
errorProject has compilation errors

JSON-RPC Protocol​

Daemon operations are exposed via JSON-RPC for client communication:

workspace/create, workspace/open, workspace/close
workspace/addProject, workspace/removeProject, workspace/listProjects
workspace/buildAll, workspace/clean, workspace/watch
daemon/health, daemon/capabilities

See CLI Interaction for connection modes, transport options, and CLI-to-daemon communication details. See IR v4 for full protocol and type specifications.

CLI Commands​

morphir workspace init # Create new workspace
morphir workspace add <path> # Add project to workspace
morphir workspace build # Build all projects
morphir workspace watch # Watch and rebuild on changes
morphir pack # Create distributable package
morphir publish # Publish to registry

Design Principles​

  1. Lazy Loading: Projects are not compiled until explicitly needed
  2. Incremental: Only recompile what changed
  3. Shared Resolution: Dependencies resolved once at workspace level
  4. Isolation: Project failures don't break the workspace
  5. Observable: Rich state and diagnostic information
  • IR v4 - Intermediate representation format
  • Extensions - MEP runtimes and verified installation