API
Package entrypoints
The package's exported TypeScript declarations are the authoritative symbol reference. The main
application path is loadAgent() plus runHeypi(). Use createHeypi() when an embedding host needs
to control startup or inject a Pi host factory.
Adapter events
Stable event discriminants:
message_acceptedmessage_queuedmessage_steeredmessage_rejectedmessage_failedturn_startedtool_startedtodo_changedmessage_completedturn_canceledturn_failed
Pi-derived events are normalized before adapters receive them. A custom event handler replaces the
adapter default; setting an event to false disables it.
slack({
token,
appToken,
events: {
message_queued: false,
},
});Core contracts
Adapterowns transport lifecycle, delivery, optional updates, attachment materialization, and approval UI.ChatMessageis normalized inbound identity and routing data.RuntimeProviderowns every Pi file and command tool for one runtime instance.ApprovalPolicyreturns allow, approval, or block decisions at a tool boundary.ScheduleDefinitiondescribes a cron prompt or trusted handler.
See the custom adapter, custom runtime, and custom tool guides for implementations.