UNPKG

@adonis-agora/agent

Version:

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

40 lines • 1.98 kB
/** * Structural, dependency-free reader for the Agora runtime context — mirrors * `@adonis-agora/authz`'s `agora/context.ts`. The Agora context library publishes a READ accessor * on the well-known symbol slot. We never import that package; when the slot is absent (context not * installed) the reader degrades to `undefined` and the caller fails closed. */ /** The symbol slot the Agora context library writes its read accessor into. */ export declare const AGORA_CONTEXT_ACCESSOR: unique symbol; /** * The slice of the context accessor this package reads. `@adonis-agora/context`'s real accessor * (`packages/core/src/accessor.ts`) publishes `tenantId` and `userRef` as METHODS — calling them * returns the active value, or `undefined` outside a request/job. They are NOT plain properties; * treating them as values (the mistake this file used to make) makes every field a truthy function * reference instead of the data it holds. We never read `globalRoles` here — authz's * `effectiveRoles` does that internally. */ export interface AgoraContextAccessor { tenantId?: () => string | undefined; userRef?: () => { type?: string; id?: string | number; } | undefined; get?: () => unknown; } /** Read the active Agora context accessor from the global slot, if present. */ export declare function readContextAccessor(): AgoraContextAccessor | undefined; /** * The active caller's `userRef` from the Agora context, or `undefined` outside a context / when * the accessor slot is absent. */ export declare function userRefFromContext(accessor?: AgoraContextAccessor | undefined): { type?: string; id?: string | number; } | undefined; /** * The active tenant id from the Agora context, or `undefined` outside a context / when unset / * when the accessor slot is absent. */ export declare function tenantIdFromContext(accessor?: AgoraContextAccessor | undefined): string | undefined; //# sourceMappingURL=agora-context.d.ts.map