UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

56 lines • 2.05 kB
/** Base error for everything this client raises on a protocol-level failure. */ export class PoppyError extends Error { code; status; description; details; constructor(code, message, opts = {}) { super(message ?? (opts.description ? `${code}: ${opts.description}` : code)); this.name = 'PoppyError'; this.code = code; this.status = opts.status; this.description = opts.description; this.details = opts.details; } } /** Discovery failed or a document didn't pass the checks of section 3. */ export class DiscoveryError extends PoppyError { constructor(code, message) { super(code, message); this.name = 'DiscoveryError'; } } /** OAuth error response from the token, device, or revocation endpoint (4.7). */ export class OAuthError extends PoppyError { retryAfter; constructor(code, opts = {}) { super(code, undefined, opts); this.name = 'OAuthError'; this.retryAfter = opts.retryAfter; } } /** * A resource (API, conversation, MCP server) refused the access token, or wants one, through * `WWW-Authenticate` (section 7): `invalid_token`, `insufficient_scope`, DPoP errors. A challenge * without an error code is reported as `insufficient_scope`, as the spec says to handle it. */ export class ResourceAuthError extends PoppyError { /** Scopes the Company says are needed, for `insufficient_scope`. */ scope; constructor(code, opts = {}) { super(code, undefined, opts); this.name = 'ResourceAuthError'; this.scope = opts.scope; } } /** A request refused with a JSON `error` body (5.3, 8.13), such as `invalid_session`. */ export class ConversationError extends PoppyError { /** For `direct_conversation_open`: the open Direct Conversation. */ conversationId; constructor(code, opts = {}) { super(code, undefined, opts); this.name = 'ConversationError'; this.conversationId = opts.conversationId; } } //# sourceMappingURL=errors.js.map