user: "What's the current USD/INR rate?"
→ Public web lookup — delegate to the Google Search specialist:
diff --git a/surfsense_backend/app/db.py b/surfsense_backend/app/db.py
index dd13b1274..064b5bff3 100644
--- a/surfsense_backend/app/db.py
+++ b/surfsense_backend/app/db.py
@@ -3041,6 +3041,11 @@ async def create_db_and_tables():
await conn.execute(text("CREATE EXTENSION IF NOT EXISTS vector"))
await conn.execute(text("CREATE EXTENSION IF NOT EXISTS pg_trgm"))
await conn.run_sync(Base.metadata.create_all)
+ # create_all never creates zero_publication (a migration-only
+ # artifact), and without it zero-cache crash-loops. Idempotent.
+ from app.zero_publication import ensure_publication
+
+ await conn.run_sync(ensure_publication)
await setup_indexes()
diff --git a/surfsense_backend/app/zero_publication.py b/surfsense_backend/app/zero_publication.py
index 574b570b8..c44a29dcd 100644
--- a/surfsense_backend/app/zero_publication.py
+++ b/surfsense_backend/app/zero_publication.py
@@ -173,6 +173,37 @@ def apply_publication(conn: Connection) -> None:
conn.execute(text(build_set_table_sql(conn)))
+def ensure_publication(conn: Connection) -> None:
+ """Create ``zero_publication`` if missing, then reconcile if its shape drifted.
+
+ Startup-bootstrap counterpart of migration 116: databases created via
+ ``Base.metadata.create_all`` (dev/test, ``DB_BOOTSTRAP_ON_STARTUP=TRUE``)
+ never run migrations, so without this zero-cache crash-loops on
+ ``Unknown or invalid publications``. Idempotent: when the publication
+ already matches the canonical shape no DDL is emitted, so a normal boot
+ fires no event triggers and never disturbs a running zero-cache.
+ """
+
+ exists = conn.execute(
+ text("SELECT 1 FROM pg_publication WHERE pubname = :name"),
+ {"name": PUBLICATION_NAME},
+ ).fetchone()
+ if not exists:
+ # Seed with one table; the reconcile below sets the full canonical
+ # shape. CREATE PUBLICATION is safe here (unlike in migrations, see
+ # 116_create_zero_publication.py): the publication does not exist, so
+ # no zero-cache replica can be attached to it yet.
+ conn.execute(
+ text(
+ f"CREATE PUBLICATION {_quote_identifier(PUBLICATION_NAME)} "
+ "FOR TABLE notifications"
+ )
+ )
+
+ if verify_publication(conn):
+ conn.execute(text(build_set_table_sql(conn)))
+
+
def _actual_publication_shape(conn: Connection) -> dict[str, list[str] | None]:
rows = conn.execute(
text(
diff --git a/surfsense_backend/scripts/check_zero_publication_bootstrap.py b/surfsense_backend/scripts/check_zero_publication_bootstrap.py
new file mode 100644
index 000000000..e8956992a
--- /dev/null
+++ b/surfsense_backend/scripts/check_zero_publication_bootstrap.py
@@ -0,0 +1,46 @@
+"""Self-check for ensure_publication on a create_all-bootstrapped scratch DB."""
+
+import asyncio
+
+import asyncpg
+from sqlalchemy import text
+from sqlalchemy.ext.asyncio import create_async_engine
+
+SCRATCH_DB = "surfsense_zero_pub_check"
+ADMIN_DSN = "postgresql://postgres:postgres@localhost:5432/postgres"
+SCRATCH_URL = f"postgresql+asyncpg://postgres:postgres@localhost:5432/{SCRATCH_DB}"
+
+
+async def main() -> None:
+ admin = await asyncpg.connect(ADMIN_DSN)
+ await admin.execute(f'DROP DATABASE IF EXISTS "{SCRATCH_DB}" WITH (FORCE)')
+ await admin.execute(f'CREATE DATABASE "{SCRATCH_DB}"')
+ await admin.close()
+
+ from app.db import Base
+ from app.zero_publication import ensure_publication, verify_publication
+
+ engine = create_async_engine(SCRATCH_URL)
+ try:
+ async with engine.begin() as conn:
+ await conn.execute(text("CREATE EXTENSION IF NOT EXISTS vector"))
+ await conn.execute(text("CREATE EXTENSION IF NOT EXISTS pg_trgm"))
+ await conn.run_sync(Base.metadata.create_all)
+ await conn.run_sync(ensure_publication)
+ mismatches = await conn.run_sync(verify_publication)
+ assert not mismatches, f"shape wrong after ensure: {mismatches}"
+
+ # Second call must be a no-op that leaves a verified shape.
+ await conn.run_sync(ensure_publication)
+ mismatches = await conn.run_sync(verify_publication)
+ assert not mismatches, f"shape wrong after re-ensure: {mismatches}"
+ finally:
+ await engine.dispose()
+ admin = await asyncpg.connect(ADMIN_DSN)
+ await admin.execute(f'DROP DATABASE IF EXISTS "{SCRATCH_DB}" WITH (FORCE)')
+ await admin.close()
+
+ print("OK: ensure_publication creates and verifies on a create_all DB, idempotently.")
+
+
+asyncio.run(main())
diff --git a/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-builder-form.tsx b/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-builder-form.tsx
index e6fb96605..1103307eb 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-builder-form.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-builder-form.tsx
@@ -156,10 +156,7 @@ export function AutomationBuilderForm({
if (mode === "edit" && automation) {
return { ...buildUpdatePayload(formForPayload), status: automation.status };
}
- const { workspace_id: _ignored, ...rest } = buildCreatePayload(
- formForPayload,
- workspaceId
- );
+ const { workspace_id: _ignored, ...rest } = buildCreatePayload(formForPayload, workspaceId);
return rest;
}
diff --git a/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-model-fields.tsx b/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-model-fields.tsx
index 7f7ca3138..429b8d37f 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-model-fields.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/automations/components/builder/automation-model-fields.tsx
@@ -51,7 +51,7 @@ export function AutomationModelFields({
errors,
}: AutomationModelFieldsProps) {
const { llm, image, vision, isLoading } = useAutomationEligibleModels();
- const rolesHref = `/dashboard/${workspaceId}/search-space-settings/models`;
+ const rolesHref = `/dashboard/${workspaceId}/workspace-settings/models`;
return (
diff --git a/surfsense_web/app/dashboard/[workspace_id]/client-layout.tsx b/surfsense_web/app/dashboard/[workspace_id]/client-layout.tsx
index 0cd650a9a..b0841d540 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/client-layout.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/client-layout.tsx
@@ -13,7 +13,7 @@ import {
modelConnectionsAtom,
modelRolesAtom,
} from "@/atoms/model-connections/model-connections-query.atoms";
-import { activeWorkspaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { DocumentUploadDialogProvider } from "@/components/assistant-ui/document-upload-popup";
import { LayoutDataProvider } from "@/components/layout";
import { OnboardingTour } from "@/components/onboarding-tour";
diff --git a/surfsense_web/app/dashboard/[workspace_id]/team/page.tsx b/surfsense_web/app/dashboard/[workspace_id]/team/page.tsx
index 4f986b287..c81646e4c 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/team/page.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/team/page.tsx
@@ -1,10 +1,6 @@
import { TeamContent } from "./team-content";
-export default async function TeamPage({
- params,
-}: {
- params: Promise<{ workspace_id: string }>;
-}) {
+export default async function TeamPage({ params }: { params: Promise<{ workspace_id: string }> }) {
const { workspace_id } = await params;
return (
diff --git a/surfsense_web/app/dashboard/[workspace_id]/team/team-content.tsx b/surfsense_web/app/dashboard/[workspace_id]/team/team-content.tsx
index afe640543..23fd111cd 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/team/team-content.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/team/team-content.tsx
@@ -599,7 +599,7 @@ function MemberRow({
- router.push(`/dashboard/${workspaceId}/search-space-settings/team-roles`)
+ router.push(`/dashboard/${workspaceId}/workspace-settings/team-roles`)
}
>
Manage Roles
diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentPermissionsContent.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentPermissionsContent.tsx
index 6cddb2b9e..bb19697f6 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentPermissionsContent.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/AgentPermissionsContent.tsx
@@ -6,7 +6,7 @@ import { AlertTriangle, Info, ShieldCheck, Trash2 } from "lucide-react";
import { useCallback, useMemo, useState } from "react";
import { toast } from "sonner";
import { agentFlagsAtom } from "@/atoms/agent/agent-flags-query.atom";
-import { activeWorkspaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import {
AlertDialog,
diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/DesktopContent.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/DesktopContent.tsx
index 97debca9d..bccc146f0 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/DesktopContent.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/DesktopContent.tsx
@@ -13,9 +13,9 @@ import {
import { Separator } from "@/components/ui/separator";
import { Skeleton } from "@/components/ui/skeleton";
import { Switch } from "@/components/ui/switch";
-import type { SearchSpace } from "@/contracts/types/search-space.types";
+import type { SearchSpace } from "@/contracts/types/workspace.types";
import { useElectronAPI } from "@/hooks/use-platform";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
export function DesktopContent() {
const api = useElectronAPI();
diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/MessagingChannelsContent.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/MessagingChannelsContent.tsx
index 3c1d3aef4..09472fd70 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/MessagingChannelsContent.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/user-settings/components/MessagingChannelsContent.tsx
@@ -17,8 +17,8 @@ import {
} from "@/components/ui/select";
import { Separator } from "@/components/ui/separator";
import { Skeleton } from "@/components/ui/skeleton";
-import type { SearchSpace } from "@/contracts/types/search-space.types";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import type { SearchSpace } from "@/contracts/types/workspace.types";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { authenticatedFetch } from "@/lib/auth-fetch";
import { buildBackendUrl } from "@/lib/env-config";
import { cn } from "@/lib/utils";
diff --git a/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout.tsx b/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout.tsx
index 46aa27ebe..82a7cf3be 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/user-settings/layout.tsx
@@ -11,7 +11,5 @@ export default function UserSettingsLayout({
}) {
const { workspace_id } = use(params);
- return (
- {children}
- );
+ return {children} ;
}
diff --git a/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/layout-shell.tsx b/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/layout-shell.tsx
index 45e1248c6..320dac9ba 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/layout-shell.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/layout-shell.tsx
@@ -76,7 +76,7 @@ export function SearchSpaceSettingsLayoutShell({
const selectedLabel = navItems.find((item) => item.value === activeTab)?.label ?? t("title");
const hrefFor = (tab: SearchSpaceSettingsTab) =>
- `/dashboard/${workspaceId}/search-space-settings/${tab}`;
+ `/dashboard/${workspaceId}/workspace-settings/${tab}`;
return (
diff --git a/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/page.tsx b/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/page.tsx
index 692ba563c..cd1d51f3a 100644
--- a/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/page.tsx
+++ b/surfsense_web/app/dashboard/[workspace_id]/workspace-settings/page.tsx
@@ -6,5 +6,5 @@ export default async function SearchSpaceSettingsPage({
params: Promise<{ workspace_id: string }>;
}) {
const { workspace_id } = await params;
- redirect(`/dashboard/${workspace_id}/search-space-settings/general`);
+ redirect(`/dashboard/${workspace_id}/workspace-settings/general`);
}
diff --git a/surfsense_web/app/dashboard/page.tsx b/surfsense_web/app/dashboard/page.tsx
index c31f0384a..205f8df94 100644
--- a/surfsense_web/app/dashboard/page.tsx
+++ b/surfsense_web/app/dashboard/page.tsx
@@ -6,7 +6,7 @@ import { motion } from "motion/react";
import { useRouter } from "next/navigation";
import { useTranslations } from "next-intl";
import { useEffect, useState } from "react";
-import { searchSpacesAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { searchSpacesAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { CreateSearchSpaceDialog } from "@/components/layout";
import { Button } from "@/components/ui/button";
import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
diff --git a/surfsense_web/app/desktop/login/page.tsx b/surfsense_web/app/desktop/login/page.tsx
index 5f7f6ade2..b8edeba96 100644
--- a/surfsense_web/app/desktop/login/page.tsx
+++ b/surfsense_web/app/desktop/login/page.tsx
@@ -14,7 +14,7 @@ import { Separator } from "@/components/ui/separator";
import { ShortcutKbd } from "@/components/ui/shortcut-kbd";
import { Spinner } from "@/components/ui/spinner";
import { useElectronAPI } from "@/hooks/use-platform";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { getPostLoginRedirectPath } from "@/lib/auth-utils";
type ShortcutKey = "generalAssist" | "quickAsk" | "screenshotAssist";
diff --git a/surfsense_web/app/invite/[invite_code]/page.tsx b/surfsense_web/app/invite/[invite_code]/page.tsx
index fee3f4647..a6423d28d 100644
--- a/surfsense_web/app/invite/[invite_code]/page.tsx
+++ b/surfsense_web/app/invite/[invite_code]/page.tsx
@@ -98,15 +98,11 @@ export default function InviteAcceptPage() {
// Track invite accepted and user added events
trackSearchSpaceInviteAccepted(
- result.search_space_id,
- result.search_space_name,
- result.role_name
- );
- trackSearchSpaceUserAdded(
- result.search_space_id,
- result.search_space_name,
+ result.workspace_id,
+ result.workspace_name,
result.role_name
);
+ trackSearchSpaceUserAdded(result.workspace_id, result.workspace_name, result.role_name);
}
} catch (err: any) {
setError(err.message || "Failed to accept invite");
@@ -117,7 +113,7 @@ export default function InviteAcceptPage() {
const handleDecline = () => {
// Track invite declined event
- trackSearchSpaceInviteDeclined(inviteInfo?.search_space_name);
+ trackSearchSpaceInviteDeclined(inviteInfo?.workspace_name);
router.push("/dashboard");
};
@@ -180,7 +176,7 @@ export default function InviteAcceptPage() {
Welcome to the team!
- You've successfully joined {acceptedData.search_space_name}
+ You've successfully joined {acceptedData.workspace_name}
@@ -190,7 +186,7 @@ export default function InviteAcceptPage() {
-
{acceptedData.search_space_name}
+
{acceptedData.workspace_name}
Search Space
@@ -208,7 +204,7 @@ export default function InviteAcceptPage() {
router.push(`/dashboard/${acceptedData.search_space_id}`)}
+ onClick={() => router.push(`/dashboard/${acceptedData.workspace_id}`)}
>
Go to Search Space
@@ -260,7 +256,7 @@ export default function InviteAcceptPage() {
You're Invited!
- Sign in to join {inviteInfo?.search_space_name || "this search space"}
+ Sign in to join {inviteInfo?.workspace_name || "this search space"}
@@ -270,7 +266,7 @@ export default function InviteAcceptPage() {
-
{inviteInfo?.search_space_name}
+
{inviteInfo?.workspace_name}
Search Space
@@ -307,7 +303,7 @@ export default function InviteAcceptPage() {
You're Invited!
- Accept this invite to join {inviteInfo?.search_space_name || "this search space"}
+ Accept this invite to join {inviteInfo?.workspace_name || "this search space"}
@@ -317,7 +313,7 @@ export default function InviteAcceptPage() {
-
{inviteInfo?.search_space_name}
+
{inviteInfo?.workspace_name}
Search Space
diff --git a/surfsense_web/atoms/agent-tools/agent-tools.atoms.ts b/surfsense_web/atoms/agent-tools/agent-tools.atoms.ts
index 84c6ed841..02e0bf4d4 100644
--- a/surfsense_web/atoms/agent-tools/agent-tools.atoms.ts
+++ b/surfsense_web/atoms/agent-tools/agent-tools.atoms.ts
@@ -2,7 +2,7 @@ import { atom } from "jotai";
import { atomWithQuery } from "jotai-tanstack-query";
import { agentToolsApiService } from "@/lib/apis/agent-tools-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
-import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "../workspaces/workspace-query.atoms";
export const agentToolsAtom = atomWithQuery((_get) => ({
queryKey: cacheKeys.agentTools.all(),
@@ -42,7 +42,7 @@ const hydratedForAtom = atom(null);
*/
export const disabledToolsAtom = atom(
(get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const hydratedFor = get(hydratedForAtom);
if (searchSpaceId && hydratedFor !== searchSpaceId) {
return loadDisabledTools(searchSpaceId);
@@ -50,7 +50,7 @@ export const disabledToolsAtom = atom(
return get(disabledToolsBaseAtom);
},
(get, set, update: string[] | ((prev: string[]) => string[])) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const prev = get(disabledToolsBaseAtom);
const next = typeof update === "function" ? update(prev) : update;
set(disabledToolsBaseAtom, next);
@@ -66,7 +66,7 @@ export const disabledToolsAtom = atom(
* Call this from a useEffect in a component that has access to the search space.
*/
export const hydrateDisabledToolsAtom = atom(null, (get, set) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
if (!searchSpaceId) return;
const stored = loadDisabledTools(searchSpaceId);
set(disabledToolsBaseAtom, stored);
@@ -75,7 +75,7 @@ export const hydrateDisabledToolsAtom = atom(null, (get, set) => {
/** Toggle a single tool's enabled/disabled state */
export const toggleToolAtom = atom(null, (get, set, toolName: string) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const current = get(disabledToolsBaseAtom);
const next = current.includes(toolName)
? current.filter((t) => t !== toolName)
diff --git a/surfsense_web/atoms/automations/automations-mutation.atoms.ts b/surfsense_web/atoms/automations/automations-mutation.atoms.ts
index 288d97c63..021758deb 100644
--- a/surfsense_web/atoms/automations/automations-mutation.atoms.ts
+++ b/surfsense_web/atoms/automations/automations-mutation.atoms.ts
@@ -49,10 +49,10 @@ export const createAutomationMutationAtom = atomWithMutation(() => ({
return automationsApiService.createAutomation(request);
},
onSuccess: (automation, variables) => {
- invalidateList(variables.search_space_id);
+ invalidateList(variables.workspace_id);
toast.success("Automation created");
trackAutomationCreated({
- search_space_id: variables.search_space_id,
+ workspace_id: variables.workspace_id,
automation_id: automation.id,
task_count: variables.definition.plan.length,
trigger_type: variables.triggers?.[0]?.type ?? "none",
@@ -67,7 +67,7 @@ export const createAutomationMutationAtom = atomWithMutation(() => ({
console.error("Error creating automation:", error);
toast.error("Failed to create automation");
trackAutomationCreateFailed({
- search_space_id: variables.search_space_id,
+ workspace_id: variables.workspace_id,
error: error.message,
});
},
@@ -80,20 +80,20 @@ export const updateAutomationMutationAtom = atomWithMutation(() => ({
},
onSuccess: (automation, vars) => {
invalidateDetail(vars.automationId);
- invalidateList(automation.search_space_id);
+ invalidateList(automation.workspace_id);
toast.success("Automation updated");
// A status-only patch (pause/resume/archive) is a distinct action from a
// definition/name edit, so split it into its own event.
if (vars.patch.status && !vars.patch.definition) {
trackAutomationStatusChanged({
automation_id: vars.automationId,
- search_space_id: automation.search_space_id,
+ workspace_id: automation.workspace_id,
next_status: vars.patch.status,
});
} else {
trackAutomationUpdated({
automation_id: vars.automationId,
- search_space_id: automation.search_space_id,
+ workspace_id: automation.workspace_id,
has_definition_change: !!vars.patch.definition,
has_name_change: vars.patch.name != null,
has_description_change: vars.patch.description !== undefined,
@@ -123,7 +123,7 @@ export const deleteAutomationMutationAtom = atomWithMutation(() => ({
toast.success("Automation deleted");
trackAutomationDeleted({
automation_id: vars.automationId,
- search_space_id: vars.searchSpaceId,
+ workspace_id: vars.searchSpaceId,
});
},
onError: (error: Error, vars) => {
diff --git a/surfsense_web/atoms/automations/automations-query.atoms.ts b/surfsense_web/atoms/automations/automations-query.atoms.ts
index 4117f9bc8..104c80356 100644
--- a/surfsense_web/atoms/automations/automations-query.atoms.ts
+++ b/surfsense_web/atoms/automations/automations-query.atoms.ts
@@ -1,5 +1,5 @@
import { atomWithQuery } from "jotai-tanstack-query";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { automationsApiService } from "@/lib/apis/automations-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
@@ -11,7 +11,7 @@ const DEFAULT_LIMIT = 50;
const DEFAULT_OFFSET = 0;
export const automationsListAtom = atomWithQuery((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
queryKey: cacheKeys.automations.list(Number(searchSpaceId ?? 0), DEFAULT_LIMIT, DEFAULT_OFFSET),
@@ -22,7 +22,7 @@ export const automationsListAtom = atomWithQuery((get) => {
return { items: [], total: 0 };
}
return automationsApiService.listAutomations({
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
limit: DEFAULT_LIMIT,
offset: DEFAULT_OFFSET,
});
diff --git a/surfsense_web/atoms/connectors/connector-mutation.atoms.ts b/surfsense_web/atoms/connectors/connector-mutation.atoms.ts
index b928f8631..927ac8572 100644
--- a/surfsense_web/atoms/connectors/connector-mutation.atoms.ts
+++ b/surfsense_web/atoms/connectors/connector-mutation.atoms.ts
@@ -10,10 +10,10 @@ import type {
import { connectorsApiService } from "@/lib/apis/connectors-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
import { queryClient } from "@/lib/query-client/client";
-import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "../workspaces/workspace-query.atoms";
export const createConnectorMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.connectors.all(searchSpaceId ?? ""),
@@ -32,7 +32,7 @@ export const createConnectorMutationAtom = atomWithMutation((get) => {
});
export const updateConnectorMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.connectors.all(searchSpaceId ?? ""),
@@ -54,7 +54,7 @@ export const updateConnectorMutationAtom = atomWithMutation((get) => {
});
export const deleteConnectorMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.connectors.all(searchSpaceId ?? ""),
@@ -80,7 +80,7 @@ export const deleteConnectorMutationAtom = atomWithMutation((get) => {
});
export const indexConnectorMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.connectors.index(),
diff --git a/surfsense_web/atoms/connectors/connector-query.atoms.ts b/surfsense_web/atoms/connectors/connector-query.atoms.ts
index 24777c8c6..b43e23388 100644
--- a/surfsense_web/atoms/connectors/connector-query.atoms.ts
+++ b/surfsense_web/atoms/connectors/connector-query.atoms.ts
@@ -1,10 +1,10 @@
import { atomWithQuery } from "jotai-tanstack-query";
import { connectorsApiService } from "@/lib/apis/connectors-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
-import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "../workspaces/workspace-query.atoms";
export const connectorsAtom = atomWithQuery((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
queryKey: cacheKeys.connectors.all(searchSpaceId!),
@@ -13,7 +13,7 @@ export const connectorsAtom = atomWithQuery((get) => {
queryFn: async () => {
return connectorsApiService.getConnectors({
queryParams: {
- search_space_id: searchSpaceId!,
+ workspace_id: searchSpaceId!,
},
});
},
diff --git a/surfsense_web/atoms/documents/document-mutation.atoms.ts b/surfsense_web/atoms/documents/document-mutation.atoms.ts
index 608862419..6336f7441 100644
--- a/surfsense_web/atoms/documents/document-mutation.atoms.ts
+++ b/surfsense_web/atoms/documents/document-mutation.atoms.ts
@@ -1,6 +1,6 @@
import { atomWithMutation } from "jotai-tanstack-query";
import { toast } from "sonner";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import type {
CreateDocumentRequest,
DeleteDocumentRequest,
@@ -14,7 +14,7 @@ import { queryClient } from "@/lib/query-client/client";
import { globalDocumentsQueryParamsAtom } from "./ui.atoms";
export const createDocumentMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const documentsQueryParams = get(globalDocumentsQueryParamsAtom);
return {
@@ -34,7 +34,7 @@ export const createDocumentMutationAtom = atomWithMutation((get) => {
});
export const uploadDocumentMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const documentsQueryParams = get(globalDocumentsQueryParamsAtom);
return {
@@ -54,7 +54,7 @@ export const uploadDocumentMutationAtom = atomWithMutation((get) => {
});
export const updateDocumentMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const documentsQueryParams = get(globalDocumentsQueryParamsAtom);
return {
@@ -77,7 +77,7 @@ export const updateDocumentMutationAtom = atomWithMutation((get) => {
});
export const deleteDocumentMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
const documentsQueryParams = get(globalDocumentsQueryParamsAtom);
return {
diff --git a/surfsense_web/atoms/invites/invites-mutation.atoms.ts b/surfsense_web/atoms/invites/invites-mutation.atoms.ts
index 31e8104a3..cb0871372 100644
--- a/surfsense_web/atoms/invites/invites-mutation.atoms.ts
+++ b/surfsense_web/atoms/invites/invites-mutation.atoms.ts
@@ -20,7 +20,7 @@ export const createInviteMutationAtom = atomWithMutation(() => ({
},
onSuccess: (_, variables) => {
queryClient.invalidateQueries({
- queryKey: cacheKeys.invites.all(variables.search_space_id.toString()),
+ queryKey: cacheKeys.invites.all(variables.workspace_id.toString()),
});
toast.success("Invite created successfully");
},
@@ -40,7 +40,7 @@ export const updateInviteMutationAtom = atomWithMutation(() => ({
},
onSuccess: (_, variables) => {
queryClient.invalidateQueries({
- queryKey: cacheKeys.invites.all(variables.search_space_id.toString()),
+ queryKey: cacheKeys.invites.all(variables.workspace_id.toString()),
});
toast.success("Invite updated successfully");
},
@@ -60,7 +60,7 @@ export const deleteInviteMutationAtom = atomWithMutation(() => ({
},
onSuccess: (_, variables) => {
queryClient.invalidateQueries({
- queryKey: cacheKeys.invites.all(variables.search_space_id.toString()),
+ queryKey: cacheKeys.invites.all(variables.workspace_id.toString()),
});
toast.success("Invite deleted successfully");
},
diff --git a/surfsense_web/atoms/invites/invites-query.atoms.ts b/surfsense_web/atoms/invites/invites-query.atoms.ts
index db1aa70a0..925ba3bf0 100644
--- a/surfsense_web/atoms/invites/invites-query.atoms.ts
+++ b/surfsense_web/atoms/invites/invites-query.atoms.ts
@@ -1,10 +1,10 @@
import { atomWithQuery } from "jotai-tanstack-query";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { invitesApiService } from "@/lib/apis/invites-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
export const invitesAtom = atomWithQuery((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
queryKey: cacheKeys.invites.all(searchSpaceId?.toString() ?? ""),
@@ -15,7 +15,7 @@ export const invitesAtom = atomWithQuery((get) => {
return [];
}
return invitesApiService.getInvites({
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
});
},
};
diff --git a/surfsense_web/atoms/logs/log-mutation.atoms.ts b/surfsense_web/atoms/logs/log-mutation.atoms.ts
index f9d73f6e0..19a2d770f 100644
--- a/surfsense_web/atoms/logs/log-mutation.atoms.ts
+++ b/surfsense_web/atoms/logs/log-mutation.atoms.ts
@@ -1,5 +1,5 @@
import { atomWithMutation } from "jotai-tanstack-query";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import type {
CreateLogRequest,
DeleteLogRequest,
@@ -13,7 +13,7 @@ import { queryClient } from "@/lib/query-client/client";
* Create Log Mutation
*/
export const createLogMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.logs.list(searchSpaceId ?? undefined),
enabled: !!searchSpaceId,
@@ -29,7 +29,7 @@ export const createLogMutationAtom = atomWithMutation((get) => {
* Update Log Mutation
*/
export const updateLogMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.logs.list(searchSpaceId ?? undefined),
enabled: !!searchSpaceId,
@@ -45,7 +45,7 @@ export const updateLogMutationAtom = atomWithMutation((get) => {
* Delete Log Mutation
*/
export const deleteLogMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: cacheKeys.logs.list(searchSpaceId ?? undefined),
enabled: !!searchSpaceId,
diff --git a/surfsense_web/atoms/members/members-mutation.atoms.ts b/surfsense_web/atoms/members/members-mutation.atoms.ts
index 9cf1b2881..8d080fd2c 100644
--- a/surfsense_web/atoms/members/members-mutation.atoms.ts
+++ b/surfsense_web/atoms/members/members-mutation.atoms.ts
@@ -21,7 +21,7 @@ export const updateMemberMutationAtom = atomWithMutation(() => {
onSuccess: (_: UpdateMembershipResponse, request: UpdateMembershipRequest) => {
toast.success("Member updated successfully");
queryClient.invalidateQueries({
- queryKey: cacheKeys.members.all(request.search_space_id.toString()),
+ queryKey: cacheKeys.members.all(request.workspace_id.toString()),
});
},
onError: () => {
@@ -39,7 +39,7 @@ export const deleteMemberMutationAtom = atomWithMutation(() => {
onSuccess: (_: DeleteMembershipResponse, request: DeleteMembershipRequest) => {
toast.success("Member removed successfully");
queryClient.invalidateQueries({
- queryKey: cacheKeys.members.all(request.search_space_id.toString()),
+ queryKey: cacheKeys.members.all(request.workspace_id.toString()),
});
},
onError: () => {
@@ -57,7 +57,7 @@ export const leaveSearchSpaceMutationAtom = atomWithMutation(() => {
onSuccess: (_: LeaveSearchSpaceResponse, request: LeaveSearchSpaceRequest) => {
toast.success("Successfully left the search space");
queryClient.invalidateQueries({
- queryKey: cacheKeys.members.all(request.search_space_id.toString()),
+ queryKey: cacheKeys.members.all(request.workspace_id.toString()),
});
},
onError: () => {
diff --git a/surfsense_web/atoms/members/members-query.atoms.ts b/surfsense_web/atoms/members/members-query.atoms.ts
index c1f507ff5..bd3fc8194 100644
--- a/surfsense_web/atoms/members/members-query.atoms.ts
+++ b/surfsense_web/atoms/members/members-query.atoms.ts
@@ -1,10 +1,10 @@
import { atomWithQuery } from "jotai-tanstack-query";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { membersApiService } from "@/lib/apis/members-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
export const membersAtom = atomWithQuery((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
queryKey: cacheKeys.members.all(searchSpaceId?.toString() ?? ""),
@@ -16,14 +16,14 @@ export const membersAtom = atomWithQuery((get) => {
return [];
}
return membersApiService.getMembers({
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
});
},
};
});
export const myAccessAtom = atomWithQuery((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
queryKey: cacheKeys.members.myAccess(searchSpaceId?.toString() ?? ""),
@@ -34,7 +34,7 @@ export const myAccessAtom = atomWithQuery((get) => {
return null;
}
return membersApiService.getMyAccess({
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
});
},
};
diff --git a/surfsense_web/atoms/model-connections/model-connections-mutation.atoms.ts b/surfsense_web/atoms/model-connections/model-connections-mutation.atoms.ts
index f00bf76f9..ecc570ed5 100644
--- a/surfsense_web/atoms/model-connections/model-connections-mutation.atoms.ts
+++ b/surfsense_web/atoms/model-connections/model-connections-mutation.atoms.ts
@@ -16,7 +16,7 @@ import type {
import { modelConnectionsApiService } from "@/lib/apis/model-connections-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
import { queryClient } from "@/lib/query-client/client";
-import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "../workspaces/workspace-query.atoms";
function invalidateModelConnections(searchSpaceId: number) {
queryClient.invalidateQueries({
@@ -40,14 +40,14 @@ function upsertModelConnection(searchSpaceId: number, connection: ConnectionRead
}
export const createModelConnectionMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["model-connections", "create"],
mutationFn: (request: ConnectionCreateRequest) =>
modelConnectionsApiService.createConnection(request),
onSuccess: (connection: ConnectionRead, request: ConnectionCreateRequest) => {
const resolvedSearchSpaceId = Number(
- request.search_space_id ?? connection.search_space_id ?? searchSpaceId
+ request.workspace_id ?? connection.workspace_id ?? searchSpaceId
);
toast.success("Connection created");
if (resolvedSearchSpaceId > 0) {
@@ -60,7 +60,7 @@ export const createModelConnectionMutationAtom = atomWithMutation((get) => {
});
export const updateModelConnectionMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["model-connections", "update"],
mutationFn: ({ id, data }: { id: number; data: ConnectionUpdateRequest }) =>
@@ -74,7 +74,7 @@ export const updateModelConnectionMutationAtom = atomWithMutation((get) => {
});
export const deleteModelConnectionMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["model-connections", "delete"],
mutationFn: (id: number) => modelConnectionsApiService.deleteConnection(id),
@@ -87,7 +87,7 @@ export const deleteModelConnectionMutationAtom = atomWithMutation((get) => {
});
export const verifyModelConnectionMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["model-connections", "verify"],
mutationFn: (id: number) => modelConnectionsApiService.verifyConnection(id),
@@ -110,7 +110,7 @@ export const verifyModelConnectionMutationAtom = atomWithMutation((get) => {
});
export const discoverConnectionModelsMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["model-connections", "discover"],
mutationFn: (id: number) => modelConnectionsApiService.discoverModels(id),
@@ -149,7 +149,7 @@ export const testPreviewModelMutationAtom = atomWithMutation(() => {
});
export const addManualModelMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["models", "add-manual"],
mutationFn: ({ connectionId, data }: { connectionId: number; data: ModelCreateRequest }) =>
@@ -163,7 +163,7 @@ export const addManualModelMutationAtom = atomWithMutation((get) => {
});
export const updateModelMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["models", "update"],
mutationFn: ({ id, data }: { id: number; data: ModelUpdateRequest }) =>
@@ -174,7 +174,7 @@ export const updateModelMutationAtom = atomWithMutation((get) => {
});
export const bulkUpdateModelsMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["models", "bulk-update"],
mutationFn: ({ connectionId, data }: { connectionId: number; data: ModelsBulkUpdateRequest }) =>
@@ -185,7 +185,7 @@ export const bulkUpdateModelsMutationAtom = atomWithMutation((get) => {
});
export const testModelMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["models", "test"],
mutationFn: (id: number) => modelConnectionsApiService.testModel(id),
@@ -199,7 +199,7 @@ export const testModelMutationAtom = atomWithMutation((get) => {
});
export const updateModelRolesMutationAtom = atomWithMutation((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
mutationKey: ["model-roles", "update"],
mutationFn: (roles: ModelRoles) =>
diff --git a/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts b/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts
index 709b51966..be3643b67 100644
--- a/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts
+++ b/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts
@@ -2,7 +2,7 @@ import { atomWithQuery } from "jotai-tanstack-query";
import { modelConnectionsApiService } from "@/lib/apis/model-connections-api.service";
import { isAuthenticated } from "@/lib/auth-utils";
import { cacheKeys } from "@/lib/query-client/cache-keys";
-import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "../workspaces/workspace-query.atoms";
export const globalModelConnectionsAtom = atomWithQuery(() => ({
queryKey: cacheKeys.modelConnections.global(),
@@ -26,7 +26,7 @@ export const modelProvidersAtom = atomWithQuery(() => ({
}));
export const modelConnectionsAtom = atomWithQuery((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
queryKey: cacheKeys.modelConnections.all(searchSpaceId),
enabled: !!searchSpaceId,
@@ -36,7 +36,7 @@ export const modelConnectionsAtom = atomWithQuery((get) => {
});
export const modelRolesAtom = atomWithQuery((get) => {
- const searchSpaceId = Number(get(activeSearchSpaceIdAtom));
+ const searchSpaceId = Number(get(activeWorkspaceIdAtom));
return {
queryKey: cacheKeys.modelConnections.roles(searchSpaceId),
enabled: !!searchSpaceId,
diff --git a/surfsense_web/atoms/public-chat-snapshots/public-chat-snapshots-query.atoms.ts b/surfsense_web/atoms/public-chat-snapshots/public-chat-snapshots-query.atoms.ts
index 9c9eafab4..c96ba53d7 100644
--- a/surfsense_web/atoms/public-chat-snapshots/public-chat-snapshots-query.atoms.ts
+++ b/surfsense_web/atoms/public-chat-snapshots/public-chat-snapshots-query.atoms.ts
@@ -1,10 +1,10 @@
import { atomWithQuery } from "jotai-tanstack-query";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { chatThreadsApiService } from "@/lib/apis/chat-threads-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
export const publicChatSnapshotsAtom = atomWithQuery((get) => {
- const searchSpaceId = get(activeSearchSpaceIdAtom);
+ const searchSpaceId = get(activeWorkspaceIdAtom);
return {
queryKey: cacheKeys.publicChatSnapshots.bySearchSpace(Number(searchSpaceId) || 0),
@@ -15,7 +15,7 @@ export const publicChatSnapshotsAtom = atomWithQuery((get) => {
return { snapshots: [] };
}
return chatThreadsApiService.listPublicChatSnapshotsForSearchSpace({
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
});
},
};
diff --git a/surfsense_web/atoms/roles/roles-mutation.atoms.ts b/surfsense_web/atoms/roles/roles-mutation.atoms.ts
index cfcb6cba1..cbe28fe94 100644
--- a/surfsense_web/atoms/roles/roles-mutation.atoms.ts
+++ b/surfsense_web/atoms/roles/roles-mutation.atoms.ts
@@ -21,7 +21,7 @@ export const createRoleMutationAtom = atomWithMutation(() => {
onSuccess: (_: CreateRoleResponse, request: CreateRoleRequest) => {
toast.success("Role created successfully");
queryClient.invalidateQueries({
- queryKey: cacheKeys.roles.all(request.search_space_id.toString()),
+ queryKey: cacheKeys.roles.all(request.workspace_id.toString()),
});
},
onError: () => {
@@ -39,13 +39,10 @@ export const updateRoleMutationAtom = atomWithMutation(() => {
onSuccess: (_: UpdateRoleResponse, request: UpdateRoleRequest) => {
toast.success("Role updated successfully");
queryClient.invalidateQueries({
- queryKey: cacheKeys.roles.all(request.search_space_id.toString()),
+ queryKey: cacheKeys.roles.all(request.workspace_id.toString()),
});
queryClient.invalidateQueries({
- queryKey: cacheKeys.roles.byId(
- request.search_space_id.toString(),
- request.role_id.toString()
- ),
+ queryKey: cacheKeys.roles.byId(request.workspace_id.toString(), request.role_id.toString()),
});
},
onError: () => {
@@ -63,7 +60,7 @@ export const deleteRoleMutationAtom = atomWithMutation(() => {
onSuccess: (_: DeleteRoleResponse, request: DeleteRoleRequest) => {
toast.success("Role deleted successfully");
queryClient.invalidateQueries({
- queryKey: cacheKeys.roles.all(request.search_space_id.toString()),
+ queryKey: cacheKeys.roles.all(request.workspace_id.toString()),
});
},
onError: () => {
diff --git a/surfsense_web/atoms/workspaces/workspace-mutation.atoms.ts b/surfsense_web/atoms/workspaces/workspace-mutation.atoms.ts
index 03d77e00c..85194e957 100644
--- a/surfsense_web/atoms/workspaces/workspace-mutation.atoms.ts
+++ b/surfsense_web/atoms/workspaces/workspace-mutation.atoms.ts
@@ -5,11 +5,11 @@ import type {
DeleteSearchSpaceRequest,
UpdateSearchSpaceApiAccessRequest,
UpdateSearchSpaceRequest,
-} from "@/contracts/types/search-space.types";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+} from "@/contracts/types/workspace.types";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
import { queryClient } from "@/lib/query-client/client";
-import { activeSearchSpaceIdAtom } from "./search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "./workspace-query.atoms";
export const createSearchSpaceMutationAtom = atomWithMutation(() => {
return {
@@ -28,7 +28,7 @@ export const createSearchSpaceMutationAtom = atomWithMutation(() => {
});
export const updateSearchSpaceMutationAtom = atomWithMutation((get) => {
- const activeSearchSpaceId = get(activeSearchSpaceIdAtom);
+ const activeSearchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: ["update-search-space", activeSearchSpaceId],
@@ -52,7 +52,7 @@ export const updateSearchSpaceMutationAtom = atomWithMutation((get) => {
});
export const updateSearchSpaceApiAccessMutationAtom = atomWithMutation((get) => {
- const activeSearchSpaceId = get(activeSearchSpaceIdAtom);
+ const activeSearchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: ["update-search-space-api-access", activeSearchSpaceId],
@@ -74,7 +74,7 @@ export const updateSearchSpaceApiAccessMutationAtom = atomWithMutation((get) =>
});
export const deleteSearchSpaceMutationAtom = atomWithMutation((get) => {
- const activeSearchSpaceId = get(activeSearchSpaceIdAtom);
+ const activeSearchSpaceId = get(activeWorkspaceIdAtom);
return {
mutationKey: ["delete-search-space", activeSearchSpaceId],
diff --git a/surfsense_web/atoms/workspaces/workspace-query.atoms.ts b/surfsense_web/atoms/workspaces/workspace-query.atoms.ts
index 588466d90..457e57a70 100644
--- a/surfsense_web/atoms/workspaces/workspace-query.atoms.ts
+++ b/surfsense_web/atoms/workspaces/workspace-query.atoms.ts
@@ -1,10 +1,10 @@
import { atom } from "jotai";
import { atomWithQuery } from "jotai-tanstack-query";
-import type { GetSearchSpacesRequest } from "@/contracts/types/search-space.types";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import type { GetSearchSpacesRequest } from "@/contracts/types/workspace.types";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
-export const activeSearchSpaceIdAtom = atom(null);
+export const activeWorkspaceIdAtom = atom(null);
export const searchSpacesQueryParamsAtom = atom({
skip: 0,
diff --git a/surfsense_web/components/assistant-ui/assistant-message.tsx b/surfsense_web/components/assistant-ui/assistant-message.tsx
index 616d3a797..3b0181f8d 100644
--- a/surfsense_web/components/assistant-ui/assistant-message.tsx
+++ b/surfsense_web/components/assistant-ui/assistant-message.tsx
@@ -29,7 +29,7 @@ import {
globalModelConnectionsAtom,
modelConnectionsAtom,
} from "@/atoms/model-connections/model-connections-query.atoms";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import {
CitationMetadataProvider,
useAllCitationMetadata,
@@ -491,7 +491,7 @@ export const AssistantMessage: FC = () => {
const commentPanelRef = useRef(null);
const commentTriggerRef = useRef(null);
const messageId = useAuiState(({ message }) => message?.id);
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const dbMessageId = parseMessageId(messageId);
const commentsEnabled = useAtomValue(commentsEnabledAtom);
diff --git a/surfsense_web/components/assistant-ui/connector-popup.tsx b/surfsense_web/components/assistant-ui/connector-popup.tsx
index 6ea55f4a5..b3dd1824c 100644
--- a/surfsense_web/components/assistant-ui/connector-popup.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup.tsx
@@ -4,7 +4,7 @@ import { useAtomValue } from "jotai";
import { forwardRef, useEffect, useImperativeHandle, useMemo, useState } from "react";
import { createPortal } from "react-dom";
import { statusInboxItemsAtom } from "@/atoms/inbox/status-inbox.atom";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog";
import { Tabs, TabsContent } from "@/components/ui/tabs";
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
@@ -36,7 +36,7 @@ interface ConnectorIndicatorProps {
export const ConnectorIndicator = forwardRef(
(_props, ref) => {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
// Real-time document type counts via Zero (updates instantly as docs are indexed)
const documentTypeCounts = useZeroDocumentTypeCounts(searchSpaceId);
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/circleback-config.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/circleback-config.tsx
index f62778180..346ba45dd 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/circleback-config.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/circleback-config.tsx
@@ -18,7 +18,7 @@ export interface CirclebackConfigProps extends ConnectorConfigProps {
// Type-safe schema for webhook info response
const circlebackWebhookInfoSchema = z.object({
webhook_url: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
method: z.string(),
content_type: z.string(),
description: z.string(),
@@ -40,12 +40,12 @@ export const CirclebackConfig: FC = ({ connector, onNameC
const controller = new AbortController();
const doFetch = async () => {
- if (!connector.search_space_id) return;
+ if (!connector.workspace_id) return;
setIsLoading(true);
try {
const response = await authenticatedFetch(
- buildBackendUrl(`/api/v1/webhooks/circleback/${connector.search_space_id}/info`),
+ buildBackendUrl(`/api/v1/webhooks/circleback/${connector.workspace_id}/info`),
{ signal: controller.signal }
);
if (controller.signal.aborted) return;
@@ -70,7 +70,7 @@ export const CirclebackConfig: FC = ({ connector, onNameC
doFetch().catch(() => {});
return () => controller.abort();
- }, [connector.search_space_id]);
+ }, [connector.workspace_id]);
const handleNameChange = (value: string) => {
setName(value);
diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
index f44587bd8..507945ad6 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx
@@ -4,7 +4,7 @@ import { useAtomValue } from "jotai";
import { ArrowLeft, Info, RefreshCw } from "lucide-react";
import { type FC, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { toast } from "sonner";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
@@ -78,7 +78,7 @@ export const ConnectorEditView: FC = ({
onConfigChange,
onNameChange,
}) => {
- const searchSpaceIdAtom = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceIdAtom = useAtomValue(activeWorkspaceIdAtom);
const isAuthExpired = connector.config?.auth_expired === true;
const reauthEndpoint = getReauthEndpoint(connector);
const [reauthing, setReauthing] = useState(false);
diff --git a/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts b/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
index 9b8149ad1..f741fc2aa 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
+++ b/surfsense_web/components/assistant-ui/connector-popup/hooks/use-connector-dialog.ts
@@ -10,7 +10,7 @@ import {
updateConnectorMutationAtom,
} from "@/atoms/connectors/connector-mutation.atoms";
import { connectorsAtom } from "@/atoms/connectors/connector-query.atoms";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { EnumConnectorName } from "@/contracts/enums/connector";
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
import { searchSourceConnector } from "@/contracts/types/connector.types";
@@ -58,7 +58,7 @@ function clearOAuthResultCookie(): void {
}
export const useConnectorDialog = () => {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const { data: allConnectors, refetch: refetchAllConnectors } = useAtomValue(connectorsAtom);
const { mutateAsync: indexConnector } = useAtomValue(indexConnectorMutationAtom);
const { mutateAsync: updateConnector } = useAtomValue(updateConnectorMutationAtom);
@@ -165,7 +165,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: connector.id,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
start_date: format(startDate, "yyyy-MM-dd"),
end_date: format(endDate, "yyyy-MM-dd"),
},
@@ -418,7 +418,7 @@ export const useConnectorDialog = () => {
enable_vision_llm: false,
},
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
});
@@ -519,7 +519,7 @@ export const useConnectorDialog = () => {
enable_vision_llm: false,
},
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
});
// Refetch connectors to get the new one
@@ -612,7 +612,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: connector.id,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
start_date: startDateStr,
end_date: endDateStr,
},
@@ -847,7 +847,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: indexingConfig.connectorId,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
body: {
folders: selectedFolders || [],
@@ -870,14 +870,14 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: indexingConfig.connectorId,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
});
} else {
await indexConnector({
connector_id: indexingConfig.connectorId,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
start_date: startDateStr,
end_date: endDateStr,
},
@@ -1114,7 +1114,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: editingConnector.id,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
body: {
folders: selectedFolders || [],
@@ -1134,7 +1134,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: editingConnector.id,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
});
indexingDescription = "Re-indexing started with updated configuration.";
@@ -1143,7 +1143,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: editingConnector.id,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
start_date: startDateStr,
end_date: endDateStr,
},
@@ -1296,7 +1296,7 @@ export const useConnectorDialog = () => {
await indexConnector({
connector_id: connectorId,
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
start_date: startDateStr,
end_date: endDateStr,
},
diff --git a/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
index 26a89b97d..30db5d3ff 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/views/connector-accounts-list-view.tsx
@@ -4,7 +4,7 @@ import { useAtomValue } from "jotai";
import { ArrowLeft, Plus, RefreshCw, Server } from "lucide-react";
import { type FC, useCallback, useState } from "react";
import { toast } from "sonner";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
import { EnumConnectorName } from "@/contracts/enums/connector";
@@ -44,7 +44,7 @@ export const ConnectorAccountsListView: FC = ({
isConnecting = false,
addButtonText,
}) => {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const [reauthingId, setReauthingId] = useState(null);
const [confirmDisconnectId, setConfirmDisconnectId] = useState(null);
const [disconnectingId, setDisconnectingId] = useState(null);
diff --git a/surfsense_web/components/assistant-ui/connector-popup/views/youtube-crawler-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/views/youtube-crawler-view.tsx
index 5bffa0dfe..11befc19b 100644
--- a/surfsense_web/components/assistant-ui/connector-popup/views/youtube-crawler-view.tsx
+++ b/surfsense_web/components/assistant-ui/connector-popup/views/youtube-crawler-view.tsx
@@ -165,7 +165,7 @@ export const YouTubeCrawlerView: FC = ({ searchSpaceId,
{
document_type: "YOUTUBE_VIDEO",
content: videoUrls,
- search_space_id: parseInt(searchSpaceId, 10),
+ workspace_id: parseInt(searchSpaceId, 10),
},
{
onSuccess: () => {
diff --git a/surfsense_web/components/assistant-ui/document-upload-popup.tsx b/surfsense_web/components/assistant-ui/document-upload-popup.tsx
index 504f1d8d4..bb8c4dcad 100644
--- a/surfsense_web/components/assistant-ui/document-upload-popup.tsx
+++ b/surfsense_web/components/assistant-ui/document-upload-popup.tsx
@@ -10,7 +10,7 @@ import {
useRef,
useState,
} from "react";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { DocumentUploadTab } from "@/components/sources/DocumentUploadTab";
import {
Dialog,
@@ -90,7 +90,7 @@ const DocumentUploadPopupContent: FC<{
isOpen: boolean;
onOpenChange: (open: boolean) => void;
}> = ({ isOpen, onOpenChange }) => {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
if (!searchSpaceId) return null;
diff --git a/surfsense_web/components/assistant-ui/markdown-text.tsx b/surfsense_web/components/assistant-ui/markdown-text.tsx
index cd32ca920..018066493 100644
--- a/surfsense_web/components/assistant-ui/markdown-text.tsx
+++ b/surfsense_web/components/assistant-ui/markdown-text.tsx
@@ -188,7 +188,7 @@ function FilePathLink({ path, className }: { path: string; className?: string })
const openEditorPanel = useSetAtom(openEditorPanelAtom);
const params = useParams();
const electronAPI = useElectronAPI();
- const searchSpaceIdParam = params?.search_space_id;
+ const searchSpaceIdParam = params?.workspace_id;
const parsedSearchSpaceId = Array.isArray(searchSpaceIdParam)
? Number(searchSpaceIdParam[0])
: Number(searchSpaceIdParam);
@@ -228,7 +228,7 @@ function FilePathLink({ path, className }: { path: string; className?: string })
if (!resolvedSearchSpaceId || !path.startsWith("/documents/")) return;
try {
const doc = await documentsApiService.getDocumentByVirtualPath({
- search_space_id: resolvedSearchSpaceId,
+ workspace_id: resolvedSearchSpaceId,
virtual_path: path,
});
openEditorPanel({
diff --git a/surfsense_web/components/assistant-ui/thread.tsx b/surfsense_web/components/assistant-ui/thread.tsx
index 3716c59aa..2c7493f0e 100644
--- a/surfsense_web/components/assistant-ui/thread.tsx
+++ b/surfsense_web/components/assistant-ui/thread.tsx
@@ -458,7 +458,7 @@ const Composer: FC = () => {
const prevMentionedDocsRef = useRef>(new Map());
const documentPickerRef = useRef(null);
const promptPickerRef = useRef(null);
- const { search_space_id, chat_id } = useParams();
+ const { workspace_id, chat_id } = useParams();
const aui = useAui();
// Desktop-only auto-focus; on mobile, programmatic focus would
// summon the soft keyboard on every picker close / thread switch.
@@ -824,7 +824,7 @@ const Composer: FC = () => {
const handleDocumentsMention = useCallback(
(mentions: MentionedDocumentInfo[]) => {
- const parsedSearchSpaceId = Number(search_space_id);
+ const parsedSearchSpaceId = Number(workspace_id);
const editorMentionedDocs = editorRef.current?.getMentionedDocuments() ?? [];
const editorDocKeys = new Set(editorMentionedDocs.map((doc) => getMentionDocKey(doc)));
@@ -844,7 +844,7 @@ const Composer: FC = () => {
setMentionQuery("");
setSuggestionAnchorPoint(null);
},
- [search_space_id]
+ [workspace_id]
);
useEffect(() => {
@@ -893,7 +893,7 @@ const Composer: FC = () => {
{
diff --git a/surfsense_web/components/assistant-ui/user-message.tsx b/surfsense_web/components/assistant-ui/user-message.tsx
index 0c3649544..655c75b21 100644
--- a/surfsense_web/components/assistant-ui/user-message.tsx
+++ b/surfsense_web/components/assistant-ui/user-message.tsx
@@ -75,7 +75,7 @@ const UserTextPart: FC = () => {
const openEditorPanel = useSetAtom(openEditorPanelAtom);
const router = useRouter();
const params = useParams();
- const searchSpaceIdParam = params?.search_space_id;
+ const searchSpaceIdParam = params?.workspace_id;
const parsedSearchSpaceId = Array.isArray(searchSpaceIdParam)
? Number(searchSpaceIdParam[0])
: Number(searchSpaceIdParam);
diff --git a/surfsense_web/components/citation-panel/citation-panel.tsx b/surfsense_web/components/citation-panel/citation-panel.tsx
index 890ac11ac..068f560d3 100644
--- a/surfsense_web/components/citation-panel/citation-panel.tsx
+++ b/surfsense_web/components/citation-panel/citation-panel.tsx
@@ -77,7 +77,7 @@ export const CitationPanelContent: FC = ({
if (!data) return;
openEditorPanel({
documentId: data.id,
- searchSpaceId: data.search_space_id,
+ searchSpaceId: data.workspace_id,
title: data.title,
});
};
diff --git a/surfsense_web/components/editor-panel/editor-panel.tsx b/surfsense_web/components/editor-panel/editor-panel.tsx
index 1e29a261a..c20c6127a 100644
--- a/surfsense_web/components/editor-panel/editor-panel.tsx
+++ b/surfsense_web/components/editor-panel/editor-panel.tsx
@@ -276,7 +276,7 @@ export function EditorPanelContent({
}
const response = await authenticatedFetch(
buildBackendUrl(
- `/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/editor-content`
+ `/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/editor-content`
),
{ method: "GET" }
);
@@ -412,7 +412,7 @@ export function EditorPanelContent({
throw new Error("Missing document context");
}
const response = await authenticatedFetch(
- buildBackendUrl(`/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/save`),
+ buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/save`),
{
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -520,7 +520,7 @@ export function EditorPanelContent({
try {
const response = await authenticatedFetch(
buildBackendUrl(
- `/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/download-markdown`
+ `/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/download-markdown`
),
{ method: "GET" }
);
diff --git a/surfsense_web/components/editor-panel/memory.ts b/surfsense_web/components/editor-panel/memory.ts
index 8c4dfc035..085837803 100644
--- a/surfsense_web/components/editor-panel/memory.ts
+++ b/surfsense_web/components/editor-panel/memory.ts
@@ -27,7 +27,7 @@ interface MemoryReadResponse {
function getMemoryPath(scope: MemoryScope, searchSpaceId?: number | null) {
if (scope === "user") return "/api/v1/users/me/memory";
if (!searchSpaceId) throw new Error("Missing search space context");
- return `/api/v1/searchspaces/${searchSpaceId}/memory`;
+ return `/api/v1/workspaces/${searchSpaceId}/memory`;
}
export function getMemoryLimitState(length: number, limits?: MemoryLimits | null) {
diff --git a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
index 433d66353..9db4c0af7 100644
--- a/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
+++ b/surfsense_web/components/layout/providers/LayoutDataProvider.tsx
@@ -13,10 +13,10 @@ import { documentsSidebarOpenAtom } from "@/atoms/documents/ui.atoms";
import { statusInboxItemsAtom } from "@/atoms/inbox/status-inbox.atom";
import { announcementsDialogAtom } from "@/atoms/layout/dialogs.atom";
import { rightPanelCollapsedAtom } from "@/atoms/layout/right-panel.atom";
-import { deleteSearchSpaceMutationAtom } from "@/atoms/search-spaces/search-space-mutation.atoms";
-import { searchSpacesAtom } from "@/atoms/search-spaces/search-space-query.atoms";
import { removeChatTabAtom, syncChatTabAtom, type Tab } from "@/atoms/tabs/tabs.atom";
import { currentUserAtom } from "@/atoms/user/user-query.atoms";
+import { deleteSearchSpaceMutationAtom } from "@/atoms/workspaces/workspace-mutation.atoms";
+import { searchSpacesAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { ActionLogDialog } from "@/components/agent-action-log/action-log-dialog";
import { AnnouncementSpotlight } from "@/components/announcements/AnnouncementSpotlight";
import { AnnouncementsDialog } from "@/components/announcements/AnnouncementsDialog";
@@ -47,7 +47,7 @@ import { useInbox } from "@/hooks/use-inbox";
import { useIsMobile } from "@/hooks/use-mobile";
import { useArchiveThread, useDeleteThread, useRenameThread } from "@/hooks/use-thread-mutations";
import { notificationsApiService } from "@/lib/apis/notifications-api.service";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { getLoginPath, logout } from "@/lib/auth-utils";
import { fetchThreads } from "@/lib/chat/thread-persistence";
import { resetUser, trackLogout } from "@/lib/posthog/events";
@@ -397,7 +397,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
const handleSearchSpaceSettings = useCallback(
(space: SearchSpace) => {
- router.push(`/dashboard/${space.id}/search-space-settings`);
+ router.push(`/dashboard/${space.id}/workspace-settings`);
},
[router]
);
@@ -595,7 +595,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
);
const handleSettings = useCallback(() => {
- router.push(`/dashboard/${searchSpaceId}/search-space-settings`);
+ router.push(`/dashboard/${searchSpaceId}/workspace-settings`);
}, [router, searchSpaceId]);
const handleManageMembers = useCallback(() => {
@@ -699,7 +699,7 @@ export function LayoutDataProvider({ searchSpaceId, children }: LayoutDataProvid
// Detect if we're on the chat page (needs overflow-hidden for chat's own scroll)
const isChatPage = pathname?.includes("/new-chat") ?? false;
const isUserSettingsPage = pathname?.includes("/user-settings") === true;
- const isSearchSpaceSettingsPage = pathname?.includes("/search-space-settings") === true;
+ const isSearchSpaceSettingsPage = pathname?.includes("/workspace-settings") === true;
const isTeamPage = pathname?.endsWith("/team") === true;
const isAutomationsPage = pathname?.includes("/automations") === true;
const useWorkspacePanel =
diff --git a/surfsense_web/components/layout/ui/dialogs/CreateWorkspaceDialog.tsx b/surfsense_web/components/layout/ui/dialogs/CreateWorkspaceDialog.tsx
index 009b2c120..ec9e94554 100644
--- a/surfsense_web/components/layout/ui/dialogs/CreateWorkspaceDialog.tsx
+++ b/surfsense_web/components/layout/ui/dialogs/CreateWorkspaceDialog.tsx
@@ -7,7 +7,7 @@ import { useTranslations } from "next-intl";
import { useState } from "react";
import { useForm } from "react-hook-form";
import * as z from "zod";
-import { createSearchSpaceMutationAtom } from "@/atoms/search-spaces/search-space-mutation.atoms";
+import { createSearchSpaceMutationAtom } from "@/atoms/workspaces/workspace-mutation.atoms";
import { Button } from "@/components/ui/button";
import {
Dialog,
diff --git a/surfsense_web/components/layout/ui/dialogs/index.ts b/surfsense_web/components/layout/ui/dialogs/index.ts
index 807a227de..8caf14d1c 100644
--- a/surfsense_web/components/layout/ui/dialogs/index.ts
+++ b/surfsense_web/components/layout/ui/dialogs/index.ts
@@ -1 +1 @@
-export { CreateSearchSpaceDialog } from "./CreateSearchSpaceDialog";
+export { CreateSearchSpaceDialog } from "./CreateWorkspaceDialog";
diff --git a/surfsense_web/components/layout/ui/header/Header.tsx b/surfsense_web/components/layout/ui/header/Header.tsx
index af997ad5c..05ed0e6b3 100644
--- a/surfsense_web/components/layout/ui/header/Header.tsx
+++ b/surfsense_web/components/layout/ui/header/Header.tsx
@@ -3,8 +3,8 @@
import { useAtomValue } from "jotai";
import { usePathname } from "next/navigation";
import { currentThreadAtom } from "@/atoms/chat/current-thread.atom";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
import { activeTabAtom } from "@/atoms/tabs/tabs.atom";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { ActionLogButton } from "@/components/agent-action-log/action-log-button";
import { ChatShareButton } from "@/components/new-chat/chat-share-button";
import { ArtifactsToggleButton } from "@/features/chat-artifacts";
@@ -16,7 +16,7 @@ interface HeaderProps {
export function Header({ mobileMenuTrigger }: HeaderProps) {
const pathname = usePathname();
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const activeTab = useAtomValue(activeTabAtom);
const isFreePage = pathname?.startsWith("/free") ?? false;
@@ -56,7 +56,7 @@ export function Header({ mobileMenuTrigger }: HeaderProps) {
id: currentThreadState.id,
visibility: currentThreadState.visibility,
created_by_id: null,
- search_space_id: currentThreadState.searchSpaceId,
+ workspace_id: currentThreadState.searchSpaceId,
title: "",
archived: false,
created_at: "",
diff --git a/surfsense_web/components/layout/ui/icon-rail/IconRail.tsx b/surfsense_web/components/layout/ui/icon-rail/IconRail.tsx
index a47b00e5c..031e9f57e 100644
--- a/surfsense_web/components/layout/ui/icon-rail/IconRail.tsx
+++ b/surfsense_web/components/layout/ui/icon-rail/IconRail.tsx
@@ -7,7 +7,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip
import { cn } from "@/lib/utils";
import type { NavItem, SearchSpace, User } from "../../types/layout.types";
import { SidebarUserProfile } from "../sidebar/SidebarUserProfile";
-import { SearchSpaceAvatar } from "./SearchSpaceAvatar";
+import { SearchSpaceAvatar } from "./WorkspaceAvatar";
interface IconRailProps {
searchSpaces: SearchSpace[];
diff --git a/surfsense_web/components/layout/ui/icon-rail/index.ts b/surfsense_web/components/layout/ui/icon-rail/index.ts
index b635e7273..2feddd146 100644
--- a/surfsense_web/components/layout/ui/icon-rail/index.ts
+++ b/surfsense_web/components/layout/ui/icon-rail/index.ts
@@ -1,3 +1,3 @@
export { IconRail } from "./IconRail";
export { NavIcon } from "./NavIcon";
-export { SearchSpaceAvatar } from "./SearchSpaceAvatar";
+export { SearchSpaceAvatar } from "./WorkspaceAvatar";
diff --git a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
index e70a9fec9..49959f8fe 100644
--- a/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/DocumentsSidebar.tsx
@@ -35,7 +35,7 @@ import {
folderWatchDialogOpenAtom,
folderWatchInitialFolderAtom,
} from "@/atoms/folder-sync/folder-sync.atoms";
-import { searchSpacesAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { searchSpacesAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { CreateFolderDialog } from "@/components/documents/CreateFolderDialog";
import type { DocumentNodeDoc } from "@/components/documents/DocumentNode";
import { DocumentsFilters } from "@/components/documents/DocumentsFilters";
@@ -76,7 +76,7 @@ import { useElectronAPI, usePlatform } from "@/hooks/use-platform";
import { anonymousChatApiService } from "@/lib/apis/anonymous-chat-api.service";
import { documentsApiService } from "@/lib/apis/documents-api.service";
import { foldersApiService } from "@/lib/apis/folders-api.service";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { authenticatedFetch } from "@/lib/auth-fetch";
import { getMentionDocKey } from "@/lib/chat/mention-doc-key";
import { buildBackendUrl } from "@/lib/env-config";
@@ -228,7 +228,7 @@ function AuthenticatedDocumentsSidebarBase({
const platformElectronAPI = useElectronAPI();
const electronAPI = desktopFeaturesEnabled ? platformElectronAPI : null;
const { etlService } = useRuntimeConfig();
- const searchSpaceId = Number(params.search_space_id);
+ const searchSpaceId = Number(params.workspace_id);
const setConnectorDialogOpen = useSetAtom(connectorDialogOpenAtom);
const openEditorPanel = useSetAtom(openEditorPanelAtom);
const { data: agentFlags } = useAtomValue(agentFlagsAtom);
@@ -430,7 +430,7 @@ function AuthenticatedDocumentsSidebarBase({
path: meta.folder_path as string,
name: bf.name,
rootFolderId: bf.id,
- searchSpaceId: bf.search_space_id,
+ searchSpaceId: bf.workspace_id,
excludePatterns: (meta.exclude_patterns as string[]) ?? [],
fileExtensions: (meta.file_extensions as string[] | null) ?? null,
active: true,
@@ -583,7 +583,7 @@ function AuthenticatedDocumentsSidebarBase({
await foldersApiService.createFolder({
name,
parent_id: createFolderParentId,
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
});
toast.success("Folder created");
if (createFolderParentId !== null) {
@@ -751,7 +751,7 @@ function AuthenticatedDocumentsSidebarBase({
.trim()
.slice(0, 80) || "folder";
await doExport(
- buildBackendUrl(`/api/v1/search-spaces/${searchSpaceId}/export`, {
+ buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/export`, {
folder_id: ctx.folder.id,
}),
`${safeName}.zip`
@@ -805,7 +805,7 @@ function AuthenticatedDocumentsSidebarBase({
.trim()
.slice(0, 80) || "folder";
await doExport(
- buildBackendUrl(`/api/v1/search-spaces/${searchSpaceId}/export`, {
+ buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/export`, {
folder_id: folder.id,
}),
`${safeName}.zip`
@@ -828,7 +828,7 @@ function AuthenticatedDocumentsSidebarBase({
const endpoint =
doc.document_type === "USER_MEMORY"
? buildBackendUrl("/api/v1/users/me/memory")
- : buildBackendUrl(`/api/v1/searchspaces/${searchSpaceId}/memory`);
+ : buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/memory`);
const response = await authenticatedFetch(endpoint, { method: "GET" });
if (!response.ok) {
const errorData = await response.json().catch(() => ({ detail: "Export failed" }));
@@ -856,7 +856,7 @@ function AuthenticatedDocumentsSidebarBase({
try {
const response = await authenticatedFetch(
- buildBackendUrl(`/api/v1/search-spaces/${searchSpaceId}/documents/${doc.id}/export`, {
+ buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/documents/${doc.id}/export`, {
format,
}),
{ method: "GET" }
@@ -1038,7 +1038,7 @@ function AuthenticatedDocumentsSidebarBase({
const endpoint =
doc.document_type === "USER_MEMORY"
? buildBackendUrl("/api/v1/users/me/memory/reset")
- : buildBackendUrl(`/api/v1/searchspaces/${searchSpaceId}/memory/reset`);
+ : buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/memory/reset`);
try {
const response = await authenticatedFetch(endpoint, { method: "POST" });
if (!response.ok) {
diff --git a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
index 3785dc649..180fba722 100644
--- a/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/InboxSidebar.tsx
@@ -165,7 +165,7 @@ export function InboxSidebarContent({
const router = useRouter();
const params = useParams();
const isMobile = !useMediaQuery("(min-width: 640px)");
- const searchSpaceId = params?.search_space_id ? Number(params.search_space_id) : null;
+ const searchSpaceId = params?.workspace_id ? Number(params.workspace_id) : null;
const [, setTargetCommentId] = useAtom(setTargetCommentIdAtom);
@@ -207,7 +207,7 @@ export function InboxSidebarContent({
queryFn: () =>
notificationsApiService.getNotifications({
queryParams: {
- search_space_id: searchSpaceId ?? undefined,
+ workspace_id: searchSpaceId ?? undefined,
type: searchTypeFilter,
search: debouncedSearch.trim(),
limit: 50,
@@ -363,7 +363,7 @@ export function InboxSidebarContent({
if (item.type === "new_mention") {
if (isNewMentionMetadata(item.metadata)) {
- const searchSpaceId = item.search_space_id;
+ const searchSpaceId = item.workspace_id;
const threadId = item.metadata.thread_id;
const commentId = item.metadata.comment_id;
@@ -381,7 +381,7 @@ export function InboxSidebarContent({
}
} else if (item.type === "comment_reply") {
if (isCommentReplyMetadata(item.metadata)) {
- const searchSpaceId = item.search_space_id;
+ const searchSpaceId = item.workspace_id;
const threadId = item.metadata.thread_id;
const replyId = item.metadata.reply_id;
diff --git a/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx b/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx
index 89a01d0c7..9a0d1cf61 100644
--- a/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/MobileSidebar.tsx
@@ -5,7 +5,7 @@ import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Sheet, SheetContent, SheetTitle } from "@/components/ui/sheet";
import type { ChatItem, NavItem, PageUsage, SearchSpace, User } from "../../types/layout.types";
-import { SearchSpaceAvatar } from "../icon-rail/SearchSpaceAvatar";
+import { SearchSpaceAvatar } from "../icon-rail/WorkspaceAvatar";
import { Sidebar } from "./Sidebar";
interface MobileSidebarProps {
diff --git a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx
index c274e1f97..9f5f299bb 100644
--- a/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx
+++ b/surfsense_web/components/layout/ui/sidebar/Sidebar.tsx
@@ -377,7 +377,7 @@ function SidebarUsageFooter({
onNavigate?: () => void;
}) {
const params = useParams();
- const searchSpaceId = params?.search_space_id ?? "";
+ const searchSpaceId = params?.workspace_id ?? "";
const isAnonymous = useIsAnonymous();
if (isCollapsed) return null;
diff --git a/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx b/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx
index 6c3d37dd7..8af24cbde 100644
--- a/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx
+++ b/surfsense_web/components/layout/ui/tabs/DocumentTabContent.tsx
@@ -104,7 +104,7 @@ export function DocumentTabContent({ documentId, searchSpaceId, title }: Documen
try {
const response = await authenticatedFetch(
buildBackendUrl(
- `/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/editor-content`
+ `/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/editor-content`
),
{ method: "GET" }
);
@@ -154,7 +154,7 @@ export function DocumentTabContent({ documentId, searchSpaceId, title }: Documen
setSaving(true);
try {
const response = await authenticatedFetch(
- buildBackendUrl(`/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/save`),
+ buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/save`),
{
method: "POST",
headers: { "Content-Type": "application/json" },
@@ -313,7 +313,7 @@ export function DocumentTabContent({ documentId, searchSpaceId, title }: Documen
try {
const response = await authenticatedFetch(
buildBackendUrl(
- `/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/download-markdown`
+ `/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/download-markdown`
),
{ method: "GET" }
);
diff --git a/surfsense_web/components/new-chat/chat-share-button.tsx b/surfsense_web/components/new-chat/chat-share-button.tsx
index 5e5e3fe19..d892eb024 100644
--- a/surfsense_web/components/new-chat/chat-share-button.tsx
+++ b/surfsense_web/components/new-chat/chat-share-button.tsx
@@ -51,7 +51,7 @@ export function ChatShareButton({ thread, onVisibilityChange, className }: ChatS
// Use Jotai atom for visibility (single source of truth)
const currentThreadState = useAtomValue(currentThreadAtom);
- const { mutateAsync: updateVisibility } = useUpdateThreadVisibility(thread?.search_space_id ?? 0);
+ const { mutateAsync: updateVisibility } = useUpdateThreadVisibility(thread?.workspace_id ?? 0);
// Snapshot creation mutation
const { mutateAsync: createSnapshot, isPending: isCreatingSnapshot } = useAtomValue(
@@ -139,9 +139,7 @@ export function ChatShareButton({ thread, onVisibilityChange, className }: ChatS
variant="ghost"
size="icon"
onClick={() =>
- router.push(
- `/dashboard/${thread.search_space_id}/search-space-settings/public-links`
- )
+ router.push(`/dashboard/${thread.workspace_id}/workspace-settings/public-links`)
}
className="size-8 bg-muted/50 hover:bg-accent hover:text-accent-foreground"
>
diff --git a/surfsense_web/components/new-chat/document-mention-picker.tsx b/surfsense_web/components/new-chat/document-mention-picker.tsx
index ab156f085..fae13420a 100644
--- a/surfsense_web/components/new-chat/document-mention-picker.tsx
+++ b/surfsense_web/components/new-chat/document-mention-picker.tsx
@@ -316,7 +316,7 @@ export const DocumentMentionPicker = forwardRef<
const titleSearchParams = useMemo(
() => ({
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
page: 0,
page_size: PAGE_SIZE,
...(isSearchValid ? { title: debouncedSearch.trim() } : {}),
@@ -362,7 +362,7 @@ export const DocumentMentionPicker = forwardRef<
try {
const queryParams = {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
page: nextPage,
page_size: PAGE_SIZE,
...(isSearchValid ? { title: debouncedSearch.trim() } : {}),
diff --git a/surfsense_web/components/new-chat/image-model-selector.tsx b/surfsense_web/components/new-chat/image-model-selector.tsx
index 11de54f77..631a9742f 100644
--- a/surfsense_web/components/new-chat/image-model-selector.tsx
+++ b/surfsense_web/components/new-chat/image-model-selector.tsx
@@ -146,7 +146,7 @@ export function ImageModelSelector({
function manageModelConnections() {
setOpen(false);
- router.push(`/dashboard/${searchSpaceId}/search-space-settings/models`);
+ router.push(`/dashboard/${searchSpaceId}/workspace-settings/models`);
}
const handleScroll = useCallback((event: UIEvent) => {
diff --git a/surfsense_web/components/new-chat/model-selector.tsx b/surfsense_web/components/new-chat/model-selector.tsx
index e4ae427aa..7579be7f1 100644
--- a/surfsense_web/components/new-chat/model-selector.tsx
+++ b/surfsense_web/components/new-chat/model-selector.tsx
@@ -149,7 +149,7 @@ export function ModelSelector({
function manageModelConnections() {
setOpen(false);
- router.push(`/dashboard/${searchSpaceId}/search-space-settings/models`);
+ router.push(`/dashboard/${searchSpaceId}/workspace-settings/models`);
}
const handleScroll = useCallback((event: UIEvent) => {
diff --git a/surfsense_web/components/new-chat/prompt-picker.tsx b/surfsense_web/components/new-chat/prompt-picker.tsx
index 65bf0a889..2ddbbde9c 100644
--- a/surfsense_web/components/new-chat/prompt-picker.tsx
+++ b/surfsense_web/components/new-chat/prompt-picker.tsx
@@ -69,9 +69,9 @@ export const PromptPicker = forwardRef(funct
const createPromptIndex = filtered.length;
const totalItems = filtered.length + 1;
- const searchSpaceId = Array.isArray(params?.search_space_id)
- ? params.search_space_id[0]
- : params?.search_space_id;
+ const searchSpaceId = Array.isArray(params?.workspace_id)
+ ? params.workspace_id[0]
+ : params?.workspace_id;
const handleSelect = useCallback(
(index: number) => {
diff --git a/surfsense_web/components/onboarding-tour.tsx b/surfsense_web/components/onboarding-tour.tsx
index a3c530ac0..de3712ae9 100644
--- a/surfsense_web/components/onboarding-tour.tsx
+++ b/surfsense_web/components/onboarding-tour.tsx
@@ -7,8 +7,8 @@ import { useTheme } from "next-themes";
import { useCallback, useEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
import { connectorsAtom } from "@/atoms/connectors/connector-query.atoms";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
import { currentUserAtom } from "@/atoms/user/user-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { Button } from "@/components/ui/button";
import { useIsMobile } from "@/hooks/use-mobile";
import { useZeroDocumentTypeCounts } from "@/hooks/use-zero-document-type-counts";
@@ -391,7 +391,7 @@ export function OnboardingTour() {
// Get user data
const { data: user } = useAtomValue(currentUserAtom);
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
// Fetch threads data
const { data: threadsData } = useQuery({
diff --git a/surfsense_web/components/public-chat/public-chat-footer.tsx b/surfsense_web/components/public-chat/public-chat-footer.tsx
index 5c775a2a1..ba20d66a1 100644
--- a/surfsense_web/components/public-chat/public-chat-footer.tsx
+++ b/surfsense_web/components/public-chat/public-chat-footer.tsx
@@ -28,7 +28,7 @@ export function PublicChatFooter({ shareToken }: PublicChatFooterProps) {
});
// Redirect to the new chat page with cloned content
- router.push(`/dashboard/${response.search_space_id}/new-chat/${response.thread_id}`);
+ router.push(`/dashboard/${response.workspace_id}/new-chat/${response.thread_id}`);
} catch (error) {
const message = error instanceof Error ? error.message : "Failed to copy chat";
toast.error(message);
diff --git a/surfsense_web/components/settings/auto-reload-settings.tsx b/surfsense_web/components/settings/auto-reload-settings.tsx
index fbb7cbfb9..823dd26bf 100644
--- a/surfsense_web/components/settings/auto-reload-settings.tsx
+++ b/surfsense_web/components/settings/auto-reload-settings.tsx
@@ -38,7 +38,7 @@ export function AutoReloadSettings() {
const pathname = usePathname();
const searchParams = useSearchParams();
const queryClient = useQueryClient();
- const searchSpaceId = Number(params?.search_space_id);
+ const searchSpaceId = Number(params?.workspace_id);
const [enabled, setEnabled] = useState(false);
const [thresholdInput, setThresholdInput] = useState("");
@@ -79,7 +79,7 @@ export function AutoReloadSettings() {
const setupMutation = useMutation({
mutationFn: () =>
- stripeApiService.createAutoReloadSetupSession({ search_space_id: searchSpaceId }),
+ stripeApiService.createAutoReloadSetupSession({ workspace_id: searchSpaceId }),
onSuccess: (response) => {
window.location.assign(response.checkout_url);
},
diff --git a/surfsense_web/components/settings/buy-credits-content.tsx b/surfsense_web/components/settings/buy-credits-content.tsx
index 8cb339420..c0646cbfc 100644
--- a/surfsense_web/components/settings/buy-credits-content.tsx
+++ b/surfsense_web/components/settings/buy-credits-content.tsx
@@ -37,7 +37,7 @@ const formatUsd = (micros: number) => {
export function BuyCreditsContent() {
const params = useParams();
- const searchSpaceId = Number(params?.search_space_id);
+ const searchSpaceId = Number(params?.workspace_id);
const [quantity, setQuantity] = useState(1);
// Raw text of the amount field so the user can clear it while typing;
// committed back to a clamped integer on blur.
@@ -176,7 +176,7 @@ export function BuyCreditsContent() {
purchaseMutation.mutate({ quantity, search_space_id: searchSpaceId })}
+ onClick={() => purchaseMutation.mutate({ quantity, workspace_id: searchSpaceId })}
>
{purchaseMutation.isPending ? (
<>
diff --git a/surfsense_web/components/settings/earn-credits-content.tsx b/surfsense_web/components/settings/earn-credits-content.tsx
index 731ea7726..067b0d4ed 100644
--- a/surfsense_web/components/settings/earn-credits-content.tsx
+++ b/surfsense_web/components/settings/earn-credits-content.tsx
@@ -32,7 +32,7 @@ const formatRewardUsd = (micros: number) => {
export function EarnCreditsContent() {
const params = useParams();
const queryClient = useQueryClient();
- const searchSpaceId = params?.search_space_id ?? "";
+ const searchSpaceId = params?.workspace_id ?? "";
useEffect(() => {
trackIncentivePageViewed();
diff --git a/surfsense_web/components/settings/general-settings-manager.tsx b/surfsense_web/components/settings/general-settings-manager.tsx
index d0c08d881..6fcd42e1c 100644
--- a/surfsense_web/components/settings/general-settings-manager.tsx
+++ b/surfsense_web/components/settings/general-settings-manager.tsx
@@ -8,13 +8,13 @@ import { toast } from "sonner";
import {
updateSearchSpaceApiAccessMutationAtom,
updateSearchSpaceMutationAtom,
-} from "@/atoms/search-spaces/search-space-mutation.atoms";
+} from "@/atoms/workspaces/workspace-mutation.atoms";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Skeleton } from "@/components/ui/skeleton";
import { Switch } from "@/components/ui/switch";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { authenticatedFetch } from "@/lib/auth-fetch";
import { buildBackendUrl } from "@/lib/env-config";
import { cacheKeys } from "@/lib/query-client/cache-keys";
@@ -57,7 +57,7 @@ export function GeneralSettingsManager({ searchSpaceId }: GeneralSettingsManager
setIsExporting(true);
try {
const response = await authenticatedFetch(
- buildBackendUrl(`/api/v1/search-spaces/${searchSpaceId}/export`),
+ buildBackendUrl(`/api/v1/workspaces/${searchSpaceId}/export`),
{ method: "GET" }
);
if (!response.ok) {
diff --git a/surfsense_web/components/settings/model-connections/connection-settings-dialog.tsx b/surfsense_web/components/settings/model-connections/connection-settings-dialog.tsx
index 1f16c3bd0..a5d04c29a 100644
--- a/surfsense_web/components/settings/model-connections/connection-settings-dialog.tsx
+++ b/surfsense_web/components/settings/model-connections/connection-settings-dialog.tsx
@@ -148,7 +148,7 @@ export function ConnectionSettingsDialog({
base_url: data.base_url,
api_key: apiKeyForTest,
scope: "SEARCH_SPACE",
- search_space_id: connection.search_space_id,
+ workspace_id: connection.workspace_id,
extra: connection.extra ?? {},
enabled: connection.enabled,
models: [],
diff --git a/surfsense_web/components/settings/model-connections/model-provider-connections-panel.tsx b/surfsense_web/components/settings/model-connections/model-provider-connections-panel.tsx
index a703ab1c8..0a6c6b1b6 100644
--- a/surfsense_web/components/settings/model-connections/model-provider-connections-panel.tsx
+++ b/surfsense_web/components/settings/model-connections/model-provider-connections-panel.tsx
@@ -138,7 +138,7 @@ export function ModelProviderConnectionsPanel({
base_url: draft.base_url,
api_key: draft.api_key,
scope: "SEARCH_SPACE" as const,
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
extra: draft.extra,
enabled: true,
models,
@@ -171,7 +171,7 @@ export function ModelProviderConnectionsPanel({
base_url: null,
api_key: null,
scope: "SEARCH_SPACE",
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
extra: {},
enabled: true,
models: [],
@@ -190,7 +190,7 @@ export function ModelProviderConnectionsPanel({
base_url: draft.base_url,
api_key: draft.api_key,
scope: "SEARCH_SPACE",
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
extra: draft.extra,
enabled: true,
models: [],
diff --git a/surfsense_web/components/settings/prompt-config-manager.tsx b/surfsense_web/components/settings/prompt-config-manager.tsx
index 997749a2a..a2064c27f 100644
--- a/surfsense_web/components/settings/prompt-config-manager.tsx
+++ b/surfsense_web/components/settings/prompt-config-manager.tsx
@@ -5,13 +5,13 @@ import { useAtomValue } from "jotai";
import { AlertTriangle, Info } from "lucide-react";
import { useEffect, useState } from "react";
import { toast } from "sonner";
-import { updateSearchSpaceMutationAtom } from "@/atoms/search-spaces/search-space-mutation.atoms";
+import { updateSearchSpaceMutationAtom } from "@/atoms/workspaces/workspace-mutation.atoms";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { Label } from "@/components/ui/label";
import { Skeleton } from "@/components/ui/skeleton";
import { Textarea } from "@/components/ui/textarea";
-import { searchSpacesApiService } from "@/lib/apis/search-spaces-api.service";
+import { searchSpacesApiService } from "@/lib/apis/workspaces-api.service";
import { cacheKeys } from "@/lib/query-client/cache-keys";
import { Spinner } from "../ui/spinner";
diff --git a/surfsense_web/components/settings/roles-manager.tsx b/surfsense_web/components/settings/roles-manager.tsx
index 5c034470d..f891e7bd0 100644
--- a/surfsense_web/components/settings/roles-manager.tsx
+++ b/surfsense_web/components/settings/roles-manager.tsx
@@ -279,7 +279,7 @@ export function RolesManager({ searchSpaceId }: { searchSpaceId: number }) {
const { data: roles = [], isLoading: rolesLoading } = useQuery({
queryKey: cacheKeys.roles.all(searchSpaceId.toString()),
- queryFn: () => rolesApiService.getRoles({ search_space_id: searchSpaceId }),
+ queryFn: () => rolesApiService.getRoles({ workspace_id: searchSpaceId }),
enabled: !!searchSpaceId,
});
@@ -311,7 +311,7 @@ export function RolesManager({ searchSpaceId }: { searchSpaceId: number }) {
}
): Promise => {
const request: UpdateRoleRequest = {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
role_id: roleId,
data: data,
};
@@ -323,7 +323,7 @@ export function RolesManager({ searchSpaceId }: { searchSpaceId: number }) {
const handleDeleteRole = useCallback(
async (roleId: number): Promise => {
const request: DeleteRoleRequest = {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
role_id: roleId,
};
await deleteRole(request);
@@ -335,7 +335,7 @@ export function RolesManager({ searchSpaceId }: { searchSpaceId: number }) {
const handleCreateRole = useCallback(
async (roleData: CreateRoleRequest["data"]): Promise => {
const request: CreateRoleRequest = {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
data: roleData,
};
return await createRole(request);
diff --git a/surfsense_web/components/sources/DocumentUploadTab.tsx b/surfsense_web/components/sources/DocumentUploadTab.tsx
index 8ee203765..3d45ac2ae 100644
--- a/surfsense_web/components/sources/DocumentUploadTab.tsx
+++ b/surfsense_web/components/sources/DocumentUploadTab.tsx
@@ -364,7 +364,7 @@ export function DocumentUploadTab({
batch.map((e) => e.file),
{
folder_name: folderUpload.folderName,
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
relative_paths: batch.map((e) => e.relativePath),
root_folder_id: rootFolderId,
use_vision_llm: useVisionLlm,
@@ -413,7 +413,7 @@ export function DocumentUploadTab({
uploadDocuments(
{
files: rawFiles,
- search_space_id: Number(searchSpaceId),
+ workspace_id: Number(searchSpaceId),
use_vision_llm: useVisionLlm,
processing_mode: processingMode,
},
diff --git a/surfsense_web/components/tool-ui/automation/create-automation.tsx b/surfsense_web/components/tool-ui/automation/create-automation.tsx
index 92607beed..fbb377905 100644
--- a/surfsense_web/components/tool-ui/automation/create-automation.tsx
+++ b/surfsense_web/components/tool-ui/automation/create-automation.tsx
@@ -9,7 +9,7 @@ import {
AutomationModelFields,
type AutomationModelSelection,
} from "@/app/dashboard/[workspace_id]/automations/components/builder/automation-model-fields";
-import { activeSearchSpaceIdAtom } from "@/atoms/search-spaces/search-space-query.atoms";
+import { activeWorkspaceIdAtom } from "@/atoms/workspaces/workspace-query.atoms";
import { JsonView } from "@/components/json-view";
import { TextShimmerLoader } from "@/components/prompt-kit/loader";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
@@ -27,7 +27,7 @@ import {
} from "@/lib/posthog/events";
import { AutomationDraftPreview } from "./automation-draft-preview";
-const editArgsSchema = automationCreateRequest.omit({ search_space_id: true });
+const editArgsSchema = automationCreateRequest.omit({ workspace_id: true });
// ----------------------------------------------------------------------------
// Result discrimination — mirrors the backend return shapes in
@@ -35,7 +35,7 @@ const editArgsSchema = automationCreateRequest.omit({ search_space_id: true });
// ----------------------------------------------------------------------------
type AutomationCreateContext = {
- search_space_id?: number;
+ workspace_id?: number;
};
interface SavedResult {
@@ -81,7 +81,7 @@ function hasStatus(value: unknown, status: string): boolean {
//
// Edit toggle reuses the same primitives as the Create-via-JSON page: raw
// textarea, Format, Zod validation against ``AutomationCreate`` (minus the
-// ``search_space_id`` field, which the backend injects). Approve dispatches
+// ``workspace_id`` field, which the backend injects). Approve dispatches
// an ``edit`` decision with the parsed args when edits are pending, otherwise
// a plain ``approve``. Multi-turn chat refinement still works as a fallback.
// ----------------------------------------------------------------------------
@@ -110,7 +110,7 @@ function ApprovalCard({ args, interruptData, onDecision }: ApprovalCardProps) {
// Per-automation model selection. The card always supplies models (chosen
// here, not snapshotted from the search space), so Approve dispatches an
// `edit` decision carrying `definition.models`.
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const eligibleModels = useAutomationEligibleModels();
const [modelSelection, setModelSelection] = useState({
chatModelId: 0,
@@ -156,7 +156,7 @@ function ApprovalCard({ args, interruptData, onDecision }: ApprovalCardProps) {
const plan = Array.isArray(baseDefinition.plan) ? baseDefinition.plan : [];
const triggers = Array.isArray(baseArgs.triggers) ? baseArgs.triggers : [];
trackAutomationChatApproved({
- search_space_id: searchSpaceId ? Number(searchSpaceId) : undefined,
+ workspace_id: searchSpaceId ? Number(searchSpaceId) : undefined,
edited: pendingEdits !== null,
task_count: plan.length,
trigger_type:
@@ -191,7 +191,7 @@ function ApprovalCard({ args, interruptData, onDecision }: ApprovalCardProps) {
if (phase !== "pending" || !canReject || isEditing) return;
setRejected();
trackAutomationChatRejected({
- search_space_id: searchSpaceId ? Number(searchSpaceId) : undefined,
+ workspace_id: searchSpaceId ? Number(searchSpaceId) : undefined,
});
onDecision({ type: "reject", message: "User rejected the automation draft." });
}, [phase, canReject, isEditing, setRejected, onDecision, searchSpaceId]);
@@ -268,7 +268,7 @@ function ApprovalCard({ args, interruptData, onDecision }: ApprovalCardProps) {
setPendingEdits(parsed);
setIsEditing(false);
trackAutomationChatDraftEdited({
- search_space_id: searchSpaceId ? Number(searchSpaceId) : undefined,
+ workspace_id: searchSpaceId ? Number(searchSpaceId) : undefined,
});
}}
onCancel={() => setIsEditing(false)}
@@ -385,7 +385,7 @@ function JsonEditor({ initialValue, onSave, onCancel }: JsonEditorProps) {
// ----------------------------------------------------------------------------
function SavedCard({ result }: { result: SavedResult }) {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const tracked = useRef(false);
useEffect(() => {
if (tracked.current) return;
@@ -393,7 +393,7 @@ function SavedCard({ result }: { result: SavedResult }) {
trackAutomationChatCreateSucceeded({
automation_id: result.automation_id,
name: result.name,
- search_space_id: searchSpaceId ? Number(searchSpaceId) : undefined,
+ workspace_id: searchSpaceId ? Number(searchSpaceId) : undefined,
});
}, [result.automation_id, result.name, searchSpaceId]);
@@ -429,7 +429,7 @@ function SavedCard({ result }: { result: SavedResult }) {
}
function InvalidCard({ result }: { result: InvalidResult }) {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const tracked = useRef(false);
useEffect(() => {
if (tracked.current) return;
@@ -437,7 +437,7 @@ function InvalidCard({ result }: { result: InvalidResult }) {
trackAutomationChatCreateFailed({
reason: "invalid",
issue_count: result.issues.length,
- search_space_id: searchSpaceId ? Number(searchSpaceId) : undefined,
+ workspace_id: searchSpaceId ? Number(searchSpaceId) : undefined,
});
}, [result.issues.length, searchSpaceId]);
@@ -464,7 +464,7 @@ function InvalidCard({ result }: { result: InvalidResult }) {
}
function ErrorCard({ result }: { result: ErrorResult }) {
- const searchSpaceId = useAtomValue(activeSearchSpaceIdAtom);
+ const searchSpaceId = useAtomValue(activeWorkspaceIdAtom);
const tracked = useRef(false);
useEffect(() => {
if (tracked.current) return;
@@ -472,7 +472,7 @@ function ErrorCard({ result }: { result: ErrorResult }) {
trackAutomationChatCreateFailed({
reason: "error",
message: result.message,
- search_space_id: searchSpaceId ? Number(searchSpaceId) : undefined,
+ workspace_id: searchSpaceId ? Number(searchSpaceId) : undefined,
});
}, [result.message, searchSpaceId]);
@@ -531,7 +531,7 @@ export const CreateAutomationToolUI = ({
* Project raw args into the shape ``AutomationDraftPreview`` expects.
*
* The args dict is the full ``AutomationCreate`` payload (minus
- * ``search_space_id`` which is injected server-side), so we trust the
+ * ``workspace_id`` which is injected server-side), so we trust the
* top-level fields but defend against missing nested defaults.
*/
function extractDraft(args: Record) {
diff --git a/surfsense_web/content/docs/testing.mdx b/surfsense_web/content/docs/testing.mdx
index c6739de10..9a79cae4e 100644
--- a/surfsense_web/content/docs/testing.mdx
+++ b/surfsense_web/content/docs/testing.mdx
@@ -87,7 +87,7 @@ External boundaries (LLM, embedding, chunking, Redis) are mocked in both suites.
1. **Database setup** — `TEST_DATABASE_URL` defaults to `surfsense_test`. Tables and extensions (`vector`, `pg_trgm`) are created once per session and dropped after.
2. **Transaction isolation** — Each test runs inside a savepoint that rolls back, so tests don't affect each other.
3. **User creation** — Integration tests register a test user via `POST /auth/register` on first run, then log in for subsequent requests.
-4. **Search space discovery** — Tests call `GET /api/v1/searchspaces` and use the first available space.
+4. **Search space discovery** — Tests call `GET /api/v1/workspaces` and use the first available space.
5. **Cleanup** — A session fixture purges stale documents before tests run. Per-test cleanup deletes documents via API, falling back to direct DB access for stuck records.
## Writing New Tests
diff --git a/surfsense_web/contracts/types/automation.types.ts b/surfsense_web/contracts/types/automation.types.ts
index 6331a663c..c9a286542 100644
--- a/surfsense_web/contracts/types/automation.types.ts
+++ b/surfsense_web/contracts/types/automation.types.ts
@@ -118,7 +118,7 @@ export type Trigger = z.infer;
// =============================================================================
export const automationCreateRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
name: z.string().min(1).max(200),
description: z.string().nullable().optional(),
definition: automationDefinition,
@@ -136,7 +136,7 @@ export type AutomationUpdateRequest = z.infer;
export const automationSummary = z.object({
id: z.number(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
name: z.string(),
description: z.string().nullable().optional(),
status: automationStatus,
@@ -159,7 +159,7 @@ export const automationListResponse = z.object({
export type AutomationListResponse = z.infer;
export const automationListParams = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
limit: z.number().int().min(1).max(200).default(50),
offset: z.number().int().min(0).default(0),
});
diff --git a/surfsense_web/contracts/types/chat-comments.types.ts b/surfsense_web/contracts/types/chat-comments.types.ts
index a7751917e..d910af63e 100644
--- a/surfsense_web/contracts/types/chat-comments.types.ts
+++ b/surfsense_web/contracts/types/chat-comments.types.ts
@@ -52,8 +52,8 @@ export const mentionContext = z.object({
thread_id: z.number(),
thread_title: z.string(),
message_id: z.number(),
- search_space_id: z.number(),
- search_space_name: z.string(),
+ workspace_id: z.number(),
+ workspace_name: z.string(),
});
export const mentionComment = z.object({
@@ -144,7 +144,7 @@ export const deleteCommentResponse = z.object({
* Get mentions
*/
export const getMentionsRequest = z.object({
- search_space_id: z.number().optional(),
+ workspace_id: z.number().optional(),
});
export const getMentionsResponse = z.object({
diff --git a/surfsense_web/contracts/types/chat-threads.types.ts b/surfsense_web/contracts/types/chat-threads.types.ts
index d245a4168..1362d5fc1 100644
--- a/surfsense_web/contracts/types/chat-threads.types.ts
+++ b/surfsense_web/contracts/types/chat-threads.types.ts
@@ -62,7 +62,7 @@ export const publicChatSnapshotDetail = z.object({
* List public chat snapshots for search space
*/
export const publicChatSnapshotsBySpaceRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const publicChatSnapshotsBySpaceResponse = z.object({
diff --git a/surfsense_web/contracts/types/connector.types.ts b/surfsense_web/contracts/types/connector.types.ts
index 7c3dbb043..a5c85d9b9 100644
--- a/surfsense_web/contracts/types/connector.types.ts
+++ b/surfsense_web/contracts/types/connector.types.ts
@@ -47,7 +47,7 @@ export const searchSourceConnector = z.object({
periodic_indexing_enabled: z.boolean(),
indexing_frequency_minutes: z.number().nullable(),
next_scheduled_at: z.string().nullable(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
user_id: z.string(),
created_at: z.string(),
});
@@ -72,7 +72,7 @@ export const getConnectorsRequest = z.object({
queryParams: paginationQueryParams
.pick({ skip: true, limit: true })
.extend({
- search_space_id: z.number().or(z.string()).nullish(),
+ workspace_id: z.number().or(z.string()).nullish(),
})
.nullish(),
});
@@ -103,7 +103,7 @@ export const createConnectorRequest = z.object({
next_scheduled_at: true,
}),
queryParams: z.object({
- search_space_id: z.number().or(z.string()),
+ workspace_id: z.number().or(z.string()),
}),
});
@@ -175,7 +175,7 @@ export const googleDriveIndexBody = z.object({
export const indexConnectorRequest = z.object({
connector_id: z.number(),
queryParams: z.object({
- search_space_id: z.number().or(z.string()),
+ workspace_id: z.number().or(z.string()),
start_date: z.string().optional(),
end_date: z.string().optional(),
}),
@@ -185,7 +185,7 @@ export const indexConnectorRequest = z.object({
export const indexConnectorResponse = z.object({
message: z.string(),
connector_id: z.number(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
indexing_from: z.string(),
indexing_to: z.string(),
});
diff --git a/surfsense_web/contracts/types/document.types.ts b/surfsense_web/contracts/types/document.types.ts
index da1dac537..c1d3b0bf8 100644
--- a/surfsense_web/contracts/types/document.types.ts
+++ b/surfsense_web/contracts/types/document.types.ts
@@ -46,7 +46,7 @@ export const document = z.object({
unique_identifier_hash: z.string().nullable(),
created_at: z.string(),
updated_at: z.string().nullable(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
created_by_id: z.string().nullable().optional(),
created_by_name: z.string().nullable().optional(),
created_by_email: z.string().nullable().optional(),
@@ -85,7 +85,7 @@ export const sortOrderEnum = z.enum(["asc", "desc"]);
export const getDocumentsRequest = z.object({
queryParams: paginationQueryParams
.extend({
- search_space_id: z.number().or(z.string()).optional(),
+ workspace_id: z.number().or(z.string()).optional(),
document_types: z.array(documentTypeEnum).optional(),
sort_by: documentSortByEnum.optional(),
sort_order: sortOrderEnum.optional(),
@@ -112,7 +112,7 @@ export const getDocumentResponse = document;
* Create documents
*/
export const createDocumentRequest = document
- .pick({ document_type: true, search_space_id: true })
+ .pick({ document_type: true, workspace_id: true })
.extend({
content: z.string().or(z.array(z.string())).or(z.array(extensionDocumentContent)),
});
@@ -129,7 +129,7 @@ export const processingModeEnum = z.enum(["basic", "premium"]);
export const uploadDocumentRequest = z.object({
files: z.array(z.instanceof(File)),
- search_space_id: z.number(),
+ workspace_id: z.number(),
use_vision_llm: z.boolean().default(false),
processing_mode: processingModeEnum.default("basic"),
});
@@ -148,7 +148,7 @@ export const uploadDocumentResponse = z.object({
*/
export const getDocumentsStatusRequest = z.object({
queryParams: z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
document_ids: z.array(z.number()).min(1),
}),
});
@@ -175,7 +175,7 @@ export const getDocumentsStatusResponse = z.object({
export const searchDocumentsRequest = z.object({
queryParams: paginationQueryParams
.extend({
- search_space_id: z.number().or(z.string()).optional(),
+ workspace_id: z.number().or(z.string()).optional(),
document_types: z.array(documentTypeEnum).optional(),
title: z.string().optional(),
})
@@ -201,7 +201,7 @@ export const documentTitleRead = z.object({
export const searchDocumentTitlesRequest = z.object({
queryParams: z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
title: z.string().optional(),
page: z.number().optional(),
page_size: z.number().optional(),
@@ -219,7 +219,7 @@ export const searchDocumentTitlesResponse = z.object({
export const getDocumentTypeCountsRequest = z.object({
queryParams: z
.object({
- search_space_id: z.number().or(z.string()).optional(),
+ workspace_id: z.number().or(z.string()).optional(),
})
.nullish(),
});
@@ -266,7 +266,7 @@ export const getDocumentChunksResponse = z.object({
*/
export const updateDocumentRequest = z.object({
id: z.number(),
- data: document.pick({ search_space_id: true, document_type: true, content: true }),
+ data: document.pick({ workspace_id: true, document_type: true, content: true }),
});
export const updateDocumentResponse = document;
diff --git a/surfsense_web/contracts/types/folder.types.ts b/surfsense_web/contracts/types/folder.types.ts
index 8a9696a1f..1a9d5ad57 100644
--- a/surfsense_web/contracts/types/folder.types.ts
+++ b/surfsense_web/contracts/types/folder.types.ts
@@ -5,7 +5,7 @@ export const folder = z.object({
name: z.string(),
position: z.string(),
parent_id: z.number().nullable(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
created_by_id: z.string().nullable().optional(),
created_at: z.string(),
updated_at: z.string(),
@@ -15,7 +15,7 @@ export const folder = z.object({
export const folderCreateRequest = z.object({
name: z.string().min(1).max(255),
parent_id: z.number().nullable().optional(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const folderUpdateRequest = z.object({
diff --git a/surfsense_web/contracts/types/image-generations.types.ts b/surfsense_web/contracts/types/image-generations.types.ts
index d972dad78..2bb7b5bee 100644
--- a/surfsense_web/contracts/types/image-generations.types.ts
+++ b/surfsense_web/contracts/types/image-generations.types.ts
@@ -7,7 +7,7 @@ import { z } from "zod";
export const imageGenerationListItem = z.object({
id: z.number(),
prompt: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
created_at: z.string(),
is_success: z.boolean(),
image_count: z.number().nullish(),
diff --git a/surfsense_web/contracts/types/inbox.types.ts b/surfsense_web/contracts/types/inbox.types.ts
index 94e533809..2fd1321c6 100644
--- a/surfsense_web/contracts/types/inbox.types.ts
+++ b/surfsense_web/contracts/types/inbox.types.ts
@@ -152,7 +152,7 @@ export const inboxItemMetadata = z.union([
export const inboxItem = z.object({
id: z.number(),
user_id: z.string(),
- search_space_id: z.number().nullable(),
+ workspace_id: z.number().nullable(),
type: inboxItemTypeEnum,
title: z.string(),
message: z.string(),
@@ -210,7 +210,7 @@ export type NotificationCategory = z.infer;
*/
export const getNotificationsRequest = z.object({
queryParams: z.object({
- search_space_id: z.number().optional(),
+ workspace_id: z.number().optional(),
type: inboxItemTypeEnum.optional(),
category: notificationCategory.optional(),
source_type: z.string().optional(),
@@ -260,7 +260,7 @@ export const markAllNotificationsReadResponse = z.object({
* Request schema for getting unread count
*/
export const getUnreadCountRequest = z.object({
- search_space_id: z.number().optional(),
+ workspace_id: z.number().optional(),
});
/**
diff --git a/surfsense_web/contracts/types/invites.types.ts b/surfsense_web/contracts/types/invites.types.ts
index 0359d84d5..4b55bb0ba 100644
--- a/surfsense_web/contracts/types/invites.types.ts
+++ b/surfsense_web/contracts/types/invites.types.ts
@@ -5,7 +5,7 @@ export const invite = z.object({
id: z.number(),
name: z.string().max(100).nullable().optional(),
invite_code: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
created_by_id: z.string().nullable(),
role_id: z.number().nullable(),
expires_at: z.string().nullable(),
@@ -20,7 +20,7 @@ export const invite = z.object({
* Create invite
*/
export const createInviteRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
data: z.object({
name: z.string().max(100).optional(),
role_id: z.number().nullable().optional(),
@@ -35,7 +35,7 @@ export const createInviteResponse = invite;
* Get invites
*/
export const getInvitesRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const getInvitesResponse = z.array(invite);
@@ -44,7 +44,7 @@ export const getInvitesResponse = z.array(invite);
* Update invite
*/
export const updateInviteRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
invite_id: z.number(),
data: z.object({
name: z.string().max(100).optional(),
@@ -61,7 +61,7 @@ export const updateInviteResponse = invite;
* Delete invite
*/
export const deleteInviteRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
invite_id: z.number(),
});
@@ -77,7 +77,7 @@ export const getInviteInfoRequest = z.object({
});
export const getInviteInfoResponse = z.object({
- search_space_name: z.string(),
+ workspace_name: z.string(),
role_name: z.string().nullable(),
is_valid: z.boolean(),
message: z.string().nullable(),
@@ -92,8 +92,8 @@ export const acceptInviteRequest = z.object({
export const acceptInviteResponse = z.object({
message: z.string(),
- search_space_id: z.number(),
- search_space_name: z.string(),
+ workspace_id: z.number(),
+ workspace_name: z.string(),
role_name: z.string().nullable(),
});
diff --git a/surfsense_web/contracts/types/log.types.ts b/surfsense_web/contracts/types/log.types.ts
index 95aa33319..db6a22dcf 100644
--- a/surfsense_web/contracts/types/log.types.ts
+++ b/surfsense_web/contracts/types/log.types.ts
@@ -19,7 +19,7 @@ export const log = z.object({
source: z.string().nullable().optional(),
log_metadata: z.record(z.string(), z.any()).nullable().optional(),
created_at: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const logBase = log.omit({ id: true, created_at: true });
@@ -27,7 +27,7 @@ export const logBase = log.omit({ id: true, created_at: true });
/**
* Create log
*/
-export const createLogRequest = logBase.extend({ search_space_id: z.number() });
+export const createLogRequest = logBase.extend({ workspace_id: z.number() });
export const createLogResponse = log;
/**
@@ -48,7 +48,7 @@ export const deleteLogResponse = z.object({
* Get logs (list)
*/
export const logFilters = z.object({
- search_space_id: z.number().optional(),
+ workspace_id: z.number().optional(),
level: logLevelEnum.optional(),
status: logStatusEnum.optional(),
source: z.string().optional(),
@@ -59,7 +59,7 @@ export const logFilters = z.object({
export const getLogsRequest = z.object({
queryParams: paginationQueryParams
.extend({
- search_space_id: z.number().optional(),
+ workspace_id: z.number().optional(),
level: logLevelEnum.optional(),
status: logStatusEnum.optional(),
source: z.string().optional(),
@@ -106,7 +106,7 @@ export const logSummary = z.object({
recent_failures: z.array(logFailure),
});
export const getLogSummaryRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
hours: z.number().optional(),
});
export const getLogSummaryResponse = logSummary;
diff --git a/surfsense_web/contracts/types/mcp.types.ts b/surfsense_web/contracts/types/mcp.types.ts
index 4a0a3c31a..e2accea71 100644
--- a/surfsense_web/contracts/types/mcp.types.ts
+++ b/surfsense_web/contracts/types/mcp.types.ts
@@ -37,7 +37,7 @@ export const mcpConnectorRead = z.object({
name: z.string(),
connector_type: z.literal("MCP_CONNECTOR"),
server_config: mcpServerConfig,
- search_space_id: z.number(),
+ workspace_id: z.number(),
user_id: z.string(),
created_at: z.string(),
updated_at: z.string(),
@@ -49,7 +49,7 @@ export const mcpConnectorRead = z.object({
export const createMCPConnectorRequest = z.object({
data: mcpConnectorCreate,
queryParams: z.object({
- search_space_id: z.number().or(z.string()),
+ workspace_id: z.number().or(z.string()),
}),
});
@@ -60,7 +60,7 @@ export const updateMCPConnectorRequest = z.object({
export const getMCPConnectorsRequest = z.object({
queryParams: z.object({
- search_space_id: z.number().or(z.string()),
+ workspace_id: z.number().or(z.string()),
}),
});
diff --git a/surfsense_web/contracts/types/members.types.ts b/surfsense_web/contracts/types/members.types.ts
index e458807af..2a8ee6092 100644
--- a/surfsense_web/contracts/types/members.types.ts
+++ b/surfsense_web/contracts/types/members.types.ts
@@ -4,7 +4,7 @@ import { role } from "./roles.types";
export const membership = z.object({
id: z.number(),
user_id: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
role_id: z.number().nullable(),
is_owner: z.boolean(),
joined_at: z.string(),
@@ -21,7 +21,7 @@ export const membership = z.object({
* Get members
*/
export const getMembersRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const getMembersResponse = z.array(membership);
@@ -30,7 +30,7 @@ export const getMembersResponse = z.array(membership);
* Update membership
*/
export const updateMembershipRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
membership_id: z.number(),
data: z.object({
role_id: z.number().nullable(),
@@ -43,7 +43,7 @@ export const updateMembershipResponse = membership;
* Delete membership
*/
export const deleteMembershipRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
membership_id: z.number(),
});
@@ -55,7 +55,7 @@ export const deleteMembershipResponse = z.object({
* Leave search space
*/
export const leaveSearchSpaceRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const leaveSearchSpaceResponse = z.object({
@@ -66,12 +66,12 @@ export const leaveSearchSpaceResponse = z.object({
* Get my access
*/
export const getMyAccessRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const getMyAccessResponse = z.object({
- search_space_name: z.string(),
- search_space_id: z.number(),
+ workspace_name: z.string(),
+ workspace_id: z.number(),
is_owner: z.boolean(),
permissions: z.array(z.string()),
role_name: z.string().nullable(),
diff --git a/surfsense_web/contracts/types/model-connections.types.ts b/surfsense_web/contracts/types/model-connections.types.ts
index 0f0c7591e..74c31b66e 100644
--- a/surfsense_web/contracts/types/model-connections.types.ts
+++ b/surfsense_web/contracts/types/model-connections.types.ts
@@ -28,7 +28,7 @@ export const connectionRead = z.object({
api_key: z.string().nullable().optional(),
extra: z.record(z.string(), z.any()).default({}),
scope: z.union([connectionScopeEnum, z.string()]),
- search_space_id: z.number().nullable().optional(),
+ workspace_id: z.number().nullable().optional(),
user_id: z.string().nullable().optional(),
enabled: z.boolean(),
has_api_key: z.boolean(),
@@ -57,7 +57,7 @@ export const connectionCreateRequest = z.object({
api_key: z.string().nullable().optional(),
extra: z.record(z.string(), z.any()).default({}),
scope: connectionScopeEnum.default("SEARCH_SPACE"),
- search_space_id: z.number().nullable().optional(),
+ workspace_id: z.number().nullable().optional(),
enabled: z.boolean().default(true),
models: z.array(modelSelection).default([]),
});
diff --git a/surfsense_web/contracts/types/podcast.types.ts b/surfsense_web/contracts/types/podcast.types.ts
index 365847668..8852c4e18 100644
--- a/surfsense_web/contracts/types/podcast.types.ts
+++ b/surfsense_web/contracts/types/podcast.types.ts
@@ -151,7 +151,7 @@ export const podcastDetail = z.object({
duration_seconds: z.number().nullable(),
error: z.string().nullable(),
created_at: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
thread_id: z.number().nullable(),
});
export type PodcastDetail = z.infer;
@@ -162,7 +162,7 @@ export const podcastSummary = z.object({
title: z.string(),
status: podcastStatus,
created_at: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
thread_id: z.number().nullish(),
});
export type PodcastSummary = z.infer;
diff --git a/surfsense_web/contracts/types/prompts.types.ts b/surfsense_web/contracts/types/prompts.types.ts
index 74b26b1d7..c75210671 100644
--- a/surfsense_web/contracts/types/prompts.types.ts
+++ b/surfsense_web/contracts/types/prompts.types.ts
@@ -7,7 +7,7 @@ export const promptRead = z.object({
name: z.string(),
prompt: z.string(),
mode: z.enum(["transform", "explore"]),
- search_space_id: z.number().nullable(),
+ workspace_id: z.number().nullable(),
is_public: z.boolean(),
version: z.number(),
created_at: z.string(),
@@ -29,7 +29,7 @@ export const promptCreateRequest = z.object({
name: z.string().min(1).max(200),
prompt: z.string().min(1),
mode: z.enum(["transform", "explore"]),
- search_space_id: z.number().nullable().optional(),
+ workspace_id: z.number().nullable().optional(),
is_public: z.boolean().optional(),
});
diff --git a/surfsense_web/contracts/types/public-chat.types.ts b/surfsense_web/contracts/types/public-chat.types.ts
index 11c338dfd..96ebaeede 100644
--- a/surfsense_web/contracts/types/public-chat.types.ts
+++ b/surfsense_web/contracts/types/public-chat.types.ts
@@ -47,7 +47,7 @@ export const clonePublicChatRequest = z.object({
export const clonePublicChatResponse = z.object({
thread_id: z.number(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
// Type exports
diff --git a/surfsense_web/contracts/types/roles.types.ts b/surfsense_web/contracts/types/roles.types.ts
index 9008a859a..a599d01df 100644
--- a/surfsense_web/contracts/types/roles.types.ts
+++ b/surfsense_web/contracts/types/roles.types.ts
@@ -7,7 +7,7 @@ export const role = z.object({
permissions: z.array(z.string()),
is_default: z.boolean(),
is_system_role: z.boolean(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
created_at: z.string(),
});
@@ -15,7 +15,7 @@ export const role = z.object({
* Create role
*/
export const createRoleRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
data: role.pick({
name: true,
description: true,
@@ -30,7 +30,7 @@ export const createRoleResponse = role;
* Get roles
*/
export const getRolesRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
});
export const getRolesResponse = z.array(role);
@@ -39,7 +39,7 @@ export const getRolesResponse = z.array(role);
* Get role by ID
*/
export const getRoleByIdRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
role_id: z.number(),
});
@@ -49,7 +49,7 @@ export const getRoleByIdResponse = role;
* Update role
*/
export const updateRoleRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
role_id: z.number(),
data: role
.pick({
@@ -67,7 +67,7 @@ export const updateRoleResponse = role;
* Delete role
*/
export const deleteRoleRequest = z.object({
- search_space_id: z.number(),
+ workspace_id: z.number(),
role_id: z.number(),
});
diff --git a/surfsense_web/contracts/types/stripe.types.ts b/surfsense_web/contracts/types/stripe.types.ts
index c548a3dd0..20e05cd70 100644
--- a/surfsense_web/contracts/types/stripe.types.ts
+++ b/surfsense_web/contracts/types/stripe.types.ts
@@ -8,7 +8,7 @@ export const purchaseStatusEnum = z.enum(["pending", "completed", "failed"]);
export const createCreditCheckoutSessionRequest = z.object({
quantity: z.number().int().min(1).max(10_000),
- search_space_id: z.number().int().min(1),
+ workspace_id: z.number().int().min(1),
});
export const createCreditCheckoutSessionResponse = z.object({
@@ -90,7 +90,7 @@ export const updateAutoReloadSettingsRequest = z.object({
});
export const createAutoReloadSetupSessionRequest = z.object({
- search_space_id: z.number().int().min(1),
+ workspace_id: z.number().int().min(1),
});
export const createAutoReloadSetupSessionResponse = z.object({
diff --git a/surfsense_web/contracts/types/video-presentations.types.ts b/surfsense_web/contracts/types/video-presentations.types.ts
index 7e0603c75..f48e790d3 100644
--- a/surfsense_web/contracts/types/video-presentations.types.ts
+++ b/surfsense_web/contracts/types/video-presentations.types.ts
@@ -12,7 +12,7 @@ export const videoPresentationListItem = z.object({
title: z.string(),
status: videoPresentationStatus.default("ready"),
created_at: z.string(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
thread_id: z.number().nullish(),
});
export type VideoPresentationListItem = z.infer;
diff --git a/surfsense_web/contracts/types/workspace.types.ts b/surfsense_web/contracts/types/workspace.types.ts
index c62b39074..176c533d6 100644
--- a/surfsense_web/contracts/types/workspace.types.ts
+++ b/surfsense_web/contracts/types/workspace.types.ts
@@ -81,14 +81,14 @@ export const updateSearchSpaceApiAccessResponse = searchSpace.omit({
export const deleteSearchSpaceRequest = searchSpace.pick({ id: true });
export const deleteSearchSpaceResponse = z.object({
- message: z.literal("Search space deleted successfully"),
+ message: z.literal("Workspace deleted successfully"),
});
/**
* Leave search space (for non-owners)
*/
export const leaveSearchSpaceResponse = z.object({
- message: z.literal("Successfully left the search space"),
+ message: z.literal("Successfully left the workspace"),
});
// Inferred types
diff --git a/surfsense_web/hooks/use-agent-actions-query.ts b/surfsense_web/hooks/use-agent-actions-query.ts
index 1e2f45a8a..19737f58f 100644
--- a/surfsense_web/hooks/use-agent-actions-query.ts
+++ b/surfsense_web/hooks/use-agent-actions-query.ts
@@ -93,7 +93,7 @@ export function applyActionLogSse(
id: event.id,
thread_id: threadId,
user_id: null,
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
tool_name: event.tool_name,
args: null,
result_id: null,
diff --git a/surfsense_web/hooks/use-connectors-sync.ts b/surfsense_web/hooks/use-connectors-sync.ts
index 00e7350f8..148e85208 100644
--- a/surfsense_web/hooks/use-connectors-sync.ts
+++ b/surfsense_web/hooks/use-connectors-sync.ts
@@ -27,7 +27,7 @@ export function useConnectorsSync(searchSpaceId: number | string | null) {
periodic_indexing_enabled: c.periodicIndexingEnabled,
indexing_frequency_minutes: c.indexingFrequencyMinutes ?? null,
next_scheduled_at: c.nextScheduledAt ? new Date(c.nextScheduledAt).toISOString() : null,
- search_space_id: c.searchSpaceId,
+ workspace_id: c.searchSpaceId,
user_id: c.userId,
created_at: c.createdAt ? new Date(c.createdAt).toISOString() : new Date().toISOString(),
}));
diff --git a/surfsense_web/hooks/use-document-search.ts b/surfsense_web/hooks/use-document-search.ts
index fdd67a2fc..01adc5254 100644
--- a/surfsense_web/hooks/use-document-search.ts
+++ b/surfsense_web/hooks/use-document-search.ts
@@ -56,7 +56,7 @@ export function useDocumentSearch(
documentsApiService
.searchDocuments({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
page: 0,
page_size: SEARCH_INITIAL_SIZE,
title: query.trim(),
@@ -91,7 +91,7 @@ export function useDocumentSearch(
try {
const response = await documentsApiService.searchDocuments({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
skip: apiLoadedRef.current,
page_size: SEARCH_SCROLL_SIZE,
title: query.trim(),
diff --git a/surfsense_web/hooks/use-documents.ts b/surfsense_web/hooks/use-documents.ts
index b01adc10a..125c12404 100644
--- a/surfsense_web/hooks/use-documents.ts
+++ b/surfsense_web/hooks/use-documents.ts
@@ -13,7 +13,7 @@ export interface DocumentStatusType {
export interface DocumentDisplay {
id: number;
- search_space_id: number;
+ workspace_id: number;
document_type: string;
title: string;
created_by_id: string | null;
@@ -25,7 +25,7 @@ export interface DocumentDisplay {
export interface ApiDocumentInput {
id: number;
- search_space_id: number;
+ workspace_id: number;
document_type: string;
title: string;
created_by_id?: string | null;
@@ -38,7 +38,7 @@ export interface ApiDocumentInput {
export function toDisplayDoc(item: ApiDocumentInput): DocumentDisplay {
return {
id: item.id,
- search_space_id: item.search_space_id,
+ workspace_id: item.workspace_id,
document_type: item.document_type,
title: item.title,
created_by_id: item.created_by_id ?? null,
@@ -142,7 +142,7 @@ export function useDocuments(
const [docsResponse, countsResponse] = await Promise.all([
documentsApiService.getDocuments({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
page: 0,
page_size: INITIAL_PAGE_SIZE,
...(typeFilter.length > 0 && { document_types: typeFilter }),
@@ -151,7 +151,7 @@ export function useDocuments(
},
}),
documentsApiService.getDocumentTypeCounts({
- queryParams: { search_space_id: searchSpaceId },
+ queryParams: { workspace_id: searchSpaceId },
}),
]);
@@ -201,7 +201,7 @@ export function useDocuments(
documentsApiService
.getDocuments({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
page: 0,
page_size: 20,
},
@@ -232,7 +232,7 @@ export function useDocuments(
.filter((d) => !prevIds.has(d.id))
.map((doc) => ({
id: doc.id,
- search_space_id: doc.searchSpaceId,
+ workspace_id: doc.searchSpaceId,
document_type: doc.documentType,
title: doc.title,
created_by_id: doc.createdById ?? null,
@@ -308,7 +308,7 @@ export function useDocuments(
try {
const response = await documentsApiService.getDocuments({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
skip: apiLoadedCountRef.current,
page_size: SCROLL_PAGE_SIZE,
...(typeFilter.length > 0 && { document_types: typeFilter }),
diff --git a/surfsense_web/hooks/use-folder-sync.ts b/surfsense_web/hooks/use-folder-sync.ts
index 8e0d0ebdc..d29f0b32e 100644
--- a/surfsense_web/hooks/use-folder-sync.ts
+++ b/surfsense_web/hooks/use-folder-sync.ts
@@ -66,7 +66,7 @@ export function useFolderSync() {
await documentsApiService.folderUploadFiles(files, {
folder_name: batch.folderName,
- search_space_id: batch.searchSpaceId,
+ workspace_id: batch.searchSpaceId,
relative_paths: addChangeFiles.map((f) => f.relativePath),
root_folder_id: batch.rootFolderId,
});
@@ -75,7 +75,7 @@ export function useFolderSync() {
if (unlinkFiles.length > 0) {
await documentsApiService.folderNotifyUnlinked({
folder_name: batch.folderName,
- search_space_id: batch.searchSpaceId,
+ workspace_id: batch.searchSpaceId,
root_folder_id: batch.rootFolderId,
relative_paths: unlinkFiles.map((f) => f.relativePath),
});
diff --git a/surfsense_web/hooks/use-inbox.ts b/surfsense_web/hooks/use-inbox.ts
index 860c0e01a..b15dfc50a 100644
--- a/surfsense_web/hooks/use-inbox.ts
+++ b/surfsense_web/hooks/use-inbox.ts
@@ -79,7 +79,7 @@ export function useInbox(
try {
const notificationsPromise = notificationsApiService.getNotifications({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
category,
limit: INITIAL_PAGE_SIZE,
},
@@ -146,7 +146,7 @@ export function useInbox(
({
id: item.id,
user_id: item.userId,
- search_space_id: item.searchSpaceId ?? undefined,
+ workspace_id: item.searchSpaceId ?? undefined,
type: item.type,
title: item.title,
message: item.message,
@@ -208,7 +208,7 @@ export function useInbox(
const response = await notificationsApiService.getNotifications({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
category,
before_date: beforeDate,
limit: SCROLL_PAGE_SIZE,
diff --git a/surfsense_web/hooks/use-logs.ts b/surfsense_web/hooks/use-logs.ts
index b646b078d..301796d2c 100644
--- a/surfsense_web/hooks/use-logs.ts
+++ b/surfsense_web/hooks/use-logs.ts
@@ -24,8 +24,8 @@ export function useLogs(searchSpaceId?: number, filters: LogFilters = {}) {
const allFilters = { ...memoizedFilters, ...customFilters };
- if (allFilters.search_space_id) {
- params.search_space_id = allFilters.search_space_id.toString();
+ if (allFilters.workspace_id) {
+ params.workspace_id = allFilters.workspace_id.toString();
}
if (allFilters.level) {
params.level = allFilters.level;
@@ -55,13 +55,13 @@ export function useLogs(searchSpaceId?: number, filters: LogFilters = {}) {
refetch,
} = useQuery({
queryKey: cacheKeys.logs.withQueryParams({
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
...buildQueryParams(filters ?? {}),
}),
queryFn: () =>
logsApiService.getLogs({
queryParams: {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
...buildQueryParams(filters ?? {}),
},
}),
@@ -95,7 +95,7 @@ export function useLogsSummary(
queryKey: cacheKeys.logs.summary(searchSpaceId),
queryFn: () =>
logsApiService.getLogSummary({
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
hours: hours,
}),
enabled: !!searchSpaceId,
diff --git a/surfsense_web/hooks/use-search-source-connectors.ts b/surfsense_web/hooks/use-search-source-connectors.ts
index c2e9566b4..321bbfb25 100644
--- a/surfsense_web/hooks/use-search-source-connectors.ts
+++ b/surfsense_web/hooks/use-search-source-connectors.ts
@@ -8,7 +8,7 @@ export interface SearchSourceConnector {
is_indexable: boolean;
last_indexed_at: string | null;
config: Record;
- search_space_id: number;
+ workspace_id: number;
user_id?: string;
created_at?: string;
periodic_indexing_enabled: boolean;
@@ -108,7 +108,7 @@ export const useSearchSourceConnectors = (lazy: boolean = false, searchSpaceId?:
const response = await authenticatedFetch(
buildBackendUrl("/api/v1/search-source-connectors", {
- search_space_id: spaceId,
+ workspace_id: spaceId,
}),
{
method: "GET",
@@ -157,17 +157,17 @@ export const useSearchSourceConnectors = (lazy: boolean = false, searchSpaceId?:
/**
* Create a new search source connector
- * @param connectorData - The connector data (excluding search_space_id)
+ * @param connectorData - The connector data (excluding workspace_id)
* @param spaceId - The search space ID to associate the connector with
*/
const createConnector = async (
- connectorData: Omit,
+ connectorData: Omit,
spaceId: number
) => {
try {
const response = await authenticatedFetch(
buildBackendUrl("/api/v1/search-source-connectors", {
- search_space_id: spaceId,
+ workspace_id: spaceId,
}),
{
method: "POST",
@@ -199,7 +199,7 @@ export const useSearchSourceConnectors = (lazy: boolean = false, searchSpaceId?:
const updateConnector = async (
connectorId: number,
connectorData: Partial<
- Omit
+ Omit
>
) => {
try {
@@ -269,7 +269,7 @@ export const useSearchSourceConnectors = (lazy: boolean = false, searchSpaceId?:
try {
const response = await authenticatedFetch(
buildBackendUrl(`/api/v1/search-source-connectors/${connectorId}/index`, {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
start_date: startDate,
end_date: endDate,
}),
diff --git a/surfsense_web/lib/apis/agent-actions-api.service.ts b/surfsense_web/lib/apis/agent-actions-api.service.ts
index 6634a11f7..f780810a0 100644
--- a/surfsense_web/lib/apis/agent-actions-api.service.ts
+++ b/surfsense_web/lib/apis/agent-actions-api.service.ts
@@ -5,7 +5,7 @@ const AgentActionReadSchema = z.object({
id: z.number(),
thread_id: z.number(),
user_id: z.string().nullable(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
tool_name: z.string(),
args: z.record(z.string(), z.unknown()).nullable(),
result_id: z.string().nullable(),
diff --git a/surfsense_web/lib/apis/agent-permissions-api.service.ts b/surfsense_web/lib/apis/agent-permissions-api.service.ts
index 6927c55d0..f7aa14af7 100644
--- a/surfsense_web/lib/apis/agent-permissions-api.service.ts
+++ b/surfsense_web/lib/apis/agent-permissions-api.service.ts
@@ -7,7 +7,7 @@ export type AgentPermissionAction = z.infer;
const AgentPermissionRuleSchema = z.object({
id: z.number(),
- search_space_id: z.number(),
+ workspace_id: z.number(),
user_id: z.string().nullable(),
thread_id: z.number().nullable(),
permission: z.string(),
@@ -44,7 +44,7 @@ export type AgentPermissionRuleUpdate = z.infer => {
return baseApiService.get(
- `/api/v1/searchspaces/${searchSpaceId}/agent/permissions/rules`,
+ `/api/v1/workspaces/${searchSpaceId}/agent/permissions/rules`,
AgentPermissionRuleListSchema
);
};
@@ -58,7 +58,7 @@ class AgentPermissionsApiService {
throw new ValidationError(parsed.error.issues.map((i) => i.message).join(", "));
}
return baseApiService.post(
- `/api/v1/searchspaces/${searchSpaceId}/agent/permissions/rules`,
+ `/api/v1/workspaces/${searchSpaceId}/agent/permissions/rules`,
AgentPermissionRuleSchema,
{ body: parsed.data }
);
@@ -74,7 +74,7 @@ class AgentPermissionsApiService {
throw new ValidationError(parsed.error.issues.map((i) => i.message).join(", "));
}
return baseApiService.patch(
- `/api/v1/searchspaces/${searchSpaceId}/agent/permissions/rules/${ruleId}`,
+ `/api/v1/workspaces/${searchSpaceId}/agent/permissions/rules/${ruleId}`,
AgentPermissionRuleSchema,
{ body: parsed.data }
);
@@ -82,7 +82,7 @@ class AgentPermissionsApiService {
remove = async (searchSpaceId: number, ruleId: number): Promise => {
await baseApiService.delete(
- `/api/v1/searchspaces/${searchSpaceId}/agent/permissions/rules/${ruleId}`
+ `/api/v1/workspaces/${searchSpaceId}/agent/permissions/rules/${ruleId}`
);
};
}
diff --git a/surfsense_web/lib/apis/automations-api.service.ts b/surfsense_web/lib/apis/automations-api.service.ts
index baaf08799..b963f2668 100644
--- a/surfsense_web/lib/apis/automations-api.service.ts
+++ b/surfsense_web/lib/apis/automations-api.service.ts
@@ -37,7 +37,7 @@ class AutomationsApiService {
listAutomations = async (params: AutomationListParams) => {
const qs = new URLSearchParams({
- search_space_id: String(params.search_space_id),
+ workspace_id: String(params.workspace_id),
limit: String(params.limit),
offset: String(params.offset),
});
@@ -66,7 +66,7 @@ class AutomationsApiService {
// Whether the search space's models are billable for automations (premium
// global or BYOK). Used to gate creation surfaces before submit.
getModelEligibility = async (searchSpaceId: number) => {
- const qs = new URLSearchParams({ search_space_id: String(searchSpaceId) });
+ const qs = new URLSearchParams({ workspace_id: String(searchSpaceId) });
return baseApiService.get(`${BASE}/model-eligibility?${qs.toString()}`, modelEligibility);
};
diff --git a/surfsense_web/lib/apis/chat-comments-api.service.ts b/surfsense_web/lib/apis/chat-comments-api.service.ts
index f1ec7a5d9..24f2fb54e 100644
--- a/surfsense_web/lib/apis/chat-comments-api.service.ts
+++ b/surfsense_web/lib/apis/chat-comments-api.service.ts
@@ -139,8 +139,8 @@ class ChatCommentsApiService {
}
const params = new URLSearchParams();
- if (parsed.data.search_space_id !== undefined) {
- params.set("search_space_id", String(parsed.data.search_space_id));
+ if (parsed.data.workspace_id !== undefined) {
+ params.set("workspace_id", String(parsed.data.workspace_id));
}
const queryString = params.toString();
diff --git a/surfsense_web/lib/apis/chat-threads-api.service.ts b/surfsense_web/lib/apis/chat-threads-api.service.ts
index 9dcd85761..b16e61985 100644
--- a/surfsense_web/lib/apis/chat-threads-api.service.ts
+++ b/surfsense_web/lib/apis/chat-threads-api.service.ts
@@ -86,7 +86,7 @@ class ChatThreadsApiService {
}
return baseApiService.get(
- `/api/v1/searchspaces/${parsed.data.search_space_id}/snapshots`,
+ `/api/v1/workspaces/${parsed.data.workspace_id}/snapshots`,
publicChatSnapshotsBySpaceResponse
);
};
diff --git a/surfsense_web/lib/apis/connectors-api.service.ts b/surfsense_web/lib/apis/connectors-api.service.ts
index 4b6d69883..8870ac5b4 100644
--- a/surfsense_web/lib/apis/connectors-api.service.ts
+++ b/surfsense_web/lib/apis/connectors-api.service.ts
@@ -311,10 +311,10 @@ class ConnectorsApiService {
* Get all MCP connectors for a search space
*/
getMCPConnectors = async (request: GetMCPConnectorsRequest) => {
- const { search_space_id } = request.queryParams;
+ const { workspace_id } = request.queryParams;
const queryString = new URLSearchParams({
- search_space_id: String(search_space_id),
+ workspace_id: String(workspace_id),
}).toString();
return baseApiService.get(`/api/v1/connectors/mcp?${queryString}`);
@@ -334,7 +334,7 @@ class ConnectorsApiService {
const { data, queryParams } = request;
const queryString = new URLSearchParams({
- search_space_id: String(queryParams.search_space_id),
+ workspace_id: String(queryParams.workspace_id),
}).toString();
return baseApiService.post(
diff --git a/surfsense_web/lib/apis/documents-api.service.ts b/surfsense_web/lib/apis/documents-api.service.ts
index 5b50db0c1..4ecf62b72 100644
--- a/surfsense_web/lib/apis/documents-api.service.ts
+++ b/surfsense_web/lib/apis/documents-api.service.ts
@@ -126,7 +126,7 @@ class DocumentsApiService {
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- const { files, search_space_id, use_vision_llm, processing_mode } = parsedRequest.data;
+ const { files, workspace_id, use_vision_llm, processing_mode } = parsedRequest.data;
const UPLOAD_BATCH_SIZE = 5;
const batches: File[][] = [];
@@ -143,7 +143,7 @@ class DocumentsApiService {
for (const batch of batches) {
const formData = new FormData();
for (const file of batch) formData.append("files", file);
- formData.append("search_space_id", String(search_space_id));
+ formData.append("workspace_id", String(workspace_id));
formData.append("use_vision_llm", String(use_vision_llm));
formData.append("processing_mode", processing_mode);
@@ -189,9 +189,9 @@ class DocumentsApiService {
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- const { search_space_id, document_ids } = parsedRequest.data.queryParams;
+ const { workspace_id, document_ids } = parsedRequest.data.queryParams;
const params = new URLSearchParams({
- search_space_id: String(search_space_id),
+ workspace_id: String(workspace_id),
document_ids: document_ids.join(","),
});
@@ -266,9 +266,9 @@ class DocumentsApiService {
);
};
- getDocumentByVirtualPath = async (request: { search_space_id: number; virtual_path: string }) => {
+ getDocumentByVirtualPath = async (request: { workspace_id: number; virtual_path: string }) => {
const params = new URLSearchParams({
- search_space_id: String(request.search_space_id),
+ workspace_id: String(request.workspace_id),
virtual_path: request.virtual_path,
});
return baseApiService.get(
@@ -403,7 +403,7 @@ class DocumentsApiService {
folderMtimeCheck = async (body: {
folder_name: string;
- search_space_id: number;
+ workspace_id: number;
files: { relative_path: string; mtime: number }[];
}): Promise<{ files_to_upload: string[] }> => {
return baseApiService.post(`/api/v1/documents/folder-mtime-check`, undefined, {
@@ -415,7 +415,7 @@ class DocumentsApiService {
files: File[],
metadata: {
folder_name: string;
- search_space_id: number;
+ workspace_id: number;
relative_paths: string[];
root_folder_id?: number | null;
use_vision_llm?: boolean;
@@ -428,7 +428,7 @@ class DocumentsApiService {
formData.append("files", file);
}
formData.append("folder_name", metadata.folder_name);
- formData.append("search_space_id", String(metadata.search_space_id));
+ formData.append("workspace_id", String(metadata.workspace_id));
formData.append("relative_paths", JSON.stringify(metadata.relative_paths));
if (metadata.root_folder_id != null) {
formData.append("root_folder_id", String(metadata.root_folder_id));
@@ -458,7 +458,7 @@ class DocumentsApiService {
folderNotifyUnlinked = async (body: {
folder_name: string;
- search_space_id: number;
+ workspace_id: number;
root_folder_id: number | null;
relative_paths: string[];
}): Promise<{ deleted_count: number }> => {
@@ -469,7 +469,7 @@ class DocumentsApiService {
folderSyncFinalize = async (body: {
folder_name: string;
- search_space_id: number;
+ workspace_id: number;
root_folder_id: number | null;
all_relative_paths: string[];
}): Promise<{ deleted_count: number }> => {
@@ -480,7 +480,7 @@ class DocumentsApiService {
getWatchedFolders = async (searchSpaceId: number) => {
return baseApiService.get(
- `/api/v1/documents/watched-folders?search_space_id=${searchSpaceId}`,
+ `/api/v1/documents/watched-folders?workspace_id=${searchSpaceId}`,
folderListResponse
);
};
diff --git a/surfsense_web/lib/apis/folders-api.service.ts b/surfsense_web/lib/apis/folders-api.service.ts
index 2e535d615..c7d7322f0 100644
--- a/surfsense_web/lib/apis/folders-api.service.ts
+++ b/surfsense_web/lib/apis/folders-api.service.ts
@@ -31,10 +31,7 @@ class FoldersApiService {
};
listFolders = async (searchSpaceId: number) => {
- return baseApiService.get(
- `/api/v1/folders?search_space_id=${searchSpaceId}`,
- folderListResponse
- );
+ return baseApiService.get(`/api/v1/folders?workspace_id=${searchSpaceId}`, folderListResponse);
};
getFolder = async (folderId: number) => {
diff --git a/surfsense_web/lib/apis/image-generations-api.service.ts b/surfsense_web/lib/apis/image-generations-api.service.ts
index 6aa17854d..6f173dafc 100644
--- a/surfsense_web/lib/apis/image-generations-api.service.ts
+++ b/surfsense_web/lib/apis/image-generations-api.service.ts
@@ -9,7 +9,7 @@ const BASE = "/api/v1/image-generations";
class ImageGenerationsApiService {
list = async (searchSpaceId: number, limit = 100) => {
const qs = new URLSearchParams({
- search_space_id: String(searchSpaceId),
+ workspace_id: String(searchSpaceId),
limit: String(limit),
}).toString();
return baseApiService.get(`${BASE}?${qs}`, imageGenerationList);
diff --git a/surfsense_web/lib/apis/invites-api.service.ts b/surfsense_web/lib/apis/invites-api.service.ts
index 34889e094..d7ee27249 100644
--- a/surfsense_web/lib/apis/invites-api.service.ts
+++ b/surfsense_web/lib/apis/invites-api.service.ts
@@ -36,7 +36,7 @@ class InvitesApiService {
}
return baseApiService.post(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/invites`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/invites`,
createInviteResponse,
{
body: parsedRequest.data.data,
@@ -58,7 +58,7 @@ class InvitesApiService {
}
return baseApiService.get(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/invites`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/invites`,
getInvitesResponse
);
};
@@ -77,7 +77,7 @@ class InvitesApiService {
}
return baseApiService.put(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/invites/${parsedRequest.data.invite_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/invites/${parsedRequest.data.invite_id}`,
updateInviteResponse,
{
body: parsedRequest.data.data,
@@ -99,7 +99,7 @@ class InvitesApiService {
}
return baseApiService.delete(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/invites/${parsedRequest.data.invite_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/invites/${parsedRequest.data.invite_id}`,
deleteInviteResponse
);
};
diff --git a/surfsense_web/lib/apis/logs-api.service.ts b/surfsense_web/lib/apis/logs-api.service.ts
index 700089354..6c389860c 100644
--- a/surfsense_web/lib/apis/logs-api.service.ts
+++ b/surfsense_web/lib/apis/logs-api.service.ts
@@ -117,8 +117,8 @@ class LogsApiService {
const errorMessage = parsedRequest.error.issues.map((issue) => issue.message).join(", ");
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- const { search_space_id, hours } = parsedRequest.data;
- const url = `/api/v1/logs/search-space/${search_space_id}/summary${hours ? `?hours=${hours}` : ""}`;
+ const { workspace_id, hours } = parsedRequest.data;
+ const url = `/api/v1/logs/workspaces/${workspace_id}/summary${hours ? `?hours=${hours}` : ""}`;
return baseApiService.get(url, getLogSummaryResponse);
};
}
diff --git a/surfsense_web/lib/apis/members-api.service.ts b/surfsense_web/lib/apis/members-api.service.ts
index 8d0d19663..f0a80eccb 100644
--- a/surfsense_web/lib/apis/members-api.service.ts
+++ b/surfsense_web/lib/apis/members-api.service.ts
@@ -33,7 +33,7 @@ class MembersApiService {
}
return baseApiService.get(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/members`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/members`,
getMembersResponse
);
};
@@ -52,7 +52,7 @@ class MembersApiService {
}
return baseApiService.put(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/members/${parsedRequest.data.membership_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/members/${parsedRequest.data.membership_id}`,
updateMembershipResponse,
{
body: parsedRequest.data.data,
@@ -74,7 +74,7 @@ class MembersApiService {
}
return baseApiService.delete(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/members/${parsedRequest.data.membership_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/members/${parsedRequest.data.membership_id}`,
deleteMembershipResponse
);
};
@@ -93,7 +93,7 @@ class MembersApiService {
}
return baseApiService.delete(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/members/me`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/members/me`,
leaveSearchSpaceResponse
);
};
@@ -112,7 +112,7 @@ class MembersApiService {
}
return baseApiService.get(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/my-access`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/my-access`,
getMyAccessResponse
);
};
diff --git a/surfsense_web/lib/apis/model-connections-api.service.ts b/surfsense_web/lib/apis/model-connections-api.service.ts
index c69bcbef2..9ac536010 100644
--- a/surfsense_web/lib/apis/model-connections-api.service.ts
+++ b/surfsense_web/lib/apis/model-connections-api.service.ts
@@ -46,7 +46,7 @@ class ModelConnectionsApiService {
getConnections = async (searchSpaceId: number): Promise => {
return baseApiService.get(
- `/api/v1/model-connections?search_space_id=${searchSpaceId}`,
+ `/api/v1/model-connections?workspace_id=${searchSpaceId}`,
connectionListResponse
);
};
@@ -159,11 +159,11 @@ class ModelConnectionsApiService {
};
getModelRoles = async (searchSpaceId: number): Promise => {
- return baseApiService.get(`/api/v1/search-spaces/${searchSpaceId}/model-roles`, modelRoles);
+ return baseApiService.get(`/api/v1/workspaces/${searchSpaceId}/model-roles`, modelRoles);
};
updateModelRoles = async (searchSpaceId: number, roles: ModelRoles): Promise => {
- return baseApiService.put(`/api/v1/search-spaces/${searchSpaceId}/model-roles`, modelRoles, {
+ return baseApiService.put(`/api/v1/workspaces/${searchSpaceId}/model-roles`, modelRoles, {
body: roles,
});
};
diff --git a/surfsense_web/lib/apis/notifications-api.service.ts b/surfsense_web/lib/apis/notifications-api.service.ts
index bec28df29..3cd69a66a 100644
--- a/surfsense_web/lib/apis/notifications-api.service.ts
+++ b/surfsense_web/lib/apis/notifications-api.service.ts
@@ -41,8 +41,8 @@ class NotificationsApiService {
// Build query string from params
const params = new URLSearchParams();
- if (queryParams.search_space_id !== undefined) {
- params.append("search_space_id", String(queryParams.search_space_id));
+ if (queryParams.workspace_id !== undefined) {
+ params.append("workspace_id", String(queryParams.workspace_id));
}
if (queryParams.type) {
params.append("type", queryParams.type);
@@ -113,7 +113,7 @@ class NotificationsApiService {
getSourceTypes = async (searchSpaceId?: number): Promise => {
const params = new URLSearchParams();
if (searchSpaceId !== undefined) {
- params.append("search_space_id", String(searchSpaceId));
+ params.append("workspace_id", String(searchSpaceId));
}
const queryString = params.toString();
@@ -136,7 +136,7 @@ class NotificationsApiService {
): Promise => {
const params = new URLSearchParams();
if (searchSpaceId !== undefined) {
- params.append("search_space_id", String(searchSpaceId));
+ params.append("workspace_id", String(searchSpaceId));
}
if (type) {
params.append("type", type);
@@ -159,7 +159,7 @@ class NotificationsApiService {
getBatchUnreadCounts = async (searchSpaceId?: number): Promise => {
const params = new URLSearchParams();
if (searchSpaceId !== undefined) {
- params.append("search_space_id", String(searchSpaceId));
+ params.append("workspace_id", String(searchSpaceId));
}
const queryString = params.toString();
diff --git a/surfsense_web/lib/apis/podcasts-api.service.ts b/surfsense_web/lib/apis/podcasts-api.service.ts
index 3a18c7951..1108c8ca3 100644
--- a/surfsense_web/lib/apis/podcasts-api.service.ts
+++ b/surfsense_web/lib/apis/podcasts-api.service.ts
@@ -17,7 +17,7 @@ const voiceOptionList = z.array(voiceOption);
class PodcastsApiService {
list = async (searchSpaceId: number, limit = 200) => {
const qs = new URLSearchParams({
- search_space_id: String(searchSpaceId),
+ workspace_id: String(searchSpaceId),
limit: String(limit),
}).toString();
return baseApiService.get(`${BASE}?${qs}`, podcastSummaryList);
diff --git a/surfsense_web/lib/apis/prompts-api.service.ts b/surfsense_web/lib/apis/prompts-api.service.ts
index 38c2ffb4e..b6418082b 100644
--- a/surfsense_web/lib/apis/prompts-api.service.ts
+++ b/surfsense_web/lib/apis/prompts-api.service.ts
@@ -15,7 +15,7 @@ class PromptsApiService {
list = async (searchSpaceId?: number) => {
const params = new URLSearchParams();
if (searchSpaceId !== undefined) {
- params.set("search_space_id", String(searchSpaceId));
+ params.set("workspace_id", String(searchSpaceId));
}
const queryString = params.toString();
const url = queryString ? `/api/v1/prompts?${queryString}` : "/api/v1/prompts";
diff --git a/surfsense_web/lib/apis/reports-api.service.ts b/surfsense_web/lib/apis/reports-api.service.ts
index bc4483f37..e795e7f66 100644
--- a/surfsense_web/lib/apis/reports-api.service.ts
+++ b/surfsense_web/lib/apis/reports-api.service.ts
@@ -6,7 +6,7 @@ const BASE = "/api/v1/reports";
class ReportsApiService {
list = async (searchSpaceId: number, limit = 200) => {
const qs = new URLSearchParams({
- search_space_id: String(searchSpaceId),
+ workspace_id: String(searchSpaceId),
limit: String(limit),
}).toString();
return baseApiService.get(`${BASE}?${qs}`, reportList);
diff --git a/surfsense_web/lib/apis/roles-api.service.ts b/surfsense_web/lib/apis/roles-api.service.ts
index 10023799b..e8264fc89 100644
--- a/surfsense_web/lib/apis/roles-api.service.ts
+++ b/surfsense_web/lib/apis/roles-api.service.ts
@@ -30,7 +30,7 @@ class RolesApiService {
}
return baseApiService.post(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/roles`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/roles`,
createRoleResponse,
{
body: parsedRequest.data.data,
@@ -49,7 +49,7 @@ class RolesApiService {
}
return baseApiService.get(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/roles`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/roles`,
getRolesResponse
);
};
@@ -65,7 +65,7 @@ class RolesApiService {
}
return baseApiService.get(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/roles/${parsedRequest.data.role_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/roles/${parsedRequest.data.role_id}`,
getRoleByIdResponse
);
};
@@ -81,7 +81,7 @@ class RolesApiService {
}
return baseApiService.put(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/roles/${parsedRequest.data.role_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/roles/${parsedRequest.data.role_id}`,
updateRoleResponse,
{
body: parsedRequest.data.data,
@@ -100,7 +100,7 @@ class RolesApiService {
}
return baseApiService.delete(
- `/api/v1/searchspaces/${parsedRequest.data.search_space_id}/roles/${parsedRequest.data.role_id}`,
+ `/api/v1/workspaces/${parsedRequest.data.workspace_id}/roles/${parsedRequest.data.role_id}`,
deleteRoleResponse
);
};
diff --git a/surfsense_web/lib/apis/video-presentations-api.service.ts b/surfsense_web/lib/apis/video-presentations-api.service.ts
index ef3ac21ed..4c8da510d 100644
--- a/surfsense_web/lib/apis/video-presentations-api.service.ts
+++ b/surfsense_web/lib/apis/video-presentations-api.service.ts
@@ -6,7 +6,7 @@ const BASE = "/api/v1/video-presentations";
class VideoPresentationsApiService {
list = async (searchSpaceId: number, limit = 200) => {
const qs = new URLSearchParams({
- search_space_id: String(searchSpaceId),
+ workspace_id: String(searchSpaceId),
limit: String(limit),
}).toString();
return baseApiService.get(`${BASE}?${qs}`, videoPresentationList);
diff --git a/surfsense_web/lib/apis/workspaces-api.service.ts b/surfsense_web/lib/apis/workspaces-api.service.ts
index 7f98399bd..1e5fb78f1 100644
--- a/surfsense_web/lib/apis/workspaces-api.service.ts
+++ b/surfsense_web/lib/apis/workspaces-api.service.ts
@@ -19,7 +19,7 @@ import {
updateSearchSpaceApiAccessResponse,
updateSearchSpaceRequest,
updateSearchSpaceResponse,
-} from "@/contracts/types/search-space.types";
+} from "@/contracts/types/workspace.types";
import { ValidationError } from "../error";
import { baseApiService } from "./base-api.service";
@@ -50,7 +50,7 @@ class SearchSpacesApiService {
? new URLSearchParams(transformedQueryParams).toString()
: "";
- return baseApiService.get(`/api/v1/searchspaces?${queryParams}`, getSearchSpacesResponse);
+ return baseApiService.get(`/api/v1/workspaces?${queryParams}`, getSearchSpacesResponse);
};
/**
@@ -66,7 +66,7 @@ class SearchSpacesApiService {
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- return baseApiService.post(`/api/v1/searchspaces`, createSearchSpaceResponse, {
+ return baseApiService.post(`/api/v1/workspaces`, createSearchSpaceResponse, {
body: parsedRequest.data,
});
};
@@ -84,7 +84,7 @@ class SearchSpacesApiService {
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- return baseApiService.get(`/api/v1/searchspaces/${request.id}`, getSearchSpaceResponse);
+ return baseApiService.get(`/api/v1/workspaces/${request.id}`, getSearchSpaceResponse);
};
/**
@@ -100,7 +100,7 @@ class SearchSpacesApiService {
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- return baseApiService.put(`/api/v1/searchspaces/${request.id}`, updateSearchSpaceResponse, {
+ return baseApiService.put(`/api/v1/workspaces/${request.id}`, updateSearchSpaceResponse, {
body: parsedRequest.data.data,
});
};
@@ -115,7 +115,7 @@ class SearchSpacesApiService {
}
return baseApiService.put(
- `/api/v1/searchspaces/${request.id}/api-access`,
+ `/api/v1/workspaces/${request.id}/api-access`,
updateSearchSpaceApiAccessResponse,
{
body: { api_access_enabled: parsedRequest.data.api_access_enabled },
@@ -136,7 +136,7 @@ class SearchSpacesApiService {
throw new ValidationError(`Invalid request: ${errorMessage}`);
}
- return baseApiService.delete(`/api/v1/searchspaces/${request.id}`, deleteSearchSpaceResponse);
+ return baseApiService.delete(`/api/v1/workspaces/${request.id}`, deleteSearchSpaceResponse);
};
/**
@@ -144,7 +144,7 @@ class SearchSpacesApiService {
*/
triggerAiSort = async (searchSpaceId: number) => {
return baseApiService.post(
- `/api/v1/searchspaces/${searchSpaceId}/ai-sort`,
+ `/api/v1/workspaces/${searchSpaceId}/ai-sort`,
z.object({ message: z.string() }),
{}
);
@@ -156,7 +156,7 @@ class SearchSpacesApiService {
*/
leaveSearchSpace = async (searchSpaceId: number) => {
return baseApiService.delete(
- `/api/v1/searchspaces/${searchSpaceId}/members/me`,
+ `/api/v1/workspaces/${searchSpaceId}/members/me`,
leaveSearchSpaceResponse
);
};
diff --git a/surfsense_web/lib/automations/builder-schema.ts b/surfsense_web/lib/automations/builder-schema.ts
index 5bb034bef..1480951c9 100644
--- a/surfsense_web/lib/automations/builder-schema.ts
+++ b/surfsense_web/lib/automations/builder-schema.ts
@@ -271,7 +271,7 @@ export function buildCreatePayload(
): AutomationCreateRequest {
const trigger = buildScheduleTrigger(form);
return {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
name: form.name.trim(),
description: form.description?.trim() ? form.description.trim() : null,
definition: buildDefinition(form),
diff --git a/surfsense_web/lib/chat/thread-persistence.ts b/surfsense_web/lib/chat/thread-persistence.ts
index dc5846f23..11b10760c 100644
--- a/surfsense_web/lib/chat/thread-persistence.ts
+++ b/surfsense_web/lib/chat/thread-persistence.ts
@@ -20,7 +20,7 @@ export interface ThreadRecord {
archived: boolean;
visibility: ChatVisibility;
created_by_id: string | null;
- search_space_id: number;
+ workspace_id: number;
created_at: string;
updated_at: string;
has_comments?: boolean;
@@ -95,7 +95,7 @@ export async function fetchThreads(
searchSpaceId: number,
limit?: number
): Promise {
- const params = new URLSearchParams({ search_space_id: String(searchSpaceId) });
+ const params = new URLSearchParams({ workspace_id: String(searchSpaceId) });
if (limit) params.append("limit", String(limit));
return baseApiService.get(`/api/v1/threads?${params}`);
}
@@ -108,7 +108,7 @@ export async function searchThreads(
title: string
): Promise {
const params = new URLSearchParams({
- search_space_id: String(searchSpaceId),
+ workspace_id: String(searchSpaceId),
title,
});
return baseApiService.get(`/api/v1/threads/search?${params}`);
@@ -125,7 +125,7 @@ export async function createThread(
body: {
title,
archived: false,
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
},
});
}
diff --git a/surfsense_web/lib/folder-sync-upload.ts b/surfsense_web/lib/folder-sync-upload.ts
index 334d9550d..114bd516f 100644
--- a/surfsense_web/lib/folder-sync-upload.ts
+++ b/surfsense_web/lib/folder-sync-upload.ts
@@ -95,7 +95,7 @@ async function uploadBatchesWithConcurrency(
files,
{
folder_name: params.folderName,
- search_space_id: params.searchSpaceId,
+ workspace_id: params.searchSpaceId,
relative_paths: batch.map((e) => e.relativePath),
root_folder_id: resolvedRootFolderId,
processing_mode: params.processingMode,
@@ -169,7 +169,7 @@ export async function uploadFolderScan(params: FolderSyncParams): Promise ({ relative_path: f.relativePath, mtime: f.mtimeMs / 1000 })),
});
@@ -214,7 +214,7 @@ export async function uploadFolderScan(params: FolderSyncParams): Promise f.relativePath),
});
diff --git a/surfsense_web/lib/posthog/events.ts b/surfsense_web/lib/posthog/events.ts
index 948c436de..44b5c32cd 100644
--- a/surfsense_web/lib/posthog/events.ts
+++ b/surfsense_web/lib/posthog/events.ts
@@ -80,20 +80,20 @@ export function trackLogout() {
export function trackSearchSpaceCreated(searchSpaceId: number, name: string) {
safeCapture("search_space_created", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
name,
});
}
export function trackSearchSpaceDeleted(searchSpaceId: number) {
safeCapture("search_space_deleted", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
});
}
export function trackSearchSpaceViewed(searchSpaceId: number) {
safeCapture("search_space_viewed", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
});
}
@@ -103,7 +103,7 @@ export function trackSearchSpaceViewed(searchSpaceId: number) {
export function trackChatCreated(searchSpaceId: number, chatId: number) {
safeCapture("chat_created", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId,
});
}
@@ -118,7 +118,7 @@ export function trackChatMessageSent(
}
) {
safeCapture("chat_message_sent", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId,
has_attachments: options?.hasAttachments ?? false,
has_mentioned_documents: options?.hasMentionedDocuments ?? false,
@@ -128,14 +128,14 @@ export function trackChatMessageSent(
export function trackChatResponseReceived(searchSpaceId: number, chatId: number) {
safeCapture("chat_response_received", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId,
});
}
export function trackChatError(searchSpaceId: number, chatId: number, error?: string) {
safeCapture("chat_error", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId,
error,
});
@@ -158,7 +158,7 @@ export function trackChatBlocked(
safeCapture(
"chat_blocked",
compact({
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId ?? undefined,
flow: payload.flow,
kind: payload.kind,
@@ -178,7 +178,7 @@ export function trackChatErrorDetailed(
safeCapture(
"chat_error",
compact({
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId ?? undefined,
flow: payload.flow,
kind: payload.kind,
@@ -220,7 +220,7 @@ export function trackDocumentUploadStarted(
totalSizeBytes: number
) {
safeCapture("document_upload_started", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
file_count: fileCount,
total_size_bytes: totalSizeBytes,
});
@@ -228,35 +228,35 @@ export function trackDocumentUploadStarted(
export function trackDocumentUploadSuccess(searchSpaceId: number, fileCount: number) {
safeCapture("document_upload_success", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
file_count: fileCount,
});
}
export function trackDocumentUploadFailure(searchSpaceId: number, error?: string) {
safeCapture("document_upload_failure", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
error,
});
}
export function trackDocumentDeleted(searchSpaceId: number, documentId: number) {
safeCapture("document_deleted", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
document_id: documentId,
});
}
export function trackDocumentBulkDeleted(searchSpaceId: number, count: number) {
safeCapture("document_bulk_deleted", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
count,
});
}
export function trackYouTubeImport(searchSpaceId: number, url: string) {
safeCapture("youtube_import_started", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
url,
});
}
@@ -303,7 +303,7 @@ export function trackConnectorEvent(
const meta = getConnectorTelemetryMeta(connectorType);
safeCapture(`connector_${stage}`, {
...compact({
- search_space_id: options.searchSpaceId ?? undefined,
+ workspace_id: options.searchSpaceId ?? undefined,
connector_id: options.connectorId ?? undefined,
source: options.source,
error: options.error,
@@ -369,14 +369,14 @@ export function trackConnectorSynced(
export function trackSettingsViewed(searchSpaceId: number, section: string) {
safeCapture("settings_viewed", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
section,
});
}
export function trackSettingsUpdated(searchSpaceId: number, section: string, setting: string) {
safeCapture("settings_updated", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
section,
setting,
});
@@ -388,14 +388,14 @@ export function trackSettingsUpdated(searchSpaceId: number, section: string, set
export function trackPodcastGenerated(searchSpaceId: number, chatId: number) {
safeCapture("podcast_generated", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
chat_id: chatId,
});
}
export function trackSourcesTabViewed(searchSpaceId: number, tab: string) {
safeCapture("sources_tab_viewed", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
tab,
});
}
@@ -423,7 +423,7 @@ export function trackSearchSpaceInviteSent(
}
) {
safeCapture("search_space_invite_sent", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
role_name: options?.roleName,
has_expiry: options?.hasExpiry ?? false,
has_max_uses: options?.hasMaxUses ?? false,
@@ -436,7 +436,7 @@ export function trackSearchSpaceInviteAccepted(
roleName?: string | null
) {
safeCapture("search_space_invite_accepted", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
search_space_name: searchSpaceName,
role_name: roleName,
});
@@ -454,7 +454,7 @@ export function trackSearchSpaceUserAdded(
roleName?: string | null
) {
safeCapture("search_space_user_added", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
search_space_name: searchSpaceName,
role_name: roleName,
});
@@ -466,7 +466,7 @@ export function trackSearchSpaceUsersViewed(
ownerCount: number
) {
safeCapture("search_space_users_viewed", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
user_count: userCount,
owner_count: ownerCount,
});
@@ -497,7 +497,7 @@ export function trackIndexWithDateRangeOpened(
connectorId: number
) {
safeCapture("index_with_date_range_opened", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
connector_type: connectorType,
connector_id: connectorId,
});
@@ -513,7 +513,7 @@ export function trackIndexWithDateRangeStarted(
}
) {
safeCapture("index_with_date_range_started", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
connector_type: connectorType,
connector_id: connectorId,
has_start_date: options?.hasStartDate ?? false,
@@ -527,7 +527,7 @@ export function trackQuickIndexClicked(
connectorId: number
) {
safeCapture("quick_index_clicked", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
connector_type: connectorType,
connector_id: connectorId,
});
@@ -539,7 +539,7 @@ export function trackConfigurePeriodicIndexingOpened(
connectorId: number
) {
safeCapture("configure_periodic_indexing_opened", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
connector_type: connectorType,
connector_id: connectorId,
});
@@ -552,7 +552,7 @@ export function trackPeriodicIndexingStarted(
frequencyMinutes: number
) {
safeCapture("periodic_indexing_started", {
- search_space_id: searchSpaceId,
+ workspace_id: searchSpaceId,
connector_type: connectorType,
connector_id: connectorId,
frequency_minutes: frequencyMinutes,
@@ -602,7 +602,7 @@ export function trackReferralLanding(refCode: string, landingUrl: string) {
// ============================================
interface AutomationCreatedProps {
- search_space_id: number;
+ workspace_id: number;
automation_id: number;
task_count?: number;
trigger_type?: string;
@@ -617,13 +617,13 @@ export function trackAutomationCreated(props: AutomationCreatedProps) {
safeCapture("automation_created", compact(props));
}
-export function trackAutomationCreateFailed(props: { search_space_id?: number; error?: string }) {
+export function trackAutomationCreateFailed(props: { workspace_id?: number; error?: string }) {
safeCapture("automation_create_failed", compact(props));
}
export function trackAutomationUpdated(props: {
automation_id: number;
- search_space_id?: number;
+ workspace_id?: number;
has_definition_change?: boolean;
has_name_change?: boolean;
has_description_change?: boolean;
@@ -634,7 +634,7 @@ export function trackAutomationUpdated(props: {
export function trackAutomationStatusChanged(props: {
automation_id: number;
- search_space_id?: number;
+ workspace_id?: number;
next_status: string;
}) {
safeCapture("automation_status_changed", compact(props));
@@ -644,7 +644,7 @@ export function trackAutomationUpdateFailed(props: { automation_id: number; erro
safeCapture("automation_update_failed", compact(props));
}
-export function trackAutomationDeleted(props: { automation_id: number; search_space_id?: number }) {
+export function trackAutomationDeleted(props: { automation_id: number; workspace_id?: number }) {
safeCapture("automation_deleted", compact(props));
}
@@ -699,7 +699,7 @@ export function trackAutomationTriggerRemoveFailed(props: {
}
interface AutomationChatDecisionProps {
- search_space_id?: number;
+ workspace_id?: number;
edited?: boolean;
task_count?: number;
trigger_type?: string;
@@ -712,25 +712,25 @@ export function trackAutomationChatApproved(props: AutomationChatDecisionProps)
safeCapture("automation_chat_approved", compact(props));
}
-export function trackAutomationChatRejected(props: { search_space_id?: number }) {
+export function trackAutomationChatRejected(props: { workspace_id?: number }) {
safeCapture("automation_chat_rejected", compact(props));
}
-export function trackAutomationChatDraftEdited(props: { search_space_id?: number }) {
+export function trackAutomationChatDraftEdited(props: { workspace_id?: number }) {
safeCapture("automation_chat_draft_edited", compact(props));
}
export function trackAutomationChatCreateSucceeded(props: {
automation_id: number;
name?: string;
- search_space_id?: number;
+ workspace_id?: number;
}) {
safeCapture("automation_chat_create_succeeded", compact(props));
}
export function trackAutomationChatCreateFailed(props: {
reason: "invalid" | "error";
- search_space_id?: number;
+ workspace_id?: number;
issue_count?: number;
message?: string;
}) {
diff --git a/surfsense_web/lib/query-client/cache-keys.ts b/surfsense_web/lib/query-client/cache-keys.ts
index 193f53b3c..8998200b4 100644
--- a/surfsense_web/lib/query-client/cache-keys.ts
+++ b/surfsense_web/lib/query-client/cache-keys.ts
@@ -1,7 +1,7 @@
import type { GetConnectorsRequest } from "@/contracts/types/connector.types";
import type { GetDocumentsRequest } from "@/contracts/types/document.types";
import type { GetLogsRequest } from "@/contracts/types/log.types";
-import type { GetSearchSpacesRequest } from "@/contracts/types/search-space.types";
+import type { GetSearchSpacesRequest } from "@/contracts/types/workspace.types";
/**
* Convert an object to a stable array of [key, value] pairs sorted by key.
diff --git a/surfsense_web/tests/fixtures/chat-thread.fixture.ts b/surfsense_web/tests/fixtures/chat-thread.fixture.ts
index 81cf3b5c3..6bfb7e15e 100644
--- a/surfsense_web/tests/fixtures/chat-thread.fixture.ts
+++ b/surfsense_web/tests/fixtures/chat-thread.fixture.ts
@@ -1,11 +1,11 @@
import type { APIRequestContext } from "@playwright/test";
import { authHeaders, BACKEND_URL } from "../helpers/api/auth";
-import type { SearchSpaceFixtures } from "./search-space.fixture";
+import type { SearchSpaceFixtures } from "./workspace.fixture";
export type ChatThreadRow = {
id: number;
title: string;
- search_space_id: number;
+ workspace_id: number;
visibility: string;
created_by_id: string | null;
created_at: string;
@@ -29,7 +29,7 @@ export const chatThreadFixtures = {
headers: authHeaders(apiToken),
data: {
title: "e2e-drive-journey",
- search_space_id: searchSpace.id,
+ workspace_id: searchSpace.id,
visibility: "PRIVATE",
},
});
diff --git a/surfsense_web/tests/fixtures/connectors/clickup.fixture.ts b/surfsense_web/tests/fixtures/connectors/clickup.fixture.ts
index 52f94fc5a..cee9effd5 100644
--- a/surfsense_web/tests/fixtures/connectors/clickup.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/clickup.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runClickupOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type ClickupFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/composio-calendar.fixture.ts b/surfsense_web/tests/fixtures/connectors/composio-calendar.fixture.ts
index 663692495..0ac934328 100644
--- a/surfsense_web/tests/fixtures/connectors/composio-calendar.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/composio-calendar.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runComposioOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type ComposioCalendarFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/composio-drive.fixture.ts b/surfsense_web/tests/fixtures/connectors/composio-drive.fixture.ts
index 470469cfd..8a96fb6a1 100644
--- a/surfsense_web/tests/fixtures/connectors/composio-drive.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/composio-drive.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runComposioOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type ComposioDriveFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/composio-gmail.fixture.ts b/surfsense_web/tests/fixtures/connectors/composio-gmail.fixture.ts
index ab2cf6f00..44304a0b0 100644
--- a/surfsense_web/tests/fixtures/connectors/composio-gmail.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/composio-gmail.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runComposioOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type ComposioGmailFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/confluence.fixture.ts b/surfsense_web/tests/fixtures/connectors/confluence.fixture.ts
index bea950279..6a36e0623 100644
--- a/surfsense_web/tests/fixtures/connectors/confluence.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/confluence.fixture.ts
@@ -3,7 +3,7 @@ import {
deleteConnector,
runConfluenceOAuth,
} from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type ConfluenceFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/jira.fixture.ts b/surfsense_web/tests/fixtures/connectors/jira.fixture.ts
index 4d1252e2e..d21643173 100644
--- a/surfsense_web/tests/fixtures/connectors/jira.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/jira.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runJiraOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type JiraFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/linear.fixture.ts b/surfsense_web/tests/fixtures/connectors/linear.fixture.ts
index b7d716f28..8e9245686 100644
--- a/surfsense_web/tests/fixtures/connectors/linear.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/linear.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runLinearOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type LinearFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/native-calendar.fixture.ts b/surfsense_web/tests/fixtures/connectors/native-calendar.fixture.ts
index be2ed4fb1..aea10fde6 100644
--- a/surfsense_web/tests/fixtures/connectors/native-calendar.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/native-calendar.fixture.ts
@@ -3,7 +3,7 @@ import {
deleteConnector,
runNativeGoogleCalendarOAuth,
} from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type NativeCalendarFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/native-drive.fixture.ts b/surfsense_web/tests/fixtures/connectors/native-drive.fixture.ts
index 35b4b5ddc..781b8d7f6 100644
--- a/surfsense_web/tests/fixtures/connectors/native-drive.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/native-drive.fixture.ts
@@ -3,7 +3,7 @@ import {
deleteConnector,
runNativeGoogleDriveOAuth,
} from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type NativeDriveFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/native-dropbox.fixture.ts b/surfsense_web/tests/fixtures/connectors/native-dropbox.fixture.ts
index aa6945acf..45b9aef69 100644
--- a/surfsense_web/tests/fixtures/connectors/native-dropbox.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/native-dropbox.fixture.ts
@@ -3,7 +3,7 @@ import {
deleteConnector,
runNativeDropboxOAuth,
} from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type NativeDropboxFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/native-gmail.fixture.ts b/surfsense_web/tests/fixtures/connectors/native-gmail.fixture.ts
index 73275decf..3c86eac3f 100644
--- a/surfsense_web/tests/fixtures/connectors/native-gmail.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/native-gmail.fixture.ts
@@ -3,7 +3,7 @@ import {
deleteConnector,
runNativeGoogleGmailOAuth,
} from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type NativeGmailFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/native-onedrive.fixture.ts b/surfsense_web/tests/fixtures/connectors/native-onedrive.fixture.ts
index bdcd9ec86..12d2175a1 100644
--- a/surfsense_web/tests/fixtures/connectors/native-onedrive.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/native-onedrive.fixture.ts
@@ -3,7 +3,7 @@ import {
deleteConnector,
runNativeOneDriveOAuth,
} from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type NativeOneDriveFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/notion.fixture.ts b/surfsense_web/tests/fixtures/connectors/notion.fixture.ts
index d0032663c..b32b20f10 100644
--- a/surfsense_web/tests/fixtures/connectors/notion.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/notion.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runNotionOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type NotionFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/connectors/slack.fixture.ts b/surfsense_web/tests/fixtures/connectors/slack.fixture.ts
index 898c2013b..e804c771f 100644
--- a/surfsense_web/tests/fixtures/connectors/slack.fixture.ts
+++ b/surfsense_web/tests/fixtures/connectors/slack.fixture.ts
@@ -1,5 +1,5 @@
import { type ConnectorRow, deleteConnector, runSlackOAuth } from "../../helpers/api/connectors";
-import { searchSpaceFixtures } from "../search-space.fixture";
+import { searchSpaceFixtures } from "../workspace.fixture";
export type SlackFixtures = {
/**
diff --git a/surfsense_web/tests/fixtures/index.ts b/surfsense_web/tests/fixtures/index.ts
index 605e8492a..34fc4839b 100644
--- a/surfsense_web/tests/fixtures/index.ts
+++ b/surfsense_web/tests/fixtures/index.ts
@@ -59,7 +59,7 @@ export { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
export { nativeOneDriveFixtures } from "./connectors/native-onedrive.fixture";
export { notionFixtures } from "./connectors/notion.fixture";
export { slackFixtures } from "./connectors/slack.fixture";
-export { searchSpaceFixtures } from "./search-space.fixture";
+export { searchSpaceFixtures } from "./workspace.fixture";
import { type ChatThreadFixtures, chatThreadFixtures } from "./chat-thread.fixture";
import { clickupFixtures } from "./connectors/clickup.fixture";
@@ -76,7 +76,7 @@ import { nativeGmailFixtures } from "./connectors/native-gmail.fixture";
import { nativeOneDriveFixtures } from "./connectors/native-onedrive.fixture";
import { notionFixtures } from "./connectors/notion.fixture";
import { slackFixtures } from "./connectors/slack.fixture";
-import { searchSpaceFixtures } from "./search-space.fixture";
+import { searchSpaceFixtures } from "./workspace.fixture";
/** Default `test` for specs that just need auth + a clean search space. */
export const test = searchSpaceFixtures;
diff --git a/surfsense_web/tests/fixtures/workspace.fixture.ts b/surfsense_web/tests/fixtures/workspace.fixture.ts
index e68ff6dce..0d3af2e3f 100644
--- a/surfsense_web/tests/fixtures/workspace.fixture.ts
+++ b/surfsense_web/tests/fixtures/workspace.fixture.ts
@@ -6,7 +6,7 @@ import {
createSearchSpace,
deleteSearchSpace,
type SearchSpaceRow,
-} from "../helpers/api/search-spaces";
+} from "../helpers/api/workspaces";
import { uniqueSearchSpaceName } from "../helpers/canary";
export type SearchSpaceFixtures = {
diff --git a/surfsense_web/tests/helpers/api/chat.ts b/surfsense_web/tests/helpers/api/chat.ts
index f5e1f92bb..ba01e2928 100644
--- a/surfsense_web/tests/helpers/api/chat.ts
+++ b/surfsense_web/tests/helpers/api/chat.ts
@@ -24,7 +24,7 @@ export async function streamChatToCompletion(
headers: authHeaders(token),
data: {
chat_id: args.threadId,
- search_space_id: args.searchSpaceId,
+ workspace_id: args.searchSpaceId,
user_query: args.query,
},
});
diff --git a/surfsense_web/tests/helpers/api/connectors.ts b/surfsense_web/tests/helpers/api/connectors.ts
index 3d9b2ee59..1730fee67 100644
--- a/surfsense_web/tests/helpers/api/connectors.ts
+++ b/surfsense_web/tests/helpers/api/connectors.ts
@@ -16,7 +16,7 @@ export async function listConnectors(
searchSpaceId: number
): Promise {
const response = await request.get(
- `${BACKEND_URL}/api/v1/search-source-connectors?search_space_id=${searchSpaceId}`,
+ `${BACKEND_URL}/api/v1/search-source-connectors?workspace_id=${searchSpaceId}`,
{ headers: authHeaders(token) }
);
if (!response.ok()) {
@@ -115,7 +115,7 @@ export async function triggerIndex(
body: IndexBody
): Promise<{ ok: true }> {
const response = await request.post(
- `${BACKEND_URL}/api/v1/search-source-connectors/${connectorId}/index?search_space_id=${searchSpaceId}`,
+ `${BACKEND_URL}/api/v1/search-source-connectors/${connectorId}/index?workspace_id=${searchSpaceId}`,
{ headers: authHeaders(token), data: body }
);
if (!response.ok()) {
@@ -134,7 +134,7 @@ export async function triggerIndexExpectDisabled(
body: IndexBody = {}
): Promise<{ indexing_started: false; message?: string }> {
const response = await request.post(
- `${BACKEND_URL}/api/v1/search-source-connectors/${connectorId}/index?search_space_id=${searchSpaceId}`,
+ `${BACKEND_URL}/api/v1/search-source-connectors/${connectorId}/index?workspace_id=${searchSpaceId}`,
{ headers: authHeaders(token), data: body }
);
if (!response.ok()) {
diff --git a/surfsense_web/tests/helpers/api/documents.ts b/surfsense_web/tests/helpers/api/documents.ts
index 9658feead..be43d7eb2 100644
--- a/surfsense_web/tests/helpers/api/documents.ts
+++ b/surfsense_web/tests/helpers/api/documents.ts
@@ -21,7 +21,7 @@ export async function listDocuments(
limit = 100
): Promise {
const response = await request.get(
- `${BACKEND_URL}/api/v1/documents?search_space_id=${searchSpaceId}&limit=${limit}`,
+ `${BACKEND_URL}/api/v1/documents?workspace_id=${searchSpaceId}&limit=${limit}`,
{ headers: authHeaders(token) }
);
if (!response.ok()) {
@@ -55,7 +55,7 @@ export async function getEditorContent(
documentId: number
): Promise {
const response = await request.get(
- `${BACKEND_URL}/api/v1/search-spaces/${searchSpaceId}/documents/${documentId}/editor-content`,
+ `${BACKEND_URL}/api/v1/workspaces/${searchSpaceId}/documents/${documentId}/editor-content`,
{ headers: authHeaders(token) }
);
if (!response.ok()) {
diff --git a/surfsense_web/tests/helpers/api/workspaces.ts b/surfsense_web/tests/helpers/api/workspaces.ts
index 06274790e..a6f251c69 100644
--- a/surfsense_web/tests/helpers/api/workspaces.ts
+++ b/surfsense_web/tests/helpers/api/workspaces.ts
@@ -13,7 +13,7 @@ export async function createSearchSpace(
name: string,
description = "E2E test search space"
): Promise {
- const response = await request.post(`${BACKEND_URL}/api/v1/searchspaces`, {
+ const response = await request.post(`${BACKEND_URL}/api/v1/workspaces`, {
headers: authHeaders(token),
data: { name, description },
});
@@ -28,7 +28,7 @@ export async function deleteSearchSpace(
token: string,
id: number
): Promise {
- const response = await request.delete(`${BACKEND_URL}/api/v1/searchspaces/${id}`, {
+ const response = await request.delete(`${BACKEND_URL}/api/v1/workspaces/${id}`, {
headers: authHeaders(token),
});
if (!response.ok() && response.status() !== 404) {
diff --git a/surfsense_web/tests/smoke/chat-stream.spec.ts b/surfsense_web/tests/smoke/chat-stream.spec.ts
index 20fe67f43..8d69163a9 100644
--- a/surfsense_web/tests/smoke/chat-stream.spec.ts
+++ b/surfsense_web/tests/smoke/chat-stream.spec.ts
@@ -12,7 +12,7 @@ test.describe("Smoke", () => {
headers: authHeaders(apiToken),
data: {
title: "e2e-chat-stream-smoke",
- search_space_id: searchSpace.id,
+ workspace_id: searchSpace.id,
visibility: "PRIVATE",
},
});
diff --git a/surfsense_web/zero/queries/automations.ts b/surfsense_web/zero/queries/automations.ts
index 4f3bd451c..019e7f994 100644
--- a/surfsense_web/zero/queries/automations.ts
+++ b/surfsense_web/zero/queries/automations.ts
@@ -4,7 +4,7 @@ import { zql } from "../schema/index";
import { constrainToAllowedSpaces } from "./authz";
// Mirrors chat byThread: client passes the parent id, the REST route still
-// authorizes via `automation_id -> search_space`. No search_space_id on the
+// authorizes via `automation_id -> search_space`. No workspace_id on the
// table by design.
export const automationRunQueries = {
byAutomation: defineQuery(
diff --git a/surfsense_web/zero/schema/automations.ts b/surfsense_web/zero/schema/automations.ts
index f9b89c533..d161731d9 100644
--- a/surfsense_web/zero/schema/automations.ts
+++ b/surfsense_web/zero/schema/automations.ts
@@ -3,7 +3,7 @@ import { json, number, string, table } from "@rocicorp/zero";
export const automationTable = table("automations")
.columns({
id: number(),
- searchSpaceId: number().from("search_space_id"),
+ searchSpaceId: number().from("workspace_id"),
})
.primaryKey("id");
diff --git a/surfsense_web/zero/schema/chat.ts b/surfsense_web/zero/schema/chat.ts
index 07229ac94..60d8e5c45 100644
--- a/surfsense_web/zero/schema/chat.ts
+++ b/surfsense_web/zero/schema/chat.ts
@@ -23,7 +23,7 @@ export const newChatMessageTable = table("new_chat_messages")
export const newChatThreadTable = table("new_chat_threads")
.columns({
id: number(),
- searchSpaceId: number().from("search_space_id"),
+ searchSpaceId: number().from("workspace_id"),
})
.primaryKey("id");
diff --git a/surfsense_web/zero/schema/documents.ts b/surfsense_web/zero/schema/documents.ts
index 988056297..1065cd2c3 100644
--- a/surfsense_web/zero/schema/documents.ts
+++ b/surfsense_web/zero/schema/documents.ts
@@ -5,7 +5,7 @@ export const documentTable = table("documents")
id: number(),
title: string(),
documentType: string().from("document_type"),
- searchSpaceId: number().from("search_space_id"),
+ searchSpaceId: number().from("workspace_id"),
folderId: number().optional().from("folder_id"),
createdById: string().optional().from("created_by_id"),
status: json(),
@@ -24,7 +24,7 @@ export const searchSourceConnectorTable = table("search_source_connectors")
periodicIndexingEnabled: boolean().from("periodic_indexing_enabled"),
indexingFrequencyMinutes: number().optional().from("indexing_frequency_minutes"),
nextScheduledAt: number().optional().from("next_scheduled_at"),
- searchSpaceId: number().from("search_space_id"),
+ searchSpaceId: number().from("workspace_id"),
userId: string().from("user_id"),
createdAt: number().from("created_at"),
})
diff --git a/surfsense_web/zero/schema/folders.ts b/surfsense_web/zero/schema/folders.ts
index c5b192942..a2428da7a 100644
--- a/surfsense_web/zero/schema/folders.ts
+++ b/surfsense_web/zero/schema/folders.ts
@@ -6,7 +6,7 @@ export const folderTable = table("folders")
name: string(),
position: string(),
parentId: number().optional().from("parent_id"),
- searchSpaceId: number().from("search_space_id"),
+ searchSpaceId: number().from("workspace_id"),
createdById: string().optional().from("created_by_id"),
createdAt: number().from("created_at"),
updatedAt: number().from("updated_at"),
diff --git a/surfsense_web/zero/schema/inbox.ts b/surfsense_web/zero/schema/inbox.ts
index 946180ba4..15991ed20 100644
--- a/surfsense_web/zero/schema/inbox.ts
+++ b/surfsense_web/zero/schema/inbox.ts
@@ -4,7 +4,7 @@ export const notificationTable = table("notifications")
.columns({
id: number(),
userId: string().from("user_id"),
- searchSpaceId: number().optional().from("search_space_id"),
+ searchSpaceId: number().optional().from("workspace_id"),
type: string(),
title: string(),
message: string(),
diff --git a/surfsense_web/zero/schema/podcasts.ts b/surfsense_web/zero/schema/podcasts.ts
index d473d776f..1b29d3161 100644
--- a/surfsense_web/zero/schema/podcasts.ts
+++ b/surfsense_web/zero/schema/podcasts.ts
@@ -12,7 +12,7 @@ export const podcastTable = table("podcasts")
specVersion: number().from("spec_version"),
durationSeconds: number().optional().from("duration_seconds"),
error: string().optional(),
- searchSpaceId: number().from("search_space_id"),
+ searchSpaceId: number().from("workspace_id"),
threadId: number().optional().from("thread_id"),
createdAt: number().from("created_at"),
})