diff --git a/packages/opencode/src/server/routes/instance/httpapi/groups/v2/session.ts b/packages/opencode/src/server/routes/instance/httpapi/groups/v2/session.ts index 70331c27f0..c1a07957db 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/groups/v2/session.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/groups/v2/session.ts @@ -4,7 +4,13 @@ import { Prompt } from "@opencode-ai/core/session-prompt" import { SessionV2 } from "@/v2/session" import { Schema } from "effect" import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi" -import { InvalidCursorError, InvalidRequestError, ServiceUnavailableError, SessionNotFoundError, UnknownError } from "../../errors" +import { + InvalidCursorError, + InvalidRequestError, + ServiceUnavailableError, + SessionNotFoundError, + UnknownError, +} from "../../errors" import { V2Authorization } from "../../middleware/authorization" import { WorkspaceRoutingQuery, WorkspaceRoutingQueryFields } from "../../middleware/workspace-routing" import { QueryBoolean } from "../query" diff --git a/packages/opencode/src/server/routes/instance/httpapi/handlers/v2/session.ts b/packages/opencode/src/server/routes/instance/httpapi/handlers/v2/session.ts index 330b6fe1bf..ff4e098fb4 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/handlers/v2/session.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/handlers/v2/session.ts @@ -3,7 +3,13 @@ import { SessionV2 } from "@/v2/session" import { DateTime, Effect, Option, Schema } from "effect" import { HttpApiBuilder, HttpApiSchema } from "effect/unstable/httpapi" import { InstanceHttpApi } from "../../api" -import { InvalidCursorError, InvalidRequestError, ServiceUnavailableError, SessionNotFoundError, UnknownError } from "../../errors" +import { + InvalidCursorError, + InvalidRequestError, + ServiceUnavailableError, + SessionNotFoundError, + UnknownError, +} from "../../errors" const DefaultSessionsLimit = 50 diff --git a/packages/opencode/src/v2/session.ts b/packages/opencode/src/v2/session.ts index 1b65245ded..dcff1a318a 100644 --- a/packages/opencode/src/v2/session.ts +++ b/packages/opencode/src/v2/session.ts @@ -110,7 +110,9 @@ export interface Interface { direction: "previous" | "next" } }) => Effect.Effect - readonly context: (sessionID: SessionID) => Effect.Effect + readonly context: ( + sessionID: SessionID, + ) => Effect.Effect readonly prompt: (input: { id?: EventV2.ID sessionID: SessionID diff --git a/packages/sdk/js/src/v2/gen/types.gen.ts b/packages/sdk/js/src/v2/gen/types.gen.ts index d4bdbbb6e1..c291571b5c 100644 --- a/packages/sdk/js/src/v2/gen/types.gen.ts +++ b/packages/sdk/js/src/v2/gen/types.gen.ts @@ -1836,6 +1836,12 @@ export type ServiceUnavailableError = { service?: string } +export type UnknownError1 = { + _tag: "UnknownError" + message: string + ref?: string +} + export type V2SessionMessagesResponse = { items: Array cursor: { @@ -7311,6 +7317,10 @@ export type V2SessionContextErrors = { * SessionNotFoundError */ 404: SessionNotFoundError + /** + * UnknownError + */ + 500: UnknownError1 } export type V2SessionContextError = V2SessionContextErrors[keyof V2SessionContextErrors] @@ -7355,6 +7365,10 @@ export type V2SessionMessagesErrors = { * SessionNotFoundError */ 404: SessionNotFoundError + /** + * UnknownError + */ + 500: UnknownError1 } export type V2SessionMessagesError = V2SessionMessagesErrors[keyof V2SessionMessagesErrors] diff --git a/packages/sdk/openapi.json b/packages/sdk/openapi.json index 8548eeb6d3..1b47efcd08 100644 --- a/packages/sdk/openapi.json +++ b/packages/sdk/openapi.json @@ -8517,6 +8517,16 @@ } } } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnknownError1" + } + } + } } }, "description": "Retrieve the active context messages for a v2 session (all messages after the last compaction).", @@ -8634,6 +8644,16 @@ } } } + }, + "500": { + "description": "UnknownError", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UnknownError1" + } + } + } } }, "description": "Retrieve projected v2 messages for a session. Items keep the requested order across pages; use cursor.next or cursor.previous to move through the ordered timeline.", @@ -15735,6 +15755,23 @@ "required": ["_tag", "message"], "additionalProperties": false }, + "UnknownError1": { + "type": "object", + "properties": { + "_tag": { + "type": "string", + "enum": ["UnknownError"] + }, + "message": { + "type": "string" + }, + "ref": { + "type": "string" + } + }, + "required": ["_tag", "message"], + "additionalProperties": false + }, "V2SessionMessagesResponse": { "type": "object", "properties": {