@trops/dash-core 0.1.281 → 0.1.283

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 CHANGED
@@ -98,6 +98,85 @@ const {
98
98
  └── utils/ File, color, browser utilities
99
99
  ```
100
100
 
101
+ ### Renderer Layer (`src/`)
102
+
103
+ Platform-agnostic UI framework.
104
+
105
+ | Module | Key Files | Purpose |
106
+ |---|---|---|
107
+ | **ComponentManager** | `ComponentManager.js` | Widget/workspace registration, config resolution |
108
+ | **Context** | `Context/` | AppContext, DashboardContext, ThemeWrapper, ProviderContext, WidgetContext, WorkspaceContext |
109
+ | **Hooks** | `hooks/` | useDashboard, useMcpProvider, useWidgetProviders, useInstalledWidgets, useWidgetEvents, useRegistrySearch |
110
+ | **Models** | `Models/` | DashboardModel, LayoutModel, ThemeModel, ComponentConfigModel, SettingsModel, etc. |
111
+ | **Api** | `Api/` | DashboardApi, ElectronDashboardApi (typed), WidgetApi, ThemeApi, MockDashboardApi |
112
+ | **Components** | `Components/` | Dashboard, Layout, Settings, Navigation, Theme, Provider, Menu, Workspace |
113
+ | **Widget** | `Widget/` | Widget, WidgetFactory, ExternalWidget |
114
+ | **Utils** | `utils/` | widgetBundleLoader, layout, validation, mcpUtils, dragTypes, resolveIcon, themeGenerator, DynamicWidgetLoader, WidgetRegistry, plugin-loader |
115
+
116
+ ### Electron Layer (`electron/`)
117
+
118
+ Main process controllers, APIs, and widget pipeline.
119
+
120
+ | Module | Key Files | Purpose |
121
+ |---|---|---|
122
+ | **Controllers** | `controller/` | providerController, mcpController, workspaceController, themeController, settingsController, layoutController, dataController, registryController, secureStoreController, dialogController, algoliaController, openaiController, menuItemsController, pluginController |
123
+ | **APIs** | `api/` | IPC handlers for each controller + `mainApi.js` (createMainApi factory) |
124
+ | **Events** | `events/` | Event channel definitions for each module |
125
+ | **Widget Pipeline** | `widgetRegistry.js`, `widgetCompiler.js`, `dynamicWidgetLoader.js` | Install, compile (esbuild), and load external widgets |
126
+ | **MCP** | `mcp/mcpServerCatalog.json` | MCP server definitions (transport, command, args, env mapping) |
127
+
128
+ ### Directory Structure
129
+
130
+ ```
131
+ dash-core/
132
+ ├── src/ # Renderer layer
133
+ │ ├── Api/
134
+ │ ├── ComponentManager.js
135
+ │ ├── Components/
136
+ │ │ ├── Dashboard/
137
+ │ │ ├── Layout/ # LayoutBuilder, LayoutContainer, LayoutGridContainer
138
+ │ │ ├── Navigation/
139
+ │ │ ├── Settings/
140
+ │ │ ├── Theme/
141
+ │ │ ├── Provider/
142
+ │ │ ├── Menu/
143
+ │ │ └── Workspace/
144
+ │ ├── Context/
145
+ │ ├── DashboardPublisher.js
146
+ │ ├── ErrorBoundary.js
147
+ │ ├── Models/
148
+ │ ├── Widget/
149
+ │ ├── hooks/
150
+ │ └── utils/
151
+ ├── electron/ # Electron layer
152
+ │ ├── api/
153
+ │ │ └── mainApi.js # createMainApi factory
154
+ │ ├── controller/
155
+ │ ├── events/
156
+ │ ├── mcp/
157
+ │ │ └── mcpServerCatalog.json
158
+ │ ├── utils/
159
+ │ ├── widgetRegistry.js
160
+ │ ├── widgetCompiler.js
161
+ │ └── dynamicWidgetLoader.js
162
+ ├── dist/ # Build output — never edit manually
163
+ │ ├── index.js # Renderer CJS
164
+ │ ├── index.esm.js # Renderer ESM
165
+ │ └── electron/
166
+ │ └── index.js # Electron CJS
167
+ ├── docs/ # Documentation
168
+ │ ├── requirements/ # PRDs and feature specs
169
+ │ │ └── prd/ # Product Requirements Documents
170
+ │ └── *.md # Technical docs
171
+ ├── .github/workflows/
172
+ │ └── release-package.yml # Auto-publish on push to master
173
+ ├── package.json
174
+ ├── rollup.config.renderer.mjs
175
+ ├── rollup.config.electron.mjs
176
+ ├── babel.config.json
177
+ └── tsconfig.json
178
+ ```
179
+
101
180
  ## Key Patterns
102
181
 
103
182
  ### createMainApi Factory
@@ -128,17 +207,67 @@ import { ThemeContext } from "@trops/dash-react";
128
207
  import { ThemeContext } from "./Context/ThemeContext";
129
208
  ```
130
209
 
210
+ ### MCP Provider Lifecycle
211
+
212
+ 1. Widget mounts -> `useMcpProvider("slack")` hook runs
213
+ 2. Hook reads provider from `AppContext.providers` (with `mcpConfig` and credentials)
214
+ 3. Calls `dashApi.mcpStartServer()` -> IPC -> `mcpController` spawns stdio child process
215
+ 4. Server returns available tools -> hook filters by `allowedTools` if specified
216
+ 5. Widget calls `callTool("send_message", args)` -> 30-second timeout per call
217
+ 6. On unmount, hook calls `mcpStopServer()` to clean up child process
218
+
219
+ ### ComponentManager
220
+
221
+ - `registerContainerTypes(LayoutContainer, LayoutGridContainer)` -- auto-called on import
222
+ - `registerWidget(config, name)` / `config(name)` for widget CRUD
223
+ - `_sourcePackage` field set on external widget configs by `registerBundleConfigs`
224
+ - `loadWidgetComponents` enriches registry entries with `.dash.js` metadata
225
+
226
+ ### Widget Bundle Loading
227
+
228
+ - `widgetBundleLoader.js` evaluates CJS bundles with `new Function()` + require shim
229
+ - **Critical:** MODULE_MAP must include `@trops/dash-core` so external widgets share the ComponentManager singleton
230
+ - `extractWidgetConfigs` requires `typeof entry.component === "function"`
231
+
232
+ ### Layout System
233
+
234
+ - **Grid path vs non-grid path**: Grid cells use `layout.find()` which returns raw items WITHOUT LayoutModel processing.
235
+ - **LayoutModel**: Refreshes `eventHandlers`/`events` from `ComponentManager.config()` -- critical for keeping config fields up-to-date in the edit modal.
236
+
237
+ ## Key Files
238
+
239
+ | File | Purpose |
240
+ |---|---|
241
+ | `src/index.js` | Main renderer export + auto-registration |
242
+ | `electron/index.js` | Main electron export |
243
+ | `electron/api/mainApi.js` | `createMainApi(extensions)` factory |
244
+ | `src/ComponentManager.js` | Widget registration system |
245
+ | `src/Context/ThemeWrapper.js` | Theme provider (imports ThemeContext from @trops/dash-react) |
246
+ | `src/Context/DashboardWrapper.js` | Dashboard context + provider passing |
247
+ | `src/hooks/useMcpProvider.js` | MCP server connection and tool calling |
248
+ | `src/hooks/useWidgetProviders.js` | Widget provider resolution |
249
+ | `src/hooks/useInstalledWidgets.js` | Merges builtin + installed widgets |
250
+ | `src/utils/widgetBundleLoader.js` | CJS bundle evaluation in renderer |
251
+ | `src/Models/LayoutModel.js` | Layout processing, refreshes events from ComponentManager |
252
+ | `src/Models/ComponentConfigModel.js` | Normalizes widget config with defaults |
253
+ | `electron/controller/providerController.js` | Provider CRUD + encryption |
254
+ | `electron/controller/mcpController.js` | MCP server spawn/stop/call |
255
+ | `electron/widgetRegistry.js` | Widget install/uninstall persistence |
256
+ | `electron/widgetCompiler.js` | esbuild compilation pipeline |
257
+ | `electron/mcp/mcpServerCatalog.json` | MCP server definitions |
258
+
131
259
  ## Documentation
132
260
 
133
261
  See [docs/INDEX.md](docs/INDEX.md) for the full documentation index:
134
262
 
135
- - [Widget System](docs/WIDGET_SYSTEM.md) Architecture, auto-registration, hot reload
136
- - [Widget API](docs/WIDGET_API.md) Management methods reference
137
- - [Widget Development](docs/WIDGET_DEVELOPMENT.md) Create and test widgets
138
- - [Widget Registry](docs/WIDGET_REGISTRY.md) Packaging and distribution
139
- - [Provider Architecture](docs/PROVIDER_ARCHITECTURE.md) Three-tier storage model
140
- - [Widget Provider Configuration](docs/WIDGET_PROVIDER_CONFIGURATION.md) Configure providers in widgets
141
- - [Testing](docs/TESTING.md) Provider and widget testing guides
263
+ - [Widget System](docs/WIDGET_SYSTEM.md) -- Architecture, auto-registration, hot reload
264
+ - [Widget API](docs/WIDGET_API.md) -- Management methods reference
265
+ - [Widget Development](docs/WIDGET_DEVELOPMENT.md) -- Create and test widgets
266
+ - [Widget Registry](docs/WIDGET_REGISTRY.md) -- Packaging and distribution
267
+ - [Provider Architecture](docs/PROVIDER_ARCHITECTURE.md) -- Three-tier storage model
268
+ - [Widget Provider Configuration](docs/WIDGET_PROVIDER_CONFIGURATION.md) -- Configure providers in widgets
269
+ - [Testing](docs/TESTING.md) -- Provider and widget testing guides
270
+ - [Product Requirements](docs/requirements/README.md) -- PRDs and feature specs
142
271
 
143
272
  ## Related Packages
144
273
 
@@ -165,6 +294,40 @@ npm run prettify
165
294
 
166
295
  Publishing is automated via GitHub Actions on push to `master`.
167
296
 
297
+ ### Build Output Verification
298
+
299
+ After any build, always verify all three output files exist:
300
+
301
+ ```bash
302
+ ls dist/index.js dist/index.esm.js dist/electron/index.js
303
+ ```
304
+
305
+ A build that exits 0 but produces incomplete output is a silent failure.
306
+
307
+ ### Rollup Configuration
308
+
309
+ **Renderer** (`rollup.config.renderer.mjs`):
310
+ - Input: `src/index.js`
311
+ - Output: CJS (`dist/index.js`) + ESM (`dist/index.esm.js`)
312
+ - Externals: react, react-dom, @trops/dash-react, @fortawesome/\*, @babel/runtime
313
+
314
+ **Electron** (`rollup.config.electron.mjs`):
315
+ - Input: `electron/index.js`
316
+ - Output: CJS only (`dist/electron/index.js`)
317
+ - Externals: electron, Node builtins, esbuild, @anthropic-ai/sdk, @modelcontextprotocol/sdk, algoliasearch, openai, etc.
318
+
319
+ ## Troubleshooting
320
+
321
+ **Build exits 0 but dist files are missing:** Silent rollup failure -- check for unresolved imports or circular dependencies.
322
+
323
+ **`dist/electron/index.js` missing after build:** Electron rollup config may have failed silently. Run `npm run build:electron` alone to isolate.
324
+
325
+ **Consumer app breaks after a dash-core change:** Fix root cause in dash-core, don't modify dash-electron as workaround.
326
+
327
+ **ThemeContext not updating in consumer:** Verify ThemeContext is imported from `@trops/dash-react` everywhere.
328
+
329
+ **MCP tools not appearing in widget:** Check that `AppContext.providers` (not `DashboardContext.providers`) is the source.
330
+
168
331
  ## License
169
332
 
170
333
  MIT
package/dist/index.esm.js CHANGED
@@ -6416,7 +6416,7 @@ var WizardDiscoverStep = function WizardDiscoverStep(_ref) {
6416
6416
  onClick: function onClick() {
6417
6417
  return handleToggleCategory(tag);
6418
6418
  },
6419
- className: filters.categories.includes(tag) ? "ring-1 ring-blue-400" : ""
6419
+ active: filters.categories.includes(tag)
6420
6420
  }, tag);
6421
6421
  })
6422
6422
  })]
@@ -6433,7 +6433,7 @@ var WizardDiscoverStep = function WizardDiscoverStep(_ref) {
6433
6433
  onClick: function onClick() {
6434
6434
  return handleToggleProvider(prov.key);
6435
6435
  },
6436
- className: filters.providers.includes(prov.key) ? "ring-1 ring-blue-400" : ""
6436
+ active: filters.providers.includes(prov.key)
6437
6437
  }, prov.key);
6438
6438
  })
6439
6439
  })]