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 {
async fn on_shutdown(Self) -> Unit
}pub(open) trait MemoryPort {
fn store(Self, entry : MemoryEntry) -> String raise MemoryError
fn search(Self, query : MemoryQuery) -> Array[MemoryEntry] raise MemoryError
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 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(all) struct ExtensionManifest {
id : String
models : Array[&ModelPort]
tools : Array[&ToolProvider]
sessions : Array[&SessionStore]
observers : Array[&Observer]
hooks : Array[&Hook]
memory : Array[&MemoryPort]
lifecycle : Array[&Lifecycle]
commands : Array[&CommandPort]
ui : Array[&UiPort]
prompt_contributors : Array[&SystemPromptContributor]
}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 ProviderConfigimpl Show for UiResponseLLM Agent framework with hexagonal (ports-and-adapters) architecture. Defines 9 traits + Agent loop. Depends on moonbitlang/async.
Dependencies