colmugx/posoco/port does not have a README file
pub(open) trait CommandPort {
fn commands(Self) -> Array[CommandDef]
async fn invoke(Self, id : String, args : Json) -> CommandOutcome raise CommandError
}pub(open) trait DecisionPort {
async fn evaluate(Self, request : DecisionRequest, context~ : DecisionCallContext) -> DecisionResult raise DecisionError
}pub(open) trait Lifecycle {
fn on_compose(Self, ctx : CompositionView) -> Unit raise CompositionError = _
async fn on_start(Self) -> Unit = _
async fn on_shutdown(Self) -> Unit = _
}pub(open) trait LogPort {
async fn write(Self, record : LogRecord, durability : LogDurability) -> Unit raise LogError
async fn flush(Self) -> Unit raise LogError
}pub(open) trait MemoryPort {
async fn inbound(Self, session_id~ : String, request~ : String) -> String? raise MemoryError
async fn store(Self, content~ : String, metadata~ : Map[String, Json]) -> String raise MemoryError
async fn search(Self, query~ : String, top_k? : Int) -> String? raise MemoryError
async fn delete(Self, id : String) -> Unit raise MemoryError
}pub(open) trait ModelPort {
async fn chat(Self, scope : InvocationScope, messages : ArrayView[Message], tools : Array[ToolDef], options : ChatOptions, stream : StreamMode) -> ModelCallResult raise ModelError
async fn compact(Self, scope : InvocationScope, messages : ArrayView[Message], tools : Array[ToolDef], options : ChatOptions, trigger : CompactTrigger) -> CompactResult raise ModelError
fn provider_config(Self) -> ProviderConfig
}pub(open) trait PipelineHook {
fn tool_exposure(Self, definition : ToolDef) -> ToolExposure = _
async fn before_model(Self, messages : Array[Message]) -> Array[Message] raise HookAbort = _
async fn before_tool(Self, call : ToolCall) -> ToolDecision = _
async fn on_post_event(Self, scope : EventScope?, stage : HookStage) -> Unit noraise = _
async fn on_turn_begin(Self) -> Unit = _
async fn on_turn_end(Self) -> Unit = _
}pub(open) trait SessionPort {
async fn load(Self, id : String) -> Session raise SessionError
async fn save(Self, id : String, session : Session) -> Unit raise SessionError
async fn append_messages(Self, id : String, from_index : Int, messages : ArrayView[Message]) -> Unit raise SessionError = _
async fn checkpoint(Self, id : String, checkpoint : SessionCheckpoint) -> Unit raise SessionError = _
async fn truncate(Self, id : String, from_index : Int) -> Unit raise SessionError = _
}pub(open) trait SystemPromptContributor {
fn system_prompt(Self) -> String
}pub(open) trait ToolCancellable {
async fn cancel(Self, run_id~ : RunId, effect_id : EffectId, reason : CancelReason) -> CancelDisposition
}pub(open) trait ToolProvider {
fn list_tools(Self) -> Array[ToolDef]
async fn execute(Self, ctx : ToolCallContext) -> ToolOutcome raise RuntimeError
}pub(open) trait UiPort {
fn ui_descriptor(Self) -> UiDescriptor
fn render(Self, intent : UiRender) -> Unit
async fn request(Self, req : UiRequest) -> UiResponse raise UiError
}pub(all) suberror HookAbort {
Aborted(reason~ : String)
}pub(all) struct AutocompleteItem {
label : String
insert_text : String
detail : String?
kind : String
} derive(Debug)pub(all) struct AutocompleteSource {
trigger : String
kind : String
fetch : (String) -> Array[AutocompleteItem]
} derive(Debug)pub(all) struct CommandDef {
id : String
label : String
description : String
category : String
ctype : CommandType
params : Array[CommandParam]
aliases : Array[String]
shortcut : String?
icon : String?
visible : Bool
metadata : Json?
} derive(Eq, Debug)pub struct CompositionView {
// private fields
}fn CompositionView::resolve(requires~ : Array[Capability], model~ : &ModelPort, decision? : &DecisionPort?, log? : &LogPort?, ui~ : &UiPort, ui_resources? : UiResources?, ui_interactions? : UiInteractions?, tasks? : Tasks?, wakeup? : WakeupPort?, tool_contributions? : ToolContributions?, events? : Events?) -> CompositionViewpub(all) enum DecisionAnswer {
BooleanAnswer(id~ : String, probability_true~ : Double)
ChoiceAnswer(id~ : String, selected~ : String, probabilities~ : Array[DecisionNamedProbability], confidence~ : Double?)
ScoreAnswer(id~ : String, score~ : Double, probabilities~ : Array[Double], confidence~ : Double?)
} derive(Eq, Debug)pub(all) struct DecisionCallContext {
purpose : String
scope : DecisionScope?
timeout_ms : Int?
failure_mode : DecisionFailureMode
} derive(Eq, Debug)fn DecisionCallContext::make(purpose~ : String, scope? : DecisionScope, timeout_ms? : Int, failure_mode? : DecisionFailureMode) -> DecisionCallContextfn DecisionNamedProbability::not_equal(x : DecisionNamedProbability, y : DecisionNamedProbability) -> Boolpub(all) struct DecisionRequest {
state : Json
questions : Array[DecisionQuestion]
} derive(Eq, Debug)pub(all) struct DecisionResult {
answers : Array[DecisionAnswer]
model : String?
usage : DecisionUsage?
} derive(Eq, Debug)fn DecisionResult::validate_for(self : DecisionResult, request : DecisionRequest) -> Unit raise DecisionErrorpub(all) struct ExtensionManifest {
id : String
models : Array[&ModelPort]
decisions : Array[&DecisionPort]
logs : Array[&LogPort]
tools : Array[&ToolProvider]
sessions : Array[&SessionPort]
observers : Array[&Observer]
hooks : Array[&PipelineHook]
memory : Array[&MemoryPort]
lifecycle : Array[&Lifecycle]
commands : Array[&CommandPort]
ui : Array[&UiPort]
prompt_contributors : Array[&SystemPromptContributor]
requires : Array[Capability]
tool_call_owners : Array[String]
}fn ExtensionManifest::ExtensionManifest(id~ : String, models? : Array[&ModelPort], decisions? : Array[&DecisionPort], logs? : Array[&LogPort], tools? : Array[&ToolProvider], sessions? : Array[&SessionPort], observers? : Array[&Observer], hooks? : Array[&PipelineHook], memory? : Array[&MemoryPort], lifecycle? : Array[&Lifecycle], commands? : Array[&CommandPort], ui? : Array[&UiPort], prompt_contributors? : Array[&SystemPromptContributor], requires? : Array[Capability], tool_call_owners? : Array[String]) -> ExtensionManifestpub(all) enum HookStage {
ModelCompleted(completion~ : Completion)
ToolCompleted(call~ : ToolCall, outcome~ : ToolOutcome)
ToolFailed(call~ : ToolCall, reason~ : String)
ModelFailed(failure~ : ModelFailure)
} derive(Debug)pub(all) struct LogRecord {
level : LogLevel
source : String
channel : String
event : String
message : String?
scope : EventScope?
data : Json
} derive(Eq, Debug)impl Show for ProviderConfigfn ProviderConfig::ProviderConfig(reasoning_effort_values~ : Array[String], context_window? : Int?, compact_threshold? : Double?) -> ProviderConfigpub struct TaskHandle {
// private fields
}fn TaskHandle::from_callbacks(receipt~ : TaskReceipt, wait~ : async (TaskReceipt) -> TaskOutcome, cancel~ : (TaskReceipt) -> Unit) -> TaskHandlepub struct Tasks {
// private fields
}pub struct ToolCallContext {
effect_id : EffectId
call_id : CallId
name : ToolName
arguments : Json
register_cancel : (&ToolCancellable) -> Unit
scope : InvocationScope?
parent_effect_id : EffectId?
root_effect_id : EffectId
// private fields
}fn ToolCallContext::ToolCallContext(effect_id~ : EffectId, call_id~ : CallId, name~ : ToolName, arguments~ : Json, register_cancel~ : (&ToolCancellable) -> Unit, scope? : InvocationScope, parent_effect_id? : EffectId, root_effect_id? : EffectId, tools? : () -> Array[ToolDef], invoke? : async (String, Json) -> InvocationResult, active? : () -> Bool) -> ToolCallContextasync fn ToolCallContext::invoke(self : ToolCallContext, name : String, arguments : Json) -> InvocationResult raise RuntimeErrorpub(all) struct ToolContributionCommit {
owner : String
revision : Int
state : ToolContributionState
} derive(Eq, Debug)fn ToolContributionCommit::not_equal(x : ToolContributionCommit, y : ToolContributionCommit) -> Boolpub(all) enum ToolContributionError {
Closed
NotContributed
Rejected(reason~ : String)
CleanupPending(revision~ : Int, state~ : ToolContributionState, detail~ : String)
} derive(Eq, Debug)impl Show for ToolContributionErrorimpl Show for ToolContributionStatepub struct ToolContributions {
// private fields
}fn ToolContributions::from_callbacks(owner~ : String, replace~ : async (&ToolProvider, async () -> Result[Unit, String]?) -> Result[ToolContributionCommit, ToolContributionError] noraise, withdraw~ : async (ToolWithdrawMode) -> Result[ToolContributionCommit, ToolContributionError] noraise, revision~ : () -> Int?, state~ : () -> ToolContributionState) -> ToolContributionsasync fn ToolContributions::replace(self : ToolContributions, provider~ : &ToolProvider, retire? : async () -> Result[Unit, String]) -> Result[ToolContributionCommit, ToolContributionError] noraiseasync fn ToolContributions::withdraw(self : ToolContributions, mode? : ToolWithdrawMode) -> Result[ToolContributionCommit, ToolContributionError] noraiseimpl Show for ToolDecisionimpl Show for ToolWithdrawModepub(all) struct UiActionInvocation {
resource : UiResourceRef
revision : Int
action : String
request_id : String
payload : Json?
} derive(Eq, Debug)pub(all) struct UiActionRequest {
resource : UiResourceRef
action : String
expected_revision : Int
request_id : String
payload : Json?
} derive(Eq, Debug)pub(all) struct UiActionResult {
request_id : String
resource : UiResourceRef
action : String
revision : Int
replayed : Bool
} derive(Eq, Debug)pub(all) struct UiActionSpec {
id : String
label : String
payload : UiActionPayloadKind
} derive(Eq, Debug)pub(all) struct UiBaseline {
cursor : UiCursor
interaction_cursor : UiCursor
resources : Array[UiResourceSnapshot]
pending_interactions : Array[UiInteractionSnapshot]
} derive(Eq, Debug)pub(all) enum UiChange {
Resource(change~ : UiResourceChange)
Interaction(change~ : UiInteractionChange)
} derive(Eq, Debug)pub struct UiHost {
// private fields
}fn UiHost::answer(self : UiHost, request~ : UiInteractionAnswerRequest) -> Result[UiInteractionAnswerReceipt, UiInteractionError]fn UiHost::connect(self : UiHost, capabilities~ : UiHostCapabilities) -> Result[UiHostConnection, UiInteractionError]fn UiHost::dismiss(self : UiHost, interaction~ : UiInteractionRef, reason? : String) -> Result[UiInteractionOutcome, UiInteractionError]async fn UiHost::dispatch(self : UiHost, request~ : UiActionRequest) -> Result[UiActionResult, UiResourceError] noraisefn UiHost::from_callbacks(snapshot~ : () -> Result[UiBaseline, UiResourceError], changes_since~ : (UiCursor) -> Result[UiChanges, UiResourceError], interactions_since~ : (UiCursor) -> Result[UiInteractionChanges, UiResourceError], dispatch~ : async (UiActionRequest) -> Result[UiActionResult, UiResourceError] noraise, answer~ : (UiInteractionAnswerRequest) -> Result[UiInteractionAnswerReceipt, UiInteractionError], dismiss~ : (UiInteractionRef, String) -> Result[UiInteractionOutcome, UiInteractionError], subscribe~ : ((UiFeedBatch) -> Result[Unit, String], (UiListenerFailure) -> Unit) -> Result[UiObservation, UiResourceError], connect? : (UiHostCapabilities) -> Result[UiHostConnection, UiInteractionError]) -> UiHostfn UiHost::interactions_since(self : UiHost, cursor~ : UiCursor) -> Result[UiInteractionChanges, UiResourceError]fn UiHost::subscribe(self : UiHost, listener~ : (UiFeedBatch) -> Result[Unit, String], on_failure~ : (UiListenerFailure) -> Unit) -> Result[UiObservation, UiResourceError]pub(all) struct UiHostCapabilities {
resource_kinds : Array[UiResourceKind]
fallback : Bool
interactions : Array[UiInteractionKind]
} derive(Eq, Debug)fn UiHostCapabilities::new(resource_kinds? : Array[UiResourceKind], fallback? : Bool, interactions? : Array[UiInteractionKind]) -> UiHostCapabilitiespub struct UiHostConnection {
// private fields
}fn UiHostConnection::answer(self : UiHostConnection, request~ : UiInteractionAnswerRequest) -> Result[UiInteractionAnswerReceipt, UiInteractionError]fn UiHostConnection::dismiss(self : UiHostConnection, interaction~ : UiInteractionRef, reason? : String) -> Result[UiInteractionOutcome, UiInteractionError]fn UiHostConnection::from_callbacks(id~ : Int, is_connected~ : () -> Bool, update~ : (UiHostCapabilities) -> Result[Unit, UiInteractionError], detach~ : () -> Result[Unit, UiInteractionError], answer~ : (UiInteractionAnswerRequest) -> Result[UiInteractionAnswerReceipt, UiInteractionError], dismiss~ : (UiInteractionRef, String) -> Result[UiInteractionOutcome, UiInteractionError]) -> UiHostConnectionfn UiHostConnection::update(self : UiHostConnection, capabilities~ : UiHostCapabilities) -> Result[Unit, UiInteractionError]pub(all) struct UiHostConnectionSupport {
connection : Int
support : UiHostSupport
} derive(Eq, Debug)fn UiHostConnectionSupport::not_equal(x : UiHostConnectionSupport, y : UiHostConnectionSupport) -> Boolimpl Show for UiInteractionAnswerpub(all) struct UiInteractionAnswerReceipt {
interaction : UiInteractionRef
answer : UiInteractionAnswer
replayed : Bool
} derive(Eq, Debug)fn UiInteractionAnswerReceipt::equal(UiInteractionAnswerReceipt, UiInteractionAnswerReceipt) -> Boolfn UiInteractionAnswerReceipt::not_equal(x : UiInteractionAnswerReceipt, y : UiInteractionAnswerReceipt) -> Boolpub(all) struct UiInteractionAnswerRequest {
interaction : UiInteractionRef
answer : UiInteractionAnswer
} derive(Eq, Debug)fn UiInteractionAnswerRequest::equal(UiInteractionAnswerRequest, UiInteractionAnswerRequest) -> Boolfn UiInteractionAnswerRequest::not_equal(x : UiInteractionAnswerRequest, y : UiInteractionAnswerRequest) -> Boolpub(all) enum UiInteractionChange {
Opened(snapshot~ : UiInteractionSnapshot)
Settled(owner~ : String, request_id~ : String, outcome~ : UiInteractionOutcome)
} derive(Eq, Debug)pub(all) struct UiInteractionChanges {
cursor : UiCursor
changes : Array[UiInteractionChange]
} derive(Eq, Debug)pub(all) enum UiInteractionError {
Closed
NotFound(owner~ : String, request_id~ : String)
Duplicate(request_id~ : String)
InvalidInput(reason~ : String)
InvalidAnswer(reason~ : String)
AlreadySettled(outcome~ : UiInteractionOutcome)
Conflict(reason~ : String)
PendingFull(limit~ : Int)
HostUnavailable(reason~ : String)
ConnectionsFull(limit~ : Int)
Dismissed(reason~ : String)
Withdrawn
} derive(Eq, Debug)impl Show for UiInteractionErrorpub(all) enum UiInteractionOutcome {
Answered(answer~ : UiInteractionAnswer)
Dismissed(reason~ : String)
Withdrawn
WaitCancelled
Closed
} derive(Eq, Debug)impl Show for UiInteractionOutcomepub(all) struct UiInteractionRequest {
request_id : String
scope : UiResourceScope
prompt : String
body : UiInteractionBody
title : String?
} derive(Eq, Debug)fn UiInteractionRequest::new(request_id~ : String, prompt~ : String, body~ : UiInteractionBody, scope? : UiResourceScope, title? : String) -> UiInteractionRequestpub(all) struct UiInteractionSnapshot {
interaction : UiInteractionRef
scope : UiResourceScope
prompt : String
body : UiInteractionBody
title : String?
} derive(Eq, Debug)pub struct UiInteractions {
// private fields
}async fn UiInteractions::ask(self : UiInteractions, request~ : UiInteractionRequest) -> Result[UiInteractionAnswer, UiInteractionError] noraisefn UiInteractions::find(self : UiInteractions, request_id~ : String) -> Result[UiInteractionSnapshot, UiInteractionError]fn UiInteractions::from_callbacks(owner~ : String, open~ : (UiInteractionRequest) -> Result[UiInteractionSnapshot, UiInteractionError], wait~ : async (UiInteractionRef) -> Result[UiInteractionAnswer, UiInteractionError] noraise, withdraw~ : (UiInteractionRef) -> Result[UiInteractionOutcome, UiInteractionError], find? : (String) -> Result[UiInteractionSnapshot, UiInteractionError], ask? : async (UiInteractionRequest) -> Result[UiInteractionAnswer, UiInteractionError] noraise) -> UiInteractionsfn UiInteractions::open(self : UiInteractions, request~ : UiInteractionRequest) -> Result[UiInteractionSnapshot, UiInteractionError]async fn UiInteractions::wait(self : UiInteractions, interaction~ : UiInteractionRef) -> Result[UiInteractionAnswer, UiInteractionError] noraisefn UiInteractions::withdraw(self : UiInteractions, interaction~ : UiInteractionRef) -> Result[UiInteractionOutcome, UiInteractionError]pub(all) enum UiResourceChange {
Published(snapshot~ : UiResourceSnapshot)
Replaced(snapshot~ : UiResourceSnapshot)
Withdrawn(owner~ : String, key~ : String, revision~ : Int)
} derive(Eq, Debug)pub(all) struct UiResourceDraft {
key : String
kind : UiResourceKind
scope : UiResourceScope
lifetime : UiResourceLifetime
title : String?
body : UiResourceBody
actions : Array[UiActionSpec]
} derive(Eq, Debug)fn UiResourceDraft::new(key~ : String, kind~ : UiResourceKind, body~ : UiResourceBody, scope? : UiResourceScope, lifetime? : UiResourceLifetime, title? : String, actions? : Array[UiActionSpec]) -> UiResourceDraftpub(all) enum UiResourceError {
Closed
Unsupported(feature~ : String)
NotFound(owner~ : String, key~ : String)
StaleRevision(expected~ : Int, actual~ : Int)
InvalidInput(reason~ : String)
Conflict(reason~ : String)
InProgress(request_id~ : String)
HandlerFailed(detail~ : String)
SnapshotRequired(reason~ : String)
} derive(Eq, Debug)impl Show for UiResourceErrorfn UiResourceKind::custom(namespace_~ : String, name~ : String, schema_version? : Int) -> UiResourceKindpub(all) struct UiResourceSnapshot {
resource : UiResourceRef
revision : Int
kind : UiResourceKind
scope : UiResourceScope
lifetime : UiResourceLifetime
title : String?
body : UiResourceBody
actions : Array[UiActionSpec]
} derive(Eq, Debug)pub struct UiResources {
// private fields
}fn UiResources::from_callbacks(owner~ : String, publish~ : (UiResourceDraft) -> Result[UiResourceSnapshot, UiResourceError], replace~ : (UiResourceDraft, Int) -> Result[UiResourceSnapshot, UiResourceError], remove~ : (UiResourceRef) -> Result[Int, UiResourceError], set_action_handler~ : (async (UiActionInvocation) -> Result[Unit, String]) -> Result[Unit, UiResourceError], operation? : () -> Result[UiResources, UiResourceError], host_support? : (UiResourceRef) -> Result[Array[UiHostConnectionSupport], UiResourceError]) -> UiResourcesfn UiResources::host_support(self : UiResources, resource~ : UiResourceRef) -> Result[Array[UiHostConnectionSupport], UiResourceError]fn UiResources::publish(self : UiResources, draft~ : UiResourceDraft) -> Result[UiResourceSnapshot, UiResourceError]fn UiResources::remove(self : UiResources, resource~ : UiResourceRef) -> Result[Int, UiResourceError]fn UiResources::replace(self : UiResources, draft~ : UiResourceDraft, expected~ : Int) -> Result[UiResourceSnapshot, UiResourceError]fn UiResources::set_action_handler(self : UiResources, handler~ : async (UiActionInvocation) -> Result[Unit, String]) -> Result[Unit, UiResourceError]impl Show for UiResponsepub struct UiSubscription {
// private fields
}fn UiSubscription::from_callbacks(id~ : Int, is_active~ : () -> Bool, unsubscribe~ : () -> Unit) -> UiSubscriptionpub struct WakeupPort {
// private fields
}fn WakeupPort::from_request(request~ : (String, String, String) -> Result[WakeupTicket, WakeupError]) -> WakeupPortfn WakeupPort::request(self : WakeupPort, session~ : String, tag~ : String, note? : String) -> Result[WakeupTicket, WakeupError]Install
Download zipLLM Agent framework with hexagonal (ports-and-adapters) architecture. Defines extension ports + Agent loop.