@cortex_ai/sdk
v1.3.1
Published
TypeScript SDK for the Cortex CaaS API
Maintainers
Readme
@cortex_ai/sdk
TypeScript SDK for the Cortex CaaS (Context-as-a-Service) API.
Zero runtime dependencies. Works with Node.js 18+ using native fetch.
Install
npm install @cortex_ai/sdkQuick Start
import { CortexClient } from "@cortex_ai/sdk";
const client = new CortexClient("http://localhost:8100", {
bearer: "your-token",
});
// Store a memory
await client.ingest({
subject: "did:cortex:abc123",
predicate: "learned",
object: "TypeScript SDK usage",
});
// Query memories
const results = await client.query("did:cortex:abc123", {
predicate: "learned",
});
// Subscribe to real-time updates via SSE
const stream = client.subscribe("did:cortex:abc123");
for await (const event of stream) {
console.log(event);
}Features
- Full CaaS API coverage (ingest, query, subscribe, webhooks, credentials)
- SSE streaming with automatic reconnection and
Last-Event-IDreplay - Bearer token and OAuth2 client-credentials authentication
- Pagination helpers
- ESM and CommonJS dual-build
- Zero runtime dependencies
Documentation
See the main repository for full documentation, protocol spec, and server setup.
License
MIT
