Hosts

OMP

registerOmpTools puts every tool on OMP with an approval tier and a status line. Built around the TypeBox rewrite OMP does behind your back
IDomp03 / 04@oh-my-pi/pi-coding-agent
Host / OMP

OMP extension

OMP's registerTool with approval, status lines and the TypeBox trap defused.

label
Text Slug
approval
read
parameters
Type.Unsafe(json)
failure
isError or thrown

Access

Importimport { registerOmpTools } from "@agntn/tools/omp"
Peer@oh-my-pi/pi-coding-agent >=18.0.0 <19
FailsisError, bad input thrown
tspackages/omp/extensions/mypackage.ts
import type { ExtensionAPI } from "@oh-my-pi/pi-coding-agent";
import { Text } from "@oh-my-pi/pi-coding-agent";
import { registerOmpTools } from "@agntn/tools/omp";

export default async function (pi: ExtensionAPI) {
  pi.setLabel("My package");
  const { tools } = await import("../../../src/tools.ts");
  registerOmpTools(pi, tools, { Text });
}

The TypeBox rewrite

OMP rewrites every bare typebox import in an extension to its own omptype facade. Your schema turns into a function. A Value.Check from typebox/value, which OMP leaves alone, then accepts anything at all. Nobody tells you. You find out when a model sends garbage and your code runs with it.

Three things keep that away from you. Type comes from @agntn/tools, where TypeBox is bundled, so there's no bare import to rewrite. defineTool refuses a schema that's a function. And the adapter hands OMP the plain JSON Schema through the host's own pi.typebox.Type.Unsafe, which validates it with OMP's full JSON Schema validator and keeps pattern and maxLength in what the model sees.

Bundling fixed the startup cost too. Unbundled, TypeBox is hundreds of small modules, and every one of them goes through OMP's loader on every start. That was about 200 ms per extension on OMP 18.4.4. Bundled it's about 20, which is noise.

Optional means optional

Want an optional field to stay optional? You don't have to do anything. registerOmpTools sets strict: false on every tool. There's no option to turn it back on.

OMP's OpenAI serializers otherwise make every property required. They rewrite optional types to also accept null. Apparently, optional means "please fill this in with x." That's a bad default for tools.

A wiki update accepts body or body_edits, never both. With body: "" beside body_edits, it refused ten times out of ten: body and bodyEdits are mutually exclusive. And null doesn't help. The core validates against the original schema and refuses it: Invalid arguments at /note: must be string.

So OMP sends your schema as written. Optional means optional, just like on Pi. Anthropic models aren't affected. OMP keeps strict there for its own tools only.

Approval and failures

A tool that starts a whole coding agent isn't just a write. Give process starters and code runners effect: "exec". OMP maps read to read, both write and destructive to write, and exec to exec. In write mode, OMP asks before running an exec tool. The status line wears the tier as a badge: ⟦exec⟧.

A returned isError stays a result, OMP reads it off the object. A bad input throws before execute.

What about a throw with a cause? The model can't read a 502 on a cause object. So the message carries the same caused by: lines as MCP. The original error rides along as cause.

Top level or behind discovery

OMP files every extension tool under discoverable unless you say otherwise. The model won't find it in the tool list. It has to go looking first. Fine for a memory tool it needs twice a day. A cipher library, though? There the whole point is the model reaching for ciphers_decode without a scavenger hunt.

ts
registerOmpTools(pi, tools, { Text, loadMode: "essential" });

loadMode goes to every tool in the list unchanged. Leave it out and OMP decides, same as before.

Status lines

The adapter draws the call and result lines with the host theme, never with an import from @oh-my-pi/pi-coding-agent/tui. Compiled OMP gives an extension only the package root, and one import from /tui stops the whole extension from loading. That's why Text comes in as an option: you import it in the extension file, where OMP can see it.

ts
registerOmpTools(pi, tools, {
  Text,
  renderers: {
    text_slug: {
      describeCall: (args) => args.text,
      describeResult: ({ details }) => [`${(details as SlugDetails).words} words`],
    },
  },
});

A status line isn't an answer. The model got to read the result, so you get to read it too. Below the status line, the adapter shows the same answer text. Collapsed, it shows four lines and a dimmed "… N more lines". That's OMP's collapsed count for its own MCP tools. Expanded, it shows every line.

A blank answer leaves just the status line. Errors show their text too, but drop the describeResult facts so a failed call doesn't show a stale summary. Status line values go through sanitizeLine. Answer text goes through sanitizeText, which keeps line breaks and strips escape sequences and control characters.

Want a different preview shape, like more lines collapsed? Pass renderResult. It replaces the status line and the answer beneath it. Is the one-line call too modest? Say it should fit the terminal width. Pass renderCall. It replaces the whole call line, describeCall included. Sanitizing what either custom renderer draws is your job.

While the call runs, the latest progress line sits dimmed next to the spinner. The badge and facts wait for the real answer. Got your own renderResult? It sees those partial results too. isPartial tells you which is which.

Questions

ask opens the same ctx.ui dialogs as in Pi. One per field. A bad value gets a warning and another try. Escape means cancel. No UI, no ask.