@squidcloud/client 1.0.495 → 1.0.497

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * See MetricName.kt for documentation on each value.
10
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_aiSpendInputTokens_count", "squid_aiSpendOutputTokens_count", "squid_aiSpendReasoningTokens_count", "squid_aiSpendCacheReadTokens_count", "squid_aiSpendCacheWriteTokens_count", "squid_aiSpendPages_count", "squid_aiSpendImages_count", "squid_aiSpendAudioSeconds_count", "squid_aiSpendCharacters_count", "squid_aiSpendSearches_count", "squid_aiSpendCostUsd_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_aiVoiceCreateSession_count", "squid_aiVoiceCreateSession_time", "squid_aiVoiceAnswerOpenAiCall_count", "squid_aiVoiceAnswerOpenAiCall_time", "squid_aiVoiceStartOpenAiWebCall_count", "squid_aiVoiceStartOpenAiWebCall_time", "squid_aiOpenAiChatCompletions_count", "squid_aiOpenAiChatCompletions_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_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"];
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_aiSpendInputTokens_count", "squid_aiSpendOutputTokens_count", "squid_aiSpendReasoningTokens_count", "squid_aiSpendCacheReadTokens_count", "squid_aiSpendCacheWriteTokens_count", "squid_aiSpendPages_count", "squid_aiSpendImages_count", "squid_aiSpendAudioSeconds_count", "squid_aiSpendCharacters_count", "squid_aiSpendSearches_count", "squid_aiSpendCostUsd_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_aiVoiceCreateSession_count", "squid_aiVoiceCreateSession_time", "squid_aiVoiceAnswerOpenAiCall_count", "squid_aiVoiceAnswerOpenAiCall_time", "squid_aiVoiceStartOpenAiWebCall_count", "squid_aiVoiceStartOpenAiWebCall_time", "squid_aiOpenAiChatCompletions_count", "squid_aiOpenAiChatCompletions_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_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_tenantDependencyResolved_count", "squid_tenantBrowserSpawnAttempt_count", "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
12
  export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
13
13
  /** Common prefix for all Squid metrics. */
14
14
  export declare const SQUID_METRIC_NAME_PREFIX = "squid_";
@@ -505,7 +505,11 @@ export interface BaseAiChatOptions {
505
505
  responseFormat?: AiAgentResponseFormat;
506
506
  /** Whether to response in a "smooth typing" way, beneficial when the chat result is displayed in a UI. Default to true. */
507
507
  smoothTyping?: boolean;
508
- /** Global context passed to the agent and all AI functions of the agent. */
508
+ /**
509
+ * Global context passed to the agent and all AI functions of the agent. A request's value also reaches the AI
510
+ * functions of its connected agents, merged over each one's stored `agentContext`. Its keys are caller input and
511
+ * win over stored ones: only the root agent's `@secureAiAgent` rules can vet them, and none run for a public agent.
512
+ */
509
513
  agentContext?: Record<string, unknown>;
510
514
  /**
511
515
  * Functions to expose to the AI.
@@ -950,6 +954,12 @@ export interface AiStatusMessage {
950
954
  /** Optional tags providing additional metadata about the status. */
951
955
  tags?: Record<string, any>;
952
956
  }
957
+ /**
958
+ * `errorType` on a failed chat/ask job when the AI provider itself failed (a stall, timeout, or
959
+ * unrecognized 5xx) rather than Squid or the caller's request.
960
+ * @category AI
961
+ */
962
+ export declare const AI_PROVIDER_ERROR_TYPE = "AI_PROVIDER_ERROR";
953
963
  /** List of all chat history (memory) sources. */
954
964
  export declare const AI_CHAT_MESSAGE_SOURCE: readonly ["user", "ai"];
955
965
  /** Source of the chat history entry: either an AI response or a user. */
@@ -1068,17 +1078,12 @@ export interface UpsertContextStatusSuccess extends BaseUpsertContextStatus {
1068
1078
  imageFailureCount?: number;
1069
1079
  }
1070
1080
  /**
1071
- * Machine-readable code identifying a specific upsert failure reason.
1072
- *
1073
- * `DUPLICATE_CONTENT` means the request omitted a contextId and its content is
1074
- * byte-identical to an existing context in the same knowledge base.
1075
- *
1076
- * `EMBEDDING_FAILED` means extraction succeeded but embedding the context's chunks did not; the
1077
- * content was not written (an overwrite target keeps its previous content) and the request can be
1078
- * safely retried as-is.
1081
+ * Names an upsert failure; `DUPLICATE_CONTENT` identifies existing content when contextId is omitted.
1082
+ * `EMBEDDING_FAILED`, `EXTRACTION_TIMED_OUT`, `PROVIDER_ACCESS_DENIED`, and `SOURCE_UNREACHABLE` may
1083
+ * succeed on retry. Document faults carry `retryable: false` because the same bytes fail again.
1079
1084
  * @category AI
1080
1085
  */
1081
- export type UpsertContextErrorCode = 'DUPLICATE_CONTENT' | 'EMBEDDING_FAILED';
1086
+ export type UpsertContextErrorCode = 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'EMBEDDING_FAILED' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'IMAGE_OVER_PROVIDER_LIMIT' | 'NO_EMBEDDABLE_CONTENT' | 'PROVIDER_ACCESS_DENIED' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'SOURCE_UNREACHABLE' | 'UNREADABLE_DOCUMENT' | 'UNREADABLE_WORKBOOK' | 'UNSUPPORTED_FILE_TYPE';
1082
1087
  /**
1083
1088
  * The existing context a `DUPLICATE_CONTENT` rejection points at — where the byte-identical original
1084
1089
  * already lives.
@@ -1105,6 +1110,11 @@ export interface UpsertContextStatusError extends BaseUpsertContextStatus {
1105
1110
  errorMessage: string;
1106
1111
  /** Machine-readable code for the failure, when one applies. */
1107
1112
  errorCode?: UpsertContextErrorCode;
1113
+ /**
1114
+ * Present only when the same bytes fail the same way again, so a caller must not retry the request
1115
+ * as-is. Absence means the failure may be transient.
1116
+ */
1117
+ retryable?: false;
1108
1118
  /**
1109
1119
  * The existing context this request duplicated, when `errorCode` is `DUPLICATE_CONTENT`. Lets a caller
1110
1120
  * point the user at where the original already lives (e.g. its folder) instead of only reporting the
@@ -37,11 +37,16 @@ export type AiFileProviderType = (typeof AI_FILE_PROVIDER_TYPES)[number];
37
37
  * for them the ids are inert rather than wrong.
38
38
  */
39
39
  export declare function isFileCapableProviderType(type: AiProviderType): type is AiFileProviderType;
40
+ /**
41
+ * The AI providers whose chat provider implements the code interpreter. Declared like
42
+ * {@link AI_FILE_PROVIDER_TYPES}, so a provider that gains the interpreter is added here and nowhere else.
43
+ */
44
+ export declare const AI_CODE_INTERPRETER_PROVIDER_TYPES: readonly ["openai", "anthropic", "gemini"];
40
45
  /**
41
46
  * Public OpenAI chat model names (active models only).
42
47
  * @category AI
43
48
  */
44
- export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra"];
49
+ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-sol", "gpt-6-luna"];
45
50
  /**
46
51
  * Public Gemini chat model names (active models only).
47
52
  * @category AI
@@ -56,12 +61,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.6", "grok-4-1-fast
56
61
  * Public Anthropic chat model names (active models only).
57
62
  * @category AI
58
63
  */
59
- export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5"];
64
+ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5"];
60
65
  /**
61
66
  * The supported AI model names.
62
67
  * @category AI
63
68
  */
64
- export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.8-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
69
+ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "gpt-6-sol", "gpt-6-luna", "claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.8-flash", "gemini-3.5-flash-lite", "grok-4.6", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"];
65
70
  /** Checks if the given model name is a global AI chat model name. */
66
71
  export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
67
72
  /**
@@ -1,8 +1,11 @@
1
+ import { JSONSchema } from 'json-schema-typed';
1
2
  import { AiFileUrl } from './ai-agent.public-types';
2
3
  import { ServiceFunctionName } from './backend.public-types';
3
4
  import { IntegrationType } from './integration.public-types';
4
5
  /** Represents the possible data types for an AI function parameter. */
5
- export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date' | 'files';
6
+ export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date' | 'files' | 'object';
7
+ /** JSON Schema (draft 2020-12) describing the value of an `object` AI function parameter. */
8
+ export type AiFunctionParamSchema = JSONSchema.Interface;
6
9
  /**
7
10
  * How sticky affinity routing must be for a function that keeps state outside the request.
8
11
  * - `pod`: the state is reachable by any worker of the pod (a file on disk, a child process).
@@ -23,6 +26,13 @@ export interface AiFunctionParam {
23
26
  required: boolean;
24
27
  /** List of possible values for the parameter, if applicable. */
25
28
  enum?: Array<Omit<AiFunctionParamType, 'date'>>;
29
+ /**
30
+ * The JSON Schema of the value; required when `type` is `'object'` and rejected otherwise. Its root must be
31
+ * `{ type: 'object' }`, and an object that lists `properties` accepts no other property unless it sets
32
+ * `additionalProperties`. Squid validates every call against it, so the function only receives a value that
33
+ * satisfies it.
34
+ */
35
+ schema?: AiFunctionParamSchema;
26
36
  /**
27
37
  * Marks this parameter as the affinity key of the function and states how sticky the routing must
28
38
  * be: every call carrying the same value is routed to the same tenant pod (and, for `worker`, the
@@ -1,4 +1,4 @@
1
- import { AgentContextRequest, AiChatModelSelection, AiReasoningEffort, ContextImageFailure, UpsertContextStatusError } from './ai-agent.public-types';
1
+ import { AiChatModelSelection, AiReasoningEffort, ContextImageFailure, UpsertContextStatusError } from './ai-agent.public-types';
2
2
  import { AiEmbeddingsModelSelection, AiRerankProvider } from './ai-common.public-types';
3
3
  import { AiContextId, AiKnowledgeBaseId, AppId } from './communication.public-types';
4
4
  import { DocumentExtractionMethod } from './extraction.public-types';
@@ -228,12 +228,24 @@ export interface AiKnowledgeBaseGraphConfig {
228
228
  */
229
229
  autoBuildDebounceMs?: number;
230
230
  /**
231
- * When true, the sweep does not start automatic structural builds for this KB: activity keeps arming
232
- * the build, and the first quiet window after the flag is cleared runs it. Meant for an ingestion
233
- * campaign whose builds an operator wants to schedule by hand; `rebuildGraph` stays available.
234
- * Defaults to false.
231
+ * When true, the sweep starts no automatic build for this KB, entity resolution included: activity keeps
232
+ * arming the build, and the first quiet window after the flag is cleared runs it. `rebuildGraph` stays
233
+ * available. To hold only the structural build, use `structuralBuildSchedule`. Defaults to false.
235
234
  */
236
235
  autoBuildPaused?: boolean;
236
+ /**
237
+ * When the sweep may start an automatic structural build: `'debounced'` (one quiet window after activity),
238
+ * `'off'` (manual `rebuildGraph` only) or a 5-field cron expression. Entity resolution keeps running
239
+ * either way. Omitted ⇒ the server's default, `'debounced'` unless the deployment sets one.
240
+ */
241
+ structuralBuildSchedule?: string;
242
+ /** IANA time zone of a cron `structuralBuildSchedule`, e.g. `'America/Los_Angeles'`. Omitted ⇒ the server's default (UTC). */
243
+ structuralBuildTimeZone?: string;
244
+ /**
245
+ * How long after a cron slot its structural build may still start (milliseconds); past it, the build waits for
246
+ * the next slot. Must be a positive integer. Omitted ⇒ the server's default (3 hours).
247
+ */
248
+ structuralBuildCatchUpMs?: number;
237
249
  /** Concept-layer (facet taxonomy) configuration. Omitted ⇒ `facets: 'auto'`. */
238
250
  concepts?: AiKnowledgeBaseGraphConceptsConfig;
239
251
  }
@@ -265,6 +277,13 @@ export interface AiKnowledgeBaseGraphConceptsConfig {
265
277
  * @category AI
266
278
  */
267
279
  export declare const FOLDER_PATH_METADATA_FIELD_NAME = "folderPath";
280
+ /**
281
+ * The canonical file-name metadata field: the source file's name, stamped by file ingestion (console
282
+ * upload, document connectors). Metadata extraction reads it, beside {@link FOLDER_PATH_METADATA_FIELD_NAME},
283
+ * as evidence about the document.
284
+ * @category AI
285
+ */
286
+ export declare const FILE_NAME_METADATA_FIELD_NAME = "filename";
268
287
  /**
269
288
  * A path facet: a deterministic tree built by splitting a hierarchical path field on {@link separator}.
270
289
  * Interior nodes are the path prefixes; scoping a search to one node matches that folder and everything
@@ -498,9 +517,18 @@ export interface AiKnowledgeBaseContext {
498
517
  * content-level dedup on upsert. Absent on legacy contexts ingested before hashing was introduced.
499
518
  */
500
519
  contentHash?: string;
501
- /** Original request configuration for how the context content was processed. */
502
- requestConfig?: AgentContextRequest;
520
+ /**
521
+ * The options the context was ingested with, replayed when it is reupserted. Absent on contexts that
522
+ * carry none; their reupsert takes the defaults.
523
+ */
524
+ requestConfig?: AiKnowledgeBaseContextRequestConfig;
503
525
  }
526
+ /**
527
+ * The ingestion request's options only. Everything else a reupsert needs lives on the context itself —
528
+ * its text or stored file, title, metadata and access scopes — where it can change after ingestion.
529
+ * @category AI
530
+ */
531
+ export type AiKnowledgeBaseContextRequestConfig = Omit<AiKnowledgeBaseTextContextRequest, 'text' | 'title' | 'metadata' | 'scopes'> | Omit<AiKnowledgeBaseFileContextRequest, 'metadata' | 'scopes'>;
504
532
  /**
505
533
  * @category AI
506
534
  */
@@ -633,11 +661,10 @@ export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseCo
633
661
  /** The preferred method for extracting data from the document. */
634
662
  preferredExtractionMethod?: DocumentExtractionMethod;
635
663
  /**
636
- * Whether Squid keeps or discards the original file.
637
- *
638
- * Keeping the original file allows reprocessing and the ability for the user to download it later.
639
- *
640
- * Defaults to false.
664
+ * Whether Squid discards the downloadable original once the file is extracted; the extracted text and
665
+ * images are stored either way. Defaults to false: the original is kept so the user can download it and
666
+ * Squid can reprocess it. Without it, `querySpreadsheetsWithAi` cannot open a workbook context and a
667
+ * reupsert of the context fails, on the sync and the bulk lane alike.
641
668
  */
642
669
  discardOriginalFile?: boolean;
643
670
  }
@@ -945,9 +972,9 @@ export interface GrepKnowledgeBaseResponse {
945
972
  */
946
973
  unscannedContextCount?: number;
947
974
  /**
948
- * With `limitation: 'truncatedContent'`, the file names of documents known to have lost content at
949
- * ingest. A bounded sample, not a complete list — present it as an example, and do not infer that
950
- * documents missing from it are intact.
975
+ * Every in-scope document known to have lost content at ingest, by file name. Present whenever such a
976
+ * document is in scope, alongside whichever {@link limitation} the scan reported — a cut document is no
977
+ * less cut because the scan also stopped early. Absent when none is.
951
978
  */
952
979
  truncatedContentFileNames?: Array<string>;
953
980
  }
@@ -1710,7 +1737,8 @@ export interface QueryKnowledgeBaseGraphResponse {
1710
1737
  summaries?: Array<KnowledgeBaseGraphQueryGlobalSummary>;
1711
1738
  }
1712
1739
  /**
1713
- * One context to stage through bulk ingestion.
1740
+ * One context to stage through bulk ingestion. Unlike the sync request, `imageExtractionModel` is not
1741
+ * accepted: a job bills one fixed vision model for every image it describes.
1714
1742
  * @category AI
1715
1743
  */
1716
1744
  export interface BulkIngestionContext {
@@ -1744,6 +1772,24 @@ export interface BulkIngestionContext {
1744
1772
  * same name, so a caller's choice survives whichever lane a deployment routes the upload through.
1745
1773
  */
1746
1774
  preferredExtractionMethod?: DocumentExtractionMethod;
1775
+ /**
1776
+ * The RAG type and chunk overlap this context is chunked and indexed with; mirrors the sync request's
1777
+ * `options`, with the same defaults (the knowledge base's `ragType`, and the overlap that type implies).
1778
+ * `chunkOverlap` must be a number below the 4,000-character chunk size.
1779
+ */
1780
+ options?: BaseAiKnowledgeBaseContextOptions;
1781
+ /**
1782
+ * Minimum width/height in pixels for an extracted image to be kept; mirrors the sync request's field of
1783
+ * the same name. Smaller images are skipped, and an inline markdown/HTML image below it keeps its raw
1784
+ * reference in the text.
1785
+ */
1786
+ imageMinSizePixels?: number;
1787
+ /**
1788
+ * Whether Squid discards a file context's downloadable original once it is extracted (the extracted
1789
+ * text and images are stored either way); mirrors {@link AiKnowledgeBaseFileContextRequest.discardOriginalFile},
1790
+ * with the same consequences. Ignored for a text context.
1791
+ */
1792
+ discardOriginalFile?: boolean;
1747
1793
  /**
1748
1794
  * Optional metadata associated with the context item; mirrors {@link BaseAiKnowledgeBaseContextRequest.metadata}.
1749
1795
  * Squid-reserved keys are stripped server-side, and values are validated/normalized against the target
@@ -1867,8 +1913,11 @@ export interface BulkIngestionFileStatus {
1867
1913
  /**
1868
1914
  * Machine-readable class of a failed file, for outcomes to treat differently from real failures.
1869
1915
  * Terminal — reported with `retryable: false` — are `'CONTENT_TOO_LARGE'` (past the per-context
1870
- * ceiling), `'ENCRYPTED_DOCUMENT'`, `'NO_EMBEDDABLE_CONTENT'`, `'SOURCE_OVER_PROVIDER_LIMIT'` (the
1871
- * bytes exceed what the extraction provider accepts) and `'UNSUPPORTED_FILE_TYPE'`.
1916
+ * ceiling), `'ENCRYPTED_DOCUMENT'`, `'IMAGE_OVER_PROVIDER_LIMIT'` (the OCR provider refuses an image in the
1917
+ * document as too large, even with the pages that draw it redrawn smaller), `'NO_EMBEDDABLE_CONTENT'`,
1918
+ * `'SOURCE_OVER_PROVIDER_LIMIT'` (the bytes exceed what the extraction provider accepts),
1919
+ * `'UNREADABLE_DOCUMENT'` (a PDF or Office file whose bytes cannot be opened as one), `'UNREADABLE_WORKBOOK'`
1920
+ * (a spreadsheet whose content the parser cannot read) and `'UNSUPPORTED_FILE_TYPE'`.
1872
1921
  * `'DUPLICATE_CONTENT'` is a skip rather than a failure: the KB already holds this content.
1873
1922
  * `'EXTRACTION_TIMED_OUT'` stays retryable — the deadline is contended, so a borderline document can
1874
1923
  * cross it under load. So do `'SOURCE_UNREACHABLE'` (the provider could not fetch the source, which a
@@ -1877,7 +1926,7 @@ export interface BulkIngestionFileStatus {
1877
1926
  * file, so re-submit it in a fresh job; a file that alone exceeds the ceiling fails this way in every job.
1878
1927
  * Additive; absent for ordinary failures.
1879
1928
  */
1880
- errorCode?: 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'JOB_FULL' | 'NO_EMBEDDABLE_CONTENT' | 'PROVIDER_ACCESS_DENIED' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'SOURCE_UNREACHABLE' | 'UNSUPPORTED_FILE_TYPE';
1929
+ errorCode?: 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'IMAGE_OVER_PROVIDER_LIMIT' | 'JOB_FULL' | 'NO_EMBEDDABLE_CONTENT' | 'PROVIDER_ACCESS_DENIED' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'SOURCE_UNREACHABLE' | 'UNREADABLE_DOCUMENT' | 'UNREADABLE_WORKBOOK' | 'UNSUPPORTED_FILE_TYPE';
1881
1930
  /**
1882
1931
  * Present only on a failed file an extraction provider answered: a stable fingerprint of that answer
1883
1932
  * (provider, HTTP status and provider code), so a caller can tell the same failure repeating from a new one.
@@ -1895,7 +1944,25 @@ export interface BulkIngestionFileStatus {
1895
1944
  imageFailures?: Array<ContextImageFailure>;
1896
1945
  /** Total number of failed images, which exceeds `imageFailures.length` when the list was capped. */
1897
1946
  imageFailureCount?: number;
1947
+ /**
1948
+ * Set on a `completed` file that is stored and searchable but that the job withheld from graph indexing;
1949
+ * the bulk counterpart of {@link UpsertKnowledgeBaseContextsResponse.graphIndexingSkippedContextIds}, and
1950
+ * `graphIndexingSkipReason` says why. Records the job's own outcome: it is written when the job's graph
1951
+ * run admits its files, which can be after the job completes (a poll of the job status sees it, the
1952
+ * terminal push may not), and it stays set even if a later graph build indexes the file.
1953
+ */
1954
+ graphIndexingSkipped?: boolean;
1955
+ /** Why graph indexing was withheld; present exactly when `graphIndexingSkipped` is. */
1956
+ graphIndexingSkipReason?: BulkIngestionGraphSkipReason;
1898
1957
  }
1958
+ /**
1959
+ * Why a bulk-ingested file was withheld from graph indexing. `'cap'`: the knowledge base is over its
1960
+ * per-KB graph chunk cap (or the cap could not be checked and the job failed closed), so the file stays
1961
+ * out until the cap allows it. `'queue'`: the graph-indexing queue was full when the file finalized; the
1962
+ * file is left to the graph auto-build sweep, which indexes it under the same cap once the job goes quiet.
1963
+ * @category AI
1964
+ */
1965
+ export type BulkIngestionGraphSkipReason = 'cap' | 'queue';
1899
1966
  /**
1900
1967
  * Why a whole bulk-ingestion staging call was refused, on the `details` of its 400 response. The
1901
1968
  * refusal names the one context that caused it, so a caller recording per-file outcomes charges only
@@ -78,6 +78,10 @@ export interface AnswerOpenAiVoiceCallRequest {
78
78
  model?: string;
79
79
  /** Voice of the realtime model; defaults to the integration's default voice. */
80
80
  voice?: string;
81
+ /** Whether caller speech interrupts the realtime model. Omitted values keep OpenAI's default. */
82
+ allowInterruptions?: boolean;
83
+ /** How readily OpenAI detects caller speech. Omitted values keep OpenAI's default. */
84
+ interruptionSensitivity?: 'low' | 'normal' | 'high';
81
85
  /** Instructions of the realtime model. */
82
86
  instructions: string;
83
87
  /** Spoken as soon as the call is answered; without it the model waits for the caller to speak first. */
@@ -124,6 +128,10 @@ export interface StartOpenAiWebVoiceCallRequest {
124
128
  model?: string;
125
129
  /** Voice of the realtime model. */
126
130
  voice?: string;
131
+ /** Whether caller speech interrupts the model; defaults to the phone line, then OpenAI's default. */
132
+ allowInterruptions?: boolean;
133
+ /** How readily caller speech is detected; defaults to the phone line, then OpenAI's default. */
134
+ interruptionSensitivity?: 'low' | 'normal' | 'high';
127
135
  /** Language the call starts in, as an ISO code or BCP-47 tag. */
128
136
  language?: string;
129
137
  /** Whether the caller may switch language mid-call. */
@@ -14,7 +14,7 @@ export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_
14
14
  * `AiAgentMcpServerConfig.oauthIntegrationId`). Kept in sync with the providers supported by the
15
15
  * MCP OAuth validation in core.
16
16
  */
17
- export declare const MCP_OAUTH_INTEGRATION_TYPES: readonly ["auth0"];
17
+ export declare const MCP_OAUTH_INTEGRATION_TYPES: readonly ["auth0", "azure-entra-id", "azure-entra-external-id"];
18
18
  /** Supported integration types for GraphQL-based services. */
19
19
  export declare const GRAPHQL_INTEGRATION_TYPES: readonly ["graphql"];
20
20
  /** Supported integration types for HTTP-based services. */
@@ -84,4 +84,18 @@ export interface AsyncJob<T = any> {
84
84
  * This is optional.
85
85
  */
86
86
  error?: string;
87
+ /**
88
+ * A machine-readable category for the error, if the job has failed. Lets a caller branch on the
89
+ * failure kind (e.g. `'AI_PROVIDER_ERROR'`) without parsing {@link error}.
90
+ */
91
+ errorType?: string;
92
+ }
93
+ /**
94
+ * An `Error` carrying a machine-readable {@link errorType}, thrown by `JobClient.awaitJob` when a
95
+ * failed job's {@link AsyncJob.errorType} is set. Lets a caller branch on the failure kind (e.g.
96
+ * `'AI_PROVIDER_ERROR'`) without parsing `message`.
97
+ */
98
+ export interface JobError extends Error {
99
+ /** The category the failed job's error was tagged with, if any (e.g. `'AI_PROVIDER_ERROR'`). */
100
+ errorType?: string;
87
101
  }
@@ -205,6 +205,18 @@ export interface AiKnowledgeBaseContextSizeRequest {
205
205
  /** The ID of the AIKnowledgeBase */
206
206
  knowledgeBaseId: AiKnowledgeBaseId;
207
207
  }
208
+ /**
209
+ * Request structure for the internal test-only route that arms an app's next bulk-ingestion fulltext blob
210
+ * operations to fail, so the staging and finalize fallbacks can be exercised without a storage outage.
211
+ */
212
+ export interface AiKnowledgeBaseFailNextBulkFulltextBlobOpsRequest {
213
+ /** The ID of the App */
214
+ appId: AppId;
215
+ /** How many blob uploads land before the next one fails; omitted leaves uploads alone. */
216
+ uploadsBeforeFailure?: number;
217
+ /** How many blob reads land before the next one fails; omitted leaves reads alone. */
218
+ readsBeforeFailure?: number;
219
+ }
208
220
  /**
209
221
  * Request structure for the internal test-only route that arms the next `count` grep scans of a
210
222
  * knowledge base to fail at their `maxTimeMS` deadline.
@@ -216,7 +228,52 @@ export interface AiKnowledgeBaseFailNextGrepScansRequest {
216
228
  knowledgeBaseId: AiKnowledgeBaseId;
217
229
  /** How many upcoming scans fail; a non-positive value disarms. */
218
230
  count: number;
231
+ /** Whether the next truncated-file-name lookup fails; false disarms, absent leaves it alone. */
232
+ failNextTruncatedNameLookup?: boolean;
219
233
  }
234
+ /**
235
+ * Where an armed bulk finalize failure throws: past the destructive-write boundary but before the vector
236
+ * write (nothing written), or right after it (the vectors are replaced, the record is not).
237
+ */
238
+ export type BulkFinalizeFailurePhase = 'beforeVectorWrite' | 'afterVectorWrite';
239
+ /**
240
+ * Request structure for the internal test-only route that arms the next `count` bulk-ingestion finalizes
241
+ * of a knowledge base to throw at `phase`.
242
+ */
243
+ export interface AiKnowledgeBaseFailNextBulkFinalizeWritesRequest {
244
+ /** The ID of the App */
245
+ appId: AppId;
246
+ /** The ID of the AIKnowledgeBase */
247
+ knowledgeBaseId: AiKnowledgeBaseId;
248
+ /** How many upcoming finalizes fail; a non-positive value disarms. */
249
+ count: number;
250
+ /** Where in the finalize the armed failures throw. */
251
+ phase: BulkFinalizeFailurePhase;
252
+ }
253
+ /**
254
+ * Request structure for the internal test-only route that arms the next `count` finalize-time
255
+ * image-description reads of a bulk-ingested knowledge base to fail.
256
+ */
257
+ export interface AiKnowledgeBaseFailNextImageDescriptionReadsRequest {
258
+ /** The ID of the App */
259
+ appId: AppId;
260
+ /** The ID of the AIKnowledgeBase */
261
+ knowledgeBaseId: AiKnowledgeBaseId;
262
+ /** How many upcoming reads fail; zero disarms. */
263
+ count: number;
264
+ }
265
+ /**
266
+ * Request structure for the internal test-only route that answers every image with a description derived
267
+ * from its own bytes and no vision call, so the sync and bulk lanes describe a file identically.
268
+ */
269
+ export interface AiKnowledgeBaseStubImageDescriptionsRequest {
270
+ /** The ID of the App */
271
+ appId: AppId;
272
+ /** Arms the stub when true, disarms it when false. */
273
+ enabled: boolean;
274
+ }
275
+ /** Leading text of a stubbed image description; the rest is the sha256 of the image bytes. */
276
+ export declare const STUB_IMAGE_DESCRIPTION_PREFIX = "Stubbed image description sha256:";
220
277
  /**
221
278
  * Request structure for the internal test-only route that makes one knowledge base's graph be built by
222
279
  * the deterministic stub extractor instead of by the model.
@@ -457,6 +514,53 @@ export interface AiKnowledgeBaseBackfillFulltextStatus {
457
514
  storedPartCount?: number;
458
515
  errorMessage?: string;
459
516
  }
517
+ /** Longest context batch one `repairBulkFulltext` call accepts; larger work-lists are split by the caller. */
518
+ export declare const REPAIR_BULK_FULLTEXT_MAX_CONTEXTS_PER_CALL = 20;
519
+ /**
520
+ * Request structure for rebuilding the stored raw text (`kb_fulltext`) of bulk-ingested contexts from the
521
+ * bulk-ingestion rows their job retained: the staged pages plus the descriptions its `imageDescription`
522
+ * requests already produced. No vision call, so a repaired context reads exactly as a freshly ingested
523
+ * one at no model cost.
524
+ */
525
+ export interface AiKnowledgeBaseRepairBulkFulltextRequest {
526
+ /** The ID of the AIKnowledgeBase */
527
+ knowledgeBaseId: AiKnowledgeBaseId;
528
+ /**
529
+ * The ids of the contexts to repair, at most {@link REPAIR_BULK_FULLTEXT_MAX_CONTEXTS_PER_CALL} per
530
+ * call. Each context's stored text is fully replaced, so re-running a context is safe.
531
+ */
532
+ contextIds: Array<AiContextId>;
533
+ /**
534
+ * Rebuilds a context whose staged pages are gone by re-extracting its stored source file, which runs
535
+ * the regular document lane and can bill OCR. Off by default; such contexts are skipped without it.
536
+ */
537
+ reextractMissingPages?: boolean;
538
+ /**
539
+ * The extraction method of the {@link reextractMissingPages} fallback, defaulting to the server's
540
+ * regular one. Name the method the original ingest used: a file extracted with OCR yields no text for
541
+ * its scanned pages under a method that does not run it, replacing the context's text with less of it.
542
+ */
543
+ extractionMethod?: DocumentExtractionMethod;
544
+ }
545
+ /** Response structure for a `repairBulkFulltext` call: one status per requested context, in request order. */
546
+ export interface AiKnowledgeBaseRepairBulkFulltextResponse {
547
+ statuses: Array<AiKnowledgeBaseRepairBulkFulltextStatus>;
548
+ }
549
+ /** Outcome of repairing the raw text of one bulk-ingested context. */
550
+ export interface AiKnowledgeBaseRepairBulkFulltextStatus {
551
+ contextId: AiContextId;
552
+ /**
553
+ * `repairedFromReextraction` rebuilt the pages from the stored source file because the row's own were
554
+ * gone: a fresh extraction, so its text is best-effort rather than the original's. `raced` means another
555
+ * ingest took the context over during the repair, so re-run it.
556
+ */
557
+ status: 'repaired' | 'repairedFromReextraction' | 'raced' | 'error' | 'skipped';
558
+ /** Why the context was left untouched, when it was skipped. `noJob` cannot be repaired by re-running. */
559
+ skippedReason?: 'notBulkIngested' | 'noJob' | 'jobActive' | 'noFileRow' | 'notFinalized' | 'pagesBounded' | 'noDescriptionRows' | 'noPages' | 'reingested';
560
+ /** How many parts (pages/sheets/image descriptions) were stored, on success. */
561
+ storedPartCount?: number;
562
+ errorMessage?: string;
563
+ }
460
564
  /**
461
565
  * Response structure for getting size of context
462
566
  * @category AI
@@ -131,6 +131,8 @@ export interface AgentAuditLogUpdateEvent {
131
131
  }
132
132
  /** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
133
133
  export declare const O11Y_TAG_IS_ERROR = "isError";
134
+ /** Tag naming the organization an application belongs to. */
135
+ export declare const O11Y_TAG_ORG_ID = "organizationId";
134
136
  /** Tag for log events. Metrics have an explicit appId field. */
135
137
  export declare const O11Y_TAG_APP_ID = "appId";
136
138
  /** Tag for metric and log events. */
@@ -168,6 +170,23 @@ export declare const O11Y_TAG_AI_BILLING_TIER = "billingTier";
168
170
  * the same app.
169
171
  */
170
172
  export declare const O11Y_TAG_AI_TRAFFIC_KIND = "trafficKind";
173
+ /**
174
+ * Which stage of a multi-stage lane spent the money, and which pass of its loop produced the call.
175
+ * Set by the query lanes, whose stages re-send the results gathered so far: without them one
176
+ * operation's bill cannot be attributed to the stage that carries the tokens. `iteration` is set
177
+ * only by a lane that loops.
178
+ */
179
+ export declare const O11Y_TAG_AI_SPEND_STAGE = "stage";
180
+ export declare const O11Y_TAG_AI_SPEND_ITERATION = "iteration";
181
+ /** The stages one `query_api` run reports under {@link O11Y_TAG_AI_SPEND_STAGE}. */
182
+ export type AiQueryApiSpendStage = 'endpoint_select' | 'body_create' | 'response_analyze' | 'explanation';
183
+ /** The stages one `query_data` run reports under {@link O11Y_TAG_AI_SPEND_STAGE}. */
184
+ export type AiQueryDataSpendStage = 'select_tables' | 'generate_query' | 'regenerate_queries' | 'clarification' | 'validate_queries' | 'interpreter_check' | 'interpreter_run' | 'results_analysis' | 'raw_result_purpose' | 'readonly_check' | 'spreadsheet_action';
185
+ /**
186
+ * Every stage value the ledger accepts. Enumerated rather than left free-form because the report
187
+ * groups by it: a typo would open a second bucket silently instead of failing to compile.
188
+ */
189
+ export type AiSpendStage = AiQueryApiSpendStage | AiQueryDataSpendStage;
171
190
  /**
172
191
  * Whether a billed page reached the document it was extracted for. Page-billed spend only: the
173
192
  * provider charges for a stale attempt too, so the pages are recorded either way and this separates
@@ -1,4 +1,10 @@
1
1
  import { Condition, DocIdCondition, SimpleCondition } from '../public-types/query.public-types';
2
+ /**
3
+ * Whether a LIKE pattern has a backslash before anything but `%`, `_` or another backslash, which is not
4
+ * a valid escape. Executors disagree on what it matches: PostgreSQL reads `\d` as `d`, while Mongo and
5
+ * the local matcher pass it to a regex as a digit.
6
+ */
7
+ export declare function hasInvalidLikeEscape(pattern: string): boolean;
2
8
  /**
3
9
  * Generates the regex pattern, handling special characters as follows:
4
10
  * - `_` is replaced with a `.`
@@ -1,24 +1,4 @@
1
1
  import { AppId } from '../public-types/communication.public-types';
2
2
  import { Stage } from '../types/stage';
3
- export declare const KOTLIN_CONTROLLERS: string[];
4
- /**
5
- * Returns true if the given path is served by Kotlin core in local dev (port 8001). All `/ws/*`
6
- * WebSocket paths are served by the TypeScript core (port 8000).
7
- */
8
- export declare function isKotlinPath(path: string): boolean;
9
3
  export declare function getEnvironmentPrefix(shard: string | undefined, region: string, cloudId: string, stage: Stage): string;
10
- export declare function getApplicationUrl(environmentPrefix: string, appId: string, path: string, appIdPlaceholder?: AppId, environmentPrefixPlaceholder?: string, forceKotlin?: boolean): string;
11
- /**
12
- * Returns the URL of [path] on the `core-query-kotlin` Service, addressed from inside the cluster.
13
- *
14
- * Naming the Service rather than building the public URL with {@link getApplicationUrl} keeps a
15
- * purely intra-cluster call off the external load balancer, which is what the Kotlin core's own
16
- * `getApplicationUrlInternal` already does for the hop in the other direction; and it makes the call
17
- * independent of where ingress sends [path], so moving that route cannot turn a forward into a
18
- * request back to this core.
19
- *
20
- * The Service is shared and not per-app, so the application is identified by the
21
- * `SquidHeaders.APP_ID` header rather than by the hostname. Local development has no cluster DNS and
22
- * keeps the per-app host on Kotlin's port.
23
- */
24
- export declare function getQueryKotlinServiceUrl(environmentPrefix: string, appId: AppId, path: string): string;
4
+ export declare function getApplicationUrl(environmentPrefix: string, appId: string, path: string, appIdPlaceholder?: AppId, environmentPrefixPlaceholder?: string): string;
@@ -1,3 +1,5 @@
1
+ /** Splits a field path into the segments `getInPath` walks: a dot or a bracket separates them. */
2
+ export declare const SPLIT_REGEX_FOR_GET_IN_PATH: RegExp;
1
3
  /** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
2
4
  export declare function getInPath(obj: unknown, path: string): any;
3
5
  export declare function isDateObject(value: unknown): value is Date;
@@ -1,6 +1,12 @@
1
1
  export declare function sortKeys(json: unknown): any;
2
2
  export declare function normalizeJsonAsString(json: unknown): string;
3
3
  export declare function serializeObj(obj: unknown): string;
4
+ /**
5
+ * A `JSON.stringify` replacer writing a `Date` as `{ $date }`, the form {@link deserializeObj} reads back,
6
+ * for callers that keep every other value's own `toJSON`. The date is read off the holder, since a
7
+ * replacer is handed the `toJSON` text of a date; an invalid date keeps that text, `null`.
8
+ */
9
+ export declare function writeDateAsBson(this: Record<string, unknown>, key: string, value: unknown): unknown;
4
10
  export declare function deserializeObj<T = any>(str: string): T;
5
11
  /**
6
12
  * Deserializes a multipart request payload when present.
@@ -81,9 +81,9 @@ export declare class AiKnowledgeBaseReference {
81
81
  */
82
82
  listContextIds(): Promise<Array<AiContextId>>;
83
83
  /**
84
- * Retrieves a specific context by its ID. Pass `truncateTextAfter: 0` to omit the context's `text`
85
- * field from the response when only its metadata (e.g. `contentHash`) is needed — the stored text
86
- * can be multiple MB, and truncating it avoids sending that payload back in full.
84
+ * Retrieves a specific context by its ID. Pass `truncateTextAfter: 0` to return an empty `text`
85
+ * field when only its metadata (e.g. `contentHash`) is needed — the stored text can be multiple
86
+ * MB, and truncating it avoids sending that payload back in full.
87
87
  */
88
88
  getContext(contextId: string, options?: GetContextOptions): Promise<AiKnowledgeBaseContext | undefined>;
89
89
  /**