npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kognitos/node

v1.0.2

Published

Kognitos JavaScript/TypeScript SDK

Readme

kognitos

CI npm version License: MIT

TypeScript SDK for the Kognitos API.

  • Zero runtime dependencies (uses native fetch)
  • Dual CJS/ESM output with full TypeScript declarations
  • Automatic snake_case/camelCase conversion
  • Built-in retry with exponential backoff
  • Request timeouts via AbortController
  • Async iteration for paginated endpoints
  • NDJSON streaming with auto-reconnect

Installation

npm install @kognitos/node

Quick start

import Kognitos from '@kognitos/node';

const client = new Kognitos({
  token: 'pat_...',
  region: 'us', // 'us' | 'eu' | 'uk'
});

// List organizations
const { data: orgs } = await client.organizations.list();

// Get a workspace
const workspace = await client.workspaces.get({
  organizationId: 'org-123',
  workspaceId: 'ws-456',
});

// List automations with pagination
const { data: automations, nextPageToken } = await client.automations.list({
  organizationId: 'org-123',
  workspaceId: 'ws-456',
  pageSize: 10,
});

Pagination

All list endpoints return { data, nextPageToken, totalSize }. Use the built-in async iterator to auto-paginate:

import { autoPaginate } from '@kognitos/node';

const page = await client.automations.list({
  organizationId: 'org-123',
  workspaceId: 'ws-456',
});

for await (const automation of autoPaginate(page, (token) =>
  client.automations.list({
    organizationId: 'org-123',
    workspaceId: 'ws-456',
    pageToken: token,
  }),
)) {
  console.log(automation.displayName);
}

Or collect everything at once:

import { collectAll } from '@kognitos/node';

const all = await collectAll(page, (token) =>
  client.automations.list({
    organizationId: 'org-123',
    workspaceId: 'ws-456',
    pageToken: token,
  }),
);

Streaming

Stream real-time agent events over NDJSON:

for await (const event of client.agents.streamEvents({
  organizationId: 'org-123',
  workspaceId: 'ws-456',
  automationId: 'auto-789',
  runId: 'run-001',
  agentId: 'agent-abc',
})) {
  console.log(event);
}

Cancel a stream with an AbortController:

const controller = new AbortController();

for await (const event of client.agents.streamEvents({
  ...scope,
  signal: controller.signal,
})) {
  if (shouldStop(event)) {
    controller.abort();
  }
}

Error handling

All errors extend KognitosError. HTTP errors include status code and API error details:

import {
  ApiError,
  AuthenticationError,
  NotFoundError,
  RateLimitError,
  ConnectionError,
  TimeoutError,
} from '@kognitos/node';

try {
  await client.automations.get({ ... });
} catch (err) {
  if (err instanceof NotFoundError) {
    console.log('Not found:', err.message);
  } else if (err instanceof RateLimitError) {
    console.log('Rate limited, retry after:', err.retryAfter, 'seconds');
  } else if (err instanceof AuthenticationError) {
    console.log('Bad token');
  } else if (err instanceof TimeoutError) {
    console.log('Request timed out');
  } else if (err instanceof ApiError) {
    console.log('API error:', err.status, err.code, err.details);
  }
}

Configuration

const client = new Kognitos({
  token: 'pat_...',          // Required — personal access token
  region: 'us',              // Required — 'us' | 'eu' | 'uk'
  env: 'prod',               // Optional — 'prod' (default) | 'dev'
  timeout: 30000,            // Optional — request timeout in ms (default: 30000)
  retry: {                   // Optional — retry config, or false to disable
    maxRetries: 2,           //   default: 2
    initialDelayMs: 500,     //   default: 500
    maxDelayMs: 5000,        //   default: 5000
  },
});

Per-request overrides:

await client.automations.get(
  { organizationId: 'org-123', workspaceId: 'ws-456', automationId: 'auto-789' },
  { timeout: 5000, retry: false },
);

Resources

| Resource | Methods | |---|---| | client.organizations | list, get, getPreferences, listUsers, getUser, listWorkspaces, listInvitations, countWorkspaceUsers | | client.workspaces | list, get, getPreferences, listUsers, listRoles, listInvitations | | client.automations | list, get, invoke, query, getRevision, listRevisions, getVisualization, addConnections, removeConnections, switchConnections, getConnectionUsage, traceConnectionUsage, deleteConnection, createSchedule, updateSchedule, deleteSchedule, listTriggers, createTrigger, listDefaultInputsHistory | | client.runs | list, get, getEvents, cancel, pause, getAggregates, getDailyAggregates | | client.agents | listEvents, getEvent, sendEvent, cancelGeneration, streamEvents | | client.books | list, listLatest, get, getVersions, getConcepts, getProcedures, search, listWorkspaceBooks, listWorkspaceBookConnections, createWorkspaceBookConnection, updateWorkspaceBookConnection, upgradeWorkspaceBookConnection, createWorkspaceBookConnectionTrigger, getWorkspaceBookConcepts, getWorkspaceBookProcedures, searchWorkspaceBooks, searchWorkspaceConcepts, searchWorkspaceProcedures | | client.connections | list, get, authorize, discover, listDiscoverables, listProcedures, searchProcedures, deleteTriggerInstance, getUserInfo | | client.files | upload, download, delete, getMetadata, generateUploadUrl, generateDownloadUrl | | client.exceptions | list, get, listGroups, countByAutomation, countByGroup, listGuideEntries, getGuideEntry, getExecutionOutputs | | client.triggers | list, addAutomations | | client.analytics | queryInsights, queryAutomationEstimates, queryMetrics, configureAutomationEstimates |

Development

npm install
npm run generate   # Regenerate types from OpenAPI spec
npm run build      # Build CJS + ESM + types
npm run check      # TypeScript type checking
npm run lint       # ESLint + Prettier
npm test           # Run tests

License

MIT