@squidcloud/client 1.0.482 → 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 (62) 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-integrations.public-types.d.ts +7 -0
  6. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +31 -1
  7. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +4 -4
  8. package/dist/internal-common/src/public-types/ai-function.public-types.d.ts +36 -0
  9. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +153 -2
  10. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +6 -0
  11. package/dist/internal-common/src/public-types/connector.public-types.d.ts +1 -1
  12. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +125 -2
  13. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  14. package/dist/internal-common/src/public-types/langgraph.public-types.d.ts +40 -0
  15. package/dist/internal-common/src/public-types/source-code.public-types.d.ts +191 -0
  16. package/dist/internal-common/src/public-types/web.public-types.d.ts +5 -0
  17. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
  18. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
  19. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
  20. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
  21. package/dist/internal-common/src/types/ai-agent.types.d.ts +249 -0
  22. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +306 -0
  23. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -0
  24. package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
  25. package/dist/internal-common/src/types/communication.types.d.ts +1 -0
  26. package/dist/internal-common/src/types/document.types.d.ts +1 -0
  27. package/dist/internal-common/src/types/file.types.d.ts +6 -0
  28. package/dist/internal-common/src/types/headers.types.d.ts +41 -0
  29. package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
  30. package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
  31. package/dist/internal-common/src/types/notification.types.d.ts +5 -0
  32. package/dist/internal-common/src/types/observability.types.d.ts +168 -0
  33. package/dist/internal-common/src/types/query.types.d.ts +15 -0
  34. package/dist/internal-common/src/types/secret.types.d.ts +7 -0
  35. package/dist/internal-common/src/types/socket.types.d.ts +1 -0
  36. package/dist/internal-common/src/types/stage.d.ts +9 -0
  37. package/dist/internal-common/src/types/time-units.d.ts +1 -0
  38. package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
  39. package/dist/internal-common/src/utils/array.d.ts +7 -0
  40. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
  41. package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
  42. package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
  43. package/dist/internal-common/src/utils/http.d.ts +10 -0
  44. package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
  45. package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
  46. package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
  47. package/dist/internal-common/src/utils/object.d.ts +86 -0
  48. package/dist/internal-common/src/utils/serialization.d.ts +24 -0
  49. package/dist/internal-common/src/utils/squid.constants.d.ts +6 -0
  50. package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
  51. package/dist/internal-common/src/utils/validation.d.ts +19 -0
  52. package/dist/internal-common/src/websocket.impl.d.ts +26 -0
  53. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +9 -1
  54. package/dist/typescript-client/src/distributed-lock.manager.d.ts +3 -2
  55. package/dist/typescript-client/src/index.d.ts +1 -0
  56. package/dist/typescript-client/src/integration-client.d.ts +5 -1
  57. package/dist/typescript-client/src/langgraph-client.d.ts +62 -0
  58. package/dist/typescript-client/src/public-types.d.ts +2 -0
  59. package/dist/typescript-client/src/squid.d.ts +6 -0
  60. package/dist/typescript-client/src/version.d.ts +1 -1
  61. package/dist/typescript-client/src/web-client.d.ts +9 -1
  62. 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_";
@@ -1,3 +1,4 @@
1
+ import { AiAgentMemoryOptions } from './ai-agent.public-types';
1
2
  import { AiQueryOptions } from './ai-query.public-types';
2
3
  import { AiAgentId } from './communication.public-types';
3
4
  /**
@@ -41,6 +42,12 @@ export interface AiApiOptions {
41
42
  * user prompt. Default 4.
42
43
  */
43
44
  maxIterations?: number;
45
+ /**
46
+ * Conversation memory configuration. When provided, prior user prompts and AI answers under the same `memoryId`
47
+ * are provided as additional context to the AI, enabling cross-prompt follow-ups
48
+ * Defaults to no memory.
49
+ */
50
+ memoryOptions?: AiAgentMemoryOptions;
44
51
  }
45
52
  /**
46
53
  * Configuration options for AI agent MCP integration.
@@ -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
@@ -843,6 +852,12 @@ export interface BaseUpsertContextStatus {
843
852
  export interface UpsertContextStatusSuccess extends BaseUpsertContextStatus {
844
853
  /** Whether the context upsert was successful or got an error. */
845
854
  status: 'success';
855
+ /**
856
+ * Set when the context was stored and is fully searchable (vector/keyword), but was NOT graph-indexed
857
+ * because the knowledge base is over its per-KB graph chunk cap. Only GraphRAG coverage is absent;
858
+ * surfaced so bulk operations can report which contexts fell outside the graph.
859
+ */
860
+ graphIndexingSkipped?: boolean;
846
861
  }
847
862
  /**
848
863
  * Machine-readable code identifying a specific upsert failure reason.
@@ -939,7 +954,13 @@ export interface TextContextRequest extends BaseContextRequest {
939
954
  export interface FileContextRequest extends BaseContextRequest {
940
955
  /** Specifies the context type as 'file'. */
941
956
  type: 'file';
942
- /** 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
+ */
943
964
  extractImages?: boolean;
944
965
  /** The minimum size for extracted images, if applicable. */
945
966
  imageMinSizePixels?: number;
@@ -1056,6 +1077,15 @@ export type AiSessionContext = {
1056
1077
  agentId: string;
1057
1078
  /** The ID of the job associated with the session. */
1058
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;
1059
1089
  /**
1060
1090
  * ID of the status update that triggered this session (e.g. the agent's "Calling AI Function"
1061
1091
  * event). Status updates emitted on behalf of this session nest under it in the status feed.
@@ -8,7 +8,7 @@ export declare const RERANK_PROVIDERS: readonly ["cohere", "none"];
8
8
  */
9
9
  export type AiRerankProvider = (typeof RERANK_PROVIDERS)[number];
10
10
  /** List of available AI provider types. See AiProviderType. */
11
- export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "codex", "cohere", "flux", "gemini", "openai", "grok", "stability", "voyage", "mistral", "textract", "vertex", "external"];
11
+ export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "codex", "cohere", "flux", "gemini", "openai", "openai-compatible", "grok", "stability", "voyage", "mistral", "textract", "vertex", "external"];
12
12
  /**
13
13
  * Type of the AI provider.
14
14
  * References a single AI service, regardless of the model or other AI function it provides (like
@@ -29,7 +29,7 @@ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4
29
29
  * Public Gemini chat model names (active models only).
30
30
  * @category AI
31
31
  */
32
- export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.5-flash", "gemini-3.1-flash-lite"];
32
+ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.6-flash", "gemini-3.5-flash-lite"];
33
33
  /**
34
34
  * Public Grok chat model names (active models only).
35
35
  * @category AI
@@ -39,12 +39,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.3", "grok-4-1-fast
39
39
  * Public Anthropic chat model names (active models only).
40
40
  * @category AI
41
41
  */
42
- export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-5"];
42
+ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5"];
43
43
  /**
44
44
  * The supported AI model names.
45
45
  * @category AI
46
46
  */
47
- export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.5-flash", "gemini-3.1-flash-lite", "grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
47
+ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.6-flash", "gemini-3.5-flash-lite", "grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
48
48
  /** Checks if the given model name is a global AI chat model name. */
49
49
  export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
50
50
  /**
@@ -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;
@@ -634,6 +645,12 @@ export interface AiKnowledgeBaseSearchResultChunk {
634
645
  export interface UpsertKnowledgeBaseContextResponse {
635
646
  /** List of the upsert status of each item sent in the request. */
636
647
  failure?: UpsertContextStatusError;
648
+ /**
649
+ * Set when the context was stored (and is fully searchable via vector/keyword) but NOT graph-indexed
650
+ * because the knowledge base is over its per-KB graph chunk cap. Only GraphRAG coverage is absent; the
651
+ * singular counterpart of {@link UpsertKnowledgeBaseContextsResponse.graphIndexingSkippedContextIds}.
652
+ */
653
+ graphIndexingSkipped?: boolean;
637
654
  }
638
655
  /**
639
656
  * Response structure for upserting contexts for an AiKnowledgeBase
@@ -652,6 +669,12 @@ export interface UpsertKnowledgeBaseContextsResponse {
652
669
  * `undefined` at runtime — callers must handle its absence rather than trust it is always populated.
653
670
  */
654
671
  contextIds?: Array<AiContextId>;
672
+ /**
673
+ * Contexts that were stored (and are fully searchable via vector/keyword) but NOT graph-indexed because
674
+ * the knowledge base is over its per-KB graph chunk cap. Only GraphRAG coverage is absent; surfaced so a
675
+ * caller can report the graph-coverage gap. Absent/empty when nothing was skipped or graph is disabled.
676
+ */
677
+ graphIndexingSkippedContextIds?: Array<AiContextId>;
655
678
  }
656
679
  /**
657
680
  * Request structure for searching an AiKnowledgeBase
@@ -665,6 +688,134 @@ export interface AiKnowledgeBaseSearchRequest {
665
688
  /** The search options for this search */
666
689
  options: AiKnowledgeBaseSearchOptions;
667
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
+ }
668
819
  /**
669
820
  * Request structure for searching AI contexts in the AiKnowledgeBase.
670
821
  * @category AI
@@ -214,6 +214,12 @@ export interface AiSpreadsheetQueryOptions {
214
214
  instructions?: string;
215
215
  /** Overrides the model used to answer the query. */
216
216
  model?: AiChatModelName;
217
+ /**
218
+ * Background gathered by the calling agent (facts from retrieved chunks, chat history, or earlier
219
+ * spreadsheet queries in the same conversation). Injected into the sub-agent's prompt as reference
220
+ * data — not as instructions — so it starts oriented instead of rediscovering the caller's context.
221
+ */
222
+ context?: string;
217
223
  }
218
224
  /**
219
225
  * Request for executing an AI-powered query over spreadsheet files.
@@ -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
  /**
@@ -121,6 +128,116 @@ export interface SpreadsheetSheetInfo {
121
128
  * Number of columns in the sheet.
122
129
  */
123
130
  columnCount: number;
131
+ /**
132
+ * Present and true when the sheet is hidden (or very-hidden) in the workbook. Hidden sheets are
133
+ * extracted like visible ones; the flag lets downstream surfaces say so. Omitted for visible
134
+ * sheets to keep the stored inventory JSON compact.
135
+ */
136
+ hidden?: boolean;
137
+ /** Cells whose value is computed by a formula. Omitted when zero, keeping the stored JSON compact. */
138
+ formulaCellCount?: number;
139
+ /** Merged ranges declared on the sheet. Omitted when zero. */
140
+ mergedRangeCount?: number;
141
+ /**
142
+ * Sheet-qualified references to this sheet from formulas on OTHER VISIBLE sheets. Omitted when
143
+ * zero. Raw evidence of "a live sheet reads this one", which is why references from hidden sheets
144
+ * are excluded — those are reported through {@link disconnected}, which walks them transitively.
145
+ */
146
+ inboundRefCount?: number;
147
+ /**
148
+ * Sheet-qualified references from this sheet's formulas to other sheets OF THIS WORKBOOK. Omitted
149
+ * when zero. External references (`[Book.xlsx]Sheet1!A1`) are not counted — except in a legacy
150
+ * .xls, whose formula text does not mark them (see {@link disconnected}), so a reference into
151
+ * another workbook's same-named sheet counts here.
152
+ */
153
+ outboundRefCount?: number;
154
+ /** Formulas on the sheet containing a `#REF!` error, the signature of deleted precedents. Omitted when zero. */
155
+ refErrorCount?: number;
156
+ /**
157
+ * Present and true when the sheet is hidden AND takes no part in the workbook's live dependency
158
+ * graph: nothing the live model reads leads to it, and it reads no visible sheet itself.
159
+ *
160
+ * Reachability, not adjacency: a hidden sheet read by another hidden sheet that a visible sheet
161
+ * reads is live, and the walk crosses as many hidden hops as the workbook has. It follows the READ
162
+ * direction only. A hidden staging or print sheet that merely reads the live model — downstream of
163
+ * it, not orphaned from it — is spared by that second clause, but sparing it does not spare what
164
+ * feeds IT: were liveness to flow backwards, one legacy tab still pointing at the current dashboard
165
+ * would carry its whole cluster of stale detail sheets back into the live set.
166
+ *
167
+ * Deliberately conservative on two further counts. It is never asserted for visible sheets, which
168
+ * are orphaned by design far more often than not (cover pages, chart tabs, mapping tables). And it
169
+ * remains a heuristic for "legacy", not a proof: `INDIRECT()`, defined-name and VBA/Power Query
170
+ * references are all invisible to a formula scan, so a hidden sheet reached only that way is a
171
+ * false positive. Consumers should present it as the evidence it is, never as a verdict.
172
+ *
173
+ * It is also under-reported in the legacy .xls container, where a parsed external reference keeps
174
+ * only the other workbook's sheet NAME: a link to the model this file was copied from can be
175
+ * credited to that file's own leftover copy of the sheet and spare it the flag. Missing orphans
176
+ * that way, never inventing them, is the direction this signal can afford to be wrong in.
177
+ */
178
+ disconnected?: boolean;
179
+ /**
180
+ * Up to a few representative formulas ("C5=SUM(B2:B4)") for the summary preview. NOT persisted in
181
+ * the bounded inventory JSON — preview-time only.
182
+ */
183
+ formulaSample?: Array<string>;
184
+ }
185
+ /**
186
+ * Workbook-level parts the per-sheet CSV dump cannot express, counted from the container index so
187
+ * the summary can SAY what it cannot show (chart-locked figures, pivot views, staleness of
188
+ * external-workbook cached values). Every field is omitted when zero/false.
189
+ */
190
+ export interface SpreadsheetWorkbookFeatures {
191
+ /** Charts embedded in the workbook; chart data is not extracted. */
192
+ chartCount?: number;
193
+ /** Pivot tables; their computed views are not extracted. */
194
+ pivotTableCount?: number;
195
+ /** External-link parts (other workbooks, DDE, or OLE); linked cells carry last-cached values that may be stale. */
196
+ externalLinkCount?: number;
197
+ /** Sheets carrying cell comments/notes (not extracted). */
198
+ commentPartCount?: number;
199
+ /** The workbook contains VBA macros. */
200
+ hasVbaMacros?: boolean;
201
+ }
202
+ /** One data series of a chart, with its cached categories and values. */
203
+ export interface SpreadsheetChartSeries {
204
+ /** The series name. */
205
+ name?: string;
206
+ /** The categories (x-axis labels) for the series. */
207
+ categories: Array<string>;
208
+ /** The numeric values for the series. */
209
+ values: Array<number>;
210
+ /**
211
+ * The series' true cached point count, present ONLY when extraction retained fewer points than the
212
+ * series actually declares. Without it, a consumer cannot tell a complete 8-point series apart from
213
+ * the first 8 points of a 12-point one, and would describe a January-December series as ending in
214
+ * August.
215
+ */
216
+ totalPointCount?: number;
217
+ }
218
+ /** One chart's cached content. Cached values are what the chart last rendered; formulas are not evaluated. */
219
+ export interface SpreadsheetChartInfo {
220
+ /** The chart's title, when it declares one. */
221
+ title?: string;
222
+ /** The worksheet the chart is anchored to, when the relationship graph resolves it. */
223
+ sheetName?: string;
224
+ /** The chart's data series, in declaration order. */
225
+ series: Array<SpreadsheetChartSeries>;
226
+ /**
227
+ * The chart's true series count, present ONLY when extraction retained fewer series than the chart
228
+ * actually declares — so an omitted-series count is computed against what the chart HAS, not against
229
+ * what survived extraction's own cap.
230
+ */
231
+ totalSeriesCount?: number;
232
+ }
233
+ /** One pivot table's identity and fields. Displayed aggregates are NOT extracted — only what it is built from. */
234
+ export interface SpreadsheetPivotInfo {
235
+ /** The pivot table name. */
236
+ name?: string;
237
+ /** The worksheet the pivot table is anchored to. */
238
+ sheetName?: string;
239
+ /** The field names used in the pivot table. */
240
+ fields: Array<string>;
124
241
  }
125
242
  /**
126
243
  * Structural information about a parseable spreadsheet document.
@@ -130,6 +247,12 @@ export interface SpreadsheetDocumentInfo {
130
247
  * The sheets of the spreadsheet, in workbook order.
131
248
  */
132
249
  sheets: Array<SpreadsheetSheetInfo>;
250
+ /** Workbook-level parts the CSV dump cannot express (best-effort; absent for CSV/TSV and .xls). */
251
+ features?: SpreadsheetWorkbookFeatures;
252
+ /** Charts with their cached series (best-effort; absent for .xls and when none exist). */
253
+ charts?: Array<SpreadsheetChartInfo>;
254
+ /** Pivot tables with their field names (best-effort; absent for .xls/.xlsb and when none exist). */
255
+ pivots?: Array<SpreadsheetPivotInfo>;
133
256
  }
134
257
  /**
135
258
  * The full result of extracting data from a document, including all pages and any extracted images.
@@ -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
  */