acp-runtime
AgentThe ACP runtime is the domain service that serves the ACP API contract. It owns the host-scoped dependencies needed to run…
Each domain exposes a Wire contract in `src/core/features/<domain>/api/` and a controller in `src/core/features/<domain>/node/`:
Each domain exposes a Wire contract in `src/core/features/<domain>/api/` and a controller in `src/core/features/<domain>/node/`:
// src/core/features/tasks/node/wire-controller.ts
export function createTasksWireController(): Controller {
return createController(tasksWireContract, {
createTask: (input) => taskOperations.createTask(input),
events: taskEvents,
});
}Contracts are assembled in `src/core/manifests/shared/desktop-wire-contract.ts`; controllers are served by `src/main/gateway/desktop-wire.ts`.
**Rules:**
Construct stateful services explicitly at the bootstrap composition root:
export type AppServiceDeps = {
db: AppDb;
};
export class AppService {
constructor(private readonly deps: AppServiceDeps) {}
private cache = new Map();
async initialize() { /* ... */ }
async doSomething(id: string) { /* ... */ }
}
export function createAppService(deps: AppServiceDeps): AppService {
return new AppService(deps);
}**Rules:**
service scope or shutdown coordinator.
Portable schema and database types live in `src/core/services/app-db/node/`. Main constructs the native Drizzle client during the database boot phase.
time; never call `getAppDb()` at module scope.
For domain logic with multiple backends (local vs SSH):
src/main/core/projects/ ├── project-provider.ts # Interface ├── impl/ │ ├── local-project-provider.ts │ └── _ssh-project-provider.ts # Prefixed with _ = not yet implemented └── project-manager.ts # Orchestrates providers
Used in: projects, filesystem (`local-fs.ts` / `ssh-fs.ts`), terminals (`local-terminal-provider.ts` / `ssh-terminal-provider.ts`)
Explicit error handling via discriminated union:
import { ok, err, type Result } from '../lib/result';
async function doSomething(): Promise<Result<Data, SomeError>> {
if (problem) return err({ type: 'not_found' as const });
return ok(data);
}**Rules:**
Use Wire event-stream hosts for main-to-renderer notifications:
export const taskEvents = createEventStreamHost(tasksWireContract.events);
taskEvents.emit(undefined, { type: 'created', task });Event definitions belong to the owning slice's portable API. Use live models for replicated state and live jobs for cancellable long-running work.
Run background commands through the shared launchers: `createBoundExec` / `NodeExecutionContext` (`packages/core/src/services/exec/api/`) or a direct `child_process` call that plans the command with `planExecutableLaunch` (`packages/core/src/primitives/exec/node/`).
**Rules:**
console program (git, `where`, cmd.exe running a `.cmd` shim) spawned without it gets its own console window, which Windows 11 shows as a Windows Terminal tab.
hiding also applies to the launched app's first window.
Emdash is the Open-Source Agentic Development Environment (🧡 YC W26). Run multiple coding agents in parallel. Use any provider.
The ACP runtime is the domain service that serves the ACP API contract. It owns the host-scoped dependencies needed to run…
This page defines the target organization of `packages/core/src/`. Core is organized by module type so that shared domain APIs…
Git is split into a transport contract and a host-scoped runtime. Renderer, desktop, and workspace-server code share the Wire…
The main process is organized into domain modules under `src/main/core/`. Each domain typically has a `controller.ts` (RPC…
`@emdash/core/primitives/path/api` is the source of truth for portable file identity and lexical path operations. The detailed…
Validates project structure against co-location and architecture patterns defined in AGENTS.md
Deprecated placeholder. Do not use; follow root AGENTS.md and package instructions instead.
Use this agent when you need to create or update technical documentation that helps developers understand the deep patterns,…
Orchestration patterns learned from experience. Review at startup and before heartbeat responses.