@aiquants/enrichment-react 0.1.1 → 0.2.1

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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import React$1, { ReactNode } from "react";
2
- import { ConfidentialityLevel, EnrichmentStageKey, SearchMode } from "@aiquants/enrichment-core";
1
+ import { SearchDegradationReason, ConfidentialityLevel, PipelineRunStatus, PipelineStepKey, EnrichmentStageKey, SearchMode, ChunkSource, PipelinePhase, PipelineStepMetric, DocumentKind, StepGate, PipelineRunRecord, PipelineFlow, NothingToReadToken, PipelineStepStatus, PipelineTrigger } from "@aiquants/enrichment-core";
2
+ import React$1, { ReactNode, JSX } from "react";
3
3
  interface SearchMetadataLike {
4
4
  is_degraded: boolean;
5
5
  search_mode: string;
@@ -10,7 +10,7 @@ interface DegradedSearchBannerProps {
10
10
  metadata: SearchMetadataLike;
11
11
  onDismiss?: () => void;
12
12
  }
13
- declare const REASON_LABELS: Readonly<Record<string, string>>;
13
+ declare const REASON_LABELS: Readonly<Record<SearchDegradationReason, string>>;
14
14
  declare function DegradedSearchBanner({ metadata, onDismiss }: DegradedSearchBannerProps): React$1.JSX.Element | null;
15
15
  interface DocumentIngestLabel {
16
16
  labelKey: string;
@@ -34,6 +34,13 @@ interface FileInspectionResult {
34
34
  mtime: string | null;
35
35
  revisionId: string | null;
36
36
  }
37
+ interface RecentIngestLastRun {
38
+ runId: number;
39
+ status: PipelineRunStatus;
40
+ retryScheduled: boolean;
41
+ failedStepKey: PipelineStepKey | null;
42
+ finishedAt: string | null;
43
+ }
37
44
  interface RecentIngestItem {
38
45
  id: number;
39
46
  fileUri: string;
@@ -45,6 +52,11 @@ interface RecentIngestItem {
45
52
  createdAt: string;
46
53
  updatedAt: string;
47
54
  errorMessage?: string | null;
55
+ lastRun: RecentIngestLastRun | null;
56
+ }
57
+ interface IngestDomainOption {
58
+ readonly key: string;
59
+ readonly label: string;
48
60
  }
49
61
  type IngestRowAction = {
50
62
  readonly kind: "retry";
@@ -63,6 +75,7 @@ interface IngestCapabilityPolicy {
63
75
  interface DocumentIngestConsoleProps {
64
76
  tenantId: string;
65
77
  policies?: readonly IngestCapabilityPolicy[];
78
+ domainOptions: readonly IngestDomainOption[];
66
79
  recentItems?: RecentIngestItem[];
67
80
  inspectionResult?: FileInspectionResult | null;
68
81
  isSubmitting?: boolean;
@@ -70,8 +83,9 @@ interface DocumentIngestConsoleProps {
70
83
  onInspectUri?: (fileUri: string) => void;
71
84
  onIngestDocument?: (payload: DocumentIngestPayload) => void;
72
85
  onRetryItem?: (fileId: number) => void;
86
+ onShowHistory?: (metadataId: number) => void;
73
87
  }
74
- declare function DocumentIngestConsole({ policies, tenantId, recentItems, inspectionResult, isSubmitting, isInspecting, onInspectUri, onIngestDocument, onRetryItem }: DocumentIngestConsoleProps): ReactNode;
88
+ declare function DocumentIngestConsole({ policies, tenantId, domainOptions, recentItems, inspectionResult, isSubmitting, isInspecting, onInspectUri, onIngestDocument, onRetryItem, onShowHistory }: DocumentIngestConsoleProps): ReactNode;
75
89
  type StrategyProvenance = "tenant" | "system";
76
90
  interface EnrichmentStrategyRow {
77
91
  id: number;
@@ -89,8 +103,8 @@ interface EnrichmentStrategyBoardProps {
89
103
  onToggleStage?: (row: EnrichmentStrategyRow, stage: EnrichmentStageKey, enabled: boolean) => void | Promise<void>;
90
104
  isUpdating?: boolean;
91
105
  }
92
- type GateState = "open" | "closed" | "unmeasured" | "absent";
93
- declare function gateStateOf(featureFlagKey: string | null, flags: Readonly<Record<string, boolean>>): GateState;
106
+ type GateState$1 = "open" | "closed" | "unmeasured" | "absent";
107
+ declare function gateStateOf(featureFlagKey: string | null, flags: Readonly<Record<string, boolean>>): GateState$1;
94
108
  declare function EnrichmentStrategyBoard({ strategies, featureFlags, onToggleStage, isUpdating }: EnrichmentStrategyBoardProps): React$1.JSX.Element;
95
109
  interface ServiceHealthStatus {
96
110
  serviceName: string;
@@ -188,22 +202,66 @@ interface MetadataSearchResult {
188
202
  circuit_breaker_status?: Record<string, string>;
189
203
  };
190
204
  }
205
+ type CircuitBreakerState = "CLOSED" | "OPEN" | "HALF_OPEN";
191
206
  interface MetadataSearchWorkbenchProps {
192
207
  tenantId: string;
193
- onSearch?: (params: MetadataSearchParams) => Promise<MetadataSearchResult>;
208
+ onSearch: (params: MetadataSearchParams) => Promise<MetadataSearchResult>;
194
209
  initialParams?: Partial<MetadataSearchParams>;
195
210
  initialResult?: MetadataSearchResult | null;
196
- circuitBreakerStatus?: Record<string, "CLOSED" | "OPEN" | "HALF_OPEN">;
211
+ circuitBreakerStatus?: Record<string, CircuitBreakerState>;
197
212
  isLoading?: boolean;
198
213
  }
199
214
  interface DeveloperSearchPreset {
200
215
  id: string;
201
216
  title: string;
202
217
  description: string;
203
- params: Partial<MetadataSearchParams>;
218
+ params: Pick<MetadataSearchParams, "mode" | "limit"> & Partial<Pick<MetadataSearchParams, "threshold" | "fusion" | "rrf_k">>;
204
219
  }
205
220
  declare const SEARCH_PRESETS: DeveloperSearchPreset[];
206
221
  declare function MetadataSearchWorkbench({ tenantId, onSearch, initialParams, initialResult, circuitBreakerStatus, isLoading: externalLoading }: MetadataSearchWorkbenchProps): React.JSX.Element;
222
+ interface ComparisonVariant {
223
+ readonly strategyId: number;
224
+ readonly label: string;
225
+ readonly embeddingModel: string;
226
+ }
227
+ interface ComparisonHit {
228
+ readonly id: string;
229
+ readonly title: string;
230
+ readonly score: number;
231
+ }
232
+ interface ComparisonVariantResult {
233
+ readonly strategyId: number;
234
+ readonly executionMs: number;
235
+ readonly hits: readonly ComparisonHit[];
236
+ }
237
+ interface ComparisonInput {
238
+ readonly query: string;
239
+ readonly strategyIds: readonly [
240
+ number,
241
+ number
242
+ ];
243
+ readonly limit: number;
244
+ }
245
+ type ComparisonOutcome = {
246
+ readonly ok: true;
247
+ readonly results: readonly ComparisonVariantResult[];
248
+ } | {
249
+ readonly ok: false;
250
+ readonly reason: string;
251
+ };
252
+ interface ModelComparisonWorkbenchProps {
253
+ variants: readonly ComparisonVariant[];
254
+ onCompare: (input: ComparisonInput) => Promise<ComparisonOutcome>;
255
+ }
256
+ declare const SCORE_DISPLAY_DECIMALS = 4;
257
+ declare function formatComparisonScore(score: number): string;
258
+ interface RankAgreement {
259
+ readonly sharedCount: number;
260
+ readonly overlapRatio: number | null;
261
+ readonly meanAbsoluteRankDifference: number | null;
262
+ }
263
+ declare function rankAgreement(a: readonly string[], b: readonly string[]): RankAgreement;
264
+ declare function ModelComparisonWorkbench({ variants, onCompare }: ModelComparisonWorkbenchProps): ReactNode;
207
265
  interface OntologyClassItem {
208
266
  name: string;
209
267
  description: string;
@@ -236,6 +294,104 @@ interface OntologyStatusCardProps {
236
294
  ontologyStatus: OntologyStatusData;
237
295
  }
238
296
  declare function OntologyStatusCard({ tenantId, ontologyStatus }: OntologyStatusCardProps): ReactNode;
297
+ type StepGateState = "open" | "closed-skip" | "closed-fail" | "unmeasured";
298
+ type GateState = "open" | "closed" | "unmeasured";
299
+ type StepGatePolicy = "none" | "skip" | "fail" | "mixed";
300
+ interface PipelineFlowViewerProps {
301
+ featureFlags: Readonly<Record<string, boolean>>;
302
+ metrics: readonly PipelineStepMetric[];
303
+ metricSampleWindow: number;
304
+ selectedKind?: DocumentKind;
305
+ onSelectKind?: (kind: DocumentKind) => void;
306
+ selectedStepKey?: PipelineStepKey | null;
307
+ onSelectStep?: (key: PipelineStepKey | null) => void;
308
+ }
309
+ declare const PHASE_LABELS: Readonly<Record<PipelinePhase, string>>;
310
+ declare const CHUNK_SOURCE_LABELS: Readonly<Record<ChunkSource, string>>;
311
+ declare const GATE_STATE_PRESENTATION: Readonly<Record<StepGateState, {
312
+ readonly badge: string;
313
+ readonly stroke: string;
314
+ readonly dash: string | undefined;
315
+ }>>;
316
+ declare const GATE_POLICY_LABELS: Readonly<Record<StepGatePolicy, string>>;
317
+ declare function gateState(gate: StepGate, featureFlags: Readonly<Record<string, boolean>>): GateState;
318
+ declare function stepGateState(gates: readonly StepGate[], featureFlags: Readonly<Record<string, boolean>>): StepGateState;
319
+ declare function stepGatePolicy(gates: readonly StepGate[]): StepGatePolicy;
320
+ declare function gateCaption(state: StepGateState, policy: StepGatePolicy): string;
321
+ declare function PipelineFlowViewer({ featureFlags, metrics, metricSampleWindow, selectedKind: controlledKind, onSelectKind, selectedStepKey: controlledStepKey, onSelectStep }: PipelineFlowViewerProps): ReactNode;
322
+ interface PipelineRunInspectorProps {
323
+ metadataId: number;
324
+ runs: readonly PipelineRunRecord[];
325
+ selectedRunId: number | null;
326
+ onSelectRun: (runId: number) => void;
327
+ isLoading: boolean;
328
+ failure: string | null;
329
+ onClose: () => void;
330
+ openRequest: number;
331
+ returnFocusFallback: () => HTMLElement | null;
332
+ }
333
+ declare const STEP_CARDS_OPEN_LIMIT = 8;
334
+ declare function PipelineRunInspector({ metadataId, runs, selectedRunId, onSelectRun, isLoading, failure, onClose, openRequest, returnFocusFallback }: PipelineRunInspectorProps): ReactNode;
335
+ declare const FLOW_NODE_TEXT: {
336
+ readonly inset: 12;
337
+ readonly labelFontSize: 13;
338
+ readonly captionFontSize: 11;
339
+ };
340
+ declare const FLOW_FOCUS_RING: {
341
+ readonly offset: 3;
342
+ readonly stroke: 2;
343
+ };
344
+ interface FlowGeometry {
345
+ readonly node: {
346
+ readonly width: number;
347
+ readonly height: number;
348
+ };
349
+ readonly gap: {
350
+ readonly column: number;
351
+ readonly row: number;
352
+ };
353
+ readonly padding: number;
354
+ }
355
+ declare const FLOW_GEOMETRY: FlowGeometry;
356
+ interface LaidOutStep {
357
+ readonly key: PipelineStepKey;
358
+ readonly x: number;
359
+ readonly y: number;
360
+ readonly rank: number;
361
+ readonly order: number;
362
+ readonly width: number;
363
+ readonly height: number;
364
+ }
365
+ interface LaidOutEdge {
366
+ readonly from: PipelineStepKey;
367
+ readonly to: PipelineStepKey;
368
+ readonly path: string;
369
+ }
370
+ interface FlowLayout {
371
+ readonly width: number;
372
+ readonly height: number;
373
+ readonly steps: readonly LaidOutStep[];
374
+ readonly edges: readonly LaidOutEdge[];
375
+ }
376
+ declare function layoutFlow(flow: PipelineFlow, geometry?: FlowGeometry): FlowLayout;
377
+ interface StatusPresentation {
378
+ readonly label: string;
379
+ readonly className: string;
380
+ }
381
+ interface StepStatusPresentation extends StatusPresentation {
382
+ readonly bar: string;
383
+ }
384
+ type PipelineRunPresentationKey = PipelineRunStatus | "FAILED_RETRY_SCHEDULED";
385
+ declare const PIPELINE_RUN_STATUS_PRESENTATION: Readonly<Record<PipelineRunPresentationKey, StatusPresentation>>;
386
+ declare const PIPELINE_STEP_STATUS_PRESENTATION: Readonly<Record<PipelineStepStatus, StepStatusPresentation>>;
387
+ declare const PIPELINE_TRIGGER_LABELS: Readonly<Record<PipelineTrigger, string>>;
388
+ declare const UNFINISHED_LABEL = "\u672A\u5B8C\u4E86";
389
+ declare function pipelineRunPresentationKey(run: {
390
+ readonly status: PipelineRunStatus;
391
+ readonly retryScheduled: boolean;
392
+ }): PipelineRunPresentationKey;
393
+ declare const NOTHING_TO_READ_LABELS: Readonly<Record<NothingToReadToken, string>>;
394
+ declare function skipReasonLabel(text: string): string;
239
395
  interface QdrantCollectionInfo {
240
396
  collection_name: string;
241
397
  domain_key: string;
@@ -259,57 +415,44 @@ interface QdrantCollectionInfo {
259
415
  interface QdrantHealthInfo {
260
416
  healthy: boolean;
261
417
  latency_ms: number;
262
- status_text?: string;
263
418
  }
264
419
  interface QdrantResourceUsage {
265
- ram_bytes?: number;
266
- disk_bytes?: number;
267
- segment_count?: number;
420
+ ram_bytes?: number | null;
421
+ disk_bytes?: number | null;
422
+ segment_count?: number | null;
268
423
  }
269
- interface QdrantStorageOverview {
424
+ type QdrantStorageOverview = {
270
425
  collections: QdrantCollectionInfo[];
271
- probe_failure: string | null;
426
+ probe_failure: null;
427
+ } | {
428
+ collections: readonly [
429
+ ];
430
+ probe_failure: string;
431
+ };
432
+ interface QdrantCollectionSelection {
433
+ selectedCollectionName: string | null;
434
+ onSelectCollection: (collectionName: string) => void;
435
+ detailId: string;
272
436
  }
273
437
  interface QdrantStorageCardProps {
274
- collections: QdrantCollectionInfo[];
275
- probeFailure?: string | null;
438
+ overview: QdrantStorageOverview;
276
439
  health?: QdrantHealthInfo;
277
440
  resources?: QdrantResourceUsage;
278
441
  onRefresh?: () => void | Promise<void>;
279
442
  isRefreshing?: boolean;
280
- onSelectCollection?: (collectionName: string) => void;
281
- selectedCollectionName?: string | null;
282
- }
283
- declare function QdrantStorageCard({ collections, probeFailure, health, resources, onRefresh, isRefreshing, onSelectCollection, selectedCollectionName }: QdrantStorageCardProps): React$1.JSX.Element;
284
- interface StageMetric {
285
- latency_p50_ms: number;
286
- latency_p95_ms: number;
287
- throughput_rps: number;
288
- success_rate: number;
289
- }
290
- interface StageGates {
291
- featureFlagKey: string | null;
292
- featureFlag: boolean | null;
293
- domainsEnabled: number | null;
294
- domainsTotal: number | null;
295
- }
296
- interface PipelineConfig {
297
- enable_summary_generation?: StageGates;
298
- enable_structured_extraction?: StageGates;
299
- enable_vector_indexing?: StageGates;
300
- enable_graph_indexing?: StageGates;
301
- enable_asset_extraction?: StageGates;
443
+ selection?: QdrantCollectionSelection;
302
444
  }
303
- type CircuitBreakerState = "CLOSED" | "OPEN" | "HALF_OPEN";
304
- type NodeOperationalStatus = "active" | "partial" | "degraded" | "disabled" | "unmeasured";
305
- interface RAGPipelineGraphViewerProps {
306
- pipelineConfig: PipelineConfig;
307
- circuitBreakerStatus?: Record<string, CircuitBreakerState>;
308
- stageMetrics?: Record<string, StageMetric>;
309
- selectedNodeId?: string | null;
310
- onNodeSelect?: (nodeId: string | null) => void;
311
- }
312
- declare function RAGPipelineGraphViewer({ pipelineConfig, circuitBreakerStatus, stageMetrics, selectedNodeId: controlledSelectedId, onNodeSelect }: RAGPipelineGraphViewerProps): React$1.JSX.Element;
445
+ declare function QdrantStorageCard({ overview, health, resources, onRefresh, isRefreshing, selection }: QdrantStorageCardProps): JSX.Element;
446
+ type RecordedInstantProps = {
447
+ readonly iso: string | null;
448
+ readonly testId: string;
449
+ };
450
+ declare function RecordedInstant({ iso, testId }: RecordedInstantProps): JSX.Element;
451
+ type FinishedInstantProps = {
452
+ readonly iso: string | null;
453
+ readonly testId: string;
454
+ };
455
+ declare function FinishedInstant({ iso, testId }: FinishedInstantProps): ReactNode;
313
456
  interface FailedSyncItem {
314
457
  id: string | number;
315
458
  file_uri: string;
@@ -339,4 +482,4 @@ interface SyncStatusMonitorProps {
339
482
  onRefresh?: () => void;
340
483
  }
341
484
  declare function SyncStatusMonitor({ counts, totalFiles, failedItems, onRetryAll, onRetryItem, isRetrying, onRefresh }: SyncStatusMonitorProps): React$1.JSX.Element;
342
- export { type CircuitBreakerState, type ConfidentialityLevelFilter, DegradedSearchBanner, type DegradedSearchBannerProps, type DeveloperSearchPreset, DocumentIngestConsole, type DocumentIngestConsoleProps, type DocumentIngestLabel, type DocumentIngestPayload, EnrichmentStrategyBoard, type EnrichmentStrategyBoardProps, type EnrichmentStrategyRow, type FailedSyncItem, type FileInspectionResult, type FusionStrategy, InfrastructureHealthMonitor, type InfrastructureHealthMonitorProps, type IngestCapabilityPolicy, type IngestRowAction, type MetadataSearchHit, type MetadataSearchParams, type MetadataSearchResult, MetadataSearchWorkbench, type MetadataSearchWorkbenchProps, type NodeOperationalStatus, type OntologyClassItem, type OntologyPredicateItem, OntologyStatusCard, type OntologyStatusCardProps, type OntologyStatusData, type PipelineConfig, type QdrantCollectionInfo, type QdrantHealthInfo, type QdrantResourceUsage, QdrantStorageCard, type QdrantStorageCardProps, type QdrantStorageOverview, RAGPipelineGraphViewer, type RAGPipelineGraphViewerProps, REASON_LABELS, type RecentIngestItem, SEARCH_MODE_LABELS, SEARCH_PRESETS, type SearchAuthzScopes, type SearchHitGraphRelation, type SearchHitScoreBreakdown, type SearchMetadataLike, type ServiceHealthStatus, type StageGates, type StageMetric, type StrategyProvenance, type SyncStatusCounts, SyncStatusMonitor, type SyncStatusMonitorProps, type SystemInfrastructureHealth, gateStateOf, ingestRowAction };
485
+ export { CHUNK_SOURCE_LABELS, type CircuitBreakerState, type ComparisonHit, type ComparisonInput, type ComparisonOutcome, type ComparisonVariant, type ComparisonVariantResult, type ConfidentialityLevelFilter, DegradedSearchBanner, type DegradedSearchBannerProps, type DeveloperSearchPreset, DocumentIngestConsole, type DocumentIngestConsoleProps, type DocumentIngestLabel, type DocumentIngestPayload, EnrichmentStrategyBoard, type EnrichmentStrategyBoardProps, type EnrichmentStrategyRow, FLOW_FOCUS_RING, FLOW_GEOMETRY, FLOW_NODE_TEXT, type FailedSyncItem, type FileInspectionResult, FinishedInstant, type FinishedInstantProps, type FlowGeometry, type FlowLayout, type FusionStrategy, GATE_POLICY_LABELS, GATE_STATE_PRESENTATION, type GateState, InfrastructureHealthMonitor, type InfrastructureHealthMonitorProps, type IngestCapabilityPolicy, type IngestDomainOption, type IngestRowAction, type LaidOutEdge, type LaidOutStep, type MetadataSearchHit, type MetadataSearchParams, type MetadataSearchResult, MetadataSearchWorkbench, type MetadataSearchWorkbenchProps, ModelComparisonWorkbench, type ModelComparisonWorkbenchProps, NOTHING_TO_READ_LABELS, type OntologyClassItem, type OntologyPredicateItem, OntologyStatusCard, type OntologyStatusCardProps, type OntologyStatusData, PHASE_LABELS, PIPELINE_RUN_STATUS_PRESENTATION, PIPELINE_STEP_STATUS_PRESENTATION, PIPELINE_TRIGGER_LABELS, PipelineFlowViewer, type PipelineFlowViewerProps, PipelineRunInspector, type PipelineRunInspectorProps, type PipelineRunPresentationKey, type QdrantCollectionInfo, type QdrantCollectionSelection, type QdrantHealthInfo, type QdrantResourceUsage, QdrantStorageCard, type QdrantStorageCardProps, type QdrantStorageOverview, REASON_LABELS, type RankAgreement, type RecentIngestItem, type RecentIngestLastRun, RecordedInstant, type RecordedInstantProps, SCORE_DISPLAY_DECIMALS, SEARCH_MODE_LABELS, SEARCH_PRESETS, STEP_CARDS_OPEN_LIMIT, type SearchAuthzScopes, type SearchHitGraphRelation, type SearchHitScoreBreakdown, type SearchMetadataLike, type ServiceHealthStatus, type StatusPresentation, type StepGatePolicy, type StepGateState, type StepStatusPresentation, type StrategyProvenance, type SyncStatusCounts, SyncStatusMonitor, type SyncStatusMonitorProps, type SystemInfrastructureHealth, UNFINISHED_LABEL, formatComparisonScore, gateCaption, gateState, gateStateOf, ingestRowAction, layoutFlow, pipelineRunPresentationKey, rankAgreement, skipReasonLabel, stepGatePolicy, stepGateState };