@nandoblanco/opencode-local-memory 1.1.1 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nandoblanco/opencode-local-memory",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -10,19 +10,28 @@
10
10
  "exports": {
11
11
  ".": "./index.js",
12
12
  "./server": "./index.js",
13
- "./tui": "./tui.ts"
13
+ "./tui": "./tui.ts",
14
+ "./rpc": "./rpc.js",
15
+ "./gui-experimental": "./dist/gui-experimental.cjs"
14
16
  },
15
17
  "bin": {
16
18
  "opencode-local-memory": "index.js"
17
19
  },
18
20
  "files": [
19
21
  "index.js",
22
+ "rpc.js",
23
+ "rpc.d.ts",
20
24
  "tui.ts",
25
+ "gui.tsx",
26
+ "gui.css",
27
+ "dist/gui-experimental.cjs",
21
28
  "assets/screenshot.png",
22
29
  "README.md",
30
+ "CHANGELOG.md",
23
31
  "LICENSE"
24
32
  ],
25
33
  "scripts": {
34
+ "build:gui": "vite build",
26
35
  "test": "node --no-warnings --test test/memory.test.js"
27
36
  },
28
37
  "sideEffects": false,
@@ -41,7 +50,8 @@
41
50
  "transformers"
42
51
  ],
43
52
  "dependencies": {
44
- "@xenova/transformers": "^2.17.2"
53
+ "@huggingface/transformers": "^4.3.2",
54
+ "onnxruntime-common": "1.30.0"
45
55
  },
46
56
  "peerDependencies": {
47
57
  "@opencode-ai/plugin": ">=2.0.0",
@@ -63,10 +73,21 @@
63
73
  "optional": true
64
74
  }
65
75
  },
76
+ "overrides": {
77
+ "glob": "14.0.5",
78
+ "minimatch": "11.0.8"
79
+ },
66
80
  "author": "nandoblanco",
67
81
  "license": "MIT",
68
82
  "repository": {
69
83
  "type": "git",
70
84
  "url": "git+https://github.com/nandoblanco/opencode-local-memory.git"
85
+ },
86
+ "devDependencies": {
87
+ "@opencode/plugin": "^2.2.5",
88
+ "@opencode/theme": "^2.2.5",
89
+ "solid-js": "^1.9.18",
90
+ "vite": "^8.3.5",
91
+ "vite-plugin-solid": "^2.11.15"
71
92
  }
72
93
  }
package/rpc.d.ts ADDED
@@ -0,0 +1,140 @@
1
+ import type { JsonSchema, Rpc } from "@opencode/plugin/rpc";
2
+
3
+ export type MemoryTypeFilter = "all" | "core" | "topics" | "sessions";
4
+ export type MemoryModeFilter = "hybrid" | "keyword" | "regex";
5
+
6
+ export interface MemoryRpcEntry {
7
+ id: string;
8
+ date: string;
9
+ file: string;
10
+ tags: string;
11
+ fact: string;
12
+ project?: string;
13
+ core?: boolean;
14
+ }
15
+
16
+ export interface MemoryRpcHit {
17
+ score: number;
18
+ semanticScore: number;
19
+ entry: MemoryRpcEntry;
20
+ }
21
+
22
+ export interface MemoryRpcQueryInput {
23
+ query?: string;
24
+ typeFilter?: MemoryTypeFilter;
25
+ topicFilter?: string;
26
+ mode?: MemoryModeFilter;
27
+ projectFilter?: string;
28
+ coreOnly?: boolean;
29
+ limit?: number;
30
+ }
31
+
32
+ export interface MemoryRpcQueryOutput {
33
+ rootDir: string;
34
+ totalEntries: number;
35
+ coreCount: number;
36
+ topicsCount: number;
37
+ sessionsCount: number;
38
+ topics: string[];
39
+ projects: string[];
40
+ hits: MemoryRpcHit[];
41
+ }
42
+
43
+ export interface MemoryRpcStoreInput {
44
+ id?: string;
45
+ topic: string;
46
+ tags: string;
47
+ fact: string;
48
+ project?: string;
49
+ core?: boolean;
50
+ supersedes?: string;
51
+ }
52
+
53
+ export interface MemoryRpcStoreOutput {
54
+ entry: {
55
+ id: string;
56
+ date: string;
57
+ file: string;
58
+ tags: string;
59
+ fact: string;
60
+ project: string;
61
+ core: boolean;
62
+ updated: boolean;
63
+ superseded: string[];
64
+ };
65
+ }
66
+
67
+ export interface MemoryRpcRemoveInput {
68
+ id: string;
69
+ }
70
+
71
+ export interface MemoryRpcRemoveOutput {
72
+ deleted: Array<{ id: string; file: string }>;
73
+ notFound: string[];
74
+ total: number;
75
+ }
76
+
77
+ export interface MemoryRpcSyncInput {}
78
+
79
+ export interface MemoryRpcSyncOutput {
80
+ total: number;
81
+ embedded: number;
82
+ reused: number;
83
+ vecFile: string;
84
+ }
85
+
86
+ export interface MemoryRpcImportInput {
87
+ limit?: number;
88
+ }
89
+
90
+ export interface MemoryRpcImportOutput {
91
+ importedFactsCount: number;
92
+ skippedFacts: number;
93
+ importedSessionsCount: number;
94
+ skippedSessions: number;
95
+ total: number;
96
+ }
97
+
98
+ export interface MemoryRpcSessionMarkdownInput {
99
+ file: string;
100
+ }
101
+
102
+ export interface MemoryRpcSessionMarkdownOutput {
103
+ file: string;
104
+ markdown: string;
105
+ }
106
+
107
+ type SchemaFor<T> = JsonSchema.JsonSchema & { readonly __type?: T };
108
+
109
+ export declare const MemoryRpc: Rpc.Definition<
110
+ "opencode-local-memory",
111
+ {
112
+ query: {
113
+ input: SchemaFor<MemoryRpcQueryInput>;
114
+ output: SchemaFor<MemoryRpcQueryOutput>;
115
+ };
116
+ store: {
117
+ input: SchemaFor<MemoryRpcStoreInput>;
118
+ output: SchemaFor<MemoryRpcStoreOutput>;
119
+ };
120
+ remove: {
121
+ input: SchemaFor<MemoryRpcRemoveInput>;
122
+ output: SchemaFor<MemoryRpcRemoveOutput>;
123
+ };
124
+ sync: {
125
+ input: SchemaFor<MemoryRpcSyncInput>;
126
+ output: SchemaFor<MemoryRpcSyncOutput>;
127
+ };
128
+ importMemory: {
129
+ input: SchemaFor<MemoryRpcImportInput>;
130
+ output: SchemaFor<MemoryRpcImportOutput>;
131
+ };
132
+ getSessionMarkdown: {
133
+ input: SchemaFor<MemoryRpcSessionMarkdownInput>;
134
+ output: SchemaFor<MemoryRpcSessionMarkdownOutput>;
135
+ };
136
+ },
137
+ Record<never, never>
138
+ >;
139
+
140
+ export default MemoryRpc;
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;