jfl 0.9.13 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/context-hub.d.ts.map +1 -1
- package/dist/commands/context-hub.js +50 -3
- package/dist/commands/context-hub.js.map +1 -1
- package/dist/commands/init-from-service.d.ts.map +1 -1
- package/dist/commands/init-from-service.js +2 -3
- package/dist/commands/init-from-service.js.map +1 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +3 -189
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/repair.d.ts.map +1 -1
- package/dist/commands/repair.js +8 -21
- package/dist/commands/repair.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +0 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/gtm-generator.js +5 -16
- package/dist/lib/gtm-generator.js.map +1 -1
- package/dist/lib/memory-db.d.ts +1 -1
- package/dist/lib/memory-db.d.ts.map +1 -1
- package/package.json +1 -1
- package/packages/pi/dist/memory-tool.d.ts.map +1 -1
- package/packages/pi/dist/memory-tool.js +23 -9
- package/packages/pi/dist/memory-tool.js.map +1 -1
- package/packages/pi/extensions/memory-tool.ts +26 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-hub.d.ts","sourceRoot":"","sources":["../../src/commands/context-hub.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"context-hub.d.ts","sourceRoot":"","sources":["../../src/commands/context-hub.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA42FH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAiBjF;AAkMD,wBAAsB,qBAAqB,CAAC,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAiHxF;AAMD,wBAAsB,iBAAiB,CACrC,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAO,iBA8lBzF"}
|
|
@@ -14,7 +14,7 @@ import * as path from "path";
|
|
|
14
14
|
import * as http from "http";
|
|
15
15
|
import { homedir } from "os";
|
|
16
16
|
import { fileURLToPath } from "url";
|
|
17
|
-
import { initializeDatabase, getMemoryStats, insertMemory } from "../lib/memory-db.js";
|
|
17
|
+
import { initializeDatabase, getMemoryStats, insertMemory, getLinksFrom, getLinksTo, getMemoriesByIds, addLink, } from "../lib/memory-db.js";
|
|
18
18
|
import { searchMemories } from "../lib/memory-search.js";
|
|
19
19
|
import { indexJournalEntries, startPeriodicIndexing, backfillEmbeddings, indexCodeHeaders } from "../lib/memory-indexer.js";
|
|
20
20
|
import { getProjectPort } from "../utils/context-hub-port.js";
|
|
@@ -988,6 +988,7 @@ function createServer(projectRoot, port, eventBus, flowEngine) {
|
|
|
988
988
|
}
|
|
989
989
|
const raw = await searchMemories(query, { type, maxItems, since });
|
|
990
990
|
const results = raw.map(r => ({
|
|
991
|
+
id: r.memory.id,
|
|
991
992
|
title: r.memory.title,
|
|
992
993
|
content: r.memory.content,
|
|
993
994
|
summary: r.memory.summary,
|
|
@@ -997,8 +998,45 @@ function createServer(projectRoot, port, eventBus, flowEngine) {
|
|
|
997
998
|
score: r.score,
|
|
998
999
|
relevance: r.relevance,
|
|
999
1000
|
}));
|
|
1001
|
+
// Surface linked memories (teacup ↔ insight connections)
|
|
1002
|
+
const linkedResults = [];
|
|
1003
|
+
for (const r of results) {
|
|
1004
|
+
if (r.id) {
|
|
1005
|
+
try {
|
|
1006
|
+
const linksFrom = await getLinksFrom(r.id);
|
|
1007
|
+
const linksTo = await getLinksTo(r.id);
|
|
1008
|
+
const linkedIds = [
|
|
1009
|
+
...linksFrom.map(l => l.to_memory_id),
|
|
1010
|
+
...linksTo.map(l => l.from_memory_id)
|
|
1011
|
+
].filter(id => !results.some(existing => existing.id === id));
|
|
1012
|
+
for (const linkedId of linkedIds.slice(0, 3)) {
|
|
1013
|
+
try {
|
|
1014
|
+
const [linked] = await getMemoriesByIds([linkedId]);
|
|
1015
|
+
if (linked) {
|
|
1016
|
+
const linkType = linksFrom.find(l => l.to_memory_id === linkedId)?.link_type
|
|
1017
|
+
|| linksTo.find(l => l.from_memory_id === linkedId)?.link_type
|
|
1018
|
+
|| 'related_to';
|
|
1019
|
+
linkedResults.push({
|
|
1020
|
+
id: linked.id,
|
|
1021
|
+
title: `🔗 ${linkType === 'leads_to' ? '🫖→' : '←🫖'} ${linked.title}`,
|
|
1022
|
+
content: linked.content,
|
|
1023
|
+
summary: linked.summary,
|
|
1024
|
+
type: linked.type,
|
|
1025
|
+
source: linked.source,
|
|
1026
|
+
ts: linked.created_at,
|
|
1027
|
+
score: r.score * 0.8,
|
|
1028
|
+
relevance: 'medium',
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
catch { /* skip broken links */ }
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
catch { /* links optional */ }
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1000
1038
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
1001
|
-
res.end(JSON.stringify({ results }));
|
|
1039
|
+
res.end(JSON.stringify({ results: [...results, ...linkedResults] }));
|
|
1002
1040
|
}
|
|
1003
1041
|
catch (err) {
|
|
1004
1042
|
res.writeHead(500, { "Content-Type": "application/json" });
|
|
@@ -1026,7 +1064,7 @@ function createServer(projectRoot, port, eventBus, flowEngine) {
|
|
|
1026
1064
|
req.on("data", chunk => body += chunk);
|
|
1027
1065
|
req.on("end", async () => {
|
|
1028
1066
|
try {
|
|
1029
|
-
const { title, content, tags } = JSON.parse(body || "{}");
|
|
1067
|
+
const { title, content, tags, type, linked_to } = JSON.parse(body || "{}");
|
|
1030
1068
|
if (!title || !content) {
|
|
1031
1069
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
1032
1070
|
res.end(JSON.stringify({ error: "title and content required" }));
|
|
@@ -1034,10 +1072,19 @@ function createServer(projectRoot, port, eventBus, flowEngine) {
|
|
|
1034
1072
|
}
|
|
1035
1073
|
const id = await insertMemory({
|
|
1036
1074
|
source: 'manual',
|
|
1075
|
+
type: type || undefined,
|
|
1037
1076
|
title,
|
|
1038
1077
|
content,
|
|
1039
1078
|
created_at: new Date().toISOString()
|
|
1040
1079
|
});
|
|
1080
|
+
// If this teacup/insight links to another memory, create the link
|
|
1081
|
+
if (linked_to && typeof linked_to === 'number') {
|
|
1082
|
+
try {
|
|
1083
|
+
const linkType = type === 'teacup' ? 'leads_to' : 'related_to';
|
|
1084
|
+
await addLink(id, linked_to, linkType);
|
|
1085
|
+
}
|
|
1086
|
+
catch { /* link is optional, don't fail the add */ }
|
|
1087
|
+
}
|
|
1041
1088
|
res.writeHead(201, { "Content-Type": "application/json" });
|
|
1042
1089
|
res.end(JSON.stringify({ id }));
|
|
1043
1090
|
}
|