feat(perch): send_user_file relay - inline sent-file cards in the hub chat (PR-E, audit item 12) - #374
Merged
Conversation
added 2 commits
September 13, 2026 16:39
… chat (PR-E, audit item 12)
pi-lab's real tool lives behind web/index.ts's bot guard (no web server in a
bot process), so a perch interactive child never HAD send_user_file at all —
this is the pi-lab-side relay branch the handoff gated on (operator OK
2026-09-13). Companion commit: pi-lab extensions/send-user-file.ts registers
the tool under askUserPath 'ui' only and announces over ctx.ui.notify as
'crow-file:' + {path,name,mime,size,caption} — the crow-ask: precedent.
- bridge.mjs: the interactive append now rides ask_user AND send_user_file
(same PI_BOT_INTERACTIVE gate; channel csvs byte-identical; per-session
narrowing can still remove either).
- perch-interactive.js: a crow-file: notify jail-copies the file into the
session's outputsDir — the only place the fd-based workspace route serves
— collision policy SUFFIX (report.png -> report-2.png, never overwrite),
dotfile basenames stored non-dot so the card is never a dead link, and a
source already in the jail serves in place. Symlink/dir/over-200MB/missing
render name-only with servable:false. Malformed JSON is swallowed like the
crow-state/crow-ask mirrors.
- perch_session_files (new table, BOTH rails: init-db + migrations/0007):
one row per announce so a chat reload re-renders the cards (operator
decision: persist). Keyed (bot_id, thread_id) like the transcript endpoint.
- routes: GET /interactive/:sid/files/history — send order; a servable row
whose file vanished drops to servable:false (a dead link is worse than a
dim name).
- hub client/css + i18n EN/ES: inline card in the transcript (images inline
via the workspace route, caption, size, Download), dim not-servable state,
fileSeen dedupe across the live/subscribe seam (rides the shared on()
identity guard — count stays 18 by construction, not by omission).
- tests: 9 engine relay, 3 route history, 6 hub card (incl. the
two-different-files key regression), 3 migration rail, envelope csv
updated. Full suite 4854 pass / 0 fail.
…onal-path commit omitted it CI's suite red on ERR_MODULE_NOT_FOUND: tests/perch-session-files-migration.test.js imports the rail the previous commit never included (the new file was staged but positional-path commits only carry listed paths). One shape, two rails: this is the second of them (init-db.js already landed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(perch): send_user_file relay - inline sent-file cards in the hub chat (PR-E, audit item 12)
pi-lab real tool sits behind web/index.ts bot guard (no web server in a bot process), so a perch interactive child never HAD send_user_file. This is the pi-lab-side relay branch the handoff gated on (operator OK 2026-09-13). Companion: pi-lab branch feat/crow-send-user-file-relay registers the tool under askUserPath ui only and announces over ctx.ui.notify as crow-file: + {path,name,mime,size,caption} - the crow-ask precedent.