@mingxy/cerebro 1.6.5 → 1.6.7
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 +3 -1
- package/src/index.ts +13 -3
- package/src/tui.tsx +6 -7
package/package.json
CHANGED
package/src/hooks.ts
CHANGED
|
@@ -8,7 +8,9 @@ function showToast(tui: any, title: string, message: string, variant: string = "
|
|
|
8
8
|
setTimeout(() => {
|
|
9
9
|
try {
|
|
10
10
|
tui.showToast({ body: { title, message, variant, duration: 5000 } });
|
|
11
|
-
} catch {
|
|
11
|
+
} catch (err) {
|
|
12
|
+
console.error("[cerebro] showToast failed:", err);
|
|
13
|
+
}
|
|
12
14
|
}, delayMs);
|
|
13
15
|
}
|
|
14
16
|
|
package/src/index.ts
CHANGED
|
@@ -39,14 +39,24 @@ function showToast(tui: any, title: string, message?: string, variant: string =
|
|
|
39
39
|
if (!tui) return;
|
|
40
40
|
setTimeout(() => {
|
|
41
41
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
const body: any = { title, variant, duration };
|
|
43
|
+
if (message) body.message = message;
|
|
44
|
+
tui.showToast({ body });
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error("[cerebro] showToast failed:", err);
|
|
47
|
+
}
|
|
44
48
|
}, 3000);
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
const OmemPlugin: Plugin = async (input) => {
|
|
48
52
|
const { directory, client } = input;
|
|
49
|
-
|
|
53
|
+
// Proxy: dynamically resolve client.tui on each access so toast works
|
|
54
|
+
// even if client.tui isn't ready yet at plugin init time
|
|
55
|
+
const tui = new Proxy({} as any, {
|
|
56
|
+
get(_, prop) {
|
|
57
|
+
return (client as any)?.tui?.[prop];
|
|
58
|
+
},
|
|
59
|
+
});
|
|
50
60
|
|
|
51
61
|
// Load overrides from opencode.json plugin_config
|
|
52
62
|
let overrides: Record<string, unknown> = {};
|
package/src/tui.tsx
CHANGED
|
@@ -38,21 +38,20 @@ function SidebarContentView(props: {
|
|
|
38
38
|
for (const unsubscribe of unsubscribers) unsubscribe();
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
const enabled = autoStore();
|
|
42
|
-
const t = theme();
|
|
43
|
-
|
|
44
41
|
return (
|
|
45
42
|
<box gap={0}>
|
|
43
|
+
<text fg={theme()?.text} wrapMode="none">
|
|
44
|
+
Cerebro
|
|
45
|
+
</text>
|
|
46
46
|
<box flexDirection="row" gap={1}>
|
|
47
47
|
<text
|
|
48
48
|
flexShrink={0}
|
|
49
|
-
style={{ fg:
|
|
49
|
+
style={{ fg: autoStore() ? theme()?.success : theme()?.textMuted }}
|
|
50
50
|
>
|
|
51
51
|
•
|
|
52
52
|
</text>
|
|
53
|
-
<text fg={
|
|
54
|
-
|
|
55
|
-
{"Auto-store " + (enabled ? "ON" : "OFF")}
|
|
53
|
+
<text fg={theme()?.textMuted} wrapMode="none">
|
|
54
|
+
{"Auto-store: " + (autoStore() ? "ON" : "OFF")}
|
|
56
55
|
</text>
|
|
57
56
|
</box>
|
|
58
57
|
</box>
|