Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: editor hand-off into the new-task composer

ogsamrat3c40a211fafc
diff --git a/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx b/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx
index 97243b5c..a644e2e4 100644
--- a/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx
+++ b/apps/app/src/react-app/domains/session/chat/session-empty-hero.tsx
@@ -1,5 +1,5 @@
/** @jsxImportSource react */
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { Zap } from "lucide-react";
import type { ComposerAttachment } from "@/app/types";
@@ -90,6 +90,19 @@ export function SessionEmptyHero(props: SessionEmptyHeroProps) {
return props.onRunTask(trimmedPrompt, attachments, handoff);
};
+ // The editor's "Ask about selection" / "Fix with agent" before any chat exists: appended to the draft.
+ useEffect(() => {
+ const onPrefill = (event: Event) => {
+ const text = (event as CustomEvent<string>).detail;
+ if (typeof text !== "string" || !text) return;
+ event.preventDefault();
+ setPrompt((value) => (value.trim() ? `${value.replace(/\s+$/, "")}\n\n${text}` : text));
+ window.setTimeout(() => window.dispatchEvent(new Event("omnirush:focusPrompt")), 50);
+ };
+ window.addEventListener("omnirush:new-task-prefill", onPrefill);
+ return () => window.removeEventListener("omnirush:new-task-prefill", onPrefill);
+ }, []);
+
return (
<div className="mx-auto w-full max-w-[640px] space-y-4 px-4 max-lg:px-4 sm:px-6">
<div className="space-y-1.5 text-center">