Add canvas artifact RPC foundation for A2UI
This commit is contained in:
@@ -234,6 +234,46 @@ describe('GatewayServer integration', () => {
|
||||
expect(methods).toContain('sessions.create');
|
||||
expect(methods).toContain('tools.list');
|
||||
expect(methods).toContain('tools.invoke');
|
||||
expect(methods).toContain('canvas.put');
|
||||
expect(methods).toContain('canvas.list');
|
||||
});
|
||||
|
||||
it('supports canvas artifact lifecycle via gateway RPC', async () => {
|
||||
if (!LISTEN_ALLOWED) {
|
||||
return;
|
||||
}
|
||||
const ws = await createClient();
|
||||
try {
|
||||
const put = await sendAndReceive(ws, {
|
||||
id: 31,
|
||||
method: 'canvas.put',
|
||||
params: {
|
||||
sessionId: 'ws:test-canvas',
|
||||
artifactId: 'a1',
|
||||
type: 'note',
|
||||
content: { text: 'draft' },
|
||||
},
|
||||
});
|
||||
expect((put as GatewayResponse).id).toBe(31);
|
||||
|
||||
const list = await sendAndReceive(ws, {
|
||||
id: 32,
|
||||
method: 'canvas.list',
|
||||
params: { sessionId: 'ws:test-canvas' },
|
||||
});
|
||||
const artifacts = ((list as GatewayResponse).result as { artifacts: Array<{ id: string }> }).artifacts;
|
||||
expect(artifacts).toHaveLength(1);
|
||||
expect(artifacts[0]?.id).toBe('a1');
|
||||
|
||||
const clear = await sendAndReceive(ws, {
|
||||
id: 33,
|
||||
method: 'canvas.clear',
|
||||
params: { sessionId: 'ws:test-canvas' },
|
||||
});
|
||||
expect(((clear as GatewayResponse).result as { cleared: number }).cleared).toBe(1);
|
||||
} finally {
|
||||
ws.close();
|
||||
}
|
||||
});
|
||||
|
||||
// ── HTTP static file serving tests ────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user