@kumologica/sdk 4.0.0-beta11 → 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.
@@ -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(project_directory)) {
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumologica/sdk",
3
- "version": "4.0.0-beta11",
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-beta11",
92
- "@kumologica/devkit": "4.0.0-beta11",
93
- "@kumologica/runtime": "4.0.0-beta11",
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 = {
@@ -146,7 +146,8 @@ class CloudConfigStore {
146
146
 
147
147
  return lines.map(l => l.trim()).join('\n');
148
148
  }
149
- }
149
+
150
+ }
150
151
 
151
152
  module.exports = {
152
153
  CloudConfigStore
@@ -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