-
Notifications
You must be signed in to change notification settings - Fork 0
feat: route BusClient warnings to app.log + toast on fallback #153 #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,6 @@ | ||||||
| { | ||||||
| "name": "@four-bytes/four-opencode-brain", | ||||||
| "version": "1.7.7", | ||||||
| "version": "1.7.8", | ||||||
| "description": "Unified brain plugin — single SQLite DB for RAG search, memory, and knowledge base", | ||||||
| "license": "Apache-2.0", | ||||||
| "type": "module", | ||||||
|
|
@@ -15,7 +15,7 @@ | |||||
| "four-bytes" | ||||||
| ], | ||||||
| "dependencies": { | ||||||
| "@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.6.1", | ||||||
| "@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib", | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: The Prompt for AI agents
Suggested change
|
||||||
| "@opencode-ai/plugin": "1.16.2", | ||||||
| "@opentui/core": "0.3.2", | ||||||
| "@opentui/solid": "0.3.2", | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,9 +79,20 @@ export function initStatus(client: PluginInput["client"], directory: string): vo | |
|
|
||
| function getBus(): Promise<BusClient> { | ||
| if (!_busPromise) { | ||
| _busPromise = BusClient.connect().catch((err) => { | ||
| _client?.app?.log({ body: { service: "brain", level: "warn", message: "BusClient connect failed", extra: { error: String(err) } } }).catch(() => {}); | ||
| _busPromise = null; // allow retry on next call | ||
| _busPromise = BusClient.connect({ | ||
| onWarn: (message, ...args) => { | ||
| _client?.app?.log({ body: { service: "brain", level: "warn", message, extra: { args: args.map(String) } } }).catch(() => {}); | ||
| }, | ||
| }).then((bus) => { | ||
| // bus.activePort === 0 means MemoryBusClient fallback (Go bus binary not available) | ||
| if ((bus as any).activePort === 0) { | ||
| _client?.tui?.showToast({ body: { title: "Brain 🧠", message: "Bus unavailable — using in-memory fallback. Install four-local-bus for cross-process communication.", variant: "warning", duration: 8000 } }); | ||
| } | ||
| return bus; | ||
| }).catch((err) => { | ||
| _client?.app?.log({ body: { service: "brain", level: "error", message: "BusClient connect failed", extra: { error: String(err) } } }).catch(() => {}); | ||
| _client?.tui?.showToast({ body: { title: "Brain 🧠", message: "Bus connection failed: " + String(err).slice(0, 80), variant: "error", duration: 7000 } }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Bus-connect failure toast is unthrottled and can spam on repeated status writes during outages. Gate this toast (once per window/once per outage) before showing it. Prompt for AI agents |
||
| _busPromise = null; | ||
| throw err; | ||
| }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: four-bytes/four-opencode-brain
Length of output: 277
🏁 Script executed:
Repository: four-bytes/four-opencode-brain
Length of output: 1877
🏁 Script executed:
Repository: four-bytes/four-opencode-brain
Length of output: 8546
🏁 Script executed:
Repository: four-bytes/four-opencode-brain
Length of output: 216
Resolve local
file:dependency before publishing to npm."@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib"at line 18 makes this published npm package uninstallable by consumers. Installation instructions in README.md and docs/SETUP.md do not document the required sibling checkout; users and CI runners following the documentation will fail with missing module errors. The bun.lock file locks this broken state.For development: gate the file: dependency behind a dev-only condition or workspace setup. For releases: replace with a publishable semver/git ref to
@four-bytes/opencode-plugin-lib, or build/publish it separately.Prompt for AI Agents