@kitsuden/sdk 0.0.0-stage → 0.9.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/toon.ts","../src/generated/kons/agent-notifications.ts","../src/generated/kons/agent-token.ts","../src/generated/kons/agents.ts","../src/generated/kons/analytics.ts","../src/generated/kons/approvals.ts","../src/generated/kons/audit.ts","../src/generated/kons/automation.ts","../src/generated/kons/blocks.ts","../src/generated/kons/brain.ts","../src/generated/kons/connections.ts","../src/generated/kons/datasets.ts","../src/generated/kons/external-mcp.ts","../src/generated/kons/external-mcp-oauth.ts","../src/generated/kons/media.ts","../src/generated/kons/models.ts","../src/generated/kons/oauth.ts","../src/generated/kons/promotion.ts","../src/generated/kons/promotion-admin.ts","../src/generated/kons/proposals.ts","../src/generated/kons/queue.ts","../src/generated/kons/record-history.ts","../src/generated/kons/reports.ts","../src/generated/kons/secret-access.ts","../src/generated/kons/traces.ts","../src/generated/index.ts","../src/api/errors.ts","../src/api/pagination.ts","../src/api/tron.ts","../src/api/transport.ts","../src/api/stream.ts","../src/api/client.ts","../src/api/standard-schema.ts"],"sourcesContent":["/**\n * @kitsuden/sdk — Universal SDK for Kitsuden\n *\n * The official JavaScript/TypeScript SDK for Kitsuden BaaS.\n * CRUD in 3 lines of code. Edge-ready. Type-safe. Reads JSON and TOON.\n *\n * @example\n * ```typescript\n * import { KitsudenClient } from '@kitsuden/sdk';\n *\n * const kitsuden = new KitsudenClient({\n * url: 'https://api.example.com',\n * apiKey: 'kitsuden_agent_xxx' // Agent NHI token (recommended)\n * });\n *\n * // CRUD via Explorer\n * const games = await kitsuden.from('games').list();\n * const game = await kitsuden.from('games').create({ title: 'New Game' });\n * await kitsuden.from('games').update(game.id, { status: 'published' });\n * await kitsuden.from('games').delete(game.id);\n *\n * // Modules\n * const modules = await kitsuden.modules.list();\n * await kitsuden.modules.toggle('academy');\n *\n * // Schema\n * const schema = await kitsuden.schema('games');\n *\n * // Smaller responses on the wire: the server picks compact JSON or TOON per\n * // response (whichever is shorter and decodes back to the same data). You\n * // still get plain objects back.\n * const lean = new KitsudenClient({ url: '...', apiKey: '...', format: 'auto' });\n * const sameData = await lean.from('games').list();\n * ```\n */\n\nimport { decodeToon } from \"./toon\";\n\nexport { decodeToon, encodeToon, ToonDecodeError } from \"./toon\";\n\n// ═══════════════════════════════════════════════════════════════\n// Typed client (generated from the API's OpenAPI 3.1: pnpm sdk:generate)\n// ═══════════════════════════════════════════════════════════════\n\nexport {\n KitsudenApi,\n createKitsuden,\n expectOk,\n isProposalPending,\n provenanceOf,\n normalizeBaseUrl,\n type KitsudenApiOptions,\n type RawCall,\n} from \"./api/client\";\nexport {\n KitsudenApiError,\n KitsudenNetworkError,\n KitsudenDecodeError,\n ProposalPendingError,\n isKitsudenError,\n} from \"./api/errors\";\nexport { decodeTron, TronDecodeError } from \"./api/tron\";\nexport { decodeBody, parseProvenance, parseRetryAfter, DEFAULT_RETRY } from \"./api/transport\";\nexport { itemsOf } from \"./api/pagination\";\nexport { operationSchemas, toStandardSchema } from \"./api/standard-schema\";\nexport type { StandardIssue, StandardResult, StandardSchemaV1 } from \"./api/standard-schema\";\nexport type {\n CallOptions,\n Format,\n Ok,\n Operation,\n OperationInfo,\n Outcome,\n PageableOperation,\n PaginationInfo,\n Problem,\n Proposal,\n ProposalPending,\n ProposalStatus,\n ProvenanceSummary,\n RecordProvenance,\n RedirectResult,\n ResponseKind,\n ResponseMeta,\n RetryPolicy,\n StreamOperation,\n} from \"./api/types\";\nexport * from \"./generated/index\";\n\n// ═══════════════════════════════════════════════════════════════\n// Types & Configuration\n// ═══════════════════════════════════════════════════════════════\n\nexport interface KitsudenClientConfig {\n /** Base URL of your Kitsuden API (e.g., https://api.example.com) */\n url: string;\n /** API Key for authentication (Bearer token) */\n apiKey?: string;\n /**\n * Wire format: 'json' (default), 'toon', or 'auto' (the server sends compact\n * JSON or TOON, whichever is shorter for each response). The client always\n * decodes, so methods return the same objects in every mode.\n */\n format?: ClientFormat;\n}\n\n/** Wire formats this SDK can decode (TRON is not one: it would add a dependency). */\nexport type ClientFormat = \"json\" | \"toon\" | \"auto\";\n\n/** The operators `GET /api/explorer/:table` understands (another one is a 400). */\nexport type FilterOp = \"contains\" | \"equals\" | \"gt\" | \"lt\" | \"gte\" | \"lte\";\n\n/**\n * The list query of `GET /api/explorer/:table` (apps/api/src/lib/explorer-query.ts).\n * Every condition must hold (AND). A secret column (token, password, hash) cannot be\n * filtered or searched: the API answers 400, as for an unknown operator or column.\n */\nexport interface ListOptions {\n limit?: number;\n page?: number;\n sort?: string;\n dir?: \"asc\" | \"desc\";\n /** Text to find in any textual column (or only in `search_fields`), case-insensitive. */\n search?: string;\n /** Columns the search is limited to (at most 30). */\n search_fields?: string[];\n /**\n * One or more conditions per column: a value (equals) or `{ op: value }`, e.g.\n * `{ status: \"draft\", created_at: { gte: \"2026-01-01\" } }` sends\n * `filter[status]=draft&filter[created_at][gte]=2026-01-01`. At most 20 conditions.\n */\n filters?: Record<\n string,\n string | number | boolean | Partial<Record<FilterOp, string | number | boolean>>\n >;\n /** The older single filter, still honoured (combined with `filters` by AND). */\n filter_field?: string;\n filter_op?: FilterOp;\n filter_value?: string;\n}\n\n/** One change of a record, as the history routes return it (newest first). */\nexport interface RecordChange {\n id: string;\n action: \"create\" | \"update\" | \"delete\";\n /** ISO timestamp. */\n at: string;\n actor: { type: \"user\" | \"agent\" | \"system\"; id: string | null; name: string | null };\n /**\n * The fields that changed. A secret column is `{ field, redacted: true }` with no\n * values; a long value is cut to `{ truncated, bytes, preview }`.\n */\n changes: Array<{ field: string; before?: unknown; after?: unknown; redacted?: true }>;\n truncated: boolean;\n /** The approved proposal this write executed, and who approved it (a user id). */\n proposalId: string | null;\n approvedBy: string | null;\n}\n\nexport interface RecordHistory {\n history: RecordChange[];\n total: number;\n limit: number;\n offset: number;\n}\n\nexport interface ListResponse<T> {\n data: T[];\n pagination: {\n page: number;\n limit: number;\n total: number;\n totalPages: number;\n hasNextPage: boolean;\n hasPrevPage: boolean;\n };\n columns?: Array<{ field: string; type: string; editable: boolean }>;\n}\n\nexport interface SchemaInfo {\n table: string;\n label: string;\n primaryKey: string;\n columns: Array<{\n name: string;\n type: string;\n editable: boolean;\n nullable: boolean;\n relatedTable?: string;\n }>;\n}\n\nexport interface ModuleInfo {\n key: string;\n name: string;\n description: string;\n enabled: boolean;\n category: string;\n canToggle: boolean;\n}\n\nexport interface OptionItem {\n value: string;\n label: string;\n}\n\n// ═══════════════════════════════════════════════════════════════\n// TOON (the same codec the API uses: ./toon.ts is a byte-identical copy)\n// ═══════════════════════════════════════════════════════════════\n\nconst TOON_MIME = \"application/vnd.toon\";\nconst AUTO_ACCEPT = 'application/vnd.kitsuden.auto; formats=\"json,toon\"';\n\n// ═══════════════════════════════════════════════════════════════\n// HTTP Client\n// ═══════════════════════════════════════════════════════════════\n\nclass HttpClient {\n private baseUrl: string;\n private apiKey?: string;\n private format: ClientFormat;\n\n constructor(config: KitsudenClientConfig) {\n this.baseUrl = config.url.replace(/\\/$/, \"\");\n this.apiKey = config.apiKey;\n this.format = config.format || \"json\";\n }\n\n private async request<T>(\n method: string,\n path: string,\n body?: unknown,\n overrideFormat?: ClientFormat\n ): Promise<T> {\n const format = overrideFormat || this.format;\n let url = `${this.baseUrl}/api${path}`;\n\n // Add format=toon as query param for TOON mode\n if (format === \"toon\") {\n const sep = url.includes(\"?\") ? \"&\" : \"?\";\n url += `${sep}format=toon`;\n }\n\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n\n if (format === \"toon\") {\n headers[\"Accept\"] = TOON_MIME;\n } else if (format === \"auto\") {\n headers[\"Accept\"] = AUTO_ACCEPT;\n }\n\n if (this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n const res = await fetch(url, {\n method,\n headers,\n body: body ? JSON.stringify(body) : undefined,\n });\n\n if (!res.ok) {\n const error = await res.json().catch(() => ({ error: res.statusText }));\n throw new KitsudenError(\n error.error || error.message || `Request failed: ${res.status}`,\n res.status\n );\n }\n\n // Handle 204 No Content\n if (res.status === 204) {\n return undefined as T;\n }\n\n // Parse response based on content type\n const contentType = res.headers.get(\"content-type\") || \"\";\n if (contentType.includes(TOON_MIME)) {\n const text = await res.text();\n return decodeToon(text) as T;\n }\n\n return res.json();\n }\n\n get<T>(path: string, format?: ClientFormat): Promise<T> {\n return this.request<T>(\"GET\", path, undefined, format);\n }\n\n post<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>(\"POST\", path, body, \"json\"); // Always JSON for writes\n }\n\n patch<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>(\"PATCH\", path, body, \"json\");\n }\n\n del<T>(path: string): Promise<T> {\n return this.request<T>(\"DELETE\", path, undefined, \"json\");\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Error Class\n// ═══════════════════════════════════════════════════════════════\n\nexport class KitsudenError extends Error {\n constructor(\n message: string,\n public statusCode: number\n ) {\n super(message);\n this.name = \"KitsudenError\";\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Table Reference — Explorer-based CRUD\n// ═══════════════════════════════════════════════════════════════\n\nexport class TableRef<T extends Record<string, unknown> = Record<string, unknown>> {\n constructor(\n private tableName: string,\n private client: HttpClient\n ) {}\n\n /**\n * List records with pagination, sorting, and filtering.\n * @example\n * const games = await kitsuden.from('games').list();\n * const filtered = await kitsuden.from('games').list({ limit: 10, sort: 'title', dir: 'asc' });\n * const found = await kitsuden.from('games').list({\n * search: 'zelda',\n * filters: { status: 'published', released_at: { gte: '2020-01-01' } },\n * });\n */\n async list(options: ListOptions = {}): Promise<ListResponse<T>> {\n const params = new URLSearchParams();\n if (options.limit) params.set(\"limit\", String(options.limit));\n if (options.page) params.set(\"page\", String(options.page));\n if (options.sort) params.set(\"sort\", options.sort);\n if (options.dir) params.set(\"dir\", options.dir);\n if (options.search) params.set(\"search\", options.search);\n if (options.search_fields?.length) params.set(\"search_fields\", options.search_fields.join(\",\"));\n for (const [field, condition] of Object.entries(options.filters ?? {})) {\n if (condition !== null && typeof condition === \"object\") {\n for (const [op, value] of Object.entries(condition)) {\n if (value !== undefined) params.append(`filter[${field}][${op}]`, String(value));\n }\n } else if (condition !== undefined) params.append(`filter[${field}]`, String(condition));\n }\n if (options.filter_field) params.set(\"filter_field\", options.filter_field);\n if (options.filter_op) params.set(\"filter_op\", options.filter_op);\n if (options.filter_value) params.set(\"filter_value\", options.filter_value);\n\n const query = params.toString();\n return this.client.get<ListResponse<T>>(\n `/explorer/${this.tableName}${query ? `?${query}` : \"\"}`\n );\n }\n\n /**\n * Get a single record by ID.\n * @example\n * const game = await kitsuden.from('games').get('uuid-123');\n */\n async get(id: string): Promise<T> {\n // Explorer doesn't have a single-record GET, so we use filter\n const result = await this.list({ filters: { id }, limit: 1 });\n const record = result.data?.[0];\n if (!record) throw new KitsudenError(\"Record not found\", 404);\n return record;\n }\n\n /**\n * Create a new record.\n * @example\n * const newGame = await kitsuden.from('games').create({ title: 'New Game', slug: 'new-game' });\n */\n async create(data: Partial<T>): Promise<T> {\n return this.client.post<T>(`/explorer/${this.tableName}`, data);\n }\n\n /**\n * Update an existing record.\n * @example\n * await kitsuden.from('games').update('uuid-123', { status: 'published' });\n */\n async update(id: string, data: Partial<T>): Promise<T> {\n return this.client.patch<T>(`/explorer/${this.tableName}/${id}`, data);\n }\n\n /**\n * Delete a record.\n * @example\n * await kitsuden.from('games').delete('uuid-123');\n */\n async delete(id: string): Promise<void> {\n await this.client.del<void>(`/explorer/${this.tableName}/${id}`);\n }\n\n /**\n * Who created, changed or deleted a record, when, and which fields (newest first).\n * Writes are recorded from the moment the record history exists; a deleted record\n * keeps its history. Admin only (`GET /api/history/:table/:id`), like the explorer.\n * @example\n * const { history } = await kitsuden.from('games').history('uuid-123');\n */\n async history(\n id: string,\n page: { limit?: number; offset?: number } = {}\n ): Promise<RecordHistory> {\n const params = new URLSearchParams();\n if (page.limit) params.set(\"limit\", String(page.limit));\n if (page.offset) params.set(\"offset\", String(page.offset));\n const query = params.toString();\n return this.client.get<RecordHistory>(\n `/history/${this.tableName}/${encodeURIComponent(id)}${query ? `?${query}` : \"\"}`\n );\n }\n\n /**\n * Get dropdown options for this table (id → display name pairs).\n * Useful for FK resolution.\n * @example\n * const options = await kitsuden.from('platforms').options();\n */\n async options(): Promise<OptionItem[]> {\n const result = await this.client.get<{ options: OptionItem[] }>(\n `/explorer/${this.tableName}/options`\n );\n return result.options;\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Collection Reference — DataSets API (backward compat)\n// ═══════════════════════════════════════════════════════════════\n\nexport class CollectionRef<T extends Record<string, unknown> = Record<string, unknown>> {\n constructor(\n private collectionName: string,\n private client: HttpClient\n ) {}\n\n async get(\n options: { limit?: number; page?: number; status?: string; sort?: string } = {}\n ): Promise<{ docs: T[]; totalDocs: number }> {\n const params = new URLSearchParams();\n if (options.limit) params.set(\"limit\", String(options.limit));\n if (options.page) params.set(\"page\", String(options.page));\n if (options.status) params.set(\"status\", options.status);\n if (options.sort) params.set(\"sort\", options.sort);\n const query = params.toString();\n return this.client.get<{ docs: T[]; totalDocs: number }>(\n `/datasets/${this.collectionName}/entries${query ? `?${query}` : \"\"}`\n );\n }\n\n async insert(data: Partial<T>): Promise<T> {\n return this.client.post<T>(`/datasets/slug/${this.collectionName}/entries`, data);\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Modules API\n// ═══════════════════════════════════════════════════════════════\n\nclass ModulesAPI {\n constructor(private client: HttpClient) {}\n\n /** List all modules with their status */\n async list(): Promise<ModuleInfo[]> {\n const result = await this.client.get<{ docs: ModuleInfo[] }>(\"/modules\");\n return result.docs;\n }\n\n /** Toggle a module on/off */\n async toggle(key: string): Promise<ModuleInfo> {\n return this.client.post<ModuleInfo>(`/modules/${key}/toggle`, {});\n }\n\n /** Get modules that are currently enabled */\n async enabled(): Promise<ModuleInfo[]> {\n const all = await this.list();\n return all.filter((m) => m.enabled);\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Main SDK Class\n// ═══════════════════════════════════════════════════════════════\n\nexport class KitsudenClient {\n private httpClient: HttpClient;\n\n /** Module management API */\n public readonly modules: ModulesAPI;\n\n /** Graphify engine — automatic relational APIs (/api/graph) */\n public readonly graph: GraphAPI;\n\n /**\n * Create a new Kitsuden SDK client.\n *\n * @example\n * // JSON mode (default)\n * const kitsuden = new KitsudenClient({ url: 'http://localhost:3000', apiKey: 'kitsuden_agent_xxx' });\n *\n * // Smaller responses: the server picks compact JSON or TOON per response\n * const agent = new KitsudenClient({ url: 'http://localhost:3000', apiKey: 'kitsuden_agent_xxx', format: 'auto' });\n */\n constructor(config: KitsudenClientConfig) {\n this.httpClient = new HttpClient(config);\n this.modules = new ModulesAPI(this.httpClient);\n this.graph = new GraphAPI(this.httpClient);\n }\n\n /**\n * Access a table for CRUD operations via the Explorer API.\n * This is the primary way to interact with Kitsuden data.\n *\n * @example\n * const games = await kitsuden.from('games').list();\n * const newGame = await kitsuden.from('games').create({ title: 'Hi' });\n */\n from<T extends Record<string, unknown> = Record<string, unknown>>(table: string): TableRef<T> {\n return new TableRef<T>(table, this.httpClient);\n }\n\n /**\n * Get schema information for a table.\n * Returns column types, editability, and relation info.\n *\n * @example\n * const schema = await kitsuden.schema('games');\n * console.log(schema.columns); // [{ name: 'title', type: 'text', editable: true }, ...]\n */\n async schema(table: string): Promise<SchemaInfo> {\n return this.httpClient.get<SchemaInfo>(`/explorer/schema/kons/${table}`);\n }\n\n /**\n * List all available tables.\n *\n * @example\n * const tables = await kitsuden.tables();\n */\n async tables(): Promise<Array<{ key: string; label: string; icon: string; rowCount: number }>> {\n const result = await this.httpClient.get<{ tables: any[] }>(\"/explorer/tables\");\n return result.tables;\n }\n\n /**\n * Access a dataset collection (backward compatibility).\n * For new code, use `.from()` instead.\n *\n * @deprecated Use `.from(table)` for Explorer API\n */\n collection<T extends Record<string, unknown> = Record<string, unknown>>(\n name: string\n ): CollectionRef<T> {\n return new CollectionRef<T>(name, this.httpClient);\n }\n\n /**\n * Health check — verify the API is reachable.\n *\n * @example\n * const healthy = await kitsuden.ping();\n */\n async ping(): Promise<boolean> {\n try {\n await this.httpClient.get(\"/health\");\n return true;\n } catch {\n return false;\n }\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Graph API (Graphify engine — KITSUDEN architecture §3)\n// ═══════════════════════════════════════════════════════════════\n\nexport interface GraphInfo {\n tables: string[];\n edges: Array<{ from: string; fromColumn: string; to: string; toColumn: string }>;\n}\n\nexport interface GraphListOptions {\n limit?: number;\n offset?: number;\n orderBy?: string;\n order?: \"asc\" | \"desc\";\n /** Equality filters column=value */\n filters?: Record<string, string>;\n}\n\n/**\n * Graphify engine — automatic relational endpoints.\n * JOINs are resolved on the server based on the real PostgreSQL FKs.\n *\n * @example\n * const projects = await kitsuden.graph.related('users', '1', 'projects');\n */\nexport class GraphAPI {\n constructor(private client: HttpClient) {}\n\n private query(options: GraphListOptions = {}): string {\n const params = new URLSearchParams();\n if (options.limit) params.set(\"limit\", String(options.limit));\n if (options.offset) params.set(\"offset\", String(options.offset));\n if (options.orderBy) params.set(\"orderBy\", options.orderBy);\n if (options.order) params.set(\"order\", options.order);\n for (const [k, v] of Object.entries(options.filters ?? {})) params.set(k, v);\n const qs = params.toString();\n return qs ? `?${qs}` : \"\";\n }\n\n /** Full graph: exposed tables + FK relations */\n async info(): Promise<GraphInfo> {\n return this.client.get<GraphInfo>(\"/graph\");\n }\n\n /** Paginated listing of a table */\n async list<T = Record<string, unknown>>(\n table: string,\n options: GraphListOptions = {}\n ): Promise<{ rows: T[]; limit: number; offset: number }> {\n return this.client.get(`/graph/${table}${this.query(options)}`);\n }\n\n /** Single record by primary key */\n async get<T = Record<string, unknown>>(table: string, id: string): Promise<{ row: T }> {\n return this.client.get(`/graph/${table}/${id}`);\n }\n\n /** Related rows — automatic JOIN (N:1, 1:N and N:M) */\n async related<T = Record<string, unknown>>(\n table: string,\n id: string,\n relation: string,\n options: GraphListOptions = {}\n ): Promise<{ kind: string; rows: T[]; limit: number; offset: number }> {\n return this.client.get(`/graph/${table}/${id}/${relation}${this.query(options)}`);\n }\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Convenience Factory\n// ═══════════════════════════════════════════════════════════════\n\n/**\n * Create a Kitsuden client with a simple function call.\n *\n * @example\n * const kitsuden = createClient('http://localhost:3000', 'kitsuden_agent_xxx');\n * const lean = createClient('http://localhost:3000', 'kitsuden_agent_xxx', 'auto');\n */\nexport function createClient(\n url: string,\n apiKey?: string,\n format: ClientFormat = \"json\"\n): KitsudenClient {\n return new KitsudenClient({ url, apiKey, format });\n}\n\n// ═══════════════════════════════════════════════════════════════\n// Backward Compatibility\n// ═══════════════════════════════════════════════════════════════\n\n/** @deprecated Use KitsudenClient instead */\nexport const Kitsuden = KitsudenClient;\n\n// ═══════════════════════════════════════════════════════════════\n// Default Export\n// ═══════════════════════════════════════════════════════════════\n\nexport default KitsudenClient;\n","/**\n * Kitsuden — TOON (Token-Oriented Object Notation), canonical codec\n * ============================================================================\n *\n * Own implementation, dependency-free, of https://toonformat.dev/ . The\n * encoder's OUTPUT is byte-for-byte the same as that of the reference\n * implementation `@toon-format/toon@4.4.0` for any JSON value, and the decoder\n * reads everything that version writes. It is guarded by\n * `src/tests-unit/toon-tabular.test.ts`, which compares the two in both\n * directions (also with random data).\n *\n * This file is the CANONICAL copy. There are two identical copies, byte for byte,\n * for the packages that cannot depend on the API: `packages/sdk/src/toon.ts`\n * (the SDK has no dependencies) and `packages/mcp-server/src/toon.ts`. It is guarded by\n * `src/tests-unit/toon-mirrors.test.ts`: edit here and copy.\n *\n * users[2]{id,name,role}: ← table: the keys ONCE, CSV rows\n * 1,Alice,admin\n * 2,Bob,user\n * docs[2]{id,_meta{datasetId,createdAt},name}: ← object column folded\n * 1,d1,2026-01-01,a into the header\n * 2,d1,2026-01-02,b\n * tags[3]: admin,ops,dev ← inline scalar array\n * items[2]: ← list form (non-uniform objects)\n * - id: 1\n * extra: true\n * - id: 2\n * profile: ← empty object: the key with nothing after it\n * empty: [] ← empty array\n *\n * Root: an array is written without a key (`[2]{id}:`), an empty object is the\n * empty document, and a scalar is its literal. 2-space indentation.\n *\n * Input semantics = those of `JSON.stringify`: `toJSON` is called (Date →\n * ISO), `undefined`/function/symbol properties disappear, in an array\n * they become `null`, NaN/±Infinity become `null` and -0 becomes 0. That way\n * `decodeToon(encodeToon(x))` is the same as `JSON.parse(JSON.stringify(x))`,\n * which is what `auto` mode (lib/formats.ts) needs to verify that\n * a TOON response loses nothing compared with the same one in JSON.\n *\n * History (2026-10-25, measurement G1 in docs/agents/benchmarks.md): the previous\n * codec could not read the list form (it returned `[]` without error in 15 of\n * 24 real endpoints), wrote `{}` where TOON expects the bare key, and\n * put root arrays under an invented `data` key.\n */\n\n// ── Literals and patterns (those of the reference) ──────────────────────────\n\nconst INDENTATION = 2;\nconst DELIMITER = \",\";\nconst DELIMITERS = [\",\", \"\\t\", \"|\"] as const;\n/** Number that a decoder reads as a number (no leading zeros). */\nconst NUMERIC_LITERAL = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i;\n/** Text that LOOKS like a number (with leading zeros or a + sign): it goes in quotes. */\nconst LOOKS_LIKE_NUMBER = /^[+-]?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i;\nconst UNQUOTED_KEY = /^[A-Z_][\\w.]*$/i;\nconst ARRAY_LENGTH = /^(?:0|[1-9]\\d*)$/;\n// Control characters: they are escaped (\\uXXXX) and force quoting. This is on purpose.\n// eslint-disable-next-line no-control-regex\nconst CONTROL = /[\\u0000-\\u001F]/;\n// eslint-disable-next-line no-control-regex\nconst CONTROL_GLOBAL = /[\\u0000-\\u001F]/g;\n\nexport class ToonDecodeError extends SyntaxError {\n line?: number;\n constructor(message: string, line?: number) {\n super(line !== undefined ? `Line ${line}: ${message}` : message);\n this.name = \"ToonDecodeError\";\n this.line = line;\n }\n}\n\ntype Json = null | boolean | number | string | Json[] | { [k: string]: Json };\ntype JsonObject = { [k: string]: Json };\n\nfunction isObject(v: unknown): v is JsonObject {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\nfunction isScalar(v: unknown): v is null | boolean | number | string {\n return v === null || typeof v === \"string\" || typeof v === \"number\" || typeof v === \"boolean\";\n}\nfunction isEmptyObject(v: JsonObject): boolean {\n for (const _ in v) return false;\n return true;\n}\nconst has = (o: object, k: string) => Object.prototype.hasOwnProperty.call(o, k);\n\n/** Assigns without going through the inherited `__proto__` setter. */\nfunction assign(target: JsonObject, key: string, value: Json): void {\n if (key === \"__proto__\") {\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n return;\n }\n target[key] = value;\n}\n\n// ── Normalization with JSON.stringify semantics ─────────────────────────────\n\n/**\n * Returns the value as `JSON.parse(JSON.stringify(v))` would see it.\n * Copies only what changes: a value that is already pure JSON is returned as is\n * (the middleware case, which starts from an already parsed body).\n */\nfunction normalize(v: unknown, withinArray: boolean): Json | undefined {\n if (v === null) return null;\n if (typeof v === \"object\" || typeof v === \"bigint\") {\n const withToJson = v as { toJSON?: () => unknown };\n if (typeof withToJson.toJSON === \"function\") return normalize(withToJson.toJSON(), withinArray);\n }\n switch (typeof v) {\n case \"string\":\n case \"boolean\":\n return v;\n case \"number\":\n if (!Number.isFinite(v)) return null;\n return Object.is(v, -0) ? 0 : v;\n case \"bigint\":\n // Same as JSON.stringify: a BigInt without toJSON cannot be serialized.\n throw new TypeError(\"Do not know how to serialize a BigInt\");\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n return withinArray ? null : undefined;\n }\n if (Array.isArray(v)) {\n let copy: Json[] | null = null;\n for (let i = 0; i < v.length; i++) {\n const n = normalize(v[i], true) as Json;\n if (copy) copy.push(n);\n else if (n !== v[i]) {\n copy = v.slice(0, i) as Json[];\n copy.push(n);\n }\n }\n return copy ?? (v as Json[]);\n }\n const obj = v as Record<string, unknown>;\n let copy: JsonObject | null = null;\n const keys = Object.keys(obj);\n for (let i = 0; i < keys.length; i++) {\n const k = keys[i]!;\n const n = normalize(obj[k], false);\n if (copy) {\n if (n !== undefined) assign(copy, k, n);\n } else if (n !== obj[k]) {\n copy = {};\n for (let j = 0; j < i; j++) assign(copy, keys[j]!, obj[keys[j]!] as Json);\n if (n !== undefined) assign(copy, k, n);\n }\n }\n return copy ?? (obj as JsonObject);\n}\n\n// ── Scalars ─────────────────────────────────────────────────────────────────\n\nfunction escape(s: string): string {\n return s\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, \"\\\\n\")\n .replace(/\\r/g, \"\\\\r\")\n .replace(/\\t/g, \"\\\\t\")\n .replace(CONTROL_GLOBAL, (c) => `\\\\u${c.charCodeAt(0).toString(16).padStart(4, \"0\")}`);\n}\n\nfunction goesWithoutQuotes(s: string): boolean {\n if (!s) return false;\n if (/^[ \\t]|[ \\t]$/.test(s)) return false;\n if (s === \"true\" || s === \"false\" || s === \"null\") return false;\n if (LOOKS_LIKE_NUMBER.test(s)) return false;\n if (s.includes(\":\") || s.includes('\"') || s.includes(\"\\\\\")) return false;\n if (/[[\\]{}]/.test(s)) return false;\n if (CONTROL.test(s)) return false;\n if (s.includes(DELIMITER)) return false;\n if (s.startsWith(\"-\") || s.startsWith(\"#\")) return false;\n return true;\n}\n\nfunction scalar(v: null | boolean | number | string): string {\n if (v === null) return \"null\";\n if (typeof v === \"boolean\" || typeof v === \"number\") return String(v);\n return goesWithoutQuotes(v) ? v : `\"${escape(v)}\"`;\n}\n\nfunction key(k: string): string {\n return UNQUOTED_KEY.test(k) ? k : `\"${escape(k)}\"`;\n}\n\n// ── Table detection ─────────────────────────────────────────────────────────\n\n/** Column of a table: a leaf, or a uniform object folded into the header. */\ninterface Field {\n name: string;\n children?: Field[];\n}\n\n/** Rows are a table if they have the same keys and each column is a leaf or table-object. */\nfunction tableFields(rows: JsonObject[]): Field[] | undefined {\n if (rows.length === 0) return undefined;\n const firstOnes = Object.keys(rows[0]!);\n if (firstOnes.length === 0) return undefined;\n for (const row of rows) {\n if (Object.keys(row).length !== firstOnes.length) return undefined;\n for (const k of firstOnes) if (!has(row, k)) return undefined;\n }\n const fields: Field[] = [];\n for (const k of firstOnes) {\n const column = rows.map((f) => f[k]);\n if (column.every(isScalar)) {\n fields.push({ name: k });\n continue;\n }\n if (!column.every((v) => isObject(v) && !isEmptyObject(v))) return undefined;\n const children = tableFields(column as JsonObject[]);\n if (!children) return undefined;\n fields.push({ name: k, children });\n }\n return fields;\n}\n\n/** Object whose values (2 or more) are uniform objects: table with a key per row. */\nfunction tableFieldsWithKey(v: JsonObject): Field[] | undefined {\n const values = Object.values(v);\n if (values.length < 2) return undefined;\n if (!values.every((x) => isObject(x) && !isEmptyObject(x))) return undefined;\n return tableFields(values as JsonObject[]);\n}\n\nfunction leaves(row: JsonObject, fields: Field[], out: Json[]): Json[] {\n for (const c of fields) {\n const v = row[c.name] as Json;\n if (c.children) leaves(v as JsonObject, c.children, out);\n else out.push(v);\n }\n return out;\n}\n\nfunction fieldSegment(fields: Field[]): string {\n return fields\n .map((c) => key(c.name) + (c.children ? `{${fieldSegment(c.children)}}` : \"\"))\n .join(DELIMITER);\n}\n\nfunction header(length: number, k?: string, fields?: Field[], withKey = false): string {\n let h = k !== undefined ? key(k) : \"\";\n h += `[${length}${withKey ? \":\" : \"\"}]`;\n if (fields) h += `{${fieldSegment(fields)}}`;\n return h + \":\";\n}\n\nfunction csvRow(values: Json[]): string {\n return values.map((v) => scalar(v as null | boolean | number | string)).join(DELIMITER);\n}\n\n// ── Encoder ─────────────────────────────────────────────────────────────────\n\nclass Output {\n readonly lines: string[] = [];\n line(level: number, text: string): void {\n this.lines.push(\" \".repeat(INDENTATION * level) + text);\n }\n item(level: number, text: string): void {\n this.line(level, \"- \" + text);\n }\n}\n\nfunction inlineLine(values: Json[], k?: string): string {\n const h = header(values.length, k);\n return values.length === 0 ? h : `${h} ${csvRow(values)}`;\n}\n\nfunction encodeObject(o: JsonObject, level: number, s: Output): void {\n for (const k of Object.keys(o)) encodePair(k, o[k] as Json, level, s);\n}\n\nfunction encodePair(k: string, v: Json, level: number, s: Output): void {\n if (isScalar(v)) {\n s.line(level, `${key(k)}: ${scalar(v)}`);\n } else if (Array.isArray(v)) {\n encodeArray(k, v, level, s);\n } else {\n const withKey = tableFieldsWithKey(v);\n if (withKey) {\n encodeTableWithKey(k, v, withKey, level, s);\n return;\n }\n s.line(level, `${key(k)}:`);\n if (!isEmptyObject(v)) encodeObject(v, level + 1, s);\n }\n}\n\nfunction encodeTableWithKey(\n k: string | undefined,\n v: JsonObject,\n fields: Field[],\n level: number,\n s: Output\n): void {\n const inputs = Object.keys(v);\n s.line(level, header(inputs.length, k, fields, true));\n rowsWithKey(v, inputs, fields, level + 1, s);\n}\n\nfunction rowsWithKey(\n v: JsonObject,\n inputs: string[],\n fields: Field[],\n level: number,\n s: Output\n): void {\n for (const e of inputs)\n s.line(level, `${key(e)}: ${csvRow(leaves(v[e] as JsonObject, fields, []))}`);\n}\n\nfunction tableRows(rows: JsonObject[], fields: Field[], level: number, s: Output): void {\n for (const f of rows) s.line(level, csvRow(leaves(f, fields, [])));\n}\n\nfunction encodeArray(k: string | undefined, v: Json[], level: number, s: Output): void {\n if (v.length === 0) {\n s.line(level, k !== undefined ? `${key(k)}: []` : \"[]\");\n return;\n }\n if (v.every(isScalar)) {\n s.line(level, inlineLine(v, k));\n return;\n }\n if (v.every((a) => Array.isArray(a) && a.every(isScalar))) {\n s.line(level, header(v.length, k));\n for (const a of v) s.item(level + 1, inlineLine(a as Json[]));\n return;\n }\n if (v.every(isObject)) {\n const fields = tableFields(v as JsonObject[]);\n if (fields) {\n s.line(level, header(v.length, k, fields));\n tableRows(v as JsonObject[], fields, level + 1, s);\n return;\n }\n }\n s.line(level, header(v.length, k));\n for (const x of v) encodeItem(x, level + 1, s);\n}\n\nfunction encodeItem(v: Json, level: number, s: Output): void {\n if (isScalar(v)) {\n s.item(level, scalar(v));\n } else if (Array.isArray(v)) {\n if (v.every(isScalar)) s.item(level, inlineLine(v));\n else {\n s.item(level, header(v.length));\n for (const x of v) encodeItem(x, level + 1, s);\n }\n } else {\n encodeObjectAsItem(v, level, s);\n }\n}\n\nfunction encodeObjectAsItem(o: JsonObject, level: number, s: Output): void {\n const keys = Object.keys(o);\n if (keys.length === 0) {\n s.line(level, \"-\");\n return;\n }\n const k0 = keys[0]!;\n const v0 = o[k0] as Json;\n const rest = (): void => {\n for (let i = 1; i < keys.length; i++) encodePair(keys[i]!, o[keys[i]!] as Json, level + 1, s);\n };\n\n if (Array.isArray(v0) && v0.length > 0 && v0.every(isObject)) {\n const fields = tableFields(v0 as JsonObject[]);\n if (fields) {\n s.item(level, header(v0.length, k0, fields));\n tableRows(v0 as JsonObject[], fields, level + 2, s);\n rest();\n return;\n }\n }\n if (isObject(v0)) {\n const withKey = tableFieldsWithKey(v0);\n if (withKey) {\n const inputs = Object.keys(v0);\n s.item(level, header(inputs.length, k0, withKey, true));\n rowsWithKey(v0, inputs, withKey, level + 2, s);\n rest();\n return;\n }\n }\n const ck = key(k0);\n if (isScalar(v0)) {\n s.item(level, `${ck}: ${scalar(v0)}`);\n } else if (Array.isArray(v0)) {\n if (v0.length === 0) s.item(level, `${ck}: []`);\n else if (v0.every(isScalar)) s.item(level, `${ck}${inlineLine(v0)}`);\n else {\n s.item(level, `${ck}${header(v0.length)}`);\n for (const x of v0) encodeItem(x, level + 2, s);\n }\n } else {\n s.item(level, `${ck}:`);\n if (!isEmptyObject(v0)) encodeObject(v0, level + 2, s);\n }\n rest();\n}\n\n/**\n * Encodes a value to TOON. Same output as `encode()` from\n * `@toon-format/toon@4.4.0` (without a trailing newline). `undefined` at the root\n * gives `null`, like the JSON body of an empty response.\n */\nexport function encodeToon(input: unknown): string {\n const v = normalize(input, true) ?? null;\n if (isScalar(v)) {\n // A text that starts with a BOM is always quoted (otherwise it would disappear).\n return typeof v === \"string\" && v.startsWith(\"\\uFEFF\") ? `\"${escape(v)}\"` : scalar(v);\n }\n const s = new Output();\n if (Array.isArray(v)) encodeArray(undefined, v, 0, s);\n else {\n const withKey = tableFieldsWithKey(v);\n if (withKey) encodeTableWithKey(undefined, v, withKey, 0, s);\n else encodeObject(v, 0, s);\n }\n return s.lines.join(\"\\n\");\n}\n\n// ── Decoder ─────────────────────────────────────────────────────────────────\n\ninterface Line {\n level: number;\n text: string;\n num: number;\n}\n\nclass Reader {\n private i = 0;\n constructor(private readonly lines: Line[]) {}\n look(): Line | undefined {\n return this.lines[this.i];\n }\n read(): Line | undefined {\n return this.lines[this.i++];\n }\n}\n\nfunction scan(text: string): Line[] {\n const rawOnes = text.split(\"\\n\");\n const out: Line[] = [];\n for (let n = 0; n < rawOnes.length; n++) {\n let raw = rawOnes[n]!;\n if (n === 0 && raw.startsWith(\"\\uFEFF\")) raw = raw.slice(1);\n if (raw.endsWith(\"\\r\")) raw = raw.slice(0, -1);\n let indent = 0;\n let withTab = false;\n while (indent < raw.length && (raw[indent] === \" \" || raw[indent] === \"\\t\")) {\n if (raw[indent] === \"\\t\") withTab = true;\n indent++;\n }\n let end = raw.length;\n while (end > indent && raw[end - 1] === \" \") end--;\n if (end === indent) continue; // blank line\n if (!withTab && raw[indent] === \"#\") continue; // comment\n if (withTab) throw new ToonDecodeError(\"Tabs are not allowed in indentation\", n + 1);\n const content = indent === 0 && end === raw.length ? raw : raw.slice(indent, end);\n out.push({ level: Math.floor(indent / INDENTATION), text: content, num: n + 1 });\n }\n return out;\n}\n\nfunction trim(s: string): string {\n let a = 0;\n let b = s.length;\n while (a < b && s[a] === \" \") a++;\n while (b > a && s[b - 1] === \" \") b--;\n return a === 0 && b === s.length ? s : s.slice(a, b);\n}\n\nconst ESCAPES: Record<string, string> = { n: \"\\n\", t: \"\\t\", r: \"\\r\", \"\\\\\": \"\\\\\", '\"': '\"' };\n\nfunction unescapeText(s: string): string {\n if (!s.includes(\"\\\\\")) return s;\n return s.replace(/\\\\(u[0-9a-fA-F]{4}|.?)/g, (_, seq: string) => {\n if (seq.length === 5) return String.fromCharCode(parseInt(seq.slice(1), 16));\n const c = ESCAPES[seq];\n if (c === undefined) throw new SyntaxError(`Invalid escape sequence: \\\\${seq}`);\n return c;\n });\n}\n\nfunction closingQuote(s: string, from: number): number {\n for (let i = from + 1; i < s.length; i++) {\n if (s[i] === \"\\\\\") {\n i++;\n continue;\n }\n if (s[i] === '\"') return i;\n }\n return -1;\n}\n\n/** Position of `ch` outside quotes, or -1. */\nfunction outsideQuotes(s: string, ch: string, from = 0): number {\n // Shortcut: if `ch` appears before the first quote, it is outside quotes.\n const quote = s.indexOf('\"', from);\n const direct = s.indexOf(ch, from);\n if (quote === -1 || (direct !== -1 && direct < quote)) return direct;\n let inside = false;\n for (let i = from; i < s.length; i++) {\n const c = s[i];\n if (inside && c === \"\\\\\") {\n i++;\n continue;\n }\n if (c === '\"') inside = !inside;\n else if (!inside && c === ch) return i;\n }\n return -1;\n}\n\nfunction literalText(token: string): string {\n const t = trim(token);\n if (!t.startsWith('\"')) return t;\n const end = closingQuote(t, 0);\n if (end === -1) throw new SyntaxError(\"Unterminated string: missing closing quote\");\n if (end !== t.length - 1) throw new SyntaxError(\"Unexpected characters after closing quote\");\n return unescapeText(t.slice(1, end));\n}\n\nfunction primitive(token: string): Json {\n const t = trim(token);\n if (!t) return \"\";\n if (t.startsWith('\"')) return literalText(t);\n if (t === \"true\") return true;\n if (t === \"false\") return false;\n if (t === \"null\") return null;\n if (NUMERIC_LITERAL.test(t)) {\n const n = Number.parseFloat(t);\n if (Number.isFinite(n)) return Object.is(n, -0) ? 0 : n;\n }\n return t;\n}\n\nfunction separate(input: string, delim: string): string[] {\n if (!input.includes('\"')) return input === \"\" ? [] : input.split(delim).map(trim);\n const values: string[] = [];\n let start = 0;\n let inside = false;\n for (let i = 0; i < input.length; i++) {\n const c = input[i];\n if (inside && c === \"\\\\\" && i + 1 < input.length) {\n i++;\n continue;\n }\n if (c === '\"') inside = !inside;\n else if (!inside && c === delim) {\n values.push(trim(input.slice(start, i)));\n start = i + 1;\n }\n }\n if (start < input.length || values.length > 0) values.push(trim(input.slice(start)));\n return values;\n}\n\nfunction closingBrace(s: string, from: number): number {\n let inside = false;\n let depth = 0;\n for (let i = from; i < s.length; i++) {\n const c = s[i];\n if (inside && c === \"\\\\\") {\n i++;\n continue;\n }\n if (c === '\"') inside = !inside;\n else if (!inside && c === \"{\") depth++;\n else if (!inside && c === \"}\") {\n depth--;\n if (depth === 0) return i;\n }\n }\n return -1;\n}\n\nfunction readFields(segment: string, delim: string): Field[] {\n const parts: string[] = [];\n let actual = \"\";\n let inside = false;\n let depth = 0;\n for (let i = 0; i < segment.length; i++) {\n const c = segment[i]!;\n if (inside && c === \"\\\\\" && i + 1 < segment.length) {\n actual += c + segment[i + 1];\n i++;\n continue;\n }\n if (c === '\"') inside = !inside;\n else if (!inside && c === \"{\") depth++;\n else if (!inside && c === \"}\") depth--;\n else if (!inside && depth === 0 && c === delim) {\n parts.push(actual);\n actual = \"\";\n continue;\n }\n actual += c;\n }\n parts.push(actual);\n return parts.map((p) => {\n const t = trim(p);\n if (!t) throw new SyntaxError(\"Empty field name in field list\");\n const opens = outsideQuotes(t, \"{\");\n if (opens === -1) return { name: literalText(t) };\n const closes = closingBrace(t, opens);\n if (closes !== t.length - 1)\n throw new SyntaxError(\"Unexpected content after nested field group\");\n return {\n name: literalText(t.slice(0, opens)),\n children: readFields(t.slice(opens + 1, closes), delim),\n };\n });\n}\n\nfunction countLeaves(cs: Field[]): number {\n let n = 0;\n for (const c of cs) n += c.children ? countLeaves(c.children) : 1;\n return n;\n}\n\ninterface Header {\n key?: string;\n length: number;\n delim: string;\n fields?: Field[];\n withKey: boolean;\n online?: string;\n}\n\n/** Reads an array header (`key[N]{fields}: ...`) or returns undefined if the line is not one. */\nfunction readHeader(text: string): Header | undefined {\n let opens: number;\n if (text.startsWith('\"')) {\n const end = closingQuote(text, 0);\n if (end === -1 || text[end + 1] !== \"[\") return undefined;\n opens = end + 1;\n } else opens = outsideQuotes(text, \"[\");\n if (opens === -1) return undefined;\n const firstColon = outsideQuotes(text, \":\");\n if (firstColon === -1 || firstColon < opens) return undefined;\n const closes = outsideQuotes(text, \"]\", opens);\n if (closes === -1) throw new SyntaxError(\"Unterminated bracket segment\");\n\n let endBraces = closes + 1;\n const brace = outsideQuotes(text, \"{\", closes);\n if (brace !== -1 && brace < outsideQuotes(text, \":\", closes)) {\n if (brace !== closes + 1)\n throw new SyntaxError(\"Unexpected content between bracket segment and field list\");\n const end = closingBrace(text, brace);\n if (end !== -1) endBraces = end + 1;\n }\n const colon = outsideQuotes(text, \":\", Math.max(closes, endBraces));\n if (colon === -1) throw new SyntaxError(\"Missing colon after array header\");\n if (colon !== Math.max(closes + 1, endBraces)) {\n throw new SyntaxError(\"Unexpected content between bracket segment and colon\");\n }\n\n let k: string | undefined;\n if (opens > 0) {\n const raw = text.slice(0, opens);\n if (/[ \\t]$/.test(raw))\n throw new SyntaxError(\"Unexpected whitespace between key and bracket segment\");\n k = raw.startsWith('\"') ? literalText(raw) : raw;\n }\n\n let seg = text.slice(opens + 1, closes);\n let delim: string = DELIMITER;\n if (seg.endsWith(\"\\t\")) {\n delim = \"\\t\";\n seg = seg.slice(0, -1);\n } else if (seg.endsWith(\"|\")) {\n delim = \"|\";\n seg = seg.slice(0, -1);\n }\n let withKey = false;\n if (seg.endsWith(\":\")) {\n withKey = true;\n seg = seg.slice(0, -1);\n }\n if (!ARRAY_LENGTH.test(seg)) throw new SyntaxError(`Invalid array length: \"${seg}\"`);\n\n let cs: Field[] | undefined;\n if (brace !== -1 && brace < colon) {\n const end = closingBrace(text, brace);\n if (end !== -1 && end < colon) {\n const content = text.slice(brace + 1, end);\n for (const other of DELIMITERS) {\n if (other !== delim && outsideQuotes(content, other) !== -1) {\n throw new SyntaxError(\"Header delimiter mismatch\");\n }\n }\n cs = readFields(content, delim);\n }\n }\n const after = trim(text.slice(colon + 1));\n if (withKey && !cs) throw new SyntaxError(\"Keyed header requires a field list\");\n if (cs && after) throw new SyntaxError(\"Unexpected content after fields-bearing header colon\");\n return {\n key: k,\n length: Number.parseInt(seg, 10),\n delim,\n fields: cs,\n withKey,\n online: after || undefined,\n };\n}\n\nfunction readKey(text: string): { key: string; end: number } {\n if (text.startsWith('\"')) {\n const closes = closingQuote(text, 0);\n if (closes === -1) throw new SyntaxError(\"Unterminated quoted key\");\n let p = closes + 1;\n while (text[p] === \" \") p++;\n if (text[p] !== \":\") throw new SyntaxError(\"Missing colon after key\");\n return { key: unescapeText(text.slice(1, closes)), end: p + 1 };\n }\n const colon = outsideQuotes(text, \":\");\n if (colon === -1) throw new SyntaxError(\"Missing colon after key\");\n return { key: trim(text.slice(0, colon)), end: colon + 1 };\n}\n\nconst isHeaderWithoutKey = (t: string) => trim(t).startsWith(\"[\") && outsideQuotes(t, \":\") !== -1;\nconst isKeyValuePair = (t: string) => outsideQuotes(t, \":\") !== -1;\n\n/** In a table, is the line a row (and not a following `key: value`)? */\nfunction isRow(text: string, delim: string): boolean {\n const colon = outsideQuotes(text, \":\");\n if (colon === -1) return true;\n const d = outsideQuotes(text, delim);\n return d !== -1 && d < colon;\n}\n\nfunction fieldsObject(cs: Field[], values: Json[]): JsonObject {\n let i = 0;\n const build = (nodes: Field[]): JsonObject => {\n const o: JsonObject = {};\n for (const n of nodes)\n assign(o, n.name, n.children ? build(n.children) : (values[i++] as Json));\n return o;\n };\n return build(cs);\n}\n\nclass Decoder {\n constructor(private readonly r: Reader) {}\n\n private error(m: string, l?: Line): ToonDecodeError {\n return new ToonDecodeError(m, l?.num);\n }\n\n private withLine<T>(l: Line, fn: () => T): T {\n try {\n return fn();\n } catch (e) {\n if (e instanceof ToonDecodeError) throw e;\n throw this.error((e as Error).message, l);\n }\n }\n\n document(): Json {\n const first = this.r.look();\n if (!first) return {};\n if (first.level !== 0) throw this.error(\"Over-indented line\", first);\n if (first.text === \"[]\") {\n this.r.read();\n this.consumed();\n return [];\n }\n if (isHeaderWithoutKey(first.text)) {\n const h = this.withLine(first, () => readHeader(first.text));\n if (h) {\n this.r.read();\n const v = this.fromHeader(h, 0, first);\n this.consumed();\n return v;\n }\n }\n this.r.read();\n if (!this.r.look() && !isKeyValuePair(first.text)) {\n return this.withLine(first, () => primitive(first.text));\n }\n if (!isKeyValuePair(first.text)) {\n throw this.error(\n \"Top-level document must start with a key-value or array-header line\",\n first\n );\n }\n const o: JsonObject = {};\n this.par(first, 0, o);\n for (let l = this.r.look(); l; l = this.r.look()) {\n if (l.level !== 0) throw this.error(\"Over-indented line\", l);\n this.r.read();\n this.par(l, 0, o);\n }\n return o;\n }\n\n private consumed(): void {\n const l = this.r.look();\n if (l) throw this.error(\"Unexpected content after the document root\", l);\n }\n\n private par(l: Line, base: number, o: JsonObject): void {\n const h = this.withLine(l, () => readHeader(l.text));\n if (h) {\n if (h.key === undefined)\n throw this.error(\"Keyless array header is only valid at the root or as a list item\", l);\n if (has(o, h.key)) throw this.error(`Duplicate sibling key \"${h.key}\"`, l);\n assign(o, h.key, this.fromHeader(h, base, l));\n return;\n }\n const { key: k, end } = this.withLine(l, () => readKey(l.text));\n if (has(o, k)) throw this.error(`Duplicate sibling key \"${k}\"`, l);\n const rest = trim(l.text.slice(end));\n if (!rest) {\n const sig = this.r.look();\n assign(o, k, sig && sig.level > base ? this.fields(base + 1) : {});\n return;\n }\n assign(o, k, rest === \"[]\" ? [] : this.withLine(l, () => primitive(rest)));\n }\n\n private fields(base: number): JsonObject {\n const o: JsonObject = {};\n let level: number | undefined;\n for (let l = this.r.look(); l && l.level >= base; l = this.r.look()) {\n level ??= l.level;\n if (l.level !== level) throw this.error(`Over-indented line: expected depth ${level}`, l);\n this.r.read();\n this.par(l, level, o);\n }\n return o;\n }\n\n private contentLevel(base: number): number {\n const l = this.r.look();\n return !l || l.level <= base + 1 ? base + 1 : l.level;\n }\n\n private fromHeader(h: Header, base: number, l: Line): Json {\n if (h.withKey) return this.tableWithKey(h, base, l);\n if (h.online !== undefined) {\n const values = this.withLine(l, () => separate(h.online!, h.delim).map(primitive));\n if (values.length !== h.length)\n throw this.error(`Expected ${h.length} inline values, got ${values.length}`, l);\n return values;\n }\n if (h.fields && h.fields.length > 0) return this.table(h, base, l);\n return this.list(h, base, l);\n }\n\n private table(h: Header, base: number, cab: Line): Json[] {\n const level = this.contentLevel(base);\n const leavesPerRow = countLeaves(h.fields!);\n const rows: Json[] = [];\n while (rows.length < h.length) {\n const l = this.r.look();\n if (!l || l.level <= base) break;\n if (l.level !== level) throw this.error(`Over-indented line: expected depth ${level}`, l);\n if (!isRow(l.text, h.delim)) break;\n this.r.read();\n const values = this.withLine(l, () => separate(l.text, h.delim).map(primitive));\n if (values.length !== leavesPerRow)\n throw this.error(`Expected ${leavesPerRow} row values, got ${values.length}`, l);\n rows.push(fieldsObject(h.fields!, values));\n }\n if (rows.length !== h.length)\n throw this.error(`Expected ${h.length} tabular rows, got ${rows.length}`, cab);\n return rows;\n }\n\n private tableWithKey(h: Header, base: number, cab: Line): JsonObject {\n const level = this.contentLevel(base);\n const leavesPerRow = countLeaves(h.fields!);\n const o: JsonObject = {};\n let n = 0;\n for (let l = this.r.look(); l && l.level > base; l = this.r.look()) {\n if (l.level !== level) throw this.error(`Over-indented line: expected depth ${level}`, l);\n this.r.read();\n const { key: k, end } = this.withLine(l, () => readKey(l.text));\n if (has(o, k)) throw this.error(`Duplicate key \"${k}\"`, l);\n const cells = trim(l.text.slice(end));\n const values =\n cells === \"\" ? [] : this.withLine(l, () => separate(cells, h.delim).map(primitive));\n if (values.length !== leavesPerRow)\n throw this.error(`Expected ${leavesPerRow} entry cells, got ${values.length}`, l);\n assign(o, k, fieldsObject(h.fields!, values));\n n++;\n }\n if (n !== h.length) throw this.error(`Expected ${h.length} keyed entries, got ${n}`, cab);\n return o;\n }\n\n private list(h: Header, base: number, cab: Line): Json[] {\n const level = this.contentLevel(base);\n const items: Json[] = [];\n while (items.length < h.length) {\n const l = this.r.look();\n if (!l || l.level <= base) break;\n if (l.level !== level) throw this.error(`Over-indented line: expected depth ${level}`, l);\n if (!(l.text.startsWith(\"- \") || l.text === \"-\")) break;\n items.push(this.item(level));\n }\n if (items.length !== h.length)\n throw this.error(`Expected ${h.length} list items, got ${items.length}`, cab);\n const sig = this.r.look();\n if (sig && sig.level === level && (sig.text.startsWith(\"- \") || sig.text === \"-\")) {\n throw this.error(`Expected ${h.length} list items, but found more`, sig);\n }\n return items;\n }\n\n private item(base: number): Json {\n const l = this.r.read()!;\n if (l.text === \"-\") return {};\n const after = l.text.slice(2).replace(/^ +/, \"\");\n if (!trim(after)) return {};\n if (trim(after) === \"[]\") return [];\n const li: Line = { ...l, text: after };\n if (isHeaderWithoutKey(after)) {\n const h = this.withLine(li, () => readHeader(after));\n if (h) {\n if (h.withKey || h.fields)\n throw this.error(\"Keyless header with a field list is only valid at the root\", li);\n return this.fromHeader(h, base, li);\n }\n }\n const h = this.withLine(li, () => readHeader(after));\n if (h && h.key !== undefined && h.fields !== undefined) {\n const o: JsonObject = {};\n assign(o, h.key, this.fromHeader(h, base + 1, li));\n this.siblings(base + 1, o);\n return o;\n }\n if (isKeyValuePair(after)) {\n const o: JsonObject = {};\n this.par(li, base + 1, o);\n this.siblings(base + 1, o);\n return o;\n }\n return this.withLine(li, () => primitive(after));\n }\n\n private siblings(level: number, o: JsonObject): void {\n for (let l = this.r.look(); l && l.level >= level; l = this.r.look()) {\n if (l.level !== level) throw this.error(`Over-indented line: expected depth ${level}`, l);\n this.r.read();\n this.par(l, level, o);\n }\n }\n}\n\n/**\n * Decodes TOON. Reads everything `encodeToon` writes and what the\n * reference implementation writes (tables with folded columns, keyed\n * tables, list form at any depth, delimiters `,` `\\t` `|`).\n * The empty document is `{}`. On malformed TOON it throws `ToonDecodeError`:\n * it never returns partial data.\n */\nexport function decodeToon(text: string): unknown {\n return new Decoder(new Reader(scan(text))).document();\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-agent-notifications: Where an agent is told that its proposals were resolved (administrators only). */\n\n/** Arguments of `agent-notifications.agent-notification`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentNotificationParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agent-notifications.agent-notification`. */\nexport type AgentNotificationResponse = {\n url: string | null;\n hasSecret: boolean;\n};\n\n/** Arguments of `agent-notifications.rotate-notification-secret`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RotateNotificationSecretParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agent-notifications.rotate-notification-secret`. */\nexport type RotateNotificationSecretResponse = {\n secret: string;\n};\n\n/** Body of `agent-notifications.set-agent-notification`. */\nexport type SetAgentNotificationBody = {\n url: string | null;\n};\n\n/** Arguments of `agent-notifications.set-agent-notification`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SetAgentNotificationParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: SetAgentNotificationBody;\n};\n\n/** Success response of `agent-notifications.set-agent-notification`. */\nexport type SetAgentNotificationResponse = {\n url: string | null;\n secret?: string;\n};\n\n/** Runtime description of every operation of kon-agent-notifications (path, method, pagination…). */\nexport const operations = {\n \"agentNotification\": {\"kon\":\"kon-agent-notifications\",\"id\":\"agent-notification\",\"operationId\":\"agent-notifications.agent-notification\",\"method\":\"GET\",\"path\":\"/admin/agents/{id}/notify\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agent-notifications:agent-notification\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"rotateNotificationSecret\": {\"kon\":\"kon-agent-notifications\",\"id\":\"rotate-notification-secret\",\"operationId\":\"agent-notifications.rotate-notification-secret\",\"method\":\"POST\",\"path\":\"/admin/agents/{id}/notify/rotate\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agent-notifications:rotate-notification-secret\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"setAgentNotification\": {\"kon\":\"kon-agent-notifications\",\"id\":\"set-agent-notification\",\"operationId\":\"agent-notifications.set-agent-notification\",\"method\":\"PUT\",\"path\":\"/admin/agents/{id}/notify\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agent-notifications:set-agent-notification\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-agent-notifications\n *\n * Where an agent is told that its proposals were resolved (administrators only).\n */\nexport interface AgentNotificationsApi {\n /**\n * Agent notify URL (admin)\n *\n * The agent's notify URL for proposal resolutions, and whether it has a signing secret (never the secret).\n *\n * REST: `GET /api/admin/agents/{id}/notify` · scope `kon:agent-notifications:agent-notification`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentNotification: Operation<AgentNotificationParams, AgentNotificationResponse>;\n /**\n * Rotate the agent notify secret (admin)\n *\n * Issues a new signing secret (the previous one stops working at once). Shown only in this response.\n *\n * REST: `POST /api/admin/agents/{id}/notify/rotate` · scope `kon:agent-notifications:rotate-notification-secret`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly rotateNotificationSecret: Operation<RotateNotificationSecretParams, RotateNotificationSecretResponse>;\n /**\n * Set the agent notify URL (admin)\n *\n * Sets (or removes, with null) the https URL that receives a signed webhook when one of the agent's proposals is resolved. The first time, the signing secret is returned in `secret`: it is shown only once.\n *\n * REST: `PUT /api/admin/agents/{id}/notify` · scope `kon:agent-notifications:set-agent-notification`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly setAgentNotification: Operation<SetAgentNotificationParams, SetAgentNotificationResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-agent-token: An agent exchanges its key for a short-lived token. */\n\n/** Body of `agent-token.exchange-agent-token`. */\nexport type ExchangeAgentTokenBody = {\n scopes?: string[];\n ttlSeconds?: number;\n audience?: string;\n};\n\n/** Arguments of `agent-token.exchange-agent-token`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ExchangeAgentTokenParams = {\n /** JSON body. */\n body: ExchangeAgentTokenBody;\n};\n\n/** Success response of `agent-token.exchange-agent-token`. */\nexport type ExchangeAgentTokenResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-agent-token (path, method, pagination…). */\nexport const operations = {\n \"exchangeAgentToken\": {\"kon\":\"kon-agent-token\",\"id\":\"exchange-agent-token\",\"operationId\":\"agent-token.exchange-agent-token\",\"method\":\"POST\",\"path\":\"/agent/token/exchange\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agent-token:exchange-agent-token\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-agent-token\n *\n * An agent exchanges its key for a short-lived token.\n */\nexport interface AgentTokenApi {\n /**\n * Exchange an agent key for a short-lived token\n *\n * An agent trades its own long-lived key for a kitsuden_ast_ token of minutes: scopes a subset of its own (denials carry over), ttlSeconds (default 300, max AGENT_SHORT_TOKEN_MAX_TTL), and an optional audience path prefix. With a DPoP proof the new token is bound to that key. It cannot be exchanged again and dies with its parent key. Agents only. See docs/agents/dpop-and-short-tokens.md.\n *\n * REST: `POST /api/agent/token/exchange` · scope `kon:agent-token:exchange-agent-token`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly exchangeAgentToken: Operation<ExchangeAgentTokenParams, ExchangeAgentTokenResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-agents: Agent permissions, keys and quotas (admin only). */\n\n/** Arguments of `agents.agent-access`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentAccessParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agents.agent-access`. */\nexport type AgentAccessResponse = Record<string, unknown>;\n\n/** Arguments of `agents.agent-decisions`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentDecisionsParams = {\n days?: number;\n agentId?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `agents.agent-decisions`. */\nexport type AgentDecisionsResponse = Record<string, unknown>;\n\n/** One item of the list `agents.agent-decisions` pages through. */\nexport type AgentDecisionsItem = unknown;\n\n/** Arguments of `agents.agent-friction`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentFrictionParams = {\n days?: number;\n agentId?: string | number;\n};\n\n/** Success response of `agents.agent-friction`. */\nexport type AgentFrictionResponse = Record<string, unknown>;\n\n/** Arguments of `agents.agent-version`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentVersionParams = {\n /** Path parameter. */\n id: string | number;\n /** Path parameter. */\n version: number;\n};\n\n/** Success response of `agents.agent-version`. */\nexport type AgentVersionResponse = Record<string, unknown>;\n\n/** Arguments of `agents.agent-versions`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentVersionsParams = {\n /** Path parameter. */\n id: string | number;\n limit?: number;\n};\n\n/** Success response of `agents.agent-versions`. */\nexport type AgentVersionsResponse = Record<string, unknown>;\n\n/** Body of `agents.bind-key-dpop`. */\nexport type BindKeyDpopBody = Record<string, unknown>;\n\n/** Arguments of `agents.bind-key-dpop`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type BindKeyDpopParams = {\n /** Path parameter. */\n id: string | number;\n /** Path parameter. */\n keyId: string | number;\n /** JSON body. */\n body: BindKeyDpopBody;\n};\n\n/** Success response of `agents.bind-key-dpop`. */\nexport type BindKeyDpopResponse = Record<string, unknown>;\n\n/** Body of `agents.create-key`. */\nexport type CreateKeyBody = {\n name?: string;\n expiresInDays?: number | null;\n};\n\n/** Arguments of `agents.create-key`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateKeyParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: CreateKeyBody;\n};\n\n/** Success response of `agents.create-key`. */\nexport type CreateKeyResponse = Record<string, unknown>;\n\n/** Arguments of `agents.list-keys`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListKeysParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agents.list-keys`. */\nexport type ListKeysResponse = Record<string, unknown>;\n\n/** Success response of `agents.permission-catalog`. */\nexport type PermissionCatalogResponse = Record<string, unknown>;\n\n/** Arguments of `agents.read-mcp-settings`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadMcpSettingsParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agents.read-mcp-settings`. */\nexport type ReadMcpSettingsResponse = Record<string, unknown>;\n\n/** Arguments of `agents.read-quotas`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadQuotasParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agents.read-quotas`. */\nexport type ReadQuotasResponse = Record<string, unknown>;\n\n/** Arguments of `agents.read-signer`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadSignerParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `agents.read-signer`. */\nexport type ReadSignerResponse = Record<string, unknown>;\n\n/** Arguments of `agents.restore-agent-version`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RestoreAgentVersionParams = {\n /** Path parameter. */\n id: string | number;\n /** Path parameter. */\n version: number;\n};\n\n/** Success response of `agents.restore-agent-version`. */\nexport type RestoreAgentVersionResponse = Record<string, unknown>;\n\n/** Arguments of `agents.revoke-key`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RevokeKeyParams = {\n /** Path parameter. */\n id: string | number;\n /** Path parameter. */\n keyId: string | number;\n};\n\n/** Success response of `agents.revoke-key`. */\nexport type RevokeKeyResponse = Record<string, unknown>;\n\n/** Body of `agents.rotate-key`. */\nexport type RotateKeyBody = {\n graceHours?: number;\n expiresInDays?: number | null;\n name?: string;\n};\n\n/** Arguments of `agents.rotate-key`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RotateKeyParams = {\n /** Path parameter. */\n id: string | number;\n /** Path parameter. */\n keyId: string | number;\n /** JSON body. */\n body: RotateKeyBody;\n};\n\n/** Success response of `agents.rotate-key`. */\nexport type RotateKeyResponse = Record<string, unknown>;\n\n/** Body of `agents.save-mcp-settings`. */\nexport type SaveMcpSettingsBody = {\n /** Default toolset for this agent's MCP sessions (comma-separated). null = all tools. */\n toolset?: string | null;\n /** How text written by others is wrapped in tool results. Default: none. */\n untrustedWrap?: \"none\" | \"delimiters\" | \"object\";\n};\n\n/** Arguments of `agents.save-mcp-settings`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveMcpSettingsParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: SaveMcpSettingsBody;\n};\n\n/** Success response of `agents.save-mcp-settings`. */\nexport type SaveMcpSettingsResponse = Record<string, unknown>;\n\n/** Body of `agents.save-quotas`. */\nexport type SaveQuotasBody = {\n requestsPerMinute?: number;\n writesPerDay?: number | null;\n budgetUnitsPerDay?: number | null;\n};\n\n/** Arguments of `agents.save-quotas`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveQuotasParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: SaveQuotasBody;\n};\n\n/** Success response of `agents.save-quotas`. */\nexport type SaveQuotasResponse = Record<string, unknown>;\n\n/** Body of `agents.save-require-dpop`. */\nexport type SaveRequireDpopBody = Record<string, unknown>;\n\n/** Arguments of `agents.save-require-dpop`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveRequireDpopParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: SaveRequireDpopBody;\n};\n\n/** Success response of `agents.save-require-dpop`. */\nexport type SaveRequireDpopResponse = Record<string, unknown>;\n\n/** Body of `agents.save-scopes`. */\nexport type SaveScopesBody = {\n scopes: string[];\n};\n\n/** Arguments of `agents.save-scopes`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveScopesParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: SaveScopesBody;\n};\n\n/** Success response of `agents.save-scopes`. */\nexport type SaveScopesResponse = Record<string, unknown>;\n\n/** Body of `agents.save-signer`. */\nexport type SaveSignerBody = {\n userId: string | null;\n};\n\n/** Arguments of `agents.save-signer`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveSignerParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: SaveSignerBody;\n};\n\n/** Success response of `agents.save-signer`. */\nexport type SaveSignerResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-agents (path, method, pagination…). */\nexport const operations = {\n \"agentAccess\": {\"kon\":\"kon-agents\",\"id\":\"agent-access\",\"operationId\":\"agents.agent-access\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/access\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:agent-access\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"agentDecisions\": {\"kon\":\"kon-agents\",\"id\":\"agent-decisions\",\"operationId\":\"agents.agent-decisions\",\"method\":\"GET\",\"path\":\"/v1/agent-decisions\",\"pathParams\":[],\"queryParams\":[\"days\",\"agentId\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:agent-decisions\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":null,\"limit\":\"limit\"}},\n \"agentFriction\": {\"kon\":\"kon-agents\",\"id\":\"agent-friction\",\"operationId\":\"agents.agent-friction\",\"method\":\"GET\",\"path\":\"/v1/agent-friction\",\"pathParams\":[],\"queryParams\":[\"days\",\"agentId\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:agent-friction\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"agentVersion\": {\"kon\":\"kon-agents\",\"id\":\"agent-version\",\"operationId\":\"agents.agent-version\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/versions/{version}\",\"pathParams\":[\"id\",\"version\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:agent-version\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"agentVersions\": {\"kon\":\"kon-agents\",\"id\":\"agent-versions\",\"operationId\":\"agents.agent-versions\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/versions\",\"pathParams\":[\"id\"],\"queryParams\":[\"limit\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:agent-versions\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"bindKeyDpop\": {\"kon\":\"kon-agents\",\"id\":\"bind-key-dpop\",\"operationId\":\"agents.bind-key-dpop\",\"method\":\"PUT\",\"path\":\"/v1/agents/{id}/keys/{keyId}/dpop\",\"pathParams\":[\"id\",\"keyId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:bind-key-dpop\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createKey\": {\"kon\":\"kon-agents\",\"id\":\"create-key\",\"operationId\":\"agents.create-key\",\"method\":\"POST\",\"path\":\"/v1/agents/{id}/keys\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:create-key\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listKeys\": {\"kon\":\"kon-agents\",\"id\":\"list-keys\",\"operationId\":\"agents.list-keys\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/keys\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:list-keys\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"permissionCatalog\": {\"kon\":\"kon-agents\",\"id\":\"permission-catalog\",\"operationId\":\"agents.permission-catalog\",\"method\":\"GET\",\"path\":\"/v1/agent-access/catalog\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:permission-catalog\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"readMcpSettings\": {\"kon\":\"kon-agents\",\"id\":\"read-mcp-settings\",\"operationId\":\"agents.read-mcp-settings\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/mcp-settings\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:read-mcp-settings\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"readQuotas\": {\"kon\":\"kon-agents\",\"id\":\"read-quotas\",\"operationId\":\"agents.read-quotas\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/quotas\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:read-quotas\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"readSigner\": {\"kon\":\"kon-agents\",\"id\":\"read-signer\",\"operationId\":\"agents.read-signer\",\"method\":\"GET\",\"path\":\"/v1/agents/{id}/sponsor\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:agents:read-signer\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"restoreAgentVersion\": {\"kon\":\"kon-agents\",\"id\":\"restore-agent-version\",\"operationId\":\"agents.restore-agent-version\",\"method\":\"POST\",\"path\":\"/v1/agents/{id}/versions/{version}/restore\",\"pathParams\":[\"id\",\"version\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:restore-agent-version\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"revokeKey\": {\"kon\":\"kon-agents\",\"id\":\"revoke-key\",\"operationId\":\"agents.revoke-key\",\"method\":\"POST\",\"path\":\"/v1/agents/{id}/keys/{keyId}/revoke\",\"pathParams\":[\"id\",\"keyId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:revoke-key\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"rotateKey\": {\"kon\":\"kon-agents\",\"id\":\"rotate-key\",\"operationId\":\"agents.rotate-key\",\"method\":\"POST\",\"path\":\"/v1/agents/{id}/keys/{keyId}/rotate\",\"pathParams\":[\"id\",\"keyId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:rotate-key\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveMcpSettings\": {\"kon\":\"kon-agents\",\"id\":\"save-mcp-settings\",\"operationId\":\"agents.save-mcp-settings\",\"method\":\"PUT\",\"path\":\"/v1/agents/{id}/mcp-settings\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:save-mcp-settings\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveQuotas\": {\"kon\":\"kon-agents\",\"id\":\"save-quotas\",\"operationId\":\"agents.save-quotas\",\"method\":\"PUT\",\"path\":\"/v1/agents/{id}/quotas\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:save-quotas\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveRequireDpop\": {\"kon\":\"kon-agents\",\"id\":\"save-require-dpop\",\"operationId\":\"agents.save-require-dpop\",\"method\":\"PUT\",\"path\":\"/v1/agents/{id}/dpop\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:save-require-dpop\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveScopes\": {\"kon\":\"kon-agents\",\"id\":\"save-scopes\",\"operationId\":\"agents.save-scopes\",\"method\":\"PUT\",\"path\":\"/v1/agents/{id}/scopes\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:save-scopes\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveSigner\": {\"kon\":\"kon-agents\",\"id\":\"save-signer\",\"operationId\":\"agents.save-signer\",\"method\":\"PUT\",\"path\":\"/v1/agents/{id}/sponsor\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:agents:save-signer\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-agents\n *\n * Agent permissions, keys and quotas (admin only).\n */\nexport interface AgentsApi {\n /**\n * What an agent can do\n *\n * The merged view (broad ∪ fine-grained − denied) of the agent's saved scopes: every SDK operation and every dataset action with its state and the scope that decided it.\n *\n * REST: `GET /api/v1/agents/{id}/access` · scope `kon:agents:agent-access`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentAccess: Operation<AgentAccessParams, AgentAccessResponse>;\n /**\n * What agents chose not to do, and why\n *\n * Decisions agents recorded themselves (MCP kitsuden_record_decision, POST /api/agent/decisions): the action they discarded, the reason, the alternatives and the version of the agent that decided, newest first, over the last `days` (1-365, default 30). Read-only: nobody edits a decision. Admins see every agent; an editor sees the agents whose proposals they may decide, so not the ones they sponsor.\n *\n * REST: `GET /api/v1/agent-decisions` · scope `kon:agents:agent-decisions`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentDecisions: PageableOperation<AgentDecisionsParams, AgentDecisionsResponse, AgentDecisionsItem>;\n /**\n * Where agents get stuck with the MCP tools\n *\n * Per tool, over the last `days` (1-90, default 7): calls, failures by error code, keys agents invent, rejected proposals, and what to change in the operation's `guide`. Reads the audited MCP tool calls; argument values are never stored, only their names.\n *\n * REST: `GET /api/v1/agent-friction` · scope `kon:agents:agent-friction`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentFriction: Operation<AgentFrictionParams, AgentFrictionResponse>;\n /**\n * One version of an agent\n *\n * The version's system prompt and configuration, who made it and when.\n *\n * REST: `GET /api/v1/agents/{id}/versions/{version}` · scope `kon:agents:agent-version`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentVersion: Operation<AgentVersionParams, AgentVersionResponse>;\n /**\n * An agent's versions\n *\n * Each distinct definition of the agent (system prompt, tools, capabilities, type), newest first, without the prompt text. An agent created before versions existed gets its first version on this call. `limit` caps the list (default 100).\n *\n * REST: `GET /api/v1/agents/{id}/versions` · scope `kon:agents:agent-versions`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentVersions: Operation<AgentVersionsParams, AgentVersionsResponse>;\n /**\n * Bind an API key to a public key (DPoP)\n *\n * Body { jwk } with a public EC P-256 or Ed25519 JWK (null unbinds). A bound key only works with a DPoP proof signed by the matching private key (RFC 9449). See docs/agents/dpop-and-short-tokens.md.\n *\n * REST: `PUT /api/v1/agents/{id}/keys/{keyId}/dpop` · scope `kon:agents:bind-key-dpop`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly bindKeyDpop: Operation<BindKeyDpopParams, BindKeyDpopResponse>;\n /**\n * Create an API key\n *\n * Creates a key with an optional name and expiry. Without expiresInDays the key expires after the server default (AGENT_KEY_DEFAULT_EXPIRY_DAYS, 90 days); expiresInDays: null asks for a key that never expires. The secret is returned once.\n *\n * REST: `POST /api/v1/agents/{id}/keys` · scope `kon:agents:create-key`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createKey: Operation<CreateKeyParams, CreateKeyResponse>;\n /**\n * List an agent's API keys\n *\n * Keys without secrets: name, prefix, status, created, last used, expiry, revocation and rotation origin.\n *\n * REST: `GET /api/v1/agents/{id}/keys` · scope `kon:agents:list-keys`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listKeys: Operation<ListKeysParams, ListKeysResponse>;\n /**\n * What can be granted to an agent\n *\n * Presets, broad scopes (with the SDK operations and dataset permissions each one opens), SDK operations by kon, legacy kons and datasets.\n *\n * REST: `GET /api/v1/agent-access/catalog` · scope `kon:agents:permission-catalog`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly permissionCatalog: Operation<void, PermissionCatalogResponse>;\n /**\n * An agent's MCP settings\n *\n * Default toolset for its MCP sessions (narrows tools/list; never grants anything) and how text written by others is wrapped in results (none | delimiters | object).\n *\n * REST: `GET /api/v1/agents/{id}/mcp-settings` · scope `kon:agents:read-mcp-settings`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readMcpSettings: Operation<ReadMcpSettingsParams, ReadMcpSettingsResponse>;\n /**\n * An agent's quotas and today's usage\n *\n * Requests per minute, writes and budget units per day (UTC), what was spent today, and formatSavings: bytes and estimated tokens the 'auto' format saved against compact JSON (per day, no personal data).\n *\n * REST: `GET /api/v1/agents/{id}/quotas` · scope `kon:agents:read-quotas`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readQuotas: Operation<ReadQuotasParams, ReadQuotasResponse>;\n /**\n * An agent's human signer\n *\n * The admin or editor account that signs what the agent creates (blog post author, dataset entry owner), whether it is still valid, and the accounts that can be chosen.\n *\n * REST: `GET /api/v1/agents/{id}/sponsor` · scope `kon:agents:read-signer`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readSigner: Operation<ReadSignerParams, ReadSignerResponse>;\n /**\n * Restore an earlier version of an agent\n *\n * Writes that version's definition back to the agent, as a new version (the history is never rewritten). Audited.\n *\n * REST: `POST /api/v1/agents/{id}/versions/{version}/restore` · scope `kon:agents:restore-agent-version`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly restoreAgentVersion: Operation<RestoreAgentVersionParams, RestoreAgentVersionResponse>;\n /**\n * Revoke an API key\n *\n * The key stops working on its next request. The record stays for auditing.\n *\n * REST: `POST /api/v1/agents/{id}/keys/{keyId}/revoke` · scope `kon:agents:revoke-key`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly revokeKey: Operation<RevokeKeyParams, RevokeKeyResponse>;\n /**\n * Rotate an API key without downtime\n *\n * Creates a new key and shortens the old one to now + graceHours, so both work during the grace period. The new secret is returned once.\n *\n * REST: `POST /api/v1/agents/{id}/keys/{keyId}/rotate` · scope `kon:agents:rotate-key`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly rotateKey: Operation<RotateKeyParams, RotateKeyResponse>;\n /**\n * Change an agent's MCP settings\n *\n * { toolset } (comma-separated: all, read, data, core, actions, kons, kon:<id>; null or 'all' = no restriction) and { untrustedWrap } (none | delimiters | object). Audited; takes effect on the agent's next MCP message.\n *\n * REST: `PUT /api/v1/agents/{id}/mcp-settings` · scope `kon:agents:save-mcp-settings`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveMcpSettings: Operation<SaveMcpSettingsParams, SaveMcpSettingsResponse>;\n /**\n * Change an agent's quotas\n *\n * requestsPerMinute (≥ 1), writesPerDay and budgetUnitsPerDay (null = no daily limit).\n *\n * REST: `PUT /api/v1/agents/{id}/quotas` · scope `kon:agents:save-quotas`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveQuotas: Operation<SaveQuotasParams, SaveQuotasResponse>;\n /**\n * Require DPoP for every credential of an agent\n *\n * Body { required: boolean }. When true, the agent's keys and tokens are refused without a valid DPoP proof, and an unbound key is refused outright.\n *\n * REST: `PUT /api/v1/agents/{id}/dpop` · scope `kon:agents:save-require-dpop`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveRequireDpop: Operation<SaveRequireDpopParams, SaveRequireDpopResponse>;\n /**\n * Replace an agent's scopes\n *\n * Replaces the whole scope list (broad, fine-grained, wildcards and !denies). Invalid scopes are rejected with the reason. Returns the merged view.\n *\n * REST: `PUT /api/v1/agents/{id}/scopes` · scope `kon:agents:save-scopes`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveScopes: Operation<SaveScopesParams, SaveScopesResponse>;\n /**\n * Set or remove an agent's human signer\n *\n * { userId } sets the signer (an existing admin or editor); { userId: null } removes it (the agent goes back to the behaviour without a signer). Audited.\n *\n * REST: `PUT /api/v1/agents/{id}/sponsor` · scope `kon:agents:save-signer`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveSigner: Operation<SaveSignerParams, SaveSignerResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-analytics: Views per subject and day, without cookies or personal data. */\n\n/** Body of `analytics.add-view`. */\nexport type AddViewBody = {\n /** What was viewed */\n type: \"game\" | \"blog_post\" | \"wiki_page\" | \"wiki\" | \"dataset\" | \"tournament\" | \"streamer\";\n /** Uuid of the viewed subject */\n id: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `analytics.add-view`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AddViewParams = {\n /** JSON body. */\n body?: AddViewBody;\n};\n\n/** Success response of `analytics.add-view`. */\nexport type AddViewResponse = null;\n\n/** Arguments of `analytics.get-most-viewed`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetMostViewedParams = {\n /** Subject type (default game): game, blog_post, wiki_page, wiki, dataset, tournament, streamer */\n type?: string | number;\n /** Window in days, 1-365 (default 30) */\n days?: string | number;\n /** How many, 1-50 (default 5) */\n limit?: string | number;\n /** Comma-separated uuids: rank only inside this set (max 100) */\n ids?: string | number;\n};\n\n/** Success response of `analytics.get-most-viewed`. */\nexport type GetMostViewedResponse = {\n type: string;\n days: number;\n docs: {\n subjectId: string;\n views: number;\n }[];\n};\n\n/** Arguments of `analytics.get-subject-series`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetSubjectSeriesParams = {\n /** Subject type: game, blog_post, wiki_page, wiki, dataset, tournament, streamer */\n type: string | number;\n /** Subject uuid */\n id: string | number;\n /** Window in days, 1-365 (default 30) */\n days?: string | number;\n};\n\n/** Success response of `analytics.get-subject-series`. */\nexport type GetSubjectSeriesResponse = {\n type: string;\n id: string;\n days: number;\n total: number;\n docs: {\n day: string;\n views: number;\n }[];\n};\n\n/** Runtime description of every operation of kon-analytics (path, method, pagination…). */\nexport const operations = {\n \"addView\": {\"kon\":\"kon-analytics\",\"id\":\"add-view\",\"operationId\":\"analytics.add-view\",\"method\":\"POST\",\"path\":\"/analytics/hit\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"204\":\"empty\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:analytics:add-view\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getMostViewed\": {\"kon\":\"kon-analytics\",\"id\":\"get-most-viewed\",\"operationId\":\"analytics.get-most-viewed\",\"method\":\"GET\",\"path\":\"/analytics/top\",\"pathParams\":[],\"queryParams\":[\"type\",\"days\",\"limit\",\"ids\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:analytics:get-most-viewed\",\"mcpTool\":\"analytics__get-most-viewed\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getSubjectSeries\": {\"kon\":\"kon-analytics\",\"id\":\"get-subject-series\",\"operationId\":\"analytics.get-subject-series\",\"method\":\"GET\",\"path\":\"/analytics/subject/{type}/{id}\",\"pathParams\":[\"type\",\"id\"],\"queryParams\":[\"days\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:analytics:get-subject-series\",\"mcpTool\":\"analytics__get-subject-series\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-analytics\n *\n * Views per subject and day, without cookies or personal data.\n */\nexport interface AnalyticsApi {\n /**\n * Count one page view\n *\n * Adds ONE view of a subject (game, blog post, wiki page, dataset, tournament, streamer) for today. Public and anonymous: no IP, cookie or user agent is stored. Known bots are dropped, and a subject that does not exist is not counted; both answer 204 like a counted view. 400 when type or id are not valid.\n *\n * REST: `POST /api/analytics/hit` · scope `kon:analytics:add-view`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly addView: Operation<AddViewParams, AddViewResponse>;\n /**\n * Most viewed subjects\n *\n * The most viewed subjects of one type over the last `days` days (views, never unique visitors), most viewed first. `ids` ranks only inside a given set of uuids. Public. Returns subject ids and view counts; 400 when the type is unknown.\n *\n * REST: `GET /api/analytics/top` · scope `kon:analytics:get-most-viewed`\n * idempotent (safe to retry) · MCP tool `analytics__get-most-viewed`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getMostViewed: Operation<GetMostViewedParams, GetMostViewedResponse>;\n /**\n * Daily views of one subject\n *\n * The views per day of one subject over the last `days` days, oldest first, with the total. Public. 400 when type or id are not valid; a subject with no views returns an empty series.\n *\n * REST: `GET /api/analytics/subject/{type}/{id}` · scope `kon:analytics:get-subject-series`\n * idempotent (safe to retry) · MCP tool `analytics__get-subject-series`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getSubjectSeries: Operation<GetSubjectSeriesParams, GetSubjectSeriesResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-approvals: Human approval of agent proposals (team members only; never an agent). */\n\n/** Body of `approvals.agent-mode`. */\nexport type AgentModeBody = {\n mode: \"inherit\" | \"propose\" | \"direct\";\n};\n\n/** Arguments of `approvals.agent-mode`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentModeParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: AgentModeBody;\n};\n\n/** Success response of `approvals.agent-mode`. */\nexport type AgentModeResponse = Record<string, unknown>;\n\n/** Body of `approvals.agent-unattended`. */\nexport type AgentUnattendedBody = {\n mode?: (\"hold\" | \"deny\") | null;\n alternative?: string | null;\n};\n\n/** Arguments of `approvals.agent-unattended`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AgentUnattendedParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: AgentUnattendedBody;\n};\n\n/** Success response of `approvals.agent-unattended`. */\nexport type AgentUnattendedResponse = Record<string, unknown>;\n\n/** Arguments of `approvals.approvals-audit`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ApprovalsAuditParams = {\n agentId?: string | number;\n proposalId?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `approvals.approvals-audit`. */\nexport type ApprovalsAuditResponse = Record<string, unknown>;\n\n/** One item of the list `approvals.approvals-audit` pages through. */\nexport type ApprovalsAuditItem = unknown;\n\n/** Success response of `approvals.approvals-configuration`. */\nexport type ApprovalsConfigurationResponse = Record<string, unknown>;\n\n/** Body of `approvals.approve-proposal`. */\nexport type ApproveProposalBody = {\n comment?: string;\n /** The operationHash of the proposal as you were shown it (GET /proposals/:id). Required to approve a proposal that has one: a different value gets 409 KITSUDEN_E_APPROVAL_STALE and nothing runs. */\n operationHash?: string;\n /** Per-field decision for a proposal that writes a record (see fieldDiff): accept or reject each field, optionally with an edited value. Fields not listed are accepted. Approve only. */\n fields?: {\n field: string;\n decision: \"accept\" | \"reject\";\n value?: unknown;\n }[];\n /** ISO date: schedule a later review of this decision (within a year) */\n reviewAt?: string;\n reviewNote?: string;\n};\n\n/** Arguments of `approvals.approve-proposal`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ApproveProposalParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: ApproveProposalBody;\n};\n\n/** Success response of `approvals.approve-proposal`. */\nexport type ApproveProposalResponse = Record<string, unknown>;\n\n/** Body of `approvals.close-review`. */\nexport type CloseReviewBody = {\n comment?: string;\n /** true: cancel it instead of marking it done */\n cancel?: boolean;\n};\n\n/** Arguments of `approvals.close-review`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CloseReviewParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: CloseReviewBody;\n};\n\n/** Success response of `approvals.close-review`. */\nexport type CloseReviewResponse = Record<string, unknown>;\n\n/** Success response of `approvals.count-pending`. */\nexport type CountPendingResponse = {\n pending: number;\n};\n\n/** Arguments of `approvals.list-proposals`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListProposalsParams = {\n status?: \"pending\" | \"executing\" | \"executed\" | \"failed\" | \"rejected\" | \"expired\";\n agentId?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `approvals.list-proposals`. */\nexport type ListProposalsResponse = Record<string, unknown>;\n\n/** One item of the list `approvals.list-proposals` pages through. */\nexport type ListProposalsItem = unknown;\n\n/** Arguments of `approvals.list-reviews`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListReviewsParams = {\n status?: \"due\" | \"scheduled\" | \"done\" | \"cancelled\" | \"all\";\n proposalId?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `approvals.list-reviews`. */\nexport type ListReviewsResponse = Record<string, unknown>;\n\n/** One item of the list `approvals.list-reviews` pages through. */\nexport type ListReviewsItem = unknown;\n\n/** Arguments of `approvals.proposal-detail`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ProposalDetailParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `approvals.proposal-detail`. */\nexport type ProposalDetailResponse = Record<string, unknown>;\n\n/** Arguments of `approvals.proposal-image`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ProposalImageParams = {\n /** Path parameter. */\n id: string | number;\n /** Path parameter. */\n fileId: string | number;\n};\n\n/** Success response of `approvals.proposal-image`. */\nexport type ProposalImageResponse = ArrayBuffer;\n\n/** Body of `approvals.reject-proposal`. */\nexport type RejectProposalBody = {\n comment?: string;\n /** The operationHash of the proposal as you were shown it (GET /proposals/:id). Required to approve a proposal that has one: a different value gets 409 KITSUDEN_E_APPROVAL_STALE and nothing runs. */\n operationHash?: string;\n /** Per-field decision for a proposal that writes a record (see fieldDiff): accept or reject each field, optionally with an edited value. Fields not listed are accepted. Approve only. */\n fields?: {\n field: string;\n decision: \"accept\" | \"reject\";\n value?: unknown;\n }[];\n /** ISO date: schedule a later review of this decision (within a year) */\n reviewAt?: string;\n reviewNote?: string;\n};\n\n/** Arguments of `approvals.reject-proposal`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RejectProposalParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: RejectProposalBody;\n};\n\n/** Success response of `approvals.reject-proposal`. */\nexport type RejectProposalResponse = Record<string, unknown>;\n\n/** Arguments of `approvals.row-evidence`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RowEvidenceParams = {\n entity: string | number;\n rowId: string | number;\n};\n\n/** Success response of `approvals.row-evidence`. */\nexport type RowEvidenceResponse = Record<string, unknown>;\n\n/** Body of `approvals.save-approvals-configuration`. */\nexport type SaveApprovalsConfigurationBody = {\n enabled?: boolean;\n proposeRetention?: \"selective\" | \"strict\";\n ttlHours?: number;\n operations?: Record<string, boolean | null>;\n legacyRules?: {\n method: string;\n path: string;\n alternative?: string;\n }[];\n unattended?: \"hold\" | \"deny\";\n unattendedAlternative?: string | null;\n alternatives?: Record<string, string | null>;\n};\n\n/** Arguments of `approvals.save-approvals-configuration`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveApprovalsConfigurationParams = {\n /** JSON body. */\n body: SaveApprovalsConfigurationBody;\n};\n\n/** Success response of `approvals.save-approvals-configuration`. */\nexport type SaveApprovalsConfigurationResponse = Record<string, unknown>;\n\n/** Body of `approvals.schedule-proposal-review`. */\nexport type ScheduleProposalReviewBody = {\n reviewAt: string;\n note?: string;\n fields?: string[];\n};\n\n/** Arguments of `approvals.schedule-proposal-review`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ScheduleProposalReviewParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: ScheduleProposalReviewBody;\n};\n\n/** Success response of `approvals.schedule-proposal-review`. */\nexport type ScheduleProposalReviewResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-approvals (path, method, pagination…). */\nexport const operations = {\n \"agentMode\": {\"kon\":\"kon-approvals\",\"id\":\"agent-mode\",\"operationId\":\"approvals.agent-mode\",\"method\":\"PUT\",\"path\":\"/approvals/agents/{id}/mode\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:agent-mode\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"agentUnattended\": {\"kon\":\"kon-approvals\",\"id\":\"agent-unattended\",\"operationId\":\"approvals.agent-unattended\",\"method\":\"PUT\",\"path\":\"/approvals/agents/{id}/unattended\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:agent-unattended\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"approvalsAudit\": {\"kon\":\"kon-approvals\",\"id\":\"approvals-audit\",\"operationId\":\"approvals.approvals-audit\",\"method\":\"GET\",\"path\":\"/approvals/audit\",\"pathParams\":[],\"queryParams\":[\"agentId\",\"proposalId\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:approvals-audit\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":null,\"limit\":\"limit\"}},\n \"approvalsConfiguration\": {\"kon\":\"kon-approvals\",\"id\":\"approvals-configuration\",\"operationId\":\"approvals.approvals-configuration\",\"method\":\"GET\",\"path\":\"/approvals/settings\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:approvals-configuration\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"approveProposal\": {\"kon\":\"kon-approvals\",\"id\":\"approve-proposal\",\"operationId\":\"approvals.approve-proposal\",\"method\":\"POST\",\"path\":\"/approvals/proposals/{id}/approve\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:approve-proposal\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_APPROVAL_STALE\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"closeReview\": {\"kon\":\"kon-approvals\",\"id\":\"close-review\",\"operationId\":\"approvals.close-review\",\"method\":\"POST\",\"path\":\"/approvals/reviews/{id}/done\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:close-review\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"countPending\": {\"kon\":\"kon-approvals\",\"id\":\"count-pending\",\"operationId\":\"approvals.count-pending\",\"method\":\"GET\",\"path\":\"/approvals/proposals/count\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:count-pending\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listProposals\": {\"kon\":\"kon-approvals\",\"id\":\"list-proposals\",\"operationId\":\"approvals.list-proposals\",\"method\":\"GET\",\"path\":\"/approvals/proposals\",\"pathParams\":[],\"queryParams\":[\"status\",\"agentId\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:list-proposals\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":null,\"limit\":\"limit\"}},\n \"listReviews\": {\"kon\":\"kon-approvals\",\"id\":\"list-reviews\",\"operationId\":\"approvals.list-reviews\",\"method\":\"GET\",\"path\":\"/approvals/reviews\",\"pathParams\":[],\"queryParams\":[\"status\",\"proposalId\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:list-reviews\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":null,\"limit\":\"limit\"}},\n \"proposalDetail\": {\"kon\":\"kon-approvals\",\"id\":\"proposal-detail\",\"operationId\":\"approvals.proposal-detail\",\"method\":\"GET\",\"path\":\"/approvals/proposals/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:proposal-detail\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"proposalImage\": {\"kon\":\"kon-approvals\",\"id\":\"proposal-image\",\"operationId\":\"approvals.proposal-image\",\"method\":\"GET\",\"path\":\"/approvals/proposals/{id}/files/{fileId}\",\"pathParams\":[\"id\",\"fileId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"binary\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:proposal-image\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"rejectProposal\": {\"kon\":\"kon-approvals\",\"id\":\"reject-proposal\",\"operationId\":\"approvals.reject-proposal\",\"method\":\"POST\",\"path\":\"/approvals/proposals/{id}/reject\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:reject-proposal\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"rowEvidence\": {\"kon\":\"kon-approvals\",\"id\":\"row-evidence\",\"operationId\":\"approvals.row-evidence\",\"method\":\"GET\",\"path\":\"/approvals/evidence\",\"pathParams\":[],\"queryParams\":[\"entity\",\"rowId\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:approvals:row-evidence\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveApprovalsConfiguration\": {\"kon\":\"kon-approvals\",\"id\":\"save-approvals-configuration\",\"operationId\":\"approvals.save-approvals-configuration\",\"method\":\"PUT\",\"path\":\"/approvals/settings\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:save-approvals-configuration\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"scheduleProposalReview\": {\"kon\":\"kon-approvals\",\"id\":\"schedule-proposal-review\",\"operationId\":\"approvals.schedule-proposal-review\",\"method\":\"POST\",\"path\":\"/approvals/proposals/{id}/review\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:approvals:schedule-proposal-review\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-approvals\n *\n * Human approval of agent proposals (team members only; never an agent).\n */\nexport interface ApprovalsApi {\n /**\n * Set an agent's approval mode (admin)\n *\n * inherit (only sensitive operations wait), propose (its writes become proposals too, per proposeRetention) or direct (never asks). With the master switch off nobody asks, whatever the mode. Audited.\n *\n * REST: `PUT /api/approvals/agents/{id}/mode` · scope `kon:approvals:agent-mode`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentMode: Operation<AgentModeParams, AgentModeResponse>;\n /**\n * Set what an agent's unattended runs do with held writes (admin)\n *\n * When nobody is attending the run (a cron or event action, an agent run they started, or a request with `Kitsuden-Unattended: true`), a request that would be held for approval is held (`hold`, 202) or refused (`deny`, 403 KITSUDEN_E_DENIED_UNATTENDED) with `alternative`: what to do instead. `mode: null` follows the global `unattended` setting; `alternative: null` uses the global text. Audited.\n *\n * REST: `PUT /api/approvals/agents/{id}/unattended` · scope `kon:approvals:agent-unattended`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly agentUnattended: Operation<AgentUnattendedParams, AgentUnattendedResponse>;\n /**\n * Approval audit trail\n *\n * Who changed each switch and when, who proposed, who approved or rejected, and the result of each execution.\n *\n * REST: `GET /api/approvals/audit` · scope `kon:approvals:approvals-audit`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly approvalsAudit: PageableOperation<ApprovalsAuditParams, ApprovalsAuditResponse, ApprovalsAuditItem>;\n /**\n * Approval settings\n *\n * The global switch, proposal lifetime, legacy route rules, every SDK operation and core MCP tool with its default and overridden sensitivity, and each agent's mode.\n *\n * REST: `GET /api/approvals/settings` · scope `kon:approvals:approvals-configuration`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly approvalsConfiguration: Operation<void, ApprovalsConfigurationResponse>;\n /**\n * Approve and execute a proposal\n *\n * Executes the stored request once, with the agent's CURRENT identity and permissions, and records the approver. A second approval gets 409. If the agent was deactivated, its key revoked or expired, or its permission removed, the proposal ends as failed without executing. With `fields` (a proposal that writes a record), only the fields it accepts are executed, with any edited value; a field the list leaves out is rejected, and every field rejected is a rejection. `reviewAt` schedules a later review. Send the `operationHash` you were shown: when the proposal has one it is required and must match (409 KITSUDEN_E_APPROVAL_STALE otherwise); before running, the stored row is re-hashed and the approval signature checked, and a mismatch fails the proposal without executing it.\n *\n * REST: `POST /api/approvals/proposals/{id}/approve` · scope `kon:approvals:approve-proposal`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_APPROVAL_STALE`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly approveProposal: Operation<ApproveProposalParams, ApproveProposalResponse>;\n /**\n * Mark a later review as done\n *\n * A person looked again at what was decided. `cancel: true` cancels it instead. A review already closed gets 409.\n *\n * REST: `POST /api/approvals/reviews/{id}/done` · scope `kon:approvals:close-review`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly closeReview: Operation<CloseReviewParams, CloseReviewResponse>;\n /**\n * Pending proposals\n *\n * How many proposals are waiting for a human (the panel's counter).\n *\n * REST: `GET /api/approvals/proposals/count` · scope `kon:approvals:count-pending`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly countPending: Operation<void, CountPendingResponse>;\n /**\n * Approval inbox\n *\n * Agent proposals, newest first, with their status (pending, executing, executed, failed, rejected, expired). Pending ones past their expiry are marked expired first.\n *\n * REST: `GET /api/approvals/proposals` · scope `kon:approvals:list-proposals`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listProposals: PageableOperation<ListProposalsParams, ListProposalsResponse, ListProposalsItem>;\n /**\n * Later reviews of decided proposals\n *\n * Review items, soonest first. `status=due` (the default) also counts a scheduled review past its date; `due` in the answer is how many are due.\n *\n * REST: `GET /api/approvals/reviews` · scope `kon:approvals:list-reviews`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listReviews: PageableOperation<ListReviewsParams, ListReviewsResponse, ListReviewsItem>;\n /**\n * A proposal in detail\n *\n * The stored request (method, path, body without secrets), the expected diff, the agent and key, the decision and the real result. `canDecide` says whether the caller may approve it.\n *\n * REST: `GET /api/approvals/proposals/{id}` · scope `kon:approvals:proposal-detail`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly proposalDetail: Operation<ProposalDetailParams, ProposalDetailResponse>;\n /**\n * An image held in a proposal\n *\n * The bytes of an image an agent uploaded while waiting for approval (a held multipart upload), for the panel's thumbnail. Team members only; never public and never cached. Deleted when the proposal is rejected, expires or is executed, after which this answers 404.\n *\n * REST: `GET /api/approvals/proposals/{id}/files/{fileId}` · scope `kon:approvals:proposal-image`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly proposalImage: Operation<ProposalImageParams, ProposalImageResponse>;\n /**\n * Reject a proposal\n *\n * The request is never executed. The comment is shown to the agent. `reviewAt` schedules a later review.\n *\n * REST: `POST /api/approvals/proposals/{id}/reject` · scope `kon:approvals:reject-proposal`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly rejectProposal: Operation<RejectProposalParams, RejectProposalResponse>;\n /**\n * The evidence of each field of a row\n *\n * The newest evidence kept per field of one row (`entity`: dataset_entry, table:<name> or sdk:<kon>; `rowId`), as applied from approved agent proposals: source, quote, confidence, retrieval date, the value applied, the proposal and who accepted it.\n *\n * REST: `GET /api/approvals/evidence` · scope `kon:approvals:row-evidence`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly rowEvidence: Operation<RowEvidenceParams, RowEvidenceResponse>;\n /**\n * Change approval settings (admin)\n *\n * Partial update: enabled (the MASTER switch: off, no agent asks for approval, not even those in propose), proposeRetention (selective: propose does not hold POSTs declared read-only; strict: it holds every write), ttlHours (1-720), operations { key: true | false | null }, legacyRules [{ method, path, alternative? }], unattended (hold | deny: what an unattended run does with a request that would be held), unattendedAlternative (text | null) and alternatives { key: text | null } per operation. Takes effect without a restart and is audited.\n *\n * REST: `PUT /api/approvals/settings` · scope `kon:approvals:save-approvals-configuration`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveApprovalsConfiguration: Operation<SaveApprovalsConfigurationParams, SaveApprovalsConfigurationResponse>;\n /**\n * Schedule a later review of a decided proposal\n *\n * At `reviewAt` (ISO date, within a year) the review becomes due and is listed in GET /reviews for a person to look again at what was decided, optionally only some `fields`. Only for executed, failed or rejected proposals.\n *\n * REST: `POST /api/approvals/proposals/{id}/review` · scope `kon:approvals:schedule-proposal-review`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly scheduleProposalReview: Operation<ScheduleProposalReviewParams, ScheduleProposalReviewResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-audit: The agent audit hash chain: verify it and read its head (administrators only). */\n\n/** Success response of `audit.audit-chain-head`. */\nexport type AuditChainHeadResponse = {\n head: Record<string, unknown> | null;\n};\n\n/** Arguments of `audit.verify-audit-chain`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type VerifyAuditChainParams = {\n fromSeq?: number;\n toSeq?: number;\n};\n\n/** Success response of `audit.verify-audit-chain`. */\nexport type VerifyAuditChainResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-audit (path, method, pagination…). */\nexport const operations = {\n \"auditChainHead\": {\"kon\":\"kon-audit\",\"id\":\"audit-chain-head\",\"operationId\":\"audit.audit-chain-head\",\"method\":\"GET\",\"path\":\"/admin/audit/head\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:audit:audit-chain-head\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"verifyAuditChain\": {\"kon\":\"kon-audit\",\"id\":\"verify-audit-chain\",\"operationId\":\"audit.verify-audit-chain\",\"method\":\"GET\",\"path\":\"/admin/audit/verify\",\"pathParams\":[],\"queryParams\":[\"fromSeq\",\"toSeq\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:audit:verify-audit-chain\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-audit\n *\n * The agent audit hash chain: verify it and read its head (administrators only).\n */\nexport interface AuditApi {\n /**\n * Head of the agent audit chain (admin)\n *\n * The newest link of the agent audit chain (seq, row_hash, mac, key version, time), or null if nothing was chained yet. Store it outside the database (a ticket, a log service, a signed commit) to detect later the removal of the newest rows.\n *\n * REST: `GET /api/admin/audit/head` · scope `kon:audit:audit-chain-head`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly auditChainHead: Operation<void, AuditChainHeadResponse>;\n /**\n * Verify the agent audit chain (admin)\n *\n * Recomputes every chained row of the agent audit log: seq without gaps, prev_hash, row_hash and MAC, and the checkpoint the chain starts from after a retention prune. Answers ok, rows checked, the first bad seq and the reason (hash_mismatch, mac_mismatch, seq_gap, prev_hash_mismatch, checkpoint_mismatch), the number of legacy (unchained) rows and the head.\n *\n * REST: `GET /api/admin/audit/verify` · scope `kon:audit:verify-audit-chain`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly verifyAuditChain: Operation<VerifyAuditChainParams, VerifyAuditChainResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-automation: The catalog of events and steps for automation rules, and the dry run of an action. */\n\n/** Success response of `automation.catalog`. */\nexport type CatalogResponse = {\n events: {\n name: string;\n source: string;\n description: string;\n payload: Record<string, string>;\n listeners: string[];\n }[];\n handlers: {\n id: string;\n source: string;\n label: string;\n description: string;\n config: Record<string, string>;\n }[];\n queues: {\n queue: string;\n label: string;\n description: string;\n payload?: Record<string, string>;\n }[];\n};\n\n/** Body of `automation.dry-run-action`. */\nexport type DryRunActionBody = {\n event?: string;\n payload?: Record<string, unknown>;\n};\n\n/** Arguments of `automation.dry-run-action`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DryRunActionParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: DryRunActionBody;\n};\n\n/** Success response of `automation.dry-run-action`. */\nexport type DryRunActionResponse = {\n wouldRun: boolean;\n conditions: {\n passed: boolean;\n outcomes: {\n condition: {\n field: string;\n op: string;\n value?: unknown;\n };\n actual?: unknown;\n passed: boolean;\n }[];\n };\n steps: {\n handler: string;\n config: Record<string, unknown>;\n preview?: unknown;\n problem?: string;\n }[];\n note?: string;\n};\n\n/** Runtime description of every operation of kon-automation (path, method, pagination…). */\nexport const operations = {\n \"catalog\": {\"kon\":\"kon-automation\",\"id\":\"catalog\",\"operationId\":\"automation.catalog\",\"method\":\"GET\",\"path\":\"/automation/catalog\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:automation:catalog\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"dryRunAction\": {\"kon\":\"kon-automation\",\"id\":\"dry-run-action\",\"operationId\":\"automation.dry-run-action\",\"method\":\"POST\",\"path\":\"/automation/actions/{id}/dry-run\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:automation:dry-run-action\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-automation\n *\n * The catalog of events and steps for automation rules, and the dry run of an action.\n */\nexport interface AutomationApi {\n /**\n * Events and steps available to rules\n *\n * The events a rule can listen to (the core's, and the ones loaded kons declare with `events.emits`, each with its payload fields and who listens) and the steps it can use (`core:webhook`, `core:send-mail`, `core:run-agent`, `core:enqueue`, and the ones kons contribute), each with its config fields. `queues` are the job queues a kon opened to the `core:enqueue` step, each with the payload its handler expects.\n *\n * REST: `GET /api/automation/catalog` · scope `kon:automation:catalog`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly catalog: Operation<void, CatalogResponse>;\n /**\n * What an action would do for an event\n *\n * Evaluates the action's conditions against `payload` and, for a rule, fills each step's config and asks its handler for a preview. Nothing is sent, nothing is written and no execution is recorded. For the other types of action only the conditions are checked. Values under keys that name a secret are hidden.\n *\n * REST: `POST /api/automation/actions/{id}/dry-run` · scope `kon:automation:dry-run-action`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly dryRunAction: Operation<DryRunActionParams, DryRunActionResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-blocks: Lego-style block system for dynamic page layouts with drag & drop. Includes Hero, Text, Image, Video, Grid, Cards, Quote, CTA, Embed, Divider, and Spacer blocks. */\n\n/** Success response of `blocks.block-types`. */\nexport type BlockTypesResponse = {\n blockTypes: {\n type: string;\n name: string;\n category: string;\n icon: string;\n description: string;\n /** Field descriptors of the block content */\n schema: Record<string, unknown>;\n [key: string]: unknown;\n }[];\n};\n\n/** Body of `blocks.clone-page`. */\nexport type ClonePageBody = {\n slug?: unknown;\n title?: unknown;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.clone-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ClonePageParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: ClonePageBody;\n};\n\n/** Success response of `blocks.clone-page`. */\nexport type ClonePageResponse = {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n metaTitle: string | null;\n metaDescription: string | null;\n ogImageId: string | null;\n layout: string;\n cssClass: string | null;\n customCss: string | null;\n publishedAt: string | null;\n isHomepage: boolean;\n requireAuth: boolean;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Body of `blocks.create-block`. */\nexport type CreateBlockBody = {\n /** Block type (GET /block-types); unknown types are a 400 */\n type?: string;\n name?: string | null;\n sortOrder?: number;\n columnSpan?: number;\n content?: Record<string, unknown>;\n cssClass?: string | null;\n backgroundColor?: string | null;\n textColor?: string | null;\n padding?: string | null;\n isVisible?: boolean;\n visibleFrom?: string | null;\n visibleUntil?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.create-block`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateBlockParams = {\n /** Page id (uuid) */\n pageId: string | number;\n /** JSON body. */\n body?: CreateBlockBody;\n};\n\n/** Success response of `blocks.create-block`. */\nexport type CreateBlockResponse = {\n id: string;\n pageId: string;\n type: string;\n name: string | null;\n sortOrder: number;\n columnSpan: number;\n content: Record<string, unknown>;\n cssClass: string | null;\n backgroundColor: string | null;\n textColor: string | null;\n padding: string | null;\n isVisible: boolean;\n visibleFrom: string | null;\n visibleUntil: string | null;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Body of `blocks.create-page`. */\nexport type CreatePageBody = {\n title?: string;\n slug?: string;\n description?: string | null;\n /** draft | published | archived */\n status?: string;\n layout?: string;\n metaTitle?: string | null;\n metaDescription?: string | null;\n ogImageId?: string | null;\n cssClass?: string | null;\n customCss?: string | null;\n /** boolean (staff only) */\n isHomepage?: unknown;\n /** boolean */\n requireAuth?: unknown;\n publishedAt?: string | null;\n /** Blocks to create with the page */\n blocks?: unknown[];\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.create-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreatePageParams = {\n /** JSON body. */\n body?: CreatePageBody;\n};\n\n/** Success response of `blocks.create-page`. */\nexport type CreatePageResponse = {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n metaTitle: string | null;\n metaDescription: string | null;\n ogImageId: string | null;\n layout: string;\n cssClass: string | null;\n customCss: string | null;\n publishedAt: string | null;\n isHomepage: boolean;\n requireAuth: boolean;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Body of `blocks.create-template`. */\nexport type CreateTemplateBody = {\n name?: string;\n description?: string | null;\n category?: string | null;\n type?: string;\n content?: Record<string, unknown>;\n cssClass?: string | null;\n backgroundColor?: string | null;\n textColor?: string | null;\n padding?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.create-template`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateTemplateParams = {\n /** JSON body. */\n body?: CreateTemplateBody;\n};\n\n/** Success response of `blocks.create-template`. */\nexport type CreateTemplateResponse = {\n id: string;\n name: string;\n description: string | null;\n category: string;\n type: string;\n content: Record<string, unknown>;\n usageCount: number;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.delete-block`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteBlockParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `blocks.delete-block`. */\nexport type DeleteBlockResponse = {\n success: true;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.delete-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeletePageParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `blocks.delete-page`. */\nexport type DeletePageResponse = {\n success: true;\n id: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.duplicate-block`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DuplicateBlockParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `blocks.duplicate-block`. */\nexport type DuplicateBlockResponse = {\n id: string;\n pageId: string;\n type: string;\n name: string | null;\n sortOrder: number;\n columnSpan: number;\n content: Record<string, unknown>;\n cssClass: string | null;\n backgroundColor: string | null;\n textColor: string | null;\n padding: string | null;\n isVisible: boolean;\n visibleFrom: string | null;\n visibleUntil: string | null;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.get-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetPageParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n /** `false` returns the page without its blocks. Default `true`. */\n includeBlocks?: \"true\" | \"false\";\n /**\n * Deprecated since 2026-11-18, removed after 2027-05-18: use `includeBlocks`.\n * @deprecated\n */\n include_blocks?: \"true\" | \"false\";\n};\n\n/** Success response of `blocks.get-page`. */\nexport type GetPageResponse = {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n metaTitle: string | null;\n metaDescription: string | null;\n ogImageId: string | null;\n layout: string;\n cssClass: string | null;\n customCss: string | null;\n publishedAt: string | null;\n isHomepage: boolean;\n requireAuth: boolean;\n createdAt: string;\n updatedAt: string;\n blocks: {\n id: string;\n pageId: string;\n type: string;\n name: string | null;\n sortOrder: number;\n columnSpan: number;\n content: Record<string, unknown>;\n cssClass: string | null;\n backgroundColor: string | null;\n textColor: string | null;\n padding: string | null;\n isVisible: boolean;\n visibleFrom: string | null;\n visibleUntil: string | null;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n }[];\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.list-pages`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListPagesParams = {\n /** draft | published | archived (only staff see non-published) */\n status?: string | number;\n /** 1-100, default 50 */\n limit?: string | number;\n offset?: string | number;\n layout?: string | number;\n /** Title contains (max 200 chars) */\n search?: string | number;\n /** Keyset paging: the `nextCursor` of the previous batch (no count is made) */\n cursor?: string | number;\n /** `cursor` for the first batch in keyset paging (answers `nextCursor`) */\n paging?: string | number;\n};\n\n/** Success response of `blocks.list-pages`. */\nexport type ListPagesResponse = {\n docs: {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n layout: string;\n isHomepage: boolean;\n publishedAt: string | null;\n updatedAt: string;\n [key: string]: unknown;\n }[];\n totalDocs?: number;\n limit: number;\n offset?: number;\n nextCursor?: string | null;\n};\n\n/** One item of the list `blocks.list-pages` pages through. */\nexport type ListPagesItem = {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n layout: string;\n isHomepage: boolean;\n publishedAt: string | null;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.list-templates`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListTemplatesParams = {\n category?: string | number;\n type?: string | number;\n};\n\n/** Success response of `blocks.list-templates`. */\nexport type ListTemplatesResponse = {\n docs: {\n id: string;\n name: string;\n description: string | null;\n category: string;\n type: string;\n content: Record<string, unknown>;\n usageCount: number;\n [key: string]: unknown;\n }[];\n};\n\n/** Body of `blocks.publish-block-as-page`. */\nexport type PublishBlockAsPageBody = {\n blockType?: string;\n content?: Record<string, unknown>;\n title?: string;\n slug?: string;\n status?: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.publish-block-as-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type PublishBlockAsPageParams = {\n /** JSON body. */\n body?: PublishBlockAsPageBody;\n};\n\n/** Success response of `blocks.publish-block-as-page`. */\nexport type PublishBlockAsPageResponse = {\n data: {\n id: string;\n slug: string;\n title: string;\n status: string;\n };\n /** false when an existing page with that slug was updated (200) */\n created: boolean;\n};\n\n/** Body of `blocks.publish-draft`. */\nexport type PublishDraftBody = {\n /** Uuid of the draft page (made with clone) */\n draftId?: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.publish-draft`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type PublishDraftParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: PublishDraftBody;\n};\n\n/** Success response of `blocks.publish-draft`. */\nexport type PublishDraftResponse = {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n metaTitle: string | null;\n metaDescription: string | null;\n ogImageId: string | null;\n layout: string;\n cssClass: string | null;\n customCss: string | null;\n publishedAt: string | null;\n isHomepage: boolean;\n requireAuth: boolean;\n createdAt: string;\n updatedAt: string;\n blocks: {\n id: string;\n pageId: string;\n type: string;\n name: string | null;\n sortOrder: number;\n columnSpan: number;\n content: Record<string, unknown>;\n cssClass: string | null;\n backgroundColor: string | null;\n textColor: string | null;\n padding: string | null;\n isVisible: boolean;\n visibleFrom: string | null;\n visibleUntil: string | null;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n }[];\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.render-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RenderPageParams = {\n /** Path parameter. */\n slug: string | number;\n};\n\n/** Success response of `blocks.render-page`. */\nexport type RenderPageResponse = {\n page: {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n metaTitle: string | null;\n metaDescription: string | null;\n layout: string;\n cssClass: string | null;\n customCss: string | null;\n publishedAt: string | null;\n [key: string]: unknown;\n };\n blocks: {\n id: string;\n type: string;\n content: Record<string, unknown>;\n columnSpan: number;\n /** Transform URLs for media blocks */\n mediaUrls?: Record<string, unknown>;\n [key: string]: unknown;\n }[];\n};\n\n/** Body of `blocks.reorder-blocks`. */\nexport type ReorderBlocksBody = {\n blockOrders?: {\n id: string;\n sortOrder: number;\n [key: string]: unknown;\n }[];\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.reorder-blocks`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReorderBlocksParams = {\n /** Page id (uuid) */\n pageId: string | number;\n /** JSON body. */\n body?: ReorderBlocksBody;\n};\n\n/** Success response of `blocks.reorder-blocks`. */\nexport type ReorderBlocksResponse = {\n success: true;\n [key: string]: unknown;\n};\n\n/** Body of `blocks.update-block`. */\nexport type UpdateBlockBody = {\n /** Block type (GET /block-types); unknown types are a 400 */\n type?: string;\n name?: string | null;\n sortOrder?: number;\n columnSpan?: number;\n content?: Record<string, unknown>;\n cssClass?: string | null;\n backgroundColor?: string | null;\n textColor?: string | null;\n padding?: string | null;\n isVisible?: boolean;\n visibleFrom?: string | null;\n visibleUntil?: string | null;\n /** Field changes instead of `content`: dot paths, numeric segments index arrays (contract page-builder-patch) */\n contentPatch?: {\n path: string;\n value: unknown;\n [key: string]: unknown;\n }[];\n /** The block's updatedAt as read; same as If-Match. A mismatch is a 409 */\n expectedUpdatedAt?: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.update-block`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateBlockParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: UpdateBlockBody;\n};\n\n/** Success response of `blocks.update-block`. */\nexport type UpdateBlockResponse = {\n id: string;\n pageId: string;\n type: string;\n name: string | null;\n sortOrder: number;\n columnSpan: number;\n content: Record<string, unknown>;\n cssClass: string | null;\n backgroundColor: string | null;\n textColor: string | null;\n padding: string | null;\n isVisible: boolean;\n visibleFrom: string | null;\n visibleUntil: string | null;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Body of `blocks.update-page`. */\nexport type UpdatePageBody = {\n title?: string;\n slug?: string;\n description?: string | null;\n /** draft | published | archived */\n status?: string;\n layout?: string;\n metaTitle?: string | null;\n metaDescription?: string | null;\n ogImageId?: string | null;\n cssClass?: string | null;\n customCss?: string | null;\n /** boolean (staff only) */\n isHomepage?: unknown;\n /** boolean */\n requireAuth?: unknown;\n publishedAt?: string | null;\n /** Blocks to create with the page */\n blocks?: unknown[];\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.update-page`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdatePageParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: UpdatePageBody;\n};\n\n/** Success response of `blocks.update-page`. */\nexport type UpdatePageResponse = {\n id: string;\n title: string;\n slug: string;\n description: string | null;\n status: \"draft\" | \"published\" | \"archived\";\n metaTitle: string | null;\n metaDescription: string | null;\n ogImageId: string | null;\n layout: string;\n cssClass: string | null;\n customCss: string | null;\n publishedAt: string | null;\n isHomepage: boolean;\n requireAuth: boolean;\n createdAt: string;\n updatedAt: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `blocks.use-template`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UseTemplateParams = {\n /** Page/block/template id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `blocks.use-template`. */\nexport type UseTemplateResponse = {\n id: string;\n name: string;\n description: string | null;\n category: string;\n type: string;\n content: Record<string, unknown>;\n usageCount: number;\n [key: string]: unknown;\n};\n\n/** Runtime description of every operation of kon-blocks (path, method, pagination…). */\nexport const operations = {\n \"blockTypes\": {\"kon\":\"kon-blocks\",\"id\":\"block-types\",\"operationId\":\"blocks.block-types\",\"method\":\"GET\",\"path\":\"/page-builder/block-types\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:blocks:block-types\",\"mcpTool\":\"blocks__block-types\",\"errors\":[\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"clonePage\": {\"kon\":\"kon-blocks\",\"id\":\"clone-page\",\"operationId\":\"blocks.clone-page\",\"method\":\"POST\",\"path\":\"/page-builder/pages/{id}/clone\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:clone-page\",\"mcpTool\":\"blocks__clone-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createBlock\": {\"kon\":\"kon-blocks\",\"id\":\"create-block\",\"operationId\":\"blocks.create-block\",\"method\":\"POST\",\"path\":\"/page-builder/pages/{pageId}/blocks\",\"pathParams\":[\"pageId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:create-block\",\"mcpTool\":\"blocks__create-block\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createPage\": {\"kon\":\"kon-blocks\",\"id\":\"create-page\",\"operationId\":\"blocks.create-page\",\"method\":\"POST\",\"path\":\"/page-builder/pages\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:create-page\",\"mcpTool\":\"blocks__create-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createTemplate\": {\"kon\":\"kon-blocks\",\"id\":\"create-template\",\"operationId\":\"blocks.create-template\",\"method\":\"POST\",\"path\":\"/page-builder/templates\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:create-template\",\"mcpTool\":\"blocks__create-template\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteBlock\": {\"kon\":\"kon-blocks\",\"id\":\"delete-block\",\"operationId\":\"blocks.delete-block\",\"method\":\"DELETE\",\"path\":\"/page-builder/blocks/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:blocks:delete-block\",\"mcpTool\":\"blocks__delete-block\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deletePage\": {\"kon\":\"kon-blocks\",\"id\":\"delete-page\",\"operationId\":\"blocks.delete-page\",\"method\":\"DELETE\",\"path\":\"/page-builder/pages/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:blocks:delete-page\",\"mcpTool\":\"blocks__delete-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"duplicateBlock\": {\"kon\":\"kon-blocks\",\"id\":\"duplicate-block\",\"operationId\":\"blocks.duplicate-block\",\"method\":\"POST\",\"path\":\"/page-builder/blocks/{id}/duplicate\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:duplicate-block\",\"mcpTool\":\"blocks__duplicate-block\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getPage\": {\"kon\":\"kon-blocks\",\"id\":\"get-page\",\"operationId\":\"blocks.get-page\",\"method\":\"GET\",\"path\":\"/page-builder/pages/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[\"includeBlocks\",\"include_blocks\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:blocks:get-page\",\"mcpTool\":\"blocks__get-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listPages\": {\"kon\":\"kon-blocks\",\"id\":\"list-pages\",\"operationId\":\"blocks.list-pages\",\"method\":\"GET\",\"path\":\"/page-builder/pages\",\"pathParams\":[],\"queryParams\":[\"status\",\"limit\",\"offset\",\"layout\",\"search\",\"cursor\",\"paging\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:blocks:list-pages\",\"mcpTool\":\"blocks__list-pages\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"cursor\",\"items\":\"docs\",\"limit\":\"limit\"}},\n \"listTemplates\": {\"kon\":\"kon-blocks\",\"id\":\"list-templates\",\"operationId\":\"blocks.list-templates\",\"method\":\"GET\",\"path\":\"/page-builder/templates\",\"pathParams\":[],\"queryParams\":[\"category\",\"type\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:blocks:list-templates\",\"mcpTool\":\"blocks__list-templates\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"publishBlockAsPage\": {\"kon\":\"kon-blocks\",\"id\":\"publish-block-as-page\",\"operationId\":\"blocks.publish-block-as-page\",\"method\":\"POST\",\"path\":\"/page-builder/pages/from-block\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:publish-block-as-page\",\"mcpTool\":\"blocks__publish-block-as-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"publishDraft\": {\"kon\":\"kon-blocks\",\"id\":\"publish-draft\",\"operationId\":\"blocks.publish-draft\",\"method\":\"POST\",\"path\":\"/page-builder/pages/{id}/publish-draft\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:publish-draft\",\"mcpTool\":\"blocks__publish-draft\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"renderPage\": {\"kon\":\"kon-blocks\",\"id\":\"render-page\",\"operationId\":\"blocks.render-page\",\"method\":\"GET\",\"path\":\"/page-builder/render/{slug}\",\"pathParams\":[\"slug\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:blocks:render-page\",\"mcpTool\":\"blocks__render-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"reorderBlocks\": {\"kon\":\"kon-blocks\",\"id\":\"reorder-blocks\",\"operationId\":\"blocks.reorder-blocks\",\"method\":\"POST\",\"path\":\"/page-builder/pages/{pageId}/blocks/reorder\",\"pathParams\":[\"pageId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:reorder-blocks\",\"mcpTool\":\"blocks__reorder-blocks\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateBlock\": {\"kon\":\"kon-blocks\",\"id\":\"update-block\",\"operationId\":\"blocks.update-block\",\"method\":\"PATCH\",\"path\":\"/page-builder/blocks/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:update-block\",\"mcpTool\":\"blocks__update-block\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updatePage\": {\"kon\":\"kon-blocks\",\"id\":\"update-page\",\"operationId\":\"blocks.update-page\",\"method\":\"PATCH\",\"path\":\"/page-builder/pages/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:update-page\",\"mcpTool\":\"blocks__update-page\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"useTemplate\": {\"kon\":\"kon-blocks\",\"id\":\"use-template\",\"operationId\":\"blocks.use-template\",\"method\":\"POST\",\"path\":\"/page-builder/templates/{id}/use\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:blocks:use-template\",\"mcpTool\":\"blocks__use-template\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-blocks\n *\n * Lego-style block system for dynamic page layouts with drag & drop. Includes Hero, Text, Image, Video, Grid, Cards, Quote, CTA, Embed, Divider, and Spacer blocks.\n */\nexport interface BlocksApi {\n /**\n * List block types\n *\n * The block types a page can hold, each with the descriptor of its content fields.\n *\n * REST: `GET /api/page-builder/block-types` · scope `kon:blocks:block-types`\n * idempotent (safe to retry) · MCP tool `blocks__block-types`\n * Errors: `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly blockTypes: Operation<void, BlockTypesResponse>;\n /**\n * Clone a page\n *\n * Copies a page and its blocks as a new draft (never as homepage). Slug and title default to '<slug>-copy' and '<title> (Copy)'.\n *\n * REST: `POST /api/page-builder/pages/{id}/clone` · scope `kon:blocks:clone-page`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__clone-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly clonePage: Operation<ClonePageParams, ClonePageResponse>;\n /**\n * Add a block to a page\n *\n * Appends a block (after the last one unless sortOrder is given). The content is sanitized for its type before it is stored.\n *\n * REST: `POST /api/page-builder/pages/{pageId}/blocks` · scope `kon:blocks:create-block`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__create-block`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createBlock: Operation<CreateBlockParams, CreateBlockResponse>;\n /**\n * Create a page\n *\n * Creates a page (draft by default) and, optionally, its blocks. The slug is derived from the title when missing. Making it the homepage needs a staff account.\n *\n * REST: `POST /api/page-builder/pages` · scope `kon:blocks:create-page`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__create-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createPage: Operation<CreatePageParams, CreatePageResponse>;\n /**\n * Create a block template\n *\n * Saves a reusable block (name, block type and content).\n *\n * REST: `POST /api/page-builder/templates` · scope `kon:blocks:create-template`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__create-template`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createTemplate: Operation<CreateTemplateParams, CreateTemplateResponse>;\n /**\n * Delete a block\n *\n * Removes one block from its page.\n *\n * REST: `DELETE /api/page-builder/blocks/{id}` · scope `kon:blocks:delete-block`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `blocks__delete-block`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteBlock: Operation<DeleteBlockParams, DeleteBlockResponse>;\n /**\n * Delete a page\n *\n * Deletes a page and all its blocks. Cannot be undone.\n *\n * REST: `DELETE /api/page-builder/pages/{id}` · scope `kon:blocks:delete-page`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `blocks__delete-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deletePage: Operation<DeletePageParams, DeletePageResponse>;\n /**\n * Duplicate a block\n *\n * Copies a block to the end of the same page (name gets a '(Copy)' suffix).\n *\n * REST: `POST /api/page-builder/blocks/{id}/duplicate` · scope `kon:blocks:duplicate-block`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__duplicate-block`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly duplicateBlock: Operation<DuplicateBlockParams, DuplicateBlockResponse>;\n /**\n * Get a page with its blocks\n *\n * One page by uuid or slug, with its visible blocks in order (block content sanitized). Drafts and session-only pages are a 404 for whoever cannot see them.\n *\n * REST: `GET /api/page-builder/pages/{id}` · scope `kon:blocks:get-page`\n * idempotent (safe to retry) · MCP tool `blocks__get-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getPage: Operation<GetPageParams, GetPageResponse>;\n /**\n * List pages\n *\n * Paginated list of page-builder pages, newest update first. The public (and any caller without the content role) only sees published pages that do not require a session; staff and agents with content:edit can filter by any status.\n *\n * REST: `GET /api/page-builder/pages` · scope `kon:blocks:list-pages`\n * idempotent (safe to retry) · MCP tool `blocks__list-pages`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listPages: PageableOperation<ListPagesParams, ListPagesResponse, ListPagesItem>;\n /**\n * List block templates\n *\n * Active block templates, most used first, optionally filtered by category or block type.\n *\n * REST: `GET /api/page-builder/templates` · scope `kon:blocks:list-templates`\n * idempotent (safe to retry) · MCP tool `blocks__list-templates`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listTemplates: Operation<ListTemplatesParams, ListTemplatesResponse>;\n /**\n * Publish one block as its own page\n *\n * Creates (201) or updates (200, same slug) a page that holds exactly one block. Republishing replaces the previous block instead of duplicating it, so it is safe to call again with the same slug.\n *\n * REST: `POST /api/page-builder/pages/from-block` · scope `kon:blocks:publish-block-as-page`\n * idempotent (safe to retry) · MCP tool `blocks__publish-block-as-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly publishBlockAsPage: Operation<PublishBlockAsPageParams, PublishBlockAsPageResponse>;\n /**\n * Publish a draft onto its page\n *\n * Atomically replaces the page's currently shown blocks with the draft's, copies title, description, metaTitle, metaDescription and ogImageId, and deletes the draft. Hidden and scheduled blocks of the page are kept. Returns the page with its shown blocks.\n *\n * REST: `POST /api/page-builder/pages/{id}/publish-draft` · scope `kon:blocks:publish-draft`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__publish-draft`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly publishDraft: Operation<PublishDraftParams, PublishDraftResponse>;\n /**\n * Render a published page\n *\n * A published page ready to paint: page metadata plus visible blocks (scheduled visibility applied) with transform URLs for their media. Session-only pages need a session.\n *\n * REST: `GET /api/page-builder/render/{slug}` · scope `kon:blocks:render-page`\n * idempotent (safe to retry) · MCP tool `blocks__render-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly renderPage: Operation<RenderPageParams, RenderPageResponse>;\n /**\n * Reorder the blocks of a page\n *\n * Sets sortOrder for up to 500 blocks of the page in one go. Blocks of other pages are ignored. Sending the same order twice leaves the same state.\n *\n * REST: `POST /api/page-builder/pages/{pageId}/blocks/reorder` · scope `kon:blocks:reorder-blocks`\n * idempotent (safe to retry) · MCP tool `blocks__reorder-blocks`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly reorderBlocks: Operation<ReorderBlocksParams, ReorderBlocksResponse>;\n /**\n * Update a block\n *\n * Changes the given block fields; new content is sanitized for the block type. `contentPatch: [{ path, value }]` changes single content fields (dot paths, numeric segments index arrays) instead of replacing `content`. With `If-Match: \"<updatedAt>\"` (or `expectedUpdatedAt`) the write only happens if the block was not changed since; otherwise 409 with the current block.\n *\n * REST: `PATCH /api/page-builder/blocks/{id}` · scope `kon:blocks:update-block`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__update-block`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateBlock: Operation<UpdateBlockParams, UpdateBlockResponse>;\n /**\n * Update a page\n *\n * Changes the given page fields. Publishing sets publishedAt when it was empty; changing the slug checks it is free; isHomepage needs a staff account.\n *\n * REST: `PATCH /api/page-builder/pages/{id}` · scope `kon:blocks:update-page`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__update-page`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updatePage: Operation<UpdatePageParams, UpdatePageResponse>;\n /**\n * Count one use of a template\n *\n * Increments the usage counter of a template (it orders the template list).\n *\n * REST: `POST /api/page-builder/templates/{id}/use` · scope `kon:blocks:use-template`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `blocks__use-template`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly useTemplate: Operation<UseTemplateParams, UseTemplateResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-brain: Agent memory: notes with an owner (private by default, optionally shared), connections with provenance, claims with evidence, OKF export and graphify import. */\n\n/** Body of `brain.add-claim`. */\nexport type AddClaimBody = {\n noteId: string;\n statement: string;\n sourceId?: string;\n source?: {\n title: string;\n content: string;\n uri?: string;\n sourceType?: \"url\" | \"file\" | \"text\" | \"note\";\n };\n range?: {\n unit: \"line\" | \"char\";\n start: number;\n end: number;\n };\n};\n\n/** Arguments of `brain.add-claim`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AddClaimParams = {\n /** JSON body. */\n body: AddClaimBody;\n};\n\n/** Success response of `brain.add-claim`. */\nexport type AddClaimResponse = {\n claim: {\n id: string;\n noteId: string;\n statement: string;\n source: {\n id: string | null;\n sha256: string;\n uri: string | null;\n range: {\n unit: \"line\" | \"char\";\n start: number;\n end: number;\n } | null;\n };\n status: \"fresh\" | \"stale\";\n staleReason: string | null;\n checkedAt: string;\n verifiedAt: string | null;\n verifiedBy: string | null;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n createdAt: string;\n };\n created: boolean;\n};\n\n/** Body of `brain.connect`. */\nexport type ConnectBody = {\n sourceNoteId: string;\n targetNoteId: string;\n relationType?: string;\n origin?: \"EXTRACTED\" | \"INFERRED\" | \"MANUAL\";\n confidence?: number;\n metadata?: Record<string, unknown>;\n};\n\n/** Arguments of `brain.connect`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ConnectParams = {\n /** JSON body. */\n body: ConnectBody;\n};\n\n/** Success response of `brain.connect`. */\nexport type ConnectResponse = {\n connection: {\n id: string;\n sourceNoteId: string;\n targetNoteId: string;\n relationType: string;\n origin: \"EXTRACTED\" | \"INFERRED\" | \"MANUAL\";\n confidence: number;\n strength: number;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n metadata: Record<string, unknown>;\n createdAt: string;\n };\n created: boolean;\n};\n\n/** Arguments of `brain.delete-note`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteNoteParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `brain.delete-note`. */\nexport type DeleteNoteResponse = null;\n\n/** Arguments of `brain.export-okf`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ExportOkfParams = {\n noteIds?: string | number;\n limit?: number;\n};\n\n/** Success response of `brain.export-okf`. */\nexport type ExportOkfResponse = {\n okfVersion: \"0.2\";\n files: {\n path: string;\n content: string;\n }[];\n notes: number;\n claims: number;\n};\n\n/** Body of `brain.import-graphify`. */\nexport type ImportGraphifyBody = {\n namespace: string;\n visibility?: \"private\" | \"shared\";\n allowUnknownSchemaVersion?: boolean;\n graph: Record<string, unknown>;\n};\n\n/** Arguments of `brain.import-graphify`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ImportGraphifyParams = {\n /** JSON body. */\n body: ImportGraphifyBody;\n};\n\n/** Success response of `brain.import-graphify`. */\nexport type ImportGraphifyResponse = {\n namespace: string;\n schemaVersion: string | number | null;\n graphifyVersion: string | null;\n notes: {\n created: number;\n updated: number;\n unchanged: number;\n };\n connections: {\n created: number;\n existing: number;\n extracted: number;\n inferred: number;\n };\n hyperedgesSkipped: number;\n embedding: {\n kind: string;\n mode: \"lexical\" | \"semantic\";\n dimensions: number;\n };\n warnings: string[];\n};\n\n/** Success response of `brain.lint`. */\nexport type LintResponse = {\n checked: number;\n updated: number;\n stale: {\n claimId: string;\n noteId: string;\n statement: string;\n reason: string;\n }[];\n};\n\n/** Arguments of `brain.list-claims`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListClaimsParams = {\n noteId?: string | number;\n status?: \"fresh\" | \"stale\";\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `brain.list-claims`. */\nexport type ListClaimsResponse = {\n claims: {\n id: string;\n noteId: string;\n statement: string;\n source: {\n id: string | null;\n sha256: string;\n uri: string | null;\n range: {\n unit: \"line\" | \"char\";\n start: number;\n end: number;\n } | null;\n };\n status: \"fresh\" | \"stale\";\n staleReason: string | null;\n checkedAt: string;\n verifiedAt: string | null;\n verifiedBy: string | null;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n createdAt: string;\n }[];\n hasMore: boolean;\n};\n\n/** One item of the list `brain.list-claims` pages through. */\nexport type ListClaimsItem = {\n id: string;\n noteId: string;\n statement: string;\n source: {\n id: string | null;\n sha256: string;\n uri: string | null;\n range: {\n unit: \"line\" | \"char\";\n start: number;\n end: number;\n } | null;\n };\n status: \"fresh\" | \"stale\";\n staleReason: string | null;\n checkedAt: string;\n verifiedAt: string | null;\n verifiedBy: string | null;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n createdAt: string;\n};\n\n/** Arguments of `brain.list-notes`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListNotesParams = {\n mine?: \"true\" | \"false\";\n visibility?: \"private\" | \"shared\";\n tag?: string | number;\n keyPrefix?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `brain.list-notes`. */\nexport type ListNotesResponse = {\n notes: {\n id: string;\n key: string | null;\n title: string;\n content: string;\n visibility: \"private\" | \"shared\";\n owner: {\n userId: string | null;\n agentId: string | null;\n sponsorUserId: string | null;\n };\n category: string;\n source: string;\n tags: string[];\n importance: number;\n confidence: number;\n metadata: Record<string, unknown>;\n embeddingKind: string | null;\n createdAt: string;\n updatedAt: string;\n }[];\n};\n\n/** One item of the list `brain.list-notes` pages through. */\nexport type ListNotesItem = {\n id: string;\n key: string | null;\n title: string;\n content: string;\n visibility: \"private\" | \"shared\";\n owner: {\n userId: string | null;\n agentId: string | null;\n sponsorUserId: string | null;\n };\n category: string;\n source: string;\n tags: string[];\n importance: number;\n confidence: number;\n metadata: Record<string, unknown>;\n embeddingKind: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Arguments of `brain.note-connections`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type NoteConnectionsParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `brain.note-connections`. */\nexport type NoteConnectionsResponse = {\n connections: {\n id: string;\n sourceNoteId: string;\n targetNoteId: string;\n relationType: string;\n origin: \"EXTRACTED\" | \"INFERRED\" | \"MANUAL\";\n confidence: number;\n strength: number;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n metadata: Record<string, unknown>;\n createdAt: string;\n }[];\n};\n\n/** Arguments of `brain.read-note`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadNoteParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `brain.read-note`. */\nexport type ReadNoteResponse = {\n note: {\n id: string;\n key: string | null;\n title: string;\n content: string;\n visibility: \"private\" | \"shared\";\n owner: {\n userId: string | null;\n agentId: string | null;\n sponsorUserId: string | null;\n };\n category: string;\n source: string;\n tags: string[];\n importance: number;\n confidence: number;\n metadata: Record<string, unknown>;\n embeddingKind: string | null;\n createdAt: string;\n updatedAt: string;\n };\n connections: {\n id: string;\n sourceNoteId: string;\n targetNoteId: string;\n relationType: string;\n origin: \"EXTRACTED\" | \"INFERRED\" | \"MANUAL\";\n confidence: number;\n strength: number;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n metadata: Record<string, unknown>;\n createdAt: string;\n }[];\n claims: {\n id: string;\n noteId: string;\n statement: string;\n source: {\n id: string | null;\n sha256: string;\n uri: string | null;\n range: {\n unit: \"line\" | \"char\";\n start: number;\n end: number;\n } | null;\n };\n status: \"fresh\" | \"stale\";\n staleReason: string | null;\n checkedAt: string;\n verifiedAt: string | null;\n verifiedBy: string | null;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n createdAt: string;\n }[];\n};\n\n/** Arguments of `brain.search`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SearchParams = {\n q: string | number;\n limit?: number;\n threshold?: number;\n visibility?: \"private\" | \"shared\";\n};\n\n/** Success response of `brain.search`. */\nexport type SearchResponse = {\n hits: {\n note: {\n id: string;\n key: string | null;\n title: string;\n content: string;\n visibility: \"private\" | \"shared\";\n owner: {\n userId: string | null;\n agentId: string | null;\n sponsorUserId: string | null;\n };\n category: string;\n source: string;\n tags: string[];\n importance: number;\n confidence: number;\n metadata: Record<string, unknown>;\n embeddingKind: string | null;\n createdAt: string;\n updatedAt: string;\n };\n score: number;\n }[];\n embedding: {\n kind: string;\n mode: \"lexical\" | \"semantic\";\n dimensions: number;\n };\n compared: number;\n};\n\n/** Body of `brain.verify-claim`. */\nexport type VerifyClaimBody = {\n rebind?: boolean;\n};\n\n/** Arguments of `brain.verify-claim`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type VerifyClaimParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: VerifyClaimBody;\n};\n\n/** Success response of `brain.verify-claim`. */\nexport type VerifyClaimResponse = {\n claim: {\n id: string;\n noteId: string;\n statement: string;\n source: {\n id: string | null;\n sha256: string;\n uri: string | null;\n range: {\n unit: \"line\" | \"char\";\n start: number;\n end: number;\n } | null;\n };\n status: \"fresh\" | \"stale\";\n staleReason: string | null;\n checkedAt: string;\n verifiedAt: string | null;\n verifiedBy: string | null;\n owner: {\n userId: string | null;\n agentId: string | null;\n };\n createdAt: string;\n };\n check: {\n status: \"fresh\" | \"stale\";\n reason: string | null;\n newerSourceId: string | null;\n };\n rebound: boolean;\n};\n\n/** Body of `brain.write-note`. */\nexport type WriteNoteBody = {\n key: string;\n title: string;\n content: string;\n visibility?: \"private\" | \"shared\";\n category?: \"schema\" | \"route\" | \"kon\" | \"agent\" | \"function\" | \"dataset\" | \"insight\" | \"connection\" | \"general\";\n tags?: string[];\n importance?: number;\n metadata?: Record<string, unknown>;\n};\n\n/** Arguments of `brain.write-note`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type WriteNoteParams = {\n /** JSON body. */\n body: WriteNoteBody;\n};\n\n/** Success response of `brain.write-note`. */\nexport type WriteNoteResponse = {\n note: {\n id: string;\n key: string | null;\n title: string;\n content: string;\n visibility: \"private\" | \"shared\";\n owner: {\n userId: string | null;\n agentId: string | null;\n sponsorUserId: string | null;\n };\n category: string;\n source: string;\n tags: string[];\n importance: number;\n confidence: number;\n metadata: Record<string, unknown>;\n embeddingKind: string | null;\n createdAt: string;\n updatedAt: string;\n };\n outcome: \"created\" | \"updated\" | \"unchanged\";\n embedding: {\n kind: string;\n mode: \"lexical\" | \"semantic\";\n dimensions: number;\n };\n};\n\n/** Runtime description of every operation of kon-brain (path, method, pagination…). */\nexport const operations = {\n \"addClaim\": {\"kon\":\"kon-brain\",\"id\":\"add-claim\",\"operationId\":\"brain.add-claim\",\"method\":\"POST\",\"path\":\"/brain/memory/claims\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\",\"201\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:brain:add-claim\",\"mcpTool\":\"brain_claim_add\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"connect\": {\"kon\":\"kon-brain\",\"id\":\"connect\",\"operationId\":\"brain.connect\",\"method\":\"POST\",\"path\":\"/brain/memory/connections\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\",\"201\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:brain:connect\",\"mcpTool\":\"brain_connect\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteNote\": {\"kon\":\"kon-brain\",\"id\":\"delete-note\",\"operationId\":\"brain.delete-note\",\"method\":\"DELETE\",\"path\":\"/brain/memory/notes/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"204\":\"empty\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:brain:delete-note\",\"mcpTool\":\"brain_note_delete\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"exportOkf\": {\"kon\":\"kon-brain\",\"id\":\"export-okf\",\"operationId\":\"brain.export-okf\",\"method\":\"GET\",\"path\":\"/brain/memory/export/okf\",\"pathParams\":[],\"queryParams\":[\"noteIds\",\"limit\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:brain:export-okf\",\"mcpTool\":\"brain_export_okf\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"importGraphify\": {\"kon\":\"kon-brain\",\"id\":\"import-graphify\",\"operationId\":\"brain.import-graphify\",\"method\":\"POST\",\"path\":\"/brain/memory/import/graphify\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:brain:import-graphify\",\"mcpTool\":\"brain_import_graphify\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"lint\": {\"kon\":\"kon-brain\",\"id\":\"lint\",\"operationId\":\"brain.lint\",\"method\":\"POST\",\"path\":\"/brain/memory/lint\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:brain:lint\",\"mcpTool\":\"brain_lint\",\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listClaims\": {\"kon\":\"kon-brain\",\"id\":\"list-claims\",\"operationId\":\"brain.list-claims\",\"method\":\"GET\",\"path\":\"/brain/memory/claims\",\"pathParams\":[],\"queryParams\":[\"noteId\",\"status\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:brain:list-claims\",\"mcpTool\":\"brain_claims\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"claims\",\"limit\":\"limit\"}},\n \"listNotes\": {\"kon\":\"kon-brain\",\"id\":\"list-notes\",\"operationId\":\"brain.list-notes\",\"method\":\"GET\",\"path\":\"/brain/memory/notes\",\"pathParams\":[],\"queryParams\":[\"mine\",\"visibility\",\"tag\",\"keyPrefix\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:brain:list-notes\",\"mcpTool\":\"brain_list\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"notes\",\"limit\":\"limit\"}},\n \"noteConnections\": {\"kon\":\"kon-brain\",\"id\":\"note-connections\",\"operationId\":\"brain.note-connections\",\"method\":\"GET\",\"path\":\"/brain/memory/notes/{id}/connections\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:brain:note-connections\",\"mcpTool\":\"brain_connections\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"readNote\": {\"kon\":\"kon-brain\",\"id\":\"read-note\",\"operationId\":\"brain.read-note\",\"method\":\"GET\",\"path\":\"/brain/memory/notes/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:brain:read-note\",\"mcpTool\":\"brain_read\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"search\": {\"kon\":\"kon-brain\",\"id\":\"search\",\"operationId\":\"brain.search\",\"method\":\"GET\",\"path\":\"/brain/memory/search\",\"pathParams\":[],\"queryParams\":[\"q\",\"limit\",\"threshold\",\"visibility\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:brain:search\",\"mcpTool\":\"brain_search\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"verifyClaim\": {\"kon\":\"kon-brain\",\"id\":\"verify-claim\",\"operationId\":\"brain.verify-claim\",\"method\":\"POST\",\"path\":\"/brain/memory/claims/{id}/verify\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:brain:verify-claim\",\"mcpTool\":\"brain_claim_verify\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"writeNote\": {\"kon\":\"kon-brain\",\"id\":\"write-note\",\"operationId\":\"brain.write-note\",\"method\":\"PUT\",\"path\":\"/brain/memory/notes\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\",\"201\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:brain:write-note\",\"mcpTool\":\"brain_note_write\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-brain\n *\n * Agent memory: notes with an owner (private by default, optionally shared), connections with provenance, claims with evidence, OKF export and graphify import.\n */\nexport interface BrainApi {\n /**\n * Add a claim with evidence to your note\n *\n * Ties a statement of YOUR note to its evidence: an existing source (`sourceId`) or the evidence itself (`source`: title, content, uri), captured as an immutable, content-addressed source. Records the source's SHA-256 and an optional range (`line`: 1-based inclusive; `char`: 0-based, end exclusive). Idempotent by (note, statement, source hash). The response never includes the source's content.\n *\n * REST: `POST /api/brain/memory/claims` · scope `kon:brain:add-claim`\n * idempotent (safe to retry) · MCP tool `brain_claim_add`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly addClaim: Operation<AddClaimParams, AddClaimResponse>;\n /**\n * Connect two notes\n *\n * Connects two notes you can see. Idempotent by (source, target, relationType): repeating it returns the existing connection. `origin` defaults to MANUAL with confidence 1.\n *\n * REST: `POST /api/brain/memory/connections` · scope `kon:brain:connect`\n * idempotent (safe to retry) · MCP tool `brain_connect`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly connect: Operation<ConnectParams, ConnectResponse>;\n /**\n * Delete a memory note\n *\n * Deletes YOUR note (and, in cascade, its connections and claims). A shared note of someone else is 403; one you cannot see, 404. Sensible: an agent under human approval gets a proposal (202) instead.\n *\n * REST: `DELETE /api/brain/memory/notes/{id}` · scope `kon:brain:delete-note`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `brain_note_delete`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteNote: Operation<DeleteNoteParams, DeleteNoteResponse>;\n /**\n * Export to Open Knowledge Format v0.2\n *\n * The notes you can see (or `noteIds`, comma-separated, at most 200 per call) as an OKF v0.2 bundle: `files[]` with paths and Markdown (YAML frontmatter: type, title, tags, status, generated, verified, sources; claims as footnotes), plus a root index.md with okf_version \"0.2\". A longer list is a 422; a URL over the HTTP server's header limit never reaches the API and gets an empty 431.\n *\n * REST: `GET /api/brain/memory/export/okf` · scope `kon:brain:export-okf`\n * idempotent (safe to retry) · MCP tool `brain_export_okf`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly exportOkf: Operation<ExportOkfParams, ExportOkfResponse>;\n /**\n * Import a graphify graph.json\n *\n * Loads a graph.json produced by graphify into YOUR memory: each node is a note with key `graphify:<namespace>:<node id>` (re-importing updates the same notes), each link a connection keeping graphify's EXTRACTED/INFERRED as `origin` and `confidence_score` as `confidence` (AMBIGUOUS → INFERRED, flagged). Checks `graph.schema_version`: absent = legacy format (warning), 1 = supported, anything else = 422 unless `allowUnknownSchemaVersion`. At most 5000 nodes and 20000 links per call.\n *\n * REST: `POST /api/brain/memory/import/graphify` · scope `kon:brain:import-graphify`\n * idempotent (safe to retry) · MCP tool `brain_import_graphify`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly importGraphify: Operation<ImportGraphifyParams, ImportGraphifyResponse>;\n /**\n * Lint claims (mark stale evidence)\n *\n * Deterministic (no AI): re-checks every claim you can see and stores fresh|stale on the ones you may write. A claim is stale when its source was re-captured with another hash (same uri), was deleted, or its range no longer fits.\n *\n * REST: `POST /api/brain/memory/lint` · scope `kon:brain:lint`\n * idempotent (safe to retry) · MCP tool `brain_lint`\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly lint: Operation<void, LintResponse>;\n /**\n * List claims with evidence\n *\n * Claims (statement + source + the source's SHA-256 + optional range) of the notes you can see. `status=stale` lists the ones whose evidence changed.\n *\n * REST: `GET /api/brain/memory/claims` · scope `kon:brain:list-claims`\n * idempotent (safe to retry) · MCP tool `brain_claims`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listClaims: PageableOperation<ListClaimsParams, ListClaimsResponse, ListClaimsItem>;\n /**\n * List memory notes\n *\n * Notes you can see, most recently updated first. `mine=true` keeps only your own; `keyPrefix` filters by the keys you chose.\n *\n * REST: `GET /api/brain/memory/notes` · scope `kon:brain:list-notes`\n * idempotent (safe to retry) · MCP tool `brain_list`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listNotes: PageableOperation<ListNotesParams, ListNotesResponse, ListNotesItem>;\n /**\n * Connections of a note\n *\n * The connections of a note you can see whose other end you can also see, with provenance: `origin` EXTRACTED (explicit in a source), INFERRED (similarity or a model's guess) or MANUAL (asserted through the API), and `confidence` in [0, 1].\n *\n * REST: `GET /api/brain/memory/notes/{id}/connections` · scope `kon:brain:note-connections`\n * idempotent (safe to retry) · MCP tool `brain_connections`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly noteConnections: Operation<NoteConnectionsParams, NoteConnectionsResponse>;\n /**\n * Read a memory note\n *\n * One note you can see, with its connections (each with `origin` EXTRACTED|INFERRED|MANUAL and `confidence`) and its claims (each with its evidence and fresh|stale status). 404 if it does not exist or is not visible to you.\n *\n * REST: `GET /api/brain/memory/notes/{id}` · scope `kon:brain:read-note`\n * idempotent (safe to retry) · MCP tool `brain_read`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readNote: Operation<ReadNoteParams, ReadNoteResponse>;\n /**\n * Search memory\n *\n * Notes nearest to `q` among those you can see (yours, your agents' if you sign for them, and shared ones). The default embeddings are LEXICAL (a term-frequency hash: shared words, not meaning) and `embedding.mode` says so; only notes embedded with the same provider are compared.\n *\n * REST: `GET /api/brain/memory/search` · scope `kon:brain:search`\n * idempotent (safe to retry) · MCP tool `brain_search`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly search: Operation<SearchParams, SearchResponse>;\n /**\n * Re-verify a claim\n *\n * Re-checks your claim against its source: fresh (and recorded as verified by you, now) or stale with the reason. With `rebind: true` and a newer source for the same uri, the claim moves to it — you assert the statement still holds there.\n *\n * REST: `POST /api/brain/memory/claims/{id}/verify` · scope `kon:brain:verify-claim`\n * idempotent (safe to retry) · MCP tool `brain_claim_verify`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly verifyClaim: Operation<VerifyClaimParams, VerifyClaimResponse>;\n /**\n * Write a memory note (idempotent by key)\n *\n * Creates or updates YOUR note with this `key` (keys are per owner: another agent's `key` is another note). Writing the same content again changes nothing (`outcome: unchanged`). Private by default; `visibility: shared` lets the team and other agents read it (never write it).\n *\n * REST: `PUT /api/brain/memory/notes` · scope `kon:brain:write-note`\n * idempotent (safe to retry) · MCP tool `brain_note_write`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly writeNote: Operation<WriteNoteParams, WriteNoteResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation, RedirectResult } from \"../../api/types\";\n\n/* kon-connections: Accounts at other services (Google, Microsoft, API keys) that kons use without seeing a credential. */\n\n/** Body of `connections.add-api-key`. */\nexport type AddApiKeyBody = {\n provider: string;\n /** `user`: your own account. `organization`: the installation's (admin) */\n scope?: \"user\" | \"organization\";\n /** Stored sealed; never returned */\n apiKey: string;\n label?: string;\n accountId?: string;\n};\n\n/** Arguments of `connections.add-api-key`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AddApiKeyParams = {\n /** JSON body. */\n body: AddApiKeyBody;\n};\n\n/** Success response of `connections.add-api-key`. */\nexport type AddApiKeyResponse = {\n data: Record<string, unknown>;\n};\n\n/** Arguments of `connections.finish-connection`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type FinishConnectionParams = {\n state?: string | number;\n code?: string | number;\n error?: string | number;\n};\n\n/** Success response of `connections.finish-connection`. */\nexport type FinishConnectionResponse = {\n data: Record<string, unknown>;\n} | RedirectResult;\n\n/** Arguments of `connections.get-connection`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetConnectionParams = {\n /** The connection */\n id: string | number;\n};\n\n/** Success response of `connections.get-connection`. */\nexport type GetConnectionResponse = {\n data: Record<string, unknown>;\n};\n\n/** Arguments of `connections.list-connections`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListConnectionsParams = {\n /** Rows per page (1-200). The default is the maximum, what the list always returned. */\n limit?: number;\n /** Rows to skip. */\n offset?: number;\n};\n\n/** Success response of `connections.list-connections`. */\nexport type ListConnectionsResponse = {\n data: Record<string, unknown>[];\n hasMore: boolean;\n};\n\n/** One item of the list `connections.list-connections` pages through. */\nexport type ListConnectionsItem = Record<string, unknown>;\n\n/** Success response of `connections.list-providers`. */\nexport type ListProvidersResponse = {\n data: Record<string, unknown>[];\n};\n\n/** Arguments of `connections.refresh-connection`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RefreshConnectionParams = {\n /** The connection */\n id: string | number;\n};\n\n/** Success response of `connections.refresh-connection`. */\nexport type RefreshConnectionResponse = {\n data: Record<string, unknown>;\n outcome: string;\n};\n\n/** Arguments of `connections.revoke-connection`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RevokeConnectionParams = {\n /** The connection */\n id: string | number;\n};\n\n/** Success response of `connections.revoke-connection`. */\nexport type RevokeConnectionResponse = {\n data: Record<string, unknown>;\n atProvider: boolean;\n};\n\n/** Body of `connections.start-connection`. */\nexport type StartConnectionBody = {\n /** `google` or `microsoft` (GET /providers lists them) */\n provider: string;\n /** `user`: your own account. `organization`: the installation's (admin) */\n scope?: \"user\" | \"organization\";\n /** What to ask for: `mail.read`, `mail.send`, `calendar.read` */\n scopeSets?: string[];\n /** Where to send the person after consenting: one of the site's origins */\n returnTo?: string;\n label?: string;\n};\n\n/** Arguments of `connections.start-connection`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type StartConnectionParams = {\n /** JSON body. */\n body: StartConnectionBody;\n};\n\n/** Success response of `connections.start-connection`. */\nexport type StartConnectionResponse = {\n data: {\n url: string;\n expiresAt: string;\n };\n};\n\n/** Runtime description of every operation of kon-connections (path, method, pagination…). */\nexport const operations = {\n \"addApiKey\": {\"kon\":\"kon-connections\",\"id\":\"add-api-key\",\"operationId\":\"connections.add-api-key\",\"method\":\"POST\",\"path\":\"/connections/api-keys\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:connections:add-api-key\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"finishConnection\": {\"kon\":\"kon-connections\",\"id\":\"finish-connection\",\"operationId\":\"connections.finish-connection\",\"method\":\"GET\",\"path\":\"/connections/oauth/callback\",\"pathParams\":[],\"queryParams\":[\"state\",\"code\",\"error\"],\"body\":null,\"responses\":{\"200\":\"json\",\"302\":\"redirect\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:connections:finish-connection\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getConnection\": {\"kon\":\"kon-connections\",\"id\":\"get-connection\",\"operationId\":\"connections.get-connection\",\"method\":\"GET\",\"path\":\"/connections/connections/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:connections:get-connection\",\"mcpTool\":\"connections__get-connection\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listConnections\": {\"kon\":\"kon-connections\",\"id\":\"list-connections\",\"operationId\":\"connections.list-connections\",\"method\":\"GET\",\"path\":\"/connections/connections\",\"pathParams\":[],\"queryParams\":[\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:connections:list-connections\",\"mcpTool\":\"connections__list-connections\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"data\",\"limit\":\"limit\"}},\n \"listProviders\": {\"kon\":\"kon-connections\",\"id\":\"list-providers\",\"operationId\":\"connections.list-providers\",\"method\":\"GET\",\"path\":\"/connections/providers\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:connections:list-providers\",\"mcpTool\":\"connections__list-providers\",\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"refreshConnection\": {\"kon\":\"kon-connections\",\"id\":\"refresh-connection\",\"operationId\":\"connections.refresh-connection\",\"method\":\"POST\",\"path\":\"/connections/connections/{id}/refresh\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:connections:refresh-connection\",\"mcpTool\":\"connections__refresh-connection\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"revokeConnection\": {\"kon\":\"kon-connections\",\"id\":\"revoke-connection\",\"operationId\":\"connections.revoke-connection\",\"method\":\"POST\",\"path\":\"/connections/connections/{id}/revoke\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:connections:revoke-connection\",\"mcpTool\":\"connections__revoke-connection\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"startConnection\": {\"kon\":\"kon-connections\",\"id\":\"start-connection\",\"operationId\":\"connections.start-connection\",\"method\":\"POST\",\"path\":\"/connections/oauth/start\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:connections:start-connection\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-connections\n *\n * Accounts at other services (Google, Microsoft, API keys) that kons use without seeing a credential.\n */\nexport interface ConnectionsApi {\n /**\n * Connect a provider with an API key\n *\n * Stores an API key for a provider that takes one (registered by a kon: `stripe`, `resend`…), sealed; it is never returned. `scope: organization` (the default) is admin only; `user` is your own. 404 for an unknown provider, 422 for a provider that connects with OAuth or a key that does not look like one, 503 without a secrets key. A person only.\n *\n * REST: `POST /api/connections/api-keys` · scope `kon:connections:add-api-key`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly addApiKey: Operation<AddApiKeyParams, AddApiKeyResponse>;\n /**\n * Where the provider sends the person back\n *\n * The provider's redirect after consent. The `state` authenticates it (one use, ten minutes), and it must come back to the browser that started it (the binding cookie `/oauth/start` sets) or to a session of the same person; otherwise 403 and the round trip is burnt. Exchanges the code, stores the credential sealed, and redirects to `returnTo` with `?connection=<id>`, or answers JSON without one. 400 for an unknown, used or refused consent.\n *\n * REST: `GET /api/connections/oauth/callback` · scope `kon:connections:finish-connection`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly finishConnection: Operation<FinishConnectionParams, FinishConnectionResponse>;\n /**\n * One connection and its status\n *\n * One of your connections (or an organization's, for an admin), without its credential. 404 if it is not yours.\n *\n * REST: `GET /api/connections/connections/{id}` · scope `kon:connections:get-connection`\n * idempotent (safe to retry) · MCP tool `connections__get-connection`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getConnection: Operation<GetConnectionParams, GetConnectionResponse>;\n /**\n * Your connections\n *\n * Your connected accounts, and the organization's if you are an admin: provider, account, granted scopes, status (`active`, `expired`, `revoked`, `error`), expiry and last use. Never a token or a key. Nobody sees another person's connections, an admin included.\n *\n * REST: `GET /api/connections/connections` · scope `kon:connections:list-connections`\n * idempotent (safe to retry) · MCP tool `connections__list-connections`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listConnections: PageableOperation<ListConnectionsParams, ListConnectionsResponse, ListConnectionsItem>;\n /**\n * The providers you can connect\n *\n * Each provider in the catalog: `id`, `name`, how it connects (`oauth`, `api_key`), whether this installation has it `configured`, and the scope sets you can ask for. Never a secret. Signed-in people.\n *\n * REST: `GET /api/connections/providers` · scope `kon:connections:list-providers`\n * idempotent (safe to retry) · MCP tool `connections__list-providers`\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listProviders: Operation<void, ListProvidersResponse>;\n /**\n * Check a connection and refresh its token now\n *\n * Refreshes an OAuth connection's access token now and returns `outcome`: `refreshed`, `expired` (connect it again), `failed` (the provider did not answer; try later) or `not-needed` (an API key). 404 if it is not yours.\n *\n * REST: `POST /api/connections/connections/{id}/refresh` · scope `kon:connections:refresh-connection`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `connections__refresh-connection`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly refreshConnection: Operation<RefreshConnectionParams, RefreshConnectionResponse>;\n /**\n * Disconnect an account\n *\n * Revokes the token at the provider when it allows it, deletes the credential, and keeps the connection as `revoked` for the record. Kons using it stop at once (kon-inbox deletes what it synced from it). Cannot be undone: connect again instead. 404 if it is not yours.\n *\n * REST: `POST /api/connections/connections/{id}/revoke` · scope `kon:connections:revoke-connection`\n * not idempotent (an Idempotency-Key is sent automatically) · sensitive: may come back as a proposal pending human approval · MCP tool `connections__revoke-connection`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly revokeConnection: Operation<RevokeConnectionParams, RevokeConnectionResponse>;\n /**\n * Start connecting an account (OAuth)\n *\n * Returns the provider's consent `url` to send the person to; it is valid for ten minutes and works once (PKCE). `scope: organization` is admin only. `returnTo` must be one of the site's origins (CONNECTIONS_RETURN_ORIGINS or ALLOWED_ORIGINS). 404 for an unknown provider, 422 for an unknown scope set, 503 when the provider is not configured here or this Kitsuden has no secrets key. A person only.\n *\n * REST: `POST /api/connections/oauth/start` · scope `kon:connections:start-connection`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly startConnection: Operation<StartConnectionParams, StartConnectionResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-datasets: Dynamic data collections with automatic REST API */\n\n/** Body of `datasets.apply-indexes`. */\nexport type ApplyIndexesBody = {\n config?: {\n indexes?: {\n name?: string;\n type?: \"btree\" | \"gin\" | \"gist\" | \"hash\" | \"brin\";\n fields: string[];\n where?: string;\n unique?: boolean;\n desc?: boolean;\n }[];\n autoDetect?: boolean;\n threshold?: number;\n excludeFields?: string[];\n };\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.apply-indexes`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ApplyIndexesParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: ApplyIndexesBody;\n};\n\n/** Success response of `datasets.apply-indexes`. */\nexport type ApplyIndexesResponse = Record<string, unknown>;\n\n/** Body of `datasets.auto-indexes`. */\nexport type AutoIndexesBody = {\n minConfidence?: \"high\" | \"medium\";\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.auto-indexes`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AutoIndexesParams = {\n /** JSON body. */\n body?: AutoIndexesBody;\n};\n\n/** Success response of `datasets.auto-indexes`. */\nexport type AutoIndexesResponse = Record<string, unknown>;\n\n/** Body of `datasets.compare-entries`. */\nexport type CompareEntriesBody = {\n /** 2-8 entry uuids */\n entryIds?: string[];\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.compare-entries`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CompareEntriesParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: CompareEntriesBody;\n};\n\n/** Success response of `datasets.compare-entries`. */\nexport type CompareEntriesResponse = {\n data: {\n id: string;\n title: string;\n }[];\n differences: unknown;\n};\n\n/** Body of `datasets.compare-snapshots`. */\nexport type CompareSnapshotsBody = {\n snapshot1?: unknown;\n snapshot2?: unknown;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.compare-snapshots`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CompareSnapshotsParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n /** JSON body. */\n body?: CompareSnapshotsBody;\n};\n\n/** Success response of `datasets.compare-snapshots`. */\nexport type CompareSnapshotsResponse = {\n comparison: unknown;\n};\n\n/** Body of `datasets.create-calculated-field`. */\nexport type CreateCalculatedFieldBody = {\n name?: string;\n label?: string;\n type?: \"formula\" | \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\" | \"concat\" | \"date_diff\" | \"date_add\" | \"conditional\" | \"lookup\" | \"rollup\";\n config?: {\n expression?: string;\n sourceTable?: string;\n sourceField?: string;\n filter?: {\n field: string;\n operator: \"eq\" | \"neq\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"in\" | \"contains\" | \"empty\" | \"not_empty\";\n value?: unknown;\n };\n fields?: string[];\n separator?: string;\n startField?: string;\n endField?: string;\n dateField?: string;\n value?: number;\n unit?: \"days\" | \"hours\" | \"minutes\" | \"seconds\" | \"months\" | \"years\";\n condition?: {\n field: string;\n operator: \"eq\" | \"neq\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"contains\" | \"empty\" | \"not_empty\" | \"in\";\n value?: unknown;\n };\n trueValue?: unknown;\n falseValue?: unknown;\n targetTable?: string;\n targetField?: string;\n matchField?: string;\n returnField?: string;\n relationField?: string;\n };\n format?: {\n type: \"text\" | \"number\" | \"currency\" | \"percentage\" | \"date\" | \"datetime\" | \"duration\" | \"badge\" | \"boolean\";\n currency?: string;\n decimals?: number;\n prefix?: string;\n suffix?: string;\n color?: string;\n };\n description?: string;\n category?: string;\n isKpi?: boolean;\n target?: number;\n warningThreshold?: number;\n dependsOn?: string[];\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.create-calculated-field`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateCalculatedFieldParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: CreateCalculatedFieldBody;\n};\n\n/** Success response of `datasets.create-calculated-field`. */\nexport type CreateCalculatedFieldResponse = {\n success: true;\n field: {\n id: string;\n name: string;\n label: string;\n type: string;\n [key: string]: unknown;\n };\n};\n\n/** Body of `datasets.create-dataset`. */\nexport type CreateDatasetBody = {\n /** Required when creating, max 200 chars */\n name?: string;\n /** a-z, 0-9 and dashes; derived from the name when missing */\n slug?: string;\n description?: string | null;\n icon?: string | null;\n /** Field definitions */\n schema?: Record<string, unknown>[];\n /** Alias of `schema` (what the panel sends) */\n fields?: Record<string, unknown>[];\n displayConfig?: unknown;\n /** Who reads and writes (admin only) */\n policyJson?: Record<string, unknown>;\n workflowJson?: unknown;\n contentConfig?: unknown;\n sourceName?: string | null;\n sourceUrl?: string | null;\n sourceLicense?: string | null;\n sourceVersion?: string | null;\n sourceCaveats?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.create-dataset`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateDatasetParams = {\n /** JSON body. */\n body?: CreateDatasetBody;\n};\n\n/** Success response of `datasets.create-dataset`. */\nexport type CreateDatasetResponse = {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n icon: string | null;\n /** Field definitions (array, or legacy {fields}) */\n schema: unknown;\n policyJson: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Body of `datasets.create-entry`. */\nexport type CreateEntryBody = {\n title?: string;\n /** The entry fields, as defined by the dataset schema */\n data?: Record<string, unknown>;\n /** staff only */\n status?: string;\n /** staff only */\n sortOrder?: number;\n /** staff only, media uuid */\n thumbnailId?: string | null;\n /** staff only */\n ownerId?: string | null;\n [key: string]: unknown;\n} | ({\n title?: string;\n /** The entry fields, as defined by the dataset schema */\n data?: Record<string, unknown>;\n /** staff only */\n status?: string;\n /** staff only */\n sortOrder?: number;\n /** staff only, media uuid */\n thumbnailId?: string | null;\n /** staff only */\n ownerId?: string | null;\n [key: string]: unknown;\n}[]);\n\n/** Arguments of `datasets.create-entry`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateEntryParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: CreateEntryBody;\n};\n\n/** Success response of `datasets.create-entry`. */\nexport type CreateEntryResponse = ({\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n} | ({\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n}[]));\n\n/** Body of `datasets.create-snapshot`. */\nexport type CreateSnapshotBody = {\n reason?: string;\n calculatedValues?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.create-snapshot`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateSnapshotParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n /** JSON body. */\n body?: CreateSnapshotBody;\n};\n\n/** Success response of `datasets.create-snapshot`. */\nexport type CreateSnapshotResponse = Record<string, unknown>;\n\n/** Arguments of `datasets.delete-calculated-field`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteCalculatedFieldParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Calculated field id (uuid) */\n fieldId: string | number;\n};\n\n/** Success response of `datasets.delete-calculated-field`. */\nexport type DeleteCalculatedFieldResponse = {\n success: true;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.delete-dataset`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteDatasetParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `datasets.delete-dataset`. */\nexport type DeleteDatasetResponse = {\n success: true;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.delete-entry`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteEntryParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n};\n\n/** Success response of `datasets.delete-entry`. */\nexport type DeleteEntryResponse = {\n success: true;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.entry-history`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type EntryHistoryParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n /** 1-200, default 50 */\n limit?: string | number;\n /** Entries to skip, default 0 */\n offset?: string | number;\n};\n\n/** Success response of `datasets.entry-history`. */\nexport type EntryHistoryResponse = {\n history: {\n id: string;\n action: \"create\" | \"update\" | \"delete\";\n /** ISO timestamp */\n at: string;\n actor: {\n type: \"user\" | \"agent\" | \"system\";\n id: string | null;\n name: string | null;\n };\n changes: {\n /** `title`, `status`… or `data.<key>` */\n field: string;\n before?: unknown;\n after?: unknown;\n /** A secret field: values are not kept */\n redacted?: true;\n }[];\n /** Some value or the list was cut to its size limit */\n truncated: boolean;\n /** The approved proposal this write executed */\n proposalId: string | null;\n approvedBy: string | null;\n }[];\n total: number;\n limit: number;\n offset: number;\n};\n\n/** One item of the list `datasets.entry-history` pages through. */\nexport type EntryHistoryItem = {\n id: string;\n action: \"create\" | \"update\" | \"delete\";\n /** ISO timestamp */\n at: string;\n actor: {\n type: \"user\" | \"agent\" | \"system\";\n id: string | null;\n name: string | null;\n };\n changes: {\n /** `title`, `status`… or `data.<key>` */\n field: string;\n before?: unknown;\n after?: unknown;\n /** A secret field: values are not kept */\n redacted?: true;\n }[];\n /** Some value or the list was cut to its size limit */\n truncated: boolean;\n /** The approved proposal this write executed */\n proposalId: string | null;\n approvedBy: string | null;\n};\n\n/** Body of `datasets.export-datasets`. */\nexport type ExportDatasetsBody = {\n datasets: string[];\n includeSchema?: boolean;\n includeCalculatedFields?: boolean;\n includeMetadata?: boolean;\n format?: \"json\" | \"csv\" | \"jsonl\";\n filter?: {\n status?: string;\n dateFrom?: string;\n dateTo?: string;\n };\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.export-datasets`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ExportDatasetsParams = {\n /** JSON body. */\n body: ExportDatasetsBody;\n};\n\n/** Success response of `datasets.export-datasets`. */\nexport type ExportDatasetsResponse = Record<string, unknown>;\n\n/** Arguments of `datasets.get-calculated-field`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetCalculatedFieldParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Calculated field id (uuid) */\n fieldId: string | number;\n};\n\n/** Success response of `datasets.get-calculated-field`. */\nexport type GetCalculatedFieldResponse = {\n success: true;\n field: {\n id: string;\n name: string;\n label: string;\n type: string;\n [key: string]: unknown;\n };\n};\n\n/** Arguments of `datasets.get-dataset`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetDatasetParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `datasets.get-dataset`. */\nexport type GetDatasetResponse = {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n icon: string | null;\n /** Field definitions (array, or legacy {fields}) */\n schema: unknown;\n policyJson: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.get-dataset-by-slug`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetDatasetBySlugParams = {\n /** Path parameter. */\n slug: string | number;\n};\n\n/** Success response of `datasets.get-dataset-by-slug`. */\nexport type GetDatasetBySlugResponse = {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n icon: string | null;\n /** Field definitions (array, or legacy {fields}) */\n schema: unknown;\n policyJson: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.get-entry`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetEntryParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n includeThumbnailUrl?: \"true\" | \"false\";\n};\n\n/** Success response of `datasets.get-entry`. */\nexport type GetEntryResponse = {\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Body of `datasets.import-package`. */\nexport type ImportPackageBody = {\n /** An export package (with `datasets`) */\n package?: Record<string, unknown>;\n config?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.import-package`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ImportPackageParams = {\n /** JSON body. */\n body?: ImportPackageBody;\n};\n\n/** Success response of `datasets.import-package`. */\nexport type ImportPackageResponse = Record<string, unknown>;\n\n/** Body of `datasets.import-to-dataset`. */\nexport type ImportToDatasetBody = {\n datasetId: string;\n data: Record<string, unknown>[];\n config?: {\n strategy?: \"upsert\" | \"replace\" | \"merge\" | \"insert\";\n mapping?: Record<string, string>;\n idField?: string;\n validate?: boolean;\n skipInvalid?: boolean;\n };\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.import-to-dataset`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ImportToDatasetParams = {\n /** JSON body. */\n body: ImportToDatasetBody;\n};\n\n/** Success response of `datasets.import-to-dataset`. */\nexport type ImportToDatasetResponse = Record<string, unknown>;\n\n/** Success response of `datasets.index-report`. */\nexport type IndexReportResponse = Record<string, unknown>;\n\n/** Success response of `datasets.index-stats`. */\nexport type IndexStatsResponse = {\n stats: unknown;\n};\n\n/** Arguments of `datasets.list-calculated-fields`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListCalculatedFieldsParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `datasets.list-calculated-fields`. */\nexport type ListCalculatedFieldsResponse = {\n success: true;\n fields: {\n id: string;\n name: string;\n label: string;\n type: string;\n [key: string]: unknown;\n }[];\n};\n\n/** Arguments of `datasets.list-datasets`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListDatasetsParams = {\n /** 1-200, default 50 */\n limit?: string | number;\n /** Datasets to skip, default 0 */\n offset?: string | number;\n};\n\n/** Success response of `datasets.list-datasets`. */\nexport type ListDatasetsResponse = {\n docs: {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n icon: string | null;\n /** Field definitions (array, or legacy {fields}) */\n schema: unknown;\n policyJson: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n }[];\n totalDocs: number;\n hasMore: boolean;\n};\n\n/** One item of the list `datasets.list-datasets` pages through. */\nexport type ListDatasetsItem = {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n icon: string | null;\n /** Field definitions (array, or legacy {fields}) */\n schema: unknown;\n policyJson: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.list-entries`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListEntriesParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** 1-1000, default 500 */\n limit?: string | number;\n /** Entries to skip, default 0 */\n offset?: string | number;\n status?: string | number;\n includeCalculated?: \"true\" | \"false\";\n /** Comma-separated calculated field names */\n calculatedFields?: string | number;\n includeThumbnailUrl?: \"true\" | \"false\";\n};\n\n/** Success response of `datasets.list-entries`. */\nexport type ListEntriesResponse = {\n docs: {\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n _calculated?: Record<string, unknown>;\n [key: string]: unknown;\n }[];\n totalDocs: number;\n hasMore: boolean;\n calculatedFields?: Record<string, unknown>[];\n dataset: {\n id: string;\n name: string;\n slug: string;\n };\n};\n\n/** One item of the list `datasets.list-entries` pages through. */\nexport type ListEntriesItem = {\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n _calculated?: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.read-snapshot`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadSnapshotParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n};\n\n/** Success response of `datasets.read-snapshot`. */\nexport type ReadSnapshotResponse = Record<string, unknown>;\n\n/** Body of `datasets.restore-snapshot`. */\nexport type RestoreSnapshotBody = {\n /** Snapshot timestamp to restore */\n timestamp?: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.restore-snapshot`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RestoreSnapshotParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n /** JSON body. */\n body?: RestoreSnapshotBody;\n};\n\n/** Success response of `datasets.restore-snapshot`. */\nexport type RestoreSnapshotResponse = {\n success: true;\n restored: true;\n};\n\n/** Arguments of `datasets.search-entries`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SearchEntriesParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** Full-text query */\n q?: string | number;\n /** field:value, field:min..max; comma-separated (max 20) */\n filters?: string | number;\n /** Comma-separated fields to count (max 8) */\n facets?: string | number;\n status?: string | number;\n limit?: string | number;\n offset?: string | number;\n};\n\n/** Success response of `datasets.search-entries`. */\nexport type SearchEntriesResponse = {\n data: {\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n }[];\n total: number;\n facets: {\n field: string;\n values: {\n value: string;\n count: number;\n }[];\n }[];\n provenance: Record<string, unknown> | null;\n [key: string]: unknown;\n};\n\n/** One item of the list `datasets.search-entries` pages through. */\nexport type SearchEntriesItem = {\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.snapshot-history`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SnapshotHistoryParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n};\n\n/** Success response of `datasets.snapshot-history`. */\nexport type SnapshotHistoryResponse = {\n snapshots: Record<string, unknown>[];\n total: number;\n};\n\n/** Arguments of `datasets.suggest-indexes`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SuggestIndexesParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `datasets.suggest-indexes`. */\nexport type SuggestIndexesResponse = {\n suggestions: Record<string, unknown>[];\n};\n\n/** Body of `datasets.update-calculated-field`. */\nexport type UpdateCalculatedFieldBody = {\n name?: string;\n label?: string;\n type?: \"formula\" | \"count\" | \"sum\" | \"avg\" | \"min\" | \"max\" | \"concat\" | \"date_diff\" | \"date_add\" | \"conditional\" | \"lookup\" | \"rollup\";\n config?: {\n expression?: string;\n sourceTable?: string;\n sourceField?: string;\n filter?: {\n field: string;\n operator: \"eq\" | \"neq\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"in\" | \"contains\" | \"empty\" | \"not_empty\";\n value?: unknown;\n };\n fields?: string[];\n separator?: string;\n startField?: string;\n endField?: string;\n dateField?: string;\n value?: number;\n unit?: \"days\" | \"hours\" | \"minutes\" | \"seconds\" | \"months\" | \"years\";\n condition?: {\n field: string;\n operator: \"eq\" | \"neq\" | \"gt\" | \"gte\" | \"lt\" | \"lte\" | \"contains\" | \"empty\" | \"not_empty\" | \"in\";\n value?: unknown;\n };\n trueValue?: unknown;\n falseValue?: unknown;\n targetTable?: string;\n targetField?: string;\n matchField?: string;\n returnField?: string;\n relationField?: string;\n };\n format?: {\n type: \"text\" | \"number\" | \"currency\" | \"percentage\" | \"date\" | \"datetime\" | \"duration\" | \"badge\" | \"boolean\";\n currency?: string;\n decimals?: number;\n prefix?: string;\n suffix?: string;\n color?: string;\n };\n description?: string;\n category?: string;\n isKpi?: boolean;\n target?: number;\n warningThreshold?: number;\n dependsOn?: string[];\n isActive?: boolean;\n sortOrder?: number;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.update-calculated-field`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateCalculatedFieldParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Calculated field id (uuid) */\n fieldId: string | number;\n /** JSON body. */\n body?: UpdateCalculatedFieldBody;\n};\n\n/** Success response of `datasets.update-calculated-field`. */\nexport type UpdateCalculatedFieldResponse = {\n success: true;\n field: {\n id: string;\n name: string;\n label: string;\n type: string;\n [key: string]: unknown;\n };\n};\n\n/** Body of `datasets.update-dataset`. */\nexport type UpdateDatasetBody = {\n /** Required when creating, max 200 chars */\n name?: string;\n /** a-z, 0-9 and dashes; derived from the name when missing */\n slug?: string;\n description?: string | null;\n icon?: string | null;\n /** Field definitions */\n schema?: Record<string, unknown>[];\n /** Alias of `schema` (what the panel sends) */\n fields?: Record<string, unknown>[];\n displayConfig?: unknown;\n /** Who reads and writes (admin only) */\n policyJson?: Record<string, unknown>;\n workflowJson?: unknown;\n contentConfig?: unknown;\n sourceName?: string | null;\n sourceUrl?: string | null;\n sourceLicense?: string | null;\n sourceVersion?: string | null;\n sourceCaveats?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.update-dataset`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateDatasetParams = {\n /** Dataset id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: UpdateDatasetBody;\n};\n\n/** Success response of `datasets.update-dataset`. */\nexport type UpdateDatasetResponse = {\n id: string;\n name: string;\n slug: string;\n description: string | null;\n icon: string | null;\n /** Field definitions (array, or legacy {fields}) */\n schema: unknown;\n policyJson: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Body of `datasets.update-entry`. */\nexport type UpdateEntryBody = {\n title?: string;\n /** The entry fields, as defined by the dataset schema */\n data?: Record<string, unknown>;\n /** staff only */\n status?: string;\n /** staff only */\n sortOrder?: number;\n /** staff only, media uuid */\n thumbnailId?: string | null;\n /** staff only */\n ownerId?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `datasets.update-entry`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateEntryParams = {\n /** Dataset id (uuid) */\n id: string | number;\n /** Entry id (uuid) */\n entryId: string | number;\n /** JSON body. */\n body?: UpdateEntryBody;\n};\n\n/** Success response of `datasets.update-entry`. */\nexport type UpdateEntryResponse = {\n id: string;\n dataSetId: string;\n title: string;\n data: Record<string, unknown>;\n status: string;\n sortOrder: number;\n ownerId: string | null;\n thumbnailUrl?: string;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Runtime description of every operation of kon-datasets (path, method, pagination…). */\nexport const operations = {\n \"applyIndexes\": {\"kon\":\"kon-datasets\",\"id\":\"apply-indexes\",\"operationId\":\"datasets.apply-indexes\",\"method\":\"POST\",\"path\":\"/datasets/{id}/indexes/apply\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:apply-indexes\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"autoIndexes\": {\"kon\":\"kon-datasets\",\"id\":\"auto-indexes\",\"operationId\":\"datasets.auto-indexes\",\"method\":\"POST\",\"path\":\"/datasets/indexes/auto\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:auto-indexes\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"compareEntries\": {\"kon\":\"kon-datasets\",\"id\":\"compare-entries\",\"operationId\":\"datasets.compare-entries\",\"method\":\"POST\",\"path\":\"/datasets/{id}/compare\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:compare-entries\",\"mcpTool\":\"datasets__compare-entries\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"compareSnapshots\": {\"kon\":\"kon-datasets\",\"id\":\"compare-snapshots\",\"operationId\":\"datasets.compare-snapshots\",\"method\":\"POST\",\"path\":\"/datasets/{id}/entries/{entryId}/compare\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:compare-snapshots\",\"mcpTool\":\"datasets__compare-snapshots\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createCalculatedField\": {\"kon\":\"kon-datasets\",\"id\":\"create-calculated-field\",\"operationId\":\"datasets.create-calculated-field\",\"method\":\"POST\",\"path\":\"/datasets/{id}/calculated-fields\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:create-calculated-field\",\"mcpTool\":\"datasets__create-calculated-field\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createDataset\": {\"kon\":\"kon-datasets\",\"id\":\"create-dataset\",\"operationId\":\"datasets.create-dataset\",\"method\":\"POST\",\"path\":\"/datasets\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:create-dataset\",\"mcpTool\":\"datasets__create-dataset\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createEntry\": {\"kon\":\"kon-datasets\",\"id\":\"create-entry\",\"operationId\":\"datasets.create-entry\",\"method\":\"POST\",\"path\":\"/datasets/{id}/entries\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:create-entry\",\"mcpTool\":\"datasets__create-entry\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createSnapshot\": {\"kon\":\"kon-datasets\",\"id\":\"create-snapshot\",\"operationId\":\"datasets.create-snapshot\",\"method\":\"POST\",\"path\":\"/datasets/{id}/entries/{entryId}/snapshots\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:create-snapshot\",\"mcpTool\":\"datasets__create-snapshot\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteCalculatedField\": {\"kon\":\"kon-datasets\",\"id\":\"delete-calculated-field\",\"operationId\":\"datasets.delete-calculated-field\",\"method\":\"DELETE\",\"path\":\"/datasets/{id}/calculated-fields/{fieldId}\",\"pathParams\":[\"id\",\"fieldId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:delete-calculated-field\",\"mcpTool\":\"datasets__delete-calculated-field\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteDataset\": {\"kon\":\"kon-datasets\",\"id\":\"delete-dataset\",\"operationId\":\"datasets.delete-dataset\",\"method\":\"DELETE\",\"path\":\"/datasets/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:delete-dataset\",\"mcpTool\":\"datasets__delete-dataset\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteEntry\": {\"kon\":\"kon-datasets\",\"id\":\"delete-entry\",\"operationId\":\"datasets.delete-entry\",\"method\":\"DELETE\",\"path\":\"/datasets/{id}/entries/{entryId}\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:delete-entry\",\"mcpTool\":\"datasets__delete-entry\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"entryHistory\": {\"kon\":\"kon-datasets\",\"id\":\"entry-history\",\"operationId\":\"datasets.entry-history\",\"method\":\"GET\",\"path\":\"/datasets/{id}/entries/{entryId}/history\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:entry-history\",\"mcpTool\":\"datasets__entry-history\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"history\",\"limit\":\"limit\"}},\n \"exportDatasets\": {\"kon\":\"kon-datasets\",\"id\":\"export-datasets\",\"operationId\":\"datasets.export-datasets\",\"method\":\"POST\",\"path\":\"/datasets/export\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:export-datasets\",\"mcpTool\":\"datasets__export-datasets\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getCalculatedField\": {\"kon\":\"kon-datasets\",\"id\":\"get-calculated-field\",\"operationId\":\"datasets.get-calculated-field\",\"method\":\"GET\",\"path\":\"/datasets/{id}/calculated-fields/{fieldId}\",\"pathParams\":[\"id\",\"fieldId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:get-calculated-field\",\"mcpTool\":\"datasets__get-calculated-field\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getDataset\": {\"kon\":\"kon-datasets\",\"id\":\"get-dataset\",\"operationId\":\"datasets.get-dataset\",\"method\":\"GET\",\"path\":\"/datasets/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:get-dataset\",\"mcpTool\":\"datasets__get-dataset\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getDatasetBySlug\": {\"kon\":\"kon-datasets\",\"id\":\"get-dataset-by-slug\",\"operationId\":\"datasets.get-dataset-by-slug\",\"method\":\"GET\",\"path\":\"/datasets/slug/{slug}\",\"pathParams\":[\"slug\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:get-dataset-by-slug\",\"mcpTool\":\"datasets__get-dataset-by-slug\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getEntry\": {\"kon\":\"kon-datasets\",\"id\":\"get-entry\",\"operationId\":\"datasets.get-entry\",\"method\":\"GET\",\"path\":\"/datasets/{id}/entries/{entryId}\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[\"includeThumbnailUrl\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:get-entry\",\"mcpTool\":\"datasets__get-entry\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"importPackage\": {\"kon\":\"kon-datasets\",\"id\":\"import-package\",\"operationId\":\"datasets.import-package\",\"method\":\"POST\",\"path\":\"/datasets/import/package\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:import-package\",\"mcpTool\":\"datasets__import-package\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"importToDataset\": {\"kon\":\"kon-datasets\",\"id\":\"import-to-dataset\",\"operationId\":\"datasets.import-to-dataset\",\"method\":\"POST\",\"path\":\"/datasets/import\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:import-to-dataset\",\"mcpTool\":\"datasets__import-to-dataset\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"indexReport\": {\"kon\":\"kon-datasets\",\"id\":\"index-report\",\"operationId\":\"datasets.index-report\",\"method\":\"POST\",\"path\":\"/datasets/indexes/report\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:index-report\",\"mcpTool\":\"datasets__index-report\",\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"indexStats\": {\"kon\":\"kon-datasets\",\"id\":\"index-stats\",\"operationId\":\"datasets.index-stats\",\"method\":\"GET\",\"path\":\"/datasets/indexes/stats\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:index-stats\",\"mcpTool\":\"datasets__index-stats\",\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listCalculatedFields\": {\"kon\":\"kon-datasets\",\"id\":\"list-calculated-fields\",\"operationId\":\"datasets.list-calculated-fields\",\"method\":\"GET\",\"path\":\"/datasets/{id}/calculated-fields\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:list-calculated-fields\",\"mcpTool\":\"datasets__list-calculated-fields\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listDatasets\": {\"kon\":\"kon-datasets\",\"id\":\"list-datasets\",\"operationId\":\"datasets.list-datasets\",\"method\":\"GET\",\"path\":\"/datasets\",\"pathParams\":[],\"queryParams\":[\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:list-datasets\",\"mcpTool\":\"datasets__list-datasets\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"docs\",\"limit\":\"limit\"}},\n \"listEntries\": {\"kon\":\"kon-datasets\",\"id\":\"list-entries\",\"operationId\":\"datasets.list-entries\",\"method\":\"GET\",\"path\":\"/datasets/{id}/entries\",\"pathParams\":[\"id\"],\"queryParams\":[\"limit\",\"offset\",\"status\",\"includeCalculated\",\"calculatedFields\",\"includeThumbnailUrl\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:list-entries\",\"mcpTool\":\"datasets__list-entries\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"docs\",\"limit\":\"limit\"}},\n \"readSnapshot\": {\"kon\":\"kon-datasets\",\"id\":\"read-snapshot\",\"operationId\":\"datasets.read-snapshot\",\"method\":\"GET\",\"path\":\"/datasets/{id}/entries/{entryId}/snapshot\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:read-snapshot\",\"mcpTool\":\"datasets__read-snapshot\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"restoreSnapshot\": {\"kon\":\"kon-datasets\",\"id\":\"restore-snapshot\",\"operationId\":\"datasets.restore-snapshot\",\"method\":\"POST\",\"path\":\"/datasets/{id}/entries/{entryId}/restore\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:datasets:restore-snapshot\",\"mcpTool\":\"datasets__restore-snapshot\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"searchEntries\": {\"kon\":\"kon-datasets\",\"id\":\"search-entries\",\"operationId\":\"datasets.search-entries\",\"method\":\"GET\",\"path\":\"/datasets/{id}/search\",\"pathParams\":[\"id\"],\"queryParams\":[\"q\",\"filters\",\"facets\",\"status\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:search-entries\",\"mcpTool\":\"datasets__search-entries\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"data\",\"limit\":\"limit\"}},\n \"snapshotHistory\": {\"kon\":\"kon-datasets\",\"id\":\"snapshot-history\",\"operationId\":\"datasets.snapshot-history\",\"method\":\"GET\",\"path\":\"/datasets/{id}/entries/{entryId}/snapshots\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:snapshot-history\",\"mcpTool\":\"datasets__snapshot-history\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"suggestIndexes\": {\"kon\":\"kon-datasets\",\"id\":\"suggest-indexes\",\"operationId\":\"datasets.suggest-indexes\",\"method\":\"GET\",\"path\":\"/datasets/{id}/indexes/suggest\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:datasets:suggest-indexes\",\"mcpTool\":\"datasets__suggest-indexes\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateCalculatedField\": {\"kon\":\"kon-datasets\",\"id\":\"update-calculated-field\",\"operationId\":\"datasets.update-calculated-field\",\"method\":\"PATCH\",\"path\":\"/datasets/{id}/calculated-fields/{fieldId}\",\"pathParams\":[\"id\",\"fieldId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:update-calculated-field\",\"mcpTool\":\"datasets__update-calculated-field\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateDataset\": {\"kon\":\"kon-datasets\",\"id\":\"update-dataset\",\"operationId\":\"datasets.update-dataset\",\"method\":\"PATCH\",\"path\":\"/datasets/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:update-dataset\",\"mcpTool\":\"datasets__update-dataset\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateEntry\": {\"kon\":\"kon-datasets\",\"id\":\"update-entry\",\"operationId\":\"datasets.update-entry\",\"method\":\"PATCH\",\"path\":\"/datasets/{id}/entries/{entryId}\",\"pathParams\":[\"id\",\"entryId\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:datasets:update-entry\",\"mcpTool\":\"datasets__update-entry\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-datasets\n *\n * Dynamic data collections with automatic REST API\n */\nexport interface DatasetsApi {\n /**\n * Apply an index configuration\n *\n * Creates the configured indexes for a dataset (DDL on the database). Admin only.\n *\n * REST: `POST /api/datasets/{id}/indexes/apply` · scope `kon:datasets:apply-indexes`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly applyIndexes: Operation<ApplyIndexesParams, ApplyIndexesResponse>;\n /**\n * Apply suggested indexes automatically\n *\n * Creates every suggested index above a confidence level across all datasets (DDL). Admin only.\n *\n * REST: `POST /api/datasets/indexes/auto` · scope `kon:datasets:auto-indexes`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly autoIndexes: Operation<AutoIndexesParams, AutoIndexesResponse>;\n /**\n * Compare entries of a dataset\n *\n * Field-by-field comparison of 2-8 different entries (how do these three swords differ). Read-only.\n *\n * REST: `POST /api/datasets/{id}/compare` · scope `kon:datasets:compare-entries`\n * idempotent (safe to retry) · MCP tool `datasets__compare-entries`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly compareEntries: Operation<CompareEntriesParams, CompareEntriesResponse>;\n /**\n * Compare two snapshots\n *\n * Field-by-field difference between two snapshot objects sent in the body. Pure computation: reads nothing.\n *\n * REST: `POST /api/datasets/{id}/entries/{entryId}/compare` · scope `kon:datasets:compare-snapshots`\n * idempotent (safe to retry) · MCP tool `datasets__compare-snapshots`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly compareSnapshots: Operation<CompareSnapshotsParams, CompareSnapshotsResponse>;\n /**\n * Create a calculated field\n *\n * Adds a calculated field. Formulas are parsed by Kitsuden's own interpreter, never executed as code. Staff only.\n *\n * REST: `POST /api/datasets/{id}/calculated-fields` · scope `kon:datasets:create-calculated-field`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__create-calculated-field`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createCalculatedField: Operation<CreateCalculatedFieldParams, CreateCalculatedFieldResponse>;\n /**\n * Create a dataset\n *\n * Creates a dataset (a typed collection) with its field schema. New datasets are admin-only to read and write unless an admin sets policyJson.\n *\n * REST: `POST /api/datasets` · scope `kon:datasets:create-dataset`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__create-dataset`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createDataset: Operation<CreateDatasetParams, CreateDatasetResponse>;\n /**\n * Create entries\n *\n * Creates one entry, or up to 1000 when the body is an array. The owner is the caller (staff can set ownerId); status, order and owner are staff-only fields.\n *\n * REST: `POST /api/datasets/{id}/entries` · scope `kon:datasets:create-entry`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__create-entry`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createEntry: Operation<CreateEntryParams, CreateEntryResponse>;\n /**\n * Take a manual snapshot of an entry\n *\n * Stores the current state of an entry (with optional reason and calculated values). Staff only.\n *\n * REST: `POST /api/datasets/{id}/entries/{entryId}/snapshots` · scope `kon:datasets:create-snapshot`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__create-snapshot`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createSnapshot: Operation<CreateSnapshotParams, CreateSnapshotResponse>;\n /**\n * Delete a calculated field\n *\n * Removes a calculated field from a dataset. Staff only.\n *\n * REST: `DELETE /api/datasets/{id}/calculated-fields/{fieldId}` · scope `kon:datasets:delete-calculated-field`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `datasets__delete-calculated-field`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteCalculatedField: Operation<DeleteCalculatedFieldParams, DeleteCalculatedFieldResponse>;\n /**\n * Delete a dataset\n *\n * Deletes a dataset and all its entries. Admin only; cannot be undone.\n *\n * REST: `DELETE /api/datasets/{id}` · scope `kon:datasets:delete-dataset`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `datasets__delete-dataset`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteDataset: Operation<DeleteDatasetParams, DeleteDatasetResponse>;\n /**\n * Delete an entry\n *\n * Deletes one entry of this dataset. Outside the staff, only the owner can, where the policy allows writing.\n *\n * REST: `DELETE /api/datasets/{id}/entries/{entryId}` · scope `kon:datasets:delete-entry`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `datasets__delete-entry`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteEntry: Operation<DeleteEntryParams, DeleteEntryResponse>;\n /**\n * Change history of an entry\n *\n * Who created, changed or deleted an entry, newest first: the actor (a person or an agent), the action (create, update, delete) and the fields that changed, with their value before and after. A field named like a secret (token, password, hash) is listed as `redacted` without values, and long values are cut to a preview. Same visibility as reading the entry (otherwise 404). Changes made before this history existed are not listed.\n *\n * REST: `GET /api/datasets/{id}/entries/{entryId}/history` · scope `kon:datasets:entry-history`\n * idempotent (safe to retry) · MCP tool `datasets__entry-history`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly entryHistory: PageableOperation<EntryHistoryParams, EntryHistoryResponse, EntryHistoryItem>;\n /**\n * Export datasets\n *\n * Exports whole datasets (schema, entries, optionally calculated fields) ignoring their read policy: staff only.\n *\n * REST: `POST /api/datasets/export` · scope `kon:datasets:export-datasets`\n * idempotent (safe to retry) · MCP tool `datasets__export-datasets`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly exportDatasets: Operation<ExportDatasetsParams, ExportDatasetsResponse>;\n /**\n * Get a calculated field\n *\n * One calculated field of a dataset this caller can read.\n *\n * REST: `GET /api/datasets/{id}/calculated-fields/{fieldId}` · scope `kon:datasets:get-calculated-field`\n * idempotent (safe to retry) · MCP tool `datasets__get-calculated-field`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getCalculatedField: Operation<GetCalculatedFieldParams, GetCalculatedFieldResponse>;\n /**\n * Get a dataset\n *\n * One dataset by uuid, if this caller can read it (otherwise 404: existence is not confirmed).\n *\n * REST: `GET /api/datasets/{id}` · scope `kon:datasets:get-dataset`\n * idempotent (safe to retry) · MCP tool `datasets__get-dataset`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getDataset: Operation<GetDatasetParams, GetDatasetResponse>;\n /**\n * Get a dataset by slug\n *\n * One dataset by slug, if this caller can read it (otherwise 404).\n *\n * REST: `GET /api/datasets/slug/{slug}` · scope `kon:datasets:get-dataset-by-slug`\n * idempotent (safe to retry) · MCP tool `datasets__get-dataset-by-slug`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getDatasetBySlug: Operation<GetDatasetBySlugParams, GetDatasetBySlugResponse>;\n /**\n * Get an entry\n *\n * One entry of THIS dataset, if the dataset and its row rules let this caller see it (otherwise 404).\n *\n * REST: `GET /api/datasets/{id}/entries/{entryId}` · scope `kon:datasets:get-entry`\n * idempotent (safe to retry) · MCP tool `datasets__get-entry`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getEntry: Operation<GetEntryParams, GetEntryResponse>;\n /**\n * Import an export package\n *\n * Imports a full package produced by the export (datasets and their entries). Admin only.\n *\n * REST: `POST /api/datasets/import/package` · scope `kon:datasets:import-package`\n * not idempotent (an Idempotency-Key is sent automatically) · sensitive: may come back as a proposal pending human approval · MCP tool `datasets__import-package`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly importPackage: Operation<ImportPackageParams, ImportPackageResponse>;\n /**\n * Import entries into a dataset\n *\n * Imports rows into one dataset with a strategy (upsert, replace, merge, insert). Admin only.\n *\n * REST: `POST /api/datasets/import` · scope `kon:datasets:import-to-dataset`\n * not idempotent (an Idempotency-Key is sent automatically) · sensitive: may come back as a proposal pending human approval · MCP tool `datasets__import-to-dataset`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly importToDataset: Operation<ImportToDatasetParams, ImportToDatasetResponse>;\n /**\n * Index report\n *\n * A report of missing and unused indexes. Read-only analysis; admin only.\n *\n * REST: `POST /api/datasets/indexes/report` · scope `kon:datasets:index-report`\n * idempotent (safe to retry) · MCP tool `datasets__index-report`\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly indexReport: Operation<void, IndexReportResponse>;\n /**\n * Index statistics\n *\n * Index usage statistics of the whole database. Admin only.\n *\n * REST: `GET /api/datasets/indexes/stats` · scope `kon:datasets:index-stats`\n * idempotent (safe to retry) · MCP tool `datasets__index-stats`\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly indexStats: Operation<void, IndexStatsResponse>;\n /**\n * List the calculated fields of a dataset\n *\n * The calculated fields (formulas, aggregates, KPIs) of a dataset this caller can read.\n *\n * REST: `GET /api/datasets/{id}/calculated-fields` · scope `kon:datasets:list-calculated-fields`\n * idempotent (safe to retry) · MCP tool `datasets__list-calculated-fields`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listCalculatedFields: Operation<ListCalculatedFieldsParams, ListCalculatedFieldsResponse>;\n /**\n * List datasets\n *\n * The datasets this caller can read (each dataset's policyJson.readAccess decides; staff see all), ordered by name, with their field schema.\n *\n * REST: `GET /api/datasets` · scope `kon:datasets:list-datasets`\n * idempotent (safe to retry) · MCP tool `datasets__list-datasets`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listDatasets: PageableOperation<ListDatasetsParams, ListDatasetsResponse, ListDatasetsItem>;\n /**\n * List the entries of a dataset\n *\n * Entries in sortOrder (up to 1000), filtered by the dataset's row rules for this caller. Optionally with calculated fields evaluated and thumbnail URLs.\n *\n * REST: `GET /api/datasets/{id}/entries` · scope `kon:datasets:list-entries`\n * idempotent (safe to retry) · MCP tool `datasets__list-entries`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listEntries: PageableOperation<ListEntriesParams, ListEntriesResponse, ListEntriesItem>;\n /**\n * Current snapshot of an entry\n *\n * The latest stored snapshot of an entry (same visibility as reading the entry).\n *\n * REST: `GET /api/datasets/{id}/entries/{entryId}/snapshot` · scope `kon:datasets:read-snapshot`\n * idempotent (safe to retry) · MCP tool `datasets__read-snapshot`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readSnapshot: Operation<ReadSnapshotParams, ReadSnapshotResponse>;\n /**\n * Restore an entry to a snapshot\n *\n * Rewrites the entry with the snapshot taken at `timestamp`. Staff only.\n *\n * REST: `POST /api/datasets/{id}/entries/{entryId}/restore` · scope `kon:datasets:restore-snapshot`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `datasets__restore-snapshot`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly restoreSnapshot: Operation<RestoreSnapshotParams, RestoreSnapshotResponse>;\n /**\n * Search the entries of a dataset\n *\n * Full-text search with field filters and facet counts (computed in the database), within what this caller can see. Carries the data provenance (source, licence, version).\n *\n * REST: `GET /api/datasets/{id}/search` · scope `kon:datasets:search-entries`\n * idempotent (safe to retry) · MCP tool `datasets__search-entries`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly searchEntries: PageableOperation<SearchEntriesParams, SearchEntriesResponse, SearchEntriesItem>;\n /**\n * Snapshot history of an entry\n *\n * Every stored snapshot of an entry, newest first.\n *\n * REST: `GET /api/datasets/{id}/entries/{entryId}/snapshots` · scope `kon:datasets:snapshot-history`\n * idempotent (safe to retry) · MCP tool `datasets__snapshot-history`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly snapshotHistory: Operation<SnapshotHistoryParams, SnapshotHistoryResponse>;\n /**\n * Suggest indexes for a dataset\n *\n * Index suggestions for the dataset fields (read-only analysis). Staff only.\n *\n * REST: `GET /api/datasets/{id}/indexes/suggest` · scope `kon:datasets:suggest-indexes`\n * idempotent (safe to retry) · MCP tool `datasets__suggest-indexes`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly suggestIndexes: Operation<SuggestIndexesParams, SuggestIndexesResponse>;\n /**\n * Update a calculated field\n *\n * Changes a calculated field (including activating it or reordering). Staff only.\n *\n * REST: `PATCH /api/datasets/{id}/calculated-fields/{fieldId}` · scope `kon:datasets:update-calculated-field`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__update-calculated-field`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateCalculatedField: Operation<UpdateCalculatedFieldParams, UpdateCalculatedFieldResponse>;\n /**\n * Update a dataset\n *\n * Changes the definition of a dataset (name, slug, schema, display, source…). Changing policyJson needs an admin.\n *\n * REST: `PATCH /api/datasets/{id}` · scope `kon:datasets:update-dataset`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__update-dataset`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateDataset: Operation<UpdateDatasetParams, UpdateDatasetResponse>;\n /**\n * Update an entry\n *\n * Changes title/data (and, for staff, the editorial fields). Outside the staff, only the owner can edit, and only where the dataset policy lets them write.\n *\n * REST: `PATCH /api/datasets/{id}/entries/{entryId}` · scope `kon:datasets:update-entry`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `datasets__update-entry`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateEntry: Operation<UpdateEntryParams, UpdateEntryResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-external-mcp: External MCP servers and the human review of their tools (human administrators only). */\n\n/** Body of `external-mcp.approve-mcp-server-tool`. */\nexport type ApproveMcpServerToolBody = {\n name: string;\n fingerprint: string;\n};\n\n/** Arguments of `external-mcp.approve-mcp-server-tool`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ApproveMcpServerToolParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: ApproveMcpServerToolBody;\n};\n\n/** Success response of `external-mcp.approve-mcp-server-tool`. */\nexport type ApproveMcpServerToolResponse = Record<string, unknown>;\n\n/** Body of `external-mcp.create-mcp-server`. */\nexport type CreateMcpServerBody = {\n name?: string;\n url?: string;\n enabled?: boolean;\n authHeaderName?: string | null;\n authHeaderValue?: string | null;\n};\n\n/** Arguments of `external-mcp.create-mcp-server`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateMcpServerParams = {\n /** JSON body. */\n body: CreateMcpServerBody;\n};\n\n/** Success response of `external-mcp.create-mcp-server`. */\nexport type CreateMcpServerResponse = Record<string, unknown>;\n\n/** Arguments of `external-mcp.delete-mcp-server`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteMcpServerParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `external-mcp.delete-mcp-server`. */\nexport type DeleteMcpServerResponse = {\n success: boolean;\n};\n\n/** Arguments of `external-mcp.disconnect-mcp-server-oauth`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DisconnectMcpServerOauthParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `external-mcp.disconnect-mcp-server-oauth`. */\nexport type DisconnectMcpServerOauthResponse = {\n success: boolean;\n};\n\n/** Arguments of `external-mcp.list-mcp-server-tools`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListMcpServerToolsParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `external-mcp.list-mcp-server-tools`. */\nexport type ListMcpServerToolsResponse = {\n docs: Record<string, unknown>[];\n};\n\n/** Success response of `external-mcp.list-mcp-servers`. */\nexport type ListMcpServersResponse = {\n docs: Record<string, unknown>[];\n};\n\n/** Arguments of `external-mcp.refresh-mcp-server`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RefreshMcpServerParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `external-mcp.refresh-mcp-server`. */\nexport type RefreshMcpServerResponse = Record<string, unknown>;\n\n/** Body of `external-mcp.start-mcp-server-oauth`. */\nexport type StartMcpServerOauthBody = {\n clientId?: string;\n clientSecret?: string;\n scopes?: string;\n};\n\n/** Arguments of `external-mcp.start-mcp-server-oauth`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type StartMcpServerOauthParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body?: StartMcpServerOauthBody;\n};\n\n/** Success response of `external-mcp.start-mcp-server-oauth`. */\nexport type StartMcpServerOauthResponse = {\n authorizationUrl: string;\n redirectUri: string;\n};\n\n/** Body of `external-mcp.update-mcp-server`. */\nexport type UpdateMcpServerBody = {\n name?: string;\n url?: string;\n enabled?: boolean;\n authHeaderName?: string | null;\n authHeaderValue?: string | null;\n};\n\n/** Arguments of `external-mcp.update-mcp-server`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateMcpServerParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: UpdateMcpServerBody;\n};\n\n/** Success response of `external-mcp.update-mcp-server`. */\nexport type UpdateMcpServerResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-external-mcp (path, method, pagination…). */\nexport const operations = {\n \"approveMcpServerTool\": {\"kon\":\"kon-external-mcp\",\"id\":\"approve-mcp-server-tool\",\"operationId\":\"external-mcp.approve-mcp-server-tool\",\"method\":\"POST\",\"path\":\"/admin/mcp-servers/{id}/tools/approve\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:external-mcp:approve-mcp-server-tool\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createMcpServer\": {\"kon\":\"kon-external-mcp\",\"id\":\"create-mcp-server\",\"operationId\":\"external-mcp.create-mcp-server\",\"method\":\"POST\",\"path\":\"/admin/mcp-servers\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:external-mcp:create-mcp-server\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteMcpServer\": {\"kon\":\"kon-external-mcp\",\"id\":\"delete-mcp-server\",\"operationId\":\"external-mcp.delete-mcp-server\",\"method\":\"DELETE\",\"path\":\"/admin/mcp-servers/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:external-mcp:delete-mcp-server\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"disconnectMcpServerOauth\": {\"kon\":\"kon-external-mcp\",\"id\":\"disconnect-mcp-server-oauth\",\"operationId\":\"external-mcp.disconnect-mcp-server-oauth\",\"method\":\"DELETE\",\"path\":\"/admin/mcp-servers/{id}/oauth\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:external-mcp:disconnect-mcp-server-oauth\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listMcpServerTools\": {\"kon\":\"kon-external-mcp\",\"id\":\"list-mcp-server-tools\",\"operationId\":\"external-mcp.list-mcp-server-tools\",\"method\":\"GET\",\"path\":\"/admin/mcp-servers/{id}/tools\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:external-mcp:list-mcp-server-tools\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listMcpServers\": {\"kon\":\"kon-external-mcp\",\"id\":\"list-mcp-servers\",\"operationId\":\"external-mcp.list-mcp-servers\",\"method\":\"GET\",\"path\":\"/admin/mcp-servers\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:external-mcp:list-mcp-servers\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"refreshMcpServer\": {\"kon\":\"kon-external-mcp\",\"id\":\"refresh-mcp-server\",\"operationId\":\"external-mcp.refresh-mcp-server\",\"method\":\"POST\",\"path\":\"/admin/mcp-servers/{id}/refresh\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:external-mcp:refresh-mcp-server\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"startMcpServerOauth\": {\"kon\":\"kon-external-mcp\",\"id\":\"start-mcp-server-oauth\",\"operationId\":\"external-mcp.start-mcp-server-oauth\",\"method\":\"POST\",\"path\":\"/admin/mcp-servers/{id}/oauth/start\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:external-mcp:start-mcp-server-oauth\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateMcpServer\": {\"kon\":\"kon-external-mcp\",\"id\":\"update-mcp-server\",\"operationId\":\"external-mcp.update-mcp-server\",\"method\":\"PATCH\",\"path\":\"/admin/mcp-servers/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:external-mcp:update-mcp-server\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-external-mcp\n *\n * External MCP servers and the human review of their tools (human administrators only).\n */\nexport interface ExternalMcpApi {\n /**\n * Approve an external MCP tool (admin, humans only)\n *\n * Approves a tool as reviewed: `fingerprint` must be the one shown (if the server changed it since, 409). Approving a removed tool forgets it.\n *\n * REST: `POST /api/admin/mcp-servers/{id}/tools/approve` · scope `kon:external-mcp:approve-mcp-server-tool`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly approveMcpServerTool: Operation<ApproveMcpServerToolParams, ApproveMcpServerToolResponse>;\n /**\n * Register an external MCP server (admin)\n *\n * Registers a Streamable HTTP MCP server. The URL must be https and resolve to public addresses. The auth header is stored encrypted and never returned (for OAuth, register the server without a header and start the OAuth connection). Nothing is connected until a refresh.\n *\n * REST: `POST /api/admin/mcp-servers` · scope `kon:external-mcp:create-mcp-server`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createMcpServer: Operation<CreateMcpServerParams, CreateMcpServerResponse>;\n /**\n * Remove an external MCP server (admin)\n *\n * Removes the server, its tools and their approvals.\n *\n * REST: `DELETE /api/admin/mcp-servers/{id}` · scope `kon:external-mcp:delete-mcp-server`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteMcpServer: Operation<DeleteMcpServerParams, DeleteMcpServerResponse>;\n /**\n * Disconnect an external MCP server's OAuth (admin)\n *\n * Forgets the tokens and the client. The server is left with no authentication until it is connected again or given an auth header.\n *\n * REST: `DELETE /api/admin/mcp-servers/{id}/oauth` · scope `kon:external-mcp:disconnect-mcp-server-oauth`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly disconnectMcpServerOauth: Operation<DisconnectMcpServerOauthParams, DisconnectMcpServerOauthResponse>;\n /**\n * An external MCP server's tools (admin)\n *\n * Each tool with its description, input schema, current and approved fingerprint, and review status.\n *\n * REST: `GET /api/admin/mcp-servers/{id}/tools` · scope `kon:external-mcp:list-mcp-server-tools`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listMcpServerTools: Operation<ListMcpServerToolsParams, ListMcpServerToolsResponse>;\n /**\n * External MCP servers (admin)\n *\n * The registered external MCP servers, with how many of their tools need review. Never the auth header.\n *\n * REST: `GET /api/admin/mcp-servers` · scope `kon:external-mcp:list-mcp-servers`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listMcpServers: Operation<void, ListMcpServersResponse>;\n /**\n * Read an external MCP server's tools (admin)\n *\n * Connects to the server, reads tools/list and stores a fingerprint of each tool (name, description, input schema). New, changed or removed tools are flagged needs_review until a person approves them.\n *\n * REST: `POST /api/admin/mcp-servers/{id}/refresh` · scope `kon:external-mcp:refresh-mcp-server`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly refreshMcpServer: Operation<RefreshMcpServerParams, RefreshMcpServerResponse>;\n /**\n * Start an OAuth connection to an external MCP server (admin)\n *\n * Discovers the server's authorization server, registers a client there (or uses `clientId`) and answers `authorizationUrl`: open it in a browser to authorize. Valid for ten minutes. The answer also sets an HttpOnly cookie scoped to the callback: the callback is accepted only from this browser or from a browser signed in as the same admin. Once authorized, OAuth replaces the auth header.\n *\n * REST: `POST /api/admin/mcp-servers/{id}/oauth/start` · scope `kon:external-mcp:start-mcp-server-oauth`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly startMcpServerOauth: Operation<StartMcpServerOauthParams, StartMcpServerOauthResponse>;\n /**\n * Change an external MCP server (admin)\n *\n * Changes name, URL, enabled flag or auth header (`authHeaderName: null` removes it; setting one replaces OAuth). A new URL sends every tool back to review and forgets the OAuth connection.\n *\n * REST: `PATCH /api/admin/mcp-servers/{id}` · scope `kon:external-mcp:update-mcp-server`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateMcpServer: Operation<UpdateMcpServerParams, UpdateMcpServerResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, RedirectResult } from \"../../api/types\";\n\n/* kon-external-mcp-oauth: The OAuth redirect of external MCP servers. */\n\n/** Arguments of `external-mcp-oauth.mcp-server-oauth-callback`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type McpServerOauthCallbackParams = {\n state?: string | number;\n code?: string | number;\n error?: string | number;\n};\n\n/** Success response of `external-mcp-oauth.mcp-server-oauth-callback`. */\nexport type McpServerOauthCallbackResponse = RedirectResult;\n\n/** Runtime description of every operation of kon-external-mcp-oauth (path, method, pagination…). */\nexport const operations = {\n \"mcpServerOauthCallback\": {\"kon\":\"kon-external-mcp-oauth\",\"id\":\"mcp-server-oauth-callback\",\"operationId\":\"external-mcp-oauth.mcp-server-oauth-callback\",\"method\":\"GET\",\"path\":\"/mcp-oauth/callback\",\"pathParams\":[],\"queryParams\":[\"state\",\"code\",\"error\"],\"body\":null,\"responses\":{\"302\":\"redirect\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:external-mcp-oauth:mcp-server-oauth-callback\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-external-mcp-oauth\n *\n * The OAuth redirect of external MCP servers.\n */\nexport interface ExternalMcpOauthApi {\n /**\n * OAuth redirect of an external MCP server\n *\n * Where an external MCP server's authorization server sends the administrator's browser back. The `state` names the round trip (one use, ten minutes), and the request must come from the browser that started it (the binding cookie `oauth/start` sets) or from a session of the same admin; otherwise the state is burnt, nothing is exchanged and the panel gets `oauth=error`. Exchanges the code and redirects to the panel. Not called by hand.\n *\n * REST: `GET /api/mcp-oauth/callback` · scope `kon:external-mcp-oauth:mcp-server-oauth-callback`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly mcpServerOauthCallback: Operation<McpServerOauthCallbackParams, McpServerOauthCallbackResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-media: Media file management with S3/MinIO storage */\n\n/** Arguments of `media.clear-image-cache`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ClearImageCacheParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `media.clear-image-cache`. */\nexport type ClearImageCacheResponse = {\n success: true;\n cleared: number;\n};\n\n/** Body of `media.create-folder`. */\nexport type CreateFolderBody = {\n /** Required, max 200 chars */\n name?: string;\n parentId?: string | null;\n description?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.create-folder`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateFolderParams = {\n /** JSON body. */\n body?: CreateFolderBody;\n};\n\n/** Success response of `media.create-folder`. */\nexport type CreateFolderResponse = {\n id: string;\n name: string;\n slug: string;\n parentId: string | null;\n path: string;\n description: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.delete-media`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteMediaParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `media.delete-media`. */\nexport type DeleteMediaResponse = {\n success: true;\n};\n\n/** Arguments of `media.get-media`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetMediaParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `media.get-media`. */\nexport type GetMediaResponse = {\n id: string;\n filename: string;\n originalName: string;\n mimeType: string;\n size: number;\n key: string;\n publicUrl: string | null;\n width: number | null;\n height: number | null;\n folderId: string | null;\n altText: string | null;\n caption: string | null;\n metadata: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n url: string | null;\n thumbnails?: Record<string, string>;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.image-with-preset`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ImageWithPresetParams = {\n /** Media id (uuid) */\n id: string | number;\n /** thumbnail | small | medium | large | hero */\n preset: string | number;\n};\n\n/** Success response of `media.image-with-preset`. */\nexport type ImageWithPresetResponse = ArrayBuffer;\n\n/** Success response of `media.list-folders`. */\nexport type ListFoldersResponse = {\n docs: {\n id: string;\n name: string;\n slug: string;\n parentId: string | null;\n path: string;\n description: string | null;\n [key: string]: unknown;\n }[];\n};\n\n/** Arguments of `media.list-media`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListMediaParams = {\n /** 1-200, default 50 */\n limit?: string | number;\n offset?: string | number;\n folderId?: string | number;\n /** File name contains (case-insensitive) */\n search?: string | number;\n /** image | video | application (MIME prefix) */\n type?: string | number;\n};\n\n/** Success response of `media.list-media`. */\nexport type ListMediaResponse = {\n docs: {\n id: string;\n filename: string;\n originalName: string;\n mimeType: string;\n size: number;\n key: string;\n publicUrl: string | null;\n width: number | null;\n height: number | null;\n folderId: string | null;\n altText: string | null;\n caption: string | null;\n metadata: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n url: string | null;\n thumbnails?: Record<string, string>;\n [key: string]: unknown;\n }[];\n /** Items in this page (not the library total) */\n totalDocs: number;\n};\n\n/** One item of the list `media.list-media` pages through. */\nexport type ListMediaItem = {\n id: string;\n filename: string;\n originalName: string;\n mimeType: string;\n size: number;\n key: string;\n publicUrl: string | null;\n width: number | null;\n height: number | null;\n folderId: string | null;\n altText: string | null;\n caption: string | null;\n metadata: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n url: string | null;\n thumbnails?: Record<string, string>;\n [key: string]: unknown;\n};\n\n/** Success response of `media.read-configuration`. */\nexport type ReadConfigurationResponse = {\n config: Record<string, unknown>;\n};\n\n/** Arguments of `media.read-focal-point`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadFocalPointParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n};\n\n/** Success response of `media.read-focal-point`. */\nexport type ReadFocalPointResponse = {\n focalPoint: {\n x: number;\n y: number;\n };\n};\n\n/** Body of `media.save-configuration`. */\nexport type SaveConfigurationBody = {\n /** MediaKonConfig: storage, features, limits */\n config: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.save-configuration`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SaveConfigurationParams = {\n /** JSON body. */\n body?: SaveConfigurationBody;\n};\n\n/** Success response of `media.save-configuration`. */\nexport type SaveConfigurationResponse = {\n success: true;\n config: Record<string, unknown>;\n};\n\n/** Body of `media.set-focal-point`. */\nexport type SetFocalPointBody = {\n /** 0-1 */\n x?: number;\n /** 0-1 */\n y?: number;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.set-focal-point`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SetFocalPointParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: SetFocalPointBody;\n};\n\n/** Success response of `media.set-focal-point`. */\nexport type SetFocalPointResponse = {\n success: true;\n focalPoint: {\n x: number;\n y: number;\n };\n};\n\n/** Body of `media.test-storage`. */\nexport type TestStorageBody = {\n /** StorageConfig to test (provider, bucket…) */\n storage: Record<string, unknown>;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.test-storage`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type TestStorageParams = {\n /** JSON body. */\n body?: TestStorageBody;\n};\n\n/** Success response of `media.test-storage`. */\nexport type TestStorageResponse = {\n success: boolean;\n message?: string;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.transform-image`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type TransformImageParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n /** Width 1-4096 */\n w?: string | number;\n width?: string | number;\n /** Height 1-4096 */\n h?: string | number;\n height?: string | number;\n /** cover | contain | fill | inside | outside */\n fit?: string | number;\n /** center | top | right | bottom | left | entropy | attention */\n pos?: string | number;\n position?: string | number;\n /** jpeg | png | webp | avif | gif | auto */\n f?: string | number;\n format?: string | number;\n /** Quality 1-100 */\n q?: string | number;\n quality?: string | number;\n /** Focal point 'x,y', each 0-1 */\n fp?: string | number;\n};\n\n/** Success response of `media.transform-image`. */\nexport type TransformImageResponse = ArrayBuffer;\n\n/** Body of `media.update-media`. */\nexport type UpdateMediaBody = {\n altText?: string | null;\n caption?: string | null;\n filename?: string;\n folderId?: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.update-media`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateMediaParams = {\n /** Media id (uuid; anything else is a 404) */\n id: string | number;\n /** JSON body. */\n body?: UpdateMediaBody;\n};\n\n/** Success response of `media.update-media`. */\nexport type UpdateMediaResponse = {\n id: string;\n filename: string;\n originalName: string;\n mimeType: string;\n size: number;\n key: string;\n publicUrl: string | null;\n width: number | null;\n height: number | null;\n folderId: string | null;\n altText: string | null;\n caption: string | null;\n metadata: Record<string, unknown> | null;\n createdAt: string | null;\n updatedAt: string | null;\n [key: string]: unknown;\n};\n\n/** Arguments of `media.upload-media`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UploadMediaParams = {\n /** Folder uuid */\n folderId?: string | number;\n thumbnails?: \"true\" | \"false\";\n /** multipart/form-data body. */\n body?: FormData;\n};\n\n/** Success response of `media.upload-media`. */\nexport type UploadMediaResponse = {\n /** true when every file was stored (201); false = partial (207) */\n success: boolean;\n files: {\n id?: string;\n filename: string;\n mimeType?: string;\n size?: number;\n url?: string;\n width?: number;\n height?: number;\n success: boolean;\n error?: string;\n [key: string]: unknown;\n }[];\n};\n\n/** Runtime description of every operation of kon-media (path, method, pagination…). */\nexport const operations = {\n \"clearImageCache\": {\"kon\":\"kon-media\",\"id\":\"clear-image-cache\",\"operationId\":\"media.clear-image-cache\",\"method\":\"DELETE\",\"path\":\"/media/cache/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:media:clear-image-cache\",\"mcpTool\":\"media__clear-image-cache\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createFolder\": {\"kon\":\"kon-media\",\"id\":\"create-folder\",\"operationId\":\"media.create-folder\",\"method\":\"POST\",\"path\":\"/media/folders\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:media:create-folder\",\"mcpTool\":\"media__create-folder\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteMedia\": {\"kon\":\"kon-media\",\"id\":\"delete-media\",\"operationId\":\"media.delete-media\",\"method\":\"DELETE\",\"path\":\"/media/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:media:delete-media\",\"mcpTool\":\"media__delete-media\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getMedia\": {\"kon\":\"kon-media\",\"id\":\"get-media\",\"operationId\":\"media.get-media\",\"method\":\"GET\",\"path\":\"/media/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:get-media\",\"mcpTool\":\"media__get-media\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"imageWithPreset\": {\"kon\":\"kon-media\",\"id\":\"image-with-preset\",\"operationId\":\"media.image-with-preset\",\"method\":\"GET\",\"path\":\"/media/preset/{id}/{preset}\",\"pathParams\":[\"id\",\"preset\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"binary\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:image-with-preset\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listFolders\": {\"kon\":\"kon-media\",\"id\":\"list-folders\",\"operationId\":\"media.list-folders\",\"method\":\"GET\",\"path\":\"/media/folders\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:list-folders\",\"mcpTool\":\"media__list-folders\",\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listMedia\": {\"kon\":\"kon-media\",\"id\":\"list-media\",\"operationId\":\"media.list-media\",\"method\":\"GET\",\"path\":\"/media\",\"pathParams\":[],\"queryParams\":[\"limit\",\"offset\",\"folderId\",\"search\",\"type\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:list-media\",\"mcpTool\":\"media__list-media\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"docs\",\"limit\":\"limit\"}},\n \"readConfiguration\": {\"kon\":\"kon-media\",\"id\":\"read-configuration\",\"operationId\":\"media.read-configuration\",\"method\":\"GET\",\"path\":\"/media/config\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:read-configuration\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"readFocalPoint\": {\"kon\":\"kon-media\",\"id\":\"read-focal-point\",\"operationId\":\"media.read-focal-point\",\"method\":\"GET\",\"path\":\"/media/focal-point/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:read-focal-point\",\"mcpTool\":\"media__read-focal-point\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"saveConfiguration\": {\"kon\":\"kon-media\",\"id\":\"save-configuration\",\"operationId\":\"media.save-configuration\",\"method\":\"POST\",\"path\":\"/media/config\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:media:save-configuration\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"setFocalPoint\": {\"kon\":\"kon-media\",\"id\":\"set-focal-point\",\"operationId\":\"media.set-focal-point\",\"method\":\"POST\",\"path\":\"/media/focal-point/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:media:set-focal-point\",\"mcpTool\":\"media__set-focal-point\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"testStorage\": {\"kon\":\"kon-media\",\"id\":\"test-storage\",\"operationId\":\"media.test-storage\",\"method\":\"POST\",\"path\":\"/media/config/test-storage\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:media:test-storage\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_BAD_GATEWAY\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"transformImage\": {\"kon\":\"kon-media\",\"id\":\"transform-image\",\"operationId\":\"media.transform-image\",\"method\":\"GET\",\"path\":\"/media/transform/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[\"w\",\"width\",\"h\",\"height\",\"fit\",\"pos\",\"position\",\"f\",\"format\",\"q\",\"quality\",\"fp\"],\"body\":null,\"responses\":{\"200\":\"binary\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:media:transform-image\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateMedia\": {\"kon\":\"kon-media\",\"id\":\"update-media\",\"operationId\":\"media.update-media\",\"method\":\"PATCH\",\"path\":\"/media/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:media:update-media\",\"mcpTool\":\"media__update-media\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"uploadMedia\": {\"kon\":\"kon-media\",\"id\":\"upload-media\",\"operationId\":\"media.upload-media\",\"method\":\"POST\",\"path\":\"/media/upload\",\"pathParams\":[],\"queryParams\":[\"folderId\",\"thumbnails\"],\"body\":\"multipart\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:media:upload-media\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_PAYLOAD_TOO_LARGE\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-media\n *\n * Media file management with S3/MinIO storage\n */\nexport interface MediaApi {\n /**\n * Clear the cached transforms of an image\n *\n * Deletes every stored transformation of the image; they are regenerated on the next request. The original is not touched.\n *\n * REST: `DELETE /api/media/cache/{id}` · scope `kon:media:clear-image-cache`\n * idempotent (safe to retry) · MCP tool `media__clear-image-cache`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly clearImageCache: Operation<ClearImageCacheParams, ClearImageCacheResponse>;\n /**\n * Create a media folder\n *\n * Creates a folder, optionally inside another one (its path is taken from the parent, not from the request).\n *\n * REST: `POST /api/media/folders` · scope `kon:media:create-folder`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `media__create-folder`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createFolder: Operation<CreateFolderParams, CreateFolderResponse>;\n /**\n * Delete a media file\n *\n * Deletes the record and its stored file and thumbnails. Cannot be undone; pages that use it will show a broken image.\n *\n * REST: `DELETE /api/media/{id}` · scope `kon:media:delete-media`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval · MCP tool `media__delete-media`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteMedia: Operation<DeleteMediaParams, DeleteMediaResponse>;\n /**\n * Get a media file\n *\n * One media record (staff only) with its URL and thumbnail URLs.\n *\n * REST: `GET /api/media/{id}` · scope `kon:media:get-media`\n * idempotent (safe to retry) · MCP tool `media__get-media`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getMedia: Operation<GetMediaParams, GetMediaResponse>;\n /**\n * Image with a named preset\n *\n * Serves the image with a named size: thumbnail (150x150), small (400x300), medium (800x600), large (1200x800) or hero (1920x1080).\n *\n * REST: `GET /api/media/preset/{id}/{preset}` · scope `kon:media:image-with-preset`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly imageWithPreset: Operation<ImageWithPresetParams, ImageWithPresetResponse>;\n /**\n * List media folders\n *\n * All media folders ordered by path (staff only).\n *\n * REST: `GET /api/media/folders` · scope `kon:media:list-folders`\n * idempotent (safe to retry) · MCP tool `media__list-folders`\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listFolders: Operation<void, ListFoldersResponse>;\n /**\n * List media files\n *\n * The media library (staff only): newest first, filterable by folder, MIME prefix and file name. Each item carries its public URL.\n *\n * REST: `GET /api/media` · scope `kon:media:list-media`\n * idempotent (safe to retry) · MCP tool `media__list-media`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listMedia: PageableOperation<ListMediaParams, ListMediaResponse, ListMediaItem>;\n /**\n * Read the media configuration\n *\n * The media kon configuration (storage provider and its settings, features, limits). Admin only: it can hold storage credentials.\n *\n * REST: `GET /api/media/config` · scope `kon:media:read-configuration`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readConfiguration: Operation<void, ReadConfigurationResponse>;\n /**\n * Get the focal point of an image\n *\n * The stored focal point, or the centre (0.5, 0.5) when none was set.\n *\n * REST: `GET /api/media/focal-point/{id}` · scope `kon:media:read-focal-point`\n * idempotent (safe to retry) · MCP tool `media__read-focal-point`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readFocalPoint: Operation<ReadFocalPointParams, ReadFocalPointResponse>;\n /**\n * Save the media configuration\n *\n * Validates and stores the media kon configuration (admin only).\n *\n * REST: `POST /api/media/config` · scope `kon:media:save-configuration`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly saveConfiguration: Operation<SaveConfigurationParams, SaveConfigurationResponse>;\n /**\n * Set the focal point of an image\n *\n * Stores the point (x, y between 0 and 1) that smart crops keep in frame. Setting the same point twice leaves the same state.\n *\n * REST: `POST /api/media/focal-point/{id}` · scope `kon:media:set-focal-point`\n * idempotent (safe to retry) · MCP tool `media__set-focal-point`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly setFocalPoint: Operation<SetFocalPointParams, SetFocalPointResponse>;\n /**\n * Test a storage configuration\n *\n * Tries to connect with the given storage settings (writes a probe on disk or calls the endpoint). Admin only.\n *\n * REST: `POST /api/media/config/test-storage` · scope `kon:media:test-storage`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_BAD_GATEWAY`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly testStorage: Operation<TestStorageParams, TestStorageResponse>;\n /**\n * Transform an image on the fly\n *\n * Serves the image resized/cropped/converted as asked (w, h, fit, pos, f, q, fp). The result is cached in storage and served with a one-year immutable Cache-Control.\n *\n * REST: `GET /api/media/transform/{id}` · scope `kon:media:transform-image`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly transformImage: Operation<TransformImageParams, TransformImageResponse>;\n /**\n * Update media metadata\n *\n * Changes the editable fields only: altText, caption, filename and folderId (never the storage key or URL).\n *\n * REST: `PATCH /api/media/{id}` · scope `kon:media:update-media`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `media__update-media`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateMedia: Operation<UpdateMediaParams, UpdateMediaResponse>;\n /**\n * Upload files\n *\n * Uploads up to 20 files (10 MB each) in the multipart field `files`. The type is detected from the bytes (JPEG, PNG, GIF, WebP, AVIF, MP4, WebM or PDF); anything else is refused per file. 201 when all were stored, 207 when some failed.\n *\n * REST: `POST /api/media/upload` · scope `kon:media:upload-media`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_PAYLOAD_TOO_LARGE`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly uploadMedia: Operation<UploadMediaParams, UploadMediaResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-models: The models declared with defineModel in the mounted kons (for the admin panel). */\n\n/** Success response of `models.list-models`. */\nexport type ListModelsResponse = {\n data: {\n kon: string;\n mountPath: string;\n base: string;\n descriptor: {\n version: number;\n name: string;\n plural: string;\n table: string;\n tag: string;\n description: string;\n title: string | null;\n access: {\n read: \"public\" | \"owner\" | \"staff\";\n write: \"owner\" | \"staff\";\n };\n withOwner: boolean;\n choosesOwner: boolean;\n scopes: {\n read: string;\n write: string;\n };\n operations: Record<string, string>;\n fields: {\n key: string;\n column: string;\n type: \"text\" | \"longText\" | \"integer\" | \"number\" | \"boolean\" | \"date\" | \"enum\" | \"json\" | \"uuid\";\n required: boolean;\n unique: boolean;\n tag: string;\n [key: string]: unknown;\n }[];\n sortable: string[];\n filterable: string[];\n [key: string]: unknown;\n };\n }[];\n};\n\n/** Runtime description of every operation of kon-models (path, method, pagination…). */\nexport const operations = {\n \"listModels\": {\"kon\":\"kon-models\",\"id\":\"list-models\",\"operationId\":\"models.list-models\",\"method\":\"GET\",\"path\":\"/models\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:models:list-models\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-models\n *\n * The models declared with defineModel in the mounted kons (for the admin panel).\n */\nexport interface ModelsApi {\n /**\n * List the declared models\n *\n * Every model declared with defineModel in a mounted kon: its descriptor (fields, access policy, scopes) and the base path of its REST collection. The admin panel builds its model views from this.\n *\n * REST: `GET /api/models` · scope `kon:models:list-models`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listModels: Operation<void, ListModelsResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-oauth: Consent and connected-client management for OAuth MCP clients (human admins and editors only). */\n\n/** Body of `oauth.decide-consent`. */\nexport type DecideConsentBody = {\n decision: \"approve\" | \"deny\";\n agentId?: string;\n newAgent?: {\n name: string;\n description?: string;\n };\n scopes?: string[];\n};\n\n/** Arguments of `oauth.decide-consent`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DecideConsentParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: DecideConsentBody;\n};\n\n/** Success response of `oauth.decide-consent`. */\nexport type DecideConsentResponse = {\n redirectTo: string;\n};\n\n/** Arguments of `oauth.list-connections`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListConnectionsParams = {\n agentId?: string | number;\n includeRevoked?: \"true\" | \"false\";\n};\n\n/** Success response of `oauth.list-connections`. */\nexport type ListConnectionsResponse = {\n grants: Record<string, unknown>[];\n};\n\n/** Arguments of `oauth.revoke-connection`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RevokeConnectionParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `oauth.revoke-connection`. */\nexport type RevokeConnectionResponse = {\n revoked: boolean;\n};\n\n/** Arguments of `oauth.view-consent`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ViewConsentParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `oauth.view-consent`. */\nexport type ViewConsentResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-oauth (path, method, pagination…). */\nexport const operations = {\n \"decideConsent\": {\"kon\":\"kon-oauth\",\"id\":\"decide-consent\",\"operationId\":\"oauth.decide-consent\",\"method\":\"POST\",\"path\":\"/oauth/consent/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:oauth:decide-consent\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listConnections\": {\"kon\":\"kon-oauth\",\"id\":\"list-connections\",\"operationId\":\"oauth.list-connections\",\"method\":\"GET\",\"path\":\"/oauth/grants\",\"pathParams\":[],\"queryParams\":[\"agentId\",\"includeRevoked\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:oauth:list-connections\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"revokeConnection\": {\"kon\":\"kon-oauth\",\"id\":\"revoke-connection\",\"operationId\":\"oauth.revoke-connection\",\"method\":\"DELETE\",\"path\":\"/oauth/grants/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:oauth:revoke-connection\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"viewConsent\": {\"kon\":\"kon-oauth\",\"id\":\"view-consent\",\"operationId\":\"oauth.view-consent\",\"method\":\"GET\",\"path\":\"/oauth/consent/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:oauth:view-consent\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-oauth\n *\n * Consent and connected-client management for OAuth MCP clients (human admins and editors only).\n */\nexport interface OauthApi {\n /**\n * Allow or deny an MCP client\n *\n * Allow: the client acts as the chosen agent (or a new one, admins only) with the chosen scopes, which must be a subset of what the agent and this human already have; this human becomes the agent's signer. Deny: the client gets access_denied. Answers with the URL to send the browser to.\n *\n * REST: `POST /api/oauth/consent/{id}` · scope `kon:oauth:decide-consent`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly decideConsent: Operation<DecideConsentParams, DecideConsentResponse>;\n /**\n * Connected MCP clients\n *\n * OAuth connections: client, agent, who allowed it, scopes, created and last used. Admins see all; editors the ones they allowed.\n *\n * REST: `GET /api/oauth/grants` · scope `kon:oauth:list-connections`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listConnections: Operation<ListConnectionsParams, ListConnectionsResponse>;\n /**\n * Revoke an OAuth connection\n *\n * Revokes the connection, its tokens and its agent key row: the client stops on its next request. Someone else's connection answers 404 to an editor.\n *\n * REST: `DELETE /api/oauth/grants/{id}` · scope `kon:oauth:revoke-connection`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly revokeConnection: Operation<RevokeConnectionParams, RevokeConnectionResponse>;\n /**\n * OAuth consent request\n *\n * What the consent screen shows for a pending MCP client authorization: the client, where the answer is sent (with a localhost warning), the requested scopes and the agents this human may delegate, with the scopes they may grant.\n *\n * REST: `GET /api/oauth/consent/{id}` · scope `kon:oauth:view-consent`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly viewConsent: Operation<ViewConsentParams, ViewConsentResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-promotion: Code promotion: an agent submits versioned drafts of a code action's code; they are tested in the sandbox, scanned and activated by a human approval (suggestion) or automatically when nothing widens permissions (turbo), with a watch window and automatic rollback. */\n\n/** Body of `promotion.activate-version`. */\nexport type ActivateVersionBody = {\n contentHash?: string;\n};\n\n/** Arguments of `promotion.activate-version`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ActivateVersionParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body?: ActivateVersionBody;\n};\n\n/** Success response of `promotion.activate-version`. */\nexport type ActivateVersionResponse = {\n version: Record<string, unknown>;\n};\n\n/** Arguments of `promotion.list-drafts`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListDraftsParams = {\n status?: \"awaiting_approval\" | \"approved\" | \"active\" | \"superseded\" | \"rolled_back\" | \"rejected\" | \"expired\" | \"failed\";\n slug?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `promotion.list-drafts`. */\nexport type ListDraftsResponse = {\n versions: Record<string, unknown>[];\n};\n\n/** One item of the list `promotion.list-drafts` pages through. */\nexport type ListDraftsItem = Record<string, unknown>;\n\n/** Body of `promotion.propose-draft`. */\nexport type ProposeDraftBody = {\n target: {\n actionId?: string;\n slug?: string;\n name?: string;\n };\n code: string;\n scopes?: string[];\n fetchAllow?: string[];\n egress?: {\n rules: {\n action: \"allow\" | \"deny\";\n target?: string;\n ports?: number[];\n }[];\n };\n runtime?: \"quickjs\" | \"opensandbox:python\" | \"opensandbox:shell\";\n timeoutMs?: number;\n memoryLimitMb?: number;\n maxCalls?: number;\n tests?: {\n name: string;\n event?: Record<string, unknown>;\n env?: Record<string, string>;\n api?: Record<string, {\n status?: number;\n body?: unknown;\n headers?: Record<string, string>;\n }>;\n fetch?: Record<string, {\n status?: number;\n body?: unknown;\n headers?: Record<string, string>;\n }>;\n expect: {\n success?: boolean;\n result?: unknown;\n resultContains?: string;\n errorContains?: string;\n logsContain?: string;\n };\n timeoutMs?: number;\n }[];\n description?: string;\n};\n\n/** Arguments of `promotion.propose-draft`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ProposeDraftParams = {\n /** JSON body. */\n body: ProposeDraftBody;\n};\n\n/** Success response of `promotion.propose-draft`. */\nexport type ProposeDraftResponse = {\n version: Record<string, unknown>;\n duplicate: boolean;\n};\n\n/** Arguments of `promotion.read-draft`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ReadDraftParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `promotion.read-draft`. */\nexport type ReadDraftResponse = {\n version: Record<string, unknown>;\n proposal: Record<string, unknown> | null;\n};\n\n/** Runtime description of every operation of kon-promotion (path, method, pagination…). */\nexport const operations = {\n \"activateVersion\": {\"kon\":\"kon-promotion\",\"id\":\"activate-version\",\"operationId\":\"promotion.activate-version\",\"method\":\"POST\",\"path\":\"/promotion/versions/{id}/activate\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:promotion:activate-version\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listDrafts\": {\"kon\":\"kon-promotion\",\"id\":\"list-drafts\",\"operationId\":\"promotion.list-drafts\",\"method\":\"GET\",\"path\":\"/promotion/drafts\",\"pathParams\":[],\"queryParams\":[\"status\",\"slug\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:promotion:list-drafts\",\"mcpTool\":\"promotion_list\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"versions\",\"limit\":\"limit\"}},\n \"proposeDraft\": {\"kon\":\"kon-promotion\",\"id\":\"propose-draft\",\"operationId\":\"promotion.propose-draft\",\"method\":\"POST\",\"path\":\"/promotion/drafts\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\",\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion:propose-draft\",\"mcpTool\":\"promotion_propose\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"readDraft\": {\"kon\":\"kon-promotion\",\"id\":\"read-draft\",\"operationId\":\"promotion.read-draft\",\"method\":\"GET\",\"path\":\"/promotion/drafts/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:promotion:read-draft\",\"mcpTool\":\"promotion_status\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-promotion\n *\n * Code promotion: an agent submits versioned drafts of a code action's code; they are tested in the sandbox, scanned and activated by a human approval (suggestion) or automatically when nothing widens permissions (turbo), with a watch window and automatic rollback.\n */\nexport interface PromotionApi {\n /**\n * Activate an approved version\n *\n * Makes the version the action's active code, with a watch window that rolls back automatically on errors. An agent can NOT call this by itself (403, even with `admin`): it only runs as the execution of the agent's proposal after a human approved it. An admin can activate a version that was approved but could not be activated (code actions were disabled). 409 if the action changed since the draft was tested (stale_base) or code actions are disabled (code_actions_disabled: the version stays approved).\n *\n * REST: `POST /api/promotion/versions/{id}/activate` · scope `kon:promotion:activate-version`\n * not idempotent (an Idempotency-Key is sent automatically) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly activateVersion: Operation<ActivateVersionParams, ActivateVersionResponse>;\n /**\n * List code drafts\n *\n * Your drafts (an admin sees every agent's), newest first, with status (awaiting_approval, approved, active, superseded, rolled_back, rejected, expired, failed), test and scan summaries and the decision.\n *\n * REST: `GET /api/promotion/drafts` · scope `kon:promotion:list-drafts`\n * idempotent (safe to retry) · MCP tool `promotion_list`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listDrafts: PageableOperation<ListDraftsParams, ListDraftsResponse, ListDraftsItem>;\n /**\n * Submit a code draft for an action\n *\n * Submits a new VERSION of a code action's code (the active version is never edited). The draft's tests (plus the tests the action declares) run in the sandbox with simulated `kitsuden.api` and `fetch`; a local security scan checks the code and the DECLARED capabilities (scopes, outbound hosts, limits) are compared with the active version. Then: suggestion mode → a proposal for a human (status awaiting_approval, proposal id in the response); turbo mode → activated at once ONLY if every test and check passes and nothing widens permissions or touches secrets, users, roles, security config or sensitive operations; otherwise a proposal with the reasons (`decision.reasons`). Resubmitting the same content returns the same version (200, duplicate: true). Agents only; never approves anything.\n *\n * REST: `POST /api/promotion/drafts` · scope `kon:promotion:propose-draft`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `promotion_propose`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly proposeDraft: Operation<ProposeDraftParams, ProposeDraftResponse>;\n /**\n * A code draft in detail\n *\n * One of your drafts with its code, test cases, the full test report, the scan report, the capability diff, the decision and reasons, its proposal (status, reviewer comment) and, once active, the watch window and any rollback. Another agent's draft is 404.\n *\n * REST: `GET /api/promotion/drafts/{id}` · scope `kon:promotion:read-draft`\n * idempotent (safe to retry) · MCP tool `promotion_status`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly readDraft: Operation<ReadDraftParams, ReadDraftResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-promotion-admin: Code promotion for admins: settings, agents' modes, approve, reject, roll back and activate (humans only). */\n\n/** Arguments of `promotion-admin.activate-approved`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ActivateApprovedParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `promotion-admin.activate-approved`. */\nexport type ActivateApprovedResponse = Record<string, unknown>;\n\n/** Body of `promotion-admin.approve-version`. */\nexport type ApproveVersionBody = {\n comment?: string;\n /** Optional: the proposal's operationHash as shown; if sent it must match */\n operationHash?: string;\n};\n\n/** Arguments of `promotion-admin.approve-version`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ApproveVersionParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: ApproveVersionBody;\n};\n\n/** Success response of `promotion-admin.approve-version`. */\nexport type ApproveVersionResponse = Record<string, unknown>;\n\n/** Success response of `promotion-admin.promotion-configuration`. */\nexport type PromotionConfigurationResponse = Record<string, unknown>;\n\n/** Body of `promotion-admin.promotion-mode`. */\nexport type PromotionModeBody = {\n mode: \"suggestion\" | \"turbo\";\n};\n\n/** Arguments of `promotion-admin.promotion-mode`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type PromotionModeParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: PromotionModeBody;\n};\n\n/** Success response of `promotion-admin.promotion-mode`. */\nexport type PromotionModeResponse = Record<string, unknown>;\n\n/** Body of `promotion-admin.reject-version`. */\nexport type RejectVersionBody = {\n comment?: string;\n /** Optional: the proposal's operationHash as shown; if sent it must match */\n operationHash?: string;\n};\n\n/** Arguments of `promotion-admin.reject-version`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RejectVersionParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: RejectVersionBody;\n};\n\n/** Success response of `promotion-admin.reject-version`. */\nexport type RejectVersionResponse = Record<string, unknown>;\n\n/** Body of `promotion-admin.rollback`. */\nexport type RollbackBody = {\n reason: string;\n};\n\n/** Arguments of `promotion-admin.rollback`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RollbackParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: RollbackBody;\n};\n\n/** Success response of `promotion-admin.rollback`. */\nexport type RollbackResponse = Record<string, unknown>;\n\n/** Body of `promotion-admin.save-promotion-configuration`. */\nexport type SavePromotionConfigurationBody = {\n turboAllowed?: boolean;\n watchMinutes?: number;\n minExecutions?: number;\n maxErrorRate?: number;\n};\n\n/** Arguments of `promotion-admin.save-promotion-configuration`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type SavePromotionConfigurationParams = {\n /** JSON body. */\n body: SavePromotionConfigurationBody;\n};\n\n/** Success response of `promotion-admin.save-promotion-configuration`. */\nexport type SavePromotionConfigurationResponse = Record<string, unknown>;\n\n/** Arguments of `promotion-admin.version`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type VersionParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `promotion-admin.version`. */\nexport type VersionResponse = Record<string, unknown>;\n\n/** Arguments of `promotion-admin.versions`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type VersionsParams = {\n status?: \"awaiting_approval\" | \"approved\" | \"active\" | \"superseded\" | \"rolled_back\" | \"rejected\" | \"expired\" | \"failed\";\n slug?: string | number;\n limit?: number;\n offset?: number;\n agentId?: string | number;\n};\n\n/** Success response of `promotion-admin.versions`. */\nexport type VersionsResponse = {\n versions: Record<string, unknown>[];\n};\n\n/** One item of the list `promotion-admin.versions` pages through. */\nexport type VersionsItem = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-promotion-admin (path, method, pagination…). */\nexport const operations = {\n \"activateApproved\": {\"kon\":\"kon-promotion-admin\",\"id\":\"activate-approved\",\"operationId\":\"promotion-admin.activate-approved\",\"method\":\"POST\",\"path\":\"/approvals/promotion/versions/{id}/activate\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion-admin:activate-approved\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"approveVersion\": {\"kon\":\"kon-promotion-admin\",\"id\":\"approve-version\",\"operationId\":\"promotion-admin.approve-version\",\"method\":\"POST\",\"path\":\"/approvals/promotion/versions/{id}/approve\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion-admin:approve-version\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"promotionConfiguration\": {\"kon\":\"kon-promotion-admin\",\"id\":\"promotion-configuration\",\"operationId\":\"promotion-admin.promotion-configuration\",\"method\":\"GET\",\"path\":\"/approvals/promotion/settings\",\"pathParams\":[],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:promotion-admin:promotion-configuration\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"promotionMode\": {\"kon\":\"kon-promotion-admin\",\"id\":\"promotion-mode\",\"operationId\":\"promotion-admin.promotion-mode\",\"method\":\"PUT\",\"path\":\"/approvals/promotion/agents/{id}/mode\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion-admin:promotion-mode\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"rejectVersion\": {\"kon\":\"kon-promotion-admin\",\"id\":\"reject-version\",\"operationId\":\"promotion-admin.reject-version\",\"method\":\"POST\",\"path\":\"/approvals/promotion/versions/{id}/reject\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion-admin:reject-version\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"rollback\": {\"kon\":\"kon-promotion-admin\",\"id\":\"rollback\",\"operationId\":\"promotion-admin.rollback\",\"method\":\"POST\",\"path\":\"/approvals/promotion/versions/{id}/rollback\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion-admin:rollback\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"savePromotionConfiguration\": {\"kon\":\"kon-promotion-admin\",\"id\":\"save-promotion-configuration\",\"operationId\":\"promotion-admin.save-promotion-configuration\",\"method\":\"PUT\",\"path\":\"/approvals/promotion/settings\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:promotion-admin:save-promotion-configuration\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"version\": {\"kon\":\"kon-promotion-admin\",\"id\":\"version\",\"operationId\":\"promotion-admin.version\",\"method\":\"GET\",\"path\":\"/approvals/promotion/versions/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:promotion-admin:version\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"versions\": {\"kon\":\"kon-promotion-admin\",\"id\":\"versions\",\"operationId\":\"promotion-admin.versions\",\"method\":\"GET\",\"path\":\"/approvals/promotion/versions\",\"pathParams\":[],\"queryParams\":[\"status\",\"slug\",\"limit\",\"offset\",\"agentId\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:promotion-admin:versions\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"versions\",\"limit\":\"limit\"}},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-promotion-admin\n *\n * Code promotion for admins: settings, agents' modes, approve, reject, roll back and activate (humans only).\n */\nexport interface PromotionAdminApi {\n /**\n * Activate an approved version\n *\n * Activates a version that was approved but could not be activated (code actions were disabled). 409 if the action changed meanwhile (stale_base) or code actions are still disabled.\n *\n * REST: `POST /api/approvals/promotion/versions/{id}/activate` · scope `kon:promotion-admin:activate-approved`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly activateApproved: Operation<ActivateApprovedParams, ActivateApprovedResponse>;\n /**\n * Approve a draft (activates it)\n *\n * Approves the draft's proposal: it is executed once, as the agent, and activates the version (with its watch window). The same as approving it in the approvals inbox.\n *\n * REST: `POST /api/approvals/promotion/versions/{id}/approve` · scope `kon:promotion-admin:approve-version`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly approveVersion: Operation<ApproveVersionParams, ApproveVersionResponse>;\n /**\n * Code promotion settings\n *\n * The global turbo cap (turboAllowed), the watch window (minutes, minimum executions, error rate that triggers a rollback), whether code actions and the approvals master switch are on, and every agent's promotion mode.\n *\n * REST: `GET /api/approvals/promotion/settings` · scope `kon:promotion-admin:promotion-configuration`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly promotionConfiguration: Operation<void, PromotionConfigurationResponse>;\n /**\n * Set an agent's promotion mode\n *\n * suggestion (default: every draft is a proposal for a human) or turbo (activated automatically when every test and check passes and nothing widens permissions; needs turboAllowed). Audited.\n *\n * REST: `PUT /api/approvals/promotion/agents/{id}/mode` · scope `kon:promotion-admin:promotion-mode`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly promotionMode: Operation<PromotionModeParams, PromotionModeResponse>;\n /**\n * Reject a draft\n *\n * Rejects the draft's proposal: the version is never activated. The comment is shown to the agent.\n *\n * REST: `POST /api/approvals/promotion/versions/{id}/reject` · scope `kon:promotion-admin:reject-version`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly rejectVersion: Operation<RejectVersionParams, RejectVersionResponse>;\n /**\n * Roll back an active version\n *\n * Restores the version that was active before this one (or pauses the action if this was its first version). Only from the active version. Audited and notified.\n *\n * REST: `POST /api/approvals/promotion/versions/{id}/rollback` · scope `kon:promotion-admin:rollback`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_CONFLICT`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly rollback: Operation<RollbackParams, RollbackResponse>;\n /**\n * Change code promotion settings\n *\n * Partial update: turboAllowed (the GLOBAL CAP: off, no agent in turbo activates anything by itself), watchMinutes (1-1440), minExecutions (1-1000), maxErrorRate (0.01-1). Audited.\n *\n * REST: `PUT /api/approvals/promotion/settings` · scope `kon:promotion-admin:save-promotion-configuration`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly savePromotionConfiguration: Operation<SavePromotionConfigurationParams, SavePromotionConfigurationResponse>;\n /**\n * A code version in detail\n *\n * The version with its code, the code it replaces, the full test and scan reports, the capability diff, the decision, its proposal and the audit trail.\n *\n * REST: `GET /api/approvals/promotion/versions/{id}` · scope `kon:promotion-admin:version`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly version: Operation<VersionParams, VersionResponse>;\n /**\n * Code versions (pipeline)\n *\n * Every agent's drafts and versions, newest first, with test, scan and decision summaries.\n *\n * REST: `GET /api/approvals/promotion/versions` · scope `kon:promotion-admin:versions`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly versions: PageableOperation<VersionsParams, VersionsResponse, VersionsItem>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation, StreamOperation } from \"../../api/types\";\n\n/* kon-proposals: An agent reads the status and result of its own proposals. */\n\n/** Arguments of `proposals.my-proposals`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type MyProposalsParams = {\n status?: \"pending\" | \"executing\" | \"executed\" | \"failed\" | \"rejected\" | \"expired\";\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `proposals.my-proposals`. */\nexport type MyProposalsResponse = Record<string, unknown>;\n\n/** One item of the list `proposals.my-proposals` pages through. */\nexport type MyProposalsItem = unknown;\n\n/** Arguments of `proposals.proposal-events`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ProposalEventsParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** One event of the stream `proposals.proposal-events` (Server-Sent Events). */\nexport type ProposalEventsEvent = Record<string, unknown>;\n\n/** Arguments of `proposals.proposal-status`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ProposalStatusParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `proposals.proposal-status`. */\nexport type ProposalStatusResponse = Record<string, unknown>;\n\n/** Runtime description of every operation of kon-proposals (path, method, pagination…). */\nexport const operations = {\n \"myProposals\": {\"kon\":\"kon-proposals\",\"id\":\"my-proposals\",\"operationId\":\"proposals.my-proposals\",\"method\":\"GET\",\"path\":\"/proposals\",\"pathParams\":[],\"queryParams\":[\"status\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:proposals:my-proposals\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":null,\"limit\":\"limit\"}},\n \"proposalEvents\": {\"kon\":\"kon-proposals\",\"id\":\"proposal-events\",\"operationId\":\"proposals.proposal-events\",\"method\":\"GET\",\"path\":\"/proposals/{id}/events\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"event-stream\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:proposals:proposal-events\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"stream\":true},\n \"proposalStatus\": {\"kon\":\"kon-proposals\",\"id\":\"proposal-status\",\"operationId\":\"proposals.proposal-status\",\"method\":\"GET\",\"path\":\"/proposals/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:proposals:proposal-status\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-proposals\n *\n * An agent reads the status and result of its own proposals.\n */\nexport interface ProposalsApi {\n /**\n * My proposals (agent)\n *\n * An agent's own proposals with their status and, once executed, the real result. A staff member sees every proposal.\n *\n * REST: `GET /api/proposals` · scope `kon:proposals:my-proposals`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly myProposals: PageableOperation<MyProposalsParams, MyProposalsResponse, MyProposalsItem>;\n /**\n * Proposal events (agent, Server-Sent Events)\n *\n * The proposal as its agent sees it, now and on every change, until it is executed, failed, rejected or expired; then `event: end`. Instead of polling `/api/proposals/:id`. Closes after 15 minutes without a resolution (reconnect). For a push to your own server instead, an admin sets the agent's notify URL (signed webhook).\n *\n * REST: `GET /api/proposals/{id}/events` · scope `kon:proposals:proposal-events`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly proposalEvents: StreamOperation<ProposalEventsParams, ProposalEventsEvent>;\n /**\n * Proposal status (agent)\n *\n * pending, executing, executed, failed, rejected or expired; the reviewer's comment; and, once executed, `result` with the real status and body. Another agent's proposal is 404.\n *\n * REST: `GET /api/proposals/{id}` · scope `kon:proposals:proposal-status`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly proposalStatus: Operation<ProposalStatusParams, ProposalStatusResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation } from \"../../api/types\";\n\n/* kon-queue: The Postgres queue: status and dead jobs (administrators only). */\n\n/** Arguments of `queue.discard-job`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DiscardJobParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `queue.discard-job`. */\nexport type DiscardJobResponse = {\n success: true;\n};\n\n/** Arguments of `queue.queue-status`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type QueueStatusParams = {\n limit?: number;\n};\n\n/** Success response of `queue.queue-status`. */\nexport type QueueStatusResponse = Record<string, unknown>;\n\n/** Arguments of `queue.retry-job`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RetryJobParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `queue.retry-job`. */\nexport type RetryJobResponse = {\n success: true;\n};\n\n/** Runtime description of every operation of kon-queue (path, method, pagination…). */\nexport const operations = {\n \"discardJob\": {\"kon\":\"kon-queue\",\"id\":\"discard-job\",\"operationId\":\"queue.discard-job\",\"method\":\"DELETE\",\"path\":\"/admin/queue/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:queue:discard-job\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"queueStatus\": {\"kon\":\"kon-queue\",\"id\":\"queue-status\",\"operationId\":\"queue.queue-status\",\"method\":\"GET\",\"path\":\"/admin/queue\",\"pathParams\":[],\"queryParams\":[\"limit\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:queue:queue-status\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"retryJob\": {\"kon\":\"kon-queue\",\"id\":\"retry-job\",\"operationId\":\"queue.retry-job\",\"method\":\"POST\",\"path\":\"/admin/queue/{id}/retry\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:queue:retry-job\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-queue\n *\n * The Postgres queue: status and dead jobs (administrators only).\n */\nexport interface QueueApi {\n /**\n * Discard a dead job (admin)\n *\n * Deletes a dead job. 404 if there is no dead job with that id.\n *\n * REST: `DELETE /api/admin/queue/{id}` · scope `kon:queue:discard-job`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly discardJob: Operation<DiscardJobParams, DiscardJobResponse>;\n /**\n * Queue status (admin)\n *\n * Counts per queue and status (pending, running, done, dead), whether the worker and LISTEN are up, and the dead jobs (without payload) with their last error.\n *\n * REST: `GET /api/admin/queue` · scope `kon:queue:queue-status`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly queueStatus: Operation<QueueStatusParams, QueueStatusResponse>;\n /**\n * Retry a dead job (admin)\n *\n * Puts a dead job back to pending with its attempts reset. 404 if there is no dead job with that id.\n *\n * REST: `POST /api/admin/queue/{id}/retry` · scope `kon:queue:retry-job`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly retryJob: Operation<RetryJobParams, RetryJobResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, PageableOperation } from \"../../api/types\";\n\n/* kon-record-history: The change history of the rows of any explorable table (for the admin panel). */\n\n/** Arguments of `record-history.record-history`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RecordHistoryParams = {\n /** The table, as /api/explorer names it */\n collection: string | number;\n /** The row's primary key */\n id: string | number;\n /** 1-200, default 50 */\n limit?: string | number;\n /** Entries to skip, default 0 */\n offset?: string | number;\n};\n\n/** Success response of `record-history.record-history`. */\nexport type RecordHistoryResponse = {\n history: {\n id: string;\n action: \"create\" | \"update\" | \"delete\";\n /** ISO timestamp */\n at: string;\n actor: {\n type: \"user\" | \"agent\" | \"system\";\n id: string | null;\n /** The name it had when it made the change */\n name: string | null;\n };\n changes: {\n /** The column (or `data.<key>` for a dataset entry) */\n field: string;\n before?: unknown;\n after?: unknown;\n /** A secret column: values are not kept */\n redacted?: true;\n }[];\n /** Some value or the list was cut to its size limit */\n truncated: boolean;\n /** The approved proposal this write executed */\n proposalId: string | null;\n approvedBy: string | null;\n }[];\n total: number;\n limit: number;\n offset: number;\n};\n\n/** One item of the list `record-history.record-history` pages through. */\nexport type RecordHistoryItem = {\n id: string;\n action: \"create\" | \"update\" | \"delete\";\n /** ISO timestamp */\n at: string;\n actor: {\n type: \"user\" | \"agent\" | \"system\";\n id: string | null;\n /** The name it had when it made the change */\n name: string | null;\n };\n changes: {\n /** The column (or `data.<key>` for a dataset entry) */\n field: string;\n before?: unknown;\n after?: unknown;\n /** A secret column: values are not kept */\n redacted?: true;\n }[];\n /** Some value or the list was cut to its size limit */\n truncated: boolean;\n /** The approved proposal this write executed */\n proposalId: string | null;\n approvedBy: string | null;\n};\n\n/** Runtime description of every operation of kon-record-history (path, method, pagination…). */\nexport const operations = {\n \"recordHistory\": {\"kon\":\"kon-record-history\",\"id\":\"record-history\",\"operationId\":\"record-history.record-history\",\"method\":\"GET\",\"path\":\"/history/{collection}/{id}\",\"pathParams\":[\"collection\",\"id\"],\"queryParams\":[\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:record-history:record-history\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"history\",\"limit\":\"limit\"}},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-record-history\n *\n * The change history of the rows of any explorable table (for the admin panel).\n */\nexport interface RecordHistoryApi {\n /**\n * Change history of a row\n *\n * Who created, changed or deleted a row of a table, when, and which fields, newest first: the actor (a person, an agent or the system), the action and each changed field's value before and after. `collection` and `id` name the row as the data explorer does. Secret columns (token, password, hash) are listed as `redacted` with no values; long values are cut to a preview. Changes made before the history existed are not listed. Admin only.\n *\n * REST: `GET /api/history/{collection}/{id}` · scope `kon:record-history:record-history`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly recordHistory: PageableOperation<RecordHistoryParams, RecordHistoryResponse, RecordHistoryItem>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-reports: Aggregate queries over kon tables and datasets, saved reports, kon-shipped reports and dashboards. */\n\n/** Body of `reports.aggregate`. */\nexport type AggregateBody = {\n query: Record<string, unknown>;\n};\n\n/** Arguments of `reports.aggregate`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type AggregateParams = {\n /** JSON body. */\n body: AggregateBody;\n};\n\n/** Success response of `reports.aggregate`. */\nexport type AggregateResponse = {\n columns: {\n name: string;\n role: \"dimension\" | \"measure\";\n }[];\n rows: Record<string, unknown>[];\n truncated: boolean;\n};\n\n/** Body of `reports.create-dashboard`. */\nexport type CreateDashboardBody = {\n name: string;\n description?: string;\n tiles?: {\n report: string;\n title?: string;\n width?: number;\n }[];\n};\n\n/** Arguments of `reports.create-dashboard`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateDashboardParams = {\n /** JSON body. */\n body: CreateDashboardBody;\n};\n\n/** Success response of `reports.create-dashboard`. */\nexport type CreateDashboardResponse = {\n dashboard: {\n id: string;\n name: string;\n description: string | null;\n tiles: {\n report: string;\n title?: string;\n width?: number;\n }[];\n updatedAt: string;\n };\n};\n\n/** Body of `reports.create-report`. */\nexport type CreateReportBody = {\n name: string;\n description?: string;\n query: Record<string, unknown>;\n chart?: Record<string, unknown>;\n};\n\n/** Arguments of `reports.create-report`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type CreateReportParams = {\n /** JSON body. */\n body: CreateReportBody;\n};\n\n/** Success response of `reports.create-report`. */\nexport type CreateReportResponse = {\n report: {\n id: string;\n source: \"saved\" | \"kon\";\n konId: string | null;\n name: string;\n description: string | null;\n query: Record<string, unknown>;\n chart: Record<string, unknown> | null;\n updatedAt: string | null;\n };\n};\n\n/** Arguments of `reports.delete-dashboard`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteDashboardParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `reports.delete-dashboard`. */\nexport type DeleteDashboardResponse = {\n deleted: boolean;\n};\n\n/** Arguments of `reports.delete-report`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type DeleteReportParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `reports.delete-report`. */\nexport type DeleteReportResponse = {\n deleted: boolean;\n};\n\n/** Arguments of `reports.get-dashboard`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetDashboardParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `reports.get-dashboard`. */\nexport type GetDashboardResponse = {\n dashboard: {\n id: string;\n name: string;\n description: string | null;\n tiles: {\n report: string;\n title?: string;\n width?: number;\n }[];\n updatedAt: string;\n };\n};\n\n/** Arguments of `reports.get-report`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type GetReportParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `reports.get-report`. */\nexport type GetReportResponse = {\n report: {\n id: string;\n source: \"saved\" | \"kon\";\n konId: string | null;\n name: string;\n description: string | null;\n query: Record<string, unknown>;\n chart: Record<string, unknown> | null;\n updatedAt: string | null;\n };\n};\n\n/** Arguments of `reports.list-dashboards`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListDashboardsParams = {\n /** Rows per page (1-200). The default is the maximum, what the list always returned. */\n limit?: number;\n /** Rows to skip. */\n offset?: number;\n};\n\n/** Success response of `reports.list-dashboards`. */\nexport type ListDashboardsResponse = {\n dashboards: {\n id: string;\n name: string;\n description: string | null;\n tiles: {\n report: string;\n title?: string;\n width?: number;\n }[];\n updatedAt: string;\n }[];\n hasMore: boolean;\n};\n\n/** One item of the list `reports.list-dashboards` pages through. */\nexport type ListDashboardsItem = {\n id: string;\n name: string;\n description: string | null;\n tiles: {\n report: string;\n title?: string;\n width?: number;\n }[];\n updatedAt: string;\n};\n\n/** Arguments of `reports.list-reports`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListReportsParams = {\n /** Rows per page (1-500). The default is the maximum, what the list always returned. */\n limit?: number;\n /** Rows to skip. */\n offset?: number;\n};\n\n/** Success response of `reports.list-reports`. */\nexport type ListReportsResponse = {\n reports: {\n id: string;\n source: \"saved\" | \"kon\";\n konId: string | null;\n name: string;\n description: string | null;\n query: Record<string, unknown>;\n chart: Record<string, unknown> | null;\n updatedAt: string | null;\n }[];\n hasMore: boolean;\n};\n\n/** One item of the list `reports.list-reports` pages through. */\nexport type ListReportsItem = {\n id: string;\n source: \"saved\" | \"kon\";\n konId: string | null;\n name: string;\n description: string | null;\n query: Record<string, unknown>;\n chart: Record<string, unknown> | null;\n updatedAt: string | null;\n};\n\n/** Arguments of `reports.run-dashboard`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RunDashboardParams = {\n /** Path parameter. */\n id: string | number;\n};\n\n/** Success response of `reports.run-dashboard`. */\nexport type RunDashboardResponse = {\n dashboard: {\n id: string;\n name: string;\n description: string | null;\n tiles: {\n report: string;\n title?: string;\n width?: number;\n }[];\n updatedAt: string;\n };\n tiles: {\n report: string;\n title: string | null;\n width: number | null;\n chart: Record<string, unknown> | null;\n result: {\n columns: {\n name: string;\n role: \"dimension\" | \"measure\";\n }[];\n rows: Record<string, unknown>[];\n truncated: boolean;\n } | null;\n error: string | null;\n }[];\n};\n\n/** Body of `reports.run-report`. */\nexport type RunReportBody = {\n report: string;\n};\n\n/** Arguments of `reports.run-report`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RunReportParams = {\n /** JSON body. */\n body: RunReportBody;\n};\n\n/** Success response of `reports.run-report`. */\nexport type RunReportResponse = {\n report: {\n id: string;\n source: \"saved\" | \"kon\";\n konId: string | null;\n name: string;\n description: string | null;\n query: Record<string, unknown>;\n chart: Record<string, unknown> | null;\n updatedAt: string | null;\n };\n result: {\n columns: {\n name: string;\n role: \"dimension\" | \"measure\";\n }[];\n rows: Record<string, unknown>[];\n truncated: boolean;\n };\n};\n\n/** Body of `reports.update-dashboard`. */\nexport type UpdateDashboardBody = {\n name?: string;\n description?: string | null;\n tiles?: {\n report: string;\n title?: string;\n width?: number;\n }[];\n};\n\n/** Arguments of `reports.update-dashboard`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateDashboardParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: UpdateDashboardBody;\n};\n\n/** Success response of `reports.update-dashboard`. */\nexport type UpdateDashboardResponse = {\n dashboard: {\n id: string;\n name: string;\n description: string | null;\n tiles: {\n report: string;\n title?: string;\n width?: number;\n }[];\n updatedAt: string;\n };\n};\n\n/** Body of `reports.update-report`. */\nexport type UpdateReportBody = {\n name?: string;\n description?: string | null;\n query?: Record<string, unknown>;\n chart?: Record<string, unknown> | null;\n};\n\n/** Arguments of `reports.update-report`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type UpdateReportParams = {\n /** Path parameter. */\n id: string | number;\n /** JSON body. */\n body: UpdateReportBody;\n};\n\n/** Success response of `reports.update-report`. */\nexport type UpdateReportResponse = {\n report: {\n id: string;\n source: \"saved\" | \"kon\";\n konId: string | null;\n name: string;\n description: string | null;\n query: Record<string, unknown>;\n chart: Record<string, unknown> | null;\n updatedAt: string | null;\n };\n};\n\n/** Runtime description of every operation of kon-reports (path, method, pagination…). */\nexport const operations = {\n \"aggregate\": {\"kon\":\"kon-reports\",\"id\":\"aggregate\",\"operationId\":\"reports.aggregate\",\"method\":\"POST\",\"path\":\"/reports/aggregate\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:aggregate\",\"mcpTool\":\"reports_aggregate\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createDashboard\": {\"kon\":\"kon-reports\",\"id\":\"create-dashboard\",\"operationId\":\"reports.create-dashboard\",\"method\":\"POST\",\"path\":\"/reports/dashboards\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:reports:create-dashboard\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"createReport\": {\"kon\":\"kon-reports\",\"id\":\"create-report\",\"operationId\":\"reports.create-report\",\"method\":\"POST\",\"path\":\"/reports\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"201\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:reports:create-report\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteDashboard\": {\"kon\":\"kon-reports\",\"id\":\"delete-dashboard\",\"operationId\":\"reports.delete-dashboard\",\"method\":\"DELETE\",\"path\":\"/reports/dashboards/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:reports:delete-dashboard\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"deleteReport\": {\"kon\":\"kon-reports\",\"id\":\"delete-report\",\"operationId\":\"reports.delete-report\",\"method\":\"DELETE\",\"path\":\"/reports/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":false,\"sensitive\":true,\"scope\":\"kon:reports:delete-report\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getDashboard\": {\"kon\":\"kon-reports\",\"id\":\"get-dashboard\",\"operationId\":\"reports.get-dashboard\",\"method\":\"GET\",\"path\":\"/reports/dashboards/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:get-dashboard\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"getReport\": {\"kon\":\"kon-reports\",\"id\":\"get-report\",\"operationId\":\"reports.get-report\",\"method\":\"GET\",\"path\":\"/reports/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:get-report\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"listDashboards\": {\"kon\":\"kon-reports\",\"id\":\"list-dashboards\",\"operationId\":\"reports.list-dashboards\",\"method\":\"GET\",\"path\":\"/reports/dashboards\",\"pathParams\":[],\"queryParams\":[\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:list-dashboards\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"dashboards\",\"limit\":\"limit\"}},\n \"listReports\": {\"kon\":\"kon-reports\",\"id\":\"list-reports\",\"operationId\":\"reports.list-reports\",\"method\":\"GET\",\"path\":\"/reports\",\"pathParams\":[],\"queryParams\":[\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:list-reports\",\"mcpTool\":\"reports_list\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"reports\",\"limit\":\"limit\"}},\n \"runDashboard\": {\"kon\":\"kon-reports\",\"id\":\"run-dashboard\",\"operationId\":\"reports.run-dashboard\",\"method\":\"POST\",\"path\":\"/reports/dashboards/{id}/run\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:run-dashboard\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"runReport\": {\"kon\":\"kon-reports\",\"id\":\"run-report\",\"operationId\":\"reports.run-report\",\"method\":\"POST\",\"path\":\"/reports/run\",\"pathParams\":[],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:reports:run-report\",\"mcpTool\":\"reports_run\",\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateDashboard\": {\"kon\":\"kon-reports\",\"id\":\"update-dashboard\",\"operationId\":\"reports.update-dashboard\",\"method\":\"PATCH\",\"path\":\"/reports/dashboards/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:reports:update-dashboard\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n \"updateReport\": {\"kon\":\"kon-reports\",\"id\":\"update-report\",\"operationId\":\"reports.update-report\",\"method\":\"PATCH\",\"path\":\"/reports/{id}\",\"pathParams\":[\"id\"],\"queryParams\":[],\"body\":\"json\",\"responses\":{\"200\":\"json\"},\"idempotent\":false,\"readOnly\":false,\"sensitive\":false,\"scope\":\"kon:reports:update-report\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-reports\n *\n * Aggregate queries over kon tables and datasets, saved reports, kon-shipped reports and dashboards.\n */\nexport interface ReportsApi {\n /**\n * Run an aggregate query\n *\n * Computes count, count_distinct, sum, avg, min or max over a table an installed kon declares, or over a dataset, optionally grouped (with day/week/month/quarter/year buckets for dates) and filtered. Runs as you: row policies decide which rows are counted. Columns that hold secrets are refused. Returns one row per group, at most `limit` (default 100, max 1000); `truncated` says there were more.\n *\n * REST: `POST /api/reports/aggregate` · scope `kon:reports:aggregate`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `reports_aggregate`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly aggregate: Operation<AggregateParams, AggregateResponse>;\n /**\n * Create a dashboard\n *\n * An ordered list of tiles. Each tile names a report (a saved report's id, or `kon:<kon id>/<report id>`), with an optional title and a width from 1 to 12.\n *\n * REST: `POST /api/reports/dashboards` · scope `kon:reports:create-dashboard`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createDashboard: Operation<CreateDashboardParams, CreateDashboardResponse>;\n /**\n * Save a report\n *\n * Stores an aggregate query under a name, with an optional chart hint (`type`: table, number, bar, line, donut; `x`; `y`). The query is checked against the real tables first: a report that could not run is not saved.\n *\n * REST: `POST /api/reports` · scope `kon:reports:create-report`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly createReport: Operation<CreateReportParams, CreateReportResponse>;\n /**\n * Delete a dashboard\n *\n * Deletes the dashboard. Its reports are kept.\n *\n * REST: `DELETE /api/reports/dashboards/{id}` · scope `kon:reports:delete-dashboard`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteDashboard: Operation<DeleteDashboardParams, DeleteDashboardResponse>;\n /**\n * Delete a saved report\n *\n * Deletes the report. A dashboard tile that pointed at it shows that the report is gone.\n *\n * REST: `DELETE /api/reports/{id}` · scope `kon:reports:delete-report`\n * idempotent (safe to retry) · sensitive: may come back as a proposal pending human approval\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly deleteReport: Operation<DeleteReportParams, DeleteReportResponse>;\n /**\n * Read a dashboard\n *\n * One dashboard with its tiles.\n *\n * REST: `GET /api/reports/dashboards/{id}` · scope `kon:reports:get-dashboard`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getDashboard: Operation<GetDashboardParams, GetDashboardResponse>;\n /**\n * Read a saved report\n *\n * One saved report with its query and chart hint. Kon reports are read from list-reports.\n *\n * REST: `GET /api/reports/{id}` · scope `kon:reports:get-report`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly getReport: Operation<GetReportParams, GetReportResponse>;\n /**\n * List dashboards\n *\n * Every dashboard with its tiles. Each tile points at a report; run them with run-dashboard.\n *\n * REST: `GET /api/reports/dashboards` · scope `kon:reports:list-dashboards`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listDashboards: PageableOperation<ListDashboardsParams, ListDashboardsResponse, ListDashboardsItem>;\n /**\n * List reports\n *\n * The reports people saved (`source: saved`) and the ones installed kons ship (`source: kon`, read-only, id `kon:<kon id>/<report id>`), each with its query.\n *\n * REST: `GET /api/reports` · scope `kon:reports:list-reports`\n * idempotent (safe to retry) · MCP tool `reports_list`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listReports: PageableOperation<ListReportsParams, ListReportsResponse, ListReportsItem>;\n /**\n * Run every report of a dashboard\n *\n * Runs each tile's report and returns the results in tile order. A tile whose report is gone or fails carries `error` instead of `result`; the others still come back.\n *\n * REST: `POST /api/reports/dashboards/{id}/run` · scope `kon:reports:run-dashboard`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly runDashboard: Operation<RunDashboardParams, RunDashboardResponse>;\n /**\n * Run a report\n *\n * Runs a saved report (by id) or a kon's (`kon:<kon id>/<report id>`) and returns its result and its chart hint. Runs as you, like `aggregate`.\n *\n * REST: `POST /api/reports/run` · scope `kon:reports:run-report`\n * not idempotent (an Idempotency-Key is sent automatically) · MCP tool `reports_run`\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly runReport: Operation<RunReportParams, RunReportResponse>;\n /**\n * Change a dashboard\n *\n * Changes the name, the description or the whole list of tiles.\n *\n * REST: `PATCH /api/reports/dashboards/{id}` · scope `kon:reports:update-dashboard`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateDashboard: Operation<UpdateDashboardParams, UpdateDashboardResponse>;\n /**\n * Change a saved report\n *\n * Changes the name, the description, the query or the chart hint. A new query is checked like a new report.\n *\n * REST: `PATCH /api/reports/{id}` · scope `kon:reports:update-report`\n * not idempotent (an Idempotency-Key is sent automatically)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_NOT_FOUND`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_IDEMPOTENCY_KEY_REUSED`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly updateReport: Operation<UpdateReportParams, UpdateReportResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, PageableOperation } from \"../../api/types\";\n\n/* kon-secret-access: Who opened which secret a kon sealed with ctx.secrets (for administrators). */\n\n/** Arguments of `secret-access.list-secret-access`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListSecretAccessParams = {\n kon?: string | number;\n limit?: number;\n offset?: number;\n};\n\n/** Success response of `secret-access.list-secret-access`. */\nexport type ListSecretAccessResponse = {\n hasMore: boolean;\n entries: {\n id: string;\n konId: string;\n outcome: string;\n purpose: string;\n subject: string | null;\n actorUserId: string | null;\n requestId: string | null;\n createdAt: string;\n }[];\n};\n\n/** One item of the list `secret-access.list-secret-access` pages through. */\nexport type ListSecretAccessItem = {\n id: string;\n konId: string;\n outcome: string;\n purpose: string;\n subject: string | null;\n actorUserId: string | null;\n requestId: string | null;\n createdAt: string;\n};\n\n/** Runtime description of every operation of kon-secret-access (path, method, pagination…). */\nexport const operations = {\n \"listSecretAccess\": {\"kon\":\"kon-secret-access\",\"id\":\"list-secret-access\",\"operationId\":\"secret-access.list-secret-access\",\"method\":\"GET\",\"path\":\"/admin/secret-access\",\"pathParams\":[],\"queryParams\":[\"kon\",\"limit\",\"offset\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:secret-access:list-secret-access\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"entries\",\"limit\":\"limit\"}},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-secret-access\n *\n * Who opened which secret a kon sealed with ctx.secrets (for administrators).\n */\nexport interface SecretAccessApi {\n /**\n * Who opened which sealed secret\n *\n * The openings and refusals of secrets kons sealed with `ctx.secrets`, newest first: the kon, the purpose, the subject the kon named, the account and the request. Never a value.\n *\n * REST: `GET /api/admin/secret-access` · scope `kon:secret-access:list-secret-access`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listSecretAccess: PageableOperation<ListSecretAccessParams, ListSecretAccessResponse, ListSecretAccessItem>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo, Operation, PageableOperation } from \"../../api/types\";\n\n/* kon-traces: The glass box: one trace per request, in Postgres (administrators only). */\n\n/** Arguments of `traces.list-requests`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type ListRequestsParams = {\n hours?: number;\n limit?: number;\n offset?: number;\n blocked?: \"0\" | \"1\";\n errors?: \"0\" | \"1\";\n actor?: string | number;\n};\n\n/** Success response of `traces.list-requests`. */\nexport type ListRequestsResponse = {\n enabled: boolean;\n requests: Record<string, unknown>[];\n hasMore: boolean;\n};\n\n/** One item of the list `traces.list-requests` pages through. */\nexport type ListRequestsItem = Record<string, unknown>;\n\n/** Arguments of `traces.requests-summary`: path and query parameters flat, the body under `body` (same shape as its MCP tool). */\nexport type RequestsSummaryParams = {\n hours?: number;\n};\n\n/** Success response of `traces.requests-summary`. */\nexport type RequestsSummaryResponse = {\n enabled: boolean;\n operations: Record<string, unknown>[];\n};\n\n/** Runtime description of every operation of kon-traces (path, method, pagination…). */\nexport const operations = {\n \"listRequests\": {\"kon\":\"kon-traces\",\"id\":\"list-requests\",\"operationId\":\"traces.list-requests\",\"method\":\"GET\",\"path\":\"/admin/requests\",\"pathParams\":[],\"queryParams\":[\"hours\",\"limit\",\"offset\",\"blocked\",\"errors\",\"actor\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:traces:list-requests\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"],\"pagination\":{\"style\":\"offset\",\"items\":\"requests\",\"limit\":\"limit\"}},\n \"requestsSummary\": {\"kon\":\"kon-traces\",\"id\":\"requests-summary\",\"operationId\":\"traces.requests-summary\",\"method\":\"GET\",\"path\":\"/admin/requests/summary\",\"pathParams\":[],\"queryParams\":[\"hours\"],\"body\":null,\"responses\":{\"200\":\"json\"},\"idempotent\":true,\"readOnly\":true,\"sensitive\":false,\"scope\":\"kon:traces:requests-summary\",\"mcpTool\":null,\"errors\":[\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_INTERNAL\"]},\n} as const satisfies Record<string, OperationInfo>;\n\n/**\n * kon-traces\n *\n * The glass box: one trace per request, in Postgres (administrators only).\n */\nexport interface TracesApi {\n /**\n * Request traces (admin)\n *\n * Recorded requests, newest first: actor, kon, operation, duration, database time, rows written and blocked writes (owner filter or RLS). Writes, errors and blocks are always recorded; reads are sampled.\n *\n * REST: `GET /api/admin/requests` · scope `kon:traces:list-requests`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly listRequests: PageableOperation<ListRequestsParams, ListRequestsResponse, ListRequestsItem>;\n /**\n * Request traces by operation (admin)\n *\n * Per kon, operation and route: requests, 5xx errors, blocked writes, p95 duration, mean database time and rows written.\n *\n * REST: `GET /api/admin/requests/summary` · scope `kon:traces:requests-summary`\n * idempotent (safe to retry)\n * Errors: `KITSUDEN_E_VALIDATION`, `KITSUDEN_E_BAD_REQUEST`, `KITSUDEN_E_UNAUTHENTICATED`, `KITSUDEN_E_FORBIDDEN`, `KITSUDEN_E_RATE_LIMITED`, `KITSUDEN_E_INTERNAL`\n */\n readonly requestsSummary: Operation<RequestsSummaryParams, RequestsSummaryResponse>;\n}\n","// Generated by scripts/sdk/generate.mjs from packages/sdk/openapi/kitsuden.openapi.json. Do not edit: run `pnpm sdk:generate`.\n\nimport type { OperationInfo } from \"../api/types\";\n\nimport { operations as agentNotificationsOps, type AgentNotificationsApi } from \"./kons/agent-notifications\";\nimport { operations as agentTokenOps, type AgentTokenApi } from \"./kons/agent-token\";\nimport { operations as agentsOps, type AgentsApi } from \"./kons/agents\";\nimport { operations as analyticsOps, type AnalyticsApi } from \"./kons/analytics\";\nimport { operations as approvalsOps, type ApprovalsApi } from \"./kons/approvals\";\nimport { operations as auditOps, type AuditApi } from \"./kons/audit\";\nimport { operations as automationOps, type AutomationApi } from \"./kons/automation\";\nimport { operations as blocksOps, type BlocksApi } from \"./kons/blocks\";\nimport { operations as brainOps, type BrainApi } from \"./kons/brain\";\nimport { operations as connectionsOps, type ConnectionsApi } from \"./kons/connections\";\nimport { operations as datasetsOps, type DatasetsApi } from \"./kons/datasets\";\nimport { operations as externalMcpOps, type ExternalMcpApi } from \"./kons/external-mcp\";\nimport { operations as externalMcpOauthOps, type ExternalMcpOauthApi } from \"./kons/external-mcp-oauth\";\nimport { operations as mediaOps, type MediaApi } from \"./kons/media\";\nimport { operations as modelsOps, type ModelsApi } from \"./kons/models\";\nimport { operations as oauthOps, type OauthApi } from \"./kons/oauth\";\nimport { operations as promotionOps, type PromotionApi } from \"./kons/promotion\";\nimport { operations as promotionAdminOps, type PromotionAdminApi } from \"./kons/promotion-admin\";\nimport { operations as proposalsOps, type ProposalsApi } from \"./kons/proposals\";\nimport { operations as queueOps, type QueueApi } from \"./kons/queue\";\nimport { operations as recordHistoryOps, type RecordHistoryApi } from \"./kons/record-history\";\nimport { operations as reportsOps, type ReportsApi } from \"./kons/reports\";\nimport { operations as secretAccessOps, type SecretAccessApi } from \"./kons/secret-access\";\nimport { operations as tracesOps, type TracesApi } from \"./kons/traces\";\n\nexport * as AgentNotifications from \"./kons/agent-notifications\";\nexport * as AgentToken from \"./kons/agent-token\";\nexport * as Agents from \"./kons/agents\";\nexport * as Analytics from \"./kons/analytics\";\nexport * as Approvals from \"./kons/approvals\";\nexport * as Audit from \"./kons/audit\";\nexport * as Automation from \"./kons/automation\";\nexport * as Blocks from \"./kons/blocks\";\nexport * as Brain from \"./kons/brain\";\nexport * as Connections from \"./kons/connections\";\nexport * as Datasets from \"./kons/datasets\";\nexport * as ExternalMcp from \"./kons/external-mcp\";\nexport * as ExternalMcpOauth from \"./kons/external-mcp-oauth\";\nexport * as Media from \"./kons/media\";\nexport * as Models from \"./kons/models\";\nexport * as Oauth from \"./kons/oauth\";\nexport * as Promotion from \"./kons/promotion\";\nexport * as PromotionAdmin from \"./kons/promotion-admin\";\nexport * as Proposals from \"./kons/proposals\";\nexport * as Queue from \"./kons/queue\";\nexport * as RecordHistory from \"./kons/record-history\";\nexport * as Reports from \"./kons/reports\";\nexport * as SecretAccess from \"./kons/secret-access\";\nexport * as Traces from \"./kons/traces\";\n\n/** Version of the Kitsuden API this client was generated from. */\nexport const API_VERSION = \"0.9.0-beta\";\n\n/** Every `KITSUDEN_E_*` code the API can send (problem+json `code`). Branch on it. */\nexport const ERROR_CODES = [\"KITSUDEN_E_BAD_REQUEST\",\"KITSUDEN_E_VALIDATION\",\"KITSUDEN_E_UNAUTHENTICATED\",\"KITSUDEN_E_LEGACY_KEY_RETIRED\",\"KITSUDEN_E_FORBIDDEN\",\"KITSUDEN_E_NOT_FOUND\",\"KITSUDEN_E_METHOD_NOT_ALLOWED\",\"KITSUDEN_E_CONFLICT\",\"KITSUDEN_E_PAYLOAD_TOO_LARGE\",\"KITSUDEN_E_UNSUPPORTED_MEDIA_TYPE\",\"KITSUDEN_E_RATE_LIMITED\",\"KITSUDEN_E_QUOTA_EXCEEDED\",\"KITSUDEN_E_APPROVAL_REQUIRED\",\"KITSUDEN_E_APPROVAL_UNSUPPORTED\",\"KITSUDEN_E_APPROVAL_STALE\",\"KITSUDEN_E_DENIED_UNATTENDED\",\"KITSUDEN_E_AGENT_SPONSOR_INVALID\",\"KITSUDEN_E_IDEMPOTENCY_KEY_INVALID\",\"KITSUDEN_E_IDEMPOTENCY_KEY_REUSED\",\"KITSUDEN_E_IDEMPOTENCY_IN_PROGRESS\",\"KITSUDEN_E_IDEMPOTENCY_NOT_REPLAYABLE\",\"KITSUDEN_E_IDEMPOTENCY_UNAVAILABLE\",\"KITSUDEN_E_INTERNAL\",\"KITSUDEN_E_BAD_GATEWAY\",\"KITSUDEN_E_UNAVAILABLE\",\"KITSUDEN_E_DB_POOL_EXHAUSTED\",\"KITSUDEN_E_TIMEOUT\"] as const;\n\nexport type KitsudenErrorCode = (typeof ERROR_CODES)[number];\n\n/** The kons this client knows, each with its typed operations. */\nexport interface KitsudenKons {\n /** kon-agent-notifications: Where an agent is told that its proposals were resolved (administrators only). */\n readonly agentNotifications: AgentNotificationsApi;\n /** kon-agent-token: An agent exchanges its key for a short-lived token. */\n readonly agentToken: AgentTokenApi;\n /** kon-agents: Agent permissions, keys and quotas (admin only). */\n readonly agents: AgentsApi;\n /** kon-analytics: Views per subject and day, without cookies or personal data. */\n readonly analytics: AnalyticsApi;\n /** kon-approvals: Human approval of agent proposals (team members only; never an agent). */\n readonly approvals: ApprovalsApi;\n /** kon-audit: The agent audit hash chain: verify it and read its head (administrators only). */\n readonly audit: AuditApi;\n /** kon-automation: The catalog of events and steps for automation rules, and the dry run of an action. */\n readonly automation: AutomationApi;\n /** kon-blocks: Lego-style block system for dynamic page layouts with drag & drop. Includes Hero, Text, Image, Video, Grid, Cards, Quote, CTA, Embed, Divider, and Spacer blocks. */\n readonly blocks: BlocksApi;\n /** kon-brain: Agent memory: notes with an owner (private by default, optionally shared), connections with provenance, claims with evidence, OKF export and graphify import. */\n readonly brain: BrainApi;\n /** kon-connections: Accounts at other services (Google, Microsoft, API keys) that kons use without seeing a credential. */\n readonly connections: ConnectionsApi;\n /** kon-datasets: Dynamic data collections with automatic REST API */\n readonly datasets: DatasetsApi;\n /** kon-external-mcp: External MCP servers and the human review of their tools (human administrators only). */\n readonly externalMcp: ExternalMcpApi;\n /** kon-external-mcp-oauth: The OAuth redirect of external MCP servers. */\n readonly externalMcpOauth: ExternalMcpOauthApi;\n /** kon-media: Media file management with S3/MinIO storage */\n readonly media: MediaApi;\n /** kon-models: The models declared with defineModel in the mounted kons (for the admin panel). */\n readonly models: ModelsApi;\n /** kon-oauth: Consent and connected-client management for OAuth MCP clients (human admins and editors only). */\n readonly oauth: OauthApi;\n /** kon-promotion: Code promotion: an agent submits versioned drafts of a code action's code; they are tested in the sandbox, scanned and activated by a human approval (suggestion) or automatically when nothing widens permissions (turbo), with a watch window and automatic rollback. */\n readonly promotion: PromotionApi;\n /** kon-promotion-admin: Code promotion for admins: settings, agents' modes, approve, reject, roll back and activate (humans only). */\n readonly promotionAdmin: PromotionAdminApi;\n /** kon-proposals: An agent reads the status and result of its own proposals. */\n readonly proposals: ProposalsApi;\n /** kon-queue: The Postgres queue: status and dead jobs (administrators only). */\n readonly queue: QueueApi;\n /** kon-record-history: The change history of the rows of any explorable table (for the admin panel). */\n readonly recordHistory: RecordHistoryApi;\n /** kon-reports: Aggregate queries over kon tables and datasets, saved reports, kon-shipped reports and dashboards. */\n readonly reports: ReportsApi;\n /** kon-secret-access: Who opened which secret a kon sealed with ctx.secrets (for administrators). */\n readonly secretAccess: SecretAccessApi;\n /** kon-traces: The glass box: one trace per request, in Postgres (administrators only). */\n readonly traces: TracesApi;\n}\n\n/** Runtime description of every operation, by kon (camelCase) and operation (camelCase). */\nexport const KONS = {\n agentNotifications: agentNotificationsOps,\n agentToken: agentTokenOps,\n agents: agentsOps,\n analytics: analyticsOps,\n approvals: approvalsOps,\n audit: auditOps,\n automation: automationOps,\n blocks: blocksOps,\n brain: brainOps,\n connections: connectionsOps,\n datasets: datasetsOps,\n externalMcp: externalMcpOps,\n externalMcpOauth: externalMcpOauthOps,\n media: mediaOps,\n models: modelsOps,\n oauth: oauthOps,\n promotion: promotionOps,\n promotionAdmin: promotionAdminOps,\n proposals: proposalsOps,\n queue: queueOps,\n recordHistory: recordHistoryOps,\n reports: reportsOps,\n secretAccess: secretAccessOps,\n traces: tracesOps,\n} as const satisfies Record<string, Record<string, OperationInfo>>;\n","import type { KitsudenErrorCode } from \"../generated/index\";\n\nimport type { OperationInfo, Problem, ProposalPending, ResponseMeta } from \"./types\";\n\n/** An `/api/*` error response (problem+json). `code` is the stable thing to branch on. */\nexport class KitsudenApiError extends Error {\n readonly name = \"KitsudenApiError\";\n readonly status: number;\n readonly code: KitsudenErrorCode | (string & {});\n readonly problem: Problem;\n readonly retryable: boolean;\n /** Seconds the server asked to wait (`Retry-After` or `retry_after`), or `null`. */\n readonly retryAfter: number | null;\n readonly requestId: string | null;\n readonly meta: ResponseMeta;\n\n constructor(problem: Problem, meta: ResponseMeta, retryAfter: number | null) {\n super(\n `${problem.code}: ${problem.detail || problem.title}${problem.hint ? ` (${problem.hint})` : \"\"}`\n );\n this.status = meta.status;\n this.code = problem.code;\n this.problem = problem;\n this.retryable = problem.retryable === true;\n this.retryAfter = retryAfter;\n this.requestId =\n meta.requestId ?? (typeof problem.requestId === \"string\" ? problem.requestId : null);\n this.meta = meta;\n }\n}\n\n/** The request never got an HTTP response (DNS, refused connection, timeout, abort). */\nexport class KitsudenNetworkError extends Error {\n readonly name = \"KitsudenNetworkError\";\n readonly operation: OperationInfo | null;\n readonly attempts: number;\n readonly timedOut: boolean;\n\n constructor(\n message: string,\n opts: { cause?: unknown; operation: OperationInfo | null; attempts: number; timedOut: boolean }\n ) {\n super(message, { cause: opts.cause });\n this.operation = opts.operation;\n this.attempts = opts.attempts;\n this.timedOut = opts.timedOut;\n }\n}\n\n/** A success response whose body could not be decoded in the format it declared. */\nexport class KitsudenDecodeError extends Error {\n readonly name = \"KitsudenDecodeError\";\n readonly meta: ResponseMeta;\n\n constructor(message: string, meta: ResponseMeta, cause?: unknown) {\n super(message, { cause });\n this.meta = meta;\n }\n}\n\n/**\n * Thrown only where a pending proposal cannot be returned as a value\n * (`pages()`, `iterate()`, `expectOk()`). Calling an operation never throws it:\n * it returns `{ kind: \"proposal_pending\" }`.\n */\nexport class ProposalPendingError extends Error {\n readonly name = \"ProposalPendingError\";\n readonly pending: ProposalPending;\n\n constructor(pending: ProposalPending) {\n super(\n `${pending.problem.code}: proposal ${pending.proposal.id} is waiting for human approval; ` +\n `nothing ran. Do not resend it; poll ${pending.proposal.statusUrl}.`\n );\n this.pending = pending;\n }\n}\n\n/** `true` if `e` is an API error, optionally with one of these codes. */\nexport function isKitsudenError<C extends KitsudenErrorCode>(\n e: unknown,\n ...codes: C[]\n): e is KitsudenApiError & { code: C } {\n return (\n e instanceof KitsudenApiError && (codes.length === 0 || (codes as string[]).includes(e.code))\n );\n}\n","import { ProposalPendingError } from \"./errors\";\nimport type { CallOptions, Ok, OperationInfo, Outcome } from \"./types\";\n\ntype Call = (\n info: OperationInfo,\n params: Record<string, unknown>,\n options?: CallOptions\n) => Promise<Outcome<unknown>>;\n\nconst ITEM_FIELDS = [\"docs\", \"data\", \"items\", \"rows\", \"results\", \"entries\"];\n/** Where list responses keep their counters, in the order they are looked up. */\nconst CONTAINERS = [\"\", \"pagination\", \"meta\", \"pageInfo\"];\n\nfunction obj(v: unknown): Record<string, unknown> | null {\n return v && typeof v === \"object\" && !Array.isArray(v) ? (v as Record<string, unknown>) : null;\n}\n\n/** The items of one page (`field` from the generated info; guessed when it is `null`). */\nexport function itemsOf(data: unknown, field: string | null | undefined): unknown[] {\n if (Array.isArray(data)) return data;\n const o = obj(data);\n if (!o) return [];\n if (field) return Array.isArray(o[field]) ? (o[field] as unknown[]) : [];\n for (const k of ITEM_FIELDS) if (Array.isArray(o[k])) return o[k] as unknown[];\n const arrays = Object.values(o).filter(Array.isArray);\n return arrays.length === 1 ? (arrays[0] as unknown[]) : [];\n}\n\nfunction search(data: unknown, names: string[]): unknown {\n const o = obj(data);\n if (!o) return undefined;\n for (const c of CONTAINERS) {\n const where = c ? obj(o[c]) : o;\n if (!where) continue;\n for (const n of names) if (where[n] !== undefined && where[n] !== null) return where[n];\n }\n return undefined;\n}\n\nconst number = (v: unknown): number | undefined => {\n const n = typeof v === \"string\" ? Number(v) : v;\n return typeof n === \"number\" && Number.isFinite(n) ? n : undefined;\n};\n\n/** Walks the pages of a list operation, moving `page`, `offset` or `cursor`. */\nexport async function* pages(\n call: Call,\n info: OperationInfo,\n params: Record<string, unknown> = {},\n options?: CallOptions\n): AsyncIterableIterator<Ok<unknown>> {\n const paging = info.pagination;\n if (!paging) throw new TypeError(`${info.operationId} is not a list operation`);\n const p: Record<string, unknown> = { ...params };\n let page = number(p.page) ?? 1;\n let offset = number(p.offset) ?? 0;\n for (let round = 0; round < 100_000; round++) {\n if (paging.style === \"page\") p.page = page;\n if (paging.style === \"offset\") p.offset = offset;\n const out = await call(info, p, options);\n if (out.kind !== \"ok\") throw new ProposalPendingError(out);\n yield out;\n\n const items = itemsOf(out.data, paging.items);\n if (items.length === 0) return;\n const hasMore = search(out.data, [\"hasNextPage\", \"hasMore\", \"has_more\", \"hasNext\"]);\n if (hasMore === false) return;\n const limit =\n number(paging.limit ? p[paging.limit] : undefined) ??\n number(search(out.data, [\"limit\", \"pageSize\", \"perPage\"]));\n const short = hasMore !== true && limit !== undefined && items.length < limit;\n\n if (paging.style === \"cursor\") {\n const next = search(out.data, [\"nextCursor\", \"next_cursor\", \"cursor\"]);\n if (next === undefined || next === null || next === \"\" || next === p.cursor) return;\n p.cursor = next;\n continue;\n }\n if (short) return;\n if (paging.style === \"page\") {\n const totalPages = number(search(out.data, [\"totalPages\", \"pages\", \"pageCount\"]));\n if (totalPages !== undefined && page >= totalPages) return;\n page++;\n } else {\n offset += items.length;\n const total = number(search(out.data, [\"totalDocs\", \"total\", \"totalCount\", \"count\"]));\n if (total !== undefined && offset >= total) return;\n }\n }\n}\n\nexport async function* iterate(\n call: Call,\n info: OperationInfo,\n params: Record<string, unknown> = {},\n options?: CallOptions\n): AsyncIterableIterator<unknown> {\n for await (const page of pages(call, info, params, options)) {\n yield* itemsOf(page.data, info.pagination?.items);\n }\n}\n","/**\n * TRON decoder (Token Reduced Object Notation, https://tron-format.github.io/)\n * ============================================================================\n *\n * Decode only: the API encodes (with `@tron-format/tron`, pinned) and sends\n * TRON only after checking that it decodes back to the same data. This is an\n * independent implementation, written so the SDK keeps zero dependencies; its\n * parity with the reference parser is tested on shared fixtures\n * (`packages/sdk/tests/fixtures/tron-cases.json`, also read by the Python SDK).\n *\n * Grammar (what the API emits):\n *\n * document := header* value\n * header := \"class\" Name (\"(\" Parent \")\")? \":\" prop (\",\" | newline prop)*\n * value := null | true | false | number | string | array | object | Name \"(\" args \")\"\n * object := \"{\" (string \":\" value (\",\" …)*)? \"}\" keys are always quoted\n * args := positional values, then optional `prop=value` named ones\n *\n * `#` starts a comment until the end of the line; `;` and newlines separate.\n */\n\nexport class TronDecodeError extends SyntaxError {\n constructor(message: string) {\n super(`TRON: ${message}`);\n this.name = \"TronDecodeError\";\n }\n}\n\nconst enum T {\n Class,\n Ident,\n Str,\n Num,\n True,\n False,\n Null,\n LParen,\n RParen,\n LBracket,\n RBracket,\n LBrace,\n RBrace,\n Comma,\n Colon,\n Semi,\n Equals,\n Newline,\n Eof,\n}\n\ninterface Tok {\n t: T;\n v: string;\n at: number;\n}\n\nconst SYMBOLS: Record<string, T> = {\n \"(\": T.LParen,\n \")\": T.RParen,\n \"[\": T.LBracket,\n \"]\": T.RBracket,\n \"{\": T.LBrace,\n \"}\": T.RBrace,\n \",\": T.Comma,\n \":\": T.Colon,\n \";\": T.Semi,\n \"=\": T.Equals,\n};\nconst ESCAPES: Record<string, string> = {\n '\"': '\"',\n \"\\\\\": \"\\\\\",\n \"/\": \"/\",\n b: \"\\b\",\n f: \"\\f\",\n n: \"\\n\",\n r: \"\\r\",\n t: \"\\t\",\n};\n\nfunction tokens(src: string): Tok[] {\n const out: Tok[] = [];\n let i = 0;\n while (i < src.length) {\n const c = src[i]!;\n if (c === \" \" || c === \"\\t\" || c === \"\\r\") {\n i++;\n } else if (c === \"\\n\") {\n out.push({ t: T.Newline, v: c, at: i++ });\n } else if (c === \"#\") {\n while (i < src.length && src[i] !== \"\\n\") i++;\n } else if (c in SYMBOLS) {\n out.push({ t: SYMBOLS[c]!, v: c, at: i++ });\n } else if (c === '\"') {\n const at = i++;\n let v = \"\";\n for (;;) {\n if (i >= src.length) throw new TronDecodeError(`unterminated string at ${at}`);\n const d = src[i]!;\n if (d === '\"') {\n i++;\n break;\n }\n if (d === \"\\\\\") {\n const e = src[i + 1];\n if (e === undefined) throw new TronDecodeError(`unterminated string at ${at}`);\n if (e === \"u\") {\n const hex = src.slice(i + 2, i + 6);\n if (!/^[0-9a-fA-F]{4}$/.test(hex)) throw new TronDecodeError(`bad \\\\u escape at ${i}`);\n v += String.fromCharCode(parseInt(hex, 16));\n i += 6;\n } else {\n v += ESCAPES[e] ?? e;\n i += 2;\n }\n } else {\n v += d;\n i++;\n }\n }\n out.push({ t: T.Str, v, at });\n } else if (c === \"-\" || (c >= \"0\" && c <= \"9\")) {\n const at = i++;\n while (i < src.length && /[0-9.eE+-]/.test(src[i]!)) i++;\n out.push({ t: T.Num, v: src.slice(at, i), at });\n } else if (/[A-Za-z_]/.test(c)) {\n const at = i++;\n while (i < src.length && /[A-Za-z0-9_]/.test(src[i]!)) i++;\n const v = src.slice(at, i);\n const t =\n v === \"class\"\n ? T.Class\n : v === \"true\"\n ? T.True\n : v === \"false\"\n ? T.False\n : v === \"null\"\n ? T.Null\n : T.Ident;\n out.push({ t, v, at });\n } else {\n throw new TronDecodeError(`unexpected character '${c}' at ${i}`);\n }\n }\n out.push({ t: T.Eof, v: \"\", at: src.length });\n return out;\n}\n\n/** Decode a TRON document into plain JSON values. */\nexport function decodeTron(src: string): unknown {\n const tk = tokens(src);\n let p = 0;\n const classes = new Map<string, string[]>();\n const view = (t: T) => tk[p]!.t === t;\n const take = (t: T) => {\n if (view(t)) {\n p++;\n return true;\n }\n return false;\n };\n const require = (t: T, that: string) => {\n const k = tk[p]!;\n if (k.t !== t) throw new TronDecodeError(`expected ${that} at ${k.at}, found '${k.v}'`);\n p++;\n return k;\n };\n const separators = () => {\n while (take(T.Semi) || take(T.Newline));\n };\n const breaks = () => {\n while (take(T.Newline));\n };\n\n const kind = () => {\n const name = require(T.Ident, \"class name\").v;\n let props: string[] = [];\n if (take(T.LParen)) {\n const parent = require(T.Ident, \"parent class name\");\n const inherited = classes.get(parent.v);\n if (!inherited) throw new TronDecodeError(`undefined parent class ${parent.v}`);\n props = [...inherited];\n require(T.RParen, \"')'\");\n }\n require(T.Colon, \"':'\");\n while (!view(T.Semi) && !view(T.Class) && !view(T.Eof)) {\n if (take(T.Newline)) {\n if (view(T.Class) || view(T.Eof)) break;\n if (view(T.Ident) && tk[p + 1]?.t === T.LParen) break;\n if (!view(T.Ident) && !view(T.Str)) break;\n continue;\n }\n if (take(T.Comma)) continue;\n if (view(T.Ident) || view(T.Str)) props.push(tk[p++]!.v);\n else break;\n }\n classes.set(name, props);\n };\n\n const value = (): unknown => {\n const k = tk[p]!;\n switch (k.t) {\n case T.Null:\n p++;\n return null;\n case T.True:\n p++;\n return true;\n case T.False:\n p++;\n return false;\n case T.Num: {\n p++;\n const n = Number(k.v);\n if (Number.isNaN(n)) throw new TronDecodeError(`bad number '${k.v}' at ${k.at}`);\n return n;\n }\n case T.Str:\n p++;\n return k.v;\n case T.LBracket: {\n p++;\n const arr: unknown[] = [];\n for (;;) {\n breaks();\n if (view(T.RBracket)) break;\n arr.push(value());\n breaks();\n if (!take(T.Comma)) break;\n }\n require(T.RBracket, \"']'\");\n return arr;\n }\n case T.LBrace: {\n p++;\n const obj: Record<string, unknown> = {};\n for (;;) {\n breaks();\n if (view(T.RBrace)) break;\n const key = require(T.Str, \"quoted key\").v;\n require(T.Colon, \"':'\");\n defineNow(obj, key, value());\n breaks();\n if (!take(T.Comma)) break;\n }\n require(T.RBrace, \"'}'\");\n return obj;\n }\n case T.Ident:\n return instance();\n default:\n throw new TronDecodeError(`unexpected '${k.v}' at ${k.at}`);\n }\n };\n\n const instance = (): Record<string, unknown> => {\n const name = tk[p++]!;\n const props = classes.get(name.v);\n if (!props) throw new TronDecodeError(`undefined class ${name.v} at ${name.at}`);\n require(T.LParen, \"'('\");\n const obj: Record<string, unknown> = {};\n const placed = new Set<string>();\n let position = 0;\n let named = false;\n for (;;) {\n breaks();\n if (view(T.RParen)) break;\n if ((view(T.Ident) || view(T.Str)) && tk[p + 1]?.t === T.Equals) {\n named = true;\n const prop = tk[p]!;\n if (!props.includes(prop.v))\n throw new TronDecodeError(`unknown property ${prop.v} of ${name.v}`);\n if (placed.has(prop.v)) throw new TronDecodeError(`property ${prop.v} repeated`);\n p += 2;\n defineNow(obj, prop.v, value());\n placed.add(prop.v);\n } else {\n if (named)\n throw new TronDecodeError(`positional argument after a named one at ${tk[p]!.at}`);\n if (position >= props.length) throw new TronDecodeError(`too many arguments for ${name.v}`);\n const prop = props[position++]!;\n defineNow(obj, prop, value());\n placed.add(prop);\n }\n breaks();\n if (!take(T.Comma)) break;\n }\n if (placed.size < props.length) {\n throw new TronDecodeError(\n `missing arguments for ${name.v}: ${props.filter((x) => !placed.has(x)).join(\", \")}`\n );\n }\n require(T.RParen, \"')'\");\n return obj;\n };\n\n separators();\n while (take(T.Class)) {\n kind();\n separators();\n }\n if (view(T.Eof)) throw new TronDecodeError(\"no data section\");\n const data = value();\n separators();\n if (!view(T.Eof))\n throw new TronDecodeError(`unexpected '${tk[p]!.v}' after the data at ${tk[p]!.at}`);\n return data;\n}\n\n/** `obj[k] = v` that also works for `__proto__` (an own property, like JSON.parse). */\nfunction defineNow(obj: Record<string, unknown>, k: string, v: unknown): void {\n if (k === \"__proto__\")\n Object.defineProperty(obj, k, {\n value: v,\n enumerable: true,\n writable: true,\n configurable: true,\n });\n else obj[k] = v;\n}\n","/**\n * One HTTP call of the typed client: URL, headers, retries, decoding.\n *\n * Only `fetch`, `AbortController`, `Headers`, `URLSearchParams`, `TextDecoder`\n * and `crypto.getRandomValues` (all in Node 18+, Bun, Deno and browsers).\n */\n\nimport { decodeToon } from \"../toon\";\n\nimport { KitsudenApiError, KitsudenDecodeError, KitsudenNetworkError } from \"./errors\";\nimport { decodeTron } from \"./tron\";\nimport type {\n CallOptions,\n Format,\n OperationInfo,\n Outcome,\n Problem,\n Proposal,\n ProvenanceSummary,\n ResponseMeta,\n RetryPolicy,\n} from \"./types\";\n\nexport const MIME = {\n json: \"application/json\",\n toon: \"application/vnd.toon\",\n tron: \"application/vnd.tron\",\n auto: \"application/vnd.kitsuden.auto\",\n} as const;\n\nexport const DEFAULT_RETRY: RetryPolicy = {\n maxRetries: 2,\n baseDelayMs: 250,\n maxDelayMs: 8_000,\n maxRetryAfterMs: 60_000,\n};\n\n/** Statuses retried when the body is not a Kitsuden problem (a proxy in front, say). */\nconst RETRYABLE_WITHOUT_PROBLEM = new Set([408, 429, 502, 503, 504]);\n\nexport interface TransportConfig {\n baseUrl: string;\n token?: string;\n sessionCookie?: string;\n credentials?: RequestCredentials;\n fetch: typeof fetch;\n format: Format;\n provenance: boolean;\n untrustedWrap?: CallOptions[\"untrustedWrap\"];\n headers: Record<string, string>;\n timeoutMs: number;\n retry: RetryPolicy;\n sleep: (ms: number) => Promise<void>;\n random: () => number;\n newIdempotencyKey: () => string;\n}\n\n/** A random key that matches the server's pattern (`^[A-Za-z0-9_.:-]+$`, 8–128). */\nexport function randomIdempotencyKey(): string {\n const bytes = new Uint8Array(16);\n const c = (globalThis as { crypto?: { getRandomValues?: (a: Uint8Array) => Uint8Array } }).crypto;\n if (c?.getRandomValues) c.getRandomValues(bytes);\n else for (let i = 0; i < bytes.length; i++) bytes[i] = Math.floor(Math.random() * 256);\n let hex = \"\";\n for (const b of bytes) hex += b.toString(16).padStart(2, \"0\");\n return `ksdk-${hex}`;\n}\n\nfunction textValue(v: unknown): string {\n return typeof v === \"string\" ? v : JSON.stringify(v);\n}\n\n/** The URL of one call (path params encoded, query params like the MCP tools: text as is, the rest as JSON). */\nexport function buildUrl(\n baseUrl: string,\n info: OperationInfo,\n params: Record<string, unknown>\n): string {\n let path = info.path;\n for (const name of info.pathParams) {\n const v = params[name];\n if (v === undefined || v === null || v === \"\") {\n throw new TypeError(`${info.operationId}: missing path parameter '${name}'`);\n }\n path = path.replace(`{${name}}`, encodeURIComponent(textValue(v)));\n }\n const q = new URLSearchParams();\n for (const name of info.queryParams) {\n const v = params[name];\n if (v === undefined || v === null) continue;\n q.set(name, textValue(v));\n }\n const qs = q.toString();\n return `${baseUrl}/api${path === \"/\" ? \"\" : path}${qs ? `?${qs}` : \"\"}`;\n}\n\nexport function acceptFor(format: Format): string {\n return MIME[format];\n}\n\nexport function parseProvenance(raw: string | null): ProvenanceSummary | null {\n if (!raw) return null;\n const out: ProvenanceSummary = { untrusted: 0, authors: {}, raw };\n for (const part of raw.split(\";\")) {\n const [k, v] = part.split(\"=\").map((s) => s.trim());\n if (!k || v === undefined) continue;\n const n = Number(v);\n if (!Number.isFinite(n)) continue;\n if (k === \"untrusted\") out.untrusted = n;\n else out.authors[k] = n;\n }\n return out;\n}\n\n/** `Retry-After` in seconds (delta or HTTP date), or `null`. */\nexport function parseRetryAfter(v: string | null, now = Date.now()): number | null {\n if (!v) return null;\n const s = v.trim();\n if (/^\\d+(\\.\\d+)?$/.test(s)) return Number(s);\n const date = Date.parse(s);\n if (Number.isNaN(date)) return null;\n return Math.max(0, (date - now) / 1000);\n}\n\nfunction formatOf(\n contentType: string | null,\n header: string | null\n): \"json\" | \"toon\" | \"tron\" | null {\n const f = header?.trim().toLowerCase();\n if (f === \"json\" || f === \"toon\" || f === \"tron\") return f;\n if (!contentType) return null;\n if (contentType.includes(MIME.toon)) return \"toon\";\n if (contentType.includes(MIME.tron)) return \"tron\";\n if (contentType.includes(\"json\")) return \"json\";\n return null;\n}\n\nexport function metaOf(\n res: Response,\n info: OperationInfo | null,\n key: string | null,\n attempts: number\n): ResponseMeta {\n const contentType = res.headers.get(\"content-type\");\n return {\n status: res.status,\n headers: res.headers,\n requestId: res.headers.get(\"x-request-id\"),\n format: formatOf(contentType, res.headers.get(\"x-kitsuden-format\")),\n contentType,\n provenance: parseProvenance(res.headers.get(\"x-kitsuden-provenance\")),\n idempotencyKey: key,\n replayed: (res.headers.get(\"idempotent-replayed\") ?? \"\").toLowerCase() === \"true\",\n attempts,\n operation: info,\n };\n}\n\n/** Decode a text body according to its declared format. */\nexport function decodeBody(text: string, format: \"json\" | \"toon\" | \"tron\" | null): unknown {\n if (format === \"toon\") return decodeToon(text);\n if (format === \"tron\") return decodeTron(text);\n return text.length === 0 ? null : JSON.parse(text);\n}\n\nexport function problemOf(status: number, body: unknown, statusText: string): Problem {\n if (body && typeof body === \"object\" && typeof (body as Problem).code === \"string\") {\n const p = body as Problem;\n return { ...p, status: typeof p.status === \"number\" ? p.status : status };\n }\n // Not a Kitsuden problem (a proxy, an HTML page): synthesize one so callers have one shape.\n const detail =\n body && typeof body === \"object\" && \"error\" in body\n ? textValue((body as { error: unknown }).error)\n : typeof body === \"string\" && body\n ? body.slice(0, 500)\n : statusText || `HTTP ${status}`;\n return {\n type: \"about:blank\",\n title: statusText || `HTTP ${status}`,\n status,\n detail,\n code:\n status >= 500\n ? \"KITSUDEN_E_INTERNAL\"\n : status === 404\n ? \"KITSUDEN_E_NOT_FOUND\"\n : \"KITSUDEN_E_BAD_REQUEST\",\n retryable: RETRYABLE_WITHOUT_PROBLEM.has(status),\n retry_after: null,\n hint: \"\",\n docs: \"\",\n error: body,\n };\n}\n\nfunction backoffWait(attempt: number, r: RetryPolicy, random: () => number): number {\n const ceiling = Math.min(r.maxDelayMs, r.baseDelayMs * 2 ** attempt);\n return Math.round(random() * ceiling);\n}\n\nfunction readJsonSafe(t: string): unknown {\n try {\n return JSON.parse(t);\n } catch {\n return t;\n }\n}\n\nexport interface RawRequest {\n info: OperationInfo;\n params: Record<string, unknown>;\n body?: unknown;\n options?: CallOptions;\n}\n\n/**\n * Run one operation. Returns `ok` or `proposal_pending`; throws\n * `KitsudenApiError` / `KitsudenNetworkError` / `KitsudenDecodeError`.\n *\n * Retries ONLY when it is safe: the operation reads, is declared idempotent,\n * or carries an `Idempotency-Key` (the server replays instead of running it\n * twice). And only on a network failure or a response the server marks\n * `retryable` (429, 503…), waiting what `Retry-After` says. A 202 approval is\n * never retried.\n */\nexport async function execute<T>(cfg: TransportConfig, req: RawRequest): Promise<Outcome<T>> {\n const { info, params } = req;\n const o = req.options ?? {};\n const policy: RetryPolicy =\n o.retry === false ? { ...cfg.retry, maxRetries: 0 } : { ...cfg.retry, ...(o.retry ?? {}) };\n const format = o.format ?? cfg.format;\n const url = buildUrl(cfg.baseUrl, info, params);\n const write = info.method !== \"GET\";\n\n const headers: Record<string, string> = { accept: acceptFor(format), ...cfg.headers };\n if (cfg.token) headers.authorization = `Bearer ${cfg.token}`;\n if (cfg.sessionCookie) headers.cookie = cfg.sessionCookie;\n if (o.provenance ?? cfg.provenance) headers[\"x-kitsuden-provenance\"] = \"1\";\n const wrapper = o.untrustedWrap ?? cfg.untrustedWrap;\n if (wrapper) headers[\"x-kitsuden-untrusted-wrap\"] = wrapper;\n\n let body: BodyInit | undefined;\n if (req.body !== undefined && info.body !== null) {\n if (info.body === \"multipart\") {\n body = req.body as BodyInit;\n } else {\n headers[\"content-type\"] = \"application/json\";\n body = JSON.stringify(req.body);\n }\n }\n\n let key: string | null = null;\n if (write && o.idempotencyKey !== false) {\n key = typeof o.idempotencyKey === \"string\" ? o.idempotencyKey : cfg.newIdempotencyKey();\n headers[\"idempotency-key\"] = key;\n }\n Object.assign(headers, o.headers ?? {});\n\n const secure = !write || info.idempotent || info.readOnly || key !== null;\n const withRedirect = Object.values(info.responses).includes(\"redirect\");\n const deadline = o.timeoutMs ?? cfg.timeoutMs;\n\n for (let attempt = 0; ; attempt++) {\n const attempts = attempt + 1;\n const ctl = new AbortController();\n let byDeadline = false;\n const timer =\n deadline > 0 ? setTimeout(() => ((byDeadline = true), ctl.abort()), deadline) : undefined;\n const onAbort = () => ctl.abort();\n o.signal?.addEventListener(\"abort\", onAbort, { once: true });\n\n let res: Response;\n try {\n res = await cfg.fetch(url, {\n method: info.method,\n headers,\n body,\n signal: ctl.signal,\n ...(cfg.credentials ? { credentials: cfg.credentials } : {}),\n ...(withRedirect ? { redirect: \"manual\" as const } : {}),\n });\n } catch (err) {\n clearTimeout(timer);\n o.signal?.removeEventListener(\"abort\", onAbort);\n if (o.signal?.aborted) throw err;\n if (secure && attempt < policy.maxRetries) {\n await cfg.sleep(backoffWait(attempt, policy, cfg.random));\n continue;\n }\n throw new KitsudenNetworkError(\n `${info.method} ${url}: ${byDeadline ? `no response in ${deadline} ms` : ((err as Error)?.message ?? String(err))}`,\n { cause: err, operation: info, attempts, timedOut: byDeadline }\n );\n }\n\n try {\n const meta = metaOf(res, info, key, attempts);\n const type = (meta.contentType ?? \"\").toLowerCase();\n\n // ── 202: pending human approval. Never retried. ──\n // Recognized by its `code`, not by the media type: the API has sent it\n // both as application/problem+json and as application/json (measured\n // against a live API), and a client that asked for TOON/TRON may get it\n // in that format.\n if (res.status === 202 && (meta.format !== null || type.includes(\"json\"))) {\n const t = await res.text();\n let p: unknown;\n try {\n p = decodeBody(t, type.includes(\"problem+json\") ? \"json\" : meta.format);\n } catch {\n p = t;\n }\n const possible = p as (Problem & { proposal?: Proposal }) | null;\n if (\n possible &&\n typeof possible === \"object\" &&\n possible.code === \"KITSUDEN_E_APPROVAL_REQUIRED\"\n ) {\n return {\n kind: \"proposal_pending\",\n ok: false,\n status: 202,\n proposal: possible.proposal as Proposal,\n problem: possible,\n meta,\n };\n }\n return { kind: \"ok\", ok: true, status: 202, data: p as T, meta };\n }\n\n // ── Errors ──\n if (res.status >= 400 || (res.status >= 300 && !withRedirect)) {\n const raw = await res.text();\n const problem = problemOf(res.status, readJsonSafe(raw), res.statusText);\n const header = parseRetryAfter(res.headers.get(\"retry-after\"));\n const wait =\n header ?? (typeof problem.retry_after === \"number\" ? problem.retry_after : null);\n const retryable = problem.retryable === true;\n if (retryable && secure && attempt < policy.maxRetries) {\n const ms = wait !== null ? wait * 1000 : backoffWait(attempt, policy, cfg.random);\n if (ms <= policy.maxRetryAfterMs) {\n await cfg.sleep(ms);\n continue;\n }\n }\n throw new KitsudenApiError(problem, meta, wait);\n }\n\n // ── Success ──\n const kind = info.responses[String(res.status)];\n if (\n kind === \"redirect\" ||\n (res.status >= 300 && res.status < 400) ||\n res.type === \"opaqueredirect\"\n ) {\n return {\n kind: \"ok\",\n ok: true,\n status: res.status,\n data: { status: res.status, location: res.headers.get(\"location\") } as T,\n meta,\n };\n }\n if (res.status === 204 || kind === \"empty\") {\n return { kind: \"ok\", ok: true, status: res.status, data: null as T, meta };\n }\n const isText =\n meta.format !== null || type.startsWith(\"text/\") || type.includes(\"javascript\");\n if (kind === \"binary\" || (!isText && kind !== \"json\" && kind !== \"text\")) {\n return {\n kind: \"ok\",\n ok: true,\n status: res.status,\n data: (await res.arrayBuffer()) as T,\n meta,\n };\n }\n const t = await res.text();\n if (kind === \"text\" || (meta.format === null && !type.includes(\"json\"))) {\n return { kind: \"ok\", ok: true, status: res.status, data: t as T, meta };\n }\n let data: unknown;\n try {\n data = decodeBody(t, meta.format);\n } catch (err) {\n throw new KitsudenDecodeError(\n `${info.operationId}: could not decode the ${meta.format ?? \"json\"} body`,\n meta,\n err\n );\n }\n return { kind: \"ok\", ok: true, status: res.status, data: data as T, meta };\n } finally {\n clearTimeout(timer);\n o.signal?.removeEventListener(\"abort\", onAbort);\n }\n }\n}\n","/**\n * Streaming operations (`output.flow` on the server): Server-Sent Events read\n * as an `AsyncIterable` of typed events.\n *\n * for await (const step of api.imports.progress({ id })) {\n * console.log(step.done, \"/\", step.total);\n * }\n *\n * Standard SSE (`text/event-stream`), no custom protocol: every `data:` event\n * is one item (JSON), `event: end` closes the stream, `event: error` carries a\n * problem+json and throws `KitsudenApiError`. Breaking out of the loop aborts\n * the request, and the server closes its generator.\n *\n * Not retried: a stream may have done work by the time it fails. Zero\n * dependencies, like the rest of the client: `fetch` + `ReadableStream`.\n */\n\nimport { KitsudenApiError, KitsudenNetworkError } from \"./errors\";\nimport { buildUrl, metaOf, problemOf, type RawRequest, type TransportConfig } from \"./transport\";\nimport type { Problem } from \"./types\";\n\ninterface RawEvent {\n event?: string;\n data: string;\n}\n\nfunction parseBlock(block: string): RawEvent | null {\n const data: string[] = [];\n let event: string | undefined;\n for (const line of block.split(/\\r?\\n/)) {\n if (!line || line.startsWith(\":\")) continue;\n const i = line.indexOf(\":\");\n const field = i === -1 ? line : line.slice(0, i);\n const value = i === -1 ? \"\" : line.slice(i + 1).replace(/^ /, \"\");\n if (field === \"data\") data.push(value);\n else if (field === \"event\") event = value;\n }\n if (data.length === 0 && !event) return null;\n return { event, data: data.join(\"\\n\") };\n}\n\nfunction json(t: string): unknown {\n try {\n return JSON.parse(t);\n } catch {\n return t;\n }\n}\n\nexport async function* streamEvents<E>(\n cfg: TransportConfig,\n req: RawRequest\n): AsyncGenerator<E, void, undefined> {\n const { info, params } = req;\n const o = req.options ?? {};\n const url = buildUrl(cfg.baseUrl, info, params);\n const headers: Record<string, string> = { ...cfg.headers, accept: \"text/event-stream\" };\n if (cfg.token) headers.authorization = `Bearer ${cfg.token}`;\n if (cfg.sessionCookie) headers.cookie = cfg.sessionCookie;\n let body: BodyInit | undefined;\n if (req.body !== undefined && info.body !== null) {\n if (info.body === \"multipart\") body = req.body as BodyInit;\n else {\n headers[\"content-type\"] = \"application/json\";\n body = JSON.stringify(req.body);\n }\n }\n Object.assign(headers, o.headers ?? {});\n\n const ctl = new AbortController();\n const onAbort = () => ctl.abort();\n o.signal?.addEventListener(\"abort\", onAbort, { once: true });\n\n let res: Response;\n try {\n res = await cfg.fetch(url, {\n method: info.method,\n headers,\n body,\n signal: ctl.signal,\n ...(cfg.credentials ? { credentials: cfg.credentials } : {}),\n });\n } catch (err) {\n o.signal?.removeEventListener(\"abort\", onAbort);\n if (o.signal?.aborted) throw err;\n throw new KitsudenNetworkError(\n `${info.method} ${url}: ${(err as Error)?.message ?? String(err)}`,\n {\n cause: err,\n operation: info,\n attempts: 1,\n timedOut: false,\n }\n );\n }\n\n const meta = metaOf(res, info, null, 1);\n const type = (res.headers.get(\"content-type\") ?? \"\").toLowerCase();\n if (res.status !== 200 || !type.includes(\"text/event-stream\") || !res.body) {\n // Not a stream: an error (or anything else) answered before it started.\n o.signal?.removeEventListener(\"abort\", onAbort);\n const t = await res.text();\n const p = json(t);\n const problem =\n p && typeof p === \"object\" && \"code\" in (p as object)\n ? (p as Problem)\n : problemOf(res.status, p, res.statusText);\n throw new KitsudenApiError(problem, meta, null);\n }\n\n const reader = res.body.getReader();\n const decoder = new TextDecoder();\n let rest = \"\";\n let finished = false;\n try {\n for (;;) {\n const { value, done } = await reader.read();\n if (value) rest += decoder.decode(value, { stream: true });\n if (done) rest += decoder.decode();\n const blocks = rest.split(/\\r?\\n\\r?\\n/);\n rest = done ? \"\" : (blocks.pop() ?? \"\");\n for (const b of blocks) {\n const ev = parseBlock(b);\n if (!ev) continue;\n if (ev.event === \"end\") {\n finished = true;\n return;\n }\n if (ev.event === \"error\") {\n finished = true;\n const p = json(ev.data);\n const problem =\n p && typeof p === \"object\" && \"code\" in (p as object)\n ? (p as Problem)\n : problemOf(500, p, \"Stream error\");\n throw new KitsudenApiError(problem, meta, null);\n }\n if (!ev.event || ev.event === \"message\") yield json(ev.data) as E;\n }\n if (done) {\n finished = true;\n return;\n }\n }\n } finally {\n o.signal?.removeEventListener(\"abort\", onAbort);\n if (!finished) {\n // The caller stopped iterating: close the connection (the server\n // cancels its generator and runs its `finally`).\n ctl.abort();\n await reader.cancel().catch(() => {});\n }\n }\n}\n","/**\n * The typed Kitsuden client: one property per kon, one typed method per\n * operation, generated from the API's OpenAPI 3.1 (`src/generated/**`).\n *\n * @example\n * ```ts\n * import { createKitsuden } from \"@kitsuden/sdk\";\n *\n * const kitsuden = createKitsuden(); // KITSUDEN_API_URL + KITSUDEN_API_TOKEN\n * const res = await kitsuden.media.listMedia({ limit: 5 });\n * if (res.kind === \"ok\") console.log(res.data.docs.map((p) => p.title));\n * ```\n */\n\nimport { KONS, type KitsudenKons } from \"../generated/index\";\n\nimport { ProposalPendingError } from \"./errors\";\nimport { iterate, pages } from \"./pagination\";\nimport { streamEvents } from \"./stream\";\nimport { DEFAULT_RETRY, execute, randomIdempotencyKey, type TransportConfig } from \"./transport\";\nimport type {\n CallOptions,\n Format,\n Ok,\n OperationInfo,\n Outcome,\n RecordProvenance,\n RetryPolicy,\n} from \"./types\";\n\nexport interface KitsudenApiOptions {\n /**\n * Origin of the API (`https://api.example.com`; a trailing `/api` is\n * accepted). Default: `KITSUDEN_API_URL`, else the page's origin in a\n * browser. There is no localhost default on purpose.\n */\n baseUrl?: string;\n /** Agent key (`kitsuden_agent_…`). Default: `KITSUDEN_API_TOKEN`. `null` = do not read the environment. */\n token?: string | null;\n /** Session cookie for server-side code (`better-auth.session_token=…`). */\n sessionCookie?: string;\n /** Browsers: `\"include\"` sends the panel's session cookie cross-origin. */\n credentials?: RequestCredentials;\n /** Default wire format for responses (default `json`). Bodies are always decoded. */\n format?: Format;\n /** Ask for provenance on every call (`X-Kitsuden-Provenance: 1`). */\n provenance?: boolean;\n untrustedWrap?: CallOptions[\"untrustedWrap\"];\n /** Extra headers on every request. */\n headers?: Record<string, string>;\n /** Per-attempt timeout (default 30 s; `0` = none). */\n timeoutMs?: number;\n retry?: Partial<RetryPolicy> | false;\n /** Your own `fetch` (tests, proxies, instrumented clients). */\n fetch?: typeof fetch;\n /** Generator of `Idempotency-Key` values (default: 128 random bits). */\n idempotencyKey?: () => string;\n /** @internal tests */\n sleep?: (ms: number) => Promise<void>;\n /** @internal tests */\n random?: () => number;\n}\n\nfunction environment(name: string): string | undefined {\n const g = globalThis as {\n process?: { env?: Record<string, string | undefined> };\n Deno?: { env?: { get?: (n: string) => string | undefined } };\n };\n try {\n const v = g.process?.env?.[name] ?? g.Deno?.env?.get?.(name);\n return v && v.trim() ? v.trim() : undefined;\n } catch {\n return undefined; // Deno without --allow-env\n }\n}\n\nfunction origin(): string | undefined {\n const l = (globalThis as { location?: { origin?: string } }).location;\n return l?.origin && l.origin !== \"null\" ? l.origin : undefined;\n}\n\nexport function normalizeBaseUrl(url: string): string {\n // A loop, not `/\\/+$/`: that regex is quadratic on a long run of slashes.\n const trimmed = url.trim();\n let end = trimmed.length;\n while (end > 0 && trimmed[end - 1] === \"/\") end--;\n const base = trimmed.slice(0, end);\n return base.endsWith(\"/api\") ? base.slice(0, -4) : base;\n}\n\ntype Call = (\n info: OperationInfo,\n params: Record<string, unknown>,\n options?: CallOptions\n) => Promise<Outcome<unknown>>;\n\ntype Stream = (\n info: OperationInfo,\n params: Record<string, unknown>,\n options?: CallOptions\n) => AsyncIterableIterator<unknown>;\n\nfunction operation(call: Call, info: OperationInfo, stream: Stream) {\n if (info.stream) {\n const s = ((params?: Record<string, unknown>, options?: CallOptions) =>\n stream(info, params ?? {}, options)) as {\n (params?: Record<string, unknown>, options?: CallOptions): AsyncIterableIterator<unknown>;\n info: OperationInfo;\n };\n s.info = info;\n return Object.freeze(s);\n }\n const f = ((params?: Record<string, unknown>, options?: CallOptions) =>\n call(info, params ?? {}, options)) as {\n (params?: Record<string, unknown>, options?: CallOptions): Promise<Outcome<unknown>>;\n info: OperationInfo;\n pages?: unknown;\n iterate?: unknown;\n };\n f.info = info;\n if (info.pagination) {\n f.pages = (params?: Record<string, unknown>, options?: CallOptions) =>\n pages(call, info, params ?? {}, options);\n f.iterate = (params?: Record<string, unknown>, options?: CallOptions) =>\n iterate(call, info, params ?? {}, options);\n }\n return Object.freeze(f);\n}\n\nexport interface RawCall extends CallOptions {\n query?: Record<string, unknown>;\n body?: unknown;\n /** `json` (default) or `multipart` (pass a FormData). */\n bodyFormat?: \"json\" | \"multipart\";\n}\n\n// The kon properties are defined in the constructor from the generated table\n// (`Object.defineProperty`), so the class cannot declare them itself; the\n// interface gives them their types. Safe here: every merged member exists at\n// runtime, which the \"generated surface\" test checks.\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport interface KitsudenApi extends KitsudenKons {}\n\n/** Typed client of a Kitsuden API. Every kon is a property; see `operations` for the list. */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging\nexport class KitsudenApi {\n readonly #cfg: TransportConfig;\n readonly #options: KitsudenApiOptions;\n\n constructor(options: KitsudenApiOptions = {}) {\n const base = options.baseUrl ?? environment(\"KITSUDEN_API_URL\") ?? origin();\n if (!base) {\n throw new TypeError(\n \"Kitsuden: no API URL. Pass { baseUrl } or set KITSUDEN_API_URL (the origin, e.g. http://localhost:13000).\"\n );\n }\n const token =\n options.token === null ? undefined : (options.token ?? environment(\"KITSUDEN_API_TOKEN\"));\n this.#options = options;\n const f = options.fetch ?? (globalThis.fetch as typeof fetch | undefined);\n if (!f) throw new TypeError(\"Kitsuden: no fetch in this runtime; pass { fetch }.\");\n this.#cfg = {\n baseUrl: normalizeBaseUrl(base),\n token,\n sessionCookie: options.sessionCookie,\n credentials: options.credentials,\n fetch: options.fetch ? f : (f.bind(globalThis) as typeof fetch),\n format: options.format ?? \"json\",\n provenance: options.provenance ?? false,\n untrustedWrap: options.untrustedWrap,\n headers: { ...(options.headers ?? {}) },\n timeoutMs: options.timeoutMs ?? 30_000,\n retry:\n options.retry === false\n ? { ...DEFAULT_RETRY, maxRetries: 0 }\n : { ...DEFAULT_RETRY, ...(options.retry ?? {}) },\n sleep: options.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms))),\n random: options.random ?? Math.random,\n newIdempotencyKey: options.idempotencyKey ?? randomIdempotencyKey,\n };\n const call: Call = (info, params, opts) => {\n const { body, ...rest } = params;\n return execute(this.#cfg, { info, params: rest, body, options: opts });\n };\n const stream: Stream = (info, params, opts) => {\n const { body, ...rest } = params;\n return streamEvents(this.#cfg, { info, params: rest, body, options: opts });\n };\n for (const [kon, ops] of Object.entries(KONS)) {\n const group: Record<string, unknown> = {};\n for (const [name, info] of Object.entries(ops))\n group[name] = operation(call, info as OperationInfo, stream);\n Object.defineProperty(this, kon, { value: Object.freeze(group), enumerable: true });\n }\n }\n\n /** Base URL in use (origin, without `/api`). */\n get baseUrl(): string {\n return this.#cfg.baseUrl;\n }\n\n /** Every operation this client knows (kon, id, method, path, scope, MCP tool…), for discovery. */\n get operations(): OperationInfo[] {\n return Object.values(KONS).flatMap((ops) => Object.values(ops) as OperationInfo[]);\n }\n\n /** A copy with other defaults (`client.withOptions({ format: \"auto\" })`). */\n withOptions(options: KitsudenApiOptions): KitsudenApi {\n return new KitsudenApi({\n ...this.#options,\n baseUrl: this.#cfg.baseUrl,\n token: this.#cfg.token ?? null,\n ...options,\n });\n }\n\n /**\n * Any route, untyped (legacy routes without a contract). Same auth,\n * retries, idempotency, formats and approval handling as the typed methods.\n * `path` is under `/api` (`/health`, `/items/games`).\n */\n request<T = unknown>(\n method: OperationInfo[\"method\"],\n path: string,\n call: RawCall = {}\n ): Promise<Outcome<T>> {\n const { query, body, bodyFormat, ...opts } = call;\n const clean = path.startsWith(\"/\") ? path : `/${path}`;\n const info: OperationInfo = {\n kon: \"\",\n id: \"\",\n operationId: `${method} ${clean}`,\n method,\n path: clean,\n pathParams: [],\n queryParams: Object.keys(query ?? {}),\n body: body === undefined ? null : (bodyFormat ?? \"json\"),\n responses: {},\n idempotent: method === \"GET\" || method === \"PUT\" || method === \"DELETE\",\n readOnly: method === \"GET\",\n sensitive: false,\n scope: null,\n mcpTool: null,\n errors: [],\n };\n return execute<T>(this.#cfg, { info, params: { ...(query ?? {}) }, body, options: opts });\n }\n}\n\n/** `new KitsudenApi(options)`. */\nexport function createKitsuden(options: KitsudenApiOptions = {}): KitsudenApi {\n return new KitsudenApi(options);\n}\n\n/** The data of an `ok` outcome; throws `ProposalPendingError` if it is a pending proposal. */\nexport function expectOk<T>(outcome: Outcome<T>): T {\n if (outcome.kind === \"ok\") return outcome.data;\n throw new ProposalPendingError(outcome);\n}\n\n/** `true` when the outcome is a proposal waiting for a human. */\nexport function isProposalPending<T>(outcome: Outcome<T>): outcome is Exclude<Outcome<T>, Ok<T>> {\n return outcome.kind === \"proposal_pending\";\n}\n\n/** Who wrote this row (`_provenance`, present when the call asked for provenance). */\nexport function provenanceOf(row: unknown): RecordProvenance | null {\n const p = (row as { _provenance?: RecordProvenance } | null)?._provenance;\n return p && typeof p === \"object\" ? p : null;\n}\n","/**\n * Standard Schema (https://standardschema.dev) from the API's JSON Schemas.\n *\n * The server's schemas are Zod 4, which already implements Standard Schema:\n * code that shares them (a kon, the starter) can hand them to any library\n * that speaks it. A client that only has the API needs something else: the\n * OpenAPI document. These helpers turn its JSON Schemas into Standard Schema\n * validators, so a form library, tRPC-style tooling or your own code can\n * validate a body BEFORE sending it, with whatever validator ecosystem it uses\n * (Zod, Valibot and ArkType all consume Standard Schema).\n *\n * import spec from \"@kitsuden/sdk/openapi.json\" with { type: \"json\" };\n * import { operationSchemas } from \"@kitsuden/sdk\";\n *\n * const { body } = operationSchemas(spec, \"blog.create-post\");\n * const r = await body![\"~standard\"].validate(input);\n * if (r.issues) showErrors(r.issues);\n *\n * Zero dependencies: a compact validator for the JSON Schema subset the API\n * emits (types, properties, required, additionalProperties, items, enum,\n * const, anyOf/oneOf/allOf, lengths, bounds, pattern, `$ref`). Unknown\n * keywords are ignored, never rejected: the server stays the authority.\n */\n\ntype Json = Record<string, unknown>;\n\n/** The Standard Schema v1 contract (inlined: no dependency). */\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n readonly \"~standard\": {\n readonly version: 1;\n readonly vendor: string;\n readonly validate: (value: unknown) => StandardResult<Output> | Promise<StandardResult<Output>>;\n readonly types?: { readonly input: Input; readonly output: Output };\n };\n}\n\nexport type StandardResult<Output> =\n | { readonly value: Output; readonly issues?: undefined }\n | { readonly issues: ReadonlyArray<StandardIssue> };\n\nexport interface StandardIssue {\n readonly message: string;\n readonly path?: ReadonlyArray<PropertyKey>;\n}\n\ntype Path = PropertyKey[];\n\nfunction typeOf(v: unknown): string {\n if (v === null) return \"null\";\n if (Array.isArray(v)) return \"array\";\n if (typeof v === \"number\") return Number.isInteger(v) ? \"integer\" : \"number\";\n return typeof v;\n}\n\nfunction fits(type: string, v: unknown): boolean {\n const real = typeOf(v);\n return real === type || (type === \"number\" && real === \"integer\");\n}\n\nfunction resolver(s: unknown, root: Json): Json {\n let actual = (s ?? {}) as Json;\n for (let i = 0; i < 20 && typeof actual.$ref === \"string\"; i++) {\n const ref = actual.$ref as string;\n if (!ref.startsWith(\"#/\")) return {};\n actual = ref\n .slice(2)\n .split(\"/\")\n .reduce<unknown>(\n (o, k) => (o as Json | undefined)?.[k.replace(/~1/g, \"/\").replace(/~0/g, \"~\")],\n root\n ) as Json;\n if (!actual) return {};\n }\n return actual;\n}\n\nfunction validate(\n schema: unknown,\n v: unknown,\n root: Json,\n route: Path,\n failures: StandardIssue[]\n): void {\n const s = resolver(schema, root);\n const failure = (message: string) => failures.push({ message, path: [...route] });\n\n if (\"const\" in s && JSON.stringify(s.const) !== JSON.stringify(v))\n return void failure(`must be ${JSON.stringify(s.const)}`);\n if (Array.isArray(s.enum) && !s.enum.some((e) => JSON.stringify(e) === JSON.stringify(v))) {\n return void failure(`must be one of ${s.enum.map((e) => JSON.stringify(e)).join(\", \")}`);\n }\n for (const sub of (s.allOf as unknown[] | undefined) ?? [])\n validate(sub, v, root, route, failures);\n for (const key of [\"anyOf\", \"oneOf\"] as const) {\n const options = s[key] as unknown[] | undefined;\n if (!options?.length) continue;\n const valid = options.filter((o) => {\n const f: StandardIssue[] = [];\n validate(o, v, root, route, f);\n return f.length === 0;\n }).length;\n if (key === \"anyOf\" ? valid === 0 : valid !== 1)\n return void failure(\n `does not match ${key === \"anyOf\" ? \"any\" : \"exactly one\"} of the allowed shapes`\n );\n }\n\n if (s.type !== undefined) {\n const types = (Array.isArray(s.type) ? s.type : [s.type]) as string[];\n if (s.nullable === true) types.push(\"null\");\n if (!types.some((t) => fits(t, v))) return void failure(`must be ${types.join(\" or \")}`);\n }\n\n if (typeof v === \"string\") {\n if (typeof s.minLength === \"number\" && v.length < s.minLength)\n failure(`must have at least ${s.minLength} characters`);\n if (typeof s.maxLength === \"number\" && v.length > s.maxLength)\n failure(`must have at most ${s.maxLength} characters`);\n if (typeof s.pattern === \"string\") {\n try {\n if (!new RegExp(s.pattern, \"u\").test(v)) failure(`must match ${s.pattern}`);\n } catch {\n /* a pattern this runtime cannot compile: the server checks it */\n }\n }\n }\n if (typeof v === \"number\") {\n if (typeof s.minimum === \"number\" && v < s.minimum) failure(`must be >= ${s.minimum}`);\n if (typeof s.maximum === \"number\" && v > s.maximum) failure(`must be <= ${s.maximum}`);\n if (typeof s.exclusiveMinimum === \"number\" && v <= s.exclusiveMinimum)\n failure(`must be > ${s.exclusiveMinimum}`);\n if (typeof s.exclusiveMaximum === \"number\" && v >= s.exclusiveMaximum)\n failure(`must be < ${s.exclusiveMaximum}`);\n }\n if (Array.isArray(v)) {\n if (typeof s.minItems === \"number\" && v.length < s.minItems)\n failure(`must have at least ${s.minItems} items`);\n if (typeof s.maxItems === \"number\" && v.length > s.maxItems)\n failure(`must have at most ${s.maxItems} items`);\n if (s.items && typeof s.items === \"object\")\n v.forEach((x, i) => validate(s.items, x, root, [...route, i], failures));\n }\n if (typeOf(v) === \"object\") {\n const o = v as Json;\n const props = (s.properties ?? {}) as Json;\n for (const req of (s.required as string[] | undefined) ?? []) {\n if (o[req] === undefined) failures.push({ message: \"is required\", path: [...route, req] });\n }\n for (const [k, x] of Object.entries(o)) {\n if (x === undefined) continue;\n if (k in props) validate(props[k], x, root, [...route, k], failures);\n else if (s.additionalProperties === false)\n failures.push({ message: \"is not allowed\", path: [...route, k] });\n else if (s.additionalProperties && typeof s.additionalProperties === \"object\") {\n validate(s.additionalProperties, x, root, [...route, k], failures);\n }\n }\n }\n}\n\n/**\n * A Standard Schema validator for a JSON Schema. `root` resolves `$ref`\n * (`#/components/schemas/…`): pass the whole OpenAPI document.\n */\nexport function toStandardSchema<T = unknown>(\n schema: unknown,\n root: unknown = schema\n): StandardSchemaV1<T> {\n return {\n \"~standard\": {\n version: 1,\n vendor: \"kitsuden\",\n validate(value: unknown) {\n const issues: StandardIssue[] = [];\n validate(schema, value, (root ?? {}) as Json, [], issues);\n return issues.length ? { issues } : { value: value as T };\n },\n },\n };\n}\n\n/**\n * The body and success-response schemas of one operation of an OpenAPI\n * document, as Standard Schema. `operationId` is `kon.operation`\n * (`blog.create-post`), the same as `OperationInfo.operationId`.\n */\nexport function operationSchemas(\n spec: unknown,\n operationId: string\n): { body: StandardSchemaV1 | null; response: StandardSchemaV1 | null } {\n const paths = ((spec as Json)?.paths ?? {}) as Record<string, Record<string, Json>>;\n for (const methods of Object.values(paths)) {\n for (const o of Object.values(methods)) {\n if (o?.operationId !== operationId) continue;\n const body = (\n (o.requestBody as Json | undefined)?.content as Record<string, Json> | undefined\n )?.[\"application/json\"]?.schema;\n const responses = (o.responses ?? {}) as Record<string, Json>;\n const success = Object.keys(responses)\n .sort()\n .find((k) => /^2\\d\\d$/.test(k));\n const content = success ? ((responses[success]?.content ?? {}) as Record<string, Json>) : {};\n const resp =\n content[\"application/json\"]?.schema ??\n content[\"text/event-stream\"]?.[\"x-kitsuden-event-schema\"];\n return {\n body: body ? toStandardSchema(body, spec) : null,\n response: resp ? toStandardSchema(resp, spec) : null,\n };\n }\n }\n throw new TypeError(`operationSchemas: no operation '${operationId}' in this document`);\n}\n"],"mappings":"sbAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,iBAAAE,GAAA,uBAAAC,GAAA,eAAAC,GAAA,WAAAC,GAAA,cAAAC,GAAA,cAAAC,GAAA,UAAAC,GAAA,eAAAC,GAAA,WAAAC,GAAA,UAAAC,GAAA,kBAAAC,GAAA,gBAAAC,GAAA,kBAAAC,EAAA,aAAAC,GAAA,gBAAAC,GAAA,gBAAAC,GAAA,qBAAAC,GAAA,aAAAC,GAAA,SAAAC,GAAA,aAAAC,GAAA,gBAAAC,EAAA,qBAAAC,EAAA,mBAAAC,EAAA,wBAAAC,EAAA,kBAAAC,EAAA,yBAAAC,EAAA,UAAAC,GAAA,WAAAC,GAAA,UAAAC,GAAA,cAAAC,GAAA,mBAAAC,GAAA,yBAAAC,EAAA,cAAAC,GAAA,UAAAC,GAAA,kBAAAC,GAAA,YAAAC,GAAA,iBAAAC,GAAA,aAAAC,GAAA,oBAAAC,EAAA,WAAAC,GAAA,oBAAAC,EAAA,iBAAAC,GAAA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AAUkB,CAAK,IAAIX,CAAE,IAAIgB,CAAQ,GAAG,KAAK,MAAMvB,CAAO,CAAC,EAAE,CAClF,CACF,EAaO,SAASwB,GACdrC,EACAsC,EACAvC,EAAuB,OACP,CAChB,OAAO,IAAI8B,EAAe,CAAE,IAAA7B,EAAK,OAAAsC,EAAQ,OAAAvC,CAAO,CAAC,CACnD,CAOO,IAAMwC,GAAWV,EAMjBW,GAAQX","names":["index_exports","__export","API_VERSION","agent_notifications_exports","agent_token_exports","agents_exports","analytics_exports","approvals_exports","audit_exports","automation_exports","blocks_exports","brain_exports","CollectionRef","connections_exports","DEFAULT_RETRY","datasets_exports","ERROR_CODES","external_mcp_exports","external_mcp_oauth_exports","GraphAPI","KONS","Kitsuden","KitsudenApi","KitsudenApiError","KitsudenClient","KitsudenDecodeError","KitsudenError","KitsudenNetworkError","media_exports","models_exports","oauth_exports","promotion_exports","promotion_admin_exports","ProposalPendingError","proposals_exports","queue_exports","record_history_exports","reports_exports","secret_access_exports","TableRef","ToonDecodeError","traces_exports","TronDecodeError","createClient","createKitsuden","decodeBody","decodeToon","decodeTron","index_default","encodeToon","expectOk","isKitsudenError","isProposalPending","itemsOf","normalizeBaseUrl","operationSchemas","parseProvenance","parseRetryAfter","provenanceOf","toStandardSchema","__toCommonJS","DELIMITERS","NUMERIC_LITERAL","LOOKS_LIKE_NUMBER","UNQUOTED_KEY","ARRAY_LENGTH","CONTROL","CONTROL_GLOBAL","ToonDecodeError","message","line","isObject","v","isScalar","isEmptyObject","_","has","o","k","assign","target","key","value","normalize","withinArray","withToJson","copy","i","n","obj","keys","j","escape","s","c","goesWithoutQuotes","scalar","tableFields","rows","firstOnes","row","fields","column","f","children","tableFieldsWithKey","values","x","leaves","out","fieldSegment","header","length","withKey","h","csvRow","Output","level","text","inlineLine","encodeObject","encodePair","encodeArray","encodeTableWithKey","inputs","rowsWithKey","e","tableRows","a","encodeItem","encodeObjectAsItem","k0","v0","rest","ck","encodeToon","input","Reader","lines","scan","rawOnes","raw","indent","withTab","end","content","trim","b","ESCAPES","unescapeText","seq","closingQuote","from","outsideQuotes","ch","quote","direct","inside","literalText","token","t","primitive","separate","delim","start","closingBrace","depth","readFields","segment","parts","actual","p","opens","closes","countLeaves","cs","readHeader","firstColon","endBraces","brace","colon","seg","other","after","readKey","isHeaderWithoutKey","isKeyValuePair","isRow","d","fieldsObject","build","nodes","Decoder","r","m","l","fn","first","base","sig","cab","leavesPerRow","cells","items","li","decodeToon","agent_notifications_exports","__export","operations","agent_token_exports","__export","operations","agents_exports","__export","operations","analytics_exports","__export","operations","approvals_exports","__export","operations","audit_exports","__export","operations","automation_exports","__export","operations","blocks_exports","__export","operations","brain_exports","__export","operations","connections_exports","__export","operations","datasets_exports","__export","operations","external_mcp_exports","__export","operations","external_mcp_oauth_exports","__export","operations","media_exports","__export","operations","models_exports","__export","operations","oauth_exports","__export","operations","promotion_exports","__export","operations","promotion_admin_exports","__export","operations","proposals_exports","__export","operations","queue_exports","__export","operations","record_history_exports","__export","operations","reports_exports","__export","operations","secret_access_exports","__export","operations","traces_exports","__export","operations","API_VERSION","ERROR_CODES","KONS","operations","KitsudenApiError","problem","meta","retryAfter","KitsudenNetworkError","message","opts","KitsudenDecodeError","cause","ProposalPendingError","pending","isKitsudenError","e","codes","ITEM_FIELDS","CONTAINERS","obj","v","itemsOf","data","field","o","k","arrays","search","names","c","where","n","number","pages","call","info","params","options","paging","p","page","offset","round","out","ProposalPendingError","items","hasMore","limit","short","next","totalPages","total","iterate","TronDecodeError","message","SYMBOLS","ESCAPES","tokens","src","out","i","c","at","v","TronDecodeError","d","e","hex","t","decodeTron","tk","p","classes","view","take","require","that","k","separators","breaks","kind","name","props","parent","inherited","value","n","arr","obj","key","defineNow","instance","placed","position","named","prop","x","data","MIME","DEFAULT_RETRY","RETRYABLE_WITHOUT_PROBLEM","randomIdempotencyKey","bytes","c","i","hex","b","textValue","v","buildUrl","baseUrl","info","params","path","name","q","qs","acceptFor","format","parseProvenance","raw","out","part","k","s","n","parseRetryAfter","now","date","formatOf","contentType","header","f","metaOf","res","key","attempts","decodeBody","text","decodeToon","decodeTron","problemOf","status","body","statusText","p","detail","backoffWait","attempt","r","random","ceiling","readJsonSafe","t","execute","cfg","req","o","policy","url","write","headers","wrapper","secure","withRedirect","deadline","ctl","byDeadline","timer","onAbort","err","KitsudenNetworkError","meta","type","possible","problem","wait","ms","KitsudenApiError","kind","isText","data","KitsudenDecodeError","parseBlock","block","data","event","line","i","field","value","json","t","streamEvents","cfg","req","info","params","o","url","buildUrl","headers","body","ctl","onAbort","res","err","KitsudenNetworkError","meta","metaOf","type","p","problem","problemOf","KitsudenApiError","reader","decoder","rest","finished","done","blocks","b","ev","environment","name","g","v","origin","l","normalizeBaseUrl","url","trimmed","end","base","operation","call","info","stream","params","options","f","pages","iterate","KitsudenApi","_KitsudenApi","#cfg","#options","token","DEFAULT_RETRY","ms","r","randomIdempotencyKey","opts","body","rest","execute","streamEvents","kon","ops","KONS","group","method","path","query","bodyFormat","clean","createKitsuden","expectOk","outcome","ProposalPendingError","isProposalPending","provenanceOf","row","p","typeOf","v","fits","type","real","resolver","s","root","actual","i","ref","k","validate","schema","route","failures","failure","message","e","sub","key","options","valid","o","f","types","t","x","props","req","toStandardSchema","value","issues","operationSchemas","spec","operationId","paths","methods","body","responses","success","content","resp","TOON_MIME","AUTO_ACCEPT","HttpClient","config","method","path","body","overrideFormat","format","url","sep","headers","res","error","KitsudenError","text","decodeToon","message","statusCode","TableRef","tableName","client","options","params","field","condition","op","value","query","id","record","data","page","CollectionRef","collectionName","ModulesAPI","key","m","KitsudenClient","GraphAPI","table","name","k","v","qs","relation","createClient","apiKey","Kitsuden","index_default"]}