Helpers, types, and migration
Helper Methods
Section titled “Helper Methods”Convenience methods that combine multiple operations.
waitForJob(jobId, opts?) — Poll job until completion.
const job = await signet.waitForJob("job-123", { timeout: 60_000, // 1 minute timeout interval: 500, // Poll every 500ms});// job.status — "completed" | "failed" | "done" | "dead"// job.result — job result (if completed)createAndIngestDocument(opts) — Create and wait for ingestion.
const doc = await signet.createAndIngestDocument({ source_type: "url", url: "https://example.com/article", title: "Example Article",});// Document is fully ingested and ready// doc.status — "done"recallOrThrow(query, opts?) — Recall that throws if no results.
try { const { results, meta } = await signet.recallOrThrow("user preferences", { type: "preference", limit: 5, minScore: 0.5, // applied locally; never sent to the daemon agentId: "my-agent", }); // Guaranteed to have at least one result // meta.totalReturned matches the filtered result count} catch (err) { console.log("No preferences found");}getMemoryOrThrow(id) — Get memory with 404 handling.
const memory = await signet.getMemoryOrThrow("mem-abc-123");// Throws if not foundgetDocumentOrThrow(id) — Get document with 404 handling.
const doc = await signet.getDocumentOrThrow("doc-123");// Throws if not foundbatchModifyWithProgress(patches, onProgress?) — Batch modify with progress.
const result = await signet.batchModifyWithProgress( [ { id: "m1", reason: "fix typo", content: "corrected" }, { id: "m2", reason: "update", content: "updated" }, ], (progress) => { console.log(`${progress.done}/${progress.total} complete`); },);// result.success — successful modifications// result.failed — failed modificationsError Handling
Section titled “Error Handling”All methods throw SignetApiError for HTTP failures and SignetNetworkError
for connection issues.
import { SignetApiError, SignetNetworkError } from "@signet/sdk";
try { await signet.remember("important fact");} catch (err) { if (err instanceof SignetApiError) { console.error(`API error ${err.status}: ${err.message}`); // err.status — HTTP status code // err.endpoint — failing endpoint // err.details — additional error details } else if (err instanceof SignetNetworkError) { console.error(`Network error: ${err.message}`); // Daemon unreachable } else { throw err; }}TypeScript Support
Section titled “TypeScript Support”The SDK is written in TypeScript and provides full type definitions.
import type { MemoryRecord, RecallResponse, JobStatus, DocumentRecord, ConnectorRecord, TaskRecord, SessionRecord, // ... and 100+ more types} from "@signet/sdk";All types are exported from the main entry point and can be imported directly.
Migration Guide
Section titled “Migration Guide”Upgrading from 0.x to 1.0
Section titled “Upgrading from 0.x to 1.0”No breaking changes — The 1.0 SDK is fully backward compatible with 0.x.
Key improvements in 1.0:
- 148 daemon endpoints covered (vs. ~25 in 0.x)
- Comprehensive helper methods
- Full TypeScript coverage
- Improved error types
- Better documentation
To upgrade:
npm install @signet/sdk@latestNo code changes required. All existing method signatures remain unchanged.