@decido/shell 1.0.0 → 4.0.1
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/README.md +31 -0
- package/package.json +17 -14
- package/.turbo/turbo-build.log +0 -13
- package/src/AgentPlayer.tsx +0 -105
- package/src/DecidoPlayer.tsx +0 -117
- package/src/bridge/BridgeAgent.ts +0 -443
- package/src/components/DecidoIcon.tsx +0 -56
- package/src/components/JsonTreeEditor.tsx +0 -117
- package/src/components/PanelSplitter.tsx +0 -71
- package/src/components/PluginErrorBoundary.tsx +0 -69
- package/src/components/SafeLiquidUI.tsx +0 -114
- package/src/components/TransientLayer.tsx +0 -92
- package/src/components/agent/AgentChat.tsx +0 -134
- package/src/components/chat-extensions/IntentCatalogPanel.tsx +0 -81
- package/src/components/chat-extensions/chatSlashCommands.ts +0 -101
- package/src/components/controls/CreatorInputBar.tsx +0 -144
- package/src/components/controls/OSToolbar.tsx +0 -90
- package/src/components/controls/TimelineTape.tsx +0 -43
- package/src/components/debug/ActionTimelineTab.tsx +0 -111
- package/src/components/debug/CSSInspectorTab.tsx +0 -436
- package/src/components/debug/ExportTab.tsx +0 -192
- package/src/components/debug/FlowHealthTab.tsx +0 -86
- package/src/components/debug/LogsTab.tsx +0 -110
- package/src/components/debug/MorphStackTab.tsx +0 -241
- package/src/components/debug/NetworkTab.tsx +0 -173
- package/src/components/debug/PerformanceTab.tsx +0 -171
- package/src/components/debug/ProfilesTab.tsx +0 -238
- package/src/components/debug/ReplayTab.tsx +0 -70
- package/src/components/debug/StoresTab.tsx +0 -255
- package/src/components/debug/TopologyTab.tsx +0 -59
- package/src/components/debug/debugConfig.tsx +0 -66
- package/src/components/playground/DebugPanel.tsx +0 -112
- package/src/components/playground/HeaderCenterControls.tsx +0 -92
- package/src/components/playground/KeyframeListItem.tsx +0 -70
- package/src/components/playground/PlaygroundAppSidebar.tsx +0 -171
- package/src/components/playground/PlaygroundBottomControls.tsx +0 -132
- package/src/components/playground/PlaygroundCanvas.tsx +0 -87
- package/src/components/playground/PlaygroundChat.tsx +0 -236
- package/src/components/playground/PlaygroundErrorBoundary.tsx +0 -63
- package/src/components/playground/PlaygroundFloatingInput.tsx +0 -352
- package/src/components/playground/PlaygroundHeader.tsx +0 -222
- package/src/components/playground/PlaygroundSidebar.tsx +0 -136
- package/src/components/playground/PlaygroundTerminal.tsx +0 -44
- package/src/components/playground/SuggestionCards.tsx +0 -29
- package/src/components/playground/demos/ClinicaAINode.tsx +0 -221
- package/src/components/playground/demos/FinanceAINode.tsx +0 -226
- package/src/components/playground/demos/KiaAcademyNode.tsx +0 -250
- package/src/components/playground/demos/KiaBotNode.tsx +0 -207
- package/src/components/playground/demos/KiaCampaignNode.tsx +0 -191
- package/src/components/playground/demos/KiaComplianceNode.tsx +0 -140
- package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +0 -220
- package/src/components/playground/demos/KiaCyberNode.tsx +0 -203
- package/src/components/playground/demos/KiaDashboardNode.tsx +0 -399
- package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +0 -168
- package/src/components/playground/demos/KiaExecutiveNode.tsx +0 -169
- package/src/components/playground/demos/KiaGamificationNode.tsx +0 -229
- package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +0 -165
- package/src/components/playground/demos/KiaInventoryNode.tsx +0 -183
- package/src/components/playground/demos/KiaLeadScoringNode.tsx +0 -226
- package/src/components/playground/demos/KiaLiveSimulationNode.tsx +0 -177
- package/src/components/playground/demos/KiaMultiDealerNode.tsx +0 -223
- package/src/components/playground/demos/KiaNPSVoiceNode.tsx +0 -214
- package/src/components/playground/demos/KiaOmnichannelNode.tsx +0 -162
- package/src/components/playground/demos/KiaPBIBudgetNode.tsx +0 -152
- package/src/components/playground/demos/KiaPBIConversionNode.tsx +0 -206
- package/src/components/playground/demos/KiaPBIFunnelNode.tsx +0 -184
- package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +0 -113
- package/src/components/playground/demos/KiaPBIPartnerNode.tsx +0 -143
- package/src/components/playground/demos/KiaPBIPreciosNode.tsx +0 -120
- package/src/components/playground/demos/KiaPBIRuntNode.tsx +0 -205
- package/src/components/playground/demos/KiaPartnerScoreNode.tsx +0 -206
- package/src/components/playground/demos/KiaPredictiveNode.tsx +0 -226
- package/src/components/playground/demos/KiaShowroomNode.tsx +0 -194
- package/src/components/playground/demos/KiaStoreNode.tsx +0 -215
- package/src/components/playground/demos/KiaSustainabilityNode.tsx +0 -173
- package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +0 -163
- package/src/components/playground/demos/KiaWorkshopNode.tsx +0 -221
- package/src/components/playground/demos/SmartCityNode.tsx +0 -205
- package/src/components/playground/demos/kia_campaign_manifest.json +0 -112
- package/src/components/playground/input-parts/AIModelSelector.tsx +0 -156
- package/src/components/playground/input-parts/InputActions.tsx +0 -80
- package/src/components/playground/input-parts/InputToolbar.tsx +0 -245
- package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +0 -287
- package/src/components/playground/sidebarDsdIO.ts +0 -82
- package/src/components/settings/SettingsPanel.tsx +0 -267
- package/src/components/shell/AppHeader.tsx +0 -9
- package/src/components/shell/AppShell.tsx +0 -139
- package/src/components/shell/ArtifactBar.tsx +0 -97
- package/src/components/shell/BootScreen.tsx +0 -19
- package/src/components/shell/CenterComposite.tsx +0 -87
- package/src/components/shell/CodeEditorPanel.tsx +0 -88
- package/src/components/shell/GlobalOverlays.tsx +0 -228
- package/src/components/shell/LayoutConfigurator.tsx +0 -209
- package/src/components/shell/LayoutGrid.tsx +0 -178
- package/src/components/shell/MorphShell.tsx +0 -368
- package/src/components/shell/PluginViewer.tsx +0 -147
- package/src/components/shell/ShellNexusPreview.tsx +0 -458
- package/src/components/shell/SlotRenderer.tsx +0 -115
- package/src/components/shell/TabBar.tsx +0 -94
- package/src/components/shell/TemplateLibrary.tsx +0 -195
- package/src/components/shell/layoutConstants.ts +0 -35
- package/src/components/shell/morphStageMeta.ts +0 -15
- package/src/components/shell/shells/BuiltInShells.tsx +0 -443
- package/src/components/shell/shells/DatawayChatShell.tsx +0 -42
- package/src/components/shell/shells/TokenPreview.tsx +0 -339
- package/src/components/shell/shells/bootShells.ts +0 -31
- package/src/components/shells/CreatorShell.tsx +0 -37
- package/src/components/shells/DecidoShell.tsx +0 -447
- package/src/components/shells/ExperimentalChatShell.tsx +0 -245
- package/src/components/shells/UserCanvas.tsx +0 -44
- package/src/components/studio/BlueprintManagerPanel.tsx +0 -137
- package/src/components/studio/DependencyTreePanel.tsx +0 -192
- package/src/components/studio/NodePalette.tsx +0 -92
- package/src/components/studio/NodePropertiesPanel.tsx +0 -81
- package/src/components/studio/ReactFlowEditor.tsx +0 -242
- package/src/components/studio/TimelineEditor.tsx +0 -122
- package/src/components/studio/TimelineKeyframeCard.tsx +0 -99
- package/src/components/studio/VariablePanel.tsx +0 -181
- package/src/components/studio/blueprint/BlueprintCard.tsx +0 -82
- package/src/components/studio/editor/CanvasContextMenu.tsx +0 -107
- package/src/components/studio/editor/EditorToolbar.tsx +0 -80
- package/src/components/studio/editor/StageContentRenderer.tsx +0 -134
- package/src/components/studio/editor/TrackPropertyEditors.tsx +0 -133
- package/src/components/studio/editor/TreeNodeItem.tsx +0 -91
- package/src/components/studio/editor/edgeStyles.ts +0 -43
- package/src/components/studio/editor/editorKeyHandler.ts +0 -95
- package/src/components/studio/editor/nodeTypeRegistry.ts +0 -137
- package/src/components/studio/editor/paletteCatalog.tsx +0 -84
- package/src/components/studio/nodes/shell/InteractionNodes.tsx +0 -82
- package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +0 -69
- package/src/components/studio/nodes/shell/RegisterActionNode.tsx +0 -20
- package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +0 -22
- package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +0 -19
- package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +0 -19
- package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +0 -22
- package/src/components/studio/nodes/shell/RegisterTabNode.tsx +0 -21
- package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +0 -22
- package/src/components/studio/nodes/shell/ShellConfigNode.tsx +0 -51
- package/src/components/studio/nodes/shell/ShellNodeBase.tsx +0 -100
- package/src/components/studio/nodes/shell/ThemeNodes.tsx +0 -51
- package/src/components/studio/nodes/shell/index.ts +0 -12
- package/src/components/widgets/BroadcastWidget.tsx +0 -93
- package/src/components/widgets/MarketplaceWidget.tsx +0 -298
- package/src/components/widgets/McpToolsWidget.tsx +0 -231
- package/src/components/widgets/OpsDashboard.tsx +0 -59
- package/src/components/widgets/QuickActionsWidget.tsx +0 -60
- package/src/components/widgets/UsageWidget.tsx +0 -112
- package/src/components/widgets/WidgetRenderer.tsx +0 -892
- package/src/components/widgets/WidgetSlotPanel.tsx +0 -213
- package/src/config/IconRegistry.ts +0 -126
- package/src/contexts/NetworkProvider.tsx +0 -162
- package/src/core/AIDirector.ts +0 -71
- package/src/core/EventBus.ts +0 -37
- package/src/core/PluginContext.tsx +0 -141
- package/src/hooks/listeners/useUIStateListener.ts +0 -59
- package/src/hooks/listeners/useWhatsAppListener.ts +0 -110
- package/src/hooks/morphBridge.ts +0 -82
- package/src/hooks/useAIModelSelector.ts +0 -144
- package/src/hooks/useAgentStream.ts +0 -220
- package/src/hooks/useAutoUpdater.ts +0 -89
- package/src/hooks/useBootSequence.ts +0 -20
- package/src/hooks/useExportDSD.ts +0 -53
- package/src/hooks/useFullscreen.ts +0 -35
- package/src/hooks/useGeminiStream.ts +0 -282
- package/src/hooks/useIntentLens.ts +0 -224
- package/src/hooks/useKeyboardShortcuts.ts +0 -69
- package/src/hooks/useLoggerBridge.ts +0 -32
- package/src/hooks/useMcpClient.ts +0 -112
- package/src/hooks/useNexusaiDeploy.ts +0 -118
- package/src/hooks/usePlaybackEngine.ts +0 -21
- package/src/hooks/usePlaygroundCommander.ts +0 -475
- package/src/hooks/usePluginEngine.ts +0 -165
- package/src/hooks/useScreenRecorder.ts +0 -73
- package/src/hooks/useShellKeyboard.ts +0 -40
- package/src/hooks/useShellShortcuts.ts +0 -118
- package/src/hooks/useSoundEffects.ts +0 -35
- package/src/hooks/useStudioConfig.ts +0 -72
- package/src/hooks/useSystemBoot.ts +0 -84
- package/src/hooks/useSystemTelemetry.ts +0 -62
- package/src/lib/debugLogger.ts +0 -80
- package/src/lib/networkInterceptor.ts +0 -100
- package/src/mocks/decido.tsx +0 -41
- package/src/plugins/pluginAPI.ts +0 -190
- package/src/store/McpStore.ts +0 -69
- package/src/store/UpdaterStore.ts +0 -60
- package/src/store/engine.ts +0 -392
- package/src/store/index.ts +0 -4
- package/src/store/layoutPresets.ts +0 -66
- package/src/store/playgroundTypes.ts +0 -98
- package/src/store/useActionTimelineStore.ts +0 -48
- package/src/store/useDebugPanelStore.ts +0 -98
- package/src/store/useDebugProfileStore.ts +0 -130
- package/src/store/useLayoutStore.ts +0 -205
- package/src/store/useMorphInstanceStore.ts +0 -289
- package/src/store/useMorphologyStore.ts +0 -103
- package/src/store/usePlaygroundStore.ts +0 -236
- package/src/store/useShellRegistry.ts +0 -123
- package/src/store/useSuggestionsStore.ts +0 -57
- package/src/store/useThemeStore.ts +0 -399
- package/src/store/useUIComponentStore.ts +0 -179
- package/src/types/DecidoStoryDefinition.ts +0 -43
- package/src/utils/ai/ai-architect.ts +0 -92
- package/src/utils/ai/ai-code.ts +0 -187
- package/src/utils/ai/ai-core.ts +0 -50
- package/src/utils/ai/ai-media.ts +0 -292
- package/src/utils/layoutGraph.ts +0 -67
- package/tsconfig.json +0 -17
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { WidgetRenderer, type WidgetDef, type ServerDrivenNode } from './WidgetRenderer';
|
|
3
|
-
import { useLayoutStore } from '../../store/useLayoutStore';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* WidgetSlotPanel — Reads active widgets and renders them.
|
|
7
|
-
*
|
|
8
|
-
* This is the "slot consumer" that bridges widget data → LayoutGrid.
|
|
9
|
-
* When a plugin registers a widget (via sidebar click or SDK),
|
|
10
|
-
* this panel shows it using WidgetRenderer.
|
|
11
|
-
*
|
|
12
|
-
* Supports side-by-side comparison of Option A (SDUI) and Option B (iframe).
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// ── Widget Store with localStorage persistence ──
|
|
16
|
-
|
|
17
|
-
const PERSISTENCE_KEY = 'decido:activeWidgets';
|
|
18
|
-
type Listener = () => void;
|
|
19
|
-
|
|
20
|
-
interface PersistedWidget {
|
|
21
|
-
id: string; pluginId: string; title: string; icon?: string;
|
|
22
|
-
slot: string; url?: string; order?: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
class WidgetStore {
|
|
26
|
-
private widgets = new Map<string, WidgetDef>();
|
|
27
|
-
private listeners = new Set<Listener>();
|
|
28
|
-
private _activeId: string | null = null;
|
|
29
|
-
private persistTimer: ReturnType<typeof setTimeout> | null = null;
|
|
30
|
-
|
|
31
|
-
register(widget: WidgetDef): void {
|
|
32
|
-
this.widgets.set(widget.id, { ...widget, visible: widget.visible ?? true });
|
|
33
|
-
this.notify();
|
|
34
|
-
this.persist();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
remove(id: string): void {
|
|
38
|
-
this.widgets.delete(id);
|
|
39
|
-
if (this._activeId === id) this._activeId = null;
|
|
40
|
-
this.notify();
|
|
41
|
-
this.persist();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
clear(): void {
|
|
45
|
-
this.widgets.clear();
|
|
46
|
-
this._activeId = null;
|
|
47
|
-
this.notify();
|
|
48
|
-
this.persist();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
setActive(id: string | null): void {
|
|
52
|
-
this._activeId = id;
|
|
53
|
-
this.notify();
|
|
54
|
-
this.persist();
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get activeId() { return this._activeId; }
|
|
58
|
-
get size() { return this.widgets.size; }
|
|
59
|
-
|
|
60
|
-
getVisible(): WidgetDef[] {
|
|
61
|
-
return Array.from(this.widgets.values())
|
|
62
|
-
.filter(w => w.visible !== false)
|
|
63
|
-
.sort((a, b) => (a.order ?? 100) - (b.order ?? 100));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/** Restore from localStorage (call on mount with schema resolver) */
|
|
67
|
-
restoreFromPersistence(schemaResolver: (widgetId: string) => ServerDrivenNode | undefined): boolean {
|
|
68
|
-
try {
|
|
69
|
-
const raw = localStorage.getItem(PERSISTENCE_KEY);
|
|
70
|
-
if (!raw) return false;
|
|
71
|
-
const snapshot = JSON.parse(raw) as { widgets: PersistedWidget[]; activeId: string | null };
|
|
72
|
-
if (!snapshot?.widgets?.length) return false;
|
|
73
|
-
|
|
74
|
-
for (const pw of snapshot.widgets) {
|
|
75
|
-
const schema = schemaResolver(pw.id);
|
|
76
|
-
this.widgets.set(pw.id, {
|
|
77
|
-
...pw,
|
|
78
|
-
visible: true,
|
|
79
|
-
schema,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
this._activeId = snapshot.activeId;
|
|
83
|
-
this.notify();
|
|
84
|
-
console.log(`[WidgetStore] Restored ${snapshot.widgets.length} widgets from persistence`);
|
|
85
|
-
return true;
|
|
86
|
-
} catch (e) {
|
|
87
|
-
console.warn('[WidgetStore] Restore failed:', e);
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
subscribe(fn: Listener): () => void {
|
|
93
|
-
this.listeners.add(fn);
|
|
94
|
-
return () => this.listeners.delete(fn);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private notify() {
|
|
98
|
-
this.listeners.forEach(fn => fn());
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/** Debounced write to localStorage (excludes schema which can't be serialized) */
|
|
102
|
-
private persist() {
|
|
103
|
-
if (this.persistTimer) clearTimeout(this.persistTimer);
|
|
104
|
-
this.persistTimer = setTimeout(() => {
|
|
105
|
-
try {
|
|
106
|
-
const snapshot = {
|
|
107
|
-
widgets: Array.from(this.widgets.values()).map(w => ({
|
|
108
|
-
id: w.id, pluginId: w.pluginId, title: w.title,
|
|
109
|
-
icon: w.icon, slot: w.slot, url: w.url, order: w.order,
|
|
110
|
-
})),
|
|
111
|
-
activeId: this._activeId,
|
|
112
|
-
};
|
|
113
|
-
localStorage.setItem(PERSISTENCE_KEY, JSON.stringify(snapshot));
|
|
114
|
-
} catch { /* quota exceeded — silently fail */ }
|
|
115
|
-
}, 300);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export const pluginWidgetStore = new WidgetStore();
|
|
120
|
-
|
|
121
|
-
// Expose on window for PluginBridge's getWidgets handler (avoids circular import)
|
|
122
|
-
(window as any).__pluginWidgetStore = pluginWidgetStore;
|
|
123
|
-
|
|
124
|
-
// ── React Hook ──
|
|
125
|
-
function useWidgetStore() {
|
|
126
|
-
const [, forceUpdate] = React.useReducer(x => x + 1, 0);
|
|
127
|
-
React.useEffect(() => pluginWidgetStore.subscribe(forceUpdate), []);
|
|
128
|
-
return {
|
|
129
|
-
widgets: pluginWidgetStore.getVisible(),
|
|
130
|
-
activeId: pluginWidgetStore.activeId,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// ── Component ──
|
|
135
|
-
|
|
136
|
-
export function WidgetSlotPanel() {
|
|
137
|
-
const { widgets, activeId } = useWidgetStore();
|
|
138
|
-
|
|
139
|
-
const activeWidget = activeId
|
|
140
|
-
? widgets.find(w => w.id === activeId) || widgets[0]
|
|
141
|
-
: widgets[0];
|
|
142
|
-
|
|
143
|
-
/** Close widget and restore R3 if no widgets remain */
|
|
144
|
-
const handleClose = React.useCallback((widgetId: string) => {
|
|
145
|
-
pluginWidgetStore.remove(widgetId);
|
|
146
|
-
// If removing the last widget, restore R3 to null
|
|
147
|
-
if (pluginWidgetStore.size === 0) {
|
|
148
|
-
useLayoutStore.getState().setSlot('R3', null);
|
|
149
|
-
}
|
|
150
|
-
}, []);
|
|
151
|
-
|
|
152
|
-
/** Close ALL widgets (button in tab bar) */
|
|
153
|
-
const handleCloseAll = React.useCallback(() => {
|
|
154
|
-
pluginWidgetStore.clear();
|
|
155
|
-
useLayoutStore.getState().setSlot('R3', null);
|
|
156
|
-
}, []);
|
|
157
|
-
|
|
158
|
-
if (widgets.length === 0) {
|
|
159
|
-
return (
|
|
160
|
-
<div className="w-full h-full flex flex-col items-center justify-center text-text-muted gap-3 bg-surface-primary">
|
|
161
|
-
<div className="w-12 h-12 rounded-xl bg-cyan-500/5 border border-cyan-500/10 flex items-center justify-center">
|
|
162
|
-
<span className="text-xl">🧩</span>
|
|
163
|
-
</div>
|
|
164
|
-
<p className="text-sm font-medium">No widgets activos</p>
|
|
165
|
-
<p className="text-xs opacity-60 max-w-[200px] text-center">
|
|
166
|
-
Selecciona un plugin del sidebar para ver widgets aquí
|
|
167
|
-
</p>
|
|
168
|
-
</div>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<div className="w-full h-full flex flex-col bg-surface-primary overflow-hidden">
|
|
174
|
-
{/* Widget tab bar */}
|
|
175
|
-
<div className="flex-none flex items-center gap-1 px-2 py-1 bg-surface-secondary border-b border-border-subtle overflow-x-auto">
|
|
176
|
-
{widgets.map(w => (
|
|
177
|
-
<button
|
|
178
|
-
key={w.id}
|
|
179
|
-
onClick={() => pluginWidgetStore.setActive(w.id)}
|
|
180
|
-
className={`px-2.5 py-1 rounded-md text-[10px] font-medium transition-all whitespace-nowrap ${
|
|
181
|
-
activeWidget?.id === w.id
|
|
182
|
-
? 'bg-surface-glass text-text-primary border border-border-default'
|
|
183
|
-
: 'text-text-muted hover:text-text-secondary hover:bg-surface-glass/50'
|
|
184
|
-
}`}
|
|
185
|
-
>
|
|
186
|
-
{w.icon && <span className="mr-1">{w.icon}</span>}
|
|
187
|
-
{w.title}
|
|
188
|
-
</button>
|
|
189
|
-
))}
|
|
190
|
-
{/* Close All button */}
|
|
191
|
-
{widgets.length > 1 && (
|
|
192
|
-
<button
|
|
193
|
-
onClick={handleCloseAll}
|
|
194
|
-
className="ml-auto px-2 py-1 rounded-md text-[10px] text-text-muted hover:text-red-400 hover:bg-red-500/10 transition-all"
|
|
195
|
-
title="Close all widgets"
|
|
196
|
-
>
|
|
197
|
-
✕ All
|
|
198
|
-
</button>
|
|
199
|
-
)}
|
|
200
|
-
</div>
|
|
201
|
-
|
|
202
|
-
{/* Active widget content */}
|
|
203
|
-
{activeWidget && (
|
|
204
|
-
<div className="flex-1 min-h-0 min-w-0 overflow-hidden">
|
|
205
|
-
<WidgetRenderer
|
|
206
|
-
widget={activeWidget}
|
|
207
|
-
onClose={() => handleClose(activeWidget.id)}
|
|
208
|
-
/>
|
|
209
|
-
</div>
|
|
210
|
-
)}
|
|
211
|
-
</div>
|
|
212
|
-
);
|
|
213
|
-
}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Search, Workflow, Zap, Terminal, BrainCircuit, Command,
|
|
3
|
-
FileText, Cpu, ShoppingCart, Building2, Activity,
|
|
4
|
-
Thermometer, AlertTriangle, TrendingUp, PackageCheck,
|
|
5
|
-
Network, Home, Settings, MessageSquare, Globe, Lock,
|
|
6
|
-
Shield, Database, HardDrive, Wifi, Cloud, Server,
|
|
7
|
-
BarChart3, PieChart, Gauge, Bell, Mail, Users,
|
|
8
|
-
FolderOpen, Code, Layers, Box, Rocket, Sparkles,
|
|
9
|
-
type LucideIcon
|
|
10
|
-
} from 'lucide-react';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* IconRegistry — Resuelve nombres de iconos (strings del JSON) a componentes Lucide.
|
|
14
|
-
*
|
|
15
|
-
* Uso:
|
|
16
|
-
* const Icon = resolveIcon("Thermometer"); // → Lucide Thermometer component
|
|
17
|
-
* <Icon size={16} />
|
|
18
|
-
*
|
|
19
|
-
* Si el icono no existe, retorna `Command` como fallback.
|
|
20
|
-
*/
|
|
21
|
-
const ICON_MAP: Record<string, LucideIcon> = {
|
|
22
|
-
// Communication & AI
|
|
23
|
-
'Search': Search,
|
|
24
|
-
'MessageSquare': MessageSquare,
|
|
25
|
-
'BrainCircuit': BrainCircuit,
|
|
26
|
-
'Sparkles': Sparkles,
|
|
27
|
-
'Command': Command,
|
|
28
|
-
'Terminal': Terminal,
|
|
29
|
-
|
|
30
|
-
// Actions & Flow
|
|
31
|
-
'Workflow': Workflow,
|
|
32
|
-
'Zap': Zap,
|
|
33
|
-
'Rocket': Rocket,
|
|
34
|
-
'Network': Network,
|
|
35
|
-
|
|
36
|
-
// Data & Files
|
|
37
|
-
'FileText': FileText,
|
|
38
|
-
'FolderOpen': FolderOpen,
|
|
39
|
-
'Code': Code,
|
|
40
|
-
'Database': Database,
|
|
41
|
-
|
|
42
|
-
// Business & Commerce
|
|
43
|
-
'ShoppingCart': ShoppingCart,
|
|
44
|
-
'Building2': Building2,
|
|
45
|
-
'Users': Users,
|
|
46
|
-
|
|
47
|
-
// Monitoring & Metrics
|
|
48
|
-
'Activity': Activity,
|
|
49
|
-
'Thermometer': Thermometer,
|
|
50
|
-
'AlertTriangle': AlertTriangle,
|
|
51
|
-
'TrendingUp': TrendingUp,
|
|
52
|
-
'BarChart3': BarChart3,
|
|
53
|
-
'PieChart': PieChart,
|
|
54
|
-
'Gauge': Gauge,
|
|
55
|
-
'Bell': Bell,
|
|
56
|
-
|
|
57
|
-
// Infrastructure
|
|
58
|
-
'Cpu': Cpu,
|
|
59
|
-
'HardDrive': HardDrive,
|
|
60
|
-
'Server': Server,
|
|
61
|
-
'Cloud': Cloud,
|
|
62
|
-
'Wifi': Wifi,
|
|
63
|
-
'PackageCheck': PackageCheck,
|
|
64
|
-
|
|
65
|
-
// Security & Settings
|
|
66
|
-
'Lock': Lock,
|
|
67
|
-
'Shield': Shield,
|
|
68
|
-
'Settings': Settings,
|
|
69
|
-
|
|
70
|
-
// Misc
|
|
71
|
-
'Globe': Globe,
|
|
72
|
-
'Mail': Mail,
|
|
73
|
-
'Home': Home,
|
|
74
|
-
'Layers': Layers,
|
|
75
|
-
'Box': Box
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Resolve a string icon name to a Lucide component.
|
|
80
|
-
* Returns Command icon as fallback for unknown names.
|
|
81
|
-
*/
|
|
82
|
-
export function resolveIcon(name: string): LucideIcon {
|
|
83
|
-
return ICON_MAP[name] || Command;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Color token resolver — maps color names to Tailwind text classes.
|
|
88
|
-
*/
|
|
89
|
-
const COLOR_MAP: Record<string, string> = {
|
|
90
|
-
'emerald': 'text-emerald-400',
|
|
91
|
-
'cyan': 'text-cyan-400',
|
|
92
|
-
'purple': 'text-purple-400',
|
|
93
|
-
'orange': 'text-orange-400',
|
|
94
|
-
'yellow': 'text-yellow-400',
|
|
95
|
-
'rose': 'text-rose-400',
|
|
96
|
-
'red': 'text-red-400',
|
|
97
|
-
'blue': 'text-blue-400',
|
|
98
|
-
'indigo': 'text-indigo-400',
|
|
99
|
-
'pink': 'text-pink-400',
|
|
100
|
-
'amber': 'text-amber-400',
|
|
101
|
-
'teal': 'text-teal-400',
|
|
102
|
-
'lime': 'text-lime-400',
|
|
103
|
-
'sky': 'text-sky-400',
|
|
104
|
-
'violet': 'text-violet-400',
|
|
105
|
-
'fuchsia': 'text-fuchsia-400',
|
|
106
|
-
'white': 'text-white'
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Resolve a color token name to a Tailwind text class.
|
|
111
|
-
* Returns "text-white" as fallback.
|
|
112
|
-
*/
|
|
113
|
-
export function resolveColor(name: string): string {
|
|
114
|
-
return COLOR_MAP[name] || 'text-white';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Generate bg/border classes from a color token.
|
|
119
|
-
*/
|
|
120
|
-
export function resolveColorClasses(color: string): { bg: string; border: string; text: string } {
|
|
121
|
-
return {
|
|
122
|
-
text: COLOR_MAP[color] || 'text-white',
|
|
123
|
-
bg: `bg-${color}-500/10`,
|
|
124
|
-
border: `border-${color}-500/20`
|
|
125
|
-
};
|
|
126
|
-
}
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext, ReactNode, useEffect, useRef, useCallback } from 'react';
|
|
2
|
-
|
|
3
|
-
// Tauri APIs are loaded DYNAMICALLY to avoid Vite resolution errors
|
|
4
|
-
// in non-Tauri (web-only) environments where @tauri-apps/api doesn't exist.
|
|
5
|
-
// Type-only import for UnlistenFn (erased at runtime)
|
|
6
|
-
type UnlistenFn = () => void;
|
|
7
|
-
|
|
8
|
-
// Detección segura del entorno Tauri
|
|
9
|
-
const isTauri = typeof window !== 'undefined' && (window as any).__TAURI_INTERNALS__ !== undefined;
|
|
10
|
-
|
|
11
|
-
// Lazy-loaded Tauri modules (only resolved at runtime when isTauri === true)
|
|
12
|
-
// @ts-ignore — @tauri-apps/api only exists inside the Tauri binary
|
|
13
|
-
const getTauriEvent = () => import(/* @vite-ignore */ '@tauri-apps/api/event');
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
const getTauriCore = () => import(/* @vite-ignore */ '@tauri-apps/api/core');
|
|
16
|
-
|
|
17
|
-
interface NetworkContextType {
|
|
18
|
-
socket: any | null;
|
|
19
|
-
isConnected: boolean;
|
|
20
|
-
isNativeOS: boolean; // Nos dice si estamos corriendo en el binario de Rust
|
|
21
|
-
emitEvent: (event: string, payload: any) => void;
|
|
22
|
-
onEvent: (event: string, callback: (payload: any) => void) => void;
|
|
23
|
-
offEvent: (event: string, callback: (payload: any) => void) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const NetworkContext = createContext<NetworkContextType>({
|
|
27
|
-
socket: null,
|
|
28
|
-
isConnected: false,
|
|
29
|
-
isNativeOS: false,
|
|
30
|
-
emitEvent: () => {},
|
|
31
|
-
onEvent: () => {},
|
|
32
|
-
offEvent: () => {}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const useNetwork = () => useContext(NetworkContext);
|
|
36
|
-
|
|
37
|
-
export const useNetworkEvent = (eventName: string, callback: (payload: any) => void) => {
|
|
38
|
-
const { onEvent, offEvent } = useNetwork();
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
onEvent(eventName, callback);
|
|
41
|
-
return () => offEvent(eventName, callback);
|
|
42
|
-
}, [eventName, callback, onEvent, offEvent]);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
interface NetworkProviderProps {
|
|
46
|
-
children: ReactNode;
|
|
47
|
-
socketInstance?: any;
|
|
48
|
-
isConnected?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const NetworkProvider = ({ children, socketInstance = null, isConnected = false }: NetworkProviderProps) => {
|
|
52
|
-
// Referencias para limpiar listeners de WebSocket nativo
|
|
53
|
-
const nativeListeners = useRef(new Map<string, Array<{originalCallback: any, wrappedCallback: any}>>());
|
|
54
|
-
// Referencias para limpiar listeners asíncronos de Tauri
|
|
55
|
-
const tauriListeners = useRef(new Map<string, Array<{originalCallback: any, unlistenPromise: Promise<UnlistenFn>}>>());
|
|
56
|
-
|
|
57
|
-
const emitEvent = useCallback(async (event: string, payload: any) => {
|
|
58
|
-
if (isTauri) {
|
|
59
|
-
// 🦀 RUTA TAURI: Enviar al Daemon en Rust
|
|
60
|
-
try {
|
|
61
|
-
const { emit } = await getTauriEvent();
|
|
62
|
-
await emit(event, payload);
|
|
63
|
-
} catch (err) {
|
|
64
|
-
console.error(`[Tauri IPC] Error emitiendo ${event}:`, err);
|
|
65
|
-
}
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 🌐 RUTA WEB: Socket.io o WebSocket Nativo
|
|
70
|
-
if (!socketInstance) {
|
|
71
|
-
console.warn(`[NetworkProvider] Emit '${event}' ignorado: No hay red disponible.`);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
if (typeof socketInstance.emit === 'function') {
|
|
76
|
-
socketInstance.emit(event, payload);
|
|
77
|
-
} else if (typeof socketInstance.send === 'function') {
|
|
78
|
-
socketInstance.send(JSON.stringify({ event, payload }));
|
|
79
|
-
}
|
|
80
|
-
}, [socketInstance]);
|
|
81
|
-
|
|
82
|
-
const onEvent = useCallback((event: string, callback: (payload: any) => void) => {
|
|
83
|
-
if (isTauri) {
|
|
84
|
-
// 🦀 RUTA TAURI: Escuchar eventos desde Rust
|
|
85
|
-
const unlistenPromise = getTauriEvent().then(({ listen }) =>
|
|
86
|
-
listen(event, (tauriEvent: any) => {
|
|
87
|
-
callback(tauriEvent.payload);
|
|
88
|
-
})
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
if (!tauriListeners.current.has(event)) {
|
|
92
|
-
tauriListeners.current.set(event,[]);
|
|
93
|
-
}
|
|
94
|
-
tauriListeners.current.get(event)?.push({ originalCallback: callback, unlistenPromise });
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// 🌐 RUTA WEB
|
|
99
|
-
if (!socketInstance) return;
|
|
100
|
-
|
|
101
|
-
if (typeof socketInstance.on === 'function') {
|
|
102
|
-
socketInstance.on(event, callback);
|
|
103
|
-
} else if (typeof socketInstance.addEventListener === 'function') {
|
|
104
|
-
const wrappedCallback = (messageEvent: MessageEvent) => {
|
|
105
|
-
try {
|
|
106
|
-
const data = JSON.parse(messageEvent.data);
|
|
107
|
-
if (data.event === event) callback(data.payload);
|
|
108
|
-
} catch(e) {}
|
|
109
|
-
};
|
|
110
|
-
socketInstance.addEventListener('message', wrappedCallback);
|
|
111
|
-
|
|
112
|
-
if (!nativeListeners.current.has(event)) {
|
|
113
|
-
nativeListeners.current.set(event,[]);
|
|
114
|
-
}
|
|
115
|
-
nativeListeners.current.get(event)?.push({ originalCallback: callback, wrappedCallback });
|
|
116
|
-
}
|
|
117
|
-
}, [socketInstance]);
|
|
118
|
-
|
|
119
|
-
const offEvent = useCallback((event: string, callback: (payload: any) => void) => {
|
|
120
|
-
if (isTauri) {
|
|
121
|
-
// 🦀 RUTA TAURI: Desuscribir
|
|
122
|
-
const listeners = tauriListeners.current.get(event) ||[];
|
|
123
|
-
const index = listeners.findIndex(l => l.originalCallback === callback);
|
|
124
|
-
if (index > -1) {
|
|
125
|
-
listeners[index].unlistenPromise.then(unlisten => unlisten());
|
|
126
|
-
listeners.splice(index, 1);
|
|
127
|
-
}
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// 🌐 RUTA WEB
|
|
132
|
-
if (!socketInstance) return;
|
|
133
|
-
|
|
134
|
-
if (typeof socketInstance.off === 'function') {
|
|
135
|
-
socketInstance.off(event, callback);
|
|
136
|
-
} else if (typeof socketInstance.removeEventListener === 'function') {
|
|
137
|
-
const listeners = nativeListeners.current.get(event) ||[];
|
|
138
|
-
const foundIndex = listeners.findIndex(l => l.originalCallback === callback);
|
|
139
|
-
if (foundIndex > -1) {
|
|
140
|
-
const { wrappedCallback } = listeners[foundIndex];
|
|
141
|
-
socketInstance.removeEventListener('message', wrappedCallback);
|
|
142
|
-
listeners.splice(foundIndex, 1);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
},[socketInstance]);
|
|
146
|
-
|
|
147
|
-
// En Tauri, estamos nativamente conectados al SO local
|
|
148
|
-
const effectiveConnection = isTauri ? true : isConnected;
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<NetworkContext.Provider value={{
|
|
152
|
-
socket: socketInstance,
|
|
153
|
-
isConnected: effectiveConnection,
|
|
154
|
-
isNativeOS: isTauri,
|
|
155
|
-
emitEvent,
|
|
156
|
-
onEvent,
|
|
157
|
-
offEvent
|
|
158
|
-
}}>
|
|
159
|
-
{children}
|
|
160
|
-
</NetworkContext.Provider>
|
|
161
|
-
);
|
|
162
|
-
};
|
package/src/core/AIDirector.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useShellStore } from '../store/engine';
|
|
2
|
-
import { MaciaIntent } from '@decido/plugin-engine';
|
|
3
|
-
|
|
4
|
-
export class AIDirector {
|
|
5
|
-
/**
|
|
6
|
-
* Scans all active plugins to match a natural language query against their intents.
|
|
7
|
-
* If a match is found, the specific plugin's handler is executed.
|
|
8
|
-
* Otherwise, the query is delegated to a general AI fallback.
|
|
9
|
-
*/
|
|
10
|
-
static async processQuery(query: string): Promise<boolean> {
|
|
11
|
-
const { plugins } = useShellStore.getState();
|
|
12
|
-
|
|
13
|
-
// Gather all intents across all registered plugins
|
|
14
|
-
const allIntents: MaciaIntent[] = [];
|
|
15
|
-
plugins.forEach(plugin => {
|
|
16
|
-
if (plugin.intents) {
|
|
17
|
-
allIntents.push(...plugin.intents);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Test the query against intent patterns
|
|
22
|
-
for (const intent of allIntents) {
|
|
23
|
-
const match = query.match(intent.match.pattern);
|
|
24
|
-
if (match) {
|
|
25
|
-
console.log(`[AIDirector] Intent Matched: ${intent.name}`);
|
|
26
|
-
try {
|
|
27
|
-
await intent.handler(match);
|
|
28
|
-
return true; // Match found and handled
|
|
29
|
-
} catch (error) {
|
|
30
|
-
console.error(`[AIDirector] Error handling intent ${intent.name}:`, error);
|
|
31
|
-
throw error;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Fallback: No specific intent matched, delegate to general AI
|
|
37
|
-
console.log(`[AIDirector] No specific intent matched for: "${query}". Delegating to general AI layer.`);
|
|
38
|
-
await this.delegateToGeneralAI(query);
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Discovery API: Gathers all available intents from registered plugins
|
|
44
|
-
* Returns a simplified list intended for UI suggestions (like the Command Palette)
|
|
45
|
-
*/
|
|
46
|
-
static getSuggestedIntents(): { pluginName: string; intentName: string; description: string; examples: string[] }[] {
|
|
47
|
-
const { plugins } = useShellStore.getState();
|
|
48
|
-
const suggestions: { pluginName: string; intentName: string; description: string; examples: string[] }[] = [];
|
|
49
|
-
|
|
50
|
-
plugins.forEach(plugin => {
|
|
51
|
-
if (plugin.intents) {
|
|
52
|
-
plugin.intents.forEach(intent => {
|
|
53
|
-
suggestions.push({
|
|
54
|
-
pluginName: plugin.name || plugin.manifest?.name || 'Unknown Plugin',
|
|
55
|
-
intentName: intent.name,
|
|
56
|
-
description: intent.match.description,
|
|
57
|
-
examples: intent.match.examples || []
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return suggestions;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private static async delegateToGeneralAI(query: string) {
|
|
67
|
-
// Implementation placeholder for general knowledge routing, LLM generation, etc.
|
|
68
|
-
// This could optionally be wired to AgentManager via a fallback standard plugin context intent.
|
|
69
|
-
console.log(`[AIDirector Fallback] Processing general request: ${query}`);
|
|
70
|
-
}
|
|
71
|
-
}
|
package/src/core/EventBus.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EventBus.ts
|
|
3
|
-
*
|
|
4
|
-
* Provides a lightweight, globally accessible cross-plugin Event Engine.
|
|
5
|
-
* Enables the "Any-Flow" Architecture: isolated plugin logic sending
|
|
6
|
-
* uncoupled messaging to UI widgets or Engine evaluations.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { probe } from '@decido/logger';
|
|
10
|
-
|
|
11
|
-
type EventHandler = (payload: any) => void;
|
|
12
|
-
|
|
13
|
-
export const EventBus = {
|
|
14
|
-
listeners: new Map<string, Set<EventHandler>>(),
|
|
15
|
-
|
|
16
|
-
emit(event: string, payload?: any) {
|
|
17
|
-
const listenerCount = this.listeners.get(event)?.size ?? 0;
|
|
18
|
-
probe('eventbus.emit', { event, listenerCount }, { level: 'debug', context: { module: 'shell', component: 'EventBus' } });
|
|
19
|
-
this.listeners.get(event)?.forEach(cb => cb(payload));
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
subscribe(event: string, callback: EventHandler) {
|
|
23
|
-
if (!this.listeners.has(event)) {
|
|
24
|
-
this.listeners.set(event, new Set());
|
|
25
|
-
}
|
|
26
|
-
this.listeners.get(event)!.add(callback);
|
|
27
|
-
probe('eventbus.subscribe', { event, totalListeners: this.listeners.get(event)!.size }, { level: 'debug', context: { module: 'shell', component: 'EventBus' } });
|
|
28
|
-
|
|
29
|
-
// Return an unsubscribe function
|
|
30
|
-
return () => {
|
|
31
|
-
const evListeners = this.listeners.get(event);
|
|
32
|
-
if (evListeners) {
|
|
33
|
-
evListeners.delete(callback);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
};
|