Skip to content

feat(perch): send_user_file relay - inline sent-file cards in the hub chat (PR-E, audit item 12) - #374

Merged
kh0pper merged 2 commits into
mainfrom
feat/perch-send-user-file
Sep 13, 2026
Merged

kh0pper merged 2 commits into
mainfrom
feat/perch-send-user-file

Conversation

@kh0pper

@kh0pper kh0pper commented Sep 13, 2026

Copy link
Copy Markdown
Owner

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.

  • bridge.mjs: interactive append rides ask_user AND send_user_file (channel csvs byte-identical; narrowing can remove either)
  • perch-interactive.js: crow-file notify jail-copies into outputsDir; collision SUFFIX never overwrite; dotfile basenames stored non-dot; in-jail source served in place; symlink/dir/over-200MB/missing render name-only servable:false
  • perch_session_files new table on BOTH rails (init-db + migrations/0007) for reload persistence
  • GET /interactive/:sid/files/history (vanished file drops to servable:false)
  • hub client/css + i18n EN/ES: inline card, images inline via the existing workspace route, dim not-servable, fileSeen dedupe on the shared on() identity guard (count stays 18 by construction)
  • tests: 9 engine + 3 route + 6 card + 3 migration + envelope csv. Full suite 4854/0.

kh0pper 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).
@kh0pper
kh0pper merged commit c8377e2 into main Sep 13, 2026
3 checks passed
@kh0pper
kh0pper deleted the feat/perch-send-user-file branch September 13, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant