@squidcloud/client 1.0.391 → 1.0.393

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 (21) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.js +1 -1
  3. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +96 -41
  4. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +5 -18
  5. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +63 -3
  6. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +56 -12
  7. package/dist/internal-common/src/public-types/api.public-types.d.ts +1 -10
  8. package/dist/internal-common/src/public-types/communication.public-types.d.ts +1 -1
  9. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +12 -0
  10. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  11. package/dist/internal-common/src/types/ai-agent.types.d.ts +4 -1
  12. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +27 -12
  13. package/dist/internal-common/src/utils/global.utils.d.ts +1 -1
  14. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +14 -4
  15. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +11 -1
  16. package/dist/typescript-client/src/ai-client.d.ts +10 -15
  17. package/dist/typescript-client/src/{ai-knowledge-base.reference.d.ts → ai-knowledge-base/ai-knowledge-base-client-reference.d.ts} +12 -4
  18. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +28 -0
  19. package/dist/typescript-client/src/index.d.ts +2 -1
  20. package/dist/typescript-client/src/version.d.ts +1 -1
  21. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import { AgentContextRequest, AiAgent, AiAgentContext, AiAudioCreateSpeechOptions, AiChatOptions, AiGenerateImageOptions, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions, ApplicationAiSettings } from '../public-types/ai-agent.public-types';
1
+ import { AgentContextRequest, AiAgent, AiAgentContext, AiAnnotation, AiAudioCreateSpeechOptions, AiChatOptions, AiGenerateImageOptions, AiSearchOptions, AiSearchResultChunk, AllAiAgentChatOptions, ApplicationAiSettings } from '../public-types/ai-agent.public-types';
2
2
  import { AiChatModelName, AiEmbeddingsModelName, AiProviderType } from '../public-types/ai-common.public-types';
3
3
  import { AiContextMetadata, AiContextMetadataFilter } from '../public-types/ai-knowledge-base.public-types';
4
4
  import { AiAgentId, AiKnowledgeBaseId, AppId, ClientRequestId } from '../public-types/communication.public-types';
@@ -49,15 +49,18 @@ export interface AiContextSizeResponse {
49
49
  }
50
50
  export interface AiAskResponse {
51
51
  responseString: string;
52
+ annotations?: Record<string, AiAnnotation>;
52
53
  }
53
54
  export interface AiAskWithVoiceResponse {
54
55
  responseString: string;
55
56
  voiceResponse: AiAudioCreateSpeechResponse;
57
+ annotations?: Record<string, AiAnnotation>;
56
58
  }
57
59
  export interface AiTranscribeAndAskWithVoiceResponse {
58
60
  transcribedPrompt: string;
59
61
  responseString: string;
60
62
  voiceResponse: AiAudioCreateSpeechResponse;
63
+ annotations?: Record<string, AiAnnotation>;
61
64
  }
62
65
  export interface AiTranscribeAndChatResponse {
63
66
  transcribedPrompt: string;
@@ -1,4 +1,5 @@
1
- import { AiKnowledgeBase, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseSearchOptions, AiKnowledgeBaseSearchResultChunk } from '../public-types/ai-knowledge-base.public-types';
1
+ import { AiKnowledgeBase, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseSearchResultChunk, AiKnowledgeBaseWithOptionalChatModel, AllAiKnowledgeBaseChatOptions } from '../public-types/ai-knowledge-base.public-types';
2
+ import { AiKnowledgeBaseId, AppId } from '../public-types/communication.public-types';
2
3
  /**
3
4
  * Request structure for getting an AiKnowledgeBase
4
5
  * @category AI
@@ -29,7 +30,7 @@ export interface DeleteAiKnowledgeBaseRequest {
29
30
  */
30
31
  export interface UpsertAiKnowledgeBaseRequest {
31
32
  /** The AiKnowledgeBase to upsert */
32
- knowledgeBase: AiKnowledgeBase;
33
+ knowledgeBase: AiKnowledgeBaseWithOptionalChatModel;
33
34
  }
34
35
  /**
35
36
  * Response structure for listing AiKnowledgeBases
@@ -95,16 +96,6 @@ export interface UpsertAiKnowledgeBaseContextsRequest {
95
96
  /** The job ID to use for the async upsert job */
96
97
  jobId: string;
97
98
  }
98
- /**
99
- * Request structure for searching an AiKnowledgeBase
100
- * @category AI
101
- */
102
- export interface AiKnowledgeBaseSearchRequest {
103
- /** The id of the AiKnowledgeBase */
104
- knowledgeBaseId: string;
105
- /** The search options for this search */
106
- options: AiKnowledgeBaseSearchOptions;
107
- }
108
99
  /**
109
100
  * Response structure for searching an AiKnowledgeBase
110
101
  * @category AI
@@ -113,3 +104,27 @@ export interface AiKnowledgeBaseSearchResponse {
113
104
  /** Array of result chunks from the search */
114
105
  chunks: Array<AiKnowledgeBaseSearchResultChunk>;
115
106
  }
107
+ /**
108
+ * Request structure for getting the size of context
109
+ * for an AiKnowledgeBase
110
+ * @category AI
111
+ */
112
+ export interface AiKnowledgeBaseContextSizeRequest {
113
+ /** The ID of the App */
114
+ appId: AppId;
115
+ /** The ID of the AIKnowledgeBase */
116
+ knowledgeBaseId: AiKnowledgeBaseId;
117
+ }
118
+ /**
119
+ * Response structure for getting size of context
120
+ * @category AI
121
+ */
122
+ export interface AiKnowledgeBaseContextSizeResponse {
123
+ /** Size of context bytes, as a number */
124
+ sizeBytes: number;
125
+ }
126
+ export interface AiKnowledgeBaseChatRequest {
127
+ knowledgeBaseId: AiKnowledgeBaseId;
128
+ prompt?: string;
129
+ options?: AllAiKnowledgeBaseChatOptions;
130
+ }
@@ -1 +1 @@
1
- export declare function isTimestampEnabled(): boolean;
1
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
- import { AgentContextRequest, AiAgent, AiAgentContext, AiConnectedAgentMetadata, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, GuardrailsOptions, UpsertAgentContextsResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { AgentContextRequest, AiAgent, AiAgentContext, AiConnectedAgentMetadata, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, GuardrailsOptions, UpsertAgentContextResponse, UpsertAgentContextsResponse, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
3
3
  import { AiChatModelName } from '../../../internal-common/src/public-types/ai-common.public-types';
4
4
  import { JobId } from '../../../internal-common/src/public-types/job.public-types';
5
- import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
5
+ import { AiAskOptions, AiAskOptionsWithVoice, AiChatOptionsWithoutVoice, AskResponse, AskWithVoiceResponse, TranscribeAndAskWithVoiceResponse, TranscribeAndChatResponse } from './ai-agent-client.types';
6
6
  /**
7
7
  * Parameters for creating or updating an AI agent.
8
8
  * Excludes the `id` field, as it is derived from the agent instance.
@@ -64,7 +64,7 @@ export declare class AiAgentReference {
64
64
  /**
65
65
  * Adds or updates a single agent context.
66
66
  */
67
- upsertContext(contextRequest: AgentContextRequest, file?: File): Promise<void>;
67
+ upsertContext(contextRequest: AgentContextRequest, file?: File): Promise<UpsertAgentContextResponse>;
68
68
  /**
69
69
  * Adds or updates multiple agent contexts.
70
70
  */
@@ -112,7 +112,7 @@ export declare class AiAgentReference {
112
112
  */
113
113
  search(options: AiSearchOptions): Promise<Array<AiSearchResultChunk>>;
114
114
  /**
115
- * Sends a prompt and receives a full string response.
115
+ * Sends a prompt and returns a full string response.
116
116
  * @param prompt The text prompt to send to the agent.
117
117
  * @param options Optional parameters for the AI ask request.
118
118
  * @param jobId (Optional) A unique identifier for this request. Use it with `squid.jobs().awaitJob(jobId)` or
@@ -120,9 +120,19 @@ export declare class AiAgentReference {
120
120
  * knows it can look up the job’s status.
121
121
  */
122
122
  ask<T extends AiChatModelName | undefined = undefined>(prompt: string, options?: AiAskOptions<T>, jobId?: JobId): Promise<string>;
123
+ /**
124
+ * Sends a prompt and returns the string response and file annotations.
125
+ * @param prompt The text prompt to send to the agent.
126
+ * @param options Optional parameters for the AI ask request.
127
+ * @param jobId (Optional) A unique identifier for this request. Use it with `squid.jobs().awaitJob(jobId)` or
128
+ * `squid.jobs().getJob(jobId)` to track progress. Make sure each job ID is both unique and kept private—anyone who
129
+ * knows it can look up the job’s status.
130
+ */
131
+ askWithAnnotations<T extends AiChatModelName | undefined = undefined>(prompt: string, options?: AiAskOptions<T>, jobId?: JobId): Promise<AskResponse>;
123
132
  /**
124
133
  * Sends a prompt and not wait for the result - the result can be tracked using the job ID
125
134
  * (`squid.jobs().awaitJob(jobId)` or `squid.jobs().getJob(jobId)).
135
+ * The result is of type AiAskResponse which contains the response string and optional annotations.
126
136
  * @param prompt The text prompt to send to the agent.
127
137
  * @param jobId A unique identifier for this request. Use it with `squid.jobs().awaitJob(jobId)` or
128
138
  * `squid.jobs().getJob(jobId)`
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { AiChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { AiAnnotation, AiChatOptions } from '../../../internal-common/src/public-types/ai-agent.public-types';
3
3
  import { AiChatModelName } from '../../../internal-common/src/public-types/ai-common.public-types';
4
4
  /**
5
5
  * Response format for transcribing audio and generating a chat response.
@@ -25,6 +25,16 @@ export interface TranscribeAndAskWithVoiceResponse {
25
25
  /** AI-generated voice response as an audio file. */
26
26
  voiceResponseFile: File;
27
27
  }
28
+ /**
29
+ * Response from an AI agent when asked a question or given a task.
30
+ * @category AI
31
+ */
32
+ export interface AskResponse {
33
+ /** The main text response from the AI agent. */
34
+ responseString: string;
35
+ /** Optional annotations that provide additional context or metadata about the response. */
36
+ annotations?: Record<string, AiAnnotation>;
37
+ }
28
38
  /**
29
39
  * Response format for AI-generated voice responses.
30
40
  * Contains the AI-generated text response and the corresponding audio file.
@@ -1,11 +1,11 @@
1
- import { ExecuteAiApiResponse, ExecuteAiQueryMultiResponse, ExecuteAiQueryOptions, ExecuteAiQueryResponse } from '../../internal-common/src/public-types/ai-query.public-types';
1
+ import { ExecuteAiApiResponse, ExecuteAiQueryOptions, ExecuteAiQueryResponse } from '../../internal-common/src/public-types/ai-query.public-types';
2
2
  import { AiAgentReference } from './agent/ai-agent-client-reference';
3
3
  import { AiAssistantClient } from './ai-assistant-client';
4
4
  import { AiAudioClient } from './ai-audio-client';
5
5
  import { AiImageClient } from './ai-image-client';
6
- import { AiKnowledgeBaseReference } from './ai-knowledge-base.reference';
6
+ import { AiKnowledgeBaseReference } from './ai-knowledge-base/ai-knowledge-base-client-reference';
7
7
  import { AiMatchMakingClient } from './ai-matchmaking-client';
8
- import { AiAgent, AiAgentId, AiProviderType, ApplicationAiSettings, IntegrationId, SecretKey } from './public-types';
8
+ import { AiAgent, AiAgentId, AiKnowledgeBase, AiKnowledgeBaseId, AiProviderType, ApplicationAiSettings, IntegrationId, SecretKey } from './public-types';
9
9
  /**
10
10
  * AiClient class serves as a facade for interacting with different AI services.
11
11
  * It provides simplified access to AI chatbot and assistant functionalities
@@ -18,6 +18,7 @@ export declare class AiClient {
18
18
  private readonly jobClient;
19
19
  private readonly aiAssistantClient;
20
20
  private aiAgentClient?;
21
+ private aiKnowledgeBaseClient?;
21
22
  /**
22
23
  * Returns a reference to the specified AI agent.
23
24
  * If no ID is provided, the built-in agent is used by default.
@@ -26,11 +27,15 @@ export declare class AiClient {
26
27
  /**
27
28
  * Returns a reference to the specified AI knowledge base.
28
29
  */
29
- knowledgeBase(knowledgeBaseId: string): AiKnowledgeBaseReference;
30
+ knowledgeBase(knowledgeBaseId: AiKnowledgeBaseId): AiKnowledgeBaseReference;
30
31
  /**
31
32
  * Lists all available AI agents.
32
33
  */
33
34
  listAgents(): Promise<Array<AiAgent>>;
35
+ /**
36
+ * Lists all available AI agents.
37
+ */
38
+ listKnowledgeBases(): Promise<Array<AiKnowledgeBase>>;
34
39
  /**
35
40
  * Retrieves the AI assistant client.
36
41
  * @returns An instance of AiAssistantClient.
@@ -74,17 +79,6 @@ export declare class AiClient {
74
79
  * {@link https://docs.squid.cloud/docs/ai}.
75
80
  */
76
81
  executeAiQuery(integrationId: IntegrationId, prompt: string, options?: ExecuteAiQueryOptions): Promise<ExecuteAiQueryResponse>;
77
- /**
78
- * Executes an AI query across multiple database integrations and returns their responses.
79
- * Useful when querying multiple sources with the same prompt.
80
- *
81
- * @param integrationIds The list of integration IDs to query.
82
- * @param prompt The prompt to send to the AI.
83
- * @param options Optional query execution parameters.
84
- * @returns A promise resolving to the responses from all queried integrations.
85
- * @deprecated Use `executeAiQuery`.
86
- */
87
- executeAiQueryMulti(integrationIds: Array<IntegrationId>, prompt: string, options?: ExecuteAiQueryOptions): Promise<ExecuteAiQueryMultiResponse>;
88
82
  /**
89
83
  * Request to execute an AI-powered API call.
90
84
  * Allows specifying allowed endpoints and whether to provide an explanation.
@@ -105,4 +99,5 @@ export declare class AiClient {
105
99
  */
106
100
  setAiProviderApiKeySecret(providerType: AiProviderType, secretKey: SecretKey | undefined): Promise<ApplicationAiSettings>;
107
101
  private getAiAgentClient;
102
+ private getAiKnowledgeBaseClient;
108
103
  }
@@ -1,4 +1,10 @@
1
- import { AiKnowledgeBase, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseSearchOptions, AiKnowledgeBaseSearchResultChunk, UpsertKnowledgeBaseContextsResponse } from '../../internal-common/src/public-types/ai-knowledge-base.public-types';
1
+ import { AiKnowledgeBase, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseSearchResultChunk, AiKnowledgeBaseWithOptionalChatModel, AllAiKnowledgeBaseChatOptions, UpsertKnowledgeBaseContextResponse, UpsertKnowledgeBaseContextsResponse } from '../../../internal-common/src/public-types/ai-knowledge-base.public-types';
2
+ /**
3
+ * Parameters for creating or updating an AI agent.
4
+ * Excludes the `id` field, as it is derived from the agent instance.
5
+ * @category AI
6
+ */
7
+ export type UpsertKnowledgeBaseRequestParams = Omit<AiKnowledgeBase, 'id'>;
2
8
  /**
3
9
  * A reference to an AI knowledge base.
4
10
  */
@@ -20,7 +26,7 @@ export declare class AiKnowledgeBaseReference {
20
26
  * Upserts the AI knowledge base.
21
27
  * @param knowledgeBase
22
28
  */
23
- upsertKnowledgeBase(knowledgeBase: AiKnowledgeBase): Promise<void>;
29
+ upsertKnowledgeBase(knowledgeBase: Omit<AiKnowledgeBaseWithOptionalChatModel, 'id'>): Promise<void>;
24
30
  /**
25
31
  * Deletes the AI knowledge base.
26
32
  * @returns A promise that resolves when the deletion is complete.
@@ -45,7 +51,7 @@ export declare class AiKnowledgeBaseReference {
45
51
  /**
46
52
  * Adds or updates a single context.
47
53
  */
48
- upsertContext(contextRequest: AiKnowledgeBaseContextRequest, file?: File): Promise<void>;
54
+ upsertContext(contextRequest: AiKnowledgeBaseContextRequest, file?: File): Promise<UpsertKnowledgeBaseContextResponse>;
49
55
  /**
50
56
  * Adds or updates multiple contexts.
51
57
  */
@@ -53,5 +59,7 @@ export declare class AiKnowledgeBaseReference {
53
59
  /**
54
60
  * Performs a semantic search in the knowledge base.
55
61
  */
56
- search(options: AiKnowledgeBaseSearchOptions): Promise<Array<AiKnowledgeBaseSearchResultChunk>>;
62
+ search(options: AllAiKnowledgeBaseChatOptions & {
63
+ prompt: string;
64
+ }): Promise<Array<AiKnowledgeBaseSearchResultChunk>>;
57
65
  }
@@ -0,0 +1,28 @@
1
+ import { AiKnowledgeBase } from '../../../internal-common/src/public-types/ai-knowledge-base.public-types';
2
+ import { AiKnowledgeBaseId } from '../../../internal-common/src/public-types/communication.public-types';
3
+ import { AiKnowledgeBaseReference } from './ai-knowledge-base-client-reference';
4
+ /**
5
+ * AiKnowledgeBaseClient manages AI knowledgebase interactions, including
6
+ * listing knowledgebases.
7
+ *
8
+ * @category AI
9
+ */
10
+ export declare class AiKnowledgeBaseClient {
11
+ private readonly rpcManager;
12
+ private readonly jobClient;
13
+ /**
14
+ * Retrieves an instance of AiKnowledeBaseReference for a specific kb ID.
15
+ * This reference provides methods for interacting with the knowledgebase.
16
+ */
17
+ knowledgeBase(id: AiKnowledgeBaseId): AiKnowledgeBaseReference;
18
+ /**
19
+ * Lists all knowledgebases available in the system.
20
+ * @returns A promise that resolves to an array of AiKnowledgeBase instances.
21
+ */
22
+ listKnowledgeBases(): Promise<Array<AiKnowledgeBase>>;
23
+ /**
24
+ * Deletes the AI knowledge base.
25
+ * @returns A promise that resolves when the deletion is complete.
26
+ */
27
+ delete(id: AiKnowledgeBaseId): Promise<void>;
28
+ }
@@ -6,7 +6,8 @@ export * from './ai-assistant-client';
6
6
  export * from './ai-audio-client';
7
7
  export * from './ai-client';
8
8
  export * from './ai-image-client';
9
- export * from './ai-knowledge-base.reference';
9
+ export * from './ai-knowledge-base/ai-knowledge-base-client';
10
+ export * from './ai-knowledge-base/ai-knowledge-base-client-reference';
10
11
  export * from './ai-matchmaking-client';
11
12
  export * from './api-client';
12
13
  export * from './auth.manager';
@@ -2,4 +2,4 @@
2
2
  * The current version of the SquidCloud client package.
3
3
  * @category Platform
4
4
  */
5
- export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.391";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.393";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.391",
3
+ "version": "1.0.393",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -41,7 +41,7 @@
41
41
  "license": "ISC",
42
42
  "dependencies": {
43
43
  "json-schema-typed": "^8.0.1",
44
- "ws": "^8.17.1"
44
+ "ws": "^8.18.3"
45
45
  },
46
46
  "optionalDependencies": {
47
47
  "bufferutil": "^4.0.8",
@@ -51,8 +51,8 @@
51
51
  "rxjs": ">=7.5.7 <8.0.0"
52
52
  },
53
53
  "devDependencies": {
54
- "typedoc": "^0.28.0",
55
- "typedoc-plugin-markdown": "^4.5.2",
54
+ "typedoc": "^0.28.10",
55
+ "typedoc-plugin-markdown": "^4.8.1",
56
56
  "@supercharge/promise-pool": "^3.2.0",
57
57
  "@webpack-cli/generators": "^3.0.7",
58
58
  "copy-webpack-plugin": "^12.0.2",
@@ -61,7 +61,7 @@
61
61
  "otrie": "^1.2.1",
62
62
  "tsconfig-paths-webpack-plugin": "^4.1.0",
63
63
  "tscpaths": "^0.0.9",
64
- "webpack": "^5.96.0",
64
+ "webpack": "^5.101.3",
65
65
  "webpack-cli": "^5.1.4"
66
66
  },
67
67
  "browser": {