CharDesk Docs

Ownership and Dependency Direction

Layer responsibility and allowed dependency edges.

HEAD a63778e
Read this page whenYou need to decide whether a dependency or responsibility crosses an allowed layer.
First answerDependency direction is shared <- domains <- widgets <- app; each layer owns a distinct contract.
BoundaryThis page owns dependency direction; behavior remains owned by the relevant domain or package authority.
Follow-upOpen the owning public.ts and the boundary guard named below.
shared <- domains <- widgets <- app
LayerOwnsBoundary
sharedDomain-neutral primitivesDepends only on shared and external packages
domainsBusiness rules and stateCross-domain access uses the owning domain's public.ts
widgetsProduct interaction and presentationCoordinates public contracts; owns no domain validation or persistence
appComposition and application lifecycleConstructs runtimes and application-wide side effects

Shared editor dependencies:

Web Host ─┐
      ├→ editor-input → editor-core → cell-plane → cell-core / protocol
Terminal Host ─┘   └→ @opentui/keymap

editor-core owns the runtime framework, interaction/clipboard workflows and document/history contracts. Hosts own native input, rendering and platform IO; shared packages cannot import Host internals. Follow the shared API and verification map and terminal Host contract.

editor-input owns the keymap integration: Host attachment lifetime, effective binding layers, command forwarding and input guards. OpenTUI owns terminal parsing and capability negotiation; @opentui/keymap owns runtime matching, precedence and sequences. editor-core retains the binding catalog and editing commands. Web and Terminal renderers still consume the shared core directly.

A domain reads its own source directly. Its public.ts contains explicit named re-exports only; composition belongs in src/app. Production cross-domain imports use the owner's public.ts; tests may use its /testing entry when present.

Use domain reference to select the business owner. The boundary check enforces layer and import direction; the state ownership check guards Canvas stores, content projection, and Yjs mutation.

Shared creation capabilities are owned by editor-core/drawing, character-library and canvas-templates. Web and Terminal adapt input, resource loading and presentation; shared creation packages have no application, React, DOM or filesystem dependency. Character insertion and template placement commit through Canvas document commands.