From 0323dea6bd329055686fc11c554f355256ad029c Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 11:45:23 +0100 Subject: [PATCH 1/9] SDK: Align canvas with codegen pipeline, add e2e tests Replace hand-wired canvas provider request handlers with the codegen-generated CanvasHandler interface from the client session API pipeline. - Remove manual canvas.open/close/invokeAction onRequest handlers from client.ts - Remove dispatchCanvasProviderRequest and manual type guards from canvas.ts - Wire canvas dispatch through generated CanvasHandler in session.registerCanvases() - Replace manual CanvasOpenResponse/CanvasHostContext/CanvasOpenContext/ CanvasActionContext/CanvasLifecycleContext/CanvasJsonSchema with re-exports from codegen (single source of truth from runtime Zod schemas) - Add 4 canvas e2e tests: list, open, invokeAction, close lifecycle Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- nodejs/src/canvas.ts | 171 +++++---------------------- nodejs/src/client.ts | 69 ----------- nodejs/src/generated/rpc.ts | 183 +++++++++++++++++++++++++++-- nodejs/src/session.ts | 42 +++++-- nodejs/test/client.test.ts | 58 ++------- nodejs/test/e2e/canvas.e2e.test.ts | 181 ++++++++++++++++++++++++++++ 6 files changed, 429 insertions(+), 275 deletions(-) create mode 100644 nodejs/test/e2e/canvas.e2e.test.ts diff --git a/nodejs/src/canvas.ts b/nodejs/src/canvas.ts index 738dfc851..48d60d389 100644 --- a/nodejs/src/canvas.ts +++ b/nodejs/src/canvas.ts @@ -2,19 +2,44 @@ * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ +import type { + CanvasJsonSchema, + CanvasProviderCloseRequest, + CanvasProviderInvokeActionRequest, + CanvasProviderOpenRequest, + CanvasProviderOpenResult, +} from "./generated/rpc.js"; + +export type { CanvasJsonSchema, CanvasHostContext } from "./generated/rpc.js"; + /** * Extension-owned canvases declared via * `joinSession({ canvases: [createCanvas({...})] })`. * - * The runtime sends provider callbacks directly as `canvas.open`, - * `canvas.close`, and `canvas.action.invoke` JSON-RPC requests. The SDK - * routes those requests by `canvasId` to the in-process handlers bound by - * `createCanvas`. Re-opening with an existing `instanceId` is how the host - * focuses an existing panel; reload is a renderer-only concern. + * The runtime sends provider callbacks as `canvas.open`, `canvas.close`, and + * `canvas.invokeAction` JSON-RPC requests via the codegen client session API + * pipeline. The SDK routes those requests by `canvasId` to the in-process + * handlers bound by `createCanvas`. Re-opening with an existing `instanceId` + * is how the host focuses an existing panel; reload is a renderer-only concern. */ -/** JSON Schema object used for canvas inputs. */ -export type CanvasJsonSchema = Record; +/* + * Wire-contract types re-exported from codegen. These are the single source of + * truth — the Zod schemas in copilot-agent-runtime drive the JSON Schema which + * drives the codegen which produces these types. + */ + +/** Response returned from a canvas `open` handler. */ +export type CanvasOpenResponse = CanvasProviderOpenResult; + +/** Context handed to a canvas's `open` handler. */ +export type CanvasOpenContext = CanvasProviderOpenRequest; + +/** Context handed to a canvas action handler. */ +export type CanvasActionContext = CanvasProviderInvokeActionRequest; + +/** Context handed to a canvas's `onClose` handler. */ +export type CanvasLifecycleContext = CanvasProviderCloseRequest; /** * A single agent-callable action contributed by a canvas. The metadata @@ -53,71 +78,6 @@ export interface CanvasDeclaration { actions?: Omit[]; } -/** Response returned from `open`. */ -export interface CanvasOpenResponse { - /** URL the host should render. Optional for native canvases. */ - url?: string; - /** Provider-supplied title shown in host chrome. */ - title?: string; - /** Provider-supplied status text shown in host chrome. */ - status?: string; -} - -/** Host capabilities passed to canvas callbacks. */ -export interface CanvasHostContext { - capabilities?: { - canvases?: boolean; - }; -} - -/** Context handed to a canvas's `open` handler. */ -export interface CanvasOpenContext { - /** Session that requested the canvas. */ - sessionId: string; - /** Extension id that owns the canvas. */ - extensionId: string; - /** Canvas id (matches the declaring `CanvasDeclaration.id`). */ - canvasId: string; - /** Stable instance id supplied by the runtime. */ - instanceId: string; - /** Validated `input` payload, shaped by `CanvasDeclaration.inputSchema`. */ - input: unknown; - /** Host capabilities supplied by the runtime. */ - host?: CanvasHostContext; -} - -/** Context handed to a canvas action handler. */ -export interface CanvasActionContext { - /** Session that invoked the action. */ - sessionId: string; - /** Extension id that owns the canvas. */ - extensionId: string; - /** Canvas id targeted by the action. */ - canvasId: string; - /** Instance id targeted by the action. */ - instanceId: string; - /** Action name from `CanvasAction.name`. */ - actionName: string; - /** Validated `input` payload, shaped by the action's `inputSchema`. */ - input: unknown; - /** Host capabilities supplied by the runtime. */ - host?: CanvasHostContext; -} - -/** Context handed to a canvas's `onClose` handler. */ -export interface CanvasLifecycleContext { - /** Session owning the canvas instance. */ - sessionId: string; - /** Extension id that owns the canvas. */ - extensionId: string; - /** Canvas id (matches the declaring `CanvasDeclaration.id`). */ - canvasId: string; - /** Instance id this lifecycle event applies to. */ - instanceId: string; - /** Host capabilities supplied by the runtime. */ - host?: CanvasHostContext; -} - /** Structured error returned from canvas handlers. */ export class CanvasError extends Error { constructor( @@ -217,70 +177,3 @@ export function createCanvas(options: CanvasOptions): Canvas { return new Canvas(options); } -/** @internal */ -export interface CanvasProviderRequestParams { - sessionId: string; - extensionId: string; - canvasId: string; - instanceId: string; - input?: unknown; - host?: CanvasHostContext; -} - -/** @internal */ -export interface CanvasActionInvokeParams extends CanvasProviderRequestParams { - actionName: string; -} - -/** - * Dispatch a direct `canvas.*` provider request to the matching {@link Canvas} - * handler. - * - * @internal - */ -export async function dispatchCanvasProviderRequest( - canvas: Canvas, - actionName: "canvas.open" | "canvas.close" | string, - params: CanvasActionInvokeParams | CanvasProviderRequestParams -): Promise { - switch (actionName) { - case "canvas.open": { - const result = await canvas.open({ - sessionId: params.sessionId, - extensionId: params.extensionId, - canvasId: params.canvasId, - instanceId: params.instanceId, - input: params.input, - host: params.host, - }); - return result ?? {}; - } - case "canvas.close": { - if (canvas.onClose) { - await canvas.onClose({ - sessionId: params.sessionId, - extensionId: params.extensionId, - canvasId: params.canvasId, - instanceId: params.instanceId, - host: params.host, - }); - } - return undefined; - } - default: { - const perAction = canvas.actionHandlers.get(actionName); - if (!perAction) { - throw CanvasError.noHandler(); - } - return perAction({ - sessionId: params.sessionId, - extensionId: params.extensionId, - canvasId: params.canvasId, - instanceId: params.instanceId, - actionName, - input: params.input, - host: params.host, - }); - } - } -} diff --git a/nodejs/src/client.ts b/nodejs/src/client.ts index 3e8a4cfa3..19fb0246d 100644 --- a/nodejs/src/client.ts +++ b/nodejs/src/client.ts @@ -32,11 +32,6 @@ import { registerClientSessionApiHandlers, } from "./generated/rpc.js"; import type { OpenCanvasInstance } from "./generated/rpc.js"; -import { - type CanvasActionInvokeParams, - type CanvasProviderRequestParams, - dispatchCanvasProviderRequest, -} from "./canvas.js"; import { getSdkProtocolVersion } from "./sdkProtocolVersion.js"; import { CopilotSession } from "./session.js"; import { createSessionFsAdapter, type SessionFsProvider } from "./sessionFsProvider.js"; @@ -134,31 +129,6 @@ function toWireCustomAgents(agents: CustomAgentConfig[] | undefined): unknown[] }); } -function isCanvasProviderRequestParams(params: unknown): params is CanvasProviderRequestParams { - if (!params || typeof params !== "object") { - return false; - } - - const request = params as { - sessionId?: unknown; - extensionId?: unknown; - canvasId?: unknown; - instanceId?: unknown; - }; - return ( - typeof request.sessionId === "string" && - typeof request.extensionId === "string" && - typeof request.canvasId === "string" && - typeof request.instanceId === "string" - ); -} - -function isCanvasActionInvokeParams(params: unknown): params is CanvasActionInvokeParams { - return ( - isCanvasProviderRequestParams(params) && - typeof (params as { actionName?: unknown }).actionName === "string" - ); -} /** * Extract transform callbacks from a system message config and prepare the wire payload. @@ -1926,17 +1896,6 @@ export class CopilotClient { await this.handleSystemMessageTransform(params) ); - this.connection.onRequest("canvas.open", async (params: CanvasProviderRequestParams) => - this.handleCanvasProviderRequest("canvas.open", params) - ); - this.connection.onRequest("canvas.close", async (params: CanvasProviderRequestParams) => - this.handleCanvasProviderRequest("canvas.close", params) - ); - this.connection.onRequest( - "canvas.action.invoke", - async (params: CanvasActionInvokeParams) => this.handleCanvasActionInvokeRequest(params) - ); - // Register client session API handlers. const sessions = this.sessions; registerClientSessionApiHandlers(this.connection, (sessionId) => { @@ -2141,32 +2100,4 @@ export class CopilotClient { return await session._handleSystemMessageTransform(params.sections); } - private async handleCanvasProviderRequest( - actionName: string, - params: unknown - ): Promise { - if (!isCanvasProviderRequestParams(params)) { - throw new Error("Invalid canvas provider request payload"); - } - - const session = this.sessions.get(params.sessionId); - if (!session) { - throw new Error(`Session not found: ${params.sessionId}`); - } - - const canvas = session.getCanvas(params.canvasId); - if (!canvas) { - throw new Error(`No canvas registered with id "${params.canvasId}"`); - } - - return dispatchCanvasProviderRequest(canvas, actionName, params); - } - - private async handleCanvasActionInvokeRequest(params: unknown): Promise { - if (!isCanvasActionInvokeParams(params)) { - throw new Error("Invalid canvas provider request payload"); - } - - return this.handleCanvasProviderRequest(params.actionName, params); - } } diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 229fd4ff0..be6a29818 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -1775,6 +1775,27 @@ export interface CanvasCloseRequest { */ instanceId: string; } +/** + * Host context supplied by the runtime. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasHostContext". + */ +export interface CanvasHostContext { + capabilities?: CanvasHostContextCapabilities; +} +/** + * Host capabilities + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasHostContextCapabilities". + */ +export interface CanvasHostContextCapabilities { + /** + * Whether canvas rendering is supported + */ + canvases?: boolean; +} /** * Canvas action invocation parameters. * @@ -1799,19 +1820,14 @@ export interface CanvasInvokeActionRequest { }; } /** - * Canvas action invocation result. + * Provider-supplied action result. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasInvokeActionResult". */ /** @experimental */ export interface CanvasInvokeActionResult { - /** - * Provider-supplied action result - */ - result?: { - [k: string]: unknown | undefined; - }; + [k: string]: unknown | undefined; } /** * Declared canvases available in this session. @@ -1948,6 +1964,117 @@ export interface CanvasOpenRequest { [k: string]: unknown | undefined; }; } +/** + * Canvas close parameters sent to the provider. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderCloseRequest". + */ +export interface CanvasProviderCloseRequest { + /** + * Target session identifier + */ + sessionId: string; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Canvas instance identifier + */ + instanceId: string; + host?: CanvasHostContext; +} +/** + * Canvas action invocation parameters sent to the provider. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderInvokeActionRequest". + */ +export interface CanvasProviderInvokeActionRequest { + /** + * Target session identifier + */ + sessionId: string; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Canvas instance identifier + */ + instanceId: string; + /** + * Action name to invoke + */ + actionName: string; + /** + * Action input + */ + input?: { + [k: string]: unknown | undefined; + }; + host?: CanvasHostContext; +} +/** + * Canvas open parameters sent to the provider. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderOpenRequest". + */ +export interface CanvasProviderOpenRequest { + /** + * Target session identifier + */ + sessionId: string; + /** + * Owning provider identifier + */ + extensionId: string; + /** + * Provider-local canvas identifier + */ + canvasId: string; + /** + * Stable caller-supplied canvas instance identifier + */ + instanceId: string; + /** + * Canvas open input + */ + input?: { + [k: string]: unknown | undefined; + }; + host?: CanvasHostContext; +} +/** + * Canvas open result returned by the provider. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "CanvasProviderOpenResult". + */ +export interface CanvasProviderOpenResult { + /** + * URL for web-rendered canvases + */ + url?: string; + /** + * Provider-supplied title + */ + title?: string; + /** + * Provider-supplied status text + */ + status?: string; +} /** * Slash commands available in the session, after applying any include/exclude filters. * @@ -11147,9 +11274,36 @@ export interface SessionFsHandler { sqliteExists(params: SessionFsSqliteExistsRequest): Promise; } +/** Handler for `canvas` client session API methods. */ +export interface CanvasHandler { + /** + * Opens a canvas instance on the provider. + * + * @param params Canvas open parameters sent to the provider. + * + * @returns Canvas open result returned by the provider. + */ + open(params: CanvasProviderOpenRequest): Promise; + /** + * Closes a canvas instance on the provider. + * + * @param params Canvas close parameters sent to the provider. + */ + close(params: CanvasProviderCloseRequest): Promise; + /** + * Invokes an action on an open canvas instance via the provider. + * + * @param params Canvas action invocation parameters sent to the provider. + * + * @returns Provider-supplied action result. + */ + invokeAction(params: CanvasProviderInvokeActionRequest): Promise; +} + /** All client session API handler groups. */ export interface ClientSessionApiHandlers { sessionFs?: SessionFsHandler; + canvas?: CanvasHandler; } /** @@ -11222,4 +11376,19 @@ export function registerClientSessionApiHandlers( if (!handler) throw new Error(`No sessionFs handler registered for session: ${params.sessionId}`); return handler.sqliteExists(params); }); + connection.onRequest("canvas.open", async (params: CanvasProviderOpenRequest) => { + const handler = getHandlers(params.sessionId).canvas; + if (!handler) throw new Error(`No canvas handler registered for session: ${params.sessionId}`); + return handler.open(params); + }); + connection.onRequest("canvas.close", async (params: CanvasProviderCloseRequest) => { + const handler = getHandlers(params.sessionId).canvas; + if (!handler) throw new Error(`No canvas handler registered for session: ${params.sessionId}`); + return handler.close(params); + }); + connection.onRequest("canvas.invokeAction", async (params: CanvasProviderInvokeActionRequest) => { + const handler = getHandlers(params.sessionId).canvas; + if (!handler) throw new Error(`No canvas handler registered for session: ${params.sessionId}`); + return handler.invokeAction(params); + }); } diff --git a/nodejs/src/session.ts b/nodejs/src/session.ts index 74823602e..b0d83de54 100644 --- a/nodejs/src/session.ts +++ b/nodejs/src/session.ts @@ -11,7 +11,7 @@ import type { MessageConnection } from "vscode-jsonrpc/node.js"; import { ConnectionError, ResponseError } from "vscode-jsonrpc/node.js"; import { createSessionRpc } from "./generated/rpc.js"; import type { ClientSessionApiHandlers } from "./generated/rpc.js"; -import type { Canvas } from "./canvas.js"; +import { type Canvas, CanvasError } from "./canvas.js"; import type { OpenCanvasInstance } from "./generated/rpc.js"; import { getTraceContext } from "./telemetry.js"; import type { @@ -647,23 +647,41 @@ export class CopilotSession { */ registerCanvases(canvases?: Canvas[]): void { this.canvases.clear(); - if (!canvases) { + if (!canvases || canvases.length === 0) { + delete this.clientSessionApis.canvas; return; } for (const canvas of canvases) { this.canvases.set(canvas.declaration.id, canvas); } - } - /** - * Retrieves a registered canvas by id. - * - * @param canvasId - The id of the canvas to retrieve - * @returns The registered Canvas if found, or undefined - * @internal Used by the SDK's direct `canvas.*` dispatcher. - */ - getCanvas(canvasId: string): Canvas | undefined { - return this.canvases.get(canvasId); + const self = this; + this.clientSessionApis.canvas = { + async open(params) { + const canvas = self.canvases.get(params.canvasId); + if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`); + return (await canvas.open(params)) ?? {}; + }, + async close(params) { + const canvas = self.canvases.get(params.canvasId); + if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`); + if (canvas.onClose) { + await canvas.onClose(params); + } + }, + async invokeAction(params) { + const canvas = self.canvases.get(params.canvasId); + if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`); + const handler = canvas.actionHandlers.get(params.actionName); + if (!handler) { + throw new CanvasError( + "canvas_action_no_handler", + "No handler implemented for this canvas action" + ); + } + return (await handler(params)) as Record; + }, + }; } /** diff --git a/nodejs/test/client.test.ts b/nodejs/test/client.test.ts index ff46c75b3..ccaa6ef59 100644 --- a/nodejs/test/client.test.ts +++ b/nodejs/test/client.test.ts @@ -105,7 +105,7 @@ describe("CopilotClient", () => { expect(payload.openCanvasInstances).toBeUndefined(); }); - it("routes direct canvas action requests to registered canvases", async () => { + it("routes canvas.invokeAction to registered canvas action handlers via clientSessionApis", async () => { const canvas = createCanvas({ id: "counter", displayName: "Counter", @@ -120,10 +120,8 @@ describe("CopilotClient", () => { }); const session = new CopilotSession("session-1", {} as any); session.registerCanvases([canvas]); - const client = new CopilotClient(); - (client as any).sessions.set(session.sessionId, session); - const result = await (client as any).handleCanvasProviderRequest("increment", { + const result = await session.clientSessionApis.canvas!.invokeAction({ sessionId: session.sessionId, extensionId: "project:counter", canvasId: "counter", @@ -145,11 +143,9 @@ describe("CopilotClient", () => { const session = new CopilotSession("session-1", {} as any); session.registerCanvases([canvas]); - const client = new CopilotClient(); - (client as any).sessions.set(session.sessionId, session); await expect( - (client as any).handleCanvasProviderRequest("ghost", { + session.clientSessionApis.canvas!.invokeAction({ sessionId: session.sessionId, extensionId: "project:counter", canvasId: "counter", @@ -160,52 +156,18 @@ describe("CopilotClient", () => { ).rejects.toMatchObject({ code: "canvas_action_no_handler" }); }); - it("rejects malformed direct canvas action payloads", async () => { - const client = new CopilotClient(); - - await expect((client as any).handleCanvasActionInvokeRequest(undefined)).rejects.toThrow( - "Invalid canvas provider request payload" - ); - await expect( - (client as any).handleCanvasActionInvokeRequest({ - sessionId: "session-1", - extensionId: "project:counter", - canvasId: "counter", - instanceId: "counter-1", - }) - ).rejects.toThrow("Invalid canvas provider request payload"); - }); - - it("rejects direct canvas provider payloads without extension ids", async () => { - const open = vi.fn(() => ({ url: "https://example.test/counter" })); + it("throws for unknown canvasId in canvas.open via clientSessionApis", async () => { + const session = new CopilotSession("session-1", {} as any); const canvas = createCanvas({ - id: "counter", - displayName: "Counter", - description: "A counter canvas", - open, + id: "other", + displayName: "Other", + description: "Some other canvas", + open: () => ({ url: "https://example.test/other" }), }); - const session = new CopilotSession("session-1", {} as any); session.registerCanvases([canvas]); - const client = new CopilotClient(); - (client as any).sessions.set(session.sessionId, session); - - await expect( - (client as any).handleCanvasProviderRequest("canvas.open", { - sessionId: session.sessionId, - canvasId: "counter", - instanceId: "counter-1", - }) - ).rejects.toThrow("Invalid canvas provider request payload"); - expect(open).not.toHaveBeenCalled(); - }); - - it("throws for unknown direct canvas dispatches", async () => { - const session = new CopilotSession("session-1", {} as any); - const client = new CopilotClient(); - (client as any).sessions.set(session.sessionId, session); await expect( - (client as any).handleCanvasProviderRequest("canvas.open", { + session.clientSessionApis.canvas!.open({ sessionId: session.sessionId, extensionId: "project:missing", canvasId: "missing", diff --git a/nodejs/test/e2e/canvas.e2e.test.ts b/nodejs/test/e2e/canvas.e2e.test.ts new file mode 100644 index 000000000..d08cba9ea --- /dev/null +++ b/nodejs/test/e2e/canvas.e2e.test.ts @@ -0,0 +1,181 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +import { describe, expect, it } from "vitest"; +import { approveAll, createCanvas } from "../../src/index.js"; +import { createSdkTestContext } from "./harness/sdkTestContext.js"; + +describe("Canvas RPC", async () => { + const openCalls: Array<{ canvasId: string; instanceId: string; input?: unknown }> = []; + const closeCalls: Array<{ canvasId: string; instanceId: string }> = []; + const actionCalls: Array<{ + canvasId: string; + instanceId: string; + actionName: string; + input?: unknown; + }> = []; + + const counter = createCanvas({ + id: "counter", + displayName: "Counter", + description: "A simple counter canvas for e2e testing", + inputSchema: { + type: "object", + properties: { startValue: { type: "number" } }, + }, + actions: [ + { + name: "increment", + description: "Increment the counter", + inputSchema: { + type: "object", + properties: { amount: { type: "number" } }, + }, + handler: (ctx) => { + actionCalls.push({ + canvasId: ctx.canvasId, + instanceId: ctx.instanceId, + actionName: ctx.actionName, + input: ctx.input, + }); + return { newValue: 42 }; + }, + }, + ], + open: (ctx) => { + openCalls.push({ + canvasId: ctx.canvasId, + instanceId: ctx.instanceId, + input: ctx.input, + }); + return { + url: "https://example.test/counter", + title: "Counter Canvas", + status: "ready", + }; + }, + onClose: (ctx) => { + closeCalls.push({ + canvasId: ctx.canvasId, + instanceId: ctx.instanceId, + }); + }, + }); + + const { copilotClient: client } = await createSdkTestContext(); + + it("discovers declared canvases via session.canvas.list", async () => { + const session = await client.createSession({ + onPermissionRequest: approveAll, + canvases: [counter], + }); + + const result = await session.rpc.canvas.list(); + expect(result.canvases).toHaveLength(1); + expect(result.canvases[0]).toMatchObject({ + canvasId: "counter", + displayName: "Counter", + description: "A simple counter canvas for e2e testing", + }); + + await session.disconnect(); + }); + + it("opens a canvas instance via session.canvas.open round-trip", async () => { + openCalls.length = 0; + + const session = await client.createSession({ + onPermissionRequest: approveAll, + canvases: [counter], + }); + + const result = await session.rpc.canvas.open({ + canvasId: "counter", + instanceId: "counter-1", + input: { startValue: 10 }, + }); + + expect(result.url).toBe("https://example.test/counter"); + expect(result.title).toBe("Counter Canvas"); + expect(openCalls).toHaveLength(1); + expect(openCalls[0]).toMatchObject({ + canvasId: "counter", + instanceId: "counter-1", + input: { startValue: 10 }, + }); + + // Verify it appears in the open list + const openList = await session.rpc.canvas.listOpen(); + expect(openList.openCanvases).toHaveLength(1); + expect(openList.openCanvases[0]).toMatchObject({ + canvasId: "counter", + instanceId: "counter-1", + }); + + await session.disconnect(); + }); + + it("invokes an action on an open canvas instance", async () => { + openCalls.length = 0; + actionCalls.length = 0; + + const session = await client.createSession({ + onPermissionRequest: approveAll, + canvases: [counter], + }); + + await session.rpc.canvas.open({ + canvasId: "counter", + instanceId: "counter-2", + input: {}, + }); + + const result = await session.rpc.canvas.invokeAction({ + instanceId: "counter-2", + actionName: "increment", + input: { amount: 5 }, + }); + + expect(result.result).toEqual({ newValue: 42 }); + expect(actionCalls).toHaveLength(1); + expect(actionCalls[0]).toMatchObject({ + canvasId: "counter", + instanceId: "counter-2", + actionName: "increment", + input: { amount: 5 }, + }); + + await session.disconnect(); + }); + + it("closes an open canvas instance via session.canvas.close", async () => { + openCalls.length = 0; + closeCalls.length = 0; + + const session = await client.createSession({ + onPermissionRequest: approveAll, + canvases: [counter], + }); + + await session.rpc.canvas.open({ + canvasId: "counter", + instanceId: "counter-3", + input: {}, + }); + expect(closeCalls).toHaveLength(0); + + await session.rpc.canvas.close({ instanceId: "counter-3" }); + expect(closeCalls).toHaveLength(1); + expect(closeCalls[0]).toMatchObject({ + canvasId: "counter", + instanceId: "counter-3", + }); + + // Verify it's no longer in the open list + const openList = await session.rpc.canvas.listOpen(); + expect(openList.openCanvases).toHaveLength(0); + + await session.disconnect(); + }); +}); From 1d3a6530671b8c82c26f40af24a4d366253471f3 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 12:19:30 +0100 Subject: [PATCH 2/9] Canvas: align C#, Python, Go, Rust with codegen pipeline Replace hand-wired canvas RPC handlers with codegen-generated CanvasHandler across all four remaining SDK languages, matching the Node implementation: - Replace manual context/response types with codegen type aliases - Remove hand-wired canvas.open/close/action.invoke handlers - Wire canvas dispatch through ClientSessionApiHandlers - Add canvas e2e tests (list, open, invokeAction, close) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/src/Canvas.cs | 120 +- dotnet/src/Client.cs | 43 - dotnet/src/Generated/Rpc.cs | 162 + dotnet/src/Session.cs | 141 +- dotnet/src/Types.cs | 5 +- dotnet/test/E2E/CanvasE2ETests.cs | 254 + dotnet/test/Unit/CanvasTests.cs | 15 +- go/canvas.go | 130 +- go/canvas_test.go | 269 +- go/client.go | 91 - go/internal/e2e/canvas_e2e_test.go | 225 + go/rpc/zrpc.go | 160 + go/session.go | 113 + go/types.go | 8 +- python/copilot/__init__.py | 6 +- python/copilot/canvas.py | 224 +- python/copilot/client.py | 138 - python/copilot/generated/rpc.py | 9953 +++++++++++++---- python/copilot/session.py | 37 +- python/e2e/test_canvas_e2e.py | 165 + python/test_canvas.py | 203 +- rust/src/canvas.rs | 154 +- rust/src/canvas_dispatch.rs | 192 + rust/src/generated/api_types.rs | 116 +- rust/src/lib.rs | 1 + rust/src/session.rs | 146 +- rust/src/types.rs | 2 +- rust/tests/e2e.rs | 2 + rust/tests/e2e/canvas.rs | 48 + rust/tests/session_test.rs | 2 +- ...nvas_list_discovers_declared_canvases.yaml | 3 + 31 files changed, 9700 insertions(+), 3428 deletions(-) create mode 100644 dotnet/test/E2E/CanvasE2ETests.cs create mode 100644 go/internal/e2e/canvas_e2e_test.go create mode 100644 python/e2e/test_canvas_e2e.py create mode 100644 rust/src/canvas_dispatch.rs create mode 100644 rust/tests/e2e/canvas.rs create mode 100644 test/snapshots/canvas/canvas_list_discovers_declared_canvases.yaml diff --git a/dotnet/src/Canvas.cs b/dotnet/src/Canvas.cs index 6a6134e18..69514edda 100644 --- a/dotnet/src/Canvas.cs +++ b/dotnet/src/Canvas.cs @@ -55,110 +55,6 @@ public sealed class ExtensionInfo public string Name { get; set; } = string.Empty; } -/// Response returned from . -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasOpenResponse -{ - /// URL the host should render. Optional for canvases with no visual surface. - [JsonPropertyName("url")] - public string? Url { get; set; } - - /// Provider-supplied title shown in host chrome. - [JsonPropertyName("title")] - public string? Title { get; set; } - - /// Provider-supplied status text shown in host chrome. - [JsonPropertyName("status")] - public string? Status { get; set; } -} - -/// Host capabilities passed to canvas provider callbacks. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasHostContext -{ - /// Host capability details. - [JsonPropertyName("capabilities")] - public CanvasHostCapabilities Capabilities { get; set; } = new(); -} - -/// Host capability details passed to canvas provider callbacks. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasHostCapabilities -{ - /// Whether the host supports canvas rendering. - [JsonPropertyName("canvases")] - public bool Canvases { get; set; } -} - -/// Context handed to . -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasOpenContext -{ - /// Session that requested the canvas. - public string SessionId { get; init; } = string.Empty; - - /// Owning provider identifier. - public string ExtensionId { get; init; } = string.Empty; - - /// Canvas id from the declaring . - public string CanvasId { get; init; } = string.Empty; - - /// Stable instance id supplied by the runtime. - public string InstanceId { get; init; } = string.Empty; - - /// Validated input payload. - public JsonElement Input { get; init; } - - /// Host capabilities supplied by the runtime. - public CanvasHostContext? Host { get; init; } -} - -/// Context handed to . -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasActionContext -{ - /// Session that invoked the action. - public string SessionId { get; init; } = string.Empty; - - /// Owning provider identifier. - public string ExtensionId { get; init; } = string.Empty; - - /// Canvas id targeted by the action. - public string CanvasId { get; init; } = string.Empty; - - /// Instance id targeted by the action. - public string InstanceId { get; init; } = string.Empty; - - /// Action name from . - public string ActionName { get; init; } = string.Empty; - - /// Validated input payload. - public JsonElement Input { get; init; } - - /// Host capabilities supplied by the runtime. - public CanvasHostContext? Host { get; init; } -} - -/// Context handed to a canvas's close lifecycle hook. -[Experimental(Diagnostics.Experimental)] -public sealed class CanvasLifecycleContext -{ - /// Session owning the canvas instance. - public string SessionId { get; init; } = string.Empty; - - /// Owning provider identifier. - public string ExtensionId { get; init; } = string.Empty; - - /// Canvas id from the declaring . - public string CanvasId { get; init; } = string.Empty; - - /// Instance id this lifecycle event applies to. - public string InstanceId { get; init; } = string.Empty; - - /// Host capabilities supplied by the runtime. - public CanvasHostContext? Host { get; init; } -} - /// Structured error returned from canvas handlers. /// /// Throw this from implementations to surface a @@ -234,9 +130,9 @@ internal partial class CanvasJsonContext : JsonSerializerContext; /// /// A session installs a single via /// SessionConfigBase.CanvasHandler. The handler receives every -/// inbound canvas.open / canvas.close / canvas.action.invoke +/// inbound canvas.open / canvas.close / canvas.invokeAction /// JSON-RPC request the runtime issues for this session and decides — typically -/// by inspecting — which +/// by inspecting — which /// application-side canvas should handle the call. /// /// The SDK does not maintain a per-canvas registry; multiplexing across @@ -252,16 +148,16 @@ internal partial class CanvasJsonContext : JsonSerializerContext; public interface ICanvasHandler { /// Open a new canvas instance. - Task OnOpenAsync(CanvasOpenContext context, CancellationToken cancellationToken); + Task OnOpenAsync(CanvasProviderOpenRequest context, CancellationToken cancellationToken); /// Canvas was closed by the user or agent. Default: no-op. - Task OnCloseAsync(CanvasLifecycleContext context, CancellationToken cancellationToken); + Task OnCloseAsync(CanvasProviderCloseRequest context, CancellationToken cancellationToken); /// /// Handle a non-lifecycle action declared by the canvas. /// Default: throws . /// - Task OnActionAsync(CanvasActionContext context, CancellationToken cancellationToken); + Task OnActionAsync(CanvasProviderInvokeActionRequest context, CancellationToken cancellationToken); } /// @@ -272,10 +168,10 @@ public interface ICanvasHandler public abstract class CanvasHandlerBase : ICanvasHandler { /// - public abstract Task OnOpenAsync(CanvasOpenContext context, CancellationToken cancellationToken); + public abstract Task OnOpenAsync(CanvasProviderOpenRequest context, CancellationToken cancellationToken); /// - public virtual Task OnCloseAsync(CanvasLifecycleContext context, CancellationToken cancellationToken) + public virtual Task OnCloseAsync(CanvasProviderCloseRequest context, CancellationToken cancellationToken) #if NET8_0_OR_GREATER => Task.CompletedTask; #else @@ -283,6 +179,6 @@ public virtual Task OnCloseAsync(CanvasLifecycleContext context, CancellationTok #endif /// - public virtual Task OnActionAsync(CanvasActionContext context, CancellationToken cancellationToken) + public virtual Task OnActionAsync(CanvasProviderInvokeActionRequest context, CancellationToken cancellationToken) => Task.FromException(CanvasError.NoHandler()); } diff --git a/dotnet/src/Client.cs b/dotnet/src/Client.cs index 0e7730690..055fd95be 100644 --- a/dotnet/src/Client.cs +++ b/dotnet/src/Client.cs @@ -1625,9 +1625,6 @@ private async Task ConnectToServerAsync(Process? cliProcess, string? rpc.SetLocalRpcMethod("autoModeSwitch.request", handler.OnAutoModeSwitchRequest); rpc.SetLocalRpcMethod("hooks.invoke", handler.OnHooksInvoke); rpc.SetLocalRpcMethod("systemMessage.transform", handler.OnSystemMessageTransform); - rpc.SetLocalRpcMethod("canvas.open", handler.OnCanvasOpen); - rpc.SetLocalRpcMethod("canvas.close", handler.OnCanvasClose); - rpc.SetLocalRpcMethod("canvas.action.invoke", handler.OnCanvasInvokeAction); ClientSessionApiRegistration.RegisterClientSessionApiHandlers(rpc, sessionId => { var session = GetSession(sessionId) ?? throw new ArgumentException($"Unknown session {sessionId}"); @@ -1821,46 +1818,6 @@ public async ValueTask OnSystemMessageTransfo return await session.HandleSystemMessageTransformAsync(sections); } -#pragma warning disable GHCP001 - public ValueTask OnCanvasOpen( - string sessionId, - string extensionId, - string canvasId, - string instanceId, - JsonElement? input = null, - CanvasHostContext? host = null) - { - var session = client.GetSession(sessionId) ?? throw new ArgumentException($"Unknown session {sessionId}"); - return session.HandleCanvasOpenAsync( - extensionId, canvasId, instanceId, input ?? default, host); - } - - public async ValueTask OnCanvasClose( - string sessionId, - string extensionId, - string canvasId, - string instanceId, - JsonElement? input = null, - CanvasHostContext? host = null) - { - var session = client.GetSession(sessionId) ?? throw new ArgumentException($"Unknown session {sessionId}"); - await session.HandleCanvasCloseAsync(extensionId, canvasId, instanceId, host); - } - - public ValueTask OnCanvasInvokeAction( - string sessionId, - string extensionId, - string canvasId, - string instanceId, - string actionName, - JsonElement? input = null, - CanvasHostContext? host = null) - { - var session = client.GetSession(sessionId) ?? throw new ArgumentException($"Unknown session {sessionId}"); - return session.HandleCanvasActionAsync( - extensionId, canvasId, instanceId, actionName, input ?? default, host); - } -#pragma warning restore GHCP001 } private class Connection( diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 470fae6cb..9c001f737 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -7760,6 +7760,122 @@ public sealed class SessionFsSqliteExistsRequest public string SessionId { get; set; } = string.Empty; } +/// Canvas open result returned by the provider. +public sealed class CanvasProviderOpenResult +{ + /// Provider-supplied status text. + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// Provider-supplied title. + [JsonPropertyName("title")] + public string? Title { get; set; } + + /// URL for web-rendered canvases. + [JsonPropertyName("url")] + public string? Url { get; set; } +} + +/// Host capabilities. +public sealed class CanvasHostContextCapabilities +{ + /// Whether canvas rendering is supported. + [JsonPropertyName("canvases")] + public bool? Canvases { get; set; } +} + +/// Host context supplied by the runtime. +public sealed class CanvasHostContext +{ + /// Host capabilities. + [JsonPropertyName("capabilities")] + public CanvasHostContextCapabilities? Capabilities { get; set; } +} + +/// Canvas open parameters sent to the provider. +public sealed class CanvasProviderOpenRequest +{ + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Host context supplied by the runtime. + [JsonPropertyName("host")] + public CanvasHostContext? Host { get; set; } + + /// Canvas open input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Stable caller-supplied canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas close parameters sent to the provider. +public sealed class CanvasProviderCloseRequest +{ + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Host context supplied by the runtime. + [JsonPropertyName("host")] + public CanvasHostContext? Host { get; set; } + + /// Canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + +/// Canvas action invocation parameters sent to the provider. +public sealed class CanvasProviderInvokeActionRequest +{ + /// Action name to invoke. + [JsonPropertyName("actionName")] + public string ActionName { get; set; } = string.Empty; + + /// Provider-local canvas identifier. + [JsonPropertyName("canvasId")] + public string CanvasId { get; set; } = string.Empty; + + /// Owning provider identifier. + [JsonPropertyName("extensionId")] + public string ExtensionId { get; set; } = string.Empty; + + /// Host context supplied by the runtime. + [JsonPropertyName("host")] + public CanvasHostContext? Host { get; set; } + + /// Action input. + [JsonPropertyName("input")] + public JsonElement? Input { get; set; } + + /// Canvas instance identifier. + [JsonPropertyName("instanceId")] + public string InstanceId { get; set; } = string.Empty; + + /// Target session identifier. + [JsonPropertyName("sessionId")] + public string SessionId { get; set; } = string.Empty; +} + /// Model capability category for grouping in the model picker. [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] @@ -14541,11 +14657,33 @@ public interface ISessionFsHandler Task SqliteExistsAsync(SessionFsSqliteExistsRequest request, CancellationToken cancellationToken = default); } +/// Handles `canvas` client session API methods. +public interface ICanvasHandler +{ + /// Opens a canvas instance on the provider. + /// Canvas open parameters sent to the provider. + /// The to monitor for cancellation requests. The default is . + /// Canvas open result returned by the provider. + Task OpenAsync(CanvasProviderOpenRequest request, CancellationToken cancellationToken = default); + /// Closes a canvas instance on the provider. + /// Canvas close parameters sent to the provider. + /// The to monitor for cancellation requests. The default is . + Task CloseAsync(CanvasProviderCloseRequest request, CancellationToken cancellationToken = default); + /// Invokes an action on an open canvas instance via the provider. + /// Canvas action invocation parameters sent to the provider. + /// The to monitor for cancellation requests. The default is . + /// Provider-supplied action result. + Task InvokeActionAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default); +} + /// Provides all client session API handler groups for a session. public sealed class ClientSessionApiHandlers { /// Optional handler for SessionFs client session API methods. public ISessionFsHandler? SessionFs { get; set; } + + /// Optional handler for Canvas client session API methods. + public ICanvasHandler? Canvas { get; set; } } /// Registers client session API handlers on a JSON-RPC connection. @@ -14630,6 +14768,24 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, Func>)(async (request, cancellationToken) => + { + var handler = getHandlers(request.SessionId).Canvas; + if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); + return await handler.OpenAsync(request, cancellationToken); + }), singleObjectParam: true); + rpc.SetLocalRpcMethod("canvas.close", (Func)(async (request, cancellationToken) => + { + var handler = getHandlers(request.SessionId).Canvas; + if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); + await handler.CloseAsync(request, cancellationToken); + }), singleObjectParam: true); + rpc.SetLocalRpcMethod("canvas.invokeAction", (Func>)(async (request, cancellationToken) => + { + var handler = getHandlers(request.SessionId).Canvas; + if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); + return await handler.InvokeActionAsync(request, cancellationToken); + }), singleObjectParam: true); } } @@ -14895,11 +15051,17 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, Func Han private readonly SemaphoreSlim _transformCallbacksLock = new(1, 1); #pragma warning disable GHCP001 - private volatile ICanvasHandler? _canvasHandler; private IReadOnlyList _openCanvases = Array.Empty(); #pragma warning restore GHCP001 @@ -890,114 +889,72 @@ internal void SetOpenCanvases(IList? canvases) internal void SetCanvasHandler(ICanvasHandler? handler) { - _canvasHandler = handler; + ClientSessionApis.Canvas = handler is null ? null : new CanvasHandlerAdapter(handler); } - internal async ValueTask HandleCanvasOpenAsync( - string extensionId, - string canvasId, - string instanceId, - JsonElement input, - CanvasHostContext? host) + private static JsonElement SerializeActionResult(object? value) { - var handler = _canvasHandler ?? throw CanvasErrorHelpers.HandlerUnset(); - var ctx = new CanvasOpenContext - { - SessionId = SessionId, - ExtensionId = extensionId, - CanvasId = canvasId, - InstanceId = instanceId, - Input = input, - Host = host, - }; - try - { - return await handler.OnOpenAsync(ctx, CancellationToken.None).ConfigureAwait(false); - } - catch (CanvasError ce) - { - throw CanvasErrorHelpers.ToRpcException(ce); - } - catch (Exception ex) when (ex is not OperationCanceledException) + var element = CopilotClient.ToJsonElementForWire(value); + if (element.HasValue) { - throw CanvasErrorHelpers.HandlerError(ex.Message); + return element.Value; } + using var doc = JsonDocument.Parse("null"); + return doc.RootElement.Clone(); } +#pragma warning restore GHCP001 - internal async ValueTask HandleCanvasCloseAsync( - string extensionId, - string canvasId, - string instanceId, - CanvasHostContext? host) + private sealed class CanvasHandlerAdapter(ICanvasHandler handler) : Rpc.ICanvasHandler { - var handler = _canvasHandler ?? throw CanvasErrorHelpers.HandlerUnset(); - var ctx = new CanvasLifecycleContext + public async Task OpenAsync(CanvasProviderOpenRequest request, CancellationToken cancellationToken = default) { - SessionId = SessionId, - ExtensionId = extensionId, - CanvasId = canvasId, - InstanceId = instanceId, - Host = host, - }; - try - { - await handler.OnCloseAsync(ctx, CancellationToken.None).ConfigureAwait(false); - } - catch (CanvasError ce) - { - throw CanvasErrorHelpers.ToRpcException(ce); - } - catch (Exception ex) when (ex is not OperationCanceledException) - { - throw CanvasErrorHelpers.HandlerError(ex.Message); + try + { + return await handler.OnOpenAsync(request, cancellationToken).ConfigureAwait(false); + } + catch (CanvasError ce) + { + throw CanvasErrorHelpers.ToRpcException(ce); + } + catch (Exception ex) when (ex is not OperationCanceledException) + { + throw CanvasErrorHelpers.HandlerError(ex.Message); + } } - } - internal async ValueTask HandleCanvasActionAsync( - string extensionId, - string canvasId, - string instanceId, - string actionName, - JsonElement input, - CanvasHostContext? host) - { - var handler = _canvasHandler ?? throw CanvasErrorHelpers.HandlerUnset(); - var ctx = new CanvasActionContext - { - SessionId = SessionId, - ExtensionId = extensionId, - CanvasId = canvasId, - InstanceId = instanceId, - ActionName = actionName, - Input = input, - Host = host, - }; - try + public async Task CloseAsync(CanvasProviderCloseRequest request, CancellationToken cancellationToken = default) { - var result = await handler.OnActionAsync(ctx, CancellationToken.None).ConfigureAwait(false); - return SerializeActionResult(result); - } - catch (CanvasError ce) - { - throw CanvasErrorHelpers.ToRpcException(ce); - } - catch (Exception ex) when (ex is not OperationCanceledException) - { - throw CanvasErrorHelpers.HandlerError(ex.Message); + try + { + await handler.OnCloseAsync(request, cancellationToken).ConfigureAwait(false); + } + catch (CanvasError ce) + { + throw CanvasErrorHelpers.ToRpcException(ce); + } + catch (Exception ex) when (ex is not OperationCanceledException) + { + throw CanvasErrorHelpers.HandlerError(ex.Message); + } } - } - private static JsonElement SerializeActionResult(object? value) - { - var element = CopilotClient.ToJsonElementForWire(value); - if (element.HasValue) + public async Task InvokeActionAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default) { - return element.Value; + try + { + var result = await handler.OnActionAsync(request, cancellationToken).ConfigureAwait(false); + return new CanvasInvokeActionResult { Result = SerializeActionResult(result) }; + } + catch (CanvasError ce) + { + throw CanvasErrorHelpers.ToRpcException(ce); + } + catch (Exception ex) when (ex is not OperationCanceledException) + { + throw CanvasErrorHelpers.HandlerError(ex.Message); + } } - using var doc = JsonDocument.Parse("null"); - return doc.RootElement.Clone(); } -#pragma warning restore GHCP001 /// /// Dispatches a command.execute event to the registered handler and diff --git a/dotnet/src/Types.cs b/dotnet/src/Types.cs index a02a5db3a..94130b604 100644 --- a/dotnet/src/Types.cs +++ b/dotnet/src/Types.cs @@ -2441,7 +2441,7 @@ protected SessionConfigBase(SessionConfigBase? other) /// /// Provider-side canvas lifecycle handler. The SDK routes inbound - /// canvas.open / canvas.close / canvas.action.invoke + /// canvas.open / canvas.close / canvas.invokeAction /// requests to this handler. /// [Experimental(Diagnostics.Experimental)] @@ -3090,9 +3090,8 @@ public sealed class SystemMessageTransformRpcResponse [JsonSerializable(typeof(string[]))] #pragma warning disable GHCP001 [JsonSerializable(typeof(CanvasDeclaration))] -[JsonSerializable(typeof(CanvasOpenResponse))] +[JsonSerializable(typeof(CanvasProviderOpenResult))] [JsonSerializable(typeof(CanvasHostContext))] -[JsonSerializable(typeof(CanvasHostCapabilities))] [JsonSerializable(typeof(ExtensionInfo))] #pragma warning restore GHCP001 internal partial class TypesJsonContext : JsonSerializerContext; diff --git a/dotnet/test/E2E/CanvasE2ETests.cs b/dotnet/test/E2E/CanvasE2ETests.cs new file mode 100644 index 000000000..a4e60479d --- /dev/null +++ b/dotnet/test/E2E/CanvasE2ETests.cs @@ -0,0 +1,254 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + *--------------------------------------------------------------------------------------------*/ + +using GitHub.Copilot.Rpc; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Xunit; +using Xunit.Abstractions; + +namespace GitHub.Copilot.Test.E2E; + +public class CanvasE2ETests(E2ETestFixture fixture, ITestOutputHelper output) + : E2ETestBase(fixture, "canvas", output) +{ + [Fact] + public async Task Should_Discover_Canvas_Via_List() + { + var handler = new TestCanvasHandler(); + await using var session = await CreateCanvasSessionAsync(handler); + + var result = await session.Rpc.Canvas.ListAsync(); + + var canvas = Assert.Single(result.Canvases); + Assert.Equal("counter", canvas.CanvasId); + Assert.Equal("Counter", canvas.DisplayName); + Assert.Equal("Tracks a counter value.", canvas.Description); + Assert.Single(canvas.Actions!); + Assert.Equal("increment", canvas.Actions![0].Name); + Assert.Empty(handler.OpenRequests); + } + + [Fact] + public async Task Should_Open_Canvas_Through_The_Handler() + { + var handler = new TestCanvasHandler(); + await using var session = await CreateCanvasSessionAsync(handler); + var canvas = Assert.Single((await session.Rpc.Canvas.ListAsync()).Canvases); + + var openResult = await session.Rpc.Canvas.OpenAsync( + canvasId: "counter", + instanceId: "counter-1", + extensionId: canvas.ExtensionId, + input: new Dictionary { ["start"] = 41 }); + + Assert.Equal("counter", openResult.CanvasId); + Assert.Equal("counter-1", openResult.InstanceId); + Assert.Equal(canvas.ExtensionId, openResult.ExtensionId); + Assert.Equal("Counter counter-1", openResult.Title); + Assert.Equal("ready", openResult.Status); + Assert.Equal("https://example.com/counter/counter-1", openResult.Url); + + var request = Assert.Single(handler.OpenRequests); + Assert.Equal(session.SessionId, request.SessionId); + Assert.Equal(canvas.ExtensionId, request.ExtensionId); + Assert.Equal("counter", request.CanvasId); + Assert.Equal("counter-1", request.InstanceId); + Assert.Equal(41, GetRequiredInt32(request.Input, "start")); + + var openCanvases = await session.Rpc.Canvas.ListOpenAsync(); + Assert.Single(openCanvases.OpenCanvases); + Assert.Equal("counter-1", openCanvases.OpenCanvases[0].InstanceId); + } + + [Fact] + public async Task Should_Invoke_Canvas_Action_Through_The_Handler() + { + var handler = new TestCanvasHandler(); + await using var session = await CreateCanvasSessionAsync(handler); + var canvas = Assert.Single((await session.Rpc.Canvas.ListAsync()).Canvases); + await session.Rpc.Canvas.OpenAsync( + canvasId: "counter", + instanceId: "counter-1", + extensionId: canvas.ExtensionId, + input: new Dictionary { ["start"] = 41 }); + + var result = await session.Rpc.Canvas.InvokeActionAsync( + instanceId: "counter-1", + actionName: "increment", + input: new Dictionary { ["delta"] = 1 }); + + var request = Assert.Single(handler.ActionRequests); + Assert.Equal(session.SessionId, request.SessionId); + Assert.Equal(canvas.ExtensionId, request.ExtensionId); + Assert.Equal("counter", request.CanvasId); + Assert.Equal("counter-1", request.InstanceId); + Assert.Equal("increment", request.ActionName); + Assert.Equal(1, GetRequiredInt32(request.Input, "delta")); + Assert.True(result.Result.HasValue); + Assert.NotEqual(JsonValueKind.Undefined, result.Result.Value.ValueKind); + } + + [Fact] + public async Task Should_Close_Canvas_Through_The_Handler() + { + var handler = new TestCanvasHandler(); + await using var session = await CreateCanvasSessionAsync(handler); + var canvas = Assert.Single((await session.Rpc.Canvas.ListAsync()).Canvases); + await session.Rpc.Canvas.OpenAsync( + canvasId: "counter", + instanceId: "counter-1", + extensionId: canvas.ExtensionId, + input: new Dictionary { ["start"] = 41 }); + + await session.Rpc.Canvas.CloseAsync("counter-1"); + + var request = Assert.Single(handler.CloseRequests); + Assert.Equal(session.SessionId, request.SessionId); + Assert.Equal(canvas.ExtensionId, request.ExtensionId); + Assert.Equal("counter", request.CanvasId); + Assert.Equal("counter-1", request.InstanceId); + + var openCanvases = await session.Rpc.Canvas.ListOpenAsync(); + Assert.Empty(openCanvases.OpenCanvases); + } + + private Task CreateCanvasSessionAsync(TestCanvasHandler handler) + { + return CreateSessionAsync(new SessionConfig + { + OnPermissionRequest = PermissionHandler.ApproveAll, + RequestCanvasRenderer = true, + RequestExtensions = true, + ExtensionInfo = new ExtensionInfo { Source = "dotnet-sdk-tests", Name = "canvas-provider" }, + Canvases = + [ + new CanvasDeclaration + { + Id = "counter", + DisplayName = "Counter", + Description = "Tracks a counter value.", + Actions = + [ + new CanvasAction + { + Name = "increment", + Description = "Increments the counter.", + } + ], + } + ], + CanvasHandler = handler, + }); + } + + private static int GetRequiredInt32(JsonElement? element, string propertyName) + { + Assert.True(element.HasValue); + return element.Value.GetProperty(propertyName).GetInt32(); + } + + private sealed class TestCanvasHandler : CanvasHandlerBase + { + public List OpenRequests { get; } = []; + public List CloseRequests { get; } = []; + public List ActionRequests { get; } = []; + + public override Task OnOpenAsync(CanvasProviderOpenRequest context, CancellationToken cancellationToken) + { + OpenRequests.Add(Clone(context)); + return Task.FromResult(new CanvasProviderOpenResult + { + Url = $"https://example.com/counter/{context.InstanceId}", + Title = $"Counter {context.InstanceId}", + Status = "ready", + }); + } + + public override Task OnCloseAsync(CanvasProviderCloseRequest context, CancellationToken cancellationToken) + { + CloseRequests.Add(Clone(context)); + return Task.CompletedTask; + } + + public override Task OnActionAsync(CanvasProviderInvokeActionRequest context, CancellationToken cancellationToken) + { + ActionRequests.Add(Clone(context)); + var openRequest = OpenRequests.LastOrDefault(request => request.InstanceId == context.InstanceId); + var current = openRequest is not null && openRequest.Input.HasValue + ? openRequest.Input.Value.GetProperty("start").GetInt32() + : 0; + var delta = context.Input.HasValue + ? context.Input.Value.GetProperty("delta").GetInt32() + : 0; + using var document = JsonDocument.Parse($@"{{""count"":{current + delta}}}"); + return Task.FromResult(document.RootElement.Clone()); + } + + private static CanvasProviderOpenRequest Clone(CanvasProviderOpenRequest request) + => new() + { + SessionId = request.SessionId, + ExtensionId = request.ExtensionId, + CanvasId = request.CanvasId, + InstanceId = request.InstanceId, + Input = Clone(request.Input), + Host = Clone(request.Host), + }; + + private static CanvasProviderCloseRequest Clone(CanvasProviderCloseRequest request) + => new() + { + SessionId = request.SessionId, + ExtensionId = request.ExtensionId, + CanvasId = request.CanvasId, + InstanceId = request.InstanceId, + Host = Clone(request.Host), + }; + + private static CanvasProviderInvokeActionRequest Clone(CanvasProviderInvokeActionRequest request) + => new() + { + SessionId = request.SessionId, + ExtensionId = request.ExtensionId, + CanvasId = request.CanvasId, + InstanceId = request.InstanceId, + ActionName = request.ActionName, + Input = Clone(request.Input), + Host = Clone(request.Host), + }; + + private static JsonElement? Clone(JsonElement? element) + { + if (!element.HasValue) + { + return null; + } + + using var document = JsonDocument.Parse(element.Value.GetRawText()); + return document.RootElement.Clone(); + } + + private static CanvasHostContext? Clone(CanvasHostContext? host) + { + if (host is null) + { + return null; + } + + return new CanvasHostContext + { + Capabilities = host.Capabilities is null + ? null + : new CanvasHostContextCapabilities + { + Canvases = host.Capabilities.Canvases, + }, + }; + } + } +} diff --git a/dotnet/test/Unit/CanvasTests.cs b/dotnet/test/Unit/CanvasTests.cs index fc5db84aa..6a2e71a58 100644 --- a/dotnet/test/Unit/CanvasTests.cs +++ b/dotnet/test/Unit/CanvasTests.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using GitHub.Copilot; +using GitHub.Copilot.Rpc; using Xunit; namespace GitHub.Copilot.Test.Unit; @@ -47,10 +48,10 @@ public void CanvasDeclaration_Serializes_CamelCase_SkippingNulls() } [Fact] - public void CanvasOpenResponse_Roundtrips_WithCamelCaseFields() + public void CanvasProviderOpenResult_Roundtrips_WithCamelCaseFields() { var options = GetSerializerOptions(); - var response = new CanvasOpenResponse + var response = new CanvasProviderOpenResult { Url = "https://example.com/c/1", Title = "Demo", @@ -58,7 +59,7 @@ public void CanvasOpenResponse_Roundtrips_WithCamelCaseFields() }; var json = JsonSerializer.Serialize(response, options); - var parsed = JsonSerializer.Deserialize(json, options); + var parsed = JsonSerializer.Deserialize(json, options); Assert.NotNull(parsed); Assert.Equal("https://example.com/c/1", parsed!.Url); @@ -81,7 +82,7 @@ public void ExtensionInfo_Serializes_SourceAndName() public async Task CanvasHandlerBase_DefaultOnClose_Completes() { var handler = new TestHandler(); - await handler.OnCloseAsync(new CanvasLifecycleContext(), CancellationToken.None); + await handler.OnCloseAsync(new CanvasProviderCloseRequest(), CancellationToken.None); } [Fact] @@ -89,7 +90,7 @@ public async Task CanvasHandlerBase_DefaultOnAction_ThrowsNoHandlerCanvasError() { var handler = new TestHandler(); var ex = await Assert.ThrowsAsync( - () => handler.OnActionAsync(new CanvasActionContext(), CancellationToken.None)); + () => handler.OnActionAsync(new CanvasProviderInvokeActionRequest(), CancellationToken.None)); Assert.Equal("canvas_action_no_handler", ex.Code); } @@ -154,7 +155,7 @@ public void ResumeSessionConfig_Clone_CopiesCanvasFields() private sealed class TestHandler : CanvasHandlerBase { - public override Task OnOpenAsync(CanvasOpenContext context, CancellationToken cancellationToken) - => Task.FromResult(new CanvasOpenResponse { Url = "https://example.com" }); + public override Task OnOpenAsync(CanvasProviderOpenRequest context, CancellationToken cancellationToken) + => Task.FromResult(new CanvasProviderOpenResult { Url = "https://example.com" }); } } diff --git a/go/canvas.go b/go/canvas.go index 2d122db29..d56039adf 100644 --- a/go/canvas.go +++ b/go/canvas.go @@ -28,74 +28,22 @@ type CanvasDeclaration struct { } // CanvasOpenResponse is the response returned from CanvasHandler.OnOpen. -type CanvasOpenResponse struct { - // URL the host should render. Optional for canvases with no visual surface. - URL *string `json:"url,omitempty"` - // Title is the provider-supplied title shown in host chrome. - Title *string `json:"title,omitempty"` - // Status is the provider-supplied status text shown in host chrome. - Status *string `json:"status,omitempty"` -} +type CanvasOpenResponse = rpc.CanvasProviderOpenResult // CanvasHostContext carries host capability hints passed to canvas provider callbacks. -type CanvasHostContext struct { - // Capabilities describes host feature support relevant to canvases. - Capabilities CanvasHostCapabilities `json:"capabilities"` -} +type CanvasHostContext = rpc.CanvasHostContext // CanvasHostCapabilities describes host capability details passed to canvas provider callbacks. -type CanvasHostCapabilities struct { - // Canvases indicates whether the host supports canvas rendering. - Canvases bool `json:"canvases"` -} +type CanvasHostCapabilities = rpc.CanvasHostContextCapabilities // CanvasOpenContext is the context handed to CanvasHandler.OnOpen. -type CanvasOpenContext struct { - // SessionID is the session that requested the canvas. - SessionID string - // ExtensionID is the owning provider identifier. - ExtensionID string - // CanvasID is the canvas id from the declaring CanvasDeclaration. - CanvasID string - // InstanceID is the stable instance id supplied by the runtime. - InstanceID string - // Input is the validated input payload. - Input any - // Host carries host capabilities supplied by the runtime. - Host *CanvasHostContext -} +type CanvasOpenContext = rpc.CanvasProviderOpenRequest // CanvasActionContext is the context handed to CanvasHandler.OnAction. -type CanvasActionContext struct { - // SessionID is the session that invoked the action. - SessionID string - // ExtensionID is the owning provider identifier. - ExtensionID string - // CanvasID is the canvas id targeted by the action. - CanvasID string - // InstanceID is the instance id targeted by the action. - InstanceID string - // ActionName is the action name from CanvasAction.Name. - ActionName string - // Input is the validated input payload. - Input any - // Host carries host capabilities supplied by the runtime. - Host *CanvasHostContext -} +type CanvasActionContext = rpc.CanvasProviderInvokeActionRequest // CanvasLifecycleContext is the context handed to a canvas's close lifecycle hook. -type CanvasLifecycleContext struct { - // SessionID is the session owning the canvas instance. - SessionID string - // ExtensionID is the owning provider identifier. - ExtensionID string - // CanvasID is the canvas id from the declaring CanvasDeclaration. - CanvasID string - // InstanceID is the instance id this lifecycle event applies to. - InstanceID string - // Host carries host capabilities supplied by the runtime. - Host *CanvasHostContext -} +type CanvasLifecycleContext = rpc.CanvasProviderCloseRequest // CanvasError is a structured error returned from canvas handlers. // @@ -131,7 +79,7 @@ func CanvasErrorNoHandler() *CanvasError { // // A session installs a single CanvasHandler (via SessionConfig.CanvasHandler). // The handler receives every inbound `canvas.open` / `canvas.close` / -// `canvas.action.invoke` JSON-RPC request the runtime issues for this session +// `canvas.invokeAction` JSON-RPC request the runtime issues for this session // and decides — typically by inspecting CanvasOpenContext.CanvasID — which // application-side canvas should handle the call. // @@ -166,67 +114,3 @@ func (CanvasHandlerDefaults) OnClose(ctx context.Context, c CanvasLifecycleConte func (CanvasHandlerDefaults) OnAction(ctx context.Context, c CanvasActionContext) (any, error) { return nil, CanvasErrorNoHandler() } - -// canvasProviderRequestParams is the wire shape of the common fields sent by -// direct `canvas.*` provider callbacks (canvas.open / canvas.close). -type canvasProviderRequestParams struct { - SessionID string `json:"sessionId"` - ExtensionID string `json:"extensionId"` - CanvasID string `json:"canvasId"` - InstanceID string `json:"instanceId"` - Input any `json:"input,omitempty"` - Host *CanvasHostContext `json:"host,omitempty"` -} - -func (p *canvasProviderRequestParams) toOpenContext() CanvasOpenContext { - return CanvasOpenContext{ - SessionID: p.SessionID, - ExtensionID: p.ExtensionID, - CanvasID: p.CanvasID, - InstanceID: p.InstanceID, - Input: p.Input, - Host: p.Host, - } -} - -func (p *canvasProviderRequestParams) toLifecycleContext() CanvasLifecycleContext { - return CanvasLifecycleContext{ - SessionID: p.SessionID, - ExtensionID: p.ExtensionID, - CanvasID: p.CanvasID, - InstanceID: p.InstanceID, - Host: p.Host, - } -} - -// canvasInvokeParams is the wire shape for `canvas.action.invoke`. -type canvasInvokeParams struct { - SessionID string `json:"sessionId"` - ExtensionID string `json:"extensionId"` - CanvasID string `json:"canvasId"` - InstanceID string `json:"instanceId"` - ActionName string `json:"actionName"` - Input any `json:"input,omitempty"` - Host *CanvasHostContext `json:"host,omitempty"` -} - -func (p *canvasInvokeParams) toActionContext() CanvasActionContext { - return CanvasActionContext{ - SessionID: p.SessionID, - ExtensionID: p.ExtensionID, - CanvasID: p.CanvasID, - InstanceID: p.InstanceID, - ActionName: p.ActionName, - Input: p.Input, - Host: p.Host, - } -} - -// ExtensionInfo carries stable extension identity for session participants -// that provide canvases. -type ExtensionInfo struct { - // Source is the extension namespace/source, e.g. "github-app". - Source string `json:"source"` - // Name is the stable provider name within the source namespace. - Name string `json:"name"` -} diff --git a/go/canvas_test.go b/go/canvas_test.go index be0538d58..0ef3dffd3 100644 --- a/go/canvas_test.go +++ b/go/canvas_test.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "errors" + "io" "testing" "github.com/github/copilot-sdk/go/internal/jsonrpc2" @@ -95,12 +96,16 @@ func TestCanvasError_ErrorString(t *testing.T) { } } -// recordingCanvasHandler captures calls for assertion. type recordingCanvasHandler struct { CanvasHandlerDefaults - openCtx *CanvasOpenContext - openResult CanvasOpenResponse - openErr error + openCtx *CanvasOpenContext + closeCtx *CanvasLifecycleContext + actionCtx *CanvasActionContext + openResult CanvasOpenResponse + actionResult any + openErr error + closeErr error + actionErr error } func (h *recordingCanvasHandler) OnOpen(ctx context.Context, c CanvasOpenContext) (CanvasOpenResponse, error) { @@ -108,130 +113,198 @@ func (h *recordingCanvasHandler) OnOpen(ctx context.Context, c CanvasOpenContext return h.openResult, h.openErr } -func TestClient_HandleCanvasOpen_DispatchesToHandler(t *testing.T) { +func (h *recordingCanvasHandler) OnClose(ctx context.Context, c CanvasLifecycleContext) error { + h.closeCtx = &c + return h.closeErr +} + +func (h *recordingCanvasHandler) OnAction(ctx context.Context, c CanvasActionContext) (any, error) { + h.actionCtx = &c + return h.actionResult, h.actionErr +} + +func TestCanvasAdapter_DispatchesToHandler(t *testing.T) { title := "Echo" url := "https://example.test/echo" handler := &recordingCanvasHandler{ openResult: CanvasOpenResponse{URL: &url, Title: &title}, + actionResult: map[string]any{ + "count": float64(2), + }, } - session := &Session{SessionID: "s1"} + session := newTestCanvasSession("s1") session.registerCanvasHandler(handler) - c := &Client{sessions: map[string]*Session{"s1": session}} - - params := canvasProviderRequestParams{ + openResp, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{ SessionID: "s1", ExtensionID: "project:echo", CanvasID: "echo", InstanceID: "echo-1", Input: map[string]any{"x": float64(1)}, - } - resp, rpcErr := c.handleCanvasOpen(params) - if rpcErr != nil { - t.Fatalf("unexpected rpc error: %+v", rpcErr) + }) + if err != nil { + t.Fatalf("unexpected open error: %v", err) } if handler.openCtx == nil { t.Fatalf("handler.OnOpen was not called") } if handler.openCtx.CanvasID != "echo" || handler.openCtx.InstanceID != "echo-1" { - t.Fatalf("unexpected ctx: %+v", handler.openCtx) + t.Fatalf("unexpected open ctx: %+v", handler.openCtx) } - if resp.URL == nil || *resp.URL != url { - t.Fatalf("response URL not propagated: %+v", resp) + if openResp.URL == nil || *openResp.URL != url { + t.Fatalf("response URL not propagated: %+v", openResp) } -} -func TestClient_HandleCanvasOpen_NoHandler_ReturnsUnsetError(t *testing.T) { - session := &Session{SessionID: "s1"} - c := &Client{sessions: map[string]*Session{"s1": session}} - - _, rpcErr := c.handleCanvasOpen(canvasProviderRequestParams{SessionID: "s1"}) - if rpcErr == nil { - t.Fatalf("expected error when no canvas handler installed") + actionResp, err := session.clientSessionApis.Canvas.InvokeAction(&rpc.CanvasProviderInvokeActionRequest{ + SessionID: "s1", + ExtensionID: "project:echo", + CanvasID: "echo", + InstanceID: "echo-1", + ActionName: "increment", + Input: map[string]any{"amount": float64(1)}, + }) + if err != nil { + t.Fatalf("unexpected action error: %v", err) } - if rpcErr.Code != -32603 { - t.Fatalf("expected internal-error code, got %d", rpcErr.Code) + if handler.actionCtx == nil { + t.Fatalf("handler.OnAction was not called") } - var data map[string]string - if err := json.Unmarshal(rpcErr.Data, &data); err != nil { - t.Fatalf("invalid error data: %v", err) + if handler.actionCtx.ActionName != "increment" { + t.Fatalf("unexpected action ctx: %+v", handler.actionCtx) } - if data["code"] != "canvas_handler_unset" { - t.Fatalf("expected code=canvas_handler_unset, got %q", data["code"]) + result, ok := actionResp.Result.(map[string]any) + if !ok || result["count"] != float64(2) { + t.Fatalf("unexpected action result: %#v", actionResp.Result) } -} -func TestClient_HandleCanvasOpen_HandlerCanvasError_Wired(t *testing.T) { - handler := &recordingCanvasHandler{ - openErr: NewCanvasError("permission_denied", "nope"), + closeResp, err := session.clientSessionApis.Canvas.Close(&rpc.CanvasProviderCloseRequest{ + SessionID: "s1", + ExtensionID: "project:echo", + CanvasID: "echo", + InstanceID: "echo-1", + }) + if err != nil { + t.Fatalf("unexpected close error: %v", err) } - session := &Session{SessionID: "s1"} - session.registerCanvasHandler(handler) - c := &Client{sessions: map[string]*Session{"s1": session}} - - _, rpcErr := c.handleCanvasOpen(canvasProviderRequestParams{SessionID: "s1"}) - if rpcErr == nil { - t.Fatalf("expected error") + if closeResp == nil { + t.Fatal("expected non-nil close response") } - var data map[string]string - _ = json.Unmarshal(rpcErr.Data, &data) - if data["code"] != "permission_denied" { - t.Fatalf("expected propagated code, got %q", data["code"]) + if handler.closeCtx == nil || handler.closeCtx.CanvasID != "echo" { + t.Fatalf("unexpected close ctx: %+v", handler.closeCtx) } } -func TestClient_HandleCanvasOpen_HandlerGenericError_WrappedAsCanvasHandlerError(t *testing.T) { - handler := &recordingCanvasHandler{openErr: errors.New("boom")} - session := &Session{SessionID: "s1"} - session.registerCanvasHandler(handler) - c := &Client{sessions: map[string]*Session{"s1": session}} +func TestCanvasAdapter_NoHandler_ReturnsUnsetError(t *testing.T) { + session := newTestCanvasSession("s1") - _, rpcErr := c.handleCanvasOpen(canvasProviderRequestParams{SessionID: "s1"}) - if rpcErr == nil { - t.Fatalf("expected error") - } - var data map[string]string - _ = json.Unmarshal(rpcErr.Data, &data) - if data["code"] != "canvas_handler_error" { - t.Fatalf("expected code=canvas_handler_error, got %q", data["code"]) - } - if data["message"] != "boom" { - t.Fatalf("expected message=boom, got %q", data["message"]) - } + _, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"}) + assertCanvasJSONRPCError(t, err, "canvas_handler_unset", "") } -// Ensure the JSON-RPC inbound parsing wires through RequestHandlerFor correctly. -func TestClient_HandleCanvasOpen_RawJSONRoundTrip(t *testing.T) { - handler := &recordingCanvasHandler{ - openResult: CanvasOpenResponse{Status: strPtr("ready")}, - } - session := &Session{SessionID: "s1"} - session.registerCanvasHandler(handler) - c := &Client{sessions: map[string]*Session{"s1": session}} +func TestCanvasAdapter_HandlerCanvasError_Wired(t *testing.T) { + session := newTestCanvasSession("s1") + session.registerCanvasHandler(&recordingCanvasHandler{ + openErr: NewCanvasError("permission_denied", "nope"), + }) + + _, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"}) + assertCanvasJSONRPCError(t, err, "permission_denied", "nope") +} + +func TestCanvasAdapter_HandlerGenericError_WrappedAsCanvasHandlerError(t *testing.T) { + session := newTestCanvasSession("s1") + session.registerCanvasHandler(&recordingCanvasHandler{ + openErr: errors.New("boom"), + }) + + _, err := session.clientSessionApis.Canvas.Open(&rpc.CanvasProviderOpenRequest{SessionID: "s1"}) + assertCanvasJSONRPCError(t, err, "canvas_handler_error", "boom") +} - rpcHandler := jsonrpc2.RequestHandlerFor(c.handleCanvasOpen) - raw := []byte(`{"sessionId":"s1","extensionId":"ext","canvasId":"echo","instanceId":"i1","input":{"k":"v"},"host":{"capabilities":{"canvases":true}}}`) - out, rpcErr := rpcHandler(raw) - if rpcErr != nil { - t.Fatalf("unexpected rpc error: %v", rpcErr) +func TestCanvasRegisterClientSessionApiHandlers_RawJSONRoundTrip(t *testing.T) { + clientToServerReader, clientToServerWriter := io.Pipe() + serverToClientReader, serverToClientWriter := io.Pipe() + + requester := jsonrpc2.NewClient(clientToServerWriter, serverToClientReader) + server := jsonrpc2.NewClient(serverToClientWriter, clientToServerReader) + session := newTestCanvasSession("s1") + session.registerCanvasHandler(&recordingCanvasHandler{ + openResult: CanvasOpenResponse{Status: strPtr("ready")}, + actionResult: map[string]any{"count": float64(2)}, + }) + rpc.RegisterClientSessionApiHandlers(server, func(sessionID string) *rpc.ClientSessionApiHandlers { + if sessionID == "s1" { + return session.clientSessionApis + } + return nil + }) + + requester.Start() + server.Start() + t.Cleanup(func() { + requester.Stop() + server.Stop() + _ = clientToServerWriter.Close() + _ = clientToServerReader.Close() + _ = serverToClientWriter.Close() + _ = serverToClientReader.Close() + }) + + raw, err := requester.Request("canvas.open", map[string]any{ + "sessionId": "s1", + "extensionId": "ext", + "canvasId": "echo", + "instanceId": "i1", + "input": map[string]any{"k": "v"}, + "host": map[string]any{ + "capabilities": map[string]any{ + "canvases": true, + }, + }, + }) + if err != nil { + t.Fatalf("unexpected rpc error: %v", err) } + + handler := session.getCanvasHandler().(*recordingCanvasHandler) if handler.openCtx == nil { t.Fatalf("handler not invoked") } - if handler.openCtx.Host == nil || !handler.openCtx.Host.Capabilities.Canvases { + if handler.openCtx.Host == nil || handler.openCtx.Host.Capabilities == nil || + handler.openCtx.Host.Capabilities.Canvases == nil || !*handler.openCtx.Host.Capabilities.Canvases { t.Fatalf("host capabilities not parsed: %+v", handler.openCtx.Host) } + var decoded map[string]any - if err := json.Unmarshal(out, &decoded); err != nil { + if err := json.Unmarshal(raw, &decoded); err != nil { t.Fatalf("bad output JSON: %v", err) } if decoded["status"] != "ready" { t.Fatalf("expected status=ready, got %v", decoded["status"]) } + + actionRaw, err := requester.Request("canvas.invokeAction", map[string]any{ + "sessionId": "s1", + "extensionId": "ext", + "canvasId": "echo", + "instanceId": "i1", + "actionName": "increment", + "input": map[string]any{"amount": float64(2)}, + }) + if err != nil { + t.Fatalf("unexpected action rpc error: %v", err) + } + var actionDecoded map[string]any + if err := json.Unmarshal(actionRaw, &actionDecoded); err != nil { + t.Fatalf("bad action output JSON: %v", err) + } + if actionDecoded["count"] != float64(2) { + t.Fatalf("expected raw provider result, got %v", actionDecoded) + } } -func TestResumeSessionResponse_OpenCanvasesParse(t *testing.T) { +func TestCanvasResumeSessionResponse_OpenCanvasesParse(t *testing.T) { raw := []byte(`{ "sessionId": "s1", "workspacePath": "/tmp/ws", @@ -265,7 +338,7 @@ func TestResumeSessionResponse_OpenCanvasesParse(t *testing.T) { } } -func TestResumeSessionRequest_OpenCanvasesWireShape(t *testing.T) { +func TestCanvasResumeSessionRequest_OpenCanvasesWireShape(t *testing.T) { req := resumeSessionRequest{ SessionID: "s1", OpenCanvases: []rpc.OpenCanvasInstance{ @@ -301,7 +374,6 @@ func TestResumeSessionRequest_OpenCanvasesWireShape(t *testing.T) { t.Fatalf("expected instanceId=echo-1, got %v", first["instanceId"]) } - // Omitted when nil empty := resumeSessionRequest{SessionID: "s1"} emptyData, err := json.Marshal(empty) if err != nil { @@ -316,4 +388,39 @@ func TestResumeSessionRequest_OpenCanvasesWireShape(t *testing.T) { } } +func assertCanvasJSONRPCError(t *testing.T, err error, wantCode, wantMessage string) { + t.Helper() + + if err == nil { + t.Fatal("expected error") + } + rpcErr, ok := err.(*jsonrpc2.Error) + if !ok { + t.Fatalf("expected *jsonrpc2.Error, got %T", err) + } + if rpcErr.Code != -32603 { + t.Fatalf("expected internal-error code, got %d", rpcErr.Code) + } + + var data map[string]string + if err := json.Unmarshal(rpcErr.Data, &data); err != nil { + t.Fatalf("invalid error data: %v", err) + } + if data["code"] != wantCode { + t.Fatalf("expected code=%s, got %q", wantCode, data["code"]) + } + if wantMessage != "" && data["message"] != wantMessage { + t.Fatalf("expected message=%q, got %q", wantMessage, data["message"]) + } +} + +func newTestCanvasSession(sessionID string) *Session { + session := &Session{ + SessionID: sessionID, + clientSessionApis: &rpc.ClientSessionApiHandlers{}, + } + session.clientSessionApis.Canvas = newCanvasClientSessionAdapter(session) + return session +} + func strPtr(s string) *string { return &s } diff --git a/go/client.go b/go/client.go index 6e7557b0b..b6da53461 100644 --- a/go/client.go +++ b/go/client.go @@ -629,7 +629,6 @@ func (c *Client) CreateSession(ctx context.Context, config *SessionConfig) (*Ses req.Canvases = config.Canvases req.RequestCanvasRenderer = config.RequestCanvasRenderer req.RequestExtensions = config.RequestExtensions - req.ExtensionInfo = config.ExtensionInfo if len(config.Commands) > 0 { cmds := make([]wireCommand, 0, len(config.Commands)) @@ -852,7 +851,6 @@ func (c *Client) ResumeSessionWithOptions(ctx context.Context, sessionID string, req.OpenCanvases = config.OpenCanvases req.RequestCanvasRenderer = config.RequestCanvasRenderer req.RequestExtensions = config.RequestExtensions - req.ExtensionInfo = config.ExtensionInfo if config.OnPermissionRequest != nil { req.RequestPermission = Bool(true) } @@ -1762,9 +1760,6 @@ func (c *Client) setupNotificationHandler() { c.client.SetRequestHandler("autoModeSwitch.request", jsonrpc2.RequestHandlerFor(c.handleAutoModeSwitchRequest)) c.client.SetRequestHandler("hooks.invoke", jsonrpc2.RequestHandlerFor(c.handleHooksInvoke)) c.client.SetRequestHandler("systemMessage.transform", jsonrpc2.RequestHandlerFor(c.handleSystemMessageTransform)) - c.client.SetRequestHandler("canvas.open", jsonrpc2.RequestHandlerFor(c.handleCanvasOpen)) - c.client.SetRequestHandler("canvas.close", jsonrpc2.RequestHandlerFor(c.handleCanvasClose)) - c.client.SetRequestHandler("canvas.action.invoke", jsonrpc2.RequestHandlerFor(c.handleCanvasActionInvoke)) rpc.RegisterClientSessionApiHandlers(c.client, func(sessionID string) *rpc.ClientSessionApiHandlers { c.sessionsMux.Lock() defer c.sessionsMux.Unlock() @@ -1913,89 +1908,3 @@ func (c *Client) handleSystemMessageTransform(req systemMessageTransformRequest) } return resp, nil } - -// canvasJSONRPCError converts a CanvasError into the structured JSON-RPC error -// envelope used by all canvas.* dispatch responses. -func canvasJSONRPCError(cerr *CanvasError) *jsonrpc2.Error { - data, _ := json.Marshal(map[string]string{ - "code": cerr.Code, - "message": cerr.Message, - }) - return &jsonrpc2.Error{ - Code: -32603, - Message: cerr.Message, - Data: data, - } -} - -// resolveCanvasSession looks up a session and its installed CanvasHandler, -// returning the canvas_handler_unset error envelope if either is missing. -func (c *Client) resolveCanvasSession(sessionID string) (*Session, CanvasHandler, *jsonrpc2.Error) { - c.sessionsMux.Lock() - session, ok := c.sessions[sessionID] - c.sessionsMux.Unlock() - if !ok { - return nil, nil, canvasJSONRPCError(NewCanvasError( - "canvas_handler_unset", - fmt.Sprintf("unknown session %s", sessionID), - )) - } - handler := session.getCanvasHandler() - if handler == nil { - return session, nil, canvasJSONRPCError(NewCanvasError( - "canvas_handler_unset", - "No CanvasHandler installed on this session; install one via SessionConfig.CanvasHandler before creating the session.", - )) - } - return session, handler, nil -} - -// canvasResultError normalizes any error returned from a CanvasHandler method -// into the structured JSON-RPC error envelope. -func canvasResultError(err error) *jsonrpc2.Error { - if err == nil { - return nil - } - if cerr, ok := err.(*CanvasError); ok { - return canvasJSONRPCError(cerr) - } - return canvasJSONRPCError(NewCanvasError("canvas_handler_error", err.Error())) -} - -// handleCanvasOpen dispatches an inbound canvas.open request to the session's CanvasHandler. -func (c *Client) handleCanvasOpen(params canvasProviderRequestParams) (CanvasOpenResponse, *jsonrpc2.Error) { - _, handler, rpcErr := c.resolveCanvasSession(params.SessionID) - if rpcErr != nil { - return CanvasOpenResponse{}, rpcErr - } - resp, err := handler.OnOpen(context.Background(), params.toOpenContext()) - if err != nil { - return CanvasOpenResponse{}, canvasResultError(err) - } - return resp, nil -} - -// handleCanvasClose dispatches an inbound canvas.close request to the session's CanvasHandler. -func (c *Client) handleCanvasClose(params canvasProviderRequestParams) (any, *jsonrpc2.Error) { - _, handler, rpcErr := c.resolveCanvasSession(params.SessionID) - if rpcErr != nil { - return nil, rpcErr - } - if err := handler.OnClose(context.Background(), params.toLifecycleContext()); err != nil { - return nil, canvasResultError(err) - } - return nil, nil -} - -// handleCanvasActionInvoke dispatches an inbound canvas.action.invoke request to the session's CanvasHandler. -func (c *Client) handleCanvasActionInvoke(params canvasInvokeParams) (any, *jsonrpc2.Error) { - _, handler, rpcErr := c.resolveCanvasSession(params.SessionID) - if rpcErr != nil { - return nil, rpcErr - } - result, err := handler.OnAction(context.Background(), params.toActionContext()) - if err != nil { - return nil, canvasResultError(err) - } - return result, nil -} diff --git a/go/internal/e2e/canvas_e2e_test.go b/go/internal/e2e/canvas_e2e_test.go new file mode 100644 index 000000000..0cf41f415 --- /dev/null +++ b/go/internal/e2e/canvas_e2e_test.go @@ -0,0 +1,225 @@ +package e2e + +import ( + "context" + "sync" + "testing" + + copilot "github.com/github/copilot-sdk/go" + "github.com/github/copilot-sdk/go/internal/e2e/testharness" + "github.com/github/copilot-sdk/go/rpc" +) + +func TestCanvasE2E(t *testing.T) { + ctx := testharness.NewTestContext(t) + client := ctx.NewClient() + t.Cleanup(func() { client.ForceStop() }) + + handler := &testCanvasHandler{} + canvasDecl := copilot.CanvasDeclaration{ + ID: "counter", + DisplayName: "Counter", + Description: "A simple counter canvas for e2e testing", + InputSchema: map[string]any{ + "type": "object", + "properties": map[string]any{ + "startValue": map[string]any{"type": "number"}, + }, + }, + Actions: []rpc.CanvasAction{{ + Name: "increment", + Description: copilot.String("Increment the counter"), + InputSchema: map[string]any{ + "type": "object", + "properties": map[string]any{ + "amount": map[string]any{"type": "number"}, + }, + }, + }}, + } + + session, err := client.CreateSession(t.Context(), &copilot.SessionConfig{ + OnPermissionRequest: copilot.PermissionHandler.ApproveAll, + Canvases: []copilot.CanvasDeclaration{canvasDecl}, + CanvasHandler: handler, + }) + if err != nil { + t.Fatalf("Failed to create session: %v", err) + } + + listResult, err := session.RPC.Canvas.List(t.Context()) + if err != nil { + t.Fatalf("Canvas.List failed: %v", err) + } + if len(listResult.Canvases) != 1 { + t.Fatalf("expected 1 canvas, got %d", len(listResult.Canvases)) + } + if listResult.Canvases[0].CanvasID != "counter" { + t.Fatalf("expected canvasId=counter, got %q", listResult.Canvases[0].CanvasID) + } + + openResult, err := session.RPC.Canvas.Open(t.Context(), &rpc.CanvasOpenRequest{ + CanvasID: "counter", + InstanceID: "counter-1", + Input: map[string]any{ + "startValue": float64(3), + }, + }) + if err != nil { + t.Fatalf("Canvas.Open failed: %v", err) + } + if openResult.CanvasID != "counter" || openResult.InstanceID != "counter-1" { + t.Fatalf("unexpected open result: %+v", openResult) + } + if openResult.URL == nil || *openResult.URL != "https://example.test/counter/counter-1" { + t.Fatalf("unexpected open URL: %+v", openResult.URL) + } + if calls := handler.OpenCalls(); len(calls) != 1 || calls[0].CanvasID != "counter" || calls[0].InstanceID != "counter-1" { + t.Fatalf("unexpected open calls: %+v", calls) + } + + actionResult, err := session.RPC.Canvas.InvokeAction(t.Context(), &rpc.CanvasInvokeActionRequest{ + InstanceID: "counter-1", + ActionName: "increment", + Input: map[string]any{ + "amount": float64(2), + }, + }) + if err != nil { + t.Fatalf("Canvas.InvokeAction failed: %v", err) + } + actionPayload, ok := actionResult.Result.(map[string]any) + if !ok || actionPayload["count"] != float64(5) { + t.Fatalf("unexpected action result: %#v", actionResult.Result) + } + if calls := handler.ActionCalls(); len(calls) != 1 || calls[0].ActionName != "increment" { + t.Fatalf("unexpected action calls: %+v", calls) + } + + closeResult, err := session.RPC.Canvas.Close(t.Context(), &rpc.CanvasCloseRequest{ + InstanceID: "counter-1", + }) + if err != nil { + t.Fatalf("Canvas.Close failed: %v", err) + } + if closeResult == nil { + t.Fatal("expected non-nil close result") + } + if calls := handler.CloseCalls(); len(calls) != 1 || calls[0].CanvasID != "counter" || calls[0].InstanceID != "counter-1" { + t.Fatalf("unexpected close calls: %+v", calls) + } +} + +type testCanvasHandler struct { + copilot.CanvasHandlerDefaults + + mu sync.Mutex + openCalls []canvasOpenCall + closeCalls []canvasCloseCall + actionCalls []canvasActionCall + counts map[string]float64 +} + +type canvasOpenCall struct { + CanvasID string + InstanceID string + Input any +} + +type canvasCloseCall struct { + CanvasID string + InstanceID string +} + +type canvasActionCall struct { + CanvasID string + InstanceID string + ActionName string + Input any +} + +func (h *testCanvasHandler) OnOpen(ctx context.Context, req copilot.CanvasOpenContext) (copilot.CanvasOpenResponse, error) { + h.mu.Lock() + defer h.mu.Unlock() + + if h.counts == nil { + h.counts = make(map[string]float64) + } + h.openCalls = append(h.openCalls, canvasOpenCall{ + CanvasID: req.CanvasID, + InstanceID: req.InstanceID, + Input: req.Input, + }) + h.counts[req.InstanceID] = numberField(req.Input, "startValue") + + return copilot.CanvasOpenResponse{ + URL: copilot.String("https://example.test/counter/" + req.InstanceID), + Title: copilot.String("Counter"), + Status: copilot.String("ready"), + }, nil +} + +func (h *testCanvasHandler) OnClose(ctx context.Context, req copilot.CanvasLifecycleContext) error { + h.mu.Lock() + defer h.mu.Unlock() + + h.closeCalls = append(h.closeCalls, canvasCloseCall{ + CanvasID: req.CanvasID, + InstanceID: req.InstanceID, + }) + delete(h.counts, req.InstanceID) + return nil +} + +func (h *testCanvasHandler) OnAction(ctx context.Context, req copilot.CanvasActionContext) (any, error) { + h.mu.Lock() + defer h.mu.Unlock() + + if h.counts == nil { + h.counts = make(map[string]float64) + } + h.actionCalls = append(h.actionCalls, canvasActionCall{ + CanvasID: req.CanvasID, + InstanceID: req.InstanceID, + ActionName: req.ActionName, + Input: req.Input, + }) + h.counts[req.InstanceID] += numberField(req.Input, "amount") + return map[string]any{"count": h.counts[req.InstanceID]}, nil +} + +func (h *testCanvasHandler) OpenCalls() []canvasOpenCall { + h.mu.Lock() + defer h.mu.Unlock() + out := make([]canvasOpenCall, len(h.openCalls)) + copy(out, h.openCalls) + return out +} + +func (h *testCanvasHandler) CloseCalls() []canvasCloseCall { + h.mu.Lock() + defer h.mu.Unlock() + out := make([]canvasCloseCall, len(h.closeCalls)) + copy(out, h.closeCalls) + return out +} + +func (h *testCanvasHandler) ActionCalls() []canvasActionCall { + h.mu.Lock() + defer h.mu.Unlock() + out := make([]canvasActionCall, len(h.actionCalls)) + copy(out, h.actionCalls) + return out +} + +func numberField(value any, key string) float64 { + m, ok := value.(map[string]any) + if !ok { + return 0 + } + n, ok := m[key].(float64) + if !ok { + return 0 + } + return n +} diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index 0b947df35..d11a77937 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -305,6 +305,21 @@ type CanvasCloseRequest struct { InstanceID string `json:"instanceId"` } +type CanvasCloseResult struct { +} + +// Host context supplied by the runtime. +type CanvasHostContext struct { + // Host capabilities + Capabilities *CanvasHostContextCapabilities `json:"capabilities,omitempty"` +} + +// Host capabilities +type CanvasHostContextCapabilities struct { + // Whether canvas rendering is supported + Canvases *bool `json:"canvases,omitempty"` +} + // Canvas action invocation parameters. // Experimental: CanvasInvokeActionRequest is part of an experimental API and may change or // be removed. @@ -360,6 +375,64 @@ type CanvasOpenRequest struct { InstanceID string `json:"instanceId"` } +// Canvas close parameters sent to the provider. +type CanvasProviderCloseRequest struct { + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Host context supplied by the runtime. + Host *CanvasHostContext `json:"host,omitempty"` + // Canvas instance identifier + InstanceID string `json:"instanceId"` + // Target session identifier + SessionID string `json:"sessionId"` +} + +// Canvas action invocation parameters sent to the provider. +type CanvasProviderInvokeActionRequest struct { + // Action name to invoke + ActionName string `json:"actionName"` + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Host context supplied by the runtime. + Host *CanvasHostContext `json:"host,omitempty"` + // Action input + Input any `json:"input,omitempty"` + // Canvas instance identifier + InstanceID string `json:"instanceId"` + // Target session identifier + SessionID string `json:"sessionId"` +} + +// Canvas open parameters sent to the provider. +type CanvasProviderOpenRequest struct { + // Provider-local canvas identifier + CanvasID string `json:"canvasId"` + // Owning provider identifier + ExtensionID string `json:"extensionId"` + // Host context supplied by the runtime. + Host *CanvasHostContext `json:"host,omitempty"` + // Canvas open input + Input any `json:"input,omitempty"` + // Stable caller-supplied canvas instance identifier + InstanceID string `json:"instanceId"` + // Target session identifier + SessionID string `json:"sessionId"` +} + +// Canvas open result returned by the provider. +type CanvasProviderOpenResult struct { + // Provider-supplied status text + Status *string `json:"status,omitempty"` + // Provider-supplied title + Title *string `json:"title,omitempty"` + // URL for web-rendered canvases + URL *string `json:"url,omitempty"` +} + // Slash commands available in the session, after applying any include/exclude filters. // Experimental: CommandList is part of an experimental API and may change or be removed. type CommandList struct { @@ -11749,6 +11822,31 @@ func NewSessionRpc(client *jsonrpc2.Client, sessionID string) *SessionRpc { return r } +type CanvasHandler interface { + // Closes a canvas instance on the provider. + // + // RPC method: canvas.close. + // + // Parameters: Canvas close parameters sent to the provider. + Close(request *CanvasProviderCloseRequest) (*CanvasCloseResult, error) + // InvokeAction invokes an action on an open canvas instance via the provider. + // + // RPC method: canvas.invokeAction. + // + // Parameters: Canvas action invocation parameters sent to the provider. + // + // Returns: Provider-supplied action result. + InvokeAction(request *CanvasProviderInvokeActionRequest) (*CanvasInvokeActionResult, error) + // Opens a canvas instance on the provider. + // + // RPC method: canvas.open. + // + // Parameters: Canvas open parameters sent to the provider. + // + // Returns: Canvas open result returned by the provider. + Open(request *CanvasProviderOpenRequest) (*CanvasProviderOpenResult, error) +} + type SessionFsHandler interface { // AppendFile appends content to a file in the client-provided session filesystem. // @@ -11866,6 +11964,7 @@ type SessionFsHandler interface { // ClientSessionApiHandlers provides all client session API handler groups for a session. type ClientSessionApiHandlers struct { + Canvas CanvasHandler SessionFs SessionFsHandler } @@ -11883,6 +11982,67 @@ func clientSessionHandlerError(err error) *jsonrpc2.Error { // RegisterClientSessionApiHandlers registers handlers for server-to-client session API // calls. func RegisterClientSessionApiHandlers(client *jsonrpc2.Client, getHandlers func(sessionID string) *ClientSessionApiHandlers) { + client.SetRequestHandler("canvas.close", func(params json.RawMessage) (json.RawMessage, *jsonrpc2.Error) { + var request CanvasProviderCloseRequest + if err := json.Unmarshal(params, &request); err != nil { + return nil, &jsonrpc2.Error{Code: -32602, Message: fmt.Sprintf("Invalid params: %v", err)} + } + handlers := getHandlers(request.SessionID) + if handlers == nil || handlers.Canvas == nil { + return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("No canvas handler registered for session: %s", request.SessionID)} + } + result, err := handlers.Canvas.Close(&request) + if err != nil { + return nil, clientSessionHandlerError(err) + } + raw, err := json.Marshal(result) + if err != nil { + return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("Failed to marshal response: %v", err)} + } + return raw, nil + }) + client.SetRequestHandler("canvas.invokeAction", func(params json.RawMessage) (json.RawMessage, *jsonrpc2.Error) { + var request CanvasProviderInvokeActionRequest + if err := json.Unmarshal(params, &request); err != nil { + return nil, &jsonrpc2.Error{Code: -32602, Message: fmt.Sprintf("Invalid params: %v", err)} + } + handlers := getHandlers(request.SessionID) + if handlers == nil || handlers.Canvas == nil { + return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("No canvas handler registered for session: %s", request.SessionID)} + } + result, err := handlers.Canvas.InvokeAction(&request) + if err != nil { + return nil, clientSessionHandlerError(err) + } + var payload any + if result != nil { + payload = result.Result + } + raw, err := json.Marshal(payload) + if err != nil { + return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("Failed to marshal response: %v", err)} + } + return raw, nil + }) + client.SetRequestHandler("canvas.open", func(params json.RawMessage) (json.RawMessage, *jsonrpc2.Error) { + var request CanvasProviderOpenRequest + if err := json.Unmarshal(params, &request); err != nil { + return nil, &jsonrpc2.Error{Code: -32602, Message: fmt.Sprintf("Invalid params: %v", err)} + } + handlers := getHandlers(request.SessionID) + if handlers == nil || handlers.Canvas == nil { + return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("No canvas handler registered for session: %s", request.SessionID)} + } + result, err := handlers.Canvas.Open(&request) + if err != nil { + return nil, clientSessionHandlerError(err) + } + raw, err := json.Marshal(result) + if err != nil { + return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("Failed to marshal response: %v", err)} + } + return raw, nil + }) client.SetRequestHandler("sessionFs.appendFile", func(params json.RawMessage) (json.RawMessage, *jsonrpc2.Error) { var request SessionFsAppendFileRequest if err := json.Unmarshal(params, &request); err != nil { diff --git a/go/session.go b/go/session.go index eca928c19..c3e13c0e4 100644 --- a/go/session.go +++ b/go/session.go @@ -130,6 +130,118 @@ func (s *Session) getCanvasHandler() CanvasHandler { return s.canvasHandler } +type canvasClientSessionAdapter struct { + session *Session +} + +func newCanvasClientSessionAdapter(session *Session) rpc.CanvasHandler { + return &canvasClientSessionAdapter{session: session} +} + +func (a *canvasClientSessionAdapter) Close(request *rpc.CanvasProviderCloseRequest) (*rpc.CanvasCloseResult, error) { + if request == nil { + return nil, canvasJSONRPCError(NewCanvasError("canvas_handler_unset", "missing canvas close request")) + } + handler, err := a.resolveHandler(canvasProviderSessionID(request)) + if err != nil { + return nil, err + } + if err := handler.OnClose(context.Background(), *request); err != nil { + return nil, canvasResultError(err) + } + return &rpc.CanvasCloseResult{}, nil +} + +func (a *canvasClientSessionAdapter) InvokeAction(request *rpc.CanvasProviderInvokeActionRequest) (*rpc.CanvasInvokeActionResult, error) { + if request == nil { + return nil, canvasJSONRPCError(NewCanvasError("canvas_handler_unset", "missing canvas action request")) + } + handler, err := a.resolveHandler(canvasProviderSessionID(request)) + if err != nil { + return nil, err + } + result, actionErr := handler.OnAction(context.Background(), *request) + if actionErr != nil { + return nil, canvasResultError(actionErr) + } + return &rpc.CanvasInvokeActionResult{Result: result}, nil +} + +func (a *canvasClientSessionAdapter) Open(request *rpc.CanvasProviderOpenRequest) (*rpc.CanvasProviderOpenResult, error) { + if request == nil { + return nil, canvasJSONRPCError(NewCanvasError("canvas_handler_unset", "missing canvas open request")) + } + handler, err := a.resolveHandler(canvasProviderSessionID(request)) + if err != nil { + return nil, err + } + result, openErr := handler.OnOpen(context.Background(), *request) + if openErr != nil { + return nil, canvasResultError(openErr) + } + return &result, nil +} + +func (a *canvasClientSessionAdapter) resolveHandler(sessionID string) (CanvasHandler, error) { + if sessionID == "" { + return nil, canvasJSONRPCError(NewCanvasError("canvas_handler_unset", "missing session ID")) + } + if a.session == nil || a.session.SessionID != sessionID { + return nil, canvasJSONRPCError(NewCanvasError("canvas_handler_unset", fmt.Sprintf("unknown session %s", sessionID))) + } + handler := a.session.getCanvasHandler() + if handler == nil { + return nil, canvasJSONRPCError(NewCanvasError( + "canvas_handler_unset", + "No CanvasHandler installed on this session; install one via SessionConfig.CanvasHandler before creating the session.", + )) + } + return handler, nil +} + +func canvasProviderSessionID(request any) string { + switch req := request.(type) { + case *rpc.CanvasProviderCloseRequest: + if req != nil { + return req.SessionID + } + case *rpc.CanvasProviderInvokeActionRequest: + if req != nil { + return req.SessionID + } + case *rpc.CanvasProviderOpenRequest: + if req != nil { + return req.SessionID + } + } + return "" +} + +func canvasJSONRPCError(cerr *CanvasError) *jsonrpc2.Error { + data, _ := json.Marshal(map[string]string{ + "code": cerr.Code, + "message": cerr.Message, + }) + return &jsonrpc2.Error{ + Code: -32603, + Message: cerr.Message, + Data: data, + } +} + +func canvasResultError(err error) error { + if err == nil { + return nil + } + if rpcErr, ok := err.(*jsonrpc2.Error); ok { + return rpcErr + } + if cerr, ok := err.(*CanvasError); ok { + return canvasJSONRPCError(cerr) + } + return canvasJSONRPCError(NewCanvasError("canvas_handler_error", err.Error())) +} + // newSession creates a new session wrapper with the given session ID and client. func newSession(sessionID string, client *jsonrpc2.Client, workspacePath string) *Session { s := &Session{ @@ -143,6 +255,7 @@ func newSession(sessionID string, client *jsonrpc2.Client, workspacePath string) eventCh: make(chan SessionEvent, 128), RPC: rpc.NewSessionRpc(client, sessionID), } + s.clientSessionApis.Canvas = newCanvasClientSessionAdapter(s) go s.processEvents() return s } diff --git a/go/types.go b/go/types.go index fe7f9d93c..2b4c07cff 100644 --- a/go/types.go +++ b/go/types.go @@ -936,12 +936,10 @@ type SessionConfig struct { RequestCanvasRenderer *bool // RequestExtensions asks the host to surface declared canvases as agent-visible extensions. RequestExtensions *bool - // CanvasHandler receives inbound canvas.open / canvas.close / canvas.action.invoke + // CanvasHandler receives inbound canvas.open / canvas.close / canvas.invokeAction // requests for this session. The SDK does not maintain a per-canvas registry; // the handler must dispatch on CanvasOpenContext.CanvasID itself. CanvasHandler CanvasHandler `json:"-"` - // ExtensionInfo identifies the stable extension providing this session's canvases. - ExtensionInfo *ExtensionInfo } type Tool struct { Name string `json:"name"` @@ -1203,8 +1201,6 @@ type ResumeSessionConfig struct { RequestExtensions *bool // CanvasHandler receives inbound canvas.* requests for this session. See SessionConfig.CanvasHandler. CanvasHandler CanvasHandler `json:"-"` - // ExtensionInfo identifies the stable extension providing this session's canvases. - ExtensionInfo *ExtensionInfo } type ProviderConfig struct { // Type is the provider type: "openai", "azure", or "anthropic". Defaults to "openai". @@ -1432,7 +1428,6 @@ type createSessionRequest struct { Canvases []CanvasDeclaration `json:"canvases,omitempty"` RequestCanvasRenderer *bool `json:"requestCanvasRenderer,omitempty"` RequestExtensions *bool `json:"requestExtensions,omitempty"` - ExtensionInfo *ExtensionInfo `json:"extensionInfo,omitempty"` Traceparent string `json:"traceparent,omitempty"` Tracestate string `json:"tracestate,omitempty"` } @@ -1492,7 +1487,6 @@ type resumeSessionRequest struct { OpenCanvases []rpc.OpenCanvasInstance `json:"openCanvases,omitempty"` RequestCanvasRenderer *bool `json:"requestCanvasRenderer,omitempty"` RequestExtensions *bool `json:"requestExtensions,omitempty"` - ExtensionInfo *ExtensionInfo `json:"extensionInfo,omitempty"` Traceparent string `json:"traceparent,omitempty"` Tracestate string `json:"tracestate,omitempty"` } diff --git a/python/copilot/__init__.py b/python/copilot/__init__.py index 874267c9f..1fcb10e9e 100644 --- a/python/copilot/__init__.py +++ b/python/copilot/__init__.py @@ -10,8 +10,9 @@ CanvasDeclaration, CanvasError, CanvasHandler, - CanvasHostCapabilities, CanvasHostContext, + CanvasHostContextCapabilities, + CanvasJsonSchema, CanvasLifecycleContext, CanvasOpenContext, CanvasOpenResponse, @@ -149,8 +150,9 @@ "CanvasDeclaration", "CanvasError", "CanvasHandler", - "CanvasHostCapabilities", "CanvasHostContext", + "CanvasHostContextCapabilities", + "CanvasJsonSchema", "CanvasLifecycleContext", "CanvasOpenContext", "CanvasOpenResponse", diff --git a/python/copilot/canvas.py b/python/copilot/canvas.py index 58c5b297d..0bb80c17a 100644 --- a/python/copilot/canvas.py +++ b/python/copilot/canvas.py @@ -1,21 +1,30 @@ """ Canvas declarations, provider callbacks, and host-side canvas RPC types. -The Copilot CLI runtime sends inbound JSON-RPC requests (``canvas.open``, -``canvas.close``, ``canvas.action.invoke``) to any session that declares -canvases. The SDK forwards every such request to a single user-supplied -:class:`CanvasHandler`; multiplexing across multiple declared canvases is -the implementor's responsibility (e.g. by switching on -:attr:`CanvasOpenContext.canvas_id`). +The Copilot CLI runtime sends inbound canvas JSON-RPC requests to any session +that declares canvases. The SDK forwards every such request to a single +user-supplied :class:`CanvasHandler`; multiplexing across multiple declared +canvases is the implementor's responsibility (for example by switching on +``ctx.canvas_id``). """ from __future__ import annotations from abc import ABC, abstractmethod -from dataclasses import dataclass, field +from dataclasses import dataclass from typing import Any -from .generated.rpc import CanvasAction, OpenCanvasInstance +from .generated.rpc import ( + CanvasAction, + CanvasHostContext, + CanvasHostContextCapabilities, + CanvasJsonSchema, + CanvasProviderCloseRequest, + CanvasProviderInvokeActionRequest, + CanvasProviderOpenRequest, + CanvasProviderOpenResult, + OpenCanvasInstance, +) __all__ = [ "CanvasAction", @@ -23,8 +32,9 @@ "CanvasDeclaration", "CanvasError", "CanvasHandler", - "CanvasHostCapabilities", "CanvasHostContext", + "CanvasHostContextCapabilities", + "CanvasJsonSchema", "CanvasLifecycleContext", "CanvasOpenContext", "CanvasOpenResponse", @@ -52,9 +62,7 @@ def to_dict(self) -> dict[str, Any]: @dataclass class CanvasDeclaration: - """Declarative metadata for a single canvas, sent on - ``session.create`` / ``session.resume``. - """ + """Declarative metadata for a single canvas, sent on create/resume.""" id: str """Canvas identifier, unique within the declaring connection.""" @@ -63,9 +71,9 @@ class CanvasDeclaration: """Human-readable name shown in host UI and canvas pickers.""" description: str - """Short, single-sentence description shown to the agent in canvas catalogs.""" + """Short description shown to the agent in canvas catalogs.""" - input_schema: dict[str, Any] | None = None + input_schema: CanvasJsonSchema | None = None """JSON Schema for the ``input`` payload accepted by ``canvas.open``.""" actions: list[CanvasAction] | None = None @@ -84,136 +92,14 @@ def to_dict(self) -> dict[str, Any]: return result -@dataclass -class CanvasOpenResponse: - """Response returned from :meth:`CanvasHandler.on_open`.""" - - url: str | None = None - """URL the host should render. Optional for canvases with no visual surface.""" - - title: str | None = None - """Provider-supplied title shown in host chrome.""" - - status: str | None = None - """Provider-supplied status text shown in host chrome.""" - - def to_dict(self) -> dict[str, Any]: - result: dict[str, Any] = {} - if self.url is not None: - result["url"] = self.url - if self.title is not None: - result["title"] = self.title - if self.status is not None: - result["status"] = self.status - return result - - -@dataclass -class CanvasHostCapabilities: - """Host capability details passed to canvas provider callbacks.""" - - canvases: bool = False - """Whether the host supports canvas rendering.""" - - @staticmethod - def from_dict(obj: Any) -> CanvasHostCapabilities: - if not isinstance(obj, dict): - return CanvasHostCapabilities() - return CanvasHostCapabilities(canvases=bool(obj.get("canvases", False))) - - -@dataclass -class CanvasHostContext: - """Host capabilities passed to canvas provider callbacks.""" - - capabilities: CanvasHostCapabilities = field(default_factory=CanvasHostCapabilities) - """Host capability details.""" - - @staticmethod - def from_dict(obj: Any) -> CanvasHostContext: - if not isinstance(obj, dict): - return CanvasHostContext() - return CanvasHostContext( - capabilities=CanvasHostCapabilities.from_dict(obj.get("capabilities")) - ) - - -@dataclass -class CanvasOpenContext: - """Context handed to :meth:`CanvasHandler.on_open`.""" - - session_id: str - """Session that requested the canvas.""" - - extension_id: str - """Owning provider identifier.""" - - canvas_id: str - """Canvas id from the declaring :class:`CanvasDeclaration`.""" - - instance_id: str - """Stable instance id supplied by the runtime.""" - - input: Any - """Validated input payload.""" - - host: CanvasHostContext | None = None - """Host capabilities supplied by the runtime.""" - - -@dataclass -class CanvasActionContext: - """Context handed to :meth:`CanvasHandler.on_action`.""" - - session_id: str - """Session that invoked the action.""" - - extension_id: str - """Owning provider identifier.""" - - canvas_id: str - """Canvas id targeted by the action.""" - - instance_id: str - """Instance id targeted by the action.""" - - action_name: str - """Action name from :attr:`CanvasAction.name`.""" - - input: Any - """Validated input payload.""" - - host: CanvasHostContext | None = None - """Host capabilities supplied by the runtime.""" - - -@dataclass -class CanvasLifecycleContext: - """Context handed to a canvas's close lifecycle hook.""" - - session_id: str - """Session owning the canvas instance.""" - - extension_id: str - """Owning provider identifier.""" - - canvas_id: str - """Canvas id from the declaring :class:`CanvasDeclaration`.""" - - instance_id: str - """Instance id this lifecycle event applies to.""" - - host: CanvasHostContext | None = None - """Host capabilities supplied by the runtime.""" +CanvasOpenResponse = CanvasProviderOpenResult +CanvasOpenContext = CanvasProviderOpenRequest +CanvasActionContext = CanvasProviderInvokeActionRequest +CanvasLifecycleContext = CanvasProviderCloseRequest class CanvasError(Exception): - """Structured error returned from canvas handlers. - - The serialized envelope is ``{"code": ..., "message": ...}``. The SDK - surfaces this through the JSON-RPC error's ``data`` field while sending - a standard ``-32603`` (internal error) wire code. - """ + """Structured error returned from canvas handlers.""" def __init__(self, code: str, message: str) -> None: self.code = code @@ -242,20 +128,7 @@ def handler_unset(cls) -> CanvasError: class CanvasHandler(ABC): - """Provider-side canvas lifecycle handler. - - A session installs a single :class:`CanvasHandler` via the - ``canvas_handler=`` argument to - :meth:`copilot.CopilotClient.create_session` / - :meth:`copilot.CopilotClient.resume_session`. The handler receives every - inbound ``canvas.open`` / ``canvas.close`` / ``canvas.action.invoke`` - JSON-RPC request the runtime issues for this session and decides — - typically by inspecting :attr:`CanvasOpenContext.canvas_id` — which - application-side canvas should handle the call. - - The SDK does not maintain a per-canvas registry; multiplexing across - declared canvases is the implementor's responsibility. - """ + """Provider-side canvas lifecycle handler.""" @abstractmethod async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: @@ -269,44 +142,5 @@ async def on_close(self, ctx: CanvasLifecycleContext) -> None: """Canvas was closed by the user or agent. Default: no-op.""" async def on_action(self, ctx: CanvasActionContext) -> Any: - """Handle a non-lifecycle action declared by the canvas. - - Default raises :meth:`CanvasError.no_handler`. - """ + """Handle a non-lifecycle action declared by the canvas.""" raise CanvasError.no_handler() - - -# ----- Internal helpers for inbound RPC dispatch (not part of the public API). ----- - - -def _open_context_from_params(params: dict[str, Any]) -> CanvasOpenContext: - return CanvasOpenContext( - session_id=params["sessionId"], - extension_id=params["extensionId"], - canvas_id=params["canvasId"], - instance_id=params["instanceId"], - input=params.get("input"), - host=CanvasHostContext.from_dict(params.get("host")) if params.get("host") else None, - ) - - -def _lifecycle_context_from_params(params: dict[str, Any]) -> CanvasLifecycleContext: - return CanvasLifecycleContext( - session_id=params["sessionId"], - extension_id=params["extensionId"], - canvas_id=params["canvasId"], - instance_id=params["instanceId"], - host=CanvasHostContext.from_dict(params.get("host")) if params.get("host") else None, - ) - - -def _action_context_from_params(params: dict[str, Any]) -> CanvasActionContext: - return CanvasActionContext( - session_id=params["sessionId"], - extension_id=params["extensionId"], - canvas_id=params["canvasId"], - instance_id=params["instanceId"], - action_name=params["actionName"], - input=params.get("input"), - host=CanvasHostContext.from_dict(params.get("host")) if params.get("host") else None, - ) diff --git a/python/copilot/client.py b/python/copilot/client.py index 5e795bdde..4386adb08 100644 --- a/python/copilot/client.py +++ b/python/copilot/client.py @@ -38,12 +38,8 @@ from ._telemetry import get_trace_context from .canvas import ( CanvasDeclaration, - CanvasError, CanvasHandler, ExtensionInfo, - _action_context_from_params, - _lifecycle_context_from_params, - _open_context_from_params, ) from .generated.rpc import ( ClientSessionApiHandlers, @@ -3038,18 +3034,6 @@ def handle_notification(method: str, params: dict): self._client.set_request_handler( "systemMessage.transform", self._handle_system_message_transform ) - self._client.set_request_handler( - "canvas.open", - self._canvas_request_handler(self._handle_canvas_open), - ) - self._client.set_request_handler( - "canvas.close", - self._canvas_request_handler(self._handle_canvas_close), - ) - self._client.set_request_handler( - "canvas.action.invoke", - self._canvas_request_handler(self._handle_canvas_action_invoke), - ) register_client_session_api_handlers(self._client, self._get_client_session_handlers) # Start listening for messages @@ -3169,18 +3153,6 @@ def handle_notification(method: str, params: dict): self._client.set_request_handler( "systemMessage.transform", self._handle_system_message_transform ) - self._client.set_request_handler( - "canvas.open", - self._canvas_request_handler(self._handle_canvas_open), - ) - self._client.set_request_handler( - "canvas.close", - self._canvas_request_handler(self._handle_canvas_close), - ) - self._client.set_request_handler( - "canvas.action.invoke", - self._canvas_request_handler(self._handle_canvas_action_invoke), - ) register_client_session_api_handlers(self._client, self._get_client_session_handlers) # Start listening for messages @@ -3310,113 +3282,3 @@ async def _handle_system_message_transform(self, params: dict) -> dict: raise ValueError(f"unknown session {session_id}") return await session._handle_system_message_transform(sections) - - def _resolve_canvas_handler(self, session_id: str) -> CanvasHandler: - """Look up the canvas handler for ``session_id`` or raise CanvasError.""" - with self._sessions_lock: - session = self._sessions.get(session_id) - if session is None: - raise CanvasError( - "canvas_handler_unset", - f"No session registered for {session_id}; cannot dispatch canvas RPC.", - ) - handler = session._get_canvas_handler() - if handler is None: - raise CanvasError.handler_unset() - return handler - - async def _handle_canvas_open(self, params: dict) -> dict: - """Handle an inbound ``canvas.open`` request from the CLI runtime.""" - try: - session_id = params["sessionId"] - except KeyError as exc: - raise CanvasError( - "canvas_invalid_request", "canvas.open params missing sessionId" - ) from exc - handler = self._resolve_canvas_handler(session_id) - try: - ctx = _open_context_from_params(params) - except KeyError as exc: - raise CanvasError( - "canvas_invalid_request", f"canvas.open params missing field: {exc.args[0]}" - ) from exc - try: - response = await handler.on_open(ctx) - except CanvasError: - raise - except Exception as exc: - raise CanvasError( - "canvas_open_handler_failed", - f"canvas.open handler raised: {exc}", - ) from exc - return response.to_dict() - - async def _handle_canvas_close(self, params: dict) -> None: - """Handle an inbound ``canvas.close`` request from the CLI runtime.""" - try: - session_id = params["sessionId"] - except KeyError as exc: - raise CanvasError( - "canvas_invalid_request", "canvas.close params missing sessionId" - ) from exc - handler = self._resolve_canvas_handler(session_id) - try: - ctx = _lifecycle_context_from_params(params) - except KeyError as exc: - raise CanvasError( - "canvas_invalid_request", f"canvas.close params missing field: {exc.args[0]}" - ) from exc - try: - await handler.on_close(ctx) - except CanvasError: - raise - except Exception as exc: - raise CanvasError( - "canvas_close_handler_failed", - f"canvas.close handler raised: {exc}", - ) from exc - return None - - async def _handle_canvas_action_invoke(self, params: dict) -> Any: - """Handle an inbound ``canvas.action.invoke`` request from the CLI runtime.""" - try: - session_id = params["sessionId"] - except KeyError as exc: - raise CanvasError( - "canvas_invalid_request", - "canvas.action.invoke params missing sessionId", - ) from exc - handler = self._resolve_canvas_handler(session_id) - try: - ctx = _action_context_from_params(params) - except KeyError as exc: - raise CanvasError( - "canvas_invalid_request", - f"canvas.action.invoke params missing field: {exc.args[0]}", - ) from exc - try: - return await handler.on_action(ctx) - except CanvasError: - raise - except Exception as exc: - raise CanvasError( - "canvas_action_handler_failed", - f"canvas.action.invoke handler raised: {exc}", - ) from exc - - @staticmethod - def _canvas_request_handler( - coro: Callable[[dict], Awaitable[Any]], - ) -> Callable[[dict], Awaitable[Any]]: - """Wrap a canvas RPC coroutine so ``CanvasError`` becomes a JSON-RPC error - with the structured envelope in the error's ``data`` field, matching the - Rust SDK wire shape. - """ - - async def wrapper(params: dict) -> Any: - try: - return await coro(params) - except CanvasError as err: - raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err - - return wrapper diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index b438ae5dc..fd82b97aa 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -2,11 +2,26 @@ AUTO-GENERATED FILE - DO NOT EDIT Generated from: api.schema.json """ + from __future__ import annotations from typing import ClassVar, TYPE_CHECKING -from .session_events import AbortReason, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval +from .session_events import ( + AbortReason, + EmbeddedBlobResourceContents, + EmbeddedTextResourceContents, + McpServerSource, + McpServerStatus, + PermissionPromptRequest, + PermissionRule, + ReasoningSummary, + SessionEvent, + SessionMode, + ShutdownType, + SkillSource, + UserToolSessionApproval, +) if TYPE_CHECKING: from .._jsonrpc import JsonRpcClient @@ -28,10 +43,12 @@ def from_str(x: Any) -> str: assert isinstance(x, str) return x + def from_none(x: Any) -> Any: assert x is None return x + def from_union(fs, x): for f in fs: try: @@ -40,41 +57,51 @@ def from_union(fs, x): pass assert False + def to_class(c: type[T], x: Any) -> dict: assert isinstance(x, c) return cast(Any, x).to_dict() + def from_bool(x: Any) -> bool: assert isinstance(x, bool) return x + def from_int(x: Any) -> int: assert isinstance(x, int) and not isinstance(x, bool) return x + def from_float(x: Any) -> float: assert isinstance(x, (float, int)) and not isinstance(x, bool) return float(x) + def to_float(x: Any) -> float: assert isinstance(x, (int, float)) return x + def from_dict(f: Callable[[Any], T], x: Any) -> dict[str, T]: assert isinstance(x, dict) - return { k: f(v) for (k, v) in x.items() } + return {k: f(v) for (k, v) in x.items()} + def from_list(f: Callable[[Any], T], x: Any) -> list[T]: assert isinstance(x, list) return [f(y) for y in x] + def to_enum(c: type[EnumT], x: Any) -> EnumT: assert isinstance(x, c) return x.value + def from_datetime(x: Any) -> datetime: return dateutil.parser.parse(x) + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AbortRequest: @@ -84,7 +111,7 @@ class AbortRequest: """Finite reason code describing why the current turn was aborted""" @staticmethod - def from_dict(obj: Any) -> 'AbortRequest': + def from_dict(obj: Any) -> "AbortRequest": assert isinstance(obj, dict) reason = from_union([AbortReason, from_none], obj.get("reason")) return AbortRequest(reason) @@ -92,9 +119,12 @@ def from_dict(obj: Any) -> 'AbortRequest': def to_dict(self) -> dict: result: dict = {} if self.reason is not None: - result["reason"] = from_union([lambda x: to_enum(AbortReason, x), from_none], self.reason) + result["reason"] = from_union( + [lambda x: to_enum(AbortReason, x), from_none], self.reason + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AbortResult: @@ -107,7 +137,7 @@ class AbortResult: """Error message if the abort failed""" @staticmethod - def from_dict(obj: Any) -> 'AbortResult': + def from_dict(obj: Any) -> "AbortResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) error = from_union([from_str, from_none], obj.get("error")) @@ -120,6 +150,7 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result + @dataclass class AccountGetQuotaRequest: git_hub_token: str | None = None @@ -128,7 +159,7 @@ class AccountGetQuotaRequest: """ @staticmethod - def from_dict(obj: Any) -> 'AccountGetQuotaRequest': + def from_dict(obj: Any) -> "AccountGetQuotaRequest": assert isinstance(obj, dict) git_hub_token = from_union([from_str, from_none], obj.get("gitHubToken")) return AccountGetQuotaRequest(git_hub_token) @@ -139,6 +170,7 @@ def to_dict(self) -> dict: result["gitHubToken"] = from_union([from_str, from_none], self.git_hub_token) return result + @dataclass class AccountQuotaSnapshot: """Schema for the `AccountQuotaSnapshot` type.""" @@ -168,31 +200,47 @@ class AccountQuotaSnapshot: """Date when the quota resets (ISO 8601 string)""" @staticmethod - def from_dict(obj: Any) -> 'AccountQuotaSnapshot': + def from_dict(obj: Any) -> "AccountQuotaSnapshot": assert isinstance(obj, dict) entitlement_requests = from_int(obj.get("entitlementRequests")) is_unlimited_entitlement = from_bool(obj.get("isUnlimitedEntitlement")) overage = from_float(obj.get("overage")) - overage_allowed_with_exhausted_quota = from_bool(obj.get("overageAllowedWithExhaustedQuota")) + overage_allowed_with_exhausted_quota = from_bool( + obj.get("overageAllowedWithExhaustedQuota") + ) remaining_percentage = from_float(obj.get("remainingPercentage")) usage_allowed_with_exhausted_quota = from_bool(obj.get("usageAllowedWithExhaustedQuota")) used_requests = from_int(obj.get("usedRequests")) reset_date = from_union([from_str, from_none], obj.get("resetDate")) - return AccountQuotaSnapshot(entitlement_requests, is_unlimited_entitlement, overage, overage_allowed_with_exhausted_quota, remaining_percentage, usage_allowed_with_exhausted_quota, used_requests, reset_date) + return AccountQuotaSnapshot( + entitlement_requests, + is_unlimited_entitlement, + overage, + overage_allowed_with_exhausted_quota, + remaining_percentage, + usage_allowed_with_exhausted_quota, + used_requests, + reset_date, + ) def to_dict(self) -> dict: result: dict = {} result["entitlementRequests"] = from_int(self.entitlement_requests) result["isUnlimitedEntitlement"] = from_bool(self.is_unlimited_entitlement) result["overage"] = to_float(self.overage) - result["overageAllowedWithExhaustedQuota"] = from_bool(self.overage_allowed_with_exhausted_quota) + result["overageAllowedWithExhaustedQuota"] = from_bool( + self.overage_allowed_with_exhausted_quota + ) result["remainingPercentage"] = to_float(self.remaining_percentage) - result["usageAllowedWithExhaustedQuota"] = from_bool(self.usage_allowed_with_exhausted_quota) + result["usageAllowedWithExhaustedQuota"] = from_bool( + self.usage_allowed_with_exhausted_quota + ) result["usedRequests"] = from_int(self.used_requests) if self.reset_date is not None: result["resetDate"] = from_union([from_str, from_none], self.reset_date) return result + # Experimental: this type is part of an experimental API and may change or be removed. class AgentInfoSource(Enum): """Where the agent definition was loaded from""" @@ -204,6 +252,7 @@ class AgentInfoSource(Enum): REMOTE = "remote" USER = "user" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentSelectRequest: @@ -213,7 +262,7 @@ class AgentSelectRequest: """Name of the custom agent to select""" @staticmethod - def from_dict(obj: Any) -> 'AgentSelectRequest': + def from_dict(obj: Any) -> "AgentSelectRequest": assert isinstance(obj, dict) name = from_str(obj.get("name")) return AgentSelectRequest(name) @@ -223,6 +272,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseEndpoints: @@ -234,7 +284,7 @@ class CopilotUserResponseEndpoints: telemetry: str | None = None @staticmethod - def from_dict(obj: Any) -> 'CopilotUserResponseEndpoints': + def from_dict(obj: Any) -> "CopilotUserResponseEndpoints": assert isinstance(obj, dict) api = from_union([from_str, from_none], obj.get("api")) origin_tracker = from_union([from_str, from_none], obj.get("origin-tracker")) @@ -254,9 +304,11 @@ def to_dict(self) -> dict: result["telemetry"] = from_union([from_str, from_none], self.telemetry) return result + class APIKeyAuthInfoType(Enum): API_KEY = "api-key" + # Experimental: this type is part of an experimental API and may change or be removed. class AuthInfoType(Enum): """Authentication type""" @@ -269,12 +321,14 @@ class AuthInfoType(Enum): TOKEN = "token" USER = "user" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasAction: """Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. """ + name: str """Action name exposed by the canvas provider""" @@ -285,7 +339,7 @@ class CanvasAction: """JSON Schema for the action input""" @staticmethod - def from_dict(obj: Any) -> 'CanvasAction': + def from_dict(obj: Any) -> "CanvasAction": assert isinstance(obj, dict) name = from_str(obj.get("name")) description = from_union([from_str, from_none], obj.get("description")) @@ -301,6 +355,7 @@ def to_dict(self) -> dict: result["inputSchema"] = self.input_schema return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasCloseRequest: @@ -310,7 +365,7 @@ class CanvasCloseRequest: """Open canvas instance identifier""" @staticmethod - def from_dict(obj: Any) -> 'CanvasCloseRequest': + def from_dict(obj: Any) -> "CanvasCloseRequest": assert isinstance(obj, dict) instance_id = from_str(obj.get("instanceId")) return CanvasCloseRequest(instance_id) @@ -320,6 +375,7 @@ def to_dict(self) -> dict: result["instanceId"] = from_str(self.instance_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. class CanvasInstanceAvailability(Enum): """Runtime-controlled routing state for an open canvas instance.""" @@ -327,6 +383,7 @@ class CanvasInstanceAvailability(Enum): READY = "ready" STALE = "stale" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasInvokeActionRequest: @@ -342,7 +399,7 @@ class CanvasInvokeActionRequest: """Action input""" @staticmethod - def from_dict(obj: Any) -> 'CanvasInvokeActionRequest': + def from_dict(obj: Any) -> "CanvasInvokeActionRequest": assert isinstance(obj, dict) action_name = from_str(obj.get("actionName")) instance_id = from_str(obj.get("instanceId")) @@ -357,25 +414,6 @@ def to_dict(self) -> dict: result["input"] = self.input return result -# Experimental: this type is part of an experimental API and may change or be removed. -@dataclass -class CanvasInvokeActionResult: - """Canvas action invocation result.""" - - result: Any = None - """Provider-supplied action result""" - - @staticmethod - def from_dict(obj: Any) -> 'CanvasInvokeActionResult': - assert isinstance(obj, dict) - result = obj.get("result") - return CanvasInvokeActionResult(result) - - def to_dict(self) -> dict: - result: dict = {} - if self.result is not None: - result["result"] = self.result - return result # Experimental: this type is part of an experimental API and may change or be removed. @dataclass @@ -396,7 +434,7 @@ class CanvasOpenRequest: """Canvas open input""" @staticmethod - def from_dict(obj: Any) -> 'CanvasOpenRequest': + def from_dict(obj: Any) -> "CanvasOpenRequest": assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) instance_id = from_str(obj.get("instanceId")) @@ -414,21 +452,57 @@ def to_dict(self) -> dict: result["input"] = self.input return result + +@dataclass +class CanvasProviderOpenResult: + """Canvas open result returned by the provider.""" + + status: str | None = None + """Provider-supplied status text""" + + title: str | None = None + """Provider-supplied title""" + + url: str | None = None + """URL for web-rendered canvases""" + + @staticmethod + def from_dict(obj: Any) -> "CanvasProviderOpenResult": + assert isinstance(obj, dict) + status = from_union([from_str, from_none], obj.get("status")) + title = from_union([from_str, from_none], obj.get("title")) + url = from_union([from_str, from_none], obj.get("url")) + return CanvasProviderOpenResult(status, title, url) + + def to_dict(self) -> dict: + result: dict = {} + if self.status is not None: + result["status"] = from_union([from_str, from_none], self.status) + if self.title is not None: + result["title"] = from_union([from_str, from_none], self.title) + if self.url is not None: + result["url"] = from_union([from_str, from_none], self.url) + return result + + # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandInputCompletion(Enum): """Optional completion hint for the input (e.g. 'directory' for filesystem path completion)""" DIRECTORY = "directory" + # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandKind(Enum): """Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command """ + BUILTIN = "builtin" CLIENT = "client" SKILL = "skill" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsHandlePendingCommandRequest: @@ -441,7 +515,7 @@ class CommandsHandlePendingCommandRequest: """Error message if the command handler failed""" @staticmethod - def from_dict(obj: Any) -> 'CommandsHandlePendingCommandRequest': + def from_dict(obj: Any) -> "CommandsHandlePendingCommandRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error = from_union([from_str, from_none], obj.get("error")) @@ -454,6 +528,7 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsHandlePendingCommandResult: @@ -463,7 +538,7 @@ class CommandsHandlePendingCommandResult: """Whether the command was handled successfully""" @staticmethod - def from_dict(obj: Any) -> 'CommandsHandlePendingCommandResult': + def from_dict(obj: Any) -> "CommandsHandlePendingCommandResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return CommandsHandlePendingCommandResult(success) @@ -473,6 +548,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsInvokeRequest: @@ -485,7 +561,7 @@ class CommandsInvokeRequest: """Raw input after the command name""" @staticmethod - def from_dict(obj: Any) -> 'CommandsInvokeRequest': + def from_dict(obj: Any) -> "CommandsInvokeRequest": assert isinstance(obj, dict) name = from_str(obj.get("name")) input = from_union([from_str, from_none], obj.get("input")) @@ -498,6 +574,7 @@ def to_dict(self) -> dict: result["input"] = from_union([from_str, from_none], self.input) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsListRequest: @@ -513,10 +590,12 @@ class CommandsListRequest: """Include enabled user-invocable skills and commands""" @staticmethod - def from_dict(obj: Any) -> 'CommandsListRequest': + def from_dict(obj: Any) -> "CommandsListRequest": assert isinstance(obj, dict) include_builtins = from_union([from_bool, from_none], obj.get("includeBuiltins")) - include_client_commands = from_union([from_bool, from_none], obj.get("includeClientCommands")) + include_client_commands = from_union( + [from_bool, from_none], obj.get("includeClientCommands") + ) include_skills = from_union([from_bool, from_none], obj.get("includeSkills")) return CommandsListRequest(include_builtins, include_client_commands, include_skills) @@ -525,17 +604,21 @@ def to_dict(self) -> dict: if self.include_builtins is not None: result["includeBuiltins"] = from_union([from_bool, from_none], self.include_builtins) if self.include_client_commands is not None: - result["includeClientCommands"] = from_union([from_bool, from_none], self.include_client_commands) + result["includeClientCommands"] = from_union( + [from_bool, from_none], self.include_client_commands + ) if self.include_skills is not None: result["includeSkills"] = from_union([from_bool, from_none], self.include_skills) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsRespondToQueuedCommandRequest: """Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). """ + request_id: str """Request ID from the `command.queued` event the host is responding to.""" @@ -543,7 +626,7 @@ class CommandsRespondToQueuedCommandRequest: """Result of the queued command execution.""" @staticmethod - def from_dict(obj: Any) -> 'CommandsRespondToQueuedCommandRequest': + def from_dict(obj: Any) -> "CommandsRespondToQueuedCommandRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = _load_QueuedCommandResult(obj.get("result")) @@ -555,6 +638,7 @@ def to_dict(self) -> dict: result["result"] = (self.result).to_dict() return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsRespondToQueuedCommandResult: @@ -566,7 +650,7 @@ class CommandsRespondToQueuedCommandResult: """ @staticmethod - def from_dict(obj: Any) -> 'CommandsRespondToQueuedCommandResult': + def from_dict(obj: Any) -> "CommandsRespondToQueuedCommandResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return CommandsRespondToQueuedCommandResult(success) @@ -576,6 +660,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectRemoteSessionParams: @@ -585,7 +670,7 @@ class ConnectRemoteSessionParams: """Session ID to connect to.""" @staticmethod - def from_dict(obj: Any) -> 'ConnectRemoteSessionParams': + def from_dict(obj: Any) -> "ConnectRemoteSessionParams": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return ConnectRemoteSessionParams(session_id) @@ -595,6 +680,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConnectRequest: @@ -604,7 +690,7 @@ class _ConnectRequest: """Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN""" @staticmethod - def from_dict(obj: Any) -> '_ConnectRequest': + def from_dict(obj: Any) -> "_ConnectRequest": assert isinstance(obj, dict) token = from_union([from_str, from_none], obj.get("token")) return _ConnectRequest(token) @@ -615,6 +701,7 @@ def to_dict(self) -> dict: result["token"] = from_union([from_str, from_none], self.token) return result + # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConnectResult: @@ -630,7 +717,7 @@ class _ConnectResult: """Server package version""" @staticmethod - def from_dict(obj: Any) -> '_ConnectResult': + def from_dict(obj: Any) -> "_ConnectResult": assert isinstance(obj, dict) ok = from_bool(obj.get("ok")) protocol_version = from_int(obj.get("protocolVersion")) @@ -644,6 +731,7 @@ def to_dict(self) -> dict: result["version"] = from_str(self.version) return result + # Experimental: this type is part of an experimental API and may change or be removed. class ConnectedRemoteSessionMetadataKind(Enum): """Neutral SDK discriminator for the connected remote session kind.""" @@ -651,6 +739,7 @@ class ConnectedRemoteSessionMetadataKind(Enum): CODING_AGENT = "coding-agent" REMOTE_SESSION = "remote-session" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectedRemoteSessionMetadataRepository: @@ -666,7 +755,7 @@ class ConnectedRemoteSessionMetadataRepository: """Repository owner or organization login.""" @staticmethod - def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadataRepository': + def from_dict(obj: Any) -> "ConnectedRemoteSessionMetadataRepository": assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) @@ -680,21 +769,26 @@ def to_dict(self) -> dict: result["owner"] = from_str(self.owner) return result + class ContentFilterMode(Enum): """Controls how MCP tool result content is filtered: none leaves content unchanged, markdown sanitizes HTML while preserving Markdown-friendly output, and hidden_characters removes characters that can hide directives. """ + HIDDEN_CHARACTERS = "hidden_characters" MARKDOWN = "markdown" NONE = "none" + class Host(Enum): HTTPS_GITHUB_COM = "https://github.com" + class CopilotAPITokenAuthInfoType(Enum): COPILOT_API_TOKEN = "copilot-api-token" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsChat: @@ -714,7 +808,7 @@ class CopilotUserResponseQuotaSnapshotsChat: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsChat': + def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsChat": assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -728,7 +822,20 @@ def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsChat': timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshotsChat(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) + return CopilotUserResponseQuotaSnapshotsChat( + entitlement, + has_quota, + overage_count, + overage_permitted, + percent_remaining, + quota_id, + quota_remaining, + quota_reset_at, + remaining, + timestamp_utc, + token_based_billing, + unlimited, + ) def to_dict(self) -> dict: result: dict = {} @@ -753,11 +860,14 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) + result["token_based_billing"] = from_union( + [from_bool, from_none], self.token_based_billing + ) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsCompletions: @@ -777,7 +887,7 @@ class CopilotUserResponseQuotaSnapshotsCompletions: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsCompletions': + def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsCompletions": assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -791,7 +901,20 @@ def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsCompletions': timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshotsCompletions(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) + return CopilotUserResponseQuotaSnapshotsCompletions( + entitlement, + has_quota, + overage_count, + overage_permitted, + percent_remaining, + quota_id, + quota_remaining, + quota_reset_at, + remaining, + timestamp_utc, + token_based_billing, + unlimited, + ) def to_dict(self) -> dict: result: dict = {} @@ -816,11 +939,14 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) + result["token_based_billing"] = from_union( + [from_bool, from_none], self.token_based_billing + ) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsPremiumInteractions: @@ -840,7 +966,7 @@ class CopilotUserResponseQuotaSnapshotsPremiumInteractions: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsPremiumInteractions': + def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsPremiumInteractions": assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -854,7 +980,20 @@ def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsPremiumInteractions timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshotsPremiumInteractions(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) + return CopilotUserResponseQuotaSnapshotsPremiumInteractions( + entitlement, + has_quota, + overage_count, + overage_permitted, + percent_remaining, + quota_id, + quota_remaining, + quota_reset_at, + remaining, + timestamp_utc, + token_based_billing, + unlimited, + ) def to_dict(self) -> dict: result: dict = {} @@ -879,11 +1018,14 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) + result["token_based_billing"] = from_union( + [from_bool, from_none], self.token_based_billing + ) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CurrentModel: @@ -899,7 +1041,7 @@ class CurrentModel: """ @staticmethod - def from_dict(obj: Any) -> 'CurrentModel': + def from_dict(obj: Any) -> "CurrentModel": assert isinstance(obj, dict) model_id = from_union([from_str, from_none], obj.get("modelId")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) @@ -913,6 +1055,7 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) return result + class DiscoveredMCPServerType(Enum): """Server transport type: stdio, http, sse (deprecated), or memory""" @@ -921,6 +1064,7 @@ class DiscoveredMCPServerType(Enum): SSE = "sse" STDIO = "stdio" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnqueueCommandParams: @@ -932,7 +1076,7 @@ class EnqueueCommandParams: """ @staticmethod - def from_dict(obj: Any) -> 'EnqueueCommandParams': + def from_dict(obj: Any) -> "EnqueueCommandParams": assert isinstance(obj, dict) command = from_str(obj.get("command")) return EnqueueCommandParams(command) @@ -942,6 +1086,7 @@ def to_dict(self) -> dict: result["command"] = from_str(self.command) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnqueueCommandResult: @@ -953,7 +1098,7 @@ class EnqueueCommandResult: """ @staticmethod - def from_dict(obj: Any) -> 'EnqueueCommandResult': + def from_dict(obj: Any) -> "EnqueueCommandResult": assert isinstance(obj, dict) queued = from_bool(obj.get("queued")) return EnqueueCommandResult(queued) @@ -963,9 +1108,11 @@ def to_dict(self) -> dict: result["queued"] = from_bool(self.queued) return result + class EnvAuthInfoType(Enum): ENV = "env" + # Experimental: this type is part of an experimental API and may change or be removed. class EventsAgentScope(Enum): """Agent-scope filter: 'primary' returns only main-agent events plus events whose type @@ -973,13 +1120,16 @@ class EventsAgentScope(Enum): events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. """ + ALL = "all" PRIMARY = "primary" + # Experimental: this type is part of an experimental API and may change or be removed. class EventLogTypes(Enum): EMPTY = "*" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogReleaseInterestResult: @@ -989,7 +1139,7 @@ class EventLogReleaseInterestResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'EventLogReleaseInterestResult': + def from_dict(obj: Any) -> "EventLogReleaseInterestResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return EventLogReleaseInterestResult(success) @@ -999,6 +1149,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogTailResult: @@ -1007,6 +1158,7 @@ class EventLogTailResult: the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). """ + cursor: str """Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the @@ -1015,7 +1167,7 @@ class EventLogTailResult: """ @staticmethod - def from_dict(obj: Any) -> 'EventLogTailResult': + def from_dict(obj: Any) -> "EventLogTailResult": assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) return EventLogTailResult(cursor) @@ -1025,15 +1177,18 @@ def to_dict(self) -> dict: result["cursor"] = from_str(self.cursor) return result + # Experimental: this type is part of an experimental API and may change or be removed. class EventsCursorStatus(Enum): """Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. """ + EXPIRED = "expired" OK = "ok" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExecuteCommandParams: @@ -1046,7 +1201,7 @@ class ExecuteCommandParams: """Name of the slash command to invoke (without the leading '/').""" @staticmethod - def from_dict(obj: Any) -> 'ExecuteCommandParams': + def from_dict(obj: Any) -> "ExecuteCommandParams": assert isinstance(obj, dict) args = from_str(obj.get("args")) command_name = from_str(obj.get("commandName")) @@ -1058,6 +1213,7 @@ def to_dict(self) -> dict: result["commandName"] = from_str(self.command_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExecuteCommandResult: @@ -1069,7 +1225,7 @@ class ExecuteCommandResult: """ @staticmethod - def from_dict(obj: Any) -> 'ExecuteCommandResult': + def from_dict(obj: Any) -> "ExecuteCommandResult": assert isinstance(obj, dict) error = from_union([from_str, from_none], obj.get("error")) return ExecuteCommandResult(error) @@ -1080,6 +1236,7 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result + # Experimental: this type is part of an experimental API and may change or be removed. class ExtensionSource(Enum): """Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/)""" @@ -1087,6 +1244,7 @@ class ExtensionSource(Enum): PROJECT = "project" USER = "user" + # Experimental: this type is part of an experimental API and may change or be removed. class ExtensionStatus(Enum): """Current status: running, disabled, failed, or starting""" @@ -1096,6 +1254,7 @@ class ExtensionStatus(Enum): RUNNING = "running" STARTING = "starting" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionsDisableRequest: @@ -1105,7 +1264,7 @@ class ExtensionsDisableRequest: """Source-qualified extension ID to disable""" @staticmethod - def from_dict(obj: Any) -> 'ExtensionsDisableRequest': + def from_dict(obj: Any) -> "ExtensionsDisableRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) return ExtensionsDisableRequest(id) @@ -1115,6 +1274,7 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionsEnableRequest: @@ -1124,7 +1284,7 @@ class ExtensionsEnableRequest: """Source-qualified extension ID to enable""" @staticmethod - def from_dict(obj: Any) -> 'ExtensionsEnableRequest': + def from_dict(obj: Any) -> "ExtensionsEnableRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) return ExtensionsEnableRequest(id) @@ -1134,23 +1294,28 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result + # Experimental: this type is part of an experimental API and may change or be removed. class ExternalToolTextResultForLlmBinaryResultsForLlmType(Enum): """Binary result type discriminator. Use "image" for images and "resource" for other binary data. """ + IMAGE = "image" RESOURCE = "resource" + # Experimental: this type is part of an experimental API and may change or be removed. class Theme(Enum): """Theme variant this icon is intended for UI theme preference per SEP-1865 """ + DARK = "dark" LIGHT = "light" + class ExternalToolTextResultForLlmContentType(Enum): AUDIO = "audio" IMAGE = "image" @@ -1159,24 +1324,31 @@ class ExternalToolTextResultForLlmContentType(Enum): TERMINAL = "terminal" TEXT = "text" + class ExternalToolTextResultForLlmContentAudioType(Enum): AUDIO = "audio" + class ExternalToolTextResultForLlmContentImageType(Enum): IMAGE = "image" + class ExternalToolTextResultForLlmContentResourceType(Enum): RESOURCE = "resource" + class ExternalToolTextResultForLlmContentResourceLinkType(Enum): RESOURCE_LINK = "resource_link" + class ExternalToolTextResultForLlmContentTerminalType(Enum): TERMINAL = "terminal" + class KindEnum(Enum): TEXT = "text" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FleetStartRequest: @@ -1186,7 +1358,7 @@ class FleetStartRequest: """Optional user prompt to combine with fleet instructions""" @staticmethod - def from_dict(obj: Any) -> 'FleetStartRequest': + def from_dict(obj: Any) -> "FleetStartRequest": assert isinstance(obj, dict) prompt = from_union([from_str, from_none], obj.get("prompt")) return FleetStartRequest(prompt) @@ -1197,6 +1369,7 @@ def to_dict(self) -> dict: result["prompt"] = from_union([from_str, from_none], self.prompt) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FleetStartResult: @@ -1206,7 +1379,7 @@ class FleetStartResult: """Whether fleet mode was successfully activated""" @staticmethod - def from_dict(obj: Any) -> 'FleetStartResult': + def from_dict(obj: Any) -> "FleetStartResult": assert isinstance(obj, dict) started = from_bool(obj.get("started")) return FleetStartResult(started) @@ -1216,6 +1389,7 @@ def to_dict(self) -> dict: result["started"] = from_bool(self.started) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustAddParams: @@ -1225,7 +1399,7 @@ class FolderTrustAddParams: """Folder path to mark as trusted""" @staticmethod - def from_dict(obj: Any) -> 'FolderTrustAddParams': + def from_dict(obj: Any) -> "FolderTrustAddParams": assert isinstance(obj, dict) path = from_str(obj.get("path")) return FolderTrustAddParams(path) @@ -1235,6 +1409,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustCheckParams: @@ -1244,7 +1419,7 @@ class FolderTrustCheckParams: """Folder path to check""" @staticmethod - def from_dict(obj: Any) -> 'FolderTrustCheckParams': + def from_dict(obj: Any) -> "FolderTrustCheckParams": assert isinstance(obj, dict) path = from_str(obj.get("path")) return FolderTrustCheckParams(path) @@ -1254,6 +1429,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustCheckResult: @@ -1263,7 +1439,7 @@ class FolderTrustCheckResult: """Whether the folder is trusted""" @staticmethod - def from_dict(obj: Any) -> 'FolderTrustCheckResult': + def from_dict(obj: Any) -> "FolderTrustCheckResult": assert isinstance(obj, dict) trusted = from_bool(obj.get("trusted")) return FolderTrustCheckResult(trusted) @@ -1273,9 +1449,11 @@ def to_dict(self) -> dict: result["trusted"] = from_bool(self.trusted) return result + class GhCLIAuthInfoType(Enum): GH_CLI = "gh-cli" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallResult: @@ -1285,7 +1463,7 @@ class HandlePendingToolCallResult: """Whether the tool call result was handled successfully""" @staticmethod - def from_dict(obj: Any) -> 'HandlePendingToolCallResult': + def from_dict(obj: Any) -> "HandlePendingToolCallResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return HandlePendingToolCallResult(success) @@ -1295,6 +1473,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryAbortManualCompactionResult: @@ -1306,7 +1485,7 @@ class HistoryAbortManualCompactionResult: """ @staticmethod - def from_dict(obj: Any) -> 'HistoryAbortManualCompactionResult': + def from_dict(obj: Any) -> "HistoryAbortManualCompactionResult": assert isinstance(obj, dict) aborted = from_bool(obj.get("aborted")) return HistoryAbortManualCompactionResult(aborted) @@ -1316,6 +1495,7 @@ def to_dict(self) -> dict: result["aborted"] = from_bool(self.aborted) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCancelBackgroundCompactionResult: @@ -1327,7 +1507,7 @@ class HistoryCancelBackgroundCompactionResult: """ @staticmethod - def from_dict(obj: Any) -> 'HistoryCancelBackgroundCompactionResult': + def from_dict(obj: Any) -> "HistoryCancelBackgroundCompactionResult": assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return HistoryCancelBackgroundCompactionResult(cancelled) @@ -1337,6 +1517,7 @@ def to_dict(self) -> dict: result["cancelled"] = from_bool(self.cancelled) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactContextWindow: @@ -1361,15 +1542,24 @@ class HistoryCompactContextWindow: """Token count from tool definitions""" @staticmethod - def from_dict(obj: Any) -> 'HistoryCompactContextWindow': + def from_dict(obj: Any) -> "HistoryCompactContextWindow": assert isinstance(obj, dict) current_tokens = from_int(obj.get("currentTokens")) messages_length = from_int(obj.get("messagesLength")) token_limit = from_int(obj.get("tokenLimit")) conversation_tokens = from_union([from_int, from_none], obj.get("conversationTokens")) system_tokens = from_union([from_int, from_none], obj.get("systemTokens")) - tool_definitions_tokens = from_union([from_int, from_none], obj.get("toolDefinitionsTokens")) - return HistoryCompactContextWindow(current_tokens, messages_length, token_limit, conversation_tokens, system_tokens, tool_definitions_tokens) + tool_definitions_tokens = from_union( + [from_int, from_none], obj.get("toolDefinitionsTokens") + ) + return HistoryCompactContextWindow( + current_tokens, + messages_length, + token_limit, + conversation_tokens, + system_tokens, + tool_definitions_tokens, + ) def to_dict(self) -> dict: result: dict = {} @@ -1377,13 +1567,18 @@ def to_dict(self) -> dict: result["messagesLength"] = from_int(self.messages_length) result["tokenLimit"] = from_int(self.token_limit) if self.conversation_tokens is not None: - result["conversationTokens"] = from_union([from_int, from_none], self.conversation_tokens) + result["conversationTokens"] = from_union( + [from_int, from_none], self.conversation_tokens + ) if self.system_tokens is not None: result["systemTokens"] = from_union([from_int, from_none], self.system_tokens) if self.tool_definitions_tokens is not None: - result["toolDefinitionsTokens"] = from_union([from_int, from_none], self.tool_definitions_tokens) + result["toolDefinitionsTokens"] = from_union( + [from_int, from_none], self.tool_definitions_tokens + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactRequest: @@ -1393,7 +1588,7 @@ class HistoryCompactRequest: """Optional user-provided instructions to focus the compaction summary""" @staticmethod - def from_dict(obj: Any) -> 'HistoryCompactRequest': + def from_dict(obj: Any) -> "HistoryCompactRequest": assert isinstance(obj, dict) custom_instructions = from_union([from_str, from_none], obj.get("customInstructions")) return HistoryCompactRequest(custom_instructions) @@ -1401,9 +1596,12 @@ def from_dict(obj: Any) -> 'HistoryCompactRequest': def to_dict(self) -> dict: result: dict = {} if self.custom_instructions is not None: - result["customInstructions"] = from_union([from_str, from_none], self.custom_instructions) + result["customInstructions"] = from_union( + [from_str, from_none], self.custom_instructions + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistorySummarizeForHandoffResult: @@ -1415,7 +1613,7 @@ class HistorySummarizeForHandoffResult: """ @staticmethod - def from_dict(obj: Any) -> 'HistorySummarizeForHandoffResult': + def from_dict(obj: Any) -> "HistorySummarizeForHandoffResult": assert isinstance(obj, dict) summary = from_str(obj.get("summary")) return HistorySummarizeForHandoffResult(summary) @@ -1425,6 +1623,7 @@ def to_dict(self) -> dict: result["summary"] = from_str(self.summary) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryTruncateRequest: @@ -1434,7 +1633,7 @@ class HistoryTruncateRequest: """Event ID to truncate to. This event and all events after it are removed from the session.""" @staticmethod - def from_dict(obj: Any) -> 'HistoryTruncateRequest': + def from_dict(obj: Any) -> "HistoryTruncateRequest": assert isinstance(obj, dict) event_id = from_str(obj.get("eventId")) return HistoryTruncateRequest(event_id) @@ -1444,6 +1643,7 @@ def to_dict(self) -> dict: result["eventId"] = from_str(self.event_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryTruncateResult: @@ -1453,7 +1653,7 @@ class HistoryTruncateResult: """Number of events that were removed""" @staticmethod - def from_dict(obj: Any) -> 'HistoryTruncateResult': + def from_dict(obj: Any) -> "HistoryTruncateResult": assert isinstance(obj, dict) events_removed = from_int(obj.get("eventsRemoved")) return HistoryTruncateResult(events_removed) @@ -1463,23 +1663,29 @@ def to_dict(self) -> dict: result["eventsRemoved"] = from_int(self.events_removed) return result + class HMACAuthInfoType(Enum): HMAC = "hmac" + class PurpleSource(Enum): GITHUB = "github" LOCAL = "local" URL = "url" + class FluffySource(Enum): GITHUB = "github" + class TentacledSource(Enum): LOCAL = "local" + class StickySource(Enum): URL = "url" + # Experimental: this type is part of an experimental API and may change or be removed. class InstructionsSourcesLocation(Enum): """Where this source lives — used for UI grouping""" @@ -1489,6 +1695,7 @@ class InstructionsSourcesLocation(Enum): USER = "user" WORKING_DIRECTORY = "working-directory" + # Experimental: this type is part of an experimental API and may change or be removed. class InstructionsSourcesType(Enum): """Category of instruction source — used for merge logic""" @@ -1501,15 +1708,18 @@ class InstructionsSourcesType(Enum): REPO = "repo" VSCODE = "vscode" + # Experimental: this type is part of an experimental API and may change or be removed. class SessionLogLevel(Enum): """Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". """ + ERROR = "error" INFO = "info" WARNING = "warning" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LogResult: @@ -1519,7 +1729,7 @@ class LogResult: """The unique identifier of the emitted session event""" @staticmethod - def from_dict(obj: Any) -> 'LogResult': + def from_dict(obj: Any) -> "LogResult": assert isinstance(obj, dict) event_id = UUID(obj.get("eventId")) return LogResult(event_id) @@ -1529,6 +1739,7 @@ def to_dict(self) -> dict: result["eventId"] = str(self.event_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LspInitializeRequest: @@ -1548,7 +1759,7 @@ class LspInitializeRequest: """ @staticmethod - def from_dict(obj: Any) -> 'LspInitializeRequest': + def from_dict(obj: Any) -> "LspInitializeRequest": assert isinstance(obj, dict) force = from_union([from_bool, from_none], obj.get("force")) git_root = from_union([from_str, from_none], obj.get("gitRoot")) @@ -1565,6 +1776,7 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseCapability: @@ -1580,7 +1792,7 @@ class MCPAppsDiagnoseCapability: """Whether the session has the `mcp-apps` capability""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsDiagnoseCapability': + def from_dict(obj: Any) -> "MCPAppsDiagnoseCapability": assert isinstance(obj, dict) advertised = from_bool(obj.get("advertised")) feature_flag_enabled = from_bool(obj.get("featureFlagEnabled")) @@ -1594,6 +1806,7 @@ def to_dict(self) -> dict: result["sessionHasMcpApps"] = from_bool(self.session_has_mcp_apps) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseRequest: @@ -1603,7 +1816,7 @@ class MCPAppsDiagnoseRequest: """MCP server to probe""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsDiagnoseRequest': + def from_dict(obj: Any) -> "MCPAppsDiagnoseRequest": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPAppsDiagnoseRequest(server_name) @@ -1613,6 +1826,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseServer: @@ -1631,7 +1845,7 @@ class MCPAppsDiagnoseServer: """Tools whose `_meta.ui` is populated (resourceUri and/or visibility set)""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsDiagnoseServer': + def from_dict(obj: Any) -> "MCPAppsDiagnoseServer": assert isinstance(obj, dict) connected = from_bool(obj.get("connected")) sample_tool_names = from_list(from_str, obj.get("sampleToolNames")) @@ -1647,6 +1861,7 @@ def to_dict(self) -> dict: result["toolsWithUiMeta"] = to_float(self.tools_with_ui_meta) return result + # Experimental: this type is part of an experimental API and may change or be removed. class MCPAppsDisplayMode(Enum): """Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. @@ -1655,10 +1870,12 @@ class MCPAppsDisplayMode(Enum): Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. """ + FULLSCREEN = "fullscreen" INLINE = "inline" PIP = "pip" + # Experimental: this type is part of an experimental API and may change or be removed. class MCPAppsHostContextDetailsPlatform(Enum): """Platform type for responsive design""" @@ -1667,6 +1884,7 @@ class MCPAppsHostContextDetailsPlatform(Enum): MOBILE = "mobile" WEB = "web" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsListToolsRequest: @@ -1681,7 +1899,7 @@ class MCPAppsListToolsRequest: """MCP server hosting the app""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsListToolsRequest': + def from_dict(obj: Any) -> "MCPAppsListToolsRequest": assert isinstance(obj, dict) origin_server_name = from_str(obj.get("originServerName")) server_name = from_str(obj.get("serverName")) @@ -1693,6 +1911,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsListToolsResult: @@ -1702,7 +1921,7 @@ class MCPAppsListToolsResult: """App-callable tools from the server""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsListToolsResult': + def from_dict(obj: Any) -> "MCPAppsListToolsResult": assert isinstance(obj, dict) tools = from_list(lambda x: from_dict(lambda x: x, x), obj.get("tools")) return MCPAppsListToolsResult(tools) @@ -1712,6 +1931,7 @@ def to_dict(self) -> dict: result["tools"] = from_list(lambda x: from_dict(lambda x: x, x), self.tools) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsReadResourceRequest: @@ -1724,7 +1944,7 @@ class MCPAppsReadResourceRequest: """Resource URI (typically ui://...)""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsReadResourceRequest': + def from_dict(obj: Any) -> "MCPAppsReadResourceRequest": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) uri = from_str(obj.get("uri")) @@ -1736,6 +1956,7 @@ def to_dict(self) -> dict: result["uri"] = from_str(self.uri) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsResourceContent: @@ -1757,7 +1978,7 @@ class MCPAppsResourceContent: """Text content (e.g. HTML)""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsResourceContent': + def from_dict(obj: Any) -> "MCPAppsResourceContent": assert isinstance(obj, dict) uri = from_str(obj.get("uri")) meta = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("_meta")) @@ -1770,7 +1991,9 @@ def to_dict(self) -> dict: result: dict = {} result["uri"] = from_str(self.uri) if self.meta is not None: - result["_meta"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.meta) + result["_meta"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.meta + ) if self.blob is not None: result["blob"] = from_union([from_str, from_none], self.blob) if self.mime_type is not None: @@ -1779,6 +2002,7 @@ def to_dict(self) -> dict: result["text"] = from_union([from_str, from_none], self.text) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPCancelSamplingExecutionParams: @@ -1788,7 +2012,7 @@ class MCPCancelSamplingExecutionParams: """The requestId previously passed to executeSampling that should be cancelled""" @staticmethod - def from_dict(obj: Any) -> 'MCPCancelSamplingExecutionParams': + def from_dict(obj: Any) -> "MCPCancelSamplingExecutionParams": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) return MCPCancelSamplingExecutionParams(request_id) @@ -1798,12 +2022,14 @@ def to_dict(self) -> dict: result["requestId"] = from_str(self.request_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPCancelSamplingExecutionResult: """Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. """ + cancelled: bool """True if an in-flight execution with the given requestId was found and signalled to cancel. False when no such execution is in flight (already completed, never started, or @@ -1811,7 +2037,7 @@ class MCPCancelSamplingExecutionResult: """ @staticmethod - def from_dict(obj: Any) -> 'MCPCancelSamplingExecutionResult': + def from_dict(obj: Any) -> "MCPCancelSamplingExecutionResult": assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return MCPCancelSamplingExecutionResult(cancelled) @@ -1821,6 +2047,7 @@ def to_dict(self) -> dict: result["cancelled"] = from_bool(self.cancelled) return result + @dataclass class MCPServerConfigHTTPAuth: """Additional authentication configuration for this server.""" @@ -1829,7 +2056,7 @@ class MCPServerConfigHTTPAuth: """Fixed port for the OAuth redirect callback server.""" @staticmethod - def from_dict(obj: Any) -> 'MCPServerConfigHTTPAuth': + def from_dict(obj: Any) -> "MCPServerConfigHTTPAuth": assert isinstance(obj, dict) redirect_port = from_union([from_int, from_none], obj.get("redirectPort")) return MCPServerConfigHTTPAuth(redirect_port) @@ -1840,18 +2067,21 @@ def to_dict(self) -> dict: result["redirectPort"] = from_union([from_int, from_none], self.redirect_port) return result + class MCPServerConfigHTTPOauthGrantType(Enum): """OAuth grant type to use when authenticating to the remote MCP server.""" AUTHORIZATION_CODE = "authorization_code" CLIENT_CREDENTIALS = "client_credentials" + class MCPServerConfigHTTPType(Enum): """Remote transport type. Defaults to "http" when omitted.""" HTTP = "http" SSE = "sse" + @dataclass class MCPConfigDisableRequest: """MCP server names to disable for new sessions.""" @@ -1863,7 +2093,7 @@ class MCPConfigDisableRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MCPConfigDisableRequest': + def from_dict(obj: Any) -> "MCPConfigDisableRequest": assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return MCPConfigDisableRequest(names) @@ -1873,6 +2103,7 @@ def to_dict(self) -> dict: result["names"] = from_list(from_str, self.names) return result + @dataclass class MCPConfigEnableRequest: """MCP server names to enable for new sessions.""" @@ -1883,7 +2114,7 @@ class MCPConfigEnableRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MCPConfigEnableRequest': + def from_dict(obj: Any) -> "MCPConfigEnableRequest": assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return MCPConfigEnableRequest(names) @@ -1893,6 +2124,7 @@ def to_dict(self) -> dict: result["names"] = from_list(from_str, self.names) return result + @dataclass class MCPConfigRemoveRequest: """MCP server name to remove from user configuration.""" @@ -1901,7 +2133,7 @@ class MCPConfigRemoveRequest: """Name of the MCP server to remove""" @staticmethod - def from_dict(obj: Any) -> 'MCPConfigRemoveRequest': + def from_dict(obj: Any) -> "MCPConfigRemoveRequest": assert isinstance(obj, dict) name = from_str(obj.get("name")) return MCPConfigRemoveRequest(name) @@ -1911,6 +2143,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPDisableRequest: @@ -1920,7 +2153,7 @@ class MCPDisableRequest: """Name of the MCP server to disable""" @staticmethod - def from_dict(obj: Any) -> 'MCPDisableRequest': + def from_dict(obj: Any) -> "MCPDisableRequest": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPDisableRequest(server_name) @@ -1930,6 +2163,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + @dataclass class MCPDiscoverRequest: """Optional working directory used as context for MCP server discovery.""" @@ -1938,7 +2172,7 @@ class MCPDiscoverRequest: """Working directory used as context for discovery (e.g., plugin resolution)""" @staticmethod - def from_dict(obj: Any) -> 'MCPDiscoverRequest': + def from_dict(obj: Any) -> "MCPDiscoverRequest": assert isinstance(obj, dict) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return MCPDiscoverRequest(working_directory) @@ -1949,6 +2183,7 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPEnableRequest: @@ -1958,7 +2193,7 @@ class MCPEnableRequest: """Name of the MCP server to enable""" @staticmethod - def from_dict(obj: Any) -> 'MCPEnableRequest': + def from_dict(obj: Any) -> "MCPEnableRequest": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPEnableRequest(server_name) @@ -1968,12 +2203,14 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthLoginRequest: """Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy. """ + server_name: str """Name of the remote MCP server to authenticate""" @@ -1996,31 +2233,39 @@ class MCPOauthLoginRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MCPOauthLoginRequest': + def from_dict(obj: Any) -> "MCPOauthLoginRequest": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) - callback_success_message = from_union([from_str, from_none], obj.get("callbackSuccessMessage")) + callback_success_message = from_union( + [from_str, from_none], obj.get("callbackSuccessMessage") + ) client_name = from_union([from_str, from_none], obj.get("clientName")) force_reauth = from_union([from_bool, from_none], obj.get("forceReauth")) - return MCPOauthLoginRequest(server_name, callback_success_message, client_name, force_reauth) + return MCPOauthLoginRequest( + server_name, callback_success_message, client_name, force_reauth + ) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) if self.callback_success_message is not None: - result["callbackSuccessMessage"] = from_union([from_str, from_none], self.callback_success_message) + result["callbackSuccessMessage"] = from_union( + [from_str, from_none], self.callback_success_message + ) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.force_reauth is not None: result["forceReauth"] = from_union([from_bool, from_none], self.force_reauth) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthLoginResult: """OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. """ + authorization_url: str | None = None """URL the caller should open in a browser to complete OAuth. Omitted when cached tokens were still valid and no browser interaction was needed — the server is already @@ -2030,7 +2275,7 @@ class MCPOauthLoginResult: """ @staticmethod - def from_dict(obj: Any) -> 'MCPOauthLoginResult': + def from_dict(obj: Any) -> "MCPOauthLoginResult": assert isinstance(obj, dict) authorization_url = from_union([from_str, from_none], obj.get("authorizationUrl")) return MCPOauthLoginResult(authorization_url) @@ -2041,12 +2286,14 @@ def to_dict(self) -> dict: result["authorizationUrl"] = from_union([from_str, from_none], self.authorization_url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPRemoveGitHubResult: """Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). """ + removed: bool """True when the auto-managed `github` MCP server was removed; false when no removal happened (e.g. user has explicitly configured a `github` server, or the server was not @@ -2054,7 +2301,7 @@ class MCPRemoveGitHubResult: """ @staticmethod - def from_dict(obj: Any) -> 'MCPRemoveGitHubResult': + def from_dict(obj: Any) -> "MCPRemoveGitHubResult": assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return MCPRemoveGitHubResult(removed) @@ -2064,16 +2311,19 @@ def to_dict(self) -> dict: result["removed"] = from_bool(self.removed) return result + # Experimental: this type is part of an experimental API and may change or be removed. class MCPSamplingExecutionAction(Enum): """Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. """ + CANCELLED = "cancelled" FAILURE = "failure" SUCCESS = "success" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServer: @@ -2092,7 +2342,7 @@ class MCPServer: """Configuration source: user, workspace, plugin, or builtin""" @staticmethod - def from_dict(obj: Any) -> 'MCPServer': + def from_dict(obj: Any) -> "MCPServer": assert isinstance(obj, dict) name = from_str(obj.get("name")) status = McpServerStatus(obj.get("status")) @@ -2107,9 +2357,12 @@ def to_dict(self) -> dict: if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.source is not None: - result["source"] = from_union([lambda x: to_enum(McpServerSource, x), from_none], self.source) + result["source"] = from_union( + [lambda x: to_enum(McpServerSource, x), from_none], self.source + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. class MCPSetEnvValueModeDetails(Enum): """How environment-variable values supplied to MCP servers are resolved. "direct" passes @@ -2123,9 +2376,11 @@ class MCPSetEnvValueModeDetails(Enum): How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). """ + DIRECT = "direct" INDIRECT = "indirect" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionContextInfo: @@ -2161,7 +2416,7 @@ class SessionContextInfo: """Sum of system, conversation and tool-definition tokens""" @staticmethod - def from_dict(obj: Any) -> 'SessionContextInfo': + def from_dict(obj: Any) -> "SessionContextInfo": assert isinstance(obj, dict) buffer_tokens = from_int(obj.get("bufferTokens")) compaction_threshold = from_int(obj.get("compactionThreshold")) @@ -2172,7 +2427,17 @@ def from_dict(obj: Any) -> 'SessionContextInfo': system_tokens = from_int(obj.get("systemTokens")) tool_definitions_tokens = from_int(obj.get("toolDefinitionsTokens")) total_tokens = from_int(obj.get("totalTokens")) - return SessionContextInfo(buffer_tokens, compaction_threshold, conversation_tokens, limit, model_name, prompt_token_limit, system_tokens, tool_definitions_tokens, total_tokens) + return SessionContextInfo( + buffer_tokens, + compaction_threshold, + conversation_tokens, + limit, + model_name, + prompt_token_limit, + system_tokens, + tool_definitions_tokens, + total_tokens, + ) def to_dict(self) -> dict: result: dict = {} @@ -2187,12 +2452,14 @@ def to_dict(self) -> dict: result["totalTokens"] = from_int(self.total_tokens) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataIsProcessingResult: """Indicates whether the local session is currently processing a turn or background continuation. """ + processing: bool """Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background @@ -2200,7 +2467,7 @@ class MetadataIsProcessingResult: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataIsProcessingResult': + def from_dict(obj: Any) -> "MetadataIsProcessingResult": assert isinstance(obj, dict) processing = from_bool(obj.get("processing")) return MetadataIsProcessingResult(processing) @@ -2210,6 +2477,7 @@ def to_dict(self) -> dict: result["processing"] = from_bool(self.processing) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecomputeContextTokensResult: @@ -2218,6 +2486,7 @@ class MetadataRecomputeContextTokensResult: resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. """ + messages_token_count: int """Tokens contributed by user/assistant/tool messages (excludes system/developer prompts).""" @@ -2230,12 +2499,14 @@ class MetadataRecomputeContextTokensResult: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataRecomputeContextTokensResult': + def from_dict(obj: Any) -> "MetadataRecomputeContextTokensResult": assert isinstance(obj, dict) messages_token_count = from_int(obj.get("messagesTokenCount")) system_token_count = from_int(obj.get("systemTokenCount")) total_tokens = from_int(obj.get("totalTokens")) - return MetadataRecomputeContextTokensResult(messages_token_count, system_token_count, total_tokens) + return MetadataRecomputeContextTokensResult( + messages_token_count, system_token_count, total_tokens + ) def to_dict(self) -> dict: result: dict = {} @@ -2244,6 +2515,7 @@ def to_dict(self) -> dict: result["totalTokens"] = from_int(self.total_tokens) return result + # Experimental: this type is part of an experimental API and may change or be removed. class HostType(Enum): """Hosting platform type of the repository @@ -2254,9 +2526,11 @@ class HostType(Enum): Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. """ + ADO = "ado" GITHUB = "github" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecordContextChangeResult: @@ -2265,8 +2539,9 @@ class MetadataRecordContextChangeResult: UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). """ + @staticmethod - def from_dict(obj: Any) -> 'MetadataRecordContextChangeResult': + def from_dict(obj: Any) -> "MetadataRecordContextChangeResult": assert isinstance(obj, dict) return MetadataRecordContextChangeResult() @@ -2274,6 +2549,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSetWorkingDirectoryRequest: @@ -2286,7 +2562,7 @@ class MetadataSetWorkingDirectoryRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataSetWorkingDirectoryRequest': + def from_dict(obj: Any) -> "MetadataSetWorkingDirectoryRequest": assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return MetadataSetWorkingDirectoryRequest(working_directory) @@ -2296,6 +2572,7 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSetWorkingDirectoryResult: @@ -2304,11 +2581,12 @@ class MetadataSetWorkingDirectoryResult: related side-effects (file index, etc.); this method only updates the session's own recorded path. """ + working_directory: str """Working directory after the update""" @staticmethod - def from_dict(obj: Any) -> 'MetadataSetWorkingDirectoryResult': + def from_dict(obj: Any) -> "MetadataSetWorkingDirectoryResult": assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return MetadataSetWorkingDirectoryResult(working_directory) @@ -2318,6 +2596,7 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. class MetadataSnapshotCurrentMode(Enum): """The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot')""" @@ -2326,6 +2605,7 @@ class MetadataSnapshotCurrentMode(Enum): INTERACTIVE = "interactive" PLAN = "plan" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSnapshotRemoteMetadataRepository: @@ -2341,7 +2621,7 @@ class MetadataSnapshotRemoteMetadataRepository: """The GitHub owner (user or organization) of the target repository.""" @staticmethod - def from_dict(obj: Any) -> 'MetadataSnapshotRemoteMetadataRepository': + def from_dict(obj: Any) -> "MetadataSnapshotRemoteMetadataRepository": assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) @@ -2355,14 +2635,17 @@ def to_dict(self) -> dict: result["owner"] = from_str(self.owner) return result + # Experimental: this type is part of an experimental API and may change or be removed. class MetadataSnapshotRemoteMetadataTaskType(Enum): """Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. """ + CCA = "cca" CLI = "cli" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModeSetRequest: @@ -2372,7 +2655,7 @@ class ModeSetRequest: """The session mode the agent is operating in""" @staticmethod - def from_dict(obj: Any) -> 'ModeSetRequest': + def from_dict(obj: Any) -> "ModeSetRequest": assert isinstance(obj, dict) mode = SessionMode(obj.get("mode")) return ModeSetRequest(mode) @@ -2382,6 +2665,7 @@ def to_dict(self) -> dict: result["mode"] = to_enum(SessionMode, self.mode) return result + @dataclass class ModelBillingTokenPricesLongContext: """Long context tier pricing (available for models with extended context windows)""" @@ -2399,13 +2683,15 @@ class ModelBillingTokenPricesLongContext: """AI Credits cost per billing batch of output tokens""" @staticmethod - def from_dict(obj: Any) -> 'ModelBillingTokenPricesLongContext': + def from_dict(obj: Any) -> "ModelBillingTokenPricesLongContext": assert isinstance(obj, dict) cache_price = from_union([from_float, from_none], obj.get("cachePrice")) context_max = from_union([from_int, from_none], obj.get("contextMax")) input_price = from_union([from_float, from_none], obj.get("inputPrice")) output_price = from_union([from_float, from_none], obj.get("outputPrice")) - return ModelBillingTokenPricesLongContext(cache_price, context_max, input_price, output_price) + return ModelBillingTokenPricesLongContext( + cache_price, context_max, input_price, output_price + ) def to_dict(self) -> dict: result: dict = {} @@ -2419,6 +2705,7 @@ def to_dict(self) -> dict: result["outputPrice"] = from_union([to_float, from_none], self.output_price) return result + @dataclass class ModelCapabilitiesLimitsVision: """Vision-specific limits""" @@ -2433,12 +2720,14 @@ class ModelCapabilitiesLimitsVision: """MIME types the model accepts""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesLimitsVision': + def from_dict(obj: Any) -> "ModelCapabilitiesLimitsVision": assert isinstance(obj, dict) max_prompt_image_size = from_int(obj.get("max_prompt_image_size")) max_prompt_images = from_int(obj.get("max_prompt_images")) supported_media_types = from_list(from_str, obj.get("supported_media_types")) - return ModelCapabilitiesLimitsVision(max_prompt_image_size, max_prompt_images, supported_media_types) + return ModelCapabilitiesLimitsVision( + max_prompt_image_size, max_prompt_images, supported_media_types + ) def to_dict(self) -> dict: result: dict = {} @@ -2447,6 +2736,7 @@ def to_dict(self) -> dict: result["supported_media_types"] = from_list(from_str, self.supported_media_types) return result + @dataclass class ModelCapabilitiesSupports: """Feature flags indicating what the model supports""" @@ -2458,7 +2748,7 @@ class ModelCapabilitiesSupports: """Whether this model supports vision/image input""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesSupports': + def from_dict(obj: Any) -> "ModelCapabilitiesSupports": assert isinstance(obj, dict) reasoning_effort = from_union([from_bool, from_none], obj.get("reasoningEffort")) vision = from_union([from_bool, from_none], obj.get("vision")) @@ -2472,6 +2762,7 @@ def to_dict(self) -> dict: result["vision"] = from_union([from_bool, from_none], self.vision) return result + class ModelPickerPriceCategory(Enum): """Relative cost tier for token-based billing users""" @@ -2480,6 +2771,7 @@ class ModelPickerPriceCategory(Enum): MEDIUM = "medium" VERY_HIGH = "very_high" + class ModelPolicyState(Enum): """Current policy state for this model""" @@ -2487,6 +2779,7 @@ class ModelPolicyState(Enum): ENABLED = "enabled" UNCONFIGURED = "unconfigured" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideLimitsVision: @@ -2502,23 +2795,32 @@ class ModelCapabilitiesOverrideLimitsVision: """MIME types the model accepts""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideLimitsVision': + def from_dict(obj: Any) -> "ModelCapabilitiesOverrideLimitsVision": assert isinstance(obj, dict) max_prompt_image_size = from_union([from_int, from_none], obj.get("max_prompt_image_size")) max_prompt_images = from_union([from_int, from_none], obj.get("max_prompt_images")) - supported_media_types = from_union([lambda x: from_list(from_str, x), from_none], obj.get("supported_media_types")) - return ModelCapabilitiesOverrideLimitsVision(max_prompt_image_size, max_prompt_images, supported_media_types) + supported_media_types = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("supported_media_types") + ) + return ModelCapabilitiesOverrideLimitsVision( + max_prompt_image_size, max_prompt_images, supported_media_types + ) def to_dict(self) -> dict: result: dict = {} if self.max_prompt_image_size is not None: - result["max_prompt_image_size"] = from_union([from_int, from_none], self.max_prompt_image_size) + result["max_prompt_image_size"] = from_union( + [from_int, from_none], self.max_prompt_image_size + ) if self.max_prompt_images is not None: result["max_prompt_images"] = from_union([from_int, from_none], self.max_prompt_images) if self.supported_media_types is not None: - result["supported_media_types"] = from_union([lambda x: from_list(from_str, x), from_none], self.supported_media_types) + result["supported_media_types"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.supported_media_types + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideSupports: @@ -2531,7 +2833,7 @@ class ModelCapabilitiesOverrideSupports: """Whether this model supports vision/image input""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideSupports': + def from_dict(obj: Any) -> "ModelCapabilitiesOverrideSupports": assert isinstance(obj, dict) reasoning_effort = from_union([from_bool, from_none], obj.get("reasoningEffort")) vision = from_union([from_bool, from_none], obj.get("vision")) @@ -2545,6 +2847,7 @@ def to_dict(self) -> dict: result["vision"] = from_union([from_bool, from_none], self.vision) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSetReasoningEffortRequest: @@ -2556,7 +2859,7 @@ class ModelSetReasoningEffortRequest: """ @staticmethod - def from_dict(obj: Any) -> 'ModelSetReasoningEffortRequest': + def from_dict(obj: Any) -> "ModelSetReasoningEffortRequest": assert isinstance(obj, dict) reasoning_effort = from_str(obj.get("reasoningEffort")) return ModelSetReasoningEffortRequest(reasoning_effort) @@ -2566,6 +2869,7 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_str(self.reasoning_effort) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSetReasoningEffortResult: @@ -2573,11 +2877,12 @@ class ModelSetReasoningEffortResult: instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns. """ + reasoning_effort: str """Reasoning effort level recorded on the session after the update""" @staticmethod - def from_dict(obj: Any) -> 'ModelSetReasoningEffortResult': + def from_dict(obj: Any) -> "ModelSetReasoningEffortResult": assert isinstance(obj, dict) reasoning_effort = from_str(obj.get("reasoningEffort")) return ModelSetReasoningEffortResult(reasoning_effort) @@ -2587,6 +2892,7 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_str(self.reasoning_effort) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSwitchToResult: @@ -2596,7 +2902,7 @@ class ModelSwitchToResult: """Currently active model identifier after the switch""" @staticmethod - def from_dict(obj: Any) -> 'ModelSwitchToResult': + def from_dict(obj: Any) -> "ModelSwitchToResult": assert isinstance(obj, dict) model_id = from_union([from_str, from_none], obj.get("modelId")) return ModelSwitchToResult(model_id) @@ -2607,6 +2913,7 @@ def to_dict(self) -> dict: result["modelId"] = from_union([from_str, from_none], self.model_id) return result + @dataclass class ModelsListRequest: git_hub_token: str | None = None @@ -2615,7 +2922,7 @@ class ModelsListRequest: """ @staticmethod - def from_dict(obj: Any) -> 'ModelsListRequest': + def from_dict(obj: Any) -> "ModelsListRequest": assert isinstance(obj, dict) git_hub_token = from_union([from_str, from_none], obj.get("gitHubToken")) return ModelsListRequest(git_hub_token) @@ -2626,6 +2933,7 @@ def to_dict(self) -> dict: result["gitHubToken"] = from_union([from_str, from_none], self.git_hub_token) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameGetResult: @@ -2635,7 +2943,7 @@ class NameGetResult: """The session name (user-set or auto-generated), or null if not yet set""" @staticmethod - def from_dict(obj: Any) -> 'NameGetResult': + def from_dict(obj: Any) -> "NameGetResult": assert isinstance(obj, dict) name = from_union([from_none, from_str], obj.get("name")) return NameGetResult(name) @@ -2645,19 +2953,21 @@ def to_dict(self) -> dict: result["name"] = from_union([from_none, from_str], self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetAutoRequest: """Auto-generated session summary to apply as the session's name when no user-set name exists. """ + summary: str """Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. """ @staticmethod - def from_dict(obj: Any) -> 'NameSetAutoRequest': + def from_dict(obj: Any) -> "NameSetAutoRequest": assert isinstance(obj, dict) summary = from_str(obj.get("summary")) return NameSetAutoRequest(summary) @@ -2667,6 +2977,7 @@ def to_dict(self) -> dict: result["summary"] = from_str(self.summary) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetAutoResult: @@ -2678,7 +2989,7 @@ class NameSetAutoResult: """ @staticmethod - def from_dict(obj: Any) -> 'NameSetAutoResult': + def from_dict(obj: Any) -> "NameSetAutoResult": assert isinstance(obj, dict) applied = from_bool(obj.get("applied")) return NameSetAutoResult(applied) @@ -2688,6 +2999,7 @@ def to_dict(self) -> dict: result["applied"] = from_bool(self.applied) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetRequest: @@ -2697,7 +3009,7 @@ class NameSetRequest: """New session name (1–100 characters, trimmed of leading/trailing whitespace)""" @staticmethod - def from_dict(obj: Any) -> 'NameSetRequest': + def from_dict(obj: Any) -> "NameSetRequest": assert isinstance(obj, dict) name = from_str(obj.get("name")) return NameSetRequest(name) @@ -2707,6 +3019,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PendingPermissionRequest: @@ -2720,7 +3033,7 @@ class PendingPermissionRequest: """Unique identifier for the pending permission request""" @staticmethod - def from_dict(obj: Any) -> 'PendingPermissionRequest': + def from_dict(obj: Any) -> "PendingPermissionRequest": assert isinstance(obj, dict) request = PermissionPromptRequest.from_dict(obj.get("request")) request_id = from_str(obj.get("requestId")) @@ -2732,6 +3045,7 @@ def to_dict(self) -> dict: result["requestId"] = from_str(self.request_id) return result + class ApprovalKind(Enum): COMMANDS = "commands" CUSTOM_TOOL = "custom-tool" @@ -2743,6 +3057,7 @@ class ApprovalKind(Enum): READ = "read" WRITE = "write" + class PermissionDecisionKind(Enum): APPROVED = "approved" APPROVED_FOR_LOCATION = "approved-for-location" @@ -2756,79 +3071,107 @@ class PermissionDecisionKind(Enum): DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook" DENIED_BY_RULES = "denied-by-rules" DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user" - DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user" + DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = ( + "denied-no-approval-rule-and-could-not-request-from-user" + ) REJECT = "reject" USER_NOT_AVAILABLE = "user-not-available" + class PermissionDecisionApproveForLocationKind(Enum): APPROVE_FOR_LOCATION = "approve-for-location" + class PermissionDecisionApproveForLocationApprovalCommandsKind(Enum): COMMANDS = "commands" + class PermissionDecisionApproveForLocationApprovalCustomToolKind(Enum): CUSTOM_TOOL = "custom-tool" + class PermissionDecisionApproveForLocationApprovalExtensionManagementKind(Enum): EXTENSION_MANAGEMENT = "extension-management" + class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccessKind(Enum): EXTENSION_PERMISSION_ACCESS = "extension-permission-access" + class PermissionDecisionApproveForLocationApprovalMCPKind(Enum): MCP = "mcp" + class PermissionDecisionApproveForLocationApprovalMCPSamplingKind(Enum): MCP_SAMPLING = "mcp-sampling" + class PermissionDecisionApproveForLocationApprovalMemoryKind(Enum): MEMORY = "memory" + class PermissionDecisionApproveForLocationApprovalReadKind(Enum): READ = "read" + class PermissionDecisionApproveForLocationApprovalWriteKind(Enum): WRITE = "write" + class PermissionDecisionApproveForSessionKind(Enum): APPROVE_FOR_SESSION = "approve-for-session" + class PermissionDecisionApproveOnceKind(Enum): APPROVE_ONCE = "approve-once" + class PermissionDecisionApprovePermanentlyKind(Enum): APPROVE_PERMANENTLY = "approve-permanently" + class PermissionDecisionApprovedKind(Enum): APPROVED = "approved" + class PermissionDecisionApprovedForLocationKind(Enum): APPROVED_FOR_LOCATION = "approved-for-location" + class PermissionDecisionApprovedForSessionKind(Enum): APPROVED_FOR_SESSION = "approved-for-session" + class PermissionDecisionCancelledKind(Enum): CANCELLED = "cancelled" + class PermissionDecisionDeniedByContentExclusionPolicyKind(Enum): DENIED_BY_CONTENT_EXCLUSION_POLICY = "denied-by-content-exclusion-policy" + class PermissionDecisionDeniedByPermissionRequestHookKind(Enum): DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook" + class PermissionDecisionDeniedByRulesKind(Enum): DENIED_BY_RULES = "denied-by-rules" + class PermissionDecisionDeniedInteractivelyByUserKind(Enum): DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user" + class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind(Enum): - DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user" + DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = ( + "denied-no-approval-rule-and-could-not-request-from-user" + ) + class PermissionDecisionRejectKind(Enum): REJECT = "reject" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionRequest: @@ -2841,7 +3184,7 @@ class PermissionDecisionRequest: """The client's response to the pending permission prompt""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionRequest': + def from_dict(obj: Any) -> "PermissionDecisionRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = _load_PermissionDecision(obj.get("result")) @@ -2853,9 +3196,11 @@ def to_dict(self) -> dict: result["result"] = (self.result).to_dict() return result + class PermissionDecisionUserNotAvailableKind(Enum): USER_NOT_AVAILABLE = "user-not-available" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationApplyParams: @@ -2865,7 +3210,7 @@ class PermissionLocationApplyParams: """Working directory whose persisted location permissions should be applied""" @staticmethod - def from_dict(obj: Any) -> 'PermissionLocationApplyParams': + def from_dict(obj: Any) -> "PermissionLocationApplyParams": assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return PermissionLocationApplyParams(working_directory) @@ -2875,6 +3220,7 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. class PermissionLocationType(Enum): """Whether the location is a git repo or directory""" @@ -2882,6 +3228,7 @@ class PermissionLocationType(Enum): DIR = "dir" REPO = "repo" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationResolveParams: @@ -2891,7 +3238,7 @@ class PermissionLocationResolveParams: """Working directory whose permission location should be resolved""" @staticmethod - def from_dict(obj: Any) -> 'PermissionLocationResolveParams': + def from_dict(obj: Any) -> "PermissionLocationResolveParams": assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return PermissionLocationResolveParams(working_directory) @@ -2901,6 +3248,7 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAddParams: @@ -2912,7 +3260,7 @@ class PermissionPathsAddParams: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsAddParams': + def from_dict(obj: Any) -> "PermissionPathsAddParams": assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsAddParams(path) @@ -2922,6 +3270,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAllowedCheckParams: @@ -2931,7 +3280,7 @@ class PermissionPathsAllowedCheckParams: """Path to check against the session's allowed directories""" @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsAllowedCheckParams': + def from_dict(obj: Any) -> "PermissionPathsAllowedCheckParams": assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsAllowedCheckParams(path) @@ -2941,6 +3290,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAllowedCheckResult: @@ -2950,7 +3300,7 @@ class PermissionPathsAllowedCheckResult: """Whether the path is within the session's allowed directories""" @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsAllowedCheckResult': + def from_dict(obj: Any) -> "PermissionPathsAllowedCheckResult": assert isinstance(obj, dict) allowed = from_bool(obj.get("allowed")) return PermissionPathsAllowedCheckResult(allowed) @@ -2960,6 +3310,7 @@ def to_dict(self) -> dict: result["allowed"] = from_bool(self.allowed) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsList: @@ -2972,7 +3323,7 @@ class PermissionPathsList: """The primary working directory for this session.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsList': + def from_dict(obj: Any) -> "PermissionPathsList": assert isinstance(obj, dict) directories = from_list(from_str, obj.get("directories")) primary = from_str(obj.get("primary")) @@ -2984,6 +3335,7 @@ def to_dict(self) -> dict: result["primary"] = from_str(self.primary) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsUpdatePrimaryParams: @@ -2993,7 +3345,7 @@ class PermissionPathsUpdatePrimaryParams: """Directory to set as the new primary working directory for the session's permission policy.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsUpdatePrimaryParams': + def from_dict(obj: Any) -> "PermissionPathsUpdatePrimaryParams": assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsUpdatePrimaryParams(path) @@ -3003,6 +3355,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsWorkspaceCheckParams: @@ -3012,7 +3365,7 @@ class PermissionPathsWorkspaceCheckParams: """Path to check against the session workspace directory""" @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsWorkspaceCheckParams': + def from_dict(obj: Any) -> "PermissionPathsWorkspaceCheckParams": assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsWorkspaceCheckParams(path) @@ -3022,6 +3375,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsWorkspaceCheckResult: @@ -3031,7 +3385,7 @@ class PermissionPathsWorkspaceCheckResult: """Whether the path is within the session workspace directory""" @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsWorkspaceCheckResult': + def from_dict(obj: Any) -> "PermissionPathsWorkspaceCheckResult": assert isinstance(obj, dict) allowed = from_bool(obj.get("allowed")) return PermissionPathsWorkspaceCheckResult(allowed) @@ -3041,6 +3395,7 @@ def to_dict(self) -> dict: result["allowed"] = from_bool(self.allowed) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPromptShownNotification: @@ -3053,7 +3408,7 @@ class PermissionPromptShownNotification: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionPromptShownNotification': + def from_dict(obj: Any) -> "PermissionPromptShownNotification": assert isinstance(obj, dict) message = from_str(obj.get("message")) return PermissionPromptShownNotification(message) @@ -3063,17 +3418,19 @@ def to_dict(self) -> dict: result["message"] = from_str(self.message) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionRequestResult: """Indicates whether the permission decision was applied; false when the request was already resolved. """ + success: bool """Whether the permission request was handled successfully""" @staticmethod - def from_dict(obj: Any) -> 'PermissionRequestResult': + def from_dict(obj: Any) -> "PermissionRequestResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionRequestResult(success) @@ -3083,12 +3440,14 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionRulesSet: """If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. """ + approved: list[PermissionRule] """Rules that auto-approve matching requests""" @@ -3096,7 +3455,7 @@ class PermissionRulesSet: """Rules that auto-deny matching requests""" @staticmethod - def from_dict(obj: Any) -> 'PermissionRulesSet': + def from_dict(obj: Any) -> "PermissionRulesSet": assert isinstance(obj, dict) approved = from_list(PermissionRule.from_dict, obj.get("approved")) denied = from_list(PermissionRule.from_dict, obj.get("denied")) @@ -3108,6 +3467,7 @@ def to_dict(self) -> dict: result["denied"] = from_list(lambda x: to_class(PermissionRule, x), self.denied) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionUrlsConfig: @@ -3115,6 +3475,7 @@ class PermissionUrlsConfig: fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. """ + initial_allowed: list[str] | None = None """Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. @@ -3125,20 +3486,25 @@ class PermissionUrlsConfig: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionUrlsConfig': + def from_dict(obj: Any) -> "PermissionUrlsConfig": assert isinstance(obj, dict) - initial_allowed = from_union([lambda x: from_list(from_str, x), from_none], obj.get("initialAllowed")) + initial_allowed = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("initialAllowed") + ) unrestricted = from_union([from_bool, from_none], obj.get("unrestricted")) return PermissionUrlsConfig(initial_allowed, unrestricted) def to_dict(self) -> dict: result: dict = {} if self.initial_allowed is not None: - result["initialAllowed"] = from_union([lambda x: from_list(from_str, x), from_none], self.initial_allowed) + result["initialAllowed"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.initial_allowed + ) if self.unrestricted is not None: result["unrestricted"] = from_union([from_bool, from_none], self.unrestricted) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionUrlsSetUnrestrictedModeParams: @@ -3150,7 +3516,7 @@ class PermissionUrlsSetUnrestrictedModeParams: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionUrlsSetUnrestrictedModeParams': + def from_dict(obj: Any) -> "PermissionUrlsSetUnrestrictedModeParams": assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) return PermissionUrlsSetUnrestrictedModeParams(enabled) @@ -3160,6 +3526,7 @@ def to_dict(self) -> dict: result["enabled"] = from_bool(self.enabled) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource: @@ -3169,7 +3536,7 @@ class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource: type: str @staticmethod - def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicyRuleSource': + def from_dict(obj: Any) -> "PermissionsConfigureAdditionalContentExclusionPolicyRuleSource": assert isinstance(obj, dict) name = from_str(obj.get("name")) type = from_str(obj.get("type")) @@ -3181,14 +3548,17 @@ def to_dict(self) -> dict: result["type"] = from_str(self.type) return result + # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsConfigureAdditionalContentExclusionPolicyScope(Enum): """Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. """ + ALL = "all" REPO = "repo" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureResult: @@ -3198,7 +3568,7 @@ class PermissionsConfigureResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsConfigureResult': + def from_dict(obj: Any) -> "PermissionsConfigureResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsConfigureResult(success) @@ -3208,6 +3578,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsFolderTrustAddTrustedResult: @@ -3217,7 +3588,7 @@ class PermissionsFolderTrustAddTrustedResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsFolderTrustAddTrustedResult': + def from_dict(obj: Any) -> "PermissionsFolderTrustAddTrustedResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsFolderTrustAddTrustedResult(success) @@ -3227,6 +3598,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalResult: @@ -3236,7 +3608,7 @@ class PermissionsLocationsAddToolApprovalResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalResult': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsLocationsAddToolApprovalResult(success) @@ -3246,14 +3618,17 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsModifyRulesScope(Enum): """Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. """ + LOCATION = "location" SESSION = "session" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsModifyRulesResult: @@ -3263,7 +3638,7 @@ class PermissionsModifyRulesResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsModifyRulesResult': + def from_dict(obj: Any) -> "PermissionsModifyRulesResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsModifyRulesResult(success) @@ -3273,6 +3648,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsNotifyPromptShownResult: @@ -3282,7 +3658,7 @@ class PermissionsNotifyPromptShownResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsNotifyPromptShownResult': + def from_dict(obj: Any) -> "PermissionsNotifyPromptShownResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsNotifyPromptShownResult(success) @@ -3292,6 +3668,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsAddResult: @@ -3301,7 +3678,7 @@ class PermissionsPathsAddResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsPathsAddResult': + def from_dict(obj: Any) -> "PermissionsPathsAddResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsPathsAddResult(success) @@ -3311,12 +3688,14 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsListRequest: """No parameters; returns the session's allow-listed directories.""" + @staticmethod - def from_dict(obj: Any) -> 'PermissionsPathsListRequest': + def from_dict(obj: Any) -> "PermissionsPathsListRequest": assert isinstance(obj, dict) return PermissionsPathsListRequest() @@ -3324,6 +3703,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsUpdatePrimaryResult: @@ -3333,7 +3713,7 @@ class PermissionsPathsUpdatePrimaryResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsPathsUpdatePrimaryResult': + def from_dict(obj: Any) -> "PermissionsPathsUpdatePrimaryResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsPathsUpdatePrimaryResult(success) @@ -3343,12 +3723,14 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPendingRequestsRequest: """No parameters; returns currently-pending permission requests for the session.""" + @staticmethod - def from_dict(obj: Any) -> 'PermissionsPendingRequestsRequest': + def from_dict(obj: Any) -> "PermissionsPendingRequestsRequest": assert isinstance(obj, dict) return PermissionsPendingRequestsRequest() @@ -3356,12 +3738,14 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsResetSessionApprovalsRequest: """No parameters; clears all session-scoped tool permission approvals.""" + @staticmethod - def from_dict(obj: Any) -> 'PermissionsResetSessionApprovalsRequest': + def from_dict(obj: Any) -> "PermissionsResetSessionApprovalsRequest": assert isinstance(obj, dict) return PermissionsResetSessionApprovalsRequest() @@ -3369,6 +3753,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsResetSessionApprovalsResult: @@ -3378,7 +3763,7 @@ class PermissionsResetSessionApprovalsResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsResetSessionApprovalsResult': + def from_dict(obj: Any) -> "PermissionsResetSessionApprovalsResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsResetSessionApprovalsResult(success) @@ -3388,6 +3773,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetApproveAllResult: @@ -3397,7 +3783,7 @@ class PermissionsSetApproveAllResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsSetApproveAllResult': + def from_dict(obj: Any) -> "PermissionsSetApproveAllResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsSetApproveAllResult(success) @@ -3407,6 +3793,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredRequest: @@ -3419,7 +3806,7 @@ class PermissionsSetRequiredRequest: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionsSetRequiredRequest': + def from_dict(obj: Any) -> "PermissionsSetRequiredRequest": assert isinstance(obj, dict) required = from_bool(obj.get("required")) return PermissionsSetRequiredRequest(required) @@ -3429,6 +3816,7 @@ def to_dict(self) -> dict: result["required"] = from_bool(self.required) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredResult: @@ -3438,7 +3826,7 @@ class PermissionsSetRequiredResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsSetRequiredResult': + def from_dict(obj: Any) -> "PermissionsSetRequiredResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsSetRequiredResult(success) @@ -3448,6 +3836,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsUrlsSetUnrestrictedModeResult: @@ -3457,7 +3846,7 @@ class PermissionsUrlsSetUnrestrictedModeResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsUrlsSetUnrestrictedModeResult': + def from_dict(obj: Any) -> "PermissionsUrlsSetUnrestrictedModeResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsUrlsSetUnrestrictedModeResult(success) @@ -3467,6 +3856,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + @dataclass class PingRequest: """Optional message to echo back to the caller.""" @@ -3475,7 +3865,7 @@ class PingRequest: """Optional message to echo back""" @staticmethod - def from_dict(obj: Any) -> 'PingRequest': + def from_dict(obj: Any) -> "PingRequest": assert isinstance(obj, dict) message = from_union([from_str, from_none], obj.get("message")) return PingRequest(message) @@ -3486,11 +3876,13 @@ def to_dict(self) -> dict: result["message"] = from_union([from_str, from_none], self.message) return result + @dataclass class PingResult: """Server liveness response, including the echoed message, current server timestamp, and protocol version. """ + message: str """Echoed message (or default greeting)""" @@ -3501,7 +3893,7 @@ class PingResult: """ISO 8601 timestamp when the server handled the ping""" @staticmethod - def from_dict(obj: Any) -> 'PingResult': + def from_dict(obj: Any) -> "PingResult": assert isinstance(obj, dict) message = from_str(obj.get("message")) protocol_version = from_int(obj.get("protocolVersion")) @@ -3515,6 +3907,7 @@ def to_dict(self) -> dict: result["timestamp"] = self.timestamp.isoformat() return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanReadResult: @@ -3530,7 +3923,7 @@ class PlanReadResult: """Absolute file path of the plan file, or null if workspace is not enabled""" @staticmethod - def from_dict(obj: Any) -> 'PlanReadResult': + def from_dict(obj: Any) -> "PlanReadResult": assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) content = from_union([from_none, from_str], obj.get("content")) @@ -3544,6 +3937,7 @@ def to_dict(self) -> dict: result["path"] = from_union([from_none, from_str], self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanUpdateRequest: @@ -3553,7 +3947,7 @@ class PlanUpdateRequest: """The new content for the plan file""" @staticmethod - def from_dict(obj: Any) -> 'PlanUpdateRequest': + def from_dict(obj: Any) -> "PlanUpdateRequest": assert isinstance(obj, dict) content = from_str(obj.get("content")) return PlanUpdateRequest(content) @@ -3563,6 +3957,7 @@ def to_dict(self) -> dict: result["content"] = from_str(self.content) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Plugin: @@ -3581,7 +3976,7 @@ class Plugin: """Installed version""" @staticmethod - def from_dict(obj: Any) -> 'Plugin': + def from_dict(obj: Any) -> "Plugin": assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) marketplace = from_str(obj.get("marketplace")) @@ -3598,6 +3993,7 @@ def to_dict(self) -> dict: result["version"] = from_union([from_str, from_none], self.version) return result + # Experimental: this type is part of an experimental API and may change or be removed. class QueuePendingItemsKind(Enum): """Whether this item is a queued user message or a queued slash command / model change""" @@ -3605,6 +4001,7 @@ class QueuePendingItemsKind(Enum): COMMAND = "command" MESSAGE = "message" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueueRemoveMostRecentResult: @@ -3616,7 +4013,7 @@ class QueueRemoveMostRecentResult: """ @staticmethod - def from_dict(obj: Any) -> 'QueueRemoveMostRecentResult': + def from_dict(obj: Any) -> "QueueRemoveMostRecentResult": assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return QueueRemoveMostRecentResult(removed) @@ -3626,6 +4023,7 @@ def to_dict(self) -> dict: result["removed"] = from_bool(self.removed) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuedCommandHandled: @@ -3640,7 +4038,7 @@ class QueuedCommandHandled: """ @staticmethod - def from_dict(obj: Any) -> 'QueuedCommandHandled': + def from_dict(obj: Any) -> "QueuedCommandHandled": assert isinstance(obj, dict) stop_processing_queue = from_union([from_bool, from_none], obj.get("stopProcessingQueue")) return QueuedCommandHandled(stop_processing_queue) @@ -3649,9 +4047,12 @@ def to_dict(self) -> dict: result: dict = {} result["handled"] = self.handled if self.stop_processing_queue is not None: - result["stopProcessingQueue"] = from_union([from_bool, from_none], self.stop_processing_queue) + result["stopProcessingQueue"] = from_union( + [from_bool, from_none], self.stop_processing_queue + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuedCommandNotHandled: @@ -3663,7 +4064,7 @@ class QueuedCommandNotHandled: """ @staticmethod - def from_dict(obj: Any) -> 'QueuedCommandNotHandled': + def from_dict(obj: Any) -> "QueuedCommandNotHandled": assert isinstance(obj, dict) return QueuedCommandNotHandled() @@ -3672,6 +4073,7 @@ def to_dict(self) -> dict: result["handled"] = self.handled return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RegisterEventInterestParams: @@ -3694,7 +4096,7 @@ class RegisterEventInterestParams: """ @staticmethod - def from_dict(obj: Any) -> 'RegisterEventInterestParams': + def from_dict(obj: Any) -> "RegisterEventInterestParams": assert isinstance(obj, dict) event_type = from_str(obj.get("eventType")) return RegisterEventInterestParams(event_type) @@ -3704,6 +4106,7 @@ def to_dict(self) -> dict: result["eventType"] = from_str(self.event_type) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RegisterEventInterestResult: @@ -3716,7 +4119,7 @@ class RegisterEventInterestResult: """ @staticmethod - def from_dict(obj: Any) -> 'RegisterEventInterestResult': + def from_dict(obj: Any) -> "RegisterEventInterestResult": assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return RegisterEventInterestResult(handle) @@ -3726,6 +4129,7 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ReleaseEventInterestParams: @@ -3739,7 +4143,7 @@ class ReleaseEventInterestParams: """ @staticmethod - def from_dict(obj: Any) -> 'ReleaseEventInterestParams': + def from_dict(obj: Any) -> "ReleaseEventInterestParams": assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return ReleaseEventInterestParams(handle) @@ -3749,15 +4153,18 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result + # Experimental: this type is part of an experimental API and may change or be removed. class RemoteSessionMode(Enum): """Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. """ + EXPORT = "export" OFF = "off" ON = "on" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteEnableResult: @@ -3770,7 +4177,7 @@ class RemoteEnableResult: """GitHub frontend URL for this session""" @staticmethod - def from_dict(obj: Any) -> 'RemoteEnableResult': + def from_dict(obj: Any) -> "RemoteEnableResult": assert isinstance(obj, dict) remote_steerable = from_bool(obj.get("remoteSteerable")) url = from_union([from_str, from_none], obj.get("url")) @@ -3783,6 +4190,7 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteNotifySteerableChangedRequest: @@ -3795,7 +4203,7 @@ class RemoteNotifySteerableChangedRequest: """ @staticmethod - def from_dict(obj: Any) -> 'RemoteNotifySteerableChangedRequest': + def from_dict(obj: Any) -> "RemoteNotifySteerableChangedRequest": assert isinstance(obj, dict) remote_steerable = from_bool(obj.get("remoteSteerable")) return RemoteNotifySteerableChangedRequest(remote_steerable) @@ -3805,6 +4213,7 @@ def to_dict(self) -> dict: result["remoteSteerable"] = from_bool(self.remote_steerable) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteNotifySteerableChangedResult: @@ -3812,8 +4221,9 @@ class RemoteNotifySteerableChangedResult: host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. """ + @staticmethod - def from_dict(obj: Any) -> 'RemoteNotifySteerableChangedResult': + def from_dict(obj: Any) -> "RemoteNotifySteerableChangedResult": assert isinstance(obj, dict) return RemoteNotifySteerableChangedResult() @@ -3821,6 +4231,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleEntry: @@ -3828,6 +4239,7 @@ class ScheduleEntry: The removed entry, or omitted if no entry matched. """ + id: int """Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). @@ -3850,7 +4262,7 @@ class ScheduleEntry: """ @staticmethod - def from_dict(obj: Any) -> 'ScheduleEntry': + def from_dict(obj: Any) -> "ScheduleEntry": assert isinstance(obj, dict) id = from_int(obj.get("id")) interval_ms = from_int(obj.get("intervalMs")) @@ -3871,6 +4283,7 @@ def to_dict(self) -> dict: result["displayPrompt"] = from_union([from_str, from_none], self.display_prompt) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleStopRequest: @@ -3880,7 +4293,7 @@ class ScheduleStopRequest: """Id of the scheduled prompt to remove.""" @staticmethod - def from_dict(obj: Any) -> 'ScheduleStopRequest': + def from_dict(obj: Any) -> "ScheduleStopRequest": assert isinstance(obj, dict) id = from_int(obj.get("id")) return ScheduleStopRequest(id) @@ -3890,6 +4303,7 @@ def to_dict(self) -> dict: result["id"] = from_int(self.id) return result + @dataclass class SecretsAddFilterValuesRequest: """Secret values to add to the redaction filter.""" @@ -3898,7 +4312,7 @@ class SecretsAddFilterValuesRequest: """Raw secret values to register for redaction""" @staticmethod - def from_dict(obj: Any) -> 'SecretsAddFilterValuesRequest': + def from_dict(obj: Any) -> "SecretsAddFilterValuesRequest": assert isinstance(obj, dict) values = from_list(from_str, obj.get("values")) return SecretsAddFilterValuesRequest(values) @@ -3908,6 +4322,7 @@ def to_dict(self) -> dict: result["values"] = from_list(from_str, self.values) return result + @dataclass class SecretsAddFilterValuesResult: """Confirmation that the secret values were registered.""" @@ -3916,7 +4331,7 @@ class SecretsAddFilterValuesResult: """Whether the values were successfully registered""" @staticmethod - def from_dict(obj: Any) -> 'SecretsAddFilterValuesResult': + def from_dict(obj: Any) -> "SecretsAddFilterValuesResult": assert isinstance(obj, dict) ok = from_bool(obj.get("ok")) return SecretsAddFilterValuesResult(ok) @@ -3926,16 +4341,19 @@ def to_dict(self) -> dict: result["ok"] = from_bool(self.ok) return result + # Experimental: this type is part of an experimental API and may change or be removed. class SendAgentMode(Enum): """The UI mode the agent was in when this message was sent. Defaults to the session's current mode. """ + AUTOPILOT = "autopilot" INTERACTIVE = "interactive" PLAN = "plan" SHELL = "shell" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentFileLineRange: @@ -3948,7 +4366,7 @@ class SendAttachmentFileLineRange: """Start line number (1-based)""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentFileLineRange': + def from_dict(obj: Any) -> "SendAttachmentFileLineRange": assert isinstance(obj, dict) end = from_int(obj.get("end")) start = from_int(obj.get("start")) @@ -3960,6 +4378,7 @@ def to_dict(self) -> dict: result["start"] = from_int(self.start) return result + class SendAttachmentGithubReferenceTypeEnum(Enum): """Type of GitHub reference""" @@ -3967,6 +4386,7 @@ class SendAttachmentGithubReferenceTypeEnum(Enum): ISSUE = "issue" PR = "pr" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelectionDetailsEnd: @@ -3979,7 +4399,7 @@ class SendAttachmentSelectionDetailsEnd: """End line number (0-based)""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentSelectionDetailsEnd': + def from_dict(obj: Any) -> "SendAttachmentSelectionDetailsEnd": assert isinstance(obj, dict) character = from_int(obj.get("character")) line = from_int(obj.get("line")) @@ -3991,6 +4411,7 @@ def to_dict(self) -> dict: result["line"] = from_int(self.line) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelectionDetailsStart: @@ -4003,7 +4424,7 @@ class SendAttachmentSelectionDetailsStart: """Start line number (0-based)""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentSelectionDetailsStart': + def from_dict(obj: Any) -> "SendAttachmentSelectionDetailsStart": assert isinstance(obj, dict) character = from_int(obj.get("character")) line = from_int(obj.get("line")) @@ -4015,6 +4436,7 @@ def to_dict(self) -> dict: result["line"] = from_int(self.line) return result + class SendAttachmentType(Enum): BLOB = "blob" DIRECTORY = "directory" @@ -4022,27 +4444,34 @@ class SendAttachmentType(Enum): GITHUB_REFERENCE = "github_reference" SELECTION = "selection" + class SendAttachmentBlobType(Enum): BLOB = "blob" + class SendAttachmentFileType(Enum): FILE = "file" + # Experimental: this type is part of an experimental API and may change or be removed. class SendAttachmentGithubReferenceType(Enum): GITHUB_REFERENCE = "github_reference" + class SendAttachmentSelectionType(Enum): SELECTION = "selection" + # Experimental: this type is part of an experimental API and may change or be removed. class SendMode(Enum): """How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. """ + ENQUEUE = "enqueue" IMMEDIATE = "immediate" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendResult: @@ -4052,7 +4481,7 @@ class SendResult: """Unique identifier assigned to the message""" @staticmethod - def from_dict(obj: Any) -> 'SendResult': + def from_dict(obj: Any) -> "SendResult": assert isinstance(obj, dict) message_id = from_str(obj.get("messageId")) return SendResult(message_id) @@ -4062,6 +4491,7 @@ def to_dict(self) -> dict: result["messageId"] = from_str(self.message_id) return result + @dataclass class ServerSkill: """Schema for the `ServerSkill` type.""" @@ -4088,7 +4518,7 @@ class ServerSkill: """The project path this skill belongs to (only for project/inherited skills)""" @staticmethod - def from_dict(obj: Any) -> 'ServerSkill': + def from_dict(obj: Any) -> "ServerSkill": assert isinstance(obj, dict) description = from_str(obj.get("description")) enabled = from_bool(obj.get("enabled")) @@ -4112,6 +4542,7 @@ def to_dict(self) -> dict: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionBulkDeleteResult: @@ -4124,7 +4555,7 @@ class SessionBulkDeleteResult: """ @staticmethod - def from_dict(obj: Any) -> 'SessionBulkDeleteResult': + def from_dict(obj: Any) -> "SessionBulkDeleteResult": assert isinstance(obj, dict) freed_bytes = from_dict(from_int, obj.get("freedBytes")) return SessionBulkDeleteResult(freed_bytes) @@ -4134,11 +4565,13 @@ def to_dict(self) -> dict: result["freedBytes"] = from_dict(from_int, self.freed_bytes) return result + @dataclass class SessionFSAppendFileRequest: """File path, content to append, and optional mode for the client-provided session filesystem. """ + content: str """Content to append""" @@ -4152,7 +4585,7 @@ class SessionFSAppendFileRequest: """Optional POSIX-style mode for newly created files""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSAppendFileRequest': + def from_dict(obj: Any) -> "SessionFSAppendFileRequest": assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) @@ -4169,12 +4602,14 @@ def to_dict(self) -> dict: result["mode"] = from_union([from_int, from_none], self.mode) return result + class SessionFSErrorCode(Enum): """Error classification""" ENOENT = "ENOENT" UNKNOWN = "UNKNOWN" + @dataclass class SessionFSExistsRequest: """Path to test for existence in the client-provided session filesystem.""" @@ -4186,7 +4621,7 @@ class SessionFSExistsRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSExistsRequest': + def from_dict(obj: Any) -> "SessionFSExistsRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4198,6 +4633,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + @dataclass class SessionFSExistsResult: """Indicates whether the requested path exists in the client-provided session filesystem.""" @@ -4206,7 +4642,7 @@ class SessionFSExistsResult: """Whether the path exists""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSExistsResult': + def from_dict(obj: Any) -> "SessionFSExistsResult": assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) return SessionFSExistsResult(exists) @@ -4216,11 +4652,13 @@ def to_dict(self) -> dict: result["exists"] = from_bool(self.exists) return result + @dataclass class SessionFSMkdirRequest: """Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. """ + path: str """Path using SessionFs conventions""" @@ -4234,7 +4672,7 @@ class SessionFSMkdirRequest: """Create parent directories as needed""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSMkdirRequest': + def from_dict(obj: Any) -> "SessionFSMkdirRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4252,6 +4690,7 @@ def to_dict(self) -> dict: result["recursive"] = from_union([from_bool, from_none], self.recursive) return result + @dataclass class SessionFSReadFileRequest: """Path of the file to read from the client-provided session filesystem.""" @@ -4263,7 +4702,7 @@ class SessionFSReadFileRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReadFileRequest': + def from_dict(obj: Any) -> "SessionFSReadFileRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4275,6 +4714,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + @dataclass class SessionFSReaddirRequest: """Directory path whose entries should be listed from the client-provided session filesystem.""" @@ -4286,7 +4726,7 @@ class SessionFSReaddirRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReaddirRequest': + def from_dict(obj: Any) -> "SessionFSReaddirRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4298,17 +4738,20 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + class SessionFSReaddirWithTypesEntryType(Enum): """Entry type""" DIRECTORY = "directory" FILE = "file" + @dataclass class SessionFSReaddirWithTypesRequest: """Directory path whose entries (with type information) should be listed from the client-provided session filesystem. """ + path: str """Path using SessionFs conventions""" @@ -4316,7 +4759,7 @@ class SessionFSReaddirWithTypesRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesRequest': + def from_dict(obj: Any) -> "SessionFSReaddirWithTypesRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4328,11 +4771,13 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + @dataclass class SessionFSRenameRequest: """Source and destination paths for renaming or moving an entry in the client-provided session filesystem. """ + dest: str """Destination path using SessionFs conventions""" @@ -4343,7 +4788,7 @@ class SessionFSRenameRequest: """Source path using SessionFs conventions""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSRenameRequest': + def from_dict(obj: Any) -> "SessionFSRenameRequest": assert isinstance(obj, dict) dest = from_str(obj.get("dest")) session_id = from_str(obj.get("sessionId")) @@ -4357,11 +4802,13 @@ def to_dict(self) -> dict: result["src"] = from_str(self.src) return result + @dataclass class SessionFSRmRequest: """Path to remove from the client-provided session filesystem, with options for recursive removal and force. """ + path: str """Path using SessionFs conventions""" @@ -4375,7 +4822,7 @@ class SessionFSRmRequest: """Remove directories and their contents recursively""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSRmRequest': + def from_dict(obj: Any) -> "SessionFSRmRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4393,6 +4840,7 @@ def to_dict(self) -> dict: result["recursive"] = from_union([from_bool, from_none], self.recursive) return result + @dataclass class SessionFSSetProviderCapabilities: """Optional capabilities declared by the provider""" @@ -4401,7 +4849,7 @@ class SessionFSSetProviderCapabilities: """Whether the provider supports SQLite query/exists operations""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSetProviderCapabilities': + def from_dict(obj: Any) -> "SessionFSSetProviderCapabilities": assert isinstance(obj, dict) sqlite = from_union([from_bool, from_none], obj.get("sqlite")) return SessionFSSetProviderCapabilities(sqlite) @@ -4412,12 +4860,14 @@ def to_dict(self) -> dict: result["sqlite"] = from_union([from_bool, from_none], self.sqlite) return result + class SessionFSSetProviderConventions(Enum): """Path conventions used by this filesystem""" POSIX = "posix" WINDOWS = "windows" + @dataclass class SessionFSSetProviderResult: """Indicates whether the calling client was registered as the session filesystem provider.""" @@ -4426,7 +4876,7 @@ class SessionFSSetProviderResult: """Whether the provider was set successfully""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSetProviderResult': + def from_dict(obj: Any) -> "SessionFSSetProviderResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionFSSetProviderResult(success) @@ -4436,6 +4886,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + @dataclass class SessionFSSqliteExistsRequest: """Identifies the target session.""" @@ -4444,7 +4895,7 @@ class SessionFSSqliteExistsRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSqliteExistsRequest': + def from_dict(obj: Any) -> "SessionFSSqliteExistsRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionFSSqliteExistsRequest(session_id) @@ -4454,6 +4905,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + @dataclass class SessionFSSqliteExistsResult: """Indicates whether the per-session SQLite database already exists.""" @@ -4462,7 +4914,7 @@ class SessionFSSqliteExistsResult: """Whether the session database already exists""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSqliteExistsResult': + def from_dict(obj: Any) -> "SessionFSSqliteExistsResult": assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) return SessionFSSqliteExistsResult(exists) @@ -4472,14 +4924,17 @@ def to_dict(self) -> dict: result["exists"] = from_bool(self.exists) return result + class SessionFSSqliteQueryType(Enum): """How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) """ + EXEC = "exec" QUERY = "query" RUN = "run" + @dataclass class SessionFSStatRequest: """Path whose metadata should be returned from the client-provided session filesystem.""" @@ -4491,7 +4946,7 @@ class SessionFSStatRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSStatRequest': + def from_dict(obj: Any) -> "SessionFSStatRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4503,6 +4958,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + @dataclass class SessionFSWriteFileRequest: """File path, content to write, and optional mode for the client-provided session filesystem.""" @@ -4520,7 +4976,7 @@ class SessionFSWriteFileRequest: """Optional POSIX-style mode for newly created files""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSWriteFileRequest': + def from_dict(obj: Any) -> "SessionFSWriteFileRequest": assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) @@ -4537,6 +4993,7 @@ def to_dict(self) -> dict: result["mode"] = from_union([from_int, from_none], self.mode) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionListFilter: @@ -4555,7 +5012,7 @@ class SessionListFilter: """Match sessions whose context.repository equals this value""" @staticmethod - def from_dict(obj: Any) -> 'SessionListFilter': + def from_dict(obj: Any) -> "SessionListFilter": assert isinstance(obj, dict) branch = from_union([from_str, from_none], obj.get("branch")) cwd = from_union([from_str, from_none], obj.get("cwd")) @@ -4575,6 +5032,7 @@ def to_dict(self) -> dict: result["repository"] = from_union([from_str, from_none], self.repository) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionLoadDeferredRepoHooksResult: @@ -4590,7 +5048,7 @@ class SessionLoadDeferredRepoHooksResult: """ @staticmethod - def from_dict(obj: Any) -> 'SessionLoadDeferredRepoHooksResult': + def from_dict(obj: Any) -> "SessionLoadDeferredRepoHooksResult": assert isinstance(obj, dict) hook_count = from_int(obj.get("hookCount")) startup_prompts = from_list(from_str, obj.get("startupPrompts")) @@ -4602,12 +5060,14 @@ def to_dict(self) -> dict: result["startupPrompts"] = from_list(from_str, self.startup_prompts) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionPruneResult: """Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. """ + candidates: list[str] """Session IDs that would be deleted in dry-run mode (always empty otherwise)""" @@ -4624,7 +5084,7 @@ class SessionPruneResult: """Session IDs that were skipped (e.g., named sessions)""" @staticmethod - def from_dict(obj: Any) -> 'SessionPruneResult': + def from_dict(obj: Any) -> "SessionPruneResult": assert isinstance(obj, dict) candidates = from_list(from_str, obj.get("candidates")) deleted = from_list(from_str, obj.get("deleted")) @@ -4642,6 +5102,7 @@ def to_dict(self) -> dict: result["skipped"] = from_list(from_str, self.skipped) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSetCredentialsParams: @@ -4656,7 +5117,7 @@ class SessionSetCredentialsParams: """ @staticmethod - def from_dict(obj: Any) -> 'SessionSetCredentialsParams': + def from_dict(obj: Any) -> "SessionSetCredentialsParams": assert isinstance(obj, dict) credentials = from_union([_load_AuthInfo, from_none], obj.get("credentials")) return SessionSetCredentialsParams(credentials) @@ -4664,9 +5125,12 @@ def from_dict(obj: Any) -> 'SessionSetCredentialsParams': def to_dict(self) -> dict: result: dict = {} if self.credentials is not None: - result["credentials"] = from_union([lambda x: (x).to_dict(), from_none], self.credentials) + result["credentials"] = from_union( + [lambda x: (x).to_dict(), from_none], self.credentials + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSetCredentialsResult: @@ -4676,7 +5140,7 @@ class SessionSetCredentialsResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'SessionSetCredentialsResult': + def from_dict(obj: Any) -> "SessionSetCredentialsResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionSetCredentialsResult(success) @@ -4686,6 +5150,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSizes: @@ -4695,7 +5160,7 @@ class SessionSizes: """Map of sessionId -> on-disk size in bytes for the session's workspace directory""" @staticmethod - def from_dict(obj: Any) -> 'SessionSizes': + def from_dict(obj: Any) -> "SessionSizes": assert isinstance(obj, dict) sizes = from_dict(from_int, obj.get("sizes")) return SessionSizes(sizes) @@ -4705,6 +5170,7 @@ def to_dict(self) -> dict: result["sizes"] = from_dict(from_int, self.sizes) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionUpdateOptionsResult: @@ -4714,7 +5180,7 @@ class SessionUpdateOptionsResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> 'SessionUpdateOptionsResult': + def from_dict(obj: Any) -> "SessionUpdateOptionsResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionUpdateOptionsResult(success) @@ -4724,6 +5190,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsBulkDeleteRequest: @@ -4733,7 +5200,7 @@ class SessionsBulkDeleteRequest: """Session IDs to close, deactivate, and delete from disk""" @staticmethod - def from_dict(obj: Any) -> 'SessionsBulkDeleteRequest': + def from_dict(obj: Any) -> "SessionsBulkDeleteRequest": assert isinstance(obj, dict) session_ids = from_list(from_str, obj.get("sessionIds")) return SessionsBulkDeleteRequest(session_ids) @@ -4743,6 +5210,7 @@ def to_dict(self) -> dict: result["sessionIds"] = from_list(from_str, self.session_ids) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCheckInUseRequest: @@ -4752,7 +5220,7 @@ class SessionsCheckInUseRequest: """Session IDs to test for live in-use locks""" @staticmethod - def from_dict(obj: Any) -> 'SessionsCheckInUseRequest': + def from_dict(obj: Any) -> "SessionsCheckInUseRequest": assert isinstance(obj, dict) session_ids = from_list(from_str, obj.get("sessionIds")) return SessionsCheckInUseRequest(session_ids) @@ -4762,6 +5230,7 @@ def to_dict(self) -> dict: result["sessionIds"] = from_list(from_str, self.session_ids) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCheckInUseResult: @@ -4773,7 +5242,7 @@ class SessionsCheckInUseResult: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsCheckInUseResult': + def from_dict(obj: Any) -> "SessionsCheckInUseResult": assert isinstance(obj, dict) in_use = from_list(from_str, obj.get("inUse")) return SessionsCheckInUseResult(in_use) @@ -4783,6 +5252,7 @@ def to_dict(self) -> dict: result["inUse"] = from_list(from_str, self.in_use) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCloseRequest: @@ -4792,7 +5262,7 @@ class SessionsCloseRequest: """Session ID to close""" @staticmethod - def from_dict(obj: Any) -> 'SessionsCloseRequest': + def from_dict(obj: Any) -> "SessionsCloseRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsCloseRequest(session_id) @@ -4802,6 +5272,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCloseResult: @@ -4809,8 +5280,9 @@ class SessionsCloseResult: lock, disposes the active session. Idempotent: succeeds even if the session is not currently active. """ + @staticmethod - def from_dict(obj: Any) -> 'SessionsCloseResult': + def from_dict(obj: Any) -> "SessionsCloseResult": assert isinstance(obj, dict) return SessionsCloseResult() @@ -4818,6 +5290,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByPrefixRequest: @@ -4829,7 +5302,7 @@ class SessionsFindByPrefixRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsFindByPrefixRequest': + def from_dict(obj: Any) -> "SessionsFindByPrefixRequest": assert isinstance(obj, dict) prefix = from_str(obj.get("prefix")) return SessionsFindByPrefixRequest(prefix) @@ -4839,6 +5312,7 @@ def to_dict(self) -> dict: result["prefix"] = from_str(self.prefix) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByPrefixResult: @@ -4848,7 +5322,7 @@ class SessionsFindByPrefixResult: """Omitted when no unique session matches the prefix (no match or ambiguous)""" @staticmethod - def from_dict(obj: Any) -> 'SessionsFindByPrefixResult': + def from_dict(obj: Any) -> "SessionsFindByPrefixResult": assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsFindByPrefixResult(session_id) @@ -4859,6 +5333,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByTaskIDRequest: @@ -4868,7 +5343,7 @@ class SessionsFindByTaskIDRequest: """GitHub task ID to look up""" @staticmethod - def from_dict(obj: Any) -> 'SessionsFindByTaskIDRequest': + def from_dict(obj: Any) -> "SessionsFindByTaskIDRequest": assert isinstance(obj, dict) task_id = from_str(obj.get("taskId")) return SessionsFindByTaskIDRequest(task_id) @@ -4878,6 +5353,7 @@ def to_dict(self) -> dict: result["taskId"] = from_str(self.task_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByTaskIDResult: @@ -4887,7 +5363,7 @@ class SessionsFindByTaskIDResult: """Omitted when no local session is bound to that GitHub task""" @staticmethod - def from_dict(obj: Any) -> 'SessionsFindByTaskIDResult': + def from_dict(obj: Any) -> "SessionsFindByTaskIDResult": assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsFindByTaskIDResult(session_id) @@ -4898,12 +5374,14 @@ def to_dict(self) -> dict: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsForkRequest: """Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. """ + session_id: str """Source session ID to fork from""" @@ -4916,7 +5394,7 @@ class SessionsForkRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsForkRequest': + def from_dict(obj: Any) -> "SessionsForkRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) name = from_union([from_str, from_none], obj.get("name")) @@ -4932,6 +5410,7 @@ def to_dict(self) -> dict: result["toEventId"] = from_union([from_str, from_none], self.to_event_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsForkResult: @@ -4944,7 +5423,7 @@ class SessionsForkResult: """Friendly name assigned to the forked session, if any.""" @staticmethod - def from_dict(obj: Any) -> 'SessionsForkResult': + def from_dict(obj: Any) -> "SessionsForkResult": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) name = from_union([from_str, from_none], obj.get("name")) @@ -4957,6 +5436,7 @@ def to_dict(self) -> dict: result["name"] = from_union([from_str, from_none], self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetEventFilePathRequest: @@ -4966,7 +5446,7 @@ class SessionsGetEventFilePathRequest: """Session ID whose event-log file path to compute""" @staticmethod - def from_dict(obj: Any) -> 'SessionsGetEventFilePathRequest': + def from_dict(obj: Any) -> "SessionsGetEventFilePathRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetEventFilePathRequest(session_id) @@ -4976,6 +5456,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetEventFilePathResult: @@ -4985,7 +5466,7 @@ class SessionsGetEventFilePathResult: """Absolute path to the session's events.jsonl file""" @staticmethod - def from_dict(obj: Any) -> 'SessionsGetEventFilePathResult': + def from_dict(obj: Any) -> "SessionsGetEventFilePathResult": assert isinstance(obj, dict) file_path = from_str(obj.get("filePath")) return SessionsGetEventFilePathResult(file_path) @@ -4995,6 +5476,7 @@ def to_dict(self) -> dict: result["filePath"] = from_str(self.file_path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetLastForContextResult: @@ -5004,7 +5486,7 @@ class SessionsGetLastForContextResult: """Most-relevant session ID for the supplied context, or omitted when no sessions exist""" @staticmethod - def from_dict(obj: Any) -> 'SessionsGetLastForContextResult': + def from_dict(obj: Any) -> "SessionsGetLastForContextResult": assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsGetLastForContextResult(session_id) @@ -5015,6 +5497,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetPersistedRemoteSteerableRequest: @@ -5024,7 +5507,7 @@ class SessionsGetPersistedRemoteSteerableRequest: """Session ID to look up the persisted remote-steerable flag for""" @staticmethod - def from_dict(obj: Any) -> 'SessionsGetPersistedRemoteSteerableRequest': + def from_dict(obj: Any) -> "SessionsGetPersistedRemoteSteerableRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetPersistedRemoteSteerableRequest(session_id) @@ -5034,19 +5517,21 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetPersistedRemoteSteerableResult: """The session's persisted remote-steerable flag, or omitted when no value has been persisted. """ + remote_steerable: bool | None = None """The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted """ @staticmethod - def from_dict(obj: Any) -> 'SessionsGetPersistedRemoteSteerableResult': + def from_dict(obj: Any) -> "SessionsGetPersistedRemoteSteerableResult": assert isinstance(obj, dict) remote_steerable = from_union([from_bool, from_none], obj.get("remoteSteerable")) return SessionsGetPersistedRemoteSteerableResult(remote_steerable) @@ -5057,6 +5542,7 @@ def to_dict(self) -> dict: result["remoteSteerable"] = from_union([from_bool, from_none], self.remote_steerable) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsLoadDeferredRepoHooksRequest: @@ -5066,7 +5552,7 @@ class SessionsLoadDeferredRepoHooksRequest: """Active session ID whose deferred repo-level hooks should be loaded""" @staticmethod - def from_dict(obj: Any) -> 'SessionsLoadDeferredRepoHooksRequest': + def from_dict(obj: Any) -> "SessionsLoadDeferredRepoHooksRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsLoadDeferredRepoHooksRequest(session_id) @@ -5076,12 +5562,14 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsPruneOldRequest: """Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). """ + older_than_days: int """Delete sessions whose modifiedTime is at least this many days old""" @@ -5095,11 +5583,13 @@ class SessionsPruneOldRequest: """When true, named sessions (set via /rename) are also eligible for pruning""" @staticmethod - def from_dict(obj: Any) -> 'SessionsPruneOldRequest': + def from_dict(obj: Any) -> "SessionsPruneOldRequest": assert isinstance(obj, dict) older_than_days = from_int(obj.get("olderThanDays")) dry_run = from_union([from_bool, from_none], obj.get("dryRun")) - exclude_session_ids = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludeSessionIds")) + exclude_session_ids = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("excludeSessionIds") + ) include_named = from_union([from_bool, from_none], obj.get("includeNamed")) return SessionsPruneOldRequest(older_than_days, dry_run, exclude_session_ids, include_named) @@ -5109,11 +5599,14 @@ def to_dict(self) -> dict: if self.dry_run is not None: result["dryRun"] = from_union([from_bool, from_none], self.dry_run) if self.exclude_session_ids is not None: - result["excludeSessionIds"] = from_union([lambda x: from_list(from_str, x), from_none], self.exclude_session_ids) + result["excludeSessionIds"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.exclude_session_ids + ) if self.include_named is not None: result["includeNamed"] = from_union([from_bool, from_none], self.include_named) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReleaseLockRequest: @@ -5123,7 +5616,7 @@ class SessionsReleaseLockRequest: """Session ID whose in-use lock should be released""" @staticmethod - def from_dict(obj: Any) -> 'SessionsReleaseLockRequest': + def from_dict(obj: Any) -> "SessionsReleaseLockRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsReleaseLockRequest(session_id) @@ -5133,14 +5626,16 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReleaseLockResult: """Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session. """ + @staticmethod - def from_dict(obj: Any) -> 'SessionsReleaseLockResult': + def from_dict(obj: Any) -> "SessionsReleaseLockResult": assert isinstance(obj, dict) return SessionsReleaseLockResult() @@ -5148,6 +5643,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReloadPluginHooksRequest: @@ -5162,7 +5658,7 @@ class SessionsReloadPluginHooksRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsReloadPluginHooksRequest': + def from_dict(obj: Any) -> "SessionsReloadPluginHooksRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) defer_repo_hooks = from_union([from_bool, from_none], obj.get("deferRepoHooks")) @@ -5175,6 +5671,7 @@ def to_dict(self) -> dict: result["deferRepoHooks"] = from_union([from_bool, from_none], self.defer_repo_hooks) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReloadPluginHooksResult: @@ -5182,8 +5679,9 @@ class SessionsReloadPluginHooksResult: Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId. """ + @staticmethod - def from_dict(obj: Any) -> 'SessionsReloadPluginHooksResult': + def from_dict(obj: Any) -> "SessionsReloadPluginHooksResult": assert isinstance(obj, dict) return SessionsReloadPluginHooksResult() @@ -5191,6 +5689,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSaveRequest: @@ -5200,7 +5699,7 @@ class SessionsSaveRequest: """Session ID whose pending events should be flushed to disk""" @staticmethod - def from_dict(obj: Any) -> 'SessionsSaveRequest': + def from_dict(obj: Any) -> "SessionsSaveRequest": assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsSaveRequest(session_id) @@ -5210,14 +5709,16 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSaveResult: """Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). """ + @staticmethod - def from_dict(obj: Any) -> 'SessionsSaveResult': + def from_dict(obj: Any) -> "SessionsSaveResult": assert isinstance(obj, dict) return SessionsSaveResult() @@ -5225,6 +5726,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetAdditionalPluginsResult: @@ -5232,8 +5734,9 @@ class SessionsSetAdditionalPluginsResult: reloads see the new set; already-running sessions keep their existing hook installation until the next reload. """ + @staticmethod - def from_dict(obj: Any) -> 'SessionsSetAdditionalPluginsResult': + def from_dict(obj: Any) -> "SessionsSetAdditionalPluginsResult": assert isinstance(obj, dict) return SessionsSetAdditionalPluginsResult() @@ -5241,6 +5744,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecRequest: @@ -5256,7 +5760,7 @@ class ShellExecRequest: """Timeout in milliseconds (default: 30000)""" @staticmethod - def from_dict(obj: Any) -> 'ShellExecRequest': + def from_dict(obj: Any) -> "ShellExecRequest": assert isinstance(obj, dict) command = from_str(obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) @@ -5272,17 +5776,19 @@ def to_dict(self) -> dict: result["timeout"] = from_union([from_int, from_none], self.timeout) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecResult: """Identifier of the spawned process, used to correlate streamed output and exit notifications. """ + process_id: str """Unique identifier for tracking streamed output""" @staticmethod - def from_dict(obj: Any) -> 'ShellExecResult': + def from_dict(obj: Any) -> "ShellExecResult": assert isinstance(obj, dict) process_id = from_str(obj.get("processId")) return ShellExecResult(process_id) @@ -5292,6 +5798,7 @@ def to_dict(self) -> dict: result["processId"] = from_str(self.process_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. class ShellKillSignal(Enum): """Signal to send (default: SIGTERM)""" @@ -5300,17 +5807,19 @@ class ShellKillSignal(Enum): SIGKILL = "SIGKILL" SIGTERM = "SIGTERM" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellKillResult: """Indicates whether the signal was delivered; false if the process was unknown or already exited. """ + killed: bool """Whether the signal was sent successfully""" @staticmethod - def from_dict(obj: Any) -> 'ShellKillResult': + def from_dict(obj: Any) -> "ShellKillResult": assert isinstance(obj, dict) killed = from_bool(obj.get("killed")) return ShellKillResult(killed) @@ -5320,6 +5829,7 @@ def to_dict(self) -> dict: result["killed"] = from_bool(self.killed) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShutdownRequest: @@ -5333,7 +5843,7 @@ class ShutdownRequest: """Why the session is being shut down. Defaults to "routine" when omitted.""" @staticmethod - def from_dict(obj: Any) -> 'ShutdownRequest': + def from_dict(obj: Any) -> "ShutdownRequest": assert isinstance(obj, dict) reason = from_union([from_str, from_none], obj.get("reason")) type = from_union([ShutdownType, from_none], obj.get("type")) @@ -5347,6 +5857,7 @@ def to_dict(self) -> dict: result["type"] = from_union([lambda x: to_enum(ShutdownType, x), from_none], self.type) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Skill: @@ -5374,7 +5885,7 @@ class Skill: """Name of the plugin that provides the skill, when source is 'plugin'""" @staticmethod - def from_dict(obj: Any) -> 'Skill': + def from_dict(obj: Any) -> "Skill": assert isinstance(obj, dict) description = from_str(obj.get("description")) enabled = from_bool(obj.get("enabled")) @@ -5398,6 +5909,7 @@ def to_dict(self) -> dict: result["pluginName"] = from_union([from_str, from_none], self.plugin_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsDisableRequest: @@ -5407,7 +5919,7 @@ class SkillsDisableRequest: """Name of the skill to disable""" @staticmethod - def from_dict(obj: Any) -> 'SkillsDisableRequest': + def from_dict(obj: Any) -> "SkillsDisableRequest": assert isinstance(obj, dict) name = from_str(obj.get("name")) return SkillsDisableRequest(name) @@ -5417,6 +5929,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + @dataclass class SkillsDiscoverRequest: """Optional project paths and additional skill directories to include in discovery.""" @@ -5428,20 +5941,29 @@ class SkillsDiscoverRequest: """Optional list of additional skill directory paths to include""" @staticmethod - def from_dict(obj: Any) -> 'SkillsDiscoverRequest': + def from_dict(obj: Any) -> "SkillsDiscoverRequest": assert isinstance(obj, dict) - project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) - skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) + project_paths = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("projectPaths") + ) + skill_directories = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories") + ) return SkillsDiscoverRequest(project_paths, skill_directories) def to_dict(self) -> dict: result: dict = {} if self.project_paths is not None: - result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) + result["projectPaths"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.project_paths + ) if self.skill_directories is not None: - result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) + result["skillDirectories"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.skill_directories + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsEnableRequest: @@ -5451,7 +5973,7 @@ class SkillsEnableRequest: """Name of the skill to enable""" @staticmethod - def from_dict(obj: Any) -> 'SkillsEnableRequest': + def from_dict(obj: Any) -> "SkillsEnableRequest": assert isinstance(obj, dict) name = from_str(obj.get("name")) return SkillsEnableRequest(name) @@ -5461,6 +5983,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsInvokedSkill: @@ -5482,13 +6005,15 @@ class SkillsInvokedSkill: """Tools that should be auto-approved when this skill is active, captured at invocation time""" @staticmethod - def from_dict(obj: Any) -> 'SkillsInvokedSkill': + def from_dict(obj: Any) -> "SkillsInvokedSkill": assert isinstance(obj, dict) content = from_str(obj.get("content")) invoked_at_turn = from_int(obj.get("invokedAtTurn")) name = from_str(obj.get("name")) path = from_str(obj.get("path")) - allowed_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("allowedTools")) + allowed_tools = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("allowedTools") + ) return SkillsInvokedSkill(content, invoked_at_turn, name, path, allowed_tools) def to_dict(self) -> dict: @@ -5498,9 +6023,12 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) result["path"] = from_str(self.path) if self.allowed_tools is not None: - result["allowedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.allowed_tools) + result["allowedTools"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.allowed_tools + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsLoadDiagnostics: @@ -5513,7 +6041,7 @@ class SkillsLoadDiagnostics: """Warnings emitted while loading skills (e.g. skills that loaded but had issues)""" @staticmethod - def from_dict(obj: Any) -> 'SkillsLoadDiagnostics': + def from_dict(obj: Any) -> "SkillsLoadDiagnostics": assert isinstance(obj, dict) errors = from_list(from_str, obj.get("errors")) warnings = from_list(from_str, obj.get("warnings")) @@ -5525,18 +6053,22 @@ def to_dict(self) -> dict: result["warnings"] = from_list(from_str, self.warnings) return result + class SlashCommandAgentPromptResultKind(Enum): AGENT_PROMPT = "agent-prompt" + class SlashCommandCompletedResultKind(Enum): COMPLETED = "completed" + class SlashCommandInvocationResultKind(Enum): AGENT_PROMPT = "agent-prompt" COMPLETED = "completed" SELECT_SUBCOMMAND = "select-subcommand" TEXT = "text" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandSelectSubcommandOption: @@ -5552,7 +6084,7 @@ class SlashCommandSelectSubcommandOption: """Optional group label for organizing options""" @staticmethod - def from_dict(obj: Any) -> 'SlashCommandSelectSubcommandOption': + def from_dict(obj: Any) -> "SlashCommandSelectSubcommandOption": assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) @@ -5567,9 +6099,11 @@ def to_dict(self) -> dict: result["group"] = from_union([from_str, from_none], self.group) return result + class SlashCommandSelectSubcommandResultKind(Enum): SELECT_SUBCOMMAND = "select-subcommand" + # Experimental: this type is part of an experimental API and may change or be removed. class TaskExecutionMode(Enum): """Whether task execution is synchronously awaited or managed in the background""" @@ -5577,6 +6111,7 @@ class TaskExecutionMode(Enum): BACKGROUND = "background" SYNC = "sync" + # Experimental: this type is part of an experimental API and may change or be removed. class TaskStatus(Enum): """Current lifecycle status of the task""" @@ -5587,9 +6122,11 @@ class TaskStatus(Enum): IDLE = "idle" RUNNING = "running" + class TaskAgentInfoType(Enum): AGENT = "agent" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskProgressLine: @@ -5602,7 +6139,7 @@ class TaskProgressLine: """ISO 8601 timestamp when this event occurred""" @staticmethod - def from_dict(obj: Any) -> 'TaskProgressLine': + def from_dict(obj: Any) -> "TaskProgressLine": assert isinstance(obj, dict) message = from_str(obj.get("message")) timestamp = from_datetime(obj.get("timestamp")) @@ -5614,18 +6151,22 @@ def to_dict(self) -> dict: result["timestamp"] = self.timestamp.isoformat() return result + # Experimental: this type is part of an experimental API and may change or be removed. class TaskShellInfoAttachmentMode(Enum): """Whether the shell runs inside a managed PTY session or as an independent background process """ + ATTACHED = "attached" DETACHED = "detached" + class TaskInfoType(Enum): AGENT = "agent" SHELL = "shell" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskList: @@ -5635,7 +6176,7 @@ class TaskList: """Currently tracked tasks""" @staticmethod - def from_dict(obj: Any) -> 'TaskList': + def from_dict(obj: Any) -> "TaskList": assert isinstance(obj, dict) tasks = from_list(_load_TaskInfo, obj.get("tasks")) return TaskList(tasks) @@ -5645,9 +6186,11 @@ def to_dict(self) -> dict: result["tasks"] = from_list(lambda x: (x).to_dict(), self.tasks) return result + class TaskShellInfoType(Enum): SHELL = "shell" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksCancelRequest: @@ -5657,7 +6200,7 @@ class TasksCancelRequest: """Task identifier""" @staticmethod - def from_dict(obj: Any) -> 'TasksCancelRequest': + def from_dict(obj: Any) -> "TasksCancelRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksCancelRequest(id) @@ -5667,6 +6210,7 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksCancelResult: @@ -5676,7 +6220,7 @@ class TasksCancelResult: """Whether the task was successfully cancelled""" @staticmethod - def from_dict(obj: Any) -> 'TasksCancelResult': + def from_dict(obj: Any) -> "TasksCancelResult": assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return TasksCancelResult(cancelled) @@ -5686,6 +6230,7 @@ def to_dict(self) -> dict: result["cancelled"] = from_bool(self.cancelled) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetCurrentPromotableResult: @@ -5698,7 +6243,7 @@ class TasksGetCurrentPromotableResult: """ @staticmethod - def from_dict(obj: Any) -> 'TasksGetCurrentPromotableResult': + def from_dict(obj: Any) -> "TasksGetCurrentPromotableResult": assert isinstance(obj, dict) task = from_union([_load_TaskInfo, from_none], obj.get("task")) return TasksGetCurrentPromotableResult(task) @@ -5709,6 +6254,7 @@ def to_dict(self) -> dict: result["task"] = from_union([lambda x: (x).to_dict(), from_none], self.task) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetProgressRequest: @@ -5718,7 +6264,7 @@ class TasksGetProgressRequest: """Task identifier (agent ID or shell ID)""" @staticmethod - def from_dict(obj: Any) -> 'TasksGetProgressRequest': + def from_dict(obj: Any) -> "TasksGetProgressRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksGetProgressRequest(id) @@ -5728,12 +6274,14 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteCurrentToBackgroundResult: """The promoted task as it now exists in background mode, omitted if no promotable task was waiting. """ + task: TaskInfo | None = None """The promoted task as it now exists in background mode, omitted if no promotable task was waiting. Atomic operation: avoids the race window of getCurrentPromotable + @@ -5741,7 +6289,7 @@ class TasksPromoteCurrentToBackgroundResult: """ @staticmethod - def from_dict(obj: Any) -> 'TasksPromoteCurrentToBackgroundResult': + def from_dict(obj: Any) -> "TasksPromoteCurrentToBackgroundResult": assert isinstance(obj, dict) task = from_union([_load_TaskInfo, from_none], obj.get("task")) return TasksPromoteCurrentToBackgroundResult(task) @@ -5752,6 +6300,7 @@ def to_dict(self) -> dict: result["task"] = from_union([lambda x: (x).to_dict(), from_none], self.task) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteToBackgroundRequest: @@ -5761,7 +6310,7 @@ class TasksPromoteToBackgroundRequest: """Task identifier""" @staticmethod - def from_dict(obj: Any) -> 'TasksPromoteToBackgroundRequest': + def from_dict(obj: Any) -> "TasksPromoteToBackgroundRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksPromoteToBackgroundRequest(id) @@ -5771,6 +6320,7 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteToBackgroundResult: @@ -5780,7 +6330,7 @@ class TasksPromoteToBackgroundResult: """Whether the task was successfully promoted to background mode""" @staticmethod - def from_dict(obj: Any) -> 'TasksPromoteToBackgroundResult': + def from_dict(obj: Any) -> "TasksPromoteToBackgroundResult": assert isinstance(obj, dict) promoted = from_bool(obj.get("promoted")) return TasksPromoteToBackgroundResult(promoted) @@ -5790,14 +6340,16 @@ def to_dict(self) -> dict: result["promoted"] = from_bool(self.promoted) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRefreshResult: """Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop. """ + @staticmethod - def from_dict(obj: Any) -> 'TasksRefreshResult': + def from_dict(obj: Any) -> "TasksRefreshResult": assert isinstance(obj, dict) return TasksRefreshResult() @@ -5805,6 +6357,7 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRemoveRequest: @@ -5814,7 +6367,7 @@ class TasksRemoveRequest: """Task identifier""" @staticmethod - def from_dict(obj: Any) -> 'TasksRemoveRequest': + def from_dict(obj: Any) -> "TasksRemoveRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksRemoveRequest(id) @@ -5824,19 +6377,21 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRemoveResult: """Indicates whether the task was removed. False when the task does not exist or is still running/idle. """ + removed: bool """Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). """ @staticmethod - def from_dict(obj: Any) -> 'TasksRemoveResult': + def from_dict(obj: Any) -> "TasksRemoveResult": assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return TasksRemoveResult(removed) @@ -5846,6 +6401,7 @@ def to_dict(self) -> dict: result["removed"] = from_bool(self.removed) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksSendMessageRequest: @@ -5861,7 +6417,7 @@ class TasksSendMessageRequest: """Agent ID of the sender, if sent on behalf of another agent""" @staticmethod - def from_dict(obj: Any) -> 'TasksSendMessageRequest': + def from_dict(obj: Any) -> "TasksSendMessageRequest": assert isinstance(obj, dict) id = from_str(obj.get("id")) message = from_str(obj.get("message")) @@ -5876,6 +6432,7 @@ def to_dict(self) -> dict: result["fromAgentId"] = from_union([from_str, from_none], self.from_agent_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksSendMessageResult: @@ -5888,7 +6445,7 @@ class TasksSendMessageResult: """Error message if delivery failed""" @staticmethod - def from_dict(obj: Any) -> 'TasksSendMessageResult': + def from_dict(obj: Any) -> "TasksSendMessageResult": assert isinstance(obj, dict) sent = from_bool(obj.get("sent")) error = from_union([from_str, from_none], obj.get("error")) @@ -5901,6 +6458,7 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksStartAgentRequest: @@ -5922,7 +6480,7 @@ class TasksStartAgentRequest: """Optional model override""" @staticmethod - def from_dict(obj: Any) -> 'TasksStartAgentRequest': + def from_dict(obj: Any) -> "TasksStartAgentRequest": assert isinstance(obj, dict) agent_type = from_str(obj.get("agentType")) name = from_str(obj.get("name")) @@ -5942,6 +6500,7 @@ def to_dict(self) -> dict: result["model"] = from_union([from_str, from_none], self.model) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksStartAgentResult: @@ -5951,7 +6510,7 @@ class TasksStartAgentResult: """Generated agent ID for the background task""" @staticmethod - def from_dict(obj: Any) -> 'TasksStartAgentResult': + def from_dict(obj: Any) -> "TasksStartAgentResult": assert isinstance(obj, dict) agent_id = from_str(obj.get("agentId")) return TasksStartAgentResult(agent_id) @@ -5961,6 +6520,7 @@ def to_dict(self) -> dict: result["agentId"] = from_str(self.agent_id) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksWaitForPendingResult: @@ -5969,8 +6529,9 @@ class TasksWaitForPendingResult: after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS). """ + @staticmethod - def from_dict(obj: Any) -> 'TasksWaitForPendingResult': + def from_dict(obj: Any) -> "TasksWaitForPendingResult": assert isinstance(obj, dict) return TasksWaitForPendingResult() @@ -5978,19 +6539,21 @@ def to_dict(self) -> dict: result: dict = {} return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TelemetrySetFeatureOverridesRequest: """Feature override key/value pairs to attach to subsequent telemetry events from this session. """ + features: dict[str, str] """Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. """ @staticmethod - def from_dict(obj: Any) -> 'TelemetrySetFeatureOverridesRequest': + def from_dict(obj: Any) -> "TelemetrySetFeatureOverridesRequest": assert isinstance(obj, dict) features = from_dict(from_str, obj.get("features")) return TelemetrySetFeatureOverridesRequest(features) @@ -6000,9 +6563,11 @@ def to_dict(self) -> dict: result["features"] = from_dict(from_str, self.features) return result + class TokenAuthInfoType(Enum): TOKEN = "token" + @dataclass class Tool: """Schema for the `Tool` type.""" @@ -6024,13 +6589,15 @@ class Tool: """JSON Schema for the tool's input parameters""" @staticmethod - def from_dict(obj: Any) -> 'Tool': + def from_dict(obj: Any) -> "Tool": assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) instructions = from_union([from_str, from_none], obj.get("instructions")) namespaced_name = from_union([from_str, from_none], obj.get("namespacedName")) - parameters = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("parameters")) + parameters = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], obj.get("parameters") + ) return Tool(description, name, instructions, namespaced_name, parameters) def to_dict(self) -> dict: @@ -6042,9 +6609,12 @@ def to_dict(self) -> dict: if self.namespaced_name is not None: result["namespacedName"] = from_union([from_str, from_none], self.namespaced_name) if self.parameters is not None: - result["parameters"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.parameters) + result["parameters"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.parameters + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolsInitializeAndValidateResult: @@ -6052,8 +6622,9 @@ class ToolsInitializeAndValidateResult: and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation. """ + @staticmethod - def from_dict(obj: Any) -> 'ToolsInitializeAndValidateResult': + def from_dict(obj: Any) -> "ToolsInitializeAndValidateResult": assert isinstance(obj, dict) return ToolsInitializeAndValidateResult() @@ -6061,6 +6632,7 @@ def to_dict(self) -> dict: result: dict = {} return result + @dataclass class ToolsListRequest: """Optional model identifier whose tool overrides should be applied to the listing.""" @@ -6071,7 +6643,7 @@ class ToolsListRequest: """ @staticmethod - def from_dict(obj: Any) -> 'ToolsListRequest': + def from_dict(obj: Any) -> "ToolsListRequest": assert isinstance(obj, dict) model = from_union([from_str, from_none], obj.get("model")) return ToolsListRequest(model) @@ -6082,15 +6654,18 @@ def to_dict(self) -> dict: result["model"] = from_union([from_str, from_none], self.model) return result + # Experimental: this type is part of an experimental API and may change or be removed. class UIAutoModeSwitchResponse(Enum): """User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). """ + NO = "no" YES = "yes" YES_ALWAYS = "yes_always" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfFieldItemsAnyOf: @@ -6103,7 +6678,7 @@ class UIElicitationArrayAnyOfFieldItemsAnyOf: """Display label for this option.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfFieldItemsAnyOf': + def from_dict(obj: Any) -> "UIElicitationArrayAnyOfFieldItemsAnyOf": assert isinstance(obj, dict) const = from_str(obj.get("const")) title = from_str(obj.get("title")) @@ -6115,12 +6690,15 @@ def to_dict(self) -> dict: result["title"] = from_str(self.title) return result + class UIElicitationArrayAnyOfFieldType(Enum): ARRAY = "array" + class UIElicitationArrayEnumFieldItemsType(Enum): STRING = "string" + # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationSchemaPropertyStringFormat(Enum): """Optional format hint that constrains the accepted input.""" @@ -6130,6 +6708,7 @@ class UIElicitationSchemaPropertyStringFormat(Enum): EMAIL = "email" URI = "uri" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringOneOfFieldOneOf: @@ -6142,7 +6721,7 @@ class UIElicitationStringOneOfFieldOneOf: """Display label for this option.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationStringOneOfFieldOneOf': + def from_dict(obj: Any) -> "UIElicitationStringOneOfFieldOneOf": assert isinstance(obj, dict) const = from_str(obj.get("const")) title = from_str(obj.get("title")) @@ -6154,6 +6733,7 @@ def to_dict(self) -> dict: result["title"] = from_str(self.title) return result + class UIElicitationSchemaPropertyType(Enum): """Numeric type accepted by the field.""" @@ -6163,9 +6743,11 @@ class UIElicitationSchemaPropertyType(Enum): NUMBER = "number" STRING = "string" + class UIElicitationSchemaType(Enum): OBJECT = "object" + # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationResponseAction(Enum): """The user's response: accept (submitted), decline (rejected), or cancel (dismissed)""" @@ -6174,19 +6756,21 @@ class UIElicitationResponseAction(Enum): CANCEL = "cancel" DECLINE = "decline" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationResult: """Indicates whether the elicitation response was accepted; false if it was already resolved by another client. """ + success: bool """Whether the response was accepted. False if the request was already resolved by another client. """ @staticmethod - def from_dict(obj: Any) -> 'UIElicitationResult': + def from_dict(obj: Any) -> "UIElicitationResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return UIElicitationResult(success) @@ -6196,9 +6780,11 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + class UIElicitationSchemaPropertyBooleanType(Enum): BOOLEAN = "boolean" + # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationSchemaPropertyNumberType(Enum): """Numeric type accepted by the field.""" @@ -6206,16 +6792,19 @@ class UIElicitationSchemaPropertyNumberType(Enum): INTEGER = "integer" NUMBER = "number" + # Experimental: this type is part of an experimental API and may change or be removed. class UIExitPlanModeAction(Enum): """The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. """ + AUTOPILOT = "autopilot" AUTOPILOT_FLEET = "autopilot_fleet" EXIT_ONLY = "exit_only" INTERACTIVE = "interactive" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingResult: @@ -6228,7 +6817,7 @@ class UIHandlePendingResult: """ @staticmethod - def from_dict(obj: Any) -> 'UIHandlePendingResult': + def from_dict(obj: Any) -> "UIHandlePendingResult": assert isinstance(obj, dict) success = from_bool(obj.get("success")) return UIHandlePendingResult(success) @@ -6238,12 +6827,14 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingSamplingRequest: """Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). """ + request_id: str """The unique request ID from the sampling.requested event""" @@ -6253,7 +6844,7 @@ class UIHandlePendingSamplingRequest: """ @staticmethod - def from_dict(obj: Any) -> 'UIHandlePendingSamplingRequest': + def from_dict(obj: Any) -> "UIHandlePendingSamplingRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("response")) @@ -6263,9 +6854,12 @@ def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) if self.response is not None: - result["response"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.response) + result["response"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.response + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUserInputResponse: @@ -6280,7 +6874,7 @@ class UIUserInputResponse: """ @staticmethod - def from_dict(obj: Any) -> 'UIUserInputResponse': + def from_dict(obj: Any) -> "UIUserInputResponse": assert isinstance(obj, dict) answer = from_str(obj.get("answer")) was_freeform = from_bool(obj.get("wasFreeform")) @@ -6292,6 +6886,7 @@ def to_dict(self) -> dict: result["wasFreeform"] = from_bool(self.was_freeform) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIRegisterDirectAutoModeSwitchHandlerResult: @@ -6300,6 +6895,7 @@ class UIRegisterDirectAutoModeSwitchHandlerResult: registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId). """ + handle: str """Opaque handle representing the registration. Pass this same handle to `unregisterDirectAutoModeSwitchHandler` when the in-process handler is no longer active. @@ -6308,7 +6904,7 @@ class UIRegisterDirectAutoModeSwitchHandlerResult: """ @staticmethod - def from_dict(obj: Any) -> 'UIRegisterDirectAutoModeSwitchHandlerResult': + def from_dict(obj: Any) -> "UIRegisterDirectAutoModeSwitchHandlerResult": assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return UIRegisterDirectAutoModeSwitchHandlerResult(handle) @@ -6318,6 +6914,7 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUnregisterDirectAutoModeSwitchHandlerRequest: @@ -6327,7 +6924,7 @@ class UIUnregisterDirectAutoModeSwitchHandlerRequest: """Handle previously returned by `registerDirectAutoModeSwitchHandler`""" @staticmethod - def from_dict(obj: Any) -> 'UIUnregisterDirectAutoModeSwitchHandlerRequest': + def from_dict(obj: Any) -> "UIUnregisterDirectAutoModeSwitchHandlerRequest": assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return UIUnregisterDirectAutoModeSwitchHandlerRequest(handle) @@ -6337,6 +6934,7 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUnregisterDirectAutoModeSwitchHandlerResult: @@ -6348,7 +6946,7 @@ class UIUnregisterDirectAutoModeSwitchHandlerResult: """ @staticmethod - def from_dict(obj: Any) -> 'UIUnregisterDirectAutoModeSwitchHandlerResult': + def from_dict(obj: Any) -> "UIUnregisterDirectAutoModeSwitchHandlerResult": assert isinstance(obj, dict) unregistered = from_bool(obj.get("unregistered")) return UIUnregisterDirectAutoModeSwitchHandlerResult(unregistered) @@ -6358,6 +6956,7 @@ def to_dict(self) -> dict: result["unregistered"] = from_bool(self.unregistered) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsCodeChanges: @@ -6376,13 +6975,15 @@ class UsageMetricsCodeChanges: """Total lines of code removed""" @staticmethod - def from_dict(obj: Any) -> 'UsageMetricsCodeChanges': + def from_dict(obj: Any) -> "UsageMetricsCodeChanges": assert isinstance(obj, dict) files_modified = from_list(from_str, obj.get("filesModified")) files_modified_count = from_int(obj.get("filesModifiedCount")) lines_added = from_int(obj.get("linesAdded")) lines_removed = from_int(obj.get("linesRemoved")) - return UsageMetricsCodeChanges(files_modified, files_modified_count, lines_added, lines_removed) + return UsageMetricsCodeChanges( + files_modified, files_modified_count, lines_added, lines_removed + ) def to_dict(self) -> dict: result: dict = {} @@ -6392,6 +6993,7 @@ def to_dict(self) -> dict: result["linesRemoved"] = from_int(self.lines_removed) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricRequests: @@ -6404,7 +7006,7 @@ class UsageMetricsModelMetricRequests: """Number of API requests made with this model""" @staticmethod - def from_dict(obj: Any) -> 'UsageMetricsModelMetricRequests': + def from_dict(obj: Any) -> "UsageMetricsModelMetricRequests": assert isinstance(obj, dict) cost = from_float(obj.get("cost")) count = from_int(obj.get("count")) @@ -6416,6 +7018,7 @@ def to_dict(self) -> dict: result["count"] = from_int(self.count) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricTokenDetail: @@ -6425,7 +7028,7 @@ class UsageMetricsModelMetricTokenDetail: """Accumulated token count for this token type""" @staticmethod - def from_dict(obj: Any) -> 'UsageMetricsModelMetricTokenDetail': + def from_dict(obj: Any) -> "UsageMetricsModelMetricTokenDetail": assert isinstance(obj, dict) token_count = from_int(obj.get("tokenCount")) return UsageMetricsModelMetricTokenDetail(token_count) @@ -6435,6 +7038,7 @@ def to_dict(self) -> dict: result["tokenCount"] = from_int(self.token_count) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricUsage: @@ -6456,14 +7060,16 @@ class UsageMetricsModelMetricUsage: """Total output tokens used for reasoning""" @staticmethod - def from_dict(obj: Any) -> 'UsageMetricsModelMetricUsage': + def from_dict(obj: Any) -> "UsageMetricsModelMetricUsage": assert isinstance(obj, dict) cache_read_tokens = from_int(obj.get("cacheReadTokens")) cache_write_tokens = from_int(obj.get("cacheWriteTokens")) input_tokens = from_int(obj.get("inputTokens")) output_tokens = from_int(obj.get("outputTokens")) reasoning_tokens = from_union([from_int, from_none], obj.get("reasoningTokens")) - return UsageMetricsModelMetricUsage(cache_read_tokens, cache_write_tokens, input_tokens, output_tokens, reasoning_tokens) + return UsageMetricsModelMetricUsage( + cache_read_tokens, cache_write_tokens, input_tokens, output_tokens, reasoning_tokens + ) def to_dict(self) -> dict: result: dict = {} @@ -6475,6 +7081,7 @@ def to_dict(self) -> dict: result["reasoningTokens"] = from_union([from_int, from_none], self.reasoning_tokens) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsTokenDetail: @@ -6484,7 +7091,7 @@ class UsageMetricsTokenDetail: """Accumulated token count for this token type""" @staticmethod - def from_dict(obj: Any) -> 'UsageMetricsTokenDetail': + def from_dict(obj: Any) -> "UsageMetricsTokenDetail": assert isinstance(obj, dict) token_count = from_int(obj.get("tokenCount")) return UsageMetricsTokenDetail(token_count) @@ -6494,9 +7101,11 @@ def to_dict(self) -> dict: result["tokenCount"] = from_int(self.token_count) return result + class UserAuthInfoType(Enum): USER = "user" + # Experimental: this type is part of an experimental API and may change or be removed. class WorkspaceDiffFileChangeType(Enum): """Type of change represented by this file diff.""" @@ -6506,15 +7115,18 @@ class WorkspaceDiffFileChangeType(Enum): MODIFIED = "modified" RENAMED = "renamed" + # Experimental: this type is part of an experimental API and may change or be removed. class WorkspaceDiffMode(Enum): """Diff mode requested by the client. Effective mode used for the returned changes. """ + BRANCH = "branch" UNSTAGED = "unstaged" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesCheckpoints: @@ -6530,7 +7142,7 @@ class WorkspacesCheckpoints: """Human-readable checkpoint title""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesCheckpoints': + def from_dict(obj: Any) -> "WorkspacesCheckpoints": assert isinstance(obj, dict) filename = from_str(obj.get("filename")) number = from_int(obj.get("number")) @@ -6544,6 +7156,7 @@ def to_dict(self) -> dict: result["title"] = from_str(self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesCreateFileRequest: @@ -6556,7 +7169,7 @@ class WorkspacesCreateFileRequest: """Relative path within the workspace files directory""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesCreateFileRequest': + def from_dict(obj: Any) -> "WorkspacesCreateFileRequest": assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) @@ -6568,6 +7181,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesListFilesResult: @@ -6577,7 +7191,7 @@ class WorkspacesListFilesResult: """Relative file paths in the workspace files directory""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesListFilesResult': + def from_dict(obj: Any) -> "WorkspacesListFilesResult": assert isinstance(obj, dict) files = from_list(from_str, obj.get("files")) return WorkspacesListFilesResult(files) @@ -6587,6 +7201,7 @@ def to_dict(self) -> dict: result["files"] = from_list(from_str, self.files) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadCheckpointRequest: @@ -6596,7 +7211,7 @@ class WorkspacesReadCheckpointRequest: """Checkpoint number to read""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesReadCheckpointRequest': + def from_dict(obj: Any) -> "WorkspacesReadCheckpointRequest": assert isinstance(obj, dict) number = from_int(obj.get("number")) return WorkspacesReadCheckpointRequest(number) @@ -6606,6 +7221,7 @@ def to_dict(self) -> dict: result["number"] = from_int(self.number) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadCheckpointResult: @@ -6615,7 +7231,7 @@ class WorkspacesReadCheckpointResult: """Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesReadCheckpointResult': + def from_dict(obj: Any) -> "WorkspacesReadCheckpointResult": assert isinstance(obj, dict) content = from_union([from_none, from_str], obj.get("content")) return WorkspacesReadCheckpointResult(content) @@ -6625,6 +7241,7 @@ def to_dict(self) -> dict: result["content"] = from_union([from_none, from_str], self.content) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadFileRequest: @@ -6634,7 +7251,7 @@ class WorkspacesReadFileRequest: """Relative path within the workspace files directory""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesReadFileRequest': + def from_dict(obj: Any) -> "WorkspacesReadFileRequest": assert isinstance(obj, dict) path = from_str(obj.get("path")) return WorkspacesReadFileRequest(path) @@ -6644,6 +7261,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadFileResult: @@ -6653,7 +7271,7 @@ class WorkspacesReadFileResult: """File content as a UTF-8 string""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesReadFileResult': + def from_dict(obj: Any) -> "WorkspacesReadFileResult": assert isinstance(obj, dict) content = from_str(obj.get("content")) return WorkspacesReadFileResult(content) @@ -6663,6 +7281,7 @@ def to_dict(self) -> dict: result["content"] = from_str(self.content) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesSaveLargePasteRequest: @@ -6672,7 +7291,7 @@ class WorkspacesSaveLargePasteRequest: """Pasted content to save as a UTF-8 file""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesSaveLargePasteRequest': + def from_dict(obj: Any) -> "WorkspacesSaveLargePasteRequest": assert isinstance(obj, dict) content = from_str(obj.get("content")) return WorkspacesSaveLargePasteRequest(content) @@ -6682,6 +7301,7 @@ def to_dict(self) -> dict: result["content"] = from_str(self.content) return result + @dataclass class Saved: filename: str @@ -6694,7 +7314,7 @@ class Saved: """Size of the saved file in bytes""" @staticmethod - def from_dict(obj: Any) -> 'Saved': + def from_dict(obj: Any) -> "Saved": assert isinstance(obj, dict) filename = from_str(obj.get("filename")) file_path = from_str(obj.get("filePath")) @@ -6708,6 +7328,7 @@ def to_dict(self) -> dict: result["sizeBytes"] = from_int(self.size_bytes) return result + @dataclass class AccountGetQuotaResult: """Quota usage snapshots for the resolved user, keyed by quota type.""" @@ -6716,16 +7337,19 @@ class AccountGetQuotaResult: """Quota snapshots keyed by type (e.g., chat, completions, premium_interactions)""" @staticmethod - def from_dict(obj: Any) -> 'AccountGetQuotaResult': + def from_dict(obj: Any) -> "AccountGetQuotaResult": assert isinstance(obj, dict) quota_snapshots = from_dict(AccountQuotaSnapshot.from_dict, obj.get("quotaSnapshots")) return AccountGetQuotaResult(quota_snapshots) def to_dict(self) -> dict: result: dict = {} - result["quotaSnapshots"] = from_dict(lambda x: to_class(AccountQuotaSnapshot, x), self.quota_snapshots) + result["quotaSnapshots"] = from_dict( + lambda x: to_class(AccountQuotaSnapshot, x), self.quota_snapshots + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionAuthStatus: @@ -6750,7 +7374,7 @@ class SessionAuthStatus: """Human-readable authentication status description""" @staticmethod - def from_dict(obj: Any) -> 'SessionAuthStatus': + def from_dict(obj: Any) -> "SessionAuthStatus": assert isinstance(obj, dict) is_authenticated = from_bool(obj.get("isAuthenticated")) auth_type = from_union([AuthInfoType, from_none], obj.get("authType")) @@ -6758,13 +7382,17 @@ def from_dict(obj: Any) -> 'SessionAuthStatus': host = from_union([from_str, from_none], obj.get("host")) login = from_union([from_str, from_none], obj.get("login")) status_message = from_union([from_str, from_none], obj.get("statusMessage")) - return SessionAuthStatus(is_authenticated, auth_type, copilot_plan, host, login, status_message) + return SessionAuthStatus( + is_authenticated, auth_type, copilot_plan, host, login, status_message + ) def to_dict(self) -> dict: result: dict = {} result["isAuthenticated"] = from_bool(self.is_authenticated) if self.auth_type is not None: - result["authType"] = from_union([lambda x: to_enum(AuthInfoType, x), from_none], self.auth_type) + result["authType"] = from_union( + [lambda x: to_enum(AuthInfoType, x), from_none], self.auth_type + ) if self.copilot_plan is not None: result["copilotPlan"] = from_union([from_str, from_none], self.copilot_plan) if self.host is not None: @@ -6775,6 +7403,7 @@ def to_dict(self) -> dict: result["statusMessage"] = from_union([from_str, from_none], self.status_message) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class DiscoveredCanvas: @@ -6802,16 +7431,26 @@ class DiscoveredCanvas: """JSON Schema for canvas open input""" @staticmethod - def from_dict(obj: Any) -> 'DiscoveredCanvas': + def from_dict(obj: Any) -> "DiscoveredCanvas": assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) extension_id = from_str(obj.get("extensionId")) - actions = from_union([lambda x: from_list(CanvasAction.from_dict, x), from_none], obj.get("actions")) + actions = from_union( + [lambda x: from_list(CanvasAction.from_dict, x), from_none], obj.get("actions") + ) extension_name = from_union([from_str, from_none], obj.get("extensionName")) input_schema = obj.get("inputSchema") - return DiscoveredCanvas(canvas_id, description, display_name, extension_id, actions, extension_name, input_schema) + return DiscoveredCanvas( + canvas_id, + description, + display_name, + extension_id, + actions, + extension_name, + input_schema, + ) def to_dict(self) -> dict: result: dict = {} @@ -6820,13 +7459,17 @@ def to_dict(self) -> dict: result["displayName"] = from_str(self.display_name) result["extensionId"] = from_str(self.extension_id) if self.actions is not None: - result["actions"] = from_union([lambda x: from_list(lambda x: to_class(CanvasAction, x), x), from_none], self.actions) + result["actions"] = from_union( + [lambda x: from_list(lambda x: to_class(CanvasAction, x), x), from_none], + self.actions, + ) if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.input_schema is not None: result["inputSchema"] = self.input_schema return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class OpenCanvasInstance: @@ -6863,7 +7506,7 @@ class OpenCanvasInstance: """URL for web-rendered canvases""" @staticmethod - def from_dict(obj: Any) -> 'OpenCanvasInstance': + def from_dict(obj: Any) -> "OpenCanvasInstance": assert isinstance(obj, dict) availability = CanvasInstanceAvailability(obj.get("availability")) canvas_id = from_str(obj.get("canvasId")) @@ -6875,7 +7518,18 @@ def from_dict(obj: Any) -> 'OpenCanvasInstance': status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) url = from_union([from_str, from_none], obj.get("url")) - return OpenCanvasInstance(availability, canvas_id, extension_id, instance_id, reopen, extension_name, input, status, title, url) + return OpenCanvasInstance( + availability, + canvas_id, + extension_id, + instance_id, + reopen, + extension_name, + input, + status, + title, + url, + ) def to_dict(self) -> dict: result: dict = {} @@ -6896,6 +7550,7 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInput: @@ -6917,11 +7572,13 @@ class SlashCommandInput: """ @staticmethod - def from_dict(obj: Any) -> 'SlashCommandInput': + def from_dict(obj: Any) -> "SlashCommandInput": assert isinstance(obj, dict) hint = from_str(obj.get("hint")) completion = from_union([SlashCommandInputCompletion, from_none], obj.get("completion")) - preserve_multiline_input = from_union([from_bool, from_none], obj.get("preserveMultilineInput")) + preserve_multiline_input = from_union( + [from_bool, from_none], obj.get("preserveMultilineInput") + ) required = from_union([from_bool, from_none], obj.get("required")) return SlashCommandInput(hint, completion, preserve_multiline_input, required) @@ -6929,13 +7586,18 @@ def to_dict(self) -> dict: result: dict = {} result["hint"] = from_str(self.hint) if self.completion is not None: - result["completion"] = from_union([lambda x: to_enum(SlashCommandInputCompletion, x), from_none], self.completion) + result["completion"] = from_union( + [lambda x: to_enum(SlashCommandInputCompletion, x), from_none], self.completion + ) if self.preserve_multiline_input is not None: - result["preserveMultilineInput"] = from_union([from_bool, from_none], self.preserve_multiline_input) + result["preserveMultilineInput"] = from_union( + [from_bool, from_none], self.preserve_multiline_input + ) if self.required is not None: result["required"] = from_union([from_bool, from_none], self.required) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentDirectory: @@ -6951,7 +7613,7 @@ class SendAttachmentDirectory: """Attachment type discriminator""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentDirectory': + def from_dict(obj: Any) -> "SendAttachmentDirectory": assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) path = from_str(obj.get("path")) @@ -6964,6 +7626,7 @@ def to_dict(self) -> dict: result["type"] = self.type return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectedRemoteSessionMetadata: @@ -7003,7 +7666,7 @@ class ConnectedRemoteSessionMetadata: """Optional session summary.""" @staticmethod - def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadata': + def from_dict(obj: Any) -> "ConnectedRemoteSessionMetadata": assert isinstance(obj, dict) kind = ConnectedRemoteSessionMetadataKind(obj.get("kind")) modified_time = from_datetime(obj.get("modifiedTime")) @@ -7016,7 +7679,19 @@ def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadata': stale_at = from_union([from_datetime, from_none], obj.get("staleAt")) state = from_union([from_str, from_none], obj.get("state")) summary = from_union([from_str, from_none], obj.get("summary")) - return ConnectedRemoteSessionMetadata(kind, modified_time, repository, session_id, start_time, name, pull_request_number, resource_id, stale_at, state, summary) + return ConnectedRemoteSessionMetadata( + kind, + modified_time, + repository, + session_id, + start_time, + name, + pull_request_number, + resource_id, + stale_at, + state, + summary, + ) def to_dict(self) -> dict: result: dict = {} @@ -7028,7 +7703,9 @@ def to_dict(self) -> dict: if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.pull_request_number is not None: - result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) + result["pullRequestNumber"] = from_union( + [from_int, from_none], self.pull_request_number + ) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.stale_at is not None: @@ -7039,6 +7716,7 @@ def to_dict(self) -> dict: result["summary"] = from_union([from_str, from_none], self.summary) return result + @dataclass class MCPServerConfigStdio: """Stdio MCP server configuration launched as a child process.""" @@ -7070,17 +7748,22 @@ class MCPServerConfigStdio: """Tools to include. Defaults to all tools if not specified.""" @staticmethod - def from_dict(obj: Any) -> 'MCPServerConfigStdio': + def from_dict(obj: Any) -> "MCPServerConfigStdio": assert isinstance(obj, dict) command = from_str(obj.get("command")) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) cwd = from_union([from_str, from_none], obj.get("cwd")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) - filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) + filter_mapping = from_union( + [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], + obj.get("filterMapping"), + ) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) - return MCPServerConfigStdio(command, args, cwd, env, filter_mapping, is_default_server, timeout, tools) + return MCPServerConfigStdio( + command, args, cwd, env, filter_mapping, is_default_server, timeout, tools + ) def to_dict(self) -> dict: result: dict = {} @@ -7092,7 +7775,14 @@ def to_dict(self) -> dict: if self.env is not None: result["env"] = from_union([lambda x: from_dict(from_str, x), from_none], self.env) if self.filter_mapping is not None: - result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) + result["filterMapping"] = from_union( + [ + lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), + lambda x: to_enum(ContentFilterMode, x), + from_none, + ], + self.filter_mapping, + ) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.timeout is not None: @@ -7101,6 +7791,27 @@ def to_dict(self) -> dict: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) return result + +@dataclass +class CanvasHostContextCapabilities: + """Host capabilities""" + + canvases: bool | None = None + """Whether canvas rendering is supported""" + + @staticmethod + def from_dict(obj: Any) -> "CanvasHostContextCapabilities": + assert isinstance(obj, dict) + canvases = from_union([from_bool, from_none], obj.get("canvases")) + return CanvasHostContextCapabilities(canvases) + + def to_dict(self) -> dict: + result: dict = {} + if self.canvases is not None: + result["canvases"] = from_union([from_bool, from_none], self.canvases) + return result + + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshots: @@ -7110,6 +7821,7 @@ class CopilotUserResponseQuotaSnapshots: Schema for the `CopilotUserResponseQuotaSnapshotsPremiumInteractions` type. """ + entitlement: float | None = None has_quota: bool | None = None overage_count: float | None = None @@ -7124,7 +7836,7 @@ class CopilotUserResponseQuotaSnapshots: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshots': + def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshots": assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -7138,7 +7850,20 @@ def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshots': timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshots(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) + return CopilotUserResponseQuotaSnapshots( + entitlement, + has_quota, + overage_count, + overage_permitted, + percent_remaining, + quota_id, + quota_remaining, + quota_reset_at, + remaining, + timestamp_utc, + token_based_billing, + unlimited, + ) def to_dict(self) -> dict: result: dict = {} @@ -7163,11 +7888,14 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) + result["token_based_billing"] = from_union( + [from_bool, from_none], self.token_based_billing + ) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result + @dataclass class DiscoveredMCPServer: """Schema for the `DiscoveredMcpServer` type.""" @@ -7185,7 +7913,7 @@ class DiscoveredMCPServer: """Server transport type: stdio, http, sse (deprecated), or memory""" @staticmethod - def from_dict(obj: Any) -> 'DiscoveredMCPServer': + def from_dict(obj: Any) -> "DiscoveredMCPServer": assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) name = from_str(obj.get("name")) @@ -7199,9 +7927,12 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) result["source"] = to_enum(McpServerSource, self.source) if self.type is not None: - result["type"] = from_union([lambda x: to_enum(DiscoveredMCPServerType, x), from_none], self.type) + result["type"] = from_union( + [lambda x: to_enum(DiscoveredMCPServerType, x), from_none], self.type + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogReadRequest: @@ -7232,29 +7963,37 @@ class EventLogReadRequest: """ @staticmethod - def from_dict(obj: Any) -> 'EventLogReadRequest': + def from_dict(obj: Any) -> "EventLogReadRequest": assert isinstance(obj, dict) agent_scope = from_union([EventsAgentScope, from_none], obj.get("agentScope")) cursor = from_union([from_str, from_none], obj.get("cursor")) max = from_union([from_int, from_none], obj.get("max")) - types = from_union([lambda x: from_list(from_str, x), EventLogTypes, from_none], obj.get("types")) + types = from_union( + [lambda x: from_list(from_str, x), EventLogTypes, from_none], obj.get("types") + ) wait_ms = from_union([from_int, from_none], obj.get("waitMs")) return EventLogReadRequest(agent_scope, cursor, max, types, wait_ms) def to_dict(self) -> dict: result: dict = {} if self.agent_scope is not None: - result["agentScope"] = from_union([lambda x: to_enum(EventsAgentScope, x), from_none], self.agent_scope) + result["agentScope"] = from_union( + [lambda x: to_enum(EventsAgentScope, x), from_none], self.agent_scope + ) if self.cursor is not None: result["cursor"] = from_union([from_str, from_none], self.cursor) if self.max is not None: result["max"] = from_union([from_int, from_none], self.max) if self.types is not None: - result["types"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x), from_none], self.types) + result["types"] = from_union( + [lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x), from_none], + self.types, + ) if self.wait_ms is not None: result["waitMs"] = from_union([from_int, from_none], self.wait_ms) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventsReadResult: @@ -7282,7 +8021,7 @@ class EventsReadResult: """ @staticmethod - def from_dict(obj: Any) -> 'EventsReadResult': + def from_dict(obj: Any) -> "EventsReadResult": assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) cursor_status = EventsCursorStatus(obj.get("cursorStatus")) @@ -7298,6 +8037,7 @@ def to_dict(self) -> dict: result["hasMore"] = from_bool(self.has_more) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Extension: @@ -7319,7 +8059,7 @@ class Extension: """Process ID if the extension is running""" @staticmethod - def from_dict(obj: Any) -> 'Extension': + def from_dict(obj: Any) -> "Extension": assert isinstance(obj, dict) id = from_str(obj.get("id")) name = from_str(obj.get("name")) @@ -7338,6 +8078,7 @@ def to_dict(self) -> dict: result["pid"] = from_union([from_int, from_none], self.pid) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmBinaryResultsForLlm: @@ -7360,14 +8101,16 @@ class ExternalToolTextResultForLlmBinaryResultsForLlm: """Optional metadata from the producing tool.""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmBinaryResultsForLlm': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmBinaryResultsForLlm": assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) type = ExternalToolTextResultForLlmBinaryResultsForLlmType(obj.get("type")) description = from_union([from_str, from_none], obj.get("description")) metadata = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("metadata")) - return ExternalToolTextResultForLlmBinaryResultsForLlm(data, mime_type, type, description, metadata) + return ExternalToolTextResultForLlmBinaryResultsForLlm( + data, mime_type, type, description, metadata + ) def to_dict(self) -> dict: result: dict = {} @@ -7377,9 +8120,12 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.metadata is not None: - result["metadata"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.metadata) + result["metadata"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.metadata + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResourceLinkIcon: @@ -7398,7 +8144,7 @@ class ExternalToolTextResultForLlmContentResourceLinkIcon: """Theme variant this icon is intended for""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResourceLinkIcon': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentResourceLinkIcon": assert isinstance(obj, dict) src = from_str(obj.get("src")) mime_type = from_union([from_str, from_none], obj.get("mimeType")) @@ -7417,7 +8163,11 @@ def to_dict(self) -> dict: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) return result -ExternalToolTextResultForLlmContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents + +ExternalToolTextResultForLlmContentResourceDetails = ( + EmbeddedTextResourceContents | EmbeddedBlobResourceContents +) + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass @@ -7434,7 +8184,7 @@ class ExternalToolTextResultForLlmContentAudio: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentAudio': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentAudio": assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) @@ -7447,6 +8197,7 @@ def to_dict(self) -> dict: result["type"] = self.type return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentImage: @@ -7462,7 +8213,7 @@ class ExternalToolTextResultForLlmContentImage: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentImage': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentImage": assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) @@ -7475,6 +8226,7 @@ def to_dict(self) -> dict: result["type"] = self.type return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResource: @@ -7487,17 +8239,28 @@ class ExternalToolTextResultForLlmContentResource: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResource': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentResource": assert isinstance(obj, dict) - resource = (lambda x: from_union([EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x))(obj.get("resource")) + resource = ( + lambda x: from_union( + [EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x + ) + )(obj.get("resource")) return ExternalToolTextResultForLlmContentResource(resource) def to_dict(self) -> dict: result: dict = {} - result["resource"] = from_union([lambda x: to_class(EmbeddedTextResourceContents, x), lambda x: to_class(EmbeddedBlobResourceContents, x)], self.resource) + result["resource"] = from_union( + [ + lambda x: to_class(EmbeddedTextResourceContents, x), + lambda x: to_class(EmbeddedBlobResourceContents, x), + ], + self.resource, + ) result["type"] = self.type return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentTerminal: @@ -7516,7 +8279,7 @@ class ExternalToolTextResultForLlmContentTerminal: """Process exit code, if the command has completed""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentTerminal': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentTerminal": assert isinstance(obj, dict) text = from_str(obj.get("text")) cwd = from_union([from_str, from_none], obj.get("cwd")) @@ -7533,6 +8296,7 @@ def to_dict(self) -> dict: result["exitCode"] = from_union([from_int, from_none], self.exit_code) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentText: @@ -7545,7 +8309,7 @@ class ExternalToolTextResultForLlmContentText: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentText': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentText": assert isinstance(obj, dict) text = from_str(obj.get("text")) return ExternalToolTextResultForLlmContentText(text) @@ -7556,6 +8320,7 @@ def to_dict(self) -> dict: result["type"] = self.type return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandTextResult: @@ -7579,12 +8344,14 @@ class SlashCommandTextResult: """ @staticmethod - def from_dict(obj: Any) -> 'SlashCommandTextResult': + def from_dict(obj: Any) -> "SlashCommandTextResult": assert isinstance(obj, dict) text = from_str(obj.get("text")) markdown = from_union([from_bool, from_none], obj.get("markdown")) preserve_ansi = from_union([from_bool, from_none], obj.get("preserveAnsi")) - runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) + runtime_settings_changed = from_union( + [from_bool, from_none], obj.get("runtimeSettingsChanged") + ) return SlashCommandTextResult(text, markdown, preserve_ansi, runtime_settings_changed) def to_dict(self) -> dict: @@ -7596,15 +8363,19 @@ def to_dict(self) -> dict: if self.preserve_ansi is not None: result["preserveAnsi"] = from_union([from_bool, from_none], self.preserve_ansi) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) + result["runtimeSettingsChanged"] = from_union( + [from_bool, from_none], self.runtime_settings_changed + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactResult: """Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. """ + messages_removed: int """Number of messages removed during compaction""" @@ -7623,14 +8394,18 @@ class HistoryCompactResult: """ @staticmethod - def from_dict(obj: Any) -> 'HistoryCompactResult': + def from_dict(obj: Any) -> "HistoryCompactResult": assert isinstance(obj, dict) messages_removed = from_int(obj.get("messagesRemoved")) success = from_bool(obj.get("success")) tokens_removed = from_int(obj.get("tokensRemoved")) - context_window = from_union([HistoryCompactContextWindow.from_dict, from_none], obj.get("contextWindow")) + context_window = from_union( + [HistoryCompactContextWindow.from_dict, from_none], obj.get("contextWindow") + ) summary_content = from_union([from_str, from_none], obj.get("summaryContent")) - return HistoryCompactResult(messages_removed, success, tokens_removed, context_window, summary_content) + return HistoryCompactResult( + messages_removed, success, tokens_removed, context_window, summary_content + ) def to_dict(self) -> dict: result: dict = {} @@ -7638,11 +8413,14 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) result["tokensRemoved"] = from_int(self.tokens_removed) if self.context_window is not None: - result["contextWindow"] = from_union([lambda x: to_class(HistoryCompactContextWindow, x), from_none], self.context_window) + result["contextWindow"] = from_union( + [lambda x: to_class(HistoryCompactContextWindow, x), from_none], self.context_window + ) if self.summary_content is not None: result["summaryContent"] = from_union([from_str, from_none], self.summary_content) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceGithub: @@ -7656,7 +8434,7 @@ class InstalledPluginSourceGithub: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> 'InstalledPluginSourceGithub': + def from_dict(obj: Any) -> "InstalledPluginSourceGithub": assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) @@ -7674,6 +8452,7 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceGithub: @@ -7687,7 +8466,7 @@ class SessionInstalledPluginSourceGithub: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGithub': + def from_dict(obj: Any) -> "SessionInstalledPluginSourceGithub": assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) @@ -7705,6 +8484,7 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceLocal: @@ -7715,7 +8495,7 @@ class InstalledPluginSourceLocal: """Constant value. Always "local".""" @staticmethod - def from_dict(obj: Any) -> 'InstalledPluginSourceLocal': + def from_dict(obj: Any) -> "InstalledPluginSourceLocal": assert isinstance(obj, dict) path = from_str(obj.get("path")) source = TentacledSource(obj.get("source")) @@ -7727,6 +8507,7 @@ def to_dict(self) -> dict: result["source"] = to_enum(TentacledSource, self.source) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceLocal: @@ -7737,7 +8518,7 @@ class SessionInstalledPluginSourceLocal: """Constant value. Always "local".""" @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPluginSourceLocal': + def from_dict(obj: Any) -> "SessionInstalledPluginSourceLocal": assert isinstance(obj, dict) path = from_str(obj.get("path")) source = TentacledSource(obj.get("source")) @@ -7749,6 +8530,7 @@ def to_dict(self) -> dict: result["source"] = to_enum(TentacledSource, self.source) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceURL: @@ -7762,7 +8544,7 @@ class InstalledPluginSourceURL: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> 'InstalledPluginSourceURL': + def from_dict(obj: Any) -> "InstalledPluginSourceURL": assert isinstance(obj, dict) source = StickySource(obj.get("source")) url = from_str(obj.get("url")) @@ -7780,6 +8562,7 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceURL: @@ -7793,7 +8576,7 @@ class SessionInstalledPluginSourceURL: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPluginSourceURL': + def from_dict(obj: Any) -> "SessionInstalledPluginSourceURL": assert isinstance(obj, dict) source = StickySource(obj.get("source")) url = from_str(obj.get("url")) @@ -7811,6 +8594,7 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsSources: @@ -7845,7 +8629,7 @@ class InstructionsSources: """Short description (body after frontmatter) for use in instruction tables""" @staticmethod - def from_dict(obj: Any) -> 'InstructionsSources': + def from_dict(obj: Any) -> "InstructionsSources": assert isinstance(obj, dict) content = from_str(obj.get("content")) id = from_str(obj.get("id")) @@ -7856,7 +8640,9 @@ def from_dict(obj: Any) -> 'InstructionsSources': apply_to = from_union([lambda x: from_list(from_str, x), from_none], obj.get("applyTo")) default_disabled = from_union([from_bool, from_none], obj.get("defaultDisabled")) description = from_union([from_str, from_none], obj.get("description")) - return InstructionsSources(content, id, label, location, source_path, type, apply_to, default_disabled, description) + return InstructionsSources( + content, id, label, location, source_path, type, apply_to, default_disabled, description + ) def to_dict(self) -> dict: result: dict = {} @@ -7867,19 +8653,23 @@ def to_dict(self) -> dict: result["sourcePath"] = from_str(self.source_path) result["type"] = to_enum(InstructionsSourcesType, self.type) if self.apply_to is not None: - result["applyTo"] = from_union([lambda x: from_list(from_str, x), from_none], self.apply_to) + result["applyTo"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.apply_to + ) if self.default_disabled is not None: result["defaultDisabled"] = from_union([from_bool, from_none], self.default_disabled) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LogRequest: """Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. """ + message: str """Human-readable message""" @@ -7901,7 +8691,7 @@ class LogRequest: """Optional URL the user can open in their browser for more details""" @staticmethod - def from_dict(obj: Any) -> 'LogRequest': + def from_dict(obj: Any) -> "LogRequest": assert isinstance(obj, dict) message = from_str(obj.get("message")) ephemeral = from_union([from_bool, from_none], obj.get("ephemeral")) @@ -7917,7 +8707,9 @@ def to_dict(self) -> dict: if self.ephemeral is not None: result["ephemeral"] = from_union([from_bool, from_none], self.ephemeral) if self.level is not None: - result["level"] = from_union([lambda x: to_enum(SessionLogLevel, x), from_none], self.level) + result["level"] = from_union( + [lambda x: to_enum(SessionLogLevel, x), from_none], self.level + ) if self.tip is not None: result["tip"] = from_union([from_str, from_none], self.tip) if self.type is not None: @@ -7926,6 +8718,7 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseResult: @@ -7938,7 +8731,7 @@ class MCPAppsDiagnoseResult: """What the server returned for this session""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsDiagnoseResult': + def from_dict(obj: Any) -> "MCPAppsDiagnoseResult": assert isinstance(obj, dict) capability = MCPAppsDiagnoseCapability.from_dict(obj.get("capability")) server = MCPAppsDiagnoseServer.from_dict(obj.get("server")) @@ -7950,6 +8743,7 @@ def to_dict(self) -> dict: result["server"] = to_class(MCPAppsDiagnoseServer, self.server) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsHostContextDetails: @@ -7977,27 +8771,39 @@ class MCPAppsHostContextDetails: """Host application identifier""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsHostContextDetails': + def from_dict(obj: Any) -> "MCPAppsHostContextDetails": assert isinstance(obj, dict) - available_display_modes = from_union([lambda x: from_list(MCPAppsDisplayMode, x), from_none], obj.get("availableDisplayModes")) + available_display_modes = from_union( + [lambda x: from_list(MCPAppsDisplayMode, x), from_none], + obj.get("availableDisplayModes"), + ) display_mode = from_union([MCPAppsDisplayMode, from_none], obj.get("displayMode")) locale = from_union([from_str, from_none], obj.get("locale")) platform = from_union([MCPAppsHostContextDetailsPlatform, from_none], obj.get("platform")) theme = from_union([Theme, from_none], obj.get("theme")) time_zone = from_union([from_str, from_none], obj.get("timeZone")) user_agent = from_union([from_str, from_none], obj.get("userAgent")) - return MCPAppsHostContextDetails(available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent) + return MCPAppsHostContextDetails( + available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent + ) def to_dict(self) -> dict: result: dict = {} if self.available_display_modes is not None: - result["availableDisplayModes"] = from_union([lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], self.available_display_modes) + result["availableDisplayModes"] = from_union( + [lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], + self.available_display_modes, + ) if self.display_mode is not None: - result["displayMode"] = from_union([lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode) + result["displayMode"] = from_union( + [lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode + ) if self.locale is not None: result["locale"] = from_union([from_str, from_none], self.locale) if self.platform is not None: - result["platform"] = from_union([lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform) + result["platform"] = from_union( + [lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform + ) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) if self.time_zone is not None: @@ -8006,6 +8812,7 @@ def to_dict(self) -> dict: result["userAgent"] = from_union([from_str, from_none], self.user_agent) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsSetHostContextDetails: @@ -8033,27 +8840,39 @@ class MCPAppsSetHostContextDetails: """Host application identifier""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsSetHostContextDetails': + def from_dict(obj: Any) -> "MCPAppsSetHostContextDetails": assert isinstance(obj, dict) - available_display_modes = from_union([lambda x: from_list(MCPAppsDisplayMode, x), from_none], obj.get("availableDisplayModes")) + available_display_modes = from_union( + [lambda x: from_list(MCPAppsDisplayMode, x), from_none], + obj.get("availableDisplayModes"), + ) display_mode = from_union([MCPAppsDisplayMode, from_none], obj.get("displayMode")) locale = from_union([from_str, from_none], obj.get("locale")) platform = from_union([MCPAppsHostContextDetailsPlatform, from_none], obj.get("platform")) theme = from_union([Theme, from_none], obj.get("theme")) time_zone = from_union([from_str, from_none], obj.get("timeZone")) user_agent = from_union([from_str, from_none], obj.get("userAgent")) - return MCPAppsSetHostContextDetails(available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent) + return MCPAppsSetHostContextDetails( + available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent + ) def to_dict(self) -> dict: result: dict = {} if self.available_display_modes is not None: - result["availableDisplayModes"] = from_union([lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], self.available_display_modes) + result["availableDisplayModes"] = from_union( + [lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], + self.available_display_modes, + ) if self.display_mode is not None: - result["displayMode"] = from_union([lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode) + result["displayMode"] = from_union( + [lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode + ) if self.locale is not None: result["locale"] = from_union([from_str, from_none], self.locale) if self.platform is not None: - result["platform"] = from_union([lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform) + result["platform"] = from_union( + [lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform + ) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) if self.time_zone is not None: @@ -8062,6 +8881,7 @@ def to_dict(self) -> dict: result["userAgent"] = from_union([from_str, from_none], self.user_agent) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsReadResourceResult: @@ -8071,7 +8891,7 @@ class MCPAppsReadResourceResult: """Resource contents returned by the server""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsReadResourceResult': + def from_dict(obj: Any) -> "MCPAppsReadResourceResult": assert isinstance(obj, dict) contents = from_list(MCPAppsResourceContent.from_dict, obj.get("contents")) return MCPAppsReadResourceResult(contents) @@ -8081,6 +8901,7 @@ def to_dict(self) -> dict: result["contents"] = from_list(lambda x: to_class(MCPAppsResourceContent, x), self.contents) return result + @dataclass class MCPServerConfig: """MCP server configuration (stdio process or remote HTTP/SSE) @@ -8089,6 +8910,7 @@ class MCPServerConfig: Remote MCP server configuration accessed over HTTP or SSE. """ + args: list[str] | None = None """Command-line arguments passed to the Stdio MCP server process.""" @@ -8137,24 +8959,45 @@ class MCPServerConfig: """URL of the remote MCP server endpoint.""" @staticmethod - def from_dict(obj: Any) -> 'MCPServerConfig': + def from_dict(obj: Any) -> "MCPServerConfig": assert isinstance(obj, dict) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) command = from_union([from_str, from_none], obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) - filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) + filter_mapping = from_union( + [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], + obj.get("filterMapping"), + ) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) auth = from_union([MCPServerConfigHTTPAuth.from_dict, from_none], obj.get("auth")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) - oauth_grant_type = from_union([MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType")) + oauth_grant_type = from_union( + [MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType") + ) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) url = from_union([from_str, from_none], obj.get("url")) - return MCPServerConfig(args, command, cwd, env, filter_mapping, is_default_server, timeout, tools, auth, headers, oauth_client_id, oauth_grant_type, oauth_public_client, type, url) + return MCPServerConfig( + args, + command, + cwd, + env, + filter_mapping, + is_default_server, + timeout, + tools, + auth, + headers, + oauth_client_id, + oauth_grant_type, + oauth_public_client, + type, + url, + ) def to_dict(self) -> dict: result: dict = {} @@ -8167,7 +9010,14 @@ def to_dict(self) -> dict: if self.env is not None: result["env"] = from_union([lambda x: from_dict(from_str, x), from_none], self.env) if self.filter_mapping is not None: - result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) + result["filterMapping"] = from_union( + [ + lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), + lambda x: to_enum(ContentFilterMode, x), + from_none, + ], + self.filter_mapping, + ) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.timeout is not None: @@ -8175,21 +9025,33 @@ def to_dict(self) -> dict: if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.auth is not None: - result["auth"] = from_union([lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth) + result["auth"] = from_union( + [lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth + ) if self.headers is not None: - result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) + result["headers"] = from_union( + [lambda x: from_dict(from_str, x), from_none], self.headers + ) if self.oauth_client_id is not None: result["oauthClientId"] = from_union([from_str, from_none], self.oauth_client_id) if self.oauth_grant_type is not None: - result["oauthGrantType"] = from_union([lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], self.oauth_grant_type) + result["oauthGrantType"] = from_union( + [lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], + self.oauth_grant_type, + ) if self.oauth_public_client is not None: - result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) + result["oauthPublicClient"] = from_union( + [from_bool, from_none], self.oauth_public_client + ) if self.type is not None: - result["type"] = from_union([lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type) + result["type"] = from_union( + [lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type + ) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result + @dataclass class MCPServerConfigHTTP: """Remote MCP server configuration accessed over HTTP or SSE.""" @@ -8230,46 +9092,82 @@ class MCPServerConfigHTTP: """Remote transport type. Defaults to "http" when omitted.""" @staticmethod - def from_dict(obj: Any) -> 'MCPServerConfigHTTP': + def from_dict(obj: Any) -> "MCPServerConfigHTTP": assert isinstance(obj, dict) url = from_str(obj.get("url")) auth = from_union([MCPServerConfigHTTPAuth.from_dict, from_none], obj.get("auth")) - filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) + filter_mapping = from_union( + [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], + obj.get("filterMapping"), + ) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) - oauth_grant_type = from_union([MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType")) + oauth_grant_type = from_union( + [MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType") + ) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) - return MCPServerConfigHTTP(url, auth, filter_mapping, headers, is_default_server, oauth_client_id, oauth_grant_type, oauth_public_client, timeout, tools, type) + return MCPServerConfigHTTP( + url, + auth, + filter_mapping, + headers, + is_default_server, + oauth_client_id, + oauth_grant_type, + oauth_public_client, + timeout, + tools, + type, + ) def to_dict(self) -> dict: result: dict = {} result["url"] = from_str(self.url) if self.auth is not None: - result["auth"] = from_union([lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth) + result["auth"] = from_union( + [lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth + ) if self.filter_mapping is not None: - result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) + result["filterMapping"] = from_union( + [ + lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), + lambda x: to_enum(ContentFilterMode, x), + from_none, + ], + self.filter_mapping, + ) if self.headers is not None: - result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) + result["headers"] = from_union( + [lambda x: from_dict(from_str, x), from_none], self.headers + ) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.oauth_client_id is not None: result["oauthClientId"] = from_union([from_str, from_none], self.oauth_client_id) if self.oauth_grant_type is not None: - result["oauthGrantType"] = from_union([lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], self.oauth_grant_type) + result["oauthGrantType"] = from_union( + [lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], + self.oauth_grant_type, + ) if self.oauth_public_client is not None: - result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) + result["oauthPublicClient"] = from_union( + [from_bool, from_none], self.oauth_public_client + ) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.type is not None: - result["type"] = from_union([lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type) + result["type"] = from_union( + [lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSamplingExecutionResult: @@ -8290,7 +9188,7 @@ class MCPSamplingExecutionResult: """ @staticmethod - def from_dict(obj: Any) -> 'MCPSamplingExecutionResult': + def from_dict(obj: Any) -> "MCPSamplingExecutionResult": assert isinstance(obj, dict) action = MCPSamplingExecutionAction(obj.get("action")) error = from_union([from_str, from_none], obj.get("error")) @@ -8303,9 +9201,12 @@ def to_dict(self) -> dict: if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result is not None: - result["result"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.result) + result["result"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.result + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerList: @@ -8315,7 +9216,7 @@ class MCPServerList: """Configured MCP servers""" @staticmethod - def from_dict(obj: Any) -> 'MCPServerList': + def from_dict(obj: Any) -> "MCPServerList": assert isinstance(obj, dict) servers = from_list(MCPServer.from_dict, obj.get("servers")) return MCPServerList(servers) @@ -8325,6 +9226,7 @@ def to_dict(self) -> dict: result["servers"] = from_list(lambda x: to_class(MCPServer, x), self.servers) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSetEnvValueModeParams: @@ -8339,7 +9241,7 @@ class MCPSetEnvValueModeParams: """ @staticmethod - def from_dict(obj: Any) -> 'MCPSetEnvValueModeParams': + def from_dict(obj: Any) -> "MCPSetEnvValueModeParams": assert isinstance(obj, dict) mode = MCPSetEnvValueModeDetails(obj.get("mode")) return MCPSetEnvValueModeParams(mode) @@ -8349,6 +9251,7 @@ def to_dict(self) -> dict: result["mode"] = to_enum(MCPSetEnvValueModeDetails, self.mode) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSetEnvValueModeResult: @@ -8358,7 +9261,7 @@ class MCPSetEnvValueModeResult: """Mode recorded on the session after the update""" @staticmethod - def from_dict(obj: Any) -> 'MCPSetEnvValueModeResult': + def from_dict(obj: Any) -> "MCPSetEnvValueModeResult": assert isinstance(obj, dict) mode = MCPSetEnvValueModeDetails(obj.get("mode")) return MCPSetEnvValueModeResult(mode) @@ -8368,6 +9271,7 @@ def to_dict(self) -> dict: result["mode"] = to_enum(MCPSetEnvValueModeDetails, self.mode) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataContextInfoResult: @@ -8379,7 +9283,7 @@ class MetadataContextInfoResult: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataContextInfoResult': + def from_dict(obj: Any) -> "MetadataContextInfoResult": assert isinstance(obj, dict) context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("contextInfo")) return MetadataContextInfoResult(context_info) @@ -8387,15 +9291,19 @@ def from_dict(obj: Any) -> 'MetadataContextInfoResult': def to_dict(self) -> dict: result: dict = {} if self.context_info is not None: - result["contextInfo"] = from_union([lambda x: to_class(SessionContextInfo, x), from_none], self.context_info) + result["contextInfo"] = from_union( + [lambda x: to_class(SessionContextInfo, x), from_none], self.context_info + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionWorkingDirectoryContext: """Updated working directory and git context. Emitted as the new payload of `session.context_changed`. """ + cwd: str """Current working directory path""" @@ -8422,7 +9330,7 @@ class SessionWorkingDirectoryContext: """Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com")""" @staticmethod - def from_dict(obj: Any) -> 'SessionWorkingDirectoryContext': + def from_dict(obj: Any) -> "SessionWorkingDirectoryContext": assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) base_commit = from_union([from_str, from_none], obj.get("baseCommit")) @@ -8432,7 +9340,9 @@ def from_dict(obj: Any) -> 'SessionWorkingDirectoryContext': host_type = from_union([HostType, from_none], obj.get("hostType")) repository = from_union([from_str, from_none], obj.get("repository")) repository_host = from_union([from_str, from_none], obj.get("repositoryHost")) - return SessionWorkingDirectoryContext(cwd, base_commit, branch, git_root, head_commit, host_type, repository, repository_host) + return SessionWorkingDirectoryContext( + cwd, base_commit, branch, git_root, head_commit, host_type, repository, repository_host + ) def to_dict(self) -> dict: result: dict = {} @@ -8446,13 +9356,16 @@ def to_dict(self) -> dict: if self.head_commit is not None: result["headCommit"] = from_union([from_str, from_none], self.head_commit) if self.host_type is not None: - result["hostType"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) + result["hostType"] = from_union( + [lambda x: to_enum(HostType, x), from_none], self.host_type + ) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) if self.repository_host is not None: result["repositoryHost"] = from_union([from_str, from_none], self.repository_host) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionContext: @@ -8461,6 +9374,7 @@ class SessionContext: Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. """ + cwd: str """Most recent working directory for this session""" @@ -8477,7 +9391,7 @@ class SessionContext: """Repository slug in `owner/name` form, when known""" @staticmethod - def from_dict(obj: Any) -> 'SessionContext': + def from_dict(obj: Any) -> "SessionContext": assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) branch = from_union([from_str, from_none], obj.get("branch")) @@ -8494,11 +9408,14 @@ def to_dict(self) -> dict: if self.git_root is not None: result["gitRoot"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: - result["hostType"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) + result["hostType"] = from_union( + [lambda x: to_enum(HostType, x), from_none], self.host_type + ) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) return result + @dataclass class Workspace: id: str @@ -8521,11 +9438,13 @@ class Workspace: user_named: bool | None = None @staticmethod - def from_dict(obj: Any) -> 'Workspace': + def from_dict(obj: Any) -> "Workspace": assert isinstance(obj, dict) id = from_str(obj.get("id")) branch = from_union([from_str, from_none], obj.get("branch")) - chronicle_sync_dismissed = from_union([from_bool, from_none], obj.get("chronicle_sync_dismissed")) + chronicle_sync_dismissed = from_union( + [from_bool, from_none], obj.get("chronicle_sync_dismissed") + ) created_at = from_union([from_datetime, from_none], obj.get("created_at")) cwd = from_union([from_str, from_none], obj.get("cwd")) git_root = from_union([from_str, from_none], obj.get("git_root")) @@ -8539,7 +9458,24 @@ def from_dict(obj: Any) -> 'Workspace': summary_count = from_union([from_int, from_none], obj.get("summary_count")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) user_named = from_union([from_bool, from_none], obj.get("user_named")) - return Workspace(id, branch, chronicle_sync_dismissed, created_at, cwd, git_root, host_type, mc_last_event_id, mc_session_id, mc_task_id, name, remote_steerable, repository, summary_count, updated_at, user_named) + return Workspace( + id, + branch, + chronicle_sync_dismissed, + created_at, + cwd, + git_root, + host_type, + mc_last_event_id, + mc_session_id, + mc_task_id, + name, + remote_steerable, + repository, + summary_count, + updated_at, + user_named, + ) def to_dict(self) -> dict: result: dict = {} @@ -8547,7 +9483,9 @@ def to_dict(self) -> dict: if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.chronicle_sync_dismissed is not None: - result["chronicle_sync_dismissed"] = from_union([from_bool, from_none], self.chronicle_sync_dismissed) + result["chronicle_sync_dismissed"] = from_union( + [from_bool, from_none], self.chronicle_sync_dismissed + ) if self.created_at is not None: result["created_at"] = from_union([lambda x: x.isoformat(), from_none], self.created_at) if self.cwd is not None: @@ -8555,7 +9493,9 @@ def to_dict(self) -> dict: if self.git_root is not None: result["git_root"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: - result["host_type"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) + result["host_type"] = from_union( + [lambda x: to_enum(HostType, x), from_none], self.host_type + ) if self.mc_last_event_id is not None: result["mc_last_event_id"] = from_union([from_str, from_none], self.mc_last_event_id) if self.mc_session_id is not None: @@ -8576,12 +9516,14 @@ def to_dict(self) -> dict: result["user_named"] = from_union([from_bool, from_none], self.user_named) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSnapshotRemoteMetadata: """Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. """ + repository: MetadataSnapshotRemoteMetadataRepository """The repository the remote session targets.""" @@ -8598,25 +9540,35 @@ class MetadataSnapshotRemoteMetadata: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataSnapshotRemoteMetadata': + def from_dict(obj: Any) -> "MetadataSnapshotRemoteMetadata": assert isinstance(obj, dict) repository = MetadataSnapshotRemoteMetadataRepository.from_dict(obj.get("repository")) pull_request_number = from_union([from_int, from_none], obj.get("pullRequestNumber")) resource_id = from_union([from_str, from_none], obj.get("resourceId")) - task_type = from_union([MetadataSnapshotRemoteMetadataTaskType, from_none], obj.get("taskType")) - return MetadataSnapshotRemoteMetadata(repository, pull_request_number, resource_id, task_type) + task_type = from_union( + [MetadataSnapshotRemoteMetadataTaskType, from_none], obj.get("taskType") + ) + return MetadataSnapshotRemoteMetadata( + repository, pull_request_number, resource_id, task_type + ) def to_dict(self) -> dict: result: dict = {} result["repository"] = to_class(MetadataSnapshotRemoteMetadataRepository, self.repository) if self.pull_request_number is not None: - result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) + result["pullRequestNumber"] = from_union( + [from_int, from_none], self.pull_request_number + ) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.task_type is not None: - result["taskType"] = from_union([lambda x: to_enum(MetadataSnapshotRemoteMetadataTaskType, x), from_none], self.task_type) + result["taskType"] = from_union( + [lambda x: to_enum(MetadataSnapshotRemoteMetadataTaskType, x), from_none], + self.task_type, + ) return result + @dataclass class ModelBillingTokenPrices: """Token-level pricing information for this model""" @@ -8640,15 +9592,19 @@ class ModelBillingTokenPrices: """AI Credits cost per billing batch of output tokens""" @staticmethod - def from_dict(obj: Any) -> 'ModelBillingTokenPrices': + def from_dict(obj: Any) -> "ModelBillingTokenPrices": assert isinstance(obj, dict) batch_size = from_union([from_int, from_none], obj.get("batchSize")) cache_price = from_union([from_float, from_none], obj.get("cachePrice")) context_max = from_union([from_int, from_none], obj.get("contextMax")) input_price = from_union([from_float, from_none], obj.get("inputPrice")) - long_context = from_union([ModelBillingTokenPricesLongContext.from_dict, from_none], obj.get("longContext")) + long_context = from_union( + [ModelBillingTokenPricesLongContext.from_dict, from_none], obj.get("longContext") + ) output_price = from_union([from_float, from_none], obj.get("outputPrice")) - return ModelBillingTokenPrices(batch_size, cache_price, context_max, input_price, long_context, output_price) + return ModelBillingTokenPrices( + batch_size, cache_price, context_max, input_price, long_context, output_price + ) def to_dict(self) -> dict: result: dict = {} @@ -8661,11 +9617,15 @@ def to_dict(self) -> dict: if self.input_price is not None: result["inputPrice"] = from_union([to_float, from_none], self.input_price) if self.long_context is not None: - result["longContext"] = from_union([lambda x: to_class(ModelBillingTokenPricesLongContext, x), from_none], self.long_context) + result["longContext"] = from_union( + [lambda x: to_class(ModelBillingTokenPricesLongContext, x), from_none], + self.long_context, + ) if self.output_price is not None: result["outputPrice"] = from_union([to_float, from_none], self.output_price) return result + @dataclass class ModelCapabilitiesLimits: """Token limits for prompts, outputs, and context window""" @@ -8683,26 +9643,35 @@ class ModelCapabilitiesLimits: """Vision-specific limits""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesLimits': + def from_dict(obj: Any) -> "ModelCapabilitiesLimits": assert isinstance(obj, dict) - max_context_window_tokens = from_union([from_int, from_none], obj.get("max_context_window_tokens")) + max_context_window_tokens = from_union( + [from_int, from_none], obj.get("max_context_window_tokens") + ) max_output_tokens = from_union([from_int, from_none], obj.get("max_output_tokens")) max_prompt_tokens = from_union([from_int, from_none], obj.get("max_prompt_tokens")) vision = from_union([ModelCapabilitiesLimitsVision.from_dict, from_none], obj.get("vision")) - return ModelCapabilitiesLimits(max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision) + return ModelCapabilitiesLimits( + max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision + ) def to_dict(self) -> dict: result: dict = {} if self.max_context_window_tokens is not None: - result["max_context_window_tokens"] = from_union([from_int, from_none], self.max_context_window_tokens) + result["max_context_window_tokens"] = from_union( + [from_int, from_none], self.max_context_window_tokens + ) if self.max_output_tokens is not None: result["max_output_tokens"] = from_union([from_int, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["max_prompt_tokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.vision is not None: - result["vision"] = from_union([lambda x: to_class(ModelCapabilitiesLimitsVision, x), from_none], self.vision) + result["vision"] = from_union( + [lambda x: to_class(ModelCapabilitiesLimitsVision, x), from_none], self.vision + ) return result + @dataclass class ModelPolicy: """Policy state (if applicable)""" @@ -8714,7 +9683,7 @@ class ModelPolicy: """Usage terms or conditions for this model""" @staticmethod - def from_dict(obj: Any) -> 'ModelPolicy': + def from_dict(obj: Any) -> "ModelPolicy": assert isinstance(obj, dict) state = ModelPolicyState(obj.get("state")) terms = from_union([from_str, from_none], obj.get("terms")) @@ -8727,6 +9696,7 @@ def to_dict(self) -> dict: result["terms"] = from_union([from_str, from_none], self.terms) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideLimits: @@ -8745,26 +9715,38 @@ class ModelCapabilitiesOverrideLimits: """Vision-specific limits""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideLimits': + def from_dict(obj: Any) -> "ModelCapabilitiesOverrideLimits": assert isinstance(obj, dict) - max_context_window_tokens = from_union([from_int, from_none], obj.get("max_context_window_tokens")) + max_context_window_tokens = from_union( + [from_int, from_none], obj.get("max_context_window_tokens") + ) max_output_tokens = from_union([from_int, from_none], obj.get("max_output_tokens")) max_prompt_tokens = from_union([from_int, from_none], obj.get("max_prompt_tokens")) - vision = from_union([ModelCapabilitiesOverrideLimitsVision.from_dict, from_none], obj.get("vision")) - return ModelCapabilitiesOverrideLimits(max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision) + vision = from_union( + [ModelCapabilitiesOverrideLimitsVision.from_dict, from_none], obj.get("vision") + ) + return ModelCapabilitiesOverrideLimits( + max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision + ) def to_dict(self) -> dict: result: dict = {} if self.max_context_window_tokens is not None: - result["max_context_window_tokens"] = from_union([from_int, from_none], self.max_context_window_tokens) + result["max_context_window_tokens"] = from_union( + [from_int, from_none], self.max_context_window_tokens + ) if self.max_output_tokens is not None: result["max_output_tokens"] = from_union([from_int, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["max_prompt_tokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.vision is not None: - result["vision"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideLimitsVision, x), from_none], self.vision) + result["vision"] = from_union( + [lambda x: to_class(ModelCapabilitiesOverrideLimitsVision, x), from_none], + self.vision, + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PendingPermissionRequestList: @@ -8778,7 +9760,7 @@ class PendingPermissionRequestList: """ @staticmethod - def from_dict(obj: Any) -> 'PendingPermissionRequestList': + def from_dict(obj: Any) -> "PendingPermissionRequestList": assert isinstance(obj, dict) items = from_list(PendingPermissionRequest.from_dict, obj.get("items")) return PendingPermissionRequestList(items) @@ -8788,6 +9770,7 @@ def to_dict(self) -> dict: result["items"] = from_list(lambda x: to_class(PendingPermissionRequest, x), self.items) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocation: @@ -8803,7 +9786,7 @@ class PermissionDecisionApproveForLocation: """Location key (git root or cwd) to persist the approval to""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocation': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocation": assert isinstance(obj, dict) approval = _load_PermissionDecisionApproveForLocationApproval(obj.get("approval")) location_key = from_str(obj.get("locationKey")) @@ -8816,6 +9799,7 @@ def to_dict(self) -> dict: result["locationKey"] = from_str(self.location_key) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalCommands: @@ -8828,7 +9812,7 @@ class PermissionDecisionApproveForLocationApprovalCommands: """Approval scoped to specific command identifiers.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalCommands': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalCommands": assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionDecisionApproveForLocationApprovalCommands(command_identifiers) @@ -8839,6 +9823,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalCommands: @@ -8851,7 +9836,7 @@ class PermissionDecisionApproveForSessionApprovalCommands: """Approval scoped to specific command identifiers.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalCommands': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalCommands": assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionDecisionApproveForSessionApprovalCommands(command_identifiers) @@ -8862,6 +9847,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsCommands: @@ -8874,7 +9860,7 @@ class PermissionsLocationsAddToolApprovalDetailsCommands: """Approval scoped to specific command identifiers.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsCommands': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsCommands": assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionsLocationsAddToolApprovalDetailsCommands(command_identifiers) @@ -8885,6 +9871,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalCustomTool: @@ -8897,7 +9884,7 @@ class PermissionDecisionApproveForLocationApprovalCustomTool: """Custom tool name.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalCustomTool': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalCustomTool": assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionDecisionApproveForLocationApprovalCustomTool(tool_name) @@ -8908,6 +9895,7 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalCustomTool: @@ -8920,7 +9908,7 @@ class PermissionDecisionApproveForSessionApprovalCustomTool: """Custom tool name.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalCustomTool': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalCustomTool": assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionDecisionApproveForSessionApprovalCustomTool(tool_name) @@ -8931,6 +9919,7 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsCustomTool: @@ -8943,7 +9932,7 @@ class PermissionsLocationsAddToolApprovalDetailsCustomTool: """Custom tool name.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsCustomTool': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsCustomTool": assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionsLocationsAddToolApprovalDetailsCustomTool(tool_name) @@ -8954,6 +9943,7 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalExtensionManagement: @@ -8968,7 +9958,7 @@ class PermissionDecisionApproveForLocationApprovalExtensionManagement: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalExtensionManagement': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalExtensionManagement": assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionDecisionApproveForLocationApprovalExtensionManagement(operation) @@ -8980,6 +9970,7 @@ def to_dict(self) -> dict: result["operation"] = from_union([from_str, from_none], self.operation) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalExtensionManagement: @@ -8994,7 +9985,7 @@ class PermissionDecisionApproveForSessionApprovalExtensionManagement: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalExtensionManagement': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalExtensionManagement": assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionDecisionApproveForSessionApprovalExtensionManagement(operation) @@ -9006,6 +9997,7 @@ def to_dict(self) -> dict: result["operation"] = from_union([from_str, from_none], self.operation) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsExtensionManagement: @@ -9020,7 +10012,7 @@ class PermissionsLocationsAddToolApprovalDetailsExtensionManagement: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsExtensionManagement': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsExtensionManagement": assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionsLocationsAddToolApprovalDetailsExtensionManagement(operation) @@ -9032,6 +10024,7 @@ def to_dict(self) -> dict: result["operation"] = from_union([from_str, from_none], self.operation) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMCP: @@ -9047,7 +10040,7 @@ class PermissionDecisionApproveForLocationApprovalMCP: """MCP tool name, or null to cover every tool on the server.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMCP': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalMCP": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) @@ -9060,6 +10053,7 @@ def to_dict(self) -> dict: result["toolName"] = from_union([from_none, from_str], self.tool_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMCP: @@ -9075,7 +10069,7 @@ class PermissionDecisionApproveForSessionApprovalMCP: """MCP tool name, or null to cover every tool on the server.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMCP': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalMCP": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) @@ -9088,6 +10082,7 @@ def to_dict(self) -> dict: result["toolName"] = from_union([from_none, from_str], self.tool_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMCP: @@ -9103,7 +10098,7 @@ class PermissionsLocationsAddToolApprovalDetailsMCP: """MCP tool name, or null to cover every tool on the server.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMCP': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsMCP": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) @@ -9116,6 +10111,7 @@ def to_dict(self) -> dict: result["toolName"] = from_union([from_none, from_str], self.tool_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMCPSampling: @@ -9128,7 +10124,7 @@ class PermissionDecisionApproveForLocationApprovalMCPSampling: """MCP server name.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMCPSampling': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalMCPSampling": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionDecisionApproveForLocationApprovalMCPSampling(server_name) @@ -9139,6 +10135,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMCPSampling: @@ -9151,7 +10148,7 @@ class PermissionDecisionApproveForSessionApprovalMCPSampling: """MCP server name.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMCPSampling': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalMCPSampling": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionDecisionApproveForSessionApprovalMCPSampling(server_name) @@ -9162,6 +10159,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMCPSampling: @@ -9174,7 +10172,7 @@ class PermissionsLocationsAddToolApprovalDetailsMCPSampling: """MCP server name.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMCPSampling': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsMCPSampling": assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionsLocationsAddToolApprovalDetailsMCPSampling(server_name) @@ -9185,6 +10183,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMemory: @@ -9194,7 +10193,7 @@ class PermissionDecisionApproveForLocationApprovalMemory: """Approval covering writes to long-term memory.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMemory': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalMemory": assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalMemory() @@ -9203,6 +10202,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMemory: @@ -9212,7 +10212,7 @@ class PermissionDecisionApproveForSessionApprovalMemory: """Approval covering writes to long-term memory.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMemory': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalMemory": assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalMemory() @@ -9221,6 +10221,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMemory: @@ -9230,7 +10231,7 @@ class PermissionsLocationsAddToolApprovalDetailsMemory: """Approval covering writes to long-term memory.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMemory': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsMemory": assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsMemory() @@ -9239,6 +10240,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalRead: @@ -9248,7 +10250,7 @@ class PermissionDecisionApproveForLocationApprovalRead: """Approval covering read-only filesystem operations.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalRead': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalRead": assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalRead() @@ -9257,6 +10259,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalRead: @@ -9266,7 +10269,7 @@ class PermissionDecisionApproveForSessionApprovalRead: """Approval covering read-only filesystem operations.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalRead': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalRead": assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalRead() @@ -9275,6 +10278,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsRead: @@ -9284,7 +10288,7 @@ class PermissionsLocationsAddToolApprovalDetailsRead: """Approval covering read-only filesystem operations.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsRead': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsRead": assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsRead() @@ -9293,6 +10297,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalWrite: @@ -9302,7 +10307,7 @@ class PermissionDecisionApproveForLocationApprovalWrite: """Approval covering filesystem write operations.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalWrite': + def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalWrite": assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalWrite() @@ -9311,6 +10316,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalWrite: @@ -9320,7 +10326,7 @@ class PermissionDecisionApproveForSessionApprovalWrite: """Approval covering filesystem write operations.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalWrite': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalWrite": assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalWrite() @@ -9329,6 +10335,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsWrite: @@ -9338,7 +10345,7 @@ class PermissionsLocationsAddToolApprovalDetailsWrite: """Approval covering filesystem write operations.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsWrite': + def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsWrite": assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsWrite() @@ -9347,6 +10354,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSession: @@ -9362,9 +10370,11 @@ class PermissionDecisionApproveForSession: """URL domain to approve for the rest of the session (URL prompts only)""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSession': + def from_dict(obj: Any) -> "PermissionDecisionApproveForSession": assert isinstance(obj, dict) - approval = from_union([_load_PermissionDecisionApproveForSessionApproval, from_none], obj.get("approval")) + approval = from_union( + [_load_PermissionDecisionApproveForSessionApproval, from_none], obj.get("approval") + ) domain = from_union([from_str, from_none], obj.get("domain")) return PermissionDecisionApproveForSession(approval, domain) @@ -9377,6 +10387,7 @@ def to_dict(self) -> dict: result["domain"] = from_union([from_str, from_none], self.domain) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveOnce: @@ -9386,7 +10397,7 @@ class PermissionDecisionApproveOnce: """Approve this single request only""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveOnce': + def from_dict(obj: Any) -> "PermissionDecisionApproveOnce": assert isinstance(obj, dict) return PermissionDecisionApproveOnce() @@ -9395,6 +10406,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovePermanently: @@ -9407,7 +10419,7 @@ class PermissionDecisionApprovePermanently: """Approve and persist across sessions (URL prompts only)""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApprovePermanently': + def from_dict(obj: Any) -> "PermissionDecisionApprovePermanently": assert isinstance(obj, dict) domain = from_str(obj.get("domain")) return PermissionDecisionApprovePermanently(domain) @@ -9418,6 +10430,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproved: @@ -9427,7 +10440,7 @@ class PermissionDecisionApproved: """The permission request was approved""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproved': + def from_dict(obj: Any) -> "PermissionDecisionApproved": assert isinstance(obj, dict) return PermissionDecisionApproved() @@ -9436,6 +10449,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovedForLocation: @@ -9451,7 +10465,7 @@ class PermissionDecisionApprovedForLocation: """The location key (git root or cwd) to persist the approval to""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApprovedForLocation': + def from_dict(obj: Any) -> "PermissionDecisionApprovedForLocation": assert isinstance(obj, dict) approval = UserToolSessionApproval.from_dict(obj.get("approval")) location_key = from_str(obj.get("locationKey")) @@ -9464,6 +10478,7 @@ def to_dict(self) -> dict: result["locationKey"] = from_str(self.location_key) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovedForSession: @@ -9476,7 +10491,7 @@ class PermissionDecisionApprovedForSession: """Approved and remembered for the rest of the session""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApprovedForSession': + def from_dict(obj: Any) -> "PermissionDecisionApprovedForSession": assert isinstance(obj, dict) approval = UserToolSessionApproval.from_dict(obj.get("approval")) return PermissionDecisionApprovedForSession(approval) @@ -9487,6 +10502,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionCancelled: @@ -9499,7 +10515,7 @@ class PermissionDecisionCancelled: """Optional explanation of why the request was cancelled""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionCancelled': + def from_dict(obj: Any) -> "PermissionDecisionCancelled": assert isinstance(obj, dict) reason = from_union([from_str, from_none], obj.get("reason")) return PermissionDecisionCancelled(reason) @@ -9511,6 +10527,7 @@ def to_dict(self) -> dict: result["reason"] = from_union([from_str, from_none], self.reason) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByContentExclusionPolicy: @@ -9526,7 +10543,7 @@ class PermissionDecisionDeniedByContentExclusionPolicy: """File path that triggered the exclusion""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionDeniedByContentExclusionPolicy': + def from_dict(obj: Any) -> "PermissionDecisionDeniedByContentExclusionPolicy": assert isinstance(obj, dict) message = from_str(obj.get("message")) path = from_str(obj.get("path")) @@ -9539,6 +10556,7 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByPermissionRequestHook: @@ -9554,7 +10572,7 @@ class PermissionDecisionDeniedByPermissionRequestHook: """Optional message from the hook explaining the denial""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionDeniedByPermissionRequestHook': + def from_dict(obj: Any) -> "PermissionDecisionDeniedByPermissionRequestHook": assert isinstance(obj, dict) interrupt = from_union([from_bool, from_none], obj.get("interrupt")) message = from_union([from_str, from_none], obj.get("message")) @@ -9569,6 +10587,7 @@ def to_dict(self) -> dict: result["message"] = from_union([from_str, from_none], self.message) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByRules: @@ -9581,7 +10600,7 @@ class PermissionDecisionDeniedByRules: """Rules that denied the request""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionDeniedByRules': + def from_dict(obj: Any) -> "PermissionDecisionDeniedByRules": assert isinstance(obj, dict) rules = from_list(PermissionRule.from_dict, obj.get("rules")) return PermissionDecisionDeniedByRules(rules) @@ -9592,6 +10611,7 @@ def to_dict(self) -> dict: result["rules"] = from_list(lambda x: to_class(PermissionRule, x), self.rules) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedInteractivelyByUser: @@ -9607,7 +10627,7 @@ class PermissionDecisionDeniedInteractivelyByUser: """Whether to force-reject the current agent turn""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionDeniedInteractivelyByUser': + def from_dict(obj: Any) -> "PermissionDecisionDeniedInteractivelyByUser": assert isinstance(obj, dict) feedback = from_union([from_str, from_none], obj.get("feedback")) force_reject = from_union([from_bool, from_none], obj.get("forceReject")) @@ -9622,6 +10642,7 @@ def to_dict(self) -> dict: result["forceReject"] = from_union([from_bool, from_none], self.force_reject) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser: @@ -9631,7 +10652,7 @@ class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser: """Denied because no approval rule matched and user confirmation was unavailable""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser': + def from_dict(obj: Any) -> "PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser": assert isinstance(obj, dict) return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser() @@ -9640,6 +10661,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionReject: @@ -9652,7 +10674,7 @@ class PermissionDecisionReject: """Optional feedback explaining the rejection""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionReject': + def from_dict(obj: Any) -> "PermissionDecisionReject": assert isinstance(obj, dict) feedback = from_union([from_str, from_none], obj.get("feedback")) return PermissionDecisionReject(feedback) @@ -9664,6 +10686,7 @@ def to_dict(self) -> dict: result["feedback"] = from_union([from_str, from_none], self.feedback) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionUserNotAvailable: @@ -9673,7 +10696,7 @@ class PermissionDecisionUserNotAvailable: """No user is available to confirm the request""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionUserNotAvailable': + def from_dict(obj: Any) -> "PermissionDecisionUserNotAvailable": assert isinstance(obj, dict) return PermissionDecisionUserNotAvailable() @@ -9682,6 +10705,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationApplyResult: @@ -9706,7 +10730,7 @@ class PermissionLocationApplyResult: """Whether the location is a git repo or directory""" @staticmethod - def from_dict(obj: Any) -> 'PermissionLocationApplyResult': + def from_dict(obj: Any) -> "PermissionLocationApplyResult": assert isinstance(obj, dict) applied_directory_count = from_int(obj.get("appliedDirectoryCount")) applied_rule_count = from_int(obj.get("appliedRuleCount")) @@ -9714,18 +10738,28 @@ def from_dict(obj: Any) -> 'PermissionLocationApplyResult': changed = from_bool(obj.get("changed")) location_key = from_str(obj.get("locationKey")) location_type = PermissionLocationType(obj.get("locationType")) - return PermissionLocationApplyResult(applied_directory_count, applied_rule_count, applied_rules, changed, location_key, location_type) + return PermissionLocationApplyResult( + applied_directory_count, + applied_rule_count, + applied_rules, + changed, + location_key, + location_type, + ) def to_dict(self) -> dict: result: dict = {} result["appliedDirectoryCount"] = from_int(self.applied_directory_count) result["appliedRuleCount"] = from_int(self.applied_rule_count) - result["appliedRules"] = from_list(lambda x: to_class(PermissionRule, x), self.applied_rules) + result["appliedRules"] = from_list( + lambda x: to_class(PermissionRule, x), self.applied_rules + ) result["changed"] = from_bool(self.changed) result["locationKey"] = from_str(self.location_key) result["locationType"] = to_enum(PermissionLocationType, self.location_type) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationResolveResult: @@ -9738,7 +10772,7 @@ class PermissionLocationResolveResult: """Whether the location is a git repo or directory""" @staticmethod - def from_dict(obj: Any) -> 'PermissionLocationResolveResult': + def from_dict(obj: Any) -> "PermissionLocationResolveResult": assert isinstance(obj, dict) location_key = from_str(obj.get("locationKey")) location_type = PermissionLocationType(obj.get("locationType")) @@ -9750,6 +10784,7 @@ def to_dict(self) -> dict: result["locationType"] = to_enum(PermissionLocationType, self.location_type) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicyRule: @@ -9763,30 +10798,46 @@ class PermissionsConfigureAdditionalContentExclusionPolicyRule: if_none_match: list[str] | None = None @staticmethod - def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicyRule': + def from_dict(obj: Any) -> "PermissionsConfigureAdditionalContentExclusionPolicyRule": assert isinstance(obj, dict) paths = from_list(from_str, obj.get("paths")) - source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("source")) - if_any_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch")) - if_none_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch")) - return PermissionsConfigureAdditionalContentExclusionPolicyRule(paths, source, if_any_match, if_none_match) + source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict( + obj.get("source") + ) + if_any_match = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch") + ) + if_none_match = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch") + ) + return PermissionsConfigureAdditionalContentExclusionPolicyRule( + paths, source, if_any_match, if_none_match + ) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(from_str, self.paths) - result["source"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.source) + result["source"] = to_class( + PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.source + ) if self.if_any_match is not None: - result["ifAnyMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_any_match) + result["ifAnyMatch"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.if_any_match + ) if self.if_none_match is not None: - result["ifNoneMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_none_match) + result["ifNoneMatch"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.if_none_match + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsModifyRulesParams: """Scope and add/remove instructions for modifying session- or location-scoped permission rules. """ + scope: PermissionsModifyRulesScope """Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. @@ -9803,11 +10854,15 @@ class PermissionsModifyRulesParams: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionsModifyRulesParams': + def from_dict(obj: Any) -> "PermissionsModifyRulesParams": assert isinstance(obj, dict) scope = PermissionsModifyRulesScope(obj.get("scope")) - add = from_union([lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("add")) - remove = from_union([lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("remove")) + add = from_union( + [lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("add") + ) + remove = from_union( + [lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("remove") + ) remove_all = from_union([from_bool, from_none], obj.get("removeAll")) return PermissionsModifyRulesParams(scope, add, remove, remove_all) @@ -9815,13 +10870,19 @@ def to_dict(self) -> dict: result: dict = {} result["scope"] = to_enum(PermissionsModifyRulesScope, self.scope) if self.add is not None: - result["add"] = from_union([lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.add) + result["add"] = from_union( + [lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.add + ) if self.remove is not None: - result["remove"] = from_union([lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.remove) + result["remove"] = from_union( + [lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], + self.remove, + ) if self.remove_all is not None: result["removeAll"] = from_union([from_bool, from_none], self.remove_all) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginList: @@ -9831,7 +10892,7 @@ class PluginList: """Installed plugins""" @staticmethod - def from_dict(obj: Any) -> 'PluginList': + def from_dict(obj: Any) -> "PluginList": assert isinstance(obj, dict) plugins = from_list(Plugin.from_dict, obj.get("plugins")) return PluginList(plugins) @@ -9841,6 +10902,7 @@ def to_dict(self) -> dict: result["plugins"] = from_list(lambda x: to_class(Plugin, x), self.plugins) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuePendingItems: @@ -9853,7 +10915,7 @@ class QueuePendingItems: """Whether this item is a queued user message or a queued slash command / model change""" @staticmethod - def from_dict(obj: Any) -> 'QueuePendingItems': + def from_dict(obj: Any) -> "QueuePendingItems": assert isinstance(obj, dict) display_text = from_str(obj.get("displayText")) kind = QueuePendingItemsKind(obj.get("kind")) @@ -9865,19 +10927,21 @@ def to_dict(self) -> dict: result["kind"] = to_enum(QueuePendingItemsKind, self.kind) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteEnableRequest: """Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. """ + mode: RemoteSessionMode | None = None """Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. """ @staticmethod - def from_dict(obj: Any) -> 'RemoteEnableRequest': + def from_dict(obj: Any) -> "RemoteEnableRequest": assert isinstance(obj, dict) mode = from_union([RemoteSessionMode, from_none], obj.get("mode")) return RemoteEnableRequest(mode) @@ -9885,9 +10949,12 @@ def from_dict(obj: Any) -> 'RemoteEnableRequest': def to_dict(self) -> dict: result: dict = {} if self.mode is not None: - result["mode"] = from_union([lambda x: to_enum(RemoteSessionMode, x), from_none], self.mode) + result["mode"] = from_union( + [lambda x: to_enum(RemoteSessionMode, x), from_none], self.mode + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleList: @@ -9897,7 +10964,7 @@ class ScheduleList: """Active scheduled prompts, ordered by id.""" @staticmethod - def from_dict(obj: Any) -> 'ScheduleList': + def from_dict(obj: Any) -> "ScheduleList": assert isinstance(obj, dict) entries = from_list(ScheduleEntry.from_dict, obj.get("entries")) return ScheduleList(entries) @@ -9907,6 +10974,7 @@ def to_dict(self) -> dict: result["entries"] = from_list(lambda x: to_class(ScheduleEntry, x), self.entries) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleStopResult: @@ -9916,7 +10984,7 @@ class ScheduleStopResult: """The removed entry, or omitted if no entry matched.""" @staticmethod - def from_dict(obj: Any) -> 'ScheduleStopResult': + def from_dict(obj: Any) -> "ScheduleStopResult": assert isinstance(obj, dict) entry = from_union([ScheduleEntry.from_dict, from_none], obj.get("entry")) return ScheduleStopResult(entry) @@ -9924,9 +10992,12 @@ def from_dict(obj: Any) -> 'ScheduleStopResult': def to_dict(self) -> dict: result: dict = {} if self.entry is not None: - result["entry"] = from_union([lambda x: to_class(ScheduleEntry, x), from_none], self.entry) + result["entry"] = from_union( + [lambda x: to_class(ScheduleEntry, x), from_none], self.entry + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelectionDetails: @@ -9939,7 +11010,7 @@ class SendAttachmentSelectionDetails: """Start position of the selection""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentSelectionDetails': + def from_dict(obj: Any) -> "SendAttachmentSelectionDetails": assert isinstance(obj, dict) end = SendAttachmentSelectionDetailsEnd.from_dict(obj.get("end")) start = SendAttachmentSelectionDetailsStart.from_dict(obj.get("start")) @@ -9951,6 +11022,7 @@ def to_dict(self) -> dict: result["start"] = to_class(SendAttachmentSelectionDetailsStart, self.start) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentBlob: @@ -9969,7 +11041,7 @@ class SendAttachmentBlob: """User-facing display name for the attachment""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentBlob': + def from_dict(obj: Any) -> "SendAttachmentBlob": assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) @@ -9985,6 +11057,7 @@ def to_dict(self) -> dict: result["displayName"] = from_union([from_str, from_none], self.display_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentFile: @@ -10003,11 +11076,13 @@ class SendAttachmentFile: """Optional line range to scope the attachment to a specific section of the file""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentFile': + def from_dict(obj: Any) -> "SendAttachmentFile": assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) path = from_str(obj.get("path")) - line_range = from_union([SendAttachmentFileLineRange.from_dict, from_none], obj.get("lineRange")) + line_range = from_union( + [SendAttachmentFileLineRange.from_dict, from_none], obj.get("lineRange") + ) return SendAttachmentFile(display_name, path, line_range) def to_dict(self) -> dict: @@ -10016,9 +11091,12 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) result["type"] = self.type if self.line_range is not None: - result["lineRange"] = from_union([lambda x: to_class(SendAttachmentFileLineRange, x), from_none], self.line_range) + result["lineRange"] = from_union( + [lambda x: to_class(SendAttachmentFileLineRange, x), from_none], self.line_range + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentGithubReference: @@ -10043,7 +11121,7 @@ class SendAttachmentGithubReference: """URL to the referenced item on GitHub""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentGithubReference': + def from_dict(obj: Any) -> "SendAttachmentGithubReference": assert isinstance(obj, dict) number = from_int(obj.get("number")) reference_type = SendAttachmentGithubReferenceTypeEnum(obj.get("referenceType")) @@ -10055,13 +11133,16 @@ def from_dict(obj: Any) -> 'SendAttachmentGithubReference': def to_dict(self) -> dict: result: dict = {} result["number"] = from_int(self.number) - result["referenceType"] = to_enum(SendAttachmentGithubReferenceTypeEnum, self.reference_type) + result["referenceType"] = to_enum( + SendAttachmentGithubReferenceTypeEnum, self.reference_type + ) result["state"] = from_str(self.state) result["title"] = from_str(self.title) result["type"] = self.type result["url"] = from_str(self.url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendRequest: @@ -10119,30 +11200,52 @@ class SendRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SendRequest': + def from_dict(obj: Any) -> "SendRequest": assert isinstance(obj, dict) prompt = from_str(obj.get("prompt")) agent_mode = from_union([SendAgentMode, from_none], obj.get("agentMode")) - attachments = from_union([lambda x: from_list(_load_SendAttachment, x), from_none], obj.get("attachments")) + attachments = from_union( + [lambda x: from_list(_load_SendAttachment, x), from_none], obj.get("attachments") + ) billable = from_union([from_bool, from_none], obj.get("billable")) display_prompt = from_union([from_str, from_none], obj.get("displayPrompt")) mode = from_union([SendMode, from_none], obj.get("mode")) prepend = from_union([from_bool, from_none], obj.get("prepend")) - request_headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("requestHeaders")) + request_headers = from_union( + [lambda x: from_dict(from_str, x), from_none], obj.get("requestHeaders") + ) required_tool = from_union([from_str, from_none], obj.get("requiredTool")) source = obj.get("source") traceparent = from_union([from_str, from_none], obj.get("traceparent")) tracestate = from_union([from_str, from_none], obj.get("tracestate")) wait = from_union([from_bool, from_none], obj.get("wait")) - return SendRequest(prompt, agent_mode, attachments, billable, display_prompt, mode, prepend, request_headers, required_tool, source, traceparent, tracestate, wait) + return SendRequest( + prompt, + agent_mode, + attachments, + billable, + display_prompt, + mode, + prepend, + request_headers, + required_tool, + source, + traceparent, + tracestate, + wait, + ) def to_dict(self) -> dict: result: dict = {} result["prompt"] = from_str(self.prompt) if self.agent_mode is not None: - result["agentMode"] = from_union([lambda x: to_enum(SendAgentMode, x), from_none], self.agent_mode) + result["agentMode"] = from_union( + [lambda x: to_enum(SendAgentMode, x), from_none], self.agent_mode + ) if self.attachments is not None: - result["attachments"] = from_union([lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.attachments) + result["attachments"] = from_union( + [lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.attachments + ) if self.billable is not None: result["billable"] = from_union([from_bool, from_none], self.billable) if self.display_prompt is not None: @@ -10152,7 +11255,9 @@ def to_dict(self) -> dict: if self.prepend is not None: result["prepend"] = from_union([from_bool, from_none], self.prepend) if self.request_headers is not None: - result["requestHeaders"] = from_union([lambda x: from_dict(from_str, x), from_none], self.request_headers) + result["requestHeaders"] = from_union( + [lambda x: from_dict(from_str, x), from_none], self.request_headers + ) if self.required_tool is not None: result["requiredTool"] = from_union([from_str, from_none], self.required_tool) if self.source is not None: @@ -10165,6 +11270,7 @@ def to_dict(self) -> dict: result["wait"] = from_union([from_bool, from_none], self.wait) return result + @dataclass class ServerSkillList: """Skills discovered across global and project sources.""" @@ -10173,7 +11279,7 @@ class ServerSkillList: """All discovered skills across all sources""" @staticmethod - def from_dict(obj: Any) -> 'ServerSkillList': + def from_dict(obj: Any) -> "ServerSkillList": assert isinstance(obj, dict) skills = from_list(ServerSkill.from_dict, obj.get("skills")) return ServerSkillList(skills) @@ -10183,6 +11289,7 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(ServerSkill, x), self.skills) return result + @dataclass class SessionFSError: """Describes a filesystem error.""" @@ -10194,7 +11301,7 @@ class SessionFSError: """Free-form detail about the error, for logging/diagnostics""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSError': + def from_dict(obj: Any) -> "SessionFSError": assert isinstance(obj, dict) code = SessionFSErrorCode(obj.get("code")) message = from_union([from_str, from_none], obj.get("message")) @@ -10207,6 +11314,7 @@ def to_dict(self) -> dict: result["message"] = from_union([from_str, from_none], self.message) return result + @dataclass class SessionFSReaddirWithTypesEntry: """Schema for the `SessionFsReaddirWithTypesEntry` type.""" @@ -10218,7 +11326,7 @@ class SessionFSReaddirWithTypesEntry: """Entry type""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesEntry': + def from_dict(obj: Any) -> "SessionFSReaddirWithTypesEntry": assert isinstance(obj, dict) name = from_str(obj.get("name")) type = SessionFSReaddirWithTypesEntryType(obj.get("type")) @@ -10230,11 +11338,13 @@ def to_dict(self) -> dict: result["type"] = to_enum(SessionFSReaddirWithTypesEntryType, self.type) return result + @dataclass class SessionFSSetProviderRequest: """Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. """ + conventions: SessionFSSetProviderConventions """Path conventions used by this filesystem""" @@ -10248,13 +11358,17 @@ class SessionFSSetProviderRequest: """Optional capabilities declared by the provider""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSetProviderRequest': + def from_dict(obj: Any) -> "SessionFSSetProviderRequest": assert isinstance(obj, dict) conventions = SessionFSSetProviderConventions(obj.get("conventions")) initial_cwd = from_str(obj.get("initialCwd")) session_state_path = from_str(obj.get("sessionStatePath")) - capabilities = from_union([SessionFSSetProviderCapabilities.from_dict, from_none], obj.get("capabilities")) - return SessionFSSetProviderRequest(conventions, initial_cwd, session_state_path, capabilities) + capabilities = from_union( + [SessionFSSetProviderCapabilities.from_dict, from_none], obj.get("capabilities") + ) + return SessionFSSetProviderRequest( + conventions, initial_cwd, session_state_path, capabilities + ) def to_dict(self) -> dict: result: dict = {} @@ -10262,14 +11376,19 @@ def to_dict(self) -> dict: result["initialCwd"] = from_str(self.initial_cwd) result["sessionStatePath"] = from_str(self.session_state_path) if self.capabilities is not None: - result["capabilities"] = from_union([lambda x: to_class(SessionFSSetProviderCapabilities, x), from_none], self.capabilities) + result["capabilities"] = from_union( + [lambda x: to_class(SessionFSSetProviderCapabilities, x), from_none], + self.capabilities, + ) return result + @dataclass class SessionFSSqliteQueryRequest: """SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. """ + query: str """SQL query to execute""" @@ -10284,12 +11403,18 @@ class SessionFSSqliteQueryRequest: """Optional named bind parameters""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSqliteQueryRequest': + def from_dict(obj: Any) -> "SessionFSSqliteQueryRequest": assert isinstance(obj, dict) query = from_str(obj.get("query")) query_type = SessionFSSqliteQueryType(obj.get("queryType")) session_id = from_str(obj.get("sessionId")) - params = from_union([lambda x: from_dict(lambda x: from_union([from_none, from_float, from_str], x), x), from_none], obj.get("params")) + params = from_union( + [ + lambda x: from_dict(lambda x: from_union([from_none, from_float, from_str], x), x), + from_none, + ], + obj.get("params"), + ) return SessionFSSqliteQueryRequest(query, query_type, session_id, params) def to_dict(self) -> dict: @@ -10298,9 +11423,18 @@ def to_dict(self) -> dict: result["queryType"] = to_enum(SessionFSSqliteQueryType, self.query_type) result["sessionId"] = from_str(self.session_id) if self.params is not None: - result["params"] = from_union([lambda x: from_dict(lambda x: from_union([from_none, to_float, from_str], x), x), from_none], self.params) + result["params"] = from_union( + [ + lambda x: from_dict( + lambda x: from_union([from_none, to_float, from_str], x), x + ), + from_none, + ], + self.params, + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsListRequest: @@ -10316,7 +11450,7 @@ class SessionsListRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsListRequest': + def from_dict(obj: Any) -> "SessionsListRequest": assert isinstance(obj, dict) filter = from_union([SessionListFilter.from_dict, from_none], obj.get("filter")) metadata_limit = from_union([from_int, from_none], obj.get("metadataLimit")) @@ -10325,11 +11459,14 @@ def from_dict(obj: Any) -> 'SessionsListRequest': def to_dict(self) -> dict: result: dict = {} if self.filter is not None: - result["filter"] = from_union([lambda x: to_class(SessionListFilter, x), from_none], self.filter) + result["filter"] = from_union( + [lambda x: to_class(SessionListFilter, x), from_none], self.filter + ) if self.metadata_limit is not None: result["metadataLimit"] = from_union([from_int, from_none], self.metadata_limit) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellKillRequest: @@ -10342,7 +11479,7 @@ class ShellKillRequest: """Signal to send (default: SIGTERM)""" @staticmethod - def from_dict(obj: Any) -> 'ShellKillRequest': + def from_dict(obj: Any) -> "ShellKillRequest": assert isinstance(obj, dict) process_id = from_str(obj.get("processId")) signal = from_union([ShellKillSignal, from_none], obj.get("signal")) @@ -10352,9 +11489,12 @@ def to_dict(self) -> dict: result: dict = {} result["processId"] = from_str(self.process_id) if self.signal is not None: - result["signal"] = from_union([lambda x: to_enum(ShellKillSignal, x), from_none], self.signal) + result["signal"] = from_union( + [lambda x: to_enum(ShellKillSignal, x), from_none], self.signal + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentInfo: @@ -10362,6 +11502,7 @@ class AgentInfo: The newly selected custom agent """ + description: str """Description of the agent's purpose""" @@ -10402,20 +11543,34 @@ class AgentInfo: """ @staticmethod - def from_dict(obj: Any) -> 'AgentInfo': + def from_dict(obj: Any) -> "AgentInfo": assert isinstance(obj, dict) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) id = from_str(obj.get("id")) name = from_str(obj.get("name")) - mcp_servers = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("mcpServers")) + mcp_servers = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], obj.get("mcpServers") + ) model = from_union([from_str, from_none], obj.get("model")) path = from_union([from_str, from_none], obj.get("path")) skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skills")) source = from_union([AgentInfoSource, from_none], obj.get("source")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) user_invocable = from_union([from_bool, from_none], obj.get("userInvocable")) - return AgentInfo(description, display_name, id, name, mcp_servers, model, path, skills, source, tools, user_invocable) + return AgentInfo( + description, + display_name, + id, + name, + mcp_servers, + model, + path, + skills, + source, + tools, + user_invocable, + ) def to_dict(self) -> dict: result: dict = {} @@ -10424,21 +11579,28 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) result["name"] = from_str(self.name) if self.mcp_servers is not None: - result["mcpServers"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.mcp_servers) + result["mcpServers"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.mcp_servers + ) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.skills is not None: - result["skills"] = from_union([lambda x: from_list(from_str, x), from_none], self.skills) + result["skills"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.skills + ) if self.source is not None: - result["source"] = from_union([lambda x: to_enum(AgentInfoSource, x), from_none], self.source) + result["source"] = from_union( + [lambda x: to_enum(AgentInfoSource, x), from_none], self.source + ) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.user_invocable is not None: result["userInvocable"] = from_union([from_bool, from_none], self.user_invocable) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillList: @@ -10448,7 +11610,7 @@ class SkillList: """Available skills""" @staticmethod - def from_dict(obj: Any) -> 'SkillList': + def from_dict(obj: Any) -> "SkillList": assert isinstance(obj, dict) skills = from_list(Skill.from_dict, obj.get("skills")) return SkillList(skills) @@ -10458,6 +11620,7 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(Skill, x), self.skills) return result + @dataclass class SkillsConfigSetDisabledSkillsRequest: """Skill names to mark as disabled in global configuration, replacing any previous list.""" @@ -10466,7 +11629,7 @@ class SkillsConfigSetDisabledSkillsRequest: """List of skill names to disable""" @staticmethod - def from_dict(obj: Any) -> 'SkillsConfigSetDisabledSkillsRequest': + def from_dict(obj: Any) -> "SkillsConfigSetDisabledSkillsRequest": assert isinstance(obj, dict) disabled_skills = from_list(from_str, obj.get("disabledSkills")) return SkillsConfigSetDisabledSkillsRequest(disabled_skills) @@ -10476,6 +11639,7 @@ def to_dict(self) -> dict: result["disabledSkills"] = from_list(from_str, self.disabled_skills) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsGetInvokedResult: @@ -10485,7 +11649,7 @@ class SkillsGetInvokedResult: """Skills invoked during this session, ordered by invocation time (most recent last)""" @staticmethod - def from_dict(obj: Any) -> 'SkillsGetInvokedResult': + def from_dict(obj: Any) -> "SkillsGetInvokedResult": assert isinstance(obj, dict) skills = from_list(SkillsInvokedSkill.from_dict, obj.get("skills")) return SkillsGetInvokedResult(skills) @@ -10495,6 +11659,7 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(SkillsInvokedSkill, x), self.skills) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandAgentPromptResult: @@ -10518,12 +11683,14 @@ class SlashCommandAgentPromptResult: """ @staticmethod - def from_dict(obj: Any) -> 'SlashCommandAgentPromptResult': + def from_dict(obj: Any) -> "SlashCommandAgentPromptResult": assert isinstance(obj, dict) display_prompt = from_str(obj.get("displayPrompt")) prompt = from_str(obj.get("prompt")) mode = from_union([SessionMode, from_none], obj.get("mode")) - runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) + runtime_settings_changed = from_union( + [from_bool, from_none], obj.get("runtimeSettingsChanged") + ) return SlashCommandAgentPromptResult(display_prompt, prompt, mode, runtime_settings_changed) def to_dict(self) -> dict: @@ -10534,9 +11701,12 @@ def to_dict(self) -> dict: if self.mode is not None: result["mode"] = from_union([lambda x: to_enum(SessionMode, x), from_none], self.mode) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) + result["runtimeSettingsChanged"] = from_union( + [from_bool, from_none], self.runtime_settings_changed + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandCompletedResult: @@ -10554,10 +11724,12 @@ class SlashCommandCompletedResult: """ @staticmethod - def from_dict(obj: Any) -> 'SlashCommandCompletedResult': + def from_dict(obj: Any) -> "SlashCommandCompletedResult": assert isinstance(obj, dict) message = from_union([from_str, from_none], obj.get("message")) - runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) + runtime_settings_changed = from_union( + [from_bool, from_none], obj.get("runtimeSettingsChanged") + ) return SlashCommandCompletedResult(message, runtime_settings_changed) def to_dict(self) -> dict: @@ -10566,9 +11738,12 @@ def to_dict(self) -> dict: if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) + result["runtimeSettingsChanged"] = from_union( + [from_bool, from_none], self.runtime_settings_changed + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandSelectSubcommandResult: @@ -10592,24 +11767,31 @@ class SlashCommandSelectSubcommandResult: """ @staticmethod - def from_dict(obj: Any) -> 'SlashCommandSelectSubcommandResult': + def from_dict(obj: Any) -> "SlashCommandSelectSubcommandResult": assert isinstance(obj, dict) command = from_str(obj.get("command")) options = from_list(SlashCommandSelectSubcommandOption.from_dict, obj.get("options")) title = from_str(obj.get("title")) - runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) + runtime_settings_changed = from_union( + [from_bool, from_none], obj.get("runtimeSettingsChanged") + ) return SlashCommandSelectSubcommandResult(command, options, title, runtime_settings_changed) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) result["kind"] = self.kind - result["options"] = from_list(lambda x: to_class(SlashCommandSelectSubcommandOption, x), self.options) + result["options"] = from_list( + lambda x: to_class(SlashCommandSelectSubcommandOption, x), self.options + ) result["title"] = from_str(self.title) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) + result["runtimeSettingsChanged"] = from_union( + [from_bool, from_none], self.runtime_settings_changed + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskAgentProgress: @@ -10625,7 +11807,7 @@ class TaskAgentProgress: """The most recent intent reported by the agent""" @staticmethod - def from_dict(obj: Any) -> 'TaskAgentProgress': + def from_dict(obj: Any) -> "TaskAgentProgress": assert isinstance(obj, dict) recent_activity = from_list(TaskProgressLine.from_dict, obj.get("recentActivity")) type = TaskAgentInfoType(obj.get("type")) @@ -10634,12 +11816,15 @@ def from_dict(obj: Any) -> 'TaskAgentProgress': def to_dict(self) -> dict: result: dict = {} - result["recentActivity"] = from_list(lambda x: to_class(TaskProgressLine, x), self.recent_activity) + result["recentActivity"] = from_list( + lambda x: to_class(TaskProgressLine, x), self.recent_activity + ) result["type"] = to_enum(TaskAgentInfoType, self.type) if self.latest_intent is not None: result["latestIntent"] = from_union([from_str, from_none], self.latest_intent) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskShellInfo: @@ -10683,7 +11868,7 @@ class TaskShellInfo: """Process ID when available""" @staticmethod - def from_dict(obj: Any) -> 'TaskShellInfo': + def from_dict(obj: Any) -> "TaskShellInfo": assert isinstance(obj, dict) attachment_mode = TaskShellInfoAttachmentMode(obj.get("attachmentMode")) command = from_str(obj.get("command")) @@ -10691,12 +11876,26 @@ def from_dict(obj: Any) -> 'TaskShellInfo': id = from_str(obj.get("id")) started_at = from_datetime(obj.get("startedAt")) status = TaskStatus(obj.get("status")) - can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) + can_promote_to_background = from_union( + [from_bool, from_none], obj.get("canPromoteToBackground") + ) completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) execution_mode = from_union([TaskExecutionMode, from_none], obj.get("executionMode")) log_path = from_union([from_str, from_none], obj.get("logPath")) pid = from_union([from_int, from_none], obj.get("pid")) - return TaskShellInfo(attachment_mode, command, description, id, started_at, status, can_promote_to_background, completed_at, execution_mode, log_path, pid) + return TaskShellInfo( + attachment_mode, + command, + description, + id, + started_at, + status, + can_promote_to_background, + completed_at, + execution_mode, + log_path, + pid, + ) def to_dict(self) -> dict: result: dict = {} @@ -10708,17 +11907,24 @@ def to_dict(self) -> dict: result["status"] = to_enum(TaskStatus, self.status) result["type"] = self.type if self.can_promote_to_background is not None: - result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) + result["canPromoteToBackground"] = from_union( + [from_bool, from_none], self.can_promote_to_background + ) if self.completed_at is not None: - result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) + result["completedAt"] = from_union( + [lambda x: x.isoformat(), from_none], self.completed_at + ) if self.execution_mode is not None: - result["executionMode"] = from_union([lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode) + result["executionMode"] = from_union( + [lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode + ) if self.log_path is not None: result["logPath"] = from_union([from_str, from_none], self.log_path) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskShellProgress: @@ -10734,7 +11940,7 @@ class TaskShellProgress: """Process ID when available""" @staticmethod - def from_dict(obj: Any) -> 'TaskShellProgress': + def from_dict(obj: Any) -> "TaskShellProgress": assert isinstance(obj, dict) recent_output = from_str(obj.get("recentOutput")) type = TaskShellInfoType(obj.get("type")) @@ -10749,6 +11955,7 @@ def to_dict(self) -> dict: result["pid"] = from_union([from_int, from_none], self.pid) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsCallToolRequest: @@ -10769,12 +11976,14 @@ class MCPAppsCallToolRequest: """Tool arguments""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsCallToolRequest': + def from_dict(obj: Any) -> "MCPAppsCallToolRequest": assert isinstance(obj, dict) origin_server_name = from_str(obj.get("originServerName")) server_name = from_str(obj.get("serverName")) tool_name = from_str(obj.get("toolName")) - arguments = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("arguments")) + arguments = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], obj.get("arguments") + ) return MCPAppsCallToolRequest(origin_server_name, server_name, tool_name, arguments) def to_dict(self) -> dict: @@ -10783,9 +11992,12 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) result["toolName"] = from_str(self.tool_name) if self.arguments is not None: - result["arguments"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.arguments) + result["arguments"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.arguments + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationAddToolApprovalParams: @@ -10798,7 +12010,7 @@ class PermissionLocationAddToolApprovalParams: """Location key (git root or cwd) to persist the approval to""" @staticmethod - def from_dict(obj: Any) -> 'PermissionLocationAddToolApprovalParams': + def from_dict(obj: Any) -> "PermissionLocationAddToolApprovalParams": assert isinstance(obj, dict) approval = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("approval")) location_key = from_str(obj.get("locationKey")) @@ -10810,6 +12022,7 @@ def to_dict(self) -> dict: result["locationKey"] = from_str(self.location_key) return result + @dataclass class ToolList: """Built-in tools available for the requested model, with their parameters and instructions.""" @@ -10818,7 +12031,7 @@ class ToolList: """List of available built-in tools with metadata""" @staticmethod - def from_dict(obj: Any) -> 'ToolList': + def from_dict(obj: Any) -> "ToolList": assert isinstance(obj, dict) tools = from_list(Tool.from_dict, obj.get("tools")) return ToolList(tools) @@ -10828,6 +12041,7 @@ def to_dict(self) -> dict: result["tools"] = from_list(lambda x: to_class(Tool, x), self.tools) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingAutoModeSwitchRequest: @@ -10842,7 +12056,7 @@ class UIHandlePendingAutoModeSwitchRequest: """ @staticmethod - def from_dict(obj: Any) -> 'UIHandlePendingAutoModeSwitchRequest': + def from_dict(obj: Any) -> "UIHandlePendingAutoModeSwitchRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIAutoModeSwitchResponse(obj.get("response")) @@ -10854,6 +12068,7 @@ def to_dict(self) -> dict: result["response"] = to_enum(UIAutoModeSwitchResponse, self.response) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfFieldItems: @@ -10863,16 +12078,19 @@ class UIElicitationArrayAnyOfFieldItems: """Selectable options, each with a value and a display label.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfFieldItems': + def from_dict(obj: Any) -> "UIElicitationArrayAnyOfFieldItems": assert isinstance(obj, dict) any_of = from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, obj.get("anyOf")) return UIElicitationArrayAnyOfFieldItems(any_of) def to_dict(self) -> dict: result: dict = {} - result["anyOf"] = from_list(lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), self.any_of) + result["anyOf"] = from_list( + lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), self.any_of + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayEnumFieldItems: @@ -10885,7 +12103,7 @@ class UIElicitationArrayEnumFieldItems: """Type discriminator. Always "string".""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationArrayEnumFieldItems': + def from_dict(obj: Any) -> "UIElicitationArrayEnumFieldItems": assert isinstance(obj, dict) enum = from_list(from_str, obj.get("enum")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) @@ -10897,6 +12115,7 @@ def to_dict(self) -> dict: result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) return result + @dataclass class UIElicitationArrayFieldItems: """Schema applied to each item in the array.""" @@ -10911,11 +12130,14 @@ class UIElicitationArrayFieldItems: """Selectable options, each with a value and a display label.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationArrayFieldItems': + def from_dict(obj: Any) -> "UIElicitationArrayFieldItems": assert isinstance(obj, dict) enum = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enum")) type = from_union([UIElicitationArrayEnumFieldItemsType, from_none], obj.get("type")) - any_of = from_union([lambda x: from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, x), from_none], obj.get("anyOf")) + any_of = from_union( + [lambda x: from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, x), from_none], + obj.get("anyOf"), + ) return UIElicitationArrayFieldItems(enum, type, any_of) def to_dict(self) -> dict: @@ -10923,11 +12145,22 @@ def to_dict(self) -> dict: if self.enum is not None: result["enum"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum) if self.type is not None: - result["type"] = from_union([lambda x: to_enum(UIElicitationArrayEnumFieldItemsType, x), from_none], self.type) + result["type"] = from_union( + [lambda x: to_enum(UIElicitationArrayEnumFieldItemsType, x), from_none], self.type + ) if self.any_of is not None: - result["anyOf"] = from_union([lambda x: from_list(lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), x), from_none], self.any_of) + result["anyOf"] = from_union( + [ + lambda x: from_list( + lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), x + ), + from_none, + ], + self.any_of, + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringEnumField: @@ -10952,7 +12185,7 @@ class UIElicitationStringEnumField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationStringEnumField': + def from_dict(obj: Any) -> "UIElicitationStringEnumField": assert isinstance(obj, dict) enum = from_list(from_str, obj.get("enum")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) @@ -10971,11 +12204,14 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.enum_names is not None: - result["enumNames"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum_names) + result["enumNames"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.enum_names + ) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyString: @@ -11003,7 +12239,7 @@ class UIElicitationSchemaPropertyString: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyString': + def from_dict(obj: Any) -> "UIElicitationSchemaPropertyString": assert isinstance(obj, dict) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) default = from_union([from_str, from_none], obj.get("default")) @@ -11012,7 +12248,9 @@ def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyString': max_length = from_union([from_int, from_none], obj.get("maxLength")) min_length = from_union([from_int, from_none], obj.get("minLength")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationSchemaPropertyString(type, default, description, format, max_length, min_length, title) + return UIElicitationSchemaPropertyString( + type, default, description, format, max_length, min_length, title + ) def to_dict(self) -> dict: result: dict = {} @@ -11022,7 +12260,10 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.format is not None: - result["format"] = from_union([lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], self.format) + result["format"] = from_union( + [lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], + self.format, + ) if self.max_length is not None: result["maxLength"] = from_union([from_int, from_none], self.max_length) if self.min_length is not None: @@ -11031,6 +12272,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringOneOfField: @@ -11052,7 +12294,7 @@ class UIElicitationStringOneOfField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationStringOneOfField': + def from_dict(obj: Any) -> "UIElicitationStringOneOfField": assert isinstance(obj, dict) one_of = from_list(UIElicitationStringOneOfFieldOneOf.from_dict, obj.get("oneOf")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) @@ -11063,7 +12305,9 @@ def from_dict(obj: Any) -> 'UIElicitationStringOneOfField': def to_dict(self) -> dict: result: dict = {} - result["oneOf"] = from_list(lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), self.one_of) + result["oneOf"] = from_list( + lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), self.one_of + ) result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) if self.default is not None: result["default"] = from_union([from_str, from_none], self.default) @@ -11073,6 +12317,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationResponse: @@ -11085,19 +12330,42 @@ class UIElicitationResponse: """The form values submitted by the user (present when action is 'accept')""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationResponse': + def from_dict(obj: Any) -> "UIElicitationResponse": assert isinstance(obj, dict) action = UIElicitationResponseAction(obj.get("action")) - content = from_union([lambda x: from_dict(lambda x: from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], x), x), from_none], obj.get("content")) + content = from_union( + [ + lambda x: from_dict( + lambda x: from_union( + [from_float, from_bool, lambda x: from_list(from_str, x), from_str], x + ), + x, + ), + from_none, + ], + obj.get("content"), + ) return UIElicitationResponse(action, content) def to_dict(self) -> dict: result: dict = {} result["action"] = to_enum(UIElicitationResponseAction, self.action) if self.content is not None: - result["content"] = from_union([lambda x: from_dict(lambda x: from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], x), x), from_none], self.content) + result["content"] = from_union( + [ + lambda x: from_dict( + lambda x: from_union( + [to_float, from_bool, lambda x: from_list(from_str, x), from_str], x + ), + x, + ), + from_none, + ], + self.content, + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyBoolean: @@ -11116,7 +12384,7 @@ class UIElicitationSchemaPropertyBoolean: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyBoolean': + def from_dict(obj: Any) -> "UIElicitationSchemaPropertyBoolean": assert isinstance(obj, dict) type = UIElicitationSchemaPropertyBooleanType(obj.get("type")) default = from_union([from_bool, from_none], obj.get("default")) @@ -11135,6 +12403,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyNumber: @@ -11159,7 +12428,7 @@ class UIElicitationSchemaPropertyNumber: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyNumber': + def from_dict(obj: Any) -> "UIElicitationSchemaPropertyNumber": assert isinstance(obj, dict) type = UIElicitationSchemaPropertyNumberType(obj.get("type")) default = from_union([from_float, from_none], obj.get("default")) @@ -11167,7 +12436,9 @@ def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyNumber': maximum = from_union([from_float, from_none], obj.get("maximum")) minimum = from_union([from_float, from_none], obj.get("minimum")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationSchemaPropertyNumber(type, default, description, maximum, minimum, title) + return UIElicitationSchemaPropertyNumber( + type, default, description, maximum, minimum, title + ) def to_dict(self) -> dict: result: dict = {} @@ -11184,6 +12455,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIExitPlanModeResponse: @@ -11204,7 +12476,7 @@ class UIExitPlanModeResponse: """ @staticmethod - def from_dict(obj: Any) -> 'UIExitPlanModeResponse': + def from_dict(obj: Any) -> "UIExitPlanModeResponse": assert isinstance(obj, dict) approved = from_bool(obj.get("approved")) auto_approve_edits = from_union([from_bool, from_none], obj.get("autoApproveEdits")) @@ -11220,9 +12492,12 @@ def to_dict(self) -> dict: if self.feedback is not None: result["feedback"] = from_union([from_str, from_none], self.feedback) if self.selected_action is not None: - result["selectedAction"] = from_union([lambda x: to_enum(UIExitPlanModeAction, x), from_none], self.selected_action) + result["selectedAction"] = from_union( + [lambda x: to_enum(UIExitPlanModeAction, x), from_none], self.selected_action + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingUserInputRequest: @@ -11235,7 +12510,7 @@ class UIHandlePendingUserInputRequest: """Schema for the `UIUserInputResponse` type.""" @staticmethod - def from_dict(obj: Any) -> 'UIHandlePendingUserInputRequest': + def from_dict(obj: Any) -> "UIHandlePendingUserInputRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIUserInputResponse.from_dict(obj.get("response")) @@ -11247,6 +12522,7 @@ def to_dict(self) -> dict: result["response"] = to_class(UIUserInputResponse, self.response) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetric: @@ -11265,11 +12541,14 @@ class UsageMetricsModelMetric: """Accumulated nano-AI units cost for this model""" @staticmethod - def from_dict(obj: Any) -> 'UsageMetricsModelMetric': + def from_dict(obj: Any) -> "UsageMetricsModelMetric": assert isinstance(obj, dict) requests = UsageMetricsModelMetricRequests.from_dict(obj.get("requests")) usage = UsageMetricsModelMetricUsage.from_dict(obj.get("usage")) - token_details = from_union([lambda x: from_dict(UsageMetricsModelMetricTokenDetail.from_dict, x), from_none], obj.get("tokenDetails")) + token_details = from_union( + [lambda x: from_dict(UsageMetricsModelMetricTokenDetail.from_dict, x), from_none], + obj.get("tokenDetails"), + ) total_nano_aiu = from_union([from_float, from_none], obj.get("totalNanoAiu")) return UsageMetricsModelMetric(requests, usage, token_details, total_nano_aiu) @@ -11278,11 +12557,20 @@ def to_dict(self) -> dict: result["requests"] = to_class(UsageMetricsModelMetricRequests, self.requests) result["usage"] = to_class(UsageMetricsModelMetricUsage, self.usage) if self.token_details is not None: - result["tokenDetails"] = from_union([lambda x: from_dict(lambda x: to_class(UsageMetricsModelMetricTokenDetail, x), x), from_none], self.token_details) + result["tokenDetails"] = from_union( + [ + lambda x: from_dict( + lambda x: to_class(UsageMetricsModelMetricTokenDetail, x), x + ), + from_none, + ], + self.token_details, + ) if self.total_nano_aiu is not None: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceDiffFileChange: @@ -11304,7 +12592,7 @@ class WorkspaceDiffFileChange: """Original file path for renamed files.""" @staticmethod - def from_dict(obj: Any) -> 'WorkspaceDiffFileChange': + def from_dict(obj: Any) -> "WorkspaceDiffFileChange": assert isinstance(obj, dict) change_type = WorkspaceDiffFileChangeType(obj.get("changeType")) diff = from_str(obj.get("diff")) @@ -11324,6 +12612,7 @@ def to_dict(self) -> dict: result["oldPath"] = from_union([from_str, from_none], self.old_path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesDiffRequest: @@ -11333,7 +12622,7 @@ class WorkspacesDiffRequest: """Diff mode requested by the client.""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesDiffRequest': + def from_dict(obj: Any) -> "WorkspacesDiffRequest": assert isinstance(obj, dict) mode = WorkspaceDiffMode(obj.get("mode")) return WorkspacesDiffRequest(mode) @@ -11343,6 +12632,7 @@ def to_dict(self) -> dict: result["mode"] = to_enum(WorkspaceDiffMode, self.mode) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesSaveLargePasteResult: @@ -11354,7 +12644,7 @@ class WorkspacesSaveLargePasteResult: """ @staticmethod - def from_dict(obj: Any) -> 'WorkspacesSaveLargePasteResult': + def from_dict(obj: Any) -> "WorkspacesSaveLargePasteResult": assert isinstance(obj, dict) saved = from_union([Saved.from_dict, from_none], obj.get("saved")) return WorkspacesSaveLargePasteResult(saved) @@ -11364,6 +12654,7 @@ def to_dict(self) -> dict: result["saved"] = from_union([lambda x: to_class(Saved, x), from_none], self.saved) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasList: @@ -11373,7 +12664,7 @@ class CanvasList: """Declared canvases available in this session""" @staticmethod - def from_dict(obj: Any) -> 'CanvasList': + def from_dict(obj: Any) -> "CanvasList": assert isinstance(obj, dict) canvases = from_list(DiscoveredCanvas.from_dict, obj.get("canvases")) return CanvasList(canvases) @@ -11383,6 +12674,7 @@ def to_dict(self) -> dict: result["canvases"] = from_list(lambda x: to_class(DiscoveredCanvas, x), self.canvases) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasListOpenResult: @@ -11392,16 +12684,19 @@ class CanvasListOpenResult: """Currently open canvas instances""" @staticmethod - def from_dict(obj: Any) -> 'CanvasListOpenResult': + def from_dict(obj: Any) -> "CanvasListOpenResult": assert isinstance(obj, dict) open_canvases = from_list(OpenCanvasInstance.from_dict, obj.get("openCanvases")) return CanvasListOpenResult(open_canvases) def to_dict(self) -> dict: result: dict = {} - result["openCanvases"] = from_list(lambda x: to_class(OpenCanvasInstance, x), self.open_canvases) + result["openCanvases"] = from_list( + lambda x: to_class(OpenCanvasInstance, x), self.open_canvases + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInfo: @@ -11430,7 +12725,7 @@ class SlashCommandInfo: """Optional unstructured input hint""" @staticmethod - def from_dict(obj: Any) -> 'SlashCommandInfo': + def from_dict(obj: Any) -> "SlashCommandInfo": assert isinstance(obj, dict) allow_during_agent_execution = from_bool(obj.get("allowDuringAgentExecution")) description = from_str(obj.get("description")) @@ -11439,7 +12734,9 @@ def from_dict(obj: Any) -> 'SlashCommandInfo': aliases = from_union([lambda x: from_list(from_str, x), from_none], obj.get("aliases")) experimental = from_union([from_bool, from_none], obj.get("experimental")) input = from_union([SlashCommandInput.from_dict, from_none], obj.get("input")) - return SlashCommandInfo(allow_during_agent_execution, description, kind, name, aliases, experimental, input) + return SlashCommandInfo( + allow_during_agent_execution, description, kind, name, aliases, experimental, input + ) def to_dict(self) -> dict: result: dict = {} @@ -11448,13 +12745,18 @@ def to_dict(self) -> dict: result["kind"] = to_enum(SlashCommandKind, self.kind) result["name"] = from_str(self.name) if self.aliases is not None: - result["aliases"] = from_union([lambda x: from_list(from_str, x), from_none], self.aliases) + result["aliases"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.aliases + ) if self.experimental is not None: result["experimental"] = from_union([from_bool, from_none], self.experimental) if self.input is not None: - result["input"] = from_union([lambda x: to_class(SlashCommandInput, x), from_none], self.input) + result["input"] = from_union( + [lambda x: to_class(SlashCommandInput, x), from_none], self.input + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteSessionConnectionResult: @@ -11467,7 +12769,7 @@ class RemoteSessionConnectionResult: """SDK session ID for the connected remote session.""" @staticmethod - def from_dict(obj: Any) -> 'RemoteSessionConnectionResult': + def from_dict(obj: Any) -> "RemoteSessionConnectionResult": assert isinstance(obj, dict) metadata = ConnectedRemoteSessionMetadata.from_dict(obj.get("metadata")) session_id = from_str(obj.get("sessionId")) @@ -11479,6 +12781,31 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result + +@dataclass +class CanvasHostContext: + """Host context supplied by the runtime.""" + + capabilities: CanvasHostContextCapabilities | None = None + """Host capabilities""" + + @staticmethod + def from_dict(obj: Any) -> "CanvasHostContext": + assert isinstance(obj, dict) + capabilities = from_union( + [CanvasHostContextCapabilities.from_dict, from_none], obj.get("capabilities") + ) + return CanvasHostContext(capabilities) + + def to_dict(self) -> dict: + result: dict = {} + if self.capabilities is not None: + result["capabilities"] = from_union( + [lambda x: to_class(CanvasHostContextCapabilities, x), from_none], self.capabilities + ) + return result + + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponse: @@ -11486,6 +12813,7 @@ class CopilotUserResponse: GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ + access_type_sku: str | None = None analytics_tracking_id: str | None = None assigned_date: Any = None @@ -11515,83 +12843,174 @@ class CopilotUserResponse: token_based_billing: bool | None = None @staticmethod - def from_dict(obj: Any) -> 'CopilotUserResponse': + def from_dict(obj: Any) -> "CopilotUserResponse": assert isinstance(obj, dict) access_type_sku = from_union([from_str, from_none], obj.get("access_type_sku")) analytics_tracking_id = from_union([from_str, from_none], obj.get("analytics_tracking_id")) assigned_date = obj.get("assigned_date") - can_signup_for_limited = from_union([from_bool, from_none], obj.get("can_signup_for_limited")) + can_signup_for_limited = from_union( + [from_bool, from_none], obj.get("can_signup_for_limited") + ) chat_enabled = from_union([from_bool, from_none], obj.get("chat_enabled")) - cli_remote_control_enabled = from_union([from_bool, from_none], obj.get("cli_remote_control_enabled")) - cloud_session_storage_enabled = from_union([from_bool, from_none], obj.get("cloud_session_storage_enabled")) + cli_remote_control_enabled = from_union( + [from_bool, from_none], obj.get("cli_remote_control_enabled") + ) + cloud_session_storage_enabled = from_union( + [from_bool, from_none], obj.get("cloud_session_storage_enabled") + ) codex_agent_enabled = from_union([from_bool, from_none], obj.get("codex_agent_enabled")) copilot_plan = from_union([from_str, from_none], obj.get("copilot_plan")) copilotignore_enabled = from_union([from_bool, from_none], obj.get("copilotignore_enabled")) - endpoints = from_union([CopilotUserResponseEndpoints.from_dict, from_none], obj.get("endpoints")) + endpoints = from_union( + [CopilotUserResponseEndpoints.from_dict, from_none], obj.get("endpoints") + ) is_mcp_enabled = obj.get("is_mcp_enabled") - limited_user_quotas = from_union([lambda x: from_dict(from_float, x), from_none], obj.get("limited_user_quotas")) - limited_user_reset_date = from_union([from_str, from_none], obj.get("limited_user_reset_date")) + limited_user_quotas = from_union( + [lambda x: from_dict(from_float, x), from_none], obj.get("limited_user_quotas") + ) + limited_user_reset_date = from_union( + [from_str, from_none], obj.get("limited_user_reset_date") + ) login = from_union([from_str, from_none], obj.get("login")) - monthly_quotas = from_union([lambda x: from_dict(from_float, x), from_none], obj.get("monthly_quotas")) + monthly_quotas = from_union( + [lambda x: from_dict(from_float, x), from_none], obj.get("monthly_quotas") + ) organization_list = obj.get("organization_list") - organization_login_list = from_union([lambda x: from_list(from_str, x), from_none], obj.get("organization_login_list")) + organization_login_list = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("organization_login_list") + ) quota_reset_date = from_union([from_str, from_none], obj.get("quota_reset_date")) quota_reset_date_utc = from_union([from_str, from_none], obj.get("quota_reset_date_utc")) - quota_snapshots = from_union([lambda x: from_dict(lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), x), from_none], obj.get("quota_snapshots")) + quota_snapshots = from_union( + [ + lambda x: from_dict( + lambda x: from_union( + [CopilotUserResponseQuotaSnapshots.from_dict, from_none], x + ), + x, + ), + from_none, + ], + obj.get("quota_snapshots"), + ) restricted_telemetry = from_union([from_bool, from_none], obj.get("restricted_telemetry")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) - return CopilotUserResponse(access_type_sku, analytics_tracking_id, assigned_date, can_signup_for_limited, chat_enabled, cli_remote_control_enabled, cloud_session_storage_enabled, codex_agent_enabled, copilot_plan, copilotignore_enabled, endpoints, is_mcp_enabled, limited_user_quotas, limited_user_reset_date, login, monthly_quotas, organization_list, organization_login_list, quota_reset_date, quota_reset_date_utc, quota_snapshots, restricted_telemetry, token_based_billing) + return CopilotUserResponse( + access_type_sku, + analytics_tracking_id, + assigned_date, + can_signup_for_limited, + chat_enabled, + cli_remote_control_enabled, + cloud_session_storage_enabled, + codex_agent_enabled, + copilot_plan, + copilotignore_enabled, + endpoints, + is_mcp_enabled, + limited_user_quotas, + limited_user_reset_date, + login, + monthly_quotas, + organization_list, + organization_login_list, + quota_reset_date, + quota_reset_date_utc, + quota_snapshots, + restricted_telemetry, + token_based_billing, + ) def to_dict(self) -> dict: result: dict = {} if self.access_type_sku is not None: result["access_type_sku"] = from_union([from_str, from_none], self.access_type_sku) if self.analytics_tracking_id is not None: - result["analytics_tracking_id"] = from_union([from_str, from_none], self.analytics_tracking_id) + result["analytics_tracking_id"] = from_union( + [from_str, from_none], self.analytics_tracking_id + ) if self.assigned_date is not None: result["assigned_date"] = self.assigned_date if self.can_signup_for_limited is not None: - result["can_signup_for_limited"] = from_union([from_bool, from_none], self.can_signup_for_limited) + result["can_signup_for_limited"] = from_union( + [from_bool, from_none], self.can_signup_for_limited + ) if self.chat_enabled is not None: result["chat_enabled"] = from_union([from_bool, from_none], self.chat_enabled) if self.cli_remote_control_enabled is not None: - result["cli_remote_control_enabled"] = from_union([from_bool, from_none], self.cli_remote_control_enabled) + result["cli_remote_control_enabled"] = from_union( + [from_bool, from_none], self.cli_remote_control_enabled + ) if self.cloud_session_storage_enabled is not None: - result["cloud_session_storage_enabled"] = from_union([from_bool, from_none], self.cloud_session_storage_enabled) + result["cloud_session_storage_enabled"] = from_union( + [from_bool, from_none], self.cloud_session_storage_enabled + ) if self.codex_agent_enabled is not None: - result["codex_agent_enabled"] = from_union([from_bool, from_none], self.codex_agent_enabled) + result["codex_agent_enabled"] = from_union( + [from_bool, from_none], self.codex_agent_enabled + ) if self.copilot_plan is not None: result["copilot_plan"] = from_union([from_str, from_none], self.copilot_plan) if self.copilotignore_enabled is not None: - result["copilotignore_enabled"] = from_union([from_bool, from_none], self.copilotignore_enabled) + result["copilotignore_enabled"] = from_union( + [from_bool, from_none], self.copilotignore_enabled + ) if self.endpoints is not None: - result["endpoints"] = from_union([lambda x: to_class(CopilotUserResponseEndpoints, x), from_none], self.endpoints) + result["endpoints"] = from_union( + [lambda x: to_class(CopilotUserResponseEndpoints, x), from_none], self.endpoints + ) if self.is_mcp_enabled is not None: result["is_mcp_enabled"] = self.is_mcp_enabled if self.limited_user_quotas is not None: - result["limited_user_quotas"] = from_union([lambda x: from_dict(to_float, x), from_none], self.limited_user_quotas) + result["limited_user_quotas"] = from_union( + [lambda x: from_dict(to_float, x), from_none], self.limited_user_quotas + ) if self.limited_user_reset_date is not None: - result["limited_user_reset_date"] = from_union([from_str, from_none], self.limited_user_reset_date) + result["limited_user_reset_date"] = from_union( + [from_str, from_none], self.limited_user_reset_date + ) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) if self.monthly_quotas is not None: - result["monthly_quotas"] = from_union([lambda x: from_dict(to_float, x), from_none], self.monthly_quotas) + result["monthly_quotas"] = from_union( + [lambda x: from_dict(to_float, x), from_none], self.monthly_quotas + ) if self.organization_list is not None: result["organization_list"] = self.organization_list if self.organization_login_list is not None: - result["organization_login_list"] = from_union([lambda x: from_list(from_str, x), from_none], self.organization_login_list) + result["organization_login_list"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.organization_login_list + ) if self.quota_reset_date is not None: result["quota_reset_date"] = from_union([from_str, from_none], self.quota_reset_date) if self.quota_reset_date_utc is not None: - result["quota_reset_date_utc"] = from_union([from_str, from_none], self.quota_reset_date_utc) + result["quota_reset_date_utc"] = from_union( + [from_str, from_none], self.quota_reset_date_utc + ) if self.quota_snapshots is not None: - result["quota_snapshots"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x), x), from_none], self.quota_snapshots) + result["quota_snapshots"] = from_union( + [ + lambda x: from_dict( + lambda x: from_union( + [lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x + ), + x, + ), + from_none, + ], + self.quota_snapshots, + ) if self.restricted_telemetry is not None: - result["restricted_telemetry"] = from_union([from_bool, from_none], self.restricted_telemetry) + result["restricted_telemetry"] = from_union( + [from_bool, from_none], self.restricted_telemetry + ) if self.token_based_billing is not None: - result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) + result["token_based_billing"] = from_union( + [from_bool, from_none], self.token_based_billing + ) return result + @dataclass class MCPDiscoverResult: """MCP servers discovered from user, workspace, plugin, and built-in sources.""" @@ -11600,7 +13019,7 @@ class MCPDiscoverResult: """MCP servers discovered from all sources""" @staticmethod - def from_dict(obj: Any) -> 'MCPDiscoverResult': + def from_dict(obj: Any) -> "MCPDiscoverResult": assert isinstance(obj, dict) servers = from_list(DiscoveredMCPServer.from_dict, obj.get("servers")) return MCPDiscoverResult(servers) @@ -11610,6 +13029,7 @@ def to_dict(self) -> dict: result["servers"] = from_list(lambda x: to_class(DiscoveredMCPServer, x), self.servers) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionList: @@ -11619,7 +13039,7 @@ class ExtensionList: """Discovered extensions and their current status""" @staticmethod - def from_dict(obj: Any) -> 'ExtensionList': + def from_dict(obj: Any) -> "ExtensionList": assert isinstance(obj, dict) extensions = from_list(Extension.from_dict, obj.get("extensions")) return ExtensionList(extensions) @@ -11629,12 +13049,14 @@ def to_dict(self) -> dict: result["extensions"] = from_list(lambda x: to_class(Extension, x), self.extensions) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess: """Schema for the `PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess` type. """ + extension_name: str """Extension name.""" @@ -11642,7 +13064,9 @@ class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess: """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess': + def from_dict( + obj: Any, + ) -> "PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess": assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess(extension_name) @@ -11653,12 +13077,14 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess: """Schema for the `PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess` type. """ + extension_name: str """Extension name.""" @@ -11666,7 +13092,9 @@ class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess: """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess': + def from_dict( + obj: Any, + ) -> "PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess": assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess(extension_name) @@ -11677,6 +13105,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess: @@ -11689,7 +13118,9 @@ class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess: """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess': + def from_dict( + obj: Any, + ) -> "PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess": assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess(extension_name) @@ -11700,6 +13131,7 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlm: @@ -11728,24 +13160,53 @@ class ExternalToolTextResultForLlm: """Optional tool-specific telemetry""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlm': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlm": assert isinstance(obj, dict) text_result_for_llm = from_str(obj.get("textResultForLlm")) - binary_results_for_llm = from_union([lambda x: from_list(ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict, x), from_none], obj.get("binaryResultsForLlm")) - contents = from_union([lambda x: from_list(_load_ExternalToolTextResultForLlmContent, x), from_none], obj.get("contents")) + binary_results_for_llm = from_union( + [ + lambda x: from_list(ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict, x), + from_none, + ], + obj.get("binaryResultsForLlm"), + ) + contents = from_union( + [lambda x: from_list(_load_ExternalToolTextResultForLlmContent, x), from_none], + obj.get("contents"), + ) error = from_union([from_str, from_none], obj.get("error")) result_type = from_union([from_str, from_none], obj.get("resultType")) session_log = from_union([from_str, from_none], obj.get("sessionLog")) - tool_telemetry = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("toolTelemetry")) - return ExternalToolTextResultForLlm(text_result_for_llm, binary_results_for_llm, contents, error, result_type, session_log, tool_telemetry) + tool_telemetry = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], obj.get("toolTelemetry") + ) + return ExternalToolTextResultForLlm( + text_result_for_llm, + binary_results_for_llm, + contents, + error, + result_type, + session_log, + tool_telemetry, + ) def to_dict(self) -> dict: result: dict = {} result["textResultForLlm"] = from_str(self.text_result_for_llm) if self.binary_results_for_llm is not None: - result["binaryResultsForLlm"] = from_union([lambda x: from_list(lambda x: to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, x), x), from_none], self.binary_results_for_llm) + result["binaryResultsForLlm"] = from_union( + [ + lambda x: from_list( + lambda x: to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, x), x + ), + from_none, + ], + self.binary_results_for_llm, + ) if self.contents is not None: - result["contents"] = from_union([lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.contents) + result["contents"] = from_union( + [lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.contents + ) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result_type is not None: @@ -11753,9 +13214,12 @@ def to_dict(self) -> dict: if self.session_log is not None: result["sessionLog"] = from_union([from_str, from_none], self.session_log) if self.tool_telemetry is not None: - result["toolTelemetry"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.tool_telemetry) + result["toolTelemetry"] = from_union( + [lambda x: from_dict(lambda x: x, x), from_none], self.tool_telemetry + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResourceLink: @@ -11786,16 +13250,26 @@ class ExternalToolTextResultForLlmContentResourceLink: """Human-readable display title for the resource""" @staticmethod - def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResourceLink': + def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentResourceLink": assert isinstance(obj, dict) name = from_str(obj.get("name")) uri = from_str(obj.get("uri")) description = from_union([from_str, from_none], obj.get("description")) - icons = from_union([lambda x: from_list(ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict, x), from_none], obj.get("icons")) + icons = from_union( + [ + lambda x: from_list( + ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict, x + ), + from_none, + ], + obj.get("icons"), + ) mime_type = from_union([from_str, from_none], obj.get("mimeType")) size = from_union([from_int, from_none], obj.get("size")) title = from_union([from_str, from_none], obj.get("title")) - return ExternalToolTextResultForLlmContentResourceLink(name, uri, description, icons, mime_type, size, title) + return ExternalToolTextResultForLlmContentResourceLink( + name, uri, description, icons, mime_type, size, title + ) def to_dict(self) -> dict: result: dict = {} @@ -11805,7 +13279,16 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.icons is not None: - result["icons"] = from_union([lambda x: from_list(lambda x: to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, x), x), from_none], self.icons) + result["icons"] = from_union( + [ + lambda x: from_list( + lambda x: to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, x), + x, + ), + from_none, + ], + self.icons, + ) if self.mime_type is not None: result["mimeType"] = from_union([from_str, from_none], self.mime_type) if self.size is not None: @@ -11814,6 +13297,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSource: @@ -11823,6 +13307,7 @@ class InstalledPluginSource: Schema for the `InstalledPluginSourceLocal` type. """ + source: PurpleSource """Constant value. Always "github". @@ -11836,7 +13321,7 @@ class InstalledPluginSource: url: str | None = None @staticmethod - def from_dict(obj: Any) -> 'InstalledPluginSource': + def from_dict(obj: Any) -> "InstalledPluginSource": assert isinstance(obj, dict) source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) @@ -11858,6 +13343,7 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSource: @@ -11867,6 +13353,7 @@ class SessionInstalledPluginSource: Schema for the `SessionInstalledPluginSourceLocal` type. """ + source: PurpleSource """Constant value. Always "github". @@ -11880,7 +13367,7 @@ class SessionInstalledPluginSource: url: str | None = None @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPluginSource': + def from_dict(obj: Any) -> "SessionInstalledPluginSource": assert isinstance(obj, dict) source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) @@ -11902,6 +13389,7 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsGetSourcesResult: @@ -11911,7 +13399,7 @@ class InstructionsGetSourcesResult: """Instruction sources for the session""" @staticmethod - def from_dict(obj: Any) -> 'InstructionsGetSourcesResult': + def from_dict(obj: Any) -> "InstructionsGetSourcesResult": assert isinstance(obj, dict) sources = from_list(InstructionsSources.from_dict, obj.get("sources")) return InstructionsGetSourcesResult(sources) @@ -11921,6 +13409,7 @@ def to_dict(self) -> dict: result["sources"] = from_list(lambda x: to_class(InstructionsSources, x), self.sources) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsHostContext: @@ -11930,7 +13419,7 @@ class MCPAppsHostContext: """Current host context""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsHostContext': + def from_dict(obj: Any) -> "MCPAppsHostContext": assert isinstance(obj, dict) context = MCPAppsHostContextDetails.from_dict(obj.get("context")) return MCPAppsHostContext(context) @@ -11940,6 +13429,7 @@ def to_dict(self) -> dict: result["context"] = to_class(MCPAppsHostContextDetails, self.context) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsSetHostContextRequest: @@ -11949,7 +13439,7 @@ class MCPAppsSetHostContextRequest: """Host context advertised to MCP App guests""" @staticmethod - def from_dict(obj: Any) -> 'MCPAppsSetHostContextRequest': + def from_dict(obj: Any) -> "MCPAppsSetHostContextRequest": assert isinstance(obj, dict) context = MCPAppsSetHostContextDetails.from_dict(obj.get("context")) return MCPAppsSetHostContextRequest(context) @@ -11959,6 +13449,7 @@ def to_dict(self) -> dict: result["context"] = to_class(MCPAppsSetHostContextDetails, self.context) return result + @dataclass class MCPConfigAddRequest: """MCP server name and configuration to add to user configuration.""" @@ -11970,7 +13461,7 @@ class MCPConfigAddRequest: """Unique name for the MCP server""" @staticmethod - def from_dict(obj: Any) -> 'MCPConfigAddRequest': + def from_dict(obj: Any) -> "MCPConfigAddRequest": assert isinstance(obj, dict) config = MCPServerConfig.from_dict(obj.get("config")) name = from_str(obj.get("name")) @@ -11982,6 +13473,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + @dataclass class MCPConfigList: """User-configured MCP servers, keyed by server name.""" @@ -11990,7 +13482,7 @@ class MCPConfigList: """All MCP servers from user config, keyed by name""" @staticmethod - def from_dict(obj: Any) -> 'MCPConfigList': + def from_dict(obj: Any) -> "MCPConfigList": assert isinstance(obj, dict) servers = from_dict(MCPServerConfig.from_dict, obj.get("servers")) return MCPConfigList(servers) @@ -12000,6 +13492,7 @@ def to_dict(self) -> dict: result["servers"] = from_dict(lambda x: to_class(MCPServerConfig, x), self.servers) return result + @dataclass class MCPConfigUpdateRequest: """MCP server name and replacement configuration to write to user configuration.""" @@ -12011,7 +13504,7 @@ class MCPConfigUpdateRequest: """Name of the MCP server to update""" @staticmethod - def from_dict(obj: Any) -> 'MCPConfigUpdateRequest': + def from_dict(obj: Any) -> "MCPConfigUpdateRequest": assert isinstance(obj, dict) config = MCPServerConfig.from_dict(obj.get("config")) name = from_str(obj.get("name")) @@ -12023,6 +13516,7 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecordContextChangeRequest: @@ -12034,7 +13528,7 @@ class MetadataRecordContextChangeRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataRecordContextChangeRequest': + def from_dict(obj: Any) -> "MetadataRecordContextChangeRequest": assert isinstance(obj, dict) context = SessionWorkingDirectoryContext.from_dict(obj.get("context")) return MetadataRecordContextChangeRequest(context) @@ -12044,6 +13538,7 @@ def to_dict(self) -> dict: result["context"] = to_class(SessionWorkingDirectoryContext, self.context) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionMetadata: @@ -12075,7 +13570,7 @@ class SessionMetadata: """Short summary of the session, when one has been derived""" @staticmethod - def from_dict(obj: Any) -> 'SessionMetadata': + def from_dict(obj: Any) -> "SessionMetadata": assert isinstance(obj, dict) is_remote = from_bool(obj.get("isRemote")) modified_time = from_str(obj.get("modifiedTime")) @@ -12085,7 +13580,9 @@ def from_dict(obj: Any) -> 'SessionMetadata': mc_task_id = from_union([from_str, from_none], obj.get("mcTaskId")) name = from_union([from_str, from_none], obj.get("name")) summary = from_union([from_str, from_none], obj.get("summary")) - return SessionMetadata(is_remote, modified_time, session_id, start_time, context, mc_task_id, name, summary) + return SessionMetadata( + is_remote, modified_time, session_id, start_time, context, mc_task_id, name, summary + ) def to_dict(self) -> dict: result: dict = {} @@ -12094,7 +13591,9 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) result["startTime"] = from_str(self.start_time) if self.context is not None: - result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) + result["context"] = from_union( + [lambda x: to_class(SessionContext, x), from_none], self.context + ) if self.mc_task_id is not None: result["mcTaskId"] = from_union([from_str, from_none], self.mc_task_id) if self.name is not None: @@ -12103,6 +13602,7 @@ def to_dict(self) -> dict: result["summary"] = from_union([from_str, from_none], self.summary) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetLastForContextRequest: @@ -12114,7 +13614,7 @@ class SessionsGetLastForContextRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsGetLastForContextRequest': + def from_dict(obj: Any) -> "SessionsGetLastForContextRequest": assert isinstance(obj, dict) context = from_union([SessionContext.from_dict, from_none], obj.get("context")) return SessionsGetLastForContextRequest(context) @@ -12122,9 +13622,12 @@ def from_dict(obj: Any) -> 'SessionsGetLastForContextRequest': def to_dict(self) -> dict: result: dict = {} if self.context is not None: - result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) + result["context"] = from_union( + [lambda x: to_class(SessionContext, x), from_none], self.context + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsConfig: @@ -12132,6 +13635,7 @@ class PermissionPathsConfig: appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. """ + additional_directories: list[str] | None = None """Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the @@ -12152,26 +13656,35 @@ class PermissionPathsConfig: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionPathsConfig': + def from_dict(obj: Any) -> "PermissionPathsConfig": assert isinstance(obj, dict) - additional_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("additionalDirectories")) + additional_directories = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("additionalDirectories") + ) include_temp_directory = from_union([from_bool, from_none], obj.get("includeTempDirectory")) unrestricted = from_union([from_bool, from_none], obj.get("unrestricted")) workspace_path = from_union([from_str, from_none], obj.get("workspacePath")) - return PermissionPathsConfig(additional_directories, include_temp_directory, unrestricted, workspace_path) + return PermissionPathsConfig( + additional_directories, include_temp_directory, unrestricted, workspace_path + ) def to_dict(self) -> dict: result: dict = {} if self.additional_directories is not None: - result["additionalDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.additional_directories) + result["additionalDirectories"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.additional_directories + ) if self.include_temp_directory is not None: - result["includeTempDirectory"] = from_union([from_bool, from_none], self.include_temp_directory) + result["includeTempDirectory"] = from_union( + [from_bool, from_none], self.include_temp_directory + ) if self.unrestricted is not None: result["unrestricted"] = from_union([from_bool, from_none], self.unrestricted) if self.workspace_path is not None: result["workspacePath"] = from_union([from_str, from_none], self.workspace_path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceSummary: @@ -12205,7 +13718,7 @@ class WorkspaceSummary: """ISO 8601 timestamp when the workspace was last updated""" @staticmethod - def from_dict(obj: Any) -> 'WorkspaceSummary': + def from_dict(obj: Any) -> "WorkspaceSummary": assert isinstance(obj, dict) id = from_str(obj.get("id")) branch = from_union([from_str, from_none], obj.get("branch")) @@ -12216,7 +13729,9 @@ def from_dict(obj: Any) -> 'WorkspaceSummary': name = from_union([from_str, from_none], obj.get("name")) repository = from_union([from_str, from_none], obj.get("repository")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) - return WorkspaceSummary(id, branch, created_at, cwd, git_root, host_type, name, repository, updated_at) + return WorkspaceSummary( + id, branch, created_at, cwd, git_root, host_type, name, repository, updated_at + ) def to_dict(self) -> dict: result: dict = {} @@ -12230,7 +13745,9 @@ def to_dict(self) -> dict: if self.git_root is not None: result["git_root"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: - result["host_type"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) + result["host_type"] = from_union( + [lambda x: to_enum(HostType, x), from_none], self.host_type + ) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.repository is not None: @@ -12239,12 +13756,14 @@ def to_dict(self) -> dict: result["updated_at"] = from_union([lambda x: x.isoformat(), from_none], self.updated_at) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesGetWorkspaceResult: """Current workspace metadata for the session, including its absolute filesystem path when available. """ + path: str | None = None """Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). @@ -12253,7 +13772,7 @@ class WorkspacesGetWorkspaceResult: """Current workspace metadata, or null if not available""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesGetWorkspaceResult': + def from_dict(obj: Any) -> "WorkspacesGetWorkspaceResult": assert isinstance(obj, dict) path = from_union([from_str, from_none], obj.get("path")) workspace = from_union([Workspace.from_dict, from_none], obj.get("workspace")) @@ -12263,9 +13782,12 @@ def to_dict(self) -> dict: result: dict = {} if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) - result["workspace"] = from_union([lambda x: to_class(Workspace, x), from_none], self.workspace) + result["workspace"] = from_union( + [lambda x: to_class(Workspace, x), from_none], self.workspace + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesListCheckpointsResult: @@ -12275,16 +13797,19 @@ class WorkspacesListCheckpointsResult: """Workspace checkpoints in chronological order. Empty when workspace is not enabled.""" @staticmethod - def from_dict(obj: Any) -> 'WorkspacesListCheckpointsResult': + def from_dict(obj: Any) -> "WorkspacesListCheckpointsResult": assert isinstance(obj, dict) checkpoints = from_list(WorkspacesCheckpoints.from_dict, obj.get("checkpoints")) return WorkspacesListCheckpointsResult(checkpoints) def to_dict(self) -> dict: result: dict = {} - result["checkpoints"] = from_list(lambda x: to_class(WorkspacesCheckpoints, x), self.checkpoints) + result["checkpoints"] = from_list( + lambda x: to_class(WorkspacesCheckpoints, x), self.checkpoints + ) return result + @dataclass class ModelBilling: """Billing information""" @@ -12296,10 +13821,12 @@ class ModelBilling: """Token-level pricing information for this model""" @staticmethod - def from_dict(obj: Any) -> 'ModelBilling': + def from_dict(obj: Any) -> "ModelBilling": assert isinstance(obj, dict) multiplier = from_union([from_float, from_none], obj.get("multiplier")) - token_prices = from_union([ModelBillingTokenPrices.from_dict, from_none], obj.get("tokenPrices")) + token_prices = from_union( + [ModelBillingTokenPrices.from_dict, from_none], obj.get("tokenPrices") + ) return ModelBilling(multiplier, token_prices) def to_dict(self) -> dict: @@ -12307,9 +13834,12 @@ def to_dict(self) -> dict: if self.multiplier is not None: result["multiplier"] = from_union([to_float, from_none], self.multiplier) if self.token_prices is not None: - result["tokenPrices"] = from_union([lambda x: to_class(ModelBillingTokenPrices, x), from_none], self.token_prices) + result["tokenPrices"] = from_union( + [lambda x: to_class(ModelBillingTokenPrices, x), from_none], self.token_prices + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverride: @@ -12322,20 +13852,29 @@ class ModelCapabilitiesOverride: """Feature flags indicating what the model supports""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilitiesOverride': + def from_dict(obj: Any) -> "ModelCapabilitiesOverride": assert isinstance(obj, dict) - limits = from_union([ModelCapabilitiesOverrideLimits.from_dict, from_none], obj.get("limits")) - supports = from_union([ModelCapabilitiesOverrideSupports.from_dict, from_none], obj.get("supports")) + limits = from_union( + [ModelCapabilitiesOverrideLimits.from_dict, from_none], obj.get("limits") + ) + supports = from_union( + [ModelCapabilitiesOverrideSupports.from_dict, from_none], obj.get("supports") + ) return ModelCapabilitiesOverride(limits, supports) def to_dict(self) -> dict: result: dict = {} if self.limits is not None: - result["limits"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideLimits, x), from_none], self.limits) + result["limits"] = from_union( + [lambda x: to_class(ModelCapabilitiesOverrideLimits, x), from_none], self.limits + ) if self.supports is not None: - result["supports"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideSupports, x), from_none], self.supports) + result["supports"] = from_union( + [lambda x: to_class(ModelCapabilitiesOverrideSupports, x), from_none], self.supports + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicy: @@ -12349,20 +13888,28 @@ class PermissionsConfigureAdditionalContentExclusionPolicy: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicy': + def from_dict(obj: Any) -> "PermissionsConfigureAdditionalContentExclusionPolicy": assert isinstance(obj, dict) last_updated_at = from_union([from_float, from_str], obj.get("last_updated_at")) - rules = from_list(PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules")) + rules = from_list( + PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules") + ) scope = PermissionsConfigureAdditionalContentExclusionPolicyScope(obj.get("scope")) return PermissionsConfigureAdditionalContentExclusionPolicy(last_updated_at, rules, scope) def to_dict(self) -> dict: result: dict = {} result["last_updated_at"] = from_union([to_float, from_str], self.last_updated_at) - result["rules"] = from_list(lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, x), self.rules) - result["scope"] = to_enum(PermissionsConfigureAdditionalContentExclusionPolicyScope, self.scope) + result["rules"] = from_list( + lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, x), + self.rules, + ) + result["scope"] = to_enum( + PermissionsConfigureAdditionalContentExclusionPolicyScope, self.scope + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuePendingItemsResult: @@ -12378,7 +13925,7 @@ class QueuePendingItemsResult: """ @staticmethod - def from_dict(obj: Any) -> 'QueuePendingItemsResult': + def from_dict(obj: Any) -> "QueuePendingItemsResult": assert isinstance(obj, dict) items = from_list(QueuePendingItems.from_dict, obj.get("items")) steering_messages = from_list(from_str, obj.get("steeringMessages")) @@ -12390,6 +13937,7 @@ def to_dict(self) -> dict: result["steeringMessages"] = from_list(from_str, self.steering_messages) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelection: @@ -12411,7 +13959,7 @@ class SendAttachmentSelection: """Attachment type discriminator""" @staticmethod - def from_dict(obj: Any) -> 'SendAttachmentSelection': + def from_dict(obj: Any) -> "SendAttachmentSelection": assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) file_path = from_str(obj.get("filePath")) @@ -12428,6 +13976,7 @@ def to_dict(self) -> dict: result["type"] = self.type return result + @dataclass class SessionFSReadFileResult: """File content as a UTF-8 string, or a filesystem error if the read failed.""" @@ -12439,7 +13988,7 @@ class SessionFSReadFileResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReadFileResult': + def from_dict(obj: Any) -> "SessionFSReadFileResult": assert isinstance(obj, dict) content = from_str(obj.get("content")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) @@ -12449,9 +13998,12 @@ def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) if self.error is not None: - result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) + result["error"] = from_union( + [lambda x: to_class(SessionFSError, x), from_none], self.error + ) return result + @dataclass class SessionFSReaddirResult: """Names of entries in the requested directory, or a filesystem error if the read failed.""" @@ -12463,7 +14015,7 @@ class SessionFSReaddirResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReaddirResult': + def from_dict(obj: Any) -> "SessionFSReaddirResult": assert isinstance(obj, dict) entries = from_list(from_str, obj.get("entries")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) @@ -12473,14 +14025,18 @@ def to_dict(self) -> dict: result: dict = {} result["entries"] = from_list(from_str, self.entries) if self.error is not None: - result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) + result["error"] = from_union( + [lambda x: to_class(SessionFSError, x), from_none], self.error + ) return result + @dataclass class SessionFSSqliteQueryResult: """Query results including rows, columns, and rows affected, or a filesystem error if execution failed. """ + columns: list[str] """Column names from the result set""" @@ -12497,7 +14053,7 @@ class SessionFSSqliteQueryResult: """SQLite last_insert_rowid() value for INSERT.""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSSqliteQueryResult': + def from_dict(obj: Any) -> "SessionFSSqliteQueryResult": assert isinstance(obj, dict) columns = from_list(from_str, obj.get("columns")) rows = from_list(lambda x: from_dict(lambda x: x, x), obj.get("rows")) @@ -12512,11 +14068,14 @@ def to_dict(self) -> dict: result["rows"] = from_list(lambda x: from_dict(lambda x: x, x), self.rows) result["rowsAffected"] = from_int(self.rows_affected) if self.error is not None: - result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) + result["error"] = from_union( + [lambda x: to_class(SessionFSError, x), from_none], self.error + ) if self.last_insert_rowid is not None: result["lastInsertRowid"] = from_union([from_int, from_none], self.last_insert_rowid) return result + @dataclass class SessionFSStatResult: """Filesystem metadata for the requested path, or a filesystem error if the stat failed.""" @@ -12540,7 +14099,7 @@ class SessionFSStatResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSStatResult': + def from_dict(obj: Any) -> "SessionFSStatResult": assert isinstance(obj, dict) birthtime = from_datetime(obj.get("birthtime")) is_directory = from_bool(obj.get("isDirectory")) @@ -12558,14 +14117,18 @@ def to_dict(self) -> dict: result["mtime"] = self.mtime.isoformat() result["size"] = from_int(self.size) if self.error is not None: - result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) + result["error"] = from_union( + [lambda x: to_class(SessionFSError, x), from_none], self.error + ) return result + @dataclass class SessionFSReaddirWithTypesResult: """Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. """ + entries: list[SessionFSReaddirWithTypesEntry] """Directory entries with type information""" @@ -12573,7 +14136,7 @@ class SessionFSReaddirWithTypesResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesResult': + def from_dict(obj: Any) -> "SessionFSReaddirWithTypesResult": assert isinstance(obj, dict) entries = from_list(SessionFSReaddirWithTypesEntry.from_dict, obj.get("entries")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) @@ -12581,11 +14144,16 @@ def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesResult': def to_dict(self) -> dict: result: dict = {} - result["entries"] = from_list(lambda x: to_class(SessionFSReaddirWithTypesEntry, x), self.entries) + result["entries"] = from_list( + lambda x: to_class(SessionFSReaddirWithTypesEntry, x), self.entries + ) if self.error is not None: - result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) + result["error"] = from_union( + [lambda x: to_class(SessionFSError, x), from_none], self.error + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentGetCurrentResult: @@ -12595,7 +14163,7 @@ class AgentGetCurrentResult: """Currently selected custom agent, or null if using the default agent""" @staticmethod - def from_dict(obj: Any) -> 'AgentGetCurrentResult': + def from_dict(obj: Any) -> "AgentGetCurrentResult": assert isinstance(obj, dict) agent = from_union([AgentInfo.from_dict, from_none], obj.get("agent")) return AgentGetCurrentResult(agent) @@ -12606,6 +14174,7 @@ def to_dict(self) -> dict: result["agent"] = from_union([lambda x: to_class(AgentInfo, x), from_none], self.agent) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentList: @@ -12615,7 +14184,7 @@ class AgentList: """Available custom agents""" @staticmethod - def from_dict(obj: Any) -> 'AgentList': + def from_dict(obj: Any) -> "AgentList": assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return AgentList(agents) @@ -12625,6 +14194,7 @@ def to_dict(self) -> dict: result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentReloadResult: @@ -12634,7 +14204,7 @@ class AgentReloadResult: """Reloaded custom agents""" @staticmethod - def from_dict(obj: Any) -> 'AgentReloadResult': + def from_dict(obj: Any) -> "AgentReloadResult": assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return AgentReloadResult(agents) @@ -12644,6 +14214,7 @@ def to_dict(self) -> dict: result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentSelectResult: @@ -12653,7 +14224,7 @@ class AgentSelectResult: """The newly selected custom agent""" @staticmethod - def from_dict(obj: Any) -> 'AgentSelectResult': + def from_dict(obj: Any) -> "AgentSelectResult": assert isinstance(obj, dict) agent = AgentInfo.from_dict(obj.get("agent")) return AgentSelectResult(agent) @@ -12663,6 +14234,7 @@ def to_dict(self) -> dict: result["agent"] = to_class(AgentInfo, self.agent) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskProgress: @@ -12670,6 +14242,7 @@ class TaskProgress: Schema for the `TaskShellProgress` type. """ + type: TaskInfoType """Progress kind""" @@ -12686,11 +14259,14 @@ class TaskProgress: """Recent stdout/stderr lines from the running shell command""" @staticmethod - def from_dict(obj: Any) -> 'TaskProgress': + def from_dict(obj: Any) -> "TaskProgress": assert isinstance(obj, dict) type = TaskInfoType(obj.get("type")) latest_intent = from_union([from_str, from_none], obj.get("latestIntent")) - recent_activity = from_union([lambda x: from_list(TaskProgressLine.from_dict, x), from_none], obj.get("recentActivity")) + recent_activity = from_union( + [lambda x: from_list(TaskProgressLine.from_dict, x), from_none], + obj.get("recentActivity"), + ) pid = from_union([from_int, from_none], obj.get("pid")) recent_output = from_union([from_str, from_none], obj.get("recentOutput")) return TaskProgress(type, latest_intent, recent_activity, pid, recent_output) @@ -12701,13 +14277,17 @@ def to_dict(self) -> dict: if self.latest_intent is not None: result["latestIntent"] = from_union([from_str, from_none], self.latest_intent) if self.recent_activity is not None: - result["recentActivity"] = from_union([lambda x: from_list(lambda x: to_class(TaskProgressLine, x), x), from_none], self.recent_activity) + result["recentActivity"] = from_union( + [lambda x: from_list(lambda x: to_class(TaskProgressLine, x), x), from_none], + self.recent_activity, + ) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) if self.recent_output is not None: result["recentOutput"] = from_union([from_str, from_none], self.recent_output) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfField: @@ -12735,7 +14315,7 @@ class UIElicitationArrayAnyOfField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfField': + def from_dict(obj: Any) -> "UIElicitationArrayAnyOfField": assert isinstance(obj, dict) items = UIElicitationArrayAnyOfFieldItems.from_dict(obj.get("items")) type = UIElicitationArrayAnyOfFieldType(obj.get("type")) @@ -12744,14 +14324,18 @@ def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfField': max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationArrayAnyOfField(items, type, default, description, max_items, min_items, title) + return UIElicitationArrayAnyOfField( + items, type, default, description, max_items, min_items, title + ) def to_dict(self) -> dict: result: dict = {} result["items"] = to_class(UIElicitationArrayAnyOfFieldItems, self.items) result["type"] = to_enum(UIElicitationArrayAnyOfFieldType, self.type) if self.default is not None: - result["default"] = from_union([lambda x: from_list(from_str, x), from_none], self.default) + result["default"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.default + ) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.max_items is not None: @@ -12762,6 +14346,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayEnumField: @@ -12789,7 +14374,7 @@ class UIElicitationArrayEnumField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationArrayEnumField': + def from_dict(obj: Any) -> "UIElicitationArrayEnumField": assert isinstance(obj, dict) items = UIElicitationArrayEnumFieldItems.from_dict(obj.get("items")) type = UIElicitationArrayAnyOfFieldType(obj.get("type")) @@ -12798,14 +14383,18 @@ def from_dict(obj: Any) -> 'UIElicitationArrayEnumField': max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationArrayEnumField(items, type, default, description, max_items, min_items, title) + return UIElicitationArrayEnumField( + items, type, default, description, max_items, min_items, title + ) def to_dict(self) -> dict: result: dict = {} result["items"] = to_class(UIElicitationArrayEnumFieldItems, self.items) result["type"] = to_enum(UIElicitationArrayAnyOfFieldType, self.type) if self.default is not None: - result["default"] = from_union([lambda x: from_list(from_str, x), from_none], self.default) + result["default"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.default + ) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.max_items is not None: @@ -12816,6 +14405,7 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaProperty: @@ -12835,6 +14425,7 @@ class UIElicitationSchemaProperty: Numeric field accepting either a number or an integer. """ + type: UIElicitationSchemaPropertyType """Type discriminator. Always "string". @@ -12891,15 +14482,21 @@ class UIElicitationSchemaProperty: """Minimum allowed value (inclusive).""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationSchemaProperty': + def from_dict(obj: Any) -> "UIElicitationSchemaProperty": assert isinstance(obj, dict) type = UIElicitationSchemaPropertyType(obj.get("type")) - default = from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], obj.get("default")) + default = from_union( + [from_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], + obj.get("default"), + ) description = from_union([from_str, from_none], obj.get("description")) enum = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enum")) enum_names = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enumNames")) title = from_union([from_str, from_none], obj.get("title")) - one_of = from_union([lambda x: from_list(UIElicitationStringOneOfFieldOneOf.from_dict, x), from_none], obj.get("oneOf")) + one_of = from_union( + [lambda x: from_list(UIElicitationStringOneOfFieldOneOf.from_dict, x), from_none], + obj.get("oneOf"), + ) items = from_union([UIElicitationArrayFieldItems.from_dict, from_none], obj.get("items")) max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) @@ -12908,31 +14505,65 @@ def from_dict(obj: Any) -> 'UIElicitationSchemaProperty': min_length = from_union([from_int, from_none], obj.get("minLength")) maximum = from_union([from_float, from_none], obj.get("maximum")) minimum = from_union([from_float, from_none], obj.get("minimum")) - return UIElicitationSchemaProperty(type, default, description, enum, enum_names, title, one_of, items, max_items, min_items, format, max_length, min_length, maximum, minimum) + return UIElicitationSchemaProperty( + type, + default, + description, + enum, + enum_names, + title, + one_of, + items, + max_items, + min_items, + format, + max_length, + min_length, + maximum, + minimum, + ) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(UIElicitationSchemaPropertyType, self.type) if self.default is not None: - result["default"] = from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], self.default) + result["default"] = from_union( + [to_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], + self.default, + ) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.enum is not None: result["enum"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum) if self.enum_names is not None: - result["enumNames"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum_names) + result["enumNames"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.enum_names + ) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) if self.one_of is not None: - result["oneOf"] = from_union([lambda x: from_list(lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), x), from_none], self.one_of) + result["oneOf"] = from_union( + [ + lambda x: from_list( + lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), x + ), + from_none, + ], + self.one_of, + ) if self.items is not None: - result["items"] = from_union([lambda x: to_class(UIElicitationArrayFieldItems, x), from_none], self.items) + result["items"] = from_union( + [lambda x: to_class(UIElicitationArrayFieldItems, x), from_none], self.items + ) if self.max_items is not None: result["maxItems"] = from_union([from_int, from_none], self.max_items) if self.min_items is not None: result["minItems"] = from_union([from_int, from_none], self.min_items) if self.format is not None: - result["format"] = from_union([lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], self.format) + result["format"] = from_union( + [lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], + self.format, + ) if self.max_length is not None: result["maxLength"] = from_union([from_int, from_none], self.max_length) if self.min_length is not None: @@ -12943,12 +14574,14 @@ def to_dict(self) -> dict: result["minimum"] = from_union([to_float, from_none], self.minimum) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingElicitationRequest: """Pending elicitation request ID and the user's response (accept/decline/cancel + form values). """ + request_id: str """The unique request ID from the elicitation.requested event""" @@ -12956,7 +14589,7 @@ class UIHandlePendingElicitationRequest: """The elicitation response (accept with form values, decline, or cancel)""" @staticmethod - def from_dict(obj: Any) -> 'UIHandlePendingElicitationRequest': + def from_dict(obj: Any) -> "UIHandlePendingElicitationRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = UIElicitationResponse.from_dict(obj.get("result")) @@ -12968,6 +14601,7 @@ def to_dict(self) -> dict: result["result"] = to_class(UIElicitationResponse, self.result) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingExitPlanModeRequest: @@ -12980,7 +14614,7 @@ class UIHandlePendingExitPlanModeRequest: """Schema for the `UIExitPlanModeResponse` type.""" @staticmethod - def from_dict(obj: Any) -> 'UIHandlePendingExitPlanModeRequest': + def from_dict(obj: Any) -> "UIHandlePendingExitPlanModeRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIExitPlanModeResponse.from_dict(obj.get("response")) @@ -12992,12 +14626,14 @@ def to_dict(self) -> dict: result["response"] = to_class(UIExitPlanModeResponse, self.response) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageGetMetricsResult: """Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. """ + code_changes: UsageMetricsCodeChanges """Aggregated code change metrics""" @@ -13033,7 +14669,7 @@ class UsageGetMetricsResult: """Session-wide accumulated nano-AI units cost""" @staticmethod - def from_dict(obj: Any) -> 'UsageGetMetricsResult': + def from_dict(obj: Any) -> "UsageGetMetricsResult": assert isinstance(obj, dict) code_changes = UsageMetricsCodeChanges.from_dict(obj.get("codeChanges")) last_call_input_tokens = from_int(obj.get("lastCallInputTokens")) @@ -13044,16 +14680,33 @@ def from_dict(obj: Any) -> 'UsageGetMetricsResult': total_premium_request_cost = from_float(obj.get("totalPremiumRequestCost")) total_user_requests = from_int(obj.get("totalUserRequests")) current_model = from_union([from_str, from_none], obj.get("currentModel")) - token_details = from_union([lambda x: from_dict(UsageMetricsTokenDetail.from_dict, x), from_none], obj.get("tokenDetails")) + token_details = from_union( + [lambda x: from_dict(UsageMetricsTokenDetail.from_dict, x), from_none], + obj.get("tokenDetails"), + ) total_nano_aiu = from_union([from_float, from_none], obj.get("totalNanoAiu")) - return UsageGetMetricsResult(code_changes, last_call_input_tokens, last_call_output_tokens, model_metrics, session_start_time, total_api_duration_ms, total_premium_request_cost, total_user_requests, current_model, token_details, total_nano_aiu) + return UsageGetMetricsResult( + code_changes, + last_call_input_tokens, + last_call_output_tokens, + model_metrics, + session_start_time, + total_api_duration_ms, + total_premium_request_cost, + total_user_requests, + current_model, + token_details, + total_nano_aiu, + ) def to_dict(self) -> dict: result: dict = {} result["codeChanges"] = to_class(UsageMetricsCodeChanges, self.code_changes) result["lastCallInputTokens"] = from_int(self.last_call_input_tokens) result["lastCallOutputTokens"] = from_int(self.last_call_output_tokens) - result["modelMetrics"] = from_dict(lambda x: to_class(UsageMetricsModelMetric, x), self.model_metrics) + result["modelMetrics"] = from_dict( + lambda x: to_class(UsageMetricsModelMetric, x), self.model_metrics + ) result["sessionStartTime"] = self.session_start_time.isoformat() result["totalApiDurationMs"] = from_int(self.total_api_duration_ms) result["totalPremiumRequestCost"] = to_float(self.total_premium_request_cost) @@ -13061,11 +14714,15 @@ def to_dict(self) -> dict: if self.current_model is not None: result["currentModel"] = from_union([from_str, from_none], self.current_model) if self.token_details is not None: - result["tokenDetails"] = from_union([lambda x: from_dict(lambda x: to_class(UsageMetricsTokenDetail, x), x), from_none], self.token_details) + result["tokenDetails"] = from_union( + [lambda x: from_dict(lambda x: to_class(UsageMetricsTokenDetail, x), x), from_none], + self.token_details, + ) if self.total_nano_aiu is not None: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceDiffResult: @@ -13083,48 +14740,197 @@ class WorkspaceDiffResult: requested_mode: WorkspaceDiffMode """Diff mode requested by the client.""" - base_branch: str | None = None - """Default branch used for a branch diff, when branch mode was requested.""" + base_branch: str | None = None + """Default branch used for a branch diff, when branch mode was requested.""" + + @staticmethod + def from_dict(obj: Any) -> "WorkspaceDiffResult": + assert isinstance(obj, dict) + changes = from_list(WorkspaceDiffFileChange.from_dict, obj.get("changes")) + is_fallback = from_bool(obj.get("isFallback")) + mode = WorkspaceDiffMode(obj.get("mode")) + requested_mode = WorkspaceDiffMode(obj.get("requestedMode")) + base_branch = from_union([from_str, from_none], obj.get("baseBranch")) + return WorkspaceDiffResult(changes, is_fallback, mode, requested_mode, base_branch) + + def to_dict(self) -> dict: + result: dict = {} + result["changes"] = from_list(lambda x: to_class(WorkspaceDiffFileChange, x), self.changes) + result["isFallback"] = from_bool(self.is_fallback) + result["mode"] = to_enum(WorkspaceDiffMode, self.mode) + result["requestedMode"] = to_enum(WorkspaceDiffMode, self.requested_mode) + if self.base_branch is not None: + result["baseBranch"] = from_union([from_str, from_none], self.base_branch) + return result + + +# Experimental: this type is part of an experimental API and may change or be removed. +@dataclass +class CommandList: + """Slash commands available in the session, after applying any include/exclude filters.""" + + commands: list[SlashCommandInfo] + """Commands available in this session""" + + @staticmethod + def from_dict(obj: Any) -> "CommandList": + assert isinstance(obj, dict) + commands = from_list(SlashCommandInfo.from_dict, obj.get("commands")) + return CommandList(commands) + + def to_dict(self) -> dict: + result: dict = {} + result["commands"] = from_list(lambda x: to_class(SlashCommandInfo, x), self.commands) + return result + + +@dataclass +class CanvasProviderCloseRequest: + """Canvas close parameters sent to the provider.""" + + canvas_id: str + """Provider-local canvas identifier""" + + extension_id: str + """Owning provider identifier""" + + instance_id: str + """Canvas instance identifier""" + + session_id: str + """Target session identifier""" + + host: CanvasHostContext | None = None + """Host context supplied by the runtime.""" + + @staticmethod + def from_dict(obj: Any) -> "CanvasProviderCloseRequest": + assert isinstance(obj, dict) + canvas_id = from_str(obj.get("canvasId")) + extension_id = from_str(obj.get("extensionId")) + instance_id = from_str(obj.get("instanceId")) + session_id = from_str(obj.get("sessionId")) + host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) + return CanvasProviderCloseRequest(canvas_id, extension_id, instance_id, session_id, host) + + def to_dict(self) -> dict: + result: dict = {} + result["canvasId"] = from_str(self.canvas_id) + result["extensionId"] = from_str(self.extension_id) + result["instanceId"] = from_str(self.instance_id) + result["sessionId"] = from_str(self.session_id) + if self.host is not None: + result["host"] = from_union( + [lambda x: to_class(CanvasHostContext, x), from_none], self.host + ) + return result + + +@dataclass +class CanvasProviderInvokeActionRequest: + """Canvas action invocation parameters sent to the provider.""" + + action_name: str + """Action name to invoke""" + + canvas_id: str + """Provider-local canvas identifier""" + + extension_id: str + """Owning provider identifier""" + + instance_id: str + """Canvas instance identifier""" + + session_id: str + """Target session identifier""" + + host: CanvasHostContext | None = None + """Host context supplied by the runtime.""" + + input: Any = None + """Action input""" @staticmethod - def from_dict(obj: Any) -> 'WorkspaceDiffResult': + def from_dict(obj: Any) -> "CanvasProviderInvokeActionRequest": assert isinstance(obj, dict) - changes = from_list(WorkspaceDiffFileChange.from_dict, obj.get("changes")) - is_fallback = from_bool(obj.get("isFallback")) - mode = WorkspaceDiffMode(obj.get("mode")) - requested_mode = WorkspaceDiffMode(obj.get("requestedMode")) - base_branch = from_union([from_str, from_none], obj.get("baseBranch")) - return WorkspaceDiffResult(changes, is_fallback, mode, requested_mode, base_branch) + action_name = from_str(obj.get("actionName")) + canvas_id = from_str(obj.get("canvasId")) + extension_id = from_str(obj.get("extensionId")) + instance_id = from_str(obj.get("instanceId")) + session_id = from_str(obj.get("sessionId")) + host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) + input = obj.get("input") + return CanvasProviderInvokeActionRequest( + action_name, canvas_id, extension_id, instance_id, session_id, host, input + ) def to_dict(self) -> dict: result: dict = {} - result["changes"] = from_list(lambda x: to_class(WorkspaceDiffFileChange, x), self.changes) - result["isFallback"] = from_bool(self.is_fallback) - result["mode"] = to_enum(WorkspaceDiffMode, self.mode) - result["requestedMode"] = to_enum(WorkspaceDiffMode, self.requested_mode) - if self.base_branch is not None: - result["baseBranch"] = from_union([from_str, from_none], self.base_branch) + result["actionName"] = from_str(self.action_name) + result["canvasId"] = from_str(self.canvas_id) + result["extensionId"] = from_str(self.extension_id) + result["instanceId"] = from_str(self.instance_id) + result["sessionId"] = from_str(self.session_id) + if self.host is not None: + result["host"] = from_union( + [lambda x: to_class(CanvasHostContext, x), from_none], self.host + ) + if self.input is not None: + result["input"] = self.input return result -# Experimental: this type is part of an experimental API and may change or be removed. + @dataclass -class CommandList: - """Slash commands available in the session, after applying any include/exclude filters.""" +class CanvasProviderOpenRequest: + """Canvas open parameters sent to the provider.""" - commands: list[SlashCommandInfo] - """Commands available in this session""" + canvas_id: str + """Provider-local canvas identifier""" + + extension_id: str + """Owning provider identifier""" + + instance_id: str + """Stable caller-supplied canvas instance identifier""" + + session_id: str + """Target session identifier""" + + host: CanvasHostContext | None = None + """Host context supplied by the runtime.""" + + input: Any = None + """Canvas open input""" @staticmethod - def from_dict(obj: Any) -> 'CommandList': + def from_dict(obj: Any) -> "CanvasProviderOpenRequest": assert isinstance(obj, dict) - commands = from_list(SlashCommandInfo.from_dict, obj.get("commands")) - return CommandList(commands) + canvas_id = from_str(obj.get("canvasId")) + extension_id = from_str(obj.get("extensionId")) + instance_id = from_str(obj.get("instanceId")) + session_id = from_str(obj.get("sessionId")) + host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) + input = obj.get("input") + return CanvasProviderOpenRequest( + canvas_id, extension_id, instance_id, session_id, host, input + ) def to_dict(self) -> dict: result: dict = {} - result["commands"] = from_list(lambda x: to_class(SlashCommandInfo, x), self.commands) + result["canvasId"] = from_str(self.canvas_id) + result["extensionId"] = from_str(self.extension_id) + result["instanceId"] = from_str(self.instance_id) + result["sessionId"] = from_str(self.session_id) + if self.host is not None: + result["host"] = from_union( + [lambda x: to_class(CanvasHostContext, x), from_none], self.host + ) + if self.input is not None: + result["input"] = self.input return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class APIKeyAuthInfo: @@ -13146,11 +14952,13 @@ class APIKeyAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'APIKeyAuthInfo': + def from_dict(obj: Any) -> "APIKeyAuthInfo": assert isinstance(obj, dict) api_key = from_str(obj.get("apiKey")) host = from_str(obj.get("host")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) return APIKeyAuthInfo(api_key, host, copilot_user) def to_dict(self) -> dict: @@ -13159,9 +14967,12 @@ def to_dict(self) -> dict: result["host"] = from_str(self.host) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotAPITokenAuthInfo: @@ -13182,10 +14993,12 @@ class CopilotAPITokenAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'CopilotAPITokenAuthInfo': + def from_dict(obj: Any) -> "CopilotAPITokenAuthInfo": assert isinstance(obj, dict) host = Host(obj.get("host")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) return CopilotAPITokenAuthInfo(host, copilot_user) def to_dict(self) -> dict: @@ -13193,9 +15006,12 @@ def to_dict(self) -> dict: result["host"] = to_enum(Host, self.host) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnvAuthInfo: @@ -13225,12 +15041,14 @@ class EnvAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'EnvAuthInfo': + def from_dict(obj: Any) -> "EnvAuthInfo": assert isinstance(obj, dict) env_var = from_str(obj.get("envVar")) host = from_str(obj.get("host")) token = from_str(obj.get("token")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) login = from_union([from_str, from_none], obj.get("login")) return EnvAuthInfo(env_var, host, token, copilot_user, login) @@ -13241,11 +15059,14 @@ def to_dict(self) -> dict: result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class GhCLIAuthInfo: @@ -13270,12 +15091,14 @@ class GhCLIAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'GhCLIAuthInfo': + def from_dict(obj: Any) -> "GhCLIAuthInfo": assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) token = from_str(obj.get("token")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) return GhCLIAuthInfo(host, login, token, copilot_user) def to_dict(self) -> dict: @@ -13285,9 +15108,12 @@ def to_dict(self) -> dict: result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HMACAuthInfo: @@ -13309,11 +15135,13 @@ class HMACAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'HMACAuthInfo': + def from_dict(obj: Any) -> "HMACAuthInfo": assert isinstance(obj, dict) hmac = from_str(obj.get("hmac")) host = Host(obj.get("host")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) return HMACAuthInfo(hmac, host, copilot_user) def to_dict(self) -> dict: @@ -13322,9 +15150,12 @@ def to_dict(self) -> dict: result["host"] = to_enum(Host, self.host) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TokenAuthInfo: @@ -13346,11 +15177,13 @@ class TokenAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'TokenAuthInfo': + def from_dict(obj: Any) -> "TokenAuthInfo": assert isinstance(obj, dict) host = from_str(obj.get("host")) token = from_str(obj.get("token")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) return TokenAuthInfo(host, token, copilot_user) def to_dict(self) -> dict: @@ -13359,9 +15192,12 @@ def to_dict(self) -> dict: result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserAuthInfo: @@ -13384,11 +15220,13 @@ class UserAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> 'UserAuthInfo': + def from_dict(obj: Any) -> "UserAuthInfo": assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) - copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) + copilot_user = from_union( + [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") + ) return UserAuthInfo(host, login, copilot_user) def to_dict(self) -> dict: @@ -13397,9 +15235,12 @@ def to_dict(self) -> dict: result["login"] = from_str(self.login) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) + result["copilotUser"] = from_union( + [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user + ) return result + @dataclass class PermissionDecisionApproveForIonApproval: """Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) @@ -13448,6 +15289,7 @@ class PermissionDecisionApproveForIonApproval: The approval to persist for this location """ + command_identifiers: list[str] | None = None """Command identifiers covered by this approval.""" @@ -13488,21 +15330,36 @@ class PermissionDecisionApproveForIonApproval: external_ref_marker_external_ref_user_tool_session_approval: str | None = None @staticmethod - def from_dict(obj: Any) -> 'PermissionDecisionApproveForIonApproval': + def from_dict(obj: Any) -> "PermissionDecisionApproveForIonApproval": assert isinstance(obj, dict) - command_identifiers = from_union([lambda x: from_list(from_str, x), from_none], obj.get("commandIdentifiers")) + command_identifiers = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("commandIdentifiers") + ) kind = from_union([ApprovalKind, from_none], obj.get("kind")) server_name = from_union([from_str, from_none], obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) operation = from_union([from_str, from_none], obj.get("operation")) extension_name = from_union([from_str, from_none], obj.get("extensionName")) - external_ref_marker_external_ref_user_tool_session_approval = from_union([from_str, from_none], obj.get("__externalRefMarker___ExternalRef_UserToolSessionApproval")) - return PermissionDecisionApproveForIonApproval(command_identifiers, kind, server_name, tool_name, operation, extension_name, external_ref_marker_external_ref_user_tool_session_approval) + external_ref_marker_external_ref_user_tool_session_approval = from_union( + [from_str, from_none], + obj.get("__externalRefMarker___ExternalRef_UserToolSessionApproval"), + ) + return PermissionDecisionApproveForIonApproval( + command_identifiers, + kind, + server_name, + tool_name, + operation, + extension_name, + external_ref_marker_external_ref_user_tool_session_approval, + ) def to_dict(self) -> dict: result: dict = {} if self.command_identifiers is not None: - result["commandIdentifiers"] = from_union([lambda x: from_list(from_str, x), from_none], self.command_identifiers) + result["commandIdentifiers"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.command_identifiers + ) if self.kind is not None: result["kind"] = from_union([lambda x: to_enum(ApprovalKind, x), from_none], self.kind) if self.server_name is not None: @@ -13514,15 +15371,20 @@ def to_dict(self) -> dict: if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.external_ref_marker_external_ref_user_tool_session_approval is not None: - result["__externalRefMarker___ExternalRef_UserToolSessionApproval"] = from_union([from_str, from_none], self.external_ref_marker_external_ref_user_tool_session_approval) + result["__externalRefMarker___ExternalRef_UserToolSessionApproval"] = from_union( + [from_str, from_none], + self.external_ref_marker_external_ref_user_tool_session_approval, + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallRequest: """Pending external tool call request ID, with the tool result or an error describing why it failed. """ + request_id: str """Request ID of the pending tool call""" @@ -13533,11 +15395,13 @@ class HandlePendingToolCallRequest: """Tool call result (string or expanded result object)""" @staticmethod - def from_dict(obj: Any) -> 'HandlePendingToolCallRequest': + def from_dict(obj: Any) -> "HandlePendingToolCallRequest": assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error = from_union([from_str, from_none], obj.get("error")) - result = from_union([ExternalToolTextResultForLlm.from_dict, from_str, from_none], obj.get("result")) + result = from_union( + [ExternalToolTextResultForLlm.from_dict, from_str, from_none], obj.get("result") + ) return HandlePendingToolCallRequest(request_id, error, result) def to_dict(self) -> dict: @@ -13546,9 +15410,13 @@ def to_dict(self) -> dict: if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result is not None: - result["result"] = from_union([lambda x: to_class(ExternalToolTextResultForLlm, x), from_str, from_none], self.result) + result["result"] = from_union( + [lambda x: to_class(ExternalToolTextResultForLlm, x), from_str, from_none], + self.result, + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPlugin: @@ -13576,16 +15444,20 @@ class InstalledPlugin: """Version installed (if available)""" @staticmethod - def from_dict(obj: Any) -> 'InstalledPlugin': + def from_dict(obj: Any) -> "InstalledPlugin": assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) installed_at = from_str(obj.get("installed_at")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) cache_path = from_union([from_str, from_none], obj.get("cache_path")) - source = from_union([InstalledPluginSource.from_dict, from_str, from_none], obj.get("source")) + source = from_union( + [InstalledPluginSource.from_dict, from_str, from_none], obj.get("source") + ) version = from_union([from_str, from_none], obj.get("version")) - return InstalledPlugin(enabled, installed_at, marketplace, name, cache_path, source, version) + return InstalledPlugin( + enabled, installed_at, marketplace, name, cache_path, source, version + ) def to_dict(self) -> dict: result: dict = {} @@ -13596,11 +15468,14 @@ def to_dict(self) -> dict: if self.cache_path is not None: result["cache_path"] = from_union([from_str, from_none], self.cache_path) if self.source is not None: - result["source"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str, from_none], self.source) + result["source"] = from_union( + [lambda x: to_class(InstalledPluginSource, x), from_str, from_none], self.source + ) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPlugin: @@ -13628,16 +15503,20 @@ class SessionInstalledPlugin: """Installed version, if known""" @staticmethod - def from_dict(obj: Any) -> 'SessionInstalledPlugin': + def from_dict(obj: Any) -> "SessionInstalledPlugin": assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) installed_at = from_str(obj.get("installed_at")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) cache_path = from_union([from_str, from_none], obj.get("cache_path")) - source = from_union([SessionInstalledPluginSource.from_dict, from_str, from_none], obj.get("source")) + source = from_union( + [SessionInstalledPluginSource.from_dict, from_str, from_none], obj.get("source") + ) version = from_union([from_str, from_none], obj.get("version")) - return SessionInstalledPlugin(enabled, installed_at, marketplace, name, cache_path, source, version) + return SessionInstalledPlugin( + enabled, installed_at, marketplace, name, cache_path, source, version + ) def to_dict(self) -> dict: result: dict = {} @@ -13648,11 +15527,15 @@ def to_dict(self) -> dict: if self.cache_path is not None: result["cache_path"] = from_union([from_str, from_none], self.cache_path) if self.source is not None: - result["source"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str, from_none], self.source) + result["source"] = from_union( + [lambda x: to_class(SessionInstalledPluginSource, x), from_str, from_none], + self.source, + ) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionEnrichMetadataResult: @@ -13662,7 +15545,7 @@ class SessionEnrichMetadataResult: """Same records, with summary and context backfilled""" @staticmethod - def from_dict(obj: Any) -> 'SessionEnrichMetadataResult': + def from_dict(obj: Any) -> "SessionEnrichMetadataResult": assert isinstance(obj, dict) sessions = from_list(SessionMetadata.from_dict, obj.get("sessions")) return SessionEnrichMetadataResult(sessions) @@ -13672,6 +15555,7 @@ def to_dict(self) -> dict: result["sessions"] = from_list(lambda x: to_class(SessionMetadata, x), self.sessions) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionList: @@ -13681,7 +15565,7 @@ class SessionList: """Sessions ordered most-recently-modified first""" @staticmethod - def from_dict(obj: Any) -> 'SessionList': + def from_dict(obj: Any) -> "SessionList": assert isinstance(obj, dict) sessions = from_list(SessionMetadata.from_dict, obj.get("sessions")) return SessionList(sessions) @@ -13691,6 +15575,7 @@ def to_dict(self) -> dict: result["sessions"] = from_list(lambda x: to_class(SessionMetadata, x), self.sessions) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsEnrichMetadataRequest: @@ -13702,7 +15587,7 @@ class SessionsEnrichMetadataRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsEnrichMetadataRequest': + def from_dict(obj: Any) -> "SessionsEnrichMetadataRequest": assert isinstance(obj, dict) sessions = from_list(SessionMetadata.from_dict, obj.get("sessions")) return SessionsEnrichMetadataRequest(sessions) @@ -13712,6 +15597,7 @@ def to_dict(self) -> dict: result["sessions"] = from_list(lambda x: to_class(SessionMetadata, x), self.sessions) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionMetadataSnapshot: @@ -13769,7 +15655,7 @@ class SessionMetadataSnapshot: """ @staticmethod - def from_dict(obj: Any) -> 'SessionMetadataSnapshot': + def from_dict(obj: Any) -> "SessionMetadataSnapshot": assert isinstance(obj, dict) already_in_use = from_bool(obj.get("alreadyInUse")) current_mode = MetadataSnapshotCurrentMode(obj.get("currentMode")) @@ -13779,12 +15665,28 @@ def from_dict(obj: Any) -> 'SessionMetadataSnapshot': start_time = from_datetime(obj.get("startTime")) working_directory = from_str(obj.get("workingDirectory")) initial_name = from_union([from_str, from_none], obj.get("initialName")) - remote_metadata = from_union([MetadataSnapshotRemoteMetadata.from_dict, from_none], obj.get("remoteMetadata")) + remote_metadata = from_union( + [MetadataSnapshotRemoteMetadata.from_dict, from_none], obj.get("remoteMetadata") + ) selected_model = from_union([from_str, from_none], obj.get("selectedModel")) summary = from_union([from_str, from_none], obj.get("summary")) workspace = from_union([WorkspaceSummary.from_dict, from_none], obj.get("workspace")) workspace_path = from_union([from_none, from_str], obj.get("workspacePath")) - return SessionMetadataSnapshot(already_in_use, current_mode, is_remote, modified_time, session_id, start_time, working_directory, initial_name, remote_metadata, selected_model, summary, workspace, workspace_path) + return SessionMetadataSnapshot( + already_in_use, + current_mode, + is_remote, + modified_time, + session_id, + start_time, + working_directory, + initial_name, + remote_metadata, + selected_model, + summary, + workspace, + workspace_path, + ) def to_dict(self) -> dict: result: dict = {} @@ -13798,22 +15700,30 @@ def to_dict(self) -> dict: if self.initial_name is not None: result["initialName"] = from_union([from_str, from_none], self.initial_name) if self.remote_metadata is not None: - result["remoteMetadata"] = from_union([lambda x: to_class(MetadataSnapshotRemoteMetadata, x), from_none], self.remote_metadata) + result["remoteMetadata"] = from_union( + [lambda x: to_class(MetadataSnapshotRemoteMetadata, x), from_none], + self.remote_metadata, + ) if self.selected_model is not None: result["selectedModel"] = from_union([from_str, from_none], self.selected_model) if self.summary is not None: result["summary"] = from_union([from_str, from_none], self.summary) if self.workspace is not None: - result["workspace"] = from_union([lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace) + result["workspace"] = from_union( + [lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace + ) result["workspacePath"] = from_union([from_none, from_str], self.workspace_path) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureParams: """Patch of permission policy fields to apply (omit a field to leave it unchanged).""" - additional_content_exclusion_policies: list[PermissionsConfigureAdditionalContentExclusionPolicy] | None = None + additional_content_exclusion_policies: ( + list[PermissionsConfigureAdditionalContentExclusionPolicy] | None + ) = None """If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. @@ -13842,32 +15752,71 @@ class PermissionsConfigureParams: """ @staticmethod - def from_dict(obj: Any) -> 'PermissionsConfigureParams': - assert isinstance(obj, dict) - additional_content_exclusion_policies = from_union([lambda x: from_list(PermissionsConfigureAdditionalContentExclusionPolicy.from_dict, x), from_none], obj.get("additionalContentExclusionPolicies")) - approve_all_read_permission_requests = from_union([from_bool, from_none], obj.get("approveAllReadPermissionRequests")) - approve_all_tool_permission_requests = from_union([from_bool, from_none], obj.get("approveAllToolPermissionRequests")) + def from_dict(obj: Any) -> "PermissionsConfigureParams": + assert isinstance(obj, dict) + additional_content_exclusion_policies = from_union( + [ + lambda x: from_list( + PermissionsConfigureAdditionalContentExclusionPolicy.from_dict, x + ), + from_none, + ], + obj.get("additionalContentExclusionPolicies"), + ) + approve_all_read_permission_requests = from_union( + [from_bool, from_none], obj.get("approveAllReadPermissionRequests") + ) + approve_all_tool_permission_requests = from_union( + [from_bool, from_none], obj.get("approveAllToolPermissionRequests") + ) paths = from_union([PermissionPathsConfig.from_dict, from_none], obj.get("paths")) rules = from_union([PermissionRulesSet.from_dict, from_none], obj.get("rules")) urls = from_union([PermissionUrlsConfig.from_dict, from_none], obj.get("urls")) - return PermissionsConfigureParams(additional_content_exclusion_policies, approve_all_read_permission_requests, approve_all_tool_permission_requests, paths, rules, urls) + return PermissionsConfigureParams( + additional_content_exclusion_policies, + approve_all_read_permission_requests, + approve_all_tool_permission_requests, + paths, + rules, + urls, + ) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: - result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicy, x), x), from_none], self.additional_content_exclusion_policies) + result["additionalContentExclusionPolicies"] = from_union( + [ + lambda x: from_list( + lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicy, x), + x, + ), + from_none, + ], + self.additional_content_exclusion_policies, + ) if self.approve_all_read_permission_requests is not None: - result["approveAllReadPermissionRequests"] = from_union([from_bool, from_none], self.approve_all_read_permission_requests) + result["approveAllReadPermissionRequests"] = from_union( + [from_bool, from_none], self.approve_all_read_permission_requests + ) if self.approve_all_tool_permission_requests is not None: - result["approveAllToolPermissionRequests"] = from_union([from_bool, from_none], self.approve_all_tool_permission_requests) + result["approveAllToolPermissionRequests"] = from_union( + [from_bool, from_none], self.approve_all_tool_permission_requests + ) if self.paths is not None: - result["paths"] = from_union([lambda x: to_class(PermissionPathsConfig, x), from_none], self.paths) + result["paths"] = from_union( + [lambda x: to_class(PermissionPathsConfig, x), from_none], self.paths + ) if self.rules is not None: - result["rules"] = from_union([lambda x: to_class(PermissionRulesSet, x), from_none], self.rules) + result["rules"] = from_union( + [lambda x: to_class(PermissionRulesSet, x), from_none], self.rules + ) if self.urls is not None: - result["urls"] = from_union([lambda x: to_class(PermissionUrlsConfig, x), from_none], self.urls) + result["urls"] = from_union( + [lambda x: to_class(PermissionUrlsConfig, x), from_none], self.urls + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetProgressResult: @@ -13879,7 +15828,7 @@ class TasksGetProgressResult: """ @staticmethod - def from_dict(obj: Any) -> 'TasksGetProgressResult': + def from_dict(obj: Any) -> "TasksGetProgressResult": assert isinstance(obj, dict) progress = from_union([TaskProgress.from_dict, from_none], obj.get("progress")) return TasksGetProgressResult(progress) @@ -13887,9 +15836,12 @@ def from_dict(obj: Any) -> 'TasksGetProgressResult': def to_dict(self) -> dict: result: dict = {} if self.progress is not None: - result["progress"] = from_union([lambda x: to_class(TaskProgress, x), from_none], self.progress) + result["progress"] = from_union( + [lambda x: to_class(TaskProgress, x), from_none], self.progress + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchema: @@ -13905,7 +15857,7 @@ class UIElicitationSchema: """List of required field names""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationSchema': + def from_dict(obj: Any) -> "UIElicitationSchema": assert isinstance(obj, dict) properties = from_dict(UIElicitationSchemaProperty.from_dict, obj.get("properties")) type = UIElicitationSchemaType(obj.get("type")) @@ -13914,12 +15866,17 @@ def from_dict(obj: Any) -> 'UIElicitationSchema': def to_dict(self) -> dict: result: dict = {} - result["properties"] = from_dict(lambda x: to_class(UIElicitationSchemaProperty, x), self.properties) + result["properties"] = from_dict( + lambda x: to_class(UIElicitationSchemaProperty, x), self.properties + ) result["type"] = to_enum(UIElicitationSchemaType, self.type) if self.required is not None: - result["required"] = from_union([lambda x: from_list(from_str, x), from_none], self.required) + result["required"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.required + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetAdditionalPluginsRequest: @@ -13931,7 +15888,7 @@ class SessionsSetAdditionalPluginsRequest: """ @staticmethod - def from_dict(obj: Any) -> 'SessionsSetAdditionalPluginsRequest': + def from_dict(obj: Any) -> "SessionsSetAdditionalPluginsRequest": assert isinstance(obj, dict) plugins = from_list(InstalledPlugin.from_dict, obj.get("plugins")) return SessionsSetAdditionalPluginsRequest(plugins) @@ -13941,6 +15898,7 @@ def to_dict(self) -> dict: result["plugins"] = from_list(lambda x: to_class(InstalledPlugin, x), self.plugins) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionUpdateOptionsParams: @@ -14064,98 +16022,203 @@ class SessionUpdateOptionsParams: """Absolute working-directory path for shell tools.""" @staticmethod - def from_dict(obj: Any) -> 'SessionUpdateOptionsParams': + def from_dict(obj: Any) -> "SessionUpdateOptionsParams": assert isinstance(obj, dict) - additional_content_exclusion_policies = from_union([lambda x: from_list(lambda x: x, x), from_none], obj.get("additionalContentExclusionPolicies")) + additional_content_exclusion_policies = from_union( + [lambda x: from_list(lambda x: x, x), from_none], + obj.get("additionalContentExclusionPolicies"), + ) agent_context = from_union([from_str, from_none], obj.get("agentContext")) ask_user_disabled = from_union([from_bool, from_none], obj.get("askUserDisabled")) - available_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("availableTools")) + available_tools = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("availableTools") + ) client_name = from_union([from_str, from_none], obj.get("clientName")) coauthor_enabled = from_union([from_bool, from_none], obj.get("coauthorEnabled")) continue_on_auto_mode = from_union([from_bool, from_none], obj.get("continueOnAutoMode")) copilot_url = from_union([from_str, from_none], obj.get("copilotUrl")) - custom_agents_local_only = from_union([from_bool, from_none], obj.get("customAgentsLocalOnly")) - disabled_instruction_sources = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledInstructionSources")) - disabled_skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledSkills")) - enable_on_demand_instruction_discovery = from_union([from_bool, from_none], obj.get("enableOnDemandInstructionDiscovery")) - enable_reasoning_summaries = from_union([from_bool, from_none], obj.get("enableReasoningSummaries")) + custom_agents_local_only = from_union( + [from_bool, from_none], obj.get("customAgentsLocalOnly") + ) + disabled_instruction_sources = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("disabledInstructionSources") + ) + disabled_skills = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("disabledSkills") + ) + enable_on_demand_instruction_discovery = from_union( + [from_bool, from_none], obj.get("enableOnDemandInstructionDiscovery") + ) + enable_reasoning_summaries = from_union( + [from_bool, from_none], obj.get("enableReasoningSummaries") + ) enable_script_safety = from_union([from_bool, from_none], obj.get("enableScriptSafety")) enable_streaming = from_union([from_bool, from_none], obj.get("enableStreaming")) env_value_mode = from_union([MCPSetEnvValueModeDetails, from_none], obj.get("envValueMode")) events_log_directory = from_union([from_str, from_none], obj.get("eventsLogDirectory")) - excluded_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludedTools")) - feature_flags = from_union([lambda x: from_dict(from_bool, x), from_none], obj.get("featureFlags")) - installed_plugins = from_union([lambda x: from_list(SessionInstalledPlugin.from_dict, x), from_none], obj.get("installedPlugins")) + excluded_tools = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("excludedTools") + ) + feature_flags = from_union( + [lambda x: from_dict(from_bool, x), from_none], obj.get("featureFlags") + ) + installed_plugins = from_union( + [lambda x: from_list(SessionInstalledPlugin.from_dict, x), from_none], + obj.get("installedPlugins"), + ) integration_id = from_union([from_str, from_none], obj.get("integrationId")) is_experimental_mode = from_union([from_bool, from_none], obj.get("isExperimentalMode")) log_interactive_shells = from_union([from_bool, from_none], obj.get("logInteractiveShells")) lsp_client_name = from_union([from_str, from_none], obj.get("lspClientName")) - manage_schedule_enabled = from_union([from_bool, from_none], obj.get("manageScheduleEnabled")) + manage_schedule_enabled = from_union( + [from_bool, from_none], obj.get("manageScheduleEnabled") + ) model = from_union([from_str, from_none], obj.get("model")) provider = obj.get("provider") reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) - running_in_interactive_mode = from_union([from_bool, from_none], obj.get("runningInInteractiveMode")) + running_in_interactive_mode = from_union( + [from_bool, from_none], obj.get("runningInInteractiveMode") + ) sandbox_config = obj.get("sandboxConfig") shell_init_profile = from_union([from_str, from_none], obj.get("shellInitProfile")) - shell_process_flags = from_union([lambda x: from_list(from_str, x), from_none], obj.get("shellProcessFlags")) - skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) - skip_custom_instructions = from_union([from_bool, from_none], obj.get("skipCustomInstructions")) + shell_process_flags = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("shellProcessFlags") + ) + skill_directories = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories") + ) + skip_custom_instructions = from_union( + [from_bool, from_none], obj.get("skipCustomInstructions") + ) trajectory_file = from_union([from_str, from_none], obj.get("trajectoryFile")) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) - return SessionUpdateOptionsParams(additional_content_exclusion_policies, agent_context, ask_user_disabled, available_tools, client_name, coauthor_enabled, continue_on_auto_mode, copilot_url, custom_agents_local_only, disabled_instruction_sources, disabled_skills, enable_on_demand_instruction_discovery, enable_reasoning_summaries, enable_script_safety, enable_streaming, env_value_mode, events_log_directory, excluded_tools, feature_flags, installed_plugins, integration_id, is_experimental_mode, log_interactive_shells, lsp_client_name, manage_schedule_enabled, model, provider, reasoning_effort, running_in_interactive_mode, sandbox_config, shell_init_profile, shell_process_flags, skill_directories, skip_custom_instructions, trajectory_file, working_directory) + return SessionUpdateOptionsParams( + additional_content_exclusion_policies, + agent_context, + ask_user_disabled, + available_tools, + client_name, + coauthor_enabled, + continue_on_auto_mode, + copilot_url, + custom_agents_local_only, + disabled_instruction_sources, + disabled_skills, + enable_on_demand_instruction_discovery, + enable_reasoning_summaries, + enable_script_safety, + enable_streaming, + env_value_mode, + events_log_directory, + excluded_tools, + feature_flags, + installed_plugins, + integration_id, + is_experimental_mode, + log_interactive_shells, + lsp_client_name, + manage_schedule_enabled, + model, + provider, + reasoning_effort, + running_in_interactive_mode, + sandbox_config, + shell_init_profile, + shell_process_flags, + skill_directories, + skip_custom_instructions, + trajectory_file, + working_directory, + ) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: - result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: x, x), from_none], self.additional_content_exclusion_policies) + result["additionalContentExclusionPolicies"] = from_union( + [lambda x: from_list(lambda x: x, x), from_none], + self.additional_content_exclusion_policies, + ) if self.agent_context is not None: result["agentContext"] = from_union([from_str, from_none], self.agent_context) if self.ask_user_disabled is not None: result["askUserDisabled"] = from_union([from_bool, from_none], self.ask_user_disabled) if self.available_tools is not None: - result["availableTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.available_tools) + result["availableTools"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.available_tools + ) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.coauthor_enabled is not None: result["coauthorEnabled"] = from_union([from_bool, from_none], self.coauthor_enabled) if self.continue_on_auto_mode is not None: - result["continueOnAutoMode"] = from_union([from_bool, from_none], self.continue_on_auto_mode) + result["continueOnAutoMode"] = from_union( + [from_bool, from_none], self.continue_on_auto_mode + ) if self.copilot_url is not None: result["copilotUrl"] = from_union([from_str, from_none], self.copilot_url) if self.custom_agents_local_only is not None: - result["customAgentsLocalOnly"] = from_union([from_bool, from_none], self.custom_agents_local_only) + result["customAgentsLocalOnly"] = from_union( + [from_bool, from_none], self.custom_agents_local_only + ) if self.disabled_instruction_sources is not None: - result["disabledInstructionSources"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_instruction_sources) + result["disabledInstructionSources"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.disabled_instruction_sources + ) if self.disabled_skills is not None: - result["disabledSkills"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_skills) + result["disabledSkills"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.disabled_skills + ) if self.enable_on_demand_instruction_discovery is not None: - result["enableOnDemandInstructionDiscovery"] = from_union([from_bool, from_none], self.enable_on_demand_instruction_discovery) + result["enableOnDemandInstructionDiscovery"] = from_union( + [from_bool, from_none], self.enable_on_demand_instruction_discovery + ) if self.enable_reasoning_summaries is not None: - result["enableReasoningSummaries"] = from_union([from_bool, from_none], self.enable_reasoning_summaries) + result["enableReasoningSummaries"] = from_union( + [from_bool, from_none], self.enable_reasoning_summaries + ) if self.enable_script_safety is not None: - result["enableScriptSafety"] = from_union([from_bool, from_none], self.enable_script_safety) + result["enableScriptSafety"] = from_union( + [from_bool, from_none], self.enable_script_safety + ) if self.enable_streaming is not None: result["enableStreaming"] = from_union([from_bool, from_none], self.enable_streaming) if self.env_value_mode is not None: - result["envValueMode"] = from_union([lambda x: to_enum(MCPSetEnvValueModeDetails, x), from_none], self.env_value_mode) + result["envValueMode"] = from_union( + [lambda x: to_enum(MCPSetEnvValueModeDetails, x), from_none], self.env_value_mode + ) if self.events_log_directory is not None: - result["eventsLogDirectory"] = from_union([from_str, from_none], self.events_log_directory) + result["eventsLogDirectory"] = from_union( + [from_str, from_none], self.events_log_directory + ) if self.excluded_tools is not None: - result["excludedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.excluded_tools) + result["excludedTools"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.excluded_tools + ) if self.feature_flags is not None: - result["featureFlags"] = from_union([lambda x: from_dict(from_bool, x), from_none], self.feature_flags) + result["featureFlags"] = from_union( + [lambda x: from_dict(from_bool, x), from_none], self.feature_flags + ) if self.installed_plugins is not None: - result["installedPlugins"] = from_union([lambda x: from_list(lambda x: to_class(SessionInstalledPlugin, x), x), from_none], self.installed_plugins) + result["installedPlugins"] = from_union( + [lambda x: from_list(lambda x: to_class(SessionInstalledPlugin, x), x), from_none], + self.installed_plugins, + ) if self.integration_id is not None: result["integrationId"] = from_union([from_str, from_none], self.integration_id) if self.is_experimental_mode is not None: - result["isExperimentalMode"] = from_union([from_bool, from_none], self.is_experimental_mode) + result["isExperimentalMode"] = from_union( + [from_bool, from_none], self.is_experimental_mode + ) if self.log_interactive_shells is not None: - result["logInteractiveShells"] = from_union([from_bool, from_none], self.log_interactive_shells) + result["logInteractiveShells"] = from_union( + [from_bool, from_none], self.log_interactive_shells + ) if self.lsp_client_name is not None: result["lspClientName"] = from_union([from_str, from_none], self.lsp_client_name) if self.manage_schedule_enabled is not None: - result["manageScheduleEnabled"] = from_union([from_bool, from_none], self.manage_schedule_enabled) + result["manageScheduleEnabled"] = from_union( + [from_bool, from_none], self.manage_schedule_enabled + ) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.provider is not None: @@ -14163,23 +16226,32 @@ def to_dict(self) -> dict: if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.running_in_interactive_mode is not None: - result["runningInInteractiveMode"] = from_union([from_bool, from_none], self.running_in_interactive_mode) + result["runningInInteractiveMode"] = from_union( + [from_bool, from_none], self.running_in_interactive_mode + ) if self.sandbox_config is not None: result["sandboxConfig"] = self.sandbox_config if self.shell_init_profile is not None: result["shellInitProfile"] = from_union([from_str, from_none], self.shell_init_profile) if self.shell_process_flags is not None: - result["shellProcessFlags"] = from_union([lambda x: from_list(from_str, x), from_none], self.shell_process_flags) + result["shellProcessFlags"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.shell_process_flags + ) if self.skill_directories is not None: - result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) + result["skillDirectories"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.skill_directories + ) if self.skip_custom_instructions is not None: - result["skipCustomInstructions"] = from_union([from_bool, from_none], self.skip_custom_instructions) + result["skipCustomInstructions"] = from_union( + [from_bool, from_none], self.skip_custom_instructions + ) if self.trajectory_file is not None: result["trajectoryFile"] = from_union([from_str, from_none], self.trajectory_file) if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationRequest: @@ -14192,7 +16264,7 @@ class UIElicitationRequest: """JSON Schema describing the form fields to present to the user""" @staticmethod - def from_dict(obj: Any) -> 'UIElicitationRequest': + def from_dict(obj: Any) -> "UIElicitationRequest": assert isinstance(obj, dict) message = from_str(obj.get("message")) requested_schema = UIElicitationSchema.from_dict(obj.get("requestedSchema")) @@ -14204,6 +16276,7 @@ def to_dict(self) -> dict: result["requestedSchema"] = to_class(UIElicitationSchema, self.requested_schema) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPExecuteSamplingParams: @@ -14228,7 +16301,7 @@ class MCPExecuteSamplingParams: """Name of the MCP server that initiated the sampling request""" @staticmethod - def from_dict(obj: Any) -> 'MCPExecuteSamplingParams': + def from_dict(obj: Any) -> "MCPExecuteSamplingParams": assert isinstance(obj, dict) mcp_request_id = from_union([from_float, from_str], obj.get("mcpRequestId")) request = from_dict(lambda x: x, obj.get("request")) @@ -14244,6 +16317,7 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataContextInfoRequest: @@ -14261,7 +16335,7 @@ class MetadataContextInfoRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataContextInfoRequest': + def from_dict(obj: Any) -> "MetadataContextInfoRequest": assert isinstance(obj, dict) output_token_limit = from_int(obj.get("outputTokenLimit")) prompt_token_limit = from_int(obj.get("promptTokenLimit")) @@ -14276,6 +16350,7 @@ def to_dict(self) -> dict: result["selectedModel"] = from_union([from_str, from_none], self.selected_model) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecomputeContextTokensRequest: @@ -14287,7 +16362,7 @@ class MetadataRecomputeContextTokensRequest: """ @staticmethod - def from_dict(obj: Any) -> 'MetadataRecomputeContextTokensRequest': + def from_dict(obj: Any) -> "MetadataRecomputeContextTokensRequest": assert isinstance(obj, dict) model_id = from_str(obj.get("modelId")) return MetadataRecomputeContextTokensRequest(model_id) @@ -14297,6 +16372,7 @@ def to_dict(self) -> dict: result["modelId"] = from_str(self.model_id) return result + @dataclass class ModelCapabilities: """Model capabilities and limits""" @@ -14308,7 +16384,7 @@ class ModelCapabilities: """Feature flags indicating what the model supports""" @staticmethod - def from_dict(obj: Any) -> 'ModelCapabilities': + def from_dict(obj: Any) -> "ModelCapabilities": assert isinstance(obj, dict) limits = from_union([ModelCapabilitiesLimits.from_dict, from_none], obj.get("limits")) supports = from_union([ModelCapabilitiesSupports.from_dict, from_none], obj.get("supports")) @@ -14317,11 +16393,16 @@ def from_dict(obj: Any) -> 'ModelCapabilities': def to_dict(self) -> dict: result: dict = {} if self.limits is not None: - result["limits"] = from_union([lambda x: to_class(ModelCapabilitiesLimits, x), from_none], self.limits) + result["limits"] = from_union( + [lambda x: to_class(ModelCapabilitiesLimits, x), from_none], self.limits + ) if self.supports is not None: - result["supports"] = from_union([lambda x: to_class(ModelCapabilitiesSupports, x), from_none], self.supports) + result["supports"] = from_union( + [lambda x: to_class(ModelCapabilitiesSupports, x), from_none], self.supports + ) return result + class ModelPickerCategory(Enum): """Model capability category for grouping in the model picker""" @@ -14329,6 +16410,7 @@ class ModelPickerCategory(Enum): POWERFUL = "powerful" VERSATILE = "versatile" + @dataclass class Model: """Schema for the `Model` type.""" @@ -14361,18 +16443,36 @@ class Model: """Supported reasoning effort levels (only present if model supports reasoning effort)""" @staticmethod - def from_dict(obj: Any) -> 'Model': + def from_dict(obj: Any) -> "Model": assert isinstance(obj, dict) capabilities = ModelCapabilities.from_dict(obj.get("capabilities")) id = from_str(obj.get("id")) name = from_str(obj.get("name")) billing = from_union([ModelBilling.from_dict, from_none], obj.get("billing")) - default_reasoning_effort = from_union([from_str, from_none], obj.get("defaultReasoningEffort")) - model_picker_category = from_union([ModelPickerCategory, from_none], obj.get("modelPickerCategory")) - model_picker_price_category = from_union([ModelPickerPriceCategory, from_none], obj.get("modelPickerPriceCategory")) + default_reasoning_effort = from_union( + [from_str, from_none], obj.get("defaultReasoningEffort") + ) + model_picker_category = from_union( + [ModelPickerCategory, from_none], obj.get("modelPickerCategory") + ) + model_picker_price_category = from_union( + [ModelPickerPriceCategory, from_none], obj.get("modelPickerPriceCategory") + ) policy = from_union([ModelPolicy.from_dict, from_none], obj.get("policy")) - supported_reasoning_efforts = from_union([lambda x: from_list(from_str, x), from_none], obj.get("supportedReasoningEfforts")) - return Model(capabilities, id, name, billing, default_reasoning_effort, model_picker_category, model_picker_price_category, policy, supported_reasoning_efforts) + supported_reasoning_efforts = from_union( + [lambda x: from_list(from_str, x), from_none], obj.get("supportedReasoningEfforts") + ) + return Model( + capabilities, + id, + name, + billing, + default_reasoning_effort, + model_picker_category, + model_picker_price_category, + policy, + supported_reasoning_efforts, + ) def to_dict(self) -> dict: result: dict = {} @@ -14380,29 +16480,44 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) result["name"] = from_str(self.name) if self.billing is not None: - result["billing"] = from_union([lambda x: to_class(ModelBilling, x), from_none], self.billing) + result["billing"] = from_union( + [lambda x: to_class(ModelBilling, x), from_none], self.billing + ) if self.default_reasoning_effort is not None: - result["defaultReasoningEffort"] = from_union([from_str, from_none], self.default_reasoning_effort) + result["defaultReasoningEffort"] = from_union( + [from_str, from_none], self.default_reasoning_effort + ) if self.model_picker_category is not None: - result["modelPickerCategory"] = from_union([lambda x: to_enum(ModelPickerCategory, x), from_none], self.model_picker_category) + result["modelPickerCategory"] = from_union( + [lambda x: to_enum(ModelPickerCategory, x), from_none], self.model_picker_category + ) if self.model_picker_price_category is not None: - result["modelPickerPriceCategory"] = from_union([lambda x: to_enum(ModelPickerPriceCategory, x), from_none], self.model_picker_price_category) + result["modelPickerPriceCategory"] = from_union( + [lambda x: to_enum(ModelPickerPriceCategory, x), from_none], + self.model_picker_price_category, + ) if self.policy is not None: - result["policy"] = from_union([lambda x: to_class(ModelPolicy, x), from_none], self.policy) + result["policy"] = from_union( + [lambda x: to_class(ModelPolicy, x), from_none], self.policy + ) if self.supported_reasoning_efforts is not None: - result["supportedReasoningEfforts"] = from_union([lambda x: from_list(from_str, x), from_none], self.supported_reasoning_efforts) + result["supportedReasoningEfforts"] = from_union( + [lambda x: from_list(from_str, x), from_none], self.supported_reasoning_efforts + ) return result + @dataclass class ModelList: """List of Copilot models available to the resolved user, including capabilities and billing metadata. """ + models: list[Model] """List of available models with full metadata""" @staticmethod - def from_dict(obj: Any) -> 'ModelList': + def from_dict(obj: Any) -> "ModelList": assert isinstance(obj, dict) models = from_list(Model.from_dict, obj.get("models")) return ModelList(models) @@ -14412,6 +16527,7 @@ def to_dict(self) -> dict: result["models"] = from_list(lambda x: to_class(Model, x), self.models) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSwitchToRequest: @@ -14430,25 +16546,35 @@ class ModelSwitchToRequest: """Reasoning summary mode to request for supported model clients""" @staticmethod - def from_dict(obj: Any) -> 'ModelSwitchToRequest': + def from_dict(obj: Any) -> "ModelSwitchToRequest": assert isinstance(obj, dict) model_id = from_str(obj.get("modelId")) - model_capabilities = from_union([ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilities")) + model_capabilities = from_union( + [ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilities") + ) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) reasoning_summary = from_union([ReasoningSummary, from_none], obj.get("reasoningSummary")) - return ModelSwitchToRequest(model_id, model_capabilities, reasoning_effort, reasoning_summary) + return ModelSwitchToRequest( + model_id, model_capabilities, reasoning_effort, reasoning_summary + ) def to_dict(self) -> dict: result: dict = {} result["modelId"] = from_str(self.model_id) if self.model_capabilities is not None: - result["modelCapabilities"] = from_union([lambda x: to_class(ModelCapabilitiesOverride, x), from_none], self.model_capabilities) + result["modelCapabilities"] = from_union( + [lambda x: to_class(ModelCapabilitiesOverride, x), from_none], + self.model_capabilities, + ) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.reasoning_summary is not None: - result["reasoningSummary"] = from_union([lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary) + result["reasoningSummary"] = from_union( + [lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsSetApproveAllSource(Enum): """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @@ -14458,6 +16584,7 @@ class PermissionsSetApproveAllSource(Enum): RPC = "rpc" SLASH_COMMAND = "slash_command" + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetApproveAllRequest: @@ -14470,7 +16597,7 @@ class PermissionsSetApproveAllRequest: """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @staticmethod - def from_dict(obj: Any) -> 'PermissionsSetApproveAllRequest': + def from_dict(obj: Any) -> "PermissionsSetApproveAllRequest": assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) source = from_union([PermissionsSetApproveAllSource, from_none], obj.get("source")) @@ -14480,9 +16607,12 @@ def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) if self.source is not None: - result["source"] = from_union([lambda x: to_enum(PermissionsSetApproveAllSource, x), from_none], self.source) + result["source"] = from_union( + [lambda x: to_enum(PermissionsSetApproveAllSource, x), from_none], self.source + ) return result + # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskAgentInfo: @@ -14545,7 +16675,7 @@ class TaskAgentInfo: """Result text from the task when available""" @staticmethod - def from_dict(obj: Any) -> 'TaskAgentInfo': + def from_dict(obj: Any) -> "TaskAgentInfo": assert isinstance(obj, dict) agent_type = from_str(obj.get("agentType")) description = from_str(obj.get("description")) @@ -14556,7 +16686,9 @@ def from_dict(obj: Any) -> 'TaskAgentInfo': tool_call_id = from_str(obj.get("toolCallId")) active_started_at = from_union([from_datetime, from_none], obj.get("activeStartedAt")) active_time_ms = from_union([from_int, from_none], obj.get("activeTimeMs")) - can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) + can_promote_to_background = from_union( + [from_bool, from_none], obj.get("canPromoteToBackground") + ) completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) error = from_union([from_str, from_none], obj.get("error")) execution_mode = from_union([TaskExecutionMode, from_none], obj.get("executionMode")) @@ -14564,7 +16696,25 @@ def from_dict(obj: Any) -> 'TaskAgentInfo': latest_response = from_union([from_str, from_none], obj.get("latestResponse")) model = from_union([from_str, from_none], obj.get("model")) result = from_union([from_str, from_none], obj.get("result")) - return TaskAgentInfo(agent_type, description, id, prompt, started_at, status, tool_call_id, active_started_at, active_time_ms, can_promote_to_background, completed_at, error, execution_mode, idle_since, latest_response, model, result) + return TaskAgentInfo( + agent_type, + description, + id, + prompt, + started_at, + status, + tool_call_id, + active_started_at, + active_time_ms, + can_promote_to_background, + completed_at, + error, + execution_mode, + idle_since, + latest_response, + model, + result, + ) def to_dict(self) -> dict: result: dict = {} @@ -14577,17 +16727,25 @@ def to_dict(self) -> dict: result["toolCallId"] = from_str(self.tool_call_id) result["type"] = self.type if self.active_started_at is not None: - result["activeStartedAt"] = from_union([lambda x: x.isoformat(), from_none], self.active_started_at) + result["activeStartedAt"] = from_union( + [lambda x: x.isoformat(), from_none], self.active_started_at + ) if self.active_time_ms is not None: result["activeTimeMs"] = from_union([from_int, from_none], self.active_time_ms) if self.can_promote_to_background is not None: - result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) + result["canPromoteToBackground"] = from_union( + [from_bool, from_none], self.can_promote_to_background + ) if self.completed_at is not None: - result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) + result["completedAt"] = from_union( + [lambda x: x.isoformat(), from_none], self.completed_at + ) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.execution_mode is not None: - result["executionMode"] = from_union([lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode) + result["executionMode"] = from_union( + [lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode + ) if self.idle_since is not None: result["idleSince"] = from_union([lambda x: x.isoformat(), from_none], self.idle_since) if self.latest_response is not None: @@ -14598,6 +16756,7 @@ def to_dict(self) -> dict: result["result"] = from_union([from_str, from_none], self.result) return result + @dataclass class RPC: abort_request: AbortRequest @@ -14617,13 +16776,19 @@ class RPC: auth_info_type: AuthInfoType canvas_action: CanvasAction canvas_close_request: CanvasCloseRequest + canvas_host_context: CanvasHostContext + canvas_host_context_capabilities: CanvasHostContextCapabilities canvas_instance_availability: CanvasInstanceAvailability canvas_invoke_action_request: CanvasInvokeActionRequest - canvas_invoke_action_result: CanvasInvokeActionResult + canvas_invoke_action_result: Any canvas_json_schema: Any canvas_list: CanvasList canvas_list_open_result: CanvasListOpenResult canvas_open_request: CanvasOpenRequest + canvas_provider_close_request: CanvasProviderCloseRequest + canvas_provider_invoke_action_request: CanvasProviderInvokeActionRequest + canvas_provider_open_request: CanvasProviderOpenRequest + canvas_provider_open_result: CanvasProviderOpenResult command_list: CommandList commands_handle_pending_command_request: CommandsHandlePendingCommandRequest commands_handle_pending_command_result: CommandsHandlePendingCommandResult @@ -14644,7 +16809,9 @@ class RPC: copilot_user_response_quota_snapshots: dict[str, CopilotUserResponseQuotaSnapshots | None] copilot_user_response_quota_snapshots_chat: CopilotUserResponseQuotaSnapshotsChat copilot_user_response_quota_snapshots_completions: CopilotUserResponseQuotaSnapshotsCompletions - copilot_user_response_quota_snapshots_premium_interactions: CopilotUserResponseQuotaSnapshotsPremiumInteractions + copilot_user_response_quota_snapshots_premium_interactions: ( + CopilotUserResponseQuotaSnapshotsPremiumInteractions + ) current_model: CurrentModel discovered_canvas: DiscoveredCanvas discovered_mcp_server: DiscoveredMCPServer @@ -14669,15 +16836,25 @@ class RPC: extension_status: ExtensionStatus external_tool_result: ExternalToolTextResultForLlm | str external_tool_text_result_for_llm: ExternalToolTextResultForLlm - external_tool_text_result_for_llm_binary_results_for_llm: ExternalToolTextResultForLlmBinaryResultsForLlm - external_tool_text_result_for_llm_binary_results_for_llm_type: ExternalToolTextResultForLlmBinaryResultsForLlmType + external_tool_text_result_for_llm_binary_results_for_llm: ( + ExternalToolTextResultForLlmBinaryResultsForLlm + ) + external_tool_text_result_for_llm_binary_results_for_llm_type: ( + ExternalToolTextResultForLlmBinaryResultsForLlmType + ) external_tool_text_result_for_llm_content: ExternalToolTextResultForLlmContent external_tool_text_result_for_llm_content_audio: ExternalToolTextResultForLlmContentAudio external_tool_text_result_for_llm_content_image: ExternalToolTextResultForLlmContentImage external_tool_text_result_for_llm_content_resource: ExternalToolTextResultForLlmContentResource - external_tool_text_result_for_llm_content_resource_details: ExternalToolTextResultForLlmContentResourceDetails - external_tool_text_result_for_llm_content_resource_link: ExternalToolTextResultForLlmContentResourceLink - external_tool_text_result_for_llm_content_resource_link_icon: ExternalToolTextResultForLlmContentResourceLinkIcon + external_tool_text_result_for_llm_content_resource_details: ( + ExternalToolTextResultForLlmContentResourceDetails + ) + external_tool_text_result_for_llm_content_resource_link: ( + ExternalToolTextResultForLlmContentResourceLink + ) + external_tool_text_result_for_llm_content_resource_link_icon: ( + ExternalToolTextResultForLlmContentResourceLinkIcon + ) external_tool_text_result_for_llm_content_resource_link_icon_theme: Theme external_tool_text_result_for_llm_content_terminal: ExternalToolTextResultForLlmContentTerminal external_tool_text_result_for_llm_content_text: ExternalToolTextResultForLlmContentText @@ -14814,34 +16991,76 @@ class RPC: permission_decision_approved_for_session: PermissionDecisionApprovedForSession permission_decision_approve_for_location: PermissionDecisionApproveForLocation permission_decision_approve_for_location_approval: PermissionDecisionApproveForLocationApproval - permission_decision_approve_for_location_approval_commands: PermissionDecisionApproveForLocationApprovalCommands - permission_decision_approve_for_location_approval_custom_tool: PermissionDecisionApproveForLocationApprovalCustomTool - permission_decision_approve_for_location_approval_extension_management: PermissionDecisionApproveForLocationApprovalExtensionManagement - permission_decision_approve_for_location_approval_extension_permission_access: PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess - permission_decision_approve_for_location_approval_mcp: PermissionDecisionApproveForLocationApprovalMCP - permission_decision_approve_for_location_approval_mcp_sampling: PermissionDecisionApproveForLocationApprovalMCPSampling - permission_decision_approve_for_location_approval_memory: PermissionDecisionApproveForLocationApprovalMemory - permission_decision_approve_for_location_approval_read: PermissionDecisionApproveForLocationApprovalRead - permission_decision_approve_for_location_approval_write: PermissionDecisionApproveForLocationApprovalWrite + permission_decision_approve_for_location_approval_commands: ( + PermissionDecisionApproveForLocationApprovalCommands + ) + permission_decision_approve_for_location_approval_custom_tool: ( + PermissionDecisionApproveForLocationApprovalCustomTool + ) + permission_decision_approve_for_location_approval_extension_management: ( + PermissionDecisionApproveForLocationApprovalExtensionManagement + ) + permission_decision_approve_for_location_approval_extension_permission_access: ( + PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess + ) + permission_decision_approve_for_location_approval_mcp: ( + PermissionDecisionApproveForLocationApprovalMCP + ) + permission_decision_approve_for_location_approval_mcp_sampling: ( + PermissionDecisionApproveForLocationApprovalMCPSampling + ) + permission_decision_approve_for_location_approval_memory: ( + PermissionDecisionApproveForLocationApprovalMemory + ) + permission_decision_approve_for_location_approval_read: ( + PermissionDecisionApproveForLocationApprovalRead + ) + permission_decision_approve_for_location_approval_write: ( + PermissionDecisionApproveForLocationApprovalWrite + ) permission_decision_approve_for_session: PermissionDecisionApproveForSession permission_decision_approve_for_session_approval: PermissionDecisionApproveForSessionApproval - permission_decision_approve_for_session_approval_commands: PermissionDecisionApproveForSessionApprovalCommands - permission_decision_approve_for_session_approval_custom_tool: PermissionDecisionApproveForSessionApprovalCustomTool - permission_decision_approve_for_session_approval_extension_management: PermissionDecisionApproveForSessionApprovalExtensionManagement - permission_decision_approve_for_session_approval_extension_permission_access: PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess - permission_decision_approve_for_session_approval_mcp: PermissionDecisionApproveForSessionApprovalMCP - permission_decision_approve_for_session_approval_mcp_sampling: PermissionDecisionApproveForSessionApprovalMCPSampling - permission_decision_approve_for_session_approval_memory: PermissionDecisionApproveForSessionApprovalMemory - permission_decision_approve_for_session_approval_read: PermissionDecisionApproveForSessionApprovalRead - permission_decision_approve_for_session_approval_write: PermissionDecisionApproveForSessionApprovalWrite + permission_decision_approve_for_session_approval_commands: ( + PermissionDecisionApproveForSessionApprovalCommands + ) + permission_decision_approve_for_session_approval_custom_tool: ( + PermissionDecisionApproveForSessionApprovalCustomTool + ) + permission_decision_approve_for_session_approval_extension_management: ( + PermissionDecisionApproveForSessionApprovalExtensionManagement + ) + permission_decision_approve_for_session_approval_extension_permission_access: ( + PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess + ) + permission_decision_approve_for_session_approval_mcp: ( + PermissionDecisionApproveForSessionApprovalMCP + ) + permission_decision_approve_for_session_approval_mcp_sampling: ( + PermissionDecisionApproveForSessionApprovalMCPSampling + ) + permission_decision_approve_for_session_approval_memory: ( + PermissionDecisionApproveForSessionApprovalMemory + ) + permission_decision_approve_for_session_approval_read: ( + PermissionDecisionApproveForSessionApprovalRead + ) + permission_decision_approve_for_session_approval_write: ( + PermissionDecisionApproveForSessionApprovalWrite + ) permission_decision_approve_once: PermissionDecisionApproveOnce permission_decision_approve_permanently: PermissionDecisionApprovePermanently permission_decision_cancelled: PermissionDecisionCancelled - permission_decision_denied_by_content_exclusion_policy: PermissionDecisionDeniedByContentExclusionPolicy - permission_decision_denied_by_permission_request_hook: PermissionDecisionDeniedByPermissionRequestHook + permission_decision_denied_by_content_exclusion_policy: ( + PermissionDecisionDeniedByContentExclusionPolicy + ) + permission_decision_denied_by_permission_request_hook: ( + PermissionDecisionDeniedByPermissionRequestHook + ) permission_decision_denied_by_rules: PermissionDecisionDeniedByRules permission_decision_denied_interactively_by_user: PermissionDecisionDeniedInteractivelyByUser - permission_decision_denied_no_approval_rule_and_could_not_request_from_user: PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser + permission_decision_denied_no_approval_rule_and_could_not_request_from_user: ( + PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser + ) permission_decision_reject: PermissionDecisionReject permission_decision_request: PermissionDecisionRequest permission_decision_user_not_available: PermissionDecisionUserNotAvailable @@ -14862,23 +17081,49 @@ class RPC: permission_prompt_shown_notification: PermissionPromptShownNotification permission_request_result: PermissionRequestResult permission_rules_set: PermissionRulesSet - permissions_configure_additional_content_exclusion_policy: PermissionsConfigureAdditionalContentExclusionPolicy - permissions_configure_additional_content_exclusion_policy_rule: PermissionsConfigureAdditionalContentExclusionPolicyRule - permissions_configure_additional_content_exclusion_policy_rule_source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource - permissions_configure_additional_content_exclusion_policy_scope: PermissionsConfigureAdditionalContentExclusionPolicyScope + permissions_configure_additional_content_exclusion_policy: ( + PermissionsConfigureAdditionalContentExclusionPolicy + ) + permissions_configure_additional_content_exclusion_policy_rule: ( + PermissionsConfigureAdditionalContentExclusionPolicyRule + ) + permissions_configure_additional_content_exclusion_policy_rule_source: ( + PermissionsConfigureAdditionalContentExclusionPolicyRuleSource + ) + permissions_configure_additional_content_exclusion_policy_scope: ( + PermissionsConfigureAdditionalContentExclusionPolicyScope + ) permissions_configure_params: PermissionsConfigureParams permissions_configure_result: PermissionsConfigureResult permissions_folder_trust_add_trusted_result: PermissionsFolderTrustAddTrustedResult permissions_locations_add_tool_approval_details: PermissionsLocationsAddToolApprovalDetails - permissions_locations_add_tool_approval_details_commands: PermissionsLocationsAddToolApprovalDetailsCommands - permissions_locations_add_tool_approval_details_custom_tool: PermissionsLocationsAddToolApprovalDetailsCustomTool - permissions_locations_add_tool_approval_details_extension_management: PermissionsLocationsAddToolApprovalDetailsExtensionManagement - permissions_locations_add_tool_approval_details_extension_permission_access: PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess - permissions_locations_add_tool_approval_details_mcp: PermissionsLocationsAddToolApprovalDetailsMCP - permissions_locations_add_tool_approval_details_mcp_sampling: PermissionsLocationsAddToolApprovalDetailsMCPSampling - permissions_locations_add_tool_approval_details_memory: PermissionsLocationsAddToolApprovalDetailsMemory - permissions_locations_add_tool_approval_details_read: PermissionsLocationsAddToolApprovalDetailsRead - permissions_locations_add_tool_approval_details_write: PermissionsLocationsAddToolApprovalDetailsWrite + permissions_locations_add_tool_approval_details_commands: ( + PermissionsLocationsAddToolApprovalDetailsCommands + ) + permissions_locations_add_tool_approval_details_custom_tool: ( + PermissionsLocationsAddToolApprovalDetailsCustomTool + ) + permissions_locations_add_tool_approval_details_extension_management: ( + PermissionsLocationsAddToolApprovalDetailsExtensionManagement + ) + permissions_locations_add_tool_approval_details_extension_permission_access: ( + PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess + ) + permissions_locations_add_tool_approval_details_mcp: ( + PermissionsLocationsAddToolApprovalDetailsMCP + ) + permissions_locations_add_tool_approval_details_mcp_sampling: ( + PermissionsLocationsAddToolApprovalDetailsMCPSampling + ) + permissions_locations_add_tool_approval_details_memory: ( + PermissionsLocationsAddToolApprovalDetailsMemory + ) + permissions_locations_add_tool_approval_details_read: ( + PermissionsLocationsAddToolApprovalDetailsRead + ) + permissions_locations_add_tool_approval_details_write: ( + PermissionsLocationsAddToolApprovalDetailsWrite + ) permissions_locations_add_tool_approval_result: PermissionsLocationsAddToolApprovalResult permissions_modify_rules_params: PermissionsModifyRulesParams permissions_modify_rules_result: PermissionsModifyRulesResult @@ -15115,8 +17360,12 @@ class RPC: ui_handle_pending_sampling_response: dict[str, Any] ui_handle_pending_user_input_request: UIHandlePendingUserInputRequest ui_register_direct_auto_mode_switch_handler_result: UIRegisterDirectAutoModeSwitchHandlerResult - ui_unregister_direct_auto_mode_switch_handler_request: UIUnregisterDirectAutoModeSwitchHandlerRequest - ui_unregister_direct_auto_mode_switch_handler_result: UIUnregisterDirectAutoModeSwitchHandlerResult + ui_unregister_direct_auto_mode_switch_handler_request: ( + UIUnregisterDirectAutoModeSwitchHandlerRequest + ) + ui_unregister_direct_auto_mode_switch_handler_result: ( + UIUnregisterDirectAutoModeSwitchHandlerResult + ) ui_user_input_response: UIUserInputResponse usage_get_metrics_result: UsageGetMetricsResult usage_metrics_code_changes: UsageMetricsCodeChanges @@ -15149,11 +17398,13 @@ class RPC: workspace_summary: WorkspaceSummary | None = None @staticmethod - def from_dict(obj: Any) -> 'RPC': + def from_dict(obj: Any) -> "RPC": assert isinstance(obj, dict) abort_request = AbortRequest.from_dict(obj.get("AbortRequest")) abort_result = AbortResult.from_dict(obj.get("AbortResult")) - account_get_quota_request = AccountGetQuotaRequest.from_dict(obj.get("AccountGetQuotaRequest")) + account_get_quota_request = AccountGetQuotaRequest.from_dict( + obj.get("AccountGetQuotaRequest") + ) account_get_quota_result = AccountGetQuotaResult.from_dict(obj.get("AccountGetQuotaResult")) account_quota_snapshot = AccountQuotaSnapshot.from_dict(obj.get("AccountQuotaSnapshot")) agent_get_current_result = AgentGetCurrentResult.from_dict(obj.get("AgentGetCurrentResult")) @@ -15168,34 +17419,93 @@ def from_dict(obj: Any) -> 'RPC': auth_info_type = AuthInfoType(obj.get("AuthInfoType")) canvas_action = CanvasAction.from_dict(obj.get("CanvasAction")) canvas_close_request = CanvasCloseRequest.from_dict(obj.get("CanvasCloseRequest")) - canvas_instance_availability = CanvasInstanceAvailability(obj.get("CanvasInstanceAvailability")) - canvas_invoke_action_request = CanvasInvokeActionRequest.from_dict(obj.get("CanvasInvokeActionRequest")) - canvas_invoke_action_result = CanvasInvokeActionResult.from_dict(obj.get("CanvasInvokeActionResult")) + canvas_host_context = CanvasHostContext.from_dict(obj.get("CanvasHostContext")) + canvas_host_context_capabilities = CanvasHostContextCapabilities.from_dict( + obj.get("CanvasHostContextCapabilities") + ) + canvas_instance_availability = CanvasInstanceAvailability( + obj.get("CanvasInstanceAvailability") + ) + canvas_invoke_action_request = CanvasInvokeActionRequest.from_dict( + obj.get("CanvasInvokeActionRequest") + ) + canvas_invoke_action_result = obj.get("CanvasInvokeActionResult") canvas_json_schema = obj.get("CanvasJsonSchema") canvas_list = CanvasList.from_dict(obj.get("CanvasList")) canvas_list_open_result = CanvasListOpenResult.from_dict(obj.get("CanvasListOpenResult")) canvas_open_request = CanvasOpenRequest.from_dict(obj.get("CanvasOpenRequest")) + canvas_provider_close_request = CanvasProviderCloseRequest.from_dict( + obj.get("CanvasProviderCloseRequest") + ) + canvas_provider_invoke_action_request = CanvasProviderInvokeActionRequest.from_dict( + obj.get("CanvasProviderInvokeActionRequest") + ) + canvas_provider_open_request = CanvasProviderOpenRequest.from_dict( + obj.get("CanvasProviderOpenRequest") + ) + canvas_provider_open_result = CanvasProviderOpenResult.from_dict( + obj.get("CanvasProviderOpenResult") + ) command_list = CommandList.from_dict(obj.get("CommandList")) - commands_handle_pending_command_request = CommandsHandlePendingCommandRequest.from_dict(obj.get("CommandsHandlePendingCommandRequest")) - commands_handle_pending_command_result = CommandsHandlePendingCommandResult.from_dict(obj.get("CommandsHandlePendingCommandResult")) + commands_handle_pending_command_request = CommandsHandlePendingCommandRequest.from_dict( + obj.get("CommandsHandlePendingCommandRequest") + ) + commands_handle_pending_command_result = CommandsHandlePendingCommandResult.from_dict( + obj.get("CommandsHandlePendingCommandResult") + ) commands_invoke_request = CommandsInvokeRequest.from_dict(obj.get("CommandsInvokeRequest")) commands_list_request = CommandsListRequest.from_dict(obj.get("CommandsListRequest")) - commands_respond_to_queued_command_request = CommandsRespondToQueuedCommandRequest.from_dict(obj.get("CommandsRespondToQueuedCommandRequest")) - commands_respond_to_queued_command_result = CommandsRespondToQueuedCommandResult.from_dict(obj.get("CommandsRespondToQueuedCommandResult")) - connected_remote_session_metadata = ConnectedRemoteSessionMetadata.from_dict(obj.get("ConnectedRemoteSessionMetadata")) - connected_remote_session_metadata_kind = ConnectedRemoteSessionMetadataKind(obj.get("ConnectedRemoteSessionMetadataKind")) - connected_remote_session_metadata_repository = ConnectedRemoteSessionMetadataRepository.from_dict(obj.get("ConnectedRemoteSessionMetadataRepository")) - connect_remote_session_params = ConnectRemoteSessionParams.from_dict(obj.get("ConnectRemoteSessionParams")) + commands_respond_to_queued_command_request = ( + CommandsRespondToQueuedCommandRequest.from_dict( + obj.get("CommandsRespondToQueuedCommandRequest") + ) + ) + commands_respond_to_queued_command_result = CommandsRespondToQueuedCommandResult.from_dict( + obj.get("CommandsRespondToQueuedCommandResult") + ) + connected_remote_session_metadata = ConnectedRemoteSessionMetadata.from_dict( + obj.get("ConnectedRemoteSessionMetadata") + ) + connected_remote_session_metadata_kind = ConnectedRemoteSessionMetadataKind( + obj.get("ConnectedRemoteSessionMetadataKind") + ) + connected_remote_session_metadata_repository = ( + ConnectedRemoteSessionMetadataRepository.from_dict( + obj.get("ConnectedRemoteSessionMetadataRepository") + ) + ) + connect_remote_session_params = ConnectRemoteSessionParams.from_dict( + obj.get("ConnectRemoteSessionParams") + ) connect_request = _ConnectRequest.from_dict(obj.get("ConnectRequest")) connect_result = _ConnectResult.from_dict(obj.get("ConnectResult")) content_filter_mode = ContentFilterMode(obj.get("ContentFilterMode")) - copilot_api_token_auth_info = CopilotAPITokenAuthInfo.from_dict(obj.get("CopilotApiTokenAuthInfo")) + copilot_api_token_auth_info = CopilotAPITokenAuthInfo.from_dict( + obj.get("CopilotApiTokenAuthInfo") + ) copilot_user_response = CopilotUserResponse.from_dict(obj.get("CopilotUserResponse")) - copilot_user_response_endpoints = CopilotUserResponseEndpoints.from_dict(obj.get("CopilotUserResponseEndpoints")) - copilot_user_response_quota_snapshots = from_dict(lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), obj.get("CopilotUserResponseQuotaSnapshots")) - copilot_user_response_quota_snapshots_chat = CopilotUserResponseQuotaSnapshotsChat.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsChat")) - copilot_user_response_quota_snapshots_completions = CopilotUserResponseQuotaSnapshotsCompletions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsCompletions")) - copilot_user_response_quota_snapshots_premium_interactions = CopilotUserResponseQuotaSnapshotsPremiumInteractions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsPremiumInteractions")) + copilot_user_response_endpoints = CopilotUserResponseEndpoints.from_dict( + obj.get("CopilotUserResponseEndpoints") + ) + copilot_user_response_quota_snapshots = from_dict( + lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), + obj.get("CopilotUserResponseQuotaSnapshots"), + ) + copilot_user_response_quota_snapshots_chat = ( + CopilotUserResponseQuotaSnapshotsChat.from_dict( + obj.get("CopilotUserResponseQuotaSnapshotsChat") + ) + ) + copilot_user_response_quota_snapshots_completions = ( + CopilotUserResponseQuotaSnapshotsCompletions.from_dict( + obj.get("CopilotUserResponseQuotaSnapshotsCompletions") + ) + ) + copilot_user_response_quota_snapshots_premium_interactions = ( + CopilotUserResponseQuotaSnapshotsPremiumInteractions.from_dict( + obj.get("CopilotUserResponseQuotaSnapshotsPremiumInteractions") + ) + ) current_model = CurrentModel.from_dict(obj.get("CurrentModel")) discovered_canvas = DiscoveredCanvas.from_dict(obj.get("DiscoveredCanvas")) discovered_mcp_server = DiscoveredMCPServer.from_dict(obj.get("DiscoveredMcpServer")) @@ -15204,9 +17514,13 @@ def from_dict(obj: Any) -> 'RPC': enqueue_command_result = EnqueueCommandResult.from_dict(obj.get("EnqueueCommandResult")) env_auth_info = EnvAuthInfo.from_dict(obj.get("EnvAuthInfo")) event_log_read_request = EventLogReadRequest.from_dict(obj.get("EventLogReadRequest")) - event_log_release_interest_result = EventLogReleaseInterestResult.from_dict(obj.get("EventLogReleaseInterestResult")) + event_log_release_interest_result = EventLogReleaseInterestResult.from_dict( + obj.get("EventLogReleaseInterestResult") + ) event_log_tail_result = EventLogTailResult.from_dict(obj.get("EventLogTailResult")) - event_log_types = from_union([lambda x: from_list(from_str, x), EventLogTypes], obj.get("EventLogTypes")) + event_log_types = from_union( + [lambda x: from_list(from_str, x), EventLogTypes], obj.get("EventLogTypes") + ) events_agent_scope = EventsAgentScope(obj.get("EventsAgentScope")) events_cursor_status = EventsCursorStatus(obj.get("EventsCursorStatus")) events_read_result = EventsReadResult.from_dict(obj.get("EventsReadResult")) @@ -15214,139 +17528,341 @@ def from_dict(obj: Any) -> 'RPC': execute_command_result = ExecuteCommandResult.from_dict(obj.get("ExecuteCommandResult")) extension = Extension.from_dict(obj.get("Extension")) extension_list = ExtensionList.from_dict(obj.get("ExtensionList")) - extensions_disable_request = ExtensionsDisableRequest.from_dict(obj.get("ExtensionsDisableRequest")) - extensions_enable_request = ExtensionsEnableRequest.from_dict(obj.get("ExtensionsEnableRequest")) + extensions_disable_request = ExtensionsDisableRequest.from_dict( + obj.get("ExtensionsDisableRequest") + ) + extensions_enable_request = ExtensionsEnableRequest.from_dict( + obj.get("ExtensionsEnableRequest") + ) extension_source = ExtensionSource(obj.get("ExtensionSource")) extension_status = ExtensionStatus(obj.get("ExtensionStatus")) - external_tool_result = from_union([ExternalToolTextResultForLlm.from_dict, from_str], obj.get("ExternalToolResult")) - external_tool_text_result_for_llm = ExternalToolTextResultForLlm.from_dict(obj.get("ExternalToolTextResultForLlm")) - external_tool_text_result_for_llm_binary_results_for_llm = ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict(obj.get("ExternalToolTextResultForLlmBinaryResultsForLlm")) - external_tool_text_result_for_llm_binary_results_for_llm_type = ExternalToolTextResultForLlmBinaryResultsForLlmType(obj.get("ExternalToolTextResultForLlmBinaryResultsForLlmType")) - external_tool_text_result_for_llm_content = _load_ExternalToolTextResultForLlmContent(obj.get("ExternalToolTextResultForLlmContent")) - external_tool_text_result_for_llm_content_audio = ExternalToolTextResultForLlmContentAudio.from_dict(obj.get("ExternalToolTextResultForLlmContentAudio")) - external_tool_text_result_for_llm_content_image = ExternalToolTextResultForLlmContentImage.from_dict(obj.get("ExternalToolTextResultForLlmContentImage")) - external_tool_text_result_for_llm_content_resource = ExternalToolTextResultForLlmContentResource.from_dict(obj.get("ExternalToolTextResultForLlmContentResource")) - external_tool_text_result_for_llm_content_resource_details = (lambda x: from_union([EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x))(obj.get("ExternalToolTextResultForLlmContentResourceDetails")) - external_tool_text_result_for_llm_content_resource_link = ExternalToolTextResultForLlmContentResourceLink.from_dict(obj.get("ExternalToolTextResultForLlmContentResourceLink")) - external_tool_text_result_for_llm_content_resource_link_icon = ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict(obj.get("ExternalToolTextResultForLlmContentResourceLinkIcon")) - external_tool_text_result_for_llm_content_resource_link_icon_theme = Theme(obj.get("ExternalToolTextResultForLlmContentResourceLinkIconTheme")) - external_tool_text_result_for_llm_content_terminal = ExternalToolTextResultForLlmContentTerminal.from_dict(obj.get("ExternalToolTextResultForLlmContentTerminal")) - external_tool_text_result_for_llm_content_text = ExternalToolTextResultForLlmContentText.from_dict(obj.get("ExternalToolTextResultForLlmContentText")) - filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode], obj.get("FilterMapping")) + external_tool_result = from_union( + [ExternalToolTextResultForLlm.from_dict, from_str], obj.get("ExternalToolResult") + ) + external_tool_text_result_for_llm = ExternalToolTextResultForLlm.from_dict( + obj.get("ExternalToolTextResultForLlm") + ) + external_tool_text_result_for_llm_binary_results_for_llm = ( + ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict( + obj.get("ExternalToolTextResultForLlmBinaryResultsForLlm") + ) + ) + external_tool_text_result_for_llm_binary_results_for_llm_type = ( + ExternalToolTextResultForLlmBinaryResultsForLlmType( + obj.get("ExternalToolTextResultForLlmBinaryResultsForLlmType") + ) + ) + external_tool_text_result_for_llm_content = _load_ExternalToolTextResultForLlmContent( + obj.get("ExternalToolTextResultForLlmContent") + ) + external_tool_text_result_for_llm_content_audio = ( + ExternalToolTextResultForLlmContentAudio.from_dict( + obj.get("ExternalToolTextResultForLlmContentAudio") + ) + ) + external_tool_text_result_for_llm_content_image = ( + ExternalToolTextResultForLlmContentImage.from_dict( + obj.get("ExternalToolTextResultForLlmContentImage") + ) + ) + external_tool_text_result_for_llm_content_resource = ( + ExternalToolTextResultForLlmContentResource.from_dict( + obj.get("ExternalToolTextResultForLlmContentResource") + ) + ) + external_tool_text_result_for_llm_content_resource_details = ( + lambda x: from_union( + [EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x + ) + )(obj.get("ExternalToolTextResultForLlmContentResourceDetails")) + external_tool_text_result_for_llm_content_resource_link = ( + ExternalToolTextResultForLlmContentResourceLink.from_dict( + obj.get("ExternalToolTextResultForLlmContentResourceLink") + ) + ) + external_tool_text_result_for_llm_content_resource_link_icon = ( + ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict( + obj.get("ExternalToolTextResultForLlmContentResourceLinkIcon") + ) + ) + external_tool_text_result_for_llm_content_resource_link_icon_theme = Theme( + obj.get("ExternalToolTextResultForLlmContentResourceLinkIconTheme") + ) + external_tool_text_result_for_llm_content_terminal = ( + ExternalToolTextResultForLlmContentTerminal.from_dict( + obj.get("ExternalToolTextResultForLlmContentTerminal") + ) + ) + external_tool_text_result_for_llm_content_text = ( + ExternalToolTextResultForLlmContentText.from_dict( + obj.get("ExternalToolTextResultForLlmContentText") + ) + ) + filter_mapping = from_union( + [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode], obj.get("FilterMapping") + ) fleet_start_request = FleetStartRequest.from_dict(obj.get("FleetStartRequest")) fleet_start_result = FleetStartResult.from_dict(obj.get("FleetStartResult")) folder_trust_add_params = FolderTrustAddParams.from_dict(obj.get("FolderTrustAddParams")) - folder_trust_check_params = FolderTrustCheckParams.from_dict(obj.get("FolderTrustCheckParams")) - folder_trust_check_result = FolderTrustCheckResult.from_dict(obj.get("FolderTrustCheckResult")) + folder_trust_check_params = FolderTrustCheckParams.from_dict( + obj.get("FolderTrustCheckParams") + ) + folder_trust_check_result = FolderTrustCheckResult.from_dict( + obj.get("FolderTrustCheckResult") + ) gh_cli_auth_info = GhCLIAuthInfo.from_dict(obj.get("GhCliAuthInfo")) - handle_pending_tool_call_request = HandlePendingToolCallRequest.from_dict(obj.get("HandlePendingToolCallRequest")) - handle_pending_tool_call_result = HandlePendingToolCallResult.from_dict(obj.get("HandlePendingToolCallResult")) - history_abort_manual_compaction_result = HistoryAbortManualCompactionResult.from_dict(obj.get("HistoryAbortManualCompactionResult")) - history_cancel_background_compaction_result = HistoryCancelBackgroundCompactionResult.from_dict(obj.get("HistoryCancelBackgroundCompactionResult")) - history_compact_context_window = HistoryCompactContextWindow.from_dict(obj.get("HistoryCompactContextWindow")) + handle_pending_tool_call_request = HandlePendingToolCallRequest.from_dict( + obj.get("HandlePendingToolCallRequest") + ) + handle_pending_tool_call_result = HandlePendingToolCallResult.from_dict( + obj.get("HandlePendingToolCallResult") + ) + history_abort_manual_compaction_result = HistoryAbortManualCompactionResult.from_dict( + obj.get("HistoryAbortManualCompactionResult") + ) + history_cancel_background_compaction_result = ( + HistoryCancelBackgroundCompactionResult.from_dict( + obj.get("HistoryCancelBackgroundCompactionResult") + ) + ) + history_compact_context_window = HistoryCompactContextWindow.from_dict( + obj.get("HistoryCompactContextWindow") + ) history_compact_request = HistoryCompactRequest.from_dict(obj.get("HistoryCompactRequest")) history_compact_result = HistoryCompactResult.from_dict(obj.get("HistoryCompactResult")) - history_summarize_for_handoff_result = HistorySummarizeForHandoffResult.from_dict(obj.get("HistorySummarizeForHandoffResult")) - history_truncate_request = HistoryTruncateRequest.from_dict(obj.get("HistoryTruncateRequest")) + history_summarize_for_handoff_result = HistorySummarizeForHandoffResult.from_dict( + obj.get("HistorySummarizeForHandoffResult") + ) + history_truncate_request = HistoryTruncateRequest.from_dict( + obj.get("HistoryTruncateRequest") + ) history_truncate_result = HistoryTruncateResult.from_dict(obj.get("HistoryTruncateResult")) hmac_auth_info = HMACAuthInfo.from_dict(obj.get("HMACAuthInfo")) installed_plugin = InstalledPlugin.from_dict(obj.get("InstalledPlugin")) - installed_plugin_source = from_union([InstalledPluginSource.from_dict, from_str], obj.get("InstalledPluginSource")) - installed_plugin_source_github = InstalledPluginSourceGithub.from_dict(obj.get("InstalledPluginSourceGithub")) - installed_plugin_source_local = InstalledPluginSourceLocal.from_dict(obj.get("InstalledPluginSourceLocal")) - installed_plugin_source_url = InstalledPluginSourceURL.from_dict(obj.get("InstalledPluginSourceUrl")) - instructions_get_sources_result = InstructionsGetSourcesResult.from_dict(obj.get("InstructionsGetSourcesResult")) + installed_plugin_source = from_union( + [InstalledPluginSource.from_dict, from_str], obj.get("InstalledPluginSource") + ) + installed_plugin_source_github = InstalledPluginSourceGithub.from_dict( + obj.get("InstalledPluginSourceGithub") + ) + installed_plugin_source_local = InstalledPluginSourceLocal.from_dict( + obj.get("InstalledPluginSourceLocal") + ) + installed_plugin_source_url = InstalledPluginSourceURL.from_dict( + obj.get("InstalledPluginSourceUrl") + ) + instructions_get_sources_result = InstructionsGetSourcesResult.from_dict( + obj.get("InstructionsGetSourcesResult") + ) instructions_sources = InstructionsSources.from_dict(obj.get("InstructionsSources")) - instructions_sources_location = InstructionsSourcesLocation(obj.get("InstructionsSourcesLocation")) + instructions_sources_location = InstructionsSourcesLocation( + obj.get("InstructionsSourcesLocation") + ) instructions_sources_type = InstructionsSourcesType(obj.get("InstructionsSourcesType")) log_request = LogRequest.from_dict(obj.get("LogRequest")) log_result = LogResult.from_dict(obj.get("LogResult")) lsp_initialize_request = LspInitializeRequest.from_dict(obj.get("LspInitializeRequest")) - mcp_apps_call_tool_request = MCPAppsCallToolRequest.from_dict(obj.get("McpAppsCallToolRequest")) - mcp_apps_diagnose_capability = MCPAppsDiagnoseCapability.from_dict(obj.get("McpAppsDiagnoseCapability")) - mcp_apps_diagnose_request = MCPAppsDiagnoseRequest.from_dict(obj.get("McpAppsDiagnoseRequest")) + mcp_apps_call_tool_request = MCPAppsCallToolRequest.from_dict( + obj.get("McpAppsCallToolRequest") + ) + mcp_apps_diagnose_capability = MCPAppsDiagnoseCapability.from_dict( + obj.get("McpAppsDiagnoseCapability") + ) + mcp_apps_diagnose_request = MCPAppsDiagnoseRequest.from_dict( + obj.get("McpAppsDiagnoseRequest") + ) mcp_apps_diagnose_result = MCPAppsDiagnoseResult.from_dict(obj.get("McpAppsDiagnoseResult")) mcp_apps_diagnose_server = MCPAppsDiagnoseServer.from_dict(obj.get("McpAppsDiagnoseServer")) mcp_apps_host_context = MCPAppsHostContext.from_dict(obj.get("McpAppsHostContext")) - mcp_apps_host_context_details = MCPAppsHostContextDetails.from_dict(obj.get("McpAppsHostContextDetails")) - mcp_apps_host_context_details_available_display_mode = MCPAppsDisplayMode(obj.get("McpAppsHostContextDetailsAvailableDisplayMode")) - mcp_apps_host_context_details_display_mode = MCPAppsDisplayMode(obj.get("McpAppsHostContextDetailsDisplayMode")) - mcp_apps_host_context_details_platform = MCPAppsHostContextDetailsPlatform(obj.get("McpAppsHostContextDetailsPlatform")) + mcp_apps_host_context_details = MCPAppsHostContextDetails.from_dict( + obj.get("McpAppsHostContextDetails") + ) + mcp_apps_host_context_details_available_display_mode = MCPAppsDisplayMode( + obj.get("McpAppsHostContextDetailsAvailableDisplayMode") + ) + mcp_apps_host_context_details_display_mode = MCPAppsDisplayMode( + obj.get("McpAppsHostContextDetailsDisplayMode") + ) + mcp_apps_host_context_details_platform = MCPAppsHostContextDetailsPlatform( + obj.get("McpAppsHostContextDetailsPlatform") + ) mcp_apps_host_context_details_theme = Theme(obj.get("McpAppsHostContextDetailsTheme")) - mcp_apps_list_tools_request = MCPAppsListToolsRequest.from_dict(obj.get("McpAppsListToolsRequest")) - mcp_apps_list_tools_result = MCPAppsListToolsResult.from_dict(obj.get("McpAppsListToolsResult")) - mcp_apps_read_resource_request = MCPAppsReadResourceRequest.from_dict(obj.get("McpAppsReadResourceRequest")) - mcp_apps_read_resource_result = MCPAppsReadResourceResult.from_dict(obj.get("McpAppsReadResourceResult")) - mcp_apps_resource_content = MCPAppsResourceContent.from_dict(obj.get("McpAppsResourceContent")) - mcp_apps_set_host_context_details = MCPAppsSetHostContextDetails.from_dict(obj.get("McpAppsSetHostContextDetails")) - mcp_apps_set_host_context_details_available_display_mode = MCPAppsDisplayMode(obj.get("McpAppsSetHostContextDetailsAvailableDisplayMode")) - mcp_apps_set_host_context_details_display_mode = MCPAppsDisplayMode(obj.get("McpAppsSetHostContextDetailsDisplayMode")) - mcp_apps_set_host_context_details_platform = MCPAppsHostContextDetailsPlatform(obj.get("McpAppsSetHostContextDetailsPlatform")) - mcp_apps_set_host_context_details_theme = Theme(obj.get("McpAppsSetHostContextDetailsTheme")) - mcp_apps_set_host_context_request = MCPAppsSetHostContextRequest.from_dict(obj.get("McpAppsSetHostContextRequest")) - mcp_cancel_sampling_execution_params = MCPCancelSamplingExecutionParams.from_dict(obj.get("McpCancelSamplingExecutionParams")) - mcp_cancel_sampling_execution_result = MCPCancelSamplingExecutionResult.from_dict(obj.get("McpCancelSamplingExecutionResult")) + mcp_apps_list_tools_request = MCPAppsListToolsRequest.from_dict( + obj.get("McpAppsListToolsRequest") + ) + mcp_apps_list_tools_result = MCPAppsListToolsResult.from_dict( + obj.get("McpAppsListToolsResult") + ) + mcp_apps_read_resource_request = MCPAppsReadResourceRequest.from_dict( + obj.get("McpAppsReadResourceRequest") + ) + mcp_apps_read_resource_result = MCPAppsReadResourceResult.from_dict( + obj.get("McpAppsReadResourceResult") + ) + mcp_apps_resource_content = MCPAppsResourceContent.from_dict( + obj.get("McpAppsResourceContent") + ) + mcp_apps_set_host_context_details = MCPAppsSetHostContextDetails.from_dict( + obj.get("McpAppsSetHostContextDetails") + ) + mcp_apps_set_host_context_details_available_display_mode = MCPAppsDisplayMode( + obj.get("McpAppsSetHostContextDetailsAvailableDisplayMode") + ) + mcp_apps_set_host_context_details_display_mode = MCPAppsDisplayMode( + obj.get("McpAppsSetHostContextDetailsDisplayMode") + ) + mcp_apps_set_host_context_details_platform = MCPAppsHostContextDetailsPlatform( + obj.get("McpAppsSetHostContextDetailsPlatform") + ) + mcp_apps_set_host_context_details_theme = Theme( + obj.get("McpAppsSetHostContextDetailsTheme") + ) + mcp_apps_set_host_context_request = MCPAppsSetHostContextRequest.from_dict( + obj.get("McpAppsSetHostContextRequest") + ) + mcp_cancel_sampling_execution_params = MCPCancelSamplingExecutionParams.from_dict( + obj.get("McpCancelSamplingExecutionParams") + ) + mcp_cancel_sampling_execution_result = MCPCancelSamplingExecutionResult.from_dict( + obj.get("McpCancelSamplingExecutionResult") + ) mcp_config_add_request = MCPConfigAddRequest.from_dict(obj.get("McpConfigAddRequest")) - mcp_config_disable_request = MCPConfigDisableRequest.from_dict(obj.get("McpConfigDisableRequest")) - mcp_config_enable_request = MCPConfigEnableRequest.from_dict(obj.get("McpConfigEnableRequest")) + mcp_config_disable_request = MCPConfigDisableRequest.from_dict( + obj.get("McpConfigDisableRequest") + ) + mcp_config_enable_request = MCPConfigEnableRequest.from_dict( + obj.get("McpConfigEnableRequest") + ) mcp_config_list = MCPConfigList.from_dict(obj.get("McpConfigList")) - mcp_config_remove_request = MCPConfigRemoveRequest.from_dict(obj.get("McpConfigRemoveRequest")) - mcp_config_update_request = MCPConfigUpdateRequest.from_dict(obj.get("McpConfigUpdateRequest")) + mcp_config_remove_request = MCPConfigRemoveRequest.from_dict( + obj.get("McpConfigRemoveRequest") + ) + mcp_config_update_request = MCPConfigUpdateRequest.from_dict( + obj.get("McpConfigUpdateRequest") + ) mcp_disable_request = MCPDisableRequest.from_dict(obj.get("McpDisableRequest")) mcp_discover_request = MCPDiscoverRequest.from_dict(obj.get("McpDiscoverRequest")) mcp_discover_result = MCPDiscoverResult.from_dict(obj.get("McpDiscoverResult")) mcp_enable_request = MCPEnableRequest.from_dict(obj.get("McpEnableRequest")) - mcp_execute_sampling_params = MCPExecuteSamplingParams.from_dict(obj.get("McpExecuteSamplingParams")) + mcp_execute_sampling_params = MCPExecuteSamplingParams.from_dict( + obj.get("McpExecuteSamplingParams") + ) mcp_execute_sampling_request = from_dict(lambda x: x, obj.get("McpExecuteSamplingRequest")) mcp_execute_sampling_result = from_dict(lambda x: x, obj.get("McpExecuteSamplingResult")) mcp_oauth_login_request = MCPOauthLoginRequest.from_dict(obj.get("McpOauthLoginRequest")) mcp_oauth_login_result = MCPOauthLoginResult.from_dict(obj.get("McpOauthLoginResult")) - mcp_remove_git_hub_result = MCPRemoveGitHubResult.from_dict(obj.get("McpRemoveGitHubResult")) - mcp_sampling_execution_action = MCPSamplingExecutionAction(obj.get("McpSamplingExecutionAction")) - mcp_sampling_execution_result = MCPSamplingExecutionResult.from_dict(obj.get("McpSamplingExecutionResult")) + mcp_remove_git_hub_result = MCPRemoveGitHubResult.from_dict( + obj.get("McpRemoveGitHubResult") + ) + mcp_sampling_execution_action = MCPSamplingExecutionAction( + obj.get("McpSamplingExecutionAction") + ) + mcp_sampling_execution_result = MCPSamplingExecutionResult.from_dict( + obj.get("McpSamplingExecutionResult") + ) mcp_server = MCPServer.from_dict(obj.get("McpServer")) mcp_server_config = MCPServerConfig.from_dict(obj.get("McpServerConfig")) mcp_server_config_http = MCPServerConfigHTTP.from_dict(obj.get("McpServerConfigHttp")) - mcp_server_config_http_auth = MCPServerConfigHTTPAuth.from_dict(obj.get("McpServerConfigHttpAuth")) - mcp_server_config_http_oauth_grant_type = MCPServerConfigHTTPOauthGrantType(obj.get("McpServerConfigHttpOauthGrantType")) + mcp_server_config_http_auth = MCPServerConfigHTTPAuth.from_dict( + obj.get("McpServerConfigHttpAuth") + ) + mcp_server_config_http_oauth_grant_type = MCPServerConfigHTTPOauthGrantType( + obj.get("McpServerConfigHttpOauthGrantType") + ) mcp_server_config_http_type = MCPServerConfigHTTPType(obj.get("McpServerConfigHttpType")) mcp_server_config_stdio = MCPServerConfigStdio.from_dict(obj.get("McpServerConfigStdio")) mcp_server_list = MCPServerList.from_dict(obj.get("McpServerList")) - mcp_set_env_value_mode_details = MCPSetEnvValueModeDetails(obj.get("McpSetEnvValueModeDetails")) - mcp_set_env_value_mode_params = MCPSetEnvValueModeParams.from_dict(obj.get("McpSetEnvValueModeParams")) - mcp_set_env_value_mode_result = MCPSetEnvValueModeResult.from_dict(obj.get("McpSetEnvValueModeResult")) - metadata_context_info_request = MetadataContextInfoRequest.from_dict(obj.get("MetadataContextInfoRequest")) - metadata_context_info_result = MetadataContextInfoResult.from_dict(obj.get("MetadataContextInfoResult")) - metadata_is_processing_result = MetadataIsProcessingResult.from_dict(obj.get("MetadataIsProcessingResult")) - metadata_recompute_context_tokens_request = MetadataRecomputeContextTokensRequest.from_dict(obj.get("MetadataRecomputeContextTokensRequest")) - metadata_recompute_context_tokens_result = MetadataRecomputeContextTokensResult.from_dict(obj.get("MetadataRecomputeContextTokensResult")) - metadata_record_context_change_request = MetadataRecordContextChangeRequest.from_dict(obj.get("MetadataRecordContextChangeRequest")) - metadata_record_context_change_result = MetadataRecordContextChangeResult.from_dict(obj.get("MetadataRecordContextChangeResult")) - metadata_set_working_directory_request = MetadataSetWorkingDirectoryRequest.from_dict(obj.get("MetadataSetWorkingDirectoryRequest")) - metadata_set_working_directory_result = MetadataSetWorkingDirectoryResult.from_dict(obj.get("MetadataSetWorkingDirectoryResult")) - metadata_snapshot_current_mode = MetadataSnapshotCurrentMode(obj.get("MetadataSnapshotCurrentMode")) - metadata_snapshot_remote_metadata = MetadataSnapshotRemoteMetadata.from_dict(obj.get("MetadataSnapshotRemoteMetadata")) - metadata_snapshot_remote_metadata_repository = MetadataSnapshotRemoteMetadataRepository.from_dict(obj.get("MetadataSnapshotRemoteMetadataRepository")) - metadata_snapshot_remote_metadata_task_type = MetadataSnapshotRemoteMetadataTaskType(obj.get("MetadataSnapshotRemoteMetadataTaskType")) + mcp_set_env_value_mode_details = MCPSetEnvValueModeDetails( + obj.get("McpSetEnvValueModeDetails") + ) + mcp_set_env_value_mode_params = MCPSetEnvValueModeParams.from_dict( + obj.get("McpSetEnvValueModeParams") + ) + mcp_set_env_value_mode_result = MCPSetEnvValueModeResult.from_dict( + obj.get("McpSetEnvValueModeResult") + ) + metadata_context_info_request = MetadataContextInfoRequest.from_dict( + obj.get("MetadataContextInfoRequest") + ) + metadata_context_info_result = MetadataContextInfoResult.from_dict( + obj.get("MetadataContextInfoResult") + ) + metadata_is_processing_result = MetadataIsProcessingResult.from_dict( + obj.get("MetadataIsProcessingResult") + ) + metadata_recompute_context_tokens_request = MetadataRecomputeContextTokensRequest.from_dict( + obj.get("MetadataRecomputeContextTokensRequest") + ) + metadata_recompute_context_tokens_result = MetadataRecomputeContextTokensResult.from_dict( + obj.get("MetadataRecomputeContextTokensResult") + ) + metadata_record_context_change_request = MetadataRecordContextChangeRequest.from_dict( + obj.get("MetadataRecordContextChangeRequest") + ) + metadata_record_context_change_result = MetadataRecordContextChangeResult.from_dict( + obj.get("MetadataRecordContextChangeResult") + ) + metadata_set_working_directory_request = MetadataSetWorkingDirectoryRequest.from_dict( + obj.get("MetadataSetWorkingDirectoryRequest") + ) + metadata_set_working_directory_result = MetadataSetWorkingDirectoryResult.from_dict( + obj.get("MetadataSetWorkingDirectoryResult") + ) + metadata_snapshot_current_mode = MetadataSnapshotCurrentMode( + obj.get("MetadataSnapshotCurrentMode") + ) + metadata_snapshot_remote_metadata = MetadataSnapshotRemoteMetadata.from_dict( + obj.get("MetadataSnapshotRemoteMetadata") + ) + metadata_snapshot_remote_metadata_repository = ( + MetadataSnapshotRemoteMetadataRepository.from_dict( + obj.get("MetadataSnapshotRemoteMetadataRepository") + ) + ) + metadata_snapshot_remote_metadata_task_type = MetadataSnapshotRemoteMetadataTaskType( + obj.get("MetadataSnapshotRemoteMetadataTaskType") + ) model = Model.from_dict(obj.get("Model")) model_billing = ModelBilling.from_dict(obj.get("ModelBilling")) - model_billing_token_prices = ModelBillingTokenPrices.from_dict(obj.get("ModelBillingTokenPrices")) - model_billing_token_prices_long_context = ModelBillingTokenPricesLongContext.from_dict(obj.get("ModelBillingTokenPricesLongContext")) + model_billing_token_prices = ModelBillingTokenPrices.from_dict( + obj.get("ModelBillingTokenPrices") + ) + model_billing_token_prices_long_context = ModelBillingTokenPricesLongContext.from_dict( + obj.get("ModelBillingTokenPricesLongContext") + ) model_capabilities = ModelCapabilities.from_dict(obj.get("ModelCapabilities")) - model_capabilities_limits = ModelCapabilitiesLimits.from_dict(obj.get("ModelCapabilitiesLimits")) - model_capabilities_limits_vision = ModelCapabilitiesLimitsVision.from_dict(obj.get("ModelCapabilitiesLimitsVision")) - model_capabilities_override = ModelCapabilitiesOverride.from_dict(obj.get("ModelCapabilitiesOverride")) - model_capabilities_override_limits = ModelCapabilitiesOverrideLimits.from_dict(obj.get("ModelCapabilitiesOverrideLimits")) - model_capabilities_override_limits_vision = ModelCapabilitiesOverrideLimitsVision.from_dict(obj.get("ModelCapabilitiesOverrideLimitsVision")) - model_capabilities_override_supports = ModelCapabilitiesOverrideSupports.from_dict(obj.get("ModelCapabilitiesOverrideSupports")) - model_capabilities_supports = ModelCapabilitiesSupports.from_dict(obj.get("ModelCapabilitiesSupports")) + model_capabilities_limits = ModelCapabilitiesLimits.from_dict( + obj.get("ModelCapabilitiesLimits") + ) + model_capabilities_limits_vision = ModelCapabilitiesLimitsVision.from_dict( + obj.get("ModelCapabilitiesLimitsVision") + ) + model_capabilities_override = ModelCapabilitiesOverride.from_dict( + obj.get("ModelCapabilitiesOverride") + ) + model_capabilities_override_limits = ModelCapabilitiesOverrideLimits.from_dict( + obj.get("ModelCapabilitiesOverrideLimits") + ) + model_capabilities_override_limits_vision = ModelCapabilitiesOverrideLimitsVision.from_dict( + obj.get("ModelCapabilitiesOverrideLimitsVision") + ) + model_capabilities_override_supports = ModelCapabilitiesOverrideSupports.from_dict( + obj.get("ModelCapabilitiesOverrideSupports") + ) + model_capabilities_supports = ModelCapabilitiesSupports.from_dict( + obj.get("ModelCapabilitiesSupports") + ) model_list = ModelList.from_dict(obj.get("ModelList")) model_picker_category = ModelPickerCategory(obj.get("ModelPickerCategory")) model_picker_price_category = ModelPickerPriceCategory(obj.get("ModelPickerPriceCategory")) model_policy = ModelPolicy.from_dict(obj.get("ModelPolicy")) model_policy_state = ModelPolicyState(obj.get("ModelPolicyState")) - model_set_reasoning_effort_request = ModelSetReasoningEffortRequest.from_dict(obj.get("ModelSetReasoningEffortRequest")) - model_set_reasoning_effort_result = ModelSetReasoningEffortResult.from_dict(obj.get("ModelSetReasoningEffortResult")) + model_set_reasoning_effort_request = ModelSetReasoningEffortRequest.from_dict( + obj.get("ModelSetReasoningEffortRequest") + ) + model_set_reasoning_effort_result = ModelSetReasoningEffortResult.from_dict( + obj.get("ModelSetReasoningEffortResult") + ) models_list_request = ModelsListRequest.from_dict(obj.get("ModelsListRequest")) model_switch_to_request = ModelSwitchToRequest.from_dict(obj.get("ModelSwitchToRequest")) model_switch_to_result = ModelSwitchToResult.from_dict(obj.get("ModelSwitchToResult")) @@ -15356,99 +17872,363 @@ def from_dict(obj: Any) -> 'RPC': name_set_auto_result = NameSetAutoResult.from_dict(obj.get("NameSetAutoResult")) name_set_request = NameSetRequest.from_dict(obj.get("NameSetRequest")) open_canvas_instance = OpenCanvasInstance.from_dict(obj.get("OpenCanvasInstance")) - options_update_env_value_mode = MCPSetEnvValueModeDetails(obj.get("OptionsUpdateEnvValueMode")) - pending_permission_request = PendingPermissionRequest.from_dict(obj.get("PendingPermissionRequest")) - pending_permission_request_list = PendingPermissionRequestList.from_dict(obj.get("PendingPermissionRequestList")) + options_update_env_value_mode = MCPSetEnvValueModeDetails( + obj.get("OptionsUpdateEnvValueMode") + ) + pending_permission_request = PendingPermissionRequest.from_dict( + obj.get("PendingPermissionRequest") + ) + pending_permission_request_list = PendingPermissionRequestList.from_dict( + obj.get("PendingPermissionRequestList") + ) permission_decision = _load_PermissionDecision(obj.get("PermissionDecision")) - permission_decision_approved = PermissionDecisionApproved.from_dict(obj.get("PermissionDecisionApproved")) - permission_decision_approved_for_location = PermissionDecisionApprovedForLocation.from_dict(obj.get("PermissionDecisionApprovedForLocation")) - permission_decision_approved_for_session = PermissionDecisionApprovedForSession.from_dict(obj.get("PermissionDecisionApprovedForSession")) - permission_decision_approve_for_location = PermissionDecisionApproveForLocation.from_dict(obj.get("PermissionDecisionApproveForLocation")) - permission_decision_approve_for_location_approval = _load_PermissionDecisionApproveForLocationApproval(obj.get("PermissionDecisionApproveForLocationApproval")) - permission_decision_approve_for_location_approval_commands = PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalCommands")) - permission_decision_approve_for_location_approval_custom_tool = PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalCustomTool")) - permission_decision_approve_for_location_approval_extension_management = PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalExtensionManagement")) - permission_decision_approve_for_location_approval_extension_permission_access = PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess")) - permission_decision_approve_for_location_approval_mcp = PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMcp")) - permission_decision_approve_for_location_approval_mcp_sampling = PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMcpSampling")) - permission_decision_approve_for_location_approval_memory = PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMemory")) - permission_decision_approve_for_location_approval_read = PermissionDecisionApproveForLocationApprovalRead.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalRead")) - permission_decision_approve_for_location_approval_write = PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalWrite")) - permission_decision_approve_for_session = PermissionDecisionApproveForSession.from_dict(obj.get("PermissionDecisionApproveForSession")) - permission_decision_approve_for_session_approval = _load_PermissionDecisionApproveForSessionApproval(obj.get("PermissionDecisionApproveForSessionApproval")) - permission_decision_approve_for_session_approval_commands = PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalCommands")) - permission_decision_approve_for_session_approval_custom_tool = PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalCustomTool")) - permission_decision_approve_for_session_approval_extension_management = PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalExtensionManagement")) - permission_decision_approve_for_session_approval_extension_permission_access = PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess")) - permission_decision_approve_for_session_approval_mcp = PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMcp")) - permission_decision_approve_for_session_approval_mcp_sampling = PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMcpSampling")) - permission_decision_approve_for_session_approval_memory = PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMemory")) - permission_decision_approve_for_session_approval_read = PermissionDecisionApproveForSessionApprovalRead.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalRead")) - permission_decision_approve_for_session_approval_write = PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalWrite")) - permission_decision_approve_once = PermissionDecisionApproveOnce.from_dict(obj.get("PermissionDecisionApproveOnce")) - permission_decision_approve_permanently = PermissionDecisionApprovePermanently.from_dict(obj.get("PermissionDecisionApprovePermanently")) - permission_decision_cancelled = PermissionDecisionCancelled.from_dict(obj.get("PermissionDecisionCancelled")) - permission_decision_denied_by_content_exclusion_policy = PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj.get("PermissionDecisionDeniedByContentExclusionPolicy")) - permission_decision_denied_by_permission_request_hook = PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj.get("PermissionDecisionDeniedByPermissionRequestHook")) - permission_decision_denied_by_rules = PermissionDecisionDeniedByRules.from_dict(obj.get("PermissionDecisionDeniedByRules")) - permission_decision_denied_interactively_by_user = PermissionDecisionDeniedInteractivelyByUser.from_dict(obj.get("PermissionDecisionDeniedInteractivelyByUser")) - permission_decision_denied_no_approval_rule_and_could_not_request_from_user = PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj.get("PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser")) - permission_decision_reject = PermissionDecisionReject.from_dict(obj.get("PermissionDecisionReject")) - permission_decision_request = PermissionDecisionRequest.from_dict(obj.get("PermissionDecisionRequest")) - permission_decision_user_not_available = PermissionDecisionUserNotAvailable.from_dict(obj.get("PermissionDecisionUserNotAvailable")) - permission_location_add_tool_approval_params = PermissionLocationAddToolApprovalParams.from_dict(obj.get("PermissionLocationAddToolApprovalParams")) - permission_location_apply_params = PermissionLocationApplyParams.from_dict(obj.get("PermissionLocationApplyParams")) - permission_location_apply_result = PermissionLocationApplyResult.from_dict(obj.get("PermissionLocationApplyResult")) - permission_location_resolve_params = PermissionLocationResolveParams.from_dict(obj.get("PermissionLocationResolveParams")) - permission_location_resolve_result = PermissionLocationResolveResult.from_dict(obj.get("PermissionLocationResolveResult")) + permission_decision_approved = PermissionDecisionApproved.from_dict( + obj.get("PermissionDecisionApproved") + ) + permission_decision_approved_for_location = PermissionDecisionApprovedForLocation.from_dict( + obj.get("PermissionDecisionApprovedForLocation") + ) + permission_decision_approved_for_session = PermissionDecisionApprovedForSession.from_dict( + obj.get("PermissionDecisionApprovedForSession") + ) + permission_decision_approve_for_location = PermissionDecisionApproveForLocation.from_dict( + obj.get("PermissionDecisionApproveForLocation") + ) + permission_decision_approve_for_location_approval = ( + _load_PermissionDecisionApproveForLocationApproval( + obj.get("PermissionDecisionApproveForLocationApproval") + ) + ) + permission_decision_approve_for_location_approval_commands = ( + PermissionDecisionApproveForLocationApprovalCommands.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalCommands") + ) + ) + permission_decision_approve_for_location_approval_custom_tool = ( + PermissionDecisionApproveForLocationApprovalCustomTool.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalCustomTool") + ) + ) + permission_decision_approve_for_location_approval_extension_management = ( + PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalExtensionManagement") + ) + ) + permission_decision_approve_for_location_approval_extension_permission_access = ( + PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess") + ) + ) + permission_decision_approve_for_location_approval_mcp = ( + PermissionDecisionApproveForLocationApprovalMCP.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalMcp") + ) + ) + permission_decision_approve_for_location_approval_mcp_sampling = ( + PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalMcpSampling") + ) + ) + permission_decision_approve_for_location_approval_memory = ( + PermissionDecisionApproveForLocationApprovalMemory.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalMemory") + ) + ) + permission_decision_approve_for_location_approval_read = ( + PermissionDecisionApproveForLocationApprovalRead.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalRead") + ) + ) + permission_decision_approve_for_location_approval_write = ( + PermissionDecisionApproveForLocationApprovalWrite.from_dict( + obj.get("PermissionDecisionApproveForLocationApprovalWrite") + ) + ) + permission_decision_approve_for_session = PermissionDecisionApproveForSession.from_dict( + obj.get("PermissionDecisionApproveForSession") + ) + permission_decision_approve_for_session_approval = ( + _load_PermissionDecisionApproveForSessionApproval( + obj.get("PermissionDecisionApproveForSessionApproval") + ) + ) + permission_decision_approve_for_session_approval_commands = ( + PermissionDecisionApproveForSessionApprovalCommands.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalCommands") + ) + ) + permission_decision_approve_for_session_approval_custom_tool = ( + PermissionDecisionApproveForSessionApprovalCustomTool.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalCustomTool") + ) + ) + permission_decision_approve_for_session_approval_extension_management = ( + PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalExtensionManagement") + ) + ) + permission_decision_approve_for_session_approval_extension_permission_access = ( + PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess") + ) + ) + permission_decision_approve_for_session_approval_mcp = ( + PermissionDecisionApproveForSessionApprovalMCP.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalMcp") + ) + ) + permission_decision_approve_for_session_approval_mcp_sampling = ( + PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalMcpSampling") + ) + ) + permission_decision_approve_for_session_approval_memory = ( + PermissionDecisionApproveForSessionApprovalMemory.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalMemory") + ) + ) + permission_decision_approve_for_session_approval_read = ( + PermissionDecisionApproveForSessionApprovalRead.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalRead") + ) + ) + permission_decision_approve_for_session_approval_write = ( + PermissionDecisionApproveForSessionApprovalWrite.from_dict( + obj.get("PermissionDecisionApproveForSessionApprovalWrite") + ) + ) + permission_decision_approve_once = PermissionDecisionApproveOnce.from_dict( + obj.get("PermissionDecisionApproveOnce") + ) + permission_decision_approve_permanently = PermissionDecisionApprovePermanently.from_dict( + obj.get("PermissionDecisionApprovePermanently") + ) + permission_decision_cancelled = PermissionDecisionCancelled.from_dict( + obj.get("PermissionDecisionCancelled") + ) + permission_decision_denied_by_content_exclusion_policy = ( + PermissionDecisionDeniedByContentExclusionPolicy.from_dict( + obj.get("PermissionDecisionDeniedByContentExclusionPolicy") + ) + ) + permission_decision_denied_by_permission_request_hook = ( + PermissionDecisionDeniedByPermissionRequestHook.from_dict( + obj.get("PermissionDecisionDeniedByPermissionRequestHook") + ) + ) + permission_decision_denied_by_rules = PermissionDecisionDeniedByRules.from_dict( + obj.get("PermissionDecisionDeniedByRules") + ) + permission_decision_denied_interactively_by_user = ( + PermissionDecisionDeniedInteractivelyByUser.from_dict( + obj.get("PermissionDecisionDeniedInteractivelyByUser") + ) + ) + permission_decision_denied_no_approval_rule_and_could_not_request_from_user = ( + PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict( + obj.get("PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser") + ) + ) + permission_decision_reject = PermissionDecisionReject.from_dict( + obj.get("PermissionDecisionReject") + ) + permission_decision_request = PermissionDecisionRequest.from_dict( + obj.get("PermissionDecisionRequest") + ) + permission_decision_user_not_available = PermissionDecisionUserNotAvailable.from_dict( + obj.get("PermissionDecisionUserNotAvailable") + ) + permission_location_add_tool_approval_params = ( + PermissionLocationAddToolApprovalParams.from_dict( + obj.get("PermissionLocationAddToolApprovalParams") + ) + ) + permission_location_apply_params = PermissionLocationApplyParams.from_dict( + obj.get("PermissionLocationApplyParams") + ) + permission_location_apply_result = PermissionLocationApplyResult.from_dict( + obj.get("PermissionLocationApplyResult") + ) + permission_location_resolve_params = PermissionLocationResolveParams.from_dict( + obj.get("PermissionLocationResolveParams") + ) + permission_location_resolve_result = PermissionLocationResolveResult.from_dict( + obj.get("PermissionLocationResolveResult") + ) permission_location_type = PermissionLocationType(obj.get("PermissionLocationType")) - permission_paths_add_params = PermissionPathsAddParams.from_dict(obj.get("PermissionPathsAddParams")) - permission_paths_allowed_check_params = PermissionPathsAllowedCheckParams.from_dict(obj.get("PermissionPathsAllowedCheckParams")) - permission_paths_allowed_check_result = PermissionPathsAllowedCheckResult.from_dict(obj.get("PermissionPathsAllowedCheckResult")) + permission_paths_add_params = PermissionPathsAddParams.from_dict( + obj.get("PermissionPathsAddParams") + ) + permission_paths_allowed_check_params = PermissionPathsAllowedCheckParams.from_dict( + obj.get("PermissionPathsAllowedCheckParams") + ) + permission_paths_allowed_check_result = PermissionPathsAllowedCheckResult.from_dict( + obj.get("PermissionPathsAllowedCheckResult") + ) permission_paths_config = PermissionPathsConfig.from_dict(obj.get("PermissionPathsConfig")) permission_paths_list = PermissionPathsList.from_dict(obj.get("PermissionPathsList")) - permission_paths_update_primary_params = PermissionPathsUpdatePrimaryParams.from_dict(obj.get("PermissionPathsUpdatePrimaryParams")) - permission_paths_workspace_check_params = PermissionPathsWorkspaceCheckParams.from_dict(obj.get("PermissionPathsWorkspaceCheckParams")) - permission_paths_workspace_check_result = PermissionPathsWorkspaceCheckResult.from_dict(obj.get("PermissionPathsWorkspaceCheckResult")) - permission_prompt_shown_notification = PermissionPromptShownNotification.from_dict(obj.get("PermissionPromptShownNotification")) - permission_request_result = PermissionRequestResult.from_dict(obj.get("PermissionRequestResult")) + permission_paths_update_primary_params = PermissionPathsUpdatePrimaryParams.from_dict( + obj.get("PermissionPathsUpdatePrimaryParams") + ) + permission_paths_workspace_check_params = PermissionPathsWorkspaceCheckParams.from_dict( + obj.get("PermissionPathsWorkspaceCheckParams") + ) + permission_paths_workspace_check_result = PermissionPathsWorkspaceCheckResult.from_dict( + obj.get("PermissionPathsWorkspaceCheckResult") + ) + permission_prompt_shown_notification = PermissionPromptShownNotification.from_dict( + obj.get("PermissionPromptShownNotification") + ) + permission_request_result = PermissionRequestResult.from_dict( + obj.get("PermissionRequestResult") + ) permission_rules_set = PermissionRulesSet.from_dict(obj.get("PermissionRulesSet")) - permissions_configure_additional_content_exclusion_policy = PermissionsConfigureAdditionalContentExclusionPolicy.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicy")) - permissions_configure_additional_content_exclusion_policy_rule = PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRule")) - permissions_configure_additional_content_exclusion_policy_rule_source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRuleSource")) - permissions_configure_additional_content_exclusion_policy_scope = PermissionsConfigureAdditionalContentExclusionPolicyScope(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyScope")) - permissions_configure_params = PermissionsConfigureParams.from_dict(obj.get("PermissionsConfigureParams")) - permissions_configure_result = PermissionsConfigureResult.from_dict(obj.get("PermissionsConfigureResult")) - permissions_folder_trust_add_trusted_result = PermissionsFolderTrustAddTrustedResult.from_dict(obj.get("PermissionsFolderTrustAddTrustedResult")) - permissions_locations_add_tool_approval_details = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("PermissionsLocationsAddToolApprovalDetails")) - permissions_locations_add_tool_approval_details_commands = PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCommands")) - permissions_locations_add_tool_approval_details_custom_tool = PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCustomTool")) - permissions_locations_add_tool_approval_details_extension_management = PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionManagement")) - permissions_locations_add_tool_approval_details_extension_permission_access = PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess")) - permissions_locations_add_tool_approval_details_mcp = PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMcp")) - permissions_locations_add_tool_approval_details_mcp_sampling = PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMcpSampling")) - permissions_locations_add_tool_approval_details_memory = PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMemory")) - permissions_locations_add_tool_approval_details_read = PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsRead")) - permissions_locations_add_tool_approval_details_write = PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsWrite")) - permissions_locations_add_tool_approval_result = PermissionsLocationsAddToolApprovalResult.from_dict(obj.get("PermissionsLocationsAddToolApprovalResult")) - permissions_modify_rules_params = PermissionsModifyRulesParams.from_dict(obj.get("PermissionsModifyRulesParams")) - permissions_modify_rules_result = PermissionsModifyRulesResult.from_dict(obj.get("PermissionsModifyRulesResult")) - permissions_modify_rules_scope = PermissionsModifyRulesScope(obj.get("PermissionsModifyRulesScope")) - permissions_notify_prompt_shown_result = PermissionsNotifyPromptShownResult.from_dict(obj.get("PermissionsNotifyPromptShownResult")) - permissions_paths_add_result = PermissionsPathsAddResult.from_dict(obj.get("PermissionsPathsAddResult")) - permissions_paths_list_request = PermissionsPathsListRequest.from_dict(obj.get("PermissionsPathsListRequest")) - permissions_paths_update_primary_result = PermissionsPathsUpdatePrimaryResult.from_dict(obj.get("PermissionsPathsUpdatePrimaryResult")) - permissions_pending_requests_request = PermissionsPendingRequestsRequest.from_dict(obj.get("PermissionsPendingRequestsRequest")) - permissions_reset_session_approvals_request = PermissionsResetSessionApprovalsRequest.from_dict(obj.get("PermissionsResetSessionApprovalsRequest")) - permissions_reset_session_approvals_result = PermissionsResetSessionApprovalsResult.from_dict(obj.get("PermissionsResetSessionApprovalsResult")) - permissions_set_approve_all_request = PermissionsSetApproveAllRequest.from_dict(obj.get("PermissionsSetApproveAllRequest")) - permissions_set_approve_all_result = PermissionsSetApproveAllResult.from_dict(obj.get("PermissionsSetApproveAllResult")) - permissions_set_approve_all_source = PermissionsSetApproveAllSource(obj.get("PermissionsSetApproveAllSource")) - permissions_set_required_request = PermissionsSetRequiredRequest.from_dict(obj.get("PermissionsSetRequiredRequest")) - permissions_set_required_result = PermissionsSetRequiredResult.from_dict(obj.get("PermissionsSetRequiredResult")) - permissions_urls_set_unrestricted_mode_result = PermissionsUrlsSetUnrestrictedModeResult.from_dict(obj.get("PermissionsUrlsSetUnrestrictedModeResult")) + permissions_configure_additional_content_exclusion_policy = ( + PermissionsConfigureAdditionalContentExclusionPolicy.from_dict( + obj.get("PermissionsConfigureAdditionalContentExclusionPolicy") + ) + ) + permissions_configure_additional_content_exclusion_policy_rule = ( + PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict( + obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRule") + ) + ) + permissions_configure_additional_content_exclusion_policy_rule_source = ( + PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict( + obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRuleSource") + ) + ) + permissions_configure_additional_content_exclusion_policy_scope = ( + PermissionsConfigureAdditionalContentExclusionPolicyScope( + obj.get("PermissionsConfigureAdditionalContentExclusionPolicyScope") + ) + ) + permissions_configure_params = PermissionsConfigureParams.from_dict( + obj.get("PermissionsConfigureParams") + ) + permissions_configure_result = PermissionsConfigureResult.from_dict( + obj.get("PermissionsConfigureResult") + ) + permissions_folder_trust_add_trusted_result = ( + PermissionsFolderTrustAddTrustedResult.from_dict( + obj.get("PermissionsFolderTrustAddTrustedResult") + ) + ) + permissions_locations_add_tool_approval_details = ( + _load_PermissionsLocationsAddToolApprovalDetails( + obj.get("PermissionsLocationsAddToolApprovalDetails") + ) + ) + permissions_locations_add_tool_approval_details_commands = ( + PermissionsLocationsAddToolApprovalDetailsCommands.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsCommands") + ) + ) + permissions_locations_add_tool_approval_details_custom_tool = ( + PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsCustomTool") + ) + ) + permissions_locations_add_tool_approval_details_extension_management = ( + PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionManagement") + ) + ) + permissions_locations_add_tool_approval_details_extension_permission_access = ( + PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess") + ) + ) + permissions_locations_add_tool_approval_details_mcp = ( + PermissionsLocationsAddToolApprovalDetailsMCP.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsMcp") + ) + ) + permissions_locations_add_tool_approval_details_mcp_sampling = ( + PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsMcpSampling") + ) + ) + permissions_locations_add_tool_approval_details_memory = ( + PermissionsLocationsAddToolApprovalDetailsMemory.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsMemory") + ) + ) + permissions_locations_add_tool_approval_details_read = ( + PermissionsLocationsAddToolApprovalDetailsRead.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsRead") + ) + ) + permissions_locations_add_tool_approval_details_write = ( + PermissionsLocationsAddToolApprovalDetailsWrite.from_dict( + obj.get("PermissionsLocationsAddToolApprovalDetailsWrite") + ) + ) + permissions_locations_add_tool_approval_result = ( + PermissionsLocationsAddToolApprovalResult.from_dict( + obj.get("PermissionsLocationsAddToolApprovalResult") + ) + ) + permissions_modify_rules_params = PermissionsModifyRulesParams.from_dict( + obj.get("PermissionsModifyRulesParams") + ) + permissions_modify_rules_result = PermissionsModifyRulesResult.from_dict( + obj.get("PermissionsModifyRulesResult") + ) + permissions_modify_rules_scope = PermissionsModifyRulesScope( + obj.get("PermissionsModifyRulesScope") + ) + permissions_notify_prompt_shown_result = PermissionsNotifyPromptShownResult.from_dict( + obj.get("PermissionsNotifyPromptShownResult") + ) + permissions_paths_add_result = PermissionsPathsAddResult.from_dict( + obj.get("PermissionsPathsAddResult") + ) + permissions_paths_list_request = PermissionsPathsListRequest.from_dict( + obj.get("PermissionsPathsListRequest") + ) + permissions_paths_update_primary_result = PermissionsPathsUpdatePrimaryResult.from_dict( + obj.get("PermissionsPathsUpdatePrimaryResult") + ) + permissions_pending_requests_request = PermissionsPendingRequestsRequest.from_dict( + obj.get("PermissionsPendingRequestsRequest") + ) + permissions_reset_session_approvals_request = ( + PermissionsResetSessionApprovalsRequest.from_dict( + obj.get("PermissionsResetSessionApprovalsRequest") + ) + ) + permissions_reset_session_approvals_result = ( + PermissionsResetSessionApprovalsResult.from_dict( + obj.get("PermissionsResetSessionApprovalsResult") + ) + ) + permissions_set_approve_all_request = PermissionsSetApproveAllRequest.from_dict( + obj.get("PermissionsSetApproveAllRequest") + ) + permissions_set_approve_all_result = PermissionsSetApproveAllResult.from_dict( + obj.get("PermissionsSetApproveAllResult") + ) + permissions_set_approve_all_source = PermissionsSetApproveAllSource( + obj.get("PermissionsSetApproveAllSource") + ) + permissions_set_required_request = PermissionsSetRequiredRequest.from_dict( + obj.get("PermissionsSetRequiredRequest") + ) + permissions_set_required_result = PermissionsSetRequiredResult.from_dict( + obj.get("PermissionsSetRequiredResult") + ) + permissions_urls_set_unrestricted_mode_result = ( + PermissionsUrlsSetUnrestrictedModeResult.from_dict( + obj.get("PermissionsUrlsSetUnrestrictedModeResult") + ) + ) permission_urls_config = PermissionUrlsConfig.from_dict(obj.get("PermissionUrlsConfig")) - permission_urls_set_unrestricted_mode_params = PermissionUrlsSetUnrestrictedModeParams.from_dict(obj.get("PermissionUrlsSetUnrestrictedModeParams")) + permission_urls_set_unrestricted_mode_params = ( + PermissionUrlsSetUnrestrictedModeParams.from_dict( + obj.get("PermissionUrlsSetUnrestrictedModeParams") + ) + ) ping_request = PingRequest.from_dict(obj.get("PingRequest")) ping_result = PingResult.from_dict(obj.get("PingResult")) plan_read_result = PlanReadResult.from_dict(obj.get("PlanReadResult")) @@ -15456,127 +18236,286 @@ def from_dict(obj: Any) -> 'RPC': plugin = Plugin.from_dict(obj.get("Plugin")) plugin_list = PluginList.from_dict(obj.get("PluginList")) queued_command_handled = QueuedCommandHandled.from_dict(obj.get("QueuedCommandHandled")) - queued_command_not_handled = QueuedCommandNotHandled.from_dict(obj.get("QueuedCommandNotHandled")) + queued_command_not_handled = QueuedCommandNotHandled.from_dict( + obj.get("QueuedCommandNotHandled") + ) queued_command_result = _load_QueuedCommandResult(obj.get("QueuedCommandResult")) queue_pending_items = QueuePendingItems.from_dict(obj.get("QueuePendingItems")) queue_pending_items_kind = QueuePendingItemsKind(obj.get("QueuePendingItemsKind")) - queue_pending_items_result = QueuePendingItemsResult.from_dict(obj.get("QueuePendingItemsResult")) - queue_remove_most_recent_result = QueueRemoveMostRecentResult.from_dict(obj.get("QueueRemoveMostRecentResult")) - register_event_interest_params = RegisterEventInterestParams.from_dict(obj.get("RegisterEventInterestParams")) - register_event_interest_result = RegisterEventInterestResult.from_dict(obj.get("RegisterEventInterestResult")) - release_event_interest_params = ReleaseEventInterestParams.from_dict(obj.get("ReleaseEventInterestParams")) + queue_pending_items_result = QueuePendingItemsResult.from_dict( + obj.get("QueuePendingItemsResult") + ) + queue_remove_most_recent_result = QueueRemoveMostRecentResult.from_dict( + obj.get("QueueRemoveMostRecentResult") + ) + register_event_interest_params = RegisterEventInterestParams.from_dict( + obj.get("RegisterEventInterestParams") + ) + register_event_interest_result = RegisterEventInterestResult.from_dict( + obj.get("RegisterEventInterestResult") + ) + release_event_interest_params = ReleaseEventInterestParams.from_dict( + obj.get("ReleaseEventInterestParams") + ) remote_enable_request = RemoteEnableRequest.from_dict(obj.get("RemoteEnableRequest")) remote_enable_result = RemoteEnableResult.from_dict(obj.get("RemoteEnableResult")) - remote_notify_steerable_changed_request = RemoteNotifySteerableChangedRequest.from_dict(obj.get("RemoteNotifySteerableChangedRequest")) - remote_notify_steerable_changed_result = RemoteNotifySteerableChangedResult.from_dict(obj.get("RemoteNotifySteerableChangedResult")) - remote_session_connection_result = RemoteSessionConnectionResult.from_dict(obj.get("RemoteSessionConnectionResult")) + remote_notify_steerable_changed_request = RemoteNotifySteerableChangedRequest.from_dict( + obj.get("RemoteNotifySteerableChangedRequest") + ) + remote_notify_steerable_changed_result = RemoteNotifySteerableChangedResult.from_dict( + obj.get("RemoteNotifySteerableChangedResult") + ) + remote_session_connection_result = RemoteSessionConnectionResult.from_dict( + obj.get("RemoteSessionConnectionResult") + ) remote_session_mode = RemoteSessionMode(obj.get("RemoteSessionMode")) schedule_entry = ScheduleEntry.from_dict(obj.get("ScheduleEntry")) schedule_list = ScheduleList.from_dict(obj.get("ScheduleList")) schedule_stop_request = ScheduleStopRequest.from_dict(obj.get("ScheduleStopRequest")) schedule_stop_result = ScheduleStopResult.from_dict(obj.get("ScheduleStopResult")) - secrets_add_filter_values_request = SecretsAddFilterValuesRequest.from_dict(obj.get("SecretsAddFilterValuesRequest")) - secrets_add_filter_values_result = SecretsAddFilterValuesResult.from_dict(obj.get("SecretsAddFilterValuesResult")) + secrets_add_filter_values_request = SecretsAddFilterValuesRequest.from_dict( + obj.get("SecretsAddFilterValuesRequest") + ) + secrets_add_filter_values_result = SecretsAddFilterValuesResult.from_dict( + obj.get("SecretsAddFilterValuesResult") + ) send_agent_mode = SendAgentMode(obj.get("SendAgentMode")) send_attachment = _load_SendAttachment(obj.get("SendAttachment")) send_attachment_blob = SendAttachmentBlob.from_dict(obj.get("SendAttachmentBlob")) - send_attachment_directory = SendAttachmentDirectory.from_dict(obj.get("SendAttachmentDirectory")) + send_attachment_directory = SendAttachmentDirectory.from_dict( + obj.get("SendAttachmentDirectory") + ) send_attachment_file = SendAttachmentFile.from_dict(obj.get("SendAttachmentFile")) - send_attachment_file_line_range = SendAttachmentFileLineRange.from_dict(obj.get("SendAttachmentFileLineRange")) - send_attachment_github_reference = SendAttachmentGithubReference.from_dict(obj.get("SendAttachmentGithubReference")) - send_attachment_github_reference_type = SendAttachmentGithubReferenceTypeEnum(obj.get("SendAttachmentGithubReferenceType")) - send_attachment_selection = SendAttachmentSelection.from_dict(obj.get("SendAttachmentSelection")) - send_attachment_selection_details = SendAttachmentSelectionDetails.from_dict(obj.get("SendAttachmentSelectionDetails")) - send_attachment_selection_details_end = SendAttachmentSelectionDetailsEnd.from_dict(obj.get("SendAttachmentSelectionDetailsEnd")) - send_attachment_selection_details_start = SendAttachmentSelectionDetailsStart.from_dict(obj.get("SendAttachmentSelectionDetailsStart")) + send_attachment_file_line_range = SendAttachmentFileLineRange.from_dict( + obj.get("SendAttachmentFileLineRange") + ) + send_attachment_github_reference = SendAttachmentGithubReference.from_dict( + obj.get("SendAttachmentGithubReference") + ) + send_attachment_github_reference_type = SendAttachmentGithubReferenceTypeEnum( + obj.get("SendAttachmentGithubReferenceType") + ) + send_attachment_selection = SendAttachmentSelection.from_dict( + obj.get("SendAttachmentSelection") + ) + send_attachment_selection_details = SendAttachmentSelectionDetails.from_dict( + obj.get("SendAttachmentSelectionDetails") + ) + send_attachment_selection_details_end = SendAttachmentSelectionDetailsEnd.from_dict( + obj.get("SendAttachmentSelectionDetailsEnd") + ) + send_attachment_selection_details_start = SendAttachmentSelectionDetailsStart.from_dict( + obj.get("SendAttachmentSelectionDetailsStart") + ) send_mode = SendMode(obj.get("SendMode")) send_request = SendRequest.from_dict(obj.get("SendRequest")) send_result = SendResult.from_dict(obj.get("SendResult")) server_skill = ServerSkill.from_dict(obj.get("ServerSkill")) server_skill_list = ServerSkillList.from_dict(obj.get("ServerSkillList")) session_auth_status = SessionAuthStatus.from_dict(obj.get("SessionAuthStatus")) - session_bulk_delete_result = SessionBulkDeleteResult.from_dict(obj.get("SessionBulkDeleteResult")) + session_bulk_delete_result = SessionBulkDeleteResult.from_dict( + obj.get("SessionBulkDeleteResult") + ) session_context = SessionContext.from_dict(obj.get("SessionContext")) session_context_host_type = HostType(obj.get("SessionContextHostType")) - session_enrich_metadata_result = SessionEnrichMetadataResult.from_dict(obj.get("SessionEnrichMetadataResult")) - session_fs_append_file_request = SessionFSAppendFileRequest.from_dict(obj.get("SessionFsAppendFileRequest")) + session_enrich_metadata_result = SessionEnrichMetadataResult.from_dict( + obj.get("SessionEnrichMetadataResult") + ) + session_fs_append_file_request = SessionFSAppendFileRequest.from_dict( + obj.get("SessionFsAppendFileRequest") + ) session_fs_error = SessionFSError.from_dict(obj.get("SessionFsError")) session_fs_error_code = SessionFSErrorCode(obj.get("SessionFsErrorCode")) - session_fs_exists_request = SessionFSExistsRequest.from_dict(obj.get("SessionFsExistsRequest")) + session_fs_exists_request = SessionFSExistsRequest.from_dict( + obj.get("SessionFsExistsRequest") + ) session_fs_exists_result = SessionFSExistsResult.from_dict(obj.get("SessionFsExistsResult")) session_fs_mkdir_request = SessionFSMkdirRequest.from_dict(obj.get("SessionFsMkdirRequest")) - session_fs_readdir_request = SessionFSReaddirRequest.from_dict(obj.get("SessionFsReaddirRequest")) - session_fs_readdir_result = SessionFSReaddirResult.from_dict(obj.get("SessionFsReaddirResult")) - session_fs_readdir_with_types_entry = SessionFSReaddirWithTypesEntry.from_dict(obj.get("SessionFsReaddirWithTypesEntry")) - session_fs_readdir_with_types_entry_type = SessionFSReaddirWithTypesEntryType(obj.get("SessionFsReaddirWithTypesEntryType")) - session_fs_readdir_with_types_request = SessionFSReaddirWithTypesRequest.from_dict(obj.get("SessionFsReaddirWithTypesRequest")) - session_fs_readdir_with_types_result = SessionFSReaddirWithTypesResult.from_dict(obj.get("SessionFsReaddirWithTypesResult")) - session_fs_read_file_request = SessionFSReadFileRequest.from_dict(obj.get("SessionFsReadFileRequest")) - session_fs_read_file_result = SessionFSReadFileResult.from_dict(obj.get("SessionFsReadFileResult")) - session_fs_rename_request = SessionFSRenameRequest.from_dict(obj.get("SessionFsRenameRequest")) + session_fs_readdir_request = SessionFSReaddirRequest.from_dict( + obj.get("SessionFsReaddirRequest") + ) + session_fs_readdir_result = SessionFSReaddirResult.from_dict( + obj.get("SessionFsReaddirResult") + ) + session_fs_readdir_with_types_entry = SessionFSReaddirWithTypesEntry.from_dict( + obj.get("SessionFsReaddirWithTypesEntry") + ) + session_fs_readdir_with_types_entry_type = SessionFSReaddirWithTypesEntryType( + obj.get("SessionFsReaddirWithTypesEntryType") + ) + session_fs_readdir_with_types_request = SessionFSReaddirWithTypesRequest.from_dict( + obj.get("SessionFsReaddirWithTypesRequest") + ) + session_fs_readdir_with_types_result = SessionFSReaddirWithTypesResult.from_dict( + obj.get("SessionFsReaddirWithTypesResult") + ) + session_fs_read_file_request = SessionFSReadFileRequest.from_dict( + obj.get("SessionFsReadFileRequest") + ) + session_fs_read_file_result = SessionFSReadFileResult.from_dict( + obj.get("SessionFsReadFileResult") + ) + session_fs_rename_request = SessionFSRenameRequest.from_dict( + obj.get("SessionFsRenameRequest") + ) session_fs_rm_request = SessionFSRmRequest.from_dict(obj.get("SessionFsRmRequest")) - session_fs_set_provider_capabilities = SessionFSSetProviderCapabilities.from_dict(obj.get("SessionFsSetProviderCapabilities")) - session_fs_set_provider_conventions = SessionFSSetProviderConventions(obj.get("SessionFsSetProviderConventions")) - session_fs_set_provider_request = SessionFSSetProviderRequest.from_dict(obj.get("SessionFsSetProviderRequest")) - session_fs_set_provider_result = SessionFSSetProviderResult.from_dict(obj.get("SessionFsSetProviderResult")) - session_fs_sqlite_exists_request = SessionFSSqliteExistsRequest.from_dict(obj.get("SessionFsSqliteExistsRequest")) - session_fs_sqlite_exists_result = SessionFSSqliteExistsResult.from_dict(obj.get("SessionFsSqliteExistsResult")) - session_fs_sqlite_query_request = SessionFSSqliteQueryRequest.from_dict(obj.get("SessionFsSqliteQueryRequest")) - session_fs_sqlite_query_result = SessionFSSqliteQueryResult.from_dict(obj.get("SessionFsSqliteQueryResult")) + session_fs_set_provider_capabilities = SessionFSSetProviderCapabilities.from_dict( + obj.get("SessionFsSetProviderCapabilities") + ) + session_fs_set_provider_conventions = SessionFSSetProviderConventions( + obj.get("SessionFsSetProviderConventions") + ) + session_fs_set_provider_request = SessionFSSetProviderRequest.from_dict( + obj.get("SessionFsSetProviderRequest") + ) + session_fs_set_provider_result = SessionFSSetProviderResult.from_dict( + obj.get("SessionFsSetProviderResult") + ) + session_fs_sqlite_exists_request = SessionFSSqliteExistsRequest.from_dict( + obj.get("SessionFsSqliteExistsRequest") + ) + session_fs_sqlite_exists_result = SessionFSSqliteExistsResult.from_dict( + obj.get("SessionFsSqliteExistsResult") + ) + session_fs_sqlite_query_request = SessionFSSqliteQueryRequest.from_dict( + obj.get("SessionFsSqliteQueryRequest") + ) + session_fs_sqlite_query_result = SessionFSSqliteQueryResult.from_dict( + obj.get("SessionFsSqliteQueryResult") + ) session_fs_sqlite_query_type = SessionFSSqliteQueryType(obj.get("SessionFsSqliteQueryType")) session_fs_stat_request = SessionFSStatRequest.from_dict(obj.get("SessionFsStatRequest")) session_fs_stat_result = SessionFSStatResult.from_dict(obj.get("SessionFsStatResult")) - session_fs_write_file_request = SessionFSWriteFileRequest.from_dict(obj.get("SessionFsWriteFileRequest")) - session_installed_plugin = SessionInstalledPlugin.from_dict(obj.get("SessionInstalledPlugin")) - session_installed_plugin_source = from_union([SessionInstalledPluginSource.from_dict, from_str], obj.get("SessionInstalledPluginSource")) - session_installed_plugin_source_github = SessionInstalledPluginSourceGithub.from_dict(obj.get("SessionInstalledPluginSourceGithub")) - session_installed_plugin_source_local = SessionInstalledPluginSourceLocal.from_dict(obj.get("SessionInstalledPluginSourceLocal")) - session_installed_plugin_source_url = SessionInstalledPluginSourceURL.from_dict(obj.get("SessionInstalledPluginSourceUrl")) + session_fs_write_file_request = SessionFSWriteFileRequest.from_dict( + obj.get("SessionFsWriteFileRequest") + ) + session_installed_plugin = SessionInstalledPlugin.from_dict( + obj.get("SessionInstalledPlugin") + ) + session_installed_plugin_source = from_union( + [SessionInstalledPluginSource.from_dict, from_str], + obj.get("SessionInstalledPluginSource"), + ) + session_installed_plugin_source_github = SessionInstalledPluginSourceGithub.from_dict( + obj.get("SessionInstalledPluginSourceGithub") + ) + session_installed_plugin_source_local = SessionInstalledPluginSourceLocal.from_dict( + obj.get("SessionInstalledPluginSourceLocal") + ) + session_installed_plugin_source_url = SessionInstalledPluginSourceURL.from_dict( + obj.get("SessionInstalledPluginSourceUrl") + ) session_list = SessionList.from_dict(obj.get("SessionList")) session_list_filter = SessionListFilter.from_dict(obj.get("SessionListFilter")) - session_load_deferred_repo_hooks_result = SessionLoadDeferredRepoHooksResult.from_dict(obj.get("SessionLoadDeferredRepoHooksResult")) + session_load_deferred_repo_hooks_result = SessionLoadDeferredRepoHooksResult.from_dict( + obj.get("SessionLoadDeferredRepoHooksResult") + ) session_log_level = SessionLogLevel(obj.get("SessionLogLevel")) - session_mcp_apps_call_tool_result = from_dict(lambda x: x, obj.get("SessionMcpAppsCallToolResult")) + session_mcp_apps_call_tool_result = from_dict( + lambda x: x, obj.get("SessionMcpAppsCallToolResult") + ) session_metadata = SessionMetadata.from_dict(obj.get("SessionMetadata")) - session_metadata_snapshot = SessionMetadataSnapshot.from_dict(obj.get("SessionMetadataSnapshot")) + session_metadata_snapshot = SessionMetadataSnapshot.from_dict( + obj.get("SessionMetadataSnapshot") + ) session_mode = SessionMode(obj.get("SessionMode")) session_prune_result = SessionPruneResult.from_dict(obj.get("SessionPruneResult")) - sessions_bulk_delete_request = SessionsBulkDeleteRequest.from_dict(obj.get("SessionsBulkDeleteRequest")) - sessions_check_in_use_request = SessionsCheckInUseRequest.from_dict(obj.get("SessionsCheckInUseRequest")) - sessions_check_in_use_result = SessionsCheckInUseResult.from_dict(obj.get("SessionsCheckInUseResult")) + sessions_bulk_delete_request = SessionsBulkDeleteRequest.from_dict( + obj.get("SessionsBulkDeleteRequest") + ) + sessions_check_in_use_request = SessionsCheckInUseRequest.from_dict( + obj.get("SessionsCheckInUseRequest") + ) + sessions_check_in_use_result = SessionsCheckInUseResult.from_dict( + obj.get("SessionsCheckInUseResult") + ) sessions_close_request = SessionsCloseRequest.from_dict(obj.get("SessionsCloseRequest")) sessions_close_result = SessionsCloseResult.from_dict(obj.get("SessionsCloseResult")) - sessions_enrich_metadata_request = SessionsEnrichMetadataRequest.from_dict(obj.get("SessionsEnrichMetadataRequest")) - session_set_credentials_params = SessionSetCredentialsParams.from_dict(obj.get("SessionSetCredentialsParams")) - session_set_credentials_result = SessionSetCredentialsResult.from_dict(obj.get("SessionSetCredentialsResult")) - sessions_find_by_prefix_request = SessionsFindByPrefixRequest.from_dict(obj.get("SessionsFindByPrefixRequest")) - sessions_find_by_prefix_result = SessionsFindByPrefixResult.from_dict(obj.get("SessionsFindByPrefixResult")) - sessions_find_by_task_id_request = SessionsFindByTaskIDRequest.from_dict(obj.get("SessionsFindByTaskIDRequest")) - sessions_find_by_task_id_result = SessionsFindByTaskIDResult.from_dict(obj.get("SessionsFindByTaskIDResult")) + sessions_enrich_metadata_request = SessionsEnrichMetadataRequest.from_dict( + obj.get("SessionsEnrichMetadataRequest") + ) + session_set_credentials_params = SessionSetCredentialsParams.from_dict( + obj.get("SessionSetCredentialsParams") + ) + session_set_credentials_result = SessionSetCredentialsResult.from_dict( + obj.get("SessionSetCredentialsResult") + ) + sessions_find_by_prefix_request = SessionsFindByPrefixRequest.from_dict( + obj.get("SessionsFindByPrefixRequest") + ) + sessions_find_by_prefix_result = SessionsFindByPrefixResult.from_dict( + obj.get("SessionsFindByPrefixResult") + ) + sessions_find_by_task_id_request = SessionsFindByTaskIDRequest.from_dict( + obj.get("SessionsFindByTaskIDRequest") + ) + sessions_find_by_task_id_result = SessionsFindByTaskIDResult.from_dict( + obj.get("SessionsFindByTaskIDResult") + ) sessions_fork_request = SessionsForkRequest.from_dict(obj.get("SessionsForkRequest")) sessions_fork_result = SessionsForkResult.from_dict(obj.get("SessionsForkResult")) - sessions_get_event_file_path_request = SessionsGetEventFilePathRequest.from_dict(obj.get("SessionsGetEventFilePathRequest")) - sessions_get_event_file_path_result = SessionsGetEventFilePathResult.from_dict(obj.get("SessionsGetEventFilePathResult")) - sessions_get_last_for_context_request = SessionsGetLastForContextRequest.from_dict(obj.get("SessionsGetLastForContextRequest")) - sessions_get_last_for_context_result = SessionsGetLastForContextResult.from_dict(obj.get("SessionsGetLastForContextResult")) - sessions_get_persisted_remote_steerable_request = SessionsGetPersistedRemoteSteerableRequest.from_dict(obj.get("SessionsGetPersistedRemoteSteerableRequest")) - sessions_get_persisted_remote_steerable_result = SessionsGetPersistedRemoteSteerableResult.from_dict(obj.get("SessionsGetPersistedRemoteSteerableResult")) + sessions_get_event_file_path_request = SessionsGetEventFilePathRequest.from_dict( + obj.get("SessionsGetEventFilePathRequest") + ) + sessions_get_event_file_path_result = SessionsGetEventFilePathResult.from_dict( + obj.get("SessionsGetEventFilePathResult") + ) + sessions_get_last_for_context_request = SessionsGetLastForContextRequest.from_dict( + obj.get("SessionsGetLastForContextRequest") + ) + sessions_get_last_for_context_result = SessionsGetLastForContextResult.from_dict( + obj.get("SessionsGetLastForContextResult") + ) + sessions_get_persisted_remote_steerable_request = ( + SessionsGetPersistedRemoteSteerableRequest.from_dict( + obj.get("SessionsGetPersistedRemoteSteerableRequest") + ) + ) + sessions_get_persisted_remote_steerable_result = ( + SessionsGetPersistedRemoteSteerableResult.from_dict( + obj.get("SessionsGetPersistedRemoteSteerableResult") + ) + ) session_sizes = SessionSizes.from_dict(obj.get("SessionSizes")) sessions_list_request = SessionsListRequest.from_dict(obj.get("SessionsListRequest")) - sessions_load_deferred_repo_hooks_request = SessionsLoadDeferredRepoHooksRequest.from_dict(obj.get("SessionsLoadDeferredRepoHooksRequest")) - sessions_prune_old_request = SessionsPruneOldRequest.from_dict(obj.get("SessionsPruneOldRequest")) - sessions_release_lock_request = SessionsReleaseLockRequest.from_dict(obj.get("SessionsReleaseLockRequest")) - sessions_release_lock_result = SessionsReleaseLockResult.from_dict(obj.get("SessionsReleaseLockResult")) - sessions_reload_plugin_hooks_request = SessionsReloadPluginHooksRequest.from_dict(obj.get("SessionsReloadPluginHooksRequest")) - sessions_reload_plugin_hooks_result = SessionsReloadPluginHooksResult.from_dict(obj.get("SessionsReloadPluginHooksResult")) + sessions_load_deferred_repo_hooks_request = SessionsLoadDeferredRepoHooksRequest.from_dict( + obj.get("SessionsLoadDeferredRepoHooksRequest") + ) + sessions_prune_old_request = SessionsPruneOldRequest.from_dict( + obj.get("SessionsPruneOldRequest") + ) + sessions_release_lock_request = SessionsReleaseLockRequest.from_dict( + obj.get("SessionsReleaseLockRequest") + ) + sessions_release_lock_result = SessionsReleaseLockResult.from_dict( + obj.get("SessionsReleaseLockResult") + ) + sessions_reload_plugin_hooks_request = SessionsReloadPluginHooksRequest.from_dict( + obj.get("SessionsReloadPluginHooksRequest") + ) + sessions_reload_plugin_hooks_result = SessionsReloadPluginHooksResult.from_dict( + obj.get("SessionsReloadPluginHooksResult") + ) sessions_save_request = SessionsSaveRequest.from_dict(obj.get("SessionsSaveRequest")) sessions_save_result = SessionsSaveResult.from_dict(obj.get("SessionsSaveResult")) - sessions_set_additional_plugins_request = SessionsSetAdditionalPluginsRequest.from_dict(obj.get("SessionsSetAdditionalPluginsRequest")) - sessions_set_additional_plugins_result = SessionsSetAdditionalPluginsResult.from_dict(obj.get("SessionsSetAdditionalPluginsResult")) - session_update_options_params = SessionUpdateOptionsParams.from_dict(obj.get("SessionUpdateOptionsParams")) - session_update_options_result = SessionUpdateOptionsResult.from_dict(obj.get("SessionUpdateOptionsResult")) - session_working_directory_context = SessionWorkingDirectoryContext.from_dict(obj.get("SessionWorkingDirectoryContext")) - session_working_directory_context_host_type = HostType(obj.get("SessionWorkingDirectoryContextHostType")) + sessions_set_additional_plugins_request = SessionsSetAdditionalPluginsRequest.from_dict( + obj.get("SessionsSetAdditionalPluginsRequest") + ) + sessions_set_additional_plugins_result = SessionsSetAdditionalPluginsResult.from_dict( + obj.get("SessionsSetAdditionalPluginsResult") + ) + session_update_options_params = SessionUpdateOptionsParams.from_dict( + obj.get("SessionUpdateOptionsParams") + ) + session_update_options_result = SessionUpdateOptionsResult.from_dict( + obj.get("SessionUpdateOptionsResult") + ) + session_working_directory_context = SessionWorkingDirectoryContext.from_dict( + obj.get("SessionWorkingDirectoryContext") + ) + session_working_directory_context_host_type = HostType( + obj.get("SessionWorkingDirectoryContextHostType") + ) shell_exec_request = ShellExecRequest.from_dict(obj.get("ShellExecRequest")) shell_exec_result = ShellExecResult.from_dict(obj.get("ShellExecResult")) shell_kill_request = ShellKillRequest.from_dict(obj.get("ShellKillRequest")) @@ -15585,23 +18524,41 @@ def from_dict(obj: Any) -> 'RPC': shutdown_request = ShutdownRequest.from_dict(obj.get("ShutdownRequest")) skill = Skill.from_dict(obj.get("Skill")) skill_list = SkillList.from_dict(obj.get("SkillList")) - skills_config_set_disabled_skills_request = SkillsConfigSetDisabledSkillsRequest.from_dict(obj.get("SkillsConfigSetDisabledSkillsRequest")) + skills_config_set_disabled_skills_request = SkillsConfigSetDisabledSkillsRequest.from_dict( + obj.get("SkillsConfigSetDisabledSkillsRequest") + ) skills_disable_request = SkillsDisableRequest.from_dict(obj.get("SkillsDisableRequest")) skills_discover_request = SkillsDiscoverRequest.from_dict(obj.get("SkillsDiscoverRequest")) skills_enable_request = SkillsEnableRequest.from_dict(obj.get("SkillsEnableRequest")) - skills_get_invoked_result = SkillsGetInvokedResult.from_dict(obj.get("SkillsGetInvokedResult")) + skills_get_invoked_result = SkillsGetInvokedResult.from_dict( + obj.get("SkillsGetInvokedResult") + ) skills_invoked_skill = SkillsInvokedSkill.from_dict(obj.get("SkillsInvokedSkill")) skills_load_diagnostics = SkillsLoadDiagnostics.from_dict(obj.get("SkillsLoadDiagnostics")) - slash_command_agent_prompt_result = SlashCommandAgentPromptResult.from_dict(obj.get("SlashCommandAgentPromptResult")) - slash_command_completed_result = SlashCommandCompletedResult.from_dict(obj.get("SlashCommandCompletedResult")) + slash_command_agent_prompt_result = SlashCommandAgentPromptResult.from_dict( + obj.get("SlashCommandAgentPromptResult") + ) + slash_command_completed_result = SlashCommandCompletedResult.from_dict( + obj.get("SlashCommandCompletedResult") + ) slash_command_info = SlashCommandInfo.from_dict(obj.get("SlashCommandInfo")) slash_command_input = SlashCommandInput.from_dict(obj.get("SlashCommandInput")) - slash_command_input_completion = SlashCommandInputCompletion(obj.get("SlashCommandInputCompletion")) - slash_command_invocation_result = _load_SlashCommandInvocationResult(obj.get("SlashCommandInvocationResult")) + slash_command_input_completion = SlashCommandInputCompletion( + obj.get("SlashCommandInputCompletion") + ) + slash_command_invocation_result = _load_SlashCommandInvocationResult( + obj.get("SlashCommandInvocationResult") + ) slash_command_kind = SlashCommandKind(obj.get("SlashCommandKind")) - slash_command_select_subcommand_option = SlashCommandSelectSubcommandOption.from_dict(obj.get("SlashCommandSelectSubcommandOption")) - slash_command_select_subcommand_result = SlashCommandSelectSubcommandResult.from_dict(obj.get("SlashCommandSelectSubcommandResult")) - slash_command_text_result = SlashCommandTextResult.from_dict(obj.get("SlashCommandTextResult")) + slash_command_select_subcommand_option = SlashCommandSelectSubcommandOption.from_dict( + obj.get("SlashCommandSelectSubcommandOption") + ) + slash_command_select_subcommand_result = SlashCommandSelectSubcommandResult.from_dict( + obj.get("SlashCommandSelectSubcommandResult") + ) + slash_command_text_result = SlashCommandTextResult.from_dict( + obj.get("SlashCommandTextResult") + ) task_agent_info = TaskAgentInfo.from_dict(obj.get("TaskAgentInfo")) task_agent_progress = TaskAgentProgress.from_dict(obj.get("TaskAgentProgress")) task_execution_mode = TaskExecutionMode(obj.get("TaskExecutionMode")) @@ -15610,104 +18567,800 @@ def from_dict(obj: Any) -> 'RPC': task_progress_line = TaskProgressLine.from_dict(obj.get("TaskProgressLine")) tasks_cancel_request = TasksCancelRequest.from_dict(obj.get("TasksCancelRequest")) tasks_cancel_result = TasksCancelResult.from_dict(obj.get("TasksCancelResult")) - tasks_get_current_promotable_result = TasksGetCurrentPromotableResult.from_dict(obj.get("TasksGetCurrentPromotableResult")) - tasks_get_progress_request = TasksGetProgressRequest.from_dict(obj.get("TasksGetProgressRequest")) - tasks_get_progress_result = TasksGetProgressResult.from_dict(obj.get("TasksGetProgressResult")) + tasks_get_current_promotable_result = TasksGetCurrentPromotableResult.from_dict( + obj.get("TasksGetCurrentPromotableResult") + ) + tasks_get_progress_request = TasksGetProgressRequest.from_dict( + obj.get("TasksGetProgressRequest") + ) + tasks_get_progress_result = TasksGetProgressResult.from_dict( + obj.get("TasksGetProgressResult") + ) task_shell_info = TaskShellInfo.from_dict(obj.get("TaskShellInfo")) - task_shell_info_attachment_mode = TaskShellInfoAttachmentMode(obj.get("TaskShellInfoAttachmentMode")) + task_shell_info_attachment_mode = TaskShellInfoAttachmentMode( + obj.get("TaskShellInfoAttachmentMode") + ) task_shell_progress = TaskShellProgress.from_dict(obj.get("TaskShellProgress")) - tasks_promote_current_to_background_result = TasksPromoteCurrentToBackgroundResult.from_dict(obj.get("TasksPromoteCurrentToBackgroundResult")) - tasks_promote_to_background_request = TasksPromoteToBackgroundRequest.from_dict(obj.get("TasksPromoteToBackgroundRequest")) - tasks_promote_to_background_result = TasksPromoteToBackgroundResult.from_dict(obj.get("TasksPromoteToBackgroundResult")) + tasks_promote_current_to_background_result = ( + TasksPromoteCurrentToBackgroundResult.from_dict( + obj.get("TasksPromoteCurrentToBackgroundResult") + ) + ) + tasks_promote_to_background_request = TasksPromoteToBackgroundRequest.from_dict( + obj.get("TasksPromoteToBackgroundRequest") + ) + tasks_promote_to_background_result = TasksPromoteToBackgroundResult.from_dict( + obj.get("TasksPromoteToBackgroundResult") + ) tasks_refresh_result = TasksRefreshResult.from_dict(obj.get("TasksRefreshResult")) tasks_remove_request = TasksRemoveRequest.from_dict(obj.get("TasksRemoveRequest")) tasks_remove_result = TasksRemoveResult.from_dict(obj.get("TasksRemoveResult")) - tasks_send_message_request = TasksSendMessageRequest.from_dict(obj.get("TasksSendMessageRequest")) - tasks_send_message_result = TasksSendMessageResult.from_dict(obj.get("TasksSendMessageResult")) - tasks_start_agent_request = TasksStartAgentRequest.from_dict(obj.get("TasksStartAgentRequest")) + tasks_send_message_request = TasksSendMessageRequest.from_dict( + obj.get("TasksSendMessageRequest") + ) + tasks_send_message_result = TasksSendMessageResult.from_dict( + obj.get("TasksSendMessageResult") + ) + tasks_start_agent_request = TasksStartAgentRequest.from_dict( + obj.get("TasksStartAgentRequest") + ) tasks_start_agent_result = TasksStartAgentResult.from_dict(obj.get("TasksStartAgentResult")) task_status = TaskStatus(obj.get("TaskStatus")) - tasks_wait_for_pending_result = TasksWaitForPendingResult.from_dict(obj.get("TasksWaitForPendingResult")) - telemetry_set_feature_overrides_request = TelemetrySetFeatureOverridesRequest.from_dict(obj.get("TelemetrySetFeatureOverridesRequest")) + tasks_wait_for_pending_result = TasksWaitForPendingResult.from_dict( + obj.get("TasksWaitForPendingResult") + ) + telemetry_set_feature_overrides_request = TelemetrySetFeatureOverridesRequest.from_dict( + obj.get("TelemetrySetFeatureOverridesRequest") + ) token_auth_info = TokenAuthInfo.from_dict(obj.get("TokenAuthInfo")) tool = Tool.from_dict(obj.get("Tool")) tool_list = ToolList.from_dict(obj.get("ToolList")) - tools_initialize_and_validate_result = ToolsInitializeAndValidateResult.from_dict(obj.get("ToolsInitializeAndValidateResult")) + tools_initialize_and_validate_result = ToolsInitializeAndValidateResult.from_dict( + obj.get("ToolsInitializeAndValidateResult") + ) tools_list_request = ToolsListRequest.from_dict(obj.get("ToolsListRequest")) ui_auto_mode_switch_response = UIAutoModeSwitchResponse(obj.get("UIAutoModeSwitchResponse")) - ui_elicitation_array_any_of_field = UIElicitationArrayAnyOfField.from_dict(obj.get("UIElicitationArrayAnyOfField")) - ui_elicitation_array_any_of_field_items = UIElicitationArrayAnyOfFieldItems.from_dict(obj.get("UIElicitationArrayAnyOfFieldItems")) - ui_elicitation_array_any_of_field_items_any_of = UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict(obj.get("UIElicitationArrayAnyOfFieldItemsAnyOf")) - ui_elicitation_array_enum_field = UIElicitationArrayEnumField.from_dict(obj.get("UIElicitationArrayEnumField")) - ui_elicitation_array_enum_field_items = UIElicitationArrayEnumFieldItems.from_dict(obj.get("UIElicitationArrayEnumFieldItems")) - ui_elicitation_field_value = from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], obj.get("UIElicitationFieldValue")) + ui_elicitation_array_any_of_field = UIElicitationArrayAnyOfField.from_dict( + obj.get("UIElicitationArrayAnyOfField") + ) + ui_elicitation_array_any_of_field_items = UIElicitationArrayAnyOfFieldItems.from_dict( + obj.get("UIElicitationArrayAnyOfFieldItems") + ) + ui_elicitation_array_any_of_field_items_any_of = ( + UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict( + obj.get("UIElicitationArrayAnyOfFieldItemsAnyOf") + ) + ) + ui_elicitation_array_enum_field = UIElicitationArrayEnumField.from_dict( + obj.get("UIElicitationArrayEnumField") + ) + ui_elicitation_array_enum_field_items = UIElicitationArrayEnumFieldItems.from_dict( + obj.get("UIElicitationArrayEnumFieldItems") + ) + ui_elicitation_field_value = from_union( + [from_float, from_bool, lambda x: from_list(from_str, x), from_str], + obj.get("UIElicitationFieldValue"), + ) ui_elicitation_request = UIElicitationRequest.from_dict(obj.get("UIElicitationRequest")) ui_elicitation_response = UIElicitationResponse.from_dict(obj.get("UIElicitationResponse")) - ui_elicitation_response_action = UIElicitationResponseAction(obj.get("UIElicitationResponseAction")) - ui_elicitation_response_content = from_dict(lambda x: from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], x), obj.get("UIElicitationResponseContent")) + ui_elicitation_response_action = UIElicitationResponseAction( + obj.get("UIElicitationResponseAction") + ) + ui_elicitation_response_content = from_dict( + lambda x: from_union( + [from_float, from_bool, lambda x: from_list(from_str, x), from_str], x + ), + obj.get("UIElicitationResponseContent"), + ) ui_elicitation_result = UIElicitationResult.from_dict(obj.get("UIElicitationResult")) ui_elicitation_schema = UIElicitationSchema.from_dict(obj.get("UIElicitationSchema")) - ui_elicitation_schema_property = UIElicitationSchemaProperty.from_dict(obj.get("UIElicitationSchemaProperty")) - ui_elicitation_schema_property_boolean = UIElicitationSchemaPropertyBoolean.from_dict(obj.get("UIElicitationSchemaPropertyBoolean")) - ui_elicitation_schema_property_number = UIElicitationSchemaPropertyNumber.from_dict(obj.get("UIElicitationSchemaPropertyNumber")) - ui_elicitation_schema_property_number_type = UIElicitationSchemaPropertyNumberType(obj.get("UIElicitationSchemaPropertyNumberType")) - ui_elicitation_schema_property_string = UIElicitationSchemaPropertyString.from_dict(obj.get("UIElicitationSchemaPropertyString")) - ui_elicitation_schema_property_string_format = UIElicitationSchemaPropertyStringFormat(obj.get("UIElicitationSchemaPropertyStringFormat")) - ui_elicitation_string_enum_field = UIElicitationStringEnumField.from_dict(obj.get("UIElicitationStringEnumField")) - ui_elicitation_string_one_of_field = UIElicitationStringOneOfField.from_dict(obj.get("UIElicitationStringOneOfField")) - ui_elicitation_string_one_of_field_one_of = UIElicitationStringOneOfFieldOneOf.from_dict(obj.get("UIElicitationStringOneOfFieldOneOf")) + ui_elicitation_schema_property = UIElicitationSchemaProperty.from_dict( + obj.get("UIElicitationSchemaProperty") + ) + ui_elicitation_schema_property_boolean = UIElicitationSchemaPropertyBoolean.from_dict( + obj.get("UIElicitationSchemaPropertyBoolean") + ) + ui_elicitation_schema_property_number = UIElicitationSchemaPropertyNumber.from_dict( + obj.get("UIElicitationSchemaPropertyNumber") + ) + ui_elicitation_schema_property_number_type = UIElicitationSchemaPropertyNumberType( + obj.get("UIElicitationSchemaPropertyNumberType") + ) + ui_elicitation_schema_property_string = UIElicitationSchemaPropertyString.from_dict( + obj.get("UIElicitationSchemaPropertyString") + ) + ui_elicitation_schema_property_string_format = UIElicitationSchemaPropertyStringFormat( + obj.get("UIElicitationSchemaPropertyStringFormat") + ) + ui_elicitation_string_enum_field = UIElicitationStringEnumField.from_dict( + obj.get("UIElicitationStringEnumField") + ) + ui_elicitation_string_one_of_field = UIElicitationStringOneOfField.from_dict( + obj.get("UIElicitationStringOneOfField") + ) + ui_elicitation_string_one_of_field_one_of = UIElicitationStringOneOfFieldOneOf.from_dict( + obj.get("UIElicitationStringOneOfFieldOneOf") + ) ui_exit_plan_mode_action = UIExitPlanModeAction(obj.get("UIExitPlanModeAction")) - ui_exit_plan_mode_response = UIExitPlanModeResponse.from_dict(obj.get("UIExitPlanModeResponse")) - ui_handle_pending_auto_mode_switch_request = UIHandlePendingAutoModeSwitchRequest.from_dict(obj.get("UIHandlePendingAutoModeSwitchRequest")) - ui_handle_pending_elicitation_request = UIHandlePendingElicitationRequest.from_dict(obj.get("UIHandlePendingElicitationRequest")) - ui_handle_pending_exit_plan_mode_request = UIHandlePendingExitPlanModeRequest.from_dict(obj.get("UIHandlePendingExitPlanModeRequest")) + ui_exit_plan_mode_response = UIExitPlanModeResponse.from_dict( + obj.get("UIExitPlanModeResponse") + ) + ui_handle_pending_auto_mode_switch_request = UIHandlePendingAutoModeSwitchRequest.from_dict( + obj.get("UIHandlePendingAutoModeSwitchRequest") + ) + ui_handle_pending_elicitation_request = UIHandlePendingElicitationRequest.from_dict( + obj.get("UIHandlePendingElicitationRequest") + ) + ui_handle_pending_exit_plan_mode_request = UIHandlePendingExitPlanModeRequest.from_dict( + obj.get("UIHandlePendingExitPlanModeRequest") + ) ui_handle_pending_result = UIHandlePendingResult.from_dict(obj.get("UIHandlePendingResult")) - ui_handle_pending_sampling_request = UIHandlePendingSamplingRequest.from_dict(obj.get("UIHandlePendingSamplingRequest")) - ui_handle_pending_sampling_response = from_dict(lambda x: x, obj.get("UIHandlePendingSamplingResponse")) - ui_handle_pending_user_input_request = UIHandlePendingUserInputRequest.from_dict(obj.get("UIHandlePendingUserInputRequest")) - ui_register_direct_auto_mode_switch_handler_result = UIRegisterDirectAutoModeSwitchHandlerResult.from_dict(obj.get("UIRegisterDirectAutoModeSwitchHandlerResult")) - ui_unregister_direct_auto_mode_switch_handler_request = UIUnregisterDirectAutoModeSwitchHandlerRequest.from_dict(obj.get("UIUnregisterDirectAutoModeSwitchHandlerRequest")) - ui_unregister_direct_auto_mode_switch_handler_result = UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict(obj.get("UIUnregisterDirectAutoModeSwitchHandlerResult")) + ui_handle_pending_sampling_request = UIHandlePendingSamplingRequest.from_dict( + obj.get("UIHandlePendingSamplingRequest") + ) + ui_handle_pending_sampling_response = from_dict( + lambda x: x, obj.get("UIHandlePendingSamplingResponse") + ) + ui_handle_pending_user_input_request = UIHandlePendingUserInputRequest.from_dict( + obj.get("UIHandlePendingUserInputRequest") + ) + ui_register_direct_auto_mode_switch_handler_result = ( + UIRegisterDirectAutoModeSwitchHandlerResult.from_dict( + obj.get("UIRegisterDirectAutoModeSwitchHandlerResult") + ) + ) + ui_unregister_direct_auto_mode_switch_handler_request = ( + UIUnregisterDirectAutoModeSwitchHandlerRequest.from_dict( + obj.get("UIUnregisterDirectAutoModeSwitchHandlerRequest") + ) + ) + ui_unregister_direct_auto_mode_switch_handler_result = ( + UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict( + obj.get("UIUnregisterDirectAutoModeSwitchHandlerResult") + ) + ) ui_user_input_response = UIUserInputResponse.from_dict(obj.get("UIUserInputResponse")) usage_get_metrics_result = UsageGetMetricsResult.from_dict(obj.get("UsageGetMetricsResult")) - usage_metrics_code_changes = UsageMetricsCodeChanges.from_dict(obj.get("UsageMetricsCodeChanges")) - usage_metrics_model_metric = UsageMetricsModelMetric.from_dict(obj.get("UsageMetricsModelMetric")) - usage_metrics_model_metric_requests = UsageMetricsModelMetricRequests.from_dict(obj.get("UsageMetricsModelMetricRequests")) - usage_metrics_model_metric_token_detail = UsageMetricsModelMetricTokenDetail.from_dict(obj.get("UsageMetricsModelMetricTokenDetail")) - usage_metrics_model_metric_usage = UsageMetricsModelMetricUsage.from_dict(obj.get("UsageMetricsModelMetricUsage")) - usage_metrics_token_detail = UsageMetricsTokenDetail.from_dict(obj.get("UsageMetricsTokenDetail")) + usage_metrics_code_changes = UsageMetricsCodeChanges.from_dict( + obj.get("UsageMetricsCodeChanges") + ) + usage_metrics_model_metric = UsageMetricsModelMetric.from_dict( + obj.get("UsageMetricsModelMetric") + ) + usage_metrics_model_metric_requests = UsageMetricsModelMetricRequests.from_dict( + obj.get("UsageMetricsModelMetricRequests") + ) + usage_metrics_model_metric_token_detail = UsageMetricsModelMetricTokenDetail.from_dict( + obj.get("UsageMetricsModelMetricTokenDetail") + ) + usage_metrics_model_metric_usage = UsageMetricsModelMetricUsage.from_dict( + obj.get("UsageMetricsModelMetricUsage") + ) + usage_metrics_token_detail = UsageMetricsTokenDetail.from_dict( + obj.get("UsageMetricsTokenDetail") + ) user_auth_info = UserAuthInfo.from_dict(obj.get("UserAuthInfo")) - workspace_diff_file_change = WorkspaceDiffFileChange.from_dict(obj.get("WorkspaceDiffFileChange")) - workspace_diff_file_change_type = WorkspaceDiffFileChangeType(obj.get("WorkspaceDiffFileChangeType")) + workspace_diff_file_change = WorkspaceDiffFileChange.from_dict( + obj.get("WorkspaceDiffFileChange") + ) + workspace_diff_file_change_type = WorkspaceDiffFileChangeType( + obj.get("WorkspaceDiffFileChangeType") + ) workspace_diff_mode = WorkspaceDiffMode(obj.get("WorkspaceDiffMode")) workspace_diff_result = WorkspaceDiffResult.from_dict(obj.get("WorkspaceDiffResult")) workspaces_checkpoints = WorkspacesCheckpoints.from_dict(obj.get("WorkspacesCheckpoints")) - workspaces_create_file_request = WorkspacesCreateFileRequest.from_dict(obj.get("WorkspacesCreateFileRequest")) + workspaces_create_file_request = WorkspacesCreateFileRequest.from_dict( + obj.get("WorkspacesCreateFileRequest") + ) workspaces_diff_request = WorkspacesDiffRequest.from_dict(obj.get("WorkspacesDiffRequest")) - workspaces_get_workspace_result = WorkspacesGetWorkspaceResult.from_dict(obj.get("WorkspacesGetWorkspaceResult")) - workspaces_list_checkpoints_result = WorkspacesListCheckpointsResult.from_dict(obj.get("WorkspacesListCheckpointsResult")) - workspaces_list_files_result = WorkspacesListFilesResult.from_dict(obj.get("WorkspacesListFilesResult")) - workspaces_read_checkpoint_request = WorkspacesReadCheckpointRequest.from_dict(obj.get("WorkspacesReadCheckpointRequest")) - workspaces_read_checkpoint_result = WorkspacesReadCheckpointResult.from_dict(obj.get("WorkspacesReadCheckpointResult")) - workspaces_read_file_request = WorkspacesReadFileRequest.from_dict(obj.get("WorkspacesReadFileRequest")) - workspaces_read_file_result = WorkspacesReadFileResult.from_dict(obj.get("WorkspacesReadFileResult")) - workspaces_save_large_paste_request = WorkspacesSaveLargePasteRequest.from_dict(obj.get("WorkspacesSaveLargePasteRequest")) - workspaces_save_large_paste_result = WorkspacesSaveLargePasteResult.from_dict(obj.get("WorkspacesSaveLargePasteResult")) + workspaces_get_workspace_result = WorkspacesGetWorkspaceResult.from_dict( + obj.get("WorkspacesGetWorkspaceResult") + ) + workspaces_list_checkpoints_result = WorkspacesListCheckpointsResult.from_dict( + obj.get("WorkspacesListCheckpointsResult") + ) + workspaces_list_files_result = WorkspacesListFilesResult.from_dict( + obj.get("WorkspacesListFilesResult") + ) + workspaces_read_checkpoint_request = WorkspacesReadCheckpointRequest.from_dict( + obj.get("WorkspacesReadCheckpointRequest") + ) + workspaces_read_checkpoint_result = WorkspacesReadCheckpointResult.from_dict( + obj.get("WorkspacesReadCheckpointResult") + ) + workspaces_read_file_request = WorkspacesReadFileRequest.from_dict( + obj.get("WorkspacesReadFileRequest") + ) + workspaces_read_file_result = WorkspacesReadFileResult.from_dict( + obj.get("WorkspacesReadFileResult") + ) + workspaces_save_large_paste_request = WorkspacesSaveLargePasteRequest.from_dict( + obj.get("WorkspacesSaveLargePasteRequest") + ) + workspaces_save_large_paste_result = WorkspacesSaveLargePasteResult.from_dict( + obj.get("WorkspacesSaveLargePasteResult") + ) workspace_summary_host_type = HostType(obj.get("WorkspaceSummaryHostType")) - workspaces_workspace_details_host_type = HostType(obj.get("WorkspacesWorkspaceDetailsHostType")) - session_context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo")) + workspaces_workspace_details_host_type = HostType( + obj.get("WorkspacesWorkspaceDetailsHostType") + ) + session_context_info = from_union( + [SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo") + ) task_progress = from_union([TaskProgress.from_dict, from_none], obj.get("TaskProgress")) - workspace_summary = from_union([WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary")) - return RPC(abort_request, abort_result, account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_reload_result, agent_select_request, agent_select_result, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_close_request, canvas_instance_availability, canvas_invoke_action_request, canvas_invoke_action_result, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, discovered_canvas, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_source, installed_plugin_source_github, installed_plugin_source_local, installed_plugin_source_url, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, lsp_initialize_request, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_oauth_login_request, mcp_oauth_login_result, mcp_remove_git_hub_result, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_auth, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_list, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_env_value_mode, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, release_event_interest_params, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_mode, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachment, send_attachment_blob, send_attachment_directory, send_attachment_file, send_attachment_file_line_range, send_attachment_github_reference, send_attachment_github_reference_type, send_attachment_selection, send_attachment_selection_details, send_attachment_selection_details_end, send_attachment_selection_details_start, send_mode, send_request, send_result, server_skill, server_skill_list, session_auth_status, session_bulk_delete_result, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_github, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata, session_metadata_snapshot, session_mode, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_prune_old_request, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, session_update_options_params, session_update_options_result, session_working_directory_context, session_working_directory_context_host_type, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_initialize_and_validate_result, tools_list_request, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, task_progress, workspace_summary) + workspace_summary = from_union( + [WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary") + ) + return RPC( + abort_request, + abort_result, + account_get_quota_request, + account_get_quota_result, + account_quota_snapshot, + agent_get_current_result, + agent_info, + agent_info_source, + agent_list, + agent_reload_result, + agent_select_request, + agent_select_result, + api_key_auth_info, + auth_info, + auth_info_type, + canvas_action, + canvas_close_request, + canvas_host_context, + canvas_host_context_capabilities, + canvas_instance_availability, + canvas_invoke_action_request, + canvas_invoke_action_result, + canvas_json_schema, + canvas_list, + canvas_list_open_result, + canvas_open_request, + canvas_provider_close_request, + canvas_provider_invoke_action_request, + canvas_provider_open_request, + canvas_provider_open_result, + command_list, + commands_handle_pending_command_request, + commands_handle_pending_command_result, + commands_invoke_request, + commands_list_request, + commands_respond_to_queued_command_request, + commands_respond_to_queued_command_result, + connected_remote_session_metadata, + connected_remote_session_metadata_kind, + connected_remote_session_metadata_repository, + connect_remote_session_params, + connect_request, + connect_result, + content_filter_mode, + copilot_api_token_auth_info, + copilot_user_response, + copilot_user_response_endpoints, + copilot_user_response_quota_snapshots, + copilot_user_response_quota_snapshots_chat, + copilot_user_response_quota_snapshots_completions, + copilot_user_response_quota_snapshots_premium_interactions, + current_model, + discovered_canvas, + discovered_mcp_server, + discovered_mcp_server_type, + enqueue_command_params, + enqueue_command_result, + env_auth_info, + event_log_read_request, + event_log_release_interest_result, + event_log_tail_result, + event_log_types, + events_agent_scope, + events_cursor_status, + events_read_result, + execute_command_params, + execute_command_result, + extension, + extension_list, + extensions_disable_request, + extensions_enable_request, + extension_source, + extension_status, + external_tool_result, + external_tool_text_result_for_llm, + external_tool_text_result_for_llm_binary_results_for_llm, + external_tool_text_result_for_llm_binary_results_for_llm_type, + external_tool_text_result_for_llm_content, + external_tool_text_result_for_llm_content_audio, + external_tool_text_result_for_llm_content_image, + external_tool_text_result_for_llm_content_resource, + external_tool_text_result_for_llm_content_resource_details, + external_tool_text_result_for_llm_content_resource_link, + external_tool_text_result_for_llm_content_resource_link_icon, + external_tool_text_result_for_llm_content_resource_link_icon_theme, + external_tool_text_result_for_llm_content_terminal, + external_tool_text_result_for_llm_content_text, + filter_mapping, + fleet_start_request, + fleet_start_result, + folder_trust_add_params, + folder_trust_check_params, + folder_trust_check_result, + gh_cli_auth_info, + handle_pending_tool_call_request, + handle_pending_tool_call_result, + history_abort_manual_compaction_result, + history_cancel_background_compaction_result, + history_compact_context_window, + history_compact_request, + history_compact_result, + history_summarize_for_handoff_result, + history_truncate_request, + history_truncate_result, + hmac_auth_info, + installed_plugin, + installed_plugin_source, + installed_plugin_source_github, + installed_plugin_source_local, + installed_plugin_source_url, + instructions_get_sources_result, + instructions_sources, + instructions_sources_location, + instructions_sources_type, + log_request, + log_result, + lsp_initialize_request, + mcp_apps_call_tool_request, + mcp_apps_diagnose_capability, + mcp_apps_diagnose_request, + mcp_apps_diagnose_result, + mcp_apps_diagnose_server, + mcp_apps_host_context, + mcp_apps_host_context_details, + mcp_apps_host_context_details_available_display_mode, + mcp_apps_host_context_details_display_mode, + mcp_apps_host_context_details_platform, + mcp_apps_host_context_details_theme, + mcp_apps_list_tools_request, + mcp_apps_list_tools_result, + mcp_apps_read_resource_request, + mcp_apps_read_resource_result, + mcp_apps_resource_content, + mcp_apps_set_host_context_details, + mcp_apps_set_host_context_details_available_display_mode, + mcp_apps_set_host_context_details_display_mode, + mcp_apps_set_host_context_details_platform, + mcp_apps_set_host_context_details_theme, + mcp_apps_set_host_context_request, + mcp_cancel_sampling_execution_params, + mcp_cancel_sampling_execution_result, + mcp_config_add_request, + mcp_config_disable_request, + mcp_config_enable_request, + mcp_config_list, + mcp_config_remove_request, + mcp_config_update_request, + mcp_disable_request, + mcp_discover_request, + mcp_discover_result, + mcp_enable_request, + mcp_execute_sampling_params, + mcp_execute_sampling_request, + mcp_execute_sampling_result, + mcp_oauth_login_request, + mcp_oauth_login_result, + mcp_remove_git_hub_result, + mcp_sampling_execution_action, + mcp_sampling_execution_result, + mcp_server, + mcp_server_config, + mcp_server_config_http, + mcp_server_config_http_auth, + mcp_server_config_http_oauth_grant_type, + mcp_server_config_http_type, + mcp_server_config_stdio, + mcp_server_list, + mcp_set_env_value_mode_details, + mcp_set_env_value_mode_params, + mcp_set_env_value_mode_result, + metadata_context_info_request, + metadata_context_info_result, + metadata_is_processing_result, + metadata_recompute_context_tokens_request, + metadata_recompute_context_tokens_result, + metadata_record_context_change_request, + metadata_record_context_change_result, + metadata_set_working_directory_request, + metadata_set_working_directory_result, + metadata_snapshot_current_mode, + metadata_snapshot_remote_metadata, + metadata_snapshot_remote_metadata_repository, + metadata_snapshot_remote_metadata_task_type, + model, + model_billing, + model_billing_token_prices, + model_billing_token_prices_long_context, + model_capabilities, + model_capabilities_limits, + model_capabilities_limits_vision, + model_capabilities_override, + model_capabilities_override_limits, + model_capabilities_override_limits_vision, + model_capabilities_override_supports, + model_capabilities_supports, + model_list, + model_picker_category, + model_picker_price_category, + model_policy, + model_policy_state, + model_set_reasoning_effort_request, + model_set_reasoning_effort_result, + models_list_request, + model_switch_to_request, + model_switch_to_result, + mode_set_request, + name_get_result, + name_set_auto_request, + name_set_auto_result, + name_set_request, + open_canvas_instance, + options_update_env_value_mode, + pending_permission_request, + pending_permission_request_list, + permission_decision, + permission_decision_approved, + permission_decision_approved_for_location, + permission_decision_approved_for_session, + permission_decision_approve_for_location, + permission_decision_approve_for_location_approval, + permission_decision_approve_for_location_approval_commands, + permission_decision_approve_for_location_approval_custom_tool, + permission_decision_approve_for_location_approval_extension_management, + permission_decision_approve_for_location_approval_extension_permission_access, + permission_decision_approve_for_location_approval_mcp, + permission_decision_approve_for_location_approval_mcp_sampling, + permission_decision_approve_for_location_approval_memory, + permission_decision_approve_for_location_approval_read, + permission_decision_approve_for_location_approval_write, + permission_decision_approve_for_session, + permission_decision_approve_for_session_approval, + permission_decision_approve_for_session_approval_commands, + permission_decision_approve_for_session_approval_custom_tool, + permission_decision_approve_for_session_approval_extension_management, + permission_decision_approve_for_session_approval_extension_permission_access, + permission_decision_approve_for_session_approval_mcp, + permission_decision_approve_for_session_approval_mcp_sampling, + permission_decision_approve_for_session_approval_memory, + permission_decision_approve_for_session_approval_read, + permission_decision_approve_for_session_approval_write, + permission_decision_approve_once, + permission_decision_approve_permanently, + permission_decision_cancelled, + permission_decision_denied_by_content_exclusion_policy, + permission_decision_denied_by_permission_request_hook, + permission_decision_denied_by_rules, + permission_decision_denied_interactively_by_user, + permission_decision_denied_no_approval_rule_and_could_not_request_from_user, + permission_decision_reject, + permission_decision_request, + permission_decision_user_not_available, + permission_location_add_tool_approval_params, + permission_location_apply_params, + permission_location_apply_result, + permission_location_resolve_params, + permission_location_resolve_result, + permission_location_type, + permission_paths_add_params, + permission_paths_allowed_check_params, + permission_paths_allowed_check_result, + permission_paths_config, + permission_paths_list, + permission_paths_update_primary_params, + permission_paths_workspace_check_params, + permission_paths_workspace_check_result, + permission_prompt_shown_notification, + permission_request_result, + permission_rules_set, + permissions_configure_additional_content_exclusion_policy, + permissions_configure_additional_content_exclusion_policy_rule, + permissions_configure_additional_content_exclusion_policy_rule_source, + permissions_configure_additional_content_exclusion_policy_scope, + permissions_configure_params, + permissions_configure_result, + permissions_folder_trust_add_trusted_result, + permissions_locations_add_tool_approval_details, + permissions_locations_add_tool_approval_details_commands, + permissions_locations_add_tool_approval_details_custom_tool, + permissions_locations_add_tool_approval_details_extension_management, + permissions_locations_add_tool_approval_details_extension_permission_access, + permissions_locations_add_tool_approval_details_mcp, + permissions_locations_add_tool_approval_details_mcp_sampling, + permissions_locations_add_tool_approval_details_memory, + permissions_locations_add_tool_approval_details_read, + permissions_locations_add_tool_approval_details_write, + permissions_locations_add_tool_approval_result, + permissions_modify_rules_params, + permissions_modify_rules_result, + permissions_modify_rules_scope, + permissions_notify_prompt_shown_result, + permissions_paths_add_result, + permissions_paths_list_request, + permissions_paths_update_primary_result, + permissions_pending_requests_request, + permissions_reset_session_approvals_request, + permissions_reset_session_approvals_result, + permissions_set_approve_all_request, + permissions_set_approve_all_result, + permissions_set_approve_all_source, + permissions_set_required_request, + permissions_set_required_result, + permissions_urls_set_unrestricted_mode_result, + permission_urls_config, + permission_urls_set_unrestricted_mode_params, + ping_request, + ping_result, + plan_read_result, + plan_update_request, + plugin, + plugin_list, + queued_command_handled, + queued_command_not_handled, + queued_command_result, + queue_pending_items, + queue_pending_items_kind, + queue_pending_items_result, + queue_remove_most_recent_result, + register_event_interest_params, + register_event_interest_result, + release_event_interest_params, + remote_enable_request, + remote_enable_result, + remote_notify_steerable_changed_request, + remote_notify_steerable_changed_result, + remote_session_connection_result, + remote_session_mode, + schedule_entry, + schedule_list, + schedule_stop_request, + schedule_stop_result, + secrets_add_filter_values_request, + secrets_add_filter_values_result, + send_agent_mode, + send_attachment, + send_attachment_blob, + send_attachment_directory, + send_attachment_file, + send_attachment_file_line_range, + send_attachment_github_reference, + send_attachment_github_reference_type, + send_attachment_selection, + send_attachment_selection_details, + send_attachment_selection_details_end, + send_attachment_selection_details_start, + send_mode, + send_request, + send_result, + server_skill, + server_skill_list, + session_auth_status, + session_bulk_delete_result, + session_context, + session_context_host_type, + session_enrich_metadata_result, + session_fs_append_file_request, + session_fs_error, + session_fs_error_code, + session_fs_exists_request, + session_fs_exists_result, + session_fs_mkdir_request, + session_fs_readdir_request, + session_fs_readdir_result, + session_fs_readdir_with_types_entry, + session_fs_readdir_with_types_entry_type, + session_fs_readdir_with_types_request, + session_fs_readdir_with_types_result, + session_fs_read_file_request, + session_fs_read_file_result, + session_fs_rename_request, + session_fs_rm_request, + session_fs_set_provider_capabilities, + session_fs_set_provider_conventions, + session_fs_set_provider_request, + session_fs_set_provider_result, + session_fs_sqlite_exists_request, + session_fs_sqlite_exists_result, + session_fs_sqlite_query_request, + session_fs_sqlite_query_result, + session_fs_sqlite_query_type, + session_fs_stat_request, + session_fs_stat_result, + session_fs_write_file_request, + session_installed_plugin, + session_installed_plugin_source, + session_installed_plugin_source_github, + session_installed_plugin_source_local, + session_installed_plugin_source_url, + session_list, + session_list_filter, + session_load_deferred_repo_hooks_result, + session_log_level, + session_mcp_apps_call_tool_result, + session_metadata, + session_metadata_snapshot, + session_mode, + session_prune_result, + sessions_bulk_delete_request, + sessions_check_in_use_request, + sessions_check_in_use_result, + sessions_close_request, + sessions_close_result, + sessions_enrich_metadata_request, + session_set_credentials_params, + session_set_credentials_result, + sessions_find_by_prefix_request, + sessions_find_by_prefix_result, + sessions_find_by_task_id_request, + sessions_find_by_task_id_result, + sessions_fork_request, + sessions_fork_result, + sessions_get_event_file_path_request, + sessions_get_event_file_path_result, + sessions_get_last_for_context_request, + sessions_get_last_for_context_result, + sessions_get_persisted_remote_steerable_request, + sessions_get_persisted_remote_steerable_result, + session_sizes, + sessions_list_request, + sessions_load_deferred_repo_hooks_request, + sessions_prune_old_request, + sessions_release_lock_request, + sessions_release_lock_result, + sessions_reload_plugin_hooks_request, + sessions_reload_plugin_hooks_result, + sessions_save_request, + sessions_save_result, + sessions_set_additional_plugins_request, + sessions_set_additional_plugins_result, + session_update_options_params, + session_update_options_result, + session_working_directory_context, + session_working_directory_context_host_type, + shell_exec_request, + shell_exec_result, + shell_kill_request, + shell_kill_result, + shell_kill_signal, + shutdown_request, + skill, + skill_list, + skills_config_set_disabled_skills_request, + skills_disable_request, + skills_discover_request, + skills_enable_request, + skills_get_invoked_result, + skills_invoked_skill, + skills_load_diagnostics, + slash_command_agent_prompt_result, + slash_command_completed_result, + slash_command_info, + slash_command_input, + slash_command_input_completion, + slash_command_invocation_result, + slash_command_kind, + slash_command_select_subcommand_option, + slash_command_select_subcommand_result, + slash_command_text_result, + task_agent_info, + task_agent_progress, + task_execution_mode, + task_info, + task_list, + task_progress_line, + tasks_cancel_request, + tasks_cancel_result, + tasks_get_current_promotable_result, + tasks_get_progress_request, + tasks_get_progress_result, + task_shell_info, + task_shell_info_attachment_mode, + task_shell_progress, + tasks_promote_current_to_background_result, + tasks_promote_to_background_request, + tasks_promote_to_background_result, + tasks_refresh_result, + tasks_remove_request, + tasks_remove_result, + tasks_send_message_request, + tasks_send_message_result, + tasks_start_agent_request, + tasks_start_agent_result, + task_status, + tasks_wait_for_pending_result, + telemetry_set_feature_overrides_request, + token_auth_info, + tool, + tool_list, + tools_initialize_and_validate_result, + tools_list_request, + ui_auto_mode_switch_response, + ui_elicitation_array_any_of_field, + ui_elicitation_array_any_of_field_items, + ui_elicitation_array_any_of_field_items_any_of, + ui_elicitation_array_enum_field, + ui_elicitation_array_enum_field_items, + ui_elicitation_field_value, + ui_elicitation_request, + ui_elicitation_response, + ui_elicitation_response_action, + ui_elicitation_response_content, + ui_elicitation_result, + ui_elicitation_schema, + ui_elicitation_schema_property, + ui_elicitation_schema_property_boolean, + ui_elicitation_schema_property_number, + ui_elicitation_schema_property_number_type, + ui_elicitation_schema_property_string, + ui_elicitation_schema_property_string_format, + ui_elicitation_string_enum_field, + ui_elicitation_string_one_of_field, + ui_elicitation_string_one_of_field_one_of, + ui_exit_plan_mode_action, + ui_exit_plan_mode_response, + ui_handle_pending_auto_mode_switch_request, + ui_handle_pending_elicitation_request, + ui_handle_pending_exit_plan_mode_request, + ui_handle_pending_result, + ui_handle_pending_sampling_request, + ui_handle_pending_sampling_response, + ui_handle_pending_user_input_request, + ui_register_direct_auto_mode_switch_handler_result, + ui_unregister_direct_auto_mode_switch_handler_request, + ui_unregister_direct_auto_mode_switch_handler_result, + ui_user_input_response, + usage_get_metrics_result, + usage_metrics_code_changes, + usage_metrics_model_metric, + usage_metrics_model_metric_requests, + usage_metrics_model_metric_token_detail, + usage_metrics_model_metric_usage, + usage_metrics_token_detail, + user_auth_info, + workspace_diff_file_change, + workspace_diff_file_change_type, + workspace_diff_mode, + workspace_diff_result, + workspaces_checkpoints, + workspaces_create_file_request, + workspaces_diff_request, + workspaces_get_workspace_result, + workspaces_list_checkpoints_result, + workspaces_list_files_result, + workspaces_read_checkpoint_request, + workspaces_read_checkpoint_result, + workspaces_read_file_request, + workspaces_read_file_result, + workspaces_save_large_paste_request, + workspaces_save_large_paste_result, + workspace_summary_host_type, + workspaces_workspace_details_host_type, + session_context_info, + task_progress, + workspace_summary, + ) def to_dict(self) -> dict: result: dict = {} result["AbortRequest"] = to_class(AbortRequest, self.abort_request) result["AbortResult"] = to_class(AbortResult, self.abort_result) - result["AccountGetQuotaRequest"] = to_class(AccountGetQuotaRequest, self.account_get_quota_request) - result["AccountGetQuotaResult"] = to_class(AccountGetQuotaResult, self.account_get_quota_result) + result["AccountGetQuotaRequest"] = to_class( + AccountGetQuotaRequest, self.account_get_quota_request + ) + result["AccountGetQuotaResult"] = to_class( + AccountGetQuotaResult, self.account_get_quota_result + ) result["AccountQuotaSnapshot"] = to_class(AccountQuotaSnapshot, self.account_quota_snapshot) - result["AgentGetCurrentResult"] = to_class(AgentGetCurrentResult, self.agent_get_current_result) + result["AgentGetCurrentResult"] = to_class( + AgentGetCurrentResult, self.agent_get_current_result + ) result["AgentInfo"] = to_class(AgentInfo, self.agent_info) result["AgentInfoSource"] = to_enum(AgentInfoSource, self.agent_info_source) result["AgentList"] = to_class(AgentList, self.agent_list) @@ -15719,45 +19372,110 @@ def to_dict(self) -> dict: result["AuthInfoType"] = to_enum(AuthInfoType, self.auth_info_type) result["CanvasAction"] = to_class(CanvasAction, self.canvas_action) result["CanvasCloseRequest"] = to_class(CanvasCloseRequest, self.canvas_close_request) - result["CanvasInstanceAvailability"] = to_enum(CanvasInstanceAvailability, self.canvas_instance_availability) - result["CanvasInvokeActionRequest"] = to_class(CanvasInvokeActionRequest, self.canvas_invoke_action_request) - result["CanvasInvokeActionResult"] = to_class(CanvasInvokeActionResult, self.canvas_invoke_action_result) + result["CanvasHostContext"] = to_class(CanvasHostContext, self.canvas_host_context) + result["CanvasHostContextCapabilities"] = to_class( + CanvasHostContextCapabilities, self.canvas_host_context_capabilities + ) + result["CanvasInstanceAvailability"] = to_enum( + CanvasInstanceAvailability, self.canvas_instance_availability + ) + result["CanvasInvokeActionRequest"] = to_class( + CanvasInvokeActionRequest, self.canvas_invoke_action_request + ) + result["CanvasInvokeActionResult"] = self.canvas_invoke_action_result result["CanvasJsonSchema"] = self.canvas_json_schema result["CanvasList"] = to_class(CanvasList, self.canvas_list) - result["CanvasListOpenResult"] = to_class(CanvasListOpenResult, self.canvas_list_open_result) + result["CanvasListOpenResult"] = to_class( + CanvasListOpenResult, self.canvas_list_open_result + ) result["CanvasOpenRequest"] = to_class(CanvasOpenRequest, self.canvas_open_request) + result["CanvasProviderCloseRequest"] = to_class( + CanvasProviderCloseRequest, self.canvas_provider_close_request + ) + result["CanvasProviderInvokeActionRequest"] = to_class( + CanvasProviderInvokeActionRequest, self.canvas_provider_invoke_action_request + ) + result["CanvasProviderOpenRequest"] = to_class( + CanvasProviderOpenRequest, self.canvas_provider_open_request + ) + result["CanvasProviderOpenResult"] = to_class( + CanvasProviderOpenResult, self.canvas_provider_open_result + ) result["CommandList"] = to_class(CommandList, self.command_list) - result["CommandsHandlePendingCommandRequest"] = to_class(CommandsHandlePendingCommandRequest, self.commands_handle_pending_command_request) - result["CommandsHandlePendingCommandResult"] = to_class(CommandsHandlePendingCommandResult, self.commands_handle_pending_command_result) - result["CommandsInvokeRequest"] = to_class(CommandsInvokeRequest, self.commands_invoke_request) + result["CommandsHandlePendingCommandRequest"] = to_class( + CommandsHandlePendingCommandRequest, self.commands_handle_pending_command_request + ) + result["CommandsHandlePendingCommandResult"] = to_class( + CommandsHandlePendingCommandResult, self.commands_handle_pending_command_result + ) + result["CommandsInvokeRequest"] = to_class( + CommandsInvokeRequest, self.commands_invoke_request + ) result["CommandsListRequest"] = to_class(CommandsListRequest, self.commands_list_request) - result["CommandsRespondToQueuedCommandRequest"] = to_class(CommandsRespondToQueuedCommandRequest, self.commands_respond_to_queued_command_request) - result["CommandsRespondToQueuedCommandResult"] = to_class(CommandsRespondToQueuedCommandResult, self.commands_respond_to_queued_command_result) - result["ConnectedRemoteSessionMetadata"] = to_class(ConnectedRemoteSessionMetadata, self.connected_remote_session_metadata) - result["ConnectedRemoteSessionMetadataKind"] = to_enum(ConnectedRemoteSessionMetadataKind, self.connected_remote_session_metadata_kind) - result["ConnectedRemoteSessionMetadataRepository"] = to_class(ConnectedRemoteSessionMetadataRepository, self.connected_remote_session_metadata_repository) - result["ConnectRemoteSessionParams"] = to_class(ConnectRemoteSessionParams, self.connect_remote_session_params) + result["CommandsRespondToQueuedCommandRequest"] = to_class( + CommandsRespondToQueuedCommandRequest, self.commands_respond_to_queued_command_request + ) + result["CommandsRespondToQueuedCommandResult"] = to_class( + CommandsRespondToQueuedCommandResult, self.commands_respond_to_queued_command_result + ) + result["ConnectedRemoteSessionMetadata"] = to_class( + ConnectedRemoteSessionMetadata, self.connected_remote_session_metadata + ) + result["ConnectedRemoteSessionMetadataKind"] = to_enum( + ConnectedRemoteSessionMetadataKind, self.connected_remote_session_metadata_kind + ) + result["ConnectedRemoteSessionMetadataRepository"] = to_class( + ConnectedRemoteSessionMetadataRepository, + self.connected_remote_session_metadata_repository, + ) + result["ConnectRemoteSessionParams"] = to_class( + ConnectRemoteSessionParams, self.connect_remote_session_params + ) result["ConnectRequest"] = to_class(_ConnectRequest, self.connect_request) result["ConnectResult"] = to_class(_ConnectResult, self.connect_result) result["ContentFilterMode"] = to_enum(ContentFilterMode, self.content_filter_mode) - result["CopilotApiTokenAuthInfo"] = to_class(CopilotAPITokenAuthInfo, self.copilot_api_token_auth_info) + result["CopilotApiTokenAuthInfo"] = to_class( + CopilotAPITokenAuthInfo, self.copilot_api_token_auth_info + ) result["CopilotUserResponse"] = to_class(CopilotUserResponse, self.copilot_user_response) - result["CopilotUserResponseEndpoints"] = to_class(CopilotUserResponseEndpoints, self.copilot_user_response_endpoints) - result["CopilotUserResponseQuotaSnapshots"] = from_dict(lambda x: from_union([lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x), self.copilot_user_response_quota_snapshots) - result["CopilotUserResponseQuotaSnapshotsChat"] = to_class(CopilotUserResponseQuotaSnapshotsChat, self.copilot_user_response_quota_snapshots_chat) - result["CopilotUserResponseQuotaSnapshotsCompletions"] = to_class(CopilotUserResponseQuotaSnapshotsCompletions, self.copilot_user_response_quota_snapshots_completions) - result["CopilotUserResponseQuotaSnapshotsPremiumInteractions"] = to_class(CopilotUserResponseQuotaSnapshotsPremiumInteractions, self.copilot_user_response_quota_snapshots_premium_interactions) + result["CopilotUserResponseEndpoints"] = to_class( + CopilotUserResponseEndpoints, self.copilot_user_response_endpoints + ) + result["CopilotUserResponseQuotaSnapshots"] = from_dict( + lambda x: from_union( + [lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x + ), + self.copilot_user_response_quota_snapshots, + ) + result["CopilotUserResponseQuotaSnapshotsChat"] = to_class( + CopilotUserResponseQuotaSnapshotsChat, self.copilot_user_response_quota_snapshots_chat + ) + result["CopilotUserResponseQuotaSnapshotsCompletions"] = to_class( + CopilotUserResponseQuotaSnapshotsCompletions, + self.copilot_user_response_quota_snapshots_completions, + ) + result["CopilotUserResponseQuotaSnapshotsPremiumInteractions"] = to_class( + CopilotUserResponseQuotaSnapshotsPremiumInteractions, + self.copilot_user_response_quota_snapshots_premium_interactions, + ) result["CurrentModel"] = to_class(CurrentModel, self.current_model) result["DiscoveredCanvas"] = to_class(DiscoveredCanvas, self.discovered_canvas) result["DiscoveredMcpServer"] = to_class(DiscoveredMCPServer, self.discovered_mcp_server) - result["DiscoveredMcpServerType"] = to_enum(DiscoveredMCPServerType, self.discovered_mcp_server_type) + result["DiscoveredMcpServerType"] = to_enum( + DiscoveredMCPServerType, self.discovered_mcp_server_type + ) result["EnqueueCommandParams"] = to_class(EnqueueCommandParams, self.enqueue_command_params) result["EnqueueCommandResult"] = to_class(EnqueueCommandResult, self.enqueue_command_result) result["EnvAuthInfo"] = to_class(EnvAuthInfo, self.env_auth_info) result["EventLogReadRequest"] = to_class(EventLogReadRequest, self.event_log_read_request) - result["EventLogReleaseInterestResult"] = to_class(EventLogReleaseInterestResult, self.event_log_release_interest_result) + result["EventLogReleaseInterestResult"] = to_class( + EventLogReleaseInterestResult, self.event_log_release_interest_result + ) result["EventLogTailResult"] = to_class(EventLogTailResult, self.event_log_tail_result) - result["EventLogTypes"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x)], self.event_log_types) + result["EventLogTypes"] = from_union( + [lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x)], + self.event_log_types, + ) result["EventsAgentScope"] = to_enum(EventsAgentScope, self.events_agent_scope) result["EventsCursorStatus"] = to_enum(EventsCursorStatus, self.events_cursor_status) result["EventsReadResult"] = to_class(EventsReadResult, self.events_read_result) @@ -15765,141 +19483,367 @@ def to_dict(self) -> dict: result["ExecuteCommandResult"] = to_class(ExecuteCommandResult, self.execute_command_result) result["Extension"] = to_class(Extension, self.extension) result["ExtensionList"] = to_class(ExtensionList, self.extension_list) - result["ExtensionsDisableRequest"] = to_class(ExtensionsDisableRequest, self.extensions_disable_request) - result["ExtensionsEnableRequest"] = to_class(ExtensionsEnableRequest, self.extensions_enable_request) + result["ExtensionsDisableRequest"] = to_class( + ExtensionsDisableRequest, self.extensions_disable_request + ) + result["ExtensionsEnableRequest"] = to_class( + ExtensionsEnableRequest, self.extensions_enable_request + ) result["ExtensionSource"] = to_enum(ExtensionSource, self.extension_source) result["ExtensionStatus"] = to_enum(ExtensionStatus, self.extension_status) - result["ExternalToolResult"] = from_union([lambda x: to_class(ExternalToolTextResultForLlm, x), from_str], self.external_tool_result) - result["ExternalToolTextResultForLlm"] = to_class(ExternalToolTextResultForLlm, self.external_tool_text_result_for_llm) - result["ExternalToolTextResultForLlmBinaryResultsForLlm"] = to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, self.external_tool_text_result_for_llm_binary_results_for_llm) - result["ExternalToolTextResultForLlmBinaryResultsForLlmType"] = to_enum(ExternalToolTextResultForLlmBinaryResultsForLlmType, self.external_tool_text_result_for_llm_binary_results_for_llm_type) - result["ExternalToolTextResultForLlmContent"] = (self.external_tool_text_result_for_llm_content).to_dict() - result["ExternalToolTextResultForLlmContentAudio"] = to_class(ExternalToolTextResultForLlmContentAudio, self.external_tool_text_result_for_llm_content_audio) - result["ExternalToolTextResultForLlmContentImage"] = to_class(ExternalToolTextResultForLlmContentImage, self.external_tool_text_result_for_llm_content_image) - result["ExternalToolTextResultForLlmContentResource"] = to_class(ExternalToolTextResultForLlmContentResource, self.external_tool_text_result_for_llm_content_resource) - result["ExternalToolTextResultForLlmContentResourceDetails"] = from_union([lambda x: to_class(EmbeddedTextResourceContents, x), lambda x: to_class(EmbeddedBlobResourceContents, x)], self.external_tool_text_result_for_llm_content_resource_details) - result["ExternalToolTextResultForLlmContentResourceLink"] = to_class(ExternalToolTextResultForLlmContentResourceLink, self.external_tool_text_result_for_llm_content_resource_link) - result["ExternalToolTextResultForLlmContentResourceLinkIcon"] = to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, self.external_tool_text_result_for_llm_content_resource_link_icon) - result["ExternalToolTextResultForLlmContentResourceLinkIconTheme"] = to_enum(Theme, self.external_tool_text_result_for_llm_content_resource_link_icon_theme) - result["ExternalToolTextResultForLlmContentTerminal"] = to_class(ExternalToolTextResultForLlmContentTerminal, self.external_tool_text_result_for_llm_content_terminal) - result["ExternalToolTextResultForLlmContentText"] = to_class(ExternalToolTextResultForLlmContentText, self.external_tool_text_result_for_llm_content_text) - result["FilterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x)], self.filter_mapping) + result["ExternalToolResult"] = from_union( + [lambda x: to_class(ExternalToolTextResultForLlm, x), from_str], + self.external_tool_result, + ) + result["ExternalToolTextResultForLlm"] = to_class( + ExternalToolTextResultForLlm, self.external_tool_text_result_for_llm + ) + result["ExternalToolTextResultForLlmBinaryResultsForLlm"] = to_class( + ExternalToolTextResultForLlmBinaryResultsForLlm, + self.external_tool_text_result_for_llm_binary_results_for_llm, + ) + result["ExternalToolTextResultForLlmBinaryResultsForLlmType"] = to_enum( + ExternalToolTextResultForLlmBinaryResultsForLlmType, + self.external_tool_text_result_for_llm_binary_results_for_llm_type, + ) + result["ExternalToolTextResultForLlmContent"] = ( + self.external_tool_text_result_for_llm_content + ).to_dict() + result["ExternalToolTextResultForLlmContentAudio"] = to_class( + ExternalToolTextResultForLlmContentAudio, + self.external_tool_text_result_for_llm_content_audio, + ) + result["ExternalToolTextResultForLlmContentImage"] = to_class( + ExternalToolTextResultForLlmContentImage, + self.external_tool_text_result_for_llm_content_image, + ) + result["ExternalToolTextResultForLlmContentResource"] = to_class( + ExternalToolTextResultForLlmContentResource, + self.external_tool_text_result_for_llm_content_resource, + ) + result["ExternalToolTextResultForLlmContentResourceDetails"] = from_union( + [ + lambda x: to_class(EmbeddedTextResourceContents, x), + lambda x: to_class(EmbeddedBlobResourceContents, x), + ], + self.external_tool_text_result_for_llm_content_resource_details, + ) + result["ExternalToolTextResultForLlmContentResourceLink"] = to_class( + ExternalToolTextResultForLlmContentResourceLink, + self.external_tool_text_result_for_llm_content_resource_link, + ) + result["ExternalToolTextResultForLlmContentResourceLinkIcon"] = to_class( + ExternalToolTextResultForLlmContentResourceLinkIcon, + self.external_tool_text_result_for_llm_content_resource_link_icon, + ) + result["ExternalToolTextResultForLlmContentResourceLinkIconTheme"] = to_enum( + Theme, self.external_tool_text_result_for_llm_content_resource_link_icon_theme + ) + result["ExternalToolTextResultForLlmContentTerminal"] = to_class( + ExternalToolTextResultForLlmContentTerminal, + self.external_tool_text_result_for_llm_content_terminal, + ) + result["ExternalToolTextResultForLlmContentText"] = to_class( + ExternalToolTextResultForLlmContentText, + self.external_tool_text_result_for_llm_content_text, + ) + result["FilterMapping"] = from_union( + [ + lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), + lambda x: to_enum(ContentFilterMode, x), + ], + self.filter_mapping, + ) result["FleetStartRequest"] = to_class(FleetStartRequest, self.fleet_start_request) result["FleetStartResult"] = to_class(FleetStartResult, self.fleet_start_result) - result["FolderTrustAddParams"] = to_class(FolderTrustAddParams, self.folder_trust_add_params) - result["FolderTrustCheckParams"] = to_class(FolderTrustCheckParams, self.folder_trust_check_params) - result["FolderTrustCheckResult"] = to_class(FolderTrustCheckResult, self.folder_trust_check_result) + result["FolderTrustAddParams"] = to_class( + FolderTrustAddParams, self.folder_trust_add_params + ) + result["FolderTrustCheckParams"] = to_class( + FolderTrustCheckParams, self.folder_trust_check_params + ) + result["FolderTrustCheckResult"] = to_class( + FolderTrustCheckResult, self.folder_trust_check_result + ) result["GhCliAuthInfo"] = to_class(GhCLIAuthInfo, self.gh_cli_auth_info) - result["HandlePendingToolCallRequest"] = to_class(HandlePendingToolCallRequest, self.handle_pending_tool_call_request) - result["HandlePendingToolCallResult"] = to_class(HandlePendingToolCallResult, self.handle_pending_tool_call_result) - result["HistoryAbortManualCompactionResult"] = to_class(HistoryAbortManualCompactionResult, self.history_abort_manual_compaction_result) - result["HistoryCancelBackgroundCompactionResult"] = to_class(HistoryCancelBackgroundCompactionResult, self.history_cancel_background_compaction_result) - result["HistoryCompactContextWindow"] = to_class(HistoryCompactContextWindow, self.history_compact_context_window) - result["HistoryCompactRequest"] = to_class(HistoryCompactRequest, self.history_compact_request) + result["HandlePendingToolCallRequest"] = to_class( + HandlePendingToolCallRequest, self.handle_pending_tool_call_request + ) + result["HandlePendingToolCallResult"] = to_class( + HandlePendingToolCallResult, self.handle_pending_tool_call_result + ) + result["HistoryAbortManualCompactionResult"] = to_class( + HistoryAbortManualCompactionResult, self.history_abort_manual_compaction_result + ) + result["HistoryCancelBackgroundCompactionResult"] = to_class( + HistoryCancelBackgroundCompactionResult, + self.history_cancel_background_compaction_result, + ) + result["HistoryCompactContextWindow"] = to_class( + HistoryCompactContextWindow, self.history_compact_context_window + ) + result["HistoryCompactRequest"] = to_class( + HistoryCompactRequest, self.history_compact_request + ) result["HistoryCompactResult"] = to_class(HistoryCompactResult, self.history_compact_result) - result["HistorySummarizeForHandoffResult"] = to_class(HistorySummarizeForHandoffResult, self.history_summarize_for_handoff_result) - result["HistoryTruncateRequest"] = to_class(HistoryTruncateRequest, self.history_truncate_request) - result["HistoryTruncateResult"] = to_class(HistoryTruncateResult, self.history_truncate_result) + result["HistorySummarizeForHandoffResult"] = to_class( + HistorySummarizeForHandoffResult, self.history_summarize_for_handoff_result + ) + result["HistoryTruncateRequest"] = to_class( + HistoryTruncateRequest, self.history_truncate_request + ) + result["HistoryTruncateResult"] = to_class( + HistoryTruncateResult, self.history_truncate_result + ) result["HMACAuthInfo"] = to_class(HMACAuthInfo, self.hmac_auth_info) result["InstalledPlugin"] = to_class(InstalledPlugin, self.installed_plugin) - result["InstalledPluginSource"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str], self.installed_plugin_source) - result["InstalledPluginSourceGithub"] = to_class(InstalledPluginSourceGithub, self.installed_plugin_source_github) - result["InstalledPluginSourceLocal"] = to_class(InstalledPluginSourceLocal, self.installed_plugin_source_local) - result["InstalledPluginSourceUrl"] = to_class(InstalledPluginSourceURL, self.installed_plugin_source_url) - result["InstructionsGetSourcesResult"] = to_class(InstructionsGetSourcesResult, self.instructions_get_sources_result) + result["InstalledPluginSource"] = from_union( + [lambda x: to_class(InstalledPluginSource, x), from_str], self.installed_plugin_source + ) + result["InstalledPluginSourceGithub"] = to_class( + InstalledPluginSourceGithub, self.installed_plugin_source_github + ) + result["InstalledPluginSourceLocal"] = to_class( + InstalledPluginSourceLocal, self.installed_plugin_source_local + ) + result["InstalledPluginSourceUrl"] = to_class( + InstalledPluginSourceURL, self.installed_plugin_source_url + ) + result["InstructionsGetSourcesResult"] = to_class( + InstructionsGetSourcesResult, self.instructions_get_sources_result + ) result["InstructionsSources"] = to_class(InstructionsSources, self.instructions_sources) - result["InstructionsSourcesLocation"] = to_enum(InstructionsSourcesLocation, self.instructions_sources_location) - result["InstructionsSourcesType"] = to_enum(InstructionsSourcesType, self.instructions_sources_type) + result["InstructionsSourcesLocation"] = to_enum( + InstructionsSourcesLocation, self.instructions_sources_location + ) + result["InstructionsSourcesType"] = to_enum( + InstructionsSourcesType, self.instructions_sources_type + ) result["LogRequest"] = to_class(LogRequest, self.log_request) result["LogResult"] = to_class(LogResult, self.log_result) result["LspInitializeRequest"] = to_class(LspInitializeRequest, self.lsp_initialize_request) - result["McpAppsCallToolRequest"] = to_class(MCPAppsCallToolRequest, self.mcp_apps_call_tool_request) - result["McpAppsDiagnoseCapability"] = to_class(MCPAppsDiagnoseCapability, self.mcp_apps_diagnose_capability) - result["McpAppsDiagnoseRequest"] = to_class(MCPAppsDiagnoseRequest, self.mcp_apps_diagnose_request) - result["McpAppsDiagnoseResult"] = to_class(MCPAppsDiagnoseResult, self.mcp_apps_diagnose_result) - result["McpAppsDiagnoseServer"] = to_class(MCPAppsDiagnoseServer, self.mcp_apps_diagnose_server) + result["McpAppsCallToolRequest"] = to_class( + MCPAppsCallToolRequest, self.mcp_apps_call_tool_request + ) + result["McpAppsDiagnoseCapability"] = to_class( + MCPAppsDiagnoseCapability, self.mcp_apps_diagnose_capability + ) + result["McpAppsDiagnoseRequest"] = to_class( + MCPAppsDiagnoseRequest, self.mcp_apps_diagnose_request + ) + result["McpAppsDiagnoseResult"] = to_class( + MCPAppsDiagnoseResult, self.mcp_apps_diagnose_result + ) + result["McpAppsDiagnoseServer"] = to_class( + MCPAppsDiagnoseServer, self.mcp_apps_diagnose_server + ) result["McpAppsHostContext"] = to_class(MCPAppsHostContext, self.mcp_apps_host_context) - result["McpAppsHostContextDetails"] = to_class(MCPAppsHostContextDetails, self.mcp_apps_host_context_details) - result["McpAppsHostContextDetailsAvailableDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_host_context_details_available_display_mode) - result["McpAppsHostContextDetailsDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_host_context_details_display_mode) - result["McpAppsHostContextDetailsPlatform"] = to_enum(MCPAppsHostContextDetailsPlatform, self.mcp_apps_host_context_details_platform) - result["McpAppsHostContextDetailsTheme"] = to_enum(Theme, self.mcp_apps_host_context_details_theme) - result["McpAppsListToolsRequest"] = to_class(MCPAppsListToolsRequest, self.mcp_apps_list_tools_request) - result["McpAppsListToolsResult"] = to_class(MCPAppsListToolsResult, self.mcp_apps_list_tools_result) - result["McpAppsReadResourceRequest"] = to_class(MCPAppsReadResourceRequest, self.mcp_apps_read_resource_request) - result["McpAppsReadResourceResult"] = to_class(MCPAppsReadResourceResult, self.mcp_apps_read_resource_result) - result["McpAppsResourceContent"] = to_class(MCPAppsResourceContent, self.mcp_apps_resource_content) - result["McpAppsSetHostContextDetails"] = to_class(MCPAppsSetHostContextDetails, self.mcp_apps_set_host_context_details) - result["McpAppsSetHostContextDetailsAvailableDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_available_display_mode) - result["McpAppsSetHostContextDetailsDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_display_mode) - result["McpAppsSetHostContextDetailsPlatform"] = to_enum(MCPAppsHostContextDetailsPlatform, self.mcp_apps_set_host_context_details_platform) - result["McpAppsSetHostContextDetailsTheme"] = to_enum(Theme, self.mcp_apps_set_host_context_details_theme) - result["McpAppsSetHostContextRequest"] = to_class(MCPAppsSetHostContextRequest, self.mcp_apps_set_host_context_request) - result["McpCancelSamplingExecutionParams"] = to_class(MCPCancelSamplingExecutionParams, self.mcp_cancel_sampling_execution_params) - result["McpCancelSamplingExecutionResult"] = to_class(MCPCancelSamplingExecutionResult, self.mcp_cancel_sampling_execution_result) + result["McpAppsHostContextDetails"] = to_class( + MCPAppsHostContextDetails, self.mcp_apps_host_context_details + ) + result["McpAppsHostContextDetailsAvailableDisplayMode"] = to_enum( + MCPAppsDisplayMode, self.mcp_apps_host_context_details_available_display_mode + ) + result["McpAppsHostContextDetailsDisplayMode"] = to_enum( + MCPAppsDisplayMode, self.mcp_apps_host_context_details_display_mode + ) + result["McpAppsHostContextDetailsPlatform"] = to_enum( + MCPAppsHostContextDetailsPlatform, self.mcp_apps_host_context_details_platform + ) + result["McpAppsHostContextDetailsTheme"] = to_enum( + Theme, self.mcp_apps_host_context_details_theme + ) + result["McpAppsListToolsRequest"] = to_class( + MCPAppsListToolsRequest, self.mcp_apps_list_tools_request + ) + result["McpAppsListToolsResult"] = to_class( + MCPAppsListToolsResult, self.mcp_apps_list_tools_result + ) + result["McpAppsReadResourceRequest"] = to_class( + MCPAppsReadResourceRequest, self.mcp_apps_read_resource_request + ) + result["McpAppsReadResourceResult"] = to_class( + MCPAppsReadResourceResult, self.mcp_apps_read_resource_result + ) + result["McpAppsResourceContent"] = to_class( + MCPAppsResourceContent, self.mcp_apps_resource_content + ) + result["McpAppsSetHostContextDetails"] = to_class( + MCPAppsSetHostContextDetails, self.mcp_apps_set_host_context_details + ) + result["McpAppsSetHostContextDetailsAvailableDisplayMode"] = to_enum( + MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_available_display_mode + ) + result["McpAppsSetHostContextDetailsDisplayMode"] = to_enum( + MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_display_mode + ) + result["McpAppsSetHostContextDetailsPlatform"] = to_enum( + MCPAppsHostContextDetailsPlatform, self.mcp_apps_set_host_context_details_platform + ) + result["McpAppsSetHostContextDetailsTheme"] = to_enum( + Theme, self.mcp_apps_set_host_context_details_theme + ) + result["McpAppsSetHostContextRequest"] = to_class( + MCPAppsSetHostContextRequest, self.mcp_apps_set_host_context_request + ) + result["McpCancelSamplingExecutionParams"] = to_class( + MCPCancelSamplingExecutionParams, self.mcp_cancel_sampling_execution_params + ) + result["McpCancelSamplingExecutionResult"] = to_class( + MCPCancelSamplingExecutionResult, self.mcp_cancel_sampling_execution_result + ) result["McpConfigAddRequest"] = to_class(MCPConfigAddRequest, self.mcp_config_add_request) - result["McpConfigDisableRequest"] = to_class(MCPConfigDisableRequest, self.mcp_config_disable_request) - result["McpConfigEnableRequest"] = to_class(MCPConfigEnableRequest, self.mcp_config_enable_request) + result["McpConfigDisableRequest"] = to_class( + MCPConfigDisableRequest, self.mcp_config_disable_request + ) + result["McpConfigEnableRequest"] = to_class( + MCPConfigEnableRequest, self.mcp_config_enable_request + ) result["McpConfigList"] = to_class(MCPConfigList, self.mcp_config_list) - result["McpConfigRemoveRequest"] = to_class(MCPConfigRemoveRequest, self.mcp_config_remove_request) - result["McpConfigUpdateRequest"] = to_class(MCPConfigUpdateRequest, self.mcp_config_update_request) + result["McpConfigRemoveRequest"] = to_class( + MCPConfigRemoveRequest, self.mcp_config_remove_request + ) + result["McpConfigUpdateRequest"] = to_class( + MCPConfigUpdateRequest, self.mcp_config_update_request + ) result["McpDisableRequest"] = to_class(MCPDisableRequest, self.mcp_disable_request) result["McpDiscoverRequest"] = to_class(MCPDiscoverRequest, self.mcp_discover_request) result["McpDiscoverResult"] = to_class(MCPDiscoverResult, self.mcp_discover_result) result["McpEnableRequest"] = to_class(MCPEnableRequest, self.mcp_enable_request) - result["McpExecuteSamplingParams"] = to_class(MCPExecuteSamplingParams, self.mcp_execute_sampling_params) - result["McpExecuteSamplingRequest"] = from_dict(lambda x: x, self.mcp_execute_sampling_request) - result["McpExecuteSamplingResult"] = from_dict(lambda x: x, self.mcp_execute_sampling_result) - result["McpOauthLoginRequest"] = to_class(MCPOauthLoginRequest, self.mcp_oauth_login_request) + result["McpExecuteSamplingParams"] = to_class( + MCPExecuteSamplingParams, self.mcp_execute_sampling_params + ) + result["McpExecuteSamplingRequest"] = from_dict( + lambda x: x, self.mcp_execute_sampling_request + ) + result["McpExecuteSamplingResult"] = from_dict( + lambda x: x, self.mcp_execute_sampling_result + ) + result["McpOauthLoginRequest"] = to_class( + MCPOauthLoginRequest, self.mcp_oauth_login_request + ) result["McpOauthLoginResult"] = to_class(MCPOauthLoginResult, self.mcp_oauth_login_result) - result["McpRemoveGitHubResult"] = to_class(MCPRemoveGitHubResult, self.mcp_remove_git_hub_result) - result["McpSamplingExecutionAction"] = to_enum(MCPSamplingExecutionAction, self.mcp_sampling_execution_action) - result["McpSamplingExecutionResult"] = to_class(MCPSamplingExecutionResult, self.mcp_sampling_execution_result) + result["McpRemoveGitHubResult"] = to_class( + MCPRemoveGitHubResult, self.mcp_remove_git_hub_result + ) + result["McpSamplingExecutionAction"] = to_enum( + MCPSamplingExecutionAction, self.mcp_sampling_execution_action + ) + result["McpSamplingExecutionResult"] = to_class( + MCPSamplingExecutionResult, self.mcp_sampling_execution_result + ) result["McpServer"] = to_class(MCPServer, self.mcp_server) result["McpServerConfig"] = to_class(MCPServerConfig, self.mcp_server_config) result["McpServerConfigHttp"] = to_class(MCPServerConfigHTTP, self.mcp_server_config_http) - result["McpServerConfigHttpAuth"] = to_class(MCPServerConfigHTTPAuth, self.mcp_server_config_http_auth) - result["McpServerConfigHttpOauthGrantType"] = to_enum(MCPServerConfigHTTPOauthGrantType, self.mcp_server_config_http_oauth_grant_type) - result["McpServerConfigHttpType"] = to_enum(MCPServerConfigHTTPType, self.mcp_server_config_http_type) - result["McpServerConfigStdio"] = to_class(MCPServerConfigStdio, self.mcp_server_config_stdio) + result["McpServerConfigHttpAuth"] = to_class( + MCPServerConfigHTTPAuth, self.mcp_server_config_http_auth + ) + result["McpServerConfigHttpOauthGrantType"] = to_enum( + MCPServerConfigHTTPOauthGrantType, self.mcp_server_config_http_oauth_grant_type + ) + result["McpServerConfigHttpType"] = to_enum( + MCPServerConfigHTTPType, self.mcp_server_config_http_type + ) + result["McpServerConfigStdio"] = to_class( + MCPServerConfigStdio, self.mcp_server_config_stdio + ) result["McpServerList"] = to_class(MCPServerList, self.mcp_server_list) - result["McpSetEnvValueModeDetails"] = to_enum(MCPSetEnvValueModeDetails, self.mcp_set_env_value_mode_details) - result["McpSetEnvValueModeParams"] = to_class(MCPSetEnvValueModeParams, self.mcp_set_env_value_mode_params) - result["McpSetEnvValueModeResult"] = to_class(MCPSetEnvValueModeResult, self.mcp_set_env_value_mode_result) - result["MetadataContextInfoRequest"] = to_class(MetadataContextInfoRequest, self.metadata_context_info_request) - result["MetadataContextInfoResult"] = to_class(MetadataContextInfoResult, self.metadata_context_info_result) - result["MetadataIsProcessingResult"] = to_class(MetadataIsProcessingResult, self.metadata_is_processing_result) - result["MetadataRecomputeContextTokensRequest"] = to_class(MetadataRecomputeContextTokensRequest, self.metadata_recompute_context_tokens_request) - result["MetadataRecomputeContextTokensResult"] = to_class(MetadataRecomputeContextTokensResult, self.metadata_recompute_context_tokens_result) - result["MetadataRecordContextChangeRequest"] = to_class(MetadataRecordContextChangeRequest, self.metadata_record_context_change_request) - result["MetadataRecordContextChangeResult"] = to_class(MetadataRecordContextChangeResult, self.metadata_record_context_change_result) - result["MetadataSetWorkingDirectoryRequest"] = to_class(MetadataSetWorkingDirectoryRequest, self.metadata_set_working_directory_request) - result["MetadataSetWorkingDirectoryResult"] = to_class(MetadataSetWorkingDirectoryResult, self.metadata_set_working_directory_result) - result["MetadataSnapshotCurrentMode"] = to_enum(MetadataSnapshotCurrentMode, self.metadata_snapshot_current_mode) - result["MetadataSnapshotRemoteMetadata"] = to_class(MetadataSnapshotRemoteMetadata, self.metadata_snapshot_remote_metadata) - result["MetadataSnapshotRemoteMetadataRepository"] = to_class(MetadataSnapshotRemoteMetadataRepository, self.metadata_snapshot_remote_metadata_repository) - result["MetadataSnapshotRemoteMetadataTaskType"] = to_enum(MetadataSnapshotRemoteMetadataTaskType, self.metadata_snapshot_remote_metadata_task_type) + result["McpSetEnvValueModeDetails"] = to_enum( + MCPSetEnvValueModeDetails, self.mcp_set_env_value_mode_details + ) + result["McpSetEnvValueModeParams"] = to_class( + MCPSetEnvValueModeParams, self.mcp_set_env_value_mode_params + ) + result["McpSetEnvValueModeResult"] = to_class( + MCPSetEnvValueModeResult, self.mcp_set_env_value_mode_result + ) + result["MetadataContextInfoRequest"] = to_class( + MetadataContextInfoRequest, self.metadata_context_info_request + ) + result["MetadataContextInfoResult"] = to_class( + MetadataContextInfoResult, self.metadata_context_info_result + ) + result["MetadataIsProcessingResult"] = to_class( + MetadataIsProcessingResult, self.metadata_is_processing_result + ) + result["MetadataRecomputeContextTokensRequest"] = to_class( + MetadataRecomputeContextTokensRequest, self.metadata_recompute_context_tokens_request + ) + result["MetadataRecomputeContextTokensResult"] = to_class( + MetadataRecomputeContextTokensResult, self.metadata_recompute_context_tokens_result + ) + result["MetadataRecordContextChangeRequest"] = to_class( + MetadataRecordContextChangeRequest, self.metadata_record_context_change_request + ) + result["MetadataRecordContextChangeResult"] = to_class( + MetadataRecordContextChangeResult, self.metadata_record_context_change_result + ) + result["MetadataSetWorkingDirectoryRequest"] = to_class( + MetadataSetWorkingDirectoryRequest, self.metadata_set_working_directory_request + ) + result["MetadataSetWorkingDirectoryResult"] = to_class( + MetadataSetWorkingDirectoryResult, self.metadata_set_working_directory_result + ) + result["MetadataSnapshotCurrentMode"] = to_enum( + MetadataSnapshotCurrentMode, self.metadata_snapshot_current_mode + ) + result["MetadataSnapshotRemoteMetadata"] = to_class( + MetadataSnapshotRemoteMetadata, self.metadata_snapshot_remote_metadata + ) + result["MetadataSnapshotRemoteMetadataRepository"] = to_class( + MetadataSnapshotRemoteMetadataRepository, + self.metadata_snapshot_remote_metadata_repository, + ) + result["MetadataSnapshotRemoteMetadataTaskType"] = to_enum( + MetadataSnapshotRemoteMetadataTaskType, self.metadata_snapshot_remote_metadata_task_type + ) result["Model"] = to_class(Model, self.model) result["ModelBilling"] = to_class(ModelBilling, self.model_billing) - result["ModelBillingTokenPrices"] = to_class(ModelBillingTokenPrices, self.model_billing_token_prices) - result["ModelBillingTokenPricesLongContext"] = to_class(ModelBillingTokenPricesLongContext, self.model_billing_token_prices_long_context) + result["ModelBillingTokenPrices"] = to_class( + ModelBillingTokenPrices, self.model_billing_token_prices + ) + result["ModelBillingTokenPricesLongContext"] = to_class( + ModelBillingTokenPricesLongContext, self.model_billing_token_prices_long_context + ) result["ModelCapabilities"] = to_class(ModelCapabilities, self.model_capabilities) - result["ModelCapabilitiesLimits"] = to_class(ModelCapabilitiesLimits, self.model_capabilities_limits) - result["ModelCapabilitiesLimitsVision"] = to_class(ModelCapabilitiesLimitsVision, self.model_capabilities_limits_vision) - result["ModelCapabilitiesOverride"] = to_class(ModelCapabilitiesOverride, self.model_capabilities_override) - result["ModelCapabilitiesOverrideLimits"] = to_class(ModelCapabilitiesOverrideLimits, self.model_capabilities_override_limits) - result["ModelCapabilitiesOverrideLimitsVision"] = to_class(ModelCapabilitiesOverrideLimitsVision, self.model_capabilities_override_limits_vision) - result["ModelCapabilitiesOverrideSupports"] = to_class(ModelCapabilitiesOverrideSupports, self.model_capabilities_override_supports) - result["ModelCapabilitiesSupports"] = to_class(ModelCapabilitiesSupports, self.model_capabilities_supports) + result["ModelCapabilitiesLimits"] = to_class( + ModelCapabilitiesLimits, self.model_capabilities_limits + ) + result["ModelCapabilitiesLimitsVision"] = to_class( + ModelCapabilitiesLimitsVision, self.model_capabilities_limits_vision + ) + result["ModelCapabilitiesOverride"] = to_class( + ModelCapabilitiesOverride, self.model_capabilities_override + ) + result["ModelCapabilitiesOverrideLimits"] = to_class( + ModelCapabilitiesOverrideLimits, self.model_capabilities_override_limits + ) + result["ModelCapabilitiesOverrideLimitsVision"] = to_class( + ModelCapabilitiesOverrideLimitsVision, self.model_capabilities_override_limits_vision + ) + result["ModelCapabilitiesOverrideSupports"] = to_class( + ModelCapabilitiesOverrideSupports, self.model_capabilities_override_supports + ) + result["ModelCapabilitiesSupports"] = to_class( + ModelCapabilitiesSupports, self.model_capabilities_supports + ) result["ModelList"] = to_class(ModelList, self.model_list) result["ModelPickerCategory"] = to_enum(ModelPickerCategory, self.model_picker_category) - result["ModelPickerPriceCategory"] = to_enum(ModelPickerPriceCategory, self.model_picker_price_category) + result["ModelPickerPriceCategory"] = to_enum( + ModelPickerPriceCategory, self.model_picker_price_category + ) result["ModelPolicy"] = to_class(ModelPolicy, self.model_policy) result["ModelPolicyState"] = to_enum(ModelPolicyState, self.model_policy_state) - result["ModelSetReasoningEffortRequest"] = to_class(ModelSetReasoningEffortRequest, self.model_set_reasoning_effort_request) - result["ModelSetReasoningEffortResult"] = to_class(ModelSetReasoningEffortResult, self.model_set_reasoning_effort_result) + result["ModelSetReasoningEffortRequest"] = to_class( + ModelSetReasoningEffortRequest, self.model_set_reasoning_effort_request + ) + result["ModelSetReasoningEffortResult"] = to_class( + ModelSetReasoningEffortResult, self.model_set_reasoning_effort_result + ) result["ModelsListRequest"] = to_class(ModelsListRequest, self.models_list_request) - result["ModelSwitchToRequest"] = to_class(ModelSwitchToRequest, self.model_switch_to_request) + result["ModelSwitchToRequest"] = to_class( + ModelSwitchToRequest, self.model_switch_to_request + ) result["ModelSwitchToResult"] = to_class(ModelSwitchToResult, self.model_switch_to_result) result["ModeSetRequest"] = to_class(ModeSetRequest, self.mode_set_request) result["NameGetResult"] = to_class(NameGetResult, self.name_get_result) @@ -15907,99 +19851,317 @@ def to_dict(self) -> dict: result["NameSetAutoResult"] = to_class(NameSetAutoResult, self.name_set_auto_result) result["NameSetRequest"] = to_class(NameSetRequest, self.name_set_request) result["OpenCanvasInstance"] = to_class(OpenCanvasInstance, self.open_canvas_instance) - result["OptionsUpdateEnvValueMode"] = to_enum(MCPSetEnvValueModeDetails, self.options_update_env_value_mode) - result["PendingPermissionRequest"] = to_class(PendingPermissionRequest, self.pending_permission_request) - result["PendingPermissionRequestList"] = to_class(PendingPermissionRequestList, self.pending_permission_request_list) + result["OptionsUpdateEnvValueMode"] = to_enum( + MCPSetEnvValueModeDetails, self.options_update_env_value_mode + ) + result["PendingPermissionRequest"] = to_class( + PendingPermissionRequest, self.pending_permission_request + ) + result["PendingPermissionRequestList"] = to_class( + PendingPermissionRequestList, self.pending_permission_request_list + ) result["PermissionDecision"] = (self.permission_decision).to_dict() - result["PermissionDecisionApproved"] = to_class(PermissionDecisionApproved, self.permission_decision_approved) - result["PermissionDecisionApprovedForLocation"] = to_class(PermissionDecisionApprovedForLocation, self.permission_decision_approved_for_location) - result["PermissionDecisionApprovedForSession"] = to_class(PermissionDecisionApprovedForSession, self.permission_decision_approved_for_session) - result["PermissionDecisionApproveForLocation"] = to_class(PermissionDecisionApproveForLocation, self.permission_decision_approve_for_location) - result["PermissionDecisionApproveForLocationApproval"] = (self.permission_decision_approve_for_location_approval).to_dict() - result["PermissionDecisionApproveForLocationApprovalCommands"] = to_class(PermissionDecisionApproveForLocationApprovalCommands, self.permission_decision_approve_for_location_approval_commands) - result["PermissionDecisionApproveForLocationApprovalCustomTool"] = to_class(PermissionDecisionApproveForLocationApprovalCustomTool, self.permission_decision_approve_for_location_approval_custom_tool) - result["PermissionDecisionApproveForLocationApprovalExtensionManagement"] = to_class(PermissionDecisionApproveForLocationApprovalExtensionManagement, self.permission_decision_approve_for_location_approval_extension_management) - result["PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess"] = to_class(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess, self.permission_decision_approve_for_location_approval_extension_permission_access) - result["PermissionDecisionApproveForLocationApprovalMcp"] = to_class(PermissionDecisionApproveForLocationApprovalMCP, self.permission_decision_approve_for_location_approval_mcp) - result["PermissionDecisionApproveForLocationApprovalMcpSampling"] = to_class(PermissionDecisionApproveForLocationApprovalMCPSampling, self.permission_decision_approve_for_location_approval_mcp_sampling) - result["PermissionDecisionApproveForLocationApprovalMemory"] = to_class(PermissionDecisionApproveForLocationApprovalMemory, self.permission_decision_approve_for_location_approval_memory) - result["PermissionDecisionApproveForLocationApprovalRead"] = to_class(PermissionDecisionApproveForLocationApprovalRead, self.permission_decision_approve_for_location_approval_read) - result["PermissionDecisionApproveForLocationApprovalWrite"] = to_class(PermissionDecisionApproveForLocationApprovalWrite, self.permission_decision_approve_for_location_approval_write) - result["PermissionDecisionApproveForSession"] = to_class(PermissionDecisionApproveForSession, self.permission_decision_approve_for_session) - result["PermissionDecisionApproveForSessionApproval"] = (self.permission_decision_approve_for_session_approval).to_dict() - result["PermissionDecisionApproveForSessionApprovalCommands"] = to_class(PermissionDecisionApproveForSessionApprovalCommands, self.permission_decision_approve_for_session_approval_commands) - result["PermissionDecisionApproveForSessionApprovalCustomTool"] = to_class(PermissionDecisionApproveForSessionApprovalCustomTool, self.permission_decision_approve_for_session_approval_custom_tool) - result["PermissionDecisionApproveForSessionApprovalExtensionManagement"] = to_class(PermissionDecisionApproveForSessionApprovalExtensionManagement, self.permission_decision_approve_for_session_approval_extension_management) - result["PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess"] = to_class(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess, self.permission_decision_approve_for_session_approval_extension_permission_access) - result["PermissionDecisionApproveForSessionApprovalMcp"] = to_class(PermissionDecisionApproveForSessionApprovalMCP, self.permission_decision_approve_for_session_approval_mcp) - result["PermissionDecisionApproveForSessionApprovalMcpSampling"] = to_class(PermissionDecisionApproveForSessionApprovalMCPSampling, self.permission_decision_approve_for_session_approval_mcp_sampling) - result["PermissionDecisionApproveForSessionApprovalMemory"] = to_class(PermissionDecisionApproveForSessionApprovalMemory, self.permission_decision_approve_for_session_approval_memory) - result["PermissionDecisionApproveForSessionApprovalRead"] = to_class(PermissionDecisionApproveForSessionApprovalRead, self.permission_decision_approve_for_session_approval_read) - result["PermissionDecisionApproveForSessionApprovalWrite"] = to_class(PermissionDecisionApproveForSessionApprovalWrite, self.permission_decision_approve_for_session_approval_write) - result["PermissionDecisionApproveOnce"] = to_class(PermissionDecisionApproveOnce, self.permission_decision_approve_once) - result["PermissionDecisionApprovePermanently"] = to_class(PermissionDecisionApprovePermanently, self.permission_decision_approve_permanently) - result["PermissionDecisionCancelled"] = to_class(PermissionDecisionCancelled, self.permission_decision_cancelled) - result["PermissionDecisionDeniedByContentExclusionPolicy"] = to_class(PermissionDecisionDeniedByContentExclusionPolicy, self.permission_decision_denied_by_content_exclusion_policy) - result["PermissionDecisionDeniedByPermissionRequestHook"] = to_class(PermissionDecisionDeniedByPermissionRequestHook, self.permission_decision_denied_by_permission_request_hook) - result["PermissionDecisionDeniedByRules"] = to_class(PermissionDecisionDeniedByRules, self.permission_decision_denied_by_rules) - result["PermissionDecisionDeniedInteractivelyByUser"] = to_class(PermissionDecisionDeniedInteractivelyByUser, self.permission_decision_denied_interactively_by_user) - result["PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser"] = to_class(PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser, self.permission_decision_denied_no_approval_rule_and_could_not_request_from_user) - result["PermissionDecisionReject"] = to_class(PermissionDecisionReject, self.permission_decision_reject) - result["PermissionDecisionRequest"] = to_class(PermissionDecisionRequest, self.permission_decision_request) - result["PermissionDecisionUserNotAvailable"] = to_class(PermissionDecisionUserNotAvailable, self.permission_decision_user_not_available) - result["PermissionLocationAddToolApprovalParams"] = to_class(PermissionLocationAddToolApprovalParams, self.permission_location_add_tool_approval_params) - result["PermissionLocationApplyParams"] = to_class(PermissionLocationApplyParams, self.permission_location_apply_params) - result["PermissionLocationApplyResult"] = to_class(PermissionLocationApplyResult, self.permission_location_apply_result) - result["PermissionLocationResolveParams"] = to_class(PermissionLocationResolveParams, self.permission_location_resolve_params) - result["PermissionLocationResolveResult"] = to_class(PermissionLocationResolveResult, self.permission_location_resolve_result) - result["PermissionLocationType"] = to_enum(PermissionLocationType, self.permission_location_type) - result["PermissionPathsAddParams"] = to_class(PermissionPathsAddParams, self.permission_paths_add_params) - result["PermissionPathsAllowedCheckParams"] = to_class(PermissionPathsAllowedCheckParams, self.permission_paths_allowed_check_params) - result["PermissionPathsAllowedCheckResult"] = to_class(PermissionPathsAllowedCheckResult, self.permission_paths_allowed_check_result) - result["PermissionPathsConfig"] = to_class(PermissionPathsConfig, self.permission_paths_config) + result["PermissionDecisionApproved"] = to_class( + PermissionDecisionApproved, self.permission_decision_approved + ) + result["PermissionDecisionApprovedForLocation"] = to_class( + PermissionDecisionApprovedForLocation, self.permission_decision_approved_for_location + ) + result["PermissionDecisionApprovedForSession"] = to_class( + PermissionDecisionApprovedForSession, self.permission_decision_approved_for_session + ) + result["PermissionDecisionApproveForLocation"] = to_class( + PermissionDecisionApproveForLocation, self.permission_decision_approve_for_location + ) + result["PermissionDecisionApproveForLocationApproval"] = ( + self.permission_decision_approve_for_location_approval + ).to_dict() + result["PermissionDecisionApproveForLocationApprovalCommands"] = to_class( + PermissionDecisionApproveForLocationApprovalCommands, + self.permission_decision_approve_for_location_approval_commands, + ) + result["PermissionDecisionApproveForLocationApprovalCustomTool"] = to_class( + PermissionDecisionApproveForLocationApprovalCustomTool, + self.permission_decision_approve_for_location_approval_custom_tool, + ) + result["PermissionDecisionApproveForLocationApprovalExtensionManagement"] = to_class( + PermissionDecisionApproveForLocationApprovalExtensionManagement, + self.permission_decision_approve_for_location_approval_extension_management, + ) + result["PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess"] = to_class( + PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess, + self.permission_decision_approve_for_location_approval_extension_permission_access, + ) + result["PermissionDecisionApproveForLocationApprovalMcp"] = to_class( + PermissionDecisionApproveForLocationApprovalMCP, + self.permission_decision_approve_for_location_approval_mcp, + ) + result["PermissionDecisionApproveForLocationApprovalMcpSampling"] = to_class( + PermissionDecisionApproveForLocationApprovalMCPSampling, + self.permission_decision_approve_for_location_approval_mcp_sampling, + ) + result["PermissionDecisionApproveForLocationApprovalMemory"] = to_class( + PermissionDecisionApproveForLocationApprovalMemory, + self.permission_decision_approve_for_location_approval_memory, + ) + result["PermissionDecisionApproveForLocationApprovalRead"] = to_class( + PermissionDecisionApproveForLocationApprovalRead, + self.permission_decision_approve_for_location_approval_read, + ) + result["PermissionDecisionApproveForLocationApprovalWrite"] = to_class( + PermissionDecisionApproveForLocationApprovalWrite, + self.permission_decision_approve_for_location_approval_write, + ) + result["PermissionDecisionApproveForSession"] = to_class( + PermissionDecisionApproveForSession, self.permission_decision_approve_for_session + ) + result["PermissionDecisionApproveForSessionApproval"] = ( + self.permission_decision_approve_for_session_approval + ).to_dict() + result["PermissionDecisionApproveForSessionApprovalCommands"] = to_class( + PermissionDecisionApproveForSessionApprovalCommands, + self.permission_decision_approve_for_session_approval_commands, + ) + result["PermissionDecisionApproveForSessionApprovalCustomTool"] = to_class( + PermissionDecisionApproveForSessionApprovalCustomTool, + self.permission_decision_approve_for_session_approval_custom_tool, + ) + result["PermissionDecisionApproveForSessionApprovalExtensionManagement"] = to_class( + PermissionDecisionApproveForSessionApprovalExtensionManagement, + self.permission_decision_approve_for_session_approval_extension_management, + ) + result["PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess"] = to_class( + PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess, + self.permission_decision_approve_for_session_approval_extension_permission_access, + ) + result["PermissionDecisionApproveForSessionApprovalMcp"] = to_class( + PermissionDecisionApproveForSessionApprovalMCP, + self.permission_decision_approve_for_session_approval_mcp, + ) + result["PermissionDecisionApproveForSessionApprovalMcpSampling"] = to_class( + PermissionDecisionApproveForSessionApprovalMCPSampling, + self.permission_decision_approve_for_session_approval_mcp_sampling, + ) + result["PermissionDecisionApproveForSessionApprovalMemory"] = to_class( + PermissionDecisionApproveForSessionApprovalMemory, + self.permission_decision_approve_for_session_approval_memory, + ) + result["PermissionDecisionApproveForSessionApprovalRead"] = to_class( + PermissionDecisionApproveForSessionApprovalRead, + self.permission_decision_approve_for_session_approval_read, + ) + result["PermissionDecisionApproveForSessionApprovalWrite"] = to_class( + PermissionDecisionApproveForSessionApprovalWrite, + self.permission_decision_approve_for_session_approval_write, + ) + result["PermissionDecisionApproveOnce"] = to_class( + PermissionDecisionApproveOnce, self.permission_decision_approve_once + ) + result["PermissionDecisionApprovePermanently"] = to_class( + PermissionDecisionApprovePermanently, self.permission_decision_approve_permanently + ) + result["PermissionDecisionCancelled"] = to_class( + PermissionDecisionCancelled, self.permission_decision_cancelled + ) + result["PermissionDecisionDeniedByContentExclusionPolicy"] = to_class( + PermissionDecisionDeniedByContentExclusionPolicy, + self.permission_decision_denied_by_content_exclusion_policy, + ) + result["PermissionDecisionDeniedByPermissionRequestHook"] = to_class( + PermissionDecisionDeniedByPermissionRequestHook, + self.permission_decision_denied_by_permission_request_hook, + ) + result["PermissionDecisionDeniedByRules"] = to_class( + PermissionDecisionDeniedByRules, self.permission_decision_denied_by_rules + ) + result["PermissionDecisionDeniedInteractivelyByUser"] = to_class( + PermissionDecisionDeniedInteractivelyByUser, + self.permission_decision_denied_interactively_by_user, + ) + result["PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser"] = to_class( + PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser, + self.permission_decision_denied_no_approval_rule_and_could_not_request_from_user, + ) + result["PermissionDecisionReject"] = to_class( + PermissionDecisionReject, self.permission_decision_reject + ) + result["PermissionDecisionRequest"] = to_class( + PermissionDecisionRequest, self.permission_decision_request + ) + result["PermissionDecisionUserNotAvailable"] = to_class( + PermissionDecisionUserNotAvailable, self.permission_decision_user_not_available + ) + result["PermissionLocationAddToolApprovalParams"] = to_class( + PermissionLocationAddToolApprovalParams, + self.permission_location_add_tool_approval_params, + ) + result["PermissionLocationApplyParams"] = to_class( + PermissionLocationApplyParams, self.permission_location_apply_params + ) + result["PermissionLocationApplyResult"] = to_class( + PermissionLocationApplyResult, self.permission_location_apply_result + ) + result["PermissionLocationResolveParams"] = to_class( + PermissionLocationResolveParams, self.permission_location_resolve_params + ) + result["PermissionLocationResolveResult"] = to_class( + PermissionLocationResolveResult, self.permission_location_resolve_result + ) + result["PermissionLocationType"] = to_enum( + PermissionLocationType, self.permission_location_type + ) + result["PermissionPathsAddParams"] = to_class( + PermissionPathsAddParams, self.permission_paths_add_params + ) + result["PermissionPathsAllowedCheckParams"] = to_class( + PermissionPathsAllowedCheckParams, self.permission_paths_allowed_check_params + ) + result["PermissionPathsAllowedCheckResult"] = to_class( + PermissionPathsAllowedCheckResult, self.permission_paths_allowed_check_result + ) + result["PermissionPathsConfig"] = to_class( + PermissionPathsConfig, self.permission_paths_config + ) result["PermissionPathsList"] = to_class(PermissionPathsList, self.permission_paths_list) - result["PermissionPathsUpdatePrimaryParams"] = to_class(PermissionPathsUpdatePrimaryParams, self.permission_paths_update_primary_params) - result["PermissionPathsWorkspaceCheckParams"] = to_class(PermissionPathsWorkspaceCheckParams, self.permission_paths_workspace_check_params) - result["PermissionPathsWorkspaceCheckResult"] = to_class(PermissionPathsWorkspaceCheckResult, self.permission_paths_workspace_check_result) - result["PermissionPromptShownNotification"] = to_class(PermissionPromptShownNotification, self.permission_prompt_shown_notification) - result["PermissionRequestResult"] = to_class(PermissionRequestResult, self.permission_request_result) + result["PermissionPathsUpdatePrimaryParams"] = to_class( + PermissionPathsUpdatePrimaryParams, self.permission_paths_update_primary_params + ) + result["PermissionPathsWorkspaceCheckParams"] = to_class( + PermissionPathsWorkspaceCheckParams, self.permission_paths_workspace_check_params + ) + result["PermissionPathsWorkspaceCheckResult"] = to_class( + PermissionPathsWorkspaceCheckResult, self.permission_paths_workspace_check_result + ) + result["PermissionPromptShownNotification"] = to_class( + PermissionPromptShownNotification, self.permission_prompt_shown_notification + ) + result["PermissionRequestResult"] = to_class( + PermissionRequestResult, self.permission_request_result + ) result["PermissionRulesSet"] = to_class(PermissionRulesSet, self.permission_rules_set) - result["PermissionsConfigureAdditionalContentExclusionPolicy"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicy, self.permissions_configure_additional_content_exclusion_policy) - result["PermissionsConfigureAdditionalContentExclusionPolicyRule"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, self.permissions_configure_additional_content_exclusion_policy_rule) - result["PermissionsConfigureAdditionalContentExclusionPolicyRuleSource"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.permissions_configure_additional_content_exclusion_policy_rule_source) - result["PermissionsConfigureAdditionalContentExclusionPolicyScope"] = to_enum(PermissionsConfigureAdditionalContentExclusionPolicyScope, self.permissions_configure_additional_content_exclusion_policy_scope) - result["PermissionsConfigureParams"] = to_class(PermissionsConfigureParams, self.permissions_configure_params) - result["PermissionsConfigureResult"] = to_class(PermissionsConfigureResult, self.permissions_configure_result) - result["PermissionsFolderTrustAddTrustedResult"] = to_class(PermissionsFolderTrustAddTrustedResult, self.permissions_folder_trust_add_trusted_result) - result["PermissionsLocationsAddToolApprovalDetails"] = (self.permissions_locations_add_tool_approval_details).to_dict() - result["PermissionsLocationsAddToolApprovalDetailsCommands"] = to_class(PermissionsLocationsAddToolApprovalDetailsCommands, self.permissions_locations_add_tool_approval_details_commands) - result["PermissionsLocationsAddToolApprovalDetailsCustomTool"] = to_class(PermissionsLocationsAddToolApprovalDetailsCustomTool, self.permissions_locations_add_tool_approval_details_custom_tool) - result["PermissionsLocationsAddToolApprovalDetailsExtensionManagement"] = to_class(PermissionsLocationsAddToolApprovalDetailsExtensionManagement, self.permissions_locations_add_tool_approval_details_extension_management) - result["PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess"] = to_class(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess, self.permissions_locations_add_tool_approval_details_extension_permission_access) - result["PermissionsLocationsAddToolApprovalDetailsMcp"] = to_class(PermissionsLocationsAddToolApprovalDetailsMCP, self.permissions_locations_add_tool_approval_details_mcp) - result["PermissionsLocationsAddToolApprovalDetailsMcpSampling"] = to_class(PermissionsLocationsAddToolApprovalDetailsMCPSampling, self.permissions_locations_add_tool_approval_details_mcp_sampling) - result["PermissionsLocationsAddToolApprovalDetailsMemory"] = to_class(PermissionsLocationsAddToolApprovalDetailsMemory, self.permissions_locations_add_tool_approval_details_memory) - result["PermissionsLocationsAddToolApprovalDetailsRead"] = to_class(PermissionsLocationsAddToolApprovalDetailsRead, self.permissions_locations_add_tool_approval_details_read) - result["PermissionsLocationsAddToolApprovalDetailsWrite"] = to_class(PermissionsLocationsAddToolApprovalDetailsWrite, self.permissions_locations_add_tool_approval_details_write) - result["PermissionsLocationsAddToolApprovalResult"] = to_class(PermissionsLocationsAddToolApprovalResult, self.permissions_locations_add_tool_approval_result) - result["PermissionsModifyRulesParams"] = to_class(PermissionsModifyRulesParams, self.permissions_modify_rules_params) - result["PermissionsModifyRulesResult"] = to_class(PermissionsModifyRulesResult, self.permissions_modify_rules_result) - result["PermissionsModifyRulesScope"] = to_enum(PermissionsModifyRulesScope, self.permissions_modify_rules_scope) - result["PermissionsNotifyPromptShownResult"] = to_class(PermissionsNotifyPromptShownResult, self.permissions_notify_prompt_shown_result) - result["PermissionsPathsAddResult"] = to_class(PermissionsPathsAddResult, self.permissions_paths_add_result) - result["PermissionsPathsListRequest"] = to_class(PermissionsPathsListRequest, self.permissions_paths_list_request) - result["PermissionsPathsUpdatePrimaryResult"] = to_class(PermissionsPathsUpdatePrimaryResult, self.permissions_paths_update_primary_result) - result["PermissionsPendingRequestsRequest"] = to_class(PermissionsPendingRequestsRequest, self.permissions_pending_requests_request) - result["PermissionsResetSessionApprovalsRequest"] = to_class(PermissionsResetSessionApprovalsRequest, self.permissions_reset_session_approvals_request) - result["PermissionsResetSessionApprovalsResult"] = to_class(PermissionsResetSessionApprovalsResult, self.permissions_reset_session_approvals_result) - result["PermissionsSetApproveAllRequest"] = to_class(PermissionsSetApproveAllRequest, self.permissions_set_approve_all_request) - result["PermissionsSetApproveAllResult"] = to_class(PermissionsSetApproveAllResult, self.permissions_set_approve_all_result) - result["PermissionsSetApproveAllSource"] = to_enum(PermissionsSetApproveAllSource, self.permissions_set_approve_all_source) - result["PermissionsSetRequiredRequest"] = to_class(PermissionsSetRequiredRequest, self.permissions_set_required_request) - result["PermissionsSetRequiredResult"] = to_class(PermissionsSetRequiredResult, self.permissions_set_required_result) - result["PermissionsUrlsSetUnrestrictedModeResult"] = to_class(PermissionsUrlsSetUnrestrictedModeResult, self.permissions_urls_set_unrestricted_mode_result) + result["PermissionsConfigureAdditionalContentExclusionPolicy"] = to_class( + PermissionsConfigureAdditionalContentExclusionPolicy, + self.permissions_configure_additional_content_exclusion_policy, + ) + result["PermissionsConfigureAdditionalContentExclusionPolicyRule"] = to_class( + PermissionsConfigureAdditionalContentExclusionPolicyRule, + self.permissions_configure_additional_content_exclusion_policy_rule, + ) + result["PermissionsConfigureAdditionalContentExclusionPolicyRuleSource"] = to_class( + PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, + self.permissions_configure_additional_content_exclusion_policy_rule_source, + ) + result["PermissionsConfigureAdditionalContentExclusionPolicyScope"] = to_enum( + PermissionsConfigureAdditionalContentExclusionPolicyScope, + self.permissions_configure_additional_content_exclusion_policy_scope, + ) + result["PermissionsConfigureParams"] = to_class( + PermissionsConfigureParams, self.permissions_configure_params + ) + result["PermissionsConfigureResult"] = to_class( + PermissionsConfigureResult, self.permissions_configure_result + ) + result["PermissionsFolderTrustAddTrustedResult"] = to_class( + PermissionsFolderTrustAddTrustedResult, self.permissions_folder_trust_add_trusted_result + ) + result["PermissionsLocationsAddToolApprovalDetails"] = ( + self.permissions_locations_add_tool_approval_details + ).to_dict() + result["PermissionsLocationsAddToolApprovalDetailsCommands"] = to_class( + PermissionsLocationsAddToolApprovalDetailsCommands, + self.permissions_locations_add_tool_approval_details_commands, + ) + result["PermissionsLocationsAddToolApprovalDetailsCustomTool"] = to_class( + PermissionsLocationsAddToolApprovalDetailsCustomTool, + self.permissions_locations_add_tool_approval_details_custom_tool, + ) + result["PermissionsLocationsAddToolApprovalDetailsExtensionManagement"] = to_class( + PermissionsLocationsAddToolApprovalDetailsExtensionManagement, + self.permissions_locations_add_tool_approval_details_extension_management, + ) + result["PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess"] = to_class( + PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess, + self.permissions_locations_add_tool_approval_details_extension_permission_access, + ) + result["PermissionsLocationsAddToolApprovalDetailsMcp"] = to_class( + PermissionsLocationsAddToolApprovalDetailsMCP, + self.permissions_locations_add_tool_approval_details_mcp, + ) + result["PermissionsLocationsAddToolApprovalDetailsMcpSampling"] = to_class( + PermissionsLocationsAddToolApprovalDetailsMCPSampling, + self.permissions_locations_add_tool_approval_details_mcp_sampling, + ) + result["PermissionsLocationsAddToolApprovalDetailsMemory"] = to_class( + PermissionsLocationsAddToolApprovalDetailsMemory, + self.permissions_locations_add_tool_approval_details_memory, + ) + result["PermissionsLocationsAddToolApprovalDetailsRead"] = to_class( + PermissionsLocationsAddToolApprovalDetailsRead, + self.permissions_locations_add_tool_approval_details_read, + ) + result["PermissionsLocationsAddToolApprovalDetailsWrite"] = to_class( + PermissionsLocationsAddToolApprovalDetailsWrite, + self.permissions_locations_add_tool_approval_details_write, + ) + result["PermissionsLocationsAddToolApprovalResult"] = to_class( + PermissionsLocationsAddToolApprovalResult, + self.permissions_locations_add_tool_approval_result, + ) + result["PermissionsModifyRulesParams"] = to_class( + PermissionsModifyRulesParams, self.permissions_modify_rules_params + ) + result["PermissionsModifyRulesResult"] = to_class( + PermissionsModifyRulesResult, self.permissions_modify_rules_result + ) + result["PermissionsModifyRulesScope"] = to_enum( + PermissionsModifyRulesScope, self.permissions_modify_rules_scope + ) + result["PermissionsNotifyPromptShownResult"] = to_class( + PermissionsNotifyPromptShownResult, self.permissions_notify_prompt_shown_result + ) + result["PermissionsPathsAddResult"] = to_class( + PermissionsPathsAddResult, self.permissions_paths_add_result + ) + result["PermissionsPathsListRequest"] = to_class( + PermissionsPathsListRequest, self.permissions_paths_list_request + ) + result["PermissionsPathsUpdatePrimaryResult"] = to_class( + PermissionsPathsUpdatePrimaryResult, self.permissions_paths_update_primary_result + ) + result["PermissionsPendingRequestsRequest"] = to_class( + PermissionsPendingRequestsRequest, self.permissions_pending_requests_request + ) + result["PermissionsResetSessionApprovalsRequest"] = to_class( + PermissionsResetSessionApprovalsRequest, + self.permissions_reset_session_approvals_request, + ) + result["PermissionsResetSessionApprovalsResult"] = to_class( + PermissionsResetSessionApprovalsResult, self.permissions_reset_session_approvals_result + ) + result["PermissionsSetApproveAllRequest"] = to_class( + PermissionsSetApproveAllRequest, self.permissions_set_approve_all_request + ) + result["PermissionsSetApproveAllResult"] = to_class( + PermissionsSetApproveAllResult, self.permissions_set_approve_all_result + ) + result["PermissionsSetApproveAllSource"] = to_enum( + PermissionsSetApproveAllSource, self.permissions_set_approve_all_source + ) + result["PermissionsSetRequiredRequest"] = to_class( + PermissionsSetRequiredRequest, self.permissions_set_required_request + ) + result["PermissionsSetRequiredResult"] = to_class( + PermissionsSetRequiredResult, self.permissions_set_required_result + ) + result["PermissionsUrlsSetUnrestrictedModeResult"] = to_class( + PermissionsUrlsSetUnrestrictedModeResult, + self.permissions_urls_set_unrestricted_mode_result, + ) result["PermissionUrlsConfig"] = to_class(PermissionUrlsConfig, self.permission_urls_config) - result["PermissionUrlsSetUnrestrictedModeParams"] = to_class(PermissionUrlsSetUnrestrictedModeParams, self.permission_urls_set_unrestricted_mode_params) + result["PermissionUrlsSetUnrestrictedModeParams"] = to_class( + PermissionUrlsSetUnrestrictedModeParams, + self.permission_urls_set_unrestricted_mode_params, + ) result["PingRequest"] = to_class(PingRequest, self.ping_request) result["PingResult"] = to_class(PingResult, self.ping_result) result["PlanReadResult"] = to_class(PlanReadResult, self.plan_read_result) @@ -16007,127 +20169,294 @@ def to_dict(self) -> dict: result["Plugin"] = to_class(Plugin, self.plugin) result["PluginList"] = to_class(PluginList, self.plugin_list) result["QueuedCommandHandled"] = to_class(QueuedCommandHandled, self.queued_command_handled) - result["QueuedCommandNotHandled"] = to_class(QueuedCommandNotHandled, self.queued_command_not_handled) + result["QueuedCommandNotHandled"] = to_class( + QueuedCommandNotHandled, self.queued_command_not_handled + ) result["QueuedCommandResult"] = (self.queued_command_result).to_dict() result["QueuePendingItems"] = to_class(QueuePendingItems, self.queue_pending_items) - result["QueuePendingItemsKind"] = to_enum(QueuePendingItemsKind, self.queue_pending_items_kind) - result["QueuePendingItemsResult"] = to_class(QueuePendingItemsResult, self.queue_pending_items_result) - result["QueueRemoveMostRecentResult"] = to_class(QueueRemoveMostRecentResult, self.queue_remove_most_recent_result) - result["RegisterEventInterestParams"] = to_class(RegisterEventInterestParams, self.register_event_interest_params) - result["RegisterEventInterestResult"] = to_class(RegisterEventInterestResult, self.register_event_interest_result) - result["ReleaseEventInterestParams"] = to_class(ReleaseEventInterestParams, self.release_event_interest_params) + result["QueuePendingItemsKind"] = to_enum( + QueuePendingItemsKind, self.queue_pending_items_kind + ) + result["QueuePendingItemsResult"] = to_class( + QueuePendingItemsResult, self.queue_pending_items_result + ) + result["QueueRemoveMostRecentResult"] = to_class( + QueueRemoveMostRecentResult, self.queue_remove_most_recent_result + ) + result["RegisterEventInterestParams"] = to_class( + RegisterEventInterestParams, self.register_event_interest_params + ) + result["RegisterEventInterestResult"] = to_class( + RegisterEventInterestResult, self.register_event_interest_result + ) + result["ReleaseEventInterestParams"] = to_class( + ReleaseEventInterestParams, self.release_event_interest_params + ) result["RemoteEnableRequest"] = to_class(RemoteEnableRequest, self.remote_enable_request) result["RemoteEnableResult"] = to_class(RemoteEnableResult, self.remote_enable_result) - result["RemoteNotifySteerableChangedRequest"] = to_class(RemoteNotifySteerableChangedRequest, self.remote_notify_steerable_changed_request) - result["RemoteNotifySteerableChangedResult"] = to_class(RemoteNotifySteerableChangedResult, self.remote_notify_steerable_changed_result) - result["RemoteSessionConnectionResult"] = to_class(RemoteSessionConnectionResult, self.remote_session_connection_result) + result["RemoteNotifySteerableChangedRequest"] = to_class( + RemoteNotifySteerableChangedRequest, self.remote_notify_steerable_changed_request + ) + result["RemoteNotifySteerableChangedResult"] = to_class( + RemoteNotifySteerableChangedResult, self.remote_notify_steerable_changed_result + ) + result["RemoteSessionConnectionResult"] = to_class( + RemoteSessionConnectionResult, self.remote_session_connection_result + ) result["RemoteSessionMode"] = to_enum(RemoteSessionMode, self.remote_session_mode) result["ScheduleEntry"] = to_class(ScheduleEntry, self.schedule_entry) result["ScheduleList"] = to_class(ScheduleList, self.schedule_list) result["ScheduleStopRequest"] = to_class(ScheduleStopRequest, self.schedule_stop_request) result["ScheduleStopResult"] = to_class(ScheduleStopResult, self.schedule_stop_result) - result["SecretsAddFilterValuesRequest"] = to_class(SecretsAddFilterValuesRequest, self.secrets_add_filter_values_request) - result["SecretsAddFilterValuesResult"] = to_class(SecretsAddFilterValuesResult, self.secrets_add_filter_values_result) + result["SecretsAddFilterValuesRequest"] = to_class( + SecretsAddFilterValuesRequest, self.secrets_add_filter_values_request + ) + result["SecretsAddFilterValuesResult"] = to_class( + SecretsAddFilterValuesResult, self.secrets_add_filter_values_result + ) result["SendAgentMode"] = to_enum(SendAgentMode, self.send_agent_mode) result["SendAttachment"] = (self.send_attachment).to_dict() result["SendAttachmentBlob"] = to_class(SendAttachmentBlob, self.send_attachment_blob) - result["SendAttachmentDirectory"] = to_class(SendAttachmentDirectory, self.send_attachment_directory) + result["SendAttachmentDirectory"] = to_class( + SendAttachmentDirectory, self.send_attachment_directory + ) result["SendAttachmentFile"] = to_class(SendAttachmentFile, self.send_attachment_file) - result["SendAttachmentFileLineRange"] = to_class(SendAttachmentFileLineRange, self.send_attachment_file_line_range) - result["SendAttachmentGithubReference"] = to_class(SendAttachmentGithubReference, self.send_attachment_github_reference) - result["SendAttachmentGithubReferenceType"] = to_enum(SendAttachmentGithubReferenceTypeEnum, self.send_attachment_github_reference_type) - result["SendAttachmentSelection"] = to_class(SendAttachmentSelection, self.send_attachment_selection) - result["SendAttachmentSelectionDetails"] = to_class(SendAttachmentSelectionDetails, self.send_attachment_selection_details) - result["SendAttachmentSelectionDetailsEnd"] = to_class(SendAttachmentSelectionDetailsEnd, self.send_attachment_selection_details_end) - result["SendAttachmentSelectionDetailsStart"] = to_class(SendAttachmentSelectionDetailsStart, self.send_attachment_selection_details_start) + result["SendAttachmentFileLineRange"] = to_class( + SendAttachmentFileLineRange, self.send_attachment_file_line_range + ) + result["SendAttachmentGithubReference"] = to_class( + SendAttachmentGithubReference, self.send_attachment_github_reference + ) + result["SendAttachmentGithubReferenceType"] = to_enum( + SendAttachmentGithubReferenceTypeEnum, self.send_attachment_github_reference_type + ) + result["SendAttachmentSelection"] = to_class( + SendAttachmentSelection, self.send_attachment_selection + ) + result["SendAttachmentSelectionDetails"] = to_class( + SendAttachmentSelectionDetails, self.send_attachment_selection_details + ) + result["SendAttachmentSelectionDetailsEnd"] = to_class( + SendAttachmentSelectionDetailsEnd, self.send_attachment_selection_details_end + ) + result["SendAttachmentSelectionDetailsStart"] = to_class( + SendAttachmentSelectionDetailsStart, self.send_attachment_selection_details_start + ) result["SendMode"] = to_enum(SendMode, self.send_mode) result["SendRequest"] = to_class(SendRequest, self.send_request) result["SendResult"] = to_class(SendResult, self.send_result) result["ServerSkill"] = to_class(ServerSkill, self.server_skill) result["ServerSkillList"] = to_class(ServerSkillList, self.server_skill_list) result["SessionAuthStatus"] = to_class(SessionAuthStatus, self.session_auth_status) - result["SessionBulkDeleteResult"] = to_class(SessionBulkDeleteResult, self.session_bulk_delete_result) + result["SessionBulkDeleteResult"] = to_class( + SessionBulkDeleteResult, self.session_bulk_delete_result + ) result["SessionContext"] = to_class(SessionContext, self.session_context) result["SessionContextHostType"] = to_enum(HostType, self.session_context_host_type) - result["SessionEnrichMetadataResult"] = to_class(SessionEnrichMetadataResult, self.session_enrich_metadata_result) - result["SessionFsAppendFileRequest"] = to_class(SessionFSAppendFileRequest, self.session_fs_append_file_request) + result["SessionEnrichMetadataResult"] = to_class( + SessionEnrichMetadataResult, self.session_enrich_metadata_result + ) + result["SessionFsAppendFileRequest"] = to_class( + SessionFSAppendFileRequest, self.session_fs_append_file_request + ) result["SessionFsError"] = to_class(SessionFSError, self.session_fs_error) result["SessionFsErrorCode"] = to_enum(SessionFSErrorCode, self.session_fs_error_code) - result["SessionFsExistsRequest"] = to_class(SessionFSExistsRequest, self.session_fs_exists_request) - result["SessionFsExistsResult"] = to_class(SessionFSExistsResult, self.session_fs_exists_result) - result["SessionFsMkdirRequest"] = to_class(SessionFSMkdirRequest, self.session_fs_mkdir_request) - result["SessionFsReaddirRequest"] = to_class(SessionFSReaddirRequest, self.session_fs_readdir_request) - result["SessionFsReaddirResult"] = to_class(SessionFSReaddirResult, self.session_fs_readdir_result) - result["SessionFsReaddirWithTypesEntry"] = to_class(SessionFSReaddirWithTypesEntry, self.session_fs_readdir_with_types_entry) - result["SessionFsReaddirWithTypesEntryType"] = to_enum(SessionFSReaddirWithTypesEntryType, self.session_fs_readdir_with_types_entry_type) - result["SessionFsReaddirWithTypesRequest"] = to_class(SessionFSReaddirWithTypesRequest, self.session_fs_readdir_with_types_request) - result["SessionFsReaddirWithTypesResult"] = to_class(SessionFSReaddirWithTypesResult, self.session_fs_readdir_with_types_result) - result["SessionFsReadFileRequest"] = to_class(SessionFSReadFileRequest, self.session_fs_read_file_request) - result["SessionFsReadFileResult"] = to_class(SessionFSReadFileResult, self.session_fs_read_file_result) - result["SessionFsRenameRequest"] = to_class(SessionFSRenameRequest, self.session_fs_rename_request) + result["SessionFsExistsRequest"] = to_class( + SessionFSExistsRequest, self.session_fs_exists_request + ) + result["SessionFsExistsResult"] = to_class( + SessionFSExistsResult, self.session_fs_exists_result + ) + result["SessionFsMkdirRequest"] = to_class( + SessionFSMkdirRequest, self.session_fs_mkdir_request + ) + result["SessionFsReaddirRequest"] = to_class( + SessionFSReaddirRequest, self.session_fs_readdir_request + ) + result["SessionFsReaddirResult"] = to_class( + SessionFSReaddirResult, self.session_fs_readdir_result + ) + result["SessionFsReaddirWithTypesEntry"] = to_class( + SessionFSReaddirWithTypesEntry, self.session_fs_readdir_with_types_entry + ) + result["SessionFsReaddirWithTypesEntryType"] = to_enum( + SessionFSReaddirWithTypesEntryType, self.session_fs_readdir_with_types_entry_type + ) + result["SessionFsReaddirWithTypesRequest"] = to_class( + SessionFSReaddirWithTypesRequest, self.session_fs_readdir_with_types_request + ) + result["SessionFsReaddirWithTypesResult"] = to_class( + SessionFSReaddirWithTypesResult, self.session_fs_readdir_with_types_result + ) + result["SessionFsReadFileRequest"] = to_class( + SessionFSReadFileRequest, self.session_fs_read_file_request + ) + result["SessionFsReadFileResult"] = to_class( + SessionFSReadFileResult, self.session_fs_read_file_result + ) + result["SessionFsRenameRequest"] = to_class( + SessionFSRenameRequest, self.session_fs_rename_request + ) result["SessionFsRmRequest"] = to_class(SessionFSRmRequest, self.session_fs_rm_request) - result["SessionFsSetProviderCapabilities"] = to_class(SessionFSSetProviderCapabilities, self.session_fs_set_provider_capabilities) - result["SessionFsSetProviderConventions"] = to_enum(SessionFSSetProviderConventions, self.session_fs_set_provider_conventions) - result["SessionFsSetProviderRequest"] = to_class(SessionFSSetProviderRequest, self.session_fs_set_provider_request) - result["SessionFsSetProviderResult"] = to_class(SessionFSSetProviderResult, self.session_fs_set_provider_result) - result["SessionFsSqliteExistsRequest"] = to_class(SessionFSSqliteExistsRequest, self.session_fs_sqlite_exists_request) - result["SessionFsSqliteExistsResult"] = to_class(SessionFSSqliteExistsResult, self.session_fs_sqlite_exists_result) - result["SessionFsSqliteQueryRequest"] = to_class(SessionFSSqliteQueryRequest, self.session_fs_sqlite_query_request) - result["SessionFsSqliteQueryResult"] = to_class(SessionFSSqliteQueryResult, self.session_fs_sqlite_query_result) - result["SessionFsSqliteQueryType"] = to_enum(SessionFSSqliteQueryType, self.session_fs_sqlite_query_type) - result["SessionFsStatRequest"] = to_class(SessionFSStatRequest, self.session_fs_stat_request) + result["SessionFsSetProviderCapabilities"] = to_class( + SessionFSSetProviderCapabilities, self.session_fs_set_provider_capabilities + ) + result["SessionFsSetProviderConventions"] = to_enum( + SessionFSSetProviderConventions, self.session_fs_set_provider_conventions + ) + result["SessionFsSetProviderRequest"] = to_class( + SessionFSSetProviderRequest, self.session_fs_set_provider_request + ) + result["SessionFsSetProviderResult"] = to_class( + SessionFSSetProviderResult, self.session_fs_set_provider_result + ) + result["SessionFsSqliteExistsRequest"] = to_class( + SessionFSSqliteExistsRequest, self.session_fs_sqlite_exists_request + ) + result["SessionFsSqliteExistsResult"] = to_class( + SessionFSSqliteExistsResult, self.session_fs_sqlite_exists_result + ) + result["SessionFsSqliteQueryRequest"] = to_class( + SessionFSSqliteQueryRequest, self.session_fs_sqlite_query_request + ) + result["SessionFsSqliteQueryResult"] = to_class( + SessionFSSqliteQueryResult, self.session_fs_sqlite_query_result + ) + result["SessionFsSqliteQueryType"] = to_enum( + SessionFSSqliteQueryType, self.session_fs_sqlite_query_type + ) + result["SessionFsStatRequest"] = to_class( + SessionFSStatRequest, self.session_fs_stat_request + ) result["SessionFsStatResult"] = to_class(SessionFSStatResult, self.session_fs_stat_result) - result["SessionFsWriteFileRequest"] = to_class(SessionFSWriteFileRequest, self.session_fs_write_file_request) - result["SessionInstalledPlugin"] = to_class(SessionInstalledPlugin, self.session_installed_plugin) - result["SessionInstalledPluginSource"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str], self.session_installed_plugin_source) - result["SessionInstalledPluginSourceGithub"] = to_class(SessionInstalledPluginSourceGithub, self.session_installed_plugin_source_github) - result["SessionInstalledPluginSourceLocal"] = to_class(SessionInstalledPluginSourceLocal, self.session_installed_plugin_source_local) - result["SessionInstalledPluginSourceUrl"] = to_class(SessionInstalledPluginSourceURL, self.session_installed_plugin_source_url) + result["SessionFsWriteFileRequest"] = to_class( + SessionFSWriteFileRequest, self.session_fs_write_file_request + ) + result["SessionInstalledPlugin"] = to_class( + SessionInstalledPlugin, self.session_installed_plugin + ) + result["SessionInstalledPluginSource"] = from_union( + [lambda x: to_class(SessionInstalledPluginSource, x), from_str], + self.session_installed_plugin_source, + ) + result["SessionInstalledPluginSourceGithub"] = to_class( + SessionInstalledPluginSourceGithub, self.session_installed_plugin_source_github + ) + result["SessionInstalledPluginSourceLocal"] = to_class( + SessionInstalledPluginSourceLocal, self.session_installed_plugin_source_local + ) + result["SessionInstalledPluginSourceUrl"] = to_class( + SessionInstalledPluginSourceURL, self.session_installed_plugin_source_url + ) result["SessionList"] = to_class(SessionList, self.session_list) result["SessionListFilter"] = to_class(SessionListFilter, self.session_list_filter) - result["SessionLoadDeferredRepoHooksResult"] = to_class(SessionLoadDeferredRepoHooksResult, self.session_load_deferred_repo_hooks_result) + result["SessionLoadDeferredRepoHooksResult"] = to_class( + SessionLoadDeferredRepoHooksResult, self.session_load_deferred_repo_hooks_result + ) result["SessionLogLevel"] = to_enum(SessionLogLevel, self.session_log_level) - result["SessionMcpAppsCallToolResult"] = from_dict(lambda x: x, self.session_mcp_apps_call_tool_result) + result["SessionMcpAppsCallToolResult"] = from_dict( + lambda x: x, self.session_mcp_apps_call_tool_result + ) result["SessionMetadata"] = to_class(SessionMetadata, self.session_metadata) - result["SessionMetadataSnapshot"] = to_class(SessionMetadataSnapshot, self.session_metadata_snapshot) + result["SessionMetadataSnapshot"] = to_class( + SessionMetadataSnapshot, self.session_metadata_snapshot + ) result["SessionMode"] = to_enum(SessionMode, self.session_mode) result["SessionPruneResult"] = to_class(SessionPruneResult, self.session_prune_result) - result["SessionsBulkDeleteRequest"] = to_class(SessionsBulkDeleteRequest, self.sessions_bulk_delete_request) - result["SessionsCheckInUseRequest"] = to_class(SessionsCheckInUseRequest, self.sessions_check_in_use_request) - result["SessionsCheckInUseResult"] = to_class(SessionsCheckInUseResult, self.sessions_check_in_use_result) + result["SessionsBulkDeleteRequest"] = to_class( + SessionsBulkDeleteRequest, self.sessions_bulk_delete_request + ) + result["SessionsCheckInUseRequest"] = to_class( + SessionsCheckInUseRequest, self.sessions_check_in_use_request + ) + result["SessionsCheckInUseResult"] = to_class( + SessionsCheckInUseResult, self.sessions_check_in_use_result + ) result["SessionsCloseRequest"] = to_class(SessionsCloseRequest, self.sessions_close_request) result["SessionsCloseResult"] = to_class(SessionsCloseResult, self.sessions_close_result) - result["SessionsEnrichMetadataRequest"] = to_class(SessionsEnrichMetadataRequest, self.sessions_enrich_metadata_request) - result["SessionSetCredentialsParams"] = to_class(SessionSetCredentialsParams, self.session_set_credentials_params) - result["SessionSetCredentialsResult"] = to_class(SessionSetCredentialsResult, self.session_set_credentials_result) - result["SessionsFindByPrefixRequest"] = to_class(SessionsFindByPrefixRequest, self.sessions_find_by_prefix_request) - result["SessionsFindByPrefixResult"] = to_class(SessionsFindByPrefixResult, self.sessions_find_by_prefix_result) - result["SessionsFindByTaskIDRequest"] = to_class(SessionsFindByTaskIDRequest, self.sessions_find_by_task_id_request) - result["SessionsFindByTaskIDResult"] = to_class(SessionsFindByTaskIDResult, self.sessions_find_by_task_id_result) + result["SessionsEnrichMetadataRequest"] = to_class( + SessionsEnrichMetadataRequest, self.sessions_enrich_metadata_request + ) + result["SessionSetCredentialsParams"] = to_class( + SessionSetCredentialsParams, self.session_set_credentials_params + ) + result["SessionSetCredentialsResult"] = to_class( + SessionSetCredentialsResult, self.session_set_credentials_result + ) + result["SessionsFindByPrefixRequest"] = to_class( + SessionsFindByPrefixRequest, self.sessions_find_by_prefix_request + ) + result["SessionsFindByPrefixResult"] = to_class( + SessionsFindByPrefixResult, self.sessions_find_by_prefix_result + ) + result["SessionsFindByTaskIDRequest"] = to_class( + SessionsFindByTaskIDRequest, self.sessions_find_by_task_id_request + ) + result["SessionsFindByTaskIDResult"] = to_class( + SessionsFindByTaskIDResult, self.sessions_find_by_task_id_result + ) result["SessionsForkRequest"] = to_class(SessionsForkRequest, self.sessions_fork_request) result["SessionsForkResult"] = to_class(SessionsForkResult, self.sessions_fork_result) - result["SessionsGetEventFilePathRequest"] = to_class(SessionsGetEventFilePathRequest, self.sessions_get_event_file_path_request) - result["SessionsGetEventFilePathResult"] = to_class(SessionsGetEventFilePathResult, self.sessions_get_event_file_path_result) - result["SessionsGetLastForContextRequest"] = to_class(SessionsGetLastForContextRequest, self.sessions_get_last_for_context_request) - result["SessionsGetLastForContextResult"] = to_class(SessionsGetLastForContextResult, self.sessions_get_last_for_context_result) - result["SessionsGetPersistedRemoteSteerableRequest"] = to_class(SessionsGetPersistedRemoteSteerableRequest, self.sessions_get_persisted_remote_steerable_request) - result["SessionsGetPersistedRemoteSteerableResult"] = to_class(SessionsGetPersistedRemoteSteerableResult, self.sessions_get_persisted_remote_steerable_result) + result["SessionsGetEventFilePathRequest"] = to_class( + SessionsGetEventFilePathRequest, self.sessions_get_event_file_path_request + ) + result["SessionsGetEventFilePathResult"] = to_class( + SessionsGetEventFilePathResult, self.sessions_get_event_file_path_result + ) + result["SessionsGetLastForContextRequest"] = to_class( + SessionsGetLastForContextRequest, self.sessions_get_last_for_context_request + ) + result["SessionsGetLastForContextResult"] = to_class( + SessionsGetLastForContextResult, self.sessions_get_last_for_context_result + ) + result["SessionsGetPersistedRemoteSteerableRequest"] = to_class( + SessionsGetPersistedRemoteSteerableRequest, + self.sessions_get_persisted_remote_steerable_request, + ) + result["SessionsGetPersistedRemoteSteerableResult"] = to_class( + SessionsGetPersistedRemoteSteerableResult, + self.sessions_get_persisted_remote_steerable_result, + ) result["SessionSizes"] = to_class(SessionSizes, self.session_sizes) result["SessionsListRequest"] = to_class(SessionsListRequest, self.sessions_list_request) - result["SessionsLoadDeferredRepoHooksRequest"] = to_class(SessionsLoadDeferredRepoHooksRequest, self.sessions_load_deferred_repo_hooks_request) - result["SessionsPruneOldRequest"] = to_class(SessionsPruneOldRequest, self.sessions_prune_old_request) - result["SessionsReleaseLockRequest"] = to_class(SessionsReleaseLockRequest, self.sessions_release_lock_request) - result["SessionsReleaseLockResult"] = to_class(SessionsReleaseLockResult, self.sessions_release_lock_result) - result["SessionsReloadPluginHooksRequest"] = to_class(SessionsReloadPluginHooksRequest, self.sessions_reload_plugin_hooks_request) - result["SessionsReloadPluginHooksResult"] = to_class(SessionsReloadPluginHooksResult, self.sessions_reload_plugin_hooks_result) + result["SessionsLoadDeferredRepoHooksRequest"] = to_class( + SessionsLoadDeferredRepoHooksRequest, self.sessions_load_deferred_repo_hooks_request + ) + result["SessionsPruneOldRequest"] = to_class( + SessionsPruneOldRequest, self.sessions_prune_old_request + ) + result["SessionsReleaseLockRequest"] = to_class( + SessionsReleaseLockRequest, self.sessions_release_lock_request + ) + result["SessionsReleaseLockResult"] = to_class( + SessionsReleaseLockResult, self.sessions_release_lock_result + ) + result["SessionsReloadPluginHooksRequest"] = to_class( + SessionsReloadPluginHooksRequest, self.sessions_reload_plugin_hooks_request + ) + result["SessionsReloadPluginHooksResult"] = to_class( + SessionsReloadPluginHooksResult, self.sessions_reload_plugin_hooks_result + ) result["SessionsSaveRequest"] = to_class(SessionsSaveRequest, self.sessions_save_request) result["SessionsSaveResult"] = to_class(SessionsSaveResult, self.sessions_save_result) - result["SessionsSetAdditionalPluginsRequest"] = to_class(SessionsSetAdditionalPluginsRequest, self.sessions_set_additional_plugins_request) - result["SessionsSetAdditionalPluginsResult"] = to_class(SessionsSetAdditionalPluginsResult, self.sessions_set_additional_plugins_result) - result["SessionUpdateOptionsParams"] = to_class(SessionUpdateOptionsParams, self.session_update_options_params) - result["SessionUpdateOptionsResult"] = to_class(SessionUpdateOptionsResult, self.session_update_options_result) - result["SessionWorkingDirectoryContext"] = to_class(SessionWorkingDirectoryContext, self.session_working_directory_context) - result["SessionWorkingDirectoryContextHostType"] = to_enum(HostType, self.session_working_directory_context_host_type) + result["SessionsSetAdditionalPluginsRequest"] = to_class( + SessionsSetAdditionalPluginsRequest, self.sessions_set_additional_plugins_request + ) + result["SessionsSetAdditionalPluginsResult"] = to_class( + SessionsSetAdditionalPluginsResult, self.sessions_set_additional_plugins_result + ) + result["SessionUpdateOptionsParams"] = to_class( + SessionUpdateOptionsParams, self.session_update_options_params + ) + result["SessionUpdateOptionsResult"] = to_class( + SessionUpdateOptionsResult, self.session_update_options_result + ) + result["SessionWorkingDirectoryContext"] = to_class( + SessionWorkingDirectoryContext, self.session_working_directory_context + ) + result["SessionWorkingDirectoryContextHostType"] = to_enum( + HostType, self.session_working_directory_context_host_type + ) result["ShellExecRequest"] = to_class(ShellExecRequest, self.shell_exec_request) result["ShellExecResult"] = to_class(ShellExecResult, self.shell_exec_result) result["ShellKillRequest"] = to_class(ShellKillRequest, self.shell_kill_request) @@ -16136,23 +20465,43 @@ def to_dict(self) -> dict: result["ShutdownRequest"] = to_class(ShutdownRequest, self.shutdown_request) result["Skill"] = to_class(Skill, self.skill) result["SkillList"] = to_class(SkillList, self.skill_list) - result["SkillsConfigSetDisabledSkillsRequest"] = to_class(SkillsConfigSetDisabledSkillsRequest, self.skills_config_set_disabled_skills_request) + result["SkillsConfigSetDisabledSkillsRequest"] = to_class( + SkillsConfigSetDisabledSkillsRequest, self.skills_config_set_disabled_skills_request + ) result["SkillsDisableRequest"] = to_class(SkillsDisableRequest, self.skills_disable_request) - result["SkillsDiscoverRequest"] = to_class(SkillsDiscoverRequest, self.skills_discover_request) + result["SkillsDiscoverRequest"] = to_class( + SkillsDiscoverRequest, self.skills_discover_request + ) result["SkillsEnableRequest"] = to_class(SkillsEnableRequest, self.skills_enable_request) - result["SkillsGetInvokedResult"] = to_class(SkillsGetInvokedResult, self.skills_get_invoked_result) + result["SkillsGetInvokedResult"] = to_class( + SkillsGetInvokedResult, self.skills_get_invoked_result + ) result["SkillsInvokedSkill"] = to_class(SkillsInvokedSkill, self.skills_invoked_skill) - result["SkillsLoadDiagnostics"] = to_class(SkillsLoadDiagnostics, self.skills_load_diagnostics) - result["SlashCommandAgentPromptResult"] = to_class(SlashCommandAgentPromptResult, self.slash_command_agent_prompt_result) - result["SlashCommandCompletedResult"] = to_class(SlashCommandCompletedResult, self.slash_command_completed_result) + result["SkillsLoadDiagnostics"] = to_class( + SkillsLoadDiagnostics, self.skills_load_diagnostics + ) + result["SlashCommandAgentPromptResult"] = to_class( + SlashCommandAgentPromptResult, self.slash_command_agent_prompt_result + ) + result["SlashCommandCompletedResult"] = to_class( + SlashCommandCompletedResult, self.slash_command_completed_result + ) result["SlashCommandInfo"] = to_class(SlashCommandInfo, self.slash_command_info) result["SlashCommandInput"] = to_class(SlashCommandInput, self.slash_command_input) - result["SlashCommandInputCompletion"] = to_enum(SlashCommandInputCompletion, self.slash_command_input_completion) + result["SlashCommandInputCompletion"] = to_enum( + SlashCommandInputCompletion, self.slash_command_input_completion + ) result["SlashCommandInvocationResult"] = (self.slash_command_invocation_result).to_dict() result["SlashCommandKind"] = to_enum(SlashCommandKind, self.slash_command_kind) - result["SlashCommandSelectSubcommandOption"] = to_class(SlashCommandSelectSubcommandOption, self.slash_command_select_subcommand_option) - result["SlashCommandSelectSubcommandResult"] = to_class(SlashCommandSelectSubcommandResult, self.slash_command_select_subcommand_result) - result["SlashCommandTextResult"] = to_class(SlashCommandTextResult, self.slash_command_text_result) + result["SlashCommandSelectSubcommandOption"] = to_class( + SlashCommandSelectSubcommandOption, self.slash_command_select_subcommand_option + ) + result["SlashCommandSelectSubcommandResult"] = to_class( + SlashCommandSelectSubcommandResult, self.slash_command_select_subcommand_result + ) + result["SlashCommandTextResult"] = to_class( + SlashCommandTextResult, self.slash_command_text_result + ) result["TaskAgentInfo"] = to_class(TaskAgentInfo, self.task_agent_info) result["TaskAgentProgress"] = to_class(TaskAgentProgress, self.task_agent_progress) result["TaskExecutionMode"] = to_enum(TaskExecutionMode, self.task_execution_mode) @@ -16161,261 +20510,595 @@ def to_dict(self) -> dict: result["TaskProgressLine"] = to_class(TaskProgressLine, self.task_progress_line) result["TasksCancelRequest"] = to_class(TasksCancelRequest, self.tasks_cancel_request) result["TasksCancelResult"] = to_class(TasksCancelResult, self.tasks_cancel_result) - result["TasksGetCurrentPromotableResult"] = to_class(TasksGetCurrentPromotableResult, self.tasks_get_current_promotable_result) - result["TasksGetProgressRequest"] = to_class(TasksGetProgressRequest, self.tasks_get_progress_request) - result["TasksGetProgressResult"] = to_class(TasksGetProgressResult, self.tasks_get_progress_result) + result["TasksGetCurrentPromotableResult"] = to_class( + TasksGetCurrentPromotableResult, self.tasks_get_current_promotable_result + ) + result["TasksGetProgressRequest"] = to_class( + TasksGetProgressRequest, self.tasks_get_progress_request + ) + result["TasksGetProgressResult"] = to_class( + TasksGetProgressResult, self.tasks_get_progress_result + ) result["TaskShellInfo"] = to_class(TaskShellInfo, self.task_shell_info) - result["TaskShellInfoAttachmentMode"] = to_enum(TaskShellInfoAttachmentMode, self.task_shell_info_attachment_mode) + result["TaskShellInfoAttachmentMode"] = to_enum( + TaskShellInfoAttachmentMode, self.task_shell_info_attachment_mode + ) result["TaskShellProgress"] = to_class(TaskShellProgress, self.task_shell_progress) - result["TasksPromoteCurrentToBackgroundResult"] = to_class(TasksPromoteCurrentToBackgroundResult, self.tasks_promote_current_to_background_result) - result["TasksPromoteToBackgroundRequest"] = to_class(TasksPromoteToBackgroundRequest, self.tasks_promote_to_background_request) - result["TasksPromoteToBackgroundResult"] = to_class(TasksPromoteToBackgroundResult, self.tasks_promote_to_background_result) + result["TasksPromoteCurrentToBackgroundResult"] = to_class( + TasksPromoteCurrentToBackgroundResult, self.tasks_promote_current_to_background_result + ) + result["TasksPromoteToBackgroundRequest"] = to_class( + TasksPromoteToBackgroundRequest, self.tasks_promote_to_background_request + ) + result["TasksPromoteToBackgroundResult"] = to_class( + TasksPromoteToBackgroundResult, self.tasks_promote_to_background_result + ) result["TasksRefreshResult"] = to_class(TasksRefreshResult, self.tasks_refresh_result) result["TasksRemoveRequest"] = to_class(TasksRemoveRequest, self.tasks_remove_request) result["TasksRemoveResult"] = to_class(TasksRemoveResult, self.tasks_remove_result) - result["TasksSendMessageRequest"] = to_class(TasksSendMessageRequest, self.tasks_send_message_request) - result["TasksSendMessageResult"] = to_class(TasksSendMessageResult, self.tasks_send_message_result) - result["TasksStartAgentRequest"] = to_class(TasksStartAgentRequest, self.tasks_start_agent_request) - result["TasksStartAgentResult"] = to_class(TasksStartAgentResult, self.tasks_start_agent_result) + result["TasksSendMessageRequest"] = to_class( + TasksSendMessageRequest, self.tasks_send_message_request + ) + result["TasksSendMessageResult"] = to_class( + TasksSendMessageResult, self.tasks_send_message_result + ) + result["TasksStartAgentRequest"] = to_class( + TasksStartAgentRequest, self.tasks_start_agent_request + ) + result["TasksStartAgentResult"] = to_class( + TasksStartAgentResult, self.tasks_start_agent_result + ) result["TaskStatus"] = to_enum(TaskStatus, self.task_status) - result["TasksWaitForPendingResult"] = to_class(TasksWaitForPendingResult, self.tasks_wait_for_pending_result) - result["TelemetrySetFeatureOverridesRequest"] = to_class(TelemetrySetFeatureOverridesRequest, self.telemetry_set_feature_overrides_request) + result["TasksWaitForPendingResult"] = to_class( + TasksWaitForPendingResult, self.tasks_wait_for_pending_result + ) + result["TelemetrySetFeatureOverridesRequest"] = to_class( + TelemetrySetFeatureOverridesRequest, self.telemetry_set_feature_overrides_request + ) result["TokenAuthInfo"] = to_class(TokenAuthInfo, self.token_auth_info) result["Tool"] = to_class(Tool, self.tool) result["ToolList"] = to_class(ToolList, self.tool_list) - result["ToolsInitializeAndValidateResult"] = to_class(ToolsInitializeAndValidateResult, self.tools_initialize_and_validate_result) + result["ToolsInitializeAndValidateResult"] = to_class( + ToolsInitializeAndValidateResult, self.tools_initialize_and_validate_result + ) result["ToolsListRequest"] = to_class(ToolsListRequest, self.tools_list_request) - result["UIAutoModeSwitchResponse"] = to_enum(UIAutoModeSwitchResponse, self.ui_auto_mode_switch_response) - result["UIElicitationArrayAnyOfField"] = to_class(UIElicitationArrayAnyOfField, self.ui_elicitation_array_any_of_field) - result["UIElicitationArrayAnyOfFieldItems"] = to_class(UIElicitationArrayAnyOfFieldItems, self.ui_elicitation_array_any_of_field_items) - result["UIElicitationArrayAnyOfFieldItemsAnyOf"] = to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, self.ui_elicitation_array_any_of_field_items_any_of) - result["UIElicitationArrayEnumField"] = to_class(UIElicitationArrayEnumField, self.ui_elicitation_array_enum_field) - result["UIElicitationArrayEnumFieldItems"] = to_class(UIElicitationArrayEnumFieldItems, self.ui_elicitation_array_enum_field_items) - result["UIElicitationFieldValue"] = from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], self.ui_elicitation_field_value) + result["UIAutoModeSwitchResponse"] = to_enum( + UIAutoModeSwitchResponse, self.ui_auto_mode_switch_response + ) + result["UIElicitationArrayAnyOfField"] = to_class( + UIElicitationArrayAnyOfField, self.ui_elicitation_array_any_of_field + ) + result["UIElicitationArrayAnyOfFieldItems"] = to_class( + UIElicitationArrayAnyOfFieldItems, self.ui_elicitation_array_any_of_field_items + ) + result["UIElicitationArrayAnyOfFieldItemsAnyOf"] = to_class( + UIElicitationArrayAnyOfFieldItemsAnyOf, + self.ui_elicitation_array_any_of_field_items_any_of, + ) + result["UIElicitationArrayEnumField"] = to_class( + UIElicitationArrayEnumField, self.ui_elicitation_array_enum_field + ) + result["UIElicitationArrayEnumFieldItems"] = to_class( + UIElicitationArrayEnumFieldItems, self.ui_elicitation_array_enum_field_items + ) + result["UIElicitationFieldValue"] = from_union( + [to_float, from_bool, lambda x: from_list(from_str, x), from_str], + self.ui_elicitation_field_value, + ) result["UIElicitationRequest"] = to_class(UIElicitationRequest, self.ui_elicitation_request) - result["UIElicitationResponse"] = to_class(UIElicitationResponse, self.ui_elicitation_response) - result["UIElicitationResponseAction"] = to_enum(UIElicitationResponseAction, self.ui_elicitation_response_action) - result["UIElicitationResponseContent"] = from_dict(lambda x: from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], x), self.ui_elicitation_response_content) + result["UIElicitationResponse"] = to_class( + UIElicitationResponse, self.ui_elicitation_response + ) + result["UIElicitationResponseAction"] = to_enum( + UIElicitationResponseAction, self.ui_elicitation_response_action + ) + result["UIElicitationResponseContent"] = from_dict( + lambda x: from_union( + [to_float, from_bool, lambda x: from_list(from_str, x), from_str], x + ), + self.ui_elicitation_response_content, + ) result["UIElicitationResult"] = to_class(UIElicitationResult, self.ui_elicitation_result) result["UIElicitationSchema"] = to_class(UIElicitationSchema, self.ui_elicitation_schema) - result["UIElicitationSchemaProperty"] = to_class(UIElicitationSchemaProperty, self.ui_elicitation_schema_property) - result["UIElicitationSchemaPropertyBoolean"] = to_class(UIElicitationSchemaPropertyBoolean, self.ui_elicitation_schema_property_boolean) - result["UIElicitationSchemaPropertyNumber"] = to_class(UIElicitationSchemaPropertyNumber, self.ui_elicitation_schema_property_number) - result["UIElicitationSchemaPropertyNumberType"] = to_enum(UIElicitationSchemaPropertyNumberType, self.ui_elicitation_schema_property_number_type) - result["UIElicitationSchemaPropertyString"] = to_class(UIElicitationSchemaPropertyString, self.ui_elicitation_schema_property_string) - result["UIElicitationSchemaPropertyStringFormat"] = to_enum(UIElicitationSchemaPropertyStringFormat, self.ui_elicitation_schema_property_string_format) - result["UIElicitationStringEnumField"] = to_class(UIElicitationStringEnumField, self.ui_elicitation_string_enum_field) - result["UIElicitationStringOneOfField"] = to_class(UIElicitationStringOneOfField, self.ui_elicitation_string_one_of_field) - result["UIElicitationStringOneOfFieldOneOf"] = to_class(UIElicitationStringOneOfFieldOneOf, self.ui_elicitation_string_one_of_field_one_of) - result["UIExitPlanModeAction"] = to_enum(UIExitPlanModeAction, self.ui_exit_plan_mode_action) - result["UIExitPlanModeResponse"] = to_class(UIExitPlanModeResponse, self.ui_exit_plan_mode_response) - result["UIHandlePendingAutoModeSwitchRequest"] = to_class(UIHandlePendingAutoModeSwitchRequest, self.ui_handle_pending_auto_mode_switch_request) - result["UIHandlePendingElicitationRequest"] = to_class(UIHandlePendingElicitationRequest, self.ui_handle_pending_elicitation_request) - result["UIHandlePendingExitPlanModeRequest"] = to_class(UIHandlePendingExitPlanModeRequest, self.ui_handle_pending_exit_plan_mode_request) - result["UIHandlePendingResult"] = to_class(UIHandlePendingResult, self.ui_handle_pending_result) - result["UIHandlePendingSamplingRequest"] = to_class(UIHandlePendingSamplingRequest, self.ui_handle_pending_sampling_request) - result["UIHandlePendingSamplingResponse"] = from_dict(lambda x: x, self.ui_handle_pending_sampling_response) - result["UIHandlePendingUserInputRequest"] = to_class(UIHandlePendingUserInputRequest, self.ui_handle_pending_user_input_request) - result["UIRegisterDirectAutoModeSwitchHandlerResult"] = to_class(UIRegisterDirectAutoModeSwitchHandlerResult, self.ui_register_direct_auto_mode_switch_handler_result) - result["UIUnregisterDirectAutoModeSwitchHandlerRequest"] = to_class(UIUnregisterDirectAutoModeSwitchHandlerRequest, self.ui_unregister_direct_auto_mode_switch_handler_request) - result["UIUnregisterDirectAutoModeSwitchHandlerResult"] = to_class(UIUnregisterDirectAutoModeSwitchHandlerResult, self.ui_unregister_direct_auto_mode_switch_handler_result) + result["UIElicitationSchemaProperty"] = to_class( + UIElicitationSchemaProperty, self.ui_elicitation_schema_property + ) + result["UIElicitationSchemaPropertyBoolean"] = to_class( + UIElicitationSchemaPropertyBoolean, self.ui_elicitation_schema_property_boolean + ) + result["UIElicitationSchemaPropertyNumber"] = to_class( + UIElicitationSchemaPropertyNumber, self.ui_elicitation_schema_property_number + ) + result["UIElicitationSchemaPropertyNumberType"] = to_enum( + UIElicitationSchemaPropertyNumberType, self.ui_elicitation_schema_property_number_type + ) + result["UIElicitationSchemaPropertyString"] = to_class( + UIElicitationSchemaPropertyString, self.ui_elicitation_schema_property_string + ) + result["UIElicitationSchemaPropertyStringFormat"] = to_enum( + UIElicitationSchemaPropertyStringFormat, + self.ui_elicitation_schema_property_string_format, + ) + result["UIElicitationStringEnumField"] = to_class( + UIElicitationStringEnumField, self.ui_elicitation_string_enum_field + ) + result["UIElicitationStringOneOfField"] = to_class( + UIElicitationStringOneOfField, self.ui_elicitation_string_one_of_field + ) + result["UIElicitationStringOneOfFieldOneOf"] = to_class( + UIElicitationStringOneOfFieldOneOf, self.ui_elicitation_string_one_of_field_one_of + ) + result["UIExitPlanModeAction"] = to_enum( + UIExitPlanModeAction, self.ui_exit_plan_mode_action + ) + result["UIExitPlanModeResponse"] = to_class( + UIExitPlanModeResponse, self.ui_exit_plan_mode_response + ) + result["UIHandlePendingAutoModeSwitchRequest"] = to_class( + UIHandlePendingAutoModeSwitchRequest, self.ui_handle_pending_auto_mode_switch_request + ) + result["UIHandlePendingElicitationRequest"] = to_class( + UIHandlePendingElicitationRequest, self.ui_handle_pending_elicitation_request + ) + result["UIHandlePendingExitPlanModeRequest"] = to_class( + UIHandlePendingExitPlanModeRequest, self.ui_handle_pending_exit_plan_mode_request + ) + result["UIHandlePendingResult"] = to_class( + UIHandlePendingResult, self.ui_handle_pending_result + ) + result["UIHandlePendingSamplingRequest"] = to_class( + UIHandlePendingSamplingRequest, self.ui_handle_pending_sampling_request + ) + result["UIHandlePendingSamplingResponse"] = from_dict( + lambda x: x, self.ui_handle_pending_sampling_response + ) + result["UIHandlePendingUserInputRequest"] = to_class( + UIHandlePendingUserInputRequest, self.ui_handle_pending_user_input_request + ) + result["UIRegisterDirectAutoModeSwitchHandlerResult"] = to_class( + UIRegisterDirectAutoModeSwitchHandlerResult, + self.ui_register_direct_auto_mode_switch_handler_result, + ) + result["UIUnregisterDirectAutoModeSwitchHandlerRequest"] = to_class( + UIUnregisterDirectAutoModeSwitchHandlerRequest, + self.ui_unregister_direct_auto_mode_switch_handler_request, + ) + result["UIUnregisterDirectAutoModeSwitchHandlerResult"] = to_class( + UIUnregisterDirectAutoModeSwitchHandlerResult, + self.ui_unregister_direct_auto_mode_switch_handler_result, + ) result["UIUserInputResponse"] = to_class(UIUserInputResponse, self.ui_user_input_response) - result["UsageGetMetricsResult"] = to_class(UsageGetMetricsResult, self.usage_get_metrics_result) - result["UsageMetricsCodeChanges"] = to_class(UsageMetricsCodeChanges, self.usage_metrics_code_changes) - result["UsageMetricsModelMetric"] = to_class(UsageMetricsModelMetric, self.usage_metrics_model_metric) - result["UsageMetricsModelMetricRequests"] = to_class(UsageMetricsModelMetricRequests, self.usage_metrics_model_metric_requests) - result["UsageMetricsModelMetricTokenDetail"] = to_class(UsageMetricsModelMetricTokenDetail, self.usage_metrics_model_metric_token_detail) - result["UsageMetricsModelMetricUsage"] = to_class(UsageMetricsModelMetricUsage, self.usage_metrics_model_metric_usage) - result["UsageMetricsTokenDetail"] = to_class(UsageMetricsTokenDetail, self.usage_metrics_token_detail) + result["UsageGetMetricsResult"] = to_class( + UsageGetMetricsResult, self.usage_get_metrics_result + ) + result["UsageMetricsCodeChanges"] = to_class( + UsageMetricsCodeChanges, self.usage_metrics_code_changes + ) + result["UsageMetricsModelMetric"] = to_class( + UsageMetricsModelMetric, self.usage_metrics_model_metric + ) + result["UsageMetricsModelMetricRequests"] = to_class( + UsageMetricsModelMetricRequests, self.usage_metrics_model_metric_requests + ) + result["UsageMetricsModelMetricTokenDetail"] = to_class( + UsageMetricsModelMetricTokenDetail, self.usage_metrics_model_metric_token_detail + ) + result["UsageMetricsModelMetricUsage"] = to_class( + UsageMetricsModelMetricUsage, self.usage_metrics_model_metric_usage + ) + result["UsageMetricsTokenDetail"] = to_class( + UsageMetricsTokenDetail, self.usage_metrics_token_detail + ) result["UserAuthInfo"] = to_class(UserAuthInfo, self.user_auth_info) - result["WorkspaceDiffFileChange"] = to_class(WorkspaceDiffFileChange, self.workspace_diff_file_change) - result["WorkspaceDiffFileChangeType"] = to_enum(WorkspaceDiffFileChangeType, self.workspace_diff_file_change_type) + result["WorkspaceDiffFileChange"] = to_class( + WorkspaceDiffFileChange, self.workspace_diff_file_change + ) + result["WorkspaceDiffFileChangeType"] = to_enum( + WorkspaceDiffFileChangeType, self.workspace_diff_file_change_type + ) result["WorkspaceDiffMode"] = to_enum(WorkspaceDiffMode, self.workspace_diff_mode) result["WorkspaceDiffResult"] = to_class(WorkspaceDiffResult, self.workspace_diff_result) - result["WorkspacesCheckpoints"] = to_class(WorkspacesCheckpoints, self.workspaces_checkpoints) - result["WorkspacesCreateFileRequest"] = to_class(WorkspacesCreateFileRequest, self.workspaces_create_file_request) - result["WorkspacesDiffRequest"] = to_class(WorkspacesDiffRequest, self.workspaces_diff_request) - result["WorkspacesGetWorkspaceResult"] = to_class(WorkspacesGetWorkspaceResult, self.workspaces_get_workspace_result) - result["WorkspacesListCheckpointsResult"] = to_class(WorkspacesListCheckpointsResult, self.workspaces_list_checkpoints_result) - result["WorkspacesListFilesResult"] = to_class(WorkspacesListFilesResult, self.workspaces_list_files_result) - result["WorkspacesReadCheckpointRequest"] = to_class(WorkspacesReadCheckpointRequest, self.workspaces_read_checkpoint_request) - result["WorkspacesReadCheckpointResult"] = to_class(WorkspacesReadCheckpointResult, self.workspaces_read_checkpoint_result) - result["WorkspacesReadFileRequest"] = to_class(WorkspacesReadFileRequest, self.workspaces_read_file_request) - result["WorkspacesReadFileResult"] = to_class(WorkspacesReadFileResult, self.workspaces_read_file_result) - result["WorkspacesSaveLargePasteRequest"] = to_class(WorkspacesSaveLargePasteRequest, self.workspaces_save_large_paste_request) - result["WorkspacesSaveLargePasteResult"] = to_class(WorkspacesSaveLargePasteResult, self.workspaces_save_large_paste_result) + result["WorkspacesCheckpoints"] = to_class( + WorkspacesCheckpoints, self.workspaces_checkpoints + ) + result["WorkspacesCreateFileRequest"] = to_class( + WorkspacesCreateFileRequest, self.workspaces_create_file_request + ) + result["WorkspacesDiffRequest"] = to_class( + WorkspacesDiffRequest, self.workspaces_diff_request + ) + result["WorkspacesGetWorkspaceResult"] = to_class( + WorkspacesGetWorkspaceResult, self.workspaces_get_workspace_result + ) + result["WorkspacesListCheckpointsResult"] = to_class( + WorkspacesListCheckpointsResult, self.workspaces_list_checkpoints_result + ) + result["WorkspacesListFilesResult"] = to_class( + WorkspacesListFilesResult, self.workspaces_list_files_result + ) + result["WorkspacesReadCheckpointRequest"] = to_class( + WorkspacesReadCheckpointRequest, self.workspaces_read_checkpoint_request + ) + result["WorkspacesReadCheckpointResult"] = to_class( + WorkspacesReadCheckpointResult, self.workspaces_read_checkpoint_result + ) + result["WorkspacesReadFileRequest"] = to_class( + WorkspacesReadFileRequest, self.workspaces_read_file_request + ) + result["WorkspacesReadFileResult"] = to_class( + WorkspacesReadFileResult, self.workspaces_read_file_result + ) + result["WorkspacesSaveLargePasteRequest"] = to_class( + WorkspacesSaveLargePasteRequest, self.workspaces_save_large_paste_request + ) + result["WorkspacesSaveLargePasteResult"] = to_class( + WorkspacesSaveLargePasteResult, self.workspaces_save_large_paste_result + ) result["WorkspaceSummaryHostType"] = to_enum(HostType, self.workspace_summary_host_type) - result["WorkspacesWorkspaceDetailsHostType"] = to_enum(HostType, self.workspaces_workspace_details_host_type) - result["SessionContextInfo"] = from_union([lambda x: to_class(SessionContextInfo, x), from_none], self.session_context_info) - result["TaskProgress"] = from_union([lambda x: to_class(TaskProgress, x), from_none], self.task_progress) - result["WorkspaceSummary"] = from_union([lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace_summary) + result["WorkspacesWorkspaceDetailsHostType"] = to_enum( + HostType, self.workspaces_workspace_details_host_type + ) + result["SessionContextInfo"] = from_union( + [lambda x: to_class(SessionContextInfo, x), from_none], self.session_context_info + ) + result["TaskProgress"] = from_union( + [lambda x: to_class(TaskProgress, x), from_none], self.task_progress + ) + result["WorkspaceSummary"] = from_union( + [lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace_summary + ) return result + def rpc_from_dict(s: Any) -> RPC: return RPC.from_dict(s) + def rpc_to_dict(x: RPC) -> Any: return to_class(RPC, x) + # The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime stores the value verbatim and uses it for outbound model/API requests; it does NOT re-validate or re-fetch the associated Copilot user response. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. -AuthInfo = HMACAuthInfo | EnvAuthInfo | TokenAuthInfo | CopilotAPITokenAuthInfo | UserAuthInfo | GhCLIAuthInfo | APIKeyAuthInfo +AuthInfo = ( + HMACAuthInfo + | EnvAuthInfo + | TokenAuthInfo + | CopilotAPITokenAuthInfo + | UserAuthInfo + | GhCLIAuthInfo + | APIKeyAuthInfo +) + def _load_AuthInfo(obj: Any) -> "AuthInfo": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "hmac": return HMACAuthInfo.from_dict(obj) - case "env": return EnvAuthInfo.from_dict(obj) - case "token": return TokenAuthInfo.from_dict(obj) - case "copilot-api-token": return CopilotAPITokenAuthInfo.from_dict(obj) - case "user": return UserAuthInfo.from_dict(obj) - case "gh-cli": return GhCLIAuthInfo.from_dict(obj) - case "api-key": return APIKeyAuthInfo.from_dict(obj) - case _: raise ValueError(f"Unknown AuthInfo type: {kind!r}") + case "hmac": + return HMACAuthInfo.from_dict(obj) + case "env": + return EnvAuthInfo.from_dict(obj) + case "token": + return TokenAuthInfo.from_dict(obj) + case "copilot-api-token": + return CopilotAPITokenAuthInfo.from_dict(obj) + case "user": + return UserAuthInfo.from_dict(obj) + case "gh-cli": + return GhCLIAuthInfo.from_dict(obj) + case "api-key": + return APIKeyAuthInfo.from_dict(obj) + case _: + raise ValueError(f"Unknown AuthInfo type: {kind!r}") + # A content block within a tool result, which may be text, terminal output, image, audio, or a resource -ExternalToolTextResultForLlmContent = ExternalToolTextResultForLlmContentText | ExternalToolTextResultForLlmContentTerminal | ExternalToolTextResultForLlmContentImage | ExternalToolTextResultForLlmContentAudio | ExternalToolTextResultForLlmContentResourceLink | ExternalToolTextResultForLlmContentResource +ExternalToolTextResultForLlmContent = ( + ExternalToolTextResultForLlmContentText + | ExternalToolTextResultForLlmContentTerminal + | ExternalToolTextResultForLlmContentImage + | ExternalToolTextResultForLlmContentAudio + | ExternalToolTextResultForLlmContentResourceLink + | ExternalToolTextResultForLlmContentResource +) + def _load_ExternalToolTextResultForLlmContent(obj: Any) -> "ExternalToolTextResultForLlmContent": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "text": return ExternalToolTextResultForLlmContentText.from_dict(obj) - case "terminal": return ExternalToolTextResultForLlmContentTerminal.from_dict(obj) - case "image": return ExternalToolTextResultForLlmContentImage.from_dict(obj) - case "audio": return ExternalToolTextResultForLlmContentAudio.from_dict(obj) - case "resource_link": return ExternalToolTextResultForLlmContentResourceLink.from_dict(obj) - case "resource": return ExternalToolTextResultForLlmContentResource.from_dict(obj) - case _: raise ValueError(f"Unknown ExternalToolTextResultForLlmContent type: {kind!r}") + case "text": + return ExternalToolTextResultForLlmContentText.from_dict(obj) + case "terminal": + return ExternalToolTextResultForLlmContentTerminal.from_dict(obj) + case "image": + return ExternalToolTextResultForLlmContentImage.from_dict(obj) + case "audio": + return ExternalToolTextResultForLlmContentAudio.from_dict(obj) + case "resource_link": + return ExternalToolTextResultForLlmContentResourceLink.from_dict(obj) + case "resource": + return ExternalToolTextResultForLlmContentResource.from_dict(obj) + case _: + raise ValueError(f"Unknown ExternalToolTextResultForLlmContent type: {kind!r}") + # The client's response to the pending permission prompt -PermissionDecision = PermissionDecisionApproveOnce | PermissionDecisionApproveForSession | PermissionDecisionApproveForLocation | PermissionDecisionApprovePermanently | PermissionDecisionReject | PermissionDecisionUserNotAvailable | PermissionDecisionApproved | PermissionDecisionApprovedForSession | PermissionDecisionApprovedForLocation | PermissionDecisionCancelled | PermissionDecisionDeniedByRules | PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser | PermissionDecisionDeniedInteractivelyByUser | PermissionDecisionDeniedByContentExclusionPolicy | PermissionDecisionDeniedByPermissionRequestHook +PermissionDecision = ( + PermissionDecisionApproveOnce + | PermissionDecisionApproveForSession + | PermissionDecisionApproveForLocation + | PermissionDecisionApprovePermanently + | PermissionDecisionReject + | PermissionDecisionUserNotAvailable + | PermissionDecisionApproved + | PermissionDecisionApprovedForSession + | PermissionDecisionApprovedForLocation + | PermissionDecisionCancelled + | PermissionDecisionDeniedByRules + | PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser + | PermissionDecisionDeniedInteractivelyByUser + | PermissionDecisionDeniedByContentExclusionPolicy + | PermissionDecisionDeniedByPermissionRequestHook +) + def _load_PermissionDecision(obj: Any) -> "PermissionDecision": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "approve-once": return PermissionDecisionApproveOnce.from_dict(obj) - case "approve-for-session": return PermissionDecisionApproveForSession.from_dict(obj) - case "approve-for-location": return PermissionDecisionApproveForLocation.from_dict(obj) - case "approve-permanently": return PermissionDecisionApprovePermanently.from_dict(obj) - case "reject": return PermissionDecisionReject.from_dict(obj) - case "user-not-available": return PermissionDecisionUserNotAvailable.from_dict(obj) - case "approved": return PermissionDecisionApproved.from_dict(obj) - case "approved-for-session": return PermissionDecisionApprovedForSession.from_dict(obj) - case "approved-for-location": return PermissionDecisionApprovedForLocation.from_dict(obj) - case "cancelled": return PermissionDecisionCancelled.from_dict(obj) - case "denied-by-rules": return PermissionDecisionDeniedByRules.from_dict(obj) - case "denied-no-approval-rule-and-could-not-request-from-user": return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj) - case "denied-interactively-by-user": return PermissionDecisionDeniedInteractivelyByUser.from_dict(obj) - case "denied-by-content-exclusion-policy": return PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj) - case "denied-by-permission-request-hook": return PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj) - case _: raise ValueError(f"Unknown PermissionDecision kind: {kind!r}") + case "approve-once": + return PermissionDecisionApproveOnce.from_dict(obj) + case "approve-for-session": + return PermissionDecisionApproveForSession.from_dict(obj) + case "approve-for-location": + return PermissionDecisionApproveForLocation.from_dict(obj) + case "approve-permanently": + return PermissionDecisionApprovePermanently.from_dict(obj) + case "reject": + return PermissionDecisionReject.from_dict(obj) + case "user-not-available": + return PermissionDecisionUserNotAvailable.from_dict(obj) + case "approved": + return PermissionDecisionApproved.from_dict(obj) + case "approved-for-session": + return PermissionDecisionApprovedForSession.from_dict(obj) + case "approved-for-location": + return PermissionDecisionApprovedForLocation.from_dict(obj) + case "cancelled": + return PermissionDecisionCancelled.from_dict(obj) + case "denied-by-rules": + return PermissionDecisionDeniedByRules.from_dict(obj) + case "denied-no-approval-rule-and-could-not-request-from-user": + return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj) + case "denied-interactively-by-user": + return PermissionDecisionDeniedInteractivelyByUser.from_dict(obj) + case "denied-by-content-exclusion-policy": + return PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj) + case "denied-by-permission-request-hook": + return PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj) + case _: + raise ValueError(f"Unknown PermissionDecision kind: {kind!r}") -# Approval to persist for this location -PermissionDecisionApproveForLocationApproval = PermissionDecisionApproveForLocationApprovalCommands | PermissionDecisionApproveForLocationApprovalRead | PermissionDecisionApproveForLocationApprovalWrite | PermissionDecisionApproveForLocationApprovalMCP | PermissionDecisionApproveForLocationApprovalMCPSampling | PermissionDecisionApproveForLocationApprovalMemory | PermissionDecisionApproveForLocationApprovalCustomTool | PermissionDecisionApproveForLocationApprovalExtensionManagement | PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess -def _load_PermissionDecisionApproveForLocationApproval(obj: Any) -> "PermissionDecisionApproveForLocationApproval": +# Approval to persist for this location +PermissionDecisionApproveForLocationApproval = ( + PermissionDecisionApproveForLocationApprovalCommands + | PermissionDecisionApproveForLocationApprovalRead + | PermissionDecisionApproveForLocationApprovalWrite + | PermissionDecisionApproveForLocationApprovalMCP + | PermissionDecisionApproveForLocationApprovalMCPSampling + | PermissionDecisionApproveForLocationApprovalMemory + | PermissionDecisionApproveForLocationApprovalCustomTool + | PermissionDecisionApproveForLocationApprovalExtensionManagement + | PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess +) + + +def _load_PermissionDecisionApproveForLocationApproval( + obj: Any, +) -> "PermissionDecisionApproveForLocationApproval": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "commands": return PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj) - case "read": return PermissionDecisionApproveForLocationApprovalRead.from_dict(obj) - case "write": return PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj) - case "mcp": return PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj) - case "mcp-sampling": return PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj) - case "memory": return PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj) - case "custom-tool": return PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj) - case "extension-management": return PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj) - case "extension-permission-access": return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict(obj) - case _: raise ValueError(f"Unknown PermissionDecisionApproveForLocationApproval kind: {kind!r}") + case "commands": + return PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj) + case "read": + return PermissionDecisionApproveForLocationApprovalRead.from_dict(obj) + case "write": + return PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj) + case "mcp": + return PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj) + case "mcp-sampling": + return PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj) + case "memory": + return PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj) + case "custom-tool": + return PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj) + case "extension-management": + return PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj) + case "extension-permission-access": + return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict( + obj + ) + case _: + raise ValueError(f"Unknown PermissionDecisionApproveForLocationApproval kind: {kind!r}") -# Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) -PermissionDecisionApproveForSessionApproval = PermissionDecisionApproveForSessionApprovalCommands | PermissionDecisionApproveForSessionApprovalRead | PermissionDecisionApproveForSessionApprovalWrite | PermissionDecisionApproveForSessionApprovalMCP | PermissionDecisionApproveForSessionApprovalMCPSampling | PermissionDecisionApproveForSessionApprovalMemory | PermissionDecisionApproveForSessionApprovalCustomTool | PermissionDecisionApproveForSessionApprovalExtensionManagement | PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess -def _load_PermissionDecisionApproveForSessionApproval(obj: Any) -> "PermissionDecisionApproveForSessionApproval": +# Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) +PermissionDecisionApproveForSessionApproval = ( + PermissionDecisionApproveForSessionApprovalCommands + | PermissionDecisionApproveForSessionApprovalRead + | PermissionDecisionApproveForSessionApprovalWrite + | PermissionDecisionApproveForSessionApprovalMCP + | PermissionDecisionApproveForSessionApprovalMCPSampling + | PermissionDecisionApproveForSessionApprovalMemory + | PermissionDecisionApproveForSessionApprovalCustomTool + | PermissionDecisionApproveForSessionApprovalExtensionManagement + | PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess +) + + +def _load_PermissionDecisionApproveForSessionApproval( + obj: Any, +) -> "PermissionDecisionApproveForSessionApproval": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "commands": return PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj) - case "read": return PermissionDecisionApproveForSessionApprovalRead.from_dict(obj) - case "write": return PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj) - case "mcp": return PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj) - case "mcp-sampling": return PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj) - case "memory": return PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj) - case "custom-tool": return PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj) - case "extension-management": return PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj) - case "extension-permission-access": return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict(obj) - case _: raise ValueError(f"Unknown PermissionDecisionApproveForSessionApproval kind: {kind!r}") + case "commands": + return PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj) + case "read": + return PermissionDecisionApproveForSessionApprovalRead.from_dict(obj) + case "write": + return PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj) + case "mcp": + return PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj) + case "mcp-sampling": + return PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj) + case "memory": + return PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj) + case "custom-tool": + return PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj) + case "extension-management": + return PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj) + case "extension-permission-access": + return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict( + obj + ) + case _: + raise ValueError(f"Unknown PermissionDecisionApproveForSessionApproval kind: {kind!r}") -# Tool approval to persist and apply -PermissionsLocationsAddToolApprovalDetails = PermissionsLocationsAddToolApprovalDetailsCommands | PermissionsLocationsAddToolApprovalDetailsRead | PermissionsLocationsAddToolApprovalDetailsWrite | PermissionsLocationsAddToolApprovalDetailsMCP | PermissionsLocationsAddToolApprovalDetailsMCPSampling | PermissionsLocationsAddToolApprovalDetailsMemory | PermissionsLocationsAddToolApprovalDetailsCustomTool | PermissionsLocationsAddToolApprovalDetailsExtensionManagement | PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess -def _load_PermissionsLocationsAddToolApprovalDetails(obj: Any) -> "PermissionsLocationsAddToolApprovalDetails": +# Tool approval to persist and apply +PermissionsLocationsAddToolApprovalDetails = ( + PermissionsLocationsAddToolApprovalDetailsCommands + | PermissionsLocationsAddToolApprovalDetailsRead + | PermissionsLocationsAddToolApprovalDetailsWrite + | PermissionsLocationsAddToolApprovalDetailsMCP + | PermissionsLocationsAddToolApprovalDetailsMCPSampling + | PermissionsLocationsAddToolApprovalDetailsMemory + | PermissionsLocationsAddToolApprovalDetailsCustomTool + | PermissionsLocationsAddToolApprovalDetailsExtensionManagement + | PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess +) + + +def _load_PermissionsLocationsAddToolApprovalDetails( + obj: Any, +) -> "PermissionsLocationsAddToolApprovalDetails": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "commands": return PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj) - case "read": return PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj) - case "write": return PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj) - case "mcp": return PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj) - case "mcp-sampling": return PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj) - case "memory": return PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj) - case "custom-tool": return PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj) - case "extension-management": return PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj) - case "extension-permission-access": return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict(obj) - case _: raise ValueError(f"Unknown PermissionsLocationsAddToolApprovalDetails kind: {kind!r}") + case "commands": + return PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj) + case "read": + return PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj) + case "write": + return PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj) + case "mcp": + return PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj) + case "mcp-sampling": + return PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj) + case "memory": + return PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj) + case "custom-tool": + return PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj) + case "extension-management": + return PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj) + case "extension-permission-access": + return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict( + obj + ) + case _: + raise ValueError(f"Unknown PermissionsLocationsAddToolApprovalDetails kind: {kind!r}") + # Result of the queued command execution. QueuedCommandResult = QueuedCommandHandled | QueuedCommandNotHandled + def _load_QueuedCommandResult(obj: Any) -> "QueuedCommandResult": assert isinstance(obj, dict) kind = obj.get("handled") match kind: - case "true": return QueuedCommandHandled.from_dict(obj) - case "false": return QueuedCommandNotHandled.from_dict(obj) - case _: raise ValueError(f"Unknown QueuedCommandResult handled: {kind!r}") + case "true": + return QueuedCommandHandled.from_dict(obj) + case "false": + return QueuedCommandNotHandled.from_dict(obj) + case _: + raise ValueError(f"Unknown QueuedCommandResult handled: {kind!r}") + # A user message attachment — a file, directory, code selection, blob, or GitHub reference -SendAttachment = SendAttachmentFile | SendAttachmentDirectory | SendAttachmentSelection | SendAttachmentGithubReference | SendAttachmentBlob +SendAttachment = ( + SendAttachmentFile + | SendAttachmentDirectory + | SendAttachmentSelection + | SendAttachmentGithubReference + | SendAttachmentBlob +) + def _load_SendAttachment(obj: Any) -> "SendAttachment": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "file": return SendAttachmentFile.from_dict(obj) - case "directory": return SendAttachmentDirectory.from_dict(obj) - case "selection": return SendAttachmentSelection.from_dict(obj) - case "github_reference": return SendAttachmentGithubReference.from_dict(obj) - case "blob": return SendAttachmentBlob.from_dict(obj) - case _: raise ValueError(f"Unknown SendAttachment type: {kind!r}") + case "file": + return SendAttachmentFile.from_dict(obj) + case "directory": + return SendAttachmentDirectory.from_dict(obj) + case "selection": + return SendAttachmentSelection.from_dict(obj) + case "github_reference": + return SendAttachmentGithubReference.from_dict(obj) + case "blob": + return SendAttachmentBlob.from_dict(obj) + case _: + raise ValueError(f"Unknown SendAttachment type: {kind!r}") + # Result of invoking the slash command (text output, prompt to send to the agent, or completion). -SlashCommandInvocationResult = SlashCommandTextResult | SlashCommandAgentPromptResult | SlashCommandCompletedResult | SlashCommandSelectSubcommandResult +SlashCommandInvocationResult = ( + SlashCommandTextResult + | SlashCommandAgentPromptResult + | SlashCommandCompletedResult + | SlashCommandSelectSubcommandResult +) + def _load_SlashCommandInvocationResult(obj: Any) -> "SlashCommandInvocationResult": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "text": return SlashCommandTextResult.from_dict(obj) - case "agent-prompt": return SlashCommandAgentPromptResult.from_dict(obj) - case "completed": return SlashCommandCompletedResult.from_dict(obj) - case "select-subcommand": return SlashCommandSelectSubcommandResult.from_dict(obj) - case _: raise ValueError(f"Unknown SlashCommandInvocationResult kind: {kind!r}") + case "text": + return SlashCommandTextResult.from_dict(obj) + case "agent-prompt": + return SlashCommandAgentPromptResult.from_dict(obj) + case "completed": + return SlashCommandCompletedResult.from_dict(obj) + case "select-subcommand": + return SlashCommandSelectSubcommandResult.from_dict(obj) + case _: + raise ValueError(f"Unknown SlashCommandInvocationResult kind: {kind!r}") + # Schema for the `TaskInfo` type. TaskInfo = TaskAgentInfo | TaskShellInfo + def _load_TaskInfo(obj: Any) -> "TaskInfo": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "agent": return TaskAgentInfo.from_dict(obj) - case "shell": return TaskShellInfo.from_dict(obj) - case _: raise ValueError(f"Unknown TaskInfo type: {kind!r}") + case "agent": + return TaskAgentInfo.from_dict(obj) + case "shell": + return TaskShellInfo.from_dict(obj) + case _: + raise ValueError(f"Unknown TaskInfo type: {kind!r}") +CanvasInvokeActionResult = Any CanvasJsonSchema = Any ExternalToolResult = ExternalToolTextResultForLlm ExternalToolTextResultForLlmContentResourceLinkIconTheme = Theme @@ -16438,12 +21121,14 @@ def _load_TaskInfo(obj: Any) -> "TaskInfo": WorkspaceSummaryHostType = HostType WorkspacesWorkspaceDetailsHostType = HostType + def _timeout_kwargs(timeout: float | None) -> dict: """Build keyword arguments for optional timeout forwarding.""" if timeout is not None: return {"timeout": timeout} return {} + def _patch_model_capabilities(data: dict) -> dict: """Ensure model capabilities have required fields. @@ -16473,7 +21158,11 @@ def __init__(self, client: "JsonRpcClient"): async def list(self, params: ModelsListRequest, *, timeout: float | None = None) -> ModelList: "Lists Copilot models available to the authenticated user.\n\nArgs:\n params: Optional GitHub token used to list models for a specific user instead of the global auth context.\n\nReturns:\n List of Copilot models available to the resolved user, including capabilities and billing metadata." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return ModelList.from_dict(_patch_model_capabilities(await self._client.request("models.list", params_dict, **_timeout_kwargs(timeout)))) + return ModelList.from_dict( + _patch_model_capabilities( + await self._client.request("models.list", params_dict, **_timeout_kwargs(timeout)) + ) + ) class ServerToolsApi: @@ -16483,27 +21172,39 @@ def __init__(self, client: "JsonRpcClient"): async def list(self, params: ToolsListRequest, *, timeout: float | None = None) -> ToolList: "Lists built-in tools available for a model.\n\nArgs:\n params: Optional model identifier whose tool overrides should be applied to the listing.\n\nReturns:\n Built-in tools available for the requested model, with their parameters and instructions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return ToolList.from_dict(await self._client.request("tools.list", params_dict, **_timeout_kwargs(timeout))) + return ToolList.from_dict( + await self._client.request("tools.list", params_dict, **_timeout_kwargs(timeout)) + ) class ServerAccountApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def get_quota(self, params: AccountGetQuotaRequest, *, timeout: float | None = None) -> AccountGetQuotaResult: + async def get_quota( + self, params: AccountGetQuotaRequest, *, timeout: float | None = None + ) -> AccountGetQuotaResult: "Gets Copilot quota usage for the authenticated user or supplied GitHub token.\n\nArgs:\n params: Optional GitHub token used to look up quota for a specific user instead of the global auth context.\n\nReturns:\n Quota usage snapshots for the resolved user, keyed by quota type." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return AccountGetQuotaResult.from_dict(await self._client.request("account.getQuota", params_dict, **_timeout_kwargs(timeout))) + return AccountGetQuotaResult.from_dict( + await self._client.request("account.getQuota", params_dict, **_timeout_kwargs(timeout)) + ) class ServerSecretsApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def add_filter_values(self, params: SecretsAddFilterValuesRequest, *, timeout: float | None = None) -> SecretsAddFilterValuesResult: + async def add_filter_values( + self, params: SecretsAddFilterValuesRequest, *, timeout: float | None = None + ) -> SecretsAddFilterValuesResult: "Registers secret values for redaction in session logs and exports. The SDK calls this to inject dynamically generated secret values (e.g., OIDC tokens).\n\nArgs:\n params: Secret values to add to the redaction filter.\n\nReturns:\n Confirmation that the secret values were registered." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SecretsAddFilterValuesResult.from_dict(await self._client.request("secrets.addFilterValues", params_dict, **_timeout_kwargs(timeout))) + return SecretsAddFilterValuesResult.from_dict( + await self._client.request( + "secrets.addFilterValues", params_dict, **_timeout_kwargs(timeout) + ) + ) class ServerMcpConfigApi: @@ -16512,7 +21213,9 @@ def __init__(self, client: "JsonRpcClient"): async def list(self, *, timeout: float | None = None) -> MCPConfigList: "Lists MCP servers from user configuration.\n\nReturns:\n User-configured MCP servers, keyed by server name." - return MCPConfigList.from_dict(await self._client.request("mcp.config.list", {}, **_timeout_kwargs(timeout))) + return MCPConfigList.from_dict( + await self._client.request("mcp.config.list", {}, **_timeout_kwargs(timeout)) + ) async def add(self, params: MCPConfigAddRequest, *, timeout: float | None = None) -> None: "Adds an MCP server to user configuration.\n\nArgs:\n params: MCP server name and configuration to add to user configuration." @@ -16534,7 +21237,9 @@ async def enable(self, params: MCPConfigEnableRequest, *, timeout: float | None params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.enable", params_dict, **_timeout_kwargs(timeout)) - async def disable(self, params: MCPConfigDisableRequest, *, timeout: float | None = None) -> None: + async def disable( + self, params: MCPConfigDisableRequest, *, timeout: float | None = None + ) -> None: "Disables MCP servers in user configuration for new sessions.\n\nArgs:\n params: MCP server names to disable for new sessions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.disable", params_dict, **_timeout_kwargs(timeout)) @@ -16545,20 +21250,28 @@ def __init__(self, client: "JsonRpcClient"): self._client = client self.config = ServerMcpConfigApi(client) - async def discover(self, params: MCPDiscoverRequest, *, timeout: float | None = None) -> MCPDiscoverResult: + async def discover( + self, params: MCPDiscoverRequest, *, timeout: float | None = None + ) -> MCPDiscoverResult: "Discovers MCP servers from user, workspace, plugin, and builtin sources.\n\nArgs:\n params: Optional working directory used as context for MCP server discovery.\n\nReturns:\n MCP servers discovered from user, workspace, plugin, and built-in sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return MCPDiscoverResult.from_dict(await self._client.request("mcp.discover", params_dict, **_timeout_kwargs(timeout))) + return MCPDiscoverResult.from_dict( + await self._client.request("mcp.discover", params_dict, **_timeout_kwargs(timeout)) + ) class ServerSkillsConfigApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def set_disabled_skills(self, params: SkillsConfigSetDisabledSkillsRequest, *, timeout: float | None = None) -> None: + async def set_disabled_skills( + self, params: SkillsConfigSetDisabledSkillsRequest, *, timeout: float | None = None + ) -> None: "Replaces the global list of disabled skills.\n\nArgs:\n params: Skill names to mark as disabled in global configuration, replacing any previous list." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - await self._client.request("skills.config.setDisabledSkills", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "skills.config.setDisabledSkills", params_dict, **_timeout_kwargs(timeout) + ) class ServerSkillsApi: @@ -16566,20 +21279,30 @@ def __init__(self, client: "JsonRpcClient"): self._client = client self.config = ServerSkillsConfigApi(client) - async def discover(self, params: SkillsDiscoverRequest, *, timeout: float | None = None) -> ServerSkillList: + async def discover( + self, params: SkillsDiscoverRequest, *, timeout: float | None = None + ) -> ServerSkillList: "Discovers skills across global and project sources.\n\nArgs:\n params: Optional project paths and additional skill directories to include in discovery.\n\nReturns:\n Skills discovered across global and project sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return ServerSkillList.from_dict(await self._client.request("skills.discover", params_dict, **_timeout_kwargs(timeout))) + return ServerSkillList.from_dict( + await self._client.request("skills.discover", params_dict, **_timeout_kwargs(timeout)) + ) class ServerSessionFsApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def set_provider(self, params: SessionFSSetProviderRequest, *, timeout: float | None = None) -> SessionFSSetProviderResult: + async def set_provider( + self, params: SessionFSSetProviderRequest, *, timeout: float | None = None + ) -> SessionFSSetProviderResult: "Registers an SDK client as the session filesystem provider.\n\nArgs:\n params: Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider.\n\nReturns:\n Indicates whether the calling client was registered as the session filesystem provider." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionFSSetProviderResult.from_dict(await self._client.request("sessionFs.setProvider", params_dict, **_timeout_kwargs(timeout))) + return SessionFSSetProviderResult.from_dict( + await self._client.request( + "sessionFs.setProvider", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16587,103 +21310,202 @@ class ServerSessionsApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def fork(self, params: SessionsForkRequest, *, timeout: float | None = None) -> SessionsForkResult: + async def fork( + self, params: SessionsForkRequest, *, timeout: float | None = None + ) -> SessionsForkResult: "Creates a new session by forking persisted history from an existing session.\n\nArgs:\n params: Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session.\n\nReturns:\n Identifier and optional friendly name assigned to the newly forked session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsForkResult.from_dict(await self._client.request("sessions.fork", params_dict, **_timeout_kwargs(timeout))) + return SessionsForkResult.from_dict( + await self._client.request("sessions.fork", params_dict, **_timeout_kwargs(timeout)) + ) - async def connect(self, params: ConnectRemoteSessionParams, *, timeout: float | None = None) -> RemoteSessionConnectionResult: + async def connect( + self, params: ConnectRemoteSessionParams, *, timeout: float | None = None + ) -> RemoteSessionConnectionResult: "Connects to an existing remote session and exposes it as an SDK session.\n\nArgs:\n params: Remote session connection parameters.\n\nReturns:\n Remote session connection result." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return RemoteSessionConnectionResult.from_dict(await self._client.request("sessions.connect", params_dict, **_timeout_kwargs(timeout))) + return RemoteSessionConnectionResult.from_dict( + await self._client.request("sessions.connect", params_dict, **_timeout_kwargs(timeout)) + ) - async def list(self, params: SessionsListRequest, *, timeout: float | None = None) -> SessionList: + async def list( + self, params: SessionsListRequest, *, timeout: float | None = None + ) -> SessionList: "Lists persisted sessions, optionally filtered by working-directory context.\n\nArgs:\n params: Optional metadata-load limit and context filter applied to the returned sessions.\n\nReturns:\n Persisted sessions matching the filter, ordered most-recently-modified first." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionList.from_dict(await self._client.request("sessions.list", params_dict, **_timeout_kwargs(timeout))) + return SessionList.from_dict( + await self._client.request("sessions.list", params_dict, **_timeout_kwargs(timeout)) + ) - async def find_by_task_id(self, params: SessionsFindByTaskIDRequest, *, timeout: float | None = None) -> SessionsFindByTaskIDResult: + async def find_by_task_id( + self, params: SessionsFindByTaskIDRequest, *, timeout: float | None = None + ) -> SessionsFindByTaskIDResult: "Finds the local session bound to a GitHub task ID, if any.\n\nArgs:\n params: GitHub task ID to look up.\n\nReturns:\n ID of the local session bound to the given GitHub task, or omitted when none." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsFindByTaskIDResult.from_dict(await self._client.request("sessions.findByTaskId", params_dict, **_timeout_kwargs(timeout))) - - async def find_by_prefix(self, params: SessionsFindByPrefixRequest, *, timeout: float | None = None) -> SessionsFindByPrefixResult: + return SessionsFindByTaskIDResult.from_dict( + await self._client.request( + "sessions.findByTaskId", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def find_by_prefix( + self, params: SessionsFindByPrefixRequest, *, timeout: float | None = None + ) -> SessionsFindByPrefixResult: "Resolves a UUID prefix to a unique session ID, if exactly one session matches.\n\nArgs:\n params: UUID prefix to resolve to a unique session ID.\n\nReturns:\n Session ID matching the prefix, omitted when no unique match exists." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsFindByPrefixResult.from_dict(await self._client.request("sessions.findByPrefix", params_dict, **_timeout_kwargs(timeout))) - - async def get_last_for_context(self, params: SessionsGetLastForContextRequest, *, timeout: float | None = None) -> SessionsGetLastForContextResult: + return SessionsFindByPrefixResult.from_dict( + await self._client.request( + "sessions.findByPrefix", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def get_last_for_context( + self, params: SessionsGetLastForContextRequest, *, timeout: float | None = None + ) -> SessionsGetLastForContextResult: "Returns the most-relevant prior session for a given working-directory context.\n\nArgs:\n params: Optional working-directory context used to score session relevance.\n\nReturns:\n Most-relevant session ID for the supplied context, or omitted when no sessions exist." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsGetLastForContextResult.from_dict(await self._client.request("sessions.getLastForContext", params_dict, **_timeout_kwargs(timeout))) - - async def get_event_file_path(self, params: SessionsGetEventFilePathRequest, *, timeout: float | None = None) -> SessionsGetEventFilePathResult: + return SessionsGetLastForContextResult.from_dict( + await self._client.request( + "sessions.getLastForContext", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def get_event_file_path( + self, params: SessionsGetEventFilePathRequest, *, timeout: float | None = None + ) -> SessionsGetEventFilePathResult: "Computes the absolute path to a session's persisted events.jsonl file.\n\nArgs:\n params: Session ID whose event-log file path to compute.\n\nReturns:\n Absolute path to the session's events.jsonl file on disk." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsGetEventFilePathResult.from_dict(await self._client.request("sessions.getEventFilePath", params_dict, **_timeout_kwargs(timeout))) + return SessionsGetEventFilePathResult.from_dict( + await self._client.request( + "sessions.getEventFilePath", params_dict, **_timeout_kwargs(timeout) + ) + ) async def get_sizes(self, *, timeout: float | None = None) -> SessionSizes: "Returns the on-disk byte size of each session's workspace directory.\n\nReturns:\n Map of sessionId -> on-disk size in bytes for each session's workspace directory." - return SessionSizes.from_dict(await self._client.request("sessions.getSizes", {}, **_timeout_kwargs(timeout))) + return SessionSizes.from_dict( + await self._client.request("sessions.getSizes", {}, **_timeout_kwargs(timeout)) + ) - async def check_in_use(self, params: SessionsCheckInUseRequest, *, timeout: float | None = None) -> SessionsCheckInUseResult: + async def check_in_use( + self, params: SessionsCheckInUseRequest, *, timeout: float | None = None + ) -> SessionsCheckInUseResult: "Returns the subset of the supplied session IDs that are currently held by another running process.\n\nArgs:\n params: Session IDs to test for live in-use locks.\n\nReturns:\n Session IDs from the input set that are currently in use by another process." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsCheckInUseResult.from_dict(await self._client.request("sessions.checkInUse", params_dict, **_timeout_kwargs(timeout))) - - async def get_persisted_remote_steerable(self, params: SessionsGetPersistedRemoteSteerableRequest, *, timeout: float | None = None) -> SessionsGetPersistedRemoteSteerableResult: + return SessionsCheckInUseResult.from_dict( + await self._client.request( + "sessions.checkInUse", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def get_persisted_remote_steerable( + self, params: SessionsGetPersistedRemoteSteerableRequest, *, timeout: float | None = None + ) -> SessionsGetPersistedRemoteSteerableResult: "Returns a session's persisted remote-steerable flag, if any has been recorded.\n\nArgs:\n params: Session ID to look up the persisted remote-steerable flag for.\n\nReturns:\n The session's persisted remote-steerable flag, or omitted when no value has been persisted." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsGetPersistedRemoteSteerableResult.from_dict(await self._client.request("sessions.getPersistedRemoteSteerable", params_dict, **_timeout_kwargs(timeout))) - - async def close(self, params: SessionsCloseRequest, *, timeout: float | None = None) -> SessionsCloseResult: + return SessionsGetPersistedRemoteSteerableResult.from_dict( + await self._client.request( + "sessions.getPersistedRemoteSteerable", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def close( + self, params: SessionsCloseRequest, *, timeout: float | None = None + ) -> SessionsCloseResult: "Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session.\n\nArgs:\n params: Session ID to close.\n\nReturns:\n Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsCloseResult.from_dict(await self._client.request("sessions.close", params_dict, **_timeout_kwargs(timeout))) + return SessionsCloseResult.from_dict( + await self._client.request("sessions.close", params_dict, **_timeout_kwargs(timeout)) + ) - async def bulk_delete(self, params: SessionsBulkDeleteRequest, *, timeout: float | None = None) -> SessionBulkDeleteResult: + async def bulk_delete( + self, params: SessionsBulkDeleteRequest, *, timeout: float | None = None + ) -> SessionBulkDeleteResult: "Closes, deactivates, and deletes a set of sessions, returning the bytes freed per session.\n\nArgs:\n params: Session IDs to close, deactivate, and delete from disk.\n\nReturns:\n Map of sessionId -> bytes freed by removing the session's workspace directory." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionBulkDeleteResult.from_dict(await self._client.request("sessions.bulkDelete", params_dict, **_timeout_kwargs(timeout))) - - async def prune_old(self, params: SessionsPruneOldRequest, *, timeout: float | None = None) -> SessionPruneResult: + return SessionBulkDeleteResult.from_dict( + await self._client.request( + "sessions.bulkDelete", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def prune_old( + self, params: SessionsPruneOldRequest, *, timeout: float | None = None + ) -> SessionPruneResult: "Deletes sessions older than the given threshold, with optional dry-run and exclusion list.\n\nArgs:\n params: Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true).\n\nReturns:\n Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionPruneResult.from_dict(await self._client.request("sessions.pruneOld", params_dict, **_timeout_kwargs(timeout))) + return SessionPruneResult.from_dict( + await self._client.request("sessions.pruneOld", params_dict, **_timeout_kwargs(timeout)) + ) - async def save(self, params: SessionsSaveRequest, *, timeout: float | None = None) -> SessionsSaveResult: + async def save( + self, params: SessionsSaveRequest, *, timeout: float | None = None + ) -> SessionsSaveResult: "Flushes a session's pending events to disk.\n\nArgs:\n params: Session ID whose pending events should be flushed to disk.\n\nReturns:\n Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed)." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsSaveResult.from_dict(await self._client.request("sessions.save", params_dict, **_timeout_kwargs(timeout))) + return SessionsSaveResult.from_dict( + await self._client.request("sessions.save", params_dict, **_timeout_kwargs(timeout)) + ) - async def release_lock(self, params: SessionsReleaseLockRequest, *, timeout: float | None = None) -> SessionsReleaseLockResult: + async def release_lock( + self, params: SessionsReleaseLockRequest, *, timeout: float | None = None + ) -> SessionsReleaseLockResult: "Releases the in-use lock held by this process for a session.\n\nArgs:\n params: Session ID whose in-use lock should be released.\n\nReturns:\n Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsReleaseLockResult.from_dict(await self._client.request("sessions.releaseLock", params_dict, **_timeout_kwargs(timeout))) - - async def enrich_metadata(self, params: SessionsEnrichMetadataRequest, *, timeout: float | None = None) -> SessionEnrichMetadataResult: + return SessionsReleaseLockResult.from_dict( + await self._client.request( + "sessions.releaseLock", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def enrich_metadata( + self, params: SessionsEnrichMetadataRequest, *, timeout: float | None = None + ) -> SessionEnrichMetadataResult: "Backfills missing summary and context fields on the supplied session metadata records.\n\nArgs:\n params: Session metadata records to enrich with summary and context information.\n\nReturns:\n The same metadata records, with summary and context fields backfilled where available." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionEnrichMetadataResult.from_dict(await self._client.request("sessions.enrichMetadata", params_dict, **_timeout_kwargs(timeout))) - - async def reload_plugin_hooks(self, params: SessionsReloadPluginHooksRequest, *, timeout: float | None = None) -> SessionsReloadPluginHooksResult: + return SessionEnrichMetadataResult.from_dict( + await self._client.request( + "sessions.enrichMetadata", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def reload_plugin_hooks( + self, params: SessionsReloadPluginHooksRequest, *, timeout: float | None = None + ) -> SessionsReloadPluginHooksResult: "Reloads user, plugin, and (optionally) repo hooks on the active session.\n\nArgs:\n params: Active session ID and an optional flag for deferring repo-level hooks until folder trust.\n\nReturns:\n Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsReloadPluginHooksResult.from_dict(await self._client.request("sessions.reloadPluginHooks", params_dict, **_timeout_kwargs(timeout))) - - async def load_deferred_repo_hooks(self, params: SessionsLoadDeferredRepoHooksRequest, *, timeout: float | None = None) -> SessionLoadDeferredRepoHooksResult: + return SessionsReloadPluginHooksResult.from_dict( + await self._client.request( + "sessions.reloadPluginHooks", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def load_deferred_repo_hooks( + self, params: SessionsLoadDeferredRepoHooksRequest, *, timeout: float | None = None + ) -> SessionLoadDeferredRepoHooksResult: "Loads previously-deferred repo-level hooks on the active session, returning queued startup prompts.\n\nArgs:\n params: Active session ID whose deferred repo-level hooks should be loaded.\n\nReturns:\n Queued repo-level startup prompts and the total hook command count after loading." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionLoadDeferredRepoHooksResult.from_dict(await self._client.request("sessions.loadDeferredRepoHooks", params_dict, **_timeout_kwargs(timeout))) - - async def set_additional_plugins(self, params: SessionsSetAdditionalPluginsRequest, *, timeout: float | None = None) -> SessionsSetAdditionalPluginsResult: + return SessionLoadDeferredRepoHooksResult.from_dict( + await self._client.request( + "sessions.loadDeferredRepoHooks", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def set_additional_plugins( + self, params: SessionsSetAdditionalPluginsRequest, *, timeout: float | None = None + ) -> SessionsSetAdditionalPluginsResult: "Replaces the manager-wide additional plugins registered with the session manager.\n\nArgs:\n params: Manager-wide additional plugins to register; replaces any previously-configured set.\n\nReturns:\n Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsSetAdditionalPluginsResult.from_dict(await self._client.request("sessions.setAdditionalPlugins", params_dict, **_timeout_kwargs(timeout))) + return SessionsSetAdditionalPluginsResult.from_dict( + await self._client.request( + "sessions.setAdditionalPlugins", params_dict, **_timeout_kwargs(timeout) + ) + ) class ServerRpc: """Typed server-scoped RPC methods.""" + def __init__(self, client: "JsonRpcClient"): self._client = client self.models = ServerModelsApi(client) @@ -16698,18 +21520,25 @@ def __init__(self, client: "JsonRpcClient"): async def ping(self, params: PingRequest, *, timeout: float | None = None) -> PingResult: "Checks server responsiveness and returns protocol information.\n\nArgs:\n params: Optional message to echo back to the caller.\n\nReturns:\n Server liveness response, including the echoed message, current server timestamp, and protocol version." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return PingResult.from_dict(await self._client.request("ping", params_dict, **_timeout_kwargs(timeout))) + return PingResult.from_dict( + await self._client.request("ping", params_dict, **_timeout_kwargs(timeout)) + ) class _InternalServerRpc: """Internal SDK server-scoped RPC methods. Not part of the public API.""" + def __init__(self, client: "JsonRpcClient"): self._client = client - async def _connect(self, params: _ConnectRequest, *, timeout: float | None = None) -> _ConnectResult: + async def _connect( + self, params: _ConnectRequest, *, timeout: float | None = None + ) -> _ConnectResult: "Performs the SDK server connection handshake and validates the optional connection token.\n\nArgs:\n params: Optional connection token presented by the SDK client during the handshake.\n\nReturns:\n Handshake result reporting the server's protocol version and package version on success.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return _ConnectResult.from_dict(await self._client.request("connect", params_dict, **_timeout_kwargs(timeout))) + return _ConnectResult.from_dict( + await self._client.request("connect", params_dict, **_timeout_kwargs(timeout)) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16720,13 +21549,25 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_status(self, *, timeout: float | None = None) -> SessionAuthStatus: "Gets authentication status and account metadata for the session.\n\nReturns:\n Authentication status and account metadata for the session." - return SessionAuthStatus.from_dict(await self._client.request("session.auth.getStatus", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def set_credentials(self, params: SessionSetCredentialsParams, *, timeout: float | None = None) -> SessionSetCredentialsResult: + return SessionAuthStatus.from_dict( + await self._client.request( + "session.auth.getStatus", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def set_credentials( + self, params: SessionSetCredentialsParams, *, timeout: float | None = None + ) -> SessionSetCredentialsResult: "Updates the session's auth credentials used for outbound model and API requests.\n\nArgs:\n params: New auth credentials to install on the session. Omit to leave credentials unchanged.\n\nReturns:\n Indicates whether the credential update succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SessionSetCredentialsResult.from_dict(await self._client.request("session.auth.setCredentials", params_dict, **_timeout_kwargs(timeout))) + return SessionSetCredentialsResult.from_dict( + await self._client.request( + "session.auth.setCredentials", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16737,17 +21578,33 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> CanvasList: "Lists canvases declared for the session.\n\nReturns:\n Declared canvases available in this session." - return CanvasList.from_dict(await self._client.request("session.canvas.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return CanvasList.from_dict( + await self._client.request( + "session.canvas.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def list_open(self, *, timeout: float | None = None) -> CanvasListOpenResult: "Lists currently open canvas instances for the live session.\n\nReturns:\n Live open-canvas snapshot." - return CanvasListOpenResult.from_dict(await self._client.request("session.canvas.listOpen", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def open(self, params: CanvasOpenRequest, *, timeout: float | None = None) -> OpenCanvasInstance: + return CanvasListOpenResult.from_dict( + await self._client.request( + "session.canvas.listOpen", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def open( + self, params: CanvasOpenRequest, *, timeout: float | None = None + ) -> OpenCanvasInstance: "Opens or focuses a canvas instance.\n\nArgs:\n params: Canvas open parameters.\n\nReturns:\n Open canvas instance snapshot." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return OpenCanvasInstance.from_dict(await self._client.request("session.canvas.open", params_dict, **_timeout_kwargs(timeout))) + return OpenCanvasInstance.from_dict( + await self._client.request( + "session.canvas.open", params_dict, **_timeout_kwargs(timeout) + ) + ) async def close(self, params: CanvasCloseRequest, *, timeout: float | None = None) -> None: "Closes an open canvas instance.\n\nArgs:\n params: Canvas close parameters." @@ -16755,11 +21612,15 @@ async def close(self, params: CanvasCloseRequest, *, timeout: float | None = Non params_dict["sessionId"] = self._session_id await self._client.request("session.canvas.close", params_dict, **_timeout_kwargs(timeout)) - async def invoke_action(self, params: CanvasInvokeActionRequest, *, timeout: float | None = None) -> CanvasInvokeActionResult: + async def invoke_action( + self, params: CanvasInvokeActionRequest, *, timeout: float | None = None + ) -> Any: "Invokes an action on an open canvas instance.\n\nArgs:\n params: Canvas action invocation parameters.\n\nReturns:\n Canvas action invocation result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return CanvasInvokeActionResult.from_dict(await self._client.request("session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout))) + return await self._client.request( + "session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16770,19 +21631,37 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_current(self, *, timeout: float | None = None) -> CurrentModel: "Gets the currently selected model for the session.\n\nReturns:\n The currently selected model and reasoning effort for the session." - return CurrentModel.from_dict(await self._client.request("session.model.getCurrent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def switch_to(self, params: ModelSwitchToRequest, *, timeout: float | None = None) -> ModelSwitchToResult: + return CurrentModel.from_dict( + await self._client.request( + "session.model.getCurrent", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def switch_to( + self, params: ModelSwitchToRequest, *, timeout: float | None = None + ) -> ModelSwitchToResult: "Switches the session to a model and optional reasoning configuration.\n\nArgs:\n params: Target model identifier and optional reasoning effort, summary, and capability overrides.\n\nReturns:\n The model identifier active on the session after the switch." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ModelSwitchToResult.from_dict(await self._client.request("session.model.switchTo", params_dict, **_timeout_kwargs(timeout))) - - async def set_reasoning_effort(self, params: ModelSetReasoningEffortRequest, *, timeout: float | None = None) -> ModelSetReasoningEffortResult: + return ModelSwitchToResult.from_dict( + await self._client.request( + "session.model.switchTo", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def set_reasoning_effort( + self, params: ModelSetReasoningEffortRequest, *, timeout: float | None = None + ) -> ModelSetReasoningEffortResult: "Updates the session's reasoning effort without changing the selected model.\n\nArgs:\n params: Reasoning effort level to apply to the currently selected model.\n\nReturns:\n Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ModelSetReasoningEffortResult.from_dict(await self._client.request("session.model.setReasoningEffort", params_dict, **_timeout_kwargs(timeout))) + return ModelSetReasoningEffortResult.from_dict( + await self._client.request( + "session.model.setReasoningEffort", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16793,7 +21672,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get(self, *, timeout: float | None = None) -> SessionMode: "Gets the current agent interaction mode.\n\nReturns:\n The session mode the agent is operating in" - return SessionMode(await self._client.request("session.mode.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return SessionMode( + await self._client.request( + "session.mode.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def set(self, params: ModeSetRequest, *, timeout: float | None = None) -> None: "Sets the current agent interaction mode.\n\nArgs:\n params: Agent interaction mode to apply to the session." @@ -16810,7 +21693,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get(self, *, timeout: float | None = None) -> NameGetResult: "Gets the session's friendly name.\n\nReturns:\n The session's friendly name, or null when not yet set." - return NameGetResult.from_dict(await self._client.request("session.name.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return NameGetResult.from_dict( + await self._client.request( + "session.name.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def set(self, params: NameSetRequest, *, timeout: float | None = None) -> None: "Sets the session's friendly name.\n\nArgs:\n params: New friendly name to apply to the session." @@ -16818,11 +21705,17 @@ async def set(self, params: NameSetRequest, *, timeout: float | None = None) -> params_dict["sessionId"] = self._session_id await self._client.request("session.name.set", params_dict, **_timeout_kwargs(timeout)) - async def set_auto(self, params: NameSetAutoRequest, *, timeout: float | None = None) -> NameSetAutoResult: + async def set_auto( + self, params: NameSetAutoRequest, *, timeout: float | None = None + ) -> NameSetAutoResult: "Persists an auto-generated session summary as the session's name when no user-set name exists.\n\nArgs:\n params: Auto-generated session summary to apply as the session's name when no user-set name exists.\n\nReturns:\n Indicates whether the auto-generated summary was applied as the session's name." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return NameSetAutoResult.from_dict(await self._client.request("session.name.setAuto", params_dict, **_timeout_kwargs(timeout))) + return NameSetAutoResult.from_dict( + await self._client.request( + "session.name.setAuto", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16833,7 +21726,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def read(self, *, timeout: float | None = None) -> PlanReadResult: "Reads the session plan file from the workspace.\n\nReturns:\n Existence, contents, and resolved path of the session plan file." - return PlanReadResult.from_dict(await self._client.request("session.plan.read", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return PlanReadResult.from_dict( + await self._client.request( + "session.plan.read", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def update(self, params: PlanUpdateRequest, *, timeout: float | None = None) -> None: "Writes new content to the session plan file.\n\nArgs:\n params: Replacement contents to write to the session plan file." @@ -16843,7 +21740,9 @@ async def update(self, params: PlanUpdateRequest, *, timeout: float | None = Non async def delete(self, *, timeout: float | None = None) -> None: "Deletes the session plan file from the workspace." - await self._client.request("session.plan.delete", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.plan.delete", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16854,45 +21753,93 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_workspace(self, *, timeout: float | None = None) -> WorkspacesGetWorkspaceResult: "Gets current workspace metadata for the session.\n\nReturns:\n Current workspace metadata for the session, including its absolute filesystem path when available." - return WorkspacesGetWorkspaceResult.from_dict(await self._client.request("session.workspaces.getWorkspace", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return WorkspacesGetWorkspaceResult.from_dict( + await self._client.request( + "session.workspaces.getWorkspace", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) async def list_files(self, *, timeout: float | None = None) -> WorkspacesListFilesResult: "Lists files stored in the session workspace files directory.\n\nReturns:\n Relative paths of files stored in the session workspace files directory." - return WorkspacesListFilesResult.from_dict(await self._client.request("session.workspaces.listFiles", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def read_file(self, params: WorkspacesReadFileRequest, *, timeout: float | None = None) -> WorkspacesReadFileResult: + return WorkspacesListFilesResult.from_dict( + await self._client.request( + "session.workspaces.listFiles", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def read_file( + self, params: WorkspacesReadFileRequest, *, timeout: float | None = None + ) -> WorkspacesReadFileResult: "Reads a file from the session workspace files directory.\n\nArgs:\n params: Relative path of the workspace file to read.\n\nReturns:\n Contents of the requested workspace file as a UTF-8 string." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspacesReadFileResult.from_dict(await self._client.request("session.workspaces.readFile", params_dict, **_timeout_kwargs(timeout))) - - async def create_file(self, params: WorkspacesCreateFileRequest, *, timeout: float | None = None) -> None: + return WorkspacesReadFileResult.from_dict( + await self._client.request( + "session.workspaces.readFile", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def create_file( + self, params: WorkspacesCreateFileRequest, *, timeout: float | None = None + ) -> None: "Creates or overwrites a file in the session workspace files directory.\n\nArgs:\n params: Relative path and UTF-8 content for the workspace file to create or overwrite." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.workspaces.createFile", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.workspaces.createFile", params_dict, **_timeout_kwargs(timeout) + ) - async def list_checkpoints(self, *, timeout: float | None = None) -> WorkspacesListCheckpointsResult: + async def list_checkpoints( + self, *, timeout: float | None = None + ) -> WorkspacesListCheckpointsResult: "Lists workspace checkpoints in chronological order.\n\nReturns:\n Workspace checkpoints in chronological order; empty when the workspace is not enabled." - return WorkspacesListCheckpointsResult.from_dict(await self._client.request("session.workspaces.listCheckpoints", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def read_checkpoint(self, params: WorkspacesReadCheckpointRequest, *, timeout: float | None = None) -> WorkspacesReadCheckpointResult: + return WorkspacesListCheckpointsResult.from_dict( + await self._client.request( + "session.workspaces.listCheckpoints", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def read_checkpoint( + self, params: WorkspacesReadCheckpointRequest, *, timeout: float | None = None + ) -> WorkspacesReadCheckpointResult: "Reads the content of a workspace checkpoint by number.\n\nArgs:\n params: Checkpoint number to read.\n\nReturns:\n Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspacesReadCheckpointResult.from_dict(await self._client.request("session.workspaces.readCheckpoint", params_dict, **_timeout_kwargs(timeout))) - - async def save_large_paste(self, params: WorkspacesSaveLargePasteRequest, *, timeout: float | None = None) -> WorkspacesSaveLargePasteResult: + return WorkspacesReadCheckpointResult.from_dict( + await self._client.request( + "session.workspaces.readCheckpoint", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def save_large_paste( + self, params: WorkspacesSaveLargePasteRequest, *, timeout: float | None = None + ) -> WorkspacesSaveLargePasteResult: "Saves pasted content as a UTF-8 file in the session workspace.\n\nArgs:\n params: Pasted content to save as a UTF-8 file in the session workspace.\n\nReturns:\n Descriptor for the saved paste file, or null when the workspace is unavailable." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspacesSaveLargePasteResult.from_dict(await self._client.request("session.workspaces.saveLargePaste", params_dict, **_timeout_kwargs(timeout))) - - async def diff(self, params: WorkspacesDiffRequest, *, timeout: float | None = None) -> WorkspaceDiffResult: + return WorkspacesSaveLargePasteResult.from_dict( + await self._client.request( + "session.workspaces.saveLargePaste", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def diff( + self, params: WorkspacesDiffRequest, *, timeout: float | None = None + ) -> WorkspaceDiffResult: "Computes a diff for the session workspace.\n\nArgs:\n params: Parameters for computing a workspace diff.\n\nReturns:\n Workspace diff result for the requested mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspaceDiffResult.from_dict(await self._client.request("session.workspaces.diff", params_dict, **_timeout_kwargs(timeout))) + return WorkspaceDiffResult.from_dict( + await self._client.request( + "session.workspaces.diff", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16903,7 +21850,13 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_sources(self, *, timeout: float | None = None) -> InstructionsGetSourcesResult: "Gets instruction sources loaded for the session.\n\nReturns:\n Instruction sources loaded for the session, in merge order." - return InstructionsGetSourcesResult.from_dict(await self._client.request("session.instructions.getSources", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return InstructionsGetSourcesResult.from_dict( + await self._client.request( + "session.instructions.getSources", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16912,11 +21865,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def start(self, params: FleetStartRequest, *, timeout: float | None = None) -> FleetStartResult: + async def start( + self, params: FleetStartRequest, *, timeout: float | None = None + ) -> FleetStartResult: "Starts fleet mode by submitting the fleet orchestration prompt to the session.\n\nArgs:\n params: Optional user prompt to combine with the fleet orchestration instructions.\n\nReturns:\n Indicates whether fleet mode was successfully activated." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return FleetStartResult.from_dict(await self._client.request("session.fleet.start", params_dict, **_timeout_kwargs(timeout))) + return FleetStartResult.from_dict( + await self._client.request( + "session.fleet.start", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16927,25 +21886,47 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> AgentList: "Lists custom agents available to the session.\n\nReturns:\n Custom agents available to the session." - return AgentList.from_dict(await self._client.request("session.agent.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return AgentList.from_dict( + await self._client.request( + "session.agent.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def get_current(self, *, timeout: float | None = None) -> AgentGetCurrentResult: "Gets the currently selected custom agent for the session.\n\nReturns:\n The currently selected custom agent, or null when using the default agent." - return AgentGetCurrentResult.from_dict(await self._client.request("session.agent.getCurrent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def select(self, params: AgentSelectRequest, *, timeout: float | None = None) -> AgentSelectResult: + return AgentGetCurrentResult.from_dict( + await self._client.request( + "session.agent.getCurrent", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def select( + self, params: AgentSelectRequest, *, timeout: float | None = None + ) -> AgentSelectResult: "Selects a custom agent for subsequent turns in the session.\n\nArgs:\n params: Name of the custom agent to select for subsequent turns.\n\nReturns:\n The newly selected custom agent." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return AgentSelectResult.from_dict(await self._client.request("session.agent.select", params_dict, **_timeout_kwargs(timeout))) + return AgentSelectResult.from_dict( + await self._client.request( + "session.agent.select", params_dict, **_timeout_kwargs(timeout) + ) + ) async def deselect(self, *, timeout: float | None = None) -> None: "Clears the selected custom agent and returns the session to the default agent." - await self._client.request("session.agent.deselect", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.agent.deselect", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) async def reload(self, *, timeout: float | None = None) -> AgentReloadResult: "Reloads custom agent definitions and returns the refreshed list.\n\nReturns:\n Custom agents available to the session after reloading definitions from disk." - return AgentReloadResult.from_dict(await self._client.request("session.agent.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return AgentReloadResult.from_dict( + await self._client.request( + "session.agent.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -16954,61 +21935,127 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def start_agent(self, params: TasksStartAgentRequest, *, timeout: float | None = None) -> TasksStartAgentResult: + async def start_agent( + self, params: TasksStartAgentRequest, *, timeout: float | None = None + ) -> TasksStartAgentResult: "Starts a background agent task in the session.\n\nArgs:\n params: Agent type, prompt, name, and optional description and model override for the new task.\n\nReturns:\n Identifier assigned to the newly started background agent task." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksStartAgentResult.from_dict(await self._client.request("session.tasks.startAgent", params_dict, **_timeout_kwargs(timeout))) + return TasksStartAgentResult.from_dict( + await self._client.request( + "session.tasks.startAgent", params_dict, **_timeout_kwargs(timeout) + ) + ) async def list(self, *, timeout: float | None = None) -> TaskList: "Lists background tasks tracked by the session.\n\nReturns:\n Background tasks currently tracked by the session." - return TaskList.from_dict(await self._client.request("session.tasks.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return TaskList.from_dict( + await self._client.request( + "session.tasks.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def refresh(self, *, timeout: float | None = None) -> TasksRefreshResult: "Refreshes metadata for any detached background shells the runtime knows about.\n\nReturns:\n Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop." - return TasksRefreshResult.from_dict(await self._client.request("session.tasks.refresh", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return TasksRefreshResult.from_dict( + await self._client.request( + "session.tasks.refresh", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def wait_for_pending(self, *, timeout: float | None = None) -> TasksWaitForPendingResult: "Waits for all in-flight background tasks and any follow-up turns to settle.\n\nReturns:\n Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS)." - return TasksWaitForPendingResult.from_dict(await self._client.request("session.tasks.waitForPending", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def get_progress(self, params: TasksGetProgressRequest, *, timeout: float | None = None) -> TasksGetProgressResult: + return TasksWaitForPendingResult.from_dict( + await self._client.request( + "session.tasks.waitForPending", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def get_progress( + self, params: TasksGetProgressRequest, *, timeout: float | None = None + ) -> TasksGetProgressResult: "Returns progress information for a background task by ID.\n\nArgs:\n params: Identifier of the background task to fetch progress for.\n\nReturns:\n Progress information for the task, or null when no task with that ID is tracked." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksGetProgressResult.from_dict(await self._client.request("session.tasks.getProgress", params_dict, **_timeout_kwargs(timeout))) - - async def get_current_promotable(self, *, timeout: float | None = None) -> TasksGetCurrentPromotableResult: + return TasksGetProgressResult.from_dict( + await self._client.request( + "session.tasks.getProgress", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def get_current_promotable( + self, *, timeout: float | None = None + ) -> TasksGetCurrentPromotableResult: "Returns the first sync-waiting task that can currently be promoted to background mode.\n\nReturns:\n The first sync-waiting task that can currently be promoted to background mode." - return TasksGetCurrentPromotableResult.from_dict(await self._client.request("session.tasks.getCurrentPromotable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def promote_to_background(self, params: TasksPromoteToBackgroundRequest, *, timeout: float | None = None) -> TasksPromoteToBackgroundResult: + return TasksGetCurrentPromotableResult.from_dict( + await self._client.request( + "session.tasks.getCurrentPromotable", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def promote_to_background( + self, params: TasksPromoteToBackgroundRequest, *, timeout: float | None = None + ) -> TasksPromoteToBackgroundResult: "Promotes an eligible synchronously-waited task so it continues running in the background.\n\nArgs:\n params: Identifier of the task to promote to background mode.\n\nReturns:\n Indicates whether the task was successfully promoted to background mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksPromoteToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteToBackground", params_dict, **_timeout_kwargs(timeout))) - - async def promote_current_to_background(self, *, timeout: float | None = None) -> TasksPromoteCurrentToBackgroundResult: + return TasksPromoteToBackgroundResult.from_dict( + await self._client.request( + "session.tasks.promoteToBackground", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def promote_current_to_background( + self, *, timeout: float | None = None + ) -> TasksPromoteCurrentToBackgroundResult: "Atomically promotes the first promotable sync-waiting task to background mode and returns it.\n\nReturns:\n The promoted task as it now exists in background mode, omitted if no promotable task was waiting." - return TasksPromoteCurrentToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteCurrentToBackground", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def cancel(self, params: TasksCancelRequest, *, timeout: float | None = None) -> TasksCancelResult: + return TasksPromoteCurrentToBackgroundResult.from_dict( + await self._client.request( + "session.tasks.promoteCurrentToBackground", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def cancel( + self, params: TasksCancelRequest, *, timeout: float | None = None + ) -> TasksCancelResult: "Cancels a background task.\n\nArgs:\n params: Identifier of the background task to cancel.\n\nReturns:\n Indicates whether the background task was successfully cancelled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksCancelResult.from_dict(await self._client.request("session.tasks.cancel", params_dict, **_timeout_kwargs(timeout))) - - async def remove(self, params: TasksRemoveRequest, *, timeout: float | None = None) -> TasksRemoveResult: + return TasksCancelResult.from_dict( + await self._client.request( + "session.tasks.cancel", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def remove( + self, params: TasksRemoveRequest, *, timeout: float | None = None + ) -> TasksRemoveResult: "Removes a completed or cancelled background task from tracking.\n\nArgs:\n params: Identifier of the completed or cancelled task to remove from tracking.\n\nReturns:\n Indicates whether the task was removed. False when the task does not exist or is still running/idle." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksRemoveResult.from_dict(await self._client.request("session.tasks.remove", params_dict, **_timeout_kwargs(timeout))) - - async def send_message(self, params: TasksSendMessageRequest, *, timeout: float | None = None) -> TasksSendMessageResult: + return TasksRemoveResult.from_dict( + await self._client.request( + "session.tasks.remove", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def send_message( + self, params: TasksSendMessageRequest, *, timeout: float | None = None + ) -> TasksSendMessageResult: "Sends a message to a background agent task.\n\nArgs:\n params: Identifier of the target agent task, message content, and optional sender agent ID.\n\nReturns:\n Indicates whether the message was delivered, with an error message when delivery failed." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksSendMessageResult.from_dict(await self._client.request("session.tasks.sendMessage", params_dict, **_timeout_kwargs(timeout))) + return TasksSendMessageResult.from_dict( + await self._client.request( + "session.tasks.sendMessage", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17019,11 +22066,21 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> SkillList: "Lists skills available to the session.\n\nReturns:\n Skills available to the session, with their enabled state." - return SkillList.from_dict(await self._client.request("session.skills.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return SkillList.from_dict( + await self._client.request( + "session.skills.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def get_invoked(self, *, timeout: float | None = None) -> SkillsGetInvokedResult: "Returns the skills that have been invoked during this session.\n\nReturns:\n Skills invoked during this session, ordered by invocation time (most recent last)." - return SkillsGetInvokedResult.from_dict(await self._client.request("session.skills.getInvoked", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return SkillsGetInvokedResult.from_dict( + await self._client.request( + "session.skills.getInvoked", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) async def enable(self, params: SkillsEnableRequest, *, timeout: float | None = None) -> None: "Enables a skill for the session.\n\nArgs:\n params: Name of the skill to enable for the session." @@ -17035,15 +22092,25 @@ async def disable(self, params: SkillsDisableRequest, *, timeout: float | None = "Disables a skill for the session.\n\nArgs:\n params: Name of the skill to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.skills.disable", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.skills.disable", params_dict, **_timeout_kwargs(timeout) + ) async def reload(self, *, timeout: float | None = None) -> SkillsLoadDiagnostics: "Reloads skill definitions for the session.\n\nReturns:\n Diagnostics from reloading skill definitions, with warnings and errors as separate lists." - return SkillsLoadDiagnostics.from_dict(await self._client.request("session.skills.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return SkillsLoadDiagnostics.from_dict( + await self._client.request( + "session.skills.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def ensure_loaded(self, *, timeout: float | None = None) -> None: "Ensures the session's skill definitions have been loaded from disk." - await self._client.request("session.skills.ensureLoaded", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.skills.ensureLoaded", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) # Experimental: this API group is experimental and may change or be removed. @@ -17052,11 +22119,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def login(self, params: MCPOauthLoginRequest, *, timeout: float | None = None) -> MCPOauthLoginResult: + async def login( + self, params: MCPOauthLoginRequest, *, timeout: float | None = None + ) -> MCPOauthLoginResult: "Starts OAuth authentication for a remote MCP server.\n\nArgs:\n params: Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy.\n\nReturns:\n OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPOauthLoginResult.from_dict(await self._client.request("session.mcp.oauth.login", params_dict, **_timeout_kwargs(timeout))) + return MCPOauthLoginResult.from_dict( + await self._client.request( + "session.mcp.oauth.login", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17065,39 +22138,73 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def read_resource(self, params: MCPAppsReadResourceRequest, *, timeout: float | None = None) -> MCPAppsReadResourceResult: + async def read_resource( + self, params: MCPAppsReadResourceRequest, *, timeout: float | None = None + ) -> MCPAppsReadResourceResult: "Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability.\n\nArgs:\n params: MCP server and resource URI to fetch.\n\nReturns:\n Resource contents returned by the MCP server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPAppsReadResourceResult.from_dict(await self._client.request("session.mcp.apps.readResource", params_dict, **_timeout_kwargs(timeout))) - - async def list_tools(self, params: MCPAppsListToolsRequest, *, timeout: float | None = None) -> MCPAppsListToolsResult: - "List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `[\"model\",\"app\"]`) or includes `\"app\"`.\n\nArgs:\n params: MCP server to list app-callable tools for.\n\nReturns:\n App-callable tools from the named MCP server." + return MCPAppsReadResourceResult.from_dict( + await self._client.request( + "session.mcp.apps.readResource", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def list_tools( + self, params: MCPAppsListToolsRequest, *, timeout: float | None = None + ) -> MCPAppsListToolsResult: + 'List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `["model","app"]`) or includes `"app"`.\n\nArgs:\n params: MCP server to list app-callable tools for.\n\nReturns:\n App-callable tools from the named MCP server.' params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPAppsListToolsResult.from_dict(await self._client.request("session.mcp.apps.listTools", params_dict, **_timeout_kwargs(timeout))) - - async def call_tool(self, params: MCPAppsCallToolRequest, *, timeout: float | None = None) -> dict: + return MCPAppsListToolsResult.from_dict( + await self._client.request( + "session.mcp.apps.listTools", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def call_tool( + self, params: MCPAppsCallToolRequest, *, timeout: float | None = None + ) -> dict: "Call an MCP tool from an MCP App view (SEP-1865). Enforces the visibility check that prevents an app iframe from invoking model-only tools. Returns the standard MCP `CallToolResult`.\n\nArgs:\n params: MCP server, tool name, and arguments to invoke from an MCP App view.\n\nReturns:\n Standard MCP CallToolResult" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return dict(await self._client.request("session.mcp.apps.callTool", params_dict, **_timeout_kwargs(timeout))) - - async def set_host_context(self, params: MCPAppsSetHostContextRequest, *, timeout: float | None = None) -> None: + return dict( + await self._client.request( + "session.mcp.apps.callTool", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def set_host_context( + self, params: MCPAppsSetHostContextRequest, *, timeout: float | None = None + ) -> None: "Replace the host context returned to MCP App guests on `ui/initialize`. Hosts use this to advertise theme, locale, or other metadata to the guest UI.\n\nArgs:\n params: Host context to advertise to MCP App guests." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.mcp.apps.setHostContext", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.mcp.apps.setHostContext", params_dict, **_timeout_kwargs(timeout) + ) async def get_host_context(self, *, timeout: float | None = None) -> MCPAppsHostContext: "Read the current host context advertised to MCP App guests.\n\nReturns:\n Current host context advertised to MCP App guests." - return MCPAppsHostContext.from_dict(await self._client.request("session.mcp.apps.getHostContext", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def diagnose(self, params: MCPAppsDiagnoseRequest, *, timeout: float | None = None) -> MCPAppsDiagnoseResult: + return MCPAppsHostContext.from_dict( + await self._client.request( + "session.mcp.apps.getHostContext", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def diagnose( + self, params: MCPAppsDiagnoseRequest, *, timeout: float | None = None + ) -> MCPAppsDiagnoseResult: "Diagnose MCP Apps wiring for a specific MCP server. Reports the session capability, feature-flag state, advertised extension, and how many tools have `_meta.ui` populated.\n\nArgs:\n params: MCP server to diagnose MCP Apps wiring for.\n\nReturns:\n Diagnostic snapshot of MCP Apps wiring for the named server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPAppsDiagnoseResult.from_dict(await self._client.request("session.mcp.apps.diagnose", params_dict, **_timeout_kwargs(timeout))) + return MCPAppsDiagnoseResult.from_dict( + await self._client.request( + "session.mcp.apps.diagnose", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17110,7 +22217,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> MCPServerList: "Lists MCP servers configured for the session and their connection status.\n\nReturns:\n MCP servers configured for the session, with their connection status." - return MCPServerList.from_dict(await self._client.request("session.mcp.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return MCPServerList.from_dict( + await self._client.request( + "session.mcp.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) async def enable(self, params: MCPEnableRequest, *, timeout: float | None = None) -> None: "Enables an MCP server for the session.\n\nArgs:\n params: Name of the MCP server to enable for the session." @@ -17126,29 +22237,55 @@ async def disable(self, params: MCPDisableRequest, *, timeout: float | None = No async def reload(self, *, timeout: float | None = None) -> None: "Reloads MCP server connections for the session." - await self._client.request("session.mcp.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.mcp.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) - async def execute_sampling(self, params: MCPExecuteSamplingParams, *, timeout: float | None = None) -> MCPSamplingExecutionResult: + async def execute_sampling( + self, params: MCPExecuteSamplingParams, *, timeout: float | None = None + ) -> MCPSamplingExecutionResult: "Runs an MCP sampling inference on behalf of an MCP server.\n\nArgs:\n params: Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference.\n\nReturns:\n Outcome of an MCP sampling execution: success result, failure error, or cancellation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPSamplingExecutionResult.from_dict(await self._client.request("session.mcp.executeSampling", params_dict, **_timeout_kwargs(timeout))) - - async def cancel_sampling_execution(self, params: MCPCancelSamplingExecutionParams, *, timeout: float | None = None) -> MCPCancelSamplingExecutionResult: + return MCPSamplingExecutionResult.from_dict( + await self._client.request( + "session.mcp.executeSampling", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def cancel_sampling_execution( + self, params: MCPCancelSamplingExecutionParams, *, timeout: float | None = None + ) -> MCPCancelSamplingExecutionResult: "Cancels an in-flight MCP sampling execution by request ID.\n\nArgs:\n params: The requestId previously passed to executeSampling that should be cancelled.\n\nReturns:\n Indicates whether an in-flight sampling execution with the given requestId was found and cancelled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPCancelSamplingExecutionResult.from_dict(await self._client.request("session.mcp.cancelSamplingExecution", params_dict, **_timeout_kwargs(timeout))) - - async def set_env_value_mode(self, params: MCPSetEnvValueModeParams, *, timeout: float | None = None) -> MCPSetEnvValueModeResult: + return MCPCancelSamplingExecutionResult.from_dict( + await self._client.request( + "session.mcp.cancelSamplingExecution", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def set_env_value_mode( + self, params: MCPSetEnvValueModeParams, *, timeout: float | None = None + ) -> MCPSetEnvValueModeResult: "Sets how environment-variable values supplied to MCP servers are resolved (direct or indirect).\n\nArgs:\n params: Mode controlling how MCP server env values are resolved (`direct` or `indirect`).\n\nReturns:\n Env-value mode recorded on the session after the update." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPSetEnvValueModeResult.from_dict(await self._client.request("session.mcp.setEnvValueMode", params_dict, **_timeout_kwargs(timeout))) + return MCPSetEnvValueModeResult.from_dict( + await self._client.request( + "session.mcp.setEnvValueMode", params_dict, **_timeout_kwargs(timeout) + ) + ) async def remove_git_hub(self, *, timeout: float | None = None) -> MCPRemoveGitHubResult: "Removes the auto-managed `github` MCP server when present.\n\nReturns:\n Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove)." - return MCPRemoveGitHubResult.from_dict(await self._client.request("session.mcp.removeGitHub", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return MCPRemoveGitHubResult.from_dict( + await self._client.request( + "session.mcp.removeGitHub", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17159,7 +22296,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> PluginList: "Lists plugins installed for the session.\n\nReturns:\n Plugins installed for the session, with their enabled state and version metadata." - return PluginList.from_dict(await self._client.request("session.plugins.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return PluginList.from_dict( + await self._client.request( + "session.plugins.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17168,11 +22309,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def update(self, params: SessionUpdateOptionsParams, *, timeout: float | None = None) -> SessionUpdateOptionsResult: + async def update( + self, params: SessionUpdateOptionsParams, *, timeout: float | None = None + ) -> SessionUpdateOptionsResult: "Patches the genuinely-mutable subset of session options.\n\nArgs:\n params: Patch of mutable session options to apply to the running session.\n\nReturns:\n Indicates whether the session options patch was applied successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SessionUpdateOptionsResult.from_dict(await self._client.request("session.options.update", params_dict, **_timeout_kwargs(timeout))) + return SessionUpdateOptionsResult.from_dict( + await self._client.request( + "session.options.update", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17181,11 +22328,15 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def initialize(self, params: LspInitializeRequest, *, timeout: float | None = None) -> None: + async def initialize( + self, params: LspInitializeRequest, *, timeout: float | None = None + ) -> None: "Loads the merged LSP configuration set for the session's working directory.\n\nArgs:\n params: Parameters for (re)loading the merged LSP configuration set." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.lsp.initialize", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.lsp.initialize", params_dict, **_timeout_kwargs(timeout) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17196,23 +22347,39 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> ExtensionList: "Lists extensions discovered for the session and their current status.\n\nReturns:\n Extensions discovered for the session, with their current status." - return ExtensionList.from_dict(await self._client.request("session.extensions.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def enable(self, params: ExtensionsEnableRequest, *, timeout: float | None = None) -> None: + return ExtensionList.from_dict( + await self._client.request( + "session.extensions.list", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def enable( + self, params: ExtensionsEnableRequest, *, timeout: float | None = None + ) -> None: "Enables an extension for the session.\n\nArgs:\n params: Source-qualified extension identifier to enable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.extensions.enable", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.extensions.enable", params_dict, **_timeout_kwargs(timeout) + ) - async def disable(self, params: ExtensionsDisableRequest, *, timeout: float | None = None) -> None: + async def disable( + self, params: ExtensionsDisableRequest, *, timeout: float | None = None + ) -> None: "Disables an extension for the session.\n\nArgs:\n params: Source-qualified extension identifier to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.extensions.disable", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.extensions.disable", params_dict, **_timeout_kwargs(timeout) + ) async def reload(self, *, timeout: float | None = None) -> None: "Reloads extension definitions and processes for the session." - await self._client.request("session.extensions.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.extensions.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17221,15 +22388,29 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def handle_pending_tool_call(self, params: HandlePendingToolCallRequest, *, timeout: float | None = None) -> HandlePendingToolCallResult: + async def handle_pending_tool_call( + self, params: HandlePendingToolCallRequest, *, timeout: float | None = None + ) -> HandlePendingToolCallResult: "Provides the result for a pending external tool call.\n\nArgs:\n params: Pending external tool call request ID, with the tool result or an error describing why it failed.\n\nReturns:\n Indicates whether the external tool call result was handled successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return HandlePendingToolCallResult.from_dict(await self._client.request("session.tools.handlePendingToolCall", params_dict, **_timeout_kwargs(timeout))) - - async def initialize_and_validate(self, *, timeout: float | None = None) -> ToolsInitializeAndValidateResult: + return HandlePendingToolCallResult.from_dict( + await self._client.request( + "session.tools.handlePendingToolCall", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def initialize_and_validate( + self, *, timeout: float | None = None + ) -> ToolsInitializeAndValidateResult: "Resolves, builds, and validates the runtime tool list for the session.\n\nReturns:\n Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation." - return ToolsInitializeAndValidateResult.from_dict(await self._client.request("session.tools.initializeAndValidate", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return ToolsInitializeAndValidateResult.from_dict( + await self._client.request( + "session.tools.initializeAndValidate", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17238,41 +22419,81 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def list(self, params: CommandsListRequest | None = None, *, timeout: float | None = None) -> CommandList: + async def list( + self, params: CommandsListRequest | None = None, *, timeout: float | None = None + ) -> CommandList: "Lists slash commands available in the session.\n\nArgs:\n params: Optional filters controlling which command sources to include in the listing.\n\nReturns:\n Slash commands available in the session, after applying any include/exclude filters." - params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} + params_dict: dict[str, Any] = ( + {k: v for k, v in params.to_dict().items() if v is not None} + if params is not None + else {} + ) params_dict["sessionId"] = self._session_id - return CommandList.from_dict(await self._client.request("session.commands.list", params_dict, **_timeout_kwargs(timeout))) - - async def invoke(self, params: CommandsInvokeRequest, *, timeout: float | None = None) -> SlashCommandInvocationResult: + return CommandList.from_dict( + await self._client.request( + "session.commands.list", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def invoke( + self, params: CommandsInvokeRequest, *, timeout: float | None = None + ) -> SlashCommandInvocationResult: "Invokes a slash command in the session.\n\nArgs:\n params: Slash command name and optional raw input string to invoke.\n\nReturns:\n Result of invoking the slash command (text output, prompt to send to the agent, or completion)." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return _load_SlashCommandInvocationResult(await self._client.request("session.commands.invoke", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_command(self, params: CommandsHandlePendingCommandRequest, *, timeout: float | None = None) -> CommandsHandlePendingCommandResult: + return _load_SlashCommandInvocationResult( + await self._client.request( + "session.commands.invoke", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_command( + self, params: CommandsHandlePendingCommandRequest, *, timeout: float | None = None + ) -> CommandsHandlePendingCommandResult: "Reports completion of a pending client-handled slash command.\n\nArgs:\n params: Pending command request ID and an optional error if the client handler failed.\n\nReturns:\n Indicates whether the pending client-handled command was completed successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return CommandsHandlePendingCommandResult.from_dict(await self._client.request("session.commands.handlePendingCommand", params_dict, **_timeout_kwargs(timeout))) - - async def execute(self, params: ExecuteCommandParams, *, timeout: float | None = None) -> ExecuteCommandResult: + return CommandsHandlePendingCommandResult.from_dict( + await self._client.request( + "session.commands.handlePendingCommand", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def execute( + self, params: ExecuteCommandParams, *, timeout: float | None = None + ) -> ExecuteCommandResult: "Executes a slash command synchronously and returns any error.\n\nArgs:\n params: Slash command name and argument string to execute synchronously.\n\nReturns:\n Error message produced while executing the command, if any." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ExecuteCommandResult.from_dict(await self._client.request("session.commands.execute", params_dict, **_timeout_kwargs(timeout))) - - async def enqueue(self, params: EnqueueCommandParams, *, timeout: float | None = None) -> EnqueueCommandResult: + return ExecuteCommandResult.from_dict( + await self._client.request( + "session.commands.execute", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def enqueue( + self, params: EnqueueCommandParams, *, timeout: float | None = None + ) -> EnqueueCommandResult: "Enqueues a slash command for FIFO processing on the local session.\n\nArgs:\n params: Slash-prefixed command string to enqueue for FIFO processing.\n\nReturns:\n Indicates whether the command was accepted into the local execution queue." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return EnqueueCommandResult.from_dict(await self._client.request("session.commands.enqueue", params_dict, **_timeout_kwargs(timeout))) - - async def respond_to_queued_command(self, params: CommandsRespondToQueuedCommandRequest, *, timeout: float | None = None) -> CommandsRespondToQueuedCommandResult: + return EnqueueCommandResult.from_dict( + await self._client.request( + "session.commands.enqueue", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def respond_to_queued_command( + self, params: CommandsRespondToQueuedCommandRequest, *, timeout: float | None = None + ) -> CommandsRespondToQueuedCommandResult: "Reports whether the host actually executed a queued command and whether to continue processing.\n\nArgs:\n params: Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands).\n\nReturns:\n Indicates whether the queued-command response was matched to a pending request." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return CommandsRespondToQueuedCommandResult.from_dict(await self._client.request("session.commands.respondToQueuedCommand", params_dict, **_timeout_kwargs(timeout))) + return CommandsRespondToQueuedCommandResult.from_dict( + await self._client.request( + "session.commands.respondToQueuedCommand", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17281,11 +22502,15 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def set_feature_overrides(self, params: TelemetrySetFeatureOverridesRequest, *, timeout: float | None = None) -> None: + async def set_feature_overrides( + self, params: TelemetrySetFeatureOverridesRequest, *, timeout: float | None = None + ) -> None: "Sets feature override key/value pairs to attach to subsequent telemetry events for the session.\n\nArgs:\n params: Feature override key/value pairs to attach to subsequent telemetry events from this session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request("session.telemetry.setFeatureOverrides", params_dict, **_timeout_kwargs(timeout)) + await self._client.request( + "session.telemetry.setFeatureOverrides", params_dict, **_timeout_kwargs(timeout) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17294,51 +22519,106 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def elicitation(self, params: UIElicitationRequest, *, timeout: float | None = None) -> UIElicitationResponse: + async def elicitation( + self, params: UIElicitationRequest, *, timeout: float | None = None + ) -> UIElicitationResponse: "Requests structured input from a UI-capable client.\n\nArgs:\n params: Prompt message and JSON schema describing the form fields to elicit from the user.\n\nReturns:\n The elicitation response (accept with form values, decline, or cancel)" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIElicitationResponse.from_dict(await self._client.request("session.ui.elicitation", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_elicitation(self, params: UIHandlePendingElicitationRequest, *, timeout: float | None = None) -> UIElicitationResult: + return UIElicitationResponse.from_dict( + await self._client.request( + "session.ui.elicitation", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_elicitation( + self, params: UIHandlePendingElicitationRequest, *, timeout: float | None = None + ) -> UIElicitationResult: "Provides the user response for a pending elicitation request.\n\nArgs:\n params: Pending elicitation request ID and the user's response (accept/decline/cancel + form values).\n\nReturns:\n Indicates whether the elicitation response was accepted; false if it was already resolved by another client." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIElicitationResult.from_dict(await self._client.request("session.ui.handlePendingElicitation", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_user_input(self, params: UIHandlePendingUserInputRequest, *, timeout: float | None = None) -> UIHandlePendingResult: + return UIElicitationResult.from_dict( + await self._client.request( + "session.ui.handlePendingElicitation", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_user_input( + self, params: UIHandlePendingUserInputRequest, *, timeout: float | None = None + ) -> UIHandlePendingResult: "Resolves a pending `user_input.requested` event with the user's response.\n\nArgs:\n params: Request ID of a pending `user_input.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingUserInput", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_sampling(self, params: UIHandlePendingSamplingRequest, *, timeout: float | None = None) -> UIHandlePendingResult: + return UIHandlePendingResult.from_dict( + await self._client.request( + "session.ui.handlePendingUserInput", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_sampling( + self, params: UIHandlePendingSamplingRequest, *, timeout: float | None = None + ) -> UIHandlePendingResult: "Resolves a pending `sampling.requested` event with a sampling result, or rejects it.\n\nArgs:\n params: Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject).\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingSampling", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_auto_mode_switch(self, params: UIHandlePendingAutoModeSwitchRequest, *, timeout: float | None = None) -> UIHandlePendingResult: + return UIHandlePendingResult.from_dict( + await self._client.request( + "session.ui.handlePendingSampling", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_auto_mode_switch( + self, params: UIHandlePendingAutoModeSwitchRequest, *, timeout: float | None = None + ) -> UIHandlePendingResult: "Resolves a pending `auto_mode_switch.requested` event with the user's accept/decline decision.\n\nArgs:\n params: Request ID of a pending `auto_mode_switch.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingAutoModeSwitch", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_exit_plan_mode(self, params: UIHandlePendingExitPlanModeRequest, *, timeout: float | None = None) -> UIHandlePendingResult: + return UIHandlePendingResult.from_dict( + await self._client.request( + "session.ui.handlePendingAutoModeSwitch", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_exit_plan_mode( + self, params: UIHandlePendingExitPlanModeRequest, *, timeout: float | None = None + ) -> UIHandlePendingResult: "Resolves a pending `exit_plan_mode.requested` event with the user's response.\n\nArgs:\n params: Request ID of a pending `exit_plan_mode.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingExitPlanMode", params_dict, **_timeout_kwargs(timeout))) - - async def register_direct_auto_mode_switch_handler(self, *, timeout: float | None = None) -> UIRegisterDirectAutoModeSwitchHandlerResult: + return UIHandlePendingResult.from_dict( + await self._client.request( + "session.ui.handlePendingExitPlanMode", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def register_direct_auto_mode_switch_handler( + self, *, timeout: float | None = None + ) -> UIRegisterDirectAutoModeSwitchHandlerResult: "Registers an in-process handler for auto-mode-switch requests so the server bridge skips dispatch.\n\nReturns:\n Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId)." - return UIRegisterDirectAutoModeSwitchHandlerResult.from_dict(await self._client.request("session.ui.registerDirectAutoModeSwitchHandler", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def unregister_direct_auto_mode_switch_handler(self, params: UIUnregisterDirectAutoModeSwitchHandlerRequest, *, timeout: float | None = None) -> UIUnregisterDirectAutoModeSwitchHandlerResult: + return UIRegisterDirectAutoModeSwitchHandlerResult.from_dict( + await self._client.request( + "session.ui.registerDirectAutoModeSwitchHandler", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def unregister_direct_auto_mode_switch_handler( + self, + params: UIUnregisterDirectAutoModeSwitchHandlerRequest, + *, + timeout: float | None = None, + ) -> UIUnregisterDirectAutoModeSwitchHandlerResult: "Unregisters a previously-registered in-process auto-mode-switch handler by its opaque handle.\n\nArgs:\n params: Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release.\n\nReturns:\n Indicates whether the handle was active and the registration count was decremented." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict(await self._client.request("session.ui.unregisterDirectAutoModeSwitchHandler", params_dict, **_timeout_kwargs(timeout))) + return UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict( + await self._client.request( + "session.ui.unregisterDirectAutoModeSwitchHandler", + params_dict, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17349,31 +22629,65 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> PermissionPathsList: "Returns the session's allowed directories and primary working directory.\n\nReturns:\n Snapshot of the session's allow-listed directories and primary working directory." - return PermissionPathsList.from_dict(await self._client.request("session.permissions.paths.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def add(self, params: PermissionPathsAddParams, *, timeout: float | None = None) -> PermissionsPathsAddResult: + return PermissionPathsList.from_dict( + await self._client.request( + "session.permissions.paths.list", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def add( + self, params: PermissionPathsAddParams, *, timeout: float | None = None + ) -> PermissionsPathsAddResult: "Adds a directory to the session's allow-list.\n\nArgs:\n params: Directory path to add to the session's allowed directories.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsPathsAddResult.from_dict(await self._client.request("session.permissions.paths.add", params_dict, **_timeout_kwargs(timeout))) - - async def update_primary(self, params: PermissionPathsUpdatePrimaryParams, *, timeout: float | None = None) -> PermissionsPathsUpdatePrimaryResult: + return PermissionsPathsAddResult.from_dict( + await self._client.request( + "session.permissions.paths.add", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def update_primary( + self, params: PermissionPathsUpdatePrimaryParams, *, timeout: float | None = None + ) -> PermissionsPathsUpdatePrimaryResult: "Updates the session's primary working directory used by the permission policy.\n\nArgs:\n params: Directory path to set as the session's new primary working directory.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsPathsUpdatePrimaryResult.from_dict(await self._client.request("session.permissions.paths.updatePrimary", params_dict, **_timeout_kwargs(timeout))) - - async def is_path_within_allowed_directories(self, params: PermissionPathsAllowedCheckParams, *, timeout: float | None = None) -> PermissionPathsAllowedCheckResult: + return PermissionsPathsUpdatePrimaryResult.from_dict( + await self._client.request( + "session.permissions.paths.updatePrimary", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def is_path_within_allowed_directories( + self, params: PermissionPathsAllowedCheckParams, *, timeout: float | None = None + ) -> PermissionPathsAllowedCheckResult: "Reports whether a path falls within any of the session's allowed directories.\n\nArgs:\n params: Path to evaluate against the session's allowed directories.\n\nReturns:\n Indicates whether the supplied path is within the session's allowed directories." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionPathsAllowedCheckResult.from_dict(await self._client.request("session.permissions.paths.isPathWithinAllowedDirectories", params_dict, **_timeout_kwargs(timeout))) - - async def is_path_within_workspace(self, params: PermissionPathsWorkspaceCheckParams, *, timeout: float | None = None) -> PermissionPathsWorkspaceCheckResult: + return PermissionPathsAllowedCheckResult.from_dict( + await self._client.request( + "session.permissions.paths.isPathWithinAllowedDirectories", + params_dict, + **_timeout_kwargs(timeout), + ) + ) + + async def is_path_within_workspace( + self, params: PermissionPathsWorkspaceCheckParams, *, timeout: float | None = None + ) -> PermissionPathsWorkspaceCheckResult: "Reports whether a path falls within the session's workspace (primary) directory.\n\nArgs:\n params: Path to evaluate against the session's workspace (primary) directory.\n\nReturns:\n Indicates whether the supplied path is within the session's workspace directory." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionPathsWorkspaceCheckResult.from_dict(await self._client.request("session.permissions.paths.isPathWithinWorkspace", params_dict, **_timeout_kwargs(timeout))) + return PermissionPathsWorkspaceCheckResult.from_dict( + await self._client.request( + "session.permissions.paths.isPathWithinWorkspace", + params_dict, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17382,23 +22696,43 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def resolve(self, params: PermissionLocationResolveParams, *, timeout: float | None = None) -> PermissionLocationResolveResult: + async def resolve( + self, params: PermissionLocationResolveParams, *, timeout: float | None = None + ) -> PermissionLocationResolveResult: "Resolves the permission location key and type for a working directory.\n\nArgs:\n params: Working directory to resolve into a location-permissions key.\n\nReturns:\n Resolved location-permissions key and type." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionLocationResolveResult.from_dict(await self._client.request("session.permissions.locations.resolve", params_dict, **_timeout_kwargs(timeout))) - - async def apply(self, params: PermissionLocationApplyParams, *, timeout: float | None = None) -> PermissionLocationApplyResult: + return PermissionLocationResolveResult.from_dict( + await self._client.request( + "session.permissions.locations.resolve", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def apply( + self, params: PermissionLocationApplyParams, *, timeout: float | None = None + ) -> PermissionLocationApplyResult: "Applies persisted location-scoped tool approvals and allowed directories for a working directory to this session's permission service.\n\nArgs:\n params: Working directory to load persisted location permissions for.\n\nReturns:\n Summary of persisted location permissions applied to the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionLocationApplyResult.from_dict(await self._client.request("session.permissions.locations.apply", params_dict, **_timeout_kwargs(timeout))) - - async def add_tool_approval(self, params: PermissionLocationAddToolApprovalParams, *, timeout: float | None = None) -> PermissionsLocationsAddToolApprovalResult: + return PermissionLocationApplyResult.from_dict( + await self._client.request( + "session.permissions.locations.apply", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def add_tool_approval( + self, params: PermissionLocationAddToolApprovalParams, *, timeout: float | None = None + ) -> PermissionsLocationsAddToolApprovalResult: "Persists a tool approval for a permission location and applies its rules to this session's live permission service.\n\nArgs:\n params: Location-scoped tool approval to persist.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsLocationsAddToolApprovalResult.from_dict(await self._client.request("session.permissions.locations.addToolApproval", params_dict, **_timeout_kwargs(timeout))) + return PermissionsLocationsAddToolApprovalResult.from_dict( + await self._client.request( + "session.permissions.locations.addToolApproval", + params_dict, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17407,17 +22741,31 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def is_trusted(self, params: FolderTrustCheckParams, *, timeout: float | None = None) -> FolderTrustCheckResult: + async def is_trusted( + self, params: FolderTrustCheckParams, *, timeout: float | None = None + ) -> FolderTrustCheckResult: "Reports whether a folder is trusted according to the user's folder trust state.\n\nArgs:\n params: Folder path to check for trust.\n\nReturns:\n Folder trust check result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return FolderTrustCheckResult.from_dict(await self._client.request("session.permissions.folderTrust.isTrusted", params_dict, **_timeout_kwargs(timeout))) - - async def add_trusted(self, params: FolderTrustAddParams, *, timeout: float | None = None) -> PermissionsFolderTrustAddTrustedResult: + return FolderTrustCheckResult.from_dict( + await self._client.request( + "session.permissions.folderTrust.isTrusted", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def add_trusted( + self, params: FolderTrustAddParams, *, timeout: float | None = None + ) -> PermissionsFolderTrustAddTrustedResult: "Adds a folder to the user's trusted folders list.\n\nArgs:\n params: Folder path to add to trusted folders.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsFolderTrustAddTrustedResult.from_dict(await self._client.request("session.permissions.folderTrust.addTrusted", params_dict, **_timeout_kwargs(timeout))) + return PermissionsFolderTrustAddTrustedResult.from_dict( + await self._client.request( + "session.permissions.folderTrust.addTrusted", + params_dict, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17426,11 +22774,19 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def set_unrestricted_mode(self, params: PermissionUrlsSetUnrestrictedModeParams, *, timeout: float | None = None) -> PermissionsUrlsSetUnrestrictedModeResult: + async def set_unrestricted_mode( + self, params: PermissionUrlsSetUnrestrictedModeParams, *, timeout: float | None = None + ) -> PermissionsUrlsSetUnrestrictedModeResult: "Toggles the runtime's URL-permission policy between unrestricted and restricted modes.\n\nArgs:\n params: Whether the URL-permission policy should run in unrestricted mode.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsUrlsSetUnrestrictedModeResult.from_dict(await self._client.request("session.permissions.urls.setUnrestrictedMode", params_dict, **_timeout_kwargs(timeout))) + return PermissionsUrlsSetUnrestrictedModeResult.from_dict( + await self._client.request( + "session.permissions.urls.setUnrestrictedMode", + params_dict, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17443,49 +22799,103 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self.folder_trust = PermissionsFolderTrustApi(client, session_id) self.urls = PermissionsUrlsApi(client, session_id) - async def configure(self, params: PermissionsConfigureParams, *, timeout: float | None = None) -> PermissionsConfigureResult: + async def configure( + self, params: PermissionsConfigureParams, *, timeout: float | None = None + ) -> PermissionsConfigureResult: "Replaces selected permission policy fields (rules, paths, URLs, exclusions, allow-all flags) on the session.\n\nArgs:\n params: Patch of permission policy fields to apply (omit a field to leave it unchanged).\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsConfigureResult.from_dict(await self._client.request("session.permissions.configure", params_dict, **_timeout_kwargs(timeout))) - - async def handle_pending_permission_request(self, params: PermissionDecisionRequest, *, timeout: float | None = None) -> PermissionRequestResult: + return PermissionsConfigureResult.from_dict( + await self._client.request( + "session.permissions.configure", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def handle_pending_permission_request( + self, params: PermissionDecisionRequest, *, timeout: float | None = None + ) -> PermissionRequestResult: "Provides a decision for a pending tool permission request.\n\nArgs:\n params: Pending permission request ID and the decision to apply (approve/reject and scope).\n\nReturns:\n Indicates whether the permission decision was applied; false when the request was already resolved." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionRequestResult.from_dict(await self._client.request("session.permissions.handlePendingPermissionRequest", params_dict, **_timeout_kwargs(timeout))) - - async def pending_requests(self, *, timeout: float | None = None) -> PendingPermissionRequestList: + return PermissionRequestResult.from_dict( + await self._client.request( + "session.permissions.handlePendingPermissionRequest", + params_dict, + **_timeout_kwargs(timeout), + ) + ) + + async def pending_requests( + self, *, timeout: float | None = None + ) -> PendingPermissionRequestList: "Reconstructs the set of pending tool permission requests from the session's event history.\n\nReturns:\n List of pending permission requests reconstructed from event history." - return PendingPermissionRequestList.from_dict(await self._client.request("session.permissions.pendingRequests", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def set_approve_all(self, params: PermissionsSetApproveAllRequest, *, timeout: float | None = None) -> PermissionsSetApproveAllResult: + return PendingPermissionRequestList.from_dict( + await self._client.request( + "session.permissions.pendingRequests", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def set_approve_all( + self, params: PermissionsSetApproveAllRequest, *, timeout: float | None = None + ) -> PermissionsSetApproveAllResult: "Enables or disables automatic approval of tool permission requests for the session.\n\nArgs:\n params: Allow-all toggle for tool permission requests, with an optional telemetry source.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsSetApproveAllResult.from_dict(await self._client.request("session.permissions.setApproveAll", params_dict, **_timeout_kwargs(timeout))) - - async def modify_rules(self, params: PermissionsModifyRulesParams, *, timeout: float | None = None) -> PermissionsModifyRulesResult: + return PermissionsSetApproveAllResult.from_dict( + await self._client.request( + "session.permissions.setApproveAll", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def modify_rules( + self, params: PermissionsModifyRulesParams, *, timeout: float | None = None + ) -> PermissionsModifyRulesResult: "Adds or removes session-scoped or location-scoped permission rules.\n\nArgs:\n params: Scope and add/remove instructions for modifying session- or location-scoped permission rules.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsModifyRulesResult.from_dict(await self._client.request("session.permissions.modifyRules", params_dict, **_timeout_kwargs(timeout))) - - async def set_required(self, params: PermissionsSetRequiredRequest, *, timeout: float | None = None) -> PermissionsSetRequiredResult: + return PermissionsModifyRulesResult.from_dict( + await self._client.request( + "session.permissions.modifyRules", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def set_required( + self, params: PermissionsSetRequiredRequest, *, timeout: float | None = None + ) -> PermissionsSetRequiredResult: "Sets whether the client wants permission prompts bridged into session events.\n\nArgs:\n params: Toggles whether permission prompts should be bridged into session events for this client.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsSetRequiredResult.from_dict(await self._client.request("session.permissions.setRequired", params_dict, **_timeout_kwargs(timeout))) - - async def reset_session_approvals(self, *, timeout: float | None = None) -> PermissionsResetSessionApprovalsResult: + return PermissionsSetRequiredResult.from_dict( + await self._client.request( + "session.permissions.setRequired", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def reset_session_approvals( + self, *, timeout: float | None = None + ) -> PermissionsResetSessionApprovalsResult: "Clears session-scoped tool permission approvals.\n\nReturns:\n Indicates whether the operation succeeded." - return PermissionsResetSessionApprovalsResult.from_dict(await self._client.request("session.permissions.resetSessionApprovals", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def notify_prompt_shown(self, params: PermissionPromptShownNotification, *, timeout: float | None = None) -> PermissionsNotifyPromptShownResult: + return PermissionsResetSessionApprovalsResult.from_dict( + await self._client.request( + "session.permissions.resetSessionApprovals", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def notify_prompt_shown( + self, params: PermissionPromptShownNotification, *, timeout: float | None = None + ) -> PermissionsNotifyPromptShownResult: "Notifies the runtime that a permission prompt UI has been shown to the user.\n\nArgs:\n params: Notification payload describing the permission prompt that the client just rendered.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsNotifyPromptShownResult.from_dict(await self._client.request("session.permissions.notifyPromptShown", params_dict, **_timeout_kwargs(timeout))) + return PermissionsNotifyPromptShownResult.from_dict( + await self._client.request( + "session.permissions.notifyPromptShown", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17496,35 +22906,71 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def snapshot(self, *, timeout: float | None = None) -> SessionMetadataSnapshot: "Returns a snapshot of the session's identifying metadata, mode, agent, and remote info.\n\nReturns:\n Point-in-time snapshot of slow-changing session identifier and state fields" - return SessionMetadataSnapshot.from_dict(await self._client.request("session.metadata.snapshot", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return SessionMetadataSnapshot.from_dict( + await self._client.request( + "session.metadata.snapshot", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) async def is_processing(self, *, timeout: float | None = None) -> MetadataIsProcessingResult: "Reports whether the local session is currently processing user/agent messages.\n\nReturns:\n Indicates whether the local session is currently processing a turn or background continuation." - return MetadataIsProcessingResult.from_dict(await self._client.request("session.metadata.isProcessing", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def context_info(self, params: MetadataContextInfoRequest, *, timeout: float | None = None) -> MetadataContextInfoResult: + return MetadataIsProcessingResult.from_dict( + await self._client.request( + "session.metadata.isProcessing", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def context_info( + self, params: MetadataContextInfoRequest, *, timeout: float | None = None + ) -> MetadataContextInfoResult: "Returns the token breakdown for the session's current context window for a given model.\n\nArgs:\n params: Model identifier and token limits used to compute the context-info breakdown.\n\nReturns:\n Token breakdown for the session's current context window, or null if uninitialized." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataContextInfoResult.from_dict(await self._client.request("session.metadata.contextInfo", params_dict, **_timeout_kwargs(timeout))) - - async def record_context_change(self, params: MetadataRecordContextChangeRequest, *, timeout: float | None = None) -> MetadataRecordContextChangeResult: + return MetadataContextInfoResult.from_dict( + await self._client.request( + "session.metadata.contextInfo", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def record_context_change( + self, params: MetadataRecordContextChangeRequest, *, timeout: float | None = None + ) -> MetadataRecordContextChangeResult: "Records a working-directory/git context change and emits a `session.context_changed` event.\n\nArgs:\n params: Updated working-directory/git context to record on the session.\n\nReturns:\n Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode)." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataRecordContextChangeResult.from_dict(await self._client.request("session.metadata.recordContextChange", params_dict, **_timeout_kwargs(timeout))) - - async def set_working_directory(self, params: MetadataSetWorkingDirectoryRequest, *, timeout: float | None = None) -> MetadataSetWorkingDirectoryResult: + return MetadataRecordContextChangeResult.from_dict( + await self._client.request( + "session.metadata.recordContextChange", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def set_working_directory( + self, params: MetadataSetWorkingDirectoryRequest, *, timeout: float | None = None + ) -> MetadataSetWorkingDirectoryResult: "Updates the session's recorded working directory.\n\nArgs:\n params: Absolute path to set as the session's new working directory.\n\nReturns:\n Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataSetWorkingDirectoryResult.from_dict(await self._client.request("session.metadata.setWorkingDirectory", params_dict, **_timeout_kwargs(timeout))) - - async def recompute_context_tokens(self, params: MetadataRecomputeContextTokensRequest, *, timeout: float | None = None) -> MetadataRecomputeContextTokensResult: + return MetadataSetWorkingDirectoryResult.from_dict( + await self._client.request( + "session.metadata.setWorkingDirectory", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def recompute_context_tokens( + self, params: MetadataRecomputeContextTokensRequest, *, timeout: float | None = None + ) -> MetadataRecomputeContextTokensResult: "Re-tokenizes the session's existing messages against a model and returns aggregate token totals.\n\nArgs:\n params: Model identifier to use when re-tokenizing the session's existing messages.\n\nReturns:\n Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataRecomputeContextTokensResult.from_dict(await self._client.request("session.metadata.recomputeContextTokens", params_dict, **_timeout_kwargs(timeout))) + return MetadataRecomputeContextTokensResult.from_dict( + await self._client.request( + "session.metadata.recomputeContextTokens", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17533,17 +22979,29 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def exec(self, params: ShellExecRequest, *, timeout: float | None = None) -> ShellExecResult: + async def exec( + self, params: ShellExecRequest, *, timeout: float | None = None + ) -> ShellExecResult: "Starts a shell command and streams output through session notifications.\n\nArgs:\n params: Shell command to run, with optional working directory and timeout in milliseconds.\n\nReturns:\n Identifier of the spawned process, used to correlate streamed output and exit notifications." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ShellExecResult.from_dict(await self._client.request("session.shell.exec", params_dict, **_timeout_kwargs(timeout))) - - async def kill(self, params: ShellKillRequest, *, timeout: float | None = None) -> ShellKillResult: - "Sends a signal to a shell process previously started via \"shell.exec\".\n\nArgs:\n params: Identifier of a process previously returned by \"shell.exec\" and the signal to send.\n\nReturns:\n Indicates whether the signal was delivered; false if the process was unknown or already exited." + return ShellExecResult.from_dict( + await self._client.request( + "session.shell.exec", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def kill( + self, params: ShellKillRequest, *, timeout: float | None = None + ) -> ShellKillResult: + 'Sends a signal to a shell process previously started via "shell.exec".\n\nArgs:\n params: Identifier of a process previously returned by "shell.exec" and the signal to send.\n\nReturns:\n Indicates whether the signal was delivered; false if the process was unknown or already exited.' params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ShellKillResult.from_dict(await self._client.request("session.shell.kill", params_dict, **_timeout_kwargs(timeout))) + return ShellKillResult.from_dict( + await self._client.request( + "session.shell.kill", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17552,29 +23010,69 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def compact(self, params: HistoryCompactRequest | None = None, *, timeout: float | None = None) -> HistoryCompactResult: + async def compact( + self, params: HistoryCompactRequest | None = None, *, timeout: float | None = None + ) -> HistoryCompactResult: "Compacts the session history to reduce context usage.\n\nArgs:\n params: Optional compaction parameters.\n\nReturns:\n Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown." - params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} + params_dict: dict[str, Any] = ( + {k: v for k, v in params.to_dict().items() if v is not None} + if params is not None + else {} + ) params_dict["sessionId"] = self._session_id - return HistoryCompactResult.from_dict(await self._client.request("session.history.compact", params_dict, **_timeout_kwargs(timeout))) - - async def truncate(self, params: HistoryTruncateRequest, *, timeout: float | None = None) -> HistoryTruncateResult: + return HistoryCompactResult.from_dict( + await self._client.request( + "session.history.compact", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def truncate( + self, params: HistoryTruncateRequest, *, timeout: float | None = None + ) -> HistoryTruncateResult: "Truncates persisted session history to a specific event.\n\nArgs:\n params: Identifier of the event to truncate to; this event and all later events are removed.\n\nReturns:\n Number of events that were removed by the truncation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return HistoryTruncateResult.from_dict(await self._client.request("session.history.truncate", params_dict, **_timeout_kwargs(timeout))) - - async def cancel_background_compaction(self, *, timeout: float | None = None) -> HistoryCancelBackgroundCompactionResult: + return HistoryTruncateResult.from_dict( + await self._client.request( + "session.history.truncate", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def cancel_background_compaction( + self, *, timeout: float | None = None + ) -> HistoryCancelBackgroundCompactionResult: "Cancels any in-progress background compaction on a local session.\n\nReturns:\n Indicates whether an in-progress background compaction was cancelled." - return HistoryCancelBackgroundCompactionResult.from_dict(await self._client.request("session.history.cancelBackgroundCompaction", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def abort_manual_compaction(self, *, timeout: float | None = None) -> HistoryAbortManualCompactionResult: + return HistoryCancelBackgroundCompactionResult.from_dict( + await self._client.request( + "session.history.cancelBackgroundCompaction", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def abort_manual_compaction( + self, *, timeout: float | None = None + ) -> HistoryAbortManualCompactionResult: "Aborts any in-progress manual compaction on a local session.\n\nReturns:\n Indicates whether an in-progress manual compaction was aborted." - return HistoryAbortManualCompactionResult.from_dict(await self._client.request("session.history.abortManualCompaction", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def summarize_for_handoff(self, *, timeout: float | None = None) -> HistorySummarizeForHandoffResult: + return HistoryAbortManualCompactionResult.from_dict( + await self._client.request( + "session.history.abortManualCompaction", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def summarize_for_handoff( + self, *, timeout: float | None = None + ) -> HistorySummarizeForHandoffResult: "Produces a markdown summary of the session's conversation context for hand-off scenarios.\n\nReturns:\n Markdown summary of the conversation context (empty when not available)." - return HistorySummarizeForHandoffResult.from_dict(await self._client.request("session.history.summarizeForHandoff", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return HistorySummarizeForHandoffResult.from_dict( + await self._client.request( + "session.history.summarizeForHandoff", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17585,15 +23083,31 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def pending_items(self, *, timeout: float | None = None) -> QueuePendingItemsResult: "Returns the local session's pending user-facing queued items and steering messages.\n\nReturns:\n Snapshot of the session's pending queued items and immediate-steering messages." - return QueuePendingItemsResult.from_dict(await self._client.request("session.queue.pendingItems", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def remove_most_recent(self, *, timeout: float | None = None) -> QueueRemoveMostRecentResult: + return QueuePendingItemsResult.from_dict( + await self._client.request( + "session.queue.pendingItems", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) + + async def remove_most_recent( + self, *, timeout: float | None = None + ) -> QueueRemoveMostRecentResult: "Removes the most recently queued user-facing item (LIFO).\n\nReturns:\n Indicates whether a user-facing pending item was removed." - return QueueRemoveMostRecentResult.from_dict(await self._client.request("session.queue.removeMostRecent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return QueueRemoveMostRecentResult.from_dict( + await self._client.request( + "session.queue.removeMostRecent", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) async def clear(self, *, timeout: float | None = None) -> None: "Clears all pending queued items on the local session." - await self._client.request("session.queue.clear", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.queue.clear", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17602,27 +23116,49 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def read(self, params: EventLogReadRequest, *, timeout: float | None = None) -> EventsReadResult: + async def read( + self, params: EventLogReadRequest, *, timeout: float | None = None + ) -> EventsReadResult: "Reads a batch of session events from a cursor, optionally waiting for new events.\n\nArgs:\n params: Cursor, batch size, and optional long-poll/filter parameters for reading session events.\n\nReturns:\n Batch of session events returned by a read, with cursor and continuation metadata." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return EventsReadResult.from_dict(await self._client.request("session.eventLog.read", params_dict, **_timeout_kwargs(timeout))) + return EventsReadResult.from_dict( + await self._client.request( + "session.eventLog.read", params_dict, **_timeout_kwargs(timeout) + ) + ) async def tail(self, *, timeout: float | None = None) -> EventLogTailResult: "Returns a snapshot of the current tail cursor without consuming events.\n\nReturns:\n Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session)." - return EventLogTailResult.from_dict(await self._client.request("session.eventLog.tail", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def register_interest(self, params: RegisterEventInterestParams, *, timeout: float | None = None) -> RegisterEventInterestResult: + return EventLogTailResult.from_dict( + await self._client.request( + "session.eventLog.tail", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) + + async def register_interest( + self, params: RegisterEventInterestParams, *, timeout: float | None = None + ) -> RegisterEventInterestResult: "Registers consumer interest in an event type for runtime gating purposes.\n\nArgs:\n params: Event type to register consumer interest for, used by runtime gating logic.\n\nReturns:\n Opaque handle representing an event-type interest registration." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return RegisterEventInterestResult.from_dict(await self._client.request("session.eventLog.registerInterest", params_dict, **_timeout_kwargs(timeout))) - - async def release_interest(self, params: ReleaseEventInterestParams, *, timeout: float | None = None) -> EventLogReleaseInterestResult: + return RegisterEventInterestResult.from_dict( + await self._client.request( + "session.eventLog.registerInterest", params_dict, **_timeout_kwargs(timeout) + ) + ) + + async def release_interest( + self, params: ReleaseEventInterestParams, *, timeout: float | None = None + ) -> EventLogReleaseInterestResult: "Releases a consumer's previously-registered interest in an event type.\n\nArgs:\n params: Opaque handle previously returned by `registerInterest` to release.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return EventLogReleaseInterestResult.from_dict(await self._client.request("session.eventLog.releaseInterest", params_dict, **_timeout_kwargs(timeout))) + return EventLogReleaseInterestResult.from_dict( + await self._client.request( + "session.eventLog.releaseInterest", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17633,7 +23169,13 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_metrics(self, *, timeout: float | None = None) -> UsageGetMetricsResult: "Gets accumulated usage metrics for the session.\n\nReturns:\n Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals." - return UsageGetMetricsResult.from_dict(await self._client.request("session.usage.getMetrics", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + return UsageGetMetricsResult.from_dict( + await self._client.request( + "session.usage.getMetrics", + {"sessionId": self._session_id}, + **_timeout_kwargs(timeout), + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17642,21 +23184,35 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def enable(self, params: RemoteEnableRequest, *, timeout: float | None = None) -> RemoteEnableResult: - "Enables remote session export or steering.\n\nArgs:\n params: Optional remote session mode (\"off\", \"export\", or \"on\"); defaults to enabling both export and remote steering.\n\nReturns:\n GitHub URL for the session and a flag indicating whether remote steering is enabled." + async def enable( + self, params: RemoteEnableRequest, *, timeout: float | None = None + ) -> RemoteEnableResult: + 'Enables remote session export or steering.\n\nArgs:\n params: Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering.\n\nReturns:\n GitHub URL for the session and a flag indicating whether remote steering is enabled.' params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return RemoteEnableResult.from_dict(await self._client.request("session.remote.enable", params_dict, **_timeout_kwargs(timeout))) + return RemoteEnableResult.from_dict( + await self._client.request( + "session.remote.enable", params_dict, **_timeout_kwargs(timeout) + ) + ) async def disable(self, *, timeout: float | None = None) -> None: "Disables remote session export and steering." - await self._client.request("session.remote.disable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.remote.disable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) - async def notify_steerable_changed(self, params: RemoteNotifySteerableChangedRequest, *, timeout: float | None = None) -> RemoteNotifySteerableChangedResult: + async def notify_steerable_changed( + self, params: RemoteNotifySteerableChangedRequest, *, timeout: float | None = None + ) -> RemoteNotifySteerableChangedResult: "Persists a remote-steerability change emitted by the host as a session event.\n\nArgs:\n params: New remote-steerability state to persist as a `session.remote_steerable_changed` event.\n\nReturns:\n Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return RemoteNotifySteerableChangedResult.from_dict(await self._client.request("session.remote.notifySteerableChanged", params_dict, **_timeout_kwargs(timeout))) + return RemoteNotifySteerableChangedResult.from_dict( + await self._client.request( + "session.remote.notifySteerableChanged", params_dict, **_timeout_kwargs(timeout) + ) + ) # Experimental: this API group is experimental and may change or be removed. @@ -17667,17 +23223,28 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> ScheduleList: "Lists the session's currently active scheduled prompts.\n\nReturns:\n Snapshot of the currently active recurring prompts for this session." - return ScheduleList.from_dict(await self._client.request("session.schedule.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) - - async def stop(self, params: ScheduleStopRequest, *, timeout: float | None = None) -> ScheduleStopResult: + return ScheduleList.from_dict( + await self._client.request( + "session.schedule.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) + ) + + async def stop( + self, params: ScheduleStopRequest, *, timeout: float | None = None + ) -> ScheduleStopResult: "Removes a scheduled prompt by id.\n\nArgs:\n params: Identifier of the scheduled prompt to remove.\n\nReturns:\n Remove a scheduled prompt by id. The result entry is omitted if the id was unknown." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ScheduleStopResult.from_dict(await self._client.request("session.schedule.stop", params_dict, **_timeout_kwargs(timeout))) + return ScheduleStopResult.from_dict( + await self._client.request( + "session.schedule.stop", params_dict, **_timeout_kwargs(timeout) + ) + ) class SessionRpc: """Typed session-scoped RPC methods.""" + def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id @@ -17714,19 +23281,25 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def suspend(self, *, timeout: float | None = None) -> None: "Suspends the session while preserving persisted state for later resume.\n\n.. warning:: This API is experimental and may change or be removed in future versions." - await self._client.request("session.suspend", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) + await self._client.request( + "session.suspend", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) + ) async def send(self, params: SendRequest, *, timeout: float | None = None) -> SendResult: "Sends a user message to the session and returns its message ID.\n\nArgs:\n params: Parameters for sending a user message to the session\n\nReturns:\n Result of sending a user message\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SendResult.from_dict(await self._client.request("session.send", params_dict, **_timeout_kwargs(timeout))) + return SendResult.from_dict( + await self._client.request("session.send", params_dict, **_timeout_kwargs(timeout)) + ) async def abort(self, params: AbortRequest, *, timeout: float | None = None) -> AbortResult: "Aborts the current agent turn.\n\nArgs:\n params: Parameters for aborting the current turn\n\nReturns:\n Result of aborting the current turn\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return AbortResult.from_dict(await self._client.request("session.abort", params_dict, **_timeout_kwargs(timeout))) + return AbortResult.from_dict( + await self._client.request("session.abort", params_dict, **_timeout_kwargs(timeout)) + ) async def shutdown(self, params: ShutdownRequest, *, timeout: float | None = None) -> None: "Shuts down the session and persists its final state. Awaits any deferred sessionEnd hooks before resolving so user-supplied hook scripts complete before the runtime tears down.\n\nArgs:\n params: Parameters for shutting down the session\n\n.. warning:: This API is experimental and may change or be removed in future versions." @@ -17738,137 +23311,261 @@ async def log(self, params: LogRequest, *, timeout: float | None = None) -> LogR "Emits a user-visible session log event.\n\nArgs:\n params: Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip.\n\nReturns:\n Identifier of the session event that was emitted for the log message.\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return LogResult.from_dict(await self._client.request("session.log", params_dict, **_timeout_kwargs(timeout))) + return LogResult.from_dict( + await self._client.request("session.log", params_dict, **_timeout_kwargs(timeout)) + ) class SessionFsHandler(Protocol): async def read_file(self, params: SessionFSReadFileRequest) -> SessionFSReadFileResult: "Reads a file from the client-provided session filesystem.\n\nArgs:\n params: Path of the file to read from the client-provided session filesystem.\n\nReturns:\n File content as a UTF-8 string, or a filesystem error if the read failed." pass + async def write_file(self, params: SessionFSWriteFileRequest) -> SessionFSError | None: "Writes a file in the client-provided session filesystem.\n\nArgs:\n params: File path, content to write, and optional mode for the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass + async def append_file(self, params: SessionFSAppendFileRequest) -> SessionFSError | None: "Appends content to a file in the client-provided session filesystem.\n\nArgs:\n params: File path, content to append, and optional mode for the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass + async def exists(self, params: SessionFSExistsRequest) -> SessionFSExistsResult: "Checks whether a path exists in the client-provided session filesystem.\n\nArgs:\n params: Path to test for existence in the client-provided session filesystem.\n\nReturns:\n Indicates whether the requested path exists in the client-provided session filesystem." pass + async def stat(self, params: SessionFSStatRequest) -> SessionFSStatResult: "Gets metadata for a path in the client-provided session filesystem.\n\nArgs:\n params: Path whose metadata should be returned from the client-provided session filesystem.\n\nReturns:\n Filesystem metadata for the requested path, or a filesystem error if the stat failed." pass + async def mkdir(self, params: SessionFSMkdirRequest) -> SessionFSError | None: "Creates a directory in the client-provided session filesystem.\n\nArgs:\n params: Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode.\n\nReturns:\n Describes a filesystem error." pass + async def readdir(self, params: SessionFSReaddirRequest) -> SessionFSReaddirResult: "Lists entry names in a directory from the client-provided session filesystem.\n\nArgs:\n params: Directory path whose entries should be listed from the client-provided session filesystem.\n\nReturns:\n Names of entries in the requested directory, or a filesystem error if the read failed." pass - async def readdir_with_types(self, params: SessionFSReaddirWithTypesRequest) -> SessionFSReaddirWithTypesResult: + + async def readdir_with_types( + self, params: SessionFSReaddirWithTypesRequest + ) -> SessionFSReaddirWithTypesResult: "Lists directory entries with type information from the client-provided session filesystem.\n\nArgs:\n params: Directory path whose entries (with type information) should be listed from the client-provided session filesystem.\n\nReturns:\n Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed." pass + async def rm(self, params: SessionFSRmRequest) -> SessionFSError | None: "Removes a file or directory from the client-provided session filesystem.\n\nArgs:\n params: Path to remove from the client-provided session filesystem, with options for recursive removal and force.\n\nReturns:\n Describes a filesystem error." pass + async def rename(self, params: SessionFSRenameRequest) -> SessionFSError | None: "Renames or moves a path in the client-provided session filesystem.\n\nArgs:\n params: Source and destination paths for renaming or moving an entry in the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass + async def sqlite_query(self, params: SessionFSSqliteQueryRequest) -> SessionFSSqliteQueryResult: "Executes a SQLite query against the per-session database.\n\nArgs:\n params: SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database.\n\nReturns:\n Query results including rows, columns, and rows affected, or a filesystem error if execution failed." pass - async def sqlite_exists(self, params: SessionFSSqliteExistsRequest) -> SessionFSSqliteExistsResult: + + async def sqlite_exists( + self, params: SessionFSSqliteExistsRequest + ) -> SessionFSSqliteExistsResult: "Checks whether the per-session SQLite database already exists, without creating it.\n\nArgs:\n params: Identifies the target session.\n\nReturns:\n Indicates whether the per-session SQLite database already exists." pass + +class CanvasHandler(Protocol): + async def open(self, params: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: + "Opens a canvas instance on the provider.\n\nArgs:\n params: Canvas open parameters sent to the provider.\n\nReturns:\n Canvas open result returned by the provider." + pass + + async def close(self, params: CanvasProviderCloseRequest) -> None: + "Closes a canvas instance on the provider.\n\nArgs:\n params: Canvas close parameters sent to the provider." + pass + + async def invoke_action(self, params: CanvasProviderInvokeActionRequest) -> Any: + "Invokes an action on an open canvas instance via the provider.\n\nArgs:\n params: Canvas action invocation parameters sent to the provider.\n\nReturns:\n Provider-supplied action result." + pass + + @dataclass class ClientSessionApiHandlers: session_fs: SessionFsHandler | None = None + canvas: CanvasHandler | None = None + def register_client_session_api_handlers( client: "JsonRpcClient", get_handlers: Callable[[str], ClientSessionApiHandlers], ) -> None: """Register client-session request handlers on a JSON-RPC connection.""" + async def handle_session_fs_read_file(params: dict) -> dict | None: request = SessionFSReadFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.read_file(request) return result.to_dict() + client.set_request_handler("sessionFs.readFile", handle_session_fs_read_file) + async def handle_session_fs_write_file(params: dict) -> dict | None: request = SessionFSWriteFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.write_file(request) return result.to_dict() if result is not None else None + client.set_request_handler("sessionFs.writeFile", handle_session_fs_write_file) + async def handle_session_fs_append_file(params: dict) -> dict | None: request = SessionFSAppendFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.append_file(request) return result.to_dict() if result is not None else None + client.set_request_handler("sessionFs.appendFile", handle_session_fs_append_file) + async def handle_session_fs_exists(params: dict) -> dict | None: request = SessionFSExistsRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.exists(request) return result.to_dict() + client.set_request_handler("sessionFs.exists", handle_session_fs_exists) + async def handle_session_fs_stat(params: dict) -> dict | None: request = SessionFSStatRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.stat(request) return result.to_dict() + client.set_request_handler("sessionFs.stat", handle_session_fs_stat) + async def handle_session_fs_mkdir(params: dict) -> dict | None: request = SessionFSMkdirRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.mkdir(request) return result.to_dict() if result is not None else None + client.set_request_handler("sessionFs.mkdir", handle_session_fs_mkdir) + async def handle_session_fs_readdir(params: dict) -> dict | None: request = SessionFSReaddirRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.readdir(request) return result.to_dict() + client.set_request_handler("sessionFs.readdir", handle_session_fs_readdir) + async def handle_session_fs_readdir_with_types(params: dict) -> dict | None: request = SessionFSReaddirWithTypesRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.readdir_with_types(request) return result.to_dict() + client.set_request_handler("sessionFs.readdirWithTypes", handle_session_fs_readdir_with_types) + async def handle_session_fs_rm(params: dict) -> dict | None: request = SessionFSRmRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.rm(request) return result.to_dict() if result is not None else None + client.set_request_handler("sessionFs.rm", handle_session_fs_rm) + async def handle_session_fs_rename(params: dict) -> dict | None: request = SessionFSRenameRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.rename(request) return result.to_dict() if result is not None else None + client.set_request_handler("sessionFs.rename", handle_session_fs_rename) + async def handle_session_fs_sqlite_query(params: dict) -> dict | None: request = SessionFSSqliteQueryRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.sqlite_query(request) return result.to_dict() + client.set_request_handler("sessionFs.sqliteQuery", handle_session_fs_sqlite_query) + async def handle_session_fs_sqlite_exists(params: dict) -> dict | None: request = SessionFSSqliteExistsRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") + if handler is None: + raise RuntimeError( + f"No session_fs handler registered for session: {request.session_id}" + ) result = await handler.sqlite_exists(request) return result.to_dict() + client.set_request_handler("sessionFs.sqliteExists", handle_session_fs_sqlite_exists) + + async def handle_canvas_open(params: dict) -> dict | None: + request = CanvasProviderOpenRequest.from_dict(params) + handler = get_handlers(request.session_id).canvas + if handler is None: + raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") + result = await handler.open(request) + return result.to_dict() + + client.set_request_handler("canvas.open", handle_canvas_open) + + async def handle_canvas_close(params: dict) -> dict | None: + request = CanvasProviderCloseRequest.from_dict(params) + handler = get_handlers(request.session_id).canvas + if handler is None: + raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") + await handler.close(request) + return None + + client.set_request_handler("canvas.close", handle_canvas_close) + + async def handle_canvas_invoke_action(params: dict) -> dict | None: + request = CanvasProviderInvokeActionRequest.from_dict(params) + handler = get_handlers(request.session_id).canvas + if handler is None: + raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") + result = await handler.invoke_action(request) + return result.value if hasattr(result, "value") else result + + client.set_request_handler("canvas.invokeAction", handle_canvas_invoke_action) diff --git a/python/copilot/session.py b/python/copilot/session.py index 90134a151..b17e88ec4 100644 --- a/python/copilot/session.py +++ b/python/copilot/session.py @@ -25,8 +25,15 @@ from ._diagnostics import log_timing from ._jsonrpc import JsonRpcError, ProcessExitedError from ._telemetry import get_trace_context, trace_context -from .canvas import CanvasHandler, OpenCanvasInstance +from .canvas import CanvasError, CanvasHandler, OpenCanvasInstance from .generated.rpc import ( + CanvasHandler as RpcCanvasHandler, +) +from .generated.rpc import ( + CanvasProviderCloseRequest, + CanvasProviderInvokeActionRequest, + CanvasProviderOpenRequest, + CanvasProviderOpenResult, ClientSessionApiHandlers, CommandsHandlePendingCommandRequest, ExternalToolTextResultForLlm, @@ -955,6 +962,29 @@ class ProviderConfig(TypedDict, total=False): SessionEventHandler = Callable[[SessionEvent], None] +class _CanvasHandlerAdapter: + def __init__(self, handler: CanvasHandler) -> None: + self._handler = handler + + async def open(self, params: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: + try: + return await self._handler.on_open(params) + except CanvasError as err: + raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err + + async def close(self, params: CanvasProviderCloseRequest) -> None: + try: + await self._handler.on_close(params) + except CanvasError as err: + raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err + + async def invoke_action(self, params: CanvasProviderInvokeActionRequest) -> Any: + try: + return await self._handler.on_action(params) + except CanvasError as err: + raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err + + class CopilotSession: """ Represents a single conversation session with the Copilot CLI. @@ -1748,6 +1778,11 @@ def _register_canvas_handler(self, handler: CanvasHandler | None) -> None: """Register the canvas handler for this session.""" with self._canvas_handler_lock: self._canvas_handler = handler + self._client_session_apis.canvas = ( + cast(RpcCanvasHandler, _CanvasHandlerAdapter(handler)) + if handler is not None + else None + ) def _get_canvas_handler(self) -> CanvasHandler | None: with self._canvas_handler_lock: diff --git a/python/e2e/test_canvas_e2e.py b/python/e2e/test_canvas_e2e.py new file mode 100644 index 000000000..77bd932fd --- /dev/null +++ b/python/e2e/test_canvas_e2e.py @@ -0,0 +1,165 @@ +"""E2E tests for canvas RPCs.""" + +from __future__ import annotations + +import pytest + +from copilot import ( + CanvasAction, + CanvasActionContext, + CanvasDeclaration, + CanvasHandler, + CanvasLifecycleContext, + CanvasOpenContext, + CanvasOpenResponse, +) +from copilot.generated.rpc import CanvasCloseRequest, CanvasInvokeActionRequest, CanvasOpenRequest +from copilot.session import CopilotSession, PermissionHandler + +from .testharness import E2ETestContext + +pytestmark = pytest.mark.asyncio(loop_scope="module") + + +class _CounterCanvasHandler(CanvasHandler): + def __init__(self) -> None: + self.open_calls: list[CanvasOpenContext] = [] + self.action_calls: list[CanvasActionContext] = [] + self.close_calls: list[CanvasLifecycleContext] = [] + + async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: + self.open_calls.append(ctx) + return CanvasOpenResponse( + url="https://example.test/counter", + title="Counter Canvas", + status="ready", + ) + + async def on_close(self, ctx: CanvasLifecycleContext) -> None: + self.close_calls.append(ctx) + + async def on_action(self, ctx: CanvasActionContext) -> dict[str, int]: + self.action_calls.append(ctx) + return {"newValue": 42} + + +def _counter_canvas() -> CanvasDeclaration: + return CanvasDeclaration( + id="counter", + display_name="Counter", + description="A simple counter canvas for e2e testing", + input_schema={ + "type": "object", + "properties": {"startValue": {"type": "number"}}, + }, + actions=[ + CanvasAction( + name="increment", + description="Increment the counter", + input_schema={ + "type": "object", + "properties": {"amount": {"type": "number"}}, + }, + ) + ], + ) + + +async def _create_counter_session( + ctx: E2ETestContext, +) -> tuple[_CounterCanvasHandler, CopilotSession]: + handler = _CounterCanvasHandler() + session = await ctx.client.create_session( + on_permission_request=PermissionHandler.approve_all, + canvases=[_counter_canvas()], + canvas_handler=handler, + ) + return handler, session + + +class TestCanvasRpc: + async def test_should_list_canvases(self, ctx: E2ETestContext): + _handler, session = await _create_counter_session(ctx) + try: + result = await session.rpc.canvas.list() + + assert len(result.canvases) == 1 + assert result.canvases[0].canvas_id == "counter" + assert result.canvases[0].display_name == "Counter" + assert result.canvases[0].description == "A simple counter canvas for e2e testing" + finally: + await session.disconnect() + + async def test_should_round_trip_canvas_open(self, ctx: E2ETestContext): + handler, session = await _create_counter_session(ctx) + try: + result = await session.rpc.canvas.open( + CanvasOpenRequest( + canvas_id="counter", + instance_id="counter-1", + input={"startValue": 10}, + ) + ) + + assert result.url == "https://example.test/counter" + assert result.title == "Counter Canvas" + assert result.status == "ready" + assert len(handler.open_calls) == 1 + assert handler.open_calls[0].canvas_id == "counter" + assert handler.open_calls[0].instance_id == "counter-1" + assert handler.open_calls[0].input == {"startValue": 10} + + open_list = await session.rpc.canvas.list_open() + assert len(open_list.open_canvases) == 1 + assert open_list.open_canvases[0].instance_id == "counter-1" + finally: + await session.disconnect() + + async def test_should_invoke_canvas_action(self, ctx: E2ETestContext): + handler, session = await _create_counter_session(ctx) + try: + await session.rpc.canvas.open( + CanvasOpenRequest( + canvas_id="counter", + instance_id="counter-2", + input={}, + ) + ) + + result = await session.rpc.canvas.invoke_action( + CanvasInvokeActionRequest( + action_name="increment", + instance_id="counter-2", + input={"amount": 5}, + ) + ) + + assert result == {"result": {"newValue": 42}} + assert len(handler.action_calls) == 1 + assert handler.action_calls[0].canvas_id == "counter" + assert handler.action_calls[0].instance_id == "counter-2" + assert handler.action_calls[0].action_name == "increment" + assert handler.action_calls[0].input == {"amount": 5} + finally: + await session.disconnect() + + async def test_should_run_close_lifecycle(self, ctx: E2ETestContext): + handler, session = await _create_counter_session(ctx) + try: + await session.rpc.canvas.open( + CanvasOpenRequest( + canvas_id="counter", + instance_id="counter-3", + input={}, + ) + ) + await session.rpc.canvas.close(CanvasCloseRequest(instance_id="counter-3")) + + assert len(handler.close_calls) == 1 + assert handler.close_calls[0].canvas_id == "counter" + assert handler.close_calls[0].instance_id == "counter-3" + + open_list = await session.rpc.canvas.list_open() + assert open_list.open_canvases == [] + finally: + await session.disconnect() diff --git a/python/test_canvas.py b/python/test_canvas.py index 4c9ab223f..304b03abd 100644 --- a/python/test_canvas.py +++ b/python/test_canvas.py @@ -2,8 +2,7 @@ from __future__ import annotations -import threading -from typing import Any +from typing import Any, cast import pytest @@ -14,15 +13,19 @@ CanvasDeclaration, CanvasError, CanvasHandler, + CanvasLifecycleContext, CanvasOpenContext, CanvasOpenResponse, ExtensionInfo, OpenCanvasInstance, - _action_context_from_params, - _lifecycle_context_from_params, - _open_context_from_params, ) -from copilot.client import CopilotClient +from copilot.generated.rpc import ( + CanvasInstanceAvailability, + CanvasProviderCloseRequest, + CanvasProviderInvokeActionRequest, + CanvasProviderOpenRequest, +) +from copilot.session import CopilotSession def test_canvas_declaration_serializes_camelcase_and_drops_optional(): @@ -68,6 +71,12 @@ def test_canvas_open_response_drops_none_fields(): } +def test_context_aliases_use_codegen_types(): + assert CanvasOpenContext is CanvasProviderOpenRequest + assert CanvasActionContext is CanvasProviderInvokeActionRequest + assert CanvasLifecycleContext is CanvasProviderCloseRequest + + def test_canvas_error_envelope_and_factories(): err = CanvasError("oops", "something broke") assert err.code == "oops" @@ -100,143 +109,99 @@ async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: assert excinfo.value.code == "canvas_action_no_handler" -def test_context_helpers_parse_params(): - base = { - "sessionId": "s", - "extensionId": "e", - "canvasId": "c", - "instanceId": "i", - "input": {"foo": 1}, - "host": {"capabilities": {"canvases": True}}, - } - open_ctx = _open_context_from_params(base) - assert open_ctx.session_id == "s" - assert open_ctx.canvas_id == "c" - assert open_ctx.input == {"foo": 1} - assert open_ctx.host is not None and open_ctx.host.capabilities.canvases is True - - close_ctx = _lifecycle_context_from_params(base) - assert close_ctx.canvas_id == "c" - assert close_ctx.instance_id == "i" - - action_ctx = _action_context_from_params({**base, "actionName": "refresh"}) - assert action_ctx.action_name == "refresh" - - -class _StubSession: - """Minimal CopilotSession stand-in for the inbound dispatch tests.""" - - def __init__(self, handler: CanvasHandler | None) -> None: - self._handler = handler - self._open_canvases: list[OpenCanvasInstance] = [] - self._open_canvases_lock = threading.Lock() - - def _get_canvas_handler(self) -> CanvasHandler | None: - return self._handler - - def _set_open_canvases(self, instances: list[OpenCanvasInstance]) -> None: - with self._open_canvases_lock: - self._open_canvases = list(instances) - - @property - def open_canvases(self) -> list[OpenCanvasInstance]: - with self._open_canvases_lock: - return list(self._open_canvases) - - -def _make_client_with_session(session_id: str, session: Any) -> CopilotClient: - """Construct a CopilotClient skeleton sufficient for testing the inbound - canvas dispatch helpers without actually launching the CLI.""" - client = CopilotClient.__new__(CopilotClient) - client._sessions = {session_id: session} - client._sessions_lock = threading.Lock() - return client - - -async def test_handle_canvas_open_dispatches_to_handler(): +async def test_register_canvas_handler_wires_generated_canvas_adapter(): class Handler(CanvasHandler): def __init__(self) -> None: - self.received: CanvasOpenContext | None = None + self.open_calls: list[CanvasOpenContext] = [] + self.close_calls: list[CanvasLifecycleContext] = [] + self.action_calls: list[CanvasActionContext] = [] async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: - self.received = ctx - return CanvasOpenResponse(url="https://canvas.example", title="Hi") + self.open_calls.append(ctx) + return CanvasOpenResponse(url="https://canvas.example", title="Hi", status="ready") + + async def on_close(self, ctx: CanvasLifecycleContext) -> None: + self.close_calls.append(ctx) async def on_action(self, ctx: CanvasActionContext) -> Any: + self.action_calls.append(ctx) return {"echo": ctx.input} + session = CopilotSession("sess-1", client=None) handler = Handler() - session = _StubSession(handler) - client = _make_client_with_session("sess-1", session) - - result = await client._handle_canvas_open( - { - "sessionId": "sess-1", - "extensionId": "ext", - "canvasId": "c", - "instanceId": "i", - "input": {"q": 1}, - } - ) - assert result == {"url": "https://canvas.example", "title": "Hi"} - assert handler.received is not None - assert handler.received.canvas_id == "c" - + session._register_canvas_handler(handler) -async def test_handle_canvas_open_raises_when_handler_unset(): - session = _StubSession(handler=None) - client = _make_client_with_session("sess-1", session) - - with pytest.raises(CanvasError) as excinfo: - await client._handle_canvas_open( - { - "sessionId": "sess-1", - "extensionId": "ext", - "canvasId": "c", - "instanceId": "i", - } - ) - assert excinfo.value.code == "canvas_handler_unset" + adapter = session._client_session_apis.canvas + assert adapter is not None + assert session._get_canvas_handler() is handler + open_request = CanvasProviderOpenRequest( + canvas_id="c", + extension_id="ext", + instance_id="i", + session_id="sess-1", + input={"q": 1}, + ) + open_result = await adapter.open(open_request) + assert open_result.to_dict() == { + "url": "https://canvas.example", + "title": "Hi", + "status": "ready", + } + assert handler.open_calls == [open_request] -async def test_handle_canvas_action_returns_arbitrary_value(): - class Handler(CanvasHandler): - async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: - return CanvasOpenResponse() + close_request = CanvasProviderCloseRequest( + canvas_id="c", + extension_id="ext", + instance_id="i", + session_id="sess-1", + ) + await adapter.close(close_request) + assert handler.close_calls == [close_request] - async def on_action(self, ctx: CanvasActionContext) -> Any: - return [1, 2, 3] - - client = _make_client_with_session("sess-1", _StubSession(Handler())) - result = await client._handle_canvas_action_invoke( - { - "sessionId": "sess-1", - "extensionId": "ext", - "canvasId": "c", - "instanceId": "i", - "actionName": "do", - } + action_request = CanvasProviderInvokeActionRequest( + action_name="refresh", + canvas_id="c", + extension_id="ext", + instance_id="i", + session_id="sess-1", + input={"value": 1}, ) - assert result == [1, 2, 3] + action_result = await adapter.invoke_action(action_request) + assert action_result == {"echo": {"value": 1}} + assert handler.action_calls == [action_request] -async def test_canvas_request_handler_translates_canvas_error(): - err = CanvasError("bad", "fail") +async def test_canvas_adapter_translates_canvas_error_to_jsonrpc_error(): + class Handler(CanvasHandler): + async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: + raise CanvasError("bad", "fail") - async def coro(params: dict) -> Any: - raise err + session = CopilotSession("sess-1", client=None) + session._register_canvas_handler(Handler()) - wrapped = CopilotClient._canvas_request_handler(coro) + adapter = cast(Any, session._client_session_apis.canvas) with pytest.raises(JsonRpcError) as excinfo: - await wrapped({}) + await adapter.open( + CanvasProviderOpenRequest( + canvas_id="c", + extension_id="ext", + instance_id="i", + session_id="sess-1", + ) + ) assert excinfo.value.code == -32603 assert excinfo.value.message == "fail" assert excinfo.value.data == {"code": "bad", "message": "fail"} -def test_set_open_canvases_round_trip(): - from copilot.generated.rpc import CanvasInstanceAvailability +def test_register_canvas_handler_can_clear_generated_handler(): + session = CopilotSession("sess-1", client=None) + session._register_canvas_handler(None) + assert session._client_session_apis.canvas is None + +def test_set_open_canvases_round_trip(): inst = OpenCanvasInstance( availability=CanvasInstanceAvailability.READY, canvas_id="c", @@ -244,6 +209,6 @@ def test_set_open_canvases_round_trip(): instance_id="i", reopen=False, ) - session = _StubSession(handler=None) + session = CopilotSession("sess-1", client=None) session._set_open_canvases([inst]) assert session.open_canvases == [inst] diff --git a/rust/src/canvas.rs b/rust/src/canvas.rs index ba13742ff..f98292269 100644 --- a/rust/src/canvas.rs +++ b/rust/src/canvas.rs @@ -6,7 +6,6 @@ use serde_json::Value; use thiserror::Error; use crate::generated::api_types::CanvasAction; -use crate::types::SessionId; /// JSON Schema object used for canvas inputs and canvas-scoped tools. pub type CanvasJsonSchema = serde_json::Map; @@ -55,88 +54,22 @@ impl CanvasDeclaration { } /// Response returned from [`CanvasHandler::on_open`]. -#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] -#[serde(rename_all = "camelCase")] -pub struct CanvasOpenResponse { - /// URL the host should render. Optional for canvases with no visual surface. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub url: Option, - /// Provider-supplied title shown in host chrome. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub title: Option, - /// Provider-supplied status text shown in host chrome. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub status: Option, -} +pub type CanvasOpenResponse = crate::generated::api_types::CanvasProviderOpenResult; /// Host capabilities passed to canvas provider callbacks. -#[derive(Debug, Clone, Default, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct CanvasHostContext { - /// Host capability details. - #[serde(default)] - pub capabilities: CanvasHostCapabilities, -} +pub use crate::generated::api_types::CanvasHostContext; /// Host capability details passed to canvas provider callbacks. -#[derive(Debug, Clone, Default, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct CanvasHostCapabilities { - /// Whether the host supports canvas rendering. - #[serde(default)] - pub canvases: bool, -} +pub use crate::generated::api_types::CanvasHostContextCapabilities as CanvasHostCapabilities; /// Context handed to [`CanvasHandler::on_open`]. -#[derive(Debug, Clone)] -pub struct CanvasOpenContext { - /// Session that requested the canvas. - pub session_id: SessionId, - /// Owning provider identifier. - pub extension_id: String, - /// Canvas id from the declaring [`CanvasDeclaration`]. - pub canvas_id: String, - /// Stable instance id supplied by the runtime. - pub instance_id: String, - /// Validated input payload. - pub input: Value, - /// Host capabilities supplied by the runtime. - pub host: Option, -} +pub type CanvasOpenContext = crate::generated::api_types::CanvasProviderOpenRequest; /// Context handed to [`CanvasHandler::on_action`]. -#[derive(Debug, Clone)] -pub struct CanvasActionContext { - /// Session that invoked the action. - pub session_id: SessionId, - /// Owning provider identifier. - pub extension_id: String, - /// Canvas id targeted by the action. - pub canvas_id: String, - /// Instance id targeted by the action. - pub instance_id: String, - /// Action name from [`crate::generated::api_types::CanvasAction::name`]. - pub action_name: String, - /// Validated input payload. - pub input: Value, - /// Host capabilities supplied by the runtime. - pub host: Option, -} +pub type CanvasActionContext = crate::generated::api_types::CanvasProviderInvokeActionRequest; /// Context handed to a canvas's close lifecycle hook. -#[derive(Debug, Clone)] -pub struct CanvasLifecycleContext { - /// Session owning the canvas instance. - pub session_id: SessionId, - /// Owning provider identifier. - pub extension_id: String, - /// Canvas id from the declaring [`CanvasDeclaration`]. - pub canvas_id: String, - /// Instance id this lifecycle event applies to. - pub instance_id: String, - /// Host capabilities supplied by the runtime. - pub host: Option, -} +pub type CanvasLifecycleContext = crate::generated::api_types::CanvasProviderCloseRequest; /// Structured error returned from canvas handlers. #[derive(Debug, Clone, Error, Serialize, Deserialize, PartialEq, Eq)] @@ -175,7 +108,7 @@ pub type CanvasResult = Result; /// A session installs a single [`CanvasHandler`] (via /// [`SessionConfig::with_canvas_handler`](crate::types::SessionConfig::with_canvas_handler)). /// The handler receives every inbound `canvas.open` / `canvas.close` / -/// `canvas.action.invoke` JSON-RPC request the runtime issues for this +/// `canvas.invokeAction` JSON-RPC request the runtime issues for this /// session and decides — typically by inspecting [`CanvasOpenContext::canvas_id`] /// — which application-side canvas should handle the call. /// @@ -197,77 +130,12 @@ pub trait CanvasHandler: Send + Sync { } } -/// Common fields sent by direct `canvas.*` provider callbacks. -#[derive(Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub(crate) struct CanvasProviderRequestParams { - pub session_id: SessionId, - pub extension_id: String, - pub canvas_id: String, - pub instance_id: String, - #[serde(default)] - pub input: Value, - #[serde(default)] - pub host: Option, -} - -/// Wire-level params for `canvas.action.invoke`. -#[derive(Debug, Clone, Deserialize)] -#[serde(rename_all = "camelCase")] -pub(crate) struct CanvasInvokeParams { - pub session_id: SessionId, - pub extension_id: String, - pub canvas_id: String, - pub instance_id: String, - pub action_name: String, - #[serde(default)] - pub input: Value, - #[serde(default)] - pub host: Option, -} - -impl CanvasProviderRequestParams { - pub(crate) fn into_open_context(self) -> CanvasOpenContext { - CanvasOpenContext { - session_id: self.session_id, - extension_id: self.extension_id, - canvas_id: self.canvas_id, - instance_id: self.instance_id, - input: self.input, - host: self.host, - } - } - - pub(crate) fn into_lifecycle_context(self) -> CanvasLifecycleContext { - CanvasLifecycleContext { - session_id: self.session_id, - extension_id: self.extension_id, - canvas_id: self.canvas_id, - instance_id: self.instance_id, - host: self.host, - } - } -} - -impl CanvasInvokeParams { - pub(crate) fn into_action_context(self) -> CanvasActionContext { - CanvasActionContext { - session_id: self.session_id, - extension_id: self.extension_id, - canvas_id: self.canvas_id, - instance_id: self.instance_id, - action_name: self.action_name, - input: self.input, - host: self.host, - } - } -} - #[cfg(test)] mod tests { use serde_json::json; use super::*; + use crate::types::SessionId; struct EchoHandler; @@ -317,7 +185,7 @@ mod tests { extension_id: "project:echo".to_string(), canvas_id: "echo".to_string(), instance_id: "echo-1".to_string(), - input: json!({ "x": 1 }), + input: Some(json!({ "x": 1 })), host: None, }) .await @@ -338,7 +206,7 @@ mod tests { canvas_id: "echo".to_string(), instance_id: "inst-1".to_string(), action_name: "shout".to_string(), - input: json!("hi"), + input: Some(json!("hi")), host: None, }) .await @@ -369,7 +237,7 @@ mod tests { canvas_id: "x".to_string(), instance_id: "x-1".to_string(), action_name: "anything".to_string(), - input: Value::Null, + input: Some(Value::Null), host: None, }) .await diff --git a/rust/src/canvas_dispatch.rs b/rust/src/canvas_dispatch.rs new file mode 100644 index 000000000..aa991320b --- /dev/null +++ b/rust/src/canvas_dispatch.rs @@ -0,0 +1,192 @@ +//! Inbound `canvas.*` JSON-RPC request dispatch helpers. +//! +//! Internal — public-facing trait lives in `crate::canvas`. Each helper +//! deserializes the generated wire request, calls the user-facing +//! [`CanvasHandler`] method, and serializes the result back onto JSON-RPC. + +use std::sync::Arc; + +use serde::Serialize; +use serde_json::Value; +use tracing::warn; + +use crate::canvas::{CanvasError, CanvasHandler}; +use crate::generated::api_types::{ + CanvasProviderCloseRequest, CanvasProviderInvokeActionRequest, CanvasProviderOpenRequest, + rpc_methods, +}; +use crate::{Client, JsonRpcRequest, JsonRpcResponse, error_codes}; + +async fn respond(client: &Client, request_id: u64, result: T) { + let value = match serde_json::to_value(&result) { + Ok(value) => value, + Err(error) => { + warn!(error = %error, "failed to serialize canvas response"); + send_error( + client, + request_id, + error_codes::INTERNAL_ERROR, + "serialization failure", + None, + ) + .await; + return; + } + }; + + let _ = client + .send_response(&JsonRpcResponse { + jsonrpc: "2.0".to_string(), + id: request_id, + result: Some(value), + error: None, + }) + .await; +} + +async fn send_error( + client: &Client, + request_id: u64, + code: i32, + message: &str, + data: Option, +) { + let _ = client + .send_response(&JsonRpcResponse { + jsonrpc: "2.0".to_string(), + id: request_id, + result: None, + error: Some(crate::JsonRpcError { + code, + message: message.to_string(), + data, + }), + }) + .await; +} + +async fn send_canvas_error(client: &Client, request_id: u64, error: CanvasError) { + let message = error.message.clone(); + let data = Some(serde_json::json!({ + "code": error.code, + "message": message, + })); + send_error( + client, + request_id, + error_codes::INTERNAL_ERROR, + &error.message, + data, + ) + .await; +} + +async fn parse_params( + client: &Client, + request: &JsonRpcRequest, +) -> Option { + let params = request + .params + .as_ref() + .cloned() + .unwrap_or(Value::Object(serde_json::Map::new())); + match serde_json::from_value(params) { + Ok(params) => Some(params), + Err(error) => { + send_error( + client, + request.id, + error_codes::INVALID_PARAMS, + &format!("invalid params: {error}"), + None, + ) + .await; + None + } + } +} + +fn canvas_handler_or_err( + handler: Option<&Arc>, +) -> Result, CanvasError> { + handler.cloned().ok_or_else(|| { + CanvasError::new( + "canvas_handler_unset", + "No CanvasHandler installed on this session; call SessionConfig::with_canvas_handler before creating the session.", + ) + }) +} + +async fn open(client: &Client, handler: &Arc, request: JsonRpcRequest) { + let Some(params) = parse_params::(client, &request).await else { + return; + }; + + match handler.on_open(params).await { + Ok(result) => respond(client, request.id, result).await, + Err(error) => send_canvas_error(client, request.id, error).await, + } +} + +async fn close(client: &Client, handler: &Arc, request: JsonRpcRequest) { + let Some(params) = parse_params::(client, &request).await else { + return; + }; + + match handler.on_close(params).await { + Ok(()) => respond(client, request.id, Value::Null).await, + Err(error) => send_canvas_error(client, request.id, error).await, + } +} + +async fn invoke_action(client: &Client, handler: &Arc, request: JsonRpcRequest) { + let Some(params) = parse_params::(client, &request).await + else { + return; + }; + + match handler.on_action(params).await { + Ok(result) => respond(client, request.id, result).await, + Err(error) => send_canvas_error(client, request.id, error).await, + } +} + +/// Dispatch a `canvas.*` request to the appropriate handler. Returns `true` +/// if the request was a canvas method, `false` otherwise. +pub(crate) async fn dispatch( + client: &Client, + handler: Option<&Arc>, + request: JsonRpcRequest, +) -> bool { + let method = request.method.as_str(); + if !method.starts_with("canvas.") { + return false; + } + + let handler = match canvas_handler_or_err(handler) { + Ok(handler) => handler, + Err(error) => { + send_canvas_error(client, request.id, error).await; + return true; + } + }; + + match method { + rpc_methods::CANVAS_OPEN => open(client, &handler, request).await, + rpc_methods::CANVAS_CLOSE => close(client, &handler, request).await, + rpc_methods::CANVAS_INVOKEACTION => invoke_action(client, &handler, request).await, + _ => { + warn!(method = %method, "unknown canvas.* method"); + send_error( + client, + request.id, + error_codes::METHOD_NOT_FOUND, + &format!("unknown method: {method}"), + None, + ) + .await; + } + } + + true +} diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index 9f2da297e..00b135060 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -10,7 +10,8 @@ use super::session_events::{ AbortReason, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval, }; -use crate::types::{RequestId, SessionEvent, SessionId}; +use crate::types::SessionEvent; +use crate::types::{RequestId, SessionId}; /// JSON-RPC method name constants. pub mod rpc_methods { @@ -402,6 +403,12 @@ pub mod rpc_methods { pub const SESSIONFS_SQLITEQUERY: &str = "sessionFs.sqliteQuery"; /// `sessionFs.sqliteExists` pub const SESSIONFS_SQLITEEXISTS: &str = "sessionFs.sqliteExists"; + /// `canvas.open` + pub const CANVAS_OPEN: &str = "canvas.open"; + /// `canvas.close` + pub const CANVAS_CLOSE: &str = "canvas.close"; + /// `canvas.invokeAction` + pub const CANVAS_INVOKEACTION: &str = "canvas.invokeAction"; } /// Parameters for aborting the current turn @@ -917,6 +924,24 @@ pub struct CanvasCloseRequest { pub instance_id: String, } +/// Host capabilities +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasHostContextCapabilities { + /// Whether canvas rendering is supported + #[serde(skip_serializing_if = "Option::is_none")] + pub canvases: Option, +} + +/// Host context supplied by the runtime. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasHostContext { + /// Host capabilities + #[serde(skip_serializing_if = "Option::is_none")] + pub capabilities: Option, +} + /// Canvas action invocation parameters. /// ///
@@ -1074,6 +1099,80 @@ pub struct CanvasOpenRequest { pub instance_id: String, } +/// Canvas close parameters sent to the provider. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasProviderCloseRequest { + /// Target session identifier + pub session_id: SessionId, + /// Owning provider identifier + pub extension_id: String, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Canvas instance identifier + pub instance_id: String, + /// Host context supplied by the runtime. + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, +} + +/// Canvas action invocation parameters sent to the provider. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasProviderInvokeActionRequest { + /// Target session identifier + pub session_id: SessionId, + /// Owning provider identifier + pub extension_id: String, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Canvas instance identifier + pub instance_id: String, + /// Action name to invoke + pub action_name: String, + /// Action input + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Host context supplied by the runtime. + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, +} + +/// Canvas open parameters sent to the provider. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasProviderOpenRequest { + /// Target session identifier + pub session_id: SessionId, + /// Owning provider identifier + pub extension_id: String, + /// Provider-local canvas identifier + pub canvas_id: String, + /// Stable caller-supplied canvas instance identifier + pub instance_id: String, + /// Canvas open input + #[serde(skip_serializing_if = "Option::is_none")] + pub input: Option, + /// Host context supplied by the runtime. + #[serde(skip_serializing_if = "Option::is_none")] + pub host: Option, +} + +/// Canvas open result returned by the provider. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasProviderOpenResult { + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Provider-supplied title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} + /// Optional unstructured input hint /// ///
@@ -11814,6 +11913,21 @@ pub struct SessionFsSqliteExistsParams { pub session_id: SessionId, } +/// Canvas open result returned by the provider. +#[derive(Debug, Clone, Default, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct CanvasOpenResult { + /// Provider-supplied status text + #[serde(skip_serializing_if = "Option::is_none")] + pub status: Option, + /// Provider-supplied title + #[serde(skip_serializing_if = "Option::is_none")] + pub title: Option, + /// URL for web-rendered canvases + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, +} + /// MCP CreateMessageResult payload (with optional 'tools' extension), present when action='success'. Treated as opaque at the schema layer; consumers should construct/consume it per the MCP CreateMessageResult shape. /// ///
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 787697e2e..cad6ee629 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -5,6 +5,7 @@ /// Canvas declarations, provider callbacks, and host-side canvas RPC types. pub mod canvas; +mod canvas_dispatch; /// Bundled CLI binary extraction and caching. pub(crate) mod embeddedcli; /// Event handler traits for session lifecycle. diff --git a/rust/src/session.rs b/rust/src/session.rs index f216b866b..57181459c 100644 --- a/rust/src/session.rs +++ b/rust/src/session.rs @@ -4,14 +4,13 @@ use std::sync::Arc; use std::time::{Duration, Instant}; use parking_lot::Mutex as ParkingLotMutex; -use serde::de::DeserializeOwned; use serde_json::Value; use tokio::sync::oneshot; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use tracing::{Instrument, warn}; -use crate::canvas::{CanvasHandler, CanvasInvokeParams, CanvasProviderRequestParams}; +use crate::canvas::CanvasHandler; use crate::generated::api_types::{LogRequest, ModelSwitchToRequest, OpenCanvasInstance}; use crate::generated::session_events::{ CommandExecuteData, ElicitationRequestedData, ExternalToolRequestedData, SessionErrorData, @@ -1735,39 +1734,12 @@ async fn handle_request( return; } - match request.method.as_str() { - "canvas.open" => { - let Some(params) = - parse_request_params::(client, request.id, &request) - .await - else { - return; - }; - let result = dispatch_canvas_open(canvas_handler, params).await; - send_canvas_dispatch_response(client, request.id, result).await; - } - - "canvas.close" => { - let Some(params) = - parse_request_params::(client, request.id, &request) - .await - else { - return; - }; - let result = dispatch_canvas_close(canvas_handler, params).await; - send_canvas_dispatch_response(client, request.id, result).await; - } - - "canvas.action.invoke" => { - let Some(params) = - parse_request_params::(client, request.id, &request).await - else { - return; - }; - let result = dispatch_canvas_action(canvas_handler, params).await; - send_canvas_dispatch_response(client, request.id, result).await; - } + if request.method.starts_with("canvas.") { + crate::canvas_dispatch::dispatch(client, canvas_handler, request).await; + return; + } + match request.method.as_str() { "hooks.invoke" => { let params = request.params.as_ref(); let hook_type = params @@ -2000,112 +1972,6 @@ async fn handle_request( } } -async fn parse_request_params( - client: &Client, - id: u64, - request: &crate::JsonRpcRequest, -) -> Option -where - T: DeserializeOwned, -{ - let params = request - .params - .as_ref() - .cloned() - .unwrap_or(Value::Object(serde_json::Map::new())); - match serde_json::from_value(params) { - Ok(params) => Some(params), - Err(error) => { - let _ = send_error_response( - client, - id, - error_codes::INVALID_PARAMS, - &format!("invalid params: {error}"), - ) - .await; - None - } - } -} - -async fn send_canvas_dispatch_response( - client: &Client, - id: u64, - result: crate::canvas::CanvasResult, -) { - let response = match result { - Ok(value) => JsonRpcResponse { - jsonrpc: "2.0".to_string(), - id, - result: Some(value), - error: None, - }, - Err(error) => JsonRpcResponse { - jsonrpc: "2.0".to_string(), - id, - result: None, - error: Some(crate::JsonRpcError { - code: error_codes::INTERNAL_ERROR, - message: error.message.clone(), - data: Some(serde_json::json!({ - "code": error.code, - "message": error.message, - })), - }), - }, - }; - if let Err(error) = client.send_response(&response).await { - warn!( - request_id = id, - error = %error, - "failed to send canvas provider response" - ); - } -} - -fn canvas_handler_or_err( - handler: Option<&Arc>, -) -> crate::canvas::CanvasResult<&Arc> { - handler.ok_or_else(|| { - crate::canvas::CanvasError::new( - "canvas_handler_unset", - "No CanvasHandler installed on this session; \ - call SessionConfig::with_canvas_handler before creating the session.", - ) - }) -} - -async fn dispatch_canvas_open( - handler: Option<&Arc>, - params: CanvasProviderRequestParams, -) -> crate::canvas::CanvasResult { - let handler = canvas_handler_or_err(handler)?; - let response = handler.on_open(params.into_open_context()).await?; - serde_json::to_value(response).map_err(|error| { - crate::canvas::CanvasError::new( - "canvas_open_response_serialization_failed", - format!("failed to serialize canvas.open response: {error}"), - ) - }) -} - -async fn dispatch_canvas_close( - handler: Option<&Arc>, - params: CanvasProviderRequestParams, -) -> crate::canvas::CanvasResult { - let handler = canvas_handler_or_err(handler)?; - handler.on_close(params.into_lifecycle_context()).await?; - Ok(Value::Null) -} - -async fn dispatch_canvas_action( - handler: Option<&Arc>, - params: CanvasInvokeParams, -) -> crate::canvas::CanvasResult { - let handler = canvas_handler_or_err(handler)?; - handler.on_action(params.into_action_context()).await -} - async fn send_error_response( client: &Client, id: u64, diff --git a/rust/src/types.rs b/rust/src/types.rs index d841096c5..f454e33ed 100644 --- a/rust/src/types.rs +++ b/rust/src/types.rs @@ -1113,7 +1113,7 @@ pub struct SessionConfig { /// Canvas declarations this connection provides to the runtime. pub canvases: Option>, /// Provider-side canvas lifecycle handler. The SDK routes inbound - /// `canvas.open` / `canvas.close` / `canvas.action.invoke` requests to + /// `canvas.open` / `canvas.close` / `canvas.invokeAction` requests to /// this handler. Use [`with_canvas_handler`](Self::with_canvas_handler) /// to install one. pub canvas_handler: Option>, diff --git a/rust/tests/e2e.rs b/rust/tests/e2e.rs index 09ece6cf5..12863aff4 100644 --- a/rust/tests/e2e.rs +++ b/rust/tests/e2e.rs @@ -7,6 +7,8 @@ mod abort; mod ask_user; #[path = "e2e/builtin_tools.rs"] mod builtin_tools; +#[path = "e2e/canvas.rs"] +mod canvas; #[path = "e2e/client.rs"] mod client; #[path = "e2e/client_api.rs"] diff --git a/rust/tests/e2e/canvas.rs b/rust/tests/e2e/canvas.rs new file mode 100644 index 000000000..24cac0dea --- /dev/null +++ b/rust/tests/e2e/canvas.rs @@ -0,0 +1,48 @@ +use std::sync::Arc; + +use async_trait::async_trait; +use github_copilot_sdk::canvas::{ + CanvasDeclaration, CanvasHandler, CanvasOpenContext, CanvasOpenResponse, CanvasResult, +}; + +use super::support::with_e2e_context; + +struct TestCanvasHandler; + +#[async_trait] +impl CanvasHandler for TestCanvasHandler { + async fn on_open(&self, _ctx: CanvasOpenContext) -> CanvasResult { + Ok(CanvasOpenResponse::default()) + } +} + +#[tokio::test] +async fn canvas_list_discovers_declared_canvases() { + with_e2e_context("canvas", "canvas_list_discovers_declared_canvases", |ctx| { + Box::pin(async move { + ctx.set_default_copilot_user(); + let client = ctx.start_client().await; + let session = client + .create_session( + ctx.approve_all_session_config() + .with_canvases([CanvasDeclaration::new( + "counter", + "Counter", + "Count things", + )]) + .with_canvas_handler(Arc::new(TestCanvasHandler)), + ) + .await + .expect("create session"); + + let result = session.rpc().canvas().list().await.expect("list canvases"); + + assert_eq!(result.canvases.len(), 1); + assert_eq!(result.canvases[0].canvas_id, "counter"); + + session.disconnect().await.expect("disconnect session"); + client.stop().await.expect("stop client"); + }) + }) + .await; +} diff --git a/rust/tests/session_test.rs b/rust/tests/session_test.rs index 050c5898d..7f848018d 100644 --- a/rust/tests/session_test.rs +++ b/rust/tests/session_test.rs @@ -380,7 +380,7 @@ async fn provider_canvas_dispatch_routes_direct_canvas_action_requests() { server .send_request( 42, - "canvas.action.invoke", + "canvas.invokeAction", serde_json::json!({ "sessionId": session.id(), "extensionId": "project:counter", diff --git a/test/snapshots/canvas/canvas_list_discovers_declared_canvases.yaml b/test/snapshots/canvas/canvas_list_discovers_declared_canvases.yaml new file mode 100644 index 000000000..056351ddb --- /dev/null +++ b/test/snapshots/canvas/canvas_list_discovers_declared_canvases.yaml @@ -0,0 +1,3 @@ +models: + - claude-sonnet-4.5 +conversations: [] From 6049ff12337a62df1e63fbcaa5574689925d7ea5 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 13:16:47 +0100 Subject: [PATCH 3/9] Codegen: regenerate with experimental markers on client session APIs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/src/Generated/Rpc.cs | 17 + go/rpc/zrpc.go | 69 +- python/copilot/generated/rpc.py | 9716 +++++++------------------------ rust/src/generated/api_types.rs | 217 + 4 files changed, 2441 insertions(+), 7578 deletions(-) diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 9c001f737..3c86973d3 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -7449,6 +7449,7 @@ internal sealed class ScheduleStopRequest } /// Describes a filesystem error. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsError { /// Error classification. @@ -7461,6 +7462,7 @@ public sealed class SessionFsError } /// File content as a UTF-8 string, or a filesystem error if the read failed. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsReadFileResult { /// File content as UTF-8 string. @@ -7525,6 +7527,7 @@ public sealed class SessionFsAppendFileRequest } /// Indicates whether the requested path exists in the client-provided session filesystem. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsExistsResult { /// Whether the path exists. @@ -7545,6 +7548,7 @@ public sealed class SessionFsExistsRequest } /// Filesystem metadata for the requested path, or a filesystem error if the stat failed. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsStatResult { /// ISO 8601 timestamp of creation. @@ -7605,6 +7609,7 @@ public sealed class SessionFsMkdirRequest } /// Names of entries in the requested directory, or a filesystem error if the read failed. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsReaddirResult { /// Entry names in the directory. @@ -7629,6 +7634,7 @@ public sealed class SessionFsReaddirRequest } /// Schema for the `SessionFsReaddirWithTypesEntry` type. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsReaddirWithTypesEntry { /// Entry name. @@ -7641,6 +7647,7 @@ public sealed class SessionFsReaddirWithTypesEntry } /// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsReaddirWithTypesResult { /// Directory entries with type information. @@ -7701,6 +7708,7 @@ public sealed class SessionFsRenameRequest } /// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsSqliteQueryResult { /// Column names from the result set. @@ -7745,6 +7753,7 @@ public sealed class SessionFsSqliteQueryRequest } /// Indicates whether the per-session SQLite database already exists. +[Experimental(Diagnostics.Experimental)] public sealed class SessionFsSqliteExistsResult { /// Whether the session database already exists. @@ -7761,6 +7770,7 @@ public sealed class SessionFsSqliteExistsRequest } /// Canvas open result returned by the provider. +[Experimental(Diagnostics.Experimental)] public sealed class CanvasProviderOpenResult { /// Provider-supplied status text. @@ -7777,6 +7787,7 @@ public sealed class CanvasProviderOpenResult } /// Host capabilities. +[Experimental(Diagnostics.Experimental)] public sealed class CanvasHostContextCapabilities { /// Whether canvas rendering is supported. @@ -7785,6 +7796,7 @@ public sealed class CanvasHostContextCapabilities } /// Host context supplied by the runtime. +[Experimental(Diagnostics.Experimental)] public sealed class CanvasHostContext { /// Host capabilities. @@ -11358,6 +11370,7 @@ public override void Write(Utf8JsonWriter writer, RemoteSessionMode value, JsonS /// Error classification. +[Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsErrorCode : IEquatable @@ -11420,6 +11433,7 @@ public override void Write(Utf8JsonWriter writer, SessionFsErrorCode value, Json /// Entry type. +[Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsReaddirWithTypesEntryType : IEquatable @@ -11482,6 +11496,7 @@ public override void Write(Utf8JsonWriter writer, SessionFsReaddirWithTypesEntry /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected). +[Experimental(Diagnostics.Experimental)] [JsonConverter(typeof(Converter))] [DebuggerDisplay("{Value,nq}")] public readonly struct SessionFsSqliteQueryType : IEquatable @@ -14593,6 +14608,7 @@ public async Task StopAsync(long id, CancellationToken cance } /// Handles `sessionFs` client session API methods. +[Experimental(Diagnostics.Experimental)] public interface ISessionFsHandler { /// Reads a file from the client-provided session filesystem. @@ -14658,6 +14674,7 @@ public interface ISessionFsHandler } /// Handles `canvas` client session API methods. +[Experimental(Diagnostics.Experimental)] public interface ICanvasHandler { /// Opens a canvas instance on the provider. diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index d11a77937..e8ca1d7bc 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -305,16 +305,22 @@ type CanvasCloseRequest struct { InstanceID string `json:"instanceId"` } +// Experimental: CanvasCloseResult is part of an experimental API and may change or be +// removed. type CanvasCloseResult struct { } // Host context supplied by the runtime. +// Experimental: CanvasHostContext is part of an experimental API and may change or be +// removed. type CanvasHostContext struct { // Host capabilities Capabilities *CanvasHostContextCapabilities `json:"capabilities,omitempty"` } // Host capabilities +// Experimental: CanvasHostContextCapabilities is part of an experimental API and may change +// or be removed. type CanvasHostContextCapabilities struct { // Whether canvas rendering is supported Canvases *bool `json:"canvases,omitempty"` @@ -376,6 +382,8 @@ type CanvasOpenRequest struct { } // Canvas close parameters sent to the provider. +// Experimental: CanvasProviderCloseRequest is part of an experimental API and may change or +// be removed. type CanvasProviderCloseRequest struct { // Provider-local canvas identifier CanvasID string `json:"canvasId"` @@ -390,6 +398,8 @@ type CanvasProviderCloseRequest struct { } // Canvas action invocation parameters sent to the provider. +// Experimental: CanvasProviderInvokeActionRequest is part of an experimental API and may +// change or be removed. type CanvasProviderInvokeActionRequest struct { // Action name to invoke ActionName string `json:"actionName"` @@ -408,6 +418,8 @@ type CanvasProviderInvokeActionRequest struct { } // Canvas open parameters sent to the provider. +// Experimental: CanvasProviderOpenRequest is part of an experimental API and may change or +// be removed. type CanvasProviderOpenRequest struct { // Provider-local canvas identifier CanvasID string `json:"canvasId"` @@ -424,6 +436,8 @@ type CanvasProviderOpenRequest struct { } // Canvas open result returned by the provider. +// Experimental: CanvasProviderOpenResult is part of an experimental API and may change or +// be removed. type CanvasProviderOpenResult struct { // Provider-supplied status text Status *string `json:"status,omitempty"` @@ -3931,6 +3945,8 @@ type SessionExtensionsReloadResult struct { // File path, content to append, and optional mode for the client-provided session // filesystem. +// Experimental: SessionFsAppendFileRequest is part of an experimental API and may change or +// be removed. type SessionFsAppendFileRequest struct { // Content to append Content string `json:"content"` @@ -3943,6 +3959,7 @@ type SessionFsAppendFileRequest struct { } // Describes a filesystem error. +// Experimental: SessionFsError is part of an experimental API and may change or be removed. type SessionFsError struct { // Error classification Code SessionFsErrorCode `json:"code"` @@ -3951,6 +3968,8 @@ type SessionFsError struct { } // Path to test for existence in the client-provided session filesystem. +// Experimental: SessionFsExistsRequest is part of an experimental API and may change or be +// removed. type SessionFsExistsRequest struct { // Path using SessionFs conventions Path string `json:"path"` @@ -3959,6 +3978,8 @@ type SessionFsExistsRequest struct { } // Indicates whether the requested path exists in the client-provided session filesystem. +// Experimental: SessionFsExistsResult is part of an experimental API and may change or be +// removed. type SessionFsExistsResult struct { // Whether the path exists Exists bool `json:"exists"` @@ -3966,6 +3987,8 @@ type SessionFsExistsResult struct { // Directory path to create in the client-provided session filesystem, with options for // recursive creation and POSIX mode. +// Experimental: SessionFsMkdirRequest is part of an experimental API and may change or be +// removed. type SessionFsMkdirRequest struct { // Optional POSIX-style mode for newly created directories Mode *int64 `json:"mode,omitempty"` @@ -3978,6 +4001,8 @@ type SessionFsMkdirRequest struct { } // Directory path whose entries should be listed from the client-provided session filesystem. +// Experimental: SessionFsReaddirRequest is part of an experimental API and may change or be +// removed. type SessionFsReaddirRequest struct { // Path using SessionFs conventions Path string `json:"path"` @@ -3986,6 +4011,8 @@ type SessionFsReaddirRequest struct { } // Names of entries in the requested directory, or a filesystem error if the read failed. +// Experimental: SessionFsReaddirResult is part of an experimental API and may change or be +// removed. type SessionFsReaddirResult struct { // Entry names in the directory Entries []string `json:"entries"` @@ -3994,6 +4021,8 @@ type SessionFsReaddirResult struct { } // Schema for the `SessionFsReaddirWithTypesEntry` type. +// Experimental: SessionFsReaddirWithTypesEntry is part of an experimental API and may +// change or be removed. type SessionFsReaddirWithTypesEntry struct { // Entry name Name string `json:"name"` @@ -4003,6 +4032,8 @@ type SessionFsReaddirWithTypesEntry struct { // Directory path whose entries (with type information) should be listed from the // client-provided session filesystem. +// Experimental: SessionFsReaddirWithTypesRequest is part of an experimental API and may +// change or be removed. type SessionFsReaddirWithTypesRequest struct { // Path using SessionFs conventions Path string `json:"path"` @@ -4012,6 +4043,8 @@ type SessionFsReaddirWithTypesRequest struct { // Entries in the requested directory paired with file/directory type information, or a // filesystem error if the read failed. +// Experimental: SessionFsReaddirWithTypesResult is part of an experimental API and may +// change or be removed. type SessionFsReaddirWithTypesResult struct { // Directory entries with type information Entries []SessionFsReaddirWithTypesEntry `json:"entries"` @@ -4020,6 +4053,8 @@ type SessionFsReaddirWithTypesResult struct { } // Path of the file to read from the client-provided session filesystem. +// Experimental: SessionFsReadFileRequest is part of an experimental API and may change or +// be removed. type SessionFsReadFileRequest struct { // Path using SessionFs conventions Path string `json:"path"` @@ -4028,6 +4063,8 @@ type SessionFsReadFileRequest struct { } // File content as a UTF-8 string, or a filesystem error if the read failed. +// Experimental: SessionFsReadFileResult is part of an experimental API and may change or be +// removed. type SessionFsReadFileResult struct { // File content as UTF-8 string Content string `json:"content"` @@ -4037,6 +4074,8 @@ type SessionFsReadFileResult struct { // Source and destination paths for renaming or moving an entry in the client-provided // session filesystem. +// Experimental: SessionFsRenameRequest is part of an experimental API and may change or be +// removed. type SessionFsRenameRequest struct { // Destination path using SessionFs conventions Dest string `json:"dest"` @@ -4048,6 +4087,8 @@ type SessionFsRenameRequest struct { // Path to remove from the client-provided session filesystem, with options for recursive // removal and force. +// Experimental: SessionFsRmRequest is part of an experimental API and may change or be +// removed. type SessionFsRmRequest struct { // Ignore errors if the path does not exist Force *bool `json:"force,omitempty"` @@ -4085,12 +4126,16 @@ type SessionFsSetProviderResult struct { } // Identifies the target session. +// Experimental: SessionFsSqliteExistsRequest is part of an experimental API and may change +// or be removed. type SessionFsSqliteExistsRequest struct { // Target session identifier SessionID string `json:"sessionId"` } // Indicates whether the per-session SQLite database already exists. +// Experimental: SessionFsSqliteExistsResult is part of an experimental API and may change +// or be removed. type SessionFsSqliteExistsResult struct { // Whether the session database already exists Exists bool `json:"exists"` @@ -4098,6 +4143,8 @@ type SessionFsSqliteExistsResult struct { // SQL query, query type, and optional bind parameters for executing a SQLite query against // the per-session database. +// Experimental: SessionFsSqliteQueryRequest is part of an experimental API and may change +// or be removed. type SessionFsSqliteQueryRequest struct { // Optional named bind parameters Params map[string]any `json:"params,omitempty"` @@ -4112,6 +4159,8 @@ type SessionFsSqliteQueryRequest struct { // Query results including rows, columns, and rows affected, or a filesystem error if // execution failed. +// Experimental: SessionFsSqliteQueryResult is part of an experimental API and may change or +// be removed. type SessionFsSqliteQueryResult struct { // Column names from the result set Columns []string `json:"columns"` @@ -4126,6 +4175,8 @@ type SessionFsSqliteQueryResult struct { } // Path whose metadata should be returned from the client-provided session filesystem. +// Experimental: SessionFsStatRequest is part of an experimental API and may change or be +// removed. type SessionFsStatRequest struct { // Path using SessionFs conventions Path string `json:"path"` @@ -4134,6 +4185,8 @@ type SessionFsStatRequest struct { } // Filesystem metadata for the requested path, or a filesystem error if the stat failed. +// Experimental: SessionFsStatResult is part of an experimental API and may change or be +// removed. type SessionFsStatResult struct { // ISO 8601 timestamp of creation Birthtime time.Time `json:"birthtime"` @@ -4150,6 +4203,8 @@ type SessionFsStatResult struct { } // File path, content to write, and optional mode for the client-provided session filesystem. +// Experimental: SessionFsWriteFileRequest is part of an experimental API and may change or +// be removed. type SessionFsWriteFileRequest struct { // Content to write Content string `json:"content"` @@ -7065,6 +7120,8 @@ const ( ) // Error classification +// Experimental: SessionFsErrorCode is part of an experimental API and may change or be +// removed. type SessionFsErrorCode string const ( @@ -7075,6 +7132,8 @@ const ( ) // Entry type +// Experimental: SessionFsReaddirWithTypesEntryType is part of an experimental API and may +// change or be removed. type SessionFsReaddirWithTypesEntryType string const ( @@ -7096,6 +7155,8 @@ const ( // How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT // (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) +// Experimental: SessionFsSqliteQueryType is part of an experimental API and may change or +// be removed. type SessionFsSqliteQueryType string const ( @@ -11822,6 +11883,7 @@ func NewSessionRpc(client *jsonrpc2.Client, sessionID string) *SessionRpc { return r } +// Experimental: CanvasHandler contains experimental APIs that may change or be removed. type CanvasHandler interface { // Closes a canvas instance on the provider. // @@ -11847,6 +11909,7 @@ type CanvasHandler interface { Open(request *CanvasProviderOpenRequest) (*CanvasProviderOpenResult, error) } +// Experimental: SessionFsHandler contains experimental APIs that may change or be removed. type SessionFsHandler interface { // AppendFile appends content to a file in the client-provided session filesystem. // @@ -12014,11 +12077,7 @@ func RegisterClientSessionApiHandlers(client *jsonrpc2.Client, getHandlers func( if err != nil { return nil, clientSessionHandlerError(err) } - var payload any - if result != nil { - payload = result.Result - } - raw, err := json.Marshal(payload) + raw, err := json.Marshal(result) if err != nil { return nil, &jsonrpc2.Error{Code: -32603, Message: fmt.Sprintf("Failed to marshal response: %v", err)} } diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index fd82b97aa..2959d81b9 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -2,26 +2,11 @@ AUTO-GENERATED FILE - DO NOT EDIT Generated from: api.schema.json """ - from __future__ import annotations from typing import ClassVar, TYPE_CHECKING -from .session_events import ( - AbortReason, - EmbeddedBlobResourceContents, - EmbeddedTextResourceContents, - McpServerSource, - McpServerStatus, - PermissionPromptRequest, - PermissionRule, - ReasoningSummary, - SessionEvent, - SessionMode, - ShutdownType, - SkillSource, - UserToolSessionApproval, -) +from .session_events import AbortReason, EmbeddedBlobResourceContents, EmbeddedTextResourceContents, McpServerSource, McpServerStatus, PermissionPromptRequest, PermissionRule, ReasoningSummary, SessionEvent, SessionMode, ShutdownType, SkillSource, UserToolSessionApproval if TYPE_CHECKING: from .._jsonrpc import JsonRpcClient @@ -43,12 +28,10 @@ def from_str(x: Any) -> str: assert isinstance(x, str) return x - def from_none(x: Any) -> Any: assert x is None return x - def from_union(fs, x): for f in fs: try: @@ -57,51 +40,41 @@ def from_union(fs, x): pass assert False - def to_class(c: type[T], x: Any) -> dict: assert isinstance(x, c) return cast(Any, x).to_dict() - def from_bool(x: Any) -> bool: assert isinstance(x, bool) return x - def from_int(x: Any) -> int: assert isinstance(x, int) and not isinstance(x, bool) return x - def from_float(x: Any) -> float: assert isinstance(x, (float, int)) and not isinstance(x, bool) return float(x) - def to_float(x: Any) -> float: assert isinstance(x, (int, float)) return x - def from_dict(f: Callable[[Any], T], x: Any) -> dict[str, T]: assert isinstance(x, dict) - return {k: f(v) for (k, v) in x.items()} - + return { k: f(v) for (k, v) in x.items() } def from_list(f: Callable[[Any], T], x: Any) -> list[T]: assert isinstance(x, list) return [f(y) for y in x] - def to_enum(c: type[EnumT], x: Any) -> EnumT: assert isinstance(x, c) return x.value - def from_datetime(x: Any) -> datetime: return dateutil.parser.parse(x) - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AbortRequest: @@ -111,7 +84,7 @@ class AbortRequest: """Finite reason code describing why the current turn was aborted""" @staticmethod - def from_dict(obj: Any) -> "AbortRequest": + def from_dict(obj: Any) -> 'AbortRequest': assert isinstance(obj, dict) reason = from_union([AbortReason, from_none], obj.get("reason")) return AbortRequest(reason) @@ -119,12 +92,9 @@ def from_dict(obj: Any) -> "AbortRequest": def to_dict(self) -> dict: result: dict = {} if self.reason is not None: - result["reason"] = from_union( - [lambda x: to_enum(AbortReason, x), from_none], self.reason - ) + result["reason"] = from_union([lambda x: to_enum(AbortReason, x), from_none], self.reason) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AbortResult: @@ -137,7 +107,7 @@ class AbortResult: """Error message if the abort failed""" @staticmethod - def from_dict(obj: Any) -> "AbortResult": + def from_dict(obj: Any) -> 'AbortResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) error = from_union([from_str, from_none], obj.get("error")) @@ -150,7 +120,6 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result - @dataclass class AccountGetQuotaRequest: git_hub_token: str | None = None @@ -159,7 +128,7 @@ class AccountGetQuotaRequest: """ @staticmethod - def from_dict(obj: Any) -> "AccountGetQuotaRequest": + def from_dict(obj: Any) -> 'AccountGetQuotaRequest': assert isinstance(obj, dict) git_hub_token = from_union([from_str, from_none], obj.get("gitHubToken")) return AccountGetQuotaRequest(git_hub_token) @@ -170,7 +139,6 @@ def to_dict(self) -> dict: result["gitHubToken"] = from_union([from_str, from_none], self.git_hub_token) return result - @dataclass class AccountQuotaSnapshot: """Schema for the `AccountQuotaSnapshot` type.""" @@ -200,47 +168,31 @@ class AccountQuotaSnapshot: """Date when the quota resets (ISO 8601 string)""" @staticmethod - def from_dict(obj: Any) -> "AccountQuotaSnapshot": + def from_dict(obj: Any) -> 'AccountQuotaSnapshot': assert isinstance(obj, dict) entitlement_requests = from_int(obj.get("entitlementRequests")) is_unlimited_entitlement = from_bool(obj.get("isUnlimitedEntitlement")) overage = from_float(obj.get("overage")) - overage_allowed_with_exhausted_quota = from_bool( - obj.get("overageAllowedWithExhaustedQuota") - ) + overage_allowed_with_exhausted_quota = from_bool(obj.get("overageAllowedWithExhaustedQuota")) remaining_percentage = from_float(obj.get("remainingPercentage")) usage_allowed_with_exhausted_quota = from_bool(obj.get("usageAllowedWithExhaustedQuota")) used_requests = from_int(obj.get("usedRequests")) reset_date = from_union([from_str, from_none], obj.get("resetDate")) - return AccountQuotaSnapshot( - entitlement_requests, - is_unlimited_entitlement, - overage, - overage_allowed_with_exhausted_quota, - remaining_percentage, - usage_allowed_with_exhausted_quota, - used_requests, - reset_date, - ) + return AccountQuotaSnapshot(entitlement_requests, is_unlimited_entitlement, overage, overage_allowed_with_exhausted_quota, remaining_percentage, usage_allowed_with_exhausted_quota, used_requests, reset_date) def to_dict(self) -> dict: result: dict = {} result["entitlementRequests"] = from_int(self.entitlement_requests) result["isUnlimitedEntitlement"] = from_bool(self.is_unlimited_entitlement) result["overage"] = to_float(self.overage) - result["overageAllowedWithExhaustedQuota"] = from_bool( - self.overage_allowed_with_exhausted_quota - ) + result["overageAllowedWithExhaustedQuota"] = from_bool(self.overage_allowed_with_exhausted_quota) result["remainingPercentage"] = to_float(self.remaining_percentage) - result["usageAllowedWithExhaustedQuota"] = from_bool( - self.usage_allowed_with_exhausted_quota - ) + result["usageAllowedWithExhaustedQuota"] = from_bool(self.usage_allowed_with_exhausted_quota) result["usedRequests"] = from_int(self.used_requests) if self.reset_date is not None: result["resetDate"] = from_union([from_str, from_none], self.reset_date) return result - # Experimental: this type is part of an experimental API and may change or be removed. class AgentInfoSource(Enum): """Where the agent definition was loaded from""" @@ -252,7 +204,6 @@ class AgentInfoSource(Enum): REMOTE = "remote" USER = "user" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentSelectRequest: @@ -262,7 +213,7 @@ class AgentSelectRequest: """Name of the custom agent to select""" @staticmethod - def from_dict(obj: Any) -> "AgentSelectRequest": + def from_dict(obj: Any) -> 'AgentSelectRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return AgentSelectRequest(name) @@ -272,7 +223,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseEndpoints: @@ -284,7 +234,7 @@ class CopilotUserResponseEndpoints: telemetry: str | None = None @staticmethod - def from_dict(obj: Any) -> "CopilotUserResponseEndpoints": + def from_dict(obj: Any) -> 'CopilotUserResponseEndpoints': assert isinstance(obj, dict) api = from_union([from_str, from_none], obj.get("api")) origin_tracker = from_union([from_str, from_none], obj.get("origin-tracker")) @@ -304,11 +254,9 @@ def to_dict(self) -> dict: result["telemetry"] = from_union([from_str, from_none], self.telemetry) return result - class APIKeyAuthInfoType(Enum): API_KEY = "api-key" - # Experimental: this type is part of an experimental API and may change or be removed. class AuthInfoType(Enum): """Authentication type""" @@ -321,14 +269,12 @@ class AuthInfoType(Enum): TOKEN = "token" USER = "user" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasAction: """Canvas action that the agent or host can invoke. To discover the input schema for a particular action, call the list_canvas_capabilities tool. """ - name: str """Action name exposed by the canvas provider""" @@ -339,7 +285,7 @@ class CanvasAction: """JSON Schema for the action input""" @staticmethod - def from_dict(obj: Any) -> "CanvasAction": + def from_dict(obj: Any) -> 'CanvasAction': assert isinstance(obj, dict) name = from_str(obj.get("name")) description = from_union([from_str, from_none], obj.get("description")) @@ -355,7 +301,6 @@ def to_dict(self) -> dict: result["inputSchema"] = self.input_schema return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasCloseRequest: @@ -365,7 +310,7 @@ class CanvasCloseRequest: """Open canvas instance identifier""" @staticmethod - def from_dict(obj: Any) -> "CanvasCloseRequest": + def from_dict(obj: Any) -> 'CanvasCloseRequest': assert isinstance(obj, dict) instance_id = from_str(obj.get("instanceId")) return CanvasCloseRequest(instance_id) @@ -375,7 +320,6 @@ def to_dict(self) -> dict: result["instanceId"] = from_str(self.instance_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. class CanvasInstanceAvailability(Enum): """Runtime-controlled routing state for an open canvas instance.""" @@ -383,7 +327,6 @@ class CanvasInstanceAvailability(Enum): READY = "ready" STALE = "stale" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasInvokeActionRequest: @@ -399,7 +342,7 @@ class CanvasInvokeActionRequest: """Action input""" @staticmethod - def from_dict(obj: Any) -> "CanvasInvokeActionRequest": + def from_dict(obj: Any) -> 'CanvasInvokeActionRequest': assert isinstance(obj, dict) action_name = from_str(obj.get("actionName")) instance_id = from_str(obj.get("instanceId")) @@ -414,7 +357,6 @@ def to_dict(self) -> dict: result["input"] = self.input return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasOpenRequest: @@ -434,7 +376,7 @@ class CanvasOpenRequest: """Canvas open input""" @staticmethod - def from_dict(obj: Any) -> "CanvasOpenRequest": + def from_dict(obj: Any) -> 'CanvasOpenRequest': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) instance_id = from_str(obj.get("instanceId")) @@ -452,7 +394,7 @@ def to_dict(self) -> dict: result["input"] = self.input return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderOpenResult: """Canvas open result returned by the provider.""" @@ -467,7 +409,7 @@ class CanvasProviderOpenResult: """URL for web-rendered canvases""" @staticmethod - def from_dict(obj: Any) -> "CanvasProviderOpenResult": + def from_dict(obj: Any) -> 'CanvasProviderOpenResult': assert isinstance(obj, dict) status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) @@ -484,25 +426,21 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandInputCompletion(Enum): """Optional completion hint for the input (e.g. 'directory' for filesystem path completion)""" DIRECTORY = "directory" - # Experimental: this type is part of an experimental API and may change or be removed. class SlashCommandKind(Enum): """Coarse command category for grouping and behavior: runtime built-in, skill-backed command, or SDK/client-owned command """ - BUILTIN = "builtin" CLIENT = "client" SKILL = "skill" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsHandlePendingCommandRequest: @@ -515,7 +453,7 @@ class CommandsHandlePendingCommandRequest: """Error message if the command handler failed""" @staticmethod - def from_dict(obj: Any) -> "CommandsHandlePendingCommandRequest": + def from_dict(obj: Any) -> 'CommandsHandlePendingCommandRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error = from_union([from_str, from_none], obj.get("error")) @@ -528,7 +466,6 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsHandlePendingCommandResult: @@ -538,7 +475,7 @@ class CommandsHandlePendingCommandResult: """Whether the command was handled successfully""" @staticmethod - def from_dict(obj: Any) -> "CommandsHandlePendingCommandResult": + def from_dict(obj: Any) -> 'CommandsHandlePendingCommandResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return CommandsHandlePendingCommandResult(success) @@ -548,7 +485,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsInvokeRequest: @@ -561,7 +497,7 @@ class CommandsInvokeRequest: """Raw input after the command name""" @staticmethod - def from_dict(obj: Any) -> "CommandsInvokeRequest": + def from_dict(obj: Any) -> 'CommandsInvokeRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) input = from_union([from_str, from_none], obj.get("input")) @@ -574,7 +510,6 @@ def to_dict(self) -> dict: result["input"] = from_union([from_str, from_none], self.input) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsListRequest: @@ -590,12 +525,10 @@ class CommandsListRequest: """Include enabled user-invocable skills and commands""" @staticmethod - def from_dict(obj: Any) -> "CommandsListRequest": + def from_dict(obj: Any) -> 'CommandsListRequest': assert isinstance(obj, dict) include_builtins = from_union([from_bool, from_none], obj.get("includeBuiltins")) - include_client_commands = from_union( - [from_bool, from_none], obj.get("includeClientCommands") - ) + include_client_commands = from_union([from_bool, from_none], obj.get("includeClientCommands")) include_skills = from_union([from_bool, from_none], obj.get("includeSkills")) return CommandsListRequest(include_builtins, include_client_commands, include_skills) @@ -604,21 +537,17 @@ def to_dict(self) -> dict: if self.include_builtins is not None: result["includeBuiltins"] = from_union([from_bool, from_none], self.include_builtins) if self.include_client_commands is not None: - result["includeClientCommands"] = from_union( - [from_bool, from_none], self.include_client_commands - ) + result["includeClientCommands"] = from_union([from_bool, from_none], self.include_client_commands) if self.include_skills is not None: result["includeSkills"] = from_union([from_bool, from_none], self.include_skills) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsRespondToQueuedCommandRequest: """Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands). """ - request_id: str """Request ID from the `command.queued` event the host is responding to.""" @@ -626,7 +555,7 @@ class CommandsRespondToQueuedCommandRequest: """Result of the queued command execution.""" @staticmethod - def from_dict(obj: Any) -> "CommandsRespondToQueuedCommandRequest": + def from_dict(obj: Any) -> 'CommandsRespondToQueuedCommandRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = _load_QueuedCommandResult(obj.get("result")) @@ -638,7 +567,6 @@ def to_dict(self) -> dict: result["result"] = (self.result).to_dict() return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandsRespondToQueuedCommandResult: @@ -650,7 +578,7 @@ class CommandsRespondToQueuedCommandResult: """ @staticmethod - def from_dict(obj: Any) -> "CommandsRespondToQueuedCommandResult": + def from_dict(obj: Any) -> 'CommandsRespondToQueuedCommandResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return CommandsRespondToQueuedCommandResult(success) @@ -660,7 +588,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectRemoteSessionParams: @@ -670,7 +597,7 @@ class ConnectRemoteSessionParams: """Session ID to connect to.""" @staticmethod - def from_dict(obj: Any) -> "ConnectRemoteSessionParams": + def from_dict(obj: Any) -> 'ConnectRemoteSessionParams': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return ConnectRemoteSessionParams(session_id) @@ -680,7 +607,6 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConnectRequest: @@ -690,7 +616,7 @@ class _ConnectRequest: """Connection token; required when the server was started with COPILOT_CONNECTION_TOKEN""" @staticmethod - def from_dict(obj: Any) -> "_ConnectRequest": + def from_dict(obj: Any) -> '_ConnectRequest': assert isinstance(obj, dict) token = from_union([from_str, from_none], obj.get("token")) return _ConnectRequest(token) @@ -701,7 +627,6 @@ def to_dict(self) -> dict: result["token"] = from_union([from_str, from_none], self.token) return result - # Internal: this type is an internal SDK API and is not part of the public surface. @dataclass class _ConnectResult: @@ -717,7 +642,7 @@ class _ConnectResult: """Server package version""" @staticmethod - def from_dict(obj: Any) -> "_ConnectResult": + def from_dict(obj: Any) -> '_ConnectResult': assert isinstance(obj, dict) ok = from_bool(obj.get("ok")) protocol_version = from_int(obj.get("protocolVersion")) @@ -731,7 +656,6 @@ def to_dict(self) -> dict: result["version"] = from_str(self.version) return result - # Experimental: this type is part of an experimental API and may change or be removed. class ConnectedRemoteSessionMetadataKind(Enum): """Neutral SDK discriminator for the connected remote session kind.""" @@ -739,7 +663,6 @@ class ConnectedRemoteSessionMetadataKind(Enum): CODING_AGENT = "coding-agent" REMOTE_SESSION = "remote-session" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectedRemoteSessionMetadataRepository: @@ -755,7 +678,7 @@ class ConnectedRemoteSessionMetadataRepository: """Repository owner or organization login.""" @staticmethod - def from_dict(obj: Any) -> "ConnectedRemoteSessionMetadataRepository": + def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadataRepository': assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) @@ -769,26 +692,21 @@ def to_dict(self) -> dict: result["owner"] = from_str(self.owner) return result - class ContentFilterMode(Enum): """Controls how MCP tool result content is filtered: none leaves content unchanged, markdown sanitizes HTML while preserving Markdown-friendly output, and hidden_characters removes characters that can hide directives. """ - HIDDEN_CHARACTERS = "hidden_characters" MARKDOWN = "markdown" NONE = "none" - class Host(Enum): HTTPS_GITHUB_COM = "https://github.com" - class CopilotAPITokenAuthInfoType(Enum): COPILOT_API_TOKEN = "copilot-api-token" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsChat: @@ -808,7 +726,7 @@ class CopilotUserResponseQuotaSnapshotsChat: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsChat": + def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsChat': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -822,20 +740,7 @@ def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsChat": timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshotsChat( - entitlement, - has_quota, - overage_count, - overage_permitted, - percent_remaining, - quota_id, - quota_remaining, - quota_reset_at, - remaining, - timestamp_utc, - token_based_billing, - unlimited, - ) + return CopilotUserResponseQuotaSnapshotsChat(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} @@ -860,14 +765,11 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union( - [from_bool, from_none], self.token_based_billing - ) + result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsCompletions: @@ -887,7 +789,7 @@ class CopilotUserResponseQuotaSnapshotsCompletions: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsCompletions": + def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsCompletions': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -901,20 +803,7 @@ def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsCompletions": timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshotsCompletions( - entitlement, - has_quota, - overage_count, - overage_permitted, - percent_remaining, - quota_id, - quota_remaining, - quota_reset_at, - remaining, - timestamp_utc, - token_based_billing, - unlimited, - ) + return CopilotUserResponseQuotaSnapshotsCompletions(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} @@ -939,14 +828,11 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union( - [from_bool, from_none], self.token_based_billing - ) + result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshotsPremiumInteractions: @@ -966,7 +852,7 @@ class CopilotUserResponseQuotaSnapshotsPremiumInteractions: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsPremiumInteractions": + def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshotsPremiumInteractions': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -980,20 +866,7 @@ def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshotsPremiumInteractions timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshotsPremiumInteractions( - entitlement, - has_quota, - overage_count, - overage_permitted, - percent_remaining, - quota_id, - quota_remaining, - quota_reset_at, - remaining, - timestamp_utc, - token_based_billing, - unlimited, - ) + return CopilotUserResponseQuotaSnapshotsPremiumInteractions(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} @@ -1018,14 +891,11 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union( - [from_bool, from_none], self.token_based_billing - ) + result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CurrentModel: @@ -1041,7 +911,7 @@ class CurrentModel: """ @staticmethod - def from_dict(obj: Any) -> "CurrentModel": + def from_dict(obj: Any) -> 'CurrentModel': assert isinstance(obj, dict) model_id = from_union([from_str, from_none], obj.get("modelId")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) @@ -1055,7 +925,6 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) return result - class DiscoveredMCPServerType(Enum): """Server transport type: stdio, http, sse (deprecated), or memory""" @@ -1064,7 +933,6 @@ class DiscoveredMCPServerType(Enum): SSE = "sse" STDIO = "stdio" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnqueueCommandParams: @@ -1076,7 +944,7 @@ class EnqueueCommandParams: """ @staticmethod - def from_dict(obj: Any) -> "EnqueueCommandParams": + def from_dict(obj: Any) -> 'EnqueueCommandParams': assert isinstance(obj, dict) command = from_str(obj.get("command")) return EnqueueCommandParams(command) @@ -1086,7 +954,6 @@ def to_dict(self) -> dict: result["command"] = from_str(self.command) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnqueueCommandResult: @@ -1098,7 +965,7 @@ class EnqueueCommandResult: """ @staticmethod - def from_dict(obj: Any) -> "EnqueueCommandResult": + def from_dict(obj: Any) -> 'EnqueueCommandResult': assert isinstance(obj, dict) queued = from_bool(obj.get("queued")) return EnqueueCommandResult(queued) @@ -1108,11 +975,9 @@ def to_dict(self) -> dict: result["queued"] = from_bool(self.queued) return result - class EnvAuthInfoType(Enum): ENV = "env" - # Experimental: this type is part of an experimental API and may change or be removed. class EventsAgentScope(Enum): """Agent-scope filter: 'primary' returns only main-agent events plus events whose type @@ -1120,16 +985,13 @@ class EventsAgentScope(Enum): events from all agents (matching wildcard-subscription behavior). Default is 'all' to preserve wildcard semantics for catch-up callers. """ - ALL = "all" PRIMARY = "primary" - # Experimental: this type is part of an experimental API and may change or be removed. class EventLogTypes(Enum): EMPTY = "*" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogReleaseInterestResult: @@ -1139,7 +1001,7 @@ class EventLogReleaseInterestResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "EventLogReleaseInterestResult": + def from_dict(obj: Any) -> 'EventLogReleaseInterestResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return EventLogReleaseInterestResult(success) @@ -1149,7 +1011,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogTailResult: @@ -1158,7 +1019,6 @@ class EventLogTailResult: the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session). """ - cursor: str """Opaque cursor pointing at the current tail of the session's persisted-events history. Pass back to `read` to receive only events that arrive AFTER this snapshot. When the @@ -1167,7 +1027,7 @@ class EventLogTailResult: """ @staticmethod - def from_dict(obj: Any) -> "EventLogTailResult": + def from_dict(obj: Any) -> 'EventLogTailResult': assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) return EventLogTailResult(cursor) @@ -1177,18 +1037,15 @@ def to_dict(self) -> dict: result["cursor"] = from_str(self.cursor) return result - # Experimental: this type is part of an experimental API and may change or be removed. class EventsCursorStatus(Enum): """Cursor status: 'ok' means the cursor was applied successfully; 'expired' means the cursor referred to an event that no longer exists in history (e.g. truncated or compacted away) and the read started from the beginning of the remaining history. """ - EXPIRED = "expired" OK = "ok" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExecuteCommandParams: @@ -1201,7 +1058,7 @@ class ExecuteCommandParams: """Name of the slash command to invoke (without the leading '/').""" @staticmethod - def from_dict(obj: Any) -> "ExecuteCommandParams": + def from_dict(obj: Any) -> 'ExecuteCommandParams': assert isinstance(obj, dict) args = from_str(obj.get("args")) command_name = from_str(obj.get("commandName")) @@ -1213,7 +1070,6 @@ def to_dict(self) -> dict: result["commandName"] = from_str(self.command_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExecuteCommandResult: @@ -1225,7 +1081,7 @@ class ExecuteCommandResult: """ @staticmethod - def from_dict(obj: Any) -> "ExecuteCommandResult": + def from_dict(obj: Any) -> 'ExecuteCommandResult': assert isinstance(obj, dict) error = from_union([from_str, from_none], obj.get("error")) return ExecuteCommandResult(error) @@ -1236,7 +1092,6 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result - # Experimental: this type is part of an experimental API and may change or be removed. class ExtensionSource(Enum): """Discovery source: project (.github/extensions/) or user (~/.copilot/extensions/)""" @@ -1244,7 +1099,6 @@ class ExtensionSource(Enum): PROJECT = "project" USER = "user" - # Experimental: this type is part of an experimental API and may change or be removed. class ExtensionStatus(Enum): """Current status: running, disabled, failed, or starting""" @@ -1254,7 +1108,6 @@ class ExtensionStatus(Enum): RUNNING = "running" STARTING = "starting" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionsDisableRequest: @@ -1264,7 +1117,7 @@ class ExtensionsDisableRequest: """Source-qualified extension ID to disable""" @staticmethod - def from_dict(obj: Any) -> "ExtensionsDisableRequest": + def from_dict(obj: Any) -> 'ExtensionsDisableRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return ExtensionsDisableRequest(id) @@ -1274,7 +1127,6 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionsEnableRequest: @@ -1284,7 +1136,7 @@ class ExtensionsEnableRequest: """Source-qualified extension ID to enable""" @staticmethod - def from_dict(obj: Any) -> "ExtensionsEnableRequest": + def from_dict(obj: Any) -> 'ExtensionsEnableRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return ExtensionsEnableRequest(id) @@ -1294,28 +1146,23 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result - # Experimental: this type is part of an experimental API and may change or be removed. class ExternalToolTextResultForLlmBinaryResultsForLlmType(Enum): """Binary result type discriminator. Use "image" for images and "resource" for other binary data. """ - IMAGE = "image" RESOURCE = "resource" - # Experimental: this type is part of an experimental API and may change or be removed. class Theme(Enum): """Theme variant this icon is intended for UI theme preference per SEP-1865 """ - DARK = "dark" LIGHT = "light" - class ExternalToolTextResultForLlmContentType(Enum): AUDIO = "audio" IMAGE = "image" @@ -1324,31 +1171,24 @@ class ExternalToolTextResultForLlmContentType(Enum): TERMINAL = "terminal" TEXT = "text" - class ExternalToolTextResultForLlmContentAudioType(Enum): AUDIO = "audio" - class ExternalToolTextResultForLlmContentImageType(Enum): IMAGE = "image" - class ExternalToolTextResultForLlmContentResourceType(Enum): RESOURCE = "resource" - class ExternalToolTextResultForLlmContentResourceLinkType(Enum): RESOURCE_LINK = "resource_link" - class ExternalToolTextResultForLlmContentTerminalType(Enum): TERMINAL = "terminal" - class KindEnum(Enum): TEXT = "text" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FleetStartRequest: @@ -1358,7 +1198,7 @@ class FleetStartRequest: """Optional user prompt to combine with fleet instructions""" @staticmethod - def from_dict(obj: Any) -> "FleetStartRequest": + def from_dict(obj: Any) -> 'FleetStartRequest': assert isinstance(obj, dict) prompt = from_union([from_str, from_none], obj.get("prompt")) return FleetStartRequest(prompt) @@ -1369,7 +1209,6 @@ def to_dict(self) -> dict: result["prompt"] = from_union([from_str, from_none], self.prompt) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FleetStartResult: @@ -1379,7 +1218,7 @@ class FleetStartResult: """Whether fleet mode was successfully activated""" @staticmethod - def from_dict(obj: Any) -> "FleetStartResult": + def from_dict(obj: Any) -> 'FleetStartResult': assert isinstance(obj, dict) started = from_bool(obj.get("started")) return FleetStartResult(started) @@ -1389,7 +1228,6 @@ def to_dict(self) -> dict: result["started"] = from_bool(self.started) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustAddParams: @@ -1399,7 +1237,7 @@ class FolderTrustAddParams: """Folder path to mark as trusted""" @staticmethod - def from_dict(obj: Any) -> "FolderTrustAddParams": + def from_dict(obj: Any) -> 'FolderTrustAddParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return FolderTrustAddParams(path) @@ -1409,7 +1247,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustCheckParams: @@ -1419,7 +1256,7 @@ class FolderTrustCheckParams: """Folder path to check""" @staticmethod - def from_dict(obj: Any) -> "FolderTrustCheckParams": + def from_dict(obj: Any) -> 'FolderTrustCheckParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return FolderTrustCheckParams(path) @@ -1429,7 +1266,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class FolderTrustCheckResult: @@ -1439,7 +1275,7 @@ class FolderTrustCheckResult: """Whether the folder is trusted""" @staticmethod - def from_dict(obj: Any) -> "FolderTrustCheckResult": + def from_dict(obj: Any) -> 'FolderTrustCheckResult': assert isinstance(obj, dict) trusted = from_bool(obj.get("trusted")) return FolderTrustCheckResult(trusted) @@ -1449,11 +1285,9 @@ def to_dict(self) -> dict: result["trusted"] = from_bool(self.trusted) return result - class GhCLIAuthInfoType(Enum): GH_CLI = "gh-cli" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallResult: @@ -1463,7 +1297,7 @@ class HandlePendingToolCallResult: """Whether the tool call result was handled successfully""" @staticmethod - def from_dict(obj: Any) -> "HandlePendingToolCallResult": + def from_dict(obj: Any) -> 'HandlePendingToolCallResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return HandlePendingToolCallResult(success) @@ -1473,7 +1307,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryAbortManualCompactionResult: @@ -1485,7 +1318,7 @@ class HistoryAbortManualCompactionResult: """ @staticmethod - def from_dict(obj: Any) -> "HistoryAbortManualCompactionResult": + def from_dict(obj: Any) -> 'HistoryAbortManualCompactionResult': assert isinstance(obj, dict) aborted = from_bool(obj.get("aborted")) return HistoryAbortManualCompactionResult(aborted) @@ -1495,7 +1328,6 @@ def to_dict(self) -> dict: result["aborted"] = from_bool(self.aborted) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCancelBackgroundCompactionResult: @@ -1507,7 +1339,7 @@ class HistoryCancelBackgroundCompactionResult: """ @staticmethod - def from_dict(obj: Any) -> "HistoryCancelBackgroundCompactionResult": + def from_dict(obj: Any) -> 'HistoryCancelBackgroundCompactionResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return HistoryCancelBackgroundCompactionResult(cancelled) @@ -1517,7 +1349,6 @@ def to_dict(self) -> dict: result["cancelled"] = from_bool(self.cancelled) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactContextWindow: @@ -1542,24 +1373,15 @@ class HistoryCompactContextWindow: """Token count from tool definitions""" @staticmethod - def from_dict(obj: Any) -> "HistoryCompactContextWindow": + def from_dict(obj: Any) -> 'HistoryCompactContextWindow': assert isinstance(obj, dict) current_tokens = from_int(obj.get("currentTokens")) messages_length = from_int(obj.get("messagesLength")) token_limit = from_int(obj.get("tokenLimit")) conversation_tokens = from_union([from_int, from_none], obj.get("conversationTokens")) system_tokens = from_union([from_int, from_none], obj.get("systemTokens")) - tool_definitions_tokens = from_union( - [from_int, from_none], obj.get("toolDefinitionsTokens") - ) - return HistoryCompactContextWindow( - current_tokens, - messages_length, - token_limit, - conversation_tokens, - system_tokens, - tool_definitions_tokens, - ) + tool_definitions_tokens = from_union([from_int, from_none], obj.get("toolDefinitionsTokens")) + return HistoryCompactContextWindow(current_tokens, messages_length, token_limit, conversation_tokens, system_tokens, tool_definitions_tokens) def to_dict(self) -> dict: result: dict = {} @@ -1567,18 +1389,13 @@ def to_dict(self) -> dict: result["messagesLength"] = from_int(self.messages_length) result["tokenLimit"] = from_int(self.token_limit) if self.conversation_tokens is not None: - result["conversationTokens"] = from_union( - [from_int, from_none], self.conversation_tokens - ) + result["conversationTokens"] = from_union([from_int, from_none], self.conversation_tokens) if self.system_tokens is not None: result["systemTokens"] = from_union([from_int, from_none], self.system_tokens) if self.tool_definitions_tokens is not None: - result["toolDefinitionsTokens"] = from_union( - [from_int, from_none], self.tool_definitions_tokens - ) + result["toolDefinitionsTokens"] = from_union([from_int, from_none], self.tool_definitions_tokens) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactRequest: @@ -1588,7 +1405,7 @@ class HistoryCompactRequest: """Optional user-provided instructions to focus the compaction summary""" @staticmethod - def from_dict(obj: Any) -> "HistoryCompactRequest": + def from_dict(obj: Any) -> 'HistoryCompactRequest': assert isinstance(obj, dict) custom_instructions = from_union([from_str, from_none], obj.get("customInstructions")) return HistoryCompactRequest(custom_instructions) @@ -1596,12 +1413,9 @@ def from_dict(obj: Any) -> "HistoryCompactRequest": def to_dict(self) -> dict: result: dict = {} if self.custom_instructions is not None: - result["customInstructions"] = from_union( - [from_str, from_none], self.custom_instructions - ) + result["customInstructions"] = from_union([from_str, from_none], self.custom_instructions) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistorySummarizeForHandoffResult: @@ -1613,7 +1427,7 @@ class HistorySummarizeForHandoffResult: """ @staticmethod - def from_dict(obj: Any) -> "HistorySummarizeForHandoffResult": + def from_dict(obj: Any) -> 'HistorySummarizeForHandoffResult': assert isinstance(obj, dict) summary = from_str(obj.get("summary")) return HistorySummarizeForHandoffResult(summary) @@ -1623,7 +1437,6 @@ def to_dict(self) -> dict: result["summary"] = from_str(self.summary) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryTruncateRequest: @@ -1633,7 +1446,7 @@ class HistoryTruncateRequest: """Event ID to truncate to. This event and all events after it are removed from the session.""" @staticmethod - def from_dict(obj: Any) -> "HistoryTruncateRequest": + def from_dict(obj: Any) -> 'HistoryTruncateRequest': assert isinstance(obj, dict) event_id = from_str(obj.get("eventId")) return HistoryTruncateRequest(event_id) @@ -1643,7 +1456,6 @@ def to_dict(self) -> dict: result["eventId"] = from_str(self.event_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryTruncateResult: @@ -1653,7 +1465,7 @@ class HistoryTruncateResult: """Number of events that were removed""" @staticmethod - def from_dict(obj: Any) -> "HistoryTruncateResult": + def from_dict(obj: Any) -> 'HistoryTruncateResult': assert isinstance(obj, dict) events_removed = from_int(obj.get("eventsRemoved")) return HistoryTruncateResult(events_removed) @@ -1663,29 +1475,23 @@ def to_dict(self) -> dict: result["eventsRemoved"] = from_int(self.events_removed) return result - class HMACAuthInfoType(Enum): HMAC = "hmac" - class PurpleSource(Enum): GITHUB = "github" LOCAL = "local" URL = "url" - class FluffySource(Enum): GITHUB = "github" - class TentacledSource(Enum): LOCAL = "local" - class StickySource(Enum): URL = "url" - # Experimental: this type is part of an experimental API and may change or be removed. class InstructionsSourcesLocation(Enum): """Where this source lives — used for UI grouping""" @@ -1695,7 +1501,6 @@ class InstructionsSourcesLocation(Enum): USER = "user" WORKING_DIRECTORY = "working-directory" - # Experimental: this type is part of an experimental API and may change or be removed. class InstructionsSourcesType(Enum): """Category of instruction source — used for merge logic""" @@ -1708,18 +1513,15 @@ class InstructionsSourcesType(Enum): REPO = "repo" VSCODE = "vscode" - # Experimental: this type is part of an experimental API and may change or be removed. class SessionLogLevel(Enum): """Log severity level. Determines how the message is displayed in the timeline. Defaults to "info". """ - ERROR = "error" INFO = "info" WARNING = "warning" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LogResult: @@ -1729,7 +1531,7 @@ class LogResult: """The unique identifier of the emitted session event""" @staticmethod - def from_dict(obj: Any) -> "LogResult": + def from_dict(obj: Any) -> 'LogResult': assert isinstance(obj, dict) event_id = UUID(obj.get("eventId")) return LogResult(event_id) @@ -1739,7 +1541,6 @@ def to_dict(self) -> dict: result["eventId"] = str(self.event_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LspInitializeRequest: @@ -1759,7 +1560,7 @@ class LspInitializeRequest: """ @staticmethod - def from_dict(obj: Any) -> "LspInitializeRequest": + def from_dict(obj: Any) -> 'LspInitializeRequest': assert isinstance(obj, dict) force = from_union([from_bool, from_none], obj.get("force")) git_root = from_union([from_str, from_none], obj.get("gitRoot")) @@ -1776,7 +1577,6 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseCapability: @@ -1792,7 +1592,7 @@ class MCPAppsDiagnoseCapability: """Whether the session has the `mcp-apps` capability""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsDiagnoseCapability": + def from_dict(obj: Any) -> 'MCPAppsDiagnoseCapability': assert isinstance(obj, dict) advertised = from_bool(obj.get("advertised")) feature_flag_enabled = from_bool(obj.get("featureFlagEnabled")) @@ -1806,7 +1606,6 @@ def to_dict(self) -> dict: result["sessionHasMcpApps"] = from_bool(self.session_has_mcp_apps) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseRequest: @@ -1816,7 +1615,7 @@ class MCPAppsDiagnoseRequest: """MCP server to probe""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsDiagnoseRequest": + def from_dict(obj: Any) -> 'MCPAppsDiagnoseRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPAppsDiagnoseRequest(server_name) @@ -1826,7 +1625,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseServer: @@ -1845,7 +1643,7 @@ class MCPAppsDiagnoseServer: """Tools whose `_meta.ui` is populated (resourceUri and/or visibility set)""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsDiagnoseServer": + def from_dict(obj: Any) -> 'MCPAppsDiagnoseServer': assert isinstance(obj, dict) connected = from_bool(obj.get("connected")) sample_tool_names = from_list(from_str, obj.get("sampleToolNames")) @@ -1861,7 +1659,6 @@ def to_dict(self) -> dict: result["toolsWithUiMeta"] = to_float(self.tools_with_ui_meta) return result - # Experimental: this type is part of an experimental API and may change or be removed. class MCPAppsDisplayMode(Enum): """Allowed values for the `McpAppsHostContextDetailsAvailableDisplayMode` enumeration. @@ -1870,12 +1667,10 @@ class MCPAppsDisplayMode(Enum): Allowed values for the `McpAppsSetHostContextDetailsAvailableDisplayMode` enumeration. """ - FULLSCREEN = "fullscreen" INLINE = "inline" PIP = "pip" - # Experimental: this type is part of an experimental API and may change or be removed. class MCPAppsHostContextDetailsPlatform(Enum): """Platform type for responsive design""" @@ -1884,7 +1679,6 @@ class MCPAppsHostContextDetailsPlatform(Enum): MOBILE = "mobile" WEB = "web" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsListToolsRequest: @@ -1899,7 +1693,7 @@ class MCPAppsListToolsRequest: """MCP server hosting the app""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsListToolsRequest": + def from_dict(obj: Any) -> 'MCPAppsListToolsRequest': assert isinstance(obj, dict) origin_server_name = from_str(obj.get("originServerName")) server_name = from_str(obj.get("serverName")) @@ -1911,7 +1705,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsListToolsResult: @@ -1921,7 +1714,7 @@ class MCPAppsListToolsResult: """App-callable tools from the server""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsListToolsResult": + def from_dict(obj: Any) -> 'MCPAppsListToolsResult': assert isinstance(obj, dict) tools = from_list(lambda x: from_dict(lambda x: x, x), obj.get("tools")) return MCPAppsListToolsResult(tools) @@ -1931,7 +1724,6 @@ def to_dict(self) -> dict: result["tools"] = from_list(lambda x: from_dict(lambda x: x, x), self.tools) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsReadResourceRequest: @@ -1944,7 +1736,7 @@ class MCPAppsReadResourceRequest: """Resource URI (typically ui://...)""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsReadResourceRequest": + def from_dict(obj: Any) -> 'MCPAppsReadResourceRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) uri = from_str(obj.get("uri")) @@ -1956,7 +1748,6 @@ def to_dict(self) -> dict: result["uri"] = from_str(self.uri) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsResourceContent: @@ -1978,7 +1769,7 @@ class MCPAppsResourceContent: """Text content (e.g. HTML)""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsResourceContent": + def from_dict(obj: Any) -> 'MCPAppsResourceContent': assert isinstance(obj, dict) uri = from_str(obj.get("uri")) meta = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("_meta")) @@ -1991,9 +1782,7 @@ def to_dict(self) -> dict: result: dict = {} result["uri"] = from_str(self.uri) if self.meta is not None: - result["_meta"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.meta - ) + result["_meta"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.meta) if self.blob is not None: result["blob"] = from_union([from_str, from_none], self.blob) if self.mime_type is not None: @@ -2002,7 +1791,6 @@ def to_dict(self) -> dict: result["text"] = from_union([from_str, from_none], self.text) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPCancelSamplingExecutionParams: @@ -2012,7 +1800,7 @@ class MCPCancelSamplingExecutionParams: """The requestId previously passed to executeSampling that should be cancelled""" @staticmethod - def from_dict(obj: Any) -> "MCPCancelSamplingExecutionParams": + def from_dict(obj: Any) -> 'MCPCancelSamplingExecutionParams': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) return MCPCancelSamplingExecutionParams(request_id) @@ -2022,14 +1810,12 @@ def to_dict(self) -> dict: result["requestId"] = from_str(self.request_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPCancelSamplingExecutionResult: """Indicates whether an in-flight sampling execution with the given requestId was found and cancelled. """ - cancelled: bool """True if an in-flight execution with the given requestId was found and signalled to cancel. False when no such execution is in flight (already completed, never started, or @@ -2037,7 +1823,7 @@ class MCPCancelSamplingExecutionResult: """ @staticmethod - def from_dict(obj: Any) -> "MCPCancelSamplingExecutionResult": + def from_dict(obj: Any) -> 'MCPCancelSamplingExecutionResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return MCPCancelSamplingExecutionResult(cancelled) @@ -2047,7 +1833,6 @@ def to_dict(self) -> dict: result["cancelled"] = from_bool(self.cancelled) return result - @dataclass class MCPServerConfigHTTPAuth: """Additional authentication configuration for this server.""" @@ -2056,7 +1841,7 @@ class MCPServerConfigHTTPAuth: """Fixed port for the OAuth redirect callback server.""" @staticmethod - def from_dict(obj: Any) -> "MCPServerConfigHTTPAuth": + def from_dict(obj: Any) -> 'MCPServerConfigHTTPAuth': assert isinstance(obj, dict) redirect_port = from_union([from_int, from_none], obj.get("redirectPort")) return MCPServerConfigHTTPAuth(redirect_port) @@ -2067,21 +1852,18 @@ def to_dict(self) -> dict: result["redirectPort"] = from_union([from_int, from_none], self.redirect_port) return result - class MCPServerConfigHTTPOauthGrantType(Enum): """OAuth grant type to use when authenticating to the remote MCP server.""" AUTHORIZATION_CODE = "authorization_code" CLIENT_CREDENTIALS = "client_credentials" - class MCPServerConfigHTTPType(Enum): """Remote transport type. Defaults to "http" when omitted.""" HTTP = "http" SSE = "sse" - @dataclass class MCPConfigDisableRequest: """MCP server names to disable for new sessions.""" @@ -2093,7 +1875,7 @@ class MCPConfigDisableRequest: """ @staticmethod - def from_dict(obj: Any) -> "MCPConfigDisableRequest": + def from_dict(obj: Any) -> 'MCPConfigDisableRequest': assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return MCPConfigDisableRequest(names) @@ -2103,7 +1885,6 @@ def to_dict(self) -> dict: result["names"] = from_list(from_str, self.names) return result - @dataclass class MCPConfigEnableRequest: """MCP server names to enable for new sessions.""" @@ -2114,7 +1895,7 @@ class MCPConfigEnableRequest: """ @staticmethod - def from_dict(obj: Any) -> "MCPConfigEnableRequest": + def from_dict(obj: Any) -> 'MCPConfigEnableRequest': assert isinstance(obj, dict) names = from_list(from_str, obj.get("names")) return MCPConfigEnableRequest(names) @@ -2124,7 +1905,6 @@ def to_dict(self) -> dict: result["names"] = from_list(from_str, self.names) return result - @dataclass class MCPConfigRemoveRequest: """MCP server name to remove from user configuration.""" @@ -2133,7 +1913,7 @@ class MCPConfigRemoveRequest: """Name of the MCP server to remove""" @staticmethod - def from_dict(obj: Any) -> "MCPConfigRemoveRequest": + def from_dict(obj: Any) -> 'MCPConfigRemoveRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return MCPConfigRemoveRequest(name) @@ -2143,7 +1923,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPDisableRequest: @@ -2153,7 +1932,7 @@ class MCPDisableRequest: """Name of the MCP server to disable""" @staticmethod - def from_dict(obj: Any) -> "MCPDisableRequest": + def from_dict(obj: Any) -> 'MCPDisableRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPDisableRequest(server_name) @@ -2163,7 +1942,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - @dataclass class MCPDiscoverRequest: """Optional working directory used as context for MCP server discovery.""" @@ -2172,7 +1950,7 @@ class MCPDiscoverRequest: """Working directory used as context for discovery (e.g., plugin resolution)""" @staticmethod - def from_dict(obj: Any) -> "MCPDiscoverRequest": + def from_dict(obj: Any) -> 'MCPDiscoverRequest': assert isinstance(obj, dict) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) return MCPDiscoverRequest(working_directory) @@ -2183,7 +1961,6 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPEnableRequest: @@ -2193,7 +1970,7 @@ class MCPEnableRequest: """Name of the MCP server to enable""" @staticmethod - def from_dict(obj: Any) -> "MCPEnableRequest": + def from_dict(obj: Any) -> 'MCPEnableRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return MCPEnableRequest(server_name) @@ -2203,14 +1980,12 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthLoginRequest: """Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy. """ - server_name: str """Name of the remote MCP server to authenticate""" @@ -2233,39 +2008,31 @@ class MCPOauthLoginRequest: """ @staticmethod - def from_dict(obj: Any) -> "MCPOauthLoginRequest": + def from_dict(obj: Any) -> 'MCPOauthLoginRequest': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) - callback_success_message = from_union( - [from_str, from_none], obj.get("callbackSuccessMessage") - ) + callback_success_message = from_union([from_str, from_none], obj.get("callbackSuccessMessage")) client_name = from_union([from_str, from_none], obj.get("clientName")) force_reauth = from_union([from_bool, from_none], obj.get("forceReauth")) - return MCPOauthLoginRequest( - server_name, callback_success_message, client_name, force_reauth - ) + return MCPOauthLoginRequest(server_name, callback_success_message, client_name, force_reauth) def to_dict(self) -> dict: result: dict = {} result["serverName"] = from_str(self.server_name) if self.callback_success_message is not None: - result["callbackSuccessMessage"] = from_union( - [from_str, from_none], self.callback_success_message - ) + result["callbackSuccessMessage"] = from_union([from_str, from_none], self.callback_success_message) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.force_reauth is not None: result["forceReauth"] = from_union([from_bool, from_none], self.force_reauth) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPOauthLoginResult: """OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server. """ - authorization_url: str | None = None """URL the caller should open in a browser to complete OAuth. Omitted when cached tokens were still valid and no browser interaction was needed — the server is already @@ -2275,7 +2042,7 @@ class MCPOauthLoginResult: """ @staticmethod - def from_dict(obj: Any) -> "MCPOauthLoginResult": + def from_dict(obj: Any) -> 'MCPOauthLoginResult': assert isinstance(obj, dict) authorization_url = from_union([from_str, from_none], obj.get("authorizationUrl")) return MCPOauthLoginResult(authorization_url) @@ -2286,14 +2053,12 @@ def to_dict(self) -> dict: result["authorizationUrl"] = from_union([from_str, from_none], self.authorization_url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPRemoveGitHubResult: """Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove). """ - removed: bool """True when the auto-managed `github` MCP server was removed; false when no removal happened (e.g. user has explicitly configured a `github` server, or the server was not @@ -2301,7 +2066,7 @@ class MCPRemoveGitHubResult: """ @staticmethod - def from_dict(obj: Any) -> "MCPRemoveGitHubResult": + def from_dict(obj: Any) -> 'MCPRemoveGitHubResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return MCPRemoveGitHubResult(removed) @@ -2311,19 +2076,16 @@ def to_dict(self) -> dict: result["removed"] = from_bool(self.removed) return result - # Experimental: this type is part of an experimental API and may change or be removed. class MCPSamplingExecutionAction(Enum): """Outcome of the sampling inference. 'success' produced a response; 'failure' encountered an error (including agent-side rejection by content filter or criteria); 'cancelled' the caller cancelled this execution via cancelSamplingExecution. """ - CANCELLED = "cancelled" FAILURE = "failure" SUCCESS = "success" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServer: @@ -2342,7 +2104,7 @@ class MCPServer: """Configuration source: user, workspace, plugin, or builtin""" @staticmethod - def from_dict(obj: Any) -> "MCPServer": + def from_dict(obj: Any) -> 'MCPServer': assert isinstance(obj, dict) name = from_str(obj.get("name")) status = McpServerStatus(obj.get("status")) @@ -2357,12 +2119,9 @@ def to_dict(self) -> dict: if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.source is not None: - result["source"] = from_union( - [lambda x: to_enum(McpServerSource, x), from_none], self.source - ) + result["source"] = from_union([lambda x: to_enum(McpServerSource, x), from_none], self.source) return result - # Experimental: this type is part of an experimental API and may change or be removed. class MCPSetEnvValueModeDetails(Enum): """How environment-variable values supplied to MCP servers are resolved. "direct" passes @@ -2376,11 +2135,9 @@ class MCPSetEnvValueModeDetails(Enum): How env values are passed to MCP servers (`direct` inlines literal values; `indirect` resolves at launch). """ - DIRECT = "direct" INDIRECT = "indirect" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionContextInfo: @@ -2416,7 +2173,7 @@ class SessionContextInfo: """Sum of system, conversation and tool-definition tokens""" @staticmethod - def from_dict(obj: Any) -> "SessionContextInfo": + def from_dict(obj: Any) -> 'SessionContextInfo': assert isinstance(obj, dict) buffer_tokens = from_int(obj.get("bufferTokens")) compaction_threshold = from_int(obj.get("compactionThreshold")) @@ -2427,17 +2184,7 @@ def from_dict(obj: Any) -> "SessionContextInfo": system_tokens = from_int(obj.get("systemTokens")) tool_definitions_tokens = from_int(obj.get("toolDefinitionsTokens")) total_tokens = from_int(obj.get("totalTokens")) - return SessionContextInfo( - buffer_tokens, - compaction_threshold, - conversation_tokens, - limit, - model_name, - prompt_token_limit, - system_tokens, - tool_definitions_tokens, - total_tokens, - ) + return SessionContextInfo(buffer_tokens, compaction_threshold, conversation_tokens, limit, model_name, prompt_token_limit, system_tokens, tool_definitions_tokens, total_tokens) def to_dict(self) -> dict: result: dict = {} @@ -2452,14 +2199,12 @@ def to_dict(self) -> dict: result["totalTokens"] = from_int(self.total_tokens) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataIsProcessingResult: """Indicates whether the local session is currently processing a turn or background continuation. """ - processing: bool """Whether the session is currently processing user/agent messages. False for non-local sessions (which don't run a local agentic loop). Reflects an in-flight turn or background @@ -2467,7 +2212,7 @@ class MetadataIsProcessingResult: """ @staticmethod - def from_dict(obj: Any) -> "MetadataIsProcessingResult": + def from_dict(obj: Any) -> 'MetadataIsProcessingResult': assert isinstance(obj, dict) processing = from_bool(obj.get("processing")) return MetadataIsProcessingResult(processing) @@ -2477,7 +2222,6 @@ def to_dict(self) -> dict: result["processing"] = from_bool(self.processing) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecomputeContextTokensResult: @@ -2486,7 +2230,6 @@ class MetadataRecomputeContextTokensResult: resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session. """ - messages_token_count: int """Tokens contributed by user/assistant/tool messages (excludes system/developer prompts).""" @@ -2499,14 +2242,12 @@ class MetadataRecomputeContextTokensResult: """ @staticmethod - def from_dict(obj: Any) -> "MetadataRecomputeContextTokensResult": + def from_dict(obj: Any) -> 'MetadataRecomputeContextTokensResult': assert isinstance(obj, dict) messages_token_count = from_int(obj.get("messagesTokenCount")) system_token_count = from_int(obj.get("systemTokenCount")) total_tokens = from_int(obj.get("totalTokens")) - return MetadataRecomputeContextTokensResult( - messages_token_count, system_token_count, total_tokens - ) + return MetadataRecomputeContextTokensResult(messages_token_count, system_token_count, total_tokens) def to_dict(self) -> dict: result: dict = {} @@ -2515,7 +2256,6 @@ def to_dict(self) -> dict: result["totalTokens"] = from_int(self.total_tokens) return result - # Experimental: this type is part of an experimental API and may change or be removed. class HostType(Enum): """Hosting platform type of the repository @@ -2526,11 +2266,9 @@ class HostType(Enum): Allowed values for the `WorkspacesWorkspaceDetailsHostType` enumeration. """ - ADO = "ado" GITHUB = "github" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecordContextChangeResult: @@ -2539,9 +2277,8 @@ class MetadataRecordContextChangeResult: UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode). """ - @staticmethod - def from_dict(obj: Any) -> "MetadataRecordContextChangeResult": + def from_dict(obj: Any) -> 'MetadataRecordContextChangeResult': assert isinstance(obj, dict) return MetadataRecordContextChangeResult() @@ -2549,7 +2286,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSetWorkingDirectoryRequest: @@ -2562,7 +2298,7 @@ class MetadataSetWorkingDirectoryRequest: """ @staticmethod - def from_dict(obj: Any) -> "MetadataSetWorkingDirectoryRequest": + def from_dict(obj: Any) -> 'MetadataSetWorkingDirectoryRequest': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return MetadataSetWorkingDirectoryRequest(working_directory) @@ -2572,7 +2308,6 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSetWorkingDirectoryResult: @@ -2581,12 +2316,11 @@ class MetadataSetWorkingDirectoryResult: related side-effects (file index, etc.); this method only updates the session's own recorded path. """ - working_directory: str """Working directory after the update""" @staticmethod - def from_dict(obj: Any) -> "MetadataSetWorkingDirectoryResult": + def from_dict(obj: Any) -> 'MetadataSetWorkingDirectoryResult': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return MetadataSetWorkingDirectoryResult(working_directory) @@ -2596,7 +2330,6 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. class MetadataSnapshotCurrentMode(Enum): """The current agent mode for this session (e.g., 'interactive', 'plan', 'autopilot')""" @@ -2605,7 +2338,6 @@ class MetadataSnapshotCurrentMode(Enum): INTERACTIVE = "interactive" PLAN = "plan" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSnapshotRemoteMetadataRepository: @@ -2621,7 +2353,7 @@ class MetadataSnapshotRemoteMetadataRepository: """The GitHub owner (user or organization) of the target repository.""" @staticmethod - def from_dict(obj: Any) -> "MetadataSnapshotRemoteMetadataRepository": + def from_dict(obj: Any) -> 'MetadataSnapshotRemoteMetadataRepository': assert isinstance(obj, dict) branch = from_str(obj.get("branch")) name = from_str(obj.get("name")) @@ -2635,17 +2367,14 @@ def to_dict(self) -> dict: result["owner"] = from_str(self.owner) return result - # Experimental: this type is part of an experimental API and may change or be removed. class MetadataSnapshotRemoteMetadataTaskType(Enum): """Whether the remote task originated from Copilot Coding Agent (cca) or a CLI `--remote` invocation. """ - CCA = "cca" CLI = "cli" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModeSetRequest: @@ -2655,7 +2384,7 @@ class ModeSetRequest: """The session mode the agent is operating in""" @staticmethod - def from_dict(obj: Any) -> "ModeSetRequest": + def from_dict(obj: Any) -> 'ModeSetRequest': assert isinstance(obj, dict) mode = SessionMode(obj.get("mode")) return ModeSetRequest(mode) @@ -2665,7 +2394,6 @@ def to_dict(self) -> dict: result["mode"] = to_enum(SessionMode, self.mode) return result - @dataclass class ModelBillingTokenPricesLongContext: """Long context tier pricing (available for models with extended context windows)""" @@ -2683,15 +2411,13 @@ class ModelBillingTokenPricesLongContext: """AI Credits cost per billing batch of output tokens""" @staticmethod - def from_dict(obj: Any) -> "ModelBillingTokenPricesLongContext": + def from_dict(obj: Any) -> 'ModelBillingTokenPricesLongContext': assert isinstance(obj, dict) cache_price = from_union([from_float, from_none], obj.get("cachePrice")) context_max = from_union([from_int, from_none], obj.get("contextMax")) input_price = from_union([from_float, from_none], obj.get("inputPrice")) output_price = from_union([from_float, from_none], obj.get("outputPrice")) - return ModelBillingTokenPricesLongContext( - cache_price, context_max, input_price, output_price - ) + return ModelBillingTokenPricesLongContext(cache_price, context_max, input_price, output_price) def to_dict(self) -> dict: result: dict = {} @@ -2705,7 +2431,6 @@ def to_dict(self) -> dict: result["outputPrice"] = from_union([to_float, from_none], self.output_price) return result - @dataclass class ModelCapabilitiesLimitsVision: """Vision-specific limits""" @@ -2720,14 +2445,12 @@ class ModelCapabilitiesLimitsVision: """MIME types the model accepts""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesLimitsVision": + def from_dict(obj: Any) -> 'ModelCapabilitiesLimitsVision': assert isinstance(obj, dict) max_prompt_image_size = from_int(obj.get("max_prompt_image_size")) max_prompt_images = from_int(obj.get("max_prompt_images")) supported_media_types = from_list(from_str, obj.get("supported_media_types")) - return ModelCapabilitiesLimitsVision( - max_prompt_image_size, max_prompt_images, supported_media_types - ) + return ModelCapabilitiesLimitsVision(max_prompt_image_size, max_prompt_images, supported_media_types) def to_dict(self) -> dict: result: dict = {} @@ -2736,7 +2459,6 @@ def to_dict(self) -> dict: result["supported_media_types"] = from_list(from_str, self.supported_media_types) return result - @dataclass class ModelCapabilitiesSupports: """Feature flags indicating what the model supports""" @@ -2748,7 +2470,7 @@ class ModelCapabilitiesSupports: """Whether this model supports vision/image input""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesSupports": + def from_dict(obj: Any) -> 'ModelCapabilitiesSupports': assert isinstance(obj, dict) reasoning_effort = from_union([from_bool, from_none], obj.get("reasoningEffort")) vision = from_union([from_bool, from_none], obj.get("vision")) @@ -2762,7 +2484,6 @@ def to_dict(self) -> dict: result["vision"] = from_union([from_bool, from_none], self.vision) return result - class ModelPickerPriceCategory(Enum): """Relative cost tier for token-based billing users""" @@ -2771,7 +2492,6 @@ class ModelPickerPriceCategory(Enum): MEDIUM = "medium" VERY_HIGH = "very_high" - class ModelPolicyState(Enum): """Current policy state for this model""" @@ -2779,7 +2499,6 @@ class ModelPolicyState(Enum): ENABLED = "enabled" UNCONFIGURED = "unconfigured" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideLimitsVision: @@ -2795,32 +2514,23 @@ class ModelCapabilitiesOverrideLimitsVision: """MIME types the model accepts""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesOverrideLimitsVision": + def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideLimitsVision': assert isinstance(obj, dict) max_prompt_image_size = from_union([from_int, from_none], obj.get("max_prompt_image_size")) max_prompt_images = from_union([from_int, from_none], obj.get("max_prompt_images")) - supported_media_types = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("supported_media_types") - ) - return ModelCapabilitiesOverrideLimitsVision( - max_prompt_image_size, max_prompt_images, supported_media_types - ) + supported_media_types = from_union([lambda x: from_list(from_str, x), from_none], obj.get("supported_media_types")) + return ModelCapabilitiesOverrideLimitsVision(max_prompt_image_size, max_prompt_images, supported_media_types) def to_dict(self) -> dict: result: dict = {} if self.max_prompt_image_size is not None: - result["max_prompt_image_size"] = from_union( - [from_int, from_none], self.max_prompt_image_size - ) + result["max_prompt_image_size"] = from_union([from_int, from_none], self.max_prompt_image_size) if self.max_prompt_images is not None: result["max_prompt_images"] = from_union([from_int, from_none], self.max_prompt_images) if self.supported_media_types is not None: - result["supported_media_types"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.supported_media_types - ) + result["supported_media_types"] = from_union([lambda x: from_list(from_str, x), from_none], self.supported_media_types) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideSupports: @@ -2833,7 +2543,7 @@ class ModelCapabilitiesOverrideSupports: """Whether this model supports vision/image input""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesOverrideSupports": + def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideSupports': assert isinstance(obj, dict) reasoning_effort = from_union([from_bool, from_none], obj.get("reasoningEffort")) vision = from_union([from_bool, from_none], obj.get("vision")) @@ -2847,7 +2557,6 @@ def to_dict(self) -> dict: result["vision"] = from_union([from_bool, from_none], self.vision) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSetReasoningEffortRequest: @@ -2859,7 +2568,7 @@ class ModelSetReasoningEffortRequest: """ @staticmethod - def from_dict(obj: Any) -> "ModelSetReasoningEffortRequest": + def from_dict(obj: Any) -> 'ModelSetReasoningEffortRequest': assert isinstance(obj, dict) reasoning_effort = from_str(obj.get("reasoningEffort")) return ModelSetReasoningEffortRequest(reasoning_effort) @@ -2869,7 +2578,6 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_str(self.reasoning_effort) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSetReasoningEffortResult: @@ -2877,12 +2585,11 @@ class ModelSetReasoningEffortResult: instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns. """ - reasoning_effort: str """Reasoning effort level recorded on the session after the update""" @staticmethod - def from_dict(obj: Any) -> "ModelSetReasoningEffortResult": + def from_dict(obj: Any) -> 'ModelSetReasoningEffortResult': assert isinstance(obj, dict) reasoning_effort = from_str(obj.get("reasoningEffort")) return ModelSetReasoningEffortResult(reasoning_effort) @@ -2892,7 +2599,6 @@ def to_dict(self) -> dict: result["reasoningEffort"] = from_str(self.reasoning_effort) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSwitchToResult: @@ -2902,7 +2608,7 @@ class ModelSwitchToResult: """Currently active model identifier after the switch""" @staticmethod - def from_dict(obj: Any) -> "ModelSwitchToResult": + def from_dict(obj: Any) -> 'ModelSwitchToResult': assert isinstance(obj, dict) model_id = from_union([from_str, from_none], obj.get("modelId")) return ModelSwitchToResult(model_id) @@ -2913,7 +2619,6 @@ def to_dict(self) -> dict: result["modelId"] = from_union([from_str, from_none], self.model_id) return result - @dataclass class ModelsListRequest: git_hub_token: str | None = None @@ -2922,7 +2627,7 @@ class ModelsListRequest: """ @staticmethod - def from_dict(obj: Any) -> "ModelsListRequest": + def from_dict(obj: Any) -> 'ModelsListRequest': assert isinstance(obj, dict) git_hub_token = from_union([from_str, from_none], obj.get("gitHubToken")) return ModelsListRequest(git_hub_token) @@ -2933,7 +2638,6 @@ def to_dict(self) -> dict: result["gitHubToken"] = from_union([from_str, from_none], self.git_hub_token) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameGetResult: @@ -2943,7 +2647,7 @@ class NameGetResult: """The session name (user-set or auto-generated), or null if not yet set""" @staticmethod - def from_dict(obj: Any) -> "NameGetResult": + def from_dict(obj: Any) -> 'NameGetResult': assert isinstance(obj, dict) name = from_union([from_none, from_str], obj.get("name")) return NameGetResult(name) @@ -2953,21 +2657,19 @@ def to_dict(self) -> dict: result["name"] = from_union([from_none, from_str], self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetAutoRequest: """Auto-generated session summary to apply as the session's name when no user-set name exists. """ - summary: str """Auto-generated session summary. Empty/whitespace-only values are ignored; values are trimmed before persisting. """ @staticmethod - def from_dict(obj: Any) -> "NameSetAutoRequest": + def from_dict(obj: Any) -> 'NameSetAutoRequest': assert isinstance(obj, dict) summary = from_str(obj.get("summary")) return NameSetAutoRequest(summary) @@ -2977,7 +2679,6 @@ def to_dict(self) -> dict: result["summary"] = from_str(self.summary) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetAutoResult: @@ -2989,7 +2690,7 @@ class NameSetAutoResult: """ @staticmethod - def from_dict(obj: Any) -> "NameSetAutoResult": + def from_dict(obj: Any) -> 'NameSetAutoResult': assert isinstance(obj, dict) applied = from_bool(obj.get("applied")) return NameSetAutoResult(applied) @@ -2999,7 +2700,6 @@ def to_dict(self) -> dict: result["applied"] = from_bool(self.applied) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class NameSetRequest: @@ -3009,7 +2709,7 @@ class NameSetRequest: """New session name (1–100 characters, trimmed of leading/trailing whitespace)""" @staticmethod - def from_dict(obj: Any) -> "NameSetRequest": + def from_dict(obj: Any) -> 'NameSetRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return NameSetRequest(name) @@ -3019,7 +2719,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PendingPermissionRequest: @@ -3033,7 +2732,7 @@ class PendingPermissionRequest: """Unique identifier for the pending permission request""" @staticmethod - def from_dict(obj: Any) -> "PendingPermissionRequest": + def from_dict(obj: Any) -> 'PendingPermissionRequest': assert isinstance(obj, dict) request = PermissionPromptRequest.from_dict(obj.get("request")) request_id = from_str(obj.get("requestId")) @@ -3045,7 +2744,6 @@ def to_dict(self) -> dict: result["requestId"] = from_str(self.request_id) return result - class ApprovalKind(Enum): COMMANDS = "commands" CUSTOM_TOOL = "custom-tool" @@ -3057,7 +2755,6 @@ class ApprovalKind(Enum): READ = "read" WRITE = "write" - class PermissionDecisionKind(Enum): APPROVED = "approved" APPROVED_FOR_LOCATION = "approved-for-location" @@ -3071,107 +2768,79 @@ class PermissionDecisionKind(Enum): DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook" DENIED_BY_RULES = "denied-by-rules" DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user" - DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = ( - "denied-no-approval-rule-and-could-not-request-from-user" - ) + DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user" REJECT = "reject" USER_NOT_AVAILABLE = "user-not-available" - class PermissionDecisionApproveForLocationKind(Enum): APPROVE_FOR_LOCATION = "approve-for-location" - class PermissionDecisionApproveForLocationApprovalCommandsKind(Enum): COMMANDS = "commands" - class PermissionDecisionApproveForLocationApprovalCustomToolKind(Enum): CUSTOM_TOOL = "custom-tool" - class PermissionDecisionApproveForLocationApprovalExtensionManagementKind(Enum): EXTENSION_MANAGEMENT = "extension-management" - class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccessKind(Enum): EXTENSION_PERMISSION_ACCESS = "extension-permission-access" - class PermissionDecisionApproveForLocationApprovalMCPKind(Enum): MCP = "mcp" - class PermissionDecisionApproveForLocationApprovalMCPSamplingKind(Enum): MCP_SAMPLING = "mcp-sampling" - class PermissionDecisionApproveForLocationApprovalMemoryKind(Enum): MEMORY = "memory" - class PermissionDecisionApproveForLocationApprovalReadKind(Enum): READ = "read" - class PermissionDecisionApproveForLocationApprovalWriteKind(Enum): WRITE = "write" - class PermissionDecisionApproveForSessionKind(Enum): APPROVE_FOR_SESSION = "approve-for-session" - class PermissionDecisionApproveOnceKind(Enum): APPROVE_ONCE = "approve-once" - class PermissionDecisionApprovePermanentlyKind(Enum): APPROVE_PERMANENTLY = "approve-permanently" - class PermissionDecisionApprovedKind(Enum): APPROVED = "approved" - class PermissionDecisionApprovedForLocationKind(Enum): APPROVED_FOR_LOCATION = "approved-for-location" - class PermissionDecisionApprovedForSessionKind(Enum): APPROVED_FOR_SESSION = "approved-for-session" - class PermissionDecisionCancelledKind(Enum): CANCELLED = "cancelled" - class PermissionDecisionDeniedByContentExclusionPolicyKind(Enum): DENIED_BY_CONTENT_EXCLUSION_POLICY = "denied-by-content-exclusion-policy" - class PermissionDecisionDeniedByPermissionRequestHookKind(Enum): DENIED_BY_PERMISSION_REQUEST_HOOK = "denied-by-permission-request-hook" - class PermissionDecisionDeniedByRulesKind(Enum): DENIED_BY_RULES = "denied-by-rules" - class PermissionDecisionDeniedInteractivelyByUserKind(Enum): DENIED_INTERACTIVELY_BY_USER = "denied-interactively-by-user" - class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUserKind(Enum): - DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = ( - "denied-no-approval-rule-and-could-not-request-from-user" - ) - + DENIED_NO_APPROVAL_RULE_AND_COULD_NOT_REQUEST_FROM_USER = "denied-no-approval-rule-and-could-not-request-from-user" class PermissionDecisionRejectKind(Enum): REJECT = "reject" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionRequest: @@ -3184,7 +2853,7 @@ class PermissionDecisionRequest: """The client's response to the pending permission prompt""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionRequest": + def from_dict(obj: Any) -> 'PermissionDecisionRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = _load_PermissionDecision(obj.get("result")) @@ -3196,11 +2865,9 @@ def to_dict(self) -> dict: result["result"] = (self.result).to_dict() return result - class PermissionDecisionUserNotAvailableKind(Enum): USER_NOT_AVAILABLE = "user-not-available" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationApplyParams: @@ -3210,7 +2877,7 @@ class PermissionLocationApplyParams: """Working directory whose persisted location permissions should be applied""" @staticmethod - def from_dict(obj: Any) -> "PermissionLocationApplyParams": + def from_dict(obj: Any) -> 'PermissionLocationApplyParams': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return PermissionLocationApplyParams(working_directory) @@ -3220,7 +2887,6 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. class PermissionLocationType(Enum): """Whether the location is a git repo or directory""" @@ -3228,7 +2894,6 @@ class PermissionLocationType(Enum): DIR = "dir" REPO = "repo" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationResolveParams: @@ -3238,7 +2903,7 @@ class PermissionLocationResolveParams: """Working directory whose permission location should be resolved""" @staticmethod - def from_dict(obj: Any) -> "PermissionLocationResolveParams": + def from_dict(obj: Any) -> 'PermissionLocationResolveParams': assert isinstance(obj, dict) working_directory = from_str(obj.get("workingDirectory")) return PermissionLocationResolveParams(working_directory) @@ -3248,7 +2913,6 @@ def to_dict(self) -> dict: result["workingDirectory"] = from_str(self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAddParams: @@ -3260,7 +2924,7 @@ class PermissionPathsAddParams: """ @staticmethod - def from_dict(obj: Any) -> "PermissionPathsAddParams": + def from_dict(obj: Any) -> 'PermissionPathsAddParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsAddParams(path) @@ -3270,7 +2934,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAllowedCheckParams: @@ -3280,7 +2943,7 @@ class PermissionPathsAllowedCheckParams: """Path to check against the session's allowed directories""" @staticmethod - def from_dict(obj: Any) -> "PermissionPathsAllowedCheckParams": + def from_dict(obj: Any) -> 'PermissionPathsAllowedCheckParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsAllowedCheckParams(path) @@ -3290,7 +2953,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsAllowedCheckResult: @@ -3300,7 +2962,7 @@ class PermissionPathsAllowedCheckResult: """Whether the path is within the session's allowed directories""" @staticmethod - def from_dict(obj: Any) -> "PermissionPathsAllowedCheckResult": + def from_dict(obj: Any) -> 'PermissionPathsAllowedCheckResult': assert isinstance(obj, dict) allowed = from_bool(obj.get("allowed")) return PermissionPathsAllowedCheckResult(allowed) @@ -3310,7 +2972,6 @@ def to_dict(self) -> dict: result["allowed"] = from_bool(self.allowed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsList: @@ -3323,7 +2984,7 @@ class PermissionPathsList: """The primary working directory for this session.""" @staticmethod - def from_dict(obj: Any) -> "PermissionPathsList": + def from_dict(obj: Any) -> 'PermissionPathsList': assert isinstance(obj, dict) directories = from_list(from_str, obj.get("directories")) primary = from_str(obj.get("primary")) @@ -3335,7 +2996,6 @@ def to_dict(self) -> dict: result["primary"] = from_str(self.primary) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsUpdatePrimaryParams: @@ -3345,7 +3005,7 @@ class PermissionPathsUpdatePrimaryParams: """Directory to set as the new primary working directory for the session's permission policy.""" @staticmethod - def from_dict(obj: Any) -> "PermissionPathsUpdatePrimaryParams": + def from_dict(obj: Any) -> 'PermissionPathsUpdatePrimaryParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsUpdatePrimaryParams(path) @@ -3355,7 +3015,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsWorkspaceCheckParams: @@ -3365,7 +3024,7 @@ class PermissionPathsWorkspaceCheckParams: """Path to check against the session workspace directory""" @staticmethod - def from_dict(obj: Any) -> "PermissionPathsWorkspaceCheckParams": + def from_dict(obj: Any) -> 'PermissionPathsWorkspaceCheckParams': assert isinstance(obj, dict) path = from_str(obj.get("path")) return PermissionPathsWorkspaceCheckParams(path) @@ -3375,7 +3034,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsWorkspaceCheckResult: @@ -3385,7 +3043,7 @@ class PermissionPathsWorkspaceCheckResult: """Whether the path is within the session workspace directory""" @staticmethod - def from_dict(obj: Any) -> "PermissionPathsWorkspaceCheckResult": + def from_dict(obj: Any) -> 'PermissionPathsWorkspaceCheckResult': assert isinstance(obj, dict) allowed = from_bool(obj.get("allowed")) return PermissionPathsWorkspaceCheckResult(allowed) @@ -3395,7 +3053,6 @@ def to_dict(self) -> dict: result["allowed"] = from_bool(self.allowed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPromptShownNotification: @@ -3408,7 +3065,7 @@ class PermissionPromptShownNotification: """ @staticmethod - def from_dict(obj: Any) -> "PermissionPromptShownNotification": + def from_dict(obj: Any) -> 'PermissionPromptShownNotification': assert isinstance(obj, dict) message = from_str(obj.get("message")) return PermissionPromptShownNotification(message) @@ -3418,19 +3075,17 @@ def to_dict(self) -> dict: result["message"] = from_str(self.message) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionRequestResult: """Indicates whether the permission decision was applied; false when the request was already resolved. """ - success: bool """Whether the permission request was handled successfully""" @staticmethod - def from_dict(obj: Any) -> "PermissionRequestResult": + def from_dict(obj: Any) -> 'PermissionRequestResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionRequestResult(success) @@ -3440,14 +3095,12 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionRulesSet: """If specified, replaces the session's approved/denied permission rules. Omit to leave the current rules unchanged. """ - approved: list[PermissionRule] """Rules that auto-approve matching requests""" @@ -3455,7 +3108,7 @@ class PermissionRulesSet: """Rules that auto-deny matching requests""" @staticmethod - def from_dict(obj: Any) -> "PermissionRulesSet": + def from_dict(obj: Any) -> 'PermissionRulesSet': assert isinstance(obj, dict) approved = from_list(PermissionRule.from_dict, obj.get("approved")) denied = from_list(PermissionRule.from_dict, obj.get("denied")) @@ -3467,7 +3120,6 @@ def to_dict(self) -> dict: result["denied"] = from_list(lambda x: to_class(PermissionRule, x), self.denied) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionUrlsConfig: @@ -3475,7 +3127,6 @@ class PermissionUrlsConfig: fresh DefaultUrlManager based on these inputs. Omit to leave the current URL policy unchanged. """ - initial_allowed: list[str] | None = None """Initial list of allowed URL/domain patterns. Patterns may include path components. Ignored when `unrestricted` is true. @@ -3486,25 +3137,20 @@ class PermissionUrlsConfig: """ @staticmethod - def from_dict(obj: Any) -> "PermissionUrlsConfig": + def from_dict(obj: Any) -> 'PermissionUrlsConfig': assert isinstance(obj, dict) - initial_allowed = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("initialAllowed") - ) + initial_allowed = from_union([lambda x: from_list(from_str, x), from_none], obj.get("initialAllowed")) unrestricted = from_union([from_bool, from_none], obj.get("unrestricted")) return PermissionUrlsConfig(initial_allowed, unrestricted) def to_dict(self) -> dict: result: dict = {} if self.initial_allowed is not None: - result["initialAllowed"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.initial_allowed - ) + result["initialAllowed"] = from_union([lambda x: from_list(from_str, x), from_none], self.initial_allowed) if self.unrestricted is not None: result["unrestricted"] = from_union([from_bool, from_none], self.unrestricted) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionUrlsSetUnrestrictedModeParams: @@ -3516,7 +3162,7 @@ class PermissionUrlsSetUnrestrictedModeParams: """ @staticmethod - def from_dict(obj: Any) -> "PermissionUrlsSetUnrestrictedModeParams": + def from_dict(obj: Any) -> 'PermissionUrlsSetUnrestrictedModeParams': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) return PermissionUrlsSetUnrestrictedModeParams(enabled) @@ -3526,7 +3172,6 @@ def to_dict(self) -> dict: result["enabled"] = from_bool(self.enabled) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource: @@ -3536,7 +3181,7 @@ class PermissionsConfigureAdditionalContentExclusionPolicyRuleSource: type: str @staticmethod - def from_dict(obj: Any) -> "PermissionsConfigureAdditionalContentExclusionPolicyRuleSource": + def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicyRuleSource': assert isinstance(obj, dict) name = from_str(obj.get("name")) type = from_str(obj.get("type")) @@ -3548,17 +3193,14 @@ def to_dict(self) -> dict: result["type"] = from_str(self.type) return result - # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsConfigureAdditionalContentExclusionPolicyScope(Enum): """Allowed values for the `PermissionsConfigureAdditionalContentExclusionPolicyScope` enumeration. """ - ALL = "all" REPO = "repo" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureResult: @@ -3568,7 +3210,7 @@ class PermissionsConfigureResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsConfigureResult": + def from_dict(obj: Any) -> 'PermissionsConfigureResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsConfigureResult(success) @@ -3578,7 +3220,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsFolderTrustAddTrustedResult: @@ -3588,7 +3229,7 @@ class PermissionsFolderTrustAddTrustedResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsFolderTrustAddTrustedResult": + def from_dict(obj: Any) -> 'PermissionsFolderTrustAddTrustedResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsFolderTrustAddTrustedResult(success) @@ -3598,7 +3239,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalResult: @@ -3608,7 +3248,7 @@ class PermissionsLocationsAddToolApprovalResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalResult": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsLocationsAddToolApprovalResult(success) @@ -3618,17 +3258,14 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsModifyRulesScope(Enum): """Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. """ - LOCATION = "location" SESSION = "session" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsModifyRulesResult: @@ -3638,7 +3275,7 @@ class PermissionsModifyRulesResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsModifyRulesResult": + def from_dict(obj: Any) -> 'PermissionsModifyRulesResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsModifyRulesResult(success) @@ -3648,7 +3285,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsNotifyPromptShownResult: @@ -3658,7 +3294,7 @@ class PermissionsNotifyPromptShownResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsNotifyPromptShownResult": + def from_dict(obj: Any) -> 'PermissionsNotifyPromptShownResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsNotifyPromptShownResult(success) @@ -3668,7 +3304,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsAddResult: @@ -3678,7 +3313,7 @@ class PermissionsPathsAddResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsPathsAddResult": + def from_dict(obj: Any) -> 'PermissionsPathsAddResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsPathsAddResult(success) @@ -3688,14 +3323,12 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsListRequest: """No parameters; returns the session's allow-listed directories.""" - @staticmethod - def from_dict(obj: Any) -> "PermissionsPathsListRequest": + def from_dict(obj: Any) -> 'PermissionsPathsListRequest': assert isinstance(obj, dict) return PermissionsPathsListRequest() @@ -3703,7 +3336,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPathsUpdatePrimaryResult: @@ -3713,7 +3345,7 @@ class PermissionsPathsUpdatePrimaryResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsPathsUpdatePrimaryResult": + def from_dict(obj: Any) -> 'PermissionsPathsUpdatePrimaryResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsPathsUpdatePrimaryResult(success) @@ -3723,14 +3355,12 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsPendingRequestsRequest: """No parameters; returns currently-pending permission requests for the session.""" - @staticmethod - def from_dict(obj: Any) -> "PermissionsPendingRequestsRequest": + def from_dict(obj: Any) -> 'PermissionsPendingRequestsRequest': assert isinstance(obj, dict) return PermissionsPendingRequestsRequest() @@ -3738,14 +3368,12 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsResetSessionApprovalsRequest: """No parameters; clears all session-scoped tool permission approvals.""" - @staticmethod - def from_dict(obj: Any) -> "PermissionsResetSessionApprovalsRequest": + def from_dict(obj: Any) -> 'PermissionsResetSessionApprovalsRequest': assert isinstance(obj, dict) return PermissionsResetSessionApprovalsRequest() @@ -3753,7 +3381,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsResetSessionApprovalsResult: @@ -3763,7 +3390,7 @@ class PermissionsResetSessionApprovalsResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsResetSessionApprovalsResult": + def from_dict(obj: Any) -> 'PermissionsResetSessionApprovalsResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsResetSessionApprovalsResult(success) @@ -3773,7 +3400,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetApproveAllResult: @@ -3783,7 +3409,7 @@ class PermissionsSetApproveAllResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsSetApproveAllResult": + def from_dict(obj: Any) -> 'PermissionsSetApproveAllResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsSetApproveAllResult(success) @@ -3793,7 +3419,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredRequest: @@ -3806,7 +3431,7 @@ class PermissionsSetRequiredRequest: """ @staticmethod - def from_dict(obj: Any) -> "PermissionsSetRequiredRequest": + def from_dict(obj: Any) -> 'PermissionsSetRequiredRequest': assert isinstance(obj, dict) required = from_bool(obj.get("required")) return PermissionsSetRequiredRequest(required) @@ -3816,7 +3441,6 @@ def to_dict(self) -> dict: result["required"] = from_bool(self.required) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetRequiredResult: @@ -3826,7 +3450,7 @@ class PermissionsSetRequiredResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsSetRequiredResult": + def from_dict(obj: Any) -> 'PermissionsSetRequiredResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsSetRequiredResult(success) @@ -3836,7 +3460,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsUrlsSetUnrestrictedModeResult: @@ -3846,7 +3469,7 @@ class PermissionsUrlsSetUnrestrictedModeResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "PermissionsUrlsSetUnrestrictedModeResult": + def from_dict(obj: Any) -> 'PermissionsUrlsSetUnrestrictedModeResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return PermissionsUrlsSetUnrestrictedModeResult(success) @@ -3856,7 +3479,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - @dataclass class PingRequest: """Optional message to echo back to the caller.""" @@ -3865,7 +3487,7 @@ class PingRequest: """Optional message to echo back""" @staticmethod - def from_dict(obj: Any) -> "PingRequest": + def from_dict(obj: Any) -> 'PingRequest': assert isinstance(obj, dict) message = from_union([from_str, from_none], obj.get("message")) return PingRequest(message) @@ -3876,13 +3498,11 @@ def to_dict(self) -> dict: result["message"] = from_union([from_str, from_none], self.message) return result - @dataclass class PingResult: """Server liveness response, including the echoed message, current server timestamp, and protocol version. """ - message: str """Echoed message (or default greeting)""" @@ -3893,7 +3513,7 @@ class PingResult: """ISO 8601 timestamp when the server handled the ping""" @staticmethod - def from_dict(obj: Any) -> "PingResult": + def from_dict(obj: Any) -> 'PingResult': assert isinstance(obj, dict) message = from_str(obj.get("message")) protocol_version = from_int(obj.get("protocolVersion")) @@ -3907,7 +3527,6 @@ def to_dict(self) -> dict: result["timestamp"] = self.timestamp.isoformat() return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanReadResult: @@ -3923,7 +3542,7 @@ class PlanReadResult: """Absolute file path of the plan file, or null if workspace is not enabled""" @staticmethod - def from_dict(obj: Any) -> "PlanReadResult": + def from_dict(obj: Any) -> 'PlanReadResult': assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) content = from_union([from_none, from_str], obj.get("content")) @@ -3937,7 +3556,6 @@ def to_dict(self) -> dict: result["path"] = from_union([from_none, from_str], self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PlanUpdateRequest: @@ -3947,7 +3565,7 @@ class PlanUpdateRequest: """The new content for the plan file""" @staticmethod - def from_dict(obj: Any) -> "PlanUpdateRequest": + def from_dict(obj: Any) -> 'PlanUpdateRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) return PlanUpdateRequest(content) @@ -3957,7 +3575,6 @@ def to_dict(self) -> dict: result["content"] = from_str(self.content) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Plugin: @@ -3976,7 +3593,7 @@ class Plugin: """Installed version""" @staticmethod - def from_dict(obj: Any) -> "Plugin": + def from_dict(obj: Any) -> 'Plugin': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) marketplace = from_str(obj.get("marketplace")) @@ -3993,7 +3610,6 @@ def to_dict(self) -> dict: result["version"] = from_union([from_str, from_none], self.version) return result - # Experimental: this type is part of an experimental API and may change or be removed. class QueuePendingItemsKind(Enum): """Whether this item is a queued user message or a queued slash command / model change""" @@ -4001,7 +3617,6 @@ class QueuePendingItemsKind(Enum): COMMAND = "command" MESSAGE = "message" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueueRemoveMostRecentResult: @@ -4013,7 +3628,7 @@ class QueueRemoveMostRecentResult: """ @staticmethod - def from_dict(obj: Any) -> "QueueRemoveMostRecentResult": + def from_dict(obj: Any) -> 'QueueRemoveMostRecentResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return QueueRemoveMostRecentResult(removed) @@ -4023,7 +3638,6 @@ def to_dict(self) -> dict: result["removed"] = from_bool(self.removed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuedCommandHandled: @@ -4038,7 +3652,7 @@ class QueuedCommandHandled: """ @staticmethod - def from_dict(obj: Any) -> "QueuedCommandHandled": + def from_dict(obj: Any) -> 'QueuedCommandHandled': assert isinstance(obj, dict) stop_processing_queue = from_union([from_bool, from_none], obj.get("stopProcessingQueue")) return QueuedCommandHandled(stop_processing_queue) @@ -4047,12 +3661,9 @@ def to_dict(self) -> dict: result: dict = {} result["handled"] = self.handled if self.stop_processing_queue is not None: - result["stopProcessingQueue"] = from_union( - [from_bool, from_none], self.stop_processing_queue - ) + result["stopProcessingQueue"] = from_union([from_bool, from_none], self.stop_processing_queue) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuedCommandNotHandled: @@ -4064,7 +3675,7 @@ class QueuedCommandNotHandled: """ @staticmethod - def from_dict(obj: Any) -> "QueuedCommandNotHandled": + def from_dict(obj: Any) -> 'QueuedCommandNotHandled': assert isinstance(obj, dict) return QueuedCommandNotHandled() @@ -4073,7 +3684,6 @@ def to_dict(self) -> dict: result["handled"] = self.handled return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RegisterEventInterestParams: @@ -4096,7 +3706,7 @@ class RegisterEventInterestParams: """ @staticmethod - def from_dict(obj: Any) -> "RegisterEventInterestParams": + def from_dict(obj: Any) -> 'RegisterEventInterestParams': assert isinstance(obj, dict) event_type = from_str(obj.get("eventType")) return RegisterEventInterestParams(event_type) @@ -4106,7 +3716,6 @@ def to_dict(self) -> dict: result["eventType"] = from_str(self.event_type) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RegisterEventInterestResult: @@ -4119,7 +3728,7 @@ class RegisterEventInterestResult: """ @staticmethod - def from_dict(obj: Any) -> "RegisterEventInterestResult": + def from_dict(obj: Any) -> 'RegisterEventInterestResult': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return RegisterEventInterestResult(handle) @@ -4129,7 +3738,6 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ReleaseEventInterestParams: @@ -4143,7 +3751,7 @@ class ReleaseEventInterestParams: """ @staticmethod - def from_dict(obj: Any) -> "ReleaseEventInterestParams": + def from_dict(obj: Any) -> 'ReleaseEventInterestParams': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return ReleaseEventInterestParams(handle) @@ -4153,18 +3761,15 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result - # Experimental: this type is part of an experimental API and may change or be removed. class RemoteSessionMode(Enum): """Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. """ - EXPORT = "export" OFF = "off" ON = "on" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteEnableResult: @@ -4177,7 +3782,7 @@ class RemoteEnableResult: """GitHub frontend URL for this session""" @staticmethod - def from_dict(obj: Any) -> "RemoteEnableResult": + def from_dict(obj: Any) -> 'RemoteEnableResult': assert isinstance(obj, dict) remote_steerable = from_bool(obj.get("remoteSteerable")) url = from_union([from_str, from_none], obj.get("url")) @@ -4190,7 +3795,6 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteNotifySteerableChangedRequest: @@ -4203,7 +3807,7 @@ class RemoteNotifySteerableChangedRequest: """ @staticmethod - def from_dict(obj: Any) -> "RemoteNotifySteerableChangedRequest": + def from_dict(obj: Any) -> 'RemoteNotifySteerableChangedRequest': assert isinstance(obj, dict) remote_steerable = from_bool(obj.get("remoteSteerable")) return RemoteNotifySteerableChangedRequest(remote_steerable) @@ -4213,7 +3817,6 @@ def to_dict(self) -> dict: result["remoteSteerable"] = from_bool(self.remote_steerable) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteNotifySteerableChangedResult: @@ -4221,9 +3824,8 @@ class RemoteNotifySteerableChangedResult: host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own. """ - @staticmethod - def from_dict(obj: Any) -> "RemoteNotifySteerableChangedResult": + def from_dict(obj: Any) -> 'RemoteNotifySteerableChangedResult': assert isinstance(obj, dict) return RemoteNotifySteerableChangedResult() @@ -4231,7 +3833,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleEntry: @@ -4239,7 +3840,6 @@ class ScheduleEntry: The removed entry, or omitted if no entry matched. """ - id: int """Sequential id assigned by the runtime within the session. Stable across resumes (rebuilt from the event log). @@ -4262,7 +3862,7 @@ class ScheduleEntry: """ @staticmethod - def from_dict(obj: Any) -> "ScheduleEntry": + def from_dict(obj: Any) -> 'ScheduleEntry': assert isinstance(obj, dict) id = from_int(obj.get("id")) interval_ms = from_int(obj.get("intervalMs")) @@ -4283,7 +3883,6 @@ def to_dict(self) -> dict: result["displayPrompt"] = from_union([from_str, from_none], self.display_prompt) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleStopRequest: @@ -4293,7 +3892,7 @@ class ScheduleStopRequest: """Id of the scheduled prompt to remove.""" @staticmethod - def from_dict(obj: Any) -> "ScheduleStopRequest": + def from_dict(obj: Any) -> 'ScheduleStopRequest': assert isinstance(obj, dict) id = from_int(obj.get("id")) return ScheduleStopRequest(id) @@ -4303,7 +3902,6 @@ def to_dict(self) -> dict: result["id"] = from_int(self.id) return result - @dataclass class SecretsAddFilterValuesRequest: """Secret values to add to the redaction filter.""" @@ -4312,7 +3910,7 @@ class SecretsAddFilterValuesRequest: """Raw secret values to register for redaction""" @staticmethod - def from_dict(obj: Any) -> "SecretsAddFilterValuesRequest": + def from_dict(obj: Any) -> 'SecretsAddFilterValuesRequest': assert isinstance(obj, dict) values = from_list(from_str, obj.get("values")) return SecretsAddFilterValuesRequest(values) @@ -4322,7 +3920,6 @@ def to_dict(self) -> dict: result["values"] = from_list(from_str, self.values) return result - @dataclass class SecretsAddFilterValuesResult: """Confirmation that the secret values were registered.""" @@ -4331,7 +3928,7 @@ class SecretsAddFilterValuesResult: """Whether the values were successfully registered""" @staticmethod - def from_dict(obj: Any) -> "SecretsAddFilterValuesResult": + def from_dict(obj: Any) -> 'SecretsAddFilterValuesResult': assert isinstance(obj, dict) ok = from_bool(obj.get("ok")) return SecretsAddFilterValuesResult(ok) @@ -4341,19 +3938,16 @@ def to_dict(self) -> dict: result["ok"] = from_bool(self.ok) return result - # Experimental: this type is part of an experimental API and may change or be removed. class SendAgentMode(Enum): """The UI mode the agent was in when this message was sent. Defaults to the session's current mode. """ - AUTOPILOT = "autopilot" INTERACTIVE = "interactive" PLAN = "plan" SHELL = "shell" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentFileLineRange: @@ -4366,7 +3960,7 @@ class SendAttachmentFileLineRange: """Start line number (1-based)""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentFileLineRange": + def from_dict(obj: Any) -> 'SendAttachmentFileLineRange': assert isinstance(obj, dict) end = from_int(obj.get("end")) start = from_int(obj.get("start")) @@ -4378,7 +3972,6 @@ def to_dict(self) -> dict: result["start"] = from_int(self.start) return result - class SendAttachmentGithubReferenceTypeEnum(Enum): """Type of GitHub reference""" @@ -4386,7 +3979,6 @@ class SendAttachmentGithubReferenceTypeEnum(Enum): ISSUE = "issue" PR = "pr" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelectionDetailsEnd: @@ -4399,7 +3991,7 @@ class SendAttachmentSelectionDetailsEnd: """End line number (0-based)""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentSelectionDetailsEnd": + def from_dict(obj: Any) -> 'SendAttachmentSelectionDetailsEnd': assert isinstance(obj, dict) character = from_int(obj.get("character")) line = from_int(obj.get("line")) @@ -4411,7 +4003,6 @@ def to_dict(self) -> dict: result["line"] = from_int(self.line) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelectionDetailsStart: @@ -4424,7 +4015,7 @@ class SendAttachmentSelectionDetailsStart: """Start line number (0-based)""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentSelectionDetailsStart": + def from_dict(obj: Any) -> 'SendAttachmentSelectionDetailsStart': assert isinstance(obj, dict) character = from_int(obj.get("character")) line = from_int(obj.get("line")) @@ -4436,7 +4027,6 @@ def to_dict(self) -> dict: result["line"] = from_int(self.line) return result - class SendAttachmentType(Enum): BLOB = "blob" DIRECTORY = "directory" @@ -4444,34 +4034,27 @@ class SendAttachmentType(Enum): GITHUB_REFERENCE = "github_reference" SELECTION = "selection" - class SendAttachmentBlobType(Enum): BLOB = "blob" - class SendAttachmentFileType(Enum): FILE = "file" - # Experimental: this type is part of an experimental API and may change or be removed. class SendAttachmentGithubReferenceType(Enum): GITHUB_REFERENCE = "github_reference" - class SendAttachmentSelectionType(Enum): SELECTION = "selection" - # Experimental: this type is part of an experimental API and may change or be removed. class SendMode(Enum): """How to deliver the message. `enqueue` (default) appends to the message queue. `immediate` interjects during an in-progress turn. """ - ENQUEUE = "enqueue" IMMEDIATE = "immediate" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendResult: @@ -4481,7 +4064,7 @@ class SendResult: """Unique identifier assigned to the message""" @staticmethod - def from_dict(obj: Any) -> "SendResult": + def from_dict(obj: Any) -> 'SendResult': assert isinstance(obj, dict) message_id = from_str(obj.get("messageId")) return SendResult(message_id) @@ -4491,7 +4074,6 @@ def to_dict(self) -> dict: result["messageId"] = from_str(self.message_id) return result - @dataclass class ServerSkill: """Schema for the `ServerSkill` type.""" @@ -4518,7 +4100,7 @@ class ServerSkill: """The project path this skill belongs to (only for project/inherited skills)""" @staticmethod - def from_dict(obj: Any) -> "ServerSkill": + def from_dict(obj: Any) -> 'ServerSkill': assert isinstance(obj, dict) description = from_str(obj.get("description")) enabled = from_bool(obj.get("enabled")) @@ -4542,7 +4124,6 @@ def to_dict(self) -> dict: result["projectPath"] = from_union([from_str, from_none], self.project_path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionBulkDeleteResult: @@ -4555,7 +4136,7 @@ class SessionBulkDeleteResult: """ @staticmethod - def from_dict(obj: Any) -> "SessionBulkDeleteResult": + def from_dict(obj: Any) -> 'SessionBulkDeleteResult': assert isinstance(obj, dict) freed_bytes = from_dict(from_int, obj.get("freedBytes")) return SessionBulkDeleteResult(freed_bytes) @@ -4565,13 +4146,12 @@ def to_dict(self) -> dict: result["freedBytes"] = from_dict(from_int, self.freed_bytes) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSAppendFileRequest: """File path, content to append, and optional mode for the client-provided session filesystem. """ - content: str """Content to append""" @@ -4585,7 +4165,7 @@ class SessionFSAppendFileRequest: """Optional POSIX-style mode for newly created files""" @staticmethod - def from_dict(obj: Any) -> "SessionFSAppendFileRequest": + def from_dict(obj: Any) -> 'SessionFSAppendFileRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) @@ -4602,14 +4182,14 @@ def to_dict(self) -> dict: result["mode"] = from_union([from_int, from_none], self.mode) return result - +# Experimental: this type is part of an experimental API and may change or be removed. class SessionFSErrorCode(Enum): """Error classification""" ENOENT = "ENOENT" UNKNOWN = "UNKNOWN" - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSExistsRequest: """Path to test for existence in the client-provided session filesystem.""" @@ -4621,7 +4201,7 @@ class SessionFSExistsRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> "SessionFSExistsRequest": + def from_dict(obj: Any) -> 'SessionFSExistsRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4633,7 +4213,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSExistsResult: """Indicates whether the requested path exists in the client-provided session filesystem.""" @@ -4642,7 +4222,7 @@ class SessionFSExistsResult: """Whether the path exists""" @staticmethod - def from_dict(obj: Any) -> "SessionFSExistsResult": + def from_dict(obj: Any) -> 'SessionFSExistsResult': assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) return SessionFSExistsResult(exists) @@ -4652,13 +4232,12 @@ def to_dict(self) -> dict: result["exists"] = from_bool(self.exists) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSMkdirRequest: """Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. """ - path: str """Path using SessionFs conventions""" @@ -4672,7 +4251,7 @@ class SessionFSMkdirRequest: """Create parent directories as needed""" @staticmethod - def from_dict(obj: Any) -> "SessionFSMkdirRequest": + def from_dict(obj: Any) -> 'SessionFSMkdirRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4690,7 +4269,7 @@ def to_dict(self) -> dict: result["recursive"] = from_union([from_bool, from_none], self.recursive) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReadFileRequest: """Path of the file to read from the client-provided session filesystem.""" @@ -4702,7 +4281,7 @@ class SessionFSReadFileRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReadFileRequest": + def from_dict(obj: Any) -> 'SessionFSReadFileRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4714,7 +4293,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirRequest: """Directory path whose entries should be listed from the client-provided session filesystem.""" @@ -4726,7 +4305,7 @@ class SessionFSReaddirRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReaddirRequest": + def from_dict(obj: Any) -> 'SessionFSReaddirRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4738,20 +4317,19 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. class SessionFSReaddirWithTypesEntryType(Enum): """Entry type""" DIRECTORY = "directory" FILE = "file" - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirWithTypesRequest: """Directory path whose entries (with type information) should be listed from the client-provided session filesystem. """ - path: str """Path using SessionFs conventions""" @@ -4759,7 +4337,7 @@ class SessionFSReaddirWithTypesRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReaddirWithTypesRequest": + def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4771,13 +4349,12 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSRenameRequest: """Source and destination paths for renaming or moving an entry in the client-provided session filesystem. """ - dest: str """Destination path using SessionFs conventions""" @@ -4788,7 +4365,7 @@ class SessionFSRenameRequest: """Source path using SessionFs conventions""" @staticmethod - def from_dict(obj: Any) -> "SessionFSRenameRequest": + def from_dict(obj: Any) -> 'SessionFSRenameRequest': assert isinstance(obj, dict) dest = from_str(obj.get("dest")) session_id = from_str(obj.get("sessionId")) @@ -4802,13 +4379,12 @@ def to_dict(self) -> dict: result["src"] = from_str(self.src) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSRmRequest: """Path to remove from the client-provided session filesystem, with options for recursive removal and force. """ - path: str """Path using SessionFs conventions""" @@ -4822,7 +4398,7 @@ class SessionFSRmRequest: """Remove directories and their contents recursively""" @staticmethod - def from_dict(obj: Any) -> "SessionFSRmRequest": + def from_dict(obj: Any) -> 'SessionFSRmRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4840,7 +4416,6 @@ def to_dict(self) -> dict: result["recursive"] = from_union([from_bool, from_none], self.recursive) return result - @dataclass class SessionFSSetProviderCapabilities: """Optional capabilities declared by the provider""" @@ -4849,7 +4424,7 @@ class SessionFSSetProviderCapabilities: """Whether the provider supports SQLite query/exists operations""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSetProviderCapabilities": + def from_dict(obj: Any) -> 'SessionFSSetProviderCapabilities': assert isinstance(obj, dict) sqlite = from_union([from_bool, from_none], obj.get("sqlite")) return SessionFSSetProviderCapabilities(sqlite) @@ -4860,14 +4435,12 @@ def to_dict(self) -> dict: result["sqlite"] = from_union([from_bool, from_none], self.sqlite) return result - class SessionFSSetProviderConventions(Enum): """Path conventions used by this filesystem""" POSIX = "posix" WINDOWS = "windows" - @dataclass class SessionFSSetProviderResult: """Indicates whether the calling client was registered as the session filesystem provider.""" @@ -4876,7 +4449,7 @@ class SessionFSSetProviderResult: """Whether the provider was set successfully""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSetProviderResult": + def from_dict(obj: Any) -> 'SessionFSSetProviderResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionFSSetProviderResult(success) @@ -4886,7 +4459,7 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteExistsRequest: """Identifies the target session.""" @@ -4895,7 +4468,7 @@ class SessionFSSqliteExistsRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSqliteExistsRequest": + def from_dict(obj: Any) -> 'SessionFSSqliteExistsRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionFSSqliteExistsRequest(session_id) @@ -4905,7 +4478,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteExistsResult: """Indicates whether the per-session SQLite database already exists.""" @@ -4914,7 +4487,7 @@ class SessionFSSqliteExistsResult: """Whether the session database already exists""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSqliteExistsResult": + def from_dict(obj: Any) -> 'SessionFSSqliteExistsResult': assert isinstance(obj, dict) exists = from_bool(obj.get("exists")) return SessionFSSqliteExistsResult(exists) @@ -4924,17 +4497,16 @@ def to_dict(self) -> dict: result["exists"] = from_bool(self.exists) return result - +# Experimental: this type is part of an experimental API and may change or be removed. class SessionFSSqliteQueryType(Enum): """How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) """ - EXEC = "exec" QUERY = "query" RUN = "run" - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSStatRequest: """Path whose metadata should be returned from the client-provided session filesystem.""" @@ -4946,7 +4518,7 @@ class SessionFSStatRequest: """Target session identifier""" @staticmethod - def from_dict(obj: Any) -> "SessionFSStatRequest": + def from_dict(obj: Any) -> 'SessionFSStatRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) session_id = from_str(obj.get("sessionId")) @@ -4958,7 +4530,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSWriteFileRequest: """File path, content to write, and optional mode for the client-provided session filesystem.""" @@ -4976,7 +4548,7 @@ class SessionFSWriteFileRequest: """Optional POSIX-style mode for newly created files""" @staticmethod - def from_dict(obj: Any) -> "SessionFSWriteFileRequest": + def from_dict(obj: Any) -> 'SessionFSWriteFileRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) @@ -4993,7 +4565,6 @@ def to_dict(self) -> dict: result["mode"] = from_union([from_int, from_none], self.mode) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionListFilter: @@ -5012,7 +4583,7 @@ class SessionListFilter: """Match sessions whose context.repository equals this value""" @staticmethod - def from_dict(obj: Any) -> "SessionListFilter": + def from_dict(obj: Any) -> 'SessionListFilter': assert isinstance(obj, dict) branch = from_union([from_str, from_none], obj.get("branch")) cwd = from_union([from_str, from_none], obj.get("cwd")) @@ -5032,7 +4603,6 @@ def to_dict(self) -> dict: result["repository"] = from_union([from_str, from_none], self.repository) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionLoadDeferredRepoHooksResult: @@ -5048,7 +4618,7 @@ class SessionLoadDeferredRepoHooksResult: """ @staticmethod - def from_dict(obj: Any) -> "SessionLoadDeferredRepoHooksResult": + def from_dict(obj: Any) -> 'SessionLoadDeferredRepoHooksResult': assert isinstance(obj, dict) hook_count = from_int(obj.get("hookCount")) startup_prompts = from_list(from_str, obj.get("startupPrompts")) @@ -5060,14 +4630,12 @@ def to_dict(self) -> dict: result["startupPrompts"] = from_list(from_str, self.startup_prompts) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionPruneResult: """Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag. """ - candidates: list[str] """Session IDs that would be deleted in dry-run mode (always empty otherwise)""" @@ -5084,7 +4652,7 @@ class SessionPruneResult: """Session IDs that were skipped (e.g., named sessions)""" @staticmethod - def from_dict(obj: Any) -> "SessionPruneResult": + def from_dict(obj: Any) -> 'SessionPruneResult': assert isinstance(obj, dict) candidates = from_list(from_str, obj.get("candidates")) deleted = from_list(from_str, obj.get("deleted")) @@ -5102,7 +4670,6 @@ def to_dict(self) -> dict: result["skipped"] = from_list(from_str, self.skipped) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSetCredentialsParams: @@ -5117,7 +4684,7 @@ class SessionSetCredentialsParams: """ @staticmethod - def from_dict(obj: Any) -> "SessionSetCredentialsParams": + def from_dict(obj: Any) -> 'SessionSetCredentialsParams': assert isinstance(obj, dict) credentials = from_union([_load_AuthInfo, from_none], obj.get("credentials")) return SessionSetCredentialsParams(credentials) @@ -5125,12 +4692,9 @@ def from_dict(obj: Any) -> "SessionSetCredentialsParams": def to_dict(self) -> dict: result: dict = {} if self.credentials is not None: - result["credentials"] = from_union( - [lambda x: (x).to_dict(), from_none], self.credentials - ) + result["credentials"] = from_union([lambda x: (x).to_dict(), from_none], self.credentials) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSetCredentialsResult: @@ -5140,7 +4704,7 @@ class SessionSetCredentialsResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "SessionSetCredentialsResult": + def from_dict(obj: Any) -> 'SessionSetCredentialsResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionSetCredentialsResult(success) @@ -5150,7 +4714,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionSizes: @@ -5160,7 +4723,7 @@ class SessionSizes: """Map of sessionId -> on-disk size in bytes for the session's workspace directory""" @staticmethod - def from_dict(obj: Any) -> "SessionSizes": + def from_dict(obj: Any) -> 'SessionSizes': assert isinstance(obj, dict) sizes = from_dict(from_int, obj.get("sizes")) return SessionSizes(sizes) @@ -5170,7 +4733,6 @@ def to_dict(self) -> dict: result["sizes"] = from_dict(from_int, self.sizes) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionUpdateOptionsResult: @@ -5180,7 +4742,7 @@ class SessionUpdateOptionsResult: """Whether the operation succeeded""" @staticmethod - def from_dict(obj: Any) -> "SessionUpdateOptionsResult": + def from_dict(obj: Any) -> 'SessionUpdateOptionsResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return SessionUpdateOptionsResult(success) @@ -5190,7 +4752,6 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsBulkDeleteRequest: @@ -5200,7 +4761,7 @@ class SessionsBulkDeleteRequest: """Session IDs to close, deactivate, and delete from disk""" @staticmethod - def from_dict(obj: Any) -> "SessionsBulkDeleteRequest": + def from_dict(obj: Any) -> 'SessionsBulkDeleteRequest': assert isinstance(obj, dict) session_ids = from_list(from_str, obj.get("sessionIds")) return SessionsBulkDeleteRequest(session_ids) @@ -5210,7 +4771,6 @@ def to_dict(self) -> dict: result["sessionIds"] = from_list(from_str, self.session_ids) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCheckInUseRequest: @@ -5220,7 +4780,7 @@ class SessionsCheckInUseRequest: """Session IDs to test for live in-use locks""" @staticmethod - def from_dict(obj: Any) -> "SessionsCheckInUseRequest": + def from_dict(obj: Any) -> 'SessionsCheckInUseRequest': assert isinstance(obj, dict) session_ids = from_list(from_str, obj.get("sessionIds")) return SessionsCheckInUseRequest(session_ids) @@ -5230,7 +4790,6 @@ def to_dict(self) -> dict: result["sessionIds"] = from_list(from_str, self.session_ids) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCheckInUseResult: @@ -5242,7 +4801,7 @@ class SessionsCheckInUseResult: """ @staticmethod - def from_dict(obj: Any) -> "SessionsCheckInUseResult": + def from_dict(obj: Any) -> 'SessionsCheckInUseResult': assert isinstance(obj, dict) in_use = from_list(from_str, obj.get("inUse")) return SessionsCheckInUseResult(in_use) @@ -5252,7 +4811,6 @@ def to_dict(self) -> dict: result["inUse"] = from_list(from_str, self.in_use) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCloseRequest: @@ -5262,7 +4820,7 @@ class SessionsCloseRequest: """Session ID to close""" @staticmethod - def from_dict(obj: Any) -> "SessionsCloseRequest": + def from_dict(obj: Any) -> 'SessionsCloseRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsCloseRequest(session_id) @@ -5272,7 +4830,6 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsCloseResult: @@ -5280,9 +4837,8 @@ class SessionsCloseResult: lock, disposes the active session. Idempotent: succeeds even if the session is not currently active. """ - @staticmethod - def from_dict(obj: Any) -> "SessionsCloseResult": + def from_dict(obj: Any) -> 'SessionsCloseResult': assert isinstance(obj, dict) return SessionsCloseResult() @@ -5290,7 +4846,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByPrefixRequest: @@ -5302,7 +4857,7 @@ class SessionsFindByPrefixRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsFindByPrefixRequest": + def from_dict(obj: Any) -> 'SessionsFindByPrefixRequest': assert isinstance(obj, dict) prefix = from_str(obj.get("prefix")) return SessionsFindByPrefixRequest(prefix) @@ -5312,7 +4867,6 @@ def to_dict(self) -> dict: result["prefix"] = from_str(self.prefix) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByPrefixResult: @@ -5322,7 +4876,7 @@ class SessionsFindByPrefixResult: """Omitted when no unique session matches the prefix (no match or ambiguous)""" @staticmethod - def from_dict(obj: Any) -> "SessionsFindByPrefixResult": + def from_dict(obj: Any) -> 'SessionsFindByPrefixResult': assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsFindByPrefixResult(session_id) @@ -5333,7 +4887,6 @@ def to_dict(self) -> dict: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByTaskIDRequest: @@ -5343,7 +4896,7 @@ class SessionsFindByTaskIDRequest: """GitHub task ID to look up""" @staticmethod - def from_dict(obj: Any) -> "SessionsFindByTaskIDRequest": + def from_dict(obj: Any) -> 'SessionsFindByTaskIDRequest': assert isinstance(obj, dict) task_id = from_str(obj.get("taskId")) return SessionsFindByTaskIDRequest(task_id) @@ -5353,7 +4906,6 @@ def to_dict(self) -> dict: result["taskId"] = from_str(self.task_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsFindByTaskIDResult: @@ -5363,7 +4915,7 @@ class SessionsFindByTaskIDResult: """Omitted when no local session is bound to that GitHub task""" @staticmethod - def from_dict(obj: Any) -> "SessionsFindByTaskIDResult": + def from_dict(obj: Any) -> 'SessionsFindByTaskIDResult': assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsFindByTaskIDResult(session_id) @@ -5374,14 +4926,12 @@ def to_dict(self) -> dict: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsForkRequest: """Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session. """ - session_id: str """Source session ID to fork from""" @@ -5394,7 +4944,7 @@ class SessionsForkRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsForkRequest": + def from_dict(obj: Any) -> 'SessionsForkRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) name = from_union([from_str, from_none], obj.get("name")) @@ -5410,7 +4960,6 @@ def to_dict(self) -> dict: result["toEventId"] = from_union([from_str, from_none], self.to_event_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsForkResult: @@ -5423,7 +4972,7 @@ class SessionsForkResult: """Friendly name assigned to the forked session, if any.""" @staticmethod - def from_dict(obj: Any) -> "SessionsForkResult": + def from_dict(obj: Any) -> 'SessionsForkResult': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) name = from_union([from_str, from_none], obj.get("name")) @@ -5436,7 +4985,6 @@ def to_dict(self) -> dict: result["name"] = from_union([from_str, from_none], self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetEventFilePathRequest: @@ -5446,7 +4994,7 @@ class SessionsGetEventFilePathRequest: """Session ID whose event-log file path to compute""" @staticmethod - def from_dict(obj: Any) -> "SessionsGetEventFilePathRequest": + def from_dict(obj: Any) -> 'SessionsGetEventFilePathRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetEventFilePathRequest(session_id) @@ -5456,7 +5004,6 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetEventFilePathResult: @@ -5466,7 +5013,7 @@ class SessionsGetEventFilePathResult: """Absolute path to the session's events.jsonl file""" @staticmethod - def from_dict(obj: Any) -> "SessionsGetEventFilePathResult": + def from_dict(obj: Any) -> 'SessionsGetEventFilePathResult': assert isinstance(obj, dict) file_path = from_str(obj.get("filePath")) return SessionsGetEventFilePathResult(file_path) @@ -5476,7 +5023,6 @@ def to_dict(self) -> dict: result["filePath"] = from_str(self.file_path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetLastForContextResult: @@ -5486,7 +5032,7 @@ class SessionsGetLastForContextResult: """Most-relevant session ID for the supplied context, or omitted when no sessions exist""" @staticmethod - def from_dict(obj: Any) -> "SessionsGetLastForContextResult": + def from_dict(obj: Any) -> 'SessionsGetLastForContextResult': assert isinstance(obj, dict) session_id = from_union([from_str, from_none], obj.get("sessionId")) return SessionsGetLastForContextResult(session_id) @@ -5497,7 +5043,6 @@ def to_dict(self) -> dict: result["sessionId"] = from_union([from_str, from_none], self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetPersistedRemoteSteerableRequest: @@ -5507,7 +5052,7 @@ class SessionsGetPersistedRemoteSteerableRequest: """Session ID to look up the persisted remote-steerable flag for""" @staticmethod - def from_dict(obj: Any) -> "SessionsGetPersistedRemoteSteerableRequest": + def from_dict(obj: Any) -> 'SessionsGetPersistedRemoteSteerableRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsGetPersistedRemoteSteerableRequest(session_id) @@ -5517,21 +5062,19 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetPersistedRemoteSteerableResult: """The session's persisted remote-steerable flag, or omitted when no value has been persisted. """ - remote_steerable: bool | None = None """The session's persisted remote-steerable flag if recorded; omitted when no value has been persisted """ @staticmethod - def from_dict(obj: Any) -> "SessionsGetPersistedRemoteSteerableResult": + def from_dict(obj: Any) -> 'SessionsGetPersistedRemoteSteerableResult': assert isinstance(obj, dict) remote_steerable = from_union([from_bool, from_none], obj.get("remoteSteerable")) return SessionsGetPersistedRemoteSteerableResult(remote_steerable) @@ -5542,7 +5085,6 @@ def to_dict(self) -> dict: result["remoteSteerable"] = from_union([from_bool, from_none], self.remote_steerable) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsLoadDeferredRepoHooksRequest: @@ -5552,7 +5094,7 @@ class SessionsLoadDeferredRepoHooksRequest: """Active session ID whose deferred repo-level hooks should be loaded""" @staticmethod - def from_dict(obj: Any) -> "SessionsLoadDeferredRepoHooksRequest": + def from_dict(obj: Any) -> 'SessionsLoadDeferredRepoHooksRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsLoadDeferredRepoHooksRequest(session_id) @@ -5562,14 +5104,12 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsPruneOldRequest: """Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true). """ - older_than_days: int """Delete sessions whose modifiedTime is at least this many days old""" @@ -5583,13 +5123,11 @@ class SessionsPruneOldRequest: """When true, named sessions (set via /rename) are also eligible for pruning""" @staticmethod - def from_dict(obj: Any) -> "SessionsPruneOldRequest": + def from_dict(obj: Any) -> 'SessionsPruneOldRequest': assert isinstance(obj, dict) older_than_days = from_int(obj.get("olderThanDays")) dry_run = from_union([from_bool, from_none], obj.get("dryRun")) - exclude_session_ids = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("excludeSessionIds") - ) + exclude_session_ids = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludeSessionIds")) include_named = from_union([from_bool, from_none], obj.get("includeNamed")) return SessionsPruneOldRequest(older_than_days, dry_run, exclude_session_ids, include_named) @@ -5599,14 +5137,11 @@ def to_dict(self) -> dict: if self.dry_run is not None: result["dryRun"] = from_union([from_bool, from_none], self.dry_run) if self.exclude_session_ids is not None: - result["excludeSessionIds"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.exclude_session_ids - ) + result["excludeSessionIds"] = from_union([lambda x: from_list(from_str, x), from_none], self.exclude_session_ids) if self.include_named is not None: result["includeNamed"] = from_union([from_bool, from_none], self.include_named) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReleaseLockRequest: @@ -5616,7 +5151,7 @@ class SessionsReleaseLockRequest: """Session ID whose in-use lock should be released""" @staticmethod - def from_dict(obj: Any) -> "SessionsReleaseLockRequest": + def from_dict(obj: Any) -> 'SessionsReleaseLockRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsReleaseLockRequest(session_id) @@ -5626,16 +5161,14 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReleaseLockResult: """Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session. """ - @staticmethod - def from_dict(obj: Any) -> "SessionsReleaseLockResult": + def from_dict(obj: Any) -> 'SessionsReleaseLockResult': assert isinstance(obj, dict) return SessionsReleaseLockResult() @@ -5643,7 +5176,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReloadPluginHooksRequest: @@ -5658,7 +5190,7 @@ class SessionsReloadPluginHooksRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsReloadPluginHooksRequest": + def from_dict(obj: Any) -> 'SessionsReloadPluginHooksRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) defer_repo_hooks = from_union([from_bool, from_none], obj.get("deferRepoHooks")) @@ -5671,7 +5203,6 @@ def to_dict(self) -> dict: result["deferRepoHooks"] = from_union([from_bool, from_none], self.defer_repo_hooks) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsReloadPluginHooksResult: @@ -5679,9 +5210,8 @@ class SessionsReloadPluginHooksResult: Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId. """ - @staticmethod - def from_dict(obj: Any) -> "SessionsReloadPluginHooksResult": + def from_dict(obj: Any) -> 'SessionsReloadPluginHooksResult': assert isinstance(obj, dict) return SessionsReloadPluginHooksResult() @@ -5689,7 +5219,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSaveRequest: @@ -5699,7 +5228,7 @@ class SessionsSaveRequest: """Session ID whose pending events should be flushed to disk""" @staticmethod - def from_dict(obj: Any) -> "SessionsSaveRequest": + def from_dict(obj: Any) -> 'SessionsSaveRequest': assert isinstance(obj, dict) session_id = from_str(obj.get("sessionId")) return SessionsSaveRequest(session_id) @@ -5709,16 +5238,14 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSaveResult: """Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed). """ - @staticmethod - def from_dict(obj: Any) -> "SessionsSaveResult": + def from_dict(obj: Any) -> 'SessionsSaveResult': assert isinstance(obj, dict) return SessionsSaveResult() @@ -5726,7 +5253,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetAdditionalPluginsResult: @@ -5734,9 +5260,8 @@ class SessionsSetAdditionalPluginsResult: reloads see the new set; already-running sessions keep their existing hook installation until the next reload. """ - @staticmethod - def from_dict(obj: Any) -> "SessionsSetAdditionalPluginsResult": + def from_dict(obj: Any) -> 'SessionsSetAdditionalPluginsResult': assert isinstance(obj, dict) return SessionsSetAdditionalPluginsResult() @@ -5744,7 +5269,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecRequest: @@ -5760,7 +5284,7 @@ class ShellExecRequest: """Timeout in milliseconds (default: 30000)""" @staticmethod - def from_dict(obj: Any) -> "ShellExecRequest": + def from_dict(obj: Any) -> 'ShellExecRequest': assert isinstance(obj, dict) command = from_str(obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) @@ -5776,19 +5300,17 @@ def to_dict(self) -> dict: result["timeout"] = from_union([from_int, from_none], self.timeout) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellExecResult: """Identifier of the spawned process, used to correlate streamed output and exit notifications. """ - process_id: str """Unique identifier for tracking streamed output""" @staticmethod - def from_dict(obj: Any) -> "ShellExecResult": + def from_dict(obj: Any) -> 'ShellExecResult': assert isinstance(obj, dict) process_id = from_str(obj.get("processId")) return ShellExecResult(process_id) @@ -5798,7 +5320,6 @@ def to_dict(self) -> dict: result["processId"] = from_str(self.process_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. class ShellKillSignal(Enum): """Signal to send (default: SIGTERM)""" @@ -5807,19 +5328,17 @@ class ShellKillSignal(Enum): SIGKILL = "SIGKILL" SIGTERM = "SIGTERM" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellKillResult: """Indicates whether the signal was delivered; false if the process was unknown or already exited. """ - killed: bool """Whether the signal was sent successfully""" @staticmethod - def from_dict(obj: Any) -> "ShellKillResult": + def from_dict(obj: Any) -> 'ShellKillResult': assert isinstance(obj, dict) killed = from_bool(obj.get("killed")) return ShellKillResult(killed) @@ -5829,7 +5348,6 @@ def to_dict(self) -> dict: result["killed"] = from_bool(self.killed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShutdownRequest: @@ -5843,7 +5361,7 @@ class ShutdownRequest: """Why the session is being shut down. Defaults to "routine" when omitted.""" @staticmethod - def from_dict(obj: Any) -> "ShutdownRequest": + def from_dict(obj: Any) -> 'ShutdownRequest': assert isinstance(obj, dict) reason = from_union([from_str, from_none], obj.get("reason")) type = from_union([ShutdownType, from_none], obj.get("type")) @@ -5857,7 +5375,6 @@ def to_dict(self) -> dict: result["type"] = from_union([lambda x: to_enum(ShutdownType, x), from_none], self.type) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Skill: @@ -5885,7 +5402,7 @@ class Skill: """Name of the plugin that provides the skill, when source is 'plugin'""" @staticmethod - def from_dict(obj: Any) -> "Skill": + def from_dict(obj: Any) -> 'Skill': assert isinstance(obj, dict) description = from_str(obj.get("description")) enabled = from_bool(obj.get("enabled")) @@ -5909,7 +5426,6 @@ def to_dict(self) -> dict: result["pluginName"] = from_union([from_str, from_none], self.plugin_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsDisableRequest: @@ -5919,7 +5435,7 @@ class SkillsDisableRequest: """Name of the skill to disable""" @staticmethod - def from_dict(obj: Any) -> "SkillsDisableRequest": + def from_dict(obj: Any) -> 'SkillsDisableRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return SkillsDisableRequest(name) @@ -5929,7 +5445,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - @dataclass class SkillsDiscoverRequest: """Optional project paths and additional skill directories to include in discovery.""" @@ -5941,29 +5456,20 @@ class SkillsDiscoverRequest: """Optional list of additional skill directory paths to include""" @staticmethod - def from_dict(obj: Any) -> "SkillsDiscoverRequest": + def from_dict(obj: Any) -> 'SkillsDiscoverRequest': assert isinstance(obj, dict) - project_paths = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("projectPaths") - ) - skill_directories = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories") - ) + project_paths = from_union([lambda x: from_list(from_str, x), from_none], obj.get("projectPaths")) + skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) return SkillsDiscoverRequest(project_paths, skill_directories) def to_dict(self) -> dict: result: dict = {} if self.project_paths is not None: - result["projectPaths"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.project_paths - ) + result["projectPaths"] = from_union([lambda x: from_list(from_str, x), from_none], self.project_paths) if self.skill_directories is not None: - result["skillDirectories"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.skill_directories - ) + result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsEnableRequest: @@ -5973,7 +5479,7 @@ class SkillsEnableRequest: """Name of the skill to enable""" @staticmethod - def from_dict(obj: Any) -> "SkillsEnableRequest": + def from_dict(obj: Any) -> 'SkillsEnableRequest': assert isinstance(obj, dict) name = from_str(obj.get("name")) return SkillsEnableRequest(name) @@ -5983,7 +5489,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsInvokedSkill: @@ -6005,15 +5510,13 @@ class SkillsInvokedSkill: """Tools that should be auto-approved when this skill is active, captured at invocation time""" @staticmethod - def from_dict(obj: Any) -> "SkillsInvokedSkill": + def from_dict(obj: Any) -> 'SkillsInvokedSkill': assert isinstance(obj, dict) content = from_str(obj.get("content")) invoked_at_turn = from_int(obj.get("invokedAtTurn")) name = from_str(obj.get("name")) path = from_str(obj.get("path")) - allowed_tools = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("allowedTools") - ) + allowed_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("allowedTools")) return SkillsInvokedSkill(content, invoked_at_turn, name, path, allowed_tools) def to_dict(self) -> dict: @@ -6023,12 +5526,9 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) result["path"] = from_str(self.path) if self.allowed_tools is not None: - result["allowedTools"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.allowed_tools - ) + result["allowedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.allowed_tools) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsLoadDiagnostics: @@ -6041,7 +5541,7 @@ class SkillsLoadDiagnostics: """Warnings emitted while loading skills (e.g. skills that loaded but had issues)""" @staticmethod - def from_dict(obj: Any) -> "SkillsLoadDiagnostics": + def from_dict(obj: Any) -> 'SkillsLoadDiagnostics': assert isinstance(obj, dict) errors = from_list(from_str, obj.get("errors")) warnings = from_list(from_str, obj.get("warnings")) @@ -6053,22 +5553,18 @@ def to_dict(self) -> dict: result["warnings"] = from_list(from_str, self.warnings) return result - class SlashCommandAgentPromptResultKind(Enum): AGENT_PROMPT = "agent-prompt" - class SlashCommandCompletedResultKind(Enum): COMPLETED = "completed" - class SlashCommandInvocationResultKind(Enum): AGENT_PROMPT = "agent-prompt" COMPLETED = "completed" SELECT_SUBCOMMAND = "select-subcommand" TEXT = "text" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandSelectSubcommandOption: @@ -6084,7 +5580,7 @@ class SlashCommandSelectSubcommandOption: """Optional group label for organizing options""" @staticmethod - def from_dict(obj: Any) -> "SlashCommandSelectSubcommandOption": + def from_dict(obj: Any) -> 'SlashCommandSelectSubcommandOption': assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) @@ -6099,11 +5595,9 @@ def to_dict(self) -> dict: result["group"] = from_union([from_str, from_none], self.group) return result - class SlashCommandSelectSubcommandResultKind(Enum): SELECT_SUBCOMMAND = "select-subcommand" - # Experimental: this type is part of an experimental API and may change or be removed. class TaskExecutionMode(Enum): """Whether task execution is synchronously awaited or managed in the background""" @@ -6111,7 +5605,6 @@ class TaskExecutionMode(Enum): BACKGROUND = "background" SYNC = "sync" - # Experimental: this type is part of an experimental API and may change or be removed. class TaskStatus(Enum): """Current lifecycle status of the task""" @@ -6122,11 +5615,9 @@ class TaskStatus(Enum): IDLE = "idle" RUNNING = "running" - class TaskAgentInfoType(Enum): AGENT = "agent" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskProgressLine: @@ -6139,7 +5630,7 @@ class TaskProgressLine: """ISO 8601 timestamp when this event occurred""" @staticmethod - def from_dict(obj: Any) -> "TaskProgressLine": + def from_dict(obj: Any) -> 'TaskProgressLine': assert isinstance(obj, dict) message = from_str(obj.get("message")) timestamp = from_datetime(obj.get("timestamp")) @@ -6151,22 +5642,18 @@ def to_dict(self) -> dict: result["timestamp"] = self.timestamp.isoformat() return result - # Experimental: this type is part of an experimental API and may change or be removed. class TaskShellInfoAttachmentMode(Enum): """Whether the shell runs inside a managed PTY session or as an independent background process """ - ATTACHED = "attached" DETACHED = "detached" - class TaskInfoType(Enum): AGENT = "agent" SHELL = "shell" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskList: @@ -6176,7 +5663,7 @@ class TaskList: """Currently tracked tasks""" @staticmethod - def from_dict(obj: Any) -> "TaskList": + def from_dict(obj: Any) -> 'TaskList': assert isinstance(obj, dict) tasks = from_list(_load_TaskInfo, obj.get("tasks")) return TaskList(tasks) @@ -6186,11 +5673,9 @@ def to_dict(self) -> dict: result["tasks"] = from_list(lambda x: (x).to_dict(), self.tasks) return result - class TaskShellInfoType(Enum): SHELL = "shell" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksCancelRequest: @@ -6200,7 +5685,7 @@ class TasksCancelRequest: """Task identifier""" @staticmethod - def from_dict(obj: Any) -> "TasksCancelRequest": + def from_dict(obj: Any) -> 'TasksCancelRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksCancelRequest(id) @@ -6210,7 +5695,6 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksCancelResult: @@ -6220,7 +5704,7 @@ class TasksCancelResult: """Whether the task was successfully cancelled""" @staticmethod - def from_dict(obj: Any) -> "TasksCancelResult": + def from_dict(obj: Any) -> 'TasksCancelResult': assert isinstance(obj, dict) cancelled = from_bool(obj.get("cancelled")) return TasksCancelResult(cancelled) @@ -6230,7 +5714,6 @@ def to_dict(self) -> dict: result["cancelled"] = from_bool(self.cancelled) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetCurrentPromotableResult: @@ -6243,7 +5726,7 @@ class TasksGetCurrentPromotableResult: """ @staticmethod - def from_dict(obj: Any) -> "TasksGetCurrentPromotableResult": + def from_dict(obj: Any) -> 'TasksGetCurrentPromotableResult': assert isinstance(obj, dict) task = from_union([_load_TaskInfo, from_none], obj.get("task")) return TasksGetCurrentPromotableResult(task) @@ -6254,7 +5737,6 @@ def to_dict(self) -> dict: result["task"] = from_union([lambda x: (x).to_dict(), from_none], self.task) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetProgressRequest: @@ -6264,7 +5746,7 @@ class TasksGetProgressRequest: """Task identifier (agent ID or shell ID)""" @staticmethod - def from_dict(obj: Any) -> "TasksGetProgressRequest": + def from_dict(obj: Any) -> 'TasksGetProgressRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksGetProgressRequest(id) @@ -6274,14 +5756,12 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteCurrentToBackgroundResult: """The promoted task as it now exists in background mode, omitted if no promotable task was waiting. """ - task: TaskInfo | None = None """The promoted task as it now exists in background mode, omitted if no promotable task was waiting. Atomic operation: avoids the race window of getCurrentPromotable + @@ -6289,7 +5769,7 @@ class TasksPromoteCurrentToBackgroundResult: """ @staticmethod - def from_dict(obj: Any) -> "TasksPromoteCurrentToBackgroundResult": + def from_dict(obj: Any) -> 'TasksPromoteCurrentToBackgroundResult': assert isinstance(obj, dict) task = from_union([_load_TaskInfo, from_none], obj.get("task")) return TasksPromoteCurrentToBackgroundResult(task) @@ -6300,7 +5780,6 @@ def to_dict(self) -> dict: result["task"] = from_union([lambda x: (x).to_dict(), from_none], self.task) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteToBackgroundRequest: @@ -6310,7 +5789,7 @@ class TasksPromoteToBackgroundRequest: """Task identifier""" @staticmethod - def from_dict(obj: Any) -> "TasksPromoteToBackgroundRequest": + def from_dict(obj: Any) -> 'TasksPromoteToBackgroundRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksPromoteToBackgroundRequest(id) @@ -6320,7 +5799,6 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksPromoteToBackgroundResult: @@ -6330,7 +5808,7 @@ class TasksPromoteToBackgroundResult: """Whether the task was successfully promoted to background mode""" @staticmethod - def from_dict(obj: Any) -> "TasksPromoteToBackgroundResult": + def from_dict(obj: Any) -> 'TasksPromoteToBackgroundResult': assert isinstance(obj, dict) promoted = from_bool(obj.get("promoted")) return TasksPromoteToBackgroundResult(promoted) @@ -6340,16 +5818,14 @@ def to_dict(self) -> dict: result["promoted"] = from_bool(self.promoted) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRefreshResult: """Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop. """ - @staticmethod - def from_dict(obj: Any) -> "TasksRefreshResult": + def from_dict(obj: Any) -> 'TasksRefreshResult': assert isinstance(obj, dict) return TasksRefreshResult() @@ -6357,7 +5833,6 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRemoveRequest: @@ -6367,7 +5842,7 @@ class TasksRemoveRequest: """Task identifier""" @staticmethod - def from_dict(obj: Any) -> "TasksRemoveRequest": + def from_dict(obj: Any) -> 'TasksRemoveRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) return TasksRemoveRequest(id) @@ -6377,21 +5852,19 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksRemoveResult: """Indicates whether the task was removed. False when the task does not exist or is still running/idle. """ - removed: bool """Whether the task was removed. Returns false if the task does not exist or is still running/idle (cancel it first). """ @staticmethod - def from_dict(obj: Any) -> "TasksRemoveResult": + def from_dict(obj: Any) -> 'TasksRemoveResult': assert isinstance(obj, dict) removed = from_bool(obj.get("removed")) return TasksRemoveResult(removed) @@ -6401,7 +5874,6 @@ def to_dict(self) -> dict: result["removed"] = from_bool(self.removed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksSendMessageRequest: @@ -6417,7 +5889,7 @@ class TasksSendMessageRequest: """Agent ID of the sender, if sent on behalf of another agent""" @staticmethod - def from_dict(obj: Any) -> "TasksSendMessageRequest": + def from_dict(obj: Any) -> 'TasksSendMessageRequest': assert isinstance(obj, dict) id = from_str(obj.get("id")) message = from_str(obj.get("message")) @@ -6432,7 +5904,6 @@ def to_dict(self) -> dict: result["fromAgentId"] = from_union([from_str, from_none], self.from_agent_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksSendMessageResult: @@ -6445,7 +5916,7 @@ class TasksSendMessageResult: """Error message if delivery failed""" @staticmethod - def from_dict(obj: Any) -> "TasksSendMessageResult": + def from_dict(obj: Any) -> 'TasksSendMessageResult': assert isinstance(obj, dict) sent = from_bool(obj.get("sent")) error = from_union([from_str, from_none], obj.get("error")) @@ -6458,7 +5929,6 @@ def to_dict(self) -> dict: result["error"] = from_union([from_str, from_none], self.error) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksStartAgentRequest: @@ -6480,7 +5950,7 @@ class TasksStartAgentRequest: """Optional model override""" @staticmethod - def from_dict(obj: Any) -> "TasksStartAgentRequest": + def from_dict(obj: Any) -> 'TasksStartAgentRequest': assert isinstance(obj, dict) agent_type = from_str(obj.get("agentType")) name = from_str(obj.get("name")) @@ -6500,7 +5970,6 @@ def to_dict(self) -> dict: result["model"] = from_union([from_str, from_none], self.model) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksStartAgentResult: @@ -6510,7 +5979,7 @@ class TasksStartAgentResult: """Generated agent ID for the background task""" @staticmethod - def from_dict(obj: Any) -> "TasksStartAgentResult": + def from_dict(obj: Any) -> 'TasksStartAgentResult': assert isinstance(obj, dict) agent_id = from_str(obj.get("agentId")) return TasksStartAgentResult(agent_id) @@ -6520,7 +5989,6 @@ def to_dict(self) -> dict: result["agentId"] = from_str(self.agent_id) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksWaitForPendingResult: @@ -6529,9 +5997,8 @@ class TasksWaitForPendingResult: after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS). """ - @staticmethod - def from_dict(obj: Any) -> "TasksWaitForPendingResult": + def from_dict(obj: Any) -> 'TasksWaitForPendingResult': assert isinstance(obj, dict) return TasksWaitForPendingResult() @@ -6539,21 +6006,19 @@ def to_dict(self) -> dict: result: dict = {} return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TelemetrySetFeatureOverridesRequest: """Feature override key/value pairs to attach to subsequent telemetry events from this session. """ - features: dict[str, str] """Override key/value pairs to attach to subsequent telemetry events from this session. Replaces any previously-set overrides. """ @staticmethod - def from_dict(obj: Any) -> "TelemetrySetFeatureOverridesRequest": + def from_dict(obj: Any) -> 'TelemetrySetFeatureOverridesRequest': assert isinstance(obj, dict) features = from_dict(from_str, obj.get("features")) return TelemetrySetFeatureOverridesRequest(features) @@ -6563,11 +6028,9 @@ def to_dict(self) -> dict: result["features"] = from_dict(from_str, self.features) return result - class TokenAuthInfoType(Enum): TOKEN = "token" - @dataclass class Tool: """Schema for the `Tool` type.""" @@ -6589,15 +6052,13 @@ class Tool: """JSON Schema for the tool's input parameters""" @staticmethod - def from_dict(obj: Any) -> "Tool": + def from_dict(obj: Any) -> 'Tool': assert isinstance(obj, dict) description = from_str(obj.get("description")) name = from_str(obj.get("name")) instructions = from_union([from_str, from_none], obj.get("instructions")) namespaced_name = from_union([from_str, from_none], obj.get("namespacedName")) - parameters = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], obj.get("parameters") - ) + parameters = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("parameters")) return Tool(description, name, instructions, namespaced_name, parameters) def to_dict(self) -> dict: @@ -6609,12 +6070,9 @@ def to_dict(self) -> dict: if self.namespaced_name is not None: result["namespacedName"] = from_union([from_str, from_none], self.namespaced_name) if self.parameters is not None: - result["parameters"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.parameters - ) + result["parameters"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.parameters) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ToolsInitializeAndValidateResult: @@ -6622,9 +6080,8 @@ class ToolsInitializeAndValidateResult: and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation. """ - @staticmethod - def from_dict(obj: Any) -> "ToolsInitializeAndValidateResult": + def from_dict(obj: Any) -> 'ToolsInitializeAndValidateResult': assert isinstance(obj, dict) return ToolsInitializeAndValidateResult() @@ -6632,7 +6089,6 @@ def to_dict(self) -> dict: result: dict = {} return result - @dataclass class ToolsListRequest: """Optional model identifier whose tool overrides should be applied to the listing.""" @@ -6643,7 +6099,7 @@ class ToolsListRequest: """ @staticmethod - def from_dict(obj: Any) -> "ToolsListRequest": + def from_dict(obj: Any) -> 'ToolsListRequest': assert isinstance(obj, dict) model = from_union([from_str, from_none], obj.get("model")) return ToolsListRequest(model) @@ -6654,18 +6110,15 @@ def to_dict(self) -> dict: result["model"] = from_union([from_str, from_none], self.model) return result - # Experimental: this type is part of an experimental API and may change or be removed. class UIAutoModeSwitchResponse(Enum): """User's choice for auto-mode switching: yes (allow this turn), yes_always (allow + persist as setting), or no (decline). """ - NO = "no" YES = "yes" YES_ALWAYS = "yes_always" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfFieldItemsAnyOf: @@ -6678,7 +6131,7 @@ class UIElicitationArrayAnyOfFieldItemsAnyOf: """Display label for this option.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationArrayAnyOfFieldItemsAnyOf": + def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfFieldItemsAnyOf': assert isinstance(obj, dict) const = from_str(obj.get("const")) title = from_str(obj.get("title")) @@ -6690,15 +6143,12 @@ def to_dict(self) -> dict: result["title"] = from_str(self.title) return result - class UIElicitationArrayAnyOfFieldType(Enum): ARRAY = "array" - class UIElicitationArrayEnumFieldItemsType(Enum): STRING = "string" - # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationSchemaPropertyStringFormat(Enum): """Optional format hint that constrains the accepted input.""" @@ -6708,7 +6158,6 @@ class UIElicitationSchemaPropertyStringFormat(Enum): EMAIL = "email" URI = "uri" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringOneOfFieldOneOf: @@ -6721,7 +6170,7 @@ class UIElicitationStringOneOfFieldOneOf: """Display label for this option.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationStringOneOfFieldOneOf": + def from_dict(obj: Any) -> 'UIElicitationStringOneOfFieldOneOf': assert isinstance(obj, dict) const = from_str(obj.get("const")) title = from_str(obj.get("title")) @@ -6733,7 +6182,6 @@ def to_dict(self) -> dict: result["title"] = from_str(self.title) return result - class UIElicitationSchemaPropertyType(Enum): """Numeric type accepted by the field.""" @@ -6743,11 +6191,9 @@ class UIElicitationSchemaPropertyType(Enum): NUMBER = "number" STRING = "string" - class UIElicitationSchemaType(Enum): OBJECT = "object" - # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationResponseAction(Enum): """The user's response: accept (submitted), decline (rejected), or cancel (dismissed)""" @@ -6756,21 +6202,19 @@ class UIElicitationResponseAction(Enum): CANCEL = "cancel" DECLINE = "decline" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationResult: """Indicates whether the elicitation response was accepted; false if it was already resolved by another client. """ - success: bool """Whether the response was accepted. False if the request was already resolved by another client. """ @staticmethod - def from_dict(obj: Any) -> "UIElicitationResult": + def from_dict(obj: Any) -> 'UIElicitationResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return UIElicitationResult(success) @@ -6780,11 +6224,9 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - class UIElicitationSchemaPropertyBooleanType(Enum): BOOLEAN = "boolean" - # Experimental: this type is part of an experimental API and may change or be removed. class UIElicitationSchemaPropertyNumberType(Enum): """Numeric type accepted by the field.""" @@ -6792,19 +6234,16 @@ class UIElicitationSchemaPropertyNumberType(Enum): INTEGER = "integer" NUMBER = "number" - # Experimental: this type is part of an experimental API and may change or be removed. class UIExitPlanModeAction(Enum): """The action the user selected. Defaults to 'autopilot' when autoApproveEdits is true, otherwise 'interactive'. """ - AUTOPILOT = "autopilot" AUTOPILOT_FLEET = "autopilot_fleet" EXIT_ONLY = "exit_only" INTERACTIVE = "interactive" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingResult: @@ -6817,7 +6256,7 @@ class UIHandlePendingResult: """ @staticmethod - def from_dict(obj: Any) -> "UIHandlePendingResult": + def from_dict(obj: Any) -> 'UIHandlePendingResult': assert isinstance(obj, dict) success = from_bool(obj.get("success")) return UIHandlePendingResult(success) @@ -6827,14 +6266,12 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingSamplingRequest: """Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject). """ - request_id: str """The unique request ID from the sampling.requested event""" @@ -6844,7 +6281,7 @@ class UIHandlePendingSamplingRequest: """ @staticmethod - def from_dict(obj: Any) -> "UIHandlePendingSamplingRequest": + def from_dict(obj: Any) -> 'UIHandlePendingSamplingRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("response")) @@ -6854,12 +6291,9 @@ def to_dict(self) -> dict: result: dict = {} result["requestId"] = from_str(self.request_id) if self.response is not None: - result["response"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.response - ) + result["response"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.response) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUserInputResponse: @@ -6874,7 +6308,7 @@ class UIUserInputResponse: """ @staticmethod - def from_dict(obj: Any) -> "UIUserInputResponse": + def from_dict(obj: Any) -> 'UIUserInputResponse': assert isinstance(obj, dict) answer = from_str(obj.get("answer")) was_freeform = from_bool(obj.get("wasFreeform")) @@ -6886,7 +6320,6 @@ def to_dict(self) -> dict: result["wasFreeform"] = from_bool(self.was_freeform) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIRegisterDirectAutoModeSwitchHandlerResult: @@ -6895,7 +6328,6 @@ class UIRegisterDirectAutoModeSwitchHandlerResult: registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId). """ - handle: str """Opaque handle representing the registration. Pass this same handle to `unregisterDirectAutoModeSwitchHandler` when the in-process handler is no longer active. @@ -6904,7 +6336,7 @@ class UIRegisterDirectAutoModeSwitchHandlerResult: """ @staticmethod - def from_dict(obj: Any) -> "UIRegisterDirectAutoModeSwitchHandlerResult": + def from_dict(obj: Any) -> 'UIRegisterDirectAutoModeSwitchHandlerResult': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return UIRegisterDirectAutoModeSwitchHandlerResult(handle) @@ -6914,7 +6346,6 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUnregisterDirectAutoModeSwitchHandlerRequest: @@ -6924,7 +6355,7 @@ class UIUnregisterDirectAutoModeSwitchHandlerRequest: """Handle previously returned by `registerDirectAutoModeSwitchHandler`""" @staticmethod - def from_dict(obj: Any) -> "UIUnregisterDirectAutoModeSwitchHandlerRequest": + def from_dict(obj: Any) -> 'UIUnregisterDirectAutoModeSwitchHandlerRequest': assert isinstance(obj, dict) handle = from_str(obj.get("handle")) return UIUnregisterDirectAutoModeSwitchHandlerRequest(handle) @@ -6934,7 +6365,6 @@ def to_dict(self) -> dict: result["handle"] = from_str(self.handle) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIUnregisterDirectAutoModeSwitchHandlerResult: @@ -6946,7 +6376,7 @@ class UIUnregisterDirectAutoModeSwitchHandlerResult: """ @staticmethod - def from_dict(obj: Any) -> "UIUnregisterDirectAutoModeSwitchHandlerResult": + def from_dict(obj: Any) -> 'UIUnregisterDirectAutoModeSwitchHandlerResult': assert isinstance(obj, dict) unregistered = from_bool(obj.get("unregistered")) return UIUnregisterDirectAutoModeSwitchHandlerResult(unregistered) @@ -6956,7 +6386,6 @@ def to_dict(self) -> dict: result["unregistered"] = from_bool(self.unregistered) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsCodeChanges: @@ -6975,15 +6404,13 @@ class UsageMetricsCodeChanges: """Total lines of code removed""" @staticmethod - def from_dict(obj: Any) -> "UsageMetricsCodeChanges": + def from_dict(obj: Any) -> 'UsageMetricsCodeChanges': assert isinstance(obj, dict) files_modified = from_list(from_str, obj.get("filesModified")) files_modified_count = from_int(obj.get("filesModifiedCount")) lines_added = from_int(obj.get("linesAdded")) lines_removed = from_int(obj.get("linesRemoved")) - return UsageMetricsCodeChanges( - files_modified, files_modified_count, lines_added, lines_removed - ) + return UsageMetricsCodeChanges(files_modified, files_modified_count, lines_added, lines_removed) def to_dict(self) -> dict: result: dict = {} @@ -6993,7 +6420,6 @@ def to_dict(self) -> dict: result["linesRemoved"] = from_int(self.lines_removed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricRequests: @@ -7006,7 +6432,7 @@ class UsageMetricsModelMetricRequests: """Number of API requests made with this model""" @staticmethod - def from_dict(obj: Any) -> "UsageMetricsModelMetricRequests": + def from_dict(obj: Any) -> 'UsageMetricsModelMetricRequests': assert isinstance(obj, dict) cost = from_float(obj.get("cost")) count = from_int(obj.get("count")) @@ -7018,7 +6444,6 @@ def to_dict(self) -> dict: result["count"] = from_int(self.count) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricTokenDetail: @@ -7028,7 +6453,7 @@ class UsageMetricsModelMetricTokenDetail: """Accumulated token count for this token type""" @staticmethod - def from_dict(obj: Any) -> "UsageMetricsModelMetricTokenDetail": + def from_dict(obj: Any) -> 'UsageMetricsModelMetricTokenDetail': assert isinstance(obj, dict) token_count = from_int(obj.get("tokenCount")) return UsageMetricsModelMetricTokenDetail(token_count) @@ -7038,7 +6463,6 @@ def to_dict(self) -> dict: result["tokenCount"] = from_int(self.token_count) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetricUsage: @@ -7060,16 +6484,14 @@ class UsageMetricsModelMetricUsage: """Total output tokens used for reasoning""" @staticmethod - def from_dict(obj: Any) -> "UsageMetricsModelMetricUsage": + def from_dict(obj: Any) -> 'UsageMetricsModelMetricUsage': assert isinstance(obj, dict) cache_read_tokens = from_int(obj.get("cacheReadTokens")) cache_write_tokens = from_int(obj.get("cacheWriteTokens")) input_tokens = from_int(obj.get("inputTokens")) output_tokens = from_int(obj.get("outputTokens")) reasoning_tokens = from_union([from_int, from_none], obj.get("reasoningTokens")) - return UsageMetricsModelMetricUsage( - cache_read_tokens, cache_write_tokens, input_tokens, output_tokens, reasoning_tokens - ) + return UsageMetricsModelMetricUsage(cache_read_tokens, cache_write_tokens, input_tokens, output_tokens, reasoning_tokens) def to_dict(self) -> dict: result: dict = {} @@ -7081,7 +6503,6 @@ def to_dict(self) -> dict: result["reasoningTokens"] = from_union([from_int, from_none], self.reasoning_tokens) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsTokenDetail: @@ -7091,7 +6512,7 @@ class UsageMetricsTokenDetail: """Accumulated token count for this token type""" @staticmethod - def from_dict(obj: Any) -> "UsageMetricsTokenDetail": + def from_dict(obj: Any) -> 'UsageMetricsTokenDetail': assert isinstance(obj, dict) token_count = from_int(obj.get("tokenCount")) return UsageMetricsTokenDetail(token_count) @@ -7101,11 +6522,9 @@ def to_dict(self) -> dict: result["tokenCount"] = from_int(self.token_count) return result - class UserAuthInfoType(Enum): USER = "user" - # Experimental: this type is part of an experimental API and may change or be removed. class WorkspaceDiffFileChangeType(Enum): """Type of change represented by this file diff.""" @@ -7115,18 +6534,15 @@ class WorkspaceDiffFileChangeType(Enum): MODIFIED = "modified" RENAMED = "renamed" - # Experimental: this type is part of an experimental API and may change or be removed. class WorkspaceDiffMode(Enum): """Diff mode requested by the client. Effective mode used for the returned changes. """ - BRANCH = "branch" UNSTAGED = "unstaged" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesCheckpoints: @@ -7142,7 +6558,7 @@ class WorkspacesCheckpoints: """Human-readable checkpoint title""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesCheckpoints": + def from_dict(obj: Any) -> 'WorkspacesCheckpoints': assert isinstance(obj, dict) filename = from_str(obj.get("filename")) number = from_int(obj.get("number")) @@ -7156,7 +6572,6 @@ def to_dict(self) -> dict: result["title"] = from_str(self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesCreateFileRequest: @@ -7169,7 +6584,7 @@ class WorkspacesCreateFileRequest: """Relative path within the workspace files directory""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesCreateFileRequest": + def from_dict(obj: Any) -> 'WorkspacesCreateFileRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) path = from_str(obj.get("path")) @@ -7181,7 +6596,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesListFilesResult: @@ -7191,7 +6605,7 @@ class WorkspacesListFilesResult: """Relative file paths in the workspace files directory""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesListFilesResult": + def from_dict(obj: Any) -> 'WorkspacesListFilesResult': assert isinstance(obj, dict) files = from_list(from_str, obj.get("files")) return WorkspacesListFilesResult(files) @@ -7201,7 +6615,6 @@ def to_dict(self) -> dict: result["files"] = from_list(from_str, self.files) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadCheckpointRequest: @@ -7211,7 +6624,7 @@ class WorkspacesReadCheckpointRequest: """Checkpoint number to read""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesReadCheckpointRequest": + def from_dict(obj: Any) -> 'WorkspacesReadCheckpointRequest': assert isinstance(obj, dict) number = from_int(obj.get("number")) return WorkspacesReadCheckpointRequest(number) @@ -7221,7 +6634,6 @@ def to_dict(self) -> dict: result["number"] = from_int(self.number) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadCheckpointResult: @@ -7231,7 +6643,7 @@ class WorkspacesReadCheckpointResult: """Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesReadCheckpointResult": + def from_dict(obj: Any) -> 'WorkspacesReadCheckpointResult': assert isinstance(obj, dict) content = from_union([from_none, from_str], obj.get("content")) return WorkspacesReadCheckpointResult(content) @@ -7241,7 +6653,6 @@ def to_dict(self) -> dict: result["content"] = from_union([from_none, from_str], self.content) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadFileRequest: @@ -7251,7 +6662,7 @@ class WorkspacesReadFileRequest: """Relative path within the workspace files directory""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesReadFileRequest": + def from_dict(obj: Any) -> 'WorkspacesReadFileRequest': assert isinstance(obj, dict) path = from_str(obj.get("path")) return WorkspacesReadFileRequest(path) @@ -7261,7 +6672,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesReadFileResult: @@ -7271,7 +6681,7 @@ class WorkspacesReadFileResult: """File content as a UTF-8 string""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesReadFileResult": + def from_dict(obj: Any) -> 'WorkspacesReadFileResult': assert isinstance(obj, dict) content = from_str(obj.get("content")) return WorkspacesReadFileResult(content) @@ -7281,7 +6691,6 @@ def to_dict(self) -> dict: result["content"] = from_str(self.content) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesSaveLargePasteRequest: @@ -7291,7 +6700,7 @@ class WorkspacesSaveLargePasteRequest: """Pasted content to save as a UTF-8 file""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesSaveLargePasteRequest": + def from_dict(obj: Any) -> 'WorkspacesSaveLargePasteRequest': assert isinstance(obj, dict) content = from_str(obj.get("content")) return WorkspacesSaveLargePasteRequest(content) @@ -7301,7 +6710,6 @@ def to_dict(self) -> dict: result["content"] = from_str(self.content) return result - @dataclass class Saved: filename: str @@ -7314,7 +6722,7 @@ class Saved: """Size of the saved file in bytes""" @staticmethod - def from_dict(obj: Any) -> "Saved": + def from_dict(obj: Any) -> 'Saved': assert isinstance(obj, dict) filename = from_str(obj.get("filename")) file_path = from_str(obj.get("filePath")) @@ -7328,7 +6736,6 @@ def to_dict(self) -> dict: result["sizeBytes"] = from_int(self.size_bytes) return result - @dataclass class AccountGetQuotaResult: """Quota usage snapshots for the resolved user, keyed by quota type.""" @@ -7337,19 +6744,16 @@ class AccountGetQuotaResult: """Quota snapshots keyed by type (e.g., chat, completions, premium_interactions)""" @staticmethod - def from_dict(obj: Any) -> "AccountGetQuotaResult": + def from_dict(obj: Any) -> 'AccountGetQuotaResult': assert isinstance(obj, dict) quota_snapshots = from_dict(AccountQuotaSnapshot.from_dict, obj.get("quotaSnapshots")) return AccountGetQuotaResult(quota_snapshots) def to_dict(self) -> dict: result: dict = {} - result["quotaSnapshots"] = from_dict( - lambda x: to_class(AccountQuotaSnapshot, x), self.quota_snapshots - ) + result["quotaSnapshots"] = from_dict(lambda x: to_class(AccountQuotaSnapshot, x), self.quota_snapshots) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionAuthStatus: @@ -7374,7 +6778,7 @@ class SessionAuthStatus: """Human-readable authentication status description""" @staticmethod - def from_dict(obj: Any) -> "SessionAuthStatus": + def from_dict(obj: Any) -> 'SessionAuthStatus': assert isinstance(obj, dict) is_authenticated = from_bool(obj.get("isAuthenticated")) auth_type = from_union([AuthInfoType, from_none], obj.get("authType")) @@ -7382,17 +6786,13 @@ def from_dict(obj: Any) -> "SessionAuthStatus": host = from_union([from_str, from_none], obj.get("host")) login = from_union([from_str, from_none], obj.get("login")) status_message = from_union([from_str, from_none], obj.get("statusMessage")) - return SessionAuthStatus( - is_authenticated, auth_type, copilot_plan, host, login, status_message - ) + return SessionAuthStatus(is_authenticated, auth_type, copilot_plan, host, login, status_message) def to_dict(self) -> dict: result: dict = {} result["isAuthenticated"] = from_bool(self.is_authenticated) if self.auth_type is not None: - result["authType"] = from_union( - [lambda x: to_enum(AuthInfoType, x), from_none], self.auth_type - ) + result["authType"] = from_union([lambda x: to_enum(AuthInfoType, x), from_none], self.auth_type) if self.copilot_plan is not None: result["copilotPlan"] = from_union([from_str, from_none], self.copilot_plan) if self.host is not None: @@ -7403,7 +6803,6 @@ def to_dict(self) -> dict: result["statusMessage"] = from_union([from_str, from_none], self.status_message) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class DiscoveredCanvas: @@ -7431,26 +6830,16 @@ class DiscoveredCanvas: """JSON Schema for canvas open input""" @staticmethod - def from_dict(obj: Any) -> "DiscoveredCanvas": + def from_dict(obj: Any) -> 'DiscoveredCanvas': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) extension_id = from_str(obj.get("extensionId")) - actions = from_union( - [lambda x: from_list(CanvasAction.from_dict, x), from_none], obj.get("actions") - ) + actions = from_union([lambda x: from_list(CanvasAction.from_dict, x), from_none], obj.get("actions")) extension_name = from_union([from_str, from_none], obj.get("extensionName")) input_schema = obj.get("inputSchema") - return DiscoveredCanvas( - canvas_id, - description, - display_name, - extension_id, - actions, - extension_name, - input_schema, - ) + return DiscoveredCanvas(canvas_id, description, display_name, extension_id, actions, extension_name, input_schema) def to_dict(self) -> dict: result: dict = {} @@ -7459,17 +6848,13 @@ def to_dict(self) -> dict: result["displayName"] = from_str(self.display_name) result["extensionId"] = from_str(self.extension_id) if self.actions is not None: - result["actions"] = from_union( - [lambda x: from_list(lambda x: to_class(CanvasAction, x), x), from_none], - self.actions, - ) + result["actions"] = from_union([lambda x: from_list(lambda x: to_class(CanvasAction, x), x), from_none], self.actions) if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.input_schema is not None: result["inputSchema"] = self.input_schema return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class OpenCanvasInstance: @@ -7506,7 +6891,7 @@ class OpenCanvasInstance: """URL for web-rendered canvases""" @staticmethod - def from_dict(obj: Any) -> "OpenCanvasInstance": + def from_dict(obj: Any) -> 'OpenCanvasInstance': assert isinstance(obj, dict) availability = CanvasInstanceAvailability(obj.get("availability")) canvas_id = from_str(obj.get("canvasId")) @@ -7518,18 +6903,7 @@ def from_dict(obj: Any) -> "OpenCanvasInstance": status = from_union([from_str, from_none], obj.get("status")) title = from_union([from_str, from_none], obj.get("title")) url = from_union([from_str, from_none], obj.get("url")) - return OpenCanvasInstance( - availability, - canvas_id, - extension_id, - instance_id, - reopen, - extension_name, - input, - status, - title, - url, - ) + return OpenCanvasInstance(availability, canvas_id, extension_id, instance_id, reopen, extension_name, input, status, title, url) def to_dict(self) -> dict: result: dict = {} @@ -7550,7 +6924,6 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInput: @@ -7572,13 +6945,11 @@ class SlashCommandInput: """ @staticmethod - def from_dict(obj: Any) -> "SlashCommandInput": + def from_dict(obj: Any) -> 'SlashCommandInput': assert isinstance(obj, dict) hint = from_str(obj.get("hint")) completion = from_union([SlashCommandInputCompletion, from_none], obj.get("completion")) - preserve_multiline_input = from_union( - [from_bool, from_none], obj.get("preserveMultilineInput") - ) + preserve_multiline_input = from_union([from_bool, from_none], obj.get("preserveMultilineInput")) required = from_union([from_bool, from_none], obj.get("required")) return SlashCommandInput(hint, completion, preserve_multiline_input, required) @@ -7586,18 +6957,13 @@ def to_dict(self) -> dict: result: dict = {} result["hint"] = from_str(self.hint) if self.completion is not None: - result["completion"] = from_union( - [lambda x: to_enum(SlashCommandInputCompletion, x), from_none], self.completion - ) + result["completion"] = from_union([lambda x: to_enum(SlashCommandInputCompletion, x), from_none], self.completion) if self.preserve_multiline_input is not None: - result["preserveMultilineInput"] = from_union( - [from_bool, from_none], self.preserve_multiline_input - ) + result["preserveMultilineInput"] = from_union([from_bool, from_none], self.preserve_multiline_input) if self.required is not None: result["required"] = from_union([from_bool, from_none], self.required) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentDirectory: @@ -7613,7 +6979,7 @@ class SendAttachmentDirectory: """Attachment type discriminator""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentDirectory": + def from_dict(obj: Any) -> 'SendAttachmentDirectory': assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) path = from_str(obj.get("path")) @@ -7626,7 +6992,6 @@ def to_dict(self) -> dict: result["type"] = self.type return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ConnectedRemoteSessionMetadata: @@ -7666,7 +7031,7 @@ class ConnectedRemoteSessionMetadata: """Optional session summary.""" @staticmethod - def from_dict(obj: Any) -> "ConnectedRemoteSessionMetadata": + def from_dict(obj: Any) -> 'ConnectedRemoteSessionMetadata': assert isinstance(obj, dict) kind = ConnectedRemoteSessionMetadataKind(obj.get("kind")) modified_time = from_datetime(obj.get("modifiedTime")) @@ -7679,19 +7044,7 @@ def from_dict(obj: Any) -> "ConnectedRemoteSessionMetadata": stale_at = from_union([from_datetime, from_none], obj.get("staleAt")) state = from_union([from_str, from_none], obj.get("state")) summary = from_union([from_str, from_none], obj.get("summary")) - return ConnectedRemoteSessionMetadata( - kind, - modified_time, - repository, - session_id, - start_time, - name, - pull_request_number, - resource_id, - stale_at, - state, - summary, - ) + return ConnectedRemoteSessionMetadata(kind, modified_time, repository, session_id, start_time, name, pull_request_number, resource_id, stale_at, state, summary) def to_dict(self) -> dict: result: dict = {} @@ -7703,9 +7056,7 @@ def to_dict(self) -> dict: if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.pull_request_number is not None: - result["pullRequestNumber"] = from_union( - [from_int, from_none], self.pull_request_number - ) + result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.stale_at is not None: @@ -7716,7 +7067,6 @@ def to_dict(self) -> dict: result["summary"] = from_union([from_str, from_none], self.summary) return result - @dataclass class MCPServerConfigStdio: """Stdio MCP server configuration launched as a child process.""" @@ -7748,22 +7098,17 @@ class MCPServerConfigStdio: """Tools to include. Defaults to all tools if not specified.""" @staticmethod - def from_dict(obj: Any) -> "MCPServerConfigStdio": + def from_dict(obj: Any) -> 'MCPServerConfigStdio': assert isinstance(obj, dict) command = from_str(obj.get("command")) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) cwd = from_union([from_str, from_none], obj.get("cwd")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) - filter_mapping = from_union( - [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], - obj.get("filterMapping"), - ) + filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) - return MCPServerConfigStdio( - command, args, cwd, env, filter_mapping, is_default_server, timeout, tools - ) + return MCPServerConfigStdio(command, args, cwd, env, filter_mapping, is_default_server, timeout, tools) def to_dict(self) -> dict: result: dict = {} @@ -7775,14 +7120,7 @@ def to_dict(self) -> dict: if self.env is not None: result["env"] = from_union([lambda x: from_dict(from_str, x), from_none], self.env) if self.filter_mapping is not None: - result["filterMapping"] = from_union( - [ - lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), - lambda x: to_enum(ContentFilterMode, x), - from_none, - ], - self.filter_mapping, - ) + result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.timeout is not None: @@ -7791,7 +7129,7 @@ def to_dict(self) -> dict: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasHostContextCapabilities: """Host capabilities""" @@ -7800,7 +7138,7 @@ class CanvasHostContextCapabilities: """Whether canvas rendering is supported""" @staticmethod - def from_dict(obj: Any) -> "CanvasHostContextCapabilities": + def from_dict(obj: Any) -> 'CanvasHostContextCapabilities': assert isinstance(obj, dict) canvases = from_union([from_bool, from_none], obj.get("canvases")) return CanvasHostContextCapabilities(canvases) @@ -7811,7 +7149,6 @@ def to_dict(self) -> dict: result["canvases"] = from_union([from_bool, from_none], self.canvases) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponseQuotaSnapshots: @@ -7821,7 +7158,6 @@ class CopilotUserResponseQuotaSnapshots: Schema for the `CopilotUserResponseQuotaSnapshotsPremiumInteractions` type. """ - entitlement: float | None = None has_quota: bool | None = None overage_count: float | None = None @@ -7836,7 +7172,7 @@ class CopilotUserResponseQuotaSnapshots: unlimited: bool | None = None @staticmethod - def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshots": + def from_dict(obj: Any) -> 'CopilotUserResponseQuotaSnapshots': assert isinstance(obj, dict) entitlement = from_union([from_float, from_none], obj.get("entitlement")) has_quota = from_union([from_bool, from_none], obj.get("has_quota")) @@ -7850,20 +7186,7 @@ def from_dict(obj: Any) -> "CopilotUserResponseQuotaSnapshots": timestamp_utc = from_union([from_str, from_none], obj.get("timestamp_utc")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) unlimited = from_union([from_bool, from_none], obj.get("unlimited")) - return CopilotUserResponseQuotaSnapshots( - entitlement, - has_quota, - overage_count, - overage_permitted, - percent_remaining, - quota_id, - quota_remaining, - quota_reset_at, - remaining, - timestamp_utc, - token_based_billing, - unlimited, - ) + return CopilotUserResponseQuotaSnapshots(entitlement, has_quota, overage_count, overage_permitted, percent_remaining, quota_id, quota_remaining, quota_reset_at, remaining, timestamp_utc, token_based_billing, unlimited) def to_dict(self) -> dict: result: dict = {} @@ -7888,14 +7211,11 @@ def to_dict(self) -> dict: if self.timestamp_utc is not None: result["timestamp_utc"] = from_union([from_str, from_none], self.timestamp_utc) if self.token_based_billing is not None: - result["token_based_billing"] = from_union( - [from_bool, from_none], self.token_based_billing - ) + result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) if self.unlimited is not None: result["unlimited"] = from_union([from_bool, from_none], self.unlimited) return result - @dataclass class DiscoveredMCPServer: """Schema for the `DiscoveredMcpServer` type.""" @@ -7913,7 +7233,7 @@ class DiscoveredMCPServer: """Server transport type: stdio, http, sse (deprecated), or memory""" @staticmethod - def from_dict(obj: Any) -> "DiscoveredMCPServer": + def from_dict(obj: Any) -> 'DiscoveredMCPServer': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) name = from_str(obj.get("name")) @@ -7927,12 +7247,9 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) result["source"] = to_enum(McpServerSource, self.source) if self.type is not None: - result["type"] = from_union( - [lambda x: to_enum(DiscoveredMCPServerType, x), from_none], self.type - ) + result["type"] = from_union([lambda x: to_enum(DiscoveredMCPServerType, x), from_none], self.type) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventLogReadRequest: @@ -7963,37 +7280,29 @@ class EventLogReadRequest: """ @staticmethod - def from_dict(obj: Any) -> "EventLogReadRequest": + def from_dict(obj: Any) -> 'EventLogReadRequest': assert isinstance(obj, dict) agent_scope = from_union([EventsAgentScope, from_none], obj.get("agentScope")) cursor = from_union([from_str, from_none], obj.get("cursor")) max = from_union([from_int, from_none], obj.get("max")) - types = from_union( - [lambda x: from_list(from_str, x), EventLogTypes, from_none], obj.get("types") - ) + types = from_union([lambda x: from_list(from_str, x), EventLogTypes, from_none], obj.get("types")) wait_ms = from_union([from_int, from_none], obj.get("waitMs")) return EventLogReadRequest(agent_scope, cursor, max, types, wait_ms) def to_dict(self) -> dict: result: dict = {} if self.agent_scope is not None: - result["agentScope"] = from_union( - [lambda x: to_enum(EventsAgentScope, x), from_none], self.agent_scope - ) + result["agentScope"] = from_union([lambda x: to_enum(EventsAgentScope, x), from_none], self.agent_scope) if self.cursor is not None: result["cursor"] = from_union([from_str, from_none], self.cursor) if self.max is not None: result["max"] = from_union([from_int, from_none], self.max) if self.types is not None: - result["types"] = from_union( - [lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x), from_none], - self.types, - ) + result["types"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x), from_none], self.types) if self.wait_ms is not None: result["waitMs"] = from_union([from_int, from_none], self.wait_ms) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EventsReadResult: @@ -8021,7 +7330,7 @@ class EventsReadResult: """ @staticmethod - def from_dict(obj: Any) -> "EventsReadResult": + def from_dict(obj: Any) -> 'EventsReadResult': assert isinstance(obj, dict) cursor = from_str(obj.get("cursor")) cursor_status = EventsCursorStatus(obj.get("cursorStatus")) @@ -8037,7 +7346,6 @@ def to_dict(self) -> dict: result["hasMore"] = from_bool(self.has_more) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class Extension: @@ -8059,7 +7367,7 @@ class Extension: """Process ID if the extension is running""" @staticmethod - def from_dict(obj: Any) -> "Extension": + def from_dict(obj: Any) -> 'Extension': assert isinstance(obj, dict) id = from_str(obj.get("id")) name = from_str(obj.get("name")) @@ -8078,7 +7386,6 @@ def to_dict(self) -> dict: result["pid"] = from_union([from_int, from_none], self.pid) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmBinaryResultsForLlm: @@ -8101,16 +7408,14 @@ class ExternalToolTextResultForLlmBinaryResultsForLlm: """Optional metadata from the producing tool.""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmBinaryResultsForLlm": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmBinaryResultsForLlm': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) type = ExternalToolTextResultForLlmBinaryResultsForLlmType(obj.get("type")) description = from_union([from_str, from_none], obj.get("description")) metadata = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("metadata")) - return ExternalToolTextResultForLlmBinaryResultsForLlm( - data, mime_type, type, description, metadata - ) + return ExternalToolTextResultForLlmBinaryResultsForLlm(data, mime_type, type, description, metadata) def to_dict(self) -> dict: result: dict = {} @@ -8120,12 +7425,9 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.metadata is not None: - result["metadata"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.metadata - ) + result["metadata"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.metadata) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResourceLinkIcon: @@ -8144,7 +7446,7 @@ class ExternalToolTextResultForLlmContentResourceLinkIcon: """Theme variant this icon is intended for""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentResourceLinkIcon": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResourceLinkIcon': assert isinstance(obj, dict) src = from_str(obj.get("src")) mime_type = from_union([from_str, from_none], obj.get("mimeType")) @@ -8163,11 +7465,7 @@ def to_dict(self) -> dict: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) return result - -ExternalToolTextResultForLlmContentResourceDetails = ( - EmbeddedTextResourceContents | EmbeddedBlobResourceContents -) - +ExternalToolTextResultForLlmContentResourceDetails = EmbeddedTextResourceContents | EmbeddedBlobResourceContents # Experimental: this type is part of an experimental API and may change or be removed. @dataclass @@ -8184,7 +7482,7 @@ class ExternalToolTextResultForLlmContentAudio: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentAudio": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentAudio': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) @@ -8197,7 +7495,6 @@ def to_dict(self) -> dict: result["type"] = self.type return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentImage: @@ -8213,7 +7510,7 @@ class ExternalToolTextResultForLlmContentImage: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentImage": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentImage': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) @@ -8226,7 +7523,6 @@ def to_dict(self) -> dict: result["type"] = self.type return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResource: @@ -8239,28 +7535,17 @@ class ExternalToolTextResultForLlmContentResource: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentResource": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResource': assert isinstance(obj, dict) - resource = ( - lambda x: from_union( - [EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x - ) - )(obj.get("resource")) + resource = (lambda x: from_union([EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x))(obj.get("resource")) return ExternalToolTextResultForLlmContentResource(resource) def to_dict(self) -> dict: result: dict = {} - result["resource"] = from_union( - [ - lambda x: to_class(EmbeddedTextResourceContents, x), - lambda x: to_class(EmbeddedBlobResourceContents, x), - ], - self.resource, - ) + result["resource"] = from_union([lambda x: to_class(EmbeddedTextResourceContents, x), lambda x: to_class(EmbeddedBlobResourceContents, x)], self.resource) result["type"] = self.type return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentTerminal: @@ -8279,7 +7564,7 @@ class ExternalToolTextResultForLlmContentTerminal: """Process exit code, if the command has completed""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentTerminal": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentTerminal': assert isinstance(obj, dict) text = from_str(obj.get("text")) cwd = from_union([from_str, from_none], obj.get("cwd")) @@ -8296,7 +7581,6 @@ def to_dict(self) -> dict: result["exitCode"] = from_union([from_int, from_none], self.exit_code) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentText: @@ -8309,7 +7593,7 @@ class ExternalToolTextResultForLlmContentText: """Content block type discriminator""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentText": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentText': assert isinstance(obj, dict) text = from_str(obj.get("text")) return ExternalToolTextResultForLlmContentText(text) @@ -8320,7 +7604,6 @@ def to_dict(self) -> dict: result["type"] = self.type return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandTextResult: @@ -8344,14 +7627,12 @@ class SlashCommandTextResult: """ @staticmethod - def from_dict(obj: Any) -> "SlashCommandTextResult": + def from_dict(obj: Any) -> 'SlashCommandTextResult': assert isinstance(obj, dict) text = from_str(obj.get("text")) markdown = from_union([from_bool, from_none], obj.get("markdown")) preserve_ansi = from_union([from_bool, from_none], obj.get("preserveAnsi")) - runtime_settings_changed = from_union( - [from_bool, from_none], obj.get("runtimeSettingsChanged") - ) + runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandTextResult(text, markdown, preserve_ansi, runtime_settings_changed) def to_dict(self) -> dict: @@ -8363,19 +7644,15 @@ def to_dict(self) -> dict: if self.preserve_ansi is not None: result["preserveAnsi"] = from_union([from_bool, from_none], self.preserve_ansi) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union( - [from_bool, from_none], self.runtime_settings_changed - ) + result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HistoryCompactResult: """Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown. """ - messages_removed: int """Number of messages removed during compaction""" @@ -8394,18 +7671,14 @@ class HistoryCompactResult: """ @staticmethod - def from_dict(obj: Any) -> "HistoryCompactResult": + def from_dict(obj: Any) -> 'HistoryCompactResult': assert isinstance(obj, dict) messages_removed = from_int(obj.get("messagesRemoved")) success = from_bool(obj.get("success")) tokens_removed = from_int(obj.get("tokensRemoved")) - context_window = from_union( - [HistoryCompactContextWindow.from_dict, from_none], obj.get("contextWindow") - ) + context_window = from_union([HistoryCompactContextWindow.from_dict, from_none], obj.get("contextWindow")) summary_content = from_union([from_str, from_none], obj.get("summaryContent")) - return HistoryCompactResult( - messages_removed, success, tokens_removed, context_window, summary_content - ) + return HistoryCompactResult(messages_removed, success, tokens_removed, context_window, summary_content) def to_dict(self) -> dict: result: dict = {} @@ -8413,14 +7686,11 @@ def to_dict(self) -> dict: result["success"] = from_bool(self.success) result["tokensRemoved"] = from_int(self.tokens_removed) if self.context_window is not None: - result["contextWindow"] = from_union( - [lambda x: to_class(HistoryCompactContextWindow, x), from_none], self.context_window - ) + result["contextWindow"] = from_union([lambda x: to_class(HistoryCompactContextWindow, x), from_none], self.context_window) if self.summary_content is not None: result["summaryContent"] = from_union([from_str, from_none], self.summary_content) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceGithub: @@ -8434,7 +7704,7 @@ class InstalledPluginSourceGithub: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> "InstalledPluginSourceGithub": + def from_dict(obj: Any) -> 'InstalledPluginSourceGithub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) @@ -8452,7 +7722,6 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceGithub: @@ -8466,7 +7735,7 @@ class SessionInstalledPluginSourceGithub: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> "SessionInstalledPluginSourceGithub": + def from_dict(obj: Any) -> 'SessionInstalledPluginSourceGithub': assert isinstance(obj, dict) repo = from_str(obj.get("repo")) source = FluffySource(obj.get("source")) @@ -8484,7 +7753,6 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceLocal: @@ -8495,7 +7763,7 @@ class InstalledPluginSourceLocal: """Constant value. Always "local".""" @staticmethod - def from_dict(obj: Any) -> "InstalledPluginSourceLocal": + def from_dict(obj: Any) -> 'InstalledPluginSourceLocal': assert isinstance(obj, dict) path = from_str(obj.get("path")) source = TentacledSource(obj.get("source")) @@ -8507,7 +7775,6 @@ def to_dict(self) -> dict: result["source"] = to_enum(TentacledSource, self.source) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceLocal: @@ -8518,7 +7785,7 @@ class SessionInstalledPluginSourceLocal: """Constant value. Always "local".""" @staticmethod - def from_dict(obj: Any) -> "SessionInstalledPluginSourceLocal": + def from_dict(obj: Any) -> 'SessionInstalledPluginSourceLocal': assert isinstance(obj, dict) path = from_str(obj.get("path")) source = TentacledSource(obj.get("source")) @@ -8530,7 +7797,6 @@ def to_dict(self) -> dict: result["source"] = to_enum(TentacledSource, self.source) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSourceURL: @@ -8544,7 +7810,7 @@ class InstalledPluginSourceURL: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> "InstalledPluginSourceURL": + def from_dict(obj: Any) -> 'InstalledPluginSourceURL': assert isinstance(obj, dict) source = StickySource(obj.get("source")) url = from_str(obj.get("url")) @@ -8562,7 +7828,6 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSourceURL: @@ -8576,7 +7841,7 @@ class SessionInstalledPluginSourceURL: ref: str | None = None @staticmethod - def from_dict(obj: Any) -> "SessionInstalledPluginSourceURL": + def from_dict(obj: Any) -> 'SessionInstalledPluginSourceURL': assert isinstance(obj, dict) source = StickySource(obj.get("source")) url = from_str(obj.get("url")) @@ -8594,7 +7859,6 @@ def to_dict(self) -> dict: result["ref"] = from_union([from_str, from_none], self.ref) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsSources: @@ -8629,7 +7893,7 @@ class InstructionsSources: """Short description (body after frontmatter) for use in instruction tables""" @staticmethod - def from_dict(obj: Any) -> "InstructionsSources": + def from_dict(obj: Any) -> 'InstructionsSources': assert isinstance(obj, dict) content = from_str(obj.get("content")) id = from_str(obj.get("id")) @@ -8640,9 +7904,7 @@ def from_dict(obj: Any) -> "InstructionsSources": apply_to = from_union([lambda x: from_list(from_str, x), from_none], obj.get("applyTo")) default_disabled = from_union([from_bool, from_none], obj.get("defaultDisabled")) description = from_union([from_str, from_none], obj.get("description")) - return InstructionsSources( - content, id, label, location, source_path, type, apply_to, default_disabled, description - ) + return InstructionsSources(content, id, label, location, source_path, type, apply_to, default_disabled, description) def to_dict(self) -> dict: result: dict = {} @@ -8653,23 +7915,19 @@ def to_dict(self) -> dict: result["sourcePath"] = from_str(self.source_path) result["type"] = to_enum(InstructionsSourcesType, self.type) if self.apply_to is not None: - result["applyTo"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.apply_to - ) + result["applyTo"] = from_union([lambda x: from_list(from_str, x), from_none], self.apply_to) if self.default_disabled is not None: result["defaultDisabled"] = from_union([from_bool, from_none], self.default_disabled) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class LogRequest: """Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip. """ - message: str """Human-readable message""" @@ -8691,7 +7949,7 @@ class LogRequest: """Optional URL the user can open in their browser for more details""" @staticmethod - def from_dict(obj: Any) -> "LogRequest": + def from_dict(obj: Any) -> 'LogRequest': assert isinstance(obj, dict) message = from_str(obj.get("message")) ephemeral = from_union([from_bool, from_none], obj.get("ephemeral")) @@ -8707,9 +7965,7 @@ def to_dict(self) -> dict: if self.ephemeral is not None: result["ephemeral"] = from_union([from_bool, from_none], self.ephemeral) if self.level is not None: - result["level"] = from_union( - [lambda x: to_enum(SessionLogLevel, x), from_none], self.level - ) + result["level"] = from_union([lambda x: to_enum(SessionLogLevel, x), from_none], self.level) if self.tip is not None: result["tip"] = from_union([from_str, from_none], self.tip) if self.type is not None: @@ -8718,7 +7974,6 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsDiagnoseResult: @@ -8731,7 +7986,7 @@ class MCPAppsDiagnoseResult: """What the server returned for this session""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsDiagnoseResult": + def from_dict(obj: Any) -> 'MCPAppsDiagnoseResult': assert isinstance(obj, dict) capability = MCPAppsDiagnoseCapability.from_dict(obj.get("capability")) server = MCPAppsDiagnoseServer.from_dict(obj.get("server")) @@ -8743,7 +7998,6 @@ def to_dict(self) -> dict: result["server"] = to_class(MCPAppsDiagnoseServer, self.server) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsHostContextDetails: @@ -8771,39 +8025,27 @@ class MCPAppsHostContextDetails: """Host application identifier""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsHostContextDetails": + def from_dict(obj: Any) -> 'MCPAppsHostContextDetails': assert isinstance(obj, dict) - available_display_modes = from_union( - [lambda x: from_list(MCPAppsDisplayMode, x), from_none], - obj.get("availableDisplayModes"), - ) + available_display_modes = from_union([lambda x: from_list(MCPAppsDisplayMode, x), from_none], obj.get("availableDisplayModes")) display_mode = from_union([MCPAppsDisplayMode, from_none], obj.get("displayMode")) locale = from_union([from_str, from_none], obj.get("locale")) platform = from_union([MCPAppsHostContextDetailsPlatform, from_none], obj.get("platform")) theme = from_union([Theme, from_none], obj.get("theme")) time_zone = from_union([from_str, from_none], obj.get("timeZone")) user_agent = from_union([from_str, from_none], obj.get("userAgent")) - return MCPAppsHostContextDetails( - available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent - ) + return MCPAppsHostContextDetails(available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent) def to_dict(self) -> dict: result: dict = {} if self.available_display_modes is not None: - result["availableDisplayModes"] = from_union( - [lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], - self.available_display_modes, - ) + result["availableDisplayModes"] = from_union([lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], self.available_display_modes) if self.display_mode is not None: - result["displayMode"] = from_union( - [lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode - ) + result["displayMode"] = from_union([lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode) if self.locale is not None: result["locale"] = from_union([from_str, from_none], self.locale) if self.platform is not None: - result["platform"] = from_union( - [lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform - ) + result["platform"] = from_union([lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) if self.time_zone is not None: @@ -8812,7 +8054,6 @@ def to_dict(self) -> dict: result["userAgent"] = from_union([from_str, from_none], self.user_agent) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsSetHostContextDetails: @@ -8840,39 +8081,27 @@ class MCPAppsSetHostContextDetails: """Host application identifier""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsSetHostContextDetails": + def from_dict(obj: Any) -> 'MCPAppsSetHostContextDetails': assert isinstance(obj, dict) - available_display_modes = from_union( - [lambda x: from_list(MCPAppsDisplayMode, x), from_none], - obj.get("availableDisplayModes"), - ) + available_display_modes = from_union([lambda x: from_list(MCPAppsDisplayMode, x), from_none], obj.get("availableDisplayModes")) display_mode = from_union([MCPAppsDisplayMode, from_none], obj.get("displayMode")) locale = from_union([from_str, from_none], obj.get("locale")) platform = from_union([MCPAppsHostContextDetailsPlatform, from_none], obj.get("platform")) theme = from_union([Theme, from_none], obj.get("theme")) time_zone = from_union([from_str, from_none], obj.get("timeZone")) user_agent = from_union([from_str, from_none], obj.get("userAgent")) - return MCPAppsSetHostContextDetails( - available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent - ) + return MCPAppsSetHostContextDetails(available_display_modes, display_mode, locale, platform, theme, time_zone, user_agent) def to_dict(self) -> dict: result: dict = {} if self.available_display_modes is not None: - result["availableDisplayModes"] = from_union( - [lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], - self.available_display_modes, - ) + result["availableDisplayModes"] = from_union([lambda x: from_list(lambda x: to_enum(MCPAppsDisplayMode, x), x), from_none], self.available_display_modes) if self.display_mode is not None: - result["displayMode"] = from_union( - [lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode - ) + result["displayMode"] = from_union([lambda x: to_enum(MCPAppsDisplayMode, x), from_none], self.display_mode) if self.locale is not None: result["locale"] = from_union([from_str, from_none], self.locale) if self.platform is not None: - result["platform"] = from_union( - [lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform - ) + result["platform"] = from_union([lambda x: to_enum(MCPAppsHostContextDetailsPlatform, x), from_none], self.platform) if self.theme is not None: result["theme"] = from_union([lambda x: to_enum(Theme, x), from_none], self.theme) if self.time_zone is not None: @@ -8881,7 +8110,6 @@ def to_dict(self) -> dict: result["userAgent"] = from_union([from_str, from_none], self.user_agent) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsReadResourceResult: @@ -8891,7 +8119,7 @@ class MCPAppsReadResourceResult: """Resource contents returned by the server""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsReadResourceResult": + def from_dict(obj: Any) -> 'MCPAppsReadResourceResult': assert isinstance(obj, dict) contents = from_list(MCPAppsResourceContent.from_dict, obj.get("contents")) return MCPAppsReadResourceResult(contents) @@ -8901,7 +8129,6 @@ def to_dict(self) -> dict: result["contents"] = from_list(lambda x: to_class(MCPAppsResourceContent, x), self.contents) return result - @dataclass class MCPServerConfig: """MCP server configuration (stdio process or remote HTTP/SSE) @@ -8910,7 +8137,6 @@ class MCPServerConfig: Remote MCP server configuration accessed over HTTP or SSE. """ - args: list[str] | None = None """Command-line arguments passed to the Stdio MCP server process.""" @@ -8959,45 +8185,24 @@ class MCPServerConfig: """URL of the remote MCP server endpoint.""" @staticmethod - def from_dict(obj: Any) -> "MCPServerConfig": + def from_dict(obj: Any) -> 'MCPServerConfig': assert isinstance(obj, dict) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) command = from_union([from_str, from_none], obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) - filter_mapping = from_union( - [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], - obj.get("filterMapping"), - ) + filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) auth = from_union([MCPServerConfigHTTPAuth.from_dict, from_none], obj.get("auth")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) - oauth_grant_type = from_union( - [MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType") - ) + oauth_grant_type = from_union([MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType")) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) url = from_union([from_str, from_none], obj.get("url")) - return MCPServerConfig( - args, - command, - cwd, - env, - filter_mapping, - is_default_server, - timeout, - tools, - auth, - headers, - oauth_client_id, - oauth_grant_type, - oauth_public_client, - type, - url, - ) + return MCPServerConfig(args, command, cwd, env, filter_mapping, is_default_server, timeout, tools, auth, headers, oauth_client_id, oauth_grant_type, oauth_public_client, type, url) def to_dict(self) -> dict: result: dict = {} @@ -9010,14 +8215,7 @@ def to_dict(self) -> dict: if self.env is not None: result["env"] = from_union([lambda x: from_dict(from_str, x), from_none], self.env) if self.filter_mapping is not None: - result["filterMapping"] = from_union( - [ - lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), - lambda x: to_enum(ContentFilterMode, x), - from_none, - ], - self.filter_mapping, - ) + result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.timeout is not None: @@ -9025,33 +8223,21 @@ def to_dict(self) -> dict: if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.auth is not None: - result["auth"] = from_union( - [lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth - ) + result["auth"] = from_union([lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth) if self.headers is not None: - result["headers"] = from_union( - [lambda x: from_dict(from_str, x), from_none], self.headers - ) + result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.oauth_client_id is not None: result["oauthClientId"] = from_union([from_str, from_none], self.oauth_client_id) if self.oauth_grant_type is not None: - result["oauthGrantType"] = from_union( - [lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], - self.oauth_grant_type, - ) + result["oauthGrantType"] = from_union([lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], self.oauth_grant_type) if self.oauth_public_client is not None: - result["oauthPublicClient"] = from_union( - [from_bool, from_none], self.oauth_public_client - ) + result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) if self.type is not None: - result["type"] = from_union( - [lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type - ) + result["type"] = from_union([lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type) if self.url is not None: result["url"] = from_union([from_str, from_none], self.url) return result - @dataclass class MCPServerConfigHTTP: """Remote MCP server configuration accessed over HTTP or SSE.""" @@ -9092,82 +8278,46 @@ class MCPServerConfigHTTP: """Remote transport type. Defaults to "http" when omitted.""" @staticmethod - def from_dict(obj: Any) -> "MCPServerConfigHTTP": + def from_dict(obj: Any) -> 'MCPServerConfigHTTP': assert isinstance(obj, dict) url = from_str(obj.get("url")) auth = from_union([MCPServerConfigHTTPAuth.from_dict, from_none], obj.get("auth")) - filter_mapping = from_union( - [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], - obj.get("filterMapping"), - ) + filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) - oauth_grant_type = from_union( - [MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType") - ) + oauth_grant_type = from_union([MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType")) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) - return MCPServerConfigHTTP( - url, - auth, - filter_mapping, - headers, - is_default_server, - oauth_client_id, - oauth_grant_type, - oauth_public_client, - timeout, - tools, - type, - ) + return MCPServerConfigHTTP(url, auth, filter_mapping, headers, is_default_server, oauth_client_id, oauth_grant_type, oauth_public_client, timeout, tools, type) def to_dict(self) -> dict: result: dict = {} result["url"] = from_str(self.url) if self.auth is not None: - result["auth"] = from_union( - [lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth - ) + result["auth"] = from_union([lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth) if self.filter_mapping is not None: - result["filterMapping"] = from_union( - [ - lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), - lambda x: to_enum(ContentFilterMode, x), - from_none, - ], - self.filter_mapping, - ) + result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.headers is not None: - result["headers"] = from_union( - [lambda x: from_dict(from_str, x), from_none], self.headers - ) + result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) if self.oauth_client_id is not None: result["oauthClientId"] = from_union([from_str, from_none], self.oauth_client_id) if self.oauth_grant_type is not None: - result["oauthGrantType"] = from_union( - [lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], - self.oauth_grant_type, - ) + result["oauthGrantType"] = from_union([lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], self.oauth_grant_type) if self.oauth_public_client is not None: - result["oauthPublicClient"] = from_union( - [from_bool, from_none], self.oauth_public_client - ) + result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.type is not None: - result["type"] = from_union( - [lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type - ) + result["type"] = from_union([lambda x: to_enum(MCPServerConfigHTTPType, x), from_none], self.type) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSamplingExecutionResult: @@ -9188,7 +8338,7 @@ class MCPSamplingExecutionResult: """ @staticmethod - def from_dict(obj: Any) -> "MCPSamplingExecutionResult": + def from_dict(obj: Any) -> 'MCPSamplingExecutionResult': assert isinstance(obj, dict) action = MCPSamplingExecutionAction(obj.get("action")) error = from_union([from_str, from_none], obj.get("error")) @@ -9201,12 +8351,9 @@ def to_dict(self) -> dict: if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result is not None: - result["result"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.result - ) + result["result"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.result) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPServerList: @@ -9216,7 +8363,7 @@ class MCPServerList: """Configured MCP servers""" @staticmethod - def from_dict(obj: Any) -> "MCPServerList": + def from_dict(obj: Any) -> 'MCPServerList': assert isinstance(obj, dict) servers = from_list(MCPServer.from_dict, obj.get("servers")) return MCPServerList(servers) @@ -9226,7 +8373,6 @@ def to_dict(self) -> dict: result["servers"] = from_list(lambda x: to_class(MCPServer, x), self.servers) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSetEnvValueModeParams: @@ -9241,7 +8387,7 @@ class MCPSetEnvValueModeParams: """ @staticmethod - def from_dict(obj: Any) -> "MCPSetEnvValueModeParams": + def from_dict(obj: Any) -> 'MCPSetEnvValueModeParams': assert isinstance(obj, dict) mode = MCPSetEnvValueModeDetails(obj.get("mode")) return MCPSetEnvValueModeParams(mode) @@ -9251,7 +8397,6 @@ def to_dict(self) -> dict: result["mode"] = to_enum(MCPSetEnvValueModeDetails, self.mode) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPSetEnvValueModeResult: @@ -9261,7 +8406,7 @@ class MCPSetEnvValueModeResult: """Mode recorded on the session after the update""" @staticmethod - def from_dict(obj: Any) -> "MCPSetEnvValueModeResult": + def from_dict(obj: Any) -> 'MCPSetEnvValueModeResult': assert isinstance(obj, dict) mode = MCPSetEnvValueModeDetails(obj.get("mode")) return MCPSetEnvValueModeResult(mode) @@ -9271,7 +8416,6 @@ def to_dict(self) -> dict: result["mode"] = to_enum(MCPSetEnvValueModeDetails, self.mode) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataContextInfoResult: @@ -9283,7 +8427,7 @@ class MetadataContextInfoResult: """ @staticmethod - def from_dict(obj: Any) -> "MetadataContextInfoResult": + def from_dict(obj: Any) -> 'MetadataContextInfoResult': assert isinstance(obj, dict) context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("contextInfo")) return MetadataContextInfoResult(context_info) @@ -9291,19 +8435,15 @@ def from_dict(obj: Any) -> "MetadataContextInfoResult": def to_dict(self) -> dict: result: dict = {} if self.context_info is not None: - result["contextInfo"] = from_union( - [lambda x: to_class(SessionContextInfo, x), from_none], self.context_info - ) + result["contextInfo"] = from_union([lambda x: to_class(SessionContextInfo, x), from_none], self.context_info) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionWorkingDirectoryContext: """Updated working directory and git context. Emitted as the new payload of `session.context_changed`. """ - cwd: str """Current working directory path""" @@ -9330,7 +8470,7 @@ class SessionWorkingDirectoryContext: """Raw host string from the git remote URL (e.g. "github.com", "dev.azure.com")""" @staticmethod - def from_dict(obj: Any) -> "SessionWorkingDirectoryContext": + def from_dict(obj: Any) -> 'SessionWorkingDirectoryContext': assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) base_commit = from_union([from_str, from_none], obj.get("baseCommit")) @@ -9340,9 +8480,7 @@ def from_dict(obj: Any) -> "SessionWorkingDirectoryContext": host_type = from_union([HostType, from_none], obj.get("hostType")) repository = from_union([from_str, from_none], obj.get("repository")) repository_host = from_union([from_str, from_none], obj.get("repositoryHost")) - return SessionWorkingDirectoryContext( - cwd, base_commit, branch, git_root, head_commit, host_type, repository, repository_host - ) + return SessionWorkingDirectoryContext(cwd, base_commit, branch, git_root, head_commit, host_type, repository, repository_host) def to_dict(self) -> dict: result: dict = {} @@ -9356,16 +8494,13 @@ def to_dict(self) -> dict: if self.head_commit is not None: result["headCommit"] = from_union([from_str, from_none], self.head_commit) if self.host_type is not None: - result["hostType"] = from_union( - [lambda x: to_enum(HostType, x), from_none], self.host_type - ) + result["hostType"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) if self.repository_host is not None: result["repositoryHost"] = from_union([from_str, from_none], self.repository_host) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionContext: @@ -9374,7 +8509,6 @@ class SessionContext: Optional working-directory context used to score session relevance. When omitted the most-recently-modified session wins. """ - cwd: str """Most recent working directory for this session""" @@ -9391,7 +8525,7 @@ class SessionContext: """Repository slug in `owner/name` form, when known""" @staticmethod - def from_dict(obj: Any) -> "SessionContext": + def from_dict(obj: Any) -> 'SessionContext': assert isinstance(obj, dict) cwd = from_str(obj.get("cwd")) branch = from_union([from_str, from_none], obj.get("branch")) @@ -9408,14 +8542,11 @@ def to_dict(self) -> dict: if self.git_root is not None: result["gitRoot"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: - result["hostType"] = from_union( - [lambda x: to_enum(HostType, x), from_none], self.host_type - ) + result["hostType"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.repository is not None: result["repository"] = from_union([from_str, from_none], self.repository) return result - @dataclass class Workspace: id: str @@ -9438,13 +8569,11 @@ class Workspace: user_named: bool | None = None @staticmethod - def from_dict(obj: Any) -> "Workspace": + def from_dict(obj: Any) -> 'Workspace': assert isinstance(obj, dict) id = from_str(obj.get("id")) branch = from_union([from_str, from_none], obj.get("branch")) - chronicle_sync_dismissed = from_union( - [from_bool, from_none], obj.get("chronicle_sync_dismissed") - ) + chronicle_sync_dismissed = from_union([from_bool, from_none], obj.get("chronicle_sync_dismissed")) created_at = from_union([from_datetime, from_none], obj.get("created_at")) cwd = from_union([from_str, from_none], obj.get("cwd")) git_root = from_union([from_str, from_none], obj.get("git_root")) @@ -9458,24 +8587,7 @@ def from_dict(obj: Any) -> "Workspace": summary_count = from_union([from_int, from_none], obj.get("summary_count")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) user_named = from_union([from_bool, from_none], obj.get("user_named")) - return Workspace( - id, - branch, - chronicle_sync_dismissed, - created_at, - cwd, - git_root, - host_type, - mc_last_event_id, - mc_session_id, - mc_task_id, - name, - remote_steerable, - repository, - summary_count, - updated_at, - user_named, - ) + return Workspace(id, branch, chronicle_sync_dismissed, created_at, cwd, git_root, host_type, mc_last_event_id, mc_session_id, mc_task_id, name, remote_steerable, repository, summary_count, updated_at, user_named) def to_dict(self) -> dict: result: dict = {} @@ -9483,9 +8595,7 @@ def to_dict(self) -> dict: if self.branch is not None: result["branch"] = from_union([from_str, from_none], self.branch) if self.chronicle_sync_dismissed is not None: - result["chronicle_sync_dismissed"] = from_union( - [from_bool, from_none], self.chronicle_sync_dismissed - ) + result["chronicle_sync_dismissed"] = from_union([from_bool, from_none], self.chronicle_sync_dismissed) if self.created_at is not None: result["created_at"] = from_union([lambda x: x.isoformat(), from_none], self.created_at) if self.cwd is not None: @@ -9493,9 +8603,7 @@ def to_dict(self) -> dict: if self.git_root is not None: result["git_root"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: - result["host_type"] = from_union( - [lambda x: to_enum(HostType, x), from_none], self.host_type - ) + result["host_type"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.mc_last_event_id is not None: result["mc_last_event_id"] = from_union([from_str, from_none], self.mc_last_event_id) if self.mc_session_id is not None: @@ -9516,14 +8624,12 @@ def to_dict(self) -> dict: result["user_named"] = from_union([from_bool, from_none], self.user_named) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataSnapshotRemoteMetadata: """Remote-session-specific metadata. Populated only when `isRemote` is true. Fields are immutable for the lifetime of the session. """ - repository: MetadataSnapshotRemoteMetadataRepository """The repository the remote session targets.""" @@ -9540,35 +8646,25 @@ class MetadataSnapshotRemoteMetadata: """ @staticmethod - def from_dict(obj: Any) -> "MetadataSnapshotRemoteMetadata": + def from_dict(obj: Any) -> 'MetadataSnapshotRemoteMetadata': assert isinstance(obj, dict) repository = MetadataSnapshotRemoteMetadataRepository.from_dict(obj.get("repository")) pull_request_number = from_union([from_int, from_none], obj.get("pullRequestNumber")) resource_id = from_union([from_str, from_none], obj.get("resourceId")) - task_type = from_union( - [MetadataSnapshotRemoteMetadataTaskType, from_none], obj.get("taskType") - ) - return MetadataSnapshotRemoteMetadata( - repository, pull_request_number, resource_id, task_type - ) + task_type = from_union([MetadataSnapshotRemoteMetadataTaskType, from_none], obj.get("taskType")) + return MetadataSnapshotRemoteMetadata(repository, pull_request_number, resource_id, task_type) def to_dict(self) -> dict: result: dict = {} result["repository"] = to_class(MetadataSnapshotRemoteMetadataRepository, self.repository) if self.pull_request_number is not None: - result["pullRequestNumber"] = from_union( - [from_int, from_none], self.pull_request_number - ) + result["pullRequestNumber"] = from_union([from_int, from_none], self.pull_request_number) if self.resource_id is not None: result["resourceId"] = from_union([from_str, from_none], self.resource_id) if self.task_type is not None: - result["taskType"] = from_union( - [lambda x: to_enum(MetadataSnapshotRemoteMetadataTaskType, x), from_none], - self.task_type, - ) + result["taskType"] = from_union([lambda x: to_enum(MetadataSnapshotRemoteMetadataTaskType, x), from_none], self.task_type) return result - @dataclass class ModelBillingTokenPrices: """Token-level pricing information for this model""" @@ -9592,19 +8688,15 @@ class ModelBillingTokenPrices: """AI Credits cost per billing batch of output tokens""" @staticmethod - def from_dict(obj: Any) -> "ModelBillingTokenPrices": + def from_dict(obj: Any) -> 'ModelBillingTokenPrices': assert isinstance(obj, dict) batch_size = from_union([from_int, from_none], obj.get("batchSize")) cache_price = from_union([from_float, from_none], obj.get("cachePrice")) context_max = from_union([from_int, from_none], obj.get("contextMax")) input_price = from_union([from_float, from_none], obj.get("inputPrice")) - long_context = from_union( - [ModelBillingTokenPricesLongContext.from_dict, from_none], obj.get("longContext") - ) + long_context = from_union([ModelBillingTokenPricesLongContext.from_dict, from_none], obj.get("longContext")) output_price = from_union([from_float, from_none], obj.get("outputPrice")) - return ModelBillingTokenPrices( - batch_size, cache_price, context_max, input_price, long_context, output_price - ) + return ModelBillingTokenPrices(batch_size, cache_price, context_max, input_price, long_context, output_price) def to_dict(self) -> dict: result: dict = {} @@ -9617,15 +8709,11 @@ def to_dict(self) -> dict: if self.input_price is not None: result["inputPrice"] = from_union([to_float, from_none], self.input_price) if self.long_context is not None: - result["longContext"] = from_union( - [lambda x: to_class(ModelBillingTokenPricesLongContext, x), from_none], - self.long_context, - ) + result["longContext"] = from_union([lambda x: to_class(ModelBillingTokenPricesLongContext, x), from_none], self.long_context) if self.output_price is not None: result["outputPrice"] = from_union([to_float, from_none], self.output_price) return result - @dataclass class ModelCapabilitiesLimits: """Token limits for prompts, outputs, and context window""" @@ -9643,35 +8731,26 @@ class ModelCapabilitiesLimits: """Vision-specific limits""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesLimits": + def from_dict(obj: Any) -> 'ModelCapabilitiesLimits': assert isinstance(obj, dict) - max_context_window_tokens = from_union( - [from_int, from_none], obj.get("max_context_window_tokens") - ) + max_context_window_tokens = from_union([from_int, from_none], obj.get("max_context_window_tokens")) max_output_tokens = from_union([from_int, from_none], obj.get("max_output_tokens")) max_prompt_tokens = from_union([from_int, from_none], obj.get("max_prompt_tokens")) vision = from_union([ModelCapabilitiesLimitsVision.from_dict, from_none], obj.get("vision")) - return ModelCapabilitiesLimits( - max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision - ) + return ModelCapabilitiesLimits(max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision) def to_dict(self) -> dict: result: dict = {} if self.max_context_window_tokens is not None: - result["max_context_window_tokens"] = from_union( - [from_int, from_none], self.max_context_window_tokens - ) + result["max_context_window_tokens"] = from_union([from_int, from_none], self.max_context_window_tokens) if self.max_output_tokens is not None: result["max_output_tokens"] = from_union([from_int, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["max_prompt_tokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.vision is not None: - result["vision"] = from_union( - [lambda x: to_class(ModelCapabilitiesLimitsVision, x), from_none], self.vision - ) + result["vision"] = from_union([lambda x: to_class(ModelCapabilitiesLimitsVision, x), from_none], self.vision) return result - @dataclass class ModelPolicy: """Policy state (if applicable)""" @@ -9683,7 +8762,7 @@ class ModelPolicy: """Usage terms or conditions for this model""" @staticmethod - def from_dict(obj: Any) -> "ModelPolicy": + def from_dict(obj: Any) -> 'ModelPolicy': assert isinstance(obj, dict) state = ModelPolicyState(obj.get("state")) terms = from_union([from_str, from_none], obj.get("terms")) @@ -9696,7 +8775,6 @@ def to_dict(self) -> dict: result["terms"] = from_union([from_str, from_none], self.terms) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverrideLimits: @@ -9715,38 +8793,26 @@ class ModelCapabilitiesOverrideLimits: """Vision-specific limits""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesOverrideLimits": + def from_dict(obj: Any) -> 'ModelCapabilitiesOverrideLimits': assert isinstance(obj, dict) - max_context_window_tokens = from_union( - [from_int, from_none], obj.get("max_context_window_tokens") - ) + max_context_window_tokens = from_union([from_int, from_none], obj.get("max_context_window_tokens")) max_output_tokens = from_union([from_int, from_none], obj.get("max_output_tokens")) max_prompt_tokens = from_union([from_int, from_none], obj.get("max_prompt_tokens")) - vision = from_union( - [ModelCapabilitiesOverrideLimitsVision.from_dict, from_none], obj.get("vision") - ) - return ModelCapabilitiesOverrideLimits( - max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision - ) + vision = from_union([ModelCapabilitiesOverrideLimitsVision.from_dict, from_none], obj.get("vision")) + return ModelCapabilitiesOverrideLimits(max_context_window_tokens, max_output_tokens, max_prompt_tokens, vision) def to_dict(self) -> dict: result: dict = {} if self.max_context_window_tokens is not None: - result["max_context_window_tokens"] = from_union( - [from_int, from_none], self.max_context_window_tokens - ) + result["max_context_window_tokens"] = from_union([from_int, from_none], self.max_context_window_tokens) if self.max_output_tokens is not None: result["max_output_tokens"] = from_union([from_int, from_none], self.max_output_tokens) if self.max_prompt_tokens is not None: result["max_prompt_tokens"] = from_union([from_int, from_none], self.max_prompt_tokens) if self.vision is not None: - result["vision"] = from_union( - [lambda x: to_class(ModelCapabilitiesOverrideLimitsVision, x), from_none], - self.vision, - ) + result["vision"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideLimitsVision, x), from_none], self.vision) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PendingPermissionRequestList: @@ -9760,7 +8826,7 @@ class PendingPermissionRequestList: """ @staticmethod - def from_dict(obj: Any) -> "PendingPermissionRequestList": + def from_dict(obj: Any) -> 'PendingPermissionRequestList': assert isinstance(obj, dict) items = from_list(PendingPermissionRequest.from_dict, obj.get("items")) return PendingPermissionRequestList(items) @@ -9770,7 +8836,6 @@ def to_dict(self) -> dict: result["items"] = from_list(lambda x: to_class(PendingPermissionRequest, x), self.items) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocation: @@ -9786,7 +8851,7 @@ class PermissionDecisionApproveForLocation: """Location key (git root or cwd) to persist the approval to""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocation": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocation': assert isinstance(obj, dict) approval = _load_PermissionDecisionApproveForLocationApproval(obj.get("approval")) location_key = from_str(obj.get("locationKey")) @@ -9799,7 +8864,6 @@ def to_dict(self) -> dict: result["locationKey"] = from_str(self.location_key) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalCommands: @@ -9812,7 +8876,7 @@ class PermissionDecisionApproveForLocationApprovalCommands: """Approval scoped to specific command identifiers.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalCommands": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalCommands': assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionDecisionApproveForLocationApprovalCommands(command_identifiers) @@ -9823,7 +8887,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalCommands: @@ -9836,7 +8899,7 @@ class PermissionDecisionApproveForSessionApprovalCommands: """Approval scoped to specific command identifiers.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalCommands": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalCommands': assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionDecisionApproveForSessionApprovalCommands(command_identifiers) @@ -9847,7 +8910,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsCommands: @@ -9860,7 +8922,7 @@ class PermissionsLocationsAddToolApprovalDetailsCommands: """Approval scoped to specific command identifiers.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsCommands": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsCommands': assert isinstance(obj, dict) command_identifiers = from_list(from_str, obj.get("commandIdentifiers")) return PermissionsLocationsAddToolApprovalDetailsCommands(command_identifiers) @@ -9871,7 +8933,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalCustomTool: @@ -9884,7 +8945,7 @@ class PermissionDecisionApproveForLocationApprovalCustomTool: """Custom tool name.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalCustomTool": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalCustomTool': assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionDecisionApproveForLocationApprovalCustomTool(tool_name) @@ -9895,7 +8956,6 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalCustomTool: @@ -9908,7 +8968,7 @@ class PermissionDecisionApproveForSessionApprovalCustomTool: """Custom tool name.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalCustomTool": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalCustomTool': assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionDecisionApproveForSessionApprovalCustomTool(tool_name) @@ -9919,7 +8979,6 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsCustomTool: @@ -9932,7 +8991,7 @@ class PermissionsLocationsAddToolApprovalDetailsCustomTool: """Custom tool name.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsCustomTool": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsCustomTool': assert isinstance(obj, dict) tool_name = from_str(obj.get("toolName")) return PermissionsLocationsAddToolApprovalDetailsCustomTool(tool_name) @@ -9943,7 +9002,6 @@ def to_dict(self) -> dict: result["toolName"] = from_str(self.tool_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalExtensionManagement: @@ -9958,7 +9016,7 @@ class PermissionDecisionApproveForLocationApprovalExtensionManagement: """ @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalExtensionManagement": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalExtensionManagement': assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionDecisionApproveForLocationApprovalExtensionManagement(operation) @@ -9970,7 +9028,6 @@ def to_dict(self) -> dict: result["operation"] = from_union([from_str, from_none], self.operation) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalExtensionManagement: @@ -9985,7 +9042,7 @@ class PermissionDecisionApproveForSessionApprovalExtensionManagement: """ @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalExtensionManagement": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalExtensionManagement': assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionDecisionApproveForSessionApprovalExtensionManagement(operation) @@ -9997,7 +9054,6 @@ def to_dict(self) -> dict: result["operation"] = from_union([from_str, from_none], self.operation) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsExtensionManagement: @@ -10012,7 +9068,7 @@ class PermissionsLocationsAddToolApprovalDetailsExtensionManagement: """ @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsExtensionManagement": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsExtensionManagement': assert isinstance(obj, dict) operation = from_union([from_str, from_none], obj.get("operation")) return PermissionsLocationsAddToolApprovalDetailsExtensionManagement(operation) @@ -10024,7 +9080,6 @@ def to_dict(self) -> dict: result["operation"] = from_union([from_str, from_none], self.operation) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMCP: @@ -10040,7 +9095,7 @@ class PermissionDecisionApproveForLocationApprovalMCP: """MCP tool name, or null to cover every tool on the server.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalMCP": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMCP': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) @@ -10053,7 +9108,6 @@ def to_dict(self) -> dict: result["toolName"] = from_union([from_none, from_str], self.tool_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMCP: @@ -10069,7 +9123,7 @@ class PermissionDecisionApproveForSessionApprovalMCP: """MCP tool name, or null to cover every tool on the server.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalMCP": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMCP': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) @@ -10082,7 +9136,6 @@ def to_dict(self) -> dict: result["toolName"] = from_union([from_none, from_str], self.tool_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMCP: @@ -10098,7 +9151,7 @@ class PermissionsLocationsAddToolApprovalDetailsMCP: """MCP tool name, or null to cover every tool on the server.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsMCP": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMCP': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) @@ -10111,7 +9164,6 @@ def to_dict(self) -> dict: result["toolName"] = from_union([from_none, from_str], self.tool_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMCPSampling: @@ -10124,7 +9176,7 @@ class PermissionDecisionApproveForLocationApprovalMCPSampling: """MCP server name.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalMCPSampling": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMCPSampling': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionDecisionApproveForLocationApprovalMCPSampling(server_name) @@ -10135,7 +9187,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMCPSampling: @@ -10148,7 +9199,7 @@ class PermissionDecisionApproveForSessionApprovalMCPSampling: """MCP server name.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalMCPSampling": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMCPSampling': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionDecisionApproveForSessionApprovalMCPSampling(server_name) @@ -10159,7 +9210,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMCPSampling: @@ -10172,7 +9222,7 @@ class PermissionsLocationsAddToolApprovalDetailsMCPSampling: """MCP server name.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsMCPSampling": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMCPSampling': assert isinstance(obj, dict) server_name = from_str(obj.get("serverName")) return PermissionsLocationsAddToolApprovalDetailsMCPSampling(server_name) @@ -10183,7 +9233,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalMemory: @@ -10193,7 +9242,7 @@ class PermissionDecisionApproveForLocationApprovalMemory: """Approval covering writes to long-term memory.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalMemory": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalMemory': assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalMemory() @@ -10202,7 +9251,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalMemory: @@ -10212,7 +9260,7 @@ class PermissionDecisionApproveForSessionApprovalMemory: """Approval covering writes to long-term memory.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalMemory": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalMemory': assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalMemory() @@ -10221,7 +9269,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsMemory: @@ -10231,7 +9278,7 @@ class PermissionsLocationsAddToolApprovalDetailsMemory: """Approval covering writes to long-term memory.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsMemory": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsMemory': assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsMemory() @@ -10240,7 +9287,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalRead: @@ -10250,7 +9296,7 @@ class PermissionDecisionApproveForLocationApprovalRead: """Approval covering read-only filesystem operations.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalRead": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalRead': assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalRead() @@ -10259,7 +9305,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalRead: @@ -10269,7 +9314,7 @@ class PermissionDecisionApproveForSessionApprovalRead: """Approval covering read-only filesystem operations.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalRead": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalRead': assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalRead() @@ -10278,7 +9323,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsRead: @@ -10288,7 +9332,7 @@ class PermissionsLocationsAddToolApprovalDetailsRead: """Approval covering read-only filesystem operations.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsRead": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsRead': assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsRead() @@ -10297,7 +9341,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalWrite: @@ -10307,7 +9350,7 @@ class PermissionDecisionApproveForLocationApprovalWrite: """Approval covering filesystem write operations.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForLocationApprovalWrite": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalWrite': assert isinstance(obj, dict) return PermissionDecisionApproveForLocationApprovalWrite() @@ -10316,7 +9359,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalWrite: @@ -10326,7 +9368,7 @@ class PermissionDecisionApproveForSessionApprovalWrite: """Approval covering filesystem write operations.""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSessionApprovalWrite": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalWrite': assert isinstance(obj, dict) return PermissionDecisionApproveForSessionApprovalWrite() @@ -10335,7 +9377,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsWrite: @@ -10345,7 +9386,7 @@ class PermissionsLocationsAddToolApprovalDetailsWrite: """Approval covering filesystem write operations.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsLocationsAddToolApprovalDetailsWrite": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsWrite': assert isinstance(obj, dict) return PermissionsLocationsAddToolApprovalDetailsWrite() @@ -10354,7 +9395,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSession: @@ -10370,11 +9410,9 @@ class PermissionDecisionApproveForSession: """URL domain to approve for the rest of the session (URL prompts only)""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForSession": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSession': assert isinstance(obj, dict) - approval = from_union( - [_load_PermissionDecisionApproveForSessionApproval, from_none], obj.get("approval") - ) + approval = from_union([_load_PermissionDecisionApproveForSessionApproval, from_none], obj.get("approval")) domain = from_union([from_str, from_none], obj.get("domain")) return PermissionDecisionApproveForSession(approval, domain) @@ -10387,7 +9425,6 @@ def to_dict(self) -> dict: result["domain"] = from_union([from_str, from_none], self.domain) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveOnce: @@ -10397,7 +9434,7 @@ class PermissionDecisionApproveOnce: """Approve this single request only""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveOnce": + def from_dict(obj: Any) -> 'PermissionDecisionApproveOnce': assert isinstance(obj, dict) return PermissionDecisionApproveOnce() @@ -10406,7 +9443,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovePermanently: @@ -10419,7 +9455,7 @@ class PermissionDecisionApprovePermanently: """Approve and persist across sessions (URL prompts only)""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApprovePermanently": + def from_dict(obj: Any) -> 'PermissionDecisionApprovePermanently': assert isinstance(obj, dict) domain = from_str(obj.get("domain")) return PermissionDecisionApprovePermanently(domain) @@ -10430,7 +9466,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproved: @@ -10440,7 +9475,7 @@ class PermissionDecisionApproved: """The permission request was approved""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproved": + def from_dict(obj: Any) -> 'PermissionDecisionApproved': assert isinstance(obj, dict) return PermissionDecisionApproved() @@ -10449,7 +9484,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovedForLocation: @@ -10465,7 +9499,7 @@ class PermissionDecisionApprovedForLocation: """The location key (git root or cwd) to persist the approval to""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApprovedForLocation": + def from_dict(obj: Any) -> 'PermissionDecisionApprovedForLocation': assert isinstance(obj, dict) approval = UserToolSessionApproval.from_dict(obj.get("approval")) location_key = from_str(obj.get("locationKey")) @@ -10478,7 +9512,6 @@ def to_dict(self) -> dict: result["locationKey"] = from_str(self.location_key) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApprovedForSession: @@ -10491,7 +9524,7 @@ class PermissionDecisionApprovedForSession: """Approved and remembered for the rest of the session""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApprovedForSession": + def from_dict(obj: Any) -> 'PermissionDecisionApprovedForSession': assert isinstance(obj, dict) approval = UserToolSessionApproval.from_dict(obj.get("approval")) return PermissionDecisionApprovedForSession(approval) @@ -10502,7 +9535,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionCancelled: @@ -10515,7 +9547,7 @@ class PermissionDecisionCancelled: """Optional explanation of why the request was cancelled""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionCancelled": + def from_dict(obj: Any) -> 'PermissionDecisionCancelled': assert isinstance(obj, dict) reason = from_union([from_str, from_none], obj.get("reason")) return PermissionDecisionCancelled(reason) @@ -10527,7 +9559,6 @@ def to_dict(self) -> dict: result["reason"] = from_union([from_str, from_none], self.reason) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByContentExclusionPolicy: @@ -10543,7 +9574,7 @@ class PermissionDecisionDeniedByContentExclusionPolicy: """File path that triggered the exclusion""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionDeniedByContentExclusionPolicy": + def from_dict(obj: Any) -> 'PermissionDecisionDeniedByContentExclusionPolicy': assert isinstance(obj, dict) message = from_str(obj.get("message")) path = from_str(obj.get("path")) @@ -10556,7 +9587,6 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByPermissionRequestHook: @@ -10572,7 +9602,7 @@ class PermissionDecisionDeniedByPermissionRequestHook: """Optional message from the hook explaining the denial""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionDeniedByPermissionRequestHook": + def from_dict(obj: Any) -> 'PermissionDecisionDeniedByPermissionRequestHook': assert isinstance(obj, dict) interrupt = from_union([from_bool, from_none], obj.get("interrupt")) message = from_union([from_str, from_none], obj.get("message")) @@ -10587,7 +9617,6 @@ def to_dict(self) -> dict: result["message"] = from_union([from_str, from_none], self.message) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedByRules: @@ -10600,7 +9629,7 @@ class PermissionDecisionDeniedByRules: """Rules that denied the request""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionDeniedByRules": + def from_dict(obj: Any) -> 'PermissionDecisionDeniedByRules': assert isinstance(obj, dict) rules = from_list(PermissionRule.from_dict, obj.get("rules")) return PermissionDecisionDeniedByRules(rules) @@ -10611,7 +9640,6 @@ def to_dict(self) -> dict: result["rules"] = from_list(lambda x: to_class(PermissionRule, x), self.rules) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedInteractivelyByUser: @@ -10627,7 +9655,7 @@ class PermissionDecisionDeniedInteractivelyByUser: """Whether to force-reject the current agent turn""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionDeniedInteractivelyByUser": + def from_dict(obj: Any) -> 'PermissionDecisionDeniedInteractivelyByUser': assert isinstance(obj, dict) feedback = from_union([from_str, from_none], obj.get("feedback")) force_reject = from_union([from_bool, from_none], obj.get("forceReject")) @@ -10642,7 +9670,6 @@ def to_dict(self) -> dict: result["forceReject"] = from_union([from_bool, from_none], self.force_reject) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser: @@ -10652,7 +9679,7 @@ class PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser: """Denied because no approval rule matched and user confirmation was unavailable""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser": + def from_dict(obj: Any) -> 'PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser': assert isinstance(obj, dict) return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser() @@ -10661,7 +9688,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionReject: @@ -10674,7 +9700,7 @@ class PermissionDecisionReject: """Optional feedback explaining the rejection""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionReject": + def from_dict(obj: Any) -> 'PermissionDecisionReject': assert isinstance(obj, dict) feedback = from_union([from_str, from_none], obj.get("feedback")) return PermissionDecisionReject(feedback) @@ -10686,7 +9712,6 @@ def to_dict(self) -> dict: result["feedback"] = from_union([from_str, from_none], self.feedback) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionUserNotAvailable: @@ -10696,7 +9721,7 @@ class PermissionDecisionUserNotAvailable: """No user is available to confirm the request""" @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionUserNotAvailable": + def from_dict(obj: Any) -> 'PermissionDecisionUserNotAvailable': assert isinstance(obj, dict) return PermissionDecisionUserNotAvailable() @@ -10705,7 +9730,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationApplyResult: @@ -10730,7 +9754,7 @@ class PermissionLocationApplyResult: """Whether the location is a git repo or directory""" @staticmethod - def from_dict(obj: Any) -> "PermissionLocationApplyResult": + def from_dict(obj: Any) -> 'PermissionLocationApplyResult': assert isinstance(obj, dict) applied_directory_count = from_int(obj.get("appliedDirectoryCount")) applied_rule_count = from_int(obj.get("appliedRuleCount")) @@ -10738,28 +9762,18 @@ def from_dict(obj: Any) -> "PermissionLocationApplyResult": changed = from_bool(obj.get("changed")) location_key = from_str(obj.get("locationKey")) location_type = PermissionLocationType(obj.get("locationType")) - return PermissionLocationApplyResult( - applied_directory_count, - applied_rule_count, - applied_rules, - changed, - location_key, - location_type, - ) + return PermissionLocationApplyResult(applied_directory_count, applied_rule_count, applied_rules, changed, location_key, location_type) def to_dict(self) -> dict: result: dict = {} result["appliedDirectoryCount"] = from_int(self.applied_directory_count) result["appliedRuleCount"] = from_int(self.applied_rule_count) - result["appliedRules"] = from_list( - lambda x: to_class(PermissionRule, x), self.applied_rules - ) + result["appliedRules"] = from_list(lambda x: to_class(PermissionRule, x), self.applied_rules) result["changed"] = from_bool(self.changed) result["locationKey"] = from_str(self.location_key) result["locationType"] = to_enum(PermissionLocationType, self.location_type) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationResolveResult: @@ -10772,7 +9786,7 @@ class PermissionLocationResolveResult: """Whether the location is a git repo or directory""" @staticmethod - def from_dict(obj: Any) -> "PermissionLocationResolveResult": + def from_dict(obj: Any) -> 'PermissionLocationResolveResult': assert isinstance(obj, dict) location_key = from_str(obj.get("locationKey")) location_type = PermissionLocationType(obj.get("locationType")) @@ -10784,7 +9798,6 @@ def to_dict(self) -> dict: result["locationType"] = to_enum(PermissionLocationType, self.location_type) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicyRule: @@ -10798,46 +9811,30 @@ class PermissionsConfigureAdditionalContentExclusionPolicyRule: if_none_match: list[str] | None = None @staticmethod - def from_dict(obj: Any) -> "PermissionsConfigureAdditionalContentExclusionPolicyRule": + def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicyRule': assert isinstance(obj, dict) paths = from_list(from_str, obj.get("paths")) - source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict( - obj.get("source") - ) - if_any_match = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch") - ) - if_none_match = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch") - ) - return PermissionsConfigureAdditionalContentExclusionPolicyRule( - paths, source, if_any_match, if_none_match - ) + source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("source")) + if_any_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifAnyMatch")) + if_none_match = from_union([lambda x: from_list(from_str, x), from_none], obj.get("ifNoneMatch")) + return PermissionsConfigureAdditionalContentExclusionPolicyRule(paths, source, if_any_match, if_none_match) def to_dict(self) -> dict: result: dict = {} result["paths"] = from_list(from_str, self.paths) - result["source"] = to_class( - PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.source - ) + result["source"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.source) if self.if_any_match is not None: - result["ifAnyMatch"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.if_any_match - ) + result["ifAnyMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_any_match) if self.if_none_match is not None: - result["ifNoneMatch"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.if_none_match - ) + result["ifNoneMatch"] = from_union([lambda x: from_list(from_str, x), from_none], self.if_none_match) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsModifyRulesParams: """Scope and add/remove instructions for modifying session- or location-scoped permission rules. """ - scope: PermissionsModifyRulesScope """Whether the change applies to ephemeral session-scoped rules (cleared at session end) or to location-scoped rules persisted via the location-permissions config file. @@ -10854,15 +9851,11 @@ class PermissionsModifyRulesParams: """ @staticmethod - def from_dict(obj: Any) -> "PermissionsModifyRulesParams": + def from_dict(obj: Any) -> 'PermissionsModifyRulesParams': assert isinstance(obj, dict) scope = PermissionsModifyRulesScope(obj.get("scope")) - add = from_union( - [lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("add") - ) - remove = from_union( - [lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("remove") - ) + add = from_union([lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("add")) + remove = from_union([lambda x: from_list(PermissionRule.from_dict, x), from_none], obj.get("remove")) remove_all = from_union([from_bool, from_none], obj.get("removeAll")) return PermissionsModifyRulesParams(scope, add, remove, remove_all) @@ -10870,19 +9863,13 @@ def to_dict(self) -> dict: result: dict = {} result["scope"] = to_enum(PermissionsModifyRulesScope, self.scope) if self.add is not None: - result["add"] = from_union( - [lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.add - ) + result["add"] = from_union([lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.add) if self.remove is not None: - result["remove"] = from_union( - [lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], - self.remove, - ) + result["remove"] = from_union([lambda x: from_list(lambda x: to_class(PermissionRule, x), x), from_none], self.remove) if self.remove_all is not None: result["removeAll"] = from_union([from_bool, from_none], self.remove_all) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PluginList: @@ -10892,7 +9879,7 @@ class PluginList: """Installed plugins""" @staticmethod - def from_dict(obj: Any) -> "PluginList": + def from_dict(obj: Any) -> 'PluginList': assert isinstance(obj, dict) plugins = from_list(Plugin.from_dict, obj.get("plugins")) return PluginList(plugins) @@ -10902,7 +9889,6 @@ def to_dict(self) -> dict: result["plugins"] = from_list(lambda x: to_class(Plugin, x), self.plugins) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuePendingItems: @@ -10915,7 +9901,7 @@ class QueuePendingItems: """Whether this item is a queued user message or a queued slash command / model change""" @staticmethod - def from_dict(obj: Any) -> "QueuePendingItems": + def from_dict(obj: Any) -> 'QueuePendingItems': assert isinstance(obj, dict) display_text = from_str(obj.get("displayText")) kind = QueuePendingItemsKind(obj.get("kind")) @@ -10927,21 +9913,19 @@ def to_dict(self) -> dict: result["kind"] = to_enum(QueuePendingItemsKind, self.kind) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteEnableRequest: """Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering. """ - mode: RemoteSessionMode | None = None """Per-session remote mode. "off" disables remote, "export" exports session events to GitHub without enabling remote steering, "on" enables both export and remote steering. """ @staticmethod - def from_dict(obj: Any) -> "RemoteEnableRequest": + def from_dict(obj: Any) -> 'RemoteEnableRequest': assert isinstance(obj, dict) mode = from_union([RemoteSessionMode, from_none], obj.get("mode")) return RemoteEnableRequest(mode) @@ -10949,12 +9933,9 @@ def from_dict(obj: Any) -> "RemoteEnableRequest": def to_dict(self) -> dict: result: dict = {} if self.mode is not None: - result["mode"] = from_union( - [lambda x: to_enum(RemoteSessionMode, x), from_none], self.mode - ) + result["mode"] = from_union([lambda x: to_enum(RemoteSessionMode, x), from_none], self.mode) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleList: @@ -10964,7 +9945,7 @@ class ScheduleList: """Active scheduled prompts, ordered by id.""" @staticmethod - def from_dict(obj: Any) -> "ScheduleList": + def from_dict(obj: Any) -> 'ScheduleList': assert isinstance(obj, dict) entries = from_list(ScheduleEntry.from_dict, obj.get("entries")) return ScheduleList(entries) @@ -10974,7 +9955,6 @@ def to_dict(self) -> dict: result["entries"] = from_list(lambda x: to_class(ScheduleEntry, x), self.entries) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ScheduleStopResult: @@ -10984,7 +9964,7 @@ class ScheduleStopResult: """The removed entry, or omitted if no entry matched.""" @staticmethod - def from_dict(obj: Any) -> "ScheduleStopResult": + def from_dict(obj: Any) -> 'ScheduleStopResult': assert isinstance(obj, dict) entry = from_union([ScheduleEntry.from_dict, from_none], obj.get("entry")) return ScheduleStopResult(entry) @@ -10992,12 +9972,9 @@ def from_dict(obj: Any) -> "ScheduleStopResult": def to_dict(self) -> dict: result: dict = {} if self.entry is not None: - result["entry"] = from_union( - [lambda x: to_class(ScheduleEntry, x), from_none], self.entry - ) + result["entry"] = from_union([lambda x: to_class(ScheduleEntry, x), from_none], self.entry) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelectionDetails: @@ -11010,7 +9987,7 @@ class SendAttachmentSelectionDetails: """Start position of the selection""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentSelectionDetails": + def from_dict(obj: Any) -> 'SendAttachmentSelectionDetails': assert isinstance(obj, dict) end = SendAttachmentSelectionDetailsEnd.from_dict(obj.get("end")) start = SendAttachmentSelectionDetailsStart.from_dict(obj.get("start")) @@ -11022,7 +9999,6 @@ def to_dict(self) -> dict: result["start"] = to_class(SendAttachmentSelectionDetailsStart, self.start) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentBlob: @@ -11041,7 +10017,7 @@ class SendAttachmentBlob: """User-facing display name for the attachment""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentBlob": + def from_dict(obj: Any) -> 'SendAttachmentBlob': assert isinstance(obj, dict) data = from_str(obj.get("data")) mime_type = from_str(obj.get("mimeType")) @@ -11057,7 +10033,6 @@ def to_dict(self) -> dict: result["displayName"] = from_union([from_str, from_none], self.display_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentFile: @@ -11076,13 +10051,11 @@ class SendAttachmentFile: """Optional line range to scope the attachment to a specific section of the file""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentFile": + def from_dict(obj: Any) -> 'SendAttachmentFile': assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) path = from_str(obj.get("path")) - line_range = from_union( - [SendAttachmentFileLineRange.from_dict, from_none], obj.get("lineRange") - ) + line_range = from_union([SendAttachmentFileLineRange.from_dict, from_none], obj.get("lineRange")) return SendAttachmentFile(display_name, path, line_range) def to_dict(self) -> dict: @@ -11091,12 +10064,9 @@ def to_dict(self) -> dict: result["path"] = from_str(self.path) result["type"] = self.type if self.line_range is not None: - result["lineRange"] = from_union( - [lambda x: to_class(SendAttachmentFileLineRange, x), from_none], self.line_range - ) + result["lineRange"] = from_union([lambda x: to_class(SendAttachmentFileLineRange, x), from_none], self.line_range) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentGithubReference: @@ -11121,7 +10091,7 @@ class SendAttachmentGithubReference: """URL to the referenced item on GitHub""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentGithubReference": + def from_dict(obj: Any) -> 'SendAttachmentGithubReference': assert isinstance(obj, dict) number = from_int(obj.get("number")) reference_type = SendAttachmentGithubReferenceTypeEnum(obj.get("referenceType")) @@ -11133,16 +10103,13 @@ def from_dict(obj: Any) -> "SendAttachmentGithubReference": def to_dict(self) -> dict: result: dict = {} result["number"] = from_int(self.number) - result["referenceType"] = to_enum( - SendAttachmentGithubReferenceTypeEnum, self.reference_type - ) + result["referenceType"] = to_enum(SendAttachmentGithubReferenceTypeEnum, self.reference_type) result["state"] = from_str(self.state) result["title"] = from_str(self.title) result["type"] = self.type result["url"] = from_str(self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendRequest: @@ -11200,52 +10167,30 @@ class SendRequest: """ @staticmethod - def from_dict(obj: Any) -> "SendRequest": + def from_dict(obj: Any) -> 'SendRequest': assert isinstance(obj, dict) prompt = from_str(obj.get("prompt")) agent_mode = from_union([SendAgentMode, from_none], obj.get("agentMode")) - attachments = from_union( - [lambda x: from_list(_load_SendAttachment, x), from_none], obj.get("attachments") - ) + attachments = from_union([lambda x: from_list(_load_SendAttachment, x), from_none], obj.get("attachments")) billable = from_union([from_bool, from_none], obj.get("billable")) display_prompt = from_union([from_str, from_none], obj.get("displayPrompt")) mode = from_union([SendMode, from_none], obj.get("mode")) prepend = from_union([from_bool, from_none], obj.get("prepend")) - request_headers = from_union( - [lambda x: from_dict(from_str, x), from_none], obj.get("requestHeaders") - ) + request_headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("requestHeaders")) required_tool = from_union([from_str, from_none], obj.get("requiredTool")) source = obj.get("source") traceparent = from_union([from_str, from_none], obj.get("traceparent")) tracestate = from_union([from_str, from_none], obj.get("tracestate")) wait = from_union([from_bool, from_none], obj.get("wait")) - return SendRequest( - prompt, - agent_mode, - attachments, - billable, - display_prompt, - mode, - prepend, - request_headers, - required_tool, - source, - traceparent, - tracestate, - wait, - ) + return SendRequest(prompt, agent_mode, attachments, billable, display_prompt, mode, prepend, request_headers, required_tool, source, traceparent, tracestate, wait) def to_dict(self) -> dict: result: dict = {} result["prompt"] = from_str(self.prompt) if self.agent_mode is not None: - result["agentMode"] = from_union( - [lambda x: to_enum(SendAgentMode, x), from_none], self.agent_mode - ) + result["agentMode"] = from_union([lambda x: to_enum(SendAgentMode, x), from_none], self.agent_mode) if self.attachments is not None: - result["attachments"] = from_union( - [lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.attachments - ) + result["attachments"] = from_union([lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.attachments) if self.billable is not None: result["billable"] = from_union([from_bool, from_none], self.billable) if self.display_prompt is not None: @@ -11255,9 +10200,7 @@ def to_dict(self) -> dict: if self.prepend is not None: result["prepend"] = from_union([from_bool, from_none], self.prepend) if self.request_headers is not None: - result["requestHeaders"] = from_union( - [lambda x: from_dict(from_str, x), from_none], self.request_headers - ) + result["requestHeaders"] = from_union([lambda x: from_dict(from_str, x), from_none], self.request_headers) if self.required_tool is not None: result["requiredTool"] = from_union([from_str, from_none], self.required_tool) if self.source is not None: @@ -11270,7 +10213,6 @@ def to_dict(self) -> dict: result["wait"] = from_union([from_bool, from_none], self.wait) return result - @dataclass class ServerSkillList: """Skills discovered across global and project sources.""" @@ -11279,7 +10221,7 @@ class ServerSkillList: """All discovered skills across all sources""" @staticmethod - def from_dict(obj: Any) -> "ServerSkillList": + def from_dict(obj: Any) -> 'ServerSkillList': assert isinstance(obj, dict) skills = from_list(ServerSkill.from_dict, obj.get("skills")) return ServerSkillList(skills) @@ -11289,7 +10231,7 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(ServerSkill, x), self.skills) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSError: """Describes a filesystem error.""" @@ -11301,7 +10243,7 @@ class SessionFSError: """Free-form detail about the error, for logging/diagnostics""" @staticmethod - def from_dict(obj: Any) -> "SessionFSError": + def from_dict(obj: Any) -> 'SessionFSError': assert isinstance(obj, dict) code = SessionFSErrorCode(obj.get("code")) message = from_union([from_str, from_none], obj.get("message")) @@ -11314,7 +10256,7 @@ def to_dict(self) -> dict: result["message"] = from_union([from_str, from_none], self.message) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirWithTypesEntry: """Schema for the `SessionFsReaddirWithTypesEntry` type.""" @@ -11326,7 +10268,7 @@ class SessionFSReaddirWithTypesEntry: """Entry type""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReaddirWithTypesEntry": + def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesEntry': assert isinstance(obj, dict) name = from_str(obj.get("name")) type = SessionFSReaddirWithTypesEntryType(obj.get("type")) @@ -11338,13 +10280,11 @@ def to_dict(self) -> dict: result["type"] = to_enum(SessionFSReaddirWithTypesEntryType, self.type) return result - @dataclass class SessionFSSetProviderRequest: """Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider. """ - conventions: SessionFSSetProviderConventions """Path conventions used by this filesystem""" @@ -11358,17 +10298,13 @@ class SessionFSSetProviderRequest: """Optional capabilities declared by the provider""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSetProviderRequest": + def from_dict(obj: Any) -> 'SessionFSSetProviderRequest': assert isinstance(obj, dict) conventions = SessionFSSetProviderConventions(obj.get("conventions")) initial_cwd = from_str(obj.get("initialCwd")) session_state_path = from_str(obj.get("sessionStatePath")) - capabilities = from_union( - [SessionFSSetProviderCapabilities.from_dict, from_none], obj.get("capabilities") - ) - return SessionFSSetProviderRequest( - conventions, initial_cwd, session_state_path, capabilities - ) + capabilities = from_union([SessionFSSetProviderCapabilities.from_dict, from_none], obj.get("capabilities")) + return SessionFSSetProviderRequest(conventions, initial_cwd, session_state_path, capabilities) def to_dict(self) -> dict: result: dict = {} @@ -11376,19 +10312,15 @@ def to_dict(self) -> dict: result["initialCwd"] = from_str(self.initial_cwd) result["sessionStatePath"] = from_str(self.session_state_path) if self.capabilities is not None: - result["capabilities"] = from_union( - [lambda x: to_class(SessionFSSetProviderCapabilities, x), from_none], - self.capabilities, - ) + result["capabilities"] = from_union([lambda x: to_class(SessionFSSetProviderCapabilities, x), from_none], self.capabilities) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteQueryRequest: """SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. """ - query: str """SQL query to execute""" @@ -11403,18 +10335,12 @@ class SessionFSSqliteQueryRequest: """Optional named bind parameters""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSqliteQueryRequest": + def from_dict(obj: Any) -> 'SessionFSSqliteQueryRequest': assert isinstance(obj, dict) query = from_str(obj.get("query")) query_type = SessionFSSqliteQueryType(obj.get("queryType")) session_id = from_str(obj.get("sessionId")) - params = from_union( - [ - lambda x: from_dict(lambda x: from_union([from_none, from_float, from_str], x), x), - from_none, - ], - obj.get("params"), - ) + params = from_union([lambda x: from_dict(lambda x: from_union([from_none, from_float, from_str], x), x), from_none], obj.get("params")) return SessionFSSqliteQueryRequest(query, query_type, session_id, params) def to_dict(self) -> dict: @@ -11423,18 +10349,9 @@ def to_dict(self) -> dict: result["queryType"] = to_enum(SessionFSSqliteQueryType, self.query_type) result["sessionId"] = from_str(self.session_id) if self.params is not None: - result["params"] = from_union( - [ - lambda x: from_dict( - lambda x: from_union([from_none, to_float, from_str], x), x - ), - from_none, - ], - self.params, - ) + result["params"] = from_union([lambda x: from_dict(lambda x: from_union([from_none, to_float, from_str], x), x), from_none], self.params) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsListRequest: @@ -11450,7 +10367,7 @@ class SessionsListRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsListRequest": + def from_dict(obj: Any) -> 'SessionsListRequest': assert isinstance(obj, dict) filter = from_union([SessionListFilter.from_dict, from_none], obj.get("filter")) metadata_limit = from_union([from_int, from_none], obj.get("metadataLimit")) @@ -11459,14 +10376,11 @@ def from_dict(obj: Any) -> "SessionsListRequest": def to_dict(self) -> dict: result: dict = {} if self.filter is not None: - result["filter"] = from_union( - [lambda x: to_class(SessionListFilter, x), from_none], self.filter - ) + result["filter"] = from_union([lambda x: to_class(SessionListFilter, x), from_none], self.filter) if self.metadata_limit is not None: result["metadataLimit"] = from_union([from_int, from_none], self.metadata_limit) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ShellKillRequest: @@ -11479,7 +10393,7 @@ class ShellKillRequest: """Signal to send (default: SIGTERM)""" @staticmethod - def from_dict(obj: Any) -> "ShellKillRequest": + def from_dict(obj: Any) -> 'ShellKillRequest': assert isinstance(obj, dict) process_id = from_str(obj.get("processId")) signal = from_union([ShellKillSignal, from_none], obj.get("signal")) @@ -11489,12 +10403,9 @@ def to_dict(self) -> dict: result: dict = {} result["processId"] = from_str(self.process_id) if self.signal is not None: - result["signal"] = from_union( - [lambda x: to_enum(ShellKillSignal, x), from_none], self.signal - ) + result["signal"] = from_union([lambda x: to_enum(ShellKillSignal, x), from_none], self.signal) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentInfo: @@ -11502,7 +10413,6 @@ class AgentInfo: The newly selected custom agent """ - description: str """Description of the agent's purpose""" @@ -11543,34 +10453,20 @@ class AgentInfo: """ @staticmethod - def from_dict(obj: Any) -> "AgentInfo": + def from_dict(obj: Any) -> 'AgentInfo': assert isinstance(obj, dict) description = from_str(obj.get("description")) display_name = from_str(obj.get("displayName")) id = from_str(obj.get("id")) name = from_str(obj.get("name")) - mcp_servers = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], obj.get("mcpServers") - ) + mcp_servers = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("mcpServers")) model = from_union([from_str, from_none], obj.get("model")) path = from_union([from_str, from_none], obj.get("path")) skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skills")) source = from_union([AgentInfoSource, from_none], obj.get("source")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) user_invocable = from_union([from_bool, from_none], obj.get("userInvocable")) - return AgentInfo( - description, - display_name, - id, - name, - mcp_servers, - model, - path, - skills, - source, - tools, - user_invocable, - ) + return AgentInfo(description, display_name, id, name, mcp_servers, model, path, skills, source, tools, user_invocable) def to_dict(self) -> dict: result: dict = {} @@ -11579,28 +10475,21 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) result["name"] = from_str(self.name) if self.mcp_servers is not None: - result["mcpServers"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.mcp_servers - ) + result["mcpServers"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.mcp_servers) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) if self.skills is not None: - result["skills"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.skills - ) + result["skills"] = from_union([lambda x: from_list(from_str, x), from_none], self.skills) if self.source is not None: - result["source"] = from_union( - [lambda x: to_enum(AgentInfoSource, x), from_none], self.source - ) + result["source"] = from_union([lambda x: to_enum(AgentInfoSource, x), from_none], self.source) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) if self.user_invocable is not None: result["userInvocable"] = from_union([from_bool, from_none], self.user_invocable) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillList: @@ -11610,7 +10499,7 @@ class SkillList: """Available skills""" @staticmethod - def from_dict(obj: Any) -> "SkillList": + def from_dict(obj: Any) -> 'SkillList': assert isinstance(obj, dict) skills = from_list(Skill.from_dict, obj.get("skills")) return SkillList(skills) @@ -11620,7 +10509,6 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(Skill, x), self.skills) return result - @dataclass class SkillsConfigSetDisabledSkillsRequest: """Skill names to mark as disabled in global configuration, replacing any previous list.""" @@ -11629,7 +10517,7 @@ class SkillsConfigSetDisabledSkillsRequest: """List of skill names to disable""" @staticmethod - def from_dict(obj: Any) -> "SkillsConfigSetDisabledSkillsRequest": + def from_dict(obj: Any) -> 'SkillsConfigSetDisabledSkillsRequest': assert isinstance(obj, dict) disabled_skills = from_list(from_str, obj.get("disabledSkills")) return SkillsConfigSetDisabledSkillsRequest(disabled_skills) @@ -11639,7 +10527,6 @@ def to_dict(self) -> dict: result["disabledSkills"] = from_list(from_str, self.disabled_skills) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SkillsGetInvokedResult: @@ -11649,7 +10536,7 @@ class SkillsGetInvokedResult: """Skills invoked during this session, ordered by invocation time (most recent last)""" @staticmethod - def from_dict(obj: Any) -> "SkillsGetInvokedResult": + def from_dict(obj: Any) -> 'SkillsGetInvokedResult': assert isinstance(obj, dict) skills = from_list(SkillsInvokedSkill.from_dict, obj.get("skills")) return SkillsGetInvokedResult(skills) @@ -11659,7 +10546,6 @@ def to_dict(self) -> dict: result["skills"] = from_list(lambda x: to_class(SkillsInvokedSkill, x), self.skills) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandAgentPromptResult: @@ -11683,14 +10569,12 @@ class SlashCommandAgentPromptResult: """ @staticmethod - def from_dict(obj: Any) -> "SlashCommandAgentPromptResult": + def from_dict(obj: Any) -> 'SlashCommandAgentPromptResult': assert isinstance(obj, dict) display_prompt = from_str(obj.get("displayPrompt")) prompt = from_str(obj.get("prompt")) mode = from_union([SessionMode, from_none], obj.get("mode")) - runtime_settings_changed = from_union( - [from_bool, from_none], obj.get("runtimeSettingsChanged") - ) + runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandAgentPromptResult(display_prompt, prompt, mode, runtime_settings_changed) def to_dict(self) -> dict: @@ -11701,12 +10585,9 @@ def to_dict(self) -> dict: if self.mode is not None: result["mode"] = from_union([lambda x: to_enum(SessionMode, x), from_none], self.mode) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union( - [from_bool, from_none], self.runtime_settings_changed - ) + result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandCompletedResult: @@ -11724,12 +10605,10 @@ class SlashCommandCompletedResult: """ @staticmethod - def from_dict(obj: Any) -> "SlashCommandCompletedResult": + def from_dict(obj: Any) -> 'SlashCommandCompletedResult': assert isinstance(obj, dict) message = from_union([from_str, from_none], obj.get("message")) - runtime_settings_changed = from_union( - [from_bool, from_none], obj.get("runtimeSettingsChanged") - ) + runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandCompletedResult(message, runtime_settings_changed) def to_dict(self) -> dict: @@ -11738,12 +10617,9 @@ def to_dict(self) -> dict: if self.message is not None: result["message"] = from_union([from_str, from_none], self.message) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union( - [from_bool, from_none], self.runtime_settings_changed - ) + result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandSelectSubcommandResult: @@ -11767,31 +10643,24 @@ class SlashCommandSelectSubcommandResult: """ @staticmethod - def from_dict(obj: Any) -> "SlashCommandSelectSubcommandResult": + def from_dict(obj: Any) -> 'SlashCommandSelectSubcommandResult': assert isinstance(obj, dict) command = from_str(obj.get("command")) options = from_list(SlashCommandSelectSubcommandOption.from_dict, obj.get("options")) title = from_str(obj.get("title")) - runtime_settings_changed = from_union( - [from_bool, from_none], obj.get("runtimeSettingsChanged") - ) + runtime_settings_changed = from_union([from_bool, from_none], obj.get("runtimeSettingsChanged")) return SlashCommandSelectSubcommandResult(command, options, title, runtime_settings_changed) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) result["kind"] = self.kind - result["options"] = from_list( - lambda x: to_class(SlashCommandSelectSubcommandOption, x), self.options - ) + result["options"] = from_list(lambda x: to_class(SlashCommandSelectSubcommandOption, x), self.options) result["title"] = from_str(self.title) if self.runtime_settings_changed is not None: - result["runtimeSettingsChanged"] = from_union( - [from_bool, from_none], self.runtime_settings_changed - ) + result["runtimeSettingsChanged"] = from_union([from_bool, from_none], self.runtime_settings_changed) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskAgentProgress: @@ -11807,7 +10676,7 @@ class TaskAgentProgress: """The most recent intent reported by the agent""" @staticmethod - def from_dict(obj: Any) -> "TaskAgentProgress": + def from_dict(obj: Any) -> 'TaskAgentProgress': assert isinstance(obj, dict) recent_activity = from_list(TaskProgressLine.from_dict, obj.get("recentActivity")) type = TaskAgentInfoType(obj.get("type")) @@ -11816,15 +10685,12 @@ def from_dict(obj: Any) -> "TaskAgentProgress": def to_dict(self) -> dict: result: dict = {} - result["recentActivity"] = from_list( - lambda x: to_class(TaskProgressLine, x), self.recent_activity - ) + result["recentActivity"] = from_list(lambda x: to_class(TaskProgressLine, x), self.recent_activity) result["type"] = to_enum(TaskAgentInfoType, self.type) if self.latest_intent is not None: result["latestIntent"] = from_union([from_str, from_none], self.latest_intent) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskShellInfo: @@ -11868,7 +10734,7 @@ class TaskShellInfo: """Process ID when available""" @staticmethod - def from_dict(obj: Any) -> "TaskShellInfo": + def from_dict(obj: Any) -> 'TaskShellInfo': assert isinstance(obj, dict) attachment_mode = TaskShellInfoAttachmentMode(obj.get("attachmentMode")) command = from_str(obj.get("command")) @@ -11876,26 +10742,12 @@ def from_dict(obj: Any) -> "TaskShellInfo": id = from_str(obj.get("id")) started_at = from_datetime(obj.get("startedAt")) status = TaskStatus(obj.get("status")) - can_promote_to_background = from_union( - [from_bool, from_none], obj.get("canPromoteToBackground") - ) + can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) execution_mode = from_union([TaskExecutionMode, from_none], obj.get("executionMode")) log_path = from_union([from_str, from_none], obj.get("logPath")) pid = from_union([from_int, from_none], obj.get("pid")) - return TaskShellInfo( - attachment_mode, - command, - description, - id, - started_at, - status, - can_promote_to_background, - completed_at, - execution_mode, - log_path, - pid, - ) + return TaskShellInfo(attachment_mode, command, description, id, started_at, status, can_promote_to_background, completed_at, execution_mode, log_path, pid) def to_dict(self) -> dict: result: dict = {} @@ -11907,24 +10759,17 @@ def to_dict(self) -> dict: result["status"] = to_enum(TaskStatus, self.status) result["type"] = self.type if self.can_promote_to_background is not None: - result["canPromoteToBackground"] = from_union( - [from_bool, from_none], self.can_promote_to_background - ) + result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) if self.completed_at is not None: - result["completedAt"] = from_union( - [lambda x: x.isoformat(), from_none], self.completed_at - ) + result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) if self.execution_mode is not None: - result["executionMode"] = from_union( - [lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode - ) + result["executionMode"] = from_union([lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode) if self.log_path is not None: result["logPath"] = from_union([from_str, from_none], self.log_path) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskShellProgress: @@ -11940,7 +10785,7 @@ class TaskShellProgress: """Process ID when available""" @staticmethod - def from_dict(obj: Any) -> "TaskShellProgress": + def from_dict(obj: Any) -> 'TaskShellProgress': assert isinstance(obj, dict) recent_output = from_str(obj.get("recentOutput")) type = TaskShellInfoType(obj.get("type")) @@ -11955,7 +10800,6 @@ def to_dict(self) -> dict: result["pid"] = from_union([from_int, from_none], self.pid) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsCallToolRequest: @@ -11976,14 +10820,12 @@ class MCPAppsCallToolRequest: """Tool arguments""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsCallToolRequest": + def from_dict(obj: Any) -> 'MCPAppsCallToolRequest': assert isinstance(obj, dict) origin_server_name = from_str(obj.get("originServerName")) server_name = from_str(obj.get("serverName")) tool_name = from_str(obj.get("toolName")) - arguments = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], obj.get("arguments") - ) + arguments = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("arguments")) return MCPAppsCallToolRequest(origin_server_name, server_name, tool_name, arguments) def to_dict(self) -> dict: @@ -11992,12 +10834,9 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) result["toolName"] = from_str(self.tool_name) if self.arguments is not None: - result["arguments"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.arguments - ) + result["arguments"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.arguments) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionLocationAddToolApprovalParams: @@ -12010,7 +10849,7 @@ class PermissionLocationAddToolApprovalParams: """Location key (git root or cwd) to persist the approval to""" @staticmethod - def from_dict(obj: Any) -> "PermissionLocationAddToolApprovalParams": + def from_dict(obj: Any) -> 'PermissionLocationAddToolApprovalParams': assert isinstance(obj, dict) approval = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("approval")) location_key = from_str(obj.get("locationKey")) @@ -12022,7 +10861,6 @@ def to_dict(self) -> dict: result["locationKey"] = from_str(self.location_key) return result - @dataclass class ToolList: """Built-in tools available for the requested model, with their parameters and instructions.""" @@ -12031,7 +10869,7 @@ class ToolList: """List of available built-in tools with metadata""" @staticmethod - def from_dict(obj: Any) -> "ToolList": + def from_dict(obj: Any) -> 'ToolList': assert isinstance(obj, dict) tools = from_list(Tool.from_dict, obj.get("tools")) return ToolList(tools) @@ -12041,7 +10879,6 @@ def to_dict(self) -> dict: result["tools"] = from_list(lambda x: to_class(Tool, x), self.tools) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingAutoModeSwitchRequest: @@ -12056,7 +10893,7 @@ class UIHandlePendingAutoModeSwitchRequest: """ @staticmethod - def from_dict(obj: Any) -> "UIHandlePendingAutoModeSwitchRequest": + def from_dict(obj: Any) -> 'UIHandlePendingAutoModeSwitchRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIAutoModeSwitchResponse(obj.get("response")) @@ -12068,7 +10905,6 @@ def to_dict(self) -> dict: result["response"] = to_enum(UIAutoModeSwitchResponse, self.response) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfFieldItems: @@ -12078,19 +10914,16 @@ class UIElicitationArrayAnyOfFieldItems: """Selectable options, each with a value and a display label.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationArrayAnyOfFieldItems": + def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfFieldItems': assert isinstance(obj, dict) any_of = from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, obj.get("anyOf")) return UIElicitationArrayAnyOfFieldItems(any_of) def to_dict(self) -> dict: result: dict = {} - result["anyOf"] = from_list( - lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), self.any_of - ) + result["anyOf"] = from_list(lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), self.any_of) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayEnumFieldItems: @@ -12103,7 +10936,7 @@ class UIElicitationArrayEnumFieldItems: """Type discriminator. Always "string".""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationArrayEnumFieldItems": + def from_dict(obj: Any) -> 'UIElicitationArrayEnumFieldItems': assert isinstance(obj, dict) enum = from_list(from_str, obj.get("enum")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) @@ -12115,7 +10948,6 @@ def to_dict(self) -> dict: result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) return result - @dataclass class UIElicitationArrayFieldItems: """Schema applied to each item in the array.""" @@ -12130,14 +10962,11 @@ class UIElicitationArrayFieldItems: """Selectable options, each with a value and a display label.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationArrayFieldItems": + def from_dict(obj: Any) -> 'UIElicitationArrayFieldItems': assert isinstance(obj, dict) enum = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enum")) type = from_union([UIElicitationArrayEnumFieldItemsType, from_none], obj.get("type")) - any_of = from_union( - [lambda x: from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, x), from_none], - obj.get("anyOf"), - ) + any_of = from_union([lambda x: from_list(UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict, x), from_none], obj.get("anyOf")) return UIElicitationArrayFieldItems(enum, type, any_of) def to_dict(self) -> dict: @@ -12145,22 +10974,11 @@ def to_dict(self) -> dict: if self.enum is not None: result["enum"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum) if self.type is not None: - result["type"] = from_union( - [lambda x: to_enum(UIElicitationArrayEnumFieldItemsType, x), from_none], self.type - ) + result["type"] = from_union([lambda x: to_enum(UIElicitationArrayEnumFieldItemsType, x), from_none], self.type) if self.any_of is not None: - result["anyOf"] = from_union( - [ - lambda x: from_list( - lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), x - ), - from_none, - ], - self.any_of, - ) + result["anyOf"] = from_union([lambda x: from_list(lambda x: to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, x), x), from_none], self.any_of) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringEnumField: @@ -12185,7 +11003,7 @@ class UIElicitationStringEnumField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationStringEnumField": + def from_dict(obj: Any) -> 'UIElicitationStringEnumField': assert isinstance(obj, dict) enum = from_list(from_str, obj.get("enum")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) @@ -12204,14 +11022,11 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.enum_names is not None: - result["enumNames"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.enum_names - ) + result["enumNames"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum_names) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyString: @@ -12239,7 +11054,7 @@ class UIElicitationSchemaPropertyString: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationSchemaPropertyString": + def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyString': assert isinstance(obj, dict) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) default = from_union([from_str, from_none], obj.get("default")) @@ -12248,9 +11063,7 @@ def from_dict(obj: Any) -> "UIElicitationSchemaPropertyString": max_length = from_union([from_int, from_none], obj.get("maxLength")) min_length = from_union([from_int, from_none], obj.get("minLength")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationSchemaPropertyString( - type, default, description, format, max_length, min_length, title - ) + return UIElicitationSchemaPropertyString(type, default, description, format, max_length, min_length, title) def to_dict(self) -> dict: result: dict = {} @@ -12260,10 +11073,7 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.format is not None: - result["format"] = from_union( - [lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], - self.format, - ) + result["format"] = from_union([lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], self.format) if self.max_length is not None: result["maxLength"] = from_union([from_int, from_none], self.max_length) if self.min_length is not None: @@ -12272,7 +11082,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationStringOneOfField: @@ -12294,7 +11103,7 @@ class UIElicitationStringOneOfField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationStringOneOfField": + def from_dict(obj: Any) -> 'UIElicitationStringOneOfField': assert isinstance(obj, dict) one_of = from_list(UIElicitationStringOneOfFieldOneOf.from_dict, obj.get("oneOf")) type = UIElicitationArrayEnumFieldItemsType(obj.get("type")) @@ -12305,9 +11114,7 @@ def from_dict(obj: Any) -> "UIElicitationStringOneOfField": def to_dict(self) -> dict: result: dict = {} - result["oneOf"] = from_list( - lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), self.one_of - ) + result["oneOf"] = from_list(lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), self.one_of) result["type"] = to_enum(UIElicitationArrayEnumFieldItemsType, self.type) if self.default is not None: result["default"] = from_union([from_str, from_none], self.default) @@ -12317,7 +11124,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationResponse: @@ -12330,42 +11136,19 @@ class UIElicitationResponse: """The form values submitted by the user (present when action is 'accept')""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationResponse": + def from_dict(obj: Any) -> 'UIElicitationResponse': assert isinstance(obj, dict) action = UIElicitationResponseAction(obj.get("action")) - content = from_union( - [ - lambda x: from_dict( - lambda x: from_union( - [from_float, from_bool, lambda x: from_list(from_str, x), from_str], x - ), - x, - ), - from_none, - ], - obj.get("content"), - ) + content = from_union([lambda x: from_dict(lambda x: from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], x), x), from_none], obj.get("content")) return UIElicitationResponse(action, content) def to_dict(self) -> dict: result: dict = {} result["action"] = to_enum(UIElicitationResponseAction, self.action) if self.content is not None: - result["content"] = from_union( - [ - lambda x: from_dict( - lambda x: from_union( - [to_float, from_bool, lambda x: from_list(from_str, x), from_str], x - ), - x, - ), - from_none, - ], - self.content, - ) + result["content"] = from_union([lambda x: from_dict(lambda x: from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], x), x), from_none], self.content) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyBoolean: @@ -12384,7 +11167,7 @@ class UIElicitationSchemaPropertyBoolean: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationSchemaPropertyBoolean": + def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyBoolean': assert isinstance(obj, dict) type = UIElicitationSchemaPropertyBooleanType(obj.get("type")) default = from_union([from_bool, from_none], obj.get("default")) @@ -12403,7 +11186,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaPropertyNumber: @@ -12428,7 +11210,7 @@ class UIElicitationSchemaPropertyNumber: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationSchemaPropertyNumber": + def from_dict(obj: Any) -> 'UIElicitationSchemaPropertyNumber': assert isinstance(obj, dict) type = UIElicitationSchemaPropertyNumberType(obj.get("type")) default = from_union([from_float, from_none], obj.get("default")) @@ -12436,9 +11218,7 @@ def from_dict(obj: Any) -> "UIElicitationSchemaPropertyNumber": maximum = from_union([from_float, from_none], obj.get("maximum")) minimum = from_union([from_float, from_none], obj.get("minimum")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationSchemaPropertyNumber( - type, default, description, maximum, minimum, title - ) + return UIElicitationSchemaPropertyNumber(type, default, description, maximum, minimum, title) def to_dict(self) -> dict: result: dict = {} @@ -12455,7 +11235,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIExitPlanModeResponse: @@ -12476,7 +11255,7 @@ class UIExitPlanModeResponse: """ @staticmethod - def from_dict(obj: Any) -> "UIExitPlanModeResponse": + def from_dict(obj: Any) -> 'UIExitPlanModeResponse': assert isinstance(obj, dict) approved = from_bool(obj.get("approved")) auto_approve_edits = from_union([from_bool, from_none], obj.get("autoApproveEdits")) @@ -12492,12 +11271,9 @@ def to_dict(self) -> dict: if self.feedback is not None: result["feedback"] = from_union([from_str, from_none], self.feedback) if self.selected_action is not None: - result["selectedAction"] = from_union( - [lambda x: to_enum(UIExitPlanModeAction, x), from_none], self.selected_action - ) + result["selectedAction"] = from_union([lambda x: to_enum(UIExitPlanModeAction, x), from_none], self.selected_action) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingUserInputRequest: @@ -12510,7 +11286,7 @@ class UIHandlePendingUserInputRequest: """Schema for the `UIUserInputResponse` type.""" @staticmethod - def from_dict(obj: Any) -> "UIHandlePendingUserInputRequest": + def from_dict(obj: Any) -> 'UIHandlePendingUserInputRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIUserInputResponse.from_dict(obj.get("response")) @@ -12522,7 +11298,6 @@ def to_dict(self) -> dict: result["response"] = to_class(UIUserInputResponse, self.response) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageMetricsModelMetric: @@ -12541,14 +11316,11 @@ class UsageMetricsModelMetric: """Accumulated nano-AI units cost for this model""" @staticmethod - def from_dict(obj: Any) -> "UsageMetricsModelMetric": + def from_dict(obj: Any) -> 'UsageMetricsModelMetric': assert isinstance(obj, dict) requests = UsageMetricsModelMetricRequests.from_dict(obj.get("requests")) usage = UsageMetricsModelMetricUsage.from_dict(obj.get("usage")) - token_details = from_union( - [lambda x: from_dict(UsageMetricsModelMetricTokenDetail.from_dict, x), from_none], - obj.get("tokenDetails"), - ) + token_details = from_union([lambda x: from_dict(UsageMetricsModelMetricTokenDetail.from_dict, x), from_none], obj.get("tokenDetails")) total_nano_aiu = from_union([from_float, from_none], obj.get("totalNanoAiu")) return UsageMetricsModelMetric(requests, usage, token_details, total_nano_aiu) @@ -12557,20 +11329,11 @@ def to_dict(self) -> dict: result["requests"] = to_class(UsageMetricsModelMetricRequests, self.requests) result["usage"] = to_class(UsageMetricsModelMetricUsage, self.usage) if self.token_details is not None: - result["tokenDetails"] = from_union( - [ - lambda x: from_dict( - lambda x: to_class(UsageMetricsModelMetricTokenDetail, x), x - ), - from_none, - ], - self.token_details, - ) + result["tokenDetails"] = from_union([lambda x: from_dict(lambda x: to_class(UsageMetricsModelMetricTokenDetail, x), x), from_none], self.token_details) if self.total_nano_aiu is not None: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceDiffFileChange: @@ -12592,7 +11355,7 @@ class WorkspaceDiffFileChange: """Original file path for renamed files.""" @staticmethod - def from_dict(obj: Any) -> "WorkspaceDiffFileChange": + def from_dict(obj: Any) -> 'WorkspaceDiffFileChange': assert isinstance(obj, dict) change_type = WorkspaceDiffFileChangeType(obj.get("changeType")) diff = from_str(obj.get("diff")) @@ -12612,7 +11375,6 @@ def to_dict(self) -> dict: result["oldPath"] = from_union([from_str, from_none], self.old_path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesDiffRequest: @@ -12622,7 +11384,7 @@ class WorkspacesDiffRequest: """Diff mode requested by the client.""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesDiffRequest": + def from_dict(obj: Any) -> 'WorkspacesDiffRequest': assert isinstance(obj, dict) mode = WorkspaceDiffMode(obj.get("mode")) return WorkspacesDiffRequest(mode) @@ -12632,7 +11394,6 @@ def to_dict(self) -> dict: result["mode"] = to_enum(WorkspaceDiffMode, self.mode) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesSaveLargePasteResult: @@ -12644,7 +11405,7 @@ class WorkspacesSaveLargePasteResult: """ @staticmethod - def from_dict(obj: Any) -> "WorkspacesSaveLargePasteResult": + def from_dict(obj: Any) -> 'WorkspacesSaveLargePasteResult': assert isinstance(obj, dict) saved = from_union([Saved.from_dict, from_none], obj.get("saved")) return WorkspacesSaveLargePasteResult(saved) @@ -12654,7 +11415,6 @@ def to_dict(self) -> dict: result["saved"] = from_union([lambda x: to_class(Saved, x), from_none], self.saved) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasList: @@ -12664,7 +11424,7 @@ class CanvasList: """Declared canvases available in this session""" @staticmethod - def from_dict(obj: Any) -> "CanvasList": + def from_dict(obj: Any) -> 'CanvasList': assert isinstance(obj, dict) canvases = from_list(DiscoveredCanvas.from_dict, obj.get("canvases")) return CanvasList(canvases) @@ -12674,7 +11434,6 @@ def to_dict(self) -> dict: result["canvases"] = from_list(lambda x: to_class(DiscoveredCanvas, x), self.canvases) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasListOpenResult: @@ -12684,19 +11443,16 @@ class CanvasListOpenResult: """Currently open canvas instances""" @staticmethod - def from_dict(obj: Any) -> "CanvasListOpenResult": + def from_dict(obj: Any) -> 'CanvasListOpenResult': assert isinstance(obj, dict) open_canvases = from_list(OpenCanvasInstance.from_dict, obj.get("openCanvases")) return CanvasListOpenResult(open_canvases) def to_dict(self) -> dict: result: dict = {} - result["openCanvases"] = from_list( - lambda x: to_class(OpenCanvasInstance, x), self.open_canvases - ) + result["openCanvases"] = from_list(lambda x: to_class(OpenCanvasInstance, x), self.open_canvases) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SlashCommandInfo: @@ -12725,7 +11481,7 @@ class SlashCommandInfo: """Optional unstructured input hint""" @staticmethod - def from_dict(obj: Any) -> "SlashCommandInfo": + def from_dict(obj: Any) -> 'SlashCommandInfo': assert isinstance(obj, dict) allow_during_agent_execution = from_bool(obj.get("allowDuringAgentExecution")) description = from_str(obj.get("description")) @@ -12734,9 +11490,7 @@ def from_dict(obj: Any) -> "SlashCommandInfo": aliases = from_union([lambda x: from_list(from_str, x), from_none], obj.get("aliases")) experimental = from_union([from_bool, from_none], obj.get("experimental")) input = from_union([SlashCommandInput.from_dict, from_none], obj.get("input")) - return SlashCommandInfo( - allow_during_agent_execution, description, kind, name, aliases, experimental, input - ) + return SlashCommandInfo(allow_during_agent_execution, description, kind, name, aliases, experimental, input) def to_dict(self) -> dict: result: dict = {} @@ -12745,18 +11499,13 @@ def to_dict(self) -> dict: result["kind"] = to_enum(SlashCommandKind, self.kind) result["name"] = from_str(self.name) if self.aliases is not None: - result["aliases"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.aliases - ) + result["aliases"] = from_union([lambda x: from_list(from_str, x), from_none], self.aliases) if self.experimental is not None: result["experimental"] = from_union([from_bool, from_none], self.experimental) if self.input is not None: - result["input"] = from_union( - [lambda x: to_class(SlashCommandInput, x), from_none], self.input - ) + result["input"] = from_union([lambda x: to_class(SlashCommandInput, x), from_none], self.input) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class RemoteSessionConnectionResult: @@ -12769,7 +11518,7 @@ class RemoteSessionConnectionResult: """SDK session ID for the connected remote session.""" @staticmethod - def from_dict(obj: Any) -> "RemoteSessionConnectionResult": + def from_dict(obj: Any) -> 'RemoteSessionConnectionResult': assert isinstance(obj, dict) metadata = ConnectedRemoteSessionMetadata.from_dict(obj.get("metadata")) session_id = from_str(obj.get("sessionId")) @@ -12781,7 +11530,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasHostContext: """Host context supplied by the runtime.""" @@ -12790,22 +11539,17 @@ class CanvasHostContext: """Host capabilities""" @staticmethod - def from_dict(obj: Any) -> "CanvasHostContext": + def from_dict(obj: Any) -> 'CanvasHostContext': assert isinstance(obj, dict) - capabilities = from_union( - [CanvasHostContextCapabilities.from_dict, from_none], obj.get("capabilities") - ) + capabilities = from_union([CanvasHostContextCapabilities.from_dict, from_none], obj.get("capabilities")) return CanvasHostContext(capabilities) def to_dict(self) -> dict: result: dict = {} if self.capabilities is not None: - result["capabilities"] = from_union( - [lambda x: to_class(CanvasHostContextCapabilities, x), from_none], self.capabilities - ) + result["capabilities"] = from_union([lambda x: to_class(CanvasHostContextCapabilities, x), from_none], self.capabilities) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotUserResponse: @@ -12813,7 +11557,6 @@ class CopilotUserResponse: GitHub API `/copilot_internal/v2/token` user response shape — the runtime trusts this verbatim and does not re-fetch when set. """ - access_type_sku: str | None = None analytics_tracking_id: str | None = None assigned_date: Any = None @@ -12843,174 +11586,83 @@ class CopilotUserResponse: token_based_billing: bool | None = None @staticmethod - def from_dict(obj: Any) -> "CopilotUserResponse": + def from_dict(obj: Any) -> 'CopilotUserResponse': assert isinstance(obj, dict) access_type_sku = from_union([from_str, from_none], obj.get("access_type_sku")) analytics_tracking_id = from_union([from_str, from_none], obj.get("analytics_tracking_id")) assigned_date = obj.get("assigned_date") - can_signup_for_limited = from_union( - [from_bool, from_none], obj.get("can_signup_for_limited") - ) + can_signup_for_limited = from_union([from_bool, from_none], obj.get("can_signup_for_limited")) chat_enabled = from_union([from_bool, from_none], obj.get("chat_enabled")) - cli_remote_control_enabled = from_union( - [from_bool, from_none], obj.get("cli_remote_control_enabled") - ) - cloud_session_storage_enabled = from_union( - [from_bool, from_none], obj.get("cloud_session_storage_enabled") - ) + cli_remote_control_enabled = from_union([from_bool, from_none], obj.get("cli_remote_control_enabled")) + cloud_session_storage_enabled = from_union([from_bool, from_none], obj.get("cloud_session_storage_enabled")) codex_agent_enabled = from_union([from_bool, from_none], obj.get("codex_agent_enabled")) copilot_plan = from_union([from_str, from_none], obj.get("copilot_plan")) copilotignore_enabled = from_union([from_bool, from_none], obj.get("copilotignore_enabled")) - endpoints = from_union( - [CopilotUserResponseEndpoints.from_dict, from_none], obj.get("endpoints") - ) + endpoints = from_union([CopilotUserResponseEndpoints.from_dict, from_none], obj.get("endpoints")) is_mcp_enabled = obj.get("is_mcp_enabled") - limited_user_quotas = from_union( - [lambda x: from_dict(from_float, x), from_none], obj.get("limited_user_quotas") - ) - limited_user_reset_date = from_union( - [from_str, from_none], obj.get("limited_user_reset_date") - ) + limited_user_quotas = from_union([lambda x: from_dict(from_float, x), from_none], obj.get("limited_user_quotas")) + limited_user_reset_date = from_union([from_str, from_none], obj.get("limited_user_reset_date")) login = from_union([from_str, from_none], obj.get("login")) - monthly_quotas = from_union( - [lambda x: from_dict(from_float, x), from_none], obj.get("monthly_quotas") - ) + monthly_quotas = from_union([lambda x: from_dict(from_float, x), from_none], obj.get("monthly_quotas")) organization_list = obj.get("organization_list") - organization_login_list = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("organization_login_list") - ) + organization_login_list = from_union([lambda x: from_list(from_str, x), from_none], obj.get("organization_login_list")) quota_reset_date = from_union([from_str, from_none], obj.get("quota_reset_date")) quota_reset_date_utc = from_union([from_str, from_none], obj.get("quota_reset_date_utc")) - quota_snapshots = from_union( - [ - lambda x: from_dict( - lambda x: from_union( - [CopilotUserResponseQuotaSnapshots.from_dict, from_none], x - ), - x, - ), - from_none, - ], - obj.get("quota_snapshots"), - ) + quota_snapshots = from_union([lambda x: from_dict(lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), x), from_none], obj.get("quota_snapshots")) restricted_telemetry = from_union([from_bool, from_none], obj.get("restricted_telemetry")) token_based_billing = from_union([from_bool, from_none], obj.get("token_based_billing")) - return CopilotUserResponse( - access_type_sku, - analytics_tracking_id, - assigned_date, - can_signup_for_limited, - chat_enabled, - cli_remote_control_enabled, - cloud_session_storage_enabled, - codex_agent_enabled, - copilot_plan, - copilotignore_enabled, - endpoints, - is_mcp_enabled, - limited_user_quotas, - limited_user_reset_date, - login, - monthly_quotas, - organization_list, - organization_login_list, - quota_reset_date, - quota_reset_date_utc, - quota_snapshots, - restricted_telemetry, - token_based_billing, - ) + return CopilotUserResponse(access_type_sku, analytics_tracking_id, assigned_date, can_signup_for_limited, chat_enabled, cli_remote_control_enabled, cloud_session_storage_enabled, codex_agent_enabled, copilot_plan, copilotignore_enabled, endpoints, is_mcp_enabled, limited_user_quotas, limited_user_reset_date, login, monthly_quotas, organization_list, organization_login_list, quota_reset_date, quota_reset_date_utc, quota_snapshots, restricted_telemetry, token_based_billing) def to_dict(self) -> dict: result: dict = {} if self.access_type_sku is not None: result["access_type_sku"] = from_union([from_str, from_none], self.access_type_sku) if self.analytics_tracking_id is not None: - result["analytics_tracking_id"] = from_union( - [from_str, from_none], self.analytics_tracking_id - ) + result["analytics_tracking_id"] = from_union([from_str, from_none], self.analytics_tracking_id) if self.assigned_date is not None: result["assigned_date"] = self.assigned_date if self.can_signup_for_limited is not None: - result["can_signup_for_limited"] = from_union( - [from_bool, from_none], self.can_signup_for_limited - ) + result["can_signup_for_limited"] = from_union([from_bool, from_none], self.can_signup_for_limited) if self.chat_enabled is not None: result["chat_enabled"] = from_union([from_bool, from_none], self.chat_enabled) if self.cli_remote_control_enabled is not None: - result["cli_remote_control_enabled"] = from_union( - [from_bool, from_none], self.cli_remote_control_enabled - ) + result["cli_remote_control_enabled"] = from_union([from_bool, from_none], self.cli_remote_control_enabled) if self.cloud_session_storage_enabled is not None: - result["cloud_session_storage_enabled"] = from_union( - [from_bool, from_none], self.cloud_session_storage_enabled - ) + result["cloud_session_storage_enabled"] = from_union([from_bool, from_none], self.cloud_session_storage_enabled) if self.codex_agent_enabled is not None: - result["codex_agent_enabled"] = from_union( - [from_bool, from_none], self.codex_agent_enabled - ) + result["codex_agent_enabled"] = from_union([from_bool, from_none], self.codex_agent_enabled) if self.copilot_plan is not None: result["copilot_plan"] = from_union([from_str, from_none], self.copilot_plan) if self.copilotignore_enabled is not None: - result["copilotignore_enabled"] = from_union( - [from_bool, from_none], self.copilotignore_enabled - ) + result["copilotignore_enabled"] = from_union([from_bool, from_none], self.copilotignore_enabled) if self.endpoints is not None: - result["endpoints"] = from_union( - [lambda x: to_class(CopilotUserResponseEndpoints, x), from_none], self.endpoints - ) + result["endpoints"] = from_union([lambda x: to_class(CopilotUserResponseEndpoints, x), from_none], self.endpoints) if self.is_mcp_enabled is not None: result["is_mcp_enabled"] = self.is_mcp_enabled if self.limited_user_quotas is not None: - result["limited_user_quotas"] = from_union( - [lambda x: from_dict(to_float, x), from_none], self.limited_user_quotas - ) + result["limited_user_quotas"] = from_union([lambda x: from_dict(to_float, x), from_none], self.limited_user_quotas) if self.limited_user_reset_date is not None: - result["limited_user_reset_date"] = from_union( - [from_str, from_none], self.limited_user_reset_date - ) + result["limited_user_reset_date"] = from_union([from_str, from_none], self.limited_user_reset_date) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) if self.monthly_quotas is not None: - result["monthly_quotas"] = from_union( - [lambda x: from_dict(to_float, x), from_none], self.monthly_quotas - ) + result["monthly_quotas"] = from_union([lambda x: from_dict(to_float, x), from_none], self.monthly_quotas) if self.organization_list is not None: result["organization_list"] = self.organization_list if self.organization_login_list is not None: - result["organization_login_list"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.organization_login_list - ) + result["organization_login_list"] = from_union([lambda x: from_list(from_str, x), from_none], self.organization_login_list) if self.quota_reset_date is not None: result["quota_reset_date"] = from_union([from_str, from_none], self.quota_reset_date) if self.quota_reset_date_utc is not None: - result["quota_reset_date_utc"] = from_union( - [from_str, from_none], self.quota_reset_date_utc - ) + result["quota_reset_date_utc"] = from_union([from_str, from_none], self.quota_reset_date_utc) if self.quota_snapshots is not None: - result["quota_snapshots"] = from_union( - [ - lambda x: from_dict( - lambda x: from_union( - [lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x - ), - x, - ), - from_none, - ], - self.quota_snapshots, - ) + result["quota_snapshots"] = from_union([lambda x: from_dict(lambda x: from_union([lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x), x), from_none], self.quota_snapshots) if self.restricted_telemetry is not None: - result["restricted_telemetry"] = from_union( - [from_bool, from_none], self.restricted_telemetry - ) + result["restricted_telemetry"] = from_union([from_bool, from_none], self.restricted_telemetry) if self.token_based_billing is not None: - result["token_based_billing"] = from_union( - [from_bool, from_none], self.token_based_billing - ) + result["token_based_billing"] = from_union([from_bool, from_none], self.token_based_billing) return result - @dataclass class MCPDiscoverResult: """MCP servers discovered from user, workspace, plugin, and built-in sources.""" @@ -13019,7 +11671,7 @@ class MCPDiscoverResult: """MCP servers discovered from all sources""" @staticmethod - def from_dict(obj: Any) -> "MCPDiscoverResult": + def from_dict(obj: Any) -> 'MCPDiscoverResult': assert isinstance(obj, dict) servers = from_list(DiscoveredMCPServer.from_dict, obj.get("servers")) return MCPDiscoverResult(servers) @@ -13029,7 +11681,6 @@ def to_dict(self) -> dict: result["servers"] = from_list(lambda x: to_class(DiscoveredMCPServer, x), self.servers) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExtensionList: @@ -13039,7 +11690,7 @@ class ExtensionList: """Discovered extensions and their current status""" @staticmethod - def from_dict(obj: Any) -> "ExtensionList": + def from_dict(obj: Any) -> 'ExtensionList': assert isinstance(obj, dict) extensions = from_list(Extension.from_dict, obj.get("extensions")) return ExtensionList(extensions) @@ -13049,14 +11700,12 @@ def to_dict(self) -> dict: result["extensions"] = from_list(lambda x: to_class(Extension, x), self.extensions) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess: """Schema for the `PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess` type. """ - extension_name: str """Extension name.""" @@ -13064,9 +11713,7 @@ class PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess: """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod - def from_dict( - obj: Any, - ) -> "PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess': assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess(extension_name) @@ -13077,14 +11724,12 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess: """Schema for the `PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess` type. """ - extension_name: str """Extension name.""" @@ -13092,9 +11737,7 @@ class PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess: """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod - def from_dict( - obj: Any, - ) -> "PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess': assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess(extension_name) @@ -13105,7 +11748,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess: @@ -13118,9 +11760,7 @@ class PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess: """Approval covering an extension's request to access a permission-gated capability.""" @staticmethod - def from_dict( - obj: Any, - ) -> "PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess": + def from_dict(obj: Any) -> 'PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess': assert isinstance(obj, dict) extension_name = from_str(obj.get("extensionName")) return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess(extension_name) @@ -13131,7 +11771,6 @@ def to_dict(self) -> dict: result["kind"] = self.kind return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlm: @@ -13160,53 +11799,24 @@ class ExternalToolTextResultForLlm: """Optional tool-specific telemetry""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlm": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlm': assert isinstance(obj, dict) text_result_for_llm = from_str(obj.get("textResultForLlm")) - binary_results_for_llm = from_union( - [ - lambda x: from_list(ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict, x), - from_none, - ], - obj.get("binaryResultsForLlm"), - ) - contents = from_union( - [lambda x: from_list(_load_ExternalToolTextResultForLlmContent, x), from_none], - obj.get("contents"), - ) + binary_results_for_llm = from_union([lambda x: from_list(ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict, x), from_none], obj.get("binaryResultsForLlm")) + contents = from_union([lambda x: from_list(_load_ExternalToolTextResultForLlmContent, x), from_none], obj.get("contents")) error = from_union([from_str, from_none], obj.get("error")) result_type = from_union([from_str, from_none], obj.get("resultType")) session_log = from_union([from_str, from_none], obj.get("sessionLog")) - tool_telemetry = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], obj.get("toolTelemetry") - ) - return ExternalToolTextResultForLlm( - text_result_for_llm, - binary_results_for_llm, - contents, - error, - result_type, - session_log, - tool_telemetry, - ) + tool_telemetry = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("toolTelemetry")) + return ExternalToolTextResultForLlm(text_result_for_llm, binary_results_for_llm, contents, error, result_type, session_log, tool_telemetry) def to_dict(self) -> dict: result: dict = {} result["textResultForLlm"] = from_str(self.text_result_for_llm) if self.binary_results_for_llm is not None: - result["binaryResultsForLlm"] = from_union( - [ - lambda x: from_list( - lambda x: to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, x), x - ), - from_none, - ], - self.binary_results_for_llm, - ) + result["binaryResultsForLlm"] = from_union([lambda x: from_list(lambda x: to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, x), x), from_none], self.binary_results_for_llm) if self.contents is not None: - result["contents"] = from_union( - [lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.contents - ) + result["contents"] = from_union([lambda x: from_list(lambda x: (x).to_dict(), x), from_none], self.contents) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result_type is not None: @@ -13214,12 +11824,9 @@ def to_dict(self) -> dict: if self.session_log is not None: result["sessionLog"] = from_union([from_str, from_none], self.session_log) if self.tool_telemetry is not None: - result["toolTelemetry"] = from_union( - [lambda x: from_dict(lambda x: x, x), from_none], self.tool_telemetry - ) + result["toolTelemetry"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.tool_telemetry) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ExternalToolTextResultForLlmContentResourceLink: @@ -13250,26 +11857,16 @@ class ExternalToolTextResultForLlmContentResourceLink: """Human-readable display title for the resource""" @staticmethod - def from_dict(obj: Any) -> "ExternalToolTextResultForLlmContentResourceLink": + def from_dict(obj: Any) -> 'ExternalToolTextResultForLlmContentResourceLink': assert isinstance(obj, dict) name = from_str(obj.get("name")) uri = from_str(obj.get("uri")) description = from_union([from_str, from_none], obj.get("description")) - icons = from_union( - [ - lambda x: from_list( - ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict, x - ), - from_none, - ], - obj.get("icons"), - ) + icons = from_union([lambda x: from_list(ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict, x), from_none], obj.get("icons")) mime_type = from_union([from_str, from_none], obj.get("mimeType")) size = from_union([from_int, from_none], obj.get("size")) title = from_union([from_str, from_none], obj.get("title")) - return ExternalToolTextResultForLlmContentResourceLink( - name, uri, description, icons, mime_type, size, title - ) + return ExternalToolTextResultForLlmContentResourceLink(name, uri, description, icons, mime_type, size, title) def to_dict(self) -> dict: result: dict = {} @@ -13279,16 +11876,7 @@ def to_dict(self) -> dict: if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.icons is not None: - result["icons"] = from_union( - [ - lambda x: from_list( - lambda x: to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, x), - x, - ), - from_none, - ], - self.icons, - ) + result["icons"] = from_union([lambda x: from_list(lambda x: to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, x), x), from_none], self.icons) if self.mime_type is not None: result["mimeType"] = from_union([from_str, from_none], self.mime_type) if self.size is not None: @@ -13297,7 +11885,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPluginSource: @@ -13307,7 +11894,6 @@ class InstalledPluginSource: Schema for the `InstalledPluginSourceLocal` type. """ - source: PurpleSource """Constant value. Always "github". @@ -13321,7 +11907,7 @@ class InstalledPluginSource: url: str | None = None @staticmethod - def from_dict(obj: Any) -> "InstalledPluginSource": + def from_dict(obj: Any) -> 'InstalledPluginSource': assert isinstance(obj, dict) source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) @@ -13343,7 +11929,6 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPluginSource: @@ -13353,7 +11938,6 @@ class SessionInstalledPluginSource: Schema for the `SessionInstalledPluginSourceLocal` type. """ - source: PurpleSource """Constant value. Always "github". @@ -13367,7 +11951,7 @@ class SessionInstalledPluginSource: url: str | None = None @staticmethod - def from_dict(obj: Any) -> "SessionInstalledPluginSource": + def from_dict(obj: Any) -> 'SessionInstalledPluginSource': assert isinstance(obj, dict) source = PurpleSource(obj.get("source")) path = from_union([from_str, from_none], obj.get("path")) @@ -13389,7 +11973,6 @@ def to_dict(self) -> dict: result["url"] = from_union([from_str, from_none], self.url) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstructionsGetSourcesResult: @@ -13399,7 +11982,7 @@ class InstructionsGetSourcesResult: """Instruction sources for the session""" @staticmethod - def from_dict(obj: Any) -> "InstructionsGetSourcesResult": + def from_dict(obj: Any) -> 'InstructionsGetSourcesResult': assert isinstance(obj, dict) sources = from_list(InstructionsSources.from_dict, obj.get("sources")) return InstructionsGetSourcesResult(sources) @@ -13409,7 +11992,6 @@ def to_dict(self) -> dict: result["sources"] = from_list(lambda x: to_class(InstructionsSources, x), self.sources) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsHostContext: @@ -13419,7 +12001,7 @@ class MCPAppsHostContext: """Current host context""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsHostContext": + def from_dict(obj: Any) -> 'MCPAppsHostContext': assert isinstance(obj, dict) context = MCPAppsHostContextDetails.from_dict(obj.get("context")) return MCPAppsHostContext(context) @@ -13429,7 +12011,6 @@ def to_dict(self) -> dict: result["context"] = to_class(MCPAppsHostContextDetails, self.context) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPAppsSetHostContextRequest: @@ -13439,7 +12020,7 @@ class MCPAppsSetHostContextRequest: """Host context advertised to MCP App guests""" @staticmethod - def from_dict(obj: Any) -> "MCPAppsSetHostContextRequest": + def from_dict(obj: Any) -> 'MCPAppsSetHostContextRequest': assert isinstance(obj, dict) context = MCPAppsSetHostContextDetails.from_dict(obj.get("context")) return MCPAppsSetHostContextRequest(context) @@ -13449,7 +12030,6 @@ def to_dict(self) -> dict: result["context"] = to_class(MCPAppsSetHostContextDetails, self.context) return result - @dataclass class MCPConfigAddRequest: """MCP server name and configuration to add to user configuration.""" @@ -13461,7 +12041,7 @@ class MCPConfigAddRequest: """Unique name for the MCP server""" @staticmethod - def from_dict(obj: Any) -> "MCPConfigAddRequest": + def from_dict(obj: Any) -> 'MCPConfigAddRequest': assert isinstance(obj, dict) config = MCPServerConfig.from_dict(obj.get("config")) name = from_str(obj.get("name")) @@ -13473,7 +12053,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - @dataclass class MCPConfigList: """User-configured MCP servers, keyed by server name.""" @@ -13482,7 +12061,7 @@ class MCPConfigList: """All MCP servers from user config, keyed by name""" @staticmethod - def from_dict(obj: Any) -> "MCPConfigList": + def from_dict(obj: Any) -> 'MCPConfigList': assert isinstance(obj, dict) servers = from_dict(MCPServerConfig.from_dict, obj.get("servers")) return MCPConfigList(servers) @@ -13492,7 +12071,6 @@ def to_dict(self) -> dict: result["servers"] = from_dict(lambda x: to_class(MCPServerConfig, x), self.servers) return result - @dataclass class MCPConfigUpdateRequest: """MCP server name and replacement configuration to write to user configuration.""" @@ -13504,7 +12082,7 @@ class MCPConfigUpdateRequest: """Name of the MCP server to update""" @staticmethod - def from_dict(obj: Any) -> "MCPConfigUpdateRequest": + def from_dict(obj: Any) -> 'MCPConfigUpdateRequest': assert isinstance(obj, dict) config = MCPServerConfig.from_dict(obj.get("config")) name = from_str(obj.get("name")) @@ -13516,7 +12094,6 @@ def to_dict(self) -> dict: result["name"] = from_str(self.name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecordContextChangeRequest: @@ -13528,7 +12105,7 @@ class MetadataRecordContextChangeRequest: """ @staticmethod - def from_dict(obj: Any) -> "MetadataRecordContextChangeRequest": + def from_dict(obj: Any) -> 'MetadataRecordContextChangeRequest': assert isinstance(obj, dict) context = SessionWorkingDirectoryContext.from_dict(obj.get("context")) return MetadataRecordContextChangeRequest(context) @@ -13538,7 +12115,6 @@ def to_dict(self) -> dict: result["context"] = to_class(SessionWorkingDirectoryContext, self.context) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionMetadata: @@ -13570,7 +12146,7 @@ class SessionMetadata: """Short summary of the session, when one has been derived""" @staticmethod - def from_dict(obj: Any) -> "SessionMetadata": + def from_dict(obj: Any) -> 'SessionMetadata': assert isinstance(obj, dict) is_remote = from_bool(obj.get("isRemote")) modified_time = from_str(obj.get("modifiedTime")) @@ -13580,9 +12156,7 @@ def from_dict(obj: Any) -> "SessionMetadata": mc_task_id = from_union([from_str, from_none], obj.get("mcTaskId")) name = from_union([from_str, from_none], obj.get("name")) summary = from_union([from_str, from_none], obj.get("summary")) - return SessionMetadata( - is_remote, modified_time, session_id, start_time, context, mc_task_id, name, summary - ) + return SessionMetadata(is_remote, modified_time, session_id, start_time, context, mc_task_id, name, summary) def to_dict(self) -> dict: result: dict = {} @@ -13591,9 +12165,7 @@ def to_dict(self) -> dict: result["sessionId"] = from_str(self.session_id) result["startTime"] = from_str(self.start_time) if self.context is not None: - result["context"] = from_union( - [lambda x: to_class(SessionContext, x), from_none], self.context - ) + result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) if self.mc_task_id is not None: result["mcTaskId"] = from_union([from_str, from_none], self.mc_task_id) if self.name is not None: @@ -13602,7 +12174,6 @@ def to_dict(self) -> dict: result["summary"] = from_union([from_str, from_none], self.summary) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsGetLastForContextRequest: @@ -13614,7 +12185,7 @@ class SessionsGetLastForContextRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsGetLastForContextRequest": + def from_dict(obj: Any) -> 'SessionsGetLastForContextRequest': assert isinstance(obj, dict) context = from_union([SessionContext.from_dict, from_none], obj.get("context")) return SessionsGetLastForContextRequest(context) @@ -13622,12 +12193,9 @@ def from_dict(obj: Any) -> "SessionsGetLastForContextRequest": def to_dict(self) -> dict: result: dict = {} if self.context is not None: - result["context"] = from_union( - [lambda x: to_class(SessionContext, x), from_none], self.context - ) + result["context"] = from_union([lambda x: to_class(SessionContext, x), from_none], self.context) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionPathsConfig: @@ -13635,7 +12203,6 @@ class PermissionPathsConfig: appropriate PathManager based on these inputs (rooted at the session's working directory). Omit to leave the current path policy unchanged. """ - additional_directories: list[str] | None = None """Additional directories to allow tool access to (in addition to the session's working directory). When `unrestricted` is true, these are still pre-populated on the @@ -13656,35 +12223,26 @@ class PermissionPathsConfig: """ @staticmethod - def from_dict(obj: Any) -> "PermissionPathsConfig": + def from_dict(obj: Any) -> 'PermissionPathsConfig': assert isinstance(obj, dict) - additional_directories = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("additionalDirectories") - ) + additional_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("additionalDirectories")) include_temp_directory = from_union([from_bool, from_none], obj.get("includeTempDirectory")) unrestricted = from_union([from_bool, from_none], obj.get("unrestricted")) workspace_path = from_union([from_str, from_none], obj.get("workspacePath")) - return PermissionPathsConfig( - additional_directories, include_temp_directory, unrestricted, workspace_path - ) + return PermissionPathsConfig(additional_directories, include_temp_directory, unrestricted, workspace_path) def to_dict(self) -> dict: result: dict = {} if self.additional_directories is not None: - result["additionalDirectories"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.additional_directories - ) + result["additionalDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.additional_directories) if self.include_temp_directory is not None: - result["includeTempDirectory"] = from_union( - [from_bool, from_none], self.include_temp_directory - ) + result["includeTempDirectory"] = from_union([from_bool, from_none], self.include_temp_directory) if self.unrestricted is not None: result["unrestricted"] = from_union([from_bool, from_none], self.unrestricted) if self.workspace_path is not None: result["workspacePath"] = from_union([from_str, from_none], self.workspace_path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceSummary: @@ -13718,7 +12276,7 @@ class WorkspaceSummary: """ISO 8601 timestamp when the workspace was last updated""" @staticmethod - def from_dict(obj: Any) -> "WorkspaceSummary": + def from_dict(obj: Any) -> 'WorkspaceSummary': assert isinstance(obj, dict) id = from_str(obj.get("id")) branch = from_union([from_str, from_none], obj.get("branch")) @@ -13729,9 +12287,7 @@ def from_dict(obj: Any) -> "WorkspaceSummary": name = from_union([from_str, from_none], obj.get("name")) repository = from_union([from_str, from_none], obj.get("repository")) updated_at = from_union([from_datetime, from_none], obj.get("updated_at")) - return WorkspaceSummary( - id, branch, created_at, cwd, git_root, host_type, name, repository, updated_at - ) + return WorkspaceSummary(id, branch, created_at, cwd, git_root, host_type, name, repository, updated_at) def to_dict(self) -> dict: result: dict = {} @@ -13745,9 +12301,7 @@ def to_dict(self) -> dict: if self.git_root is not None: result["git_root"] = from_union([from_str, from_none], self.git_root) if self.host_type is not None: - result["host_type"] = from_union( - [lambda x: to_enum(HostType, x), from_none], self.host_type - ) + result["host_type"] = from_union([lambda x: to_enum(HostType, x), from_none], self.host_type) if self.name is not None: result["name"] = from_union([from_str, from_none], self.name) if self.repository is not None: @@ -13756,14 +12310,12 @@ def to_dict(self) -> dict: result["updated_at"] = from_union([lambda x: x.isoformat(), from_none], self.updated_at) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesGetWorkspaceResult: """Current workspace metadata for the session, including its absolute filesystem path when available. """ - path: str | None = None """Absolute filesystem path to the workspace directory. Omitted when the session has no workspace (e.g. remote sessions). @@ -13772,7 +12324,7 @@ class WorkspacesGetWorkspaceResult: """Current workspace metadata, or null if not available""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesGetWorkspaceResult": + def from_dict(obj: Any) -> 'WorkspacesGetWorkspaceResult': assert isinstance(obj, dict) path = from_union([from_str, from_none], obj.get("path")) workspace = from_union([Workspace.from_dict, from_none], obj.get("workspace")) @@ -13782,12 +12334,9 @@ def to_dict(self) -> dict: result: dict = {} if self.path is not None: result["path"] = from_union([from_str, from_none], self.path) - result["workspace"] = from_union( - [lambda x: to_class(Workspace, x), from_none], self.workspace - ) + result["workspace"] = from_union([lambda x: to_class(Workspace, x), from_none], self.workspace) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspacesListCheckpointsResult: @@ -13797,19 +12346,16 @@ class WorkspacesListCheckpointsResult: """Workspace checkpoints in chronological order. Empty when workspace is not enabled.""" @staticmethod - def from_dict(obj: Any) -> "WorkspacesListCheckpointsResult": + def from_dict(obj: Any) -> 'WorkspacesListCheckpointsResult': assert isinstance(obj, dict) checkpoints = from_list(WorkspacesCheckpoints.from_dict, obj.get("checkpoints")) return WorkspacesListCheckpointsResult(checkpoints) def to_dict(self) -> dict: result: dict = {} - result["checkpoints"] = from_list( - lambda x: to_class(WorkspacesCheckpoints, x), self.checkpoints - ) + result["checkpoints"] = from_list(lambda x: to_class(WorkspacesCheckpoints, x), self.checkpoints) return result - @dataclass class ModelBilling: """Billing information""" @@ -13821,12 +12367,10 @@ class ModelBilling: """Token-level pricing information for this model""" @staticmethod - def from_dict(obj: Any) -> "ModelBilling": + def from_dict(obj: Any) -> 'ModelBilling': assert isinstance(obj, dict) multiplier = from_union([from_float, from_none], obj.get("multiplier")) - token_prices = from_union( - [ModelBillingTokenPrices.from_dict, from_none], obj.get("tokenPrices") - ) + token_prices = from_union([ModelBillingTokenPrices.from_dict, from_none], obj.get("tokenPrices")) return ModelBilling(multiplier, token_prices) def to_dict(self) -> dict: @@ -13834,12 +12378,9 @@ def to_dict(self) -> dict: if self.multiplier is not None: result["multiplier"] = from_union([to_float, from_none], self.multiplier) if self.token_prices is not None: - result["tokenPrices"] = from_union( - [lambda x: to_class(ModelBillingTokenPrices, x), from_none], self.token_prices - ) + result["tokenPrices"] = from_union([lambda x: to_class(ModelBillingTokenPrices, x), from_none], self.token_prices) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelCapabilitiesOverride: @@ -13852,29 +12393,20 @@ class ModelCapabilitiesOverride: """Feature flags indicating what the model supports""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilitiesOverride": + def from_dict(obj: Any) -> 'ModelCapabilitiesOverride': assert isinstance(obj, dict) - limits = from_union( - [ModelCapabilitiesOverrideLimits.from_dict, from_none], obj.get("limits") - ) - supports = from_union( - [ModelCapabilitiesOverrideSupports.from_dict, from_none], obj.get("supports") - ) + limits = from_union([ModelCapabilitiesOverrideLimits.from_dict, from_none], obj.get("limits")) + supports = from_union([ModelCapabilitiesOverrideSupports.from_dict, from_none], obj.get("supports")) return ModelCapabilitiesOverride(limits, supports) def to_dict(self) -> dict: result: dict = {} if self.limits is not None: - result["limits"] = from_union( - [lambda x: to_class(ModelCapabilitiesOverrideLimits, x), from_none], self.limits - ) + result["limits"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideLimits, x), from_none], self.limits) if self.supports is not None: - result["supports"] = from_union( - [lambda x: to_class(ModelCapabilitiesOverrideSupports, x), from_none], self.supports - ) + result["supports"] = from_union([lambda x: to_class(ModelCapabilitiesOverrideSupports, x), from_none], self.supports) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureAdditionalContentExclusionPolicy: @@ -13888,28 +12420,20 @@ class PermissionsConfigureAdditionalContentExclusionPolicy: """ @staticmethod - def from_dict(obj: Any) -> "PermissionsConfigureAdditionalContentExclusionPolicy": + def from_dict(obj: Any) -> 'PermissionsConfigureAdditionalContentExclusionPolicy': assert isinstance(obj, dict) last_updated_at = from_union([from_float, from_str], obj.get("last_updated_at")) - rules = from_list( - PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules") - ) + rules = from_list(PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict, obj.get("rules")) scope = PermissionsConfigureAdditionalContentExclusionPolicyScope(obj.get("scope")) return PermissionsConfigureAdditionalContentExclusionPolicy(last_updated_at, rules, scope) def to_dict(self) -> dict: result: dict = {} result["last_updated_at"] = from_union([to_float, from_str], self.last_updated_at) - result["rules"] = from_list( - lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, x), - self.rules, - ) - result["scope"] = to_enum( - PermissionsConfigureAdditionalContentExclusionPolicyScope, self.scope - ) + result["rules"] = from_list(lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, x), self.rules) + result["scope"] = to_enum(PermissionsConfigureAdditionalContentExclusionPolicyScope, self.scope) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class QueuePendingItemsResult: @@ -13925,7 +12449,7 @@ class QueuePendingItemsResult: """ @staticmethod - def from_dict(obj: Any) -> "QueuePendingItemsResult": + def from_dict(obj: Any) -> 'QueuePendingItemsResult': assert isinstance(obj, dict) items = from_list(QueuePendingItems.from_dict, obj.get("items")) steering_messages = from_list(from_str, obj.get("steeringMessages")) @@ -13937,7 +12461,6 @@ def to_dict(self) -> dict: result["steeringMessages"] = from_list(from_str, self.steering_messages) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SendAttachmentSelection: @@ -13959,7 +12482,7 @@ class SendAttachmentSelection: """Attachment type discriminator""" @staticmethod - def from_dict(obj: Any) -> "SendAttachmentSelection": + def from_dict(obj: Any) -> 'SendAttachmentSelection': assert isinstance(obj, dict) display_name = from_str(obj.get("displayName")) file_path = from_str(obj.get("filePath")) @@ -13976,7 +12499,7 @@ def to_dict(self) -> dict: result["type"] = self.type return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReadFileResult: """File content as a UTF-8 string, or a filesystem error if the read failed.""" @@ -13988,7 +12511,7 @@ class SessionFSReadFileResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReadFileResult": + def from_dict(obj: Any) -> 'SessionFSReadFileResult': assert isinstance(obj, dict) content = from_str(obj.get("content")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) @@ -13998,12 +12521,10 @@ def to_dict(self) -> dict: result: dict = {} result["content"] = from_str(self.content) if self.error is not None: - result["error"] = from_union( - [lambda x: to_class(SessionFSError, x), from_none], self.error - ) + result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirResult: """Names of entries in the requested directory, or a filesystem error if the read failed.""" @@ -14015,7 +12536,7 @@ class SessionFSReaddirResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReaddirResult": + def from_dict(obj: Any) -> 'SessionFSReaddirResult': assert isinstance(obj, dict) entries = from_list(from_str, obj.get("entries")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) @@ -14025,18 +12546,15 @@ def to_dict(self) -> dict: result: dict = {} result["entries"] = from_list(from_str, self.entries) if self.error is not None: - result["error"] = from_union( - [lambda x: to_class(SessionFSError, x), from_none], self.error - ) + result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSSqliteQueryResult: """Query results including rows, columns, and rows affected, or a filesystem error if execution failed. """ - columns: list[str] """Column names from the result set""" @@ -14053,7 +12571,7 @@ class SessionFSSqliteQueryResult: """SQLite last_insert_rowid() value for INSERT.""" @staticmethod - def from_dict(obj: Any) -> "SessionFSSqliteQueryResult": + def from_dict(obj: Any) -> 'SessionFSSqliteQueryResult': assert isinstance(obj, dict) columns = from_list(from_str, obj.get("columns")) rows = from_list(lambda x: from_dict(lambda x: x, x), obj.get("rows")) @@ -14068,14 +12586,12 @@ def to_dict(self) -> dict: result["rows"] = from_list(lambda x: from_dict(lambda x: x, x), self.rows) result["rowsAffected"] = from_int(self.rows_affected) if self.error is not None: - result["error"] = from_union( - [lambda x: to_class(SessionFSError, x), from_none], self.error - ) + result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) if self.last_insert_rowid is not None: result["lastInsertRowid"] = from_union([from_int, from_none], self.last_insert_rowid) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSStatResult: """Filesystem metadata for the requested path, or a filesystem error if the stat failed.""" @@ -14099,7 +12615,7 @@ class SessionFSStatResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> "SessionFSStatResult": + def from_dict(obj: Any) -> 'SessionFSStatResult': assert isinstance(obj, dict) birthtime = from_datetime(obj.get("birthtime")) is_directory = from_bool(obj.get("isDirectory")) @@ -14117,18 +12633,15 @@ def to_dict(self) -> dict: result["mtime"] = self.mtime.isoformat() result["size"] = from_int(self.size) if self.error is not None: - result["error"] = from_union( - [lambda x: to_class(SessionFSError, x), from_none], self.error - ) + result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionFSReaddirWithTypesResult: """Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. """ - entries: list[SessionFSReaddirWithTypesEntry] """Directory entries with type information""" @@ -14136,7 +12649,7 @@ class SessionFSReaddirWithTypesResult: """Describes a filesystem error.""" @staticmethod - def from_dict(obj: Any) -> "SessionFSReaddirWithTypesResult": + def from_dict(obj: Any) -> 'SessionFSReaddirWithTypesResult': assert isinstance(obj, dict) entries = from_list(SessionFSReaddirWithTypesEntry.from_dict, obj.get("entries")) error = from_union([SessionFSError.from_dict, from_none], obj.get("error")) @@ -14144,16 +12657,11 @@ def from_dict(obj: Any) -> "SessionFSReaddirWithTypesResult": def to_dict(self) -> dict: result: dict = {} - result["entries"] = from_list( - lambda x: to_class(SessionFSReaddirWithTypesEntry, x), self.entries - ) + result["entries"] = from_list(lambda x: to_class(SessionFSReaddirWithTypesEntry, x), self.entries) if self.error is not None: - result["error"] = from_union( - [lambda x: to_class(SessionFSError, x), from_none], self.error - ) + result["error"] = from_union([lambda x: to_class(SessionFSError, x), from_none], self.error) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentGetCurrentResult: @@ -14163,7 +12671,7 @@ class AgentGetCurrentResult: """Currently selected custom agent, or null if using the default agent""" @staticmethod - def from_dict(obj: Any) -> "AgentGetCurrentResult": + def from_dict(obj: Any) -> 'AgentGetCurrentResult': assert isinstance(obj, dict) agent = from_union([AgentInfo.from_dict, from_none], obj.get("agent")) return AgentGetCurrentResult(agent) @@ -14174,7 +12682,6 @@ def to_dict(self) -> dict: result["agent"] = from_union([lambda x: to_class(AgentInfo, x), from_none], self.agent) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentList: @@ -14184,7 +12691,7 @@ class AgentList: """Available custom agents""" @staticmethod - def from_dict(obj: Any) -> "AgentList": + def from_dict(obj: Any) -> 'AgentList': assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return AgentList(agents) @@ -14194,7 +12701,6 @@ def to_dict(self) -> dict: result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentReloadResult: @@ -14204,7 +12710,7 @@ class AgentReloadResult: """Reloaded custom agents""" @staticmethod - def from_dict(obj: Any) -> "AgentReloadResult": + def from_dict(obj: Any) -> 'AgentReloadResult': assert isinstance(obj, dict) agents = from_list(AgentInfo.from_dict, obj.get("agents")) return AgentReloadResult(agents) @@ -14214,7 +12720,6 @@ def to_dict(self) -> dict: result["agents"] = from_list(lambda x: to_class(AgentInfo, x), self.agents) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class AgentSelectResult: @@ -14224,7 +12729,7 @@ class AgentSelectResult: """The newly selected custom agent""" @staticmethod - def from_dict(obj: Any) -> "AgentSelectResult": + def from_dict(obj: Any) -> 'AgentSelectResult': assert isinstance(obj, dict) agent = AgentInfo.from_dict(obj.get("agent")) return AgentSelectResult(agent) @@ -14234,7 +12739,6 @@ def to_dict(self) -> dict: result["agent"] = to_class(AgentInfo, self.agent) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskProgress: @@ -14242,7 +12746,6 @@ class TaskProgress: Schema for the `TaskShellProgress` type. """ - type: TaskInfoType """Progress kind""" @@ -14259,14 +12762,11 @@ class TaskProgress: """Recent stdout/stderr lines from the running shell command""" @staticmethod - def from_dict(obj: Any) -> "TaskProgress": + def from_dict(obj: Any) -> 'TaskProgress': assert isinstance(obj, dict) type = TaskInfoType(obj.get("type")) latest_intent = from_union([from_str, from_none], obj.get("latestIntent")) - recent_activity = from_union( - [lambda x: from_list(TaskProgressLine.from_dict, x), from_none], - obj.get("recentActivity"), - ) + recent_activity = from_union([lambda x: from_list(TaskProgressLine.from_dict, x), from_none], obj.get("recentActivity")) pid = from_union([from_int, from_none], obj.get("pid")) recent_output = from_union([from_str, from_none], obj.get("recentOutput")) return TaskProgress(type, latest_intent, recent_activity, pid, recent_output) @@ -14277,17 +12777,13 @@ def to_dict(self) -> dict: if self.latest_intent is not None: result["latestIntent"] = from_union([from_str, from_none], self.latest_intent) if self.recent_activity is not None: - result["recentActivity"] = from_union( - [lambda x: from_list(lambda x: to_class(TaskProgressLine, x), x), from_none], - self.recent_activity, - ) + result["recentActivity"] = from_union([lambda x: from_list(lambda x: to_class(TaskProgressLine, x), x), from_none], self.recent_activity) if self.pid is not None: result["pid"] = from_union([from_int, from_none], self.pid) if self.recent_output is not None: result["recentOutput"] = from_union([from_str, from_none], self.recent_output) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayAnyOfField: @@ -14315,7 +12811,7 @@ class UIElicitationArrayAnyOfField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationArrayAnyOfField": + def from_dict(obj: Any) -> 'UIElicitationArrayAnyOfField': assert isinstance(obj, dict) items = UIElicitationArrayAnyOfFieldItems.from_dict(obj.get("items")) type = UIElicitationArrayAnyOfFieldType(obj.get("type")) @@ -14324,18 +12820,14 @@ def from_dict(obj: Any) -> "UIElicitationArrayAnyOfField": max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationArrayAnyOfField( - items, type, default, description, max_items, min_items, title - ) + return UIElicitationArrayAnyOfField(items, type, default, description, max_items, min_items, title) def to_dict(self) -> dict: result: dict = {} result["items"] = to_class(UIElicitationArrayAnyOfFieldItems, self.items) result["type"] = to_enum(UIElicitationArrayAnyOfFieldType, self.type) if self.default is not None: - result["default"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.default - ) + result["default"] = from_union([lambda x: from_list(from_str, x), from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.max_items is not None: @@ -14346,7 +12838,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationArrayEnumField: @@ -14374,7 +12865,7 @@ class UIElicitationArrayEnumField: """Human-readable label for the field.""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationArrayEnumField": + def from_dict(obj: Any) -> 'UIElicitationArrayEnumField': assert isinstance(obj, dict) items = UIElicitationArrayEnumFieldItems.from_dict(obj.get("items")) type = UIElicitationArrayAnyOfFieldType(obj.get("type")) @@ -14383,18 +12874,14 @@ def from_dict(obj: Any) -> "UIElicitationArrayEnumField": max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) title = from_union([from_str, from_none], obj.get("title")) - return UIElicitationArrayEnumField( - items, type, default, description, max_items, min_items, title - ) + return UIElicitationArrayEnumField(items, type, default, description, max_items, min_items, title) def to_dict(self) -> dict: result: dict = {} result["items"] = to_class(UIElicitationArrayEnumFieldItems, self.items) result["type"] = to_enum(UIElicitationArrayAnyOfFieldType, self.type) if self.default is not None: - result["default"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.default - ) + result["default"] = from_union([lambda x: from_list(from_str, x), from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.max_items is not None: @@ -14405,7 +12892,6 @@ def to_dict(self) -> dict: result["title"] = from_union([from_str, from_none], self.title) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchemaProperty: @@ -14425,7 +12911,6 @@ class UIElicitationSchemaProperty: Numeric field accepting either a number or an integer. """ - type: UIElicitationSchemaPropertyType """Type discriminator. Always "string". @@ -14482,21 +12967,15 @@ class UIElicitationSchemaProperty: """Minimum allowed value (inclusive).""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationSchemaProperty": + def from_dict(obj: Any) -> 'UIElicitationSchemaProperty': assert isinstance(obj, dict) type = UIElicitationSchemaPropertyType(obj.get("type")) - default = from_union( - [from_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], - obj.get("default"), - ) + default = from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], obj.get("default")) description = from_union([from_str, from_none], obj.get("description")) enum = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enum")) enum_names = from_union([lambda x: from_list(from_str, x), from_none], obj.get("enumNames")) title = from_union([from_str, from_none], obj.get("title")) - one_of = from_union( - [lambda x: from_list(UIElicitationStringOneOfFieldOneOf.from_dict, x), from_none], - obj.get("oneOf"), - ) + one_of = from_union([lambda x: from_list(UIElicitationStringOneOfFieldOneOf.from_dict, x), from_none], obj.get("oneOf")) items = from_union([UIElicitationArrayFieldItems.from_dict, from_none], obj.get("items")) max_items = from_union([from_int, from_none], obj.get("maxItems")) min_items = from_union([from_int, from_none], obj.get("minItems")) @@ -14505,65 +12984,31 @@ def from_dict(obj: Any) -> "UIElicitationSchemaProperty": min_length = from_union([from_int, from_none], obj.get("minLength")) maximum = from_union([from_float, from_none], obj.get("maximum")) minimum = from_union([from_float, from_none], obj.get("minimum")) - return UIElicitationSchemaProperty( - type, - default, - description, - enum, - enum_names, - title, - one_of, - items, - max_items, - min_items, - format, - max_length, - min_length, - maximum, - minimum, - ) + return UIElicitationSchemaProperty(type, default, description, enum, enum_names, title, one_of, items, max_items, min_items, format, max_length, min_length, maximum, minimum) def to_dict(self) -> dict: result: dict = {} result["type"] = to_enum(UIElicitationSchemaPropertyType, self.type) if self.default is not None: - result["default"] = from_union( - [to_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], - self.default, - ) + result["default"] = from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str, from_none], self.default) if self.description is not None: result["description"] = from_union([from_str, from_none], self.description) if self.enum is not None: result["enum"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum) if self.enum_names is not None: - result["enumNames"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.enum_names - ) + result["enumNames"] = from_union([lambda x: from_list(from_str, x), from_none], self.enum_names) if self.title is not None: result["title"] = from_union([from_str, from_none], self.title) if self.one_of is not None: - result["oneOf"] = from_union( - [ - lambda x: from_list( - lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), x - ), - from_none, - ], - self.one_of, - ) + result["oneOf"] = from_union([lambda x: from_list(lambda x: to_class(UIElicitationStringOneOfFieldOneOf, x), x), from_none], self.one_of) if self.items is not None: - result["items"] = from_union( - [lambda x: to_class(UIElicitationArrayFieldItems, x), from_none], self.items - ) + result["items"] = from_union([lambda x: to_class(UIElicitationArrayFieldItems, x), from_none], self.items) if self.max_items is not None: result["maxItems"] = from_union([from_int, from_none], self.max_items) if self.min_items is not None: result["minItems"] = from_union([from_int, from_none], self.min_items) if self.format is not None: - result["format"] = from_union( - [lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], - self.format, - ) + result["format"] = from_union([lambda x: to_enum(UIElicitationSchemaPropertyStringFormat, x), from_none], self.format) if self.max_length is not None: result["maxLength"] = from_union([from_int, from_none], self.max_length) if self.min_length is not None: @@ -14574,14 +13019,12 @@ def to_dict(self) -> dict: result["minimum"] = from_union([to_float, from_none], self.minimum) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingElicitationRequest: """Pending elicitation request ID and the user's response (accept/decline/cancel + form values). """ - request_id: str """The unique request ID from the elicitation.requested event""" @@ -14589,7 +13032,7 @@ class UIHandlePendingElicitationRequest: """The elicitation response (accept with form values, decline, or cancel)""" @staticmethod - def from_dict(obj: Any) -> "UIHandlePendingElicitationRequest": + def from_dict(obj: Any) -> 'UIHandlePendingElicitationRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) result = UIElicitationResponse.from_dict(obj.get("result")) @@ -14601,7 +13044,6 @@ def to_dict(self) -> dict: result["result"] = to_class(UIElicitationResponse, self.result) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIHandlePendingExitPlanModeRequest: @@ -14614,7 +13056,7 @@ class UIHandlePendingExitPlanModeRequest: """Schema for the `UIExitPlanModeResponse` type.""" @staticmethod - def from_dict(obj: Any) -> "UIHandlePendingExitPlanModeRequest": + def from_dict(obj: Any) -> 'UIHandlePendingExitPlanModeRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) response = UIExitPlanModeResponse.from_dict(obj.get("response")) @@ -14626,14 +13068,12 @@ def to_dict(self) -> dict: result["response"] = to_class(UIExitPlanModeResponse, self.response) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UsageGetMetricsResult: """Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals. """ - code_changes: UsageMetricsCodeChanges """Aggregated code change metrics""" @@ -14669,7 +13109,7 @@ class UsageGetMetricsResult: """Session-wide accumulated nano-AI units cost""" @staticmethod - def from_dict(obj: Any) -> "UsageGetMetricsResult": + def from_dict(obj: Any) -> 'UsageGetMetricsResult': assert isinstance(obj, dict) code_changes = UsageMetricsCodeChanges.from_dict(obj.get("codeChanges")) last_call_input_tokens = from_int(obj.get("lastCallInputTokens")) @@ -14680,33 +13120,16 @@ def from_dict(obj: Any) -> "UsageGetMetricsResult": total_premium_request_cost = from_float(obj.get("totalPremiumRequestCost")) total_user_requests = from_int(obj.get("totalUserRequests")) current_model = from_union([from_str, from_none], obj.get("currentModel")) - token_details = from_union( - [lambda x: from_dict(UsageMetricsTokenDetail.from_dict, x), from_none], - obj.get("tokenDetails"), - ) + token_details = from_union([lambda x: from_dict(UsageMetricsTokenDetail.from_dict, x), from_none], obj.get("tokenDetails")) total_nano_aiu = from_union([from_float, from_none], obj.get("totalNanoAiu")) - return UsageGetMetricsResult( - code_changes, - last_call_input_tokens, - last_call_output_tokens, - model_metrics, - session_start_time, - total_api_duration_ms, - total_premium_request_cost, - total_user_requests, - current_model, - token_details, - total_nano_aiu, - ) + return UsageGetMetricsResult(code_changes, last_call_input_tokens, last_call_output_tokens, model_metrics, session_start_time, total_api_duration_ms, total_premium_request_cost, total_user_requests, current_model, token_details, total_nano_aiu) def to_dict(self) -> dict: result: dict = {} result["codeChanges"] = to_class(UsageMetricsCodeChanges, self.code_changes) result["lastCallInputTokens"] = from_int(self.last_call_input_tokens) result["lastCallOutputTokens"] = from_int(self.last_call_output_tokens) - result["modelMetrics"] = from_dict( - lambda x: to_class(UsageMetricsModelMetric, x), self.model_metrics - ) + result["modelMetrics"] = from_dict(lambda x: to_class(UsageMetricsModelMetric, x), self.model_metrics) result["sessionStartTime"] = self.session_start_time.isoformat() result["totalApiDurationMs"] = from_int(self.total_api_duration_ms) result["totalPremiumRequestCost"] = to_float(self.total_premium_request_cost) @@ -14714,15 +13137,11 @@ def to_dict(self) -> dict: if self.current_model is not None: result["currentModel"] = from_union([from_str, from_none], self.current_model) if self.token_details is not None: - result["tokenDetails"] = from_union( - [lambda x: from_dict(lambda x: to_class(UsageMetricsTokenDetail, x), x), from_none], - self.token_details, - ) + result["tokenDetails"] = from_union([lambda x: from_dict(lambda x: to_class(UsageMetricsTokenDetail, x), x), from_none], self.token_details) if self.total_nano_aiu is not None: result["totalNanoAiu"] = from_union([to_float, from_none], self.total_nano_aiu) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class WorkspaceDiffResult: @@ -14744,7 +13163,7 @@ class WorkspaceDiffResult: """Default branch used for a branch diff, when branch mode was requested.""" @staticmethod - def from_dict(obj: Any) -> "WorkspaceDiffResult": + def from_dict(obj: Any) -> 'WorkspaceDiffResult': assert isinstance(obj, dict) changes = from_list(WorkspaceDiffFileChange.from_dict, obj.get("changes")) is_fallback = from_bool(obj.get("isFallback")) @@ -14763,7 +13182,6 @@ def to_dict(self) -> dict: result["baseBranch"] = from_union([from_str, from_none], self.base_branch) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CommandList: @@ -14773,7 +13191,7 @@ class CommandList: """Commands available in this session""" @staticmethod - def from_dict(obj: Any) -> "CommandList": + def from_dict(obj: Any) -> 'CommandList': assert isinstance(obj, dict) commands = from_list(SlashCommandInfo.from_dict, obj.get("commands")) return CommandList(commands) @@ -14783,7 +13201,7 @@ def to_dict(self) -> dict: result["commands"] = from_list(lambda x: to_class(SlashCommandInfo, x), self.commands) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderCloseRequest: """Canvas close parameters sent to the provider.""" @@ -14804,7 +13222,7 @@ class CanvasProviderCloseRequest: """Host context supplied by the runtime.""" @staticmethod - def from_dict(obj: Any) -> "CanvasProviderCloseRequest": + def from_dict(obj: Any) -> 'CanvasProviderCloseRequest': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) extension_id = from_str(obj.get("extensionId")) @@ -14820,12 +13238,10 @@ def to_dict(self) -> dict: result["instanceId"] = from_str(self.instance_id) result["sessionId"] = from_str(self.session_id) if self.host is not None: - result["host"] = from_union( - [lambda x: to_class(CanvasHostContext, x), from_none], self.host - ) + result["host"] = from_union([lambda x: to_class(CanvasHostContext, x), from_none], self.host) return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderInvokeActionRequest: """Canvas action invocation parameters sent to the provider.""" @@ -14852,7 +13268,7 @@ class CanvasProviderInvokeActionRequest: """Action input""" @staticmethod - def from_dict(obj: Any) -> "CanvasProviderInvokeActionRequest": + def from_dict(obj: Any) -> 'CanvasProviderInvokeActionRequest': assert isinstance(obj, dict) action_name = from_str(obj.get("actionName")) canvas_id = from_str(obj.get("canvasId")) @@ -14861,9 +13277,7 @@ def from_dict(obj: Any) -> "CanvasProviderInvokeActionRequest": session_id = from_str(obj.get("sessionId")) host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) input = obj.get("input") - return CanvasProviderInvokeActionRequest( - action_name, canvas_id, extension_id, instance_id, session_id, host, input - ) + return CanvasProviderInvokeActionRequest(action_name, canvas_id, extension_id, instance_id, session_id, host, input) def to_dict(self) -> dict: result: dict = {} @@ -14873,14 +13287,12 @@ def to_dict(self) -> dict: result["instanceId"] = from_str(self.instance_id) result["sessionId"] = from_str(self.session_id) if self.host is not None: - result["host"] = from_union( - [lambda x: to_class(CanvasHostContext, x), from_none], self.host - ) + result["host"] = from_union([lambda x: to_class(CanvasHostContext, x), from_none], self.host) if self.input is not None: result["input"] = self.input return result - +# Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CanvasProviderOpenRequest: """Canvas open parameters sent to the provider.""" @@ -14904,7 +13316,7 @@ class CanvasProviderOpenRequest: """Canvas open input""" @staticmethod - def from_dict(obj: Any) -> "CanvasProviderOpenRequest": + def from_dict(obj: Any) -> 'CanvasProviderOpenRequest': assert isinstance(obj, dict) canvas_id = from_str(obj.get("canvasId")) extension_id = from_str(obj.get("extensionId")) @@ -14912,9 +13324,7 @@ def from_dict(obj: Any) -> "CanvasProviderOpenRequest": session_id = from_str(obj.get("sessionId")) host = from_union([CanvasHostContext.from_dict, from_none], obj.get("host")) input = obj.get("input") - return CanvasProviderOpenRequest( - canvas_id, extension_id, instance_id, session_id, host, input - ) + return CanvasProviderOpenRequest(canvas_id, extension_id, instance_id, session_id, host, input) def to_dict(self) -> dict: result: dict = {} @@ -14923,14 +13333,11 @@ def to_dict(self) -> dict: result["instanceId"] = from_str(self.instance_id) result["sessionId"] = from_str(self.session_id) if self.host is not None: - result["host"] = from_union( - [lambda x: to_class(CanvasHostContext, x), from_none], self.host - ) + result["host"] = from_union([lambda x: to_class(CanvasHostContext, x), from_none], self.host) if self.input is not None: result["input"] = self.input return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class APIKeyAuthInfo: @@ -14952,13 +13359,11 @@ class APIKeyAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "APIKeyAuthInfo": + def from_dict(obj: Any) -> 'APIKeyAuthInfo': assert isinstance(obj, dict) api_key = from_str(obj.get("apiKey")) host = from_str(obj.get("host")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return APIKeyAuthInfo(api_key, host, copilot_user) def to_dict(self) -> dict: @@ -14967,12 +13372,9 @@ def to_dict(self) -> dict: result["host"] = from_str(self.host) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class CopilotAPITokenAuthInfo: @@ -14993,12 +13395,10 @@ class CopilotAPITokenAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "CopilotAPITokenAuthInfo": + def from_dict(obj: Any) -> 'CopilotAPITokenAuthInfo': assert isinstance(obj, dict) host = Host(obj.get("host")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return CopilotAPITokenAuthInfo(host, copilot_user) def to_dict(self) -> dict: @@ -15006,12 +13406,9 @@ def to_dict(self) -> dict: result["host"] = to_enum(Host, self.host) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class EnvAuthInfo: @@ -15041,14 +13438,12 @@ class EnvAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "EnvAuthInfo": + def from_dict(obj: Any) -> 'EnvAuthInfo': assert isinstance(obj, dict) env_var = from_str(obj.get("envVar")) host = from_str(obj.get("host")) token = from_str(obj.get("token")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) login = from_union([from_str, from_none], obj.get("login")) return EnvAuthInfo(env_var, host, token, copilot_user, login) @@ -15059,14 +13454,11 @@ def to_dict(self) -> dict: result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) if self.login is not None: result["login"] = from_union([from_str, from_none], self.login) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class GhCLIAuthInfo: @@ -15091,14 +13483,12 @@ class GhCLIAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "GhCLIAuthInfo": + def from_dict(obj: Any) -> 'GhCLIAuthInfo': assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) token = from_str(obj.get("token")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return GhCLIAuthInfo(host, login, token, copilot_user) def to_dict(self) -> dict: @@ -15108,12 +13498,9 @@ def to_dict(self) -> dict: result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HMACAuthInfo: @@ -15135,13 +13522,11 @@ class HMACAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "HMACAuthInfo": + def from_dict(obj: Any) -> 'HMACAuthInfo': assert isinstance(obj, dict) hmac = from_str(obj.get("hmac")) host = Host(obj.get("host")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return HMACAuthInfo(hmac, host, copilot_user) def to_dict(self) -> dict: @@ -15150,12 +13535,9 @@ def to_dict(self) -> dict: result["host"] = to_enum(Host, self.host) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TokenAuthInfo: @@ -15177,13 +13559,11 @@ class TokenAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "TokenAuthInfo": + def from_dict(obj: Any) -> 'TokenAuthInfo': assert isinstance(obj, dict) host = from_str(obj.get("host")) token = from_str(obj.get("token")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return TokenAuthInfo(host, token, copilot_user) def to_dict(self) -> dict: @@ -15192,12 +13572,9 @@ def to_dict(self) -> dict: result["token"] = from_str(self.token) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UserAuthInfo: @@ -15220,13 +13597,11 @@ class UserAuthInfo: """ @staticmethod - def from_dict(obj: Any) -> "UserAuthInfo": + def from_dict(obj: Any) -> 'UserAuthInfo': assert isinstance(obj, dict) host = from_str(obj.get("host")) login = from_str(obj.get("login")) - copilot_user = from_union( - [CopilotUserResponse.from_dict, from_none], obj.get("copilotUser") - ) + copilot_user = from_union([CopilotUserResponse.from_dict, from_none], obj.get("copilotUser")) return UserAuthInfo(host, login, copilot_user) def to_dict(self) -> dict: @@ -15235,12 +13610,9 @@ def to_dict(self) -> dict: result["login"] = from_str(self.login) result["type"] = self.type if self.copilot_user is not None: - result["copilotUser"] = from_union( - [lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user - ) + result["copilotUser"] = from_union([lambda x: to_class(CopilotUserResponse, x), from_none], self.copilot_user) return result - @dataclass class PermissionDecisionApproveForIonApproval: """Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) @@ -15289,7 +13661,6 @@ class PermissionDecisionApproveForIonApproval: The approval to persist for this location """ - command_identifiers: list[str] | None = None """Command identifiers covered by this approval.""" @@ -15330,36 +13701,21 @@ class PermissionDecisionApproveForIonApproval: external_ref_marker_external_ref_user_tool_session_approval: str | None = None @staticmethod - def from_dict(obj: Any) -> "PermissionDecisionApproveForIonApproval": + def from_dict(obj: Any) -> 'PermissionDecisionApproveForIonApproval': assert isinstance(obj, dict) - command_identifiers = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("commandIdentifiers") - ) + command_identifiers = from_union([lambda x: from_list(from_str, x), from_none], obj.get("commandIdentifiers")) kind = from_union([ApprovalKind, from_none], obj.get("kind")) server_name = from_union([from_str, from_none], obj.get("serverName")) tool_name = from_union([from_none, from_str], obj.get("toolName")) operation = from_union([from_str, from_none], obj.get("operation")) extension_name = from_union([from_str, from_none], obj.get("extensionName")) - external_ref_marker_external_ref_user_tool_session_approval = from_union( - [from_str, from_none], - obj.get("__externalRefMarker___ExternalRef_UserToolSessionApproval"), - ) - return PermissionDecisionApproveForIonApproval( - command_identifiers, - kind, - server_name, - tool_name, - operation, - extension_name, - external_ref_marker_external_ref_user_tool_session_approval, - ) + external_ref_marker_external_ref_user_tool_session_approval = from_union([from_str, from_none], obj.get("__externalRefMarker___ExternalRef_UserToolSessionApproval")) + return PermissionDecisionApproveForIonApproval(command_identifiers, kind, server_name, tool_name, operation, extension_name, external_ref_marker_external_ref_user_tool_session_approval) def to_dict(self) -> dict: result: dict = {} if self.command_identifiers is not None: - result["commandIdentifiers"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.command_identifiers - ) + result["commandIdentifiers"] = from_union([lambda x: from_list(from_str, x), from_none], self.command_identifiers) if self.kind is not None: result["kind"] = from_union([lambda x: to_enum(ApprovalKind, x), from_none], self.kind) if self.server_name is not None: @@ -15371,20 +13727,15 @@ def to_dict(self) -> dict: if self.extension_name is not None: result["extensionName"] = from_union([from_str, from_none], self.extension_name) if self.external_ref_marker_external_ref_user_tool_session_approval is not None: - result["__externalRefMarker___ExternalRef_UserToolSessionApproval"] = from_union( - [from_str, from_none], - self.external_ref_marker_external_ref_user_tool_session_approval, - ) + result["__externalRefMarker___ExternalRef_UserToolSessionApproval"] = from_union([from_str, from_none], self.external_ref_marker_external_ref_user_tool_session_approval) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class HandlePendingToolCallRequest: """Pending external tool call request ID, with the tool result or an error describing why it failed. """ - request_id: str """Request ID of the pending tool call""" @@ -15395,13 +13746,11 @@ class HandlePendingToolCallRequest: """Tool call result (string or expanded result object)""" @staticmethod - def from_dict(obj: Any) -> "HandlePendingToolCallRequest": + def from_dict(obj: Any) -> 'HandlePendingToolCallRequest': assert isinstance(obj, dict) request_id = from_str(obj.get("requestId")) error = from_union([from_str, from_none], obj.get("error")) - result = from_union( - [ExternalToolTextResultForLlm.from_dict, from_str, from_none], obj.get("result") - ) + result = from_union([ExternalToolTextResultForLlm.from_dict, from_str, from_none], obj.get("result")) return HandlePendingToolCallRequest(request_id, error, result) def to_dict(self) -> dict: @@ -15410,13 +13759,9 @@ def to_dict(self) -> dict: if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.result is not None: - result["result"] = from_union( - [lambda x: to_class(ExternalToolTextResultForLlm, x), from_str, from_none], - self.result, - ) + result["result"] = from_union([lambda x: to_class(ExternalToolTextResultForLlm, x), from_str, from_none], self.result) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class InstalledPlugin: @@ -15444,20 +13789,16 @@ class InstalledPlugin: """Version installed (if available)""" @staticmethod - def from_dict(obj: Any) -> "InstalledPlugin": + def from_dict(obj: Any) -> 'InstalledPlugin': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) installed_at = from_str(obj.get("installed_at")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) cache_path = from_union([from_str, from_none], obj.get("cache_path")) - source = from_union( - [InstalledPluginSource.from_dict, from_str, from_none], obj.get("source") - ) + source = from_union([InstalledPluginSource.from_dict, from_str, from_none], obj.get("source")) version = from_union([from_str, from_none], obj.get("version")) - return InstalledPlugin( - enabled, installed_at, marketplace, name, cache_path, source, version - ) + return InstalledPlugin(enabled, installed_at, marketplace, name, cache_path, source, version) def to_dict(self) -> dict: result: dict = {} @@ -15468,14 +13809,11 @@ def to_dict(self) -> dict: if self.cache_path is not None: result["cache_path"] = from_union([from_str, from_none], self.cache_path) if self.source is not None: - result["source"] = from_union( - [lambda x: to_class(InstalledPluginSource, x), from_str, from_none], self.source - ) + result["source"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str, from_none], self.source) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionInstalledPlugin: @@ -15503,20 +13841,16 @@ class SessionInstalledPlugin: """Installed version, if known""" @staticmethod - def from_dict(obj: Any) -> "SessionInstalledPlugin": + def from_dict(obj: Any) -> 'SessionInstalledPlugin': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) installed_at = from_str(obj.get("installed_at")) marketplace = from_str(obj.get("marketplace")) name = from_str(obj.get("name")) cache_path = from_union([from_str, from_none], obj.get("cache_path")) - source = from_union( - [SessionInstalledPluginSource.from_dict, from_str, from_none], obj.get("source") - ) + source = from_union([SessionInstalledPluginSource.from_dict, from_str, from_none], obj.get("source")) version = from_union([from_str, from_none], obj.get("version")) - return SessionInstalledPlugin( - enabled, installed_at, marketplace, name, cache_path, source, version - ) + return SessionInstalledPlugin(enabled, installed_at, marketplace, name, cache_path, source, version) def to_dict(self) -> dict: result: dict = {} @@ -15527,15 +13861,11 @@ def to_dict(self) -> dict: if self.cache_path is not None: result["cache_path"] = from_union([from_str, from_none], self.cache_path) if self.source is not None: - result["source"] = from_union( - [lambda x: to_class(SessionInstalledPluginSource, x), from_str, from_none], - self.source, - ) + result["source"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str, from_none], self.source) if self.version is not None: result["version"] = from_union([from_str, from_none], self.version) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionEnrichMetadataResult: @@ -15545,7 +13875,7 @@ class SessionEnrichMetadataResult: """Same records, with summary and context backfilled""" @staticmethod - def from_dict(obj: Any) -> "SessionEnrichMetadataResult": + def from_dict(obj: Any) -> 'SessionEnrichMetadataResult': assert isinstance(obj, dict) sessions = from_list(SessionMetadata.from_dict, obj.get("sessions")) return SessionEnrichMetadataResult(sessions) @@ -15555,7 +13885,6 @@ def to_dict(self) -> dict: result["sessions"] = from_list(lambda x: to_class(SessionMetadata, x), self.sessions) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionList: @@ -15565,7 +13894,7 @@ class SessionList: """Sessions ordered most-recently-modified first""" @staticmethod - def from_dict(obj: Any) -> "SessionList": + def from_dict(obj: Any) -> 'SessionList': assert isinstance(obj, dict) sessions = from_list(SessionMetadata.from_dict, obj.get("sessions")) return SessionList(sessions) @@ -15575,7 +13904,6 @@ def to_dict(self) -> dict: result["sessions"] = from_list(lambda x: to_class(SessionMetadata, x), self.sessions) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsEnrichMetadataRequest: @@ -15587,7 +13915,7 @@ class SessionsEnrichMetadataRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsEnrichMetadataRequest": + def from_dict(obj: Any) -> 'SessionsEnrichMetadataRequest': assert isinstance(obj, dict) sessions = from_list(SessionMetadata.from_dict, obj.get("sessions")) return SessionsEnrichMetadataRequest(sessions) @@ -15597,7 +13925,6 @@ def to_dict(self) -> dict: result["sessions"] = from_list(lambda x: to_class(SessionMetadata, x), self.sessions) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionMetadataSnapshot: @@ -15655,7 +13982,7 @@ class SessionMetadataSnapshot: """ @staticmethod - def from_dict(obj: Any) -> "SessionMetadataSnapshot": + def from_dict(obj: Any) -> 'SessionMetadataSnapshot': assert isinstance(obj, dict) already_in_use = from_bool(obj.get("alreadyInUse")) current_mode = MetadataSnapshotCurrentMode(obj.get("currentMode")) @@ -15665,28 +13992,12 @@ def from_dict(obj: Any) -> "SessionMetadataSnapshot": start_time = from_datetime(obj.get("startTime")) working_directory = from_str(obj.get("workingDirectory")) initial_name = from_union([from_str, from_none], obj.get("initialName")) - remote_metadata = from_union( - [MetadataSnapshotRemoteMetadata.from_dict, from_none], obj.get("remoteMetadata") - ) + remote_metadata = from_union([MetadataSnapshotRemoteMetadata.from_dict, from_none], obj.get("remoteMetadata")) selected_model = from_union([from_str, from_none], obj.get("selectedModel")) summary = from_union([from_str, from_none], obj.get("summary")) workspace = from_union([WorkspaceSummary.from_dict, from_none], obj.get("workspace")) workspace_path = from_union([from_none, from_str], obj.get("workspacePath")) - return SessionMetadataSnapshot( - already_in_use, - current_mode, - is_remote, - modified_time, - session_id, - start_time, - working_directory, - initial_name, - remote_metadata, - selected_model, - summary, - workspace, - workspace_path, - ) + return SessionMetadataSnapshot(already_in_use, current_mode, is_remote, modified_time, session_id, start_time, working_directory, initial_name, remote_metadata, selected_model, summary, workspace, workspace_path) def to_dict(self) -> dict: result: dict = {} @@ -15700,30 +14011,22 @@ def to_dict(self) -> dict: if self.initial_name is not None: result["initialName"] = from_union([from_str, from_none], self.initial_name) if self.remote_metadata is not None: - result["remoteMetadata"] = from_union( - [lambda x: to_class(MetadataSnapshotRemoteMetadata, x), from_none], - self.remote_metadata, - ) + result["remoteMetadata"] = from_union([lambda x: to_class(MetadataSnapshotRemoteMetadata, x), from_none], self.remote_metadata) if self.selected_model is not None: result["selectedModel"] = from_union([from_str, from_none], self.selected_model) if self.summary is not None: result["summary"] = from_union([from_str, from_none], self.summary) if self.workspace is not None: - result["workspace"] = from_union( - [lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace - ) + result["workspace"] = from_union([lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace) result["workspacePath"] = from_union([from_none, from_str], self.workspace_path) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsConfigureParams: """Patch of permission policy fields to apply (omit a field to leave it unchanged).""" - additional_content_exclusion_policies: ( - list[PermissionsConfigureAdditionalContentExclusionPolicy] | None - ) = None + additional_content_exclusion_policies: list[PermissionsConfigureAdditionalContentExclusionPolicy] | None = None """If specified, replaces the host-supplied GitHub Content Exclusion policies on the session (combined with natively-discovered policies when evaluating tool/file access). Omit to leave the current policies unchanged. @@ -15752,71 +14055,32 @@ class PermissionsConfigureParams: """ @staticmethod - def from_dict(obj: Any) -> "PermissionsConfigureParams": - assert isinstance(obj, dict) - additional_content_exclusion_policies = from_union( - [ - lambda x: from_list( - PermissionsConfigureAdditionalContentExclusionPolicy.from_dict, x - ), - from_none, - ], - obj.get("additionalContentExclusionPolicies"), - ) - approve_all_read_permission_requests = from_union( - [from_bool, from_none], obj.get("approveAllReadPermissionRequests") - ) - approve_all_tool_permission_requests = from_union( - [from_bool, from_none], obj.get("approveAllToolPermissionRequests") - ) + def from_dict(obj: Any) -> 'PermissionsConfigureParams': + assert isinstance(obj, dict) + additional_content_exclusion_policies = from_union([lambda x: from_list(PermissionsConfigureAdditionalContentExclusionPolicy.from_dict, x), from_none], obj.get("additionalContentExclusionPolicies")) + approve_all_read_permission_requests = from_union([from_bool, from_none], obj.get("approveAllReadPermissionRequests")) + approve_all_tool_permission_requests = from_union([from_bool, from_none], obj.get("approveAllToolPermissionRequests")) paths = from_union([PermissionPathsConfig.from_dict, from_none], obj.get("paths")) rules = from_union([PermissionRulesSet.from_dict, from_none], obj.get("rules")) urls = from_union([PermissionUrlsConfig.from_dict, from_none], obj.get("urls")) - return PermissionsConfigureParams( - additional_content_exclusion_policies, - approve_all_read_permission_requests, - approve_all_tool_permission_requests, - paths, - rules, - urls, - ) + return PermissionsConfigureParams(additional_content_exclusion_policies, approve_all_read_permission_requests, approve_all_tool_permission_requests, paths, rules, urls) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: - result["additionalContentExclusionPolicies"] = from_union( - [ - lambda x: from_list( - lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicy, x), - x, - ), - from_none, - ], - self.additional_content_exclusion_policies, - ) + result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: to_class(PermissionsConfigureAdditionalContentExclusionPolicy, x), x), from_none], self.additional_content_exclusion_policies) if self.approve_all_read_permission_requests is not None: - result["approveAllReadPermissionRequests"] = from_union( - [from_bool, from_none], self.approve_all_read_permission_requests - ) + result["approveAllReadPermissionRequests"] = from_union([from_bool, from_none], self.approve_all_read_permission_requests) if self.approve_all_tool_permission_requests is not None: - result["approveAllToolPermissionRequests"] = from_union( - [from_bool, from_none], self.approve_all_tool_permission_requests - ) + result["approveAllToolPermissionRequests"] = from_union([from_bool, from_none], self.approve_all_tool_permission_requests) if self.paths is not None: - result["paths"] = from_union( - [lambda x: to_class(PermissionPathsConfig, x), from_none], self.paths - ) + result["paths"] = from_union([lambda x: to_class(PermissionPathsConfig, x), from_none], self.paths) if self.rules is not None: - result["rules"] = from_union( - [lambda x: to_class(PermissionRulesSet, x), from_none], self.rules - ) + result["rules"] = from_union([lambda x: to_class(PermissionRulesSet, x), from_none], self.rules) if self.urls is not None: - result["urls"] = from_union( - [lambda x: to_class(PermissionUrlsConfig, x), from_none], self.urls - ) + result["urls"] = from_union([lambda x: to_class(PermissionUrlsConfig, x), from_none], self.urls) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TasksGetProgressResult: @@ -15828,7 +14092,7 @@ class TasksGetProgressResult: """ @staticmethod - def from_dict(obj: Any) -> "TasksGetProgressResult": + def from_dict(obj: Any) -> 'TasksGetProgressResult': assert isinstance(obj, dict) progress = from_union([TaskProgress.from_dict, from_none], obj.get("progress")) return TasksGetProgressResult(progress) @@ -15836,12 +14100,9 @@ def from_dict(obj: Any) -> "TasksGetProgressResult": def to_dict(self) -> dict: result: dict = {} if self.progress is not None: - result["progress"] = from_union( - [lambda x: to_class(TaskProgress, x), from_none], self.progress - ) + result["progress"] = from_union([lambda x: to_class(TaskProgress, x), from_none], self.progress) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationSchema: @@ -15857,7 +14118,7 @@ class UIElicitationSchema: """List of required field names""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationSchema": + def from_dict(obj: Any) -> 'UIElicitationSchema': assert isinstance(obj, dict) properties = from_dict(UIElicitationSchemaProperty.from_dict, obj.get("properties")) type = UIElicitationSchemaType(obj.get("type")) @@ -15866,17 +14127,12 @@ def from_dict(obj: Any) -> "UIElicitationSchema": def to_dict(self) -> dict: result: dict = {} - result["properties"] = from_dict( - lambda x: to_class(UIElicitationSchemaProperty, x), self.properties - ) + result["properties"] = from_dict(lambda x: to_class(UIElicitationSchemaProperty, x), self.properties) result["type"] = to_enum(UIElicitationSchemaType, self.type) if self.required is not None: - result["required"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.required - ) + result["required"] = from_union([lambda x: from_list(from_str, x), from_none], self.required) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionsSetAdditionalPluginsRequest: @@ -15888,7 +14144,7 @@ class SessionsSetAdditionalPluginsRequest: """ @staticmethod - def from_dict(obj: Any) -> "SessionsSetAdditionalPluginsRequest": + def from_dict(obj: Any) -> 'SessionsSetAdditionalPluginsRequest': assert isinstance(obj, dict) plugins = from_list(InstalledPlugin.from_dict, obj.get("plugins")) return SessionsSetAdditionalPluginsRequest(plugins) @@ -15898,7 +14154,6 @@ def to_dict(self) -> dict: result["plugins"] = from_list(lambda x: to_class(InstalledPlugin, x), self.plugins) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionUpdateOptionsParams: @@ -16022,203 +14277,98 @@ class SessionUpdateOptionsParams: """Absolute working-directory path for shell tools.""" @staticmethod - def from_dict(obj: Any) -> "SessionUpdateOptionsParams": + def from_dict(obj: Any) -> 'SessionUpdateOptionsParams': assert isinstance(obj, dict) - additional_content_exclusion_policies = from_union( - [lambda x: from_list(lambda x: x, x), from_none], - obj.get("additionalContentExclusionPolicies"), - ) + additional_content_exclusion_policies = from_union([lambda x: from_list(lambda x: x, x), from_none], obj.get("additionalContentExclusionPolicies")) agent_context = from_union([from_str, from_none], obj.get("agentContext")) ask_user_disabled = from_union([from_bool, from_none], obj.get("askUserDisabled")) - available_tools = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("availableTools") - ) + available_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("availableTools")) client_name = from_union([from_str, from_none], obj.get("clientName")) coauthor_enabled = from_union([from_bool, from_none], obj.get("coauthorEnabled")) continue_on_auto_mode = from_union([from_bool, from_none], obj.get("continueOnAutoMode")) copilot_url = from_union([from_str, from_none], obj.get("copilotUrl")) - custom_agents_local_only = from_union( - [from_bool, from_none], obj.get("customAgentsLocalOnly") - ) - disabled_instruction_sources = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("disabledInstructionSources") - ) - disabled_skills = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("disabledSkills") - ) - enable_on_demand_instruction_discovery = from_union( - [from_bool, from_none], obj.get("enableOnDemandInstructionDiscovery") - ) - enable_reasoning_summaries = from_union( - [from_bool, from_none], obj.get("enableReasoningSummaries") - ) + custom_agents_local_only = from_union([from_bool, from_none], obj.get("customAgentsLocalOnly")) + disabled_instruction_sources = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledInstructionSources")) + disabled_skills = from_union([lambda x: from_list(from_str, x), from_none], obj.get("disabledSkills")) + enable_on_demand_instruction_discovery = from_union([from_bool, from_none], obj.get("enableOnDemandInstructionDiscovery")) + enable_reasoning_summaries = from_union([from_bool, from_none], obj.get("enableReasoningSummaries")) enable_script_safety = from_union([from_bool, from_none], obj.get("enableScriptSafety")) enable_streaming = from_union([from_bool, from_none], obj.get("enableStreaming")) env_value_mode = from_union([MCPSetEnvValueModeDetails, from_none], obj.get("envValueMode")) events_log_directory = from_union([from_str, from_none], obj.get("eventsLogDirectory")) - excluded_tools = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("excludedTools") - ) - feature_flags = from_union( - [lambda x: from_dict(from_bool, x), from_none], obj.get("featureFlags") - ) - installed_plugins = from_union( - [lambda x: from_list(SessionInstalledPlugin.from_dict, x), from_none], - obj.get("installedPlugins"), - ) + excluded_tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("excludedTools")) + feature_flags = from_union([lambda x: from_dict(from_bool, x), from_none], obj.get("featureFlags")) + installed_plugins = from_union([lambda x: from_list(SessionInstalledPlugin.from_dict, x), from_none], obj.get("installedPlugins")) integration_id = from_union([from_str, from_none], obj.get("integrationId")) is_experimental_mode = from_union([from_bool, from_none], obj.get("isExperimentalMode")) log_interactive_shells = from_union([from_bool, from_none], obj.get("logInteractiveShells")) lsp_client_name = from_union([from_str, from_none], obj.get("lspClientName")) - manage_schedule_enabled = from_union( - [from_bool, from_none], obj.get("manageScheduleEnabled") - ) + manage_schedule_enabled = from_union([from_bool, from_none], obj.get("manageScheduleEnabled")) model = from_union([from_str, from_none], obj.get("model")) provider = obj.get("provider") reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) - running_in_interactive_mode = from_union( - [from_bool, from_none], obj.get("runningInInteractiveMode") - ) + running_in_interactive_mode = from_union([from_bool, from_none], obj.get("runningInInteractiveMode")) sandbox_config = obj.get("sandboxConfig") shell_init_profile = from_union([from_str, from_none], obj.get("shellInitProfile")) - shell_process_flags = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("shellProcessFlags") - ) - skill_directories = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories") - ) - skip_custom_instructions = from_union( - [from_bool, from_none], obj.get("skipCustomInstructions") - ) + shell_process_flags = from_union([lambda x: from_list(from_str, x), from_none], obj.get("shellProcessFlags")) + skill_directories = from_union([lambda x: from_list(from_str, x), from_none], obj.get("skillDirectories")) + skip_custom_instructions = from_union([from_bool, from_none], obj.get("skipCustomInstructions")) trajectory_file = from_union([from_str, from_none], obj.get("trajectoryFile")) working_directory = from_union([from_str, from_none], obj.get("workingDirectory")) - return SessionUpdateOptionsParams( - additional_content_exclusion_policies, - agent_context, - ask_user_disabled, - available_tools, - client_name, - coauthor_enabled, - continue_on_auto_mode, - copilot_url, - custom_agents_local_only, - disabled_instruction_sources, - disabled_skills, - enable_on_demand_instruction_discovery, - enable_reasoning_summaries, - enable_script_safety, - enable_streaming, - env_value_mode, - events_log_directory, - excluded_tools, - feature_flags, - installed_plugins, - integration_id, - is_experimental_mode, - log_interactive_shells, - lsp_client_name, - manage_schedule_enabled, - model, - provider, - reasoning_effort, - running_in_interactive_mode, - sandbox_config, - shell_init_profile, - shell_process_flags, - skill_directories, - skip_custom_instructions, - trajectory_file, - working_directory, - ) + return SessionUpdateOptionsParams(additional_content_exclusion_policies, agent_context, ask_user_disabled, available_tools, client_name, coauthor_enabled, continue_on_auto_mode, copilot_url, custom_agents_local_only, disabled_instruction_sources, disabled_skills, enable_on_demand_instruction_discovery, enable_reasoning_summaries, enable_script_safety, enable_streaming, env_value_mode, events_log_directory, excluded_tools, feature_flags, installed_plugins, integration_id, is_experimental_mode, log_interactive_shells, lsp_client_name, manage_schedule_enabled, model, provider, reasoning_effort, running_in_interactive_mode, sandbox_config, shell_init_profile, shell_process_flags, skill_directories, skip_custom_instructions, trajectory_file, working_directory) def to_dict(self) -> dict: result: dict = {} if self.additional_content_exclusion_policies is not None: - result["additionalContentExclusionPolicies"] = from_union( - [lambda x: from_list(lambda x: x, x), from_none], - self.additional_content_exclusion_policies, - ) + result["additionalContentExclusionPolicies"] = from_union([lambda x: from_list(lambda x: x, x), from_none], self.additional_content_exclusion_policies) if self.agent_context is not None: result["agentContext"] = from_union([from_str, from_none], self.agent_context) if self.ask_user_disabled is not None: result["askUserDisabled"] = from_union([from_bool, from_none], self.ask_user_disabled) if self.available_tools is not None: - result["availableTools"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.available_tools - ) + result["availableTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.available_tools) if self.client_name is not None: result["clientName"] = from_union([from_str, from_none], self.client_name) if self.coauthor_enabled is not None: result["coauthorEnabled"] = from_union([from_bool, from_none], self.coauthor_enabled) if self.continue_on_auto_mode is not None: - result["continueOnAutoMode"] = from_union( - [from_bool, from_none], self.continue_on_auto_mode - ) + result["continueOnAutoMode"] = from_union([from_bool, from_none], self.continue_on_auto_mode) if self.copilot_url is not None: result["copilotUrl"] = from_union([from_str, from_none], self.copilot_url) if self.custom_agents_local_only is not None: - result["customAgentsLocalOnly"] = from_union( - [from_bool, from_none], self.custom_agents_local_only - ) + result["customAgentsLocalOnly"] = from_union([from_bool, from_none], self.custom_agents_local_only) if self.disabled_instruction_sources is not None: - result["disabledInstructionSources"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.disabled_instruction_sources - ) + result["disabledInstructionSources"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_instruction_sources) if self.disabled_skills is not None: - result["disabledSkills"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.disabled_skills - ) + result["disabledSkills"] = from_union([lambda x: from_list(from_str, x), from_none], self.disabled_skills) if self.enable_on_demand_instruction_discovery is not None: - result["enableOnDemandInstructionDiscovery"] = from_union( - [from_bool, from_none], self.enable_on_demand_instruction_discovery - ) + result["enableOnDemandInstructionDiscovery"] = from_union([from_bool, from_none], self.enable_on_demand_instruction_discovery) if self.enable_reasoning_summaries is not None: - result["enableReasoningSummaries"] = from_union( - [from_bool, from_none], self.enable_reasoning_summaries - ) + result["enableReasoningSummaries"] = from_union([from_bool, from_none], self.enable_reasoning_summaries) if self.enable_script_safety is not None: - result["enableScriptSafety"] = from_union( - [from_bool, from_none], self.enable_script_safety - ) + result["enableScriptSafety"] = from_union([from_bool, from_none], self.enable_script_safety) if self.enable_streaming is not None: result["enableStreaming"] = from_union([from_bool, from_none], self.enable_streaming) if self.env_value_mode is not None: - result["envValueMode"] = from_union( - [lambda x: to_enum(MCPSetEnvValueModeDetails, x), from_none], self.env_value_mode - ) + result["envValueMode"] = from_union([lambda x: to_enum(MCPSetEnvValueModeDetails, x), from_none], self.env_value_mode) if self.events_log_directory is not None: - result["eventsLogDirectory"] = from_union( - [from_str, from_none], self.events_log_directory - ) + result["eventsLogDirectory"] = from_union([from_str, from_none], self.events_log_directory) if self.excluded_tools is not None: - result["excludedTools"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.excluded_tools - ) + result["excludedTools"] = from_union([lambda x: from_list(from_str, x), from_none], self.excluded_tools) if self.feature_flags is not None: - result["featureFlags"] = from_union( - [lambda x: from_dict(from_bool, x), from_none], self.feature_flags - ) + result["featureFlags"] = from_union([lambda x: from_dict(from_bool, x), from_none], self.feature_flags) if self.installed_plugins is not None: - result["installedPlugins"] = from_union( - [lambda x: from_list(lambda x: to_class(SessionInstalledPlugin, x), x), from_none], - self.installed_plugins, - ) + result["installedPlugins"] = from_union([lambda x: from_list(lambda x: to_class(SessionInstalledPlugin, x), x), from_none], self.installed_plugins) if self.integration_id is not None: result["integrationId"] = from_union([from_str, from_none], self.integration_id) if self.is_experimental_mode is not None: - result["isExperimentalMode"] = from_union( - [from_bool, from_none], self.is_experimental_mode - ) + result["isExperimentalMode"] = from_union([from_bool, from_none], self.is_experimental_mode) if self.log_interactive_shells is not None: - result["logInteractiveShells"] = from_union( - [from_bool, from_none], self.log_interactive_shells - ) + result["logInteractiveShells"] = from_union([from_bool, from_none], self.log_interactive_shells) if self.lsp_client_name is not None: result["lspClientName"] = from_union([from_str, from_none], self.lsp_client_name) if self.manage_schedule_enabled is not None: - result["manageScheduleEnabled"] = from_union( - [from_bool, from_none], self.manage_schedule_enabled - ) + result["manageScheduleEnabled"] = from_union([from_bool, from_none], self.manage_schedule_enabled) if self.model is not None: result["model"] = from_union([from_str, from_none], self.model) if self.provider is not None: @@ -16226,32 +14376,23 @@ def to_dict(self) -> dict: if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.running_in_interactive_mode is not None: - result["runningInInteractiveMode"] = from_union( - [from_bool, from_none], self.running_in_interactive_mode - ) + result["runningInInteractiveMode"] = from_union([from_bool, from_none], self.running_in_interactive_mode) if self.sandbox_config is not None: result["sandboxConfig"] = self.sandbox_config if self.shell_init_profile is not None: result["shellInitProfile"] = from_union([from_str, from_none], self.shell_init_profile) if self.shell_process_flags is not None: - result["shellProcessFlags"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.shell_process_flags - ) + result["shellProcessFlags"] = from_union([lambda x: from_list(from_str, x), from_none], self.shell_process_flags) if self.skill_directories is not None: - result["skillDirectories"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.skill_directories - ) + result["skillDirectories"] = from_union([lambda x: from_list(from_str, x), from_none], self.skill_directories) if self.skip_custom_instructions is not None: - result["skipCustomInstructions"] = from_union( - [from_bool, from_none], self.skip_custom_instructions - ) + result["skipCustomInstructions"] = from_union([from_bool, from_none], self.skip_custom_instructions) if self.trajectory_file is not None: result["trajectoryFile"] = from_union([from_str, from_none], self.trajectory_file) if self.working_directory is not None: result["workingDirectory"] = from_union([from_str, from_none], self.working_directory) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class UIElicitationRequest: @@ -16264,7 +14405,7 @@ class UIElicitationRequest: """JSON Schema describing the form fields to present to the user""" @staticmethod - def from_dict(obj: Any) -> "UIElicitationRequest": + def from_dict(obj: Any) -> 'UIElicitationRequest': assert isinstance(obj, dict) message = from_str(obj.get("message")) requested_schema = UIElicitationSchema.from_dict(obj.get("requestedSchema")) @@ -16276,7 +14417,6 @@ def to_dict(self) -> dict: result["requestedSchema"] = to_class(UIElicitationSchema, self.requested_schema) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MCPExecuteSamplingParams: @@ -16301,7 +14441,7 @@ class MCPExecuteSamplingParams: """Name of the MCP server that initiated the sampling request""" @staticmethod - def from_dict(obj: Any) -> "MCPExecuteSamplingParams": + def from_dict(obj: Any) -> 'MCPExecuteSamplingParams': assert isinstance(obj, dict) mcp_request_id = from_union([from_float, from_str], obj.get("mcpRequestId")) request = from_dict(lambda x: x, obj.get("request")) @@ -16317,7 +14457,6 @@ def to_dict(self) -> dict: result["serverName"] = from_str(self.server_name) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataContextInfoRequest: @@ -16335,7 +14474,7 @@ class MetadataContextInfoRequest: """ @staticmethod - def from_dict(obj: Any) -> "MetadataContextInfoRequest": + def from_dict(obj: Any) -> 'MetadataContextInfoRequest': assert isinstance(obj, dict) output_token_limit = from_int(obj.get("outputTokenLimit")) prompt_token_limit = from_int(obj.get("promptTokenLimit")) @@ -16350,7 +14489,6 @@ def to_dict(self) -> dict: result["selectedModel"] = from_union([from_str, from_none], self.selected_model) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class MetadataRecomputeContextTokensRequest: @@ -16362,7 +14500,7 @@ class MetadataRecomputeContextTokensRequest: """ @staticmethod - def from_dict(obj: Any) -> "MetadataRecomputeContextTokensRequest": + def from_dict(obj: Any) -> 'MetadataRecomputeContextTokensRequest': assert isinstance(obj, dict) model_id = from_str(obj.get("modelId")) return MetadataRecomputeContextTokensRequest(model_id) @@ -16372,7 +14510,6 @@ def to_dict(self) -> dict: result["modelId"] = from_str(self.model_id) return result - @dataclass class ModelCapabilities: """Model capabilities and limits""" @@ -16384,7 +14521,7 @@ class ModelCapabilities: """Feature flags indicating what the model supports""" @staticmethod - def from_dict(obj: Any) -> "ModelCapabilities": + def from_dict(obj: Any) -> 'ModelCapabilities': assert isinstance(obj, dict) limits = from_union([ModelCapabilitiesLimits.from_dict, from_none], obj.get("limits")) supports = from_union([ModelCapabilitiesSupports.from_dict, from_none], obj.get("supports")) @@ -16393,16 +14530,11 @@ def from_dict(obj: Any) -> "ModelCapabilities": def to_dict(self) -> dict: result: dict = {} if self.limits is not None: - result["limits"] = from_union( - [lambda x: to_class(ModelCapabilitiesLimits, x), from_none], self.limits - ) + result["limits"] = from_union([lambda x: to_class(ModelCapabilitiesLimits, x), from_none], self.limits) if self.supports is not None: - result["supports"] = from_union( - [lambda x: to_class(ModelCapabilitiesSupports, x), from_none], self.supports - ) + result["supports"] = from_union([lambda x: to_class(ModelCapabilitiesSupports, x), from_none], self.supports) return result - class ModelPickerCategory(Enum): """Model capability category for grouping in the model picker""" @@ -16410,7 +14542,6 @@ class ModelPickerCategory(Enum): POWERFUL = "powerful" VERSATILE = "versatile" - @dataclass class Model: """Schema for the `Model` type.""" @@ -16443,36 +14574,18 @@ class Model: """Supported reasoning effort levels (only present if model supports reasoning effort)""" @staticmethod - def from_dict(obj: Any) -> "Model": + def from_dict(obj: Any) -> 'Model': assert isinstance(obj, dict) capabilities = ModelCapabilities.from_dict(obj.get("capabilities")) id = from_str(obj.get("id")) name = from_str(obj.get("name")) billing = from_union([ModelBilling.from_dict, from_none], obj.get("billing")) - default_reasoning_effort = from_union( - [from_str, from_none], obj.get("defaultReasoningEffort") - ) - model_picker_category = from_union( - [ModelPickerCategory, from_none], obj.get("modelPickerCategory") - ) - model_picker_price_category = from_union( - [ModelPickerPriceCategory, from_none], obj.get("modelPickerPriceCategory") - ) + default_reasoning_effort = from_union([from_str, from_none], obj.get("defaultReasoningEffort")) + model_picker_category = from_union([ModelPickerCategory, from_none], obj.get("modelPickerCategory")) + model_picker_price_category = from_union([ModelPickerPriceCategory, from_none], obj.get("modelPickerPriceCategory")) policy = from_union([ModelPolicy.from_dict, from_none], obj.get("policy")) - supported_reasoning_efforts = from_union( - [lambda x: from_list(from_str, x), from_none], obj.get("supportedReasoningEfforts") - ) - return Model( - capabilities, - id, - name, - billing, - default_reasoning_effort, - model_picker_category, - model_picker_price_category, - policy, - supported_reasoning_efforts, - ) + supported_reasoning_efforts = from_union([lambda x: from_list(from_str, x), from_none], obj.get("supportedReasoningEfforts")) + return Model(capabilities, id, name, billing, default_reasoning_effort, model_picker_category, model_picker_price_category, policy, supported_reasoning_efforts) def to_dict(self) -> dict: result: dict = {} @@ -16480,44 +14593,29 @@ def to_dict(self) -> dict: result["id"] = from_str(self.id) result["name"] = from_str(self.name) if self.billing is not None: - result["billing"] = from_union( - [lambda x: to_class(ModelBilling, x), from_none], self.billing - ) + result["billing"] = from_union([lambda x: to_class(ModelBilling, x), from_none], self.billing) if self.default_reasoning_effort is not None: - result["defaultReasoningEffort"] = from_union( - [from_str, from_none], self.default_reasoning_effort - ) + result["defaultReasoningEffort"] = from_union([from_str, from_none], self.default_reasoning_effort) if self.model_picker_category is not None: - result["modelPickerCategory"] = from_union( - [lambda x: to_enum(ModelPickerCategory, x), from_none], self.model_picker_category - ) + result["modelPickerCategory"] = from_union([lambda x: to_enum(ModelPickerCategory, x), from_none], self.model_picker_category) if self.model_picker_price_category is not None: - result["modelPickerPriceCategory"] = from_union( - [lambda x: to_enum(ModelPickerPriceCategory, x), from_none], - self.model_picker_price_category, - ) + result["modelPickerPriceCategory"] = from_union([lambda x: to_enum(ModelPickerPriceCategory, x), from_none], self.model_picker_price_category) if self.policy is not None: - result["policy"] = from_union( - [lambda x: to_class(ModelPolicy, x), from_none], self.policy - ) + result["policy"] = from_union([lambda x: to_class(ModelPolicy, x), from_none], self.policy) if self.supported_reasoning_efforts is not None: - result["supportedReasoningEfforts"] = from_union( - [lambda x: from_list(from_str, x), from_none], self.supported_reasoning_efforts - ) + result["supportedReasoningEfforts"] = from_union([lambda x: from_list(from_str, x), from_none], self.supported_reasoning_efforts) return result - @dataclass class ModelList: """List of Copilot models available to the resolved user, including capabilities and billing metadata. """ - models: list[Model] """List of available models with full metadata""" @staticmethod - def from_dict(obj: Any) -> "ModelList": + def from_dict(obj: Any) -> 'ModelList': assert isinstance(obj, dict) models = from_list(Model.from_dict, obj.get("models")) return ModelList(models) @@ -16527,7 +14625,6 @@ def to_dict(self) -> dict: result["models"] = from_list(lambda x: to_class(Model, x), self.models) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class ModelSwitchToRequest: @@ -16546,35 +14643,25 @@ class ModelSwitchToRequest: """Reasoning summary mode to request for supported model clients""" @staticmethod - def from_dict(obj: Any) -> "ModelSwitchToRequest": + def from_dict(obj: Any) -> 'ModelSwitchToRequest': assert isinstance(obj, dict) model_id = from_str(obj.get("modelId")) - model_capabilities = from_union( - [ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilities") - ) + model_capabilities = from_union([ModelCapabilitiesOverride.from_dict, from_none], obj.get("modelCapabilities")) reasoning_effort = from_union([from_str, from_none], obj.get("reasoningEffort")) reasoning_summary = from_union([ReasoningSummary, from_none], obj.get("reasoningSummary")) - return ModelSwitchToRequest( - model_id, model_capabilities, reasoning_effort, reasoning_summary - ) + return ModelSwitchToRequest(model_id, model_capabilities, reasoning_effort, reasoning_summary) def to_dict(self) -> dict: result: dict = {} result["modelId"] = from_str(self.model_id) if self.model_capabilities is not None: - result["modelCapabilities"] = from_union( - [lambda x: to_class(ModelCapabilitiesOverride, x), from_none], - self.model_capabilities, - ) + result["modelCapabilities"] = from_union([lambda x: to_class(ModelCapabilitiesOverride, x), from_none], self.model_capabilities) if self.reasoning_effort is not None: result["reasoningEffort"] = from_union([from_str, from_none], self.reasoning_effort) if self.reasoning_summary is not None: - result["reasoningSummary"] = from_union( - [lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary - ) + result["reasoningSummary"] = from_union([lambda x: to_enum(ReasoningSummary, x), from_none], self.reasoning_summary) return result - # Experimental: this type is part of an experimental API and may change or be removed. class PermissionsSetApproveAllSource(Enum): """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @@ -16584,7 +14671,6 @@ class PermissionsSetApproveAllSource(Enum): RPC = "rpc" SLASH_COMMAND = "slash_command" - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class PermissionsSetApproveAllRequest: @@ -16597,7 +14683,7 @@ class PermissionsSetApproveAllRequest: """Optional source for allow-all telemetry. Defaults to `rpc` when omitted for SDK callers.""" @staticmethod - def from_dict(obj: Any) -> "PermissionsSetApproveAllRequest": + def from_dict(obj: Any) -> 'PermissionsSetApproveAllRequest': assert isinstance(obj, dict) enabled = from_bool(obj.get("enabled")) source = from_union([PermissionsSetApproveAllSource, from_none], obj.get("source")) @@ -16607,12 +14693,9 @@ def to_dict(self) -> dict: result: dict = {} result["enabled"] = from_bool(self.enabled) if self.source is not None: - result["source"] = from_union( - [lambda x: to_enum(PermissionsSetApproveAllSource, x), from_none], self.source - ) + result["source"] = from_union([lambda x: to_enum(PermissionsSetApproveAllSource, x), from_none], self.source) return result - # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class TaskAgentInfo: @@ -16675,7 +14758,7 @@ class TaskAgentInfo: """Result text from the task when available""" @staticmethod - def from_dict(obj: Any) -> "TaskAgentInfo": + def from_dict(obj: Any) -> 'TaskAgentInfo': assert isinstance(obj, dict) agent_type = from_str(obj.get("agentType")) description = from_str(obj.get("description")) @@ -16686,9 +14769,7 @@ def from_dict(obj: Any) -> "TaskAgentInfo": tool_call_id = from_str(obj.get("toolCallId")) active_started_at = from_union([from_datetime, from_none], obj.get("activeStartedAt")) active_time_ms = from_union([from_int, from_none], obj.get("activeTimeMs")) - can_promote_to_background = from_union( - [from_bool, from_none], obj.get("canPromoteToBackground") - ) + can_promote_to_background = from_union([from_bool, from_none], obj.get("canPromoteToBackground")) completed_at = from_union([from_datetime, from_none], obj.get("completedAt")) error = from_union([from_str, from_none], obj.get("error")) execution_mode = from_union([TaskExecutionMode, from_none], obj.get("executionMode")) @@ -16696,25 +14777,7 @@ def from_dict(obj: Any) -> "TaskAgentInfo": latest_response = from_union([from_str, from_none], obj.get("latestResponse")) model = from_union([from_str, from_none], obj.get("model")) result = from_union([from_str, from_none], obj.get("result")) - return TaskAgentInfo( - agent_type, - description, - id, - prompt, - started_at, - status, - tool_call_id, - active_started_at, - active_time_ms, - can_promote_to_background, - completed_at, - error, - execution_mode, - idle_since, - latest_response, - model, - result, - ) + return TaskAgentInfo(agent_type, description, id, prompt, started_at, status, tool_call_id, active_started_at, active_time_ms, can_promote_to_background, completed_at, error, execution_mode, idle_since, latest_response, model, result) def to_dict(self) -> dict: result: dict = {} @@ -16727,25 +14790,17 @@ def to_dict(self) -> dict: result["toolCallId"] = from_str(self.tool_call_id) result["type"] = self.type if self.active_started_at is not None: - result["activeStartedAt"] = from_union( - [lambda x: x.isoformat(), from_none], self.active_started_at - ) + result["activeStartedAt"] = from_union([lambda x: x.isoformat(), from_none], self.active_started_at) if self.active_time_ms is not None: result["activeTimeMs"] = from_union([from_int, from_none], self.active_time_ms) if self.can_promote_to_background is not None: - result["canPromoteToBackground"] = from_union( - [from_bool, from_none], self.can_promote_to_background - ) + result["canPromoteToBackground"] = from_union([from_bool, from_none], self.can_promote_to_background) if self.completed_at is not None: - result["completedAt"] = from_union( - [lambda x: x.isoformat(), from_none], self.completed_at - ) + result["completedAt"] = from_union([lambda x: x.isoformat(), from_none], self.completed_at) if self.error is not None: result["error"] = from_union([from_str, from_none], self.error) if self.execution_mode is not None: - result["executionMode"] = from_union( - [lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode - ) + result["executionMode"] = from_union([lambda x: to_enum(TaskExecutionMode, x), from_none], self.execution_mode) if self.idle_since is not None: result["idleSince"] = from_union([lambda x: x.isoformat(), from_none], self.idle_since) if self.latest_response is not None: @@ -16756,7 +14811,6 @@ def to_dict(self) -> dict: result["result"] = from_union([from_str, from_none], self.result) return result - @dataclass class RPC: abort_request: AbortRequest @@ -16809,9 +14863,7 @@ class RPC: copilot_user_response_quota_snapshots: dict[str, CopilotUserResponseQuotaSnapshots | None] copilot_user_response_quota_snapshots_chat: CopilotUserResponseQuotaSnapshotsChat copilot_user_response_quota_snapshots_completions: CopilotUserResponseQuotaSnapshotsCompletions - copilot_user_response_quota_snapshots_premium_interactions: ( - CopilotUserResponseQuotaSnapshotsPremiumInteractions - ) + copilot_user_response_quota_snapshots_premium_interactions: CopilotUserResponseQuotaSnapshotsPremiumInteractions current_model: CurrentModel discovered_canvas: DiscoveredCanvas discovered_mcp_server: DiscoveredMCPServer @@ -16836,25 +14888,15 @@ class RPC: extension_status: ExtensionStatus external_tool_result: ExternalToolTextResultForLlm | str external_tool_text_result_for_llm: ExternalToolTextResultForLlm - external_tool_text_result_for_llm_binary_results_for_llm: ( - ExternalToolTextResultForLlmBinaryResultsForLlm - ) - external_tool_text_result_for_llm_binary_results_for_llm_type: ( - ExternalToolTextResultForLlmBinaryResultsForLlmType - ) + external_tool_text_result_for_llm_binary_results_for_llm: ExternalToolTextResultForLlmBinaryResultsForLlm + external_tool_text_result_for_llm_binary_results_for_llm_type: ExternalToolTextResultForLlmBinaryResultsForLlmType external_tool_text_result_for_llm_content: ExternalToolTextResultForLlmContent external_tool_text_result_for_llm_content_audio: ExternalToolTextResultForLlmContentAudio external_tool_text_result_for_llm_content_image: ExternalToolTextResultForLlmContentImage external_tool_text_result_for_llm_content_resource: ExternalToolTextResultForLlmContentResource - external_tool_text_result_for_llm_content_resource_details: ( - ExternalToolTextResultForLlmContentResourceDetails - ) - external_tool_text_result_for_llm_content_resource_link: ( - ExternalToolTextResultForLlmContentResourceLink - ) - external_tool_text_result_for_llm_content_resource_link_icon: ( - ExternalToolTextResultForLlmContentResourceLinkIcon - ) + external_tool_text_result_for_llm_content_resource_details: ExternalToolTextResultForLlmContentResourceDetails + external_tool_text_result_for_llm_content_resource_link: ExternalToolTextResultForLlmContentResourceLink + external_tool_text_result_for_llm_content_resource_link_icon: ExternalToolTextResultForLlmContentResourceLinkIcon external_tool_text_result_for_llm_content_resource_link_icon_theme: Theme external_tool_text_result_for_llm_content_terminal: ExternalToolTextResultForLlmContentTerminal external_tool_text_result_for_llm_content_text: ExternalToolTextResultForLlmContentText @@ -16991,76 +15033,34 @@ class RPC: permission_decision_approved_for_session: PermissionDecisionApprovedForSession permission_decision_approve_for_location: PermissionDecisionApproveForLocation permission_decision_approve_for_location_approval: PermissionDecisionApproveForLocationApproval - permission_decision_approve_for_location_approval_commands: ( - PermissionDecisionApproveForLocationApprovalCommands - ) - permission_decision_approve_for_location_approval_custom_tool: ( - PermissionDecisionApproveForLocationApprovalCustomTool - ) - permission_decision_approve_for_location_approval_extension_management: ( - PermissionDecisionApproveForLocationApprovalExtensionManagement - ) - permission_decision_approve_for_location_approval_extension_permission_access: ( - PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess - ) - permission_decision_approve_for_location_approval_mcp: ( - PermissionDecisionApproveForLocationApprovalMCP - ) - permission_decision_approve_for_location_approval_mcp_sampling: ( - PermissionDecisionApproveForLocationApprovalMCPSampling - ) - permission_decision_approve_for_location_approval_memory: ( - PermissionDecisionApproveForLocationApprovalMemory - ) - permission_decision_approve_for_location_approval_read: ( - PermissionDecisionApproveForLocationApprovalRead - ) - permission_decision_approve_for_location_approval_write: ( - PermissionDecisionApproveForLocationApprovalWrite - ) + permission_decision_approve_for_location_approval_commands: PermissionDecisionApproveForLocationApprovalCommands + permission_decision_approve_for_location_approval_custom_tool: PermissionDecisionApproveForLocationApprovalCustomTool + permission_decision_approve_for_location_approval_extension_management: PermissionDecisionApproveForLocationApprovalExtensionManagement + permission_decision_approve_for_location_approval_extension_permission_access: PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess + permission_decision_approve_for_location_approval_mcp: PermissionDecisionApproveForLocationApprovalMCP + permission_decision_approve_for_location_approval_mcp_sampling: PermissionDecisionApproveForLocationApprovalMCPSampling + permission_decision_approve_for_location_approval_memory: PermissionDecisionApproveForLocationApprovalMemory + permission_decision_approve_for_location_approval_read: PermissionDecisionApproveForLocationApprovalRead + permission_decision_approve_for_location_approval_write: PermissionDecisionApproveForLocationApprovalWrite permission_decision_approve_for_session: PermissionDecisionApproveForSession permission_decision_approve_for_session_approval: PermissionDecisionApproveForSessionApproval - permission_decision_approve_for_session_approval_commands: ( - PermissionDecisionApproveForSessionApprovalCommands - ) - permission_decision_approve_for_session_approval_custom_tool: ( - PermissionDecisionApproveForSessionApprovalCustomTool - ) - permission_decision_approve_for_session_approval_extension_management: ( - PermissionDecisionApproveForSessionApprovalExtensionManagement - ) - permission_decision_approve_for_session_approval_extension_permission_access: ( - PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess - ) - permission_decision_approve_for_session_approval_mcp: ( - PermissionDecisionApproveForSessionApprovalMCP - ) - permission_decision_approve_for_session_approval_mcp_sampling: ( - PermissionDecisionApproveForSessionApprovalMCPSampling - ) - permission_decision_approve_for_session_approval_memory: ( - PermissionDecisionApproveForSessionApprovalMemory - ) - permission_decision_approve_for_session_approval_read: ( - PermissionDecisionApproveForSessionApprovalRead - ) - permission_decision_approve_for_session_approval_write: ( - PermissionDecisionApproveForSessionApprovalWrite - ) + permission_decision_approve_for_session_approval_commands: PermissionDecisionApproveForSessionApprovalCommands + permission_decision_approve_for_session_approval_custom_tool: PermissionDecisionApproveForSessionApprovalCustomTool + permission_decision_approve_for_session_approval_extension_management: PermissionDecisionApproveForSessionApprovalExtensionManagement + permission_decision_approve_for_session_approval_extension_permission_access: PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess + permission_decision_approve_for_session_approval_mcp: PermissionDecisionApproveForSessionApprovalMCP + permission_decision_approve_for_session_approval_mcp_sampling: PermissionDecisionApproveForSessionApprovalMCPSampling + permission_decision_approve_for_session_approval_memory: PermissionDecisionApproveForSessionApprovalMemory + permission_decision_approve_for_session_approval_read: PermissionDecisionApproveForSessionApprovalRead + permission_decision_approve_for_session_approval_write: PermissionDecisionApproveForSessionApprovalWrite permission_decision_approve_once: PermissionDecisionApproveOnce permission_decision_approve_permanently: PermissionDecisionApprovePermanently permission_decision_cancelled: PermissionDecisionCancelled - permission_decision_denied_by_content_exclusion_policy: ( - PermissionDecisionDeniedByContentExclusionPolicy - ) - permission_decision_denied_by_permission_request_hook: ( - PermissionDecisionDeniedByPermissionRequestHook - ) + permission_decision_denied_by_content_exclusion_policy: PermissionDecisionDeniedByContentExclusionPolicy + permission_decision_denied_by_permission_request_hook: PermissionDecisionDeniedByPermissionRequestHook permission_decision_denied_by_rules: PermissionDecisionDeniedByRules permission_decision_denied_interactively_by_user: PermissionDecisionDeniedInteractivelyByUser - permission_decision_denied_no_approval_rule_and_could_not_request_from_user: ( - PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser - ) + permission_decision_denied_no_approval_rule_and_could_not_request_from_user: PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser permission_decision_reject: PermissionDecisionReject permission_decision_request: PermissionDecisionRequest permission_decision_user_not_available: PermissionDecisionUserNotAvailable @@ -17081,49 +15081,23 @@ class RPC: permission_prompt_shown_notification: PermissionPromptShownNotification permission_request_result: PermissionRequestResult permission_rules_set: PermissionRulesSet - permissions_configure_additional_content_exclusion_policy: ( - PermissionsConfigureAdditionalContentExclusionPolicy - ) - permissions_configure_additional_content_exclusion_policy_rule: ( - PermissionsConfigureAdditionalContentExclusionPolicyRule - ) - permissions_configure_additional_content_exclusion_policy_rule_source: ( - PermissionsConfigureAdditionalContentExclusionPolicyRuleSource - ) - permissions_configure_additional_content_exclusion_policy_scope: ( - PermissionsConfigureAdditionalContentExclusionPolicyScope - ) + permissions_configure_additional_content_exclusion_policy: PermissionsConfigureAdditionalContentExclusionPolicy + permissions_configure_additional_content_exclusion_policy_rule: PermissionsConfigureAdditionalContentExclusionPolicyRule + permissions_configure_additional_content_exclusion_policy_rule_source: PermissionsConfigureAdditionalContentExclusionPolicyRuleSource + permissions_configure_additional_content_exclusion_policy_scope: PermissionsConfigureAdditionalContentExclusionPolicyScope permissions_configure_params: PermissionsConfigureParams permissions_configure_result: PermissionsConfigureResult permissions_folder_trust_add_trusted_result: PermissionsFolderTrustAddTrustedResult permissions_locations_add_tool_approval_details: PermissionsLocationsAddToolApprovalDetails - permissions_locations_add_tool_approval_details_commands: ( - PermissionsLocationsAddToolApprovalDetailsCommands - ) - permissions_locations_add_tool_approval_details_custom_tool: ( - PermissionsLocationsAddToolApprovalDetailsCustomTool - ) - permissions_locations_add_tool_approval_details_extension_management: ( - PermissionsLocationsAddToolApprovalDetailsExtensionManagement - ) - permissions_locations_add_tool_approval_details_extension_permission_access: ( - PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess - ) - permissions_locations_add_tool_approval_details_mcp: ( - PermissionsLocationsAddToolApprovalDetailsMCP - ) - permissions_locations_add_tool_approval_details_mcp_sampling: ( - PermissionsLocationsAddToolApprovalDetailsMCPSampling - ) - permissions_locations_add_tool_approval_details_memory: ( - PermissionsLocationsAddToolApprovalDetailsMemory - ) - permissions_locations_add_tool_approval_details_read: ( - PermissionsLocationsAddToolApprovalDetailsRead - ) - permissions_locations_add_tool_approval_details_write: ( - PermissionsLocationsAddToolApprovalDetailsWrite - ) + permissions_locations_add_tool_approval_details_commands: PermissionsLocationsAddToolApprovalDetailsCommands + permissions_locations_add_tool_approval_details_custom_tool: PermissionsLocationsAddToolApprovalDetailsCustomTool + permissions_locations_add_tool_approval_details_extension_management: PermissionsLocationsAddToolApprovalDetailsExtensionManagement + permissions_locations_add_tool_approval_details_extension_permission_access: PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess + permissions_locations_add_tool_approval_details_mcp: PermissionsLocationsAddToolApprovalDetailsMCP + permissions_locations_add_tool_approval_details_mcp_sampling: PermissionsLocationsAddToolApprovalDetailsMCPSampling + permissions_locations_add_tool_approval_details_memory: PermissionsLocationsAddToolApprovalDetailsMemory + permissions_locations_add_tool_approval_details_read: PermissionsLocationsAddToolApprovalDetailsRead + permissions_locations_add_tool_approval_details_write: PermissionsLocationsAddToolApprovalDetailsWrite permissions_locations_add_tool_approval_result: PermissionsLocationsAddToolApprovalResult permissions_modify_rules_params: PermissionsModifyRulesParams permissions_modify_rules_result: PermissionsModifyRulesResult @@ -17360,12 +15334,8 @@ class RPC: ui_handle_pending_sampling_response: dict[str, Any] ui_handle_pending_user_input_request: UIHandlePendingUserInputRequest ui_register_direct_auto_mode_switch_handler_result: UIRegisterDirectAutoModeSwitchHandlerResult - ui_unregister_direct_auto_mode_switch_handler_request: ( - UIUnregisterDirectAutoModeSwitchHandlerRequest - ) - ui_unregister_direct_auto_mode_switch_handler_result: ( - UIUnregisterDirectAutoModeSwitchHandlerResult - ) + ui_unregister_direct_auto_mode_switch_handler_request: UIUnregisterDirectAutoModeSwitchHandlerRequest + ui_unregister_direct_auto_mode_switch_handler_result: UIUnregisterDirectAutoModeSwitchHandlerResult ui_user_input_response: UIUserInputResponse usage_get_metrics_result: UsageGetMetricsResult usage_metrics_code_changes: UsageMetricsCodeChanges @@ -17398,13 +15368,11 @@ class RPC: workspace_summary: WorkspaceSummary | None = None @staticmethod - def from_dict(obj: Any) -> "RPC": + def from_dict(obj: Any) -> 'RPC': assert isinstance(obj, dict) abort_request = AbortRequest.from_dict(obj.get("AbortRequest")) abort_result = AbortResult.from_dict(obj.get("AbortResult")) - account_get_quota_request = AccountGetQuotaRequest.from_dict( - obj.get("AccountGetQuotaRequest") - ) + account_get_quota_request = AccountGetQuotaRequest.from_dict(obj.get("AccountGetQuotaRequest")) account_get_quota_result = AccountGetQuotaResult.from_dict(obj.get("AccountGetQuotaResult")) account_quota_snapshot = AccountQuotaSnapshot.from_dict(obj.get("AccountQuotaSnapshot")) agent_get_current_result = AgentGetCurrentResult.from_dict(obj.get("AgentGetCurrentResult")) @@ -17420,92 +15388,39 @@ def from_dict(obj: Any) -> "RPC": canvas_action = CanvasAction.from_dict(obj.get("CanvasAction")) canvas_close_request = CanvasCloseRequest.from_dict(obj.get("CanvasCloseRequest")) canvas_host_context = CanvasHostContext.from_dict(obj.get("CanvasHostContext")) - canvas_host_context_capabilities = CanvasHostContextCapabilities.from_dict( - obj.get("CanvasHostContextCapabilities") - ) - canvas_instance_availability = CanvasInstanceAvailability( - obj.get("CanvasInstanceAvailability") - ) - canvas_invoke_action_request = CanvasInvokeActionRequest.from_dict( - obj.get("CanvasInvokeActionRequest") - ) + canvas_host_context_capabilities = CanvasHostContextCapabilities.from_dict(obj.get("CanvasHostContextCapabilities")) + canvas_instance_availability = CanvasInstanceAvailability(obj.get("CanvasInstanceAvailability")) + canvas_invoke_action_request = CanvasInvokeActionRequest.from_dict(obj.get("CanvasInvokeActionRequest")) canvas_invoke_action_result = obj.get("CanvasInvokeActionResult") canvas_json_schema = obj.get("CanvasJsonSchema") canvas_list = CanvasList.from_dict(obj.get("CanvasList")) canvas_list_open_result = CanvasListOpenResult.from_dict(obj.get("CanvasListOpenResult")) canvas_open_request = CanvasOpenRequest.from_dict(obj.get("CanvasOpenRequest")) - canvas_provider_close_request = CanvasProviderCloseRequest.from_dict( - obj.get("CanvasProviderCloseRequest") - ) - canvas_provider_invoke_action_request = CanvasProviderInvokeActionRequest.from_dict( - obj.get("CanvasProviderInvokeActionRequest") - ) - canvas_provider_open_request = CanvasProviderOpenRequest.from_dict( - obj.get("CanvasProviderOpenRequest") - ) - canvas_provider_open_result = CanvasProviderOpenResult.from_dict( - obj.get("CanvasProviderOpenResult") - ) + canvas_provider_close_request = CanvasProviderCloseRequest.from_dict(obj.get("CanvasProviderCloseRequest")) + canvas_provider_invoke_action_request = CanvasProviderInvokeActionRequest.from_dict(obj.get("CanvasProviderInvokeActionRequest")) + canvas_provider_open_request = CanvasProviderOpenRequest.from_dict(obj.get("CanvasProviderOpenRequest")) + canvas_provider_open_result = CanvasProviderOpenResult.from_dict(obj.get("CanvasProviderOpenResult")) command_list = CommandList.from_dict(obj.get("CommandList")) - commands_handle_pending_command_request = CommandsHandlePendingCommandRequest.from_dict( - obj.get("CommandsHandlePendingCommandRequest") - ) - commands_handle_pending_command_result = CommandsHandlePendingCommandResult.from_dict( - obj.get("CommandsHandlePendingCommandResult") - ) + commands_handle_pending_command_request = CommandsHandlePendingCommandRequest.from_dict(obj.get("CommandsHandlePendingCommandRequest")) + commands_handle_pending_command_result = CommandsHandlePendingCommandResult.from_dict(obj.get("CommandsHandlePendingCommandResult")) commands_invoke_request = CommandsInvokeRequest.from_dict(obj.get("CommandsInvokeRequest")) commands_list_request = CommandsListRequest.from_dict(obj.get("CommandsListRequest")) - commands_respond_to_queued_command_request = ( - CommandsRespondToQueuedCommandRequest.from_dict( - obj.get("CommandsRespondToQueuedCommandRequest") - ) - ) - commands_respond_to_queued_command_result = CommandsRespondToQueuedCommandResult.from_dict( - obj.get("CommandsRespondToQueuedCommandResult") - ) - connected_remote_session_metadata = ConnectedRemoteSessionMetadata.from_dict( - obj.get("ConnectedRemoteSessionMetadata") - ) - connected_remote_session_metadata_kind = ConnectedRemoteSessionMetadataKind( - obj.get("ConnectedRemoteSessionMetadataKind") - ) - connected_remote_session_metadata_repository = ( - ConnectedRemoteSessionMetadataRepository.from_dict( - obj.get("ConnectedRemoteSessionMetadataRepository") - ) - ) - connect_remote_session_params = ConnectRemoteSessionParams.from_dict( - obj.get("ConnectRemoteSessionParams") - ) + commands_respond_to_queued_command_request = CommandsRespondToQueuedCommandRequest.from_dict(obj.get("CommandsRespondToQueuedCommandRequest")) + commands_respond_to_queued_command_result = CommandsRespondToQueuedCommandResult.from_dict(obj.get("CommandsRespondToQueuedCommandResult")) + connected_remote_session_metadata = ConnectedRemoteSessionMetadata.from_dict(obj.get("ConnectedRemoteSessionMetadata")) + connected_remote_session_metadata_kind = ConnectedRemoteSessionMetadataKind(obj.get("ConnectedRemoteSessionMetadataKind")) + connected_remote_session_metadata_repository = ConnectedRemoteSessionMetadataRepository.from_dict(obj.get("ConnectedRemoteSessionMetadataRepository")) + connect_remote_session_params = ConnectRemoteSessionParams.from_dict(obj.get("ConnectRemoteSessionParams")) connect_request = _ConnectRequest.from_dict(obj.get("ConnectRequest")) connect_result = _ConnectResult.from_dict(obj.get("ConnectResult")) content_filter_mode = ContentFilterMode(obj.get("ContentFilterMode")) - copilot_api_token_auth_info = CopilotAPITokenAuthInfo.from_dict( - obj.get("CopilotApiTokenAuthInfo") - ) + copilot_api_token_auth_info = CopilotAPITokenAuthInfo.from_dict(obj.get("CopilotApiTokenAuthInfo")) copilot_user_response = CopilotUserResponse.from_dict(obj.get("CopilotUserResponse")) - copilot_user_response_endpoints = CopilotUserResponseEndpoints.from_dict( - obj.get("CopilotUserResponseEndpoints") - ) - copilot_user_response_quota_snapshots = from_dict( - lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), - obj.get("CopilotUserResponseQuotaSnapshots"), - ) - copilot_user_response_quota_snapshots_chat = ( - CopilotUserResponseQuotaSnapshotsChat.from_dict( - obj.get("CopilotUserResponseQuotaSnapshotsChat") - ) - ) - copilot_user_response_quota_snapshots_completions = ( - CopilotUserResponseQuotaSnapshotsCompletions.from_dict( - obj.get("CopilotUserResponseQuotaSnapshotsCompletions") - ) - ) - copilot_user_response_quota_snapshots_premium_interactions = ( - CopilotUserResponseQuotaSnapshotsPremiumInteractions.from_dict( - obj.get("CopilotUserResponseQuotaSnapshotsPremiumInteractions") - ) - ) + copilot_user_response_endpoints = CopilotUserResponseEndpoints.from_dict(obj.get("CopilotUserResponseEndpoints")) + copilot_user_response_quota_snapshots = from_dict(lambda x: from_union([CopilotUserResponseQuotaSnapshots.from_dict, from_none], x), obj.get("CopilotUserResponseQuotaSnapshots")) + copilot_user_response_quota_snapshots_chat = CopilotUserResponseQuotaSnapshotsChat.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsChat")) + copilot_user_response_quota_snapshots_completions = CopilotUserResponseQuotaSnapshotsCompletions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsCompletions")) + copilot_user_response_quota_snapshots_premium_interactions = CopilotUserResponseQuotaSnapshotsPremiumInteractions.from_dict(obj.get("CopilotUserResponseQuotaSnapshotsPremiumInteractions")) current_model = CurrentModel.from_dict(obj.get("CurrentModel")) discovered_canvas = DiscoveredCanvas.from_dict(obj.get("DiscoveredCanvas")) discovered_mcp_server = DiscoveredMCPServer.from_dict(obj.get("DiscoveredMcpServer")) @@ -17514,13 +15429,9 @@ def from_dict(obj: Any) -> "RPC": enqueue_command_result = EnqueueCommandResult.from_dict(obj.get("EnqueueCommandResult")) env_auth_info = EnvAuthInfo.from_dict(obj.get("EnvAuthInfo")) event_log_read_request = EventLogReadRequest.from_dict(obj.get("EventLogReadRequest")) - event_log_release_interest_result = EventLogReleaseInterestResult.from_dict( - obj.get("EventLogReleaseInterestResult") - ) + event_log_release_interest_result = EventLogReleaseInterestResult.from_dict(obj.get("EventLogReleaseInterestResult")) event_log_tail_result = EventLogTailResult.from_dict(obj.get("EventLogTailResult")) - event_log_types = from_union( - [lambda x: from_list(from_str, x), EventLogTypes], obj.get("EventLogTypes") - ) + event_log_types = from_union([lambda x: from_list(from_str, x), EventLogTypes], obj.get("EventLogTypes")) events_agent_scope = EventsAgentScope(obj.get("EventsAgentScope")) events_cursor_status = EventsCursorStatus(obj.get("EventsCursorStatus")) events_read_result = EventsReadResult.from_dict(obj.get("EventsReadResult")) @@ -17528,341 +15439,139 @@ def from_dict(obj: Any) -> "RPC": execute_command_result = ExecuteCommandResult.from_dict(obj.get("ExecuteCommandResult")) extension = Extension.from_dict(obj.get("Extension")) extension_list = ExtensionList.from_dict(obj.get("ExtensionList")) - extensions_disable_request = ExtensionsDisableRequest.from_dict( - obj.get("ExtensionsDisableRequest") - ) - extensions_enable_request = ExtensionsEnableRequest.from_dict( - obj.get("ExtensionsEnableRequest") - ) + extensions_disable_request = ExtensionsDisableRequest.from_dict(obj.get("ExtensionsDisableRequest")) + extensions_enable_request = ExtensionsEnableRequest.from_dict(obj.get("ExtensionsEnableRequest")) extension_source = ExtensionSource(obj.get("ExtensionSource")) extension_status = ExtensionStatus(obj.get("ExtensionStatus")) - external_tool_result = from_union( - [ExternalToolTextResultForLlm.from_dict, from_str], obj.get("ExternalToolResult") - ) - external_tool_text_result_for_llm = ExternalToolTextResultForLlm.from_dict( - obj.get("ExternalToolTextResultForLlm") - ) - external_tool_text_result_for_llm_binary_results_for_llm = ( - ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict( - obj.get("ExternalToolTextResultForLlmBinaryResultsForLlm") - ) - ) - external_tool_text_result_for_llm_binary_results_for_llm_type = ( - ExternalToolTextResultForLlmBinaryResultsForLlmType( - obj.get("ExternalToolTextResultForLlmBinaryResultsForLlmType") - ) - ) - external_tool_text_result_for_llm_content = _load_ExternalToolTextResultForLlmContent( - obj.get("ExternalToolTextResultForLlmContent") - ) - external_tool_text_result_for_llm_content_audio = ( - ExternalToolTextResultForLlmContentAudio.from_dict( - obj.get("ExternalToolTextResultForLlmContentAudio") - ) - ) - external_tool_text_result_for_llm_content_image = ( - ExternalToolTextResultForLlmContentImage.from_dict( - obj.get("ExternalToolTextResultForLlmContentImage") - ) - ) - external_tool_text_result_for_llm_content_resource = ( - ExternalToolTextResultForLlmContentResource.from_dict( - obj.get("ExternalToolTextResultForLlmContentResource") - ) - ) - external_tool_text_result_for_llm_content_resource_details = ( - lambda x: from_union( - [EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x - ) - )(obj.get("ExternalToolTextResultForLlmContentResourceDetails")) - external_tool_text_result_for_llm_content_resource_link = ( - ExternalToolTextResultForLlmContentResourceLink.from_dict( - obj.get("ExternalToolTextResultForLlmContentResourceLink") - ) - ) - external_tool_text_result_for_llm_content_resource_link_icon = ( - ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict( - obj.get("ExternalToolTextResultForLlmContentResourceLinkIcon") - ) - ) - external_tool_text_result_for_llm_content_resource_link_icon_theme = Theme( - obj.get("ExternalToolTextResultForLlmContentResourceLinkIconTheme") - ) - external_tool_text_result_for_llm_content_terminal = ( - ExternalToolTextResultForLlmContentTerminal.from_dict( - obj.get("ExternalToolTextResultForLlmContentTerminal") - ) - ) - external_tool_text_result_for_llm_content_text = ( - ExternalToolTextResultForLlmContentText.from_dict( - obj.get("ExternalToolTextResultForLlmContentText") - ) - ) - filter_mapping = from_union( - [lambda x: from_dict(ContentFilterMode, x), ContentFilterMode], obj.get("FilterMapping") - ) + external_tool_result = from_union([ExternalToolTextResultForLlm.from_dict, from_str], obj.get("ExternalToolResult")) + external_tool_text_result_for_llm = ExternalToolTextResultForLlm.from_dict(obj.get("ExternalToolTextResultForLlm")) + external_tool_text_result_for_llm_binary_results_for_llm = ExternalToolTextResultForLlmBinaryResultsForLlm.from_dict(obj.get("ExternalToolTextResultForLlmBinaryResultsForLlm")) + external_tool_text_result_for_llm_binary_results_for_llm_type = ExternalToolTextResultForLlmBinaryResultsForLlmType(obj.get("ExternalToolTextResultForLlmBinaryResultsForLlmType")) + external_tool_text_result_for_llm_content = _load_ExternalToolTextResultForLlmContent(obj.get("ExternalToolTextResultForLlmContent")) + external_tool_text_result_for_llm_content_audio = ExternalToolTextResultForLlmContentAudio.from_dict(obj.get("ExternalToolTextResultForLlmContentAudio")) + external_tool_text_result_for_llm_content_image = ExternalToolTextResultForLlmContentImage.from_dict(obj.get("ExternalToolTextResultForLlmContentImage")) + external_tool_text_result_for_llm_content_resource = ExternalToolTextResultForLlmContentResource.from_dict(obj.get("ExternalToolTextResultForLlmContentResource")) + external_tool_text_result_for_llm_content_resource_details = (lambda x: from_union([EmbeddedTextResourceContents.from_dict, EmbeddedBlobResourceContents.from_dict], x))(obj.get("ExternalToolTextResultForLlmContentResourceDetails")) + external_tool_text_result_for_llm_content_resource_link = ExternalToolTextResultForLlmContentResourceLink.from_dict(obj.get("ExternalToolTextResultForLlmContentResourceLink")) + external_tool_text_result_for_llm_content_resource_link_icon = ExternalToolTextResultForLlmContentResourceLinkIcon.from_dict(obj.get("ExternalToolTextResultForLlmContentResourceLinkIcon")) + external_tool_text_result_for_llm_content_resource_link_icon_theme = Theme(obj.get("ExternalToolTextResultForLlmContentResourceLinkIconTheme")) + external_tool_text_result_for_llm_content_terminal = ExternalToolTextResultForLlmContentTerminal.from_dict(obj.get("ExternalToolTextResultForLlmContentTerminal")) + external_tool_text_result_for_llm_content_text = ExternalToolTextResultForLlmContentText.from_dict(obj.get("ExternalToolTextResultForLlmContentText")) + filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode], obj.get("FilterMapping")) fleet_start_request = FleetStartRequest.from_dict(obj.get("FleetStartRequest")) fleet_start_result = FleetStartResult.from_dict(obj.get("FleetStartResult")) folder_trust_add_params = FolderTrustAddParams.from_dict(obj.get("FolderTrustAddParams")) - folder_trust_check_params = FolderTrustCheckParams.from_dict( - obj.get("FolderTrustCheckParams") - ) - folder_trust_check_result = FolderTrustCheckResult.from_dict( - obj.get("FolderTrustCheckResult") - ) + folder_trust_check_params = FolderTrustCheckParams.from_dict(obj.get("FolderTrustCheckParams")) + folder_trust_check_result = FolderTrustCheckResult.from_dict(obj.get("FolderTrustCheckResult")) gh_cli_auth_info = GhCLIAuthInfo.from_dict(obj.get("GhCliAuthInfo")) - handle_pending_tool_call_request = HandlePendingToolCallRequest.from_dict( - obj.get("HandlePendingToolCallRequest") - ) - handle_pending_tool_call_result = HandlePendingToolCallResult.from_dict( - obj.get("HandlePendingToolCallResult") - ) - history_abort_manual_compaction_result = HistoryAbortManualCompactionResult.from_dict( - obj.get("HistoryAbortManualCompactionResult") - ) - history_cancel_background_compaction_result = ( - HistoryCancelBackgroundCompactionResult.from_dict( - obj.get("HistoryCancelBackgroundCompactionResult") - ) - ) - history_compact_context_window = HistoryCompactContextWindow.from_dict( - obj.get("HistoryCompactContextWindow") - ) + handle_pending_tool_call_request = HandlePendingToolCallRequest.from_dict(obj.get("HandlePendingToolCallRequest")) + handle_pending_tool_call_result = HandlePendingToolCallResult.from_dict(obj.get("HandlePendingToolCallResult")) + history_abort_manual_compaction_result = HistoryAbortManualCompactionResult.from_dict(obj.get("HistoryAbortManualCompactionResult")) + history_cancel_background_compaction_result = HistoryCancelBackgroundCompactionResult.from_dict(obj.get("HistoryCancelBackgroundCompactionResult")) + history_compact_context_window = HistoryCompactContextWindow.from_dict(obj.get("HistoryCompactContextWindow")) history_compact_request = HistoryCompactRequest.from_dict(obj.get("HistoryCompactRequest")) history_compact_result = HistoryCompactResult.from_dict(obj.get("HistoryCompactResult")) - history_summarize_for_handoff_result = HistorySummarizeForHandoffResult.from_dict( - obj.get("HistorySummarizeForHandoffResult") - ) - history_truncate_request = HistoryTruncateRequest.from_dict( - obj.get("HistoryTruncateRequest") - ) + history_summarize_for_handoff_result = HistorySummarizeForHandoffResult.from_dict(obj.get("HistorySummarizeForHandoffResult")) + history_truncate_request = HistoryTruncateRequest.from_dict(obj.get("HistoryTruncateRequest")) history_truncate_result = HistoryTruncateResult.from_dict(obj.get("HistoryTruncateResult")) hmac_auth_info = HMACAuthInfo.from_dict(obj.get("HMACAuthInfo")) installed_plugin = InstalledPlugin.from_dict(obj.get("InstalledPlugin")) - installed_plugin_source = from_union( - [InstalledPluginSource.from_dict, from_str], obj.get("InstalledPluginSource") - ) - installed_plugin_source_github = InstalledPluginSourceGithub.from_dict( - obj.get("InstalledPluginSourceGithub") - ) - installed_plugin_source_local = InstalledPluginSourceLocal.from_dict( - obj.get("InstalledPluginSourceLocal") - ) - installed_plugin_source_url = InstalledPluginSourceURL.from_dict( - obj.get("InstalledPluginSourceUrl") - ) - instructions_get_sources_result = InstructionsGetSourcesResult.from_dict( - obj.get("InstructionsGetSourcesResult") - ) + installed_plugin_source = from_union([InstalledPluginSource.from_dict, from_str], obj.get("InstalledPluginSource")) + installed_plugin_source_github = InstalledPluginSourceGithub.from_dict(obj.get("InstalledPluginSourceGithub")) + installed_plugin_source_local = InstalledPluginSourceLocal.from_dict(obj.get("InstalledPluginSourceLocal")) + installed_plugin_source_url = InstalledPluginSourceURL.from_dict(obj.get("InstalledPluginSourceUrl")) + instructions_get_sources_result = InstructionsGetSourcesResult.from_dict(obj.get("InstructionsGetSourcesResult")) instructions_sources = InstructionsSources.from_dict(obj.get("InstructionsSources")) - instructions_sources_location = InstructionsSourcesLocation( - obj.get("InstructionsSourcesLocation") - ) + instructions_sources_location = InstructionsSourcesLocation(obj.get("InstructionsSourcesLocation")) instructions_sources_type = InstructionsSourcesType(obj.get("InstructionsSourcesType")) log_request = LogRequest.from_dict(obj.get("LogRequest")) log_result = LogResult.from_dict(obj.get("LogResult")) lsp_initialize_request = LspInitializeRequest.from_dict(obj.get("LspInitializeRequest")) - mcp_apps_call_tool_request = MCPAppsCallToolRequest.from_dict( - obj.get("McpAppsCallToolRequest") - ) - mcp_apps_diagnose_capability = MCPAppsDiagnoseCapability.from_dict( - obj.get("McpAppsDiagnoseCapability") - ) - mcp_apps_diagnose_request = MCPAppsDiagnoseRequest.from_dict( - obj.get("McpAppsDiagnoseRequest") - ) + mcp_apps_call_tool_request = MCPAppsCallToolRequest.from_dict(obj.get("McpAppsCallToolRequest")) + mcp_apps_diagnose_capability = MCPAppsDiagnoseCapability.from_dict(obj.get("McpAppsDiagnoseCapability")) + mcp_apps_diagnose_request = MCPAppsDiagnoseRequest.from_dict(obj.get("McpAppsDiagnoseRequest")) mcp_apps_diagnose_result = MCPAppsDiagnoseResult.from_dict(obj.get("McpAppsDiagnoseResult")) mcp_apps_diagnose_server = MCPAppsDiagnoseServer.from_dict(obj.get("McpAppsDiagnoseServer")) mcp_apps_host_context = MCPAppsHostContext.from_dict(obj.get("McpAppsHostContext")) - mcp_apps_host_context_details = MCPAppsHostContextDetails.from_dict( - obj.get("McpAppsHostContextDetails") - ) - mcp_apps_host_context_details_available_display_mode = MCPAppsDisplayMode( - obj.get("McpAppsHostContextDetailsAvailableDisplayMode") - ) - mcp_apps_host_context_details_display_mode = MCPAppsDisplayMode( - obj.get("McpAppsHostContextDetailsDisplayMode") - ) - mcp_apps_host_context_details_platform = MCPAppsHostContextDetailsPlatform( - obj.get("McpAppsHostContextDetailsPlatform") - ) + mcp_apps_host_context_details = MCPAppsHostContextDetails.from_dict(obj.get("McpAppsHostContextDetails")) + mcp_apps_host_context_details_available_display_mode = MCPAppsDisplayMode(obj.get("McpAppsHostContextDetailsAvailableDisplayMode")) + mcp_apps_host_context_details_display_mode = MCPAppsDisplayMode(obj.get("McpAppsHostContextDetailsDisplayMode")) + mcp_apps_host_context_details_platform = MCPAppsHostContextDetailsPlatform(obj.get("McpAppsHostContextDetailsPlatform")) mcp_apps_host_context_details_theme = Theme(obj.get("McpAppsHostContextDetailsTheme")) - mcp_apps_list_tools_request = MCPAppsListToolsRequest.from_dict( - obj.get("McpAppsListToolsRequest") - ) - mcp_apps_list_tools_result = MCPAppsListToolsResult.from_dict( - obj.get("McpAppsListToolsResult") - ) - mcp_apps_read_resource_request = MCPAppsReadResourceRequest.from_dict( - obj.get("McpAppsReadResourceRequest") - ) - mcp_apps_read_resource_result = MCPAppsReadResourceResult.from_dict( - obj.get("McpAppsReadResourceResult") - ) - mcp_apps_resource_content = MCPAppsResourceContent.from_dict( - obj.get("McpAppsResourceContent") - ) - mcp_apps_set_host_context_details = MCPAppsSetHostContextDetails.from_dict( - obj.get("McpAppsSetHostContextDetails") - ) - mcp_apps_set_host_context_details_available_display_mode = MCPAppsDisplayMode( - obj.get("McpAppsSetHostContextDetailsAvailableDisplayMode") - ) - mcp_apps_set_host_context_details_display_mode = MCPAppsDisplayMode( - obj.get("McpAppsSetHostContextDetailsDisplayMode") - ) - mcp_apps_set_host_context_details_platform = MCPAppsHostContextDetailsPlatform( - obj.get("McpAppsSetHostContextDetailsPlatform") - ) - mcp_apps_set_host_context_details_theme = Theme( - obj.get("McpAppsSetHostContextDetailsTheme") - ) - mcp_apps_set_host_context_request = MCPAppsSetHostContextRequest.from_dict( - obj.get("McpAppsSetHostContextRequest") - ) - mcp_cancel_sampling_execution_params = MCPCancelSamplingExecutionParams.from_dict( - obj.get("McpCancelSamplingExecutionParams") - ) - mcp_cancel_sampling_execution_result = MCPCancelSamplingExecutionResult.from_dict( - obj.get("McpCancelSamplingExecutionResult") - ) + mcp_apps_list_tools_request = MCPAppsListToolsRequest.from_dict(obj.get("McpAppsListToolsRequest")) + mcp_apps_list_tools_result = MCPAppsListToolsResult.from_dict(obj.get("McpAppsListToolsResult")) + mcp_apps_read_resource_request = MCPAppsReadResourceRequest.from_dict(obj.get("McpAppsReadResourceRequest")) + mcp_apps_read_resource_result = MCPAppsReadResourceResult.from_dict(obj.get("McpAppsReadResourceResult")) + mcp_apps_resource_content = MCPAppsResourceContent.from_dict(obj.get("McpAppsResourceContent")) + mcp_apps_set_host_context_details = MCPAppsSetHostContextDetails.from_dict(obj.get("McpAppsSetHostContextDetails")) + mcp_apps_set_host_context_details_available_display_mode = MCPAppsDisplayMode(obj.get("McpAppsSetHostContextDetailsAvailableDisplayMode")) + mcp_apps_set_host_context_details_display_mode = MCPAppsDisplayMode(obj.get("McpAppsSetHostContextDetailsDisplayMode")) + mcp_apps_set_host_context_details_platform = MCPAppsHostContextDetailsPlatform(obj.get("McpAppsSetHostContextDetailsPlatform")) + mcp_apps_set_host_context_details_theme = Theme(obj.get("McpAppsSetHostContextDetailsTheme")) + mcp_apps_set_host_context_request = MCPAppsSetHostContextRequest.from_dict(obj.get("McpAppsSetHostContextRequest")) + mcp_cancel_sampling_execution_params = MCPCancelSamplingExecutionParams.from_dict(obj.get("McpCancelSamplingExecutionParams")) + mcp_cancel_sampling_execution_result = MCPCancelSamplingExecutionResult.from_dict(obj.get("McpCancelSamplingExecutionResult")) mcp_config_add_request = MCPConfigAddRequest.from_dict(obj.get("McpConfigAddRequest")) - mcp_config_disable_request = MCPConfigDisableRequest.from_dict( - obj.get("McpConfigDisableRequest") - ) - mcp_config_enable_request = MCPConfigEnableRequest.from_dict( - obj.get("McpConfigEnableRequest") - ) + mcp_config_disable_request = MCPConfigDisableRequest.from_dict(obj.get("McpConfigDisableRequest")) + mcp_config_enable_request = MCPConfigEnableRequest.from_dict(obj.get("McpConfigEnableRequest")) mcp_config_list = MCPConfigList.from_dict(obj.get("McpConfigList")) - mcp_config_remove_request = MCPConfigRemoveRequest.from_dict( - obj.get("McpConfigRemoveRequest") - ) - mcp_config_update_request = MCPConfigUpdateRequest.from_dict( - obj.get("McpConfigUpdateRequest") - ) + mcp_config_remove_request = MCPConfigRemoveRequest.from_dict(obj.get("McpConfigRemoveRequest")) + mcp_config_update_request = MCPConfigUpdateRequest.from_dict(obj.get("McpConfigUpdateRequest")) mcp_disable_request = MCPDisableRequest.from_dict(obj.get("McpDisableRequest")) mcp_discover_request = MCPDiscoverRequest.from_dict(obj.get("McpDiscoverRequest")) mcp_discover_result = MCPDiscoverResult.from_dict(obj.get("McpDiscoverResult")) mcp_enable_request = MCPEnableRequest.from_dict(obj.get("McpEnableRequest")) - mcp_execute_sampling_params = MCPExecuteSamplingParams.from_dict( - obj.get("McpExecuteSamplingParams") - ) + mcp_execute_sampling_params = MCPExecuteSamplingParams.from_dict(obj.get("McpExecuteSamplingParams")) mcp_execute_sampling_request = from_dict(lambda x: x, obj.get("McpExecuteSamplingRequest")) mcp_execute_sampling_result = from_dict(lambda x: x, obj.get("McpExecuteSamplingResult")) mcp_oauth_login_request = MCPOauthLoginRequest.from_dict(obj.get("McpOauthLoginRequest")) mcp_oauth_login_result = MCPOauthLoginResult.from_dict(obj.get("McpOauthLoginResult")) - mcp_remove_git_hub_result = MCPRemoveGitHubResult.from_dict( - obj.get("McpRemoveGitHubResult") - ) - mcp_sampling_execution_action = MCPSamplingExecutionAction( - obj.get("McpSamplingExecutionAction") - ) - mcp_sampling_execution_result = MCPSamplingExecutionResult.from_dict( - obj.get("McpSamplingExecutionResult") - ) + mcp_remove_git_hub_result = MCPRemoveGitHubResult.from_dict(obj.get("McpRemoveGitHubResult")) + mcp_sampling_execution_action = MCPSamplingExecutionAction(obj.get("McpSamplingExecutionAction")) + mcp_sampling_execution_result = MCPSamplingExecutionResult.from_dict(obj.get("McpSamplingExecutionResult")) mcp_server = MCPServer.from_dict(obj.get("McpServer")) mcp_server_config = MCPServerConfig.from_dict(obj.get("McpServerConfig")) mcp_server_config_http = MCPServerConfigHTTP.from_dict(obj.get("McpServerConfigHttp")) - mcp_server_config_http_auth = MCPServerConfigHTTPAuth.from_dict( - obj.get("McpServerConfigHttpAuth") - ) - mcp_server_config_http_oauth_grant_type = MCPServerConfigHTTPOauthGrantType( - obj.get("McpServerConfigHttpOauthGrantType") - ) + mcp_server_config_http_auth = MCPServerConfigHTTPAuth.from_dict(obj.get("McpServerConfigHttpAuth")) + mcp_server_config_http_oauth_grant_type = MCPServerConfigHTTPOauthGrantType(obj.get("McpServerConfigHttpOauthGrantType")) mcp_server_config_http_type = MCPServerConfigHTTPType(obj.get("McpServerConfigHttpType")) mcp_server_config_stdio = MCPServerConfigStdio.from_dict(obj.get("McpServerConfigStdio")) mcp_server_list = MCPServerList.from_dict(obj.get("McpServerList")) - mcp_set_env_value_mode_details = MCPSetEnvValueModeDetails( - obj.get("McpSetEnvValueModeDetails") - ) - mcp_set_env_value_mode_params = MCPSetEnvValueModeParams.from_dict( - obj.get("McpSetEnvValueModeParams") - ) - mcp_set_env_value_mode_result = MCPSetEnvValueModeResult.from_dict( - obj.get("McpSetEnvValueModeResult") - ) - metadata_context_info_request = MetadataContextInfoRequest.from_dict( - obj.get("MetadataContextInfoRequest") - ) - metadata_context_info_result = MetadataContextInfoResult.from_dict( - obj.get("MetadataContextInfoResult") - ) - metadata_is_processing_result = MetadataIsProcessingResult.from_dict( - obj.get("MetadataIsProcessingResult") - ) - metadata_recompute_context_tokens_request = MetadataRecomputeContextTokensRequest.from_dict( - obj.get("MetadataRecomputeContextTokensRequest") - ) - metadata_recompute_context_tokens_result = MetadataRecomputeContextTokensResult.from_dict( - obj.get("MetadataRecomputeContextTokensResult") - ) - metadata_record_context_change_request = MetadataRecordContextChangeRequest.from_dict( - obj.get("MetadataRecordContextChangeRequest") - ) - metadata_record_context_change_result = MetadataRecordContextChangeResult.from_dict( - obj.get("MetadataRecordContextChangeResult") - ) - metadata_set_working_directory_request = MetadataSetWorkingDirectoryRequest.from_dict( - obj.get("MetadataSetWorkingDirectoryRequest") - ) - metadata_set_working_directory_result = MetadataSetWorkingDirectoryResult.from_dict( - obj.get("MetadataSetWorkingDirectoryResult") - ) - metadata_snapshot_current_mode = MetadataSnapshotCurrentMode( - obj.get("MetadataSnapshotCurrentMode") - ) - metadata_snapshot_remote_metadata = MetadataSnapshotRemoteMetadata.from_dict( - obj.get("MetadataSnapshotRemoteMetadata") - ) - metadata_snapshot_remote_metadata_repository = ( - MetadataSnapshotRemoteMetadataRepository.from_dict( - obj.get("MetadataSnapshotRemoteMetadataRepository") - ) - ) - metadata_snapshot_remote_metadata_task_type = MetadataSnapshotRemoteMetadataTaskType( - obj.get("MetadataSnapshotRemoteMetadataTaskType") - ) + mcp_set_env_value_mode_details = MCPSetEnvValueModeDetails(obj.get("McpSetEnvValueModeDetails")) + mcp_set_env_value_mode_params = MCPSetEnvValueModeParams.from_dict(obj.get("McpSetEnvValueModeParams")) + mcp_set_env_value_mode_result = MCPSetEnvValueModeResult.from_dict(obj.get("McpSetEnvValueModeResult")) + metadata_context_info_request = MetadataContextInfoRequest.from_dict(obj.get("MetadataContextInfoRequest")) + metadata_context_info_result = MetadataContextInfoResult.from_dict(obj.get("MetadataContextInfoResult")) + metadata_is_processing_result = MetadataIsProcessingResult.from_dict(obj.get("MetadataIsProcessingResult")) + metadata_recompute_context_tokens_request = MetadataRecomputeContextTokensRequest.from_dict(obj.get("MetadataRecomputeContextTokensRequest")) + metadata_recompute_context_tokens_result = MetadataRecomputeContextTokensResult.from_dict(obj.get("MetadataRecomputeContextTokensResult")) + metadata_record_context_change_request = MetadataRecordContextChangeRequest.from_dict(obj.get("MetadataRecordContextChangeRequest")) + metadata_record_context_change_result = MetadataRecordContextChangeResult.from_dict(obj.get("MetadataRecordContextChangeResult")) + metadata_set_working_directory_request = MetadataSetWorkingDirectoryRequest.from_dict(obj.get("MetadataSetWorkingDirectoryRequest")) + metadata_set_working_directory_result = MetadataSetWorkingDirectoryResult.from_dict(obj.get("MetadataSetWorkingDirectoryResult")) + metadata_snapshot_current_mode = MetadataSnapshotCurrentMode(obj.get("MetadataSnapshotCurrentMode")) + metadata_snapshot_remote_metadata = MetadataSnapshotRemoteMetadata.from_dict(obj.get("MetadataSnapshotRemoteMetadata")) + metadata_snapshot_remote_metadata_repository = MetadataSnapshotRemoteMetadataRepository.from_dict(obj.get("MetadataSnapshotRemoteMetadataRepository")) + metadata_snapshot_remote_metadata_task_type = MetadataSnapshotRemoteMetadataTaskType(obj.get("MetadataSnapshotRemoteMetadataTaskType")) model = Model.from_dict(obj.get("Model")) model_billing = ModelBilling.from_dict(obj.get("ModelBilling")) - model_billing_token_prices = ModelBillingTokenPrices.from_dict( - obj.get("ModelBillingTokenPrices") - ) - model_billing_token_prices_long_context = ModelBillingTokenPricesLongContext.from_dict( - obj.get("ModelBillingTokenPricesLongContext") - ) + model_billing_token_prices = ModelBillingTokenPrices.from_dict(obj.get("ModelBillingTokenPrices")) + model_billing_token_prices_long_context = ModelBillingTokenPricesLongContext.from_dict(obj.get("ModelBillingTokenPricesLongContext")) model_capabilities = ModelCapabilities.from_dict(obj.get("ModelCapabilities")) - model_capabilities_limits = ModelCapabilitiesLimits.from_dict( - obj.get("ModelCapabilitiesLimits") - ) - model_capabilities_limits_vision = ModelCapabilitiesLimitsVision.from_dict( - obj.get("ModelCapabilitiesLimitsVision") - ) - model_capabilities_override = ModelCapabilitiesOverride.from_dict( - obj.get("ModelCapabilitiesOverride") - ) - model_capabilities_override_limits = ModelCapabilitiesOverrideLimits.from_dict( - obj.get("ModelCapabilitiesOverrideLimits") - ) - model_capabilities_override_limits_vision = ModelCapabilitiesOverrideLimitsVision.from_dict( - obj.get("ModelCapabilitiesOverrideLimitsVision") - ) - model_capabilities_override_supports = ModelCapabilitiesOverrideSupports.from_dict( - obj.get("ModelCapabilitiesOverrideSupports") - ) - model_capabilities_supports = ModelCapabilitiesSupports.from_dict( - obj.get("ModelCapabilitiesSupports") - ) + model_capabilities_limits = ModelCapabilitiesLimits.from_dict(obj.get("ModelCapabilitiesLimits")) + model_capabilities_limits_vision = ModelCapabilitiesLimitsVision.from_dict(obj.get("ModelCapabilitiesLimitsVision")) + model_capabilities_override = ModelCapabilitiesOverride.from_dict(obj.get("ModelCapabilitiesOverride")) + model_capabilities_override_limits = ModelCapabilitiesOverrideLimits.from_dict(obj.get("ModelCapabilitiesOverrideLimits")) + model_capabilities_override_limits_vision = ModelCapabilitiesOverrideLimitsVision.from_dict(obj.get("ModelCapabilitiesOverrideLimitsVision")) + model_capabilities_override_supports = ModelCapabilitiesOverrideSupports.from_dict(obj.get("ModelCapabilitiesOverrideSupports")) + model_capabilities_supports = ModelCapabilitiesSupports.from_dict(obj.get("ModelCapabilitiesSupports")) model_list = ModelList.from_dict(obj.get("ModelList")) model_picker_category = ModelPickerCategory(obj.get("ModelPickerCategory")) model_picker_price_category = ModelPickerPriceCategory(obj.get("ModelPickerPriceCategory")) model_policy = ModelPolicy.from_dict(obj.get("ModelPolicy")) model_policy_state = ModelPolicyState(obj.get("ModelPolicyState")) - model_set_reasoning_effort_request = ModelSetReasoningEffortRequest.from_dict( - obj.get("ModelSetReasoningEffortRequest") - ) - model_set_reasoning_effort_result = ModelSetReasoningEffortResult.from_dict( - obj.get("ModelSetReasoningEffortResult") - ) + model_set_reasoning_effort_request = ModelSetReasoningEffortRequest.from_dict(obj.get("ModelSetReasoningEffortRequest")) + model_set_reasoning_effort_result = ModelSetReasoningEffortResult.from_dict(obj.get("ModelSetReasoningEffortResult")) models_list_request = ModelsListRequest.from_dict(obj.get("ModelsListRequest")) model_switch_to_request = ModelSwitchToRequest.from_dict(obj.get("ModelSwitchToRequest")) model_switch_to_result = ModelSwitchToResult.from_dict(obj.get("ModelSwitchToResult")) @@ -17872,363 +15581,99 @@ def from_dict(obj: Any) -> "RPC": name_set_auto_result = NameSetAutoResult.from_dict(obj.get("NameSetAutoResult")) name_set_request = NameSetRequest.from_dict(obj.get("NameSetRequest")) open_canvas_instance = OpenCanvasInstance.from_dict(obj.get("OpenCanvasInstance")) - options_update_env_value_mode = MCPSetEnvValueModeDetails( - obj.get("OptionsUpdateEnvValueMode") - ) - pending_permission_request = PendingPermissionRequest.from_dict( - obj.get("PendingPermissionRequest") - ) - pending_permission_request_list = PendingPermissionRequestList.from_dict( - obj.get("PendingPermissionRequestList") - ) + options_update_env_value_mode = MCPSetEnvValueModeDetails(obj.get("OptionsUpdateEnvValueMode")) + pending_permission_request = PendingPermissionRequest.from_dict(obj.get("PendingPermissionRequest")) + pending_permission_request_list = PendingPermissionRequestList.from_dict(obj.get("PendingPermissionRequestList")) permission_decision = _load_PermissionDecision(obj.get("PermissionDecision")) - permission_decision_approved = PermissionDecisionApproved.from_dict( - obj.get("PermissionDecisionApproved") - ) - permission_decision_approved_for_location = PermissionDecisionApprovedForLocation.from_dict( - obj.get("PermissionDecisionApprovedForLocation") - ) - permission_decision_approved_for_session = PermissionDecisionApprovedForSession.from_dict( - obj.get("PermissionDecisionApprovedForSession") - ) - permission_decision_approve_for_location = PermissionDecisionApproveForLocation.from_dict( - obj.get("PermissionDecisionApproveForLocation") - ) - permission_decision_approve_for_location_approval = ( - _load_PermissionDecisionApproveForLocationApproval( - obj.get("PermissionDecisionApproveForLocationApproval") - ) - ) - permission_decision_approve_for_location_approval_commands = ( - PermissionDecisionApproveForLocationApprovalCommands.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalCommands") - ) - ) - permission_decision_approve_for_location_approval_custom_tool = ( - PermissionDecisionApproveForLocationApprovalCustomTool.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalCustomTool") - ) - ) - permission_decision_approve_for_location_approval_extension_management = ( - PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalExtensionManagement") - ) - ) - permission_decision_approve_for_location_approval_extension_permission_access = ( - PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess") - ) - ) - permission_decision_approve_for_location_approval_mcp = ( - PermissionDecisionApproveForLocationApprovalMCP.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalMcp") - ) - ) - permission_decision_approve_for_location_approval_mcp_sampling = ( - PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalMcpSampling") - ) - ) - permission_decision_approve_for_location_approval_memory = ( - PermissionDecisionApproveForLocationApprovalMemory.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalMemory") - ) - ) - permission_decision_approve_for_location_approval_read = ( - PermissionDecisionApproveForLocationApprovalRead.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalRead") - ) - ) - permission_decision_approve_for_location_approval_write = ( - PermissionDecisionApproveForLocationApprovalWrite.from_dict( - obj.get("PermissionDecisionApproveForLocationApprovalWrite") - ) - ) - permission_decision_approve_for_session = PermissionDecisionApproveForSession.from_dict( - obj.get("PermissionDecisionApproveForSession") - ) - permission_decision_approve_for_session_approval = ( - _load_PermissionDecisionApproveForSessionApproval( - obj.get("PermissionDecisionApproveForSessionApproval") - ) - ) - permission_decision_approve_for_session_approval_commands = ( - PermissionDecisionApproveForSessionApprovalCommands.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalCommands") - ) - ) - permission_decision_approve_for_session_approval_custom_tool = ( - PermissionDecisionApproveForSessionApprovalCustomTool.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalCustomTool") - ) - ) - permission_decision_approve_for_session_approval_extension_management = ( - PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalExtensionManagement") - ) - ) - permission_decision_approve_for_session_approval_extension_permission_access = ( - PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess") - ) - ) - permission_decision_approve_for_session_approval_mcp = ( - PermissionDecisionApproveForSessionApprovalMCP.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalMcp") - ) - ) - permission_decision_approve_for_session_approval_mcp_sampling = ( - PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalMcpSampling") - ) - ) - permission_decision_approve_for_session_approval_memory = ( - PermissionDecisionApproveForSessionApprovalMemory.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalMemory") - ) - ) - permission_decision_approve_for_session_approval_read = ( - PermissionDecisionApproveForSessionApprovalRead.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalRead") - ) - ) - permission_decision_approve_for_session_approval_write = ( - PermissionDecisionApproveForSessionApprovalWrite.from_dict( - obj.get("PermissionDecisionApproveForSessionApprovalWrite") - ) - ) - permission_decision_approve_once = PermissionDecisionApproveOnce.from_dict( - obj.get("PermissionDecisionApproveOnce") - ) - permission_decision_approve_permanently = PermissionDecisionApprovePermanently.from_dict( - obj.get("PermissionDecisionApprovePermanently") - ) - permission_decision_cancelled = PermissionDecisionCancelled.from_dict( - obj.get("PermissionDecisionCancelled") - ) - permission_decision_denied_by_content_exclusion_policy = ( - PermissionDecisionDeniedByContentExclusionPolicy.from_dict( - obj.get("PermissionDecisionDeniedByContentExclusionPolicy") - ) - ) - permission_decision_denied_by_permission_request_hook = ( - PermissionDecisionDeniedByPermissionRequestHook.from_dict( - obj.get("PermissionDecisionDeniedByPermissionRequestHook") - ) - ) - permission_decision_denied_by_rules = PermissionDecisionDeniedByRules.from_dict( - obj.get("PermissionDecisionDeniedByRules") - ) - permission_decision_denied_interactively_by_user = ( - PermissionDecisionDeniedInteractivelyByUser.from_dict( - obj.get("PermissionDecisionDeniedInteractivelyByUser") - ) - ) - permission_decision_denied_no_approval_rule_and_could_not_request_from_user = ( - PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict( - obj.get("PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser") - ) - ) - permission_decision_reject = PermissionDecisionReject.from_dict( - obj.get("PermissionDecisionReject") - ) - permission_decision_request = PermissionDecisionRequest.from_dict( - obj.get("PermissionDecisionRequest") - ) - permission_decision_user_not_available = PermissionDecisionUserNotAvailable.from_dict( - obj.get("PermissionDecisionUserNotAvailable") - ) - permission_location_add_tool_approval_params = ( - PermissionLocationAddToolApprovalParams.from_dict( - obj.get("PermissionLocationAddToolApprovalParams") - ) - ) - permission_location_apply_params = PermissionLocationApplyParams.from_dict( - obj.get("PermissionLocationApplyParams") - ) - permission_location_apply_result = PermissionLocationApplyResult.from_dict( - obj.get("PermissionLocationApplyResult") - ) - permission_location_resolve_params = PermissionLocationResolveParams.from_dict( - obj.get("PermissionLocationResolveParams") - ) - permission_location_resolve_result = PermissionLocationResolveResult.from_dict( - obj.get("PermissionLocationResolveResult") - ) + permission_decision_approved = PermissionDecisionApproved.from_dict(obj.get("PermissionDecisionApproved")) + permission_decision_approved_for_location = PermissionDecisionApprovedForLocation.from_dict(obj.get("PermissionDecisionApprovedForLocation")) + permission_decision_approved_for_session = PermissionDecisionApprovedForSession.from_dict(obj.get("PermissionDecisionApprovedForSession")) + permission_decision_approve_for_location = PermissionDecisionApproveForLocation.from_dict(obj.get("PermissionDecisionApproveForLocation")) + permission_decision_approve_for_location_approval = _load_PermissionDecisionApproveForLocationApproval(obj.get("PermissionDecisionApproveForLocationApproval")) + permission_decision_approve_for_location_approval_commands = PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalCommands")) + permission_decision_approve_for_location_approval_custom_tool = PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalCustomTool")) + permission_decision_approve_for_location_approval_extension_management = PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalExtensionManagement")) + permission_decision_approve_for_location_approval_extension_permission_access = PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess")) + permission_decision_approve_for_location_approval_mcp = PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMcp")) + permission_decision_approve_for_location_approval_mcp_sampling = PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMcpSampling")) + permission_decision_approve_for_location_approval_memory = PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalMemory")) + permission_decision_approve_for_location_approval_read = PermissionDecisionApproveForLocationApprovalRead.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalRead")) + permission_decision_approve_for_location_approval_write = PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj.get("PermissionDecisionApproveForLocationApprovalWrite")) + permission_decision_approve_for_session = PermissionDecisionApproveForSession.from_dict(obj.get("PermissionDecisionApproveForSession")) + permission_decision_approve_for_session_approval = _load_PermissionDecisionApproveForSessionApproval(obj.get("PermissionDecisionApproveForSessionApproval")) + permission_decision_approve_for_session_approval_commands = PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalCommands")) + permission_decision_approve_for_session_approval_custom_tool = PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalCustomTool")) + permission_decision_approve_for_session_approval_extension_management = PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalExtensionManagement")) + permission_decision_approve_for_session_approval_extension_permission_access = PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess")) + permission_decision_approve_for_session_approval_mcp = PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMcp")) + permission_decision_approve_for_session_approval_mcp_sampling = PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMcpSampling")) + permission_decision_approve_for_session_approval_memory = PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalMemory")) + permission_decision_approve_for_session_approval_read = PermissionDecisionApproveForSessionApprovalRead.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalRead")) + permission_decision_approve_for_session_approval_write = PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj.get("PermissionDecisionApproveForSessionApprovalWrite")) + permission_decision_approve_once = PermissionDecisionApproveOnce.from_dict(obj.get("PermissionDecisionApproveOnce")) + permission_decision_approve_permanently = PermissionDecisionApprovePermanently.from_dict(obj.get("PermissionDecisionApprovePermanently")) + permission_decision_cancelled = PermissionDecisionCancelled.from_dict(obj.get("PermissionDecisionCancelled")) + permission_decision_denied_by_content_exclusion_policy = PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj.get("PermissionDecisionDeniedByContentExclusionPolicy")) + permission_decision_denied_by_permission_request_hook = PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj.get("PermissionDecisionDeniedByPermissionRequestHook")) + permission_decision_denied_by_rules = PermissionDecisionDeniedByRules.from_dict(obj.get("PermissionDecisionDeniedByRules")) + permission_decision_denied_interactively_by_user = PermissionDecisionDeniedInteractivelyByUser.from_dict(obj.get("PermissionDecisionDeniedInteractivelyByUser")) + permission_decision_denied_no_approval_rule_and_could_not_request_from_user = PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj.get("PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser")) + permission_decision_reject = PermissionDecisionReject.from_dict(obj.get("PermissionDecisionReject")) + permission_decision_request = PermissionDecisionRequest.from_dict(obj.get("PermissionDecisionRequest")) + permission_decision_user_not_available = PermissionDecisionUserNotAvailable.from_dict(obj.get("PermissionDecisionUserNotAvailable")) + permission_location_add_tool_approval_params = PermissionLocationAddToolApprovalParams.from_dict(obj.get("PermissionLocationAddToolApprovalParams")) + permission_location_apply_params = PermissionLocationApplyParams.from_dict(obj.get("PermissionLocationApplyParams")) + permission_location_apply_result = PermissionLocationApplyResult.from_dict(obj.get("PermissionLocationApplyResult")) + permission_location_resolve_params = PermissionLocationResolveParams.from_dict(obj.get("PermissionLocationResolveParams")) + permission_location_resolve_result = PermissionLocationResolveResult.from_dict(obj.get("PermissionLocationResolveResult")) permission_location_type = PermissionLocationType(obj.get("PermissionLocationType")) - permission_paths_add_params = PermissionPathsAddParams.from_dict( - obj.get("PermissionPathsAddParams") - ) - permission_paths_allowed_check_params = PermissionPathsAllowedCheckParams.from_dict( - obj.get("PermissionPathsAllowedCheckParams") - ) - permission_paths_allowed_check_result = PermissionPathsAllowedCheckResult.from_dict( - obj.get("PermissionPathsAllowedCheckResult") - ) + permission_paths_add_params = PermissionPathsAddParams.from_dict(obj.get("PermissionPathsAddParams")) + permission_paths_allowed_check_params = PermissionPathsAllowedCheckParams.from_dict(obj.get("PermissionPathsAllowedCheckParams")) + permission_paths_allowed_check_result = PermissionPathsAllowedCheckResult.from_dict(obj.get("PermissionPathsAllowedCheckResult")) permission_paths_config = PermissionPathsConfig.from_dict(obj.get("PermissionPathsConfig")) permission_paths_list = PermissionPathsList.from_dict(obj.get("PermissionPathsList")) - permission_paths_update_primary_params = PermissionPathsUpdatePrimaryParams.from_dict( - obj.get("PermissionPathsUpdatePrimaryParams") - ) - permission_paths_workspace_check_params = PermissionPathsWorkspaceCheckParams.from_dict( - obj.get("PermissionPathsWorkspaceCheckParams") - ) - permission_paths_workspace_check_result = PermissionPathsWorkspaceCheckResult.from_dict( - obj.get("PermissionPathsWorkspaceCheckResult") - ) - permission_prompt_shown_notification = PermissionPromptShownNotification.from_dict( - obj.get("PermissionPromptShownNotification") - ) - permission_request_result = PermissionRequestResult.from_dict( - obj.get("PermissionRequestResult") - ) + permission_paths_update_primary_params = PermissionPathsUpdatePrimaryParams.from_dict(obj.get("PermissionPathsUpdatePrimaryParams")) + permission_paths_workspace_check_params = PermissionPathsWorkspaceCheckParams.from_dict(obj.get("PermissionPathsWorkspaceCheckParams")) + permission_paths_workspace_check_result = PermissionPathsWorkspaceCheckResult.from_dict(obj.get("PermissionPathsWorkspaceCheckResult")) + permission_prompt_shown_notification = PermissionPromptShownNotification.from_dict(obj.get("PermissionPromptShownNotification")) + permission_request_result = PermissionRequestResult.from_dict(obj.get("PermissionRequestResult")) permission_rules_set = PermissionRulesSet.from_dict(obj.get("PermissionRulesSet")) - permissions_configure_additional_content_exclusion_policy = ( - PermissionsConfigureAdditionalContentExclusionPolicy.from_dict( - obj.get("PermissionsConfigureAdditionalContentExclusionPolicy") - ) - ) - permissions_configure_additional_content_exclusion_policy_rule = ( - PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict( - obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRule") - ) - ) - permissions_configure_additional_content_exclusion_policy_rule_source = ( - PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict( - obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRuleSource") - ) - ) - permissions_configure_additional_content_exclusion_policy_scope = ( - PermissionsConfigureAdditionalContentExclusionPolicyScope( - obj.get("PermissionsConfigureAdditionalContentExclusionPolicyScope") - ) - ) - permissions_configure_params = PermissionsConfigureParams.from_dict( - obj.get("PermissionsConfigureParams") - ) - permissions_configure_result = PermissionsConfigureResult.from_dict( - obj.get("PermissionsConfigureResult") - ) - permissions_folder_trust_add_trusted_result = ( - PermissionsFolderTrustAddTrustedResult.from_dict( - obj.get("PermissionsFolderTrustAddTrustedResult") - ) - ) - permissions_locations_add_tool_approval_details = ( - _load_PermissionsLocationsAddToolApprovalDetails( - obj.get("PermissionsLocationsAddToolApprovalDetails") - ) - ) - permissions_locations_add_tool_approval_details_commands = ( - PermissionsLocationsAddToolApprovalDetailsCommands.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsCommands") - ) - ) - permissions_locations_add_tool_approval_details_custom_tool = ( - PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsCustomTool") - ) - ) - permissions_locations_add_tool_approval_details_extension_management = ( - PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionManagement") - ) - ) - permissions_locations_add_tool_approval_details_extension_permission_access = ( - PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess") - ) - ) - permissions_locations_add_tool_approval_details_mcp = ( - PermissionsLocationsAddToolApprovalDetailsMCP.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsMcp") - ) - ) - permissions_locations_add_tool_approval_details_mcp_sampling = ( - PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsMcpSampling") - ) - ) - permissions_locations_add_tool_approval_details_memory = ( - PermissionsLocationsAddToolApprovalDetailsMemory.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsMemory") - ) - ) - permissions_locations_add_tool_approval_details_read = ( - PermissionsLocationsAddToolApprovalDetailsRead.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsRead") - ) - ) - permissions_locations_add_tool_approval_details_write = ( - PermissionsLocationsAddToolApprovalDetailsWrite.from_dict( - obj.get("PermissionsLocationsAddToolApprovalDetailsWrite") - ) - ) - permissions_locations_add_tool_approval_result = ( - PermissionsLocationsAddToolApprovalResult.from_dict( - obj.get("PermissionsLocationsAddToolApprovalResult") - ) - ) - permissions_modify_rules_params = PermissionsModifyRulesParams.from_dict( - obj.get("PermissionsModifyRulesParams") - ) - permissions_modify_rules_result = PermissionsModifyRulesResult.from_dict( - obj.get("PermissionsModifyRulesResult") - ) - permissions_modify_rules_scope = PermissionsModifyRulesScope( - obj.get("PermissionsModifyRulesScope") - ) - permissions_notify_prompt_shown_result = PermissionsNotifyPromptShownResult.from_dict( - obj.get("PermissionsNotifyPromptShownResult") - ) - permissions_paths_add_result = PermissionsPathsAddResult.from_dict( - obj.get("PermissionsPathsAddResult") - ) - permissions_paths_list_request = PermissionsPathsListRequest.from_dict( - obj.get("PermissionsPathsListRequest") - ) - permissions_paths_update_primary_result = PermissionsPathsUpdatePrimaryResult.from_dict( - obj.get("PermissionsPathsUpdatePrimaryResult") - ) - permissions_pending_requests_request = PermissionsPendingRequestsRequest.from_dict( - obj.get("PermissionsPendingRequestsRequest") - ) - permissions_reset_session_approvals_request = ( - PermissionsResetSessionApprovalsRequest.from_dict( - obj.get("PermissionsResetSessionApprovalsRequest") - ) - ) - permissions_reset_session_approvals_result = ( - PermissionsResetSessionApprovalsResult.from_dict( - obj.get("PermissionsResetSessionApprovalsResult") - ) - ) - permissions_set_approve_all_request = PermissionsSetApproveAllRequest.from_dict( - obj.get("PermissionsSetApproveAllRequest") - ) - permissions_set_approve_all_result = PermissionsSetApproveAllResult.from_dict( - obj.get("PermissionsSetApproveAllResult") - ) - permissions_set_approve_all_source = PermissionsSetApproveAllSource( - obj.get("PermissionsSetApproveAllSource") - ) - permissions_set_required_request = PermissionsSetRequiredRequest.from_dict( - obj.get("PermissionsSetRequiredRequest") - ) - permissions_set_required_result = PermissionsSetRequiredResult.from_dict( - obj.get("PermissionsSetRequiredResult") - ) - permissions_urls_set_unrestricted_mode_result = ( - PermissionsUrlsSetUnrestrictedModeResult.from_dict( - obj.get("PermissionsUrlsSetUnrestrictedModeResult") - ) - ) + permissions_configure_additional_content_exclusion_policy = PermissionsConfigureAdditionalContentExclusionPolicy.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicy")) + permissions_configure_additional_content_exclusion_policy_rule = PermissionsConfigureAdditionalContentExclusionPolicyRule.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRule")) + permissions_configure_additional_content_exclusion_policy_rule_source = PermissionsConfigureAdditionalContentExclusionPolicyRuleSource.from_dict(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyRuleSource")) + permissions_configure_additional_content_exclusion_policy_scope = PermissionsConfigureAdditionalContentExclusionPolicyScope(obj.get("PermissionsConfigureAdditionalContentExclusionPolicyScope")) + permissions_configure_params = PermissionsConfigureParams.from_dict(obj.get("PermissionsConfigureParams")) + permissions_configure_result = PermissionsConfigureResult.from_dict(obj.get("PermissionsConfigureResult")) + permissions_folder_trust_add_trusted_result = PermissionsFolderTrustAddTrustedResult.from_dict(obj.get("PermissionsFolderTrustAddTrustedResult")) + permissions_locations_add_tool_approval_details = _load_PermissionsLocationsAddToolApprovalDetails(obj.get("PermissionsLocationsAddToolApprovalDetails")) + permissions_locations_add_tool_approval_details_commands = PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCommands")) + permissions_locations_add_tool_approval_details_custom_tool = PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsCustomTool")) + permissions_locations_add_tool_approval_details_extension_management = PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionManagement")) + permissions_locations_add_tool_approval_details_extension_permission_access = PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess")) + permissions_locations_add_tool_approval_details_mcp = PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMcp")) + permissions_locations_add_tool_approval_details_mcp_sampling = PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMcpSampling")) + permissions_locations_add_tool_approval_details_memory = PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsMemory")) + permissions_locations_add_tool_approval_details_read = PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsRead")) + permissions_locations_add_tool_approval_details_write = PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj.get("PermissionsLocationsAddToolApprovalDetailsWrite")) + permissions_locations_add_tool_approval_result = PermissionsLocationsAddToolApprovalResult.from_dict(obj.get("PermissionsLocationsAddToolApprovalResult")) + permissions_modify_rules_params = PermissionsModifyRulesParams.from_dict(obj.get("PermissionsModifyRulesParams")) + permissions_modify_rules_result = PermissionsModifyRulesResult.from_dict(obj.get("PermissionsModifyRulesResult")) + permissions_modify_rules_scope = PermissionsModifyRulesScope(obj.get("PermissionsModifyRulesScope")) + permissions_notify_prompt_shown_result = PermissionsNotifyPromptShownResult.from_dict(obj.get("PermissionsNotifyPromptShownResult")) + permissions_paths_add_result = PermissionsPathsAddResult.from_dict(obj.get("PermissionsPathsAddResult")) + permissions_paths_list_request = PermissionsPathsListRequest.from_dict(obj.get("PermissionsPathsListRequest")) + permissions_paths_update_primary_result = PermissionsPathsUpdatePrimaryResult.from_dict(obj.get("PermissionsPathsUpdatePrimaryResult")) + permissions_pending_requests_request = PermissionsPendingRequestsRequest.from_dict(obj.get("PermissionsPendingRequestsRequest")) + permissions_reset_session_approvals_request = PermissionsResetSessionApprovalsRequest.from_dict(obj.get("PermissionsResetSessionApprovalsRequest")) + permissions_reset_session_approvals_result = PermissionsResetSessionApprovalsResult.from_dict(obj.get("PermissionsResetSessionApprovalsResult")) + permissions_set_approve_all_request = PermissionsSetApproveAllRequest.from_dict(obj.get("PermissionsSetApproveAllRequest")) + permissions_set_approve_all_result = PermissionsSetApproveAllResult.from_dict(obj.get("PermissionsSetApproveAllResult")) + permissions_set_approve_all_source = PermissionsSetApproveAllSource(obj.get("PermissionsSetApproveAllSource")) + permissions_set_required_request = PermissionsSetRequiredRequest.from_dict(obj.get("PermissionsSetRequiredRequest")) + permissions_set_required_result = PermissionsSetRequiredResult.from_dict(obj.get("PermissionsSetRequiredResult")) + permissions_urls_set_unrestricted_mode_result = PermissionsUrlsSetUnrestrictedModeResult.from_dict(obj.get("PermissionsUrlsSetUnrestrictedModeResult")) permission_urls_config = PermissionUrlsConfig.from_dict(obj.get("PermissionUrlsConfig")) - permission_urls_set_unrestricted_mode_params = ( - PermissionUrlsSetUnrestrictedModeParams.from_dict( - obj.get("PermissionUrlsSetUnrestrictedModeParams") - ) - ) + permission_urls_set_unrestricted_mode_params = PermissionUrlsSetUnrestrictedModeParams.from_dict(obj.get("PermissionUrlsSetUnrestrictedModeParams")) ping_request = PingRequest.from_dict(obj.get("PingRequest")) ping_result = PingResult.from_dict(obj.get("PingResult")) plan_read_result = PlanReadResult.from_dict(obj.get("PlanReadResult")) @@ -18236,286 +15681,127 @@ def from_dict(obj: Any) -> "RPC": plugin = Plugin.from_dict(obj.get("Plugin")) plugin_list = PluginList.from_dict(obj.get("PluginList")) queued_command_handled = QueuedCommandHandled.from_dict(obj.get("QueuedCommandHandled")) - queued_command_not_handled = QueuedCommandNotHandled.from_dict( - obj.get("QueuedCommandNotHandled") - ) + queued_command_not_handled = QueuedCommandNotHandled.from_dict(obj.get("QueuedCommandNotHandled")) queued_command_result = _load_QueuedCommandResult(obj.get("QueuedCommandResult")) queue_pending_items = QueuePendingItems.from_dict(obj.get("QueuePendingItems")) queue_pending_items_kind = QueuePendingItemsKind(obj.get("QueuePendingItemsKind")) - queue_pending_items_result = QueuePendingItemsResult.from_dict( - obj.get("QueuePendingItemsResult") - ) - queue_remove_most_recent_result = QueueRemoveMostRecentResult.from_dict( - obj.get("QueueRemoveMostRecentResult") - ) - register_event_interest_params = RegisterEventInterestParams.from_dict( - obj.get("RegisterEventInterestParams") - ) - register_event_interest_result = RegisterEventInterestResult.from_dict( - obj.get("RegisterEventInterestResult") - ) - release_event_interest_params = ReleaseEventInterestParams.from_dict( - obj.get("ReleaseEventInterestParams") - ) + queue_pending_items_result = QueuePendingItemsResult.from_dict(obj.get("QueuePendingItemsResult")) + queue_remove_most_recent_result = QueueRemoveMostRecentResult.from_dict(obj.get("QueueRemoveMostRecentResult")) + register_event_interest_params = RegisterEventInterestParams.from_dict(obj.get("RegisterEventInterestParams")) + register_event_interest_result = RegisterEventInterestResult.from_dict(obj.get("RegisterEventInterestResult")) + release_event_interest_params = ReleaseEventInterestParams.from_dict(obj.get("ReleaseEventInterestParams")) remote_enable_request = RemoteEnableRequest.from_dict(obj.get("RemoteEnableRequest")) remote_enable_result = RemoteEnableResult.from_dict(obj.get("RemoteEnableResult")) - remote_notify_steerable_changed_request = RemoteNotifySteerableChangedRequest.from_dict( - obj.get("RemoteNotifySteerableChangedRequest") - ) - remote_notify_steerable_changed_result = RemoteNotifySteerableChangedResult.from_dict( - obj.get("RemoteNotifySteerableChangedResult") - ) - remote_session_connection_result = RemoteSessionConnectionResult.from_dict( - obj.get("RemoteSessionConnectionResult") - ) + remote_notify_steerable_changed_request = RemoteNotifySteerableChangedRequest.from_dict(obj.get("RemoteNotifySteerableChangedRequest")) + remote_notify_steerable_changed_result = RemoteNotifySteerableChangedResult.from_dict(obj.get("RemoteNotifySteerableChangedResult")) + remote_session_connection_result = RemoteSessionConnectionResult.from_dict(obj.get("RemoteSessionConnectionResult")) remote_session_mode = RemoteSessionMode(obj.get("RemoteSessionMode")) schedule_entry = ScheduleEntry.from_dict(obj.get("ScheduleEntry")) schedule_list = ScheduleList.from_dict(obj.get("ScheduleList")) schedule_stop_request = ScheduleStopRequest.from_dict(obj.get("ScheduleStopRequest")) schedule_stop_result = ScheduleStopResult.from_dict(obj.get("ScheduleStopResult")) - secrets_add_filter_values_request = SecretsAddFilterValuesRequest.from_dict( - obj.get("SecretsAddFilterValuesRequest") - ) - secrets_add_filter_values_result = SecretsAddFilterValuesResult.from_dict( - obj.get("SecretsAddFilterValuesResult") - ) + secrets_add_filter_values_request = SecretsAddFilterValuesRequest.from_dict(obj.get("SecretsAddFilterValuesRequest")) + secrets_add_filter_values_result = SecretsAddFilterValuesResult.from_dict(obj.get("SecretsAddFilterValuesResult")) send_agent_mode = SendAgentMode(obj.get("SendAgentMode")) send_attachment = _load_SendAttachment(obj.get("SendAttachment")) send_attachment_blob = SendAttachmentBlob.from_dict(obj.get("SendAttachmentBlob")) - send_attachment_directory = SendAttachmentDirectory.from_dict( - obj.get("SendAttachmentDirectory") - ) + send_attachment_directory = SendAttachmentDirectory.from_dict(obj.get("SendAttachmentDirectory")) send_attachment_file = SendAttachmentFile.from_dict(obj.get("SendAttachmentFile")) - send_attachment_file_line_range = SendAttachmentFileLineRange.from_dict( - obj.get("SendAttachmentFileLineRange") - ) - send_attachment_github_reference = SendAttachmentGithubReference.from_dict( - obj.get("SendAttachmentGithubReference") - ) - send_attachment_github_reference_type = SendAttachmentGithubReferenceTypeEnum( - obj.get("SendAttachmentGithubReferenceType") - ) - send_attachment_selection = SendAttachmentSelection.from_dict( - obj.get("SendAttachmentSelection") - ) - send_attachment_selection_details = SendAttachmentSelectionDetails.from_dict( - obj.get("SendAttachmentSelectionDetails") - ) - send_attachment_selection_details_end = SendAttachmentSelectionDetailsEnd.from_dict( - obj.get("SendAttachmentSelectionDetailsEnd") - ) - send_attachment_selection_details_start = SendAttachmentSelectionDetailsStart.from_dict( - obj.get("SendAttachmentSelectionDetailsStart") - ) + send_attachment_file_line_range = SendAttachmentFileLineRange.from_dict(obj.get("SendAttachmentFileLineRange")) + send_attachment_github_reference = SendAttachmentGithubReference.from_dict(obj.get("SendAttachmentGithubReference")) + send_attachment_github_reference_type = SendAttachmentGithubReferenceTypeEnum(obj.get("SendAttachmentGithubReferenceType")) + send_attachment_selection = SendAttachmentSelection.from_dict(obj.get("SendAttachmentSelection")) + send_attachment_selection_details = SendAttachmentSelectionDetails.from_dict(obj.get("SendAttachmentSelectionDetails")) + send_attachment_selection_details_end = SendAttachmentSelectionDetailsEnd.from_dict(obj.get("SendAttachmentSelectionDetailsEnd")) + send_attachment_selection_details_start = SendAttachmentSelectionDetailsStart.from_dict(obj.get("SendAttachmentSelectionDetailsStart")) send_mode = SendMode(obj.get("SendMode")) send_request = SendRequest.from_dict(obj.get("SendRequest")) send_result = SendResult.from_dict(obj.get("SendResult")) server_skill = ServerSkill.from_dict(obj.get("ServerSkill")) server_skill_list = ServerSkillList.from_dict(obj.get("ServerSkillList")) session_auth_status = SessionAuthStatus.from_dict(obj.get("SessionAuthStatus")) - session_bulk_delete_result = SessionBulkDeleteResult.from_dict( - obj.get("SessionBulkDeleteResult") - ) + session_bulk_delete_result = SessionBulkDeleteResult.from_dict(obj.get("SessionBulkDeleteResult")) session_context = SessionContext.from_dict(obj.get("SessionContext")) session_context_host_type = HostType(obj.get("SessionContextHostType")) - session_enrich_metadata_result = SessionEnrichMetadataResult.from_dict( - obj.get("SessionEnrichMetadataResult") - ) - session_fs_append_file_request = SessionFSAppendFileRequest.from_dict( - obj.get("SessionFsAppendFileRequest") - ) + session_enrich_metadata_result = SessionEnrichMetadataResult.from_dict(obj.get("SessionEnrichMetadataResult")) + session_fs_append_file_request = SessionFSAppendFileRequest.from_dict(obj.get("SessionFsAppendFileRequest")) session_fs_error = SessionFSError.from_dict(obj.get("SessionFsError")) session_fs_error_code = SessionFSErrorCode(obj.get("SessionFsErrorCode")) - session_fs_exists_request = SessionFSExistsRequest.from_dict( - obj.get("SessionFsExistsRequest") - ) + session_fs_exists_request = SessionFSExistsRequest.from_dict(obj.get("SessionFsExistsRequest")) session_fs_exists_result = SessionFSExistsResult.from_dict(obj.get("SessionFsExistsResult")) session_fs_mkdir_request = SessionFSMkdirRequest.from_dict(obj.get("SessionFsMkdirRequest")) - session_fs_readdir_request = SessionFSReaddirRequest.from_dict( - obj.get("SessionFsReaddirRequest") - ) - session_fs_readdir_result = SessionFSReaddirResult.from_dict( - obj.get("SessionFsReaddirResult") - ) - session_fs_readdir_with_types_entry = SessionFSReaddirWithTypesEntry.from_dict( - obj.get("SessionFsReaddirWithTypesEntry") - ) - session_fs_readdir_with_types_entry_type = SessionFSReaddirWithTypesEntryType( - obj.get("SessionFsReaddirWithTypesEntryType") - ) - session_fs_readdir_with_types_request = SessionFSReaddirWithTypesRequest.from_dict( - obj.get("SessionFsReaddirWithTypesRequest") - ) - session_fs_readdir_with_types_result = SessionFSReaddirWithTypesResult.from_dict( - obj.get("SessionFsReaddirWithTypesResult") - ) - session_fs_read_file_request = SessionFSReadFileRequest.from_dict( - obj.get("SessionFsReadFileRequest") - ) - session_fs_read_file_result = SessionFSReadFileResult.from_dict( - obj.get("SessionFsReadFileResult") - ) - session_fs_rename_request = SessionFSRenameRequest.from_dict( - obj.get("SessionFsRenameRequest") - ) + session_fs_readdir_request = SessionFSReaddirRequest.from_dict(obj.get("SessionFsReaddirRequest")) + session_fs_readdir_result = SessionFSReaddirResult.from_dict(obj.get("SessionFsReaddirResult")) + session_fs_readdir_with_types_entry = SessionFSReaddirWithTypesEntry.from_dict(obj.get("SessionFsReaddirWithTypesEntry")) + session_fs_readdir_with_types_entry_type = SessionFSReaddirWithTypesEntryType(obj.get("SessionFsReaddirWithTypesEntryType")) + session_fs_readdir_with_types_request = SessionFSReaddirWithTypesRequest.from_dict(obj.get("SessionFsReaddirWithTypesRequest")) + session_fs_readdir_with_types_result = SessionFSReaddirWithTypesResult.from_dict(obj.get("SessionFsReaddirWithTypesResult")) + session_fs_read_file_request = SessionFSReadFileRequest.from_dict(obj.get("SessionFsReadFileRequest")) + session_fs_read_file_result = SessionFSReadFileResult.from_dict(obj.get("SessionFsReadFileResult")) + session_fs_rename_request = SessionFSRenameRequest.from_dict(obj.get("SessionFsRenameRequest")) session_fs_rm_request = SessionFSRmRequest.from_dict(obj.get("SessionFsRmRequest")) - session_fs_set_provider_capabilities = SessionFSSetProviderCapabilities.from_dict( - obj.get("SessionFsSetProviderCapabilities") - ) - session_fs_set_provider_conventions = SessionFSSetProviderConventions( - obj.get("SessionFsSetProviderConventions") - ) - session_fs_set_provider_request = SessionFSSetProviderRequest.from_dict( - obj.get("SessionFsSetProviderRequest") - ) - session_fs_set_provider_result = SessionFSSetProviderResult.from_dict( - obj.get("SessionFsSetProviderResult") - ) - session_fs_sqlite_exists_request = SessionFSSqliteExistsRequest.from_dict( - obj.get("SessionFsSqliteExistsRequest") - ) - session_fs_sqlite_exists_result = SessionFSSqliteExistsResult.from_dict( - obj.get("SessionFsSqliteExistsResult") - ) - session_fs_sqlite_query_request = SessionFSSqliteQueryRequest.from_dict( - obj.get("SessionFsSqliteQueryRequest") - ) - session_fs_sqlite_query_result = SessionFSSqliteQueryResult.from_dict( - obj.get("SessionFsSqliteQueryResult") - ) + session_fs_set_provider_capabilities = SessionFSSetProviderCapabilities.from_dict(obj.get("SessionFsSetProviderCapabilities")) + session_fs_set_provider_conventions = SessionFSSetProviderConventions(obj.get("SessionFsSetProviderConventions")) + session_fs_set_provider_request = SessionFSSetProviderRequest.from_dict(obj.get("SessionFsSetProviderRequest")) + session_fs_set_provider_result = SessionFSSetProviderResult.from_dict(obj.get("SessionFsSetProviderResult")) + session_fs_sqlite_exists_request = SessionFSSqliteExistsRequest.from_dict(obj.get("SessionFsSqliteExistsRequest")) + session_fs_sqlite_exists_result = SessionFSSqliteExistsResult.from_dict(obj.get("SessionFsSqliteExistsResult")) + session_fs_sqlite_query_request = SessionFSSqliteQueryRequest.from_dict(obj.get("SessionFsSqliteQueryRequest")) + session_fs_sqlite_query_result = SessionFSSqliteQueryResult.from_dict(obj.get("SessionFsSqliteQueryResult")) session_fs_sqlite_query_type = SessionFSSqliteQueryType(obj.get("SessionFsSqliteQueryType")) session_fs_stat_request = SessionFSStatRequest.from_dict(obj.get("SessionFsStatRequest")) session_fs_stat_result = SessionFSStatResult.from_dict(obj.get("SessionFsStatResult")) - session_fs_write_file_request = SessionFSWriteFileRequest.from_dict( - obj.get("SessionFsWriteFileRequest") - ) - session_installed_plugin = SessionInstalledPlugin.from_dict( - obj.get("SessionInstalledPlugin") - ) - session_installed_plugin_source = from_union( - [SessionInstalledPluginSource.from_dict, from_str], - obj.get("SessionInstalledPluginSource"), - ) - session_installed_plugin_source_github = SessionInstalledPluginSourceGithub.from_dict( - obj.get("SessionInstalledPluginSourceGithub") - ) - session_installed_plugin_source_local = SessionInstalledPluginSourceLocal.from_dict( - obj.get("SessionInstalledPluginSourceLocal") - ) - session_installed_plugin_source_url = SessionInstalledPluginSourceURL.from_dict( - obj.get("SessionInstalledPluginSourceUrl") - ) + session_fs_write_file_request = SessionFSWriteFileRequest.from_dict(obj.get("SessionFsWriteFileRequest")) + session_installed_plugin = SessionInstalledPlugin.from_dict(obj.get("SessionInstalledPlugin")) + session_installed_plugin_source = from_union([SessionInstalledPluginSource.from_dict, from_str], obj.get("SessionInstalledPluginSource")) + session_installed_plugin_source_github = SessionInstalledPluginSourceGithub.from_dict(obj.get("SessionInstalledPluginSourceGithub")) + session_installed_plugin_source_local = SessionInstalledPluginSourceLocal.from_dict(obj.get("SessionInstalledPluginSourceLocal")) + session_installed_plugin_source_url = SessionInstalledPluginSourceURL.from_dict(obj.get("SessionInstalledPluginSourceUrl")) session_list = SessionList.from_dict(obj.get("SessionList")) session_list_filter = SessionListFilter.from_dict(obj.get("SessionListFilter")) - session_load_deferred_repo_hooks_result = SessionLoadDeferredRepoHooksResult.from_dict( - obj.get("SessionLoadDeferredRepoHooksResult") - ) + session_load_deferred_repo_hooks_result = SessionLoadDeferredRepoHooksResult.from_dict(obj.get("SessionLoadDeferredRepoHooksResult")) session_log_level = SessionLogLevel(obj.get("SessionLogLevel")) - session_mcp_apps_call_tool_result = from_dict( - lambda x: x, obj.get("SessionMcpAppsCallToolResult") - ) + session_mcp_apps_call_tool_result = from_dict(lambda x: x, obj.get("SessionMcpAppsCallToolResult")) session_metadata = SessionMetadata.from_dict(obj.get("SessionMetadata")) - session_metadata_snapshot = SessionMetadataSnapshot.from_dict( - obj.get("SessionMetadataSnapshot") - ) + session_metadata_snapshot = SessionMetadataSnapshot.from_dict(obj.get("SessionMetadataSnapshot")) session_mode = SessionMode(obj.get("SessionMode")) session_prune_result = SessionPruneResult.from_dict(obj.get("SessionPruneResult")) - sessions_bulk_delete_request = SessionsBulkDeleteRequest.from_dict( - obj.get("SessionsBulkDeleteRequest") - ) - sessions_check_in_use_request = SessionsCheckInUseRequest.from_dict( - obj.get("SessionsCheckInUseRequest") - ) - sessions_check_in_use_result = SessionsCheckInUseResult.from_dict( - obj.get("SessionsCheckInUseResult") - ) + sessions_bulk_delete_request = SessionsBulkDeleteRequest.from_dict(obj.get("SessionsBulkDeleteRequest")) + sessions_check_in_use_request = SessionsCheckInUseRequest.from_dict(obj.get("SessionsCheckInUseRequest")) + sessions_check_in_use_result = SessionsCheckInUseResult.from_dict(obj.get("SessionsCheckInUseResult")) sessions_close_request = SessionsCloseRequest.from_dict(obj.get("SessionsCloseRequest")) sessions_close_result = SessionsCloseResult.from_dict(obj.get("SessionsCloseResult")) - sessions_enrich_metadata_request = SessionsEnrichMetadataRequest.from_dict( - obj.get("SessionsEnrichMetadataRequest") - ) - session_set_credentials_params = SessionSetCredentialsParams.from_dict( - obj.get("SessionSetCredentialsParams") - ) - session_set_credentials_result = SessionSetCredentialsResult.from_dict( - obj.get("SessionSetCredentialsResult") - ) - sessions_find_by_prefix_request = SessionsFindByPrefixRequest.from_dict( - obj.get("SessionsFindByPrefixRequest") - ) - sessions_find_by_prefix_result = SessionsFindByPrefixResult.from_dict( - obj.get("SessionsFindByPrefixResult") - ) - sessions_find_by_task_id_request = SessionsFindByTaskIDRequest.from_dict( - obj.get("SessionsFindByTaskIDRequest") - ) - sessions_find_by_task_id_result = SessionsFindByTaskIDResult.from_dict( - obj.get("SessionsFindByTaskIDResult") - ) + sessions_enrich_metadata_request = SessionsEnrichMetadataRequest.from_dict(obj.get("SessionsEnrichMetadataRequest")) + session_set_credentials_params = SessionSetCredentialsParams.from_dict(obj.get("SessionSetCredentialsParams")) + session_set_credentials_result = SessionSetCredentialsResult.from_dict(obj.get("SessionSetCredentialsResult")) + sessions_find_by_prefix_request = SessionsFindByPrefixRequest.from_dict(obj.get("SessionsFindByPrefixRequest")) + sessions_find_by_prefix_result = SessionsFindByPrefixResult.from_dict(obj.get("SessionsFindByPrefixResult")) + sessions_find_by_task_id_request = SessionsFindByTaskIDRequest.from_dict(obj.get("SessionsFindByTaskIDRequest")) + sessions_find_by_task_id_result = SessionsFindByTaskIDResult.from_dict(obj.get("SessionsFindByTaskIDResult")) sessions_fork_request = SessionsForkRequest.from_dict(obj.get("SessionsForkRequest")) sessions_fork_result = SessionsForkResult.from_dict(obj.get("SessionsForkResult")) - sessions_get_event_file_path_request = SessionsGetEventFilePathRequest.from_dict( - obj.get("SessionsGetEventFilePathRequest") - ) - sessions_get_event_file_path_result = SessionsGetEventFilePathResult.from_dict( - obj.get("SessionsGetEventFilePathResult") - ) - sessions_get_last_for_context_request = SessionsGetLastForContextRequest.from_dict( - obj.get("SessionsGetLastForContextRequest") - ) - sessions_get_last_for_context_result = SessionsGetLastForContextResult.from_dict( - obj.get("SessionsGetLastForContextResult") - ) - sessions_get_persisted_remote_steerable_request = ( - SessionsGetPersistedRemoteSteerableRequest.from_dict( - obj.get("SessionsGetPersistedRemoteSteerableRequest") - ) - ) - sessions_get_persisted_remote_steerable_result = ( - SessionsGetPersistedRemoteSteerableResult.from_dict( - obj.get("SessionsGetPersistedRemoteSteerableResult") - ) - ) + sessions_get_event_file_path_request = SessionsGetEventFilePathRequest.from_dict(obj.get("SessionsGetEventFilePathRequest")) + sessions_get_event_file_path_result = SessionsGetEventFilePathResult.from_dict(obj.get("SessionsGetEventFilePathResult")) + sessions_get_last_for_context_request = SessionsGetLastForContextRequest.from_dict(obj.get("SessionsGetLastForContextRequest")) + sessions_get_last_for_context_result = SessionsGetLastForContextResult.from_dict(obj.get("SessionsGetLastForContextResult")) + sessions_get_persisted_remote_steerable_request = SessionsGetPersistedRemoteSteerableRequest.from_dict(obj.get("SessionsGetPersistedRemoteSteerableRequest")) + sessions_get_persisted_remote_steerable_result = SessionsGetPersistedRemoteSteerableResult.from_dict(obj.get("SessionsGetPersistedRemoteSteerableResult")) session_sizes = SessionSizes.from_dict(obj.get("SessionSizes")) sessions_list_request = SessionsListRequest.from_dict(obj.get("SessionsListRequest")) - sessions_load_deferred_repo_hooks_request = SessionsLoadDeferredRepoHooksRequest.from_dict( - obj.get("SessionsLoadDeferredRepoHooksRequest") - ) - sessions_prune_old_request = SessionsPruneOldRequest.from_dict( - obj.get("SessionsPruneOldRequest") - ) - sessions_release_lock_request = SessionsReleaseLockRequest.from_dict( - obj.get("SessionsReleaseLockRequest") - ) - sessions_release_lock_result = SessionsReleaseLockResult.from_dict( - obj.get("SessionsReleaseLockResult") - ) - sessions_reload_plugin_hooks_request = SessionsReloadPluginHooksRequest.from_dict( - obj.get("SessionsReloadPluginHooksRequest") - ) - sessions_reload_plugin_hooks_result = SessionsReloadPluginHooksResult.from_dict( - obj.get("SessionsReloadPluginHooksResult") - ) + sessions_load_deferred_repo_hooks_request = SessionsLoadDeferredRepoHooksRequest.from_dict(obj.get("SessionsLoadDeferredRepoHooksRequest")) + sessions_prune_old_request = SessionsPruneOldRequest.from_dict(obj.get("SessionsPruneOldRequest")) + sessions_release_lock_request = SessionsReleaseLockRequest.from_dict(obj.get("SessionsReleaseLockRequest")) + sessions_release_lock_result = SessionsReleaseLockResult.from_dict(obj.get("SessionsReleaseLockResult")) + sessions_reload_plugin_hooks_request = SessionsReloadPluginHooksRequest.from_dict(obj.get("SessionsReloadPluginHooksRequest")) + sessions_reload_plugin_hooks_result = SessionsReloadPluginHooksResult.from_dict(obj.get("SessionsReloadPluginHooksResult")) sessions_save_request = SessionsSaveRequest.from_dict(obj.get("SessionsSaveRequest")) sessions_save_result = SessionsSaveResult.from_dict(obj.get("SessionsSaveResult")) - sessions_set_additional_plugins_request = SessionsSetAdditionalPluginsRequest.from_dict( - obj.get("SessionsSetAdditionalPluginsRequest") - ) - sessions_set_additional_plugins_result = SessionsSetAdditionalPluginsResult.from_dict( - obj.get("SessionsSetAdditionalPluginsResult") - ) - session_update_options_params = SessionUpdateOptionsParams.from_dict( - obj.get("SessionUpdateOptionsParams") - ) - session_update_options_result = SessionUpdateOptionsResult.from_dict( - obj.get("SessionUpdateOptionsResult") - ) - session_working_directory_context = SessionWorkingDirectoryContext.from_dict( - obj.get("SessionWorkingDirectoryContext") - ) - session_working_directory_context_host_type = HostType( - obj.get("SessionWorkingDirectoryContextHostType") - ) + sessions_set_additional_plugins_request = SessionsSetAdditionalPluginsRequest.from_dict(obj.get("SessionsSetAdditionalPluginsRequest")) + sessions_set_additional_plugins_result = SessionsSetAdditionalPluginsResult.from_dict(obj.get("SessionsSetAdditionalPluginsResult")) + session_update_options_params = SessionUpdateOptionsParams.from_dict(obj.get("SessionUpdateOptionsParams")) + session_update_options_result = SessionUpdateOptionsResult.from_dict(obj.get("SessionUpdateOptionsResult")) + session_working_directory_context = SessionWorkingDirectoryContext.from_dict(obj.get("SessionWorkingDirectoryContext")) + session_working_directory_context_host_type = HostType(obj.get("SessionWorkingDirectoryContextHostType")) shell_exec_request = ShellExecRequest.from_dict(obj.get("ShellExecRequest")) shell_exec_result = ShellExecResult.from_dict(obj.get("ShellExecResult")) shell_kill_request = ShellKillRequest.from_dict(obj.get("ShellKillRequest")) @@ -18524,41 +15810,23 @@ def from_dict(obj: Any) -> "RPC": shutdown_request = ShutdownRequest.from_dict(obj.get("ShutdownRequest")) skill = Skill.from_dict(obj.get("Skill")) skill_list = SkillList.from_dict(obj.get("SkillList")) - skills_config_set_disabled_skills_request = SkillsConfigSetDisabledSkillsRequest.from_dict( - obj.get("SkillsConfigSetDisabledSkillsRequest") - ) + skills_config_set_disabled_skills_request = SkillsConfigSetDisabledSkillsRequest.from_dict(obj.get("SkillsConfigSetDisabledSkillsRequest")) skills_disable_request = SkillsDisableRequest.from_dict(obj.get("SkillsDisableRequest")) skills_discover_request = SkillsDiscoverRequest.from_dict(obj.get("SkillsDiscoverRequest")) skills_enable_request = SkillsEnableRequest.from_dict(obj.get("SkillsEnableRequest")) - skills_get_invoked_result = SkillsGetInvokedResult.from_dict( - obj.get("SkillsGetInvokedResult") - ) + skills_get_invoked_result = SkillsGetInvokedResult.from_dict(obj.get("SkillsGetInvokedResult")) skills_invoked_skill = SkillsInvokedSkill.from_dict(obj.get("SkillsInvokedSkill")) skills_load_diagnostics = SkillsLoadDiagnostics.from_dict(obj.get("SkillsLoadDiagnostics")) - slash_command_agent_prompt_result = SlashCommandAgentPromptResult.from_dict( - obj.get("SlashCommandAgentPromptResult") - ) - slash_command_completed_result = SlashCommandCompletedResult.from_dict( - obj.get("SlashCommandCompletedResult") - ) + slash_command_agent_prompt_result = SlashCommandAgentPromptResult.from_dict(obj.get("SlashCommandAgentPromptResult")) + slash_command_completed_result = SlashCommandCompletedResult.from_dict(obj.get("SlashCommandCompletedResult")) slash_command_info = SlashCommandInfo.from_dict(obj.get("SlashCommandInfo")) slash_command_input = SlashCommandInput.from_dict(obj.get("SlashCommandInput")) - slash_command_input_completion = SlashCommandInputCompletion( - obj.get("SlashCommandInputCompletion") - ) - slash_command_invocation_result = _load_SlashCommandInvocationResult( - obj.get("SlashCommandInvocationResult") - ) + slash_command_input_completion = SlashCommandInputCompletion(obj.get("SlashCommandInputCompletion")) + slash_command_invocation_result = _load_SlashCommandInvocationResult(obj.get("SlashCommandInvocationResult")) slash_command_kind = SlashCommandKind(obj.get("SlashCommandKind")) - slash_command_select_subcommand_option = SlashCommandSelectSubcommandOption.from_dict( - obj.get("SlashCommandSelectSubcommandOption") - ) - slash_command_select_subcommand_result = SlashCommandSelectSubcommandResult.from_dict( - obj.get("SlashCommandSelectSubcommandResult") - ) - slash_command_text_result = SlashCommandTextResult.from_dict( - obj.get("SlashCommandTextResult") - ) + slash_command_select_subcommand_option = SlashCommandSelectSubcommandOption.from_dict(obj.get("SlashCommandSelectSubcommandOption")) + slash_command_select_subcommand_result = SlashCommandSelectSubcommandResult.from_dict(obj.get("SlashCommandSelectSubcommandResult")) + slash_command_text_result = SlashCommandTextResult.from_dict(obj.get("SlashCommandTextResult")) task_agent_info = TaskAgentInfo.from_dict(obj.get("TaskAgentInfo")) task_agent_progress = TaskAgentProgress.from_dict(obj.get("TaskAgentProgress")) task_execution_mode = TaskExecutionMode(obj.get("TaskExecutionMode")) @@ -18567,800 +15835,104 @@ def from_dict(obj: Any) -> "RPC": task_progress_line = TaskProgressLine.from_dict(obj.get("TaskProgressLine")) tasks_cancel_request = TasksCancelRequest.from_dict(obj.get("TasksCancelRequest")) tasks_cancel_result = TasksCancelResult.from_dict(obj.get("TasksCancelResult")) - tasks_get_current_promotable_result = TasksGetCurrentPromotableResult.from_dict( - obj.get("TasksGetCurrentPromotableResult") - ) - tasks_get_progress_request = TasksGetProgressRequest.from_dict( - obj.get("TasksGetProgressRequest") - ) - tasks_get_progress_result = TasksGetProgressResult.from_dict( - obj.get("TasksGetProgressResult") - ) + tasks_get_current_promotable_result = TasksGetCurrentPromotableResult.from_dict(obj.get("TasksGetCurrentPromotableResult")) + tasks_get_progress_request = TasksGetProgressRequest.from_dict(obj.get("TasksGetProgressRequest")) + tasks_get_progress_result = TasksGetProgressResult.from_dict(obj.get("TasksGetProgressResult")) task_shell_info = TaskShellInfo.from_dict(obj.get("TaskShellInfo")) - task_shell_info_attachment_mode = TaskShellInfoAttachmentMode( - obj.get("TaskShellInfoAttachmentMode") - ) + task_shell_info_attachment_mode = TaskShellInfoAttachmentMode(obj.get("TaskShellInfoAttachmentMode")) task_shell_progress = TaskShellProgress.from_dict(obj.get("TaskShellProgress")) - tasks_promote_current_to_background_result = ( - TasksPromoteCurrentToBackgroundResult.from_dict( - obj.get("TasksPromoteCurrentToBackgroundResult") - ) - ) - tasks_promote_to_background_request = TasksPromoteToBackgroundRequest.from_dict( - obj.get("TasksPromoteToBackgroundRequest") - ) - tasks_promote_to_background_result = TasksPromoteToBackgroundResult.from_dict( - obj.get("TasksPromoteToBackgroundResult") - ) + tasks_promote_current_to_background_result = TasksPromoteCurrentToBackgroundResult.from_dict(obj.get("TasksPromoteCurrentToBackgroundResult")) + tasks_promote_to_background_request = TasksPromoteToBackgroundRequest.from_dict(obj.get("TasksPromoteToBackgroundRequest")) + tasks_promote_to_background_result = TasksPromoteToBackgroundResult.from_dict(obj.get("TasksPromoteToBackgroundResult")) tasks_refresh_result = TasksRefreshResult.from_dict(obj.get("TasksRefreshResult")) tasks_remove_request = TasksRemoveRequest.from_dict(obj.get("TasksRemoveRequest")) tasks_remove_result = TasksRemoveResult.from_dict(obj.get("TasksRemoveResult")) - tasks_send_message_request = TasksSendMessageRequest.from_dict( - obj.get("TasksSendMessageRequest") - ) - tasks_send_message_result = TasksSendMessageResult.from_dict( - obj.get("TasksSendMessageResult") - ) - tasks_start_agent_request = TasksStartAgentRequest.from_dict( - obj.get("TasksStartAgentRequest") - ) + tasks_send_message_request = TasksSendMessageRequest.from_dict(obj.get("TasksSendMessageRequest")) + tasks_send_message_result = TasksSendMessageResult.from_dict(obj.get("TasksSendMessageResult")) + tasks_start_agent_request = TasksStartAgentRequest.from_dict(obj.get("TasksStartAgentRequest")) tasks_start_agent_result = TasksStartAgentResult.from_dict(obj.get("TasksStartAgentResult")) task_status = TaskStatus(obj.get("TaskStatus")) - tasks_wait_for_pending_result = TasksWaitForPendingResult.from_dict( - obj.get("TasksWaitForPendingResult") - ) - telemetry_set_feature_overrides_request = TelemetrySetFeatureOverridesRequest.from_dict( - obj.get("TelemetrySetFeatureOverridesRequest") - ) + tasks_wait_for_pending_result = TasksWaitForPendingResult.from_dict(obj.get("TasksWaitForPendingResult")) + telemetry_set_feature_overrides_request = TelemetrySetFeatureOverridesRequest.from_dict(obj.get("TelemetrySetFeatureOverridesRequest")) token_auth_info = TokenAuthInfo.from_dict(obj.get("TokenAuthInfo")) tool = Tool.from_dict(obj.get("Tool")) tool_list = ToolList.from_dict(obj.get("ToolList")) - tools_initialize_and_validate_result = ToolsInitializeAndValidateResult.from_dict( - obj.get("ToolsInitializeAndValidateResult") - ) + tools_initialize_and_validate_result = ToolsInitializeAndValidateResult.from_dict(obj.get("ToolsInitializeAndValidateResult")) tools_list_request = ToolsListRequest.from_dict(obj.get("ToolsListRequest")) ui_auto_mode_switch_response = UIAutoModeSwitchResponse(obj.get("UIAutoModeSwitchResponse")) - ui_elicitation_array_any_of_field = UIElicitationArrayAnyOfField.from_dict( - obj.get("UIElicitationArrayAnyOfField") - ) - ui_elicitation_array_any_of_field_items = UIElicitationArrayAnyOfFieldItems.from_dict( - obj.get("UIElicitationArrayAnyOfFieldItems") - ) - ui_elicitation_array_any_of_field_items_any_of = ( - UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict( - obj.get("UIElicitationArrayAnyOfFieldItemsAnyOf") - ) - ) - ui_elicitation_array_enum_field = UIElicitationArrayEnumField.from_dict( - obj.get("UIElicitationArrayEnumField") - ) - ui_elicitation_array_enum_field_items = UIElicitationArrayEnumFieldItems.from_dict( - obj.get("UIElicitationArrayEnumFieldItems") - ) - ui_elicitation_field_value = from_union( - [from_float, from_bool, lambda x: from_list(from_str, x), from_str], - obj.get("UIElicitationFieldValue"), - ) + ui_elicitation_array_any_of_field = UIElicitationArrayAnyOfField.from_dict(obj.get("UIElicitationArrayAnyOfField")) + ui_elicitation_array_any_of_field_items = UIElicitationArrayAnyOfFieldItems.from_dict(obj.get("UIElicitationArrayAnyOfFieldItems")) + ui_elicitation_array_any_of_field_items_any_of = UIElicitationArrayAnyOfFieldItemsAnyOf.from_dict(obj.get("UIElicitationArrayAnyOfFieldItemsAnyOf")) + ui_elicitation_array_enum_field = UIElicitationArrayEnumField.from_dict(obj.get("UIElicitationArrayEnumField")) + ui_elicitation_array_enum_field_items = UIElicitationArrayEnumFieldItems.from_dict(obj.get("UIElicitationArrayEnumFieldItems")) + ui_elicitation_field_value = from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], obj.get("UIElicitationFieldValue")) ui_elicitation_request = UIElicitationRequest.from_dict(obj.get("UIElicitationRequest")) ui_elicitation_response = UIElicitationResponse.from_dict(obj.get("UIElicitationResponse")) - ui_elicitation_response_action = UIElicitationResponseAction( - obj.get("UIElicitationResponseAction") - ) - ui_elicitation_response_content = from_dict( - lambda x: from_union( - [from_float, from_bool, lambda x: from_list(from_str, x), from_str], x - ), - obj.get("UIElicitationResponseContent"), - ) + ui_elicitation_response_action = UIElicitationResponseAction(obj.get("UIElicitationResponseAction")) + ui_elicitation_response_content = from_dict(lambda x: from_union([from_float, from_bool, lambda x: from_list(from_str, x), from_str], x), obj.get("UIElicitationResponseContent")) ui_elicitation_result = UIElicitationResult.from_dict(obj.get("UIElicitationResult")) ui_elicitation_schema = UIElicitationSchema.from_dict(obj.get("UIElicitationSchema")) - ui_elicitation_schema_property = UIElicitationSchemaProperty.from_dict( - obj.get("UIElicitationSchemaProperty") - ) - ui_elicitation_schema_property_boolean = UIElicitationSchemaPropertyBoolean.from_dict( - obj.get("UIElicitationSchemaPropertyBoolean") - ) - ui_elicitation_schema_property_number = UIElicitationSchemaPropertyNumber.from_dict( - obj.get("UIElicitationSchemaPropertyNumber") - ) - ui_elicitation_schema_property_number_type = UIElicitationSchemaPropertyNumberType( - obj.get("UIElicitationSchemaPropertyNumberType") - ) - ui_elicitation_schema_property_string = UIElicitationSchemaPropertyString.from_dict( - obj.get("UIElicitationSchemaPropertyString") - ) - ui_elicitation_schema_property_string_format = UIElicitationSchemaPropertyStringFormat( - obj.get("UIElicitationSchemaPropertyStringFormat") - ) - ui_elicitation_string_enum_field = UIElicitationStringEnumField.from_dict( - obj.get("UIElicitationStringEnumField") - ) - ui_elicitation_string_one_of_field = UIElicitationStringOneOfField.from_dict( - obj.get("UIElicitationStringOneOfField") - ) - ui_elicitation_string_one_of_field_one_of = UIElicitationStringOneOfFieldOneOf.from_dict( - obj.get("UIElicitationStringOneOfFieldOneOf") - ) + ui_elicitation_schema_property = UIElicitationSchemaProperty.from_dict(obj.get("UIElicitationSchemaProperty")) + ui_elicitation_schema_property_boolean = UIElicitationSchemaPropertyBoolean.from_dict(obj.get("UIElicitationSchemaPropertyBoolean")) + ui_elicitation_schema_property_number = UIElicitationSchemaPropertyNumber.from_dict(obj.get("UIElicitationSchemaPropertyNumber")) + ui_elicitation_schema_property_number_type = UIElicitationSchemaPropertyNumberType(obj.get("UIElicitationSchemaPropertyNumberType")) + ui_elicitation_schema_property_string = UIElicitationSchemaPropertyString.from_dict(obj.get("UIElicitationSchemaPropertyString")) + ui_elicitation_schema_property_string_format = UIElicitationSchemaPropertyStringFormat(obj.get("UIElicitationSchemaPropertyStringFormat")) + ui_elicitation_string_enum_field = UIElicitationStringEnumField.from_dict(obj.get("UIElicitationStringEnumField")) + ui_elicitation_string_one_of_field = UIElicitationStringOneOfField.from_dict(obj.get("UIElicitationStringOneOfField")) + ui_elicitation_string_one_of_field_one_of = UIElicitationStringOneOfFieldOneOf.from_dict(obj.get("UIElicitationStringOneOfFieldOneOf")) ui_exit_plan_mode_action = UIExitPlanModeAction(obj.get("UIExitPlanModeAction")) - ui_exit_plan_mode_response = UIExitPlanModeResponse.from_dict( - obj.get("UIExitPlanModeResponse") - ) - ui_handle_pending_auto_mode_switch_request = UIHandlePendingAutoModeSwitchRequest.from_dict( - obj.get("UIHandlePendingAutoModeSwitchRequest") - ) - ui_handle_pending_elicitation_request = UIHandlePendingElicitationRequest.from_dict( - obj.get("UIHandlePendingElicitationRequest") - ) - ui_handle_pending_exit_plan_mode_request = UIHandlePendingExitPlanModeRequest.from_dict( - obj.get("UIHandlePendingExitPlanModeRequest") - ) + ui_exit_plan_mode_response = UIExitPlanModeResponse.from_dict(obj.get("UIExitPlanModeResponse")) + ui_handle_pending_auto_mode_switch_request = UIHandlePendingAutoModeSwitchRequest.from_dict(obj.get("UIHandlePendingAutoModeSwitchRequest")) + ui_handle_pending_elicitation_request = UIHandlePendingElicitationRequest.from_dict(obj.get("UIHandlePendingElicitationRequest")) + ui_handle_pending_exit_plan_mode_request = UIHandlePendingExitPlanModeRequest.from_dict(obj.get("UIHandlePendingExitPlanModeRequest")) ui_handle_pending_result = UIHandlePendingResult.from_dict(obj.get("UIHandlePendingResult")) - ui_handle_pending_sampling_request = UIHandlePendingSamplingRequest.from_dict( - obj.get("UIHandlePendingSamplingRequest") - ) - ui_handle_pending_sampling_response = from_dict( - lambda x: x, obj.get("UIHandlePendingSamplingResponse") - ) - ui_handle_pending_user_input_request = UIHandlePendingUserInputRequest.from_dict( - obj.get("UIHandlePendingUserInputRequest") - ) - ui_register_direct_auto_mode_switch_handler_result = ( - UIRegisterDirectAutoModeSwitchHandlerResult.from_dict( - obj.get("UIRegisterDirectAutoModeSwitchHandlerResult") - ) - ) - ui_unregister_direct_auto_mode_switch_handler_request = ( - UIUnregisterDirectAutoModeSwitchHandlerRequest.from_dict( - obj.get("UIUnregisterDirectAutoModeSwitchHandlerRequest") - ) - ) - ui_unregister_direct_auto_mode_switch_handler_result = ( - UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict( - obj.get("UIUnregisterDirectAutoModeSwitchHandlerResult") - ) - ) + ui_handle_pending_sampling_request = UIHandlePendingSamplingRequest.from_dict(obj.get("UIHandlePendingSamplingRequest")) + ui_handle_pending_sampling_response = from_dict(lambda x: x, obj.get("UIHandlePendingSamplingResponse")) + ui_handle_pending_user_input_request = UIHandlePendingUserInputRequest.from_dict(obj.get("UIHandlePendingUserInputRequest")) + ui_register_direct_auto_mode_switch_handler_result = UIRegisterDirectAutoModeSwitchHandlerResult.from_dict(obj.get("UIRegisterDirectAutoModeSwitchHandlerResult")) + ui_unregister_direct_auto_mode_switch_handler_request = UIUnregisterDirectAutoModeSwitchHandlerRequest.from_dict(obj.get("UIUnregisterDirectAutoModeSwitchHandlerRequest")) + ui_unregister_direct_auto_mode_switch_handler_result = UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict(obj.get("UIUnregisterDirectAutoModeSwitchHandlerResult")) ui_user_input_response = UIUserInputResponse.from_dict(obj.get("UIUserInputResponse")) usage_get_metrics_result = UsageGetMetricsResult.from_dict(obj.get("UsageGetMetricsResult")) - usage_metrics_code_changes = UsageMetricsCodeChanges.from_dict( - obj.get("UsageMetricsCodeChanges") - ) - usage_metrics_model_metric = UsageMetricsModelMetric.from_dict( - obj.get("UsageMetricsModelMetric") - ) - usage_metrics_model_metric_requests = UsageMetricsModelMetricRequests.from_dict( - obj.get("UsageMetricsModelMetricRequests") - ) - usage_metrics_model_metric_token_detail = UsageMetricsModelMetricTokenDetail.from_dict( - obj.get("UsageMetricsModelMetricTokenDetail") - ) - usage_metrics_model_metric_usage = UsageMetricsModelMetricUsage.from_dict( - obj.get("UsageMetricsModelMetricUsage") - ) - usage_metrics_token_detail = UsageMetricsTokenDetail.from_dict( - obj.get("UsageMetricsTokenDetail") - ) + usage_metrics_code_changes = UsageMetricsCodeChanges.from_dict(obj.get("UsageMetricsCodeChanges")) + usage_metrics_model_metric = UsageMetricsModelMetric.from_dict(obj.get("UsageMetricsModelMetric")) + usage_metrics_model_metric_requests = UsageMetricsModelMetricRequests.from_dict(obj.get("UsageMetricsModelMetricRequests")) + usage_metrics_model_metric_token_detail = UsageMetricsModelMetricTokenDetail.from_dict(obj.get("UsageMetricsModelMetricTokenDetail")) + usage_metrics_model_metric_usage = UsageMetricsModelMetricUsage.from_dict(obj.get("UsageMetricsModelMetricUsage")) + usage_metrics_token_detail = UsageMetricsTokenDetail.from_dict(obj.get("UsageMetricsTokenDetail")) user_auth_info = UserAuthInfo.from_dict(obj.get("UserAuthInfo")) - workspace_diff_file_change = WorkspaceDiffFileChange.from_dict( - obj.get("WorkspaceDiffFileChange") - ) - workspace_diff_file_change_type = WorkspaceDiffFileChangeType( - obj.get("WorkspaceDiffFileChangeType") - ) + workspace_diff_file_change = WorkspaceDiffFileChange.from_dict(obj.get("WorkspaceDiffFileChange")) + workspace_diff_file_change_type = WorkspaceDiffFileChangeType(obj.get("WorkspaceDiffFileChangeType")) workspace_diff_mode = WorkspaceDiffMode(obj.get("WorkspaceDiffMode")) workspace_diff_result = WorkspaceDiffResult.from_dict(obj.get("WorkspaceDiffResult")) workspaces_checkpoints = WorkspacesCheckpoints.from_dict(obj.get("WorkspacesCheckpoints")) - workspaces_create_file_request = WorkspacesCreateFileRequest.from_dict( - obj.get("WorkspacesCreateFileRequest") - ) + workspaces_create_file_request = WorkspacesCreateFileRequest.from_dict(obj.get("WorkspacesCreateFileRequest")) workspaces_diff_request = WorkspacesDiffRequest.from_dict(obj.get("WorkspacesDiffRequest")) - workspaces_get_workspace_result = WorkspacesGetWorkspaceResult.from_dict( - obj.get("WorkspacesGetWorkspaceResult") - ) - workspaces_list_checkpoints_result = WorkspacesListCheckpointsResult.from_dict( - obj.get("WorkspacesListCheckpointsResult") - ) - workspaces_list_files_result = WorkspacesListFilesResult.from_dict( - obj.get("WorkspacesListFilesResult") - ) - workspaces_read_checkpoint_request = WorkspacesReadCheckpointRequest.from_dict( - obj.get("WorkspacesReadCheckpointRequest") - ) - workspaces_read_checkpoint_result = WorkspacesReadCheckpointResult.from_dict( - obj.get("WorkspacesReadCheckpointResult") - ) - workspaces_read_file_request = WorkspacesReadFileRequest.from_dict( - obj.get("WorkspacesReadFileRequest") - ) - workspaces_read_file_result = WorkspacesReadFileResult.from_dict( - obj.get("WorkspacesReadFileResult") - ) - workspaces_save_large_paste_request = WorkspacesSaveLargePasteRequest.from_dict( - obj.get("WorkspacesSaveLargePasteRequest") - ) - workspaces_save_large_paste_result = WorkspacesSaveLargePasteResult.from_dict( - obj.get("WorkspacesSaveLargePasteResult") - ) + workspaces_get_workspace_result = WorkspacesGetWorkspaceResult.from_dict(obj.get("WorkspacesGetWorkspaceResult")) + workspaces_list_checkpoints_result = WorkspacesListCheckpointsResult.from_dict(obj.get("WorkspacesListCheckpointsResult")) + workspaces_list_files_result = WorkspacesListFilesResult.from_dict(obj.get("WorkspacesListFilesResult")) + workspaces_read_checkpoint_request = WorkspacesReadCheckpointRequest.from_dict(obj.get("WorkspacesReadCheckpointRequest")) + workspaces_read_checkpoint_result = WorkspacesReadCheckpointResult.from_dict(obj.get("WorkspacesReadCheckpointResult")) + workspaces_read_file_request = WorkspacesReadFileRequest.from_dict(obj.get("WorkspacesReadFileRequest")) + workspaces_read_file_result = WorkspacesReadFileResult.from_dict(obj.get("WorkspacesReadFileResult")) + workspaces_save_large_paste_request = WorkspacesSaveLargePasteRequest.from_dict(obj.get("WorkspacesSaveLargePasteRequest")) + workspaces_save_large_paste_result = WorkspacesSaveLargePasteResult.from_dict(obj.get("WorkspacesSaveLargePasteResult")) workspace_summary_host_type = HostType(obj.get("WorkspaceSummaryHostType")) - workspaces_workspace_details_host_type = HostType( - obj.get("WorkspacesWorkspaceDetailsHostType") - ) - session_context_info = from_union( - [SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo") - ) + workspaces_workspace_details_host_type = HostType(obj.get("WorkspacesWorkspaceDetailsHostType")) + session_context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo")) task_progress = from_union([TaskProgress.from_dict, from_none], obj.get("TaskProgress")) - workspace_summary = from_union( - [WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary") - ) - return RPC( - abort_request, - abort_result, - account_get_quota_request, - account_get_quota_result, - account_quota_snapshot, - agent_get_current_result, - agent_info, - agent_info_source, - agent_list, - agent_reload_result, - agent_select_request, - agent_select_result, - api_key_auth_info, - auth_info, - auth_info_type, - canvas_action, - canvas_close_request, - canvas_host_context, - canvas_host_context_capabilities, - canvas_instance_availability, - canvas_invoke_action_request, - canvas_invoke_action_result, - canvas_json_schema, - canvas_list, - canvas_list_open_result, - canvas_open_request, - canvas_provider_close_request, - canvas_provider_invoke_action_request, - canvas_provider_open_request, - canvas_provider_open_result, - command_list, - commands_handle_pending_command_request, - commands_handle_pending_command_result, - commands_invoke_request, - commands_list_request, - commands_respond_to_queued_command_request, - commands_respond_to_queued_command_result, - connected_remote_session_metadata, - connected_remote_session_metadata_kind, - connected_remote_session_metadata_repository, - connect_remote_session_params, - connect_request, - connect_result, - content_filter_mode, - copilot_api_token_auth_info, - copilot_user_response, - copilot_user_response_endpoints, - copilot_user_response_quota_snapshots, - copilot_user_response_quota_snapshots_chat, - copilot_user_response_quota_snapshots_completions, - copilot_user_response_quota_snapshots_premium_interactions, - current_model, - discovered_canvas, - discovered_mcp_server, - discovered_mcp_server_type, - enqueue_command_params, - enqueue_command_result, - env_auth_info, - event_log_read_request, - event_log_release_interest_result, - event_log_tail_result, - event_log_types, - events_agent_scope, - events_cursor_status, - events_read_result, - execute_command_params, - execute_command_result, - extension, - extension_list, - extensions_disable_request, - extensions_enable_request, - extension_source, - extension_status, - external_tool_result, - external_tool_text_result_for_llm, - external_tool_text_result_for_llm_binary_results_for_llm, - external_tool_text_result_for_llm_binary_results_for_llm_type, - external_tool_text_result_for_llm_content, - external_tool_text_result_for_llm_content_audio, - external_tool_text_result_for_llm_content_image, - external_tool_text_result_for_llm_content_resource, - external_tool_text_result_for_llm_content_resource_details, - external_tool_text_result_for_llm_content_resource_link, - external_tool_text_result_for_llm_content_resource_link_icon, - external_tool_text_result_for_llm_content_resource_link_icon_theme, - external_tool_text_result_for_llm_content_terminal, - external_tool_text_result_for_llm_content_text, - filter_mapping, - fleet_start_request, - fleet_start_result, - folder_trust_add_params, - folder_trust_check_params, - folder_trust_check_result, - gh_cli_auth_info, - handle_pending_tool_call_request, - handle_pending_tool_call_result, - history_abort_manual_compaction_result, - history_cancel_background_compaction_result, - history_compact_context_window, - history_compact_request, - history_compact_result, - history_summarize_for_handoff_result, - history_truncate_request, - history_truncate_result, - hmac_auth_info, - installed_plugin, - installed_plugin_source, - installed_plugin_source_github, - installed_plugin_source_local, - installed_plugin_source_url, - instructions_get_sources_result, - instructions_sources, - instructions_sources_location, - instructions_sources_type, - log_request, - log_result, - lsp_initialize_request, - mcp_apps_call_tool_request, - mcp_apps_diagnose_capability, - mcp_apps_diagnose_request, - mcp_apps_diagnose_result, - mcp_apps_diagnose_server, - mcp_apps_host_context, - mcp_apps_host_context_details, - mcp_apps_host_context_details_available_display_mode, - mcp_apps_host_context_details_display_mode, - mcp_apps_host_context_details_platform, - mcp_apps_host_context_details_theme, - mcp_apps_list_tools_request, - mcp_apps_list_tools_result, - mcp_apps_read_resource_request, - mcp_apps_read_resource_result, - mcp_apps_resource_content, - mcp_apps_set_host_context_details, - mcp_apps_set_host_context_details_available_display_mode, - mcp_apps_set_host_context_details_display_mode, - mcp_apps_set_host_context_details_platform, - mcp_apps_set_host_context_details_theme, - mcp_apps_set_host_context_request, - mcp_cancel_sampling_execution_params, - mcp_cancel_sampling_execution_result, - mcp_config_add_request, - mcp_config_disable_request, - mcp_config_enable_request, - mcp_config_list, - mcp_config_remove_request, - mcp_config_update_request, - mcp_disable_request, - mcp_discover_request, - mcp_discover_result, - mcp_enable_request, - mcp_execute_sampling_params, - mcp_execute_sampling_request, - mcp_execute_sampling_result, - mcp_oauth_login_request, - mcp_oauth_login_result, - mcp_remove_git_hub_result, - mcp_sampling_execution_action, - mcp_sampling_execution_result, - mcp_server, - mcp_server_config, - mcp_server_config_http, - mcp_server_config_http_auth, - mcp_server_config_http_oauth_grant_type, - mcp_server_config_http_type, - mcp_server_config_stdio, - mcp_server_list, - mcp_set_env_value_mode_details, - mcp_set_env_value_mode_params, - mcp_set_env_value_mode_result, - metadata_context_info_request, - metadata_context_info_result, - metadata_is_processing_result, - metadata_recompute_context_tokens_request, - metadata_recompute_context_tokens_result, - metadata_record_context_change_request, - metadata_record_context_change_result, - metadata_set_working_directory_request, - metadata_set_working_directory_result, - metadata_snapshot_current_mode, - metadata_snapshot_remote_metadata, - metadata_snapshot_remote_metadata_repository, - metadata_snapshot_remote_metadata_task_type, - model, - model_billing, - model_billing_token_prices, - model_billing_token_prices_long_context, - model_capabilities, - model_capabilities_limits, - model_capabilities_limits_vision, - model_capabilities_override, - model_capabilities_override_limits, - model_capabilities_override_limits_vision, - model_capabilities_override_supports, - model_capabilities_supports, - model_list, - model_picker_category, - model_picker_price_category, - model_policy, - model_policy_state, - model_set_reasoning_effort_request, - model_set_reasoning_effort_result, - models_list_request, - model_switch_to_request, - model_switch_to_result, - mode_set_request, - name_get_result, - name_set_auto_request, - name_set_auto_result, - name_set_request, - open_canvas_instance, - options_update_env_value_mode, - pending_permission_request, - pending_permission_request_list, - permission_decision, - permission_decision_approved, - permission_decision_approved_for_location, - permission_decision_approved_for_session, - permission_decision_approve_for_location, - permission_decision_approve_for_location_approval, - permission_decision_approve_for_location_approval_commands, - permission_decision_approve_for_location_approval_custom_tool, - permission_decision_approve_for_location_approval_extension_management, - permission_decision_approve_for_location_approval_extension_permission_access, - permission_decision_approve_for_location_approval_mcp, - permission_decision_approve_for_location_approval_mcp_sampling, - permission_decision_approve_for_location_approval_memory, - permission_decision_approve_for_location_approval_read, - permission_decision_approve_for_location_approval_write, - permission_decision_approve_for_session, - permission_decision_approve_for_session_approval, - permission_decision_approve_for_session_approval_commands, - permission_decision_approve_for_session_approval_custom_tool, - permission_decision_approve_for_session_approval_extension_management, - permission_decision_approve_for_session_approval_extension_permission_access, - permission_decision_approve_for_session_approval_mcp, - permission_decision_approve_for_session_approval_mcp_sampling, - permission_decision_approve_for_session_approval_memory, - permission_decision_approve_for_session_approval_read, - permission_decision_approve_for_session_approval_write, - permission_decision_approve_once, - permission_decision_approve_permanently, - permission_decision_cancelled, - permission_decision_denied_by_content_exclusion_policy, - permission_decision_denied_by_permission_request_hook, - permission_decision_denied_by_rules, - permission_decision_denied_interactively_by_user, - permission_decision_denied_no_approval_rule_and_could_not_request_from_user, - permission_decision_reject, - permission_decision_request, - permission_decision_user_not_available, - permission_location_add_tool_approval_params, - permission_location_apply_params, - permission_location_apply_result, - permission_location_resolve_params, - permission_location_resolve_result, - permission_location_type, - permission_paths_add_params, - permission_paths_allowed_check_params, - permission_paths_allowed_check_result, - permission_paths_config, - permission_paths_list, - permission_paths_update_primary_params, - permission_paths_workspace_check_params, - permission_paths_workspace_check_result, - permission_prompt_shown_notification, - permission_request_result, - permission_rules_set, - permissions_configure_additional_content_exclusion_policy, - permissions_configure_additional_content_exclusion_policy_rule, - permissions_configure_additional_content_exclusion_policy_rule_source, - permissions_configure_additional_content_exclusion_policy_scope, - permissions_configure_params, - permissions_configure_result, - permissions_folder_trust_add_trusted_result, - permissions_locations_add_tool_approval_details, - permissions_locations_add_tool_approval_details_commands, - permissions_locations_add_tool_approval_details_custom_tool, - permissions_locations_add_tool_approval_details_extension_management, - permissions_locations_add_tool_approval_details_extension_permission_access, - permissions_locations_add_tool_approval_details_mcp, - permissions_locations_add_tool_approval_details_mcp_sampling, - permissions_locations_add_tool_approval_details_memory, - permissions_locations_add_tool_approval_details_read, - permissions_locations_add_tool_approval_details_write, - permissions_locations_add_tool_approval_result, - permissions_modify_rules_params, - permissions_modify_rules_result, - permissions_modify_rules_scope, - permissions_notify_prompt_shown_result, - permissions_paths_add_result, - permissions_paths_list_request, - permissions_paths_update_primary_result, - permissions_pending_requests_request, - permissions_reset_session_approvals_request, - permissions_reset_session_approvals_result, - permissions_set_approve_all_request, - permissions_set_approve_all_result, - permissions_set_approve_all_source, - permissions_set_required_request, - permissions_set_required_result, - permissions_urls_set_unrestricted_mode_result, - permission_urls_config, - permission_urls_set_unrestricted_mode_params, - ping_request, - ping_result, - plan_read_result, - plan_update_request, - plugin, - plugin_list, - queued_command_handled, - queued_command_not_handled, - queued_command_result, - queue_pending_items, - queue_pending_items_kind, - queue_pending_items_result, - queue_remove_most_recent_result, - register_event_interest_params, - register_event_interest_result, - release_event_interest_params, - remote_enable_request, - remote_enable_result, - remote_notify_steerable_changed_request, - remote_notify_steerable_changed_result, - remote_session_connection_result, - remote_session_mode, - schedule_entry, - schedule_list, - schedule_stop_request, - schedule_stop_result, - secrets_add_filter_values_request, - secrets_add_filter_values_result, - send_agent_mode, - send_attachment, - send_attachment_blob, - send_attachment_directory, - send_attachment_file, - send_attachment_file_line_range, - send_attachment_github_reference, - send_attachment_github_reference_type, - send_attachment_selection, - send_attachment_selection_details, - send_attachment_selection_details_end, - send_attachment_selection_details_start, - send_mode, - send_request, - send_result, - server_skill, - server_skill_list, - session_auth_status, - session_bulk_delete_result, - session_context, - session_context_host_type, - session_enrich_metadata_result, - session_fs_append_file_request, - session_fs_error, - session_fs_error_code, - session_fs_exists_request, - session_fs_exists_result, - session_fs_mkdir_request, - session_fs_readdir_request, - session_fs_readdir_result, - session_fs_readdir_with_types_entry, - session_fs_readdir_with_types_entry_type, - session_fs_readdir_with_types_request, - session_fs_readdir_with_types_result, - session_fs_read_file_request, - session_fs_read_file_result, - session_fs_rename_request, - session_fs_rm_request, - session_fs_set_provider_capabilities, - session_fs_set_provider_conventions, - session_fs_set_provider_request, - session_fs_set_provider_result, - session_fs_sqlite_exists_request, - session_fs_sqlite_exists_result, - session_fs_sqlite_query_request, - session_fs_sqlite_query_result, - session_fs_sqlite_query_type, - session_fs_stat_request, - session_fs_stat_result, - session_fs_write_file_request, - session_installed_plugin, - session_installed_plugin_source, - session_installed_plugin_source_github, - session_installed_plugin_source_local, - session_installed_plugin_source_url, - session_list, - session_list_filter, - session_load_deferred_repo_hooks_result, - session_log_level, - session_mcp_apps_call_tool_result, - session_metadata, - session_metadata_snapshot, - session_mode, - session_prune_result, - sessions_bulk_delete_request, - sessions_check_in_use_request, - sessions_check_in_use_result, - sessions_close_request, - sessions_close_result, - sessions_enrich_metadata_request, - session_set_credentials_params, - session_set_credentials_result, - sessions_find_by_prefix_request, - sessions_find_by_prefix_result, - sessions_find_by_task_id_request, - sessions_find_by_task_id_result, - sessions_fork_request, - sessions_fork_result, - sessions_get_event_file_path_request, - sessions_get_event_file_path_result, - sessions_get_last_for_context_request, - sessions_get_last_for_context_result, - sessions_get_persisted_remote_steerable_request, - sessions_get_persisted_remote_steerable_result, - session_sizes, - sessions_list_request, - sessions_load_deferred_repo_hooks_request, - sessions_prune_old_request, - sessions_release_lock_request, - sessions_release_lock_result, - sessions_reload_plugin_hooks_request, - sessions_reload_plugin_hooks_result, - sessions_save_request, - sessions_save_result, - sessions_set_additional_plugins_request, - sessions_set_additional_plugins_result, - session_update_options_params, - session_update_options_result, - session_working_directory_context, - session_working_directory_context_host_type, - shell_exec_request, - shell_exec_result, - shell_kill_request, - shell_kill_result, - shell_kill_signal, - shutdown_request, - skill, - skill_list, - skills_config_set_disabled_skills_request, - skills_disable_request, - skills_discover_request, - skills_enable_request, - skills_get_invoked_result, - skills_invoked_skill, - skills_load_diagnostics, - slash_command_agent_prompt_result, - slash_command_completed_result, - slash_command_info, - slash_command_input, - slash_command_input_completion, - slash_command_invocation_result, - slash_command_kind, - slash_command_select_subcommand_option, - slash_command_select_subcommand_result, - slash_command_text_result, - task_agent_info, - task_agent_progress, - task_execution_mode, - task_info, - task_list, - task_progress_line, - tasks_cancel_request, - tasks_cancel_result, - tasks_get_current_promotable_result, - tasks_get_progress_request, - tasks_get_progress_result, - task_shell_info, - task_shell_info_attachment_mode, - task_shell_progress, - tasks_promote_current_to_background_result, - tasks_promote_to_background_request, - tasks_promote_to_background_result, - tasks_refresh_result, - tasks_remove_request, - tasks_remove_result, - tasks_send_message_request, - tasks_send_message_result, - tasks_start_agent_request, - tasks_start_agent_result, - task_status, - tasks_wait_for_pending_result, - telemetry_set_feature_overrides_request, - token_auth_info, - tool, - tool_list, - tools_initialize_and_validate_result, - tools_list_request, - ui_auto_mode_switch_response, - ui_elicitation_array_any_of_field, - ui_elicitation_array_any_of_field_items, - ui_elicitation_array_any_of_field_items_any_of, - ui_elicitation_array_enum_field, - ui_elicitation_array_enum_field_items, - ui_elicitation_field_value, - ui_elicitation_request, - ui_elicitation_response, - ui_elicitation_response_action, - ui_elicitation_response_content, - ui_elicitation_result, - ui_elicitation_schema, - ui_elicitation_schema_property, - ui_elicitation_schema_property_boolean, - ui_elicitation_schema_property_number, - ui_elicitation_schema_property_number_type, - ui_elicitation_schema_property_string, - ui_elicitation_schema_property_string_format, - ui_elicitation_string_enum_field, - ui_elicitation_string_one_of_field, - ui_elicitation_string_one_of_field_one_of, - ui_exit_plan_mode_action, - ui_exit_plan_mode_response, - ui_handle_pending_auto_mode_switch_request, - ui_handle_pending_elicitation_request, - ui_handle_pending_exit_plan_mode_request, - ui_handle_pending_result, - ui_handle_pending_sampling_request, - ui_handle_pending_sampling_response, - ui_handle_pending_user_input_request, - ui_register_direct_auto_mode_switch_handler_result, - ui_unregister_direct_auto_mode_switch_handler_request, - ui_unregister_direct_auto_mode_switch_handler_result, - ui_user_input_response, - usage_get_metrics_result, - usage_metrics_code_changes, - usage_metrics_model_metric, - usage_metrics_model_metric_requests, - usage_metrics_model_metric_token_detail, - usage_metrics_model_metric_usage, - usage_metrics_token_detail, - user_auth_info, - workspace_diff_file_change, - workspace_diff_file_change_type, - workspace_diff_mode, - workspace_diff_result, - workspaces_checkpoints, - workspaces_create_file_request, - workspaces_diff_request, - workspaces_get_workspace_result, - workspaces_list_checkpoints_result, - workspaces_list_files_result, - workspaces_read_checkpoint_request, - workspaces_read_checkpoint_result, - workspaces_read_file_request, - workspaces_read_file_result, - workspaces_save_large_paste_request, - workspaces_save_large_paste_result, - workspace_summary_host_type, - workspaces_workspace_details_host_type, - session_context_info, - task_progress, - workspace_summary, - ) + workspace_summary = from_union([WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary")) + return RPC(abort_request, abort_result, account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_reload_result, agent_select_request, agent_select_result, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_instance_availability, canvas_invoke_action_request, canvas_invoke_action_result, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, discovered_canvas, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_source, installed_plugin_source_github, installed_plugin_source_local, installed_plugin_source_url, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, lsp_initialize_request, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_oauth_login_request, mcp_oauth_login_result, mcp_remove_git_hub_result, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_auth, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_list, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_env_value_mode, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, release_event_interest_params, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_mode, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachment, send_attachment_blob, send_attachment_directory, send_attachment_file, send_attachment_file_line_range, send_attachment_github_reference, send_attachment_github_reference_type, send_attachment_selection, send_attachment_selection_details, send_attachment_selection_details_end, send_attachment_selection_details_start, send_mode, send_request, send_result, server_skill, server_skill_list, session_auth_status, session_bulk_delete_result, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_github, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata, session_metadata_snapshot, session_mode, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_prune_old_request, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, session_update_options_params, session_update_options_result, session_working_directory_context, session_working_directory_context_host_type, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_initialize_and_validate_result, tools_list_request, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, task_progress, workspace_summary) def to_dict(self) -> dict: result: dict = {} result["AbortRequest"] = to_class(AbortRequest, self.abort_request) result["AbortResult"] = to_class(AbortResult, self.abort_result) - result["AccountGetQuotaRequest"] = to_class( - AccountGetQuotaRequest, self.account_get_quota_request - ) - result["AccountGetQuotaResult"] = to_class( - AccountGetQuotaResult, self.account_get_quota_result - ) + result["AccountGetQuotaRequest"] = to_class(AccountGetQuotaRequest, self.account_get_quota_request) + result["AccountGetQuotaResult"] = to_class(AccountGetQuotaResult, self.account_get_quota_result) result["AccountQuotaSnapshot"] = to_class(AccountQuotaSnapshot, self.account_quota_snapshot) - result["AgentGetCurrentResult"] = to_class( - AgentGetCurrentResult, self.agent_get_current_result - ) + result["AgentGetCurrentResult"] = to_class(AgentGetCurrentResult, self.agent_get_current_result) result["AgentInfo"] = to_class(AgentInfo, self.agent_info) result["AgentInfoSource"] = to_enum(AgentInfoSource, self.agent_info_source) result["AgentList"] = to_class(AgentList, self.agent_list) @@ -19373,109 +15945,50 @@ def to_dict(self) -> dict: result["CanvasAction"] = to_class(CanvasAction, self.canvas_action) result["CanvasCloseRequest"] = to_class(CanvasCloseRequest, self.canvas_close_request) result["CanvasHostContext"] = to_class(CanvasHostContext, self.canvas_host_context) - result["CanvasHostContextCapabilities"] = to_class( - CanvasHostContextCapabilities, self.canvas_host_context_capabilities - ) - result["CanvasInstanceAvailability"] = to_enum( - CanvasInstanceAvailability, self.canvas_instance_availability - ) - result["CanvasInvokeActionRequest"] = to_class( - CanvasInvokeActionRequest, self.canvas_invoke_action_request - ) + result["CanvasHostContextCapabilities"] = to_class(CanvasHostContextCapabilities, self.canvas_host_context_capabilities) + result["CanvasInstanceAvailability"] = to_enum(CanvasInstanceAvailability, self.canvas_instance_availability) + result["CanvasInvokeActionRequest"] = to_class(CanvasInvokeActionRequest, self.canvas_invoke_action_request) result["CanvasInvokeActionResult"] = self.canvas_invoke_action_result result["CanvasJsonSchema"] = self.canvas_json_schema result["CanvasList"] = to_class(CanvasList, self.canvas_list) - result["CanvasListOpenResult"] = to_class( - CanvasListOpenResult, self.canvas_list_open_result - ) + result["CanvasListOpenResult"] = to_class(CanvasListOpenResult, self.canvas_list_open_result) result["CanvasOpenRequest"] = to_class(CanvasOpenRequest, self.canvas_open_request) - result["CanvasProviderCloseRequest"] = to_class( - CanvasProviderCloseRequest, self.canvas_provider_close_request - ) - result["CanvasProviderInvokeActionRequest"] = to_class( - CanvasProviderInvokeActionRequest, self.canvas_provider_invoke_action_request - ) - result["CanvasProviderOpenRequest"] = to_class( - CanvasProviderOpenRequest, self.canvas_provider_open_request - ) - result["CanvasProviderOpenResult"] = to_class( - CanvasProviderOpenResult, self.canvas_provider_open_result - ) + result["CanvasProviderCloseRequest"] = to_class(CanvasProviderCloseRequest, self.canvas_provider_close_request) + result["CanvasProviderInvokeActionRequest"] = to_class(CanvasProviderInvokeActionRequest, self.canvas_provider_invoke_action_request) + result["CanvasProviderOpenRequest"] = to_class(CanvasProviderOpenRequest, self.canvas_provider_open_request) + result["CanvasProviderOpenResult"] = to_class(CanvasProviderOpenResult, self.canvas_provider_open_result) result["CommandList"] = to_class(CommandList, self.command_list) - result["CommandsHandlePendingCommandRequest"] = to_class( - CommandsHandlePendingCommandRequest, self.commands_handle_pending_command_request - ) - result["CommandsHandlePendingCommandResult"] = to_class( - CommandsHandlePendingCommandResult, self.commands_handle_pending_command_result - ) - result["CommandsInvokeRequest"] = to_class( - CommandsInvokeRequest, self.commands_invoke_request - ) + result["CommandsHandlePendingCommandRequest"] = to_class(CommandsHandlePendingCommandRequest, self.commands_handle_pending_command_request) + result["CommandsHandlePendingCommandResult"] = to_class(CommandsHandlePendingCommandResult, self.commands_handle_pending_command_result) + result["CommandsInvokeRequest"] = to_class(CommandsInvokeRequest, self.commands_invoke_request) result["CommandsListRequest"] = to_class(CommandsListRequest, self.commands_list_request) - result["CommandsRespondToQueuedCommandRequest"] = to_class( - CommandsRespondToQueuedCommandRequest, self.commands_respond_to_queued_command_request - ) - result["CommandsRespondToQueuedCommandResult"] = to_class( - CommandsRespondToQueuedCommandResult, self.commands_respond_to_queued_command_result - ) - result["ConnectedRemoteSessionMetadata"] = to_class( - ConnectedRemoteSessionMetadata, self.connected_remote_session_metadata - ) - result["ConnectedRemoteSessionMetadataKind"] = to_enum( - ConnectedRemoteSessionMetadataKind, self.connected_remote_session_metadata_kind - ) - result["ConnectedRemoteSessionMetadataRepository"] = to_class( - ConnectedRemoteSessionMetadataRepository, - self.connected_remote_session_metadata_repository, - ) - result["ConnectRemoteSessionParams"] = to_class( - ConnectRemoteSessionParams, self.connect_remote_session_params - ) + result["CommandsRespondToQueuedCommandRequest"] = to_class(CommandsRespondToQueuedCommandRequest, self.commands_respond_to_queued_command_request) + result["CommandsRespondToQueuedCommandResult"] = to_class(CommandsRespondToQueuedCommandResult, self.commands_respond_to_queued_command_result) + result["ConnectedRemoteSessionMetadata"] = to_class(ConnectedRemoteSessionMetadata, self.connected_remote_session_metadata) + result["ConnectedRemoteSessionMetadataKind"] = to_enum(ConnectedRemoteSessionMetadataKind, self.connected_remote_session_metadata_kind) + result["ConnectedRemoteSessionMetadataRepository"] = to_class(ConnectedRemoteSessionMetadataRepository, self.connected_remote_session_metadata_repository) + result["ConnectRemoteSessionParams"] = to_class(ConnectRemoteSessionParams, self.connect_remote_session_params) result["ConnectRequest"] = to_class(_ConnectRequest, self.connect_request) result["ConnectResult"] = to_class(_ConnectResult, self.connect_result) result["ContentFilterMode"] = to_enum(ContentFilterMode, self.content_filter_mode) - result["CopilotApiTokenAuthInfo"] = to_class( - CopilotAPITokenAuthInfo, self.copilot_api_token_auth_info - ) + result["CopilotApiTokenAuthInfo"] = to_class(CopilotAPITokenAuthInfo, self.copilot_api_token_auth_info) result["CopilotUserResponse"] = to_class(CopilotUserResponse, self.copilot_user_response) - result["CopilotUserResponseEndpoints"] = to_class( - CopilotUserResponseEndpoints, self.copilot_user_response_endpoints - ) - result["CopilotUserResponseQuotaSnapshots"] = from_dict( - lambda x: from_union( - [lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x - ), - self.copilot_user_response_quota_snapshots, - ) - result["CopilotUserResponseQuotaSnapshotsChat"] = to_class( - CopilotUserResponseQuotaSnapshotsChat, self.copilot_user_response_quota_snapshots_chat - ) - result["CopilotUserResponseQuotaSnapshotsCompletions"] = to_class( - CopilotUserResponseQuotaSnapshotsCompletions, - self.copilot_user_response_quota_snapshots_completions, - ) - result["CopilotUserResponseQuotaSnapshotsPremiumInteractions"] = to_class( - CopilotUserResponseQuotaSnapshotsPremiumInteractions, - self.copilot_user_response_quota_snapshots_premium_interactions, - ) + result["CopilotUserResponseEndpoints"] = to_class(CopilotUserResponseEndpoints, self.copilot_user_response_endpoints) + result["CopilotUserResponseQuotaSnapshots"] = from_dict(lambda x: from_union([lambda x: to_class(CopilotUserResponseQuotaSnapshots, x), from_none], x), self.copilot_user_response_quota_snapshots) + result["CopilotUserResponseQuotaSnapshotsChat"] = to_class(CopilotUserResponseQuotaSnapshotsChat, self.copilot_user_response_quota_snapshots_chat) + result["CopilotUserResponseQuotaSnapshotsCompletions"] = to_class(CopilotUserResponseQuotaSnapshotsCompletions, self.copilot_user_response_quota_snapshots_completions) + result["CopilotUserResponseQuotaSnapshotsPremiumInteractions"] = to_class(CopilotUserResponseQuotaSnapshotsPremiumInteractions, self.copilot_user_response_quota_snapshots_premium_interactions) result["CurrentModel"] = to_class(CurrentModel, self.current_model) result["DiscoveredCanvas"] = to_class(DiscoveredCanvas, self.discovered_canvas) result["DiscoveredMcpServer"] = to_class(DiscoveredMCPServer, self.discovered_mcp_server) - result["DiscoveredMcpServerType"] = to_enum( - DiscoveredMCPServerType, self.discovered_mcp_server_type - ) + result["DiscoveredMcpServerType"] = to_enum(DiscoveredMCPServerType, self.discovered_mcp_server_type) result["EnqueueCommandParams"] = to_class(EnqueueCommandParams, self.enqueue_command_params) result["EnqueueCommandResult"] = to_class(EnqueueCommandResult, self.enqueue_command_result) result["EnvAuthInfo"] = to_class(EnvAuthInfo, self.env_auth_info) result["EventLogReadRequest"] = to_class(EventLogReadRequest, self.event_log_read_request) - result["EventLogReleaseInterestResult"] = to_class( - EventLogReleaseInterestResult, self.event_log_release_interest_result - ) + result["EventLogReleaseInterestResult"] = to_class(EventLogReleaseInterestResult, self.event_log_release_interest_result) result["EventLogTailResult"] = to_class(EventLogTailResult, self.event_log_tail_result) - result["EventLogTypes"] = from_union( - [lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x)], - self.event_log_types, - ) + result["EventLogTypes"] = from_union([lambda x: from_list(from_str, x), lambda x: to_enum(EventLogTypes, x)], self.event_log_types) result["EventsAgentScope"] = to_enum(EventsAgentScope, self.events_agent_scope) result["EventsCursorStatus"] = to_enum(EventsCursorStatus, self.events_cursor_status) result["EventsReadResult"] = to_class(EventsReadResult, self.events_read_result) @@ -19483,367 +15996,141 @@ def to_dict(self) -> dict: result["ExecuteCommandResult"] = to_class(ExecuteCommandResult, self.execute_command_result) result["Extension"] = to_class(Extension, self.extension) result["ExtensionList"] = to_class(ExtensionList, self.extension_list) - result["ExtensionsDisableRequest"] = to_class( - ExtensionsDisableRequest, self.extensions_disable_request - ) - result["ExtensionsEnableRequest"] = to_class( - ExtensionsEnableRequest, self.extensions_enable_request - ) + result["ExtensionsDisableRequest"] = to_class(ExtensionsDisableRequest, self.extensions_disable_request) + result["ExtensionsEnableRequest"] = to_class(ExtensionsEnableRequest, self.extensions_enable_request) result["ExtensionSource"] = to_enum(ExtensionSource, self.extension_source) result["ExtensionStatus"] = to_enum(ExtensionStatus, self.extension_status) - result["ExternalToolResult"] = from_union( - [lambda x: to_class(ExternalToolTextResultForLlm, x), from_str], - self.external_tool_result, - ) - result["ExternalToolTextResultForLlm"] = to_class( - ExternalToolTextResultForLlm, self.external_tool_text_result_for_llm - ) - result["ExternalToolTextResultForLlmBinaryResultsForLlm"] = to_class( - ExternalToolTextResultForLlmBinaryResultsForLlm, - self.external_tool_text_result_for_llm_binary_results_for_llm, - ) - result["ExternalToolTextResultForLlmBinaryResultsForLlmType"] = to_enum( - ExternalToolTextResultForLlmBinaryResultsForLlmType, - self.external_tool_text_result_for_llm_binary_results_for_llm_type, - ) - result["ExternalToolTextResultForLlmContent"] = ( - self.external_tool_text_result_for_llm_content - ).to_dict() - result["ExternalToolTextResultForLlmContentAudio"] = to_class( - ExternalToolTextResultForLlmContentAudio, - self.external_tool_text_result_for_llm_content_audio, - ) - result["ExternalToolTextResultForLlmContentImage"] = to_class( - ExternalToolTextResultForLlmContentImage, - self.external_tool_text_result_for_llm_content_image, - ) - result["ExternalToolTextResultForLlmContentResource"] = to_class( - ExternalToolTextResultForLlmContentResource, - self.external_tool_text_result_for_llm_content_resource, - ) - result["ExternalToolTextResultForLlmContentResourceDetails"] = from_union( - [ - lambda x: to_class(EmbeddedTextResourceContents, x), - lambda x: to_class(EmbeddedBlobResourceContents, x), - ], - self.external_tool_text_result_for_llm_content_resource_details, - ) - result["ExternalToolTextResultForLlmContentResourceLink"] = to_class( - ExternalToolTextResultForLlmContentResourceLink, - self.external_tool_text_result_for_llm_content_resource_link, - ) - result["ExternalToolTextResultForLlmContentResourceLinkIcon"] = to_class( - ExternalToolTextResultForLlmContentResourceLinkIcon, - self.external_tool_text_result_for_llm_content_resource_link_icon, - ) - result["ExternalToolTextResultForLlmContentResourceLinkIconTheme"] = to_enum( - Theme, self.external_tool_text_result_for_llm_content_resource_link_icon_theme - ) - result["ExternalToolTextResultForLlmContentTerminal"] = to_class( - ExternalToolTextResultForLlmContentTerminal, - self.external_tool_text_result_for_llm_content_terminal, - ) - result["ExternalToolTextResultForLlmContentText"] = to_class( - ExternalToolTextResultForLlmContentText, - self.external_tool_text_result_for_llm_content_text, - ) - result["FilterMapping"] = from_union( - [ - lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), - lambda x: to_enum(ContentFilterMode, x), - ], - self.filter_mapping, - ) + result["ExternalToolResult"] = from_union([lambda x: to_class(ExternalToolTextResultForLlm, x), from_str], self.external_tool_result) + result["ExternalToolTextResultForLlm"] = to_class(ExternalToolTextResultForLlm, self.external_tool_text_result_for_llm) + result["ExternalToolTextResultForLlmBinaryResultsForLlm"] = to_class(ExternalToolTextResultForLlmBinaryResultsForLlm, self.external_tool_text_result_for_llm_binary_results_for_llm) + result["ExternalToolTextResultForLlmBinaryResultsForLlmType"] = to_enum(ExternalToolTextResultForLlmBinaryResultsForLlmType, self.external_tool_text_result_for_llm_binary_results_for_llm_type) + result["ExternalToolTextResultForLlmContent"] = (self.external_tool_text_result_for_llm_content).to_dict() + result["ExternalToolTextResultForLlmContentAudio"] = to_class(ExternalToolTextResultForLlmContentAudio, self.external_tool_text_result_for_llm_content_audio) + result["ExternalToolTextResultForLlmContentImage"] = to_class(ExternalToolTextResultForLlmContentImage, self.external_tool_text_result_for_llm_content_image) + result["ExternalToolTextResultForLlmContentResource"] = to_class(ExternalToolTextResultForLlmContentResource, self.external_tool_text_result_for_llm_content_resource) + result["ExternalToolTextResultForLlmContentResourceDetails"] = from_union([lambda x: to_class(EmbeddedTextResourceContents, x), lambda x: to_class(EmbeddedBlobResourceContents, x)], self.external_tool_text_result_for_llm_content_resource_details) + result["ExternalToolTextResultForLlmContentResourceLink"] = to_class(ExternalToolTextResultForLlmContentResourceLink, self.external_tool_text_result_for_llm_content_resource_link) + result["ExternalToolTextResultForLlmContentResourceLinkIcon"] = to_class(ExternalToolTextResultForLlmContentResourceLinkIcon, self.external_tool_text_result_for_llm_content_resource_link_icon) + result["ExternalToolTextResultForLlmContentResourceLinkIconTheme"] = to_enum(Theme, self.external_tool_text_result_for_llm_content_resource_link_icon_theme) + result["ExternalToolTextResultForLlmContentTerminal"] = to_class(ExternalToolTextResultForLlmContentTerminal, self.external_tool_text_result_for_llm_content_terminal) + result["ExternalToolTextResultForLlmContentText"] = to_class(ExternalToolTextResultForLlmContentText, self.external_tool_text_result_for_llm_content_text) + result["FilterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x)], self.filter_mapping) result["FleetStartRequest"] = to_class(FleetStartRequest, self.fleet_start_request) result["FleetStartResult"] = to_class(FleetStartResult, self.fleet_start_result) - result["FolderTrustAddParams"] = to_class( - FolderTrustAddParams, self.folder_trust_add_params - ) - result["FolderTrustCheckParams"] = to_class( - FolderTrustCheckParams, self.folder_trust_check_params - ) - result["FolderTrustCheckResult"] = to_class( - FolderTrustCheckResult, self.folder_trust_check_result - ) + result["FolderTrustAddParams"] = to_class(FolderTrustAddParams, self.folder_trust_add_params) + result["FolderTrustCheckParams"] = to_class(FolderTrustCheckParams, self.folder_trust_check_params) + result["FolderTrustCheckResult"] = to_class(FolderTrustCheckResult, self.folder_trust_check_result) result["GhCliAuthInfo"] = to_class(GhCLIAuthInfo, self.gh_cli_auth_info) - result["HandlePendingToolCallRequest"] = to_class( - HandlePendingToolCallRequest, self.handle_pending_tool_call_request - ) - result["HandlePendingToolCallResult"] = to_class( - HandlePendingToolCallResult, self.handle_pending_tool_call_result - ) - result["HistoryAbortManualCompactionResult"] = to_class( - HistoryAbortManualCompactionResult, self.history_abort_manual_compaction_result - ) - result["HistoryCancelBackgroundCompactionResult"] = to_class( - HistoryCancelBackgroundCompactionResult, - self.history_cancel_background_compaction_result, - ) - result["HistoryCompactContextWindow"] = to_class( - HistoryCompactContextWindow, self.history_compact_context_window - ) - result["HistoryCompactRequest"] = to_class( - HistoryCompactRequest, self.history_compact_request - ) + result["HandlePendingToolCallRequest"] = to_class(HandlePendingToolCallRequest, self.handle_pending_tool_call_request) + result["HandlePendingToolCallResult"] = to_class(HandlePendingToolCallResult, self.handle_pending_tool_call_result) + result["HistoryAbortManualCompactionResult"] = to_class(HistoryAbortManualCompactionResult, self.history_abort_manual_compaction_result) + result["HistoryCancelBackgroundCompactionResult"] = to_class(HistoryCancelBackgroundCompactionResult, self.history_cancel_background_compaction_result) + result["HistoryCompactContextWindow"] = to_class(HistoryCompactContextWindow, self.history_compact_context_window) + result["HistoryCompactRequest"] = to_class(HistoryCompactRequest, self.history_compact_request) result["HistoryCompactResult"] = to_class(HistoryCompactResult, self.history_compact_result) - result["HistorySummarizeForHandoffResult"] = to_class( - HistorySummarizeForHandoffResult, self.history_summarize_for_handoff_result - ) - result["HistoryTruncateRequest"] = to_class( - HistoryTruncateRequest, self.history_truncate_request - ) - result["HistoryTruncateResult"] = to_class( - HistoryTruncateResult, self.history_truncate_result - ) + result["HistorySummarizeForHandoffResult"] = to_class(HistorySummarizeForHandoffResult, self.history_summarize_for_handoff_result) + result["HistoryTruncateRequest"] = to_class(HistoryTruncateRequest, self.history_truncate_request) + result["HistoryTruncateResult"] = to_class(HistoryTruncateResult, self.history_truncate_result) result["HMACAuthInfo"] = to_class(HMACAuthInfo, self.hmac_auth_info) result["InstalledPlugin"] = to_class(InstalledPlugin, self.installed_plugin) - result["InstalledPluginSource"] = from_union( - [lambda x: to_class(InstalledPluginSource, x), from_str], self.installed_plugin_source - ) - result["InstalledPluginSourceGithub"] = to_class( - InstalledPluginSourceGithub, self.installed_plugin_source_github - ) - result["InstalledPluginSourceLocal"] = to_class( - InstalledPluginSourceLocal, self.installed_plugin_source_local - ) - result["InstalledPluginSourceUrl"] = to_class( - InstalledPluginSourceURL, self.installed_plugin_source_url - ) - result["InstructionsGetSourcesResult"] = to_class( - InstructionsGetSourcesResult, self.instructions_get_sources_result - ) + result["InstalledPluginSource"] = from_union([lambda x: to_class(InstalledPluginSource, x), from_str], self.installed_plugin_source) + result["InstalledPluginSourceGithub"] = to_class(InstalledPluginSourceGithub, self.installed_plugin_source_github) + result["InstalledPluginSourceLocal"] = to_class(InstalledPluginSourceLocal, self.installed_plugin_source_local) + result["InstalledPluginSourceUrl"] = to_class(InstalledPluginSourceURL, self.installed_plugin_source_url) + result["InstructionsGetSourcesResult"] = to_class(InstructionsGetSourcesResult, self.instructions_get_sources_result) result["InstructionsSources"] = to_class(InstructionsSources, self.instructions_sources) - result["InstructionsSourcesLocation"] = to_enum( - InstructionsSourcesLocation, self.instructions_sources_location - ) - result["InstructionsSourcesType"] = to_enum( - InstructionsSourcesType, self.instructions_sources_type - ) + result["InstructionsSourcesLocation"] = to_enum(InstructionsSourcesLocation, self.instructions_sources_location) + result["InstructionsSourcesType"] = to_enum(InstructionsSourcesType, self.instructions_sources_type) result["LogRequest"] = to_class(LogRequest, self.log_request) result["LogResult"] = to_class(LogResult, self.log_result) result["LspInitializeRequest"] = to_class(LspInitializeRequest, self.lsp_initialize_request) - result["McpAppsCallToolRequest"] = to_class( - MCPAppsCallToolRequest, self.mcp_apps_call_tool_request - ) - result["McpAppsDiagnoseCapability"] = to_class( - MCPAppsDiagnoseCapability, self.mcp_apps_diagnose_capability - ) - result["McpAppsDiagnoseRequest"] = to_class( - MCPAppsDiagnoseRequest, self.mcp_apps_diagnose_request - ) - result["McpAppsDiagnoseResult"] = to_class( - MCPAppsDiagnoseResult, self.mcp_apps_diagnose_result - ) - result["McpAppsDiagnoseServer"] = to_class( - MCPAppsDiagnoseServer, self.mcp_apps_diagnose_server - ) + result["McpAppsCallToolRequest"] = to_class(MCPAppsCallToolRequest, self.mcp_apps_call_tool_request) + result["McpAppsDiagnoseCapability"] = to_class(MCPAppsDiagnoseCapability, self.mcp_apps_diagnose_capability) + result["McpAppsDiagnoseRequest"] = to_class(MCPAppsDiagnoseRequest, self.mcp_apps_diagnose_request) + result["McpAppsDiagnoseResult"] = to_class(MCPAppsDiagnoseResult, self.mcp_apps_diagnose_result) + result["McpAppsDiagnoseServer"] = to_class(MCPAppsDiagnoseServer, self.mcp_apps_diagnose_server) result["McpAppsHostContext"] = to_class(MCPAppsHostContext, self.mcp_apps_host_context) - result["McpAppsHostContextDetails"] = to_class( - MCPAppsHostContextDetails, self.mcp_apps_host_context_details - ) - result["McpAppsHostContextDetailsAvailableDisplayMode"] = to_enum( - MCPAppsDisplayMode, self.mcp_apps_host_context_details_available_display_mode - ) - result["McpAppsHostContextDetailsDisplayMode"] = to_enum( - MCPAppsDisplayMode, self.mcp_apps_host_context_details_display_mode - ) - result["McpAppsHostContextDetailsPlatform"] = to_enum( - MCPAppsHostContextDetailsPlatform, self.mcp_apps_host_context_details_platform - ) - result["McpAppsHostContextDetailsTheme"] = to_enum( - Theme, self.mcp_apps_host_context_details_theme - ) - result["McpAppsListToolsRequest"] = to_class( - MCPAppsListToolsRequest, self.mcp_apps_list_tools_request - ) - result["McpAppsListToolsResult"] = to_class( - MCPAppsListToolsResult, self.mcp_apps_list_tools_result - ) - result["McpAppsReadResourceRequest"] = to_class( - MCPAppsReadResourceRequest, self.mcp_apps_read_resource_request - ) - result["McpAppsReadResourceResult"] = to_class( - MCPAppsReadResourceResult, self.mcp_apps_read_resource_result - ) - result["McpAppsResourceContent"] = to_class( - MCPAppsResourceContent, self.mcp_apps_resource_content - ) - result["McpAppsSetHostContextDetails"] = to_class( - MCPAppsSetHostContextDetails, self.mcp_apps_set_host_context_details - ) - result["McpAppsSetHostContextDetailsAvailableDisplayMode"] = to_enum( - MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_available_display_mode - ) - result["McpAppsSetHostContextDetailsDisplayMode"] = to_enum( - MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_display_mode - ) - result["McpAppsSetHostContextDetailsPlatform"] = to_enum( - MCPAppsHostContextDetailsPlatform, self.mcp_apps_set_host_context_details_platform - ) - result["McpAppsSetHostContextDetailsTheme"] = to_enum( - Theme, self.mcp_apps_set_host_context_details_theme - ) - result["McpAppsSetHostContextRequest"] = to_class( - MCPAppsSetHostContextRequest, self.mcp_apps_set_host_context_request - ) - result["McpCancelSamplingExecutionParams"] = to_class( - MCPCancelSamplingExecutionParams, self.mcp_cancel_sampling_execution_params - ) - result["McpCancelSamplingExecutionResult"] = to_class( - MCPCancelSamplingExecutionResult, self.mcp_cancel_sampling_execution_result - ) + result["McpAppsHostContextDetails"] = to_class(MCPAppsHostContextDetails, self.mcp_apps_host_context_details) + result["McpAppsHostContextDetailsAvailableDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_host_context_details_available_display_mode) + result["McpAppsHostContextDetailsDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_host_context_details_display_mode) + result["McpAppsHostContextDetailsPlatform"] = to_enum(MCPAppsHostContextDetailsPlatform, self.mcp_apps_host_context_details_platform) + result["McpAppsHostContextDetailsTheme"] = to_enum(Theme, self.mcp_apps_host_context_details_theme) + result["McpAppsListToolsRequest"] = to_class(MCPAppsListToolsRequest, self.mcp_apps_list_tools_request) + result["McpAppsListToolsResult"] = to_class(MCPAppsListToolsResult, self.mcp_apps_list_tools_result) + result["McpAppsReadResourceRequest"] = to_class(MCPAppsReadResourceRequest, self.mcp_apps_read_resource_request) + result["McpAppsReadResourceResult"] = to_class(MCPAppsReadResourceResult, self.mcp_apps_read_resource_result) + result["McpAppsResourceContent"] = to_class(MCPAppsResourceContent, self.mcp_apps_resource_content) + result["McpAppsSetHostContextDetails"] = to_class(MCPAppsSetHostContextDetails, self.mcp_apps_set_host_context_details) + result["McpAppsSetHostContextDetailsAvailableDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_available_display_mode) + result["McpAppsSetHostContextDetailsDisplayMode"] = to_enum(MCPAppsDisplayMode, self.mcp_apps_set_host_context_details_display_mode) + result["McpAppsSetHostContextDetailsPlatform"] = to_enum(MCPAppsHostContextDetailsPlatform, self.mcp_apps_set_host_context_details_platform) + result["McpAppsSetHostContextDetailsTheme"] = to_enum(Theme, self.mcp_apps_set_host_context_details_theme) + result["McpAppsSetHostContextRequest"] = to_class(MCPAppsSetHostContextRequest, self.mcp_apps_set_host_context_request) + result["McpCancelSamplingExecutionParams"] = to_class(MCPCancelSamplingExecutionParams, self.mcp_cancel_sampling_execution_params) + result["McpCancelSamplingExecutionResult"] = to_class(MCPCancelSamplingExecutionResult, self.mcp_cancel_sampling_execution_result) result["McpConfigAddRequest"] = to_class(MCPConfigAddRequest, self.mcp_config_add_request) - result["McpConfigDisableRequest"] = to_class( - MCPConfigDisableRequest, self.mcp_config_disable_request - ) - result["McpConfigEnableRequest"] = to_class( - MCPConfigEnableRequest, self.mcp_config_enable_request - ) + result["McpConfigDisableRequest"] = to_class(MCPConfigDisableRequest, self.mcp_config_disable_request) + result["McpConfigEnableRequest"] = to_class(MCPConfigEnableRequest, self.mcp_config_enable_request) result["McpConfigList"] = to_class(MCPConfigList, self.mcp_config_list) - result["McpConfigRemoveRequest"] = to_class( - MCPConfigRemoveRequest, self.mcp_config_remove_request - ) - result["McpConfigUpdateRequest"] = to_class( - MCPConfigUpdateRequest, self.mcp_config_update_request - ) + result["McpConfigRemoveRequest"] = to_class(MCPConfigRemoveRequest, self.mcp_config_remove_request) + result["McpConfigUpdateRequest"] = to_class(MCPConfigUpdateRequest, self.mcp_config_update_request) result["McpDisableRequest"] = to_class(MCPDisableRequest, self.mcp_disable_request) result["McpDiscoverRequest"] = to_class(MCPDiscoverRequest, self.mcp_discover_request) result["McpDiscoverResult"] = to_class(MCPDiscoverResult, self.mcp_discover_result) result["McpEnableRequest"] = to_class(MCPEnableRequest, self.mcp_enable_request) - result["McpExecuteSamplingParams"] = to_class( - MCPExecuteSamplingParams, self.mcp_execute_sampling_params - ) - result["McpExecuteSamplingRequest"] = from_dict( - lambda x: x, self.mcp_execute_sampling_request - ) - result["McpExecuteSamplingResult"] = from_dict( - lambda x: x, self.mcp_execute_sampling_result - ) - result["McpOauthLoginRequest"] = to_class( - MCPOauthLoginRequest, self.mcp_oauth_login_request - ) + result["McpExecuteSamplingParams"] = to_class(MCPExecuteSamplingParams, self.mcp_execute_sampling_params) + result["McpExecuteSamplingRequest"] = from_dict(lambda x: x, self.mcp_execute_sampling_request) + result["McpExecuteSamplingResult"] = from_dict(lambda x: x, self.mcp_execute_sampling_result) + result["McpOauthLoginRequest"] = to_class(MCPOauthLoginRequest, self.mcp_oauth_login_request) result["McpOauthLoginResult"] = to_class(MCPOauthLoginResult, self.mcp_oauth_login_result) - result["McpRemoveGitHubResult"] = to_class( - MCPRemoveGitHubResult, self.mcp_remove_git_hub_result - ) - result["McpSamplingExecutionAction"] = to_enum( - MCPSamplingExecutionAction, self.mcp_sampling_execution_action - ) - result["McpSamplingExecutionResult"] = to_class( - MCPSamplingExecutionResult, self.mcp_sampling_execution_result - ) + result["McpRemoveGitHubResult"] = to_class(MCPRemoveGitHubResult, self.mcp_remove_git_hub_result) + result["McpSamplingExecutionAction"] = to_enum(MCPSamplingExecutionAction, self.mcp_sampling_execution_action) + result["McpSamplingExecutionResult"] = to_class(MCPSamplingExecutionResult, self.mcp_sampling_execution_result) result["McpServer"] = to_class(MCPServer, self.mcp_server) result["McpServerConfig"] = to_class(MCPServerConfig, self.mcp_server_config) result["McpServerConfigHttp"] = to_class(MCPServerConfigHTTP, self.mcp_server_config_http) - result["McpServerConfigHttpAuth"] = to_class( - MCPServerConfigHTTPAuth, self.mcp_server_config_http_auth - ) - result["McpServerConfigHttpOauthGrantType"] = to_enum( - MCPServerConfigHTTPOauthGrantType, self.mcp_server_config_http_oauth_grant_type - ) - result["McpServerConfigHttpType"] = to_enum( - MCPServerConfigHTTPType, self.mcp_server_config_http_type - ) - result["McpServerConfigStdio"] = to_class( - MCPServerConfigStdio, self.mcp_server_config_stdio - ) + result["McpServerConfigHttpAuth"] = to_class(MCPServerConfigHTTPAuth, self.mcp_server_config_http_auth) + result["McpServerConfigHttpOauthGrantType"] = to_enum(MCPServerConfigHTTPOauthGrantType, self.mcp_server_config_http_oauth_grant_type) + result["McpServerConfigHttpType"] = to_enum(MCPServerConfigHTTPType, self.mcp_server_config_http_type) + result["McpServerConfigStdio"] = to_class(MCPServerConfigStdio, self.mcp_server_config_stdio) result["McpServerList"] = to_class(MCPServerList, self.mcp_server_list) - result["McpSetEnvValueModeDetails"] = to_enum( - MCPSetEnvValueModeDetails, self.mcp_set_env_value_mode_details - ) - result["McpSetEnvValueModeParams"] = to_class( - MCPSetEnvValueModeParams, self.mcp_set_env_value_mode_params - ) - result["McpSetEnvValueModeResult"] = to_class( - MCPSetEnvValueModeResult, self.mcp_set_env_value_mode_result - ) - result["MetadataContextInfoRequest"] = to_class( - MetadataContextInfoRequest, self.metadata_context_info_request - ) - result["MetadataContextInfoResult"] = to_class( - MetadataContextInfoResult, self.metadata_context_info_result - ) - result["MetadataIsProcessingResult"] = to_class( - MetadataIsProcessingResult, self.metadata_is_processing_result - ) - result["MetadataRecomputeContextTokensRequest"] = to_class( - MetadataRecomputeContextTokensRequest, self.metadata_recompute_context_tokens_request - ) - result["MetadataRecomputeContextTokensResult"] = to_class( - MetadataRecomputeContextTokensResult, self.metadata_recompute_context_tokens_result - ) - result["MetadataRecordContextChangeRequest"] = to_class( - MetadataRecordContextChangeRequest, self.metadata_record_context_change_request - ) - result["MetadataRecordContextChangeResult"] = to_class( - MetadataRecordContextChangeResult, self.metadata_record_context_change_result - ) - result["MetadataSetWorkingDirectoryRequest"] = to_class( - MetadataSetWorkingDirectoryRequest, self.metadata_set_working_directory_request - ) - result["MetadataSetWorkingDirectoryResult"] = to_class( - MetadataSetWorkingDirectoryResult, self.metadata_set_working_directory_result - ) - result["MetadataSnapshotCurrentMode"] = to_enum( - MetadataSnapshotCurrentMode, self.metadata_snapshot_current_mode - ) - result["MetadataSnapshotRemoteMetadata"] = to_class( - MetadataSnapshotRemoteMetadata, self.metadata_snapshot_remote_metadata - ) - result["MetadataSnapshotRemoteMetadataRepository"] = to_class( - MetadataSnapshotRemoteMetadataRepository, - self.metadata_snapshot_remote_metadata_repository, - ) - result["MetadataSnapshotRemoteMetadataTaskType"] = to_enum( - MetadataSnapshotRemoteMetadataTaskType, self.metadata_snapshot_remote_metadata_task_type - ) + result["McpSetEnvValueModeDetails"] = to_enum(MCPSetEnvValueModeDetails, self.mcp_set_env_value_mode_details) + result["McpSetEnvValueModeParams"] = to_class(MCPSetEnvValueModeParams, self.mcp_set_env_value_mode_params) + result["McpSetEnvValueModeResult"] = to_class(MCPSetEnvValueModeResult, self.mcp_set_env_value_mode_result) + result["MetadataContextInfoRequest"] = to_class(MetadataContextInfoRequest, self.metadata_context_info_request) + result["MetadataContextInfoResult"] = to_class(MetadataContextInfoResult, self.metadata_context_info_result) + result["MetadataIsProcessingResult"] = to_class(MetadataIsProcessingResult, self.metadata_is_processing_result) + result["MetadataRecomputeContextTokensRequest"] = to_class(MetadataRecomputeContextTokensRequest, self.metadata_recompute_context_tokens_request) + result["MetadataRecomputeContextTokensResult"] = to_class(MetadataRecomputeContextTokensResult, self.metadata_recompute_context_tokens_result) + result["MetadataRecordContextChangeRequest"] = to_class(MetadataRecordContextChangeRequest, self.metadata_record_context_change_request) + result["MetadataRecordContextChangeResult"] = to_class(MetadataRecordContextChangeResult, self.metadata_record_context_change_result) + result["MetadataSetWorkingDirectoryRequest"] = to_class(MetadataSetWorkingDirectoryRequest, self.metadata_set_working_directory_request) + result["MetadataSetWorkingDirectoryResult"] = to_class(MetadataSetWorkingDirectoryResult, self.metadata_set_working_directory_result) + result["MetadataSnapshotCurrentMode"] = to_enum(MetadataSnapshotCurrentMode, self.metadata_snapshot_current_mode) + result["MetadataSnapshotRemoteMetadata"] = to_class(MetadataSnapshotRemoteMetadata, self.metadata_snapshot_remote_metadata) + result["MetadataSnapshotRemoteMetadataRepository"] = to_class(MetadataSnapshotRemoteMetadataRepository, self.metadata_snapshot_remote_metadata_repository) + result["MetadataSnapshotRemoteMetadataTaskType"] = to_enum(MetadataSnapshotRemoteMetadataTaskType, self.metadata_snapshot_remote_metadata_task_type) result["Model"] = to_class(Model, self.model) result["ModelBilling"] = to_class(ModelBilling, self.model_billing) - result["ModelBillingTokenPrices"] = to_class( - ModelBillingTokenPrices, self.model_billing_token_prices - ) - result["ModelBillingTokenPricesLongContext"] = to_class( - ModelBillingTokenPricesLongContext, self.model_billing_token_prices_long_context - ) + result["ModelBillingTokenPrices"] = to_class(ModelBillingTokenPrices, self.model_billing_token_prices) + result["ModelBillingTokenPricesLongContext"] = to_class(ModelBillingTokenPricesLongContext, self.model_billing_token_prices_long_context) result["ModelCapabilities"] = to_class(ModelCapabilities, self.model_capabilities) - result["ModelCapabilitiesLimits"] = to_class( - ModelCapabilitiesLimits, self.model_capabilities_limits - ) - result["ModelCapabilitiesLimitsVision"] = to_class( - ModelCapabilitiesLimitsVision, self.model_capabilities_limits_vision - ) - result["ModelCapabilitiesOverride"] = to_class( - ModelCapabilitiesOverride, self.model_capabilities_override - ) - result["ModelCapabilitiesOverrideLimits"] = to_class( - ModelCapabilitiesOverrideLimits, self.model_capabilities_override_limits - ) - result["ModelCapabilitiesOverrideLimitsVision"] = to_class( - ModelCapabilitiesOverrideLimitsVision, self.model_capabilities_override_limits_vision - ) - result["ModelCapabilitiesOverrideSupports"] = to_class( - ModelCapabilitiesOverrideSupports, self.model_capabilities_override_supports - ) - result["ModelCapabilitiesSupports"] = to_class( - ModelCapabilitiesSupports, self.model_capabilities_supports - ) + result["ModelCapabilitiesLimits"] = to_class(ModelCapabilitiesLimits, self.model_capabilities_limits) + result["ModelCapabilitiesLimitsVision"] = to_class(ModelCapabilitiesLimitsVision, self.model_capabilities_limits_vision) + result["ModelCapabilitiesOverride"] = to_class(ModelCapabilitiesOverride, self.model_capabilities_override) + result["ModelCapabilitiesOverrideLimits"] = to_class(ModelCapabilitiesOverrideLimits, self.model_capabilities_override_limits) + result["ModelCapabilitiesOverrideLimitsVision"] = to_class(ModelCapabilitiesOverrideLimitsVision, self.model_capabilities_override_limits_vision) + result["ModelCapabilitiesOverrideSupports"] = to_class(ModelCapabilitiesOverrideSupports, self.model_capabilities_override_supports) + result["ModelCapabilitiesSupports"] = to_class(ModelCapabilitiesSupports, self.model_capabilities_supports) result["ModelList"] = to_class(ModelList, self.model_list) result["ModelPickerCategory"] = to_enum(ModelPickerCategory, self.model_picker_category) - result["ModelPickerPriceCategory"] = to_enum( - ModelPickerPriceCategory, self.model_picker_price_category - ) + result["ModelPickerPriceCategory"] = to_enum(ModelPickerPriceCategory, self.model_picker_price_category) result["ModelPolicy"] = to_class(ModelPolicy, self.model_policy) result["ModelPolicyState"] = to_enum(ModelPolicyState, self.model_policy_state) - result["ModelSetReasoningEffortRequest"] = to_class( - ModelSetReasoningEffortRequest, self.model_set_reasoning_effort_request - ) - result["ModelSetReasoningEffortResult"] = to_class( - ModelSetReasoningEffortResult, self.model_set_reasoning_effort_result - ) + result["ModelSetReasoningEffortRequest"] = to_class(ModelSetReasoningEffortRequest, self.model_set_reasoning_effort_request) + result["ModelSetReasoningEffortResult"] = to_class(ModelSetReasoningEffortResult, self.model_set_reasoning_effort_result) result["ModelsListRequest"] = to_class(ModelsListRequest, self.models_list_request) - result["ModelSwitchToRequest"] = to_class( - ModelSwitchToRequest, self.model_switch_to_request - ) + result["ModelSwitchToRequest"] = to_class(ModelSwitchToRequest, self.model_switch_to_request) result["ModelSwitchToResult"] = to_class(ModelSwitchToResult, self.model_switch_to_result) result["ModeSetRequest"] = to_class(ModeSetRequest, self.mode_set_request) result["NameGetResult"] = to_class(NameGetResult, self.name_get_result) @@ -19851,317 +16138,99 @@ def to_dict(self) -> dict: result["NameSetAutoResult"] = to_class(NameSetAutoResult, self.name_set_auto_result) result["NameSetRequest"] = to_class(NameSetRequest, self.name_set_request) result["OpenCanvasInstance"] = to_class(OpenCanvasInstance, self.open_canvas_instance) - result["OptionsUpdateEnvValueMode"] = to_enum( - MCPSetEnvValueModeDetails, self.options_update_env_value_mode - ) - result["PendingPermissionRequest"] = to_class( - PendingPermissionRequest, self.pending_permission_request - ) - result["PendingPermissionRequestList"] = to_class( - PendingPermissionRequestList, self.pending_permission_request_list - ) + result["OptionsUpdateEnvValueMode"] = to_enum(MCPSetEnvValueModeDetails, self.options_update_env_value_mode) + result["PendingPermissionRequest"] = to_class(PendingPermissionRequest, self.pending_permission_request) + result["PendingPermissionRequestList"] = to_class(PendingPermissionRequestList, self.pending_permission_request_list) result["PermissionDecision"] = (self.permission_decision).to_dict() - result["PermissionDecisionApproved"] = to_class( - PermissionDecisionApproved, self.permission_decision_approved - ) - result["PermissionDecisionApprovedForLocation"] = to_class( - PermissionDecisionApprovedForLocation, self.permission_decision_approved_for_location - ) - result["PermissionDecisionApprovedForSession"] = to_class( - PermissionDecisionApprovedForSession, self.permission_decision_approved_for_session - ) - result["PermissionDecisionApproveForLocation"] = to_class( - PermissionDecisionApproveForLocation, self.permission_decision_approve_for_location - ) - result["PermissionDecisionApproveForLocationApproval"] = ( - self.permission_decision_approve_for_location_approval - ).to_dict() - result["PermissionDecisionApproveForLocationApprovalCommands"] = to_class( - PermissionDecisionApproveForLocationApprovalCommands, - self.permission_decision_approve_for_location_approval_commands, - ) - result["PermissionDecisionApproveForLocationApprovalCustomTool"] = to_class( - PermissionDecisionApproveForLocationApprovalCustomTool, - self.permission_decision_approve_for_location_approval_custom_tool, - ) - result["PermissionDecisionApproveForLocationApprovalExtensionManagement"] = to_class( - PermissionDecisionApproveForLocationApprovalExtensionManagement, - self.permission_decision_approve_for_location_approval_extension_management, - ) - result["PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess"] = to_class( - PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess, - self.permission_decision_approve_for_location_approval_extension_permission_access, - ) - result["PermissionDecisionApproveForLocationApprovalMcp"] = to_class( - PermissionDecisionApproveForLocationApprovalMCP, - self.permission_decision_approve_for_location_approval_mcp, - ) - result["PermissionDecisionApproveForLocationApprovalMcpSampling"] = to_class( - PermissionDecisionApproveForLocationApprovalMCPSampling, - self.permission_decision_approve_for_location_approval_mcp_sampling, - ) - result["PermissionDecisionApproveForLocationApprovalMemory"] = to_class( - PermissionDecisionApproveForLocationApprovalMemory, - self.permission_decision_approve_for_location_approval_memory, - ) - result["PermissionDecisionApproveForLocationApprovalRead"] = to_class( - PermissionDecisionApproveForLocationApprovalRead, - self.permission_decision_approve_for_location_approval_read, - ) - result["PermissionDecisionApproveForLocationApprovalWrite"] = to_class( - PermissionDecisionApproveForLocationApprovalWrite, - self.permission_decision_approve_for_location_approval_write, - ) - result["PermissionDecisionApproveForSession"] = to_class( - PermissionDecisionApproveForSession, self.permission_decision_approve_for_session - ) - result["PermissionDecisionApproveForSessionApproval"] = ( - self.permission_decision_approve_for_session_approval - ).to_dict() - result["PermissionDecisionApproveForSessionApprovalCommands"] = to_class( - PermissionDecisionApproveForSessionApprovalCommands, - self.permission_decision_approve_for_session_approval_commands, - ) - result["PermissionDecisionApproveForSessionApprovalCustomTool"] = to_class( - PermissionDecisionApproveForSessionApprovalCustomTool, - self.permission_decision_approve_for_session_approval_custom_tool, - ) - result["PermissionDecisionApproveForSessionApprovalExtensionManagement"] = to_class( - PermissionDecisionApproveForSessionApprovalExtensionManagement, - self.permission_decision_approve_for_session_approval_extension_management, - ) - result["PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess"] = to_class( - PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess, - self.permission_decision_approve_for_session_approval_extension_permission_access, - ) - result["PermissionDecisionApproveForSessionApprovalMcp"] = to_class( - PermissionDecisionApproveForSessionApprovalMCP, - self.permission_decision_approve_for_session_approval_mcp, - ) - result["PermissionDecisionApproveForSessionApprovalMcpSampling"] = to_class( - PermissionDecisionApproveForSessionApprovalMCPSampling, - self.permission_decision_approve_for_session_approval_mcp_sampling, - ) - result["PermissionDecisionApproveForSessionApprovalMemory"] = to_class( - PermissionDecisionApproveForSessionApprovalMemory, - self.permission_decision_approve_for_session_approval_memory, - ) - result["PermissionDecisionApproveForSessionApprovalRead"] = to_class( - PermissionDecisionApproveForSessionApprovalRead, - self.permission_decision_approve_for_session_approval_read, - ) - result["PermissionDecisionApproveForSessionApprovalWrite"] = to_class( - PermissionDecisionApproveForSessionApprovalWrite, - self.permission_decision_approve_for_session_approval_write, - ) - result["PermissionDecisionApproveOnce"] = to_class( - PermissionDecisionApproveOnce, self.permission_decision_approve_once - ) - result["PermissionDecisionApprovePermanently"] = to_class( - PermissionDecisionApprovePermanently, self.permission_decision_approve_permanently - ) - result["PermissionDecisionCancelled"] = to_class( - PermissionDecisionCancelled, self.permission_decision_cancelled - ) - result["PermissionDecisionDeniedByContentExclusionPolicy"] = to_class( - PermissionDecisionDeniedByContentExclusionPolicy, - self.permission_decision_denied_by_content_exclusion_policy, - ) - result["PermissionDecisionDeniedByPermissionRequestHook"] = to_class( - PermissionDecisionDeniedByPermissionRequestHook, - self.permission_decision_denied_by_permission_request_hook, - ) - result["PermissionDecisionDeniedByRules"] = to_class( - PermissionDecisionDeniedByRules, self.permission_decision_denied_by_rules - ) - result["PermissionDecisionDeniedInteractivelyByUser"] = to_class( - PermissionDecisionDeniedInteractivelyByUser, - self.permission_decision_denied_interactively_by_user, - ) - result["PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser"] = to_class( - PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser, - self.permission_decision_denied_no_approval_rule_and_could_not_request_from_user, - ) - result["PermissionDecisionReject"] = to_class( - PermissionDecisionReject, self.permission_decision_reject - ) - result["PermissionDecisionRequest"] = to_class( - PermissionDecisionRequest, self.permission_decision_request - ) - result["PermissionDecisionUserNotAvailable"] = to_class( - PermissionDecisionUserNotAvailable, self.permission_decision_user_not_available - ) - result["PermissionLocationAddToolApprovalParams"] = to_class( - PermissionLocationAddToolApprovalParams, - self.permission_location_add_tool_approval_params, - ) - result["PermissionLocationApplyParams"] = to_class( - PermissionLocationApplyParams, self.permission_location_apply_params - ) - result["PermissionLocationApplyResult"] = to_class( - PermissionLocationApplyResult, self.permission_location_apply_result - ) - result["PermissionLocationResolveParams"] = to_class( - PermissionLocationResolveParams, self.permission_location_resolve_params - ) - result["PermissionLocationResolveResult"] = to_class( - PermissionLocationResolveResult, self.permission_location_resolve_result - ) - result["PermissionLocationType"] = to_enum( - PermissionLocationType, self.permission_location_type - ) - result["PermissionPathsAddParams"] = to_class( - PermissionPathsAddParams, self.permission_paths_add_params - ) - result["PermissionPathsAllowedCheckParams"] = to_class( - PermissionPathsAllowedCheckParams, self.permission_paths_allowed_check_params - ) - result["PermissionPathsAllowedCheckResult"] = to_class( - PermissionPathsAllowedCheckResult, self.permission_paths_allowed_check_result - ) - result["PermissionPathsConfig"] = to_class( - PermissionPathsConfig, self.permission_paths_config - ) + result["PermissionDecisionApproved"] = to_class(PermissionDecisionApproved, self.permission_decision_approved) + result["PermissionDecisionApprovedForLocation"] = to_class(PermissionDecisionApprovedForLocation, self.permission_decision_approved_for_location) + result["PermissionDecisionApprovedForSession"] = to_class(PermissionDecisionApprovedForSession, self.permission_decision_approved_for_session) + result["PermissionDecisionApproveForLocation"] = to_class(PermissionDecisionApproveForLocation, self.permission_decision_approve_for_location) + result["PermissionDecisionApproveForLocationApproval"] = (self.permission_decision_approve_for_location_approval).to_dict() + result["PermissionDecisionApproveForLocationApprovalCommands"] = to_class(PermissionDecisionApproveForLocationApprovalCommands, self.permission_decision_approve_for_location_approval_commands) + result["PermissionDecisionApproveForLocationApprovalCustomTool"] = to_class(PermissionDecisionApproveForLocationApprovalCustomTool, self.permission_decision_approve_for_location_approval_custom_tool) + result["PermissionDecisionApproveForLocationApprovalExtensionManagement"] = to_class(PermissionDecisionApproveForLocationApprovalExtensionManagement, self.permission_decision_approve_for_location_approval_extension_management) + result["PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess"] = to_class(PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess, self.permission_decision_approve_for_location_approval_extension_permission_access) + result["PermissionDecisionApproveForLocationApprovalMcp"] = to_class(PermissionDecisionApproveForLocationApprovalMCP, self.permission_decision_approve_for_location_approval_mcp) + result["PermissionDecisionApproveForLocationApprovalMcpSampling"] = to_class(PermissionDecisionApproveForLocationApprovalMCPSampling, self.permission_decision_approve_for_location_approval_mcp_sampling) + result["PermissionDecisionApproveForLocationApprovalMemory"] = to_class(PermissionDecisionApproveForLocationApprovalMemory, self.permission_decision_approve_for_location_approval_memory) + result["PermissionDecisionApproveForLocationApprovalRead"] = to_class(PermissionDecisionApproveForLocationApprovalRead, self.permission_decision_approve_for_location_approval_read) + result["PermissionDecisionApproveForLocationApprovalWrite"] = to_class(PermissionDecisionApproveForLocationApprovalWrite, self.permission_decision_approve_for_location_approval_write) + result["PermissionDecisionApproveForSession"] = to_class(PermissionDecisionApproveForSession, self.permission_decision_approve_for_session) + result["PermissionDecisionApproveForSessionApproval"] = (self.permission_decision_approve_for_session_approval).to_dict() + result["PermissionDecisionApproveForSessionApprovalCommands"] = to_class(PermissionDecisionApproveForSessionApprovalCommands, self.permission_decision_approve_for_session_approval_commands) + result["PermissionDecisionApproveForSessionApprovalCustomTool"] = to_class(PermissionDecisionApproveForSessionApprovalCustomTool, self.permission_decision_approve_for_session_approval_custom_tool) + result["PermissionDecisionApproveForSessionApprovalExtensionManagement"] = to_class(PermissionDecisionApproveForSessionApprovalExtensionManagement, self.permission_decision_approve_for_session_approval_extension_management) + result["PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess"] = to_class(PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess, self.permission_decision_approve_for_session_approval_extension_permission_access) + result["PermissionDecisionApproveForSessionApprovalMcp"] = to_class(PermissionDecisionApproveForSessionApprovalMCP, self.permission_decision_approve_for_session_approval_mcp) + result["PermissionDecisionApproveForSessionApprovalMcpSampling"] = to_class(PermissionDecisionApproveForSessionApprovalMCPSampling, self.permission_decision_approve_for_session_approval_mcp_sampling) + result["PermissionDecisionApproveForSessionApprovalMemory"] = to_class(PermissionDecisionApproveForSessionApprovalMemory, self.permission_decision_approve_for_session_approval_memory) + result["PermissionDecisionApproveForSessionApprovalRead"] = to_class(PermissionDecisionApproveForSessionApprovalRead, self.permission_decision_approve_for_session_approval_read) + result["PermissionDecisionApproveForSessionApprovalWrite"] = to_class(PermissionDecisionApproveForSessionApprovalWrite, self.permission_decision_approve_for_session_approval_write) + result["PermissionDecisionApproveOnce"] = to_class(PermissionDecisionApproveOnce, self.permission_decision_approve_once) + result["PermissionDecisionApprovePermanently"] = to_class(PermissionDecisionApprovePermanently, self.permission_decision_approve_permanently) + result["PermissionDecisionCancelled"] = to_class(PermissionDecisionCancelled, self.permission_decision_cancelled) + result["PermissionDecisionDeniedByContentExclusionPolicy"] = to_class(PermissionDecisionDeniedByContentExclusionPolicy, self.permission_decision_denied_by_content_exclusion_policy) + result["PermissionDecisionDeniedByPermissionRequestHook"] = to_class(PermissionDecisionDeniedByPermissionRequestHook, self.permission_decision_denied_by_permission_request_hook) + result["PermissionDecisionDeniedByRules"] = to_class(PermissionDecisionDeniedByRules, self.permission_decision_denied_by_rules) + result["PermissionDecisionDeniedInteractivelyByUser"] = to_class(PermissionDecisionDeniedInteractivelyByUser, self.permission_decision_denied_interactively_by_user) + result["PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser"] = to_class(PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser, self.permission_decision_denied_no_approval_rule_and_could_not_request_from_user) + result["PermissionDecisionReject"] = to_class(PermissionDecisionReject, self.permission_decision_reject) + result["PermissionDecisionRequest"] = to_class(PermissionDecisionRequest, self.permission_decision_request) + result["PermissionDecisionUserNotAvailable"] = to_class(PermissionDecisionUserNotAvailable, self.permission_decision_user_not_available) + result["PermissionLocationAddToolApprovalParams"] = to_class(PermissionLocationAddToolApprovalParams, self.permission_location_add_tool_approval_params) + result["PermissionLocationApplyParams"] = to_class(PermissionLocationApplyParams, self.permission_location_apply_params) + result["PermissionLocationApplyResult"] = to_class(PermissionLocationApplyResult, self.permission_location_apply_result) + result["PermissionLocationResolveParams"] = to_class(PermissionLocationResolveParams, self.permission_location_resolve_params) + result["PermissionLocationResolveResult"] = to_class(PermissionLocationResolveResult, self.permission_location_resolve_result) + result["PermissionLocationType"] = to_enum(PermissionLocationType, self.permission_location_type) + result["PermissionPathsAddParams"] = to_class(PermissionPathsAddParams, self.permission_paths_add_params) + result["PermissionPathsAllowedCheckParams"] = to_class(PermissionPathsAllowedCheckParams, self.permission_paths_allowed_check_params) + result["PermissionPathsAllowedCheckResult"] = to_class(PermissionPathsAllowedCheckResult, self.permission_paths_allowed_check_result) + result["PermissionPathsConfig"] = to_class(PermissionPathsConfig, self.permission_paths_config) result["PermissionPathsList"] = to_class(PermissionPathsList, self.permission_paths_list) - result["PermissionPathsUpdatePrimaryParams"] = to_class( - PermissionPathsUpdatePrimaryParams, self.permission_paths_update_primary_params - ) - result["PermissionPathsWorkspaceCheckParams"] = to_class( - PermissionPathsWorkspaceCheckParams, self.permission_paths_workspace_check_params - ) - result["PermissionPathsWorkspaceCheckResult"] = to_class( - PermissionPathsWorkspaceCheckResult, self.permission_paths_workspace_check_result - ) - result["PermissionPromptShownNotification"] = to_class( - PermissionPromptShownNotification, self.permission_prompt_shown_notification - ) - result["PermissionRequestResult"] = to_class( - PermissionRequestResult, self.permission_request_result - ) + result["PermissionPathsUpdatePrimaryParams"] = to_class(PermissionPathsUpdatePrimaryParams, self.permission_paths_update_primary_params) + result["PermissionPathsWorkspaceCheckParams"] = to_class(PermissionPathsWorkspaceCheckParams, self.permission_paths_workspace_check_params) + result["PermissionPathsWorkspaceCheckResult"] = to_class(PermissionPathsWorkspaceCheckResult, self.permission_paths_workspace_check_result) + result["PermissionPromptShownNotification"] = to_class(PermissionPromptShownNotification, self.permission_prompt_shown_notification) + result["PermissionRequestResult"] = to_class(PermissionRequestResult, self.permission_request_result) result["PermissionRulesSet"] = to_class(PermissionRulesSet, self.permission_rules_set) - result["PermissionsConfigureAdditionalContentExclusionPolicy"] = to_class( - PermissionsConfigureAdditionalContentExclusionPolicy, - self.permissions_configure_additional_content_exclusion_policy, - ) - result["PermissionsConfigureAdditionalContentExclusionPolicyRule"] = to_class( - PermissionsConfigureAdditionalContentExclusionPolicyRule, - self.permissions_configure_additional_content_exclusion_policy_rule, - ) - result["PermissionsConfigureAdditionalContentExclusionPolicyRuleSource"] = to_class( - PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, - self.permissions_configure_additional_content_exclusion_policy_rule_source, - ) - result["PermissionsConfigureAdditionalContentExclusionPolicyScope"] = to_enum( - PermissionsConfigureAdditionalContentExclusionPolicyScope, - self.permissions_configure_additional_content_exclusion_policy_scope, - ) - result["PermissionsConfigureParams"] = to_class( - PermissionsConfigureParams, self.permissions_configure_params - ) - result["PermissionsConfigureResult"] = to_class( - PermissionsConfigureResult, self.permissions_configure_result - ) - result["PermissionsFolderTrustAddTrustedResult"] = to_class( - PermissionsFolderTrustAddTrustedResult, self.permissions_folder_trust_add_trusted_result - ) - result["PermissionsLocationsAddToolApprovalDetails"] = ( - self.permissions_locations_add_tool_approval_details - ).to_dict() - result["PermissionsLocationsAddToolApprovalDetailsCommands"] = to_class( - PermissionsLocationsAddToolApprovalDetailsCommands, - self.permissions_locations_add_tool_approval_details_commands, - ) - result["PermissionsLocationsAddToolApprovalDetailsCustomTool"] = to_class( - PermissionsLocationsAddToolApprovalDetailsCustomTool, - self.permissions_locations_add_tool_approval_details_custom_tool, - ) - result["PermissionsLocationsAddToolApprovalDetailsExtensionManagement"] = to_class( - PermissionsLocationsAddToolApprovalDetailsExtensionManagement, - self.permissions_locations_add_tool_approval_details_extension_management, - ) - result["PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess"] = to_class( - PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess, - self.permissions_locations_add_tool_approval_details_extension_permission_access, - ) - result["PermissionsLocationsAddToolApprovalDetailsMcp"] = to_class( - PermissionsLocationsAddToolApprovalDetailsMCP, - self.permissions_locations_add_tool_approval_details_mcp, - ) - result["PermissionsLocationsAddToolApprovalDetailsMcpSampling"] = to_class( - PermissionsLocationsAddToolApprovalDetailsMCPSampling, - self.permissions_locations_add_tool_approval_details_mcp_sampling, - ) - result["PermissionsLocationsAddToolApprovalDetailsMemory"] = to_class( - PermissionsLocationsAddToolApprovalDetailsMemory, - self.permissions_locations_add_tool_approval_details_memory, - ) - result["PermissionsLocationsAddToolApprovalDetailsRead"] = to_class( - PermissionsLocationsAddToolApprovalDetailsRead, - self.permissions_locations_add_tool_approval_details_read, - ) - result["PermissionsLocationsAddToolApprovalDetailsWrite"] = to_class( - PermissionsLocationsAddToolApprovalDetailsWrite, - self.permissions_locations_add_tool_approval_details_write, - ) - result["PermissionsLocationsAddToolApprovalResult"] = to_class( - PermissionsLocationsAddToolApprovalResult, - self.permissions_locations_add_tool_approval_result, - ) - result["PermissionsModifyRulesParams"] = to_class( - PermissionsModifyRulesParams, self.permissions_modify_rules_params - ) - result["PermissionsModifyRulesResult"] = to_class( - PermissionsModifyRulesResult, self.permissions_modify_rules_result - ) - result["PermissionsModifyRulesScope"] = to_enum( - PermissionsModifyRulesScope, self.permissions_modify_rules_scope - ) - result["PermissionsNotifyPromptShownResult"] = to_class( - PermissionsNotifyPromptShownResult, self.permissions_notify_prompt_shown_result - ) - result["PermissionsPathsAddResult"] = to_class( - PermissionsPathsAddResult, self.permissions_paths_add_result - ) - result["PermissionsPathsListRequest"] = to_class( - PermissionsPathsListRequest, self.permissions_paths_list_request - ) - result["PermissionsPathsUpdatePrimaryResult"] = to_class( - PermissionsPathsUpdatePrimaryResult, self.permissions_paths_update_primary_result - ) - result["PermissionsPendingRequestsRequest"] = to_class( - PermissionsPendingRequestsRequest, self.permissions_pending_requests_request - ) - result["PermissionsResetSessionApprovalsRequest"] = to_class( - PermissionsResetSessionApprovalsRequest, - self.permissions_reset_session_approvals_request, - ) - result["PermissionsResetSessionApprovalsResult"] = to_class( - PermissionsResetSessionApprovalsResult, self.permissions_reset_session_approvals_result - ) - result["PermissionsSetApproveAllRequest"] = to_class( - PermissionsSetApproveAllRequest, self.permissions_set_approve_all_request - ) - result["PermissionsSetApproveAllResult"] = to_class( - PermissionsSetApproveAllResult, self.permissions_set_approve_all_result - ) - result["PermissionsSetApproveAllSource"] = to_enum( - PermissionsSetApproveAllSource, self.permissions_set_approve_all_source - ) - result["PermissionsSetRequiredRequest"] = to_class( - PermissionsSetRequiredRequest, self.permissions_set_required_request - ) - result["PermissionsSetRequiredResult"] = to_class( - PermissionsSetRequiredResult, self.permissions_set_required_result - ) - result["PermissionsUrlsSetUnrestrictedModeResult"] = to_class( - PermissionsUrlsSetUnrestrictedModeResult, - self.permissions_urls_set_unrestricted_mode_result, - ) + result["PermissionsConfigureAdditionalContentExclusionPolicy"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicy, self.permissions_configure_additional_content_exclusion_policy) + result["PermissionsConfigureAdditionalContentExclusionPolicyRule"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRule, self.permissions_configure_additional_content_exclusion_policy_rule) + result["PermissionsConfigureAdditionalContentExclusionPolicyRuleSource"] = to_class(PermissionsConfigureAdditionalContentExclusionPolicyRuleSource, self.permissions_configure_additional_content_exclusion_policy_rule_source) + result["PermissionsConfigureAdditionalContentExclusionPolicyScope"] = to_enum(PermissionsConfigureAdditionalContentExclusionPolicyScope, self.permissions_configure_additional_content_exclusion_policy_scope) + result["PermissionsConfigureParams"] = to_class(PermissionsConfigureParams, self.permissions_configure_params) + result["PermissionsConfigureResult"] = to_class(PermissionsConfigureResult, self.permissions_configure_result) + result["PermissionsFolderTrustAddTrustedResult"] = to_class(PermissionsFolderTrustAddTrustedResult, self.permissions_folder_trust_add_trusted_result) + result["PermissionsLocationsAddToolApprovalDetails"] = (self.permissions_locations_add_tool_approval_details).to_dict() + result["PermissionsLocationsAddToolApprovalDetailsCommands"] = to_class(PermissionsLocationsAddToolApprovalDetailsCommands, self.permissions_locations_add_tool_approval_details_commands) + result["PermissionsLocationsAddToolApprovalDetailsCustomTool"] = to_class(PermissionsLocationsAddToolApprovalDetailsCustomTool, self.permissions_locations_add_tool_approval_details_custom_tool) + result["PermissionsLocationsAddToolApprovalDetailsExtensionManagement"] = to_class(PermissionsLocationsAddToolApprovalDetailsExtensionManagement, self.permissions_locations_add_tool_approval_details_extension_management) + result["PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess"] = to_class(PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess, self.permissions_locations_add_tool_approval_details_extension_permission_access) + result["PermissionsLocationsAddToolApprovalDetailsMcp"] = to_class(PermissionsLocationsAddToolApprovalDetailsMCP, self.permissions_locations_add_tool_approval_details_mcp) + result["PermissionsLocationsAddToolApprovalDetailsMcpSampling"] = to_class(PermissionsLocationsAddToolApprovalDetailsMCPSampling, self.permissions_locations_add_tool_approval_details_mcp_sampling) + result["PermissionsLocationsAddToolApprovalDetailsMemory"] = to_class(PermissionsLocationsAddToolApprovalDetailsMemory, self.permissions_locations_add_tool_approval_details_memory) + result["PermissionsLocationsAddToolApprovalDetailsRead"] = to_class(PermissionsLocationsAddToolApprovalDetailsRead, self.permissions_locations_add_tool_approval_details_read) + result["PermissionsLocationsAddToolApprovalDetailsWrite"] = to_class(PermissionsLocationsAddToolApprovalDetailsWrite, self.permissions_locations_add_tool_approval_details_write) + result["PermissionsLocationsAddToolApprovalResult"] = to_class(PermissionsLocationsAddToolApprovalResult, self.permissions_locations_add_tool_approval_result) + result["PermissionsModifyRulesParams"] = to_class(PermissionsModifyRulesParams, self.permissions_modify_rules_params) + result["PermissionsModifyRulesResult"] = to_class(PermissionsModifyRulesResult, self.permissions_modify_rules_result) + result["PermissionsModifyRulesScope"] = to_enum(PermissionsModifyRulesScope, self.permissions_modify_rules_scope) + result["PermissionsNotifyPromptShownResult"] = to_class(PermissionsNotifyPromptShownResult, self.permissions_notify_prompt_shown_result) + result["PermissionsPathsAddResult"] = to_class(PermissionsPathsAddResult, self.permissions_paths_add_result) + result["PermissionsPathsListRequest"] = to_class(PermissionsPathsListRequest, self.permissions_paths_list_request) + result["PermissionsPathsUpdatePrimaryResult"] = to_class(PermissionsPathsUpdatePrimaryResult, self.permissions_paths_update_primary_result) + result["PermissionsPendingRequestsRequest"] = to_class(PermissionsPendingRequestsRequest, self.permissions_pending_requests_request) + result["PermissionsResetSessionApprovalsRequest"] = to_class(PermissionsResetSessionApprovalsRequest, self.permissions_reset_session_approvals_request) + result["PermissionsResetSessionApprovalsResult"] = to_class(PermissionsResetSessionApprovalsResult, self.permissions_reset_session_approvals_result) + result["PermissionsSetApproveAllRequest"] = to_class(PermissionsSetApproveAllRequest, self.permissions_set_approve_all_request) + result["PermissionsSetApproveAllResult"] = to_class(PermissionsSetApproveAllResult, self.permissions_set_approve_all_result) + result["PermissionsSetApproveAllSource"] = to_enum(PermissionsSetApproveAllSource, self.permissions_set_approve_all_source) + result["PermissionsSetRequiredRequest"] = to_class(PermissionsSetRequiredRequest, self.permissions_set_required_request) + result["PermissionsSetRequiredResult"] = to_class(PermissionsSetRequiredResult, self.permissions_set_required_result) + result["PermissionsUrlsSetUnrestrictedModeResult"] = to_class(PermissionsUrlsSetUnrestrictedModeResult, self.permissions_urls_set_unrestricted_mode_result) result["PermissionUrlsConfig"] = to_class(PermissionUrlsConfig, self.permission_urls_config) - result["PermissionUrlsSetUnrestrictedModeParams"] = to_class( - PermissionUrlsSetUnrestrictedModeParams, - self.permission_urls_set_unrestricted_mode_params, - ) + result["PermissionUrlsSetUnrestrictedModeParams"] = to_class(PermissionUrlsSetUnrestrictedModeParams, self.permission_urls_set_unrestricted_mode_params) result["PingRequest"] = to_class(PingRequest, self.ping_request) result["PingResult"] = to_class(PingResult, self.ping_result) result["PlanReadResult"] = to_class(PlanReadResult, self.plan_read_result) @@ -20169,294 +16238,127 @@ def to_dict(self) -> dict: result["Plugin"] = to_class(Plugin, self.plugin) result["PluginList"] = to_class(PluginList, self.plugin_list) result["QueuedCommandHandled"] = to_class(QueuedCommandHandled, self.queued_command_handled) - result["QueuedCommandNotHandled"] = to_class( - QueuedCommandNotHandled, self.queued_command_not_handled - ) + result["QueuedCommandNotHandled"] = to_class(QueuedCommandNotHandled, self.queued_command_not_handled) result["QueuedCommandResult"] = (self.queued_command_result).to_dict() result["QueuePendingItems"] = to_class(QueuePendingItems, self.queue_pending_items) - result["QueuePendingItemsKind"] = to_enum( - QueuePendingItemsKind, self.queue_pending_items_kind - ) - result["QueuePendingItemsResult"] = to_class( - QueuePendingItemsResult, self.queue_pending_items_result - ) - result["QueueRemoveMostRecentResult"] = to_class( - QueueRemoveMostRecentResult, self.queue_remove_most_recent_result - ) - result["RegisterEventInterestParams"] = to_class( - RegisterEventInterestParams, self.register_event_interest_params - ) - result["RegisterEventInterestResult"] = to_class( - RegisterEventInterestResult, self.register_event_interest_result - ) - result["ReleaseEventInterestParams"] = to_class( - ReleaseEventInterestParams, self.release_event_interest_params - ) + result["QueuePendingItemsKind"] = to_enum(QueuePendingItemsKind, self.queue_pending_items_kind) + result["QueuePendingItemsResult"] = to_class(QueuePendingItemsResult, self.queue_pending_items_result) + result["QueueRemoveMostRecentResult"] = to_class(QueueRemoveMostRecentResult, self.queue_remove_most_recent_result) + result["RegisterEventInterestParams"] = to_class(RegisterEventInterestParams, self.register_event_interest_params) + result["RegisterEventInterestResult"] = to_class(RegisterEventInterestResult, self.register_event_interest_result) + result["ReleaseEventInterestParams"] = to_class(ReleaseEventInterestParams, self.release_event_interest_params) result["RemoteEnableRequest"] = to_class(RemoteEnableRequest, self.remote_enable_request) result["RemoteEnableResult"] = to_class(RemoteEnableResult, self.remote_enable_result) - result["RemoteNotifySteerableChangedRequest"] = to_class( - RemoteNotifySteerableChangedRequest, self.remote_notify_steerable_changed_request - ) - result["RemoteNotifySteerableChangedResult"] = to_class( - RemoteNotifySteerableChangedResult, self.remote_notify_steerable_changed_result - ) - result["RemoteSessionConnectionResult"] = to_class( - RemoteSessionConnectionResult, self.remote_session_connection_result - ) + result["RemoteNotifySteerableChangedRequest"] = to_class(RemoteNotifySteerableChangedRequest, self.remote_notify_steerable_changed_request) + result["RemoteNotifySteerableChangedResult"] = to_class(RemoteNotifySteerableChangedResult, self.remote_notify_steerable_changed_result) + result["RemoteSessionConnectionResult"] = to_class(RemoteSessionConnectionResult, self.remote_session_connection_result) result["RemoteSessionMode"] = to_enum(RemoteSessionMode, self.remote_session_mode) result["ScheduleEntry"] = to_class(ScheduleEntry, self.schedule_entry) result["ScheduleList"] = to_class(ScheduleList, self.schedule_list) result["ScheduleStopRequest"] = to_class(ScheduleStopRequest, self.schedule_stop_request) result["ScheduleStopResult"] = to_class(ScheduleStopResult, self.schedule_stop_result) - result["SecretsAddFilterValuesRequest"] = to_class( - SecretsAddFilterValuesRequest, self.secrets_add_filter_values_request - ) - result["SecretsAddFilterValuesResult"] = to_class( - SecretsAddFilterValuesResult, self.secrets_add_filter_values_result - ) + result["SecretsAddFilterValuesRequest"] = to_class(SecretsAddFilterValuesRequest, self.secrets_add_filter_values_request) + result["SecretsAddFilterValuesResult"] = to_class(SecretsAddFilterValuesResult, self.secrets_add_filter_values_result) result["SendAgentMode"] = to_enum(SendAgentMode, self.send_agent_mode) result["SendAttachment"] = (self.send_attachment).to_dict() result["SendAttachmentBlob"] = to_class(SendAttachmentBlob, self.send_attachment_blob) - result["SendAttachmentDirectory"] = to_class( - SendAttachmentDirectory, self.send_attachment_directory - ) + result["SendAttachmentDirectory"] = to_class(SendAttachmentDirectory, self.send_attachment_directory) result["SendAttachmentFile"] = to_class(SendAttachmentFile, self.send_attachment_file) - result["SendAttachmentFileLineRange"] = to_class( - SendAttachmentFileLineRange, self.send_attachment_file_line_range - ) - result["SendAttachmentGithubReference"] = to_class( - SendAttachmentGithubReference, self.send_attachment_github_reference - ) - result["SendAttachmentGithubReferenceType"] = to_enum( - SendAttachmentGithubReferenceTypeEnum, self.send_attachment_github_reference_type - ) - result["SendAttachmentSelection"] = to_class( - SendAttachmentSelection, self.send_attachment_selection - ) - result["SendAttachmentSelectionDetails"] = to_class( - SendAttachmentSelectionDetails, self.send_attachment_selection_details - ) - result["SendAttachmentSelectionDetailsEnd"] = to_class( - SendAttachmentSelectionDetailsEnd, self.send_attachment_selection_details_end - ) - result["SendAttachmentSelectionDetailsStart"] = to_class( - SendAttachmentSelectionDetailsStart, self.send_attachment_selection_details_start - ) + result["SendAttachmentFileLineRange"] = to_class(SendAttachmentFileLineRange, self.send_attachment_file_line_range) + result["SendAttachmentGithubReference"] = to_class(SendAttachmentGithubReference, self.send_attachment_github_reference) + result["SendAttachmentGithubReferenceType"] = to_enum(SendAttachmentGithubReferenceTypeEnum, self.send_attachment_github_reference_type) + result["SendAttachmentSelection"] = to_class(SendAttachmentSelection, self.send_attachment_selection) + result["SendAttachmentSelectionDetails"] = to_class(SendAttachmentSelectionDetails, self.send_attachment_selection_details) + result["SendAttachmentSelectionDetailsEnd"] = to_class(SendAttachmentSelectionDetailsEnd, self.send_attachment_selection_details_end) + result["SendAttachmentSelectionDetailsStart"] = to_class(SendAttachmentSelectionDetailsStart, self.send_attachment_selection_details_start) result["SendMode"] = to_enum(SendMode, self.send_mode) result["SendRequest"] = to_class(SendRequest, self.send_request) result["SendResult"] = to_class(SendResult, self.send_result) result["ServerSkill"] = to_class(ServerSkill, self.server_skill) result["ServerSkillList"] = to_class(ServerSkillList, self.server_skill_list) result["SessionAuthStatus"] = to_class(SessionAuthStatus, self.session_auth_status) - result["SessionBulkDeleteResult"] = to_class( - SessionBulkDeleteResult, self.session_bulk_delete_result - ) + result["SessionBulkDeleteResult"] = to_class(SessionBulkDeleteResult, self.session_bulk_delete_result) result["SessionContext"] = to_class(SessionContext, self.session_context) result["SessionContextHostType"] = to_enum(HostType, self.session_context_host_type) - result["SessionEnrichMetadataResult"] = to_class( - SessionEnrichMetadataResult, self.session_enrich_metadata_result - ) - result["SessionFsAppendFileRequest"] = to_class( - SessionFSAppendFileRequest, self.session_fs_append_file_request - ) + result["SessionEnrichMetadataResult"] = to_class(SessionEnrichMetadataResult, self.session_enrich_metadata_result) + result["SessionFsAppendFileRequest"] = to_class(SessionFSAppendFileRequest, self.session_fs_append_file_request) result["SessionFsError"] = to_class(SessionFSError, self.session_fs_error) result["SessionFsErrorCode"] = to_enum(SessionFSErrorCode, self.session_fs_error_code) - result["SessionFsExistsRequest"] = to_class( - SessionFSExistsRequest, self.session_fs_exists_request - ) - result["SessionFsExistsResult"] = to_class( - SessionFSExistsResult, self.session_fs_exists_result - ) - result["SessionFsMkdirRequest"] = to_class( - SessionFSMkdirRequest, self.session_fs_mkdir_request - ) - result["SessionFsReaddirRequest"] = to_class( - SessionFSReaddirRequest, self.session_fs_readdir_request - ) - result["SessionFsReaddirResult"] = to_class( - SessionFSReaddirResult, self.session_fs_readdir_result - ) - result["SessionFsReaddirWithTypesEntry"] = to_class( - SessionFSReaddirWithTypesEntry, self.session_fs_readdir_with_types_entry - ) - result["SessionFsReaddirWithTypesEntryType"] = to_enum( - SessionFSReaddirWithTypesEntryType, self.session_fs_readdir_with_types_entry_type - ) - result["SessionFsReaddirWithTypesRequest"] = to_class( - SessionFSReaddirWithTypesRequest, self.session_fs_readdir_with_types_request - ) - result["SessionFsReaddirWithTypesResult"] = to_class( - SessionFSReaddirWithTypesResult, self.session_fs_readdir_with_types_result - ) - result["SessionFsReadFileRequest"] = to_class( - SessionFSReadFileRequest, self.session_fs_read_file_request - ) - result["SessionFsReadFileResult"] = to_class( - SessionFSReadFileResult, self.session_fs_read_file_result - ) - result["SessionFsRenameRequest"] = to_class( - SessionFSRenameRequest, self.session_fs_rename_request - ) + result["SessionFsExistsRequest"] = to_class(SessionFSExistsRequest, self.session_fs_exists_request) + result["SessionFsExistsResult"] = to_class(SessionFSExistsResult, self.session_fs_exists_result) + result["SessionFsMkdirRequest"] = to_class(SessionFSMkdirRequest, self.session_fs_mkdir_request) + result["SessionFsReaddirRequest"] = to_class(SessionFSReaddirRequest, self.session_fs_readdir_request) + result["SessionFsReaddirResult"] = to_class(SessionFSReaddirResult, self.session_fs_readdir_result) + result["SessionFsReaddirWithTypesEntry"] = to_class(SessionFSReaddirWithTypesEntry, self.session_fs_readdir_with_types_entry) + result["SessionFsReaddirWithTypesEntryType"] = to_enum(SessionFSReaddirWithTypesEntryType, self.session_fs_readdir_with_types_entry_type) + result["SessionFsReaddirWithTypesRequest"] = to_class(SessionFSReaddirWithTypesRequest, self.session_fs_readdir_with_types_request) + result["SessionFsReaddirWithTypesResult"] = to_class(SessionFSReaddirWithTypesResult, self.session_fs_readdir_with_types_result) + result["SessionFsReadFileRequest"] = to_class(SessionFSReadFileRequest, self.session_fs_read_file_request) + result["SessionFsReadFileResult"] = to_class(SessionFSReadFileResult, self.session_fs_read_file_result) + result["SessionFsRenameRequest"] = to_class(SessionFSRenameRequest, self.session_fs_rename_request) result["SessionFsRmRequest"] = to_class(SessionFSRmRequest, self.session_fs_rm_request) - result["SessionFsSetProviderCapabilities"] = to_class( - SessionFSSetProviderCapabilities, self.session_fs_set_provider_capabilities - ) - result["SessionFsSetProviderConventions"] = to_enum( - SessionFSSetProviderConventions, self.session_fs_set_provider_conventions - ) - result["SessionFsSetProviderRequest"] = to_class( - SessionFSSetProviderRequest, self.session_fs_set_provider_request - ) - result["SessionFsSetProviderResult"] = to_class( - SessionFSSetProviderResult, self.session_fs_set_provider_result - ) - result["SessionFsSqliteExistsRequest"] = to_class( - SessionFSSqliteExistsRequest, self.session_fs_sqlite_exists_request - ) - result["SessionFsSqliteExistsResult"] = to_class( - SessionFSSqliteExistsResult, self.session_fs_sqlite_exists_result - ) - result["SessionFsSqliteQueryRequest"] = to_class( - SessionFSSqliteQueryRequest, self.session_fs_sqlite_query_request - ) - result["SessionFsSqliteQueryResult"] = to_class( - SessionFSSqliteQueryResult, self.session_fs_sqlite_query_result - ) - result["SessionFsSqliteQueryType"] = to_enum( - SessionFSSqliteQueryType, self.session_fs_sqlite_query_type - ) - result["SessionFsStatRequest"] = to_class( - SessionFSStatRequest, self.session_fs_stat_request - ) + result["SessionFsSetProviderCapabilities"] = to_class(SessionFSSetProviderCapabilities, self.session_fs_set_provider_capabilities) + result["SessionFsSetProviderConventions"] = to_enum(SessionFSSetProviderConventions, self.session_fs_set_provider_conventions) + result["SessionFsSetProviderRequest"] = to_class(SessionFSSetProviderRequest, self.session_fs_set_provider_request) + result["SessionFsSetProviderResult"] = to_class(SessionFSSetProviderResult, self.session_fs_set_provider_result) + result["SessionFsSqliteExistsRequest"] = to_class(SessionFSSqliteExistsRequest, self.session_fs_sqlite_exists_request) + result["SessionFsSqliteExistsResult"] = to_class(SessionFSSqliteExistsResult, self.session_fs_sqlite_exists_result) + result["SessionFsSqliteQueryRequest"] = to_class(SessionFSSqliteQueryRequest, self.session_fs_sqlite_query_request) + result["SessionFsSqliteQueryResult"] = to_class(SessionFSSqliteQueryResult, self.session_fs_sqlite_query_result) + result["SessionFsSqliteQueryType"] = to_enum(SessionFSSqliteQueryType, self.session_fs_sqlite_query_type) + result["SessionFsStatRequest"] = to_class(SessionFSStatRequest, self.session_fs_stat_request) result["SessionFsStatResult"] = to_class(SessionFSStatResult, self.session_fs_stat_result) - result["SessionFsWriteFileRequest"] = to_class( - SessionFSWriteFileRequest, self.session_fs_write_file_request - ) - result["SessionInstalledPlugin"] = to_class( - SessionInstalledPlugin, self.session_installed_plugin - ) - result["SessionInstalledPluginSource"] = from_union( - [lambda x: to_class(SessionInstalledPluginSource, x), from_str], - self.session_installed_plugin_source, - ) - result["SessionInstalledPluginSourceGithub"] = to_class( - SessionInstalledPluginSourceGithub, self.session_installed_plugin_source_github - ) - result["SessionInstalledPluginSourceLocal"] = to_class( - SessionInstalledPluginSourceLocal, self.session_installed_plugin_source_local - ) - result["SessionInstalledPluginSourceUrl"] = to_class( - SessionInstalledPluginSourceURL, self.session_installed_plugin_source_url - ) + result["SessionFsWriteFileRequest"] = to_class(SessionFSWriteFileRequest, self.session_fs_write_file_request) + result["SessionInstalledPlugin"] = to_class(SessionInstalledPlugin, self.session_installed_plugin) + result["SessionInstalledPluginSource"] = from_union([lambda x: to_class(SessionInstalledPluginSource, x), from_str], self.session_installed_plugin_source) + result["SessionInstalledPluginSourceGithub"] = to_class(SessionInstalledPluginSourceGithub, self.session_installed_plugin_source_github) + result["SessionInstalledPluginSourceLocal"] = to_class(SessionInstalledPluginSourceLocal, self.session_installed_plugin_source_local) + result["SessionInstalledPluginSourceUrl"] = to_class(SessionInstalledPluginSourceURL, self.session_installed_plugin_source_url) result["SessionList"] = to_class(SessionList, self.session_list) result["SessionListFilter"] = to_class(SessionListFilter, self.session_list_filter) - result["SessionLoadDeferredRepoHooksResult"] = to_class( - SessionLoadDeferredRepoHooksResult, self.session_load_deferred_repo_hooks_result - ) + result["SessionLoadDeferredRepoHooksResult"] = to_class(SessionLoadDeferredRepoHooksResult, self.session_load_deferred_repo_hooks_result) result["SessionLogLevel"] = to_enum(SessionLogLevel, self.session_log_level) - result["SessionMcpAppsCallToolResult"] = from_dict( - lambda x: x, self.session_mcp_apps_call_tool_result - ) + result["SessionMcpAppsCallToolResult"] = from_dict(lambda x: x, self.session_mcp_apps_call_tool_result) result["SessionMetadata"] = to_class(SessionMetadata, self.session_metadata) - result["SessionMetadataSnapshot"] = to_class( - SessionMetadataSnapshot, self.session_metadata_snapshot - ) + result["SessionMetadataSnapshot"] = to_class(SessionMetadataSnapshot, self.session_metadata_snapshot) result["SessionMode"] = to_enum(SessionMode, self.session_mode) result["SessionPruneResult"] = to_class(SessionPruneResult, self.session_prune_result) - result["SessionsBulkDeleteRequest"] = to_class( - SessionsBulkDeleteRequest, self.sessions_bulk_delete_request - ) - result["SessionsCheckInUseRequest"] = to_class( - SessionsCheckInUseRequest, self.sessions_check_in_use_request - ) - result["SessionsCheckInUseResult"] = to_class( - SessionsCheckInUseResult, self.sessions_check_in_use_result - ) + result["SessionsBulkDeleteRequest"] = to_class(SessionsBulkDeleteRequest, self.sessions_bulk_delete_request) + result["SessionsCheckInUseRequest"] = to_class(SessionsCheckInUseRequest, self.sessions_check_in_use_request) + result["SessionsCheckInUseResult"] = to_class(SessionsCheckInUseResult, self.sessions_check_in_use_result) result["SessionsCloseRequest"] = to_class(SessionsCloseRequest, self.sessions_close_request) result["SessionsCloseResult"] = to_class(SessionsCloseResult, self.sessions_close_result) - result["SessionsEnrichMetadataRequest"] = to_class( - SessionsEnrichMetadataRequest, self.sessions_enrich_metadata_request - ) - result["SessionSetCredentialsParams"] = to_class( - SessionSetCredentialsParams, self.session_set_credentials_params - ) - result["SessionSetCredentialsResult"] = to_class( - SessionSetCredentialsResult, self.session_set_credentials_result - ) - result["SessionsFindByPrefixRequest"] = to_class( - SessionsFindByPrefixRequest, self.sessions_find_by_prefix_request - ) - result["SessionsFindByPrefixResult"] = to_class( - SessionsFindByPrefixResult, self.sessions_find_by_prefix_result - ) - result["SessionsFindByTaskIDRequest"] = to_class( - SessionsFindByTaskIDRequest, self.sessions_find_by_task_id_request - ) - result["SessionsFindByTaskIDResult"] = to_class( - SessionsFindByTaskIDResult, self.sessions_find_by_task_id_result - ) + result["SessionsEnrichMetadataRequest"] = to_class(SessionsEnrichMetadataRequest, self.sessions_enrich_metadata_request) + result["SessionSetCredentialsParams"] = to_class(SessionSetCredentialsParams, self.session_set_credentials_params) + result["SessionSetCredentialsResult"] = to_class(SessionSetCredentialsResult, self.session_set_credentials_result) + result["SessionsFindByPrefixRequest"] = to_class(SessionsFindByPrefixRequest, self.sessions_find_by_prefix_request) + result["SessionsFindByPrefixResult"] = to_class(SessionsFindByPrefixResult, self.sessions_find_by_prefix_result) + result["SessionsFindByTaskIDRequest"] = to_class(SessionsFindByTaskIDRequest, self.sessions_find_by_task_id_request) + result["SessionsFindByTaskIDResult"] = to_class(SessionsFindByTaskIDResult, self.sessions_find_by_task_id_result) result["SessionsForkRequest"] = to_class(SessionsForkRequest, self.sessions_fork_request) result["SessionsForkResult"] = to_class(SessionsForkResult, self.sessions_fork_result) - result["SessionsGetEventFilePathRequest"] = to_class( - SessionsGetEventFilePathRequest, self.sessions_get_event_file_path_request - ) - result["SessionsGetEventFilePathResult"] = to_class( - SessionsGetEventFilePathResult, self.sessions_get_event_file_path_result - ) - result["SessionsGetLastForContextRequest"] = to_class( - SessionsGetLastForContextRequest, self.sessions_get_last_for_context_request - ) - result["SessionsGetLastForContextResult"] = to_class( - SessionsGetLastForContextResult, self.sessions_get_last_for_context_result - ) - result["SessionsGetPersistedRemoteSteerableRequest"] = to_class( - SessionsGetPersistedRemoteSteerableRequest, - self.sessions_get_persisted_remote_steerable_request, - ) - result["SessionsGetPersistedRemoteSteerableResult"] = to_class( - SessionsGetPersistedRemoteSteerableResult, - self.sessions_get_persisted_remote_steerable_result, - ) + result["SessionsGetEventFilePathRequest"] = to_class(SessionsGetEventFilePathRequest, self.sessions_get_event_file_path_request) + result["SessionsGetEventFilePathResult"] = to_class(SessionsGetEventFilePathResult, self.sessions_get_event_file_path_result) + result["SessionsGetLastForContextRequest"] = to_class(SessionsGetLastForContextRequest, self.sessions_get_last_for_context_request) + result["SessionsGetLastForContextResult"] = to_class(SessionsGetLastForContextResult, self.sessions_get_last_for_context_result) + result["SessionsGetPersistedRemoteSteerableRequest"] = to_class(SessionsGetPersistedRemoteSteerableRequest, self.sessions_get_persisted_remote_steerable_request) + result["SessionsGetPersistedRemoteSteerableResult"] = to_class(SessionsGetPersistedRemoteSteerableResult, self.sessions_get_persisted_remote_steerable_result) result["SessionSizes"] = to_class(SessionSizes, self.session_sizes) result["SessionsListRequest"] = to_class(SessionsListRequest, self.sessions_list_request) - result["SessionsLoadDeferredRepoHooksRequest"] = to_class( - SessionsLoadDeferredRepoHooksRequest, self.sessions_load_deferred_repo_hooks_request - ) - result["SessionsPruneOldRequest"] = to_class( - SessionsPruneOldRequest, self.sessions_prune_old_request - ) - result["SessionsReleaseLockRequest"] = to_class( - SessionsReleaseLockRequest, self.sessions_release_lock_request - ) - result["SessionsReleaseLockResult"] = to_class( - SessionsReleaseLockResult, self.sessions_release_lock_result - ) - result["SessionsReloadPluginHooksRequest"] = to_class( - SessionsReloadPluginHooksRequest, self.sessions_reload_plugin_hooks_request - ) - result["SessionsReloadPluginHooksResult"] = to_class( - SessionsReloadPluginHooksResult, self.sessions_reload_plugin_hooks_result - ) + result["SessionsLoadDeferredRepoHooksRequest"] = to_class(SessionsLoadDeferredRepoHooksRequest, self.sessions_load_deferred_repo_hooks_request) + result["SessionsPruneOldRequest"] = to_class(SessionsPruneOldRequest, self.sessions_prune_old_request) + result["SessionsReleaseLockRequest"] = to_class(SessionsReleaseLockRequest, self.sessions_release_lock_request) + result["SessionsReleaseLockResult"] = to_class(SessionsReleaseLockResult, self.sessions_release_lock_result) + result["SessionsReloadPluginHooksRequest"] = to_class(SessionsReloadPluginHooksRequest, self.sessions_reload_plugin_hooks_request) + result["SessionsReloadPluginHooksResult"] = to_class(SessionsReloadPluginHooksResult, self.sessions_reload_plugin_hooks_result) result["SessionsSaveRequest"] = to_class(SessionsSaveRequest, self.sessions_save_request) result["SessionsSaveResult"] = to_class(SessionsSaveResult, self.sessions_save_result) - result["SessionsSetAdditionalPluginsRequest"] = to_class( - SessionsSetAdditionalPluginsRequest, self.sessions_set_additional_plugins_request - ) - result["SessionsSetAdditionalPluginsResult"] = to_class( - SessionsSetAdditionalPluginsResult, self.sessions_set_additional_plugins_result - ) - result["SessionUpdateOptionsParams"] = to_class( - SessionUpdateOptionsParams, self.session_update_options_params - ) - result["SessionUpdateOptionsResult"] = to_class( - SessionUpdateOptionsResult, self.session_update_options_result - ) - result["SessionWorkingDirectoryContext"] = to_class( - SessionWorkingDirectoryContext, self.session_working_directory_context - ) - result["SessionWorkingDirectoryContextHostType"] = to_enum( - HostType, self.session_working_directory_context_host_type - ) + result["SessionsSetAdditionalPluginsRequest"] = to_class(SessionsSetAdditionalPluginsRequest, self.sessions_set_additional_plugins_request) + result["SessionsSetAdditionalPluginsResult"] = to_class(SessionsSetAdditionalPluginsResult, self.sessions_set_additional_plugins_result) + result["SessionUpdateOptionsParams"] = to_class(SessionUpdateOptionsParams, self.session_update_options_params) + result["SessionUpdateOptionsResult"] = to_class(SessionUpdateOptionsResult, self.session_update_options_result) + result["SessionWorkingDirectoryContext"] = to_class(SessionWorkingDirectoryContext, self.session_working_directory_context) + result["SessionWorkingDirectoryContextHostType"] = to_enum(HostType, self.session_working_directory_context_host_type) result["ShellExecRequest"] = to_class(ShellExecRequest, self.shell_exec_request) result["ShellExecResult"] = to_class(ShellExecResult, self.shell_exec_result) result["ShellKillRequest"] = to_class(ShellKillRequest, self.shell_kill_request) @@ -20465,43 +16367,23 @@ def to_dict(self) -> dict: result["ShutdownRequest"] = to_class(ShutdownRequest, self.shutdown_request) result["Skill"] = to_class(Skill, self.skill) result["SkillList"] = to_class(SkillList, self.skill_list) - result["SkillsConfigSetDisabledSkillsRequest"] = to_class( - SkillsConfigSetDisabledSkillsRequest, self.skills_config_set_disabled_skills_request - ) + result["SkillsConfigSetDisabledSkillsRequest"] = to_class(SkillsConfigSetDisabledSkillsRequest, self.skills_config_set_disabled_skills_request) result["SkillsDisableRequest"] = to_class(SkillsDisableRequest, self.skills_disable_request) - result["SkillsDiscoverRequest"] = to_class( - SkillsDiscoverRequest, self.skills_discover_request - ) + result["SkillsDiscoverRequest"] = to_class(SkillsDiscoverRequest, self.skills_discover_request) result["SkillsEnableRequest"] = to_class(SkillsEnableRequest, self.skills_enable_request) - result["SkillsGetInvokedResult"] = to_class( - SkillsGetInvokedResult, self.skills_get_invoked_result - ) + result["SkillsGetInvokedResult"] = to_class(SkillsGetInvokedResult, self.skills_get_invoked_result) result["SkillsInvokedSkill"] = to_class(SkillsInvokedSkill, self.skills_invoked_skill) - result["SkillsLoadDiagnostics"] = to_class( - SkillsLoadDiagnostics, self.skills_load_diagnostics - ) - result["SlashCommandAgentPromptResult"] = to_class( - SlashCommandAgentPromptResult, self.slash_command_agent_prompt_result - ) - result["SlashCommandCompletedResult"] = to_class( - SlashCommandCompletedResult, self.slash_command_completed_result - ) + result["SkillsLoadDiagnostics"] = to_class(SkillsLoadDiagnostics, self.skills_load_diagnostics) + result["SlashCommandAgentPromptResult"] = to_class(SlashCommandAgentPromptResult, self.slash_command_agent_prompt_result) + result["SlashCommandCompletedResult"] = to_class(SlashCommandCompletedResult, self.slash_command_completed_result) result["SlashCommandInfo"] = to_class(SlashCommandInfo, self.slash_command_info) result["SlashCommandInput"] = to_class(SlashCommandInput, self.slash_command_input) - result["SlashCommandInputCompletion"] = to_enum( - SlashCommandInputCompletion, self.slash_command_input_completion - ) + result["SlashCommandInputCompletion"] = to_enum(SlashCommandInputCompletion, self.slash_command_input_completion) result["SlashCommandInvocationResult"] = (self.slash_command_invocation_result).to_dict() result["SlashCommandKind"] = to_enum(SlashCommandKind, self.slash_command_kind) - result["SlashCommandSelectSubcommandOption"] = to_class( - SlashCommandSelectSubcommandOption, self.slash_command_select_subcommand_option - ) - result["SlashCommandSelectSubcommandResult"] = to_class( - SlashCommandSelectSubcommandResult, self.slash_command_select_subcommand_result - ) - result["SlashCommandTextResult"] = to_class( - SlashCommandTextResult, self.slash_command_text_result - ) + result["SlashCommandSelectSubcommandOption"] = to_class(SlashCommandSelectSubcommandOption, self.slash_command_select_subcommand_option) + result["SlashCommandSelectSubcommandResult"] = to_class(SlashCommandSelectSubcommandResult, self.slash_command_select_subcommand_result) + result["SlashCommandTextResult"] = to_class(SlashCommandTextResult, self.slash_command_text_result) result["TaskAgentInfo"] = to_class(TaskAgentInfo, self.task_agent_info) result["TaskAgentProgress"] = to_class(TaskAgentProgress, self.task_agent_progress) result["TaskExecutionMode"] = to_enum(TaskExecutionMode, self.task_execution_mode) @@ -20510,592 +16392,259 @@ def to_dict(self) -> dict: result["TaskProgressLine"] = to_class(TaskProgressLine, self.task_progress_line) result["TasksCancelRequest"] = to_class(TasksCancelRequest, self.tasks_cancel_request) result["TasksCancelResult"] = to_class(TasksCancelResult, self.tasks_cancel_result) - result["TasksGetCurrentPromotableResult"] = to_class( - TasksGetCurrentPromotableResult, self.tasks_get_current_promotable_result - ) - result["TasksGetProgressRequest"] = to_class( - TasksGetProgressRequest, self.tasks_get_progress_request - ) - result["TasksGetProgressResult"] = to_class( - TasksGetProgressResult, self.tasks_get_progress_result - ) + result["TasksGetCurrentPromotableResult"] = to_class(TasksGetCurrentPromotableResult, self.tasks_get_current_promotable_result) + result["TasksGetProgressRequest"] = to_class(TasksGetProgressRequest, self.tasks_get_progress_request) + result["TasksGetProgressResult"] = to_class(TasksGetProgressResult, self.tasks_get_progress_result) result["TaskShellInfo"] = to_class(TaskShellInfo, self.task_shell_info) - result["TaskShellInfoAttachmentMode"] = to_enum( - TaskShellInfoAttachmentMode, self.task_shell_info_attachment_mode - ) + result["TaskShellInfoAttachmentMode"] = to_enum(TaskShellInfoAttachmentMode, self.task_shell_info_attachment_mode) result["TaskShellProgress"] = to_class(TaskShellProgress, self.task_shell_progress) - result["TasksPromoteCurrentToBackgroundResult"] = to_class( - TasksPromoteCurrentToBackgroundResult, self.tasks_promote_current_to_background_result - ) - result["TasksPromoteToBackgroundRequest"] = to_class( - TasksPromoteToBackgroundRequest, self.tasks_promote_to_background_request - ) - result["TasksPromoteToBackgroundResult"] = to_class( - TasksPromoteToBackgroundResult, self.tasks_promote_to_background_result - ) + result["TasksPromoteCurrentToBackgroundResult"] = to_class(TasksPromoteCurrentToBackgroundResult, self.tasks_promote_current_to_background_result) + result["TasksPromoteToBackgroundRequest"] = to_class(TasksPromoteToBackgroundRequest, self.tasks_promote_to_background_request) + result["TasksPromoteToBackgroundResult"] = to_class(TasksPromoteToBackgroundResult, self.tasks_promote_to_background_result) result["TasksRefreshResult"] = to_class(TasksRefreshResult, self.tasks_refresh_result) result["TasksRemoveRequest"] = to_class(TasksRemoveRequest, self.tasks_remove_request) result["TasksRemoveResult"] = to_class(TasksRemoveResult, self.tasks_remove_result) - result["TasksSendMessageRequest"] = to_class( - TasksSendMessageRequest, self.tasks_send_message_request - ) - result["TasksSendMessageResult"] = to_class( - TasksSendMessageResult, self.tasks_send_message_result - ) - result["TasksStartAgentRequest"] = to_class( - TasksStartAgentRequest, self.tasks_start_agent_request - ) - result["TasksStartAgentResult"] = to_class( - TasksStartAgentResult, self.tasks_start_agent_result - ) + result["TasksSendMessageRequest"] = to_class(TasksSendMessageRequest, self.tasks_send_message_request) + result["TasksSendMessageResult"] = to_class(TasksSendMessageResult, self.tasks_send_message_result) + result["TasksStartAgentRequest"] = to_class(TasksStartAgentRequest, self.tasks_start_agent_request) + result["TasksStartAgentResult"] = to_class(TasksStartAgentResult, self.tasks_start_agent_result) result["TaskStatus"] = to_enum(TaskStatus, self.task_status) - result["TasksWaitForPendingResult"] = to_class( - TasksWaitForPendingResult, self.tasks_wait_for_pending_result - ) - result["TelemetrySetFeatureOverridesRequest"] = to_class( - TelemetrySetFeatureOverridesRequest, self.telemetry_set_feature_overrides_request - ) + result["TasksWaitForPendingResult"] = to_class(TasksWaitForPendingResult, self.tasks_wait_for_pending_result) + result["TelemetrySetFeatureOverridesRequest"] = to_class(TelemetrySetFeatureOverridesRequest, self.telemetry_set_feature_overrides_request) result["TokenAuthInfo"] = to_class(TokenAuthInfo, self.token_auth_info) result["Tool"] = to_class(Tool, self.tool) result["ToolList"] = to_class(ToolList, self.tool_list) - result["ToolsInitializeAndValidateResult"] = to_class( - ToolsInitializeAndValidateResult, self.tools_initialize_and_validate_result - ) + result["ToolsInitializeAndValidateResult"] = to_class(ToolsInitializeAndValidateResult, self.tools_initialize_and_validate_result) result["ToolsListRequest"] = to_class(ToolsListRequest, self.tools_list_request) - result["UIAutoModeSwitchResponse"] = to_enum( - UIAutoModeSwitchResponse, self.ui_auto_mode_switch_response - ) - result["UIElicitationArrayAnyOfField"] = to_class( - UIElicitationArrayAnyOfField, self.ui_elicitation_array_any_of_field - ) - result["UIElicitationArrayAnyOfFieldItems"] = to_class( - UIElicitationArrayAnyOfFieldItems, self.ui_elicitation_array_any_of_field_items - ) - result["UIElicitationArrayAnyOfFieldItemsAnyOf"] = to_class( - UIElicitationArrayAnyOfFieldItemsAnyOf, - self.ui_elicitation_array_any_of_field_items_any_of, - ) - result["UIElicitationArrayEnumField"] = to_class( - UIElicitationArrayEnumField, self.ui_elicitation_array_enum_field - ) - result["UIElicitationArrayEnumFieldItems"] = to_class( - UIElicitationArrayEnumFieldItems, self.ui_elicitation_array_enum_field_items - ) - result["UIElicitationFieldValue"] = from_union( - [to_float, from_bool, lambda x: from_list(from_str, x), from_str], - self.ui_elicitation_field_value, - ) + result["UIAutoModeSwitchResponse"] = to_enum(UIAutoModeSwitchResponse, self.ui_auto_mode_switch_response) + result["UIElicitationArrayAnyOfField"] = to_class(UIElicitationArrayAnyOfField, self.ui_elicitation_array_any_of_field) + result["UIElicitationArrayAnyOfFieldItems"] = to_class(UIElicitationArrayAnyOfFieldItems, self.ui_elicitation_array_any_of_field_items) + result["UIElicitationArrayAnyOfFieldItemsAnyOf"] = to_class(UIElicitationArrayAnyOfFieldItemsAnyOf, self.ui_elicitation_array_any_of_field_items_any_of) + result["UIElicitationArrayEnumField"] = to_class(UIElicitationArrayEnumField, self.ui_elicitation_array_enum_field) + result["UIElicitationArrayEnumFieldItems"] = to_class(UIElicitationArrayEnumFieldItems, self.ui_elicitation_array_enum_field_items) + result["UIElicitationFieldValue"] = from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], self.ui_elicitation_field_value) result["UIElicitationRequest"] = to_class(UIElicitationRequest, self.ui_elicitation_request) - result["UIElicitationResponse"] = to_class( - UIElicitationResponse, self.ui_elicitation_response - ) - result["UIElicitationResponseAction"] = to_enum( - UIElicitationResponseAction, self.ui_elicitation_response_action - ) - result["UIElicitationResponseContent"] = from_dict( - lambda x: from_union( - [to_float, from_bool, lambda x: from_list(from_str, x), from_str], x - ), - self.ui_elicitation_response_content, - ) + result["UIElicitationResponse"] = to_class(UIElicitationResponse, self.ui_elicitation_response) + result["UIElicitationResponseAction"] = to_enum(UIElicitationResponseAction, self.ui_elicitation_response_action) + result["UIElicitationResponseContent"] = from_dict(lambda x: from_union([to_float, from_bool, lambda x: from_list(from_str, x), from_str], x), self.ui_elicitation_response_content) result["UIElicitationResult"] = to_class(UIElicitationResult, self.ui_elicitation_result) result["UIElicitationSchema"] = to_class(UIElicitationSchema, self.ui_elicitation_schema) - result["UIElicitationSchemaProperty"] = to_class( - UIElicitationSchemaProperty, self.ui_elicitation_schema_property - ) - result["UIElicitationSchemaPropertyBoolean"] = to_class( - UIElicitationSchemaPropertyBoolean, self.ui_elicitation_schema_property_boolean - ) - result["UIElicitationSchemaPropertyNumber"] = to_class( - UIElicitationSchemaPropertyNumber, self.ui_elicitation_schema_property_number - ) - result["UIElicitationSchemaPropertyNumberType"] = to_enum( - UIElicitationSchemaPropertyNumberType, self.ui_elicitation_schema_property_number_type - ) - result["UIElicitationSchemaPropertyString"] = to_class( - UIElicitationSchemaPropertyString, self.ui_elicitation_schema_property_string - ) - result["UIElicitationSchemaPropertyStringFormat"] = to_enum( - UIElicitationSchemaPropertyStringFormat, - self.ui_elicitation_schema_property_string_format, - ) - result["UIElicitationStringEnumField"] = to_class( - UIElicitationStringEnumField, self.ui_elicitation_string_enum_field - ) - result["UIElicitationStringOneOfField"] = to_class( - UIElicitationStringOneOfField, self.ui_elicitation_string_one_of_field - ) - result["UIElicitationStringOneOfFieldOneOf"] = to_class( - UIElicitationStringOneOfFieldOneOf, self.ui_elicitation_string_one_of_field_one_of - ) - result["UIExitPlanModeAction"] = to_enum( - UIExitPlanModeAction, self.ui_exit_plan_mode_action - ) - result["UIExitPlanModeResponse"] = to_class( - UIExitPlanModeResponse, self.ui_exit_plan_mode_response - ) - result["UIHandlePendingAutoModeSwitchRequest"] = to_class( - UIHandlePendingAutoModeSwitchRequest, self.ui_handle_pending_auto_mode_switch_request - ) - result["UIHandlePendingElicitationRequest"] = to_class( - UIHandlePendingElicitationRequest, self.ui_handle_pending_elicitation_request - ) - result["UIHandlePendingExitPlanModeRequest"] = to_class( - UIHandlePendingExitPlanModeRequest, self.ui_handle_pending_exit_plan_mode_request - ) - result["UIHandlePendingResult"] = to_class( - UIHandlePendingResult, self.ui_handle_pending_result - ) - result["UIHandlePendingSamplingRequest"] = to_class( - UIHandlePendingSamplingRequest, self.ui_handle_pending_sampling_request - ) - result["UIHandlePendingSamplingResponse"] = from_dict( - lambda x: x, self.ui_handle_pending_sampling_response - ) - result["UIHandlePendingUserInputRequest"] = to_class( - UIHandlePendingUserInputRequest, self.ui_handle_pending_user_input_request - ) - result["UIRegisterDirectAutoModeSwitchHandlerResult"] = to_class( - UIRegisterDirectAutoModeSwitchHandlerResult, - self.ui_register_direct_auto_mode_switch_handler_result, - ) - result["UIUnregisterDirectAutoModeSwitchHandlerRequest"] = to_class( - UIUnregisterDirectAutoModeSwitchHandlerRequest, - self.ui_unregister_direct_auto_mode_switch_handler_request, - ) - result["UIUnregisterDirectAutoModeSwitchHandlerResult"] = to_class( - UIUnregisterDirectAutoModeSwitchHandlerResult, - self.ui_unregister_direct_auto_mode_switch_handler_result, - ) + result["UIElicitationSchemaProperty"] = to_class(UIElicitationSchemaProperty, self.ui_elicitation_schema_property) + result["UIElicitationSchemaPropertyBoolean"] = to_class(UIElicitationSchemaPropertyBoolean, self.ui_elicitation_schema_property_boolean) + result["UIElicitationSchemaPropertyNumber"] = to_class(UIElicitationSchemaPropertyNumber, self.ui_elicitation_schema_property_number) + result["UIElicitationSchemaPropertyNumberType"] = to_enum(UIElicitationSchemaPropertyNumberType, self.ui_elicitation_schema_property_number_type) + result["UIElicitationSchemaPropertyString"] = to_class(UIElicitationSchemaPropertyString, self.ui_elicitation_schema_property_string) + result["UIElicitationSchemaPropertyStringFormat"] = to_enum(UIElicitationSchemaPropertyStringFormat, self.ui_elicitation_schema_property_string_format) + result["UIElicitationStringEnumField"] = to_class(UIElicitationStringEnumField, self.ui_elicitation_string_enum_field) + result["UIElicitationStringOneOfField"] = to_class(UIElicitationStringOneOfField, self.ui_elicitation_string_one_of_field) + result["UIElicitationStringOneOfFieldOneOf"] = to_class(UIElicitationStringOneOfFieldOneOf, self.ui_elicitation_string_one_of_field_one_of) + result["UIExitPlanModeAction"] = to_enum(UIExitPlanModeAction, self.ui_exit_plan_mode_action) + result["UIExitPlanModeResponse"] = to_class(UIExitPlanModeResponse, self.ui_exit_plan_mode_response) + result["UIHandlePendingAutoModeSwitchRequest"] = to_class(UIHandlePendingAutoModeSwitchRequest, self.ui_handle_pending_auto_mode_switch_request) + result["UIHandlePendingElicitationRequest"] = to_class(UIHandlePendingElicitationRequest, self.ui_handle_pending_elicitation_request) + result["UIHandlePendingExitPlanModeRequest"] = to_class(UIHandlePendingExitPlanModeRequest, self.ui_handle_pending_exit_plan_mode_request) + result["UIHandlePendingResult"] = to_class(UIHandlePendingResult, self.ui_handle_pending_result) + result["UIHandlePendingSamplingRequest"] = to_class(UIHandlePendingSamplingRequest, self.ui_handle_pending_sampling_request) + result["UIHandlePendingSamplingResponse"] = from_dict(lambda x: x, self.ui_handle_pending_sampling_response) + result["UIHandlePendingUserInputRequest"] = to_class(UIHandlePendingUserInputRequest, self.ui_handle_pending_user_input_request) + result["UIRegisterDirectAutoModeSwitchHandlerResult"] = to_class(UIRegisterDirectAutoModeSwitchHandlerResult, self.ui_register_direct_auto_mode_switch_handler_result) + result["UIUnregisterDirectAutoModeSwitchHandlerRequest"] = to_class(UIUnregisterDirectAutoModeSwitchHandlerRequest, self.ui_unregister_direct_auto_mode_switch_handler_request) + result["UIUnregisterDirectAutoModeSwitchHandlerResult"] = to_class(UIUnregisterDirectAutoModeSwitchHandlerResult, self.ui_unregister_direct_auto_mode_switch_handler_result) result["UIUserInputResponse"] = to_class(UIUserInputResponse, self.ui_user_input_response) - result["UsageGetMetricsResult"] = to_class( - UsageGetMetricsResult, self.usage_get_metrics_result - ) - result["UsageMetricsCodeChanges"] = to_class( - UsageMetricsCodeChanges, self.usage_metrics_code_changes - ) - result["UsageMetricsModelMetric"] = to_class( - UsageMetricsModelMetric, self.usage_metrics_model_metric - ) - result["UsageMetricsModelMetricRequests"] = to_class( - UsageMetricsModelMetricRequests, self.usage_metrics_model_metric_requests - ) - result["UsageMetricsModelMetricTokenDetail"] = to_class( - UsageMetricsModelMetricTokenDetail, self.usage_metrics_model_metric_token_detail - ) - result["UsageMetricsModelMetricUsage"] = to_class( - UsageMetricsModelMetricUsage, self.usage_metrics_model_metric_usage - ) - result["UsageMetricsTokenDetail"] = to_class( - UsageMetricsTokenDetail, self.usage_metrics_token_detail - ) + result["UsageGetMetricsResult"] = to_class(UsageGetMetricsResult, self.usage_get_metrics_result) + result["UsageMetricsCodeChanges"] = to_class(UsageMetricsCodeChanges, self.usage_metrics_code_changes) + result["UsageMetricsModelMetric"] = to_class(UsageMetricsModelMetric, self.usage_metrics_model_metric) + result["UsageMetricsModelMetricRequests"] = to_class(UsageMetricsModelMetricRequests, self.usage_metrics_model_metric_requests) + result["UsageMetricsModelMetricTokenDetail"] = to_class(UsageMetricsModelMetricTokenDetail, self.usage_metrics_model_metric_token_detail) + result["UsageMetricsModelMetricUsage"] = to_class(UsageMetricsModelMetricUsage, self.usage_metrics_model_metric_usage) + result["UsageMetricsTokenDetail"] = to_class(UsageMetricsTokenDetail, self.usage_metrics_token_detail) result["UserAuthInfo"] = to_class(UserAuthInfo, self.user_auth_info) - result["WorkspaceDiffFileChange"] = to_class( - WorkspaceDiffFileChange, self.workspace_diff_file_change - ) - result["WorkspaceDiffFileChangeType"] = to_enum( - WorkspaceDiffFileChangeType, self.workspace_diff_file_change_type - ) + result["WorkspaceDiffFileChange"] = to_class(WorkspaceDiffFileChange, self.workspace_diff_file_change) + result["WorkspaceDiffFileChangeType"] = to_enum(WorkspaceDiffFileChangeType, self.workspace_diff_file_change_type) result["WorkspaceDiffMode"] = to_enum(WorkspaceDiffMode, self.workspace_diff_mode) result["WorkspaceDiffResult"] = to_class(WorkspaceDiffResult, self.workspace_diff_result) - result["WorkspacesCheckpoints"] = to_class( - WorkspacesCheckpoints, self.workspaces_checkpoints - ) - result["WorkspacesCreateFileRequest"] = to_class( - WorkspacesCreateFileRequest, self.workspaces_create_file_request - ) - result["WorkspacesDiffRequest"] = to_class( - WorkspacesDiffRequest, self.workspaces_diff_request - ) - result["WorkspacesGetWorkspaceResult"] = to_class( - WorkspacesGetWorkspaceResult, self.workspaces_get_workspace_result - ) - result["WorkspacesListCheckpointsResult"] = to_class( - WorkspacesListCheckpointsResult, self.workspaces_list_checkpoints_result - ) - result["WorkspacesListFilesResult"] = to_class( - WorkspacesListFilesResult, self.workspaces_list_files_result - ) - result["WorkspacesReadCheckpointRequest"] = to_class( - WorkspacesReadCheckpointRequest, self.workspaces_read_checkpoint_request - ) - result["WorkspacesReadCheckpointResult"] = to_class( - WorkspacesReadCheckpointResult, self.workspaces_read_checkpoint_result - ) - result["WorkspacesReadFileRequest"] = to_class( - WorkspacesReadFileRequest, self.workspaces_read_file_request - ) - result["WorkspacesReadFileResult"] = to_class( - WorkspacesReadFileResult, self.workspaces_read_file_result - ) - result["WorkspacesSaveLargePasteRequest"] = to_class( - WorkspacesSaveLargePasteRequest, self.workspaces_save_large_paste_request - ) - result["WorkspacesSaveLargePasteResult"] = to_class( - WorkspacesSaveLargePasteResult, self.workspaces_save_large_paste_result - ) + result["WorkspacesCheckpoints"] = to_class(WorkspacesCheckpoints, self.workspaces_checkpoints) + result["WorkspacesCreateFileRequest"] = to_class(WorkspacesCreateFileRequest, self.workspaces_create_file_request) + result["WorkspacesDiffRequest"] = to_class(WorkspacesDiffRequest, self.workspaces_diff_request) + result["WorkspacesGetWorkspaceResult"] = to_class(WorkspacesGetWorkspaceResult, self.workspaces_get_workspace_result) + result["WorkspacesListCheckpointsResult"] = to_class(WorkspacesListCheckpointsResult, self.workspaces_list_checkpoints_result) + result["WorkspacesListFilesResult"] = to_class(WorkspacesListFilesResult, self.workspaces_list_files_result) + result["WorkspacesReadCheckpointRequest"] = to_class(WorkspacesReadCheckpointRequest, self.workspaces_read_checkpoint_request) + result["WorkspacesReadCheckpointResult"] = to_class(WorkspacesReadCheckpointResult, self.workspaces_read_checkpoint_result) + result["WorkspacesReadFileRequest"] = to_class(WorkspacesReadFileRequest, self.workspaces_read_file_request) + result["WorkspacesReadFileResult"] = to_class(WorkspacesReadFileResult, self.workspaces_read_file_result) + result["WorkspacesSaveLargePasteRequest"] = to_class(WorkspacesSaveLargePasteRequest, self.workspaces_save_large_paste_request) + result["WorkspacesSaveLargePasteResult"] = to_class(WorkspacesSaveLargePasteResult, self.workspaces_save_large_paste_result) result["WorkspaceSummaryHostType"] = to_enum(HostType, self.workspace_summary_host_type) - result["WorkspacesWorkspaceDetailsHostType"] = to_enum( - HostType, self.workspaces_workspace_details_host_type - ) - result["SessionContextInfo"] = from_union( - [lambda x: to_class(SessionContextInfo, x), from_none], self.session_context_info - ) - result["TaskProgress"] = from_union( - [lambda x: to_class(TaskProgress, x), from_none], self.task_progress - ) - result["WorkspaceSummary"] = from_union( - [lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace_summary - ) + result["WorkspacesWorkspaceDetailsHostType"] = to_enum(HostType, self.workspaces_workspace_details_host_type) + result["SessionContextInfo"] = from_union([lambda x: to_class(SessionContextInfo, x), from_none], self.session_context_info) + result["TaskProgress"] = from_union([lambda x: to_class(TaskProgress, x), from_none], self.task_progress) + result["WorkspaceSummary"] = from_union([lambda x: to_class(WorkspaceSummary, x), from_none], self.workspace_summary) return result - def rpc_from_dict(s: Any) -> RPC: return RPC.from_dict(s) - def rpc_to_dict(x: RPC) -> Any: return to_class(RPC, x) - # The new auth credentials to install on the session. When omitted or `undefined`, the call is a no-op and the session's existing credentials are preserved. The runtime stores the value verbatim and uses it for outbound model/API requests; it does NOT re-validate or re-fetch the associated Copilot user response. Several variants carry secret material; treat this method's params as containing secrets at rest and in transit. -AuthInfo = ( - HMACAuthInfo - | EnvAuthInfo - | TokenAuthInfo - | CopilotAPITokenAuthInfo - | UserAuthInfo - | GhCLIAuthInfo - | APIKeyAuthInfo -) - +AuthInfo = HMACAuthInfo | EnvAuthInfo | TokenAuthInfo | CopilotAPITokenAuthInfo | UserAuthInfo | GhCLIAuthInfo | APIKeyAuthInfo def _load_AuthInfo(obj: Any) -> "AuthInfo": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "hmac": - return HMACAuthInfo.from_dict(obj) - case "env": - return EnvAuthInfo.from_dict(obj) - case "token": - return TokenAuthInfo.from_dict(obj) - case "copilot-api-token": - return CopilotAPITokenAuthInfo.from_dict(obj) - case "user": - return UserAuthInfo.from_dict(obj) - case "gh-cli": - return GhCLIAuthInfo.from_dict(obj) - case "api-key": - return APIKeyAuthInfo.from_dict(obj) - case _: - raise ValueError(f"Unknown AuthInfo type: {kind!r}") - + case "hmac": return HMACAuthInfo.from_dict(obj) + case "env": return EnvAuthInfo.from_dict(obj) + case "token": return TokenAuthInfo.from_dict(obj) + case "copilot-api-token": return CopilotAPITokenAuthInfo.from_dict(obj) + case "user": return UserAuthInfo.from_dict(obj) + case "gh-cli": return GhCLIAuthInfo.from_dict(obj) + case "api-key": return APIKeyAuthInfo.from_dict(obj) + case _: raise ValueError(f"Unknown AuthInfo type: {kind!r}") # A content block within a tool result, which may be text, terminal output, image, audio, or a resource -ExternalToolTextResultForLlmContent = ( - ExternalToolTextResultForLlmContentText - | ExternalToolTextResultForLlmContentTerminal - | ExternalToolTextResultForLlmContentImage - | ExternalToolTextResultForLlmContentAudio - | ExternalToolTextResultForLlmContentResourceLink - | ExternalToolTextResultForLlmContentResource -) - +ExternalToolTextResultForLlmContent = ExternalToolTextResultForLlmContentText | ExternalToolTextResultForLlmContentTerminal | ExternalToolTextResultForLlmContentImage | ExternalToolTextResultForLlmContentAudio | ExternalToolTextResultForLlmContentResourceLink | ExternalToolTextResultForLlmContentResource def _load_ExternalToolTextResultForLlmContent(obj: Any) -> "ExternalToolTextResultForLlmContent": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "text": - return ExternalToolTextResultForLlmContentText.from_dict(obj) - case "terminal": - return ExternalToolTextResultForLlmContentTerminal.from_dict(obj) - case "image": - return ExternalToolTextResultForLlmContentImage.from_dict(obj) - case "audio": - return ExternalToolTextResultForLlmContentAudio.from_dict(obj) - case "resource_link": - return ExternalToolTextResultForLlmContentResourceLink.from_dict(obj) - case "resource": - return ExternalToolTextResultForLlmContentResource.from_dict(obj) - case _: - raise ValueError(f"Unknown ExternalToolTextResultForLlmContent type: {kind!r}") - + case "text": return ExternalToolTextResultForLlmContentText.from_dict(obj) + case "terminal": return ExternalToolTextResultForLlmContentTerminal.from_dict(obj) + case "image": return ExternalToolTextResultForLlmContentImage.from_dict(obj) + case "audio": return ExternalToolTextResultForLlmContentAudio.from_dict(obj) + case "resource_link": return ExternalToolTextResultForLlmContentResourceLink.from_dict(obj) + case "resource": return ExternalToolTextResultForLlmContentResource.from_dict(obj) + case _: raise ValueError(f"Unknown ExternalToolTextResultForLlmContent type: {kind!r}") # The client's response to the pending permission prompt -PermissionDecision = ( - PermissionDecisionApproveOnce - | PermissionDecisionApproveForSession - | PermissionDecisionApproveForLocation - | PermissionDecisionApprovePermanently - | PermissionDecisionReject - | PermissionDecisionUserNotAvailable - | PermissionDecisionApproved - | PermissionDecisionApprovedForSession - | PermissionDecisionApprovedForLocation - | PermissionDecisionCancelled - | PermissionDecisionDeniedByRules - | PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser - | PermissionDecisionDeniedInteractivelyByUser - | PermissionDecisionDeniedByContentExclusionPolicy - | PermissionDecisionDeniedByPermissionRequestHook -) - +PermissionDecision = PermissionDecisionApproveOnce | PermissionDecisionApproveForSession | PermissionDecisionApproveForLocation | PermissionDecisionApprovePermanently | PermissionDecisionReject | PermissionDecisionUserNotAvailable | PermissionDecisionApproved | PermissionDecisionApprovedForSession | PermissionDecisionApprovedForLocation | PermissionDecisionCancelled | PermissionDecisionDeniedByRules | PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser | PermissionDecisionDeniedInteractivelyByUser | PermissionDecisionDeniedByContentExclusionPolicy | PermissionDecisionDeniedByPermissionRequestHook def _load_PermissionDecision(obj: Any) -> "PermissionDecision": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "approve-once": - return PermissionDecisionApproveOnce.from_dict(obj) - case "approve-for-session": - return PermissionDecisionApproveForSession.from_dict(obj) - case "approve-for-location": - return PermissionDecisionApproveForLocation.from_dict(obj) - case "approve-permanently": - return PermissionDecisionApprovePermanently.from_dict(obj) - case "reject": - return PermissionDecisionReject.from_dict(obj) - case "user-not-available": - return PermissionDecisionUserNotAvailable.from_dict(obj) - case "approved": - return PermissionDecisionApproved.from_dict(obj) - case "approved-for-session": - return PermissionDecisionApprovedForSession.from_dict(obj) - case "approved-for-location": - return PermissionDecisionApprovedForLocation.from_dict(obj) - case "cancelled": - return PermissionDecisionCancelled.from_dict(obj) - case "denied-by-rules": - return PermissionDecisionDeniedByRules.from_dict(obj) - case "denied-no-approval-rule-and-could-not-request-from-user": - return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj) - case "denied-interactively-by-user": - return PermissionDecisionDeniedInteractivelyByUser.from_dict(obj) - case "denied-by-content-exclusion-policy": - return PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj) - case "denied-by-permission-request-hook": - return PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj) - case _: - raise ValueError(f"Unknown PermissionDecision kind: {kind!r}") - + case "approve-once": return PermissionDecisionApproveOnce.from_dict(obj) + case "approve-for-session": return PermissionDecisionApproveForSession.from_dict(obj) + case "approve-for-location": return PermissionDecisionApproveForLocation.from_dict(obj) + case "approve-permanently": return PermissionDecisionApprovePermanently.from_dict(obj) + case "reject": return PermissionDecisionReject.from_dict(obj) + case "user-not-available": return PermissionDecisionUserNotAvailable.from_dict(obj) + case "approved": return PermissionDecisionApproved.from_dict(obj) + case "approved-for-session": return PermissionDecisionApprovedForSession.from_dict(obj) + case "approved-for-location": return PermissionDecisionApprovedForLocation.from_dict(obj) + case "cancelled": return PermissionDecisionCancelled.from_dict(obj) + case "denied-by-rules": return PermissionDecisionDeniedByRules.from_dict(obj) + case "denied-no-approval-rule-and-could-not-request-from-user": return PermissionDecisionDeniedNoApprovalRuleAndCouldNotRequestFromUser.from_dict(obj) + case "denied-interactively-by-user": return PermissionDecisionDeniedInteractivelyByUser.from_dict(obj) + case "denied-by-content-exclusion-policy": return PermissionDecisionDeniedByContentExclusionPolicy.from_dict(obj) + case "denied-by-permission-request-hook": return PermissionDecisionDeniedByPermissionRequestHook.from_dict(obj) + case _: raise ValueError(f"Unknown PermissionDecision kind: {kind!r}") # Approval to persist for this location -PermissionDecisionApproveForLocationApproval = ( - PermissionDecisionApproveForLocationApprovalCommands - | PermissionDecisionApproveForLocationApprovalRead - | PermissionDecisionApproveForLocationApprovalWrite - | PermissionDecisionApproveForLocationApprovalMCP - | PermissionDecisionApproveForLocationApprovalMCPSampling - | PermissionDecisionApproveForLocationApprovalMemory - | PermissionDecisionApproveForLocationApprovalCustomTool - | PermissionDecisionApproveForLocationApprovalExtensionManagement - | PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess -) - - -def _load_PermissionDecisionApproveForLocationApproval( - obj: Any, -) -> "PermissionDecisionApproveForLocationApproval": +PermissionDecisionApproveForLocationApproval = PermissionDecisionApproveForLocationApprovalCommands | PermissionDecisionApproveForLocationApprovalRead | PermissionDecisionApproveForLocationApprovalWrite | PermissionDecisionApproveForLocationApprovalMCP | PermissionDecisionApproveForLocationApprovalMCPSampling | PermissionDecisionApproveForLocationApprovalMemory | PermissionDecisionApproveForLocationApprovalCustomTool | PermissionDecisionApproveForLocationApprovalExtensionManagement | PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess + +def _load_PermissionDecisionApproveForLocationApproval(obj: Any) -> "PermissionDecisionApproveForLocationApproval": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "commands": - return PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj) - case "read": - return PermissionDecisionApproveForLocationApprovalRead.from_dict(obj) - case "write": - return PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj) - case "mcp": - return PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj) - case "mcp-sampling": - return PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj) - case "memory": - return PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj) - case "custom-tool": - return PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj) - case "extension-management": - return PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj) - case "extension-permission-access": - return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict( - obj - ) - case _: - raise ValueError(f"Unknown PermissionDecisionApproveForLocationApproval kind: {kind!r}") - + case "commands": return PermissionDecisionApproveForLocationApprovalCommands.from_dict(obj) + case "read": return PermissionDecisionApproveForLocationApprovalRead.from_dict(obj) + case "write": return PermissionDecisionApproveForLocationApprovalWrite.from_dict(obj) + case "mcp": return PermissionDecisionApproveForLocationApprovalMCP.from_dict(obj) + case "mcp-sampling": return PermissionDecisionApproveForLocationApprovalMCPSampling.from_dict(obj) + case "memory": return PermissionDecisionApproveForLocationApprovalMemory.from_dict(obj) + case "custom-tool": return PermissionDecisionApproveForLocationApprovalCustomTool.from_dict(obj) + case "extension-management": return PermissionDecisionApproveForLocationApprovalExtensionManagement.from_dict(obj) + case "extension-permission-access": return PermissionDecisionApproveForLocationApprovalExtensionPermissionAccess.from_dict(obj) + case _: raise ValueError(f"Unknown PermissionDecisionApproveForLocationApproval kind: {kind!r}") # Session-scoped approval to remember (tool prompts only; omitted for path/url prompts) -PermissionDecisionApproveForSessionApproval = ( - PermissionDecisionApproveForSessionApprovalCommands - | PermissionDecisionApproveForSessionApprovalRead - | PermissionDecisionApproveForSessionApprovalWrite - | PermissionDecisionApproveForSessionApprovalMCP - | PermissionDecisionApproveForSessionApprovalMCPSampling - | PermissionDecisionApproveForSessionApprovalMemory - | PermissionDecisionApproveForSessionApprovalCustomTool - | PermissionDecisionApproveForSessionApprovalExtensionManagement - | PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess -) - - -def _load_PermissionDecisionApproveForSessionApproval( - obj: Any, -) -> "PermissionDecisionApproveForSessionApproval": +PermissionDecisionApproveForSessionApproval = PermissionDecisionApproveForSessionApprovalCommands | PermissionDecisionApproveForSessionApprovalRead | PermissionDecisionApproveForSessionApprovalWrite | PermissionDecisionApproveForSessionApprovalMCP | PermissionDecisionApproveForSessionApprovalMCPSampling | PermissionDecisionApproveForSessionApprovalMemory | PermissionDecisionApproveForSessionApprovalCustomTool | PermissionDecisionApproveForSessionApprovalExtensionManagement | PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess + +def _load_PermissionDecisionApproveForSessionApproval(obj: Any) -> "PermissionDecisionApproveForSessionApproval": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "commands": - return PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj) - case "read": - return PermissionDecisionApproveForSessionApprovalRead.from_dict(obj) - case "write": - return PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj) - case "mcp": - return PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj) - case "mcp-sampling": - return PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj) - case "memory": - return PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj) - case "custom-tool": - return PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj) - case "extension-management": - return PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj) - case "extension-permission-access": - return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict( - obj - ) - case _: - raise ValueError(f"Unknown PermissionDecisionApproveForSessionApproval kind: {kind!r}") - + case "commands": return PermissionDecisionApproveForSessionApprovalCommands.from_dict(obj) + case "read": return PermissionDecisionApproveForSessionApprovalRead.from_dict(obj) + case "write": return PermissionDecisionApproveForSessionApprovalWrite.from_dict(obj) + case "mcp": return PermissionDecisionApproveForSessionApprovalMCP.from_dict(obj) + case "mcp-sampling": return PermissionDecisionApproveForSessionApprovalMCPSampling.from_dict(obj) + case "memory": return PermissionDecisionApproveForSessionApprovalMemory.from_dict(obj) + case "custom-tool": return PermissionDecisionApproveForSessionApprovalCustomTool.from_dict(obj) + case "extension-management": return PermissionDecisionApproveForSessionApprovalExtensionManagement.from_dict(obj) + case "extension-permission-access": return PermissionDecisionApproveForSessionApprovalExtensionPermissionAccess.from_dict(obj) + case _: raise ValueError(f"Unknown PermissionDecisionApproveForSessionApproval kind: {kind!r}") # Tool approval to persist and apply -PermissionsLocationsAddToolApprovalDetails = ( - PermissionsLocationsAddToolApprovalDetailsCommands - | PermissionsLocationsAddToolApprovalDetailsRead - | PermissionsLocationsAddToolApprovalDetailsWrite - | PermissionsLocationsAddToolApprovalDetailsMCP - | PermissionsLocationsAddToolApprovalDetailsMCPSampling - | PermissionsLocationsAddToolApprovalDetailsMemory - | PermissionsLocationsAddToolApprovalDetailsCustomTool - | PermissionsLocationsAddToolApprovalDetailsExtensionManagement - | PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess -) - - -def _load_PermissionsLocationsAddToolApprovalDetails( - obj: Any, -) -> "PermissionsLocationsAddToolApprovalDetails": +PermissionsLocationsAddToolApprovalDetails = PermissionsLocationsAddToolApprovalDetailsCommands | PermissionsLocationsAddToolApprovalDetailsRead | PermissionsLocationsAddToolApprovalDetailsWrite | PermissionsLocationsAddToolApprovalDetailsMCP | PermissionsLocationsAddToolApprovalDetailsMCPSampling | PermissionsLocationsAddToolApprovalDetailsMemory | PermissionsLocationsAddToolApprovalDetailsCustomTool | PermissionsLocationsAddToolApprovalDetailsExtensionManagement | PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess + +def _load_PermissionsLocationsAddToolApprovalDetails(obj: Any) -> "PermissionsLocationsAddToolApprovalDetails": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "commands": - return PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj) - case "read": - return PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj) - case "write": - return PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj) - case "mcp": - return PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj) - case "mcp-sampling": - return PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj) - case "memory": - return PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj) - case "custom-tool": - return PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj) - case "extension-management": - return PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj) - case "extension-permission-access": - return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict( - obj - ) - case _: - raise ValueError(f"Unknown PermissionsLocationsAddToolApprovalDetails kind: {kind!r}") - + case "commands": return PermissionsLocationsAddToolApprovalDetailsCommands.from_dict(obj) + case "read": return PermissionsLocationsAddToolApprovalDetailsRead.from_dict(obj) + case "write": return PermissionsLocationsAddToolApprovalDetailsWrite.from_dict(obj) + case "mcp": return PermissionsLocationsAddToolApprovalDetailsMCP.from_dict(obj) + case "mcp-sampling": return PermissionsLocationsAddToolApprovalDetailsMCPSampling.from_dict(obj) + case "memory": return PermissionsLocationsAddToolApprovalDetailsMemory.from_dict(obj) + case "custom-tool": return PermissionsLocationsAddToolApprovalDetailsCustomTool.from_dict(obj) + case "extension-management": return PermissionsLocationsAddToolApprovalDetailsExtensionManagement.from_dict(obj) + case "extension-permission-access": return PermissionsLocationsAddToolApprovalDetailsExtensionPermissionAccess.from_dict(obj) + case _: raise ValueError(f"Unknown PermissionsLocationsAddToolApprovalDetails kind: {kind!r}") # Result of the queued command execution. QueuedCommandResult = QueuedCommandHandled | QueuedCommandNotHandled - def _load_QueuedCommandResult(obj: Any) -> "QueuedCommandResult": assert isinstance(obj, dict) kind = obj.get("handled") match kind: - case "true": - return QueuedCommandHandled.from_dict(obj) - case "false": - return QueuedCommandNotHandled.from_dict(obj) - case _: - raise ValueError(f"Unknown QueuedCommandResult handled: {kind!r}") - + case "true": return QueuedCommandHandled.from_dict(obj) + case "false": return QueuedCommandNotHandled.from_dict(obj) + case _: raise ValueError(f"Unknown QueuedCommandResult handled: {kind!r}") # A user message attachment — a file, directory, code selection, blob, or GitHub reference -SendAttachment = ( - SendAttachmentFile - | SendAttachmentDirectory - | SendAttachmentSelection - | SendAttachmentGithubReference - | SendAttachmentBlob -) - +SendAttachment = SendAttachmentFile | SendAttachmentDirectory | SendAttachmentSelection | SendAttachmentGithubReference | SendAttachmentBlob def _load_SendAttachment(obj: Any) -> "SendAttachment": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "file": - return SendAttachmentFile.from_dict(obj) - case "directory": - return SendAttachmentDirectory.from_dict(obj) - case "selection": - return SendAttachmentSelection.from_dict(obj) - case "github_reference": - return SendAttachmentGithubReference.from_dict(obj) - case "blob": - return SendAttachmentBlob.from_dict(obj) - case _: - raise ValueError(f"Unknown SendAttachment type: {kind!r}") - + case "file": return SendAttachmentFile.from_dict(obj) + case "directory": return SendAttachmentDirectory.from_dict(obj) + case "selection": return SendAttachmentSelection.from_dict(obj) + case "github_reference": return SendAttachmentGithubReference.from_dict(obj) + case "blob": return SendAttachmentBlob.from_dict(obj) + case _: raise ValueError(f"Unknown SendAttachment type: {kind!r}") # Result of invoking the slash command (text output, prompt to send to the agent, or completion). -SlashCommandInvocationResult = ( - SlashCommandTextResult - | SlashCommandAgentPromptResult - | SlashCommandCompletedResult - | SlashCommandSelectSubcommandResult -) - +SlashCommandInvocationResult = SlashCommandTextResult | SlashCommandAgentPromptResult | SlashCommandCompletedResult | SlashCommandSelectSubcommandResult def _load_SlashCommandInvocationResult(obj: Any) -> "SlashCommandInvocationResult": assert isinstance(obj, dict) kind = obj.get("kind") match kind: - case "text": - return SlashCommandTextResult.from_dict(obj) - case "agent-prompt": - return SlashCommandAgentPromptResult.from_dict(obj) - case "completed": - return SlashCommandCompletedResult.from_dict(obj) - case "select-subcommand": - return SlashCommandSelectSubcommandResult.from_dict(obj) - case _: - raise ValueError(f"Unknown SlashCommandInvocationResult kind: {kind!r}") - + case "text": return SlashCommandTextResult.from_dict(obj) + case "agent-prompt": return SlashCommandAgentPromptResult.from_dict(obj) + case "completed": return SlashCommandCompletedResult.from_dict(obj) + case "select-subcommand": return SlashCommandSelectSubcommandResult.from_dict(obj) + case _: raise ValueError(f"Unknown SlashCommandInvocationResult kind: {kind!r}") # Schema for the `TaskInfo` type. TaskInfo = TaskAgentInfo | TaskShellInfo - def _load_TaskInfo(obj: Any) -> "TaskInfo": assert isinstance(obj, dict) kind = obj.get("type") match kind: - case "agent": - return TaskAgentInfo.from_dict(obj) - case "shell": - return TaskShellInfo.from_dict(obj) - case _: - raise ValueError(f"Unknown TaskInfo type: {kind!r}") + case "agent": return TaskAgentInfo.from_dict(obj) + case "shell": return TaskShellInfo.from_dict(obj) + case _: raise ValueError(f"Unknown TaskInfo type: {kind!r}") CanvasInvokeActionResult = Any @@ -21121,14 +16670,12 @@ def _load_TaskInfo(obj: Any) -> "TaskInfo": WorkspaceSummaryHostType = HostType WorkspacesWorkspaceDetailsHostType = HostType - def _timeout_kwargs(timeout: float | None) -> dict: """Build keyword arguments for optional timeout forwarding.""" if timeout is not None: return {"timeout": timeout} return {} - def _patch_model_capabilities(data: dict) -> dict: """Ensure model capabilities have required fields. @@ -21158,11 +16705,7 @@ def __init__(self, client: "JsonRpcClient"): async def list(self, params: ModelsListRequest, *, timeout: float | None = None) -> ModelList: "Lists Copilot models available to the authenticated user.\n\nArgs:\n params: Optional GitHub token used to list models for a specific user instead of the global auth context.\n\nReturns:\n List of Copilot models available to the resolved user, including capabilities and billing metadata." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return ModelList.from_dict( - _patch_model_capabilities( - await self._client.request("models.list", params_dict, **_timeout_kwargs(timeout)) - ) - ) + return ModelList.from_dict(_patch_model_capabilities(await self._client.request("models.list", params_dict, **_timeout_kwargs(timeout)))) class ServerToolsApi: @@ -21172,39 +16715,27 @@ def __init__(self, client: "JsonRpcClient"): async def list(self, params: ToolsListRequest, *, timeout: float | None = None) -> ToolList: "Lists built-in tools available for a model.\n\nArgs:\n params: Optional model identifier whose tool overrides should be applied to the listing.\n\nReturns:\n Built-in tools available for the requested model, with their parameters and instructions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return ToolList.from_dict( - await self._client.request("tools.list", params_dict, **_timeout_kwargs(timeout)) - ) + return ToolList.from_dict(await self._client.request("tools.list", params_dict, **_timeout_kwargs(timeout))) class ServerAccountApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def get_quota( - self, params: AccountGetQuotaRequest, *, timeout: float | None = None - ) -> AccountGetQuotaResult: + async def get_quota(self, params: AccountGetQuotaRequest, *, timeout: float | None = None) -> AccountGetQuotaResult: "Gets Copilot quota usage for the authenticated user or supplied GitHub token.\n\nArgs:\n params: Optional GitHub token used to look up quota for a specific user instead of the global auth context.\n\nReturns:\n Quota usage snapshots for the resolved user, keyed by quota type." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return AccountGetQuotaResult.from_dict( - await self._client.request("account.getQuota", params_dict, **_timeout_kwargs(timeout)) - ) + return AccountGetQuotaResult.from_dict(await self._client.request("account.getQuota", params_dict, **_timeout_kwargs(timeout))) class ServerSecretsApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def add_filter_values( - self, params: SecretsAddFilterValuesRequest, *, timeout: float | None = None - ) -> SecretsAddFilterValuesResult: + async def add_filter_values(self, params: SecretsAddFilterValuesRequest, *, timeout: float | None = None) -> SecretsAddFilterValuesResult: "Registers secret values for redaction in session logs and exports. The SDK calls this to inject dynamically generated secret values (e.g., OIDC tokens).\n\nArgs:\n params: Secret values to add to the redaction filter.\n\nReturns:\n Confirmation that the secret values were registered." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SecretsAddFilterValuesResult.from_dict( - await self._client.request( - "secrets.addFilterValues", params_dict, **_timeout_kwargs(timeout) - ) - ) + return SecretsAddFilterValuesResult.from_dict(await self._client.request("secrets.addFilterValues", params_dict, **_timeout_kwargs(timeout))) class ServerMcpConfigApi: @@ -21213,9 +16744,7 @@ def __init__(self, client: "JsonRpcClient"): async def list(self, *, timeout: float | None = None) -> MCPConfigList: "Lists MCP servers from user configuration.\n\nReturns:\n User-configured MCP servers, keyed by server name." - return MCPConfigList.from_dict( - await self._client.request("mcp.config.list", {}, **_timeout_kwargs(timeout)) - ) + return MCPConfigList.from_dict(await self._client.request("mcp.config.list", {}, **_timeout_kwargs(timeout))) async def add(self, params: MCPConfigAddRequest, *, timeout: float | None = None) -> None: "Adds an MCP server to user configuration.\n\nArgs:\n params: MCP server name and configuration to add to user configuration." @@ -21237,9 +16766,7 @@ async def enable(self, params: MCPConfigEnableRequest, *, timeout: float | None params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.enable", params_dict, **_timeout_kwargs(timeout)) - async def disable( - self, params: MCPConfigDisableRequest, *, timeout: float | None = None - ) -> None: + async def disable(self, params: MCPConfigDisableRequest, *, timeout: float | None = None) -> None: "Disables MCP servers in user configuration for new sessions.\n\nArgs:\n params: MCP server names to disable for new sessions." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} await self._client.request("mcp.config.disable", params_dict, **_timeout_kwargs(timeout)) @@ -21250,28 +16777,20 @@ def __init__(self, client: "JsonRpcClient"): self._client = client self.config = ServerMcpConfigApi(client) - async def discover( - self, params: MCPDiscoverRequest, *, timeout: float | None = None - ) -> MCPDiscoverResult: + async def discover(self, params: MCPDiscoverRequest, *, timeout: float | None = None) -> MCPDiscoverResult: "Discovers MCP servers from user, workspace, plugin, and builtin sources.\n\nArgs:\n params: Optional working directory used as context for MCP server discovery.\n\nReturns:\n MCP servers discovered from user, workspace, plugin, and built-in sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return MCPDiscoverResult.from_dict( - await self._client.request("mcp.discover", params_dict, **_timeout_kwargs(timeout)) - ) + return MCPDiscoverResult.from_dict(await self._client.request("mcp.discover", params_dict, **_timeout_kwargs(timeout))) class ServerSkillsConfigApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def set_disabled_skills( - self, params: SkillsConfigSetDisabledSkillsRequest, *, timeout: float | None = None - ) -> None: + async def set_disabled_skills(self, params: SkillsConfigSetDisabledSkillsRequest, *, timeout: float | None = None) -> None: "Replaces the global list of disabled skills.\n\nArgs:\n params: Skill names to mark as disabled in global configuration, replacing any previous list." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - await self._client.request( - "skills.config.setDisabledSkills", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("skills.config.setDisabledSkills", params_dict, **_timeout_kwargs(timeout)) class ServerSkillsApi: @@ -21279,30 +16798,20 @@ def __init__(self, client: "JsonRpcClient"): self._client = client self.config = ServerSkillsConfigApi(client) - async def discover( - self, params: SkillsDiscoverRequest, *, timeout: float | None = None - ) -> ServerSkillList: + async def discover(self, params: SkillsDiscoverRequest, *, timeout: float | None = None) -> ServerSkillList: "Discovers skills across global and project sources.\n\nArgs:\n params: Optional project paths and additional skill directories to include in discovery.\n\nReturns:\n Skills discovered across global and project sources." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return ServerSkillList.from_dict( - await self._client.request("skills.discover", params_dict, **_timeout_kwargs(timeout)) - ) + return ServerSkillList.from_dict(await self._client.request("skills.discover", params_dict, **_timeout_kwargs(timeout))) class ServerSessionFsApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def set_provider( - self, params: SessionFSSetProviderRequest, *, timeout: float | None = None - ) -> SessionFSSetProviderResult: + async def set_provider(self, params: SessionFSSetProviderRequest, *, timeout: float | None = None) -> SessionFSSetProviderResult: "Registers an SDK client as the session filesystem provider.\n\nArgs:\n params: Initial working directory, session-state path layout, and path conventions used to register the calling SDK client as the session filesystem provider.\n\nReturns:\n Indicates whether the calling client was registered as the session filesystem provider." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionFSSetProviderResult.from_dict( - await self._client.request( - "sessionFs.setProvider", params_dict, **_timeout_kwargs(timeout) - ) - ) + return SessionFSSetProviderResult.from_dict(await self._client.request("sessionFs.setProvider", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21310,202 +16819,103 @@ class ServerSessionsApi: def __init__(self, client: "JsonRpcClient"): self._client = client - async def fork( - self, params: SessionsForkRequest, *, timeout: float | None = None - ) -> SessionsForkResult: + async def fork(self, params: SessionsForkRequest, *, timeout: float | None = None) -> SessionsForkResult: "Creates a new session by forking persisted history from an existing session.\n\nArgs:\n params: Source session identifier to fork from, optional event-ID boundary, and optional friendly name for the new session.\n\nReturns:\n Identifier and optional friendly name assigned to the newly forked session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsForkResult.from_dict( - await self._client.request("sessions.fork", params_dict, **_timeout_kwargs(timeout)) - ) + return SessionsForkResult.from_dict(await self._client.request("sessions.fork", params_dict, **_timeout_kwargs(timeout))) - async def connect( - self, params: ConnectRemoteSessionParams, *, timeout: float | None = None - ) -> RemoteSessionConnectionResult: + async def connect(self, params: ConnectRemoteSessionParams, *, timeout: float | None = None) -> RemoteSessionConnectionResult: "Connects to an existing remote session and exposes it as an SDK session.\n\nArgs:\n params: Remote session connection parameters.\n\nReturns:\n Remote session connection result." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return RemoteSessionConnectionResult.from_dict( - await self._client.request("sessions.connect", params_dict, **_timeout_kwargs(timeout)) - ) + return RemoteSessionConnectionResult.from_dict(await self._client.request("sessions.connect", params_dict, **_timeout_kwargs(timeout))) - async def list( - self, params: SessionsListRequest, *, timeout: float | None = None - ) -> SessionList: + async def list(self, params: SessionsListRequest, *, timeout: float | None = None) -> SessionList: "Lists persisted sessions, optionally filtered by working-directory context.\n\nArgs:\n params: Optional metadata-load limit and context filter applied to the returned sessions.\n\nReturns:\n Persisted sessions matching the filter, ordered most-recently-modified first." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionList.from_dict( - await self._client.request("sessions.list", params_dict, **_timeout_kwargs(timeout)) - ) + return SessionList.from_dict(await self._client.request("sessions.list", params_dict, **_timeout_kwargs(timeout))) - async def find_by_task_id( - self, params: SessionsFindByTaskIDRequest, *, timeout: float | None = None - ) -> SessionsFindByTaskIDResult: + async def find_by_task_id(self, params: SessionsFindByTaskIDRequest, *, timeout: float | None = None) -> SessionsFindByTaskIDResult: "Finds the local session bound to a GitHub task ID, if any.\n\nArgs:\n params: GitHub task ID to look up.\n\nReturns:\n ID of the local session bound to the given GitHub task, or omitted when none." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsFindByTaskIDResult.from_dict( - await self._client.request( - "sessions.findByTaskId", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def find_by_prefix( - self, params: SessionsFindByPrefixRequest, *, timeout: float | None = None - ) -> SessionsFindByPrefixResult: + return SessionsFindByTaskIDResult.from_dict(await self._client.request("sessions.findByTaskId", params_dict, **_timeout_kwargs(timeout))) + + async def find_by_prefix(self, params: SessionsFindByPrefixRequest, *, timeout: float | None = None) -> SessionsFindByPrefixResult: "Resolves a UUID prefix to a unique session ID, if exactly one session matches.\n\nArgs:\n params: UUID prefix to resolve to a unique session ID.\n\nReturns:\n Session ID matching the prefix, omitted when no unique match exists." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsFindByPrefixResult.from_dict( - await self._client.request( - "sessions.findByPrefix", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def get_last_for_context( - self, params: SessionsGetLastForContextRequest, *, timeout: float | None = None - ) -> SessionsGetLastForContextResult: + return SessionsFindByPrefixResult.from_dict(await self._client.request("sessions.findByPrefix", params_dict, **_timeout_kwargs(timeout))) + + async def get_last_for_context(self, params: SessionsGetLastForContextRequest, *, timeout: float | None = None) -> SessionsGetLastForContextResult: "Returns the most-relevant prior session for a given working-directory context.\n\nArgs:\n params: Optional working-directory context used to score session relevance.\n\nReturns:\n Most-relevant session ID for the supplied context, or omitted when no sessions exist." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsGetLastForContextResult.from_dict( - await self._client.request( - "sessions.getLastForContext", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def get_event_file_path( - self, params: SessionsGetEventFilePathRequest, *, timeout: float | None = None - ) -> SessionsGetEventFilePathResult: + return SessionsGetLastForContextResult.from_dict(await self._client.request("sessions.getLastForContext", params_dict, **_timeout_kwargs(timeout))) + + async def get_event_file_path(self, params: SessionsGetEventFilePathRequest, *, timeout: float | None = None) -> SessionsGetEventFilePathResult: "Computes the absolute path to a session's persisted events.jsonl file.\n\nArgs:\n params: Session ID whose event-log file path to compute.\n\nReturns:\n Absolute path to the session's events.jsonl file on disk." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsGetEventFilePathResult.from_dict( - await self._client.request( - "sessions.getEventFilePath", params_dict, **_timeout_kwargs(timeout) - ) - ) + return SessionsGetEventFilePathResult.from_dict(await self._client.request("sessions.getEventFilePath", params_dict, **_timeout_kwargs(timeout))) async def get_sizes(self, *, timeout: float | None = None) -> SessionSizes: "Returns the on-disk byte size of each session's workspace directory.\n\nReturns:\n Map of sessionId -> on-disk size in bytes for each session's workspace directory." - return SessionSizes.from_dict( - await self._client.request("sessions.getSizes", {}, **_timeout_kwargs(timeout)) - ) + return SessionSizes.from_dict(await self._client.request("sessions.getSizes", {}, **_timeout_kwargs(timeout))) - async def check_in_use( - self, params: SessionsCheckInUseRequest, *, timeout: float | None = None - ) -> SessionsCheckInUseResult: + async def check_in_use(self, params: SessionsCheckInUseRequest, *, timeout: float | None = None) -> SessionsCheckInUseResult: "Returns the subset of the supplied session IDs that are currently held by another running process.\n\nArgs:\n params: Session IDs to test for live in-use locks.\n\nReturns:\n Session IDs from the input set that are currently in use by another process." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsCheckInUseResult.from_dict( - await self._client.request( - "sessions.checkInUse", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def get_persisted_remote_steerable( - self, params: SessionsGetPersistedRemoteSteerableRequest, *, timeout: float | None = None - ) -> SessionsGetPersistedRemoteSteerableResult: + return SessionsCheckInUseResult.from_dict(await self._client.request("sessions.checkInUse", params_dict, **_timeout_kwargs(timeout))) + + async def get_persisted_remote_steerable(self, params: SessionsGetPersistedRemoteSteerableRequest, *, timeout: float | None = None) -> SessionsGetPersistedRemoteSteerableResult: "Returns a session's persisted remote-steerable flag, if any has been recorded.\n\nArgs:\n params: Session ID to look up the persisted remote-steerable flag for.\n\nReturns:\n The session's persisted remote-steerable flag, or omitted when no value has been persisted." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsGetPersistedRemoteSteerableResult.from_dict( - await self._client.request( - "sessions.getPersistedRemoteSteerable", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def close( - self, params: SessionsCloseRequest, *, timeout: float | None = None - ) -> SessionsCloseResult: + return SessionsGetPersistedRemoteSteerableResult.from_dict(await self._client.request("sessions.getPersistedRemoteSteerable", params_dict, **_timeout_kwargs(timeout))) + + async def close(self, params: SessionsCloseRequest, *, timeout: float | None = None) -> SessionsCloseResult: "Closes a session: emits shutdown, flushes pending events, releases the in-use lock, and disposes the active session.\n\nArgs:\n params: Session ID to close.\n\nReturns:\n Closes a session: emits shutdown, flushes pending events to disk, releases the in-use lock, disposes the active session. Idempotent: succeeds even if the session is not currently active." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsCloseResult.from_dict( - await self._client.request("sessions.close", params_dict, **_timeout_kwargs(timeout)) - ) + return SessionsCloseResult.from_dict(await self._client.request("sessions.close", params_dict, **_timeout_kwargs(timeout))) - async def bulk_delete( - self, params: SessionsBulkDeleteRequest, *, timeout: float | None = None - ) -> SessionBulkDeleteResult: + async def bulk_delete(self, params: SessionsBulkDeleteRequest, *, timeout: float | None = None) -> SessionBulkDeleteResult: "Closes, deactivates, and deletes a set of sessions, returning the bytes freed per session.\n\nArgs:\n params: Session IDs to close, deactivate, and delete from disk.\n\nReturns:\n Map of sessionId -> bytes freed by removing the session's workspace directory." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionBulkDeleteResult.from_dict( - await self._client.request( - "sessions.bulkDelete", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def prune_old( - self, params: SessionsPruneOldRequest, *, timeout: float | None = None - ) -> SessionPruneResult: + return SessionBulkDeleteResult.from_dict(await self._client.request("sessions.bulkDelete", params_dict, **_timeout_kwargs(timeout))) + + async def prune_old(self, params: SessionsPruneOldRequest, *, timeout: float | None = None) -> SessionPruneResult: "Deletes sessions older than the given threshold, with optional dry-run and exclusion list.\n\nArgs:\n params: Age threshold and optional flags controlling which old sessions are pruned (or simulated when dryRun is true).\n\nReturns:\n Outcome of the prune operation: deleted IDs, dry-run candidates, skipped IDs, total bytes freed, and the dry-run flag." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionPruneResult.from_dict( - await self._client.request("sessions.pruneOld", params_dict, **_timeout_kwargs(timeout)) - ) + return SessionPruneResult.from_dict(await self._client.request("sessions.pruneOld", params_dict, **_timeout_kwargs(timeout))) - async def save( - self, params: SessionsSaveRequest, *, timeout: float | None = None - ) -> SessionsSaveResult: + async def save(self, params: SessionsSaveRequest, *, timeout: float | None = None) -> SessionsSaveResult: "Flushes a session's pending events to disk.\n\nArgs:\n params: Session ID whose pending events should be flushed to disk.\n\nReturns:\n Flush a session's pending events to disk. No-op when no writer exists for the session (e.g., already closed)." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsSaveResult.from_dict( - await self._client.request("sessions.save", params_dict, **_timeout_kwargs(timeout)) - ) + return SessionsSaveResult.from_dict(await self._client.request("sessions.save", params_dict, **_timeout_kwargs(timeout))) - async def release_lock( - self, params: SessionsReleaseLockRequest, *, timeout: float | None = None - ) -> SessionsReleaseLockResult: + async def release_lock(self, params: SessionsReleaseLockRequest, *, timeout: float | None = None) -> SessionsReleaseLockResult: "Releases the in-use lock held by this process for a session.\n\nArgs:\n params: Session ID whose in-use lock should be released.\n\nReturns:\n Release the in-use lock held by this process for the given session. No-op when this process does not currently hold a lock for the session." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsReleaseLockResult.from_dict( - await self._client.request( - "sessions.releaseLock", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def enrich_metadata( - self, params: SessionsEnrichMetadataRequest, *, timeout: float | None = None - ) -> SessionEnrichMetadataResult: + return SessionsReleaseLockResult.from_dict(await self._client.request("sessions.releaseLock", params_dict, **_timeout_kwargs(timeout))) + + async def enrich_metadata(self, params: SessionsEnrichMetadataRequest, *, timeout: float | None = None) -> SessionEnrichMetadataResult: "Backfills missing summary and context fields on the supplied session metadata records.\n\nArgs:\n params: Session metadata records to enrich with summary and context information.\n\nReturns:\n The same metadata records, with summary and context fields backfilled where available." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionEnrichMetadataResult.from_dict( - await self._client.request( - "sessions.enrichMetadata", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def reload_plugin_hooks( - self, params: SessionsReloadPluginHooksRequest, *, timeout: float | None = None - ) -> SessionsReloadPluginHooksResult: + return SessionEnrichMetadataResult.from_dict(await self._client.request("sessions.enrichMetadata", params_dict, **_timeout_kwargs(timeout))) + + async def reload_plugin_hooks(self, params: SessionsReloadPluginHooksRequest, *, timeout: float | None = None) -> SessionsReloadPluginHooksResult: "Reloads user, plugin, and (optionally) repo hooks on the active session.\n\nArgs:\n params: Active session ID and an optional flag for deferring repo-level hooks until folder trust.\n\nReturns:\n Reload all hooks (user, plugin, optionally repo) and apply them to the active session. Call after installing or removing plugins so their hooks take effect immediately. No-op when no active session matches the given sessionId." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsReloadPluginHooksResult.from_dict( - await self._client.request( - "sessions.reloadPluginHooks", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def load_deferred_repo_hooks( - self, params: SessionsLoadDeferredRepoHooksRequest, *, timeout: float | None = None - ) -> SessionLoadDeferredRepoHooksResult: + return SessionsReloadPluginHooksResult.from_dict(await self._client.request("sessions.reloadPluginHooks", params_dict, **_timeout_kwargs(timeout))) + + async def load_deferred_repo_hooks(self, params: SessionsLoadDeferredRepoHooksRequest, *, timeout: float | None = None) -> SessionLoadDeferredRepoHooksResult: "Loads previously-deferred repo-level hooks on the active session, returning queued startup prompts.\n\nArgs:\n params: Active session ID whose deferred repo-level hooks should be loaded.\n\nReturns:\n Queued repo-level startup prompts and the total hook command count after loading." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionLoadDeferredRepoHooksResult.from_dict( - await self._client.request( - "sessions.loadDeferredRepoHooks", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def set_additional_plugins( - self, params: SessionsSetAdditionalPluginsRequest, *, timeout: float | None = None - ) -> SessionsSetAdditionalPluginsResult: + return SessionLoadDeferredRepoHooksResult.from_dict(await self._client.request("sessions.loadDeferredRepoHooks", params_dict, **_timeout_kwargs(timeout))) + + async def set_additional_plugins(self, params: SessionsSetAdditionalPluginsRequest, *, timeout: float | None = None) -> SessionsSetAdditionalPluginsResult: "Replaces the manager-wide additional plugins registered with the session manager.\n\nArgs:\n params: Manager-wide additional plugins to register; replaces any previously-configured set.\n\nReturns:\n Replace the manager-wide additional plugins. New session creations and subsequent hook reloads see the new set; already-running sessions keep their existing hook installation until the next reload." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return SessionsSetAdditionalPluginsResult.from_dict( - await self._client.request( - "sessions.setAdditionalPlugins", params_dict, **_timeout_kwargs(timeout) - ) - ) + return SessionsSetAdditionalPluginsResult.from_dict(await self._client.request("sessions.setAdditionalPlugins", params_dict, **_timeout_kwargs(timeout))) class ServerRpc: """Typed server-scoped RPC methods.""" - def __init__(self, client: "JsonRpcClient"): self._client = client self.models = ServerModelsApi(client) @@ -21520,25 +16930,18 @@ def __init__(self, client: "JsonRpcClient"): async def ping(self, params: PingRequest, *, timeout: float | None = None) -> PingResult: "Checks server responsiveness and returns protocol information.\n\nArgs:\n params: Optional message to echo back to the caller.\n\nReturns:\n Server liveness response, including the echoed message, current server timestamp, and protocol version." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return PingResult.from_dict( - await self._client.request("ping", params_dict, **_timeout_kwargs(timeout)) - ) + return PingResult.from_dict(await self._client.request("ping", params_dict, **_timeout_kwargs(timeout))) class _InternalServerRpc: """Internal SDK server-scoped RPC methods. Not part of the public API.""" - def __init__(self, client: "JsonRpcClient"): self._client = client - async def _connect( - self, params: _ConnectRequest, *, timeout: float | None = None - ) -> _ConnectResult: + async def _connect(self, params: _ConnectRequest, *, timeout: float | None = None) -> _ConnectResult: "Performs the SDK server connection handshake and validates the optional connection token.\n\nArgs:\n params: Optional connection token presented by the SDK client during the handshake.\n\nReturns:\n Handshake result reporting the server's protocol version and package version on success.\n\n:meta private:\n\nInternal SDK API; not part of the public surface." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} - return _ConnectResult.from_dict( - await self._client.request("connect", params_dict, **_timeout_kwargs(timeout)) - ) + return _ConnectResult.from_dict(await self._client.request("connect", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21549,25 +16952,13 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_status(self, *, timeout: float | None = None) -> SessionAuthStatus: "Gets authentication status and account metadata for the session.\n\nReturns:\n Authentication status and account metadata for the session." - return SessionAuthStatus.from_dict( - await self._client.request( - "session.auth.getStatus", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def set_credentials( - self, params: SessionSetCredentialsParams, *, timeout: float | None = None - ) -> SessionSetCredentialsResult: + return SessionAuthStatus.from_dict(await self._client.request("session.auth.getStatus", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def set_credentials(self, params: SessionSetCredentialsParams, *, timeout: float | None = None) -> SessionSetCredentialsResult: "Updates the session's auth credentials used for outbound model and API requests.\n\nArgs:\n params: New auth credentials to install on the session. Omit to leave credentials unchanged.\n\nReturns:\n Indicates whether the credential update succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SessionSetCredentialsResult.from_dict( - await self._client.request( - "session.auth.setCredentials", params_dict, **_timeout_kwargs(timeout) - ) - ) + return SessionSetCredentialsResult.from_dict(await self._client.request("session.auth.setCredentials", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21578,33 +16969,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> CanvasList: "Lists canvases declared for the session.\n\nReturns:\n Declared canvases available in this session." - return CanvasList.from_dict( - await self._client.request( - "session.canvas.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return CanvasList.from_dict(await self._client.request("session.canvas.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def list_open(self, *, timeout: float | None = None) -> CanvasListOpenResult: "Lists currently open canvas instances for the live session.\n\nReturns:\n Live open-canvas snapshot." - return CanvasListOpenResult.from_dict( - await self._client.request( - "session.canvas.listOpen", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def open( - self, params: CanvasOpenRequest, *, timeout: float | None = None - ) -> OpenCanvasInstance: + return CanvasListOpenResult.from_dict(await self._client.request("session.canvas.listOpen", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def open(self, params: CanvasOpenRequest, *, timeout: float | None = None) -> OpenCanvasInstance: "Opens or focuses a canvas instance.\n\nArgs:\n params: Canvas open parameters.\n\nReturns:\n Open canvas instance snapshot." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return OpenCanvasInstance.from_dict( - await self._client.request( - "session.canvas.open", params_dict, **_timeout_kwargs(timeout) - ) - ) + return OpenCanvasInstance.from_dict(await self._client.request("session.canvas.open", params_dict, **_timeout_kwargs(timeout))) async def close(self, params: CanvasCloseRequest, *, timeout: float | None = None) -> None: "Closes an open canvas instance.\n\nArgs:\n params: Canvas close parameters." @@ -21612,15 +16987,11 @@ async def close(self, params: CanvasCloseRequest, *, timeout: float | None = Non params_dict["sessionId"] = self._session_id await self._client.request("session.canvas.close", params_dict, **_timeout_kwargs(timeout)) - async def invoke_action( - self, params: CanvasInvokeActionRequest, *, timeout: float | None = None - ) -> Any: + async def invoke_action(self, params: CanvasInvokeActionRequest, *, timeout: float | None = None) -> Any: "Invokes an action on an open canvas instance.\n\nArgs:\n params: Canvas action invocation parameters.\n\nReturns:\n Canvas action invocation result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return await self._client.request( - "session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout) - ) + return Any.from_dict(await self._client.request("session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21631,37 +17002,19 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_current(self, *, timeout: float | None = None) -> CurrentModel: "Gets the currently selected model for the session.\n\nReturns:\n The currently selected model and reasoning effort for the session." - return CurrentModel.from_dict( - await self._client.request( - "session.model.getCurrent", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def switch_to( - self, params: ModelSwitchToRequest, *, timeout: float | None = None - ) -> ModelSwitchToResult: + return CurrentModel.from_dict(await self._client.request("session.model.getCurrent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def switch_to(self, params: ModelSwitchToRequest, *, timeout: float | None = None) -> ModelSwitchToResult: "Switches the session to a model and optional reasoning configuration.\n\nArgs:\n params: Target model identifier and optional reasoning effort, summary, and capability overrides.\n\nReturns:\n The model identifier active on the session after the switch." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ModelSwitchToResult.from_dict( - await self._client.request( - "session.model.switchTo", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def set_reasoning_effort( - self, params: ModelSetReasoningEffortRequest, *, timeout: float | None = None - ) -> ModelSetReasoningEffortResult: + return ModelSwitchToResult.from_dict(await self._client.request("session.model.switchTo", params_dict, **_timeout_kwargs(timeout))) + + async def set_reasoning_effort(self, params: ModelSetReasoningEffortRequest, *, timeout: float | None = None) -> ModelSetReasoningEffortResult: "Updates the session's reasoning effort without changing the selected model.\n\nArgs:\n params: Reasoning effort level to apply to the currently selected model.\n\nReturns:\n Update the session's reasoning effort without changing the selected model. Use `switchTo` instead when you also need to change the model. The runtime stores the effort on the session and applies it to subsequent turns." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ModelSetReasoningEffortResult.from_dict( - await self._client.request( - "session.model.setReasoningEffort", params_dict, **_timeout_kwargs(timeout) - ) - ) + return ModelSetReasoningEffortResult.from_dict(await self._client.request("session.model.setReasoningEffort", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21672,11 +17025,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get(self, *, timeout: float | None = None) -> SessionMode: "Gets the current agent interaction mode.\n\nReturns:\n The session mode the agent is operating in" - return SessionMode( - await self._client.request( - "session.mode.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return SessionMode(await self._client.request("session.mode.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set(self, params: ModeSetRequest, *, timeout: float | None = None) -> None: "Sets the current agent interaction mode.\n\nArgs:\n params: Agent interaction mode to apply to the session." @@ -21693,11 +17042,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get(self, *, timeout: float | None = None) -> NameGetResult: "Gets the session's friendly name.\n\nReturns:\n The session's friendly name, or null when not yet set." - return NameGetResult.from_dict( - await self._client.request( - "session.name.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return NameGetResult.from_dict(await self._client.request("session.name.get", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def set(self, params: NameSetRequest, *, timeout: float | None = None) -> None: "Sets the session's friendly name.\n\nArgs:\n params: New friendly name to apply to the session." @@ -21705,17 +17050,11 @@ async def set(self, params: NameSetRequest, *, timeout: float | None = None) -> params_dict["sessionId"] = self._session_id await self._client.request("session.name.set", params_dict, **_timeout_kwargs(timeout)) - async def set_auto( - self, params: NameSetAutoRequest, *, timeout: float | None = None - ) -> NameSetAutoResult: + async def set_auto(self, params: NameSetAutoRequest, *, timeout: float | None = None) -> NameSetAutoResult: "Persists an auto-generated session summary as the session's name when no user-set name exists.\n\nArgs:\n params: Auto-generated session summary to apply as the session's name when no user-set name exists.\n\nReturns:\n Indicates whether the auto-generated summary was applied as the session's name." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return NameSetAutoResult.from_dict( - await self._client.request( - "session.name.setAuto", params_dict, **_timeout_kwargs(timeout) - ) - ) + return NameSetAutoResult.from_dict(await self._client.request("session.name.setAuto", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21726,11 +17065,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def read(self, *, timeout: float | None = None) -> PlanReadResult: "Reads the session plan file from the workspace.\n\nReturns:\n Existence, contents, and resolved path of the session plan file." - return PlanReadResult.from_dict( - await self._client.request( - "session.plan.read", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return PlanReadResult.from_dict(await self._client.request("session.plan.read", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def update(self, params: PlanUpdateRequest, *, timeout: float | None = None) -> None: "Writes new content to the session plan file.\n\nArgs:\n params: Replacement contents to write to the session plan file." @@ -21740,9 +17075,7 @@ async def update(self, params: PlanUpdateRequest, *, timeout: float | None = Non async def delete(self, *, timeout: float | None = None) -> None: "Deletes the session plan file from the workspace." - await self._client.request( - "session.plan.delete", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.plan.delete", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. @@ -21753,93 +17086,45 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_workspace(self, *, timeout: float | None = None) -> WorkspacesGetWorkspaceResult: "Gets current workspace metadata for the session.\n\nReturns:\n Current workspace metadata for the session, including its absolute filesystem path when available." - return WorkspacesGetWorkspaceResult.from_dict( - await self._client.request( - "session.workspaces.getWorkspace", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return WorkspacesGetWorkspaceResult.from_dict(await self._client.request("session.workspaces.getWorkspace", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def list_files(self, *, timeout: float | None = None) -> WorkspacesListFilesResult: "Lists files stored in the session workspace files directory.\n\nReturns:\n Relative paths of files stored in the session workspace files directory." - return WorkspacesListFilesResult.from_dict( - await self._client.request( - "session.workspaces.listFiles", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def read_file( - self, params: WorkspacesReadFileRequest, *, timeout: float | None = None - ) -> WorkspacesReadFileResult: + return WorkspacesListFilesResult.from_dict(await self._client.request("session.workspaces.listFiles", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def read_file(self, params: WorkspacesReadFileRequest, *, timeout: float | None = None) -> WorkspacesReadFileResult: "Reads a file from the session workspace files directory.\n\nArgs:\n params: Relative path of the workspace file to read.\n\nReturns:\n Contents of the requested workspace file as a UTF-8 string." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspacesReadFileResult.from_dict( - await self._client.request( - "session.workspaces.readFile", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def create_file( - self, params: WorkspacesCreateFileRequest, *, timeout: float | None = None - ) -> None: + return WorkspacesReadFileResult.from_dict(await self._client.request("session.workspaces.readFile", params_dict, **_timeout_kwargs(timeout))) + + async def create_file(self, params: WorkspacesCreateFileRequest, *, timeout: float | None = None) -> None: "Creates or overwrites a file in the session workspace files directory.\n\nArgs:\n params: Relative path and UTF-8 content for the workspace file to create or overwrite." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.workspaces.createFile", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.workspaces.createFile", params_dict, **_timeout_kwargs(timeout)) - async def list_checkpoints( - self, *, timeout: float | None = None - ) -> WorkspacesListCheckpointsResult: + async def list_checkpoints(self, *, timeout: float | None = None) -> WorkspacesListCheckpointsResult: "Lists workspace checkpoints in chronological order.\n\nReturns:\n Workspace checkpoints in chronological order; empty when the workspace is not enabled." - return WorkspacesListCheckpointsResult.from_dict( - await self._client.request( - "session.workspaces.listCheckpoints", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def read_checkpoint( - self, params: WorkspacesReadCheckpointRequest, *, timeout: float | None = None - ) -> WorkspacesReadCheckpointResult: + return WorkspacesListCheckpointsResult.from_dict(await self._client.request("session.workspaces.listCheckpoints", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def read_checkpoint(self, params: WorkspacesReadCheckpointRequest, *, timeout: float | None = None) -> WorkspacesReadCheckpointResult: "Reads the content of a workspace checkpoint by number.\n\nArgs:\n params: Checkpoint number to read.\n\nReturns:\n Checkpoint content as a UTF-8 string, or null when the checkpoint or workspace is missing." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspacesReadCheckpointResult.from_dict( - await self._client.request( - "session.workspaces.readCheckpoint", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def save_large_paste( - self, params: WorkspacesSaveLargePasteRequest, *, timeout: float | None = None - ) -> WorkspacesSaveLargePasteResult: + return WorkspacesReadCheckpointResult.from_dict(await self._client.request("session.workspaces.readCheckpoint", params_dict, **_timeout_kwargs(timeout))) + + async def save_large_paste(self, params: WorkspacesSaveLargePasteRequest, *, timeout: float | None = None) -> WorkspacesSaveLargePasteResult: "Saves pasted content as a UTF-8 file in the session workspace.\n\nArgs:\n params: Pasted content to save as a UTF-8 file in the session workspace.\n\nReturns:\n Descriptor for the saved paste file, or null when the workspace is unavailable." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspacesSaveLargePasteResult.from_dict( - await self._client.request( - "session.workspaces.saveLargePaste", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def diff( - self, params: WorkspacesDiffRequest, *, timeout: float | None = None - ) -> WorkspaceDiffResult: + return WorkspacesSaveLargePasteResult.from_dict(await self._client.request("session.workspaces.saveLargePaste", params_dict, **_timeout_kwargs(timeout))) + + async def diff(self, params: WorkspacesDiffRequest, *, timeout: float | None = None) -> WorkspaceDiffResult: "Computes a diff for the session workspace.\n\nArgs:\n params: Parameters for computing a workspace diff.\n\nReturns:\n Workspace diff result for the requested mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return WorkspaceDiffResult.from_dict( - await self._client.request( - "session.workspaces.diff", params_dict, **_timeout_kwargs(timeout) - ) - ) + return WorkspaceDiffResult.from_dict(await self._client.request("session.workspaces.diff", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21850,13 +17135,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_sources(self, *, timeout: float | None = None) -> InstructionsGetSourcesResult: "Gets instruction sources loaded for the session.\n\nReturns:\n Instruction sources loaded for the session, in merge order." - return InstructionsGetSourcesResult.from_dict( - await self._client.request( - "session.instructions.getSources", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return InstructionsGetSourcesResult.from_dict(await self._client.request("session.instructions.getSources", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21865,17 +17144,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def start( - self, params: FleetStartRequest, *, timeout: float | None = None - ) -> FleetStartResult: + async def start(self, params: FleetStartRequest, *, timeout: float | None = None) -> FleetStartResult: "Starts fleet mode by submitting the fleet orchestration prompt to the session.\n\nArgs:\n params: Optional user prompt to combine with the fleet orchestration instructions.\n\nReturns:\n Indicates whether fleet mode was successfully activated." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return FleetStartResult.from_dict( - await self._client.request( - "session.fleet.start", params_dict, **_timeout_kwargs(timeout) - ) - ) + return FleetStartResult.from_dict(await self._client.request("session.fleet.start", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21886,47 +17159,25 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> AgentList: "Lists custom agents available to the session.\n\nReturns:\n Custom agents available to the session." - return AgentList.from_dict( - await self._client.request( - "session.agent.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return AgentList.from_dict(await self._client.request("session.agent.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def get_current(self, *, timeout: float | None = None) -> AgentGetCurrentResult: "Gets the currently selected custom agent for the session.\n\nReturns:\n The currently selected custom agent, or null when using the default agent." - return AgentGetCurrentResult.from_dict( - await self._client.request( - "session.agent.getCurrent", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def select( - self, params: AgentSelectRequest, *, timeout: float | None = None - ) -> AgentSelectResult: + return AgentGetCurrentResult.from_dict(await self._client.request("session.agent.getCurrent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def select(self, params: AgentSelectRequest, *, timeout: float | None = None) -> AgentSelectResult: "Selects a custom agent for subsequent turns in the session.\n\nArgs:\n params: Name of the custom agent to select for subsequent turns.\n\nReturns:\n The newly selected custom agent." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return AgentSelectResult.from_dict( - await self._client.request( - "session.agent.select", params_dict, **_timeout_kwargs(timeout) - ) - ) + return AgentSelectResult.from_dict(await self._client.request("session.agent.select", params_dict, **_timeout_kwargs(timeout))) async def deselect(self, *, timeout: float | None = None) -> None: "Clears the selected custom agent and returns the session to the default agent." - await self._client.request( - "session.agent.deselect", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.agent.deselect", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> AgentReloadResult: "Reloads custom agent definitions and returns the refreshed list.\n\nReturns:\n Custom agents available to the session after reloading definitions from disk." - return AgentReloadResult.from_dict( - await self._client.request( - "session.agent.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return AgentReloadResult.from_dict(await self._client.request("session.agent.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -21935,127 +17186,61 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def start_agent( - self, params: TasksStartAgentRequest, *, timeout: float | None = None - ) -> TasksStartAgentResult: + async def start_agent(self, params: TasksStartAgentRequest, *, timeout: float | None = None) -> TasksStartAgentResult: "Starts a background agent task in the session.\n\nArgs:\n params: Agent type, prompt, name, and optional description and model override for the new task.\n\nReturns:\n Identifier assigned to the newly started background agent task." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksStartAgentResult.from_dict( - await self._client.request( - "session.tasks.startAgent", params_dict, **_timeout_kwargs(timeout) - ) - ) + return TasksStartAgentResult.from_dict(await self._client.request("session.tasks.startAgent", params_dict, **_timeout_kwargs(timeout))) async def list(self, *, timeout: float | None = None) -> TaskList: "Lists background tasks tracked by the session.\n\nReturns:\n Background tasks currently tracked by the session." - return TaskList.from_dict( - await self._client.request( - "session.tasks.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return TaskList.from_dict(await self._client.request("session.tasks.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def refresh(self, *, timeout: float | None = None) -> TasksRefreshResult: "Refreshes metadata for any detached background shells the runtime knows about.\n\nReturns:\n Refresh metadata for any detached background shells the runtime knows about. Use after a long pause to pick up exit/output state for shells running outside the agent loop." - return TasksRefreshResult.from_dict( - await self._client.request( - "session.tasks.refresh", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return TasksRefreshResult.from_dict(await self._client.request("session.tasks.refresh", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def wait_for_pending(self, *, timeout: float | None = None) -> TasksWaitForPendingResult: "Waits for all in-flight background tasks and any follow-up turns to settle.\n\nReturns:\n Wait until all in-flight background tasks (agents + shells) and any follow-up turns scheduled by their completions have settled. Returns when the runtime is fully drained or after an internal timeout (default 10 minutes; configurable via COPILOT_TASK_WAIT_TIMEOUT_SECONDS)." - return TasksWaitForPendingResult.from_dict( - await self._client.request( - "session.tasks.waitForPending", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def get_progress( - self, params: TasksGetProgressRequest, *, timeout: float | None = None - ) -> TasksGetProgressResult: + return TasksWaitForPendingResult.from_dict(await self._client.request("session.tasks.waitForPending", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def get_progress(self, params: TasksGetProgressRequest, *, timeout: float | None = None) -> TasksGetProgressResult: "Returns progress information for a background task by ID.\n\nArgs:\n params: Identifier of the background task to fetch progress for.\n\nReturns:\n Progress information for the task, or null when no task with that ID is tracked." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksGetProgressResult.from_dict( - await self._client.request( - "session.tasks.getProgress", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def get_current_promotable( - self, *, timeout: float | None = None - ) -> TasksGetCurrentPromotableResult: + return TasksGetProgressResult.from_dict(await self._client.request("session.tasks.getProgress", params_dict, **_timeout_kwargs(timeout))) + + async def get_current_promotable(self, *, timeout: float | None = None) -> TasksGetCurrentPromotableResult: "Returns the first sync-waiting task that can currently be promoted to background mode.\n\nReturns:\n The first sync-waiting task that can currently be promoted to background mode." - return TasksGetCurrentPromotableResult.from_dict( - await self._client.request( - "session.tasks.getCurrentPromotable", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def promote_to_background( - self, params: TasksPromoteToBackgroundRequest, *, timeout: float | None = None - ) -> TasksPromoteToBackgroundResult: + return TasksGetCurrentPromotableResult.from_dict(await self._client.request("session.tasks.getCurrentPromotable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def promote_to_background(self, params: TasksPromoteToBackgroundRequest, *, timeout: float | None = None) -> TasksPromoteToBackgroundResult: "Promotes an eligible synchronously-waited task so it continues running in the background.\n\nArgs:\n params: Identifier of the task to promote to background mode.\n\nReturns:\n Indicates whether the task was successfully promoted to background mode." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksPromoteToBackgroundResult.from_dict( - await self._client.request( - "session.tasks.promoteToBackground", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def promote_current_to_background( - self, *, timeout: float | None = None - ) -> TasksPromoteCurrentToBackgroundResult: + return TasksPromoteToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteToBackground", params_dict, **_timeout_kwargs(timeout))) + + async def promote_current_to_background(self, *, timeout: float | None = None) -> TasksPromoteCurrentToBackgroundResult: "Atomically promotes the first promotable sync-waiting task to background mode and returns it.\n\nReturns:\n The promoted task as it now exists in background mode, omitted if no promotable task was waiting." - return TasksPromoteCurrentToBackgroundResult.from_dict( - await self._client.request( - "session.tasks.promoteCurrentToBackground", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def cancel( - self, params: TasksCancelRequest, *, timeout: float | None = None - ) -> TasksCancelResult: + return TasksPromoteCurrentToBackgroundResult.from_dict(await self._client.request("session.tasks.promoteCurrentToBackground", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def cancel(self, params: TasksCancelRequest, *, timeout: float | None = None) -> TasksCancelResult: "Cancels a background task.\n\nArgs:\n params: Identifier of the background task to cancel.\n\nReturns:\n Indicates whether the background task was successfully cancelled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksCancelResult.from_dict( - await self._client.request( - "session.tasks.cancel", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def remove( - self, params: TasksRemoveRequest, *, timeout: float | None = None - ) -> TasksRemoveResult: + return TasksCancelResult.from_dict(await self._client.request("session.tasks.cancel", params_dict, **_timeout_kwargs(timeout))) + + async def remove(self, params: TasksRemoveRequest, *, timeout: float | None = None) -> TasksRemoveResult: "Removes a completed or cancelled background task from tracking.\n\nArgs:\n params: Identifier of the completed or cancelled task to remove from tracking.\n\nReturns:\n Indicates whether the task was removed. False when the task does not exist or is still running/idle." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksRemoveResult.from_dict( - await self._client.request( - "session.tasks.remove", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def send_message( - self, params: TasksSendMessageRequest, *, timeout: float | None = None - ) -> TasksSendMessageResult: + return TasksRemoveResult.from_dict(await self._client.request("session.tasks.remove", params_dict, **_timeout_kwargs(timeout))) + + async def send_message(self, params: TasksSendMessageRequest, *, timeout: float | None = None) -> TasksSendMessageResult: "Sends a message to a background agent task.\n\nArgs:\n params: Identifier of the target agent task, message content, and optional sender agent ID.\n\nReturns:\n Indicates whether the message was delivered, with an error message when delivery failed." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return TasksSendMessageResult.from_dict( - await self._client.request( - "session.tasks.sendMessage", params_dict, **_timeout_kwargs(timeout) - ) - ) + return TasksSendMessageResult.from_dict(await self._client.request("session.tasks.sendMessage", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22066,21 +17251,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> SkillList: "Lists skills available to the session.\n\nReturns:\n Skills available to the session, with their enabled state." - return SkillList.from_dict( - await self._client.request( - "session.skills.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return SkillList.from_dict(await self._client.request("session.skills.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def get_invoked(self, *, timeout: float | None = None) -> SkillsGetInvokedResult: "Returns the skills that have been invoked during this session.\n\nReturns:\n Skills invoked during this session, ordered by invocation time (most recent last)." - return SkillsGetInvokedResult.from_dict( - await self._client.request( - "session.skills.getInvoked", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return SkillsGetInvokedResult.from_dict(await self._client.request("session.skills.getInvoked", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def enable(self, params: SkillsEnableRequest, *, timeout: float | None = None) -> None: "Enables a skill for the session.\n\nArgs:\n params: Name of the skill to enable for the session." @@ -22092,25 +17267,15 @@ async def disable(self, params: SkillsDisableRequest, *, timeout: float | None = "Disables a skill for the session.\n\nArgs:\n params: Name of the skill to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.skills.disable", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.skills.disable", params_dict, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> SkillsLoadDiagnostics: "Reloads skill definitions for the session.\n\nReturns:\n Diagnostics from reloading skill definitions, with warnings and errors as separate lists." - return SkillsLoadDiagnostics.from_dict( - await self._client.request( - "session.skills.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return SkillsLoadDiagnostics.from_dict(await self._client.request("session.skills.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def ensure_loaded(self, *, timeout: float | None = None) -> None: "Ensures the session's skill definitions have been loaded from disk." - await self._client.request( - "session.skills.ensureLoaded", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) + await self._client.request("session.skills.ensureLoaded", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. @@ -22119,17 +17284,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def login( - self, params: MCPOauthLoginRequest, *, timeout: float | None = None - ) -> MCPOauthLoginResult: + async def login(self, params: MCPOauthLoginRequest, *, timeout: float | None = None) -> MCPOauthLoginResult: "Starts OAuth authentication for a remote MCP server.\n\nArgs:\n params: Remote MCP server name and optional overrides controlling reauthentication, OAuth client display name, and the callback success-page copy.\n\nReturns:\n OAuth authorization URL the caller should open, or empty when cached tokens already authenticated the server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPOauthLoginResult.from_dict( - await self._client.request( - "session.mcp.oauth.login", params_dict, **_timeout_kwargs(timeout) - ) - ) + return MCPOauthLoginResult.from_dict(await self._client.request("session.mcp.oauth.login", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22138,73 +17297,39 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def read_resource( - self, params: MCPAppsReadResourceRequest, *, timeout: float | None = None - ) -> MCPAppsReadResourceResult: + async def read_resource(self, params: MCPAppsReadResourceRequest, *, timeout: float | None = None) -> MCPAppsReadResourceResult: "Fetch an MCP resource (typically a `ui://` MCP App bundle, per SEP-1865) from a connected server. Requires the `mcp-apps` session capability.\n\nArgs:\n params: MCP server and resource URI to fetch.\n\nReturns:\n Resource contents returned by the MCP server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPAppsReadResourceResult.from_dict( - await self._client.request( - "session.mcp.apps.readResource", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def list_tools( - self, params: MCPAppsListToolsRequest, *, timeout: float | None = None - ) -> MCPAppsListToolsResult: - 'List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `["model","app"]`) or includes `"app"`.\n\nArgs:\n params: MCP server to list app-callable tools for.\n\nReturns:\n App-callable tools from the named MCP server.' + return MCPAppsReadResourceResult.from_dict(await self._client.request("session.mcp.apps.readResource", params_dict, **_timeout_kwargs(timeout))) + + async def list_tools(self, params: MCPAppsListToolsRequest, *, timeout: float | None = None) -> MCPAppsListToolsResult: + "List tools that an MCP App view is allowed to call (SEP-1865 visibility filter). Returns tools whose `_meta.ui.visibility` is unset (default `[\"model\",\"app\"]`) or includes `\"app\"`.\n\nArgs:\n params: MCP server to list app-callable tools for.\n\nReturns:\n App-callable tools from the named MCP server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPAppsListToolsResult.from_dict( - await self._client.request( - "session.mcp.apps.listTools", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def call_tool( - self, params: MCPAppsCallToolRequest, *, timeout: float | None = None - ) -> dict: + return MCPAppsListToolsResult.from_dict(await self._client.request("session.mcp.apps.listTools", params_dict, **_timeout_kwargs(timeout))) + + async def call_tool(self, params: MCPAppsCallToolRequest, *, timeout: float | None = None) -> dict: "Call an MCP tool from an MCP App view (SEP-1865). Enforces the visibility check that prevents an app iframe from invoking model-only tools. Returns the standard MCP `CallToolResult`.\n\nArgs:\n params: MCP server, tool name, and arguments to invoke from an MCP App view.\n\nReturns:\n Standard MCP CallToolResult" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return dict( - await self._client.request( - "session.mcp.apps.callTool", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def set_host_context( - self, params: MCPAppsSetHostContextRequest, *, timeout: float | None = None - ) -> None: + return dict(await self._client.request("session.mcp.apps.callTool", params_dict, **_timeout_kwargs(timeout))) + + async def set_host_context(self, params: MCPAppsSetHostContextRequest, *, timeout: float | None = None) -> None: "Replace the host context returned to MCP App guests on `ui/initialize`. Hosts use this to advertise theme, locale, or other metadata to the guest UI.\n\nArgs:\n params: Host context to advertise to MCP App guests." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.mcp.apps.setHostContext", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.mcp.apps.setHostContext", params_dict, **_timeout_kwargs(timeout)) async def get_host_context(self, *, timeout: float | None = None) -> MCPAppsHostContext: "Read the current host context advertised to MCP App guests.\n\nReturns:\n Current host context advertised to MCP App guests." - return MCPAppsHostContext.from_dict( - await self._client.request( - "session.mcp.apps.getHostContext", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def diagnose( - self, params: MCPAppsDiagnoseRequest, *, timeout: float | None = None - ) -> MCPAppsDiagnoseResult: + return MCPAppsHostContext.from_dict(await self._client.request("session.mcp.apps.getHostContext", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def diagnose(self, params: MCPAppsDiagnoseRequest, *, timeout: float | None = None) -> MCPAppsDiagnoseResult: "Diagnose MCP Apps wiring for a specific MCP server. Reports the session capability, feature-flag state, advertised extension, and how many tools have `_meta.ui` populated.\n\nArgs:\n params: MCP server to diagnose MCP Apps wiring for.\n\nReturns:\n Diagnostic snapshot of MCP Apps wiring for the named server." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPAppsDiagnoseResult.from_dict( - await self._client.request( - "session.mcp.apps.diagnose", params_dict, **_timeout_kwargs(timeout) - ) - ) + return MCPAppsDiagnoseResult.from_dict(await self._client.request("session.mcp.apps.diagnose", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22217,11 +17342,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> MCPServerList: "Lists MCP servers configured for the session and their connection status.\n\nReturns:\n MCP servers configured for the session, with their connection status." - return MCPServerList.from_dict( - await self._client.request( - "session.mcp.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return MCPServerList.from_dict(await self._client.request("session.mcp.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def enable(self, params: MCPEnableRequest, *, timeout: float | None = None) -> None: "Enables an MCP server for the session.\n\nArgs:\n params: Name of the MCP server to enable for the session." @@ -22237,55 +17358,29 @@ async def disable(self, params: MCPDisableRequest, *, timeout: float | None = No async def reload(self, *, timeout: float | None = None) -> None: "Reloads MCP server connections for the session." - await self._client.request( - "session.mcp.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.mcp.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) - async def execute_sampling( - self, params: MCPExecuteSamplingParams, *, timeout: float | None = None - ) -> MCPSamplingExecutionResult: + async def execute_sampling(self, params: MCPExecuteSamplingParams, *, timeout: float | None = None) -> MCPSamplingExecutionResult: "Runs an MCP sampling inference on behalf of an MCP server.\n\nArgs:\n params: Identifiers and raw MCP CreateMessageRequest params used to run a sampling inference.\n\nReturns:\n Outcome of an MCP sampling execution: success result, failure error, or cancellation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPSamplingExecutionResult.from_dict( - await self._client.request( - "session.mcp.executeSampling", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def cancel_sampling_execution( - self, params: MCPCancelSamplingExecutionParams, *, timeout: float | None = None - ) -> MCPCancelSamplingExecutionResult: + return MCPSamplingExecutionResult.from_dict(await self._client.request("session.mcp.executeSampling", params_dict, **_timeout_kwargs(timeout))) + + async def cancel_sampling_execution(self, params: MCPCancelSamplingExecutionParams, *, timeout: float | None = None) -> MCPCancelSamplingExecutionResult: "Cancels an in-flight MCP sampling execution by request ID.\n\nArgs:\n params: The requestId previously passed to executeSampling that should be cancelled.\n\nReturns:\n Indicates whether an in-flight sampling execution with the given requestId was found and cancelled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPCancelSamplingExecutionResult.from_dict( - await self._client.request( - "session.mcp.cancelSamplingExecution", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def set_env_value_mode( - self, params: MCPSetEnvValueModeParams, *, timeout: float | None = None - ) -> MCPSetEnvValueModeResult: + return MCPCancelSamplingExecutionResult.from_dict(await self._client.request("session.mcp.cancelSamplingExecution", params_dict, **_timeout_kwargs(timeout))) + + async def set_env_value_mode(self, params: MCPSetEnvValueModeParams, *, timeout: float | None = None) -> MCPSetEnvValueModeResult: "Sets how environment-variable values supplied to MCP servers are resolved (direct or indirect).\n\nArgs:\n params: Mode controlling how MCP server env values are resolved (`direct` or `indirect`).\n\nReturns:\n Env-value mode recorded on the session after the update." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MCPSetEnvValueModeResult.from_dict( - await self._client.request( - "session.mcp.setEnvValueMode", params_dict, **_timeout_kwargs(timeout) - ) - ) + return MCPSetEnvValueModeResult.from_dict(await self._client.request("session.mcp.setEnvValueMode", params_dict, **_timeout_kwargs(timeout))) async def remove_git_hub(self, *, timeout: float | None = None) -> MCPRemoveGitHubResult: "Removes the auto-managed `github` MCP server when present.\n\nReturns:\n Indicates whether the auto-managed `github` MCP server was removed (false when nothing to remove)." - return MCPRemoveGitHubResult.from_dict( - await self._client.request( - "session.mcp.removeGitHub", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return MCPRemoveGitHubResult.from_dict(await self._client.request("session.mcp.removeGitHub", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22296,11 +17391,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> PluginList: "Lists plugins installed for the session.\n\nReturns:\n Plugins installed for the session, with their enabled state and version metadata." - return PluginList.from_dict( - await self._client.request( - "session.plugins.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) + return PluginList.from_dict(await self._client.request("session.plugins.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22309,17 +17400,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def update( - self, params: SessionUpdateOptionsParams, *, timeout: float | None = None - ) -> SessionUpdateOptionsResult: + async def update(self, params: SessionUpdateOptionsParams, *, timeout: float | None = None) -> SessionUpdateOptionsResult: "Patches the genuinely-mutable subset of session options.\n\nArgs:\n params: Patch of mutable session options to apply to the running session.\n\nReturns:\n Indicates whether the session options patch was applied successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SessionUpdateOptionsResult.from_dict( - await self._client.request( - "session.options.update", params_dict, **_timeout_kwargs(timeout) - ) - ) + return SessionUpdateOptionsResult.from_dict(await self._client.request("session.options.update", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22328,15 +17413,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def initialize( - self, params: LspInitializeRequest, *, timeout: float | None = None - ) -> None: + async def initialize(self, params: LspInitializeRequest, *, timeout: float | None = None) -> None: "Loads the merged LSP configuration set for the session's working directory.\n\nArgs:\n params: Parameters for (re)loading the merged LSP configuration set." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.lsp.initialize", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.lsp.initialize", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. @@ -22347,39 +17428,23 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> ExtensionList: "Lists extensions discovered for the session and their current status.\n\nReturns:\n Extensions discovered for the session, with their current status." - return ExtensionList.from_dict( - await self._client.request( - "session.extensions.list", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def enable( - self, params: ExtensionsEnableRequest, *, timeout: float | None = None - ) -> None: + return ExtensionList.from_dict(await self._client.request("session.extensions.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def enable(self, params: ExtensionsEnableRequest, *, timeout: float | None = None) -> None: "Enables an extension for the session.\n\nArgs:\n params: Source-qualified extension identifier to enable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.extensions.enable", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.extensions.enable", params_dict, **_timeout_kwargs(timeout)) - async def disable( - self, params: ExtensionsDisableRequest, *, timeout: float | None = None - ) -> None: + async def disable(self, params: ExtensionsDisableRequest, *, timeout: float | None = None) -> None: "Disables an extension for the session.\n\nArgs:\n params: Source-qualified extension identifier to disable for the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.extensions.disable", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.extensions.disable", params_dict, **_timeout_kwargs(timeout)) async def reload(self, *, timeout: float | None = None) -> None: "Reloads extension definitions and processes for the session." - await self._client.request( - "session.extensions.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.extensions.reload", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. @@ -22388,29 +17453,15 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def handle_pending_tool_call( - self, params: HandlePendingToolCallRequest, *, timeout: float | None = None - ) -> HandlePendingToolCallResult: + async def handle_pending_tool_call(self, params: HandlePendingToolCallRequest, *, timeout: float | None = None) -> HandlePendingToolCallResult: "Provides the result for a pending external tool call.\n\nArgs:\n params: Pending external tool call request ID, with the tool result or an error describing why it failed.\n\nReturns:\n Indicates whether the external tool call result was handled successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return HandlePendingToolCallResult.from_dict( - await self._client.request( - "session.tools.handlePendingToolCall", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def initialize_and_validate( - self, *, timeout: float | None = None - ) -> ToolsInitializeAndValidateResult: + return HandlePendingToolCallResult.from_dict(await self._client.request("session.tools.handlePendingToolCall", params_dict, **_timeout_kwargs(timeout))) + + async def initialize_and_validate(self, *, timeout: float | None = None) -> ToolsInitializeAndValidateResult: "Resolves, builds, and validates the runtime tool list for the session.\n\nReturns:\n Resolve, build, and validate the runtime tool list for this session. Subagent sessions and consumer flows that need an initialized tool set before `send` invoke this. Default base-class implementation is a no-op for sessions that don't support tool validation." - return ToolsInitializeAndValidateResult.from_dict( - await self._client.request( - "session.tools.initializeAndValidate", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return ToolsInitializeAndValidateResult.from_dict(await self._client.request("session.tools.initializeAndValidate", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22419,81 +17470,41 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def list( - self, params: CommandsListRequest | None = None, *, timeout: float | None = None - ) -> CommandList: + async def list(self, params: CommandsListRequest | None = None, *, timeout: float | None = None) -> CommandList: "Lists slash commands available in the session.\n\nArgs:\n params: Optional filters controlling which command sources to include in the listing.\n\nReturns:\n Slash commands available in the session, after applying any include/exclude filters." - params_dict: dict[str, Any] = ( - {k: v for k, v in params.to_dict().items() if v is not None} - if params is not None - else {} - ) + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id - return CommandList.from_dict( - await self._client.request( - "session.commands.list", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def invoke( - self, params: CommandsInvokeRequest, *, timeout: float | None = None - ) -> SlashCommandInvocationResult: + return CommandList.from_dict(await self._client.request("session.commands.list", params_dict, **_timeout_kwargs(timeout))) + + async def invoke(self, params: CommandsInvokeRequest, *, timeout: float | None = None) -> SlashCommandInvocationResult: "Invokes a slash command in the session.\n\nArgs:\n params: Slash command name and optional raw input string to invoke.\n\nReturns:\n Result of invoking the slash command (text output, prompt to send to the agent, or completion)." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return _load_SlashCommandInvocationResult( - await self._client.request( - "session.commands.invoke", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_command( - self, params: CommandsHandlePendingCommandRequest, *, timeout: float | None = None - ) -> CommandsHandlePendingCommandResult: + return _load_SlashCommandInvocationResult(await self._client.request("session.commands.invoke", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_command(self, params: CommandsHandlePendingCommandRequest, *, timeout: float | None = None) -> CommandsHandlePendingCommandResult: "Reports completion of a pending client-handled slash command.\n\nArgs:\n params: Pending command request ID and an optional error if the client handler failed.\n\nReturns:\n Indicates whether the pending client-handled command was completed successfully." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return CommandsHandlePendingCommandResult.from_dict( - await self._client.request( - "session.commands.handlePendingCommand", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def execute( - self, params: ExecuteCommandParams, *, timeout: float | None = None - ) -> ExecuteCommandResult: + return CommandsHandlePendingCommandResult.from_dict(await self._client.request("session.commands.handlePendingCommand", params_dict, **_timeout_kwargs(timeout))) + + async def execute(self, params: ExecuteCommandParams, *, timeout: float | None = None) -> ExecuteCommandResult: "Executes a slash command synchronously and returns any error.\n\nArgs:\n params: Slash command name and argument string to execute synchronously.\n\nReturns:\n Error message produced while executing the command, if any." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ExecuteCommandResult.from_dict( - await self._client.request( - "session.commands.execute", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def enqueue( - self, params: EnqueueCommandParams, *, timeout: float | None = None - ) -> EnqueueCommandResult: + return ExecuteCommandResult.from_dict(await self._client.request("session.commands.execute", params_dict, **_timeout_kwargs(timeout))) + + async def enqueue(self, params: EnqueueCommandParams, *, timeout: float | None = None) -> EnqueueCommandResult: "Enqueues a slash command for FIFO processing on the local session.\n\nArgs:\n params: Slash-prefixed command string to enqueue for FIFO processing.\n\nReturns:\n Indicates whether the command was accepted into the local execution queue." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return EnqueueCommandResult.from_dict( - await self._client.request( - "session.commands.enqueue", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def respond_to_queued_command( - self, params: CommandsRespondToQueuedCommandRequest, *, timeout: float | None = None - ) -> CommandsRespondToQueuedCommandResult: + return EnqueueCommandResult.from_dict(await self._client.request("session.commands.enqueue", params_dict, **_timeout_kwargs(timeout))) + + async def respond_to_queued_command(self, params: CommandsRespondToQueuedCommandRequest, *, timeout: float | None = None) -> CommandsRespondToQueuedCommandResult: "Reports whether the host actually executed a queued command and whether to continue processing.\n\nArgs:\n params: Queued-command request ID and the result indicating whether the host executed it (and whether to stop processing further queued commands).\n\nReturns:\n Indicates whether the queued-command response was matched to a pending request." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return CommandsRespondToQueuedCommandResult.from_dict( - await self._client.request( - "session.commands.respondToQueuedCommand", params_dict, **_timeout_kwargs(timeout) - ) - ) + return CommandsRespondToQueuedCommandResult.from_dict(await self._client.request("session.commands.respondToQueuedCommand", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22502,15 +17513,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def set_feature_overrides( - self, params: TelemetrySetFeatureOverridesRequest, *, timeout: float | None = None - ) -> None: + async def set_feature_overrides(self, params: TelemetrySetFeatureOverridesRequest, *, timeout: float | None = None) -> None: "Sets feature override key/value pairs to attach to subsequent telemetry events for the session.\n\nArgs:\n params: Feature override key/value pairs to attach to subsequent telemetry events from this session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - await self._client.request( - "session.telemetry.setFeatureOverrides", params_dict, **_timeout_kwargs(timeout) - ) + await self._client.request("session.telemetry.setFeatureOverrides", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. @@ -22519,106 +17526,51 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def elicitation( - self, params: UIElicitationRequest, *, timeout: float | None = None - ) -> UIElicitationResponse: + async def elicitation(self, params: UIElicitationRequest, *, timeout: float | None = None) -> UIElicitationResponse: "Requests structured input from a UI-capable client.\n\nArgs:\n params: Prompt message and JSON schema describing the form fields to elicit from the user.\n\nReturns:\n The elicitation response (accept with form values, decline, or cancel)" params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIElicitationResponse.from_dict( - await self._client.request( - "session.ui.elicitation", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_elicitation( - self, params: UIHandlePendingElicitationRequest, *, timeout: float | None = None - ) -> UIElicitationResult: + return UIElicitationResponse.from_dict(await self._client.request("session.ui.elicitation", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_elicitation(self, params: UIHandlePendingElicitationRequest, *, timeout: float | None = None) -> UIElicitationResult: "Provides the user response for a pending elicitation request.\n\nArgs:\n params: Pending elicitation request ID and the user's response (accept/decline/cancel + form values).\n\nReturns:\n Indicates whether the elicitation response was accepted; false if it was already resolved by another client." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIElicitationResult.from_dict( - await self._client.request( - "session.ui.handlePendingElicitation", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_user_input( - self, params: UIHandlePendingUserInputRequest, *, timeout: float | None = None - ) -> UIHandlePendingResult: + return UIElicitationResult.from_dict(await self._client.request("session.ui.handlePendingElicitation", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_user_input(self, params: UIHandlePendingUserInputRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `user_input.requested` event with the user's response.\n\nArgs:\n params: Request ID of a pending `user_input.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict( - await self._client.request( - "session.ui.handlePendingUserInput", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_sampling( - self, params: UIHandlePendingSamplingRequest, *, timeout: float | None = None - ) -> UIHandlePendingResult: + return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingUserInput", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_sampling(self, params: UIHandlePendingSamplingRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `sampling.requested` event with a sampling result, or rejects it.\n\nArgs:\n params: Request ID of a pending `sampling.requested` event and an optional sampling result payload (omit to reject).\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict( - await self._client.request( - "session.ui.handlePendingSampling", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_auto_mode_switch( - self, params: UIHandlePendingAutoModeSwitchRequest, *, timeout: float | None = None - ) -> UIHandlePendingResult: + return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingSampling", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_auto_mode_switch(self, params: UIHandlePendingAutoModeSwitchRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `auto_mode_switch.requested` event with the user's accept/decline decision.\n\nArgs:\n params: Request ID of a pending `auto_mode_switch.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict( - await self._client.request( - "session.ui.handlePendingAutoModeSwitch", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_exit_plan_mode( - self, params: UIHandlePendingExitPlanModeRequest, *, timeout: float | None = None - ) -> UIHandlePendingResult: + return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingAutoModeSwitch", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_exit_plan_mode(self, params: UIHandlePendingExitPlanModeRequest, *, timeout: float | None = None) -> UIHandlePendingResult: "Resolves a pending `exit_plan_mode.requested` event with the user's response.\n\nArgs:\n params: Request ID of a pending `exit_plan_mode.requested` event and the user's response.\n\nReturns:\n Indicates whether the pending UI request was resolved by this call." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIHandlePendingResult.from_dict( - await self._client.request( - "session.ui.handlePendingExitPlanMode", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def register_direct_auto_mode_switch_handler( - self, *, timeout: float | None = None - ) -> UIRegisterDirectAutoModeSwitchHandlerResult: + return UIHandlePendingResult.from_dict(await self._client.request("session.ui.handlePendingExitPlanMode", params_dict, **_timeout_kwargs(timeout))) + + async def register_direct_auto_mode_switch_handler(self, *, timeout: float | None = None) -> UIRegisterDirectAutoModeSwitchHandlerResult: "Registers an in-process handler for auto-mode-switch requests so the server bridge skips dispatch.\n\nReturns:\n Register an in-process handler for `auto_mode_switch.requested` events. The caller still attaches the actual listener via the standard event-subscription mechanism; this registration solely tells the server bridge to skip its own dispatch (so a remote client doesn't race the in-process handler for the same requestId)." - return UIRegisterDirectAutoModeSwitchHandlerResult.from_dict( - await self._client.request( - "session.ui.registerDirectAutoModeSwitchHandler", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def unregister_direct_auto_mode_switch_handler( - self, - params: UIUnregisterDirectAutoModeSwitchHandlerRequest, - *, - timeout: float | None = None, - ) -> UIUnregisterDirectAutoModeSwitchHandlerResult: + return UIRegisterDirectAutoModeSwitchHandlerResult.from_dict(await self._client.request("session.ui.registerDirectAutoModeSwitchHandler", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def unregister_direct_auto_mode_switch_handler(self, params: UIUnregisterDirectAutoModeSwitchHandlerRequest, *, timeout: float | None = None) -> UIUnregisterDirectAutoModeSwitchHandlerResult: "Unregisters a previously-registered in-process auto-mode-switch handler by its opaque handle.\n\nArgs:\n params: Opaque handle previously returned by `registerDirectAutoModeSwitchHandler` to release.\n\nReturns:\n Indicates whether the handle was active and the registration count was decremented." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict( - await self._client.request( - "session.ui.unregisterDirectAutoModeSwitchHandler", - params_dict, - **_timeout_kwargs(timeout), - ) - ) + return UIUnregisterDirectAutoModeSwitchHandlerResult.from_dict(await self._client.request("session.ui.unregisterDirectAutoModeSwitchHandler", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22629,65 +17581,31 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> PermissionPathsList: "Returns the session's allowed directories and primary working directory.\n\nReturns:\n Snapshot of the session's allow-listed directories and primary working directory." - return PermissionPathsList.from_dict( - await self._client.request( - "session.permissions.paths.list", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def add( - self, params: PermissionPathsAddParams, *, timeout: float | None = None - ) -> PermissionsPathsAddResult: + return PermissionPathsList.from_dict(await self._client.request("session.permissions.paths.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def add(self, params: PermissionPathsAddParams, *, timeout: float | None = None) -> PermissionsPathsAddResult: "Adds a directory to the session's allow-list.\n\nArgs:\n params: Directory path to add to the session's allowed directories.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsPathsAddResult.from_dict( - await self._client.request( - "session.permissions.paths.add", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def update_primary( - self, params: PermissionPathsUpdatePrimaryParams, *, timeout: float | None = None - ) -> PermissionsPathsUpdatePrimaryResult: + return PermissionsPathsAddResult.from_dict(await self._client.request("session.permissions.paths.add", params_dict, **_timeout_kwargs(timeout))) + + async def update_primary(self, params: PermissionPathsUpdatePrimaryParams, *, timeout: float | None = None) -> PermissionsPathsUpdatePrimaryResult: "Updates the session's primary working directory used by the permission policy.\n\nArgs:\n params: Directory path to set as the session's new primary working directory.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsPathsUpdatePrimaryResult.from_dict( - await self._client.request( - "session.permissions.paths.updatePrimary", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def is_path_within_allowed_directories( - self, params: PermissionPathsAllowedCheckParams, *, timeout: float | None = None - ) -> PermissionPathsAllowedCheckResult: + return PermissionsPathsUpdatePrimaryResult.from_dict(await self._client.request("session.permissions.paths.updatePrimary", params_dict, **_timeout_kwargs(timeout))) + + async def is_path_within_allowed_directories(self, params: PermissionPathsAllowedCheckParams, *, timeout: float | None = None) -> PermissionPathsAllowedCheckResult: "Reports whether a path falls within any of the session's allowed directories.\n\nArgs:\n params: Path to evaluate against the session's allowed directories.\n\nReturns:\n Indicates whether the supplied path is within the session's allowed directories." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionPathsAllowedCheckResult.from_dict( - await self._client.request( - "session.permissions.paths.isPathWithinAllowedDirectories", - params_dict, - **_timeout_kwargs(timeout), - ) - ) - - async def is_path_within_workspace( - self, params: PermissionPathsWorkspaceCheckParams, *, timeout: float | None = None - ) -> PermissionPathsWorkspaceCheckResult: + return PermissionPathsAllowedCheckResult.from_dict(await self._client.request("session.permissions.paths.isPathWithinAllowedDirectories", params_dict, **_timeout_kwargs(timeout))) + + async def is_path_within_workspace(self, params: PermissionPathsWorkspaceCheckParams, *, timeout: float | None = None) -> PermissionPathsWorkspaceCheckResult: "Reports whether a path falls within the session's workspace (primary) directory.\n\nArgs:\n params: Path to evaluate against the session's workspace (primary) directory.\n\nReturns:\n Indicates whether the supplied path is within the session's workspace directory." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionPathsWorkspaceCheckResult.from_dict( - await self._client.request( - "session.permissions.paths.isPathWithinWorkspace", - params_dict, - **_timeout_kwargs(timeout), - ) - ) + return PermissionPathsWorkspaceCheckResult.from_dict(await self._client.request("session.permissions.paths.isPathWithinWorkspace", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22696,43 +17614,23 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def resolve( - self, params: PermissionLocationResolveParams, *, timeout: float | None = None - ) -> PermissionLocationResolveResult: + async def resolve(self, params: PermissionLocationResolveParams, *, timeout: float | None = None) -> PermissionLocationResolveResult: "Resolves the permission location key and type for a working directory.\n\nArgs:\n params: Working directory to resolve into a location-permissions key.\n\nReturns:\n Resolved location-permissions key and type." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionLocationResolveResult.from_dict( - await self._client.request( - "session.permissions.locations.resolve", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def apply( - self, params: PermissionLocationApplyParams, *, timeout: float | None = None - ) -> PermissionLocationApplyResult: + return PermissionLocationResolveResult.from_dict(await self._client.request("session.permissions.locations.resolve", params_dict, **_timeout_kwargs(timeout))) + + async def apply(self, params: PermissionLocationApplyParams, *, timeout: float | None = None) -> PermissionLocationApplyResult: "Applies persisted location-scoped tool approvals and allowed directories for a working directory to this session's permission service.\n\nArgs:\n params: Working directory to load persisted location permissions for.\n\nReturns:\n Summary of persisted location permissions applied to the session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionLocationApplyResult.from_dict( - await self._client.request( - "session.permissions.locations.apply", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def add_tool_approval( - self, params: PermissionLocationAddToolApprovalParams, *, timeout: float | None = None - ) -> PermissionsLocationsAddToolApprovalResult: + return PermissionLocationApplyResult.from_dict(await self._client.request("session.permissions.locations.apply", params_dict, **_timeout_kwargs(timeout))) + + async def add_tool_approval(self, params: PermissionLocationAddToolApprovalParams, *, timeout: float | None = None) -> PermissionsLocationsAddToolApprovalResult: "Persists a tool approval for a permission location and applies its rules to this session's live permission service.\n\nArgs:\n params: Location-scoped tool approval to persist.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsLocationsAddToolApprovalResult.from_dict( - await self._client.request( - "session.permissions.locations.addToolApproval", - params_dict, - **_timeout_kwargs(timeout), - ) - ) + return PermissionsLocationsAddToolApprovalResult.from_dict(await self._client.request("session.permissions.locations.addToolApproval", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22741,31 +17639,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def is_trusted( - self, params: FolderTrustCheckParams, *, timeout: float | None = None - ) -> FolderTrustCheckResult: + async def is_trusted(self, params: FolderTrustCheckParams, *, timeout: float | None = None) -> FolderTrustCheckResult: "Reports whether a folder is trusted according to the user's folder trust state.\n\nArgs:\n params: Folder path to check for trust.\n\nReturns:\n Folder trust check result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return FolderTrustCheckResult.from_dict( - await self._client.request( - "session.permissions.folderTrust.isTrusted", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def add_trusted( - self, params: FolderTrustAddParams, *, timeout: float | None = None - ) -> PermissionsFolderTrustAddTrustedResult: + return FolderTrustCheckResult.from_dict(await self._client.request("session.permissions.folderTrust.isTrusted", params_dict, **_timeout_kwargs(timeout))) + + async def add_trusted(self, params: FolderTrustAddParams, *, timeout: float | None = None) -> PermissionsFolderTrustAddTrustedResult: "Adds a folder to the user's trusted folders list.\n\nArgs:\n params: Folder path to add to trusted folders.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsFolderTrustAddTrustedResult.from_dict( - await self._client.request( - "session.permissions.folderTrust.addTrusted", - params_dict, - **_timeout_kwargs(timeout), - ) - ) + return PermissionsFolderTrustAddTrustedResult.from_dict(await self._client.request("session.permissions.folderTrust.addTrusted", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22774,19 +17658,11 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def set_unrestricted_mode( - self, params: PermissionUrlsSetUnrestrictedModeParams, *, timeout: float | None = None - ) -> PermissionsUrlsSetUnrestrictedModeResult: + async def set_unrestricted_mode(self, params: PermissionUrlsSetUnrestrictedModeParams, *, timeout: float | None = None) -> PermissionsUrlsSetUnrestrictedModeResult: "Toggles the runtime's URL-permission policy between unrestricted and restricted modes.\n\nArgs:\n params: Whether the URL-permission policy should run in unrestricted mode.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsUrlsSetUnrestrictedModeResult.from_dict( - await self._client.request( - "session.permissions.urls.setUnrestrictedMode", - params_dict, - **_timeout_kwargs(timeout), - ) - ) + return PermissionsUrlsSetUnrestrictedModeResult.from_dict(await self._client.request("session.permissions.urls.setUnrestrictedMode", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22799,103 +17675,49 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self.folder_trust = PermissionsFolderTrustApi(client, session_id) self.urls = PermissionsUrlsApi(client, session_id) - async def configure( - self, params: PermissionsConfigureParams, *, timeout: float | None = None - ) -> PermissionsConfigureResult: + async def configure(self, params: PermissionsConfigureParams, *, timeout: float | None = None) -> PermissionsConfigureResult: "Replaces selected permission policy fields (rules, paths, URLs, exclusions, allow-all flags) on the session.\n\nArgs:\n params: Patch of permission policy fields to apply (omit a field to leave it unchanged).\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsConfigureResult.from_dict( - await self._client.request( - "session.permissions.configure", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def handle_pending_permission_request( - self, params: PermissionDecisionRequest, *, timeout: float | None = None - ) -> PermissionRequestResult: + return PermissionsConfigureResult.from_dict(await self._client.request("session.permissions.configure", params_dict, **_timeout_kwargs(timeout))) + + async def handle_pending_permission_request(self, params: PermissionDecisionRequest, *, timeout: float | None = None) -> PermissionRequestResult: "Provides a decision for a pending tool permission request.\n\nArgs:\n params: Pending permission request ID and the decision to apply (approve/reject and scope).\n\nReturns:\n Indicates whether the permission decision was applied; false when the request was already resolved." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionRequestResult.from_dict( - await self._client.request( - "session.permissions.handlePendingPermissionRequest", - params_dict, - **_timeout_kwargs(timeout), - ) - ) - - async def pending_requests( - self, *, timeout: float | None = None - ) -> PendingPermissionRequestList: + return PermissionRequestResult.from_dict(await self._client.request("session.permissions.handlePendingPermissionRequest", params_dict, **_timeout_kwargs(timeout))) + + async def pending_requests(self, *, timeout: float | None = None) -> PendingPermissionRequestList: "Reconstructs the set of pending tool permission requests from the session's event history.\n\nReturns:\n List of pending permission requests reconstructed from event history." - return PendingPermissionRequestList.from_dict( - await self._client.request( - "session.permissions.pendingRequests", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def set_approve_all( - self, params: PermissionsSetApproveAllRequest, *, timeout: float | None = None - ) -> PermissionsSetApproveAllResult: + return PendingPermissionRequestList.from_dict(await self._client.request("session.permissions.pendingRequests", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def set_approve_all(self, params: PermissionsSetApproveAllRequest, *, timeout: float | None = None) -> PermissionsSetApproveAllResult: "Enables or disables automatic approval of tool permission requests for the session.\n\nArgs:\n params: Allow-all toggle for tool permission requests, with an optional telemetry source.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsSetApproveAllResult.from_dict( - await self._client.request( - "session.permissions.setApproveAll", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def modify_rules( - self, params: PermissionsModifyRulesParams, *, timeout: float | None = None - ) -> PermissionsModifyRulesResult: + return PermissionsSetApproveAllResult.from_dict(await self._client.request("session.permissions.setApproveAll", params_dict, **_timeout_kwargs(timeout))) + + async def modify_rules(self, params: PermissionsModifyRulesParams, *, timeout: float | None = None) -> PermissionsModifyRulesResult: "Adds or removes session-scoped or location-scoped permission rules.\n\nArgs:\n params: Scope and add/remove instructions for modifying session- or location-scoped permission rules.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsModifyRulesResult.from_dict( - await self._client.request( - "session.permissions.modifyRules", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def set_required( - self, params: PermissionsSetRequiredRequest, *, timeout: float | None = None - ) -> PermissionsSetRequiredResult: + return PermissionsModifyRulesResult.from_dict(await self._client.request("session.permissions.modifyRules", params_dict, **_timeout_kwargs(timeout))) + + async def set_required(self, params: PermissionsSetRequiredRequest, *, timeout: float | None = None) -> PermissionsSetRequiredResult: "Sets whether the client wants permission prompts bridged into session events.\n\nArgs:\n params: Toggles whether permission prompts should be bridged into session events for this client.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsSetRequiredResult.from_dict( - await self._client.request( - "session.permissions.setRequired", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def reset_session_approvals( - self, *, timeout: float | None = None - ) -> PermissionsResetSessionApprovalsResult: + return PermissionsSetRequiredResult.from_dict(await self._client.request("session.permissions.setRequired", params_dict, **_timeout_kwargs(timeout))) + + async def reset_session_approvals(self, *, timeout: float | None = None) -> PermissionsResetSessionApprovalsResult: "Clears session-scoped tool permission approvals.\n\nReturns:\n Indicates whether the operation succeeded." - return PermissionsResetSessionApprovalsResult.from_dict( - await self._client.request( - "session.permissions.resetSessionApprovals", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def notify_prompt_shown( - self, params: PermissionPromptShownNotification, *, timeout: float | None = None - ) -> PermissionsNotifyPromptShownResult: + return PermissionsResetSessionApprovalsResult.from_dict(await self._client.request("session.permissions.resetSessionApprovals", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def notify_prompt_shown(self, params: PermissionPromptShownNotification, *, timeout: float | None = None) -> PermissionsNotifyPromptShownResult: "Notifies the runtime that a permission prompt UI has been shown to the user.\n\nArgs:\n params: Notification payload describing the permission prompt that the client just rendered.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return PermissionsNotifyPromptShownResult.from_dict( - await self._client.request( - "session.permissions.notifyPromptShown", params_dict, **_timeout_kwargs(timeout) - ) - ) + return PermissionsNotifyPromptShownResult.from_dict(await self._client.request("session.permissions.notifyPromptShown", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22906,71 +17728,35 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def snapshot(self, *, timeout: float | None = None) -> SessionMetadataSnapshot: "Returns a snapshot of the session's identifying metadata, mode, agent, and remote info.\n\nReturns:\n Point-in-time snapshot of slow-changing session identifier and state fields" - return SessionMetadataSnapshot.from_dict( - await self._client.request( - "session.metadata.snapshot", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return SessionMetadataSnapshot.from_dict(await self._client.request("session.metadata.snapshot", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def is_processing(self, *, timeout: float | None = None) -> MetadataIsProcessingResult: "Reports whether the local session is currently processing user/agent messages.\n\nReturns:\n Indicates whether the local session is currently processing a turn or background continuation." - return MetadataIsProcessingResult.from_dict( - await self._client.request( - "session.metadata.isProcessing", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def context_info( - self, params: MetadataContextInfoRequest, *, timeout: float | None = None - ) -> MetadataContextInfoResult: + return MetadataIsProcessingResult.from_dict(await self._client.request("session.metadata.isProcessing", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def context_info(self, params: MetadataContextInfoRequest, *, timeout: float | None = None) -> MetadataContextInfoResult: "Returns the token breakdown for the session's current context window for a given model.\n\nArgs:\n params: Model identifier and token limits used to compute the context-info breakdown.\n\nReturns:\n Token breakdown for the session's current context window, or null if uninitialized." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataContextInfoResult.from_dict( - await self._client.request( - "session.metadata.contextInfo", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def record_context_change( - self, params: MetadataRecordContextChangeRequest, *, timeout: float | None = None - ) -> MetadataRecordContextChangeResult: + return MetadataContextInfoResult.from_dict(await self._client.request("session.metadata.contextInfo", params_dict, **_timeout_kwargs(timeout))) + + async def record_context_change(self, params: MetadataRecordContextChangeRequest, *, timeout: float | None = None) -> MetadataRecordContextChangeResult: "Records a working-directory/git context change and emits a `session.context_changed` event.\n\nArgs:\n params: Updated working-directory/git context to record on the session.\n\nReturns:\n Notify the session that its working directory context has changed. Emits a `session.context_changed` event so consumers (telemetry, OTel tracker, ACP, the timeline UI) can react. Use this when the host has detected a cwd/branch/repo change outside the session's normal lifecycle (e.g., after a shell command in interactive mode)." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataRecordContextChangeResult.from_dict( - await self._client.request( - "session.metadata.recordContextChange", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def set_working_directory( - self, params: MetadataSetWorkingDirectoryRequest, *, timeout: float | None = None - ) -> MetadataSetWorkingDirectoryResult: + return MetadataRecordContextChangeResult.from_dict(await self._client.request("session.metadata.recordContextChange", params_dict, **_timeout_kwargs(timeout))) + + async def set_working_directory(self, params: MetadataSetWorkingDirectoryRequest, *, timeout: float | None = None) -> MetadataSetWorkingDirectoryResult: "Updates the session's recorded working directory.\n\nArgs:\n params: Absolute path to set as the session's new working directory.\n\nReturns:\n Update the session's working directory. Used by the host when the user explicitly changes cwd (e.g., the `/cd` slash command). The host is responsible for `process.chdir` and any related side-effects (file index, etc.); this method only updates the session's own recorded path." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataSetWorkingDirectoryResult.from_dict( - await self._client.request( - "session.metadata.setWorkingDirectory", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def recompute_context_tokens( - self, params: MetadataRecomputeContextTokensRequest, *, timeout: float | None = None - ) -> MetadataRecomputeContextTokensResult: + return MetadataSetWorkingDirectoryResult.from_dict(await self._client.request("session.metadata.setWorkingDirectory", params_dict, **_timeout_kwargs(timeout))) + + async def recompute_context_tokens(self, params: MetadataRecomputeContextTokensRequest, *, timeout: float | None = None) -> MetadataRecomputeContextTokensResult: "Re-tokenizes the session's existing messages against a model and returns aggregate token totals.\n\nArgs:\n params: Model identifier to use when re-tokenizing the session's existing messages.\n\nReturns:\n Re-tokenize the session's existing messages against `modelId` and return the token totals. Useful for hosts that want an initial estimate of context usage on session resume, before the next agent turn fires `session.context_info_changed` events. Returns zeros for an empty session." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return MetadataRecomputeContextTokensResult.from_dict( - await self._client.request( - "session.metadata.recomputeContextTokens", params_dict, **_timeout_kwargs(timeout) - ) - ) + return MetadataRecomputeContextTokensResult.from_dict(await self._client.request("session.metadata.recomputeContextTokens", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -22979,29 +17765,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def exec( - self, params: ShellExecRequest, *, timeout: float | None = None - ) -> ShellExecResult: + async def exec(self, params: ShellExecRequest, *, timeout: float | None = None) -> ShellExecResult: "Starts a shell command and streams output through session notifications.\n\nArgs:\n params: Shell command to run, with optional working directory and timeout in milliseconds.\n\nReturns:\n Identifier of the spawned process, used to correlate streamed output and exit notifications." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ShellExecResult.from_dict( - await self._client.request( - "session.shell.exec", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def kill( - self, params: ShellKillRequest, *, timeout: float | None = None - ) -> ShellKillResult: - 'Sends a signal to a shell process previously started via "shell.exec".\n\nArgs:\n params: Identifier of a process previously returned by "shell.exec" and the signal to send.\n\nReturns:\n Indicates whether the signal was delivered; false if the process was unknown or already exited.' + return ShellExecResult.from_dict(await self._client.request("session.shell.exec", params_dict, **_timeout_kwargs(timeout))) + + async def kill(self, params: ShellKillRequest, *, timeout: float | None = None) -> ShellKillResult: + "Sends a signal to a shell process previously started via \"shell.exec\".\n\nArgs:\n params: Identifier of a process previously returned by \"shell.exec\" and the signal to send.\n\nReturns:\n Indicates whether the signal was delivered; false if the process was unknown or already exited." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ShellKillResult.from_dict( - await self._client.request( - "session.shell.kill", params_dict, **_timeout_kwargs(timeout) - ) - ) + return ShellKillResult.from_dict(await self._client.request("session.shell.kill", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -23010,69 +17784,29 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def compact( - self, params: HistoryCompactRequest | None = None, *, timeout: float | None = None - ) -> HistoryCompactResult: + async def compact(self, params: HistoryCompactRequest | None = None, *, timeout: float | None = None) -> HistoryCompactResult: "Compacts the session history to reduce context usage.\n\nArgs:\n params: Optional compaction parameters.\n\nReturns:\n Compaction outcome with the number of tokens and messages removed, summary text, and the resulting context window breakdown." - params_dict: dict[str, Any] = ( - {k: v for k, v in params.to_dict().items() if v is not None} - if params is not None - else {} - ) + params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} if params is not None else {} params_dict["sessionId"] = self._session_id - return HistoryCompactResult.from_dict( - await self._client.request( - "session.history.compact", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def truncate( - self, params: HistoryTruncateRequest, *, timeout: float | None = None - ) -> HistoryTruncateResult: + return HistoryCompactResult.from_dict(await self._client.request("session.history.compact", params_dict, **_timeout_kwargs(timeout))) + + async def truncate(self, params: HistoryTruncateRequest, *, timeout: float | None = None) -> HistoryTruncateResult: "Truncates persisted session history to a specific event.\n\nArgs:\n params: Identifier of the event to truncate to; this event and all later events are removed.\n\nReturns:\n Number of events that were removed by the truncation." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return HistoryTruncateResult.from_dict( - await self._client.request( - "session.history.truncate", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def cancel_background_compaction( - self, *, timeout: float | None = None - ) -> HistoryCancelBackgroundCompactionResult: + return HistoryTruncateResult.from_dict(await self._client.request("session.history.truncate", params_dict, **_timeout_kwargs(timeout))) + + async def cancel_background_compaction(self, *, timeout: float | None = None) -> HistoryCancelBackgroundCompactionResult: "Cancels any in-progress background compaction on a local session.\n\nReturns:\n Indicates whether an in-progress background compaction was cancelled." - return HistoryCancelBackgroundCompactionResult.from_dict( - await self._client.request( - "session.history.cancelBackgroundCompaction", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def abort_manual_compaction( - self, *, timeout: float | None = None - ) -> HistoryAbortManualCompactionResult: + return HistoryCancelBackgroundCompactionResult.from_dict(await self._client.request("session.history.cancelBackgroundCompaction", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def abort_manual_compaction(self, *, timeout: float | None = None) -> HistoryAbortManualCompactionResult: "Aborts any in-progress manual compaction on a local session.\n\nReturns:\n Indicates whether an in-progress manual compaction was aborted." - return HistoryAbortManualCompactionResult.from_dict( - await self._client.request( - "session.history.abortManualCompaction", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def summarize_for_handoff( - self, *, timeout: float | None = None - ) -> HistorySummarizeForHandoffResult: + return HistoryAbortManualCompactionResult.from_dict(await self._client.request("session.history.abortManualCompaction", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def summarize_for_handoff(self, *, timeout: float | None = None) -> HistorySummarizeForHandoffResult: "Produces a markdown summary of the session's conversation context for hand-off scenarios.\n\nReturns:\n Markdown summary of the conversation context (empty when not available)." - return HistorySummarizeForHandoffResult.from_dict( - await self._client.request( - "session.history.summarizeForHandoff", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return HistorySummarizeForHandoffResult.from_dict(await self._client.request("session.history.summarizeForHandoff", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -23083,31 +17817,15 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def pending_items(self, *, timeout: float | None = None) -> QueuePendingItemsResult: "Returns the local session's pending user-facing queued items and steering messages.\n\nReturns:\n Snapshot of the session's pending queued items and immediate-steering messages." - return QueuePendingItemsResult.from_dict( - await self._client.request( - "session.queue.pendingItems", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) - - async def remove_most_recent( - self, *, timeout: float | None = None - ) -> QueueRemoveMostRecentResult: + return QueuePendingItemsResult.from_dict(await self._client.request("session.queue.pendingItems", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def remove_most_recent(self, *, timeout: float | None = None) -> QueueRemoveMostRecentResult: "Removes the most recently queued user-facing item (LIFO).\n\nReturns:\n Indicates whether a user-facing pending item was removed." - return QueueRemoveMostRecentResult.from_dict( - await self._client.request( - "session.queue.removeMostRecent", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return QueueRemoveMostRecentResult.from_dict(await self._client.request("session.queue.removeMostRecent", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) async def clear(self, *, timeout: float | None = None) -> None: "Clears all pending queued items on the local session." - await self._client.request( - "session.queue.clear", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.queue.clear", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. @@ -23116,49 +17834,27 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def read( - self, params: EventLogReadRequest, *, timeout: float | None = None - ) -> EventsReadResult: + async def read(self, params: EventLogReadRequest, *, timeout: float | None = None) -> EventsReadResult: "Reads a batch of session events from a cursor, optionally waiting for new events.\n\nArgs:\n params: Cursor, batch size, and optional long-poll/filter parameters for reading session events.\n\nReturns:\n Batch of session events returned by a read, with cursor and continuation metadata." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return EventsReadResult.from_dict( - await self._client.request( - "session.eventLog.read", params_dict, **_timeout_kwargs(timeout) - ) - ) + return EventsReadResult.from_dict(await self._client.request("session.eventLog.read", params_dict, **_timeout_kwargs(timeout))) async def tail(self, *, timeout: float | None = None) -> EventLogTailResult: "Returns a snapshot of the current tail cursor without consuming events.\n\nReturns:\n Snapshot of the current tail cursor without returning any events. Use this when a consumer wants to subscribe to live events going forward without first paginating through the entire persisted history (which would happen if `read` were called without a cursor on a long-lived session)." - return EventLogTailResult.from_dict( - await self._client.request( - "session.eventLog.tail", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) - - async def register_interest( - self, params: RegisterEventInterestParams, *, timeout: float | None = None - ) -> RegisterEventInterestResult: + return EventLogTailResult.from_dict(await self._client.request("session.eventLog.tail", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def register_interest(self, params: RegisterEventInterestParams, *, timeout: float | None = None) -> RegisterEventInterestResult: "Registers consumer interest in an event type for runtime gating purposes.\n\nArgs:\n params: Event type to register consumer interest for, used by runtime gating logic.\n\nReturns:\n Opaque handle representing an event-type interest registration." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return RegisterEventInterestResult.from_dict( - await self._client.request( - "session.eventLog.registerInterest", params_dict, **_timeout_kwargs(timeout) - ) - ) - - async def release_interest( - self, params: ReleaseEventInterestParams, *, timeout: float | None = None - ) -> EventLogReleaseInterestResult: + return RegisterEventInterestResult.from_dict(await self._client.request("session.eventLog.registerInterest", params_dict, **_timeout_kwargs(timeout))) + + async def release_interest(self, params: ReleaseEventInterestParams, *, timeout: float | None = None) -> EventLogReleaseInterestResult: "Releases a consumer's previously-registered interest in an event type.\n\nArgs:\n params: Opaque handle previously returned by `registerInterest` to release.\n\nReturns:\n Indicates whether the operation succeeded." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return EventLogReleaseInterestResult.from_dict( - await self._client.request( - "session.eventLog.releaseInterest", params_dict, **_timeout_kwargs(timeout) - ) - ) + return EventLogReleaseInterestResult.from_dict(await self._client.request("session.eventLog.releaseInterest", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -23169,13 +17865,7 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def get_metrics(self, *, timeout: float | None = None) -> UsageGetMetricsResult: "Gets accumulated usage metrics for the session.\n\nReturns:\n Accumulated session usage metrics, including premium request cost, token counts, model breakdown, and code-change totals." - return UsageGetMetricsResult.from_dict( - await self._client.request( - "session.usage.getMetrics", - {"sessionId": self._session_id}, - **_timeout_kwargs(timeout), - ) - ) + return UsageGetMetricsResult.from_dict(await self._client.request("session.usage.getMetrics", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -23184,35 +17874,21 @@ def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id - async def enable( - self, params: RemoteEnableRequest, *, timeout: float | None = None - ) -> RemoteEnableResult: - 'Enables remote session export or steering.\n\nArgs:\n params: Optional remote session mode ("off", "export", or "on"); defaults to enabling both export and remote steering.\n\nReturns:\n GitHub URL for the session and a flag indicating whether remote steering is enabled.' + async def enable(self, params: RemoteEnableRequest, *, timeout: float | None = None) -> RemoteEnableResult: + "Enables remote session export or steering.\n\nArgs:\n params: Optional remote session mode (\"off\", \"export\", or \"on\"); defaults to enabling both export and remote steering.\n\nReturns:\n GitHub URL for the session and a flag indicating whether remote steering is enabled." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return RemoteEnableResult.from_dict( - await self._client.request( - "session.remote.enable", params_dict, **_timeout_kwargs(timeout) - ) - ) + return RemoteEnableResult.from_dict(await self._client.request("session.remote.enable", params_dict, **_timeout_kwargs(timeout))) async def disable(self, *, timeout: float | None = None) -> None: "Disables remote session export and steering." - await self._client.request( - "session.remote.disable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.remote.disable", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) - async def notify_steerable_changed( - self, params: RemoteNotifySteerableChangedRequest, *, timeout: float | None = None - ) -> RemoteNotifySteerableChangedResult: + async def notify_steerable_changed(self, params: RemoteNotifySteerableChangedRequest, *, timeout: float | None = None) -> RemoteNotifySteerableChangedResult: "Persists a remote-steerability change emitted by the host as a session event.\n\nArgs:\n params: New remote-steerability state to persist as a `session.remote_steerable_changed` event.\n\nReturns:\n Persist a steerability change as a `session.remote_steerable_changed` event. Used by the host (CLI / SDK consumer) when it has just finished enabling or disabling steering on a remote exporter that the runtime does not directly own." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return RemoteNotifySteerableChangedResult.from_dict( - await self._client.request( - "session.remote.notifySteerableChanged", params_dict, **_timeout_kwargs(timeout) - ) - ) + return RemoteNotifySteerableChangedResult.from_dict(await self._client.request("session.remote.notifySteerableChanged", params_dict, **_timeout_kwargs(timeout))) # Experimental: this API group is experimental and may change or be removed. @@ -23223,28 +17899,17 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def list(self, *, timeout: float | None = None) -> ScheduleList: "Lists the session's currently active scheduled prompts.\n\nReturns:\n Snapshot of the currently active recurring prompts for this session." - return ScheduleList.from_dict( - await self._client.request( - "session.schedule.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) - ) - - async def stop( - self, params: ScheduleStopRequest, *, timeout: float | None = None - ) -> ScheduleStopResult: + return ScheduleList.from_dict(await self._client.request("session.schedule.list", {"sessionId": self._session_id}, **_timeout_kwargs(timeout))) + + async def stop(self, params: ScheduleStopRequest, *, timeout: float | None = None) -> ScheduleStopResult: "Removes a scheduled prompt by id.\n\nArgs:\n params: Identifier of the scheduled prompt to remove.\n\nReturns:\n Remove a scheduled prompt by id. The result entry is omitted if the id was unknown." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return ScheduleStopResult.from_dict( - await self._client.request( - "session.schedule.stop", params_dict, **_timeout_kwargs(timeout) - ) - ) + return ScheduleStopResult.from_dict(await self._client.request("session.schedule.stop", params_dict, **_timeout_kwargs(timeout))) class SessionRpc: """Typed session-scoped RPC methods.""" - def __init__(self, client: "JsonRpcClient", session_id: str): self._client = client self._session_id = session_id @@ -23281,25 +17946,19 @@ def __init__(self, client: "JsonRpcClient", session_id: str): async def suspend(self, *, timeout: float | None = None) -> None: "Suspends the session while preserving persisted state for later resume.\n\n.. warning:: This API is experimental and may change or be removed in future versions." - await self._client.request( - "session.suspend", {"sessionId": self._session_id}, **_timeout_kwargs(timeout) - ) + await self._client.request("session.suspend", {"sessionId": self._session_id}, **_timeout_kwargs(timeout)) async def send(self, params: SendRequest, *, timeout: float | None = None) -> SendResult: "Sends a user message to the session and returns its message ID.\n\nArgs:\n params: Parameters for sending a user message to the session\n\nReturns:\n Result of sending a user message\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return SendResult.from_dict( - await self._client.request("session.send", params_dict, **_timeout_kwargs(timeout)) - ) + return SendResult.from_dict(await self._client.request("session.send", params_dict, **_timeout_kwargs(timeout))) async def abort(self, params: AbortRequest, *, timeout: float | None = None) -> AbortResult: "Aborts the current agent turn.\n\nArgs:\n params: Parameters for aborting the current turn\n\nReturns:\n Result of aborting the current turn\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return AbortResult.from_dict( - await self._client.request("session.abort", params_dict, **_timeout_kwargs(timeout)) - ) + return AbortResult.from_dict(await self._client.request("session.abort", params_dict, **_timeout_kwargs(timeout))) async def shutdown(self, params: ShutdownRequest, *, timeout: float | None = None) -> None: "Shuts down the session and persists its final state. Awaits any deferred sessionEnd hooks before resolving so user-supplied hook scripts complete before the runtime tears down.\n\nArgs:\n params: Parameters for shutting down the session\n\n.. warning:: This API is experimental and may change or be removed in future versions." @@ -23311,261 +17970,172 @@ async def log(self, params: LogRequest, *, timeout: float | None = None) -> LogR "Emits a user-visible session log event.\n\nArgs:\n params: Message text, optional severity level, persistence flag, optional follow-up URL, and optional tip.\n\nReturns:\n Identifier of the session event that was emitted for the log message.\n\n.. warning:: This API is experimental and may change or be removed in future versions." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return LogResult.from_dict( - await self._client.request("session.log", params_dict, **_timeout_kwargs(timeout)) - ) + return LogResult.from_dict(await self._client.request("session.log", params_dict, **_timeout_kwargs(timeout))) +# Experimental: this API group is experimental and may change or be removed. class SessionFsHandler(Protocol): async def read_file(self, params: SessionFSReadFileRequest) -> SessionFSReadFileResult: "Reads a file from the client-provided session filesystem.\n\nArgs:\n params: Path of the file to read from the client-provided session filesystem.\n\nReturns:\n File content as a UTF-8 string, or a filesystem error if the read failed." pass - async def write_file(self, params: SessionFSWriteFileRequest) -> SessionFSError | None: "Writes a file in the client-provided session filesystem.\n\nArgs:\n params: File path, content to write, and optional mode for the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass - async def append_file(self, params: SessionFSAppendFileRequest) -> SessionFSError | None: "Appends content to a file in the client-provided session filesystem.\n\nArgs:\n params: File path, content to append, and optional mode for the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass - async def exists(self, params: SessionFSExistsRequest) -> SessionFSExistsResult: "Checks whether a path exists in the client-provided session filesystem.\n\nArgs:\n params: Path to test for existence in the client-provided session filesystem.\n\nReturns:\n Indicates whether the requested path exists in the client-provided session filesystem." pass - async def stat(self, params: SessionFSStatRequest) -> SessionFSStatResult: "Gets metadata for a path in the client-provided session filesystem.\n\nArgs:\n params: Path whose metadata should be returned from the client-provided session filesystem.\n\nReturns:\n Filesystem metadata for the requested path, or a filesystem error if the stat failed." pass - async def mkdir(self, params: SessionFSMkdirRequest) -> SessionFSError | None: "Creates a directory in the client-provided session filesystem.\n\nArgs:\n params: Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode.\n\nReturns:\n Describes a filesystem error." pass - async def readdir(self, params: SessionFSReaddirRequest) -> SessionFSReaddirResult: "Lists entry names in a directory from the client-provided session filesystem.\n\nArgs:\n params: Directory path whose entries should be listed from the client-provided session filesystem.\n\nReturns:\n Names of entries in the requested directory, or a filesystem error if the read failed." pass - - async def readdir_with_types( - self, params: SessionFSReaddirWithTypesRequest - ) -> SessionFSReaddirWithTypesResult: + async def readdir_with_types(self, params: SessionFSReaddirWithTypesRequest) -> SessionFSReaddirWithTypesResult: "Lists directory entries with type information from the client-provided session filesystem.\n\nArgs:\n params: Directory path whose entries (with type information) should be listed from the client-provided session filesystem.\n\nReturns:\n Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed." pass - async def rm(self, params: SessionFSRmRequest) -> SessionFSError | None: "Removes a file or directory from the client-provided session filesystem.\n\nArgs:\n params: Path to remove from the client-provided session filesystem, with options for recursive removal and force.\n\nReturns:\n Describes a filesystem error." pass - async def rename(self, params: SessionFSRenameRequest) -> SessionFSError | None: "Renames or moves a path in the client-provided session filesystem.\n\nArgs:\n params: Source and destination paths for renaming or moving an entry in the client-provided session filesystem.\n\nReturns:\n Describes a filesystem error." pass - async def sqlite_query(self, params: SessionFSSqliteQueryRequest) -> SessionFSSqliteQueryResult: "Executes a SQLite query against the per-session database.\n\nArgs:\n params: SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database.\n\nReturns:\n Query results including rows, columns, and rows affected, or a filesystem error if execution failed." pass - - async def sqlite_exists( - self, params: SessionFSSqliteExistsRequest - ) -> SessionFSSqliteExistsResult: + async def sqlite_exists(self, params: SessionFSSqliteExistsRequest) -> SessionFSSqliteExistsResult: "Checks whether the per-session SQLite database already exists, without creating it.\n\nArgs:\n params: Identifies the target session.\n\nReturns:\n Indicates whether the per-session SQLite database already exists." pass - +# Experimental: this API group is experimental and may change or be removed. class CanvasHandler(Protocol): async def open(self, params: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: "Opens a canvas instance on the provider.\n\nArgs:\n params: Canvas open parameters sent to the provider.\n\nReturns:\n Canvas open result returned by the provider." pass - async def close(self, params: CanvasProviderCloseRequest) -> None: "Closes a canvas instance on the provider.\n\nArgs:\n params: Canvas close parameters sent to the provider." pass - async def invoke_action(self, params: CanvasProviderInvokeActionRequest) -> Any: "Invokes an action on an open canvas instance via the provider.\n\nArgs:\n params: Canvas action invocation parameters sent to the provider.\n\nReturns:\n Provider-supplied action result." pass - @dataclass class ClientSessionApiHandlers: session_fs: SessionFsHandler | None = None canvas: CanvasHandler | None = None - def register_client_session_api_handlers( client: "JsonRpcClient", get_handlers: Callable[[str], ClientSessionApiHandlers], ) -> None: """Register client-session request handlers on a JSON-RPC connection.""" - async def handle_session_fs_read_file(params: dict) -> dict | None: request = SessionFSReadFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.read_file(request) return result.to_dict() - client.set_request_handler("sessionFs.readFile", handle_session_fs_read_file) - async def handle_session_fs_write_file(params: dict) -> dict | None: request = SessionFSWriteFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.write_file(request) return result.to_dict() if result is not None else None - client.set_request_handler("sessionFs.writeFile", handle_session_fs_write_file) - async def handle_session_fs_append_file(params: dict) -> dict | None: request = SessionFSAppendFileRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.append_file(request) return result.to_dict() if result is not None else None - client.set_request_handler("sessionFs.appendFile", handle_session_fs_append_file) - async def handle_session_fs_exists(params: dict) -> dict | None: request = SessionFSExistsRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.exists(request) return result.to_dict() - client.set_request_handler("sessionFs.exists", handle_session_fs_exists) - async def handle_session_fs_stat(params: dict) -> dict | None: request = SessionFSStatRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.stat(request) return result.to_dict() - client.set_request_handler("sessionFs.stat", handle_session_fs_stat) - async def handle_session_fs_mkdir(params: dict) -> dict | None: request = SessionFSMkdirRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.mkdir(request) return result.to_dict() if result is not None else None - client.set_request_handler("sessionFs.mkdir", handle_session_fs_mkdir) - async def handle_session_fs_readdir(params: dict) -> dict | None: request = SessionFSReaddirRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.readdir(request) return result.to_dict() - client.set_request_handler("sessionFs.readdir", handle_session_fs_readdir) - async def handle_session_fs_readdir_with_types(params: dict) -> dict | None: request = SessionFSReaddirWithTypesRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.readdir_with_types(request) return result.to_dict() - client.set_request_handler("sessionFs.readdirWithTypes", handle_session_fs_readdir_with_types) - async def handle_session_fs_rm(params: dict) -> dict | None: request = SessionFSRmRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.rm(request) return result.to_dict() if result is not None else None - client.set_request_handler("sessionFs.rm", handle_session_fs_rm) - async def handle_session_fs_rename(params: dict) -> dict | None: request = SessionFSRenameRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.rename(request) return result.to_dict() if result is not None else None - client.set_request_handler("sessionFs.rename", handle_session_fs_rename) - async def handle_session_fs_sqlite_query(params: dict) -> dict | None: request = SessionFSSqliteQueryRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.sqlite_query(request) return result.to_dict() - client.set_request_handler("sessionFs.sqliteQuery", handle_session_fs_sqlite_query) - async def handle_session_fs_sqlite_exists(params: dict) -> dict | None: request = SessionFSSqliteExistsRequest.from_dict(params) handler = get_handlers(request.session_id).session_fs - if handler is None: - raise RuntimeError( - f"No session_fs handler registered for session: {request.session_id}" - ) + if handler is None: raise RuntimeError(f"No session_fs handler registered for session: {request.session_id}") result = await handler.sqlite_exists(request) return result.to_dict() - client.set_request_handler("sessionFs.sqliteExists", handle_session_fs_sqlite_exists) - async def handle_canvas_open(params: dict) -> dict | None: request = CanvasProviderOpenRequest.from_dict(params) handler = get_handlers(request.session_id).canvas - if handler is None: - raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") + if handler is None: raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") result = await handler.open(request) return result.to_dict() - client.set_request_handler("canvas.open", handle_canvas_open) - async def handle_canvas_close(params: dict) -> dict | None: request = CanvasProviderCloseRequest.from_dict(params) handler = get_handlers(request.session_id).canvas - if handler is None: - raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") + if handler is None: raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") await handler.close(request) return None - client.set_request_handler("canvas.close", handle_canvas_close) - async def handle_canvas_invoke_action(params: dict) -> dict | None: request = CanvasProviderInvokeActionRequest.from_dict(params) handler = get_handlers(request.session_id).canvas - if handler is None: - raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") + if handler is None: raise RuntimeError(f"No canvas handler registered for session: {request.session_id}") result = await handler.invoke_action(request) - return result.value if hasattr(result, "value") else result - + return result.value if hasattr(result, 'value') else result client.set_request_handler("canvas.invokeAction", handle_canvas_invoke_action) diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index 00b135060..6f5ddc9d5 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -925,6 +925,13 @@ pub struct CanvasCloseRequest { } /// Host capabilities +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasHostContextCapabilities { @@ -934,6 +941,13 @@ pub struct CanvasHostContextCapabilities { } /// Host context supplied by the runtime. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasHostContext { @@ -1100,6 +1114,13 @@ pub struct CanvasOpenRequest { } /// Canvas close parameters sent to the provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasProviderCloseRequest { @@ -1117,6 +1138,13 @@ pub struct CanvasProviderCloseRequest { } /// Canvas action invocation parameters sent to the provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasProviderInvokeActionRequest { @@ -1139,6 +1167,13 @@ pub struct CanvasProviderInvokeActionRequest { } /// Canvas open parameters sent to the provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasProviderOpenRequest { @@ -1159,6 +1194,13 @@ pub struct CanvasProviderOpenRequest { } /// Canvas open result returned by the provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasProviderOpenResult { @@ -5992,6 +6034,13 @@ pub struct SessionEnrichMetadataResult { } /// File path, content to append, and optional mode for the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsAppendFileRequest { @@ -6007,6 +6056,13 @@ pub struct SessionFsAppendFileRequest { } /// Describes a filesystem error. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsError { @@ -6018,6 +6074,13 @@ pub struct SessionFsError { } /// Path to test for existence in the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsExistsRequest { @@ -6028,6 +6091,13 @@ pub struct SessionFsExistsRequest { } /// Indicates whether the requested path exists in the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsExistsResult { @@ -6036,6 +6106,13 @@ pub struct SessionFsExistsResult { } /// Directory path to create in the client-provided session filesystem, with options for recursive creation and POSIX mode. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsMkdirRequest { @@ -6052,6 +6129,13 @@ pub struct SessionFsMkdirRequest { } /// Directory path whose entries should be listed from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReaddirRequest { @@ -6062,6 +6146,13 @@ pub struct SessionFsReaddirRequest { } /// Names of entries in the requested directory, or a filesystem error if the read failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReaddirResult { @@ -6073,6 +6164,13 @@ pub struct SessionFsReaddirResult { } /// Schema for the `SessionFsReaddirWithTypesEntry` type. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReaddirWithTypesEntry { @@ -6083,6 +6181,13 @@ pub struct SessionFsReaddirWithTypesEntry { } /// Directory path whose entries (with type information) should be listed from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReaddirWithTypesRequest { @@ -6093,6 +6198,13 @@ pub struct SessionFsReaddirWithTypesRequest { } /// Entries in the requested directory paired with file/directory type information, or a filesystem error if the read failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReaddirWithTypesResult { @@ -6104,6 +6216,13 @@ pub struct SessionFsReaddirWithTypesResult { } /// Path of the file to read from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReadFileRequest { @@ -6114,6 +6233,13 @@ pub struct SessionFsReadFileRequest { } /// File content as a UTF-8 string, or a filesystem error if the read failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsReadFileResult { @@ -6125,6 +6251,13 @@ pub struct SessionFsReadFileResult { } /// Source and destination paths for renaming or moving an entry in the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsRenameRequest { @@ -6137,6 +6270,13 @@ pub struct SessionFsRenameRequest { } /// Path to remove from the client-provided session filesystem, with options for recursive removal and force. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsRmRequest { @@ -6185,6 +6325,13 @@ pub struct SessionFsSetProviderResult { } /// Indicates whether the per-session SQLite database already exists. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsSqliteExistsResult { @@ -6193,6 +6340,13 @@ pub struct SessionFsSqliteExistsResult { } /// SQL query, query type, and optional bind parameters for executing a SQLite query against the per-session database. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsSqliteQueryRequest { @@ -6208,6 +6362,13 @@ pub struct SessionFsSqliteQueryRequest { } /// Query results including rows, columns, and rows affected, or a filesystem error if execution failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsSqliteQueryResult { @@ -6226,6 +6387,13 @@ pub struct SessionFsSqliteQueryResult { } /// Path whose metadata should be returned from the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsStatRequest { @@ -6236,6 +6404,13 @@ pub struct SessionFsStatRequest { } /// Filesystem metadata for the requested path, or a filesystem error if the stat failed. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsStatResult { @@ -6255,6 +6430,13 @@ pub struct SessionFsStatResult { } /// File path, content to write, and optional mode for the client-provided session filesystem. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsWriteFileRequest { @@ -11906,6 +12088,13 @@ pub struct SessionScheduleStopResult { } /// Identifies the target session. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionFsSqliteExistsParams { @@ -11914,6 +12103,13 @@ pub struct SessionFsSqliteExistsParams { } /// Canvas open result returned by the provider. +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CanvasOpenResult { @@ -13636,6 +13832,13 @@ pub enum SessionContextHostType { } /// Error classification +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum SessionFsErrorCode { /// The requested path does not exist. @@ -13649,6 +13852,13 @@ pub enum SessionFsErrorCode { } /// Entry type +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum SessionFsReaddirWithTypesEntryType { /// The entry is a file. @@ -13679,6 +13889,13 @@ pub enum SessionFsSetProviderConventions { } /// How to execute the query: 'exec' for DDL/multi-statement (no results), 'query' for SELECT (returns rows), 'run' for INSERT/UPDATE/DELETE (returns rowsAffected) +/// +///
+/// +/// **Experimental.** This type is part of an experimental wire-protocol surface +/// and may change or be removed in future SDK or CLI releases. +/// +///
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)] pub enum SessionFsSqliteQueryType { /// Execute DDL or multi-statement SQL without returning rows. From 9200462d9e1a719b4fe1dee44814841c0c76dc63 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 13:22:07 +0100 Subject: [PATCH 4/9] Codegen: emit @experimental on client session API handler interfaces (Node) The TypeScript codegen was computing groupExperimental but not using it to add @experimental JSDoc to handler interfaces. C#, Python, and Go already did this correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- nodejs/src/generated/rpc.ts | 32 ++++++++++++++++++++++++++++++++ scripts/codegen/typescript.ts | 3 +++ 2 files changed, 35 insertions(+) diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index be6a29818..890337192 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -861,6 +861,7 @@ export type SessionContextHostType = * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsErrorCode". */ +/** @experimental */ export type SessionFsErrorCode = /** The requested path does not exist. */ | "ENOENT" @@ -872,6 +873,7 @@ export type SessionFsErrorCode = * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirWithTypesEntryType". */ +/** @experimental */ export type SessionFsReaddirWithTypesEntryType = /** The entry is a file. */ | "file" @@ -894,6 +896,7 @@ export type SessionFsSetProviderConventions = * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsSqliteQueryType". */ +/** @experimental */ export type SessionFsSqliteQueryType = /** Execute DDL or multi-statement SQL without returning rows. */ | "exec" @@ -1781,6 +1784,7 @@ export interface CanvasCloseRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasHostContext". */ +/** @experimental */ export interface CanvasHostContext { capabilities?: CanvasHostContextCapabilities; } @@ -1790,6 +1794,7 @@ export interface CanvasHostContext { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasHostContextCapabilities". */ +/** @experimental */ export interface CanvasHostContextCapabilities { /** * Whether canvas rendering is supported @@ -1970,6 +1975,7 @@ export interface CanvasOpenRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasProviderCloseRequest". */ +/** @experimental */ export interface CanvasProviderCloseRequest { /** * Target session identifier @@ -1995,6 +2001,7 @@ export interface CanvasProviderCloseRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasProviderInvokeActionRequest". */ +/** @experimental */ export interface CanvasProviderInvokeActionRequest { /** * Target session identifier @@ -2030,6 +2037,7 @@ export interface CanvasProviderInvokeActionRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasProviderOpenRequest". */ +/** @experimental */ export interface CanvasProviderOpenRequest { /** * Target session identifier @@ -2061,6 +2069,7 @@ export interface CanvasProviderOpenRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "CanvasProviderOpenResult". */ +/** @experimental */ export interface CanvasProviderOpenResult { /** * URL for web-rendered canvases @@ -6578,6 +6587,7 @@ export interface SessionMetadata { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsAppendFileRequest". */ +/** @experimental */ export interface SessionFsAppendFileRequest { /** * Target session identifier @@ -6602,6 +6612,7 @@ export interface SessionFsAppendFileRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsError". */ +/** @experimental */ export interface SessionFsError { code: SessionFsErrorCode; /** @@ -6615,6 +6626,7 @@ export interface SessionFsError { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsExistsRequest". */ +/** @experimental */ export interface SessionFsExistsRequest { /** * Target session identifier @@ -6631,6 +6643,7 @@ export interface SessionFsExistsRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsExistsResult". */ +/** @experimental */ export interface SessionFsExistsResult { /** * Whether the path exists @@ -6643,6 +6656,7 @@ export interface SessionFsExistsResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsMkdirRequest". */ +/** @experimental */ export interface SessionFsMkdirRequest { /** * Target session identifier @@ -6667,6 +6681,7 @@ export interface SessionFsMkdirRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirRequest". */ +/** @experimental */ export interface SessionFsReaddirRequest { /** * Target session identifier @@ -6683,6 +6698,7 @@ export interface SessionFsReaddirRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirResult". */ +/** @experimental */ export interface SessionFsReaddirResult { /** * Entry names in the directory @@ -6696,6 +6712,7 @@ export interface SessionFsReaddirResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirWithTypesEntry". */ +/** @experimental */ export interface SessionFsReaddirWithTypesEntry { /** * Entry name @@ -6709,6 +6726,7 @@ export interface SessionFsReaddirWithTypesEntry { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirWithTypesRequest". */ +/** @experimental */ export interface SessionFsReaddirWithTypesRequest { /** * Target session identifier @@ -6725,6 +6743,7 @@ export interface SessionFsReaddirWithTypesRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReaddirWithTypesResult". */ +/** @experimental */ export interface SessionFsReaddirWithTypesResult { /** * Directory entries with type information @@ -6738,6 +6757,7 @@ export interface SessionFsReaddirWithTypesResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReadFileRequest". */ +/** @experimental */ export interface SessionFsReadFileRequest { /** * Target session identifier @@ -6754,6 +6774,7 @@ export interface SessionFsReadFileRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsReadFileResult". */ +/** @experimental */ export interface SessionFsReadFileResult { /** * File content as UTF-8 string @@ -6767,6 +6788,7 @@ export interface SessionFsReadFileResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsRenameRequest". */ +/** @experimental */ export interface SessionFsRenameRequest { /** * Target session identifier @@ -6787,6 +6809,7 @@ export interface SessionFsRenameRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsRmRequest". */ +/** @experimental */ export interface SessionFsRmRequest { /** * Target session identifier @@ -6853,6 +6876,7 @@ export interface SessionFsSetProviderResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsSqliteExistsResult". */ +/** @experimental */ export interface SessionFsSqliteExistsResult { /** * Whether the session database already exists @@ -6865,6 +6889,7 @@ export interface SessionFsSqliteExistsResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsSqliteQueryRequest". */ +/** @experimental */ export interface SessionFsSqliteQueryRequest { /** * Target session identifier @@ -6888,6 +6913,7 @@ export interface SessionFsSqliteQueryRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsSqliteQueryResult". */ +/** @experimental */ export interface SessionFsSqliteQueryResult { /** * For SELECT: array of row objects. For others: empty array. @@ -6915,6 +6941,7 @@ export interface SessionFsSqliteQueryResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsStatRequest". */ +/** @experimental */ export interface SessionFsStatRequest { /** * Target session identifier @@ -6931,6 +6958,7 @@ export interface SessionFsStatRequest { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsStatResult". */ +/** @experimental */ export interface SessionFsStatResult { /** * Whether the path is a file @@ -6960,6 +6988,7 @@ export interface SessionFsStatResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsWriteFileRequest". */ +/** @experimental */ export interface SessionFsWriteFileRequest { /** * Target session identifier @@ -9602,6 +9631,7 @@ export interface SessionMcpAppsCallToolResult { * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionFsSqliteExistsRequest". */ +/** @experimental */ export interface SessionFsSqliteExistsRequest { /** * Target session identifier @@ -11175,6 +11205,7 @@ export function createSessionRpc(connection: MessageConnection, sessionId: strin } /** Handler for `sessionFs` client session API methods. */ +/** @experimental */ export interface SessionFsHandler { /** * Reads a file from the client-provided session filesystem. @@ -11275,6 +11306,7 @@ export interface SessionFsHandler { } /** Handler for `canvas` client session API methods. */ +/** @experimental */ export interface CanvasHandler { /** * Opens a canvas instance on the provider. diff --git a/scripts/codegen/typescript.ts b/scripts/codegen/typescript.ts index 61e551d68..f3a4bd192 100644 --- a/scripts/codegen/typescript.ts +++ b/scripts/codegen/typescript.ts @@ -846,6 +846,9 @@ function emitClientSessionApiRegistration(clientSchema: Record) const groupExperimental = isNodeFullyExperimental(clientSchema[groupName] as Record); if (groupDeprecated) { lines.push(`/** @deprecated Handler for \`${groupName}\` client session API methods. */`); + } else if (groupExperimental) { + lines.push(`/** Handler for \`${groupName}\` client session API methods. */`); + lines.push(TS_EXPERIMENTAL_JSDOC); } else { lines.push(`/** Handler for \`${groupName}\` client session API methods. */`); } From fd090d2c0982650344ad19617e77a02de2590b77 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 14:24:11 +0100 Subject: [PATCH 5/9] Rust: Add canvas round-trip e2e tests for open, invokeAction, close Adds 3 new e2e tests matching the Node/C# canvas test coverage: - canvas_open_round_trip: verifies server->client open dispatch and response - canvas_invoke_action_round_trip: verifies action dispatch with input/result - canvas_close_round_trip: verifies close dispatch and list_open cleanup Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- rust/tests/e2e/canvas.rs | 253 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 240 insertions(+), 13 deletions(-) diff --git a/rust/tests/e2e/canvas.rs b/rust/tests/e2e/canvas.rs index 24cac0dea..b00c182bb 100644 --- a/rust/tests/e2e/canvas.rs +++ b/rust/tests/e2e/canvas.rs @@ -2,36 +2,85 @@ use std::sync::Arc; use async_trait::async_trait; use github_copilot_sdk::canvas::{ - CanvasDeclaration, CanvasHandler, CanvasOpenContext, CanvasOpenResponse, CanvasResult, + CanvasActionContext, CanvasDeclaration, CanvasHandler, CanvasLifecycleContext, + CanvasOpenContext, CanvasOpenResponse, CanvasResult, }; +use github_copilot_sdk::generated::api_types::CanvasAction; +use github_copilot_sdk::types::ExtensionInfo; +use parking_lot::Mutex; +use serde_json::{Value, json}; use super::support::with_e2e_context; -struct TestCanvasHandler; +struct TestCanvasHandler { + open_calls: Mutex>, + close_calls: Mutex>, + action_calls: Mutex>, +} + +impl TestCanvasHandler { + fn new() -> Self { + Self { + open_calls: Mutex::new(Vec::new()), + close_calls: Mutex::new(Vec::new()), + action_calls: Mutex::new(Vec::new()), + } + } +} #[async_trait] impl CanvasHandler for TestCanvasHandler { - async fn on_open(&self, _ctx: CanvasOpenContext) -> CanvasResult { - Ok(CanvasOpenResponse::default()) + async fn on_open(&self, ctx: CanvasOpenContext) -> CanvasResult { + self.open_calls.lock().push(ctx.clone()); + Ok(CanvasOpenResponse { + url: Some(format!( + "https://example.com/counter/{}", + ctx.instance_id + )), + title: Some(format!("Counter {}", ctx.instance_id)), + status: Some("ready".to_string()), + }) + } + + async fn on_action(&self, ctx: CanvasActionContext) -> CanvasResult { + self.action_calls.lock().push(ctx.clone()); + Ok(json!({ "newValue": 42 })) + } + + async fn on_close(&self, ctx: CanvasLifecycleContext) -> CanvasResult<()> { + self.close_calls.lock().push(ctx.clone()); + Ok(()) } } +fn canvas_session_config( + ctx: &super::support::E2eContext, + handler: Arc, +) -> github_copilot_sdk::types::SessionConfig { + let mut decl = CanvasDeclaration::new("counter", "Counter", "Tracks a counter value."); + decl.actions = Some(vec![CanvasAction { + name: "increment".to_string(), + description: Some("Increments the counter.".to_string()), + input_schema: None, + }]); + + ctx.approve_all_session_config() + .with_request_canvas_renderer(true) + .with_request_extensions(true) + .with_extension_info(ExtensionInfo::new("rust-sdk-tests", "canvas-provider")) + .with_canvases([decl]) + .with_canvas_handler(handler) +} + #[tokio::test] async fn canvas_list_discovers_declared_canvases() { with_e2e_context("canvas", "canvas_list_discovers_declared_canvases", |ctx| { Box::pin(async move { ctx.set_default_copilot_user(); let client = ctx.start_client().await; + let handler = Arc::new(TestCanvasHandler::new()); let session = client - .create_session( - ctx.approve_all_session_config() - .with_canvases([CanvasDeclaration::new( - "counter", - "Counter", - "Count things", - )]) - .with_canvas_handler(Arc::new(TestCanvasHandler)), - ) + .create_session(canvas_session_config(&ctx, handler)) .await .expect("create session"); @@ -39,6 +88,184 @@ async fn canvas_list_discovers_declared_canvases() { assert_eq!(result.canvases.len(), 1); assert_eq!(result.canvases[0].canvas_id, "counter"); + assert_eq!(result.canvases[0].display_name, "Counter"); + assert_eq!(result.canvases[0].description, "Tracks a counter value."); + + session.disconnect().await.expect("disconnect session"); + client.stop().await.expect("stop client"); + }) + }) + .await; +} + +#[tokio::test] +async fn canvas_open_round_trip() { + with_e2e_context("canvas", "canvas_open_round_trip", |ctx| { + Box::pin(async move { + ctx.set_default_copilot_user(); + let client = ctx.start_client().await; + let handler = Arc::new(TestCanvasHandler::new()); + let session = client + .create_session(canvas_session_config(&ctx, handler.clone())) + .await + .expect("create session"); + + let canvas_list = session.rpc().canvas().list().await.expect("list canvases"); + let canvas = &canvas_list.canvases[0]; + + let open_result = session + .rpc() + .canvas() + .open(github_copilot_sdk::generated::api_types::CanvasOpenRequest { + canvas_id: "counter".to_string(), + instance_id: "counter-1".to_string(), + extension_id: Some(canvas.extension_id.clone()), + input: Some(json!({ "start": 41 })), + }) + .await + .expect("open canvas"); + + assert_eq!(open_result.instance_id, "counter-1"); + assert_eq!( + open_result.title.as_deref(), + Some("Counter counter-1") + ); + assert_eq!(open_result.status.as_deref(), Some("ready")); + assert_eq!( + open_result.url.as_deref(), + Some("https://example.com/counter/counter-1") + ); + + let opens = handler.open_calls.lock(); + assert_eq!(opens.len(), 1); + assert_eq!(opens[0].canvas_id, "counter"); + assert_eq!(opens[0].instance_id, "counter-1"); + drop(opens); + + let open_list = session + .rpc() + .canvas() + .list_open() + .await + .expect("list open canvases"); + assert_eq!(open_list.open_canvases.len(), 1); + assert_eq!(open_list.open_canvases[0].instance_id, "counter-1"); + + session.disconnect().await.expect("disconnect session"); + client.stop().await.expect("stop client"); + }) + }) + .await; +} + +#[tokio::test] +async fn canvas_invoke_action_round_trip() { + with_e2e_context("canvas", "canvas_invoke_action_round_trip", |ctx| { + Box::pin(async move { + ctx.set_default_copilot_user(); + let client = ctx.start_client().await; + let handler = Arc::new(TestCanvasHandler::new()); + let session = client + .create_session(canvas_session_config(&ctx, handler.clone())) + .await + .expect("create session"); + + let canvas_list = session.rpc().canvas().list().await.expect("list canvases"); + let canvas = &canvas_list.canvases[0]; + + session + .rpc() + .canvas() + .open(github_copilot_sdk::generated::api_types::CanvasOpenRequest { + canvas_id: "counter".to_string(), + instance_id: "counter-2".to_string(), + extension_id: Some(canvas.extension_id.clone()), + input: Some(json!({})), + }) + .await + .expect("open canvas"); + + let result = session + .rpc() + .canvas() + .invoke_action( + github_copilot_sdk::generated::api_types::CanvasInvokeActionRequest { + instance_id: "counter-2".to_string(), + action_name: "increment".to_string(), + input: Some(json!({ "delta": 1 })), + }, + ) + .await + .expect("invoke action"); + + assert_eq!(result.result, Some(json!({ "newValue": 42 }))); + + let actions = handler.action_calls.lock(); + assert_eq!(actions.len(), 1); + assert_eq!(actions[0].canvas_id, "counter"); + assert_eq!(actions[0].instance_id, "counter-2"); + assert_eq!(actions[0].action_name, "increment"); + assert_eq!(actions[0].input, Some(json!({ "delta": 1 }))); + drop(actions); + + session.disconnect().await.expect("disconnect session"); + client.stop().await.expect("stop client"); + }) + }) + .await; +} + +#[tokio::test] +async fn canvas_close_round_trip() { + with_e2e_context("canvas", "canvas_close_round_trip", |ctx| { + Box::pin(async move { + ctx.set_default_copilot_user(); + let client = ctx.start_client().await; + let handler = Arc::new(TestCanvasHandler::new()); + let session = client + .create_session(canvas_session_config(&ctx, handler.clone())) + .await + .expect("create session"); + + let canvas_list = session.rpc().canvas().list().await.expect("list canvases"); + let canvas = &canvas_list.canvases[0]; + + session + .rpc() + .canvas() + .open(github_copilot_sdk::generated::api_types::CanvasOpenRequest { + canvas_id: "counter".to_string(), + instance_id: "counter-3".to_string(), + extension_id: Some(canvas.extension_id.clone()), + input: Some(json!({})), + }) + .await + .expect("open canvas"); + + assert!(handler.close_calls.lock().is_empty()); + + session + .rpc() + .canvas() + .close(github_copilot_sdk::generated::api_types::CanvasCloseRequest { + instance_id: "counter-3".to_string(), + }) + .await + .expect("close canvas"); + + let closes = handler.close_calls.lock(); + assert_eq!(closes.len(), 1); + assert_eq!(closes[0].canvas_id, "counter"); + assert_eq!(closes[0].instance_id, "counter-3"); + drop(closes); + + let open_list = session + .rpc() + .canvas() + .list_open() + .await + .expect("list open canvases"); + assert!(open_list.open_canvases.is_empty()); session.disconnect().await.expect("disconnect session"); client.stop().await.expect("stop client"); From bcebc3eeff52c3192b45e1fd3c20f2c2c9763e86 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 15:06:11 +0100 Subject: [PATCH 6/9] Drop canvas type aliases, fix opaque result codegen for C#/Go - Remove friendly type aliases (CanvasOpenContext, CanvasOpenResponse, etc.) from all 5 languages; use codegen names (CanvasProviderOpenRequest, CanvasProviderOpenResult, etc.) directly. Canvas is experimental and days old, so no backward-compat concern. - Fix C# codegen: opaque results (x-opaque-json) now emit 'object' instead of a named wrapper type, preventing double-wrapping of invokeAction result. - Fix Go codegen: opaque results now emit 'any' instead of a named struct pointer, preventing the same double-wrapping issue. - Restore accidentally removed ExtensionInfo from Go SessionConfig, ResumeSessionConfig, and wire structs. - Fix Go canvas.close adapter to return nil (null on wire) instead of empty struct ({} on wire). - Update all tests (unit + e2e) across all languages. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/src/Generated/Rpc.cs | 4 +-- dotnet/src/Session.cs | 4 +-- go/canvas.go | 41 +++++++++------------- go/canvas_test.go | 30 ++++++++-------- go/internal/e2e/canvas_e2e_test.go | 8 ++--- go/rpc/zrpc.go | 2 +- go/session.go | 6 ++-- go/types.go | 8 ++++- nodejs/src/canvas.ts | 24 ++----------- nodejs/src/extension.ts | 4 --- nodejs/src/index.ts | 4 --- nodejs/src/session.ts | 4 +-- python/copilot/__init__.py | 8 ----- python/copilot/canvas.py | 16 ++------- python/e2e/test_canvas_e2e.py | 28 ++++++++------- python/test_canvas.py | 37 ++++++++------------ rust/src/canvas.rs | 55 ++++++++++++++---------------- rust/tests/e2e/canvas.rs | 22 ++++++------ rust/tests/session_test.rs | 14 ++++---- scripts/codegen/csharp.ts | 6 ++-- scripts/codegen/go.ts | 16 ++++++--- 21 files changed, 147 insertions(+), 194 deletions(-) diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 3c86973d3..4c305dd81 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -14690,7 +14690,7 @@ public interface ICanvasHandler /// Canvas action invocation parameters sent to the provider. /// The to monitor for cancellation requests. The default is . /// Provider-supplied action result. - Task InvokeActionAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default); + Task InvokeActionAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default); } /// Provides all client session API handler groups for a session. @@ -14797,7 +14797,7 @@ public static void RegisterClientSessionApiHandlers(JsonRpc rpc, Func>)(async (request, cancellationToken) => + rpc.SetLocalRpcMethod("canvas.invokeAction", (Func>)(async (request, cancellationToken) => { var handler = getHandlers(request.SessionId).Canvas; if (handler is null) throw new InvalidOperationException($"No canvas handler registered for session: {request.SessionId}"); diff --git a/dotnet/src/Session.cs b/dotnet/src/Session.cs index 663b2dab2..08044d685 100644 --- a/dotnet/src/Session.cs +++ b/dotnet/src/Session.cs @@ -938,12 +938,12 @@ public async Task CloseAsync(CanvasProviderCloseRequest request, CancellationTok } } - public async Task InvokeActionAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default) + public async Task InvokeActionAsync(CanvasProviderInvokeActionRequest request, CancellationToken cancellationToken = default) { try { var result = await handler.OnActionAsync(request, cancellationToken).ConfigureAwait(false); - return new CanvasInvokeActionResult { Result = SerializeActionResult(result) }; + return SerializeActionResult(result); } catch (CanvasError ce) { diff --git a/go/canvas.go b/go/canvas.go index d56039adf..49216c3d9 100644 --- a/go/canvas.go +++ b/go/canvas.go @@ -2,7 +2,7 @@ // // This file mirrors rust/src/canvas.rs. The SDK does not maintain a per-canvas // registry; multiplexing across declared canvases is the CanvasHandler -// implementor's responsibility (typically by switching on CanvasOpenContext.CanvasID). +// implementor's responsibility (typically by switching on CanvasProviderOpenRequest.CanvasID). package copilot @@ -27,23 +27,14 @@ type CanvasDeclaration struct { Actions []rpc.CanvasAction `json:"actions,omitempty"` } -// CanvasOpenResponse is the response returned from CanvasHandler.OnOpen. -type CanvasOpenResponse = rpc.CanvasProviderOpenResult - -// CanvasHostContext carries host capability hints passed to canvas provider callbacks. -type CanvasHostContext = rpc.CanvasHostContext - -// CanvasHostCapabilities describes host capability details passed to canvas provider callbacks. -type CanvasHostCapabilities = rpc.CanvasHostContextCapabilities - -// CanvasOpenContext is the context handed to CanvasHandler.OnOpen. -type CanvasOpenContext = rpc.CanvasProviderOpenRequest - -// CanvasActionContext is the context handed to CanvasHandler.OnAction. -type CanvasActionContext = rpc.CanvasProviderInvokeActionRequest - -// CanvasLifecycleContext is the context handed to a canvas's close lifecycle hook. -type CanvasLifecycleContext = rpc.CanvasProviderCloseRequest +// ExtensionInfo carries stable extension identity for session participants +// that provide canvases. +type ExtensionInfo struct { + // Source is the extension namespace/source, e.g. "github-app". + Source string `json:"source"` + // Name is the extension identifier within that source, e.g. "my-app". + Name string `json:"name"` +} // CanvasError is a structured error returned from canvas handlers. // @@ -80,7 +71,7 @@ func CanvasErrorNoHandler() *CanvasError { // A session installs a single CanvasHandler (via SessionConfig.CanvasHandler). // The handler receives every inbound `canvas.open` / `canvas.close` / // `canvas.invokeAction` JSON-RPC request the runtime issues for this session -// and decides — typically by inspecting CanvasOpenContext.CanvasID — which +// and decides — typically by inspecting CanvasProviderOpenRequest.CanvasID — which // application-side canvas should handle the call. // // The SDK does not maintain a per-canvas registry; multiplexing across declared @@ -89,9 +80,9 @@ func CanvasErrorNoHandler() *CanvasError { // Embed CanvasHandlerDefaults to inherit no-op defaults for OnClose and a // "no handler" error for OnAction. type CanvasHandler interface { - OnOpen(ctx context.Context, c CanvasOpenContext) (CanvasOpenResponse, error) - OnClose(ctx context.Context, c CanvasLifecycleContext) error - OnAction(ctx context.Context, c CanvasActionContext) (any, error) + OnOpen(ctx context.Context, c rpc.CanvasProviderOpenRequest) (rpc.CanvasProviderOpenResult, error) + OnClose(ctx context.Context, c rpc.CanvasProviderCloseRequest) error + OnAction(ctx context.Context, c rpc.CanvasProviderInvokeActionRequest) (any, error) } // CanvasHandlerDefaults supplies default OnClose / OnAction implementations @@ -102,15 +93,15 @@ type CanvasHandler interface { // type myHandler struct { // copilot.CanvasHandlerDefaults // } -// func (h *myHandler) OnOpen(ctx context.Context, c copilot.CanvasOpenContext) (copilot.CanvasOpenResponse, error) { ... } +// func (h *myHandler) OnOpen(ctx context.Context, c rpc.CanvasProviderOpenRequest) (rpc.CanvasProviderOpenResult, error) { ... } type CanvasHandlerDefaults struct{} // OnClose returns nil by default. -func (CanvasHandlerDefaults) OnClose(ctx context.Context, c CanvasLifecycleContext) error { +func (CanvasHandlerDefaults) OnClose(ctx context.Context, c rpc.CanvasProviderCloseRequest) error { return nil } // OnAction returns CanvasErrorNoHandler() by default. -func (CanvasHandlerDefaults) OnAction(ctx context.Context, c CanvasActionContext) (any, error) { +func (CanvasHandlerDefaults) OnAction(ctx context.Context, c rpc.CanvasProviderInvokeActionRequest) (any, error) { return nil, CanvasErrorNoHandler() } diff --git a/go/canvas_test.go b/go/canvas_test.go index 0ef3dffd3..34d4a160d 100644 --- a/go/canvas_test.go +++ b/go/canvas_test.go @@ -69,7 +69,7 @@ func TestCanvasDeclaration_OmitsEmptyActions(t *testing.T) { func TestCanvasHandlerDefaults_OnAction_ReturnsNoHandler(t *testing.T) { d := CanvasHandlerDefaults{} - _, err := d.OnAction(context.Background(), CanvasActionContext{}) + _, err := d.OnAction(context.Background(), rpc.CanvasProviderInvokeActionRequest{}) if err == nil { t.Fatalf("expected error from default OnAction") } @@ -84,7 +84,7 @@ func TestCanvasHandlerDefaults_OnAction_ReturnsNoHandler(t *testing.T) { func TestCanvasHandlerDefaults_OnClose_ReturnsNil(t *testing.T) { d := CanvasHandlerDefaults{} - if err := d.OnClose(context.Background(), CanvasLifecycleContext{}); err != nil { + if err := d.OnClose(context.Background(), rpc.CanvasProviderCloseRequest{}); err != nil { t.Fatalf("expected nil from default OnClose, got %v", err) } } @@ -98,27 +98,27 @@ func TestCanvasError_ErrorString(t *testing.T) { type recordingCanvasHandler struct { CanvasHandlerDefaults - openCtx *CanvasOpenContext - closeCtx *CanvasLifecycleContext - actionCtx *CanvasActionContext - openResult CanvasOpenResponse + openCtx *rpc.CanvasProviderOpenRequest + closeCtx *rpc.CanvasProviderCloseRequest + actionCtx *rpc.CanvasProviderInvokeActionRequest + openResult rpc.CanvasProviderOpenResult actionResult any openErr error closeErr error actionErr error } -func (h *recordingCanvasHandler) OnOpen(ctx context.Context, c CanvasOpenContext) (CanvasOpenResponse, error) { +func (h *recordingCanvasHandler) OnOpen(ctx context.Context, c rpc.CanvasProviderOpenRequest) (rpc.CanvasProviderOpenResult, error) { h.openCtx = &c return h.openResult, h.openErr } -func (h *recordingCanvasHandler) OnClose(ctx context.Context, c CanvasLifecycleContext) error { +func (h *recordingCanvasHandler) OnClose(ctx context.Context, c rpc.CanvasProviderCloseRequest) error { h.closeCtx = &c return h.closeErr } -func (h *recordingCanvasHandler) OnAction(ctx context.Context, c CanvasActionContext) (any, error) { +func (h *recordingCanvasHandler) OnAction(ctx context.Context, c rpc.CanvasProviderInvokeActionRequest) (any, error) { h.actionCtx = &c return h.actionResult, h.actionErr } @@ -127,7 +127,7 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) { title := "Echo" url := "https://example.test/echo" handler := &recordingCanvasHandler{ - openResult: CanvasOpenResponse{URL: &url, Title: &title}, + openResult: rpc.CanvasProviderOpenResult{URL: &url, Title: &title}, actionResult: map[string]any{ "count": float64(2), }, @@ -173,9 +173,9 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) { if handler.actionCtx.ActionName != "increment" { t.Fatalf("unexpected action ctx: %+v", handler.actionCtx) } - result, ok := actionResp.Result.(map[string]any) + result, ok := actionResp.(map[string]any) if !ok || result["count"] != float64(2) { - t.Fatalf("unexpected action result: %#v", actionResp.Result) + t.Fatalf("unexpected action result: %#v", actionResp) } closeResp, err := session.clientSessionApis.Canvas.Close(&rpc.CanvasProviderCloseRequest{ @@ -187,8 +187,8 @@ func TestCanvasAdapter_DispatchesToHandler(t *testing.T) { if err != nil { t.Fatalf("unexpected close error: %v", err) } - if closeResp == nil { - t.Fatal("expected non-nil close response") + if closeResp != nil { + t.Fatal("expected nil close response") } if handler.closeCtx == nil || handler.closeCtx.CanvasID != "echo" { t.Fatalf("unexpected close ctx: %+v", handler.closeCtx) @@ -230,7 +230,7 @@ func TestCanvasRegisterClientSessionApiHandlers_RawJSONRoundTrip(t *testing.T) { server := jsonrpc2.NewClient(serverToClientWriter, clientToServerReader) session := newTestCanvasSession("s1") session.registerCanvasHandler(&recordingCanvasHandler{ - openResult: CanvasOpenResponse{Status: strPtr("ready")}, + openResult: rpc.CanvasProviderOpenResult{Status: strPtr("ready")}, actionResult: map[string]any{"count": float64(2)}, }) rpc.RegisterClientSessionApiHandlers(server, func(sessionID string) *rpc.ClientSessionApiHandlers { diff --git a/go/internal/e2e/canvas_e2e_test.go b/go/internal/e2e/canvas_e2e_test.go index 0cf41f415..7f7b71544 100644 --- a/go/internal/e2e/canvas_e2e_test.go +++ b/go/internal/e2e/canvas_e2e_test.go @@ -138,7 +138,7 @@ type canvasActionCall struct { Input any } -func (h *testCanvasHandler) OnOpen(ctx context.Context, req copilot.CanvasOpenContext) (copilot.CanvasOpenResponse, error) { +func (h *testCanvasHandler) OnOpen(ctx context.Context, req rpc.CanvasProviderOpenRequest) (rpc.CanvasProviderOpenResult, error) { h.mu.Lock() defer h.mu.Unlock() @@ -152,14 +152,14 @@ func (h *testCanvasHandler) OnOpen(ctx context.Context, req copilot.CanvasOpenCo }) h.counts[req.InstanceID] = numberField(req.Input, "startValue") - return copilot.CanvasOpenResponse{ + return rpc.CanvasProviderOpenResult{ URL: copilot.String("https://example.test/counter/" + req.InstanceID), Title: copilot.String("Counter"), Status: copilot.String("ready"), }, nil } -func (h *testCanvasHandler) OnClose(ctx context.Context, req copilot.CanvasLifecycleContext) error { +func (h *testCanvasHandler) OnClose(ctx context.Context, req rpc.CanvasProviderCloseRequest) error { h.mu.Lock() defer h.mu.Unlock() @@ -171,7 +171,7 @@ func (h *testCanvasHandler) OnClose(ctx context.Context, req copilot.CanvasLifec return nil } -func (h *testCanvasHandler) OnAction(ctx context.Context, req copilot.CanvasActionContext) (any, error) { +func (h *testCanvasHandler) OnAction(ctx context.Context, req rpc.CanvasProviderInvokeActionRequest) (any, error) { h.mu.Lock() defer h.mu.Unlock() diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index e8ca1d7bc..bc2dbe2f2 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -11898,7 +11898,7 @@ type CanvasHandler interface { // Parameters: Canvas action invocation parameters sent to the provider. // // Returns: Provider-supplied action result. - InvokeAction(request *CanvasProviderInvokeActionRequest) (*CanvasInvokeActionResult, error) + InvokeAction(request *CanvasProviderInvokeActionRequest) (any, error) // Opens a canvas instance on the provider. // // RPC method: canvas.open. diff --git a/go/session.go b/go/session.go index c3e13c0e4..6c89137b3 100644 --- a/go/session.go +++ b/go/session.go @@ -149,10 +149,10 @@ func (a *canvasClientSessionAdapter) Close(request *rpc.CanvasProviderCloseReque if err := handler.OnClose(context.Background(), *request); err != nil { return nil, canvasResultError(err) } - return &rpc.CanvasCloseResult{}, nil + return nil, nil } -func (a *canvasClientSessionAdapter) InvokeAction(request *rpc.CanvasProviderInvokeActionRequest) (*rpc.CanvasInvokeActionResult, error) { +func (a *canvasClientSessionAdapter) InvokeAction(request *rpc.CanvasProviderInvokeActionRequest) (any, error) { if request == nil { return nil, canvasJSONRPCError(NewCanvasError("canvas_handler_unset", "missing canvas action request")) } @@ -164,7 +164,7 @@ func (a *canvasClientSessionAdapter) InvokeAction(request *rpc.CanvasProviderInv if actionErr != nil { return nil, canvasResultError(actionErr) } - return &rpc.CanvasInvokeActionResult{Result: result}, nil + return result, nil } func (a *canvasClientSessionAdapter) Open(request *rpc.CanvasProviderOpenRequest) (*rpc.CanvasProviderOpenResult, error) { diff --git a/go/types.go b/go/types.go index 2b4c07cff..a38ec6f03 100644 --- a/go/types.go +++ b/go/types.go @@ -938,8 +938,10 @@ type SessionConfig struct { RequestExtensions *bool // CanvasHandler receives inbound canvas.open / canvas.close / canvas.invokeAction // requests for this session. The SDK does not maintain a per-canvas registry; - // the handler must dispatch on CanvasOpenContext.CanvasID itself. + // the handler must dispatch on CanvasProviderOpenRequest.CanvasID itself. CanvasHandler CanvasHandler `json:"-"` + // ExtensionInfo identifies the stable extension providing this session's canvases. + ExtensionInfo *ExtensionInfo } type Tool struct { Name string `json:"name"` @@ -1201,6 +1203,8 @@ type ResumeSessionConfig struct { RequestExtensions *bool // CanvasHandler receives inbound canvas.* requests for this session. See SessionConfig.CanvasHandler. CanvasHandler CanvasHandler `json:"-"` + // ExtensionInfo identifies the stable extension providing this session's canvases. + ExtensionInfo *ExtensionInfo } type ProviderConfig struct { // Type is the provider type: "openai", "azure", or "anthropic". Defaults to "openai". @@ -1428,6 +1432,7 @@ type createSessionRequest struct { Canvases []CanvasDeclaration `json:"canvases,omitempty"` RequestCanvasRenderer *bool `json:"requestCanvasRenderer,omitempty"` RequestExtensions *bool `json:"requestExtensions,omitempty"` + ExtensionInfo *ExtensionInfo `json:"extensionInfo,omitempty"` Traceparent string `json:"traceparent,omitempty"` Tracestate string `json:"tracestate,omitempty"` } @@ -1487,6 +1492,7 @@ type resumeSessionRequest struct { OpenCanvases []rpc.OpenCanvasInstance `json:"openCanvases,omitempty"` RequestCanvasRenderer *bool `json:"requestCanvasRenderer,omitempty"` RequestExtensions *bool `json:"requestExtensions,omitempty"` + ExtensionInfo *ExtensionInfo `json:"extensionInfo,omitempty"` Traceparent string `json:"traceparent,omitempty"` Tracestate string `json:"tracestate,omitempty"` } diff --git a/nodejs/src/canvas.ts b/nodejs/src/canvas.ts index 48d60d389..47fcf3560 100644 --- a/nodejs/src/canvas.ts +++ b/nodejs/src/canvas.ts @@ -23,24 +23,6 @@ export type { CanvasJsonSchema, CanvasHostContext } from "./generated/rpc.js"; * is how the host focuses an existing panel; reload is a renderer-only concern. */ -/* - * Wire-contract types re-exported from codegen. These are the single source of - * truth — the Zod schemas in copilot-agent-runtime drive the JSON Schema which - * drives the codegen which produces these types. - */ - -/** Response returned from a canvas `open` handler. */ -export type CanvasOpenResponse = CanvasProviderOpenResult; - -/** Context handed to a canvas's `open` handler. */ -export type CanvasOpenContext = CanvasProviderOpenRequest; - -/** Context handed to a canvas action handler. */ -export type CanvasActionContext = CanvasProviderInvokeActionRequest; - -/** Context handed to a canvas's `onClose` handler. */ -export type CanvasLifecycleContext = CanvasProviderCloseRequest; - /** * A single agent-callable action contributed by a canvas. The metadata * (`name`, `description`, `inputSchema`) is serialized over the wire on @@ -58,7 +40,7 @@ export interface CanvasAction { /** Optional JSON Schema for the action's `input` payload. */ inputSchema?: CanvasJsonSchema; /** Required per-action dispatch handler. */ - handler: (ctx: CanvasActionContext) => Promise | unknown; + handler: (ctx: CanvasProviderInvokeActionRequest) => Promise | unknown; } /** @@ -118,14 +100,14 @@ export interface CanvasOptions { actions?: CanvasAction[]; /** Required. Open a new canvas instance. */ - open: (ctx: CanvasOpenContext) => Promise | CanvasOpenResponse; + open: (ctx: CanvasProviderOpenRequest) => Promise | CanvasProviderOpenResult; /** * Optional. Notified when a canvas instance is closed by the user, the * agent, or the host. Fire-and-forget: the return value is ignored and * errors are logged but not surfaced to the runtime. */ - onClose?: (ctx: CanvasLifecycleContext) => Promise | void; + onClose?: (ctx: CanvasProviderCloseRequest) => Promise | void; } /** A registered canvas: declarative metadata + in-process handler closures. diff --git a/nodejs/src/extension.ts b/nodejs/src/extension.ts index 95346dec4..0e315ea28 100644 --- a/nodejs/src/extension.ts +++ b/nodejs/src/extension.ts @@ -16,13 +16,9 @@ export { CanvasError, createCanvas, type CanvasAction, - type CanvasActionContext, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, - type CanvasLifecycleContext, - type CanvasOpenContext, - type CanvasOpenResponse, type CanvasOptions, } from "./canvas.js"; diff --git a/nodejs/src/index.ts b/nodejs/src/index.ts index 42498c58f..c39621c0b 100644 --- a/nodejs/src/index.ts +++ b/nodejs/src/index.ts @@ -16,13 +16,9 @@ export { CanvasError, createCanvas, type CanvasAction, - type CanvasActionContext, type CanvasDeclaration, type CanvasHostContext, type CanvasJsonSchema, - type CanvasLifecycleContext, - type CanvasOpenContext, - type CanvasOpenResponse, type CanvasOptions, } from "./canvas.js"; export { diff --git a/nodejs/src/session.ts b/nodejs/src/session.ts index b0d83de54..b7b53de0c 100644 --- a/nodejs/src/session.ts +++ b/nodejs/src/session.ts @@ -10,7 +10,7 @@ import type { MessageConnection } from "vscode-jsonrpc/node.js"; import { ConnectionError, ResponseError } from "vscode-jsonrpc/node.js"; import { createSessionRpc } from "./generated/rpc.js"; -import type { ClientSessionApiHandlers } from "./generated/rpc.js"; +import type { ClientSessionApiHandlers, CanvasInvokeActionResult } from "./generated/rpc.js"; import { type Canvas, CanvasError } from "./canvas.js"; import type { OpenCanvasInstance } from "./generated/rpc.js"; import { getTraceContext } from "./telemetry.js"; @@ -679,7 +679,7 @@ export class CopilotSession { "No handler implemented for this canvas action" ); } - return (await handler(params)) as Record; + return (await handler(params)) as CanvasInvokeActionResult; }, }; } diff --git a/python/copilot/__init__.py b/python/copilot/__init__.py index 1fcb10e9e..175d032a9 100644 --- a/python/copilot/__init__.py +++ b/python/copilot/__init__.py @@ -6,16 +6,12 @@ from .canvas import ( CanvasAction, - CanvasActionContext, CanvasDeclaration, CanvasError, CanvasHandler, CanvasHostContext, CanvasHostContextCapabilities, CanvasJsonSchema, - CanvasLifecycleContext, - CanvasOpenContext, - CanvasOpenResponse, ExtensionInfo, OpenCanvasInstance, ) @@ -146,16 +142,12 @@ "AutoModeSwitchRequest", "AutoModeSwitchResponse", "CanvasAction", - "CanvasActionContext", "CanvasDeclaration", "CanvasError", "CanvasHandler", "CanvasHostContext", "CanvasHostContextCapabilities", "CanvasJsonSchema", - "CanvasLifecycleContext", - "CanvasOpenContext", - "CanvasOpenResponse", "ChildProcessRuntimeConnection", "CloudSessionOptions", "CloudSessionRepository", diff --git a/python/copilot/canvas.py b/python/copilot/canvas.py index 0bb80c17a..772c15b39 100644 --- a/python/copilot/canvas.py +++ b/python/copilot/canvas.py @@ -28,16 +28,12 @@ __all__ = [ "CanvasAction", - "CanvasActionContext", "CanvasDeclaration", "CanvasError", "CanvasHandler", "CanvasHostContext", "CanvasHostContextCapabilities", "CanvasJsonSchema", - "CanvasLifecycleContext", - "CanvasOpenContext", - "CanvasOpenResponse", "ExtensionInfo", "OpenCanvasInstance", ] @@ -92,12 +88,6 @@ def to_dict(self) -> dict[str, Any]: return result -CanvasOpenResponse = CanvasProviderOpenResult -CanvasOpenContext = CanvasProviderOpenRequest -CanvasActionContext = CanvasProviderInvokeActionRequest -CanvasLifecycleContext = CanvasProviderCloseRequest - - class CanvasError(Exception): """Structured error returned from canvas handlers.""" @@ -131,16 +121,16 @@ class CanvasHandler(ABC): """Provider-side canvas lifecycle handler.""" @abstractmethod - async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: + async def on_open(self, ctx: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: """Open a new canvas instance. May raise :class:`CanvasError` to surface a structured failure to the host. """ - async def on_close(self, ctx: CanvasLifecycleContext) -> None: + async def on_close(self, ctx: CanvasProviderCloseRequest) -> None: """Canvas was closed by the user or agent. Default: no-op.""" - async def on_action(self, ctx: CanvasActionContext) -> Any: + async def on_action(self, ctx: CanvasProviderInvokeActionRequest) -> Any: """Handle a non-lifecycle action declared by the canvas.""" raise CanvasError.no_handler() diff --git a/python/e2e/test_canvas_e2e.py b/python/e2e/test_canvas_e2e.py index 77bd932fd..095ba6d2d 100644 --- a/python/e2e/test_canvas_e2e.py +++ b/python/e2e/test_canvas_e2e.py @@ -6,14 +6,18 @@ from copilot import ( CanvasAction, - CanvasActionContext, CanvasDeclaration, CanvasHandler, - CanvasLifecycleContext, - CanvasOpenContext, - CanvasOpenResponse, ) -from copilot.generated.rpc import CanvasCloseRequest, CanvasInvokeActionRequest, CanvasOpenRequest +from copilot.generated.rpc import ( + CanvasCloseRequest, + CanvasInvokeActionRequest, + CanvasOpenRequest, + CanvasProviderCloseRequest, + CanvasProviderInvokeActionRequest, + CanvasProviderOpenRequest, + CanvasProviderOpenResult, +) from copilot.session import CopilotSession, PermissionHandler from .testharness import E2ETestContext @@ -23,22 +27,22 @@ class _CounterCanvasHandler(CanvasHandler): def __init__(self) -> None: - self.open_calls: list[CanvasOpenContext] = [] - self.action_calls: list[CanvasActionContext] = [] - self.close_calls: list[CanvasLifecycleContext] = [] + self.open_calls: list[CanvasProviderOpenRequest] = [] + self.action_calls: list[CanvasProviderInvokeActionRequest] = [] + self.close_calls: list[CanvasProviderCloseRequest] = [] - async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: + async def on_open(self, ctx: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: self.open_calls.append(ctx) - return CanvasOpenResponse( + return CanvasProviderOpenResult( url="https://example.test/counter", title="Counter Canvas", status="ready", ) - async def on_close(self, ctx: CanvasLifecycleContext) -> None: + async def on_close(self, ctx: CanvasProviderCloseRequest) -> None: self.close_calls.append(ctx) - async def on_action(self, ctx: CanvasActionContext) -> dict[str, int]: + async def on_action(self, ctx: CanvasProviderInvokeActionRequest) -> dict[str, int]: self.action_calls.append(ctx) return {"newValue": 42} diff --git a/python/test_canvas.py b/python/test_canvas.py index 304b03abd..99075fe52 100644 --- a/python/test_canvas.py +++ b/python/test_canvas.py @@ -9,13 +9,9 @@ from copilot._jsonrpc import JsonRpcError from copilot.canvas import ( CanvasAction, - CanvasActionContext, CanvasDeclaration, CanvasError, CanvasHandler, - CanvasLifecycleContext, - CanvasOpenContext, - CanvasOpenResponse, ExtensionInfo, OpenCanvasInstance, ) @@ -24,6 +20,7 @@ CanvasProviderCloseRequest, CanvasProviderInvokeActionRequest, CanvasProviderOpenRequest, + CanvasProviderOpenResult, ) from copilot.session import CopilotSession @@ -64,19 +61,13 @@ def test_extension_info_serializes(): def test_canvas_open_response_drops_none_fields(): - assert CanvasOpenResponse().to_dict() == {} - assert CanvasOpenResponse(url="https://x", status="ok").to_dict() == { + assert CanvasProviderOpenResult().to_dict() == {} + assert CanvasProviderOpenResult(url="https://x", status="ok").to_dict() == { "url": "https://x", "status": "ok", } -def test_context_aliases_use_codegen_types(): - assert CanvasOpenContext is CanvasProviderOpenRequest - assert CanvasActionContext is CanvasProviderInvokeActionRequest - assert CanvasLifecycleContext is CanvasProviderCloseRequest - - def test_canvas_error_envelope_and_factories(): err = CanvasError("oops", "something broke") assert err.code == "oops" @@ -92,11 +83,11 @@ def test_canvas_error_envelope_and_factories(): async def test_default_canvas_handler_on_action_raises_no_handler(): class StubHandler(CanvasHandler): - async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: - return CanvasOpenResponse() + async def on_open(self, ctx: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: + return CanvasProviderOpenResult() handler = StubHandler() - ctx = CanvasActionContext( + ctx = CanvasProviderInvokeActionRequest( session_id="s", extension_id="e", canvas_id="c", @@ -112,18 +103,18 @@ async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: async def test_register_canvas_handler_wires_generated_canvas_adapter(): class Handler(CanvasHandler): def __init__(self) -> None: - self.open_calls: list[CanvasOpenContext] = [] - self.close_calls: list[CanvasLifecycleContext] = [] - self.action_calls: list[CanvasActionContext] = [] + self.open_calls: list[CanvasProviderOpenRequest] = [] + self.close_calls: list[CanvasProviderCloseRequest] = [] + self.action_calls: list[CanvasProviderInvokeActionRequest] = [] - async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: + async def on_open(self, ctx: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: self.open_calls.append(ctx) - return CanvasOpenResponse(url="https://canvas.example", title="Hi", status="ready") + return CanvasProviderOpenResult(url="https://canvas.example", title="Hi", status="ready") - async def on_close(self, ctx: CanvasLifecycleContext) -> None: + async def on_close(self, ctx: CanvasProviderCloseRequest) -> None: self.close_calls.append(ctx) - async def on_action(self, ctx: CanvasActionContext) -> Any: + async def on_action(self, ctx: CanvasProviderInvokeActionRequest) -> Any: self.action_calls.append(ctx) return {"echo": ctx.input} @@ -174,7 +165,7 @@ async def on_action(self, ctx: CanvasActionContext) -> Any: async def test_canvas_adapter_translates_canvas_error_to_jsonrpc_error(): class Handler(CanvasHandler): - async def on_open(self, ctx: CanvasOpenContext) -> CanvasOpenResponse: + async def on_open(self, ctx: CanvasProviderOpenRequest) -> CanvasProviderOpenResult: raise CanvasError("bad", "fail") session = CopilotSession("sess-1", client=None) diff --git a/rust/src/canvas.rs b/rust/src/canvas.rs index f98292269..b6f9f376c 100644 --- a/rust/src/canvas.rs +++ b/rust/src/canvas.rs @@ -53,24 +53,6 @@ impl CanvasDeclaration { } } -/// Response returned from [`CanvasHandler::on_open`]. -pub type CanvasOpenResponse = crate::generated::api_types::CanvasProviderOpenResult; - -/// Host capabilities passed to canvas provider callbacks. -pub use crate::generated::api_types::CanvasHostContext; - -/// Host capability details passed to canvas provider callbacks. -pub use crate::generated::api_types::CanvasHostContextCapabilities as CanvasHostCapabilities; - -/// Context handed to [`CanvasHandler::on_open`]. -pub type CanvasOpenContext = crate::generated::api_types::CanvasProviderOpenRequest; - -/// Context handed to [`CanvasHandler::on_action`]. -pub type CanvasActionContext = crate::generated::api_types::CanvasProviderInvokeActionRequest; - -/// Context handed to a canvas's close lifecycle hook. -pub type CanvasLifecycleContext = crate::generated::api_types::CanvasProviderCloseRequest; - /// Structured error returned from canvas handlers. #[derive(Debug, Clone, Error, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "camelCase")] @@ -109,7 +91,8 @@ pub type CanvasResult = Result; /// [`SessionConfig::with_canvas_handler`](crate::types::SessionConfig::with_canvas_handler)). /// The handler receives every inbound `canvas.open` / `canvas.close` / /// `canvas.invokeAction` JSON-RPC request the runtime issues for this -/// session and decides — typically by inspecting [`CanvasOpenContext::canvas_id`] +/// session and decides — typically by inspecting +/// [`CanvasProviderOpenRequest::canvas_id`](crate::generated::api_types::CanvasProviderOpenRequest::canvas_id) /// — which application-side canvas should handle the call. /// /// The SDK does not maintain a per-canvas registry; multiplexing across @@ -117,15 +100,24 @@ pub type CanvasResult = Result; #[async_trait] pub trait CanvasHandler: Send + Sync { /// Open a new canvas instance. - async fn on_open(&self, ctx: CanvasOpenContext) -> CanvasResult; + async fn on_open( + &self, + ctx: crate::generated::api_types::CanvasProviderOpenRequest, + ) -> CanvasResult; /// Handle a non-lifecycle action declared by the canvas. - async fn on_action(&self, _ctx: CanvasActionContext) -> CanvasResult { + async fn on_action( + &self, + _ctx: crate::generated::api_types::CanvasProviderInvokeActionRequest, + ) -> CanvasResult { Err(CanvasError::no_handler()) } /// Canvas was closed by the user or agent. - async fn on_close(&self, _ctx: CanvasLifecycleContext) -> CanvasResult<()> { + async fn on_close( + &self, + _ctx: crate::generated::api_types::CanvasProviderCloseRequest, + ) -> CanvasResult<()> { Ok(()) } } @@ -135,21 +127,24 @@ mod tests { use serde_json::json; use super::*; + use crate::generated::api_types::{ + CanvasProviderInvokeActionRequest, CanvasProviderOpenRequest, CanvasProviderOpenResult, + }; use crate::types::SessionId; struct EchoHandler; #[async_trait] impl CanvasHandler for EchoHandler { - async fn on_open(&self, ctx: CanvasOpenContext) -> CanvasResult { - Ok(CanvasOpenResponse { + async fn on_open(&self, ctx: CanvasProviderOpenRequest) -> CanvasResult { + Ok(CanvasProviderOpenResult { url: Some(format!("https://example.test/{}", ctx.canvas_id)), title: Some("Echo".to_string()), status: Some("ready".to_string()), }) } - async fn on_action(&self, ctx: CanvasActionContext) -> CanvasResult { + async fn on_action(&self, ctx: CanvasProviderInvokeActionRequest) -> CanvasResult { Ok(json!({ "echoed": ctx.action_name, "input": ctx.input })) } } @@ -180,7 +175,7 @@ mod tests { async fn handler_on_open_returns_response() { let handler = EchoHandler; let response = handler - .on_open(CanvasOpenContext { + .on_open(CanvasProviderOpenRequest { session_id: SessionId::from("s1"), extension_id: "project:echo".to_string(), canvas_id: "echo".to_string(), @@ -200,7 +195,7 @@ mod tests { async fn handler_on_action_returns_value() { let handler = EchoHandler; let result = handler - .on_action(CanvasActionContext { + .on_action(CanvasProviderInvokeActionRequest { session_id: SessionId::from("s1"), extension_id: "project:echo".to_string(), canvas_id: "echo".to_string(), @@ -221,8 +216,8 @@ mod tests { struct OpenOnly; #[async_trait] impl CanvasHandler for OpenOnly { - async fn on_open(&self, _ctx: CanvasOpenContext) -> CanvasResult { - Ok(CanvasOpenResponse { + async fn on_open(&self, _ctx: CanvasProviderOpenRequest) -> CanvasResult { + Ok(CanvasProviderOpenResult { url: None, title: None, status: None, @@ -231,7 +226,7 @@ mod tests { } let err = OpenOnly - .on_action(CanvasActionContext { + .on_action(CanvasProviderInvokeActionRequest { session_id: SessionId::from("s1"), extension_id: "project:open-only".to_string(), canvas_id: "x".to_string(), diff --git a/rust/tests/e2e/canvas.rs b/rust/tests/e2e/canvas.rs index b00c182bb..1defe2c11 100644 --- a/rust/tests/e2e/canvas.rs +++ b/rust/tests/e2e/canvas.rs @@ -1,11 +1,11 @@ use std::sync::Arc; use async_trait::async_trait; -use github_copilot_sdk::canvas::{ - CanvasActionContext, CanvasDeclaration, CanvasHandler, CanvasLifecycleContext, - CanvasOpenContext, CanvasOpenResponse, CanvasResult, +use github_copilot_sdk::canvas::{CanvasDeclaration, CanvasHandler, CanvasResult}; +use github_copilot_sdk::generated::api_types::{ + CanvasAction, CanvasProviderCloseRequest, CanvasProviderInvokeActionRequest, + CanvasProviderOpenRequest, CanvasProviderOpenResult, }; -use github_copilot_sdk::generated::api_types::CanvasAction; use github_copilot_sdk::types::ExtensionInfo; use parking_lot::Mutex; use serde_json::{Value, json}; @@ -13,9 +13,9 @@ use serde_json::{Value, json}; use super::support::with_e2e_context; struct TestCanvasHandler { - open_calls: Mutex>, - close_calls: Mutex>, - action_calls: Mutex>, + open_calls: Mutex>, + close_calls: Mutex>, + action_calls: Mutex>, } impl TestCanvasHandler { @@ -30,9 +30,9 @@ impl TestCanvasHandler { #[async_trait] impl CanvasHandler for TestCanvasHandler { - async fn on_open(&self, ctx: CanvasOpenContext) -> CanvasResult { + async fn on_open(&self, ctx: CanvasProviderOpenRequest) -> CanvasResult { self.open_calls.lock().push(ctx.clone()); - Ok(CanvasOpenResponse { + Ok(CanvasProviderOpenResult { url: Some(format!( "https://example.com/counter/{}", ctx.instance_id @@ -42,12 +42,12 @@ impl CanvasHandler for TestCanvasHandler { }) } - async fn on_action(&self, ctx: CanvasActionContext) -> CanvasResult { + async fn on_action(&self, ctx: CanvasProviderInvokeActionRequest) -> CanvasResult { self.action_calls.lock().push(ctx.clone()); Ok(json!({ "newValue": 42 })) } - async fn on_close(&self, ctx: CanvasLifecycleContext) -> CanvasResult<()> { + async fn on_close(&self, ctx: CanvasProviderCloseRequest) -> CanvasResult<()> { self.close_calls.lock().push(ctx.clone()); Ok(()) } diff --git a/rust/tests/session_test.rs b/rust/tests/session_test.rs index 7f848018d..322cc5fbb 100644 --- a/rust/tests/session_test.rs +++ b/rust/tests/session_test.rs @@ -6,11 +6,11 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::time::Duration; use async_trait::async_trait; -use github_copilot_sdk::canvas::{ - CanvasActionContext, CanvasDeclaration, CanvasHandler, CanvasOpenContext, CanvasOpenResponse, - CanvasResult, +use github_copilot_sdk::canvas::{CanvasDeclaration, CanvasHandler, CanvasResult}; +use github_copilot_sdk::generated::api_types::{ + CanvasInstanceAvailability, CanvasProviderInvokeActionRequest, CanvasProviderOpenRequest, + CanvasProviderOpenResult, OpenCanvasInstance, }; -use github_copilot_sdk::generated::api_types::{CanvasInstanceAvailability, OpenCanvasInstance}; use github_copilot_sdk::handler::{ ApproveAllHandler, AutoModeSwitchHandler, AutoModeSwitchResponse, ElicitationHandler, ExitPlanModeHandler, ExitPlanModeResult, UserInputHandler, UserInputResponse, @@ -31,15 +31,15 @@ struct TestCanvasHandler; #[async_trait] impl CanvasHandler for TestCanvasHandler { - async fn on_open(&self, ctx: CanvasOpenContext) -> CanvasResult { - Ok(CanvasOpenResponse { + async fn on_open(&self, ctx: CanvasProviderOpenRequest) -> CanvasResult { + Ok(CanvasProviderOpenResult { url: Some(format!("https://example.test/{}", ctx.canvas_id)), title: Some("Test Canvas".to_string()), status: Some("ready".to_string()), }) } - async fn on_action(&self, ctx: CanvasActionContext) -> CanvasResult { + async fn on_action(&self, ctx: CanvasProviderInvokeActionRequest) -> CanvasResult { Ok(serde_json::json!({ "actionName": ctx.action_name, "input": ctx.input, diff --git a/scripts/codegen/csharp.ts b/scripts/codegen/csharp.ts index 13a7a1417..883895cde 100644 --- a/scripts/codegen/csharp.ts +++ b/scripts/codegen/csharp.ts @@ -1452,12 +1452,14 @@ function getCSharpSchemaTypeName(schema: JSONSchema7 | null | undefined, fallbac return getRpcSchemaTypeName(schema, fallback); } -/** Returns the C# type for a method's result, accounting for nullable anyOf wrappers. */ +/** Returns the C# type for a method's result, accounting for nullable anyOf wrappers and opaque JSON. */ function resolvedResultTypeName(method: RpcMethod): string { const schema = getMethodResultSchema(method); if (!schema) return resultTypeName(method); + if (isOpaqueJson(schema)) return "object"; const inner = getNullableInner(schema); if (inner) { + if (isOpaqueJson(inner)) return "object?"; // Nullable wrapper: resolve the inner $ref type name with "?" suffix const innerName = inner.$ref ? typeToClassName(refTypeName(inner.$ref, rpcDefinitions)) @@ -2181,7 +2183,7 @@ function emitClientSessionApiRegistration(clientSchema: Record, for (const { methods } of groups) { for (const method of methods) { const resultSchema = getMethodResultSchema(method); - if (!isVoidSchema(resultSchema)) { + if (!isVoidSchema(resultSchema) && !isOpaqueJson(resultSchema)) { emitRpcResultType(resultTypeName(method), resultSchema!, "public", classes); } diff --git a/scripts/codegen/go.ts b/scripts/codegen/go.ts index 49e537d8e..a8b85dc0b 100644 --- a/scripts/codegen/go.ts +++ b/scripts/codegen/go.ts @@ -34,6 +34,7 @@ import { isIntegerSchemaBoundedToInt32, isNodeFullyDeprecated, isNodeFullyExperimental, + isOpaqueJson, isRpcMethod, isSchemaDeprecated, isSchemaExperimental, @@ -3559,6 +3560,8 @@ async function generateRpc(schemaPath?: string): Promise { if (nullableInner) { // Nullable results (e.g., *SessionFSError) don't need a wrapper type; // the inner type is already in definitions via shared hoisting. + } else if (isOpaqueJson(resultSchema)) { + // Opaque JSON results map to `any` — no named struct needed. } else if (isVoidSchema(resultSchema)) { // Emit an empty struct for void results (forward-compatible with adding fields later) allDefinitions[goResultTypeName(method)] = { @@ -4035,10 +4038,15 @@ function emitClientSessionApiRegistration(lines: string[], clientSchema: Record< } const paramsType = resolveType(goParamsTypeName(method)); const nullableInner = resultSchema ? getNullableInner(resultSchema) : undefined; - const resultType = nullableInner - ? resolveType(goNullableResultTypeName(method, nullableInner)) - : resolveType(goResultTypeName(method)); - const returnType = unionInfos.has(resultType) ? resultType : `*${resultType}`; + let returnType: string; + if (isOpaqueJson(resultSchema)) { + returnType = "any"; + } else { + const resultType = nullableInner + ? resolveType(goNullableResultTypeName(method, nullableInner)) + : resolveType(goResultTypeName(method)); + returnType = unionInfos.has(resultType) ? resultType : `*${resultType}`; + } lines.push(`\t${clientHandlerMethodName(method.rpcMethod)}(request *${paramsType}) (${returnType}, error)`); } lines.push(`}`); From 569c533a6051ef535cea70027db816bdf3354108 Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Mon, 25 May 2026 15:15:11 +0100 Subject: [PATCH 7/9] Wrap canvas handler errors with structured envelope in Node and Python Node: catch CanvasError and generic exceptions in canvas adapter, throw ResponseError with {code, message} data envelope. Python: catch generic exceptions (not just CanvasError) in _CanvasHandlerAdapter, wrap as canvas_handler_error envelope. All 5 SDKs now consistently produce structured error envelopes for canvas handler failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- nodejs/src/session.ts | 30 +++++++++++++++++++++++++----- python/copilot/session.py | 14 ++++++++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/nodejs/src/session.ts b/nodejs/src/session.ts index b7b53de0c..76cdb577d 100644 --- a/nodejs/src/session.ts +++ b/nodejs/src/session.ts @@ -8,7 +8,7 @@ */ import type { MessageConnection } from "vscode-jsonrpc/node.js"; -import { ConnectionError, ResponseError } from "vscode-jsonrpc/node.js"; +import { ConnectionError, ErrorCodes, ResponseError } from "vscode-jsonrpc/node.js"; import { createSessionRpc } from "./generated/rpc.js"; import type { ClientSessionApiHandlers, CanvasInvokeActionResult } from "./generated/rpc.js"; import { type Canvas, CanvasError } from "./canvas.js"; @@ -660,13 +660,21 @@ export class CopilotSession { async open(params) { const canvas = self.canvases.get(params.canvasId); if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`); - return (await canvas.open(params)) ?? {}; + try { + return (await canvas.open(params)) ?? {}; + } catch (error) { + throw toCanvasRpcError(error); + } }, async close(params) { const canvas = self.canvases.get(params.canvasId); if (!canvas) throw new Error(`No canvas registered with id "${params.canvasId}"`); - if (canvas.onClose) { - await canvas.onClose(params); + try { + if (canvas.onClose) { + await canvas.onClose(params); + } + } catch (error) { + throw toCanvasRpcError(error); } }, async invokeAction(params) { @@ -679,7 +687,11 @@ export class CopilotSession { "No handler implemented for this canvas action" ); } - return (await handler(params)) as CanvasInvokeActionResult; + try { + return (await handler(params)) as CanvasInvokeActionResult; + } catch (error) { + throw toCanvasRpcError(error); + } }, }; } @@ -1215,3 +1227,11 @@ function isToolResultObject(value: unknown): value is ToolResultObject { return allowedResultTypes.includes((value as ToolResultObject).resultType); } + +/** Convert a canvas handler error into a ResponseError with a structured data envelope. */ +function toCanvasRpcError(error: unknown): ResponseError { + if (error instanceof ResponseError) return error; + const code = error instanceof CanvasError ? error.code : "canvas_handler_error"; + const message = error instanceof Error ? error.message : String(error); + return new ResponseError(ErrorCodes.InternalError, message, { code, message }); +} diff --git a/python/copilot/session.py b/python/copilot/session.py index b17e88ec4..2b95778c8 100644 --- a/python/copilot/session.py +++ b/python/copilot/session.py @@ -971,18 +971,32 @@ async def open(self, params: CanvasProviderOpenRequest) -> CanvasProviderOpenRes return await self._handler.on_open(params) except CanvasError as err: raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err + except Exception as err: + raise _canvas_handler_error(err) from err async def close(self, params: CanvasProviderCloseRequest) -> None: try: await self._handler.on_close(params) except CanvasError as err: raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err + except Exception as err: + raise _canvas_handler_error(err) from err async def invoke_action(self, params: CanvasProviderInvokeActionRequest) -> Any: try: return await self._handler.on_action(params) except CanvasError as err: raise JsonRpcError(-32603, err.message, data=err.to_envelope()) from err + except Exception as err: + raise _canvas_handler_error(err) from err + + +def _canvas_handler_error(err: Exception) -> JsonRpcError: + return JsonRpcError( + -32603, + str(err), + data={"code": "canvas_handler_error", "message": str(err)}, + ) class CopilotSession: From 5a30e6298f9ab5c22d4b2710487393720ee60dfa Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 26 May 2026 10:24:17 +0100 Subject: [PATCH 8/9] Codegen: Fix Python opaque JSON result deserialization CanvasInvokeActionResult gets collapsed to Any by quicktype when all properties are x-opaque-json. The method emitter tried Any.from_dict() which fails because Any is a typing construct, not a generated class. Add isAnyType check so opaque/Any-typed results skip from_dict and return the raw value directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- scripts/codegen/python.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/codegen/python.ts b/scripts/codegen/python.ts index 1af315eac..77bbb4813 100644 --- a/scripts/codegen/python.ts +++ b/scripts/codegen/python.ts @@ -18,6 +18,7 @@ import { getRpcSchemaTypeName, getSessionEventsSchemaPath, isObjectSchema, + isOpaqueJson, isVoidSchema, getNullableInner, isRpcMethod, @@ -3225,7 +3226,8 @@ function emitMethod(lines: string[], name: string, method: RpcMethod, isSession: const effectiveResultSchema = nullableInner ?? resultSchema; const hasResult = !isVoidSchema(resultSchema) && !nullableInner; const hasNullableResult = !!nullableInner; - const resultIsObject = isPythonObjectResultSchema(effectiveResultSchema); + const resultIsOpaque = isOpaqueJson(effectiveResultSchema); + const resultIsObject = !resultIsOpaque && isPythonObjectResultSchema(effectiveResultSchema); let resultType: string; if (hasNullableResult) { @@ -3264,7 +3266,11 @@ function emitMethod(lines: string[], name: string, method: RpcMethod, isSession: // Deserialize helper const innerTypeName = hasNullableResult ? resolveType(pythonResultTypeName(method, nullableInner)) : resultType; + const isAnyType = innerTypeName === "Any"; const deserialize = (expr: string) => { + if (resultIsOpaque || isAnyType) { + return expr; + } if (hasNullableResult) { return resultIsObject ? `${innerTypeName}.from_dict(${expr}) if ${expr} is not None else None` From ff3c68f3598b32bd12175dad3c7597561d5bc75d Mon Sep 17 00:00:00 2001 From: Steve Sanderson Date: Tue, 26 May 2026 10:24:24 +0100 Subject: [PATCH 9/9] Codegen: Regenerate all languages from updated runtime schemas Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- dotnet/src/Generated/Rpc.cs | 6 +-- go/rpc/zrpc.go | 55 ++++++++++++++++++-- go/rpc/zrpc_encoding.go | 81 +++++++++++++++++++++++++++++ nodejs/src/generated/rpc.ts | 45 +++++++++++++++-- python/copilot/generated/rpc.py | 90 ++++++++++++++++++++++++--------- rust/src/generated/api_types.rs | 17 +++++-- rust/src/generated/rpc.rs | 2 +- 7 files changed, 256 insertions(+), 40 deletions(-) diff --git a/dotnet/src/Generated/Rpc.cs b/dotnet/src/Generated/Rpc.cs index 4c305dd81..3652fd784 100644 --- a/dotnet/src/Generated/Rpc.cs +++ b/dotnet/src/Generated/Rpc.cs @@ -1011,11 +1011,11 @@ internal sealed class SessionsReleaseLockRequest public string SessionId { get; set; } = string.Empty; } -/// The same metadata records, with summary and context fields backfilled where available. +/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. [Experimental(Diagnostics.Experimental)] public sealed class SessionEnrichMetadataResult { - /// Same records, with summary and context backfilled. + /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. [JsonPropertyName("sessions")] public IList Sessions { get => field ??= []; set; } } @@ -12098,7 +12098,7 @@ public async Task ReleaseLockAsync(string sessionId, /// Backfills missing summary and context fields on the supplied session metadata records. /// Session metadata records to enrich. Records that already have summary and context are returned unchanged. /// The to monitor for cancellation requests. The default is . - /// The same metadata records, with summary and context fields backfilled where available. + /// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. public async Task EnrichMetadataAsync(IList sessions, CancellationToken cancellationToken = default) { ArgumentNullException.ThrowIfNull(sessions); diff --git a/go/rpc/zrpc.go b/go/rpc/zrpc.go index bc2dbe2f2..9ba283cfd 100644 --- a/go/rpc/zrpc.go +++ b/go/rpc/zrpc.go @@ -1822,6 +1822,8 @@ type McpServerConfigHTTP struct { OauthGrantType *McpServerConfigHTTPOauthGrantType `json:"oauthGrantType,omitempty"` // Whether the configured OAuth client is public and does not require a client secret. OauthPublicClient *bool `json:"oauthPublicClient,omitempty"` + // OIDC token configuration. When truthy, a token is automatically gathered. + Oidc McpServerConfigHTTPOidc `json:"oidc,omitempty"` // Timeout in milliseconds for tool calls to this server. Timeout *int64 `json:"timeout,omitempty"` // Tools to include. Defaults to all tools if not specified. @@ -1838,6 +1840,8 @@ func (McpServerConfigHTTP) mcpServerConfig() {} type McpServerConfigStdio struct { // Command-line arguments passed to the Stdio MCP server process. Args []string `json:"args,omitempty"` + // Authentication configuration for this server. + Auth McpServerConfigStdioAuth `json:"auth,omitempty"` // Executable command used to start the Stdio MCP server process. Command string `json:"command"` // Working directory for the Stdio MCP server process. @@ -1850,6 +1854,8 @@ type McpServerConfigStdio struct { // Whether this server is a built-in fallback used when the user has not configured their // own server. IsDefaultServer *bool `json:"isDefaultServer,omitempty"` + // OIDC token configuration. When truthy, a token is automatically gathered. + Oidc McpServerConfigStdioOidc `json:"oidc,omitempty"` // Timeout in milliseconds for tool calls to this server. Timeout *int64 `json:"timeout,omitempty"` // Tools to include. Defaults to all tools if not specified. @@ -1864,6 +1870,45 @@ type McpServerConfigHTTPAuth struct { RedirectPort *int32 `json:"redirectPort,omitempty"` } +// OIDC token configuration. When truthy, a token is automatically gathered. +type McpServerConfigHTTPOidc interface { + mcpServerConfigHTTPOidc() +} + +type McpServerConfigHTTPOidcAnyMap map[string]any + +func (McpServerConfigHTTPOidcAnyMap) mcpServerConfigHTTPOidc() {} + +type McpServerConfigHTTPOidcBoolean bool + +func (McpServerConfigHTTPOidcBoolean) mcpServerConfigHTTPOidc() {} + +// Authentication configuration for this server. +type McpServerConfigStdioAuth interface { + mcpServerConfigStdioAuth() +} + +type McpServerConfigStdioAuthAnyMap map[string]any + +func (McpServerConfigStdioAuthAnyMap) mcpServerConfigStdioAuth() {} + +type McpServerConfigStdioAuthBoolean bool + +func (McpServerConfigStdioAuthBoolean) mcpServerConfigStdioAuth() {} + +// OIDC token configuration. When truthy, a token is automatically gathered. +type McpServerConfigStdioOidc interface { + mcpServerConfigStdioOidc() +} + +type McpServerConfigStdioOidcAnyMap map[string]any + +func (McpServerConfigStdioOidcAnyMap) mcpServerConfigStdioOidc() {} + +type McpServerConfigStdioOidcBoolean bool + +func (McpServerConfigStdioOidcBoolean) mcpServerConfigStdioOidc() {} + // MCP servers configured for the session, with their connection status. // Experimental: McpServerList is part of an experimental API and may change or be removed. type McpServerList struct { @@ -3920,11 +3965,13 @@ type SessionContextInfo struct { TotalTokens int64 `json:"totalTokens"` } -// The same metadata records, with summary and context fields backfilled where available. +// The enriched metadata records, with summary and context fields backfilled where +// available. Sessions confirmed empty and unnamed are omitted. // Experimental: SessionEnrichMetadataResult is part of an experimental API and may change // or be removed. type SessionEnrichMetadataResult struct { - // Same records, with summary and context backfilled + // Enriched records, with summary and context backfilled. Sessions confirmed empty and + // unnamed may be omitted. Sessions []SessionMetadata `json:"sessions"` } @@ -7844,8 +7891,8 @@ func (a *ServerSessionsApi) Connect(ctx context.Context, params *ConnectRemoteSe // // Parameters: Session metadata records to enrich with summary and context information. // -// Returns: The same metadata records, with summary and context fields backfilled where -// available. +// Returns: The enriched metadata records, with summary and context fields backfilled where +// available. Sessions confirmed empty and unnamed are omitted. func (a *ServerSessionsApi) EnrichMetadata(ctx context.Context, params *SessionsEnrichMetadataRequest) (*SessionEnrichMetadataResult, error) { raw, err := a.client.Request("sessions.enrichMetadata", params) if err != nil { diff --git a/go/rpc/zrpc_encoding.go b/go/rpc/zrpc_encoding.go index f013a1fef..9224f65cf 100644 --- a/go/rpc/zrpc_encoding.go +++ b/go/rpc/zrpc_encoding.go @@ -668,6 +668,25 @@ func (r RawMcpServerConfigData) MarshalJSON() ([]byte, error) { return []byte("null"), nil } +func unmarshalMcpServerConfigHTTPOidc(data []byte) (McpServerConfigHTTPOidc, error) { + if string(data) == "null" { + return nil, nil + } + { + var value bool + if err := json.Unmarshal(data, &value); err == nil { + return McpServerConfigHTTPOidcBoolean(value), nil + } + } + { + var value McpServerConfigHTTPOidcAnyMap + if err := json.Unmarshal(data, &value); err == nil { + return value, nil + } + } + return nil, errors.New("data did not match any union variant for McpServerConfigHTTPOidc") +} + func (r *McpServerConfigHTTP) UnmarshalJSON(data []byte) error { type rawMcpServerConfigHTTP struct { Auth *McpServerConfigHTTPAuth `json:"auth,omitempty"` @@ -677,6 +696,7 @@ func (r *McpServerConfigHTTP) UnmarshalJSON(data []byte) error { OauthClientID *string `json:"oauthClientId,omitempty"` OauthGrantType *McpServerConfigHTTPOauthGrantType `json:"oauthGrantType,omitempty"` OauthPublicClient *bool `json:"oauthPublicClient,omitempty"` + Oidc json.RawMessage `json:"oidc,omitempty"` Timeout *int64 `json:"timeout,omitempty"` Tools []string `json:"tools,omitempty"` Type *McpServerConfigHTTPType `json:"type,omitempty"` @@ -699,6 +719,13 @@ func (r *McpServerConfigHTTP) UnmarshalJSON(data []byte) error { r.OauthClientID = raw.OauthClientID r.OauthGrantType = raw.OauthGrantType r.OauthPublicClient = raw.OauthPublicClient + if raw.Oidc != nil { + value, err := unmarshalMcpServerConfigHTTPOidc(raw.Oidc) + if err != nil { + return err + } + r.Oidc = value + } r.Timeout = raw.Timeout r.Tools = raw.Tools r.Type = raw.Type @@ -706,14 +733,54 @@ func (r *McpServerConfigHTTP) UnmarshalJSON(data []byte) error { return nil } +func unmarshalMcpServerConfigStdioAuth(data []byte) (McpServerConfigStdioAuth, error) { + if string(data) == "null" { + return nil, nil + } + { + var value bool + if err := json.Unmarshal(data, &value); err == nil { + return McpServerConfigStdioAuthBoolean(value), nil + } + } + { + var value McpServerConfigStdioAuthAnyMap + if err := json.Unmarshal(data, &value); err == nil { + return value, nil + } + } + return nil, errors.New("data did not match any union variant for McpServerConfigStdioAuth") +} + +func unmarshalMcpServerConfigStdioOidc(data []byte) (McpServerConfigStdioOidc, error) { + if string(data) == "null" { + return nil, nil + } + { + var value bool + if err := json.Unmarshal(data, &value); err == nil { + return McpServerConfigStdioOidcBoolean(value), nil + } + } + { + var value McpServerConfigStdioOidcAnyMap + if err := json.Unmarshal(data, &value); err == nil { + return value, nil + } + } + return nil, errors.New("data did not match any union variant for McpServerConfigStdioOidc") +} + func (r *McpServerConfigStdio) UnmarshalJSON(data []byte) error { type rawMcpServerConfigStdio struct { Args []string `json:"args,omitempty"` + Auth json.RawMessage `json:"auth,omitempty"` Command string `json:"command"` Cwd *string `json:"cwd,omitempty"` Env map[string]string `json:"env,omitempty"` FilterMapping json.RawMessage `json:"filterMapping,omitempty"` IsDefaultServer *bool `json:"isDefaultServer,omitempty"` + Oidc json.RawMessage `json:"oidc,omitempty"` Timeout *int64 `json:"timeout,omitempty"` Tools []string `json:"tools,omitempty"` } @@ -722,6 +789,13 @@ func (r *McpServerConfigStdio) UnmarshalJSON(data []byte) error { return err } r.Args = raw.Args + if raw.Auth != nil { + value, err := unmarshalMcpServerConfigStdioAuth(raw.Auth) + if err != nil { + return err + } + r.Auth = value + } r.Command = raw.Command r.Cwd = raw.Cwd r.Env = raw.Env @@ -733,6 +807,13 @@ func (r *McpServerConfigStdio) UnmarshalJSON(data []byte) error { r.FilterMapping = value } r.IsDefaultServer = raw.IsDefaultServer + if raw.Oidc != nil { + value, err := unmarshalMcpServerConfigStdioOidc(raw.Oidc) + if err != nil { + return err + } + r.Oidc = value + } r.Timeout = raw.Timeout r.Tools = raw.Tools return nil diff --git a/nodejs/src/generated/rpc.ts b/nodejs/src/generated/rpc.ts index 890337192..c79da28e9 100644 --- a/nodejs/src/generated/rpc.ts +++ b/nodejs/src/generated/rpc.ts @@ -452,6 +452,28 @@ export type McpAppsSetHostContextDetailsPlatform = * via the `definition` "McpServerConfig". */ export type McpServerConfig = McpServerConfigStdio | McpServerConfigHttp; +/** + * OIDC token configuration. When truthy, a token is automatically gathered. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerConfigStdioOidc". + */ +export type McpServerConfigStdioOidc = + | boolean + | { + [k: string]: unknown | undefined; + }; +/** + * Authentication configuration for this server. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerConfigStdioAuth". + */ +export type McpServerConfigStdioAuth = + | boolean + | { + [k: string]: unknown | undefined; + }; /** * Remote transport type. Defaults to "http" when omitted. * @@ -463,6 +485,17 @@ export type McpServerConfigHttpType = | "http" /** Server-Sent Events transport. */ | "sse"; +/** + * OIDC token configuration. When truthy, a token is automatically gathered. + * + * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema + * via the `definition` "McpServerConfigHttpOidc". + */ +export type McpServerConfigHttpOidc = + | boolean + | { + [k: string]: unknown | undefined; + }; /** * OAuth grant type to use when authenticating to the remote MCP server. * @@ -3599,6 +3632,8 @@ export interface McpServerConfigStdio { * Timeout in milliseconds for tool calls to this server. */ timeout?: number; + oidc?: McpServerConfigStdioOidc; + auth?: McpServerConfigStdioAuth; /** * Executable command used to start the Stdio MCP server process. */ @@ -3639,6 +3674,8 @@ export interface McpServerConfigHttp { * Timeout in milliseconds for tool calls to this server. */ timeout?: number; + oidc?: McpServerConfigHttpOidc; + auth?: McpServerConfigHttpAuth; /** * URL of the remote MCP server endpoint. */ @@ -3658,7 +3695,6 @@ export interface McpServerConfigHttp { */ oauthPublicClient?: boolean; oauthGrantType?: McpServerConfigHttpOauthGrantType; - auth?: McpServerConfigHttpAuth; } /** * Additional authentication configuration for this server. @@ -3671,6 +3707,7 @@ export interface McpServerConfigHttpAuth { * Fixed port for the OAuth redirect callback server. */ redirectPort?: number; + [k: string]: unknown | undefined; } /** * MCP server names to disable for new sessions. @@ -6531,7 +6568,7 @@ export interface SessionContext { branch?: string; } /** - * The same metadata records, with summary and context fields backfilled where available. + * The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. * * This interface was referenced by `_RpcSchemaRoot`'s JSON-Schema * via the `definition` "SessionEnrichMetadataResult". @@ -6539,7 +6576,7 @@ export interface SessionContext { /** @experimental */ export interface SessionEnrichMetadataResult { /** - * Same records, with summary and context backfilled + * Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. */ sessions: SessionMetadata[]; } @@ -9921,7 +9958,7 @@ export function createServerRpc(connection: MessageConnection) { * * @param params Session metadata records to enrich with summary and context information. * - * @returns The same metadata records, with summary and context fields backfilled where available. + * @returns The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. */ enrichMetadata: async (params: SessionsEnrichMetadataRequest): Promise => connection.sendRequest("sessions.enrichMetadata", params), diff --git a/python/copilot/generated/rpc.py b/python/copilot/generated/rpc.py index 2959d81b9..e18f83f8b 100644 --- a/python/copilot/generated/rpc.py +++ b/python/copilot/generated/rpc.py @@ -1834,17 +1834,17 @@ def to_dict(self) -> dict: return result @dataclass -class MCPServerConfigHTTPAuth: +class AuthAuth: """Additional authentication configuration for this server.""" redirect_port: int | None = None """Fixed port for the OAuth redirect callback server.""" @staticmethod - def from_dict(obj: Any) -> 'MCPServerConfigHTTPAuth': + def from_dict(obj: Any) -> 'AuthAuth': assert isinstance(obj, dict) redirect_port = from_union([from_int, from_none], obj.get("redirectPort")) - return MCPServerConfigHTTPAuth(redirect_port) + return AuthAuth(redirect_port) def to_dict(self) -> dict: result: dict = {} @@ -7077,6 +7077,9 @@ class MCPServerConfigStdio: args: list[str] | None = None """Command-line arguments passed to the Stdio MCP server process.""" + auth: bool | dict[str, Any] | None = None + """Authentication configuration for this server.""" + cwd: str | None = None """Working directory for the Stdio MCP server process.""" @@ -7091,6 +7094,9 @@ class MCPServerConfigStdio: """Whether this server is a built-in fallback used when the user has not configured their own server. """ + oidc: bool | dict[str, Any] | None = None + """OIDC token configuration. When truthy, a token is automatically gathered.""" + timeout: int | None = None """Timeout in milliseconds for tool calls to this server.""" @@ -7102,19 +7108,23 @@ def from_dict(obj: Any) -> 'MCPServerConfigStdio': assert isinstance(obj, dict) command = from_str(obj.get("command")) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) + auth = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], obj.get("auth")) cwd = from_union([from_str, from_none], obj.get("cwd")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) + oidc = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], obj.get("oidc")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) - return MCPServerConfigStdio(command, args, cwd, env, filter_mapping, is_default_server, timeout, tools) + return MCPServerConfigStdio(command, args, auth, cwd, env, filter_mapping, is_default_server, oidc, timeout, tools) def to_dict(self) -> dict: result: dict = {} result["command"] = from_str(self.command) if self.args is not None: result["args"] = from_union([lambda x: from_list(from_str, x), from_none], self.args) + if self.auth is not None: + result["auth"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], self.auth) if self.cwd is not None: result["cwd"] = from_union([from_str, from_none], self.cwd) if self.env is not None: @@ -7123,6 +7133,8 @@ def to_dict(self) -> dict: result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) + if self.oidc is not None: + result["oidc"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], self.oidc) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: @@ -8140,6 +8152,11 @@ class MCPServerConfig: args: list[str] | None = None """Command-line arguments passed to the Stdio MCP server process.""" + auth: bool | AuthAuth | None = None + """Authentication configuration for this server. + + Additional authentication configuration for this server. + """ command: str | None = None """Executable command used to start the Stdio MCP server process.""" @@ -8157,15 +8174,15 @@ class MCPServerConfig: """Whether this server is a built-in fallback used when the user has not configured their own server. """ + oidc: bool | dict[str, Any] | None = None + """OIDC token configuration. When truthy, a token is automatically gathered.""" + timeout: int | None = None """Timeout in milliseconds for tool calls to this server.""" tools: list[str] | None = None """Tools to include. Defaults to all tools if not specified.""" - auth: MCPServerConfigHTTPAuth | None = None - """Additional authentication configuration for this server.""" - headers: dict[str, str] | None = None """HTTP headers to include in requests to the remote MCP server.""" @@ -8188,26 +8205,29 @@ class MCPServerConfig: def from_dict(obj: Any) -> 'MCPServerConfig': assert isinstance(obj, dict) args = from_union([lambda x: from_list(from_str, x), from_none], obj.get("args")) + auth = from_union([from_bool, AuthAuth.from_dict, from_none], obj.get("auth")) command = from_union([from_str, from_none], obj.get("command")) cwd = from_union([from_str, from_none], obj.get("cwd")) env = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("env")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) + oidc = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], obj.get("oidc")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) - auth = from_union([MCPServerConfigHTTPAuth.from_dict, from_none], obj.get("auth")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) oauth_grant_type = from_union([MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType")) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) url = from_union([from_str, from_none], obj.get("url")) - return MCPServerConfig(args, command, cwd, env, filter_mapping, is_default_server, timeout, tools, auth, headers, oauth_client_id, oauth_grant_type, oauth_public_client, type, url) + return MCPServerConfig(args, auth, command, cwd, env, filter_mapping, is_default_server, oidc, timeout, tools, headers, oauth_client_id, oauth_grant_type, oauth_public_client, type, url) def to_dict(self) -> dict: result: dict = {} if self.args is not None: result["args"] = from_union([lambda x: from_list(from_str, x), from_none], self.args) + if self.auth is not None: + result["auth"] = from_union([from_bool, lambda x: to_class(AuthAuth, x), from_none], self.auth) if self.command is not None: result["command"] = from_union([from_str, from_none], self.command) if self.cwd is not None: @@ -8218,12 +8238,12 @@ def to_dict(self) -> dict: result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.is_default_server is not None: result["isDefaultServer"] = from_union([from_bool, from_none], self.is_default_server) + if self.oidc is not None: + result["oidc"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], self.oidc) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: result["tools"] = from_union([lambda x: from_list(from_str, x), from_none], self.tools) - if self.auth is not None: - result["auth"] = from_union([lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth) if self.headers is not None: result["headers"] = from_union([lambda x: from_dict(from_str, x), from_none], self.headers) if self.oauth_client_id is not None: @@ -8245,7 +8265,7 @@ class MCPServerConfigHTTP: url: str """URL of the remote MCP server endpoint.""" - auth: MCPServerConfigHTTPAuth | None = None + auth: AuthAuth | None = None """Additional authentication configuration for this server.""" filter_mapping: dict[str, ContentFilterMode] | ContentFilterMode | None = None @@ -8268,6 +8288,9 @@ class MCPServerConfigHTTP: oauth_public_client: bool | None = None """Whether the configured OAuth client is public and does not require a client secret.""" + oidc: bool | dict[str, Any] | None = None + """OIDC token configuration. When truthy, a token is automatically gathered.""" + timeout: int | None = None """Timeout in milliseconds for tool calls to this server.""" @@ -8281,23 +8304,24 @@ class MCPServerConfigHTTP: def from_dict(obj: Any) -> 'MCPServerConfigHTTP': assert isinstance(obj, dict) url = from_str(obj.get("url")) - auth = from_union([MCPServerConfigHTTPAuth.from_dict, from_none], obj.get("auth")) + auth = from_union([AuthAuth.from_dict, from_none], obj.get("auth")) filter_mapping = from_union([lambda x: from_dict(ContentFilterMode, x), ContentFilterMode, from_none], obj.get("filterMapping")) headers = from_union([lambda x: from_dict(from_str, x), from_none], obj.get("headers")) is_default_server = from_union([from_bool, from_none], obj.get("isDefaultServer")) oauth_client_id = from_union([from_str, from_none], obj.get("oauthClientId")) oauth_grant_type = from_union([MCPServerConfigHTTPOauthGrantType, from_none], obj.get("oauthGrantType")) oauth_public_client = from_union([from_bool, from_none], obj.get("oauthPublicClient")) + oidc = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], obj.get("oidc")) timeout = from_union([from_int, from_none], obj.get("timeout")) tools = from_union([lambda x: from_list(from_str, x), from_none], obj.get("tools")) type = from_union([MCPServerConfigHTTPType, from_none], obj.get("type")) - return MCPServerConfigHTTP(url, auth, filter_mapping, headers, is_default_server, oauth_client_id, oauth_grant_type, oauth_public_client, timeout, tools, type) + return MCPServerConfigHTTP(url, auth, filter_mapping, headers, is_default_server, oauth_client_id, oauth_grant_type, oauth_public_client, oidc, timeout, tools, type) def to_dict(self) -> dict: result: dict = {} result["url"] = from_str(self.url) if self.auth is not None: - result["auth"] = from_union([lambda x: to_class(MCPServerConfigHTTPAuth, x), from_none], self.auth) + result["auth"] = from_union([lambda x: to_class(AuthAuth, x), from_none], self.auth) if self.filter_mapping is not None: result["filterMapping"] = from_union([lambda x: from_dict(lambda x: to_enum(ContentFilterMode, x), x), lambda x: to_enum(ContentFilterMode, x), from_none], self.filter_mapping) if self.headers is not None: @@ -8310,6 +8334,8 @@ def to_dict(self) -> dict: result["oauthGrantType"] = from_union([lambda x: to_enum(MCPServerConfigHTTPOauthGrantType, x), from_none], self.oauth_grant_type) if self.oauth_public_client is not None: result["oauthPublicClient"] = from_union([from_bool, from_none], self.oauth_public_client) + if self.oidc is not None: + result["oidc"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x), from_none], self.oidc) if self.timeout is not None: result["timeout"] = from_union([from_int, from_none], self.timeout) if self.tools is not None: @@ -13869,10 +13895,13 @@ def to_dict(self) -> dict: # Experimental: this type is part of an experimental API and may change or be removed. @dataclass class SessionEnrichMetadataResult: - """The same metadata records, with summary and context fields backfilled where available.""" - + """The enriched metadata records, with summary and context fields backfilled where + available. Sessions confirmed empty and unnamed are omitted. + """ sessions: list[SessionMetadata] - """Same records, with summary and context backfilled""" + """Enriched records, with summary and context backfilled. Sessions confirmed empty and + unnamed may be omitted. + """ @staticmethod def from_dict(obj: Any) -> 'SessionEnrichMetadataResult': @@ -14975,10 +15004,13 @@ class RPC: mcp_server: MCPServer mcp_server_config: MCPServerConfig mcp_server_config_http: MCPServerConfigHTTP - mcp_server_config_http_auth: MCPServerConfigHTTPAuth + mcp_server_config_http_auth: AuthAuth mcp_server_config_http_oauth_grant_type: MCPServerConfigHTTPOauthGrantType + mcp_server_config_http_oidc: bool | dict[str, Any] mcp_server_config_http_type: MCPServerConfigHTTPType mcp_server_config_stdio: MCPServerConfigStdio + mcp_server_config_stdio_auth: bool | dict[str, Any] + mcp_server_config_stdio_oidc: bool | dict[str, Any] mcp_server_list: MCPServerList mcp_set_env_value_mode_details: MCPSetEnvValueModeDetails mcp_set_env_value_mode_params: MCPSetEnvValueModeParams @@ -15532,10 +15564,13 @@ def from_dict(obj: Any) -> 'RPC': mcp_server = MCPServer.from_dict(obj.get("McpServer")) mcp_server_config = MCPServerConfig.from_dict(obj.get("McpServerConfig")) mcp_server_config_http = MCPServerConfigHTTP.from_dict(obj.get("McpServerConfigHttp")) - mcp_server_config_http_auth = MCPServerConfigHTTPAuth.from_dict(obj.get("McpServerConfigHttpAuth")) + mcp_server_config_http_auth = AuthAuth.from_dict(obj.get("McpServerConfigHttpAuth")) mcp_server_config_http_oauth_grant_type = MCPServerConfigHTTPOauthGrantType(obj.get("McpServerConfigHttpOauthGrantType")) + mcp_server_config_http_oidc = from_union([from_bool, lambda x: from_dict(lambda x: x, x)], obj.get("McpServerConfigHttpOidc")) mcp_server_config_http_type = MCPServerConfigHTTPType(obj.get("McpServerConfigHttpType")) mcp_server_config_stdio = MCPServerConfigStdio.from_dict(obj.get("McpServerConfigStdio")) + mcp_server_config_stdio_auth = from_union([from_bool, lambda x: from_dict(lambda x: x, x)], obj.get("McpServerConfigStdioAuth")) + mcp_server_config_stdio_oidc = from_union([from_bool, lambda x: from_dict(lambda x: x, x)], obj.get("McpServerConfigStdioOidc")) mcp_server_list = MCPServerList.from_dict(obj.get("McpServerList")) mcp_set_env_value_mode_details = MCPSetEnvValueModeDetails(obj.get("McpSetEnvValueModeDetails")) mcp_set_env_value_mode_params = MCPSetEnvValueModeParams.from_dict(obj.get("McpSetEnvValueModeParams")) @@ -15923,7 +15958,7 @@ def from_dict(obj: Any) -> 'RPC': session_context_info = from_union([SessionContextInfo.from_dict, from_none], obj.get("SessionContextInfo")) task_progress = from_union([TaskProgress.from_dict, from_none], obj.get("TaskProgress")) workspace_summary = from_union([WorkspaceSummary.from_dict, from_none], obj.get("WorkspaceSummary")) - return RPC(abort_request, abort_result, account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_reload_result, agent_select_request, agent_select_result, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_instance_availability, canvas_invoke_action_request, canvas_invoke_action_result, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, discovered_canvas, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_source, installed_plugin_source_github, installed_plugin_source_local, installed_plugin_source_url, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, lsp_initialize_request, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_oauth_login_request, mcp_oauth_login_result, mcp_remove_git_hub_result, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_auth, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_list, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_env_value_mode, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, release_event_interest_params, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_mode, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachment, send_attachment_blob, send_attachment_directory, send_attachment_file, send_attachment_file_line_range, send_attachment_github_reference, send_attachment_github_reference_type, send_attachment_selection, send_attachment_selection_details, send_attachment_selection_details_end, send_attachment_selection_details_start, send_mode, send_request, send_result, server_skill, server_skill_list, session_auth_status, session_bulk_delete_result, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_github, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata, session_metadata_snapshot, session_mode, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_prune_old_request, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, session_update_options_params, session_update_options_result, session_working_directory_context, session_working_directory_context_host_type, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_initialize_and_validate_result, tools_list_request, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, task_progress, workspace_summary) + return RPC(abort_request, abort_result, account_get_quota_request, account_get_quota_result, account_quota_snapshot, agent_get_current_result, agent_info, agent_info_source, agent_list, agent_reload_result, agent_select_request, agent_select_result, api_key_auth_info, auth_info, auth_info_type, canvas_action, canvas_close_request, canvas_host_context, canvas_host_context_capabilities, canvas_instance_availability, canvas_invoke_action_request, canvas_invoke_action_result, canvas_json_schema, canvas_list, canvas_list_open_result, canvas_open_request, canvas_provider_close_request, canvas_provider_invoke_action_request, canvas_provider_open_request, canvas_provider_open_result, command_list, commands_handle_pending_command_request, commands_handle_pending_command_result, commands_invoke_request, commands_list_request, commands_respond_to_queued_command_request, commands_respond_to_queued_command_result, connected_remote_session_metadata, connected_remote_session_metadata_kind, connected_remote_session_metadata_repository, connect_remote_session_params, connect_request, connect_result, content_filter_mode, copilot_api_token_auth_info, copilot_user_response, copilot_user_response_endpoints, copilot_user_response_quota_snapshots, copilot_user_response_quota_snapshots_chat, copilot_user_response_quota_snapshots_completions, copilot_user_response_quota_snapshots_premium_interactions, current_model, discovered_canvas, discovered_mcp_server, discovered_mcp_server_type, enqueue_command_params, enqueue_command_result, env_auth_info, event_log_read_request, event_log_release_interest_result, event_log_tail_result, event_log_types, events_agent_scope, events_cursor_status, events_read_result, execute_command_params, execute_command_result, extension, extension_list, extensions_disable_request, extensions_enable_request, extension_source, extension_status, external_tool_result, external_tool_text_result_for_llm, external_tool_text_result_for_llm_binary_results_for_llm, external_tool_text_result_for_llm_binary_results_for_llm_type, external_tool_text_result_for_llm_content, external_tool_text_result_for_llm_content_audio, external_tool_text_result_for_llm_content_image, external_tool_text_result_for_llm_content_resource, external_tool_text_result_for_llm_content_resource_details, external_tool_text_result_for_llm_content_resource_link, external_tool_text_result_for_llm_content_resource_link_icon, external_tool_text_result_for_llm_content_resource_link_icon_theme, external_tool_text_result_for_llm_content_terminal, external_tool_text_result_for_llm_content_text, filter_mapping, fleet_start_request, fleet_start_result, folder_trust_add_params, folder_trust_check_params, folder_trust_check_result, gh_cli_auth_info, handle_pending_tool_call_request, handle_pending_tool_call_result, history_abort_manual_compaction_result, history_cancel_background_compaction_result, history_compact_context_window, history_compact_request, history_compact_result, history_summarize_for_handoff_result, history_truncate_request, history_truncate_result, hmac_auth_info, installed_plugin, installed_plugin_source, installed_plugin_source_github, installed_plugin_source_local, installed_plugin_source_url, instructions_get_sources_result, instructions_sources, instructions_sources_location, instructions_sources_type, log_request, log_result, lsp_initialize_request, mcp_apps_call_tool_request, mcp_apps_diagnose_capability, mcp_apps_diagnose_request, mcp_apps_diagnose_result, mcp_apps_diagnose_server, mcp_apps_host_context, mcp_apps_host_context_details, mcp_apps_host_context_details_available_display_mode, mcp_apps_host_context_details_display_mode, mcp_apps_host_context_details_platform, mcp_apps_host_context_details_theme, mcp_apps_list_tools_request, mcp_apps_list_tools_result, mcp_apps_read_resource_request, mcp_apps_read_resource_result, mcp_apps_resource_content, mcp_apps_set_host_context_details, mcp_apps_set_host_context_details_available_display_mode, mcp_apps_set_host_context_details_display_mode, mcp_apps_set_host_context_details_platform, mcp_apps_set_host_context_details_theme, mcp_apps_set_host_context_request, mcp_cancel_sampling_execution_params, mcp_cancel_sampling_execution_result, mcp_config_add_request, mcp_config_disable_request, mcp_config_enable_request, mcp_config_list, mcp_config_remove_request, mcp_config_update_request, mcp_disable_request, mcp_discover_request, mcp_discover_result, mcp_enable_request, mcp_execute_sampling_params, mcp_execute_sampling_request, mcp_execute_sampling_result, mcp_oauth_login_request, mcp_oauth_login_result, mcp_remove_git_hub_result, mcp_sampling_execution_action, mcp_sampling_execution_result, mcp_server, mcp_server_config, mcp_server_config_http, mcp_server_config_http_auth, mcp_server_config_http_oauth_grant_type, mcp_server_config_http_oidc, mcp_server_config_http_type, mcp_server_config_stdio, mcp_server_config_stdio_auth, mcp_server_config_stdio_oidc, mcp_server_list, mcp_set_env_value_mode_details, mcp_set_env_value_mode_params, mcp_set_env_value_mode_result, metadata_context_info_request, metadata_context_info_result, metadata_is_processing_result, metadata_recompute_context_tokens_request, metadata_recompute_context_tokens_result, metadata_record_context_change_request, metadata_record_context_change_result, metadata_set_working_directory_request, metadata_set_working_directory_result, metadata_snapshot_current_mode, metadata_snapshot_remote_metadata, metadata_snapshot_remote_metadata_repository, metadata_snapshot_remote_metadata_task_type, model, model_billing, model_billing_token_prices, model_billing_token_prices_long_context, model_capabilities, model_capabilities_limits, model_capabilities_limits_vision, model_capabilities_override, model_capabilities_override_limits, model_capabilities_override_limits_vision, model_capabilities_override_supports, model_capabilities_supports, model_list, model_picker_category, model_picker_price_category, model_policy, model_policy_state, model_set_reasoning_effort_request, model_set_reasoning_effort_result, models_list_request, model_switch_to_request, model_switch_to_result, mode_set_request, name_get_result, name_set_auto_request, name_set_auto_result, name_set_request, open_canvas_instance, options_update_env_value_mode, pending_permission_request, pending_permission_request_list, permission_decision, permission_decision_approved, permission_decision_approved_for_location, permission_decision_approved_for_session, permission_decision_approve_for_location, permission_decision_approve_for_location_approval, permission_decision_approve_for_location_approval_commands, permission_decision_approve_for_location_approval_custom_tool, permission_decision_approve_for_location_approval_extension_management, permission_decision_approve_for_location_approval_extension_permission_access, permission_decision_approve_for_location_approval_mcp, permission_decision_approve_for_location_approval_mcp_sampling, permission_decision_approve_for_location_approval_memory, permission_decision_approve_for_location_approval_read, permission_decision_approve_for_location_approval_write, permission_decision_approve_for_session, permission_decision_approve_for_session_approval, permission_decision_approve_for_session_approval_commands, permission_decision_approve_for_session_approval_custom_tool, permission_decision_approve_for_session_approval_extension_management, permission_decision_approve_for_session_approval_extension_permission_access, permission_decision_approve_for_session_approval_mcp, permission_decision_approve_for_session_approval_mcp_sampling, permission_decision_approve_for_session_approval_memory, permission_decision_approve_for_session_approval_read, permission_decision_approve_for_session_approval_write, permission_decision_approve_once, permission_decision_approve_permanently, permission_decision_cancelled, permission_decision_denied_by_content_exclusion_policy, permission_decision_denied_by_permission_request_hook, permission_decision_denied_by_rules, permission_decision_denied_interactively_by_user, permission_decision_denied_no_approval_rule_and_could_not_request_from_user, permission_decision_reject, permission_decision_request, permission_decision_user_not_available, permission_location_add_tool_approval_params, permission_location_apply_params, permission_location_apply_result, permission_location_resolve_params, permission_location_resolve_result, permission_location_type, permission_paths_add_params, permission_paths_allowed_check_params, permission_paths_allowed_check_result, permission_paths_config, permission_paths_list, permission_paths_update_primary_params, permission_paths_workspace_check_params, permission_paths_workspace_check_result, permission_prompt_shown_notification, permission_request_result, permission_rules_set, permissions_configure_additional_content_exclusion_policy, permissions_configure_additional_content_exclusion_policy_rule, permissions_configure_additional_content_exclusion_policy_rule_source, permissions_configure_additional_content_exclusion_policy_scope, permissions_configure_params, permissions_configure_result, permissions_folder_trust_add_trusted_result, permissions_locations_add_tool_approval_details, permissions_locations_add_tool_approval_details_commands, permissions_locations_add_tool_approval_details_custom_tool, permissions_locations_add_tool_approval_details_extension_management, permissions_locations_add_tool_approval_details_extension_permission_access, permissions_locations_add_tool_approval_details_mcp, permissions_locations_add_tool_approval_details_mcp_sampling, permissions_locations_add_tool_approval_details_memory, permissions_locations_add_tool_approval_details_read, permissions_locations_add_tool_approval_details_write, permissions_locations_add_tool_approval_result, permissions_modify_rules_params, permissions_modify_rules_result, permissions_modify_rules_scope, permissions_notify_prompt_shown_result, permissions_paths_add_result, permissions_paths_list_request, permissions_paths_update_primary_result, permissions_pending_requests_request, permissions_reset_session_approvals_request, permissions_reset_session_approvals_result, permissions_set_approve_all_request, permissions_set_approve_all_result, permissions_set_approve_all_source, permissions_set_required_request, permissions_set_required_result, permissions_urls_set_unrestricted_mode_result, permission_urls_config, permission_urls_set_unrestricted_mode_params, ping_request, ping_result, plan_read_result, plan_update_request, plugin, plugin_list, queued_command_handled, queued_command_not_handled, queued_command_result, queue_pending_items, queue_pending_items_kind, queue_pending_items_result, queue_remove_most_recent_result, register_event_interest_params, register_event_interest_result, release_event_interest_params, remote_enable_request, remote_enable_result, remote_notify_steerable_changed_request, remote_notify_steerable_changed_result, remote_session_connection_result, remote_session_mode, schedule_entry, schedule_list, schedule_stop_request, schedule_stop_result, secrets_add_filter_values_request, secrets_add_filter_values_result, send_agent_mode, send_attachment, send_attachment_blob, send_attachment_directory, send_attachment_file, send_attachment_file_line_range, send_attachment_github_reference, send_attachment_github_reference_type, send_attachment_selection, send_attachment_selection_details, send_attachment_selection_details_end, send_attachment_selection_details_start, send_mode, send_request, send_result, server_skill, server_skill_list, session_auth_status, session_bulk_delete_result, session_context, session_context_host_type, session_enrich_metadata_result, session_fs_append_file_request, session_fs_error, session_fs_error_code, session_fs_exists_request, session_fs_exists_result, session_fs_mkdir_request, session_fs_readdir_request, session_fs_readdir_result, session_fs_readdir_with_types_entry, session_fs_readdir_with_types_entry_type, session_fs_readdir_with_types_request, session_fs_readdir_with_types_result, session_fs_read_file_request, session_fs_read_file_result, session_fs_rename_request, session_fs_rm_request, session_fs_set_provider_capabilities, session_fs_set_provider_conventions, session_fs_set_provider_request, session_fs_set_provider_result, session_fs_sqlite_exists_request, session_fs_sqlite_exists_result, session_fs_sqlite_query_request, session_fs_sqlite_query_result, session_fs_sqlite_query_type, session_fs_stat_request, session_fs_stat_result, session_fs_write_file_request, session_installed_plugin, session_installed_plugin_source, session_installed_plugin_source_github, session_installed_plugin_source_local, session_installed_plugin_source_url, session_list, session_list_filter, session_load_deferred_repo_hooks_result, session_log_level, session_mcp_apps_call_tool_result, session_metadata, session_metadata_snapshot, session_mode, session_prune_result, sessions_bulk_delete_request, sessions_check_in_use_request, sessions_check_in_use_result, sessions_close_request, sessions_close_result, sessions_enrich_metadata_request, session_set_credentials_params, session_set_credentials_result, sessions_find_by_prefix_request, sessions_find_by_prefix_result, sessions_find_by_task_id_request, sessions_find_by_task_id_result, sessions_fork_request, sessions_fork_result, sessions_get_event_file_path_request, sessions_get_event_file_path_result, sessions_get_last_for_context_request, sessions_get_last_for_context_result, sessions_get_persisted_remote_steerable_request, sessions_get_persisted_remote_steerable_result, session_sizes, sessions_list_request, sessions_load_deferred_repo_hooks_request, sessions_prune_old_request, sessions_release_lock_request, sessions_release_lock_result, sessions_reload_plugin_hooks_request, sessions_reload_plugin_hooks_result, sessions_save_request, sessions_save_result, sessions_set_additional_plugins_request, sessions_set_additional_plugins_result, session_update_options_params, session_update_options_result, session_working_directory_context, session_working_directory_context_host_type, shell_exec_request, shell_exec_result, shell_kill_request, shell_kill_result, shell_kill_signal, shutdown_request, skill, skill_list, skills_config_set_disabled_skills_request, skills_disable_request, skills_discover_request, skills_enable_request, skills_get_invoked_result, skills_invoked_skill, skills_load_diagnostics, slash_command_agent_prompt_result, slash_command_completed_result, slash_command_info, slash_command_input, slash_command_input_completion, slash_command_invocation_result, slash_command_kind, slash_command_select_subcommand_option, slash_command_select_subcommand_result, slash_command_text_result, task_agent_info, task_agent_progress, task_execution_mode, task_info, task_list, task_progress_line, tasks_cancel_request, tasks_cancel_result, tasks_get_current_promotable_result, tasks_get_progress_request, tasks_get_progress_result, task_shell_info, task_shell_info_attachment_mode, task_shell_progress, tasks_promote_current_to_background_result, tasks_promote_to_background_request, tasks_promote_to_background_result, tasks_refresh_result, tasks_remove_request, tasks_remove_result, tasks_send_message_request, tasks_send_message_result, tasks_start_agent_request, tasks_start_agent_result, task_status, tasks_wait_for_pending_result, telemetry_set_feature_overrides_request, token_auth_info, tool, tool_list, tools_initialize_and_validate_result, tools_list_request, ui_auto_mode_switch_response, ui_elicitation_array_any_of_field, ui_elicitation_array_any_of_field_items, ui_elicitation_array_any_of_field_items_any_of, ui_elicitation_array_enum_field, ui_elicitation_array_enum_field_items, ui_elicitation_field_value, ui_elicitation_request, ui_elicitation_response, ui_elicitation_response_action, ui_elicitation_response_content, ui_elicitation_result, ui_elicitation_schema, ui_elicitation_schema_property, ui_elicitation_schema_property_boolean, ui_elicitation_schema_property_number, ui_elicitation_schema_property_number_type, ui_elicitation_schema_property_string, ui_elicitation_schema_property_string_format, ui_elicitation_string_enum_field, ui_elicitation_string_one_of_field, ui_elicitation_string_one_of_field_one_of, ui_exit_plan_mode_action, ui_exit_plan_mode_response, ui_handle_pending_auto_mode_switch_request, ui_handle_pending_elicitation_request, ui_handle_pending_exit_plan_mode_request, ui_handle_pending_result, ui_handle_pending_sampling_request, ui_handle_pending_sampling_response, ui_handle_pending_user_input_request, ui_register_direct_auto_mode_switch_handler_result, ui_unregister_direct_auto_mode_switch_handler_request, ui_unregister_direct_auto_mode_switch_handler_result, ui_user_input_response, usage_get_metrics_result, usage_metrics_code_changes, usage_metrics_model_metric, usage_metrics_model_metric_requests, usage_metrics_model_metric_token_detail, usage_metrics_model_metric_usage, usage_metrics_token_detail, user_auth_info, workspace_diff_file_change, workspace_diff_file_change_type, workspace_diff_mode, workspace_diff_result, workspaces_checkpoints, workspaces_create_file_request, workspaces_diff_request, workspaces_get_workspace_result, workspaces_list_checkpoints_result, workspaces_list_files_result, workspaces_read_checkpoint_request, workspaces_read_checkpoint_result, workspaces_read_file_request, workspaces_read_file_result, workspaces_save_large_paste_request, workspaces_save_large_paste_result, workspace_summary_host_type, workspaces_workspace_details_host_type, session_context_info, task_progress, workspace_summary) def to_dict(self) -> dict: result: dict = {} @@ -16089,10 +16124,13 @@ def to_dict(self) -> dict: result["McpServer"] = to_class(MCPServer, self.mcp_server) result["McpServerConfig"] = to_class(MCPServerConfig, self.mcp_server_config) result["McpServerConfigHttp"] = to_class(MCPServerConfigHTTP, self.mcp_server_config_http) - result["McpServerConfigHttpAuth"] = to_class(MCPServerConfigHTTPAuth, self.mcp_server_config_http_auth) + result["McpServerConfigHttpAuth"] = to_class(AuthAuth, self.mcp_server_config_http_auth) result["McpServerConfigHttpOauthGrantType"] = to_enum(MCPServerConfigHTTPOauthGrantType, self.mcp_server_config_http_oauth_grant_type) + result["McpServerConfigHttpOidc"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x)], self.mcp_server_config_http_oidc) result["McpServerConfigHttpType"] = to_enum(MCPServerConfigHTTPType, self.mcp_server_config_http_type) result["McpServerConfigStdio"] = to_class(MCPServerConfigStdio, self.mcp_server_config_stdio) + result["McpServerConfigStdioAuth"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x)], self.mcp_server_config_stdio_auth) + result["McpServerConfigStdioOidc"] = from_union([from_bool, lambda x: from_dict(lambda x: x, x)], self.mcp_server_config_stdio_oidc) result["McpServerList"] = to_class(MCPServerList, self.mcp_server_list) result["McpSetEnvValueModeDetails"] = to_enum(MCPSetEnvValueModeDetails, self.mcp_set_env_value_mode_details) result["McpSetEnvValueModeParams"] = to_class(MCPSetEnvValueModeParams, self.mcp_set_env_value_mode_params) @@ -16661,6 +16699,10 @@ def _load_TaskInfo(obj: Any) -> "TaskInfo": McpAppsSetHostContextDetailsTheme = Theme McpExecuteSamplingRequest = dict McpExecuteSamplingResult = dict +McpServerConfigHttpAuth = AuthAuth +McpServerConfigHttpOidc = bool +McpServerConfigStdioAuth = bool +McpServerConfigStdioOidc = bool OptionsUpdateEnvValueMode = MCPSetEnvValueModeDetails SessionContextHostType = HostType SessionMcpAppsCallToolResult = dict @@ -16894,7 +16936,7 @@ async def release_lock(self, params: SessionsReleaseLockRequest, *, timeout: flo return SessionsReleaseLockResult.from_dict(await self._client.request("sessions.releaseLock", params_dict, **_timeout_kwargs(timeout))) async def enrich_metadata(self, params: SessionsEnrichMetadataRequest, *, timeout: float | None = None) -> SessionEnrichMetadataResult: - "Backfills missing summary and context fields on the supplied session metadata records.\n\nArgs:\n params: Session metadata records to enrich with summary and context information.\n\nReturns:\n The same metadata records, with summary and context fields backfilled where available." + "Backfills missing summary and context fields on the supplied session metadata records.\n\nArgs:\n params: Session metadata records to enrich with summary and context information.\n\nReturns:\n The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted." params_dict = {k: v for k, v in params.to_dict().items() if v is not None} return SessionEnrichMetadataResult.from_dict(await self._client.request("sessions.enrichMetadata", params_dict, **_timeout_kwargs(timeout))) @@ -16991,7 +17033,7 @@ async def invoke_action(self, params: CanvasInvokeActionRequest, *, timeout: flo "Invokes an action on an open canvas instance.\n\nArgs:\n params: Canvas action invocation parameters.\n\nReturns:\n Canvas action invocation result." params_dict: dict[str, Any] = {k: v for k, v in params.to_dict().items() if v is not None} params_dict["sessionId"] = self._session_id - return Any.from_dict(await self._client.request("session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout))) + return await self._client.request("session.canvas.invokeAction", params_dict, **_timeout_kwargs(timeout)) # Experimental: this API group is experimental and may change or be removed. diff --git a/rust/src/generated/api_types.rs b/rust/src/generated/api_types.rs index 6f5ddc9d5..1e370b674 100644 --- a/rust/src/generated/api_types.rs +++ b/rust/src/generated/api_types.rs @@ -3071,6 +3071,9 @@ pub struct McpServerConfigHttp { /// Whether the configured OAuth client is public and does not require a client secret. #[serde(skip_serializing_if = "Option::is_none")] pub oauth_public_client: Option, + /// OIDC token configuration. When truthy, a token is automatically gathered. + #[serde(skip_serializing_if = "Option::is_none")] + pub oidc: Option, /// Timeout in milliseconds for tool calls to this server. #[serde(skip_serializing_if = "Option::is_none")] pub timeout: Option, @@ -3091,6 +3094,9 @@ pub struct McpServerConfigStdio { /// Command-line arguments passed to the Stdio MCP server process. #[serde(default)] pub args: Vec, + /// Authentication configuration for this server. + #[serde(skip_serializing_if = "Option::is_none")] + pub auth: Option, /// Executable command used to start the Stdio MCP server process. pub command: String, /// Working directory for the Stdio MCP server process. @@ -3105,6 +3111,9 @@ pub struct McpServerConfigStdio { /// Whether this server is a built-in fallback used when the user has not configured their own server. #[serde(skip_serializing_if = "Option::is_none")] pub is_default_server: Option, + /// OIDC token configuration. When truthy, a token is automatically gathered. + #[serde(skip_serializing_if = "Option::is_none")] + pub oidc: Option, /// Timeout in milliseconds for tool calls to this server. #[serde(skip_serializing_if = "Option::is_none")] pub timeout: Option, @@ -6018,7 +6027,7 @@ pub struct SessionMetadata { pub summary: Option, } -/// The same metadata records, with summary and context fields backfilled where available. +/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. /// ///
/// @@ -6029,7 +6038,7 @@ pub struct SessionMetadata { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionEnrichMetadataResult { - /// Same records, with summary and context backfilled + /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. pub sessions: Vec, } @@ -9389,7 +9398,7 @@ pub struct SessionsPruneOldResult { pub skipped: Vec, } -/// The same metadata records, with summary and context fields backfilled where available. +/// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. /// ///
/// @@ -9400,7 +9409,7 @@ pub struct SessionsPruneOldResult { #[derive(Debug, Clone, Default, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct SessionsEnrichMetadataResult { - /// Same records, with summary and context backfilled + /// Enriched records, with summary and context backfilled. Sessions confirmed empty and unnamed may be omitted. pub sessions: Vec, } diff --git a/rust/src/generated/rpc.rs b/rust/src/generated/rpc.rs index 644e49e86..c0c793fe0 100644 --- a/rust/src/generated/rpc.rs +++ b/rust/src/generated/rpc.rs @@ -902,7 +902,7 @@ impl<'a> ClientRpcSessions<'a> { /// /// # Returns /// - /// The same metadata records, with summary and context fields backfilled where available. + /// The enriched metadata records, with summary and context fields backfilled where available. Sessions confirmed empty and unnamed are omitted. /// ///
///