From 839628445d4b2a99d00b0b0a2400bc0e4df5145e Mon Sep 17 00:00:00 2001 From: Dan Cleary Date: Tue, 3 Mar 2026 13:50:03 -0500 Subject: [PATCH] Align OpenAPI 3.0 schema constraints and improve setup payload errors. Replace unsupported OpenAPI const usage with 3.0-compatible enums and make CLI setup report invalid workspace creation payloads explicitly instead of classifying them as network failures. Made-with: Cursor --- openapi/agentstorage.v1.yaml | 6 ++++-- packages/cli/src/commands/setup.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/openapi/agentstorage.v1.yaml b/openapi/agentstorage.v1.yaml index 49aa7cb..5963d1f 100644 --- a/openapi/agentstorage.v1.yaml +++ b/openapi/agentstorage.v1.yaml @@ -198,7 +198,7 @@ paths: properties: permanent: type: boolean - const: true + enum: [true] required: [permanent] additionalProperties: false - type: object @@ -208,7 +208,9 @@ paths: minimum: 1 maximum: 604800 permanent: - enum: [false, null] + type: boolean + enum: [false] + nullable: true required: [expiresInSeconds] additionalProperties: false responses: diff --git a/packages/cli/src/commands/setup.ts b/packages/cli/src/commands/setup.ts index 3f810a9..7891088 100644 --- a/packages/cli/src/commands/setup.ts +++ b/packages/cli/src/commands/setup.ts @@ -24,6 +24,12 @@ class HttpError extends Error { } } +class InvalidPayloadError extends Error { + constructor(message: string) { + super(message); + } +} + const FETCH_TIMEOUT_MS = 30_000; function isTimeoutError(e: unknown): e is Error { @@ -114,7 +120,9 @@ export async function runSetup(argv: string[]): Promise { } const payload = await res.json(); if (!isCreateWorkspacePayload(payload)) { - throw new Error("Invalid workspace creation response"); + throw new InvalidPayloadError( + "POST /v1/workspaces returned an invalid payload.", + ); } created = payload; console.log(c.green + "✓" + c.reset); @@ -128,6 +136,8 @@ export async function runSetup(argv: string[]): Promise { console.error( fail(`POST /v1/workspaces timed out after ${FETCH_TIMEOUT_MS}ms.`), ); + } else if (e instanceof InvalidPayloadError) { + console.error(fail(e.message)); } else { console.error( fail(