open-index/open-npm huggingface dataset:
npm package: @orrin-ai/client
Description: MCP agent with session management and SSE streaming support
Latest version: 0.1.0

# Orrin AI

AI session management with streaming SSE support for Next.js applications.

## Installation

```bash
npm install orrin-ai
```

## Quick Start

### Setting up with Next.js API Route

```typescript
// app/api/ai/route.ts
import { NextOrrinAi, NextOrrinAiOptions, InMemoryDatabaseAdapter } from 'orrin-ai';
import yourLLMAdapter from './your-llm-adapter';

// Configure the OrrinAI client
const options = NextOrrinAiOptions({
  llmAdapter: yourLLMAdapter,
  databaseAdapter: new InMemoryDatabaseAdapter()
});

// Create and export the API route handler
const handler = NextOrrinAi(options);
export { handler as POST };
```

### Creating a Session

```typescript
// In your application logic
const response = await fetch('/api/ai/session', {
  method: 'POST'
});
const { sessionId } = await response.json();
```

### Sending a Message

```typescript
// Set up SSE connection
const eventSource = new EventSource(`/api/ai?sessionId=${sessionId}`);

// Listen for streamed responses
eventSource.addEventListener('text_delta', (event) => {
  const data = JSON.parse(event.data);
  console.log('Received text:', data.delta);
});

// Send message
await fetch('/api/ai', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    sessionId,
    message: 'Hello, how can you help me today?'
  })
});
```

## Features

- Session-based conversation management
- Streaming responses with Server-Sent Events (SSE)
- Tool calling support
- Support for thinking state
- Easy integration with Next.js API routes
- In-memory database adapter included
- Extensible for custom LLM adapters

## Documentation

For more detailed documentation, please refer to our [GitHub repository](link-to-your-repo).

## License

MIT
npm package: @orrin-ai/database-adapter-in-memory
Description: In-memory database adapter for MCP agent
Author: Orrin AI
Latest version: 0.1.1

# @orrin-ai/database-adapter-in-memory

In-memory database adapter for Orrin AI framework, ideal for testing or simpler applications.

## Installation

```bash
npm install @orrin-ai/database-adapter-in-memory
```

## Usage

The database-adapter-in-memory package provides in-memory storage for Orrin AI sessions and messages.

```typescript
import { InMemoryDatabaseAdapter } from "@orrin-ai/database-adapter-in-memory";
import { OrrinAiClient } from "@orrin-ai/mcp-agent";
import { ClaudeAdapter } from "@orrin-ai/llm-adapters-anthropic";

// Initialize the in-memory adapter
const dbAdapter = new InMemoryDatabaseAdapter();

// Use with OrrinAiClient
const client = new OrrinAiClient({
  llmAdapter: new ClaudeAdapter(),
  databaseAdapter: dbAdapter
});

// Now you can use the client with in-memory storage
// Note: All data will be lost when the application restarts
const sessionId = await client.createAndOpenSession();
for await (const chunk of client.addUserMessage(sessionId, "Hello!")) {
  // Process response chunks
}
```

## API Reference

### InMemoryDatabaseAdapter

Database adapter for in-memory storage.

#### Constructor

```typescript
constructor()
```

#### Key Methods (implements DatabaseAdapter interface)

- `createSession(sessionId)`: Creates a new session in memory
- `getSession(sessionId)`: Retrieves session information
- `addMessage(sessionId, message)`: Stores a message for a session
- `getMessages(sessionId)`: Retrieves all messages for a session

## When to Use

The in-memory adapter is best for:
- Development and testing environments
- Simple applications where persistence isn't required
- Scenarios where you want to avoid database setup

For production applications that need to maintain conversation history across restarts, consider using the SQLiteDatabaseAdapter instead.

## License

MIT
npm package: @orrin-ai/database-adapter-sqlite
Description: SQLite database adapter for MCP agent
Author: Orrin AI
Latest version: 0.1.2

# @orrin-ai/database-adapter-sqlite

SQLite database adapter for Orrin AI framework, providing persistent storage for AI sessions and messages.

## Installation

```bash
npm install @orrin-ai/database-adapter-sqlite
```

## Usage

The database-adapter-sqlite package provides SQLite-based persistence for Orrin AI conversations.

```typescript
import { SQLiteDatabaseAdapter } from "@orrin-ai/database-adapter-sqlite";
import { OrrinAiClient } from "@orrin-ai/mcp-agent";
import { ClaudeAdapter } from "@orrin-ai/llm-adapters-anthropic";

// Initialize with default options
// This creates a SQLite database file in the default location
const dbAdapter = new SQLiteDatabaseAdapter();

// Or, configure with custom database path
const dbAdapterWithOptions = new SQLiteDatabaseAdapter({
  databasePath: "./my-custom-path/conversations.db"
});

// Use with OrrinAiClient
const client = new OrrinAiClient({
  llmAdapter: new ClaudeAdapter(),
  databaseAdapter: dbAdapter
});
```

## API Reference

### SQLiteDatabaseAdapter

Database adapter for SQLite persistence.

#### Constructor

```typescript
constructor(config?: SQLiteDatabaseAdapterConfig)
```

Optional configuration:
- `config.databasePath`: Custom path for the SQLite database file (defaults to "./orrin-ai.db")

#### Key Methods (implements DatabaseAdapter interface)

- `createSession(sessionId)`: Creates a new session
- `getSession(sessionId)`: Retrieves session information
- `addMessage(sessionId, message)`: Stores a message for a session
- `getMessages(sessionId)`: Retrieves all messages for a session

## License

MIT
npm package: @orrin-ai/llm-adapters-anthropic
Description: Anthropic LLM adapter for MCP agent
Author: Orrin AI
Latest version: 0.1.3

# @orrin-ai/llm-adapters-anthropic

Anthropic Claude adapter for Orrin AI framework.

## Installation

```bash
npm install @orrin-ai/llm-adapters-anthropic
```

## Usage

The llm-adapters-anthropic package provides integration with Anthropic's Claude models.

```typescript
import { ClaudeAdapter } from "@orrin-ai/llm-adapters-anthropic";
import { OrrinAiClient } from "@orrin-ai/mcp-agent";
import { SQLiteDatabaseAdapter } from "@orrin-ai/database-adapter-sqlite";

// Initialize the Claude adapter
// Uses ANTHROPIC_API_KEY from environment variables by default
const llmAdapter = new ClaudeAdapter();

// Or, configure with options
const llmAdapterWithOptions = new ClaudeAdapter({
  apiKey: "your-api-key", // Optional: override environment variable
  modelName: "claude-3-opus-20240229", // Optional: specify model version
  temperature: 0.7 // Optional: adjust temperature
});

// Use with OrrinAiClient
const client = new OrrinAiClient({
  llmAdapter: llmAdapter,
  databaseAdapter: new SQLiteDatabaseAdapter()
});
```

## API Reference

### ClaudeAdapter

Adapter for Anthropic's Claude models.

#### Constructor

```typescript
constructor(config?: ClaudeAdapterConfig)
```

Optional configuration:
- `config.apiKey`: Anthropic API key (defaults to ANTHROPIC_API_KEY environment variable)
- `config.modelName`: Claude model to use (defaults to "claude-3-sonnet-20240229")
- `config.temperature`: Temperature for generation (defaults to 0.7)
- `config.maxTokens`: Maximum tokens in response (defaults to 4096)

## License

MIT
npm package: @orrin-ai/mcp-agent
Description: MCP agent with session management and SSE streaming support
Latest version: 0.1.4

# @orrin-ai/mcp-agent

Core package for Orrin AI - a fully resumable modular agent framework with MCP support.

## Installation

```bash
npm install @orrin-ai/mcp-agent
```

## Usage

The mcp-agent package provides the essential components for creating and managing AI agents with persistent sessions.

```typescript
import { OrrinAiClient } from "@orrin-ai/mcp-agent";
import { ClaudeAdapter } from "@orrin-ai/llm-adapters-anthropic";
import { SQLiteDatabaseAdapter } from "@orrin-ai/database-adapter-sqlite";

// Initialize the client with adapters
const client = new OrrinAiClient({
  llmAdapter: new ClaudeAdapter(),
  databaseAdapter: new SQLiteDatabaseAdapter(),
  mcpServerUrls: ["http://localhost:3000/sse"] // Optional MCP servers
});

// Create and open a session
const sessionId = await client.createAndOpenSession();

// Process a user message with streaming responses
for await (const chunk of client.addUserMessage(sessionId, "Hello!")) {
  if ('type' in chunk && chunk.type === 'text_delta') {
    console.log(chunk.delta); // Process text chunks
  }
}

// Close the session when done
await client.closeSession(sessionId);

// Disconnect all agents if needed
await client.disconnectAll();
```

## API Reference

### OrrinAiClient

The main class for managing AI agent sessions.

#### Constructor

```typescript
constructor(config: OrrinAiClientConfig)
```

- `config.llmAdapter`: LLM adapter for communicating with AI models
- `config.databaseAdapter`: Database adapter for storing sessions and messages
- `config.mcpServerUrls`: Optional array of MCP server URLs for enhanced capabilities

#### Methods

- `createSession()`: Creates a new session in the database
- `openSession(sessionId)`: Opens an existing session by initializing an Agent
- `createAndOpenSession()`: Creates and opens a session in one operation
- `closeSession(sessionId)`: Closes a specific session
- `disconnectAll()`: Closes all active session agents
- `addUserMessage(sessionId, message)`: Adds a user message to a session and yields streamed responses

## License

MIT
npm package: @orrisai/agent-otp-shared
Description: Shared types, schemas, and constants for Agent OTP
Author: Agent OTP Team
Latest version: 0.2.0

# @orrisai/agent-otp-shared

Shared types, schemas, and constants for [Agent OTP](https://agentotp.com).

This package contains:
- TypeScript type definitions
- Zod validation schemas
- Shared constants

## Installation

```bash
npm install @orrisai/agent-otp-shared
```

## Usage

```typescript
// Import types
import type {
  PermissionStatus,
  TokenVerificationResult,
  TokenUsageResult,
} from '@orrisai/agent-otp-shared';

// Import constants
import {
  PERMISSION_STATUS,
  POLICY_ACTION,
  TOKEN_DEFAULTS,
} from '@orrisai/agent-otp-shared';

// Import schemas for validation
import {
  createPermissionRequestSchema,
  verifyTokenSchema,
} from '@orrisai/agent-otp-shared';
```

## Exports

### Constants

- `PERMISSION_STATUS` - Permission status values (pending, approved, denied, expired, used)
- `POLICY_ACTION` - Policy action types (auto_approve, require_approval, deny)
- `TOKEN_DEFAULTS` - Default token configuration

### Types

- `PermissionStatus` - Permission status type
- `TokenVerificationResult` - Token verification response
- `TokenUsageResult` - Token usage response
- And more...

### Schemas (Zod)

- `createPermissionRequestSchema` - Validate permission requests
- `verifyTokenSchema` - Validate token verification
- `useTokenSchema` - Validate token usage
- And more...

## License

MIT - see [LICENSE](../../LICENSE) for details.
npm package: @orrisroot/inject-loader
Description: A Webpack loader for injecting code into modules via their dependencies
Author: Justin Morris
Latest version: 5.0.0

# 💉📦 inject-loader

A Webpack loader for injecting code into modules via their dependencies

[![npm](https://img.shields.io/npm/v/@orrisroot/inject-loader.svg)](https://www.npmjs.com/package/@orrisroot/inject-loader)
[![Downloads](https://img.shields.io/npm/dw/@orrisroot/inject-loader.svg)](https://www.npmjs.com/package/@orrisroot/inject-loader)

***

## Why

This is particularly useful for writing tests where mocking things inside your module-under-test is sometimes necessary before execution.

`inject-loader` was inspired by, and builds upon ideas introduced in [jauco/webpack-injectable](https://github.com/jauco/webpack-injectable).

This library has been forked from [inject-loader](https://github.com/plasticine/inject-loader) and renamed to [@orrisroot/inject-loader](https://github.com/orrisroot/inject-loader) for continued maintenance.

## Usage

[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)

Use the inject loader by adding the `@orrisroot/inject-loader!` [inline loader](https://webpack.js.org/concepts/loaders/#inline) when you use `require`, this will return a function that can used in test code to modify the injected module.

By default all `require` statements in an injected module will be altered to be replaced with an injector, though if a replacement it not specified the default values will be used.

## Examples

Given some code in a module like this:

```javascript
// MyStore.js

var Dispatcher = require('lib/dispatcher');
var EventEmitter = require('events').EventEmitter;
var handleAction = require('lib/handle_action');

Dispatcher.register(handleAction, 'MyStore');
```

You can manipulate it’s dependencies when you come to write tests as follows:

```javascript
// If no flags are provided when using the loader then
// all require statements will be wrapped in an injector
MyModuleInjector = require('@orrisroot/inject-loader!MyStore')
MyModule = MyModuleInjector({
  'lib/dispatcher': DispatcherMock,
  'events': EventsMock,
  'lib/handle_action': HandleActionMock
})
```

There are a few examples of complete test setups for Webpack 5 in the [`example`](./example) folder.

## License

The source code is licensed MIT. see [`LICENSE`](./LICENSE).
npm package: @orrkislev/webgpu-utils
Description: Utility functions for WebGPU development with a focus on generative art
Author: Orr Kislev
Latest version: 0.1.2

# WebGPU Utils

A comprehensive utility library for WebGPU development with a focus on generative art and creative coding.

## Installation

```bash
npm install webgpu-utils
```

## Getting Started

To help you get started quickly, we provide several starter templates:

- **[CDN Starter](https://github.com/orrkislev/webgpu-utils/tree/main/_%20starters/cdn)** - Simple HTML file with CDN imports
- **[ES Module Starter](https://github.com/orrkislev/webgpu-utils/tree/main/_%20starters/es%20module)** - Modern ES module setup
- **[Vite Starter](https://github.com/orrkislev/webgpu-utils/tree/main/_%20starters/vite)** - Basic development environment with Vite

## Features

- **Rendering Utilities**: Easily create render and compute passes
- **Data Structures**: Typed struct system for efficient GPU buffer management
- **Math Utilities**: Helper functions for 2D/3D graphics and random number generation
- **Shader Helpers**: Noise functions, camera utilities, and ray casting

## Basic Usage

```javascript
import { init, wgsl, renderPass, ComputePass, runPasses } from '../../dist/webgpu-utils.esm.js'

await init()

const code = wgsl`
    let pos = vec2<u32>(id.x, id.y);
    let color = vec4<f32>(f32(pos.x) / width, f32(pos.y) / height, .5, 1.0);
    textureStore(renderTxtr, pos, color);
`

const pass = ComputePass.texture(code, [])
runPasses([pass, renderPass])
```

## Core Components

### Canvas and Device Setup

- `await init()`: Initialize WebGPU canvas and device

### Pass Types

- `RenderPass`: For rendering to the canvas or textures
- `ComputePass`: For GPGPU computations

### Textures and Buffers

- `Texture`: Create and manage WebGPU textures
- `Buffer`: Create and manage WebGPU buffers
- `Struct`: Typed data structure for GPU buffers

### Named Buffers and Textures

- `renderTxtr`: The main texture used for rendering the scene.
- `feedbackTxtr`: A texture used for feedback in the rendering process.
- `mouse`: A Buffer that stores mouse position data.
- `time`: A Buffer that stores time data for animations.

### Named Passes

- `renderPass`: The main render pass that outputs to the canvas.
- `clearPass`: A pass that clears the render texture.
- `matchPass`: A pass that draws the current frame to the feedback texture.

### Shader Utilities

- Noise functions (2D and 3D)
- Camera utilities
- Ray casting helpers

## Examples



## License

MIT
npm package: @orsetra/core-ui
Description: Core UI components, hooks, and utilities for Orsetra micro-frontends
Author: Orsetra
Latest version: 1.0.0

# @orsetra/core-ui

Core UI components, hooks, and utilities for Orsetra micro-frontends architecture.

## Structure

```
shared/
├── src/
│   ├── components/     # Composants UI réutilisables
│   ├── hooks/          # Hooks React partagés
│   ├── lib/            # Utilitaires et helpers
│   ├── styles/         # Styles globaux
│   └── types/          # Types TypeScript partagés
```

## Utilisation

Dans un micro-app :

```typescript
// Importer des types
import type { User, AuthContext } from '@orsetra/core-ui/types';

//### UI Components

```tsx
import { Button, Card, Input } from '@orsetra/core-ui/components/ui';

// Importer des hooks
import { useAuth, useToast } from '@orsetra/core-ui/hooks';

// Importer des utilitaires
import { cn, formatDate } from '@orsetra/core-ui/lib';

// Importer des constantes
import { ROUTES, API_ENDPOINTS } from '@orsetra/core-ui/lib';
```

## Développement

Ce package est utilisé en mode "source" (pas de build), les micro-apps importent directement les fichiers TypeScript.