crouter
Plugin

API reference

Every value and type exported by @crouter/plugin, read from the TypeScript compiler.

Every export of @crouter/plugin, read from the TypeScript compiler at build time and grouped by what it is used for. Types re-exported from @crouter/api are documented with that package.

Defining a plugin

The builders that declare a plugin and its command tree, and the shapes they produce.

definePlugin, defineBranch, defineLeaf, defineStreamingLeaf, PluginDefinition, BranchNode, LeafNode, LeafContext, LeafCaller, LeafCallerActor, MemoryDoc, kebab, PluginDefinitionError

Parameters

Declaring the flags, positionals and stdin input a leaf accepts.

param, AnyParam, Input, Encoding, FlagStringParam, FlagIntParam, FlagBoolParam, FlagEnumParam, FlagPathParam, PositionalParam, StdinParam

Output fields

Declaring the fields a leaf returns, and the object type they add up to.

field, OutField, Output, ObjectField, ArrayField, EnumField, FileField, FileOutputValue

Serving

Hosting a plugin behind an HTTP endpoint.

createFetchHandler, FetchHandlerOptions, FetchHandlerAuth, RequestIdentity, LeafAnswerEvent, RequestStore, createCallerVerifier, CallerVerifier

Receipts

Recording what a provider's tool call cost and sending it to the directory ledger.

postReceipt, Receipt, ReceiptOptions, ReceiptOutbox, ReceiptPostError

Bundle and manifest

Building a distributable bundle and the command manifest crtr reads from it.

buildBundle, BuildBundleOptions, BuildBundleResult, BuildBundleMemoryMember, buildCommandManifest, compareManifests, BreakingManifestChange, ManifestInvalidError

Errors

Failing a leaf with an exit code, a message and optional remediation.

LeafError, LeafErrorOptions, LeafErrorQuestion

On this page