This package is the local desktop agent daemon. It owns durable agent identity, execution profiles, routing, context admission, run/attempt state, physical-tool authorization, and the cross-surface conversation journal. Swift is a transport and presentation client; adapters execute model work but do not own policy.
Swift desktop client
<-> protocol.ts / index.ts (versioned JSONL transport)
-> runtime/kernel.ts (public kernel facade)
-> kernel-{core,sessions,runs,coordinator,artifacts}.ts
-> desktop-intent-router.ts
-> external-surface-tool-policy.ts
-> context-snapshot.ts
-> session-execution-profile.ts
-> conversation-journal.ts
-> run-tool-capability.ts -> tool-invocation-ledger.ts
-> sqlite-store.ts (durable state)
-> adapters/* (model-provider execution only)
-> omi-tools-{stdio,http}.ts (generated physical-tool surfaces)
protocol.tsdefines every message crossing the Swift/Node boundary. New authority-bearing operations must be typed here and correlated to their persisted owner, session, run, attempt, and claim generation where applicable.index.tsvalidates transport envelopes and connects physical I/O to kernel operations. It must not reimplement routing, profile, journal, or capability policy.runtime/kernel.tsis the public facade. Its splitkernel-*modules contain the implementation domains and may share the narrow types inkernel-types.ts.desktop-intent-router.tsis the sole semantic route decision owner. Callers use atomic route-and-apply operations rather than reproducing policy.external-surface-tool-policy.tsimplements a kernel-owned proposal policy invoked by the atomic route/relay path for every surface. It may recover a malformed permission proposal into the native tool or reject an external-app target, and it gates pill visibility against the persisted user prompt. Swift and provider prompts never reimplement this decision.session-execution-profile.tsowns immutable, generation-fenced session profiles. Preference changes affect future sessions only unless an explicit migration succeeds.context-snapshot.tsowns versioned context source selection, admission, and rendering. Surface policy and tool capability fingerprints are distinct from the shared base-content version.conversation-journal.tsis the sole durable conversation writer.backend-turn-projection.tsis the shared canonical backend payload/hash projection used by normal writes and startup repair. Backend synchronization and deletion use owner-scoped outboxes; Swift performs physical HTTP only and returns exact claim receipts. Clear advances the journal generation, invalidates remote reconciliation, preserves only the identity of already-delivering POST claims, and gates both remote reads and new-generation POSTs until the backend DELETE is acknowledged.run-tool-capability.tsandtool-invocation-ledger.tsjointly authorize and record physical effects. Request IDs are tracing keys, never authorization.sqlite-store.tsowns schema creation, migrations, startup reconciliation, and transactions. Other modules do not issue lifecycle-altering schema DDL.adapters/*translate a pinned run into provider calls. They cannot choose a different provider, mutate a session profile, or directly execute desktop effects.artifact-storage.tsowns per-run managed artifact directories. Every leaf attempt receives that directory as both its adapter cwd and MCP workspace; delegated objectives and raw control-tool cwd values cannot default a deliverable to Desktop. Explicit external-delivery reports remain a narrow compatibility import path and are copied into the managed directory.- Generated tool manifests and Swift executors are updated together through
../scripts/generate-tool-surfaces.mjs; hand-edited capability mirrors are prohibited.
When a change crosses an ownership boundary, add a behavioral contract test at that boundary. Protocol changes require Swift and Node decode tests. Durable changes require restart/idempotency tests. Provider or mode fallback paths must use the repository's bounded fallback telemetry contract.