Class: Textus::Session

Inherits:
Data
  • Object
show all
Defined in:
lib/textus/session.rb

Overview

The agent session: per-connection (MCP), per-process (CLI), or per-loop (Ruby) orientation state — the audit cursor plus the manifest etag and propose_zone captured at boot. Immutable Data value; advance_cursor returns a new instance. ADR 0036.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cursorObject (readonly)

Returns the value of attribute cursor

Returns:

  • (Object)

    the current value of cursor



6
7
8
# File 'lib/textus/session.rb', line 6

def cursor
  @cursor
end

#manifest_etagObject (readonly)

Returns the value of attribute manifest_etag

Returns:

  • (Object)

    the current value of manifest_etag



6
7
8
# File 'lib/textus/session.rb', line 6

def manifest_etag
  @manifest_etag
end

#propose_zoneObject (readonly)

Returns the value of attribute propose_zone

Returns:

  • (Object)

    the current value of propose_zone



6
7
8
# File 'lib/textus/session.rb', line 6

def propose_zone
  @propose_zone
end

#roleObject (readonly)

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



6
7
8
# File 'lib/textus/session.rb', line 6

def role
  @role
end

Instance Method Details

#advance_cursor(new_cursor) ⇒ Object



7
# File 'lib/textus/session.rb', line 7

def advance_cursor(new_cursor) = with(cursor: new_cursor)

#check_etag!(observed_etag) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/textus/session.rb', line 9

def check_etag!(observed_etag)
  return if observed_etag == manifest_etag

  raise Textus::MCP::ContractDrift.new(
    "manifest changed (was #{short_etag(manifest_etag)}, now #{short_etag(observed_etag)}); re-run boot",
  )
end