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) -> 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], options : ChatOptions, trigger : CompactTrigger) -> CompactResult raise ModelError
fn provider_config(Self) -> ProviderConfig
}pub(open) trait Observer {
fn on_event(Self, event : TurnEvent) -> Unit = _
fn on_event_at(Self, scope : EventScope?, event : TurnEvent) -> Unit = _
}pub(open) trait PipelineHook {
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, stage : HookStage) -> Unit noraise = _
async fn on_post_event_at(Self, scope : EventScope?, stage : HookStage) -> Unit noraise = _
async fn on_turn_begin(Self) -> Unit = _
async fn on_turn_end(Self) -> Unit = _
}pub(open) trait SessionStore {
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 ToolProvider {
fn list_tools(Self) -> Array[ToolDef]
async fn execute(Self, name : String, call : ToolCall) -> 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, tasks? : Tasks?) -> 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)fn 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[&SessionStore]
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]
}fn ExtensionManifest::ExtensionManifest(id~ : String, models? : Array[&ModelPort], decisions? : Array[&DecisionPort], logs? : Array[&LogPort], tools? : Array[&ToolProvider], sessions? : Array[&SessionStore], 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]) -> 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
}impl Show for ToolDecisionimpl Show for UiResponseInstall
Download zipLLM Agent framework with hexagonal (ports-and-adapters) architecture. Defines extension ports + Agent loop. Depends on moonbitlang/async and colmugx/fuwaroid.
Dependencies