@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
61 lines • 2.53 kB
TypeScript
import { type JWK } from 'jose';
import { type StoredKey } from './keys.js';
import type { ClientMetadata } from './types.js';
import { type SecurityOptions } from './util.js';
export interface IdentityConfig {
/** Where the identity documents are served, e.g. `https://agent.example`. */
baseUrl: string;
clientName: string;
/** Defaults to `{baseUrl}/logo.svg`, which `serve-identity` serves. */
logoUri?: string | undefined;
/** Signing keys; the first one signs. Public halves go in `jwks_uri`. */
keys: StoredKey[];
/** Extensions this agent supports (3.3). None by default. */
extensions?: Record<string, {
version: string;
}> | undefined;
}
/** Lifetime of a client assertion (the guides suggest at most five minutes). */
export declare const ASSERTION_TTL_SECONDS = 60;
export declare const DELEGATION_TYP = "pap-delegation+jwt";
/** How long a delegation lasts, within the 24 hours 5.2 allows. */
export declare const DELEGATION_TTL_SECONDS: number;
/**
* The Personal Agent's identity (4.1): its `client_id` URL, its metadata document, and the
* keys from `jwks_uri` that sign client assertions and the delegations of Session JWT keys.
*/
export declare class AgentIdentity {
readonly baseUrl: string;
readonly clientName: string;
readonly logoUri: string;
readonly keys: StoredKey[];
readonly extensions?: Record<string, {
version: string;
}> | undefined;
constructor(cfg: IdentityConfig, sec?: SecurityOptions);
/** `client_id` is the URL the metadata document is fetched from (4.1). */
get clientId(): string;
get jwksUri(): string;
/** Same origin as `client_id`, as 4.1 requires for `redirect_uris`. */
get redirectUri(): string;
metadata(): ClientMetadata;
/** The public key set. Never contains private members. */
jwks(): {
keys: Record<string, unknown>[];
};
private sign;
/**
* `private_key_jwt` client assertion (4.1, RFC 7523): `iss` = `sub` = `client_id`, `aud` = the
* Company's issuer as a single string, short-lived, with `iat` and a fresh `jti`.
*/
clientAssertion(issuer: string): Promise<string>;
/**
* A delegation (5.2): vouches for one delegated public key. It names no User or Company. Its
* times are rounded to the hour, as the guides suggest, so they say less about when it was made.
*/
delegate(publicJwk: JWK): Promise<{
jwt: string;
exp: number;
}>;
}
//# sourceMappingURL=identity.d.ts.map