@squidcloud/client
Advanced tools
| /** | ||
| * Names of the Squid metrics. | ||
| * Should be in sync with MetricName.kt. | ||
| * See MetricName.kt for documentation on each value. | ||
| */ | ||
| export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatOutcome_count", "squid_aiImageGeneration_count", "squid_aiImageGeneration_time", "squid_aiRemoveBackground_count", "squid_aiRemoveBackground_time", "squid_aiAudioTranscribe_count", "squid_aiAudioTranscribe_time", "squid_aiAudioCreateSpeech_count", "squid_aiAudioCreateSpeech_time", "squid_aiIntegrationData_count", "squid_aiIntegrationData_time", "squid_aiIntegrationApi_count", "squid_aiIntegrationApi_time", "squid_apiControllerCall_count", "squid_apiControllerCall_time", "squid_aiContextUpsert_count", "squid_aiContextDelete_count", "squid_codeInitialization_count", "squid_codeInitialization_time", "squid_deleteApiKey_count", "squid_deleteApiKey_time", "squid_deleteSecret_count", "squid_deleteSecret_time", "squid_discoverGraphQLConnectionSchema_count", "squid_discoverGraphQLConnectionSchema_time", "squid_discoverOpenApiSchema_count", "squid_discoverOpenApiSchema_time", "squid_discoverOpenApiSchemaFromFile_count", "squid_discoverOpenApiSchemaFromFile_time", "squid_executeBackendFunction_count", "squid_executeBackendFunction_time", "squid_getAiChatbotProfiles_count", "squid_getAiChatbotProfiles_time", "squid_getAllApiKeys_count", "squid_getAllApiKeys_time", "squid_getAllSecrets_count", "squid_getAllSecrets_time", "squid_getAppApiKey_count", "squid_getAppApiKey_time", "squid_getSecret_count", "squid_getSecret_time", "squid_graphql_count", "squid_graphql_time", "squid_graphqlQuery_count", "squid_graphqlQuery_time", "squid_integrationCount_value", "squid_mutate_count", "squid_mutate_time", "squid_metricQuery_count", "squid_metricQuery_time", "squid_metricReport_count", "squid_metricReport_time", "squid_nativeQuery_count", "squid_nativeQuery_time", "squid_openapi_count", "squid_openapi_time", "squid_produceTopicMessage_count", "squid_produceTopicMessage_time", "squid_query_count", "squid_query_time", "squid_registerQuery_count", "squid_registerQuery_time", "squid_rerankChunks_count", "squid_rerankChunks_time", "squid_schedulerJob_count", "squid_schedulerJob_time", "squid_schema_size", "squid_secrets_entries", "squid_storageDeleteFiles_count", "squid_storageDeleteFiles_time", "squid_storageGetDownloadUrl_count", "squid_storageGetDownloadUrl_time", "squid_storageGetFileMetadata_count", "squid_storageGetFileMetadata_time", "squid_storageListDirectoryContents_count", "squid_storageListDirectoryContents_time", "squid_storageUploadFile_count", "squid_storageUploadFile_time", "squid_subscribeToTopic_count", "squid_subscribeToTopic_time", "squid_testGraphQLConnection_count", "squid_testGraphQLConnection_time", "squid_testAgentProtocolConnection_count", "squid_testAgentProtocolConnection_time", "squid_trigger_count", "squid_trigger_time", "squid_upsertApiKey_count", "squid_upsertApiKey_time", "squid_upsertSecret_count", "squid_upsertSecret_time", "squid_vectorChunks_count", "squid_vectorChunks_time", "squid_webhook_count", "squid_webhook_time", "squid_acquireLock_count", "squid_acquireLock_time", "squid_releaseLock_count", "squid_releaseLock_time"]; | ||
| export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number]; | ||
| /** Common prefix for all Squid metrics. */ | ||
| export declare const SQUID_METRIC_NAME_PREFIX = "squid_"; |
| import { ApiOptions } from '../public-types/api-client.public-types'; | ||
| import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types'; | ||
| import { IntegrationId } from '../public-types/communication.public-types'; | ||
| /** The headers of an API call. */ | ||
| export type ApiHeaders = Record<string, string | number | boolean>; | ||
| /** The context of an API call. */ | ||
| export declare class ApiCallContext { | ||
| readonly integrationId: IntegrationId; | ||
| readonly endpointId: ApiEndpointId; | ||
| readonly url: string; | ||
| readonly method: HttpMethod; | ||
| readonly body: unknown; | ||
| readonly options: ApiOptions; | ||
| } | ||
| /** | ||
| * Represents a request to call an API through a specified integration and endpoint. | ||
| * Includes optional method override and additional request options. | ||
| */ | ||
| export interface CallApiRequest<BodyType = any> { | ||
| /** The identifier of the integration through which the API is called. */ | ||
| integrationId: IntegrationId; | ||
| /** Target API endpoint to invoke. */ | ||
| endpointId: ApiEndpointId; | ||
| /** Optional request payload. */ | ||
| body?: BodyType; | ||
| /** Optional HTTP method override. Default is POST. */ | ||
| overrideMethod?: HttpMethod; | ||
| /** Additional request options. */ | ||
| options: ApiOptions; | ||
| } |
| import { SquidDocIdObj, SquidDocument } from '../public-types/document.public-types'; | ||
| import { Paths } from '../public-types/typescript.public-types'; | ||
| /** | ||
| * The mutation type. | ||
| * @category Database | ||
| */ | ||
| export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"]; | ||
| /** | ||
| * @category Database | ||
| */ | ||
| export type MutationType = (typeof MUTATION_TYPES)[number]; | ||
| interface BaseMutation { | ||
| type: MutationType; | ||
| squidDocIdObj: SquidDocIdObj; | ||
| } | ||
| /** | ||
| * A mutation on a document. | ||
| * @category Database | ||
| */ | ||
| export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation; | ||
| /** | ||
| * Represents a delete mutation on a document. | ||
| * @category Database | ||
| */ | ||
| export interface DeleteMutation extends BaseMutation { | ||
| /** Specifies that the mutation is a deletion. */ | ||
| type: 'delete'; | ||
| } | ||
| /** | ||
| * Represents an update mutation on a document. | ||
| * @category Database | ||
| */ | ||
| export interface UpdateMutation<T = any> extends BaseMutation { | ||
| /** Specifies that the mutation is an update. */ | ||
| type: 'update'; | ||
| /** The updated properties */ | ||
| properties: { | ||
| [key in keyof T & string]?: Array<PropertyMutation<T[key]>>; | ||
| }; | ||
| } | ||
| /** | ||
| * Represents an insert mutation on a document. | ||
| * @category Database | ||
| */ | ||
| export interface InsertMutation<T = any> extends BaseMutation { | ||
| /** Specifies that the mutation is an insertion. */ | ||
| type: 'insert'; | ||
| /** The inserted document */ | ||
| properties: T; | ||
| } | ||
| /** | ||
| * A representation of a single property update. | ||
| * @category Database | ||
| */ | ||
| export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation; | ||
| /** | ||
| * A value update property mutation. | ||
| * @category Database | ||
| */ | ||
| export interface ValueUpdatePropertyMutation<Value = any> { | ||
| /** Specifies that the mutation updates a value. */ | ||
| type: 'update'; | ||
| /** New value to be set. */ | ||
| value: Value; | ||
| } | ||
| /** | ||
| * Applying a numeric function to a property. | ||
| * @category Database | ||
| */ | ||
| export interface ApplyNumericFnPropertyMutation { | ||
| /** Specifies that the mutation applies a numeric function. */ | ||
| type: 'applyNumericFn'; | ||
| /** Numeric function to apply. */ | ||
| fn: 'increment'; | ||
| /** Value to use in the numeric function. */ | ||
| value: number; | ||
| } | ||
| /** | ||
| * A property update that removes a property from a document. | ||
| * @category Database | ||
| */ | ||
| export interface RemovePropertyMutation { | ||
| /** Specifies that the mutation removes a property. */ | ||
| type: 'removeProperty'; | ||
| } | ||
| interface ApplyExtendString { | ||
| /** Specifies that the mutation applies a string function. */ | ||
| type: 'applyStringFn'; | ||
| /** String function to extend the existing string. */ | ||
| fn: 'extendString'; | ||
| /** String value to append. */ | ||
| value: string; | ||
| } | ||
| interface ApplyTrimString { | ||
| /** Specifies that the mutation applies a string function. */ | ||
| type: 'applyStringFn'; | ||
| /** String function to trim the existing string. */ | ||
| fn: 'trim'; | ||
| } | ||
| /** | ||
| * A property mutation that modifies a string. | ||
| * @category Database | ||
| */ | ||
| export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString; | ||
| /** | ||
| * The before and after documents of a document change. | ||
| * @category Database | ||
| */ | ||
| export interface BeforeAndAfterDocs<T = SquidDocument> { | ||
| /** Document state before the mutation. */ | ||
| before: T | undefined; | ||
| /** Document state after the mutation. */ | ||
| after: T | undefined; | ||
| } | ||
| /** | ||
| * The mutation context that will be provided to the security function. | ||
| * @category Database | ||
| */ | ||
| export declare class MutationContext<T = any> { | ||
| readonly mutation: Mutation<T>; | ||
| readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>; | ||
| readonly serverTimeStamp: Date; | ||
| /** | ||
| * Returns the state of the document before the mutation was applied. | ||
| */ | ||
| get before(): T | undefined; | ||
| /** | ||
| * Returns the state of the document after the mutation was applied. | ||
| */ | ||
| get after(): T | undefined; | ||
| /** | ||
| * Returns the type of the mutation (insert, update, or delete). | ||
| */ | ||
| getMutationType(): MutationType; | ||
| /** Returns true if the mutation affects the provided path. */ | ||
| affectsPath(path: Paths<T>): boolean; | ||
| /** | ||
| * Find all affected paths starting from a root path. | ||
| * | ||
| * @example | ||
| * doc before - { a: { b: 1, c: 2 }, d: 3 } | ||
| * doc after - { a: { b: 1, c: 3 }, d: 4 } | ||
| * doc.affectedPaths('a') // ['a.c'] | ||
| */ | ||
| affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>; | ||
| private checkPath; | ||
| } | ||
| export {}; |
| import { IntegrationId } from '../public-types/communication.public-types'; | ||
| /** | ||
| * Represents the type of native query request, either relational, elastic or MongoDB. | ||
| * @category Database | ||
| */ | ||
| export type NativeQueryRequestType = 'relational' | 'mongo' | 'elasticsearch' | 'pure'; | ||
| interface BaseNativeQueryContext { | ||
| /** Type of the native query request. */ | ||
| type: NativeQueryRequestType; | ||
| /** Identifier for the integration. */ | ||
| integrationId: IntegrationId; | ||
| } | ||
| /** | ||
| * Context for executing a relational database query. | ||
| * @category Database | ||
| */ | ||
| export interface RelationalNativeQueryContext extends BaseNativeQueryContext { | ||
| /** Specifies that the query is for a relational database. */ | ||
| type: 'relational'; | ||
| /** SQL query string to be executed. */ | ||
| query: string; | ||
| /** Parameters to be used in the query. */ | ||
| params: Record<string, any>; | ||
| } | ||
| /** | ||
| * Context for executing a MongoDB query. | ||
| * @category Database | ||
| */ | ||
| export interface MongoNativeQueryContext extends BaseNativeQueryContext { | ||
| /** Specifies that the query is for a Mongo database. */ | ||
| type: 'mongo'; | ||
| /** Name of the MongoDB collection to query. */ | ||
| collectionName: string; | ||
| /** Array of aggregation pipeline stages. */ | ||
| aggregationPipeline: Array<any | undefined>; | ||
| } | ||
| /** | ||
| * Context for executing an Elasticsearch query. | ||
| * @category Database | ||
| */ | ||
| export interface ElasticsearchNativeQueryContext { | ||
| /** Specifies that the query is for an Elasticsearch database. */ | ||
| type: 'elasticsearch'; | ||
| /** Elasticsearch index to query. */ | ||
| index: string; | ||
| /** Elasticsearch query string. */ | ||
| endpoint?: string; | ||
| /** HTTP method to use for the request. */ | ||
| method?: 'GET' | 'POST'; | ||
| /** Body of the request. */ | ||
| body: Record<string, any>; | ||
| /** Headers to include in the request. */ | ||
| integrationId: IntegrationId; | ||
| } | ||
| /** | ||
| * Context for executing a pure database query. | ||
| * @category Database | ||
| */ | ||
| export interface PureNativeQueryContext extends BaseNativeQueryContext { | ||
| /** Specifies that the query is for a relational database. */ | ||
| type: 'pure'; | ||
| /** SQL query string to be executed. */ | ||
| query: string; | ||
| /** Parameters to be used in the query. */ | ||
| params: Record<string, any>; | ||
| } | ||
| /** | ||
| * Union type representing either a relational or MongoDB native query context. | ||
| * @category Database | ||
| */ | ||
| export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext | ElasticsearchNativeQueryContext | PureNativeQueryContext; | ||
| export {}; |
| import { AiQueryOptions } from '../public-types/ai-query.public-types'; | ||
| import { IntegrationId } from '../public-types/communication.public-types'; | ||
| import { CollectionName, DocumentData, FieldName } from '../public-types/document.public-types'; | ||
| import { FieldSort, Operator, Query, SimpleCondition } from '../public-types/query.public-types'; | ||
| import { DeepRecord, FieldOf, PartialBy, Paths } from '../public-types/typescript.public-types'; | ||
| /** | ||
| * The information provided to the secureAiQuery function about the AI query being executed. | ||
| * @category AI | ||
| */ | ||
| export interface AiQueryContext { | ||
| /** The prompt provided for the AI query. */ | ||
| prompt: string; | ||
| /** The options used for executing the AI query. */ | ||
| options: AiQueryOptions; | ||
| } | ||
| /** | ||
| * Represents the Squid query context. | ||
| * Passed to methods that require query details, such as those annotated with the `@secureCollection` annotation. | ||
| * @category Database | ||
| */ | ||
| export declare class QueryContext<T extends DocumentData = any> { | ||
| readonly query: Query<T>; | ||
| /** | ||
| * The ID of the integration being queried. | ||
| */ | ||
| get integrationId(): IntegrationId; | ||
| /** | ||
| * The name of the collection being queried. | ||
| */ | ||
| get collectionName(): CollectionName; | ||
| /** | ||
| * The query limit if one exists, -1 otherwise. | ||
| */ | ||
| get limit(): number; | ||
| /** | ||
| * The fields to project (include) in query results, or undefined if all fields should be returned. | ||
| */ | ||
| get projectFields(): Array<FieldName> | undefined; | ||
| /** | ||
| * Verifies that the query's sort order aligns with the provided field sorts. The fields specified in the `sorts` | ||
| * parameter must appear in the exact order at the beginning of the query's sort sequence. The query can include | ||
| * additional fields in its sort order, but only after the specified sorts. | ||
| * | ||
| * @param sorts An array of field sorts. | ||
| * @returns Whether the query's sorts matches the provided field sorts. | ||
| */ | ||
| sortedBy(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean; | ||
| /** | ||
| * Verifies that the query's sort order exactly matches the provided field sorts. The fields specified in the | ||
| * `sorts` parameter must appear in the exact order in the query's sort sequence. No additional sorts may be present | ||
| * in the query. | ||
| * | ||
| * @param sorts An array of field sorts. | ||
| * @returns Whether the query's sorts exactly match the provided field sorts. | ||
| */ | ||
| sortedByExact(sorts: Array<PartialBy<FieldSort<T>, 'asc'>>): boolean; | ||
| /** | ||
| * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates | ||
| * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include | ||
| * additional conditions, as these only narrow the result set. | ||
| * | ||
| * @param fieldName The name of the field for the condition. | ||
| * @param operator The operator of the condition. | ||
| * @param value The value of the condition. | ||
| * @returns Whether the query is a subquery of the parent condition. | ||
| */ | ||
| isSubqueryOf<F extends Paths<T>, O extends AllOperators>(fieldName: F, operator: O, value: GenericValue<T, F, O> | null): boolean; | ||
| /** | ||
| * Verifies that the query is a subquery of the specified condition. A subquery is defined as a query that evaluates | ||
| * to a subset of the results that would be obtained by applying the parent condition. The subquery may also include | ||
| * additional conditions, as these only narrow the result set. | ||
| * | ||
| * @param condition The condition to validate. | ||
| * @returns Whether the query is a subquery of the parent condition. | ||
| */ | ||
| isSubqueryOfCondition(condition: GeneralCondition<T>): boolean; | ||
| /** | ||
| * Verifies that the query is a subquery of the specified conditions. A subquery is defined as a query that evaluates | ||
| * to a subset of the results that would be obtained by applying the parent conditions. The subquery may also include | ||
| * additional conditions, as these only narrow the result set. | ||
| * | ||
| * @param conditions The conditions to validate. | ||
| * @returns Whether the query includes subquery of the parent conditions. | ||
| */ | ||
| isSubqueryOfConditions(conditions: GeneralConditions<T>): boolean; | ||
| /** | ||
| * Verifies that the query is a subquery of the specified query. A subquery is defined as a query that evaluates | ||
| * to a subset of the results that obtained for the parent query, including sorts and limits. | ||
| * | ||
| * @param query The query to validate. | ||
| * @returns Whether the query is a subquery of the parent query. | ||
| */ | ||
| isSubqueryOfQuery(query: Query<T>): boolean; | ||
| /** | ||
| * Checks if this query's projectFields are a subset of the parent query's projectFields. | ||
| * A query can only be a child of another if the parent provides all fields the child needs. | ||
| * | ||
| * @param childFields - The projectFields of this query (the potential child) | ||
| * @param parentFields - The projectFields of the candidate parent query | ||
| * @returns Whether the child's fields are available from the parent | ||
| */ | ||
| private isProjectFieldsSubset; | ||
| /** | ||
| * Returns all conditions that apply to any of the specified field names. This method | ||
| * provides a convenient way to retrieve all conditions that involve a specific set of fields. | ||
| * | ||
| * @param fieldNames The field names for which to retrieve conditions. | ||
| * @returns An array of conditions that involve any of the specified field names. | ||
| */ | ||
| getConditionsFor<K extends Paths<T>>(...fieldNames: Array<K>): ContextConditions<T, K>; | ||
| /** | ||
| * Returns all conditions that apply to the specified field name. This method provides | ||
| * a convenient way to retrieve all conditions that involve a specific field. | ||
| * | ||
| * @param fieldName The field name for which to retrieve conditions. | ||
| * @returns An array of conditions that involve the specified field name. | ||
| */ | ||
| getConditionsForField<K extends Paths<T>>(fieldName: K): ContextConditions<T>; | ||
| /** | ||
| * Returns true if the given document can be a result of the query. | ||
| * The method does not account for limit and sort order. | ||
| */ | ||
| documentMatchesQuery(doc: DocumentData): boolean; | ||
| } | ||
| /** | ||
| * A list of context conditions. | ||
| * @category Database | ||
| */ | ||
| export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>; | ||
| /** | ||
| * A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'. | ||
| * @category Database | ||
| */ | ||
| export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>; | ||
| /** | ||
| * A condition using the 'in' operator to match values within a set. | ||
| * @category Database | ||
| */ | ||
| export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> { | ||
| /** Specifies the 'in' operator to check if a value exists within an array. */ | ||
| operator: 'in'; | ||
| /** An array of values to match against the field. */ | ||
| value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>; | ||
| } | ||
| /** | ||
| * A condition using the 'not in' operator to exclude values within a set. | ||
| * @category Database | ||
| */ | ||
| export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> { | ||
| /** Specifies the 'not in' operator to check if a value does not exist within an array. */ | ||
| operator: 'not in'; | ||
| /** An array of values to exclude from the field. */ | ||
| value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>; | ||
| } | ||
| /** | ||
| * A condition using operators other than 'in' or 'not in' for field comparisons. | ||
| * @category Database | ||
| */ | ||
| export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> { | ||
| /** The operator to use for the comparison, excluding 'in' and 'not in'. */ | ||
| operator: Exclude<ContextOperator, 'in' | 'not in'>; | ||
| /** The value to compare against the field. */ | ||
| value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any; | ||
| } | ||
| /** | ||
| * A condition that includes all operators, including 'in' and 'not in', for general use. | ||
| * @category Database | ||
| */ | ||
| export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> { | ||
| /** The operator to apply to the condition, including all possible operators. */ | ||
| operator: AllOperators; | ||
| /** The value to use in the condition comparison. */ | ||
| value: any; | ||
| } | ||
| /** | ||
| * A list of general conditions. | ||
| * @category Database | ||
| */ | ||
| export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>; | ||
| /** | ||
| * @category Database | ||
| */ | ||
| export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in'; | ||
| type AllOperators = Operator | 'in' | 'not in'; | ||
| /** | ||
| * A generic value that can exist in a query. | ||
| * @category Database | ||
| */ | ||
| export type GenericValue<Doc = any, F extends Paths<Doc> = Paths<Doc>, O extends AllOperators = any> = O extends 'in' ? Array<DeepRecord<Doc>[F]> | null : O extends 'not in' ? Array<DeepRecord<Doc>[F]> | null : DeepRecord<Doc>[F] | null; | ||
| export {}; |
| import { AgentContextRequest, AiAgent, AiAgentContext, AiAnnotation, AiAudioCreateSpeechOptions, AiChatMessage, AiChatOptions, AiGenerateImageOptions, AllAiAgentChatOptions, ApplicationAiSettings } from '../public-types/ai-agent.public-types'; | ||
| import { AiProviderType, ModelIdSpec } from '../public-types/ai-common.public-types'; | ||
| import { AiContextMetadata, AiContextMetadataFilter } from '../public-types/ai-knowledge-base.public-types'; | ||
| import { AiAgentId, AiKnowledgeBaseId, AppId, ClientRequestId } from '../public-types/communication.public-types'; | ||
| import { JobId } from '../public-types/job.public-types'; | ||
| import { SecretKey } from '../public-types/secret.public-types'; | ||
| /** Specification for an AI model, defining its operational parameters. */ | ||
| export type AiModelSpec = { | ||
| /** Maximum tokens the model can generate in a single response. */ | ||
| maxOutputTokens: number; | ||
| /** Total context window size: input (aka prompt) + output (aka completion) tokens combined. */ | ||
| contextWindowTokens: number; | ||
| }; | ||
| export interface AiChatRequest { | ||
| agentId: AiAgentId; | ||
| clientRequestId: ClientRequestId; | ||
| prompt?: string; | ||
| options?: AllAiAgentChatOptions; | ||
| jobId: JobId; | ||
| } | ||
| export interface AiAskRequest { | ||
| agentId: AiAgentId; | ||
| prompt?: string; | ||
| options?: AllAiAgentChatOptions; | ||
| jobId: JobId; | ||
| } | ||
| export interface AiGenerateImageRequest { | ||
| prompt: string; | ||
| options: AiGenerateImageOptions; | ||
| } | ||
| export interface AiAskQuestionInternalRequest { | ||
| appId: AppId; | ||
| prompt: string; | ||
| options: AiChatOptions; | ||
| } | ||
| export interface AiAskQuestionInternalResponse { | ||
| answer: string; | ||
| } | ||
| export interface GetSharedAgentsInternalRequest { | ||
| organizationId: string; | ||
| } | ||
| export interface GetSharedAgentsInternalResponse { | ||
| sharedAgents: Array<{ | ||
| agentId: AiAgentId; | ||
| appId: AppId; | ||
| }>; | ||
| } | ||
| export interface ClearSharedAgentsForOrgInternalRequest { | ||
| organizationId: string; | ||
| } | ||
| export interface AiContextSizeRequest { | ||
| appId: AppId; | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface AiContextSizeResponse { | ||
| sizeBytes: number; | ||
| } | ||
| export interface AiAskResponse { | ||
| responseString: string; | ||
| annotations?: Record<string, AiAnnotation>; | ||
| } | ||
| export interface AiAskWithVoiceResponse { | ||
| responseString: string; | ||
| voiceResponse: AiAudioCreateSpeechResponse; | ||
| annotations?: Record<string, AiAnnotation>; | ||
| } | ||
| export interface AiTranscribeAndAskWithVoiceResponse { | ||
| transcribedPrompt: string; | ||
| responseString: string; | ||
| voiceResponse: AiAudioCreateSpeechResponse; | ||
| annotations?: Record<string, AiAnnotation>; | ||
| } | ||
| export interface AiTranscribeAndChatResponse { | ||
| transcribedPrompt: string; | ||
| } | ||
| export interface AiAudioCreateSpeechResponse { | ||
| mimeType: string; | ||
| extension: string; | ||
| base64File: string; | ||
| } | ||
| export interface AiAudioCreateSpeechRequest { | ||
| input: string; | ||
| options: AiAudioCreateSpeechOptions; | ||
| } | ||
| export interface GetAgentRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface GetAgentResponse { | ||
| agent: AiAgent | undefined; | ||
| } | ||
| export interface GetAgentContextRequest { | ||
| agentId: AiAgentId; | ||
| contextId: string; | ||
| } | ||
| export interface ConnectAgentKnowledgeBaseRequest { | ||
| agentId: AiAgentId; | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| description: string; | ||
| } | ||
| export interface DisconnectAgentKnowledgeBaseRequest { | ||
| agentId: AiAgentId; | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| } | ||
| export interface DeleteAgentRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface UnshareAgentRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface SetAgentOptionInPathRequest { | ||
| agentId: AiAgentId; | ||
| path: string; | ||
| value: unknown; | ||
| } | ||
| export interface AddConnectedIntegrationRequest { | ||
| agentId: AiAgentId; | ||
| integrationId: string; | ||
| integrationType: string; | ||
| description: string; | ||
| } | ||
| export interface AddConnectedAgentRequest { | ||
| agentId: AiAgentId; | ||
| connectedAgentId: string; | ||
| description: string; | ||
| } | ||
| export interface AddConnectedKnowledgeBaseRequest { | ||
| agentId: AiAgentId; | ||
| knowledgeBaseId: string; | ||
| description: string; | ||
| } | ||
| export interface AddFunctionRequest { | ||
| agentId: AiAgentId; | ||
| functionId: string; | ||
| } | ||
| export interface RemoveConnectedAgentRequest { | ||
| agentId: AiAgentId; | ||
| connectedAgentId: string; | ||
| } | ||
| export interface RemoveConnectedIntegrationRequest { | ||
| agentId: AiAgentId; | ||
| integrationId: string; | ||
| } | ||
| export interface RemoveConnectedKnowledgeBaseRequest { | ||
| agentId: AiAgentId; | ||
| knowledgeBaseId: string; | ||
| } | ||
| export interface RemoveFunctionRequest { | ||
| agentId: AiAgentId; | ||
| functionId: string; | ||
| } | ||
| export interface SetAgentDescriptionRequest { | ||
| agentId: AiAgentId; | ||
| description: string; | ||
| } | ||
| export interface ListAgentContextsRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface ListAgentContextsResponse { | ||
| contexts: Array<AiAgentContext>; | ||
| } | ||
| export interface DeleteAgentContextsRequest { | ||
| agentId: AiAgentId; | ||
| contextIds: Array<string>; | ||
| } | ||
| export interface UpsertAgentContextsRequest { | ||
| agentId: AiAgentId; | ||
| contextRequests: Array<AgentContextRequest>; | ||
| } | ||
| export interface UpsertAgentCustomGuardrailsRequest { | ||
| agentId: AiAgentId; | ||
| customGuardrail: string; | ||
| } | ||
| export interface DeleteAgentCustomGuardrailsRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface ListAgentsResponse { | ||
| agents: Array<AiAgent>; | ||
| } | ||
| export interface GetApplicationAiSettingsResponse { | ||
| settings: ApplicationAiSettings; | ||
| } | ||
| export interface GetApplicationAiSettingsResponse { | ||
| settings: ApplicationAiSettings; | ||
| } | ||
| export interface SetApplicationAiSettingsRequest { | ||
| settings: ApplicationAiSettings; | ||
| } | ||
| export interface SetAiProviderApiKeySecretRequest { | ||
| providerType: AiProviderType; | ||
| secretKey: SecretKey | undefined; | ||
| } | ||
| export interface SetAiProviderApiKeySecretResponse { | ||
| settings: ApplicationAiSettings; | ||
| } | ||
| export interface ListChatModelsResponse { | ||
| models: ModelIdSpec[]; | ||
| } | ||
| export interface RegenerateAgentApiKeyRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export interface GetAgentApiKeyRequest { | ||
| agentId: AiAgentId; | ||
| } | ||
| export declare function validateAiContextMetadata(metadata: AiContextMetadata): void; | ||
| export declare function validateAiContextMetadataFilter(filter: AiContextMetadataFilter): void; | ||
| export declare const METADATA_SERVICE_FUNCTION_NAME = "default:metadata"; | ||
| export interface GetChatHistoryRequest { | ||
| agentId: AiAgentId; | ||
| memoryId: string; | ||
| } | ||
| export interface GetChatHistoryResponse { | ||
| messages: Array<AiChatMessage>; | ||
| } | ||
| export interface ProvideAgentFeedbackRequest { | ||
| agentId: string; | ||
| feedback: string; | ||
| } | ||
| export interface BuildAgentRequest { | ||
| agentId: string; | ||
| request: string; | ||
| memoryId?: string; | ||
| } | ||
| export interface UploadAiFileRequest { | ||
| /** AI provider to upload file to. */ | ||
| provider: AiProviderType; | ||
| /** Optional expiration time in seconds. If provided, file will be registered for automatic cleanup. */ | ||
| expirationInSeconds?: number; | ||
| } | ||
| export interface UploadAiFileResponse { | ||
| fileId: string; | ||
| } | ||
| export interface DeleteAiFileRequest { | ||
| fileId: string; | ||
| /** AI provider that owns the file. */ | ||
| provider: AiProviderType; | ||
| } | ||
| export interface DeleteAiFileResponse { | ||
| deleted: boolean; | ||
| } |
| import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseSearchResultChunk } from '../public-types/ai-knowledge-base.public-types'; | ||
| import { AiContextId, AiKnowledgeBaseId, AppId } from '../public-types/communication.public-types'; | ||
| /** | ||
| * Request structure for getting an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface GetAiKnowledgeBaseRequest { | ||
| /** The id of the app */ | ||
| appId: AppId; | ||
| /** The id of the AiKnowledgeBase */ | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| } | ||
| /** | ||
| * Request structure for getting all AiKnowledgeBases | ||
| * @category AI | ||
| */ | ||
| export interface GetAiKnowledgeBasesRequest { | ||
| /** The id of the app */ | ||
| appId: AppId; | ||
| } | ||
| /** | ||
| * Response structure for getting an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface GetAiKnowledgeBaseResponse { | ||
| /** The resulting AiKnowledgeBase, if it is found */ | ||
| knowledgeBase: AiKnowledgeBase | undefined; | ||
| } | ||
| /** | ||
| * Request structure for deleting an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface DeleteAiKnowledgeBaseRequest { | ||
| /** The id of the AiKnowledgeBase */ | ||
| id: string; | ||
| } | ||
| /** | ||
| * Request structure for upserting an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface UpsertAiKnowledgeBaseRequest { | ||
| /** The AiKnowledgeBase to upsert */ | ||
| knowledgeBase: Omit<AiEmbeddingsModelWithOptionalFields, 'appId' | 'updatedAt'>; | ||
| } | ||
| /** | ||
| * Response structure for listing AiKnowledgeBases | ||
| * @category AI | ||
| */ | ||
| export interface ListAiKnowledgeBasesResponse { | ||
| /** The list of AiKnowledgeBases */ | ||
| knowledgeBases: Array<AiKnowledgeBase>; | ||
| } | ||
| /** | ||
| * Request structure for listing AiKnowledgeBaseContexts | ||
| * @category AI | ||
| */ | ||
| export interface ListAiKnowledgeBaseContextsRequest { | ||
| /** The id of the AiKnowledgeBase */ | ||
| id: string; | ||
| /** The number of characters after which text is truncated. Optional */ | ||
| truncateTextAfter?: number; | ||
| } | ||
| /** | ||
| * Response structure to list AiKnowledgeBaseContexts | ||
| * @category AI | ||
| */ | ||
| export interface ListAiKnowledgeBaseContextsResponse { | ||
| /** The list of AiKnowledgeBaseContexts */ | ||
| contexts: Array<AiKnowledgeBaseContext>; | ||
| } | ||
| /** | ||
| * Response structure to list contextids for an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface ListAiKnowledgeBaseContextIdsResponse { | ||
| /** The list of AiContextIds */ | ||
| contextIds: Array<AiContextId>; | ||
| } | ||
| /** | ||
| * Request structure for deleting AiKnowledgeBaseContexts | ||
| * @category AI | ||
| */ | ||
| export interface DeleteAiKnowledgeBaseContextsRequest { | ||
| /** The id of the AiKnowledgeBase */ | ||
| knowledgeBaseId: string; | ||
| /** An array of AiKnowledgeBaseContext ids */ | ||
| contextIds: Array<string>; | ||
| } | ||
| /** | ||
| * Request structure for getting an AiKnowledgeBaseContext | ||
| * @category AI | ||
| */ | ||
| export interface GetAiKnowledgeBaseContextRequest { | ||
| /** The id of the AiKnowledgeBase */ | ||
| knowledgeBaseId: string; | ||
| /** The id of the AiKnowledgeBaseContext */ | ||
| contextId: string; | ||
| } | ||
| /** | ||
| * Request structure for getting all AiKnowledgeBaseContexts | ||
| * for a given knowledge base | ||
| * @category AI | ||
| */ | ||
| export interface GetAiKnowledgeBaseContextsRequest { | ||
| /** The id of the app */ | ||
| appId: AppId; | ||
| /** The id of the AiKnowledgeBase */ | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| /** The number of characters after which text is truncated. Optional */ | ||
| truncateTextAfter?: number; | ||
| } | ||
| /** | ||
| * Response structure for getting an AiKnowledgeBaseContext | ||
| * @category AI | ||
| */ | ||
| export interface GetAiKnowledgeBaseContextResponse { | ||
| /** The resulting AiKnowledgeBaseContext, if it is found */ | ||
| context: AiKnowledgeBaseContext | undefined; | ||
| } | ||
| /** | ||
| * Request structure for upserting context for an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface UpsertAiKnowledgeBaseContextsRequest { | ||
| /** The id of the AiKnowledgeBase */ | ||
| knowledgeBaseId: string; | ||
| /** The AiKnowledgeBaseContext data, which could be a file or text */ | ||
| contextRequests: Array<AiKnowledgeBaseContextRequest>; | ||
| /** The job ID to use for the async upsert job */ | ||
| jobId: string; | ||
| } | ||
| /** | ||
| * Response structure for searching an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface AiKnowledgeBaseSearchResponse { | ||
| /** Array of result chunks from the search */ | ||
| chunks: Array<AiKnowledgeBaseSearchResultChunk>; | ||
| } | ||
| /** | ||
| * Request structure for getting the size of context | ||
| * for an AiKnowledgeBase | ||
| * @category AI | ||
| */ | ||
| export interface AiKnowledgeBaseContextSizeRequest { | ||
| /** The ID of the App */ | ||
| appId: AppId; | ||
| /** The ID of the AIKnowledgeBase */ | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| } | ||
| /** | ||
| * Request structure for identifying a knowledge base to reimport the context files (when possible). | ||
| */ | ||
| export interface AiKnowledgeBaseReimportAllFilesRequest { | ||
| /** The ID of the AIKnowledgeBase */ | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| } | ||
| /** | ||
| * Request structure for identifying a knowledge base to reimport the context files (when possible). | ||
| */ | ||
| export interface AiKnowledgeBaseReimportFilesRequest { | ||
| /** The ID of the AIKnowledgeBase */ | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| /** The ids of the AiKnowledgeBaseContexts to reimport */ | ||
| contextIds: Array<string>; | ||
| } | ||
| /** | ||
| * Response structure for getting size of context | ||
| * @category AI | ||
| */ | ||
| export interface AiKnowledgeBaseContextSizeResponse { | ||
| /** Size of context bytes, as a number */ | ||
| sizeBytes: number; | ||
| } | ||
| /** | ||
| * Request structure for getting the values vector of | ||
| * a specific context | ||
| * | ||
| * @category AI | ||
| */ | ||
| export interface AiKnowledgeBaseValueVectorRequest { | ||
| /** The ID of the App */ | ||
| appId: AppId; | ||
| /** The ID of the AIKnowledgeBase */ | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| /** The ID of the context */ | ||
| contextId: AiContextId; | ||
| } | ||
| /** | ||
| * Response structure for getting values vector of a | ||
| * specific context | ||
| * @category AI | ||
| */ | ||
| export interface AiKnowledgeBaseValueVectorResponse { | ||
| /** The vector */ | ||
| vector: number[]; | ||
| } | ||
| export interface AiKnowledgeBaseChatRequest { | ||
| knowledgeBaseId: AiKnowledgeBaseId; | ||
| prompt?: string; | ||
| options?: AiKnowledgeBaseChatOptions; | ||
| } |
| import { MmEntity, MmEntityMatch, MmFindMatchesOptions, MmListEntitiesOptions, MmMatchMaker } from '../public-types/ai-matchmaking.public-types'; | ||
| export interface MmCreateMatchMakerRequest { | ||
| matchMaker: MmMatchMaker; | ||
| } | ||
| export interface MmDeleteMatchMakerRequest { | ||
| matchMakerId: string; | ||
| } | ||
| export interface MmGetMatchMakerRequest { | ||
| matchMakerId: string; | ||
| } | ||
| export interface MmGetMatchMakerResponse { | ||
| matchMaker: MmMatchMaker | undefined; | ||
| } | ||
| export interface MmDeleteEntityRequest { | ||
| matchMakerId: string; | ||
| entityId: string; | ||
| } | ||
| export interface MmInsertEntityRequest { | ||
| matchMakerId: string; | ||
| entity: MmEntity; | ||
| } | ||
| export interface MmInsertEntitiesRequest { | ||
| matchMakerId: string; | ||
| entities: Array<MmEntity>; | ||
| } | ||
| export interface MmFindMatchesRequest { | ||
| matchMakerId: string; | ||
| entityId: string; | ||
| options: MmFindMatchesOptions; | ||
| } | ||
| export interface MmFindMatchesResponse { | ||
| matches: Array<MmEntityMatch>; | ||
| } | ||
| export interface MmFindMatchesForEntityRequest { | ||
| matchMakerId: string; | ||
| entity: Omit<MmEntity, 'metadata' | 'id'>; | ||
| options: MmFindMatchesOptions; | ||
| } | ||
| export interface MmFindMatchesForEntityResponse { | ||
| matches: Array<MmEntityMatch>; | ||
| } | ||
| export interface MmListMatchMakersResponse { | ||
| matchMakers: Array<MmMatchMaker>; | ||
| } | ||
| export interface MmListEntitiesRequest { | ||
| matchMakerId: string; | ||
| categoryId: string; | ||
| options: MmListEntitiesOptions; | ||
| } | ||
| export interface MmListEntitiesResponse { | ||
| entities: Array<MmEntity>; | ||
| } | ||
| export interface MmGetEntityRequest { | ||
| matchMakerId: string; | ||
| entityId: string; | ||
| } | ||
| export interface MmGetEntityResponse { | ||
| entity: MmEntity | undefined; | ||
| } |
| export type ChatId = string; |
| export interface Base64File { | ||
| filename: string; | ||
| mimetype: string; | ||
| base64: string; | ||
| __isSquidBase64File__: true; | ||
| } |
| /** HTTP header names used by Squid for request metadata. */ | ||
| export declare const SquidHeaders: { | ||
| /** Correlates logs and spans across distributed calls. */ | ||
| readonly TRACE_ID: "x-squid-traceid"; | ||
| /** Shared secret header for internal authentication. */ | ||
| readonly SECRET: "x-squid-secret"; | ||
| /** API key provided by the calling application. */ | ||
| readonly APP_API_KEY: "x-app-api-key"; | ||
| /** Unique identifier of the client application. */ | ||
| readonly APP_ID: "x-squid-appid"; | ||
| /** Unique identifier of the end user or service client. */ | ||
| readonly CLIENT_ID: "x-squid-clientid"; | ||
| /** Version string of the Squid client library. */ | ||
| readonly CLIENT_VERSION: "x-squid-client-version"; | ||
| /** Originating IP address of the request. */ | ||
| readonly SOURCE_IP: "x-squid-source-ip"; | ||
| }; |
| /** | ||
| * Status lifecycle for management API keys. | ||
| * Keys must be suspended before they can be deleted. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export type ManagementApiKeyStatus = 'active' | 'suspended' | 'deleted'; | ||
| /** | ||
| * Prefix for all management API keys. | ||
| * Used to identify and validate management keys. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export declare const MANAGEMENT_API_KEY_PREFIX = "squid_mgmt_"; | ||
| /** | ||
| * Represents a user-level management API key. | ||
| * These keys provide programmatic access to manage organizations and applications | ||
| * where the user is an admin. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface ManagementApiKey { | ||
| /** Unique identifier for the API key */ | ||
| id: string; | ||
| /** The user ID who owns this key */ | ||
| userId: string; | ||
| /** Optional description for the key */ | ||
| description?: string; | ||
| /** Current status of the key */ | ||
| status: ManagementApiKeyStatus; | ||
| /** Timestamp when the key was created */ | ||
| createdAt: Date; | ||
| /** Timestamp when the key was last updated */ | ||
| updatedAt: Date; | ||
| /** Timestamp when the key was last used, if ever */ | ||
| lastUsedAt?: Date; | ||
| } | ||
| /** | ||
| * Request to create a new management API key. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface CreateManagementApiKeyRequest { | ||
| /** Optional description for the key */ | ||
| description?: string; | ||
| } | ||
| /** | ||
| * Response when creating a new management API key. | ||
| * The keyValue is only returned once during creation. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface CreateManagementApiKeyResponse { | ||
| /** The created key metadata */ | ||
| key: ManagementApiKey; | ||
| /** The raw key value (only returned once during creation) */ | ||
| keyValue: string; | ||
| } | ||
| /** | ||
| * Request to update a management API key's status. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface UpdateManagementApiKeyRequest { | ||
| /** The ID of the key to update */ | ||
| keyId: string; | ||
| /** New status (can only toggle between active and suspended) */ | ||
| status: 'active' | 'suspended'; | ||
| } | ||
| /** | ||
| * Request to delete a management API key. | ||
| * The key must be suspended before deletion. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface DeleteManagementApiKeyRequest { | ||
| /** The ID of the key to delete */ | ||
| keyId: string; | ||
| } | ||
| /** | ||
| * Response containing a list of user's management API keys. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface ListManagementApiKeysResponse { | ||
| /** List of management API keys (without key values) */ | ||
| keys: ManagementApiKey[]; | ||
| } | ||
| /** | ||
| * Response from validating a management API key. | ||
| * @category ManagementApiKey | ||
| */ | ||
| export interface ValidateManagementApiKeyResponse { | ||
| /** Whether the key is valid and active */ | ||
| valid: boolean; | ||
| /** The user ID associated with the key (if valid) */ | ||
| userId?: string; | ||
| /** The key ID (if valid) */ | ||
| keyId?: string; | ||
| } |
| import { ClientId } from '../public-types/communication.public-types'; | ||
| export interface PublishNotificationRequest { | ||
| clientIds: Array<ClientId>; | ||
| payload: unknown; | ||
| } |
| import { MetricName } from '../metric-name'; | ||
| import { AppId } from '../public-types/communication.public-types'; | ||
| export interface ObservableNameMetrics { | ||
| count: MetricName; | ||
| time: MetricName; | ||
| } | ||
| export declare const ObservableNames: { | ||
| readonly functionExecution: ObservableNameMetrics; | ||
| readonly codeInitialization: ObservableNameMetrics; | ||
| readonly getAiChatbotProfiles: ObservableNameMetrics; | ||
| readonly aiImageGeneration: ObservableNameMetrics; | ||
| readonly aiRemoveBackground: ObservableNameMetrics; | ||
| readonly aiAudioTranscribe: ObservableNameMetrics; | ||
| readonly aiAudioCreateSpeech: ObservableNameMetrics; | ||
| readonly discoverGraphQLConnectionSchema: ObservableNameMetrics; | ||
| readonly discoverOpenApiSchema: ObservableNameMetrics; | ||
| readonly discoverOpenApiSchemaFromFile: ObservableNameMetrics; | ||
| readonly graphqlQuery: ObservableNameMetrics; | ||
| readonly testGraphQLConnection: ObservableNameMetrics; | ||
| readonly testAgentProtocolConnection: ObservableNameMetrics; | ||
| readonly graphql: ObservableNameMetrics; | ||
| readonly acquireLock: ObservableNameMetrics; | ||
| readonly releaseLock: ObservableNameMetrics; | ||
| /** | ||
| * Timing and count for '/observability/metrics' endpoint calls used to report batch of metrics. | ||
| */ | ||
| readonly metricReport: ObservableNameMetrics; | ||
| /** | ||
| * Timing and count for '/observability/metrics/query' endpoint calls used to query metrics. | ||
| */ | ||
| readonly metricQuery: ObservableNameMetrics; | ||
| }; | ||
| export type ObservableName = keyof typeof ObservableNames; | ||
| export interface MetricEvent { | ||
| appId: AppId; | ||
| name: MetricName; | ||
| tags: Record<string, string>; | ||
| timestamp: Date; | ||
| value: number; | ||
| isExposedToUser: boolean; | ||
| } | ||
| export interface LogEvent { | ||
| message: string; | ||
| level: string; | ||
| tags: Record<string, string>; | ||
| timestamp: Date; | ||
| isExposedToUser: boolean; | ||
| host: string; | ||
| source?: string; | ||
| service?: string; | ||
| } | ||
| export declare const AUDIT_LOG_EVENT_NAMES: readonly ["ai_agent"]; | ||
| export type AuditLogEventName = (typeof AUDIT_LOG_EVENT_NAMES)[number]; | ||
| export interface AuditLogEvent { | ||
| appId: AppId; | ||
| name: AuditLogEventName; | ||
| timestamp: Date; | ||
| context: { | ||
| clientId?: string; | ||
| userId: string; | ||
| }; | ||
| tags: Record<string, string>; | ||
| } | ||
| /** Agent audit log entry - one per agent invocation */ | ||
| export interface AgentAuditLogEvent { | ||
| appId: AppId; | ||
| /** Agent ID (nullable for query-with-AI operations without an agent) */ | ||
| agentId?: string; | ||
| jobId: string; | ||
| prompt: string; | ||
| tags: Record<string, string>; | ||
| createdAt: Date; | ||
| /** Integration ID for query-with-AI operations (nullable, used when not invoked via agent) */ | ||
| integrationId?: string; | ||
| } | ||
| export type AgentAuditLogUpdateType = 'statusUpdate' | 'response'; | ||
| /** Usage metric for AI model input/output — either token count or character count depending on provider. */ | ||
| export interface AiUsageMetric { | ||
| unit: 'tokens' | 'characters'; | ||
| value: number; | ||
| } | ||
| /** Agent audit log update entry - status updates and responses for agent invocations */ | ||
| export interface AgentAuditLogUpdateEvent { | ||
| appId: AppId; | ||
| /** Agent ID (nullable for query-with-AI operations without an agent) */ | ||
| agentId?: string; | ||
| jobId: string; | ||
| statusUpdateId: string; | ||
| title: string; | ||
| parentStatusUpdateId?: string; | ||
| tags: Record<string, string>; | ||
| body: string; | ||
| type: AgentAuditLogUpdateType; | ||
| createdAt: Date; | ||
| /** Integration ID for query-with-AI operations (nullable, used when not invoked via agent) */ | ||
| integrationId?: string; | ||
| /** Input usage metric (tokens or characters depending on provider). */ | ||
| inputUsage?: AiUsageMetric; | ||
| /** Output usage metric (tokens or characters depending on provider). */ | ||
| outputUsage?: AiUsageMetric; | ||
| } | ||
| /** Tag for metric events. Value: '0' - not an error, '1' - is an error. */ | ||
| export declare const O11Y_TAG_IS_ERROR = "isError"; | ||
| /** Tag for log events. Metrics have an explicit appId field. */ | ||
| export declare const O11Y_TAG_APP_ID = "appId"; | ||
| /** Tag for metric and log events. */ | ||
| export declare const O11Y_TAG_INTEGRATION_ID = "integrationId"; | ||
| /** Tag for AI events. */ | ||
| export declare const O11Y_TAG_AI_MODEL = "aiModel"; | ||
| export declare const O11Y_TAG_AI_PROFILE = "aiProfile"; | ||
| /** Tag for AI KnowledgeBase events */ | ||
| export declare const O11Y_TAG_AI_KNOWLEDGE_BASE_MODEL = "aiKnowledgeBaseModel"; | ||
| export declare const O11Y_TAG_API_KEY_SOURCE = "apiKeySource"; | ||
| /** Tag for metric and log events. Value: '0' - not a tenant originated, '1' - is a tenant originated. */ | ||
| export declare const O11Y_TAG_IS_TENANT_ORIGINATED = "isTenantOriginated"; | ||
| /** Contains a full (with a service name) function name for backend functions. */ | ||
| export declare const O11Y_TAG_FUNCTION_NAME = "functionName"; | ||
| /** Contains a type of the function name for backend functions (See ExecuteFunctionAnnotationType.). */ | ||
| export declare const O11Y_TAG_FUNCTION_TYPE = "functionType"; | ||
| /** Tag for the trace ID. Used in logs. */ | ||
| export declare const O11Y_TAG_TRACE_ID = "trace_id"; | ||
| /** Tag for the span ID. Used in logs. */ | ||
| export declare const O11Y_TAG_SPAN_ID = "span_id"; | ||
| export declare function getBooleanMetricTagValue(value: boolean): string; | ||
| export declare const COUNT_METRIC_SUFFIXES: string[]; | ||
| export declare const GAUGE_METRIC_SUFFIXES: string[]; |
| import { Condition, SimpleCondition } from '../public-types/query.public-types'; | ||
| /** | ||
| * Generates the regex pattern, handling special characters as follows: | ||
| * - `_` is replaced with a `.` | ||
| * - `%` is replaced with `[\s\S]*`. | ||
| * - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`. | ||
| * - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \ | ||
| * | ||
| * Exported for testing purposes. | ||
| * */ | ||
| export declare function replaceSpecialCharacters(input: string): string; | ||
| /** Returns true if the condition is a 'SimpleCondition' or false otherwise. */ | ||
| export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition; |
| import { ApiKeyEntry } from '../public-types/secret.public-types'; | ||
| export declare const BACKEND_API_KEY = "_BACKEND_API_KEY"; | ||
| export declare const APP_API_KEY = "APP_API_KEY"; | ||
| export declare const AGENT_API_HEADER = "x-squid-agent-api-key"; | ||
| export interface AgentSecrets { | ||
| apiKey: ApiKeyEntry | undefined; | ||
| } |
| export declare const SOCKET_RECONNECT_TIMEOUT: number; |
| /** | ||
| * Stage of the Squid deployment: | ||
| * - 'local' - Squid is run locally. | ||
| * - 'prod' - Production environment (https://console.getsquid.ai). | ||
| * - 'sandbox' - One of the sandbox environments (https://console.sandbox.getsquid.ai). | ||
| * - 'staging' - One of the staging environments (https://console.staging.getsquid.ai). | ||
| */ | ||
| export declare const STAGES: readonly ["local", "prod", "sandbox", "staging"]; | ||
| export type Stage = (typeof STAGES)[number]; |
| export {}; |
| import { AppId } from '../public-types/communication.public-types'; | ||
| /** | ||
| * Request to create a shortened URL. | ||
| */ | ||
| export interface ShortUrlRequest { | ||
| /** The URL to shorten. It must be a valid URL and should include the protocol (start with http:// or https://). */ | ||
| url: string; | ||
| /** The application ID that will own this shortened URL. */ | ||
| appId: AppId; | ||
| /** Seconds to live for the shortened URL. If set to 0, the URL will never expire. Defaults to 1 day. */ | ||
| secondsToLive?: number; | ||
| /** Optional file extension to include in the shortened URL ID (e.g., 'pdf', 'html'). The extension becomes part of the ID, so 'abc123.pdf' and 'abc123.jpg' are distinct URLs. */ | ||
| fileExtension?: string; | ||
| } | ||
| /** | ||
| * Request to create shortened URLs. | ||
| */ | ||
| export interface ShortUrlBulkRequest { | ||
| /** The URLs to shorten. They must be valid URLs and should include the protocol (start with http:// or https://). */ | ||
| urls: string[]; | ||
| /** The application ID that will own these shortened URLs. */ | ||
| appId: AppId; | ||
| /** Seconds to live for all shortened URLs. If set to 0, the URLs will never expire. Defaults to 1 day. */ | ||
| secondsToLive?: number; | ||
| /** Optional file extension to include in all shortened URL IDs (e.g., 'pdf', 'html'). The extension becomes part of each ID, so 'abc123.pdf' and 'abc123.jpg' are distinct URLs. */ | ||
| fileExtension?: string; | ||
| } | ||
| /** | ||
| * Request to delete a shortened URL. | ||
| */ | ||
| export interface ShortUrlDeleteRequest { | ||
| /** The ID of the shortened URL to delete. */ | ||
| id: string; | ||
| /** The application ID that owns the shortened URL. */ | ||
| appId: AppId; | ||
| } | ||
| /** | ||
| * Request to delete a shortened URL. | ||
| */ | ||
| export interface ShortUrlBulkDeleteRequest { | ||
| /** The IDs of the shortened URLs to delete. */ | ||
| ids: string[]; | ||
| /** The application ID that owns the shortened URLs. */ | ||
| appId: AppId; | ||
| } |
| export declare function truncateOrPadArray(arr: number[], length: number): number[]; | ||
| /** | ||
| * Computes a single “recommended” chunk size so that if you loop | ||
| * `for (let i = 0; i < length; i += chunkSize)`, | ||
| * no slice will exceed `maxChunkSize` and all chunk sizes are 'almost' equal. | ||
| */ | ||
| export declare function computeRecommendedChunkSize(length: number, maxChunkSize: number): number; |
| /** Returns true if the application is run by a Playwright test. */ | ||
| export declare function isPlaywrightTestMode(): boolean | undefined; |
| /** Gets file extension from filename. */ | ||
| export declare function getFileExtension(filename: string): string | undefined; |
| export {}; |
| import { AppId } from '../public-types/communication.public-types'; | ||
| import { Stage } from '../types/stage'; | ||
| export declare const KOTLIN_CONTROLLERS: string[]; | ||
| export declare function getEnvironmentPrefix(shard: string | undefined, region: string, cloudId: string, stage: Stage): string; | ||
| export declare function getApplicationUrl(environmentPrefix: string, appId: string, path: string, appIdPlaceholder?: AppId, environmentPrefixPlaceholder?: string, forceKotlin?: boolean): string; |
| type LockMutex = string; | ||
| /** | ||
| * A simple lock manager that locks a list of mutexes. | ||
| * When locking a list of mutexes, the lock will start only when all the mutexes are available - preventing partial lock | ||
| * and potential deadlocks. | ||
| */ | ||
| export declare class LockManager { | ||
| private readonly locks; | ||
| lock(...mutexes: LockMutex[]): Promise<void>; | ||
| release(...mutexes: LockMutex[]): void; | ||
| canGetLock(...mutexes: LockMutex[]): boolean; | ||
| lockSync(...mutexes: LockMutex[]): void; | ||
| } | ||
| export {}; |
| import { QueryMetricsRequestCommon, QueryMetricsResultGroup } from '../public-types/metric.public-types'; | ||
| export type QueryMetricsRequestIntervals = Required<Pick<QueryMetricsRequestCommon, 'fillValue' | 'fn' | 'groupByTags' | 'periodEndSeconds' | 'periodStartSeconds' | 'pointIntervalAlignment' | 'pointIntervalSeconds' | 'tagDomains' | 'noDataBehavior'>>; | ||
| /** Adds missed known tag domain groups and fills all missed points with a request.fillValue. */ | ||
| export declare function fillMissedPoints(request: QueryMetricsRequestIntervals, resultGroups: Array<QueryMetricsResultGroup>): void; |
| /** | ||
| * Type suffixes defines the type of the metric and can be used for | ||
| * metric value validation for incoming metrics. | ||
| */ | ||
| export declare const SQUID_METRIC_TYPE_SUFFIXES: readonly ["_count", "_time", "_size", "_entries", "_value"]; | ||
| /** Returns true if the given metric has a valid metric type. */ | ||
| export declare function hasValidMetricTypeSuffix(metricName: string): boolean; |
| /** Returns a value by the `path`. Works with array indexes, like a.b[0]. */ | ||
| export declare function getInPath(obj: unknown, path: string): any; | ||
| export declare function isDateObject(value: unknown): value is Date; | ||
| /** Sets a value by path . Does not support array indexes. */ | ||
| export declare function setInPath(obj: object, path: string, value: unknown, delimiter?: string): void; | ||
| export declare function deleteInPath(obj: object, path: string, delimiter?: string): void; | ||
| export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void; | ||
| export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void; | ||
| export declare function isNil(obj: unknown): obj is null | undefined; | ||
| export declare function isEqual(a: unknown, b: unknown): boolean; | ||
| export declare function isEmpty(a: unknown): boolean; | ||
| export declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...fieldsToRemove: K): Pick<T, Exclude<keyof T, K[number]>>; | ||
| export type CloneCustomizer = (value: unknown) => unknown | undefined; | ||
| /** | ||
| * Creates a deep copy of the specified object, including all nested objects and specifically handling Date, Map, and | ||
| * Set fields. | ||
| * | ||
| * The customizer function can modify the cloning process for the object and its fields. If the customizer | ||
| * returns 'undefined' for any input, the function falls back to the standard cloning logic. | ||
| * | ||
| * The cloning process is recursive, ensuring deep cloning of all objects. | ||
| * | ||
| * Note: This function does not support cloning objects with circular dependencies and will throw a system stack | ||
| * overflow error if encountered. | ||
| */ | ||
| export declare function cloneDeep<R = unknown>(value: R, customizer?: CloneCustomizer): R; | ||
| /** Creates a shallow clone of the object. */ | ||
| export declare function cloneShallow<T>(value: T): T; | ||
| export declare function deepMerge<T extends object, U extends object>(target: T, source: U): T & U; | ||
| /** Returns true if the `value` is a defined object and is not an array. */ | ||
| export declare function isPlainObject(value: unknown): value is object; | ||
| /** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */ | ||
| export declare function compareValues(v1: unknown, v2: unknown): number; | ||
| /** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */ | ||
| export declare function mapValues<ResultType extends object = Record<string, unknown>, InputType extends Record<string, unknown> = Record<string, unknown>>(obj: InputType, valueMapperFn: (value: any, key: keyof InputType, obj: InputType) => unknown): ResultType; | ||
| /** Groups elements of the array by key. See _.groupBy for details. */ | ||
| export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (item: T) => K): Record<K, T[]>; | ||
| /** | ||
| * Picks selected fields from the object and returns a new object with the fields selected. | ||
| * The selected fields are assigned by reference (there is no cloning). | ||
| */ | ||
| export declare function pick<T extends object, K extends keyof T>(obj: T, keys: ReadonlyArray<K>): Pick<T, K>; | ||
| /** Inverts the record: swaps keys and values. */ | ||
| export declare function invert<K extends string | number, V extends string | number>(record: Record<K, V>): Record<V, K>; | ||
| /** | ||
| * Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end. | ||
| * If end is less than start a zero-length range is created unless a negative step is specified. | ||
| * | ||
| * Same as lodash range but with an additional parameter: `maximumNumberOfItems`. | ||
| */ | ||
| export declare function range(start: number, end: number, step: number, maximumNumberOfItems?: number): number[]; | ||
| /** Returns count of top level properties in object. */ | ||
| export declare function countObjectKeys(obj: object | undefined | null): number; | ||
| /** Returns object entries sorted by name. */ | ||
| export declare function getSortedEntries<T>(record: Record<string, T>): Array<[string, T]>; | ||
| /** Removes top level fields which are empty objects. May be used for value formatting. */ | ||
| export declare function removeEmptyTopLevelRecords<T extends object>(record: T): Partial<T>; | ||
| export declare function removeUndefinedValues<V>(tags: Record<string, V | undefined>): Record<string, V>; | ||
| export declare function extractKey(line: string | undefined): string | null; | ||
| /** Represents a line in a diff output */ | ||
| export interface DiffLine { | ||
| lineNumber: number; | ||
| text: string; | ||
| type: 'unchanged' | 'added' | 'removed' | 'changed'; | ||
| } | ||
| /** Result of computing a line-by-line diff between two objects */ | ||
| export interface DiffResult { | ||
| leftLines: Array<DiffLine>; | ||
| rightLines: Array<DiffLine>; | ||
| hasChanges: boolean; | ||
| } | ||
| /** | ||
| * Computes a line-by-line diff between two objects. | ||
| * Objects are serialized to JSON with sorted keys for consistent comparison. | ||
| * @param before The previous/left object (can be undefined for new objects) | ||
| * @param after The current/right object | ||
| * @returns DiffResult with left and right lines and whether there are changes | ||
| */ | ||
| export declare function computeObjectDiff(before: unknown, after: unknown): DiffResult; | ||
| /** | ||
| * Formats an object as diff lines (all unchanged). | ||
| * Useful for displaying a single object without comparison. | ||
| * @param obj The object to format | ||
| * @returns Array of DiffLine with all lines marked as unchanged | ||
| */ | ||
| export declare function formatObjectAsLines(obj: unknown): Array<DiffLine>; |
| export declare function sortKeys(json: unknown): any; | ||
| export declare function normalizeJsonAsString(json: unknown): string; | ||
| export declare function serializeObj(obj: unknown): string; | ||
| export declare function deserializeObj<T = any>(str: string): T; | ||
| export declare function encodeValueForMapping(value: unknown): string; | ||
| export declare function decodeValueForMapping(encodedString: string): any; | ||
| /** | ||
| * Compares 2 objects by their normalized JSON value. | ||
| * This function should not be used with objects with circular references. | ||
| * Returns true if the object are equal. | ||
| */ | ||
| export declare function compareByNormalizedJsonValue<T>(v1: T | undefined, v2: T | undefined): boolean; | ||
| /** | ||
| * Compares 2 objects by their normalized JSON value for specific fields only. | ||
| * This function should not be used with objects with circular references. | ||
| * Returns true if the specified fields are equal. | ||
| */ | ||
| export declare function compareByNormalizedJsonValueForFields<T>(v1: T | undefined, v2: T | undefined, fields: Array<keyof T>): boolean; |
| export declare const SQUID_SUPPORT_EMAIL = "support@getsquid.ai"; | ||
| /** | ||
| * Error code when application is not found. | ||
| * Must be in sync with Kotlin. | ||
| */ | ||
| export declare const APPLICATION_NOT_FOUND_ERROR = "APPLICATION_NOT_FOUND"; |
| export declare function generateTraceId(prefix?: string): string; |
| import { HttpStatusCode } from '../public-types/http-status.public-types'; | ||
| export declare class ValidationError extends Error { | ||
| readonly statusCode: HttpStatusCode; | ||
| readonly details?: any; | ||
| constructor(error: string, statusCode: HttpStatusCode, details?: Record<string, unknown>); | ||
| } | ||
| export declare function isValidId(id: unknown, maxLength?: number): boolean; | ||
| export declare function validateFieldSort(fieldSort: unknown): void; | ||
| export declare function validateQueryLimit(limit: unknown): void; | ||
| /** | ||
| * All type names returned by 'typeof' supported by JavaScript: | ||
| * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}. | ||
| * and a few other supported types. | ||
| */ | ||
| export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function'; | ||
| /** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */ | ||
| export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean; | ||
| /** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */ | ||
| export declare function hasOnlyKeys(obj: object, keys: string[]): boolean; |
| interface Options { | ||
| maxAttempts?: number; | ||
| protocols?: string[]; | ||
| onmessage?: (event: any) => void; | ||
| onopen?: (event: any) => void; | ||
| onclose?: (event: any) => void; | ||
| onerror?: (event: any) => void; | ||
| onreconnect?: (event: any) => void; | ||
| onmaximum?: (event: any) => void; | ||
| timeoutMillis?: number; | ||
| } | ||
| export interface WebSocketWrapper { | ||
| open: () => void; | ||
| reconnect: (e: any) => void; | ||
| json: (x: any) => void; | ||
| send: (x: string) => void; | ||
| close: (x?: number, y?: string) => void; | ||
| connected: boolean; | ||
| /** | ||
| * Websocket is explicitly closed by calling socket.close(). | ||
| * Used to ignore errors after socket.closed() is called. | ||
| */ | ||
| closeCalled: boolean; | ||
| } | ||
| export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper; | ||
| export {}; |
@@ -5,2 +5,2 @@ /** | ||
| */ | ||
| export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.456"; | ||
| export declare const SQUIDCLOUD_CLIENT_PACKAGE_VERSION = "1.0.457"; |
+1
-1
| { | ||
| "name": "@squidcloud/client", | ||
| "version": "1.0.456", | ||
| "version": "1.0.457", | ||
| "description": "A typescript implementation of the Squid client", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
731965
9.59%137
37%9003
19.75%24
4.35%