pub(crate) fn rehome_for_container(
found: Vec<Resolved>,
missing: Vec<String>,
host_cwd: &str,
) -> (Vec<Resolved>, Vec<String>)Expand description
Copy each resolved attachment’s send-copy from its host path into host_cwd (the pane’s working
folder) and point it at the container-side path instead (narko #198 piece 2): a container agent can
open a file under its workspace mount, never a bare host path. The copy keeps the exact trailing path
id_bearing_suffix finds — <sha256>.… for an image/derived file, named/<sha256>/<realname> for
any other kind — the same two shapes the composer’s reload parser (ID_RE, attached-images.ts) and
the image counter (images_in_text, transcript/images.rs) already recognize (#7434): renaming to
the display name instead would make every container attachment unrecognizable to both on reload. A
path with neither shape, or a copy that fails, joins missing, the same treatment a send-copy swept
by retention gets.
The write goes through crate::backend::workdir_fs::Workdir, the same primitive every other write
into an agent’s working directory uses: a container agent has read-write access to this whole tree
through its bind mount, so the destination needs the same defenses a native agent’s own workdir
already gets against a symlinked ancestor folder or a symlinked destination file, not a hand-rolled
check here that has to rediscover them (#7434).
A document’s extracted-text companion (item.note’s text version: <path>, from PDFs and Office
files) is rehomed the same way and the note rewritten to the container path: a container agent
could open the one file this leaves pointed at a host path but not the other (#7434). If the
companion can’t be rehomed, that part of the note is dropped rather than leaving a host path the
container never gets.