@unson/brainbase-mcp 0.1.0 → 0.2.2

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.
@@ -0,0 +1,123 @@
1
+ declare const WORKFLOW_STATES: readonly ["initialized", "source_ready", "candidates_ready", "promotion_reviewed", "first_value_ready", "first_value_answer_reviewed"];
2
+ export type SourceMode = 'mcp' | 'drive' | 'gmail' | 'local_folder' | 'single_document';
3
+ export type SourceStatus = 'ready' | 'waiting_for_authorization' | 'unavailable' | 'error' | 'unconfirmed';
4
+ export type ObservationClass = 'observed' | 'inferred';
5
+ export type ReviewDecision = 'approve' | 'edit' | 'reject' | 'merge';
6
+ export type WorkflowState = typeof WORKFLOW_STATES[number];
7
+ export interface SourceInventoryInput {
8
+ id: string;
9
+ mode: SourceMode;
10
+ status: SourceStatus;
11
+ evidencePointer?: string;
12
+ permissionScope?: string[];
13
+ detail?: string;
14
+ }
15
+ export interface SourceInventory extends SourceInventoryInput {
16
+ id: string;
17
+ permissionScope: string[];
18
+ }
19
+ export interface SourceReceiptInput {
20
+ sourceId: string;
21
+ evidencePointer: string;
22
+ contentHash: string;
23
+ permissionSnapshot: Record<string, unknown>;
24
+ collectionStatus: 'collected';
25
+ }
26
+ export interface CandidateInput {
27
+ kind: string;
28
+ payload: Record<string, unknown>;
29
+ observationClass: ObservationClass;
30
+ evidenceId: string;
31
+ }
32
+ export interface ConnectedCandidate extends CandidateInput {
33
+ id: string;
34
+ ingestedPayloadHash: string;
35
+ sourceId: string;
36
+ reviewStatus: 'pending' | 'approved' | 'rejected' | 'merged';
37
+ reviewDecision?: ReviewDecision;
38
+ reviewReason?: string;
39
+ mergedIntoCandidateId?: string;
40
+ promotedCanonicalIds: string[];
41
+ }
42
+ export interface SourceReceipt extends SourceReceiptInput {
43
+ mode: SourceMode;
44
+ collectedAt: string;
45
+ candidateIds: string[];
46
+ }
47
+ export interface FirstValueReceipt {
48
+ answerHash: string;
49
+ usedCanonicalIds: string[];
50
+ missingContext: string[];
51
+ recordedAt: string;
52
+ }
53
+ export interface FirstValueReview {
54
+ verdict: 'useful' | 'not_useful';
55
+ missingContext: string[];
56
+ reviewedAt: string;
57
+ elapsedSeconds: number;
58
+ withinTargetSeconds: boolean;
59
+ }
60
+ export interface ConnectedOnboardingRun {
61
+ id: string;
62
+ valueTarget: string;
63
+ path: 'warm' | 'fallback' | 'blocked';
64
+ state: WorkflowState;
65
+ startedAt: string;
66
+ updatedAt: string;
67
+ sourceReadyAt?: string;
68
+ sources: SourceInventory[];
69
+ selectedSourceIds: string[];
70
+ receipts: SourceReceipt[];
71
+ candidates: ConnectedCandidate[];
72
+ promotedCanonicalIds: string[];
73
+ firstValueReceipt?: FirstValueReceipt;
74
+ firstValueReview?: FirstValueReview;
75
+ }
76
+ export interface ConnectedOnboardingOptions {
77
+ now?: () => Date;
78
+ idFactory?: () => string;
79
+ }
80
+ export interface ReviewAction {
81
+ candidateId: string;
82
+ decision: ReviewDecision;
83
+ reason: string;
84
+ payload?: Record<string, unknown>;
85
+ mergeIntoCandidateId?: string;
86
+ }
87
+ export type FirstValueInput = {
88
+ action: 'record';
89
+ answerHash: string;
90
+ usedCanonicalIds: string[];
91
+ missingContext?: string[];
92
+ } | {
93
+ action: 'review';
94
+ verdict: 'useful' | 'not_useful';
95
+ missingContext?: string[];
96
+ };
97
+ export declare class ConnectedOnboardingError extends Error {
98
+ readonly code: string;
99
+ constructor(code: string, message: string);
100
+ }
101
+ export declare class ConnectedOnboardingRuntime {
102
+ private readonly dataDir;
103
+ private readonly now;
104
+ private readonly idFactory;
105
+ constructor(dataDir: string, options?: ConnectedOnboardingOptions);
106
+ start(input: {
107
+ valueTarget: string;
108
+ sources: SourceInventoryInput[];
109
+ }): Promise<ConnectedOnboardingRun>;
110
+ get(runId: string): Promise<ConnectedOnboardingRun>;
111
+ ingest(runId: string, input: {
112
+ source: SourceReceiptInput;
113
+ candidates: CandidateInput[];
114
+ }): Promise<ConnectedOnboardingRun>;
115
+ review(runId: string, actions: ReviewAction[]): Promise<ConnectedOnboardingRun>;
116
+ firstValue(runId: string, input: FirstValueInput): Promise<ConnectedOnboardingRun>;
117
+ private timestamp;
118
+ private readLedger;
119
+ private mutateLedger;
120
+ }
121
+ export declare function normalizeSourceInventory(raw: SourceInventoryInput[]): SourceInventory[];
122
+ export declare function assertSafePersistentValue(value: unknown, trail?: string[]): void;
123
+ export {};