@awesomate/platform-sdk 0.1.0
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/README.md +92 -0
- package/dist/cjs/client.d.ts +128 -0
- package/dist/cjs/client.js +257 -0
- package/dist/cjs/client.js.map +1 -0
- package/dist/cjs/http.d.ts +27 -0
- package/dist/cjs/http.js +127 -0
- package/dist/cjs/http.js.map +1 -0
- package/dist/cjs/index.d.ts +9 -0
- package/dist/cjs/index.js +35 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/service.d.ts +140 -0
- package/dist/cjs/service.js +216 -0
- package/dist/cjs/service.js.map +1 -0
- package/dist/cjs/sign.d.ts +11 -0
- package/dist/cjs/sign.js +41 -0
- package/dist/cjs/sign.js.map +1 -0
- package/dist/cjs/sse.d.ts +27 -0
- package/dist/cjs/sse.js +130 -0
- package/dist/cjs/sse.js.map +1 -0
- package/dist/cjs/types.d.ts +517 -0
- package/dist/cjs/types.js +4 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/client.d.ts +128 -0
- package/dist/esm/client.js +251 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/http.d.ts +27 -0
- package/dist/esm/http.js +116 -0
- package/dist/esm/http.js.map +1 -0
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/service.d.ts +140 -0
- package/dist/esm/service.js +210 -0
- package/dist/esm/service.js.map +1 -0
- package/dist/esm/sign.d.ts +11 -0
- package/dist/esm/sign.js +36 -0
- package/dist/esm/sign.js.map +1 -0
- package/dist/esm/sse.d.ts +27 -0
- package/dist/esm/sse.js +125 -0
- package/dist/esm/sse.js.map +1 -0
- package/dist/esm/types.d.ts +517 -0
- package/dist/esm/types.js +3 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every call resolves to one of three outcomes and never throws on the request path:
|
|
3
|
+
* a 2xx with typed data; a 4xx with the platform's error envelope; or `unavailable`
|
|
4
|
+
* (5xx, timeout, network failure, missing config) so callers can answer 503/202 cleanly.
|
|
5
|
+
*/
|
|
6
|
+
export type PlatformResult<T> = {
|
|
7
|
+
ok: true;
|
|
8
|
+
status: number;
|
|
9
|
+
data: T;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
status: number;
|
|
13
|
+
error: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
requestId?: string;
|
|
16
|
+
retryAfter?: string;
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
reason: "unavailable";
|
|
20
|
+
};
|
|
21
|
+
export type PlatformFailure = Exclude<PlatformResult<never>, {
|
|
22
|
+
ok: true;
|
|
23
|
+
}>;
|
|
24
|
+
export type KeyClass = "q" | "p" | "i" | "a" | "s" | "u";
|
|
25
|
+
export type AnswerStatus = "ok" | "no_results" | "failed_validation" | "error";
|
|
26
|
+
export type AgentName = "knowledge" | "content" | "social" | "assistant" | (string & {});
|
|
27
|
+
export interface AnswerRequest {
|
|
28
|
+
/** ≤ 2000 chars. */
|
|
29
|
+
question: string;
|
|
30
|
+
/** ≤ 128 chars, end-user session id; omitted → the platform generates one and echoes it. */
|
|
31
|
+
session?: string;
|
|
32
|
+
/** Default = the tenant's `default_agent`. */
|
|
33
|
+
agent?: AgentName;
|
|
34
|
+
/** 1–10, default 3. */
|
|
35
|
+
max_sources?: number;
|
|
36
|
+
/** v2: run a published agent by id with the v1 response shape. */
|
|
37
|
+
agent_id?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface AnswerSource {
|
|
40
|
+
ref: number;
|
|
41
|
+
doc_id: string;
|
|
42
|
+
title: string;
|
|
43
|
+
kind: string;
|
|
44
|
+
section_path: string;
|
|
45
|
+
locator: string | null;
|
|
46
|
+
url: string | null;
|
|
47
|
+
excerpt: string;
|
|
48
|
+
}
|
|
49
|
+
export interface Citation {
|
|
50
|
+
doc_id: string;
|
|
51
|
+
section_path: string;
|
|
52
|
+
}
|
|
53
|
+
export interface Answer {
|
|
54
|
+
tenant: string;
|
|
55
|
+
status: AnswerStatus;
|
|
56
|
+
/** Internal form with `[[doc_id#Section]]` markers; empty unless status is `ok`. */
|
|
57
|
+
answer: string;
|
|
58
|
+
/** End-user form: markers replaced by [1], [2]…; the tenant's `no_answer_message` when status ≠ ok. */
|
|
59
|
+
answer_plain: string;
|
|
60
|
+
sources: AnswerSource[];
|
|
61
|
+
citations: Citation[];
|
|
62
|
+
score: number;
|
|
63
|
+
attempts: number;
|
|
64
|
+
mode: string;
|
|
65
|
+
retrieved: Citation[];
|
|
66
|
+
tools: string[];
|
|
67
|
+
session: string;
|
|
68
|
+
}
|
|
69
|
+
/** The `meta` SSE event — the validated result minus the text that already streamed. */
|
|
70
|
+
export interface AnswerMeta {
|
|
71
|
+
status: AnswerStatus;
|
|
72
|
+
citations: Citation[];
|
|
73
|
+
score: number;
|
|
74
|
+
attempts: number;
|
|
75
|
+
mode: string;
|
|
76
|
+
retrieved: Array<Citation & Record<string, unknown>>;
|
|
77
|
+
tools: string[];
|
|
78
|
+
sources: Array<Record<string, unknown>>;
|
|
79
|
+
thread?: string;
|
|
80
|
+
repaired?: "stripped_uncited" | "regenerated" | "truncated" | (string & {});
|
|
81
|
+
/** v2 grounded_chat agents: the one documented client-side retraction. */
|
|
82
|
+
reply_override?: string;
|
|
83
|
+
[extra: string]: unknown;
|
|
84
|
+
}
|
|
85
|
+
export type AnswerStreamEvent = {
|
|
86
|
+
event: "sources";
|
|
87
|
+
sources: Array<Record<string, unknown>>;
|
|
88
|
+
} | {
|
|
89
|
+
event: "answer";
|
|
90
|
+
text: string;
|
|
91
|
+
} | {
|
|
92
|
+
event: "reply";
|
|
93
|
+
text: string;
|
|
94
|
+
} | {
|
|
95
|
+
event: "meta";
|
|
96
|
+
meta: AnswerMeta;
|
|
97
|
+
} | {
|
|
98
|
+
event: "done";
|
|
99
|
+
} | {
|
|
100
|
+
event: "error";
|
|
101
|
+
message: string;
|
|
102
|
+
};
|
|
103
|
+
export interface QueryHit {
|
|
104
|
+
doc_id: string;
|
|
105
|
+
section_path: string;
|
|
106
|
+
title: string;
|
|
107
|
+
kind: string | null;
|
|
108
|
+
excerpt: string;
|
|
109
|
+
score: number | null;
|
|
110
|
+
url: string | null;
|
|
111
|
+
locator: string | null;
|
|
112
|
+
}
|
|
113
|
+
export interface QueryResponse {
|
|
114
|
+
tenant: string;
|
|
115
|
+
query: string;
|
|
116
|
+
hits: QueryHit[];
|
|
117
|
+
}
|
|
118
|
+
export interface QueryParams {
|
|
119
|
+
q: string;
|
|
120
|
+
/** 1–20, default 8. */
|
|
121
|
+
limit?: number;
|
|
122
|
+
kind?: string;
|
|
123
|
+
/** One dataset (`knowledge`, `content`, `social`, …); omitted → fan-out over everything enabled. */
|
|
124
|
+
dataset?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface Whoami {
|
|
127
|
+
tenant: string;
|
|
128
|
+
display_name: string;
|
|
129
|
+
status: string;
|
|
130
|
+
plan: string;
|
|
131
|
+
key: {
|
|
132
|
+
id: string;
|
|
133
|
+
class: string;
|
|
134
|
+
scope?: string;
|
|
135
|
+
scopes?: string[];
|
|
136
|
+
expires_at?: string | null;
|
|
137
|
+
};
|
|
138
|
+
datasets: string[];
|
|
139
|
+
counts: {
|
|
140
|
+
sources: number;
|
|
141
|
+
chunks: number;
|
|
142
|
+
indexed: number;
|
|
143
|
+
};
|
|
144
|
+
last_indexed_at: string | null;
|
|
145
|
+
}
|
|
146
|
+
export interface Status {
|
|
147
|
+
tenant?: string;
|
|
148
|
+
jobs: {
|
|
149
|
+
queued: number;
|
|
150
|
+
running: number;
|
|
151
|
+
failed: number;
|
|
152
|
+
};
|
|
153
|
+
time_to_searchable_p50_min: number | null;
|
|
154
|
+
sources_by_kind: Record<string, number>;
|
|
155
|
+
}
|
|
156
|
+
export interface Feedback {
|
|
157
|
+
session?: string;
|
|
158
|
+
/** 1–10, the `sources[].ref` being rated. */
|
|
159
|
+
ref?: number;
|
|
160
|
+
rating: "up" | "down";
|
|
161
|
+
/** ≤ 500 chars. */
|
|
162
|
+
comment?: string;
|
|
163
|
+
}
|
|
164
|
+
export type IngestKind = "markdown" | "pdf" | "facebook-export" | "html-url" | "html-sitemap" | "video" | "audio" | "image" | "data-import" | (string & {});
|
|
165
|
+
export type JobStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled";
|
|
166
|
+
/** One entry of `IngestJob.stages`, as the worker pipeline writes it. */
|
|
167
|
+
export interface JobStage {
|
|
168
|
+
status: string;
|
|
169
|
+
at?: string;
|
|
170
|
+
error?: string | null;
|
|
171
|
+
[extra: string]: unknown;
|
|
172
|
+
}
|
|
173
|
+
export interface IngestJob {
|
|
174
|
+
job_id: string;
|
|
175
|
+
kind: IngestKind;
|
|
176
|
+
status: JobStatus;
|
|
177
|
+
/** Keyed by stage name (`fetch`, `parse`, `upsert`, `enrich`, `index`, `finalize`, …), not an array. */
|
|
178
|
+
stages?: Record<string, JobStage>;
|
|
179
|
+
result_summary?: Record<string, unknown> | null;
|
|
180
|
+
error?: string | null;
|
|
181
|
+
cost?: Record<string, unknown> | null;
|
|
182
|
+
created_at: string;
|
|
183
|
+
started_at?: string | null;
|
|
184
|
+
finished_at?: string | null;
|
|
185
|
+
}
|
|
186
|
+
export interface UploadTicket {
|
|
187
|
+
upload_id: string;
|
|
188
|
+
key: string;
|
|
189
|
+
put_url?: string;
|
|
190
|
+
multipart?: {
|
|
191
|
+
upload_id: string;
|
|
192
|
+
part_urls: string[];
|
|
193
|
+
};
|
|
194
|
+
expires_at: string;
|
|
195
|
+
}
|
|
196
|
+
export interface CreateUploadBody {
|
|
197
|
+
filename: string;
|
|
198
|
+
mime: string;
|
|
199
|
+
size_bytes: number;
|
|
200
|
+
sha256?: string;
|
|
201
|
+
}
|
|
202
|
+
export interface CompleteUploadBody {
|
|
203
|
+
sha256?: string;
|
|
204
|
+
parts?: Array<{
|
|
205
|
+
etag: string;
|
|
206
|
+
part: number;
|
|
207
|
+
}>;
|
|
208
|
+
}
|
|
209
|
+
export type CreateJobBody = {
|
|
210
|
+
kind: IngestKind;
|
|
211
|
+
upload_id: string;
|
|
212
|
+
options?: Record<string, unknown>;
|
|
213
|
+
} | {
|
|
214
|
+
kind: IngestKind;
|
|
215
|
+
url: string;
|
|
216
|
+
options?: Record<string, unknown>;
|
|
217
|
+
};
|
|
218
|
+
export interface Enqueued {
|
|
219
|
+
job_id: string;
|
|
220
|
+
status: JobStatus;
|
|
221
|
+
position?: number;
|
|
222
|
+
}
|
|
223
|
+
export interface JobsPage {
|
|
224
|
+
jobs: IngestJob[];
|
|
225
|
+
next_cursor: string | null;
|
|
226
|
+
}
|
|
227
|
+
export interface DatasetSummary {
|
|
228
|
+
dataset_id: string;
|
|
229
|
+
name: string;
|
|
230
|
+
description?: string | null;
|
|
231
|
+
grain?: string | null;
|
|
232
|
+
status: string;
|
|
233
|
+
record_count: number;
|
|
234
|
+
period_from?: string | null;
|
|
235
|
+
period_to?: string | null;
|
|
236
|
+
updated_at: string;
|
|
237
|
+
}
|
|
238
|
+
export interface DataQuery {
|
|
239
|
+
dataset: string;
|
|
240
|
+
measures: Array<{
|
|
241
|
+
column: string;
|
|
242
|
+
agg: "sum" | "avg" | "min" | "max" | "count" | "last";
|
|
243
|
+
}>;
|
|
244
|
+
dimensions?: string[];
|
|
245
|
+
time?: {
|
|
246
|
+
grain?: string;
|
|
247
|
+
preset?: string;
|
|
248
|
+
from?: string;
|
|
249
|
+
to?: string;
|
|
250
|
+
};
|
|
251
|
+
filters?: Array<{
|
|
252
|
+
column: string;
|
|
253
|
+
op: "eq" | "neq" | "in" | "gte" | "lte" | "contains";
|
|
254
|
+
value: unknown;
|
|
255
|
+
}>;
|
|
256
|
+
compare?: "previous_period" | "previous_year" | null;
|
|
257
|
+
order_by?: Array<{
|
|
258
|
+
field: string;
|
|
259
|
+
dir: "asc" | "desc";
|
|
260
|
+
}>;
|
|
261
|
+
limit?: number;
|
|
262
|
+
}
|
|
263
|
+
export interface DataQueryResult {
|
|
264
|
+
dataset_id: string;
|
|
265
|
+
columns: Array<Record<string, unknown>>;
|
|
266
|
+
rows: Array<Record<string, unknown>>;
|
|
267
|
+
data_ref: string;
|
|
268
|
+
truncated: boolean;
|
|
269
|
+
elapsed_ms: number;
|
|
270
|
+
applied_defaults?: string[];
|
|
271
|
+
}
|
|
272
|
+
export type CreateImportBody = {
|
|
273
|
+
upload_id: string;
|
|
274
|
+
} | {
|
|
275
|
+
rows: unknown[];
|
|
276
|
+
dataset_id?: string;
|
|
277
|
+
mode?: "auto" | "append" | "new";
|
|
278
|
+
answers?: Record<string, string>;
|
|
279
|
+
};
|
|
280
|
+
export interface Tenant {
|
|
281
|
+
id: string;
|
|
282
|
+
contact_id: number;
|
|
283
|
+
display_name: string;
|
|
284
|
+
plan: string;
|
|
285
|
+
status: "active" | "suspended" | "deleted" | (string & {});
|
|
286
|
+
config?: Record<string, unknown>;
|
|
287
|
+
datasets?: string[];
|
|
288
|
+
}
|
|
289
|
+
export interface UpsertTenantBody {
|
|
290
|
+
contact_id: number;
|
|
291
|
+
display_name: string;
|
|
292
|
+
plan: string;
|
|
293
|
+
status?: string;
|
|
294
|
+
config?: Record<string, unknown>;
|
|
295
|
+
datasets?: string[];
|
|
296
|
+
}
|
|
297
|
+
export interface MintKeyBody {
|
|
298
|
+
class: "q" | "p" | "i";
|
|
299
|
+
name: string;
|
|
300
|
+
expires_in_s?: number;
|
|
301
|
+
allowed_origins?: string[];
|
|
302
|
+
}
|
|
303
|
+
export interface MintedKey {
|
|
304
|
+
key_id: string;
|
|
305
|
+
key_prefix: string;
|
|
306
|
+
/** Plaintext — returned by the platform exactly ONCE. Hand it to its destination and discard. */
|
|
307
|
+
key: string;
|
|
308
|
+
}
|
|
309
|
+
export interface TenantKeyMeta {
|
|
310
|
+
key_id: string;
|
|
311
|
+
key_prefix: string;
|
|
312
|
+
class?: string;
|
|
313
|
+
scopes?: string[];
|
|
314
|
+
expires_at?: string | null;
|
|
315
|
+
}
|
|
316
|
+
/** The `entities.resolve` job the tenant detail reports (null when none has ever run). */
|
|
317
|
+
export interface ResolutionJobMeta {
|
|
318
|
+
job_id: string;
|
|
319
|
+
status: JobStatus | (string & {});
|
|
320
|
+
started_at: string | null;
|
|
321
|
+
finished_at: string | null;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Entity-layer fields arrive together once the platform deploys the layer (always present,
|
|
325
|
+
* 0/null, from then on). `people_named` doubles as the capability probe: `'people_named' in
|
|
326
|
+
* counts` → the layer exists.
|
|
327
|
+
*/
|
|
328
|
+
export interface TenantCounts {
|
|
329
|
+
sources: number;
|
|
330
|
+
chunks: number;
|
|
331
|
+
jobs_queued: number;
|
|
332
|
+
jobs_running: number;
|
|
333
|
+
storage_bytes: number;
|
|
334
|
+
people_named?: number;
|
|
335
|
+
people_unknown?: number;
|
|
336
|
+
aliases_pending?: number;
|
|
337
|
+
entities_place?: number;
|
|
338
|
+
entities_topic?: number;
|
|
339
|
+
last_resolution_at?: string | null;
|
|
340
|
+
resolution_job?: ResolutionJobMeta | null;
|
|
341
|
+
}
|
|
342
|
+
export interface TenantDetail {
|
|
343
|
+
tenant: Tenant;
|
|
344
|
+
keys?: TenantKeyMeta[];
|
|
345
|
+
counts?: TenantCounts;
|
|
346
|
+
}
|
|
347
|
+
export interface PurgeJob {
|
|
348
|
+
purge_job_id?: string;
|
|
349
|
+
tenant_id?: string;
|
|
350
|
+
state: "running" | "done" | "failed";
|
|
351
|
+
purged: {
|
|
352
|
+
pg: number | boolean;
|
|
353
|
+
meili: number | boolean;
|
|
354
|
+
media: number | boolean;
|
|
355
|
+
memory: number | boolean;
|
|
356
|
+
};
|
|
357
|
+
error?: string;
|
|
358
|
+
started_at?: string;
|
|
359
|
+
finished_at?: string;
|
|
360
|
+
}
|
|
361
|
+
export interface UsageRow {
|
|
362
|
+
tenant_id: string;
|
|
363
|
+
day: string;
|
|
364
|
+
kind: string;
|
|
365
|
+
quantity: number;
|
|
366
|
+
unit: string;
|
|
367
|
+
cost_usd: number;
|
|
368
|
+
}
|
|
369
|
+
/** Metadata-only source row — content fields are omitted by construction on the platform side. */
|
|
370
|
+
export interface SourceMeta {
|
|
371
|
+
source_id: string;
|
|
372
|
+
kind: string;
|
|
373
|
+
title: string;
|
|
374
|
+
url?: string | null;
|
|
375
|
+
size_bytes?: number | null;
|
|
376
|
+
segments: number;
|
|
377
|
+
chunks: number;
|
|
378
|
+
indexed_chunks: number;
|
|
379
|
+
status: "indexing" | "ready" | "failed";
|
|
380
|
+
created_at: string;
|
|
381
|
+
updated_at: string;
|
|
382
|
+
tags?: string[];
|
|
383
|
+
}
|
|
384
|
+
export interface SourcesPage {
|
|
385
|
+
sources: SourceMeta[];
|
|
386
|
+
next_cursor: string | null;
|
|
387
|
+
}
|
|
388
|
+
/** `GET /v1/admin/tenants/:id/sources/summary` — whole-library counts in one call. */
|
|
389
|
+
export interface SourceSummary {
|
|
390
|
+
total: number;
|
|
391
|
+
by_kind: Record<string, number>;
|
|
392
|
+
chunks: number;
|
|
393
|
+
indexed_chunks: number;
|
|
394
|
+
failed_sources: number;
|
|
395
|
+
last_indexed_at: string | null;
|
|
396
|
+
}
|
|
397
|
+
/** Job as GET /v1/ingest/jobs/:id plus the admin channel's dead-lettered webhook state. */
|
|
398
|
+
export interface IngestJobMeta extends IngestJob {
|
|
399
|
+
webhook?: {
|
|
400
|
+
delivered: boolean;
|
|
401
|
+
dead: boolean;
|
|
402
|
+
attempts: number;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
export interface AdminJobsPage {
|
|
406
|
+
jobs: IngestJobMeta[];
|
|
407
|
+
next_cursor: string | null;
|
|
408
|
+
}
|
|
409
|
+
export type CreateSourceBody = {
|
|
410
|
+
url: string;
|
|
411
|
+
} | {
|
|
412
|
+
sitemap: string;
|
|
413
|
+
since?: string;
|
|
414
|
+
} | {
|
|
415
|
+
upload_token: string;
|
|
416
|
+
kind?: IngestKind;
|
|
417
|
+
filename?: string;
|
|
418
|
+
options?: Record<string, unknown>;
|
|
419
|
+
};
|
|
420
|
+
export type PersonStatus = "named" | "unknown" | "hidden";
|
|
421
|
+
export type EntityKind = "person" | "place" | "topic";
|
|
422
|
+
/** One row of `GET …/people`. `display_name` is null for unnamed clusters; the handle is the
|
|
423
|
+
* platform's opaque per-tenant label, never a name. */
|
|
424
|
+
export interface PersonMeta {
|
|
425
|
+
person_id: string;
|
|
426
|
+
handle: string;
|
|
427
|
+
display_name: string | null;
|
|
428
|
+
status: PersonStatus;
|
|
429
|
+
face_count: number;
|
|
430
|
+
text_mentions: number;
|
|
431
|
+
docs: number;
|
|
432
|
+
aliases: number;
|
|
433
|
+
merged_into?: string | null;
|
|
434
|
+
}
|
|
435
|
+
export interface PeoplePage {
|
|
436
|
+
people: PersonMeta[];
|
|
437
|
+
next_cursor: string | null;
|
|
438
|
+
}
|
|
439
|
+
export interface PersonAlias {
|
|
440
|
+
alias: string;
|
|
441
|
+
alias_norm: string;
|
|
442
|
+
decided_by: "rule" | "embed" | "llm" | "human" | (string & {});
|
|
443
|
+
confidence: number | null;
|
|
444
|
+
mention_count: number;
|
|
445
|
+
}
|
|
446
|
+
export interface CoMention {
|
|
447
|
+
entity_id: string;
|
|
448
|
+
kind: EntityKind;
|
|
449
|
+
label: string;
|
|
450
|
+
shared_docs: number;
|
|
451
|
+
}
|
|
452
|
+
/** Witness document, metadata only (title/locator/url — never body text). */
|
|
453
|
+
export interface EntityDocRef {
|
|
454
|
+
doc_id: string;
|
|
455
|
+
kind: string;
|
|
456
|
+
title: string;
|
|
457
|
+
locator: string;
|
|
458
|
+
url?: string | null;
|
|
459
|
+
}
|
|
460
|
+
export interface PersonDetail {
|
|
461
|
+
person: PersonMeta;
|
|
462
|
+
aliases: PersonAlias[];
|
|
463
|
+
co_mentions: CoMention[];
|
|
464
|
+
docs: EntityDocRef[];
|
|
465
|
+
}
|
|
466
|
+
export type PersonPatchBody = {
|
|
467
|
+
display_name: string;
|
|
468
|
+
} | {
|
|
469
|
+
status: "hidden" | "unknown";
|
|
470
|
+
};
|
|
471
|
+
export interface MergeResult {
|
|
472
|
+
person_id: string;
|
|
473
|
+
into_person_id: string;
|
|
474
|
+
faces_moved: number;
|
|
475
|
+
aliases_moved: number;
|
|
476
|
+
merge_id: number | string;
|
|
477
|
+
job_id: string | null;
|
|
478
|
+
}
|
|
479
|
+
export interface AliasSuggestion {
|
|
480
|
+
kind: EntityKind;
|
|
481
|
+
alias: string;
|
|
482
|
+
alias_norm: string;
|
|
483
|
+
status?: "pending" | "accepted" | "rejected";
|
|
484
|
+
mention_count: number;
|
|
485
|
+
sample_docs: Array<{
|
|
486
|
+
doc_id: string;
|
|
487
|
+
title: string;
|
|
488
|
+
locator: string;
|
|
489
|
+
}>;
|
|
490
|
+
suggested_entity_id?: string | null;
|
|
491
|
+
suggested_label?: string | null;
|
|
492
|
+
confidence: number | null;
|
|
493
|
+
decided_by: string | null;
|
|
494
|
+
rationale?: string | null;
|
|
495
|
+
}
|
|
496
|
+
export interface AliasesPage {
|
|
497
|
+
aliases: AliasSuggestion[];
|
|
498
|
+
next_cursor: string | null;
|
|
499
|
+
}
|
|
500
|
+
/** Alias identity is (kind, alias_norm) — there is no alias_id. */
|
|
501
|
+
export interface AliasDecisionBody {
|
|
502
|
+
kind: EntityKind;
|
|
503
|
+
alias_norm: string;
|
|
504
|
+
decision: "accept" | "reject";
|
|
505
|
+
entity_id?: string;
|
|
506
|
+
create_person?: {
|
|
507
|
+
display_name: string;
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
export interface LiveSourceTotals {
|
|
511
|
+
total: number;
|
|
512
|
+
failed: number;
|
|
513
|
+
/** only when the platform served the summary route */
|
|
514
|
+
by_kind?: Record<string, number>;
|
|
515
|
+
/** the paged fallback stopped at its cap — total is a floor, not a count */
|
|
516
|
+
truncated: boolean;
|
|
517
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,qFAAqF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@awesomate/platform-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed client for the Awesomate platform /v1 API — tenant API (answer, query, media, ingest, data) and the hub service channel. Browser + Node, no dependencies.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/itmooti/platform.git",
|
|
9
|
+
"directory": "packages/sdk"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/cjs/index.js",
|
|
13
|
+
"module": "./dist/esm/index.js",
|
|
14
|
+
"types": "./dist/esm/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/esm/index.d.ts",
|
|
19
|
+
"default": "./dist/esm/index.js"
|
|
20
|
+
},
|
|
21
|
+
"require": {
|
|
22
|
+
"types": "./dist/cjs/index.d.ts",
|
|
23
|
+
"default": "./dist/cjs/index.js"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=20"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "22.20.1",
|
|
40
|
+
"typescript": "5.9.2",
|
|
41
|
+
"vitest": "4.1.11"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
45
|
+
"lint": "tsc --noEmit -p tsconfig.json",
|
|
46
|
+
"test": "vitest run"
|
|
47
|
+
}
|
|
48
|
+
}
|