WEFT_OS/.agents/skills/weft-appd-sessions/SKILL.md
Marco Allegretti 39869a2a38
docs: add engineering contract, contributor toolkit and templates
Add AGENTS.md as the single engineering contract: sources of truth,
evidence and proof requirements, ownership, working modes, the reviewed
change loop, maintenance isolation, decision authority, dependency and
fork rules, the 0.0.x to 0.1.0 release progression, and branch and
publication rules.

Add .agents/ with scope, implement, verify, maintenance and release
procedures; reviewer, architecture debt scout, simplicity and refactoring
roles; skills for the compositor, Servo rendering, runtime capabilities,
appd sessions, packages and data, Linux deployment, integration
verification and documentation; and verify.py, which runs the existing
check profiles with --locked from any directory, stops on the first
failure and supports --dry-run.

check_toolkit.py validates local links and heading anchors, metadata,
catalog coverage and issue forms. A new contributor-toolkit CI job runs
both. The structure follows the Resina Design System toolkit at
1e768064f57a1e403ab271822383e732795905a6, adapted to WEFT.

Validation, against the committed lockfiles:
- verify.py toolkit: checker passes, 28 runner/checker tests pass
- verify.py portable, demos, packages: pass
- verify.py linux, runtime, servo-embed: fail on existing defects
  (clippy collapsible_if in the winit backend, three clippy lints in
  weft-runtime with wasmtime-runtime, and an E0308 in the selected Servo
  revision's servo-layout); the runner reports the failing status

Add CONTRIBUTING.md, issue forms for defects and changes, maintenance
problems and decisions of direction, and a pull request template asking
for ownership, proof and the validation actually performed. README.md
links the contribution guide.
2026-10-08 23:40:08 +00:00

3.3 KiB

name description
weft-appd-sessions Use for weft-appd session lifecycle, readiness, child supervision and cleanup, the appd IPC and WebSocket bridge, and compositor association.

Appd sessions and IPC

Owner: weft-appd owns resolved package selection, effective grants, session identity, child supervision, readiness and cleanup. The shells display that state; they do not keep a second authoritative copy. Read the blueprint's resolved package descriptor, role-separated protocol and single lifecycle owner.

Where things live

Concern Source
Daemon, session registry, request dispatch appd main.rs
Child spawning, preopens, systemd wrapping, data paths runtime.rs
Unix socket messages ipc.rs
Browser-facing WebSocket server ws.rs
Compositor association client compositor_client.rs, weft-ipc-types
Image mount path mount.rs
Injected app bridge app-shell embedder
Shell-side client system-ui.html

Working rules

  • One session model: Starting -> Running -> Stopping -> Stopped, with structured terminal reasons. Running requires the component initialized, session IPC connected, the document and bridge initialized and the surface's first frame presented. Stdout text cannot establish readiness.
  • Every exit path enters the same cleanup: spawn failure, invalid package, initialization failure, timeout, cancellation, guest trap, child crash, explicit close and daemon shutdown. Owned resources include both children, portals, relays, sockets, compositor associations, temporary directories and mounts.
  • Use a process-group or systemd mechanism that is valid for the selected systemd and preserves ownership; verify systemd-run argument combinations against the installed version. Terminate gracefully for a bounded time, then forcibly, and await settlement instead of sleeping.
  • A caller-supplied session_id is a routing claim. Bind role, session and generation on the server, authenticate the browser bootstrap, and never deliver private payloads to unrelated subscribers.
  • The bridge and daemon share one versioned semantic envelope. Bound frame size, queued messages and bytes and concurrency; preserve partial frames across cancellation; do not hold the registry lock across awaits; remove closed relays; resynchronize from a snapshot after overflow.
  • Default logs exclude application payloads, clipboard contents, saved notes and credentials.

Evidence

python .agents/scripts/verify.py portable runs the appd and IPC unit tests. Lifecycle and protocol claims need fixtures with real child processes and sockets: each startup phase failing or cancelled, children crashing, fragmented and concurrent frames, full queues, forged and stale credentials, and checks that no owned process, socket, relay or mount remains.