Fixes#1368
Previously, was duplicated in 4 places with 3 subtly different fallback behaviors:
1. inline-citation.tsx: returned on error
2. markdown-text.tsx: returned on error
3. assistant-message.tsx: returned on error
4. citation.tsx: returned on error
Created canonical in that:
- Returns
- Strips prefix from hostname
- Returns on invalid URL (safest contract)
Updated all 4 call sites:
- inline-citation.tsx: (preserves original fallback)
- markdown-text.tsx: (preserves original fallback)
- assistant-message.tsx: (drop-in, both return )
- citation.tsx: (drop-in, both return )
Co-authored-by: guangyang1206 <guangyang1206@users.noreply.github.com>
Fixes#1370
Object.values() produces order-dependent cache keys because the order of values depends on the order of keys in the object. This causes the same logical query to produce different cache keys when the parameter object has keys in different orders.
Added stableEntries() helper that:
1. Filters out undefined values
2. Sorts entries by key name
3. Returns flat array of [key, value] pairs
This ensures cache key identity is stable regardless of parameter object key order.
Co-authored-by: guangyang1206 <guangyang1206@users.noreply.github.com>
This commit modifies various metadata and canonical URLs in the SurfSense application to ensure consistency by using "https://www.surfsense.com" instead of "https://surfsense.com". Changes were made in layout files, blog posts, and SEO components to reflect this update.
- Slot MCPTrustedTools in mcp-service-config (gated on connector.id > 0) so
any connected MCP-backed connector exposes a revoke surface for
approve_always grants.
- Add new mcp-trusted-tools.tsx (audit + revoke list) and
connectorsApiService.untrustMCPTool() that backs it.
- Drop the redundant row-level Disconnect from ConnectorAccountsListView:
Manage now leads to the edit view whose own Disconnect is the single
source of truth. Remove the now-dead onDisconnect prop, confirm-flow
state, and handleDisconnectFromList hook callback + return entry.
The 'Always Allow' button is now driven entirely by the server-supplied
allowed_decisions palette. The card no longer peeks at
context.mcp_connector_id to decide whether to render the button, and no
longer fires a separate trust-tool HTTP call on click - one
{type: 'approve_always'} dispatch is enough; the agent middleware
handles the in-memory promotion and (for MCP tools) the database save
via its trusted_tool_saver callback.
Drops the dead trustMCPTool / untrustMCPTool service helpers - they had
no remaining callers after this rework. The backing HTTP routes are
kept on the server as a programmatic surface.
- Add formatThreadTimestamp() to surfsense_web/lib/format-date.ts
- Use shared helper in AllPrivateChatsSidebar and AllSharedChatsSidebar
- Remove unused date-fns format import from both sidebar files
- Centralises timestamp formatting policy for future i18n/relative-time changes
- Added a new endpoint `/stripe/finalize-checkout` to synchronously fulfill a checkout session, addressing the webhook-vs-redirect race condition.
- Updated the `PurchaseSuccessPage` component to handle various states of the checkout process, including loading, completed, pending, and failed states.
- Introduced a new response model `FinalizeCheckoutResponse` to provide immediate feedback on the purchase status.
- Enhanced the Stripe API service to include the new finalize checkout functionality.
- Added `enableCitations` prop to `MarkdownViewer` to support interactive citation badges.
- Updated instances of `MarkdownViewer` across various components to utilize the new citation feature.
- Enhanced citation processing in `PlateEditor` for read-only views, ensuring citations are rendered correctly without affecting markdown serialization.
- Refactored citation handling in `InlineCitation` and `MarkdownText` to improve citation context management.
Fixes#1241
The docs bundle was importing `{ icons }` from lucide-react, which pulls
the entire Lucide icon library (~1 400 SVGs, ~500 kB of JS) into the Next.js
docs bundle even though only nine icons are used in docs frontmatter and
meta.json files.
Replace with a hand-maintained DOCS_ICONS whitelist that imports only the
icons that are actually referenced (BookOpen, ClipboardCheck, Compass,
Container, Download, FlaskConical, Heart, Unplug, Wrench).
To add a new docs icon: import it from lucide-react and add it to the
DOCS_ICONS record. The icon() callback remains the same for callers.
- Updated `content_hash` in the `Document` model to remove global uniqueness, allowing identical content across different paths.
- Enhanced `_create_document` function to handle path uniqueness and prevent session-poisoning from `IntegrityError`.
- Added detailed comments for clarity on the changes and their implications.
- Introduced new citation handling in the editor for improved user experience with citation jumps.
- Updated package dependencies in the frontend for better functionality.