Architecture end state

Accepted implementation target for phux-33bjb, not shipped behavior. Wave 0 specifies the destination; waves 1–7 materialize it. Current contracts remain in architecture, decisions, organization, organization store, embedding and scripting. Deliberate changes are labelled below. Qualification supplies the required consumer-visible proof.

The destination is host-authoritative resources, operation-owned transitions, truthful evidence, generation-owned live state, portable client decisions and platform-owned execution/presentation. Wire, JSON, binding and storage are independent projections; bounded native terminal data stays direct.

Logical modules, not one crate/thread/actor per noun. Retain correct code; delete replaced policy. Counts are leads, not defects.

Constraints that remain true

  • Serving host authorizes under current policy; client admission is usability. Connection revocation does not itself terminate existing execution.
  • Database commit cannot atomically commit arbitrary OS effects. Missing evidence stays unknown; missing receipts/process identity never authorize another launch.
  • Durable keys, allocation instances, activations, host incarnations, connection/ link epochs, stream/bootstrap generations and views are different lifetimes.
  • Preserve exact atomic affected-set/current-grant checks, child-first closure, arrangement locks/session-kill override/protected Intake, commit-before-effects/ publication, bounded receipts, stale-writer fencing, hot/cold restart distinction and pure domain/engine seams. Preserve session-kill’s proven exceptional ordering.
  • One transaction authority can serialize cross-table facts without separate locks. libghostty’s !Send state stays engine-thread-owned: no avoidable allocations, copies, hops or round trips. Preserve batching/borrowing and backpressure.
  • Clients vary scheduling/painting, not equivalent intent policy. Work/organization retain separate authorities: no global transaction or universal event bus.
  • Independent releases, wire 1.x compatibility, frozen stored/upgrade formats remain obligations, not waived by a future major.

Operation meanings

Normative destination meanings, not proposed runtime types/wire commands. “Commit” includes transition, retained receipt and journal position before effects/ publication. Exact execution means authority/resource key/activation, plus applicable live incarnation/allocation fences. Receipts are bounded, not perpetual exactly-once.

MeaningAuthorityExact identity and lifetimeLinearization pointObservable outcome and uncertainty
createHost current create/organize and kind admissionNew durable resource, placement, operation id and initial activationMembership/placement/launch-intent commit before engine constructionCommitted intent is not start/success. Failure stays inspectable; lost reply requires retained receipt/state reconciliation, not another create.
ensure-sessionHost resolves existence; shared client intentAuthority-scoped selector resolves durable session key; creation retains operation idSerialized existing-session resolution or atomic create commitReport existing/created and exact key; resource launch is a separate stage. Never queue creation while reporting unavailable.
select-viewLocal view ownerView id and current resource/stream generation; view lifetimeMatching live view’s local selection updateNo membership, attach or execution change; stale view is unavailable, not implicit create/kill.
attachHost current watch/stream grantExact session/resource plus connection, attachment and stream/bootstrap generationInstallation of admitted generation-owned interestAdmission is not bootstrap/presentation. Disconnect retires interest, not execution/history; stale completions cannot reinstall it.
raw-inputHost current input grant/lease; client readiness/order gateLive execution, incarnation, attachment/input generation; no durable receiptLocal queue acceptance only; host/PTY effect is separateRefused/unavailable versus queued; queue is not admission/delivery/read/success. Loss may leave unknown delivery: never blindly resend.
acknowledged-pasteHost input grant/lease/trust; portable delivery selectionOriginal input operation scoped to server incarnation/execution; terminal ordering fenceServer acknowledged-input admission and subsequent delivery settlement, not client enqueueRefused/not applied, acknowledged delivery and unknown differ; reconcile original identity. User/untrusted, size and peer/satellite fallback remain explicit; raw cannot overtake unresolved input.
close-viewLocal view and subscription ownersExact view and its generation-owned stream interestView retirement and fenced interest releaseRetire callbacks/interest, not execution. Failed-create compensation must explicitly cancel the exact created activation.
terminateHost current grant and exact affected setExact execution, applicable live handle/incarnation/instance fencesDurable termination admission before cancellation/effect handoffAccepted is not observed end. Reconcile lost reply; never retarget replacement activation. Plan descendants and close child-first.
purgeHost removal authority/lifecycle rulesDurable resource and required activation/revision fences, bound descendantsDurable removal/retirement commit before publicationRefuse unsafe removal of possibly live execution. After teardown retain pending retirement until settled; preserve retained outcomes until permitted purge/expiry.
session-killHost session authority; lock override, protected IntakeDurable session, operation id, atomically resolved members/descendantsDurable commit under affected-set serialization before teardownCommit precedes child-first close/suppression/mirror/effect/publication. Replay never recloses; no partial host-local admission. Cross-host outcomes remain independent.
restoreImport inert; host current execution authorizationArchive provenance; new exact creation/activation, never old PTYImport commit distinct from authorized execution-intent commitImport/readiness/admission/execution differ. Current trusted integration or exact raw-recipe approval; readiness failure does not prove nonexecution.
relaunchHost current launch/lifecycle policyExisting durable resource, expected activation/revision, new operation/activationAuthorized new-intent commit after old execution eligible and conflicting engine releasedNo automatic ambiguous retry/reused-PID adoption. Intent differs from start/end; resume tokens are data, not executable authority.

Only an exact, visible, unclipped presentation receipt may clear matching input uncertainty: connection epoch, resource/stream generation, frame and delivery fence must still match. Acquisition/build/paint is not presentation; an old receipt cannot clear a newer fence. The uncertainty remains terminal-wide even when a particular view presents it.

Criticism ledger and required disposition

Source-proven means the linked source/docs establish a structure or behavior, not that an adversarial scenario was executed. Inferred names a risk requiring qualification, not a demonstrated exploit. Policy identifies a deliberate behavioral decision, not an accidental implementation cleanup. Earlier diagnostic SCC/count reports are investigation leads; they are not current measured facts.

  1. Physical decomposition is not semantic decomposition. Source-proven: RemoteAttach carries recording specification across workflows, not proof of a defect/current SCC. Required: cohesive clusters, directed/justified cross-owner contracts; private cycles may remain. Reduce caller knowledge, not file size.
  2. Storage ownership is not operation ownership. Source-proven: contexts expose shared state; session_kill coordinates persist/suppress/close/mirror/effect/announce. Preserve correctness while making full admitted workflows private: current grant/exact set, commit, effects/publication; no routine raw-table or prepared-state access.
  3. Logging is not a closed failure protocol. Source-proven: retries in lifecycle.rs differ from warning-only refused failure/removal commits in effects.rs and activation.rs. Inferred outage risk: stranded intent. Required: one exact-activation evidence ingress, recoverable inspectable retirement; retry commits, never execution.
  4. Missing evidence is not nonexecution. Source-proven: spawn.rs builds before start reporting; reconcile.rs maps Starting without identity to NeverLaunched. Inferred crash-window risk: overstated certainty. Required across server/client/recording/keeper: distinguish intent, provably unattempted, known attempt, observed end and unknown. Never invent exit zero or relaunch permission.
  5. Numeric identity is not lifetime. Source-proven: federation.rs proxy/lease keys lack link epoch. Inferred replacement/reused-id/late-work risk, not demonstrated bypass. Required: epoch-owned incarnation, capabilities/catalog, proxies, leases, requests/cursors; teardown retires all, late work cannot reinstall them.
  6. Shared libraries do not guarantee shared decisions. Source-proven: input.rs chooses paste delivery/order; FFI client.rs ensure/select/spawns locally, returning zero after queued creation. Required: portable typed identity/order/capability/fallback/outcomes. Keep create/ensure, view/terminate, raw/acknowledged and user/untrusted distinct; linkage is not parity.
  7. Queue/admission/delivery/presentation differ. Source-proven: FFI render_projection acknowledges acquisition/build, contrary to embedding. Required: explicit refused/unavailable/queued/acknowledged/unknown and exact presentation receipts. No discarded results/acquisition acknowledgment; preserve Rune’s correct contract.
  8. View failure is not resource death. Source-proven: browser pane_refusal legacy-kills an unpresented split. Required: separate execution/interest/view, explicit exact activation cancellation for failed-create compensation, not incidental kill. Preserve runtime’s separation.
  9. Portable semantics must not own scheduling. Source-proven: stepped.rs owns connection locking/engine round trip. Required: facts/clocks → bounded semantic work; drivers own I/O, locks, time/backoff, handoff/callback retirement. Fence completions; preserve batching, event loops and !Send; no universal bus.
  10. Representations have independent contracts. Source-proven: wire Refusal depends on public error projection; keeper binding.rs stores public ExecutionRef. Required: lower pure validation, separate host filesystem/ authority checks, outward conversions, keeper pin/frozen storage; JSON must not migrate storage. Preserve independent core/protocol and distinct-ID proof.
  11. Archives are not perpetual execution authorization. Source-proven: organization documents trusted-integration terminal resume versus ACP archived-recipe execution. Policy change: new execution requires current trusted-template admission or local-owner approval bound to the exact raw recipe and restore/relaunch operation. Remote and delegated callers require a current trusted template. This accepted product/security target does not allege current unauthorized execution. Import/readiness/trust stay separate; cutover updates user docs and acceptance evidence explicitly.
  12. Temporal state needs cohesive owners, not field wrappers. Source-proven: TerminalActor combines terminal/ process/bootstrap/input/consumer facts; PeerWatch combines watches/presentation. Concentration is not proof each field needs an actor. Required: private bootstrap/publication, process, input-ordering, watch and view-preference owners; efficient shared ordering/data, no invalid production optional states solely for tests.
  13. Structural/generated agreement is not behavioral proof. Source-proven: wire_schema.rs derives top-level metadata/presence from tables/samples; CI names green checks without Apple work. Required: independent nested/frozen/peer oracles, exact source/artifact/platform/ scenario provenance. Structural/file-growth gates supplement behavior; actual native proof precedes integration, not optional capacity follow-up.

Ten logical owners

OwnerResponsibility and seam
1. Domain transitionsPure membership/arrangement/lifecycle, durable identities and refusals; existing core.
2. Host operation authorityCurrent subject/grant, affected set, transaction/receipt/journal, mirror/effect/publication; private workflows, no mega-dispatcher.
3. Execution lifecycleReservations, observed evidence/backlog, retirement, reconciliation, upgrade quiescence; engine facts, durable host interpretation.
4. Live generationsConnection/attachment/stream/bootstrap/link facts, cancellation and stale-result rejection. Streams reserve their exact generation before any await, fence on the predecessor’s actual task, and natural close drains the admitted emitter (stream attach).
5. Resource kinds/terminal engineExisting kind contracts; engine owns PTY/libghostty/encoding/native capture; explicit host assembly.
6. Portable client semanticsShared session/intent decisions, explicit facts/clocks/identity and typed outcomes; extend existing kernels/policies.
7. Platform drivers/viewsI/O/locks/scheduling, gestures/presentation/search/selection/scroll, teardown/callbacks. Shared native trust planning; platform credentials/origin constraints.
8. Contract projectionsWire/JSON/binding/storage owners and outward conversions; compatibility adapters, not competing semantic authority.
9. Work authorityKeeper transactions/projection; events wake exact level reads; no global transaction or invented work success.
10. QualificationScenarios, independent oracles, same-source native/foreign provenance, performance/backpressure and change-locality proof.

Materialization and qualification

Backward prerequisites and dependency-ordered waves work from this destination to implementation. Every operation and disposition requires the consumer-visible proof in qualification.