Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
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",
Expand All @@ -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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether the repo documents/enforces sibling checkout for local file deps
# and whether package managers will need ../four-opencode-plugin-lib to exist.

set -euo pipefail

echo "== package.json dependency =="
cat package.json | sed -n '1,140p' | rg -n '"`@four-bytes/opencode-plugin-lib`"|\"name\"|\"version\"'

echo
echo "== docs/scripts mentioning four-opencode-plugin-lib sibling checkout =="
rg -n -C2 'four-opencode-plugin-lib|file:\.\./four-opencode-plugin-lib|git submodule|workspace|monorepo' README.md docs/ .github/ scripts/ 2>/dev/null || true

echo
echo "== lockfiles (if present) containing local file reference =="
fd -HI '(^|/)(bun\.lockb|bun\.lock|package-lock\.json|pnpm-lock\.yaml|yarn\.lock)$' | while read -r f; do
  echo "-- $f"
  rg -n 'four-opencode-plugin-lib|file:\.\./four-opencode-plugin-lib' "$f" || true
done

Repository: four-bytes/four-opencode-brain

Length of output: 277


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== package.json content (lines 1-50) =="
head -50 package.json

echo ""
echo "== Package name and version =="
cat package.json | grep -E '"name"|"version"'

echo ""
echo "== All dependencies mentioning four-opencode-plugin-lib =="
cat package.json | grep -n 'four-opencode-plugin-lib'

Repository: four-bytes/four-opencode-brain

Length of output: 1877


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== README or documentation mentioning sibling checkout or monorepo =="
for file in README.md README.rst CONTRIBUTING.md SETUP.md docs/SETUP.md; do
  if [ -f "$file" ]; then
    echo "-- Found: $file"
    cat "$file" | head -100
  fi
done

echo ""
echo "== Check if ../four-opencode-plugin-lib is documented =="
rg 'four-opencode-plugin-lib|sibling|monorepo|workspace' --type md --type txt 2>/dev/null || echo "No matches found"

Repository: four-bytes/four-opencode-brain

Length of output: 8546


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Lockfiles present in repo =="
fd -HI '\.(lock|lockb|yaml)$' | grep -E '(package-lock|pnpm-lock|yarn\.lock|bun\.lock|bun\.lockb)' || echo "No lockfiles found"

echo ""
echo "== Directory structure - check for sibling four-opencode-plugin-lib =="
ls -la ../ 2>/dev/null | grep four-opencode || echo "Cannot list parent directory"

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
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 18, The `"`@four-bytes/opencode-plugin-lib`":
"file:../four-opencode-plugin-lib"` dependency in package.json uses a local file
reference that will break when the package is published to npm. Either configure
the project to use a workspace setup that conditionally resolves this for
development while maintaining a valid publishable dependency for releases, or
replace the file: reference with a proper semver version number or git reference
to `@four-bytes/opencode-plugin-lib` that is installable for npm consumers.
Additionally, ensure that bun.lock is regenerated after resolving the dependency
to reflect the publishable state.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: The file:../four-opencode-plugin-lib reference will make this package uninstallable for any consumer or CI runner that doesn't have the sibling directory checked out. If this merges and gets published to npm, all installations will fail with a missing module error. Replace with a publishable semver or git ref (e.g., github:four-bytes/four-opencode-plugin-lib#v0.7.0) before merging, or gate it behind a workspace/dev-only mechanism.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At package.json, line 18:

<comment>The `file:../four-opencode-plugin-lib` reference will make this package uninstallable for any consumer or CI runner that doesn't have the sibling directory checked out. If this merges and gets published to npm, all installations will fail with a missing module error. Replace with a publishable semver or git ref (e.g., `github:four-bytes/four-opencode-plugin-lib#v0.7.0`) before merging, or gate it behind a workspace/dev-only mechanism.</comment>

<file context>
@@ -15,7 +15,7 @@
   ],
   "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",
     "@opencode-ai/plugin": "1.16.2",
     "@opentui/core": "0.3.2",
</file context>
Suggested change
"@four-bytes/opencode-plugin-lib": "file:../four-opencode-plugin-lib",
"@four-bytes/opencode-plugin-lib": "github:four-bytes/four-opencode-plugin-lib#v0.7.0",

"@opencode-ai/plugin": "1.16.2",
"@opentui/core": "0.3.2",
"@opentui/solid": "0.3.2",
Expand Down
17 changes: 14 additions & 3 deletions src/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 } });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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
Check if this issue is valid — if so, understand the root cause and fix it. At src/status.ts, line 94:

<comment>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.</comment>

<file context>
@@ -79,9 +79,20 @@ export function initStatus(client: PluginInput["client"], directory: string): vo
+      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 } });
+      _busPromise = null;
       throw err;
</file context>

_busPromise = null;
throw err;
});
}
Expand Down
Loading