mirror of
https://github.com/nexu-io/open-design.git
synced 2026-05-31 19:04:39 +07:00
* feat(dev): add desktop tools-dev control plane * refactor(sidecar): split Open Design contracts Move Open Design-specific sidecar protocol definitions into @open-design/contracts so sidecar and platform can remain descriptor-driven primitives. * refactor(daemon): organize package sources Keep daemon app code, tests, and sidecar entrypoints in separate package directories so each layer can be built and verified independently. * chore(repo): streamline maintenance entrypoints Centralize agent guidance by directory and reduce root command chains while preserving the existing build scope. * docs: translate agent guidance to English * fix(sidecar): tolerate stale IPC sockets Remove stale Unix socket files only after confirming no listener is active, so tools-dev can restart after unclean shutdowns.
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { createClaudeStreamHandler } from '../../apps/daemon/src/claude-stream.js';
|
|
import { createCopilotStreamHandler } from '../../apps/daemon/src/copilot-stream.js';
|
|
|
|
describe('structured agent stream fixtures', () => {
|
|
it('emits TodoWrite tool_use from Claude Code stream JSON', () => {
|
|
const events: unknown[] = [];
|
|
const handler = createClaudeStreamHandler((event: unknown) => events.push(event));
|
|
handler.feed(`${JSON.stringify({
|
|
type: 'assistant',
|
|
message: {
|
|
id: 'msg-1',
|
|
content: [
|
|
{
|
|
type: 'tool_use',
|
|
id: 'toolu-1',
|
|
name: 'TodoWrite',
|
|
input: {
|
|
todos: [{ content: 'Run QA', status: 'pending' }],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
})}\n`);
|
|
handler.flush();
|
|
|
|
expect(events).toContainEqual({
|
|
type: 'tool_use',
|
|
id: 'toolu-1',
|
|
name: 'TodoWrite',
|
|
input: {
|
|
todos: [{ content: 'Run QA', status: 'pending' }],
|
|
},
|
|
});
|
|
});
|
|
|
|
it('emits TodoWrite tool_use from GitHub Copilot CLI JSON stream', () => {
|
|
const events: unknown[] = [];
|
|
const handler = createCopilotStreamHandler((event: unknown) => events.push(event));
|
|
handler.feed(`${JSON.stringify({
|
|
type: 'tool.execution_start',
|
|
data: {
|
|
toolCallId: 'call-1',
|
|
toolName: 'TodoWrite',
|
|
arguments: {
|
|
todos: [{ content: 'Run QA', status: 'pending' }],
|
|
},
|
|
},
|
|
})}\n`);
|
|
handler.flush();
|
|
|
|
expect(events).toContainEqual({
|
|
type: 'tool_use',
|
|
id: 'call-1',
|
|
name: 'TodoWrite',
|
|
input: {
|
|
todos: [{ content: 'Run QA', status: 'pending' }],
|
|
},
|
|
});
|
|
});
|
|
});
|