chore: bootstrap hermes-ui skeleton from 0.6.29 snapshot
Import the client, server, skills, tests, and build scripts as the starting point for the rebuild, then trim the surfaces this project does not ship: Electron desktop packaging, the marketing website, and the ESP32 firmware tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows. Rename the package and CLI entry points to hermes-ui, drop the prepare hook so npm ci no longer triggers a build, and drop the removed tsconfig and nodemon references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs so the documented package map and hard rules match this repository. reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
decodeMcuImaAdpcm,
|
||||
encodeMcuImaAdpcm,
|
||||
} from '../../packages/server/src/services/hermes/mcu-adpcm'
|
||||
|
||||
function pcmBuffer(samples: number[]): Buffer {
|
||||
const pcm = Buffer.alloc(samples.length * 2)
|
||||
samples.forEach((sample, index) => pcm.writeInt16LE(sample, index * 2))
|
||||
return pcm
|
||||
}
|
||||
|
||||
describe('MCU IMA-ADPCM', () => {
|
||||
it('round-trips mono PCM with the expected HADP framing', () => {
|
||||
const pcm = pcmBuffer([0, 1200, 2400, 1000, -500, -2200, -800, 300, 1500])
|
||||
const encoded = encodeMcuImaAdpcm(pcm, 16000)
|
||||
const decoded = decodeMcuImaAdpcm(encoded)
|
||||
|
||||
expect(encoded.toString('ascii', 0, 4)).toBe('HADP')
|
||||
expect(encoded.length).toBe(20 + Math.ceil((pcm.length / 2 - 1) / 2))
|
||||
expect(decoded.sampleRate).toBe(16000)
|
||||
expect(decoded.channels).toBe(1)
|
||||
expect(decoded.pcm.length).toBe(pcm.length)
|
||||
expect(decoded.pcm.readInt16LE(0)).toBe(pcm.readInt16LE(0))
|
||||
})
|
||||
|
||||
it('rejects truncated HADP chunks before allocating decoded PCM', () => {
|
||||
const encoded = encodeMcuImaAdpcm(pcmBuffer([0, 1000, 2000, 3000]), 16000)
|
||||
|
||||
expect(() => decodeMcuImaAdpcm(encoded.subarray(0, -1))).toThrow('size does not match')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user