Commit graph

6040 commits

Author SHA1 Message Date
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
CREDO23
d97b2830c5 fix: resolve desktop KB prompt self-contradiction on chunk_ids
The citations fix (cacb27e0) added a "Chunk citations in your prose"
section to system_prompt_desktop.md telling the KB subagent to always
leave `evidence.chunk_ids` null and emit no `[citation:...]` markers in
desktop mode, but left the pre-existing line declaring that
`chunk_ids` apply to `<priority_documents>` hits. The two rules
contradicted each other; the model picked one per turn.

Strike the stale conditional clause and point at the dedicated section
as the single source of truth. Matches the parallel line in
system_prompt_cloud.md and the already-consistent
system_prompt_readonly_desktop.md.
2026-05-22 17:24:57 +02:00
Anish Sarkar
51e4d8b489 feat(tasks): enhance Celery task telemetry with queue metadata and latency tracking 2026-05-22 18:19:38 +05:30
Anish Sarkar
7a3b278b75 feat(connectors): add retry and auth telemetry events 2026-05-22 17:50:02 +05:30
Anish Sarkar
c4abbd6e20 feat(pipeline): enrich ETL and indexing failure telemetry 2026-05-22 17:49:46 +05:30
Anish Sarkar
6e03ab044a feat(tasks): measure Celery queue latency 2026-05-22 17:49:02 +05:30
Anish Sarkar
dc893281ba feat(chat): add model retry and stream lifecycle events 2026-05-22 17:48:43 +05:30
Anish Sarkar
dbb652d4f8 feat(observability): add telemetry error and event helpers 2026-05-22 17:48:01 +05:30
Anish Sarkar
0fe2bba5a8 refactor(chat): replace TooltipIconButton with Button for scroll functionality 2026-05-22 17:46:35 +05:30
Anish Sarkar
87a4dcfd05 feat(tasks): record indexing heartbeat metrics 2026-05-22 13:50:32 +05:30
Anish Sarkar
7c07c220fc feat(connectors): add connector sync spans 2026-05-22 13:49:59 +05:30
Anish Sarkar
4e3a6dff46 feat(etl): instrument extraction spans and outcomes 2026-05-22 13:49:42 +05:30
Anish Sarkar
8bca29fe0d feat(agents): track subagent invocation telemetry 2026-05-22 13:48:57 +05:30
Anish Sarkar
5a6b92c2b6 feat(chat): instrument streamed chat request telemetry 2026-05-22 13:48:19 +05:30
Anish Sarkar
f7f49de109 feat(observability): add chat subagent and ETL telemetry primitives 2026-05-22 13:47:50 +05:30
Anish Sarkar
21d9b1f218 fix(observability): sanitize outbound HTTP span URLs 2026-05-22 13:47:10 +05:30
guangyang1206
a1397a51b5 fix: move getConnectorTelemetryMeta from components/ to lib/ to fix dependency inversion
lib/posthog/events.ts was importing from components/assistant-ui/...,
creating an inverted dependency layer (lib → components).

Move ConnectorTelemetryMeta type, CONNECTOR_TELEMETRY_REGISTRY,
getConnectorTelemetryMeta, and getReauthEndpoint into the new
lib/connector-telemetry.ts module so that lib/ no longer depends upward
into the UI tree.

connector-constants.ts now re-exports from the new module for
backward compatibility.

Fixes #1375
2026-05-22 12:15:20 +08:00
DESKTOP-RTLN3BA\$punk
fc3b39483b Merge commit '334729754f' into dev 2026-05-21 21:14:15 -07:00
DESKTOP-RTLN3BA\$punk
1990125458 feat: update Privacy Policy with detailed data collection practices and usage information 2026-05-21 21:13:30 -07:00
guangyang1206
a66d65a835 refactor: extract shared hasPermission helper (MODSetter/SurfSense#1366)
- Add canPerform() helper function to members-query.atoms.ts
- Add usePermissionGate() hook for convenience
- Update team-content.tsx to use canPerform()
- Update roles-manager.tsx to use canPerform()
- Eliminates duplicated permission check logic
- Centralizes permission policy in one location

Fixes #1366
2026-05-22 12:08:05 +08:00
Rohan Verma
334729754f
Merge pull request #1424 from MODSetter/dev
feat: added adsense on /free page
2026-05-21 21:05:33 -07:00
DESKTOP-RTLN3BA\$punk
c381dd5ba9 Merge commit '49dd8409d8' into dev 2026-05-21 21:04:48 -07:00
DESKTOP-RTLN3BA\$punk
2eaf4fbce1 feat: added adsense on /free page 2026-05-21 21:01:10 -07:00
Rohan Verma
49dd8409d8
Merge pull request #1423 from MODSetter/dev
feat: improved agent speed and fixed it citations
2026-05-21 14:47:13 -07:00
DESKTOP-RTLN3BA\$punk
2e589091d8 feat: bumped version to 0.0.25 2026-05-21 14:44:33 -07:00
DESKTOP-RTLN3BA\$punk
5cfcf4ac82 Merge commit '0f98480096' into dev 2026-05-21 14:43:00 -07:00
DESKTOP-RTLN3BA\$punk
cacb27e007 fix: citations in agent responses 2026-05-21 14:41:32 -07:00
DESKTOP-RTLN3BA\$punk
1a4400c923 refactor(env): streamline BACKEND_URL usage in GoogleLoginButton and DocumentTabContent; update connector-status-config for Composio Google Drive connector maintenance 2026-05-21 13:37:55 -07:00
Anish Sarkar
cea5605e32 feat(indexing): track indexing and connector outcomes 2026-05-21 23:03:43 +05:30
Anish Sarkar
b9d76f006d feat(retriever): instrument knowledge base search 2026-05-21 23:03:31 +05:30
Anish Sarkar
53691f9c51 feat(agents): track permission and compaction events 2026-05-21 23:02:54 +05:30
Anish Sarkar
ea3d0a6463 feat(agents): emit metrics for model and tool calls 2026-05-21 23:02:36 +05:30
Anish Sarkar
6095b48b5f feat(observability): add SurfSense metric helpers 2026-05-21 23:02:20 +05:30
Anish Sarkar
eb2e2b253b feat(observability): add OpenTelemetry process bootstrap 2026-05-21 23:01:54 +05:30