Ergonomic session facade backed by Jidoka.Session.Data.
Jidoka.Session.Data is the durable data contract. This module is the
developer-facing API for starting, running, resuming, and inspecting sessions
without reaching into lower-level execution modules for common workflows.
Summary
Functions
Waits for a request handle returned by chat_async/3.
Cancels an active asynchronous session request.
Runs one turn for a session and returns final assistant text.
Starts one session chat turn asynchronously.
Creates a new session from a safe snapshot in an existing session.
Fetches a persisted session from a configured session store.
Lists persisted sessions from a configured session store.
Lists pending human-review requests from a session or session store.
Recovers a session after its durable worker lease expires.
Lists stored sessions that are ready for crash recovery.
Returns a data-only replay view for a session.
Resumes the latest hibernated snapshot for a session.
Runs one turn for a session and returns the full session result.
Starts a new session for an agent, spec, or plan.
Starts a new session with an explicit session id.
Writes one memory entry through the configured memory store.
Types
@type agent_input() :: Jidoka.Turn.Plan.input()
@type async_result() :: {:ok, Jidoka.Chat.Request.t()} | {:error, term()}
@type chat_result() :: {:ok, t(), String.t()} | {:hibernate, t(), Jidoka.Snapshot.t()} | {:cancelled, Jidoka.Cancellation.t()} | {:error, term()}
@type opts() :: keyword()
@type request_input() :: Jidoka.Turn.Request.input()
@type run_result() :: {:ok, t(), Jidoka.Turn.Result.t()} | {:hibernate, t(), Jidoka.Snapshot.t()} | {:error, term()}
@type t() :: Jidoka.Session.Data.t()
Functions
@spec await(Jidoka.Chat.Request.t(), opts()) :: chat_result()
Waits for a request handle returned by chat_async/3.
@spec cancel(Jidoka.Chat.Request.t(), opts()) :: {:ok, Jidoka.Cancellation.t()} | {:error, term()}
Cancels an active asynchronous session request.
@spec chat(session_input(), String.t(), opts()) :: chat_result()
Runs one turn for a session and returns final assistant text.
The updated session is returned with the text so caller-managed sessions do not lose durable state when no store is configured.
@spec chat_async(session_input(), String.t(), opts()) :: async_result()
Starts one session chat turn asynchronously.
Pass stream: true to stream request-scoped Jidoka.Event values to the
caller mailbox while the request is running.
@spec fork(session_input(), opts()) :: {:ok, t()} | {:error, term()}
Creates a new session from a safe snapshot in an existing session.
The source session stays unchanged. By default, this function forks the
latest snapshot. Pass snapshot: to select another stored snapshot.
@spec get(Jidoka.Session.Store.store(), String.t()) :: {:ok, t()} | {:error, term()}
Fetches a persisted session from a configured session store.
@spec list(Jidoka.Session.Store.store()) :: {:ok, [t()]} | {:error, term()}
Lists persisted sessions from a configured session store.
@spec pending_reviews(t() | Jidoka.Session.Store.store()) :: {:ok, [Jidoka.Review.Request.t()]} | {:error, term()}
Lists pending human-review requests from a session or session store.
@spec recover(String.t(), opts()) :: run_result()
Recovers a session after its durable worker lease expires.
@spec recoverable(Jidoka.Session.Store.store(), opts()) :: {:ok, [t()]} | {:error, term()}
Lists stored sessions that are ready for crash recovery.
@spec replay(t()) :: {:ok, Jidoka.Session.Replay.t()} | {:error, term()}
Returns a data-only replay view for a session.
@spec resume(session_input(), opts()) :: run_result()
Resumes the latest hibernated snapshot for a session.
@spec run(session_input(), request_input(), opts()) :: run_result()
Runs one turn for a session and returns the full session result.
@spec start(agent_input(), opts() | String.t()) :: {:ok, t()} | {:error, term()}
Starts a new session for an agent, spec, or plan.
The returned value is a Jidoka.Session.Data struct. A DSL agent module is
accepted directly:
{:ok, session} = Jidoka.Session.start(MyApp.SupportAgent, "support-123")Pass store: ... to persist the session immediately.
@spec start(agent_input(), String.t(), opts()) :: {:ok, t()} | {:error, term()}
Starts a new session with an explicit session id.
@spec write_memory(t(), String.t(), opts()) :: {:ok, Jidoka.Memory.WriteResult.t()} | {:error, term()}
Writes one memory entry through the configured memory store.