wip: next round of implementation, this time tests

This commit is contained in:
2026-02-25 20:38:34 +01:00
parent 20ea499a6f
commit 7808ce74ac
8 changed files with 633 additions and 1 deletions

View File

@@ -71,4 +71,23 @@ describe('agentic protocol validator', () => {
expect(result.ok).toBe(true);
});
it('rejects invalid request envelope and returns structured protocol error', () => {
const result = validateProtocolRequestEnvelope({
protocolVersion: '2.0',
surface: 'tab',
messages: [{ role: 'invalid-role', content: 'Create a chart' }],
context: { projectId: 'project-1' },
capabilities: {
widgets: ['chart'],
actions: ['openPost'],
tools: ['search_posts'],
},
unknown: true,
});
expect(result.ok).toBe(false);
expect(result.error?.code).toBe('AGUI_PROTOCOL_VALIDATION_ERROR');
expect(result.error?.details?.length).toBeGreaterThan(0);
});
});