@nandoblanco/opencode-local-memory 1.1.0 → 1.2.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/README.md +31 -10
- package/dist/gui-experimental.cjs +1 -0
- package/gui.css +635 -0
- package/gui.tsx +1314 -0
- package/index.js +333 -6
- package/package.json +23 -3
- package/rpc.d.ts +140 -0
- package/rpc.js +221 -0
- package/tui.ts +970 -265
package/rpc.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
const DRAFT_2020_12 = "https://json-schema.org/draft/2020-12/schema";
|
|
2
|
+
|
|
3
|
+
const memoryEntrySchema = {
|
|
4
|
+
type: "object",
|
|
5
|
+
properties: {
|
|
6
|
+
id: { type: "string" },
|
|
7
|
+
date: { type: "string" },
|
|
8
|
+
file: { type: "string" },
|
|
9
|
+
tags: { type: "string" },
|
|
10
|
+
fact: { type: "string" },
|
|
11
|
+
project: { type: "string" },
|
|
12
|
+
core: { type: "boolean" },
|
|
13
|
+
},
|
|
14
|
+
required: ["id", "date", "file", "tags", "fact"],
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const memoryHitSchema = {
|
|
19
|
+
type: "object",
|
|
20
|
+
properties: {
|
|
21
|
+
score: { type: "number" },
|
|
22
|
+
semanticScore: { type: "number" },
|
|
23
|
+
entry: memoryEntrySchema,
|
|
24
|
+
},
|
|
25
|
+
required: ["score", "semanticScore", "entry"],
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const MemoryRpc = {
|
|
30
|
+
id: "opencode-local-memory",
|
|
31
|
+
methods: {
|
|
32
|
+
query: {
|
|
33
|
+
input: {
|
|
34
|
+
$schema: DRAFT_2020_12,
|
|
35
|
+
type: "object",
|
|
36
|
+
properties: {
|
|
37
|
+
query: { type: "string" },
|
|
38
|
+
typeFilter: { type: "string", enum: ["all", "core", "topics", "sessions"] },
|
|
39
|
+
topicFilter: { type: "string" },
|
|
40
|
+
mode: { type: "string", enum: ["hybrid", "keyword", "regex"] },
|
|
41
|
+
projectFilter: { type: "string" },
|
|
42
|
+
coreOnly: { type: "boolean" },
|
|
43
|
+
limit: { type: "number" },
|
|
44
|
+
},
|
|
45
|
+
additionalProperties: false,
|
|
46
|
+
},
|
|
47
|
+
output: {
|
|
48
|
+
$schema: DRAFT_2020_12,
|
|
49
|
+
type: "object",
|
|
50
|
+
properties: {
|
|
51
|
+
rootDir: { type: "string" },
|
|
52
|
+
totalEntries: { type: "number" },
|
|
53
|
+
coreCount: { type: "number" },
|
|
54
|
+
topicsCount: { type: "number" },
|
|
55
|
+
sessionsCount: { type: "number" },
|
|
56
|
+
topics: { type: "array", items: { type: "string" } },
|
|
57
|
+
projects: { type: "array", items: { type: "string" } },
|
|
58
|
+
hits: { type: "array", items: memoryHitSchema },
|
|
59
|
+
},
|
|
60
|
+
required: [
|
|
61
|
+
"rootDir",
|
|
62
|
+
"totalEntries",
|
|
63
|
+
"coreCount",
|
|
64
|
+
"topicsCount",
|
|
65
|
+
"sessionsCount",
|
|
66
|
+
"topics",
|
|
67
|
+
"projects",
|
|
68
|
+
"hits",
|
|
69
|
+
],
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
store: {
|
|
74
|
+
input: {
|
|
75
|
+
$schema: DRAFT_2020_12,
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {
|
|
78
|
+
id: { type: "string" },
|
|
79
|
+
topic: { type: "string" },
|
|
80
|
+
tags: { type: "string" },
|
|
81
|
+
fact: { type: "string" },
|
|
82
|
+
project: { type: "string" },
|
|
83
|
+
core: { type: "boolean" },
|
|
84
|
+
supersedes: { type: "string" },
|
|
85
|
+
},
|
|
86
|
+
required: ["topic", "tags", "fact"],
|
|
87
|
+
additionalProperties: false,
|
|
88
|
+
},
|
|
89
|
+
output: {
|
|
90
|
+
$schema: DRAFT_2020_12,
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
entry: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
id: { type: "string" },
|
|
97
|
+
date: { type: "string" },
|
|
98
|
+
file: { type: "string" },
|
|
99
|
+
tags: { type: "string" },
|
|
100
|
+
fact: { type: "string" },
|
|
101
|
+
project: { type: "string" },
|
|
102
|
+
core: { type: "boolean" },
|
|
103
|
+
updated: { type: "boolean" },
|
|
104
|
+
superseded: { type: "array", items: { type: "string" } },
|
|
105
|
+
},
|
|
106
|
+
required: ["id", "date", "file", "tags", "fact", "project", "core", "updated", "superseded"],
|
|
107
|
+
additionalProperties: false,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
required: ["entry"],
|
|
111
|
+
additionalProperties: false,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
remove: {
|
|
115
|
+
input: {
|
|
116
|
+
$schema: DRAFT_2020_12,
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
id: { type: "string" },
|
|
120
|
+
},
|
|
121
|
+
required: ["id"],
|
|
122
|
+
additionalProperties: false,
|
|
123
|
+
},
|
|
124
|
+
output: {
|
|
125
|
+
$schema: DRAFT_2020_12,
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
deleted: {
|
|
129
|
+
type: "array",
|
|
130
|
+
items: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
id: { type: "string" },
|
|
134
|
+
file: { type: "string" },
|
|
135
|
+
},
|
|
136
|
+
required: ["id", "file"],
|
|
137
|
+
additionalProperties: false,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
notFound: { type: "array", items: { type: "string" } },
|
|
141
|
+
total: { type: "number" },
|
|
142
|
+
},
|
|
143
|
+
required: ["deleted", "notFound", "total"],
|
|
144
|
+
additionalProperties: false,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
sync: {
|
|
148
|
+
input: {
|
|
149
|
+
$schema: DRAFT_2020_12,
|
|
150
|
+
type: "object",
|
|
151
|
+
properties: {},
|
|
152
|
+
additionalProperties: false,
|
|
153
|
+
},
|
|
154
|
+
output: {
|
|
155
|
+
$schema: DRAFT_2020_12,
|
|
156
|
+
type: "object",
|
|
157
|
+
properties: {
|
|
158
|
+
total: { type: "number" },
|
|
159
|
+
embedded: { type: "number" },
|
|
160
|
+
reused: { type: "number" },
|
|
161
|
+
vecFile: { type: "string" },
|
|
162
|
+
},
|
|
163
|
+
required: ["total", "embedded", "reused", "vecFile"],
|
|
164
|
+
additionalProperties: false,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
importMemory: {
|
|
168
|
+
input: {
|
|
169
|
+
$schema: DRAFT_2020_12,
|
|
170
|
+
type: "object",
|
|
171
|
+
properties: {
|
|
172
|
+
limit: { type: "number" },
|
|
173
|
+
},
|
|
174
|
+
additionalProperties: false,
|
|
175
|
+
},
|
|
176
|
+
output: {
|
|
177
|
+
$schema: DRAFT_2020_12,
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
importedFactsCount: { type: "number" },
|
|
181
|
+
skippedFacts: { type: "number" },
|
|
182
|
+
importedSessionsCount: { type: "number" },
|
|
183
|
+
skippedSessions: { type: "number" },
|
|
184
|
+
total: { type: "number" },
|
|
185
|
+
},
|
|
186
|
+
required: [
|
|
187
|
+
"importedFactsCount",
|
|
188
|
+
"skippedFacts",
|
|
189
|
+
"importedSessionsCount",
|
|
190
|
+
"skippedSessions",
|
|
191
|
+
"total",
|
|
192
|
+
],
|
|
193
|
+
additionalProperties: false,
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
getSessionMarkdown: {
|
|
197
|
+
input: {
|
|
198
|
+
$schema: DRAFT_2020_12,
|
|
199
|
+
type: "object",
|
|
200
|
+
properties: {
|
|
201
|
+
file: { type: "string" },
|
|
202
|
+
},
|
|
203
|
+
required: ["file"],
|
|
204
|
+
additionalProperties: false,
|
|
205
|
+
},
|
|
206
|
+
output: {
|
|
207
|
+
$schema: DRAFT_2020_12,
|
|
208
|
+
type: "object",
|
|
209
|
+
properties: {
|
|
210
|
+
file: { type: "string" },
|
|
211
|
+
markdown: { type: "string" },
|
|
212
|
+
},
|
|
213
|
+
required: ["file", "markdown"],
|
|
214
|
+
additionalProperties: false,
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
events: {},
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
export default MemoryRpc;
|