nitrostack 1.0.26 → 1.0.27
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/package.json
CHANGED
|
@@ -21,6 +21,16 @@ export function EnlargeModal() {
|
|
|
21
21
|
|
|
22
22
|
// Get data from item's examples or responseData
|
|
23
23
|
const widgetData = item.examples?.response || item.responseData || {};
|
|
24
|
+
|
|
25
|
+
// Debug logging
|
|
26
|
+
console.log('EnlargeModal - Widget info:', {
|
|
27
|
+
type,
|
|
28
|
+
itemName: item.name,
|
|
29
|
+
componentUri,
|
|
30
|
+
hasWidgetData: !!widgetData && Object.keys(widgetData).length > 0,
|
|
31
|
+
widgetDataType: widgetData ? typeof widgetData : 'none',
|
|
32
|
+
itemMeta: item._meta,
|
|
33
|
+
});
|
|
24
34
|
|
|
25
35
|
const handleUseInChat = () => {
|
|
26
36
|
if (type !== 'tool') return;
|
|
@@ -25,6 +25,17 @@ export function ToolCard({ tool, onExecute }: ToolCardProps) {
|
|
|
25
25
|
|
|
26
26
|
// Get example data for preview
|
|
27
27
|
const exampleData = tool.examples?.response;
|
|
28
|
+
|
|
29
|
+
// Debug logging for widget detection
|
|
30
|
+
if (hasWidget) {
|
|
31
|
+
console.log('ToolCard - Widget detected:', {
|
|
32
|
+
toolName: tool.name,
|
|
33
|
+
widgetUri,
|
|
34
|
+
hasExampleData: !!exampleData,
|
|
35
|
+
exampleDataType: exampleData ? typeof exampleData : 'none',
|
|
36
|
+
toolMeta: tool._meta,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
28
39
|
|
|
29
40
|
const handleUseInChat = (e: React.MouseEvent) => {
|
|
30
41
|
e.stopPropagation();
|
|
@@ -55,7 +55,18 @@ export function WidgetRenderer({ uri, data, className = '' }: WidgetRendererProp
|
|
|
55
55
|
// Production mode: fetch and render
|
|
56
56
|
const loadProductionWidget = async () => {
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
// Convert widget route/path to resource URI format if needed
|
|
59
|
+
// Routes like "/calculator-result" or "calculator-result" should become "widget://calculator-result"
|
|
60
|
+
let resourceUri = uri;
|
|
61
|
+
if (!uri.startsWith('widget://') && !uri.startsWith('http://') && !uri.startsWith('https://')) {
|
|
62
|
+
// Remove leading slash if present
|
|
63
|
+
const widgetPath = uri.startsWith('/') ? uri.substring(1) : uri;
|
|
64
|
+
resourceUri = `widget://${widgetPath}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
console.log('Loading widget in production mode:', { originalUri: uri, resourceUri, data });
|
|
68
|
+
|
|
69
|
+
const response = await fetch(`/api/resources/${encodeURIComponent(resourceUri)}`);
|
|
59
70
|
const result = await response.json();
|
|
60
71
|
|
|
61
72
|
if (result.contents && result.contents.length > 0) {
|
|
@@ -72,9 +83,17 @@ export function WidgetRenderer({ uri, data, className = '' }: WidgetRendererProp
|
|
|
72
83
|
URL.revokeObjectURL(blobUrl);
|
|
73
84
|
};
|
|
74
85
|
}
|
|
86
|
+
console.log('✅ Widget loaded successfully:', { resourceUri, hasHtml: !!html, hasData: !!data });
|
|
87
|
+
} else {
|
|
88
|
+
console.warn('⚠️ Widget resource found but no content:', { resourceUri, result });
|
|
75
89
|
}
|
|
76
90
|
} catch (error) {
|
|
77
|
-
console.error('Failed to load widget:',
|
|
91
|
+
console.error('❌ Failed to load widget:', {
|
|
92
|
+
originalUri: uri,
|
|
93
|
+
resourceUri,
|
|
94
|
+
error: error instanceof Error ? error.message : String(error),
|
|
95
|
+
stack: error instanceof Error ? error.stack : undefined
|
|
96
|
+
});
|
|
78
97
|
}
|
|
79
98
|
};
|
|
80
99
|
|