@squidcloud/client 1.0.483 → 1.0.484
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/ai/system-openai-compatible.d.ts +35 -0
- package/dist/internal-common/src/metric-name.d.ts +14 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +25 -1
- package/dist/internal-common/src/public-types/ai-function.public-types.d.ts +36 -0
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +141 -2
- package/dist/internal-common/src/public-types/connector.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/extraction.public-types.d.ts +9 -2
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/source-code.public-types.d.ts +191 -0
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +249 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +306 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +41 -0
- package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +5 -0
- package/dist/internal-common/src/types/observability.types.d.ts +168 -0
- package/dist/internal-common/src/types/query.types.d.ts +15 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/internal-common/src/types/time-units.d.ts +1 -0
- package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http.d.ts +10 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +86 -0
- package/dist/internal-common/src/utils/serialization.d.ts +24 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +6 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +19 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +9 -1
- package/dist/typescript-client/src/distributed-lock.manager.d.ts +3 -2
- package/dist/typescript-client/src/integration-client.d.ts +5 -1
- package/dist/typescript-client/src/public-types.d.ts +1 -0
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
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 getting an AiKnowledgeBaseContext
|
|
107
|
+
* @category AI
|
|
108
|
+
*/
|
|
109
|
+
export interface GetAiKnowledgeBaseContextRequest {
|
|
110
|
+
/** The id of the AiKnowledgeBase */
|
|
111
|
+
knowledgeBaseId: string;
|
|
112
|
+
/** The id of the AiKnowledgeBaseContext */
|
|
113
|
+
contextId: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Request structure for getting a page of AiKnowledgeBaseContexts
|
|
117
|
+
* for a given knowledge base
|
|
118
|
+
* @category AI
|
|
119
|
+
*/
|
|
120
|
+
export interface GetAiKnowledgeBaseContextsRequest {
|
|
121
|
+
/** The id of the app */
|
|
122
|
+
appId: AppId;
|
|
123
|
+
/** The id of the AiKnowledgeBase */
|
|
124
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
125
|
+
/** The number of characters after which text is truncated. Optional */
|
|
126
|
+
truncateTextAfter?: number;
|
|
127
|
+
/** The number of contexts to skip, for pagination. Optional */
|
|
128
|
+
offset?: number;
|
|
129
|
+
/** The maximum number of contexts to return, for pagination. Optional */
|
|
130
|
+
limit?: number;
|
|
131
|
+
/** Case-insensitive substring search across id/title only. Optional */
|
|
132
|
+
search?: string;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Response structure for getting a page of AiKnowledgeBaseContexts for a given knowledge base
|
|
136
|
+
* @category AI
|
|
137
|
+
*/
|
|
138
|
+
export interface GetAiKnowledgeBaseContextsResponse {
|
|
139
|
+
/** The requested page of AiKnowledgeBaseContexts */
|
|
140
|
+
contexts: Array<AiKnowledgeBaseContext>;
|
|
141
|
+
/** The total number of contexts in the AiKnowledgeBase, ignoring offset/limit */
|
|
142
|
+
totalCount: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Response structure for getting an AiKnowledgeBaseContext
|
|
146
|
+
* @category AI
|
|
147
|
+
*/
|
|
148
|
+
export interface GetAiKnowledgeBaseContextResponse {
|
|
149
|
+
/** The resulting AiKnowledgeBaseContext, if it is found */
|
|
150
|
+
context: AiKnowledgeBaseContext | undefined;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Request structure for upserting context for an AiKnowledgeBase
|
|
154
|
+
* @category AI
|
|
155
|
+
*/
|
|
156
|
+
export interface UpsertAiKnowledgeBaseContextsRequest {
|
|
157
|
+
/** The id of the AiKnowledgeBase */
|
|
158
|
+
knowledgeBaseId: string;
|
|
159
|
+
/** The AiKnowledgeBaseContext data, which could be a file or text */
|
|
160
|
+
contextRequests: Array<AiKnowledgeBaseContextRequest>;
|
|
161
|
+
/** The job ID to use for the async upsert job */
|
|
162
|
+
jobId: string;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Response structure for searching an AiKnowledgeBase
|
|
166
|
+
* @category AI
|
|
167
|
+
*/
|
|
168
|
+
export interface AiKnowledgeBaseSearchResponse {
|
|
169
|
+
/** Array of result chunks from the search */
|
|
170
|
+
chunks: Array<AiKnowledgeBaseSearchResultChunk>;
|
|
171
|
+
/** Traversed subgraph for a `searchMode:'graph'` query with `includeGraphContext`; absent otherwise. */
|
|
172
|
+
graphContext?: AiKnowledgeBaseGraphContext;
|
|
173
|
+
}
|
|
174
|
+
export type { ExploreKnowledgeBaseGraphRequest, ExploreKnowledgeBaseGraphResponse, GetKnowledgeBaseGraphStatusRequest, GetKnowledgeBaseGraphStatusResponse, KnowledgeBaseGraphEdge, KnowledgeBaseGraphFacetStatus, KnowledgeBaseGraphModelUsage, KnowledgeBaseGraphNode, KnowledgeBaseGraphQueryConcepts, KnowledgeBaseGraphQueryDoc, KnowledgeBaseGraphQueryGlobalSummary, KnowledgeBaseGraphQueryMatch, KnowledgeBaseGraphQueryOp, KnowledgeBaseGraphQueryPath, KnowledgeBaseGraphQuerySubtreeNode, KnowledgeBaseGraphRebuildMode, KnowledgeBaseGraphTopic, KnowledgeBaseGraphTopicEdge, KnowledgeBaseGraphUsage, QueryKnowledgeBaseGraphRequest, QueryKnowledgeBaseGraphResponse, RebuildKnowledgeBaseGraphRequest, } from '../public-types/ai-knowledge-base.public-types';
|
|
175
|
+
/**
|
|
176
|
+
* Request structure for getting the size of context
|
|
177
|
+
* for an AiKnowledgeBase
|
|
178
|
+
* @category AI
|
|
179
|
+
*/
|
|
180
|
+
export interface AiKnowledgeBaseContextSizeRequest {
|
|
181
|
+
/** The ID of the App */
|
|
182
|
+
appId: AppId;
|
|
183
|
+
/** The ID of the AIKnowledgeBase */
|
|
184
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Request structure for the internal test-only route that arms the next `count` grep scans of a
|
|
188
|
+
* knowledge base to fail at their `maxTimeMS` deadline.
|
|
189
|
+
*/
|
|
190
|
+
export interface AiKnowledgeBaseFailNextGrepScansRequest {
|
|
191
|
+
/** The ID of the App */
|
|
192
|
+
appId: AppId;
|
|
193
|
+
/** The ID of the AIKnowledgeBase */
|
|
194
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
195
|
+
/** How many upcoming scans fail; a non-positive value disarms. */
|
|
196
|
+
count: number;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Request structure for identifying a knowledge base to reimport the context files (when possible).
|
|
200
|
+
*/
|
|
201
|
+
export interface AiKnowledgeBaseReimportAllFilesRequest {
|
|
202
|
+
/** The ID of the AIKnowledgeBase */
|
|
203
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Request structure for identifying a knowledge base to reimport the context files (when possible).
|
|
207
|
+
*/
|
|
208
|
+
export interface AiKnowledgeBaseReimportFilesRequest {
|
|
209
|
+
/** The ID of the AIKnowledgeBase */
|
|
210
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
211
|
+
/** The ids of the AiKnowledgeBaseContexts to reimport */
|
|
212
|
+
contextIds: Array<string>;
|
|
213
|
+
}
|
|
214
|
+
/** Longest context batch one `backfillFulltext` call accepts; larger work-lists are split by the caller. */
|
|
215
|
+
export declare const BACKFILL_FULLTEXT_MAX_CONTEXTS_PER_CALL = 20;
|
|
216
|
+
/**
|
|
217
|
+
* Request structure for rebuilding the stored raw text (`kb_fulltext`) of existing contexts from their
|
|
218
|
+
* stored source files, without re-ingesting them — no chunk, embedding or graph writes. This is how
|
|
219
|
+
* contexts ingested before literal search existed become greppable.
|
|
220
|
+
*/
|
|
221
|
+
export interface AiKnowledgeBaseBackfillFulltextRequest {
|
|
222
|
+
/** The ID of the AIKnowledgeBase */
|
|
223
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
224
|
+
/**
|
|
225
|
+
* The ids of the contexts to backfill, at most {@link BACKFILL_FULLTEXT_MAX_CONTEXTS_PER_CALL} per
|
|
226
|
+
* call. Each context's stored text is fully replaced, so re-running a context is safe.
|
|
227
|
+
*/
|
|
228
|
+
contextIds: Array<AiContextId>;
|
|
229
|
+
/**
|
|
230
|
+
* The extraction method for file contexts. Defaults to the server's regular document extraction
|
|
231
|
+
* default (OCR when configured), which reproduces the text the ingest pipeline indexed — including
|
|
232
|
+
* scanned pages. `legacy` extracts in-process without any external model call, but yields nothing for
|
|
233
|
+
* scanned pages, so a caller choosing it must compare the stored part counts against expectations.
|
|
234
|
+
*/
|
|
235
|
+
extractionMethod?: DocumentExtractionMethod;
|
|
236
|
+
/**
|
|
237
|
+
* A context that already has stored text is SKIPPED unless this is true. The backfill rebuilds
|
|
238
|
+
* literal text only, while ingest also stores image/OCR-description parts — so replacing a context
|
|
239
|
+
* that ingest populated would silently delete its description text from the literal index. Set this
|
|
240
|
+
* only to deliberately re-extract contexts this backfill itself populated (e.g. retrying a thin
|
|
241
|
+
* `legacy` yield with OCR).
|
|
242
|
+
*/
|
|
243
|
+
overwrite?: boolean;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Response structure for a `backfillFulltext` call: one status per requested context, in request order.
|
|
247
|
+
*/
|
|
248
|
+
export interface AiKnowledgeBaseBackfillFulltextResponse {
|
|
249
|
+
statuses: Array<AiKnowledgeBaseBackfillFulltextStatus>;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Outcome of backfilling the raw text of one context.
|
|
253
|
+
*/
|
|
254
|
+
export interface AiKnowledgeBaseBackfillFulltextStatus {
|
|
255
|
+
contextId: AiContextId;
|
|
256
|
+
/** `skipped` means the context already has stored text and `overwrite` was not set; nothing changed. */
|
|
257
|
+
status: 'success' | 'error' | 'skipped';
|
|
258
|
+
/**
|
|
259
|
+
* How many parts (pages/sheets) were stored, on success. Zero means extraction yielded no text at
|
|
260
|
+
* all — for a `legacy` run over a scanned document that is the expected signal to retry with OCR.
|
|
261
|
+
*/
|
|
262
|
+
storedPartCount?: number;
|
|
263
|
+
errorMessage?: string;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Response structure for getting size of context
|
|
267
|
+
* @category AI
|
|
268
|
+
*/
|
|
269
|
+
export interface AiKnowledgeBaseContextSizeResponse {
|
|
270
|
+
/** Size of context bytes, as a number */
|
|
271
|
+
sizeBytes: number;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Request structure for getting the values vector of
|
|
275
|
+
* a specific context
|
|
276
|
+
*
|
|
277
|
+
* @category AI
|
|
278
|
+
*/
|
|
279
|
+
export interface AiKnowledgeBaseValueVectorRequest {
|
|
280
|
+
/** The ID of the App */
|
|
281
|
+
appId: AppId;
|
|
282
|
+
/** The ID of the AIKnowledgeBase */
|
|
283
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
284
|
+
/** The ID of the context */
|
|
285
|
+
contextId: AiContextId;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Response structure for getting values vector of a
|
|
289
|
+
* specific context
|
|
290
|
+
* @category AI
|
|
291
|
+
*/
|
|
292
|
+
export interface AiKnowledgeBaseValueVectorResponse {
|
|
293
|
+
/** The vector */
|
|
294
|
+
vector: number[];
|
|
295
|
+
}
|
|
296
|
+
export interface AiKnowledgeBaseChatRequest {
|
|
297
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
298
|
+
prompt?: string;
|
|
299
|
+
options?: AiKnowledgeBaseChatOptions;
|
|
300
|
+
}
|
|
301
|
+
/** Emitted to the console queue when a knowledge base or its contexts change. */
|
|
302
|
+
export interface KbChangeEvent {
|
|
303
|
+
appId: AppId;
|
|
304
|
+
knowledgeBaseId: AiKnowledgeBaseId;
|
|
305
|
+
changeType: 'kb' | 'context';
|
|
306
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MmEntity, MmMatchMaker } from '../public-types/ai-matchmaking.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Internal-only matchmaking request shapes. Every other request/response of the matchmaking wire
|
|
4
|
+
* contract is declared in `ai-matchmaking.public-types` and imported directly from there.
|
|
5
|
+
*/
|
|
6
|
+
export interface MmCreateMatchMakerRequest {
|
|
7
|
+
matchMaker: MmMatchMaker;
|
|
8
|
+
}
|
|
9
|
+
export interface MmGetMatchMakerRequest {
|
|
10
|
+
matchMakerId: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MmInsertEntityRequest {
|
|
13
|
+
matchMakerId: string;
|
|
14
|
+
entity: MmEntity;
|
|
15
|
+
}
|
|
16
|
+
export interface MmGetEntityRequest {
|
|
17
|
+
matchMakerId: string;
|
|
18
|
+
entityId: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ChatId = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** HTTP header names used by Squid for request metadata. */
|
|
2
|
+
export declare const SquidHeaders: {
|
|
3
|
+
/** Correlates logs and spans across distributed calls. */
|
|
4
|
+
readonly TRACE_ID: "x-squid-traceid";
|
|
5
|
+
/** Shared secret header for internal authentication. */
|
|
6
|
+
readonly SECRET: "x-squid-secret";
|
|
7
|
+
/** API key provided by the calling application. */
|
|
8
|
+
readonly APP_API_KEY: "x-app-api-key";
|
|
9
|
+
/** Unique identifier of the client application. */
|
|
10
|
+
readonly APP_ID: "x-squid-appid";
|
|
11
|
+
/** Unique identifier of the end user or service client. */
|
|
12
|
+
readonly CLIENT_ID: "x-squid-clientid";
|
|
13
|
+
/** Version string of the Squid client library. */
|
|
14
|
+
readonly CLIENT_VERSION: "x-squid-client-version";
|
|
15
|
+
/** Originating IP address of the request. */
|
|
16
|
+
readonly SOURCE_IP: "x-squid-source-ip";
|
|
17
|
+
/**
|
|
18
|
+
* Response-only: IP of the tenant pod that served the request, i.e. the address to reach it at
|
|
19
|
+
* again. Core records it to route subsequent affinity-keyed calls to the same pod. Absent when the
|
|
20
|
+
* pod does not know its own IP.
|
|
21
|
+
*/
|
|
22
|
+
readonly POD_IP: "x-squid-pod-ip";
|
|
23
|
+
/**
|
|
24
|
+
* Response-only: identity of the tenant process that served the request. Distinct from
|
|
25
|
+
* {@link POD_IP}, which is an address and is reused: Kubernetes hands the IP of a deleted pod to a
|
|
26
|
+
* new one, so only this value tells core whether it is still talking to the same instance.
|
|
27
|
+
*/
|
|
28
|
+
readonly INSTANCE_ID: "x-squid-instance-id";
|
|
29
|
+
/**
|
|
30
|
+
* Request-only: the {@link INSTANCE_ID} core believes it is calling, sent when routing directly to a
|
|
31
|
+
* pinned pod instead of through the tenant service. The receiving instance refuses the request when
|
|
32
|
+
* the value is not its own — the pod at that address may have been replaced, possibly by a pod of a
|
|
33
|
+
* different application.
|
|
34
|
+
*/
|
|
35
|
+
readonly EXPECTED_INSTANCE_ID: "x-squid-expected-instance-id";
|
|
36
|
+
/**
|
|
37
|
+
* Response-only: key of the tenant worker that served the request, reported separately from
|
|
38
|
+
* {@link POD_IP} so core alone decides whether to pin at pod or at worker granularity.
|
|
39
|
+
*/
|
|
40
|
+
readonly WORKER_KEY: "x-squid-worker-key";
|
|
41
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status lifecycle for management API keys.
|
|
3
|
+
* Keys must be suspended before they can be deleted.
|
|
4
|
+
* @category ManagementApiKey
|
|
5
|
+
*/
|
|
6
|
+
export type ManagementApiKeyStatus = 'active' | 'suspended' | 'deleted';
|
|
7
|
+
/**
|
|
8
|
+
* Prefix for all management API keys.
|
|
9
|
+
* Used to identify and validate management keys.
|
|
10
|
+
* @category ManagementApiKey
|
|
11
|
+
*/
|
|
12
|
+
export declare const MANAGEMENT_API_KEY_PREFIX = "squid_mgmt_";
|
|
13
|
+
/**
|
|
14
|
+
* Represents a user-level management API key.
|
|
15
|
+
* These keys provide programmatic access to manage organizations and applications
|
|
16
|
+
* where the user is an admin.
|
|
17
|
+
* @category ManagementApiKey
|
|
18
|
+
*/
|
|
19
|
+
export interface ManagementApiKey {
|
|
20
|
+
/** Unique identifier for the API key */
|
|
21
|
+
id: string;
|
|
22
|
+
/** The user ID who owns this key */
|
|
23
|
+
userId: string;
|
|
24
|
+
/** Optional description for the key */
|
|
25
|
+
description?: string;
|
|
26
|
+
/** Current status of the key */
|
|
27
|
+
status: ManagementApiKeyStatus;
|
|
28
|
+
/** Timestamp when the key was created */
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
/** Timestamp when the key was last updated */
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
/** Timestamp when the key was last used, if ever */
|
|
33
|
+
lastUsedAt?: Date;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Request to create a new management API key.
|
|
37
|
+
* @category ManagementApiKey
|
|
38
|
+
*/
|
|
39
|
+
export interface CreateManagementApiKeyRequest {
|
|
40
|
+
/** Optional description for the key */
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Response when creating a new management API key.
|
|
45
|
+
* The keyValue is only returned once during creation.
|
|
46
|
+
* @category ManagementApiKey
|
|
47
|
+
*/
|
|
48
|
+
export interface CreateManagementApiKeyResponse {
|
|
49
|
+
/** The created key metadata */
|
|
50
|
+
key: ManagementApiKey;
|
|
51
|
+
/** The raw key value (only returned once during creation) */
|
|
52
|
+
keyValue: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Request to update a management API key's status.
|
|
56
|
+
* @category ManagementApiKey
|
|
57
|
+
*/
|
|
58
|
+
export interface UpdateManagementApiKeyRequest {
|
|
59
|
+
/** The ID of the key to update */
|
|
60
|
+
keyId: string;
|
|
61
|
+
/** New status (can only toggle between active and suspended) */
|
|
62
|
+
status: 'active' | 'suspended';
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Request to delete a management API key.
|
|
66
|
+
* The key must be suspended before deletion.
|
|
67
|
+
* @category ManagementApiKey
|
|
68
|
+
*/
|
|
69
|
+
export interface DeleteManagementApiKeyRequest {
|
|
70
|
+
/** The ID of the key to delete */
|
|
71
|
+
keyId: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Response containing a list of user's management API keys.
|
|
75
|
+
* @category ManagementApiKey
|
|
76
|
+
*/
|
|
77
|
+
export interface ListManagementApiKeysResponse {
|
|
78
|
+
/** List of management API keys (without key values) */
|
|
79
|
+
keys: ManagementApiKey[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Response from validating a management API key.
|
|
83
|
+
* @category ManagementApiKey
|
|
84
|
+
*/
|
|
85
|
+
export interface ValidateManagementApiKeyResponse {
|
|
86
|
+
/** Whether the key is valid and active */
|
|
87
|
+
valid: boolean;
|
|
88
|
+
/** The user ID associated with the key (if valid) */
|
|
89
|
+
userId?: string;
|
|
90
|
+
/** The key ID (if valid) */
|
|
91
|
+
keyId?: string;
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { MetricName } from '../metric-name';
|
|
2
|
+
import { AppId } from '../public-types/communication.public-types';
|
|
3
|
+
export interface ObservableNameMetrics {
|
|
4
|
+
count: MetricName;
|
|
5
|
+
time: MetricName;
|
|
6
|
+
}
|
|
7
|
+
export declare const ObservableNames: {
|
|
8
|
+
readonly functionExecution: ObservableNameMetrics;
|
|
9
|
+
readonly codeInitialization: ObservableNameMetrics;
|
|
10
|
+
readonly getAiChatbotProfiles: ObservableNameMetrics;
|
|
11
|
+
readonly aiImageGeneration: ObservableNameMetrics;
|
|
12
|
+
readonly aiRemoveBackground: ObservableNameMetrics;
|
|
13
|
+
readonly aiAudioTranscribe: ObservableNameMetrics;
|
|
14
|
+
readonly aiAudioCreateSpeech: ObservableNameMetrics;
|
|
15
|
+
readonly discoverGraphQLConnectionSchema: ObservableNameMetrics;
|
|
16
|
+
readonly discoverOpenApiSchema: ObservableNameMetrics;
|
|
17
|
+
readonly discoverOpenApiSchemaFromFile: ObservableNameMetrics;
|
|
18
|
+
readonly graphqlQuery: ObservableNameMetrics;
|
|
19
|
+
readonly testGraphQLConnection: ObservableNameMetrics;
|
|
20
|
+
readonly testAgentProtocolConnection: ObservableNameMetrics;
|
|
21
|
+
readonly graphql: ObservableNameMetrics;
|
|
22
|
+
readonly acquireLock: ObservableNameMetrics;
|
|
23
|
+
readonly releaseLock: ObservableNameMetrics;
|
|
24
|
+
/**
|
|
25
|
+
* Timing and count for '/observability/metrics' endpoint calls used to report batch of metrics.
|
|
26
|
+
*/
|
|
27
|
+
readonly metricReport: ObservableNameMetrics;
|
|
28
|
+
/**
|
|
29
|
+
* Timing and count for '/observability/metrics/query' endpoint calls used to query metrics.
|
|
30
|
+
*/
|
|
31
|
+
readonly metricQuery: ObservableNameMetrics;
|
|
32
|
+
readonly storageUploadFile: ObservableNameMetrics;
|
|
33
|
+
readonly storageGetFileMetadata: ObservableNameMetrics;
|
|
34
|
+
readonly storageGetDownloadUrl: ObservableNameMetrics;
|
|
35
|
+
readonly storageDeleteFiles: ObservableNameMetrics;
|
|
36
|
+
readonly storageListDirectoryContents: ObservableNameMetrics;
|
|
37
|
+
readonly produceTopicMessage: ObservableNameMetrics;
|
|
38
|
+
readonly subscribeToTopic: ObservableNameMetrics;
|
|
39
|
+
readonly queueMessageHandler: ObservableNameMetrics;
|
|
40
|
+
readonly schedulerJob: ObservableNameMetrics;
|
|
41
|
+
readonly eventHandler: ObservableNameMetrics;
|
|
42
|
+
readonly webhook: ObservableNameMetrics;
|
|
43
|
+
readonly openapi: ObservableNameMetrics;
|
|
44
|
+
readonly executeBackendFunction: ObservableNameMetrics;
|
|
45
|
+
readonly apiControllerCall: ObservableNameMetrics;
|
|
46
|
+
};
|
|
47
|
+
export type ObservableName = keyof typeof ObservableNames;
|
|
48
|
+
export interface MetricEvent {
|
|
49
|
+
appId: AppId;
|
|
50
|
+
name: MetricName;
|
|
51
|
+
tags: Record<string, string>;
|
|
52
|
+
timestamp: Date;
|
|
53
|
+
value: number;
|
|
54
|
+
isExposedToUser: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface LogEvent {
|
|
57
|
+
message: string;
|
|
58
|
+
level: string;
|
|
59
|
+
tags: Record<string, string>;
|
|
60
|
+
timestamp: Date;
|
|
61
|
+
isExposedToUser: boolean;
|
|
62
|
+
host: string;
|
|
63
|
+
source?: string;
|
|
64
|
+
service?: string;
|
|
65
|
+
}
|
|
66
|
+
export declare const AUDIT_LOG_EVENT_NAMES: readonly ["ai_agent"];
|
|
67
|
+
export type AuditLogEventName = (typeof AUDIT_LOG_EVENT_NAMES)[number];
|
|
68
|
+
export interface AuditLogEvent {
|
|
69
|
+
appId: AppId;
|
|
70
|
+
name: AuditLogEventName;
|
|
71
|
+
timestamp: Date;
|
|
72
|
+
context: {
|
|
73
|
+
clientId?: string;
|
|
74
|
+
userId: string;
|
|
75
|
+
};
|
|
76
|
+
tags: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
/** Agent audit log entry - one per agent invocation */
|
|
79
|
+
export interface AgentAuditLogEvent {
|
|
80
|
+
appId: AppId;
|
|
81
|
+
/** Agent ID (nullable for query-with-AI operations without an agent) */
|
|
82
|
+
agentId?: string;
|
|
83
|
+
jobId: string;
|
|
84
|
+
prompt: string;
|
|
85
|
+
/** Fully assembled system instructions sent to the LLM; set only when the agent enables auditLogFullContext. */
|
|
86
|
+
systemInstructions?: string;
|
|
87
|
+
tags: Record<string, string>;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
/** Integration ID for query-with-AI operations (nullable, used when not invoked via agent) */
|
|
90
|
+
integrationId?: string;
|
|
91
|
+
}
|
|
92
|
+
export type AgentAuditLogUpdateType = 'statusUpdate' | 'response';
|
|
93
|
+
/** Usage metric for AI model input/output — either token count or character count depending on provider. */
|
|
94
|
+
export interface AiUsageMetric {
|
|
95
|
+
unit: 'tokens' | 'characters';
|
|
96
|
+
value: number;
|
|
97
|
+
}
|
|
98
|
+
/** Agent audit log update entry - status updates and responses for agent invocations */
|
|
99
|
+
export interface AgentAuditLogUpdateEvent {
|
|
100
|
+
appId: AppId;
|
|
101
|
+
/** Agent ID (nullable for query-with-AI operations without an agent) */
|
|
102
|
+
agentId?: string;
|
|
103
|
+
jobId: string;
|
|
104
|
+
statusUpdateId: string;
|
|
105
|
+
title: string;
|
|
106
|
+
parentStatusUpdateId?: string;
|
|
107
|
+
tags: Record<string, string>;
|
|
108
|
+
body: string;
|
|
109
|
+
type: AgentAuditLogUpdateType;
|
|
110
|
+
createdAt: Date;
|
|
111
|
+
/** Integration ID for query-with-AI operations (nullable, used when not invoked via agent) */
|
|
112
|
+
integrationId?: string;
|
|
113
|
+
/** Input usage metric (tokens or characters depending on provider). */
|
|
114
|
+
inputUsage?: AiUsageMetric;
|
|
115
|
+
/** Output usage metric (tokens or characters depending on provider). */
|
|
116
|
+
outputUsage?: AiUsageMetric;
|
|
117
|
+
/** Reasoning tokens consumed (where the provider reports them separately from output tokens). */
|
|
118
|
+
reasoningTokens?: number;
|
|
119
|
+
/** Number of input tokens served from the provider's prompt cache (read hits). */
|
|
120
|
+
cacheReadInputTokens?: number;
|
|
121
|
+
/** Number of input tokens written into the provider's prompt cache (cache misses that created new entries). */
|
|
122
|
+
cacheWriteInputTokens?: number;
|
|
123
|
+
}
|
|
124
|
+
/** Tag for metric events. Value: '0' - not an error, '1' - is an error. */
|
|
125
|
+
export declare const O11Y_TAG_IS_ERROR = "isError";
|
|
126
|
+
/** Tag for log events. Metrics have an explicit appId field. */
|
|
127
|
+
export declare const O11Y_TAG_APP_ID = "appId";
|
|
128
|
+
/** Tag for metric and log events. */
|
|
129
|
+
export declare const O11Y_TAG_INTEGRATION_ID = "integrationId";
|
|
130
|
+
/** Tag for AI events. */
|
|
131
|
+
export declare const O11Y_TAG_AI_MODEL = "aiModel";
|
|
132
|
+
export declare const O11Y_TAG_AI_PROFILE = "aiProfile";
|
|
133
|
+
/** Tag for AI KnowledgeBase events */
|
|
134
|
+
export declare const O11Y_TAG_AI_KNOWLEDGE_BASE_MODEL = "aiKnowledgeBaseModel";
|
|
135
|
+
export declare const O11Y_TAG_API_KEY_SOURCE = "apiKeySource";
|
|
136
|
+
export declare const O11Y_TAG_AI_JOB_ID = "aiJobId";
|
|
137
|
+
/** Tag prefix for client-provided metric annotations (see BaseAiChatOptions.metricAnnotations). */
|
|
138
|
+
export declare const O11Y_TAG_METRIC_ANNOTATION_PREFIX = "annotation.";
|
|
139
|
+
/** Maximum number of AI usage annotation entries kept per call; extra entries are dropped. */
|
|
140
|
+
export declare const MAX_METRIC_ANNOTATIONS = 10;
|
|
141
|
+
/** Maximum length of an AI usage annotation key; longer keys are dropped. */
|
|
142
|
+
export declare const MAX_METRIC_ANNOTATION_KEY_LENGTH = 64;
|
|
143
|
+
/** Maximum length of an AI usage annotation value; longer values are truncated. */
|
|
144
|
+
export declare const MAX_METRIC_ANNOTATION_VALUE_LENGTH = 256;
|
|
145
|
+
/**
|
|
146
|
+
* Sanitizes client-provided metric annotations: caps the number of entries, drops empty or
|
|
147
|
+
* oversized keys, and truncates oversized values. Returns undefined when nothing valid remains.
|
|
148
|
+
*/
|
|
149
|
+
export declare function sanitizeMetricAnnotations(annotations: Record<string, string> | undefined): Record<string, string> | undefined;
|
|
150
|
+
/** Tag for metric and log events. Value: '0' - not a tenant originated, '1' - is a tenant originated. */
|
|
151
|
+
export declare const O11Y_TAG_IS_TENANT_ORIGINATED = "isTenantOriginated";
|
|
152
|
+
/** Contains a full (with a service name) function name for backend functions. */
|
|
153
|
+
export declare const O11Y_TAG_FUNCTION_NAME = "functionName";
|
|
154
|
+
/** Contains a type of the function name for backend functions (See ExecuteFunctionAnnotationType.). */
|
|
155
|
+
export declare const O11Y_TAG_FUNCTION_TYPE = "functionType";
|
|
156
|
+
/** Tag for the trace ID. Used in logs. */
|
|
157
|
+
export declare const O11Y_TAG_TRACE_ID = "trace_id";
|
|
158
|
+
/** Tag for the span ID. Used in logs. */
|
|
159
|
+
export declare const O11Y_TAG_SPAN_ID = "span_id";
|
|
160
|
+
/**
|
|
161
|
+
* Tag carrying Squid's own correlation id (the `n_`/`c_`/`k_` short id minted by
|
|
162
|
+
* `generateTraceId`). Distinct from `trace_id`/`span_id`, which hold the W3C ids from OTel.
|
|
163
|
+
* Rides W3C baggage under the same key on internal hops; attached to spans and logs.
|
|
164
|
+
*/
|
|
165
|
+
export declare const O11Y_TAG_SQUID_TRACE_ID = "squid_tid";
|
|
166
|
+
export declare function getBooleanMetricTagValue(value: boolean): string;
|
|
167
|
+
export declare const COUNT_METRIC_SUFFIXES: string[];
|
|
168
|
+
export declare const GAUGE_METRIC_SUFFIXES: string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Condition, DocIdCondition, SimpleCondition } from '../public-types/query.public-types';
|
|
2
|
+
/**
|
|
3
|
+
* Generates the regex pattern, handling special characters as follows:
|
|
4
|
+
* - `_` is replaced with a `.`
|
|
5
|
+
* - `%` is replaced with `[\s\S]*`.
|
|
6
|
+
* - The above characters can be escaped with \, eg. `\_` is replaced with `_` and `\%` with `%`.
|
|
7
|
+
* - All special characters in regex (-, /, \, ^, $, *, +, ?, ., (, ), |, [, ], {, }) get escaped with \
|
|
8
|
+
*
|
|
9
|
+
* Exported for testing purposes.
|
|
10
|
+
* */
|
|
11
|
+
export declare function replaceSpecialCharacters(input: string): string;
|
|
12
|
+
/** Returns true if the condition is a 'SimpleCondition' or false otherwise. */
|
|
13
|
+
export declare function isSimpleCondition(condition: Condition): condition is SimpleCondition;
|
|
14
|
+
/** Returns true if the condition is a 'DocIdCondition' or false otherwise. */
|
|
15
|
+
export declare function isDocIdCondition(condition: Condition): condition is DocIdCondition;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApiKeyEntry } from '../public-types/secret.public-types';
|
|
2
|
+
export declare const BACKEND_API_KEY = "_BACKEND_API_KEY";
|
|
3
|
+
export declare const APP_API_KEY = "APP_API_KEY";
|
|
4
|
+
export declare const AGENT_API_HEADER = "x-squid-agent-api-key";
|
|
5
|
+
export interface AgentSecrets {
|
|
6
|
+
apiKey: ApiKeyEntry | undefined;
|
|
7
|
+
}
|