Files
pastilhas 3da6d11c00 extract speech-to-text into its own plugin
Moves platform STT out into a plugin that owns the whole whisper.cpp contract: sidecar,
config (a JSON file under DATA_PATH/transcribe/, validated against the server before
storing), a thin proxy router, a skill so an agent knows the contract without being told,
and a script-mode file-browser task (not agentic — no model turn per audio file).

sidecar/transcribe.ts and its test moved unchanged from src/servers/api/stt/ — every
constant in it has a reason attached and none of it was touched.

The platform-side removal (routes, dead useAudioRecording path, Settings screen, locale
keys) lands in a separate, uncommitted change in the platform repo for review.

Not yet reachable from the file browser: the platform does not load tasks from a plugin's
directory yet (skills/affordances/notifications do). Ships anyway per instructions.

Officer-Session: 656f5c85-e49a-4f1f-b9f3-042a04b4d043
2026-08-24 03:28:04 +00:00

23 lines
1.1 KiB
TypeScript

import { createSidecarProxy } from '@@/sidecar/create-proxy';
import { mountPrefix } from '@@/plugins/manifest';
import { manifest } from '../manifest';
// /api/transcribe/* — auth, then forward to officer-transcribe. No routes of its own and no Whisper
// knowledge: the whole contract lives in ../sidecar/index.ts.
//
// ── The prefix is DERIVED, not written ──
//
// `mountPrefix` returns `/transcribe` for this first-party publisher; a literal '/api/transcribe' would
// be right only by coincidence and wrong the moment anyone else publishes this plugin. Same reasoning as
// `plugins/photos/api/router.ts` and `plugins/music/api/router.ts`.
const proxy = createSidecarProxy({
name: 'transcribe',
prefix: `/api${mountPrefix({ appName: 'transcribe', manifest })}`,
// whisper.cpp runs at roughly 8x realtime, so a long voice memo (the moved `transcribe.ts` was tuned
// for recordings past 40 minutes, and disables Bun's own 300s fetch ceiling for exactly that reason)
// can hold this hop open for minutes. 1800s gives it the same headroom on the platform->sidecar leg.
timeoutSeconds: 1800,
});
export const router = proxy.router;