feat(receiver): remove sessions, add filename/mime, fix gen counter, compact UI

- Removed session tracking entirely; single global decode state
- Receiver UI: no sessions table, no big progress bar
- Inline stats above video: scanned / useful / need  ·  gen X of Y
- Sender passes filename and mimeType to encode worker
- Packetizer wraps file payloads with [filenameLen][name][mimeLen][mime] header
- Decode worker parses metadata and uses it for download name/type
- Fixed generation counter bug: final progress was skipped when reconstruction
  succeeded; now reportProgress is called right before early return
This commit is contained in:
Hermes Agent
2026-05-03 13:31:47 +00:00
parent 2017447e81
commit 8d894b08e6
5 changed files with 164 additions and 269 deletions
+4 -2
View File
@@ -14,6 +14,8 @@ interface EncodeInput {
data: ArrayBuffer;
isText: boolean;
compress: boolean;
filename?: string;
mimeType?: string;
}
interface EncodeOutput {
@@ -33,7 +35,7 @@ interface ErrorOutput {
message: string;
}
// ─── Worker handler ─────────────────────────────────────────────────────────────────u2500
// ─── Worker handler ───────────────────────────────────────────────────────────────────
self.onmessage = (e: MessageEvent<EncodeInput>) => {
const msg = e.data;
@@ -52,7 +54,7 @@ self.onmessage = (e: MessageEvent<EncodeInput>) => {
function handleEncode(input: EncodeInput): EncodeOutput {
const originalBytes = new Uint8Array(input.data);
const result = packetize(originalBytes, input.isText, input.compress);
const result = packetize(originalBytes, input.isText, input.compress, input.filename, input.mimeType);
const frames = scheduleFrames(result.packets, result.totalGenerations, result.sessionId);
return {