@squidcloud/client 1.0.434 → 1.0.436

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.
@@ -14,6 +14,10 @@ export interface AiAgentDatabaseIntegrationOptions {
14
14
  collectionsToUse?: string[];
15
15
  /** If true, disables the code interpreter when analyzing query results. Default: false. */
16
16
  disableCodeInterpreter?: boolean;
17
+ /** Disables the whole analyze stage (includes code interpreter). */
18
+ disableAnalyzeStage?: boolean;
19
+ /** Enables raw results in the response. */
20
+ enableRawResults?: boolean;
17
21
  /** If true, provides more detailed status updates during AI query execution. Default: false. */
18
22
  verboseStatusUpdates?: boolean;
19
23
  /** If provided, this agent will be used to generate the query. */
@@ -239,7 +239,14 @@ export interface AiFileUrl {
239
239
  /** The file name, can be used in the prompt to reference the file. */
240
240
  fileName?: string;
241
241
  }
242
- /** The purpose of the AI file, used to determine how the file should be processed or utilized. */
242
+ /**
243
+ * The purpose of the AI file, used to determine how the file should be processed or utilized.
244
+ *
245
+ * - `'context'` - The file is included directly in the AI prompt as contextual content (e.g., images, PDFs).
246
+ * Use this for files that the AI should reference when generating a response.
247
+ * - `'tools'` - The file is returned as part of a tool/function call result (e.g., query results, generated documents).
248
+ * Use this for files produced by AI tools or integrations that should be delivered to the caller alongside the response.
249
+ */
243
250
  export type AiFilePurpose = 'context' | 'tools';
244
251
  /**
245
252
  * Metadata for an AI agent connected to an integration.
@@ -593,7 +600,7 @@ export interface AiStatusMessage {
593
600
  /** ID of the status update message. */
594
601
  messageId: string;
595
602
  /** The ID of the agent generating the status message. */
596
- agentId: AiAgentId;
603
+ agentId?: AiAgentId;
597
604
  /** An optional chat ID associated with the status message. */
598
605
  chatId?: string;
599
606
  /** The title or summary of the status message. */
@@ -8,7 +8,7 @@ export declare const RERANK_PROVIDERS: readonly ["cohere", "none"];
8
8
  */
9
9
  export type AiRerankProvider = (typeof RERANK_PROVIDERS)[number];
10
10
  /** List of available AI provider types. See AiProviderType. */
11
- export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "flux", "gemini", "openai", "grok", "stability", "voyage", "external"];
11
+ export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "flux", "gemini", "openai", "grok", "stability", "voyage", "mistral", "textract", "external"];
12
12
  /**
13
13
  * Type of the AI provider.
14
14
  * References a single AI service, regardless of the model or other AI function it provides (like
@@ -1,6 +1,7 @@
1
- import { AiChatOptions, AiSessionContext } from './ai-agent.public-types';
1
+ import { AiAgentMemoryOptions, AiChatOptions, AiFileUrl, AiSessionContext } from './ai-agent.public-types';
2
2
  import { ApiOptions } from './api-client.public-types';
3
3
  import { AiAgentId, IntegrationId } from './communication.public-types';
4
+ import { PartialBy } from './typescript.public-types';
4
5
  /**
5
6
  * Options for configuring AI query execution.
6
7
  * @category AI
@@ -13,16 +14,16 @@ export interface AiQueryOptions {
13
14
  instructions?: string;
14
15
  /** Whether to enable raw results output. */
15
16
  enableRawResults?: boolean;
16
- /** Whether to generate a step-by-step walkthrough for the response. */
17
- generateWalkthrough?: boolean;
18
17
  /** Options for the collection selection stage. */
19
18
  selectCollectionsOptions?: AiQuerySelectCollectionsOptions;
20
19
  /** Options for the query generation stage. */
21
20
  generateQueryOptions?: AiQueryGenerateQueryOptions;
22
- /** Options specify how to query result should be analyzed (processed) before returning it to user. */
21
+ /** Options to specify how the query result should be analyzed (processed) before returning it to the user. */
23
22
  analyzeResultsOptions?: AiQueryAnalyzeResultsOptions;
24
23
  /** Session information for the AI query execution. */
25
- sessionContext?: AiSessionContext;
24
+ sessionContext?: PartialBy<AiSessionContext, 'agentId'>;
25
+ /** memory options */
26
+ memoryOptions?: AiAgentMemoryOptions;
26
27
  }
27
28
  /**
28
29
  * Request to execute an AI query using a specific integration.
@@ -85,6 +86,12 @@ export interface AiQueryGenerateQueryOptions {
85
86
  }
86
87
  /** Options for the query result analysis. */
87
88
  export interface AiQueryAnalyzeResultsOptions {
89
+ /**
90
+ * When set to true, the stage is disabled.
91
+ * The response will contain generated queries, raw results, and a hardcoded text in the answer
92
+ * to check the result files.
93
+ */
94
+ disabled?: boolean;
88
95
  /** Enables or disables code interpreter mode. Default: 'false'. */
89
96
  enableCodeInterpreter?: boolean;
90
97
  /** Customizes AI agent behavior used by the stage. */
@@ -105,6 +112,8 @@ export interface ExecutedQueryInfo {
105
112
  purpose?: string;
106
113
  /** Whether this specific query executed successfully. */
107
114
  success: boolean;
115
+ /** Raw result file information. Undefined if upload failed or raw results are not enabled. */
116
+ rawResult?: AiFileUrl;
108
117
  }
109
118
  /**
110
119
  * Response from an AI query execution.
@@ -116,50 +125,26 @@ export interface AiQueryResponse {
116
125
  answer: string;
117
126
  /** Optional explanation for the AI-generated answer. */
118
127
  explanation?: string;
119
- /** All executed queries with their details. */
120
- executedQueries?: ExecutedQueryInfo[];
128
+ /** Executed queries with their details and raw result URLs. */
129
+ executedQueries: ExecutedQueryInfo[];
121
130
  /** Markdown format type of the executed query response. */
122
131
  queryMarkdownType?: string;
123
- /** URL to access raw results from the query execution. */
132
+ /**
133
+ * @deprecated Use {@link ExecutedQueryInfo.rawResult} in {@link executedQueries} instead.
134
+ * URL to access raw results from the first executed query. Populated for backward compatibility.
135
+ */
124
136
  rawResultsUrl?: string;
125
137
  /** Indicates whether the query execution was successful. */
126
138
  success: boolean;
127
- /** Indicates whether code interpreter was used to analyze the results. */
139
+ /** Indicates whether a code interpreter was used to analyze the results. */
128
140
  usedCodeInterpreter?: boolean;
129
141
  /**
130
142
  * When the AI needs clarification to generate a query, this field contains the clarification question.
131
- * Only populated when `generateQueryOptions.allowClarification` is enabled and the AI determines
143
+ * Only populated when `generateQueryOptions.allowClarification` is enabled, and the AI determines
132
144
  * it cannot generate a valid query without more information.
133
145
  */
134
146
  clarificationQuestion?: string;
135
147
  }
136
- /**
137
- * Details of an executed query, including the query text and result type.
138
- * @category AI
139
- */
140
- export interface ExecutedQuery {
141
- /** Text of the executed query. */
142
- query: string;
143
- /** The Markdown type of the result (sql, mongo, etc.). */
144
- markdownType: string;
145
- /** URL to access raw results from the query execution. */
146
- rawResultsUrl?: string;
147
- }
148
- /**
149
- * Response from executing an AI query across multiple integrations.
150
- * Includes answers and explanations for each executed query.
151
- * @category AI
152
- */
153
- export interface ExecuteAiQueryMultiResponse {
154
- /** AI-generated answer for the multi-integration query. */
155
- answer: string;
156
- /** Optional explanation for the AI-generated response. */
157
- explanation?: string;
158
- /** List of executed queries with details. */
159
- executedQueries: Array<ExecutedQuery>;
160
- /** Indicates whether the query execution was successful. */
161
- success: boolean;
162
- }
163
148
  /**
164
149
  * The AI API call response
165
150
  * @category AI
@@ -1,6 +1,6 @@
1
1
  import { IntegrationId } from './communication.public-types';
2
2
  /** List of all integration types supported by Squid. */
3
- export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce_crm", "sap_hana", "sentry", "servicenow", "snowflake", "spanner", "xata", "zendesk", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible"];
3
+ export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_db", "built_in_gcs", "built_in_queue", "built_in_s3", "cassandra", "clickhouse", "cloudsql", "cockroach", "cognito", "connected_knowledgebases", "confluence", "confluent", "datadog", "db2", "descope", "documentdb", "dynamodb", "elasticsearch", "firebase_auth", "firestore", "gcs", "github", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jira_jsm", "jwt_hmac", "jwt_rsa", "kafka", "keycloak", "linear", "mariadb", "monday", "mongo", "mssql", "databricks", "mysql", "newrelic", "okta", "onedrive", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce_crm", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible"];
4
4
  /**
5
5
  * @category Database
6
6
  */
@@ -161,10 +161,6 @@ export interface GetAgentApiKeyRequest {
161
161
  export declare function validateAiContextMetadata(metadata: AiContextMetadata): void;
162
162
  export declare function validateAiContextMetadataFilter(filter: AiContextMetadataFilter): void;
163
163
  export declare const METADATA_SERVICE_FUNCTION_NAME = "default:metadata";
164
- export interface UpdateApplicationAiSettingsWebhookPayload {
165
- appId: AppId;
166
- aiSettings: ApplicationAiSettings;
167
- }
168
164
  export interface GetChatHistoryRequest {
169
165
  agentId: AiAgentId;
170
166
  memoryId: string;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Status lifecycle for management API keys.
3
+ * Keys must be suspended before they can be deleted.
4
+ * @category ManagementApiKey
5
+ */
6
+ export type ManagementApiKeyStatus = 'active' | 'suspended' | 'deleted';
7
+ /**
8
+ * Prefix for all management API keys.
9
+ * Used to identify and validate management keys.
10
+ * @category ManagementApiKey
11
+ */
12
+ export declare const MANAGEMENT_API_KEY_PREFIX = "squid_mgmt_";
13
+ /**
14
+ * Represents a user-level management API key.
15
+ * These keys provide programmatic access to manage organizations and applications
16
+ * where the user is an admin.
17
+ * @category ManagementApiKey
18
+ */
19
+ export interface ManagementApiKey {
20
+ /** Unique identifier for the API key */
21
+ id: string;
22
+ /** The user ID who owns this key */
23
+ userId: string;
24
+ /** Optional description for the key */
25
+ description?: string;
26
+ /** Current status of the key */
27
+ status: ManagementApiKeyStatus;
28
+ /** Timestamp when the key was created */
29
+ createdAt: Date;
30
+ /** Timestamp when the key was last updated */
31
+ updatedAt: Date;
32
+ /** Timestamp when the key was last used, if ever */
33
+ lastUsedAt?: Date;
34
+ }
35
+ /**
36
+ * Request to create a new management API key.
37
+ * @category ManagementApiKey
38
+ */
39
+ export interface CreateManagementApiKeyRequest {
40
+ /** Optional description for the key */
41
+ description?: string;
42
+ }
43
+ /**
44
+ * Response when creating a new management API key.
45
+ * The keyValue is only returned once during creation.
46
+ * @category ManagementApiKey
47
+ */
48
+ export interface CreateManagementApiKeyResponse {
49
+ /** The created key with its value (only shown once) */
50
+ key: ManagementApiKey & {
51
+ keyValue: string;
52
+ };
53
+ }
54
+ /**
55
+ * Request to update a management API key's status.
56
+ * @category ManagementApiKey
57
+ */
58
+ export interface UpdateManagementApiKeyRequest {
59
+ /** The ID of the key to update */
60
+ keyId: string;
61
+ /** New status (can only toggle between active and suspended) */
62
+ status: 'active' | 'suspended';
63
+ }
64
+ /**
65
+ * Request to delete a management API key.
66
+ * The key must be suspended before deletion.
67
+ * @category ManagementApiKey
68
+ */
69
+ export interface DeleteManagementApiKeyRequest {
70
+ /** The ID of the key to delete */
71
+ keyId: string;
72
+ }
73
+ /**
74
+ * Response containing a list of user's management API keys.
75
+ * @category ManagementApiKey
76
+ */
77
+ export interface ListManagementApiKeysResponse {
78
+ /** List of management API keys (without key values) */
79
+ keys: ManagementApiKey[];
80
+ }
81
+ /**
82
+ * Response from validating a management API key.
83
+ * @category ManagementApiKey
84
+ */
85
+ export interface ValidateManagementApiKeyResponse {
86
+ /** Whether the key is valid and active */
87
+ valid: boolean;
88
+ /** The user ID associated with the key (if valid) */
89
+ userId?: string;
90
+ /** The key ID (if valid) */
91
+ keyId?: string;
92
+ }
@@ -137,8 +137,9 @@ export declare class AiAgentReference {
137
137
  askAsync<T extends AiChatModelName | undefined = undefined>(prompt: string, jobId: JobId, options?: AiAskOptions<T>): Promise<void>;
138
138
  /**
139
139
  * Observes live status messages from the agent.
140
+ * @param jobId The job ID to filter status updates for a specific job. If not provided, all status updates for the agent are observed.
140
141
  */
141
- observeStatusUpdates(): Observable<AiStatusMessage>;
142
+ observeStatusUpdates(jobId: JobId): Observable<AiStatusMessage>;
142
143
  /**
143
144
  * Returns a list of all chat history messages with the given 'memoryId'.
144
145
  * Includes both user and & AI messages.
@@ -1,3 +1,4 @@
1
+ import { Observable } from 'rxjs';
1
2
  import { AiQueryOptions, AiQueryResponse, ExecuteAiApiResponse } from '../../internal-common/src/public-types/ai-query.public-types';
2
3
  import { AiAgentClientOptions } from './agent/ai-agent-client';
3
4
  import { AiAgentReference } from './agent/ai-agent-client-reference';
@@ -6,7 +7,7 @@ import { AiFilesClient } from './ai-files-client';
6
7
  import { AiImageClient } from './ai-image-client';
7
8
  import { AiKnowledgeBaseReference } from './ai-knowledge-base/ai-knowledge-base-client-reference';
8
9
  import { AiMatchMakingClient } from './ai-matchmaking-client';
9
- import { AiAgent, AiAgentApiIntegrationOptions, AiAgentId, AiFileProviderType, AiKnowledgeBase, AiKnowledgeBaseId, AiProviderType, AiSessionContext, ApplicationAiSettings, IntegrationId, SecretKey } from './public-types';
10
+ import { AiAgent, AiAgentApiIntegrationOptions, AiAgentId, AiFileProviderType, AiKnowledgeBase, AiKnowledgeBaseId, AiProviderType, AiSessionContext, AiStatusMessage, ApplicationAiSettings, IntegrationId, JobId, SecretKey } from './public-types';
10
11
  /**
11
12
  * AiClient class serves as a facade for interacting with different AI services.
12
13
  * It provides simplified access to AI chatbot and assistant functionalities
@@ -117,6 +118,11 @@ export declare class AiClient {
117
118
  * Returns the updated state of the AI application settings.
118
119
  */
119
120
  setAiProviderApiKeySecret(providerType: AiProviderType, secretKey: SecretKey | undefined): Promise<ApplicationAiSettings>;
121
+ /**
122
+ * Observes live status messages for all AI updates.
123
+ * @param jobId (Optional) If provided, filters status updates to only those related to the given job ID.
124
+ */
125
+ observeStatusUpdates(jobId?: JobId): Observable<AiStatusMessage>;
120
126
  private getAiAgentClient;
121
127
  private getAiKnowledgeBaseClient;
122
128
  }
@@ -31,6 +31,7 @@ export * from './extraction-client';
31
31
  export * from './file-args-transformer';
32
32
  export * from './integration-client';
33
33
  export * from './job-client';
34
+ export * from './management-client';
34
35
  export * from './mutation/mutation-sender';
35
36
  export * from './native-query-manager';
36
37
  export * from './notification-client';
@@ -0,0 +1,129 @@
1
+ import { SquidRegion } from '../../internal-common/src/public-types/regions.public-types';
2
+ /**
3
+ * Supported cloud providers for application creation.
4
+ * @category ManagementClient
5
+ */
6
+ export type ManagementCloudId = 'aws' | 'gcp' | 'azure';
7
+ /**
8
+ * Options for creating a ManagementClient.
9
+ * @category ManagementClient
10
+ */
11
+ export interface ManagementClientOptions {
12
+ /** The management API key (starts with 'squid_mgmt_') */
13
+ apiKey: string;
14
+ /** The Squid region to connect to */
15
+ region: SquidRegion;
16
+ }
17
+ /**
18
+ * Request to create a new organization.
19
+ * @category ManagementClient
20
+ */
21
+ export interface ManagementCreateOrganizationRequest {
22
+ /** Name of the organization (2-50 characters) */
23
+ name: string;
24
+ }
25
+ /**
26
+ * Response from creating a new organization.
27
+ * @category ManagementClient
28
+ */
29
+ export interface ManagementCreateOrganizationResponse {
30
+ /** The ID of the created organization */
31
+ organizationId: string;
32
+ }
33
+ /**
34
+ * Request to create a new application.
35
+ * @category ManagementClient
36
+ */
37
+ export interface ManagementCreateApplicationRequest {
38
+ /** The organization ID to create the application in */
39
+ organizationId: string;
40
+ /** Name of the application */
41
+ name: string;
42
+ /** Cloud provider for the application */
43
+ cloudId: ManagementCloudId;
44
+ /** Region within the cloud provider (e.g., 'us-east-1') */
45
+ region: string;
46
+ }
47
+ /**
48
+ * Response from creating a new application.
49
+ * @category ManagementClient
50
+ */
51
+ export interface ManagementCreateApplicationResponse {
52
+ /** The ID of the created application */
53
+ appId: string;
54
+ }
55
+ /**
56
+ * Request to delete an application.
57
+ * @category ManagementClient
58
+ */
59
+ export interface ManagementDeleteApplicationRequest {
60
+ /** The ID of the application to delete */
61
+ appId: string;
62
+ }
63
+ /**
64
+ * Client for programmatic management of Squid organizations and applications.
65
+ *
66
+ * Use this client to automate organization and application management
67
+ * using management API keys (created in the Squid Console Profile Settings).
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const client = new ManagementClient({
72
+ * apiKey: 'squid_mgmt_xxx...',
73
+ * region: 'us-east-1.aws'
74
+ * });
75
+ *
76
+ * // Create an organization
77
+ * const { organizationId } = await client.createOrganization({ name: 'My Org' });
78
+ *
79
+ * // Create an application
80
+ * const { appId } = await client.createApplication({
81
+ * organizationId,
82
+ * name: 'My App',
83
+ * cloudId: 'aws',
84
+ * region: 'us-east-1'
85
+ * });
86
+ *
87
+ * // Delete an application
88
+ * await client.deleteApplication({ appId });
89
+ * ```
90
+ *
91
+ * @category ManagementClient
92
+ */
93
+ export declare class ManagementClient {
94
+ private readonly apiKey;
95
+ private readonly region;
96
+ /**
97
+ * Creates a new ManagementClient.
98
+ *
99
+ * @param options - Configuration options including API key and region
100
+ * @throws Error if the API key does not start with 'squid_mgmt_'
101
+ */
102
+ constructor(options: ManagementClientOptions);
103
+ /**
104
+ * Creates a new organization.
105
+ * The user associated with the management API key becomes the admin of the new organization.
106
+ *
107
+ * @param request - The organization creation request
108
+ * @returns The created organization's ID
109
+ * @throws Error if organization name is invalid or key is unauthorized
110
+ */
111
+ createOrganization(request: ManagementCreateOrganizationRequest): Promise<ManagementCreateOrganizationResponse>;
112
+ /**
113
+ * Creates a new application in an organization.
114
+ * Requires the user to be an admin in the target organization.
115
+ *
116
+ * @param request - The application creation request
117
+ * @returns The created application's ID
118
+ * @throws Error if user is not admin or organization quota reached
119
+ */
120
+ createApplication(request: ManagementCreateApplicationRequest): Promise<ManagementCreateApplicationResponse>;
121
+ /**
122
+ * Deletes an application.
123
+ * Requires the user to be an admin in the application's organization.
124
+ *
125
+ * @param request - The application deletion request
126
+ * @throws Error if user is not admin or application not found
127
+ */
128
+ deleteApplication(request: ManagementDeleteApplicationRequest): Promise<void>;
129
+ }
@@ -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.434";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.436";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.434",
3
+ "version": "1.0.436",
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.18.3"
44
+ "ws": "^8.19.0"
45
45
  },
46
46
  "optionalDependencies": {
47
47
  "bufferutil": "^4.0.8",