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.
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
buildProjectedGroupChatHistory,
|
|
isWorkspaceDiffToolMessage,
|
|
projectGroupChatMessage,
|
|
} from '../../packages/server/src/services/hermes/group-chat/context-projection'
|
|
|
|
function message(overrides: Record<string, unknown>) {
|
|
return {
|
|
id: 'm1',
|
|
roomId: 'room-1',
|
|
senderId: 'agent-1',
|
|
senderName: 'Worker',
|
|
content: 'hello',
|
|
timestamp: 1,
|
|
role: 'user',
|
|
...overrides,
|
|
} as any
|
|
}
|
|
|
|
describe('group chat workspace diff context exclusion', () => {
|
|
it('identifies workspace_diff tool messages for hard context exclusion', () => {
|
|
expect(isWorkspaceDiffToolMessage(message({ role: 'tool', tool_name: 'workspace_diff' }))).toBe(true)
|
|
expect(isWorkspaceDiffToolMessage(message({ role: 'tool', tool_name: 'search' }))).toBe(false)
|
|
})
|
|
|
|
it('excludes workspace_diff messages from projected model history while keeping regular tools', () => {
|
|
const diff = message({
|
|
id: 'diff-1',
|
|
role: 'tool',
|
|
tool_name: 'workspace_diff',
|
|
content: JSON.stringify({ kind: 'workspace_diff', files: [{ patch: '+secret patch' }] }),
|
|
})
|
|
const regularTool = message({
|
|
id: 'tool-1',
|
|
role: 'tool',
|
|
tool_name: 'search',
|
|
content: 'docs found',
|
|
})
|
|
|
|
const history = buildProjectedGroupChatHistory('', [
|
|
message({ id: 'm1', senderName: 'Alice', senderId: 'user-1', role: 'user', content: '@Worker hello' }),
|
|
diff,
|
|
regularTool,
|
|
], { agentId: 'agent-1', name: 'Worker' })
|
|
|
|
expect(history.map(item => item.content).join('\n')).not.toContain('secret patch')
|
|
expect(history).toContainEqual(projectGroupChatMessage(regularTool, { agentId: 'agent-1', name: 'Worker' }))
|
|
})
|
|
})
|