feat(chat): view context — tell the assistant what you're looking at
Nightly Build / build (push) Successful in 7m51s

An eye next to the paperclip shares what the user has open with their next
message: the page, the folder being browsed, the file open in the viewer and
any highlighted passage (line numbers where a source view exists), plus which
entity a detail page is about. The bag is client-authored {label, value} pairs
in English — the backend only clamps (chars, never bytes), neutralizes the
harness tag and renders one <system-extra> block per message, deduped
consecutively so it appears exactly when the view changed. On by default,
per-device toggle, hover/tap to preview, a chip on every sent message;
docs/view-context.md for users, an updated harness.md clause for the model.
This commit is contained in:
Daniele
2026-08-23 20:53:30 +01:00
parent 488c702517
commit 505f2e95c1
42 changed files with 2096 additions and 122 deletions
+10 -1
View File
@@ -404,10 +404,19 @@ async fn handle_socket(
// projection (never stored as text), and the UI renders the
// command's `display` instead of the expanded `content`.
let attachments = client_msg.attachments.clone();
let metadata = (!attachments.is_empty() || command_ref.is_some())
// Clamped and tag-neutralized here, at the ingress: the megabyte a
// Cmd+A can produce must never reach the column, and every later
// reader (projection, REST, echo) works on canonical data.
let view_context = core_api::message_meta::sanitize_view_context(
client_msg.view_context.clone(),
);
let metadata = (!attachments.is_empty()
|| command_ref.is_some()
|| !view_context.is_empty())
.then(|| core_api::message_meta::MessageMetadata {
attachments: attachments.clone(),
command: command_ref.clone(),
view_context,
});
// No echo here: the `UserMessage` event is emitted when the message is