@mingxy/cerebro 2.1.9 → 2.2.1
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 +1 -1
- package/src/config.ts +6 -0
- package/src/hooks.ts +6 -3
- package/web/assets/{index-C_WsfcNQ.js → index-Bw5luP_E.js} +77 -77
- package/web/index.html +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingxy/cerebro",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Cerebro persistent memory plugin for OpenCode — auto-recall, auto-capture, 9 memory tools with clustering, project-scoped memory isolation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/config.ts
CHANGED
|
@@ -20,6 +20,9 @@ export interface CerebroPluginConfig {
|
|
|
20
20
|
searchCount: number;
|
|
21
21
|
recentTruncateChars: number;
|
|
22
22
|
searchTruncateChars: number;
|
|
23
|
+
recentTimeoutMs: number;
|
|
24
|
+
searchTimeoutMs: number;
|
|
25
|
+
profileTimeoutMs: number;
|
|
23
26
|
};
|
|
24
27
|
ingest: {
|
|
25
28
|
autoCaptureThreshold: number;
|
|
@@ -60,6 +63,9 @@ const DEFAULTS: CerebroPluginConfig = {
|
|
|
60
63
|
searchCount: 10,
|
|
61
64
|
recentTruncateChars: 0, // 0 = 不截断
|
|
62
65
|
searchTruncateChars: 0, // 0 = 不截断
|
|
66
|
+
recentTimeoutMs: 3000,
|
|
67
|
+
searchTimeoutMs: 5000,
|
|
68
|
+
profileTimeoutMs: 2000,
|
|
63
69
|
},
|
|
64
70
|
ingest: {
|
|
65
71
|
autoCaptureThreshold: 5,
|
package/src/hooks.ts
CHANGED
|
@@ -255,20 +255,23 @@ export async function buildMemoryInjection(
|
|
|
255
255
|
const searchCount = ic.searchCount || DEFAULTS.injection.searchCount;
|
|
256
256
|
const recentTruncate = ic.recentTruncateChars || 0; // 0 = 不截断
|
|
257
257
|
const searchTruncate = ic.searchTruncateChars || 0; // 0 = 不截断
|
|
258
|
+
const profileTimeout = ic.profileTimeoutMs || DEFAULTS.injection.profileTimeoutMs;
|
|
259
|
+
const recentTimeout = ic.recentTimeoutMs || DEFAULTS.injection.recentTimeoutMs;
|
|
260
|
+
const searchTimeout = ic.searchTimeoutMs || DEFAULTS.injection.searchTimeoutMs;
|
|
258
261
|
|
|
259
262
|
const [profile, projectMemories, searchResults] = await Promise.all([
|
|
260
263
|
Promise.race([
|
|
261
264
|
client.getInjection(),
|
|
262
|
-
new Promise<null>((resolve) => setTimeout(() => resolve(null),
|
|
265
|
+
new Promise<null>((resolve) => setTimeout(() => resolve(null), profileTimeout)),
|
|
263
266
|
]).catch(() => null),
|
|
264
267
|
Promise.race([
|
|
265
268
|
client.listRecent(recentCount, projectPath),
|
|
266
|
-
new Promise<never[]>((resolve) => setTimeout(() => resolve([]),
|
|
269
|
+
new Promise<never[]>((resolve) => setTimeout(() => resolve([]), recentTimeout)),
|
|
267
270
|
]).catch(() => []),
|
|
268
271
|
query
|
|
269
272
|
? Promise.race([
|
|
270
273
|
client.searchMemories(query, searchCount, undefined, undefined, projectPath),
|
|
271
|
-
new Promise<never[]>((resolve) => setTimeout(() => resolve([]),
|
|
274
|
+
new Promise<never[]>((resolve) => setTimeout(() => resolve([]), searchTimeout)),
|
|
272
275
|
]).catch(() => [])
|
|
273
276
|
: Promise.resolve([]),
|
|
274
277
|
]);
|