@squidcloud/client 1.0.413 → 1.0.415

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.
@@ -269,6 +269,22 @@ export interface AiAgentMemoryOptions {
269
269
  */
270
270
  expirationMinutes?: number;
271
271
  }
272
+ /**
273
+ * Model specification for integration-based LLM providers like Ollama.
274
+ * @category AI
275
+ */
276
+ export interface IntegrationModelSpec {
277
+ /** The integration ID that provides the LLM */
278
+ integrationId: IntegrationId;
279
+ /** The model name within that integration */
280
+ model: string;
281
+ }
282
+ /**
283
+ * Type for specifying which LLM model to use.
284
+ * Can be either a vendor model name (string) or an integration-based model (object).
285
+ * @category AI
286
+ */
287
+ export type AiChatModelSelection = AiChatModelName | IntegrationModelSpec;
272
288
  /**
273
289
  * The base AI agent chat options, should not be used directly.
274
290
  * @category AI
@@ -329,8 +345,8 @@ export interface BaseAiChatOptions {
329
345
  temperature?: number;
330
346
  /** Preset instruction options that can be toggled on */
331
347
  guardrails?: GuardrailsOptions;
332
- /** The LLM model to use. */
333
- model?: AiChatModelName;
348
+ /** The LLM model to use. Can be a vendor model name (string) or an integration-based model (object). */
349
+ model?: AiChatModelSelection;
334
350
  /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
335
351
  rerankProvider?: AiRerankProvider;
336
352
  /**
@@ -441,6 +457,8 @@ export interface AiAgent<T extends AiChatModelName | undefined = undefined> {
441
457
  options: AiChatOptions<T>;
442
458
  /** The embedding model name used by the agent. */
443
459
  embeddingModelName: AiEmbeddingsModelName;
460
+ /** Optional api key used specifically for operations on this agent */
461
+ apiKey?: string;
444
462
  }
445
463
  /**
446
464
  * @category AI
@@ -496,22 +514,6 @@ export interface AiChatMessage {
496
514
  export declare const AI_STATUS_MESSAGE_PARENT_MESSAGE_ID_TAG = "parent";
497
515
  /** The tag contains a response of the AI tool call. */
498
516
  export declare const AI_STATUS_MESSAGE_RESULT_TAG = "result";
499
- /**
500
- * The options for the AI agent search method.
501
- * @category AI
502
- */
503
- export interface AiSearchOptions {
504
- /** The prompt to search for */
505
- prompt: string;
506
- /** DEPRECATED: A set of filters that will limit the context the AI can access. */
507
- contextMetadataFilter?: AiContextMetadataFilter;
508
- /** A set of filters that will limit the context the AI can access. */
509
- contextMetadataFilterForKnowledgeBase?: Record<AiKnowledgeBaseId, AiContextMetadataFilter>;
510
- /** The maximum number of results to return */
511
- limit?: number;
512
- /** Which provider's reranker to use for reranking the context. Defaults to 'cohere'. */
513
- rerankProvider?: AiRerankProvider;
514
- }
515
517
  /**
516
518
  * A single chunk of data returned from an AI search operation.
517
519
  * @category AI
@@ -170,3 +170,11 @@ export type StableDiffusionModelName = (typeof STABLE_DIFFUSION_MODEL_NAMES)[num
170
170
  * @category AI
171
171
  */
172
172
  export type FluxModelName = (typeof FLUX_MODEL_NAMES)[number];
173
+ /**
174
+ * Type guard to check if a model selection is integration-based.
175
+ * @category AI
176
+ */
177
+ export declare function isIntegrationModelSpec(model: unknown): model is {
178
+ integrationId: string;
179
+ model: string;
180
+ };
@@ -0,0 +1,39 @@
1
+ import { IntegrationId } from '../communication.public-types';
2
+ /**
3
+ * Configuration for identifying a user's external auth connection.
4
+ * @category ExternalAuth
5
+ */
6
+ export interface ExternalAuthConfig {
7
+ /** The integration ID (e.g., 'google-calendar', 'microsoft-teams'). */
8
+ integrationId: IntegrationId;
9
+ /** User-specific identifier to distinguish between different users' tokens. */
10
+ identifier: string;
11
+ }
12
+ /**
13
+ * Request to save an authorization code and exchange it for tokens.
14
+ * @category ExternalAuth
15
+ */
16
+ export interface SaveAuthCodeRequest {
17
+ /** The authorization code from the auth provider. */
18
+ authCode: string;
19
+ /** Configuration identifying the user and integration. */
20
+ externalAuthConfig: ExternalAuthConfig;
21
+ }
22
+ /**
23
+ * Request to get a valid access token for an integration.
24
+ * @category ExternalAuth
25
+ */
26
+ export interface GetAccessTokenRequest {
27
+ /** Configuration identifying the user and integration. */
28
+ externalAuthConfig: ExternalAuthConfig;
29
+ }
30
+ /**
31
+ * Response containing a valid access token and expiration time.
32
+ * @category ExternalAuth
33
+ */
34
+ export interface GetAccessTokenResponse {
35
+ /** Valid access token for making API calls. */
36
+ accessToken: string;
37
+ /** When the access token expires. */
38
+ expirationTime: Date;
39
+ }
@@ -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", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "jwt_hmac", "jwt_rsa", "kafka", "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", "mail", "slack", "mcp", "a2a", "legend"];
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", "google_calendar", "google_docs", "google_drive", "graphql", "hubspot", "jira", "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", "mail", "slack", "mcp", "a2a", "legend", "ollama"];
4
4
  /**
5
5
  * @category Database
6
6
  */
@@ -8,7 +8,7 @@ export declare const DATA_INTEGRATION_TYPES: readonly ["bigquery", "built_in_db"
8
8
  /**
9
9
  * @category Auth
10
10
  */
11
- export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "descope", "firebase_auth"];
11
+ export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_hmac", "cognito", "okta", "keycloak", "descope", "firebase_auth"];
12
12
  /** Supported integration types for GraphQL-based services. */
13
13
  export declare const GRAPHQL_INTEGRATION_TYPES: readonly ["graphql", "linear"];
14
14
  /** Supported integration types for HTTP-based services. */
@@ -1,5 +1,5 @@
1
1
  import { Observable } from 'rxjs';
2
- import { AiAgent, AiChatMessage, AiConnectedAgentMetadata, AiSearchOptions, AiSearchResultChunk, AiStatusMessage, AiTranscribeAndAskResponse, AllAiAgentChatOptions, GuardrailsOptions, UpsertAgentRequest } from '../../../internal-common/src/public-types/ai-agent.public-types';
2
+ import { AiAgent, AiChatMessage, AiChatModelSelection, AiConnectedAgentMetadata, AiStatusMessage, AiTranscribeAndAskResponse, AllAiAgentChatOptions, GuardrailsOptions, 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
5
  import { Paths } from '../../../internal-common/src/public-types/typescript.public-types';
@@ -18,6 +18,7 @@ export type UpsertAgentRequestParams = Omit<UpsertAgentRequest, 'id'>;
18
18
  */
19
19
  export declare class AiAgentReference {
20
20
  private readonly agentId;
21
+ private readonly agentApiKey;
21
22
  private readonly ongoingChatSequences;
22
23
  private readonly rpcManager;
23
24
  private readonly socketManager;
@@ -42,7 +43,7 @@ export declare class AiAgentReference {
42
43
  /**
43
44
  * Changes the AI model used by the agent.
44
45
  */
45
- updateModel(model: AiChatModelName): Promise<void>;
46
+ updateModel(model: AiChatModelSelection): Promise<void>;
46
47
  /**
47
48
  * Updates the list of agents connected to this agent.
48
49
  */
@@ -59,6 +60,18 @@ export declare class AiAgentReference {
59
60
  * Deletes the custom guardrails for the agent.
60
61
  */
61
62
  deleteCustomGuardrail(): Promise<void>;
63
+ /**
64
+ * Regenerates the api key for the agent.
65
+ * Will throw an error if the agent does not exist.
66
+ *
67
+ * @returns the new api key
68
+ */
69
+ regenerateApiKey(): Promise<string>;
70
+ /**
71
+ * Fetches the default api key for the agent
72
+ * @returns the api key if one exists
73
+ */
74
+ getApiKey(): Promise<string | undefined>;
62
75
  /**
63
76
  * Sends a prompt to the agent and receives streamed text responses.
64
77
  * @param prompt The text prompt to send to the agent.
@@ -77,10 +90,6 @@ export declare class AiAgentReference {
77
90
  * knows it can look up the job’s status.
78
91
  */
79
92
  transcribeAndChat(fileToTranscribe: File, options?: AiChatOptionsWithoutVoice, jobId?: JobId): Promise<TranscribeAndChatResponse>;
80
- /**
81
- * Performs a semantic search using the agent's knowledge base.
82
- */
83
- search(options: AiSearchOptions): Promise<Array<AiSearchResultChunk>>;
84
93
  /**
85
94
  * Sends a prompt and returns a full string response.
86
95
  * @param prompt The text prompt to send to the agent.
@@ -165,4 +174,8 @@ export declare class AiAgentReference {
165
174
  private replaceFileTags;
166
175
  private askInternal;
167
176
  private chatInternal;
177
+ /**
178
+ * Calls rpcManager post but with the agent api key if one was given during construction
179
+ */
180
+ private post;
168
181
  }
@@ -1,5 +1,16 @@
1
1
  import { AiAgent, AiAgentId } from '../public-types';
2
2
  import { AiAgentReference } from './ai-agent-client-reference';
3
+ /**
4
+ * Allows the user to provide custom options to the agent client
5
+ *
6
+ * @category AI
7
+ */
8
+ export type AiAgentClientOptions = {
9
+ /**
10
+ * Allows providing an agent API key that can be used instead of the app API key
11
+ */
12
+ apiKey?: string;
13
+ };
3
14
  /**
4
15
  * AiAgentClient manages AI agent interactions, including listing agents,
5
16
  * handling real-time chat responses, and processing AI status updates
@@ -16,7 +27,7 @@ export declare class AiAgentClient {
16
27
  * Retrieves an instance of AiAgentReference for a specific agent ID.
17
28
  * This reference provides methods for interacting with the agent.
18
29
  */
19
- agent(id: AiAgentId): AiAgentReference;
30
+ agent(id: AiAgentId, options?: AiAgentClientOptions | undefined): AiAgentReference;
20
31
  /**
21
32
  * Lists all agents available in the system.
22
33
  * @returns A promise that resolves to an array of AiAgent instances.
@@ -1,4 +1,5 @@
1
1
  import { AiQueryOptions, AiQueryResponse, ExecuteAiApiResponse } from '../../internal-common/src/public-types/ai-query.public-types';
2
+ import { AiAgentClientOptions } from './agent/ai-agent-client';
2
3
  import { AiAgentReference } from './agent/ai-agent-client-reference';
3
4
  import { AiAssistantClient } from './ai-assistant-client';
4
5
  import { AiAudioClient } from './ai-audio-client';
@@ -24,7 +25,7 @@ export declare class AiClient {
24
25
  * Returns a reference to the specified AI agent.
25
26
  * If no ID is provided, the built-in agent is used by default.
26
27
  */
27
- agent(agentId?: AiAgentId): AiAgentReference;
28
+ agent(agentId?: AiAgentId, options?: AiAgentClientOptions | undefined): AiAgentReference;
28
29
  /**
29
30
  * Returns a reference to the specified AI knowledge base.
30
31
  */
@@ -4,8 +4,12 @@ import { Observable } from 'rxjs';
4
4
  * @category Platform
5
5
  */
6
6
  export interface DistributedLock {
7
- /** Releases the lock. */
8
- release(): void;
7
+ /**
8
+ * Releases the lock by sending a release message to the server.
9
+ * The release process runs asynchronously. Use `observeRelease()` to be notified when the release completes.
10
+ * @returns A promise that resolves when the release message is sent, or undefined for backward compatibility.
11
+ */
12
+ release(): Promise<void> | void;
9
13
  /**
10
14
  * Whether the lock has been released.
11
15
  * @returns True if the lock has been released.
@@ -0,0 +1,36 @@
1
+ import { GetAccessTokenResponse } from '../../internal-common/src/public-types/external-auth/external-auth.public-types';
2
+ /**
3
+ * Client for managing authentication tokens for external integrations.
4
+ *
5
+ * Provides methods for saving and retrieving auth tokens for external services.
6
+ * @category ExternalAuth
7
+ */
8
+ export declare class ExternalAuthClient {
9
+ private readonly integrationId;
10
+ private readonly rpcManager;
11
+ /**
12
+ * Takes an auth token, potentially exchanges the auth token with an external api depending on the external auth,
13
+ * and stores the result in Squid's secure storage.
14
+ *
15
+ * This function requires Squid to be initialized with an API key
16
+ *
17
+ * @param authCode - The authorization code obtained from the auth provider's callback.
18
+ * @param identifier - A user-specific identifier (usually a user ID) to associate with the tokens.
19
+ * This allows multiple users to connect their own accounts to the same integration.
20
+ * @returns A promise that resolves with the access token and its expiration time.
21
+ */
22
+ saveAuthCode(authCode: string, identifier: string): Promise<GetAccessTokenResponse>;
23
+ /**
24
+ * Retrieves a valid access token for the integration.
25
+ * Automatically refreshes the token if it has expired or is about to expire.
26
+ *
27
+ * This function requires Squid to be initialized with an API key
28
+ *
29
+ * @param identifier - The user-specific identifier that was used when saving the auth code.
30
+ * @returns A promise that resolves with a valid access token and its expiration time.
31
+ *
32
+ * @throws Error if no tokens are found for the given integration and identifier.
33
+ * The user must first complete the auth flow by calling `saveAuthCode()`.
34
+ */
35
+ getAccessToken(identifier: string): Promise<GetAccessTokenResponse>;
36
+ }
@@ -26,6 +26,7 @@ export * from './document-reference';
26
26
  export * from './document-reference.factory';
27
27
  export * from './document-store';
28
28
  export * from './execute-function-options';
29
+ export * from './external-auth-client';
29
30
  export * from './extraction-client';
30
31
  export * from './file-args-transformer';
31
32
  export * from './file-utils';
@@ -12,6 +12,7 @@ export * from '../../internal-common/src/public-types/code-executor.public-types
12
12
  export * from '../../internal-common/src/public-types/communication.public-types';
13
13
  export * from '../../internal-common/src/public-types/context.public-types';
14
14
  export * from '../../internal-common/src/public-types/document.public-types';
15
+ export * from '../../internal-common/src/public-types/external-auth/external-auth.public-types';
15
16
  export * from '../../internal-common/src/public-types/extraction.public-types';
16
17
  export * from '../../internal-common/src/public-types/http-status.public-types';
17
18
  export * from '../../internal-common/src/public-types/integration.public-types';
@@ -5,6 +5,7 @@ import { CollectionReference } from './collection-reference';
5
5
  import { ConnectionDetails } from './connection-details';
6
6
  import { DistributedLock } from './distributed-lock.manager';
7
7
  import { ExecuteFunctionOptions } from './execute-function-options';
8
+ import { ExternalAuthClient } from './external-auth-client';
8
9
  import { ExtractionClient } from './extraction-client';
9
10
  import { JobClient } from './job-client';
10
11
  import { NotificationClient } from './notification-client';
@@ -330,6 +331,15 @@ export declare class Squid {
330
331
  * @param integrationId The storage integration ID to use.
331
332
  */
332
333
  personalStorage(integrationId: IntegrationId): PersonalStorageClient;
334
+ /**
335
+ * Returns a client for managing external oauth tokens for integrations.
336
+ * Use this to save authorization codes and retrieve access tokens.
337
+ * Squid automatically handles token refresh when tokens expire.
338
+ *
339
+ * @param integrationId The integration ID
340
+ * @returns An ExternalAuthClient instance for the specified integration
341
+ */
342
+ externalAuth(integrationId: IntegrationId): ExternalAuthClient;
333
343
  /**
334
344
  * Returns a client for working with structured data extraction tools.
335
345
  */
@@ -363,6 +373,8 @@ export declare class Squid {
363
373
  * @returns A promise that resolves when the destruct process is complete.
364
374
  */
365
375
  destruct(): Promise<void>;
376
+ /** Set to true if the client was destructured. */
377
+ get isDestructed(): boolean;
366
378
  /** Provides information about the connection to the Squid Server. */
367
379
  connectionDetails(): ConnectionDetails;
368
380
  /** Returns the notification client for handling (publishing and receiving) custom messages. */
@@ -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.413";
5
+ export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.415";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.413",
3
+ "version": "1.0.415",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",