realtime-avatar 0.3.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,48 @@
1
+ import { C as CallMode, a as CallPolicy } from './types-C_EMPwN7.js';
2
+
3
+ /** The three things a caller can ask the proxy to do. Gate on these, not on URLs. */
4
+ type ProxyOperation = "connect" | "end" | "avatars" | "credits";
5
+ interface AuthorizeContext {
6
+ request: Request;
7
+ operation: ProxyOperation;
8
+ }
9
+ interface SessionContext {
10
+ request: Request;
11
+ /** Which character the caller asked for. Validate it — it came from the client. */
12
+ avatarId: string;
13
+ mode: CallMode;
14
+ }
15
+ interface ProxyConfig {
16
+ /** Server-only. `tic_live_…` / `tic_test_…`. */
17
+ apiKey: string | (() => string | Promise<string>);
18
+ baseUrl?: string;
19
+ /**
20
+ * Who may do this. Return a `Response` to refuse, or nothing to allow.
21
+ *
22
+ * `connect` is the only operation that costs money to start, so that is where a wallet
23
+ * check belongs. Leaving the reads ungated keeps them cheap.
24
+ */
25
+ authorize?: (context: AuthorizeContext) => Promise<Response | void> | Response | void;
26
+ /**
27
+ * Does this request own that session? Answer for `POST …/end`.
28
+ *
29
+ * Without it the handler remembers what it minted IN PROCESS, which is correct for one
30
+ * server and wrong for serverless, where the next request lands somewhere else and every
31
+ * release is silently declined. Back this with whatever already knows which user started
32
+ * which call, and return false for anything else — rule 12 exists because a route that
33
+ * ends an arbitrary id lets any visitor hang up any call on your account.
34
+ */
35
+ ownsSession?: (context: {
36
+ request: Request;
37
+ sessionId: string;
38
+ }) => Promise<boolean> | boolean;
39
+ /**
40
+ * What the character knows for THIS call. Return a policy, or a `Response` to refuse.
41
+ *
42
+ * Whatever the browser sent for these concerns is discarded — this is the only source.
43
+ * A field you do not set is absent rather than inherited, so an omission fails closed.
44
+ */
45
+ session?: (context: SessionContext) => Promise<CallPolicy | Response> | CallPolicy | Response;
46
+ }
47
+
48
+ export type { ProxyConfig as P };
package/package.json ADDED
@@ -0,0 +1,150 @@
1
+ {
2
+ "name": "realtime-avatar",
3
+ "version": "0.3.0",
4
+ "description": "Realtime Avatar SDK. `realtime-avatar` and the route adapters hold your API key and are server-only; `realtime-avatar/react`, `/browser` and `/tools` never can \u2014 importing a server entry into a browser build throws at bundle time.",
5
+ "license": "MIT",
6
+ "author": "The Influence Company",
7
+ "homepage": "https://realtimeavatar.ai/docs",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/theinfluencecompany/realtime-avatar-sdk.git",
11
+ "directory": "libs/sdk-server"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/theinfluencecompany/realtime-avatar-sdk/issues"
15
+ },
16
+ "keywords": [
17
+ "ai",
18
+ "avatar",
19
+ "realtime",
20
+ "voice",
21
+ "video",
22
+ "agent",
23
+ "full-duplex",
24
+ "livekit",
25
+ "sdk",
26
+ "api-client",
27
+ "react",
28
+ "react-native"
29
+ ],
30
+ "type": "module",
31
+ "main": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "workerd": "./dist/index.js",
37
+ "browser": "./dist/server-only-guard.js",
38
+ "react-native": "./dist/server-only-guard.js",
39
+ "default": "./dist/index.js"
40
+ },
41
+ "./server": {
42
+ "types": "./dist/server.d.ts",
43
+ "workerd": "./dist/server.js",
44
+ "browser": "./dist/server-only-guard.js",
45
+ "react-native": "./dist/server-only-guard.js",
46
+ "default": "./dist/server.js"
47
+ },
48
+ "./nextjs": {
49
+ "types": "./dist/nextjs.d.ts",
50
+ "workerd": "./dist/nextjs.js",
51
+ "browser": "./dist/server-only-guard.js",
52
+ "react-native": "./dist/server-only-guard.js",
53
+ "default": "./dist/nextjs.js"
54
+ },
55
+ "./hono": {
56
+ "types": "./dist/hono.d.ts",
57
+ "workerd": "./dist/hono.js",
58
+ "browser": "./dist/server-only-guard.js",
59
+ "react-native": "./dist/server-only-guard.js",
60
+ "default": "./dist/hono.js"
61
+ },
62
+ "./express": {
63
+ "types": "./dist/express.d.ts",
64
+ "workerd": "./dist/express.js",
65
+ "browser": "./dist/server-only-guard.js",
66
+ "react-native": "./dist/server-only-guard.js",
67
+ "default": "./dist/express.js"
68
+ },
69
+ "./tanstack-start": {
70
+ "types": "./dist/tanstack-start.d.ts",
71
+ "workerd": "./dist/tanstack-start.js",
72
+ "browser": "./dist/server-only-guard.js",
73
+ "react-native": "./dist/server-only-guard.js",
74
+ "default": "./dist/tanstack-start.js"
75
+ },
76
+ "./react": {
77
+ "types": "./dist/react.d.ts",
78
+ "default": "./dist/react.js"
79
+ },
80
+ "./react-native": {
81
+ "types": "./dist/react-native.d.ts",
82
+ "default": "./dist/react-native.js"
83
+ },
84
+ "./browser": {
85
+ "types": "./dist/browser.d.ts",
86
+ "default": "./dist/browser.js"
87
+ },
88
+ "./tools": {
89
+ "types": "./dist/tools.d.ts",
90
+ "default": "./dist/tools.js"
91
+ }
92
+ },
93
+ "files": [
94
+ "dist",
95
+ "README.md"
96
+ ],
97
+ "engines": {
98
+ "node": ">=20"
99
+ },
100
+ "sideEffects": [
101
+ "./dist/server-only-guard.js"
102
+ ],
103
+ "publishConfig": {
104
+ "access": "public"
105
+ },
106
+ "scripts": {
107
+ "build": "tsup"
108
+ },
109
+ "devDependencies": {
110
+ "tsup": "^8.5.0",
111
+ "typescript": "^5.9.2",
112
+ "@livekit/components-react": "2.9.21",
113
+ "@livekit/react-native": "^2.11.1",
114
+ "@types/react": "19.2.7",
115
+ "react": "19.2.7",
116
+ "react-dom": "19.2.7",
117
+ "react-native": "0.81.5"
118
+ },
119
+ "peerDependencies": {
120
+ "@livekit/components-react": "^2.9.0",
121
+ "@livekit/react-native": "^2.11.0",
122
+ "react": ">=18",
123
+ "react-dom": ">=18",
124
+ "react-native": ">=0.78",
125
+ "livekit-client": "^2.9.0"
126
+ },
127
+ "peerDependenciesMeta": {
128
+ "@livekit/components-react": {
129
+ "optional": true
130
+ },
131
+ "@livekit/react-native": {
132
+ "optional": true
133
+ },
134
+ "react-dom": {
135
+ "optional": true
136
+ },
137
+ "react-native": {
138
+ "optional": true
139
+ },
140
+ "react": {
141
+ "optional": true
142
+ },
143
+ "livekit-client": {
144
+ "optional": true
145
+ }
146
+ },
147
+ "dependencies": {
148
+ "zod": "^4.4.3"
149
+ }
150
+ }