@craftedxp/sdk-node 0.10.1 → 0.15.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/README.md +106 -13
- package/dist/index.d.mts +306 -25
- package/dist/index.d.ts +306 -25
- package/dist/index.js +275 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +274 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ interface HttpRequest {
|
|
|
23
23
|
}
|
|
24
24
|
declare const createHttpClient: (opts: HttpClientOptions) => {
|
|
25
25
|
request: <T>(req: HttpRequest) => Promise<T>;
|
|
26
|
+
stream: <T = unknown>(req: HttpRequest) => AsyncIterable<T>;
|
|
26
27
|
};
|
|
27
28
|
type HttpClient = ReturnType<typeof createHttpClient>;
|
|
28
29
|
|
|
@@ -30,6 +31,16 @@ type TtsProvider = 'pockettts' | 'cartesia' | 'fish-audio' | 'gemini' | 'kokoro'
|
|
|
30
31
|
type SttProvider = 'deepgram';
|
|
31
32
|
type LlmProvider = 'gemini' | 'openai' | 'anthropic';
|
|
32
33
|
type EndpointingMode = 'smart' | 'simple';
|
|
34
|
+
/**
|
|
35
|
+
* Agent kind. Set at creation and immutable thereafter — changing what an
|
|
36
|
+
* agent does means creating a new one. Gates which routes accept the agent:
|
|
37
|
+
* - `assistant` — 1:1 voice + text chat + learning mode (LLM + STT + TTS)
|
|
38
|
+
* - `room` — hosts LiveKit rooms; per-speaker transcription + analysis
|
|
39
|
+
* - `transcribe` — 1:1 dictation, STT-only (the agent never speaks)
|
|
40
|
+
*
|
|
41
|
+
* Replaces the legacy `canHostRooms` / `transcribeOnly` boolean flags.
|
|
42
|
+
*/
|
|
43
|
+
type AgentType = 'assistant' | 'room' | 'transcribe';
|
|
33
44
|
interface AgentVoice {
|
|
34
45
|
provider: TtsProvider;
|
|
35
46
|
voiceId?: string;
|
|
@@ -108,6 +119,8 @@ interface AgentRecording {
|
|
|
108
119
|
interface Agent {
|
|
109
120
|
agentId: string;
|
|
110
121
|
orgId: string;
|
|
122
|
+
/** Agent kind — see {@link AgentType}. Immutable after creation. */
|
|
123
|
+
type: AgentType;
|
|
111
124
|
name: string;
|
|
112
125
|
systemPrompt: string;
|
|
113
126
|
/**
|
|
@@ -118,6 +131,8 @@ interface Agent {
|
|
|
118
131
|
* caller speaks first.
|
|
119
132
|
*/
|
|
120
133
|
agentSpeaksFirst?: boolean;
|
|
134
|
+
/** Personal assistant (`assistant` agents only) — the learning tools are live on every `ct_`-token call, not just `mode=learning`. */
|
|
135
|
+
isPersonal?: boolean;
|
|
121
136
|
voice: AgentVoice;
|
|
122
137
|
transcriber: AgentTranscriber;
|
|
123
138
|
model: AgentModel;
|
|
@@ -150,19 +165,22 @@ interface Agent {
|
|
|
150
165
|
* right gateway.
|
|
151
166
|
*/
|
|
152
167
|
transport?: 'ws' | 'webrtc';
|
|
153
|
-
/**
|
|
154
|
-
canHostRooms?: boolean;
|
|
155
|
-
/** Room operating mode (`'notes-only'` today). */
|
|
168
|
+
/** Room operating mode (`'notes-only'` today). Only set on `type: 'room'` agents. */
|
|
156
169
|
roomMode?: 'notes-only';
|
|
157
|
-
/** Transcribe-only mode — the agent listens but never speaks. */
|
|
158
|
-
transcribeOnly?: boolean;
|
|
159
170
|
createdAt: number;
|
|
160
171
|
updatedAt: number;
|
|
161
172
|
}
|
|
162
173
|
interface AgentCreateInput {
|
|
174
|
+
/**
|
|
175
|
+
* Agent kind — see {@link AgentType}. Required and immutable: it cannot be
|
|
176
|
+
* changed via {@link AgentUpdateInput} (it is omitted from that type).
|
|
177
|
+
*/
|
|
178
|
+
type: AgentType;
|
|
163
179
|
name: string;
|
|
164
180
|
systemPrompt: string;
|
|
165
181
|
agentSpeaksFirst?: boolean;
|
|
182
|
+
/** Personal assistant (`assistant` agents only) — the learning tools are live on every `ct_`-token call, not just `mode=learning`. */
|
|
183
|
+
isPersonal?: boolean;
|
|
166
184
|
voice?: AgentVoice;
|
|
167
185
|
transcriber?: AgentTranscriber;
|
|
168
186
|
model?: AgentModel;
|
|
@@ -184,26 +202,18 @@ interface AgentCreateInput {
|
|
|
184
202
|
*/
|
|
185
203
|
avatarUrl?: string;
|
|
186
204
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Room operating mode. Today only `'notes-only'` exists — the agent listens
|
|
193
|
-
* and takes structured notes without speaking. A literal union so future
|
|
194
|
-
* modes can be added without breaking the wire.
|
|
205
|
+
* Room operating mode. Only valid on `type: 'room'` agents. Today only
|
|
206
|
+
* `'notes-only'` exists — the agent listens and takes structured notes
|
|
207
|
+
* without speaking. A literal union so future modes can be added without
|
|
208
|
+
* breaking the wire.
|
|
195
209
|
*/
|
|
196
210
|
roomMode?: 'notes-only';
|
|
197
|
-
/**
|
|
198
|
-
* Transcribe-only mode. When `true`, the agent listens but never speaks: no
|
|
199
|
-
* TTS/LLM, no greeting, idle nudges suppressed, user turns are not routed
|
|
200
|
-
* through the LLM — an STT-only loop that streams `transcript` data-messages
|
|
201
|
-
* back to the caller. `voice` stays required by the schema (defaults apply)
|
|
202
|
-
* but is never read at runtime.
|
|
203
|
-
*/
|
|
204
|
-
transcribeOnly?: boolean;
|
|
205
211
|
}
|
|
206
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Patch shape for `agents.update`. `type` is immutable, so it is omitted
|
|
214
|
+
* here — to change an agent's kind, create a new agent.
|
|
215
|
+
*/
|
|
216
|
+
type AgentUpdateInput = Partial<Omit<AgentCreateInput, 'type'>>;
|
|
207
217
|
/**
|
|
208
218
|
* Trimmed agent shape returned by the consumer catalog
|
|
209
219
|
* (`GET /v1/orgs/:orgId/agents`). Operator-only fields like
|
|
@@ -283,6 +293,8 @@ interface CallRecord {
|
|
|
283
293
|
costBreakdown?: CostBreakdown;
|
|
284
294
|
errorMessage?: string;
|
|
285
295
|
metadata?: Record<string, string>;
|
|
296
|
+
/** Transport channel the call was carried over (`'voice'` = WebRTC/WS audio, `'text'` = text-only). */
|
|
297
|
+
channel?: 'voice' | 'text';
|
|
286
298
|
}
|
|
287
299
|
interface CallListFilters {
|
|
288
300
|
agentId?: string;
|
|
@@ -385,6 +397,18 @@ interface CallTokenMintInput {
|
|
|
385
397
|
* default user-initiated connect. See docs/sdks.md "Agent-initiated calls".
|
|
386
398
|
*/
|
|
387
399
|
initiatedBy?: 'user' | 'agent';
|
|
400
|
+
/**
|
|
401
|
+
* Session channel selector. `voice` (default) routes to WS/WebRTC audio;
|
|
402
|
+
* `text` routes to HTTP+SSE chat via the `chats` resource. `text` requires
|
|
403
|
+
* a `type: 'assistant'` agent; non-assistant agents are rejected at mint
|
|
404
|
+
* (`wrong_agent_type`), as is `mode: 'learning'` on a non-assistant agent.
|
|
405
|
+
*/
|
|
406
|
+
channel?: 'voice' | 'text';
|
|
407
|
+
/**
|
|
408
|
+
* Session purpose. `standard` (default) is a regular call. `learning`
|
|
409
|
+
* (admin-bypass only) flags a self-learning session — see Phase 19.
|
|
410
|
+
*/
|
|
411
|
+
mode?: 'standard' | 'learning';
|
|
388
412
|
}
|
|
389
413
|
interface CallTokenMintResult {
|
|
390
414
|
tokenId: string;
|
|
@@ -406,6 +430,12 @@ interface CallTokenMintResult {
|
|
|
406
430
|
* of falling back to the Phase-1 routes on the API base (local dev).
|
|
407
431
|
*/
|
|
408
432
|
webrtcGatewayBase?: string;
|
|
433
|
+
/**
|
|
434
|
+
* Session channel echoed back from the mint. Useful for the client SDK
|
|
435
|
+
* to dispatch correctly — text-mode tokens go to `chatsFor(token)`,
|
|
436
|
+
* voice-mode tokens go to `voice-js`/`voice-rn`.
|
|
437
|
+
*/
|
|
438
|
+
channel?: 'voice' | 'text';
|
|
409
439
|
}
|
|
410
440
|
interface CallTokenSummary {
|
|
411
441
|
tokenId: string;
|
|
@@ -416,7 +446,7 @@ interface CallTokenSummary {
|
|
|
416
446
|
revoked: boolean;
|
|
417
447
|
allowedOrigins?: string[];
|
|
418
448
|
}
|
|
419
|
-
type PlatformEventName = 'call.started' | 'call.ended' | 'transcript.updated' | 'call.summary.ready' | 'tool.call.requested' | 'tool.call.completed' | 'tool.call.failed' | 'credits.low';
|
|
449
|
+
type PlatformEventName = 'call.started' | 'call.ended' | 'transcript.updated' | 'call.summary.ready' | 'tool.call.requested' | 'tool.call.completed' | 'tool.call.failed' | 'credits.low' | 'speech.ready' | 'speech.failed';
|
|
420
450
|
interface WebhookConfig {
|
|
421
451
|
webhookId: string;
|
|
422
452
|
orgId: string;
|
|
@@ -470,6 +500,17 @@ interface CreateRoomInput {
|
|
|
470
500
|
agentId: string;
|
|
471
501
|
/** 1..240 — enforced by the server. */
|
|
472
502
|
durationMin: number;
|
|
503
|
+
/**
|
|
504
|
+
* Document references forwarded to the room analyzer. Each `docId` is an
|
|
505
|
+
* analysis document (`adoc_…`) uploaded via `POST /v1/analysis-docs` (NOT a
|
|
506
|
+
* knowledge-base file), tagged with an optional semantic role (e.g. `'jd'`,
|
|
507
|
+
* `'cv'`); the worker loads the full text and injects it into the analyzer.
|
|
508
|
+
* Omit when the room agent uses its default analysis behaviour.
|
|
509
|
+
*/
|
|
510
|
+
analysisContext?: Array<{
|
|
511
|
+
docId: string;
|
|
512
|
+
role?: string;
|
|
513
|
+
}>;
|
|
473
514
|
}
|
|
474
515
|
interface CreateRoomResponse {
|
|
475
516
|
roomId: string;
|
|
@@ -532,11 +573,159 @@ interface ListUtterancesResponse {
|
|
|
532
573
|
utterances: UtteranceWire[];
|
|
533
574
|
nextCursor: string | null;
|
|
534
575
|
}
|
|
576
|
+
interface AnalysisWire {
|
|
577
|
+
analysisId: string;
|
|
578
|
+
participantId: string;
|
|
579
|
+
label: string;
|
|
580
|
+
score?: number;
|
|
581
|
+
note?: string;
|
|
582
|
+
createdAt: string;
|
|
583
|
+
/**
|
|
584
|
+
* Which producer emitted this result: `'summary'` | `'rated_dimensions'` |
|
|
585
|
+
* `'suggested_questions'`. Set by the worker on every result it produces;
|
|
586
|
+
* absent only on legacy analysis entries written before producers existed.
|
|
587
|
+
*/
|
|
588
|
+
producer?: string;
|
|
589
|
+
}
|
|
590
|
+
interface ListAnalysisResponse {
|
|
591
|
+
analysis: AnalysisWire[];
|
|
592
|
+
nextCursor: string | null;
|
|
593
|
+
}
|
|
535
594
|
/** Returned by host-action endpoints (`/end` and friends) — 202 + eventId so
|
|
536
595
|
* callers can correlate the async system-message broadcast that follows. */
|
|
537
596
|
interface RoomEventAck {
|
|
538
597
|
eventId: string;
|
|
539
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* SSE events emitted by the text-channel chat endpoints. Concatenate
|
|
601
|
+
* `token.text` chunks to build up the agent's reply; render `tool.call`
|
|
602
|
+
* and `tool.result` as "doing-something" UI hints; treat `turn.end` as
|
|
603
|
+
* the signal that the current POST has finished streaming.
|
|
604
|
+
*/
|
|
605
|
+
type ChatEvent = {
|
|
606
|
+
type: 'chat.started';
|
|
607
|
+
chatId: string;
|
|
608
|
+
callId: string;
|
|
609
|
+
} | {
|
|
610
|
+
type: 'token';
|
|
611
|
+
text: string;
|
|
612
|
+
} | {
|
|
613
|
+
type: 'tool.call';
|
|
614
|
+
name: string;
|
|
615
|
+
args: unknown;
|
|
616
|
+
} | {
|
|
617
|
+
type: 'tool.result';
|
|
618
|
+
name: string;
|
|
619
|
+
ok?: boolean;
|
|
620
|
+
[key: string]: unknown;
|
|
621
|
+
} | {
|
|
622
|
+
type: 'turn.end';
|
|
623
|
+
finishReason: 'stop' | 'aborted' | 'length' | 'tool_error';
|
|
624
|
+
committedText?: string;
|
|
625
|
+
} | {
|
|
626
|
+
type: 'error';
|
|
627
|
+
code: string;
|
|
628
|
+
message: string;
|
|
629
|
+
};
|
|
630
|
+
type SpaceKind = 'audio' | 'video';
|
|
631
|
+
type RecordingMode = 'off' | 'host-source' | 'composite';
|
|
632
|
+
interface RecordingConfig {
|
|
633
|
+
mode: RecordingMode;
|
|
634
|
+
maxMinutesPerSession?: number;
|
|
635
|
+
audioOnly?: boolean;
|
|
636
|
+
}
|
|
637
|
+
/** The redacted space shape the server returns (`toSpaceView`). */
|
|
638
|
+
interface SpaceView {
|
|
639
|
+
spaceId: string;
|
|
640
|
+
agentId: string;
|
|
641
|
+
/** Stable human-friendly join code, e.g. `abc-defg-hij`. */
|
|
642
|
+
code: string;
|
|
643
|
+
kind: SpaceKind;
|
|
644
|
+
notesEnabled: boolean;
|
|
645
|
+
lobbyEnabled: boolean;
|
|
646
|
+
recording: RecordingConfig;
|
|
647
|
+
active: boolean;
|
|
648
|
+
currentSessionId: string | null;
|
|
649
|
+
sessionCount: number;
|
|
650
|
+
createdAt: string;
|
|
651
|
+
updatedAt: string;
|
|
652
|
+
}
|
|
653
|
+
interface CreateSpaceInput {
|
|
654
|
+
agentId: string;
|
|
655
|
+
/** Defaults to `video` server-side. */
|
|
656
|
+
kind?: SpaceKind;
|
|
657
|
+
/** Defaults to `true` server-side. */
|
|
658
|
+
notesEnabled?: boolean;
|
|
659
|
+
/** Defaults to `false` server-side. */
|
|
660
|
+
lobbyEnabled?: boolean;
|
|
661
|
+
recording?: RecordingConfig;
|
|
662
|
+
}
|
|
663
|
+
/** At least one field is required — the server rejects an empty patch. */
|
|
664
|
+
interface SpacePatch {
|
|
665
|
+
notesEnabled?: boolean;
|
|
666
|
+
lobbyEnabled?: boolean;
|
|
667
|
+
active?: boolean;
|
|
668
|
+
recording?: RecordingConfig;
|
|
669
|
+
}
|
|
670
|
+
interface ListSpacesResponse {
|
|
671
|
+
data: SpaceView[];
|
|
672
|
+
}
|
|
673
|
+
interface SpeechSynthesizeInput {
|
|
674
|
+
agentId: string;
|
|
675
|
+
text?: string;
|
|
676
|
+
context?: Record<string, unknown>;
|
|
677
|
+
instructions?: string;
|
|
678
|
+
format?: 'mp3' | 'wav' | 'ogg';
|
|
679
|
+
sampleRate?: 16000 | 24000 | 48000;
|
|
680
|
+
idempotencyKey?: string;
|
|
681
|
+
userTags?: string[];
|
|
682
|
+
ttlSeconds?: number;
|
|
683
|
+
metadata?: Record<string, string>;
|
|
684
|
+
}
|
|
685
|
+
interface SpeechAsset {
|
|
686
|
+
id: string;
|
|
687
|
+
status: 'ready';
|
|
688
|
+
url: string;
|
|
689
|
+
expiresAt: string;
|
|
690
|
+
durationMs: number;
|
|
691
|
+
bytes: number;
|
|
692
|
+
format: 'mp3' | 'wav' | 'ogg';
|
|
693
|
+
sampleRate: number;
|
|
694
|
+
text: string;
|
|
695
|
+
agentId: string;
|
|
696
|
+
idempotencyKey?: string;
|
|
697
|
+
metadata?: Record<string, string>;
|
|
698
|
+
createdAt: string;
|
|
699
|
+
}
|
|
700
|
+
interface SpeechJob {
|
|
701
|
+
id: string;
|
|
702
|
+
status: 'queued' | 'processing' | 'failed';
|
|
703
|
+
error?: {
|
|
704
|
+
code: string;
|
|
705
|
+
message: string;
|
|
706
|
+
};
|
|
707
|
+
idempotencyKey?: string;
|
|
708
|
+
metadata?: Record<string, string>;
|
|
709
|
+
createdAt: string;
|
|
710
|
+
}
|
|
711
|
+
interface SpeechListInput {
|
|
712
|
+
idempotencyKeyPrefix?: string;
|
|
713
|
+
status?: 'queued' | 'processing' | 'ready' | 'failed';
|
|
714
|
+
limit?: number;
|
|
715
|
+
cursor?: string;
|
|
716
|
+
}
|
|
717
|
+
interface SpeechReadyEvent {
|
|
718
|
+
event: 'speech.ready';
|
|
719
|
+
timestamp: string;
|
|
720
|
+
orgId: string;
|
|
721
|
+
data: SpeechAsset;
|
|
722
|
+
}
|
|
723
|
+
interface SpeechFailedEvent {
|
|
724
|
+
event: 'speech.failed';
|
|
725
|
+
timestamp: string;
|
|
726
|
+
orgId: string;
|
|
727
|
+
data: SpeechJob;
|
|
728
|
+
}
|
|
540
729
|
|
|
541
730
|
declare const createMeResource: (http: HttpClient) => {
|
|
542
731
|
get: () => Promise<MeResponse>;
|
|
@@ -678,10 +867,89 @@ declare const createRoomsResource: (http: HttpClient) => {
|
|
|
678
867
|
list: (filters?: RoomListFilters) => Promise<ListRoomsResponse>;
|
|
679
868
|
get: (roomId: string) => Promise<RoomDoc>;
|
|
680
869
|
transcript: (roomId: string, opts?: RoomTranscriptOptions) => Promise<ListUtterancesResponse>;
|
|
870
|
+
analysis: (roomId: string, opts?: RoomTranscriptOptions) => Promise<ListAnalysisResponse>;
|
|
681
871
|
end: (roomId: string) => Promise<RoomEventAck>;
|
|
682
872
|
};
|
|
683
873
|
type RoomsResource = ReturnType<typeof createRoomsResource>;
|
|
684
874
|
|
|
875
|
+
type JoinUrlStyle = 'query' | 'path';
|
|
876
|
+
interface BuildJoinUrlOptions {
|
|
877
|
+
/** Required — the developer's own page that renders <VoiceRoom/>. Absolute URL. */
|
|
878
|
+
baseUrl: string;
|
|
879
|
+
/** 'query' (default) → ?code=… · 'path' → /… */
|
|
880
|
+
style?: JoinUrlStyle;
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Build a participant join URL on the DEVELOPER's domain from a space (or a
|
|
884
|
+
* raw code). White-label: the returned URL never points at a voissia origin —
|
|
885
|
+
* `baseUrl` is required and supplied by the caller.
|
|
886
|
+
*
|
|
887
|
+
* The default `query` style appends `?code=<code>`, matching how
|
|
888
|
+
* `<VoiceRoom/>` (and the example app) read the code from the URL.
|
|
889
|
+
*/
|
|
890
|
+
declare const buildJoinUrl: (spaceOrCode: SpaceView | string, opts: BuildJoinUrlOptions) => string;
|
|
891
|
+
|
|
892
|
+
declare const createSpacesResource: (http: HttpClient) => {
|
|
893
|
+
create: (input: CreateSpaceInput) => Promise<SpaceView>;
|
|
894
|
+
get: (spaceId: string) => Promise<SpaceView>;
|
|
895
|
+
list: () => Promise<ListSpacesResponse>;
|
|
896
|
+
update: (spaceId: string, patch: SpacePatch) => Promise<SpaceView>;
|
|
897
|
+
delete: (spaceId: string) => Promise<void>;
|
|
898
|
+
joinUrl: (spaceOrCode: SpaceView | string, opts: BuildJoinUrlOptions) => string;
|
|
899
|
+
};
|
|
900
|
+
type SpacesResource = ReturnType<typeof createSpacesResource>;
|
|
901
|
+
|
|
902
|
+
interface StartChatInput {
|
|
903
|
+
agentId: string;
|
|
904
|
+
text?: string;
|
|
905
|
+
}
|
|
906
|
+
interface Chat {
|
|
907
|
+
id: string;
|
|
908
|
+
callId: string;
|
|
909
|
+
greeting: AsyncIterable<ChatEvent>;
|
|
910
|
+
send(text: string): AsyncIterable<ChatEvent>;
|
|
911
|
+
end(): Promise<void>;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Per-token chat resource. Construct via `client.chatsFor(callToken)` —
|
|
915
|
+
* `callToken` is a raw `ct_…` minted with `channel: 'text'`.
|
|
916
|
+
*
|
|
917
|
+
* The async iterables stream SSE events: `chat.started` (start only),
|
|
918
|
+
* then a sequence of `token` / `tool.call` / `tool.result` / `error`,
|
|
919
|
+
* then `turn.end` which closes the stream. The client must NOT keep
|
|
920
|
+
* a connection open between turns — each `send` is a fresh POST.
|
|
921
|
+
*/
|
|
922
|
+
declare const createChatsResource: (http: HttpClient, callToken: string) => {
|
|
923
|
+
start(input: StartChatInput): Promise<Chat>;
|
|
924
|
+
};
|
|
925
|
+
type ChatsResource = ReturnType<typeof createChatsResource>;
|
|
926
|
+
|
|
927
|
+
declare const createSpeechResource: (http: HttpClient) => {
|
|
928
|
+
/**
|
|
929
|
+
* Synchronous. Resolves with the ready asset. Throws PlatformError
|
|
930
|
+
* code 'accepted' (status 202, `body` = SpeechJob) when the server hands
|
|
931
|
+
* the job to the queue instead — poll `get(job.id)` or wait for the
|
|
932
|
+
* `speech.ready` webhook.
|
|
933
|
+
*/
|
|
934
|
+
synthesize: (input: SpeechSynthesizeInput) => Promise<SpeechAsset>;
|
|
935
|
+
/**
|
|
936
|
+
* Asynchronous. Normally returns a queued/processing SpeechJob —
|
|
937
|
+
* completion arrives via the `speech.ready` / `speech.failed` webhook or
|
|
938
|
+
* a later `get(job.id)`. Exception: when `idempotencyKey` matches an
|
|
939
|
+
* existing *ready* asset, the server short-circuits the queue hop and
|
|
940
|
+
* responds 200 with that SpeechAsset directly instead of 202.
|
|
941
|
+
*/
|
|
942
|
+
enqueue: (input: SpeechSynthesizeInput) => Promise<SpeechJob | SpeechAsset>;
|
|
943
|
+
get: (id: string) => Promise<SpeechAsset | SpeechJob>;
|
|
944
|
+
list: (input?: SpeechListInput) => Promise<{
|
|
945
|
+
items: Array<SpeechAsset | SpeechJob>;
|
|
946
|
+
cursor?: string;
|
|
947
|
+
}>;
|
|
948
|
+
/** Idempotent. Deleting a ready asset invalidates its URL immediately. */
|
|
949
|
+
delete: (id: string) => Promise<void>;
|
|
950
|
+
};
|
|
951
|
+
type SpeechResource = ReturnType<typeof createSpeechResource>;
|
|
952
|
+
|
|
685
953
|
interface PlatformClientOptions {
|
|
686
954
|
apiKey: string;
|
|
687
955
|
baseUrl?: string;
|
|
@@ -700,10 +968,23 @@ declare class PlatformClient {
|
|
|
700
968
|
readonly webhooks: WebhooksResource;
|
|
701
969
|
readonly orgs: OrgsResource;
|
|
702
970
|
readonly rooms: RoomsResource;
|
|
971
|
+
readonly spaces: SpacesResource;
|
|
972
|
+
readonly speech: SpeechResource;
|
|
973
|
+
private readonly _http;
|
|
703
974
|
constructor(options: PlatformClientOptions);
|
|
975
|
+
/**
|
|
976
|
+
* Returns a per-token chat resource bound to the given `ct_…` call token.
|
|
977
|
+
* The token must have been minted with `channel: 'text'`.
|
|
978
|
+
*
|
|
979
|
+
* Note: `chatsFor` is a factory method (not a fixed property) because the
|
|
980
|
+
* underlying resource is scoped to a single call token, whereas this client
|
|
981
|
+
* was constructed with an `sk_` admin key. Each end-user session needs its
|
|
982
|
+
* own `chatsFor(token)` handle.
|
|
983
|
+
*/
|
|
984
|
+
chatsFor(callToken: string): ChatsResource;
|
|
704
985
|
}
|
|
705
986
|
|
|
706
|
-
type ApiErrorCode = 'unauthorized' | 'forbidden' | 'not_found' | 'bad_request' | 'conflict' | 'rate_limited' | 'payment_required' | 'internal_error' | 'unknown';
|
|
987
|
+
type ApiErrorCode = 'unauthorized' | 'forbidden' | 'not_found' | 'bad_request' | 'conflict' | 'rate_limited' | 'payment_required' | 'internal_error' | 'accepted' | 'service_unavailable' | 'unknown';
|
|
707
988
|
declare class PlatformError extends Error {
|
|
708
989
|
readonly code: ApiErrorCode;
|
|
709
990
|
readonly status: number;
|
|
@@ -723,4 +1004,4 @@ declare class PlatformError extends Error {
|
|
|
723
1004
|
|
|
724
1005
|
declare const verifyWebhookSignature: (rawBody: Buffer | string, signatureHeader: string, secret: string) => boolean;
|
|
725
1006
|
|
|
726
|
-
export { type Agent, type AgentCreateInput, type AgentEndpointing, type AgentHttpTool, type AgentModel, type AgentRecording, type AgentTool, type AgentTranscriber, type AgentUpdateInput, type AgentVoice, type AgentWebhooksResource, type AgentsResource, type ApiErrorCode, type CallListFilters, type CallRecord, type CallRecordingUrlResponse, type CallStatus, type CallSummary, type CallTokenMintInput, type CallTokenMintResult, type CallTokenSummary, type CallTokensResource, type CallsResource, type CatalogAgent, type CatalogListInput, type CostBreakdown, type CreateRoomInput, type CreateRoomResponse, type CreditsResource, type EndReason, type EndpointingMode, type GuestRole, type KnowledgeBase, type KnowledgeBaseFile, type KnowledgeBasesResource, type LedgerEntry, type ListRoomsResponse, type ListUtterancesResponse, type LlmProvider, type MeResource, type MeResponse, type OrgsResource, PlatformClient, type PlatformClientOptions, PlatformError, type PlatformEventName, type RecordingMeta, type RoomDoc, type RoomEndReason, type RoomEventAck, type RoomListFilters, type RoomMetricsWire, type RoomStatus, type RoomTranscriptOptions, type RoomsResource, type SttProvider, type TranscriptTurn, type TtsProvider, type UtteranceWire, type WebhookConfig, type WebhookCreateInput, type WebhookDelivery, type WebhookUpdateInput, type WebhooksResource, type WorkerStatus, verifyWebhookSignature };
|
|
1007
|
+
export { type Agent, type AgentCreateInput, type AgentEndpointing, type AgentHttpTool, type AgentModel, type AgentRecording, type AgentTool, type AgentTranscriber, type AgentType, type AgentUpdateInput, type AgentVoice, type AgentWebhooksResource, type AgentsResource, type AnalysisWire, type ApiErrorCode, type BuildJoinUrlOptions, type CallListFilters, type CallRecord, type CallRecordingUrlResponse, type CallStatus, type CallSummary, type CallTokenMintInput, type CallTokenMintResult, type CallTokenSummary, type CallTokensResource, type CallsResource, type CatalogAgent, type CatalogListInput, type Chat, type ChatEvent, type ChatsResource, type CostBreakdown, type CreateRoomInput, type CreateRoomResponse, type CreateSpaceInput, type CreditsResource, type EndReason, type EndpointingMode, type GuestRole, type JoinUrlStyle, type KnowledgeBase, type KnowledgeBaseFile, type KnowledgeBasesResource, type LedgerEntry, type ListAnalysisResponse, type ListRoomsResponse, type ListSpacesResponse, type ListUtterancesResponse, type LlmProvider, type MeResource, type MeResponse, type OrgsResource, PlatformClient, type PlatformClientOptions, PlatformError, type PlatformEventName, type RecordingConfig, type RecordingMeta, type RecordingMode, type RoomDoc, type RoomEndReason, type RoomEventAck, type RoomListFilters, type RoomMetricsWire, type RoomStatus, type RoomTranscriptOptions, type RoomsResource, type SpaceKind, type SpacePatch, type SpaceView, type SpacesResource, type SpeechAsset, type SpeechFailedEvent, type SpeechJob, type SpeechListInput, type SpeechReadyEvent, type SpeechResource, type SpeechSynthesizeInput, type StartChatInput, type SttProvider, type TranscriptTurn, type TtsProvider, type UtteranceWire, type WebhookConfig, type WebhookCreateInput, type WebhookDelivery, type WebhookUpdateInput, type WebhooksResource, type WorkerStatus, buildJoinUrl, verifyWebhookSignature };
|