//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts /** The Standard Typed interface. This is a base type extended by other specs. */ interface StandardTypedV1 { /** The Standard properties. */ readonly "~standard": StandardTypedV1.Props; } declare namespace StandardTypedV1 { /** The Standard Typed properties interface. */ interface Props { /** The version number of the standard. */ readonly version: 1; /** The vendor name of the schema library. */ readonly vendor: string; /** Inferred types associated with the schema. */ readonly types?: Types | undefined; } /** The Standard Typed types interface. */ interface Types { /** The input type of the schema. */ readonly input: Input; /** The output type of the schema. */ readonly output: Output; } /** Infers the input type of a Standard Typed. */ type InferInput = NonNullable["input"]; /** Infers the output type of a Standard Typed. */ type InferOutput = NonNullable["output"]; } /** The Standard Schema interface. */ interface StandardSchemaV1 { /** The Standard Schema properties. */ readonly "~standard": StandardSchemaV1.Props; } declare namespace StandardSchemaV1 { /** The Standard Schema properties interface. */ interface Props extends StandardTypedV1.Props { /** Validates unknown input values. */ readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; } /** The result interface of the validate function. */ type Result = SuccessResult | FailureResult; /** The result interface if validation succeeds. */ interface SuccessResult { /** The typed output value. */ readonly value: Output; /** A falsy value for `issues` indicates success. */ readonly issues?: undefined; } interface Options { /** Explicit support for additional vendor-specific parameters, if needed. */ readonly libraryOptions?: Record | undefined; } /** The result interface if validation fails. */ interface FailureResult { /** The issues of failed validation. */ readonly issues: ReadonlyArray; } /** The issue interface of the failure output. */ interface Issue { /** The error message of the issue. */ readonly message: string; /** The path of the issue, if any. */ readonly path?: ReadonlyArray | undefined; } /** The path segment interface of the issue. */ interface PathSegment { /** The key representing a path segment. */ readonly key: PropertyKey; } /** The Standard types interface. */ interface Types extends StandardTypedV1.Types {} /** Infers the input type of a Standard. */ type InferInput = StandardTypedV1.InferInput; /** Infers the output type of a Standard. */ type InferOutput = StandardTypedV1.InferOutput; } //#endregion //#region ../internal/src/operation-definition.d.ts /** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */ type OperationKind = "read" | "write" | "destructive"; /** The signed-in user of a call. */ interface OperationUser { id: string; name?: string; email?: string; image?: string; [key: string]: unknown; } /** The Agent Actor when an agent calls through a capability or MCP on behalf of a user. */ interface OperationActor { id: string; kind?: string; label?: string; meta?: object; } /** The checked Console access of a call. `vite-hub` issues it. `ConsoleAccess` has this shape. */ interface OperationAccess { readonly mode: string; /** * The sections that the call may use. `"all"` when no section filter applies. An entry is a section id (`"kv"`, every * operation of the section), `"
:read"` (only the operations that read), or `"
:"` (only the * calls of a scoped operation for that scope, such as `"blob:media"` for one Blob store). `"
::read"` * allows only the reads of that scope. */ readonly sections: "all" | readonly string[]; readonly user?: OperationUser; } interface OperationContext { /** The checked Console access of the call. */ access: OperationAccess; /** The signed-in user, or null. */ user: OperationUser | null; /** The Agent Actor when an agent calls on behalf of `user`. */ actor?: OperationActor; surface: "console" | "cli" | "mcp" | "agent"; /** Set by the host from generated build identity, never from request input or runtime NODE_ENV. */ development?: boolean; /** * The project root of a development server, for operations that read build files, such as `bundle.report`. Hosts set * it only with `development`, so a deployed server never reads project files through it. */ projectRoot?: string; env?: Record; waitUntil?: (task: Promise) => void; request?: Request; /** * The request event of the HTTP request that carries the call, when there is one: the Request of the Console route, * with its Standard Context. Operations hand it to app hooks that read the request's own session, such as `identify` * of Comments. */ event?: unknown; /** Operations set a success status here, such as 202 for an accepted call. */ response?: { status?: number; }; /** * An agent or an MCP client may pass `lease: "override"` to `content.save`, `content.remove`, and `content.restore` * only when the developer allowed it. Defaults to false, so a model cannot take over a document that a person is editing. */ overrideLeases?: boolean; /** * What an Agent may read of the Channel conversations, set by `operations({ conversations })`. `participant`: only the * threads that the Actor takes part in. `all`: every thread. Unset: none. */ conversations?: "all" | "participant"; } interface OperationDefinition { /** `
.`, such as `content.publish`. Unique per app. */ name: string; /** One sentence. Becomes the CLI help line and the MCP tool description. */ description: string; /** * Console section that grants access, such as `content`. `false`: any Console user. A function reads the section * from the input, for operations that serve several sections. Section ids cannot contain `:`; it is reserved for * scope and read-only grants. A function that returns an invalid id denies the call. */ section: string | false | ((input: Input) => string | undefined); /** * The part of a string `section` that one call uses, such as the Blob store that the input names. The call then needs * the section (every scope) or `"
:"` (only this scope). A scope that is empty, is `read`, or has a * `:` needs the whole section. */ scope?: (input: Input) => string | undefined; /** `read` never changes state. `write` changes state. `destructive` deletes or publishes; the CLI asks for `--yes`, MCP marks `destructiveHint`, agents require approval by default. */ kind: OperationKind; /** Standard Schema (valibot in this repo). Its Standard JSON Schema builds CLI flags and the MCP input schema. */ input: StandardSchemaV1; output?: StandardSchemaV1; cli?: { /** Defaults: namespace = section, command = verb. */ namespace?: string; /** A space groups commands: `jobs list` and `jobs show` run as `vitehub jobs list` and `jobs show`. */ command?: string; /** Input keys read from positional arguments, in order. */ positional?: string[]; /** Human output, written verbatim. Without it the CLI prints JSON. `--json` always prints JSON. */ format?: (output: Output) => string; /** `vitehub ` runs this command when no command is named. */ default?: boolean; }; /** Largest request body in bytes. It can raise the 64 KiB default but not lower it. */ maxRequestBytes?: number; /** * Returns true when this call only reads, such as a dry run of a `destructive` operation. The CLI then skips the * confirmation, and agents run it without approval. Without it, every call of a `destructive` operation asks. */ readOnlyWhen?: (input: Input) => boolean; /** * How MCP offers the operation as a tool. `false`: MCP does not offer it, such as an editor transport that only the * Console uses. `title`: the short title that clients show, instead of the name in words. `format`: the text of a * result for the Agent, such as a list of lines. The result stays the structured content. Without `format`, the text * is the result as JSON. */ mcp?: false | { title?: string; format?: (output: NoInfer) => string; }; /** `false`: the operation never reads `context.user`, so the Console skips the session lookup for it. */ user?: false; /** * The operation runs code of the app, such as a workflow, a job, a task, or a schedule. The Console registers it only * when `console.invoke` is on, which is the default in development and off in a production build. */ invoke?: true; run: (input: Input, context: OperationContext) => Output | Promise; } /** An operation of any input and output, as a registry holds it. */ interface AnyOperation extends Omit, "cli" | "input" | "mcp" | "output" | "readOnlyWhen" | "run" | "scope" | "section"> { readOnlyWhen?: (input: never) => boolean; cli?: { namespace?: string; command?: string; default?: boolean; positional?: string[]; format?: (output: never) => string; }; mcp?: false | { title?: string; format?: (output: never) => string; }; input: StandardSchemaV1; output?: StandardSchemaV1; run: (input: never, context: OperationContext) => unknown; scope?: (input: never) => string | undefined; section: string | false | ((input: never) => string | undefined); } /** The contribution of one plugin: operations, or a module that exports them. */ interface OperationContributionEntry { /** The absolute path of the module that generated code imports, such as `ownModule(import.meta.url, "operations")`. */ module: string; /** Named export that holds an operation or an array of operations. Defaults to `default`. */ export?: string; /** Loads the export in the tool process, for a module that the tool cannot resolve by name. */ load?: () => Promise; /** `false`: the app already has these operations at runtime. Only tools such as the CLI and `vitehub inspect` read the entry. */ runtime?: false; } //#endregion export { OperationContributionEntry as n, AnyOperation as t };