mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-12 15:34:58 -05:00
* v0 * v1 * Basic ss tes * Ss tests * Stuff * Add mcp * mcp v1 * Improvement * Fix * BROKEN * Checkpoint * Streaming * Fix abort * Things are broken * Streaming seems to work but copilot is dumb * Fix edge issue * LUAAAA * Fix stream buffer * Fix lint * Checkpoint * Initial temp state, in the middle of a refactor * Initial test shows diff store still working * Tool refactor * First cleanup pass complete - untested * Continued cleanup * Refactor * Refactor complete - no testing yet * Fix - cursor makes me sad * Fix mcp * Clean up mcp * Updated mcp * Add respond to subagents * Fix definitions * Add tools * Add tools * Add copilot mcp tracking * Fix lint * Fix mcp * Fix * Updates * Clean up mcp * Fix copilot mcp tool names to be sim prefixed * Add opus 4.6 * Fix discovery tool * Fix * Remove logs * Fix go side tool rendering * Update docs * Fix hydration * Fix tool call resolution * Fix * Fix lint * Fix superagent and autoallow integrations * Fix always allow * Update block * Remove plan docs * Fix hardcoded ff * Fix dropped provider * Fix lint * Fix tests * Fix dead messages array * Fix discovery * Fix run workflow * Fix run block * Fix run from block in copilot * Fix lint * Fix skip and mtb * Fix typing * Fix tool call * Bump api version * Fix bun lock * Nuke bad files
43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
/**
|
|
* @vitest-environment node
|
|
*/
|
|
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
normalizeSseEvent,
|
|
shouldSkipToolCallEvent,
|
|
shouldSkipToolResultEvent,
|
|
} from '@/lib/copilot/orchestrator/sse-utils'
|
|
|
|
describe('sse-utils', () => {
|
|
it.concurrent('normalizes tool fields from string data', () => {
|
|
const event = {
|
|
type: 'tool_result',
|
|
data: JSON.stringify({
|
|
id: 'tool_1',
|
|
name: 'edit_workflow',
|
|
success: true,
|
|
result: { ok: true },
|
|
}),
|
|
}
|
|
|
|
const normalized = normalizeSseEvent(event as any)
|
|
|
|
expect(normalized.toolCallId).toBe('tool_1')
|
|
expect(normalized.toolName).toBe('edit_workflow')
|
|
expect(normalized.success).toBe(true)
|
|
expect(normalized.result).toEqual({ ok: true })
|
|
})
|
|
|
|
it.concurrent('dedupes tool_call events', () => {
|
|
const event = { type: 'tool_call', data: { id: 'tool_call_1', name: 'plan' } }
|
|
expect(shouldSkipToolCallEvent(event as any)).toBe(false)
|
|
expect(shouldSkipToolCallEvent(event as any)).toBe(true)
|
|
})
|
|
|
|
it.concurrent('dedupes tool_result events', () => {
|
|
const event = { type: 'tool_result', data: { id: 'tool_result_1', name: 'plan' } }
|
|
expect(shouldSkipToolResultEvent(event as any)).toBe(false)
|
|
expect(shouldSkipToolResultEvent(event as any)).toBe(true)
|
|
})
|
|
})
|