feat(ai-chat-companion): floating widget + composables + NcAppSidebar#197
Merged
Conversation
Implements the nextcloud-vue side of the ai-chat-companion 3-spec chain (hydra ADR-034). Adds a single line auto-mount via CnAppRoot — consuming apps get a Conduction-Cobalt hex FAB and a context-aware chat panel for free. NEW components (src/components/CnAiCompanion/): - CnAiCompanion.vue — top-level mount, OR health probe, no-op fallback - CnAiFloatingButton.vue — Conduction-Cobalt (#4376fc) hex with white AI sparkles icon (Material Design Creation), pointy-top point-up per brand rule. Solid colour, no gradients. - CnAiChatPanel.vue — built on NcAppSidebar (proper NC theming + a11y + slide animation) with NcActionButton secondary actions for Start new chat and History. - CnAiMessageList.vue, CnAiInput.vue — message rendering and input. NEW dialog (src/dialogs/, per ADR-004 file-isolation rule): - CnAiHistoryDialog.vue — NcDialog overlay listing past conversations. NEW composables (src/composables/): - useAiContext() — injects the reactive cnAiContext provided by CnAppRoot. - useAiChatStream() — owns the SSE lifecycle via @microsoft/fetch- event-source (handles POST bodies, abort signals, automatic reconnect, frame parsing). Falls back to POST /api/chat/send on 404/501 with synthetic final event. MODIFIED: - CnAppRoot.vue — provides reactive cnAiContext; auto-mounts <CnAiCompanion /> as the last NcContent child so the embedded NcAppSidebar slides in from the right. - CnIndexPage / CnDetailPage / CnDashboardPage — push pageKind, registerSlug, schemaSlug, objectUuid into cnAiContext on created() + watch + beforeDestroy. - l10n/en.json + l10n/nl.json — 13 new keys + Dutch translations. - src/index.js + src/types/index.d.ts — barrel exports. Demo: examples/ai-chat-companion-demo/ — standalone harness with mocked OR backend (health, /api/chat/stream, /api/chat/conversations). Tests: Vitest mount + behaviour tests for every new component and composable. tests/__mocks__/fetch-event-source.js mocks the SSE library so unit tests run without a real OR backend. Depends on the hydra ai-chat-companion spec.
This was referenced May 11, 2026
rubenvdlinde
added a commit
that referenced
this pull request
May 11, 2026
…t spec The mount-level in-memory manifest tests previously asserted axios.get was never called. After the AI Chat Companion (#197) was merged onto beta, the CnAiCompanion child issues an unrelated GET /apps/openregister/api/chat/health during mount. Filter axios.get calls to /api/manifest endpoints so the REQ-IMM-002 / REQ-IMM-004 guarantees stay meaningful without colliding with the new health probe.
Contributor
|
🎉 This PR is included in version 1.0.0-beta.31 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Summary
Implements the
nextcloud-vueside of theai-chat-companion3-spec chain (hydra ADR-034).Consuming apps get a Conduction-Cobalt hex FAB + context-aware chat panel auto-mounted via
CnAppRoot— a single line in any app that already wraps inCnAppRoot. No install-time PHP dep on OpenRegister (runtime HTTP only, gracefully no-ops when OR is unreachable).New components
src/components/CnAiCompanion/CnAiFloatingButton.vue— Conduction-Cobalt (#4376fc) hex with white AI sparkles icon (Material DesignCreation). Pointy-top point-up per the brand rule. Solid colour, no gradients. Hover#2e5ed9. Respectsprefers-reduced-motion. Position prop accepts four corners.CnAiCompanion.vue— top-level mount, OR health probe at startup, no-op fallback (renders nothing if OR unreachable, no console warnings above info).CnAiChatPanel.vue— built onNcAppSidebar(proper NC theming + a11y + slide animation) withNcActionButtonsecondary actions for Start-new-chat and History. Slides in from the right edge.CnAiMessageList.vue— user / assistant / system roles, NcRichText for assistant markdown, plain text for user, tool-call / tool-result inline with collapse-to-summary, isError highlighting.CnAiInput.vue— multi-line textarea + send, Enter to send, Shift+Enter for newline.src/dialogs/(per ADR-004 file-isolation rule)CnAiHistoryDialog.vue—NcDialog-based history browser, fetchesGET /api/chat/conversations?limit=50, empty / loading / error states.New composables
useAiContext()— injects the reactivecnAiContext.useAiChatStream()— owns the SSE lifecycle via@microsoft/fetch-event-source(handles POST bodies, abort signals, auto-reconnect, frame parsing). Falls back toPOST /api/chat/sendon 404 / 501 with synthetic final event so message-rendering code has one path.Modified
CnAppRoot.vue— provides reactivecnAiContext; auto-mounts<CnAiCompanion />as the lastNcContentchild so the embeddedNcAppSidebarslides from the right.CnIndexPage/CnDetailPage/CnDashboardPage— pushpageKind,registerSlug,schemaSlug,objectUuidintocnAiContextoncreated()+watch+beforeDestroy.l10n/en.json+l10n/nl.json— 13 keys + Dutch translations.src/index.js+src/types/index.d.ts— exports.Demo
examples/ai-chat-companion-demo/ships a standalone harness with mocked OR backend (health,/api/chat/stream,/api/chat/conversations).Browser-verified
Mounted via
file:link in decidesk against the real OR backend: hex FAB renders bottom-right (verifiedcn-ai-floating-button__hexelement +rgb(67, 118, 252)background +creation-iconclass). NcAppSidebar slides in from the right with title, subtitle, sparkles empty state, and the message input.Dependencies
Depends on the hydra ai-chat-companion spec landing first (defines the contracts) and the sibling openregister/ai-chat-companion-orchestrator for the real SSE backend (widget no-ops gracefully without it).
Test plan
openspec validate ai-chat-companion-widget --strictpassesnpm run lintcleannpm testgreennpm run buildESM + CJS + extracted CSS no new warnings