open-index/open-npm huggingface dataset:
npm package: @proceedgate/node
Description: Framework-agnostic Node.js SDK for integrating ProceedGate (Governor) into any agent loop.
Latest version: 0.1.0

# @proceedgate/node

Framework-agnostic Node.js SDK for integrating ProceedGate (Governor) into any agent loop.

## Install

```bash
npm i @proceedgate/node
```

## Quick start

```ts
import { createProceedGateClient, requireGateStepOk } from '@proceedgate/node';

const client = createProceedGateClient({
  baseUrl: 'https://governor.proceedgate.dev',
  actor: { id: 'service:agent-runner', project: 'demo' },
});

await requireGateStepOk(client, {
  policyId: 'retry_friction_v1',
  action: 'retry',
  context: { attempt_in_window: 3, window_seconds: 60, tool: 'model' },
  // Non-interactive demo mode:
  txHash: process.env.PROCEEDGATE_TX_HASH,
});

// Typical catch pattern (no regrets v1):
// import { ProceedGateFrictionError } from '@proceedgate/node';
// try { ... } catch (e) {
//   if (e instanceof ProceedGateFrictionError) {
//     console.log('Decision blocked:', e.decisionId);
//     console.log('Friction:', e.friction);
//     console.log('Stable code:', e.code);
//   } else {
//     throw e;
//   }
// }

// If you need raw payloads for debugging/observability:
// import { requireGateStepOkWithRaw } from '@proceedgate/node';
```

See ../../INTEGRATION.md for end-to-end examples.
npm package: @proceedgate/vercel-ai
Description: Vercel AI SDK integration for ProceedGate cost governance
Author: ProceedGate
Latest version: 1.0.0

# @proceedgate/vercel-ai

Vercel AI SDK integration for ProceedGate cost governance. Gates LLM calls and tool invocations with retry storm detection and budget enforcement on BNB Chain.

## Install

```bash
npm i @proceedgate/vercel-ai
```

## Middleware (recommended)

Wrap your language model with ProceedGate governance:

```ts
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { proceedGateMiddleware } from '@proceedgate/vercel-ai';
import { wrapLanguageModel } from 'ai';

const model = wrapLanguageModel({
  model: openai('gpt-4o'),
  middleware: proceedGateMiddleware({
    apiKey: process.env.PG_KEY!,
    workspaceId: 'my-workspace',
  }),
});

// Every call is now gated
const result = await generateText({
  model,
  prompt: 'Analyze this data...',
});
```

## Tool gating

Gate individual tools:

```ts
import { tool } from 'ai';
import { z } from 'zod';
import { gatedTool } from '@proceedgate/vercel-ai';

const gate = gatedTool({
  apiKey: process.env.PG_KEY!,
  workspaceId: 'my-workspace',
});

const searchTool = gate(
  tool({
    description: 'Search the web',
    parameters: z.object({ query: z.string() }),
    execute: async ({ query }) => {
      return await fetch(`https://api.example.com/search?q=${query}`).then(r => r.json());
    },
  }),
  { costEstimate: 0.01 }
);
```

## Higher-order wrapper

Wrap any async function:

```ts
import { generateText } from 'ai';
import { withProceedGate } from '@proceedgate/vercel-ai';

const gate = withProceedGate({
  apiKey: process.env.PG_KEY!,
  workspaceId: 'my-workspace',
  maxBudget: 5.00, // $5 max
});

const result = await gate(
  () => generateText({ model: openai('gpt-4o'), prompt: 'Hello' })
);
// result._proceedgate.cost — cumulative cost tracked
```

## Configuration

```ts
proceedGateMiddleware({
  apiKey: 'pg_ws_...',           // Required: API key
  workspaceId: 'my-workspace',    // Required: workspace ID
  baseUrl: 'https://governor.proceedgate.dev', // Optional: API endpoint
  policyId: 'retry_friction_v1', // Optional: governance policy
  agentId: 'my-agent',           // Optional: agent identifier
  onFriction: 'block',           // 'block' (throw) or 'warn' (log + continue)
  maxBudget: 10.00,              // Optional: max USD budget
});
```

## Error handling

```ts
import { ProceedGateFrictionError } from '@proceedgate/vercel-ai';

try {
  await generateText({ model, prompt: '...' });
} catch (e) {
  if (e instanceof ProceedGateFrictionError) {
    console.log('Blocked:', e.decisionId);
    console.log('Friction:', e.friction); // { price, reason, chain }
  }
}
```

## Related packages

- `@proceedgate/node` — Framework-agnostic Node.js SDK
- `@proceedgate/langchain` — LangChain integration
- `@proceedgate/mcp-server` — MCP server for Claude Code

## Links

- Docs: https://proceedgate.dev/docs.html
- API: https://governor.proceedgate.dev
- Dashboard: https://proceedgate.dev/dashboard.html