@decido/shell 1.0.0 → 4.0.2
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 +27 -18
- 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/index.ts +0 -97
- 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
package/src/store/engine.ts
DELETED
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
import { MaciaPlugin, MaciaWidget, WidgetRenderMode } from '@decido/plugin-engine';
|
|
3
|
-
import { kernel } from '@decido/kernel-bridge';
|
|
4
|
-
|
|
5
|
-
// Transient Overlays definitions
|
|
6
|
-
export type ShellMode = 'workbench' | 'canvas' | 'landing' | 'ghost';
|
|
7
|
-
|
|
8
|
-
export interface TransientOverlay {
|
|
9
|
-
id: string;
|
|
10
|
-
widgetId: string;
|
|
11
|
-
position: { x: number; y: number; width?: number; height?: number };
|
|
12
|
-
props?: Record<string, any>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type LayoutNode = {
|
|
16
|
-
id: string;
|
|
17
|
-
type: 'split-vertical' | 'split-horizontal' | 'tabs' | 'widget';
|
|
18
|
-
children?: LayoutNode[];
|
|
19
|
-
widgetId?: string;
|
|
20
|
-
size?: number; // flex basis/flex grow ratio
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export interface Workspace {
|
|
24
|
-
id: string;
|
|
25
|
-
name: string;
|
|
26
|
-
icon?: any; // React.ReactNode equivalent but avoiding cyclic typings issue if any, or just import React
|
|
27
|
-
layout: LayoutNode;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface ShellState {
|
|
31
|
-
plugins: Map<string, MaciaPlugin>;
|
|
32
|
-
widgets: Map<string, MaciaWidget>;
|
|
33
|
-
|
|
34
|
-
// Layout Management
|
|
35
|
-
activeShellMode: ShellMode;
|
|
36
|
-
setShellMode: (mode: ShellMode) => void;
|
|
37
|
-
|
|
38
|
-
rootLayout: LayoutNode | null;
|
|
39
|
-
activeWidgetId: string | null;
|
|
40
|
-
|
|
41
|
-
// Workspaces (Tabs mapping to rootLayouts)
|
|
42
|
-
workspaces: Workspace[];
|
|
43
|
-
activeWorkspaceId: string | null;
|
|
44
|
-
|
|
45
|
-
// Transient UI Layer
|
|
46
|
-
transientOverlays: TransientOverlay[];
|
|
47
|
-
isCommandPaletteOpen: boolean;
|
|
48
|
-
isForgeTerminalOpen: boolean;
|
|
49
|
-
isGodModePanelOpen: boolean;
|
|
50
|
-
isMarketplaceOpen: boolean;
|
|
51
|
-
isShortcutSettingsOpen: boolean;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
// Actions
|
|
55
|
-
registerPlugin: (plugin: MaciaPlugin) => void;
|
|
56
|
-
unregisterPlugin: (pluginId: string) => void;
|
|
57
|
-
|
|
58
|
-
openTransientOverlay: (overlay: Omit<TransientOverlay, 'id'>) => string;
|
|
59
|
-
closeTransientOverlay: (id: string) => void;
|
|
60
|
-
|
|
61
|
-
setCommandPaletteOpen: (open: boolean) => void;
|
|
62
|
-
setForgeTerminalOpen: (open: boolean) => void;
|
|
63
|
-
setGodModePanelOpen: (open: boolean) => void;
|
|
64
|
-
setMarketplaceOpen: (open: boolean) => void;
|
|
65
|
-
setShortcutSettingsOpen: (open: boolean) => void;
|
|
66
|
-
|
|
67
|
-
setLayout: (layout: LayoutNode) => void;
|
|
68
|
-
|
|
69
|
-
// Workspace actions
|
|
70
|
-
addWorkspace: (workspace: Workspace) => void;
|
|
71
|
-
setActiveWorkspace: (id: string) => void;
|
|
72
|
-
|
|
73
|
-
// Scene / Layout Persistence
|
|
74
|
-
savedScenes: Record<string, LayoutNode>;
|
|
75
|
-
saveScene: (sceneName: string) => void;
|
|
76
|
-
loadScene: (sceneName: string) => void;
|
|
77
|
-
|
|
78
|
-
// Phase 9: Intent-Based Registry & Morphological Interfaces
|
|
79
|
-
requestCapability: (capability: string) => MaciaWidget[];
|
|
80
|
-
openWidgetByCapability: (capability: string, options?: { renderMode?: WidgetRenderMode; data?: any }) => boolean;
|
|
81
|
-
|
|
82
|
-
// Phase 16: Live Data Context
|
|
83
|
-
widgetDataBus: Record<string, any>;
|
|
84
|
-
setWidgetData: (widgetId: string, data: any) => void;
|
|
85
|
-
|
|
86
|
-
// Phase 18: Thin Client Mobile Support
|
|
87
|
-
isThinClient: boolean;
|
|
88
|
-
initializeEnvironment: () => Promise<void>;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
import { sentinelMiddleware } from '@decido/sentinel-browser';
|
|
92
|
-
|
|
93
|
-
export const useShellStore = create<ShellState>()(
|
|
94
|
-
sentinelMiddleware('shell_store', (set) => ({
|
|
95
|
-
plugins: new Map(),
|
|
96
|
-
widgets: new Map(),
|
|
97
|
-
|
|
98
|
-
activeShellMode: 'workbench', // Default to Workbench given it's the ERP standard
|
|
99
|
-
setShellMode: (mode) => set({ activeShellMode: mode }),
|
|
100
|
-
|
|
101
|
-
rootLayout: null,
|
|
102
|
-
activeWidgetId: null,
|
|
103
|
-
|
|
104
|
-
workspaces: [],
|
|
105
|
-
activeWorkspaceId: null,
|
|
106
|
-
|
|
107
|
-
transientOverlays: [],
|
|
108
|
-
isCommandPaletteOpen: false,
|
|
109
|
-
isForgeTerminalOpen: false,
|
|
110
|
-
isGodModePanelOpen: false,
|
|
111
|
-
isMarketplaceOpen: false,
|
|
112
|
-
isShortcutSettingsOpen: false,
|
|
113
|
-
|
|
114
|
-
// MCP servers moved to dedicated McpStore.ts
|
|
115
|
-
|
|
116
|
-
savedScenes: {},
|
|
117
|
-
|
|
118
|
-
widgetDataBus: {},
|
|
119
|
-
|
|
120
|
-
setWidgetData: (widgetId: string, data: any) => set((state: ShellState) => ({
|
|
121
|
-
widgetDataBus: { ...state.widgetDataBus, [widgetId]: data }
|
|
122
|
-
})),
|
|
123
|
-
|
|
124
|
-
isThinClient: false,
|
|
125
|
-
initializeEnvironment: async () => {
|
|
126
|
-
try {
|
|
127
|
-
const isTauri = typeof window !== 'undefined' && '__TAURI_INTERNALS__' in window;
|
|
128
|
-
if (!isTauri) {
|
|
129
|
-
console.log('[OS] Web Environment Detected (No Tauri). Running in standard browser mode.');
|
|
130
|
-
set({ isThinClient: false });
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const osPlugin = await import('@tauri-apps/plugin-os');
|
|
135
|
-
const osType = await osPlugin.type();
|
|
136
|
-
const mobile = osType === 'android' || osType === 'ios';
|
|
137
|
-
set({ isThinClient: mobile });
|
|
138
|
-
console.log(`[OS] Entorno detectado: ${mobile ? 'Móvil (Thin Client)' : 'Desktop (Node)'}`);
|
|
139
|
-
|
|
140
|
-
if (mobile) {
|
|
141
|
-
kernel.execute('broadcast_message', {
|
|
142
|
-
intent: "node_announcement",
|
|
143
|
-
payload: JSON.stringify({
|
|
144
|
-
tier: "Satellite",
|
|
145
|
-
capabilities: ["voice", "display"]
|
|
146
|
-
})
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Registrar listener global para notificaciones inter-nodales
|
|
151
|
-
kernel.onEvent(async (payload: any) => {
|
|
152
|
-
if (payload.event_type === 'broadcast_event' && payload.data?.intent === 'push_notification') {
|
|
153
|
-
const { title, body, urgency } = payload.data.payload;
|
|
154
|
-
|
|
155
|
-
try {
|
|
156
|
-
const notification = await import('@tauri-apps/plugin-notification');
|
|
157
|
-
let permission = await notification.isPermissionGranted();
|
|
158
|
-
if (!permission) {
|
|
159
|
-
permission = await notification.requestPermission() === 'granted';
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (permission) {
|
|
163
|
-
notification.sendNotification({
|
|
164
|
-
title,
|
|
165
|
-
body,
|
|
166
|
-
icon: 'notification_icon',
|
|
167
|
-
sound: urgency === 'critical' ? 'alarm' : 'default'
|
|
168
|
-
});
|
|
169
|
-
console.log(`[Satellite] 🔔 Alerta recibida de ${payload.agent_id}: ${title}`);
|
|
170
|
-
}
|
|
171
|
-
} catch (e) {
|
|
172
|
-
console.warn('Failed to send tauri notification', e);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
} catch (e) {
|
|
178
|
-
console.warn('[OS] No se pudo detectar el entorno Tauri, asumiendo Desktop', e);
|
|
179
|
-
}
|
|
180
|
-
},
|
|
181
|
-
|
|
182
|
-
registerPlugin: (plugin: MaciaPlugin) => set((state: ShellState) => {
|
|
183
|
-
const pluginId = plugin.id || plugin.manifest?.id;
|
|
184
|
-
if (!pluginId) return state; // Ignore invalid plugins
|
|
185
|
-
|
|
186
|
-
const newPlugins = new Map(state.plugins);
|
|
187
|
-
newPlugins.set(pluginId, plugin);
|
|
188
|
-
|
|
189
|
-
const newWidgets = new Map(state.widgets);
|
|
190
|
-
const widgets = plugin.widgets || plugin.manifest?.widgets || [];
|
|
191
|
-
widgets.forEach(w => {
|
|
192
|
-
const boundWidget: MaciaWidget = { ...w, pluginId: pluginId };
|
|
193
|
-
newWidgets.set(boundWidget.id, boundWidget);
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
// Add explicit cast to `state` as any to bypass `intentsCache` errors locally, or just omit it because intents are scanned dynamically via AIDirector now!
|
|
197
|
-
// We'll just execute standard state properties
|
|
198
|
-
|
|
199
|
-
if (plugin.onRegister) {
|
|
200
|
-
try {
|
|
201
|
-
Promise.resolve(plugin.onRegister()).catch(e => console.error(`[OS] Failed to async-register plugin ${pluginId}:`, e));
|
|
202
|
-
} catch (e) {
|
|
203
|
-
console.error(`[OS] Failed to sync-register plugin ${pluginId}:`, e);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// --- Phase 24: SDK Zero-Trust Mount ---
|
|
208
|
-
if (plugin.mount && plugin.manifest && typeof window !== 'undefined') {
|
|
209
|
-
try {
|
|
210
|
-
plugin.mount({} as any);
|
|
211
|
-
} catch (e) {
|
|
212
|
-
console.error(`[OS] Failed to mount plugin ${pluginId}`, e);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return { plugins: newPlugins, widgets: newWidgets } as any; // Typecast because of store variations
|
|
217
|
-
}),
|
|
218
|
-
|
|
219
|
-
unregisterPlugin: (pluginId: string) => set((state: ShellState) => {
|
|
220
|
-
const newPlugins = new Map(state.plugins);
|
|
221
|
-
const plugin = newPlugins.get(pluginId) as any;
|
|
222
|
-
|
|
223
|
-
if (plugin) {
|
|
224
|
-
const newWidgets = new Map(state.widgets);
|
|
225
|
-
const widgets = plugin.widgets || plugin.manifest?.widgets || [];
|
|
226
|
-
widgets.forEach((w: MaciaWidget) => newWidgets.delete(w.id));
|
|
227
|
-
|
|
228
|
-
if (plugin.onUnregister) {
|
|
229
|
-
try {
|
|
230
|
-
Promise.resolve(plugin.onUnregister()).catch(e => console.error(`[OS] Failed to async-unregister plugin ${pluginId}:`, e));
|
|
231
|
-
} catch (e) {
|
|
232
|
-
console.error(`[OS] Failed to sync-unregister plugin ${pluginId}:`, e);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
newPlugins.delete(pluginId);
|
|
237
|
-
return { plugins: newPlugins, widgets: newWidgets } as any;
|
|
238
|
-
}
|
|
239
|
-
return state;
|
|
240
|
-
}),
|
|
241
|
-
|
|
242
|
-
openTransientOverlay: (overlay) => {
|
|
243
|
-
const id = typeof crypto !== 'undefined' && crypto.randomUUID ? crypto.randomUUID() : Date.now().toString() + Math.random().toString(36).substring(2);
|
|
244
|
-
set((state: ShellState) => ({
|
|
245
|
-
transientOverlays: [...state.transientOverlays, { ...overlay, id }]
|
|
246
|
-
}));
|
|
247
|
-
return id;
|
|
248
|
-
},
|
|
249
|
-
|
|
250
|
-
closeTransientOverlay: (id) => {
|
|
251
|
-
set((state: ShellState) => ({
|
|
252
|
-
transientOverlays: state.transientOverlays.filter(o => o.id !== id)
|
|
253
|
-
}));
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
setCommandPaletteOpen: (open) => {
|
|
257
|
-
set({ isCommandPaletteOpen: open });
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
setForgeTerminalOpen: (open) => {
|
|
261
|
-
set({ isForgeTerminalOpen: open });
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
setGodModePanelOpen: (open) => {
|
|
265
|
-
set({ isGodModePanelOpen: open });
|
|
266
|
-
},
|
|
267
|
-
|
|
268
|
-
setMarketplaceOpen: (open) => {
|
|
269
|
-
set({ isMarketplaceOpen: open });
|
|
270
|
-
},
|
|
271
|
-
|
|
272
|
-
setShortcutSettingsOpen: (open) => {
|
|
273
|
-
set({ isShortcutSettingsOpen: open });
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
setLayout: (layout) => {
|
|
277
|
-
// Wrap in View Transitions API to implement transmutations as per architectural rules
|
|
278
|
-
if (typeof document !== 'undefined' && 'startViewTransition' in document) {
|
|
279
|
-
const transition = (document as any).startViewTransition(() => {
|
|
280
|
-
set({ rootLayout: layout });
|
|
281
|
-
});
|
|
282
|
-
// Suppress the AbortError from unhandled promise rejections if transitions rapidly overlap
|
|
283
|
-
if (transition.ready) transition.ready.catch(() => { });
|
|
284
|
-
if (transition.finished) transition.finished.catch(() => { });
|
|
285
|
-
if (transition.updateCallbackDone) transition.updateCallbackDone.catch(() => { });
|
|
286
|
-
} else {
|
|
287
|
-
set({ rootLayout: layout });
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
addWorkspace: (workspace) => {
|
|
292
|
-
set((state: ShellState) => {
|
|
293
|
-
const exists = state.workspaces.find(w => w.id === workspace.id);
|
|
294
|
-
if (exists) return state;
|
|
295
|
-
return { workspaces: [...state.workspaces, workspace] };
|
|
296
|
-
});
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
setActiveWorkspace: (id) => {
|
|
300
|
-
// Actually Zustand set takes a function. Let's do carefully.
|
|
301
|
-
set((state: ShellState) => {
|
|
302
|
-
const ws = state.workspaces.find(w => w.id === id);
|
|
303
|
-
if (!ws) return state;
|
|
304
|
-
|
|
305
|
-
// Apply View Transition natively inside the state setter wrapping logic,
|
|
306
|
-
// but since startViewTransition is async, we do it carefully:
|
|
307
|
-
if (typeof document !== 'undefined' && 'startViewTransition' in document) {
|
|
308
|
-
const transition = (document as any).startViewTransition(() => {
|
|
309
|
-
set({ rootLayout: ws.layout, activeWorkspaceId: id });
|
|
310
|
-
});
|
|
311
|
-
if (transition.ready) transition.ready.catch(() => { });
|
|
312
|
-
if (transition.finished) transition.finished.catch(() => { });
|
|
313
|
-
if (transition.updateCallbackDone) transition.updateCallbackDone.catch(() => { });
|
|
314
|
-
return state; // We already called set() async inside the transition
|
|
315
|
-
} else {
|
|
316
|
-
return { rootLayout: ws.layout, activeWorkspaceId: id };
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
saveScene: (sceneName: string) => {
|
|
322
|
-
set((state: ShellState) => {
|
|
323
|
-
if (!state.rootLayout) return state;
|
|
324
|
-
// Native structured cloning or deep copy of the layout tree to avoid proxy mutations
|
|
325
|
-
const layoutSnapshot = JSON.parse(JSON.stringify(state.rootLayout));
|
|
326
|
-
return {
|
|
327
|
-
savedScenes: {
|
|
328
|
-
...state.savedScenes,
|
|
329
|
-
[sceneName]: layoutSnapshot
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
});
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
loadScene: (sceneName: string) => {
|
|
336
|
-
set((state: ShellState) => {
|
|
337
|
-
const scene = state.savedScenes[sceneName];
|
|
338
|
-
if (!scene) return state;
|
|
339
|
-
|
|
340
|
-
// Implement view transition for the layout swap
|
|
341
|
-
if (typeof document !== 'undefined' && 'startViewTransition' in document) {
|
|
342
|
-
const transition = (document as any).startViewTransition(() => {
|
|
343
|
-
set({ rootLayout: JSON.parse(JSON.stringify(scene)) });
|
|
344
|
-
});
|
|
345
|
-
if (transition.ready) transition.ready.catch(() => { });
|
|
346
|
-
if (transition.finished) transition.finished.catch(() => { });
|
|
347
|
-
if (transition.updateCallbackDone) transition.updateCallbackDone.catch(() => { });
|
|
348
|
-
return state;
|
|
349
|
-
} else {
|
|
350
|
-
return { rootLayout: JSON.parse(JSON.stringify(scene)) };
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
requestCapability: (capability: string) => {
|
|
356
|
-
const matchingWidgets: MaciaWidget[] = [];
|
|
357
|
-
useShellStore.getState().widgets.forEach(w => {
|
|
358
|
-
if (w.capabilities?.includes(capability)) {
|
|
359
|
-
matchingWidgets.push(w);
|
|
360
|
-
}
|
|
361
|
-
});
|
|
362
|
-
return matchingWidgets;
|
|
363
|
-
},
|
|
364
|
-
|
|
365
|
-
openWidgetByCapability: (capability: string, options) => {
|
|
366
|
-
const state = useShellStore.getState();
|
|
367
|
-
const widgets = state.requestCapability(capability);
|
|
368
|
-
if (widgets.length === 0) return false;
|
|
369
|
-
|
|
370
|
-
const widget = widgets[0]; // Take best match (first for now)
|
|
371
|
-
const zone = widget.layoutConfig?.preferredZone || 'overlay';
|
|
372
|
-
|
|
373
|
-
// For morphological generic overlays
|
|
374
|
-
if (zone === 'overlay') {
|
|
375
|
-
state.openTransientOverlay({
|
|
376
|
-
widgetId: widget.id,
|
|
377
|
-
position: {
|
|
378
|
-
x: typeof window !== 'undefined' ? window.innerWidth / 2 - 200 : 100,
|
|
379
|
-
y: typeof window !== 'undefined' ? window.innerHeight / 2 - 150 : 100,
|
|
380
|
-
width: widget.layoutConfig?.initialSize?.w || 400,
|
|
381
|
-
height: widget.layoutConfig?.initialSize?.h || 300
|
|
382
|
-
},
|
|
383
|
-
props: { context: { renderMode: options?.renderMode || 'expanded', data: options?.data } }
|
|
384
|
-
});
|
|
385
|
-
return true;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
// Feature expansion point: handle rendering into 'main-canvas' or 'dock'
|
|
389
|
-
console.warn(`[Shell OS] Morphological view requested for capability ${capability} in zone ${zone}, but only 'overlay' is currently implemented for Intent-Based Registry.`);
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
})));
|
package/src/store/index.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Layout types and built-in presets.
|
|
3
|
-
* Extracted from useLayoutStore for reuse across components.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/** Slot component identifiers — maps to real React components */
|
|
7
|
-
export type SlotComponentId =
|
|
8
|
-
| 'workspace-chat' | 'debug' | 'graph-editor' | 'timeline-editor'
|
|
9
|
-
| 'canvas' | 'terminal' | 'app-sidebar' | 'widget-panel' | null;
|
|
10
|
-
|
|
11
|
-
/** The 6 content regions from the grid */
|
|
12
|
-
export type RegionId = 'R1' | 'R2' | 'R3' | 'R4' | 'R5' | 'R6';
|
|
13
|
-
|
|
14
|
-
/** Morph stage types */
|
|
15
|
-
export type MorphStageType = '2d' | '3d' | 'workbench' | 'liquid' | 'artifact' | 'custom';
|
|
16
|
-
|
|
17
|
-
export interface MorphStage {
|
|
18
|
-
type: MorphStageType;
|
|
19
|
-
label?: string;
|
|
20
|
-
data?: any;
|
|
21
|
-
componentId?: string;
|
|
22
|
-
sourceNodeId?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Tab in the T2 Tab Bar */
|
|
26
|
-
export interface LayoutTab {
|
|
27
|
-
id: string;
|
|
28
|
-
label: string;
|
|
29
|
-
icon?: string;
|
|
30
|
-
componentId: string;
|
|
31
|
-
closeable?: boolean;
|
|
32
|
-
data?: any;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** Saved layout preset */
|
|
36
|
-
export interface LayoutPreset {
|
|
37
|
-
id: string;
|
|
38
|
-
name: string;
|
|
39
|
-
slots: Record<RegionId, SlotComponentId>;
|
|
40
|
-
createdAt: number;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// ── Built-in Presets ──
|
|
44
|
-
|
|
45
|
-
const PRESET_CREATOR: Record<RegionId, SlotComponentId> = {
|
|
46
|
-
R1: 'workspace-chat', R2: null, R3: 'graph-editor', R4: 'debug', R5: null, R6: null,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const PRESET_PLAYER: Record<RegionId, SlotComponentId> = {
|
|
50
|
-
R1: 'workspace-chat', R2: null, R3: null, R4: null, R5: null, R6: null,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const PRESET_MINIMAL: Record<RegionId, SlotComponentId> = {
|
|
54
|
-
R1: null, R2: null, R3: null, R4: null, R5: null, R6: null,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const PRESET_STUDIO: Record<RegionId, SlotComponentId> = {
|
|
58
|
-
R1: 'app-sidebar', R2: null, R3: 'graph-editor', R4: 'terminal', R5: null, R6: null,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const BUILT_IN_PRESETS: Record<string, Record<RegionId, SlotComponentId>> = {
|
|
62
|
-
creator: PRESET_CREATOR,
|
|
63
|
-
player: PRESET_PLAYER,
|
|
64
|
-
minimal: PRESET_MINIMAL,
|
|
65
|
-
studio: PRESET_STUDIO,
|
|
66
|
-
};
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Playground shared types.
|
|
3
|
-
* Extracted from usePlaygroundStore for reuse in components and hooks.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type StepType = 'chat' | 'profile' | 'action';
|
|
7
|
-
|
|
8
|
-
export interface PlaygroundLog {
|
|
9
|
-
time: string;
|
|
10
|
-
msg: string;
|
|
11
|
-
type: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type ChatMessageType = 'text' | 'alert' | 'card' | 'canvas' | 'workflow' | 'ui-artifact' | 'tool' | 'error';
|
|
15
|
-
export type ChatMessageSender = 'user' | 'agent' | 'system' | 'tool';
|
|
16
|
-
|
|
17
|
-
// ── Thinking (Chain of Thought) ──
|
|
18
|
-
export interface ThinkingData {
|
|
19
|
-
content: string;
|
|
20
|
-
duration?: number;
|
|
21
|
-
isStreaming?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ── Tool Calls (inline in message) ──
|
|
25
|
-
export interface ToolCallInfo {
|
|
26
|
-
id: string;
|
|
27
|
-
name: string;
|
|
28
|
-
args?: unknown;
|
|
29
|
-
result?: unknown;
|
|
30
|
-
status: 'running' | 'success' | 'error';
|
|
31
|
-
startTime: number;
|
|
32
|
-
endTime?: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ── Execution Timeline Steps ──
|
|
36
|
-
export interface ExecutionStep {
|
|
37
|
-
type: 'thinking' | 'tool_call' | 'text_delta' | 'text_complete' | 'error';
|
|
38
|
-
label: string;
|
|
39
|
-
startTime: number;
|
|
40
|
-
endTime?: number;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// ── Code Blocks with Apply capability ──
|
|
44
|
-
export interface CodeBlockData {
|
|
45
|
-
code: string;
|
|
46
|
-
language?: string;
|
|
47
|
-
filePath?: string;
|
|
48
|
-
applyMode?: 'write' | 'search_replace' | 'insert_at' | 'append';
|
|
49
|
-
searchText?: string;
|
|
50
|
-
insertLine?: number;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface ChatMessage {
|
|
54
|
-
id: string;
|
|
55
|
-
type: ChatMessageType;
|
|
56
|
-
sender: ChatMessageSender;
|
|
57
|
-
text: string;
|
|
58
|
-
payload?: any;
|
|
59
|
-
timestamp: number;
|
|
60
|
-
actorId?: string;
|
|
61
|
-
actorName?: string;
|
|
62
|
-
uiSchema?: string;
|
|
63
|
-
// ── V2 Rich Content ──
|
|
64
|
-
thinking?: ThinkingData;
|
|
65
|
-
toolCalls?: ToolCallInfo[];
|
|
66
|
-
executionSteps?: ExecutionStep[];
|
|
67
|
-
codeBlocks?: CodeBlockData[];
|
|
68
|
-
// ── Intent metadata ──
|
|
69
|
-
detectedIntent?: {
|
|
70
|
-
type: string;
|
|
71
|
-
confidence: number;
|
|
72
|
-
matchedTokens?: string[];
|
|
73
|
-
resolvedAt: 'regex' | 'llm' | 'fallback';
|
|
74
|
-
};
|
|
75
|
-
morphInstanceId?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface SavedSequence {
|
|
79
|
-
id: string;
|
|
80
|
-
prompt: string;
|
|
81
|
-
brand: string;
|
|
82
|
-
duration: number;
|
|
83
|
-
keyframes: any[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface ChatInstance {
|
|
87
|
-
id: string;
|
|
88
|
-
title: string;
|
|
89
|
-
createdAt: number;
|
|
90
|
-
updatedAt: number;
|
|
91
|
-
preview?: string;
|
|
92
|
-
// ── V2: Identity & Context ──
|
|
93
|
-
shellType?: string; // Shell de salida asociada
|
|
94
|
-
icon?: string; // Emoji identificador
|
|
95
|
-
color?: string; // Color hex (#10b981)
|
|
96
|
-
model?: string; // Modelo Gemini usado
|
|
97
|
-
messageCount?: number; // Contador para preview
|
|
98
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useActionTimelineStore — Records all store actions in chronological order.
|
|
3
|
-
* Sprint AR: Event-sourcing style timeline for debugging.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
|
|
8
|
-
export interface TimelineEvent {
|
|
9
|
-
id: number;
|
|
10
|
-
timestamp: string;
|
|
11
|
-
storeName: string;
|
|
12
|
-
actionName: string;
|
|
13
|
-
data?: any;
|
|
14
|
-
level: 'info' | 'warn' | 'error';
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const MAX_EVENTS = 200;
|
|
18
|
-
let _evtId = 0;
|
|
19
|
-
|
|
20
|
-
interface ActionTimelineState {
|
|
21
|
-
events: TimelineEvent[];
|
|
22
|
-
isPaused: boolean;
|
|
23
|
-
filter: string;
|
|
24
|
-
|
|
25
|
-
addEvent: (event: Omit<TimelineEvent, 'id'>) => void;
|
|
26
|
-
clear: () => void;
|
|
27
|
-
togglePause: () => void;
|
|
28
|
-
setFilter: (filter: string) => void;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const useActionTimelineStore = create<ActionTimelineState>((set, get) => ({
|
|
32
|
-
events: [],
|
|
33
|
-
isPaused: false,
|
|
34
|
-
filter: '',
|
|
35
|
-
|
|
36
|
-
addEvent: (event) => {
|
|
37
|
-
if (get().isPaused) return;
|
|
38
|
-
const id = ++_evtId;
|
|
39
|
-
set(s => {
|
|
40
|
-
const events = [...s.events, { ...event, id }];
|
|
41
|
-
return { events: events.length > MAX_EVENTS ? events.slice(-MAX_EVENTS) : events };
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
clear: () => set({ events: [] }),
|
|
46
|
-
togglePause: () => set(s => ({ isPaused: !s.isPaused })),
|
|
47
|
-
setFilter: (filter) => set({ filter }),
|
|
48
|
-
}));
|