/** * Commands over HTTP (SPEC.md §14, §43). * * Every mutation in Assemora is a command, and every caller — Studio, the SDK, the * CLI, an agent — sends the same one. These endpoints are that bus reached over * HTTP: one `POST /commands/` per registered command, generated from what the * command described about itself. * * Mounting all of them is safe by construction rather than by care. The bus runs * validation, authorization, the transaction, revisions and audit before a handler * sees anything, and authorization denies by default (SPEC.md §12, §50). An endpoint * exists for `auth.users.create`; reaching it without the permission answers 403. * * The exception is a command that has none of that floor because it is *publicly* * authorized — a login is callable by somebody who is nobody yet. Such a command * declares `reachableFrom: 'its own route'`, and this generator skips it: the checks * that make it safe live in the route written for it, and a generic alias would be a * second door past all of them (SPEC.md §85). */ import type { CommandBus, CommandReach, SchemaRegistry } from '@assemora/core'; import { type JsonSchema, type Schema } from '@assemora/schema'; import type { Route } from './route.js'; /** The part of a command description these endpoints need. */ export type CommandEndpoint = { readonly name: string; readonly description?: string; readonly input: JsonSchema; /** Absent when the command did not say what it answers with. */ readonly output?: JsonSchema; readonly module?: string; readonly reachableFrom?: CommandReach; }; /** * A response the route documents but does not judge. * * The registry keeps a command's output as JSON Schema, and the handler's answer is * the application's own truth: parsing it here would turn a description that fell * behind the handler into a 500 for every caller, which is a worse outcome than a * document that is wrong (SPEC.md §42). */ export declare const documented: (output: JsonSchema) => Schema; /** * Reads the command descriptions out of the registry, whoever put them there — * except the ones that said a route written for them is the only way in. */ export declare const commandEndpoints: (registry: SchemaRegistry) => CommandEndpoint[]; /** What a caller may say about the endpoints this generates. */ export type CommandRouteOptions = { /** * A ceiling of its own for named commands, in bytes, keyed by command name. * * Every command answers at one generated address, so a command that carries a file * — `media.upload`, whose input is base64 — cannot be given room without giving the * same room to `auth.users.create`. Naming it here keeps the wide ceiling on the one * endpoint that needs it (SPEC.md §85). */ readonly bodyLimit?: Readonly>; }; export declare const commandRoutes: (endpoints: readonly CommandEndpoint[], commands: CommandBus, options?: CommandRouteOptions) => Route[]; //# sourceMappingURL=commands.d.ts.map