colmugx/posoco/puppetry does not have a README file
pub(open) trait EventSubscriber {
fn subscriber_id(Self) -> String
fn provenance(Self) -> String
async fn on_event(Self, EventEnvelope) -> Unit raise SubscriberError
}pub(open) trait HarnessLifecycleNode {
fn node_id(Self) -> String
fn provenance(Self) -> String
async fn startup(Self) -> Unit raise LifecycleNodeError
async fn shutdown(Self) -> Unit raise LifecycleNodeError
}pub(open) trait JournalContributor {
fn contributor_id(Self) -> String
fn provenance(Self) -> String
fn contribute(Self, PreCommitContext) -> JournalContribution raise ContributionError
}pub(open) trait RunJournal {
fn append(Self, Array[JournalEntry]) -> Int raise HarnessError
fn revision(Self) -> Int
fn entries_for_run(Self, RunId) -> Array[JournalEntry]
fn entries_for_savepoint(Self, RunId, String) -> Array[JournalEntry]
}pub(all) suberror ContributionError {
Internal(contributor_id~ : String, detail~ : String)
Inconsistent(contributor_id~ : String, detail~ : String)
}impl Show for ContributionErrorpub(all) suberror HarnessError {
IllegalPhaseTransition(from~ : HarnessPhase, to~ : HarnessPhase, operation~ : OperationClass, detail~ : String)
OperationNotAllowedInPhase(phase~ : HarnessPhase, operation~ : OperationClass, detail~ : String)
LeaseHeld(operation_id~ : String, held_by~ : String)
LeaseNotHeld(operation_id~ : String, detail~ : String)
AfterShutdown(command~ : String)
SnapshotInvalid(detail~ : String)
StaleIdentity(kind~ : String, expected~ : String, actual~ : String)
QueueFull(kind~ : String, depth~ : Int)
SuspensionPayloadMismatch(suspension_id~ : String, expected_kind~ : String)
SuspensionIdMismatch(target_run_id~ : RunId, expected~ : String, actual~ : String)
AbortNoActiveRun(run_id~ : RunId)
SavepointFailed(kind~ : String, cause~ : SavepointFailureCause)
ContributionInvalid(contributor_id~ : String, detail~ : String)
SubscriberJournalMutation(subscriber_id~ : String)
LifecycleStartupFailed(node_id~ : String, cause~ : String, rollback_failures~ : Array[(String, String)])
LifecycleShutdownFailed(node_id~ : String, cause~ : String, other_failures~ : Array[(String, String)])
LifecycleDuplicate(node_id~ : String)
SubscriberFailed(subscriber_id~ : String, cause~ : String, committed_revision~ : Int)
PumpLoopExceeded(iterations~ : Int)
DuplicateOrLateCompletion(effect_id~ : EffectId, detail~ : String)
ReducerInvariantViolation(category~ : InvariantCategory)
}impl Show for HarnessErrorpub(all) suberror LifecycleNodeError {
Internal(node_id~ : String, detail~ : String)
Inconsistent(node_id~ : String, detail~ : String)
InvalidState(node_id~ : String, detail~ : String)
}impl Show for LifecycleNodeErrorpub(all) suberror SubscriberError {
Internal(subscriber_id~ : String, detail~ : String)
ContractViolation(subscriber_id~ : String, detail~ : String)
}impl Show for SubscriberErrorpub struct ControlMailbox {
steer_queue : Queue[SteerCommand]
follow_up_queue : Queue[FollowUpCommand]
steer_depth : Int
follow_up_depth : Int
resume_pending : Map[String, ResumeCommand]
abort_requested : Bool
active_run_id : RunId?
active_turn_id : TurnId?
idle_cond : Cond
quiescent_status : QuiescentStatus
max_depth : Int
}pub struct EventDispatcher {
subscribers : Array[&EventSubscriber]
next_seq : Int
last_committed_revision : Int
run_id : RunId
turn_id : TurnId
session_id : SessionId
}async fn EventDispatcher::dispatch(self : EventDispatcher, event : KernelEvent, committed_revision : Int) -> Unit raise HarnessErrorfn EventDispatcher::new(run_id : RunId, turn_id : TurnId, session_id : SessionId) -> EventDispatcherimpl Show for EventEnvelopefn EventEnvelope::new(run_id~ : RunId, turn_id~ : TurnId, session_id~ : SessionId, seq~ : Int, committed_revision~ : Int, event~ : KernelEvent) -> EventEnvelopepub(all) struct ExecutionContext {
host : &HostRuntime
model_id : ModelId
catalog : ToolCatalogSnapshot
}fn ExecutionContext::new(host : &HostRuntime, model_id~ : ModelId, catalog~ : ToolCatalogSnapshot) -> ExecutionContextimpl RunJournal for FailOnNthJournalfn entries_for_savepoint(self : FailOnNthJournal, run_id : RunId, savepoint_id : String) -> Array[JournalEntry]pub(all) struct FrozenBatch {
savepoint_id : String
savepoint_kind : SavepointKind
expected_revision : Int
entries : Array[JournalEntry]
frozen_entry_keys : Array[String]
} derive(Eq, Debug)pub struct Harness {
config : HarnessConfig
phase_gate : PhaseGate
mailbox : ControlMailbox
lifecycle : LifecycleCollection
last_completed_transcript : CanonicalTranscript?
}async fn Harness::prompt(self : Harness, run_id : RunId, turn_id : TurnId, session_id : SessionId, initial_messages : Array[CanonicalMessage], operation_id : String) -> PromptResult raise HarnessErrorpub(all) struct HarnessConfig {
host : &HostRuntime
model_id : ModelId
catalog : ToolCatalogSnapshot
journal : &RunJournal
contributors : Array[&JournalContributor]
subscribers : Array[&EventSubscriber]
lifecycle_nodes : Array[&HarnessLifecycleNode]
default_budget : Budget
max_iterations : Int
}impl Show for HarnessPhasepub struct InMemoryJournal {
entries : Array[JournalEntry]
seen_ids : Map[String, Bool]
terminal_runs : Map[String, Bool]
}impl RunJournal for InMemoryJournalfn entries_for_savepoint(self : InMemoryJournal, run_id : RunId, savepoint_id : String) -> Array[JournalEntry]fn InMemoryJournal::append_impl(self : InMemoryJournal, batch : Array[JournalEntry]) -> Int raise HarnessErrorfn InMemoryJournal::entries_for_run_impl(self : InMemoryJournal, run_id : RunId) -> Array[JournalEntry]fn InMemoryJournal::entries_for_savepoint_impl(self : InMemoryJournal, run_id : RunId, savepoint_id : String) -> Array[JournalEntry]pub(all) struct JournalContribution {
contributor_id : String
provenance : String
proposed_entries : Array[JournalEntry]
} derive(Eq, Debug)fn JournalContribution::with_entries(contributor_id : String, provenance : String, entries : Array[JournalEntry]) -> JournalContributionpub(all) struct JournalEntry {
identity : JournalEntryIdentity
revision : Int
summary : String
payload : Json
} derive(Eq, Debug)impl Show for JournalEntryIdentitypub struct LifecycleCollection {
nodes : Array[&HarnessLifecycleNode]
node_ids : Map[String, Bool]
started : Map[String, Bool]
shut_down : Map[String, Bool]
is_sealed : Bool
}fn LifecycleCollection::register(self : LifecycleCollection, node : &HarnessLifecycleNode) -> Unit raise HarnessErrorimpl Show for LifecycleStartupErrorpub(all) struct NoopContributor {
id : String
}impl JournalContributor for NoopContributorfn contribute(self : NoopContributor, _ctx : PreCommitContext) -> JournalContribution raise ContributionErrorpub(all) struct NoopSubscriber {
id : String
}impl EventSubscriber for NoopSubscriberimpl Show for OperationClasspub(all) struct OperationLease {
operation_id : String
acquired_phase : HarnessPhase
run_id : RunId
turn_id : TurnId
} derive(Eq, Debug)impl Show for OperationLeasepub struct PhaseGate {
phase : HarnessPhase
lease : OperationLease?
active_run_id : RunId?
active_turn_id : TurnId?
active_suspension_id : String?
}fn PhaseGate::acquire_prompt(self : PhaseGate, operation_id : String, run_id : RunId, turn_id : TurnId) -> (PhaseGate, OperationLease) raise HarnessErrorfn PhaseGate::acquire_resume(self : PhaseGate, operation_id : String, expected_suspension_id : String) -> (PhaseGate, OperationLease) raise HarnessErrorfn PhaseGate::enter_suspended(self : PhaseGate, suspension_id : String) -> PhaseGate raise HarnessErrorpub(all) struct PreCommitContext {
run_id : RunId
turn_id : TurnId
session_id : SessionId
savepoint_id : String
savepoint_kind : SavepointKind
base_entries : Array[JournalEntry]
current_revision : Int
catalog_version : CatalogVersion
} derive(Eq, Debug)pub(all) enum PromptResult {
Accepted(run_id~ : RunId, turn_id~ : TurnId)
LeaseBusy(held_by~ : String)
Rejected(error~ : HarnessError)
}impl Show for PromptResultimpl Show for QueuePolicypub(all) enum QuiescentStatus {
Idle
Suspended(run_id~ : RunId, suspension_id~ : String, requirement_kind~ : String)
Terminal(outcome~ : RunOutcome)
Shutdown
} derive(Eq, Debug)impl Show for QuiescentStatusimpl Show for SavepointFailureCauseimpl Show for SavepointKindpub struct TurnSnapshot {
run_id : RunId
turn_id : TurnId
session_id : SessionId
catalog_version : CatalogVersion
tool_definitions : Array[CanonicalToolDef]
model_id : String
call_options : Json
budget : Budget
deadline : Int?
hook_provenance : Array[String]
lifecycle_provenance : Array[String]
subscriber_provenance : Array[String]
fingerprint : String
} derive(Eq, Debug)impl Show for TurnSnapshotpub(all) struct TurnSnapshotInput {
run_id : RunId
turn_id : TurnId
session_id : SessionId
catalog : ToolCatalogSnapshot
model_id : String
call_options : Json
budget : Budget
deadline : Int?
hook_provenance : Array[String]
lifecycle_provenance : Array[String]
subscriber_provenance : Array[String]
} derive(Eq, Debug)async fn execute_one(effect : Effect, ctx : ExecutionContext, on_chunk : (Json) -> Unit) -> RunInputfn prepare_batch(ctx : PreCommitContext, contributors : Array[&JournalContributor]) -> FrozenBatch raise HarnessErrorInstall
Download zipLLM Agent framework with hexagonal (ports-and-adapters) architecture. Defines 9 traits + Agent loop. Depends on moonbitlang/async.