Skip to content

Libraries: mount several indexes at once, read only beside the knowledge base - #338

Merged
mattshax merged 1 commit into
mainfrom
libraries
Sep 12, 2026
Merged

mattshax merged 1 commit into
mainfrom
libraries

Conversation

@mattshax

Copy link
Copy Markdown
Member

The Studio built and owned its index, which suited a knowledge base and nothing else. It now mounts libraries: the knowledge base is the first, writable, and every request that does not name a library means it, so nothing that existed before changes. Any other library is read only: a site's root-built GUFI index or one someone handed over, reached through a local tree with an optional source root.

Registry (server/src/libraries.ts): libraries come from the deployment (STUDIO_LIBRARIES, pinned; also an Additional Libraries field on the deploy form) or from Settings > Libraries, where an administrator adds one by path and the Studio probes the tree first (a GUFI index, the Studio's full-text tables, vectors, source readable). Nothing is asked of GUFI and nothing is written into the index.

Addressing: a library parameter on every corpus and index route, defaulting to the primary. gufi.ts functions take an index root (per-root caches), kb.ts a source root. Read-only libraries refuse upload, move, rename, delete, labels, and re-index with a 403; a library with no files on this host answers 409 on file routes and the viewer says why. Chat tools read from the library the conversation names.

Client: the Library rail header becomes the switcher when more than one library is mounted; the current library rides on every API call from one place (api.ts) and on deep links as &lib=<id>. STUDIO_SECTIONS chooses which sections appear, so a site can run an index viewer with no assistant.

Verified against a real second GUFI index on the dev server: probe reported capabilities per library; listing, filename search, and file reads followed the named library; the primary was untouched; mutations on the read-only library were refused (403), no-files library answered 409, unknown answered 404.

Tests: 8 new server tests (registry, probe, addressing, guards, config), 3 new web tests (URL suffix, switcher, deep links). 182 server and 12 web tests pass. Docs: docs/LIBRARIES.md, README, ARCHITECTURE, .env.example, both deploy workflows.

Not yet: enrichment sidecars for read-only libraries, the Query page's scope, cross-library search, remote libraries through GUFI's client.

…knowledge base

The Studio built and owned its index, which suited a knowledge base and
nothing else. It now mounts libraries: the knowledge base is the first,
writable, and every request that does not name a library means it, so
nothing that existed before has changed. Any other library is read only,
a site's root-built GUFI index or one someone handed over, reached
through a local tree with an optional source root.

The registry lives in libraries.ts. Libraries come from the deployment
(STUDIO_LIBRARIES, pinned, also a field on the deploy form) or from
Settings, where an administrator adds one by path and the Studio probes
the tree first: a GUFI index, the Studio's full-text tables, vectors, and
whether the source is readable. Nothing is asked of GUFI and nothing is
written into the index.

Addressing is a library parameter on every corpus and index route,
defaulting to the primary; the index functions take an index root and
the corpus functions a source root, with per-root caches. A read-only
library refuses upload, move, rename, delete, labels, and re-index with
a 403 that says so, and the interface does not offer them. A library
with no files on this host can be searched and described but not
opened: the file routes answer 409 and the viewer says why. The chat
tools read from the library the conversation names.

On the client the Library rail header becomes the switcher when more
than one library is mounted; the current library rides on every API
call from one place, and on deep links as &lib=<id>, so a shared link
and a reload land in the right library. STUDIO_SECTIONS chooses which
sections appear, so a site can run an index viewer with no assistant.

Verified against a real second GUFI index mounted on the dev server:
the probe reported each library's capabilities, listing and filename
search and file reads followed the named library, the primary was
untouched, and mutations on the read-only library were refused.

Not yet: enrichment sidecars for read-only libraries, the Query page's
scope, searching across libraries, and remote libraries through GUFI's
client. Each builds on this rather than changing it.
@mattshax
mattshax merged commit 45977e4 into main Sep 12, 2026
3 of 4 checks passed
@mattshax
mattshax deleted the libraries branch September 12, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant