a28eb78ded
Keep local/offline and host capability recipes on app-owned command/event/projection flow without teaching raw EffectBatch as the authoring boundary. req: local/001 req: local/002 req: host/002
56 lines
2.3 KiB
Markdown
56 lines
2.3 KiB
Markdown
# Recipe: local command log
|
|
|
|
A hemx app may feel local-first without making hemx core a client database or
|
|
sync framework. The local artifact is an app-owned command/event log plus a
|
|
projection; hemx effects are rendered output, not stored truth. req: local/001
|
|
req: local/002
|
|
|
|
## Decision: no `hemx-local` crate yet
|
|
|
|
`hemx local` remains an app/recipe pattern for now, not a reusable hemx layer.
|
|
The host capability path proves that thin typed contracts work when the shared
|
|
semantics are obvious: manifest, call, event, and host-check failure. The local
|
|
exemplar proves a safer boundary for offline work: command, domain event,
|
|
projection, then generated UI effects. It does not yet prove common storage,
|
|
reconciliation, export, deletion, or conflict semantics across apps, so a crate
|
|
would freeze product policy too early. req: local/002 req: local/003 req:
|
|
local/004
|
|
|
|
A future reusable layer must first prove at least two independent apps share the
|
|
same command-log contract without sharing domain policy, storage provider, sync
|
|
provider, or conflict rules. Until then, recipes and app-owned integrations are
|
|
more honest and easier to delete. req: local/002 req: local/003
|
|
|
|
## Shape
|
|
|
|
```text
|
|
user intent
|
|
→ LocalCommand
|
|
→ domain validation
|
|
→ LocalEvent
|
|
→ Projection
|
|
→ generated UI effects
|
|
```
|
|
|
|
The log may live in memory, IndexedDB, SQLite, a native host store, or another
|
|
app-chosen persistence layer. That storage choice is not hemx core. req: local/002
|
|
|
|
## Replay and sync
|
|
|
|
Replaying local work to a server, remote AI/STT gateway, backup target, or peer
|
|
sync engine is explicit product policy. The app decides what can be queued,
|
|
exported, deleted, reconciled, retried, rejected, or redacted. A local projection
|
|
can render immediate feedback while those decisions remain pending. req: local/003
|
|
|
|
## Boundary
|
|
|
|
Do not persist DOM patches as truth. Do not persist generated UI effect payloads
|
|
as the local application log. Those are render instructions produced after
|
|
app/domain code accepts commands and projects events. req: local/001 req:
|
|
local/004
|
|
|
|
Use `hemx-host` only when the local log needs device or shell capabilities such
|
|
as secure storage, files, haptics, microphone, or notifications. The host still
|
|
returns facts; app code still owns the command/event/projection policy. req:
|
|
host/002 req: local/003
|