Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Share agent fix (better naming + register plugin correctly)

ali-inkcof536d6426874
diff --git a/packages/app/src/builder-ui/ui/react-injects.tsx b/packages/app/src/builder-ui/ui/react-injects.tsx
index 2e06842c..10a1c8ec 100644
--- a/packages/app/src/builder-ui/ui/react-injects.tsx
+++ b/packages/app/src/builder-ui/ui/react-injects.tsx
@@ -25,7 +25,7 @@ import ConfirmModal from '@src/react/shared/components/ui/modals/ConfirmModal';
import { Spinner } from '@src/react/shared/components/ui/spinner';
import { AppStateProvider, useAppState } from '@src/react/shared/contexts/AppStateContext';
import { useAuthCtx } from '@src/react/shared/contexts/auth.context';
-import { plugins, PluginType } from '@src/react/shared/plugins/Plugins';
+import { plugins, PluginTarget, PluginType } from '@src/react/shared/plugins/Plugins';
import { queryClient } from '@src/react/shared/query-client';
import { QueryClientProvider } from '@tanstack/react-query';
import { BrowserRouter as Router } from 'react-router-dom';
@@ -237,29 +237,27 @@ export function renderAgentModals({ rootID }: { rootID: string }): void {
const authContext = useAuthCtx();
const appState = useAppState();
- const shareButton = document.getElementById('share-agent-button-topbar') as HTMLButtonElement;
- if (shareButton) {
- shareButton.disabled = !authContext?.userInfo;
- }
-
+ // Handle button state management in useEffect only to avoid race conditions
useEffect(() => {
const shareButton = document.getElementById('share-agent-button-topbar') as HTMLButtonElement;
if (shareButton) {
if (!authContext?.userInfo) {
shareButton.setAttribute('disabled', 'true');
+ console.warn('Share button disabled: User not authenticated');
} else {
shareButton.removeAttribute('disabled');
+ console.log('Share button enabled: User authenticated');
}
}
}, [authContext?.userInfo]);
- // Resolve WelcomeInvitePage from plugin registry (enterprise provides it)
- const welcomeInvitePlugins = plugins.getPluginsByTarget(
- 'WelcomeInvitePage',
+ // Resolve ShareAgentWithUsers component from plugin registry (enterprise provides it)
+ const shareAgentPlugins = plugins.getPluginsByTarget(
+ PluginTarget.ShareAgentWithUsers,
PluginType.Function,
);
- const createWelcomeInvitePage =
- (welcomeInvitePlugins[0] as any)?.type === PluginType.Function
- ? (welcomeInvitePlugins[0] as any).function
+ const createShareAgentModal =
+ (shareAgentPlugins[0] as any)?.type === PluginType.Function
+ ? (shareAgentPlugins[0] as any).function
: null;
return (
@@ -269,9 +267,9 @@ export function renderAgentModals({ rootID }: { rootID: string }): void {
<Spinner />
</div>
)}
- {appState?.isShareAgentModalOpen && createWelcomeInvitePage && (
+ {appState?.isShareAgentModalOpen && authContext?.userInfo && createShareAgentModal && (
<div className="fixed inset-0">
- {createWelcomeInvitePage({
+ {createShareAgentModal({
isShareAgent: true,
onClose: () => appState.toggleShareAgentModal(),
agentId: workspace.agent.id,
diff --git a/packages/app/src/react/shared/plugins/Plugins.ts b/packages/app/src/react/shared/plugins/Plugins.ts
index 978bd302..f462aeb1 100644
--- a/packages/app/src/react/shared/plugins/Plugins.ts
+++ b/packages/app/src/react/shared/plugins/Plugins.ts
@@ -11,6 +11,7 @@ export enum PluginTarget {
BuilderSidebarComponentItems = 'builder/sidebarComponentItems',
BuilderSREComponents = 'builder/sreComponents',
AgentsPageSection = 'agentsPage/section',
+ ShareAgentWithUsers = 'builder/modals/ShareAgentWithUsers',
}
export enum PluginType {