@mingxy/cerebro 2.2.2 → 2.2.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +20 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mingxy/cerebro",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
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/index.ts CHANGED
@@ -140,6 +140,26 @@ const OmemPlugin: Plugin = async (input) => {
140
140
  writeFileSync(join(tmpdir(), "cerebro_startup_toast.json"), JSON.stringify(startupToast));
141
141
  } catch {}
142
142
 
143
+ // Retry direct toast — poll client.tui until ready (opencode 1.17.14+ delays TUI init)
144
+ // 20 attempts × 500ms = 10s window; fires immediately once TUI is ready
145
+ const fireStartupToast = (attempts = 0) => {
146
+ const tuiApi = (client as any)?.tui;
147
+ if (tuiApi?.showToast) {
148
+ tuiApi.showToast({
149
+ body: {
150
+ title: startupToast.title,
151
+ message: startupToast.message,
152
+ variant: startupToast.variant,
153
+ duration: 7000,
154
+ },
155
+ });
156
+ logInfo("startup toast fired", { title: startupToast.title, attempts });
157
+ } else if (attempts < 20) {
158
+ setTimeout(() => fireStartupToast(attempts + 1), 500);
159
+ }
160
+ };
161
+ setTimeout(fireStartupToast, 2000);
162
+
143
163
  // Auto-update check (fire-and-forget, non-blocking)
144
164
  checkAndUpdate(tui, pluginVersion).catch(() => {});
145
165