diff --git a/packages/sdk/js/src/v2/gen/sdk.gen.ts b/packages/sdk/js/src/v2/gen/sdk.gen.ts index b757b75350..77ae899be8 100644 --- a/packages/sdk/js/src/v2/gen/sdk.gen.ts +++ b/packages/sdk/js/src/v2/gen/sdk.gen.ts @@ -110,6 +110,8 @@ import type { SessionForkResponses, SessionGetErrors, SessionGetResponses, + SessionHandoffErrors, + SessionHandoffResponses, SessionInitErrors, SessionInitResponses, SessionListResponses, @@ -1766,6 +1768,48 @@ export class Session extends HeyApiClient { ...params, }) } + + /** + * Handoff session + * + * Extract context and relevant files for another agent to continue the conversation. + */ + public handoff( + parameters: { + sessionID: string + directory?: string + model?: { + providerID: string + modelID: string + } + goal?: string + }, + options?: Options, + ) { + const params = buildClientParams( + [parameters], + [ + { + args: [ + { in: "path", key: "sessionID" }, + { in: "query", key: "directory" }, + { in: "body", key: "model" }, + { in: "body", key: "goal" }, + ], + }, + ], + ) + return (options?.client ?? this.client).post({ + url: "/session/{sessionID}/handoff", + ...options, + ...params, + headers: { + "Content-Type": "application/json", + ...options?.headers, + ...params.headers, + }, + }) + } } export class Part extends HeyApiClient { diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index d72c37a28b..6580121275 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -3803,6 +3803,51 @@ export type PermissionRespondResponses = { export type PermissionRespondResponse = PermissionRespondResponses[keyof PermissionRespondResponses] +export type SessionHandoffData = { + body?: { + model: { + providerID: string + modelID: string + } + goal?: string + } + path: { + /** + * Session ID + */ + sessionID: string + } + query?: { + directory?: string + } + url: "/session/{sessionID}/handoff" +} + +export type SessionHandoffErrors = { + /** + * Bad request + */ + 400: BadRequestError + /** + * Not found + */ + 404: NotFoundError +} + +export type SessionHandoffError = SessionHandoffErrors[keyof SessionHandoffErrors] + +export type SessionHandoffResponses = { + /** + * Handoff data extracted + */ + 200: { + text: string + files: Array + } +} + +export type SessionHandoffResponse = SessionHandoffResponses[keyof SessionHandoffResponses] + export type PermissionReplyData = { body?: { reply: "once" | "always" | "reject" diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index f50cc06c10..dc4da08701 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -3297,6 +3297,108 @@ ] } }, + "/session/{sessionID}/handoff": { + "post": { + "operationId": "session.handoff", + "parameters": [ + { + "in": "query", + "name": "directory", + "schema": { + "type": "string" + } + }, + { + "in": "path", + "name": "sessionID", + "schema": { + "type": "string" + }, + "required": true, + "description": "Session ID" + } + ], + "summary": "Handoff session", + "description": "Extract context and relevant files for another agent to continue the conversation.", + "responses": { + "200": { + "description": "Handoff data extracted", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "text": { + "type": "string" + }, + "files": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": ["text", "files"] + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BadRequestError" + } + } + } + }, + "404": { + "description": "Not found", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NotFoundError" + } + } + } + } + }, + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "model": { + "type": "object", + "properties": { + "providerID": { + "type": "string" + }, + "modelID": { + "type": "string" + } + }, + "required": ["providerID", "modelID"] + }, + "goal": { + "type": "string" + } + }, + "required": ["model"] + } + } + } + }, + "x-codeSamples": [ + { + "lang": "js", + "source": "import { createOpencodeClient } from \"@opencode-ai/sdk\n\nconst client = createOpencodeClient()\nawait client.session.handoff({\n ...\n})" + } + ] + } + }, "/permission/{requestID}/reply": { "post": { "operationId": "permission.reply",