@decido/shell 4.0.1 → 4.0.3

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.
Files changed (38) hide show
  1. package/dist/CenterComposite-RPEGBKQU.mjs +1697 -0
  2. package/dist/DebugPanel-KEKDMHDN.mjs +14 -0
  3. package/dist/MorphShell-FKDBB7E5.mjs +14 -0
  4. package/dist/PlaygroundAppSidebar-ALYJJGAO.mjs +9 -0
  5. package/dist/PlaygroundChat-MI2KXMK6.mjs +15 -0
  6. package/dist/PlaygroundTerminal-5AV4BJAI.mjs +7 -0
  7. package/dist/PluginSandbox-WMNAUQOJ.mjs +188 -0
  8. package/dist/ReactFlowEditor-RTF2652X.mjs +3574 -0
  9. package/dist/ReactFlowEditor-ZW5MCN5Y.css +561 -0
  10. package/dist/TimelineEditor-N4HRMHTB.mjs +226 -0
  11. package/dist/WidgetSlotPanel-KJI4CHHD.mjs +11 -0
  12. package/dist/chunk-2YMI4N5I.mjs +2004 -0
  13. package/dist/chunk-3BZX7LF2.mjs +139 -0
  14. package/dist/chunk-3P4P3M54.mjs +136 -0
  15. package/dist/chunk-F3OTFHNO.mjs +40 -0
  16. package/dist/chunk-IMHORBTL.mjs +48 -0
  17. package/dist/chunk-JF5QSJYT.mjs +295 -0
  18. package/dist/chunk-LWMMFTJC.mjs +382 -0
  19. package/dist/chunk-MSVEFEXE.mjs +179 -0
  20. package/dist/chunk-OCHGY2MN.mjs +1662 -0
  21. package/dist/chunk-PMYAM764.mjs +813 -0
  22. package/dist/chunk-Q64KZXPK.mjs +43 -0
  23. package/dist/chunk-QHQW2HMU.mjs +155 -0
  24. package/dist/chunk-RWZ4BOIN.mjs +385 -0
  25. package/dist/chunk-UHT6FIYF.mjs +195 -0
  26. package/dist/chunk-UJCSKKID.mjs +30 -0
  27. package/dist/chunk-V3CYNPGL.mjs +8758 -0
  28. package/dist/chunk-VBPGEFNM.mjs +2381 -0
  29. package/dist/chunk-XMSU6UWD.mjs +158 -0
  30. package/dist/chunk-ZCCCBHE6.mjs +55 -0
  31. package/dist/index.css +561 -0
  32. package/dist/index.js +65130 -0
  33. package/dist/index.mjs +40248 -0
  34. package/dist/useIntentLens-LEQCAXCK.mjs +13 -0
  35. package/dist/useSuggestionsStore-4L2AIZ2D.mjs +7 -0
  36. package/dist/wasm-QFXGEYGP.mjs +81 -0
  37. package/package.json +27 -22
  38. package/src/index.ts +0 -97
@@ -0,0 +1,158 @@
1
+ // src/store/usePlaygroundStore.ts
2
+ import { create } from "zustand";
3
+ import { persist, createJSONStorage } from "zustand/middleware";
4
+ import { get, set as idbSet, del } from "idb-keyval";
5
+ var idbStorage = {
6
+ getItem: async (name) => await get(name) || null,
7
+ setItem: async (name, value) => {
8
+ await idbSet(name, value);
9
+ },
10
+ removeItem: async (name) => {
11
+ await del(name);
12
+ }
13
+ };
14
+ var usePlaygroundStore = create()(
15
+ persist(
16
+ (set) => ({
17
+ // 1. Core State
18
+ isBooting: true,
19
+ setIsBooting: (val) => set({ isBooting: val }),
20
+ step: "chat",
21
+ setStep: (val) => set({ step: val }),
22
+ selectedProfile: null,
23
+ setSelectedProfile: (val) => set({ selectedProfile: val }),
24
+ prototypeBrand: "decido",
25
+ setPrototypeBrand: (val) => set((state) => ({ prototypeBrand: typeof val === "function" ? val(state.prototypeBrand) : val })),
26
+ activeArtifactData: null,
27
+ setActiveArtifactData: (val) => set({ activeArtifactData: val }),
28
+ // Canvas & UI Integration
29
+ demoState: "idle",
30
+ setDemoState: (val) => set({ demoState: val }),
31
+ showCanvas: false,
32
+ setShowCanvas: (val) => set({ showCanvas: val }),
33
+ showChat: true,
34
+ setShowChat: (val) => set({ showChat: val }),
35
+ // 2. UI Toggles
36
+ isMuted: false,
37
+ setIsMuted: (val) => set((state) => ({ isMuted: typeof val === "function" ? val(state.isMuted) : val })),
38
+ selectedVoice: "Kore",
39
+ setSelectedVoice: (val) => set({ selectedVoice: val }),
40
+ isFullscreen: false,
41
+ setIsFullscreen: (val) => set({ isFullscreen: val }),
42
+ isVoiceActive: false,
43
+ setIsVoiceActive: (val) => set({ isVoiceActive: val }),
44
+ isSidebarOpen: false,
45
+ setIsSidebarOpen: (val) => set({ isSidebarOpen: val }),
46
+ isTerminalOpen: false,
47
+ setIsTerminalOpen: (val) => set({ isTerminalOpen: val }),
48
+ inputValue: "",
49
+ setInputValue: (val) => set({ inputValue: val }),
50
+ isCreatorMode: false,
51
+ setIsCreatorMode: (val) => set({ isCreatorMode: val }),
52
+ creatorViewMode: "graph",
53
+ setCreatorViewMode: (val) => set({ creatorViewMode: val }),
54
+ // 4. Logs Management
55
+ logs: [],
56
+ addLog: (msg, type = "info") => set((state) => ({
57
+ logs: [...state.logs.slice(-49), { time: (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour12: false }), msg, type }]
58
+ })),
59
+ setLogs: (val) => set((state) => ({ logs: typeof val === "function" ? val(state.logs) : val })),
60
+ // 5. Timelines
61
+ // Moved to useTimelineStore
62
+ // 6. Saved Sequences
63
+ savedSequences: [],
64
+ addSavedSequence: (seq) => set((state) => ({ savedSequences: [...state.savedSequences, seq] })),
65
+ removeSavedSequence: (id) => set((state) => ({ savedSequences: state.savedSequences.filter((s) => s.id !== id) })),
66
+ // 7. Chat Messages (per-instance isolation)
67
+ chatMessagesByInstance: {},
68
+ addChatMessage: (msg) => set((state) => {
69
+ const chatId = state.activeChatId || "_default";
70
+ const existing = state.chatMessagesByInstance[chatId] || [];
71
+ const newMsg = { ...msg, id: Math.random().toString(36).substring(2, 9), timestamp: Date.now() };
72
+ const updated = { ...state.chatMessagesByInstance, [chatId]: [...existing, newMsg] };
73
+ const chatInstances = state.chatInstances.map((c) => {
74
+ if (c.id === chatId) {
75
+ const preview = msg.sender === "user" ? msg.text.slice(0, 60) : c.preview;
76
+ const title = c.title === "Nueva conversaci\xF3n" && msg.sender === "user" ? msg.text.slice(0, 40) : c.title;
77
+ return { ...c, preview, title, messageCount: (c.messageCount || 0) + 1, updatedAt: Date.now() };
78
+ }
79
+ return c;
80
+ });
81
+ return { chatMessagesByInstance: updated, chatInstances };
82
+ }),
83
+ upsertChatMessage: (id, msg) => set((state) => {
84
+ const chatId = state.activeChatId || "_default";
85
+ const existing = state.chatMessagesByInstance[chatId] || [];
86
+ const idx = existing.findIndex((m) => m.id === id);
87
+ let updated;
88
+ if (idx >= 0) {
89
+ updated = [...existing];
90
+ updated[idx] = { ...updated[idx], ...msg };
91
+ } else {
92
+ updated = [...existing, msg];
93
+ }
94
+ return { chatMessagesByInstance: { ...state.chatMessagesByInstance, [chatId]: updated } };
95
+ }),
96
+ clearChatMessages: () => set((state) => {
97
+ const chatId = state.activeChatId || "_default";
98
+ return { chatMessagesByInstance: { ...state.chatMessagesByInstance, [chatId]: [] } };
99
+ }),
100
+ getChatMessages: () => {
101
+ const state = usePlaygroundStore.getState();
102
+ const chatId = state.activeChatId || "_default";
103
+ return state.chatMessagesByInstance[chatId] || [];
104
+ },
105
+ // 8. Chat Instances (Sidebar History)
106
+ chatInstances: [],
107
+ activeChatId: null,
108
+ addChatInstance: (title) => {
109
+ const id = Date.now().toString(36) + Math.random().toString(36).substring(2, 7);
110
+ const now = Date.now();
111
+ const model = localStorage.getItem("decido_gemini_model") || void 0;
112
+ const shellType = localStorage.getItem("decido_selected_shell") || void 0;
113
+ set((state) => ({
114
+ chatInstances: [{ id, title: title || "Nueva conversaci\xF3n", createdAt: now, updatedAt: now, model, shellType }, ...state.chatInstances],
115
+ activeChatId: id
116
+ }));
117
+ return id;
118
+ },
119
+ removeChatInstance: (id) => set((state) => {
120
+ const { [id]: _, ...rest } = state.chatMessagesByInstance;
121
+ return {
122
+ chatInstances: state.chatInstances.filter((c) => c.id !== id),
123
+ activeChatId: state.activeChatId === id ? state.chatInstances.find((c) => c.id !== id)?.id ?? null : state.activeChatId,
124
+ chatMessagesByInstance: rest
125
+ };
126
+ }),
127
+ renameChatInstance: (id, title) => set((state) => ({
128
+ chatInstances: state.chatInstances.map((c) => c.id === id ? { ...c, title, updatedAt: Date.now() } : c)
129
+ })),
130
+ setActiveChatId: (id) => set({ activeChatId: id })
131
+ }),
132
+ {
133
+ name: "playground-storage",
134
+ storage: createJSONStorage(() => idbStorage),
135
+ partialize: (state) => ({
136
+ showChat: state.showChat,
137
+ logs: state.logs,
138
+ inputValue: state.inputValue,
139
+ prototypeBrand: state.prototypeBrand,
140
+ isCreatorMode: state.isCreatorMode,
141
+ isMuted: state.isMuted,
142
+ selectedVoice: state.selectedVoice,
143
+ isTerminalOpen: state.isTerminalOpen,
144
+ isSidebarOpen: state.isSidebarOpen,
145
+ step: state.step,
146
+ selectedProfile: state.selectedProfile,
147
+ savedSequences: state.savedSequences,
148
+ chatMessagesByInstance: state.chatMessagesByInstance,
149
+ chatInstances: state.chatInstances,
150
+ activeChatId: state.activeChatId
151
+ })
152
+ }
153
+ )
154
+ );
155
+
156
+ export {
157
+ usePlaygroundStore
158
+ };
@@ -0,0 +1,55 @@
1
+ import {
2
+ dlog
3
+ } from "./chunk-3P4P3M54.mjs";
4
+
5
+ // src/store/useMorphologyStore.ts
6
+ import { create } from "zustand";
7
+ var componentRegistry = /* @__PURE__ */ new Map();
8
+ var useMorphologyStore = create((set, get) => ({
9
+ activeStage: null,
10
+ stageHistory: [],
11
+ setStage: (stage) => {
12
+ dlog.morph(`setStage \u2192 ${stage?.type || "null"}${stage?.label ? ` (${stage.label})` : ""}`, stage);
13
+ set({ activeStage: stage });
14
+ },
15
+ pushStage: (stage) => {
16
+ const { activeStage, stageHistory } = get();
17
+ dlog.morph(`pushStage \u2192 ${stage.type}${stage.label ? ` (${stage.label})` : ""} | depth: ${stageHistory.length + 1}`, { stage, previousStage: activeStage?.type });
18
+ const newHistory = activeStage ? [...stageHistory, activeStage] : stageHistory;
19
+ set({ activeStage: stage, stageHistory: newHistory });
20
+ },
21
+ popStage: () => {
22
+ const { stageHistory, activeStage } = get();
23
+ if (stageHistory.length === 0) {
24
+ dlog.morph("popStage \u2192 null (history empty)", { poppedStage: activeStage?.type }, "warn");
25
+ set({ activeStage: null });
26
+ return;
27
+ }
28
+ const prev = stageHistory[stageHistory.length - 1];
29
+ dlog.morph(`popStage \u2192 ${prev.type}${prev.label ? ` (${prev.label})` : ""} | depth: ${stageHistory.length - 1}`, { poppedStage: activeStage?.type, restoredStage: prev.type });
30
+ set({
31
+ activeStage: prev,
32
+ stageHistory: stageHistory.slice(0, -1)
33
+ });
34
+ },
35
+ clearStages: () => {
36
+ dlog.morph("clearStages \u2192 all stages cleared", { previousDepth: get().stageHistory.length });
37
+ set({ activeStage: null, stageHistory: [] });
38
+ }
39
+ }));
40
+ function registerMorphComponent(id, component) {
41
+ componentRegistry.set(id, component);
42
+ }
43
+ function getMorphComponent(id) {
44
+ return componentRegistry.get(id);
45
+ }
46
+ function getRegisteredMorphComponents() {
47
+ return Array.from(componentRegistry.keys());
48
+ }
49
+
50
+ export {
51
+ useMorphologyStore,
52
+ registerMorphComponent,
53
+ getMorphComponent,
54
+ getRegisteredMorphComponents
55
+ };