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,58 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
describe('LAN peer tools service', () => {
|
||||
afterEach(() => {
|
||||
vi.resetModules()
|
||||
vi.doUnmock('../../packages/server/src/services/lan-peer-socket')
|
||||
})
|
||||
|
||||
it('rejects remote tool calls on passive server-side peer connections', async () => {
|
||||
const execRemoteCommand = vi.fn()
|
||||
vi.doMock('../../packages/server/src/services/lan-peer-socket', () => ({
|
||||
getLanPeerSocketManager: () => ({
|
||||
getConnection: () => ({
|
||||
info: () => ({ role: 'server' }),
|
||||
execRemoteCommand,
|
||||
}),
|
||||
}),
|
||||
}))
|
||||
|
||||
const { getLanPeerToolsService } = await import('../../packages/server/src/services/lan-peer-tools')
|
||||
|
||||
expect(() => getLanPeerToolsService().exec({
|
||||
connectionId: 'server-side-connection',
|
||||
command: 'id',
|
||||
})).toThrow('Peer connection is not authorized for remote tools')
|
||||
expect(execRemoteCommand).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('allows remote tool calls on active client-side peer connections', async () => {
|
||||
const execRemoteCommand = vi.fn(async () => ({
|
||||
stdout: 'ok',
|
||||
stderr: '',
|
||||
exit_code: 0,
|
||||
timed_out: false,
|
||||
}))
|
||||
vi.doMock('../../packages/server/src/services/lan-peer-socket', () => ({
|
||||
getLanPeerSocketManager: () => ({
|
||||
getConnection: () => ({
|
||||
info: () => ({ role: 'client' }),
|
||||
execRemoteCommand,
|
||||
}),
|
||||
}),
|
||||
}))
|
||||
|
||||
const { getLanPeerToolsService } = await import('../../packages/server/src/services/lan-peer-tools')
|
||||
const result = await getLanPeerToolsService().exec({
|
||||
connectionId: 'client-side-connection',
|
||||
command: 'id',
|
||||
args: ['-u'],
|
||||
})
|
||||
|
||||
expect(result.stdout).toBe('ok')
|
||||
expect(execRemoteCommand).toHaveBeenCalledWith(expect.objectContaining({
|
||||
command: 'id',
|
||||
args: ['-u'],
|
||||
}))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user