@mingxy/cerebro 2.0.1 → 2.0.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/package.json +1 -1
- package/src/hooks.ts +9 -5
- package/src/index.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mingxy/cerebro",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
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/hooks.ts
CHANGED
|
@@ -120,13 +120,17 @@ async function detectProjectName(rootPath: string): Promise<string | undefined>
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
export function showToast(tui: any, title: string, message: string, variant: string = "info", delayMs?: number) {
|
|
123
|
-
if (!tui)
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
if (!tui?.showToast) {
|
|
124
|
+
logDebug("showToast: tui or tui.showToast unavailable");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const defaultDelay = 1000;
|
|
128
|
+
const effectiveDelay = delayMs ?? defaultDelay;
|
|
129
|
+
setTimeout(async () => {
|
|
126
130
|
try {
|
|
127
|
-
tui.showToast({ body: { title, message, variant, duration: 5000 } });
|
|
131
|
+
await tui.showToast({ body: { title, message, variant, duration: 5000 } });
|
|
128
132
|
} catch (err) {
|
|
129
|
-
logErr("showToast failed", { error: String(err) });
|
|
133
|
+
logErr("showToast failed", { error: String(err), title });
|
|
130
134
|
}
|
|
131
135
|
}, effectiveDelay);
|
|
132
136
|
}
|
package/src/index.ts
CHANGED
|
@@ -61,7 +61,9 @@ const OmemPlugin: Plugin = async (input) => {
|
|
|
61
61
|
// even if client.tui isn't ready yet at plugin init time
|
|
62
62
|
const tui = new Proxy({} as any, {
|
|
63
63
|
get(_, prop) {
|
|
64
|
-
|
|
64
|
+
const realTui = (client as any)?.tui;
|
|
65
|
+
const val = realTui?.[prop];
|
|
66
|
+
return typeof val === "function" ? val.bind(realTui) : val;
|
|
65
67
|
},
|
|
66
68
|
});
|
|
67
69
|
|
|
@@ -74,7 +76,7 @@ const OmemPlugin: Plugin = async (input) => {
|
|
|
74
76
|
} catch {}
|
|
75
77
|
|
|
76
78
|
const config = loadPluginConfig(overrides as any);
|
|
77
|
-
const STARTUP_DELAY =
|
|
79
|
+
const STARTUP_DELAY = 5000;
|
|
78
80
|
|
|
79
81
|
setOpencodeClient(client);
|
|
80
82
|
|