Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
696fc929c6 | ||
|
|
dfb5004326 | ||
|
|
0824700e4e | ||
|
|
d08cc9b543 | ||
|
|
6c00bd9ffa | ||
|
|
3816155b91 | ||
|
|
aefc84441c | ||
|
|
2ec157e160 | ||
|
|
2e95190cac | ||
|
|
9a6fbe0d3f | ||
|
|
3e0a9def1f |
@@ -117,6 +117,8 @@ jobs:
|
|||||||
file: web/Dockerfile
|
file: web/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
|
# Bakes the release tag into the client bundle (sidebar footer).
|
||||||
|
build-args: SUPERBRAIN_VERSION=${{ github.ref_name }}
|
||||||
tags: |
|
tags: |
|
||||||
federatedcomputer/superbrain-web:${{ github.ref_name }}
|
federatedcomputer/superbrain-web:${{ github.ref_name }}
|
||||||
federatedcomputer/superbrain-web:latest
|
federatedcomputer/superbrain-web:latest
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ V=1.2.3
|
|||||||
docker buildx build --platform linux/amd64,linux/arm64 --push \
|
docker buildx build --platform linux/amd64,linux/arm64 --push \
|
||||||
-t federatedcomputer/superbrain-app:$V -t federatedcomputer/superbrain-app:latest .
|
-t federatedcomputer/superbrain-app:$V -t federatedcomputer/superbrain-app:latest .
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 --push \
|
docker buildx build --platform linux/amd64,linux/arm64 --push \
|
||||||
|
--build-arg SUPERBRAIN_VERSION=$V \
|
||||||
-t federatedcomputer/superbrain-web:$V -t federatedcomputer/superbrain-web:latest web
|
-t federatedcomputer/superbrain-web:$V -t federatedcomputer/superbrain-web:latest web
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 --push \
|
docker buildx build --platform linux/amd64,linux/arm64 --push \
|
||||||
--build-context deploy=deploy/federated \
|
--build-context deploy=deploy/federated \
|
||||||
@@ -575,7 +576,7 @@ is off without it.
|
|||||||
| Variable | Required | Default | Purpose |
|
| Variable | Required | Default | Purpose |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| `AI_API_KEY` | for the server-wide key | — | Operator fallback key; per-user BYO configs (Settings → AI) take precedence, and free/standard plans are BYO-only |
|
| `AI_API_KEY` | for the server-wide key | — | Operator fallback key; per-user BYO configs (Settings → AI) take precedence, and free/standard plans are BYO-only |
|
||||||
| `AI_MODEL` | no | `recursive/flint-v1.0:free` | Any model the provider serves |
|
| `AI_MODEL` | no | `nvidia/nemotron-3-ultra-550b-a55b:free` | Any model the provider serves |
|
||||||
| `AI_BASE_URL` | no | `https://openrouter.ai/api/v1` | Any OpenAI-compatible endpoint |
|
| `AI_BASE_URL` | no | `https://openrouter.ai/api/v1` | Any OpenAI-compatible endpoint |
|
||||||
| `AI_PROVIDER` | no | `openai-compatible` | or `anthropic` / `gemini` |
|
| `AI_PROVIDER` | no | `openai-compatible` | or `anthropic` / `gemini` |
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -320,7 +320,7 @@ Gemini); who pays for the tokens is configuration:
|
|||||||
|
|
||||||
```env
|
```env
|
||||||
AI_API_KEY=... # operator's key
|
AI_API_KEY=... # operator's key
|
||||||
AI_MODEL=recursive/flint-v1.0:free # any model the provider serves
|
AI_MODEL=nvidia/nemotron-3-ultra-550b-a55b:free # any model the provider serves
|
||||||
AI_BASE_URL=https://openrouter.ai/api/v1 # any OpenAI-compatible endpoint
|
AI_BASE_URL=https://openrouter.ai/api/v1 # any OpenAI-compatible endpoint
|
||||||
AI_PROVIDER=openai-compatible # or anthropic / gemini
|
AI_PROVIDER=openai-compatible # or anthropic / gemini
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -318,6 +318,74 @@ Suite-side work items to finish the link (NOT in this repo), copy-paste ready:
|
|||||||
(automations/assistant); those still resolve per-user BYO first, then the
|
(automations/assistant); those still resolve per-user BYO first, then the
|
||||||
plan-gated `AI_*` server env key.
|
plan-gated `AI_*` server env key.
|
||||||
|
|
||||||
|
**Executed on erwin (federatedcomputer.ai) 2026-11-05, superbrain 1.2.4.**
|
||||||
|
Verified: hub lists all 14 tools; read call OK; bad id propagates the Go
|
||||||
|
404 as a tool error; pdns records added. Interim gateway image
|
||||||
|
`federatedcomputer/mcpserver-superbrain:1.8.8` (Dockerfile:
|
||||||
|
`deploy/federated/mcpserver-superbrain.Dockerfile` = upstream 1.8.8 + pipx
|
||||||
|
superbrain-mcp + apps_registry entry; built because upstream ships neither)
|
||||||
|
— the core's mcpserver service `CONTAINER` points at it. Local-only suite
|
||||||
|
edits on erwin (unpushable from here; upstream TODOs): `superbrain` in
|
||||||
|
`MCPSERVER_APPS`, the `mcpserver_app_env_var` case, and the compose render's
|
||||||
|
image repo in `lib/mcpserver.sh`. Retire all three when upstream bakes
|
||||||
|
superbrain in. Gotcha hit: `pipx install` inside the gateway resolves
|
||||||
|
`mcp` 2.x unless pinned `<2` (FastMCP→MCPServer rename breaks the venv at
|
||||||
|
import) — pinned in `mcp/pyproject.toml`.
|
||||||
|
|
||||||
|
### Incident 2026-11-03: the auto-upgrader took superbrain down (and the fix)
|
||||||
|
|
||||||
|
`upgrade-federated.timer` (daily ~10:06, runs `/federated/bin/upgrade` with no
|
||||||
|
args, transcript in `/federated/logs/upgrade.log`) redeployed superbrain
|
||||||
|
(trigger: the then-new `update-superbrain` branch in the Core repo), removed
|
||||||
|
all three containers, then restarted via `/federated/bin/start superbrain` —
|
||||||
|
which fell through to `usage; exit 2` because **superbrain is absent from
|
||||||
|
`EXTRA_APPS` in `lib/functions.sh`** (the SERVICES registry). `upgrade_app`
|
||||||
|
ignored the exit status and printed "Done upgrading" over the dead stack;
|
||||||
|
traefik then answered its default 404 for the whole hostname until manual
|
||||||
|
recovery (~9 h). Aggravator: the DB ledger was already at 017 (a 1.2.0 migrate
|
||||||
|
had run during the Nov 2 operator session) while `.env` pinned 1.0.1, so any
|
||||||
|
restart attempt hit migrate.sh's "applied chain must stay complete" refusal.
|
||||||
|
Recovery: pinned `IMAGE_VERSION="1.2.0"` + restored the `AI_*` lines,
|
||||||
|
`compose up -d`.
|
||||||
|
|
||||||
|
Fix layers, outermost first:
|
||||||
|
|
||||||
|
1. **Pin (immediate, house mechanism):** `IMAGE_VERSION_HOLD=1` in
|
||||||
|
`/federated/apps/superbrain/.env` — `upgrade_app` returns before touching
|
||||||
|
anything. REMOVE once layer 3 lands and auto-upgrades are wanted again
|
||||||
|
(until then, upgrades are manual: `/federated/bin/upgrade superbrain`).
|
||||||
|
2. **erwin-local (defense in depth, live now):** commit `a1eae10` in the
|
||||||
|
host's `/federated` checkout adds superbrain to `EXTRA_APPS` and makes
|
||||||
|
`upgrade_app` check the start exit status + container liveness, alerting
|
||||||
|
via `send_matrix_alert` instead of printing success over a dead stack.
|
||||||
|
Verified: `/federated/bin/start superbrain` now dispatches ("already
|
||||||
|
running") instead of usage. **This commit cannot be pushed**: the box's
|
||||||
|
`installcore` token is pull-only (403) and andrew's account cannot even
|
||||||
|
read the Core repo — so erwin's suite master sits one commit ahead of
|
||||||
|
origin. When the maintainer merges the equivalent change, reset erwin's
|
||||||
|
`/federated` to origin/master to avoid a diverged pull.
|
||||||
|
3. **Core repo (permanent, all cores):** `core-fix-upgrade-superbrain.patch`
|
||||||
|
next to this document is `a1eae10` in `git format-patch` form — hand it to
|
||||||
|
the Core maintainer (the `update-superbrain` branch convention is the
|
||||||
|
house landing path for suite-side app changes).
|
||||||
|
|
||||||
|
Release-publish note (2026-11-05): 1.2.3 was published manually from the
|
||||||
|
dev host with README Option B (multi-arch, tag + latest) using a Docker Hub
|
||||||
|
PAT for `aserwin73` after the org write-scope was corrected — the first
|
||||||
|
successful publish of any release. CI `publish` remains untested end-to-end:
|
||||||
|
the Gitea repo secrets `DOCKERHUB_USERNAME`/`DOCKERHUB_TOKEN` are still unset
|
||||||
|
(andrew's account gets 403 on the repo secrets API; an org owner must set
|
||||||
|
them) — until then every release needs a manual Option B push.
|
||||||
|
|
||||||
|
**1.2.3 is defective for updates — use 1.2.4+:** its migrate image's
|
||||||
|
`/deploy/lib-superbrain.sh` carries unescaped backticks inside the unquoted
|
||||||
|
`render_superbrain_compose` heredoc (command substitution). A re-render while
|
||||||
|
the stack is running injects `docker container inspect` JSON into the compose
|
||||||
|
file; update.sh's parse guard aborts (safely, leaving the old compose
|
||||||
|
replaced by the broken render — restore by re-rendering from a fixed lib).
|
||||||
|
Fixed in 1.2.4 by rewording; rule: no backticks or unescaped `$` inside that
|
||||||
|
heredoc, ever.
|
||||||
|
|
||||||
### Not applicable
|
### Not applicable
|
||||||
|
|
||||||
- `email_superbrain`: since the notification engine (2026-10-26) the app
|
- `email_superbrain`: since the notification engine (2026-10-26) the app
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
From a1eae10112af01b9c35130fa69d149427a83a365 Mon Sep 17 00:00:00 2001
|
||||||
|
From: andrew <andrew@federated.computer>
|
||||||
|
Date: Wed, 4 Nov 2026 15:39:12 +0000
|
||||||
|
Subject: [PATCH] Register superbrain in EXTRA_APPS; fail upgrade_app when the
|
||||||
|
app does not come back up
|
||||||
|
|
||||||
|
The 2026-11-03 upgrade-federated.timer run stopped superbrain, then
|
||||||
|
/federated/bin/start superbrain fell through to usage/exit 2 because
|
||||||
|
superbrain was absent from SERVICES (CORE_APPS/EXTRA_APPS); upgrade_app
|
||||||
|
ignored the exit status and printed Done upgrading over a dead stack,
|
||||||
|
which left traefik answering its default 404 for the whole hostname.
|
||||||
|
|
||||||
|
- add superbrain to EXTRA_APPS so bin/start can dispatch it
|
||||||
|
- upgrade_app: after the post-redeploy start, check the exit status AND
|
||||||
|
that the primary container is actually running; otherwise
|
||||||
|
send_matrix_alert and return 1 instead of reporting success
|
||||||
|
---
|
||||||
|
lib/functions.sh | 7 ++++++-
|
||||||
|
services/superbrain/service | 2 +-
|
||||||
|
2 files changed, 7 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/functions.sh b/lib/functions.sh
|
||||||
|
index c00c444..9bd2fba 100644
|
||||||
|
--- a/lib/functions.sh
|
||||||
|
+++ b/lib/functions.sh
|
||||||
|
@@ -31,7 +31,7 @@
|
||||||
|
|
||||||
|
# Define all services
|
||||||
|
CORE_APPS=("pdnsmysql" "pdns" "pdnsadmin" "traefik" "postgresql" "ldap" "mail" "authelia")
|
||||||
|
-EXTRA_APPS=("collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm" "nginx" "matrixslack" "matrixsignal" "matrixwhatsapp" "dashboard" "jitsiopenid" "roundcube" "redis" "discourse" "wordpressshop" "plane" "calcom" "headscale" "headplane" "dittofeed" "kimai" "nodeexporter" "tailscale" "gitearunner" "nextcloudtalk" "clickhouseserver" "plausible" "docuseal" "mautic" "matomo" "superpanel" "n8n" "immich" "mcpserver" "erpnext" "hermes")
|
||||||
|
+EXTRA_APPS=("collabora" "nextcloud" "matrix" "element" "listmonk" "vaultwarden" "panel" "wireguard" "jitsi" "baserow" "gitea" "caddy" "autodiscover" "castopod" "wordpress" "coturn" "bookstack" "freescout" "msp" "espocrm" "nginx" "matrixslack" "matrixsignal" "matrixwhatsapp" "dashboard" "jitsiopenid" "roundcube" "redis" "discourse" "wordpressshop" "plane" "calcom" "headscale" "headplane" "dittofeed" "kimai" "nodeexporter" "tailscale" "gitearunner" "nextcloudtalk" "clickhouseserver" "plausible" "docuseal" "mautic" "matomo" "superpanel" "n8n" "immich" "mcpserver" "erpnext" "hermes" "superbrain")
|
||||||
|
SERVICES=("${CORE_APPS[@]}" "${EXTRA_APPS[@]}")
|
||||||
|
|
||||||
|
failts() {
|
||||||
|
@@ -345,6 +345,11 @@ upgrade_app() {
|
||||||
|
echo -ne "$APP was already shut down so we won't be starting it.\n"
|
||||||
|
else
|
||||||
|
/federated/bin/start $APP
|
||||||
|
+ if [ $? -ne 0 ] && [ "$(docker container inspect -f '{{.State.Running}}' $APP 2>/dev/null)" != "true" ]; then
|
||||||
|
+ send_matrix_alert "$DOMAIN ($EXTERNALIP): upgrade of $APP to $VERSION finished but the app did not come back up - investigate now, the service is likely DOWN"
|
||||||
|
+ echo -ne "ERROR: start $APP failed during upgrade - app may be DOWN, not reporting success.\n"
|
||||||
|
+ return 1
|
||||||
|
+ fi
|
||||||
|
if [ -x "/federated/services/${APP}/upgrade/post" ]; then
|
||||||
|
if ! /federated/services/${APP}/upgrade/post ${IMAGE_VERSION} ${VERSION}; then
|
||||||
|
echo "Post-upgrade script for ${APP} failed, verify the app still works"
|
||||||
|
diff --git a/services/superbrain/service b/services/superbrain/service
|
||||||
|
index 7ad6015..a6e9b31 100644
|
||||||
|
--- a/services/superbrain/service
|
||||||
|
+++ b/services/superbrain/service
|
||||||
|
@@ -2,7 +2,7 @@ NAME=Superbrain
|
||||||
|
DESCRIPTION="Bookmark & Knowledge Base"
|
||||||
|
DOCS=https://github.com/andrew/superbrain
|
||||||
|
CONTAINER=federatedcomputer/superbrain-app
|
||||||
|
-VERSION=1.0.1
|
||||||
|
+VERSION=1.2.0
|
||||||
|
INTERNAL_IP=192.168.0.93
|
||||||
|
DEPENDS="postgresql"
|
||||||
|
PORTS=3000
|
||||||
|
--
|
||||||
|
2.53.0
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ SUPERBRAIN_APP_IP="192.168.0.94"
|
|||||||
SUPERBRAIN_MIGRATE_IP="192.168.0.95"
|
SUPERBRAIN_MIGRATE_IP="192.168.0.95"
|
||||||
# Release to install; the generic `upgrade` flow keeps .env in step with the
|
# Release to install; the generic `upgrade` flow keeps .env in step with the
|
||||||
# service file's VERSION afterwards.
|
# service file's VERSION afterwards.
|
||||||
SUPERBRAIN_IMAGE_VERSION="1.2.2"
|
SUPERBRAIN_IMAGE_VERSION="1.2.5"
|
||||||
|
|
||||||
# render_superbrain_compose writes the app-dir compose file. Called by
|
# render_superbrain_compose writes the app-dir compose file. Called by
|
||||||
# config_superbrain (install) and by deploy/federated/update.sh after a lib
|
# config_superbrain (install) and by deploy/federated/update.sh after a lib
|
||||||
@@ -84,8 +84,11 @@ services:
|
|||||||
web:
|
web:
|
||||||
image: federatedcomputer/superbrain-web:\${IMAGE_VERSION}
|
image: federatedcomputer/superbrain-web:\${IMAGE_VERSION}
|
||||||
# MUST be named exactly "superbrain": upgrade_app() probes
|
# MUST be named exactly "superbrain": upgrade_app() probes
|
||||||
# `docker container inspect superbrain` and skips apps whose primary
|
# "docker container inspect superbrain" and skips apps whose primary
|
||||||
# container it cannot find under the app name.
|
# container it cannot find under the app name. (No backticks in this
|
||||||
|
# heredoc: it is unquoted, so they would become command substitution —
|
||||||
|
# hit in production 2026-11-05 when a re-render with the container
|
||||||
|
# running injected inspect JSON into the compose file.)
|
||||||
container_name: superbrain
|
container_name: superbrain
|
||||||
hostname: superbrain.$DOMAIN
|
hostname: superbrain.$DOMAIN
|
||||||
restart: always
|
restart: always
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Interim MCP gateway image: upstream federatedcomputer/mcpserver PLUS the
|
||||||
|
# superbrain MCP server, until the mcpserver repo bakes it in officially
|
||||||
|
# (apps_registry.py entry + package install in its own Dockerfile).
|
||||||
|
#
|
||||||
|
# Build from the repo root:
|
||||||
|
# docker buildx build --platform linux/amd64,linux/arm64 --push \
|
||||||
|
# -f deploy/federated/mcpserver-superbrain.Dockerfile \
|
||||||
|
# -t federatedcomputer/mcpserver-superbrain:1.8.8 .
|
||||||
|
#
|
||||||
|
# The suite's mcpserver service file then uses
|
||||||
|
# CONTAINER=federatedcomputer/mcpserver-superbrain (VERSION_RX stays
|
||||||
|
# digits-only: 1.8.8). Published 2026-11-05 for the erwin attach; delete
|
||||||
|
# once upstream ships superbrain support and the service CONTAINER moves
|
||||||
|
# back to federatedcomputer/mcpserver.
|
||||||
|
FROM federatedcomputer/mcpserver:1.8.8
|
||||||
|
|
||||||
|
COPY mcp/ /src/superbrain-mcp/
|
||||||
|
RUN pipx install /src/superbrain-mcp \
|
||||||
|
&& rm -rf /src/superbrain-mcp \
|
||||||
|
&& python3 - <<'PY'
|
||||||
|
p = "/app/apps_registry.py"
|
||||||
|
s = open(p).read()
|
||||||
|
entry = ''' "superbrain": {
|
||||||
|
"required_env": "SUPERBRAIN_API_URL",
|
||||||
|
"command": "superbrain-mcp",
|
||||||
|
"args": [],
|
||||||
|
},
|
||||||
|
'''
|
||||||
|
assert '"superbrain"' not in s, "registry already has superbrain"
|
||||||
|
assert s.count(' "plausible": {') == 1
|
||||||
|
s = s.replace(' "plausible": {', entry + ' "plausible": {', 1)
|
||||||
|
open(p, "w").write(s)
|
||||||
|
print("apps_registry patched: superbrain entry added")
|
||||||
|
PY
|
||||||
@@ -2,7 +2,7 @@ NAME=superbrain
|
|||||||
DESCRIPTION="Bookmark & Knowledge Base"
|
DESCRIPTION="Bookmark & Knowledge Base"
|
||||||
DOCS=https://github.com/andrew/superbrain
|
DOCS=https://github.com/andrew/superbrain
|
||||||
CONTAINER=federatedcomputer/superbrain-app
|
CONTAINER=federatedcomputer/superbrain-app
|
||||||
VERSION=1.2.2
|
VERSION=1.2.5
|
||||||
INTERNAL_IP=192.168.0.93
|
INTERNAL_IP=192.168.0.93
|
||||||
DEPENDS="postgresql"
|
DEPENDS="postgresql"
|
||||||
PORTS=3000
|
PORTS=3000
|
||||||
|
|||||||
+5
-2
@@ -42,8 +42,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DefaultModel is the fallback for the server env config (OpenRouter free
|
// DefaultModel is the fallback for the server env config (OpenRouter free
|
||||||
// tier). User configs always carry an explicit model.
|
// tier). User configs always carry an explicit model. Free slugs rotate on
|
||||||
const DefaultModel = "recursive/flint-v1.0:free"
|
// OpenRouter (recursive/flint-v1.0:free lost its upstreams around 2026-11);
|
||||||
|
// when swapping this, probe /api/v1/models for ":free" ids first — and note
|
||||||
|
// deployments that set AI_MODEL explicitly are unaffected either way.
|
||||||
|
const DefaultModel = "nvidia/nemotron-3-ultra-550b-a55b:free"
|
||||||
|
|
||||||
const defaultOpenAIBase = "https://openrouter.ai/api/v1"
|
const defaultOpenAIBase = "https://openrouter.ai/api/v1"
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -7,13 +7,16 @@ name = "superbrain-mcp"
|
|||||||
# Versioned in lockstep with the Superbrain release it speaks to (house
|
# Versioned in lockstep with the Superbrain release it speaks to (house
|
||||||
# tooling tracks one version per app); the federated mcpserver gateway
|
# tooling tracks one version per app); the federated mcpserver gateway
|
||||||
# installs this package and spawns `superbrain-mcp` per linked instance.
|
# installs this package and spawns `superbrain-mcp` per linked instance.
|
||||||
version = "1.2.2"
|
version = "1.2.5"
|
||||||
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
|
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"mcp>=1.2",
|
# Pinned to the 1.x line: the federated gateway ecosystem (mcp-proxy,
|
||||||
|
# hub_entrypoint, every sibling server) uses the v1 FastMCP API; mcp 2.x
|
||||||
|
# renamed it to MCPServer and breaks at import inside the gateway venv.
|
||||||
|
"mcp>=1.2,<2",
|
||||||
"httpx>=0.27",
|
"httpx>=0.27",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
|
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
|
||||||
|
|
||||||
__version__ = "1.2.2"
|
__version__ = "1.2.5"
|
||||||
|
|||||||
+10
-10
@@ -439,24 +439,24 @@ try {
|
|||||||
await inboxColumn.locator('[data-bookmark-id="bookmark-3"]').waitFor()
|
await inboxColumn.locator('[data-bookmark-id="bookmark-3"]').waitFor()
|
||||||
console.log('PASS: kanban drag reorders within a column and moves cards between columns')
|
console.log('PASS: kanban drag reorders within a column and moves cards between columns')
|
||||||
|
|
||||||
// Page tabs share the persisted position with the sidebar; dragging a tab
|
// The sidebar persists the complete order permutation (PUT /api/pages);
|
||||||
// issues the complete order permutation and both surfaces reload. Reset the
|
// drag b above a. Reset the pin from the earlier metadata test so both
|
||||||
// pin from the earlier metadata test so both pages are in one reorder group.
|
// pages are in one reorder group.
|
||||||
pages.get('a').pinned = false
|
pages.get('a').pinned = false
|
||||||
await page.goto(`${base}/pages`)
|
await page.goto(`${base}/pages`)
|
||||||
await page.locator('[data-page-tab="a"]').waitFor()
|
await page.locator('[data-page-id="a"]').waitFor()
|
||||||
await page.locator('[data-page-tab="b"] [data-page-tab-drag]').dragTo(
|
await page.locator('[data-page-id="b"] [data-page-drag-handle]').dragTo(
|
||||||
page.locator('[data-page-tab="a"]'),
|
page.locator('[data-page-id="a"]'),
|
||||||
{ targetPosition: { x: 5, y: 5 } },
|
{ targetPosition: { x: 10, y: 5 } },
|
||||||
)
|
)
|
||||||
await eventually(() => pages.get('b')?.position === 0 && pages.get('a')?.position === 1, 'Page tab drag did not reorder')
|
await eventually(() => pages.get('b')?.position === 0 && pages.get('a')?.position === 1, 'Sidebar page drag did not reorder')
|
||||||
// The sidebar uses the same complete order permutation; drag a back above b.
|
// And drag a back above b.
|
||||||
await page.locator('[data-page-id="a"] [data-page-drag-handle]').dragTo(
|
await page.locator('[data-page-id="a"] [data-page-drag-handle]').dragTo(
|
||||||
page.locator('[data-page-id="b"]'),
|
page.locator('[data-page-id="b"]'),
|
||||||
{ targetPosition: { x: 10, y: 5 } },
|
{ targetPosition: { x: 10, y: 5 } },
|
||||||
)
|
)
|
||||||
await eventually(() => pages.get('a')?.position === 0 && pages.get('b')?.position === 1, 'Sidebar page drag did not reorder')
|
await eventually(() => pages.get('a')?.position === 0 && pages.get('b')?.position === 1, 'Sidebar page drag did not reorder')
|
||||||
console.log('PASS: page tabs and sidebar persist drag reordering')
|
console.log('PASS: sidebar persists drag reordering')
|
||||||
|
|
||||||
// Revocation failure path (review CR-02): when Go's revocation fails, the
|
// Revocation failure path (review CR-02): when Go's revocation fails, the
|
||||||
// local sign-out still completes, but the UI must say so — local cookie
|
// local sign-out still completes, but the UI must say so — local cookie
|
||||||
|
|||||||
+5
-1
@@ -8,7 +8,11 @@ FROM node:22.23.3-alpine3.24 AS build
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
# Release version baked into the client bundle (sidebar footer). The release
|
||||||
|
# workflow passes the tag as SUPERBRAIN_VERSION; every other build keeps the
|
||||||
|
# default and the UI shows "dev build".
|
||||||
|
ARG SUPERBRAIN_VERSION=dev
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1 NEXT_PUBLIC_SUPERBRAIN_VERSION=$SUPERBRAIN_VERSION
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
FROM node:22.23.3-alpine3.24 AS runtime
|
FROM node:22.23.3-alpine3.24 AS runtime
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import ReactMarkdown from 'react-markdown'
|
|||||||
import remarkGfm from 'remark-gfm'
|
import remarkGfm from 'remark-gfm'
|
||||||
import { toast } from 'sonner'
|
import { toast } from 'sonner'
|
||||||
import {
|
import {
|
||||||
ChevronLeft, ChevronRight, Code, CornerUpLeft, Download, Eye, FileText, GripVertical,
|
Code, CornerUpLeft, Download, Eye, FileText,
|
||||||
Heading1, Heading2, Heading3, History, Layers, Link2, List, ListOrdered, ListTodo, Minus, Pencil,
|
Heading1, Heading2, Heading3, History, Layers, Link2, List, ListOrdered, ListTodo, Minus, Pencil,
|
||||||
Pin, PinOff, Plus, Quote, RotateCcw, Search, Trash2, Type, X,
|
Pin, PinOff, Plus, Quote, RotateCcw, Trash2, Type, X,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { Input } from '@/components/ui/input'
|
import { Input } from '@/components/ui/input'
|
||||||
@@ -23,7 +23,6 @@ import {
|
|||||||
PAGES_CHANGED, collectionEmbedMarkdown, descendantPageIds, internalPageId, nextUntitledTitle,
|
PAGES_CHANGED, collectionEmbedMarkdown, descendantPageIds, internalPageId, nextUntitledTitle,
|
||||||
notifyActivePage, notifyPagesChanged, pageLinkMarkdown, parsePageEmbed, type PageSummary,
|
notifyActivePage, notifyPagesChanged, pageLinkMarkdown, parsePageEmbed, type PageSummary,
|
||||||
} from '@/lib/pages'
|
} from '@/lib/pages'
|
||||||
import { reorderPages } from '@/lib/page-order'
|
|
||||||
import { fetchLinkPreview } from '@/lib/link-preview'
|
import { fetchLinkPreview } from '@/lib/link-preview'
|
||||||
import { LinkPreviewCard } from '@/components/link-preview-card'
|
import { LinkPreviewCard } from '@/components/link-preview-card'
|
||||||
import type { Element, ElementContent } from 'hast'
|
import type { Element, ElementContent } from 'hast'
|
||||||
@@ -184,7 +183,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
const [pages, setPages] = useState<PageSummary[]>([])
|
const [pages, setPages] = useState<PageSummary[]>([])
|
||||||
const [activeId, setActiveId] = useState<string | null>(initialId)
|
const [activeId, setActiveId] = useState<string | null>(initialId)
|
||||||
const [page, setPage] = useState<PageDetail | null>(null)
|
const [page, setPage] = useState<PageDetail | null>(null)
|
||||||
const [filter, setFilter] = useState('')
|
|
||||||
const [mode, setMode] = useState<'edit' | 'preview'>('preview')
|
const [mode, setMode] = useState<'edit' | 'preview'>('preview')
|
||||||
const [title, setTitle] = useState('')
|
const [title, setTitle] = useState('')
|
||||||
const [content, setContent] = useState('')
|
const [content, setContent] = useState('')
|
||||||
@@ -202,11 +200,8 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
const [historyBusy, setHistoryBusy] = useState<string | null>(null)
|
const [historyBusy, setHistoryBusy] = useState<string | null>(null)
|
||||||
const [slash, setSlash] = useState<{ query: string; start: number } | null>(null)
|
const [slash, setSlash] = useState<{ query: string; start: number } | null>(null)
|
||||||
const [slashIndex, setSlashIndex] = useState(0)
|
const [slashIndex, setSlashIndex] = useState(0)
|
||||||
const [tabDrop, setTabDrop] = useState<{ id: string; after: boolean } | null>(null)
|
|
||||||
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
const textareaRef = useRef<HTMLTextAreaElement>(null)
|
||||||
const pendingCaret = useRef<number | null>(null)
|
const pendingCaret = useRef<number | null>(null)
|
||||||
const suppressTabClick = useRef(false)
|
|
||||||
const draggedTabRef = useRef<string | null>(null)
|
|
||||||
const activePage = useRef(initialId)
|
const activePage = useRef(initialId)
|
||||||
const loadSequence = useRef(0)
|
const loadSequence = useRef(0)
|
||||||
const selectionSequence = useRef(0)
|
const selectionSequence = useRef(0)
|
||||||
@@ -504,34 +499,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const move = async (dir: -1 | 1) => {
|
|
||||||
if (!activeId) return
|
|
||||||
const idx = pages.findIndex((p) => p.id === activeId)
|
|
||||||
const target = pages[idx + dir]
|
|
||||||
if (idx < 0 || !target) return
|
|
||||||
const next = reorderPages(pages, activeId, target.id, dir > 0)
|
|
||||||
if (next === 'blocked') { toast.error('Pinned and unpinned pages keep separate groups'); return }
|
|
||||||
if (next) await savePageOrder(next)
|
|
||||||
}
|
|
||||||
|
|
||||||
const savePageOrder = async (next: PageSummary[]) => {
|
|
||||||
setPages(next)
|
|
||||||
const res = await fetch('/api/pages', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ order: next.map((p) => p.id) }) })
|
|
||||||
if (!res.ok) { toast.error('Could not reorder pages'); await loadPages(); return }
|
|
||||||
await loadPages()
|
|
||||||
notify()
|
|
||||||
}
|
|
||||||
|
|
||||||
const dropTab = (target: PageSummary, after: boolean) => {
|
|
||||||
const source = draggedTabRef.current
|
|
||||||
draggedTabRef.current = null
|
|
||||||
setTabDrop(null)
|
|
||||||
if (!source) return
|
|
||||||
const next = reorderPages(pages, source, target.id, after)
|
|
||||||
if (next === 'blocked') { toast.error('Pinned and unpinned pages keep separate groups'); return }
|
|
||||||
if (next) void savePageOrder(next)
|
|
||||||
}
|
|
||||||
|
|
||||||
const download = async () => {
|
const download = async () => {
|
||||||
if (!activeId) return
|
if (!activeId) return
|
||||||
// A paused conflict can never flush; exporting the server copy is still
|
// A paused conflict can never flush; exporting the server copy is still
|
||||||
@@ -658,7 +625,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
if (/^https?:\/\/\S+$/i.test(text)) offerTitleForPastedUrl(text)
|
if (/^https?:\/\/\S+$/i.test(text)) offerTitleForPastedUrl(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
const visible = pages.filter((p) => p.title.toLowerCase().includes(filter.toLowerCase()))
|
|
||||||
const looksLikeUrl = /^(https?:\/\/)?[\w-]+(\.[\w-]+)+/i.test(linkQuery.trim())
|
const looksLikeUrl = /^(https?:\/\/)?[\w-]+(\.[\w-]+)+/i.test(linkQuery.trim())
|
||||||
// A page may move under any page except itself or one of its descendants
|
// A page may move under any page except itself or one of its descendants
|
||||||
// (the server rejects that cycle even if a stale client tries it).
|
// (the server rejects that cycle even if a stale client tries it).
|
||||||
@@ -670,74 +636,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full flex-col">
|
<div className="flex h-full flex-col">
|
||||||
<div className="flex items-center gap-2 border-b border-border/60 px-4 py-2">
|
|
||||||
<div className="relative w-40 shrink-0">
|
|
||||||
<Search className="absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
|
|
||||||
<Input value={filter} onChange={(e) => setFilter(e.target.value)} placeholder="Filter pages" className="h-8 pl-7 text-sm" />
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-1 items-center gap-1 overflow-x-auto">
|
|
||||||
{visible.map((p) => (
|
|
||||||
<div
|
|
||||||
key={p.id}
|
|
||||||
data-page-tab={p.id}
|
|
||||||
onDragOver={(e) => {
|
|
||||||
if (!draggedTabRef.current || draggedTabRef.current === p.id) return
|
|
||||||
e.preventDefault()
|
|
||||||
e.dataTransfer.dropEffect = 'move'
|
|
||||||
const rect = e.currentTarget.getBoundingClientRect()
|
|
||||||
setTabDrop({ id: p.id, after: e.clientX > rect.left + rect.width / 2 })
|
|
||||||
}}
|
|
||||||
onDragLeave={(e) => {
|
|
||||||
if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setTabDrop(null)
|
|
||||||
}}
|
|
||||||
onDrop={(e) => {
|
|
||||||
e.preventDefault()
|
|
||||||
const rect = e.currentTarget.getBoundingClientRect()
|
|
||||||
dropTab(p, e.clientX > rect.left + rect.width / 2)
|
|
||||||
}}
|
|
||||||
title={filter.trim() ? 'Clear the filter to reorder pages' : 'Drag the grip to reorder page'}
|
|
||||||
className={cn(
|
|
||||||
'group/tab flex shrink-0 items-center gap-1 rounded-md px-2 py-1.5 text-sm transition-colors',
|
|
||||||
p.id === activeId ? 'bg-primary/10 font-medium text-primary' : 'text-muted-foreground hover:bg-muted hover:text-foreground',
|
|
||||||
tabDrop?.id === p.id && 'ring-1 ring-primary/50',
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{!filter.trim() && (
|
|
||||||
<span
|
|
||||||
data-page-tab-drag
|
|
||||||
draggable
|
|
||||||
onDragStart={(e) => {
|
|
||||||
suppressTabClick.current = true
|
|
||||||
draggedTabRef.current = p.id
|
|
||||||
e.dataTransfer.effectAllowed = 'move'
|
|
||||||
e.dataTransfer.setData('text/plain', p.id)
|
|
||||||
}}
|
|
||||||
onDragEnd={() => {
|
|
||||||
draggedTabRef.current = null
|
|
||||||
setTabDrop(null)
|
|
||||||
setTimeout(() => { suppressTabClick.current = false }, 0)
|
|
||||||
}}
|
|
||||||
className="cursor-grab text-muted-foreground/40 opacity-0 transition-opacity hover:text-muted-foreground active:cursor-grabbing group-hover/tab:opacity-100"
|
|
||||||
aria-label={`Drag page ${p.title}`}
|
|
||||||
>
|
|
||||||
<GripVertical className="h-3 w-3" />
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={() => { if (!suppressTabClick.current) select(p.id) }}
|
|
||||||
aria-label={p.title}
|
|
||||||
className="flex min-w-0 items-center gap-1.5"
|
|
||||||
>
|
|
||||||
{p.pinned ? <Pin className="h-3 w-3" /> : <FileText className="h-3 w-3" />}
|
|
||||||
<span className="max-w-[10rem] truncate">{p.title}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
<Button size="sm" onClick={createPage}><Plus className="mr-1 h-4 w-4" />New page</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!page || page.id !== activeId ? (
|
{!page || page.id !== activeId ? (
|
||||||
<div className="flex flex-1 flex-col items-center justify-center gap-3 p-10 text-center">
|
<div className="flex flex-1 flex-col items-center justify-center gap-3 p-10 text-center">
|
||||||
<FileText className="h-10 w-10 text-muted-foreground" />
|
<FileText className="h-10 w-10 text-muted-foreground" />
|
||||||
@@ -753,8 +651,6 @@ export function PagesClient({ initialId }: { initialId: string | null }) {
|
|||||||
{saveState === 'dirty' && <Button size="sm" variant="outline" onClick={() => autosave.flush(page.id)}>Save now</Button>}
|
{saveState === 'dirty' && <Button size="sm" variant="outline" onClick={() => autosave.flush(page.id)}>Save now</Button>}
|
||||||
<Button variant="ghost" size="icon-sm" title={mode === 'edit' ? 'Preview' : 'Edit'} onClick={() => { setMode(mode === 'edit' ? 'preview' : 'edit'); setSlash(null) }}>{mode === 'edit' ? <Eye className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}</Button>
|
<Button variant="ghost" size="icon-sm" title={mode === 'edit' ? 'Preview' : 'Edit'} onClick={() => { setMode(mode === 'edit' ? 'preview' : 'edit'); setSlash(null) }}>{mode === 'edit' ? <Eye className="h-4 w-4" /> : <Pencil className="h-4 w-4" />}</Button>
|
||||||
<Button variant="ghost" size="icon-sm" title={page.pinned ? 'Unpin' : 'Pin to sidebar'} onClick={togglePin}>{page.pinned ? <PinOff className="h-4 w-4" /> : <Pin className="h-4 w-4" />}</Button>
|
<Button variant="ghost" size="icon-sm" title={page.pinned ? 'Unpin' : 'Pin to sidebar'} onClick={togglePin}>{page.pinned ? <PinOff className="h-4 w-4" /> : <Pin className="h-4 w-4" />}</Button>
|
||||||
<Button variant="ghost" size="icon-sm" title="Move tab left" onClick={() => move(-1)}><ChevronLeft className="h-4 w-4" /></Button>
|
|
||||||
<Button variant="ghost" size="icon-sm" title="Move tab right" onClick={() => move(1)}><ChevronRight className="h-4 w-4" /></Button>
|
|
||||||
<Button variant="ghost" size="icon-sm" title="Download .md" onClick={download}><Download className="h-4 w-4" /></Button>
|
<Button variant="ghost" size="icon-sm" title="Download .md" onClick={download}><Download className="h-4 w-4" /></Button>
|
||||||
<Button variant="ghost" size="icon-sm" title="Version history" onClick={() => void openHistory()}><History className="h-4 w-4" /></Button>
|
<Button variant="ghost" size="icon-sm" title="Version history" onClick={() => void openHistory()}><History className="h-4 w-4" /></Button>
|
||||||
<Button variant="ghost" size="icon-sm" title="Move to trash" onClick={remove}><Trash2 className="h-4 w-4 text-destructive" /></Button>
|
<Button variant="ghost" size="icon-sm" title="Move to trash" onClick={remove}><Trash2 className="h-4 w-4 text-destructive" /></Button>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const PROVIDERS: Record<string, { label: string; defaultBase: string; models: st
|
|||||||
'openai-compatible': {
|
'openai-compatible': {
|
||||||
label: 'OpenAI-compatible (OpenRouter, OpenAI, Grok, Groq, Ollama, …)',
|
label: 'OpenAI-compatible (OpenRouter, OpenAI, Grok, Groq, Ollama, …)',
|
||||||
defaultBase: 'https://openrouter.ai/api/v1',
|
defaultBase: 'https://openrouter.ai/api/v1',
|
||||||
models: ['gpt-4o-mini', 'gpt-4o', 'recursive/flint-v1.0:free'],
|
models: ['gpt-4o-mini', 'gpt-4o', 'nvidia/nemotron-3-ultra-550b-a55b:free', 'google/gemma-4-31b-it:free'],
|
||||||
},
|
},
|
||||||
anthropic: {
|
anthropic: {
|
||||||
label: 'Anthropic (Claude)',
|
label: 'Anthropic (Claude)',
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
import { useRouter, useSearchParams } from 'next/navigation'
|
import { useRouter, useSearchParams } from 'next/navigation'
|
||||||
import { Suspense, useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'
|
import { Suspense, useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'
|
||||||
|
|
||||||
|
// Release version baked into the client bundle at image build time
|
||||||
|
// (web/Dockerfile ARG SUPERBRAIN_VERSION; CI passes the tag, local builds
|
||||||
|
// keep "dev"). Shown in the sidebar footer so any deployment can be
|
||||||
|
// identified from the UI alone.
|
||||||
|
const APP_VERSION = process.env.NEXT_PUBLIC_SUPERBRAIN_VERSION || ''
|
||||||
import { cn } from '@/lib/utils'
|
import { cn } from '@/lib/utils'
|
||||||
import {
|
import {
|
||||||
Calendar, Tags, Users, Kanban, Link2, Settings, ChevronLeft, ChevronRight, ChevronDown,
|
Calendar, Tags, Users, Kanban, Link2, Settings, ChevronLeft, ChevronRight, ChevronDown,
|
||||||
@@ -110,6 +116,11 @@ export function Sidebar({ open, onToggle, onQuickFind, pathname, isAdmin = false
|
|||||||
<Button variant="ghost" size="icon-sm" onClick={onToggle} className="w-full" aria-label={open ? 'Collapse sidebar' : 'Expand sidebar'}>
|
<Button variant="ghost" size="icon-sm" onClick={onToggle} className="w-full" aria-label={open ? 'Collapse sidebar' : 'Expand sidebar'}>
|
||||||
{open ? <ChevronLeft className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
{open ? <ChevronLeft className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
||||||
</Button>
|
</Button>
|
||||||
|
{open && APP_VERSION && (
|
||||||
|
<p className="px-3 pt-0.5 text-[10px] text-muted-foreground/70 select-none" title={`Superbrain ${APP_VERSION}`}>
|
||||||
|
{APP_VERSION === 'dev' ? 'dev build' : `v${APP_VERSION}`}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user