Attach any file, take shares from other apps, and survive a backwards highlight

Attachments were images only. Now any file can be attached: from the file
chooser behind the "+" menu, or from Android's share sheet, which the app
is now in. An image still goes to the model as a picture; anything else is
stored under its own name (`<hex>-<name>`, cleaned by `safe_file_name`)
and the Claude driver ends the message with `Attached file: /abs/path`,
since the CLI reads files by path and a model cannot be shown a trace. The
user-message field is renamed `images` -> `attachments` on both sides,
with a serde alias reading the rows written before. A share arrives before
anyone has said which session it is for, so it is held in AppRoot with a
banner on the list until a session takes it; an open session takes it at
once. Unreadable shares are reported beside the composer, not thrown.

The tool card crashed the app when opened on a command holding a quoted
glob such as `-path '*/.git/*'`: highlights 1.1.0's shell lexer answers
`x '*/a/*'` with a span whose end is before its start, and AnnotatedString
refuses the range. Such spans are dropped; the library is the place for
the fix. The echo driver gains `/bash <command>` so a card with a given
command can be produced on the emulator.

ui-sandbox.sh's token salvage read the tokens block's close only at a line
start, ran past the compact `),],` the server writes, and copied `setups`
into the new config twice, which the server then refused.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
irisandClaude Fable 5.1 committed 2026-09-03 08:15:10 -04:00
1 parent 4bc69e8f9c
commit 6180663f14
25 files changed
+672 -165

No files matched your search

+16 -16
View File
@@ -33,7 +33,7 @@ use anyhow::{Context, Result, bail};
use serde::{Deserialize, Serialize};
use serde_json::json;
use super::driver::{Driver, Event, EventSink, ImageRef, SessionStatus};
use super::driver::{AttachmentRef, Driver, Event, EventSink, SessionStatus};
use super::process;
use super::transport::{Launch, Streams, Transport};
use crate::config::{ProviderConfig, SessionConfig};
@@ -322,10 +322,10 @@ fn watch(session_dir: PathBuf, sink: EventSink) {
}
impl Driver for LlamaDriver {
fn send_user_message(&self, text: String, images: Vec<ImageRef>) {
if !images.is_empty() {
fn send_user_message(&self, text: String, attachments: Vec<AttachmentRef>) {
if !attachments.is_empty() {
let _ = self.sink.send(Event::Error {
message: "this model can't be sent images".to_string(),
message: "this model can't be sent attachments or files".to_string(),
});
}
let sink = self.sink.clone();
@@ -344,9 +344,9 @@ impl Driver for LlamaDriver {
let _ = sink.send(Event::MessageTaken {
id: None,
text: text.clone(),
// Never any: this driver refuses images above, and saying
// so is what the refusal above is for.
images: Vec::new(),
// Never any: this driver refuses attachments above, and
// saying so is what the refusal above is for.
attachments: Vec::new(),
});
let _ = sink.send(Event::Status {
state: SessionStatus::Running,
@@ -649,7 +649,7 @@ mod tests {
Event::UserMessage {
id: None,
text: "hello".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::AssistantText {
delta: "hi ".into(),
@@ -663,7 +663,7 @@ mod tests {
Event::UserMessage {
id: None,
text: "again".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::AssistantText {
delta: "yes".into(),
@@ -695,7 +695,7 @@ mod tests {
Event::UserMessage {
id: None,
text: "count".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::AssistantText {
delta: "one two".into(),
@@ -721,7 +721,7 @@ mod tests {
Event::UserMessage {
id: None,
text: "hello".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::Error {
message: "something went wrong".into(),
@@ -749,7 +749,7 @@ mod tests {
Event::UserMessage {
id: None,
text: "the long expensive conversation".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::AssistantText {
delta: "at length".into(),
@@ -758,7 +758,7 @@ mod tests {
Event::UserMessage {
id: None,
text: "a fresh start".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::AssistantText {
delta: "cheaply".into(),
@@ -778,19 +778,19 @@ mod tests {
Event::UserMessage {
id: None,
text: "one".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::Cleared,
Event::UserMessage {
id: None,
text: "two".into(),
images: Vec::new(),
attachments: Vec::new(),
},
Event::Cleared,
Event::UserMessage {
id: None,
text: "three".into(),
images: Vec::new(),
attachments: Vec::new(),
},
]);
let messages = conversation(&path);