Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions components/Notebook/NoteEditorLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function NoteEditorLayout({ onAgentChatDockedChange }: NoteEditorLayoutPr
searchParams?.get('tab') === 'details' ? 'details' : 'document'
);

// ---- AI assistant chat (gated to hub editors and moderators) ----
// ---- AI assistant chat ----
const [isAgentChatOpen, setIsAgentChatOpen] = useState(false);
// Flipped when the server denies access (the gate can change server-side);
// hides the entry point while this note is open.
Expand Down Expand Up @@ -142,9 +142,8 @@ export function NoteEditorLayout({ onAgentChatDockedChange }: NoteEditorLayoutPr
const isChangelog = isChangelogNote(note);
const isChangelogAccessDenied = isChangelog && !user?.isModerator;

const isHubEditorOrModerator = Boolean(user?.moderator) || (user?.editorOfHubs?.length ?? 0) > 0;
const showAgentChat =
isHubEditorOrModerator &&
Boolean(user) &&
!agentChatUnavailable &&
// Changelogs are moderator-only: the page renders Note Not Found in place
// of the document, so the assistant must not mount over it.
Expand Down
2 changes: 1 addition & 1 deletion hooks/useNotebookChatSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useReconnectingSocket, type SocketStatus } from './useReconnectingSocke

/**
* Server-defined close codes that mean reconnecting is pointless for this
* chat: unauthenticated (4401), not editor/moderator (4403), chat/note not
* chat: unauthenticated (4401), Research AI access blocked (4403), chat/note not
* found or not yours (4404). REST polling remains the fallback, and the REST
* layer surfaces the matching access error to the UI.
*/
Expand Down
Loading