@pi-unipi/memory 0.1.0 → 0.1.2
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/index.ts +58 -0
- package/package.json +9 -4
package/index.ts
CHANGED
|
@@ -14,6 +14,12 @@ import {
|
|
|
14
14
|
emitEvent,
|
|
15
15
|
getPackageVersion,
|
|
16
16
|
} from "@unipi/core";
|
|
17
|
+
|
|
18
|
+
// Get info registry from global (avoids direct import issues with pi's extension loading)
|
|
19
|
+
function getInfoRegistry() {
|
|
20
|
+
const g = globalThis as any;
|
|
21
|
+
return g.__unipi_info_registry;
|
|
22
|
+
}
|
|
17
23
|
import {
|
|
18
24
|
MemoryStorage,
|
|
19
25
|
getProjectName,
|
|
@@ -82,6 +88,58 @@ export default function (pi: ExtensionAPI) {
|
|
|
82
88
|
],
|
|
83
89
|
});
|
|
84
90
|
|
|
91
|
+
// Register info group
|
|
92
|
+
const registry = getInfoRegistry();
|
|
93
|
+
if (registry) {
|
|
94
|
+
console.debug("[memory] Registering info group");
|
|
95
|
+
registry.registerGroup({
|
|
96
|
+
id: "memory",
|
|
97
|
+
name: "Memory",
|
|
98
|
+
icon: "🧠",
|
|
99
|
+
priority: 60,
|
|
100
|
+
config: {
|
|
101
|
+
showByDefault: true,
|
|
102
|
+
stats: [
|
|
103
|
+
{ id: "projectCount", label: "Project Memories", show: true },
|
|
104
|
+
{ id: "totalCount", label: "Total Memories", show: true },
|
|
105
|
+
{ id: "projects", label: "Projects", show: true },
|
|
106
|
+
{ id: "recent", label: "Recent Memories", show: true },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
dataProvider: async () => {
|
|
110
|
+
if (!projectStorage) {
|
|
111
|
+
return {
|
|
112
|
+
projectCount: { value: "0" },
|
|
113
|
+
totalCount: { value: "0" },
|
|
114
|
+
projects: { value: "none" },
|
|
115
|
+
recent: { value: "none" },
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const projectMemories = projectStorage.listAll();
|
|
120
|
+
const allMemories = listAllProjects();
|
|
121
|
+
const uniqueProjects = [...new Set(allMemories.map((m) => m.project))];
|
|
122
|
+
|
|
123
|
+
// Get 3 most recent memories (sorted by updated DESC in listAll)
|
|
124
|
+
const recentMemories = projectMemories.slice(0, 3);
|
|
125
|
+
const recentList = recentMemories.map(m => m.title).join("\n");
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
projectCount: { value: String(projectMemories.length) },
|
|
129
|
+
totalCount: { value: String(allMemories.length) },
|
|
130
|
+
projects: {
|
|
131
|
+
value: uniqueProjects.length.toString(),
|
|
132
|
+
detail: uniqueProjects.slice(0, 5).join(", ") + (uniqueProjects.length > 5 ? ` +${uniqueProjects.length - 5} more` : ""),
|
|
133
|
+
},
|
|
134
|
+
recent: {
|
|
135
|
+
value: recentMemories.length > 0 ? recentMemories[0].title : "none",
|
|
136
|
+
detail: recentMemories.length > 1 ? recentMemories.slice(1).map(m => m.title).join("\n") : undefined,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
85
143
|
// Show memory status in UI
|
|
86
144
|
if (ctx.hasUI) {
|
|
87
145
|
const projectCount = projectStorage.listAll().length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Persistent cross-session memory with vector search for Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,8 +24,12 @@
|
|
|
24
24
|
"sqlite-vec"
|
|
25
25
|
],
|
|
26
26
|
"pi": {
|
|
27
|
-
"extensions": [
|
|
28
|
-
|
|
27
|
+
"extensions": [
|
|
28
|
+
"index.ts"
|
|
29
|
+
],
|
|
30
|
+
"skills": [
|
|
31
|
+
"skills"
|
|
32
|
+
]
|
|
29
33
|
},
|
|
30
34
|
"files": [
|
|
31
35
|
"index.ts",
|
|
@@ -41,7 +45,8 @@
|
|
|
41
45
|
"better-sqlite3": "^12.9.0",
|
|
42
46
|
"sqlite-vec": "^0.1.9",
|
|
43
47
|
"js-yaml": "^4.1.0",
|
|
44
|
-
"@unipi/core": "*"
|
|
48
|
+
"@unipi/core": "*",
|
|
49
|
+
"@pi-unipi/info-screen": "*"
|
|
45
50
|
},
|
|
46
51
|
"peerDependencies": {
|
|
47
52
|
"@mariozechner/pi-coding-agent": "*",
|