Uniform API -- Lightweight Dances #313
Closed
evomimic
started this conversation in
Design Discussions
Replies: 1 comment
-
|
This approach to re-factoring the Dance API was never fully fleshed out and actually misses the mark by a large margin. Rather than try to fix it... I'm just going to close this discussion. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
OBSOLETE
This approach to re-factoring the Dance API was never fully fleshed out and actually misses the mark by a large margin. Rather than try to fix it... I'm just going to close this discussion.
MAP: Rust ⇆ TypeScript layering with lightweight Dances (HolonReference-based)
Goals
1) High-level layering
A. Rust “Dance Host” (in Tauri)
dance(envelope_bytes) -> envelope_bytes.B. TypeScript SDK (“true TS API”)
body.C. (Later) Host ↔ Guest Gateway
channel/session_stateonly at this boundary (infra concern, not dance/body concern).2) Uniform envelope (v1) — HolonReference in/out
Request
v: "1"id: string(correlation)ts: ISO-8601dance: "Namespace.VerbNoun"(e.g.,HolonLoader.LoadSegment)kind: "query" | "command"body: HolonReference← the only payload fieldtxn?: { id: string }undo?: { policy: "Record" | "Skip" }meta?: { actor?: string, caps?: string[], locale?: string }channel?,session_state_mode?,session_state?Response
v: "1"id: stringok: booleanresult: HolonReference | HolonReference[] | null← always refs, never raw dataerror?: { code: string, reason: string, details?: any }logs?: any[]effects?: { events?: any[] }session_state?3) HolonReference (canonical forms)
A
HolonReferencemay point to:{"transient":"<opaque-id>"}(host-local, non-forgeable){"id":"<HolonId>"}{"tk":"TypeName:Key"}{"proxy":"ProxyName","tk":"Type:Key"}or{"ext":"<ProxyId>:<LocalId>"}Rules:
4) Mapping methods → dances (initial set)
HolonLoader.load_segment→ command:HolonLoader.LoadSegmentHolonLoader.commit_all→ command:HolonLoader.CommitHolonReader.get_holon→ query:Holon.ReadHolonReader.search→ query:Holon.SearchValidation.validate_import→ query:Validation.ValidateImportTxn.begin/Txn.end→ commands:Txn.Begin/Txn.EndNaming:
Namespace.CamelVerb(queries) /Namespace.CamelVerbNoun(commands).5) Handlers (single signature)
DanceContextsupplies correlation id, actor/caps, txn context, undo sink, logger.bodyto a request holon (transient/staged/saved), reads props/rels, performs logic.ResultRef=HolonReference | Vec<HolonReference> | Null.6) Request holon pattern (builders & shaping)
body.Transient.CreateEmpty→ returnsHolonReferenceTransient.SetProperty/RemovePropertyTransient.AddRelationship/RemoveRelationshipTransient.Seal7) Undo/redo (compensations)
kind:"command", host preps a compensation entry only after a successful mutation.HolonLoader.RevertStage) recorded with minimal facts.undo.policy = "Record", SDK can override per call.8) Transactions
Txn.Begin→ host creates/returns a txn context (ref by id).requires_txn(hardcoded table for now).Txn.EndwithCommit|Rollbackdrives apply/compensate.ctx.txn_idand route to staged persistence paths.9) Logging & tracing
idrequired; host addsspan_id, latency, outcome.logsechoed in dev builds.10) Error model (stable wire values)
BadRequest— shape/validation/type errorsForbidden— authz/capability/ownership/sealed violationsNotFound— missing ref / expired leaseConflict— version/CAS/lease problems at boundariesUnprocessableEntity— domain rule failedServerError— unexpectedNotImplemented,ServiceUnavailable11) Dispatch: static now, dynamic later
Static table (today)
Dynamic (future)
descriptor_refto envelope/meta.12) TypeScript SDK skeleton
Transport
Client
13) Serialization, versioning, idempotency
meta.idempotency_keyfor commands (host dedupes).14) Authz & ownership (quick guards)
sealedflags and capability checks (meta.caps).Forbiddenfor illegal writes;NotFound/Conflictfor dead/expired refs.15) Rollout plan (practical)
body/result) in Rust & TS.perform(),beginTxn/endTxn, a few ergonomic wrappers.Holon.Read,HolonLoader.LoadSegment,HolonLoader.Commit).16) What “result refs” point to
Itemsreference saved/transient items.Itemsrel; further pages via new dances.This plan gives you a uniform, future-proof API surface: HolonReference in, HolonReference(s) out, with all the important platform semantics (undo, txn, authz, logging) living in the host middleware—clean for today, extensible for tomorrow.
Beta Was this translation helpful? Give feedback.
All reactions