TypeScript SDK
The TypeScript SDK is an HTTP client that wraps the Akshi HTTP API. Use it for external tooling, dashboards, and orchestration scripts.
Installation
npm install @akshi/sdk
Quick start
import { AkshiClient } from "@akshi/sdk";
const client = new AkshiClient({
baseUrl: "http://127.0.0.1:3210",
token: "my-token",
});
const health = await client.health();
console.log(health.ok ? "Healthy" : "Unhealthy");
Client methods
| Method | HTTP | Returns | Description |
|---|---|---|---|
health() | GET /api/v1/health | HealthResponse | Runtime health check |
status() | GET /api/v1/agents | AgentStatus[] | All agent statuses |
logs(since?) | GET /api/v1/logs | LogEntry[] | Log entries, optionally filtered by ISO timestamp |
findings(since?) | GET /api/v1/findings | FindingRecord[] | Findings, optionally filtered by ISO timestamp |
postFindings(records) | POST /api/v1/findings | void | Submit a batch of findings |
FindingRecord
interface FindingRecord {
agent: string; // Agent name that produced the finding
severity: "info" | "low" | "medium" | "high" | "critical";
title: string; // Short summary
detail: string; // Full description
source?: string; // Origin (e.g., file path or URL)
timestamp?: string; // ISO 8601; auto-set if omitted
}
Error handling
All methods throw AkshiApiError on non-2xx responses. The error exposes
statusCode, error, and detail properties matching the API error format.
import { AkshiApiError } from "@akshi/sdk";
try {
await client.postFindings(records);
} catch (e) {
if (e instanceof AkshiApiError) {
console.error(`${e.statusCode}: ${e.detail}`);
}
}