aifastdb 3.8.9 → 3.10.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/aifastdb.win32-x64-msvc.node +0 -0
- package/dist/social-graph-v2-benchmark.d.ts +14 -0
- package/dist/social-graph-v2-benchmark.d.ts.map +1 -0
- package/dist/social-graph-v2-benchmark.js +336 -0
- package/dist/social-graph-v2-benchmark.js.map +1 -0
- package/dist/social-graph-v2.d.ts +308 -3
- package/dist/social-graph-v2.d.ts.map +1 -1
- package/dist/social-graph-v2.js +1080 -3
- package/dist/social-graph-v2.js.map +1 -1
- package/dist/social-types.d.ts +777 -1
- package/dist/social-types.d.ts.map +1 -1
- package/dist/social-types.js +32 -1
- package/dist/social-types.js.map +1 -1
- package/package.json +4 -3
package/dist/social-types.d.ts
CHANGED
|
@@ -29,6 +29,766 @@ export interface Relation {
|
|
|
29
29
|
metadata: Record<string, unknown>;
|
|
30
30
|
created_at: number;
|
|
31
31
|
}
|
|
32
|
+
/** Standard relation families for historical graph exploration. */
|
|
33
|
+
export type HistoricalRelationFamily = 'kinship' | 'political' | 'event' | 'narrative' | 'evidence' | 'temporal' | 'spatial';
|
|
34
|
+
/** Recommended entity types for historical graph ingestion. */
|
|
35
|
+
export type HistoricalEntityType = 'person' | 'event' | 'document' | 'location' | 'date' | 'fact' | 'claim' | 'evidence' | 'organization' | 'office' | 'artifact';
|
|
36
|
+
/** Standard direction selector for historical relation queries. */
|
|
37
|
+
export type RelationDirection = 'outgoing' | 'incoming' | 'both';
|
|
38
|
+
/** Canonical historical relation type names. */
|
|
39
|
+
export declare const HISTORICAL_RELATION_TYPES: {
|
|
40
|
+
readonly participatedIn: "participated_in";
|
|
41
|
+
readonly involvesPerson: "involves_person";
|
|
42
|
+
readonly mentionedIn: "mentioned_in";
|
|
43
|
+
readonly describedIn: "described_in";
|
|
44
|
+
readonly sourceOf: "source_of";
|
|
45
|
+
readonly occurredAt: "occurred_at";
|
|
46
|
+
readonly occurredOn: "occurred_on";
|
|
47
|
+
readonly occurredInYear: "occurred_in_year";
|
|
48
|
+
readonly supportedBy: "supported_by";
|
|
49
|
+
readonly derivedFromClaim: "derived_from_claim";
|
|
50
|
+
readonly conflictsWith: "conflicts_with";
|
|
51
|
+
readonly sameAs: "same_as";
|
|
52
|
+
readonly aliasOf: "alias_of";
|
|
53
|
+
readonly servedUnder: "served_under";
|
|
54
|
+
readonly appointedBy: "appointed_by";
|
|
55
|
+
readonly recommendedBy: "recommended_by";
|
|
56
|
+
readonly alliedWith: "allied_with";
|
|
57
|
+
readonly opposedTo: "opposed_to";
|
|
58
|
+
readonly betrayed: "betrayed";
|
|
59
|
+
readonly rebelledAgainst: "rebelled_against";
|
|
60
|
+
readonly defeated: "defeated";
|
|
61
|
+
readonly killed: "killed";
|
|
62
|
+
readonly captured: "captured";
|
|
63
|
+
readonly predecessorOf: "predecessor_of";
|
|
64
|
+
readonly succeededBy: "succeeded_by";
|
|
65
|
+
readonly partOfCampaign: "part_of_campaign";
|
|
66
|
+
readonly narrativeParallel: "narrative_parallel";
|
|
67
|
+
readonly resembles: "resembles";
|
|
68
|
+
};
|
|
69
|
+
/** Standard metadata stored on historical relations. */
|
|
70
|
+
export interface HistoricalRelationMetadata {
|
|
71
|
+
relationFamily?: HistoricalRelationFamily;
|
|
72
|
+
subtype?: string;
|
|
73
|
+
role?: string;
|
|
74
|
+
stance?: string;
|
|
75
|
+
side?: string;
|
|
76
|
+
narrativeWeight?: number;
|
|
77
|
+
sourceChapterId?: string;
|
|
78
|
+
sourceChapterTitle?: string;
|
|
79
|
+
sourceSpan?: string;
|
|
80
|
+
sourceQuote?: string;
|
|
81
|
+
evidenceIds?: string[];
|
|
82
|
+
claimId?: string;
|
|
83
|
+
canonicalFactId?: string;
|
|
84
|
+
yearStart?: number;
|
|
85
|
+
yearEnd?: number;
|
|
86
|
+
timeLabel?: string;
|
|
87
|
+
dynasty?: string;
|
|
88
|
+
confidence?: number;
|
|
89
|
+
isInferred?: boolean;
|
|
90
|
+
inferenceMethod?: string;
|
|
91
|
+
importBatchId?: string;
|
|
92
|
+
externalSource?: string;
|
|
93
|
+
[key: string]: unknown;
|
|
94
|
+
}
|
|
95
|
+
/** Input contract for writing a standardized historical relation. */
|
|
96
|
+
export interface HistoricalRelationInput extends HistoricalRelationMetadata {
|
|
97
|
+
sourceId: string;
|
|
98
|
+
targetId: string;
|
|
99
|
+
relationType: string;
|
|
100
|
+
weight?: number;
|
|
101
|
+
bidirectional?: boolean;
|
|
102
|
+
deterministicKey?: string;
|
|
103
|
+
upsert?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** Shared filter contract for advanced historical relation queries. */
|
|
106
|
+
export interface HistoricalRelationFilter {
|
|
107
|
+
relationTypes?: string[];
|
|
108
|
+
relationFamilies?: HistoricalRelationFamily[];
|
|
109
|
+
excludeRelationTypes?: string[];
|
|
110
|
+
sourceEntityId?: string;
|
|
111
|
+
sourceChapterId?: string;
|
|
112
|
+
yearStart?: number;
|
|
113
|
+
yearEnd?: number;
|
|
114
|
+
dynasty?: string;
|
|
115
|
+
minConfidence?: number;
|
|
116
|
+
isInferred?: boolean;
|
|
117
|
+
direction?: RelationDirection;
|
|
118
|
+
metadataMatch?: Record<string, unknown>;
|
|
119
|
+
offset?: number;
|
|
120
|
+
limit?: number;
|
|
121
|
+
includeRelatedEntities?: boolean;
|
|
122
|
+
includeTimeline?: boolean;
|
|
123
|
+
includeEvidence?: boolean;
|
|
124
|
+
includeClaims?: boolean;
|
|
125
|
+
includeFacts?: boolean;
|
|
126
|
+
includeChapters?: boolean;
|
|
127
|
+
includeConflictClusters?: boolean;
|
|
128
|
+
includeSourceBundle?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/** Shared filter contract for historical path queries. */
|
|
131
|
+
export interface HistoricalPathFilter extends HistoricalRelationFilter {
|
|
132
|
+
maxHops?: number;
|
|
133
|
+
bidirectionalSearch?: boolean;
|
|
134
|
+
includeInferred?: boolean;
|
|
135
|
+
}
|
|
136
|
+
/** Input contract for writing a standardized historical entity. */
|
|
137
|
+
export interface HistoricalEntityInput {
|
|
138
|
+
entityId?: string;
|
|
139
|
+
deterministicKey?: string;
|
|
140
|
+
entityType: string;
|
|
141
|
+
name: string;
|
|
142
|
+
displayName?: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
canonicalName?: string;
|
|
145
|
+
aliasNames?: string[];
|
|
146
|
+
timeLabel?: string;
|
|
147
|
+
yearStart?: number;
|
|
148
|
+
yearEnd?: number;
|
|
149
|
+
dynasty?: string;
|
|
150
|
+
sourceName?: string;
|
|
151
|
+
sourceRecordId?: string;
|
|
152
|
+
sourceUri?: string;
|
|
153
|
+
canonicalEntityId?: string;
|
|
154
|
+
upsert?: boolean;
|
|
155
|
+
metadata?: Record<string, unknown>;
|
|
156
|
+
}
|
|
157
|
+
/** Input contract for writing a first-class historical claim node. */
|
|
158
|
+
export interface HistoricalClaimInput {
|
|
159
|
+
entityId?: string;
|
|
160
|
+
deterministicKey?: string;
|
|
161
|
+
name: string;
|
|
162
|
+
displayName?: string;
|
|
163
|
+
description?: string;
|
|
164
|
+
canonicalName?: string;
|
|
165
|
+
aliasNames?: string[];
|
|
166
|
+
timeLabel?: string;
|
|
167
|
+
yearStart?: number;
|
|
168
|
+
yearEnd?: number;
|
|
169
|
+
dynasty?: string;
|
|
170
|
+
sourceName?: string;
|
|
171
|
+
sourceRecordId?: string;
|
|
172
|
+
sourceUri?: string;
|
|
173
|
+
canonicalEntityId?: string;
|
|
174
|
+
upsert?: boolean;
|
|
175
|
+
metadata?: Record<string, unknown>;
|
|
176
|
+
subjectEntityId?: string;
|
|
177
|
+
objectEntityId?: string;
|
|
178
|
+
relationType?: string;
|
|
179
|
+
evidenceIds?: string[];
|
|
180
|
+
sourceEntityId?: string;
|
|
181
|
+
sourceChapterId?: string;
|
|
182
|
+
sourceChapterTitle?: string;
|
|
183
|
+
sourceSpan?: string;
|
|
184
|
+
sourceQuote?: string;
|
|
185
|
+
canonicalFactId?: string;
|
|
186
|
+
}
|
|
187
|
+
/** Input contract for writing a first-class historical fact node. */
|
|
188
|
+
export interface HistoricalFactInput {
|
|
189
|
+
entityId?: string;
|
|
190
|
+
deterministicKey?: string;
|
|
191
|
+
name: string;
|
|
192
|
+
displayName?: string;
|
|
193
|
+
description?: string;
|
|
194
|
+
canonicalName?: string;
|
|
195
|
+
aliasNames?: string[];
|
|
196
|
+
timeLabel?: string;
|
|
197
|
+
yearStart?: number;
|
|
198
|
+
yearEnd?: number;
|
|
199
|
+
dynasty?: string;
|
|
200
|
+
sourceName?: string;
|
|
201
|
+
sourceRecordId?: string;
|
|
202
|
+
sourceUri?: string;
|
|
203
|
+
canonicalEntityId?: string;
|
|
204
|
+
upsert?: boolean;
|
|
205
|
+
metadata?: Record<string, unknown>;
|
|
206
|
+
subjectEntityId?: string;
|
|
207
|
+
objectEntityId?: string;
|
|
208
|
+
relationType?: string;
|
|
209
|
+
claimIds?: string[];
|
|
210
|
+
evidenceIds?: string[];
|
|
211
|
+
sourceEntityId?: string;
|
|
212
|
+
sourceChapterId?: string;
|
|
213
|
+
sourceChapterTitle?: string;
|
|
214
|
+
sourceSpan?: string;
|
|
215
|
+
sourceQuote?: string;
|
|
216
|
+
}
|
|
217
|
+
/** Input contract for writing a first-class historical evidence node. */
|
|
218
|
+
export interface HistoricalEvidenceInput {
|
|
219
|
+
entityId?: string;
|
|
220
|
+
deterministicKey?: string;
|
|
221
|
+
name: string;
|
|
222
|
+
displayName?: string;
|
|
223
|
+
description?: string;
|
|
224
|
+
canonicalName?: string;
|
|
225
|
+
aliasNames?: string[];
|
|
226
|
+
timeLabel?: string;
|
|
227
|
+
yearStart?: number;
|
|
228
|
+
yearEnd?: number;
|
|
229
|
+
dynasty?: string;
|
|
230
|
+
sourceName?: string;
|
|
231
|
+
sourceRecordId?: string;
|
|
232
|
+
sourceUri?: string;
|
|
233
|
+
canonicalEntityId?: string;
|
|
234
|
+
upsert?: boolean;
|
|
235
|
+
metadata?: Record<string, unknown>;
|
|
236
|
+
sourceEntityId?: string;
|
|
237
|
+
sourceChapterId?: string;
|
|
238
|
+
sourceChapterTitle?: string;
|
|
239
|
+
sourceSpan?: string;
|
|
240
|
+
sourceQuote?: string;
|
|
241
|
+
referencedEntityIds?: string[];
|
|
242
|
+
}
|
|
243
|
+
/** Input contract for writing a historical conflict relation between claim/fact nodes. */
|
|
244
|
+
export interface HistoricalConflictInput {
|
|
245
|
+
leftEntityId: string;
|
|
246
|
+
rightEntityId: string;
|
|
247
|
+
conflictLevel?: string;
|
|
248
|
+
conflictKind?: string;
|
|
249
|
+
evidenceIds?: string[];
|
|
250
|
+
sourceEntityId?: string;
|
|
251
|
+
sourceChapterId?: string;
|
|
252
|
+
sourceChapterTitle?: string;
|
|
253
|
+
sourceSpan?: string;
|
|
254
|
+
sourceQuote?: string;
|
|
255
|
+
yearStart?: number;
|
|
256
|
+
yearEnd?: number;
|
|
257
|
+
timeLabel?: string;
|
|
258
|
+
dynasty?: string;
|
|
259
|
+
confidence?: number;
|
|
260
|
+
deterministicKey?: string;
|
|
261
|
+
upsert?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/** Shared filter contract for claim/fact/evidence historical node queries. */
|
|
264
|
+
export interface ClaimFactEvidenceFilter {
|
|
265
|
+
subjectEntityId?: string;
|
|
266
|
+
objectEntityId?: string;
|
|
267
|
+
relationType?: string;
|
|
268
|
+
sourceEntityId?: string;
|
|
269
|
+
sourceChapterId?: string;
|
|
270
|
+
evidenceId?: string;
|
|
271
|
+
claimId?: string;
|
|
272
|
+
canonicalFactId?: string;
|
|
273
|
+
referencedEntityId?: string;
|
|
274
|
+
yearStart?: number;
|
|
275
|
+
yearEnd?: number;
|
|
276
|
+
dynasty?: string;
|
|
277
|
+
nameContains?: string;
|
|
278
|
+
limit?: number;
|
|
279
|
+
}
|
|
280
|
+
/** Import mode used by historical graph ingestion sessions. */
|
|
281
|
+
export type ImportMode = 'full' | 'incremental' | 'patch';
|
|
282
|
+
/** Lifecycle state for an import session. */
|
|
283
|
+
export type ImportSessionStatus = 'open' | 'committed' | 'rolled_back' | 'failed';
|
|
284
|
+
/** Conflict policy applied when upserting historical graph objects. */
|
|
285
|
+
export type UpsertConflictPolicy = 'skip' | 'replace' | 'merge_metadata' | 'error';
|
|
286
|
+
/** Merge strategy used when metadata is merged during upsert. */
|
|
287
|
+
export type MetadataMergePolicy = 'prefer_existing' | 'prefer_incoming' | 'append_arrays_unique' | 'deep_merge_shallow_values';
|
|
288
|
+
/** Item category returned in batch write results. */
|
|
289
|
+
export type BatchItemType = 'entity' | 'relation' | 'claim' | 'fact' | 'evidence' | 'alias' | 'merge';
|
|
290
|
+
/** Per-item status returned in batch write results. */
|
|
291
|
+
export type BatchItemStatus = 'created' | 'updated' | 'skipped' | 'failed' | 'unchanged';
|
|
292
|
+
/** Input for opening an import session. */
|
|
293
|
+
export interface ImportSessionInput {
|
|
294
|
+
datasetKey?: string;
|
|
295
|
+
sourceName?: string;
|
|
296
|
+
importBatchId?: string;
|
|
297
|
+
mode?: ImportMode;
|
|
298
|
+
metadata?: Record<string, unknown>;
|
|
299
|
+
}
|
|
300
|
+
/** Logical import session metadata for historical graph ingestion. */
|
|
301
|
+
export interface ImportSession {
|
|
302
|
+
sessionId: string;
|
|
303
|
+
datasetKey?: string;
|
|
304
|
+
sourceName?: string;
|
|
305
|
+
importBatchId?: string;
|
|
306
|
+
mode: ImportMode;
|
|
307
|
+
status: ImportSessionStatus;
|
|
308
|
+
startedAt: string;
|
|
309
|
+
committedAt?: string;
|
|
310
|
+
checkpointToken?: string;
|
|
311
|
+
metadata?: Record<string, unknown>;
|
|
312
|
+
}
|
|
313
|
+
/** Resumable checkpoint emitted during batch ingestion. */
|
|
314
|
+
export interface ImportCheckpoint {
|
|
315
|
+
sessionId: string;
|
|
316
|
+
checkpointToken: string;
|
|
317
|
+
lastEntityCursor?: string;
|
|
318
|
+
lastRelationCursor?: string;
|
|
319
|
+
processedItems: number;
|
|
320
|
+
createdItems: number;
|
|
321
|
+
updatedItems: number;
|
|
322
|
+
skippedItems: number;
|
|
323
|
+
failedItems: number;
|
|
324
|
+
createdAt: string;
|
|
325
|
+
metadata?: Record<string, unknown>;
|
|
326
|
+
}
|
|
327
|
+
/** Per-item diagnostics returned by batch ingestion APIs. */
|
|
328
|
+
export interface BatchItemResult {
|
|
329
|
+
index: number;
|
|
330
|
+
itemType: BatchItemType;
|
|
331
|
+
inputId?: string;
|
|
332
|
+
resolvedId?: string;
|
|
333
|
+
status: BatchItemStatus;
|
|
334
|
+
reasonCode?: string;
|
|
335
|
+
message?: string;
|
|
336
|
+
conflictPolicy?: UpsertConflictPolicy;
|
|
337
|
+
warnings?: string[];
|
|
338
|
+
diagnostics?: Record<string, unknown>;
|
|
339
|
+
}
|
|
340
|
+
/** Shared options for batch write ingestion APIs. */
|
|
341
|
+
export interface BatchWriteOptions {
|
|
342
|
+
upsert?: boolean;
|
|
343
|
+
conflictPolicy?: UpsertConflictPolicy;
|
|
344
|
+
metadataMergePolicy?: MetadataMergePolicy;
|
|
345
|
+
autoCommit?: boolean;
|
|
346
|
+
emitCheckpointEvery?: number;
|
|
347
|
+
continueOnError?: boolean;
|
|
348
|
+
dedupeWithinBatch?: boolean;
|
|
349
|
+
validateOnly?: boolean;
|
|
350
|
+
}
|
|
351
|
+
/** Batch-level result returned by historical ingestion APIs. */
|
|
352
|
+
export interface BatchWriteResult {
|
|
353
|
+
sessionId?: string;
|
|
354
|
+
batchId?: string;
|
|
355
|
+
success: boolean;
|
|
356
|
+
total: number;
|
|
357
|
+
created: number;
|
|
358
|
+
updated: number;
|
|
359
|
+
skipped: number;
|
|
360
|
+
failed: number;
|
|
361
|
+
unchanged: number;
|
|
362
|
+
checkpointToken?: string;
|
|
363
|
+
items: BatchItemResult[];
|
|
364
|
+
stats?: Record<string, number>;
|
|
365
|
+
warnings?: string[];
|
|
366
|
+
}
|
|
367
|
+
/** Entity hit returned by historical relation queries. */
|
|
368
|
+
export interface RelatedEntityHit {
|
|
369
|
+
entity: Entity;
|
|
370
|
+
relation: Relation;
|
|
371
|
+
direction: RelationDirection;
|
|
372
|
+
}
|
|
373
|
+
/** Evidence lookup result for a relation. */
|
|
374
|
+
export interface RelationEvidenceResult {
|
|
375
|
+
relation: Relation;
|
|
376
|
+
evidenceEntities: Entity[];
|
|
377
|
+
sourceChapterId?: string;
|
|
378
|
+
sourceChapterTitle?: string;
|
|
379
|
+
sourceSpan?: string;
|
|
380
|
+
sourceQuote?: string;
|
|
381
|
+
}
|
|
382
|
+
/** Grouped claim/fact/evidence nodes for a source entity. */
|
|
383
|
+
export interface SourceBundleResult {
|
|
384
|
+
sourceEntity: Entity;
|
|
385
|
+
claims: Entity[];
|
|
386
|
+
facts: Entity[];
|
|
387
|
+
evidenceEntities: Entity[];
|
|
388
|
+
}
|
|
389
|
+
export interface HistoricalSourceExcerptResult {
|
|
390
|
+
excerptId: string;
|
|
391
|
+
sourceEntity?: Entity | null;
|
|
392
|
+
sourceChapterId?: string;
|
|
393
|
+
sourceChapterTitle?: string;
|
|
394
|
+
sourceSpan?: string;
|
|
395
|
+
sourceQuote?: string;
|
|
396
|
+
relationIds: string[];
|
|
397
|
+
evidenceEntities: Entity[];
|
|
398
|
+
claimEntities: Entity[];
|
|
399
|
+
factEntities: Entity[];
|
|
400
|
+
yearStart?: number;
|
|
401
|
+
yearEnd?: number;
|
|
402
|
+
timeLabel?: string;
|
|
403
|
+
dynasty?: string;
|
|
404
|
+
supportCount: number;
|
|
405
|
+
reasonCodes: string[];
|
|
406
|
+
}
|
|
407
|
+
export interface HistoricalEvidenceContextSummaryResult {
|
|
408
|
+
excerptCount: number;
|
|
409
|
+
quotedExcerptCount: number;
|
|
410
|
+
sourceEntityCount: number;
|
|
411
|
+
relationCount: number;
|
|
412
|
+
evidenceCount: number;
|
|
413
|
+
claimCount: number;
|
|
414
|
+
factCount: number;
|
|
415
|
+
}
|
|
416
|
+
export interface HistoricalEvidenceContextResult {
|
|
417
|
+
targetEntity: Entity;
|
|
418
|
+
excerpts: HistoricalSourceExcerptResult[];
|
|
419
|
+
sourceEntities: Entity[];
|
|
420
|
+
evidenceEntities: Entity[];
|
|
421
|
+
claimEntities: Entity[];
|
|
422
|
+
factEntities: Entity[];
|
|
423
|
+
summary: HistoricalEvidenceContextSummaryResult;
|
|
424
|
+
reasons: string[];
|
|
425
|
+
}
|
|
426
|
+
/** Aggregated entity-centered historical graph read model. */
|
|
427
|
+
export interface EntityHistoryBundleResult {
|
|
428
|
+
entity: Entity;
|
|
429
|
+
relatedEntities: RelatedEntityHit[];
|
|
430
|
+
timeline: RelatedEntityHit[];
|
|
431
|
+
evidence: RelationEvidenceResult[];
|
|
432
|
+
claims: Entity[];
|
|
433
|
+
facts: Entity[];
|
|
434
|
+
chapters: RelatedEntityHit[];
|
|
435
|
+
conflictClusters: ConflictClusterResult[];
|
|
436
|
+
summary: EntityHistoryBundleSummaryResult;
|
|
437
|
+
sourceBundle?: SourceBundleResult | null;
|
|
438
|
+
}
|
|
439
|
+
export interface EntityHistoryBundleSummaryResult {
|
|
440
|
+
relatedEntityCount: number;
|
|
441
|
+
timelineCount: number;
|
|
442
|
+
evidenceCount: number;
|
|
443
|
+
claimCount: number;
|
|
444
|
+
factCount: number;
|
|
445
|
+
chapterCount: number;
|
|
446
|
+
conflictClusterCount: number;
|
|
447
|
+
hasSourceBundle: boolean;
|
|
448
|
+
}
|
|
449
|
+
export interface TimelineBucketResult {
|
|
450
|
+
bucketKey: string;
|
|
451
|
+
yearStart?: number;
|
|
452
|
+
yearEnd?: number;
|
|
453
|
+
timeLabel?: string;
|
|
454
|
+
dynasty?: string;
|
|
455
|
+
hits: RelatedEntityHit[];
|
|
456
|
+
hitCount: number;
|
|
457
|
+
}
|
|
458
|
+
export interface HistoricalTimelineEventResult {
|
|
459
|
+
event: Entity;
|
|
460
|
+
yearStart?: number;
|
|
461
|
+
yearEnd?: number;
|
|
462
|
+
timeLabel?: string;
|
|
463
|
+
dynasty?: string;
|
|
464
|
+
participantCount: number;
|
|
465
|
+
chapterCount: number;
|
|
466
|
+
evidenceCount: number;
|
|
467
|
+
claimCount: number;
|
|
468
|
+
factCount: number;
|
|
469
|
+
conflictClusterCount: number;
|
|
470
|
+
}
|
|
471
|
+
export interface HistoricalEventParticipantResult {
|
|
472
|
+
participant: Entity;
|
|
473
|
+
relation: Relation;
|
|
474
|
+
role?: string;
|
|
475
|
+
stance?: string;
|
|
476
|
+
side?: string;
|
|
477
|
+
narrativeWeight?: number;
|
|
478
|
+
sourceEntities: Entity[];
|
|
479
|
+
evidenceEntities: Entity[];
|
|
480
|
+
yearStart?: number;
|
|
481
|
+
yearEnd?: number;
|
|
482
|
+
timeLabel?: string;
|
|
483
|
+
dynasty?: string;
|
|
484
|
+
}
|
|
485
|
+
export interface HistoricalEntityEventRoleResult {
|
|
486
|
+
event: HistoricalTimelineEventResult;
|
|
487
|
+
relation: Relation;
|
|
488
|
+
role?: string;
|
|
489
|
+
stance?: string;
|
|
490
|
+
side?: string;
|
|
491
|
+
narrativeWeight?: number;
|
|
492
|
+
sourceEntities: Entity[];
|
|
493
|
+
evidenceEntities: Entity[];
|
|
494
|
+
}
|
|
495
|
+
export interface HistoricalActorInteractionResult {
|
|
496
|
+
counterpart: Entity;
|
|
497
|
+
interactionScore: number;
|
|
498
|
+
coEventCount: number;
|
|
499
|
+
conflictTouchCount: number;
|
|
500
|
+
sharedSourceCount: number;
|
|
501
|
+
timeOverlapScore: number;
|
|
502
|
+
directRelationCount: number;
|
|
503
|
+
relationTypes: string[];
|
|
504
|
+
sharedEventIds: string[];
|
|
505
|
+
sourceEntities: Entity[];
|
|
506
|
+
evidenceEntities: Entity[];
|
|
507
|
+
reasons: string[];
|
|
508
|
+
}
|
|
509
|
+
export interface HistoricalInteractionSummaryStatsResult {
|
|
510
|
+
counterpartCount: number;
|
|
511
|
+
personCounterpartCount: number;
|
|
512
|
+
eventCounterpartCount: number;
|
|
513
|
+
directRelationCount: number;
|
|
514
|
+
coEventCount: number;
|
|
515
|
+
conflictTouchCount: number;
|
|
516
|
+
sharedSourceCount: number;
|
|
517
|
+
strongestInteractionScore: number;
|
|
518
|
+
averageInteractionScore: number;
|
|
519
|
+
}
|
|
520
|
+
export interface HistoricalInteractionSummaryResult {
|
|
521
|
+
anchorEntity: Entity;
|
|
522
|
+
interactions: HistoricalActorInteractionResult[];
|
|
523
|
+
strongestPersonInteraction?: HistoricalActorInteractionResult | null;
|
|
524
|
+
strongestEventInteraction?: HistoricalActorInteractionResult | null;
|
|
525
|
+
summary: HistoricalInteractionSummaryStatsResult;
|
|
526
|
+
reasons: string[];
|
|
527
|
+
}
|
|
528
|
+
export interface HistoricalActivityItemResult {
|
|
529
|
+
activityId: string;
|
|
530
|
+
activityType: string;
|
|
531
|
+
primaryEntity: Entity;
|
|
532
|
+
relatedEntities: Entity[];
|
|
533
|
+
sourceEntities: Entity[];
|
|
534
|
+
evidenceEntities: Entity[];
|
|
535
|
+
relation?: Relation | null;
|
|
536
|
+
event?: HistoricalTimelineEventResult | null;
|
|
537
|
+
yearStart?: number;
|
|
538
|
+
yearEnd?: number;
|
|
539
|
+
timeLabel?: string;
|
|
540
|
+
dynasty?: string;
|
|
541
|
+
importanceScore?: number | null;
|
|
542
|
+
conflictStatus?: string | null;
|
|
543
|
+
reasonCodes: string[];
|
|
544
|
+
}
|
|
545
|
+
export interface HistoricalActivityStreamSummaryResult {
|
|
546
|
+
activityCount: number;
|
|
547
|
+
eventCount: number;
|
|
548
|
+
relationCount: number;
|
|
549
|
+
claimCount: number;
|
|
550
|
+
factCount: number;
|
|
551
|
+
evidenceCount: number;
|
|
552
|
+
conflictCount: number;
|
|
553
|
+
}
|
|
554
|
+
export interface HistoricalActivityStreamResult {
|
|
555
|
+
anchorEntity?: Entity | null;
|
|
556
|
+
items: HistoricalActivityItemResult[];
|
|
557
|
+
summary: HistoricalActivityStreamSummaryResult;
|
|
558
|
+
}
|
|
559
|
+
export interface HistoricalEventImportanceScoreBreakdownResult {
|
|
560
|
+
participantScore: number;
|
|
561
|
+
chapterScore: number;
|
|
562
|
+
evidenceScore: number;
|
|
563
|
+
claimScore: number;
|
|
564
|
+
factScore: number;
|
|
565
|
+
conflictScore: number;
|
|
566
|
+
chronologyScore: number;
|
|
567
|
+
}
|
|
568
|
+
export interface HistoricalEventImportanceResult {
|
|
569
|
+
event: HistoricalTimelineEventResult;
|
|
570
|
+
score: number;
|
|
571
|
+
reasons: string[];
|
|
572
|
+
scoreBreakdown: HistoricalEventImportanceScoreBreakdownResult;
|
|
573
|
+
}
|
|
574
|
+
export interface HistoricalNarrativeOrderScoreBreakdownResult {
|
|
575
|
+
chronologyScore: number;
|
|
576
|
+
supportDensityScore: number;
|
|
577
|
+
excerptSignalScore: number;
|
|
578
|
+
narrativeSignalScore: number;
|
|
579
|
+
anchorRelevanceScore: number;
|
|
580
|
+
}
|
|
581
|
+
export interface HistoricalNarrativeOrderResult {
|
|
582
|
+
event: HistoricalTimelineEventResult;
|
|
583
|
+
score: number;
|
|
584
|
+
reasons: string[];
|
|
585
|
+
scoreBreakdown: HistoricalNarrativeOrderScoreBreakdownResult;
|
|
586
|
+
}
|
|
587
|
+
export interface HistoricalTimelineBucketResult {
|
|
588
|
+
bucketKey: string;
|
|
589
|
+
yearStart?: number;
|
|
590
|
+
yearEnd?: number;
|
|
591
|
+
timeLabel?: string;
|
|
592
|
+
dynasty?: string;
|
|
593
|
+
events: HistoricalTimelineEventResult[];
|
|
594
|
+
eventCount: number;
|
|
595
|
+
participantCount: number;
|
|
596
|
+
}
|
|
597
|
+
export interface AliasMergeResult {
|
|
598
|
+
canonicalEntity: Entity;
|
|
599
|
+
aliasEntity: Entity;
|
|
600
|
+
mergedAliasNames: string[];
|
|
601
|
+
}
|
|
602
|
+
export interface HistoricalProjectionSectionsResult {
|
|
603
|
+
relatedEntityIds: string[];
|
|
604
|
+
timelineEntityIds: string[];
|
|
605
|
+
claimIds: string[];
|
|
606
|
+
factIds: string[];
|
|
607
|
+
chapterIds: string[];
|
|
608
|
+
evidenceEntityIds: string[];
|
|
609
|
+
sourceEntityIds: string[];
|
|
610
|
+
conflictEntityIds: string[];
|
|
611
|
+
relationIds: string[];
|
|
612
|
+
}
|
|
613
|
+
export interface HistoricalGraphProjectionResult {
|
|
614
|
+
rootEntity: Entity;
|
|
615
|
+
entities: Entity[];
|
|
616
|
+
relations: Relation[];
|
|
617
|
+
timelineBuckets: TimelineBucketResult[];
|
|
618
|
+
summary: EntityHistoryBundleSummaryResult;
|
|
619
|
+
sections: HistoricalProjectionSectionsResult;
|
|
620
|
+
}
|
|
621
|
+
export interface HistoricalEntitySpotlightSummaryResult {
|
|
622
|
+
aliasCount: number;
|
|
623
|
+
kinshipRelationCount: number;
|
|
624
|
+
politicalRelationCount: number;
|
|
625
|
+
eventRelationCount: number;
|
|
626
|
+
chapterCount: number;
|
|
627
|
+
timelineCount: number;
|
|
628
|
+
conflictClusterCount: number;
|
|
629
|
+
}
|
|
630
|
+
export interface HistoricalEntitySpotlightResult {
|
|
631
|
+
entity: Entity;
|
|
632
|
+
canonicalEntity?: Entity | null;
|
|
633
|
+
aliasEntities: Entity[];
|
|
634
|
+
bundle: EntityHistoryBundleResult;
|
|
635
|
+
kinshipRelations: RelatedEntityHit[];
|
|
636
|
+
politicalRelations: RelatedEntityHit[];
|
|
637
|
+
eventRelations: RelatedEntityHit[];
|
|
638
|
+
summary: HistoricalEntitySpotlightSummaryResult;
|
|
639
|
+
}
|
|
640
|
+
export interface HistoricalEntitySearchFilter {
|
|
641
|
+
entityTypes?: string[];
|
|
642
|
+
canonicalEntityId?: string;
|
|
643
|
+
sourceEntityId?: string;
|
|
644
|
+
sourceChapterId?: string;
|
|
645
|
+
yearStart?: number;
|
|
646
|
+
yearEnd?: number;
|
|
647
|
+
dynasty?: string;
|
|
648
|
+
textQuery?: string;
|
|
649
|
+
offset?: number;
|
|
650
|
+
limit?: number;
|
|
651
|
+
}
|
|
652
|
+
export interface HistoricalNarrativeOrderFilter extends HistoricalEntitySearchFilter {
|
|
653
|
+
anchorEntityId?: string;
|
|
654
|
+
}
|
|
655
|
+
export interface HistoricalEntityRecommendationResult {
|
|
656
|
+
entity: Entity;
|
|
657
|
+
score: number;
|
|
658
|
+
reasons: string[];
|
|
659
|
+
}
|
|
660
|
+
/** Connected conflict component rooted at a claim/fact node. */
|
|
661
|
+
export interface ConflictClusterResult {
|
|
662
|
+
anchorEntity: Entity;
|
|
663
|
+
clusterEntities: Entity[];
|
|
664
|
+
conflictRelations: Relation[];
|
|
665
|
+
relatedEntities: Entity[];
|
|
666
|
+
sourceEntities: Entity[];
|
|
667
|
+
evidenceEntities: Entity[];
|
|
668
|
+
conflictLevels: string[];
|
|
669
|
+
conflictKinds: string[];
|
|
670
|
+
claimEntities: Entity[];
|
|
671
|
+
factEntities: Entity[];
|
|
672
|
+
claimConflictRelations: Relation[];
|
|
673
|
+
factConflictRelations: Relation[];
|
|
674
|
+
mixedConflictRelations: Relation[];
|
|
675
|
+
summary: ConflictClusterSummaryResult;
|
|
676
|
+
}
|
|
677
|
+
/** Summary view for a layered conflict cluster. */
|
|
678
|
+
export interface ConflictClusterSummaryResult {
|
|
679
|
+
dominantLevel: string;
|
|
680
|
+
clusterEntityCount: number;
|
|
681
|
+
claimEntityCount: number;
|
|
682
|
+
factEntityCount: number;
|
|
683
|
+
claimConflictCount: number;
|
|
684
|
+
factConflictCount: number;
|
|
685
|
+
mixedConflictCount: number;
|
|
686
|
+
sourceEntityCount: number;
|
|
687
|
+
evidenceEntityCount: number;
|
|
688
|
+
}
|
|
689
|
+
export interface HistoricalConflictOverviewSummaryResult {
|
|
690
|
+
clusterCount: number;
|
|
691
|
+
claimEntityCount: number;
|
|
692
|
+
factEntityCount: number;
|
|
693
|
+
sourceEntityCount: number;
|
|
694
|
+
evidenceEntityCount: number;
|
|
695
|
+
dominantLevels: string[];
|
|
696
|
+
conflictKinds: string[];
|
|
697
|
+
}
|
|
698
|
+
export interface HistoricalConflictOverviewResult {
|
|
699
|
+
entity: Entity;
|
|
700
|
+
clusters: ConflictClusterResult[];
|
|
701
|
+
sourceEntities: Entity[];
|
|
702
|
+
evidenceEntities: Entity[];
|
|
703
|
+
summary: HistoricalConflictOverviewSummaryResult;
|
|
704
|
+
}
|
|
705
|
+
export interface HistoricalConflictScoreBreakdownResult {
|
|
706
|
+
structuralScore: number;
|
|
707
|
+
evidenceScore: number;
|
|
708
|
+
sourceScore: number;
|
|
709
|
+
factPriorityScore: number;
|
|
710
|
+
kindDiversityScore: number;
|
|
711
|
+
spreadScore: number;
|
|
712
|
+
}
|
|
713
|
+
export interface HistoricalConflictAdjudicationResult {
|
|
714
|
+
scope: string;
|
|
715
|
+
targetId: string;
|
|
716
|
+
score: number;
|
|
717
|
+
severity: string;
|
|
718
|
+
status: string;
|
|
719
|
+
recommendedAction: string;
|
|
720
|
+
reasons: string[];
|
|
721
|
+
scoreBreakdown: HistoricalConflictScoreBreakdownResult;
|
|
722
|
+
}
|
|
723
|
+
export interface HistoricalConflictAdjudicationContainerResult {
|
|
724
|
+
entity: Entity;
|
|
725
|
+
overview: HistoricalConflictOverviewResult;
|
|
726
|
+
overviewAssessment: HistoricalConflictAdjudicationResult;
|
|
727
|
+
clusterAssessments: HistoricalConflictAdjudicationResult[];
|
|
728
|
+
}
|
|
729
|
+
export interface HistoricalGraphDiagnosticIssueResult {
|
|
730
|
+
code: string;
|
|
731
|
+
severity: string;
|
|
732
|
+
message: string;
|
|
733
|
+
entityId?: string;
|
|
734
|
+
relationId?: string;
|
|
735
|
+
}
|
|
736
|
+
export interface HistoricalGraphDiagnosticsCountsResult {
|
|
737
|
+
historicalEntityCount: number;
|
|
738
|
+
historicalRelationCount: number;
|
|
739
|
+
personCount: number;
|
|
740
|
+
eventCount: number;
|
|
741
|
+
documentCount: number;
|
|
742
|
+
evidenceCount: number;
|
|
743
|
+
claimCount: number;
|
|
744
|
+
factCount: number;
|
|
745
|
+
}
|
|
746
|
+
export interface HistoricalGraphTimeCoverageResult {
|
|
747
|
+
datedEntityCount: number;
|
|
748
|
+
undatedEntityCount: number;
|
|
749
|
+
datedEventCount: number;
|
|
750
|
+
undatedEventCount: number;
|
|
751
|
+
datedRelationCount: number;
|
|
752
|
+
undatedRelationCount: number;
|
|
753
|
+
}
|
|
754
|
+
export interface HistoricalGraphIntegrityResult {
|
|
755
|
+
danglingRelationEndpointCount: number;
|
|
756
|
+
danglingSourceEntityRefCount: number;
|
|
757
|
+
danglingEvidenceRefCount: number;
|
|
758
|
+
danglingClaimRefCount: number;
|
|
759
|
+
danglingCanonicalEntityRefCount: number;
|
|
760
|
+
danglingCanonicalFactRefCount: number;
|
|
761
|
+
}
|
|
762
|
+
export interface HistoricalGraphMetadataCompletenessResult {
|
|
763
|
+
claimsMissingSubjectEntityCount: number;
|
|
764
|
+
claimsMissingRelationTypeCount: number;
|
|
765
|
+
factsMissingClaimIdsCount: number;
|
|
766
|
+
factsMissingEvidenceIdsCount: number;
|
|
767
|
+
evidenceMissingReferencedEntityIdsCount: number;
|
|
768
|
+
evidenceMissingSourceEntityCount: number;
|
|
769
|
+
relationsMissingRelationFamilyCount: number;
|
|
770
|
+
}
|
|
771
|
+
export interface HistoricalGraphMetricsSummaryResult {
|
|
772
|
+
totalRequests: number;
|
|
773
|
+
successfulWrites: number;
|
|
774
|
+
failedWrites: number;
|
|
775
|
+
rejectedRequests: number;
|
|
776
|
+
batchesFlushed: number;
|
|
777
|
+
batchDocuments: number;
|
|
778
|
+
avgQueueTimeUs: number;
|
|
779
|
+
avgWriteTimeUs: number;
|
|
780
|
+
entityCount: number;
|
|
781
|
+
relationCount: number;
|
|
782
|
+
queueFillRatio: number;
|
|
783
|
+
}
|
|
784
|
+
export interface HistoricalGraphDiagnosticsResult {
|
|
785
|
+
counts: HistoricalGraphDiagnosticsCountsResult;
|
|
786
|
+
timeCoverage: HistoricalGraphTimeCoverageResult;
|
|
787
|
+
integrity: HistoricalGraphIntegrityResult;
|
|
788
|
+
metadataCompleteness: HistoricalGraphMetadataCompletenessResult;
|
|
789
|
+
metrics: HistoricalGraphMetricsSummaryResult;
|
|
790
|
+
issues: HistoricalGraphDiagnosticIssueResult[];
|
|
791
|
+
}
|
|
32
792
|
/** Input for creating a person */
|
|
33
793
|
export interface PersonInput {
|
|
34
794
|
id?: string;
|
|
@@ -148,6 +908,22 @@ export interface AllPathsResult {
|
|
|
148
908
|
paths: PathResult[];
|
|
149
909
|
shortestHops: number;
|
|
150
910
|
}
|
|
911
|
+
/** Score breakdown for a ranked historical path candidate. */
|
|
912
|
+
export interface HistoricalPathScoreBreakdownResult {
|
|
913
|
+
hopScore: number;
|
|
914
|
+
relationWeightScore: number;
|
|
915
|
+
confidenceScore: number;
|
|
916
|
+
provenanceScore: number;
|
|
917
|
+
chronologyScore: number;
|
|
918
|
+
inferredPenalty: number;
|
|
919
|
+
}
|
|
920
|
+
/** Ranked historical path candidate with scoring reasons. */
|
|
921
|
+
export interface HistoricalPathRankingResult {
|
|
922
|
+
path: PathResult;
|
|
923
|
+
score: number;
|
|
924
|
+
reasons: string[];
|
|
925
|
+
scoreBreakdown: HistoricalPathScoreBreakdownResult;
|
|
926
|
+
}
|
|
151
927
|
/** Options for path finding */
|
|
152
928
|
export interface PathOptions {
|
|
153
929
|
maxHops?: number;
|
|
@@ -391,7 +1167,7 @@ export type NodeGroup = 'person' | 'company' | 'tag';
|
|
|
391
1167
|
* - belongs_to: 通用归属关系(已弃用,仅保留向后兼容)
|
|
392
1168
|
* - tagged: 标签关系(已弃用,请使用 has_tag)
|
|
393
1169
|
*/
|
|
394
|
-
export type EdgeRelationType = 'friend' | 'knows' | 'colleague' | 'classmate' | 'family' | 'mentor' | 'work_for' | 'has_tag' | 'has_skill' | 'has_interest' | 'owns' | 'belongs_to' | 'tagged';
|
|
1170
|
+
export type EdgeRelationType = 'friend' | 'knows' | 'colleague' | 'classmate' | 'family' | 'mentor' | 'work_for' | 'has_tag' | 'has_skill' | 'has_interest' | 'owns' | 'participated_in' | 'involves_person' | 'mentioned_in' | 'described_in' | 'source_of' | 'occurred_at' | 'occurred_on' | 'occurred_in_year' | 'supported_by' | 'derived_from_claim' | 'conflicts_with' | 'same_as' | 'alias_of' | 'served_under' | 'appointed_by' | 'recommended_by' | 'allied_with' | 'opposed_to' | 'betrayed' | 'rebelled_against' | 'defeated' | 'killed' | 'captured' | 'predecessor_of' | 'succeeded_by' | 'part_of_campaign' | 'narrative_parallel' | 'resembles' | 'belongs_to' | 'tagged';
|
|
395
1171
|
/** Node for graph visualization */
|
|
396
1172
|
export interface GraphNode {
|
|
397
1173
|
/** Unique node ID */
|