diff --git a/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx b/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx index 3207af75..250d8977 100644 --- a/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx +++ b/src/workspaces/officerdev/src/apps/Chat/EmbeddableChat/EmbeddableChat.tsx @@ -31,6 +31,14 @@ type EmbeddableChatProps = { * a commander opened in /chat had `context: 'chat'` and silently lost the control. */ isCommander?: boolean; + /** + * Refuse input entirely, with a reason the composer shows. + * + * For a surface where something must be chosen before a conversation can start — a new commander needs a + * name and a working directory, both unchangeable afterwards. Disabling the composer is the only honest + * place to enforce that: anywhere later and the person has already written what they meant to say. + */ + disabled?: false | { reason: string }; onMessageComplete?: () => void; }; @@ -43,7 +51,7 @@ export const EmbeddableChat = ({ className, onMessageComplete, ...params }: Embe return (
- +
); }; diff --git a/src/workspaces/officerdev/src/apps/Chat/components/InputArea.tsx b/src/workspaces/officerdev/src/apps/Chat/components/InputArea.tsx index fdffa53b..ee6a3f60 100644 --- a/src/workspaces/officerdev/src/apps/Chat/components/InputArea.tsx +++ b/src/workspaces/officerdev/src/apps/Chat/components/InputArea.tsx @@ -16,9 +16,11 @@ import { BackgroundTaskTray } from './BackgroundTaskTray'; type InputAreaProps = { manager: UseEmbeddableChatType; + /** When set, input is refused and the reason is shown in place of the composer's own hints. */ + disabled?: false | { reason: string }; }; -export const InputArea = ({ manager }: InputAreaProps) => { +export const InputArea = ({ manager, disabled }: InputAreaProps) => { const [loginOpen, setLoginOpen] = useState(false); // Only for a commander, and only once it has an id. Everything a commander's loop needs in order to be // stoppable and deletable hangs off these two paths — see api/command-hq/spawned.ts. @@ -110,6 +112,10 @@ export const InputArea = ({ manager }: InputAreaProps) => {