@cleocode/brain 2026.11.16 → 2026.11.17-rc.ci.734
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/README.md +31 -21
- package/dist/src/adapters/agent-registry.d.ts +12 -9
- package/dist/src/adapters/agent-registry.d.ts.map +1 -1
- package/dist/src/adapters/agent-registry.js +40 -65
- package/dist/src/adapters/agent-registry.js.map +1 -1
- package/dist/src/adapters/brain.d.ts +3 -2
- package/dist/src/adapters/brain.d.ts.map +1 -1
- package/dist/src/adapters/brain.js +172 -172
- package/dist/src/adapters/brain.js.map +1 -1
- package/dist/src/adapters/conduit.d.ts +5 -4
- package/dist/src/adapters/conduit.d.ts.map +1 -1
- package/dist/src/adapters/conduit.js +53 -64
- package/dist/src/adapters/conduit.js.map +1 -1
- package/dist/src/adapters/index.d.ts +2 -2
- package/dist/src/adapters/index.d.ts.map +1 -1
- package/dist/src/adapters/index.js +11 -10
- package/dist/src/adapters/index.js.map +1 -1
- package/dist/src/adapters/nexus.d.ts +5 -3
- package/dist/src/adapters/nexus.d.ts.map +1 -1
- package/dist/src/adapters/nexus.js +47 -44
- package/dist/src/adapters/nexus.js.map +1 -1
- package/dist/src/adapters/tasks.d.ts +4 -2
- package/dist/src/adapters/tasks.d.ts.map +1 -1
- package/dist/src/adapters/tasks.js +93 -92
- package/dist/src/adapters/tasks.js.map +1 -1
- package/dist/src/cleo-home.d.ts +22 -12
- package/dist/src/cleo-home.d.ts.map +1 -1
- package/dist/src/cleo-home.js +24 -20
- package/dist/src/cleo-home.js.map +1 -1
- package/dist/src/db-connections.d.ts +23 -101
- package/dist/src/db-connections.d.ts.map +1 -1
- package/dist/src/db-connections.js +43 -169
- package/dist/src/db-connections.js.map +1 -1
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/project-context.d.ts +15 -7
- package/dist/src/project-context.d.ts.map +1 -1
- package/dist/src/project-context.js +10 -15
- package/dist/src/project-context.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* BRAIN substrate adapter for the Living Brain API.
|
|
3
3
|
*
|
|
4
|
-
* Queries
|
|
4
|
+
* Queries the project `cleo.db` and returns BrainNodes/BrainEdges for all typed
|
|
5
|
+
* memory tables:
|
|
5
6
|
* observations, decisions, patterns, learnings, plus the graph layer
|
|
6
7
|
* (brain_page_nodes / brain_page_edges).
|
|
7
8
|
*
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
*
|
|
14
15
|
* Node IDs are prefixed with "brain:" to prevent collisions.
|
|
15
16
|
*/
|
|
16
|
-
import { allTyped,
|
|
17
|
+
import { allTyped, readProjectStore } from '../db-connections.js';
|
|
17
18
|
import { resolveDefaultProjectContext } from '../project-context.js';
|
|
18
19
|
/**
|
|
19
20
|
* Converts a brain_page_edges type-prefixed ID (e.g. "observation:O-abc")
|
|
@@ -76,7 +77,7 @@ function taskRefToBrainNodeId(taskRef) {
|
|
|
76
77
|
return `tasks:${taskRef.slice('task:'.length)}`;
|
|
77
78
|
}
|
|
78
79
|
/**
|
|
79
|
-
* Returns all BrainNodes and BrainEdges sourced from
|
|
80
|
+
* Returns all BrainNodes and BrainEdges sourced from the project `cleo.db`.
|
|
80
81
|
*
|
|
81
82
|
* Pulls from all four typed memory tables plus brain_page_edges.
|
|
82
83
|
* Emits intra-brain edges between loaded nodes, cross-substrate
|
|
@@ -91,213 +92,212 @@ function taskRefToBrainNodeId(taskRef) {
|
|
|
91
92
|
*/
|
|
92
93
|
export function getBrainSubstrate(options = {}) {
|
|
93
94
|
const ctx = options.projectCtx ?? resolveDefaultProjectContext();
|
|
94
|
-
const db = getBrainDb(ctx);
|
|
95
|
-
if (!db)
|
|
96
|
-
return { nodes: [], edges: [] };
|
|
97
95
|
const minWeight = options.minWeight ?? 0;
|
|
98
96
|
const perSubstrateLimit = Math.ceil((options.limit ?? 500) / 5);
|
|
99
97
|
const nodes = [];
|
|
100
98
|
const edges = [];
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
readProjectStore(ctx, (db) => {
|
|
100
|
+
try {
|
|
101
|
+
// Observations — normalise created_at to ISO-8601 with 'T' separator via strftime
|
|
102
|
+
const obsRows = allTyped(db.prepare(`SELECT id, title, quality_score, memory_tier,
|
|
104
103
|
strftime('%Y-%m-%dT%H:%M:%S', created_at) AS created_at,
|
|
105
104
|
source_session_id, files_modified_json
|
|
106
|
-
FROM brain_observations
|
|
105
|
+
FROM main.brain_observations
|
|
107
106
|
WHERE (quality_score IS NULL OR quality_score >= ?)
|
|
108
107
|
ORDER BY quality_score DESC, created_at DESC
|
|
109
108
|
LIMIT ?`), minWeight, Math.ceil(perSubstrateLimit * 0.4));
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
109
|
+
for (const row of obsRows) {
|
|
110
|
+
nodes.push({
|
|
111
|
+
id: `brain:${row.id}`,
|
|
112
|
+
kind: 'observation',
|
|
113
|
+
substrate: 'brain',
|
|
114
|
+
label: row.title,
|
|
115
|
+
weight: row.quality_score ?? undefined,
|
|
116
|
+
createdAt: row.created_at,
|
|
117
|
+
meta: {
|
|
118
|
+
memory_tier: row.memory_tier,
|
|
119
|
+
created_at: row.created_at,
|
|
120
|
+
source_session_id: row.source_session_id,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
// Decisions — normalise created_at to ISO-8601 with 'T' separator via strftime
|
|
125
|
+
const decRows = allTyped(db.prepare(`SELECT id, decision, quality_score, context_task_id,
|
|
127
126
|
strftime('%Y-%m-%dT%H:%M:%S', created_at) AS created_at
|
|
128
|
-
FROM brain_decisions
|
|
127
|
+
FROM main.brain_decisions
|
|
129
128
|
WHERE (quality_score IS NULL OR quality_score >= ?)
|
|
130
129
|
ORDER BY quality_score DESC, created_at DESC
|
|
131
130
|
LIMIT ?`), minWeight, Math.ceil(perSubstrateLimit * 0.25));
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
131
|
+
for (const row of decRows) {
|
|
132
|
+
nodes.push({
|
|
133
|
+
id: `brain:${row.id}`,
|
|
134
|
+
kind: 'decision',
|
|
135
|
+
substrate: 'brain',
|
|
136
|
+
label: row.decision.slice(0, 100),
|
|
137
|
+
weight: row.quality_score ?? undefined,
|
|
138
|
+
createdAt: row.created_at,
|
|
139
|
+
meta: {
|
|
140
|
+
context_task_id: row.context_task_id,
|
|
141
|
+
created_at: row.created_at,
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
// Patterns — uses 'pattern' text column (not 'title') and 'extracted_at' (not 'created_at').
|
|
146
|
+
// SQLite strftime is used to normalise the timestamp to ISO-8601 with 'T' separator.
|
|
147
|
+
const patRows = allTyped(db.prepare(`SELECT id, pattern, type, quality_score,
|
|
149
148
|
strftime('%Y-%m-%dT%H:%M:%S', extracted_at) AS extracted_at
|
|
150
|
-
FROM brain_patterns
|
|
149
|
+
FROM main.brain_patterns
|
|
151
150
|
WHERE (quality_score IS NULL OR quality_score >= ?)
|
|
152
151
|
ORDER BY quality_score DESC, extracted_at DESC
|
|
153
152
|
LIMIT ?`), minWeight, Math.ceil(perSubstrateLimit * 0.2));
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
153
|
+
for (const row of patRows) {
|
|
154
|
+
nodes.push({
|
|
155
|
+
id: `brain:${row.id}`,
|
|
156
|
+
kind: 'pattern',
|
|
157
|
+
substrate: 'brain',
|
|
158
|
+
label: row.pattern.slice(0, 100),
|
|
159
|
+
weight: row.quality_score ?? undefined,
|
|
160
|
+
createdAt: row.extracted_at,
|
|
161
|
+
meta: { pattern_type: row.type, created_at: row.extracted_at },
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// Learnings — uses 'insight' text column (not 'title').
|
|
165
|
+
// Normalise created_at to ISO-8601 with 'T' separator via strftime.
|
|
166
|
+
const learnRows = allTyped(db.prepare(`SELECT id, insight, quality_score,
|
|
168
167
|
strftime('%Y-%m-%dT%H:%M:%S', created_at) AS created_at
|
|
169
|
-
FROM brain_learnings
|
|
168
|
+
FROM main.brain_learnings
|
|
170
169
|
WHERE (quality_score IS NULL OR quality_score >= ?)
|
|
171
170
|
ORDER BY quality_score DESC, created_at DESC
|
|
172
171
|
LIMIT ?`), minWeight, Math.ceil(perSubstrateLimit * 0.15));
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
// Build lookup: type-prefixed ID (e.g. "observation:O-abc") → BrainNode ID
|
|
185
|
-
// (e.g. "brain:O-abc"). This is needed because brain_page_edges stores
|
|
186
|
-
// IDs in type-prefixed format while BrainNode IDs use the "brain:" prefix.
|
|
187
|
-
const typeIdToBrainNodeId = new Map();
|
|
188
|
-
for (const n of nodes) {
|
|
189
|
-
const rawId = n.id.slice('brain:'.length);
|
|
190
|
-
// Determine which type prefix this node would have in brain_page_edges
|
|
191
|
-
let typePrefix;
|
|
192
|
-
if (n.kind === 'observation')
|
|
193
|
-
typePrefix = 'observation';
|
|
194
|
-
else if (n.kind === 'decision')
|
|
195
|
-
typePrefix = 'decision';
|
|
196
|
-
else if (n.kind === 'pattern')
|
|
197
|
-
typePrefix = 'pattern';
|
|
198
|
-
else
|
|
199
|
-
typePrefix = 'learning';
|
|
200
|
-
typeIdToBrainNodeId.set(`${typePrefix}:${rawId}`, n.id);
|
|
201
|
-
}
|
|
202
|
-
// brain_page_edges: query all and classify each edge
|
|
203
|
-
const pageEdgeRows = allTyped(db.prepare(`SELECT from_id, to_id, edge_type, weight FROM brain_page_edges`));
|
|
204
|
-
for (const row of pageEdgeRows) {
|
|
205
|
-
const sourceBrainNodeId = typeIdToBrainNodeId.get(row.from_id) ?? brainTypeIdToBrainNodeId(row.from_id);
|
|
206
|
-
if (!sourceBrainNodeId)
|
|
207
|
-
continue; // source not a recognised brain node
|
|
208
|
-
if (isTaskId(row.to_id)) {
|
|
209
|
-
// Cross-substrate: brain → tasks
|
|
210
|
-
edges.push({
|
|
211
|
-
source: sourceBrainNodeId,
|
|
212
|
-
target: taskRefToBrainNodeId(row.to_id),
|
|
213
|
-
type: row.edge_type,
|
|
214
|
-
weight: row.weight ?? 0.5,
|
|
215
|
-
substrate: 'cross',
|
|
172
|
+
for (const row of learnRows) {
|
|
173
|
+
nodes.push({
|
|
174
|
+
id: `brain:${row.id}`,
|
|
175
|
+
kind: 'learning',
|
|
176
|
+
substrate: 'brain',
|
|
177
|
+
label: row.insight.slice(0, 100),
|
|
178
|
+
weight: row.quality_score ?? undefined,
|
|
179
|
+
createdAt: row.created_at,
|
|
180
|
+
meta: { created_at: row.created_at },
|
|
216
181
|
});
|
|
217
182
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
183
|
+
// Build lookup: type-prefixed ID (e.g. "observation:O-abc") → BrainNode ID
|
|
184
|
+
// (e.g. "brain:O-abc"). This is needed because brain_page_edges stores
|
|
185
|
+
// IDs in type-prefixed format while BrainNode IDs use the "brain:" prefix.
|
|
186
|
+
const typeIdToBrainNodeId = new Map();
|
|
187
|
+
for (const n of nodes) {
|
|
188
|
+
const rawId = n.id.slice('brain:'.length);
|
|
189
|
+
// Determine which type prefix this node would have in brain_page_edges
|
|
190
|
+
let typePrefix;
|
|
191
|
+
if (n.kind === 'observation')
|
|
192
|
+
typePrefix = 'observation';
|
|
193
|
+
else if (n.kind === 'decision')
|
|
194
|
+
typePrefix = 'decision';
|
|
195
|
+
else if (n.kind === 'pattern')
|
|
196
|
+
typePrefix = 'pattern';
|
|
197
|
+
else
|
|
198
|
+
typePrefix = 'learning';
|
|
199
|
+
typeIdToBrainNodeId.set(`${typePrefix}:${rawId}`, n.id);
|
|
227
200
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
201
|
+
// brain_page_edges: query all and classify each edge
|
|
202
|
+
const pageEdgeRows = allTyped(db.prepare(`SELECT from_id, to_id, edge_type, weight FROM main.brain_page_edges`));
|
|
203
|
+
for (const row of pageEdgeRows) {
|
|
204
|
+
const sourceBrainNodeId = typeIdToBrainNodeId.get(row.from_id) ?? brainTypeIdToBrainNodeId(row.from_id);
|
|
205
|
+
if (!sourceBrainNodeId)
|
|
206
|
+
continue; // source not a recognised brain node
|
|
207
|
+
if (isTaskId(row.to_id)) {
|
|
208
|
+
// Cross-substrate: brain → tasks
|
|
232
209
|
edges.push({
|
|
233
210
|
source: sourceBrainNodeId,
|
|
234
|
-
target:
|
|
211
|
+
target: taskRefToBrainNodeId(row.to_id),
|
|
235
212
|
type: row.edge_type,
|
|
236
213
|
weight: row.weight ?? 0.5,
|
|
237
|
-
substrate: '
|
|
214
|
+
substrate: 'cross',
|
|
238
215
|
});
|
|
239
216
|
}
|
|
217
|
+
else if (isNexusStyleId(row.to_id)) {
|
|
218
|
+
// Cross-substrate: brain → nexus (code_reference, etc.)
|
|
219
|
+
edges.push({
|
|
220
|
+
source: sourceBrainNodeId,
|
|
221
|
+
target: `nexus:${row.to_id}`,
|
|
222
|
+
type: row.edge_type,
|
|
223
|
+
weight: row.weight ?? 0.5,
|
|
224
|
+
substrate: 'cross',
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
// Intra-brain: both IDs should be brain nodes
|
|
229
|
+
const targetBrainNodeId = typeIdToBrainNodeId.get(row.to_id) ?? brainTypeIdToBrainNodeId(row.to_id);
|
|
230
|
+
if (targetBrainNodeId) {
|
|
231
|
+
edges.push({
|
|
232
|
+
source: sourceBrainNodeId,
|
|
233
|
+
target: targetBrainNodeId,
|
|
234
|
+
type: row.edge_type,
|
|
235
|
+
weight: row.weight ?? 0.5,
|
|
236
|
+
substrate: 'brain',
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
240
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
continue; // source node not in loaded set
|
|
250
|
-
edges.push({
|
|
251
|
-
source: sourceBrainNodeId,
|
|
252
|
-
target: `tasks:${row.task_id}`,
|
|
253
|
-
type: row.link_type,
|
|
254
|
-
weight: 0.7,
|
|
255
|
-
substrate: 'cross',
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
// brain_observations.files_modified_json: cross-substrate observation → nexus file
|
|
259
|
-
for (const row of obsRows) {
|
|
260
|
-
if (!row.files_modified_json)
|
|
261
|
-
continue;
|
|
262
|
-
let filePaths;
|
|
263
|
-
try {
|
|
264
|
-
filePaths = JSON.parse(row.files_modified_json);
|
|
265
|
-
}
|
|
266
|
-
catch {
|
|
267
|
-
continue;
|
|
268
|
-
}
|
|
269
|
-
if (!Array.isArray(filePaths))
|
|
270
|
-
continue;
|
|
271
|
-
const sourceBrainNodeId = `brain:${row.id}`;
|
|
272
|
-
for (const rawPath of filePaths) {
|
|
273
|
-
if (typeof rawPath !== 'string' || rawPath.length === 0)
|
|
274
|
-
continue;
|
|
241
|
+
// brain_memory_links: cross-substrate edges from typed memory nodes to tasks
|
|
242
|
+
const memLinkRows = allTyped(db.prepare(`SELECT memory_type, memory_id, task_id, link_type
|
|
243
|
+
FROM main.brain_memory_links`));
|
|
244
|
+
for (const row of memLinkRows) {
|
|
245
|
+
const sourceTypeId = `${row.memory_type}:${row.memory_id}`;
|
|
246
|
+
const sourceBrainNodeId = typeIdToBrainNodeId.get(sourceTypeId) ?? brainTypeIdToBrainNodeId(sourceTypeId);
|
|
247
|
+
if (!sourceBrainNodeId)
|
|
248
|
+
continue; // source node not in loaded set
|
|
275
249
|
edges.push({
|
|
276
250
|
source: sourceBrainNodeId,
|
|
277
|
-
target: `
|
|
278
|
-
type:
|
|
279
|
-
weight: 0.
|
|
251
|
+
target: `tasks:${row.task_id}`,
|
|
252
|
+
type: row.link_type,
|
|
253
|
+
weight: 0.7,
|
|
280
254
|
substrate: 'cross',
|
|
281
255
|
});
|
|
282
256
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
257
|
+
// brain_observations.files_modified_json: cross-substrate observation → nexus file
|
|
258
|
+
for (const row of obsRows) {
|
|
259
|
+
if (!row.files_modified_json)
|
|
260
|
+
continue;
|
|
261
|
+
let filePaths;
|
|
262
|
+
try {
|
|
263
|
+
filePaths = JSON.parse(row.files_modified_json);
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (!Array.isArray(filePaths))
|
|
269
|
+
continue;
|
|
270
|
+
const sourceBrainNodeId = `brain:${row.id}`;
|
|
271
|
+
for (const rawPath of filePaths) {
|
|
272
|
+
if (typeof rawPath !== 'string' || rawPath.length === 0)
|
|
273
|
+
continue;
|
|
274
|
+
edges.push({
|
|
275
|
+
source: sourceBrainNodeId,
|
|
276
|
+
target: `nexus:${rawPath}`,
|
|
277
|
+
type: 'modified_by',
|
|
278
|
+
weight: 0.6,
|
|
279
|
+
substrate: 'cross',
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
// Soft FK: brain_decisions.context_task_id → tasks (direct, not via page_edges)
|
|
284
|
+
// This handles decisions whose context_task_id may not yet appear in brain_page_edges.
|
|
285
|
+
for (const dec of decRows) {
|
|
286
|
+
if (dec.context_task_id) {
|
|
287
|
+
edges.push({
|
|
288
|
+
source: `brain:${dec.id}`,
|
|
289
|
+
target: `tasks:${dec.context_task_id}`,
|
|
290
|
+
type: 'applies_to',
|
|
291
|
+
weight: 0.8,
|
|
292
|
+
substrate: 'cross',
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
297
|
+
catch {
|
|
298
|
+
// Return partial results on error
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
301
|
return { nodes, edges };
|
|
302
302
|
}
|
|
303
303
|
//# sourceMappingURL=brain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain.js","sourceRoot":"","sources":["../../../src/adapters/brain.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"brain.js","sourceRoot":"","sources":["../../../src/adapters/brain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AA2DrE;;;;;;;;GAQG;AACH,SAAS,wBAAwB,CAAC,MAAc;IAC9C,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAChC,I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1B,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE,GAAG;wBACX,SAAS,EAAE,OAAO;qBACnB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,gFAAgF;YAChF,uFAAuF;YACvF,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;gBAC1B,IAAI,GAAG,CAAC,eAAe,EAAE,CAAC;oBACxB,KAAK,CAAC,IAAI,CAAC;wBACT,MAAM,EAAE,SAAS,GAAG,CAAC,EAAE,EAAE;wBACzB,MAAM,EAAE,SAAS,GAAG,CAAC,eAAe,EAAE;wBACtC,IAAI,EAAE,YAAY;wBAClB,MAAM,EAAE,GAAG;wBACX,SAAS,EAAE,OAAO;qBACnB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,kCAAkC;QACpC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CONDUIT substrate adapter for the Living Brain API.
|
|
3
3
|
*
|
|
4
|
-
* Queries
|
|
4
|
+
* Queries the project `cleo.db` (`conduit_messages`) and returns
|
|
5
|
+
* BrainNodes/BrainEdges for agent-to-agent messages.
|
|
5
6
|
* Each message becomes a node; `from_agent_id → to_agent_id` becomes an edge.
|
|
6
|
-
* Co-authoring agent pairs produce cross-substrate edges to
|
|
7
|
+
* Co-authoring agent pairs produce cross-substrate edges to AGENT-REGISTRY.
|
|
7
8
|
*
|
|
8
9
|
* Node IDs are prefixed with "conduit:" to prevent collisions.
|
|
9
10
|
*/
|
|
10
11
|
import type { BrainEdge, BrainNode, BrainQueryOptions } from '../types.js';
|
|
11
12
|
/**
|
|
12
|
-
* Returns all BrainNodes and BrainEdges sourced from
|
|
13
|
+
* Returns all BrainNodes and BrainEdges sourced from `conduit_messages`.
|
|
13
14
|
*
|
|
14
15
|
* Fetches the most recent messages (capped at perSubstrateLimit).
|
|
15
16
|
* Synthesizes agent→agent edges and cross-substrate agent references
|
|
16
|
-
* pointing to
|
|
17
|
+
* pointing to the agent registry.
|
|
17
18
|
*
|
|
18
19
|
* @param options - Query options (limit).
|
|
19
20
|
* @returns Nodes and edges from the CONDUIT substrate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conduit.d.ts","sourceRoot":"","sources":["../../../src/adapters/conduit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"conduit.d.ts","sourceRoot":"","sources":["../../../src/adapters/conduit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAa3E;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,iBAAsB,GAAG;IACpE,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB,CAqEA"}
|
|
@@ -1,94 +1,83 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CONDUIT substrate adapter for the Living Brain API.
|
|
3
3
|
*
|
|
4
|
-
* Queries
|
|
4
|
+
* Queries the project `cleo.db` (`conduit_messages`) and returns
|
|
5
|
+
* BrainNodes/BrainEdges for agent-to-agent messages.
|
|
5
6
|
* Each message becomes a node; `from_agent_id → to_agent_id` becomes an edge.
|
|
6
|
-
* Co-authoring agent pairs produce cross-substrate edges to
|
|
7
|
+
* Co-authoring agent pairs produce cross-substrate edges to AGENT-REGISTRY.
|
|
7
8
|
*
|
|
8
9
|
* Node IDs are prefixed with "conduit:" to prevent collisions.
|
|
9
10
|
*/
|
|
10
|
-
import { allTyped,
|
|
11
|
+
import { allTyped, readProjectStore } from '../db-connections.js';
|
|
11
12
|
import { resolveDefaultProjectContext } from '../project-context.js';
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Returns null when the value is not a finite positive number.
|
|
15
|
-
*
|
|
16
|
-
* @param epoch - UNIX timestamp in seconds.
|
|
17
|
-
* @returns ISO-8601 string or null.
|
|
18
|
-
*/
|
|
19
|
-
function epochToIso(epoch) {
|
|
20
|
-
if (!Number.isFinite(epoch) || epoch <= 0)
|
|
21
|
-
return null;
|
|
22
|
-
return new Date(epoch * 1000).toISOString();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns all BrainNodes and BrainEdges sourced from conduit.db.
|
|
14
|
+
* Returns all BrainNodes and BrainEdges sourced from `conduit_messages`.
|
|
26
15
|
*
|
|
27
16
|
* Fetches the most recent messages (capped at perSubstrateLimit).
|
|
28
17
|
* Synthesizes agent→agent edges and cross-substrate agent references
|
|
29
|
-
* pointing to
|
|
18
|
+
* pointing to the agent registry.
|
|
30
19
|
*
|
|
31
20
|
* @param options - Query options (limit).
|
|
32
21
|
* @returns Nodes and edges from the CONDUIT substrate.
|
|
33
22
|
*/
|
|
34
23
|
export function getConduitSubstrate(options = {}) {
|
|
35
24
|
const ctx = options.projectCtx ?? resolveDefaultProjectContext();
|
|
36
|
-
const db = getConduitDb(ctx);
|
|
37
|
-
if (!db)
|
|
38
|
-
return { nodes: [], edges: [] };
|
|
39
25
|
const perSubstrateLimit = Math.ceil((options.limit ?? 500) / 5);
|
|
40
26
|
const nodes = [];
|
|
41
27
|
const edges = [];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
readProjectStore(ctx, (db) => {
|
|
29
|
+
try {
|
|
30
|
+
// Most recent messages
|
|
31
|
+
const msgRows = allTyped(db.prepare(`SELECT id, content, from_agent_id, to_agent_id,
|
|
32
|
+
strftime('%Y-%m-%dT%H:%M:%S', created_at) AS created_at, conversation_id
|
|
33
|
+
FROM main.conduit_messages
|
|
46
34
|
ORDER BY created_at DESC
|
|
47
35
|
LIMIT ?`), perSubstrateLimit);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
36
|
+
const agentPairs = new Map();
|
|
37
|
+
for (const row of msgRows) {
|
|
38
|
+
// Message node — truncate content for label
|
|
39
|
+
const label = row.content.length > 80 ? `${row.content.slice(0, 80)}…` : row.content;
|
|
40
|
+
nodes.push({
|
|
41
|
+
id: `conduit:${row.id}`,
|
|
42
|
+
kind: 'message',
|
|
43
|
+
substrate: 'conduit',
|
|
44
|
+
label,
|
|
45
|
+
createdAt: row.created_at,
|
|
46
|
+
meta: {
|
|
47
|
+
from_agent_id: row.from_agent_id,
|
|
48
|
+
to_agent_id: row.to_agent_id,
|
|
49
|
+
conversation_id: row.conversation_id,
|
|
50
|
+
created_at: row.created_at,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
// Aggregate agent pairs for social-graph edges
|
|
54
|
+
if (row.from_agent_id && row.to_agent_id) {
|
|
55
|
+
const key = `${row.from_agent_id}→${row.to_agent_id}`;
|
|
56
|
+
const existing = agentPairs.get(key);
|
|
57
|
+
if (existing) {
|
|
58
|
+
existing.count++;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
agentPairs.set(key, { count: 1, from: row.from_agent_id, to: row.to_agent_id });
|
|
62
|
+
}
|
|
74
63
|
}
|
|
75
64
|
}
|
|
65
|
+
// Cross-substrate: agent social graph edges pointing to agent-registry nodes
|
|
66
|
+
for (const [, pair] of agentPairs) {
|
|
67
|
+
const weight = Math.min(1.0, pair.count / 10);
|
|
68
|
+
edges.push({
|
|
69
|
+
source: `agent-registry:${pair.from}`,
|
|
70
|
+
target: `agent-registry:${pair.to}`,
|
|
71
|
+
type: 'messages',
|
|
72
|
+
weight,
|
|
73
|
+
substrate: 'cross',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const weight = Math.min(1.0, pair.count / 10);
|
|
80
|
-
edges.push({
|
|
81
|
-
source: `agent-registry:${pair.from}`,
|
|
82
|
-
target: `agent-registry:${pair.to}`,
|
|
83
|
-
type: 'messages',
|
|
84
|
-
weight,
|
|
85
|
-
substrate: 'cross',
|
|
86
|
-
});
|
|
77
|
+
catch {
|
|
78
|
+
// Return partial results on error
|
|
87
79
|
}
|
|
88
|
-
}
|
|
89
|
-
catch {
|
|
90
|
-
// Return partial results on error
|
|
91
|
-
}
|
|
80
|
+
});
|
|
92
81
|
return { nodes, edges };
|
|
93
82
|
}
|
|
94
83
|
//# sourceMappingURL=conduit.js.map
|