mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Show first user message in resume picker
This commit is contained in:
@@ -991,6 +991,49 @@ describe('session model', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('includes first user message in local resumable sessions', () => {
|
||||
const store = new Store(':memory:')
|
||||
const engine = new SyncEngine(
|
||||
store,
|
||||
{} as never,
|
||||
new RpcRegistry(),
|
||||
{ broadcast() {} } as never
|
||||
)
|
||||
|
||||
try {
|
||||
const session = engine.getOrCreateSession(
|
||||
'local-resume-first-message',
|
||||
{
|
||||
path: '/tmp/project',
|
||||
host: 'localhost',
|
||||
machineId: 'machine-1',
|
||||
flavor: 'codex',
|
||||
codexSessionId: 'codex-thread-1',
|
||||
name: 'Generated title'
|
||||
},
|
||||
null,
|
||||
'default'
|
||||
)
|
||||
store.messages.addMessage(session.id, {
|
||||
role: 'agent',
|
||||
content: { type: 'text', text: 'agent warmup' }
|
||||
})
|
||||
store.messages.addMessage(session.id, {
|
||||
role: 'user',
|
||||
content: { type: 'text', text: ' Build the picker\nwith search ' }
|
||||
})
|
||||
|
||||
const sessions = engine.listLocalResumableSessions('default', { machineId: 'machine-1' })
|
||||
|
||||
expect(sessions.find((item) => item.sessionId === session.id)).toMatchObject({
|
||||
name: 'Generated title',
|
||||
firstUserMessage: 'Build the picker with search'
|
||||
})
|
||||
} finally {
|
||||
engine.stop()
|
||||
}
|
||||
})
|
||||
|
||||
it('local handoff succeeds immediately for inactive sessions', async () => {
|
||||
const store = new Store(':memory:')
|
||||
const engine = new SyncEngine(
|
||||
|
||||
Reference in New Issue
Block a user