Commit Graph

28 Commits

Author SHA1 Message Date
Hermes Agent 2500796edd docs: split README into README.md and ARCHITECTURE.md
README.md now focuses on user-facing content:
- General description and live demo link
- Installation instructions (npm, Bun, npx, bunx)
- CLI usage examples (file, stdin, --serve)
- CLI flags table
- Dev setup with all relevant commands and scripts
- Link to ARCHITECTURE.md

ARCHITECTURE.md contains all technical implementation details:
- High-level architecture diagram
- Full project structure tree
- Runtime and dev dependencies
- Protocol spec (packet format, constants, metadata wrapping)
- Algorithm deep dives (RLNC, GF256, QR encode/decode, GIF, scheduling)
- Sender and receiver data flow diagrams
- Design decisions and rationale
- Common pitfalls
2026-05-04 01:56:16 +00:00
Hermes Agent 468af211ad feat: rename to qr-stream, add --serve web preview, include src in package
- Rename CLI entry from qr-terminal.ts to qr-stream.ts
- Rename package to qr-stream, version 0.6.0
- Add --serve / -s flag to start built-in static file server for web UI preview
- Include dist/ and src/ in npm files so consumers get both bundled CLI and source code
- Add static_server.ts helper using Node built-in http module
- Update help text and tests for new name and --serve flag
- Remove old qr-terminal.js from deployment
2026-05-04 01:47:10 +00:00
Hermes Agent e1261ca927 chore: prepare package for npm publishing
- Add MIT LICENSE
- Remove "private": true
- Set name to qr-transfer-terminal, version 0.5.0
- Add files, engines, keywords, repository, bugs, homepage fields
- Move typescript from peerDependencies to devDependencies
- Add prepublishOnly script to ensure fresh CLI bundle
2026-05-04 01:29:09 +00:00
Hermes Agent a7773b5c0a feat(cli): make installable as qr-terminal bin; fix cursor positioning
- Add 'bin' field to package.json so npm/npx/bunx can invoke it as
  'qr-terminal'. The bin points to dist/qr-terminal.js.
- Change shebang to '#!/usr/bin/env node' for universal compatibility.
- Fix displaced chars: each frame write now ends with '\n' and
  moveCursorUp() appends '\x1b[G' to move to column 0. Previously the
  cursor stayed at the end of the previous last line, causing redraws
  to start mid-line.
- Position QR at top-left (removed padTop/padLeft centre logic) since
  the alt-buffer is clean and only the QR is shown.
- Update help text to show npx/bunx invocations.
2026-05-03 22:27:30 +00:00
Hermes Agent 352fc2d459 feat(cli): alt-buffer, top-of-screen draw, -h/--help flags
- Enter alternate screen buffer (\x1b[?1049h) before drawing and exit
  it (\x1b[?1049l) on cleanup. This preserves the user's terminal
  content when the app quits.
- Clear screen once after entering alt buffer so drawing starts from
  the top-left.
- Add -h and --help flags that print usage, stdin/file modes, and
  controls (q / Ctrl-C to quit).
- Update tests for new alt-buffer helpers and help text.
- Rebuild CLI bundle (dist/qr-terminal.js 95.4kb) and redeploy webapp.
2026-05-03 22:14:50 +00:00
Hermes Agent c0baff8d42 build: include CLI bundle in default build step 2026-05-03 22:06:56 +00:00
Hermes Agent 6854fbe3a7 fix(cli): eliminate flicker by in-place overwrite; remove status text
- Stop clearing the entire screen every frame — now clears once on first
  draw, then uses cursor-up (\x1b[nA) to overwrite the QR block in place.
- Removed frame counter, generation info, and 'press q' text — only the
  QR code is shown, keeping the display minimal and static-area free.
- Simplified buildFrames return type (Uint8Array[] only).
- Added moveCursorUp() helper to terminal_raster.ts.
2026-05-03 22:02:50 +00:00
Hermes Agent 664a0d0587 fix(cli): correct inverted QR colours via explicit ANSI white-bg/black-fg
Terminal block characters render in the foreground colour; on dark-themed
terminals the QR looked inverted. Now every line is wrapped with
\x1b[47m\x1b[30m (white bg / black fg) so dark modules appear black and
light modules appear white on any terminal theme.
2026-05-03 21:51:54 +00:00
Hermes Agent cdb43f36db fix(cli): add quiet zone around terminal QR; fix q-key quit via /dev/tty
- renderToTerminal now pads with a 4-module quiet zone (white border)
  horizontally and vertically, matching the webapp rasterizer.
- Keyboard input now tries /dev/tty first so q/Ctrl-C works even when
  stdin is a pipe (e.g. echo ... | bun run src/cli/qr-terminal.ts).
- Update all CLI renderer tests for padded output; add tests for custom
  and zero quiet zone.
- Increase outer_ec_benefit test timeout to 15s to avoid flaky failures.
- Rebuild CLI bundle and webapp; redeploy to nginx.
2026-05-03 21:38:17 +00:00
Hermes Agent 5340ae8fe1 fix: keep time/throughput visible after transfer completes
The transfer stats bar was wrapped in {scanning && ...} so elapsed
time and KB/s vanished when scanning auto-stopped on completion.
Add a persistent summary section that stays visible after scanning
stops, showing final transfer time, average throughput, and data size.

Uses formatDuration, formatBytes utility helpers already in the file.
2026-05-03 19:49:53 +00:00
Hermes Agent 73ae264e4d v0.5: CLI terminal QR frontend + tests + deploy to /qr-transfer/ 2026-05-03 19:44:16 +00:00
Hermes Agent 87bd318adc v0.4: outer RS error correction, scanner timer, generation-based progress
- Add outer Reed-Solomon error correction across generations
  (3% overhead, 1 parity gen per ~33 source gens)
- Fix progress display: show generations solved/needed instead of
  raw packet counts, making outer EC benefit visible
- Add decode timer: tracks elapsed time from first frame to completion
  and shows throughput in KB/s
- Add benchmark test confirming outer EC reduces tail waiting time
  under biased frame loss
- Remove per-generation hash verification (superseded by outer RS)
- Update deployment base path to /hermes-web-demos/qr/
2026-05-03 19:04:06 +00:00
Hermes Agent 036375a5eb docs: comprehensive README for onboarding 2026-05-03 14:50:28 +00:00
Hermes Agent 83396a1544 feat(routing): hash-based routes + sender state reset fix
- Hash routing: #sender / #receiver, persists across refresh
- App reads window.location.hash on mount and listens to hashchange
- Sender: resetOutput() helper revokes blob URLs and wipes all output state
- Sender resets when: mode changes, file changes, text changes, generate clicked
- Fixes 'object error' caused by stale revoked blob URLs staying in DOM
2026-05-03 13:53:41 +00:00
Hermes Agent 8d894b08e6 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
2026-05-03 13:31:47 +00:00
Hermes Agent 2017447e81 feat(receiver): informative frame stats, camera zoom, crop overlay, jsQR opts
- Frame count now shows: scanned / useful (linearly independent) / minimal needed
- Camera zoom via getUserMedia track.applyConstraints when supported
- Software crop fallback with visible dashed-square overlay on video
- Corner markers on scan region for visual feedback
- qr_decode accepts inversionAttempts option for faster GIF decoding
- Preserved attemptBoth for camera scanning (handles glare/reflections)
2026-05-03 13:10:08 +00:00
Hermes Agent bbe49ddee8 refactor: replace manifest with fixed header, single V10-M profile
- Remove CBOR manifest and manifest.ts entirely
- Fixed 18-byte packet header: sessionId, generationIndex, symbolIndex,
  packetType, totalGenerations, dataLength, flags, reserved
- Single hardcoded profile: QR V10, ECC M, K=16, R=8, payload=191 bytes
- Add isText flag (bit 0 of flags) for text vs binary routing
- Remove hash computation and profile selection UI
- Update all tests to match new protocol (33 tests passing)
- Fix generateCoefficients arg order bug in complete.test.ts
- Fix createQRGif dimension bug in tests
- Make prod_roundtrip frame loss deterministic

All 33 tests pass. Build succeeds.
2026-05-03 12:10:09 +00:00
Hermes Agent 2506ac317c Fix decode stalling: include packetType in dedup key to prevent manifest/data collision
The dedup key was `::`, which
caused manifest fragment 0 to collide with systematic symbol 0. The RLNC
decoder then never reached full rank, so generations never solved and the
receiver appeared to hang.

- Add packetType to dedup key so manifest/systematic/coded symbols are unique
- Add completed session flag to ignore late frames after reconstruction
- Prevent trailing progress message from overwriting complete status
- Add frame_decode and prod_roundtrip tests
2026-05-03 02:12:40 +00:00
Hermes Agent 98eaadfa87 Add debug logging to decode worker: track frame count, report QR null/error messages to UI. Error display now visible in GIF file mode. 2026-05-02 23:29:32 +00:00
Hermes Agent 91cdaec50d Cleanup test files 2026-05-02 23:20:00 +00:00
Hermes Agent 067c4abbc7 Fix GIF file mode: send transferable ArrayBuffer pixels instead of ImageData objects (structured clone can fail in some browsers). Worker reconstructs ImageData from received buffer. 2026-05-02 23:19:56 +00:00
Hermes Agent 1f406b5739 Fix GIF parser: gifFrameToRgba now fills all pixels with background color (was leaving unset pixels as (0,0,0,0) black). Add error display to GIF file mode section. 2026-05-02 23:14:52 +00:00
Hermes Agent cad1f91b92 Fix QR decode for binary data: use jsQR chunk.bytes instead of result.data (UTF-8 drops bytes>127). Fix GIF LZW decoder: don't reset bit buffer on clear code (discards valid bits). Fix receiver GIF file mode: use gif_parser instead of drawImage (only captured first frame). 2026-05-02 23:04:00 +00:00
Hermes Agent dc370f9bce Fix GIF roundtrip: rewrite LZW decoder, add GIF file test mode
- Rewrote GIF LZW decoder (gif_parser.ts) — old version produced
  wrong pixel indices for larger images (V20 QR frames), causing
  all QR decodes to fail after GIF roundtrip
- Added full end-to-end test: encode → QR → GIF → parse GIF →
  decode QR → RLNC decode → reconstruct (94 tests passing)
- Added GIF File input mode to receiver for debug/testing
- Fixed receiver stale closure bug (scanning state captured
  as false, preventing any frame capture)
- GIF parser handles: LZW, interlaced, local/global palettes,
  Graphics Control Extension, disposal methods
2026-05-02 22:43:58 +00:00
Hermes Agent 6f3f0b2ee2 Fix receiver: stale closure + add GIF file test mode
- Fix stale closure bug in camera capture loop (scanning state
  captured as false, preventing any frame capture)
- Add GIF File input mode to receiver — upload a QR-over-GIF
  directly to test the decode pipeline without camera
- Update decode worker to accept imageData or frameData
- Receiver now shows two input modes: Camera and GIF File
2026-05-02 22:22:42 +00:00
Hermes Agent 0241068994 Fix receiver stale closure bug — scanning never started
The rAF capture loop checked  where
 was a state variable captured in a stale closure.
The loop was created when scanning=false, so it immediately
exited on every frame and never captured any camera frames.

Fix: use scanningRef (useRef) instead of state for the loop
guard, so the rAF callback always reads the live value.
2026-05-02 22:17:04 +00:00
Hermes Agent efdf9d0e13 Fix robustness, white border, GIF size estimate
- Fix Robust profile: V20-Q (97 modules, 315px) instead of broken V31-Q
  — fewer modules = bigger squares = camera-friendly
  — K=16, R=16 (100% overhead for max robustness)
  — Actual max payload: 450 bytes (verified against QR library)
- Fix Balanced: V25-Q, K=20, R=12
- Fix Fast: V35-M, K=24, R=8
- Remove ugly white border: global CSS reset (margin:0, padding:0)
- Remove broken estimated GIF size (was off by orders of magnitude)
- Show actual GIF size after generation instead
- Add 8MB file size limit
- Remove warning banners
2026-05-02 22:08:36 +00:00
Hermes Agent b20e5c9c17 Initial implementation: QR-over-GIF Transfer System
- Protocol: packet format, CRC32C, CBOR manifest, fragmentation
- FEC: GF(256) arithmetic, xoshiro128** PRNG, systematic RLNC encoder/decoder
- QR: generation (qrcode-generator), rasterization (3px/module), decoding (jsQR)
- GIF: animated GIF generation (gifenc) with 2-colour palette
- Preprocessing: deflate compression, SHA-256 hashing
- Sender pipeline: packetizer, frame scheduler with interleaving
- Workers: encode, gif generation, decode/reconstruction in Web Workers
- UI: Preact SPA with Sender/Receiver tabs, dark theme
- Tests: 93 passing (unit, property-based, integration, E2E)
- Default profile: Robust (V31-Q, K=24, R=12)
- Deployed to /hermes-web-demos/qr-transfer/
2026-05-02 21:37:06 +00:00