Expand description
Extensions: code that registers tools and commands with a session and
handles its events, as pi’s extension runner (core/extensions in pi
v1.0.0) runs them.
This is the part of pi’s ExtensionAPI that the built-in extensions use.
The wasm host in yapi-ext implements Extension for loaded packages with
the same contract. Each session gets its own extension instances. A
replaced session receives session_shutdown before its successor starts.
Modules§
- codemode
- What other parts of a session know about the
codemodetool, whichyapi-extimplements: its name, schema and prompt text, and how to tell the genuine tool from another extension’s tool of the same name. - discovery
- Which files load as extensions: pi’s extension entry rules
(
core/extensions/loader.tsin piv1.0.0). - tool_
search - The
tool_searchtool: a BM25 ranker over the metadata of tools that are not declared to the model (codemodeanddeferredexposure), which activates the matches for the next model call. Port ofextensions/tool-searchin piv1.0.0.
Structs§
- Bash
Operations - pi’s
BashOperations: operations auser_bashhandler returned to run a!command with. - Command
- A slash command an extension registered.
- Context
- What an extension can reach while handling an event or command.
- Custom
Options - The options of pi’s
custom: how a custom component is shown. - Dialog
Options - pi’s
ExtensionUIDialogOptions: when a dialog closes on its own. - Event
Policy - The
pi.eventschannels an extension may send to, and hear from, extensions whose grants differ from its own. Each pattern is an exact channel, a prefix ending in*, or*for every channel. - Grants
- What an extension may reach. The default grants everything, as pi does.
- Loadout
- pi’s
ToolLoadout: the tools a loadout hook sees. - Loadout
Changes - pi’s
ToolLoadoutChanges: what a loadout hook changes. - NoUi
- The UI of print and JSON modes: nothing is shown.
- Remote
Component - A pi-tui component that lives in an extension runtime.
- Renderers
- What an extension draws in the transcript.
- Resolved
Command - pi’s
ResolvedCommand: an extension command with the name it is invoked by. - Shortcut
- A key an extension binds with pi’s
registerShortcut. - Shortcut
Binding - An extension shortcut the interactive mode honors.
- Terminal
State - What extensions see of the terminal.
- Tool
Info - pi’s
ToolInfo: a tool as extensions see it. - Tool
Renderers - pi’s
renderCall,renderResultandrenderShell: how an extension draws one of its tools. - Tools
- The session’s tools, shared with its extensions.
- Working
Indicator - pi’s
WorkingIndicatorOptions: the animation shown while the agent works.
Enums§
- Mode
- pi’s
ExtensionMode: the mode a session runs in. - Model
Update - A provider’s new models from a refresh.
- Notify
Kind - How a notification is shown.
- Placement
- pi’s
WidgetPlacement: where a widget goes. - Session
Action - A session change an extension command asks for, one of pi’s
ExtensionCommandContextActions. - Widget
- What a widget shows.
Constants§
- CAPABILITIES
- The capabilities a manifest grants, in the order yapi lists them. Each
but
allgives one grant, andallgives every grant, running processes included.none, which grants nothing, stands alone. - RESERVED_
ACTIONS - pi’s
RESERVED_KEYBINDINGS_FOR_EXTENSION_CONFLICTS: actions whose keys extensions may not take.
Traits§
- Component
Host - The extension runtime side of components: renders them and delivers input to them.
- Extension
- An extension. Every hook has a no-op default.
- Extension
Ui - pi’s
ExtensionUIContextas a mode implements it. Dialogs a mode cannot show resolve as cancelled. Everything else does nothing by default.
Functions§
- builtin_
source - pi’s source info for a built-in extension named
name. - builtins
- The built-in extensions each session starts with.
- delivers
- Whether an event on
channelfrom an extension withsender’s grants and policy reaches one withreceiver’s: always between identical grants, since neither gains anything, and otherwise when the sender may send the channel and the receiver may hear it. - receives
- Whether an extension with
grantshears pi eventkind. The provider request events carry the request’s body and headers, credentials included, which only the network grant may read. - resolve_
shortcuts - pi’s
getShortcuts: the shortcuts ofextensionsin load order, given the keys bound to each built-in action. A key a reserved action uses is refused. Another built-in key, or one an earlier extension took, goes to the later extension. Returns the bindings and pi’s warnings, each with the path of the extension it concerns. - tool_
granted - Whether
grantsallow runningtool. The built-inbash,grepandfindrun processes, and the other built-in tools need file access. Any other tool, including one an extension registers under a built-in name, may reach anything, so it needs every grant.
Type Aliases§
- Model
List - A provider’s new models from a refresh, or why it failed.
- Session
Actions - How a mode carries out
SessionActions: whether an extension cancelled the change, or why it failed. - Setup
- pi’s
newSessionsetup: runs with the replacement session once it is built, before its extensions start.