Developer Hub@eclips/sdk

TypeScript SDK

A fully typed, zero-dependency client for the eClips REST API. Works in Node.js 18+ and any modern runtime with fetch.

Install

bash
npm install @eclips/sdk

Quickstart

Create a client and run an agent. Set your key and org id as environment variables.

typescript
import { EClipsClient } from '@eclips/sdk';

const client = new EClipsClient({
  apiKey: process.env.ECLIPS_API_KEY!,
  organizationId: process.env.ECLIPS_ORG_ID!,
});

// Fire and poll — blocks until the agent finishes
const result = await client.runAndWait(
  'procurement_specialist',
  'Get 3 vendor quotes for 500 laptops — Dell, HP, Lenovo',
);

console.log(result.status);  // "completed"
console.log(result.result);  // { vendors: [...], recommended: "Dell" }

Verifying webhooks

Every webhook POST is signed with HMAC-SHA256. Verify it before trusting the payload.

typescript
import { EClipsClient } from '@eclips/sdk';

// In your webhook route, verify the signature before trusting the body
const ok = EClipsClient.verifyWebhook(
  rawBody,
  request.headers['x-eclips-signature'],
  process.env.WEBHOOK_SECRET!,
);
if (!ok) return new Response('Unauthorized', { status: 401 });

Typed errors

Each failure is a catchable error class so you can branch on exactly what happened.

typescript
import {
  EClipsClient,
  AuthenticationError,
  RateLimitError,
  TimeoutError,
  NotFoundError,
} from '@eclips/sdk';

try {
  const result = await client.runAndWait('ap_specialist', task);
} catch (err) {
  if (err instanceof AuthenticationError) {
    // Invalid or missing API key
  } else if (err instanceof RateLimitError) {
    await sleep(err.retryAfter ?? 60);   // seconds
  } else if (err instanceof TimeoutError) {
    // err.runId is still valid — poll client.getRun(err.runId)
  } else if (err instanceof NotFoundError) {
    // Run, triage item, or webhook not found
  }
}

Method reference

client.run()Agents

Trigger an agent run, returns run_id immediately

client.runAndWait()Agents

Trigger + poll until a terminal state

client.getRun()Agents

Fetch status and result for any run

client.listRuns()Agents

Paginated run history for your org

client.listTriage()Triage

Pending human-in-the-loop items

client.approveTriage()Triage

Approve and continue the blocked run

client.rejectTriage()Triage

Reject and cancel the blocked run

client.createWebhook()Webhooks

Register a webhook endpoint

client.listWebhooks()Webhooks

List all registered webhooks

client.deleteWebhook()Webhooks

Remove a webhook

client.createBatch()Batch

Submit many tasks in a single job

client.getBatch()Batch

Poll a batch job status

client.listBatches()Batch

History of batch jobs

client.cancelBatch()Batch

Cancel rows not yet started

client.triggerWorkflow()Workflows

Run a multi-step workflow

client.listWorkflows()Workflows

Fetch all saved workflows