@squidcloud/client 1.0.497 → 1.0.499
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/metric-name.d.ts +1 -10
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +53 -3
- package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +3 -3
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +178 -17
- package/dist/internal-common/src/public-types/langgraph.public-types.d.ts +17 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +4 -3
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +24 -3
- package/dist/internal-common/src/types/headers.types.d.ts +0 -13
- package/dist/internal-common/src/types/observability.types.d.ts +55 -2
- package/dist/internal-common/src/utils/object.d.ts +5 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +1 -4
- package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +5 -5
- package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +12 -4
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +15 -1
- package/dist/typescript-client/src/langgraph-client.d.ts +7 -13
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,4 @@
|
|
|
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
|
-
*/
|
|
1
|
+
/** Names of the Squid metrics; dashboards and metric queries key on these exact strings. */
|
|
11
2
|
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
3
|
export type MetricName = (typeof ALL_SQUID_METRIC_NAMES)[number];
|
|
13
4
|
/** Common prefix for all Squid metrics. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONSchema } from 'json-schema-typed';
|
|
2
|
-
import { AiAudioCreateSpeechModelName, AiAudioTranscriptionModelName, AiChatModelName, AiImageModelName, AiProviderType, AiRerankProvider, AnthropicChatModelName, CanonicalReasoningEffort, EmbeddingModelIdSpec, 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, VendorAiChatModelName } 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';
|
|
@@ -420,6 +420,54 @@ export interface IntegrationModelSpec {
|
|
|
420
420
|
* @category AI
|
|
421
421
|
*/
|
|
422
422
|
export type AiChatModelSelection = AiChatModelName | IntegrationModelSpec;
|
|
423
|
+
/**
|
|
424
|
+
* Lets a routing model pick which of several vendor models answers an `ask` or `chat` request. The routing model
|
|
425
|
+
* sees the question, the agent's instructions and a card per candidate (price, tier, reasoning,
|
|
426
|
+
* context window) and names the one that should answer; that model then serves the request.
|
|
427
|
+
* @category AI
|
|
428
|
+
*/
|
|
429
|
+
export interface AiModelRoutingOptions {
|
|
430
|
+
/** The vendor models the routing model chooses from; at least two, no duplicates. */
|
|
431
|
+
models: VendorAiChatModelName[];
|
|
432
|
+
/** The vendor model that makes the choice. */
|
|
433
|
+
routingModel: VendorAiChatModelName;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* The model of an `ask` or `chat` request: a concrete model, or a set of models a routing model chooses from.
|
|
437
|
+
* @category AI
|
|
438
|
+
*/
|
|
439
|
+
export type AiAskModelSelection = AiChatModelSelection | AiModelRoutingOptions;
|
|
440
|
+
/**
|
|
441
|
+
* What a `chat` job resolves to once its stream has ended; read it with `squid.jobs().awaitJob(jobId)`.
|
|
442
|
+
* @category AI
|
|
443
|
+
*/
|
|
444
|
+
export interface AiChatJobResult {
|
|
445
|
+
/** Set when `model` was an {@link AiModelRoutingOptions}: which model answered and what routing cost. */
|
|
446
|
+
routing?: AiModelRoutingResult;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Chat options as a request carries them: the model may also be a routing choice between several models.
|
|
450
|
+
* @category AI
|
|
451
|
+
*/
|
|
452
|
+
export type AiChatRequestOptions = Omit<AllAiAgentChatOptions, 'model'> & {
|
|
453
|
+
model?: AiAskModelSelection;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* How a request whose `model` was an {@link AiModelRoutingOptions} was routed.
|
|
457
|
+
* @category AI
|
|
458
|
+
*/
|
|
459
|
+
export interface AiModelRoutingResult {
|
|
460
|
+
/** The model the routing model chose and the request was sent to. A `backupModel` may still have served it. */
|
|
461
|
+
model: VendorAiChatModelName;
|
|
462
|
+
/** The model that made the choice. */
|
|
463
|
+
routingModel: VendorAiChatModelName;
|
|
464
|
+
/** Input tokens the routing call consumed. */
|
|
465
|
+
inputTokens: number;
|
|
466
|
+
/** Output tokens the routing call generated. */
|
|
467
|
+
outputTokens: number;
|
|
468
|
+
/** Best-effort USD cost of the routing call; undefined when the routing model is unpriced. */
|
|
469
|
+
costUsd?: number;
|
|
470
|
+
}
|
|
423
471
|
/**
|
|
424
472
|
* A backup model together with the sampling settings to run it with. Use this form instead of a
|
|
425
473
|
* bare {@link AiChatModelSelection} when the backup needs settings of its own; anything left unset
|
|
@@ -750,7 +798,7 @@ export type AiVerbosityLevel = 'low' | 'medium' | 'high';
|
|
|
750
798
|
* **Example:**
|
|
751
799
|
* ```typescript
|
|
752
800
|
* {
|
|
753
|
-
* model: 'claude-sonnet-5',
|
|
801
|
+
* model: 'claude-sonnet-5-5',
|
|
754
802
|
* responseFormat: {
|
|
755
803
|
* type: 'json_schema',
|
|
756
804
|
* schema: {
|
|
@@ -1244,7 +1292,7 @@ export type AiPiiEntityType = 'email' | 'phoneNumber' | 'creditCard' | 'ssn' | '
|
|
|
1244
1292
|
/** Entity kinds screened when {@link AiPiiOptions.entities} is omitted. */
|
|
1245
1293
|
export declare const DEFAULT_PII_ENTITY_TYPES: ReadonlyArray<AiPiiEntityType>;
|
|
1246
1294
|
/** Model that screens prompts unless overridden. Small and fast: it runs on every prompt. */
|
|
1247
|
-
export declare const DEFAULT_PII_CLASSIFIER_MODEL = "gpt-
|
|
1295
|
+
export declare const DEFAULT_PII_CLASSIFIER_MODEL = "gpt-6-luna";
|
|
1248
1296
|
/**
|
|
1249
1297
|
* Rejects a prompt before it reaches the agent's model when it carries PII, so the prompt is never
|
|
1250
1298
|
* sent to the model provider, never answered, and never written to chat memory.
|
|
@@ -1401,6 +1449,8 @@ export interface AiAskResponse {
|
|
|
1401
1449
|
responseString: string;
|
|
1402
1450
|
/** Optional annotations (e.g., file references) in the response */
|
|
1403
1451
|
annotations?: Record<string, AiAnnotation>;
|
|
1452
|
+
/** Set when `model` was an {@link AiModelRoutingOptions}: which model answered and what routing cost. */
|
|
1453
|
+
routing?: AiModelRoutingResult;
|
|
1404
1454
|
}
|
|
1405
1455
|
/**
|
|
1406
1456
|
* API request to create speech from text
|
|
@@ -46,7 +46,7 @@ export declare const AI_CODE_INTERPRETER_PROVIDER_TYPES: readonly ["openai", "an
|
|
|
46
46
|
* Public OpenAI chat model names (active models only).
|
|
47
47
|
* @category AI
|
|
48
48
|
*/
|
|
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-
|
|
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-luna", "gpt-6.1-sol"];
|
|
50
50
|
/**
|
|
51
51
|
* Public Gemini chat model names (active models only).
|
|
52
52
|
* @category AI
|
|
@@ -61,12 +61,12 @@ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.6", "grok-4-1-fast
|
|
|
61
61
|
* Public Anthropic chat model names (active models only).
|
|
62
62
|
* @category AI
|
|
63
63
|
*/
|
|
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"];
|
|
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-5"];
|
|
65
65
|
/**
|
|
66
66
|
* The supported AI model names.
|
|
67
67
|
* @category AI
|
|
68
68
|
*/
|
|
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-
|
|
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-luna", "gpt-6.1-sol", "claude-fable-5", "claude-fable-5-1", "claude-haiku-4-5-20251001", "claude-opus-5-5", "claude-sonnet-5-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"];
|
|
70
70
|
/** Checks if the given model name is a global AI chat model name. */
|
|
71
71
|
export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName;
|
|
72
72
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiChatModelSelection, AiReasoningEffort, ContextImageFailure, UpsertContextStatusError } from './ai-agent.public-types';
|
|
1
|
+
import { AiChatModelSelection, AiReasoningEffort, ContextImageFailure, UpsertContextErrorCode, 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';
|
|
@@ -943,9 +943,11 @@ export interface AiKnowledgeBaseGrepMatch {
|
|
|
943
943
|
* content was never searchable.
|
|
944
944
|
* - `coverageUnknown` — the scan itself succeeded, but how much of the scope holds stored text could not
|
|
945
945
|
* be determined, so completeness cannot be asserted either way.
|
|
946
|
+
* - `patternTooBroad` — the pattern may occur in too many places to check them all within the time limit,
|
|
947
|
+
* so only some were searched. Narrow with `metadataFilter` or use a longer, more distinctive pattern.
|
|
946
948
|
* @category AI
|
|
947
949
|
*/
|
|
948
|
-
export type GrepScanLimitation = 'timedOut' | 'noIndexedText' | 'filterMatchedNoContexts' | 'scopeTruncated' | 'partsCapReached' | 'partialCoverage' | 'truncatedContent' | 'coverageUnknown';
|
|
950
|
+
export type GrepScanLimitation = 'timedOut' | 'noIndexedText' | 'filterMatchedNoContexts' | 'scopeTruncated' | 'partsCapReached' | 'partialCoverage' | 'truncatedContent' | 'coverageUnknown' | 'patternTooBroad';
|
|
949
951
|
/**
|
|
950
952
|
* Response structure for a literal scan over a knowledge base's raw extracted text.
|
|
951
953
|
* @category AI
|
|
@@ -1271,6 +1273,21 @@ export interface GetKnowledgeBaseGraphStatusResponse {
|
|
|
1271
1273
|
conceptScopeReady?: boolean;
|
|
1272
1274
|
/** The incremental entity-resolution sweep's latest readings, present once a sweep has sampled the KB. */
|
|
1273
1275
|
resolution?: KnowledgeBaseGraphResolutionStatus;
|
|
1276
|
+
/** Scheduled structural build slots skipped because the build could not start in time, newest last. */
|
|
1277
|
+
structuralBuildSkips?: Array<KnowledgeBaseGraphStructuralBuildSkip>;
|
|
1278
|
+
/** A manual `rebuildGraph` request waiting for the running entity-resolution build to finish. */
|
|
1279
|
+
queuedRebuild?: KnowledgeBaseGraphQueuedRebuild;
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* A manual graph rebuild requested while an entity-resolution build ran. It starts once that build ends,
|
|
1283
|
+
* regardless of the structural build schedule.
|
|
1284
|
+
* @category AI
|
|
1285
|
+
*/
|
|
1286
|
+
export interface KnowledgeBaseGraphQueuedRebuild {
|
|
1287
|
+
/** The requested rebuild mode; a `'full'` request absorbs a `'structural'` one queued with it. */
|
|
1288
|
+
mode: KnowledgeBaseGraphRebuildMode;
|
|
1289
|
+
/** When the latest request was queued (epoch millis). */
|
|
1290
|
+
requestedAt: number;
|
|
1274
1291
|
}
|
|
1275
1292
|
/**
|
|
1276
1293
|
* Readings the incremental entity-resolution sweep persists on a knowledge base: the dirty backlog it
|
|
@@ -1358,7 +1375,58 @@ export interface KnowledgeBaseGraphBuildUsage {
|
|
|
1358
1375
|
usage: KnowledgeBaseGraphUsage;
|
|
1359
1376
|
/** The split of {@link usage} across the stages the build ran. */
|
|
1360
1377
|
stages: KnowledgeBaseGraphBuildStageUsage;
|
|
1378
|
+
/** What the build's incremental entity-resolution stage has got through; absent until its first pass reports. */
|
|
1379
|
+
resolutionProgress?: KnowledgeBaseGraphResolutionProgress;
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* Running progress of a build's incremental entity-resolution stage, written as each pass proposes,
|
|
1383
|
+
* adjudicates and merges, and summed over the build's execution attempts. The build's `usage` is flushed
|
|
1384
|
+
* at the same points, so it reads as the cost so far while the build runs.
|
|
1385
|
+
* @category AI
|
|
1386
|
+
*/
|
|
1387
|
+
export interface KnowledgeBaseGraphResolutionProgress {
|
|
1388
|
+
/** Drain rounds completed. */
|
|
1389
|
+
rounds: number;
|
|
1390
|
+
/** Resolution passes completed. */
|
|
1391
|
+
passes: number;
|
|
1392
|
+
/** Dirty entities examined. */
|
|
1393
|
+
examined: number;
|
|
1394
|
+
/** Candidate pairs sent to adjudication. */
|
|
1395
|
+
pairsProposed: number;
|
|
1396
|
+
/** Candidate pairs adjudication confirmed as the same entity. */
|
|
1397
|
+
pairsConfirmed: number;
|
|
1398
|
+
/** Entities merged into a canonical entity. */
|
|
1399
|
+
entitiesMerged: number;
|
|
1400
|
+
/** Time spent proposing candidate pairs (millis). */
|
|
1401
|
+
proposalMs: number;
|
|
1402
|
+
/** Time spent adjudicating candidate pairs (millis). */
|
|
1403
|
+
adjudicationMs: number;
|
|
1404
|
+
/** Time spent merging confirmed pairs and refreshing the survivors (millis). */
|
|
1405
|
+
mergeMs: number;
|
|
1406
|
+
/** When the progress was last written (epoch millis). */
|
|
1407
|
+
updatedAt: number;
|
|
1408
|
+
}
|
|
1409
|
+
/**
|
|
1410
|
+
* A scheduled structural build slot whose catch-up window closed (or the next slot superseded it) without a
|
|
1411
|
+
* structural build, because the automatic build could not start while the window was open.
|
|
1412
|
+
* @category AI
|
|
1413
|
+
*/
|
|
1414
|
+
export interface KnowledgeBaseGraphStructuralBuildSkip {
|
|
1415
|
+
/** The cron slot that was skipped (epoch millis). */
|
|
1416
|
+
slotAt: number;
|
|
1417
|
+
/** When the slot's catch-up window closed (epoch millis). */
|
|
1418
|
+
windowEndsAt: number;
|
|
1419
|
+
/**
|
|
1420
|
+
* Why the build could not start: an entity-resolution build was still running, another graph build held the KB,
|
|
1421
|
+
* a manual rebuild was queued ahead of it, a bulk ingestion was writing to it, or `graphRag.autoBuildPaused` was set.
|
|
1422
|
+
* The last reason seen in the window.
|
|
1423
|
+
*/
|
|
1424
|
+
reason: KnowledgeBaseGraphStructuralBuildSkipReason;
|
|
1425
|
+
/** When the skip was recorded (epoch millis). */
|
|
1426
|
+
recordedAt: number;
|
|
1361
1427
|
}
|
|
1428
|
+
/** Why an automatic structural build could not start inside its scheduled window. @category AI */
|
|
1429
|
+
export type KnowledgeBaseGraphStructuralBuildSkipReason = 'resolution-running' | 'build-in-progress' | 'queued-rebuild' | 'bulk-ingest' | 'paused';
|
|
1362
1430
|
/**
|
|
1363
1431
|
* A graph build's LLM usage split by pipeline stage. A stage the build entered but spent nothing on
|
|
1364
1432
|
* reads zero; a stage it never ran (skipped by its plan, or by a resume) is absent.
|
|
@@ -1896,6 +1964,24 @@ export interface BulkIngestionJobStatusCounts {
|
|
|
1896
1964
|
/** Logical requests submitted to the provider and awaiting results. */
|
|
1897
1965
|
requestsSubmitted: number;
|
|
1898
1966
|
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Machine-readable class of a bulk-ingestion file failure, for outcomes to treat differently from real
|
|
1969
|
+
* failures. Terminal — reported with `retryable: false` — are `'CONTENT_TOO_LARGE'` (past the per-context
|
|
1970
|
+
* ceiling), `'ENCRYPTED_DOCUMENT'`, `'IMAGE_OVER_PROVIDER_LIMIT'` (the OCR provider refuses an image in the
|
|
1971
|
+
* document as too large, even with the pages that draw it redrawn smaller), `'NO_EMBEDDABLE_CONTENT'`,
|
|
1972
|
+
* `'SOURCE_OVER_PROVIDER_LIMIT'` (the bytes exceed what the extraction provider accepts),
|
|
1973
|
+
* `'UNREADABLE_DOCUMENT'` (a PDF or Office file whose bytes cannot be opened as one), `'UNREADABLE_WORKBOOK'`
|
|
1974
|
+
* (a spreadsheet whose content the parser cannot read) and `'UNSUPPORTED_FILE_TYPE'`.
|
|
1975
|
+
* `'DUPLICATE_CONTENT'` is a skip rather than a failure: the KB already holds this content.
|
|
1976
|
+
* `'EXTRACTION_TIMED_OUT'` stays retryable — the deadline is contended, so a borderline document can
|
|
1977
|
+
* cross it under load. So do `'SOURCE_UNREACHABLE'` (the provider could not fetch the source, which a
|
|
1978
|
+
* fresh link can fix) and `'PROVIDER_ACCESS_DENIED'` (the provider refused the credential or its quota is
|
|
1979
|
+
* spent, a fault of the environment). `'JOB_FULL'`: the job's request ceiling had no room left for this
|
|
1980
|
+
* file when it was admitted — before any paid stage ran — so re-submit it in a fresh job; a file that
|
|
1981
|
+
* alone exceeds the ceiling fails this way in every job.
|
|
1982
|
+
* @category AI
|
|
1983
|
+
*/
|
|
1984
|
+
export type BulkIngestionFileErrorCode = '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';
|
|
1899
1985
|
/**
|
|
1900
1986
|
* Per-file/per-context status within a bulk-ingestion job, so a caller can see which file finished,
|
|
1901
1987
|
* which is still processing, and why a file failed.
|
|
@@ -1912,21 +1998,9 @@ export interface BulkIngestionFileStatus {
|
|
|
1912
1998
|
errorMessage?: string;
|
|
1913
1999
|
/**
|
|
1914
2000
|
* Machine-readable class of a failed file, for outcomes to treat differently from real failures.
|
|
1915
|
-
*
|
|
1916
|
-
|
|
1917
|
-
|
|
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'`.
|
|
1921
|
-
* `'DUPLICATE_CONTENT'` is a skip rather than a failure: the KB already holds this content.
|
|
1922
|
-
* `'EXTRACTION_TIMED_OUT'` stays retryable — the deadline is contended, so a borderline document can
|
|
1923
|
-
* cross it under load. So do `'SOURCE_UNREACHABLE'` (the provider could not fetch the source, which a
|
|
1924
|
-
* fresh link can fix) and `'PROVIDER_ACCESS_DENIED'` (the provider refused the credential or its quota is
|
|
1925
|
-
* spent, a fault of the environment). `'JOB_FULL'`: the job's request ceiling had no room left for this
|
|
1926
|
-
* file, so re-submit it in a fresh job; a file that alone exceeds the ceiling fails this way in every job.
|
|
1927
|
-
* Additive; absent for ordinary failures.
|
|
1928
|
-
*/
|
|
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';
|
|
2001
|
+
* Additive; absent for ordinary failures. See {@link BulkIngestionFileErrorCode}.
|
|
2002
|
+
*/
|
|
2003
|
+
errorCode?: BulkIngestionFileErrorCode;
|
|
1930
2004
|
/**
|
|
1931
2005
|
* Present only on a failed file an extraction provider answered: a stable fingerprint of that answer
|
|
1932
2006
|
* (provider, HTTP status and provider code), so a caller can tell the same failure repeating from a new one.
|
|
@@ -1963,6 +2037,91 @@ export interface BulkIngestionFileStatus {
|
|
|
1963
2037
|
* @category AI
|
|
1964
2038
|
*/
|
|
1965
2039
|
export type BulkIngestionGraphSkipReason = 'cap' | 'queue';
|
|
2040
|
+
/**
|
|
2041
|
+
* The durable ingestion status of a single file/text context, tracked independently of any one
|
|
2042
|
+
* bulk-ingestion job so it survives job purge. `'no_record'` means the knowledge base has never seen
|
|
2043
|
+
* this path — never persisted, only synthesized when a status query finds nothing. `'in_progress'`
|
|
2044
|
+
* covers every non-terminal bulk-ingestion stage (staged through embedding); the ledger only records
|
|
2045
|
+
* terminal outcomes, so finer sub-stages are not distinguished. `'completed'` and `'failed'` are terminal.
|
|
2046
|
+
* @category AI
|
|
2047
|
+
*/
|
|
2048
|
+
export type AiKnowledgeBaseFileStatus = 'no_record' | 'in_progress' | 'completed' | 'failed';
|
|
2049
|
+
/**
|
|
2050
|
+
* The durable ingestion status of one file/text context at a path, returned by
|
|
2051
|
+
* {@link AiKnowledgeBaseReference.getFileStatus} and as one entry of
|
|
2052
|
+
* {@link AiKnowledgeBaseFolderStatusResponse.files}.
|
|
2053
|
+
* @category AI
|
|
2054
|
+
*/
|
|
2055
|
+
export interface AiKnowledgeBaseFileStatusInfo {
|
|
2056
|
+
/** The context id, absent only when `status` is `'no_record'`. */
|
|
2057
|
+
contextId?: AiContextId;
|
|
2058
|
+
/** The file's path: `folderPath/filename`, or just `filename` at the upload root. */
|
|
2059
|
+
path: string;
|
|
2060
|
+
/** The file's current durable status. */
|
|
2061
|
+
status: AiKnowledgeBaseFileStatus;
|
|
2062
|
+
/** Present only when `status` is `'failed'`: the terminal failure reason. */
|
|
2063
|
+
errorMessage?: string;
|
|
2064
|
+
/**
|
|
2065
|
+
* Present only when `status` is `'failed'`: the machine-readable failure class, when known. A bulk
|
|
2066
|
+
* lane failure reports {@link BulkIngestionFileErrorCode}; a synchronous `upsertContexts` failure
|
|
2067
|
+
* reports {@link UpsertContextErrorCode} — the two lanes use distinct, mostly-overlapping codes.
|
|
2068
|
+
*/
|
|
2069
|
+
errorCode?: BulkIngestionFileErrorCode | UpsertContextErrorCode;
|
|
2070
|
+
/** When this status was last recorded; absent when `status` is `'no_record'`. */
|
|
2071
|
+
updatedAt?: Date;
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Request to look up the durable ingestion status of a single file/text context by path.
|
|
2075
|
+
* @category AI
|
|
2076
|
+
*/
|
|
2077
|
+
export interface GetKnowledgeBaseFileStatusRequest {
|
|
2078
|
+
/** The knowledge base to query. */
|
|
2079
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
2080
|
+
/** The file's path: `folderPath/filename`, or just `filename` at the upload root. */
|
|
2081
|
+
path: string;
|
|
2082
|
+
}
|
|
2083
|
+
/**
|
|
2084
|
+
* Request to search and aggregate the durable ingestion status of every file/text context matching
|
|
2085
|
+
* `folderPath`, read three ways and unioned: a folder subtree, a bare filename anywhere in the
|
|
2086
|
+
* knowledge base, and — when it contains a `/` — an exact `folderPath/filename` path.
|
|
2087
|
+
* @category AI
|
|
2088
|
+
*/
|
|
2089
|
+
export interface GetKnowledgeBaseFolderStatusRequest {
|
|
2090
|
+
/** The knowledge base to query. */
|
|
2091
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
2092
|
+
/**
|
|
2093
|
+
* The folder subtree, bare filename, or exact file path to search for. A subtree match uses the same
|
|
2094
|
+
* segment-safe matching as `$underPath` metadata filters; a value containing `/` also matches that
|
|
2095
|
+
* exact file, so pasting a path from an earlier result finds that one file, not a folder of the same name.
|
|
2096
|
+
*/
|
|
2097
|
+
folderPath: string;
|
|
2098
|
+
/**
|
|
2099
|
+
* Maximum number of files to return in `files`, prioritizing failures (the ones needing attention)
|
|
2100
|
+
* before filling remaining room with other statuses. `counts`/`totalFiles` always cover every file
|
|
2101
|
+
* regardless of this cap. Defaults to 50.
|
|
2102
|
+
*/
|
|
2103
|
+
fileLimit?: number;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Aggregate ingestion status for every file/text context matching a searched folder subtree, bare
|
|
2107
|
+
* filename, or exact file path (see {@link GetKnowledgeBaseFolderStatusRequest.folderPath}), combining
|
|
2108
|
+
* a name/path search with per-status counts and the failures that need attention.
|
|
2109
|
+
* @category AI
|
|
2110
|
+
*/
|
|
2111
|
+
export interface AiKnowledgeBaseFolderStatusResponse {
|
|
2112
|
+
/** The folder subtree, filename, or exact path that was searched. */
|
|
2113
|
+
folderPath: string;
|
|
2114
|
+
/** Count of matching files by terminal/in-progress status (excludes `no_record`), uncapped. */
|
|
2115
|
+
counts: Record<Exclude<AiKnowledgeBaseFileStatus, 'no_record'>, number>;
|
|
2116
|
+
/** Total files found, across all statuses in `counts`. */
|
|
2117
|
+
totalFiles: number;
|
|
2118
|
+
/** False when nothing matched — the folder-level `no_record` case. */
|
|
2119
|
+
hasAnyRecords: boolean;
|
|
2120
|
+
/** Files under the folder, capped at `fileLimit` and prioritizing failures. */
|
|
2121
|
+
files: Array<AiKnowledgeBaseFileStatusInfo>;
|
|
2122
|
+
/** True when `files` was capped and more files exist under the folder than are returned. */
|
|
2123
|
+
truncated: boolean;
|
|
2124
|
+
}
|
|
1966
2125
|
/**
|
|
1967
2126
|
* Why a whole bulk-ingestion staging call was refused, on the `details` of its 400 response. The
|
|
1968
2127
|
* refusal names the one context that caused it, so a caller recording per-file outcomes charges only
|
|
@@ -2013,6 +2172,8 @@ export interface BulkIngestionProviderBatchStatus {
|
|
|
2013
2172
|
providerStatus?: string;
|
|
2014
2173
|
/** When a poll first saw {@link providerStatus}. */
|
|
2015
2174
|
providerStatusChangedAt?: Date;
|
|
2175
|
+
/** Why the provider failed the batch as a whole, in its own words; absent on a batch it did not fail. */
|
|
2176
|
+
providerError?: string;
|
|
2016
2177
|
/** When the provider started running the batch; absent while it has not. */
|
|
2017
2178
|
providerInProgressAt?: Date;
|
|
2018
2179
|
/** Per-request progress at the newest poll; absent for a provider that does not report it. */
|
|
@@ -7,6 +7,23 @@ export interface InvokeLangGraphOptions {
|
|
|
7
7
|
threadId?: string;
|
|
8
8
|
/** Initial state for the run. */
|
|
9
9
|
input?: Record<string, unknown>;
|
|
10
|
+
/** How long the run may take, in ms, before it stops and fails. At most, and by default, one hour. */
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Context of the run, which every node reads as LangGraph's `runtime.context`. It is not stored, so a resume
|
|
14
|
+
* passes its own.
|
|
15
|
+
*/
|
|
16
|
+
context?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for resuming an interrupted LangGraph thread.
|
|
20
|
+
* @category AI
|
|
21
|
+
*/
|
|
22
|
+
export interface ResumeLangGraphOptions {
|
|
23
|
+
/** How long the resumed run may take, in ms, before it stops and fails. At most, and by default, one hour. */
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
/** Context of the resumed run, which every node reads as LangGraph's `runtime.context`. */
|
|
26
|
+
context?: Record<string, unknown>;
|
|
10
27
|
}
|
|
11
28
|
/**
|
|
12
29
|
* Successful result of a LangGraph invocation.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AgentContextRequest, AiAgent, AiAgentContext, AiAgentMcpServerConfig, AiAnnotation, AiAudioCreateSpeechOptions, AiChatMessage, AiChatOptions, AiGenerateImageOptions,
|
|
1
|
+
import { AgentContextRequest, AiAgent, AiAgentContext, AiAgentMcpServerConfig, AiAnnotation, AiAudioCreateSpeechOptions, AiChatMessage, AiChatOptions, AiChatRequestOptions, AiGenerateImageOptions, AiModelRoutingResult, ApplicationAiSettings, BuildAgentOptions } from '../public-types/ai-agent.public-types';
|
|
2
2
|
import { AiProviderType, ModelIdSpec } from '../public-types/ai-common.public-types';
|
|
3
3
|
import { AiContextMetadata, AiContextMetadataFilter } from '../public-types/ai-knowledge-base.public-types';
|
|
4
4
|
import { AiAgentId, AiKnowledgeBaseId, AppId, ClientRequestId } from '../public-types/communication.public-types';
|
|
@@ -15,13 +15,13 @@ export interface AiChatRequest {
|
|
|
15
15
|
agentId: AiAgentId;
|
|
16
16
|
clientRequestId: ClientRequestId;
|
|
17
17
|
prompt?: string;
|
|
18
|
-
options?:
|
|
18
|
+
options?: AiChatRequestOptions;
|
|
19
19
|
jobId: JobId;
|
|
20
20
|
}
|
|
21
21
|
export interface AiAskRequest {
|
|
22
22
|
agentId: AiAgentId;
|
|
23
23
|
prompt?: string;
|
|
24
|
-
options?:
|
|
24
|
+
options?: AiChatRequestOptions;
|
|
25
25
|
jobId: JobId;
|
|
26
26
|
}
|
|
27
27
|
export interface AiGenerateImageRequest {
|
|
@@ -65,6 +65,7 @@ export interface AiContextSizeResponse {
|
|
|
65
65
|
export interface AiAskResponse {
|
|
66
66
|
responseString: string;
|
|
67
67
|
annotations?: Record<string, AiAnnotation>;
|
|
68
|
+
routing?: AiModelRoutingResult;
|
|
68
69
|
}
|
|
69
70
|
export interface AiAskWithVoiceResponse {
|
|
70
71
|
responseString: string;
|
|
@@ -193,7 +193,7 @@ export interface AiKnowledgeBaseSearchResponse {
|
|
|
193
193
|
/** Traversed subgraph for a `searchMode:'graph'` query with `includeGraphContext`; absent otherwise. */
|
|
194
194
|
graphContext?: AiKnowledgeBaseGraphContext;
|
|
195
195
|
}
|
|
196
|
-
export type { ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GetKnowledgeBaseGraphStatusRequest, GetKnowledgeBaseGraphStatusResponse, KnowledgeBaseGraphBuildStageUsage, KnowledgeBaseGraphBuildUsage, KnowledgeBaseGraphEdge, KnowledgeBaseGraphFacetStatus, KnowledgeBaseGraphModelUsage, KnowledgeBaseGraphNode, KnowledgeBaseGraphQueryConcepts, KnowledgeBaseGraphQueryDoc, KnowledgeBaseGraphQueryGlobalSummary, KnowledgeBaseGraphQueryMatch, KnowledgeBaseGraphQueryOp, KnowledgeBaseGraphQueryPath, KnowledgeBaseGraphQuerySubtreeNode, KnowledgeBaseGraphRebuildMode, KnowledgeBaseGraphResolutionStatus, KnowledgeBaseGraphTopic, KnowledgeBaseGraphTopicEdge, KnowledgeBaseGraphUsage, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, } from '../public-types/ai-knowledge-base.public-types';
|
|
196
|
+
export type { ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GetKnowledgeBaseGraphStatusRequest, GetKnowledgeBaseGraphStatusResponse, KnowledgeBaseGraphBuildStageUsage, KnowledgeBaseGraphBuildUsage, KnowledgeBaseGraphEdge, KnowledgeBaseGraphFacetStatus, KnowledgeBaseGraphModelUsage, KnowledgeBaseGraphNode, KnowledgeBaseGraphQueryConcepts, KnowledgeBaseGraphQueryDoc, KnowledgeBaseGraphQueryGlobalSummary, KnowledgeBaseGraphQueryMatch, KnowledgeBaseGraphQueryOp, KnowledgeBaseGraphQueryPath, KnowledgeBaseGraphQuerySubtreeNode, KnowledgeBaseGraphQueuedRebuild, KnowledgeBaseGraphRebuildMode, KnowledgeBaseGraphResolutionProgress, KnowledgeBaseGraphResolutionStatus, KnowledgeBaseGraphStructuralBuildSkip, KnowledgeBaseGraphStructuralBuildSkipReason, KnowledgeBaseGraphTopic, KnowledgeBaseGraphTopicEdge, KnowledgeBaseGraphUsage, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, } from '../public-types/ai-knowledge-base.public-types';
|
|
197
197
|
/**
|
|
198
198
|
* Request structure for getting the size of context
|
|
199
199
|
* for an AiKnowledgeBase
|
|
@@ -231,6 +231,25 @@ export interface AiKnowledgeBaseFailNextGrepScansRequest {
|
|
|
231
231
|
/** Whether the next truncated-file-name lookup fails; false disarms, absent leaves it alone. */
|
|
232
232
|
failNextTruncatedNameLookup?: boolean;
|
|
233
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Request structure for the internal test-only route that reports how many chunk-collection scope
|
|
236
|
+
* resolutions a Mongo-backed knowledge base's filtered searches ran, and arms the next ones to fail.
|
|
237
|
+
*/
|
|
238
|
+
export interface AiKnowledgeBaseChunkScopeResolutionsRequest {
|
|
239
|
+
/** The ID of the App */
|
|
240
|
+
appId: AppId;
|
|
241
|
+
/** The ID of the AIKnowledgeBase */
|
|
242
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
243
|
+
/** How many upcoming chunk-collection resolutions fail at their `maxTimeMS` deadline; absent disarms. */
|
|
244
|
+
failNext?: number;
|
|
245
|
+
/** How many upcoming context-record lookups fail at their `maxTimeMS` deadline; absent disarms. */
|
|
246
|
+
failNextRecordLookups?: number;
|
|
247
|
+
}
|
|
248
|
+
/** Response structure for {@link AiKnowledgeBaseChunkScopeResolutionsRequest}. */
|
|
249
|
+
export interface AiKnowledgeBaseChunkScopeResolutionsResponse {
|
|
250
|
+
/** How many chunk-collection scope resolutions ran since the previous request. */
|
|
251
|
+
count: number;
|
|
252
|
+
}
|
|
234
253
|
/**
|
|
235
254
|
* Where an armed bulk finalize failure throws: past the destructive-write boundary but before the vector
|
|
236
255
|
* write (nothing written), or right after it (the vectors are replaced, the record is not).
|
|
@@ -346,6 +365,8 @@ export interface AiKnowledgeBaseSetGraphWriteGateRequest {
|
|
|
346
365
|
export interface AiKnowledgeBaseSetGraphWriteGateResponse {
|
|
347
366
|
/** True once a writer has parked on the gate. */
|
|
348
367
|
entered: boolean;
|
|
368
|
+
/** How many writers have parked on the gate since it was armed. */
|
|
369
|
+
entrants: number;
|
|
349
370
|
}
|
|
350
371
|
/**
|
|
351
372
|
* Request structure for the internal test-only route that runs one knowledge base's graph writes without the
|
|
@@ -610,9 +631,9 @@ export interface AiKnowledgeBaseChatRequest {
|
|
|
610
631
|
prompt?: string;
|
|
611
632
|
options?: AiKnowledgeBaseChatOptionsInternal;
|
|
612
633
|
}
|
|
613
|
-
/** Emitted to the console queue when a knowledge base
|
|
634
|
+
/** Emitted to the console queue when a knowledge base, its contexts, or a file's ingestion status change. */
|
|
614
635
|
export interface KbChangeEvent {
|
|
615
636
|
appId: AppId;
|
|
616
637
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
617
|
-
changeType: 'kb' | 'context';
|
|
638
|
+
changeType: 'kb' | 'context' | 'fileStatus';
|
|
618
639
|
}
|
|
@@ -10,21 +10,8 @@ export declare const SquidHeaders: {
|
|
|
10
10
|
readonly APP_ID: "x-squid-appid";
|
|
11
11
|
/** Unique identifier of the end user or service client. */
|
|
12
12
|
readonly CLIENT_ID: "x-squid-clientid";
|
|
13
|
-
/**
|
|
14
|
-
* Marks a request already forwarded between the cores, carrying a digest of the internal API key.
|
|
15
|
-
*
|
|
16
|
-
* The receiving core answers such a request itself instead of forwarding it back, and does not
|
|
17
|
-
* meter it — whichever core took the request from the outside already did. A value derived from a
|
|
18
|
-
* shared secret is what makes that safe: a caller could otherwise send the header and skip their
|
|
19
|
-
* own quota. A digest rather than the key itself, because the header reaches tenant code, where
|
|
20
|
-
* the key would be a privilege escalation; it authorizes nothing, {@link SECRET} is what internal
|
|
21
|
-
* auth reads.
|
|
22
|
-
*/
|
|
23
|
-
readonly PROXY_HOP: "x-squid-proxy-hop";
|
|
24
13
|
/** Version string of the Squid client library. */
|
|
25
14
|
readonly CLIENT_VERSION: "x-squid-client-version";
|
|
26
|
-
/** Originating IP address of the request. */
|
|
27
|
-
readonly SOURCE_IP: "x-squid-source-ip";
|
|
28
15
|
/**
|
|
29
16
|
* Access tokens the caller supplies for the request's integrations, as a JSON object keyed by
|
|
30
17
|
* integration ID. An integration type that runs with one takes it in place of its stored secret.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MetricName } from '../metric-name';
|
|
2
2
|
import { AppId } from '../public-types/communication.public-types';
|
|
3
|
+
import { JobId } from '../public-types/job.public-types';
|
|
3
4
|
export interface ObservableNameMetrics {
|
|
4
5
|
count: MetricName;
|
|
5
6
|
time: MetricName;
|
|
@@ -129,6 +130,58 @@ export interface AgentAuditLogUpdateEvent {
|
|
|
129
130
|
/** Number of input tokens written into the provider's prompt cache (cache misses that created new entries). */
|
|
130
131
|
cacheWriteInputTokens?: number;
|
|
131
132
|
}
|
|
133
|
+
/** The lane a knowledge-base search arrived through, recorded on its audit entry. */
|
|
134
|
+
export declare const KB_SEARCH_AUDIT_SOURCES: readonly ["sdk", "agent-context", "agent-tool", "internal", "context-search"];
|
|
135
|
+
/** One of {@link KB_SEARCH_AUDIT_SOURCES}. */
|
|
136
|
+
export type KbSearchAuditSource = (typeof KB_SEARCH_AUDIT_SOURCES)[number];
|
|
137
|
+
/**
|
|
138
|
+
* Maximum UTF-8 bytes of any free-text audit payload (agent instructions, retrieved content, tool
|
|
139
|
+
* results, KB query text). Keeps the entry under Kafka's ~1MB message limit with headroom for the rest
|
|
140
|
+
* of the event and JSON escaping.
|
|
141
|
+
*/
|
|
142
|
+
export declare const MAX_AUDIT_TEXT_BYTES = 500000;
|
|
143
|
+
/** Truncates a free-text audit payload to {@link MAX_AUDIT_TEXT_BYTES}, marking the cut. */
|
|
144
|
+
export declare function truncateAuditText(text: string): string;
|
|
145
|
+
/**
|
|
146
|
+
* Maximum scopes / contextIds kept on a KB search audit entry. When exceeded, the list is cut and
|
|
147
|
+
* `__truncated` is appended as the final element — the `__` prefix is Squid's reserved scope
|
|
148
|
+
* namespace, so the sentinel can never collide with a real scope or context id from a resolver.
|
|
149
|
+
*/
|
|
150
|
+
export declare const MAX_KB_AUDIT_LIST_ENTRIES = 1000;
|
|
151
|
+
/** Final element of a capped scopes/contextIds list on a KB search audit entry. */
|
|
152
|
+
export declare const KB_AUDIT_TRUNCATED_SENTINEL = "__truncated";
|
|
153
|
+
/** Caps an audited scopes/contextIds list, appending the sentinel when entries were dropped. */
|
|
154
|
+
export declare function capKbAuditList(values: ReadonlyArray<string>): Array<string>;
|
|
155
|
+
/**
|
|
156
|
+
* KB retrieval audit entry — one per search of an access-enforced knowledge base, across every
|
|
157
|
+
* search lane. Records what the caller asked, the access scopes they held, and which contexts
|
|
158
|
+
* (documents) the search returned. Only searches on a knowledge base with
|
|
159
|
+
* `accessControl.mode: 'enforced'` produce entries.
|
|
160
|
+
*/
|
|
161
|
+
export interface KbSearchAuditLogEvent {
|
|
162
|
+
appId: AppId;
|
|
163
|
+
knowledgeBaseId: string;
|
|
164
|
+
/** The search lane the query arrived through. */
|
|
165
|
+
source: KbSearchAuditSource;
|
|
166
|
+
/** The agent the search ran for; absent outside agent jobs. */
|
|
167
|
+
agentId?: string;
|
|
168
|
+
/** The agent job the search ran in; absent outside agent jobs. */
|
|
169
|
+
jobId?: JobId;
|
|
170
|
+
/** The query text, truncated to {@link MAX_AUDIT_TEXT_BYTES}. */
|
|
171
|
+
prompt: string;
|
|
172
|
+
/** Effective retrieval mode (`hybrid` | `vector` | `keyword`; `graph` is refused under enforcement). */
|
|
173
|
+
searchMode: string;
|
|
174
|
+
/** Access scopes the caller held for this search (the resolver's output), capped. */
|
|
175
|
+
scopes: Array<string>;
|
|
176
|
+
/** Unique context ids of the documents returned to the caller, capped. */
|
|
177
|
+
contextIds: Array<string>;
|
|
178
|
+
/** Number of chunks returned (post-limit). */
|
|
179
|
+
chunkCount: number;
|
|
180
|
+
durationMs: number;
|
|
181
|
+
/** Identity tags of the caller: {@link AUDIT_TAG_USER_ID} / auth type / client id / source IP. */
|
|
182
|
+
tags: Record<string, string>;
|
|
183
|
+
createdAt: Date;
|
|
184
|
+
}
|
|
132
185
|
/** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
|
|
133
186
|
export declare const O11Y_TAG_IS_ERROR = "isError";
|
|
134
187
|
/** Tag naming the organization an application belongs to. */
|
|
@@ -137,7 +190,7 @@ export declare const O11Y_TAG_ORG_ID = "organizationId";
|
|
|
137
190
|
export declare const O11Y_TAG_APP_ID = "appId";
|
|
138
191
|
/** Tag for metric and log events. */
|
|
139
192
|
export declare const O11Y_TAG_INTEGRATION_ID = "integrationId";
|
|
140
|
-
/** The integration's own type, which
|
|
193
|
+
/** The integration's own type, which per-type metrics are grouped by. */
|
|
141
194
|
export declare const O11Y_TAG_INTEGRATION_TYPE = "integrationType";
|
|
142
195
|
/** Whether the query also registered a subscription for its result. */
|
|
143
196
|
export declare const O11Y_TAG_SUBSCRIBE = "subscribe";
|
|
@@ -217,7 +270,7 @@ export declare const O11Y_TAG_TRACE_ID = "trace_id";
|
|
|
217
270
|
/** Tag for the span ID. Used in logs. */
|
|
218
271
|
export declare const O11Y_TAG_SPAN_ID = "span_id";
|
|
219
272
|
/**
|
|
220
|
-
* Tag carrying Squid's own correlation id (the `n_`/`c_
|
|
273
|
+
* Tag carrying Squid's own correlation id (the `n_`/`c_` short id minted by
|
|
221
274
|
* `generateTraceId`). Distinct from `trace_id`/`span_id`, which hold the W3C ids from OTel.
|
|
222
275
|
* Rides W3C baggage under the same key on internal hops; attached to spans and logs.
|
|
223
276
|
*/
|
|
@@ -31,6 +31,11 @@ export declare function cloneShallow<T>(value: T): T;
|
|
|
31
31
|
export declare function deepMerge<T extends object, U extends object>(target: T, source: U): T & U;
|
|
32
32
|
/** Returns true if the `value` is a defined object and is not an array. */
|
|
33
33
|
export declare function isPlainObject(value: unknown): value is object;
|
|
34
|
+
/**
|
|
35
|
+
* Returns true if the `value` is an object that JSON can hold as it is: a plain object whose values are JSON at any
|
|
36
|
+
* depth, with no `__proto__` key. A `Date` or another class instance is not one.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isJsonObject(value: unknown): value is Record<string, unknown>;
|
|
34
39
|
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
35
40
|
export declare function compareValues(v1: unknown, v2: unknown): number;
|
|
36
41
|
/** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
export declare const SQUID_SUPPORT_EMAIL = "support@getsquid.ai";
|
|
2
|
-
/**
|
|
3
|
-
* Error code when application is not found.
|
|
4
|
-
* Must be in sync with Kotlin.
|
|
5
|
-
*/
|
|
2
|
+
/** Error code when application is not found. */
|
|
6
3
|
export declare const APPLICATION_NOT_FOUND_ERROR = "APPLICATION_NOT_FOUND";
|