@squidcloud/client 1.0.492 → 1.0.494
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/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/ai/system-openai-compatible.d.ts +35 -0
- package/dist/internal-common/src/metric-name.d.ts +14 -0
- package/dist/internal-common/src/public-types/ai-agent-connection.public-types.d.ts +34 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +46 -2
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +29 -0
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +284 -29
- package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +12 -0
- package/dist/internal-common/src/public-types/ai-voice.public-types.d.ts +200 -0
- package/dist/internal-common/src/public-types/connector.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +302 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +514 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +58 -0
- package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +19 -0
- package/dist/internal-common/src/types/observability.types.d.ts +223 -0
- package/dist/internal-common/src/types/query.types.d.ts +15 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/internal-common/src/types/time-units.d.ts +1 -0
- package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http-utils.d.ts +15 -0
- package/dist/internal-common/src/utils/http.d.ts +24 -0
- package/dist/internal-common/src/utils/integration-access-tokens.d.ts +15 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +86 -0
- package/dist/internal-common/src/utils/serialization.d.ts +24 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +6 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +21 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +1 -1
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +4 -4
- package/dist/typescript-client/src/ai-client.d.ts +17 -4
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +4 -2
- package/dist/typescript-client/src/ai-voice-client.d.ts +42 -0
- package/dist/typescript-client/src/ai-web-voice-call.d.ts +62 -0
- package/dist/typescript-client/src/index.d.ts +2 -0
- package/dist/typescript-client/src/public-types.d.ts +2 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateTraceId(prefix?: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HttpStatusCode } from '../public-types/http-status.public-types';
|
|
2
|
+
export declare class ValidationError extends Error {
|
|
3
|
+
readonly statusCode: HttpStatusCode;
|
|
4
|
+
readonly details?: any;
|
|
5
|
+
constructor(error: string, statusCode: HttpStatusCode, details?: Record<string, unknown>);
|
|
6
|
+
}
|
|
7
|
+
export declare function isValidId(id: unknown, maxLength?: number): boolean;
|
|
8
|
+
export declare function validateFieldSort(fieldSort: unknown): void;
|
|
9
|
+
/** The largest limit one query may carry. */
|
|
10
|
+
export declare const MAX_QUERY_LIMIT = 20000;
|
|
11
|
+
export declare function validateQueryLimit(limit: unknown): void;
|
|
12
|
+
/**
|
|
13
|
+
* All type names returned by 'typeof' supported by JavaScript:
|
|
14
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}.
|
|
15
|
+
* and a few other supported types.
|
|
16
|
+
*/
|
|
17
|
+
export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function';
|
|
18
|
+
/** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */
|
|
19
|
+
export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean;
|
|
20
|
+
/** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */
|
|
21
|
+
export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
maxAttempts?: number;
|
|
3
|
+
protocols?: string[];
|
|
4
|
+
onmessage?: (event: any) => void;
|
|
5
|
+
onopen?: (event: any) => void;
|
|
6
|
+
onclose?: (event: any) => void;
|
|
7
|
+
onerror?: (event: any) => void;
|
|
8
|
+
onreconnect?: (event: any) => void;
|
|
9
|
+
onmaximum?: (event: any) => void;
|
|
10
|
+
timeoutMillis?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface WebSocketWrapper {
|
|
13
|
+
open: () => void;
|
|
14
|
+
reconnect: (e: any) => void;
|
|
15
|
+
json: (x: any) => void;
|
|
16
|
+
send: (x: string) => void;
|
|
17
|
+
close: (x?: number, y?: string) => void;
|
|
18
|
+
connected: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Websocket is explicitly closed by calling socket.close().
|
|
21
|
+
* Used to ignore errors after socket.closed() is called.
|
|
22
|
+
*/
|
|
23
|
+
closeCalled: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper;
|
|
26
|
+
export {};
|
|
@@ -262,7 +262,7 @@ export declare class AiAgentReference {
|
|
|
262
262
|
*/
|
|
263
263
|
private withMetricAnnotations;
|
|
264
264
|
/**
|
|
265
|
-
* Calls rpcManager post
|
|
265
|
+
* Calls rpcManager post with [headers], adding the agent api key if one was given during construction
|
|
266
266
|
*/
|
|
267
267
|
private post;
|
|
268
268
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { AiAnnotation, AiChatModelSelection, AiChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
2
|
+
import { AiAnnotation, AiChatModelSelection, AiChatOptions, AiChatRequestCredentials } from '../../../internal-common/src/public-types/ai-agent.public-types';
|
|
3
3
|
/**
|
|
4
4
|
* Response format for transcribing audio and generating a chat response.
|
|
5
5
|
* Contains the transcribed text and a stream of AI-generated responses.
|
|
@@ -51,18 +51,18 @@ export interface AskWithVoiceResponse {
|
|
|
51
51
|
*/
|
|
52
52
|
export type AiChatOptionsWithoutVoice<T extends AiChatModelSelection | undefined = undefined> = Omit<AiChatOptions<T>, 'voiceOptions'> & {
|
|
53
53
|
model?: T;
|
|
54
|
-
};
|
|
54
|
+
} & AiChatRequestCredentials;
|
|
55
55
|
/**
|
|
56
56
|
* Options for AI-generated responses that exclude voice-specific settings and smooth typing behavior.
|
|
57
57
|
* @category AI
|
|
58
58
|
*/
|
|
59
59
|
export type AiAskOptions<T extends AiChatModelSelection | undefined = undefined> = Omit<AiChatOptions<T>, 'voiceOptions' | 'smoothTyping'> & {
|
|
60
60
|
model?: T;
|
|
61
|
-
};
|
|
61
|
+
} & AiChatRequestCredentials;
|
|
62
62
|
/**
|
|
63
63
|
* Options for AI-generated responses that include voice-specific settings but excludes smooth typing.
|
|
64
64
|
* @category AI
|
|
65
65
|
*/
|
|
66
66
|
export type AiAskOptionsWithVoice<T extends AiChatModelSelection | undefined = undefined> = Omit<AiChatOptions<T>, 'smoothTyping'> & {
|
|
67
67
|
model?: T;
|
|
68
|
-
};
|
|
68
|
+
} & AiChatRequestCredentials;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { AiFunctionMetadata } from '../../internal-common/src/public-types/ai-function.public-types';
|
|
3
|
-
import {
|
|
3
|
+
import { AiQueryRequestOptions, AiQueryResponse, AiSpreadsheetQueryOptions, ExecuteAiApiResponse, ExecuteAiSpreadsheetQueryResponse } from '../../internal-common/src/public-types/ai-query.public-types';
|
|
4
4
|
import { AiAgentClientOptions } from './agent/ai-agent-client';
|
|
5
5
|
import { AiAgentReference } from './agent/ai-agent-client-reference';
|
|
6
6
|
import { AiAudioClient } from './ai-audio-client';
|
|
@@ -8,7 +8,8 @@ import { AiFilesClient } from './ai-files-client';
|
|
|
8
8
|
import { AiImageClient } from './ai-image-client';
|
|
9
9
|
import { AiKnowledgeBaseReference } from './ai-knowledge-base/ai-knowledge-base-client-reference';
|
|
10
10
|
import { AiMatchMakingClient } from './ai-matchmaking-client';
|
|
11
|
-
import {
|
|
11
|
+
import { AiVoiceClient } from './ai-voice-client';
|
|
12
|
+
import { AiAgent, AiAgentApiIntegrationOptions, AiAgentId, AiFileProviderType, AiFileUrl, AiKnowledgeBase, AiKnowledgeBaseId, AiProviderType, AiSessionContext, AiStatusMessage, ApplicationAiSettings, EmbeddingModelIdSpec, IntegrationId, JobId, ListChatModelsRequest, ListEmbeddingModelsRequest, ModelIdSpec, SecretKey } from './public-types';
|
|
12
13
|
/**
|
|
13
14
|
* AiClient class serves as a facade for interacting with different AI services.
|
|
14
15
|
* It provides simplified access to AI chatbot and assistant functionalities
|
|
@@ -53,6 +54,13 @@ export declare class AiClient {
|
|
|
53
54
|
* included only when `options.includeDeprecated` is true and are marked with `replacedBy`.
|
|
54
55
|
*/
|
|
55
56
|
listChatModels(options?: ListChatModelsRequest): Promise<ModelIdSpec[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the embedding models a new knowledge base can be created on: Squid-provided vendor models
|
|
59
|
+
* and the application's custom integration models. Exactly one entry is `isDefault`. Deprecated
|
|
60
|
+
* vendor models are included only when `options.includeDeprecated` is true and are marked with
|
|
61
|
+
* `replacedBy`.
|
|
62
|
+
*/
|
|
63
|
+
listEmbeddingModels(options?: ListEmbeddingModelsRequest): Promise<EmbeddingModelIdSpec[]>;
|
|
56
64
|
/**
|
|
57
65
|
* Retrieves an AI image client.
|
|
58
66
|
*/
|
|
@@ -61,6 +69,10 @@ export declare class AiClient {
|
|
|
61
69
|
* Retrieves an AI audio client.
|
|
62
70
|
*/
|
|
63
71
|
audio(): AiAudioClient;
|
|
72
|
+
/**
|
|
73
|
+
* Retrieves an AI voice client, which opens phone-call sessions relayed to an agent.
|
|
74
|
+
*/
|
|
75
|
+
voice(): AiVoiceClient;
|
|
64
76
|
/**
|
|
65
77
|
* Retrieves an AI match-making client.
|
|
66
78
|
* @deprecated - Use `knowledgebase('kbId').searchContextsWith*()` instead.
|
|
@@ -90,7 +102,8 @@ export declare class AiClient {
|
|
|
90
102
|
* @param prompt The text prompt to send to the AI. This should be formulated in a way that the AI can
|
|
91
103
|
* understand and respond to, taking into account the nature of the task or the information
|
|
92
104
|
* sought.
|
|
93
|
-
* @param options Additional options to customize the query execution.
|
|
105
|
+
* @param options Additional options to customize the query execution. An `accessToken` is sent as a request
|
|
106
|
+
* header rather than with the options.
|
|
94
107
|
* @param abortSignal Optional signal used to abort the underlying request. When the signal aborts, the in-flight
|
|
95
108
|
* HTTP request is cancelled and its promise rejects, allowing callers to bound a single call
|
|
96
109
|
* without leaking the request.
|
|
@@ -109,7 +122,7 @@ export declare class AiClient {
|
|
|
109
122
|
* For more details on the usage and capabilities of the AI Assistant, refer to the documentation provided at
|
|
110
123
|
* {@link https://docs.squid.cloud/docs/ai}.
|
|
111
124
|
*/
|
|
112
|
-
executeAiQuery(integrationId: IntegrationId, prompt: string, options?:
|
|
125
|
+
executeAiQuery(integrationId: IntegrationId, prompt: string, options?: AiQueryRequestOptions, abortSignal?: AbortSignal): Promise<AiQueryResponse>;
|
|
113
126
|
/**
|
|
114
127
|
* Executes an AI-powered API call using a specific integration.
|
|
115
128
|
* The AI will select appropriate endpoints, generate request bodies,
|
package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseContextWithReasoning, AiKnowledgeBaseDownloadContextResponse, AiKnowledgeBaseSearchContextsWithContextIdRequest, AiKnowledgeBaseSearchContextsWithPromptRequest, AiKnowledgeBaseSearchResponse, AiKnowledgeBaseSearchResultChunk, BulkIngestionContext, BulkIngestionCreateUploadUrlsResponse, BulkIngestionJobStatusResponse, BulkIngestionUpsertContextsResponse, ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GenerateMetadataFieldDescriptionsRequest, GenerateMetadataFieldDescriptionsResponse, GetKnowledgeBaseGraphStatusResponse, GrepKnowledgeBaseOptions, GrepKnowledgeBaseResponse, ListAiKnowledgeBaseContextsPageResponse, ListKnowledgeBaseContextsOptions, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, UpsertKnowledgeBaseContextResponse, UpsertKnowledgeBaseContextsResponse } from '../../../internal-common/src/public-types/ai-knowledge-base.public-types';
|
|
2
|
+
import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseContextWithReasoning, AiKnowledgeBaseDownloadContextResponse, AiKnowledgeBaseSearchContextsWithContextIdRequest, AiKnowledgeBaseSearchContextsWithPromptRequest, AiKnowledgeBaseSearchResponse, AiKnowledgeBaseSearchResultChunk, BulkIngestionContext, BulkIngestionCreateUploadUrlsResponse, BulkIngestionJobStatusResponse, BulkIngestionUpsertContextsOptions, BulkIngestionUpsertContextsResponse, ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GenerateMetadataFieldDescriptionsRequest, GenerateMetadataFieldDescriptionsResponse, GetKnowledgeBaseGraphStatusResponse, GrepKnowledgeBaseOptions, GrepKnowledgeBaseResponse, ListAiKnowledgeBaseContextsPageResponse, ListKnowledgeBaseContextsOptions, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, UpsertKnowledgeBaseContextResponse, UpsertKnowledgeBaseContextsResponse } from '../../../internal-common/src/public-types/ai-knowledge-base.public-types';
|
|
3
3
|
import { AiContextId } from '../../../internal-common/src/public-types/communication.public-types';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for creating or updating an AI agent.
|
|
@@ -130,10 +130,12 @@ export declare class AiKnowledgeBaseReference {
|
|
|
130
130
|
* caps are enforced by the upload parser and exceeding either is rejected before staging runs. For larger
|
|
131
131
|
* sets use {@link createBulkUploadUrls} and pass `stagedObjectKey` instead, which uploads straight to
|
|
132
132
|
* storage and is subject to neither cap.
|
|
133
|
+
* @param options `speed` says how quickly the job must finish, and so which provider tier Squid buys
|
|
134
|
+
* for it; omitted, Squid decides from the job's size.
|
|
133
135
|
* @returns The id of the staged bulk-ingestion job, plus the context id assigned to each staged context
|
|
134
136
|
* (in the same order as `contextRequests`).
|
|
135
137
|
*/
|
|
136
|
-
bulkUpsertContexts(contextRequests: Array<BulkIngestionContext>, files?: Array<File
|
|
138
|
+
bulkUpsertContexts(contextRequests: Array<BulkIngestionContext>, files?: Array<File>, options?: BulkIngestionUpsertContextsOptions): Promise<BulkIngestionUpsertContextsResponse>;
|
|
137
139
|
/**
|
|
138
140
|
* Mints presigned upload URLs for direct-to-storage bulk files, bypassing multipart upload through core.
|
|
139
141
|
* PUT each file's bytes to its `uploadUrl` — sending every header in that entry's `requiredHeaders`,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AiWebVoiceCall, AiWebVoiceCallOptions } from './ai-web-voice-call';
|
|
2
|
+
import { AnswerOpenAiVoiceCallRequest, AnswerOpenAiVoiceCallResponse, CreateAiVoiceSessionRequest, CreateAiVoiceSessionResponse, StartOpenAiWebVoiceCallRequest, StartOpenAiWebVoiceCallResponse } from './public-types';
|
|
3
|
+
/**
|
|
4
|
+
* AiVoiceClient puts agents on voice calls: phone calls a telephony provider relays to or OpenAI answers
|
|
5
|
+
* for a Squid agent (application API key), and browser calls a user starts from a web page.
|
|
6
|
+
* @category AI
|
|
7
|
+
*/
|
|
8
|
+
export declare class AiVoiceClient {
|
|
9
|
+
private readonly rpcManager;
|
|
10
|
+
/**
|
|
11
|
+
* Opens a voice session and returns the relay URL the telephony provider must connect to.
|
|
12
|
+
*
|
|
13
|
+
* @param request - The agent, provider and per-call chat options.
|
|
14
|
+
* @returns The session id, its one-time token and the absolute relay URL.
|
|
15
|
+
*/
|
|
16
|
+
createSession(request: CreateAiVoiceSessionRequest): Promise<CreateAiVoiceSessionResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Answers a phone call that reached an OpenAI project's SIP endpoint: Squid accepts it and speaks for the
|
|
19
|
+
* agent until the call ends.
|
|
20
|
+
*
|
|
21
|
+
* @param request - The call, the agent, and how the realtime model should talk.
|
|
22
|
+
* @returns The id of the voice session that runs the call.
|
|
23
|
+
*/
|
|
24
|
+
answerOpenAiCall(request: AnswerOpenAiVoiceCallRequest): Promise<AnswerOpenAiVoiceCallResponse>;
|
|
25
|
+
/**
|
|
26
|
+
* Starts a browser call with an agent from a WebRTC offer: Squid creates the call on the OpenAI Realtime
|
|
27
|
+
* API, runs the agent behind it, and returns the answer for the browser's remote description. Use
|
|
28
|
+
* {@link startWebCall} for the whole flow, this for a custom WebRTC setup.
|
|
29
|
+
*
|
|
30
|
+
* @param request - The agent, the offer and optional voice settings.
|
|
31
|
+
* @returns The session id, the call id and OpenAI's answer.
|
|
32
|
+
*/
|
|
33
|
+
startOpenAiWebCall(request: StartOpenAiWebVoiceCallRequest): Promise<StartOpenAiWebVoiceCallResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Starts a voice conversation with an agent in the browser: opens the microphone, connects to the OpenAI
|
|
36
|
+
* realtime model over WebRTC and plays the agent's voice. Browser only.
|
|
37
|
+
*
|
|
38
|
+
* @param options - The agent and optional voice settings.
|
|
39
|
+
* @returns The running call, to listen to its turns, mute it or stop it.
|
|
40
|
+
*/
|
|
41
|
+
startWebCall(options: AiWebVoiceCallOptions): Promise<AiWebVoiceCall>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AiVoiceSessionTurn, StartOpenAiWebVoiceCallRequest } from './public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Where the agent's voice plays; an `<audio>` element does.
|
|
4
|
+
* @category AI
|
|
5
|
+
*/
|
|
6
|
+
export interface AiWebVoiceCallSink {
|
|
7
|
+
/** The media stream to play. */
|
|
8
|
+
srcObject: unknown;
|
|
9
|
+
/** Whether playback starts as soon as the stream arrives. */
|
|
10
|
+
autoplay: boolean;
|
|
11
|
+
/** Starts playback. */
|
|
12
|
+
play(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Options of a browser call: everything of {@link StartOpenAiWebVoiceCallRequest} except the offer, which the
|
|
16
|
+
* call produces itself.
|
|
17
|
+
* @category AI
|
|
18
|
+
*/
|
|
19
|
+
export interface AiWebVoiceCallOptions extends Omit<StartOpenAiWebVoiceCallRequest, 'sdp'> {
|
|
20
|
+
/** Plays the agent's voice; created on the page when omitted. */
|
|
21
|
+
sink?: AiWebVoiceCallSink;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An event of the call as the Realtime API reports it over the data channel, such as
|
|
25
|
+
* `conversation.item.input_audio_transcription.completed` or `response.done`.
|
|
26
|
+
* @category AI
|
|
27
|
+
*/
|
|
28
|
+
export interface AiWebVoiceCallEvent {
|
|
29
|
+
/** The event type, e.g. `response.done`. */
|
|
30
|
+
type: string;
|
|
31
|
+
/** The rest of the event, as the Realtime API sends it. */
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A voice conversation with an agent from the browser: the microphone goes to the OpenAI realtime model over
|
|
36
|
+
* WebRTC, its voice comes back the same way, and Squid runs the agent behind it. Start one with
|
|
37
|
+
* {@link AiVoiceClient.startWebCall}.
|
|
38
|
+
* @category AI
|
|
39
|
+
*/
|
|
40
|
+
export declare class AiWebVoiceCall {
|
|
41
|
+
/** Id of the voice session in Squid; its transcript events carry it. */
|
|
42
|
+
readonly sessionId: string;
|
|
43
|
+
/** Id of the call at OpenAI. */
|
|
44
|
+
readonly callId: string;
|
|
45
|
+
private readonly peer;
|
|
46
|
+
private readonly microphone;
|
|
47
|
+
private readonly eventListeners;
|
|
48
|
+
private readonly endListeners;
|
|
49
|
+
private ended;
|
|
50
|
+
/** Listens to every event of the call; returns the function that stops listening. */
|
|
51
|
+
onEvent(listener: (event: AiWebVoiceCallEvent) => void): () => void;
|
|
52
|
+
/** Listens to the spoken turns, the caller's as transcribed and the agent's as spoken. */
|
|
53
|
+
onTurn(listener: (turn: AiVoiceSessionTurn) => void): () => void;
|
|
54
|
+
/** Runs once the call is over, whether the agent hung up, the connection dropped or {@link stop} was called. */
|
|
55
|
+
onEnd(listener: () => void): () => void;
|
|
56
|
+
/** Silences or restores the microphone without ending the call. */
|
|
57
|
+
setMuted(muted: boolean): void;
|
|
58
|
+
/** Ends the call from the browser's side. */
|
|
59
|
+
stop(): void;
|
|
60
|
+
private dispatch;
|
|
61
|
+
private finish;
|
|
62
|
+
}
|
|
@@ -10,6 +10,8 @@ export * from './ai-knowledge-base/ai-knowledge-base-client';
|
|
|
10
10
|
export * from './ai-knowledge-base/ai-knowledge-base-client-reference';
|
|
11
11
|
export * from './ai-matchmaking-client';
|
|
12
12
|
export * from './ai-status-updates';
|
|
13
|
+
export * from './ai-voice-client';
|
|
14
|
+
export * from './ai-web-voice-call';
|
|
13
15
|
export * from './api-client';
|
|
14
16
|
export * from './auth.manager';
|
|
15
17
|
export * from './backend-function.manager';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from '../../internal-common/src/public-types/ai-agent-integrations.public-types';
|
|
2
2
|
export * from '../../internal-common/src/public-types/ai-agent.public-types';
|
|
3
3
|
/** AI function metadata types for listing and describing available functions. */
|
|
4
|
+
export * from '../../internal-common/src/public-types/ai-agent-connection.public-types';
|
|
4
5
|
export * from '../../internal-common/src/public-types/ai-common.public-types';
|
|
5
6
|
export * from '../../internal-common/src/public-types/ai-function.public-types';
|
|
6
7
|
export * from '../../internal-common/src/public-types/ai-knowledge-base.public-types';
|
|
7
8
|
export * from '../../internal-common/src/public-types/ai-matchmaking.public-types';
|
|
8
9
|
export * from '../../internal-common/src/public-types/ai-query.public-types';
|
|
10
|
+
export * from '../../internal-common/src/public-types/ai-voice.public-types';
|
|
9
11
|
export * from '../../internal-common/src/public-types/api-client.public-types';
|
|
10
12
|
export * from '../../internal-common/src/public-types/api.public-types';
|
|
11
13
|
export * from '../../internal-common/src/public-types/backend.public-types';
|