Skip to main content

Module extension

Module extension 

Source

Structs§

AfterToolCallResult
Partial override returned from after_tool_call (matching pi’s AfterToolCallResult). Merge semantics are field-by-field: provided fields replace the original; omitted fields keep their values.
AutocompleteItem
An autocomplete item for slash command arguments.
BeforeCompactResult
Result returned from before_compact (matching pi’s SessionBeforeCompactResult). Returning { cancel: true } prevents compaction.
BeforeToolCallResult
Result returned from before_tool_call (matching pi’s BeforeToolCallResult). Returning { block: true } prevents execution; reason becomes the error text.
Cancel
Simple cancellation token for tool execution. Shared between the agent loop and tool execution to signal cancellation.
SlashCommand
A registered slash command.
ToolDefinition
A tool bundled with its prompt metadata.
ToolRenderContext
Context passed to ToolRenderer methods (matching pi’s ToolRenderContext). Carries all metadata about the tool execution that renderers may need.
ValidationError
A single validation error, matching pi’s TypeBox error structure.

Enums§

CommandResult
Result of executing a slash command.

Traits§

CommandHandler
A slash command handler (built-in or extension-provided). Commands use the same Extension trait as tools - built-ins and user extensions register commands through a uniform interface.
Extension
ToolRenderer
Tool-specific rendering interface (matching pi’s renderCall/renderResult pattern). Each built-in tool implements this to provide its own visual representation.

Functions§

coerce_primitive_by_type
Coerce a single JSON value to match a JSON Schema type (modifies in place). This handles common LLM mistakes: sending numbers as strings, booleans as strings, etc.
coerce_with_json_schema
Recursively coerce tool arguments to match a JSON Schema (modifies in place).
validate_tool_arguments
Validate tool arguments against its JSON Schema (matching pi’s validateToolArguments).