@kumologica/sdk 4.0.0-beta10 → 4.0.0-beta12
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 +21 -2
- package/cli/utils/license.js +4 -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/lib/utils/tools.min.js +1 -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,21 @@ async function promptUpdates(updates) {
|
|
|
138
139
|
return false;
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
async function checkSDKVersion() {
|
|
143
|
+
|
|
144
|
+
const sdkVersion = await checkSDK();
|
|
145
|
+
|
|
146
|
+
if (sdkVersion || sdkVersion === "") {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
console.log("");
|
|
150
|
+
console.log(`-----------------------------------------------------`);
|
|
151
|
+
console.log(`New version of Kumologica SDK is now available: ${sdkVersion}`);
|
|
152
|
+
console.log("To update, run: npm install -g @kumologica/sdk");
|
|
153
|
+
console.log(`-----------------------------------------------------`);
|
|
154
|
+
console.log("");
|
|
155
|
+
}
|
|
156
|
+
|
|
141
157
|
/*
|
|
142
158
|
check if upgrade in npmjs to the existing ones in package.json
|
|
143
159
|
check if upgrade or missing node_modules vs package.json
|
|
@@ -148,6 +164,7 @@ async function runUpdater(projectDir) {
|
|
|
148
164
|
console.debug("Project directory not provided, skipping upgrade check");
|
|
149
165
|
return;
|
|
150
166
|
}
|
|
167
|
+
|
|
151
168
|
const updater = new Updater(projectDir);
|
|
152
169
|
const updates = await updater.checkForUpdates();
|
|
153
170
|
|
|
@@ -187,11 +204,13 @@ exports.handler = async ({ project_directory }) => {
|
|
|
187
204
|
? path.resolve(project_directory)
|
|
188
205
|
: undefined;
|
|
189
206
|
|
|
190
|
-
if (!await licenseCheck(
|
|
207
|
+
if (!await licenseCheck()) {
|
|
191
208
|
process.exit(1);
|
|
192
209
|
}
|
|
193
210
|
|
|
194
211
|
await runUpdater(projectDir);
|
|
195
212
|
|
|
213
|
+
await checkSDKVersion();
|
|
214
|
+
|
|
196
215
|
startElectron(projectDir);
|
|
197
216
|
};
|
package/cli/utils/license.js
CHANGED
|
@@ -70,8 +70,10 @@ async function promptForLicenseKey() {
|
|
|
70
70
|
|
|
71
71
|
console.log(`📧 Developer license will be requested for: ${email}`);
|
|
72
72
|
|
|
73
|
-
await tools.license.subscribe(email);
|
|
74
|
-
|
|
73
|
+
const res = await tools.license.subscribe(email);
|
|
74
|
+
if (res) {
|
|
75
|
+
console.log(`Follow the instructions in your email to complete the process.`);
|
|
76
|
+
}
|
|
75
77
|
|
|
76
78
|
return false;
|
|
77
79
|
} else {
|
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-beta12",
|
|
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-beta12",
|
|
92
|
+
"@kumologica/devkit": "4.0.0-beta12",
|
|
93
|
+
"@kumologica/runtime": "4.0.0-beta12",
|
|
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 = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e,o,n,
|
|
1
|
+
var e,o,n,r,s=require("crypto"),t=require("fs"),c=require("path");function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(){if(!o){o=1;let l="base64";e={subscribe:async function(e){console.log("Requesting license for email: "+e);try{var o=await fetch("https://api.infra.kumologica.com/p/signup?x-api-key=RjibYF3qZb2AzmTrPOnV35LfRV798e3Z87vp4izo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(o.ok)return!0;{let e=await o.text();return console.error(`License request failed: ${o.status} `+e),!1}}catch(e){return console.error("Fetch failed (network/socket level):",e.message),console.log("Node version:",process.version),console.log("Timeout being used (default 300s if not set):",fetch.Timeout||"not set"),e.cause&&(console.error("Underlying cause:",e.cause),console.error("Cause name:",e.cause.name),console.error("Cause message:",e.cause.message),console.error("Cause code (if any):",e.cause.code)),!1}},display:function(e){e?(console.log("-------- License Details ----------"),console.log("Subscriber: "+e.sub),console.log("Email: "+e.email),console.log("License Type: "+e.licenseType),console.log("Issued For: "+(e.name||e.email)),console.log("Issued By: "+e.iss),console.log("Issued At: "+new Date(e.iat).toLocaleString()),console.log("Expiry: "+("perpetual"===e.exp?"Perpetual":new Date(e.exp).toLocaleString())),console.log("-----------------------------------")):console.error("Invalid license data.")},verify:function(e){publicKeyPem=(()=>{var r=Buffer.from("XkI1bxBWOXhHBztkdXIuEXlKLBcSIWstZlEzOEADPyFCCVkUeQNIIxwWDU4QEiEyLHpfOjwHCVNlL3tTFiIvMGkcZCkOBnNgIjtybUckA3x7BRARDElXRxECPlB4OgF4aWIRDQAGLBI2Jns3eTINDkx+XSN9bAAFDHllInIdCEg8SzICC2JJJyl4CGk5JAB/EBQcLW4+dzcuMGxhLglhbHUZF2ZwFQMJEl08cAVfWGd5ADtje34SDUJCHxUlWh83aghXDnJXXwxxCFsUNANhCzJ0MHoiVyEvLlh2OC5gf2UwdGZhDxAvMllUcCgSWl1w",l).toString().split("").reverse().join("");let n="";for(let o=0;o<r.length;o++){let e="34jfd#d-cDFG23@W096ml".charCodeAt(o%21);n+=String.fromCharCode(r.charCodeAt(o)^e)}return Buffer.from(n,l).toString()})();var o=s,[e,r]=e.split(".");if(!e||!r)throw new Error("Invalid license format. License may have been tampered.");var e=Buffer.from(e,"base64url").toString("utf-8"),n=JSON.parse(e),e=Buffer.from(e,"utf-8"),r=Buffer.from(r,l),o=o.createVerify("SHA256");if(o.update(e),o.end(),!o.verify(publicKeyPem,r))throw new Error("Invalid license signature. License may have been tampered.");if(!(n&&n.sub&&n.email&&n.iss&&n.iat))throw new Error("Invalid license data. License may have been tampered.");if(n.exp&&("Perpetual"===n.exp||Date.now()>n.exp))throw new Error("License has expired. Please renew your license, contact Kumologica support at contact@kumologica.com.");return n},save:function(e,o){var r=t,n=c,n=(console.log("saving key to: "+e),n.join(e,"kumologica.license"));try{r.writeFileSync(n,o,"utf-8"),console.log("License saved successfully at: "+n)}catch(e){console.error("Failed to save license: "+e.message)}},read:function(e){var o=t,r=c.join(e,"kumologica.license");try{let e=o.readFileSync(r,"utf-8");return console.log("License read successfully from: "+r),e}catch(e){return null}}}}return e}var a=(()=>{if(r)return n;r=1;var e=i();return n={license:e}})(),u=l(a);module.exports=u;
|
|
@@ -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
|