Commit graph

903 commits

Author SHA1 Message Date
CREDO23
4625bd937e feat(web): run history section on automations detail page
Recent runs card under triggers. Each row expands lazily to fetch the
full run (step results, output, artifacts, error). 20-row cap for now;
real pagination lands if usage demands it.
2026-05-28 01:35:48 +02:00
CREDO23
2e572d7818 feat(web): create_automation HITL approval card in chat
Closes the create loop in chat: the agent describes user intent → the
drafter sub-LLM produces an AutomationCreate JSON → this card surfaces
a structured preview → approve persists; reject cancels. Edits flow
through chat refinement (re-call with a refined intent), not in-card,
so the card stays simple and the multi-turn checkpointer carries the
context.

Tool UI (components/tool-ui/automation/):
- create-automation.tsx — entry dispatcher + ApprovalCard chrome
  (pending/processing/complete/rejected via useHitlPhase) + SavedCard
  (links to the detail page) + InvalidCard (lists drafter validation
  issues) + ErrorCard (verbatim message). Rejection result is hidden
  because the approval card itself shows the rejected phase inline.
- automation-draft-preview.tsx — structured preview body: name +
  description + goal, triggers (humanised cron + tz + static-input
  keys), plan steps (step_id → action), and a collapsible raw JSON
  for power users.

Wiring:
- components/tool-ui/index.ts — re-export.
- features/chat-messages/timeline/tool-registry/registry.ts —
  register create_automation → CreateAutomationToolUI (dynamic import,
  same pattern as other connector tools).
- contracts/enums/toolIcons.tsx — Workflow icon + "Create automation"
  display name so fallback chrome (and timeline headers) are honest.

Shared util:
- lib/automations/describe-cron.ts — lifted from the route slice's
  lib/ folder since both the dashboard slice and the new approval card
  now render schedule descriptions. Slice imports updated; the now-
  empty slice lib/ folder is gone.

Backend prompt fragments:
- main_agent/system_prompt/.../create_automation/description.md and
  the tool's docstring no longer promise in-card edits. They make the
  refinement path explicit: if the user wants changes after seeing the
  draft, they reply in chat and the agent calls the tool again with a
  refined intent.

v1 deliberately excludes:
- In-card edit form / right-side edit panel — defer until we see real
  demand. The chat refinement loop covers the common case.
- approve_always / persistent allow rules — automations are a single
  artifact, not a repeated mutation, so the "trust this kind of call"
  affordance doesn't apply.
2026-05-28 01:32:04 +02:00
CREDO23
c0a9ea368f feat(web): automations detail page (definition viewer + trigger manager)
Vertical slice at /dashboard/[id]/automations/[automation_id]. Branches
in the orchestrator are: perms loading → skeleton, no-access → access
denied panel, bad id → not-found, fetch loading → skeleton, fetch
error → not-found, loaded → header + definition + triggers.

Route:
- page.tsx — server boundary; extracts both ids.
- automation-detail-content.tsx — client orchestrator.

Header:
- automation-detail-header.tsx — back link, name, status badge,
  description, pause/resume + delete actions. Delete navigates back to
  the list via a new onDeleted hook on DeleteAutomationDialog so the
  list page (where the row just vanishes) stays unaffected.
- automation-not-found.tsx — 404/403/NaN-id panel. We don't
  distinguish missing vs. forbidden in the UI.

Definition (read-only in v1):
- automation-definition-section.tsx — wrapper Card; renders goal +
  tags + execution defaults + inputs schema (if present) + plan.
- plan-step-card.tsx — one step (when, output_as, retries, timeout,
  params JSON).
- execution-summary.tsx — timeout / max_retries / backoff /
  concurrency + on_failure step count.
- inputs-schema-preview.tsx — formatted JSON of inputs.schema; only
  rendered when the definition declares inputs.

Triggers:
- automation-triggers-section.tsx — wrapper Card, "Add via chat" CTA
  (creation is intent-driven, same philosophy as automations).
- trigger-card.tsx — schedule + timezone + cron, last/next fire
  hints, static_inputs JSON, enable Switch and remove button.
- delete-trigger-dialog.tsx — confirm + mutation atom.

Shared:
- lib/describe-cron.ts — moved out of automation-triggers-summary.tsx
  so both list and detail can describe schedules consistently
  (daily/weekdays/weekly/monthly/hourly, raw cron fallback).

Loading:
- automation-detail-loading.tsx — same shell as the loaded view so the
  layout doesn't jump on data arrival.

RBAC: each interactive surface is independently gated
(canUpdate/canDelete/canCreate) so the orchestrator stays thin and the
component tree is self-documenting about what each action requires.

Out of scope (later PRs):
- Editing definition / trigger params (raw-JSON path) — PR5
- Run history — PR6
2026-05-28 01:21:54 +02:00
CREDO23
bc3c2fd515 fix(web): hide header Create CTA on the automations empty state
The empty-state card already hosts the primary "Create via chat" CTA;
keeping the header button on the same screen showed two identical
buttons. Adds an optional ``showCreateCta`` prop to AutomationsHeader
(default true) and turns it off only in the empty branch so the card
stays the focal point.
2026-05-28 01:14:10 +02:00
CREDO23
fe28833ad4 feat(web): automations list page with status, pause/resume and delete
Vertical slice at /dashboard/[id]/automations. The page is read-only by
default; every action gates on backend automations:* permissions via a
co-located permissions hook so adding/removing surfaces stays a
one-file change.

Route:
- page.tsx — server boundary; extracts search_space_id.
- automations-content.tsx — client orchestrator (loading / no-access /
  error / empty / table branches).

Components (one concern per file):
- automations-header.tsx — title + count + "Create via chat" CTA.
- automations-table.tsx + automation-row.tsx — name/status/updated
  columns; row name links to detail (PR4).
- automation-status-badge.tsx — active / paused / archived pill.
- automation-row-actions.tsx — ⋯ menu with pause/resume + delete,
  gated on canUpdate / canDelete. Archived rows hide the toggle.
- delete-automation-dialog.tsx — destructive confirm; mentions FK
  cascade explicitly so users know triggers/runs go too.
- automations-empty-state.tsx — zero-state pointing to chat (creation
  is intent-driven via the create_automation HITL tool, not a form).
- automations-loading.tsx — skeleton rows in the same shell so the
  layout doesn't shift on data arrival.
- automation-triggers-summary.tsx — small cron-describer (daily,
  weekdays, weekly, monthly, hourly) + timezone for the detail page.
  Kept inline since v1 only registers schedule.

Hooks:
- use-automation-permissions.ts — single source of truth for the
  slice's canCreate/canRead/canUpdate/canDelete/canExecute gates,
  backed by myAccessAtom.

Pause/resume and delete reuse the PR2 mutation atoms, so list +
detail caches stay coherent without bespoke invalidation.

Out of scope (later PRs):
- detail route (definition viewer + triggers manager) — PR4
- raw JSON editor — PR5
- nav entry / sidebar wiring — small follow-up PR
2026-05-28 01:02:48 +02: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
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
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
1a6d1ced43
Merge pull request #1417 from VarunShukla07/fix/env-config-editor-chat-dashboard
refactor(env): replace inline process.env reads with BACKEND_URL in editor, chat, dashboard and settings
2026-05-20 12:14:01 -07:00
Anish Sarkar
61234e125f refactor: remove team memory components and related settings from user and search space settings 2026-05-20 12:01:26 +05:30
Varun Shukla
fead3a64f4 refactor(env): replace inline process.env reads with BACKEND_URL in editor, chat, dashboard and settings 2026-05-20 03:34:22 +05:30
Anish Sarkar
73043a0756 feat: enhance memory API responses with limits and update UI components for memory limit handling 2026-05-20 03:17:05 +05:30
Anish Sarkar
89a8438864 feat: wire memory settings to memory API 2026-05-20 02:02:42 +05:30
Anish Sarkar
d66295aedd chore: ran linting 2026-05-19 21:02:07 +05:30
Anish Sarkar
ee3a6dc45f refactor: enhance DesktopContent and HotkeysContent components with improved loading states, updated styling, and consistent use of separators 2026-05-19 18:22:30 +05:30
Anish Sarkar
1169b43196 refactor: improve styling of MemberRow component and clean up agent tools imports 2026-05-19 17:41:48 +05:30
Anish Sarkar
8fd52d340f refactor: update styling and structure of team content, comment panel, and UI components 2026-05-19 17:34:59 +05:30
Anish Sarkar
78ad19dd6a refactor: enhance PromptsContent with dropdown menu for actions, update loading states, and improve styling consistency 2026-05-19 12:59:02 +05:30
Anish Sarkar
3b168e987d feat: add TeamPage component and remove TeamDialog for improved team management interface 2026-05-19 11:40:06 +05:30
Anish Sarkar
49e1395299 refactor: enhance user settings components with updated icons, improved loading states, and consistent alert structures 2026-05-19 11:11:14 +05:30
Anish Sarkar
d129ddd8f7 refactor: implement new layout structure for search space and user settings with clear ownership 2026-05-19 01:04:59 +05:30
Anish Sarkar
b7a6e3af3d refactor: update alert components across various files to use a consistent structure and styling 2026-05-18 23:46:16 +05:30
Anish Sarkar
e0ecea61f8 refactor: extract user avatar color and initials logic into a new utility module, update related components to use the new functions 2026-05-18 21:40:23 +05:30
Anish Sarkar
b6aed05683 refactor: implement SearchSpaceSettingsPage and SearchSpaceSettingsPanel components, replacing the previous settings dialog and enhancing tab navigation for search space settings 2026-05-18 02:02:45 +05:30
Anish Sarkar
08142f9add refactor: implement UserSettingsPage and UserSettingsPanel components, replacing UserSettingsDialog and enhancing user settings navigation 2026-05-18 01:51:31 +05:30
Anish Sarkar
5bcda6b83b refactor: replace action log sheet with dialog component and update related references 2026-05-18 01:34:41 +05:30
Anish Sarkar
10527ddb7c refactor: implement tab navigation in BuyMorePage and enhance button styles in BuyPagesContent and BuyTokensContent 2026-05-17 23:29:41 +05:30
Anish Sarkar
a49ee05456 refactor: enhance layout structure by introducing WorkspacePanel and updating component styles 2026-05-17 03:17:12 +05:30
Anish Sarkar
bd1d1c42a7 refactor: adjust thread max width and update button sizes in ComposerAction for improved UI consistency 2026-05-17 02:57:00 +05:30
Anish Sarkar
f65bc81509 Merge remote-tracking branch 'upstream/dev' into feat/ui-revamp 2026-05-16 19:26:36 +05:30
CREDO23
c8b756ae8f hitl/wire: rename 'always' decision-type to 'approve_always'
Renames the SurfSense HITL extension decision-type from "always" to
"approve_always" so it sits in the same verb-first family as "approve",
"reject", and "edit". The Python constant is now SURFSENSE_DECISION_APPROVE_ALWAYS;
the wire value, the permission-domain decision_type, and the FE union members
all match (no wire/internal mismatch).

Both the multi_agent_chat permission middleware and the legacy new_chat one
accept the new wire value; the FE types.ts union is updated accordingly.

The "context.always" payload key is intentionally left untouched - it's the
patterns-to-promote field, semantically distinct from the decision type.
2026-05-15 14:47:32 +02:00
Anish Sarkar
56239548c8 refactor: replace Activity icons with Workflow icons across various components for consistency 2026-05-15 00:47:21 +05:30
Anish Sarkar
c180417329 refactor: enhance loading and sidebar components with improved skeleton loading states and styling 2026-05-14 23:28:41 +05:30
Anish Sarkar
3d42712b3f refactor: replace button elements with Button component for improved consistency and styling across multiple UI components 2026-05-14 14:17:44 +05:30
Anish Sarkar
198c38b335 refactor: replace button elements with Button component for consistent styling across various UI components 2026-05-14 13:30:20 +05:30
CREDO23
1bb9f435e5 chat-messages: render and batch-submit multiple HITL approval cards 2026-05-13 21:00:01 +02:00
Anish Sarkar
75b7a9cc6c refactor: update UI components to enhance hover effects and color consistency 2026-05-13 23:53:09 +05:30
Anish Sarkar
a9252913cf refactor: update OnboardPage styling for consistency with main panel design 2026-05-13 18:22:52 +05:30
Anish Sarkar
6aa4dcef60 refactor: update UI components to use consistent popup and text colors 2026-05-13 16:46:35 +05:30
Anish Sarkar
481bb406b6 Merge remote-tracking branch 'upstream/dev' into feat/ui-revamp 2026-05-13 03:02:23 +05:30
DESKTOP-RTLN3BA\$punk
c8374e6c5b feat: improved document, folder mentions rendering
Some checks are pending
Build and Push Docker Images / tag_release (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web) (push) Blocked by required conditions
2026-05-09 22:15:51 -07:00
CREDO23
2ab6b1c757 Merge upstream/dev into feature/multi-agent. 2026-05-09 23:00:56 +02:00
CREDO23
932bf22a34 chat: fix mixed-decision HITL crash and fold resumed assistant messages into the interrupted bubble. 2026-05-09 22:54:07 +02:00
CREDO23
2e132513be chat: unify HITL approval UX behind a single paginated card and harden timeline supersede. 2026-05-09 21:44:54 +02:00
CREDO23
9c5a178468 chat: switch dashboard chat page to slice and drop superseded aborted rows on resume. 2026-05-09 18:35:39 +02:00
DESKTOP-RTLN3BA\$punk
4e174f17f2 chore: linting 2026-05-05 17:08:34 -07:00
DESKTOP-RTLN3BA\$punk
b5be9408f7 Merge commit '9576d1f01f' into dev
Some checks are pending
Build and Push Docker Images / tag_release (push) Waiting to run
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_backend, ./surfsense_backend/Dockerfile, backend, surfsense-backend, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-24.04-arm, linux/arm64, arm64) (push) Blocked by required conditions
Build and Push Docker Images / build (./surfsense_web, ./surfsense_web/Dockerfile, web, surfsense-web, ubuntu-latest, linux/amd64, amd64) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (backend, surfsense-backend) (push) Blocked by required conditions
Build and Push Docker Images / create_manifest (web, surfsense-web) (push) Blocked by required conditions
2026-05-05 01:44:39 -07:00
DESKTOP-RTLN3BA\$punk
6e1dd40597 feat: implement finalize checkout endpoint and update purchase success handling
- 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.
2026-05-05 01:01:12 -07:00
CREDO23
5119915f4f Merge upstream/dev into feature/multi-agent 2026-05-05 01:44:46 +02:00
CREDO23
6a9433c8ff Apply per-card decisions in HITL bundle resume. 2026-05-05 00:22:10 +02:00