-
+
);
}
@@ -176,6 +180,75 @@ function PreviewSessionBody({ session, taskId }: { session: TaskSession; taskId:
);
}
+/**
+ * PassthroughComposer is the kandev-controlled compose box rendered alongside
+ * the PTY in passthrough mode. Submitting forwards the typed text via the
+ * onSubmit prop (which posts `message.add` over WS); the backend's
+ * `Executor.Prompt` routes passthrough sessions to PTY stdin so the CLI agent
+ * actually receives it. Enter submits; Shift+Enter inserts a newline.
+ */
+export function PassthroughComposer({
+ onSubmit,
+}: {
+ onSubmit: (content: string) => Promise
;
+}) {
+ const [value, setValue] = useState("");
+ const [isSending, setIsSending] = useState(false);
+ const trimmed = value.trim();
+ const canSubmit = trimmed.length > 0 && !isSending;
+
+ const submit = useCallback(async () => {
+ if (!canSubmit) return;
+ setIsSending(true);
+ try {
+ await onSubmit(trimmed);
+ setValue("");
+ } finally {
+ setIsSending(false);
+ }
+ }, [canSubmit, onSubmit, trimmed]);
+
+ const handleKeyDown = useCallback(
+ (e: KeyboardEvent) => {
+ if (e.key === "Enter" && !e.shiftKey) {
+ e.preventDefault();
+ void submit();
+ }
+ },
+ [submit],
+ );
+
+ return (
+
+
+ );
+}
+
function RunningSpinner() {
return ;
}