@squidcloud/client 1.0.325 → 1.0.327

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.
Files changed (27) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +80 -45
  3. package/dist/internal-common/src/public-types/bundle-data.public-types.d.ts +0 -2
  4. package/dist/internal-common/src/public-types/communication.public-types.d.ts +0 -1
  5. package/dist/internal-common/src/public-types/http-status.enum.d.ts +414 -50
  6. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  7. package/dist/internal-common/src/public-types/query.public-types.d.ts +1 -0
  8. package/dist/internal-common/src/public-types/socket.public-types.d.ts +3 -5
  9. package/dist/internal-common/src/types/ai-agent.types.d.ts +1 -32
  10. package/dist/internal-common/src/types/observability.types.d.ts +1 -1
  11. package/dist/internal-common/src/utils/validation.d.ts +3 -4
  12. package/dist/typescript-client/src/admin-client.d.ts +0 -3
  13. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +36 -0
  14. package/dist/typescript-client/src/agent/ai-agent-client.d.ts +13 -0
  15. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +17 -0
  16. package/dist/typescript-client/src/ai-client.d.ts +3 -2
  17. package/dist/typescript-client/src/collection-reference.d.ts +1 -1
  18. package/dist/typescript-client/src/document-reference.d.ts +1 -1
  19. package/dist/typescript-client/src/index.d.ts +4 -2
  20. package/dist/typescript-client/src/public-types.d.ts +0 -1
  21. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +1 -1
  22. package/dist/typescript-client/src/squid.d.ts +4 -4
  23. package/dist/typescript-client/src/version.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/dist/internal-common/src/public-types/integrations/ai_agent.public-types.d.ts +0 -47
  26. package/dist/typescript-client/src/agent-client.d.ts +0 -6
  27. package/dist/typescript-client/src/ai-agent-client.d.ts +0 -228
@@ -1,7 +1,9 @@
1
- import { FunctionName, FunctionNameWithContext } from './bundle-data.public-types';
2
- import { AiAgentId, IntegrationId } from './communication.public-types';
1
+ import { AiAgentId, AiContextId, IntegrationId } from './communication.public-types';
3
2
  import { IntegrationType } from './integration.public-types';
3
+ import { FunctionName, FunctionNameWithContext } from './bundle-data.public-types';
4
4
  /** The supported OpenAI models */
5
+ export declare const OPENAI_O1_CHAT_MODEL_NAMES: readonly ["o1", "o1-mini"];
6
+ export declare const OPENAI_REASONING_CHAT_MODEL_NAMES: readonly ["o1", "o1-mini", "o3-mini"];
5
7
  export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-4o", "gpt-4o-mini", "o1", "o1-mini", "o3-mini"];
6
8
  export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-1.5-pro", "gemini-2.0-flash"];
7
9
  export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-3-5-haiku-latest", "claude-3-5-sonnet-latest"];
@@ -23,6 +25,7 @@ export declare const OPEN_AI_CREATE_SPEECH_FORMATS: readonly ["mp3", "opus", "aa
23
25
  export type AiChatModelName = (typeof AI_CHAT_MODEL_NAMES)[number];
24
26
  export type AiEmbeddingsModelName = (typeof AI_EMBEDDINGS_MODEL_NAMES)[number];
25
27
  export type OpenAiChatModelName = (typeof OPENAI_CHAT_MODEL_NAMES)[number];
28
+ export type OpenAiReasoningChatModelName = (typeof OPENAI_REASONING_CHAT_MODEL_NAMES)[number];
26
29
  export type GeminiChatModelName = (typeof GEMINI_CHAT_MODEL_NAMES)[number];
27
30
  export type AnthropicChatModelName = (typeof ANTHROPIC_CHAT_MODEL_NAMES)[number];
28
31
  export type AiImageModelName = (typeof AI_IMAGE_MODEL_NAMES)[number];
@@ -38,7 +41,7 @@ export type FluxModelName = (typeof FLUX_MODEL_NAMES)[number];
38
41
  export type AiGenerateImageOptions = DallEOptions | StableDiffusionCoreOptions | FluxOptions;
39
42
  export type AiAudioTranscribeOptions = WhisperOptions;
40
43
  export type AiAudioCreateSpeechOptions = OpenAiCreateSpeechOptions;
41
- export declare const VECTOR_DB_TYPES: readonly ["pinecone", "postgres"];
44
+ export declare const VECTOR_DB_TYPES: readonly ["postgres"];
42
45
  export type VectorDbType = (typeof VECTOR_DB_TYPES)[number];
43
46
  export interface AiAudioCreateSpeechResponse {
44
47
  mimeType: string;
@@ -135,8 +138,7 @@ export interface AiChatPromptQuotas {
135
138
  */
136
139
  maxAiCallStackSize: number;
137
140
  }
138
- /** The options for the AI chat method. */
139
- export interface AiAgentChatOptions {
141
+ interface BaseAiAgentChatOptions {
140
142
  /** The maximum number of tokens to use when making the request to the AI model. Default to the max tokens the model can accept. */
141
143
  maxTokens?: number;
142
144
  /** A unique chat ID, if the same chat ID is used again and history is not disabled, it will continue the conversation. */
@@ -155,16 +157,6 @@ export interface AiAgentChatOptions {
155
157
  responseFormat?: OpenAiResponseFormat;
156
158
  /** Whether to response in a "smooth typing" way, beneficial when the chat result is displayed in a UI. Default to true. */
157
159
  smoothTyping?: boolean;
158
- /** The temperature to use when sampling from the model. Default to 0.5. */
159
- temperature?: number;
160
- /** The top P value to use when sampling from the model. Default to 1. */
161
- topP?: number;
162
- /** The model to use for this chat. If not provided, the profile model will be used. */
163
- overrideModel?: AiChatModelName;
164
- /** File URLs (only images supported at the moment). */
165
- fileUrls?: Array<AiFileUrl>;
166
- /** Constrains effort on reasoning for reasoning models. o1 models only. */
167
- reasoningEffort?: 'low' | 'medium' | 'high';
168
160
  /** Global context passed to the agent and all AI functions of the agent. */
169
161
  agentContext?: Record<string, unknown>;
170
162
  /**
@@ -174,8 +166,8 @@ export interface AiAgentChatOptions {
174
166
  * Overrides the stored value.
175
167
  */
176
168
  functions?: Array<FunctionName | FunctionNameWithContext>;
177
- /** A list of instructions to include with the prompt. */
178
- instructions?: Array<string>;
169
+ /** Instructions to include with the prompt. */
170
+ instructions?: string;
179
171
  /** A set of filters that will limit the context the AI can access. */
180
172
  contextMetadataFilter?: AiContextMetadataFilter;
181
173
  /** The options to use for the response in voice. */
@@ -188,10 +180,45 @@ export interface AiAgentChatOptions {
188
180
  quotas?: AiChatPromptQuotas;
189
181
  /** Include metadata in the context */
190
182
  includeMetadata?: boolean;
191
- /** Enables grounding with real-time web search to enhance AI responses with up-to-date information.
192
- * Currently supported only for gemini-2.0-flash. */
183
+ /** The temperature to use when sampling from the model. Default to 0.5. */
184
+ temperature?: number;
185
+ model?: AiChatModelName;
186
+ }
187
+ export interface GeminiChatOptions extends BaseAiAgentChatOptions {
188
+ model?: GeminiChatModelName;
193
189
  groundingWithWebSearch?: boolean;
194
190
  }
191
+ export interface OpenAiChatOptions extends BaseAiAgentChatOptions {
192
+ model?: OpenAiChatModelName;
193
+ fileUrls?: Array<AiFileUrl>;
194
+ }
195
+ export interface OpenAiReasoningChatOptions extends OpenAiChatOptions {
196
+ model?: OpenAiReasoningChatModelName;
197
+ reasoningEffort?: 'low' | 'medium' | 'high';
198
+ }
199
+ export interface AnthropicChatOptions extends BaseAiAgentChatOptions {
200
+ model?: AnthropicChatModelName;
201
+ }
202
+ export type AiSessionOptions = Partial<{
203
+ traceId: string;
204
+ clientId: string;
205
+ agentId: string;
206
+ }>;
207
+ export type AiAgentChatOptions<T extends AiChatModelName | undefined = undefined> = T extends undefined ? BaseAiAgentChatOptions | GeminiChatOptions | OpenAiReasoningChatOptions | OpenAiChatOptions | AnthropicChatOptions : T extends GeminiChatModelName ? GeminiChatOptions : T extends OpenAiReasoningChatModelName ? OpenAiReasoningChatOptions : T extends OpenAiChatModelName ? OpenAiChatOptions : T extends AnthropicChatModelName ? AnthropicChatOptions : never;
208
+ /** A definition of an AI agent. */
209
+ export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
210
+ id: AiAgentId;
211
+ createdAt: Date;
212
+ updatedAt: Date;
213
+ description?: string;
214
+ isPublic?: boolean;
215
+ auditLog?: boolean;
216
+ /** The default options of the agent - can be overridden by the user when using the agent. */
217
+ options: AiAgentChatOptions<T>;
218
+ }
219
+ export type UpsertAgentRequest = Omit<AiAgent, 'createdAt' | 'updatedAt' | 'options'> & {
220
+ options?: AiAgentChatOptions;
221
+ };
195
222
  export interface AiObserveStatusOptions {
196
223
  /** A unique chat ID for the conversation. */
197
224
  chatId?: string;
@@ -232,18 +259,10 @@ export interface AiSearchOptions {
232
259
  }
233
260
  export interface AiSearchRequest {
234
261
  options: AiSearchOptions;
235
- profileId: string;
236
- integrationId: IntegrationId;
262
+ agentId: AiAgentId;
237
263
  }
238
264
  export type AiMutationType = 'insert' | 'update' | 'delete' | 'append' | 'feedback';
239
265
  export type AiResourceType = 'instruction' | 'profile' | 'context' | 'contexts';
240
- export type AiContextType = 'text' | 'url' | 'file';
241
- export interface AiContextBase {
242
- type: AiContextType;
243
- data: string;
244
- metadata?: AiContextMetadata;
245
- password?: string;
246
- }
247
266
  export interface AiSearchResponse {
248
267
  chunks: Array<AiSearchResultChunk>;
249
268
  }
@@ -252,32 +271,47 @@ export interface AiSearchResultChunk {
252
271
  metadata?: AiContextMetadata;
253
272
  score: number;
254
273
  }
255
- export interface AiTextContext extends AiContextBase {
256
- type: 'text';
274
+ /**
275
+ * Provides context to the security rules of an AI Agent for each new user prompt.
276
+ * Refer to the `@secureAiAgent` annotation for more details.
277
+ */
278
+ export declare class SecureAiAgentContext {
279
+ readonly prompt?: string;
280
+ readonly agentId: AiAgentId;
257
281
  }
258
- export interface AiUrlContext extends AiContextBase {
259
- type: 'url';
260
- extractImages?: boolean;
261
- minImageWidth?: number;
262
- minImageHeight?: number;
282
+ export interface AiAgentContext {
283
+ id: AiContextId;
284
+ createdAt: Date;
285
+ updatedAt: Date;
286
+ agentId: AiAgentId;
287
+ type: AiContextType;
288
+ title: string;
289
+ text: string;
290
+ preview: boolean;
291
+ sizeBytes: number;
292
+ metadata: AiContextMetadata;
293
+ }
294
+ export type AgentContextRequest = TextContextRequest | FileContextRequest;
295
+ export interface BaseContextRequest {
296
+ contextId: string;
297
+ type: AiContextType;
298
+ metadata?: AiContextMetadata;
299
+ }
300
+ export type AiContextType = 'text' | 'file';
301
+ export interface TextContextRequest extends BaseContextRequest {
302
+ type: 'text';
303
+ title: string;
304
+ text: string;
263
305
  }
264
- export interface AiFileContext extends AiContextBase {
306
+ export interface FileContextRequest extends BaseContextRequest {
265
307
  type: 'file';
266
308
  extractImages?: boolean;
267
309
  minImageWidth?: number;
268
310
  minImageHeight?: number;
269
311
  fullPageAsImage?: boolean;
270
312
  extractionModel?: AiChatModelName;
313
+ password?: string;
271
314
  }
272
- /**
273
- * Provides context to the security rules of an AI Agent for each new user prompt.
274
- * Refer to the `@secureAiChatbotChat` annotation for more details.
275
- */
276
- export declare class AiChatContext {
277
- readonly prompt?: string;
278
- readonly profileId: AiAgentId;
279
- }
280
- export type AiContext = AiTextContext | AiUrlContext | AiFileContext;
281
315
  export type AiContextMetadataValue = number | string | boolean | undefined;
282
316
  export type AiContextMetadataValueArray = AiContextMetadataValue[];
283
317
  export interface AiContextMetadataEqFilter {
@@ -319,3 +353,4 @@ export interface AiContextMetadataOrFilter {
319
353
  }
320
354
  export type AiContextMetadataFilter = AiContextMetadataFieldFilter | AiContextMetadataAndFilter | AiContextMetadataOrFilter;
321
355
  export type AiContextMetadata = Record<string, AiContextMetadataValue>;
356
+ export {};
@@ -7,8 +7,6 @@ export type StorageActionType = 'read' | 'write' | 'update' | 'insert' | 'delete
7
7
  export type TopicActionType = 'read' | 'write' | 'all';
8
8
  /** The different type of actions for metrics. */
9
9
  export type MetricActionType = 'write' | 'all';
10
- /** Types of actions that can be performed on an AI chatbot. */
11
- export type AiActionType = 'chat' | 'mutate' | 'all';
12
10
  export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
13
11
  export interface AiFunctionParam {
14
12
  name: string;
@@ -10,6 +10,5 @@ export type SquidDocId = string;
10
10
  export type ClientRequestId = string;
11
11
  /** ID of AI agent. Also known as AI profile id. */
12
12
  export type AiAgentId = string;
13
- export type AiProfileId = AiAgentId;
14
13
  export declare const BUILT_IN_AGENT_ID = "built_in_agent";
15
14
  export type AiContextId = string;