mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-04 01:40:45 +08:00
- Implemented CliCommandNode component for executing CLI tools with AI models. - Implemented PromptNode component for constructing AI prompts with context. - Added styling for mode and tool badges in both components. - Enhanced user experience with command and argument previews, execution status, and error handling. test: add comprehensive tests for ask_question tool - Created direct test for ask_question tool execution. - Developed end-to-end tests to validate ask_question tool integration with WebSocket and A2UI surfaces. - Implemented simple and integrated WebSocket tests to ensure proper message handling and surface reception. - Added tool registration test to verify ask_question tool is correctly registered. chore: add WebSocket listener and simulation tests - Added WebSocket listener for A2UI surfaces to facilitate testing. - Implemented frontend simulation test to validate complete flow from backend to frontend. - Created various test scripts to ensure robust testing of ask_question tool functionality.
45 lines
1.5 KiB
JavaScript
45 lines
1.5 KiB
JavaScript
/**
|
||
* Direct test of ask_question tool by importing and calling the handler
|
||
* This runs in the same Node.js process as imports, so it tests tool execution
|
||
* but WebSocket distribution will only work if there are actual clients connected
|
||
*/
|
||
|
||
import { handler } from './ccw/dist/tools/ask-question.js';
|
||
|
||
console.log('=== Direct ask_question Tool Test ===\n');
|
||
|
||
console.log('1. Calling ask_question handler directly...\n');
|
||
|
||
const params = {
|
||
question: {
|
||
id: 'direct-test-1',
|
||
type: 'confirm',
|
||
title: 'Direct Test Question',
|
||
message: 'This is a direct test of the ask_question tool',
|
||
description: 'If you see this in the frontend, the integration is working!'
|
||
},
|
||
timeout: 10000 // 10 second timeout
|
||
};
|
||
|
||
console.log('2. Tool parameters:', JSON.stringify(params, null, 2));
|
||
console.log('\n3. Executing tool (will wait for answer or timeout)...\n');
|
||
|
||
try {
|
||
const result = await handler(params);
|
||
|
||
console.log('4. Tool execution completed!\n');
|
||
console.log('Result:', JSON.stringify(result, null, 2));
|
||
|
||
if (result.success && !result.result.error) {
|
||
console.log('\n✅ SUCCESS!');
|
||
console.log('Answer received:', result.result.answers?.[0]?.value);
|
||
} else if (result.result.error === 'Question timed out') {
|
||
console.log('\n⏱️ TIMEOUT - No answer received within 10 seconds');
|
||
console.log('Check if frontend dialog appeared');
|
||
} else {
|
||
console.log('\n❌ FAILED:', result.result.error);
|
||
}
|
||
} catch (error) {
|
||
console.error('\n❌ ERROR:', error);
|
||
}
|