@kybernesis/brain-contracts 0.1.6 → 0.5.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/dist/entity.d.ts +135 -135
- package/dist/entity.d.ts.map +1 -1
- package/dist/entity.js +66 -43
- package/dist/entity.js.map +1 -1
- package/dist/fact.d.ts +94 -94
- package/dist/fact.d.ts.map +1 -1
- package/dist/fact.js +17 -15
- package/dist/fact.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/sleep.d.ts +77 -77
- package/dist/sleep.d.ts.map +1 -1
- package/dist/sleep.js +27 -25
- package/dist/sleep.js.map +1 -1
- package/dist/storage.d.ts +222 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +28 -0
- package/dist/storage.js.map +1 -0
- package/dist/timeline.d.ts +76 -76
- package/dist/timeline.d.ts.map +1 -1
- package/dist/timeline.js +12 -10
- package/dist/timeline.js.map +1 -1
- package/package.json +1 -1
package/dist/entity.d.ts
CHANGED
|
@@ -2,245 +2,245 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const EntitySchema: z.ZodObject<{
|
|
3
3
|
id: z.ZodNumber;
|
|
4
4
|
name: z.ZodString;
|
|
5
|
-
|
|
5
|
+
normalized_name: z.ZodString;
|
|
6
6
|
aliases: z.ZodArray<z.ZodString, "many">;
|
|
7
7
|
type: z.ZodEnum<["person", "company", "project", "place", "topic"]>;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
first_seen: z.ZodString;
|
|
9
|
+
last_seen: z.ZodString;
|
|
10
|
+
mention_count: z.ZodNumber;
|
|
11
11
|
priority: z.ZodNumber;
|
|
12
|
-
|
|
12
|
+
decay_score: z.ZodNumber;
|
|
13
13
|
tier: z.ZodEnum<["hot", "warm", "archive"]>;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
last_accessed: z.ZodOptional<z.ZodString>;
|
|
15
|
+
access_count: z.ZodNumber;
|
|
16
|
+
is_pinned: z.ZodBoolean;
|
|
17
|
+
last_reasoned_at: z.ZodOptional<z.ZodString>;
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
|
-
type: "person" | "company" | "project" | "place" | "topic";
|
|
20
19
|
id: number;
|
|
21
20
|
name: string;
|
|
22
|
-
|
|
21
|
+
normalized_name: string;
|
|
23
22
|
aliases: string[];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
type: "person" | "company" | "project" | "place" | "topic";
|
|
24
|
+
first_seen: string;
|
|
25
|
+
last_seen: string;
|
|
26
|
+
mention_count: number;
|
|
27
27
|
priority: number;
|
|
28
|
-
|
|
28
|
+
decay_score: number;
|
|
29
29
|
tier: "hot" | "warm" | "archive";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
access_count: number;
|
|
31
|
+
is_pinned: boolean;
|
|
32
|
+
last_accessed?: string | undefined;
|
|
33
|
+
last_reasoned_at?: string | undefined;
|
|
34
34
|
}, {
|
|
35
|
-
type: "person" | "company" | "project" | "place" | "topic";
|
|
36
35
|
id: number;
|
|
37
36
|
name: string;
|
|
38
|
-
|
|
37
|
+
normalized_name: string;
|
|
39
38
|
aliases: string[];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
type: "person" | "company" | "project" | "place" | "topic";
|
|
40
|
+
first_seen: string;
|
|
41
|
+
last_seen: string;
|
|
42
|
+
mention_count: number;
|
|
43
43
|
priority: number;
|
|
44
|
-
|
|
44
|
+
decay_score: number;
|
|
45
45
|
tier: "hot" | "warm" | "archive";
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
access_count: number;
|
|
47
|
+
is_pinned: boolean;
|
|
48
|
+
last_accessed?: string | undefined;
|
|
49
|
+
last_reasoned_at?: string | undefined;
|
|
50
50
|
}>;
|
|
51
51
|
export type Entity = z.infer<typeof EntitySchema>;
|
|
52
52
|
export declare const EntityMentionSchema: z.ZodObject<{
|
|
53
53
|
id: z.ZodNumber;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
entity_id: z.ZodNumber;
|
|
55
|
+
conversation_id: z.ZodString;
|
|
56
|
+
source_path: z.ZodString;
|
|
57
57
|
context: z.ZodOptional<z.ZodString>;
|
|
58
58
|
timestamp: z.ZodString;
|
|
59
|
-
|
|
59
|
+
source_type: z.ZodString;
|
|
60
60
|
confidence: z.ZodNumber;
|
|
61
61
|
}, "strip", z.ZodTypeAny, {
|
|
62
62
|
id: number;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
entity_id: number;
|
|
64
|
+
conversation_id: string;
|
|
65
|
+
source_path: string;
|
|
66
66
|
timestamp: string;
|
|
67
|
-
|
|
67
|
+
source_type: string;
|
|
68
68
|
confidence: number;
|
|
69
69
|
context?: string | undefined;
|
|
70
70
|
}, {
|
|
71
71
|
id: number;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
entity_id: number;
|
|
73
|
+
conversation_id: string;
|
|
74
|
+
source_path: string;
|
|
75
75
|
timestamp: string;
|
|
76
|
-
|
|
76
|
+
source_type: string;
|
|
77
77
|
confidence: number;
|
|
78
78
|
context?: string | undefined;
|
|
79
79
|
}>;
|
|
80
80
|
export type EntityMention = z.infer<typeof EntityMentionSchema>;
|
|
81
81
|
export declare const EntityRelationSchema: z.ZodObject<{
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
source_id: z.ZodNumber;
|
|
83
|
+
target_id: z.ZodNumber;
|
|
84
84
|
relationship: z.ZodEnum<["co-occurred", "founded", "works_at", "invested_in", "met_with", "created", "manages", "partners_with", "located_in", "discussed", "related_to", "reports_to", "uses", "depends_on", "part_of"]>;
|
|
85
85
|
strength: z.ZodNumber;
|
|
86
86
|
confidence: z.ZodNumber;
|
|
87
87
|
method: z.ZodString;
|
|
88
88
|
rationale: z.ZodOptional<z.ZodString>;
|
|
89
|
-
|
|
89
|
+
last_verified: z.ZodOptional<z.ZodString>;
|
|
90
90
|
}, "strip", z.ZodTypeAny, {
|
|
91
|
-
relationship: "co-occurred" | "founded" | "works_at" | "invested_in" | "met_with" | "created" | "manages" | "partners_with" | "located_in" | "discussed" | "related_to" | "reports_to" | "uses" | "depends_on" | "part_of";
|
|
92
91
|
confidence: number;
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
source_id: number;
|
|
93
|
+
target_id: number;
|
|
94
|
+
relationship: "co-occurred" | "founded" | "works_at" | "invested_in" | "met_with" | "created" | "manages" | "partners_with" | "located_in" | "discussed" | "related_to" | "reports_to" | "uses" | "depends_on" | "part_of";
|
|
95
95
|
strength: number;
|
|
96
96
|
method: string;
|
|
97
97
|
rationale?: string | undefined;
|
|
98
|
-
|
|
98
|
+
last_verified?: string | undefined;
|
|
99
99
|
}, {
|
|
100
|
-
relationship: "co-occurred" | "founded" | "works_at" | "invested_in" | "met_with" | "created" | "manages" | "partners_with" | "located_in" | "discussed" | "related_to" | "reports_to" | "uses" | "depends_on" | "part_of";
|
|
101
100
|
confidence: number;
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
source_id: number;
|
|
102
|
+
target_id: number;
|
|
103
|
+
relationship: "co-occurred" | "founded" | "works_at" | "invested_in" | "met_with" | "created" | "manages" | "partners_with" | "located_in" | "discussed" | "related_to" | "reports_to" | "uses" | "depends_on" | "part_of";
|
|
104
104
|
strength: number;
|
|
105
105
|
method: string;
|
|
106
106
|
rationale?: string | undefined;
|
|
107
|
-
|
|
107
|
+
last_verified?: string | undefined;
|
|
108
108
|
}>;
|
|
109
109
|
export type EntityRelation = z.infer<typeof EntityRelationSchema>;
|
|
110
110
|
export declare const EntityMergeSchema: z.ZodObject<{
|
|
111
111
|
id: z.ZodNumber;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
keep_id: z.ZodNumber;
|
|
113
|
+
remove_id: z.ZodNumber;
|
|
114
|
+
keep_name: z.ZodOptional<z.ZodString>;
|
|
115
|
+
remove_name: z.ZodOptional<z.ZodString>;
|
|
116
|
+
keep_type: z.ZodOptional<z.ZodString>;
|
|
117
|
+
remove_type: z.ZodOptional<z.ZodString>;
|
|
118
118
|
reason: z.ZodString;
|
|
119
119
|
confidence: z.ZodOptional<z.ZodNumber>;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
ai_rationale: z.ZodOptional<z.ZodString>;
|
|
121
|
+
mentions_moved: z.ZodNumber;
|
|
122
|
+
relations_moved: z.ZodNumber;
|
|
123
|
+
merged_at: z.ZodString;
|
|
124
|
+
merged_by: z.ZodString;
|
|
125
125
|
}, "strip", z.ZodTypeAny, {
|
|
126
126
|
id: number;
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
keep_id: number;
|
|
128
|
+
remove_id: number;
|
|
129
129
|
reason: string;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
mentions_moved: number;
|
|
131
|
+
relations_moved: number;
|
|
132
|
+
merged_at: string;
|
|
133
|
+
merged_by: string;
|
|
134
134
|
confidence?: number | undefined;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
keep_name?: string | undefined;
|
|
136
|
+
remove_name?: string | undefined;
|
|
137
|
+
keep_type?: string | undefined;
|
|
138
|
+
remove_type?: string | undefined;
|
|
139
|
+
ai_rationale?: string | undefined;
|
|
140
140
|
}, {
|
|
141
141
|
id: number;
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
keep_id: number;
|
|
143
|
+
remove_id: number;
|
|
144
144
|
reason: string;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
mentions_moved: number;
|
|
146
|
+
relations_moved: number;
|
|
147
|
+
merged_at: string;
|
|
148
|
+
merged_by: string;
|
|
149
149
|
confidence?: number | undefined;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
keep_name?: string | undefined;
|
|
151
|
+
remove_name?: string | undefined;
|
|
152
|
+
keep_type?: string | undefined;
|
|
153
|
+
remove_type?: string | undefined;
|
|
154
|
+
ai_rationale?: string | undefined;
|
|
155
155
|
}>;
|
|
156
156
|
export type EntityMerge = z.infer<typeof EntityMergeSchema>;
|
|
157
157
|
export declare const EntityProfileSchema: z.ZodObject<{
|
|
158
|
-
|
|
158
|
+
entity_id: z.ZodNumber;
|
|
159
159
|
profile: z.ZodString;
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
generated_at: z.ZodString;
|
|
161
|
+
fact_count: z.ZodNumber;
|
|
162
162
|
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
|
|
163
|
+
entity_id: number;
|
|
164
164
|
profile: string;
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
generated_at: string;
|
|
166
|
+
fact_count: number;
|
|
167
167
|
}, {
|
|
168
|
-
|
|
168
|
+
entity_id: number;
|
|
169
169
|
profile: string;
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
generated_at: string;
|
|
171
|
+
fact_count: number;
|
|
172
172
|
}>;
|
|
173
173
|
export type EntityProfile = z.infer<typeof EntityProfileSchema>;
|
|
174
174
|
export declare const ContradictionStatusSchema: z.ZodEnum<["open", "resolved"]>;
|
|
175
175
|
export type ContradictionStatus = z.infer<typeof ContradictionStatusSchema>;
|
|
176
176
|
export declare const ContradictionSchema: z.ZodObject<{
|
|
177
177
|
id: z.ZodNumber;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
entity_id: z.ZodOptional<z.ZodNumber>;
|
|
179
|
+
fact_a_id: z.ZodOptional<z.ZodNumber>;
|
|
180
|
+
fact_b_id: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
fact_a: z.ZodOptional<z.ZodString>;
|
|
182
|
+
fact_b: z.ZodOptional<z.ZodString>;
|
|
183
183
|
description: z.ZodOptional<z.ZodString>;
|
|
184
184
|
status: z.ZodEnum<["open", "resolved"]>;
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
resolved_by: z.ZodOptional<z.ZodString>;
|
|
186
|
+
created_at: z.ZodString;
|
|
187
187
|
}, "strip", z.ZodTypeAny, {
|
|
188
|
-
status: "open" | "resolved";
|
|
189
188
|
id: number;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
status: "open" | "resolved";
|
|
190
|
+
created_at: string;
|
|
191
|
+
entity_id?: number | undefined;
|
|
192
|
+
fact_a_id?: number | undefined;
|
|
193
|
+
fact_b_id?: number | undefined;
|
|
194
|
+
fact_a?: string | undefined;
|
|
195
|
+
fact_b?: string | undefined;
|
|
196
196
|
description?: string | undefined;
|
|
197
|
-
|
|
197
|
+
resolved_by?: string | undefined;
|
|
198
198
|
}, {
|
|
199
|
-
status: "open" | "resolved";
|
|
200
199
|
id: number;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
status: "open" | "resolved";
|
|
201
|
+
created_at: string;
|
|
202
|
+
entity_id?: number | undefined;
|
|
203
|
+
fact_a_id?: number | undefined;
|
|
204
|
+
fact_b_id?: number | undefined;
|
|
205
|
+
fact_a?: string | undefined;
|
|
206
|
+
fact_b?: string | undefined;
|
|
207
207
|
description?: string | undefined;
|
|
208
|
-
|
|
208
|
+
resolved_by?: string | undefined;
|
|
209
209
|
}>;
|
|
210
210
|
export type Contradiction = z.infer<typeof ContradictionSchema>;
|
|
211
211
|
export declare const EntityInsightSchema: z.ZodObject<{
|
|
212
212
|
id: z.ZodNumber;
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
entity_id: z.ZodNumber;
|
|
214
|
+
insight_type: z.ZodEnum<["inference", "pattern", "quality", "synthesis"]>;
|
|
215
215
|
insight: z.ZodString;
|
|
216
216
|
reasoning: z.ZodString;
|
|
217
217
|
confidence: z.ZodNumber;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
source_entity_ids: z.ZodArray<z.ZodNumber, "many">;
|
|
219
|
+
created_at: z.ZodString;
|
|
220
|
+
expires_at: z.ZodOptional<z.ZodString>;
|
|
221
|
+
is_stale: z.ZodBoolean;
|
|
222
222
|
}, "strip", z.ZodTypeAny, {
|
|
223
223
|
id: number;
|
|
224
|
-
|
|
224
|
+
entity_id: number;
|
|
225
225
|
confidence: number;
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
created_at: string;
|
|
227
|
+
insight_type: "inference" | "pattern" | "quality" | "synthesis";
|
|
228
228
|
insight: string;
|
|
229
229
|
reasoning: string;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
source_entity_ids: number[];
|
|
231
|
+
is_stale: boolean;
|
|
232
|
+
expires_at?: string | undefined;
|
|
233
233
|
}, {
|
|
234
234
|
id: number;
|
|
235
|
-
|
|
235
|
+
entity_id: number;
|
|
236
236
|
confidence: number;
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
created_at: string;
|
|
238
|
+
insight_type: "inference" | "pattern" | "quality" | "synthesis";
|
|
239
239
|
insight: string;
|
|
240
240
|
reasoning: string;
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
source_entity_ids: number[];
|
|
242
|
+
is_stale: boolean;
|
|
243
|
+
expires_at?: string | undefined;
|
|
244
244
|
}>;
|
|
245
245
|
export type EntityInsight = z.infer<typeof EntityInsightSchema>;
|
|
246
246
|
//# sourceMappingURL=entity.d.ts.map
|
package/dist/entity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.ts","sourceRoot":"","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AC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGhE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/entity.js
CHANGED
|
@@ -1,94 +1,117 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { EntityTypeSchema, RelationshipTypeSchema, TierSchema, InsightTypeSchema } from './constants.js';
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// LOAD-BEARING CONVENTION — DO NOT "FIX" TO camelCase.
|
|
5
|
+
//
|
|
6
|
+
// Every object field in this package is snake_case on purpose. These schemas
|
|
7
|
+
// are a port of KAD's canonical brain object interfaces
|
|
8
|
+
// (`~/dev/kybernesis/kyberagent-desktop` :: `main:packages/daemon/src/brain/*.ts`),
|
|
9
|
+
// which return raw DB rows. The DB columns are snake_case, KAD's interfaces are
|
|
10
|
+
// snake_case, and every consumer (KAD renderer, KBDE, Arcana) reads snake_case.
|
|
11
|
+
//
|
|
12
|
+
// The library briefly diverged to camelCase, which forced an A→B→A camel↔snake
|
|
13
|
+
// rename at every consumer boundary and surfaced as `NaNmo` in the KAD desktop
|
|
14
|
+
// Entities/Timeline tabs (`entity.last_seen` was `undefined`). This is the cause
|
|
15
|
+
// the v0.2.0 realignment fixed. Renaming these back to camelCase to satisfy
|
|
16
|
+
// `@typescript-eslint/naming-convention` reopens that bug.
|
|
17
|
+
//
|
|
18
|
+
// The oracle is KAD's interface, not the snake_case convention itself — match
|
|
19
|
+
// KAD field-for-field. A schema-key guard test (`schema-naming.test.ts`) enforces
|
|
20
|
+
// `/^[a-z0-9_]+$/` so camelCase cannot silently reappear. See
|
|
21
|
+
// `docs/plans/snake-case-realignment.md`.
|
|
22
|
+
//
|
|
23
|
+
// (Infra/config types like `TenantContext`/`TenantPaths` in `tenant.ts` are NOT
|
|
24
|
+
// KAD brain rows and intentionally stay camelCase.)
|
|
25
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
3
26
|
// Maps to entities table in entity-graph.db.
|
|
4
27
|
export const EntitySchema = z.object({
|
|
5
28
|
id: z.number().int(),
|
|
6
29
|
name: z.string(),
|
|
7
|
-
|
|
30
|
+
normalized_name: z.string(),
|
|
8
31
|
aliases: z.array(z.string()),
|
|
9
32
|
type: EntityTypeSchema,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
33
|
+
first_seen: z.string(),
|
|
34
|
+
last_seen: z.string(),
|
|
35
|
+
mention_count: z.number().int(),
|
|
13
36
|
priority: z.number(),
|
|
14
|
-
|
|
37
|
+
decay_score: z.number(),
|
|
15
38
|
tier: TierSchema,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
39
|
+
last_accessed: z.string().optional(),
|
|
40
|
+
access_count: z.number().int(),
|
|
41
|
+
is_pinned: z.boolean(),
|
|
42
|
+
last_reasoned_at: z.string().optional(),
|
|
20
43
|
});
|
|
21
44
|
// Maps to entity_mentions table.
|
|
22
45
|
export const EntityMentionSchema = z.object({
|
|
23
46
|
id: z.number().int(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
entity_id: z.number().int(),
|
|
48
|
+
conversation_id: z.string(),
|
|
49
|
+
source_path: z.string(),
|
|
27
50
|
context: z.string().optional(),
|
|
28
51
|
timestamp: z.string(),
|
|
29
|
-
|
|
52
|
+
source_type: z.string(),
|
|
30
53
|
confidence: z.number(),
|
|
31
54
|
});
|
|
32
55
|
// Maps to entity_relations table.
|
|
33
56
|
export const EntityRelationSchema = z.object({
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
source_id: z.number().int(),
|
|
58
|
+
target_id: z.number().int(),
|
|
36
59
|
relationship: RelationshipTypeSchema,
|
|
37
60
|
strength: z.number().int(),
|
|
38
61
|
confidence: z.number(),
|
|
39
62
|
method: z.string(),
|
|
40
63
|
rationale: z.string().optional(),
|
|
41
|
-
|
|
64
|
+
last_verified: z.string().optional(),
|
|
42
65
|
});
|
|
43
66
|
// Maps to entity_merges table.
|
|
44
67
|
export const EntityMergeSchema = z.object({
|
|
45
68
|
id: z.number().int(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
69
|
+
keep_id: z.number().int(),
|
|
70
|
+
remove_id: z.number().int(),
|
|
71
|
+
keep_name: z.string().optional(),
|
|
72
|
+
remove_name: z.string().optional(),
|
|
73
|
+
keep_type: z.string().optional(),
|
|
74
|
+
remove_type: z.string().optional(),
|
|
52
75
|
reason: z.string(),
|
|
53
76
|
confidence: z.number().optional(),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
ai_rationale: z.string().optional(),
|
|
78
|
+
mentions_moved: z.number().int(),
|
|
79
|
+
relations_moved: z.number().int(),
|
|
80
|
+
merged_at: z.string(),
|
|
81
|
+
merged_by: z.string(),
|
|
59
82
|
});
|
|
60
83
|
// Maps to entity_profiles table.
|
|
61
84
|
export const EntityProfileSchema = z.object({
|
|
62
|
-
|
|
85
|
+
entity_id: z.number().int(),
|
|
63
86
|
profile: z.string(),
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
generated_at: z.string(),
|
|
88
|
+
fact_count: z.number().int(),
|
|
66
89
|
});
|
|
67
90
|
// Maps to contradictions table.
|
|
68
91
|
export const ContradictionStatusSchema = z.enum(['open', 'resolved']);
|
|
69
92
|
export const ContradictionSchema = z.object({
|
|
70
93
|
id: z.number().int(),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
entity_id: z.number().int().optional(),
|
|
95
|
+
fact_a_id: z.number().int().optional(),
|
|
96
|
+
fact_b_id: z.number().int().optional(),
|
|
97
|
+
fact_a: z.string().optional(),
|
|
98
|
+
fact_b: z.string().optional(),
|
|
76
99
|
description: z.string().optional(),
|
|
77
100
|
status: ContradictionStatusSchema,
|
|
78
|
-
|
|
79
|
-
|
|
101
|
+
resolved_by: z.string().optional(),
|
|
102
|
+
created_at: z.string(),
|
|
80
103
|
});
|
|
81
104
|
// Maps to entity_insights table.
|
|
82
105
|
export const EntityInsightSchema = z.object({
|
|
83
106
|
id: z.number().int(),
|
|
84
|
-
|
|
85
|
-
|
|
107
|
+
entity_id: z.number().int(),
|
|
108
|
+
insight_type: InsightTypeSchema,
|
|
86
109
|
insight: z.string(),
|
|
87
110
|
reasoning: z.string(),
|
|
88
111
|
confidence: z.number(),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
112
|
+
source_entity_ids: z.array(z.number().int()),
|
|
113
|
+
created_at: z.string(),
|
|
114
|
+
expires_at: z.string().optional(),
|
|
115
|
+
is_stale: z.boolean(),
|
|
93
116
|
});
|
|
94
117
|
//# sourceMappingURL=entity.js.map
|
package/dist/entity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEzG,6CAA6C;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,
|
|
1
|
+
{"version":3,"file":"entity.js","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,UAAU,EAAE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