|
@@ -205,7 +205,22 @@ describe('prepared-route prompt admission', () => {
|
|
|
expect(systemTexts(h.capable.requests[0]!)).toEqual([
|
|
expect(systemTexts(h.capable.requests[0]!)).toEqual([
|
|
|
[{ type: 'text', text: 'prompt one' }], [{ type: 'text', text: 'prompt two' }],
|
|
[{ type: 'text', text: 'prompt one' }], [{ type: 'text', text: 'prompt two' }],
|
|
|
])
|
|
])
|
|
|
- expect(h.capable.requests[0]!.messages.map(message => message.role)).toEqual(['system', 'user', 'assistant', 'system', 'user'])
|
|
|
|
|
|
|
+ const messages = h.capable.requests[0]!.messages
|
|
|
|
|
+ expect(messages.map(message => message.role)).toEqual(['system', 'user', 'assistant', 'system', 'user', 'user'])
|
|
|
|
|
+ const notice = [{
|
|
|
|
|
+ type: 'text',
|
|
|
|
|
+ text: '[model changed: assistant turns above this point were generated by plain/model; the session continues with capable/model]',
|
|
|
|
|
+ }]
|
|
|
|
|
+ expect(messages.slice(-2).map(message => message.content)).toEqual([
|
|
|
|
|
+ [{ type: 'text', text: 'second' }], notice,
|
|
|
|
|
+ ])
|
|
|
|
|
+ const notices = h.agent.session.snapshotEvents().filter(event => event.type === 'user/message'
|
|
|
|
|
+ && event.data.source.kind === 'plugin' && event.data.source.plugin === 'model-selection')
|
|
|
|
|
+ expect(notices).toHaveLength(1)
|
|
|
|
|
+ expect(notices[0]!.data).toMatchObject({
|
|
|
|
|
+ content: notice,
|
|
|
|
|
+ source: { kind: 'plugin', plugin: 'model-selection', form: 'notice', summary: 'plain/model → capable/model' },
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it.each([false, true])('resumes capable history with first pre-step replacement=%s', async (replace) => {
|
|
it.each([false, true])('resumes capable history with first pre-step replacement=%s', async (replace) => {
|