subspace_chat/agent_chat/external.rs
1//! What the app shell adds to the chat from outside the panel: the selected
2//! row and its open details, or text selected in a detail pane.
3//!
4//! The shell owns the key, the panel button and the pane's context menu, so
5//! this is the one way in. Pinning a reference here never sends a message:
6//! the reference rides with the user's next prompt, like the automatic one.
7
8use super::logic::upsert_context;
9use super::{ChatPanel, Context};
10
11use subspace_agent::ContextRef;
12
13impl ChatPanel {
14 /// Pins `reference` to the chat shown, replacing one with the same key.
15 // qual:api - the app shell hands a context reference to the open chat.
16 pub fn attach_reference(&mut self, reference: ContextRef, cx: &mut Context<Self>) {
17 upsert_context(&mut self.tab_mut().context, reference);
18 cx.notify();
19 }
20}