Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This repo owns:
- local examples in `examples/`

Sibling dependency:
- `../agent` → `@deepgram/agent`
- `../agent` → `@deepgram/agents`

## Commands

Expand All @@ -20,7 +20,7 @@ bun run dev

## Architecture Notes

- `@deepgram/react` depends on `@deepgram/agent`.
- `@deepgram/react` depends on `@deepgram/agents`.
- It provides the provider + hooks layer only; no bundled UI.
- `@deepgram/ui` consumes this package for prebuilt components.

Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: deepgram/agent
path: ../agent
- uses: actions/checkout@v6

- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.10"
- name: Build @deepgram/agent
run: cd ../agent && bun install && bun run --filter '@deepgram/agent' build

- run: bun install

- name: Typecheck
run: bun run typecheck

- name: Build
run: bun run build

- name: Test
run: bun run test
26 changes: 8 additions & 18 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
release_created: ${{ steps.release.outputs['packages/react--release_created'] }}
version: ${{ steps.release.outputs['packages/react--version'] }}
steps:
- uses: googleapis/release-please-action@v4
- uses: googleapis/release-please-action@v5
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -31,31 +31,21 @@ jobs:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
repository: deepgram/agent
path: ../agent
- uses: actions/checkout@v6

- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.10"
- uses: actions/setup-node@v4

- uses: actions/setup-node@v6
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Build @deepgram/agent
run: cd ../agent && bun install && bun run --filter '@deepgram/agent' build

- run: bun install

- run: bun run build
- name: Swap file pointers
run: |
SDK_VERSION=$(node -e "console.log(require('../agent/packages/sdk/package.json').version)")
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('packages/react/package.json', 'utf8'));
pkg.dependencies['@deepgram/agent'] = SDK_VERSION;
fs.writeFileSync('packages/react/package.json', JSON.stringify(pkg, null, 2) + '\n');
"

- run: npm publish --provenance --access public
working-directory: packages/react
env:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ React hooks and provider for the [Deepgram Voice Agent API](https://developers.d
## Install

```bash
npm install @deepgram/react @deepgram/agent
npm install @deepgram/react @deepgram/agents
```

## Quick Start
Expand Down Expand Up @@ -67,9 +67,9 @@ See the [package README](packages/react/README.md) for full API documentation.

| Package | Repo | Description |
|---------|------|-------------|
| [`@deepgram/agent`](https://github.com/deepgram/agent) | `deepgram/agent` | Core SDK -- WebSocket session, microphone capture, audio playback |
| [`@deepgram/agents`](https://github.com/deepgram/agent) | `deepgram/agent` | Core SDK -- WebSocket session, microphone capture, audio playback |
| [`@deepgram/ui`](https://github.com/deepgram/ui) | `deepgram/ui` | Pre-built React UI components with Tailwind CSS theming |
| [`@deepgram/agent-widget`](https://github.com/deepgram/agent) | `deepgram/agent` | Self-contained widget (UMD + ESM) |
| [`@deepgram/agents-widget`](https://github.com/deepgram/agent) | `deepgram/agent` | Self-contained widget (UMD + ESM) |

## Documentation

Expand All @@ -81,7 +81,7 @@ See the [package README](packages/react/README.md) for full API documentation.

**Prerequisites:** [Bun](https://bun.sh/) 1.3+

This package depends on `@deepgram/agent` via a `file:` pointer. Clone the agent repo as a sibling:
This package depends on `@deepgram/agents` via a `file:` pointer. Clone the agent repo as a sibling:

```bash
git clone git@github.com:deepgram/agent.git ../agent
Expand Down
155 changes: 54 additions & 101 deletions bun.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"lint": "bun run --filter '@deepgram/react' lint"
},
"overrides": {
"brace-expansion": "5.0.5",
"@deepgram/agent": "file:../agent/packages/sdk"
"brace-expansion": "5.0.5"
}
}
6 changes: 3 additions & 3 deletions packages/react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For pre-built UI components, see [`@deepgram/ui`](https://github.com/deepgram/ui
## Install

```bash
npm install @deepgram/react @deepgram/agent
npm install @deepgram/react @deepgram/agents
```

## Quick Start
Expand Down Expand Up @@ -206,7 +206,7 @@ const {

## Exports

All hooks, the provider, context types, and common SDK types (re-exported from `@deepgram/agent` for convenience):
All hooks, the provider, context types, and common SDK types (re-exported from `@deepgram/agents` for convenience):

```ts
// Provider
Expand All @@ -232,7 +232,7 @@ export type {
// Context types
export type { AgentContextValue, ConversationEntry, AgentMode };

// SDK types (re-exported from @deepgram/agent)
// SDK types (re-exported from @deepgram/agents)
export type {
AgentSessionConfig, AuthConfig, TokenFactory,
AgentSettingsObject, ThinkSettings, SpeakSettings,
Expand Down
29 changes: 20 additions & 9 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@deepgram/react",
"version": "0.0.0",
"description": "React hooks and components for @deepgram/agent",
"description": "React hooks and components for @deepgram/agents",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
Expand All @@ -13,7 +13,18 @@
"require": "./dist/index.cjs"
}
},
"files": ["dist"],
"files": [
"dist"
],
"repository": {
"type": "git",
"url": "git+https://github.com/deepgram/react.git",
"directory": "packages/react"
},
"homepage": "https://github.com/deepgram/react/tree/main/packages/react#readme",
"bugs": {
"url": "https://github.com/deepgram/react/issues"
},
"scripts": {
"build": "tsc --noEmit && vite build",
"typecheck": "tsc --noEmit",
Expand All @@ -22,7 +33,7 @@
"test:watch": "bun test --watch"
},
"dependencies": {
"@deepgram/agent": "file:../../../agent/packages/sdk"
"@deepgram/agents": "^0.1.1"
},
"peerDependencies": {
"react": ">=18.0.0",
Expand All @@ -34,12 +45,12 @@
"@types/react-dom": "19.2.3",
"@vitejs/plugin-react": "6.0.1",
"eventemitter3": "5.0.4",
"happy-dom": "20.8.9",
"react": "19.2.4",
"react-dom": "19.2.4",
"terser": "5.46.1",
"typescript": "5.9.3",
"vite": "8.0.5",
"happy-dom": "20.9.0",
"react": "19.2.5",
"react-dom": "19.2.5",
"terser": "5.46.2",
"typescript": "6.0.2",
"vite": "8.0.10",
"vite-plugin-dts": "4.5.4"
},
"license": "MIT"
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/__tests__/helpers/mock-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function resetMocks() {
}

// Install module-level mock
mock.module("@deepgram/agent", () => ({
mock.module("@deepgram/agents", () => ({
AgentSession: class extends MockAgentSession {
constructor(...args: unknown[]) {
super();
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createContext, useContext } from "react";
import type { AgentSession, AgentState } from "@deepgram/agent";
import type { FunctionCallItem } from "@deepgram/agent";
import type { AgentSession, AgentState } from "@deepgram/agents";
import type { FunctionCallItem } from "@deepgram/agents";

export interface ConversationEntry {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useAgentClientTool.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect } from "react";
import { useAgentContext } from "../context.js";
import type { FunctionCallItem } from "@deepgram/agent";
import type { FunctionCallItem } from "@deepgram/agents";

/**
* Register a client-side tool handler that the agent can invoke.
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useAgentSession.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useAgentContext } from "../context.js";
import type { AgentSession } from "@deepgram/agent";
import type { AgentSession } from "@deepgram/agents";

/**
* Returns the raw AgentSession for advanced use cases — custom event
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useAgentState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useAgentContext } from "../context.js";
import type { AgentState } from "@deepgram/agent";
import type { AgentState } from "@deepgram/agents";

export interface UseAgentStateResult {
state: AgentState;
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/hooks/useDeepgramAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type AgentState,
type ConversationTextMessage,
type FunctionCallRequestMessage,
} from "@deepgram/agent";
} from "@deepgram/agents";
import type { ConversationEntry } from "../context.js";

export interface UseDeepgramAgentOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ export type {
ThinkSettings,
SpeakSettings,
MicrophoneOptions,
} from "@deepgram/agent";
} from "@deepgram/agents";
2 changes: 1 addition & 1 deletion packages/react/src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
type AgentState,
type MicrophoneOptions,
type FunctionCallItem,
} from "@deepgram/agent";
} from "@deepgram/agents";
import { AgentContext, type AgentMode, type ConversationEntry } from "./context.js";

export interface AgentProviderProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"rootDir": "src",
"declarationDir": "dist",
"paths": {
"@deepgram/agent": ["../../../agent/packages/sdk/dist/index"]
"@deepgram/agents": ["../../../agent/packages/sdk/dist/index"]
}
},
"include": ["src"],
Expand Down
2 changes: 1 addition & 1 deletion packages/react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig({
"react",
"react/jsx-runtime",
"react-dom",
"@deepgram/agent",
"@deepgram/agents",
],
},
minify: "terser",
Expand Down
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"packages": {
"packages/react": {
"package-name": "@deepgram/react",
"changelog-path": "CHANGELOG.md"
"changelog-path": "CHANGELOG.md",
"release-as": "0.1.0"
}
}
}