Class: Textus::Application::Reads::Pulse

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/application/reads/pulse.rb

Overview

Aggregator over audit + freshness + review + doctor. One round-trip for an agent’s per-turn heartbeat. All component reads are existing APIs; pulse is sugar with a stable envelope shape and a monotonic cursor (seq).

Instance Method Summary collapse

Constructor Details

#initialize(ctx:, manifest:, file_store:, audit_log:, root:, store:) ⇒ Pulse

Returns a new instance of Pulse.



9
10
11
12
13
14
15
16
# File 'lib/textus/application/reads/pulse.rb', line 9

def initialize(ctx:, manifest:, file_store:, audit_log:, root:, store:)
  @ctx        = ctx
  @manifest   = manifest
  @file_store = file_store
  @audit_log  = audit_log
  @root       = root
  @store      = store
end

Instance Method Details

#call(since: 0) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/textus/application/reads/pulse.rb', line 18

def call(since: 0)
  changed = audit_changes_since(since)
  {
    "cursor" => @audit_log.latest_seq,
    "changed" => changed,
    "stale" => stale_keys,
    "pending_review" => review_keys,
    "doctor" => doctor_summary,
  }
end