@squidcloud/client 1.0.491 → 1.0.493
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.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/ai/system-openai-compatible.d.ts +35 -0
- package/dist/internal-common/src/metric-name.d.ts +14 -0
- package/dist/internal-common/src/public-types/ai-agent-connection.public-types.d.ts +34 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +33 -2
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +29 -0
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +284 -29
- package/dist/internal-common/src/public-types/ai-voice.public-types.d.ts +200 -0
- package/dist/internal-common/src/public-types/connector.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +302 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +514 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +52 -0
- package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +19 -0
- package/dist/internal-common/src/types/observability.types.d.ts +223 -0
- package/dist/internal-common/src/types/query.types.d.ts +15 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/internal-common/src/types/time-units.d.ts +1 -0
- package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http.d.ts +24 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +86 -0
- package/dist/internal-common/src/utils/serialization.d.ts +24 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +6 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +21 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/ai-client.d.ts +13 -1
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +4 -2
- package/dist/typescript-client/src/ai-voice-client.d.ts +42 -0
- package/dist/typescript-client/src/ai-web-voice-call.d.ts +62 -0
- package/dist/typescript-client/src/index.d.ts +2 -0
- package/dist/typescript-client/src/public-types.d.ts +2 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- 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_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"];
|
|
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_";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AiConnectedIntegrationMetadata } from './ai-agent.public-types';
|
|
2
|
+
import type { AiAgentId, IntegrationId } from './communication.public-types';
|
|
3
|
+
import type { IntegrationType } from './integration.public-types';
|
|
4
|
+
/**
|
|
5
|
+
* Event type emitted whenever an agent's connection to an integration is created, changed or removed:
|
|
6
|
+
* connecting a connector in Agent Studio, editing its settings, or disconnecting it, through the console
|
|
7
|
+
* or the SDK. Subscribe with `@eventHandler(AI_AGENT_CONNECTION_EVENT_TYPE)`; the payload is an
|
|
8
|
+
* {@link AiAgentConnectionEvent}.
|
|
9
|
+
* @category AI
|
|
10
|
+
*/
|
|
11
|
+
export declare const AI_AGENT_CONNECTION_EVENT_TYPE = "ai-agent-connection-event";
|
|
12
|
+
/**
|
|
13
|
+
* What happened to the connection.
|
|
14
|
+
* @category AI
|
|
15
|
+
*/
|
|
16
|
+
export type AiAgentConnectionChange = 'created' | 'changed' | 'deleted';
|
|
17
|
+
/**
|
|
18
|
+
* The payload broadcast on {@link AI_AGENT_CONNECTION_EVENT_TYPE}.
|
|
19
|
+
* @category AI
|
|
20
|
+
*/
|
|
21
|
+
export interface AiAgentConnectionEvent {
|
|
22
|
+
/** The agent whose connection changed. */
|
|
23
|
+
agentId: AiAgentId;
|
|
24
|
+
/** The integration the connection points at. */
|
|
25
|
+
integrationId: IntegrationId;
|
|
26
|
+
/** Type of that integration. */
|
|
27
|
+
integrationType: IntegrationType;
|
|
28
|
+
/** Whether the connection was created, changed or deleted. */
|
|
29
|
+
change: AiAgentConnectionChange;
|
|
30
|
+
/** The connection after the change; absent when it was removed. */
|
|
31
|
+
connection?: AiConnectedIntegrationMetadata;
|
|
32
|
+
/** The connection before the change; absent when it was created. */
|
|
33
|
+
previousConnection?: AiConnectedIntegrationMetadata;
|
|
34
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
-
import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, CanonicalReasoningEffort, GeminiChatModelName, GrokChatModelName, ModelIdSpec, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat, OpenAiImageModelName } from './ai-common.public-types';
|
|
2
|
+
import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, CanonicalReasoningEffort, EmbeddingModelIdSpec, GeminiChatModelName, GrokChatModelName, ModelIdSpec, OpenAiAudioCreateSpeechModelName, OpenAiAudioTranscriptionModelName, OpenAiChatModelName, OpenAiCreateSpeechFormat, OpenAiImageModelName } from './ai-common.public-types';
|
|
3
3
|
import { AiContextMetadata, AiContextMetadataFilter, AiKnowledgeBaseContextType, AiRagType } from './ai-knowledge-base.public-types';
|
|
4
4
|
import { AiFunctionId, AiFunctionIdWithContext, UserAiChatModelName } from './backend.public-types';
|
|
5
5
|
import { AiAgentId, AiContextId, AiKnowledgeBaseId, AppId, IntegrationId } from './communication.public-types';
|
|
@@ -883,6 +883,12 @@ export declare const AGENT_STATUS_TITLE_ACCESSING_KB = "Accessing Knowledge Base
|
|
|
883
883
|
* @category AI
|
|
884
884
|
*/
|
|
885
885
|
export declare const AGENT_STATUS_TITLE_CALLING_AI_FUNCTION = "Calling AI Function";
|
|
886
|
+
/**
|
|
887
|
+
* Status update title broadcast when an AI function callable returns, carrying the function's raw
|
|
888
|
+
* result in the body. Nested under the matching {@link AGENT_STATUS_TITLE_CALLING_AI_FUNCTION} event.
|
|
889
|
+
* @category AI
|
|
890
|
+
*/
|
|
891
|
+
export declare const AGENT_STATUS_TITLE_AI_FUNCTION_RESULT = "AI Function Result";
|
|
886
892
|
/**
|
|
887
893
|
* Status update title broadcast when the agent invokes a knowledge-base metadata-inspection callable
|
|
888
894
|
* (the opt-in `enableMetadataInspection` tool). Distinct from {@link AGENT_STATUS_TITLE_ACCESSING_KB}
|
|
@@ -1236,7 +1242,10 @@ export type AiPiiOptions = {
|
|
|
1236
1242
|
entities?: Array<AiPiiEntityType>;
|
|
1237
1243
|
/** App-specific PII in plain language, e.g. `'internal case numbers like CASE-12345'`. */
|
|
1238
1244
|
customRules?: Array<string>;
|
|
1239
|
-
/**
|
|
1245
|
+
/**
|
|
1246
|
+
* Model performing the screening. Defaults to {@link DEFAULT_PII_CLASSIFIER_MODEL}. Each attempt is
|
|
1247
|
+
* bounded at a minute, so an override has to answer within it.
|
|
1248
|
+
*/
|
|
1240
1249
|
classifierModel?: AiChatModelSelection;
|
|
1241
1250
|
/** Literal values that never count as PII, e.g. a shared support address. */
|
|
1242
1251
|
allowList?: Array<string>;
|
|
@@ -1503,3 +1512,25 @@ export interface ListChatModelsResponse {
|
|
|
1503
1512
|
/** All chat models available to the application. */
|
|
1504
1513
|
models: Array<ModelIdSpec>;
|
|
1505
1514
|
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Request options for listing the embedding models a new knowledge base can be created on.
|
|
1517
|
+
* @category AI
|
|
1518
|
+
*/
|
|
1519
|
+
export interface ListEmbeddingModelsRequest {
|
|
1520
|
+
/**
|
|
1521
|
+
* When true, deprecated vendor models (those with `replacedBy`) are included.
|
|
1522
|
+
* Defaults to false (only active models are returned).
|
|
1523
|
+
*/
|
|
1524
|
+
includeDeprecated?: boolean;
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Response containing the embedding models a new knowledge base can be created on: Squid-provided
|
|
1528
|
+
* vendor models and the application's custom integration models. Exactly one entry carries `isDefault`.
|
|
1529
|
+
* Deprecated vendor models are included only when requested via `includeDeprecated` and are marked
|
|
1530
|
+
* with `replacedBy`; an existing knowledge base keeps its model regardless.
|
|
1531
|
+
* @category AI
|
|
1532
|
+
*/
|
|
1533
|
+
export interface ListEmbeddingModelsResponse {
|
|
1534
|
+
/** All embedding models available to the application. */
|
|
1535
|
+
models: Array<EmbeddingModelIdSpec>;
|
|
1536
|
+
}
|
|
@@ -259,6 +259,35 @@ export interface ModelIdSpec {
|
|
|
259
259
|
*/
|
|
260
260
|
source?: AiModelSource;
|
|
261
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* An embedding model a new knowledge base can be created on. `modelId` alone is not an identity: an
|
|
264
|
+
* integration can serve the same model name as a vendor, so `(modelId, integrationId)` is.
|
|
265
|
+
* @category AI
|
|
266
|
+
*/
|
|
267
|
+
export interface EmbeddingModelIdSpec {
|
|
268
|
+
/** The embedding model ID used for API calls. */
|
|
269
|
+
modelId: string;
|
|
270
|
+
/** The integration ID if this model comes from an integration. Undefined for Squid-provided models. */
|
|
271
|
+
integrationId?: string;
|
|
272
|
+
/** The embedding dimensions, present for integration-based models. */
|
|
273
|
+
dimensions?: number;
|
|
274
|
+
/** Human-readable display name for the model. */
|
|
275
|
+
displayName: string;
|
|
276
|
+
/** Where the model comes from: 'vendor' (Squid-provided) or 'connector' (an integration configured on the app). */
|
|
277
|
+
source: AiModelSource;
|
|
278
|
+
/**
|
|
279
|
+
* Set only on a deprecated vendor model, which is listed on request: the model a new knowledge base
|
|
280
|
+
* asking for this one is created on. Undefined for active models.
|
|
281
|
+
*/
|
|
282
|
+
replacedBy?: AiEmbeddingsModelName;
|
|
283
|
+
/** True on exactly one entry of a non-empty list: the model to create on when the caller has no preference. */
|
|
284
|
+
isDefault?: boolean;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The `embeddingModel` a knowledge base is created with for a listed model.
|
|
288
|
+
* @category AI
|
|
289
|
+
*/
|
|
290
|
+
export declare function embeddingModelSelectionOf(model: EmbeddingModelIdSpec): AiEmbeddingsModelSelection;
|
|
262
291
|
/**
|
|
263
292
|
* Type guard to check if a model selection is integration-based.
|
|
264
293
|
* @category AI
|
|
@@ -222,10 +222,18 @@ export interface AiKnowledgeBaseGraphConfig {
|
|
|
222
222
|
entityTypes?: string[];
|
|
223
223
|
/**
|
|
224
224
|
* Quiet window (milliseconds) after the last graph activity before the sweep auto-builds the
|
|
225
|
-
* structure. Must be a positive integer
|
|
226
|
-
* cadence (1 minute) bounds how
|
|
225
|
+
* structure. Must be a positive integer, and is floored at 3 seconds — a shorter window is not
|
|
226
|
+
* servable. Defaults to the server's window (5 minutes); the sweep cadence (1 minute) bounds how
|
|
227
|
+
* promptly an elapsed window is picked up.
|
|
227
228
|
*/
|
|
228
229
|
autoBuildDebounceMs?: number;
|
|
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.
|
|
235
|
+
*/
|
|
236
|
+
autoBuildPaused?: boolean;
|
|
229
237
|
/** Concept-layer (facet taxonomy) configuration. Omitted ⇒ `facets: 'auto'`. */
|
|
230
238
|
concepts?: AiKnowledgeBaseGraphConceptsConfig;
|
|
231
239
|
}
|
|
@@ -479,7 +487,8 @@ export interface AiKnowledgeBaseContext {
|
|
|
479
487
|
metadata: AiContextMetadata;
|
|
480
488
|
/**
|
|
481
489
|
* Names of metadata fields whose stored values were machine-extracted from the content
|
|
482
|
-
* (driven by the knowledge base's `metadataFields` schema
|
|
490
|
+
* (driven by the knowledge base's `metadataFields` schema, plus the reserved `lastModified` key
|
|
491
|
+
* every knowledge base derives from the document container) rather than user-supplied.
|
|
483
492
|
* On re-upsert/replay, extracted values count as not-supplied (re-extracted fresh) while
|
|
484
493
|
* user-supplied values are preserved; consumers can also use this to caveat extracted values.
|
|
485
494
|
*/
|
|
@@ -650,26 +659,6 @@ export declare const BULK_INGESTION_MAX_MULTIPART_FILE_BYTES: number;
|
|
|
650
659
|
* @category AI
|
|
651
660
|
*/
|
|
652
661
|
export declare const MAX_UPLOAD_FILE_BYTES: number;
|
|
653
|
-
/**
|
|
654
|
-
* Embedding models the bulk-ingestion (batch embeddings) lane admits. A model needs a provider batch
|
|
655
|
-
* adapter to be listed here, but an adapter alone is not enough: a route is listed only once every core
|
|
656
|
-
* pod can take it, because a pod on an older image routes a job it cannot place to the wrong provider.
|
|
657
|
-
* This list IS that switch — adding a model here opens its route everywhere at once.
|
|
658
|
-
*
|
|
659
|
-
* Public and shared deliberately: `bulkUpsertContexts` answers a batch-transport job on any other model
|
|
660
|
-
* with a 501, but `createBulkUploadUrls` resolves no base at all, so a caller that stages before it upserts
|
|
661
|
-
* learns of the refusal only once the bytes are already uploaded. A caller that knows this bound can check
|
|
662
|
-
* the base up front and refuse the request instead — which only works while this list says what the
|
|
663
|
-
* deployment will really take. A base on an unlisted model keeps ingesting on the sync transport.
|
|
664
|
-
* @category AI
|
|
665
|
-
*/
|
|
666
|
-
export declare const BULK_INGESTION_EMBEDDING_MODELS: readonly ["text-embedding-3-small", "voyage-3-large", "voyage-4-large", "voyage-4"];
|
|
667
|
-
/**
|
|
668
|
-
* Whether `model` is one of {@link BULK_INGESTION_EMBEDDING_MODELS}. Takes any embedding model selection
|
|
669
|
-
* (an integration-backed model spec is an object and is never supported).
|
|
670
|
-
* @category AI
|
|
671
|
-
*/
|
|
672
|
-
export declare function isBulkIngestionEmbeddingModel(model: unknown): model is (typeof BULK_INGESTION_EMBEDDING_MODELS)[number];
|
|
673
662
|
/**
|
|
674
663
|
* @category AI
|
|
675
664
|
*/
|
|
@@ -1180,8 +1169,10 @@ export interface GetKnowledgeBaseGraphStatusRequest {
|
|
|
1180
1169
|
export interface GetKnowledgeBaseGraphStatusResponse {
|
|
1181
1170
|
/** Whether GraphRAG is enabled on the KB. */
|
|
1182
1171
|
enabled: boolean;
|
|
1183
|
-
/** Number of entities in the KB's graph partition. */
|
|
1172
|
+
/** Number of live entities in the KB's graph partition (quarantined ones excluded). */
|
|
1184
1173
|
entityCount: number;
|
|
1174
|
+
/** Entities hidden by a dead-weight quarantine run; absent when the KB's graph store cannot quarantine. */
|
|
1175
|
+
quarantinedEntityCount?: number;
|
|
1185
1176
|
/** Number of outgoing relationships (mirrors excluded). */
|
|
1186
1177
|
relationshipCount: number;
|
|
1187
1178
|
/** Number of communities detected (Phase 3), 0 when none. */
|
|
@@ -1217,8 +1208,18 @@ export interface GetKnowledgeBaseGraphStatusResponse {
|
|
|
1217
1208
|
buildJob?: KnowledgeBaseGraphBuildJob;
|
|
1218
1209
|
/** Lifetime LLM usage of incremental graph ingestion (per-upsert extraction), when any was recorded. */
|
|
1219
1210
|
ingestUsage?: KnowledgeBaseGraphUsage;
|
|
1220
|
-
/**
|
|
1211
|
+
/**
|
|
1212
|
+
* LLM usage of the most recent COMPLETED `rebuildGraph` run (including its re-extraction), when one
|
|
1213
|
+
* ran. A build in flight leaves it on the previous build until it completes — read
|
|
1214
|
+
* {@link buildUsageHistory} for the in-flight run.
|
|
1215
|
+
*/
|
|
1221
1216
|
lastRebuildUsage?: KnowledgeBaseGraphUsage;
|
|
1217
|
+
/**
|
|
1218
|
+
* Per-build LLM usage of the KB's most recent `rebuildGraph` runs, newest first, bounded to the last
|
|
1219
|
+
* 50 builds. Unlike {@link lastRebuildUsage} no build erases another's record, so back-to-back builds
|
|
1220
|
+
* are all accounted for.
|
|
1221
|
+
*/
|
|
1222
|
+
buildUsageHistory?: Array<KnowledgeBaseGraphBuildUsage>;
|
|
1222
1223
|
/**
|
|
1223
1224
|
* Lifetime LLM usage of the combined contextual-blurb + graph-extraction call (run automatically for
|
|
1224
1225
|
* `ragType:'contextual'` graph-enabled KBs), when any was recorded. Covers BOTH the contextual blurb
|
|
@@ -1241,6 +1242,63 @@ export interface GetKnowledgeBaseGraphStatusResponse {
|
|
|
1241
1242
|
* capped contextId-closure fallback. Absent when GraphRAG is disabled.
|
|
1242
1243
|
*/
|
|
1243
1244
|
conceptScopeReady?: boolean;
|
|
1245
|
+
/** The incremental entity-resolution sweep's latest readings, present once a sweep has sampled the KB. */
|
|
1246
|
+
resolution?: KnowledgeBaseGraphResolutionStatus;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Readings the incremental entity-resolution sweep persists on a knowledge base: the dirty backlog it
|
|
1250
|
+
* drains across sweeps and the duplicate-name fragmentation it exists to merge.
|
|
1251
|
+
* @category AI
|
|
1252
|
+
*/
|
|
1253
|
+
export interface KnowledgeBaseGraphResolutionStatus {
|
|
1254
|
+
/** Entities rewritten since the sweep last examined them. */
|
|
1255
|
+
backlog: number;
|
|
1256
|
+
/** When `backlog` was sampled (epoch millis) — the start or end of a sweep. */
|
|
1257
|
+
backlogSampledAt: number;
|
|
1258
|
+
/** Entities sharing another entity's significant-name-token signature; absent until a sweep sampled it. */
|
|
1259
|
+
duplicateNames?: number;
|
|
1260
|
+
/** When `duplicateNames` was sampled (epoch millis). */
|
|
1261
|
+
duplicateNamesSampledAt?: number;
|
|
1262
|
+
/** The most recent sweep: the bounds it ran under and what it got through; absent until one has run. */
|
|
1263
|
+
lastSweep?: KnowledgeBaseGraphResolutionSweep;
|
|
1264
|
+
}
|
|
1265
|
+
/**
|
|
1266
|
+
* One incremental entity-resolution sweep's bounds and counters, as persisted at its start (counters
|
|
1267
|
+
* zero) and again at its end.
|
|
1268
|
+
* @category AI
|
|
1269
|
+
*/
|
|
1270
|
+
export interface KnowledgeBaseGraphResolutionSweep {
|
|
1271
|
+
/** Dirty entities one pass of the sweep examined at most. */
|
|
1272
|
+
dirtyBatch: number;
|
|
1273
|
+
/** Drain rounds the sweep ran at most. */
|
|
1274
|
+
maxRounds: number;
|
|
1275
|
+
/** Candidate pairs one drain round of the sweep adjudicated at most. */
|
|
1276
|
+
maxPairsPerRound: number;
|
|
1277
|
+
/** Resolution passes one drain round of the sweep ran at most. */
|
|
1278
|
+
maxPasses: number;
|
|
1279
|
+
/** Adjudication calls the sweep kept in flight. */
|
|
1280
|
+
adjudicationConcurrency: number;
|
|
1281
|
+
/** Dirty entities one pass of the sweep searched candidates for at once. */
|
|
1282
|
+
proposalConcurrency: number;
|
|
1283
|
+
/** Drain rounds the sweep ran. */
|
|
1284
|
+
rounds: number;
|
|
1285
|
+
/** Dirty entities the sweep examined. */
|
|
1286
|
+
examined: number;
|
|
1287
|
+
/** Candidate pairs the sweep sent to adjudication. */
|
|
1288
|
+
pairsAdjudicated: number;
|
|
1289
|
+
/** Candidate pairs adjudication confirmed as the same entity. */
|
|
1290
|
+
pairsConfirmed: number;
|
|
1291
|
+
/** Adjudication calls the sweep made; absent on a reading from a sweep that did not record calls. */
|
|
1292
|
+
adjudicationCalls?: number;
|
|
1293
|
+
/** Of those, calls the provider served the instruction prefix from its prompt cache; absent with them. */
|
|
1294
|
+
adjudicationCachedCalls?: number;
|
|
1295
|
+
/**
|
|
1296
|
+
* Index-visibility wait tokens the sweep spent: a count of waits, not a duration. Absent on a reading
|
|
1297
|
+
* from a sweep that did not record waits.
|
|
1298
|
+
*/
|
|
1299
|
+
visibilityWaits?: number;
|
|
1300
|
+
/** When this reading was written (epoch millis). */
|
|
1301
|
+
sampledAt: number;
|
|
1244
1302
|
}
|
|
1245
1303
|
/** The most recent graph backfill/rebuild job of a knowledge base. @category AI */
|
|
1246
1304
|
export interface KnowledgeBaseGraphBuildJob {
|
|
@@ -1251,6 +1309,46 @@ export interface KnowledgeBaseGraphBuildJob {
|
|
|
1251
1309
|
/** When the job was enqueued (epoch millis). */
|
|
1252
1310
|
startedAt?: number;
|
|
1253
1311
|
}
|
|
1312
|
+
/**
|
|
1313
|
+
* LLM usage of one graph build (`rebuildGraph` run), kept per build so a later build cannot erase it.
|
|
1314
|
+
* Accumulated across the run's execution attempts — a resumed rebuild adds to the same record.
|
|
1315
|
+
* @category AI
|
|
1316
|
+
*/
|
|
1317
|
+
export interface KnowledgeBaseGraphBuildUsage {
|
|
1318
|
+
/** Identity of the build, stable across its execution attempts. */
|
|
1319
|
+
buildId: string;
|
|
1320
|
+
/** The plan the build executed; `'resolution'` is the internal resolution-only continuation. */
|
|
1321
|
+
mode: KnowledgeBaseGraphRebuildMode | 'resolution';
|
|
1322
|
+
/** The build's lifecycle state. */
|
|
1323
|
+
status: 'in_progress' | 'completed' | 'failed';
|
|
1324
|
+
/** When the build started (epoch millis). */
|
|
1325
|
+
startedAt: number;
|
|
1326
|
+
/** When the build reached a terminal state (epoch millis); absent while it runs. */
|
|
1327
|
+
completedAt?: number;
|
|
1328
|
+
/** Contexts whose chunks the build re-extracted; `0` when it re-extracted nothing. */
|
|
1329
|
+
contextsReextracted: number;
|
|
1330
|
+
/** The build's total LLM usage, with its per-model split. */
|
|
1331
|
+
usage: KnowledgeBaseGraphUsage;
|
|
1332
|
+
/** The split of {@link usage} across the stages the build ran. */
|
|
1333
|
+
stages: KnowledgeBaseGraphBuildStageUsage;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* A graph build's LLM usage split by pipeline stage. A stage the build entered but spent nothing on
|
|
1337
|
+
* reads zero; a stage it never ran (skipped by its plan, or by a resume) is absent.
|
|
1338
|
+
* @category AI
|
|
1339
|
+
*/
|
|
1340
|
+
export interface KnowledgeBaseGraphBuildStageUsage {
|
|
1341
|
+
/** Entity/relationship re-extraction from the KB's chunks. */
|
|
1342
|
+
reextraction?: KnowledgeBaseGraphUsage;
|
|
1343
|
+
/** Entity resolution (duplicate-name adjudication and merges). */
|
|
1344
|
+
resolution?: KnowledgeBaseGraphUsage;
|
|
1345
|
+
/** The lexical mention backstop, which is deterministic and normally spends nothing. */
|
|
1346
|
+
backstop?: KnowledgeBaseGraphUsage;
|
|
1347
|
+
/** Topic clustering and topic summaries. */
|
|
1348
|
+
topics?: KnowledgeBaseGraphUsage;
|
|
1349
|
+
/** Facet tree construction. */
|
|
1350
|
+
facets?: KnowledgeBaseGraphUsage;
|
|
1351
|
+
}
|
|
1254
1352
|
/**
|
|
1255
1353
|
* Aggregated LLM token usage (and best-effort cost) of graph work on a KB. Token counts are the
|
|
1256
1354
|
* provider-reported ground truth; `estCostUsd` is estimated from model list prices at call time —
|
|
@@ -1351,6 +1449,13 @@ export interface RebuildKnowledgeBaseGraphRequest {
|
|
|
1351
1449
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
1352
1450
|
/** What to recompute (see {@link KnowledgeBaseGraphRebuildMode}). Default `'structural'`. */
|
|
1353
1451
|
mode?: KnowledgeBaseGraphRebuildMode;
|
|
1452
|
+
/**
|
|
1453
|
+
* When true, starts the rebuild even while a bulk-ingestion job on the KB is still active. Off by
|
|
1454
|
+
* default: such a rebuild is refused (`GRAPH_REBUILD_BLOCKED_BY_BULK_JOB`) because it re-extracts the
|
|
1455
|
+
* contexts the job is still merging. Set it for a job that is wedged (its pod died and its deadline
|
|
1456
|
+
* has not passed) when cancelling the job is not an option.
|
|
1457
|
+
*/
|
|
1458
|
+
ignoreActiveBulkJobs?: boolean;
|
|
1354
1459
|
}
|
|
1355
1460
|
/**
|
|
1356
1461
|
* Request structure for exploring a bounded subgraph of a knowledge base's graph (Phase 3 visualization).
|
|
@@ -1665,7 +1770,34 @@ export interface BulkIngestionUpsertContextsRequest {
|
|
|
1665
1770
|
knowledgeBaseId: string;
|
|
1666
1771
|
/** The contexts to stage; each becomes one bulk-ingestion file. */
|
|
1667
1772
|
contexts: Array<BulkIngestionContext>;
|
|
1773
|
+
/**
|
|
1774
|
+
* How quickly this job must finish. A hint, not a command: Squid honours it where the job's models and
|
|
1775
|
+
* its share of the ingestion pool allow, and otherwise runs the job the way it can. Read
|
|
1776
|
+
* {@link BulkIngestionJobStatusResponse.transport} to see what it actually ran as.
|
|
1777
|
+
*/
|
|
1778
|
+
speed?: BulkIngestionSpeed;
|
|
1668
1779
|
}
|
|
1780
|
+
/**
|
|
1781
|
+
* The optional half of a bulk-ingestion staging call.
|
|
1782
|
+
* @category AI
|
|
1783
|
+
*/
|
|
1784
|
+
export interface BulkIngestionUpsertContextsOptions {
|
|
1785
|
+
/** See {@link BulkIngestionUpsertContextsRequest.speed}. */
|
|
1786
|
+
speed?: BulkIngestionSpeed;
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* How quickly a bulk-ingestion job must finish, and so which provider tier Squid buys for it. The model,
|
|
1790
|
+
* the prompts and the resulting chunks are identical at every speed — only the queue in front of them
|
|
1791
|
+
* differs.
|
|
1792
|
+
*
|
|
1793
|
+
* - `economy` — provider batch, cheapest, tails up to 24 hours.
|
|
1794
|
+
* - `auto` — Squid decides from the job's size. The default.
|
|
1795
|
+
* - `fast` — runs inline, minutes rather than hours, at full list price.
|
|
1796
|
+
* @category AI
|
|
1797
|
+
*/
|
|
1798
|
+
export declare const BULK_INGESTION_SPEEDS: readonly ["economy", "auto", "fast"];
|
|
1799
|
+
/** See {@link BULK_INGESTION_SPEEDS}. */
|
|
1800
|
+
export type BulkIngestionSpeed = (typeof BULK_INGESTION_SPEEDS)[number];
|
|
1669
1801
|
/**
|
|
1670
1802
|
* Response for a staged bulk-ingestion request.
|
|
1671
1803
|
* @category AI
|
|
@@ -1734,11 +1866,21 @@ export interface BulkIngestionFileStatus {
|
|
|
1734
1866
|
errorMessage?: string;
|
|
1735
1867
|
/**
|
|
1736
1868
|
* Machine-readable class of a failed file, for outcomes to treat differently from real failures.
|
|
1737
|
-
*
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1869
|
+
* 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'`.
|
|
1872
|
+
* `'DUPLICATE_CONTENT'` is a skip rather than a failure: the KB already holds this content.
|
|
1873
|
+
* `'EXTRACTION_TIMED_OUT'` stays retryable — the deadline is contended, so a borderline document can
|
|
1874
|
+
* cross it under load. `'JOB_FULL'`: the job's request ceiling had no room left for this file, so re-submit it
|
|
1875
|
+
* in a fresh job; a file that alone exceeds the ceiling fails this way in every job. Additive; absent for
|
|
1876
|
+
* ordinary failures.
|
|
1877
|
+
*/
|
|
1878
|
+
errorCode?: 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'JOB_FULL' | 'NO_EMBEDDABLE_CONTENT' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'UNSUPPORTED_FILE_TYPE';
|
|
1879
|
+
/**
|
|
1880
|
+
* Present only on a failed file: the same bytes fail the same way, so a caller must park the file
|
|
1881
|
+
* instead of re-submitting it. Absence means retryable.
|
|
1740
1882
|
*/
|
|
1741
|
-
|
|
1883
|
+
retryable?: false;
|
|
1742
1884
|
/**
|
|
1743
1885
|
* First images (capped) the context lacks a description for because describing them failed; a
|
|
1744
1886
|
* `completed` file is otherwise fully ingested. Absent when every image succeeded.
|
|
@@ -1747,6 +1889,20 @@ export interface BulkIngestionFileStatus {
|
|
|
1747
1889
|
/** Total number of failed images, which exceeds `imageFailures.length` when the list was capped. */
|
|
1748
1890
|
imageFailureCount?: number;
|
|
1749
1891
|
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Why a whole bulk-ingestion staging call was refused, on the `details` of its 400 response. The
|
|
1894
|
+
* refusal names the one context that caused it, so a caller recording per-file outcomes charges only
|
|
1895
|
+
* that file.
|
|
1896
|
+
* @category AI
|
|
1897
|
+
*/
|
|
1898
|
+
export interface BulkIngestionStagingRefusal {
|
|
1899
|
+
/** The staged object exceeds the per-file source ceiling. */
|
|
1900
|
+
errorCode: 'STAGED_OBJECT_TOO_LARGE';
|
|
1901
|
+
/** The same bytes are refused the same way, so the named file must be parked rather than re-staged. */
|
|
1902
|
+
retryable: false;
|
|
1903
|
+
/** The context whose file caused the refusal. */
|
|
1904
|
+
contextId: string;
|
|
1905
|
+
}
|
|
1750
1906
|
/**
|
|
1751
1907
|
* One provider batch created for a bulk-ingestion job, so a caller can tell a job waiting on a
|
|
1752
1908
|
* submitted provider batch (healthy — the designed cost/latency tradeoff of the batch lane, with
|
|
@@ -1774,6 +1930,99 @@ export interface BulkIngestionProviderBatchStatus {
|
|
|
1774
1930
|
* stopped, not that the batch is waiting. Read wait duration off {@link createdAt}.
|
|
1775
1931
|
*/
|
|
1776
1932
|
updatedAt: Date;
|
|
1933
|
+
/** The lanes of the requests the batch carries; empty when a batch of an older core cannot tell. */
|
|
1934
|
+
lanes?: Array<BulkIngestionRequestLane>;
|
|
1935
|
+
/**
|
|
1936
|
+
* The provider's status at the newest poll, as the adapter reports it: provider-raw for OpenAI, normalized
|
|
1937
|
+
* (`in_progress`, `completed`, …) for Anthropic and Mistral.
|
|
1938
|
+
*/
|
|
1939
|
+
providerStatus?: string;
|
|
1940
|
+
/** When a poll first saw {@link providerStatus}. */
|
|
1941
|
+
providerStatusChangedAt?: Date;
|
|
1942
|
+
/** When the provider started running the batch; absent while it has not. */
|
|
1943
|
+
providerInProgressAt?: Date;
|
|
1944
|
+
/** Per-request progress at the newest poll; absent for a provider that does not report it. */
|
|
1945
|
+
requestCounts?: BulkIngestionProviderBatchRequestCounts;
|
|
1946
|
+
/** When the poll that read {@link requestCounts} ran. */
|
|
1947
|
+
requestCountsAt?: Date;
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* The lane a bulk-ingestion request belongs to; core's `BulkIngestionLane` is this type.
|
|
1951
|
+
* @category AI
|
|
1952
|
+
*/
|
|
1953
|
+
export type BulkIngestionRequestLane = 'embeddings' | 'imageDescription' | 'spreadsheetSummary' | 'metadataExtraction' | 'chunkContext' | 'documentOcr';
|
|
1954
|
+
/**
|
|
1955
|
+
* A provider batch's per-request progress as the provider reports it.
|
|
1956
|
+
* @category AI
|
|
1957
|
+
*/
|
|
1958
|
+
export interface BulkIngestionProviderBatchRequestCounts {
|
|
1959
|
+
/** Requests in the batch. */
|
|
1960
|
+
total: number;
|
|
1961
|
+
/**
|
|
1962
|
+
* Requests the provider ran to a result, succeeded or failed. Requests it reports as cancelled or expired unrun are
|
|
1963
|
+
* left out, so `total − completed` is not the count still in flight.
|
|
1964
|
+
*/
|
|
1965
|
+
completed: number;
|
|
1966
|
+
/** Of {@link completed}, the ones that failed, when the provider reports that breakdown. */
|
|
1967
|
+
failed?: number;
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Provider-side progress of one job's batches on one provider route (provider, endpoint and model). A route
|
|
1971
|
+
* is the unit the provider queues, and one batch can carry several lanes, so progress is reported per route.
|
|
1972
|
+
* @category AI
|
|
1973
|
+
*/
|
|
1974
|
+
export interface BulkIngestionProviderRouteThroughput {
|
|
1975
|
+
/** The provider running the route's batches. */
|
|
1976
|
+
provider: BulkIngestionProviderBatchStatus['provider'];
|
|
1977
|
+
/** The provider API the route's batches ride. */
|
|
1978
|
+
endpoint: BulkIngestionProviderBatchStatus['endpoint'];
|
|
1979
|
+
/** The model the route's batches run on. */
|
|
1980
|
+
model: string;
|
|
1981
|
+
/** The lanes the route's batches carry. */
|
|
1982
|
+
lanes: Array<BulkIngestionRequestLane>;
|
|
1983
|
+
/** The route's batches created or submitted and not yet ended at the provider. */
|
|
1984
|
+
batchesInFlight: number;
|
|
1985
|
+
/** Requests in those batches the provider has not settled yet. */
|
|
1986
|
+
requestsInFlight: number;
|
|
1987
|
+
/** Requests the provider ran to a result, succeeded or failed, across the route's batches. */
|
|
1988
|
+
requestsCompleted: number;
|
|
1989
|
+
/** Of {@link requestsCompleted}, the ones that failed; absent when no batch reports that breakdown. */
|
|
1990
|
+
requestsFailed?: number;
|
|
1991
|
+
/**
|
|
1992
|
+
* Requests the provider completed per minute over the last {@link BulkIngestionProviderThroughput.windowMinutes};
|
|
1993
|
+
* absent when no batch of the route reports counts.
|
|
1994
|
+
*/
|
|
1995
|
+
completedPerMinute?: number;
|
|
1996
|
+
/**
|
|
1997
|
+
* The oldest view of an in-flight batch: when its counts were read, else when its status last was, else when it
|
|
1998
|
+
* was created. Older than a few minutes means polls lag or return no counts, not that the provider stalled:
|
|
1999
|
+
* {@link completedPerMinute} then misses what the provider did since.
|
|
2000
|
+
*/
|
|
2001
|
+
countsObservedAt?: Date;
|
|
2002
|
+
}
|
|
2003
|
+
/**
|
|
2004
|
+
* One in-flight provider-batch budget of the app on the shared system credential.
|
|
2005
|
+
* @category AI
|
|
2006
|
+
*/
|
|
2007
|
+
export interface BulkIngestionInFlightBatchBudget {
|
|
2008
|
+
/** The lanes whose batches the budget gates. */
|
|
2009
|
+
lanes: Array<BulkIngestionRequestLane>;
|
|
2010
|
+
/** Batches of the WHOLE app holding the budget: another job of the app holds slots too. */
|
|
2011
|
+
inFlight: number;
|
|
2012
|
+
/** How many batches the budget admits right now; a lane whose budget is full waits for a slot. */
|
|
2013
|
+
limit: number;
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Whether a running job's provider batches are draining: per-route progress and the app's in-flight budgets.
|
|
2017
|
+
* @category AI
|
|
2018
|
+
*/
|
|
2019
|
+
export interface BulkIngestionProviderThroughput {
|
|
2020
|
+
/** The span, in minutes, the per-route completion rates cover. */
|
|
2021
|
+
windowMinutes: number;
|
|
2022
|
+
/** Progress per provider route the job has batches on. */
|
|
2023
|
+
routes: Array<BulkIngestionProviderRouteThroughput>;
|
|
2024
|
+
/** The app's in-flight budgets; absent when the job's batches run on the app's own provider key, which is not capped. */
|
|
2025
|
+
inFlightBatchBudgets?: Array<BulkIngestionInFlightBatchBudget>;
|
|
1777
2026
|
}
|
|
1778
2027
|
/**
|
|
1779
2028
|
* Response describing a bulk-ingestion job's current state and progress counts.
|
|
@@ -1831,6 +2080,12 @@ export interface BulkIngestionJobStatusResponse {
|
|
|
1831
2080
|
* the wire: consumers must tolerate its absence.
|
|
1832
2081
|
*/
|
|
1833
2082
|
phase?: 'extracting' | 'awaiting-provider-batch' | 'indexing';
|
|
2083
|
+
/**
|
|
2084
|
+
* Provider-side progress of the job's batches, so a saturated in-flight budget the provider is draining
|
|
2085
|
+
* reads differently from one it completes nothing in. Present only while a `'batch'` job is `running`.
|
|
2086
|
+
* Optional on the wire: consumers must tolerate its absence.
|
|
2087
|
+
*/
|
|
2088
|
+
providerThroughput?: BulkIngestionProviderThroughput;
|
|
1834
2089
|
/** Per-file status, one entry per staged context (bounded by the job's file cap). */
|
|
1835
2090
|
files: Array<BulkIngestionFileStatus>;
|
|
1836
2091
|
}
|