feat(a2ui): Implement A2UI backend with question handling and WebSocket support

- Added A2UITypes for defining question structures and answers.
- Created A2UIWebSocketHandler for managing WebSocket connections and message handling.
- Developed ask-question tool for interactive user questions via A2UI.
- Introduced platformUtils for platform detection and shell command handling.
- Centralized TypeScript types in index.ts for better organization.
- Implemented compatibility checks for hook templates based on platform requirements.
This commit is contained in:
catlog22
2026-01-31 15:27:12 +08:00
parent 4e009bb03a
commit 715ef12c92
163 changed files with 19495 additions and 715 deletions

View File

@@ -6,9 +6,11 @@
import { QueryClientProvider } from '@tanstack/react-query';
import { RouterProvider } from 'react-router-dom';
import { IntlProvider } from 'react-intl';
import { useEffect } from 'react';
import { router } from './router';
import queryClient from './lib/query-client';
import type { Locale } from './lib/i18n';
import { useWorkflowStore } from '@/stores/workflowStore';
interface AppProps {
locale: Locale;
@@ -23,10 +25,36 @@ function App({ locale, messages }: AppProps) {
return (
<IntlProvider locale={locale} messages={messages}>
<QueryClientProvider client={queryClient}>
<QueryInvalidator />
<RouterProvider router={router} />
</QueryClientProvider>
</IntlProvider>
);
}
/**
* Query invalidator component
* Registers callback with workflowStore to invalidate workspace queries on workspace switch
*/
function QueryInvalidator() {
const registerQueryInvalidator = useWorkflowStore((state) => state.registerQueryInvalidator);
useEffect(() => {
// Register callback to invalidate all 'workspace' prefixed queries
const callback = () => {
queryClient.invalidateQueries({
predicate: (query) => {
const queryKey = query.queryKey;
// Check if the first element of the query key is 'workspace'
return Array.isArray(queryKey) && queryKey[0] === 'workspace';
},
});
};
registerQueryInvalidator(callback);
}, [registerQueryInvalidator]);
return null;
}
export default App;