@decido/shell 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +13 -0
- package/package.json +65 -0
- package/src/AgentPlayer.tsx +105 -0
- package/src/DecidoPlayer.tsx +117 -0
- package/src/bridge/BridgeAgent.ts +443 -0
- package/src/components/DecidoIcon.tsx +56 -0
- package/src/components/JsonTreeEditor.tsx +117 -0
- package/src/components/PanelSplitter.tsx +71 -0
- package/src/components/PluginErrorBoundary.tsx +69 -0
- package/src/components/SafeLiquidUI.tsx +114 -0
- package/src/components/TransientLayer.tsx +92 -0
- package/src/components/agent/AgentChat.tsx +134 -0
- package/src/components/chat-extensions/IntentCatalogPanel.tsx +81 -0
- package/src/components/chat-extensions/chatSlashCommands.ts +101 -0
- package/src/components/controls/CreatorInputBar.tsx +144 -0
- package/src/components/controls/OSToolbar.tsx +90 -0
- package/src/components/controls/TimelineTape.tsx +43 -0
- package/src/components/debug/ActionTimelineTab.tsx +111 -0
- package/src/components/debug/CSSInspectorTab.tsx +436 -0
- package/src/components/debug/ExportTab.tsx +192 -0
- package/src/components/debug/FlowHealthTab.tsx +86 -0
- package/src/components/debug/LogsTab.tsx +110 -0
- package/src/components/debug/MorphStackTab.tsx +241 -0
- package/src/components/debug/NetworkTab.tsx +173 -0
- package/src/components/debug/PerformanceTab.tsx +171 -0
- package/src/components/debug/ProfilesTab.tsx +238 -0
- package/src/components/debug/ReplayTab.tsx +70 -0
- package/src/components/debug/StoresTab.tsx +255 -0
- package/src/components/debug/TopologyTab.tsx +59 -0
- package/src/components/debug/debugConfig.tsx +66 -0
- package/src/components/playground/DebugPanel.tsx +112 -0
- package/src/components/playground/HeaderCenterControls.tsx +92 -0
- package/src/components/playground/KeyframeListItem.tsx +70 -0
- package/src/components/playground/PlaygroundAppSidebar.tsx +171 -0
- package/src/components/playground/PlaygroundBottomControls.tsx +132 -0
- package/src/components/playground/PlaygroundCanvas.tsx +87 -0
- package/src/components/playground/PlaygroundChat.tsx +236 -0
- package/src/components/playground/PlaygroundErrorBoundary.tsx +63 -0
- package/src/components/playground/PlaygroundFloatingInput.tsx +352 -0
- package/src/components/playground/PlaygroundHeader.tsx +222 -0
- package/src/components/playground/PlaygroundSidebar.tsx +136 -0
- package/src/components/playground/PlaygroundTerminal.tsx +44 -0
- package/src/components/playground/SuggestionCards.tsx +29 -0
- package/src/components/playground/demos/ClinicaAINode.tsx +221 -0
- package/src/components/playground/demos/FinanceAINode.tsx +226 -0
- package/src/components/playground/demos/KiaAcademyNode.tsx +250 -0
- package/src/components/playground/demos/KiaBotNode.tsx +207 -0
- package/src/components/playground/demos/KiaCampaignNode.tsx +191 -0
- package/src/components/playground/demos/KiaComplianceNode.tsx +140 -0
- package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +220 -0
- package/src/components/playground/demos/KiaCyberNode.tsx +203 -0
- package/src/components/playground/demos/KiaDashboardNode.tsx +399 -0
- package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +168 -0
- package/src/components/playground/demos/KiaExecutiveNode.tsx +169 -0
- package/src/components/playground/demos/KiaGamificationNode.tsx +229 -0
- package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +165 -0
- package/src/components/playground/demos/KiaInventoryNode.tsx +183 -0
- package/src/components/playground/demos/KiaLeadScoringNode.tsx +226 -0
- package/src/components/playground/demos/KiaLiveSimulationNode.tsx +177 -0
- package/src/components/playground/demos/KiaMultiDealerNode.tsx +223 -0
- package/src/components/playground/demos/KiaNPSVoiceNode.tsx +214 -0
- package/src/components/playground/demos/KiaOmnichannelNode.tsx +162 -0
- package/src/components/playground/demos/KiaPBIBudgetNode.tsx +152 -0
- package/src/components/playground/demos/KiaPBIConversionNode.tsx +206 -0
- package/src/components/playground/demos/KiaPBIFunnelNode.tsx +184 -0
- package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +113 -0
- package/src/components/playground/demos/KiaPBIPartnerNode.tsx +143 -0
- package/src/components/playground/demos/KiaPBIPreciosNode.tsx +120 -0
- package/src/components/playground/demos/KiaPBIRuntNode.tsx +205 -0
- package/src/components/playground/demos/KiaPartnerScoreNode.tsx +206 -0
- package/src/components/playground/demos/KiaPredictiveNode.tsx +226 -0
- package/src/components/playground/demos/KiaShowroomNode.tsx +194 -0
- package/src/components/playground/demos/KiaStoreNode.tsx +215 -0
- package/src/components/playground/demos/KiaSustainabilityNode.tsx +173 -0
- package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +163 -0
- package/src/components/playground/demos/KiaWorkshopNode.tsx +221 -0
- package/src/components/playground/demos/SmartCityNode.tsx +205 -0
- package/src/components/playground/demos/kia_campaign_manifest.json +112 -0
- package/src/components/playground/input-parts/AIModelSelector.tsx +156 -0
- package/src/components/playground/input-parts/InputActions.tsx +80 -0
- package/src/components/playground/input-parts/InputToolbar.tsx +245 -0
- package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +287 -0
- package/src/components/playground/sidebarDsdIO.ts +82 -0
- package/src/components/settings/SettingsPanel.tsx +267 -0
- package/src/components/shell/AppHeader.tsx +9 -0
- package/src/components/shell/AppShell.tsx +139 -0
- package/src/components/shell/ArtifactBar.tsx +97 -0
- package/src/components/shell/BootScreen.tsx +19 -0
- package/src/components/shell/CenterComposite.tsx +87 -0
- package/src/components/shell/CodeEditorPanel.tsx +88 -0
- package/src/components/shell/GlobalOverlays.tsx +228 -0
- package/src/components/shell/LayoutConfigurator.tsx +209 -0
- package/src/components/shell/LayoutGrid.tsx +178 -0
- package/src/components/shell/MorphShell.tsx +368 -0
- package/src/components/shell/PluginViewer.tsx +147 -0
- package/src/components/shell/ShellNexusPreview.tsx +458 -0
- package/src/components/shell/SlotRenderer.tsx +115 -0
- package/src/components/shell/TabBar.tsx +94 -0
- package/src/components/shell/TemplateLibrary.tsx +195 -0
- package/src/components/shell/layoutConstants.ts +35 -0
- package/src/components/shell/morphStageMeta.ts +15 -0
- package/src/components/shell/shells/BuiltInShells.tsx +443 -0
- package/src/components/shell/shells/DatawayChatShell.tsx +42 -0
- package/src/components/shell/shells/TokenPreview.tsx +339 -0
- package/src/components/shell/shells/bootShells.ts +31 -0
- package/src/components/shells/CreatorShell.tsx +37 -0
- package/src/components/shells/DecidoShell.tsx +447 -0
- package/src/components/shells/ExperimentalChatShell.tsx +245 -0
- package/src/components/shells/UserCanvas.tsx +44 -0
- package/src/components/studio/BlueprintManagerPanel.tsx +137 -0
- package/src/components/studio/DependencyTreePanel.tsx +192 -0
- package/src/components/studio/NodePalette.tsx +92 -0
- package/src/components/studio/NodePropertiesPanel.tsx +81 -0
- package/src/components/studio/ReactFlowEditor.tsx +242 -0
- package/src/components/studio/TimelineEditor.tsx +122 -0
- package/src/components/studio/TimelineKeyframeCard.tsx +99 -0
- package/src/components/studio/VariablePanel.tsx +181 -0
- package/src/components/studio/blueprint/BlueprintCard.tsx +82 -0
- package/src/components/studio/editor/CanvasContextMenu.tsx +107 -0
- package/src/components/studio/editor/EditorToolbar.tsx +80 -0
- package/src/components/studio/editor/StageContentRenderer.tsx +134 -0
- package/src/components/studio/editor/TrackPropertyEditors.tsx +133 -0
- package/src/components/studio/editor/TreeNodeItem.tsx +91 -0
- package/src/components/studio/editor/edgeStyles.ts +43 -0
- package/src/components/studio/editor/editorKeyHandler.ts +95 -0
- package/src/components/studio/editor/nodeTypeRegistry.ts +137 -0
- package/src/components/studio/editor/paletteCatalog.tsx +84 -0
- package/src/components/studio/nodes/shell/InteractionNodes.tsx +82 -0
- package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +69 -0
- package/src/components/studio/nodes/shell/RegisterActionNode.tsx +20 -0
- package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +22 -0
- package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +19 -0
- package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +19 -0
- package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +22 -0
- package/src/components/studio/nodes/shell/RegisterTabNode.tsx +21 -0
- package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +22 -0
- package/src/components/studio/nodes/shell/ShellConfigNode.tsx +51 -0
- package/src/components/studio/nodes/shell/ShellNodeBase.tsx +100 -0
- package/src/components/studio/nodes/shell/ThemeNodes.tsx +51 -0
- package/src/components/studio/nodes/shell/index.ts +12 -0
- package/src/components/widgets/BroadcastWidget.tsx +93 -0
- package/src/components/widgets/MarketplaceWidget.tsx +298 -0
- package/src/components/widgets/McpToolsWidget.tsx +231 -0
- package/src/components/widgets/OpsDashboard.tsx +59 -0
- package/src/components/widgets/QuickActionsWidget.tsx +60 -0
- package/src/components/widgets/UsageWidget.tsx +112 -0
- package/src/components/widgets/WidgetRenderer.tsx +892 -0
- package/src/components/widgets/WidgetSlotPanel.tsx +213 -0
- package/src/config/IconRegistry.ts +126 -0
- package/src/contexts/NetworkProvider.tsx +162 -0
- package/src/core/AIDirector.ts +71 -0
- package/src/core/EventBus.ts +37 -0
- package/src/core/PluginContext.tsx +141 -0
- package/src/hooks/listeners/useUIStateListener.ts +59 -0
- package/src/hooks/listeners/useWhatsAppListener.ts +110 -0
- package/src/hooks/morphBridge.ts +82 -0
- package/src/hooks/useAIModelSelector.ts +144 -0
- package/src/hooks/useAgentStream.ts +220 -0
- package/src/hooks/useAutoUpdater.ts +89 -0
- package/src/hooks/useBootSequence.ts +20 -0
- package/src/hooks/useExportDSD.ts +53 -0
- package/src/hooks/useFullscreen.ts +35 -0
- package/src/hooks/useGeminiStream.ts +282 -0
- package/src/hooks/useIntentLens.ts +224 -0
- package/src/hooks/useKeyboardShortcuts.ts +69 -0
- package/src/hooks/useLoggerBridge.ts +32 -0
- package/src/hooks/useMcpClient.ts +112 -0
- package/src/hooks/useNexusaiDeploy.ts +118 -0
- package/src/hooks/usePlaybackEngine.ts +21 -0
- package/src/hooks/usePlaygroundCommander.ts +475 -0
- package/src/hooks/usePluginEngine.ts +165 -0
- package/src/hooks/useScreenRecorder.ts +73 -0
- package/src/hooks/useShellKeyboard.ts +40 -0
- package/src/hooks/useShellShortcuts.ts +118 -0
- package/src/hooks/useSoundEffects.ts +35 -0
- package/src/hooks/useStudioConfig.ts +72 -0
- package/src/hooks/useSystemBoot.ts +84 -0
- package/src/hooks/useSystemTelemetry.ts +62 -0
- package/src/index.ts +97 -0
- package/src/lib/debugLogger.ts +80 -0
- package/src/lib/networkInterceptor.ts +100 -0
- package/src/mocks/decido.tsx +41 -0
- package/src/plugins/pluginAPI.ts +190 -0
- package/src/store/McpStore.ts +69 -0
- package/src/store/UpdaterStore.ts +60 -0
- package/src/store/engine.ts +392 -0
- package/src/store/index.ts +4 -0
- package/src/store/layoutPresets.ts +66 -0
- package/src/store/playgroundTypes.ts +98 -0
- package/src/store/useActionTimelineStore.ts +48 -0
- package/src/store/useDebugPanelStore.ts +98 -0
- package/src/store/useDebugProfileStore.ts +130 -0
- package/src/store/useLayoutStore.ts +205 -0
- package/src/store/useMorphInstanceStore.ts +289 -0
- package/src/store/useMorphologyStore.ts +103 -0
- package/src/store/usePlaygroundStore.ts +236 -0
- package/src/store/useShellRegistry.ts +123 -0
- package/src/store/useSuggestionsStore.ts +57 -0
- package/src/store/useThemeStore.ts +399 -0
- package/src/store/useUIComponentStore.ts +179 -0
- package/src/types/DecidoStoryDefinition.ts +43 -0
- package/src/utils/ai/ai-architect.ts +92 -0
- package/src/utils/ai/ai-code.ts +187 -0
- package/src/utils/ai/ai-core.ts +50 -0
- package/src/utils/ai/ai-media.ts +292 -0
- package/src/utils/layoutGraph.ts +67 -0
- package/tsconfig.json +17 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
Debugger listening on ws://127.0.0.1:49814/b16f304e-fd53-46c9-b073-7a75b1b9a411
|
|
3
|
+
For help, see: https://nodejs.org/en/docs/inspector
|
|
4
|
+
Debugger attached.
|
|
5
|
+
|
|
6
|
+
> @decido/shell@1.0.0 build /Users/julioramirez/dev/active/OnBoardingDecido/packages/shell
|
|
7
|
+
> tsc
|
|
8
|
+
|
|
9
|
+
Debugger listening on ws://127.0.0.1:49820/ba1bb555-8ad1-42ff-8292-b704d6166a48
|
|
10
|
+
For help, see: https://nodejs.org/en/docs/inspector
|
|
11
|
+
Debugger attached.
|
|
12
|
+
Waiting for the debugger to disconnect...
|
|
13
|
+
Waiting for the debugger to disconnect...
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@decido/shell",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Decido OS Shell — Main facade: UI composition, morphology, auth, overlays, adapters",
|
|
5
|
+
"main": "./src/index.ts",
|
|
6
|
+
"types": "./src/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.ts"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@noble/curves": "^2.0.1",
|
|
12
|
+
"@tauri-apps/api": "^2.0.0-rc.0",
|
|
13
|
+
"@tauri-apps/plugin-notification": "^2.2.1",
|
|
14
|
+
"@tauri-apps/plugin-os": "^2.3.2",
|
|
15
|
+
"@tauri-apps/plugin-process": "^2.3.1",
|
|
16
|
+
"@tauri-apps/plugin-updater": "^2.10.0",
|
|
17
|
+
"clsx": "^2.1.1",
|
|
18
|
+
"framer-motion": "^12.4.3",
|
|
19
|
+
"idb-keyval": "^6.2.1",
|
|
20
|
+
"lucide-react": "^0.370.0",
|
|
21
|
+
"motion": "^11.16.1",
|
|
22
|
+
"react": "^18.3.1",
|
|
23
|
+
"react-dom": "^18.3.1",
|
|
24
|
+
"react-resizable-panels": "^4.7.2",
|
|
25
|
+
"recharts": "^3.7.0",
|
|
26
|
+
"socket.io-client": "^4.8.3",
|
|
27
|
+
"tailwind-merge": "^3.5.0",
|
|
28
|
+
"y-websocket": "^1.5.4",
|
|
29
|
+
"yjs": "^13.6.29",
|
|
30
|
+
"zustand": "^4.5.2",
|
|
31
|
+
"@decido/canvas-core": "0.1.0",
|
|
32
|
+
"@decido/core": "0.1.0",
|
|
33
|
+
"@decido/kernel-bridge": "1.0.0",
|
|
34
|
+
"@decido/logger": "^1.0.0",
|
|
35
|
+
"@decido/sdk": "1.0.0",
|
|
36
|
+
"@decido/macia-core": "0.1.0",
|
|
37
|
+
"@decido/sentinel-browser": "0.2.0",
|
|
38
|
+
"@decido/shell-auth": "1.0.0",
|
|
39
|
+
"@decido/shell-telemetry": "1.0.0",
|
|
40
|
+
"@decido/plugin-engine": "1.0.0",
|
|
41
|
+
"@decido/chat": "1.0.0",
|
|
42
|
+
"@decido/commands": "1.0.0",
|
|
43
|
+
"@decido/engine": "0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/react": "^18.2.0",
|
|
47
|
+
"@types/react-dom": "^18.2.0",
|
|
48
|
+
"@types/socket.io-client": "^3.0.0",
|
|
49
|
+
"@types/three": "^0.183.1",
|
|
50
|
+
"tailwindcss": "^4.2.1",
|
|
51
|
+
"typescript": "^5.0.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"react": "^18.2.0",
|
|
55
|
+
"react-dom": "^18.2.0"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"license": "UNLICENSED",
|
|
61
|
+
"scripts": {
|
|
62
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
63
|
+
"build": "tsup src/index.ts --format esm --dts --minify --clean"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Panel, Group as PanelGroup } from 'react-resizable-panels';
|
|
3
|
+
import { AgentChat, AgentMessage } from './components/agent/AgentChat';
|
|
4
|
+
import { NetworkProvider } from './contexts/NetworkProvider';
|
|
5
|
+
|
|
6
|
+
export default function AgentPlayer({ socketInstance }: { socketInstance?: any }) {
|
|
7
|
+
const [messages, setMessages] = useState<AgentMessage[]>([]);
|
|
8
|
+
const [isGenerating, setIsGenerating] = useState(false);
|
|
9
|
+
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (!socketInstance) return;
|
|
12
|
+
|
|
13
|
+
const handleOrchestratorEvent = (event: any) => {
|
|
14
|
+
console.log('[AgentPlayer] Recibido orchestrator-event:', event);
|
|
15
|
+
|
|
16
|
+
// Filtramos eventos relevantes del stream del agente o arenas
|
|
17
|
+
if (event.event_type === 'AgentStreamEvent' && event.data) {
|
|
18
|
+
const streamData = event.data;
|
|
19
|
+
const agentId = event.agent_id || 'decido-agent';
|
|
20
|
+
|
|
21
|
+
setMessages(prev => {
|
|
22
|
+
// Buscar si ya hay un mensaje en curso para este agente (el último)
|
|
23
|
+
const lastMsg = prev[prev.length - 1];
|
|
24
|
+
const isSameAgent = lastMsg && lastMsg.role === 'agent' && lastMsg.id === agentId;
|
|
25
|
+
|
|
26
|
+
let newToolCalls = isSameAgent ? [...(lastMsg.toolCalls || [])] : [];
|
|
27
|
+
let newText = isSameAgent ? lastMsg.text : '';
|
|
28
|
+
|
|
29
|
+
if (streamData.type === 'Think') {
|
|
30
|
+
// El chunk de pensamiento se concatena al texto
|
|
31
|
+
newText += streamData.content;
|
|
32
|
+
} else if (streamData.type === 'ToolCall') {
|
|
33
|
+
// Se mandó a ejecutar una tool
|
|
34
|
+
newToolCalls.push({
|
|
35
|
+
name: streamData.tool_name || 'unknown_tool',
|
|
36
|
+
args: streamData.tool_args || {},
|
|
37
|
+
status: 'running'
|
|
38
|
+
});
|
|
39
|
+
} else if (streamData.type === 'ToolResult') {
|
|
40
|
+
// El resultado de una tool altera el status de la última tool agregada
|
|
41
|
+
if (newToolCalls.length > 0) {
|
|
42
|
+
newToolCalls[newToolCalls.length - 1].status = 'success';
|
|
43
|
+
newToolCalls[newToolCalls.length - 1].output = streamData.content;
|
|
44
|
+
}
|
|
45
|
+
} else if (streamData.type === 'Message') {
|
|
46
|
+
newText += streamData.content;
|
|
47
|
+
setIsGenerating(false);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (isSameAgent) {
|
|
51
|
+
const updated = [...prev];
|
|
52
|
+
updated[updated.length - 1] = { ...lastMsg, text: newText, toolCalls: newToolCalls };
|
|
53
|
+
return updated;
|
|
54
|
+
} else {
|
|
55
|
+
return [...prev, { id: agentId, role: 'agent', text: newText, toolCalls: newToolCalls }];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
} else if (event.event_type === 'SpawnAgentRequest') {
|
|
59
|
+
setIsGenerating(true);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
socketInstance.on('orchestrator-event', handleOrchestratorEvent);
|
|
64
|
+
return () => {
|
|
65
|
+
socketInstance.off('orchestrator-event', handleOrchestratorEvent);
|
|
66
|
+
};
|
|
67
|
+
}, [socketInstance]);
|
|
68
|
+
|
|
69
|
+
const handleSendMessage = (text: string) => {
|
|
70
|
+
if (!text.trim() || !socketInstance) return;
|
|
71
|
+
|
|
72
|
+
const newUserMsg: AgentMessage = { id: Date.now().toString(), role: 'user', text };
|
|
73
|
+
setMessages(prev => [...prev, newUserMsg]);
|
|
74
|
+
setIsGenerating(true);
|
|
75
|
+
|
|
76
|
+
socketInstance.emit('rpc_call', {
|
|
77
|
+
cmd: 'send_message',
|
|
78
|
+
args: {
|
|
79
|
+
from: 'AgentPlayerUI',
|
|
80
|
+
to: 'dev-master',
|
|
81
|
+
intent: 'chat_request',
|
|
82
|
+
payload: text,
|
|
83
|
+
priority: 'High'
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<NetworkProvider socketInstance={socketInstance} isConnected={!!socketInstance?.connected}>
|
|
90
|
+
<div className="bg-surface-primary flex font-sans relative overflow-hidden text-text-primary rounded-xl border border-border-default shadow-lg w-full h-[800px]">
|
|
91
|
+
<PanelGroup orientation="horizontal" className="flex-1 w-full h-full relative z-20">
|
|
92
|
+
<Panel id="agent-chat" defaultSize={100} minSize={30} className="flex flex-col relative h-full bg-surface-primary">
|
|
93
|
+
<div className="flex-1 w-full relative z-20 overflow-hidden flex flex-col pt-4">
|
|
94
|
+
<AgentChat
|
|
95
|
+
messages={messages}
|
|
96
|
+
onSendMessage={handleSendMessage}
|
|
97
|
+
isGenerating={isGenerating}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
</Panel>
|
|
101
|
+
</PanelGroup>
|
|
102
|
+
</div>
|
|
103
|
+
</NetworkProvider>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { useEffect, useState, useMemo } from 'react';
|
|
2
|
+
import { Panel, Group as PanelGroup, Separator as PanelResizeHandle } from 'react-resizable-panels';
|
|
3
|
+
import { usePlaygroundStore } from './store/usePlaygroundStore';
|
|
4
|
+
import { useEngineStore } from '@decido/engine';
|
|
5
|
+
import { useTimelineStore } from '@decido/engine';
|
|
6
|
+
import { useUIStateListener } from './hooks/listeners/useUIStateListener';
|
|
7
|
+
import { usePlaybackSimulator } from '@decido/engine';
|
|
8
|
+
import { PlaygroundChat } from './components/playground/PlaygroundChat';
|
|
9
|
+
import { PlaygroundCanvas } from './components/playground/PlaygroundCanvas';
|
|
10
|
+
import { PlaygroundErrorBoundary } from './components/playground/PlaygroundErrorBoundary';
|
|
11
|
+
import { NetworkProvider } from './contexts/NetworkProvider';
|
|
12
|
+
import { DecidoStudioProps } from '@decido/engine';
|
|
13
|
+
import { SimulationTape } from '@decido/engine';
|
|
14
|
+
import { useRef } from 'react';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* DecidoPlayer Embebido
|
|
18
|
+
* Phase H: Runtime completo — auto-inicia flujos, ejecuta render nodes con formularios,
|
|
19
|
+
* y soporta toda la lógica del motor (condicionales, triggers, subflows).
|
|
20
|
+
*/
|
|
21
|
+
export default function DecidoPlayer({ aiProvider, VoiceWidget, config, socketInstance, width = '100%', height = '100%' }: DecidoStudioProps & { width?: string, height?: string }) {
|
|
22
|
+
|
|
23
|
+
// Core state
|
|
24
|
+
const { step, selectedProfile, isBooting, prototypeBrand, setInputValue } = usePlaygroundStore();
|
|
25
|
+
const { resetEngine } = useEngineStore();
|
|
26
|
+
const setActiveTimeline = useTimelineStore(state => state.setActiveTimeline);
|
|
27
|
+
|
|
28
|
+
// Listen to UI state nodes emitting in the timeline
|
|
29
|
+
const { demoState, showCanvas, setShowCanvas } = useUIStateListener();
|
|
30
|
+
const dragConstraintsRef = useRef<HTMLDivElement>(null);
|
|
31
|
+
|
|
32
|
+
// Auto-start: mock tape dispatches SYSTEM_START at t=0.1s
|
|
33
|
+
const mockTape: SimulationTape = useMemo(() => ({
|
|
34
|
+
id: `tape-${prototypeBrand}`,
|
|
35
|
+
events: [
|
|
36
|
+
{ t: 0.1, event: { type: 'SYSTEM_START' }, description: "Arranque Automático (Player)" }
|
|
37
|
+
]
|
|
38
|
+
}), [prototypeBrand]);
|
|
39
|
+
|
|
40
|
+
const { isPlaying, setIsPlaying, resetSimulation } = usePlaybackSimulator(mockTape);
|
|
41
|
+
|
|
42
|
+
// Sync active timeline + auto-start on brand change
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setActiveTimeline(prototypeBrand);
|
|
45
|
+
resetEngine();
|
|
46
|
+
resetSimulation();
|
|
47
|
+
// Small delay to let store settle before starting playback
|
|
48
|
+
const timer = setTimeout(() => setIsPlaying(true), 100);
|
|
49
|
+
return () => clearTimeout(timer);
|
|
50
|
+
}, [prototypeBrand]);
|
|
51
|
+
|
|
52
|
+
const safeConfig = config || { environments: {}, voices: [] };
|
|
53
|
+
const activeConfig = (safeConfig.environments as Record<string, any>)[prototypeBrand] ||
|
|
54
|
+
Object.values(safeConfig.environments)[0] || {};
|
|
55
|
+
|
|
56
|
+
const [suggestions, setSuggestions] = useState<any[]>([]);
|
|
57
|
+
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setSuggestions(prev => {
|
|
60
|
+
const next = activeConfig.suggestions || [];
|
|
61
|
+
if (JSON.stringify(prev) === JSON.stringify(next)) return prev;
|
|
62
|
+
return next;
|
|
63
|
+
});
|
|
64
|
+
}, [activeConfig.suggestions]);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<NetworkProvider socketInstance={socketInstance} isConnected={!!socketInstance?.connected}>
|
|
68
|
+
<div style={{ width, height }} className="bg-surface-primary flex font-sans relative overflow-hidden text-text-primary rounded-xl border border-border-default shadow-lg">
|
|
69
|
+
<PanelGroup orientation="horizontal" className="flex-1 w-full h-full relative z-20">
|
|
70
|
+
|
|
71
|
+
{/* LEFT CHAT PANEL */}
|
|
72
|
+
<Panel id="player-chat" defaultSize={showCanvas ? 60 : 100} minSize={30} className="flex flex-col relative h-full bg-surface-primary">
|
|
73
|
+
<div className="flex-1 w-full relative z-20 overflow-hidden flex flex-col">
|
|
74
|
+
<PlaygroundErrorBoundary fallbackName="Motor de Chat (Player)">
|
|
75
|
+
<PlaygroundChat
|
|
76
|
+
step={step}
|
|
77
|
+
selectedProfile={selectedProfile}
|
|
78
|
+
authAvailableLicenses={[]}
|
|
79
|
+
handleProfileSelect={() => {}}
|
|
80
|
+
activeConfig={activeConfig}
|
|
81
|
+
demoState={demoState}
|
|
82
|
+
suggestions={suggestions}
|
|
83
|
+
setInputValue={setInputValue}
|
|
84
|
+
isGenerating={false}
|
|
85
|
+
config={safeConfig}
|
|
86
|
+
isCreatorMode={false}
|
|
87
|
+
handleGeneratePlayground={async () => {}}
|
|
88
|
+
/>
|
|
89
|
+
</PlaygroundErrorBoundary>
|
|
90
|
+
</div>
|
|
91
|
+
</Panel>
|
|
92
|
+
|
|
93
|
+
{/* RIGHT CANVAS PANEL */}
|
|
94
|
+
{showCanvas && (
|
|
95
|
+
<>
|
|
96
|
+
<PanelResizeHandle className="w-1.5 hover:bg-cyan-500/20 active:bg-cyan-500/30 transition-colors cursor-col-resize z-40 relative group flex items-center justify-center border-l-2 border-border-subtle">
|
|
97
|
+
</PanelResizeHandle>
|
|
98
|
+
<Panel id="player-canvas" defaultSize={40} minSize={20} className="bg-surface-secondary h-full relative z-30 overflow-hidden">
|
|
99
|
+
<PlaygroundErrorBoundary fallbackName="Lienzo 3D (Player)">
|
|
100
|
+
<PlaygroundCanvas
|
|
101
|
+
showCanvas={showCanvas}
|
|
102
|
+
setShowCanvas={setShowCanvas}
|
|
103
|
+
activeConfig={activeConfig}
|
|
104
|
+
prototypeBrand={prototypeBrand}
|
|
105
|
+
activeState={demoState}
|
|
106
|
+
chartData={[]}
|
|
107
|
+
dragConstraintsRef={dragConstraintsRef}
|
|
108
|
+
/>
|
|
109
|
+
</PlaygroundErrorBoundary>
|
|
110
|
+
</Panel>
|
|
111
|
+
</>
|
|
112
|
+
)}
|
|
113
|
+
</PanelGroup>
|
|
114
|
+
</div>
|
|
115
|
+
</NetworkProvider>
|
|
116
|
+
);
|
|
117
|
+
}
|