@@ -8,9 +8,8 @@ import { usePromptRef } from "../context/prompt"
88import { useLocal } from "../context/local"
99import { usePluginRuntime } from "../plugin/runtime"
1010import { useEditorContext } from "../context/editor"
11- import { HomeSessionDestinationProvider } from "./home/session-destination"
1211import { useData } from "../context/data"
13- import { LocationProvider } from "../context/location"
12+ import { useSetLocation } from "../context/location"
1413import { FormPrompt } from "./session/form"
1514import { PluginSlot } from "../plugin/context"
1615
@@ -29,10 +28,13 @@ export function Home() {
2928 const local = useLocal ( )
3029 const editor = useEditorContext ( )
3130 const data = useData ( )
31+ const setLocation = useSetLocation ( )
3232 // Global MCP elicitations can arrive without a session route, so keep them reachable from Home.
3333 const forms = createMemo ( ( ) => data . session . form . list ( "global" , data . location . default ( ) ) ?? [ ] )
3434 let sent = false
3535
36+ createEffect ( ( ) => setLocation ( data . location . default ( ) ) )
37+
3638 onMount ( ( ) => {
3739 editor . clearSelection ( )
3840 } )
@@ -64,47 +66,45 @@ export function Home() {
6466 } )
6567
6668 return (
67- < LocationProvider location = { data . location . default ( ) } >
68- < HomeSessionDestinationProvider >
69- < box flexGrow = { 1 } alignItems = "center" paddingLeft = { 2 } paddingRight = { 2 } >
70- < box flexGrow = { 1 } minHeight = { 0 } />
71- < box height = { 4 } minHeight = { 0 } flexShrink = { 1 } />
72- < box flexShrink = { 0 } >
73- < pluginRuntime . Slot name = "home_logo" mode = "replace" >
74- < Logo />
75- </ pluginRuntime . Slot >
76- </ box >
77- < box height = { 1 } minHeight = { 0 } flexShrink = { 1 } />
78- < box width = "100%" maxWidth = { 75 } zIndex = { 1000 } paddingTop = { 1 } flexShrink = { 0 } >
79- < pluginRuntime . Slot name = "home_prompt" mode = "replace" ref = { bind } >
80- < Prompt
81- ref = { bind }
82- right = { < pluginRuntime . Slot name = "home_prompt_right" /> }
83- placeholders = { placeholder }
84- disabled = { forms ( ) . length > 0 }
85- />
86- </ pluginRuntime . Slot >
87- </ box >
88- < PluginSlot name = "home.bottom" />
89- < box flexGrow = { 1 } minHeight = { 0 } />
90- < Toast />
69+ < >
70+ < box flexGrow = { 1 } alignItems = "center" paddingLeft = { 2 } paddingRight = { 2 } >
71+ < box flexGrow = { 1 } minHeight = { 0 } />
72+ < box height = { 4 } minHeight = { 0 } flexShrink = { 1 } />
73+ < box flexShrink = { 0 } >
74+ < pluginRuntime . Slot name = "home_logo" mode = "replace" >
75+ < Logo />
76+ </ pluginRuntime . Slot >
9177 </ box >
92- < box width = "100%" flexShrink = { 0 } >
93- < PluginSlot name = "home.footer" />
78+ < box height = { 1 } minHeight = { 0 } flexShrink = { 1 } />
79+ < box width = "100%" maxWidth = { 75 } zIndex = { 1000 } paddingTop = { 1 } flexShrink = { 0 } >
80+ < pluginRuntime . Slot name = "home_prompt" mode = "replace" ref = { bind } >
81+ < Prompt
82+ ref = { bind }
83+ right = { < pluginRuntime . Slot name = "home_prompt_right" /> }
84+ placeholders = { placeholder }
85+ disabled = { forms ( ) . length > 0 }
86+ />
87+ </ pluginRuntime . Slot >
9488 </ box >
95- < Show when = { forms ( ) [ 0 ] ?. id } keyed >
96- { ( _ ) => {
97- const form = forms ( ) [ 0 ]
98- return form ? (
99- < box position = "absolute" zIndex = { 2000 } left = { 0 } right = { 0 } bottom = { 1 } paddingLeft = { 2 } paddingRight = { 2 } >
100- < box width = "100%" >
101- < FormPrompt form = { form } />
102- </ box >
89+ < PluginSlot name = "home.bottom" />
90+ < box flexGrow = { 1 } minHeight = { 0 } />
91+ < Toast />
92+ </ box >
93+ < box width = "100%" flexShrink = { 0 } >
94+ < PluginSlot name = "home.footer" />
95+ </ box >
96+ < Show when = { forms ( ) [ 0 ] ?. id } keyed >
97+ { ( _ ) => {
98+ const form = forms ( ) [ 0 ]
99+ return form ? (
100+ < box position = "absolute" zIndex = { 2000 } left = { 0 } right = { 0 } bottom = { 1 } paddingLeft = { 2 } paddingRight = { 2 } >
101+ < box width = "100%" >
102+ < FormPrompt form = { form } />
103103 </ box >
104- ) : null
105- } }
106- </ Show >
107- </ HomeSessionDestinationProvider >
108- </ LocationProvider >
104+ </ box >
105+ ) : null
106+ } }
107+ </ Show >
108+ </ >
109109 )
110110}
0 commit comments