open-index/open-npm huggingface dataset:
npm package: @fuzentry/sdk-ts
Description: TypeScript SDK for Fuzentry AI governance API — pre-execution enforcement, immutable audit trails, folder-scoped isolation
Author: Fuzentry
Latest version: 1.0.3

# @fuzentry/sdk-ts

TypeScript SDK for the Fuzentry AI governance platform.

Fuzentry enforces compliance policy **before** your AI calls execute — not after. Every execution produces an immutable, cryptographically signed audit record.

> **Access:** This package is private. Install requires an npm token issued with your Fuzentry subscription.

---

## Installation

```bash
npm install @fuzentry/sdk-ts
```

Set your credentials:

```bash
export FUZENTRY_API_KEY=your_api_key
export FUZENTRY_BASE_URL=https://api.tailoringtechforward.net
```

---

## Quick Start

```typescript
import { FuzentryClient, GovernanceError } from '@fuzentry/sdk-ts';

const fuzentry = new FuzentryClient({
  apiKey: process.env.FUZENTRY_API_KEY,
});

try {
  const result = await fuzentry.execute({
    surface: 'MODEL',
    context: {
      tenantId: req.tenant.id,        // from your JWT middleware
      folderId: req.body.accountId,   // from your request body
      actorId:  req.user.sub,         // from your JWT sub claim
      intent:   'loan-decision',      // declared once at the call site
    },
    input: applicantData,
    handler: (input) => callOpenAI(input),
  });

  return res.json(result.output);

} catch (err) {
  if (err instanceof GovernanceError) {
    // Policy denied — audit record already written
    return res.status(403).json({ denied: true, reason: err.reason });
  }
  throw err;
}
```

---

## Core Concepts

### ExecutionContext — 4 Required Fields

| Field | Source | Changes per request? |
|---|---|---|
| `tenantId` | JWT claim | Yes |
| `folderId` | Request body | Yes |
| `actorId` | JWT `sub` | Yes |
| `intent` | Hardcoded at call site | **No** |

`intent` is declared once when you write the wrapper function. It is the governance label for what that code does — never computed from request data.

### Surfaces

Every AI operation is governed at one of seven surfaces:
`AUTH` → `PROMPTS` → `MODEL` → `MEMORY` → `TOOL` → `PLUGIN` → `EXPORT`

### Enforcement Modes

| Mode | Behavior |
|---|---|
| `OBSERVE` | Policy evaluates, violations logged, execution proceeds |
| `SHADOW` | Policy evaluates, hypothetical denial proof generated, execution proceeds |
| `ENFORCE` | Policy evaluates, violations **block** execution, audit record written |

---

## API Reference

### `fuzentry.execute(params)`
Execute a governed AI operation. Handler only invoked on `ALLOW`. Audit record written regardless.

### `fuzentry.queryAuditRecords(params)`
Query governance decisions by tenant, folder, intent, or surface.

### `fuzentry.getDenialProof(auditRecordId)`
Retrieve a cryptographic denial proof for compliance evidence.

### `fuzentry.ping()`
Verify API key and tenant connectivity. Call this during integration setup.

---

## Support

For design partner integration support: **support@tailoringtechforward.net**