import { z } from "zod"; import { type ModuleFilePath } from "@valbuild/core"; declare const ModuleFilePath: z.ZodString & z.ZodType>; /** * Why Val Build refused a write for the project's plan, as data: the `error` of * its 403 (`refusalError` in valbuild/home's `billing/projectLimits.ts`). * * Every field but `code` is optional and every field is a plain string, so a * newer Val Build that adds a code or a fix still parses: the Studio says an * unknown one with Billing beside it rather than failing to read the answer. */ export declare const PlanRefusalError: z.ZodObject<{ code: z.ZodString; fix: z.ZodOptional; until: z.ZodOptional; billingUrl: z.ZodOptional; }, z.core.$strip>; export type PlanRefusalErrorT = z.infer; /** * The header a request to `/admin/proxy` must carry. A cross-site form or * `` cannot set a custom header, so without it the proxy cannot be driven * with the editor's cookie from another site. */ export declare const VAL_STUDIO_HEADER = "x-val-studio"; /** * On a user message in an AI chat: the tools called in the turn it asked for, * as the content server keeps them (valbuild/home `docs/proposals.md`, * Flow H) - what each tool row shows, never what the tool read or wrote. * * A chat with a summary this cannot read loads without its tool rows rather * than not at all, hence the `catch`. */ export declare const AIToolCallSummaries: z.ZodCatch>; answers: z.ZodOptional>; }, z.core.$strip>>>>; declare const cookies: z.ZodUnion, z.ZodLiteral<"val_enable">, z.ZodLiteral<"val_state">]>; type Cookies = z.infer; declare const enableCookieValue: z.ZodObject<{ value: z.ZodLiteral<"true">; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; }, z.core.$strip>; }, z.core.$strip>; type EnableCookieValue = z.infer; type CookieValue = EnableCookieValue | { value: "false" | string | null; options?: { httpOnly: boolean; sameSite: "lax" | "strict"; expires: Date; }; }; /** * Upper bound on how many `.jsonValues()` entries one `/json` request may ask * for. Callers page through bigger sets; the Studio chunks its key windows to * this. Shared so client and server agree on the limit. */ export declare const JSON_ENTRIES_BATCH_MAX = 100; export declare const AnalyticsBeacon: z.ZodObject<{ v: z.ZodLiteral<1>; route: z.ZodString; cv: z.ZodOptional; view: z.ZodOptional; utm: z.ZodOptional; medium: z.ZodOptional; campaign: z.ZodOptional; }, z.core.$strip>>; device: z.ZodEnum<{ phone: "phone"; tablet: "tablet"; desktop: "desktop"; }>; }, z.core.$strip>>; rendered: z.ZodRecord>; viewed: z.ZodRecord>; }, z.core.$strip>; export type AnalyticsBeacon = z.infer; /** * A Sketchpad, as the server keeps it: a rough page written in the strict * format of `sketchpad/sketchFormat.ts`, owned by the project and nothing * else. Not by an AI session -- the assistant that made it remembers its id, * and any chat can read it again -- and not by a page: `page` is a label for * which page it is about, and can be changed or cleared. * * `version` goes up by one on every change, and a change names the version * it was made against, so two writers cannot overwrite each other unseen. */ export declare const Sketchpad: z.ZodObject<{ id: z.ZodString; page: z.ZodNullable; title: z.ZodNullable; text: z.ZodString; version: z.ZodNumber; archived: z.ZodBoolean; createdAt: z.ZodString; updatedAt: z.ZodString; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>; export type SketchpadT = z.infer; export declare const SketchpadSummary: z.ZodObject<{ title: z.ZodNullable; page: z.ZodNullable; version: z.ZodNumber; id: z.ZodString; createdAt: z.ZodString; updatedAt: z.ZodString; archived: z.ZodBoolean; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>; export type SketchpadSummaryT = z.infer; /** The most text a sketchpad holds, in UTF-8 bytes: a page, not a site. */ export declare const SKETCHPAD_MAX_TEXT_LENGTH: number; /** * A manifest as the server answers it: what each module IS on the server * (`GET /manifest`, and the same answer on `/stat` when the Studio asks for it * there -- one function on the server answers both, `manifestAnswer`). */ export declare const ManifestJson: z.ZodObject<{ project: z.ZodObject<{ build: z.ZodString; seq: z.ZodNumber; }, z.core.$strip>; modules: z.ZodRecord>, z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>>; tag: z.ZodOptional; since: z.ZodOptional; superseded: z.ZodOptional; registry: z.ZodOptional>; }, z.core.$strip>; export type ManifestJsonT = z.infer; /** * The manifest a `/stat` answer carries, when the request said which one the * Studio holds (`manifest` on the request): what `GET /manifest` would have * answered for it, so another editor's keystroke costs no manifest request. * * - A manifest, whole or a delta. A delta names the ETag it is relative to * (`sinceTag`): a Studio uses it only while it holds exactly that one. * - `unchanged`: the manifest the request named, at `seq`, is still the * one for this answer's `seq`. Decided by `seq` alone, and not read: a * Studio reads a manifest only for a stat whose `seq` moved. It keeps the * next request naming the same manifest. * * Optional: absent from a server of the release before, and from an answer * to a request that did not ask, and then the Studio reads `GET /manifest`. */ export declare const StatManifest: z.ZodUnion; modules: z.ZodRecord>, z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>>; tag: z.ZodOptional; since: z.ZodOptional; superseded: z.ZodOptional; registry: z.ZodOptional>; sinceTag: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ unchanged: z.ZodLiteral; tag: z.ZodString; seq: z.ZodNumber; }, z.core.$strip>]>; export type StatManifestT = z.infer; export declare const Api: { "/draft/enable": { GET: { req: { query: { redirect_to: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/draft/disable": { GET: { req: { query: { redirect_to: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/analytics": { POST: { req: { body: z.ZodUnknown; headers: { "sec-fetch-site": z.ZodOptional; "user-agent": z.ZodOptional; "x-vercel-ip-country": z.ZodOptional; "cf-ipcountry": z.ZodOptional; "cloudfront-viewer-country": z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ counted: z.ZodBoolean; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<410>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/draft/stat": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ draftMode: z.ZodBoolean; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/enable": { GET: { req: { query: { redirect_to: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; cookies: z.ZodObject<{ val_enable: z.ZodObject<{ value: z.ZodLiteral<"true">; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; }, z.core.$strip>; }, z.core.$strip>; val_state: z.ZodObject<{ value: z.ZodString; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; expires: z.ZodInstanceOf; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; cookies: z.ZodObject<{ val_enable: z.ZodObject<{ value: z.ZodLiteral<"true">; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/disable": { GET: { req: { query: { redirect_to: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; cookies: z.ZodObject<{ val_enable: z.ZodObject<{ value: z.ZodLiteral<"false">; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/authorize": { GET: { req: { query: { redirect_to: z.ZodOptional, z.ZodTransform>>; }; }; res: z.ZodUnion; redirectTo: z.ZodString; cookies: z.ZodObject<{ val_enable: z.ZodObject<{ value: z.ZodLiteral<"true">; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; }, z.core.$strip>; }, z.core.$strip>; val_state: z.ZodObject<{ value: z.ZodString; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; expires: z.ZodInstanceOf; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/callback": { GET: { req: { query: { code: z.ZodOptional, z.ZodTransform>>; state: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_state: z.ZodString; }; }; res: z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; cookies: z.ZodObject<{ val_state: z.ZodObject<{ value: z.ZodLiteral; }, z.core.$strip>; val_enable: z.ZodOptional; options: z.ZodObject<{ httpOnly: z.ZodLiteral; sameSite: z.ZodLiteral<"lax">; }, z.core.$strip>; }, z.core.$strip>>; val_session: z.ZodOptional; sameSite: z.ZodLiteral<"strict">; path: z.ZodString; secure: z.ZodLiteral; expires: z.ZodInstanceOf; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>; }; }; "/logout": { GET: { req: { query: { redirect_to: z.ZodOptional, z.ZodTransform>>; }; }; res: z.ZodUnion; cookies: z.ZodObject<{ val_session: z.ZodOptional; sameSite: z.ZodLiteral<"strict">; path: z.ZodString; secure: z.ZodLiteral; expires: z.ZodInstanceOf; }, z.core.$strip>>; }, z.core.$strip>>; val_state: z.ZodOptional; sameSite: z.ZodLiteral<"strict">; path: z.ZodString; secure: z.ZodLiteral; expires: z.ZodInstanceOf; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<302>; redirectTo: z.ZodString; cookies: z.ZodObject<{ val_session: z.ZodOptional; sameSite: z.ZodLiteral<"strict">; path: z.ZodString; secure: z.ZodLiteral; expires: z.ZodInstanceOf; }, z.core.$strip>>; }, z.core.$strip>>; val_state: z.ZodOptional; sameSite: z.ZodLiteral<"strict">; path: z.ZodString; secure: z.ZodLiteral; expires: z.ZodInstanceOf; }, z.core.$strip>>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/remote/settings": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ publicProjectId: z.ZodString; coreVersion: z.ZodString; remoteFileBuckets: z.ZodArray>; remoteHost: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ errorCode: z.ZodUnion, z.ZodLiteral<"error-could-not-get-settings">, z.ZodLiteral<"project-not-configured">, z.ZodLiteral<"pat-error">, z.ZodLiteral<"api-key-missing">]>; message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<401>; json: z.ZodObject<{ errorCode: z.ZodOptional>; message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * The versions of Val's packages the server runs, for the list at the foot * of the Studio's account panel. */ "/versions": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ framework: z.ZodNullable, z.ZodLiteral<"tanstack">]>; version: z.ZodString; }, z.core.$strip>>; core: z.ZodString; server: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<401>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * What each module IS, right now: its version (`schema`, `base`, `chain`), * and the project version that is relative to. What `/stat` answers, per * module; see `docs/plans/one-content-model.md`, "The Studio loads * everything from one place". * * It has its own ETag, so a client that sends it back (`If-None-Match`) * gets a 304 and no body while nothing has moved. Computed from versions * kept as content changes: answering it hashes nothing. * * "Since `seq` N" (`?since=N`, with the ETag of the manifest the client * holds, which was answered at `seq` N, as `If-None-Match`): the modules * whose version moved since that manifest, and no others, with `since: N` * on the answer to say it is a delta. The ETag is in the body too (`tag`), * for a client that reads answers through `ValClient`, which hands over * the body and not the headers. Answered whole -- no `since` -- when the server no * longer holds the manifest that ETag names (another process, another * build, too long ago), and by a server of the release before, which * ignores the parameter. Optional both ways. */ "/manifest": { GET: { req: { cookies: { val_session: z.ZodOptional; }; headers: { "if-none-match": z.ZodOptional; }; query: { since: z.ZodOptional, z.ZodTransform>>; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ project: z.ZodObject<{ build: z.ZodString; seq: z.ZodNumber; }, z.core.$strip>; modules: z.ZodRecord>, z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>>; tag: z.ZodOptional; since: z.ZodOptional; superseded: z.ZodOptional; registry: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<304>; json: z.ZodOptional; }, z.core.$strip>]>; }; }; "/stat": { POST: { req: { body: z.ZodNullable; schemaSha: z.ZodOptional; version: z.ZodOptional>; baseSha: z.ZodString; patches: z.ZodOptional>; jsonEntriesSha: z.ZodOptional; manifest: z.ZodOptional>>; }, z.core.$strip>>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<503>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodUnion, z.ZodLiteral<"no-change">, z.ZodLiteral<"did-change">]>; baseSha: z.ZodString; schemaSha: z.ZodOptional; sourcesSha: z.ZodOptional; patches: z.ZodArray>>; appliedPatches: z.ZodOptional>>>; publishingPatches: z.ZodOptional>>>; heldBackPatches: z.ZodOptional>>>; headCommitSha: z.ZodOptional; removed: z.ZodOptional>; reason: z.ZodString; }, z.core.$strip>>>; config: z.ZodObject<{ project: z.ZodOptional; root: z.ZodOptional; files: z.ZodOptional; }, z.core.$strip>>; gitCommit: z.ZodOptional; gitBranch: z.ZodOptional; }, z.core.$strip>; profileId: z.ZodNullable; mode: z.ZodUnion, z.ZodLiteral<"fs">]>; jsonEntriesSha: z.ZodOptional; sourceMode: z.ZodOptional, z.ZodLiteral<"connected">]>>; publishJobs: z.ZodOptional; publishRefusal: z.ZodOptional; message: z.ZodString; }, z.core.$strip>>; proposal: z.ZodOptional>; historyBranch: z.ZodOptional; version: z.ZodOptional>; manifest: z.ZodOptional; modules: z.ZodRecord>, z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>>; tag: z.ZodOptional; since: z.ZodOptional; superseded: z.ZodOptional; registry: z.ZodOptional>; sinceTag: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ unchanged: z.ZodLiteral; tag: z.ZodString; seq: z.ZodNumber; }, z.core.$strip>]>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"use-websocket">; url: z.ZodString; nonce: z.ZodString; baseSha: z.ZodString; schemaSha: z.ZodOptional; sourcesSha: z.ZodOptional; commitSha: z.ZodOptional; patches: z.ZodArray>>; appliedPatches: z.ZodOptional>>>; publishingPatches: z.ZodOptional>>>; heldBackPatches: z.ZodOptional>>>; headCommitSha: z.ZodOptional; headPatchId: z.ZodOptional>>>; headVersion: z.ZodOptional; commits: z.ZodArray; parentCommitSha: z.ZodNullable; branch: z.ZodString; creator: z.ZodString; createdAt: z.ZodString; commitMessage: z.ZodNullable; }, z.core.$strip>>; deployments: z.ZodOptional>; }, z.core.$strip>>>; config: z.ZodObject<{ project: z.ZodOptional; root: z.ZodOptional; files: z.ZodOptional; }, z.core.$strip>>; gitCommit: z.ZodOptional; gitBranch: z.ZodOptional; }, z.core.$strip>; profileId: z.ZodNullable; mode: z.ZodUnion, z.ZodLiteral<"fs">]>; sourceMode: z.ZodOptional, z.ZodLiteral<"connected">]>>; publishJobs: z.ZodOptional; publishRefusal: z.ZodOptional; message: z.ZodString; }, z.core.$strip>>; proposal: z.ZodOptional>; historyBranch: z.ZodOptional; version: z.ZodOptional>; manifest: z.ZodOptional; modules: z.ZodRecord>, z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>>; tag: z.ZodOptional; since: z.ZodOptional; superseded: z.ZodOptional; registry: z.ZodOptional>; sinceTag: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ unchanged: z.ZodLiteral; tag: z.ZodString; seq: z.ZodNumber; }, z.core.$strip>]>>; }, z.core.$strip>]>; }, z.core.$strip>]>; }; }; /** * The content service's publish API, reached through this deployment. * * A managed project is built in the Studio's own tab -- there is no host * watching a repository to pick a commit up -- and what it builds then has to * be published. The browser cannot do that itself: it holds a session cookie * for this origin and no credential content would accept. So the publish * conversation goes through here, exactly as patches already do. * * ## Deliberately not typed past this point * * No `res`, and a body this does not describe. The shapes belong to content, * and they are already written down twice -- once in content's own `Api.ts` * and once in the copy `@valbuild/cli` keeps beside its parser so the two can * be diffed by eye. A third copy here would be a third thing to keep in step, * and this layer has no decision to make that would need one: it authenticates * the caller, swaps the credential, and carries status and body back verbatim. * The Studio parses the answer with the same module the CLI does. * * That means this route answers with statuses the generic result type does not * model -- a 409 when a publish has already gone live, for one. `/save` has * always done the same; the dispatch boundary erases the type and the adapter * sends what it is given. * * ## What it may reach * * The sub-path is content's, minus `/v1`: `/publish`, `/publish/{id}` and its * three steps, and `/build-target`. `ValOpsHttp.publishApi` holds the allow * list, beside the credential, because the browser chooses this path. */ "/publish-api": { GET: { req: { path: z.ZodOptional; cookies: { val_session: z.ZodOptional; }; headers: { "if-none-match": z.ZodOptional; }; }; res: z.ZodUnion, z.ZodObject<{ status: z.ZodLiteral<304>; json: z.ZodOptional; }, z.core.$strip>]>; }; POST: { req: { path: z.ZodOptional; body: z.ZodOptional; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodObject<{ status: z.ZodNumber; json: z.ZodUnknown; }, z.core.$strip>; }; }; /** * The content service's proposals API, reached through this deployment: * list, open, read, rename, close, reopen and retry a setup * (valbuild/home `docs/proposals.md`, Flow B). * * The same arrangement as `/publish-api`, for the same reasons: the browser * holds a session for this origin and no credential content accepts, so * this server checks the session, sends the project's key with the person's * profile id beside it -- a proposal is opened, renamed and closed by * somebody -- and carries content's status and body back unread. The sub-path * is content's, after `/proposals`; `ValOpsHttp.proposalsApi` holds the * allow list. A save is not here: it is `/save`, which a proposal's server * sends to the proposal's own route. */ "/proposals-api": { GET: { req: { path: z.ZodOptional; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodObject<{ status: z.ZodNumber; json: z.ZodUnknown; }, z.core.$strip>; }; POST: { req: { path: z.ZodOptional; body: z.ZodOptional; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodObject<{ status: z.ZodNumber; json: z.ZodUnknown; }, z.core.$strip>; }; PATCH: { req: { path: z.ZodOptional; body: z.ZodOptional; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodObject<{ status: z.ZodNumber; json: z.ZodUnknown; }, z.core.$strip>; }; }; /** * The project's sketchpads: list them, or make one. See `Sketchpad`. * Making one answers with its id, which is what an assistant keeps to * read and change it later. */ "/sketchpads": { GET: { req: { query: { /** `exclude` (the default), `include`, or `only`. */ archived: z.ZodOptional, z.ZodTransform>>; /** Only those about this page. */ page: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ sketchpads: z.ZodArray; page: z.ZodNullable; version: z.ZodNumber; id: z.ZodString; createdAt: z.ZodString; updatedAt: z.ZodString; archived: z.ZodBoolean; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>]>; }; POST: { req: { body: z.ZodObject<{ text: z.ZodString; page: z.ZodNullable; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; errors: z.ZodOptional>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<201>; json: z.ZodObject<{ sketchpad: z.ZodObject<{ id: z.ZodString; page: z.ZodNullable; title: z.ZodNullable; text: z.ZodString; version: z.ZodNumber; archived: z.ZodBoolean; createdAt: z.ZodString; updatedAt: z.ZodString; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** One sketchpad: read it, or change its text, its page or whether it is archived. */ "/sketchpad": { GET: { req: { query: { id: z.ZodPipe, z.ZodTransform>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ sketchpad: z.ZodObject<{ id: z.ZodString; page: z.ZodNullable; title: z.ZodNullable; text: z.ZodString; version: z.ZodNumber; archived: z.ZodBoolean; createdAt: z.ZodString; updatedAt: z.ZodString; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>]>; }; PATCH: { req: { body: z.ZodObject<{ id: z.ZodString; baseVersion: z.ZodNumber; text: z.ZodOptional; page: z.ZodOptional>; archived: z.ZodOptional; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; errors: z.ZodOptional>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<409>; json: z.ZodObject<{ message: z.ZodString; sketchpad: z.ZodObject<{ id: z.ZodString; page: z.ZodNullable; title: z.ZodNullable; text: z.ZodString; version: z.ZodNumber; archived: z.ZodBoolean; createdAt: z.ZodString; updatedAt: z.ZodString; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ sketchpad: z.ZodObject<{ id: z.ZodString; page: z.ZodNullable; title: z.ZodNullable; text: z.ZodString; version: z.ZodNumber; archived: z.ZodBoolean; createdAt: z.ZodString; updatedAt: z.ZodString; createdBy: z.ZodNullable; updatedBy: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/upload/patches": { POST: { req: { path: z.ZodOptional; body: z.ZodObject<{ parentRef: z.ZodUnion; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>; filePath: z.ZodString; data: z.ZodAny; type: z.ZodUnion, z.ZodLiteral<"image">]>; metadata: z.ZodAny; remote: z.ZodBoolean; }, z.core.$strip>; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ filePath: z.ZodString; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * Open a batch of external URLs and report what answered. * * A batch rather than one URL because the client checks a list, and a POST * rather than a GET because the list is the input and does not belong in a * URL or a cache. * * The server makes outbound requests to addresses this body supplies, which * is SSRF by construction - see `linkCheck/addressGuard.ts` for the deny * list that makes it safe, and `docs/plans/external-page-link-checks.md` for * why it is a deny list on the RESOLVED address. */ "/external-urls/check": { POST: { req: { body: z.ZodObject<{ urls: z.ZodArray; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ results: z.ZodRecord; code: z.ZodNumber; finalUrl: z.ZodString; ms: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"unreachable">; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"timeout">; ms: z.ZodNumber; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"skipped">; message: z.ZodString; }, z.core.$strip>]>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/direct-file-upload-settings": { POST: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<401>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ nonce: z.ZodNullable; baseUrl: z.ZodString; contentBaseUrl: z.ZodNullable; contentAuthNonce: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/patches": { DELETE: { req: { query: { id: z.ZodArray>>; }; body: z.ZodOptional>; }, z.core.$strip>>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; errors: z.ZodArray>; message: z.ZodString; publishJobId: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ parentPatchId: z.ZodString; message: z.ZodString; }, z.core.$strip>]>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<502>; json: z.ZodObject<{ message: z.ZodString; details: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodUnion>>, z.ZodObject<{ deleted: z.ZodArray>>; headVersion: z.ZodOptional; }, z.core.$strip>]>; }, z.core.$strip>]>; }; PUT: { req: { body: z.ZodObject<{ parentRef: z.ZodUnion; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>; sessionId: z.ZodOptional>; patches: z.ZodArray>; patchId: z.ZodString & z.ZodType>; patch: z.ZodAny; }, z.core.$strip>>; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<409>; json: z.ZodObject<{ type: z.ZodLiteral<"patch-head-conflict">; message: z.ZodString; newPatchIds: z.ZodOptional>>>; parentRef: z.ZodOptional; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>>; headVersion: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ type: z.ZodLiteral<"patch-error">; message: z.ZodString; errors: z.ZodRecord>, z.ZodArray; }, z.core.$strip>>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<403>; json: z.ZodObject<{ type: z.ZodLiteral<"plan-refused">; message: z.ZodString; error: z.ZodObject<{ code: z.ZodString; fix: z.ZodOptional; until: z.ZodOptional; billingUrl: z.ZodOptional; }, z.core.$strip>; newPatchIds: z.ZodArray>>; parentRef: z.ZodUnion; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>; headVersion: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<502>; json: z.ZodObject<{ type: z.ZodLiteral<"service-error">; message: z.ZodString; details: z.ZodOptional; newPatchIds: z.ZodArray>>; parentRef: z.ZodUnion; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>; headVersion: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ newPatchIds: z.ZodArray>>; parentRef: z.ZodUnion; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>; headVersion: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>]>; }; GET: { req: { query: { patch_id: z.ZodOptional>>>; exclude_patch_ops: z.ZodOptional, z.ZodTransform> & z.ZodType<"false" | "true", string[], z.core.$ZodTypeInternals<"false" | "true", string[]>>, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; patchErrors: z.ZodArray>; message: z.ZodString; publishJobId: z.ZodOptional; }, z.core.$strip>, z.ZodObject<{ parentPatchId: z.ZodString; message: z.ZodString; }, z.core.$strip>]>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; error: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; details: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ patches: z.ZodArray>; patch: z.ZodOptional; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"remove">; path: z.ZodTuple<[z.ZodString], z.ZodString>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"replace">; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"move">; from: z.ZodTuple<[z.ZodString], z.ZodString>; path: z.ZodArray; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"copy">; from: z.ZodArray; path: z.ZodArray; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"test">; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"file">; path: z.ZodArray; filePath: z.ZodString; value: z.ZodType>; remote: z.ZodBoolean; nestedFilePath: z.ZodOptional>; metadata: z.ZodOptional>>; }, z.core.$strict>], "op">>>; patchId: z.ZodString & z.ZodType>; createdAt: z.ZodString; authorId: z.ZodNullable; appliedAt: z.ZodNullable>; }, z.core.$strip>>; baseSha: z.ZodString; error: z.ZodOptional>; errors: z.ZodOptional>, z.ZodObject<{ message: z.ZodString; }, z.core.$strip>>>; version: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/schema": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; details: z.ZodArray>>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; details: z.ZodArray>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ schemaSha: z.ZodString; schemas: z.ZodRecord>, z.ZodType>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * One module by version: phase 6 of `docs/plans/one-content-model.md` * ("The Studio loads everything from one place"). `GET /modules/~`, * with `v` the version wanted as its `moduleKey` (the newest when absent; * a base is a version with the empty chain) and `have` the version the * caller holds: when the caller's chain is a start of the answer's under * the same schema and base, the answer is the patches from it (`delta`), * otherwise the whole module. An answer for an asked `v` is immutable. */ "/modules/~": { GET: { req: { path: z.ZodString; query: { v: z.ZodOptional, z.ZodTransform>>; have: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; current: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; headers: z.ZodOptional>; json: z.ZodUnion; version: z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>; source: z.ZodAny; entries: z.ZodRecord; }, z.core.$strip>, z.ZodObject<{ deleted: z.ZodLiteral; version: z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; key: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ error: z.ZodString; patchId: z.ZodOptional>>; version: z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; key: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>>; patches: z.ZodOptional>>>; failed: z.ZodOptional>; message: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"delta">; from: z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>; to: z.ZodObject<{ schema: z.ZodString; base: z.ZodString; chain: z.ZodString; }, z.core.$strip>; patches: z.ZodArray>; patch: z.ZodArray; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"remove">; path: z.ZodTuple<[z.ZodString], z.ZodString>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"replace">; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"move">; from: z.ZodTuple<[z.ZodString], z.ZodString>; path: z.ZodArray; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"copy">; from: z.ZodArray; path: z.ZodArray; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"test">; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"file">; path: z.ZodArray; filePath: z.ZodString; value: z.ZodType>; remote: z.ZodBoolean; nestedFilePath: z.ZodOptional>; metadata: z.ZodOptional>>; }, z.core.$strict>], "op">>; }, z.core.$strip>>; }, z.core.$strip>]>; }, z.core.$strip>]>; }; }; /** * The Studio's full check, one module per request: its sources against its * schema and its local files against their bytes, on the content the caller * is looking at. See `docs/plans/studio-validate.md`. */ "/validate": { POST: { req: { body: z.ZodObject<{ moduleFilePath: z.ZodString & z.ZodType>; patchIds: z.ZodOptional>>>; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<501>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ moduleFilePath: z.ZodString & z.ZodType>; errors: z.ZodRecord; fatal: z.ZodOptional; fixes: z.ZodOptional>>>; }, z.core.$strip>>>; invalidSource: z.ZodOptional; remoteHosts: z.ZodOptional, z.ZodLiteral<"unreachable">]>; details: z.ZodString; sourcePaths: z.ZodArray>>; }, z.core.$strip>>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * The patch that fixes one error the full check reported. The server finds * the error again rather than trusting the caller's copy, and builds only the * fixes `STUDIO_FIXES` lists. The patch is returned, not applied: the Studio * adds it as a pending change like any edit. */ "/validate/fix": { POST: { req: { body: z.ZodObject<{ moduleFilePath: z.ZodString & z.ZodType>; sourcePath: z.ZodType>; fix: z.ZodSchema<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "video:add-metadata" | "video:upload-remote" | "video:download-remote" | "videos:add-metadata" | "videos:check-remote" | "videos:upload-remote" | "keyof:check-keys" | "image:check-gallery" | "file:check-gallery" | "video:check-gallery" | "router:check-route" | "locale:check-locale" | "router:check-locale-param" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "videos:check-unique-folder" | "videos:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module" | "remote:rewrite-host", unknown, z.core.$ZodTypeInternals<"image:add-metadata" | "image:check-metadata" | "image:upload-remote" | "image:download-remote" | "image:check-remote" | "images:check-remote" | "images:upload-remote" | "file:add-metadata" | "file:check-metadata" | "file:upload-remote" | "file:download-remote" | "file:check-remote" | "files:check-remote" | "files:upload-remote" | "video:add-metadata" | "video:upload-remote" | "video:download-remote" | "videos:add-metadata" | "videos:check-remote" | "videos:upload-remote" | "keyof:check-keys" | "image:check-gallery" | "file:check-gallery" | "video:check-gallery" | "router:check-route" | "locale:check-locale" | "router:check-locale-param" | "images:check-unique-folder" | "files:check-unique-folder" | "images:check-all-files" | "files:check-all-files" | "videos:check-unique-folder" | "videos:check-all-files" | "jsonValues:extract-entry" | "record:fill-keys" | "external:upload" | "view:check-module" | "remote:rewrite-host", unknown>>; patchIds: z.ZodOptional>>>; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<501>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ patch: z.ZodArray; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"remove">; path: z.ZodTuple<[z.ZodString], z.ZodString>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"replace">; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"move">; from: z.ZodTuple<[z.ZodString], z.ZodString>; path: z.ZodArray; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"copy">; from: z.ZodArray; path: z.ZodArray; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"test">; path: z.ZodArray; value: z.ZodType>; }, z.core.$strict>, z.ZodObject<{ op: z.ZodLiteral<"file">; path: z.ZodArray; filePath: z.ZodString; value: z.ZodType>; remote: z.ZodBoolean; nestedFilePath: z.ZodOptional>; metadata: z.ZodOptional>>; }, z.core.$strict>], "op">>; remainingErrors: z.ZodArray; fatal: z.ZodOptional; fixes: z.ZodOptional>>>; sourcePath: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/publish-job-prepare": { POST: { req: { body: z.ZodObject<{ jobId: z.ZodString; tab: z.ZodString; patchIds: z.ZodArray>>; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<409>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<502>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ job: z.ZodNullable>; base: z.ZodNullable; patches: z.ZodArray; }, z.core.$strip>>; sourceFiles: z.ZodRecord>; binaryFiles: z.ZodRecord; binaryFilesUnread: z.ZodArray; branch: z.ZodNullable; buildable: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * In a proposal: the SITE's Source for every module the proposal has saved, * as the build it is based on has it. What Compare with the site diffs the * proposal against -- saved and unsaved alike -- because the Studio's own * base Source there is the proposal's last save. 404 anywhere that is not a * proposal's address. valbuild/home `docs/proposals.md`. */ "/proposal-site-sources": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ modules: z.ZodRecord; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/profiles": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ profiles: z.ZodArray; avatar: z.ZodNullable>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * Publish selected (`docs/plans/remove-patch-groups.md`, Phase 4), its first * half, on the site's own server: the changes picked in Review, already * closed into whole patch sets (`selectionClosure`), moved into a proposal * of kind `publish` and saved there -- prepared over the site's head, which * the proposal is based on, so a publish landing in between is refused * rather than reverted. The second half is that proposal's Publish, pressed * as any proposal's is (`publishProposal`); this server answers its checks * and press with what the merge moves, as the proposal's own address would. */ "/publish-selected": { POST: { req: { body: z.ZodObject<{ patchIds: z.ZodArray>>; displayName: z.ZodString; requestId: z.ZodString; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<409>; json: z.ZodObject<{ message: z.ZodString; headMoved: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<502>; json: z.ZodObject<{ message: z.ZodString; proposal: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ proposal: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/save": { POST: { req: { body: z.ZodObject<{ message: z.ZodOptional; patchIds: z.ZodArray>>; expectedHeadCommitSha: z.ZodOptional; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ commitSha: z.ZodOptional; sourceFiles: z.ZodOptional>>; binaryFiles: z.ZodOptional>; branch: z.ZodOptional; binaryFilesUnread: z.ZodOptional>; removed: z.ZodOptional>; moduleFilePath: z.ZodString & z.ZodType>; message: z.ZodString; }, z.core.$strip>>>; headVersion: z.ZodOptional; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<409>; json: z.ZodUnion; message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ message: z.ZodString; isNotFastForward: z.ZodLiteral; }, z.core.$strip>, z.ZodObject<{ message: z.ZodString; headMoved: z.ZodLiteral; }, z.core.$strip>]>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodUnion>, z.ZodArray>>; binaryFilePatchErrors: z.ZodRecord>; unappliablePatches: z.ZodOptional>, z.ZodObject<{ moduleFilePath: z.ZodString & z.ZodType>; message: z.ZodString; }, z.core.$strip>>>; }, z.core.$strip>, z.ZodArray>]>>; }, z.core.$strip>, z.ZodObject<{ message: z.ZodString; errorCode: z.ZodUnion, z.ZodLiteral<"pat-error">]>; }, z.core.$strip>]>; }, z.core.$strip>]>; }; }; "/history/commits": { GET: { req: { query: { branch: z.ZodPipe, z.ZodTransform>; limit: z.ZodOptional, z.ZodTransform>, z.ZodTransform>>; /** The previous page's `nextCursor`. */ cursor: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodIntersection, z.ZodObject<{ kind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodIntersection, z.ZodObject<{ kind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ commits: z.ZodArray; clientCommitSha: z.ZodNullable; branch: z.ZodString; createdBranch: z.ZodNullable; creator: z.ZodNullable; message: z.ZodNullable; createdAt: z.ZodString; seqNum: z.ZodString; patchCount: z.ZodNumber; hasArchive: z.ZodBoolean; }, z.core.$strip>>; nextCursor: z.ZodNullable; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * One commit, reconstructed. IMMUTABLE for a given sha - it says nothing * about the current source or schema, which is what lets it be cached * forever and what makes comparing many commits cheap. */ "/history/commit": { GET: { req: { query: { commit_sha: z.ZodPipe, z.ZodTransform>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodIntersection, z.ZodObject<{ kind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ commit: z.ZodObject<{ commitSha: z.ZodString; parentCommitSha: z.ZodNullable; clientCommitSha: z.ZodNullable; branch: z.ZodString; createdBranch: z.ZodNullable; creator: z.ZodNullable; message: z.ZodNullable; createdAt: z.ZodString; seqNum: z.ZodString; patchCount: z.ZodNumber; hasArchive: z.ZodBoolean; }, z.core.$strip>; modules: z.ZodRecord>>; schema: z.ZodNullable>>; patchIds: z.ZodArray>>; changedPaths: z.ZodArray; failures: z.ZodArray; commitSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"archive-unreadable">; commitSha: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"source-unavailable">; moduleFilePath: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"schema-unreadable">; moduleFilePath: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"file-unavailable">; gitPath: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"not-supported-in-fs-mode">; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"transport">; message: z.ZodString; }, z.core.$strip>], "kind">>; }, z.core.$strip>>; patches: z.ZodArray>; moduleFilePath: z.ZodString; patch: z.ZodUnknown; authorId: z.ZodNullable; createdAt: z.ZodString; baseSha: z.ZodString; coreVersion: z.ZodString; }, z.core.$strip>>; jsonEntries: z.ZodRecord; binaryFiles: z.ZodArray, z.ZodLiteral<"modified">, z.ZodLiteral<"deleted">]>; remote: z.ZodBoolean; url: z.ZodString; }, z.core.$strip>>; warnings: z.ZodArray; commitSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"archive-unreadable">; commitSha: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"source-unavailable">; moduleFilePath: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"schema-unreadable">; moduleFilePath: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"file-unavailable">; gitPath: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"not-supported-in-fs-mode">; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"transport">; message: z.ZodString; }, z.core.$strip>], "kind">>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * ONE module, as of a commit — including a commit that did not change it. * * `/history/commit` covers what a commit changed, which is the narrow case: * navigate the history pane to anything else and there would be nothing to * show. This answers "how did this module look at that point", which is the * question someone comparing two panes is actually asking. Immutable for the * same reason: what a commit left behind cannot change. */ "/history/module": { GET: { req: { query: { commit_sha: z.ZodPipe, z.ZodTransform>; module_file_path: z.ZodPipe, z.ZodTransform>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodIntersection, z.ZodObject<{ kind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ moduleFilePath: z.ZodString; module: z.ZodNullable>>; schema: z.ZodNullable>>; patchIds: z.ZodArray>>; changedPaths: z.ZodArray; failures: z.ZodArray; commitSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"archive-unreadable">; commitSha: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"source-unavailable">; moduleFilePath: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"schema-unreadable">; moduleFilePath: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"file-unavailable">; gitPath: z.ZodString; message: z.ZodString; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"not-supported-in-fs-mode">; }, z.core.$strip>, z.ZodObject<{ kind: z.ZodLiteral<"transport">; message: z.ZodString; }, z.core.$strip>], "kind">>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * One file as it was at one commit. * * The lazy half: `/history/commit` NAMES a commit's binary files and this is * where their bytes come from, so nothing is fetched until an `` * actually mounts. A file at a fixed commit cannot change, so the response is * immutable and the browser's own cache handles flipping between commits. */ /** * One `.jsonValues()` entry's content, as it was at a commit. * * The history pane's counterpart to `/json`. A `.jsonValues()` record's * source is only `{_type:"json"}` markers - the content is per entry, fetched * on demand - so without this the commit pane rendered every entry as an * empty field, which is a claim that the author left it blank. * * One entry per request, deliberately: the store fetches an entry when * something reads inside it, so a batch would mean guessing which entries the * pane is about to show. Authenticated for the same reasons as * `/history/files` below. */ "/history/json": { GET: { req: { query: { commit_sha: z.ZodPipe, z.ZodTransform>; path: z.ZodPipe, z.ZodTransform>; key: z.ZodPipe, z.ZodTransform>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodIntersection, z.ZodObject<{ kind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodIntersection, z.ZodObject<{ kind: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ path: z.ZodString & z.ZodType>; key: z.ZodString; content: z.ZodUnknown; }, z.core.$strip>; }, z.core.$strip>]>; }; }; /** * A binary file as it was at a commit. * * AUTHENTICATED, unlike `/files` below - and the difference is not an * oversight in either direction. See the comment on `/files`: what makes it * safe to leave open is that a `patch_id` is an unguessable UUID, and what * makes leaving it open NECESSARY is that a draft image is fetched by the * app's own backend during Next image optimisation, with no cookies. * * Neither holds here. A commit sha is published - `git log`, the GitHub UI, * every PR - so it is not a secret to stand in for a credential. And nothing * fetches these server-side: they are read by the Studio, in a browser that * has the session cookie, for the history pane and for staging a restore. * So this one asks. */ "/history/files": { GET: { req: { query: { commit_sha: z.ZodPipe, z.ZodTransform>; path: z.ZodPipe, z.ZodTransform>; remote: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; body: z.ZodInstanceOf>; }, z.core.$strip>]>; }; }; "/files": { GET: { req: { path: z.ZodString; query: { patch_id: z.ZodOptional>>, z.ZodTransform>>; remote: z.ZodOptional, z.ZodTransform>>; }; headers: { range: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; body: z.ZodInstanceOf>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<206>; body: z.ZodInstanceOf>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<416>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/json": { GET: { req: { query: { path: z.ZodPipe, z.ZodTransform>; key: z.ZodOptional, z.ZodTransform>>; keys: z.ZodOptional>; offset: z.ZodOptional, z.ZodTransform>, z.ZodTransform>>; limit: z.ZodOptional, z.ZodTransform>, z.ZodTransform>>; apply_patches: z.ZodOptional, z.ZodTransform> & z.ZodType<"false" | "true", string[], z.core.$ZodTypeInternals<"false" | "true", string[]>>, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<404>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ path: z.ZodString & z.ZodType>; key: z.ZodString; content: z.ZodAny; version: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ path: z.ZodString & z.ZodType>; entries: z.ZodArray>; missing: z.ZodArray; errors: z.ZodArray>; offset: z.ZodOptional; limit: z.ZodOptional; total: z.ZodOptional; version: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/ai/initialize": { POST: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ nonce: z.ZodString; wsUrl: z.ZodString; providers: z.ZodOptional>; models: z.ZodOptional>; }, z.core.$strip>>>; defaultModel: z.ZodOptional>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/ai/sessions": { GET: { req: { query: { limit: z.ZodOptional, z.ZodTransform>>; cursor_updatedAt: z.ZodOptional, z.ZodTransform>>; cursor_id: z.ZodOptional, z.ZodTransform>>; /** * The proposal the Studio is in, by name: lists that proposal's * chats, everyone's, instead of your own (valbuild/home * `docs/proposals.md`, Flow H). */ proposal: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ sessions: z.ZodArray; createdAt: z.ZodString; updatedAt: z.ZodString; authorIds: z.ZodOptional>; }, z.core.$strip>>; nextCursor: z.ZodOptional>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; PATCH: { req: { path: z.ZodString; body: z.ZodObject<{ name: z.ZodString; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{}, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/ai/messages": { GET: { req: { path: z.ZodString; query: { limit: z.ZodOptional, z.ZodTransform>>; cursor_updatedAt: z.ZodOptional, z.ZodTransform>>; cursor_id: z.ZodOptional, z.ZodTransform>>; }; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ messages: z.ZodArray>; toolCalls: z.ZodCatch>; answers: z.ZodOptional>; }, z.core.$strip>>>>; role: z.ZodString; content: z.ZodUnion; text: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"image_url">; url: z.ZodString; }, z.core.$strip>]>>]>; }, z.core.$strip>>; nextCursor: z.ZodOptional>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/ai/session-image-to-patch-file": { POST: { req: { body: z.ZodObject<{ patchId: z.ZodString & z.ZodType>; parentRef: z.ZodUnion; headBaseSha: z.ZodString; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"patch">; patchId: z.ZodString & z.ZodType>; }, z.core.$strip>]>; files: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ patchId: z.ZodString & z.ZodType>; files: z.ZodArray; sha256: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<400>; json: z.ZodObject<{ message: z.ZodString; details: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/ai/images": { PATCH: { req: { body: z.ZodObject<{ key: z.ZodString; metadata: z.ZodAny; contentType: z.ZodString; }, z.core.$strip>; cookies: { val_session: z.ZodOptional; }; }; res: z.ZodUnion; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ key: z.ZodString; }, z.core.$strip>; }, z.core.$strip>, z.ZodObject<{ status: z.ZodLiteral<500>; json: z.ZodObject<{ message: z.ZodString; }, z.core.$strip>; }, z.core.$strip>]>; }; }; "/admin/status": { GET: { req: { cookies: { val_session: z.ZodOptional; }; }; res: z.ZodObject<{ status: z.ZodLiteral<200>; json: z.ZodObject<{ connected: z.ZodBoolean; signIn: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>; }; }; "/admin/proxy": { GET: { req: { path: z.ZodString; rawQuery: z.ZodString; headers: { "x-val-studio": z.ZodOptional; }; cookies: { val_session: z.ZodOptional; }; body: z.ZodUnknown; }; res: z.ZodObject<{ status: z.ZodUnion, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>; json: z.ZodUnknown; }, z.core.$strip>; }; POST: { req: { path: z.ZodString; rawQuery: z.ZodString; headers: { "x-val-studio": z.ZodOptional; }; cookies: { val_session: z.ZodOptional; }; body: z.ZodUnknown; }; res: z.ZodObject<{ status: z.ZodUnion, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>; json: z.ZodUnknown; }, z.core.$strip>; }; PUT: { req: { path: z.ZodString; rawQuery: z.ZodString; headers: { "x-val-studio": z.ZodOptional; }; cookies: { val_session: z.ZodOptional; }; body: z.ZodUnknown; }; res: z.ZodObject<{ status: z.ZodUnion, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>; json: z.ZodUnknown; }, z.core.$strip>; }; DELETE: { req: { path: z.ZodString; rawQuery: z.ZodString; headers: { "x-val-studio": z.ZodOptional; }; cookies: { val_session: z.ZodOptional; }; body: z.ZodUnknown; }; res: z.ZodObject<{ status: z.ZodUnion, z.ZodLiteral<400>, z.ZodLiteral<401>, z.ZodLiteral<403>, z.ZodLiteral<404>, z.ZodLiteral<500>]>; json: z.ZodUnknown; }, z.core.$strip>; }; }; }; /** * Extracts the keys of an object where the value is not undefined. */ type DefinedKeys = { [K in keyof T]-?: T[K] extends undefined ? never : K; }[keyof T]; /** * Extracts the keys of an object where the value is not undefined. * Then picks the keys from the object. * This is useful for creating a new object type with only the defined keys. * @example * type A = { a: string; b?: number }; * type B = DefinedObject; // { a: string } */ type DefinedObject = Pick>; /** * This schema supports: * 1. multiple query params with the same name * 2. simple API route definitions where: * 2.1. z.array means at least one query params this name is required * 2.2. z.optional means no query param of this name is accepted * 2.3. z.array(...).optional() means zero or more query params of this name is accepted * * Do not change this without updating the ValRouter query parsing logic * */ export type ValidQueryParamTypes = boolean | number | string | string[] | undefined; export type ApiEndpoint = { req: { path?: z.ZodString | z.ZodOptional; body?: z.ZodTypeAny; query?: Record>; cookies?: Record>; /** * Request headers, by lower-case name, parsed the way `cookies` are. * Absent ones are `undefined`. */ headers?: Record>; /** * The query string exactly as sent (`?a=1&b=2`, or `""`), for a route that * forwards it rather than reading it. `query` is for routes that read it. */ rawQuery?: z.ZodString; }; res: z.ZodSchema<{ status: number; body: unknown; contentType?: string; cookies?: Partial>; } | { status: number; json?: unknown; cookies?: Partial>; } | { cookies?: Partial>; status: 302; redirectTo: string; }>; }; type ApiGuard = Record<`/${string}`, Partial>>; export type ServerOf = { [Route in keyof Api]: { [Method in keyof Api[Route]]: Api[Route][Method] extends ApiEndpoint ? (req: DefinedObject<{ body: Api[Route][Method]["req"]["body"] extends z.ZodTypeAny ? z.infer : undefined; path: Api[Route][Method]["req"]["path"] extends z.ZodSchema ? string : undefined; query: Api[Route][Method]["req"]["query"] extends Record> ? { [key in keyof Api[Route][Method]["req"]["query"]]: z.infer; } : undefined; cookies: Api[Route][Method]["req"]["cookies"] extends Record> ? { [key in keyof Api[Route][Method]["req"]["cookies"]]: z.infer; } : undefined; headers: Api[Route][Method]["req"]["headers"] extends Record> ? { [key in keyof Api[Route][Method]["req"]["headers"]]: z.infer; } : undefined; rawQuery: Api[Route][Method]["req"]["rawQuery"] extends z.ZodString ? string : undefined; }>) => Promise> : never; }; }; export type ClientOf = (route: Route, method: Method, req: DefinedObject<{ body: Endpoint["req"]["body"] extends z.ZodTypeAny ? z.infer : undefined; path: Endpoint["req"]["path"] extends z.ZodSchema ? z.infer : undefined; query: Endpoint["req"]["query"] extends Record> ? { [key in keyof Endpoint["req"]["query"]]: z.infer; } : undefined; headers: Endpoint["req"]["headers"] extends Record> ? { [key in keyof Endpoint["req"]["headers"]]: z.infer; } : undefined; }>) => Promise | ClientFetchErrors>; export type ClientFetchErrors = { status: 404; json: { message: string; method: string; path: string; }; } | { status: 413; json: { message: string; method: string; path: string; }; } | { status: 500; json: { message: string; type: "unknown"; }; } | { status: 504; json: { message: string; }; } | { status: null; json: { type: "network_error"; retryable: boolean; message: string; details: string; } | { message: string; type: "client_side_validation_error"; details: { validationError: string; data: unknown; }; }; }; export type UrlOf = (...args: Route extends "/val" ? [route: Route] : Endpoint["req"]["query"] extends Record> ? [ route: `/api/val${Route & string}`, query: { [key in keyof Endpoint["req"]["query"]]: z.infer; } ] : [ route: `/api/val${Route & string}`, query: {} ]) => string; export type Api = { [Route in keyof typeof Api]: { [Method in keyof (typeof Api)[Route]]: (typeof Api)[Route][Method] extends ApiEndpoint ? (typeof Api)[Route][Method] : never; }; }; export {};