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 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 MemoryPort {
async fn store(Self, entry : MemoryEntry) -> String raise MemoryError
async fn search(Self, query : MemoryQuery) -> Array[MemoryEntry] raise MemoryError
async fn delete(Self, id : String) -> Unit raise MemoryError
}pub(open) trait ModelPort {
async fn chat(Self, scope : InvocationScope, messages : Array[Message], tools : Array[ToolDef], options : ChatOptions, stream : StreamMode) -> ModelCallResult raise ModelError
async fn compact(Self, scope : InvocationScope, messages : Array[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
}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, ui~ : &UiPort) -> CompositionViewpub(all) struct ExtensionManifest {
id : String
models : Array[&ModelPort]
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]
}pub(all) enum HookStage {
ModelCompleted(completion~ : Completion)
ToolCompleted(call~ : ToolCall, outcome~ : ToolOutcome)
ToolFailed(call~ : ToolCall, reason~ : String)
ModelFailed(failure~ : ModelFailure)
} derive(Debug)impl Show for ProviderConfigfn ProviderConfig::ProviderConfig(reasoning_effort_values~ : Array[String], context_window? : Int?, compact_threshold? : Double?) -> ProviderConfigimpl Show for ToolDecisionimpl Show for UiResponseLLM Agent framework with hexagonal (ports-and-adapters) architecture. Defines 9 traits + Agent loop. Depends on moonbitlang/async.
Dependencies