fix(feedback): keep payload in feedback event

This commit is contained in:
Turtle
2026-07-29 21:33:53 +08:00
parent 0ccd3ed463
commit eb6fa86481
42 changed files with 248 additions and 130 deletions

View File

@@ -320,6 +320,25 @@ describe('CommandService', () => {
])
})
it('omits raw input from command/run when an authoritative domain event owns it', async () => {
const ctx = await mount()
const { agent } = await mintAgentScope(ctx, 'a')
const seen = vi.fn(() => ({ kind: 'success' as const }))
ctx.commands.register({
name: 'private',
description: 'Record privately',
recordInput: false,
handler: seen,
})
await ctx.commands.execute(agent, '/private keep this once', new AbortController().signal)
expect(seen).toHaveBeenCalledWith(expect.objectContaining({ rawInput: ' keep this once' }))
const run = agent.session.events.find(event => event.type === 'command/run')
expect(run?.type).toBe('command/run')
expect(run?.type === 'command/run' && Object.hasOwn(run.data, 'args')).toBe(false)
})
it('mints distinct monotonic commandIds across executions', async () => {
const ctx = await mount()
const { agent } = await mintAgentScope(ctx, 'a')