feat(app): add native chat sessions browser

This commit is contained in:
2026-10-21 13:37:03 +01:00
parent d99cd82616
commit 48059247d1
6 changed files with 509 additions and 25 deletions
@@ -222,6 +222,7 @@ void main() {
'session_id': 's',
'text': 'hi',
'operation_id': 'same',
'native_message_id': 'msg_same',
},
});
await repo.answerForm('s', 'f', {'choice': 'yes'}, action: 'submit');
@@ -239,7 +240,7 @@ void main() {
'session_id': 's',
'request_id': 'r',
'decision': 'once',
'client': 'web',
'client': 'Web',
'message': 'approved',
},
});
@@ -255,5 +256,41 @@ void main() {
expect(gateway.calls.last.type, 'chat_model');
},
);
test('rejects invalid permissions and prompts before sending', () async {
expect(
() => repo.prompt(' ', 'hello', operationId: 'x'),
throwsArgumentError,
);
expect(
() => repo.prompt('s', ' ', operationId: 'x'),
throwsArgumentError,
);
expect(
() => repo.replyPermission('s', 'r', 'approve'),
throwsArgumentError,
);
expect(gateway.calls, isEmpty);
});
test(
'uses the server model catalog object and default history limit',
() async {
gateway.reply = {
'chat_models': {
'providers': {
'p': ['m'],
},
},
};
expect((await repo.models('s'))['providers'], {
'p': ['m'],
});
expect(gateway.calls.single.fields, {
'chat_query': {'session_id': 's'},
});
gateway.calls.clear();
await repo.history('s');
expect(gateway.calls.single.fields['chat_query']['limit'], 200);
},
);
});
}