@mongoosejs/studio 0.5.2 → 0.5.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/backend/actions/ChatThread/streamChatMessage.js +12 -12
- package/backend/chatAgent/agentSystemPrompt.js +22 -10
- package/backend/chatAgent/getAgentTools.js +19 -8
- package/backend/chatAgent/runChatAgent.js +17 -0
- package/backend/index.js +3 -0
- package/debugging.js +11 -0
- package/eval/agent/cases.js +168 -0
- package/eval/agent/fixtures/carsharing.js +147 -0
- package/eval/agent/fixtures/ecommerce.js +152 -0
- package/eval/agent/run.js +323 -0
- package/frontend/public/app.js +346 -9
- package/frontend/public/tw.css +52 -0
- package/frontend/src/_util/recent-pages-history.js +116 -0
- package/frontend/src/chat/chat-message-script/chat-message-script.html +1 -6
- package/frontend/src/document/document.html +2 -2
- package/frontend/src/index.js +143 -1
- package/frontend/src/modal/modal.css +26 -1
- package/frontend/src/modal/modal.html +2 -2
- package/frontend/src/modal/modal.js +5 -1
- package/frontend/src/navbar/navbar.html +73 -2
- package/frontend/src/navbar/navbar.js +63 -1
- package/index.js +2 -1
- package/package.json +3 -2
|
@@ -4,6 +4,13 @@ const api = require('../api');
|
|
|
4
4
|
const mothership = require('../mothership');
|
|
5
5
|
const template = require('./navbar.html');
|
|
6
6
|
const { routes, hasAccess } = require('../routes');
|
|
7
|
+
const {
|
|
8
|
+
RECENT_PAGES_STORAGE_KEY,
|
|
9
|
+
RECENT_PAGES_CHANGED_EVENT,
|
|
10
|
+
safeReadRecentPages,
|
|
11
|
+
saveRecentPages,
|
|
12
|
+
withRecentPagesStorageLock
|
|
13
|
+
} = require('../_util/recent-pages-history');
|
|
7
14
|
|
|
8
15
|
const appendCSS = require('../appendCSS');
|
|
9
16
|
|
|
@@ -15,7 +22,9 @@ module.exports = app => app.component('navbar', {
|
|
|
15
22
|
inject: ['state'],
|
|
16
23
|
data: () => ({
|
|
17
24
|
showFlyout: false,
|
|
18
|
-
darkMode: typeof localStorage !== 'undefined' && localStorage.getItem('studio-theme') === 'dark'
|
|
25
|
+
darkMode: typeof localStorage !== 'undefined' && localStorage.getItem('studio-theme') === 'dark',
|
|
26
|
+
showRecentPagesModal: false,
|
|
27
|
+
localRecentPages: []
|
|
19
28
|
}),
|
|
20
29
|
mounted: function() {
|
|
21
30
|
window.navbar = this;
|
|
@@ -37,6 +46,32 @@ module.exports = app => app.component('navbar', {
|
|
|
37
46
|
mobileMenu.classList.add('translate-x-full');
|
|
38
47
|
});
|
|
39
48
|
}
|
|
49
|
+
|
|
50
|
+
this.localRecentPages = safeReadRecentPages();
|
|
51
|
+
|
|
52
|
+
this._syncRecentPagesFromOtherTab = ev => {
|
|
53
|
+
if (ev.storageArea !== window.localStorage || ev.key !== RECENT_PAGES_STORAGE_KEY) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
this.refreshRecentPagesFromStorage();
|
|
57
|
+
};
|
|
58
|
+
this._syncRecentPagesFromBroadcast = () => this.refreshRecentPagesFromStorage();
|
|
59
|
+
|
|
60
|
+
window.addEventListener('storage', this._syncRecentPagesFromOtherTab);
|
|
61
|
+
window.addEventListener(RECENT_PAGES_CHANGED_EVENT, this._syncRecentPagesFromBroadcast);
|
|
62
|
+
},
|
|
63
|
+
beforeUnmount() {
|
|
64
|
+
if (this._syncRecentPagesFromOtherTab) {
|
|
65
|
+
window.removeEventListener('storage', this._syncRecentPagesFromOtherTab);
|
|
66
|
+
}
|
|
67
|
+
if (this._syncRecentPagesFromBroadcast) {
|
|
68
|
+
window.removeEventListener(RECENT_PAGES_CHANGED_EVENT, this._syncRecentPagesFromBroadcast);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
watch: {
|
|
72
|
+
'$route.fullPath'() {
|
|
73
|
+
this.refreshRecentPagesFromStorage();
|
|
74
|
+
}
|
|
40
75
|
},
|
|
41
76
|
computed: {
|
|
42
77
|
dashboardView() {
|
|
@@ -69,6 +104,9 @@ module.exports = app => app.component('navbar', {
|
|
|
69
104
|
hasTaskVisualizer() {
|
|
70
105
|
return !!window.MONGOOSE_STUDIO_CONFIG.enableTaskVisualizer;
|
|
71
106
|
},
|
|
107
|
+
recentPagesList() {
|
|
108
|
+
return this.localRecentPages;
|
|
109
|
+
},
|
|
72
110
|
hasLLMAPIKey() {
|
|
73
111
|
return !!window.MONGOOSE_STUDIO_CONFIG.hasLLMAPIKey;
|
|
74
112
|
},
|
|
@@ -103,6 +141,30 @@ module.exports = app => app.component('navbar', {
|
|
|
103
141
|
const meta = document.querySelector('meta[name="theme-color"]');
|
|
104
142
|
if (meta) meta.setAttribute('content', this.darkMode ? '#0f0f0f' : '#ffffff');
|
|
105
143
|
document.documentElement.dispatchEvent(new CustomEvent('studio-theme-changed', { detail: { dark: this.darkMode } }));
|
|
144
|
+
},
|
|
145
|
+
refreshRecentPagesFromStorage() {
|
|
146
|
+
this.localRecentPages = safeReadRecentPages();
|
|
147
|
+
},
|
|
148
|
+
openRecentPagesModal() {
|
|
149
|
+
this.showRecentPagesModal = true;
|
|
150
|
+
this.refreshRecentPagesFromStorage();
|
|
151
|
+
},
|
|
152
|
+
closeRecentPagesModal() {
|
|
153
|
+
this.showRecentPagesModal = false;
|
|
154
|
+
},
|
|
155
|
+
clearRecentPagesHistory() {
|
|
156
|
+
this.localRecentPages = [];
|
|
157
|
+
void withRecentPagesStorageLock(() => saveRecentPages([]));
|
|
158
|
+
},
|
|
159
|
+
goToRecentPage(entry) {
|
|
160
|
+
if (!entry || !entry.path) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
this.showRecentPagesModal = false;
|
|
164
|
+
if (entry.path === this.$route.fullPath) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.$router.push(entry.path);
|
|
106
168
|
}
|
|
107
169
|
},
|
|
108
170
|
directives: {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mongoosejs/studio",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "AI-Powered Data Workspace for MongoDB: Turn your MongoDB data into dashboards, maps, and interactive workflows - powered by your Mongoose models and AI.",
|
|
5
5
|
"homepage": "https://mongoosestudio.app/",
|
|
6
6
|
"repository": {
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"tailwind": "tailwindcss -o ./frontend/public/tw.css",
|
|
54
54
|
"tailwind:watch": "tailwindcss -o ./frontend/public/tw.css --watch",
|
|
55
55
|
"test": "mocha test/*.test.js",
|
|
56
|
-
"test:frontend": "mocha test/frontend/*.test.js"
|
|
56
|
+
"test:frontend": "mocha test/frontend/*.test.js",
|
|
57
|
+
"eval:agent": "node eval/agent/run.js"
|
|
57
58
|
}
|
|
58
59
|
}
|