Compare commits

..
4 Commits
Author SHA1 Message Date
Andrew S Erwin c04be7529a release 0.3.7: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 5m34s
release / smoke (push) Successful in 10m20s
release / publish (push) Failing after 9m57s
2026-11-24 16:04:08 -06:00
Andrew S Erwin 4b6a58118e Rename Go module to gitea.federated.computer/Federated_Computer/superbrain
The Gitea repository was renamed brain -> superbrain (server-side redirect
already in place; local origin updated at 0.3.5). Carry the rename through
for accurate identity, the 0.3.2 precedent: go.mod + every internal import,
the agent's outbound User-Agent contact URL, README/RUNNING clone URLs and
local notes. CHANGELOG history entries stay as written. Pure identifier
rename, no runtime behavior change; verified with build + vet + unit tests
and the full database integration suite under -race.
2026-11-24 16:02:01 -06:00
Andrew S Erwin ae7d3852e2 release 0.3.6: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 5m33s
release / smoke (push) Successful in 10m36s
release / publish (push) Failing after 9m57s
2026-11-24 11:35:20 -06:00
Andrew S Erwin 3878dddaa7 WebDAV: survive rate limits on large shares
Nextcloud throttles bursty PROPFIND walks (429) and big trees exceeded the
3-minute sync budget — production's 1000+ file share failed intermittently
with 'unexpected answer (429)' and 'context deadline exceeded'. propfind now
retries 429/503 up to 3 times honoring Retry-After (capped 30s, ctx-bound,
linear backoff without the header), the directory walk paces 100ms between
PROPFINDs, and the engine sync budget grows to 6 minutes. Unit tests cover
recover-after-429 and the bounded attempt count; truncation semantics are
unchanged.
2026-11-24 11:35:06 -06:00
83 changed files with 346 additions and 218 deletions
+4 -1
View File
@@ -158,7 +158,10 @@ deleted it, FK SET NULL) re-links every still-tracked file. A truncated
listing (200 dirs / 1000 files / depth 12 caps) creates new members but listing (200 dirs / 1000 files / depth 12 caps) creates new members but
never reconciles deletions. Dials are netguard-pinned (ports 80/443 outside never reconciles deletions. Dials are netguard-pinned (ports 80/443 outside
tests), credentials travel only in a Basic `Authorization` header (never the tests), credentials travel only in a Basic `Authorization` header (never the
URL), and redirects are refused outright. Creation AND every sync re-check URL), and redirects are refused outright. Rate-limited answers (429/503) are
retried up to 3 times honoring `Retry-After` (capped at 30s), directory walks
are paced 100ms apart, and the engine's per-sync budget is 6 minutes — large
shares throttle instead of failing. Creation AND every sync re-check
`AllowConnector("webdav")` from the entitlement catalog; a downgrade `AllowConnector("webdav")` from the entitlement catalog; a downgrade
suppresses syncs instead of deleting anything. suppresses syncs instead of deleting anything.
+24
View File
@@ -7,6 +7,30 @@ Versions correspond to git tags and to the published image set
(the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta). (the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta).
Dates are tag dates. Dates are tag dates.
## 0.3.7 — 2026-11-24
### Changed
- **Accurate module identity after the Gitea rename**: the repository was
renamed `brain` → `superbrain` on Gitea; the Go module is now
`gitea.federated.computer/Federated_Computer/superbrain` (go.mod + every
internal import), and the agent's outbound User-Agent contact URL and the
README/RUNNING clone URLs follow. Pure identifier rename with no runtime
behavior change; verified with build + vet + unit tests and the full
database integration suite under `-race`.
## 0.3.6 — 2026-11-24
### Fixed
- **WebDAV on large shares**: Nextcloud throttles bursty PROPFIND walks, so
production's 1,000+ file share failed intermittently with "unexpected
answer (429)" and "context deadline exceeded". PROPFIND now retries
429/503 up to 3 times honoring `Retry-After` (capped at 30s, ctx-bound,
linear backoff without the header), the directory walk paces 100ms between
requests, and the engine's per-sync budget grows from 3 to 6 minutes.
Truncation semantics are unchanged (a capped walk still never reconciles
deletions); unit tests cover recover-after-429 and the bounded attempt
count.
## 0.3.5 — 2026-11-24 ## 0.3.5 — 2026-11-24
### Fixed ### Fixed
+3 -3
View File
@@ -38,7 +38,7 @@ Details: [web/docs/AUTHELIA.md](web/docs/AUTHELIA.md) §7.
Requires Docker with Compose v2 or newer. On a new installation: Requires Docker with Compose v2 or newer. On a new installation:
```bash ```bash
git clone https://gitea.federated.computer/Federated_Computer/brain.git git clone https://gitea.federated.computer/Federated_Computer/superbrain.git
cd superbrain cd superbrain
cp .env.example .env cp .env.example .env
docker run --rm node:22-alpine node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))" docker run --rm node:22-alpine node -e "console.log(require('node:crypto').randomBytes(32).toString('hex'))"
@@ -490,7 +490,7 @@ federatedcomputer/superbrain-migrate:<version> DB bootstrap (context db, db/D
``` ```
Platforms: `linux/amd64,linux/arm64`. Source of truth: this Gitea repo Platforms: `linux/amd64,linux/arm64`. Source of truth: this Gitea repo
(`https://gitea.federated.computer/Federated_Computer/brain.git`) at the (`https://gitea.federated.computer/Federated_Computer/superbrain.git`) at the
matching tag. The repositories auto-create on first push under the matching tag. The repositories auto-create on first push under the
`federatedcomputer` namespace; keep them **public** so cores can pull `federatedcomputer` namespace; keep them **public** so cores can pull
without registry credentials. Never move an existing tag — cut a new without registry credentials. Never move an existing tag — cut a new
@@ -536,7 +536,7 @@ Watch the run under the repo's Actions tab; verify with
From any Linux machine with Docker, buildx and login rights: From any Linux machine with Docker, buildx and login rights:
```bash ```bash
git clone https://gitea.federated.computer/Federated_Computer/brain.git git clone https://gitea.federated.computer/Federated_Computer/superbrain.git
cd brain && git checkout 0.2.17 # always build from the tag cd brain && git checkout 0.2.17 # always build from the tag
# One-time per machine: buildx builder + cross-arch emulation # One-time per machine: buildx builder + cross-arch emulation
+1 -1
View File
@@ -26,7 +26,7 @@ Both commands should succeed. On Windows, Docker must be using Linux containers.
## 1. Download the app ## 1. Download the app
```sh ```sh
git clone https://gitea.federated.computer/Federated_Computer/brain.git git clone https://gitea.federated.computer/Federated_Computer/superbrain.git
cd superbrain cd superbrain
``` ```
+1 -1
View File
@@ -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="0.3.5" SUPERBRAIN_IMAGE_VERSION="0.3.7"
# 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
+1 -1
View File
@@ -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=0.3.5 VERSION=0.3.7
INTERNAL_IP=192.168.0.93 INTERNAL_IP=192.168.0.93
DEPENDS="postgresql" DEPENDS="postgresql"
PORTS=3000 PORTS=3000
+1 -1
View File
@@ -1,4 +1,4 @@
module gitea.federated.computer/Federated_Computer/brain module gitea.federated.computer/Federated_Computer/superbrain
go 1.26.0 go 1.26.0
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"gitea.federated.computer/Federated_Computer/brain/internal/ai" "gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// ErrCompileRejected means the model could not (or refused to) express the // ErrCompileRejected means the model could not (or refused to) express the
+8 -8
View File
@@ -14,13 +14,13 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/ai" "gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/mailer" "gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"gitea.federated.computer/Federated_Computer/brain/internal/notify" "gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"net" "net"
) )
@@ -407,7 +407,7 @@ func fetchText(ctx context.Context, rawurl string) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
req.Header.Set("User-Agent", "Superbrain-agent/1.0 (+https://gitea.federated.computer/Federated_Computer/brain)") req.Header.Set("User-Agent", "Superbrain-agent/1.0 (+https://gitea.federated.computer/Federated_Computer/superbrain)")
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/json;q=0.9,text/plain;q=0.8") req.Header.Set("Accept", "text/html,application/xhtml+xml,application/json;q=0.9,text/plain;q=0.8")
res, err := fetchClient.Do(req) res, err := fetchClient.Do(req)
if err != nil { if err != nil {
+6 -6
View File
@@ -33,12 +33,12 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
// DefaultModel is the fallback for the server env config (OpenRouter free // DefaultModel is the fallback for the server env config (OpenRouter free
+1 -1
View File
@@ -30,7 +30,7 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
const ( const (
+2 -2
View File
@@ -3,8 +3,8 @@ package auth
import ( import (
"encoding/json" "encoding/json"
"errors" "errors"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgconn"
"log" "log"
"net/http" "net/http"
+3 -3
View File
@@ -3,9 +3,9 @@ package auth
import ( import (
"context" "context"
"errors" "errors"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/models" "gitea.federated.computer/Federated_Computer/superbrain/internal/models"
"log" "log"
"net/http" "net/http"
"sync" "sync"
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
) )
+3 -3
View File
@@ -32,9 +32,9 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/mailer" "gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
) )
const ( const (
+1 -1
View File
@@ -25,7 +25,7 @@ import (
"crypto/hmac" "crypto/hmac"
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"net" "net"
"net/http" "net/http"
"sort" "sort"
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
) )
+4 -4
View File
@@ -4,10 +4,10 @@ import (
"database/sql" "database/sql"
"encoding/json" "encoding/json"
"errors" "errors"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/handlers" "gitea.federated.computer/Federated_Computer/superbrain/internal/handlers"
"log" "log"
"net/http" "net/http"
"strings" "strings"
+1 -1
View File
@@ -29,7 +29,7 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
) )
// Conn is the dial-relevant projection of a stored CalDavConnection row plus // Conn is the dial-relevant projection of a stored CalDavConnection row plus
+4 -4
View File
@@ -11,10 +11,10 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
+1 -1
View File
@@ -31,7 +31,7 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
) )
// Conn is the dial-relevant projection of a stored CardDavConnection row // Conn is the dial-relevant projection of a stored CardDavConnection row
+4 -4
View File
@@ -10,10 +10,10 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
_ "github.com/jackc/pgx/v5/stdlib" _ "github.com/jackc/pgx/v5/stdlib"
) )
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
) )
// Tenancy phase 1 (DESIGN_TENANCY_ENTITLEMENTS.md): every user belongs to // Tenancy phase 1 (DESIGN_TENANCY_ENTITLEMENTS.md): every user belongs to
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/models" "gitea.federated.computer/Federated_Computer/superbrain/internal/models"
) )
type UserRepo struct{ db *DB } type UserRepo struct{ db *DB }
+4 -4
View File
@@ -14,10 +14,10 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/agent" "gitea.federated.computer/Federated_Computer/superbrain/internal/agent"
"gitea.federated.computer/Federated_Computer/brain/internal/ai" "gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// compileLimiter bounds NL compilations per user (each one is an LLM call). // compileLimiter bounds NL compilations per user (each one is an LLM call).
+7 -7
View File
@@ -19,13 +19,13 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/agent" "gitea.federated.computer/Federated_Computer/superbrain/internal/agent"
"gitea.federated.computer/Federated_Computer/brain/internal/ai" "gitea.federated.computer/Federated_Computer/superbrain/internal/ai"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
) )
// aiKeyMask mirrors the notification-channel mask: write-only secrets. // aiKeyMask mirrors the notification-channel mask: write-only secrets.
+2 -2
View File
@@ -20,8 +20,8 @@ import (
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// maxAPIKeys caps live keys per user — a product limit against credential // maxAPIKeys caps live keys per user — a product limit against credential
+3 -3
View File
@@ -6,9 +6,9 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/markdown" "gitea.federated.computer/Federated_Computer/superbrain/internal/markdown"
"gitea.federated.computer/Federated_Computer/brain/internal/preview" "gitea.federated.computer/Federated_Computer/superbrain/internal/preview"
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
+6 -6
View File
@@ -22,12 +22,12 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/caldav" "gitea.federated.computer/Federated_Computer/superbrain/internal/caldav"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
+7 -7
View File
@@ -27,13 +27,13 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/carddav" "gitea.federated.computer/Federated_Computer/superbrain/internal/carddav"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"math" "math"
"net/http" "net/http"
"regexp" "regexp"
+2 -2
View File
@@ -5,8 +5,8 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"github.com/jackc/pgx/v5/pgconn" "github.com/jackc/pgx/v5/pgconn"
"io" "io"
"log" "log"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"net/http" "net/http"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// Structured export (trust phase): a single owner-scoped JSON archive that is // Structured export (trust phase): a single owner-scoped JSON archive that is
+2 -2
View File
@@ -2,8 +2,8 @@ package handlers
import ( import (
"database/sql" "database/sql"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/kanban" "gitea.federated.computer/Federated_Computer/superbrain/internal/kanban"
"net/http" "net/http"
"strings" "strings"
) )
+6 -6
View File
@@ -23,12 +23,12 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/mcpclient" "gitea.federated.computer/Federated_Computer/superbrain/internal/mcpclient"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
+6 -6
View File
@@ -5,12 +5,12 @@ import (
"database/sql" "database/sql"
"encoding/xml" "encoding/xml"
"errors" "errors"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"gitea.federated.computer/Federated_Computer/brain/internal/signals" "gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
"io" "io"
"net" "net"
"net/http" "net/http"
+8 -8
View File
@@ -35,14 +35,14 @@ import (
"sync" "sync"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/caldav" "gitea.federated.computer/Federated_Computer/superbrain/internal/caldav"
"gitea.federated.computer/Federated_Computer/brain/internal/carddav" "gitea.federated.computer/Federated_Computer/superbrain/internal/carddav"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"gitea.federated.computer/Federated_Computer/brain/internal/webdav" "gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
) )
const nextcloudVerifyTimeout = 25 * time.Second const nextcloudVerifyTimeout = 25 * time.Second
+4 -4
View File
@@ -19,10 +19,10 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/notify" "gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
// errPlanGate answers 403 for features the tenant's plan does not include. // errPlanGate answers 403 for features the tenant's plan does not include.
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// Connected pages (Notion-like upgrades phase 3). // Connected pages (Notion-like upgrades phase 3).
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"net/http" "net/http"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// Page revision history (trust phase). Every committed content version gets // Page revision history (trust phase). Every committed content version gets
+2 -2
View File
@@ -3,8 +3,8 @@ package handlers
import ( import (
"context" "context"
"database/sql" "database/sql"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/markdown" "gitea.federated.computer/Federated_Computer/superbrain/internal/markdown"
"net/http" "net/http"
"strings" "strings"
"time" "time"
+1 -1
View File
@@ -15,7 +15,7 @@ import (
"sort" "sort"
"strings" "strings"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// profileTextFields maps the allowlisted column names to their rune caps. // profileTextFields maps the allowlisted column names to their rune caps.
+3 -3
View File
@@ -3,9 +3,9 @@ package handlers
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"gitea.federated.computer/Federated_Computer/brain/internal/signals" "gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
"net/http" "net/http"
"strings" "strings"
"time" "time"
+1 -1
View File
@@ -2,7 +2,7 @@ package handlers
import ( import (
"database/sql" "database/sql"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"net/http" "net/http"
"strings" "strings"
"time" "time"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"encoding/json" "encoding/json"
"net/http" "net/http"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// Recoverable deletions (trust phase). // Recoverable deletions (trust phase).
+1 -1
View File
@@ -1,7 +1,7 @@
package handlers package handlers
import ( import (
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"net/http" "net/http"
) )
+6 -6
View File
@@ -25,12 +25,12 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"gitea.federated.computer/Federated_Computer/brain/internal/webdav" "gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
) )
const ( const (
+1 -1
View File
@@ -9,7 +9,7 @@ import (
"strings" "strings"
"testing" "testing"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// machineReq calls the API with an API-key Bearer header and no cookies — // machineReq calls the API with an API-key Bearer header and no cookies —
+2 -2
View File
@@ -7,8 +7,8 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/scripts" "gitea.federated.computer/Federated_Computer/superbrain/internal/scripts"
) )
// AUTH_MODE=oidc (core/federated shape): Authelia exclusively. Password // AUTH_MODE=oidc (core/federated shape): Authelia exclusively. Password
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// fakeCaldav is a mutable RFC 4791 server for integration tests: a home at // fakeCaldav is a mutable RFC 4791 server for integration tests: a home at
+2 -2
View File
@@ -16,8 +16,8 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/signals" "gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
"github.com/emersion/go-imap/backend/memory" "github.com/emersion/go-imap/backend/memory"
imapserver "github.com/emersion/go-imap/server" imapserver "github.com/emersion/go-imap/server"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
+4 -4
View File
@@ -3,10 +3,10 @@ package http
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"io" "io"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
+2 -2
View File
@@ -3,8 +3,8 @@ package http
import ( import (
"context" "context"
"encoding/json" "encoding/json"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/signals" "gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
"github.com/emersion/go-imap/backend/memory" "github.com/emersion/go-imap/backend/memory"
imapserver "github.com/emersion/go-imap/server" imapserver "github.com/emersion/go-imap/server"
"io" "io"
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
) )
// fakeNextcloud serves all three DAV protocols on ONE origin with the // fakeNextcloud serves all three DAV protocols on ONE origin with the
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/notify" "gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
) )
// fakeWebhook captures one Slack-style POST for the delivery tests. // fakeWebhook captures one Slack-style POST for the delivery tests.
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/notify" "gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
) )
// fakeSignalBridge mimics a signal-cli REST bridge: POST /v2/send?account=... // fakeSignalBridge mimics a signal-cli REST bridge: POST /v2/send?account=...
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
) )
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// fakeSMTP is a minimal loopback SMTP relay: it speaks just enough of the // fakeSMTP is a minimal loopback SMTP relay: it speaks just enough of the
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"gitea.federated.computer/Federated_Computer/brain/internal/scripts" "gitea.federated.computer/Federated_Computer/superbrain/internal/scripts"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
"os" "os"
+6 -6
View File
@@ -6,12 +6,12 @@ import (
"os" "os"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/auth" "gitea.federated.computer/Federated_Computer/superbrain/internal/auth"
"gitea.federated.computer/Federated_Computer/brain/internal/authguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/authguard"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/handlers" "gitea.federated.computer/Federated_Computer/superbrain/internal/handlers"
"gitea.federated.computer/Federated_Computer/brain/internal/oidc" "gitea.federated.computer/Federated_Computer/superbrain/internal/oidc"
) )
// NewServer builds the HTTP server with all routes registered. // NewServer builds the HTTP server with all routes registered.
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
) )
// Tenancy phase 1: every account-creation path lands the user in the // Tenancy phase 1: every account-creation path lands the user in the
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"testing" "testing"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/notify" "gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
) )
var unsubTokenRx = regexp.MustCompile(`/unsubscribe\?token=([0-9a-f.]+)`) var unsubTokenRx = regexp.MustCompile(`/unsubscribe\?token=([0-9a-f.]+)`)
+3 -3
View File
@@ -10,9 +10,9 @@ import (
"sync" "sync"
"testing" "testing"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
"gitea.federated.computer/Federated_Computer/brain/internal/webdav" "gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
) )
// fakeShare is a mutable minimal RFC 4918 server (Basic-auth erwin/s3cret) // fakeShare is a mutable minimal RFC 4918 server (Basic-auth erwin/s3cret)
+1 -1
View File
@@ -3,7 +3,7 @@ package kanban
import ( import (
"context" "context"
"database/sql" "database/sql"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
var DefaultColumns = []struct{ Label, Color, Key string }{{"Inbox", "#64748b", "INBOX"}, {"To Do", "#3b82f6", "TODO"}, {"In Progress", "#f59e0b", "IN_PROGRESS"}, {"Done", "#22c55e", "DONE"}} var DefaultColumns = []struct{ Label, Color, Key string }{{"Inbox", "#64748b", "INBOX"}, {"To Do", "#3b82f6", "TODO"}, {"In Progress", "#f59e0b", "IN_PROGRESS"}, {"Done", "#22c55e", "DONE"}}
+2 -2
View File
@@ -32,8 +32,8 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
// ErrNotConfigured means SMTP_HOST/SMTP_FROM are unset; callers surface a // ErrNotConfigured means SMTP_HOST/SMTP_FROM are unset; callers surface a
+1 -1
View File
@@ -2,7 +2,7 @@ package markdown
import ( import (
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"net/http" "net/http"
"regexp" "regexp"
"strings" "strings"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"strings" "strings"
"testing" "testing"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
) )
// Review L-11: link destinations are wrapped and escaped so parentheses or // Review L-11: link destinations are wrapped and escaped so parentheses or
+2 -2
View File
@@ -23,7 +23,7 @@ import (
mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp" mcpsdk "github.com/modelcontextprotocol/go-sdk/mcp"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
) )
// Conn is the dial-relevant projection of a stored McpConnection row plus // Conn is the dial-relevant projection of a stored McpConnection row plus
@@ -91,7 +91,7 @@ func httpClient(conn Conn) *http.Client {
// ListTools connects, initializes and lists the server's tools, then closes // ListTools connects, initializes and lists the server's tools, then closes
// the session. The context bounds the whole exchange. // the session. The context bounds the whole exchange.
func ListTools(ctx context.Context, conn Conn) ([]Tool, error) { func ListTools(ctx context.Context, conn Conn) ([]Tool, error) {
client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.5"}, nil) client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.7"}, nil)
var transport mcpsdk.Transport var transport mcpsdk.Transport
hc := httpClient(conn) hc := httpClient(conn)
switch conn.Transport { switch conn.Transport {
+4 -4
View File
@@ -27,10 +27,10 @@ import (
"strings" "strings"
"time" "time"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/mailer" "gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
) )
// Kinds is the phase-1 channel set (mirrors the NotificationChannel CHECK). // Kinds is the phase-1 channel set (mirrors the NotificationChannel CHECK).
+4 -4
View File
@@ -28,10 +28,10 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/entitlements" "gitea.federated.computer/Federated_Computer/superbrain/internal/entitlements"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
+3 -3
View File
@@ -13,9 +13,9 @@ import (
"encoding/hex" "encoding/hex"
"strings" "strings"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/mailer" "gitea.federated.computer/Federated_Computer/superbrain/internal/mailer"
) )
// unsubscribeDomain separates these MACs from every other use of the // unsubscribeDomain separates these MACs from every other use of the
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"regexp" "regexp"
"strings" "strings"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
) )
var placeholderPatterns = []*regexp.Regexp{ var placeholderPatterns = []*regexp.Regexp{
+2 -2
View File
@@ -3,8 +3,8 @@ package preview
import ( import (
"context" "context"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
"golang.org/x/net/html" "golang.org/x/net/html"
"io" "io"
"net" "net"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"golang.org/x/crypto/bcrypt" "golang.org/x/crypto/bcrypt"
"os" "os"
"strings" "strings"
+1 -1
View File
@@ -2,7 +2,7 @@ package signals
import ( import (
"context" "context"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"log" "log"
"sync" "sync"
"time" "time"
+4 -4
View File
@@ -6,10 +6,10 @@ import (
"database/sql" "database/sql"
"errors" "errors"
"fmt" "fmt"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
"github.com/emersion/go-imap" "github.com/emersion/go-imap"
"github.com/emersion/go-imap/client" "github.com/emersion/go-imap/client"
"log" "log"
+53 -1
View File
@@ -26,10 +26,11 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"path" "path"
"strconv"
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/netguard" "gitea.federated.computer/Federated_Computer/superbrain/internal/netguard"
) )
// Conn is the dial-relevant projection of a stored WebDavConnection row plus // Conn is the dial-relevant projection of a stored WebDavConnection row plus
@@ -146,6 +147,13 @@ func List(ctx context.Context, conn Conn) (*ListResult, error) {
if rel != "" { if rel != "" {
dirURL += "/" dirURL += "/"
} }
if dials > 1 {
select {
case <-ctx.Done():
return nil, ctx.Err()
case <-time.After(walkPace):
}
}
entries, err := propfindEntries(ctx, conn, dirURL) entries, err := propfindEntries(ctx, conn, dirURL)
if err != nil { if err != nil {
return nil, err return nil, err
@@ -218,7 +226,13 @@ type parsed struct {
// propfind issues a PROPFIND with the given Depth and returns the raw // propfind issues a PROPFIND with the given Depth and returns the raw
// response (caller closes the body). Both Check and List build the same // response (caller closes the body). Both Check and List build the same
// request; only Depth differs. // request; only Depth differs.
//
// Rate limits (429/503 — Nextcloud throttles bursty PROPFIND walks) are
// retried up to rateRetries times, honoring Retry-After (capped at
// rateWaitCap so a hostile server cannot pin the sync); without the header
// a short linear backoff applies. Every wait is ctx-bound.
func propfind(ctx context.Context, conn Conn, target, depth string) (*http.Response, error) { func propfind(ctx context.Context, conn Conn, target, depth string) (*http.Response, error) {
for attempt := 0; ; attempt++ {
req, err := http.NewRequestWithContext(ctx, "PROPFIND", target, strings.NewReader(propfindBody)) req, err := http.NewRequestWithContext(ctx, "PROPFIND", target, strings.NewReader(propfindBody))
if err != nil { if err != nil {
return nil, err return nil, err
@@ -229,8 +243,46 @@ func propfind(ctx context.Context, conn Conn, target, depth string) (*http.Respo
if err != nil { if err != nil {
return nil, fmt.Errorf("could not reach the WebDAV share: %w", err) return nil, fmt.Errorf("could not reach the WebDAV share: %w", err)
} }
if (res.StatusCode == http.StatusTooManyRequests || res.StatusCode == http.StatusServiceUnavailable) && attempt < rateRetries {
wait := rateLimitWait(res.Header.Get("Retry-After"), attempt)
_ = res.Body.Close()
select {
case <-ctx.Done():
return nil, fmt.Errorf("could not reach the WebDAV share: %w", ctx.Err())
case <-time.After(wait):
}
continue
}
return res, nil return res, nil
} }
}
const (
rateRetries = 3
rateWaitCap = 30 * time.Second
rateWaitDefault = 5 * time.Second
// walkPace spaces directory PROPFINDs so a bounded walk stays under
// common server rate limits instead of tripping them and paying
// Retry-After waits on every request.
walkPace = 100 * time.Millisecond
)
// rateLimitWait parses Retry-After (delay-seconds form; the HTTP-date form
// falls back to the default) and caps it. attempt is zero-based.
func rateLimitWait(header string, attempt int) time.Duration {
if secs, err := strconv.Atoi(strings.TrimSpace(header)); err == nil && secs >= 0 {
d := time.Duration(secs) * time.Second
if d > rateWaitCap {
d = rateWaitCap
}
return d
}
d := rateWaitDefault * time.Duration(attempt+1)
if d > rateWaitCap {
d = rateWaitCap
}
return d
}
const propfindBody = `<?xml version="1.0" encoding="utf-8"?>` + const propfindBody = `<?xml version="1.0" encoding="utf-8"?>` +
`<propfind xmlns="DAV:"><prop>` + `<propfind xmlns="DAV:"><prop>` +
+49
View File
@@ -197,3 +197,52 @@ func TestNormalizeBasePercentSafety(t *testing.T) {
t.Fatalf("double or missing encoding: %q", got) t.Fatalf("double or missing encoding: %q", got)
} }
} }
// A 429 with Retry-After is retried, not fatal: the walk recovers once the
// throttle window passes (Nextcloud rate-limits bursty PROPFIND walks).
func TestListRetriesRateLimit(t *testing.T) {
allowPrivate(t)
hits := 0
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hits++
if hits == 1 {
w.Header().Set("Retry-After", "1")
http.Error(w, "slow down", http.StatusTooManyRequests)
return
}
w.Header().Set("Content-Type", "application/xml")
w.WriteHeader(http.StatusMultiStatus)
_, _ = w.Write([]byte(`<multistatus xmlns="DAV:">` +
`<response><href>/dav/</href><propstat><prop><resourcetype><collection/></resourcetype></prop></propstat></response>` +
`<response><href>/dav/a.txt</href><propstat><prop><resourcetype/><getetag>"A1"</getetag></prop></propstat></response>` +
`</multistatus>`))
}))
t.Cleanup(ts.Close)
res, err := List(context.Background(), Conn{BaseURL: ts.URL + "/dav", Username: davUser, Password: davPass})
if err != nil {
t.Fatalf("429 then 207 must recover: %v", err)
}
if len(res.Files) != 1 || res.Files[0].Path != "a.txt" || hits != 2 {
t.Fatalf("retry walk wrong: files=%v hits=%d", res.Files, hits)
}
}
// Persistent 429s stay bounded: exactly rateRetries+1 attempts, then the
// server's answer surfaces (no infinite retry loop pinning the sync tick).
func TestListRateLimitBounded(t *testing.T) {
allowPrivate(t)
hits := 0
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
hits++
w.Header().Set("Retry-After", "0")
http.Error(w, "slow down", http.StatusTooManyRequests)
}))
t.Cleanup(ts.Close)
_, err := List(context.Background(), Conn{BaseURL: ts.URL + "/dav", Username: davUser, Password: davPass})
if err == nil || !strings.Contains(err.Error(), "429") {
t.Fatalf("persistent 429 must surface: %v", err)
}
if hits != rateRetries+1 {
t.Fatalf("attempts = %d, want %d", hits, rateRetries+1)
}
}
+5 -5
View File
@@ -12,17 +12,17 @@ import (
"strings" "strings"
"time" "time"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
crypt "gitea.federated.computer/Federated_Computer/brain/internal/crypto" crypt "gitea.federated.computer/Federated_Computer/superbrain/internal/crypto"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/outbound" "gitea.federated.computer/Federated_Computer/superbrain/internal/outbound"
) )
const ( const (
tick = 5 * time.Minute // engine cadence tick = 5 * time.Minute // engine cadence
syncEvery = 30 * time.Minute // per-connection freshness target syncEvery = 30 * time.Minute // per-connection freshness target
perTick = 10 // connections claimed per tick perTick = 10 // connections claimed per tick
syncTimeout = 3 * time.Minute // one full reconcile syncTimeout = 6 * time.Minute // one full reconcile (large walks pace + retry 429s)
lastErrCap = 500 lastErrCap = 500
dialBudget = 10 // outbound.Reserve window per owner (tests + syncs) dialBudget = 10 // outbound.Reserve window per owner (tests + syncs)
dialWindow = time.Minute dialWindow = time.Minute
+10 -10
View File
@@ -3,16 +3,16 @@ package main
import ( import (
"context" "context"
"errors" "errors"
"gitea.federated.computer/Federated_Computer/brain/internal/agent" "gitea.federated.computer/Federated_Computer/superbrain/internal/agent"
"gitea.federated.computer/Federated_Computer/brain/internal/caldav" "gitea.federated.computer/Federated_Computer/superbrain/internal/caldav"
"gitea.federated.computer/Federated_Computer/brain/internal/carddav" "gitea.federated.computer/Federated_Computer/superbrain/internal/carddav"
"gitea.federated.computer/Federated_Computer/brain/internal/config" "gitea.federated.computer/Federated_Computer/superbrain/internal/config"
"gitea.federated.computer/Federated_Computer/brain/internal/db" "gitea.federated.computer/Federated_Computer/superbrain/internal/db"
"gitea.federated.computer/Federated_Computer/brain/internal/http" "gitea.federated.computer/Federated_Computer/superbrain/internal/http"
"gitea.federated.computer/Federated_Computer/brain/internal/notify" "gitea.federated.computer/Federated_Computer/superbrain/internal/notify"
"gitea.federated.computer/Federated_Computer/brain/internal/scripts" "gitea.federated.computer/Federated_Computer/superbrain/internal/scripts"
"gitea.federated.computer/Federated_Computer/brain/internal/signals" "gitea.federated.computer/Federated_Computer/superbrain/internal/signals"
"gitea.federated.computer/Federated_Computer/brain/internal/webdav" "gitea.federated.computer/Federated_Computer/superbrain/internal/webdav"
"log" "log"
stdhttp "net/http" stdhttp "net/http"
"os" "os"
+1 -1
View File
@@ -7,7 +7,7 @@ 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 = "0.3.5" version = "0.3.7"
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"
+1 -1
View File
@@ -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__ = "0.3.5" __version__ = "0.3.7"