Skip to content

Repository files navigation

Ask::Session

Event-sourced session state for the ask-rb ecosystem.

Overview

Ask::Session provides the foundational value objects and stores for event-sourced session management in ask-rb: immutable Record and Event envelopes, an in-memory Store with concurrency guardrails, a durable ProviderStore for restart-safe sessions, a replayable Host with subscriptions, a State reducer, and a Sink that records ask-runtime tool lifecycle through Host#sink. It ships with zero runtime dependencies — durability through ask-state-providers is an optional integration.

Task guides live in docs/.

Installation

Requires Ruby 3.2+.

gem "ask-session"

Quick start

In-memory, single process:

require "ask-session"

host = Ask::Session::Host.new

host.create(id: "s1", metadata: { user: "alice" })
host.send_message("s1", content: "hello")
host.session("s1").version # => 2
host.close("s1", reason: "done")

Invalid transitions (sending to a closed session, closing twice) raise Ask::Session::InvalidTransitionError.

Guides

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-feature)
  3. Commit your changes (git commit -am 'Add feature')
  4. Push to the branch (git push origin my-feature)
  5. Create a Pull Request

License

MIT License. See LICENSE for details.

About

Durable, replayable session state for the ask-rb ecosystem

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages