Commit graph

6073 commits

Author SHA1 Message Date
Rohan Verma
820f541f08
Merge pull request #1439 from AnishSarkar22/fix/mention-documents
feat: improve composer mentions and connector account selection
2026-05-26 13:37:18 -07:00
Rohan Verma
5f4d62c225
Merge pull request #1437 from AnishSarkar22/fix/electron-nextjs
feat: improve desktop updates, branding, and local server lifecycle
2026-05-26 13:36:58 -07:00
Anish Sarkar
b8450e60d5 refactor(web): update Switch component styles in ComposerAction for improved layout and consistency 2026-05-27 01:41:37 +05:30
Anish Sarkar
dbf235cbda feat(web): enhance composer suggestion skeleton, improve document mention picker loading states & improved LLM prompt block for connector mentions 2026-05-27 00:43:50 +05:30
Anish Sarkar
17293125ef feat(web): implement recent mention management in document mention picker and enhance composer component 2026-05-27 00:26:44 +05:30
Anish Sarkar
79f5e8f88c feat(web): add connector display definitions and enhance composer suggestion components 2026-05-26 22:40:22 +05:30
Anish Sarkar
2d134439ec feat(web): enhance mention handling to support connectors and improve document key management 2026-05-26 21:52:04 +05:30
Anish Sarkar
a41b16b73e feat(web): enhance chat context and mention handling with connector support 2026-05-26 21:11:53 +05:30
Anish Sarkar
701ae800b4 feat(web): refactor sign-in button and composer components to use Button component 2026-05-26 18:27:02 +05:30
Anish Sarkar
9cd3de9ec1 feat(web): update mention components to use Button component and enhance styling 2026-05-26 16:50:40 +05:30
Anish Sarkar
d445974838 feat(web): enhance inline mention editor and thread components with suggestion trigger info and anchor rect 2026-05-26 14:36:46 +05:30
Anish Sarkar
0d65a2e4e3 feat(web): implement composer suggestion popover and integrate with document mention picker 2026-05-26 13:37:59 +05:30
Anish Sarkar
baba31ab43 feat(tray): refactor context menu creation for improved screenshot functionality and quit option 2026-05-26 12:23:41 +05:30
Anish Sarkar
7276210403 feat(auto-updater, ui): rename DesktopUpdatePrompt with DesktopUpdateToast 2026-05-26 11:57:50 +05:30
Rohan Verma
e1abbf7424
Merge pull request #1436 from suryo12/refactor/1360-shrink-documents-panel-interface
refactor(web): shrink LayoutShell.documentsPanel interface (fixes #1360)
2026-05-25 20:09:12 -07:00
Anish Sarkar
bf4e60d224 feat(menu, dev-tools): enhance menu with view options and enable dev tools in development mode 2026-05-26 03:55:16 +05:30
Anish Sarkar
98697f1dd6 feat(auto-updater, menu): implement update state management and enhance menu options for updates 2026-05-26 03:11:06 +05:30
Anish Sarkar
6cf0f07366 refactor(auto-updater): remove native install dialog and streamline update notification handling 2026-05-26 02:38:23 +05:30
Anish Sarkar
c0fefa4db1 feat(auto-updater, ui): implement update notification and installation prompt in desktop application 2026-05-25 23:24:26 +05:30
Anish Sarkar
74fff64779 feat(menu): add Privacy Policy and Terms of Service options to the application menu 2026-05-25 22:26:14 +05:30
Anish Sarkar
79378db7c8 refactor(connector): streamline connector telemetry imports and clean up unused constants 2026-05-25 22:21:34 +05:30
Anish Sarkar
26fe4d7493 feat(auto-updater, menu): enhance update management and add menu options for updates and policies 2026-05-25 21:44:31 +05:30
suryo12
20b8b99938 refactor(web): shrink LayoutShell.documentsPanel interface (fixes #1360)
The `documentsPanel` prop on `LayoutShell` declared `isDocked` and
`onDockedChange` alongside `open` / `onOpenChange`, but the shell never
forwarded those two extra fields to its consumers. `RightPanel` already
defines its own interface accepting only `open` / `onOpenChange`, and
`DocumentsSidebar` keeps both as optional props with safe fallbacks for
the rare cases that pass them directly.

Trim the interface to the two fields the shell actually plumbs through
and drop the matching `isDocumentsDocked` state and prop entries from
`LayoutDataProvider`, which was the only caller still populating the
dead fields (`FreeLayoutDataProvider` already passed the minimal pair).
`DocumentsSidebar` itself is untouched — its props remain optional so
direct consumers that want docking behaviour can still wire it.
2026-05-25 22:06:44 +07:00
Anish Sarkar
96da8498e6 Merge remote-tracking branch 'upstream/dev' into fix/electron-nextjs 2026-05-25 18:01:06 +05:30
Anish Sarkar
fe797e65d6 refactor(deep-links, quick-ask, window): replace localhost references with dynamic server origin retrieval 2026-05-25 17:55:03 +05:30
Anish Sarkar
a2847664c8 feat(server): enhance server management with process forking and implement server origin retrieval 2026-05-25 17:52:10 +05:30
Anish Sarkar
7be4231ad4 feat(app): update product name to 'SurfSense' and implement server shutdown on app quit 2026-05-25 17:45:27 +05:30
Rohan Verma
18c66409a0
Merge pull request #1433 from suryo12/fix/roles-manager-orphaned-hasPermission
fix(web): remove orphaned hasPermission inline body in roles-manager
2026-05-24 18:50:48 -07:00
Rohan Verma
ba18d932e6
Merge pull request #1432 from suryo12/refactor/1358-jotai-slideout-tick
refactor(web): replace slideout panel window event with jotai atom (f…
2026-05-24 18:50:17 -07:00
suryo12
d571cb23fa refactor(web): use last-seen-tick comparison for slideout listener
Replace the boolean "skip first render" ref with a ref that stores the
previously-seen tick value. The effect now compares against the stored
value and only fires when it differs, which makes the dependency
naturally used (removes the `void slideoutOpenedTick;` acknowledgement)
and self-documents the intent of the guard.

Behavior is unchanged — both forms preserve the one-shot-per-event
semantics of the prior window-event implementation. The JSDoc on
`slideoutOpenedTickAtom` is updated to describe the new pattern.
2026-05-24 18:13:36 +07:00
suryo12
29d5ee5465 fix(web): remove orphaned hasPermission inline body in roles-manager
PR #1428 (issue #1366) extracted the inline `hasPermission` callback into
a shared `canPerform` helper but left the original arrow-function body,
its dependency array, and trailing `)` behind after the new
`useCallback` block. The result was a syntactically invalid statement
that broke `pnpm build` on the `dev` branch and is now blocking every
E2E job in the PR queue.

Delete the orphaned lines so the file parses again. No behavior change —
the working `useCallback(canPerform(access, permission))` already
supplies the same predicate the duplicated body did.
2026-05-24 17:23:27 +07:00
Rohan Verma
63e5943cc8
Merge pull request #1431 from dekalouis/refactor/1361-prompt-config-use-mutation-atom
refactor: migrate PromptConfigManager save to updateSearchSpaceMutationAtom
2026-05-24 02:48:46 -07:00
suryo12
ddae506631 refactor(web): replace slideout panel window event with jotai atom (fixes #1358)
Replace the `SLIDEOUT_PANEL_OPENED_EVENT` window event with a
`slideoutOpenedTickAtom` jotai atom. The dispatcher in
`SidebarSlideOutPanel` now bumps the tick via `useSetAtom`, and the
listener in `Thread` reads it via `useAtomValue` and reacts on change
behind a ref guard that skips the initial render — preserving the
one-shot-per-open semantics of the previous event.

This removes the implicit cross-module string contract, makes the
signal traceable through React DevTools / jotai inspector, and lets
TypeScript catch typos that the string-based event API silently
swallowed.
2026-05-24 16:41:47 +07:00
dekalouis
f382cb296c refactor: migrate PromptConfigManager save to updateSearchSpaceMutationAtom 2026-05-24 15:26:40 +07:00
Rohan Verma
d53866d87d
Merge pull request #1430 from suryo12/refactor/1362-oauth-typed-contract
refactor(web): centralize OAuth callback cookie contract (fixes #1362)
2026-05-23 15:53:51 -07:00
Rohan Verma
69388fc710
Merge pull request #1429 from CREDO23/fix-desktop-redirects
[Fixes] Packaged desktop: connector redirect + linux launcher icon
2026-05-23 15:51:59 -07:00
Rohan Verma
ee87747b37
Merge pull request #1428 from guangyang1206/fix/extract-shared-haspermission-helper-1366
refactor: extract shared hasPermission helper (MODSetter/SurfSense#1366)
2026-05-23 15:51:34 -07:00
Rohan Verma
06bcc85287
Merge pull request #1426 from guangyang1206/fix/1375-move-getConnectorTelemetryMeta-to-lib
fix: move getConnectorTelemetryMeta from components/ to lib
2026-05-23 15:50:59 -07:00
Rohan Verma
da4ba09d88
Merge pull request #1427 from AnishSarkar22/feat/opentelemetry
feat: OpenTelemetry integration
2026-05-23 15:50:20 -07:00
suryo12
aa86534a52 refactor(web): centralize OAuth callback cookie contract (fixes #1362)
Replace the duplicated `OAUTH_RESULT_COOKIE` constant and inline payload
type across the callback route and connector dialog hook with a shared
`contracts/types/oauth.types.ts` module that exports:

- OAUTH_RESULT_COOKIE constant
- oauthCallbackResultSchema Zod schema
- OAuthCallbackResult type (inferred from the schema)
- parseOAuthCallbackResult() helper that returns null on invalid JSON
  or shape mismatch

The route handler now uses the shared type to constrain the cookie
payload at compile time. The consumer hook validates the cookie value
through the helper instead of an unchecked JSON.parse, removing the
silent runtime risk when the cookie is tampered with or its shape
drifts.
2026-05-23 23:22:18 +07:00
Anish Sarkar
98e3950dc8 Merge remote-tracking branch 'upstream/dev' into feat/opentelemetry 2026-05-23 03:21:08 +05:30
Anish Sarkar
6302939a72 feat(docs): add observability documentation 2026-05-23 03:18:25 +05:30
Anish Sarkar
4c8d47617d feat(env): add SURFSENSE_ENV variable for deployment environment and update observability resource attributes 2026-05-23 02:13:24 +05:30
Anish Sarkar
df698e0216 feat(observability): integrate OpenTelemetry collector and configuration for enhanced telemetry 2026-05-23 00:17:23 +05:30
CREDO23
fa75d7c54c fix(desktop): ship multi-size icons so linux launchers can find them
electron-builder was given a single 2048x2048 icon.png and dumped it into
hicolor/2048x2048/apps/, a bucket no Linux desktop environment indexes —
launchers and taskbar fell back to a generic placeholder. Pre-render the
standard sizes (16, 32, 48, 64, 128, 256, 512, 1024) and point linux.icon
at the directory so each PNG lands in the matching hicolor/NxN/apps/ slot.

Tray icon was unaffected (loaded at runtime via Electron's Tray API from
bundled resources, no theme lookup).
2026-05-22 20:04:21 +02:00
CREDO23
d5284b3076 fix(desktop): bind bundled Next.js on localhost to keep window origin stable
Setting HOSTNAME=0.0.0.0 made Next.js standalone canonicalize request.url to
http://0.0.0.0:PORT. The connector OAuth callback's NextResponse.redirect built
its Location from that URL, so navigating it flipped window.location.origin from
http://localhost:PORT to http://0.0.0.0:PORT. The backend CORS allowlist matches
localhost/127.0.0.1 only, blocking every subsequent API call until app restart —
producing the "no internet" / app-down state after connecting any connector.
2026-05-22 19:37:19 +02:00
CREDO23
b9403b1720 feat(desktop): emit PostHog events for OAuth redirect intercept and miss
Adds two diagnostic events to surface OAuth-redirect failures we can't
reproduce on Linux:

- desktop_oauth_redirect_intercepted fires from inside onBeforeRequest
  with the original host, path, and target port — confirms the rewrite
  actually ran.
- desktop_oauth_redirect_missed fires from a read-only onCompleted
  listener when a /dashboard/*/connectors/callback URL lands off-localhost,
  meaning the rewrite filter didn't catch it. This is the smoking-gun
  event for "connector OAuth dies on mac/win" reports.

Read-only; no behavior change.
2026-05-22 18:40:06 +02:00
CREDO23
1b6c238c68 refactor(desktop): harden OAuth redirect rewrite for host variants and self-hosters
The interceptor previously matched a strict `${HOSTED_FRONTEND_URL}/*`
prefix and did a naive String.replace, which broke whenever the backend
NEXT_FRONTEND_URL differed at all (apex vs www, http vs https, or a
self-hosted domain). Now:

- Match by host: apex + www. sibling, both http and https.
- Rewrite via URL parsing so only protocol/host change; query strings
  containing the host as a value are left intact.
- Read HOSTED_FRONTEND_URL through getHostedFrontendUrl() which honors
  a SURFSENSE_HOSTED_FRONTEND_URL_OVERRIDE env var, letting self-hosters
  point their builds at their own frontend without rebuilding.

Default behavior is identical when override is unset and backend host
matches the baked-in value.
2026-05-22 18:39:47 +02:00
CREDO23
fe98c17b1d fix(desktop): declare surfsense:// scheme in macOS Info.plist
Linux registered the scheme via desktop-file MIME, but mac.extendInfo
never declared CFBundleURLTypes, leaving install-time LaunchServices
unaware of the protocol. The runtime app.setAsDefaultProtocolClient
call still runs as a fallback.
2026-05-22 18:39:27 +02:00
CREDO23
6ee7c04d02 fix(desktop): recover deep-link URL from argv on win/linux cold start
setupDeepLinks() only listened for second-instance and open-url events.
On Windows/Linux a fresh launch via `surfsense://` delivers the URL in
argv of the first instance, where it was silently dropped. Scan argv on
setup so the existing handlePendingDeepLink() pass picks it up.
2026-05-22 18:39:22 +02:00