| 214 | |
| 215 | /** Assemble the SDK object exposed on window for plugin bundles. */ |
| 216 | export function buildSDK() { |
| 217 | return { |
| 218 | sdkVersion: "1.2.0", |
| 219 | host: "tracedecay-standalone", |
| 220 | React, |
| 221 | hooks: { useState, useEffect, useCallback, useMemo, useRef, useContext, createContext }, |
| 222 | api: {}, |
| 223 | fetchJSON, |
| 224 | authedFetch, |
| 225 | buildWsUrl: (p) => p, |
| 226 | buildWsAuthParam: () => ["", ""], |
| 227 | /** |
| 228 | * Populated by the shell after a successful GET /api/capabilities response. |
| 229 | * Plugin tabs may read this to feature-gate behavior: |
| 230 | * const caps = window.__HERMES_PLUGIN_SDK__.capabilities; |
| 231 | * if (caps?.curation) { ... } |
| 232 | * Null until the first successful fetch. |
| 233 | */ |
| 234 | capabilities: null, |
| 235 | projects: { |
| 236 | getSelectedProjectId, |
| 237 | subscribe: subscribeSelectedProject, |
| 238 | }, |
| 239 | components: { |
| 240 | Card, |
| 241 | CardHeader, |
| 242 | CardTitle, |
| 243 | CardContent, |
| 244 | Badge, |
| 245 | Button, |
| 246 | Checkbox, |
| 247 | Input, |
| 248 | Label, |
| 249 | Select, |
| 250 | SelectOption, |
| 251 | Separator, |
| 252 | Tabs, |
| 253 | TabsList, |
| 254 | TabsTrigger, |
| 255 | PluginSlot, |
| 256 | }, |
| 257 | utils: { cn, timeAgo, isoTimeAgo, makeSequence }, |
| 258 | useI18n, |
| 259 | }; |
| 260 | } |