svrnty-hermes-webui-plugin/routes/transcribe.py
Svrnty c1e3fa1af0
All checks were successful
plugin-tests / test (push) Successful in 25s
feat(plugin): Phase 2 partial — vault_status migrated + brand skin moved + eval suite (P2.B/C, P3.A/B)
Lands the easy migrations + the automation skeleton. STT migration deferred
to Phase 2.1 (it touches the streaming engine + bootstrap JS — needs a new
streaming_hook public-API method OR forced-internal CONNECTION-MAP entries).

Migrated to plugin:
  routes/vault_status.py    GET /api/vault/status (from fork commit 3e2c74f3)
  static/{app.js,app.css,fonts/}  brand skin (from hermes-ext/)

Plugin auto-loaded by hermes-webui when HERMES_WEBUI_PYTHON_PLUGIN is set;
register_static + inject_stylesheet + inject_script wire the URL contract at
/plugins/svrnty/{app.css,app.js} per protocol §14 (Q5).

Automation skeleton:
  Makefile                          one-liner targets: test · map · sync-upstream · smoke
  scripts/boot-smoke.py             start upstream+plugin, curl every endpoint
  scripts/upstream-sync.py          fetch tags + run matrix + JSON report
  tests/evals/test_features.py      4 evals (loader contract · vault payload · brand URL contract · forced-internal=0)
  tests/unit/test_brand_skin.py     4 asset-presence + wiring tests
  tests/unit/test_vault_status.py   3 handler tests (register, success, error)

CONNECTION-MAP.md: 0 forced-internal dependencies; plugin uses only public API.
AST script timestamp removed so map-check is deterministic.

Tests: 11/11 PASS (4 evals + 7 unit). Integration tests deferred until
boot-smoke runs against a live hermes-webui (Phase 2.D + 2.E gate).

Deferred to next session:
  P2.A  STT migration (needs streaming_hook design — see routes/transcribe.py)
  P2.D  Revert 4 fork feature commits — needs STT migration first
  P2.E  Archive hermes-ext repo — gated on P2.D
  P2.F  Live boot smoke against real webui

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 10:02:47 -04:00

38 lines
1.8 KiB
Python

"""GET /api/transcribe — STT route — DEFERRED MIGRATION (P2.A).
The STT feature in the original fork commit 014b9eef touches THREE upstream
modules:
1. api/upload.py — handle_transcribe() + _external_stt_transcribe()
2. api/streaming.py — _transcribe_audio_attachments() injects transcripts
into the agent-visible message during streaming
3. static/boot.js — mic button + MediaRecorder fallback (iOS WKWebView)
Migration #1 is straightforward (route + helper move cleanly). Migrations #2
and #3 cross-cut the streaming engine and the bootstrap JS — refactoring them
to live in the plugin requires either:
(a) New public-API hooks: api.streaming_hook(name, callback) so the plugin
can register an attachment processor that runs inside the streaming
pipeline. Adds ~50 LOC to the loader + amends Protocol PRD §5.1.
(b) Accept STT as a forced-internal dependency. Adds CONNECTION-MAP entries
under forced_internal/ with the streaming.py + boot.js touch points and
their rebase-risk notes.
Phase 2.1 decides between (a) and (b). Until that's resolved, the STT route
stays in the fork (commit 014b9eef remains). This stub exists so the migration
plan is co-located with the code and tooling can flag the gap.
Test status: vault_status migration proves the loader works. STT is a deeper
integration test for the loader's expressiveness.
"""
# Intentionally NOT registered yet. The plugin loader's _phase2_routes() does
# not include "transcribe" — see plugin.py.
#
# When Phase 2.1 lands, this file will host either:
# - A new route handler using a streaming_hook to register the attachment
# processor (option a), or
# - The route handler + CONNECTION-MAP forced-internal entries for the
# remaining touch points (option b).