Add 7 missing SDK methods and document all exports

- Add listAgents, unfreezeAgent, deleteAgent, getMe, issueApiToken, downloadExport, health methods
- Add corresponding response types to types.ts
- Export new types from index.ts
- Document all previously undocumented exports in README

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 4.6 committed 2026-03-01 15:53:50 -05:00
1 parent 8a2e34eac2
commit cb7a6320d5
4 files changed
+141

No files matched your search

+60
View File
@@ -5,6 +5,9 @@ import type {
RegisterAgentRequest,
RegisterAgentResponse,
GetAgentResponse,
ListAgentsResponse,
UnfreezeAgentResponse,
DeleteAgentResponse,
SubmitOperationResponse,
GetOperationResponse,
VerifyOperationResponse,
@@ -16,7 +19,10 @@ import type {
CreateExportResponse,
ListExportsResponse,
GetExportResponse,
GetMeResponse,
IssueApiTokenResponse,
JWKSResponse,
HealthResponse,
AuthRegisterResponse,
AuthLoginResponse,
ErrorResponse,
@@ -119,6 +125,18 @@ export class ElydoraClient {
return handleResponse<AuthLoginResponse>(res);
}
// -------------------------------------------------------------------------
// Auth (instance methods — require token)
// -------------------------------------------------------------------------
async getMe(): Promise<GetMeResponse> {
return this.request<GetMeResponse>('GET', '/v1/auth/me');
}
async issueApiToken(ttlSeconds?: number | null): Promise<IssueApiTokenResponse> {
return this.request<IssueApiTokenResponse>('POST', '/v1/auth/token', { ttl_seconds: ttlSeconds ?? null });
}
// -------------------------------------------------------------------------
// Agent management
// -------------------------------------------------------------------------
@@ -135,6 +153,18 @@ export class ElydoraClient {
await this.request<unknown>('POST', `/v1/agents/${encodeURIComponent(agentId)}/freeze`, { reason });
}
async listAgents(): Promise<ListAgentsResponse> {
return this.request<ListAgentsResponse>('GET', '/v1/agents');
}
async unfreezeAgent(agentId: string, reason: string): Promise<UnfreezeAgentResponse> {
return this.request<UnfreezeAgentResponse>('POST', `/v1/agents/${encodeURIComponent(agentId)}/unfreeze`, { reason });
}
async deleteAgent(agentId: string): Promise<DeleteAgentResponse> {
return this.request<DeleteAgentResponse>('DELETE', `/v1/agents/${encodeURIComponent(agentId)}`);
}
async revokeKey(agentId: string, kid: string, reason: string): Promise<void> {
await this.request<unknown>('POST', `/v1/agents/${encodeURIComponent(agentId)}/revoke`, { kid, reason });
}
@@ -250,6 +280,23 @@ export class ElydoraClient {
return this.request<GetExportResponse>('GET', `/v1/exports/${encodeURIComponent(exportId)}`);
}
async downloadExport(exportId: string): Promise<ArrayBuffer> {
const url = `${this.baseUrl}/v1/exports/${encodeURIComponent(exportId)}/download`;
const headers: Record<string, string> = {};
if (this.token) {
headers['Authorization'] = `Bearer ${this.token}`;
}
const res = await fetch(url, { method: 'GET', headers });
if (!res.ok) {
return handleResponse<never>(res);
}
return res.arrayBuffer();
}
// -------------------------------------------------------------------------
// JWKS
// -------------------------------------------------------------------------
@@ -263,6 +310,19 @@ export class ElydoraClient {
return handleResponse<JWKSResponse>(res);
}
// -------------------------------------------------------------------------
// Health
// -------------------------------------------------------------------------
async health(): Promise<HealthResponse> {
const url = `${this.baseUrl}/v1/health`;
const res = await fetch(url, {
method: 'GET',
headers: { 'Accept': 'application/json' },
});
return handleResponse<HealthResponse>(res);
}
// -------------------------------------------------------------------------
// Internal HTTP helpers
// -------------------------------------------------------------------------
+6
View File
@@ -46,6 +46,9 @@ export type {
RegisterAgentRequest,
RegisterAgentResponse,
GetAgentResponse,
ListAgentsResponse,
UnfreezeAgentResponse,
DeleteAgentResponse,
SubmitOperationResponse,
GetOperationResponse,
VerifyOperationResponse,
@@ -57,8 +60,11 @@ export type {
CreateExportResponse,
GetExportResponse,
ListExportsResponse,
GetMeResponse,
IssueApiTokenResponse,
JWK,
JWKSResponse,
HealthResponse,
AuthRegisterResponse,
AuthLoginResponse,
ErrorResponse,
+28
View File
@@ -247,6 +247,34 @@ export interface ListExportsResponse {
readonly exports: Export[];
}
export interface ListAgentsResponse {
readonly agents: Agent[];
}
export interface UnfreezeAgentResponse {
readonly agent: Agent;
}
export interface DeleteAgentResponse {
readonly deleted: boolean;
}
export interface GetMeResponse {
readonly user: User;
}
export interface IssueApiTokenResponse {
readonly token: string;
readonly expires_at: number | null;
}
export interface HealthResponse {
readonly status: string;
readonly version: string;
readonly protocol_version: string;
readonly timestamp: number;
}
export interface JWK {
readonly kty: string;
readonly crv?: string;