@squidcloud/client 1.0.502 → 1.0.504

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/index.js +1 -1
  3. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +28 -2
  4. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +3 -3
  5. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +30 -8
  6. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +5 -0
  7. package/dist/internal-common/src/public-types/ai-voice.public-types.d.ts +16 -0
  8. package/dist/internal-common/src/public-types/context.public-types.d.ts +2 -0
  9. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +1 -1
  10. package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
  11. package/dist/internal-common/src/public-types/langgraph.public-types.d.ts +86 -0
  12. package/dist/internal-common/src/public-types/session.public-types.d.ts +82 -0
  13. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +4 -4
  14. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +1 -1
  15. package/dist/typescript-client/src/index.d.ts +1 -0
  16. package/dist/typescript-client/src/langgraph-client.d.ts +23 -1
  17. package/dist/typescript-client/src/public-types.d.ts +1 -0
  18. package/dist/typescript-client/src/session-client.d.ts +21 -0
  19. package/dist/typescript-client/src/squid.d.ts +12 -0
  20. package/dist/typescript-client/src/version.d.ts +1 -1
  21. package/package.json +1 -1
  22. package/dist/internal-common/src/ai/system-openai-compatible.d.ts +0 -35
  23. package/dist/internal-common/src/metric-name.d.ts +0 -5
  24. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +0 -30
  25. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +0 -161
  26. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +0 -75
  27. package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +0 -193
  28. package/dist/internal-common/src/types/ai-agent.types.d.ts +0 -304
  29. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +0 -798
  30. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +0 -19
  31. package/dist/internal-common/src/types/backend-function.types.d.ts +0 -1
  32. package/dist/internal-common/src/types/communication.types.d.ts +0 -1
  33. package/dist/internal-common/src/types/document.types.d.ts +0 -1
  34. package/dist/internal-common/src/types/file.types.d.ts +0 -6
  35. package/dist/internal-common/src/types/headers.types.d.ts +0 -45
  36. package/dist/internal-common/src/types/management-api-key.types.d.ts +0 -92
  37. package/dist/internal-common/src/types/mutation.types.d.ts +0 -1
  38. package/dist/internal-common/src/types/notification.types.d.ts +0 -19
  39. package/dist/internal-common/src/types/observability.types.d.ts +0 -296
  40. package/dist/internal-common/src/types/query.types.d.ts +0 -21
  41. package/dist/internal-common/src/types/secret.types.d.ts +0 -7
  42. package/dist/internal-common/src/types/socket.types.d.ts +0 -1
  43. package/dist/internal-common/src/types/stage.d.ts +0 -9
  44. package/dist/internal-common/src/types/time-units.d.ts +0 -1
  45. package/dist/internal-common/src/types/url-shortener.types.d.ts +0 -45
  46. package/dist/internal-common/src/utils/array.d.ts +0 -7
  47. package/dist/internal-common/src/utils/connector-path-status.d.ts +0 -27
  48. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +0 -2
  49. package/dist/internal-common/src/utils/file-utils.d.ts +0 -2
  50. package/dist/internal-common/src/utils/global.utils.d.ts +0 -1
  51. package/dist/internal-common/src/utils/http-utils.d.ts +0 -15
  52. package/dist/internal-common/src/utils/http.d.ts +0 -4
  53. package/dist/internal-common/src/utils/integration-access-tokens.d.ts +0 -15
  54. package/dist/internal-common/src/utils/lock.manager.d.ts +0 -14
  55. package/dist/internal-common/src/utils/metric-utils.d.ts +0 -4
  56. package/dist/internal-common/src/utils/metrics.types.d.ts +0 -7
  57. package/dist/internal-common/src/utils/object.d.ts +0 -93
  58. package/dist/internal-common/src/utils/serialization.d.ts +0 -30
  59. package/dist/internal-common/src/utils/squid.constants.d.ts +0 -3
  60. package/dist/internal-common/src/utils/trace-id-generator.d.ts +0 -1
  61. package/dist/internal-common/src/utils/validation.d.ts +0 -21
  62. package/dist/internal-common/src/websocket.impl.d.ts +0 -26
@@ -1,798 +0,0 @@
1
- import { AiEmbeddingsModelWithOptionalFields, AiKnowledgeBase, AiKnowledgeBaseChatOptions, AiKnowledgeBaseContext, AiKnowledgeBaseContextRequest, AiKnowledgeBaseGraphContext, AiKnowledgeBaseGraphSearchOptions, AiKnowledgeBaseSearchResultChunk } from '../public-types/ai-knowledge-base.public-types';
2
- import { AiContextId, AiKnowledgeBaseId, AppId } from '../public-types/communication.public-types';
3
- import { DocumentExtractionMethod } from '../public-types/extraction.public-types';
4
- /**
5
- * Internal (eval-harness-only) extension of the public graph search options. `graphOnly` returns just the
6
- * graph channel's chunks (measures the graph's marginal recall) instead of the public `fused` behavior;
7
- * it is not exposed in public-types because production callers always fuse. The graph channel accepts
8
- * this shape at runtime, so eval specs cast their options to it. Themes-level "global" answering is NOT a
9
- * search mode — it moved to the `globalSummary` op of `queryKnowledgeGraph`.
10
- * @category AI
11
- */
12
- export interface AiKnowledgeBaseGraphSearchOptionsInternal extends AiKnowledgeBaseGraphSearchOptions {
13
- /** Internal/eval-only: `'graphOnly'` returns only the graph channel; `'fused'` (default) RRF-merges with hybrid. */
14
- mode?: 'graphOnly' | 'fused';
15
- }
16
- /**
17
- * Request structure for getting an AiKnowledgeBase
18
- * @category AI
19
- */
20
- export interface GetAiKnowledgeBaseRequest {
21
- /** The id of the app */
22
- appId: AppId;
23
- /** The id of the AiKnowledgeBase */
24
- knowledgeBaseId: AiKnowledgeBaseId;
25
- }
26
- /**
27
- * Request structure for getting all AiKnowledgeBases
28
- * @category AI
29
- */
30
- export interface GetAiKnowledgeBasesRequest {
31
- /** The id of the app */
32
- appId: AppId;
33
- }
34
- /**
35
- * Response structure for getting an AiKnowledgeBase
36
- * @category AI
37
- */
38
- export interface GetAiKnowledgeBaseResponse {
39
- /** The resulting AiKnowledgeBase, if it is found */
40
- knowledgeBase: AiKnowledgeBase | undefined;
41
- }
42
- /**
43
- * Request structure for deleting an AiKnowledgeBase
44
- * @category AI
45
- */
46
- export interface DeleteAiKnowledgeBaseRequest {
47
- /** The id of the AiKnowledgeBase */
48
- id: string;
49
- }
50
- /**
51
- * Request structure for upserting an AiKnowledgeBase
52
- * @category AI
53
- */
54
- export interface UpsertAiKnowledgeBaseRequest {
55
- /** The AiKnowledgeBase to upsert */
56
- knowledgeBase: Omit<AiEmbeddingsModelWithOptionalFields, 'appId' | 'updatedAt'>;
57
- }
58
- /**
59
- * Response structure for listing AiKnowledgeBases
60
- * @category AI
61
- */
62
- export interface ListAiKnowledgeBasesResponse {
63
- /** The list of AiKnowledgeBases */
64
- knowledgeBases: Array<AiKnowledgeBase>;
65
- }
66
- /**
67
- * Request structure for listing AiKnowledgeBaseContexts
68
- * @category AI
69
- * @deprecated Fetches every context in one call with no pagination — expensive for large knowledge
70
- * bases. Use {@link ListAiKnowledgeBaseContextsPageRequest} instead.
71
- */
72
- export interface ListAiKnowledgeBaseContextsRequest {
73
- /** The id of the AiKnowledgeBase */
74
- id: string;
75
- /** The number of characters after which text is truncated. Optional */
76
- truncateTextAfter?: number;
77
- }
78
- /**
79
- * Response structure to list AiKnowledgeBaseContexts
80
- * @category AI
81
- * @deprecated See {@link ListAiKnowledgeBaseContextsRequest}.
82
- */
83
- export interface ListAiKnowledgeBaseContextsResponse {
84
- /** The list of AiKnowledgeBaseContexts */
85
- contexts: Array<AiKnowledgeBaseContext>;
86
- }
87
- /**
88
- * Response structure to list contextids for an AiKnowledgeBase
89
- * @category AI
90
- */
91
- export interface ListAiKnowledgeBaseContextIdsResponse {
92
- /** The list of AiContextIds */
93
- contextIds: Array<AiContextId>;
94
- }
95
- /**
96
- * Request structure for deleting AiKnowledgeBaseContexts
97
- * @category AI
98
- */
99
- export interface DeleteAiKnowledgeBaseContextsRequest {
100
- /** The id of the AiKnowledgeBase */
101
- knowledgeBaseId: string;
102
- /** An array of AiKnowledgeBaseContext ids */
103
- contextIds: Array<string>;
104
- }
105
- /**
106
- * Request structure for replacing the access scopes of a single AiKnowledgeBaseContext.
107
- * @category AI
108
- */
109
- export interface SetAiKnowledgeBaseContextScopesRequest {
110
- /** The id of the AiKnowledgeBase */
111
- knowledgeBaseId: string;
112
- /** The id of the AiKnowledgeBaseContext whose scopes are replaced */
113
- contextId: string;
114
- /** The scopes that grant read access to this context. An empty array makes it visible to everyone. */
115
- scopes: Array<string>;
116
- }
117
- /**
118
- * Response structure for replacing the access scopes of a single AiKnowledgeBaseContext.
119
- * @category AI
120
- */
121
- export interface SetAiKnowledgeBaseContextScopesResponse {
122
- /** How many chunks of the context had their scopes rewritten. */
123
- updatedChunkCount: number;
124
- }
125
- /**
126
- * Where a context stands in its version family, as computed by the source that owns the family rules.
127
- * @category AI
128
- */
129
- export interface AiKnowledgeBaseContextVersionState {
130
- /** Stable id of the family, namespaced by the source (integration + site/drive). */
131
- familyId: string;
132
- /** Sortable rank key within the family: larger is more final. */
133
- versionKey: string;
134
- /** Revision of the rule set that produced this state. */
135
- rulesRevision: string;
136
- /** Whether a newer version of the same document makes this one superseded. */
137
- superseded: boolean;
138
- /** The context that supersedes this one; present when `superseded`. */
139
- winnerContextId?: string;
140
- /** Why the winner ranks above this context (`final-marker`, `higher-version`, ...). */
141
- reason?: string;
142
- }
143
- /** Most contexts one {@link SetAiKnowledgeBaseContextVersionStatesRequest} may carry. */
144
- export declare const MAX_AI_KNOWLEDGE_BASE_VERSION_STATE_BATCH = 250;
145
- /**
146
- * One context and its new version state.
147
- * @category AI
148
- */
149
- export interface AiKnowledgeBaseContextVersionStateItem {
150
- /** The id of the AiKnowledgeBaseContext whose version state is replaced */
151
- contextId: string;
152
- /** The new version state; absent clears it, which makes the context a regular, never-superseded one. */
153
- versionState?: AiKnowledgeBaseContextVersionState;
154
- }
155
- /**
156
- * Request structure for replacing the version state of a batch of AiKnowledgeBaseContexts.
157
- * @category AI
158
- */
159
- export interface SetAiKnowledgeBaseContextVersionStatesRequest {
160
- /** The id of the AiKnowledgeBase */
161
- knowledgeBaseId: string;
162
- /** At most {@link MAX_AI_KNOWLEDGE_BASE_VERSION_STATE_BATCH} items, each context at most once. */
163
- items: Array<AiKnowledgeBaseContextVersionStateItem>;
164
- }
165
- /**
166
- * The outcome for one context of a {@link SetAiKnowledgeBaseContextVersionStatesRequest}.
167
- * @category AI
168
- */
169
- export interface AiKnowledgeBaseContextVersionStateResult {
170
- contextId: string;
171
- /** False when no record exists for the context (not ingested yet, or deleted); nothing was written then. */
172
- applied: boolean;
173
- /** Whether the context's content is now hidden from search candidates. */
174
- hidden: boolean;
175
- }
176
- /**
177
- * Response structure for replacing the version state of a batch of AiKnowledgeBaseContexts.
178
- * @category AI
179
- */
180
- export interface SetAiKnowledgeBaseContextVersionStatesResponse {
181
- /** One result per request item, in request order. */
182
- results: Array<AiKnowledgeBaseContextVersionStateResult>;
183
- }
184
- /**
185
- * Request structure for getting an AiKnowledgeBaseContext
186
- * @category AI
187
- */
188
- export interface GetAiKnowledgeBaseContextRequest {
189
- /** The id of the AiKnowledgeBase */
190
- knowledgeBaseId: string;
191
- /** The id of the AiKnowledgeBaseContext */
192
- contextId: string;
193
- /** The number of characters after which text is truncated. Optional */
194
- truncateTextAfter?: number;
195
- }
196
- /**
197
- * Request structure for getting a page of AiKnowledgeBaseContexts
198
- * for a given knowledge base
199
- * @category AI
200
- */
201
- export interface GetAiKnowledgeBaseContextsRequest {
202
- /** The id of the app */
203
- appId: AppId;
204
- /** The id of the AiKnowledgeBase */
205
- knowledgeBaseId: AiKnowledgeBaseId;
206
- /** The number of characters after which text is truncated. Optional */
207
- truncateTextAfter?: number;
208
- /** The number of contexts to skip, for pagination. Optional */
209
- offset?: number;
210
- /** The maximum number of contexts to return, for pagination. Optional */
211
- limit?: number;
212
- /** Case-insensitive substring search across id/title only. Optional */
213
- search?: string;
214
- }
215
- /**
216
- * Response structure for getting a page of AiKnowledgeBaseContexts for a given knowledge base
217
- * @category AI
218
- */
219
- export interface GetAiKnowledgeBaseContextsResponse {
220
- /** The requested page of AiKnowledgeBaseContexts */
221
- contexts: Array<AiKnowledgeBaseContext>;
222
- /** The total number of contexts in the AiKnowledgeBase, ignoring offset/limit */
223
- totalCount: number;
224
- }
225
- /**
226
- * Response structure for getting an AiKnowledgeBaseContext
227
- * @category AI
228
- */
229
- export interface GetAiKnowledgeBaseContextResponse {
230
- /** The resulting AiKnowledgeBaseContext, if it is found */
231
- context: AiKnowledgeBaseContext | undefined;
232
- }
233
- /**
234
- * Request structure for upserting context for an AiKnowledgeBase
235
- * @category AI
236
- */
237
- export interface UpsertAiKnowledgeBaseContextsRequest {
238
- /** The id of the AiKnowledgeBase */
239
- knowledgeBaseId: string;
240
- /** The AiKnowledgeBaseContext data, which could be a file or text */
241
- contextRequests: Array<AiKnowledgeBaseContextRequest>;
242
- /** The job ID to use for the async upsert job */
243
- jobId: string;
244
- }
245
- /**
246
- * Response structure for searching an AiKnowledgeBase
247
- * @category AI
248
- */
249
- export interface AiKnowledgeBaseSearchResponse {
250
- /** Array of result chunks from the search */
251
- chunks: Array<AiKnowledgeBaseSearchResultChunk>;
252
- /** Traversed subgraph for a `searchMode:'graph'` query with `includeGraphContext`; absent otherwise. */
253
- graphContext?: AiKnowledgeBaseGraphContext;
254
- }
255
- export type { ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GetKnowledgeBaseGraphStatusRequest, GetKnowledgeBaseGraphStatusResponse, KnowledgeBaseGraphBuildStageUsage, KnowledgeBaseGraphBuildUsage, KnowledgeBaseGraphEdge, KnowledgeBaseGraphFacetStatus, KnowledgeBaseGraphModelUsage, KnowledgeBaseGraphNode, KnowledgeBaseGraphQueryConcepts, KnowledgeBaseGraphQueryDoc, KnowledgeBaseGraphQueryGlobalSummary, KnowledgeBaseGraphQueryMatch, KnowledgeBaseGraphQueryOp, KnowledgeBaseGraphQueryPath, KnowledgeBaseGraphQueryRelationship, KnowledgeBaseGraphQuerySubtreeNode, KnowledgeBaseGraphQueuedRebuild, KnowledgeBaseGraphRebuildMode, KnowledgeBaseGraphResolutionProgress, KnowledgeBaseGraphResolutionStatus, KnowledgeBaseGraphStructuralBuildSkip, KnowledgeBaseGraphStructuralBuildSkipReason, KnowledgeBaseGraphTopic, KnowledgeBaseGraphTopicEdge, KnowledgeBaseGraphUsage, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, } from '../public-types/ai-knowledge-base.public-types';
256
- /**
257
- * Request structure for getting the size of context
258
- * for an AiKnowledgeBase
259
- * @category AI
260
- */
261
- export interface AiKnowledgeBaseContextSizeRequest {
262
- /** The ID of the App */
263
- appId: AppId;
264
- /** The ID of the AIKnowledgeBase */
265
- knowledgeBaseId: AiKnowledgeBaseId;
266
- }
267
- /**
268
- * Request structure for the internal test-only route that arms an app's next bulk-ingestion fulltext blob
269
- * operations to fail, so the staging and finalize fallbacks can be exercised without a storage outage.
270
- */
271
- export interface AiKnowledgeBaseFailNextBulkFulltextBlobOpsRequest {
272
- /** The ID of the App */
273
- appId: AppId;
274
- /** How many blob uploads land before the next one fails; omitted leaves uploads alone. */
275
- uploadsBeforeFailure?: number;
276
- /** How many blob reads land before the next one fails; omitted leaves reads alone. */
277
- readsBeforeFailure?: number;
278
- }
279
- /**
280
- * Request structure for the internal test-only route that arms the next `count` grep scans of a
281
- * knowledge base to fail at their `maxTimeMS` deadline.
282
- */
283
- export interface AiKnowledgeBaseFailNextGrepScansRequest {
284
- /** The ID of the App */
285
- appId: AppId;
286
- /** The ID of the AIKnowledgeBase */
287
- knowledgeBaseId: AiKnowledgeBaseId;
288
- /** How many upcoming scans fail; a non-positive value disarms. */
289
- count: number;
290
- /** Whether the next truncated-file-name lookup fails; false disarms, absent leaves it alone. */
291
- failNextTruncatedNameLookup?: boolean;
292
- }
293
- /**
294
- * Request structure for the internal test-only route that reports how many chunk-collection scope
295
- * resolutions a Mongo-backed knowledge base's filtered searches ran, and arms the next ones to fail.
296
- */
297
- export interface AiKnowledgeBaseChunkScopeResolutionsRequest {
298
- /** The ID of the App */
299
- appId: AppId;
300
- /** The ID of the AIKnowledgeBase */
301
- knowledgeBaseId: AiKnowledgeBaseId;
302
- /** How many upcoming chunk-collection resolutions fail at their `maxTimeMS` deadline; absent disarms. */
303
- failNext?: number;
304
- /** How many upcoming context-record lookups fail at their `maxTimeMS` deadline; absent disarms. */
305
- failNextRecordLookups?: number;
306
- }
307
- /** Response structure for {@link AiKnowledgeBaseChunkScopeResolutionsRequest}. */
308
- export interface AiKnowledgeBaseChunkScopeResolutionsResponse {
309
- /** How many chunk-collection scope resolutions ran since the previous request. */
310
- count: number;
311
- }
312
- /**
313
- * Where an armed bulk finalize failure throws: past the destructive-write boundary but before the vector
314
- * write (nothing written), or right after it (the vectors are replaced, the record is not).
315
- */
316
- export type BulkFinalizeFailurePhase = 'beforeVectorWrite' | 'afterVectorWrite';
317
- /**
318
- * Request structure for the internal test-only route that arms the next `count` bulk-ingestion finalizes
319
- * of a knowledge base to throw at `phase`.
320
- */
321
- export interface AiKnowledgeBaseFailNextBulkFinalizeWritesRequest {
322
- /** The ID of the App */
323
- appId: AppId;
324
- /** The ID of the AIKnowledgeBase */
325
- knowledgeBaseId: AiKnowledgeBaseId;
326
- /** How many upcoming finalizes fail; a non-positive value disarms. */
327
- count: number;
328
- /** Where in the finalize the armed failures throw. */
329
- phase: BulkFinalizeFailurePhase;
330
- }
331
- /**
332
- * Request structure for the internal test-only route that arms the next `count` finalize-time
333
- * image-description reads of a bulk-ingested knowledge base to fail.
334
- */
335
- export interface AiKnowledgeBaseFailNextImageDescriptionReadsRequest {
336
- /** The ID of the App */
337
- appId: AppId;
338
- /** The ID of the AIKnowledgeBase */
339
- knowledgeBaseId: AiKnowledgeBaseId;
340
- /** How many upcoming reads fail; zero disarms. */
341
- count: number;
342
- }
343
- /**
344
- * Request structure for the internal test-only route that answers every image with a description derived
345
- * from its own bytes and no vision call, so the sync and bulk lanes describe a file identically.
346
- */
347
- export interface AiKnowledgeBaseStubImageDescriptionsRequest {
348
- /** The ID of the App */
349
- appId: AppId;
350
- /** Arms the stub when true, disarms it when false. */
351
- enabled: boolean;
352
- }
353
- /** Leading text of a stubbed image description; the rest is the sha256 of the image bytes. */
354
- export declare const STUB_IMAGE_DESCRIPTION_PREFIX = "Stubbed image description sha256:";
355
- /**
356
- * Request structure for the internal test-only route that makes one knowledge base's graph be built by
357
- * the deterministic stub extractor instead of by the model.
358
- */
359
- export interface AiKnowledgeBaseEnableGraphStubExtractionRequest {
360
- /** The ID of the App */
361
- appId: AppId;
362
- /** The ID of the AIKnowledgeBase */
363
- knowledgeBaseId: AiKnowledgeBaseId;
364
- /** Gives every entity the stub's pseudo-vector, directive-seeded ones included, so none is embedded. */
365
- pseudoVectors?: boolean;
366
- }
367
- /**
368
- * Request structure for the internal test-only route that shrinks one knowledge base's resolution drain
369
- * bounds, so a small corpus needs several rounds or sweeps to drain.
370
- */
371
- export interface AiKnowledgeBaseSetGraphResolutionDrainBoundsRequest {
372
- /** The ID of the App */
373
- appId: AppId;
374
- /** The ID of the AIKnowledgeBase */
375
- knowledgeBaseId: AiKnowledgeBaseId;
376
- /** Dirty entities one resolution pass examines. */
377
- dirtyBatch: number;
378
- /** Drain rounds one sweep runs. */
379
- maxRounds: number;
380
- /** Candidate pairs one drain round adjudicates; the deployment default when absent. */
381
- maxPairsPerRound?: number;
382
- /** Resolution passes one drain round runs; the deployment default when absent. */
383
- maxPasses?: number;
384
- /** Adjudication calls kept in flight; the deployment default when absent. */
385
- adjudicationConcurrency?: number;
386
- /** Dirty entities one pass searches candidates for at once; the deployment default when absent. */
387
- proposalConcurrency?: number;
388
- }
389
- /**
390
- * Request structure for the internal test-only route that drops each entity's own hit from one knowledge
391
- * base's resolution ANN results, so a test can make every entity miss itself.
392
- */
393
- export interface AiKnowledgeBaseHideOwnResolutionHitsRequest {
394
- /** The ID of the App */
395
- appId: AppId;
396
- /** The ID of the AIKnowledgeBase */
397
- knowledgeBaseId: AiKnowledgeBaseId;
398
- }
399
- /**
400
- * Where a test can park a graph write. `merge-component` holds a resolution merge before it takes the write
401
- * lock for its component, `merge` between its snapshot read and its fence, and `merge-fenced` between its
402
- * fence and its first write; `entity-read-back` holds a finalize upsert before the read-back that names its
403
- * entities, and `entity-provenance` after that read-back's fallback, before its provenance write; `edge-write`
404
- * holds it before the edge write, the window its description pass occupies, and `edge-upsert` after the edge
405
- * write resolved its endpoints, before it writes. `prune-repair` holds a prune between its bucket delete and
406
- * its owner repair.
407
- */
408
- export type GraphWriteGatePoint = 'merge-component' | 'merge' | 'merge-fenced' | 'entity-read-back' | 'entity-provenance' | 'edge-write' | 'edge-upsert' | 'prune-repair';
409
- /**
410
- * Request structure for the internal test-only route that parks one of a knowledge base's graph writes,
411
- * so a test can interleave a resolution merge with a bulk-finalize upsert deterministically.
412
- */
413
- export interface AiKnowledgeBaseSetGraphWriteGateRequest {
414
- /** The ID of the App */
415
- appId: AppId;
416
- /** The ID of the AIKnowledgeBase */
417
- knowledgeBaseId: AiKnowledgeBaseId;
418
- /** Which write to park. */
419
- point: GraphWriteGatePoint;
420
- /** True parks the next writer at that point; false releases a parked writer and stops parking. */
421
- armed: boolean;
422
- }
423
- /** Response of the internal test-only graph write-gate route. */
424
- export interface AiKnowledgeBaseSetGraphWriteGateResponse {
425
- /** True once a writer has parked on the gate. */
426
- entered: boolean;
427
- /** How many writers have parked on the gate since it was armed. */
428
- entrants: number;
429
- }
430
- /**
431
- * Request structure for the internal test-only route that runs one knowledge base's graph writes without the
432
- * per-KB write lock, so a test can pin the interleavings the lock rules out.
433
- */
434
- export interface AiKnowledgeBaseBypassGraphWriteLockRequest {
435
- /** The ID of the App */
436
- appId: AppId;
437
- /** The ID of the AIKnowledgeBase */
438
- knowledgeBaseId: AiKnowledgeBaseId;
439
- }
440
- /** Request structure for the internal test-only route that reports one knowledge base's graph write lock. */
441
- export interface AiKnowledgeBaseGetGraphWriteLockStateRequest {
442
- /** The ID of the App */
443
- appId: AppId;
444
- /** The ID of the AIKnowledgeBase */
445
- knowledgeBaseId: AiKnowledgeBaseId;
446
- }
447
- /** Response of the internal test-only graph write-lock state route. */
448
- export interface AiKnowledgeBaseGetGraphWriteLockStateResponse {
449
- /** Writers holding the lock shared: finalize entity or edge writes. */
450
- sharedHolders: number;
451
- /** True while a resolution merge holds the lock exclusive. */
452
- exclusiveHeld: boolean;
453
- /** Writers queued for a shared hold. */
454
- sharedWaiters: number;
455
- /** Writers queued for an exclusive hold. */
456
- exclusiveWaiters: number;
457
- }
458
- /** Turns content dedup (ENG-2930) on or off for new ingests of one knowledge base. */
459
- export interface AiKnowledgeBaseSetContentDedupRequest {
460
- /** The ID of the App */
461
- appId: AppId;
462
- /** The ID of the AIKnowledgeBase */
463
- knowledgeBaseId: AiKnowledgeBaseId;
464
- /** Whether new ingests share stored content; false keeps reads of already shared content working. */
465
- enabled: boolean;
466
- }
467
- /** Runs the duplicates migration (ENG-2930) over one knowledge base. */
468
- export interface AiKnowledgeBaseMigrateContentDuplicatesRequest {
469
- /** The ID of the App */
470
- appId: AppId;
471
- /** The ID of the AIKnowledgeBase */
472
- knowledgeBaseId: AiKnowledgeBaseId;
473
- /** `dryRun` counts only; `apply` converts copies and hides their storage; `purge` deletes what was hidden. */
474
- mode: 'dryRun' | 'apply' | 'purge';
475
- /** Upper bound on the groups this run changes; omitted = all. */
476
- maxGroups?: number;
477
- }
478
- /** What one duplicates-migration run found and did. */
479
- export interface AiKnowledgeBaseMigrateContentDuplicatesResponse {
480
- /** Groups of identical contexts not yet stored once. */
481
- groups: number;
482
- /** Redundant copies across those groups. */
483
- copies: number;
484
- /** Groups this run changed. */
485
- processedGroups: number;
486
- /** Chunks this run hid. */
487
- chunksHidden: number;
488
- /** Hidden chunks this run deleted. */
489
- chunksDeleted: number;
490
- }
491
- /** Drops the chunk search indexes superseded by `vector_idx_v4` and `bm25_idx_v2` (ENG-2917). */
492
- export interface AiKnowledgeBaseDropSupersededSearchIndexesRequest {
493
- /** One `kb_chunks_<dim>` collection; omitted = every chunk collection. */
494
- embeddingDimensions?: number;
495
- /** Reports what would be dropped, and why or why not, without dropping anything. */
496
- dryRun: boolean;
497
- /** Required to drop: every pod of the deployment runs with version suppression on (one pod cannot check). */
498
- allPodsSuppressionEnabled?: boolean;
499
- }
500
- /** Per chunk collection, the superseded search indexes found and dropped. */
501
- export interface AiKnowledgeBaseDropSupersededSearchIndexesResponse {
502
- collections: Array<{
503
- /** The chunk collection. */
504
- collection: string;
505
- /** The superseded indexes present that may go. */
506
- droppable: Array<string>;
507
- /** The indexes dropped; empty on a dry run. */
508
- dropped: Array<string>;
509
- /** Why they may or may not go. */
510
- reason: string;
511
- }>;
512
- }
513
- /** Test only: makes index-state probes of one chunk collection treat the named search indexes as not READY. */
514
- export interface AiKnowledgeBaseHoldChunkSearchIndexesRequest {
515
- /** The `kb_chunks_<dim>` collection. */
516
- embeddingDimensions: number;
517
- /** The indexes to hold; an empty list releases the collection. */
518
- indexNames: Array<string>;
519
- }
520
- /** The collection's read targets, probed right after the hold changed. */
521
- export interface AiKnowledgeBaseHoldChunkSearchIndexesResponse {
522
- vectorIndexName: string;
523
- bm25IndexName: string;
524
- /** Whether reads apply the `hidden` predicate. */
525
- hiddenFilterReady: boolean;
526
- }
527
- /** Test only: parks the next same-content re-ingest of a context between its read and its reservation. */
528
- export interface AiKnowledgeBaseParkSameKeyReingestRequest {
529
- /** The ID of the App */
530
- appId: AppId;
531
- /** The ID of the AIKnowledgeBase */
532
- knowledgeBaseId: AiKnowledgeBaseId;
533
- /** `arm` parks the next re-ingest of `contextId`, `release` lets it go, `status` only reports. */
534
- action: 'arm' | 'release' | 'status';
535
- /** The re-ingested context; required to arm. */
536
- contextId?: AiContextId;
537
- }
538
- /** Whether a re-ingest is parked now. */
539
- export interface AiKnowledgeBaseParkSameKeyReingestResponse {
540
- parked: boolean;
541
- }
542
- /** Checks the content model (ENG-2930) of one knowledge base. */
543
- export interface AiKnowledgeBaseCheckContentDedupRequest {
544
- /** The ID of the App */
545
- appId: AppId;
546
- /** The ID of the AIKnowledgeBase */
547
- knowledgeBaseId: AiKnowledgeBaseId;
548
- }
549
- /** The invariant-check outcome of one knowledge base's content model. */
550
- export interface AiKnowledgeBaseCheckContentDedupResponse {
551
- /** Live contents. */
552
- contents: number;
553
- /** Placements of live contents. */
554
- placements: number;
555
- /** Every broken invariant found; empty when the model is consistent. */
556
- violations: Array<string>;
557
- }
558
- /**
559
- * Request structure for the internal test-only route that sets a knowledge base's graph schema version.
560
- * A migration test needs a KB on the older schema, which the creation path never produces.
561
- */
562
- export interface AiKnowledgeBaseSetGraphSchemaVersionRequest {
563
- /** The ID of the App */
564
- appId: AppId;
565
- /** The ID of the AIKnowledgeBase */
566
- knowledgeBaseId: AiKnowledgeBaseId;
567
- /** The schema version to stamp; omit to clear the stamp so the KB uses the v1 layout. */
568
- version?: number;
569
- }
570
- /**
571
- * Request structure of the operator call that quarantines a knowledge base's dead-weight graph entities
572
- * (ENG-2802): entities of degree at most `maxDegree`, cited by at most one chunk, whose name carries no
573
- * significant token, is numeric/date-like, or is one token shared by many other entity names.
574
- */
575
- export interface QuarantineKnowledgeBaseGraphEntitiesRequest {
576
- /** The ID of the AIKnowledgeBase */
577
- knowledgeBaseId: AiKnowledgeBaseId;
578
- /** Reports the matching set without writing anything. */
579
- dryRun?: boolean;
580
- /** Highest degree a quarantined entity may have: 0 (default) or 1. */
581
- maxDegree?: number;
582
- /**
583
- * How many entities must share a single-token name signature before that token counts as generic;
584
- * the deployment default when absent.
585
- */
586
- frequentSignatureMinEntities?: number;
587
- }
588
- /** One entity a quarantine report samples. */
589
- export interface KnowledgeBaseGraphQuarantineSampleEntity {
590
- /** Hex id of the entity document. */
591
- id: string;
592
- /** Canonical display name. */
593
- name: string;
594
- /** Extracted entity type. */
595
- type: string;
596
- /** Relationships touching the entity. */
597
- degree: number;
598
- /** Chunks citing the entity. */
599
- chunkRefCount: number;
600
- }
601
- /** Response structure of {@link QuarantineKnowledgeBaseGraphEntitiesRequest}. */
602
- export interface QuarantineKnowledgeBaseGraphEntitiesResponse {
603
- /** Stamped on every entity this run quarantined; absent on a dry run. */
604
- runId?: string;
605
- /** Entities the criteria match (dry run) or this run quarantined. */
606
- matched: number;
607
- /** Entities of the partition still live after the run (dry run: before it). */
608
- liveEntityCount: number;
609
- /** Entities quarantined by this and earlier runs. */
610
- quarantinedEntityCount: number;
611
- /** Up to 50 matching entities. */
612
- sample: KnowledgeBaseGraphQuarantineSampleEntity[];
613
- }
614
- /** Request structure of the operator call that restores the entities one quarantine run hid. */
615
- export interface RestoreKnowledgeBaseGraphEntitiesRequest {
616
- /** The ID of the AIKnowledgeBase */
617
- knowledgeBaseId: AiKnowledgeBaseId;
618
- /** The `runId` the quarantine call returned. */
619
- runId: string;
620
- }
621
- /** Response structure of {@link RestoreKnowledgeBaseGraphEntitiesRequest}. */
622
- export interface RestoreKnowledgeBaseGraphEntitiesResponse {
623
- /** Entities the call restored. */
624
- restored: number;
625
- /** Entities still quarantined by other runs. */
626
- quarantinedEntityCount: number;
627
- }
628
- /**
629
- * Request structure for identifying a knowledge base to reimport the context files (when possible).
630
- */
631
- export interface AiKnowledgeBaseReimportAllFilesRequest {
632
- /** The ID of the AIKnowledgeBase */
633
- knowledgeBaseId: AiKnowledgeBaseId;
634
- }
635
- /**
636
- * Request structure for identifying a knowledge base to reimport the context files (when possible).
637
- */
638
- export interface AiKnowledgeBaseReimportFilesRequest {
639
- /** The ID of the AIKnowledgeBase */
640
- knowledgeBaseId: AiKnowledgeBaseId;
641
- /** The ids of the AiKnowledgeBaseContexts to reimport */
642
- contextIds: Array<string>;
643
- }
644
- /** Longest context batch one `backfillFulltext` call accepts; larger work-lists are split by the caller. */
645
- export declare const BACKFILL_FULLTEXT_MAX_CONTEXTS_PER_CALL = 20;
646
- /**
647
- * Request structure for rebuilding the stored raw text (`kb_fulltext`) of existing contexts from their
648
- * stored source files, without re-ingesting them — no chunk, embedding or graph writes. This is how
649
- * contexts ingested before literal search existed become greppable.
650
- */
651
- export interface AiKnowledgeBaseBackfillFulltextRequest {
652
- /** The ID of the AIKnowledgeBase */
653
- knowledgeBaseId: AiKnowledgeBaseId;
654
- /**
655
- * The ids of the contexts to backfill, at most {@link BACKFILL_FULLTEXT_MAX_CONTEXTS_PER_CALL} per
656
- * call. Each context's stored text is fully replaced, so re-running a context is safe.
657
- */
658
- contextIds: Array<AiContextId>;
659
- /**
660
- * The extraction method for file contexts. Defaults to the server's regular document extraction
661
- * default (OCR when configured), which reproduces the text the ingest pipeline indexed — including
662
- * scanned pages. `legacy` extracts in-process without any external model call, but yields nothing for
663
- * scanned pages, so a caller choosing it must compare the stored part counts against expectations.
664
- * `legacy_with_llm` yields the same in-process text here — its page-screenshot descriptions are an
665
- * ingest-time addition, not part of the literal text this backfill rebuilds.
666
- */
667
- extractionMethod?: DocumentExtractionMethod;
668
- /**
669
- * A context that already has stored text is SKIPPED unless this is true. The backfill rebuilds
670
- * literal text only, while ingest also stores image/OCR-description parts — so replacing a context
671
- * that ingest populated would silently delete its description text from the literal index. Set this
672
- * only to deliberately re-extract contexts this backfill itself populated (e.g. retrying a thin
673
- * `legacy` yield with OCR).
674
- */
675
- overwrite?: boolean;
676
- }
677
- /**
678
- * Response structure for a `backfillFulltext` call: one status per requested context, in request order.
679
- */
680
- export interface AiKnowledgeBaseBackfillFulltextResponse {
681
- statuses: Array<AiKnowledgeBaseBackfillFulltextStatus>;
682
- }
683
- /**
684
- * Outcome of backfilling the raw text of one context.
685
- */
686
- export interface AiKnowledgeBaseBackfillFulltextStatus {
687
- contextId: AiContextId;
688
- /** `skipped` means the context already has stored text and `overwrite` was not set; nothing changed. */
689
- status: 'success' | 'error' | 'skipped';
690
- /**
691
- * How many parts (pages/sheets) were stored, on success. Zero means extraction yielded no text at
692
- * all — for a `legacy` run over a scanned document that is the expected signal to retry with OCR.
693
- */
694
- storedPartCount?: number;
695
- errorMessage?: string;
696
- }
697
- /** Longest context batch one `repairBulkFulltext` call accepts; larger work-lists are split by the caller. */
698
- export declare const REPAIR_BULK_FULLTEXT_MAX_CONTEXTS_PER_CALL = 20;
699
- /**
700
- * Request structure for rebuilding the stored raw text (`kb_fulltext`) of bulk-ingested contexts from the
701
- * bulk-ingestion rows their job retained: the staged pages plus the descriptions its `imageDescription`
702
- * requests already produced. No vision call, so a repaired context reads exactly as a freshly ingested
703
- * one at no model cost.
704
- */
705
- export interface AiKnowledgeBaseRepairBulkFulltextRequest {
706
- /** The ID of the AIKnowledgeBase */
707
- knowledgeBaseId: AiKnowledgeBaseId;
708
- /**
709
- * The ids of the contexts to repair, at most {@link REPAIR_BULK_FULLTEXT_MAX_CONTEXTS_PER_CALL} per
710
- * call. Each context's stored text is fully replaced, so re-running a context is safe.
711
- */
712
- contextIds: Array<AiContextId>;
713
- /**
714
- * Rebuilds a context whose staged pages are gone by re-extracting its stored source file, which runs
715
- * the regular document lane and can bill OCR. Off by default; such contexts are skipped without it.
716
- */
717
- reextractMissingPages?: boolean;
718
- /**
719
- * The extraction method of the {@link reextractMissingPages} fallback, defaulting to the server's
720
- * regular one. Name the method the original ingest used: a file extracted with OCR yields no text for
721
- * its scanned pages under a method that does not run it, replacing the context's text with less of it.
722
- */
723
- extractionMethod?: DocumentExtractionMethod;
724
- }
725
- /** Response structure for a `repairBulkFulltext` call: one status per requested context, in request order. */
726
- export interface AiKnowledgeBaseRepairBulkFulltextResponse {
727
- statuses: Array<AiKnowledgeBaseRepairBulkFulltextStatus>;
728
- }
729
- /** Outcome of repairing the raw text of one bulk-ingested context. */
730
- export interface AiKnowledgeBaseRepairBulkFulltextStatus {
731
- contextId: AiContextId;
732
- /**
733
- * `repairedFromReextraction` rebuilt the pages from the stored source file because the row's own were
734
- * gone: a fresh extraction, so its text is best-effort rather than the original's. `raced` means another
735
- * ingest took the context over during the repair, so re-run it.
736
- */
737
- status: 'repaired' | 'repairedFromReextraction' | 'raced' | 'error' | 'skipped';
738
- /** Why the context was left untouched, when it was skipped. `noJob` cannot be repaired by re-running. */
739
- skippedReason?: 'notBulkIngested' | 'noJob' | 'jobActive' | 'noFileRow' | 'notFinalized' | 'pagesBounded' | 'noDescriptionRows' | 'noPages' | 'reingested';
740
- /** How many parts (pages/sheets/image descriptions) were stored, on success. */
741
- storedPartCount?: number;
742
- errorMessage?: string;
743
- }
744
- /**
745
- * Response structure for getting size of context
746
- * @category AI
747
- */
748
- export interface AiKnowledgeBaseContextSizeResponse {
749
- /** Size of context bytes, as a number */
750
- sizeBytes: number;
751
- }
752
- /**
753
- * Request structure for getting the values vector of
754
- * a specific context
755
- *
756
- * @category AI
757
- */
758
- export interface AiKnowledgeBaseValueVectorRequest {
759
- /** The ID of the App */
760
- appId: AppId;
761
- /** The ID of the AIKnowledgeBase */
762
- knowledgeBaseId: AiKnowledgeBaseId;
763
- /** The ID of the context */
764
- contextId: AiContextId;
765
- }
766
- /**
767
- * Response structure for getting values vector of a
768
- * specific context
769
- * @category AI
770
- */
771
- export interface AiKnowledgeBaseValueVectorResponse {
772
- /** The vector */
773
- vector: number[];
774
- }
775
- /**
776
- * Internal (console-test-only) extension of the public chat options, for the `test/chat` endpoint
777
- * used by the console's KB test-chat panel.
778
- * @category AI
779
- */
780
- export interface AiKnowledgeBaseChatOptionsInternal extends AiKnowledgeBaseChatOptions {
781
- /**
782
- * When true, the response cites sources by name using inline markers — names only, since this
783
- * console-test path never mints download links. Takes precedence over the deprecated
784
- * `includeReference`. Default to false.
785
- */
786
- citation?: boolean;
787
- }
788
- export interface AiKnowledgeBaseChatRequest {
789
- knowledgeBaseId: AiKnowledgeBaseId;
790
- prompt?: string;
791
- options?: AiKnowledgeBaseChatOptionsInternal;
792
- }
793
- /** Emitted to the console queue when a knowledge base, its contexts, or a file's ingestion status change. */
794
- export interface KbChangeEvent {
795
- appId: AppId;
796
- knowledgeBaseId: AiKnowledgeBaseId;
797
- changeType: 'kb' | 'context' | 'fileStatus';
798
- }