* feat(ai): add HarnessAgent sidecar foundation * feat(ai): integrate Pi as a Harness provider * fix(ai): harden Harness provider integration * fix(ai): address Harness integration review * fix(ai): align Harness code with project conventions * fix(ai): preserve Harness sessions on cancellation * test(ai): cover Harness JSONL framing * refactor(ai): generalize Harness sidecar adapters * fix(ci): build Harness sidecar for native checks
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import { describe, expect, test } from 'bun:test'
|
|
|
|
import { replaceMCPConnectionSettings, setMCPConnectionCredential } from '@/app/integrations/mcp'
|
|
import { buildPiMCPServers } from '@/app/integrations/mcp/pi'
|
|
|
|
import { installTauriMockWindow } from '#tests/helpers/tauri/mocks'
|
|
|
|
installTauriMockWindow()
|
|
|
|
describe('Pi MCP configuration', () => {
|
|
test('adapts the built-in and external MCP servers to Pi native configuration', async () => {
|
|
replaceMCPConnectionSettings({
|
|
version: 1,
|
|
connections: [
|
|
{
|
|
id: 'mcp-example',
|
|
name: 'example',
|
|
enabled: true,
|
|
transport: { type: 'streamable-http', url: 'https://example.com/mcp' },
|
|
authentication: {
|
|
type: 'bearer',
|
|
credentialRef: {
|
|
integrationId: 'mcp',
|
|
profileId: 'mcp-example',
|
|
field: 'bearer-token'
|
|
}
|
|
}
|
|
}
|
|
]
|
|
})
|
|
await setMCPConnectionCredential('mcp-example', 'external-token')
|
|
|
|
const servers = await buildPiMCPServers({ authorizationToken: 'built-in-token' })
|
|
expect(servers.example).toEqual({
|
|
url: 'https://example.com/mcp',
|
|
headers: { Authorization: 'Bearer external-token' },
|
|
auth: false
|
|
})
|
|
expect(servers['open-pencil']).toEqual({
|
|
url: expect.stringContaining('/mcp'),
|
|
headers: { Authorization: 'Bearer built-in-token' },
|
|
auth: false
|
|
})
|
|
})
|
|
})
|