@hubui/client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * HubUI Client SDK - Internal Realtime Adapter
3
+ * @hubui/client
4
+ *
5
+ * This file isolates transport imports to keep them internal.
6
+ * The bundler inlines runtime internals from end users.
7
+ */
8
+ export { Room, RoomEvent, ConnectionState, Track, TrackPublication, Participant, RemoteParticipant, LocalParticipant, DataPacket_Kind, ParticipantKind, LogLevel, setLogLevel, } from 'livekit-client';
9
+ export type { RoomOptions, RoomConnectOptions, TranscriptionSegment, } from 'livekit-client';
@@ -0,0 +1,95 @@
1
+ /**
2
+ * HubUI Client SDK - Type Definitions
3
+ * @hubui/client
4
+ */
5
+ /**
6
+ * Configuration for connecting to a HubUI agent
7
+ */
8
+ export interface HubUIConfig {
9
+ /** The agent ID from your HubUI dashboard */
10
+ agentId: string;
11
+ /** Your API key (pk_live_xxx) from the HubUI dashboard. Required unless `token` is provided. */
12
+ apiKey?: string;
13
+ /** Pre-fetched connection token. When provided, the SDK skips API key validation and token fetch. Requires `serverUrl`. */
14
+ token?: string;
15
+ /** WebSocket server URL. Required when using `token` directly. */
16
+ serverUrl?: string;
17
+ /** Connection mode: 'voice' for audio calls, 'text' for chat */
18
+ mode: 'voice' | 'text';
19
+ /** Optional: Display name for the end user */
20
+ userName?: string;
21
+ /** Optional: Email for the end user (for analytics) */
22
+ userEmail?: string;
23
+ /** Optional: Specific audio input device ID */
24
+ audioInput?: string;
25
+ /** Optional: Specific audio output device ID */
26
+ audioOutput?: string;
27
+ /** Optional: Custom API base URL (for enterprise) */
28
+ apiBaseUrl?: string;
29
+ /** Optional: Enable debug logging to the browser console (default: false) */
30
+ debug?: boolean;
31
+ }
32
+ /**
33
+ * Connection states for a HubUI session
34
+ */
35
+ export type HubUIConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
36
+ /**
37
+ * A single transcript entry
38
+ */
39
+ export interface HubUITranscriptEntry {
40
+ /** Unique ID for this entry */
41
+ id: string;
42
+ /** Who spoke: 'user' or 'agent' */
43
+ speaker: 'user' | 'agent';
44
+ /** The transcribed or sent text */
45
+ text: string;
46
+ /** When this entry was created */
47
+ timestamp: Date;
48
+ /** Whether this is a final transcript (vs interim) */
49
+ isFinal: boolean;
50
+ }
51
+ /**
52
+ * Audio device information
53
+ */
54
+ export interface AudioDevice {
55
+ /** Device ID to use when setting input/output */
56
+ deviceId: string;
57
+ /** Human-readable device name */
58
+ label: string;
59
+ /** Device type */
60
+ kind: 'audioinput' | 'audiooutput';
61
+ }
62
+ /**
63
+ * Event handler types
64
+ */
65
+ export interface HubUIEvents {
66
+ /** Fired when successfully connected to the agent */
67
+ 'connected': () => void;
68
+ /** Fired when disconnected from the agent */
69
+ 'disconnected': () => void;
70
+ /** Fired when an error occurs */
71
+ 'error': (error: HubUIError) => void;
72
+ /** Fired when transcript is received (voice mode) */
73
+ 'transcript': (text: string, speaker: 'user' | 'agent', isFinal: boolean) => void;
74
+ /** Fired when a text message is received */
75
+ 'message': (text: string) => void;
76
+ /** Fired when connection state changes */
77
+ 'connectionStateChanged': (state: HubUIConnectionState) => void;
78
+ /** Fired when audio playback is blocked (mobile browsers) */
79
+ 'audioPlaybackBlocked': () => void;
80
+ }
81
+ /**
82
+ * Error class for HubUI-specific errors
83
+ */
84
+ export declare class HubUIError extends Error {
85
+ code: string;
86
+ constructor(message: string, code?: string);
87
+ }
88
+ /**
89
+ * Response from the token endpoint
90
+ */
91
+ export interface TokenResponse {
92
+ token: string;
93
+ hubui_url: string;
94
+ room_name: string;
95
+ }
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@hubui/client",
3
+ "version": "0.1.0",
4
+ "description": "HubUI Client SDK - Connect to AI voice and text agents",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.esm.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.esm.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist/**/*.cjs",
18
+ "dist/**/*.js",
19
+ "dist/**/*.d.ts",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "scripts": {
24
+ "build": "rollup -c",
25
+ "dev": "rollup -c -w",
26
+ "clean": "rm -rf dist",
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "prepublishOnly": "npm run clean && npm run build"
30
+ },
31
+ "keywords": [
32
+ "hubui",
33
+ "ai",
34
+ "voice",
35
+ "chat",
36
+ "sdk",
37
+ "realtime",
38
+ "agents"
39
+ ],
40
+ "author": "HubUI",
41
+ "license": "Apache-2.0",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/HubUI-AI/hubui-client.git"
45
+ },
46
+ "homepage": "https://hubui.ai",
47
+ "bugs": {
48
+ "url": "https://github.com/HubUI-AI/hubui-client/issues"
49
+ },
50
+ "devDependencies": {
51
+ "@rollup/plugin-commonjs": "^25.0.7",
52
+ "@rollup/plugin-node-resolve": "^15.2.3",
53
+ "@rollup/plugin-terser": "^0.4.4",
54
+ "@rollup/plugin-typescript": "^11.1.6",
55
+ "rollup": "^4.9.6",
56
+ "tslib": "^2.6.2",
57
+ "typescript": "^5.3.3",
58
+ "vitest": "^3.2.4"
59
+ },
60
+ "dependencies": {
61
+ "livekit-client": "^2.0.0"
62
+ },
63
+ "engines": {
64
+ "node": ">=16.0.0"
65
+ },
66
+ "sideEffects": false,
67
+ "publishConfig": {
68
+ "access": "public",
69
+ "registry": "https://registry.npmjs.org/"
70
+ }
71
+ }