UNPKG

@adonis-agora/agent

Version:

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

55 lines • 1.92 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.2). */ export class OAuthError extends PoppyError { retryAfter; constructor(code, opts = {}) { super(code, undefined, opts); this.name = 'OAuthError'; this.retryAfter = opts.retryAfter; } } /** * A resource (API, conversation, mediated sign-in) rejected the token, via `WWW-Authenticate` * (section 6): `invalid_token`, `sign_in_required`, `insufficient_scope`, DPoP errors. */ 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 conversation error with a JSON `error` body (7.13). */ 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