fix(console): gate the AI surface on the service-ai capability (discovery), not the agent catalog#1992
Merged
Merged
Conversation
…he agent catalog useAiSurfaceEnabled now keys off discovery's `services.ai` (isAiEnabled) — i.e. whether the enterprise @objectstack/service-ai capability is present — instead of a non-empty agent catalog. service-ai is an enterprise capability; a Community-Edition runtime doesn't ship it, so the framework doesn't register the AI service and discovery reports services.ai unavailable → the whole AI surface hides. An install that has service-ai reports it available → AI shows. The presence of the CAPABILITY gates, not whether a specific agent is configured yet. The earlier catalog-based gating was a workaround for the headless service-ai reporting itself available in CE. The framework now only registers the AI service when the host app declares @objectstack/service-ai (objectstack-ai/framework#2311), so discovery is an honest edition signal and the catalog detour is gone. Everything else from the original gating stays: the centralized hook, the RequireAiSurface /ai route guard, the gated top-bar link + designer "Ask AI" buttons, and AiChatPage's graceful empty state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
os-zhuang
added a commit
that referenced
this pull request
Jun 25, 2026
…ot discovery (per-user AI seat) (#1993) Reverts objectui#1992. `useAiSurfaceEnabled` keys off `GET /api/v1/ai/agents` again (>= 1 agent → AI shows). That route is now access-filtered server-side (framework ADR-0049 / ADR-0068): it returns only the agents the CALLER may chat, so a user WITHOUT the per-user AI seat (`ai_seat`) gets an empty catalog and the ENTIRE AI surface — FAB, `/ai` routes, top-bar + designer "Ask AI" — hides for them, instead of showing a control that 403s on click. #1992 had moved the gate to the deployment-wide discovery `services.ai` capability, which is identical for every user and so cannot express per-user seating — the wrong signal for the AI-seat gate. Community-Edition gating is unaffected (no service-ai → no agents → empty catalog → hidden). Updated the hook docs with a "do NOT flip back to discovery" note so the per-user dimension isn't dropped again. app-shell builds clean; useAiSurface tests (4) green. The catalog's per-user filtering is proven server-side (framework branch feat/ai-seat-catalog-filter): seated user → ['build','ask'], seat-less → []. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to #1987 (and the framework's #2311).
@objectstack/service-aiis an enterprise capability — the Community Edition does not depend on it. So the console's AI gate should key off whetherservice-aiis present (discovery'sservices.ai), not the agent catalog.#1987 gated on a non-empty agent catalog as a workaround: at the time, a CE-shaped runtime still loaded the headless AI service and reported
services.ai: availablewith no agents, so a discovery-based gate would have shown AI with nothing behind it. The framework now (#2311) only registers the AI service when the host app declares@objectstack/service-ai, so discovery is an honest edition signal:service-ai) →services.ai: { enabled: false, status: "unavailable" }→ AI surface hides.service-aipresent) →services.ai: available→ AI shows — even if no specific agent is configured yet (the capability is what matters; AiChatPage degrades gracefully on an empty catalog).What changed
Only
useAiSurfaceEnabled:Everything else from #1987 stays — the centralized hook, the
RequireAiSurface/airoute guard, the gated top-bar AI link + designer "Ask AI" buttons, and AiChatPage's graceful "AI unavailable" empty state.resolveAiApiBaseis kept (HomePage still uses it for its per-agent CTAs).Verification
tscclean; console fulltsc && vite buildclean.useAiSurface.test.ts(discovery on/off/loading).services.ai: unavailablewhen noservice-ai) was established end-to-end in framework fix(components): also toast form submit errors so they're visible past the fold #2311.🤖 Generated with Claude Code