@openagentid/sdk API
Exported TypeScript types, signatures and source documentation.
Package manifest, subpaths, and integration guide.
This reference resolves exported symbols from the package entry point with the TypeScript parser/type checker. It includes declarations and inferred types, not implementation bodies. External dependencies unavailable to the extraction environment can remain unresolved; this is source documentation, not proof that all packages typecheck or are published.
OpenAgent
OpenAgent — the public namespace. All calls delegate to a singleton
runtime created lazily on first use. Most apps never need more than this.
export declare const OpenAgent: { readonly configure: (config?: OpenAgentConfig) => OpenAgentRuntime; readonly runtime: () => OpenAgentRuntime; readonly createAgent: (input: CreateAgentInput) => Promise<OpenAgentInstance>; readonly loadAgent: (did: Did, skills?: readonly SkillId[]) => Promise<OpenAgentInstance>; readonly authenticate: (req: Request, options?: VerifyRequestOptions) => Promise<AuthContext>; };Source: openagent-sdk/sdks/typescript/src/agent.ts:221.
OpenAgentRuntime
Global, lazily-initialized OpenAgent runtime.
The default instance is populated by {@link OpenAgent.configure}. Callers
who need multiple runtimes in one process can instantiate OpenAgentRuntime
directly.
export declare class OpenAgentRuntime {
constructor(config?: OpenAgentConfig): OpenAgentRuntime;
config(): Readonly<ResolvedOpenAgentConfig>;
identity(): IdentityProvider;
arsenal(): ArsenalClient;
verification(): VerificationClient;
createAgent(input: CreateAgentInput): Promise<OpenAgentInstance>;
loadAgent(did: Did, skills?: readonly SkillId[]): Promise<OpenAgentInstance>;
authenticate(req: Request, options?: VerifyRequestOptions): Promise<AuthContext>;
}Source: openagent-sdk/sdks/typescript/src/agent.ts:121.
OpenAgentInstance
A live, fully-authenticated agent handle.
/** A live, fully-authenticated agent handle. */
export interface OpenAgentInstance {
/** The agent's DID. */
readonly did: Did;
/** The raw OAS identity document. */
readonly document: IdentityDocument;
/** Skills policy bound to this agent. */
skillsPolicy(): SkillsPolicy;
/** Replace the agent's skills policy (immutable — returns a new instance). */
withSkillsPolicy(policy: SkillsPolicy): OpenAgentInstance;
/** Fetch a credential handle for `provider`. */
credentialsFor(provider: string, scopes?: readonly string[]): Promise<CredentialHandle>;
/** Underlying identity provider (escape hatch). */
identity(): IdentityProvider;
}Source: openagent-sdk/sdks/typescript/src/agent.ts:99.
OpenAgentConfig
Global SDK configuration.
All fields are optional; sensible defaults are applied by {@link OpenAgent.configure }. The SDK works with zero configuration for local development and test environments.
/**
* Global SDK configuration.
*
* All fields are optional; sensible defaults are applied by
* {@link OpenAgent.configure}. The SDK works with zero configuration for
* local development and test environments.
*/
export interface OpenAgentConfig {
/** Override the default namespace (`l1fe`). */
namespace?: string;
/**
* Transport endpoints. If omitted, the SDK assumes it is running in-process
* with the underlying libraries (useful for tests) or that the wrapped
* SDKs will read their own env vars.
*/
endpoints?: {
oasResolver?: string;
arsenalBroker?: string;
aegisVerifier?: string;
};
/**
* Inject a custom `fetch`. Defaults to globalThis.fetch (native on Node 20+,
* Bun, Deno, browsers, Workers).
*/
fetch?: typeof fetch;
/** Optional structured logger. */
logger?: Logger;
/** Override the abort timeout (ms) for HTTP calls. Default: 30000. */
requestTimeoutMs?: number;
/**
* Pre-constructed subsystem clients (advanced). When provided, the SDK
* uses them directly instead of constructing its own.
*/
clients?: OpenAgentClients;
}Source: openagent-sdk/sdks/typescript/src/config.ts:98.
OpenAgentClients
Forward-declared clients for the three wrapped subsystems.
Concrete interfaces live in the per-module files so that this config file does not depend on internal implementation details.
/**
* Forward-declared clients for the three wrapped subsystems.
*
* Concrete interfaces live in the per-module files so that this config file
* does not depend on internal implementation details.
*/
export interface OpenAgentClients {
readonly identity?: unknown;
readonly credentials?: unknown;
readonly verification?: unknown;
}Source: openagent-sdk/sdks/typescript/src/config.ts:85.
ResolvedOpenAgentConfig
Resolved configuration with all defaults applied.
/** Resolved configuration with all defaults applied. */
export interface ResolvedOpenAgentConfig {
namespace: string;
endpoints: {
oasResolver?: string;
arsenalBroker?: string;
aegisVerifier?: string;
};
fetch: typeof fetch;
logger: Logger;
requestTimeoutMs: number;
clients: OpenAgentClients;
}Source: openagent-sdk/sdks/typescript/src/config.ts:128.
CreateAgentInput
export type CreateAgentInput = z.infer<typeof createAgentInputSchema>;Source: openagent-sdk/sdks/typescript/src/config.ts:61.
Logger
Logger interface — structured, dependency-free.
/** Logger interface — structured, dependency-free. */
export interface Logger {
debug(msg: string, fields?: Record<string, unknown>): void;
info(msg: string, fields?: Record<string, unknown>): void;
warn(msg: string, fields?: Record<string, unknown>): void;
error(msg: string, fields?: Record<string, unknown>): void;
}Source: openagent-sdk/sdks/typescript/src/config.ts:64.
resolveConfig
Merge user config with defaults. Pure function — does not mutate input.
export declare const resolveConfig: (config?: OpenAgentConfig) => ResolvedOpenAgentConfig;Source: openagent-sdk/sdks/typescript/src/config.ts:145.
silentLogger
No-op logger used by default.
export declare const silentLogger: Logger;Source: openagent-sdk/sdks/typescript/src/config.ts:72.
createAgentInputSchema
Parameters accepted by {@link OpenAgent.createAgent }.
export declare const createAgentInputSchema: z.ZodObject<{ parent: z.ZodString; name: z.ZodString; scopes: z.ZodArray<z.ZodString>; namespace: z.ZodOptional<z.ZodString>; skills: z.ZodOptional<z.ZodArray<z.ZodString>>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, z.core.$strict>;Source: openagent-sdk/sdks/typescript/src/config.ts:40.
didSchema
export declare const didSchema: z.ZodString;Source: openagent-sdk/sdks/typescript/src/config.ts:20.
scopeSchema
A parsed OAS scope string such as openai:chat:completions.
export declare const scopeSchema: z.ZodString;Source: openagent-sdk/sdks/typescript/src/config.ts:23.
providerSchema
Provider identifier (e.g. openai, github, stripe).
export declare const providerSchema: z.ZodString;Source: openagent-sdk/sdks/typescript/src/config.ts:32.
DEFAULT_NAMESPACE
export declare const DEFAULT_NAMESPACE: "l1fe";Source: openagent-sdk/sdks/typescript/src/config.ts:141.
DEFAULT_REQUEST_TIMEOUT_MS
export declare const DEFAULT_REQUEST_TIMEOUT_MS: 30000;Source: openagent-sdk/sdks/typescript/src/config.ts:142.
DID_REGEX
DID regex for did:oas:<namespace>:<kind>:<identifier>.
Mirrors the OAS v1.1.0 specification. We keep it deliberately permissive here — strict validation belongs in the OAS SDK itself.
export declare const DID_REGEX: RegExp;Source: openagent-sdk/sdks/typescript/src/config.ts:17.
Did
Fully qualified did:oas identifier.
/** Fully qualified `did:oas` identifier. */
export type Did = string;Source: openagent-sdk/sdks/typescript/src/identity.ts:19.
IdentityDocument
OAS identity document fragment — minimum fields needed by the SDK.
/** OAS identity document fragment — minimum fields needed by the SDK. */
export interface IdentityDocument {
/** Canonical DID. */
did: Did;
/** Parent DID (lineage). */
parent: Did;
/** Multibase-encoded Ed25519 public key. */
publicKeyMultibase: string;
/** Entity kind — `agent`, `tool`, etc. */
kind: string;
/** Granted scopes. */
scopes: readonly string[];
/** ISO-8601 creation timestamp. */
createdAt: string;
/** Opaque metadata. */
metadata?: Record<string, unknown>;
}Source: openagent-sdk/sdks/typescript/src/identity.ts:22.
IdentityProvider
The OAS identity facade. Concrete providers come from @openagentid/oas-sdk
(production) or from {@link StubIdentityProvider } (test / offline dev).
/**
* The OAS identity facade. Concrete providers come from `@openagentid/oas-sdk`
* (production) or from {@link StubIdentityProvider} (test / offline dev).
*/
export interface IdentityProvider {
/** Create a new OAS identity descended from `input.parent`. */
createAgentIdentity(input: CreateAgentInput): Promise<IdentityDocument>;
/** Resolve an existing DID to its identity document. */
resolve(did: Did): Promise<IdentityDocument>;
/** Sign a challenge (e.g. from AEGIS) with the agent's private key. */
signChallenge(did: Did, challenge: Uint8Array): Promise<SignedAssertion>;
/** Return the public key for a DID (multibase). */
publicKey(did: Did): Promise<string>;
}Source: openagent-sdk/sdks/typescript/src/identity.ts:57.
SignedAssertion
Signed credential returned by the identity provider.
/** Signed credential returned by the identity provider. */
export interface SignedAssertion {
/** JWS / JWT / OAS assertion envelope (base64url). */
token: string;
/** Raw signature bytes (base64). */
signature: string;
/** DID of the signer. */
signer: Did;
/** Unix timestamp when the assertion was minted. */
issuedAt: number;
/** Unix timestamp after which the assertion is invalid. */
expiresAt: number;
}Source: openagent-sdk/sdks/typescript/src/identity.ts:40.
parseIdentityDocument
Validate an untrusted identity document. Throws {@link IdentityError} on failure.
export declare const parseIdentityDocument: (raw: unknown) => IdentityDocument;Source: openagent-sdk/sdks/typescript/src/identity.ts:85.
toIdentityProvider
Narrow any unknown value into an {@link IdentityProvider}, or throw.
This is the integration point where @openagentid/oas-sdk's client is adapted into
our interface. When that SDK is finalized, replace the duck-typing below
with a direct import.
export declare const toIdentityProvider: (client: unknown) => IdentityProvider;Source: openagent-sdk/sdks/typescript/src/identity.ts:107.
identityDocumentSchema
Runtime-validated identity document schema.
export declare const identityDocumentSchema: z.ZodObject<{ did: z.ZodString; parent: z.ZodString; publicKeyMultibase: z.ZodString; kind: z.ZodString; scopes: z.ZodReadonly<z.ZodArray<z.ZodString>>; createdAt: z.ZodString; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, z.core.$strict>;Source: openagent-sdk/sdks/typescript/src/identity.ts:72.
ArsenalClient
Arsenal broker client facade. The real client lives in @openagentid/arsenal-sdk
and is injected by the application; see INTEGRATION_NOTES.md.
/**
* Arsenal broker client facade. The real client lives in `@openagentid/arsenal-sdk`
* and is injected by the application; see `INTEGRATION_NOTES.md`.
*/
export interface ArsenalClient {
/** Request a scoped credential for `provider` on behalf of `agentDid`. */
requestCredential(params: {
agentDid: Did;
provider: string;
scopes?: readonly string[];
}): Promise<IssuedCredential>;
/** Optionally release / revoke a previously issued credential. */
release?(credentialProxyUrl: string): Promise<void>;
}Source: openagent-sdk/sdks/typescript/src/credentials.ts:50.
CredentialHandle
A live, fetch-ready credential bound to an agent DID + provider.
The fetch method is a drop-in replacement for globalThis.fetch. The
underlying credential is refreshed lazily when the caller invokes
refresh() — auto-rotation stays out of the per-request hot path.
/**
* A live, fetch-ready credential bound to an agent DID + provider.
*
* The fetch method is a drop-in replacement for `globalThis.fetch`. The
* underlying credential is refreshed lazily when the caller invokes
* `refresh()` — auto-rotation stays out of the per-request hot path.
*/
export interface CredentialHandle {
readonly provider: string;
readonly agentDid: Did;
readonly expiresAt: number;
/**
* Drop-in replacement for the global `fetch`. The `X-Arsenal-Target`
* header is set to the original URL and the request is routed through
* the Arsenal credential proxy.
*
* Streaming responses (SSE, chunked JSON, transfer-encoding: chunked)
* are fully supported because the return value is a standard `Response`.
*/
fetch: typeof fetch;
/** Mint a fresh credential and return a new handle. */
refresh(): Promise<CredentialHandle>;
/** Release the credential (best-effort; safe to call multiple times). */
release(): Promise<void>;
}Source: openagent-sdk/sdks/typescript/src/credentials.ts:69.
IssuedCredential
A short-lived credential minted by the Arsenal broker.
/** A short-lived credential minted by the Arsenal broker. */
export interface IssuedCredential {
/** Provider identifier this credential targets. */
provider: string;
/**
* Credential material location. Arsenal's broker returns pre-signed proxy
* URLs rather than raw secrets; raw tokens never leave the broker.
*/
proxyUrl: string;
/** Unix timestamp after which the credential is invalid. */
expiresAt: number;
/** Optional ceiling on how many requests this credential can issue. */
remainingCalls?: number;
/** Arbitrary metadata (tenant, project, region). */
metadata?: Record<string, unknown>;
}Source: openagent-sdk/sdks/typescript/src/credentials.ts:30.
createCredentialHandle
Create a {@link CredentialHandle} backed by an Arsenal client.
export declare const createCredentialHandle: (params: CreateCredentialHandleParams) => Promise<CredentialHandle>;Source: openagent-sdk/sdks/typescript/src/credentials.ts:102.
AuthContext
A resolved, authenticated caller identity.
/** A resolved, authenticated caller identity. */
export interface AuthContext {
/** The calling agent's DID. */
readonly did: Did;
/** The root HMR/MHR this agent chains to. */
readonly root: Did;
/** Delegation chain from `root` → `did`. Ordered, length ≥ 1. */
readonly lineage: readonly Did[];
/** OAS + Sigil authority proof required for privileged access. */
readonly lineageAuthority?: LineageAuthorityContext;
/** Scopes granted to this caller for this request. */
readonly scopes: readonly string[];
/** Unix timestamp when the underlying assertion expires. */
readonly expiresAt: number;
/** Raw bearer the caller presented, for audit logging. */
readonly presentedToken?: string;
/** Arbitrary claims passed through from AEGIS. */
readonly claims?: Readonly<Record<string, unknown>>;
}Source: openagent-sdk/sdks/typescript/src/verification.ts:42.
LineageAuthorityContext
Sigil-backed lineage authority attached by an OAS verifier.
/** Sigil-backed lineage authority attached by an OAS verifier. */
export interface LineageAuthorityContext {
/** DID whose privileged authority was verified. */
readonly subject: Did;
/** Backend/source identifier, normally `sigil_gal`. */
readonly source: string;
/** Finalized root DID for the verified path. */
readonly root: Did;
/** Reconstructed finalized path, ordered root to caller. */
readonly path: readonly Did[];
/** Sigil block height at which this authority was finalized. */
readonly finalizedBlock: number;
/** Authority path kind, e.g. `human_to_agent`. */
readonly pathKind: string;
/** Scopes proven by this lineage path. */
readonly scopes: readonly string[];
/** Generation/depth from root to subject. */
readonly generation: number;
/** Accepted root kind for this authority path. */
readonly rootKind?: string;
/** Optional org lineage root commitment for org-scoped authority. */
readonly orgRootCommitment?: string;
/** Optional expiry timestamp for the authority edge/path. */
readonly expiresAt?: string;
}Source: openagent-sdk/sdks/typescript/src/verification.ts:16.
PrivilegedAuthorityVerifier
Runtime hook that turns an authenticated context into OAS/Sigil authority.
/** Runtime hook that turns an authenticated context into OAS/Sigil authority. */
export interface PrivilegedAuthorityVerifier {
verify(ctx: AuthContext, options: VerifyRequestOptions): Promise<LineageAuthorityContext>;
}Source: openagent-sdk/sdks/typescript/src/verification.ts:96.
VerificationClient
AEGIS verifier facade. Concrete implementation lives in @openagentid/aegis-sdk.
The OpenAgent SDK never decodes assertions itself — it delegates to AEGIS for all verification, lineage walking, and policy evaluation.
/**
* AEGIS verifier facade. Concrete implementation lives in `@openagentid/aegis-sdk`.
*
* The OpenAgent SDK never decodes assertions itself — it delegates to
* AEGIS for all verification, lineage walking, and policy evaluation.
*/
export interface VerificationClient {
verifyRequest(req: Request, options?: VerifyRequestOptions): Promise<AuthContext>;
/** Issue a short-lived challenge for challenge-response auth. */
issueChallenge(): Promise<{
challenge: Uint8Array;
challengeId: string;
}>;
/** Verify a challenge response (typically from a worker/CLI flow). */
verifyChallengeResponse(params: {
challengeId: string;
agentDid: Did;
signatureBase64: string;
}): Promise<AuthContext>;
}Source: openagent-sdk/sdks/typescript/src/verification.ts:81.
VerifyRequestOptions
Options for {@link VerificationClient.verifyRequest}.
/** Options for {@link VerificationClient.verifyRequest}. */
export interface VerifyRequestOptions {
/** Require the caller to hold all of these scopes; otherwise throw. */
requiredScopes?: readonly string[];
/** Require the caller's lineage to include (or equal) this DID. */
requiredAncestor?: Did;
/** Require a Sigil-backed OAS lineage authority result. */
requirePrivilegedAuthority?: boolean;
/** Required authority path kind when privileged authority is required. */
requiredAuthorityPath?: string;
/** Extra clock skew tolerance (seconds). Default: 60. */
clockSkewSeconds?: number;
}Source: openagent-sdk/sdks/typescript/src/verification.ts:62.
PrivilegedAuthorityVerificationClient
Wraps any verifier and requires OAS/Sigil authority for privileged requests.
export declare class PrivilegedAuthorityVerificationClient {
constructor(inner: VerificationClient, authorityVerifier: PrivilegedAuthorityVerifier): PrivilegedAuthorityVerificationClient;
verifyRequest(req: Request, options?: VerifyRequestOptions): Promise<AuthContext>;
issueChallenge(): Promise<{ challenge: Uint8Array; challengeId: string; }>;
verifyChallengeResponse(params: { challengeId: string; agentDid: Did; signatureBase64: string; }): Promise<AuthContext>;
}Source: openagent-sdk/sdks/typescript/src/verification.ts:168.
extractBearerToken
Extract the bearer token from a Request without trusting it.
Checks, in order: Authorization: OpenAgent ...,
Authorization: Bearer ..., X-OpenAgent-Token, and an oa_token
query parameter. Returns null if absent.
export declare const extractBearerToken: (req: Request) => string | null;Source: openagent-sdk/sdks/typescript/src/verification.ts:107.
assertScopes
Assert that ctx holds every scope in required.
export declare const assertScopes: (ctx: AuthContext, required: readonly string[]) => void;Source: openagent-sdk/sdks/typescript/src/verification.ts:126.
assertAncestor
Assert that ctx.lineage contains ancestor.
export declare const assertAncestor: (ctx: AuthContext, ancestor: Did) => void;Source: openagent-sdk/sdks/typescript/src/verification.ts:138.
toVerificationClient
Narrow any unknown value into a {@link VerificationClient}, or throw.
Duck-typed for forward compatibility with @openagentid/aegis-sdk.
export declare const toVerificationClient: (client: unknown) => VerificationClient;Source: openagent-sdk/sdks/typescript/src/verification.ts:151.
SkillId
A skill identifier such as frontend-design or sql-query.
/** A skill identifier such as `frontend-design` or `sql-query`. */
export type SkillId = string;Source: openagent-sdk/sdks/typescript/src/skills.ts:17.
SkillsPolicy
The minimum contract the OpenAgent SDK expects from a skills policy.
/** The minimum contract the OpenAgent SDK expects from a skills policy. */
export interface SkillsPolicy {
/** Return true if the agent may invoke `skill`. */
canInvoke(skill: SkillId): boolean;
/** Throw a {@link SkillDeniedError} if `skill` is not allowed. */
assertCanInvoke(skill: SkillId): void;
/** List all skills the agent is currently permitted to invoke. */
listAllowed(): readonly SkillId[];
/** Produce a new policy with an additional skill. */
grant(skill: SkillId): SkillsPolicy;
/** Produce a new policy without `skill`. */
revoke(skill: SkillId): SkillsPolicy;
}Source: openagent-sdk/sdks/typescript/src/skills.ts:20.
InMemorySkillsPolicy
In-memory, immutable skills policy. Every mutation returns a new instance.
Supports two match modes:
- Exact:
frontend-designmatches onlyfrontend-design - Wildcard suffix:
frontend-*matchesfrontend-design,frontend-test, ...
export declare class InMemorySkillsPolicy {
constructor(skills?: readonly SkillId[]): InMemorySkillsPolicy;
canInvoke(skill: SkillId): boolean;
assertCanInvoke(skill: SkillId): void;
listAllowed(): readonly SkillId[];
grant(skill: SkillId): SkillsPolicy;
revoke(skill: SkillId): SkillsPolicy;
}Source: openagent-sdk/sdks/typescript/src/skills.ts:44.
denyAllSkills
Empty policy that denies everything.
export declare const denyAllSkills: SkillsPolicy;Source: openagent-sdk/sdks/typescript/src/skills.ts:87.
allowAllSkills
Policy that allows any skill (dangerous — use only in tests).
export declare const allowAllSkills: SkillsPolicy;Source: openagent-sdk/sdks/typescript/src/skills.ts:90.
act
The ACT namespace.
export declare const act: { readonly verify: (token: Uint8Array) => ActVerifierBuilder; readonly setCryptoBinding: (binding: ActVerifyBinding) => void; };Source: openagent-sdk/sdks/typescript/src/act.ts:215.
ActVerifierBuilder
Fluent ACT verifier, built by {@link act.verify}.
export declare class ActVerifierBuilder {
constructor(token: Uint8Array): ActVerifierBuilder;
issuer(iss: string): this;
forAudience(audience: string): this;
requireScope(scope: string): this;
requireScopes(scopes: string[]): this;
trustedKeys(keys: Uint8Array[]): this;
withLeeway(seconds: number): this;
atTime(unixSeconds: number): this;
run(): Promise<ActClaims>;
}Source: openagent-sdk/sdks/typescript/src/act.ts:108.
setActCryptoBinding
Inject the crypto-wasm binding. Called by consumers at startup (and by
tests with a mock). The binding is the @openagentid/crypto-wasm module's
nodejs or bundler build, already instantiated.
export declare const setActCryptoBinding: (binding: ActVerifyBinding) => void;Source: openagent-sdk/sdks/typescript/src/act.ts:92.
ActClaims
The claims of a verified ACT, as returned by the canonical verifier.
/** The claims of a verified ACT, as returned by the canonical verifier. */
export interface ActClaims {
/** Token identifier. */
jti: string;
/** Subject: the OAS DID of the agent the token was issued to. */
sub: string;
/** Issuer: the broker instance that minted the token. */
iss: string;
/** Audiences this token is valid for. */
aud: string[];
/** Issued-at, seconds since the Unix epoch. */
iat: number;
/** Not-before, seconds since the Unix epoch. */
nbf: number;
/** Expiry, seconds since the Unix epoch. */
exp: number;
/** Tenant this token is scoped to. */
tenant_id: string;
/** Granted scopes (`service:resource:action`). */
scope: string[];
/** Proof-of-possession binding, when present. */
cnf?: {
key_fingerprint: string;
alg: string;
};
/** Onward delegation constraints, when present. */
delegation?: {
allow_delegation: boolean;
max_depth: number;
};
/** Issuer-defined extension claims (opaque to the format). */
ext?: Record<string, unknown>;
}Source: openagent-sdk/sdks/typescript/src/act.ts:29.
ActVerifyOptions
Options accepted by the fluent verifier.
/** Options accepted by the fluent verifier. */
export interface ActVerifyOptions {
/** The trusted issuer string (required — see {@link ActVerifierBuilder.issuer}). */
issuer?: string;
/** The audience this verifier answers for (required). */
audience?: string;
/** Scopes the token must grant. Wildcards in the grant expand; literal in the request. */
scopes?: string[];
/** Raw 32-byte Ed25519 trusted public keys (required). */
trustedKeys?: Uint8Array[];
/** Symmetric clock-skew allowance in seconds. Default: 0. */
leewaySeconds?: number;
/** Pinned verification time (tests and decision replay). Default: system clock. */
nowUnixSeconds?: number;
}Source: openagent-sdk/sdks/typescript/src/act.ts:57.
withAct
Fetch-standard middleware factory.
Returns a handler that takes (request, claims). A request whose token is
missing, malformed, forged, expired, wrong-audience, or under-scoped gets
a 401 with the reason — the handler never runs, and unauthenticated claims
never reach the application.
export declare const withAct: (config: RequireActConfig, handler: (req: Request, claims: ActClaims) => Promise<Response> | Response) => (req: Request) => Promise<Response>;Source: openagent-sdk/sdks/typescript/src/middleware.ts:88.
requireActExpress
Express-compatible middleware factory.
On success, the verified claims land on req.actClaims; on failure the
request is rejected with a 401 and never reaches the route.
export declare const requireActExpress: (config: RequireActConfig) => (req: { headers: Record<string, string | string[] | undefined>; actClaims?: ActClaims; }, res: { status: (code: number) => { json: (body: unknown) => unknown; }; }, next: () => void) => Promise<void>;Source: openagent-sdk/sdks/typescript/src/middleware.ts:126.
RequireActConfig
Policy for the middleware: the verifier bindings plus optional scopes.
/** Policy for the middleware: the verifier bindings plus optional scopes. */
export interface RequireActConfig {
/** The trusted issuer string. */
issuer: string;
/** The audience this service answers for. */
audience: string;
/** Scopes every request must carry. Default: none. */
scopes?: string[];
/** Trusted Ed25519 public keys (raw 32 bytes each). */
trustedKeys: Uint8Array[];
/** Clock-skew allowance in seconds. Default: 0. */
leewaySeconds?: number;
/**
* Extract the ACT envelope bytes from the request. Default: base64url of
* the `Authorization: Bearer <token>` header value.
*/
extractToken?: (req: Request) => Uint8Array | undefined;
/**
* Render the 401 response. Default: JSON `{ error }` with a
* `WWW-Authenticate: OpenAgent` hint.
*/
onUnauthorized?: (req: Request, reason: string) => Response;
}Source: openagent-sdk/sdks/typescript/src/middleware.ts:20.
keys
The key-custody namespace.
export declare const keys: { readonly generate: () => Promise<AgentKeys>; readonly fromSeed: (seed: Uint8Array) => AgentKeys; readonly fromSeedHex: (hex: string) => AgentKeys; readonly fromEnv: (envVar: string) => AgentKeys; readonly saveSeed: (keys: AgentKeys, path: string) => Promise<void>; readonly fromSeedFile: (path: string) => Promise<AgentKeys>; readonly seedToHex: (bytes: Uint8Array) => string; readonly setCryptoBinding: (binding: KeyCryptoBinding) => void; };Source: openagent-sdk/sdks/typescript/src/keys.ts:123.
setKeyCryptoBinding
Inject the crypto-wasm binding (same one as {@link setActCryptoBinding }).
export declare const setKeyCryptoBinding: (binding: KeyCryptoBinding) => void;Source: openagent-sdk/sdks/typescript/src/keys.ts:36.
AgentKeys
An agent's key material, derived from one seed.
/** An agent's key material, derived from one seed. */
export interface AgentKeys {
/** The 32-byte seed — the only thing that must be persisted. */
readonly seed: Uint8Array;
/** Ed25519 signing (private) key. */
readonly signingKey: Uint8Array;
/** Ed25519 verifying (public) key — the agent's identity fingerprint. */
readonly verifyingKey: Uint8Array;
/** X25519 encryption secret key (derived from the seed). */
readonly encryptionSecretKey: Uint8Array;
/** X25519 encryption public key (derived). */
readonly encryptionPublicKey: Uint8Array;
}Source: openagent-sdk/sdks/typescript/src/keys.ts:55.
KeyCryptoBinding
The crypto-wasm binding shape key custody consumes.
/** The crypto-wasm binding shape key custody consumes. */
export interface KeyCryptoBinding {
ed25519_generate_keypair(): {
signing_key: Uint8Array;
verifying_key: Uint8Array;
};
ed25519_public_from_private(signingKey: Uint8Array): Uint8Array;
x25519_generate_keypair(): {
secret_key: Uint8Array;
public_key: Uint8Array;
};
x25519_public_from_secret?(secretKey: Uint8Array): Uint8Array;
blake3_derive_key(context: string, keyMaterial: Uint8Array): Uint8Array;
}Source: openagent-sdk/sdks/typescript/src/keys.ts:25.
OpenAgentError
Root of the OpenAgent SDK error hierarchy.
try {
await OpenAgent.createAgent({ ... });
} catch (err) {
if (err instanceof OpenAgentError) {
console.error(err.code, err.message);
}
}export declare class OpenAgentError {
code: ErrorCodeValue;
cause: unknown;
context: Record<string, unknown>;
constructor(message: string, details: ErrorDetails): OpenAgentError;
toJSON(): Record<string, unknown>;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:74.
ConfigError
Configuration or usage violation (invalid input, missing dependency).
export declare class ConfigError {
constructor(message: string, context?: Record<string, unknown>): ConfigError;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:101.
InputValidationError
Runtime input validation failure (Zod, boundary checks).
export declare class InputValidationError {
constructor(message: string, cause?: unknown, context?: Record<string, unknown>): InputValidationError;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:110.
IdentityError
OAS identity subsystem failure.
export declare class IdentityError {
constructor(message: string, details: ErrorDetails): IdentityError;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:119.
CredentialError
Arsenal credentials subsystem failure.
export declare class CredentialError {
constructor(message: string, details: ErrorDetails): CredentialError;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:128.
VerificationError
AEGIS verification subsystem failure.
export declare class VerificationError {
constructor(message: string, details: ErrorDetails): VerificationError;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:137.
SkillDeniedError
Skills policy denial.
export declare class SkillDeniedError {
skill: string;
constructor(skill: string, reason?: string, context?: Record<string, unknown>): SkillDeniedError;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:146.
ErrorCode
Stable machine-readable error codes. These are part of the SDK's public contract and MUST stay in sync with the Rust reference implementation.
export declare const ErrorCode: { readonly INVALID_CONFIG: "openagent/invalid-config"; readonly INVALID_INPUT: "openagent/invalid-input"; readonly NOT_INITIALIZED: "openagent/not-initialized"; readonly IDENTITY_CREATE_FAILED: "openagent/identity/create-failed"; readonly IDENTITY_RESOLVE_FAILED: "openagent/identity/resolve-failed"; readonly IDENTITY_SIGNATURE_INVALID: "openagent/identity/signature-invalid"; readonly IDENTITY_LINEAGE_INVALID: "openagent/identity/lineage-invalid"; readonly CREDENTIAL_FETCH_FAILED: "openagent/credentials/fetch-failed"; readonly CREDENTIAL_SCOPE_DENIED: "openagent/credentials/scope-denied"; readonly CREDENTIAL_PROVIDER_UNKNOWN: "openagent/credentials/provider-unknown"; readonly CREDENTIAL_EXPIRED: "openagent/credentials/expired"; readonly VERIFICATION_FAILED: "openagent/verification/failed"; readonly AUTH_REQUIRED: "openagent/verification/auth-required"; readonly AUTH_CHALLENGE_INVALID: "openagent/verification/challenge-invalid"; readonly SKILL_DENIED: "openagent/skills/denied"; readonly SKILL_UNKNOWN: "openagent/skills/unknown"; readonly NETWORK_ERROR: "openagent/network-error"; readonly SERIALIZATION_ERROR: "openagent/serialization-error"; readonly UNKNOWN: "openagent/unknown"; };Source: openagent-sdk/sdks/typescript/src/errors.ts:16.
ErrorCodeValue
export type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];Source: openagent-sdk/sdks/typescript/src/errors.ts:49.
ErrorDetails
Structured error metadata attached to every {@link OpenAgentError}.
/** Structured error metadata attached to every {@link OpenAgentError}. */
export interface ErrorDetails {
/** Stable machine-readable code. */
code: ErrorCodeValue;
/** Optional cause (native Error, SDK error, or anything). */
cause?: unknown;
/** Arbitrary structured context for logging. */
context?: Record<string, unknown>;
}Source: openagent-sdk/sdks/typescript/src/errors.ts:52.
wrapError
Wraps any non-OpenAgentError into the SDK hierarchy without losing the cause.
export declare const wrapError: (err: unknown, fallbackMessage: string) => OpenAgentError;Source: openagent-sdk/sdks/typescript/src/errors.ts:161.
getErrorMessage
Narrow an unknown caught value to a human-readable message.
export declare const getErrorMessage: (err: unknown) => string;Source: openagent-sdk/sdks/typescript/src/errors.ts:168.
VERSION
SDK version — kept in sync with package.json.
export declare const VERSION: "0.1.1";Source: openagent-sdk/sdks/typescript/src/index.ts:127.