import * as v from "valibot";
//#region 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;
}
/** The Standard JSON Schema interface. */
//#endregion
//#region code/core/.dts-emit/code/core/src/shared/open-service/types.d.ts
type GetServiceOptions = {
/**
* Required when the target service is marked `internal: true`. Internal OSA surfaces are unstable
* and may change without a semver bump — only pass this when you intentionally accept that risk.
*/
internal?: boolean;
};
//#endregion
//#region code/core/.dts-emit/code/core/src/shared/open-service/toolset-definition.d.ts
type AnySchema = StandardSchemaV1;
type ToolsetTransport = 'cli' | 'mcp' | 'sdk';
/**
* Service lookup for toolset handlers. Intentionally not keyed to ServerCoreServices:
* toolsets may call core OSA (with `{ internal: true }`) or optional addon services by id.
*/
type ToolsetGetService = {
(serviceId: string, options?: GetServiceOptions): TInstance;
};
type ToolsetCtx = {
transport: ToolsetTransport;
/**
* Storybook UI base URL, including any deployment subpath. Absent when running from a CLI
* without a live Storybook.
*/
origin?: string;
getService: ToolsetGetService;
};
/**
* A handler's usage report: the payload describing what the call did, counts and flags alike. It
* travels on the outcome, so a handler reports at most once and in the same object as its data.
* The surface that ran the method turns it into its own telemetry record and names the event; a
* handler never names one.
*/
type ToolsetTelemetryReport = {
payload: Record;
};
/**
* A method description, resolved per transport.
*
* The function form exists because descriptions cross-reference sibling methods, and each surface
* spells those differently (`stories-changed` on MCP, `npx storybook tools stories changed` on
* the CLI, dotted `toolsetId.methodName` in the SDK). Use `getToolName(ctx)` to render a reference
* rather than hardcoding a spelling.
*/
type ToolsetMethodDescription = string | ((context: ToolsetCtx) => string);
/**
* The result of one method run: the tag, the structured data, the rendered Markdown, and the usage
* report, all from a single execution.
*
* The failure model in one line each: could not do the job → throw; did the job and the answer is
* bad news → return `{ ok: false, data, markdown }`. Adapters unwrap mechanically — text blocks
* from `markdown`, `structuredContent` from `data`, MCP `isError` (and later CLI exit codes) from
* `ok` — so everything a method means lives on its definition, never re-derived outside it.
*
* Declare `TFailure = never` for infallible methods; the signature then documents fallibility and
* TypeScript narrows both branches. Return plain object literals: contextual typing against this
* union does the narrowing, no factory helpers needed.
*
* `markdown` may be multiple strings: MCP renders each as its own text block (`stories-preview`
* renders one block per URL), the CLI joins them with newlines.
*/
type ToolsetOutcome = {
readonly ok: true;
readonly data: TSuccess;
readonly markdown: string | string[];
readonly telemetry?: TReport;
} | {
readonly ok: false;
readonly data: TFailure;
readonly markdown: string | string[];
readonly telemetry?: TReport;
};
type AnyToolsetOutcome = ToolsetOutcome;
/** Output schema for a published toolset method. Must describe a JSON object. */
type ToolsetObjectOutputSchema = StandardSchemaV1, Record>;
/**
* One public method: description, input schema, optional output schema, and one handler.
*
* The handler produces the whole {@link ToolsetOutcome} — data, side effects, the usage report,
* and the rendered Markdown — because one MCP response carries `content` (text) and
* `structuredContent` (JSON) at once, and both must come from a single run: re-running a method
* with side effects would repeat them. The usage report is part of the returned object, with the
* rendered text in hand, so no consumer can forget it.
*/
type ToolsetMethod = {
/**
* Short display label shown by client UIs (e.g. an MCP client's tool list). Editable prose like
* `description`, not an invokable tool name.
*/
title: string;
description: ToolsetMethodDescription;
input: TSchema; /** Published as the MCP tool's `outputSchema`. Must describe a JSON object. */
output?: ToolsetObjectOutputSchema;
/**
* Marks a method that can only do its job against a running Storybook dev server — because it
* needs a live origin for its URLs or reads state only the dev server owns. Consumers that run
* without one (the `storybook tools` CLI) surface these methods behind one uniform contract:
* start the dev server first. Adapters that always have a dev server (MCP) ignore the trait.
*/
requiresDevServer?: true;
handler: (input: StandardSchemaV1.InferOutput, context: ToolsetCtx) => TOutcome | Promise;
};
type AnyToolsetMethod = ToolsetMethod;
type ToolsetMethods = Record;
type ToolsetDefinition = {
id: TId;
description: string;
methods: TMethods;
};
/** Resolves a method description for one transport. */
declare function resolveToolsetDescription(description: ToolsetMethodDescription, context: ToolsetCtx): string;
//#endregion
//#region code/core/.dts-emit/code/core/src/shared/open-service/toolset-names.d.ts
type ToolsetMethodId = `${string}.${string}`;
/** `stories.findByComponent` -> `stories-find-by-component`. */
declare function toMcpToolName(method: ToolsetMethodId): string;
/**
* Renders how a toolset method is spelled for the active transport.
*
* Not a composed-Storybook "ref" (`refs` in `main.js`) — the name is the invokable tool/command
* string agents see. Descriptions that tell an agent to call another tool must use this rather
* than hardcoding either spelling.
*/
declare function getToolName(context: Pick): (method: ToolsetMethodId) => string;
//#endregion
//#region code/core/.dts-emit/code/core/src/shared/open-service/toolsets/docs/instructions.d.ts
declare const DOCS_TOOLSET_INSTRUCTIONS: string;
//#endregion
//#region code/core/.dts-emit/code/core/src/shared/open-service/toolsets/docs/manifest-formatter/manifest-types.d.ts
declare const ManifestErrorSchema: v.ObjectSchema<{
readonly name: v.StringSchema;
readonly message: v.StringSchema;
}, undefined>;
type ManifestError = v.InferOutput;
declare const StorySchema: v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly id: v.OptionalSchema, undefined>;
readonly snippet: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
}, undefined>;
type Story = v.InferOutput;
/**
* A JSON Reference (`{ $ref }`) pointing at a value in another manifest document. Used by the v1
* (split/ref) format for docgen, story-docs and MDX payloads.
*/
declare const JsonRef: v.ObjectSchema<{
readonly $ref: v.StringSchema;
}, undefined>;
type JsonRef = v.InferOutput;
/** Inline (v0) docs entry: the full MDX `content` is embedded. */
declare const DocV0: v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly title: v.OptionalSchema, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly content: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>;
type DocV0 = v.InferOutput;
declare const SubcomponentManifest: v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly import: v.OptionalSchema, undefined>;
readonly apiDescription: v.OptionalSchema, undefined>;
readonly renderer: v.OptionalSchema, undefined>;
readonly reactDocgen: v.OptionalSchema;
readonly reactDocgenTypescript: v.OptionalSchema;
readonly reactComponentMeta: v.OptionalSchema;
}, undefined>;
type SubcomponentManifest = v.InferOutput;
/** Inline (v0) component: docgen, stories and attached docs are all embedded. */
declare const ComponentManifestV0: v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly import: v.OptionalSchema, undefined>;
readonly apiDescription: v.OptionalSchema, undefined>;
readonly renderer: v.OptionalSchema, undefined>;
readonly reactDocgen: v.OptionalSchema;
readonly reactDocgenTypescript: v.OptionalSchema;
readonly reactComponentMeta: v.OptionalSchema;
readonly id: v.StringSchema;
readonly stories: v.OptionalSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly id: v.OptionalSchema, undefined>;
readonly snippet: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
}, undefined>, undefined>, undefined>;
readonly subcomponents: v.OptionalSchema, v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly import: v.OptionalSchema, undefined>;
readonly apiDescription: v.OptionalSchema, undefined>;
readonly renderer: v.OptionalSchema, undefined>;
readonly reactDocgen: v.OptionalSchema;
readonly reactDocgenTypescript: v.OptionalSchema;
readonly reactComponentMeta: v.OptionalSchema;
}, undefined>, undefined>, undefined>;
readonly docs: v.OptionalSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly title: v.OptionalSchema, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly content: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>, undefined>, undefined>;
}, undefined>;
type ComponentManifestV0 = v.InferOutput;
declare const ComponentManifestMapV0: v.ObjectSchema<{
readonly v: v.LiteralSchema<0, undefined>;
readonly components: v.RecordSchema, v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly import: v.OptionalSchema, undefined>;
readonly apiDescription: v.OptionalSchema, undefined>;
readonly renderer: v.OptionalSchema, undefined>;
readonly reactDocgen: v.OptionalSchema;
readonly reactDocgenTypescript: v.OptionalSchema;
readonly reactComponentMeta: v.OptionalSchema;
readonly id: v.StringSchema;
readonly stories: v.OptionalSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly id: v.OptionalSchema, undefined>;
readonly snippet: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
}, undefined>, undefined>, undefined>;
readonly subcomponents: v.OptionalSchema, v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly import: v.OptionalSchema, undefined>;
readonly apiDescription: v.OptionalSchema, undefined>;
readonly renderer: v.OptionalSchema, undefined>;
readonly reactDocgen: v.OptionalSchema;
readonly reactDocgenTypescript: v.OptionalSchema;
readonly reactComponentMeta: v.OptionalSchema;
}, undefined>, undefined>, undefined>;
readonly docs: v.OptionalSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly title: v.OptionalSchema, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly content: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>, undefined>, undefined>;
}, undefined>, undefined>;
}, undefined>;
type ComponentManifestMapV0 = v.InferOutput;
declare const DocsManifestMapV0: v.ObjectSchema<{
readonly v: v.LiteralSchema<0, undefined>;
readonly docs: v.RecordSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly title: v.OptionalSchema, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly content: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>, undefined>;
}, undefined>;
type DocsManifestMapV0 = v.InferOutput;
/**
* Shallow (v1) docs entry. The full MDX payload lives behind `mdx.$ref`; `mdx` is optional because
* the in-process dev index omits it.
*/
declare const DocV1: v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly summary: v.OptionalSchema, undefined>;
readonly mdx: v.OptionalSchema;
}, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>;
type DocV1 = v.InferOutput;
/**
* Shallow (v1) component index row. Identity and summary are inlined for cheap listing; docgen and
* story-docs live behind `$ref`s, attached docs behind nested `mdx.$ref`s. `stories` may also be an
* inline array, which is how a listing built with story ids resolved carries them.
*/
declare const ComponentManifestV1: v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly docgen: v.OptionalSchema;
}, undefined>, undefined>;
readonly stories: v.OptionalSchema;
}, undefined>, v.ArraySchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly id: v.OptionalSchema, undefined>;
readonly snippet: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
}, undefined>, undefined>], undefined>, undefined>;
readonly docs: v.OptionalSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly summary: v.OptionalSchema, undefined>;
readonly mdx: v.OptionalSchema;
}, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>, undefined>, undefined>;
}, undefined>;
type ComponentManifestV1 = v.InferOutput;
declare const ComponentManifestMapV1: v.ObjectSchema<{
readonly v: v.LiteralSchema<1, undefined>;
readonly components: v.RecordSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly docgen: v.OptionalSchema;
}, undefined>, undefined>;
readonly stories: v.OptionalSchema;
}, undefined>, v.ArraySchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly id: v.OptionalSchema, undefined>;
readonly snippet: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
}, undefined>, undefined>], undefined>, undefined>;
readonly docs: v.OptionalSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly summary: v.OptionalSchema, undefined>;
readonly mdx: v.OptionalSchema;
}, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>, undefined>, undefined>;
}, undefined>, undefined>;
}, undefined>;
type ComponentManifestMapV1 = v.InferOutput;
declare const DocsManifestMapV1: v.ObjectSchema<{
readonly v: v.LiteralSchema<1, undefined>;
readonly docs: v.RecordSchema, v.ObjectSchema<{
readonly id: v.StringSchema;
readonly name: v.StringSchema;
readonly summary: v.OptionalSchema, undefined>;
readonly mdx: v.OptionalSchema;
}, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
}, undefined>, undefined>;
}, undefined>;
type DocsManifestMapV1 = v.InferOutput;
/** `components.json`, discriminated on `v` (0 = inline, 1 = split/ref). */
declare const ComponentManifestMap: v.VariantSchema<"v", [v.ObjectSchema<{
readonly v: v.LiteralSchema<0, undefined>;
readonly components: v.RecordSchema, v.ObjectSchema<{
readonly name: v.StringSchema;
readonly description: v.OptionalSchema, undefined>;
readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>;
readonly error: v.OptionalSchema;
readonly message: v.StringSchema;
}, undefined>, undefined>;
readonly path: v.OptionalSchema, undefined>;
readonly summary: v.OptionalSchema, undefined>;
readonly import: v.OptionalSchema, undefined>;
readonly apiDescription: v.OptionalSchema