open-index/open-npm huggingface dataset:
npm package: @frenchfryai/core
Description: Framework-agnostic primitives for OpenAI Realtime over WebRTC, with typed event parsing and tool-call orchestration helpers.
Latest version: 0.1.2

# @frenchfryai/core

Framework-agnostic primitives for OpenAI Realtime over WebRTC, with typed event parsing and tool-call orchestration helpers.

## Installation

```bash
npm install @frenchfryai/core
```

## What This Package Provides

- `createRealtimeClient(...)` to manage browser-side realtime connection lifecycle
- Runtime-validated protocol parsers for client/server events
- Tool-call stream accumulation and invocation utilities
- Structured tool output helpers for `function_call_output` events

## Basic Usage

```ts
import { createRealtimeClient } from "@frenchfryai/core";

const client = createRealtimeClient({
  sessionEndpoint: "http://localhost:8787/realtime/session",
  session: {
    model: "gpt-realtime",
    type: "realtime"
  }
});

await client.connect();

client.events$.subscribe((event) => {
  if (event.type === "runtime.connection.open") {
    console.log("connected");
  }
});

client.send({
  type: "response.create",
  response: {}
});
```

## Tool Orchestration Example

```ts
import {
  createFunctionCallOutputEvents,
  createToolRegistry,
  runToolInvocation
} from "@frenchfryai/core";

const toolsByName = createToolRegistry([
  {
    name: "echo",
    description: "Echo input",
    handler: async (input) => input
  }
]);

const result = await runToolInvocation({
  doneEvent: {
    type: "response.function_call_arguments.done",
    call_id: "call_123",
    name: "echo",
    arguments: "{\"hello\":\"world\"}"
  },
  timeoutMs: 15_000,
  toolsByName
});

const outputEvents = createFunctionCallOutputEvents({
  callId: result.callId,
  output: result.output
});
```

## Main Exports

- `createRealtimeClient`
- `parseCoreClientEvent`
- `parseCoreServerEvent`
- `createToolCallAccumulatorState`
- `reduceToolCallAccumulatorState`
- `createToolRegistry`
- `runToolInvocation`
- `shouldInvokeToolCall`
- `createFunctionCallOutputEvents`
npm package: @frenchfryai/react
Description: React bindings for Frenchfry voice + tool orchestration, including a high-level `VoiceAgent` component and outlet-based generative UI rendering.
Latest version: 0.1.2

# @frenchfryai/react

React bindings for Frenchfry voice + tool orchestration, including a high-level `VoiceAgent` component and outlet-based generative UI rendering.

## Installation

```bash
npm install @frenchfryai/react @frenchfryai/core react
```

## What This Package Provides

- `VoiceAgent` for connection lifecycle, tool execution, and render-state
- `FrenchfryProvider` + `VoiceUiOutlet` for outlet-based generated UI delivery
- `useGenUi` to bridge streaming tool args to Hashbrown UI rendering
- `useVoiceAgent` context hook
- Re-exported Hashbrown React helpers: `useTool`, `useUiKit`, `useJsonParser`

## Basic Usage

```tsx
import {
  FrenchfryProvider,
  VoiceAgent,
  VoiceUiOutlet
} from "@frenchfryai/react";

export const App = () => {
  return (
    <FrenchfryProvider>
      <VoiceAgent
        sessionEndpoint="http://localhost:8787/realtime/session"
        session={{ model: "gpt-realtime", type: "realtime" }}
      >
        {(agent) => (
          <>
            <button onClick={agent.start} disabled={agent.isRunning}>
              Start
            </button>
            <button onClick={agent.stop} disabled={!agent.isRunning}>
              Stop
            </button>
            <VoiceUiOutlet name="voice-main" />
          </>
        )}
      </VoiceAgent>
    </FrenchfryProvider>
  );
};
```

## Using `useGenUi`

`useGenUi` registers a tool contract and stream handlers you pass to `VoiceAgent` via `genUi`.

```tsx
import { VoiceAgent, useGenUi } from "@frenchfryai/react";
import { useMyUiKit } from "./my-ui-kit";

export const AgentWithUi = () => {
  const kit = useMyUiKit();
  const genUi = useGenUi({ kit, outlet: "voice-main" });

  return (
    <VoiceAgent
      sessionEndpoint="http://localhost:8787/realtime/session"
      session={{ model: "gpt-realtime", type: "realtime" }}
      genUi={[genUi]}
    >
      {() => null}
    </VoiceAgent>
  );
};
```

## Main Exports

- `FrenchfryProvider`
- `VoiceAgent`
- `VoiceUiOutlet`
- `useGenUi`
- `useVoiceAgent`
- `useTool`
- `useUiKit`
- `useJsonParser`
npm package: @frenchfryai/runtime
Description: Server-side runtime boundary for OpenAI Realtime call setup. This package provides a typed route helper that forwards browser SDP/session payloads to OpenAI and returns answer SDP.
Latest version: 0.1.2

# @frenchfryai/runtime

Server-side runtime boundary for OpenAI Realtime call setup. This package provides a typed route helper that forwards browser SDP/session payloads to OpenAI and returns answer SDP.

## Installation

```bash
npm install @frenchfryai/runtime hono
```

## What This Package Provides

- `registerRealtimeSessionRoute(...)` for SDP/session exchange endpoint registration
- Input validation for multipart form payloads and session JSON
- Typed runtime protocol parser for browser client events

## Basic Usage

```ts
import { Hono } from "hono";
import { registerRealtimeSessionRoute } from "@frenchfryai/runtime";

const app = new Hono();

registerRealtimeSessionRoute(app, {
  path: "/realtime/session",
  openai: {
    apiKey: process.env.OPENAI_API_KEY ?? ""
  }
});
```

The route expects `multipart/form-data` with:

- `sdp`: offer SDP string
- `session`: JSON string containing at least `{ "type": "realtime", ... }`

## OpenAI Options

- `apiKey`: required
- `callsUrl`: optional override (defaults to `https://api.openai.com/v1/realtime/calls`)
- `organization`: optional OpenAI organization header
- `project`: optional OpenAI project header

## Main Exports

- `registerRealtimeSessionRoute`
- `parseRuntimeClientProtocolEvent`
- `RuntimeOpenAIOptions` type
- `RuntimeRealtimeSessionOptions` type
- `RuntimeClientProtocolEvent` type