open-index/open-npm huggingface dataset:
npm package: @openleash/cli
Description: CLI for openleash
Latest version: 0.14.0

# @openleash/cli

CLI for [OpenLeash](https://github.com/openleash/openleash) — local-first authorization and proof sidecar for AI agents.

## Installation

```bash
npm install -g @openleash/cli
```

## Quick start

```bash
# Start the server (bootstraps ./data and config.yaml)
openleash start

# Run the interactive setup wizard
openleash wizard

# Test policies with the playground
openleash playground list
openleash playground run small_purchase_allowed
```

## Commands

| Command | Description |
|---------|-------------|
| `openleash start` | Start the server |
| `openleash wizard` | Interactive setup wizard |
| `openleash policy list` | List policies |
| `openleash policy show <id>` | Show policy YAML |
| `openleash policy upsert --owner <id> --file <path>` | Create/update policy |
| `openleash policy validate --file <path>` | Validate policy YAML |
| `openleash playground list` | List scenarios |
| `openleash playground run <name>` | Run a scenario |
| `openleash keys list` | List signing keys |
| `openleash keys rotate` | Rotate signing key |
| `openleash testvectors` | Generate test vectors |

## Documentation

See the [OpenLeash README](https://github.com/openleash/openleash) for full documentation.

## License

[Apache-2.0](https://github.com/openleash/openleash/blob/main/LICENSE)
npm package: @openleash/core
Description: Core authorization engine for openleash
Latest version: 0.14.0

# @openleash/core

Core authorization engine for [OpenLeash](https://github.com/openleash/openleash) — local-first authorization and proof sidecar for AI agents.

## What's included

- **Policy engine** — evaluate agent actions against YAML policies
- **Decision types** — `ALLOW`, `DENY`, `REQUIRE_APPROVAL`, `REQUIRE_STEP_UP`, `REQUIRE_DEPOSIT`
- **PASETO proof tokens** — issue and verify short-lived v4.public tokens
- **Obligations** — attach requirements (human approval, step-up auth, deposits) to decisions
- **State management** — human-readable file-based storage (markdown + YAML)
- **Types** — full TypeScript types for actions, policies, decisions, and tokens

## Installation

```bash
npm install @openleash/core
```

## Usage

This package is used internally by `@openleash/server` and `@openleash/cli`. For agent-side integration, use [`@openleash/sdk-ts`](https://www.npmjs.com/package/@openleash/sdk-ts) instead.

## Documentation

See the [OpenLeash README](https://github.com/openleash/openleash) for full documentation.

## License

[Apache-2.0](https://github.com/openleash/openleash/blob/main/LICENSE)
npm package: @openleash/sdk-ts
Description: TypeScript SDK for openleash
Latest version: 0.6.0

# @openleash/sdk-ts

TypeScript SDK for [OpenLeash](https://github.com/openleash/openleash) — local-first authorization and proof sidecar for AI agents.

Use this package in your agent code to request authorization and verify proof tokens.

## Installation

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

## Register with an invite

```typescript
import { redeemAgentInvite } from '@openleash/sdk-ts';

const agent = await redeemAgentInvite({
  inviteUrl: process.env.OPENLEASH_AGENT_INVITE_URL!,
  agentId: 'my-agent',
});

// agent.openleash_url      — server URL
// agent.agent_principal_id — your ID
// agent.private_key_b64    — your private key (generated locally)
// agent.auth               — signing protocol details
// agent.endpoints          — available API endpoints
```

## Authorize an action

```typescript
import { authorize } from '@openleash/sdk-ts';

const result = await authorize({
  openleashUrl: 'http://127.0.0.1:8787',
  agentId: 'my-agent',
  privateKeyB64: process.env.OPENLEASH_AGENT_PRIVATE_KEY_B64!,
  action: {
    action_id: crypto.randomUUID(),
    action_type: 'purchase',
    requested_at: new Date().toISOString(),
    principal: { agent_id: 'my-agent' },
    subject: { principal_id: '<owner-id>' },
    relying_party: { domain: 'example.com', trust_profile: 'LOW' },
    payload: { amount_minor: 5000, currency: 'USD' },
  },
});

console.log(result.decision); // "ALLOW" | "DENY" | "REQUIRE_APPROVAL" | ...
console.log(result.proof_token); // PASETO v4.public token (if allowed)
```

## Verify a proof offline

```typescript
import { verifyProofOffline } from '@openleash/sdk-ts';

const result = await verifyProofOffline({
  token: proofToken,
  publicKeys: [{ kid: 'key-id', public_key_b64: 'base64...' }],
});

console.log(result.valid, result.claims);
```

## Propose a policy

```typescript
import { createPolicyDraft, getPolicyDraft } from '@openleash/sdk-ts';

// Submit a draft policy for owner review
const draft = await createPolicyDraft({
  openleashUrl: 'http://127.0.0.1:8787',
  agentId: 'my-agent',
  privateKeyB64: process.env.OPENLEASH_AGENT_PRIVATE_KEY_B64!,
  policyYaml: `version: 1
default: deny
rules:
  - id: allow-read
    effect: allow
    action: "data.read"`,
  appliesToAgentPrincipalId: '<your-agent-principal-id>',
  justification: 'Need read access for analytics',
});

// Poll for the owner's decision
const result = await getPolicyDraft({
  openleashUrl: 'http://127.0.0.1:8787',
  agentId: 'my-agent',
  privateKeyB64: process.env.OPENLEASH_AGENT_PRIVATE_KEY_B64!,
  policyDraftId: draft.policy_draft_id,
});

console.log(result.status); // "PENDING" | "APPROVED" | "DENIED"
console.log(result.resulting_policy_id); // UUID if approved
```

## Documentation

See the [OpenLeash README](https://github.com/openleash/openleash) for full documentation.

## License

[Apache-2.0](https://github.com/openleash/openleash/blob/main/LICENSE)
npm package: @openleash/server
Description: HTTP server for openleash
Latest version: 0.14.0

# @openleash/server

HTTP server for [OpenLeash](https://github.com/openleash/openleash) — local-first authorization and proof sidecar for AI agents.

## What's included

- **Fastify HTTP server** on `127.0.0.1:8787`
- **Authorization endpoint** — `POST /v1/authorize`
- **Proof verification** — `POST /v1/verify-proof`
- **Agent registration** — `POST /v1/agents/register`
- **Admin API** — owner management, policy upsert, audit log retrieval
- **Middleware** — agent signature verification, admin auth, request validation
- **Bootstrap** — automatic `./data/` directory and config initialization

## Installation

```bash
npm install @openleash/server
```

## Usage

This package is used internally by `@openleash/cli`. To run the server, use the CLI:

```bash
npx openleash start
```

For agent-side integration, use [`@openleash/sdk-ts`](https://www.npmjs.com/package/@openleash/sdk-ts).

## API Endpoints

| Method | Path | Description |
|--------|------|-------------|
| GET | `/v1/health` | Health check |
| GET | `/v1/public-keys` | Retrieve server public keys |
| POST | `/v1/authorize` | Request authorization decision |
| POST | `/v1/verify-proof` | Verify a proof token |
| POST | `/v1/agents/registration-challenge` | Request registration challenge |
| POST | `/v1/agents/register` | Register a new agent |
| POST | `/v1/admin/owners` | Create owner (admin) |
| POST | `/v1/admin/policies` | Upsert policy (admin) |
| GET | `/v1/admin/audit` | Retrieve audit log (admin) |

## Documentation

See the [OpenLeash README](https://github.com/openleash/openleash) for full documentation.

## License

[Apache-2.0](https://github.com/openleash/openleash/blob/main/LICENSE)