fix(cli): wire command:result + system:reload socket events in TUI
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

Gateway slash command responses were silently dropped — use-socket.ts
had no handlers for command:result or system:reload. Added both:
- command:result → renders success/error as a system message
- system:reload → updates command registry manifest + shows reload message

Also removes stray @testing-library/react devDependency that was
never used in the CLI package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 08:02:18 -05:00
parent b6effdcd6b
commit 31aea56345

View File

@@ -12,6 +12,8 @@ import type {
SessionInfoPayload, SessionInfoPayload,
ErrorPayload, ErrorPayload,
CommandManifestPayload, CommandManifestPayload,
SlashCommandResultPayload,
SystemReloadPayload,
} from '@mosaic/types'; } from '@mosaic/types';
import { commandRegistry } from '../commands/index.js'; import { commandRegistry } from '../commands/index.js';
@@ -230,6 +232,27 @@ export function useSocket(opts: UseSocketOptions): UseSocketReturn {
commandRegistry.updateManifest(data.manifest); commandRegistry.updateManifest(data.manifest);
}); });
socket.on('command:result', (data: SlashCommandResultPayload) => {
const prefix = data.success ? '' : 'Error: ';
const text = data.message ?? (data.success ? 'Done.' : 'Command failed.');
setMessages((msgs) => [
...msgs,
{ role: 'system', content: `${prefix}${text}`, timestamp: new Date() },
]);
});
socket.on('system:reload', (data: SystemReloadPayload) => {
commandRegistry.updateManifest({
commands: data.commands,
skills: data.skills,
version: Date.now(),
});
setMessages((msgs) => [
...msgs,
{ role: 'system', content: data.message, timestamp: new Date() },
]);
});
return () => { return () => {
socket.disconnect(); socket.disconnect();
}; };