Class: Textus::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/store/session.rb,
lib/textus/store.rb,
lib/textus/store/cursor.rb,
lib/textus/store/geometry.rb,
lib/textus/store/container.rb,
lib/textus/store/jobs/base.rb,
lib/textus/store/jobs/plan.rb,
lib/textus/store/compositor.rb,
lib/textus/store/jobs/index.rb,
lib/textus/store/jobs/queue.rb,
lib/textus/store/jobs/sweep.rb,
lib/textus/store/jobs/worker.rb,
lib/textus/store/index/lookup.rb,
lib/textus/store/jobs/planner.rb,
lib/textus/store/index/builder.rb,
lib/textus/store/jobs/registry.rb,
lib/textus/store/jobs/retention.rb,
lib/textus/store/envelope/reader.rb,
lib/textus/store/envelope/writer.rb,
lib/textus/store/jobs/materialize.rb

Overview

The agent session: per-connection (MCP), per-process (CLI), or per-loop (Ruby) orientation state — the audit cursor plus the contract etag and propose_lane captured at boot. Immutable Dry::Struct::Value; advance_cursor and with return new instances. ADR 0036; contract_etag widened in ADR 0074.

Defined Under Namespace

Modules: Envelope, Index, Jobs Classes: Compositor, Container, Cursor, Geometry, Session

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root) ⇒ Store

Returns a new instance of Store.



45
46
47
# File 'lib/textus/store.rb', line 45

def initialize(root)
  @container = build_container(File.expand_path(root))
end

Instance Attribute Details

#containerObject (readonly)

Returns the value of attribute container.



5
6
7
# File 'lib/textus/store.rb', line 5

def container
  @container
end

Class Method Details

.discover(start_dir = Dir.pwd, root: nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/textus/store.rb', line 14

def self.discover(start_dir = Dir.pwd, root: nil)
  explicit = root || ENV.fetch("TEXTUS_ROOT", nil)
  return discover_explicit(explicit) if explicit

  ascend_for_store(File.expand_path(start_dir)) ||
    raise(IoError.new("no .textus directory found from #{start_dir}"))
end

Instance Method Details

#as(role, dry_run: false, correlation_id: nil) ⇒ Object



64
65
66
# File 'lib/textus/store.rb', line 64

def as(role, dry_run: false, correlation_id: nil)
  Textus::Surface::RoleScope.new(container: container, role: role, dry_run: dry_run, correlation_id: correlation_id)
end

#gateObject



60
61
62
# File 'lib/textus/store.rb', line 60

def gate
  @container.gate
end

#session(role:) ⇒ Object

Build an agent Session oriented at the current cursor/manifest — the Ruby equivalent of an MCP ‘initialize`. ADR 0036.



51
52
53
54
55
56
57
58
# File 'lib/textus/store.rb', line 51

def session(role:)
  Textus::Store::Session.new(
    role: role.to_s,
    cursor: audit_log.latest_seq,
    propose_lane: manifest.policy.propose_lane_for(role),
    contract_etag: Textus::Value::Etag.for_contract(root),
  )
end