mirror of
https://github.com/davidkaya/aryx.git
synced 2026-07-24 21:48:36 +02:00
- Add McpOauthRequiredEvent and McpOauthStaticClientConfigEvent to sidecar contracts - Add PendingMcpAuthRecord domain type with status tracking (pending/authenticating/failed/done) - Add pendingMcpAuth field to SessionRecord for session-level auth state - Wire onMcpOAuthRequired callback through sidecarProcess, runTurnPending, and AryxAppService - Handle mcp-oauth-required events: set session pendingMcpAuth, clear on turn finalize/cancel - Add dismissSessionMcpAuth IPC channel with preload binding and handler registration - Create McpAuthBanner component (amber-themed, shows server name/URL, dismiss button) - Integrate McpAuthBanner into ChatPane with placeholder text and App.tsx callback - Update test fixtures for new RunTurnPendingCommand.onMcpOAuthRequired field Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
57 lines
1.8 KiB
TypeScript
57 lines
1.8 KiB
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
|
|
import {
|
|
markRunTurnPendingErrored,
|
|
shouldHandleRunTurnEvent,
|
|
type RunTurnPendingCommand,
|
|
} from '@main/sidecar/runTurnPending';
|
|
|
|
describe('run turn pending helpers', () => {
|
|
test('marks a run-turn pending command as errored and rejects it once', () => {
|
|
const rejected: Error[] = [];
|
|
const pending: RunTurnPendingCommand = {
|
|
kind: 'run-turn',
|
|
resolve: () => undefined,
|
|
reject: (error) => rejected.push(error),
|
|
onDelta: () => undefined,
|
|
onActivity: () => undefined,
|
|
onApproval: () => undefined,
|
|
onUserInput: () => undefined,
|
|
onExitPlanMode: () => undefined,
|
|
onMcpOAuthRequired: () => undefined,
|
|
errored: false,
|
|
};
|
|
|
|
const first = markRunTurnPendingErrored(pending, 'boom');
|
|
const second = markRunTurnPendingErrored(pending, new Error('later'));
|
|
|
|
expect(first).toBeInstanceOf(Error);
|
|
expect(first.message).toBe('boom');
|
|
expect(second.message).toBe('later');
|
|
expect(pending.errored).toBe(true);
|
|
expect(rejected).toHaveLength(1);
|
|
expect(rejected[0].message).toBe('boom');
|
|
});
|
|
|
|
test('stops handling turn events after the pending command has errored', () => {
|
|
const pending: RunTurnPendingCommand = {
|
|
kind: 'run-turn',
|
|
resolve: () => undefined,
|
|
reject: () => undefined,
|
|
onDelta: () => undefined,
|
|
onActivity: () => undefined,
|
|
onApproval: () => undefined,
|
|
onUserInput: () => undefined,
|
|
onExitPlanMode: () => undefined,
|
|
onMcpOAuthRequired: () => undefined,
|
|
errored: false,
|
|
};
|
|
|
|
expect(shouldHandleRunTurnEvent(pending)).toBe(true);
|
|
|
|
markRunTurnPendingErrored(pending, new Error('boom'));
|
|
|
|
expect(shouldHandleRunTurnEvent(pending)).toBe(false);
|
|
});
|
|
});
|