Skip to content

Commit d97f391

Browse files
feat(api): error and error_code as types
1 parent a044360 commit d97f391

7 files changed

Lines changed: 116 additions & 18 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 14
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta%2Fwarp-api-39e18bbb8b0af73eca7a880f56afbdecd69e3e5bab82a04c4d6429c32d7e6727.yml
33
openapi_spec_hash: 7a0de988bb37416d6e80f4a4bbe9d0d0
4-
config_hash: 0884847870200ee9d34bb00ce94aaa8e
4+
config_hash: 38ab203e1bd97a9bb22bbf744bcb5808

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Types:
55
- <code><a href="./src/resources/agent/agent.ts">AgentSkill</a></code>
66
- <code><a href="./src/resources/agent/agent.ts">AmbientAgentConfig</a></code>
77
- <code><a href="./src/resources/agent/agent.ts">CloudEnvironmentConfig</a></code>
8+
- <code><a href="./src/resources/agent/agent.ts">Error</a></code>
9+
- <code><a href="./src/resources/agent/agent.ts">ErrorCode</a></code>
810
- <code><a href="./src/resources/agent/agent.ts">McpServerConfig</a></code>
911
- <code><a href="./src/resources/agent/agent.ts">Scope</a></code>
1012
- <code><a href="./src/resources/agent/agent.ts">UserProfile</a></code>

src/client.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import {
2727
AgentSkill,
2828
AmbientAgentConfig,
2929
CloudEnvironmentConfig,
30+
Error,
31+
ErrorCode,
3032
McpServerConfig,
3133
Scope,
3234
UserProfile,
@@ -744,6 +746,8 @@ export declare namespace OzAPI {
744746
type AgentSkill as AgentSkill,
745747
type AmbientAgentConfig as AmbientAgentConfig,
746748
type CloudEnvironmentConfig as CloudEnvironmentConfig,
749+
type Error as Error,
750+
type ErrorCode as ErrorCode,
747751
type McpServerConfig as McpServerConfig,
748752
type Scope as Scope,
749753
type UserProfile as UserProfile,

src/resources/agent/agent.ts

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,108 @@ export namespace CloudEnvironmentConfig {
262262
}
263263
}
264264

265+
/**
266+
* Error response following RFC 7807 (Problem Details for HTTP APIs). Includes
267+
* backward-compatible extension members.
268+
*
269+
* The response uses the `application/problem+json` content type. Additional
270+
* extension members (e.g., `auth_url`, `provider`) may be present depending on the
271+
* error code.
272+
*/
273+
export interface Error {
274+
/**
275+
* Human-readable error message combining title and detail. Backward-compatible
276+
* extension member for older clients.
277+
*/
278+
error: string;
279+
280+
/**
281+
* The HTTP status code for this occurrence of the problem (RFC 7807)
282+
*/
283+
status: number;
284+
285+
/**
286+
* A short, human-readable summary of the problem type (RFC 7807)
287+
*/
288+
title: string;
289+
290+
/**
291+
* A URI reference that identifies the problem type (RFC 7807). Format:
292+
* `https://docs.warp.dev/agent-platform/troubleshooting/errors/{error_code}` See
293+
* PlatformErrorCode for the list of possible error codes.
294+
*/
295+
type: string;
296+
297+
/**
298+
* A human-readable explanation specific to this occurrence of the problem
299+
* (RFC 7807)
300+
*/
301+
detail?: string;
302+
303+
/**
304+
* The request path that generated this error (RFC 7807)
305+
*/
306+
instance?: string;
307+
308+
/**
309+
* Whether the request can be retried. When true, the error is transient and the
310+
* request may be retried. When false, retrying without addressing the underlying
311+
* cause will not succeed.
312+
*/
313+
retryable?: boolean;
314+
315+
/**
316+
* OpenTelemetry trace ID for debugging and support requests
317+
*/
318+
trace_id?: string;
319+
}
320+
321+
/**
322+
* Machine-readable error code identifying the problem type. Used in the `type` URI
323+
* of Error responses and in the `error_code` field of RunStatusMessage.
324+
*
325+
* User errors (run transitions to FAILED):
326+
*
327+
* - `insufficient_credits` — Team has no remaining add-on credits
328+
* - `feature_not_available` — Required feature not enabled for user's plan
329+
* - `external_authentication_required` — User hasn't authorized a required
330+
* external service
331+
* - `not_authorized` — Principal lacks permission for the requested operation
332+
* - `invalid_request` — Request is malformed or contains invalid parameters
333+
* - `resource_not_found` — Referenced resource does not exist
334+
* - `budget_exceeded` — Spending budget limit has been reached
335+
* - `integration_disabled` — Integration is disabled and must be enabled
336+
* - `integration_not_configured` — Integration setup is incomplete
337+
* - `operation_not_supported` — Requested operation not supported for this
338+
* resource/state
339+
* - `environment_setup_failed` — Client-side environment setup failed
340+
* - `content_policy_violation` — Prompt or setup commands violated content policy
341+
* - `conflict` — Request conflicts with the current state of the resource
342+
*
343+
* Warp errors (run transitions to ERROR):
344+
*
345+
* - `authentication_required` — Request lacks valid authentication credentials
346+
* - `resource_unavailable` — Transient infrastructure issue (retryable)
347+
* - `internal_error` — Unexpected server-side error (retryable)
348+
*/
349+
export type ErrorCode =
350+
| 'insufficient_credits'
351+
| 'feature_not_available'
352+
| 'external_authentication_required'
353+
| 'not_authorized'
354+
| 'invalid_request'
355+
| 'resource_not_found'
356+
| 'budget_exceeded'
357+
| 'integration_disabled'
358+
| 'integration_not_configured'
359+
| 'operation_not_supported'
360+
| 'environment_setup_failed'
361+
| 'content_policy_violation'
362+
| 'conflict'
363+
| 'authentication_required'
364+
| 'resource_unavailable'
365+
| 'internal_error';
366+
265367
/**
266368
* Configuration for an MCP server. Must have exactly one of: warp_id, command, or
267369
* url.
@@ -543,6 +645,8 @@ export declare namespace Agent {
543645
type AgentSkill as AgentSkill,
544646
type AmbientAgentConfig as AmbientAgentConfig,
545647
type CloudEnvironmentConfig as CloudEnvironmentConfig,
648+
type Error as Error,
649+
type ErrorCode as ErrorCode,
546650
type McpServerConfig as McpServerConfig,
547651
type Scope as Scope,
548652
type UserProfile as UserProfile,

src/resources/agent/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export {
55
type AgentSkill,
66
type AmbientAgentConfig,
77
type CloudEnvironmentConfig,
8+
type Error,
9+
type ErrorCode,
810
type McpServerConfig,
911
type Scope,
1012
type UserProfile,

src/resources/agent/runs.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -383,23 +383,7 @@ export namespace RunItem {
383383
* - `resource_unavailable` — Transient infrastructure issue (retryable)
384384
* - `internal_error` — Unexpected server-side error (retryable)
385385
*/
386-
error_code?:
387-
| 'insufficient_credits'
388-
| 'feature_not_available'
389-
| 'external_authentication_required'
390-
| 'not_authorized'
391-
| 'invalid_request'
392-
| 'resource_not_found'
393-
| 'budget_exceeded'
394-
| 'integration_disabled'
395-
| 'integration_not_configured'
396-
| 'operation_not_supported'
397-
| 'environment_setup_failed'
398-
| 'content_policy_violation'
399-
| 'conflict'
400-
| 'authentication_required'
401-
| 'resource_unavailable'
402-
| 'internal_error';
386+
error_code?: AgentAPI.ErrorCode;
403387

404388
/**
405389
* Whether the error is transient and the client may retry by submitting a new run.

src/resources/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export {
55
type AgentSkill,
66
type AmbientAgentConfig,
77
type CloudEnvironmentConfig,
8+
type Error,
9+
type ErrorCode,
810
type McpServerConfig,
911
type Scope,
1012
type UserProfile,

0 commit comments

Comments
 (0)