Results and errors
Result values, yielded read errors, Effect tags, and thrown AgentKitError.
Result values
@rivus/agent-kit/catalog exports isBuiltinCodingAgentId, Result, ok, err, AgentKitError and isAgentKitError. It runs anywhere. /catalog retains AgentKitError and isAgentKitError so callers can recognize errors from shell functions.
loadTranscriptandsummarizeSessionresolve to aResult:{ ok: true, value }or{ ok: false, error }, whereerror._tagnames the failure.loadTranscriptandsummarizeSessionfail withSessionNotFound,ReadFailed,UnknownFormatGeneration,NoAdapterAcceptedorCapabilityUnsupported.detectAgentsresolves toInstallation[]. A failed probe is recorded in that Agent'sproblems.listSessionsyields{ ref, error }for a missing root (RootMissing) or an unreadable file (ReadFailed) and goes on with the next one.scanUsageyields{ agent, path, error }items the same way.- When the
signaloption aborts, the call rejects withsignal.reason. /acpfails Effects with the same kind of_tagerrors:AgentUnavailableandHandshakeFailedfromconnectAgent;AuthRequired,AcpTimeout,AcpRequestFailed,ConnectionClosed,BindingNotFound,LoadUnsupportedandSessionBindingStoreFailurefrom opening sessions;TurnInProgress,SessionClosedandCancelUnsettledfrom turns.
Thrown errors
- Programming errors and defects throw. Naming an Agent without a session adapter in
listSessions({ agents }), or without a hook dialect inreadHookEvent, throws anAgentKitErrorwithcode: "capability-unsupported". Test for it withisAgentKitError.summarizeSessionthrows the same way, withcode: "invalid-prompts", forpromptscaps that are not whole numbers in range.readHookEventnever throws because of a payload.
Effect tags
Lease failures are typed values with a _tag: LeaseHeld, LeaseLost, LeaseConfigInvalid, LeaseRepositoryFailure and the repository's RevisionConflict. The kit runs no Effect itself. Run the program at your application's assembly root.
Lane failures are typed values with a _tag: LaneQueueFull, LanesClosed and LanesConfigInvalid.
applyInstall dies with an AgentKitError whose code is "unknown-plan" when the plan was not returned by planInstall. Re-plan after PlanStale or TargetChanged. A PlanConflict names, per conflict, the choices that resolve it ("force", "adopt", "backup").