open-index/open-npm huggingface dataset:
npm package: @keylessai/sdk
Description: AI Action Governance Kernel — Every AI action must pass through the Kernel.
Author: KeylessAI, Inc.
Latest version: 0.1.0

# @keylessai/sdk

AI Action Governance Kernel — every AI action must pass through the Kernel.

No direct execution. No bypass. No shortcuts.

## Install

```bash
npm install @keylessai/sdk
```

## Quick start

```typescript
import { KeylessAI } from '@keylessai/sdk';

const keyless = new KeylessAI({
  apiKey: 'ka_live_xxxxx',
  orgId:  'org_xxxxx',
  agentId:'agent_xxxxx',
});

// 1. Simulate first (dry-run)
const sim = await keyless.simulate({
  action: 'ads.budget_increase',
  amount: 5000,
});
console.log(sim.policyDecision); // 'allow' | 'require_approval' | 'deny'

// 2. Execute for real
const result = await keyless.execute({
  action: 'ads.budget_increase',
  amount: 5000,
  target: { campaign: 'camp_abc' },
});

if (result.status === 'awaiting_approval') {
  const approved = await keyless.waitForApproval(result.intentId);
  if (approved) {
    const final = await keyless.resume(result.intentId);
    console.log('Done:', final.executionId);
  }
}

// 3. Query the ledger
const history = await keyless.ledger({ limit: 10 });
console.log(history.summary.total_cost);
```

## API

| Method | Description |
|---|---|
| `execute(input)` | Run a governed action through the full pipeline |
| `simulate(input)` | Dry-run to preview risk score & policy decision |
| `ledger(query?)` | Query the immutable decision ledger |
| `waitForApproval(intentId, opts?)` | Poll until an intent is approved or denied |
| `resume(intentId)` | Execute an already-approved intent |

## How it works

Every call flows through a strict 10-step pipeline:

1. **Intent** — declare what the AI wants to do
2. **Policy** — 7 rules evaluated (permissions, budgets, rate limits, risk)
3. **Approval** — high-value actions routed to humans
4. **Execute** — atomic, once-only execution
5. **Ledger** — immutable audit trail

## Configuration

```typescript
new KeylessAI({
  apiKey: 'ka_live_xxxxx',      // required
  orgId: 'org_xxxxx',           // required
  agentId: 'agent_xxxxx',       // required
  baseUrl: 'https://...',       // default: app.keyless-ai.com/api/v3
  autoPolicy: true,             // $1000+ requires approval
  timeout: 30000,               // request timeout (ms)
  maxRetries: 2,                // retries on transient failures
});
```

## Links

- [Documentation](https://docs.keyless-ai.com)
- [Dashboard](https://app.keyless-ai.com)
- [Website](https://www.keyless-ai.com)

## License

MIT
npm package: @keylightdigital/nexus
Description: TypeScript SDK for Nexus agent observability — the Plausible for AI agents
Author: Keylight Digital LLC
Latest version: 0.1.0

# @keylightdigital/nexus

TypeScript SDK for [Nexus](https://nexus.keylightdigital.dev) — simple, affordable agent observability for indie developers.

## Installation

```bash
npm install @keylightdigital/nexus
```

## Quickstart

```typescript
import { NexusClient } from '@keylightdigital/nexus'

const nexus = new NexusClient({ apiKey: 'nxs_...', agentId: 'my-assistant' })

const trace = await nexus.startTrace({ name: 'process-invoice' })

await trace.addSpan({ name: 'extract-data', output: { invoice_id: '123' } })
await trace.addSpan({ name: 'call-gpt-4o', input: prompt, output: result })

await trace.end({ status: 'success' })
```

## Configuration

| Option | Type | Required | Default |
|--------|------|----------|---------|
| `apiKey` | `string` | Yes | — |
| `agentId` | `string` | Yes | — |
| `baseUrl` | `string` | No | `https://nexus.keylightdigital.dev` |

## API

### `NexusClient`

```typescript
const nexus = new NexusClient({ apiKey, agentId, baseUrl? })
await nexus.startTrace({ name, metadata? }) → Trace
```

### `Trace`

```typescript
trace.trace_id                              // UUID assigned by the server
await trace.addSpan({ name, input?, output?, error? }) → Span
await trace.end({ status })                 // status: 'success' | 'error' | 'timeout'
```

### `Span`

```typescript
span.span_id   // UUID assigned by the server
span.name      // span name
span.startedAt // Date captured at time of addSpan() call
```

## Error Handling

All SDK methods are non-throwing. Network errors and API errors are logged to `console.error` with a `[Nexus]` prefix. Your agent continues running even if Nexus is unavailable.

## Dashboard

Create API keys and view your traces at [nexus.keylightdigital.dev](https://nexus.keylightdigital.dev).
npm package: @keyloom/adapters
Description: Database adapters for Keyloom (Prisma, etc.)
Author: Keyloom Contributors
Latest version: 3.1.3

# @keyloom/adapters

Consolidated database adapters for Keyloom. Start with Prisma:

## Installation

```bash
npm install @keyloom/adapters @prisma/client prisma
# or
pnpm add @keyloom/adapters @prisma/client prisma
```

## Quick Start (Prisma)

```ts
import { PrismaAdapter } from "@keyloom/adapters";
import { PrismaClient } from "@prisma/client";

const prisma = new PrismaClient();

export default {
  adapter: PrismaAdapter(prisma),
  // ...
};
```

See SCHEMA.md in this package for the reference Prisma schema.
npm package: @keyloom/cli
Description: Keyloom command-line tools: init, migrate, routes, doctor
Latest version: 3.1.3

# @keyloom/cli

Professional CLI for initializing and maintaining a Keyloom authentication setup.

## Install

The CLI is shipped with the monorepo and published as a package. In app repos, install locally and use with npx/pnpm dlx:

```bash
pnpm add -D @keyloom/cli
npx keyloom init
```

Or invoke via node if running from a cloned monorepo build:

```bash
node ./packages/cli/dist/keyloom.js --help
```

## Commands

### `keyloom init`
Interactive wizard that sets up a production‑ready auth baseline.

What it does:
- Detects project type (Next.js App/Pages Router) and TypeScript
- Installs required deps (uses your package manager)
- Generates `keyloom.config.(ts|js)` with your choices
- Scaffolds API handler and middleware
- Writes `.env.example` including `AUTH_SECRET`, `DATABASE_URL`, and provider vars
- Generates migration artifacts for your chosen adapter
- Runs `keyloom routes` to create the initial route manifest

Useful flags:
- `--yes` non‑interactive defaults
- `--adapter <prisma|drizzle-pg|drizzle-mysql|postgres|mysql2|mongo>`
- `--providers <github,google,discord,...>`
- `--cwd <path>` to target a different project directory

### `keyloom routes`
Scans your project for Keyloom routes and produces a manifest used by the doctor and tooling.

```bash
keyloom routes --cwd .
```

Outputs:
- `.keyloom/routes.generated.ts`
- `.keyloom/routes.generated.json`

### `keyloom doctor`
Runs environment and configuration checks with actionable guidance.

Checks include:
- Required env vars (AUTH_SECRET, provider secrets, etc.)
- Cookie settings and JWT/DB session configuration
- Presence of route manifest and scaffolded files
- Package versions and known pitfalls

```bash
keyloom doctor --cwd .
```

### `keyloom generate`
Generates database artifacts (DDL/files) for the selected adapter without applying them.

```bash
keyloom generate --cwd .
```

### `keyloom migrate`
Generates artifacts and then runs the adapter’s migration tool when available.

```bash
# Prisma example
keyloom migrate --cwd .
# Drizzle example
keyloom migrate --cwd .
```

## Exit codes
- 0 on success
- Non‑zero when an operation fails (installation, generation, or validation)

## Troubleshooting
- Re‑run with `--cwd` if working in a subdirectory
- If dependency installation fails, the CLI prints the exact manual command
- For Prisma, ensure `DATABASE_URL` is set and `prisma` is installed

## License
MIT
npm package: @keyloom/react
Description: React hooks and utilities for Keyloom authentication (sessions, login, OAuth, and plugins)
Latest version: 3.1.2

# @keyloom/react

React hooks and utilities for Keyloom authentication with automatic CSRF, session management, and SSR safety.

Quick start:

```tsx
import { SessionProvider, useLogin, useSession } from "@keyloom/react";

export function App({ children }) {
  return <SessionProvider>{children}</SessionProvider>;
}

export function LoginButton() {
  const { login, loading } = useLogin();
  return (
    <button disabled={loading} onClick={() => login({ email: "a@b.co", password: "pw" })}>
      Sign in
    </button>
  );
}

export function UserInfo() {
  const { data, status } = useSession();
  if (status === "loading") return <p>Loading…</p>;
  if (!data.user) return <p>Signed out</p>;
  return <pre>{JSON.stringify(data.user, null, 2)}</pre>;
}
```