memorix 0.1.3 → 0.1.5
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/cli/index.js
CHANGED
|
@@ -790,6 +790,9 @@ async function storeObservation(input) {
|
|
|
790
790
|
}
|
|
791
791
|
return observation;
|
|
792
792
|
}
|
|
793
|
+
function getObservation(id) {
|
|
794
|
+
return observations.find((o) => o.id === id);
|
|
795
|
+
}
|
|
793
796
|
async function reindexObservations() {
|
|
794
797
|
let count2 = 0;
|
|
795
798
|
for (const obs of observations) {
|
|
@@ -1047,8 +1050,29 @@ async function compactTimeline(anchorId, projectId, depthBefore = 3, depthAfter
|
|
|
1047
1050
|
const totalTokens = countTextTokens(formatted);
|
|
1048
1051
|
return { timeline, formatted, totalTokens };
|
|
1049
1052
|
}
|
|
1050
|
-
async function compactDetail(ids
|
|
1051
|
-
const documents =
|
|
1053
|
+
async function compactDetail(ids) {
|
|
1054
|
+
const documents = [];
|
|
1055
|
+
for (const id of ids) {
|
|
1056
|
+
const obs = getObservation(id);
|
|
1057
|
+
if (obs) {
|
|
1058
|
+
documents.push({
|
|
1059
|
+
id: `obs-${obs.id}`,
|
|
1060
|
+
observationId: obs.id,
|
|
1061
|
+
entityName: obs.entityName,
|
|
1062
|
+
type: obs.type,
|
|
1063
|
+
title: obs.title,
|
|
1064
|
+
narrative: obs.narrative,
|
|
1065
|
+
facts: obs.facts.join("\n"),
|
|
1066
|
+
filesModified: obs.filesModified.join("\n"),
|
|
1067
|
+
concepts: obs.concepts.join(", "),
|
|
1068
|
+
tokens: obs.tokens,
|
|
1069
|
+
createdAt: obs.createdAt,
|
|
1070
|
+
projectId: obs.projectId,
|
|
1071
|
+
accessCount: 0,
|
|
1072
|
+
lastAccessedAt: ""
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1052
1076
|
const formattedParts = documents.map(
|
|
1053
1077
|
(doc) => formatObservationDetail(doc)
|
|
1054
1078
|
);
|
|
@@ -1061,6 +1085,7 @@ var init_engine = __esm({
|
|
|
1061
1085
|
"use strict";
|
|
1062
1086
|
init_esm_shims();
|
|
1063
1087
|
init_orama_store();
|
|
1088
|
+
init_observations();
|
|
1064
1089
|
init_index_format();
|
|
1065
1090
|
init_token_budget();
|
|
1066
1091
|
}
|
|
@@ -2596,7 +2621,6 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
2596
2621
|
query,
|
|
2597
2622
|
limit,
|
|
2598
2623
|
type,
|
|
2599
|
-
projectId: project.id,
|
|
2600
2624
|
maxTokens
|
|
2601
2625
|
});
|
|
2602
2626
|
return {
|
|
@@ -2623,7 +2647,7 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
2623
2647
|
async ({ anchorId, depthBefore, depthAfter }) => {
|
|
2624
2648
|
const result = await compactTimeline(
|
|
2625
2649
|
anchorId,
|
|
2626
|
-
|
|
2650
|
+
void 0,
|
|
2627
2651
|
depthBefore,
|
|
2628
2652
|
depthAfter
|
|
2629
2653
|
);
|
|
@@ -2647,7 +2671,7 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
2647
2671
|
}
|
|
2648
2672
|
},
|
|
2649
2673
|
async ({ ids }) => {
|
|
2650
|
-
const result = await compactDetail(ids
|
|
2674
|
+
const result = await compactDetail(ids);
|
|
2651
2675
|
return {
|
|
2652
2676
|
content: [
|
|
2653
2677
|
{
|
|
@@ -2671,7 +2695,7 @@ Entity: ${entityName} | Type: ${type} | Project: ${project.id}${enrichment}`
|
|
|
2671
2695
|
const database = await (await Promise.resolve().then(() => (init_orama_store(), orama_store_exports))).getDb();
|
|
2672
2696
|
const allResults = await search2(database, {
|
|
2673
2697
|
term: "",
|
|
2674
|
-
where: {
|
|
2698
|
+
where: {},
|
|
2675
2699
|
limit: 1e4
|
|
2676
2700
|
});
|
|
2677
2701
|
const docs = allResults.hits.map((h) => h.document);
|