@psiclawops/hypermem 0.1.0 → 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/ARCHITECTURE.md +4 -3
- package/README.md +457 -174
- package/package.json +15 -5
- package/dist/background-indexer.d.ts +0 -117
- package/dist/background-indexer.d.ts.map +0 -1
- package/dist/background-indexer.js +0 -732
- package/dist/compaction-fence.d.ts +0 -89
- package/dist/compaction-fence.d.ts.map +0 -1
- package/dist/compaction-fence.js +0 -153
- package/dist/compositor.d.ts +0 -139
- package/dist/compositor.d.ts.map +0 -1
- package/dist/compositor.js +0 -1109
- package/dist/cross-agent.d.ts +0 -57
- package/dist/cross-agent.d.ts.map +0 -1
- package/dist/cross-agent.js +0 -254
- package/dist/db.d.ts +0 -131
- package/dist/db.d.ts.map +0 -1
- package/dist/db.js +0 -398
- package/dist/desired-state-store.d.ts +0 -100
- package/dist/desired-state-store.d.ts.map +0 -1
- package/dist/desired-state-store.js +0 -212
- package/dist/doc-chunk-store.d.ts +0 -115
- package/dist/doc-chunk-store.d.ts.map +0 -1
- package/dist/doc-chunk-store.js +0 -278
- package/dist/doc-chunker.d.ts +0 -99
- package/dist/doc-chunker.d.ts.map +0 -1
- package/dist/doc-chunker.js +0 -324
- package/dist/episode-store.d.ts +0 -48
- package/dist/episode-store.d.ts.map +0 -1
- package/dist/episode-store.js +0 -135
- package/dist/fact-store.d.ts +0 -57
- package/dist/fact-store.d.ts.map +0 -1
- package/dist/fact-store.js +0 -175
- package/dist/fleet-store.d.ts +0 -144
- package/dist/fleet-store.d.ts.map +0 -1
- package/dist/fleet-store.js +0 -276
- package/dist/hybrid-retrieval.d.ts +0 -60
- package/dist/hybrid-retrieval.d.ts.map +0 -1
- package/dist/hybrid-retrieval.js +0 -340
- package/dist/index.d.ts +0 -611
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -1042
- package/dist/knowledge-graph.d.ts +0 -110
- package/dist/knowledge-graph.d.ts.map +0 -1
- package/dist/knowledge-graph.js +0 -305
- package/dist/knowledge-store.d.ts +0 -72
- package/dist/knowledge-store.d.ts.map +0 -1
- package/dist/knowledge-store.js +0 -241
- package/dist/library-schema.d.ts +0 -22
- package/dist/library-schema.d.ts.map +0 -1
- package/dist/library-schema.js +0 -717
- package/dist/message-store.d.ts +0 -76
- package/dist/message-store.d.ts.map +0 -1
- package/dist/message-store.js +0 -273
- package/dist/preference-store.d.ts +0 -54
- package/dist/preference-store.d.ts.map +0 -1
- package/dist/preference-store.js +0 -109
- package/dist/preservation-gate.d.ts +0 -82
- package/dist/preservation-gate.d.ts.map +0 -1
- package/dist/preservation-gate.js +0 -150
- package/dist/provider-translator.d.ts +0 -40
- package/dist/provider-translator.d.ts.map +0 -1
- package/dist/provider-translator.js +0 -349
- package/dist/rate-limiter.d.ts +0 -76
- package/dist/rate-limiter.d.ts.map +0 -1
- package/dist/rate-limiter.js +0 -179
- package/dist/redis.d.ts +0 -188
- package/dist/redis.d.ts.map +0 -1
- package/dist/redis.js +0 -534
- package/dist/schema.d.ts +0 -15
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -203
- package/dist/secret-scanner.d.ts +0 -51
- package/dist/secret-scanner.d.ts.map +0 -1
- package/dist/secret-scanner.js +0 -248
- package/dist/seed.d.ts +0 -108
- package/dist/seed.d.ts.map +0 -1
- package/dist/seed.js +0 -177
- package/dist/system-store.d.ts +0 -73
- package/dist/system-store.d.ts.map +0 -1
- package/dist/system-store.js +0 -182
- package/dist/topic-store.d.ts +0 -45
- package/dist/topic-store.d.ts.map +0 -1
- package/dist/topic-store.js +0 -136
- package/dist/types.d.ts +0 -329
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -9
- package/dist/vector-store.d.ts +0 -132
- package/dist/vector-store.d.ts.map +0 -1
- package/dist/vector-store.js +0 -498
- package/dist/work-store.d.ts +0 -112
- package/dist/work-store.d.ts.map +0 -1
- package/dist/work-store.js +0 -273
package/dist/fact-store.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HyperMem Fact Store
|
|
3
|
-
*
|
|
4
|
-
* CRUD operations for facts (extracted knowledge that spans sessions).
|
|
5
|
-
* Facts live in the central library DB, tagged by agent_id.
|
|
6
|
-
* Facts have scope (agent/session/user), confidence, and decay.
|
|
7
|
-
*/
|
|
8
|
-
function nowIso() {
|
|
9
|
-
return new Date().toISOString();
|
|
10
|
-
}
|
|
11
|
-
function parseFactRow(row) {
|
|
12
|
-
return {
|
|
13
|
-
id: row.id,
|
|
14
|
-
agentId: row.agent_id,
|
|
15
|
-
scope: row.scope,
|
|
16
|
-
domain: row.domain || null,
|
|
17
|
-
content: row.content,
|
|
18
|
-
confidence: row.confidence,
|
|
19
|
-
visibility: row.visibility || 'private',
|
|
20
|
-
sourceType: row.source_type || 'conversation',
|
|
21
|
-
sourceSessionKey: row.source_session_key || null,
|
|
22
|
-
sourceRef: row.source_ref || null,
|
|
23
|
-
createdAt: row.created_at,
|
|
24
|
-
updatedAt: row.updated_at,
|
|
25
|
-
expiresAt: row.expires_at || null,
|
|
26
|
-
supersededBy: row.superseded_by || null,
|
|
27
|
-
decayScore: row.decay_score,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export class FactStore {
|
|
31
|
-
db;
|
|
32
|
-
constructor(db) {
|
|
33
|
-
this.db = db;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Add a new fact. Checks for duplicates by content.
|
|
37
|
-
*/
|
|
38
|
-
addFact(agentId, content, opts) {
|
|
39
|
-
const now = nowIso();
|
|
40
|
-
const scope = opts?.scope || 'agent';
|
|
41
|
-
// Check for exact duplicate
|
|
42
|
-
const existing = this.db.prepare(`
|
|
43
|
-
SELECT * FROM facts WHERE agent_id = ? AND content = ? AND scope = ?
|
|
44
|
-
`).get(agentId, content, scope);
|
|
45
|
-
if (existing) {
|
|
46
|
-
this.db.prepare(`
|
|
47
|
-
UPDATE facts SET confidence = MAX(confidence, ?), updated_at = ? WHERE id = ?
|
|
48
|
-
`).run(opts?.confidence || 1.0, now, existing.id);
|
|
49
|
-
return parseFactRow({ ...existing, updated_at: now });
|
|
50
|
-
}
|
|
51
|
-
const result = this.db.prepare(`
|
|
52
|
-
INSERT INTO facts (agent_id, scope, domain, content, confidence,
|
|
53
|
-
visibility, source_type, source_session_key, source_ref,
|
|
54
|
-
created_at, updated_at, expires_at, decay_score)
|
|
55
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0.0)
|
|
56
|
-
`).run(agentId, scope, opts?.domain || null, content, opts?.confidence || 1.0, opts?.visibility || 'private', opts?.sourceType || 'conversation', opts?.sourceSessionKey || null, opts?.sourceRef || null, now, now, opts?.expiresAt || null);
|
|
57
|
-
const id = Number(result.lastInsertRowid);
|
|
58
|
-
return {
|
|
59
|
-
id,
|
|
60
|
-
agentId,
|
|
61
|
-
scope,
|
|
62
|
-
domain: opts?.domain || null,
|
|
63
|
-
content,
|
|
64
|
-
confidence: opts?.confidence || 1.0,
|
|
65
|
-
visibility: opts?.visibility || 'private',
|
|
66
|
-
sourceType: opts?.sourceType || 'conversation',
|
|
67
|
-
sourceSessionKey: opts?.sourceSessionKey || null,
|
|
68
|
-
sourceRef: opts?.sourceRef || null,
|
|
69
|
-
createdAt: now,
|
|
70
|
-
updatedAt: now,
|
|
71
|
-
expiresAt: opts?.expiresAt || null,
|
|
72
|
-
supersededBy: null,
|
|
73
|
-
decayScore: 0,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get active facts for an agent.
|
|
78
|
-
*/
|
|
79
|
-
getActiveFacts(agentId, opts) {
|
|
80
|
-
let sql = `
|
|
81
|
-
SELECT * FROM facts
|
|
82
|
-
WHERE agent_id = ?
|
|
83
|
-
AND superseded_by IS NULL
|
|
84
|
-
AND (expires_at IS NULL OR expires_at > datetime('now'))
|
|
85
|
-
AND decay_score < 0.8
|
|
86
|
-
`;
|
|
87
|
-
const params = [agentId];
|
|
88
|
-
if (opts?.scope) {
|
|
89
|
-
sql += ' AND scope = ?';
|
|
90
|
-
params.push(opts.scope);
|
|
91
|
-
}
|
|
92
|
-
if (opts?.domain) {
|
|
93
|
-
sql += ' AND domain = ?';
|
|
94
|
-
params.push(opts.domain);
|
|
95
|
-
}
|
|
96
|
-
if (opts?.minConfidence) {
|
|
97
|
-
sql += ' AND confidence >= ?';
|
|
98
|
-
params.push(opts.minConfidence);
|
|
99
|
-
}
|
|
100
|
-
sql += ' ORDER BY confidence DESC, decay_score ASC';
|
|
101
|
-
if (opts?.limit) {
|
|
102
|
-
sql += ' LIMIT ?';
|
|
103
|
-
params.push(opts.limit);
|
|
104
|
-
}
|
|
105
|
-
const rows = this.db.prepare(sql).all(...params);
|
|
106
|
-
return rows.map(parseFactRow);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Full-text search facts.
|
|
110
|
-
*/
|
|
111
|
-
searchFacts(query, opts) {
|
|
112
|
-
const limit = opts?.limit || 20;
|
|
113
|
-
const hasFilters = !!(opts?.agentId || opts?.domain || opts?.visibility);
|
|
114
|
-
const innerLimit = hasFilters ? limit * 4 : limit;
|
|
115
|
-
// Two-phase: FTS in subquery, then filter on small set. See hybrid-retrieval.ts.
|
|
116
|
-
let sql = `
|
|
117
|
-
SELECT f.* FROM (
|
|
118
|
-
SELECT rowid, rank FROM facts_fts WHERE facts_fts MATCH ? ORDER BY rank LIMIT ?
|
|
119
|
-
) sub
|
|
120
|
-
JOIN facts f ON f.id = sub.rowid
|
|
121
|
-
WHERE f.superseded_by IS NULL
|
|
122
|
-
AND f.decay_score < 0.8
|
|
123
|
-
`;
|
|
124
|
-
const params = [query, innerLimit];
|
|
125
|
-
if (opts?.agentId) {
|
|
126
|
-
sql += ' AND f.agent_id = ?';
|
|
127
|
-
params.push(opts.agentId);
|
|
128
|
-
}
|
|
129
|
-
if (opts?.domain) {
|
|
130
|
-
sql += ' AND f.domain = ?';
|
|
131
|
-
params.push(opts.domain);
|
|
132
|
-
}
|
|
133
|
-
if (opts?.visibility) {
|
|
134
|
-
sql += ' AND f.visibility = ?';
|
|
135
|
-
params.push(opts.visibility);
|
|
136
|
-
}
|
|
137
|
-
sql += ' ORDER BY sub.rank LIMIT ?';
|
|
138
|
-
params.push(limit);
|
|
139
|
-
const rows = this.db.prepare(sql).all(...params);
|
|
140
|
-
return rows.map(parseFactRow);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Decay all facts by a fixed rate.
|
|
144
|
-
*/
|
|
145
|
-
decayFacts(agentId, decayRate = 0.01) {
|
|
146
|
-
const result = this.db.prepare(`
|
|
147
|
-
UPDATE facts
|
|
148
|
-
SET decay_score = MIN(decay_score + ?, 1.0), updated_at = ?
|
|
149
|
-
WHERE agent_id = ? AND decay_score < 1.0
|
|
150
|
-
`).run(decayRate, nowIso(), agentId);
|
|
151
|
-
return result.changes;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Remove expired and fully decayed facts.
|
|
155
|
-
*/
|
|
156
|
-
pruneFacts(agentId) {
|
|
157
|
-
const result = this.db.prepare(`
|
|
158
|
-
DELETE FROM facts
|
|
159
|
-
WHERE agent_id = ?
|
|
160
|
-
AND (
|
|
161
|
-
(expires_at IS NOT NULL AND expires_at < datetime('now'))
|
|
162
|
-
OR decay_score >= 1.0
|
|
163
|
-
)
|
|
164
|
-
`).run(agentId);
|
|
165
|
-
return result.changes;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Get fact count for an agent.
|
|
169
|
-
*/
|
|
170
|
-
getFactCount(agentId) {
|
|
171
|
-
const row = this.db.prepare('SELECT COUNT(*) AS count FROM facts WHERE agent_id = ?').get(agentId);
|
|
172
|
-
return row.count;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
//# sourceMappingURL=fact-store.js.map
|
package/dist/fleet-store.d.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HyperMem Fleet Registry Store
|
|
3
|
-
*
|
|
4
|
-
* Agent roster, org structure, roles, capabilities.
|
|
5
|
-
* Lives in the central library DB.
|
|
6
|
-
* The operational map of the fleet.
|
|
7
|
-
*/
|
|
8
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
9
|
-
export interface AgentCapability {
|
|
10
|
-
capType: 'skill' | 'tool' | 'mcp_server';
|
|
11
|
-
name: string;
|
|
12
|
-
version?: string;
|
|
13
|
-
source?: string;
|
|
14
|
-
config?: Record<string, unknown>;
|
|
15
|
-
status: string;
|
|
16
|
-
lastVerified?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface FleetAgent {
|
|
19
|
-
id: string;
|
|
20
|
-
displayName: string;
|
|
21
|
-
tier: string;
|
|
22
|
-
orgId: string | null;
|
|
23
|
-
reportsTo: string | null;
|
|
24
|
-
domains: string[];
|
|
25
|
-
sessionKeys: string[];
|
|
26
|
-
status: string;
|
|
27
|
-
lastSeen: string | null;
|
|
28
|
-
createdAt: string;
|
|
29
|
-
updatedAt: string;
|
|
30
|
-
metadata: Record<string, unknown> | null;
|
|
31
|
-
capabilities: AgentCapability[] | null;
|
|
32
|
-
}
|
|
33
|
-
export interface FleetOrg {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string;
|
|
36
|
-
leadAgentId: string | null;
|
|
37
|
-
mission: string | null;
|
|
38
|
-
createdAt: string;
|
|
39
|
-
}
|
|
40
|
-
export declare class FleetStore {
|
|
41
|
-
private readonly db;
|
|
42
|
-
constructor(db: DatabaseSync);
|
|
43
|
-
/**
|
|
44
|
-
* Register or update an agent.
|
|
45
|
-
*/
|
|
46
|
-
upsertAgent(id: string, data: {
|
|
47
|
-
displayName?: string;
|
|
48
|
-
tier?: string;
|
|
49
|
-
orgId?: string;
|
|
50
|
-
reportsTo?: string;
|
|
51
|
-
domains?: string[];
|
|
52
|
-
sessionKeys?: string[];
|
|
53
|
-
status?: string;
|
|
54
|
-
metadata?: Record<string, unknown>;
|
|
55
|
-
}): FleetAgent;
|
|
56
|
-
/**
|
|
57
|
-
* Get an agent by ID.
|
|
58
|
-
*/
|
|
59
|
-
getAgent(id: string): FleetAgent | null;
|
|
60
|
-
/**
|
|
61
|
-
* List all agents, optionally filtered.
|
|
62
|
-
*/
|
|
63
|
-
listAgents(opts?: {
|
|
64
|
-
tier?: string;
|
|
65
|
-
orgId?: string;
|
|
66
|
-
status?: string;
|
|
67
|
-
}): FleetAgent[];
|
|
68
|
-
/**
|
|
69
|
-
* Update agent status and last_seen.
|
|
70
|
-
*/
|
|
71
|
-
heartbeat(agentId: string, status?: string): void;
|
|
72
|
-
/**
|
|
73
|
-
* Find agents by domain.
|
|
74
|
-
*/
|
|
75
|
-
findByDomain(domain: string): FleetAgent[];
|
|
76
|
-
/**
|
|
77
|
-
* Register or update an org.
|
|
78
|
-
*/
|
|
79
|
-
upsertOrg(id: string, data: {
|
|
80
|
-
name: string;
|
|
81
|
-
leadAgentId?: string;
|
|
82
|
-
mission?: string;
|
|
83
|
-
}): FleetOrg;
|
|
84
|
-
/**
|
|
85
|
-
* Get an org by ID.
|
|
86
|
-
*/
|
|
87
|
-
getOrg(id: string): FleetOrg | null;
|
|
88
|
-
/**
|
|
89
|
-
* List all orgs.
|
|
90
|
-
*/
|
|
91
|
-
listOrgs(): FleetOrg[];
|
|
92
|
-
/**
|
|
93
|
-
* Get all agents in an org.
|
|
94
|
-
*/
|
|
95
|
-
getOrgMembers(orgId: string): FleetAgent[];
|
|
96
|
-
/**
|
|
97
|
-
* Register or update a capability for an agent.
|
|
98
|
-
*/
|
|
99
|
-
upsertCapability(agentId: string, cap: {
|
|
100
|
-
capType: AgentCapability['capType'];
|
|
101
|
-
name: string;
|
|
102
|
-
version?: string;
|
|
103
|
-
source?: string;
|
|
104
|
-
config?: Record<string, unknown>;
|
|
105
|
-
status?: string;
|
|
106
|
-
}): AgentCapability;
|
|
107
|
-
/**
|
|
108
|
-
* Bulk-sync capabilities for an agent (replace all of a given type).
|
|
109
|
-
*/
|
|
110
|
-
syncCapabilities(agentId: string, capType: AgentCapability['capType'], caps: Array<{
|
|
111
|
-
name: string;
|
|
112
|
-
version?: string;
|
|
113
|
-
source?: string;
|
|
114
|
-
config?: Record<string, unknown>;
|
|
115
|
-
}>): void;
|
|
116
|
-
/**
|
|
117
|
-
* Get a specific capability.
|
|
118
|
-
*/
|
|
119
|
-
getCapability(agentId: string, capType: string, name: string): AgentCapability | null;
|
|
120
|
-
/**
|
|
121
|
-
* List capabilities for an agent, optionally filtered by type.
|
|
122
|
-
*/
|
|
123
|
-
getAgentCapabilities(agentId: string, capType?: string): AgentCapability[];
|
|
124
|
-
/**
|
|
125
|
-
* Find agents that have a specific capability.
|
|
126
|
-
*/
|
|
127
|
-
findByCapability(capType: string, name: string): FleetAgent[];
|
|
128
|
-
/**
|
|
129
|
-
* Find agents that have ANY of the given capabilities.
|
|
130
|
-
*/
|
|
131
|
-
findByAnyCapability(caps: Array<{
|
|
132
|
-
capType: string;
|
|
133
|
-
name: string;
|
|
134
|
-
}>): FleetAgent[];
|
|
135
|
-
/**
|
|
136
|
-
* Remove a capability from an agent.
|
|
137
|
-
*/
|
|
138
|
-
removeCapability(agentId: string, capType: string, name: string): void;
|
|
139
|
-
/**
|
|
140
|
-
* Sync the denormalized capabilities JSON on fleet_agents.
|
|
141
|
-
*/
|
|
142
|
-
private _syncCapabilitiesJson;
|
|
143
|
-
}
|
|
144
|
-
//# sourceMappingURL=fleet-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fleet-store.d.ts","sourceRoot":"","sources":["../src/fleet-store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM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AO,CAAC,CAAC;QACjC,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,eAAe;IAgCnB;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC;QACjF,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClC,CAAC,GAAG,IAAI;IAyBT;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAQrF;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,EAAE;IAe1E;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE;IAW7D;;OAEG;IACH,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,UAAU,EAAE;IAgBjF;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAWtE;;OAEG;IACH,OAAO,CAAC,qBAAqB;CAQ9B"}
|
package/dist/fleet-store.js
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HyperMem Fleet Registry Store
|
|
3
|
-
*
|
|
4
|
-
* Agent roster, org structure, roles, capabilities.
|
|
5
|
-
* Lives in the central library DB.
|
|
6
|
-
* The operational map of the fleet.
|
|
7
|
-
*/
|
|
8
|
-
function nowIso() {
|
|
9
|
-
return new Date().toISOString();
|
|
10
|
-
}
|
|
11
|
-
function parseAgentRow(row) {
|
|
12
|
-
return {
|
|
13
|
-
id: row.id,
|
|
14
|
-
displayName: row.display_name,
|
|
15
|
-
tier: row.tier,
|
|
16
|
-
orgId: row.org_id || null,
|
|
17
|
-
reportsTo: row.reports_to || null,
|
|
18
|
-
domains: row.domains ? JSON.parse(row.domains) : [],
|
|
19
|
-
sessionKeys: row.session_keys ? JSON.parse(row.session_keys) : [],
|
|
20
|
-
status: row.status,
|
|
21
|
-
lastSeen: row.last_seen || null,
|
|
22
|
-
createdAt: row.created_at,
|
|
23
|
-
updatedAt: row.updated_at,
|
|
24
|
-
metadata: row.metadata ? JSON.parse(row.metadata) : null,
|
|
25
|
-
capabilities: row.capabilities ? JSON.parse(row.capabilities) : null,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function parseCapabilityRow(row) {
|
|
29
|
-
return {
|
|
30
|
-
capType: row.cap_type,
|
|
31
|
-
name: row.name,
|
|
32
|
-
version: row.version || undefined,
|
|
33
|
-
source: row.source || undefined,
|
|
34
|
-
config: row.config ? JSON.parse(row.config) : undefined,
|
|
35
|
-
status: row.status,
|
|
36
|
-
lastVerified: row.last_verified || undefined,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function parseOrgRow(row) {
|
|
40
|
-
return {
|
|
41
|
-
id: row.id,
|
|
42
|
-
name: row.name,
|
|
43
|
-
leadAgentId: row.lead_agent_id || null,
|
|
44
|
-
mission: row.mission || null,
|
|
45
|
-
createdAt: row.created_at,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
export class FleetStore {
|
|
49
|
-
db;
|
|
50
|
-
constructor(db) {
|
|
51
|
-
this.db = db;
|
|
52
|
-
}
|
|
53
|
-
// ── Agents ──────────────────────────────────────────────────
|
|
54
|
-
/**
|
|
55
|
-
* Register or update an agent.
|
|
56
|
-
*/
|
|
57
|
-
upsertAgent(id, data) {
|
|
58
|
-
const now = nowIso();
|
|
59
|
-
const existing = this.db.prepare('SELECT * FROM fleet_agents WHERE id = ?')
|
|
60
|
-
.get(id);
|
|
61
|
-
if (existing) {
|
|
62
|
-
this.db.prepare(`
|
|
63
|
-
UPDATE fleet_agents SET
|
|
64
|
-
display_name = COALESCE(?, display_name),
|
|
65
|
-
tier = COALESCE(?, tier),
|
|
66
|
-
org_id = COALESCE(?, org_id),
|
|
67
|
-
reports_to = COALESCE(?, reports_to),
|
|
68
|
-
domains = COALESCE(?, domains),
|
|
69
|
-
session_keys = COALESCE(?, session_keys),
|
|
70
|
-
status = COALESCE(?, status),
|
|
71
|
-
metadata = COALESCE(?, metadata),
|
|
72
|
-
last_seen = ?,
|
|
73
|
-
updated_at = ?
|
|
74
|
-
WHERE id = ?
|
|
75
|
-
`).run(data.displayName || null, data.tier || null, data.orgId || null, data.reportsTo || null, data.domains ? JSON.stringify(data.domains) : null, data.sessionKeys ? JSON.stringify(data.sessionKeys) : null, data.status || null, data.metadata ? JSON.stringify(data.metadata) : null, now, now, id);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
this.db.prepare(`
|
|
79
|
-
INSERT INTO fleet_agents (id, display_name, tier, org_id, reports_to,
|
|
80
|
-
domains, session_keys, status, last_seen, created_at, updated_at, metadata)
|
|
81
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
82
|
-
`).run(id, data.displayName || id, data.tier || 'unknown', data.orgId || null, data.reportsTo || null, data.domains ? JSON.stringify(data.domains) : '[]', data.sessionKeys ? JSON.stringify(data.sessionKeys) : '[]', data.status || 'active', now, now, now, data.metadata ? JSON.stringify(data.metadata) : null);
|
|
83
|
-
}
|
|
84
|
-
return this.getAgent(id);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Get an agent by ID.
|
|
88
|
-
*/
|
|
89
|
-
getAgent(id) {
|
|
90
|
-
const row = this.db.prepare('SELECT * FROM fleet_agents WHERE id = ?')
|
|
91
|
-
.get(id);
|
|
92
|
-
return row ? parseAgentRow(row) : null;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* List all agents, optionally filtered.
|
|
96
|
-
*/
|
|
97
|
-
listAgents(opts) {
|
|
98
|
-
let sql = 'SELECT * FROM fleet_agents WHERE 1=1';
|
|
99
|
-
const params = [];
|
|
100
|
-
if (opts?.tier) {
|
|
101
|
-
sql += ' AND tier = ?';
|
|
102
|
-
params.push(opts.tier);
|
|
103
|
-
}
|
|
104
|
-
if (opts?.orgId) {
|
|
105
|
-
sql += ' AND org_id = ?';
|
|
106
|
-
params.push(opts.orgId);
|
|
107
|
-
}
|
|
108
|
-
if (opts?.status) {
|
|
109
|
-
sql += ' AND status = ?';
|
|
110
|
-
params.push(opts.status);
|
|
111
|
-
}
|
|
112
|
-
sql += ' ORDER BY tier, id';
|
|
113
|
-
const rows = this.db.prepare(sql).all(...params);
|
|
114
|
-
return rows.map(parseAgentRow);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Update agent status and last_seen.
|
|
118
|
-
*/
|
|
119
|
-
heartbeat(agentId, status = 'active') {
|
|
120
|
-
const now = nowIso();
|
|
121
|
-
this.db.prepare('UPDATE fleet_agents SET status = ?, last_seen = ?, updated_at = ? WHERE id = ?').run(status, now, now, agentId);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Find agents by domain.
|
|
125
|
-
*/
|
|
126
|
-
findByDomain(domain) {
|
|
127
|
-
const rows = this.db.prepare("SELECT * FROM fleet_agents WHERE domains LIKE ? AND status = 'active'").all(`%"${domain}"%`);
|
|
128
|
-
return rows.map(parseAgentRow);
|
|
129
|
-
}
|
|
130
|
-
// ── Orgs ────────────────────────────────────────────────────
|
|
131
|
-
/**
|
|
132
|
-
* Register or update an org.
|
|
133
|
-
*/
|
|
134
|
-
upsertOrg(id, data) {
|
|
135
|
-
const now = nowIso();
|
|
136
|
-
this.db.prepare(`
|
|
137
|
-
INSERT INTO fleet_orgs (id, name, lead_agent_id, mission, created_at)
|
|
138
|
-
VALUES (?, ?, ?, ?, ?)
|
|
139
|
-
ON CONFLICT(id) DO UPDATE SET
|
|
140
|
-
name = excluded.name,
|
|
141
|
-
lead_agent_id = COALESCE(excluded.lead_agent_id, lead_agent_id),
|
|
142
|
-
mission = COALESCE(excluded.mission, mission)
|
|
143
|
-
`).run(id, data.name, data.leadAgentId || null, data.mission || null, now);
|
|
144
|
-
return this.getOrg(id);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get an org by ID.
|
|
148
|
-
*/
|
|
149
|
-
getOrg(id) {
|
|
150
|
-
const row = this.db.prepare('SELECT * FROM fleet_orgs WHERE id = ?')
|
|
151
|
-
.get(id);
|
|
152
|
-
return row ? parseOrgRow(row) : null;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* List all orgs.
|
|
156
|
-
*/
|
|
157
|
-
listOrgs() {
|
|
158
|
-
const rows = this.db.prepare('SELECT * FROM fleet_orgs ORDER BY name')
|
|
159
|
-
.all();
|
|
160
|
-
return rows.map(parseOrgRow);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Get all agents in an org.
|
|
164
|
-
*/
|
|
165
|
-
getOrgMembers(orgId) {
|
|
166
|
-
const rows = this.db.prepare("SELECT * FROM fleet_agents WHERE org_id = ? ORDER BY tier, id").all(orgId);
|
|
167
|
-
return rows.map(parseAgentRow);
|
|
168
|
-
}
|
|
169
|
-
// ── Capabilities ────────────────────────────────────────────
|
|
170
|
-
/**
|
|
171
|
-
* Register or update a capability for an agent.
|
|
172
|
-
*/
|
|
173
|
-
upsertCapability(agentId, cap) {
|
|
174
|
-
const now = nowIso();
|
|
175
|
-
this.db.prepare(`
|
|
176
|
-
INSERT INTO agent_capabilities (agent_id, cap_type, name, version, source, config, status, last_verified, created_at, updated_at)
|
|
177
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
178
|
-
ON CONFLICT(agent_id, cap_type, name) DO UPDATE SET
|
|
179
|
-
version = COALESCE(excluded.version, version),
|
|
180
|
-
source = COALESCE(excluded.source, source),
|
|
181
|
-
config = COALESCE(excluded.config, config),
|
|
182
|
-
status = excluded.status,
|
|
183
|
-
last_verified = excluded.last_verified,
|
|
184
|
-
updated_at = excluded.updated_at
|
|
185
|
-
`).run(agentId, cap.capType, cap.name, cap.version || null, cap.source || null, cap.config ? JSON.stringify(cap.config) : null, cap.status || 'active', now, now, now);
|
|
186
|
-
// Also update the denormalized JSON on fleet_agents
|
|
187
|
-
this._syncCapabilitiesJson(agentId);
|
|
188
|
-
return this.getCapability(agentId, cap.capType, cap.name);
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Bulk-sync capabilities for an agent (replace all of a given type).
|
|
192
|
-
*/
|
|
193
|
-
syncCapabilities(agentId, capType, caps) {
|
|
194
|
-
const now = nowIso();
|
|
195
|
-
const capNames = caps.map(c => c.name);
|
|
196
|
-
// Mark missing ones as removed
|
|
197
|
-
const existing = this.db.prepare('SELECT name FROM agent_capabilities WHERE agent_id = ? AND cap_type = ? AND status = ?').all(agentId, capType, 'active');
|
|
198
|
-
for (const row of existing) {
|
|
199
|
-
if (!capNames.includes(row.name)) {
|
|
200
|
-
this.db.prepare('UPDATE agent_capabilities SET status = ?, updated_at = ? WHERE agent_id = ? AND cap_type = ? AND name = ?').run('removed', now, agentId, capType, row.name);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
// Upsert current ones
|
|
204
|
-
for (const cap of caps) {
|
|
205
|
-
this.upsertCapability(agentId, { capType, ...cap });
|
|
206
|
-
}
|
|
207
|
-
this._syncCapabilitiesJson(agentId);
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Get a specific capability.
|
|
211
|
-
*/
|
|
212
|
-
getCapability(agentId, capType, name) {
|
|
213
|
-
const row = this.db.prepare('SELECT * FROM agent_capabilities WHERE agent_id = ? AND cap_type = ? AND name = ?').get(agentId, capType, name);
|
|
214
|
-
return row ? parseCapabilityRow(row) : null;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* List capabilities for an agent, optionally filtered by type.
|
|
218
|
-
*/
|
|
219
|
-
getAgentCapabilities(agentId, capType) {
|
|
220
|
-
let sql = 'SELECT * FROM agent_capabilities WHERE agent_id = ? AND status = ?';
|
|
221
|
-
const params = [agentId, 'active'];
|
|
222
|
-
if (capType) {
|
|
223
|
-
sql += ' AND cap_type = ?';
|
|
224
|
-
params.push(capType);
|
|
225
|
-
}
|
|
226
|
-
sql += ' ORDER BY cap_type, name';
|
|
227
|
-
const rows = this.db.prepare(sql).all(...params);
|
|
228
|
-
return rows.map(parseCapabilityRow);
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Find agents that have a specific capability.
|
|
232
|
-
*/
|
|
233
|
-
findByCapability(capType, name) {
|
|
234
|
-
const rows = this.db.prepare(`
|
|
235
|
-
SELECT fa.* FROM fleet_agents fa
|
|
236
|
-
INNER JOIN agent_capabilities ac ON ac.agent_id = fa.id
|
|
237
|
-
WHERE ac.cap_type = ? AND ac.name = ? AND ac.status = 'active' AND fa.status = 'active'
|
|
238
|
-
ORDER BY fa.tier, fa.id
|
|
239
|
-
`).all(capType, name);
|
|
240
|
-
return rows.map(parseAgentRow);
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Find agents that have ANY of the given capabilities.
|
|
244
|
-
*/
|
|
245
|
-
findByAnyCapability(caps) {
|
|
246
|
-
if (caps.length === 0)
|
|
247
|
-
return [];
|
|
248
|
-
const conditions = caps.map(() => '(ac.cap_type = ? AND ac.name = ?)').join(' OR ');
|
|
249
|
-
const params = caps.flatMap(c => [c.capType, c.name]);
|
|
250
|
-
const rows = this.db.prepare(`
|
|
251
|
-
SELECT DISTINCT fa.* FROM fleet_agents fa
|
|
252
|
-
INNER JOIN agent_capabilities ac ON ac.agent_id = fa.id
|
|
253
|
-
WHERE (${conditions}) AND ac.status = 'active' AND fa.status = 'active'
|
|
254
|
-
ORDER BY fa.tier, fa.id
|
|
255
|
-
`).all(...params);
|
|
256
|
-
return rows.map(parseAgentRow);
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Remove a capability from an agent.
|
|
260
|
-
*/
|
|
261
|
-
removeCapability(agentId, capType, name) {
|
|
262
|
-
const now = nowIso();
|
|
263
|
-
this.db.prepare('UPDATE agent_capabilities SET status = ?, updated_at = ? WHERE agent_id = ? AND cap_type = ? AND name = ?').run('removed', now, agentId, capType, name);
|
|
264
|
-
this._syncCapabilitiesJson(agentId);
|
|
265
|
-
}
|
|
266
|
-
// ── Internal ────────────────────────────────────────────────
|
|
267
|
-
/**
|
|
268
|
-
* Sync the denormalized capabilities JSON on fleet_agents.
|
|
269
|
-
*/
|
|
270
|
-
_syncCapabilitiesJson(agentId) {
|
|
271
|
-
const caps = this.getAgentCapabilities(agentId);
|
|
272
|
-
const now = nowIso();
|
|
273
|
-
this.db.prepare('UPDATE fleet_agents SET capabilities = ?, updated_at = ? WHERE id = ?').run(JSON.stringify(caps), now, agentId);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
//# sourceMappingURL=fleet-store.js.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HyperMem Hybrid Retrieval — FTS5 + KNN Score Fusion
|
|
3
|
-
*
|
|
4
|
-
* Merges keyword (FTS5/BM25) and semantic (KNN/vector) results into a
|
|
5
|
-
* single ranked list using Reciprocal Rank Fusion (RRF). This avoids
|
|
6
|
-
* vocabulary mismatch (KNN-only misses exact terms) and semantic gap
|
|
7
|
-
* (FTS5-only misses paraphrases).
|
|
8
|
-
*
|
|
9
|
-
* Architecture:
|
|
10
|
-
* - FTS5 results from library.db (facts_fts, knowledge_fts, episodes_fts)
|
|
11
|
-
* - KNN results from vectors.db via VectorStore
|
|
12
|
-
* - RRF merges both ranked lists with configurable k constant
|
|
13
|
-
* - Deduplication by (sourceTable, sourceId)
|
|
14
|
-
* - Token-budgeted output for compositor consumption
|
|
15
|
-
*/
|
|
16
|
-
import type { DatabaseSync } from 'node:sqlite';
|
|
17
|
-
import type { VectorStore } from './vector-store.js';
|
|
18
|
-
export interface HybridSearchResult {
|
|
19
|
-
sourceTable: string;
|
|
20
|
-
sourceId: number;
|
|
21
|
-
content: string;
|
|
22
|
-
domain?: string;
|
|
23
|
-
agentId?: string;
|
|
24
|
-
metadata?: string;
|
|
25
|
-
/** Combined RRF score (higher = more relevant) */
|
|
26
|
-
score: number;
|
|
27
|
-
/** Which retrieval paths contributed */
|
|
28
|
-
sources: ('fts' | 'knn')[];
|
|
29
|
-
}
|
|
30
|
-
export interface HybridSearchOptions {
|
|
31
|
-
/** Content types to search. Default: ['facts', 'knowledge', 'episodes'] */
|
|
32
|
-
tables?: string[];
|
|
33
|
-
/** Max results to return. Default: 10 */
|
|
34
|
-
limit?: number;
|
|
35
|
-
/** Max KNN distance (filters low-quality vectors). Default: 1.2 */
|
|
36
|
-
maxKnnDistance?: number;
|
|
37
|
-
/** RRF k constant. Higher = less weight to top ranks. Default: 60 */
|
|
38
|
-
rrfK?: number;
|
|
39
|
-
/** Agent ID filter for FTS queries */
|
|
40
|
-
agentId?: string;
|
|
41
|
-
/** Weight for FTS results in fusion. Default: 1.0 */
|
|
42
|
-
ftsWeight?: number;
|
|
43
|
-
/** Weight for KNN results in fusion. Default: 1.0 */
|
|
44
|
-
knnWeight?: number;
|
|
45
|
-
/** Minimum number of FTS terms to attempt a query (skip if fewer). Default: 1 */
|
|
46
|
-
minFtsTerms?: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Build an FTS5 query from a natural language string.
|
|
50
|
-
* Extracts meaningful words, removes stop words, uses OR conjunction.
|
|
51
|
-
*/
|
|
52
|
-
export declare function buildFtsQuery(input: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* Hybrid search combining FTS5 keyword search and KNN vector search.
|
|
55
|
-
*
|
|
56
|
-
* When vectorStore is null, falls back to FTS5-only.
|
|
57
|
-
* When FTS5 query is empty (all stop words), falls back to KNN-only.
|
|
58
|
-
*/
|
|
59
|
-
export declare function hybridSearch(libraryDb: DatabaseSync, vectorStore: VectorStore | null, query: string, opts?: HybridSearchOptions): Promise<HybridSearchResult[]>;
|
|
60
|
-
//# sourceMappingURL=hybrid-retrieval.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hybrid-retrieval.d.ts","sourceRoot":"","sources":["../src/hybrid-retrieval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAsB,MAAM,mBAAmB,CAAC;AAIzE,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,OAAO,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAA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