@rymi/node 1.0.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 +40 -0
- package/dist/index.d.mts +763 -0
- package/dist/index.d.ts +763 -0
- package/dist/index.js +596 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +546 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import { Agent } from '@rymi/sdk-types';
|
|
2
|
+
export * from '@rymi/sdk-types';
|
|
3
|
+
|
|
4
|
+
interface ClientOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The Rymi secret API key (`rymi_...`)
|
|
7
|
+
*/
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The base URL for the API. Defaults to `https://api.rymi.live/v1`
|
|
11
|
+
*/
|
|
12
|
+
baseURL?: string;
|
|
13
|
+
}
|
|
14
|
+
declare class RymiError extends Error {
|
|
15
|
+
status?: number;
|
|
16
|
+
code?: string;
|
|
17
|
+
constructor(message: string, status?: number, code?: string);
|
|
18
|
+
}
|
|
19
|
+
declare class RymiClient {
|
|
20
|
+
private apiKey;
|
|
21
|
+
private baseURL;
|
|
22
|
+
constructor(options?: ClientOptions);
|
|
23
|
+
private request;
|
|
24
|
+
get<T>(path: string): Promise<T>;
|
|
25
|
+
post<T>(path: string, body?: any): Promise<T>;
|
|
26
|
+
put<T>(path: string, body?: any): Promise<T>;
|
|
27
|
+
patch<T>(path: string, body?: any): Promise<T>;
|
|
28
|
+
delete<T>(path: string): Promise<T>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface CreateAgentParams {
|
|
32
|
+
name: string;
|
|
33
|
+
/** @deprecated Use system_prompt. This alias is mapped before the request is sent. */
|
|
34
|
+
prompt?: string;
|
|
35
|
+
system_prompt?: string;
|
|
36
|
+
voice?: string;
|
|
37
|
+
persona?: any;
|
|
38
|
+
playbook?: any;
|
|
39
|
+
advanced?: any;
|
|
40
|
+
features?: any;
|
|
41
|
+
post_call?: any;
|
|
42
|
+
llm_provider?: 'gemini' | 'openai' | 'anthropic' | 'sarvam';
|
|
43
|
+
llm_model?: string;
|
|
44
|
+
llm_fallback_provider?: string | null;
|
|
45
|
+
llm_fallback_model?: string | null;
|
|
46
|
+
stt_provider?: string;
|
|
47
|
+
stt_model?: string;
|
|
48
|
+
stt_fallback_provider?: string | null;
|
|
49
|
+
stt_fallback_model?: string | null;
|
|
50
|
+
tts_provider?: string;
|
|
51
|
+
tts_model?: string;
|
|
52
|
+
tts_fallback_provider?: string | null;
|
|
53
|
+
tts_fallback_model?: string | null;
|
|
54
|
+
/** Self-hosted endpoint URLs (https:// or wss://). Enterprise only. */
|
|
55
|
+
custom_llm_url?: string | null;
|
|
56
|
+
custom_voice_url?: string | null;
|
|
57
|
+
custom_voice_mode?: 'rymi' | 'openai-compat';
|
|
58
|
+
custom_transcriber_url?: string | null;
|
|
59
|
+
agent_role?: 'operator' | 'specialist' | 'executive' | 'concierge';
|
|
60
|
+
language?: string | null;
|
|
61
|
+
/** All BCP-47 languages the agent should handle, e.g. ["hi-IN","en-US"] for a bilingual agent. */
|
|
62
|
+
supported_languages?: string[];
|
|
63
|
+
provider_config?: any;
|
|
64
|
+
}
|
|
65
|
+
interface UpdateAgentParams {
|
|
66
|
+
name?: string;
|
|
67
|
+
/** @deprecated Use system_prompt. This alias is mapped before the request is sent. */
|
|
68
|
+
prompt?: string;
|
|
69
|
+
system_prompt?: string;
|
|
70
|
+
voice?: string;
|
|
71
|
+
persona?: any;
|
|
72
|
+
playbook?: any;
|
|
73
|
+
advanced?: any;
|
|
74
|
+
features?: any;
|
|
75
|
+
post_call?: any;
|
|
76
|
+
llm_provider?: 'gemini' | 'openai' | 'anthropic' | 'sarvam';
|
|
77
|
+
llm_model?: string;
|
|
78
|
+
llm_fallback_provider?: string | null;
|
|
79
|
+
llm_fallback_model?: string | null;
|
|
80
|
+
stt_provider?: string;
|
|
81
|
+
stt_model?: string;
|
|
82
|
+
stt_fallback_provider?: string | null;
|
|
83
|
+
stt_fallback_model?: string | null;
|
|
84
|
+
tts_provider?: string;
|
|
85
|
+
tts_model?: string;
|
|
86
|
+
tts_fallback_provider?: string | null;
|
|
87
|
+
tts_fallback_model?: string | null;
|
|
88
|
+
/** Self-hosted endpoint URLs (https:// or wss://). Enterprise only. */
|
|
89
|
+
custom_llm_url?: string | null;
|
|
90
|
+
custom_voice_url?: string | null;
|
|
91
|
+
custom_voice_mode?: 'rymi' | 'openai-compat';
|
|
92
|
+
custom_transcriber_url?: string | null;
|
|
93
|
+
agent_role?: 'operator' | 'specialist' | 'executive' | 'concierge';
|
|
94
|
+
language?: string | null;
|
|
95
|
+
/** All BCP-47 languages the agent should handle, e.g. ["hi-IN","en-US"] for a bilingual agent. */
|
|
96
|
+
supported_languages?: string[];
|
|
97
|
+
chat_summary?: string | null;
|
|
98
|
+
provider_config?: any;
|
|
99
|
+
}
|
|
100
|
+
interface AgentListResponse {
|
|
101
|
+
agents: Agent[];
|
|
102
|
+
total: number;
|
|
103
|
+
offset: number;
|
|
104
|
+
limit: number;
|
|
105
|
+
}
|
|
106
|
+
interface AgentCallListResponse {
|
|
107
|
+
calls: any[];
|
|
108
|
+
total: number;
|
|
109
|
+
offset: number;
|
|
110
|
+
limit: number;
|
|
111
|
+
agent_id: string;
|
|
112
|
+
}
|
|
113
|
+
interface ValidatePublishParams {
|
|
114
|
+
agent_id?: string;
|
|
115
|
+
name?: string;
|
|
116
|
+
voice?: string;
|
|
117
|
+
persona?: any;
|
|
118
|
+
playbook?: any;
|
|
119
|
+
advanced?: any;
|
|
120
|
+
features?: any;
|
|
121
|
+
post_call?: any;
|
|
122
|
+
[key: string]: any;
|
|
123
|
+
}
|
|
124
|
+
interface ChangeEntry {
|
|
125
|
+
key: string;
|
|
126
|
+
value: any;
|
|
127
|
+
}
|
|
128
|
+
interface ApplyChangesParams {
|
|
129
|
+
currentConfig: Record<string, any>;
|
|
130
|
+
changes: ChangeEntry[];
|
|
131
|
+
mode: 'create' | 'edit';
|
|
132
|
+
lenient?: boolean;
|
|
133
|
+
}
|
|
134
|
+
interface ApplyChangesResponse {
|
|
135
|
+
valid: true;
|
|
136
|
+
config: Record<string, any>;
|
|
137
|
+
applied: ChangeEntry[];
|
|
138
|
+
}
|
|
139
|
+
interface EnrichCompanyParams {
|
|
140
|
+
companyName: string;
|
|
141
|
+
websiteUrl: string;
|
|
142
|
+
}
|
|
143
|
+
interface EnrichCompanyResponse {
|
|
144
|
+
enriched: boolean;
|
|
145
|
+
companyDescription?: string;
|
|
146
|
+
knowledgeBase?: any[];
|
|
147
|
+
error?: string;
|
|
148
|
+
}
|
|
149
|
+
interface PreviewStackParams {
|
|
150
|
+
/** Cost/capability role. `concierge` is not supported by this endpoint. */
|
|
151
|
+
agent_role?: 'operator' | 'specialist' | 'executive';
|
|
152
|
+
role?: 'operator' | 'specialist' | 'executive';
|
|
153
|
+
language?: string | null;
|
|
154
|
+
/** Required, non-empty list of BCP-47 languages to resolve a stack for. */
|
|
155
|
+
supported_languages: string[];
|
|
156
|
+
current_provider_config?: Record<string, any> | null;
|
|
157
|
+
}
|
|
158
|
+
interface AgentKnowledgeSource {
|
|
159
|
+
id: string;
|
|
160
|
+
kind?: 'text' | 'url';
|
|
161
|
+
title?: string;
|
|
162
|
+
source_uri?: string | null;
|
|
163
|
+
bytes?: number;
|
|
164
|
+
created_at?: string;
|
|
165
|
+
[key: string]: any;
|
|
166
|
+
}
|
|
167
|
+
type AddKnowledgeSourceParams = {
|
|
168
|
+
kind: 'text';
|
|
169
|
+
title: string;
|
|
170
|
+
text: string;
|
|
171
|
+
} | {
|
|
172
|
+
kind: 'url';
|
|
173
|
+
title: string;
|
|
174
|
+
url: string;
|
|
175
|
+
};
|
|
176
|
+
interface AgentChange {
|
|
177
|
+
change_id: string;
|
|
178
|
+
field_path?: string;
|
|
179
|
+
before_jsonb?: any;
|
|
180
|
+
after_jsonb?: any;
|
|
181
|
+
changed_by?: string;
|
|
182
|
+
created_at?: string;
|
|
183
|
+
undone_at?: string | null;
|
|
184
|
+
[key: string]: any;
|
|
185
|
+
}
|
|
186
|
+
declare class AgentsResource {
|
|
187
|
+
private client;
|
|
188
|
+
constructor(client: RymiClient);
|
|
189
|
+
/**
|
|
190
|
+
* Retrieve a list of all your AI Agents.
|
|
191
|
+
*/
|
|
192
|
+
list(params?: {
|
|
193
|
+
limit?: number;
|
|
194
|
+
offset?: number;
|
|
195
|
+
}): Promise<AgentListResponse>;
|
|
196
|
+
/**
|
|
197
|
+
* Retrieve a single AI Agent by its unique ID.
|
|
198
|
+
*/
|
|
199
|
+
retrieve(agentId: string): Promise<Agent>;
|
|
200
|
+
/**
|
|
201
|
+
* Create a new AI Agent with a complete system prompt and voice settings.
|
|
202
|
+
*/
|
|
203
|
+
create(data: CreateAgentParams): Promise<{
|
|
204
|
+
status: 'created';
|
|
205
|
+
id: string;
|
|
206
|
+
}>;
|
|
207
|
+
/**
|
|
208
|
+
* Update an existing AI Agent's persona or configuration.
|
|
209
|
+
*/
|
|
210
|
+
update(agentId: string, data: UpdateAgentParams): Promise<{
|
|
211
|
+
status: 'updated';
|
|
212
|
+
}>;
|
|
213
|
+
/**
|
|
214
|
+
* Delete an AI Agent permanently.
|
|
215
|
+
*/
|
|
216
|
+
delete(agentId: string): Promise<{
|
|
217
|
+
status: 'deleted';
|
|
218
|
+
id: string;
|
|
219
|
+
}>;
|
|
220
|
+
llmOptions(): Promise<{
|
|
221
|
+
models: any[];
|
|
222
|
+
voices: any[];
|
|
223
|
+
}>;
|
|
224
|
+
generate(data: {
|
|
225
|
+
prompt: string;
|
|
226
|
+
options?: Record<string, any>;
|
|
227
|
+
}): Promise<Record<string, any>>;
|
|
228
|
+
/**
|
|
229
|
+
* List calls made with a specific agent.
|
|
230
|
+
*/
|
|
231
|
+
listCalls(agentId: string, params?: {
|
|
232
|
+
limit?: number;
|
|
233
|
+
offset?: number;
|
|
234
|
+
status?: string;
|
|
235
|
+
}): Promise<AgentCallListResponse>;
|
|
236
|
+
/**
|
|
237
|
+
* Duplicate an existing agent. The clone gets " (Copy)" appended to its name.
|
|
238
|
+
*/
|
|
239
|
+
clone(agentId: string): Promise<{
|
|
240
|
+
status: 'created';
|
|
241
|
+
id: string;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Validate an agent's configuration before publishing.
|
|
245
|
+
* Pass agent_id to merge with an existing persisted agent, or supply fields directly.
|
|
246
|
+
*/
|
|
247
|
+
validatePublish(params: ValidatePublishParams): Promise<Record<string, any>>;
|
|
248
|
+
/**
|
|
249
|
+
* Validate and apply a flat-diff change-set against the AgentConfig field registry.
|
|
250
|
+
* Does NOT persist — callers must follow up with update().
|
|
251
|
+
*/
|
|
252
|
+
applyChanges(params: ApplyChangesParams): Promise<ApplyChangesResponse>;
|
|
253
|
+
/**
|
|
254
|
+
* Use AI with Google Search grounding to generate a company description from a website URL.
|
|
255
|
+
*/
|
|
256
|
+
enrichCompany(params: EnrichCompanyParams): Promise<EnrichCompanyResponse>;
|
|
257
|
+
/**
|
|
258
|
+
* Preview the resolved per-language model stack (STT/LLM/TTS), blockers,
|
|
259
|
+
* warnings, model diffs, and any required role upgrades for a set of
|
|
260
|
+
* supported languages — without persisting anything. Note: the concierge
|
|
261
|
+
* (realtime) role is not supported by this endpoint.
|
|
262
|
+
*/
|
|
263
|
+
previewStack(params: PreviewStackParams): Promise<Record<string, any>>;
|
|
264
|
+
/**
|
|
265
|
+
* List the knowledge sources (RAG context) attached to an agent.
|
|
266
|
+
*/
|
|
267
|
+
listKnowledgeSources(agentId: string): Promise<{
|
|
268
|
+
sources: AgentKnowledgeSource[];
|
|
269
|
+
}>;
|
|
270
|
+
/**
|
|
271
|
+
* Add a knowledge source to an agent from raw text or a URL.
|
|
272
|
+
*/
|
|
273
|
+
addKnowledgeSource(agentId: string, data: AddKnowledgeSourceParams): Promise<Record<string, any>>;
|
|
274
|
+
/**
|
|
275
|
+
* Delete a knowledge source from an agent.
|
|
276
|
+
*/
|
|
277
|
+
deleteKnowledgeSource(agentId: string, sourceId: string): Promise<Record<string, any>>;
|
|
278
|
+
/**
|
|
279
|
+
* List the recorded configuration changes for an agent (most recent first).
|
|
280
|
+
* Optionally pass an ISO timestamp to only return changes since then.
|
|
281
|
+
*/
|
|
282
|
+
listChanges(agentId: string, params?: {
|
|
283
|
+
since?: string;
|
|
284
|
+
}): Promise<{
|
|
285
|
+
changes: AgentChange[];
|
|
286
|
+
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Undo a single recorded configuration change, reverting that field to its
|
|
289
|
+
* previous value. Returns the resulting agent snapshot.
|
|
290
|
+
*/
|
|
291
|
+
undoChange(agentId: string, changeId: string): Promise<{
|
|
292
|
+
ok: boolean;
|
|
293
|
+
changeId: string;
|
|
294
|
+
agentSnapshot: Agent;
|
|
295
|
+
}>;
|
|
296
|
+
/**
|
|
297
|
+
* Run the evaluation suite for an agent. mode="synthetic" (default) uses
|
|
298
|
+
* the offline scorer; mode="live" runs the model-driven runner.
|
|
299
|
+
*/
|
|
300
|
+
runEvals(agentId: string, params?: {
|
|
301
|
+
mode?: 'synthetic' | 'live';
|
|
302
|
+
}): Promise<Record<string, any>>;
|
|
303
|
+
/**
|
|
304
|
+
* List previous evaluation runs for an agent.
|
|
305
|
+
*/
|
|
306
|
+
listEvalRuns(agentId: string): Promise<Record<string, any>>;
|
|
307
|
+
/**
|
|
308
|
+
* Retrieve a single evaluation run, including per-scenario scores.
|
|
309
|
+
*/
|
|
310
|
+
getEvalRun(agentId: string, runId: string): Promise<Record<string, any>>;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
interface ListCallsParams {
|
|
314
|
+
limit?: number;
|
|
315
|
+
offset?: number;
|
|
316
|
+
cursor?: string;
|
|
317
|
+
status?: string;
|
|
318
|
+
}
|
|
319
|
+
interface CallRecord {
|
|
320
|
+
id: string;
|
|
321
|
+
agent_id: string;
|
|
322
|
+
room_name: string;
|
|
323
|
+
status: 'queued' | 'ringing' | 'in_progress' | 'completed' | 'failed' | 'busy' | 'canceled';
|
|
324
|
+
duration_seconds?: number;
|
|
325
|
+
started_at?: string;
|
|
326
|
+
ended_at?: string;
|
|
327
|
+
participants?: Array<{
|
|
328
|
+
id: string;
|
|
329
|
+
role: 'agent' | 'customer' | 'observer';
|
|
330
|
+
transport: 'webrtc' | 'pstn' | 'sip' | 'internal';
|
|
331
|
+
identity: string;
|
|
332
|
+
status: string;
|
|
333
|
+
}>;
|
|
334
|
+
metadata?: Record<string, any>;
|
|
335
|
+
intelligence_status?: string;
|
|
336
|
+
participant_count?: number;
|
|
337
|
+
primary_participant?: Record<string, any> | null;
|
|
338
|
+
total_cost?: number;
|
|
339
|
+
provider_cost?: number;
|
|
340
|
+
provider_cost_breakdown?: Record<string, any>;
|
|
341
|
+
provider_cost_calculated_at?: string | null;
|
|
342
|
+
bill_duration?: number;
|
|
343
|
+
}
|
|
344
|
+
interface CallListResponse {
|
|
345
|
+
calls: CallRecord[];
|
|
346
|
+
total: number;
|
|
347
|
+
limit: number;
|
|
348
|
+
offset: number;
|
|
349
|
+
next_cursor?: string | null;
|
|
350
|
+
}
|
|
351
|
+
interface CreateCallParams {
|
|
352
|
+
agent_id: string;
|
|
353
|
+
participants: Array<{
|
|
354
|
+
transport: 'webrtc' | 'pstn';
|
|
355
|
+
identity: string;
|
|
356
|
+
from_number?: string;
|
|
357
|
+
metadata?: Record<string, any>;
|
|
358
|
+
}>;
|
|
359
|
+
metadata?: Record<string, any>;
|
|
360
|
+
variables?: Record<string, any>;
|
|
361
|
+
post_call?: Record<string, any>;
|
|
362
|
+
}
|
|
363
|
+
interface BatchCallParams {
|
|
364
|
+
agent_id: string;
|
|
365
|
+
to?: string[];
|
|
366
|
+
recipients?: Array<{
|
|
367
|
+
to?: string;
|
|
368
|
+
identity?: string;
|
|
369
|
+
phone?: string;
|
|
370
|
+
phone_number?: string;
|
|
371
|
+
from_number?: string;
|
|
372
|
+
metadata?: Record<string, any>;
|
|
373
|
+
}>;
|
|
374
|
+
from_number?: string;
|
|
375
|
+
batch_id?: string;
|
|
376
|
+
metadata?: Record<string, any>;
|
|
377
|
+
variables?: Record<string, any>;
|
|
378
|
+
post_call?: Record<string, any>;
|
|
379
|
+
}
|
|
380
|
+
interface CreateCallResponse {
|
|
381
|
+
id: string;
|
|
382
|
+
room_name: string;
|
|
383
|
+
status: string;
|
|
384
|
+
participants: Array<{
|
|
385
|
+
id: string;
|
|
386
|
+
transport: 'webrtc' | 'pstn';
|
|
387
|
+
identity: string;
|
|
388
|
+
status: string;
|
|
389
|
+
access?: {
|
|
390
|
+
url: string;
|
|
391
|
+
token: string;
|
|
392
|
+
};
|
|
393
|
+
telephony_leg_id?: string;
|
|
394
|
+
job_id?: string;
|
|
395
|
+
}>;
|
|
396
|
+
agent?: {
|
|
397
|
+
id: string;
|
|
398
|
+
name: string;
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
declare class CallsResource {
|
|
402
|
+
private client;
|
|
403
|
+
constructor(client: RymiClient);
|
|
404
|
+
/**
|
|
405
|
+
* Retrieve a list of all previous and active calls.
|
|
406
|
+
*/
|
|
407
|
+
list(params?: ListCallsParams): Promise<CallListResponse>;
|
|
408
|
+
/**
|
|
409
|
+
* Retrieve calls currently in progress.
|
|
410
|
+
*/
|
|
411
|
+
active(params?: ListCallsParams): Promise<CallListResponse>;
|
|
412
|
+
/**
|
|
413
|
+
* Retrieve details, transcripts, and analysis of a single call by its unique ID.
|
|
414
|
+
*/
|
|
415
|
+
retrieve(callId: string): Promise<CallRecord>;
|
|
416
|
+
/**
|
|
417
|
+
* Dispatch an outbound phone call securely using your configured carrier.
|
|
418
|
+
*/
|
|
419
|
+
create(data: CreateCallParams): Promise<CreateCallResponse>;
|
|
420
|
+
/**
|
|
421
|
+
* Queue up to 500 outbound PSTN recipients in one request.
|
|
422
|
+
*/
|
|
423
|
+
batch(data: BatchCallParams): Promise<CreateCallResponse & {
|
|
424
|
+
batch_id: string;
|
|
425
|
+
queued: number;
|
|
426
|
+
}>;
|
|
427
|
+
summary(callId: string): Promise<Record<string, any>>;
|
|
428
|
+
transcript(callId: string): Promise<Record<string, any>>;
|
|
429
|
+
recording(callId: string): Promise<Record<string, any>>;
|
|
430
|
+
reprocess(callId: string): Promise<Record<string, any>>;
|
|
431
|
+
/** Force-end an active call. Irreversible — closes the LiveKit room and triggers post-call processing. */
|
|
432
|
+
end(callId: string): Promise<{
|
|
433
|
+
status: string;
|
|
434
|
+
id: string;
|
|
435
|
+
message: string;
|
|
436
|
+
}>;
|
|
437
|
+
/** Add one or more participants to an in-progress call (warm transfer / conference). */
|
|
438
|
+
addParticipants(callId: string, data: {
|
|
439
|
+
participants: CreateCallParams['participants'];
|
|
440
|
+
}): Promise<CreateCallResponse>;
|
|
441
|
+
queueStats(): Promise<Record<string, number>>;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface DncEntry {
|
|
445
|
+
id?: string;
|
|
446
|
+
phone: string;
|
|
447
|
+
reason?: string;
|
|
448
|
+
created_at?: string;
|
|
449
|
+
}
|
|
450
|
+
interface DncListResponse {
|
|
451
|
+
dnc_entries: DncEntry[];
|
|
452
|
+
total: number;
|
|
453
|
+
offset: number;
|
|
454
|
+
limit: number;
|
|
455
|
+
}
|
|
456
|
+
interface DncCheckResult {
|
|
457
|
+
phone_number: string;
|
|
458
|
+
normalized: string | null;
|
|
459
|
+
blocked: boolean;
|
|
460
|
+
valid: boolean;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Do-Not-Call registry. Numbers are normalized to E.164 server-side on both
|
|
464
|
+
* write and read, so any input format is accepted.
|
|
465
|
+
*/
|
|
466
|
+
declare class DncResource {
|
|
467
|
+
private client;
|
|
468
|
+
constructor(client: RymiClient);
|
|
469
|
+
/** List all DNC entries for the tenant. */
|
|
470
|
+
list(params?: {
|
|
471
|
+
limit?: number;
|
|
472
|
+
offset?: number;
|
|
473
|
+
}): Promise<DncListResponse>;
|
|
474
|
+
/** Add a single number to the Do-Not-Call registry. */
|
|
475
|
+
add(data: {
|
|
476
|
+
phone_number: string;
|
|
477
|
+
reason?: string;
|
|
478
|
+
}): Promise<{
|
|
479
|
+
status: 'blocklisted';
|
|
480
|
+
phone_number: string;
|
|
481
|
+
}>;
|
|
482
|
+
/** Add up to 1000 numbers in one request. Invalid numbers are skipped and returned in `invalid`. */
|
|
483
|
+
addBatch(data: {
|
|
484
|
+
phone_numbers: string[];
|
|
485
|
+
reason?: string;
|
|
486
|
+
}): Promise<{
|
|
487
|
+
status: 'blocklisted';
|
|
488
|
+
count: number;
|
|
489
|
+
invalid_count: number;
|
|
490
|
+
invalid: string[];
|
|
491
|
+
}>;
|
|
492
|
+
/** Check up to 500 numbers without adding them. Read-only. */
|
|
493
|
+
check(data: {
|
|
494
|
+
phone_numbers: string[];
|
|
495
|
+
}): Promise<{
|
|
496
|
+
results: DncCheckResult[];
|
|
497
|
+
blocked_count: number;
|
|
498
|
+
total_checked: number;
|
|
499
|
+
}>;
|
|
500
|
+
/** Remove a number from the registry (re-enables outbound to it). */
|
|
501
|
+
remove(phone: string): Promise<{
|
|
502
|
+
status: 'removed';
|
|
503
|
+
phone: string;
|
|
504
|
+
}>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
interface NumberRecord {
|
|
508
|
+
id?: string;
|
|
509
|
+
number?: string;
|
|
510
|
+
phone_number?: string;
|
|
511
|
+
provider?: 'plivo' | 'twilio' | 'vonage';
|
|
512
|
+
capabilities?: string[];
|
|
513
|
+
price?: string | number;
|
|
514
|
+
monthly_price?: number;
|
|
515
|
+
agent_id?: string | null;
|
|
516
|
+
assigned_agent_id?: string | null;
|
|
517
|
+
created_at?: string;
|
|
518
|
+
}
|
|
519
|
+
declare class NumbersResource {
|
|
520
|
+
private client;
|
|
521
|
+
constructor(client: RymiClient);
|
|
522
|
+
/**
|
|
523
|
+
* Retrieve a list of all phone numbers assigned to your Rymi account.
|
|
524
|
+
*/
|
|
525
|
+
list(params?: {
|
|
526
|
+
limit?: number;
|
|
527
|
+
offset?: number;
|
|
528
|
+
}): Promise<{
|
|
529
|
+
numbers: NumberRecord[];
|
|
530
|
+
total: number;
|
|
531
|
+
offset: number;
|
|
532
|
+
limit: number;
|
|
533
|
+
}>;
|
|
534
|
+
register(number: string, params?: {
|
|
535
|
+
agent_id?: string;
|
|
536
|
+
}): Promise<{
|
|
537
|
+
status: 'registered';
|
|
538
|
+
number: string;
|
|
539
|
+
agent_id: string | null;
|
|
540
|
+
}>;
|
|
541
|
+
attach(number: string, agentId: string): Promise<{
|
|
542
|
+
status: 'attached';
|
|
543
|
+
agent_id: string;
|
|
544
|
+
number: string;
|
|
545
|
+
}>;
|
|
546
|
+
remove(number: string): Promise<{
|
|
547
|
+
status: 'removed';
|
|
548
|
+
number: string;
|
|
549
|
+
}>;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
interface WebhookRecord {
|
|
553
|
+
id: string;
|
|
554
|
+
url: string;
|
|
555
|
+
events: string[];
|
|
556
|
+
alert_email?: string | null;
|
|
557
|
+
created_at?: string;
|
|
558
|
+
}
|
|
559
|
+
declare class WebhooksResource {
|
|
560
|
+
private client;
|
|
561
|
+
constructor(client: RymiClient);
|
|
562
|
+
/** List registered webhook endpoints. The signing secret is never returned. */
|
|
563
|
+
list(params?: {
|
|
564
|
+
limit?: number;
|
|
565
|
+
offset?: number;
|
|
566
|
+
}): Promise<{
|
|
567
|
+
webhooks: WebhookRecord[];
|
|
568
|
+
total: number;
|
|
569
|
+
offset: number;
|
|
570
|
+
limit: number;
|
|
571
|
+
}>;
|
|
572
|
+
/** Register a webhook. `url` must be public https. `secret` must be 16–256 chars. */
|
|
573
|
+
create(data: {
|
|
574
|
+
url: string;
|
|
575
|
+
events: string[];
|
|
576
|
+
secret: string;
|
|
577
|
+
alert_email?: string;
|
|
578
|
+
}): Promise<{
|
|
579
|
+
status: 'registered';
|
|
580
|
+
}>;
|
|
581
|
+
/** Update a webhook. Only provided fields change. Pass `secret` to rotate it. */
|
|
582
|
+
update(id: string, data: {
|
|
583
|
+
url?: string;
|
|
584
|
+
events?: string[];
|
|
585
|
+
secret?: string;
|
|
586
|
+
alert_email?: string | null;
|
|
587
|
+
}): Promise<{
|
|
588
|
+
status: 'updated';
|
|
589
|
+
id: string;
|
|
590
|
+
}>;
|
|
591
|
+
/** Delete a webhook endpoint. */
|
|
592
|
+
delete(id: string): Promise<{
|
|
593
|
+
status: 'deleted';
|
|
594
|
+
id: string;
|
|
595
|
+
}>;
|
|
596
|
+
/**
|
|
597
|
+
* Verifies that a webhook received by your backend was genuinely dispatched by Rymi.
|
|
598
|
+
*
|
|
599
|
+
* Rymi endpoints secure webhooks by computing an HMAC-SHA256 signature
|
|
600
|
+
* of the raw JSON body concatenated with the timestamp, using your Webhook Secret.
|
|
601
|
+
*
|
|
602
|
+
* @param payload The raw stringified JSON body of the webhook hook request.
|
|
603
|
+
* @param signatureHeader The value of the `X-Rymi-Signature` header from the request.
|
|
604
|
+
* @param timestampHeader The value of the `X-Rymi-Timestamp` header from the request.
|
|
605
|
+
* @param webhookSecret Your project's unique Webhook Signing Secret (starts with `whsec_`)
|
|
606
|
+
* @param toleranceMillis Allowed time difference in milliseconds to prevent replay attacks (default 5 mins)
|
|
607
|
+
*
|
|
608
|
+
* @throws {Error} if the signature is invalid or if the timestamp exceeds the tolerance.
|
|
609
|
+
*/
|
|
610
|
+
verifySignature(payload: string, signatureHeader: string, timestampHeader: string, webhookSecret: string, toleranceMillis?: number): boolean;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
interface PublishableKeyRecord {
|
|
614
|
+
id: string;
|
|
615
|
+
key_prefix: string;
|
|
616
|
+
agent_id: string;
|
|
617
|
+
label: string;
|
|
618
|
+
allowed_channels: Array<'web' | 'phone'>;
|
|
619
|
+
audience: 'sdk' | 'landing_demo';
|
|
620
|
+
default_from_number: string | null;
|
|
621
|
+
created_at: string;
|
|
622
|
+
}
|
|
623
|
+
interface CreatePublishableKeyParams {
|
|
624
|
+
agent_id: string;
|
|
625
|
+
label: string;
|
|
626
|
+
allowed_channels?: Array<'web' | 'phone'>;
|
|
627
|
+
audience?: 'sdk' | 'landing_demo';
|
|
628
|
+
default_from_number?: string | null;
|
|
629
|
+
}
|
|
630
|
+
declare class KeysResource {
|
|
631
|
+
private client;
|
|
632
|
+
constructor(client: RymiClient);
|
|
633
|
+
listPublishable(): Promise<{
|
|
634
|
+
keys: PublishableKeyRecord[];
|
|
635
|
+
}>;
|
|
636
|
+
createPublishable(data: CreatePublishableKeyParams): Promise<CreatePublishableKeyParams & {
|
|
637
|
+
key: string;
|
|
638
|
+
}>;
|
|
639
|
+
revokePublishable(id: string): Promise<{
|
|
640
|
+
success: true;
|
|
641
|
+
}>;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
type TelephonyProvider = 'plivo' | 'twilio' | 'vonage';
|
|
645
|
+
interface ConnectTelephonyParams {
|
|
646
|
+
provider: TelephonyProvider;
|
|
647
|
+
auth_id?: string;
|
|
648
|
+
auth_token?: string;
|
|
649
|
+
api_key?: string;
|
|
650
|
+
api_secret?: string;
|
|
651
|
+
signature_secret?: string;
|
|
652
|
+
}
|
|
653
|
+
declare class TelephonyResource {
|
|
654
|
+
private client;
|
|
655
|
+
constructor(client: RymiClient);
|
|
656
|
+
connect(data: ConnectTelephonyParams): Promise<{
|
|
657
|
+
status: 'connected';
|
|
658
|
+
provider: TelephonyProvider;
|
|
659
|
+
account_name: string;
|
|
660
|
+
message: string;
|
|
661
|
+
}>;
|
|
662
|
+
disconnect(): Promise<{
|
|
663
|
+
status: 'disconnected';
|
|
664
|
+
message: string;
|
|
665
|
+
}>;
|
|
666
|
+
status(): Promise<{
|
|
667
|
+
connected: boolean;
|
|
668
|
+
provider: TelephonyProvider | null;
|
|
669
|
+
account_name: string | null;
|
|
670
|
+
account_country: string | null;
|
|
671
|
+
}>;
|
|
672
|
+
numbers(): Promise<{
|
|
673
|
+
numbers: any[];
|
|
674
|
+
}>;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
interface UsageSummary {
|
|
678
|
+
voice_runtime: {
|
|
679
|
+
remaining_minutes: number;
|
|
680
|
+
status: string;
|
|
681
|
+
};
|
|
682
|
+
studio_ai?: {
|
|
683
|
+
used_units?: number;
|
|
684
|
+
included_units?: number | null;
|
|
685
|
+
quota_percent?: number;
|
|
686
|
+
status?: string;
|
|
687
|
+
overage_enabled?: boolean;
|
|
688
|
+
};
|
|
689
|
+
post_call_intelligence?: {
|
|
690
|
+
status?: string;
|
|
691
|
+
used_units?: number;
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
declare class BillingResource {
|
|
695
|
+
private client;
|
|
696
|
+
constructor(client: RymiClient);
|
|
697
|
+
/**
|
|
698
|
+
* Lane-aware usage summary: remaining voice-runtime minutes, Studio AI unit
|
|
699
|
+
* usage, and post-call intelligence usage. Voice balance is reported in
|
|
700
|
+
* MINUTES (the customer-facing unit), not dollars.
|
|
701
|
+
*/
|
|
702
|
+
usageSummary(): Promise<UsageSummary>;
|
|
703
|
+
/** Estimate the cost of a call for a given tier and duration. */
|
|
704
|
+
estimate(data?: {
|
|
705
|
+
tier?: 'operator' | 'specialist' | 'executive' | 'concierge';
|
|
706
|
+
duration_seconds?: number;
|
|
707
|
+
}): Promise<Record<string, any>>;
|
|
708
|
+
/** Configure auto-recharge. Server rejects (400) if enabled && pack_usd <= threshold_usd. */
|
|
709
|
+
setAutoRecharge(data: {
|
|
710
|
+
enabled?: boolean;
|
|
711
|
+
pack_usd?: number;
|
|
712
|
+
threshold_usd?: number;
|
|
713
|
+
}): Promise<{
|
|
714
|
+
ok: true;
|
|
715
|
+
}>;
|
|
716
|
+
/** Configure spend-alert preferences. */
|
|
717
|
+
setAlerts(data: {
|
|
718
|
+
thresholds_usd?: number[];
|
|
719
|
+
low_balance_pct?: number;
|
|
720
|
+
email_enabled?: boolean;
|
|
721
|
+
}): Promise<{
|
|
722
|
+
ok: true;
|
|
723
|
+
}>;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
interface AgentTemplateSummary {
|
|
727
|
+
id?: string;
|
|
728
|
+
slug?: string;
|
|
729
|
+
label?: string;
|
|
730
|
+
description?: string;
|
|
731
|
+
icon?: string;
|
|
732
|
+
color?: string;
|
|
733
|
+
defaults?: Record<string, any>;
|
|
734
|
+
[key: string]: any;
|
|
735
|
+
}
|
|
736
|
+
declare class TemplatesResource {
|
|
737
|
+
private client;
|
|
738
|
+
constructor(client: RymiClient);
|
|
739
|
+
/**
|
|
740
|
+
* List published agent templates available to the current tenant. Use a
|
|
741
|
+
* template's `defaults` as the starting config for create_agent.
|
|
742
|
+
*/
|
|
743
|
+
list(): Promise<{
|
|
744
|
+
templates: AgentTemplateSummary[];
|
|
745
|
+
source?: string;
|
|
746
|
+
}>;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
declare class Rymi {
|
|
750
|
+
private client;
|
|
751
|
+
agents: AgentsResource;
|
|
752
|
+
calls: CallsResource;
|
|
753
|
+
dnc: DncResource;
|
|
754
|
+
numbers: NumbersResource;
|
|
755
|
+
webhooks: WebhooksResource;
|
|
756
|
+
keys: KeysResource;
|
|
757
|
+
telephony: TelephonyResource;
|
|
758
|
+
billing: BillingResource;
|
|
759
|
+
templates: TemplatesResource;
|
|
760
|
+
constructor(options?: ClientOptions);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export { type AddKnowledgeSourceParams, type AgentCallListResponse, type AgentChange, type AgentKnowledgeSource, type AgentListResponse, type AgentTemplateSummary, AgentsResource, type ApplyChangesParams, type ApplyChangesResponse, type BatchCallParams, BillingResource, type CallListResponse, type CallRecord, CallsResource, type ChangeEntry, type ClientOptions, type ConnectTelephonyParams, type CreateAgentParams, type CreateCallParams, type CreateCallResponse, type CreatePublishableKeyParams, type DncCheckResult, type DncEntry, type DncListResponse, DncResource, type EnrichCompanyParams, type EnrichCompanyResponse, KeysResource, type ListCallsParams, type NumberRecord, NumbersResource, type PreviewStackParams, type PublishableKeyRecord, Rymi, RymiClient, RymiError, type TelephonyProvider, TelephonyResource, TemplatesResource, type UpdateAgentParams, type UsageSummary, type ValidatePublishParams, type WebhookRecord, WebhooksResource, Rymi as default };
|