Skip to content

Hardcode observer basepath, Use SDK useDMs; remove workspace DM API and hook#69

Merged
willwashburn merged 3 commits intomainfrom
hardcode-observer-basepath
Mar 6, 2026
Merged

Hardcode observer basepath, Use SDK useDMs; remove workspace DM API and hook#69
willwashburn merged 3 commits intomainfrom
hardcode-observer-basepath

Conversation

@willwashburn
Copy link
Copy Markdown
Member

This pull request simplifies the handling of the Next.js basePath for the observer dashboard by hardcoding it to /observer and removing all dynamic or environment-based path logic. It eliminates the withBasePath utility and updates all code to use the /observer prefix directly. Additionally, it removes the custom DMs API hook and endpoint in favor of built-in hooks from the @relaycast/react library, and makes minor workflow adjustments to reflect the new path structure.

Base path handling simplification:

  • Hardcoded the Next.js basePath to '/observer' in next.config.js, removing the need for dynamic or environment-based path configuration. (packages/observer-dashboard/next.config.js)
  • Removed the withBasePath utility and all its usages throughout the codebase, replacing them with direct /observer paths in API calls and asset references. (packages/observer-dashboard/src/lib/basePath.ts, multiple files) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]

API and data fetching improvements:

  • Removed the custom /api/dms endpoint and the useWorkspaceDMs hook, switching to the standard useDMs hook from @relaycast/react for direct DM conversation data. (packages/observer-dashboard/src/app/api/dms/route.ts, packages/observer-dashboard/src/hooks/use-workspace-dms.ts, packages/observer-dashboard/src/components/DashboardLayout.tsx) [1] [2] [3]

Workflow and deployment updates:

  • Updated deployment and workflow files to remove the base-path input and ensure all preview and production URLs include the /observer prefix. (.github/actions/deploy-observer-dashboard/action.yml, .github/workflows/deploy.yml, .github/workflows/preview.yml) [1] [2] [3] [4] [5]

These changes make the observer dashboard's routing and deployment more predictable and maintainable by standardizing on the /observer path and removing unnecessary indirection.

Remove the dynamic basePath handling and hardcode the app to run under /observer. Deleted the withBasePath helper and replaced its usages with explicit "/observer" prefixes (assets and API routes). Also set next.config.js basePath to "/observer", removed the base-path input from the deploy action and workflow, and updated preview workflow checks/messages to include the /observer path. This simplifies routing for deployments served under /observer but requires ensuring the site and API are hosted at that base path.
Replace the local workspace DM implementation with the SDK-provided useDMs hook. Deleted the server API route (src/app/api/dms/route.ts) and the client hook (src/hooks/use-workspace-dms.ts) that previously fetched workspace DMs and handled websocket DM events, and updated DashboardLayout to import useDMs from @relaycast/react instead of the removed hook. This consolidates DM handling onto the SDK hook and removes the custom workspace-level endpoint and related update logic.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes the observer dashboard’s routing by hardcoding the Next.js basePath to /observer, removes the previously dynamic base path plumbing, and simplifies DM data-fetching by switching from a custom workspace DM endpoint/hook to the SDK’s useDMs hook.

Changes:

  • Hardcode basePath: "/observer" and replace all withBasePath(...) usages with explicit /observer/... paths.
  • Remove the custom workspace DM API route and useWorkspaceDMs hook; use useDMs from @relaycast/react instead.
  • Update preview/deploy workflows and the deploy composite action to align URLs and remove base-path inputs.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/observer-dashboard/next.config.js Hardcodes Next.js basePath to /observer.
packages/observer-dashboard/src/lib/basePath.ts Removes dynamic basePath helper.
packages/observer-dashboard/src/lib/auth.ts Updates auth fetches to /observer/api/....
packages/observer-dashboard/src/components/RelaySessionProvider.tsx Updates session check fetch path to /observer/api/....
packages/observer-dashboard/src/components/DashboardLayout.tsx Switches DMs source to useDMs; updates workspace stream API path.
packages/observer-dashboard/src/components/ChatFeed.tsx Updates DM messages fetch path to /observer/api/....
packages/observer-dashboard/src/components/AgentSidebar.tsx Updates logo asset paths to /observer/brand/....
packages/observer-dashboard/src/app/login/page.tsx Updates logo asset paths to /observer/brand/....
packages/observer-dashboard/src/hooks/use-workspace-dms.ts Removes custom workspace DM hook.
packages/observer-dashboard/src/app/api/dms/route.ts Removes custom /api/dms endpoint.
.github/workflows/preview.yml Updates observer preview URL checks/comments to include /observer.
.github/workflows/deploy.yml Removes base-path input to deploy action.
.github/actions/deploy-observer-dashboard/action.yml Removes base-path input/env wiring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "",
basePath: "/observer",
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

Hardcoding Next.js basePath to /observer means requests to the observer hostname root (/) will 404 unless something upstream rewrites/redirects to /observer. The current observer-router worker forwards incoming.pathname unchanged, so it will pass / through to Pages unchanged. Consider adding an explicit redirect/rewrite for / (and possibly any non-/observer/* path) either in the observer-router worker or via a Next.js redirects() rule so the dashboard remains reachable at the bare hostname.

Suggested change
basePath: "/observer",
basePath: "/observer",
async redirects() {
return [
{
source: "/",
destination: "/observer",
permanent: false,
},
];
},

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

Preview deployed!

Environment URL
API https://pr69-api.relaycast.dev
Health https://pr69-api.relaycast.dev/health
Observer https://pr69-observer.relaycast.dev/observer

This preview shares the staging database and will be cleaned up when the PR is merged or closed.

Run E2E tests

npm run e2e -- https://pr69-api.relaycast.dev --ci

Open observer dashboard

https://pr69-observer.relaycast.dev/observer

Delete multiple Next.js edge API route handlers for the observer dashboard (activity, bridge, DM messages, spawned, workspace/stream) and update UI components to use the client Relay SDK directly. ChatFeed now uses useRelay().dmMessages instead of fetching /observer/api/dms, and DashboardLayout uses useRelay() to fetch workspace DMs, subscribe to DM events, and call relay.workspace.stream.get/set for stream status and toggling. Also add conversion helper for DM conversation summaries and adjust types/imports accordingly.
@willwashburn willwashburn merged commit 44bdcc5 into main Mar 6, 2026
4 checks passed
@willwashburn willwashburn deleted the hardcode-observer-basepath branch March 6, 2026 20:53
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.

2 participants