@soulcraft/brainy 3.17.0 → 3.19.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/CHANGELOG.md +2 -0
- package/README.md +58 -10
- package/dist/augmentations/defaultAugmentations.d.ts +0 -1
- package/dist/augmentations/defaultAugmentations.js +0 -5
- package/dist/brainy.d.ts +64 -0
- package/dist/brainy.js +77 -0
- package/dist/conversation/conversationManager.d.ts +176 -0
- package/dist/conversation/conversationManager.js +666 -0
- package/dist/conversation/index.d.ts +8 -0
- package/dist/conversation/index.js +8 -0
- package/dist/conversation/types.d.ts +231 -0
- package/dist/conversation/types.js +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp/conversationTools.d.ts +88 -0
- package/dist/mcp/conversationTools.js +470 -0
- package/dist/neural/embeddedPatterns.d.ts +1 -1
- package/dist/neural/embeddedPatterns.js +1 -1
- package/dist/neural/naturalLanguageProcessor.js +0 -1
- package/dist/setup.js +0 -1
- package/dist/types/mcpTypes.d.ts +7 -1
- package/dist/unified.js +0 -1
- package/dist/vfs/VirtualFileSystem.d.ts +6 -4
- package/dist/vfs/VirtualFileSystem.js +44 -21
- package/dist/vfs/index.d.ts +0 -5
- package/dist/vfs/index.js +0 -6
- package/dist/vfs/semantic/ProjectionRegistry.d.ts +84 -0
- package/dist/vfs/semantic/ProjectionRegistry.js +118 -0
- package/dist/vfs/semantic/ProjectionStrategy.d.ts +69 -0
- package/dist/vfs/semantic/ProjectionStrategy.js +40 -0
- package/dist/vfs/semantic/SemanticPathParser.d.ts +73 -0
- package/dist/vfs/semantic/SemanticPathParser.js +285 -0
- package/dist/vfs/semantic/SemanticPathResolver.d.ts +99 -0
- package/dist/vfs/semantic/SemanticPathResolver.js +242 -0
- package/dist/vfs/semantic/index.d.ts +17 -0
- package/dist/vfs/semantic/index.js +18 -0
- package/dist/vfs/semantic/projections/AuthorProjection.d.ts +35 -0
- package/dist/vfs/semantic/projections/AuthorProjection.js +74 -0
- package/dist/vfs/semantic/projections/ConceptProjection.d.ts +42 -0
- package/dist/vfs/semantic/projections/ConceptProjection.js +87 -0
- package/dist/vfs/semantic/projections/RelationshipProjection.d.ts +41 -0
- package/dist/vfs/semantic/projections/RelationshipProjection.js +101 -0
- package/dist/vfs/semantic/projections/SimilarityProjection.d.ts +36 -0
- package/dist/vfs/semantic/projections/SimilarityProjection.js +77 -0
- package/dist/vfs/semantic/projections/TagProjection.d.ts +34 -0
- package/dist/vfs/semantic/projections/TagProjection.js +73 -0
- package/dist/vfs/semantic/projections/TemporalProjection.d.ts +35 -0
- package/dist/vfs/semantic/projections/TemporalProjection.js +89 -0
- package/dist/vfs/types.d.ts +1 -8
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relationship Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps relationship-based paths to files connected in the knowledge graph
|
|
5
|
+
* Uses EXISTING GraphAdjacencyIndex for O(1) traversal
|
|
6
|
+
*/
|
|
7
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
8
|
+
/**
|
|
9
|
+
* Relationship Projection: /related-to/<path>/depth-N/types-X,Y
|
|
10
|
+
*
|
|
11
|
+
* Uses EXISTING infrastructure:
|
|
12
|
+
* - Brainy.getRelations() for graph traversal (REAL - line 803 in brainy.ts)
|
|
13
|
+
* - GraphAdjacencyIndex for O(1) neighbor lookups (REAL)
|
|
14
|
+
* - VerbType enum for relationship types (REAL - graphTypes.ts)
|
|
15
|
+
*/
|
|
16
|
+
export class RelationshipProjection extends BaseProjectionStrategy {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.name = 'relationship';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert relationship value to Brainy FindParams
|
|
23
|
+
* Note: Graph queries don't use FindParams, but we provide this for consistency
|
|
24
|
+
*/
|
|
25
|
+
toQuery(value, subpath) {
|
|
26
|
+
// This is informational - actual resolution uses getRelations()
|
|
27
|
+
return {
|
|
28
|
+
where: {
|
|
29
|
+
vfsType: 'file'
|
|
30
|
+
},
|
|
31
|
+
connected: {
|
|
32
|
+
to: value.targetPath,
|
|
33
|
+
depth: value.depth || 1
|
|
34
|
+
},
|
|
35
|
+
limit: 1000
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve relationships using REAL Brainy.getRelations()
|
|
40
|
+
* Uses GraphAdjacencyIndex for O(1) graph traversal
|
|
41
|
+
*/
|
|
42
|
+
async resolve(brain, vfs, value) {
|
|
43
|
+
// Step 1: Resolve target path to entity ID
|
|
44
|
+
const targetId = await this.resolvePathToId(vfs, value.targetPath);
|
|
45
|
+
if (!targetId) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
// Step 2: Get relationships using REAL Brainy graph
|
|
49
|
+
const depth = value.depth || 1;
|
|
50
|
+
const visited = new Set();
|
|
51
|
+
const results = [];
|
|
52
|
+
await this.traverseRelationships(brain, targetId, depth, visited, results, value.relationshipTypes);
|
|
53
|
+
// Filter to only files
|
|
54
|
+
return await this.filterFiles(brain, results);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Recursive graph traversal using REAL Brainy.getRelations()
|
|
58
|
+
*/
|
|
59
|
+
async traverseRelationships(brain, entityId, remainingDepth, visited, results, types) {
|
|
60
|
+
if (remainingDepth <= 0 || visited.has(entityId)) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
visited.add(entityId);
|
|
64
|
+
// Get outgoing relationships (REAL method - line 803 in brainy.ts)
|
|
65
|
+
const relations = await brain.getRelations({
|
|
66
|
+
from: entityId,
|
|
67
|
+
limit: 100
|
|
68
|
+
});
|
|
69
|
+
for (const relation of relations) {
|
|
70
|
+
// Filter by relationship type if specified
|
|
71
|
+
if (types && types.length > 0) {
|
|
72
|
+
const relationshipName = relation.type?.toLowerCase();
|
|
73
|
+
if (!types.some(t => t.toLowerCase() === relationshipName)) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Add to results
|
|
78
|
+
if (!results.includes(relation.to)) {
|
|
79
|
+
results.push(relation.to);
|
|
80
|
+
}
|
|
81
|
+
// Recurse if depth remaining
|
|
82
|
+
if (remainingDepth > 1) {
|
|
83
|
+
await this.traverseRelationships(brain, relation.to, remainingDepth - 1, visited, results, types);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Resolve path to entity ID
|
|
89
|
+
* Helper to convert traditional path to entity ID
|
|
90
|
+
*/
|
|
91
|
+
async resolvePathToId(vfs, path) {
|
|
92
|
+
try {
|
|
93
|
+
// Use REAL VFS public method
|
|
94
|
+
return await vfs.resolvePath(path);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=RelationshipProjection.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Similarity Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps similarity-based paths to files with similar content
|
|
5
|
+
* Uses EXISTING HNSW Index for O(log n) vector similarity
|
|
6
|
+
*/
|
|
7
|
+
import { Brainy } from '../../../brainy.js';
|
|
8
|
+
import { VirtualFileSystem } from '../../VirtualFileSystem.js';
|
|
9
|
+
import { FindParams } from '../../../types/brainy.types.js';
|
|
10
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
11
|
+
import { SimilarityValue } from '../SemanticPathParser.js';
|
|
12
|
+
/**
|
|
13
|
+
* Similarity Projection: /similar-to/<path>/threshold-N
|
|
14
|
+
*
|
|
15
|
+
* Uses EXISTING infrastructure:
|
|
16
|
+
* - Brainy.similar() for vector similarity (REAL - line 680 in brainy.ts)
|
|
17
|
+
* - HNSW Index for O(log n) nearest neighbor search (REAL)
|
|
18
|
+
* - Cosine similarity for scoring (REAL)
|
|
19
|
+
*/
|
|
20
|
+
export declare class SimilarityProjection extends BaseProjectionStrategy {
|
|
21
|
+
readonly name = "similar";
|
|
22
|
+
/**
|
|
23
|
+
* Convert similarity value to Brainy FindParams
|
|
24
|
+
* Note: Similarity uses brain.similar(), not find(), but we provide this for consistency
|
|
25
|
+
*/
|
|
26
|
+
toQuery(value: SimilarityValue, subpath?: string): FindParams;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve similarity using REAL Brainy.similar()
|
|
29
|
+
* Uses HNSW Index for O(log n) vector search
|
|
30
|
+
*/
|
|
31
|
+
resolve(brain: Brainy, vfs: VirtualFileSystem, value: SimilarityValue): Promise<string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve path to entity ID
|
|
34
|
+
*/
|
|
35
|
+
private resolvePathToId;
|
|
36
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Similarity Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps similarity-based paths to files with similar content
|
|
5
|
+
* Uses EXISTING HNSW Index for O(log n) vector similarity
|
|
6
|
+
*/
|
|
7
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
8
|
+
/**
|
|
9
|
+
* Similarity Projection: /similar-to/<path>/threshold-N
|
|
10
|
+
*
|
|
11
|
+
* Uses EXISTING infrastructure:
|
|
12
|
+
* - Brainy.similar() for vector similarity (REAL - line 680 in brainy.ts)
|
|
13
|
+
* - HNSW Index for O(log n) nearest neighbor search (REAL)
|
|
14
|
+
* - Cosine similarity for scoring (REAL)
|
|
15
|
+
*/
|
|
16
|
+
export class SimilarityProjection extends BaseProjectionStrategy {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.name = 'similar';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert similarity value to Brainy FindParams
|
|
23
|
+
* Note: Similarity uses brain.similar(), not find(), but we provide this for consistency
|
|
24
|
+
*/
|
|
25
|
+
toQuery(value, subpath) {
|
|
26
|
+
// This is informational - actual resolution uses brain.similar()
|
|
27
|
+
return {
|
|
28
|
+
where: {
|
|
29
|
+
vfsType: 'file'
|
|
30
|
+
},
|
|
31
|
+
near: {
|
|
32
|
+
id: value.targetPath,
|
|
33
|
+
threshold: value.threshold || 0.7
|
|
34
|
+
},
|
|
35
|
+
limit: 50
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolve similarity using REAL Brainy.similar()
|
|
40
|
+
* Uses HNSW Index for O(log n) vector search
|
|
41
|
+
*/
|
|
42
|
+
async resolve(brain, vfs, value) {
|
|
43
|
+
// Step 1: Resolve target path to entity ID
|
|
44
|
+
const targetId = await this.resolvePathToId(vfs, value.targetPath);
|
|
45
|
+
if (!targetId) {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
// Step 2: Get target entity to use its vector
|
|
49
|
+
const targetEntity = await brain.get(targetId);
|
|
50
|
+
if (!targetEntity) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
// Step 3: Find similar entities using REAL HNSW search
|
|
54
|
+
// VERIFIED: brain.similar() exists at line 680 in brainy.ts
|
|
55
|
+
const results = await brain.similar({
|
|
56
|
+
to: targetEntity,
|
|
57
|
+
threshold: value.threshold || 0.7,
|
|
58
|
+
limit: 50,
|
|
59
|
+
where: { vfsType: 'file' } // Only files
|
|
60
|
+
});
|
|
61
|
+
// Extract IDs
|
|
62
|
+
return this.extractIds(results);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolve path to entity ID
|
|
66
|
+
*/
|
|
67
|
+
async resolvePathToId(vfs, path) {
|
|
68
|
+
try {
|
|
69
|
+
// Use REAL VFS public method
|
|
70
|
+
return await vfs.resolvePath(path);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=SimilarityProjection.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tag Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps tag-based paths to files with those tags
|
|
5
|
+
* Uses EXISTING MetadataIndexManager for O(log n) queries
|
|
6
|
+
*/
|
|
7
|
+
import { Brainy } from '../../../brainy.js';
|
|
8
|
+
import { VirtualFileSystem } from '../../VirtualFileSystem.js';
|
|
9
|
+
import { FindParams } from '../../../types/brainy.types.js';
|
|
10
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
11
|
+
import { VFSEntity } from '../../types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Tag Projection: /by-tag/<tagName>/<subpath>
|
|
14
|
+
*
|
|
15
|
+
* Uses EXISTING infrastructure:
|
|
16
|
+
* - Brainy.find() with metadata filters (REAL)
|
|
17
|
+
* - MetadataIndexManager for O(log n) tag queries (REAL)
|
|
18
|
+
* - VFSMetadata.tags field (REAL - types.ts line 66)
|
|
19
|
+
*/
|
|
20
|
+
export declare class TagProjection extends BaseProjectionStrategy {
|
|
21
|
+
readonly name = "tag";
|
|
22
|
+
/**
|
|
23
|
+
* Convert tag name to Brainy FindParams
|
|
24
|
+
*/
|
|
25
|
+
toQuery(tagName: string, subpath?: string): FindParams;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve tag to entity IDs using REAL Brainy.find()
|
|
28
|
+
*/
|
|
29
|
+
resolve(brain: Brainy, vfs: VirtualFileSystem, tagName: string): Promise<string[]>;
|
|
30
|
+
/**
|
|
31
|
+
* List all files with tags
|
|
32
|
+
*/
|
|
33
|
+
list(brain: Brainy, vfs: VirtualFileSystem, limit?: number): Promise<VFSEntity[]>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tag Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps tag-based paths to files with those tags
|
|
5
|
+
* Uses EXISTING MetadataIndexManager for O(log n) queries
|
|
6
|
+
*/
|
|
7
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
8
|
+
/**
|
|
9
|
+
* Tag Projection: /by-tag/<tagName>/<subpath>
|
|
10
|
+
*
|
|
11
|
+
* Uses EXISTING infrastructure:
|
|
12
|
+
* - Brainy.find() with metadata filters (REAL)
|
|
13
|
+
* - MetadataIndexManager for O(log n) tag queries (REAL)
|
|
14
|
+
* - VFSMetadata.tags field (REAL - types.ts line 66)
|
|
15
|
+
*/
|
|
16
|
+
export class TagProjection extends BaseProjectionStrategy {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.name = 'tag';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert tag name to Brainy FindParams
|
|
23
|
+
*/
|
|
24
|
+
toQuery(tagName, subpath) {
|
|
25
|
+
const query = {
|
|
26
|
+
where: {
|
|
27
|
+
vfsType: 'file',
|
|
28
|
+
tags: { contains: tagName } // BFO operator for array contains
|
|
29
|
+
},
|
|
30
|
+
limit: 1000
|
|
31
|
+
};
|
|
32
|
+
// Filter by filename if subpath specified
|
|
33
|
+
if (subpath) {
|
|
34
|
+
query.where = {
|
|
35
|
+
...query.where,
|
|
36
|
+
anyOf: [
|
|
37
|
+
{ name: subpath },
|
|
38
|
+
{ path: { endsWith: subpath } } // BFO operator
|
|
39
|
+
]
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return query;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve tag to entity IDs using REAL Brainy.find()
|
|
46
|
+
*/
|
|
47
|
+
async resolve(brain, vfs, tagName) {
|
|
48
|
+
// Use REAL Brainy metadata filtering
|
|
49
|
+
const results = await brain.find({
|
|
50
|
+
where: {
|
|
51
|
+
vfsType: 'file',
|
|
52
|
+
tags: { contains: tagName } // BFO operator
|
|
53
|
+
},
|
|
54
|
+
limit: 1000
|
|
55
|
+
});
|
|
56
|
+
return this.extractIds(results);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* List all files with tags
|
|
60
|
+
*/
|
|
61
|
+
async list(brain, vfs, limit = 100) {
|
|
62
|
+
// Get all files that have tags
|
|
63
|
+
const results = await brain.find({
|
|
64
|
+
where: {
|
|
65
|
+
vfsType: 'file',
|
|
66
|
+
tags: { exists: true } // BFO operator
|
|
67
|
+
},
|
|
68
|
+
limit
|
|
69
|
+
});
|
|
70
|
+
return results.map(r => r.entity);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=TagProjection.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporal Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps time-based paths to files modified at that time
|
|
5
|
+
* Uses EXISTING MetadataIndexManager with range queries
|
|
6
|
+
*/
|
|
7
|
+
import { Brainy } from '../../../brainy.js';
|
|
8
|
+
import { VirtualFileSystem } from '../../VirtualFileSystem.js';
|
|
9
|
+
import { FindParams } from '../../../types/brainy.types.js';
|
|
10
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
11
|
+
import { VFSEntity } from '../../types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Temporal Projection: /as-of/<YYYY-MM-DD>/<subpath>
|
|
14
|
+
*
|
|
15
|
+
* Uses EXISTING infrastructure:
|
|
16
|
+
* - Brainy.find() with range queries (REAL)
|
|
17
|
+
* - MetadataIndexManager.$gte/$lte operators (REAL)
|
|
18
|
+
* - VFSMetadata.modified field (REAL - types.ts line 49)
|
|
19
|
+
*/
|
|
20
|
+
export declare class TemporalProjection extends BaseProjectionStrategy {
|
|
21
|
+
readonly name = "time";
|
|
22
|
+
/**
|
|
23
|
+
* Convert date to Brainy FindParams with range query
|
|
24
|
+
*/
|
|
25
|
+
toQuery(date: Date, subpath?: string): FindParams;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve date to entity IDs using REAL Brainy.find()
|
|
28
|
+
* Uses MetadataIndexManager range queries for O(log n) performance
|
|
29
|
+
*/
|
|
30
|
+
resolve(brain: Brainy, vfs: VirtualFileSystem, date: Date): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* List recently modified files
|
|
33
|
+
*/
|
|
34
|
+
list(brain: Brainy, vfs: VirtualFileSystem, limit?: number): Promise<VFSEntity[]>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Temporal Projection Strategy
|
|
3
|
+
*
|
|
4
|
+
* Maps time-based paths to files modified at that time
|
|
5
|
+
* Uses EXISTING MetadataIndexManager with range queries
|
|
6
|
+
*/
|
|
7
|
+
import { BaseProjectionStrategy } from '../ProjectionStrategy.js';
|
|
8
|
+
/**
|
|
9
|
+
* Temporal Projection: /as-of/<YYYY-MM-DD>/<subpath>
|
|
10
|
+
*
|
|
11
|
+
* Uses EXISTING infrastructure:
|
|
12
|
+
* - Brainy.find() with range queries (REAL)
|
|
13
|
+
* - MetadataIndexManager.$gte/$lte operators (REAL)
|
|
14
|
+
* - VFSMetadata.modified field (REAL - types.ts line 49)
|
|
15
|
+
*/
|
|
16
|
+
export class TemporalProjection extends BaseProjectionStrategy {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.name = 'time';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Convert date to Brainy FindParams with range query
|
|
23
|
+
*/
|
|
24
|
+
toQuery(date, subpath) {
|
|
25
|
+
// Get start and end of day (24-hour window)
|
|
26
|
+
const startOfDay = new Date(date);
|
|
27
|
+
startOfDay.setHours(0, 0, 0, 0);
|
|
28
|
+
const endOfDay = new Date(date);
|
|
29
|
+
endOfDay.setHours(23, 59, 59, 999);
|
|
30
|
+
const query = {
|
|
31
|
+
where: {
|
|
32
|
+
vfsType: 'file',
|
|
33
|
+
modified: {
|
|
34
|
+
greaterEqual: startOfDay.getTime(), // BFO operator
|
|
35
|
+
lessEqual: endOfDay.getTime() // BFO operator
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
limit: 1000
|
|
39
|
+
};
|
|
40
|
+
// Filter by filename if subpath specified
|
|
41
|
+
if (subpath) {
|
|
42
|
+
query.where = {
|
|
43
|
+
...query.where,
|
|
44
|
+
anyOf: [
|
|
45
|
+
{ name: subpath },
|
|
46
|
+
{ path: { endsWith: subpath } } // BFO operator (not $regex)
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return query;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve date to entity IDs using REAL Brainy.find()
|
|
54
|
+
* Uses MetadataIndexManager range queries for O(log n) performance
|
|
55
|
+
*/
|
|
56
|
+
async resolve(brain, vfs, date) {
|
|
57
|
+
const startOfDay = new Date(date);
|
|
58
|
+
startOfDay.setHours(0, 0, 0, 0);
|
|
59
|
+
const endOfDay = new Date(date);
|
|
60
|
+
endOfDay.setHours(23, 59, 59, 999);
|
|
61
|
+
// Use REAL Brainy metadata filtering with range operators
|
|
62
|
+
const results = await brain.find({
|
|
63
|
+
where: {
|
|
64
|
+
vfsType: 'file',
|
|
65
|
+
modified: {
|
|
66
|
+
greaterEqual: startOfDay.getTime(), // BFO operator
|
|
67
|
+
lessEqual: endOfDay.getTime() // BFO operator
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
limit: 1000
|
|
71
|
+
});
|
|
72
|
+
return this.extractIds(results);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* List recently modified files
|
|
76
|
+
*/
|
|
77
|
+
async list(brain, vfs, limit = 100) {
|
|
78
|
+
const oneDayAgo = Date.now() - (24 * 60 * 60 * 1000);
|
|
79
|
+
const results = await brain.find({
|
|
80
|
+
where: {
|
|
81
|
+
vfsType: 'file',
|
|
82
|
+
modified: { greaterEqual: oneDayAgo } // BFO operator
|
|
83
|
+
},
|
|
84
|
+
limit
|
|
85
|
+
});
|
|
86
|
+
return results.map(r => r.entity);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=TemporalProjection.js.map
|
package/dist/vfs/types.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export interface VFSMetadata {
|
|
|
48
48
|
name: string;
|
|
49
49
|
confidence: number;
|
|
50
50
|
}>;
|
|
51
|
+
conceptNames?: string[];
|
|
51
52
|
todos?: VFSTodo[];
|
|
52
53
|
dependencies?: string[];
|
|
53
54
|
exports?: string[];
|
|
@@ -252,14 +253,6 @@ export interface VFSConfig {
|
|
|
252
253
|
autoTag?: boolean;
|
|
253
254
|
autoConcepts?: boolean;
|
|
254
255
|
};
|
|
255
|
-
knowledgeLayer?: {
|
|
256
|
-
enabled?: boolean;
|
|
257
|
-
eventRecording?: boolean;
|
|
258
|
-
semanticVersioning?: boolean;
|
|
259
|
-
persistentEntities?: boolean;
|
|
260
|
-
concepts?: boolean;
|
|
261
|
-
gitBridge?: boolean;
|
|
262
|
-
};
|
|
263
256
|
permissions?: {
|
|
264
257
|
defaultFile?: number;
|
|
265
258
|
defaultDirectory?: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soulcraft/brainy",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.19.0",
|
|
4
4
|
"description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|