Skip to content

feat(generic): add generic resource tab, refactor home structure, and UI polish#3803

Merged
waleedlatif1 merged 8 commits intostagingfrom
feat/generic
Mar 27, 2026
Merged

feat(generic): add generic resource tab, refactor home structure, and UI polish#3803
waleedlatif1 merged 8 commits intostagingfrom
feat/generic

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add generic Results resource tab infrastructure — types, SSE wiring, registry entry, placeholder component (wiring commented out pending rich UI from Emir)
  • Unify tool panel behavior into a single `TOOL_PANEL_BEHAVIOR` map as the source of truth for all resource routing logic
  • Add `isEphemeralResource` helper to centralize ephemeral resource filtering (generic + streaming-file) across persistence guards
  • Fix `RESOURCE_INVALIDATORS` type to use `Exclude<MothershipResourceType, 'generic'>` for compile-time exhaustiveness
  • Remove competing `animate-slide-in-right` animation from resource panel open — single CSS width transition with expo-out curve for smoother reveal
  • Reduce resource panel default width from 60% to 50%
  • Rename `_components` → `components` in user-input and search-modal (non-standard naming convention)
  • Move `use-auto-scroll`, `use-streaming-reveal`, `use-animated-placeholder` to shared `hooks/` (used across features, not home-only)
  • Colocate `chat-message-attachments` at home components level (shared by both mothership-chat and workflow chat)
  • Remove `isResourceAnimatingIn` state machinery (redundant after transition cleanup)

Type of Change

  • New feature
  • Improvement / refactor

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 27, 2026 7:13am

Request Review

@cursor
Copy link

cursor bot commented Mar 27, 2026

PR Summary

Medium Risk
Mostly UI refactors, but it deletes a large chunk of (landing) components and rewires chat/auth flows, which could cause routing/build or styling regressions if any removed exports are still referenced.

Overview
Introduces a shared AUTH_SUBMIT_BTN class and removes the BrandedButton component + related global CSS, updating auth/SSO/verify/reset/consent and chat auth pages to use plain <button> elements with consistent loader states.

Reworks the public chat experience to match the landing theme (dark variables), including a substantial ChatInput redesign (textarea auto-sizing, drag/drop + attachment thumbnails, mic/send/stop controls) plus header/loading/message styling tweaks.

Cleans up/reshapes the site structure by removing most (landing) UI components/exports and retargeting shared imports (e.g., GitHub stars action and useAnimatedPlaceholder) to new locations, and adds coverage to ensure PATCH /api/chat/manage/:id preserves an existing password when not explicitly updated.

Written by Cursor Bugbot for commit 161bf02. Configure here.

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR adds the infrastructure for a generic "Results" resource tab, refactors resource-routing logic into a single source of truth, and polishes several UI/structural details across the home feature.\n\nKey changes:\n\n- TOOL_PANEL_BEHAVIOR map (resource-extraction.ts): replaces the old flat RESOURCE_TOOL_NAMES set with a typed dedicated/deferred/excluded map covering ~40 tools, making routing intent explicit and keeping shouldOpenGenericResource as a clean open-world default for unlisted tools.\n- isEphemeralResource helper: centralises the streaming-file and generic exclusion pattern; persistChatResources, removeResource.mutate, and reorderResources.mutate all now use it — no more scattered r.id !== 'streaming-file' checks.\n- generic resource type: added to MothershipResourceType, RESOURCE_REGISTRY, and resource-content.tsx; RESOURCE_INVALIDATORS is tightened to Exclude<MothershipResourceType, 'generic'> for compile-time exhaustiveness. The GenericResourceContent placeholder and the SSE wiring in use-chat.ts are intentionally staged (call sites commented out pending a richer UI).\n- Animation cleanup: removes isResourceAnimatingIn state machinery and the competing animate-slide-in-right class; the resource panel now uses a single CSS width transition with an expo-out curve.\n- Structural housekeeping: shared hooks moved to hooks/, _componentscomponents rename, chat-message-attachments colocation, and onCloseAutoFocus focus-trap fix in the resource dropdown.

Confidence Score: 4/5

Safe to merge — no runtime regressions introduced; the only concern is staged helper declarations that may surface as linting warnings.

The core logic changes are well-structured and type-safe. Prior concerns (whitelabeling regression, duplicated auth button styles) have been resolved. The one remaining item is that genericEntryMap, appendGenericEntry, and updateGenericEntry are declared in live code in use-chat.ts with all call sites commented out, which may trigger no-unused-vars linting warnings. Everything else — persistence guards, registry exhaustiveness, animation cleanup, structural refactoring — is clean.

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts (staged helper declarations without active call sites)

Important Files Changed

Filename Overview
apps/sim/lib/copilot/resource-extraction.ts Replaces flat RESOURCE_TOOL_NAMES set with a comprehensive TOOL_PANEL_BEHAVIOR map (dedicated/deferred/excluded); adds isEphemeralResource, shouldOpenGenericResource, and isDeferredResourceTool helpers — clean, well-documented refactor.
apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts Adds genericResourceData state/ref, reset paths, and staged helper functions (genericEntryMap, appendGenericEntry, updateGenericEntry) — helpers are fully implemented but have no active call sites (all commented out), which may trigger linting warnings.
apps/sim/lib/copilot/resources.ts Replaces hardcoded r.id !== 'streaming-file' guard in persistChatResources with isEphemeralResource(r), correctly excluding both generic and streaming-file resources from DB persistence.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-registry/resource-registry.tsx Adds generic entry to RESOURCE_REGISTRY with TerminalWindow icon; tightens RESOURCE_INVALIDATORS to Exclude<MothershipResourceType, 'generic'> and adds an early-return guard in invalidateResourceQueries — compile-time safe.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-tabs/resource-tabs.tsx Guards removeResource.mutate and reorderResources.mutate with isEphemeralResource so ephemeral tabs never trigger server mutations; reorder correctly sends only persistable resources to the server while local ordering is preserved.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/resource-content/generic-resource-content.tsx New placeholder GenericResourceContent with auto-scroll, empty state, and per-entry status/streaming rendering; explicitly marked for replacement by a richer UI.
apps/sim/app/workspace/[workspaceId]/home/home.tsx Removes the redundant isResourceAnimatingIn state machine; wires genericResourceData from useChat down to MothershipView; simplifies animate-slide-in-right to a single CSS width transition.
apps/sim/app/_styles/globals.css Removes now-unused .branded-button-gradient and .branded-button-custom CSS classes as part of the auth button consolidation; change is additive-safe (classes were only referenced by the deleted hook).
apps/sim/lib/copilot/resource-types.ts Extends MothershipResourceType union with 'generic'; one-line change that unlocks exhaustive-switch checking across the codebase.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SSE tool_call event] --> B{TOOL_PANEL_BEHAVIOR lookup}
    B -->|dedicated| C[Open dedicated resource tab\ntable / file / workflow / knowledgebase]
    B -->|deferred| D{Does tool_result\nproduce a resource?}
    B -->|excluded| E[No resource panel update]
    B -->|not in map| F[TODO: Open generic Results tab\ncommented out]
    D -->|yes| C
    D -->|no| F

    C --> G{isEphemeralResource?}
    F --> G
    G -->|false| H[persistChatResources\nto DB]
    G -->|true streaming-file or generic| I[Client-only state only\nskip DB + skip remove mutation\nskip reorder mutation]
Loading

Reviews (2): Last reviewed commit: "fix(auth): extract shared auth button cl..." | Re-trigger Greptile

- Extract AUTH_SUBMIT_BTN constant to (auth)/components/auth-button-classes.ts,
  replacing 10 copy-pasted identical className strings across 7 files
- Update SSOLoginButton primary variant to use AUTH_SUBMIT_BTN instead of
  hardcoded purple gradient, making it consistent with all other auth form
  submit buttons
- Fix missing isEphemeralResource import in lib/copilot/resources.ts
  (was re-exported but not available in local scope)
@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@waleedlatif1 waleedlatif1 merged commit 5f1d5e0 into staging Mar 27, 2026
3 checks passed
@waleedlatif1 waleedlatif1 deleted the feat/generic branch March 27, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant