adk_session_query (erlang_adk v0.7.0)
View SourceVersioned query, pagination, and non-destructive branching for sessions.
The current session-service behaviour exposes whole snapshots. This layer adds stable ordering, HMAC-authenticated snapshot cursors, event filters, and plan/apply branching without requiring a backend rewrite. A rewind is materialized as a new session; the source is never edited or deleted.
Summary
Functions
Apply a previously generated plan to a new target session. The source snapshot and plan contents are revalidated. Scoped app/user deltas are rejected unless allow_shared_state_replay => true is explicit.
Materialize a full-head branch.
Get one session with a stable, filtered page of canonical JSON-safe events. State and event maps have all credential-bearing keys removed.
List one deterministic page. cursor_secret (at least 32 bytes) is mandatory; cursors are bound to app, user, page size, order, and the complete list snapshot.
Plan a branch at the current head without creating it.
Plan a new session retaining a chronological prefix of source events. Selectors are all, {index, Count}, {event_id, Id}, or {timestamp, Milliseconds}. Event-id and timestamp selectors are inclusive.
Materialize an historical prefix as a new session. This is always non-destructive; destructive => true is rejected.
Functions
Apply a previously generated plan to a new target session. The source snapshot and plan contents are revalidated. Scoped app/user deltas are rejected unless allow_shared_state_replay => true is explicit.
Materialize a full-head branch.
-spec capabilities() -> map().
Get one session with a stable, filtered page of canonical JSON-safe events. State and event maps have all credential-bearing keys removed.
List one deterministic page. cursor_secret (at least 32 bytes) is mandatory; cursors are bound to app, user, page size, order, and the complete list snapshot.
-spec new_cursor_secret() -> binary().
Plan a branch at the current head without creating it.
-spec plan_rewind(module(), binary(), binary(), binary(), term(), map()) -> {ok, map()} | {error, term()}.
Plan a new session retaining a chronological prefix of source events. Selectors are all, {index, Count}, {event_id, Id}, or {timestamp, Milliseconds}. Event-id and timestamp selectors are inclusive.
-spec rewind(module(), binary(), binary(), binary(), term(), map()) -> {ok, map()} | {error, term()}.
Materialize an historical prefix as a new session. This is always non-destructive; destructive => true is rejected.
-spec version() -> pos_integer().