Commit Graph

59 Commits

Author SHA1 Message Date
infrost af28cd45df add zxing-wasm qr encode method 2026-07-08 18:11:13 +01:00
Frost 2ad5b606c3 Update README with new demo link and test info
Updated the live demo link and clarified file transfer test details.
2026-07-08 18:11:13 +01:00
Frost ed22655f5b Revise file transfer scenarios in README
Updated file transfer scenarios and added details on performance improvements.
2026-07-08 18:11:13 +01:00
infrost db447ec0a0 update readme.md 2026-07-08 18:08:48 +01:00
infrost fd8b828ac4 change default message coding to raptorqwasm 2026-07-08 18:08:01 +01:00
infrost 0f28daf9cf using raptorq wasm 2026-07-08 18:08:01 +01:00
infrost ec6381b742 enable advance decode settings 2026-07-08 18:08:00 +01:00
infrost 682349e145 bug fixes and several improvements 2026-07-08 18:08:00 +01:00
infrost f06e26c256 enable Parallel QR 2026-07-08 18:08:00 +01:00
infrost 452a0c5df2 change qr scanner to zxing/wasm and ui improvement 2026-07-08 18:08:00 +01:00
infrost 5e7e3393fe add ajustable qr size 2026-07-08 18:08:00 +01:00
infrost 3f36779b73 add ajustable qr speed 2026-07-08 18:08:00 +01:00
infrost 1fb901bb56 init 2026-07-08 18:08:00 +01:00
Hermit 527d0e7b4e Update README.md 2026-07-08 18:08:00 +01:00
Hermes Agent 25437e2223 Make package scoped 2026-07-08 18:08:00 +01:00
Hermes Agent 57a52db54c Make prepublish hook do a full build 2026-07-08 18:08:00 +01:00
Hermes Agent 383b2f81d3 Replace em dashes with regular dashes in package.json, README, ARCHITECTURE 2026-05-04 16:34:13 +00:00
Hermes Agent aaef21883b Sync package.json version to v0.8.4 2026-05-04 16:31:31 +00:00
Hermes Agent f8fd9e864e Use relative Vite base path, remove strip-prefix hack 2026-05-04 16:09:32 +00:00
Hermes Agent 80c0a23bbd Fix --serve: strip Vite base path, add --port/--host flags 2026-05-04 16:05:26 +00:00
Hermes Agent 6d4a01dcd7 package.json: set author to Hermit, GitHub username to hermitm0nk 2026-05-04 15:57:13 +00:00
Hermes Agent 80a37fffdc Update package.json to v0.8.2, document CLI input modes and outer RS design in ARCHITECTURE.md 2026-05-04 15:56:04 +00:00
Hermes Agent 4b49acb8f7 CLI: pass filename and MIME type from file argument into packet metadata
- Added MIME type lookup table for common extensions
- Extracts basename from file path for filename metadata
- Channels filename/mimeType through readInput → buildFrames → packetize
- Stdin text mode leaves filename/mimeType undefined (as before)
2026-05-04 15:52:07 +00:00
Hermes Agent 5739d1b973 CLI: treat stdin as text input, file arg as binary input
- readInput() now returns {data, isText} tuple
- stdin (no file arg) → isText=true (text mode)
- file argument → isText=false (binary/file mode)
- Passes isText through to packetize for proper metadata tagging
2026-05-04 15:49:11 +00:00
Hermes Agent c93eda9156 Fix parityCount to use Math.floor, neededPackets to use totalGenerations
parityCount: Math.ceil → Math.floor
- Small files (G ≤ 33) now truly get 0 parity generations
- Large files (G ≥ 34) still get proportional parity (≈3%)
- Previously Math.ceil always gave ≥1 parity for any G ≥ 1

neededPackets: K * sourceGenerations → K * totalGenerations
- Aligns with the round-robin scheduler: symbols are interleaved
  across ALL generations, so practical minimum is K × totalGens
- Fixes the mismatch where 'needed' showed 32 but actual
  decode required ~48 frames (for 2 source + 1 parity case)

Tests: Updated assembly test comments and totalGenerations params
to match new parityCount behavior.

Closes the long-standing 'needed frames count is off because of
outer error correction' issue.
2026-05-04 15:32:25 +00:00
Hermes Agent d7fc7606ec fix(receiver): revert indicator to framesWithQR/accepted/needed with correct math
- framesWithQR now counts ALL frames with a valid QR (including duplicates),
  not just deduplicated ones. Moved increment before dedup check.
- acceptedPackets already correctly counts linearly-independent packets
  (rank increase), capped at K per generation by the decoder.
- neededPackets = K * sourceGenerations, computed from constants.
- Keep generation count (solvedGens/sourceGens) as secondary indicator.

This gives an honest rough progress bar: useful can approach or briefly
touch required while some generations are still partially filled, but the
generation count is the definitive completion signal.
2026-05-04 14:36:39 +00:00
Hermes Agent f4ef1bb473 fix(receiver): replace misleading packet ratio with generation progress
The compact indicator previously showed framesWithQR/acceptedPackets/neededPackets.
Because acceptedPackets counts parity-generation packets and uneven distribution
across generations, it could exceed neededPackets while the file was still not
decoded. This is confusing.

Change the primary compact indicator to generation counts:
  framesWithQR / solvedGens / sourceGens gens

This is always meaningful: solved never exceeds required, and when they match,
the transfer is complete. Packet count is kept as a raw secondary number.
2026-05-04 14:09:21 +00:00
Hermes Agent 6e14700fc4 chore: bump version to 0.7.0 2026-05-04 13:32:50 +00:00
Hermes Agent f56ed6455a feat: disable outer RS for small files (≤33 source generations)
Small files are already well-protected by QR code ECC + fountain code.
Outer Reed-Solomon only kicks in when sourceGenerations ≥ 34,
where ceil(G * 0.03) ≥ 1. This eliminates 100% overhead for tiny files.

- parityCount(): remove Math.max(1, ...) floor
- Update tests to not assume parity always exists
- Increase outer_ec_benefit.test.ts payloads to >34 gens so
  outer RS is actually active during benchmark
2026-05-04 13:32:39 +00:00
Hermes Agent ba788cc601 fix(receiver): start timer on first frame detection, add required QR count indicator
- Timer now starts when the first QR frame is detected (first progress
  message from worker with totalFrames > 0) instead of when camera is
  turned on. This eliminates the jump where elapsed time showed a few
  seconds before any QR was actually seen.

- Replace separate 'scanned' and 'useful' stats with a compact
  'QRs scanned/useful/required: X/Y/Z' indicator that clearly shows
  progress toward the total packets needed for decode. The 'required'
  count correctly accounts for outer RS overhead via K * sourceGens.

- Same display format applies to both camera and GIF-file input modes.
2026-05-04 12:31:35 +00:00
Hermes Agent b2ee0c55b5 fix: remove hardcoded absolute path from vite.config.ts alias
Replace /home/aiagent/projects/qr/src with resolve(__dirname, 'src')
so the project can be cloned and built on any machine.
2026-05-04 11:40:59 +00:00
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