feat: make /transfer bidirectional across telegram and tui

This commit is contained in:
William Valentin
2026-02-18 07:55:08 -08:00
parent d48adbe0b0
commit 16af5e75fd
13 changed files with 262 additions and 17 deletions
+29 -1
View File
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { createContextCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand } from './index.js';
import { createContextCommand, createElevateCommand, createModelCommand, createQueueCommand, createResearchCommand, createTransferCommand } from './index.js';
describe('builtin /model command', () => {
it('passes through the full argument string', async () => {
@@ -169,3 +169,31 @@ describe('builtin /context command', () => {
expect(result).toEqual({ handled: true, text: 'Context command is not available in this session.' });
});
});
describe('builtin /transfer command', () => {
it('passes through the full target argument string', async () => {
const cmd = createTransferCommand();
const transferSession = vi.fn(() => 'Session transferred');
const result = await cmd.execute(['telegram'], {
channel: 'test',
senderId: 'user',
sessionId: 's1',
rawInput: '/transfer telegram',
services: { transferSession },
});
expect(transferSession).toHaveBeenCalledWith('telegram');
expect(result).toEqual({ handled: true, text: 'Session transferred' });
});
it('returns not-available when service is missing', async () => {
const cmd = createTransferCommand();
const result = await cmd.execute(['tui'], {
channel: 'test',
senderId: 'user',
sessionId: 's1',
rawInput: '/transfer tui',
services: {},
});
expect(result).toEqual({ handled: true, text: 'Transfer command is not available in this session.' });
});
});