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

@trycomp/compound-sdk

v0.1.4

Published

TypeScript SDK for the Comp AI API.

Readme

@trycomp/compound-sdk

Developer-friendly & type-safe Typescript SDK specifically catered to leverage @trycomp/compound-sdk API.

Built by Speakeasy License: MIT

[!IMPORTANT] This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.

Summary

Table of Contents

SDK Installation

The SDK can be installed with either npm, pnpm, bun or yarn package managers.

NPM

npm add @trycomp/compound-sdk

PNPM

pnpm add @trycomp/compound-sdk

Bun

bun add @trycomp/compound-sdk

Yarn

yarn add @trycomp/compound-sdk

[!NOTE] This package is published as an ES Module (ESM) only. For applications using CommonJS, use await import("@trycomp/compound-sdk") to import and use this package.

Requirements

For supported JavaScript runtimes, please consult RUNTIMES.md.

SDK Example Usage

Example

import { Compai } from "@trycomp/compound-sdk";

const compai = new Compai({
  bearerAuth: process.env["COMP_AI_BEARER_AUTH"] ?? "",
});

async function run() {
  const result = await compai.activity.addComment({
    args: {
      body: "<value>",
      orgId: "<id>",
      subjectId: "<id>",
      subjectType: "repository",
    },
  });

  console.log(result);
}

run();

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

| Name | Type | Scheme | Environment Variable | | ------------ | ---- | ----------- | --------------------- | | bearerAuth | http | HTTP Bearer | COMP_AI_BEARER_AUTH |

To authenticate with the API the bearerAuth parameter must be set when initializing the SDK client instance. For example:

import { Compai } from "@trycomp/compound-sdk";

const compai = new Compai({
  bearerAuth: process.env["COMP_AI_BEARER_AUTH"] ?? "",
});

async function run() {
  const result = await compai.activity.addComment({
    args: {
      body: "<value>",
      orgId: "<id>",
      subjectId: "<id>",
      subjectType: "repository",
    },
  });

  console.log(result);
}

run();

Available Resources and Operations

Activity

Admin

ApiKeys

  • listForOrg - Calls a query at the path modules/apiKeys.js:listForOrg

Auth

CloudInfrastructure.Connections

  • disconnectAll - Calls a mutation at the path modules/cloudInfrastructure/connections.js:disconnectAll
  • disconnectAws - Calls a mutation at the path modules/cloudInfrastructure/connections.js:disconnectAws
  • disconnectConnection - Calls a mutation at the path modules/cloudInfrastructure/connections.js:disconnectConnection
  • getById - Calls a query at the path modules/cloudInfrastructure/connections.js:getById
  • getForOrg - Calls a query at the path modules/cloudInfrastructure/connections.js:getForOrg
  • listForOrg - Calls a query at the path modules/cloudInfrastructure/connections.js:listForOrg
  • listForOrgWithStats - Calls a query at the path modules/cloudInfrastructure/connections.js:listForOrgWithStats
  • setGithubScope - Calls a mutation at the path modules/cloudInfrastructure/connections.js:setGithubScope
  • setLabel - Calls a mutation at the path modules/cloudInfrastructure/connections.js:setLabel

CloudInfrastructure.Mutelist

  • listForConnection - Calls a query at the path modules/cloudInfrastructure/mutelist.js:listForConnection
  • listForOrg - Calls a query at the path modules/cloudInfrastructure/mutelist.js:listForOrg
  • listSuppressionOptions - Calls a query at the path modules/cloudInfrastructure/mutelist.js:listSuppressionOptions
  • removeEntry - Calls a mutation at the path modules/cloudInfrastructure/mutelist.js:removeEntry
  • setEnabled - Calls a mutation at the path modules/cloudInfrastructure/mutelist.js:setEnabled
  • upsertEntry - Calls a mutation at the path modules/cloudInfrastructure/mutelist.js:upsertEntry

CloudInfrastructure.Profiles

  • create - Calls a mutation at the path modules/cloudInfrastructure/profiles.js:create
  • getById - Calls a query at the path modules/cloudInfrastructure/profiles.js:getById
  • listForConnection - Calls a query at the path modules/cloudInfrastructure/profiles.js:listForConnection
  • listForOrg - Calls a query at the path modules/cloudInfrastructure/profiles.js:listForOrg
  • remove - Calls a mutation at the path modules/cloudInfrastructure/profiles.js:remove
  • setEnabled - Calls a mutation at the path modules/cloudInfrastructure/profiles.js:setEnabled
  • update - Calls a mutation at the path modules/cloudInfrastructure/profiles.js:update

CloudInfrastructure.Settings

  • getForOrg - Calls a query at the path modules/cloudInfrastructure/settings.js:getForOrg
  • update - Calls a mutation at the path modules/cloudInfrastructure/settings.js:update

CloudInfrastructure.Verify

CloudInfrastructure.VerifyGithub

CloudInfrastructure.VerifyKubernetes

CloudTests.Findings

  • getById - Calls a query at the path modules/cloudTests/findings.js:getById
  • listForConnection - Calls a query at the path modules/cloudTests/findings.js:listForConnection
  • listForOrg - Calls a query at the path modules/cloudTests/findings.js:listForOrg
  • listOpenChecks - Calls a query at the path modules/cloudTests/findings.js:listOpenChecks
  • setAssignee - Calls a mutation at the path modules/cloudTests/findings.js:setAssignee
  • setStatus - Calls a mutation at the path modules/cloudTests/findings.js:setStatus

CloudTests.Metrics

  • getOverview - Calls a query at the path modules/cloudTests/metrics.js:getOverview

CloudTests.Remediation

  • generateForFinding - Calls a action at the path modules/cloudTests/remediation.js:generateForFinding

CloudTests.Scans

  • listRunsForOrg - Calls a query at the path modules/cloudTests/scans.js:listRunsForOrg
  • listRunsForConnection - Calls a query at the path modules/cloudTests/scans.js:listRunsForConnection
  • getRunById - Calls a query at the path modules/cloudTests/scans.js:getRunById
  • listEventsForRun - Calls a query at the path modules/cloudTests/scans.js:listEventsForRun
  • runForConnection - Calls a mutation at the path modules/cloudTests/scans.js:runForConnection

CodeSecurity.AiPentests

  • listProjects - Calls a query at the path modules/codeSecurity/aiPentests.js:listProjects
  • getProject - Calls a query at the path modules/codeSecurity/aiPentests.js:getProject
  • listRunsForProject - Calls a query at the path modules/codeSecurity/aiPentests.js:listRunsForProject
  • listEventsForRun - Calls a query at the path modules/codeSecurity/aiPentests.js:listEventsForRun
  • listFindingsForRun - Calls a query at the path modules/codeSecurity/aiPentests.js:listFindingsForRun
  • listSecretsForProject - Calls a query at the path modules/codeSecurity/aiPentests.js:listSecretsForProject
  • createProject - Calls a mutation at the path modules/codeSecurity/aiPentests.js:createProject
  • saveDraft - Calls a mutation at the path modules/codeSecurity/aiPentests.js:saveDraft
  • createRunFromDraft - Calls a mutation at the path modules/codeSecurity/aiPentests.js:createRunFromDraft
  • restartFailedRun - Calls a mutation at the path modules/codeSecurity/aiPentests.js:restartFailedRun
  • generateUploadUrl - Calls a mutation at the path modules/codeSecurity/aiPentests.js:generateUploadUrl
  • checkConnectivity - Calls a action at the path modules/codeSecurity/aiPentests.js:checkConnectivity

CodeSecurity.Autofix

  • createFixPullRequest - Calls a action at the path modules/codeSecurity/autofix.js:createFixPullRequest
  • getRegenStatus - Calls a query at the path modules/codeSecurity/autofix.js:getRegenStatus

CodeSecurity.DeepSecurityAudit

  • queueAudit - Calls a action at the path modules/codeSecurity/deepSecurityAudit.js:queueAudit
  • latestForRepo - Calls a query at the path modules/codeSecurity/deepSecurityAudit.js:latestForRepo
  • listEventsForRun - Calls a query at the path modules/codeSecurity/deepSecurityAudit.js:listEventsForRun

CodeSecurity.DepScanner

  • latestForRepo - Calls a query at the path modules/codeSecurity/depScanner.js:latestForRepo
  • listEventsForRun - Calls a query at the path modules/codeSecurity/depScanner.js:listEventsForRun
  • queueDepScan - Calls a action at the path modules/codeSecurity/depScanner.js:queueDepScan

CodeSecurity.Findings

  • getById - Calls a query at the path modules/codeSecurity/findings.js:getById
  • listForRepo - Calls a query at the path modules/codeSecurity/findings.js:listForRepo
  • listOpenForOrg - Calls a query at the path modules/codeSecurity/findings.js:listOpenForOrg
  • setAssignee - Calls a mutation at the path modules/codeSecurity/findings.js:setAssignee
  • setStatus - Calls a mutation at the path modules/codeSecurity/findings.js:setStatus

CodeSecurity.Metrics

  • getOverview - Calls a query at the path modules/codeSecurity/metrics.js:getOverview

CodeSecurity.Repositories

  • listForOrg - Calls a query at the path modules/codeSecurity/repositories.js:listForOrg
  • listForOrgWithStats - Calls a query at the path modules/codeSecurity/repositories.js:listForOrgWithStats
  • getById - Calls a query at the path modules/codeSecurity/repositories.js:getById
  • setContextNotes - Calls a mutation at the path modules/codeSecurity/repositories.js:setContextNotes
  • updateScanSettings - Calls a mutation at the path modules/codeSecurity/repositories.js:updateScanSettings

CodeSecurity.Reviewer

  • listForOrg - Calls a query at the path modules/codeSecurity/reviewer.js:listForOrg
  • getById - Calls a query at the path modules/codeSecurity/reviewer.js:getById
  • getRunBySha - Calls a query at the path modules/codeSecurity/reviewer.js:getRunBySha
  • getFindingById - Calls a query at the path modules/codeSecurity/reviewer.js:getFindingById
  • setFindingStatus - Calls a mutation at the path modules/codeSecurity/reviewer.js:setFindingStatus
  • listEvents - Calls a query at the path modules/codeSecurity/reviewer.js:listEvents
  • listStepStates - Calls a query at the path modules/codeSecurity/reviewer.js:listStepStates
  • rerunReview - Calls a action at the path modules/codeSecurity/reviewer.js:rerunReview

CodeSecurity.ReviewRules

  • listForOrg - Calls a query at the path modules/codeSecurity/reviewRules.js:listForOrg
  • listForRepo - Calls a query at the path modules/codeSecurity/reviewRules.js:listForRepo
  • create - Calls a mutation at the path modules/codeSecurity/reviewRules.js:create
  • update - Calls a mutation at the path modules/codeSecurity/reviewRules.js:update
  • setEnabled - Calls a mutation at the path modules/codeSecurity/reviewRules.js:setEnabled
  • remove - Calls a mutation at the path modules/codeSecurity/reviewRules.js:remove
  • setOrgRuleDisabledForRepo - Calls a mutation at the path modules/codeSecurity/reviewRules.js:setOrgRuleDisabledForRepo

CodeSecurity.Scan

  • scanRepository - Calls a action at the path modules/codeSecurity/scan.js:scanRepository
  • enqueueInitialScans - Calls a action at the path modules/codeSecurity/scan.js:enqueueInitialScans

Compliance.Library

Compliance.OrgControls

  • listForOrg - Calls a query at the path compliance/orgControls.js:listForOrg
  • getById - Calls a query at the path compliance/orgControls.js:getById
  • countByStatus - Calls a query at the path compliance/orgControls.js:countByStatus

Compliance.OrgFrameworks

  • listForOrg - Calls a query at the path compliance/orgFrameworks.js:listForOrg
  • adopt - Calls a mutation at the path compliance/orgFrameworks.js:adopt

Devices.Devices

  • listForOrg - Calls a query at the path modules/devices/devices.js:listForOrg
  • orderDevice - Calls a mutation at the path modules/devices/devices.js:orderDevice

Devices.Policies

  • listForOrg - Calls a query at the path modules/devices/policies.js:listForOrg
  • upsert - Calls a mutation at the path modules/devices/policies.js:upsert

Entitlements

  • getMyMembership - Calls a query at the path entitlements.js:getMyMembership
  • getForOrg - Calls a query at the path entitlements.js:getForOrg
  • hasModuleForOrg - Calls a query at the path entitlements.js:hasModuleForOrg
  • grantManual - Calls a mutation at the path entitlements.js:grantManual

Evidence.Evidence

  • listForOrg - Calls a query at the path evidence/evidence.js:listForOrg
  • generateUploadUrl - Calls a mutation at the path evidence/evidence.js:generateUploadUrl
  • attach - Calls a mutation at the path evidence/evidence.js:attach

Integrations.Github.Actions

  • setRepositoryScope - Calls a action at the path integrations/github/actions.js:setRepositoryScope
  • listInstallationRepos - Calls a action at the path integrations/github/actions.js:listInstallationRepos

Integrations.Github.Connect

  • buildInstallUrl - Calls a action at the path integrations/github/connect.js:buildInstallUrl
  • getOrgSlugByInstallation - Calls a query at the path integrations/github/connect.js:getOrgSlugByInstallation
  • completeInstall - Calls a action at the path integrations/github/connect.js:completeInstall

Integrations.Github.DispatchWebhook

  • verifyAndDispatch - Calls a action at the path integrations/github/dispatchWebhook.js:verifyAndDispatch

Integrations.Github.Mutations

  • updateConfig - Calls a mutation at the path integrations/github/mutations.js:updateConfig
  • disconnect - Calls a mutation at the path integrations/github/mutations.js:disconnect
  • clearRepositories - Calls a mutation at the path integrations/github/mutations.js:clearRepositories

Integrations.Github.Queries

  • getForOrg - Calls a query at the path integrations/github/queries.js:getForOrg

Integrations.GoogleWorkspace.Connect

  • startOAuth - Calls a action at the path integrations/googleWorkspace/connect.js:startOAuth
  • completeCallback - Calls a action at the path integrations/googleWorkspace/connect.js:completeCallback

Integrations.GoogleWorkspace.Queries

  • getForOrg - Calls a query at the path integrations/googleWorkspace/queries.js:getForOrg

Integrations.List

  • listForOrg - Calls a query at the path integrations/list.js:listForOrg

Onboarding

  • getForOrg - Calls a query at the path onboarding.js:getForOrg
  • markDone - Calls a mutation at the path onboarding.js:markDone
  • undo - Calls a mutation at the path onboarding.js:undo
  • dismiss - Calls a mutation at the path onboarding.js:dismiss
  • restore - Calls a mutation at the path onboarding.js:restore
  • isModuleOnboarded - Calls a query at the path onboarding.js:isModuleOnboarded
  • modulesOnboardedForOrg - Calls a query at the path onboarding.js:modulesOnboardedForOrg

Orgs

Policies.Policies

  • listForOrg - Calls a query at the path policies/policies.js:listForOrg
  • getById - Calls a query at the path policies/policies.js:getById
  • saveVersion - Calls a mutation at the path policies/policies.js:saveVersion
  • publish - Calls a mutation at the path policies/policies.js:publish
  • retire - Calls a mutation at the path policies/policies.js:retire

Policies.Versions

  • listForPolicy - Calls a query at the path policies/versions.js:listForPolicy

Portal

Quotes

  • listForOrg - Calls a query at the path quotes.js:listForOrg
  • getById - Calls a query at the path quotes.js:getById
  • adminListForOrg - Calls a query at the path quotes.js:adminListForOrg
  • create - Calls a action at the path quotes.js:create
  • startCheckout - Calls a action at the path quotes.js:startCheckout
  • cancel - Calls a mutation at the path quotes.js:cancel

Stripe

Tasks.Tasks

  • listForOrg - Calls a query at the path tasks/tasks.js:listForOrg
  • getById - Calls a query at the path tasks/tasks.js:getById
  • markComplete - Calls a mutation at the path tasks/tasks.js:markComplete
  • reopen - Calls a mutation at the path tasks/tasks.js:reopen
  • assign - Calls a mutation at the path tasks/tasks.js:assign

Standalone functions

All the methods listed above are available as standalone functions. These functions are ideal for use in applications running in the browser, serverless runtimes or other environments where application bundle size is a primary concern. When using a bundler to build your application, all unused functionality will be either excluded from the final bundle or tree-shaken away.

To read more about standalone functions, check FUNCTIONS.md.

Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:

import { Compai } from "@trycomp/compound-sdk";

const compai = new Compai({
  bearerAuth: process.env["COMP_AI_BEARER_AUTH"] ?? "",
});

async function run() {
  const result = await compai.activity.addComment({
    args: {
      body: "<value>",
      orgId: "<id>",
      subjectId: "<id>",
      subjectType: "repository",
    },
  }, {
    retries: {
      strategy: "backoff",
      backoff: {
        initialInterval: 1,
        maxInterval: 50,
        exponent: 1.1,
        maxElapsedTime: 100,
      },
      retryConnectionErrors: false,
    },
  });

  console.log(result);
}

run();

If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:

import { Compai } from "@trycomp/compound-sdk";

const compai = new Compai({
  retryConfig: {
    strategy: "backoff",
    backoff: {
      initialInterval: 1,
      maxInterval: 50,
      exponent: 1.1,
      maxElapsedTime: 100,
    },
    retryConnectionErrors: false,
  },
  bearerAuth: process.env["COMP_AI_BEARER_AUTH"] ?? "",
});

async function run() {
  const result = await compai.activity.addComment({
    args: {
      body: "<value>",
      orgId: "<id>",
      subjectId: "<id>",
      subjectType: "repository",
    },
  });

  console.log(result);
}

run();

Error Handling

CompaiError is the base class for all HTTP error responses. It has the following properties:

| Property | Type | Description | | ------------------- | ---------- | --------------------------------------------------------------------------------------- | | error.message | string | Error message | | error.statusCode | number | HTTP response status code eg 404 | | error.headers | Headers | HTTP response headers | | error.body | string | HTTP body. Can be empty string if no body is returned. | | error.rawResponse | Response | Raw HTTP response | | error.data$ | | Optional. Some errors may contain structured data. See Error Classes. |

Example

import { Compai } from "@trycomp/compound-sdk";
import * as errors from "@trycomp/compound-sdk/models/errors";

const compai = new Compai({
  bearerAuth: process.env["COMP_AI_BEARER_AUTH"] ?? "",
});

async function run() {
  try {
    const result = await compai.activity.addComment({
      args: {
        body: "<value>",
        orgId: "<id>",
        subjectId: "<id>",
        subjectType: "repository",
      },
    });

    console.log(result);
  } catch (error) {
    // The base class for HTTP error responses
    if (error instanceof errors.CompaiError) {
      console.log(error.message);
      console.log(error.statusCode);
      console.log(error.body);
      console.log(error.headers);

      // Depending on the method different errors may be thrown
      if (error instanceof errors.FailedResponseError) {
      }
    }
  }
}

run();

Error Classes

Primary errors:

Network errors:

Inherit from CompaiError:

  • ResponseValidationError: Type mismatch between the data returned from the server and the structure expected by the SDK. See error.rawValue for the raw value and error.pretty() for a nicely formatted multi-line string.

Server Selection

Override Server URL Per-Client

The default server can be overridden globally by passing a URL to the serverURL: string optional parameter when initializing the SDK client instance. For example:

import { Compai } from "@trycomp/compound-sdk";

const compai = new Compai({
  serverURL: "https://fleet-sparrow-75.convex.cloud",
  bearerAuth: process.env["COMP_AI_BEARER_AUTH"] ?? "",
});

async function run() {
  const result = await compai.activity.addComment({
    args: {
      body: "<value>",
      orgId: "<id>",
      subjectId: "<id>",
      subjectType: "repository",
    },
  });

  console.log(result);
}

run();

Custom HTTP Client

The TypeScript SDK makes API calls using an HTTPClient that wraps the native Fetch API. This client is a thin wrapper around fetch and provides the ability to attach hooks around the request lifecycle that can be used to modify the request or handle errors and response.

The HTTPClient constructor takes an optional fetcher argument that can be used to integrate a third-party HTTP client or when writing tests to mock out the HTTP client and feed in fixtures.

The following example shows how to:

  • route requests through a proxy server using undici's ProxyAgent
  • use the "beforeRequest" hook to add a custom header and a timeout to requests
  • use the "requestError" hook to log errors
import { Compai } from "@trycomp/compound-sdk";
import { ProxyAgent } from "undici";
import { HTTPClient } from "@trycomp/compound-sdk/lib/http";

const dispatcher = new ProxyAgent("http://proxy.example.com:8080");

const httpClient = new HTTPClient({
  // 'fetcher' takes a function that has the same signature as native 'fetch'.
  fetcher: (input, init) =>
    // 'dispatcher' is specific to undici and not part of the standard Fetch API.
    fetch(input, { ...init, dispatcher } as RequestInit),
});

httpClient.addHook("beforeRequest", (request) => {
  const nextRequest = new Request(request, {
    signal: request.signal || AbortSignal.timeout(5000)
  });

  nextRequest.headers.set("x-custom-header", "custom value");

  return nextRequest;
});

httpClient.addHook("requestError", (error, request) => {
  console.group("Request Error");
  console.log("Reason:", `${error}`);
  console.log("Endpoint