@madewithremy/admin 0.1.57 → 0.1.59
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/client.d.ts +199 -0
- package/dist/config.d.ts +8 -0
- package/dist/ctx.d.ts +36 -0
- package/dist/errors.d.ts +68 -0
- package/dist/http.d.ts +68 -0
- package/dist/index.d.ts +7 -9442
- package/dist/index.js +6 -14
- package/dist/index.js.map +7 -1
- package/dist/ops/agent.d.ts +44 -0
- package/dist/ops/analytics.d.ts +285 -0
- package/dist/ops/apps.d.ts +33 -0
- package/dist/ops/crashes.d.ts +86 -0
- package/dist/ops/cron.d.ts +40 -0
- package/dist/ops/data.d.ts +68 -0
- package/dist/ops/dataSourceConnectors.d.ts +80 -0
- package/dist/ops/dataSourceEvals.d.ts +208 -0
- package/dist/ops/dataSourceJobs.d.ts +141 -0
- package/dist/ops/dataSourceMappers.d.ts +125 -0
- package/dist/ops/dataSources.d.ts +654 -0
- package/dist/ops/db.d.ts +81 -0
- package/dist/ops/diagnostics.d.ts +42 -0
- package/dist/ops/domains.d.ts +250 -0
- package/dist/ops/email.d.ts +305 -0
- package/dist/ops/events.d.ts +56 -0
- package/dist/ops/feedback.d.ts +24 -0
- package/dist/ops/files.d.ts +166 -0
- package/dist/ops/infra.d.ts +163 -0
- package/dist/ops/issues.d.ts +160 -0
- package/dist/ops/jewels.d.ts +249 -0
- package/dist/ops/methods.d.ts +60 -0
- package/dist/ops/prerender.d.ts +74 -0
- package/dist/ops/previews.d.ts +52 -0
- package/dist/ops/qaRecordings.d.ts +68 -0
- package/dist/ops/releases.d.ts +193 -0
- package/dist/ops/requests.d.ts +73 -0
- package/dist/ops/secrets.d.ts +61 -0
- package/dist/ops/settings.d.ts +45 -0
- package/dist/ops/tasks.d.ts +47 -0
- package/dist/ops/usage.d.ts +40 -0
- package/dist/ops/users.d.ts +59 -0
- package/dist/ops/voice.d.ts +178 -0
- package/dist/output.d.ts +19 -0
- package/dist/parseJsonConfig.d.ts +41 -0
- package/dist/poll.d.ts +38 -0
- package/dist/prod.js +39 -55
- package/dist/runningMethod.d.ts +25 -0
- package/dist/sleep.d.ts +12 -0
- package/dist/types/agent.d.ts +95 -0
- package/dist/types/analytics.d.ts +225 -0
- package/dist/types/apps.d.ts +39 -0
- package/dist/types/crashes.d.ts +81 -0
- package/dist/types/cron.d.ts +68 -0
- package/dist/types/data.d.ts +38 -0
- package/dist/types/dataSourceConnectors.d.ts +59 -0
- package/dist/types/dataSourceEvals.d.ts +225 -0
- package/dist/types/dataSourceJobs.d.ts +283 -0
- package/dist/types/dataSourceMappers.d.ts +204 -0
- package/dist/types/dataSourceReaders.d.ts +102 -0
- package/dist/types/dataSources.d.ts +627 -0
- package/dist/types/db.d.ts +63 -0
- package/dist/types/diagnostics.d.ts +96 -0
- package/dist/types/domains.d.ts +277 -0
- package/dist/types/email.d.ts +400 -0
- package/dist/types/events.d.ts +54 -0
- package/dist/types/feedback.d.ts +11 -0
- package/dist/types/files.d.ts +150 -0
- package/dist/types/index.d.ts +37 -0
- package/dist/types/infra.d.ts +188 -0
- package/dist/types/issues.d.ts +106 -0
- package/dist/types/jewels.d.ts +336 -0
- package/dist/types/methods.d.ts +34 -0
- package/dist/types/prerender.d.ts +59 -0
- package/dist/types/previews.d.ts +39 -0
- package/dist/types/progress.d.ts +31 -0
- package/dist/types/qaRecordings.d.ts +51 -0
- package/dist/types/releases.d.ts +233 -0
- package/dist/types/requests.d.ts +114 -0
- package/dist/types/secrets.d.ts +42 -0
- package/dist/types/settings.d.ts +79 -0
- package/dist/types/tasks.d.ts +99 -0
- package/dist/types/usage.d.ts +29 -0
- package/dist/types/users.d.ts +61 -0
- package/dist/types/voice.d.ts +197 -0
- package/dist/upload.d.ts +11 -0
- package/package.json +7 -10
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response types for the data-sources management API.
|
|
3
|
+
*
|
|
4
|
+
* Transcribed from the api (apps/api/src/):
|
|
5
|
+
* roles/http/routes/Apps/manage/dataSources/index.ts
|
|
6
|
+
* customerApps/AppDataSources/pipeline.ts
|
|
7
|
+
* customerApps/AppDataSources/searchDataSource.ts
|
|
8
|
+
* customerApps/AppDataSources/dao/DataSourcesDao.ts
|
|
9
|
+
*
|
|
10
|
+
* 204/empty responses surface as `{ ok: true; status: number }` (readBody in api.ts).
|
|
11
|
+
*/
|
|
12
|
+
import type { DataSourceConnector } from './dataSourceConnectors.js';
|
|
13
|
+
import type { DataSourcesHydration } from './dataSourceEvals.js';
|
|
14
|
+
import type { DataSourceJob } from './dataSourceJobs.js';
|
|
15
|
+
import type { DataSourceMapper } from './dataSourceMappers.js';
|
|
16
|
+
import type { DataSourceReader, DataSourceReaderDeliveries } from './dataSourceReaders.js';
|
|
17
|
+
import type { OperationProgress } from './progress.js';
|
|
18
|
+
/**
|
|
19
|
+
* Chunking settings pinned at pipeline creation.
|
|
20
|
+
* Any change requires a revectorize, not a config update.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* `structural` splits on document structure (headings, blocks, paragraphs);
|
|
24
|
+
* `whole` embeds each document as a single chunk, for corpora of short records
|
|
25
|
+
* where the document is the retrieval unit.
|
|
26
|
+
*/
|
|
27
|
+
export type DataSourcesChunkingStrategy = 'structural' | 'whole';
|
|
28
|
+
export interface DataSourcesChunkingConfig {
|
|
29
|
+
strategy: DataSourcesChunkingStrategy;
|
|
30
|
+
version: number;
|
|
31
|
+
/**
|
|
32
|
+
* Rough char budget per chunk; structure wins over budget, never the reverse.
|
|
33
|
+
* For `whole`, the ceiling above which a document is chunked structurally
|
|
34
|
+
* instead (default 24000).
|
|
35
|
+
*/
|
|
36
|
+
maxChars: number;
|
|
37
|
+
/** Below this a chunk is merged forward rather than embedded on its own. */
|
|
38
|
+
minChars: number;
|
|
39
|
+
/**
|
|
40
|
+
* Extraction block types discarded before chunking.
|
|
41
|
+
* Corpus-dependent: page furniture is noise in most corpora.
|
|
42
|
+
*/
|
|
43
|
+
dropBlockTypes: string[];
|
|
44
|
+
}
|
|
45
|
+
/** Ingest configuration pinned to a pipeline version. */
|
|
46
|
+
export interface DataSourcesIngestConfig {
|
|
47
|
+
extraction: {
|
|
48
|
+
modelId: string;
|
|
49
|
+
};
|
|
50
|
+
chunking: DataSourcesChunkingConfig;
|
|
51
|
+
/** Per-chunk LLM context blurb prepended before embedding. */
|
|
52
|
+
contextual: {
|
|
53
|
+
enabled: boolean;
|
|
54
|
+
modelId: string | null;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Vision pass over embedded images. On by default: a text-only document costs
|
|
58
|
+
* nothing, but an undescribed chart is invisible to search.
|
|
59
|
+
*/
|
|
60
|
+
images: {
|
|
61
|
+
describe: boolean;
|
|
62
|
+
modelId: string | null;
|
|
63
|
+
};
|
|
64
|
+
/** Tokenizer version behind the lexical vectors — index and query must agree. */
|
|
65
|
+
sparse: {
|
|
66
|
+
version: number;
|
|
67
|
+
};
|
|
68
|
+
embedding: {
|
|
69
|
+
modelId: string;
|
|
70
|
+
dimensions: number;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Sparse update payloads for POST /datasources/config. Only the keys the
|
|
75
|
+
* caller wants changed are sent — the server deep-merges, so "don't touch"
|
|
76
|
+
* and "turn off" stay distinct on the wire (see configFromFlags).
|
|
77
|
+
*/
|
|
78
|
+
export interface DataSourcesIngestUpdate {
|
|
79
|
+
chunking?: {
|
|
80
|
+
/** Naming a strategy pins its current version; versions are not settable. */
|
|
81
|
+
strategy?: DataSourcesChunkingStrategy;
|
|
82
|
+
maxChars?: number;
|
|
83
|
+
minChars?: number;
|
|
84
|
+
dropBlockTypes?: string[];
|
|
85
|
+
};
|
|
86
|
+
contextual?: {
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
modelId?: string;
|
|
89
|
+
};
|
|
90
|
+
images?: {
|
|
91
|
+
describe?: boolean;
|
|
92
|
+
modelId?: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* `dimensions` must be the model's native size or one of its Matryoshka
|
|
96
|
+
* sizes; omitted = native. Either half alone re-resolves the pair.
|
|
97
|
+
*/
|
|
98
|
+
embedding?: {
|
|
99
|
+
modelId?: string;
|
|
100
|
+
dimensions?: number;
|
|
101
|
+
};
|
|
102
|
+
extraction?: {
|
|
103
|
+
modelId: string;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export interface DataSourcesRetrievalUpdate {
|
|
107
|
+
hybrid?: boolean;
|
|
108
|
+
rerank?: {
|
|
109
|
+
enabled?: boolean;
|
|
110
|
+
modelId?: string;
|
|
111
|
+
};
|
|
112
|
+
topK?: number;
|
|
113
|
+
}
|
|
114
|
+
/** Live retrieval settings — take effect on the next query, no rebuild required. */
|
|
115
|
+
export interface DataSourcesRetrievalConfig {
|
|
116
|
+
/** Fuse dense with lexical. Free to toggle because sparse vectors are always written. */
|
|
117
|
+
hybrid: boolean;
|
|
118
|
+
rerank: {
|
|
119
|
+
enabled: boolean;
|
|
120
|
+
modelId: string | null;
|
|
121
|
+
candidates: number;
|
|
122
|
+
};
|
|
123
|
+
adaptive: {
|
|
124
|
+
enabled: boolean;
|
|
125
|
+
gap: number;
|
|
126
|
+
};
|
|
127
|
+
topK: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Document row as returned by the API.
|
|
131
|
+
*
|
|
132
|
+
* `sourceKey` is store-relative (not an S3 key) and is kept here for
|
|
133
|
+
* completeness, though the CLI does not address objects by it.
|
|
134
|
+
*/
|
|
135
|
+
export interface DataSourcesDocument {
|
|
136
|
+
id: string;
|
|
137
|
+
dataSourceId: string;
|
|
138
|
+
appId: string;
|
|
139
|
+
contentHash: string;
|
|
140
|
+
filename: string | null;
|
|
141
|
+
contentType: string | null;
|
|
142
|
+
sizeBytes: number | null;
|
|
143
|
+
/** Store-relative key for the source document in the datasource-uploads store. */
|
|
144
|
+
sourceKey: string;
|
|
145
|
+
/** App-supplied scalar metadata set at add time; filterable at search time. */
|
|
146
|
+
metadata: Record<string, string | number | boolean> | null;
|
|
147
|
+
/** Entities the document asserts, sorted; null when never set. */
|
|
148
|
+
entities: string[] | null;
|
|
149
|
+
createdAt: string;
|
|
150
|
+
updatedAt: string;
|
|
151
|
+
}
|
|
152
|
+
/** One document with its current build state, as returned by GET /datasources/documents. */
|
|
153
|
+
export interface DataSourcesDocumentStatus {
|
|
154
|
+
id: string;
|
|
155
|
+
filename: string | null;
|
|
156
|
+
contentHash: string;
|
|
157
|
+
/**
|
|
158
|
+
* 'processing' | 'done' | 'error'.
|
|
159
|
+
* A document with no build row yet is also surfaced as 'processing'.
|
|
160
|
+
*/
|
|
161
|
+
status: string;
|
|
162
|
+
errorMessage: string | null;
|
|
163
|
+
chunkCount: number | null;
|
|
164
|
+
pageCount: number | null;
|
|
165
|
+
metadata: Record<string, string | number | boolean> | null;
|
|
166
|
+
entities: string[] | null;
|
|
167
|
+
ingestedAt: string | null;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* GET /datasources/documents — one page of per-document ingest state for one
|
|
171
|
+
* pipeline, oldest first unless `order=newest`; `status=error` is the failures,
|
|
172
|
+
* newest failure first; `filename` a prefix.
|
|
173
|
+
*
|
|
174
|
+
* `pipelineVersion` is absent when the data source does not exist (returns `{ documents: [] }`).
|
|
175
|
+
* `candidate=true` watches a migration in progress. `nextCursor` is set when
|
|
176
|
+
* more pages follow; `allDocuments` walks them.
|
|
177
|
+
*/
|
|
178
|
+
export interface DataSourcesDocumentsResult {
|
|
179
|
+
pipelineVersion?: number;
|
|
180
|
+
nextCursor?: string | null;
|
|
181
|
+
documents: DataSourcesDocumentStatus[];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* POST /datasources/upload-token — discriminated union on `alreadyCurrent`.
|
|
185
|
+
*
|
|
186
|
+
* alreadyCurrent=true: file unchanged; CLI skips upload (metadata updated in-place).
|
|
187
|
+
* alreadyCurrent=false: proceed with presigned upload then confirm via POST /documents.
|
|
188
|
+
*/
|
|
189
|
+
export type DataSourcesUploadTokenResult = {
|
|
190
|
+
alreadyCurrent: true;
|
|
191
|
+
document: DataSourcesDocument;
|
|
192
|
+
/** Mapped sources: what this mapper version produced from the bytes, the first thousand at most. */
|
|
193
|
+
documents?: DataSourcesDocument[];
|
|
194
|
+
/** Mapped sources: how many it produced in all. */
|
|
195
|
+
documentCount?: number;
|
|
196
|
+
} | {
|
|
197
|
+
alreadyCurrent: false;
|
|
198
|
+
contentType: string;
|
|
199
|
+
upload: {
|
|
200
|
+
key: string;
|
|
201
|
+
uploadUrl: string;
|
|
202
|
+
uploadFields: Record<string, string>;
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* POST /datasources/documents — confirm an uploaded object and queue its
|
|
207
|
+
* builds. On a mapped source the object is a raw copy and the mapper decides
|
|
208
|
+
* what it becomes: `documents` holds everything produced, `document` the first
|
|
209
|
+
* of them (null only for a `deletes` outcome). An object that maps to more
|
|
210
|
+
* than a thousand documents returns the first thousand and `job`, which
|
|
211
|
+
* registers and builds the rest.
|
|
212
|
+
*/
|
|
213
|
+
export interface DataSourcesDocumentConfirmResult {
|
|
214
|
+
document: DataSourcesDocument | null;
|
|
215
|
+
documents: DataSourcesDocument[];
|
|
216
|
+
/** Every document the object maps to; `documents.length` unless `job` is set. */
|
|
217
|
+
documentCount: number;
|
|
218
|
+
/** Whether any document was queued for a build. */
|
|
219
|
+
queued: boolean;
|
|
220
|
+
outcome: 'unmapped' | 'documents' | 'passthrough' | 'deletes';
|
|
221
|
+
/** Documents removed or superseded as a result. */
|
|
222
|
+
removed: number;
|
|
223
|
+
/** Documents that failed validation and were not registered; null when none did. */
|
|
224
|
+
invalid: {
|
|
225
|
+
count: number;
|
|
226
|
+
examples: {
|
|
227
|
+
document: number;
|
|
228
|
+
reason: string;
|
|
229
|
+
}[];
|
|
230
|
+
} | null;
|
|
231
|
+
/** The job taking the rest of an object larger than a thousand documents. */
|
|
232
|
+
job: DataSourceJob | null;
|
|
233
|
+
}
|
|
234
|
+
/** Build progress counts used in several list and status shapes. */
|
|
235
|
+
export interface DataSourcesBuildProgress {
|
|
236
|
+
total: number;
|
|
237
|
+
done: number;
|
|
238
|
+
processing: number;
|
|
239
|
+
error: number;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Where a source's index lives. Null is the shared pool. `phase` is the
|
|
243
|
+
* resource's lifecycle phase (see types/infra.ts); anything but `active` means
|
|
244
|
+
* searches on this source fail with `capacity_<phase>`.
|
|
245
|
+
*/
|
|
246
|
+
export interface DataSourcesPlacement {
|
|
247
|
+
resourceId: string;
|
|
248
|
+
name: string | null;
|
|
249
|
+
offeringLabel: string | null;
|
|
250
|
+
phase: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* A placement move in flight on the active version, or the last one's
|
|
254
|
+
* failure; null when idle. The points are copied from durable storage onto
|
|
255
|
+
* the target in the background (no re-embedding); the source flips when
|
|
256
|
+
* `copied` reaches `total`. While it runs, writes to the source are refused
|
|
257
|
+
* with `data_source_migrating`; search keeps serving from the old placement.
|
|
258
|
+
* A sibling of `placement` because a source on the shared pool (placement
|
|
259
|
+
* null) can be moving too.
|
|
260
|
+
*/
|
|
261
|
+
/**
|
|
262
|
+
* Dedicated capacity's index, as Qdrant reports it: `building` while the
|
|
263
|
+
* optimizer is behind the writes (a load can outrun it for a while), `ready`
|
|
264
|
+
* otherwise.
|
|
265
|
+
*/
|
|
266
|
+
export interface DataSourcesIndex {
|
|
267
|
+
state: 'ready' | 'building';
|
|
268
|
+
indexedVectors: number;
|
|
269
|
+
totalVectors: number;
|
|
270
|
+
/** The optimizer's progress in the one shape, with the platform's measured rate and ETA. */
|
|
271
|
+
progress: OperationProgress;
|
|
272
|
+
}
|
|
273
|
+
export interface DataSourcesMigration {
|
|
274
|
+
/** Where it is going; null is the shared pool. */
|
|
275
|
+
toResourceId: string | null;
|
|
276
|
+
toName: string | null;
|
|
277
|
+
copied: number;
|
|
278
|
+
total: number;
|
|
279
|
+
startedAt: string;
|
|
280
|
+
/** Set when the move failed; the source is unfrozen and a new move may start. */
|
|
281
|
+
error: string | null;
|
|
282
|
+
/** The copy in the one progress shape, with the platform's measured rate and ETA. */
|
|
283
|
+
progress: OperationProgress;
|
|
284
|
+
}
|
|
285
|
+
/** A source's committed dictionary: what a push reports, and what the source reads back. */
|
|
286
|
+
export interface DataSourcesDictionaryReport {
|
|
287
|
+
version: number;
|
|
288
|
+
/** The matching rule its names were keyed under, carried from push to push. */
|
|
289
|
+
linkerVersion: number;
|
|
290
|
+
entries: number;
|
|
291
|
+
names: number;
|
|
292
|
+
/** Names more than one id claims: each tags every claimant. */
|
|
293
|
+
ambiguousNames: number;
|
|
294
|
+
/**
|
|
295
|
+
* The names the most ids claim: `name` as you pushed it (one of them, when
|
|
296
|
+
* several fold alike), `key` as the linker matches it (folded, separators
|
|
297
|
+
* dropped), and how many ids claim it.
|
|
298
|
+
*/
|
|
299
|
+
mostClaimed: {
|
|
300
|
+
key: string;
|
|
301
|
+
name?: string;
|
|
302
|
+
ids: number;
|
|
303
|
+
}[];
|
|
304
|
+
/** Names that can't match their own text as written, with a few of them. */
|
|
305
|
+
unmatchable: {
|
|
306
|
+
count: number;
|
|
307
|
+
examples: string[];
|
|
308
|
+
};
|
|
309
|
+
committedAt: string;
|
|
310
|
+
}
|
|
311
|
+
/** POST /datasources/dictionary/commit. */
|
|
312
|
+
export interface DataSourcesDictionaryPushResult extends DataSourcesDictionaryReport {
|
|
313
|
+
/** The push equalled the committed dictionary: no new version, no relink. */
|
|
314
|
+
unchanged: boolean;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* A relink in flight: a version's passages re-tagged against the source's
|
|
318
|
+
* newer dictionary, a lap at a time. A commit mid-lap marks the lap to run
|
|
319
|
+
* once more, which writes little.
|
|
320
|
+
*/
|
|
321
|
+
export interface DataSourcesRelink {
|
|
322
|
+
version: number;
|
|
323
|
+
lap: number;
|
|
324
|
+
walked: number;
|
|
325
|
+
total: number;
|
|
326
|
+
rewritten: number;
|
|
327
|
+
startedAt: string;
|
|
328
|
+
/** Why the lap is holding (the source's dedicated capacity is off). */
|
|
329
|
+
waiting: string | null;
|
|
330
|
+
error: string | null;
|
|
331
|
+
progress: OperationProgress;
|
|
332
|
+
}
|
|
333
|
+
/** POST /datasources/dictionary. */
|
|
334
|
+
export interface DataSourcesDictionaryStatus {
|
|
335
|
+
dictionary: DataSourcesDictionaryReport | null;
|
|
336
|
+
relink: DataSourcesRelink | null;
|
|
337
|
+
candidateRelink: DataSourcesRelink | null;
|
|
338
|
+
}
|
|
339
|
+
/** POST /datasources/link. */
|
|
340
|
+
export interface DataSourcesLinkResult {
|
|
341
|
+
/** The dictionary version that linked, or null when the source has none. */
|
|
342
|
+
version: number | null;
|
|
343
|
+
mentions: {
|
|
344
|
+
ids: string[];
|
|
345
|
+
text: string;
|
|
346
|
+
}[];
|
|
347
|
+
}
|
|
348
|
+
/** One data source in the GET /datasources listing. */
|
|
349
|
+
export interface DataSourcesListEntry {
|
|
350
|
+
id: string;
|
|
351
|
+
slug: string;
|
|
352
|
+
name: string | null;
|
|
353
|
+
/** Total document count (active pipeline). */
|
|
354
|
+
documentCount: number;
|
|
355
|
+
/**
|
|
356
|
+
* The most documents the source may hold, the app's limit; null when
|
|
357
|
+
* unlimited. An add past it is refused with `document_limit_reached`.
|
|
358
|
+
*/
|
|
359
|
+
documentLimit: number | null;
|
|
360
|
+
counts: DataSourcesBuildProgress;
|
|
361
|
+
/** Source-document bytes (does not include vector storage). */
|
|
362
|
+
storageBytes: number;
|
|
363
|
+
chunkCount: number;
|
|
364
|
+
/** When the most recent document finished building on the active version. */
|
|
365
|
+
lastIngestedAt: string | null;
|
|
366
|
+
activeVersion: number | null;
|
|
367
|
+
embeddingModelId: string | null;
|
|
368
|
+
dimensions: number | null;
|
|
369
|
+
/** Present while a revectorization is in flight. */
|
|
370
|
+
candidate: {
|
|
371
|
+
version: number;
|
|
372
|
+
progress: DataSourcesBuildProgress;
|
|
373
|
+
} | null;
|
|
374
|
+
/** Dedicated placement, or null for the shared pool. */
|
|
375
|
+
placement: DataSourcesPlacement | null;
|
|
376
|
+
/** A move in flight, or its last failure. */
|
|
377
|
+
migration: DataSourcesMigration | null;
|
|
378
|
+
/** The bulk ingestion job in flight on this source, if any. */
|
|
379
|
+
job: DataSourceJob | null;
|
|
380
|
+
/** The S3 bucket this source follows, if it is connected to one. */
|
|
381
|
+
connector: DataSourceConnector | null;
|
|
382
|
+
/** An index reload in flight after an eviction, or its last failure. */
|
|
383
|
+
hydration: DataSourcesHydration | null;
|
|
384
|
+
/** The source's current dictionary, or null when none was pushed. */
|
|
385
|
+
dictionary: DataSourcesDictionaryReport | null;
|
|
386
|
+
/** A relink of the active version onto the dictionary, while one runs. */
|
|
387
|
+
relink: DataSourcesRelink | null;
|
|
388
|
+
/**
|
|
389
|
+
* Dedicated capacity only; null on the shared pool. `building` while the
|
|
390
|
+
* optimizer is behind the writes, `ready` otherwise. Search answers
|
|
391
|
+
* `index_building` (503) while building.
|
|
392
|
+
*/
|
|
393
|
+
index: DataSourcesIndex | null;
|
|
394
|
+
/** The source this one was sampled from (`datasources sample`), or null. */
|
|
395
|
+
sampleOf: string | null;
|
|
396
|
+
/** The mapper the live release declares for this source, or null. */
|
|
397
|
+
mapper: DataSourceMapper | null;
|
|
398
|
+
/** The reader the live release declares for this source, or null. */
|
|
399
|
+
reader: (DataSourceReader & {
|
|
400
|
+
deliveries: DataSourceReaderDeliveries;
|
|
401
|
+
}) | null;
|
|
402
|
+
createdAt: string;
|
|
403
|
+
}
|
|
404
|
+
/** GET /datasources — all data sources for the app. */
|
|
405
|
+
export interface DataSourcesListResult {
|
|
406
|
+
dataSources: DataSourcesListEntry[];
|
|
407
|
+
}
|
|
408
|
+
/** Citation pointing a search result back at its source document. */
|
|
409
|
+
export interface DataSourcesSearchCitation {
|
|
410
|
+
documentId: string;
|
|
411
|
+
filename: string | null;
|
|
412
|
+
pageNumber: number | null;
|
|
413
|
+
/** Position within the document — joins a hit back to GET /chunks. */
|
|
414
|
+
chunkIndex: number | null;
|
|
415
|
+
headingPath: string[];
|
|
416
|
+
boundingBox?: {
|
|
417
|
+
topLeftX: number;
|
|
418
|
+
topLeftY: number;
|
|
419
|
+
bottomRightX: number;
|
|
420
|
+
bottomRightY: number;
|
|
421
|
+
};
|
|
422
|
+
/** On-domain URL for the source document. */
|
|
423
|
+
url: string;
|
|
424
|
+
}
|
|
425
|
+
/** One search result from POST /datasources/search. */
|
|
426
|
+
export interface DataSourcesSearchResultItem {
|
|
427
|
+
score: number;
|
|
428
|
+
text: string;
|
|
429
|
+
/** The entities this passage carries (its document's asserted ids). */
|
|
430
|
+
entities: string[];
|
|
431
|
+
citation: DataSourcesSearchCitation;
|
|
432
|
+
/** Rank and score from retrieval, before reranking. */
|
|
433
|
+
retrievalRank?: number;
|
|
434
|
+
retrievalScore?: number;
|
|
435
|
+
/** Branch attribution — only when `explain` was asked for. */
|
|
436
|
+
explain?: unknown;
|
|
437
|
+
/** base64 Float32Array — only when `includeVectors` was asked for. */
|
|
438
|
+
vector?: string;
|
|
439
|
+
/** Surrounding chunks — only when `expand` was asked for. */
|
|
440
|
+
neighbors?: {
|
|
441
|
+
before: string[];
|
|
442
|
+
after: string[];
|
|
443
|
+
};
|
|
444
|
+
/** Query-term offsets into `text` — only when `highlight` was asked for. */
|
|
445
|
+
matches?: {
|
|
446
|
+
start: number;
|
|
447
|
+
end: number;
|
|
448
|
+
token: string;
|
|
449
|
+
}[];
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* POST /datasources/count. An exact containment count over the filter, in
|
|
453
|
+
* chunks (passages): `contains` = all the words, any order. Not the set
|
|
454
|
+
* `search` returns and not a relevance count, which does not exist.
|
|
455
|
+
*/
|
|
456
|
+
export interface DataSourcesCountResult {
|
|
457
|
+
chunks: number;
|
|
458
|
+
pipelineVersion: number;
|
|
459
|
+
latencyMs: number;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* POST /datasources/entities. The entities the passages matching a filter are
|
|
463
|
+
* about, most first. `chunks` is passages carrying each id, not documents, and
|
|
464
|
+
* approximate.
|
|
465
|
+
*/
|
|
466
|
+
export interface DataSourcesEntitiesResult {
|
|
467
|
+
entities: {
|
|
468
|
+
id: string;
|
|
469
|
+
chunks: number;
|
|
470
|
+
}[];
|
|
471
|
+
pipelineVersion: number;
|
|
472
|
+
latencyMs: number;
|
|
473
|
+
}
|
|
474
|
+
/** One passage of a listing: a search hit without the ranking. */
|
|
475
|
+
export interface DataSourcesPassage {
|
|
476
|
+
text: string;
|
|
477
|
+
entities: string[];
|
|
478
|
+
citation: DataSourcesSearchCitation;
|
|
479
|
+
}
|
|
480
|
+
/** POST /datasources/passages — a page of every passage matching a filter. */
|
|
481
|
+
export interface DataSourcesPassagesResult {
|
|
482
|
+
passages: DataSourcesPassage[];
|
|
483
|
+
/** Pass back as `cursor` for the next page; null after the last. */
|
|
484
|
+
nextCursor: string | null;
|
|
485
|
+
pipelineVersion: number;
|
|
486
|
+
latencyMs: number;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* POST /datasources/search.
|
|
490
|
+
*
|
|
491
|
+
* `mode` reports what actually ran (e.g. `reranked: false` after an adaptive skip
|
|
492
|
+
* or a reranker outage) rather than what was requested.
|
|
493
|
+
*/
|
|
494
|
+
export interface DataSourcesSearchResult {
|
|
495
|
+
results: DataSourcesSearchResultItem[];
|
|
496
|
+
mode: {
|
|
497
|
+
search: 'hybrid' | 'semantic' | 'lexical';
|
|
498
|
+
hybrid: boolean;
|
|
499
|
+
reranked: boolean;
|
|
500
|
+
pipelineVersion: number;
|
|
501
|
+
};
|
|
502
|
+
/** base64 Float32Array — only when `includeQueryVector` was asked for. */
|
|
503
|
+
queryVector?: string;
|
|
504
|
+
elapsedMs: number;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* GET /datasources/config — full pipeline configuration for one data source.
|
|
508
|
+
*
|
|
509
|
+
* Split by change cost: `ingest` is pinned and requires a revectorize to change;
|
|
510
|
+
* `retrieval` is live and takes effect on the next query.
|
|
511
|
+
*/
|
|
512
|
+
export interface DataSourcesConfigResult {
|
|
513
|
+
slug: string;
|
|
514
|
+
ingest: {
|
|
515
|
+
version: number;
|
|
516
|
+
fingerprint: string;
|
|
517
|
+
config: DataSourcesIngestConfig;
|
|
518
|
+
} | null;
|
|
519
|
+
retrieval: Partial<DataSourcesRetrievalConfig>;
|
|
520
|
+
candidate: {
|
|
521
|
+
version: number;
|
|
522
|
+
config: DataSourcesIngestConfig;
|
|
523
|
+
} | null;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* POST /datasources/config — response after updating configuration.
|
|
527
|
+
*
|
|
528
|
+
* `placementChanged` with `migration` set means a populated source started a
|
|
529
|
+
* background move rather than moving on the spot.
|
|
530
|
+
*/
|
|
531
|
+
export interface DataSourcesConfigUpdateResult {
|
|
532
|
+
ingestChanged: boolean;
|
|
533
|
+
placementChanged: boolean;
|
|
534
|
+
ingest: DataSourcesIngestConfig;
|
|
535
|
+
retrieval: Partial<DataSourcesRetrievalConfig>;
|
|
536
|
+
placement: DataSourcesPlacement | null;
|
|
537
|
+
migration: DataSourcesMigration | null;
|
|
538
|
+
}
|
|
539
|
+
/** POST /datasources — an empty source, on the requested placement. */
|
|
540
|
+
export interface DataSourcesCreateResult {
|
|
541
|
+
dataSource: {
|
|
542
|
+
id: string;
|
|
543
|
+
slug: string;
|
|
544
|
+
name: string | null;
|
|
545
|
+
/** Dedicated resource id, or null for the shared pool. */
|
|
546
|
+
resourceId: string | null;
|
|
547
|
+
createdAt: string;
|
|
548
|
+
};
|
|
549
|
+
pipeline: {
|
|
550
|
+
version: number;
|
|
551
|
+
config: DataSourcesIngestConfig;
|
|
552
|
+
};
|
|
553
|
+
placement: DataSourcesPlacement | null;
|
|
554
|
+
migration: DataSourcesMigration | null;
|
|
555
|
+
}
|
|
556
|
+
/** POST /datasources/move — the move as started (or applied, for an empty source). */
|
|
557
|
+
export interface DataSourcesMoveResult {
|
|
558
|
+
placement: DataSourcesPlacement | null;
|
|
559
|
+
/** Null when the source was empty and moved on the spot. */
|
|
560
|
+
migration: DataSourcesMigration | null;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* POST /datasources/revectorize — starts a new candidate pipeline alongside the live one.
|
|
564
|
+
*
|
|
565
|
+
* `changes` is a human-readable list of config diffs between old and new versions.
|
|
566
|
+
*/
|
|
567
|
+
export interface DataSourcesRevectorizeResult {
|
|
568
|
+
candidateVersion: number;
|
|
569
|
+
activeVersion: number;
|
|
570
|
+
/** Number of documents queued for re-embedding. */
|
|
571
|
+
queued: number;
|
|
572
|
+
/** Human-readable list of config changes from the active version. */
|
|
573
|
+
changes: string[];
|
|
574
|
+
}
|
|
575
|
+
/** POST /datasources/promote — make the candidate version live. */
|
|
576
|
+
export interface DataSourcesPromoteResult {
|
|
577
|
+
activeVersion: number;
|
|
578
|
+
/** Version that was retired (replaced); null if no previous active existed. */
|
|
579
|
+
retiredVersion: number | null;
|
|
580
|
+
}
|
|
581
|
+
/** POST /datasources/versions/drop — discard a candidate or retired version. */
|
|
582
|
+
export interface DataSourcesDropResult {
|
|
583
|
+
dropped: number;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* POST /datasources/delete — delete every version, document, and byte. The
|
|
587
|
+
* source is gone to every reader when this returns; its rows and objects are
|
|
588
|
+
* removed by a background job, which `purging` says.
|
|
589
|
+
*/
|
|
590
|
+
export interface DataSourcesDeleteResult {
|
|
591
|
+
deleted: true;
|
|
592
|
+
/** Number of documents being removed. */
|
|
593
|
+
documents: number;
|
|
594
|
+
/** Number of pipeline versions being dropped. */
|
|
595
|
+
versions: number;
|
|
596
|
+
purging: boolean;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* POST /datasources/documents/delete — always responds 204 (empty body).
|
|
600
|
+
*
|
|
601
|
+
* Surfaces as `{ ok: true; status: number }` via readBody in api.ts.
|
|
602
|
+
*/
|
|
603
|
+
export interface DataSourcesDocumentDeleteResult {
|
|
604
|
+
ok: true;
|
|
605
|
+
status: number;
|
|
606
|
+
}
|
|
607
|
+
/**
|
|
608
|
+
* Which documents a bulk removal selects: the row-level half of the search
|
|
609
|
+
* filter (`metadata`, `filename`, `documentIds`) plus `externalIdPrefix`, the
|
|
610
|
+
* identity a bulk job or connector recorded (a customer's key prefix, say).
|
|
611
|
+
* Chunk-level fields and an empty selector are refused.
|
|
612
|
+
*/
|
|
613
|
+
export interface DataSourcesDocumentSelector {
|
|
614
|
+
metadata?: Record<string, string | number | boolean | (string | number | boolean)[] | {
|
|
615
|
+
gte?: number;
|
|
616
|
+
lte?: number;
|
|
617
|
+
}>;
|
|
618
|
+
filename?: string | string[];
|
|
619
|
+
documentIds?: string[];
|
|
620
|
+
externalIdPrefix?: string;
|
|
621
|
+
}
|
|
622
|
+
/** POST /datasources/documents/delete-many — one page of up to 1,000. */
|
|
623
|
+
export interface DataSourcesDocumentDeleteManyResult {
|
|
624
|
+
deleted: number;
|
|
625
|
+
/** Still matching after this page; call again while > 0. */
|
|
626
|
+
remaining: number;
|
|
627
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Response types for the db command group.
|
|
3
|
+
*
|
|
4
|
+
* Sources in the api (apps/api/src/):
|
|
5
|
+
* POST /db/query → roles/http/routes/Apps/manage/dbQuery.ts
|
|
6
|
+
* AppDatabasesDao.executeSqlBatch returns
|
|
7
|
+
* Array<{ rows: any[]; changes: number }>
|
|
8
|
+
* GET /db/history → the same file, over ReleasesDao.listPublishedReleases
|
|
9
|
+
* (PublishedRelease, AppReleases/types/release.ts)
|
|
10
|
+
* POST /db/history/query, /db/history/attach → the same file; answered as
|
|
11
|
+
* /db/query is
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Response from GET /_internal/v2/apps/:appId/db/history: the app's releases
|
|
15
|
+
* that were ever live, newest first, with the window each was live for.
|
|
16
|
+
*/
|
|
17
|
+
export interface DbHistoryResult {
|
|
18
|
+
copies: Array<{
|
|
19
|
+
releaseId: string;
|
|
20
|
+
commitSha: string;
|
|
21
|
+
/** First line of the release's commit message. */
|
|
22
|
+
subject: string;
|
|
23
|
+
/** When the release went live (ISO). */
|
|
24
|
+
liveFrom: string;
|
|
25
|
+
/**
|
|
26
|
+
* When the next release replaced it (ISO): its database holds live as it
|
|
27
|
+
* stood at that moment. Null for the release live now.
|
|
28
|
+
*/
|
|
29
|
+
liveUntil: string | null;
|
|
30
|
+
/** The release live now, whose database is live: query it with `db query`. */
|
|
31
|
+
current: boolean;
|
|
32
|
+
/** The release's databases; history commands use the one named as live's default. */
|
|
33
|
+
databases: Array<{
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
}>;
|
|
37
|
+
}>;
|
|
38
|
+
/** Pass back as `cursor` for the next page; null on the last one. */
|
|
39
|
+
nextCursor: string | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Response from POST /_internal/v2/apps/:appId/db/query.
|
|
43
|
+
* Used by both 'db query' and 'db tables'. Row values are database-specific
|
|
44
|
+
* and typed unknown; changes is the SQLite rowcount for DML statements.
|
|
45
|
+
*/
|
|
46
|
+
export interface DbQueryResult {
|
|
47
|
+
results: Array<{
|
|
48
|
+
/** Result rows from the query. Values are dynamic; typed unknown. */
|
|
49
|
+
rows: unknown[];
|
|
50
|
+
/** Rows modified by a DML statement; 0 for SELECT. */
|
|
51
|
+
changes: number;
|
|
52
|
+
}>;
|
|
53
|
+
/**
|
|
54
|
+
* Display info for the people the rows reference (user-typed columns hold
|
|
55
|
+
* `@@user@@<id>`), keyed by user id. Only people the workspace may see.
|
|
56
|
+
*/
|
|
57
|
+
resolvedUsers: Record<string, {
|
|
58
|
+
id: string;
|
|
59
|
+
username: string;
|
|
60
|
+
displayName: string | null;
|
|
61
|
+
profilePictureUrl: string | null;
|
|
62
|
+
}>;
|
|
63
|
+
}
|