@squidcloud/client 1.0.494 → 1.0.496
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/public-types/ai-agent.public-types.d.ts +15 -9
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +77 -17
- package/dist/internal-common/src/public-types/ai-voice.public-types.d.ts +8 -0
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/job.public-types.d.ts +14 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +104 -0
- package/dist/internal-common/src/types/observability.types.d.ts +3 -0
- package/dist/internal-common/src/utils/http.d.ts +1 -21
- package/dist/internal-common/src/utils/serialization.d.ts +6 -0
- package/dist/typescript-client/src/document-reference.d.ts +1 -0
- package/dist/typescript-client/src/job-client.d.ts +3 -2
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -950,6 +950,12 @@ export interface AiStatusMessage {
|
|
|
950
950
|
/** Optional tags providing additional metadata about the status. */
|
|
951
951
|
tags?: Record<string, any>;
|
|
952
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* `errorType` on a failed chat/ask job when the AI provider itself failed (a stall, timeout, or
|
|
955
|
+
* unrecognized 5xx) rather than Squid or the caller's request.
|
|
956
|
+
* @category AI
|
|
957
|
+
*/
|
|
958
|
+
export declare const AI_PROVIDER_ERROR_TYPE = "AI_PROVIDER_ERROR";
|
|
953
959
|
/** List of all chat history (memory) sources. */
|
|
954
960
|
export declare const AI_CHAT_MESSAGE_SOURCE: readonly ["user", "ai"];
|
|
955
961
|
/** Source of the chat history entry: either an AI response or a user. */
|
|
@@ -1068,17 +1074,12 @@ export interface UpsertContextStatusSuccess extends BaseUpsertContextStatus {
|
|
|
1068
1074
|
imageFailureCount?: number;
|
|
1069
1075
|
}
|
|
1070
1076
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
* byte-identical to an existing context in the same knowledge base.
|
|
1075
|
-
*
|
|
1076
|
-
* `EMBEDDING_FAILED` means extraction succeeded but embedding the context's chunks did not; the
|
|
1077
|
-
* content was not written (an overwrite target keeps its previous content) and the request can be
|
|
1078
|
-
* safely retried as-is.
|
|
1077
|
+
* Names an upsert failure; `DUPLICATE_CONTENT` identifies existing content when contextId is omitted.
|
|
1078
|
+
* `EMBEDDING_FAILED`, `EXTRACTION_TIMED_OUT`, `PROVIDER_ACCESS_DENIED`, and `SOURCE_UNREACHABLE` may
|
|
1079
|
+
* succeed on retry. Document faults carry `retryable: false` because the same bytes fail again.
|
|
1079
1080
|
* @category AI
|
|
1080
1081
|
*/
|
|
1081
|
-
export type UpsertContextErrorCode = 'DUPLICATE_CONTENT' | 'EMBEDDING_FAILED';
|
|
1082
|
+
export type UpsertContextErrorCode = 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'EMBEDDING_FAILED' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'NO_EMBEDDABLE_CONTENT' | 'PROVIDER_ACCESS_DENIED' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'SOURCE_UNREACHABLE' | 'UNREADABLE_WORKBOOK' | 'UNSUPPORTED_FILE_TYPE';
|
|
1082
1083
|
/**
|
|
1083
1084
|
* The existing context a `DUPLICATE_CONTENT` rejection points at — where the byte-identical original
|
|
1084
1085
|
* already lives.
|
|
@@ -1105,6 +1106,11 @@ export interface UpsertContextStatusError extends BaseUpsertContextStatus {
|
|
|
1105
1106
|
errorMessage: string;
|
|
1106
1107
|
/** Machine-readable code for the failure, when one applies. */
|
|
1107
1108
|
errorCode?: UpsertContextErrorCode;
|
|
1109
|
+
/**
|
|
1110
|
+
* Present only when the same bytes fail the same way again, so a caller must not retry the request
|
|
1111
|
+
* as-is. Absence means the failure may be transient.
|
|
1112
|
+
*/
|
|
1113
|
+
retryable?: false;
|
|
1108
1114
|
/**
|
|
1109
1115
|
* The existing context this request duplicated, when `errorCode` is `DUPLICATE_CONTENT`. Lets a caller
|
|
1110
1116
|
* point the user at where the original already lives (e.g. its folder) instead of only reporting the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AiChatModelSelection, AiReasoningEffort, ContextImageFailure, UpsertContextStatusError } from './ai-agent.public-types';
|
|
2
2
|
import { AiEmbeddingsModelSelection, AiRerankProvider } from './ai-common.public-types';
|
|
3
3
|
import { AiContextId, AiKnowledgeBaseId, AppId } from './communication.public-types';
|
|
4
4
|
import { DocumentExtractionMethod } from './extraction.public-types';
|
|
@@ -265,6 +265,13 @@ export interface AiKnowledgeBaseGraphConceptsConfig {
|
|
|
265
265
|
* @category AI
|
|
266
266
|
*/
|
|
267
267
|
export declare const FOLDER_PATH_METADATA_FIELD_NAME = "folderPath";
|
|
268
|
+
/**
|
|
269
|
+
* The canonical file-name metadata field: the source file's name, stamped by file ingestion (console
|
|
270
|
+
* upload, document connectors). Metadata extraction reads it, beside {@link FOLDER_PATH_METADATA_FIELD_NAME},
|
|
271
|
+
* as evidence about the document.
|
|
272
|
+
* @category AI
|
|
273
|
+
*/
|
|
274
|
+
export declare const FILE_NAME_METADATA_FIELD_NAME = "filename";
|
|
268
275
|
/**
|
|
269
276
|
* A path facet: a deterministic tree built by splitting a hierarchical path field on {@link separator}.
|
|
270
277
|
* Interior nodes are the path prefixes; scoping a search to one node matches that folder and everything
|
|
@@ -498,9 +505,18 @@ export interface AiKnowledgeBaseContext {
|
|
|
498
505
|
* content-level dedup on upsert. Absent on legacy contexts ingested before hashing was introduced.
|
|
499
506
|
*/
|
|
500
507
|
contentHash?: string;
|
|
501
|
-
/**
|
|
502
|
-
|
|
508
|
+
/**
|
|
509
|
+
* The options the context was ingested with, replayed when it is reupserted. Absent on contexts that
|
|
510
|
+
* carry none; their reupsert takes the defaults.
|
|
511
|
+
*/
|
|
512
|
+
requestConfig?: AiKnowledgeBaseContextRequestConfig;
|
|
503
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* The ingestion request's options only. Everything else a reupsert needs lives on the context itself —
|
|
516
|
+
* its text or stored file, title, metadata and access scopes — where it can change after ingestion.
|
|
517
|
+
* @category AI
|
|
518
|
+
*/
|
|
519
|
+
export type AiKnowledgeBaseContextRequestConfig = Omit<AiKnowledgeBaseTextContextRequest, 'text' | 'title' | 'metadata' | 'scopes'> | Omit<AiKnowledgeBaseFileContextRequest, 'metadata' | 'scopes'>;
|
|
504
520
|
/**
|
|
505
521
|
* @category AI
|
|
506
522
|
*/
|
|
@@ -633,11 +649,10 @@ export interface AiKnowledgeBaseFileContextRequest extends BaseAiKnowledgeBaseCo
|
|
|
633
649
|
/** The preferred method for extracting data from the document. */
|
|
634
650
|
preferredExtractionMethod?: DocumentExtractionMethod;
|
|
635
651
|
/**
|
|
636
|
-
* Whether Squid
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
* Defaults to false.
|
|
652
|
+
* Whether Squid discards the downloadable original once the file is extracted; the extracted text and
|
|
653
|
+
* images are stored either way. Defaults to false: the original is kept so the user can download it and
|
|
654
|
+
* Squid can reprocess it. Without it, `querySpreadsheetsWithAi` cannot open a workbook context and a
|
|
655
|
+
* reupsert of the context fails, on the sync and the bulk lane alike.
|
|
641
656
|
*/
|
|
642
657
|
discardOriginalFile?: boolean;
|
|
643
658
|
}
|
|
@@ -945,9 +960,9 @@ export interface GrepKnowledgeBaseResponse {
|
|
|
945
960
|
*/
|
|
946
961
|
unscannedContextCount?: number;
|
|
947
962
|
/**
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
963
|
+
* Every in-scope document known to have lost content at ingest, by file name. Present whenever such a
|
|
964
|
+
* document is in scope, alongside whichever {@link limitation} the scan reported — a cut document is no
|
|
965
|
+
* less cut because the scan also stopped early. Absent when none is.
|
|
951
966
|
*/
|
|
952
967
|
truncatedContentFileNames?: Array<string>;
|
|
953
968
|
}
|
|
@@ -1710,7 +1725,8 @@ export interface QueryKnowledgeBaseGraphResponse {
|
|
|
1710
1725
|
summaries?: Array<KnowledgeBaseGraphQueryGlobalSummary>;
|
|
1711
1726
|
}
|
|
1712
1727
|
/**
|
|
1713
|
-
* One context to stage through bulk ingestion.
|
|
1728
|
+
* One context to stage through bulk ingestion. Unlike the sync request, `imageExtractionModel` is not
|
|
1729
|
+
* accepted: a job bills one fixed vision model for every image it describes.
|
|
1714
1730
|
* @category AI
|
|
1715
1731
|
*/
|
|
1716
1732
|
export interface BulkIngestionContext {
|
|
@@ -1744,6 +1760,24 @@ export interface BulkIngestionContext {
|
|
|
1744
1760
|
* same name, so a caller's choice survives whichever lane a deployment routes the upload through.
|
|
1745
1761
|
*/
|
|
1746
1762
|
preferredExtractionMethod?: DocumentExtractionMethod;
|
|
1763
|
+
/**
|
|
1764
|
+
* The RAG type and chunk overlap this context is chunked and indexed with; mirrors the sync request's
|
|
1765
|
+
* `options`, with the same defaults (the knowledge base's `ragType`, and the overlap that type implies).
|
|
1766
|
+
* `chunkOverlap` must be a number below the 4,000-character chunk size.
|
|
1767
|
+
*/
|
|
1768
|
+
options?: BaseAiKnowledgeBaseContextOptions;
|
|
1769
|
+
/**
|
|
1770
|
+
* Minimum width/height in pixels for an extracted image to be kept; mirrors the sync request's field of
|
|
1771
|
+
* the same name. Smaller images are skipped, and an inline markdown/HTML image below it keeps its raw
|
|
1772
|
+
* reference in the text.
|
|
1773
|
+
*/
|
|
1774
|
+
imageMinSizePixels?: number;
|
|
1775
|
+
/**
|
|
1776
|
+
* Whether Squid discards a file context's downloadable original once it is extracted (the extracted
|
|
1777
|
+
* text and images are stored either way); mirrors {@link AiKnowledgeBaseFileContextRequest.discardOriginalFile},
|
|
1778
|
+
* with the same consequences. Ignored for a text context.
|
|
1779
|
+
*/
|
|
1780
|
+
discardOriginalFile?: boolean;
|
|
1747
1781
|
/**
|
|
1748
1782
|
* Optional metadata associated with the context item; mirrors {@link BaseAiKnowledgeBaseContextRequest.metadata}.
|
|
1749
1783
|
* Squid-reserved keys are stripped server-side, and values are validated/normalized against the target
|
|
@@ -1868,14 +1902,22 @@ export interface BulkIngestionFileStatus {
|
|
|
1868
1902
|
* Machine-readable class of a failed file, for outcomes to treat differently from real failures.
|
|
1869
1903
|
* Terminal — reported with `retryable: false` — are `'CONTENT_TOO_LARGE'` (past the per-context
|
|
1870
1904
|
* ceiling), `'ENCRYPTED_DOCUMENT'`, `'NO_EMBEDDABLE_CONTENT'`, `'SOURCE_OVER_PROVIDER_LIMIT'` (the
|
|
1871
|
-
* bytes exceed what the extraction provider accepts)
|
|
1905
|
+
* bytes exceed what the extraction provider accepts), `'UNREADABLE_WORKBOOK'` (a spreadsheet whose
|
|
1906
|
+
* content the parser cannot read) and `'UNSUPPORTED_FILE_TYPE'`.
|
|
1872
1907
|
* `'DUPLICATE_CONTENT'` is a skip rather than a failure: the KB already holds this content.
|
|
1873
1908
|
* `'EXTRACTION_TIMED_OUT'` stays retryable — the deadline is contended, so a borderline document can
|
|
1874
|
-
* cross it under load. `'
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
1909
|
+
* cross it under load. So do `'SOURCE_UNREACHABLE'` (the provider could not fetch the source, which a
|
|
1910
|
+
* fresh link can fix) and `'PROVIDER_ACCESS_DENIED'` (the provider refused the credential or its quota is
|
|
1911
|
+
* spent, a fault of the environment). `'JOB_FULL'`: the job's request ceiling had no room left for this
|
|
1912
|
+
* file, so re-submit it in a fresh job; a file that alone exceeds the ceiling fails this way in every job.
|
|
1913
|
+
* Additive; absent for ordinary failures.
|
|
1914
|
+
*/
|
|
1915
|
+
errorCode?: 'CONTENT_TOO_LARGE' | 'DUPLICATE_CONTENT' | 'ENCRYPTED_DOCUMENT' | 'EXTRACTION_TIMED_OUT' | 'JOB_FULL' | 'NO_EMBEDDABLE_CONTENT' | 'PROVIDER_ACCESS_DENIED' | 'SOURCE_OVER_PROVIDER_LIMIT' | 'SOURCE_UNREACHABLE' | 'UNREADABLE_WORKBOOK' | 'UNSUPPORTED_FILE_TYPE';
|
|
1916
|
+
/**
|
|
1917
|
+
* Present only on a failed file an extraction provider answered: a stable fingerprint of that answer
|
|
1918
|
+
* (provider, HTTP status and provider code), so a caller can tell the same failure repeating from a new one.
|
|
1877
1919
|
*/
|
|
1878
|
-
|
|
1920
|
+
errorSignature?: string;
|
|
1879
1921
|
/**
|
|
1880
1922
|
* Present only on a failed file: the same bytes fail the same way, so a caller must park the file
|
|
1881
1923
|
* instead of re-submitting it. Absence means retryable.
|
|
@@ -1888,7 +1930,25 @@ export interface BulkIngestionFileStatus {
|
|
|
1888
1930
|
imageFailures?: Array<ContextImageFailure>;
|
|
1889
1931
|
/** Total number of failed images, which exceeds `imageFailures.length` when the list was capped. */
|
|
1890
1932
|
imageFailureCount?: number;
|
|
1933
|
+
/**
|
|
1934
|
+
* Set on a `completed` file that is stored and searchable but that the job withheld from graph indexing;
|
|
1935
|
+
* the bulk counterpart of {@link UpsertKnowledgeBaseContextsResponse.graphIndexingSkippedContextIds}, and
|
|
1936
|
+
* `graphIndexingSkipReason` says why. Records the job's own outcome: it is written when the job's graph
|
|
1937
|
+
* run admits its files, which can be after the job completes (a poll of the job status sees it, the
|
|
1938
|
+
* terminal push may not), and it stays set even if a later graph build indexes the file.
|
|
1939
|
+
*/
|
|
1940
|
+
graphIndexingSkipped?: boolean;
|
|
1941
|
+
/** Why graph indexing was withheld; present exactly when `graphIndexingSkipped` is. */
|
|
1942
|
+
graphIndexingSkipReason?: BulkIngestionGraphSkipReason;
|
|
1891
1943
|
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Why a bulk-ingested file was withheld from graph indexing. `'cap'`: the knowledge base is over its
|
|
1946
|
+
* per-KB graph chunk cap (or the cap could not be checked and the job failed closed), so the file stays
|
|
1947
|
+
* out until the cap allows it. `'queue'`: the graph-indexing queue was full when the file finalized; the
|
|
1948
|
+
* file is left to the graph auto-build sweep, which indexes it under the same cap once the job goes quiet.
|
|
1949
|
+
* @category AI
|
|
1950
|
+
*/
|
|
1951
|
+
export type BulkIngestionGraphSkipReason = 'cap' | 'queue';
|
|
1892
1952
|
/**
|
|
1893
1953
|
* Why a whole bulk-ingestion staging call was refused, on the `details` of its 400 response. The
|
|
1894
1954
|
* refusal names the one context that caused it, so a caller recording per-file outcomes charges only
|
|
@@ -78,6 +78,10 @@ export interface AnswerOpenAiVoiceCallRequest {
|
|
|
78
78
|
model?: string;
|
|
79
79
|
/** Voice of the realtime model; defaults to the integration's default voice. */
|
|
80
80
|
voice?: string;
|
|
81
|
+
/** Whether caller speech interrupts the realtime model. Omitted values keep OpenAI's default. */
|
|
82
|
+
allowInterruptions?: boolean;
|
|
83
|
+
/** How readily OpenAI detects caller speech. Omitted values keep OpenAI's default. */
|
|
84
|
+
interruptionSensitivity?: 'low' | 'normal' | 'high';
|
|
81
85
|
/** Instructions of the realtime model. */
|
|
82
86
|
instructions: string;
|
|
83
87
|
/** Spoken as soon as the call is answered; without it the model waits for the caller to speak first. */
|
|
@@ -124,6 +128,10 @@ export interface StartOpenAiWebVoiceCallRequest {
|
|
|
124
128
|
model?: string;
|
|
125
129
|
/** Voice of the realtime model. */
|
|
126
130
|
voice?: string;
|
|
131
|
+
/** Whether caller speech interrupts the model; defaults to the phone line, then OpenAI's default. */
|
|
132
|
+
allowInterruptions?: boolean;
|
|
133
|
+
/** How readily caller speech is detected; defaults to the phone line, then OpenAI's default. */
|
|
134
|
+
interruptionSensitivity?: 'low' | 'normal' | 'high';
|
|
127
135
|
/** Language the call starts in, as an ISO code or BCP-47 tag. */
|
|
128
136
|
language?: string;
|
|
129
137
|
/** Whether the caller may switch language mid-call. */
|
|
@@ -14,7 +14,7 @@ export declare const AUTH_INTEGRATION_TYPES: readonly ["auth0", "jwt_rsa", "jwt_
|
|
|
14
14
|
* `AiAgentMcpServerConfig.oauthIntegrationId`). Kept in sync with the providers supported by the
|
|
15
15
|
* MCP OAuth validation in core.
|
|
16
16
|
*/
|
|
17
|
-
export declare const MCP_OAUTH_INTEGRATION_TYPES: readonly ["auth0"];
|
|
17
|
+
export declare const MCP_OAUTH_INTEGRATION_TYPES: readonly ["auth0", "azure-entra-id", "azure-entra-external-id"];
|
|
18
18
|
/** Supported integration types for GraphQL-based services. */
|
|
19
19
|
export declare const GRAPHQL_INTEGRATION_TYPES: readonly ["graphql"];
|
|
20
20
|
/** Supported integration types for HTTP-based services. */
|
|
@@ -84,4 +84,18 @@ export interface AsyncJob<T = any> {
|
|
|
84
84
|
* This is optional.
|
|
85
85
|
*/
|
|
86
86
|
error?: string;
|
|
87
|
+
/**
|
|
88
|
+
* A machine-readable category for the error, if the job has failed. Lets a caller branch on the
|
|
89
|
+
* failure kind (e.g. `'AI_PROVIDER_ERROR'`) without parsing {@link error}.
|
|
90
|
+
*/
|
|
91
|
+
errorType?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* An `Error` carrying a machine-readable {@link errorType}, thrown by `JobClient.awaitJob` when a
|
|
95
|
+
* failed job's {@link AsyncJob.errorType} is set. Lets a caller branch on the failure kind (e.g.
|
|
96
|
+
* `'AI_PROVIDER_ERROR'`) without parsing `message`.
|
|
97
|
+
*/
|
|
98
|
+
export interface JobError extends Error {
|
|
99
|
+
/** The category the failed job's error was tagged with, if any (e.g. `'AI_PROVIDER_ERROR'`). */
|
|
100
|
+
errorType?: string;
|
|
87
101
|
}
|
|
@@ -205,6 +205,18 @@ export interface AiKnowledgeBaseContextSizeRequest {
|
|
|
205
205
|
/** The ID of the AIKnowledgeBase */
|
|
206
206
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
207
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Request structure for the internal test-only route that arms an app's next bulk-ingestion fulltext blob
|
|
210
|
+
* operations to fail, so the staging and finalize fallbacks can be exercised without a storage outage.
|
|
211
|
+
*/
|
|
212
|
+
export interface AiKnowledgeBaseFailNextBulkFulltextBlobOpsRequest {
|
|
213
|
+
/** The ID of the App */
|
|
214
|
+
appId: AppId;
|
|
215
|
+
/** How many blob uploads land before the next one fails; omitted leaves uploads alone. */
|
|
216
|
+
uploadsBeforeFailure?: number;
|
|
217
|
+
/** How many blob reads land before the next one fails; omitted leaves reads alone. */
|
|
218
|
+
readsBeforeFailure?: number;
|
|
219
|
+
}
|
|
208
220
|
/**
|
|
209
221
|
* Request structure for the internal test-only route that arms the next `count` grep scans of a
|
|
210
222
|
* knowledge base to fail at their `maxTimeMS` deadline.
|
|
@@ -216,7 +228,52 @@ export interface AiKnowledgeBaseFailNextGrepScansRequest {
|
|
|
216
228
|
knowledgeBaseId: AiKnowledgeBaseId;
|
|
217
229
|
/** How many upcoming scans fail; a non-positive value disarms. */
|
|
218
230
|
count: number;
|
|
231
|
+
/** Whether the next truncated-file-name lookup fails; false disarms, absent leaves it alone. */
|
|
232
|
+
failNextTruncatedNameLookup?: boolean;
|
|
219
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Where an armed bulk finalize failure throws: past the destructive-write boundary but before the vector
|
|
236
|
+
* write (nothing written), or right after it (the vectors are replaced, the record is not).
|
|
237
|
+
*/
|
|
238
|
+
export type BulkFinalizeFailurePhase = 'beforeVectorWrite' | 'afterVectorWrite';
|
|
239
|
+
/**
|
|
240
|
+
* Request structure for the internal test-only route that arms the next `count` bulk-ingestion finalizes
|
|
241
|
+
* of a knowledge base to throw at `phase`.
|
|
242
|
+
*/
|
|
243
|
+
export interface AiKnowledgeBaseFailNextBulkFinalizeWritesRequest {
|
|
244
|
+
/** The ID of the App */
|
|
245
|
+
appId: AppId;
|
|
246
|
+
/** The ID of the AIKnowledgeBase */
|
|
247
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
248
|
+
/** How many upcoming finalizes fail; a non-positive value disarms. */
|
|
249
|
+
count: number;
|
|
250
|
+
/** Where in the finalize the armed failures throw. */
|
|
251
|
+
phase: BulkFinalizeFailurePhase;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Request structure for the internal test-only route that arms the next `count` finalize-time
|
|
255
|
+
* image-description reads of a bulk-ingested knowledge base to fail.
|
|
256
|
+
*/
|
|
257
|
+
export interface AiKnowledgeBaseFailNextImageDescriptionReadsRequest {
|
|
258
|
+
/** The ID of the App */
|
|
259
|
+
appId: AppId;
|
|
260
|
+
/** The ID of the AIKnowledgeBase */
|
|
261
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
262
|
+
/** How many upcoming reads fail; zero disarms. */
|
|
263
|
+
count: number;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Request structure for the internal test-only route that answers every image with a description derived
|
|
267
|
+
* from its own bytes and no vision call, so the sync and bulk lanes describe a file identically.
|
|
268
|
+
*/
|
|
269
|
+
export interface AiKnowledgeBaseStubImageDescriptionsRequest {
|
|
270
|
+
/** The ID of the App */
|
|
271
|
+
appId: AppId;
|
|
272
|
+
/** Arms the stub when true, disarms it when false. */
|
|
273
|
+
enabled: boolean;
|
|
274
|
+
}
|
|
275
|
+
/** Leading text of a stubbed image description; the rest is the sha256 of the image bytes. */
|
|
276
|
+
export declare const STUB_IMAGE_DESCRIPTION_PREFIX = "Stubbed image description sha256:";
|
|
220
277
|
/**
|
|
221
278
|
* Request structure for the internal test-only route that makes one knowledge base's graph be built by
|
|
222
279
|
* the deterministic stub extractor instead of by the model.
|
|
@@ -457,6 +514,53 @@ export interface AiKnowledgeBaseBackfillFulltextStatus {
|
|
|
457
514
|
storedPartCount?: number;
|
|
458
515
|
errorMessage?: string;
|
|
459
516
|
}
|
|
517
|
+
/** Longest context batch one `repairBulkFulltext` call accepts; larger work-lists are split by the caller. */
|
|
518
|
+
export declare const REPAIR_BULK_FULLTEXT_MAX_CONTEXTS_PER_CALL = 20;
|
|
519
|
+
/**
|
|
520
|
+
* Request structure for rebuilding the stored raw text (`kb_fulltext`) of bulk-ingested contexts from the
|
|
521
|
+
* bulk-ingestion rows their job retained: the staged pages plus the descriptions its `imageDescription`
|
|
522
|
+
* requests already produced. No vision call, so a repaired context reads exactly as a freshly ingested
|
|
523
|
+
* one at no model cost.
|
|
524
|
+
*/
|
|
525
|
+
export interface AiKnowledgeBaseRepairBulkFulltextRequest {
|
|
526
|
+
/** The ID of the AIKnowledgeBase */
|
|
527
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
528
|
+
/**
|
|
529
|
+
* The ids of the contexts to repair, at most {@link REPAIR_BULK_FULLTEXT_MAX_CONTEXTS_PER_CALL} per
|
|
530
|
+
* call. Each context's stored text is fully replaced, so re-running a context is safe.
|
|
531
|
+
*/
|
|
532
|
+
contextIds: Array<AiContextId>;
|
|
533
|
+
/**
|
|
534
|
+
* Rebuilds a context whose staged pages are gone by re-extracting its stored source file, which runs
|
|
535
|
+
* the regular document lane and can bill OCR. Off by default; such contexts are skipped without it.
|
|
536
|
+
*/
|
|
537
|
+
reextractMissingPages?: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* The extraction method of the {@link reextractMissingPages} fallback, defaulting to the server's
|
|
540
|
+
* regular one. Name the method the original ingest used: a file extracted with OCR yields no text for
|
|
541
|
+
* its scanned pages under a method that does not run it, replacing the context's text with less of it.
|
|
542
|
+
*/
|
|
543
|
+
extractionMethod?: DocumentExtractionMethod;
|
|
544
|
+
}
|
|
545
|
+
/** Response structure for a `repairBulkFulltext` call: one status per requested context, in request order. */
|
|
546
|
+
export interface AiKnowledgeBaseRepairBulkFulltextResponse {
|
|
547
|
+
statuses: Array<AiKnowledgeBaseRepairBulkFulltextStatus>;
|
|
548
|
+
}
|
|
549
|
+
/** Outcome of repairing the raw text of one bulk-ingested context. */
|
|
550
|
+
export interface AiKnowledgeBaseRepairBulkFulltextStatus {
|
|
551
|
+
contextId: AiContextId;
|
|
552
|
+
/**
|
|
553
|
+
* `repairedFromReextraction` rebuilt the pages from the stored source file because the row's own were
|
|
554
|
+
* gone: a fresh extraction, so its text is best-effort rather than the original's. `raced` means another
|
|
555
|
+
* ingest took the context over during the repair, so re-run it.
|
|
556
|
+
*/
|
|
557
|
+
status: 'repaired' | 'repairedFromReextraction' | 'raced' | 'error' | 'skipped';
|
|
558
|
+
/** Why the context was left untouched, when it was skipped. `noJob` cannot be repaired by re-running. */
|
|
559
|
+
skippedReason?: 'notBulkIngested' | 'noJob' | 'jobActive' | 'noFileRow' | 'notFinalized' | 'pagesBounded' | 'noDescriptionRows' | 'noPages' | 'reingested';
|
|
560
|
+
/** How many parts (pages/sheets/image descriptions) were stored, on success. */
|
|
561
|
+
storedPartCount?: number;
|
|
562
|
+
errorMessage?: string;
|
|
563
|
+
}
|
|
460
564
|
/**
|
|
461
565
|
* Response structure for getting size of context
|
|
462
566
|
* @category AI
|
|
@@ -6,6 +6,7 @@ export interface ObservableNameMetrics {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const ObservableNames: {
|
|
8
8
|
readonly nativeQuery: ObservableNameMetrics;
|
|
9
|
+
readonly registerQuery: ObservableNameMetrics;
|
|
9
10
|
readonly query: ObservableNameMetrics;
|
|
10
11
|
readonly mutate: ObservableNameMetrics;
|
|
11
12
|
readonly functionExecution: ObservableNameMetrics;
|
|
@@ -130,6 +131,8 @@ export interface AgentAuditLogUpdateEvent {
|
|
|
130
131
|
}
|
|
131
132
|
/** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
|
|
132
133
|
export declare const O11Y_TAG_IS_ERROR = "isError";
|
|
134
|
+
/** Tag naming the organization an application belongs to. */
|
|
135
|
+
export declare const O11Y_TAG_ORG_ID = "organizationId";
|
|
133
136
|
/** Tag for log events. Metrics have an explicit appId field. */
|
|
134
137
|
export declare const O11Y_TAG_APP_ID = "appId";
|
|
135
138
|
/** Tag for metric and log events. */
|
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
import { AppId } from '../public-types/communication.public-types';
|
|
2
2
|
import { Stage } from '../types/stage';
|
|
3
|
-
export declare const KOTLIN_CONTROLLERS: string[];
|
|
4
|
-
/**
|
|
5
|
-
* Returns true if the given path is served by Kotlin core in local dev (port 8001). All `/ws/*`
|
|
6
|
-
* WebSocket paths are served by the TypeScript core (port 8000).
|
|
7
|
-
*/
|
|
8
|
-
export declare function isKotlinPath(path: string): boolean;
|
|
9
3
|
export declare function getEnvironmentPrefix(shard: string | undefined, region: string, cloudId: string, stage: Stage): string;
|
|
10
|
-
export declare function getApplicationUrl(environmentPrefix: string, appId: string, path: string, appIdPlaceholder?: AppId, environmentPrefixPlaceholder?: string
|
|
11
|
-
/**
|
|
12
|
-
* Returns the URL of [path] on the `core-query-kotlin` Service, addressed from inside the cluster.
|
|
13
|
-
*
|
|
14
|
-
* Naming the Service rather than building the public URL with {@link getApplicationUrl} keeps a
|
|
15
|
-
* purely intra-cluster call off the external load balancer, which is what the Kotlin core's own
|
|
16
|
-
* `getApplicationUrlInternal` already does for the hop in the other direction; and it makes the call
|
|
17
|
-
* independent of where ingress sends [path], so moving that route cannot turn a forward into a
|
|
18
|
-
* request back to this core.
|
|
19
|
-
*
|
|
20
|
-
* The Service is shared and not per-app, so the application is identified by the
|
|
21
|
-
* `SquidHeaders.APP_ID` header rather than by the hostname. Local development has no cluster DNS and
|
|
22
|
-
* keeps the per-app host on Kotlin's port.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getQueryKotlinServiceUrl(environmentPrefix: string, appId: AppId, path: string): string;
|
|
4
|
+
export declare function getApplicationUrl(environmentPrefix: string, appId: string, path: string, appIdPlaceholder?: AppId, environmentPrefixPlaceholder?: string): string;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export declare function sortKeys(json: unknown): any;
|
|
2
2
|
export declare function normalizeJsonAsString(json: unknown): string;
|
|
3
3
|
export declare function serializeObj(obj: unknown): string;
|
|
4
|
+
/**
|
|
5
|
+
* A `JSON.stringify` replacer writing a `Date` as `{ $date }`, the form {@link deserializeObj} reads back,
|
|
6
|
+
* for callers that keep every other value's own `toJSON`. The date is read off the holder, since a
|
|
7
|
+
* replacer is handed the `toJSON` text of a date; an invalid date keeps that text, `null`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeDateAsBson(this: Record<string, unknown>, key: string, value: unknown): unknown;
|
|
4
10
|
export declare function deserializeObj<T = any>(str: string): T;
|
|
5
11
|
/**
|
|
6
12
|
* Deserializes a multipart request payload when present.
|
|
@@ -18,6 +18,7 @@ export declare class DocumentReference<T extends DocumentData = any> {
|
|
|
18
18
|
private readonly dataManager;
|
|
19
19
|
private readonly queryBuilderFactory;
|
|
20
20
|
private readonly projectFields?;
|
|
21
|
+
private readonly identityReference?;
|
|
21
22
|
/** A string that uniquely identifies this document reference. */
|
|
22
23
|
refId: string;
|
|
23
24
|
/**
|
|
@@ -33,8 +33,9 @@ export declare class JobClient {
|
|
|
33
33
|
*/
|
|
34
34
|
getJob<T = any>(jobId: JobId): Promise<AsyncJob<T> | undefined>;
|
|
35
35
|
/**
|
|
36
|
-
* Waits until the specified job finishes, then resolves with its result or
|
|
37
|
-
*
|
|
36
|
+
* Waits until the specified job finishes, then resolves with its result or throws if the job
|
|
37
|
+
* fails. The thrown error is a {@link JobError}: check its `errorType` (e.g. `'AI_PROVIDER_ERROR'`)
|
|
38
|
+
* to branch on the failure kind without parsing `message`.
|
|
38
39
|
*
|
|
39
40
|
* @param jobId A unique, private identifier for the job.
|
|
40
41
|
* Do **not** reuse a `jobId` across clients—possessing the ID
|