@maka/runtime is Maka's pure-Node agent runtime. It owns model/backend execution, session sandbox-boundary control flow, event projection, context handling, recovery, and sandbox-aware workspace execution. Product shells compose it; they do not reimplement its loop.
The package root barrel and the subpaths declared in package.json are supported public APIs. Do not import undeclared internal source paths from another package. The main integration points are:
SessionManagerfor session and turn orchestration.BackendRegistryandAgentBackendfor backend selection.AiSdkBackendfor the shipped backend implementation.FakeBackendis test-only: it lives undertest-only/, is exported as@maka/runtime/test-only/fake-backend, and release packaging drops that directory, so no production module may import it. Tests and the Desktop E2E run reach it through the composition'sprimaryBackendFactoryseam.- Session execution-boundary APIs for managed sandbox expansion and explicit bypass.
buildBuiltinTools()and the workspace executor interfaces for tool composition.RuntimeKernel, runtime events, projections, and recovery helpers for execution lifecycle.
Desktop composition lives in apps/desktop/src/main/main.ts. Other clients execute Maka through Runtime Host rather than composing Runtime directly.
- Add backend behavior behind
AgentBackendand register it through the existing registry. - Add tools through the builtin/tool composition seams; keep filesystem and shell effects behind
WorkspaceExecutor. - Put shared pure contracts in
packages/coreand interactive Runtime state in the SQLite control plane owned bypackages/storage. - Expose supported package APIs through the root barrel or a declared
package.jsonsubpath rather than importing internal files from another package. - Keep provider credentials and Electron IPC outside this package. The product shell resolves credentials and passes only the dependencies required for execution.
For the system-level model and code-reading map, start with the root ARCHITECTURE.md. Sandbox-specific contracts live in src/sandbox/README.md.