aifastdb 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/aidb.win32-x64-msvc.node +0 -0
- package/aifastdb.win32-x64-msvc.node +0 -0
- package/dist/client.d.ts +140 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +270 -0
- package/dist/client.js.map +1 -0
- package/dist/connectme-adapter.d.ts +76 -0
- package/dist/connectme-adapter.d.ts.map +1 -0
- package/dist/connectme-adapter.js +456 -0
- package/dist/connectme-adapter.js.map +1 -0
- package/dist/family-tree.d.ts +482 -0
- package/dist/family-tree.d.ts.map +1 -0
- package/dist/family-tree.js +676 -0
- package/dist/family-tree.js.map +1 -0
- package/dist/family-types.d.ts +228 -0
- package/dist/family-types.d.ts.map +1 -0
- package/dist/family-types.js +108 -0
- package/dist/family-types.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/memory-manager.d.ts +82 -0
- package/dist/memory-manager.d.ts.map +1 -0
- package/dist/memory-manager.js +273 -0
- package/dist/memory-manager.js.map +1 -0
- package/dist/native.d.ts +352 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +35 -0
- package/dist/native.js.map +1 -0
- package/dist/query-builder.d.ts +143 -0
- package/dist/query-builder.d.ts.map +1 -0
- package/dist/query-builder.js +240 -0
- package/dist/query-builder.js.map +1 -0
- package/dist/social-graph.d.ts +392 -0
- package/dist/social-graph.d.ts.map +1 -0
- package/dist/social-graph.js +545 -0
- package/dist/social-graph.js.map +1 -0
- package/dist/social-types.d.ts +379 -0
- package/dist/social-types.d.ts.map +1 -0
- package/dist/social-types.js +34 -0
- package/dist/social-types.js.map +1 -0
- package/dist/types.d.ts +475 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +161 -0
- package/dist/types.js.map +1 -0
- package/dist/vibe-synapse.d.ts +174 -0
- package/dist/vibe-synapse.d.ts.map +1 -0
- package/dist/vibe-synapse.js +509 -0
- package/dist/vibe-synapse.js.map +1 -0
- package/package.json +61 -0
- package/vibebase.node +0 -0
- package/vibebase.win32-x64-msvc.node +0 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Family Tree (Genealogy) Types for AiFastDb
|
|
3
|
+
*
|
|
4
|
+
* Provides TypeScript interfaces for family tree operations:
|
|
5
|
+
* - Family member management with gender tracking
|
|
6
|
+
* - Parent-child, spouse, and sibling relationships
|
|
7
|
+
* - Ancestor and descendant traversal
|
|
8
|
+
* - Relationship calculation and Chinese kinship titles
|
|
9
|
+
* - Family tree construction and statistics
|
|
10
|
+
*/
|
|
11
|
+
import type { Entity, Relation } from './social-types';
|
|
12
|
+
/** Gender enumeration */
|
|
13
|
+
export type Gender = 'male' | 'female' | 'unknown';
|
|
14
|
+
/** Gender constants */
|
|
15
|
+
export declare const GENDER: {
|
|
16
|
+
readonly MALE: Gender;
|
|
17
|
+
readonly FEMALE: Gender;
|
|
18
|
+
readonly UNKNOWN: Gender;
|
|
19
|
+
};
|
|
20
|
+
/** Family relationship type enumeration */
|
|
21
|
+
export type FamilyRelationType = 'father' | 'mother' | 'son' | 'daughter' | 'parent' | 'child' | 'spouse' | 'husband' | 'wife' | 'ex_spouse' | 'sibling' | 'brother' | 'sister' | 'half_sibling' | 'grandfather' | 'grandmother' | 'grandparent' | 'grandson' | 'granddaughter' | 'grandchild' | 'uncle' | 'aunt' | 'nephew' | 'niece' | 'cousin' | 'father_in_law' | 'mother_in_law' | 'son_in_law' | 'daughter_in_law' | 'brother_in_law' | 'sister_in_law';
|
|
22
|
+
/** Relation type constants for storage */
|
|
23
|
+
export declare const FAMILY_RELATION_TYPES: {
|
|
24
|
+
readonly PARENT_OF: "parent_of";
|
|
25
|
+
readonly CHILD_OF: "child_of";
|
|
26
|
+
readonly FATHER_OF: "father_of";
|
|
27
|
+
readonly MOTHER_OF: "mother_of";
|
|
28
|
+
readonly SPOUSE_OF: "spouse_of";
|
|
29
|
+
readonly HUSBAND_OF: "husband_of";
|
|
30
|
+
readonly WIFE_OF: "wife_of";
|
|
31
|
+
readonly EX_SPOUSE_OF: "ex_spouse_of";
|
|
32
|
+
readonly SIBLING_OF: "sibling_of";
|
|
33
|
+
readonly BROTHER_OF: "brother_of";
|
|
34
|
+
readonly SISTER_OF: "sister_of";
|
|
35
|
+
readonly HALF_SIBLING_OF: "half_sibling_of";
|
|
36
|
+
readonly GRANDPARENT_OF: "grandparent_of";
|
|
37
|
+
readonly GRANDCHILD_OF: "grandchild_of";
|
|
38
|
+
readonly STEP_PARENT_OF: "step_parent_of";
|
|
39
|
+
readonly STEP_FATHER_OF: "step_father_of";
|
|
40
|
+
readonly STEP_MOTHER_OF: "step_mother_of";
|
|
41
|
+
readonly STEP_CHILD_OF: "step_child_of";
|
|
42
|
+
readonly ADOPTIVE_PARENT_OF: "adoptive_parent_of";
|
|
43
|
+
readonly ADOPTIVE_FATHER_OF: "adoptive_father_of";
|
|
44
|
+
readonly ADOPTIVE_MOTHER_OF: "adoptive_mother_of";
|
|
45
|
+
readonly ADOPTED_CHILD_OF: "adopted_child_of";
|
|
46
|
+
};
|
|
47
|
+
/** Parent type for getAllParentsWithType */
|
|
48
|
+
export type ParentType = 'biological' | 'step' | 'adoptive';
|
|
49
|
+
/** Child type for getAllChildrenWithType */
|
|
50
|
+
export type ChildType = 'biological' | 'step' | 'adopted';
|
|
51
|
+
/** Parent info with type */
|
|
52
|
+
export interface ParentInfo {
|
|
53
|
+
person: import('./social-types').Entity;
|
|
54
|
+
type: ParentType;
|
|
55
|
+
}
|
|
56
|
+
/** Child info with type */
|
|
57
|
+
export interface ChildInfo {
|
|
58
|
+
person: import('./social-types').Entity;
|
|
59
|
+
type: ChildType;
|
|
60
|
+
}
|
|
61
|
+
/** Input for creating a family member */
|
|
62
|
+
export interface FamilyMemberInput {
|
|
63
|
+
/** Optional ID (auto-generated if not provided) */
|
|
64
|
+
id?: string;
|
|
65
|
+
/** Person's name */
|
|
66
|
+
name: string;
|
|
67
|
+
/** Gender */
|
|
68
|
+
gender: Gender;
|
|
69
|
+
/** Birth date in YYYY-MM-DD format */
|
|
70
|
+
birthDate?: string;
|
|
71
|
+
/** Death date in YYYY-MM-DD format (optional) */
|
|
72
|
+
deathDate?: string;
|
|
73
|
+
/** Birth order among siblings */
|
|
74
|
+
birthOrder?: number;
|
|
75
|
+
/** Generation number (0 = self, 1 = parent, -1 = child) */
|
|
76
|
+
generation?: number;
|
|
77
|
+
/** Additional properties */
|
|
78
|
+
properties?: Record<string, unknown>;
|
|
79
|
+
}
|
|
80
|
+
/** Spouse information with ex status */
|
|
81
|
+
export interface SpouseInfo {
|
|
82
|
+
/** The spouse entity */
|
|
83
|
+
person: Entity;
|
|
84
|
+
/** Whether this is an ex-spouse */
|
|
85
|
+
isEx: boolean;
|
|
86
|
+
}
|
|
87
|
+
/** Direction in path traversal */
|
|
88
|
+
export type PathDirection = 'up' | 'down' | 'same';
|
|
89
|
+
/** A step in the family path */
|
|
90
|
+
export interface FamilyPathStep {
|
|
91
|
+
/** The person at this step */
|
|
92
|
+
person: Entity;
|
|
93
|
+
/** The relation type to reach this person */
|
|
94
|
+
relation_type: string;
|
|
95
|
+
/** The direction of traversal */
|
|
96
|
+
direction: PathDirection;
|
|
97
|
+
}
|
|
98
|
+
/** Family relationship path between two people */
|
|
99
|
+
export interface FamilyPath {
|
|
100
|
+
/** Starting person */
|
|
101
|
+
from: Entity;
|
|
102
|
+
/** Ending person */
|
|
103
|
+
to: Entity;
|
|
104
|
+
/** Path steps from 'from' to 'to' */
|
|
105
|
+
path: FamilyPathStep[];
|
|
106
|
+
/** Calculated relationship title (Chinese) */
|
|
107
|
+
relationship: string;
|
|
108
|
+
/** Generation difference (positive = elder, negative = younger) */
|
|
109
|
+
generation_diff: number;
|
|
110
|
+
/** Blood relationship distance */
|
|
111
|
+
blood_distance: number;
|
|
112
|
+
}
|
|
113
|
+
/** Family tree structure */
|
|
114
|
+
export interface FamilyTree {
|
|
115
|
+
/** Root person of the tree */
|
|
116
|
+
root: Entity;
|
|
117
|
+
/** All members in the tree */
|
|
118
|
+
members: Entity[];
|
|
119
|
+
/** Members grouped by generation (generation number -> members) */
|
|
120
|
+
generations: Record<number, Entity[]>;
|
|
121
|
+
/** Total number of generations */
|
|
122
|
+
total_generations: number;
|
|
123
|
+
/** All family relations in the tree */
|
|
124
|
+
relations: Relation[];
|
|
125
|
+
}
|
|
126
|
+
/** Family statistics */
|
|
127
|
+
export interface FamilyStats {
|
|
128
|
+
/** Total number of family members */
|
|
129
|
+
total_members: number;
|
|
130
|
+
/** Total number of generations */
|
|
131
|
+
total_generations: number;
|
|
132
|
+
/** Number of male members */
|
|
133
|
+
male_count: number;
|
|
134
|
+
/** Number of female members */
|
|
135
|
+
female_count: number;
|
|
136
|
+
/** Number of members with unknown gender */
|
|
137
|
+
unknown_gender_count: number;
|
|
138
|
+
/** Number of living members */
|
|
139
|
+
living_members: number;
|
|
140
|
+
/** Number of deceased members */
|
|
141
|
+
deceased_members: number;
|
|
142
|
+
/** Average number of children per parent */
|
|
143
|
+
average_children: number;
|
|
144
|
+
/** Earliest birth date in the family */
|
|
145
|
+
earliest_birth?: string;
|
|
146
|
+
/** Latest birth date in the family */
|
|
147
|
+
latest_birth?: string;
|
|
148
|
+
}
|
|
149
|
+
/** Common Chinese kinship titles */
|
|
150
|
+
export declare const CHINESE_KINSHIP_TITLES: {
|
|
151
|
+
readonly FATHER: "父亲";
|
|
152
|
+
readonly MOTHER: "母亲";
|
|
153
|
+
readonly PATERNAL_GRANDFATHER: "爷爷";
|
|
154
|
+
readonly PATERNAL_GRANDMOTHER: "奶奶";
|
|
155
|
+
readonly MATERNAL_GRANDFATHER: "外公";
|
|
156
|
+
readonly MATERNAL_GRANDMOTHER: "外婆";
|
|
157
|
+
readonly GREAT_GRANDFATHER: "曾祖父";
|
|
158
|
+
readonly GREAT_GRANDMOTHER: "曾祖母";
|
|
159
|
+
readonly SON: "儿子";
|
|
160
|
+
readonly DAUGHTER: "女儿";
|
|
161
|
+
readonly GRANDSON: "孙子";
|
|
162
|
+
readonly GRANDDAUGHTER: "孙女";
|
|
163
|
+
readonly GREAT_GRANDSON: "曾孙";
|
|
164
|
+
readonly GREAT_GRANDDAUGHTER: "曾孙女";
|
|
165
|
+
readonly HUSBAND: "丈夫";
|
|
166
|
+
readonly WIFE: "妻子";
|
|
167
|
+
readonly SPOUSE: "配偶";
|
|
168
|
+
readonly OLDER_BROTHER: "哥哥";
|
|
169
|
+
readonly YOUNGER_BROTHER: "弟弟";
|
|
170
|
+
readonly OLDER_SISTER: "姐姐";
|
|
171
|
+
readonly YOUNGER_SISTER: "妹妹";
|
|
172
|
+
readonly BROTHER: "兄弟";
|
|
173
|
+
readonly SISTER: "姐妹";
|
|
174
|
+
readonly PATERNAL_UNCLE_OLDER: "伯伯";
|
|
175
|
+
readonly PATERNAL_UNCLE_YOUNGER: "叔叔";
|
|
176
|
+
readonly PATERNAL_AUNT: "姑姑";
|
|
177
|
+
readonly MATERNAL_UNCLE: "舅舅";
|
|
178
|
+
readonly MATERNAL_AUNT: "姨妈";
|
|
179
|
+
readonly NEPHEW_PATERNAL: "侄子";
|
|
180
|
+
readonly NIECE_PATERNAL: "侄女";
|
|
181
|
+
readonly NEPHEW_MATERNAL: "外甥";
|
|
182
|
+
readonly NIECE_MATERNAL: "外甥女";
|
|
183
|
+
readonly PATERNAL_COUSIN_MALE: "堂兄弟";
|
|
184
|
+
readonly PATERNAL_COUSIN_FEMALE: "堂姐妹";
|
|
185
|
+
readonly MATERNAL_COUSIN_MALE: "表兄弟";
|
|
186
|
+
readonly MATERNAL_COUSIN_FEMALE: "表姐妹";
|
|
187
|
+
readonly FATHER_IN_LAW_HUSBAND: "公公";
|
|
188
|
+
readonly MOTHER_IN_LAW_HUSBAND: "婆婆";
|
|
189
|
+
readonly FATHER_IN_LAW_WIFE: "岳父";
|
|
190
|
+
readonly MOTHER_IN_LAW_WIFE: "岳母";
|
|
191
|
+
readonly SON_IN_LAW: "女婿";
|
|
192
|
+
readonly DAUGHTER_IN_LAW: "儿媳";
|
|
193
|
+
};
|
|
194
|
+
/** Options for building a family tree */
|
|
195
|
+
export interface BuildFamilyTreeOptions {
|
|
196
|
+
/** Number of generations to traverse upward (default: 3) */
|
|
197
|
+
generationsUp?: number;
|
|
198
|
+
/** Number of generations to traverse downward (default: 3) */
|
|
199
|
+
generationsDown?: number;
|
|
200
|
+
}
|
|
201
|
+
/** Options for ancestor/descendant queries */
|
|
202
|
+
export interface TraversalOptions {
|
|
203
|
+
/** Maximum number of generations to traverse (default: 10) */
|
|
204
|
+
maxGenerations?: number;
|
|
205
|
+
}
|
|
206
|
+
/** Result of checking if two people are related */
|
|
207
|
+
export interface RelationshipCheckResult {
|
|
208
|
+
/** Whether the two people are related */
|
|
209
|
+
isRelated: boolean;
|
|
210
|
+
/** The relationship path if related */
|
|
211
|
+
path?: FamilyPath;
|
|
212
|
+
/** The relationship title if related */
|
|
213
|
+
title?: string;
|
|
214
|
+
}
|
|
215
|
+
/** Family member with computed relationships */
|
|
216
|
+
export interface FamilyMemberWithRelations extends Entity {
|
|
217
|
+
/** Parents of this member */
|
|
218
|
+
parents?: Entity[];
|
|
219
|
+
/** Spouse of this member */
|
|
220
|
+
spouse?: Entity;
|
|
221
|
+
/** Children of this member */
|
|
222
|
+
children?: Entity[];
|
|
223
|
+
/** Siblings of this member */
|
|
224
|
+
siblings?: Entity[];
|
|
225
|
+
/** Generation number relative to root */
|
|
226
|
+
generation?: number;
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=family-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-types.d.ts","sourceRoot":"","sources":["../ts/family-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMvD,yBAAyB;AACzB,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AC7B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Family Tree (Genealogy) Types for AiFastDb
|
|
4
|
+
*
|
|
5
|
+
* Provides TypeScript interfaces for family tree operations:
|
|
6
|
+
* - Family member management with gender tracking
|
|
7
|
+
* - Parent-child, spouse, and sibling relationships
|
|
8
|
+
* - Ancestor and descendant traversal
|
|
9
|
+
* - Relationship calculation and Chinese kinship titles
|
|
10
|
+
* - Family tree construction and statistics
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.CHINESE_KINSHIP_TITLES = exports.FAMILY_RELATION_TYPES = exports.GENDER = void 0;
|
|
14
|
+
/** Gender constants */
|
|
15
|
+
exports.GENDER = {
|
|
16
|
+
MALE: 'male',
|
|
17
|
+
FEMALE: 'female',
|
|
18
|
+
UNKNOWN: 'unknown',
|
|
19
|
+
};
|
|
20
|
+
/** Relation type constants for storage */
|
|
21
|
+
exports.FAMILY_RELATION_TYPES = {
|
|
22
|
+
// Direct blood relatives
|
|
23
|
+
PARENT_OF: 'parent_of',
|
|
24
|
+
CHILD_OF: 'child_of',
|
|
25
|
+
FATHER_OF: 'father_of',
|
|
26
|
+
MOTHER_OF: 'mother_of',
|
|
27
|
+
// Spouse
|
|
28
|
+
SPOUSE_OF: 'spouse_of',
|
|
29
|
+
HUSBAND_OF: 'husband_of',
|
|
30
|
+
WIFE_OF: 'wife_of',
|
|
31
|
+
EX_SPOUSE_OF: 'ex_spouse_of',
|
|
32
|
+
// Siblings
|
|
33
|
+
SIBLING_OF: 'sibling_of',
|
|
34
|
+
BROTHER_OF: 'brother_of',
|
|
35
|
+
SISTER_OF: 'sister_of',
|
|
36
|
+
HALF_SIBLING_OF: 'half_sibling_of',
|
|
37
|
+
// Grandparents/Grandchildren
|
|
38
|
+
GRANDPARENT_OF: 'grandparent_of',
|
|
39
|
+
GRANDCHILD_OF: 'grandchild_of',
|
|
40
|
+
// Step family (继父母/继子女)
|
|
41
|
+
STEP_PARENT_OF: 'step_parent_of',
|
|
42
|
+
STEP_FATHER_OF: 'step_father_of',
|
|
43
|
+
STEP_MOTHER_OF: 'step_mother_of',
|
|
44
|
+
STEP_CHILD_OF: 'step_child_of',
|
|
45
|
+
// Adoptive family (养父母/养子女)
|
|
46
|
+
ADOPTIVE_PARENT_OF: 'adoptive_parent_of',
|
|
47
|
+
ADOPTIVE_FATHER_OF: 'adoptive_father_of',
|
|
48
|
+
ADOPTIVE_MOTHER_OF: 'adoptive_mother_of',
|
|
49
|
+
ADOPTED_CHILD_OF: 'adopted_child_of',
|
|
50
|
+
};
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Chinese Kinship Titles
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/** Common Chinese kinship titles */
|
|
55
|
+
exports.CHINESE_KINSHIP_TITLES = {
|
|
56
|
+
// Direct ancestors
|
|
57
|
+
FATHER: '父亲',
|
|
58
|
+
MOTHER: '母亲',
|
|
59
|
+
PATERNAL_GRANDFATHER: '爷爷',
|
|
60
|
+
PATERNAL_GRANDMOTHER: '奶奶',
|
|
61
|
+
MATERNAL_GRANDFATHER: '外公',
|
|
62
|
+
MATERNAL_GRANDMOTHER: '外婆',
|
|
63
|
+
GREAT_GRANDFATHER: '曾祖父',
|
|
64
|
+
GREAT_GRANDMOTHER: '曾祖母',
|
|
65
|
+
// Direct descendants
|
|
66
|
+
SON: '儿子',
|
|
67
|
+
DAUGHTER: '女儿',
|
|
68
|
+
GRANDSON: '孙子',
|
|
69
|
+
GRANDDAUGHTER: '孙女',
|
|
70
|
+
GREAT_GRANDSON: '曾孙',
|
|
71
|
+
GREAT_GRANDDAUGHTER: '曾孙女',
|
|
72
|
+
// Spouse
|
|
73
|
+
HUSBAND: '丈夫',
|
|
74
|
+
WIFE: '妻子',
|
|
75
|
+
SPOUSE: '配偶',
|
|
76
|
+
// Siblings
|
|
77
|
+
OLDER_BROTHER: '哥哥',
|
|
78
|
+
YOUNGER_BROTHER: '弟弟',
|
|
79
|
+
OLDER_SISTER: '姐姐',
|
|
80
|
+
YOUNGER_SISTER: '妹妹',
|
|
81
|
+
BROTHER: '兄弟',
|
|
82
|
+
SISTER: '姐妹',
|
|
83
|
+
// Paternal uncles and aunts
|
|
84
|
+
PATERNAL_UNCLE_OLDER: '伯伯',
|
|
85
|
+
PATERNAL_UNCLE_YOUNGER: '叔叔',
|
|
86
|
+
PATERNAL_AUNT: '姑姑',
|
|
87
|
+
// Maternal uncles and aunts
|
|
88
|
+
MATERNAL_UNCLE: '舅舅',
|
|
89
|
+
MATERNAL_AUNT: '姨妈',
|
|
90
|
+
// Nephews and nieces
|
|
91
|
+
NEPHEW_PATERNAL: '侄子',
|
|
92
|
+
NIECE_PATERNAL: '侄女',
|
|
93
|
+
NEPHEW_MATERNAL: '外甥',
|
|
94
|
+
NIECE_MATERNAL: '外甥女',
|
|
95
|
+
// Cousins
|
|
96
|
+
PATERNAL_COUSIN_MALE: '堂兄弟',
|
|
97
|
+
PATERNAL_COUSIN_FEMALE: '堂姐妹',
|
|
98
|
+
MATERNAL_COUSIN_MALE: '表兄弟',
|
|
99
|
+
MATERNAL_COUSIN_FEMALE: '表姐妹',
|
|
100
|
+
// In-laws
|
|
101
|
+
FATHER_IN_LAW_HUSBAND: '公公',
|
|
102
|
+
MOTHER_IN_LAW_HUSBAND: '婆婆',
|
|
103
|
+
FATHER_IN_LAW_WIFE: '岳父',
|
|
104
|
+
MOTHER_IN_LAW_WIFE: '岳母',
|
|
105
|
+
SON_IN_LAW: '女婿',
|
|
106
|
+
DAUGHTER_IN_LAW: '儿媳',
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=family-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"family-types.js","sourceRoot":"","sources":["../ts/family-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAWH,uBAAuB;AACV,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,MAAgB;IACtB,MAAM,EAAE,QAAkB;IAC1B,OAAO,EAAE,SAAmB;CACpB,CAAC;AA8CX,0CAA0C;AAC7B,QAAA,qBAAqB,GAAG;IACnC,yBAAyB;IACzB,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS;IACT,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,WAAW;IACX,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,iBAAiB;IAClC,6BAA6B;IAC7B,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,wBAAwB;IACxB,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,4BAA4B;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,kBAAkB,EAAE,oBAAoB;IACxC,gBAAgB,EAAE,kBAAkB;CAC5B,CAAC;AA+HX,+EAA+E;AAC/E,yBAAyB;AACzB,+EAA+E;AAE/E,oCAAoC;AACvB,QAAA,sBAAsB,GAAG;IACpC,mBAAmB;IACnB,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,oBAAoB,EAAE,IAAI;IAC1B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database designed for AI applications with:
|
|
5
|
+
* - Vector similarity search (HNSW)
|
|
6
|
+
* - Semantic indexing
|
|
7
|
+
* - Agent memory with time decay
|
|
8
|
+
* - Knowledge graph support
|
|
9
|
+
* - Social graph analysis
|
|
10
|
+
* - Hybrid search (vector + text + metadata)
|
|
11
|
+
* - Built-in multimodal perception (Candle)
|
|
12
|
+
* - External LLM reasoning (Ollama/OpenAI)
|
|
13
|
+
*/
|
|
14
|
+
export { AiFastDb, version, type AiFastDbConfig, type IAiFastDb, type HNSWConfig, type StorageConfig, type MemoryInput, type MemoryNode, type SearchResult, type QueryOptions, type FilterCondition, type ContextOptions, type PreparedContext, type Collection, type CollectionStats, ContentType, } from './native';
|
|
15
|
+
export { AiFastDbClient, createAiFastDb } from './client';
|
|
16
|
+
export { QueryBuilder } from './query-builder';
|
|
17
|
+
export { MemoryManager } from './memory-manager';
|
|
18
|
+
export { VibeSynapse, createVibeSynapse, createVibeSynapseWithMiniLM, createVibeSynapseWithOllama, } from './vibe-synapse';
|
|
19
|
+
export { SocialGraph } from './social-graph';
|
|
20
|
+
export { ConnectMeAdapter } from './connectme-adapter';
|
|
21
|
+
export { FamilyTreeManager } from './family-tree';
|
|
22
|
+
export * from './family-types';
|
|
23
|
+
export { CollectionConfig, OnDeleteAction, ForeignKeyConfig, ForeignKeyValidationResult, CascadeDeleteResult, PopulateConfig, populate, foreignKey, MultiCollectionQueryOptions, EmbeddingFunction, BatchEmbeddingFunction, EmbeddingProvider, OpenAIEmbeddingConfig, EnrichedMemory, EnrichedSearchResult, ChunkingOptions, Document, IngestionResult, GraphTraversalResult, Filters, RelationTypes, EntityTypes, Modality, PerceptionConfig, ReasoningConfig, VibeSynapseConfig, MultimodalInput, PerceptionResult, ReasoningResult, LogicCheckResult, CrossModalSearchOptions, PerceptionPresets, ReasoningPresets, } from './types';
|
|
24
|
+
export * from './social-types';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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BAAuB,EACvB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AiFastDb - AI-friendly Database
|
|
4
|
+
*
|
|
5
|
+
* A high-performance database designed for AI applications with:
|
|
6
|
+
* - Vector similarity search (HNSW)
|
|
7
|
+
* - Semantic indexing
|
|
8
|
+
* - Agent memory with time decay
|
|
9
|
+
* - Knowledge graph support
|
|
10
|
+
* - Social graph analysis
|
|
11
|
+
* - Hybrid search (vector + text + metadata)
|
|
12
|
+
* - Built-in multimodal perception (Candle)
|
|
13
|
+
* - External LLM reasoning (Ollama/OpenAI)
|
|
14
|
+
*/
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.ReasoningPresets = exports.PerceptionPresets = exports.EntityTypes = exports.RelationTypes = exports.Filters = exports.foreignKey = exports.populate = exports.FamilyTreeManager = exports.ConnectMeAdapter = exports.SocialGraph = exports.createVibeSynapseWithOllama = exports.createVibeSynapseWithMiniLM = exports.createVibeSynapse = exports.VibeSynapse = exports.MemoryManager = exports.QueryBuilder = exports.createAiFastDb = exports.AiFastDbClient = exports.ContentType = exports.version = exports.AiFastDb = void 0;
|
|
31
|
+
// Re-export native bindings
|
|
32
|
+
var native_1 = require("./native");
|
|
33
|
+
Object.defineProperty(exports, "AiFastDb", { enumerable: true, get: function () { return native_1.AiFastDb; } });
|
|
34
|
+
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return native_1.version; } });
|
|
35
|
+
Object.defineProperty(exports, "ContentType", { enumerable: true, get: function () { return native_1.ContentType; } });
|
|
36
|
+
// Export high-level API
|
|
37
|
+
var client_1 = require("./client");
|
|
38
|
+
Object.defineProperty(exports, "AiFastDbClient", { enumerable: true, get: function () { return client_1.AiFastDbClient; } });
|
|
39
|
+
Object.defineProperty(exports, "createAiFastDb", { enumerable: true, get: function () { return client_1.createAiFastDb; } });
|
|
40
|
+
var query_builder_1 = require("./query-builder");
|
|
41
|
+
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return query_builder_1.QueryBuilder; } });
|
|
42
|
+
var memory_manager_1 = require("./memory-manager");
|
|
43
|
+
Object.defineProperty(exports, "MemoryManager", { enumerable: true, get: function () { return memory_manager_1.MemoryManager; } });
|
|
44
|
+
// Export VibeSynapse (multimodal perception API)
|
|
45
|
+
var vibe_synapse_1 = require("./vibe-synapse");
|
|
46
|
+
Object.defineProperty(exports, "VibeSynapse", { enumerable: true, get: function () { return vibe_synapse_1.VibeSynapse; } });
|
|
47
|
+
Object.defineProperty(exports, "createVibeSynapse", { enumerable: true, get: function () { return vibe_synapse_1.createVibeSynapse; } });
|
|
48
|
+
Object.defineProperty(exports, "createVibeSynapseWithMiniLM", { enumerable: true, get: function () { return vibe_synapse_1.createVibeSynapseWithMiniLM; } });
|
|
49
|
+
Object.defineProperty(exports, "createVibeSynapseWithOllama", { enumerable: true, get: function () { return vibe_synapse_1.createVibeSynapseWithOllama; } });
|
|
50
|
+
// Export Social Graph API
|
|
51
|
+
var social_graph_1 = require("./social-graph");
|
|
52
|
+
Object.defineProperty(exports, "SocialGraph", { enumerable: true, get: function () { return social_graph_1.SocialGraph; } });
|
|
53
|
+
var connectme_adapter_1 = require("./connectme-adapter");
|
|
54
|
+
Object.defineProperty(exports, "ConnectMeAdapter", { enumerable: true, get: function () { return connectme_adapter_1.ConnectMeAdapter; } });
|
|
55
|
+
// Export Family Tree API
|
|
56
|
+
var family_tree_1 = require("./family-tree");
|
|
57
|
+
Object.defineProperty(exports, "FamilyTreeManager", { enumerable: true, get: function () { return family_tree_1.FamilyTreeManager; } });
|
|
58
|
+
__exportStar(require("./family-types"), exports);
|
|
59
|
+
// Export types (excluding Entity and Relation from types to avoid conflict with social-types)
|
|
60
|
+
var types_1 = require("./types");
|
|
61
|
+
Object.defineProperty(exports, "populate", { enumerable: true, get: function () { return types_1.populate; } });
|
|
62
|
+
Object.defineProperty(exports, "foreignKey", { enumerable: true, get: function () { return types_1.foreignKey; } });
|
|
63
|
+
Object.defineProperty(exports, "Filters", { enumerable: true, get: function () { return types_1.Filters; } });
|
|
64
|
+
Object.defineProperty(exports, "RelationTypes", { enumerable: true, get: function () { return types_1.RelationTypes; } });
|
|
65
|
+
Object.defineProperty(exports, "EntityTypes", { enumerable: true, get: function () { return types_1.EntityTypes; } });
|
|
66
|
+
Object.defineProperty(exports, "PerceptionPresets", { enumerable: true, get: function () { return types_1.PerceptionPresets; } });
|
|
67
|
+
Object.defineProperty(exports, "ReasoningPresets", { enumerable: true, get: function () { return types_1.ReasoningPresets; } });
|
|
68
|
+
// Export social types (including Entity and Relation which are consistent with Rust core)
|
|
69
|
+
__exportStar(require("./social-types"), exports);
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;AAEH,4BAA4B;AAC5B,mCAiBkB;AAhBhB,kGAAA,QAAQ,OAAA;AACR,iGAAA,OAAO,OAAA;AAcP,qGAAA,WAAW,OAAA;AAGb,wBAAwB;AACxB,mCAA0D;AAAjD,wGAAA,cAAc,OAAA;AAAE,wGAAA,cAAc,OAAA;AACvC,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AAEtB,iDAAiD;AACjD,+CAKwB;AAJtB,2GAAA,WAAW,OAAA;AACX,iHAAA,iBAAiB,OAAA;AACjB,2HAAA,2BAA2B,OAAA;AAC3B,2HAAA,2BAA2B,OAAA;AAG7B,0BAA0B;AAC1B,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAEzB,yBAAyB;AACzB,6CAAkD;AAAzC,gHAAA,iBAAiB,OAAA;AAC1B,iDAA+B;AAE/B,8FAA8F;AAC9F,iCAkCiB;AA3Bf,iGAAA,QAAQ,OAAA;AACR,mGAAA,UAAU,OAAA;AAYV,gGAAA,OAAO,OAAA;AACP,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AAUX,0GAAA,iBAAiB,OAAA;AACjB,yGAAA,gBAAgB,OAAA;AAGlB,0FAA0F;AAC1F,iDAA+B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memory Manager for AI Agent long-term memory
|
|
3
|
+
*
|
|
4
|
+
* Provides higher-level memory management including:
|
|
5
|
+
* - Automatic importance decay
|
|
6
|
+
* - Memory consolidation
|
|
7
|
+
* - Context preparation for LLMs
|
|
8
|
+
*/
|
|
9
|
+
import type { IAiFastDb, MemoryNode, MemoryInput, PreparedContext } from './native';
|
|
10
|
+
import type { EmbeddingProvider, ChunkingOptions, Document, IngestionResult } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Memory manager configuration
|
|
13
|
+
*/
|
|
14
|
+
export interface MemoryManagerConfig {
|
|
15
|
+
/** Default decay rate for memories */
|
|
16
|
+
defaultDecayRate?: number;
|
|
17
|
+
/** Default importance for new memories */
|
|
18
|
+
defaultImportance?: number;
|
|
19
|
+
/** Maximum memories to keep (for pruning) */
|
|
20
|
+
maxMemories?: number;
|
|
21
|
+
/** Importance threshold below which memories can be pruned */
|
|
22
|
+
pruneThreshold?: number;
|
|
23
|
+
/** Embedding provider for automatic embedding generation */
|
|
24
|
+
embeddingProvider?: EmbeddingProvider;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Memory Manager for AI Agent applications
|
|
28
|
+
*/
|
|
29
|
+
export declare class MemoryManager {
|
|
30
|
+
private db;
|
|
31
|
+
private config;
|
|
32
|
+
constructor(db: IAiFastDb, config?: MemoryManagerConfig);
|
|
33
|
+
/**
|
|
34
|
+
* Set embedding provider
|
|
35
|
+
*/
|
|
36
|
+
setEmbeddingProvider(provider: EmbeddingProvider): void;
|
|
37
|
+
/**
|
|
38
|
+
* Store a memory with automatic embedding
|
|
39
|
+
*/
|
|
40
|
+
remember(content: string, options?: Partial<MemoryInput>): Promise<MemoryNode>;
|
|
41
|
+
/**
|
|
42
|
+
* Store multiple memories with automatic embedding
|
|
43
|
+
*/
|
|
44
|
+
rememberMany(items: Array<{
|
|
45
|
+
content: string;
|
|
46
|
+
options?: Partial<MemoryInput>;
|
|
47
|
+
}>): Promise<MemoryNode[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Ingest a document with chunking
|
|
50
|
+
*/
|
|
51
|
+
ingestDocument(doc: Document, options?: ChunkingOptions): Promise<IngestionResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Chunk text into smaller pieces
|
|
54
|
+
*/
|
|
55
|
+
private chunkText;
|
|
56
|
+
/**
|
|
57
|
+
* Recall memories with automatic query embedding
|
|
58
|
+
*/
|
|
59
|
+
recall(query: string, limit?: number): Promise<MemoryNode[]>;
|
|
60
|
+
/**
|
|
61
|
+
* Get context for LLM with automatic embedding
|
|
62
|
+
*/
|
|
63
|
+
getContext(query: string, maxTokens?: number): Promise<PreparedContext>;
|
|
64
|
+
/**
|
|
65
|
+
* Prune old/unimportant memories
|
|
66
|
+
*/
|
|
67
|
+
prune(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Consolidate similar memories
|
|
70
|
+
*/
|
|
71
|
+
consolidate(): Promise<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Get memory statistics
|
|
74
|
+
*/
|
|
75
|
+
stats(): {
|
|
76
|
+
totalMemories: number;
|
|
77
|
+
avgImportance: number;
|
|
78
|
+
oldestMemory: number;
|
|
79
|
+
newestMemory: number;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=memory-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-manager.d.ts","sourceRoot":"","sources":["../ts/memory-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,WAAW,EAEX,eAAe,EAEhB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,sCAAsC;IACtC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,MAAM,CAEZ;gBAEU,EAAE,EAAE,SAAS,EAAE,MAAM,GAAE,mBAAwB;IAW3D;;O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