@squidcloud/client 1.0.483 → 1.0.484

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.js +1 -1
  3. package/dist/internal-common/src/ai/system-openai-compatible.d.ts +35 -0
  4. package/dist/internal-common/src/metric-name.d.ts +14 -0
  5. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +25 -1
  6. package/dist/internal-common/src/public-types/ai-function.public-types.d.ts +36 -0
  7. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +141 -2
  8. package/dist/internal-common/src/public-types/connector.public-types.d.ts +1 -1
  9. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +9 -2
  10. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  11. package/dist/internal-common/src/public-types/source-code.public-types.d.ts +191 -0
  12. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
  13. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
  14. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
  15. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
  16. package/dist/internal-common/src/types/ai-agent.types.d.ts +249 -0
  17. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +306 -0
  18. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -0
  19. package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
  20. package/dist/internal-common/src/types/communication.types.d.ts +1 -0
  21. package/dist/internal-common/src/types/document.types.d.ts +1 -0
  22. package/dist/internal-common/src/types/file.types.d.ts +6 -0
  23. package/dist/internal-common/src/types/headers.types.d.ts +41 -0
  24. package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
  25. package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
  26. package/dist/internal-common/src/types/notification.types.d.ts +5 -0
  27. package/dist/internal-common/src/types/observability.types.d.ts +168 -0
  28. package/dist/internal-common/src/types/query.types.d.ts +15 -0
  29. package/dist/internal-common/src/types/secret.types.d.ts +7 -0
  30. package/dist/internal-common/src/types/socket.types.d.ts +1 -0
  31. package/dist/internal-common/src/types/stage.d.ts +9 -0
  32. package/dist/internal-common/src/types/time-units.d.ts +1 -0
  33. package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
  34. package/dist/internal-common/src/utils/array.d.ts +7 -0
  35. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
  36. package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
  37. package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
  38. package/dist/internal-common/src/utils/http.d.ts +10 -0
  39. package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
  40. package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
  41. package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
  42. package/dist/internal-common/src/utils/object.d.ts +86 -0
  43. package/dist/internal-common/src/utils/serialization.d.ts +24 -0
  44. package/dist/internal-common/src/utils/squid.constants.d.ts +6 -0
  45. package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
  46. package/dist/internal-common/src/utils/validation.d.ts +19 -0
  47. package/dist/internal-common/src/websocket.impl.d.ts +26 -0
  48. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +9 -1
  49. package/dist/typescript-client/src/distributed-lock.manager.d.ts +3 -2
  50. package/dist/typescript-client/src/integration-client.d.ts +5 -1
  51. package/dist/typescript-client/src/public-types.d.ts +1 -0
  52. package/dist/typescript-client/src/version.d.ts +1 -1
  53. package/package.json +1 -1
@@ -0,0 +1,35 @@
1
+ /**
2
+ * System-level OpenAI-compatible backends ("slots") for Squid's own internal AI calls.
3
+ *
4
+ * Generic plumbing for pointing an internal model at ANY OpenAI-compatible HTTP endpoint —
5
+ * primarily Squid's own self-hosted models, but any OpenAI-compatible backend works. The
6
+ * non-secret part of a slot (base URL, optional headers/extra body) is hardcoded here on purpose
7
+ * (changing a backend is a reviewed code change); only the API key lives in Vault under
8
+ * `SystemSecrets['openai-compatible'][slotName].apiKey`.
9
+ *
10
+ * NOT the customer-facing `openai_compatible` Integration (per-app, console-configured). Models
11
+ * served through these slots are declared in `AI_CHAT_MODEL_REGISTRY` with
12
+ * `providerType: 'openai-compatible'` + `openAiCompatibleSlot`, and resolve only with
13
+ * `keyType: 'system'` (see `AiProviderFactory.getChatProviderForModel`) — never customer-reachable.
14
+ *
15
+ * No slots are defined yet (foundation only). To wire one up:
16
+ * 1. add a slot below, e.g. `'my-model': { baseUrl: 'https://llm.internal.squid/v1' }`;
17
+ * 2. seed its key in `SystemSecrets['openai-compatible']['my-model'].apiKey`;
18
+ * 3. add a model entry in ai-model.registry.ts pointing `openAiCompatibleSlot: 'my-model'`.
19
+ */
20
+ /** Non-secret configuration of one system OpenAI-compatible backend. */
21
+ export interface SystemOpenAiCompatibleSlotConfig {
22
+ /** Base URL of the OpenAI-compatible API, e.g. a self-hosted 'https://llm.internal.squid/v1'. */
23
+ baseUrl: string;
24
+ /** Extra HTTP headers sent with every request. */
25
+ headers?: Record<string, string>;
26
+ /** Extra JSON body fields merged into every request — reserved wire fields are dropped by the provider. */
27
+ extraBody?: Record<string, unknown>;
28
+ }
29
+ /** Name of a system OpenAI-compatible slot (a key of `SYSTEM_OPENAI_COMPATIBLE_SLOTS`). */
30
+ export type SystemOpenAiCompatibleSlotName = string;
31
+ /**
32
+ * Registered system OpenAI-compatible slots, keyed by name. Empty by design — add a self-hosted
33
+ * (or any other) OpenAI-compatible backend here; see the module doc above.
34
+ */
35
+ export declare const SYSTEM_OPENAI_COMPATIBLE_SLOTS: Record<SystemOpenAiCompatibleSlotName, SystemOpenAiCompatibleSlotConfig>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Names of the Squid metrics.
3
+ *
4
+ * This list and its Kotlin counterpart (MetricName.kt) may diverge:
5
+ * each side declares only the metrics that its own backend emits.
6
+ * However, metrics emitted by both backends MUST use identical names on both sides —
7
+ * otherwise dashboards and metric queries that mix data from both sources will break.
8
+ *
9
+ * See MetricName.kt for documentation on each value.
10
+ */
11
+ export declare const ALL_SQUID_METRIC_NAMES: readonly ["squid_functionExecution_count", "squid_functionExecution_time", "squid_aiChatbotContext_size", "squid_aiChatbotChatInputTokens_count", "squid_aiChatbotChatOutputTokens_count", "squid_aiChatbotChatReasoningTokens_count", "squid_aiChatbotChatCacheReadInputTokens_count", "squid_aiChatbotChatCacheWriteInputTokens_count", "squid_aiChatbotChatCostUsd_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_sourceCodeAnalysis_count", "squid_sourceCodeAnalysis_time", "squid_sourceCodeLeaseWait_time", "squid_sourceCodeWorkspaceBytes_value", "squid_sourceCodeInputTokens_count", "squid_sourceCodeOutputTokens_count", "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_apiControllerCall_count", "squid_apiControllerCall_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_queueMessageHandler_count", "squid_queueMessageHandler_time", "squid_registerQuery_count", "squid_registerQuery_time", "squid_rerankChunks_count", "squid_rerankChunks_time", "squid_schedulerJob_count", "squid_schedulerJob_time", "squid_eventHandler_count", "squid_eventHandler_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"];
12
+ export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
13
+ /** Common prefix for all Squid metrics. */
14
+ export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
@@ -677,6 +677,8 @@ export interface AiAgent<T extends AiChatModelSelection | undefined = undefined>
677
677
  isPublic?: boolean;
678
678
  /** Enables audit logging for the agent's activities if true; defaults to false. */
679
679
  auditLog?: boolean;
680
+ /** Records the full agent context in the audit log — assembled system instructions on the chat-start entry and retrieved knowledge-base content in KB tool-call updates; requires auditLog; defaults to false. */
681
+ auditLogFullContext?: boolean;
680
682
  /** The default chat options for the agent, overridable by the user during use. */
681
683
  options: AiChatOptions<T>;
682
684
  /** Optional api key used specifically for operations on this agent */
@@ -722,6 +724,13 @@ export declare const AGENT_STATUS_TITLE_INSPECTING_KB_METADATA = "Inspecting Kno
722
724
  * @category AI
723
725
  */
724
726
  export declare const AGENT_STATUS_TITLE_QUERYING_KB_GRAPH = "Querying Knowledge Base Graph";
727
+ /**
728
+ * Status update title emitted when the agent runs the `grepKnowledgeBase` tool (a literal/regex scan over
729
+ * the knowledge base's raw extracted text). Distinct from {@link AGENT_STATUS_TITLE_ACCESSING_KB} so a
730
+ * caller can tell an exact-match scan apart from ranked retrieval.
731
+ * @category AI
732
+ */
733
+ export declare const AGENT_STATUS_TITLE_GREPPING_KB = "Searching Knowledge Base Text";
725
734
  /**
726
735
  * Status update title broadcast when the agent queries a spreadsheet file callable.
727
736
  * @category AI
@@ -945,7 +954,13 @@ export interface TextContextRequest extends BaseContextRequest {
945
954
  export interface FileContextRequest extends BaseContextRequest {
946
955
  /** Specifies the context type as 'file'. */
947
956
  type: 'file';
948
- /** Whether to extract images from the file; defaults to false. */
957
+ /**
958
+ * Whether to extract images from the file, describe them with a vision model, and index those
959
+ * descriptions alongside the text. Defaults to true — a document's charts, diagrams and scanned pages
960
+ * carry content the text layer does not. Note that the text context request has no such option:
961
+ * inline images in a text payload are extracted only for a knowledge-base text context, and default
962
+ * to OFF there.
963
+ */
949
964
  extractImages?: boolean;
950
965
  /** The minimum size for extracted images, if applicable. */
951
966
  imageMinSizePixels?: number;
@@ -1062,6 +1077,15 @@ export type AiSessionContext = {
1062
1077
  agentId: string;
1063
1078
  /** The ID of the job associated with the session. */
1064
1079
  jobId: JobId;
1080
+ /**
1081
+ * The conversation this call belongs to, as the caller named it (`memoryOptions.memoryId`, or the
1082
+ * deprecated `chatId`). Stable across the turns of one chat and different for two chats, including
1083
+ * two chats of the same client, which `clientId` is not: a client id belongs to a connection, and
1084
+ * one connection can carry several conversations. Not the id chat history is keyed by — that one
1085
+ * falls back to `clientId` — so do not read it as one. Absent for callers that named no conversation
1086
+ * (a direct function call, security rules).
1087
+ */
1088
+ conversationId?: string;
1065
1089
  /**
1066
1090
  * ID of the status update that triggered this session (e.g. the agent's "Calling AI Function"
1067
1091
  * event). Status updates emitted on behalf of this session nest under it in the status feed.
@@ -3,6 +3,14 @@ import { ServiceFunctionName } from './backend.public-types';
3
3
  import { IntegrationType } from './integration.public-types';
4
4
  /** Represents the possible data types for an AI function parameter. */
5
5
  export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date' | 'files';
6
+ /**
7
+ * How sticky affinity routing must be for a function that keeps state outside the request.
8
+ * - `pod`: the state is reachable by any worker of the pod (a file on disk, a child process).
9
+ * - `worker`: the state lives in one worker's memory, so the worker itself has to be reused.
10
+ */
11
+ export declare const FUNCTION_AFFINITY_SCOPES: readonly ["pod", "worker"];
12
+ /** See {@link FUNCTION_AFFINITY_SCOPES}. */
13
+ export type FunctionAffinityScope = (typeof FUNCTION_AFFINITY_SCOPES)[number];
6
14
  /** Defines the structure of a parameter for an AI function. */
7
15
  export interface AiFunctionParam {
8
16
  /** Name of the parameter. */
@@ -15,6 +23,34 @@ export interface AiFunctionParam {
15
23
  required: boolean;
16
24
  /** List of possible values for the parameter, if applicable. */
17
25
  enum?: Array<Omit<AiFunctionParamType, 'date'>>;
26
+ /**
27
+ * Marks this parameter as the affinity key of the function and states how sticky the routing must
28
+ * be: every call carrying the same value is routed to the same tenant pod (and, for `worker`, the
29
+ * same worker) for as long as it is alive. Use it for functions that keep state outside the
30
+ * request. Only one `string` parameter of a function may declare it, and declaring it on a
31
+ * parameter of any other type fails the bundle build.
32
+ *
33
+ * A value of `undefined`, `null` or `''` means no affinity at all — the call is routed normally, to
34
+ * an arbitrary pod. Blank is deliberately not a key: a caller that leaves the parameter empty must
35
+ * get an instance of its own rather than share one with every other caller that also left it empty.
36
+ *
37
+ * The value is a namespace within the application, the function's SERVICE **and the calling job**
38
+ * (falling back to the conversation for callers without one): two agent requests that pick the same
39
+ * value are routed independently, so the value only has to be unique within one request's own
40
+ * calls. That matches where such values come from — a model authoring a session name is told
41
+ * nothing about other requests, and unrelated callers routinely land on the same word. A caller
42
+ * with neither a job nor a conversation gets no affinity at all rather than a namespace shared with
43
+ * every other such caller. Two callers cannot be routed to one instance on purpose by agreeing on a
44
+ * value; a function that needs genuinely shared state needs shared storage, not shared routing.
45
+ *
46
+ * The domain is the service rather than the single function so that companion functions of one
47
+ * service reach each other's state — a release function must land on the worker whose interpreter
48
+ * its key names, or it would no-op against an empty domain of its own and report success.
49
+ *
50
+ * The guarantee is routing, not durability: when the pod or worker goes away, so does whatever it
51
+ * held, and the next call lands on a fresh one. The function has to detect that itself and cope.
52
+ */
53
+ affinity?: FunctionAffinityScope;
18
54
  }
19
55
  /** Represents an AI function response that also includes files. */
20
56
  export interface AiFunctionResponseWithFiles<ResponseType = unknown> {
@@ -494,7 +494,10 @@ export interface AiKnowledgeBaseTextContextRequest extends BaseAiKnowledgeBaseCo
494
494
  */
495
495
  format?: AiKnowledgeBaseTextFormat;
496
496
  /**
497
- * Whether to extract images embedded in markdown/HTML text. Defaults to false.
497
+ * Whether to extract images embedded in markdown/HTML text. Defaults to FALSE — deliberately the
498
+ * opposite of {@link AiKnowledgeBaseFileContextRequest.extractImages}. A pasted blob's inline images
499
+ * are usually layout chrome, whereas an uploaded document's images are part of its content. Uploading
500
+ * the same markdown as a `.md` file is therefore the file case, and defaults to images ON.
498
501
  *
499
502
  * When true and the text is detected as (or declared to be) markdown/HTML, image references inside the
500
503
  * text (`![alt](url)` or `<img src="...">`) are fetched, stored, and have descriptions generated
@@ -524,7 +527,15 @@ export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseCo
524
527
  contextId?: AiContextId;
525
528
  /** Specifies the context type as 'file'. */
526
529
  type: 'file';
527
- /** Whether to extract images from the file; defaults to false. */
530
+ /**
531
+ * Whether to extract images from the file, describe them with a vision model, and index those
532
+ * descriptions alongside the text. Defaults to TRUE — a document's charts, diagrams and scanned pages
533
+ * carry content the text layer does not, so a file context captures them unless asked not to.
534
+ *
535
+ * Note this is the opposite of {@link AiKnowledgeBaseTextContextRequest.extractImages}, which defaults
536
+ * to false: images referenced from a pasted markdown/HTML blob are usually layout chrome, and fetching
537
+ * them means following URLs the caller supplied.
538
+ */
528
539
  extractImages?: boolean;
529
540
  /** The minimum size for extracted images, if applicable. */
530
541
  imageMinSizePixels?: number;
@@ -677,6 +688,134 @@ export interface AiKnowledgeBaseSearchRequest {
677
688
  /** The search options for this search */
678
689
  options: AiKnowledgeBaseSearchOptions;
679
690
  }
691
+ /** Default number of grep matches returned when the caller does not ask for a specific number. */
692
+ export declare const GREP_KNOWLEDGE_BASE_DEFAULT_MAX_MATCHES = 50;
693
+ /** Hard ceiling on grep matches: a larger `maxMatches` is clamped down to this value. */
694
+ export declare const GREP_KNOWLEDGE_BASE_MAX_MATCHES = 200;
695
+ /**
696
+ * Longest accepted grep pattern. A literal needle is short by nature; the cap exists so an
697
+ * adversarially long pattern cannot be used to inflate matching cost on a shared server.
698
+ */
699
+ export declare const GREP_KNOWLEDGE_BASE_MAX_PATTERN_CHARS = 500;
700
+ /** Longest `line` / `context` a single match returns; anything longer is clipped with an ellipsis. */
701
+ export declare const GREP_KNOWLEDGE_BASE_MAX_MATCH_LINE_CHARS = 500;
702
+ /**
703
+ * Options for a literal scan over a knowledge base's raw extracted text.
704
+ * @category AI
705
+ */
706
+ export interface GrepKnowledgeBaseOptions {
707
+ /**
708
+ * Scopes the scan to the contexts whose metadata matches this filter — the same grammar knowledge-base
709
+ * chunk search accepts, including `$and`/`$or` composition and the `$underPath` folder operator. The
710
+ * filter selects the contexts BEFORE any text is matched.
711
+ */
712
+ metadataFilter?: AiContextMetadataFilter;
713
+ /**
714
+ * The maximum number of matches to return. Defaults to {@link GREP_KNOWLEDGE_BASE_DEFAULT_MAX_MATCHES}
715
+ * and is clamped to {@link GREP_KNOWLEDGE_BASE_MAX_MATCHES}.
716
+ */
717
+ maxMatches?: number;
718
+ }
719
+ /**
720
+ * Request structure for a literal scan over a knowledge base's raw extracted text.
721
+ * @category AI
722
+ */
723
+ export interface GrepKnowledgeBaseRequest {
724
+ /** The id of the AiKnowledgeBase */
725
+ knowledgeBaseId: AiKnowledgeBaseId;
726
+ /**
727
+ * The literal substring to look for. Every regex metacharacter in it is escaped, so punctuation and
728
+ * symbols mean themselves, and it may span lines. Capped at
729
+ * {@link GREP_KNOWLEDGE_BASE_MAX_PATTERN_CHARS} characters.
730
+ *
731
+ * Matching is case-insensitive for ASCII letters only: `acme` finds `ACME`, but `café` does not find
732
+ * `CAFÉ`. The store and the server run two different regex engines, and their `i` flags disagree on
733
+ * non-ASCII folding — matching ASCII-only is what keeps them in step, so a hit is never reported as an
734
+ * absence. Search the exact casing for non-ASCII text.
735
+ */
736
+ pattern: string;
737
+ /** Scan options. */
738
+ options?: GrepKnowledgeBaseOptions;
739
+ }
740
+ /**
741
+ * One matching line found by {@link GrepKnowledgeBaseRequest}.
742
+ * @category AI
743
+ */
744
+ export interface AiKnowledgeBaseGrepMatch {
745
+ /** The id of the context the match was found in. */
746
+ contextId: AiContextId;
747
+ /** The source file name (or context title for text contexts). */
748
+ fileName: string;
749
+ /** The locator within the file: a sheet/section title when the extractor supplied one, else `page N`. */
750
+ part: string;
751
+ /** The 1-based line number the match starts on within its part. */
752
+ lineNumber: number;
753
+ /** The matching line, clipped to {@link GREP_KNOWLEDGE_BASE_MAX_MATCH_LINE_CHARS} with an ellipsis. */
754
+ line: string;
755
+ /**
756
+ * The matching line plus a small window of the lines around it, joined by newlines and clipped to
757
+ * {@link GREP_KNOWLEDGE_BASE_MAX_MATCH_LINE_CHARS}. Wide spreadsheet rows are the normal case here, so
758
+ * the clip is what keeps a full result set from overflowing an agent's context window.
759
+ */
760
+ context: string;
761
+ }
762
+ /**
763
+ * Why a grep result does not cover everything the caller asked for. Absent means the scan was complete
764
+ * over the requested scope, and only then may an empty `matches` be read as the pattern being absent.
765
+ * At most one applies; the server picks the most significant.
766
+ *
767
+ * - `timedOut` — the scan hit its server-side deadline. Routine on large knowledge bases, since the
768
+ * match is unindexed. Says nothing at all about whether the pattern occurs.
769
+ * - `noIndexedText` — nothing in scope has stored text, so nothing was searched. Contexts ingested
770
+ * before literal search existed sit here until they are re-ingested.
771
+ * - `filterMatchedNoContexts` — `metadataFilter`, composed with any visibility filter the application
772
+ * applies, admitted no contexts, so the scan had nothing to read.
773
+ * - `scopeTruncated` — `metadataFilter` admitted more contexts than one scan can cover, so only a prefix
774
+ * of them was searched. Narrow the filter.
775
+ * - `partsCapReached` — the scan filled its per-call budget of matching pages/sheets, so more matching
776
+ * places exist than it read.
777
+ * - `partialCoverage` — some contexts in scope have stored text and some do not; see
778
+ * {@link GrepKnowledgeBaseResponse.unscannedContextCount}.
779
+ * - `truncatedContent` — some in-scope text was cut at ingest, either because one page or sheet exceeded
780
+ * the per-part storage cap or because a document had more pages than the per-document cap, so that
781
+ * content was never searchable.
782
+ * - `coverageUnknown` — the scan itself succeeded, but how much of the scope holds stored text could not
783
+ * be determined, so completeness cannot be asserted either way.
784
+ * @category AI
785
+ */
786
+ export type GrepScanLimitation = 'timedOut' | 'noIndexedText' | 'filterMatchedNoContexts' | 'scopeTruncated' | 'partsCapReached' | 'partialCoverage' | 'truncatedContent' | 'coverageUnknown';
787
+ /**
788
+ * Response structure for a literal scan over a knowledge base's raw extracted text.
789
+ * @category AI
790
+ */
791
+ export interface GrepKnowledgeBaseResponse {
792
+ /** The matches found, in context/part/line order. */
793
+ matches: Array<AiKnowledgeBaseGrepMatch>;
794
+ /**
795
+ * True when the returned list stopped at `maxMatches` — more matches exist than were returned. This
796
+ * means ONLY that: every other way a scan can fall short of the request lives in {@link limitation},
797
+ * so a caller branching on this one field never mistakes an incomplete scan for "there are more hits".
798
+ */
799
+ truncated: boolean;
800
+ /**
801
+ * Why the scan did not cover the full requested scope, if it did not. Absent means it did — which is
802
+ * the only case where an empty `matches` is evidence that the pattern does not occur. The whole point
803
+ * of this API is to make absence claims trustworthy, so callers must branch on this before concluding
804
+ * anything from an empty result.
805
+ */
806
+ limitation?: GrepScanLimitation;
807
+ /**
808
+ * With `limitation: 'partialCoverage'`, how many contexts in scope have no stored text and were
809
+ * therefore never scanned. The result is silent about those contexts.
810
+ */
811
+ unscannedContextCount?: number;
812
+ /**
813
+ * With `limitation: 'truncatedContent'`, the file names of documents known to have lost content at
814
+ * ingest. A bounded sample, not a complete list — present it as an example, and do not infer that
815
+ * documents missing from it are intact.
816
+ */
817
+ truncatedContentFileNames?: Array<string>;
818
+ }
680
819
  /**
681
820
  * Request structure for searching AI contexts in the AiKnowledgeBase.
682
821
  * @category AI
@@ -4,7 +4,7 @@
4
4
  * 'CONNECTOR_PACKAGES_TO_EXCLUDE_FROM_AUTO_SYNC' in ConnectorsService (console-backend).
5
5
  * @category Platform
6
6
  */
7
- export declare const CONNECTOR_IDS: readonly ["confluence", "cotomi", "essentials", "freshdesk", "github", "google_calendar", "google_drive", "hubspot", "sharepoint", "jira", "jira_jsm", "linear", "mail", "onedrive", "outlook", "salesforce", "servicenow_csm", "slack", "teams", "ticketmind_companion", "zendesk"];
7
+ export declare const CONNECTOR_IDS: readonly ["bitbucket", "confluence", "cotomi", "essentials", "freshdesk", "github", "google_calendar", "google_drive", "hubspot", "sharepoint", "jira", "jira_jsm", "linear", "mail", "onedrive", "outlook", "salesforce", "servicenow_csm", "slack", "teams", "ticketmind_companion", "zendesk"];
8
8
  /**
9
9
  * Unique connector package name.
10
10
  * @category Platform
@@ -11,11 +11,18 @@ export interface ExtractDataFromDocumentOptions {
11
11
  */
12
12
  imageMinSizePixels?: number;
13
13
  /**
14
- * Whether to extract embedded images from the document.
14
+ * Whether to extract embedded images from the document. Defaults to true.
15
15
  */
16
16
  extractImages?: boolean;
17
17
  /**
18
- * Specific page indexes to extract from the document (0-based). If omitted, all pages are extracted.
18
+ * Specific page indexes to extract from the document (0-based whole numbers). If omitted or empty, all
19
+ * pages are extracted. Duplicates are collapsed, order does not matter, and a selection containing no
20
+ * whole page number at all is rejected.
21
+ *
22
+ * An index past the end of the document is ignored, and a selection naming only such indexes is
23
+ * rejected — but only where the document is read here. Extracting a PDF *by URL* through an OCR
24
+ * provider hands it over without reading it, so its length is unknown and what an out-of-range index
25
+ * does is up to that provider. Upload the file instead to have the whole selection checked.
19
26
  */
20
27
  pageIndexes?: number[];
21
28
  /**
@@ -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", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "built_in_azure_blob", "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", "azure-entra-external-id", "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", "outlook", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint", "vertex"];
3
+ export declare const INTEGRATION_TYPES: readonly ["active_directory", "ai_agents", "ai_chatbot", "algolia", "alloydb", "api", "auth0", "bedrock", "azure_blob", "azure_cosmosdb", "azure_postgresql", "azure_sql", "bigquery", "bitbucket", "built_in_azure_blob", "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", "azure-entra-external-id", "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", "outlook", "oracledb", "pinecone", "postgres", "redis", "s3", "salesforce", "sap_hana", "sentry", "snowflake", "spanner", "xata", "zendesk", "servicenow_csm", "freshdesk", "mail", "slack", "mcp", "a2a", "legend", "teams", "openai_compatible", "openai_compatible_embedding", "sharepoint", "vertex"];
4
4
  /**
5
5
  * @category Database
6
6
  */
@@ -0,0 +1,191 @@
1
+ import type { IntegrationInfo } from './integration.public-types';
2
+ /** Identifies the source-code analysis AI function. */
3
+ export declare const SOURCE_CODE_ANALYZE_FUNCTION_ID = "analyzeCode";
4
+ /** Limits the number of repositories selected for analysis. */
5
+ export declare const SOURCE_CODE_MAX_REPOSITORIES = 20;
6
+ /** Limits each supplemental instruction field supplied to source-code analysis. */
7
+ export declare const SOURCE_CODE_MAX_SUPPLEMENTAL_INSTRUCTIONS_LENGTH = 20000;
8
+ /** Lists CLI providers available for source-code analysis. */
9
+ export declare const SOURCE_CODE_ANALYZER_MODELS: readonly ["claude-code", "codex"];
10
+ /** Identifies a CLI provider available for source-code analysis. */
11
+ export type SourceCodeAnalyzerModel = (typeof SOURCE_CODE_ANALYZER_MODELS)[number];
12
+ /** Lists supported source-control providers. */
13
+ export declare const SOURCE_CONTROL_PROVIDERS: readonly ["github", "bitbucket"];
14
+ /** Identifies a supported source-control provider. */
15
+ export type SourceControlProvider = (typeof SOURCE_CONTROL_PROVIDERS)[number];
16
+ /** Lists integration types that provide source repositories. */
17
+ export declare const SOURCE_CODE_INTEGRATION_TYPES: readonly ["github", "bitbucket"];
18
+ /** Identifies an integration type that provides source repositories. */
19
+ export type SourceCodeIntegrationType = (typeof SOURCE_CODE_INTEGRATION_TYPES)[number];
20
+ /** Configures source-code analysis for an AI agent integration. */
21
+ export interface AiAgentSourceCodeIntegrationOptions {
22
+ /** Enables repository-backed code analysis. */
23
+ codeAnalysisEnabled: boolean;
24
+ /** Selects the CLI provider used for code analysis. */
25
+ analyzerModel?: SourceCodeAnalyzerModel;
26
+ /** Provides supplemental code-analysis instructions. */
27
+ analyzerInstructions?: string;
28
+ }
29
+ /** Stores the immutable GitHub identity and access metadata for a selected repository. */
30
+ export interface GitHubRepositoryConfiguration {
31
+ /** Stores GitHub's numeric repository identifier. */
32
+ id: number;
33
+ /** Stores the owner/repository name. */
34
+ fullName: string;
35
+ /** Stores the credential-free HTTPS clone URL. */
36
+ cloneUrl: string;
37
+ /** Stores the credential-free HTTPS web URL. */
38
+ htmlUrl: string;
39
+ /** Stores the default branch name. */
40
+ defaultBranch: string;
41
+ }
42
+ /** Stores the immutable Bitbucket identity and access metadata for a selected repository. */
43
+ export interface BitbucketRepositoryConfiguration {
44
+ /** Stores Bitbucket's immutable repository UUID. */
45
+ uuid: string;
46
+ /** Stores the workspace/repository name. */
47
+ fullName: string;
48
+ /** Stores the credential-free HTTPS clone URL. */
49
+ cloneUrl: string;
50
+ /** Stores the credential-free HTTPS web URL. */
51
+ webUrl: string;
52
+ /** Stores the default branch name. */
53
+ defaultBranch: string;
54
+ }
55
+ /** Represents the repository-selection portion of a GitHub integration configuration. */
56
+ interface GitHubRepositorySelectionConfiguration {
57
+ /** Stores the legacy owner/repository selection. */
58
+ repository?: string;
59
+ /** Stores canonical selected repository metadata. */
60
+ repositories?: GitHubRepositoryConfiguration[];
61
+ /** Stores the selected default owner/repository name. */
62
+ defaultRepository?: string;
63
+ }
64
+ /** Represents the repository-selection portion of a Bitbucket integration configuration. */
65
+ interface BitbucketRepositorySelectionConfiguration {
66
+ /** Stores the configured Bitbucket workspace slug. */
67
+ workspace: string;
68
+ /** Stores canonical selected repository metadata. */
69
+ repositories: BitbucketRepositoryConfiguration[];
70
+ /** Stores the selected default workspace/repository name. */
71
+ defaultRepository: string;
72
+ }
73
+ /** Describes a source repository that can be prepared for analysis. */
74
+ export interface SourceRepository {
75
+ /** Identifies the source-control provider. */
76
+ provider: SourceControlProvider;
77
+ /** Stores the provider's immutable repository identifier. */
78
+ providerRepositoryId: string;
79
+ /** Stores the owner/repository name. */
80
+ fullName: string;
81
+ /** Stores the credential-free clone URL. */
82
+ cloneUrl: string;
83
+ /** Stores the repository web URL. */
84
+ webUrl: string;
85
+ /** Stores the repository's default branch. */
86
+ defaultBranch: string;
87
+ }
88
+ /** Requests analysis of selected source-code repositories. */
89
+ export interface AnalyzeCodeRequest {
90
+ /** Contains the question to answer. */
91
+ question: string;
92
+ /** Narrows repository selection. */
93
+ repositoryHints?: string;
94
+ /** Narrows analysis to a captured reference. */
95
+ refHint?: string;
96
+ /** Supplies customer context for the answer. */
97
+ customerContext?: string;
98
+ }
99
+ /** Marks an inclusive range of lines in a repository path. */
100
+ export interface SourceCodeLineRange {
101
+ /** Stores the first included line number. */
102
+ start: number;
103
+ /** Stores the last included line number. */
104
+ end: number;
105
+ }
106
+ /** Identifies a path supporting a source-code finding. */
107
+ export interface SourceCodePathEvidence {
108
+ /** Stores the path relative to the repository root. */
109
+ path: string;
110
+ /** Marks the supporting line range when available. */
111
+ lines?: SourceCodeLineRange;
112
+ }
113
+ /** Identifies the captured repository reference behind a finding. */
114
+ export interface SourceCodeRef {
115
+ /** Identifies the reference kind. */
116
+ type: 'branch' | 'tag' | 'commit';
117
+ /** Stores the captured reference name. */
118
+ name: string;
119
+ }
120
+ /** Records repository evidence supporting a source-code answer. */
121
+ export interface SourceCodeRepositoryEvidence {
122
+ /** Stores the owner/repository name. */
123
+ repository: string;
124
+ /** Identifies the inspected captured reference. */
125
+ ref: SourceCodeRef;
126
+ /** Stores the immutable commit SHA. */
127
+ commitSha: string;
128
+ /** Lists paths supporting the finding. */
129
+ paths: SourceCodePathEvidence[];
130
+ /** Stores the snapshot fetch time. */
131
+ fetchedAt: string;
132
+ /** Marks evidence from a stale snapshot. */
133
+ stale: boolean;
134
+ }
135
+ /** Returns a source-code analysis answer and its evidence. */
136
+ export interface AnalyzeCodeResult {
137
+ /** Contains the concise answer. */
138
+ answer: string;
139
+ /** Lists repository evidence supporting the answer. */
140
+ repositories: SourceCodeRepositoryEvidence[];
141
+ /** Stores the latest snapshot fetch time. */
142
+ fetchTimestamp: string;
143
+ /** Marks whether any source snapshot is stale. */
144
+ stale: boolean;
145
+ /** Lists warnings encountered during analysis. */
146
+ warnings: string[];
147
+ /** Warns when a prepared workspace cannot persist. */
148
+ workspacePersistenceWarning?: string;
149
+ }
150
+ /** Requests discovery from an existing or draft source-code integration. */
151
+ export type DiscoverSourceRepositoriesRequest = {
152
+ /** Identifies the source-code integration type. */
153
+ integrationType: SourceCodeIntegrationType;
154
+ /** Identifies the persisted integration. */
155
+ integrationId: string;
156
+ /** Prevents draft and persisted integration inputs from mixing. */
157
+ draftIntegration?: never;
158
+ } | {
159
+ /** Identifies the source-code integration type. */
160
+ integrationType: SourceCodeIntegrationType;
161
+ /** Prevents draft and persisted integration inputs from mixing. */
162
+ integrationId?: never;
163
+ /** Supplies an integration that has not been persisted. */
164
+ draftIntegration: IntegrationInfo;
165
+ };
166
+ /** Returns repositories discovered from a source-code integration. */
167
+ export interface DiscoverSourceRepositoriesResponse {
168
+ /** Lists repositories available for selection. */
169
+ repositories: SourceRepository[];
170
+ }
171
+ /** Represents a normalized GitHub repository selection. */
172
+ export interface NormalizedGitHubRepositorySelection {
173
+ /** Stores the accepted legacy selection when canonical metadata is absent. */
174
+ legacyRepository?: string;
175
+ /** Lists validated canonical repository metadata. */
176
+ repositories: GitHubRepositoryConfiguration[];
177
+ /** Stores the validated default owner/repository name. */
178
+ defaultRepository: string;
179
+ }
180
+ /** Represents a normalized Bitbucket repository selection. */
181
+ export interface NormalizedBitbucketRepositorySelection {
182
+ /** Lists validated canonical repository metadata. */
183
+ repositories: BitbucketRepositoryConfiguration[];
184
+ /** Stores the validated default workspace/repository name. */
185
+ defaultRepository: string;
186
+ }
187
+ /** Normalizes selected GitHub repositories for persistence and connector use. */
188
+ export declare function normalizeGitHubRepositorySelection(configuration: GitHubRepositorySelectionConfiguration): NormalizedGitHubRepositorySelection;
189
+ /** Normalizes selected Bitbucket repositories for persistence and connector use. */
190
+ export declare function normalizeBitbucketRepositorySelection(configuration: BitbucketRepositorySelectionConfiguration): NormalizedBitbucketRepositorySelection;
191
+ export {};
@@ -0,0 +1,30 @@
1
+ import { ApiOptions } from '../public-types/api-client.public-types';
2
+ import { ApiEndpointId, HttpMethod } from '../public-types/api.public-types';
3
+ import { IntegrationId } from '../public-types/communication.public-types';
4
+ /** The headers of an API call. */
5
+ export type ApiHeaders = Record<string, string | number | boolean>;
6
+ /** The context of an API call. */
7
+ export declare class ApiCallContext {
8
+ readonly integrationId: IntegrationId;
9
+ readonly endpointId: ApiEndpointId;
10
+ readonly url: string;
11
+ readonly method: HttpMethod;
12
+ readonly body: unknown;
13
+ readonly options: ApiOptions;
14
+ }
15
+ /**
16
+ * Represents a request to call an API through a specified integration and endpoint.
17
+ * Includes optional method override and additional request options.
18
+ */
19
+ export interface CallApiRequest<BodyType = any> {
20
+ /** The identifier of the integration through which the API is called. */
21
+ integrationId: IntegrationId;
22
+ /** Target API endpoint to invoke. */
23
+ endpointId: ApiEndpointId;
24
+ /** Optional request payload. */
25
+ body?: BodyType;
26
+ /** Optional HTTP method override. Default is POST. */
27
+ overrideMethod?: HttpMethod;
28
+ /** Additional request options. */
29
+ options: ApiOptions;
30
+ }