assistant: teach the agent about Search admin

Bring the LLM agent's prompts and tools current with the new /search
section and arcadia-search admin sidecar:

- New tools in admin-tools.ts:
  - list_search_corpora: enumerate tenants + corpora with build status,
    so the agent can pick a real corpus instead of guessing.
  - rebuild_search_corpus(tenant, corpus): isWrite=true, surfaces a
    confirm card. Use after uploads or when results look stale.
- search_kb description updated: names docs / operator-tools / files
  explicitly, and points at list_search_corpora when unsure.
- ARCADIA_KNOWLEDGE: adds search-corpus terminology, /search route,
  and a one-liner pointer to the three new tools.
- assistant.tsx UI_CONTROL_PREFACE: nav-search added, full Search
  page action catalog (search-refresh / -restart / -new-tenant /
  -new-corpus, corpora-search, per-row corpus-{t}-{c}-{rebuild,edit,
  delete,actions}, tenant-{id}-delete, dialog form fields). Recipe
  for the manual rebuild path, plus a note steering the agent to
  the rebuild_search_corpus tool by default.
- search.tsx publishes a "search" surface to admin-context with
  tenants + corpora summary, so the agent gets live state without
  needing a tool call when /search is mounted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jules
2026-05-04 19:17:12 +10:00
parent eb7bc62d14
commit d1469059d8
4 changed files with 105 additions and 4 deletions

View File

@@ -60,6 +60,7 @@ import {
} from "~/lib/search-admin"
import { pageTitle } from "~/lib/page-meta"
import { useSession } from "~/lib/session"
import { useRegisterAdminContext } from "~/lib/admin-context"
export const meta = () => pageTitle("Search")
@@ -140,6 +141,24 @@ export default function SearchRoute() {
return { indexed, docs }
}, [corpora])
// Publish a snapshot to the assistant's admin context so the agent
// can answer "what corpora exist?" / "is the docs corpus indexed?"
// without having to call list_search_corpora.
const adminSurface = useMemo(
() => ({
endpoint: searchAdmin.baseUrl,
tenants: tenants.map((t) => ({ id: t.id, corpus_count: t.corpus_count })),
corpora: corpora.map((c) => ({
tenant: c.tenant,
corpus: c.corpus,
indexed: c.indexed,
num_docs: c.num_docs,
})),
}),
[tenants, corpora],
)
useRegisterAdminContext("search", adminSurface)
const rebuild = useCallback(
async (tenant: string, corpus: string) => {
const id = `${tenant}/${corpus}`