@kumologica/sdk 4.0.0-beta11 → 4.0.0-beta13
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/cli/commands/open.js +27 -2
- package/package.json +4 -4
- package/src/app/lib/stores/settings-ai-store.js +34 -1
- package/src/app/lib/stores/settings-cloud-store.js +2 -1
- package/src/app/ui/editor-client/public/red/red.js +2 -1
- package/src/app/ui/editor-client/public/red/red.min.js +1 -1
- package/src/app/ui/editor-client/src/js/ui/palette-aiassistant.js +2 -1
package/cli/commands/open.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const path = require("path");
|
|
2
2
|
const { spawn } = require("child_process");
|
|
3
|
-
const { Updater } = require("@kumologica/builder");
|
|
3
|
+
const { Updater, checkSDK } = require("@kumologica/builder");
|
|
4
|
+
|
|
4
5
|
const { confirm } = require("enquirer");
|
|
5
6
|
|
|
6
7
|
const { logError } = require("../utils/logger");
|
|
@@ -138,6 +139,26 @@ async function promptUpdates(updates) {
|
|
|
138
139
|
return false;
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
async function checkSDKVersion() {
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
const sdkVersion = await checkSDK.checkSDK();
|
|
146
|
+
|
|
147
|
+
if (!sdkVersion || sdkVersion === "") {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
console.log("");
|
|
152
|
+
console.log(`-----------------------------------------------------`);
|
|
153
|
+
console.log(`New version of Kumologica SDK is now available: ${sdkVersion}`);
|
|
154
|
+
console.log("To update, run: npm install -g @kumologica/sdk");
|
|
155
|
+
console.log(`-----------------------------------------------------`);
|
|
156
|
+
console.log("");
|
|
157
|
+
}catch (e) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
141
162
|
/*
|
|
142
163
|
check if upgrade in npmjs to the existing ones in package.json
|
|
143
164
|
check if upgrade or missing node_modules vs package.json
|
|
@@ -148,6 +169,7 @@ async function runUpdater(projectDir) {
|
|
|
148
169
|
console.debug("Project directory not provided, skipping upgrade check");
|
|
149
170
|
return;
|
|
150
171
|
}
|
|
172
|
+
|
|
151
173
|
const updater = new Updater(projectDir);
|
|
152
174
|
const updates = await updater.checkForUpdates();
|
|
153
175
|
|
|
@@ -183,15 +205,18 @@ exports.desc = "Open Kumologica Designer";
|
|
|
183
205
|
|
|
184
206
|
exports.handler = async ({ project_directory }) => {
|
|
185
207
|
|
|
208
|
+
await checkSDKVersion();
|
|
209
|
+
|
|
186
210
|
const projectDir = project_directory
|
|
187
211
|
? path.resolve(project_directory)
|
|
188
212
|
: undefined;
|
|
189
213
|
|
|
190
|
-
if (!await licenseCheck(
|
|
214
|
+
if (!await licenseCheck()) {
|
|
191
215
|
process.exit(1);
|
|
192
216
|
}
|
|
193
217
|
|
|
194
218
|
await runUpdater(projectDir);
|
|
195
219
|
|
|
220
|
+
|
|
196
221
|
startElectron(projectDir);
|
|
197
222
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kumologica/sdk",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta13",
|
|
4
4
|
"productName": "Kumologica Designer",
|
|
5
5
|
"copyright": "Copyright 2020 Kumologica Pty Ltd, All Rights Reserved.",
|
|
6
6
|
"author": "Kumologica Pty Ltd <contact@kumologica.com>",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
"@aws-sdk/signature-v4": "^3.370.0",
|
|
89
89
|
"@aws-sdk/types": "^3.936.0",
|
|
90
90
|
"@electron/remote": "^2.0.8",
|
|
91
|
-
"@kumologica/builder": "4.0.0-
|
|
92
|
-
"@kumologica/devkit": "4.0.0-
|
|
93
|
-
"@kumologica/runtime": "4.0.0-
|
|
91
|
+
"@kumologica/builder": "4.0.0-beta13",
|
|
92
|
+
"@kumologica/devkit": "4.0.0-beta13",
|
|
93
|
+
"@kumologica/runtime": "4.0.0-beta13",
|
|
94
94
|
"ajv": "8.10.0",
|
|
95
95
|
"archive-type": "^4.0.0",
|
|
96
96
|
"basic-auth": "2.0.1",
|
|
@@ -171,7 +171,7 @@ class AiConfigStore {
|
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
parseAiConfigFile() {
|
|
174
|
-
this.initFile = ini.parse(this.readAiConfigFile());
|
|
174
|
+
this.initFile = this.unnestIni(ini.parse(this.readAiConfigFile()));
|
|
175
175
|
return this.initFile;
|
|
176
176
|
}
|
|
177
177
|
|
|
@@ -259,6 +259,39 @@ class AiConfigStore {
|
|
|
259
259
|
});
|
|
260
260
|
this.writeChatHistoryFile(JSON.stringify(chatHistory));
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
unnestIni(parsed) {
|
|
264
|
+
const result = {};
|
|
265
|
+
|
|
266
|
+
function recurse(obj, path = '') {
|
|
267
|
+
for (const key in obj) {
|
|
268
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
269
|
+
|
|
270
|
+
const val = obj[key];
|
|
271
|
+
const fullPath = path ? `${path}.${key}` : key;
|
|
272
|
+
|
|
273
|
+
if (val && typeof val === 'object' && !Array.isArray(val)) {
|
|
274
|
+
// Check if this object contains only primitive values (i.e. it's a real section)
|
|
275
|
+
const isSectionContent = Object.values(val).every(
|
|
276
|
+
v => typeof v !== 'object' || v === null
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
if (isSectionContent) {
|
|
280
|
+
result[fullPath] = val; // ← this is what you want
|
|
281
|
+
} else {
|
|
282
|
+
recurse(val, fullPath); // deeper nesting in section name
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
// rare top-level key=value outside any section
|
|
286
|
+
result[fullPath] = val;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
recurse(parsed);
|
|
292
|
+
return result;
|
|
293
|
+
}
|
|
294
|
+
|
|
262
295
|
}
|
|
263
296
|
|
|
264
297
|
module.exports = {
|
|
@@ -27572,7 +27572,7 @@ async function chatWithAi(conversation, question) {
|
|
|
27572
27572
|
};
|
|
27573
27573
|
|
|
27574
27574
|
try {
|
|
27575
|
-
console.log("Calling chatAi with options:", options);
|
|
27575
|
+
console.log("Calling chatAi with options:", JSON.stringify(options));
|
|
27576
27576
|
const res = await window.__kumologica.libs.chatAi(options);
|
|
27577
27577
|
|
|
27578
27578
|
console.log("response:", JSON.stringify(res));
|
|
@@ -27583,6 +27583,7 @@ async function chatWithAi(conversation, question) {
|
|
|
27583
27583
|
conversation.push({ role: 'assistant', content: res.content || '[No response]' });
|
|
27584
27584
|
aiConfigStore.updateChatHistory("latest", conversation);
|
|
27585
27585
|
} catch(err) {
|
|
27586
|
+
console.error("Error during chatWithAi:", JSON.stringify(err));
|
|
27586
27587
|
$chat.append(`<div style="color:red; text-align:left;">Error: ${err.message}</div>`);
|
|
27587
27588
|
|
|
27588
27589
|
// Auto-scroll on error
|