Module: Kailash::TrustPlane

Defined in:
lib/kailash/trust_plane.rb

Overview

Trust Plane module wraps the Rust trust-plane crate, providing EATP-powered trust environment for human-AI collaborative work.

All classes are defined by the native extension (Magnus). This file adds convenience methods and block-based lifecycle patterns.

Class Method Summary collapse

Class Method Details

.create_project(path, name, author, envelope: nil, &block) ⇒ Object

Convenience: open a TrustProject with a block for automatic scoping.

Kailash::TrustPlane.create_project("/path", "MyProject", "author") do |project|
project.record_decision(...)
end


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kailash/trust_plane.rb', line 16

def self.create_project(path, name, author, envelope: nil, &block)
  args = [path, name, author]
  args << envelope if envelope
  project = TrustProject.create(*args)
  return project unless block

  begin
    yield project
  ensure
    # TrustProject has no explicit close, but ensure block completes
  end
end

.load_project(path) {|project| ... } ⇒ Object

Convenience: load an existing TrustProject with a block.

Kailash::TrustPlane.load_project("/path/.trust") do |project|
report = project.verify
end

Yields:

  • (project)


35
36
37
38
39
40
# File 'lib/kailash/trust_plane.rb', line 35

def self.load_project(path, &block)
  project = TrustProject.load(path)
  return project unless block

  yield project
end