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

@valence-ai/sdk

v0.3.0

Published

SDK for connecting applications to Valence AI for security issues, runtime signals, and optional runtime review flows.

Readme

@valence-ai/sdk

Valence AI SDK for integrating security issue ingestion, local scan uploads, and runtime security signals into the Valence AI control plane.

What it supports

  • Local scan ingestion (runLocalSecurityScan)
  • CI scan ingestion (client.reportFindings)
  • Runtime decision reporting as security issues (createRuntimeFindingHooks, reportRuntimeDecisionFinding)
  • Optional runtime guardrail controls (createToolExecutionGuard, withValenceGuard)

Install

npm install @valence-ai/sdk

Required configuration

Integration requires:

  • Valence API base URL
  • Project API key
  • Project ID
  • Environment (production | staging | sandbox)

Optional:

  • Workspace ID
  • Agent name (mainly for runtime guardrail flows)

Create a client

import { createValenceClient } from '@valence-ai/sdk';

const client = createValenceClient({
  baseUrl: process.env.VALENCE_API_BASE_URL!,
  apiKey: process.env.VALENCE_API_KEY!,
});

Local scan integration

import { runLocalSecurityScan } from '@valence-ai/sdk';

const result = await runLocalSecurityScan(
  {
    baseUrl: process.env.VALENCE_API_BASE_URL!,
    apiKey: process.env.VALENCE_API_KEY!,
  },
  {
    cwd: process.cwd(),
    projectId: process.env.VALENCE_PROJECT_ID!,
    workspaceId: process.env.VALENCE_WORKSPACE_ID,
    environment: process.env.VALENCE_ENVIRONMENT as 'production' | 'staging' | 'sandbox',
    metadata: { sourceLabel: 'Local developer scan' },
  }
);

console.log(`Uploaded ${result.findings.length} security issues`);

Current scan coverage is optimized for high-signal web-app findings, dependency risk from npm audit, and environment/secret misconfiguration patterns.

CI ingestion (bring your own scanner)

await client.reportFindings({
  projectId: process.env.VALENCE_PROJECT_ID!,
  workspaceId: process.env.VALENCE_WORKSPACE_ID,
  environment: process.env.VALENCE_ENVIRONMENT as 'production' | 'staging' | 'sandbox',
  source: 'CI_SCAN',
  findings: ciFindings,
  metadata: {
    branch: process.env.GITHUB_REF_NAME,
    commitSha: process.env.GITHUB_SHA,
  },
});

ciFindings must be mapped to the Valence finding shape before upload.

Runtime security issue reporting

Auto-map runtime decisions to security issues

import {
  createRuntimeFindingHooks,
  createToolExecutionGuard,
} from '@valence-ai/sdk';

const runtimeHooks = createRuntimeFindingHooks(client, {
  minimumRisk: 'HIGH',
});

const guard = createToolExecutionGuard(
  client,
  {
    workspaceId: process.env.VALENCE_WORKSPACE_ID!,
    projectId: process.env.VALENCE_PROJECT_ID!,
    environment: process.env.VALENCE_ENVIRONMENT as 'production' | 'staging' | 'sandbox',
    goal: 'serve customer dashboard',
  },
  runtimeHooks
);

Report a runtime decision directly

import { reportRuntimeDecisionFinding } from '@valence-ai/sdk';

await reportRuntimeDecisionFinding(
  client,
  {
    workspaceId: process.env.VALENCE_WORKSPACE_ID!,
    projectId: process.env.VALENCE_PROJECT_ID!,
    environment: 'production',
    goal: 'export invoices',
    tool: 'billing_export',
    action: 'export',
  },
  {
    decision: 'REQUIRES_APPROVAL',
    reason: 'Billing exports require review in production.',
    risk: 'HIGH',
    latencyMs: 14,
  }
);

Optional runtime guardrail controls

import { withValenceGuard } from '@valence-ai/sdk';

const guardedReadIncident = withValenceGuard(client, {
  workspaceId: process.env.VALENCE_WORKSPACE_ID!,
  projectId: process.env.VALENCE_PROJECT_ID!,
  agentName: process.env.VALENCE_AGENT_NAME!,
  tool: 'read_incident',
  action: 'read',
  environment: 'staging',
  goal: 'resolve_incident',
});

const incident = await guardedReadIncident(async () => readIncident('INC-1421'));

Use this mode only for workflows that need pre-execution allow/block/approval behavior.

Error handling

import {
  ValenceApprovalRequiredError,
  ValenceBlockError,
} from '@valence-ai/sdk';

try {
  await guard.runTool(
    { tool: 'restart_service', action: 'write' },
    async () => restartService('payments-api')
  );
} catch (error) {
  if (error instanceof ValenceApprovalRequiredError) {
    console.log('Approval required', error.approvalId);
  } else if (error instanceof ValenceBlockError) {
    console.log('Blocked', error.message);
  } else {
    throw error;
  }
}

Exports

createValenceClient
runLocalSecurityScan
createRuntimeFindingHooks
reportRuntimeDecisionFinding
buildRuntimeDecisionFinding
createToolExecutionGuard
guardToolExecution
withValenceGuard
ValenceDecisionError
ValenceBlockError
ValenceApprovalRequiredError
isValenceDecisionError