feat(companion): support default canvas session in platform clients

This commit is contained in:
William Valentin
2026-02-16 18:41:18 -08:00
parent 56d06e4827
commit cd8bfe26dd
6 changed files with 180 additions and 37 deletions
@@ -196,15 +196,17 @@ describe('platform clients integration', () => {
}
const runtime = createRuntime();
const client = new MacOSCompanionClient({ runtime, nodeId: 'macos-canvas-e2e' });
const client = new MacOSCompanionClient({
runtime,
nodeId: 'macos-canvas-e2e',
defaultSessionId: 'ws:platform-canvas-e2e',
});
await client.connect();
try {
await client.register();
const sessionId = 'ws:platform-canvas-e2e';
const put = await client.putCanvasArtifact({
sessionId,
artifactId: 'mac-art-1',
type: 'note',
content: { text: 'hello from platform wrapper' },
@@ -212,16 +214,16 @@ describe('platform clients integration', () => {
expect(put.upserted).toBe(true);
expect(put.artifact.id).toBe('mac-art-1');
const list = await client.listCanvasArtifacts(sessionId);
const list = await client.listCanvasArtifacts();
expect(list.artifacts.some((artifact) => artifact.id === 'mac-art-1')).toBe(true);
const get = await client.getCanvasArtifact({ sessionId, artifactId: 'mac-art-1' });
const get = await client.getCanvasArtifact({ artifactId: 'mac-art-1' });
expect(get.artifact.id).toBe('mac-art-1');
const del = await client.deleteCanvasArtifact({ sessionId, artifactId: 'mac-art-1' });
const del = await client.deleteCanvasArtifact({ artifactId: 'mac-art-1' });
expect(del.deleted).toBe(true);
const clear = await client.clearCanvasArtifacts(sessionId);
const clear = await client.clearCanvasArtifacts();
expect(clear.cleared).toBe(0);
} finally {
client.disconnect();