agent2agentSourceA2AStoreSQLite

class SQLite

SQLite-backed task store with async pub/sub and webhook delivery.

This is the enlightened replacement for the in-memory TaskStore. Follows the gospel:

The store composes three concerns:

  1. SQLite — persistent CRUD for tasks, push configs
  2. PubSub — in-process streaming subscriptions
  3. Webhooks — push notification delivery

SQLite is safe for fiber-based concurrency within a single process because Ruby fibers are cooperatively scheduled — only one fiber runs at a time, so no concurrent writes can collide.

Definitions

def initialize(path: ":memory:")

Implementation

def initialize(path: ":memory:")
  @db = ::SQLite3::Database.new(path)
  @db.results_as_hash = true
  @db.execute("PRAGMA journal_mode = WAL")
  @db.execute("PRAGMA synchronous = NORMAL")
  @db.execute("PRAGMA foreign_keys = ON")

  @pub_sub  = PubSub.new
  @webhooks = Webhooks.new

  create_tables
end