@talqing/sdk 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.
- package/LICENSE +21 -0
- package/README.md +193 -0
- package/dist/browser.d.ts +153 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +440 -0
- package/dist/browser.js.map +1 -0
- package/dist/client.d.ts +101 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +88 -0
- package/dist/client.js.map +1 -0
- package/dist/gen/apiVersion.d.ts +3 -0
- package/dist/gen/apiVersion.d.ts.map +1 -0
- package/dist/gen/apiVersion.js +4 -0
- package/dist/gen/apiVersion.js.map +1 -0
- package/dist/gen/client/client.gen.d.ts +3 -0
- package/dist/gen/client/client.gen.d.ts.map +1 -0
- package/dist/gen/client/client.gen.js +217 -0
- package/dist/gen/client/client.gen.js.map +1 -0
- package/dist/gen/client/index.d.ts +11 -0
- package/dist/gen/client/index.d.ts.map +1 -0
- package/dist/gen/client/index.js +7 -0
- package/dist/gen/client/index.js.map +1 -0
- package/dist/gen/client/types.gen.d.ts +121 -0
- package/dist/gen/client/types.gen.d.ts.map +1 -0
- package/dist/gen/client/types.gen.js +3 -0
- package/dist/gen/client/types.gen.js.map +1 -0
- package/dist/gen/client/utils.gen.d.ts +38 -0
- package/dist/gen/client/utils.gen.d.ts.map +1 -0
- package/dist/gen/client/utils.gen.js +231 -0
- package/dist/gen/client/utils.gen.js.map +1 -0
- package/dist/gen/client.gen.d.ts +13 -0
- package/dist/gen/client.gen.d.ts.map +1 -0
- package/dist/gen/client.gen.js +4 -0
- package/dist/gen/client.gen.js.map +1 -0
- package/dist/gen/core/auth.gen.d.ts +26 -0
- package/dist/gen/core/auth.gen.d.ts.map +1 -0
- package/dist/gen/core/auth.gen.js +15 -0
- package/dist/gen/core/auth.gen.js.map +1 -0
- package/dist/gen/core/bodySerializer.gen.d.ts +26 -0
- package/dist/gen/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/gen/core/bodySerializer.gen.js +58 -0
- package/dist/gen/core/bodySerializer.gen.js.map +1 -0
- package/dist/gen/core/params.gen.d.ts +44 -0
- package/dist/gen/core/params.gen.d.ts.map +1 -0
- package/dist/gen/core/params.gen.js +110 -0
- package/dist/gen/core/params.gen.js.map +1 -0
- package/dist/gen/core/pathSerializer.gen.d.ts +34 -0
- package/dist/gen/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/gen/core/pathSerializer.gen.js +107 -0
- package/dist/gen/core/pathSerializer.gen.js.map +1 -0
- package/dist/gen/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/gen/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/gen/core/queryKeySerializer.gen.js +93 -0
- package/dist/gen/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/gen/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/gen/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/gen/core/serverSentEvents.gen.js +133 -0
- package/dist/gen/core/serverSentEvents.gen.js.map +1 -0
- package/dist/gen/core/types.gen.d.ts +84 -0
- package/dist/gen/core/types.gen.d.ts.map +1 -0
- package/dist/gen/core/types.gen.js +3 -0
- package/dist/gen/core/types.gen.js.map +1 -0
- package/dist/gen/core/utils.gen.d.ts +20 -0
- package/dist/gen/core/utils.gen.d.ts.map +1 -0
- package/dist/gen/core/utils.gen.js +88 -0
- package/dist/gen/core/utils.gen.js.map +1 -0
- package/dist/gen/index.d.ts +3 -0
- package/dist/gen/index.d.ts.map +1 -0
- package/dist/gen/index.js +3 -0
- package/dist/gen/index.js.map +1 -0
- package/dist/gen/sdk.gen.d.ts +2330 -0
- package/dist/gen/sdk.gen.d.ts.map +1 -0
- package/dist/gen/sdk.gen.js +4320 -0
- package/dist/gen/sdk.gen.js.map +1 -0
- package/dist/gen/types.gen.d.ts +17288 -0
- package/dist/gen/types.gen.d.ts.map +1 -0
- package/dist/gen/types.gen.js +3 -0
- package/dist/gen/types.gen.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/vocabulary.d.ts +67 -0
- package/dist/vocabulary.d.ts.map +1 -0
- package/dist/vocabulary.js +12 -0
- package/dist/vocabulary.js.map +1 -0
- package/package.json +67 -0
- package/src/browser.tsx +675 -0
- package/src/client.ts +189 -0
- package/src/gen/apiVersion.ts +4 -0
- package/src/gen/client/client.gen.ts +277 -0
- package/src/gen/client/index.ts +27 -0
- package/src/gen/client/types.gen.ts +218 -0
- package/src/gen/client/utils.gen.ts +316 -0
- package/src/gen/client.gen.ts +16 -0
- package/src/gen/core/auth.gen.ts +48 -0
- package/src/gen/core/bodySerializer.gen.ts +82 -0
- package/src/gen/core/params.gen.ts +178 -0
- package/src/gen/core/pathSerializer.gen.ts +171 -0
- package/src/gen/core/queryKeySerializer.gen.ts +117 -0
- package/src/gen/core/serverSentEvents.gen.ts +242 -0
- package/src/gen/core/types.gen.ts +110 -0
- package/src/gen/core/utils.gen.ts +140 -0
- package/src/gen/index.ts +4 -0
- package/src/gen/sdk.gen.ts +5008 -0
- package/src/gen/types.gen.ts +18418 -0
- package/src/index.ts +13 -0
- package/src/vocabulary.ts +134 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Talqing
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Talqing TypeScript SDK
|
|
2
|
+
|
|
3
|
+
The TypeScript client for the Talqing `/v1` API, generated from
|
|
4
|
+
`openapi/openapi.json`. It is the same set of operations, under the same names,
|
|
5
|
+
as the Python SDK — both come from the surface `backend/api/sdk_surface.py`
|
|
6
|
+
declares.
|
|
7
|
+
|
|
8
|
+
Two entrypoints:
|
|
9
|
+
|
|
10
|
+
- `@talqing/sdk` — the API. Dependency-free, `fetch`-based.
|
|
11
|
+
- `@talqing/sdk/browser` — the LiveKit layer for web calls, so a
|
|
12
|
+
tenant never types `livekit-client` themselves.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @talqing/sdk
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Node 20 or newer. `react` and `react-dom` are peer dependencies of the
|
|
19
|
+
`/browser` entrypoint only — a server-side consumer never installs them.
|
|
20
|
+
|
|
21
|
+
## Authentication
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { TalqingClient } from "@talqing/sdk";
|
|
25
|
+
|
|
26
|
+
const talqing = new TalqingClient({
|
|
27
|
+
baseUrl: "https://api.in.talqing.com",
|
|
28
|
+
token: process.env.TALQING_API_TOKEN,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const me = await talqing.auth.me();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`baseUrl` is required and has no default. Bundlers inline `NEXT_PUBLIC_*` at
|
|
35
|
+
build time, so a missing value cannot be caught at runtime — a localhost
|
|
36
|
+
fallback would silently ship a production bundle calling a server that is not
|
|
37
|
+
there.
|
|
38
|
+
|
|
39
|
+
In the dashboard, pass `credentials: "include"` to send the cookie session
|
|
40
|
+
instead of a token, and `onUnauthorized` to handle a dead session in one place:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
const baseUrl = process.env.NEXT_PUBLIC_API_URL;
|
|
44
|
+
if (!baseUrl) throw new Error("NEXT_PUBLIC_API_URL is required");
|
|
45
|
+
|
|
46
|
+
const talqing = new TalqingClient({
|
|
47
|
+
baseUrl,
|
|
48
|
+
credentials: "include",
|
|
49
|
+
onUnauthorized: () => router.push("/login"),
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## The shape of it
|
|
54
|
+
|
|
55
|
+
Operations are reached by resource, exactly as the API names them. Path and
|
|
56
|
+
query parameters are one flat object; a request body is keyed by its schema
|
|
57
|
+
name.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
await talqing.agents.list({ limit: 50 });
|
|
61
|
+
await talqing.agents.get({ agent_id });
|
|
62
|
+
await talqing.agents.versions.rollback({ agent_id, version: 3 });
|
|
63
|
+
await talqing.calls.batches.pause({ batch_id });
|
|
64
|
+
await talqing.telephony.phoneNumbers.assign({
|
|
65
|
+
number_id,
|
|
66
|
+
assignPhoneNumberRequest: { agent_id },
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const agent = await talqing.agents.create({
|
|
70
|
+
createAgentRequest: { config: { name: "Support bot", channel: "text" } },
|
|
71
|
+
});
|
|
72
|
+
await talqing.agents.publish({ agent_id: agent.id });
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The body key is the generator's one ergonomic cost — hey-api has no `body`
|
|
76
|
+
option — and it is uniform, so it is the same shape at every write call site.
|
|
77
|
+
|
|
78
|
+
## Errors
|
|
79
|
+
|
|
80
|
+
Every non-2xx throws `TalqingApiError`. There is one error shape, so there is
|
|
81
|
+
nothing to branch on:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import { TalqingApiError } from "@talqing/sdk";
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
await talqing.agents.publish({ agent_id });
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error instanceof TalqingApiError) {
|
|
90
|
+
console.error(error.status, error.message); // 400 config is invalid
|
|
91
|
+
error.errors.forEach(console.error); // ["llm: unknown model gpt-4.9"]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Pagination
|
|
97
|
+
|
|
98
|
+
Every list endpoint pages the same way, so one helper covers all of them:
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { paginate } from "@talqing/sdk";
|
|
102
|
+
|
|
103
|
+
for await (const agent of paginate((q) => talqing.agents.list(q))) {
|
|
104
|
+
console.log(agent.config.name);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Live streams
|
|
109
|
+
|
|
110
|
+
Six endpoints stay open and push events. Each frame is typed, and repeats its
|
|
111
|
+
own name in `event`, which is what narrows the union:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const { stream } = await talqing.conversations.events({ conversation_id });
|
|
115
|
+
|
|
116
|
+
for await (const event of stream) {
|
|
117
|
+
if (event.event === "assistant.delta") process.stdout.write(event.text);
|
|
118
|
+
if (event.event === "turn" && event.status === "done") break;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`talqing.copilot.agents.stream`, `copilot.tools.stream`,
|
|
123
|
+
`copilot.knowledge.stream`, `copilot.tasks.stream` and `knowledge.events` work
|
|
124
|
+
the same way.
|
|
125
|
+
|
|
126
|
+
## Text conversations
|
|
127
|
+
|
|
128
|
+
Text agents never create or join a LiveKit room. Open the conversation, then
|
|
129
|
+
send turns — both addressed by your own `contact_key`, so the same key always
|
|
130
|
+
reaches the same thread — and watch it happen on the stream above.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
const conversation = await talqing.conversations.create({
|
|
134
|
+
createTextConversationRequest: { contact_key: "user-42", agent_id },
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
await talqing.conversations.messages.create({
|
|
138
|
+
textMessageRequest: {
|
|
139
|
+
contact_key: "user-42",
|
|
140
|
+
message: "Hello",
|
|
141
|
+
client_message_id: crypto.randomUUID(),
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Web calls
|
|
147
|
+
|
|
148
|
+
Voice and video agents take a LiveKit room token. The `/browser` entrypoint
|
|
149
|
+
wraps the whole join — installing this package is all a tenant needs.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { TalqingSessionProvider, useTalqingSession } from "@talqing/sdk/browser";
|
|
153
|
+
|
|
154
|
+
function App({ agentId }: { agentId: string }) {
|
|
155
|
+
const session = useTalqingSession({ client: talqing, agentId });
|
|
156
|
+
return (
|
|
157
|
+
<TalqingSessionProvider session={session}>
|
|
158
|
+
<Call />
|
|
159
|
+
</TalqingSessionProvider>
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
It also carries `useTalqingImages` for attaching a photo mid-call,
|
|
165
|
+
`useTalqingFrontendRpcs` for tools that call back into your page,
|
|
166
|
+
`useTalqingUserdata`, `useTalqingAvatarTrack` and `TalqingVideoTrack` for a
|
|
167
|
+
video agent, and audio capture defaults with echo cancellation on — without
|
|
168
|
+
which the agent hears its own speech through the microphone.
|
|
169
|
+
|
|
170
|
+
## Types
|
|
171
|
+
|
|
172
|
+
Every request and response shape is exported, named as the API names it:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import type { AgentConfig, AgentResponse, CallOutcome, OperationRequest } from "@talqing/sdk";
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`Page<T>` is the shape every list endpoint returns. OpenAPI has no generics, so
|
|
179
|
+
the document spells each instantiation out (`PageAgentResponse`); TypeScript is
|
|
180
|
+
structural, so those satisfy `Page<AgentResponse>` and generic helpers work.
|
|
181
|
+
|
|
182
|
+
## Regenerating
|
|
183
|
+
|
|
184
|
+
`src/gen` is generated and checked in. After re-running `openapi/export.py`:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm run generate # rewrite it
|
|
188
|
+
npm run generate:check # or just assert it is current
|
|
189
|
+
npm run build # dist/, which the dashboard resolves through
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Everything else in `src` is hand-written: the client, the error, the pagination
|
|
193
|
+
helper and the LiveKit layer — what the document cannot say.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Room, type RoomOptions } from "livekit-client";
|
|
3
|
+
import { type ReceivedMessage, type TrackReference, type UseSessionReturn } from "@livekit/components-react";
|
|
4
|
+
import type { JsonObject, JsonValue, TalqingClient } from "./client.js";
|
|
5
|
+
import type { ScreenShareCaptureOptions, TrackPublishOptions } from "livekit-client";
|
|
6
|
+
import type { CallTokenResponse, TokenRequest } from "./gen/types.gen.js";
|
|
7
|
+
/** Everything about one web call except which agent runs it. Wire-shaped, like
|
|
8
|
+
* every other request type in this SDK. */
|
|
9
|
+
export type TalqingCallOptions = Omit<TokenRequest, "agent_id">;
|
|
10
|
+
export interface TalqingBrowserSessionOptions {
|
|
11
|
+
client: TalqingClient;
|
|
12
|
+
agentId: string | null;
|
|
13
|
+
roomOptions?: RoomOptions;
|
|
14
|
+
callOptions?: TalqingCallOptions;
|
|
15
|
+
onTokenDetails?: (details: CallTokenResponse) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface TalqingRpcInvocation {
|
|
18
|
+
payload: string;
|
|
19
|
+
responseTimeout?: number;
|
|
20
|
+
callerIdentity?: string;
|
|
21
|
+
}
|
|
22
|
+
export type TalqingRpcHandler = (data: TalqingRpcInvocation) => string | Promise<string>;
|
|
23
|
+
export type TalqingRpcHandlers = Record<string, TalqingRpcHandler>;
|
|
24
|
+
export interface TalqingFrontendRpcEnvelope {
|
|
25
|
+
method: string;
|
|
26
|
+
payload?: JsonValue;
|
|
27
|
+
}
|
|
28
|
+
export declare class TalqingRpcError extends Error {
|
|
29
|
+
readonly code: number;
|
|
30
|
+
readonly data?: string;
|
|
31
|
+
constructor(code: number, message: string, data?: string);
|
|
32
|
+
}
|
|
33
|
+
export type TalqingSession = UseSessionReturn;
|
|
34
|
+
export type TalqingMessage = ReceivedMessage;
|
|
35
|
+
export type TalqingVideoTrackRef = TrackReference;
|
|
36
|
+
export declare function createTalqingTokenSource(client: TalqingClient, agentId: string | null, options?: TalqingCallOptions, onTokenDetails?: (details: CallTokenResponse) => void): import("livekit-client").TokenSourceLiteral;
|
|
37
|
+
export declare const TALQING_AUDIO_CAPTURE_DEFAULTS: {
|
|
38
|
+
readonly echoCancellation: true;
|
|
39
|
+
readonly noiseSuppression: true;
|
|
40
|
+
readonly autoGainControl: true;
|
|
41
|
+
};
|
|
42
|
+
export declare function useTalqingSession({ client, agentId, roomOptions, callOptions, onTokenDetails, }: TalqingBrowserSessionOptions): TalqingSession;
|
|
43
|
+
export declare function TalqingSessionProvider({ session, children, audio, }: {
|
|
44
|
+
session: TalqingSession;
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
audio?: boolean;
|
|
47
|
+
}): React.JSX.Element;
|
|
48
|
+
export declare function useTalqingConnection(): {
|
|
49
|
+
isConnected: boolean;
|
|
50
|
+
connectionState: import("livekit-client").ConnectionState;
|
|
51
|
+
room: Room;
|
|
52
|
+
start: (options?: import("@livekit/components-react").SessionConnectOptions) => Promise<void>;
|
|
53
|
+
end: () => Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
export declare function setTalqingUserdata(room: Room, patch: JsonObject, responseTimeout?: number): Promise<{
|
|
56
|
+
ok: boolean;
|
|
57
|
+
error?: string;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function getTalqingUserdata(room: Room, keys?: string[], responseTimeout?: number): Promise<JsonObject>;
|
|
60
|
+
export declare function useTalqingUserdata(): {
|
|
61
|
+
get: (keys?: string[], responseTimeout?: number) => Promise<JsonObject>;
|
|
62
|
+
set: (patch: JsonObject, responseTimeout?: number) => Promise<{
|
|
63
|
+
ok: boolean;
|
|
64
|
+
error?: string;
|
|
65
|
+
}>;
|
|
66
|
+
};
|
|
67
|
+
export declare const TALQING_IMAGE_TOPIC = "talqing.images";
|
|
68
|
+
/** Decoded size the server refuses above. The downscale below keeps a phone
|
|
69
|
+
* photo far under it; this is the belt for a file that is not a photo. */
|
|
70
|
+
export declare const TALQING_IMAGE_MAX_BYTES: number;
|
|
71
|
+
/** Longest side the server stores. Downscaling to it before sending is a
|
|
72
|
+
* courtesy to the data channel, which is ordered and reliable and will
|
|
73
|
+
* happily spend a minute pushing 10 MB past a call's audio. */
|
|
74
|
+
export declare const TALQING_IMAGE_MAX_EDGE_PX = 1568;
|
|
75
|
+
export type TalqingImageStatus = "sending" | "sent" | "failed" | "unknown";
|
|
76
|
+
export interface TalqingSentImage {
|
|
77
|
+
/** The stream id `sendFile` returned, which the ack comes back under. */
|
|
78
|
+
streamId: string;
|
|
79
|
+
name: string;
|
|
80
|
+
/** An object URL for the downscaled image, for rendering the thumbnail.
|
|
81
|
+
* Revoked when the hook unmounts. */
|
|
82
|
+
previewUrl: string;
|
|
83
|
+
status: TalqingImageStatus;
|
|
84
|
+
/** Set when `status` is "failed" or "unknown" — a sentence, shown as-is. */
|
|
85
|
+
error?: string;
|
|
86
|
+
}
|
|
87
|
+
/** Refuse what the browser can see is wrong, instantly and with no round trip.
|
|
88
|
+
* Returns the sentence to show, or null when the file is fine. The server
|
|
89
|
+
* re-validates everything regardless — this exists so the common mistakes cost
|
|
90
|
+
* nothing to catch. */
|
|
91
|
+
export declare function talqingImageRejection(file: File): string | null;
|
|
92
|
+
/** Downscale to the longest edge the server keeps, re-encoding as JPEG or PNG.
|
|
93
|
+
*
|
|
94
|
+
* Also what normalizes whatever the OS handed the file input — this is how a
|
|
95
|
+
* Safari HEIC becomes a JPEG. Throws if the image cannot be decoded, which is
|
|
96
|
+
* the third dropzone check. */
|
|
97
|
+
export declare function talqingDownscaleImage(file: File): Promise<Blob>;
|
|
98
|
+
/** Validate and downscale a file into the `data:` URL a text message carries.
|
|
99
|
+
*
|
|
100
|
+
* `createTextMessage` takes `images: [{data_url, filename}]`; this produces the
|
|
101
|
+
* `data_url`. It doubles as the thumbnail's `src`, so there is no object URL to
|
|
102
|
+
* create and revoke. Throws the sentence to show if the file is refused. */
|
|
103
|
+
export declare function talqingImageDataUrl(file: File): Promise<string>;
|
|
104
|
+
/** Send images to the agent on this call, and follow what became of each.
|
|
105
|
+
*
|
|
106
|
+
* `send` resolves once the bytes are on their way; the outcome arrives on the
|
|
107
|
+
* returned list, which is what a thumbnail should render.
|
|
108
|
+
*
|
|
109
|
+
* Takes the `Room` rather than reading it from the session context: a byte
|
|
110
|
+
* stream and an RPC handler are room-level things, and passing the room keeps
|
|
111
|
+
* this usable from a surface that manages its own connection —
|
|
112
|
+
* `useTalqingConnection().room` inside a provider, or the Room you built. */
|
|
113
|
+
export declare function useTalqingImages(room: Room | null | undefined): {
|
|
114
|
+
send: (file: File) => Promise<TalqingSentImage>;
|
|
115
|
+
sent: TalqingSentImage[];
|
|
116
|
+
clear: () => void;
|
|
117
|
+
};
|
|
118
|
+
export declare function useTalqingAgent(): {
|
|
119
|
+
state: "failed" | "idle" | "connecting" | "disconnected" | "listening" | "thinking" | "speaking" | "pre-connect-buffering" | "initializing";
|
|
120
|
+
isFinished: boolean;
|
|
121
|
+
};
|
|
122
|
+
export declare function useTalqingMessages(): {
|
|
123
|
+
messages: ReceivedMessage[];
|
|
124
|
+
send: (message: string, options?: import("livekit-client").SendTextOptions) => Promise<import("@livekit/components-react").ReceivedChatMessage>;
|
|
125
|
+
isSending: boolean;
|
|
126
|
+
};
|
|
127
|
+
export declare const TALQING_SCREEN_SHARE_CAPTURE: ScreenShareCaptureOptions;
|
|
128
|
+
export declare const TALQING_SCREEN_SHARE_PUBLISH: TrackPublishOptions;
|
|
129
|
+
export declare function useTalqingScreenShare(): {
|
|
130
|
+
/** Whether a screen is being shared right now. */
|
|
131
|
+
enabled: boolean;
|
|
132
|
+
/** True while the browser picker is open or the track is publishing. */
|
|
133
|
+
pending: boolean;
|
|
134
|
+
/** Opens the browser's share picker. Must be called from a user gesture. */
|
|
135
|
+
start: () => Promise<void> | Promise<boolean | undefined>;
|
|
136
|
+
/** Stops sharing. The agent is told it can no longer see on the next turn. */
|
|
137
|
+
stop: () => Promise<void> | Promise<boolean | undefined>;
|
|
138
|
+
};
|
|
139
|
+
export declare function useTalqingAvatarTrack(): TalqingVideoTrackRef | undefined;
|
|
140
|
+
export declare function TalqingVideoTrack({ track, className, }: {
|
|
141
|
+
track: TalqingVideoTrackRef;
|
|
142
|
+
className?: string;
|
|
143
|
+
}): React.JSX.Element;
|
|
144
|
+
export declare function useTalqingRpcHandlers(handlers: TalqingRpcHandlers, enabled?: boolean): void;
|
|
145
|
+
export declare function useTalqingFrontendRpcs(enabled?: boolean): {
|
|
146
|
+
actions: Record<string, {
|
|
147
|
+
payload?: JsonValue;
|
|
148
|
+
at: number;
|
|
149
|
+
}>;
|
|
150
|
+
clear: () => void;
|
|
151
|
+
};
|
|
152
|
+
export declare function setTalqingBrowserLogLevel(level: "debug" | "info" | "warn" | "error" | "silent"): void;
|
|
153
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAEL,IAAI,EAMJ,KAAK,WAAW,E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