Every hosted extension exports a default function receiving pi:
export default function extension(pi) {
  // Register tools and lifecycle handlers here.
}
The module is imported during manifest discovery and when the sandbox extension host starts. Keep top-level registration deterministic and free of network calls or mutable workspace work.

Methods

MethodPurposeWhen to call
registerTool(tool)Register a model-callable sandbox toolDuring extension initialization
on(event, handler)Subscribe to a hosted lifecycle eventDuring extension initialization
setModel(selection)Select a model and optional thinking levelInside before_agent_start
setActiveTools(names)Select tools for the turn/sessionInside before_agent_start

Context boundary

Tools and hook handlers run inside the sandbox extension host. They can use projected agent resources and the mutable agent workspace. They do not execute in trusted worker memory. The runtime handler context currently exposes:
{
  external: RuntimeExternalEventContext | null;
}
See external event context for the exact fields.

JavaScript contract

Salambo currently documents runnable .mjs modules. There is no published TypeScript extension SDK to import. You may use your own build step, but the declared entrypoint must be JavaScript that the managed runtime can import.