@seed-ship/mcp-ui-solid 1.0.2 → 1.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.
- package/dist/components/GenerativeUIErrorBoundary.d.ts +59 -0
- package/dist/components/GenerativeUIErrorBoundary.d.ts.map +1 -0
- package/dist/components/StreamingUIRenderer.d.ts +32 -0
- package/dist/components/StreamingUIRenderer.d.ts.map +1 -0
- package/dist/components/UIResourceRenderer.d.ts +43 -0
- package/dist/components/UIResourceRenderer.d.ts.map +1 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useStreamingUI.d.ts +79 -0
- package/dist/hooks/useStreamingUI.d.ts.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/services/component-registry.d.ts +50 -0
- package/dist/services/component-registry.d.ts.map +1 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/validation.d.ts +48 -0
- package/dist/services/validation.d.ts.map +1 -0
- package/dist/types/index.d.ts +250 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +31 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generative UI Error Boundary with Telemetry
|
|
3
|
+
* Phase 0: Error isolation + structured logging
|
|
4
|
+
*
|
|
5
|
+
* Features:
|
|
6
|
+
* - Component-level error isolation
|
|
7
|
+
* - Structured logging with context
|
|
8
|
+
* - Performance timing
|
|
9
|
+
* - Retry mechanism
|
|
10
|
+
* - User-friendly fallback UI
|
|
11
|
+
*/
|
|
12
|
+
import { Component } from 'solid-js';
|
|
13
|
+
import type { RendererError } from '../types';
|
|
14
|
+
/**
|
|
15
|
+
* Props for GenerativeUIErrorBoundary
|
|
16
|
+
*/
|
|
17
|
+
export interface GenerativeUIErrorBoundaryProps {
|
|
18
|
+
/**
|
|
19
|
+
* Component identifier for telemetry
|
|
20
|
+
*/
|
|
21
|
+
componentId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Component type for context
|
|
24
|
+
*/
|
|
25
|
+
componentType: string;
|
|
26
|
+
/**
|
|
27
|
+
* Error callback
|
|
28
|
+
*/
|
|
29
|
+
onError?: (error: RendererError) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Allow retry on error
|
|
32
|
+
*/
|
|
33
|
+
allowRetry?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Child components to wrap
|
|
36
|
+
*/
|
|
37
|
+
children: any;
|
|
38
|
+
/**
|
|
39
|
+
* Custom fallback UI (optional)
|
|
40
|
+
*/
|
|
41
|
+
fallback?: (error: Error, retry?: () => void) => any;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Generative UI Error Boundary Component
|
|
45
|
+
*/
|
|
46
|
+
export declare const GenerativeUIErrorBoundary: Component<GenerativeUIErrorBoundaryProps>;
|
|
47
|
+
/**
|
|
48
|
+
* Performance monitoring wrapper
|
|
49
|
+
* Logs render times for performance analysis
|
|
50
|
+
*/
|
|
51
|
+
export declare function withPerformanceMonitoring<P extends {
|
|
52
|
+
componentId: string;
|
|
53
|
+
componentType: string;
|
|
54
|
+
}>(WrappedComponent: Component<P>): (props: P) => import("solid-js").JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Hook to track component lifecycle events
|
|
57
|
+
*/
|
|
58
|
+
export declare function useComponentTelemetry(componentId: string, componentType: string): () => void;
|
|
59
|
+
//# sourceMappingURL=GenerativeUIErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenerativeUIErrorBoundary.d.ts","sourceRoot":"","sources":["../../src/components/GenerativeUIErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAqC,MAAM,UAAU,CAAA;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAI7C;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAExC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAA;IAEb;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM,IAAI,KAAK,GAAG,CAAA;CACrD;AAwDD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,CAAC,8BAA8B,CAkF/E,CAAA;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,EAChG,gBAAgB,EAAE,SAAS,CAAC,CAAC,CAAC,IAEtB,OAAO,CAAC,oCAkCjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAkB/E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StreamingUIRenderer Component - Phase 2
|
|
3
|
+
*
|
|
4
|
+
* Renders streaming dashboard components with skeleton states and progress indicators.
|
|
5
|
+
* Uses the useStreamingUI hook for SSE connection and state management.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Skeleton loading states while components stream
|
|
9
|
+
* - Progress bar and status messages
|
|
10
|
+
* - Smooth component animations on arrival
|
|
11
|
+
* - Error handling with retry capability
|
|
12
|
+
* - Responsive 12-column grid layout
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <StreamingUIRenderer
|
|
17
|
+
* query="Show me revenue trends"
|
|
18
|
+
* spaceIds={['uuid1', 'uuid2']}
|
|
19
|
+
* onComplete={(metadata) => console.log('Done!', metadata)}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import { type UseStreamingUIOptions } from '../hooks/useStreamingUI';
|
|
24
|
+
import type { RendererError } from '../types';
|
|
25
|
+
export interface StreamingUIRendererProps extends UseStreamingUIOptions {
|
|
26
|
+
class?: string;
|
|
27
|
+
showProgress?: boolean;
|
|
28
|
+
showMetadata?: boolean;
|
|
29
|
+
onRenderError?: (error: RendererError) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function StreamingUIRenderer(props: StreamingUIRendererProps): import("solid-js").JSX.Element;
|
|
32
|
+
//# sourceMappingURL=StreamingUIRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StreamingUIRenderer.d.ts","sourceRoot":"","sources":["../../src/components/StreamingUIRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AACpF,OAAO,KAAK,EAAe,aAAa,EAAE,MAAM,UAAU,CAAA;AAI1D,MAAM,WAAW,wBAAyB,SAAQ,qBAAqB;IACrE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CAC/C;AAkED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,kCA2KlE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UI Resource Renderer Component
|
|
3
|
+
* Phase 0: Foundation with iframe sandbox and composite grid support
|
|
4
|
+
*
|
|
5
|
+
* Security features:
|
|
6
|
+
* - Sandboxed iframes for untrusted content
|
|
7
|
+
* - CSP enforcement via middleware
|
|
8
|
+
* - XSS prevention with DOMPurify
|
|
9
|
+
* - Domain whitelist validation
|
|
10
|
+
*
|
|
11
|
+
* Performance:
|
|
12
|
+
* - Lazy loading with Intersection Observer
|
|
13
|
+
* - Render timeout enforcement
|
|
14
|
+
* - Error boundaries for isolation
|
|
15
|
+
*/
|
|
16
|
+
import { Component } from 'solid-js';
|
|
17
|
+
import type { UIComponent, UILayout, RendererError } from '../types';
|
|
18
|
+
/**
|
|
19
|
+
* Props for UIResourceRenderer
|
|
20
|
+
*/
|
|
21
|
+
export interface UIResourceRendererProps {
|
|
22
|
+
/**
|
|
23
|
+
* Single component or full layout to render
|
|
24
|
+
*/
|
|
25
|
+
content: UIComponent | UILayout;
|
|
26
|
+
/**
|
|
27
|
+
* Lazy loading (default: true)
|
|
28
|
+
*/
|
|
29
|
+
lazyLoad?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Error callback
|
|
32
|
+
*/
|
|
33
|
+
onError?: (error: RendererError) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Custom CSS class
|
|
36
|
+
*/
|
|
37
|
+
class?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Main UIResourceRenderer component
|
|
41
|
+
*/
|
|
42
|
+
export declare const UIResourceRenderer: Component<UIResourceRendererProps>;
|
|
43
|
+
//# sourceMappingURL=UIResourceRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIResourceRenderer.d.ts","sourceRoot":"","sources":["../../src/components/UIResourceRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAoC,MAAM,UAAU,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAiB,MAAM,UAAU,CAAA;AAInF;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,WAAW,GAAG,QAAQ,CAAA;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;IAExC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AA8QD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,uBAAuB,CA6CjE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP UI Solid - Components
|
|
3
|
+
*
|
|
4
|
+
* SolidJS components for rendering MCP-generated UI resources
|
|
5
|
+
*/
|
|
6
|
+
export { UIResourceRenderer } from './UIResourceRenderer';
|
|
7
|
+
export type { UIResourceRendererProps } from './UIResourceRenderer';
|
|
8
|
+
export { StreamingUIRenderer } from './StreamingUIRenderer';
|
|
9
|
+
export type { StreamingUIRendererProps } from './StreamingUIRenderer';
|
|
10
|
+
export { GenerativeUIErrorBoundary } from './GenerativeUIErrorBoundary';
|
|
11
|
+
export type { GenerativeUIErrorBoundaryProps } from './GenerativeUIErrorBoundary';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,YAAY,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP UI Solid - Hooks
|
|
3
|
+
*
|
|
4
|
+
* SolidJS hooks for managing UI resource state and streaming
|
|
5
|
+
*/
|
|
6
|
+
export { useStreamingUI } from './useStreamingUI';
|
|
7
|
+
export type { UseStreamingUIOptions, StreamingUIState, StreamProgress, StreamError, CompleteMetadata, } from './useStreamingUI';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useStreamingUI Hook - Phase 2
|
|
3
|
+
*
|
|
4
|
+
* Client-side hook for consuming the streaming generative UI endpoint.
|
|
5
|
+
* Handles SSE connection, component buffering, reordering, and error handling.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - SSE connection with automatic reconnection
|
|
9
|
+
* - Component buffering and reordering by sequenceId
|
|
10
|
+
* - Progress tracking and loading states
|
|
11
|
+
* - Error handling with recovery attempts
|
|
12
|
+
* - Cleanup on unmount
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { components, isLoading, error, progress } = useStreamingUI({
|
|
17
|
+
* query: 'Show me revenue trends',
|
|
18
|
+
* spaceIds: ['uuid1', 'uuid2'],
|
|
19
|
+
* onComplete: (metadata) => console.log('Done!', metadata),
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
import type { UIComponent } from '../types';
|
|
24
|
+
export interface UseStreamingUIOptions {
|
|
25
|
+
query: string;
|
|
26
|
+
spaceIds?: string[];
|
|
27
|
+
sessionId?: string;
|
|
28
|
+
options?: {
|
|
29
|
+
useCache?: boolean;
|
|
30
|
+
useLLM?: boolean;
|
|
31
|
+
maxComponents?: number;
|
|
32
|
+
preferredComponents?: Array<'chart' | 'table' | 'metric' | 'text'>;
|
|
33
|
+
};
|
|
34
|
+
onComplete?: (metadata: CompleteMetadata) => void;
|
|
35
|
+
onError?: (error: StreamError) => void;
|
|
36
|
+
onComponentReceived?: (component: UIComponent) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface StreamingUIState {
|
|
39
|
+
components: UIComponent[];
|
|
40
|
+
isLoading: boolean;
|
|
41
|
+
isStreaming: boolean;
|
|
42
|
+
error: StreamError | null;
|
|
43
|
+
progress: StreamProgress;
|
|
44
|
+
metadata: CompleteMetadata | null;
|
|
45
|
+
}
|
|
46
|
+
export interface StreamProgress {
|
|
47
|
+
receivedCount: number;
|
|
48
|
+
totalCount: number | null;
|
|
49
|
+
message: string;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CompleteMetadata {
|
|
53
|
+
layoutId: string;
|
|
54
|
+
componentsCount: number;
|
|
55
|
+
executionTimeMs: number;
|
|
56
|
+
firstTokenMs: number;
|
|
57
|
+
provider: 'groq' | 'mock';
|
|
58
|
+
model: string;
|
|
59
|
+
tokensUsed?: number;
|
|
60
|
+
costUSD?: number;
|
|
61
|
+
cached: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface StreamError {
|
|
64
|
+
error: string;
|
|
65
|
+
message: string;
|
|
66
|
+
componentId?: string;
|
|
67
|
+
recoverable: boolean;
|
|
68
|
+
}
|
|
69
|
+
export declare function useStreamingUI(options: UseStreamingUIOptions): {
|
|
70
|
+
components: import("solid-js").Accessor<UIComponent[]>;
|
|
71
|
+
isLoading: import("solid-js").Accessor<boolean>;
|
|
72
|
+
isStreaming: import("solid-js").Accessor<boolean>;
|
|
73
|
+
error: import("solid-js").Accessor<StreamError | null>;
|
|
74
|
+
progress: import("solid-js").Accessor<StreamProgress>;
|
|
75
|
+
metadata: import("solid-js").Accessor<CompleteMetadata | null>;
|
|
76
|
+
startStreaming: () => void;
|
|
77
|
+
stopStreaming: () => void;
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=useStreamingUI.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStreamingUI.d.ts","sourceRoot":"","sources":["../../src/hooks/useStreamingUI.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAS3C,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,mBAAmB,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAA;KACnE,CAAA;IACD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACjD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,CAAA;CACvD;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,WAAW,EAAE,CAAA;IACzB,SAAS,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;IACzB,QAAQ,EAAE,cAAc,CAAA;IACxB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAA;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,aAAa,EAAE,MAAM,CAAA;IACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;CACrB;AAuCD,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB;;;;;;;;;EAsU5D"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @seed-ship/mcp-ui-solid
|
|
3
|
+
*
|
|
4
|
+
* SolidJS components and hooks for rendering MCP-generated UI resources
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import { UIResourceRenderer, StreamingUIRenderer } from '@seed-ship/mcp-ui-solid'
|
|
9
|
+
* import { useStreamingUI } from '@seed-ship/mcp-ui-solid/hooks'
|
|
10
|
+
* import type { UIComponent, UILayout } from '@seed-ship/mcp-ui-solid/types'
|
|
11
|
+
*
|
|
12
|
+
* // Static rendering
|
|
13
|
+
* function Dashboard() {
|
|
14
|
+
* const layout = { components: [...] }
|
|
15
|
+
* return <UIResourceRenderer content={layout} />
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* // Streaming rendering
|
|
19
|
+
* function StreamingDashboard() {
|
|
20
|
+
* return (
|
|
21
|
+
* <StreamingUIRenderer
|
|
22
|
+
* query="Show me revenue trends"
|
|
23
|
+
* spaceIds={['space-1']}
|
|
24
|
+
* onComplete={(metadata) => console.log('Done!', metadata)}
|
|
25
|
+
* />
|
|
26
|
+
* )
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export { UIResourceRenderer, StreamingUIRenderer, GenerativeUIErrorBoundary } from './components';
|
|
31
|
+
export type { UIResourceRendererProps, StreamingUIRendererProps, GenerativeUIErrorBoundaryProps, } from './components';
|
|
32
|
+
export { useStreamingUI } from './hooks';
|
|
33
|
+
export type { UseStreamingUIOptions, StreamingUIState, StreamProgress, StreamError, CompleteMetadata, } from './hooks';
|
|
34
|
+
export type { UIComponent, UILayout, GridPosition, ComponentType, RendererError, ChartComponentParams, TableComponentParams, MetricComponentParams, TextComponentParams, } from './types';
|
|
35
|
+
export { validateComponent, validateLayout, DEFAULT_RESOURCE_LIMITS, ComponentRegistry, } from './services';
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AAEjG,YAAY,EACV,uBAAuB,EACvB,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAExC,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,gBAAgB,GACjB,MAAM,SAAS,CAAA;AAGhB,YAAY,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Registry Service
|
|
3
|
+
* Phase 0: Static registry with Quickchart and Table definitions
|
|
4
|
+
* Phase 1: Dynamic registry populated from /api/mcp/tools/list
|
|
5
|
+
*
|
|
6
|
+
* Provides component schemas for LLM prompt engineering
|
|
7
|
+
*/
|
|
8
|
+
import type { ComponentRegistryEntry, ComponentType } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Quickchart Component Registry Entry
|
|
11
|
+
* Based on Quickchart API documentation
|
|
12
|
+
*/
|
|
13
|
+
export declare const QuickchartRegistry: ComponentRegistryEntry;
|
|
14
|
+
/**
|
|
15
|
+
* Table Component Registry Entry
|
|
16
|
+
*/
|
|
17
|
+
export declare const TableRegistry: ComponentRegistryEntry;
|
|
18
|
+
/**
|
|
19
|
+
* Metric Card Component Registry Entry
|
|
20
|
+
*/
|
|
21
|
+
export declare const MetricRegistry: ComponentRegistryEntry;
|
|
22
|
+
/**
|
|
23
|
+
* Text Component Registry Entry
|
|
24
|
+
*/
|
|
25
|
+
export declare const TextRegistry: ComponentRegistryEntry;
|
|
26
|
+
/**
|
|
27
|
+
* Component Registry - All components indexed by type
|
|
28
|
+
*/
|
|
29
|
+
export declare const ComponentRegistry: Map<ComponentType, ComponentRegistryEntry>;
|
|
30
|
+
/**
|
|
31
|
+
* Get component registry entry by type
|
|
32
|
+
*/
|
|
33
|
+
export declare function getComponentEntry(type: ComponentType): ComponentRegistryEntry | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Get all component types
|
|
36
|
+
*/
|
|
37
|
+
export declare function getAllComponentTypes(): ComponentType[];
|
|
38
|
+
/**
|
|
39
|
+
* Get registry as JSON for LLM context
|
|
40
|
+
*/
|
|
41
|
+
export declare function getRegistryForLLM(): string;
|
|
42
|
+
/**
|
|
43
|
+
* Validate component against registry schema
|
|
44
|
+
* (Future: Use Zod for runtime validation)
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateAgainstRegistry(componentType: ComponentType, params: any): {
|
|
47
|
+
valid: boolean;
|
|
48
|
+
errors?: string[];
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=component-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/services/component-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAGrE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,sBA0GhC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,sBAqE3B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,sBA2D5B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,sBA2C1B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,GAAG,CAAC,aAAa,EAAE,sBAAsB,CAKvE,CAAA;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,sBAAsB,GAAG,SAAS,CAEzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,aAAa,EAAE,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAc1C;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,GAAG,GACV;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAkBvC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP UI Solid - Services
|
|
3
|
+
*
|
|
4
|
+
* Business logic for component validation and registry management
|
|
5
|
+
*/
|
|
6
|
+
export { validateComponent, validateLayout, DEFAULT_RESOURCE_LIMITS } from './validation';
|
|
7
|
+
export { ComponentRegistry } from './component-registry';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Validation Service
|
|
3
|
+
* Phase 0: Resource Limits & Schema Validation
|
|
4
|
+
*
|
|
5
|
+
* Validates LLM-generated components against:
|
|
6
|
+
* - JSON schema
|
|
7
|
+
* - Resource limits (data points, payload size, grid bounds)
|
|
8
|
+
* - Security constraints (domain whitelist, XSS prevention)
|
|
9
|
+
*/
|
|
10
|
+
import type { UIComponent, UILayout, ValidationResult, ResourceLimits, ChartComponentParams, TableComponentParams } from '../types';
|
|
11
|
+
/**
|
|
12
|
+
* Default resource limits (configurable via env)
|
|
13
|
+
*/
|
|
14
|
+
export declare const DEFAULT_RESOURCE_LIMITS: ResourceLimits;
|
|
15
|
+
/**
|
|
16
|
+
* Validate grid position bounds (1-12 columns)
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateGridPosition(position: UIComponent['position']): ValidationResult;
|
|
19
|
+
/**
|
|
20
|
+
* Validate chart component against resource limits
|
|
21
|
+
*/
|
|
22
|
+
export declare function validateChartComponent(params: ChartComponentParams, limits?: ResourceLimits): ValidationResult;
|
|
23
|
+
/**
|
|
24
|
+
* Validate table component against resource limits
|
|
25
|
+
*/
|
|
26
|
+
export declare function validateTableComponent(params: TableComponentParams, limits?: ResourceLimits): ValidationResult;
|
|
27
|
+
/**
|
|
28
|
+
* Validate payload size
|
|
29
|
+
*/
|
|
30
|
+
export declare function validatePayloadSize(component: UIComponent, limits?: ResourceLimits): ValidationResult;
|
|
31
|
+
/**
|
|
32
|
+
* Sanitize string to prevent XSS
|
|
33
|
+
* Basic implementation - DOMPurify used at render time
|
|
34
|
+
*/
|
|
35
|
+
export declare function sanitizeString(input: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Validate iframe domain against whitelist
|
|
38
|
+
*/
|
|
39
|
+
export declare function validateIframeDomain(url: string): ValidationResult;
|
|
40
|
+
/**
|
|
41
|
+
* Validate entire component
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateComponent(component: UIComponent, limits?: ResourceLimits): ValidationResult;
|
|
44
|
+
/**
|
|
45
|
+
* Validate entire layout
|
|
46
|
+
*/
|
|
47
|
+
export declare function validateLayout(layout: UILayout, limits?: ResourceLimits): ValidationResult;
|
|
48
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/services/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,UAAU,CAAA;AAEjB;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAKrC,CAAA;AAcD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,CAAC,UAAU,CAAC,GAAG,gBAAgB,CA+CxF;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,GAAE,cAAwC,GAC/C,gBAAgB,CA8ClB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,oBAAoB,EAC5B,MAAM,GAAE,cAAwC,GAC/C,gBAAgB,CAmDlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,EACtB,MAAM,GAAE,cAAwC,GAC/C,gBAAgB,CAiBlB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAmClE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,WAAW,EACtB,MAAM,GAAE,cAAwC,GAC/C,gBAAgB,CAmElB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,EAChB,MAAM,GAAE,cAAwC,GAC/C,gBAAgB,CA8ClB"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generative MCP UI - Type Definitions
|
|
3
|
+
* Phase 0-3 Implementation
|
|
4
|
+
*
|
|
5
|
+
* Defines the contract for LLM-generated UI components
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Component types supported by the renderer
|
|
9
|
+
*/
|
|
10
|
+
export type ComponentType = 'chart' | 'table' | 'metric' | 'text' | 'grid';
|
|
11
|
+
/**
|
|
12
|
+
* Chart types (powered by Quickchart)
|
|
13
|
+
*/
|
|
14
|
+
export type ChartType = 'bar' | 'line' | 'pie' | 'doughnut' | 'radar' | 'scatter';
|
|
15
|
+
/**
|
|
16
|
+
* Grid layout specification (12-column system)
|
|
17
|
+
*/
|
|
18
|
+
export interface GridPosition {
|
|
19
|
+
/**
|
|
20
|
+
* Column start (1-12)
|
|
21
|
+
*/
|
|
22
|
+
colStart: number;
|
|
23
|
+
/**
|
|
24
|
+
* Column span (1-12)
|
|
25
|
+
*/
|
|
26
|
+
colSpan: number;
|
|
27
|
+
/**
|
|
28
|
+
* Row start (1-based, auto-increment if not specified)
|
|
29
|
+
*/
|
|
30
|
+
rowStart?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Row span (default: 1)
|
|
33
|
+
*/
|
|
34
|
+
rowSpan?: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Component resource limits (SECURITY)
|
|
38
|
+
*/
|
|
39
|
+
export interface ResourceLimits {
|
|
40
|
+
/**
|
|
41
|
+
* Max data points per chart (default: 1000)
|
|
42
|
+
*/
|
|
43
|
+
maxDataPoints: number;
|
|
44
|
+
/**
|
|
45
|
+
* Max table rows (default: 100, pagination required)
|
|
46
|
+
*/
|
|
47
|
+
maxTableRows: number;
|
|
48
|
+
/**
|
|
49
|
+
* Max payload size in bytes (default: 50KB)
|
|
50
|
+
*/
|
|
51
|
+
maxPayloadSize: number;
|
|
52
|
+
/**
|
|
53
|
+
* Iframe render timeout in ms (default: 5000ms)
|
|
54
|
+
*/
|
|
55
|
+
renderTimeout: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Chart component parameters
|
|
59
|
+
*/
|
|
60
|
+
export interface ChartComponentParams {
|
|
61
|
+
type: ChartType;
|
|
62
|
+
title?: string;
|
|
63
|
+
data: {
|
|
64
|
+
labels: string[];
|
|
65
|
+
datasets: Array<{
|
|
66
|
+
label: string;
|
|
67
|
+
data: number[];
|
|
68
|
+
backgroundColor?: string | string[];
|
|
69
|
+
borderColor?: string | string[];
|
|
70
|
+
borderWidth?: number;
|
|
71
|
+
}>;
|
|
72
|
+
};
|
|
73
|
+
options?: {
|
|
74
|
+
responsive?: boolean;
|
|
75
|
+
maintainAspectRatio?: boolean;
|
|
76
|
+
tension?: number;
|
|
77
|
+
scales?: any;
|
|
78
|
+
plugins?: any;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Table component parameters
|
|
83
|
+
*/
|
|
84
|
+
export interface TableComponentParams {
|
|
85
|
+
title?: string;
|
|
86
|
+
columns: Array<{
|
|
87
|
+
key: string;
|
|
88
|
+
label: string;
|
|
89
|
+
sortable?: boolean;
|
|
90
|
+
width?: string;
|
|
91
|
+
}>;
|
|
92
|
+
rows: Array<Record<string, any>>;
|
|
93
|
+
pagination?: {
|
|
94
|
+
currentPage: number;
|
|
95
|
+
pageSize: number;
|
|
96
|
+
totalRows: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Metric card component parameters
|
|
101
|
+
*/
|
|
102
|
+
export interface MetricComponentParams {
|
|
103
|
+
title: string;
|
|
104
|
+
value: string | number;
|
|
105
|
+
unit?: string;
|
|
106
|
+
trend?: {
|
|
107
|
+
value: number;
|
|
108
|
+
direction: 'up' | 'down' | 'neutral';
|
|
109
|
+
};
|
|
110
|
+
subtitle?: string;
|
|
111
|
+
icon?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Text component parameters
|
|
115
|
+
*/
|
|
116
|
+
export interface TextComponentParams {
|
|
117
|
+
content: string;
|
|
118
|
+
markdown?: boolean;
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* UI Component definition (generated by LLM)
|
|
123
|
+
*/
|
|
124
|
+
export interface UIComponent {
|
|
125
|
+
/**
|
|
126
|
+
* Unique component ID
|
|
127
|
+
*/
|
|
128
|
+
id: string;
|
|
129
|
+
/**
|
|
130
|
+
* Component type
|
|
131
|
+
*/
|
|
132
|
+
type: ComponentType;
|
|
133
|
+
/**
|
|
134
|
+
* Grid position
|
|
135
|
+
*/
|
|
136
|
+
position: GridPosition;
|
|
137
|
+
/**
|
|
138
|
+
* Component parameters (type-specific)
|
|
139
|
+
*/
|
|
140
|
+
params: ChartComponentParams | TableComponentParams | MetricComponentParams | TextComponentParams;
|
|
141
|
+
/**
|
|
142
|
+
* Metadata for observability
|
|
143
|
+
*/
|
|
144
|
+
metadata?: {
|
|
145
|
+
generatedAt: string;
|
|
146
|
+
llmModel?: string;
|
|
147
|
+
confidence?: number;
|
|
148
|
+
toolsUsed?: string[];
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* UI Layout (collection of components)
|
|
153
|
+
*/
|
|
154
|
+
export interface UILayout {
|
|
155
|
+
/**
|
|
156
|
+
* Layout ID
|
|
157
|
+
*/
|
|
158
|
+
id: string;
|
|
159
|
+
/**
|
|
160
|
+
* Components in the layout
|
|
161
|
+
*/
|
|
162
|
+
components: UIComponent[];
|
|
163
|
+
/**
|
|
164
|
+
* Grid configuration
|
|
165
|
+
*/
|
|
166
|
+
grid: {
|
|
167
|
+
columns: number;
|
|
168
|
+
gap: string;
|
|
169
|
+
minRowHeight?: string;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Layout metadata
|
|
173
|
+
*/
|
|
174
|
+
metadata?: {
|
|
175
|
+
query: string;
|
|
176
|
+
generatedAt: string;
|
|
177
|
+
llmModel?: string;
|
|
178
|
+
totalComponents: number;
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Component registry entry
|
|
183
|
+
*/
|
|
184
|
+
export interface ComponentRegistryEntry {
|
|
185
|
+
/**
|
|
186
|
+
* Component type identifier
|
|
187
|
+
*/
|
|
188
|
+
type: ComponentType;
|
|
189
|
+
/**
|
|
190
|
+
* Component name
|
|
191
|
+
*/
|
|
192
|
+
name: string;
|
|
193
|
+
/**
|
|
194
|
+
* Component description (for LLM context)
|
|
195
|
+
*/
|
|
196
|
+
description: string;
|
|
197
|
+
/**
|
|
198
|
+
* JSON schema for validation
|
|
199
|
+
*/
|
|
200
|
+
schema: any;
|
|
201
|
+
/**
|
|
202
|
+
* Example usage (for LLM few-shot prompting)
|
|
203
|
+
*/
|
|
204
|
+
examples: Array<{
|
|
205
|
+
query: string;
|
|
206
|
+
component: UIComponent;
|
|
207
|
+
}>;
|
|
208
|
+
/**
|
|
209
|
+
* Resource limits
|
|
210
|
+
*/
|
|
211
|
+
limits: ResourceLimits;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Component validation result
|
|
215
|
+
*/
|
|
216
|
+
export interface ValidationResult {
|
|
217
|
+
valid: boolean;
|
|
218
|
+
errors?: Array<{
|
|
219
|
+
path: string;
|
|
220
|
+
message: string;
|
|
221
|
+
code: string;
|
|
222
|
+
}>;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Renderer error types
|
|
226
|
+
*/
|
|
227
|
+
export type RendererErrorType = 'validation' | 'render' | 'timeout' | 'resource_limit' | 'network' | 'security';
|
|
228
|
+
/**
|
|
229
|
+
* Renderer error
|
|
230
|
+
*/
|
|
231
|
+
export interface RendererError {
|
|
232
|
+
type: RendererErrorType;
|
|
233
|
+
message: string;
|
|
234
|
+
componentId?: string;
|
|
235
|
+
details?: any;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Streaming event types (Phase 2)
|
|
239
|
+
*/
|
|
240
|
+
export type StreamEventType = 'status' | 'component-start' | 'component' | 'component-complete' | 'error' | 'complete';
|
|
241
|
+
/**
|
|
242
|
+
* Streaming event (Phase 2)
|
|
243
|
+
*/
|
|
244
|
+
export interface StreamEvent {
|
|
245
|
+
event: StreamEventType;
|
|
246
|
+
data: any;
|
|
247
|
+
sequenceId?: number;
|
|
248
|
+
timestamp: string;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;AAE1E;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,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GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,GAAG,CAAA;CACd;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,iBAAiB,GACjB,WAAW,GACX,oBAAoB,GACpB,OAAO,GACP,UAAU,CAAA;AAEd;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,eAAe,CAAA;IACtB,IAAI,EAAE,GAAG,CAAA;IACT,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple internal logger utility
|
|
3
|
+
*
|
|
4
|
+
* Provides basic logging functionality for the package.
|
|
5
|
+
* Consumers can disable logging by setting NODE_ENV=production
|
|
6
|
+
* or by implementing their own logging solution.
|
|
7
|
+
*/
|
|
8
|
+
export interface Logger {
|
|
9
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
10
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
11
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
12
|
+
debug(message: string, context?: Record<string, unknown>): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a feature-scoped logger
|
|
16
|
+
*
|
|
17
|
+
* @param feature - Feature name for log prefixing
|
|
18
|
+
* @returns Logger instance
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const logger = createLogger('my-component')
|
|
23
|
+
* logger.info('Component mounted', { componentId: '123' })
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createLogger(feature: string): Logger;
|
|
27
|
+
/**
|
|
28
|
+
* No-op logger for testing or when logging is disabled
|
|
29
|
+
*/
|
|
30
|
+
export declare const noopLogger: Logger;
|
|
31
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC9D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAChE;AAWD;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAyBpD;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,MAKxB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-ship/mcp-ui-solid",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "SolidJS components for rendering MCP-generated UI resources",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"url": "https://github.com/theseedship/mcp-ui/issues"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
|
-
"build": "vite build",
|
|
76
|
+
"build": "vite build && pnpm build:types",
|
|
77
77
|
"build:types": "tsc --emitDeclarationOnly --outDir dist --skipLibCheck",
|
|
78
78
|
"dev": "vite build --watch",
|
|
79
79
|
"test": "vitest run",
|