@askexenow/exe-os 0.8.42 → 0.8.44
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/dist/bin/cli.js +15 -1
- package/dist/bin/exe-boot.js +45 -31
- package/dist/bin/exe-cloud.js +15 -1
- package/dist/bin/exe-gateway.js +15 -1
- package/dist/bin/exe-link.js +49 -31
- package/dist/bin/exe-new-employee.js +19 -1
- package/dist/bin/setup.js +15 -1
- package/dist/hooks/ingest-worker.js +19 -1
- package/dist/hooks/prompt-ingest-worker.js +19 -1
- package/dist/hooks/response-ingest-worker.js +19 -1
- package/dist/hooks/summary-worker.js +49 -31
- package/dist/lib/cloud-sync.js +49 -31
- package/dist/lib/license.js +15 -1
- package/dist/mcp/server.js +15 -1
- package/dist/tui/App.js +15 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -4805,7 +4805,21 @@ function getCacheAgeMs() {
|
|
|
4805
4805
|
}
|
|
4806
4806
|
}
|
|
4807
4807
|
async function checkLicense() {
|
|
4808
|
-
|
|
4808
|
+
let key = loadLicense();
|
|
4809
|
+
if (!key) {
|
|
4810
|
+
try {
|
|
4811
|
+
const configPath = path11.join(EXE_AI_DIR, "config.json");
|
|
4812
|
+
if (existsSync10(configPath)) {
|
|
4813
|
+
const raw = JSON.parse(readFileSync6(configPath, "utf8"));
|
|
4814
|
+
const cloud = raw.cloud;
|
|
4815
|
+
if (cloud?.apiKey) {
|
|
4816
|
+
key = cloud.apiKey;
|
|
4817
|
+
saveLicense(key);
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
} catch {
|
|
4821
|
+
}
|
|
4822
|
+
}
|
|
4809
4823
|
if (!key) return FREE_LICENSE;
|
|
4810
4824
|
const cached = await getCachedLicense();
|
|
4811
4825
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/dist/bin/exe-boot.js
CHANGED
|
@@ -2532,7 +2532,21 @@ function getCacheAgeMs() {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
}
|
|
2534
2534
|
async function checkLicense() {
|
|
2535
|
-
|
|
2535
|
+
let key = loadLicense();
|
|
2536
|
+
if (!key) {
|
|
2537
|
+
try {
|
|
2538
|
+
const configPath = path9.join(EXE_AI_DIR, "config.json");
|
|
2539
|
+
if (existsSync8(configPath)) {
|
|
2540
|
+
const raw = JSON.parse(readFileSync7(configPath, "utf8"));
|
|
2541
|
+
const cloud = raw.cloud;
|
|
2542
|
+
if (cloud?.apiKey) {
|
|
2543
|
+
key = cloud.apiKey;
|
|
2544
|
+
saveLicense(key);
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
} catch {
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2536
2550
|
if (!key) return FREE_LICENSE;
|
|
2537
2551
|
const cached = await getCachedLicense();
|
|
2538
2552
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -5582,16 +5596,16 @@ async function cloudSync(config) {
|
|
|
5582
5596
|
author_device_id, scope)
|
|
5583
5597
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
5584
5598
|
args: [
|
|
5585
|
-
rec.id,
|
|
5586
|
-
rec.agent_id,
|
|
5587
|
-
rec.agent_role,
|
|
5588
|
-
rec.session_id,
|
|
5589
|
-
rec.timestamp,
|
|
5590
|
-
rec.tool_name,
|
|
5591
|
-
rec.project_name,
|
|
5592
|
-
rec.has_error,
|
|
5593
|
-
rec.raw_text,
|
|
5594
|
-
rec.version,
|
|
5599
|
+
rec.id ?? null,
|
|
5600
|
+
rec.agent_id ?? null,
|
|
5601
|
+
rec.agent_role ?? null,
|
|
5602
|
+
rec.session_id ?? null,
|
|
5603
|
+
rec.timestamp ?? null,
|
|
5604
|
+
rec.tool_name ?? null,
|
|
5605
|
+
rec.project_name ?? null,
|
|
5606
|
+
rec.has_error ?? 0,
|
|
5607
|
+
rec.raw_text ?? "",
|
|
5608
|
+
rec.version ?? 0,
|
|
5595
5609
|
rec.author_device_id ?? null,
|
|
5596
5610
|
rec.scope ?? "business"
|
|
5597
5611
|
]
|
|
@@ -5996,7 +6010,7 @@ async function cloudPullBehaviors(config) {
|
|
|
5996
6010
|
const existing = await client.execute({
|
|
5997
6011
|
sql: `SELECT COUNT(*) as cnt FROM behaviors
|
|
5998
6012
|
WHERE agent_id = ? AND content = ?`,
|
|
5999
|
-
args: [behavior.agent_id, behavior.content]
|
|
6013
|
+
args: [behavior.agent_id ?? null, behavior.content ?? null]
|
|
6000
6014
|
});
|
|
6001
6015
|
if (Number(existing.rows[0]?.cnt) > 0) continue;
|
|
6002
6016
|
await client.execute({
|
|
@@ -6004,15 +6018,15 @@ async function cloudPullBehaviors(config) {
|
|
|
6004
6018
|
(id, agent_id, project_name, domain, content, active, priority, created_at, updated_at)
|
|
6005
6019
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
6006
6020
|
args: [
|
|
6007
|
-
behavior.id,
|
|
6008
|
-
behavior.agent_id,
|
|
6021
|
+
behavior.id ?? null,
|
|
6022
|
+
behavior.agent_id ?? null,
|
|
6009
6023
|
behavior.project_name ?? null,
|
|
6010
6024
|
behavior.domain ?? null,
|
|
6011
|
-
behavior.content,
|
|
6012
|
-
behavior.active,
|
|
6025
|
+
behavior.content ?? null,
|
|
6026
|
+
behavior.active ?? 1,
|
|
6013
6027
|
behavior.priority ?? "p1",
|
|
6014
|
-
behavior.created_at,
|
|
6015
|
-
behavior.updated_at
|
|
6028
|
+
behavior.created_at ?? null,
|
|
6029
|
+
behavior.updated_at ?? null
|
|
6016
6030
|
]
|
|
6017
6031
|
});
|
|
6018
6032
|
pulled++;
|
|
@@ -6153,16 +6167,16 @@ async function cloudPullTasks(config) {
|
|
|
6153
6167
|
blocked_by, parent_task_id, budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at)
|
|
6154
6168
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
6155
6169
|
args: [
|
|
6156
|
-
t.id,
|
|
6157
|
-
t.title,
|
|
6158
|
-
t.assigned_to,
|
|
6159
|
-
t.assigned_by,
|
|
6160
|
-
t.project_name,
|
|
6170
|
+
t.id ?? null,
|
|
6171
|
+
t.title ?? null,
|
|
6172
|
+
t.assigned_to ?? null,
|
|
6173
|
+
t.assigned_by ?? null,
|
|
6174
|
+
t.project_name ?? null,
|
|
6161
6175
|
t.priority ?? "p1",
|
|
6162
6176
|
t.status ?? "open",
|
|
6163
6177
|
t.task_file ?? null,
|
|
6164
|
-
t.created_at,
|
|
6165
|
-
t.updated_at,
|
|
6178
|
+
t.created_at ?? null,
|
|
6179
|
+
t.updated_at ?? null,
|
|
6166
6180
|
t.blocked_by ?? null,
|
|
6167
6181
|
t.parent_task_id ?? null,
|
|
6168
6182
|
t.budget_tokens ?? null,
|
|
@@ -6200,15 +6214,15 @@ async function cloudPullConversations(config) {
|
|
|
6200
6214
|
content_metadata, agent_response, agent_name, timestamp, ingested_at)
|
|
6201
6215
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
6202
6216
|
args: [
|
|
6203
|
-
c.id,
|
|
6204
|
-
c.platform,
|
|
6217
|
+
c.id ?? null,
|
|
6218
|
+
c.platform ?? null,
|
|
6205
6219
|
c.external_id ?? null,
|
|
6206
|
-
c.sender_id,
|
|
6220
|
+
c.sender_id ?? null,
|
|
6207
6221
|
c.sender_name ?? null,
|
|
6208
6222
|
c.sender_phone ?? null,
|
|
6209
6223
|
c.sender_email ?? null,
|
|
6210
6224
|
c.recipient_id ?? null,
|
|
6211
|
-
c.channel_id,
|
|
6225
|
+
c.channel_id ?? null,
|
|
6212
6226
|
c.thread_id ?? null,
|
|
6213
6227
|
c.reply_to_id ?? null,
|
|
6214
6228
|
c.content_text ?? null,
|
|
@@ -6216,8 +6230,8 @@ async function cloudPullConversations(config) {
|
|
|
6216
6230
|
c.content_metadata ?? null,
|
|
6217
6231
|
c.agent_response ?? null,
|
|
6218
6232
|
c.agent_name ?? null,
|
|
6219
|
-
c.timestamp,
|
|
6220
|
-
c.ingested_at
|
|
6233
|
+
c.timestamp ?? null,
|
|
6234
|
+
c.ingested_at ?? null
|
|
6221
6235
|
]
|
|
6222
6236
|
}));
|
|
6223
6237
|
await client.batch(stmts, "write");
|
package/dist/bin/exe-cloud.js
CHANGED
|
@@ -373,7 +373,21 @@ function getCacheAgeMs() {
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
async function checkLicense() {
|
|
376
|
-
|
|
376
|
+
let key = loadLicense();
|
|
377
|
+
if (!key) {
|
|
378
|
+
try {
|
|
379
|
+
const configPath = path4.join(EXE_AI_DIR, "config.json");
|
|
380
|
+
if (existsSync4(configPath)) {
|
|
381
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
382
|
+
const cloud = raw.cloud;
|
|
383
|
+
if (cloud?.apiKey) {
|
|
384
|
+
key = cloud.apiKey;
|
|
385
|
+
saveLicense(key);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
} catch {
|
|
389
|
+
}
|
|
390
|
+
}
|
|
377
391
|
if (!key) return FREE_LICENSE;
|
|
378
392
|
const cached = await getCachedLicense();
|
|
379
393
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/dist/bin/exe-gateway.js
CHANGED
|
@@ -3064,7 +3064,21 @@ function getCacheAgeMs() {
|
|
|
3064
3064
|
}
|
|
3065
3065
|
}
|
|
3066
3066
|
async function checkLicense() {
|
|
3067
|
-
|
|
3067
|
+
let key = loadLicense();
|
|
3068
|
+
if (!key) {
|
|
3069
|
+
try {
|
|
3070
|
+
const configPath = path5.join(EXE_AI_DIR, "config.json");
|
|
3071
|
+
if (existsSync5(configPath)) {
|
|
3072
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
3073
|
+
const cloud = raw.cloud;
|
|
3074
|
+
if (cloud?.apiKey) {
|
|
3075
|
+
key = cloud.apiKey;
|
|
3076
|
+
saveLicense(key);
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
} catch {
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3068
3082
|
if (!key) return FREE_LICENSE;
|
|
3069
3083
|
const cached = await getCachedLicense();
|
|
3070
3084
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/dist/bin/exe-link.js
CHANGED
|
@@ -477,6 +477,10 @@ function loadLicense() {
|
|
|
477
477
|
return null;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
+
function saveLicense(apiKey) {
|
|
481
|
+
mkdirSync(EXE_AI_DIR, { recursive: true });
|
|
482
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
483
|
+
}
|
|
480
484
|
async function verifyLicenseJwt(token) {
|
|
481
485
|
try {
|
|
482
486
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -566,7 +570,21 @@ function getCacheAgeMs() {
|
|
|
566
570
|
}
|
|
567
571
|
}
|
|
568
572
|
async function checkLicense() {
|
|
569
|
-
|
|
573
|
+
let key = loadLicense();
|
|
574
|
+
if (!key) {
|
|
575
|
+
try {
|
|
576
|
+
const configPath = path4.join(EXE_AI_DIR, "config.json");
|
|
577
|
+
if (existsSync4(configPath)) {
|
|
578
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
579
|
+
const cloud = raw.cloud;
|
|
580
|
+
if (cloud?.apiKey) {
|
|
581
|
+
key = cloud.apiKey;
|
|
582
|
+
saveLicense(key);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
} catch {
|
|
586
|
+
}
|
|
587
|
+
}
|
|
570
588
|
if (!key) return FREE_LICENSE;
|
|
571
589
|
const cached = await getCachedLicense();
|
|
572
590
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -841,16 +859,16 @@ async function cloudSync(config) {
|
|
|
841
859
|
author_device_id, scope)
|
|
842
860
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
843
861
|
args: [
|
|
844
|
-
rec.id,
|
|
845
|
-
rec.agent_id,
|
|
846
|
-
rec.agent_role,
|
|
847
|
-
rec.session_id,
|
|
848
|
-
rec.timestamp,
|
|
849
|
-
rec.tool_name,
|
|
850
|
-
rec.project_name,
|
|
851
|
-
rec.has_error,
|
|
852
|
-
rec.raw_text,
|
|
853
|
-
rec.version,
|
|
862
|
+
rec.id ?? null,
|
|
863
|
+
rec.agent_id ?? null,
|
|
864
|
+
rec.agent_role ?? null,
|
|
865
|
+
rec.session_id ?? null,
|
|
866
|
+
rec.timestamp ?? null,
|
|
867
|
+
rec.tool_name ?? null,
|
|
868
|
+
rec.project_name ?? null,
|
|
869
|
+
rec.has_error ?? 0,
|
|
870
|
+
rec.raw_text ?? "",
|
|
871
|
+
rec.version ?? 0,
|
|
854
872
|
rec.author_device_id ?? null,
|
|
855
873
|
rec.scope ?? "business"
|
|
856
874
|
]
|
|
@@ -1255,7 +1273,7 @@ async function cloudPullBehaviors(config) {
|
|
|
1255
1273
|
const existing = await client.execute({
|
|
1256
1274
|
sql: `SELECT COUNT(*) as cnt FROM behaviors
|
|
1257
1275
|
WHERE agent_id = ? AND content = ?`,
|
|
1258
|
-
args: [behavior.agent_id, behavior.content]
|
|
1276
|
+
args: [behavior.agent_id ?? null, behavior.content ?? null]
|
|
1259
1277
|
});
|
|
1260
1278
|
if (Number(existing.rows[0]?.cnt) > 0) continue;
|
|
1261
1279
|
await client.execute({
|
|
@@ -1263,15 +1281,15 @@ async function cloudPullBehaviors(config) {
|
|
|
1263
1281
|
(id, agent_id, project_name, domain, content, active, priority, created_at, updated_at)
|
|
1264
1282
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1265
1283
|
args: [
|
|
1266
|
-
behavior.id,
|
|
1267
|
-
behavior.agent_id,
|
|
1284
|
+
behavior.id ?? null,
|
|
1285
|
+
behavior.agent_id ?? null,
|
|
1268
1286
|
behavior.project_name ?? null,
|
|
1269
1287
|
behavior.domain ?? null,
|
|
1270
|
-
behavior.content,
|
|
1271
|
-
behavior.active,
|
|
1288
|
+
behavior.content ?? null,
|
|
1289
|
+
behavior.active ?? 1,
|
|
1272
1290
|
behavior.priority ?? "p1",
|
|
1273
|
-
behavior.created_at,
|
|
1274
|
-
behavior.updated_at
|
|
1291
|
+
behavior.created_at ?? null,
|
|
1292
|
+
behavior.updated_at ?? null
|
|
1275
1293
|
]
|
|
1276
1294
|
});
|
|
1277
1295
|
pulled++;
|
|
@@ -1412,16 +1430,16 @@ async function cloudPullTasks(config) {
|
|
|
1412
1430
|
blocked_by, parent_task_id, budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at)
|
|
1413
1431
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1414
1432
|
args: [
|
|
1415
|
-
t.id,
|
|
1416
|
-
t.title,
|
|
1417
|
-
t.assigned_to,
|
|
1418
|
-
t.assigned_by,
|
|
1419
|
-
t.project_name,
|
|
1433
|
+
t.id ?? null,
|
|
1434
|
+
t.title ?? null,
|
|
1435
|
+
t.assigned_to ?? null,
|
|
1436
|
+
t.assigned_by ?? null,
|
|
1437
|
+
t.project_name ?? null,
|
|
1420
1438
|
t.priority ?? "p1",
|
|
1421
1439
|
t.status ?? "open",
|
|
1422
1440
|
t.task_file ?? null,
|
|
1423
|
-
t.created_at,
|
|
1424
|
-
t.updated_at,
|
|
1441
|
+
t.created_at ?? null,
|
|
1442
|
+
t.updated_at ?? null,
|
|
1425
1443
|
t.blocked_by ?? null,
|
|
1426
1444
|
t.parent_task_id ?? null,
|
|
1427
1445
|
t.budget_tokens ?? null,
|
|
@@ -1459,15 +1477,15 @@ async function cloudPullConversations(config) {
|
|
|
1459
1477
|
content_metadata, agent_response, agent_name, timestamp, ingested_at)
|
|
1460
1478
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1461
1479
|
args: [
|
|
1462
|
-
c.id,
|
|
1463
|
-
c.platform,
|
|
1480
|
+
c.id ?? null,
|
|
1481
|
+
c.platform ?? null,
|
|
1464
1482
|
c.external_id ?? null,
|
|
1465
|
-
c.sender_id,
|
|
1483
|
+
c.sender_id ?? null,
|
|
1466
1484
|
c.sender_name ?? null,
|
|
1467
1485
|
c.sender_phone ?? null,
|
|
1468
1486
|
c.sender_email ?? null,
|
|
1469
1487
|
c.recipient_id ?? null,
|
|
1470
|
-
c.channel_id,
|
|
1488
|
+
c.channel_id ?? null,
|
|
1471
1489
|
c.thread_id ?? null,
|
|
1472
1490
|
c.reply_to_id ?? null,
|
|
1473
1491
|
c.content_text ?? null,
|
|
@@ -1475,8 +1493,8 @@ async function cloudPullConversations(config) {
|
|
|
1475
1493
|
c.content_metadata ?? null,
|
|
1476
1494
|
c.agent_response ?? null,
|
|
1477
1495
|
c.agent_name ?? null,
|
|
1478
|
-
c.timestamp,
|
|
1479
|
-
c.ingested_at
|
|
1496
|
+
c.timestamp ?? null,
|
|
1497
|
+
c.ingested_at ?? null
|
|
1480
1498
|
]
|
|
1481
1499
|
}));
|
|
1482
1500
|
await client.batch(stmts, "write");
|
|
@@ -1306,6 +1306,10 @@ function loadLicense() {
|
|
|
1306
1306
|
return null;
|
|
1307
1307
|
}
|
|
1308
1308
|
}
|
|
1309
|
+
function saveLicense(apiKey) {
|
|
1310
|
+
mkdirSync(EXE_AI_DIR, { recursive: true });
|
|
1311
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
1312
|
+
}
|
|
1309
1313
|
async function verifyLicenseJwt(token) {
|
|
1310
1314
|
try {
|
|
1311
1315
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -1396,7 +1400,21 @@ function getCacheAgeMs() {
|
|
|
1396
1400
|
}
|
|
1397
1401
|
}
|
|
1398
1402
|
async function checkLicense() {
|
|
1399
|
-
|
|
1403
|
+
let key = loadLicense();
|
|
1404
|
+
if (!key) {
|
|
1405
|
+
try {
|
|
1406
|
+
const configPath = path3.join(EXE_AI_DIR, "config.json");
|
|
1407
|
+
if (existsSync3(configPath)) {
|
|
1408
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
1409
|
+
const cloud = raw.cloud;
|
|
1410
|
+
if (cloud?.apiKey) {
|
|
1411
|
+
key = cloud.apiKey;
|
|
1412
|
+
saveLicense(key);
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
} catch {
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1400
1418
|
if (!key) return FREE_LICENSE;
|
|
1401
1419
|
const cached = await getCachedLicense();
|
|
1402
1420
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/dist/bin/setup.js
CHANGED
|
@@ -841,7 +841,21 @@ function getCacheAgeMs() {
|
|
|
841
841
|
}
|
|
842
842
|
}
|
|
843
843
|
async function checkLicense() {
|
|
844
|
-
|
|
844
|
+
let key = loadLicense();
|
|
845
|
+
if (!key) {
|
|
846
|
+
try {
|
|
847
|
+
const configPath = path5.join(EXE_AI_DIR, "config.json");
|
|
848
|
+
if (existsSync5(configPath)) {
|
|
849
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
850
|
+
const cloud = raw.cloud;
|
|
851
|
+
if (cloud?.apiKey) {
|
|
852
|
+
key = cloud.apiKey;
|
|
853
|
+
saveLicense(key);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
} catch {
|
|
857
|
+
}
|
|
858
|
+
}
|
|
845
859
|
if (!key) return FREE_LICENSE;
|
|
846
860
|
const cached = await getCachedLicense();
|
|
847
861
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -1773,6 +1773,10 @@ function loadLicense() {
|
|
|
1773
1773
|
return null;
|
|
1774
1774
|
}
|
|
1775
1775
|
}
|
|
1776
|
+
function saveLicense(apiKey) {
|
|
1777
|
+
mkdirSync2(EXE_AI_DIR, { recursive: true });
|
|
1778
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
1779
|
+
}
|
|
1776
1780
|
async function verifyLicenseJwt(token) {
|
|
1777
1781
|
try {
|
|
1778
1782
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -1862,7 +1866,21 @@ function getCacheAgeMs() {
|
|
|
1862
1866
|
}
|
|
1863
1867
|
}
|
|
1864
1868
|
async function checkLicense() {
|
|
1865
|
-
|
|
1869
|
+
let key = loadLicense();
|
|
1870
|
+
if (!key) {
|
|
1871
|
+
try {
|
|
1872
|
+
const configPath = path8.join(EXE_AI_DIR, "config.json");
|
|
1873
|
+
if (existsSync7(configPath)) {
|
|
1874
|
+
const raw = JSON.parse(readFileSync5(configPath, "utf8"));
|
|
1875
|
+
const cloud = raw.cloud;
|
|
1876
|
+
if (cloud?.apiKey) {
|
|
1877
|
+
key = cloud.apiKey;
|
|
1878
|
+
saveLicense(key);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
} catch {
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1866
1884
|
if (!key) return FREE_LICENSE;
|
|
1867
1885
|
const cached = await getCachedLicense();
|
|
1868
1886
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -2396,6 +2396,10 @@ function loadLicense() {
|
|
|
2396
2396
|
return null;
|
|
2397
2397
|
}
|
|
2398
2398
|
}
|
|
2399
|
+
function saveLicense(apiKey) {
|
|
2400
|
+
mkdirSync2(EXE_AI_DIR, { recursive: true });
|
|
2401
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
2402
|
+
}
|
|
2399
2403
|
async function verifyLicenseJwt(token) {
|
|
2400
2404
|
try {
|
|
2401
2405
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -2486,7 +2490,21 @@ function getCacheAgeMs() {
|
|
|
2486
2490
|
}
|
|
2487
2491
|
}
|
|
2488
2492
|
async function checkLicense() {
|
|
2489
|
-
|
|
2493
|
+
let key = loadLicense();
|
|
2494
|
+
if (!key) {
|
|
2495
|
+
try {
|
|
2496
|
+
const configPath = path6.join(EXE_AI_DIR, "config.json");
|
|
2497
|
+
if (existsSync5(configPath)) {
|
|
2498
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
2499
|
+
const cloud = raw.cloud;
|
|
2500
|
+
if (cloud?.apiKey) {
|
|
2501
|
+
key = cloud.apiKey;
|
|
2502
|
+
saveLicense(key);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
} catch {
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2490
2508
|
if (!key) return FREE_LICENSE;
|
|
2491
2509
|
const cached = await getCachedLicense();
|
|
2492
2510
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -1963,6 +1963,10 @@ function loadLicense() {
|
|
|
1963
1963
|
return null;
|
|
1964
1964
|
}
|
|
1965
1965
|
}
|
|
1966
|
+
function saveLicense(apiKey) {
|
|
1967
|
+
mkdirSync2(EXE_AI_DIR, { recursive: true });
|
|
1968
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
1969
|
+
}
|
|
1966
1970
|
async function verifyLicenseJwt(token) {
|
|
1967
1971
|
try {
|
|
1968
1972
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -2052,7 +2056,21 @@ function getCacheAgeMs() {
|
|
|
2052
2056
|
}
|
|
2053
2057
|
}
|
|
2054
2058
|
async function checkLicense() {
|
|
2055
|
-
|
|
2059
|
+
let key = loadLicense();
|
|
2060
|
+
if (!key) {
|
|
2061
|
+
try {
|
|
2062
|
+
const configPath = path7.join(EXE_AI_DIR, "config.json");
|
|
2063
|
+
if (existsSync6(configPath)) {
|
|
2064
|
+
const raw = JSON.parse(readFileSync4(configPath, "utf8"));
|
|
2065
|
+
const cloud = raw.cloud;
|
|
2066
|
+
if (cloud?.apiKey) {
|
|
2067
|
+
key = cloud.apiKey;
|
|
2068
|
+
saveLicense(key);
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
} catch {
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2056
2074
|
if (!key) return FREE_LICENSE;
|
|
2057
2075
|
const cached = await getCachedLicense();
|
|
2058
2076
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -1764,6 +1764,10 @@ function loadLicense() {
|
|
|
1764
1764
|
return null;
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
|
+
function saveLicense(apiKey) {
|
|
1768
|
+
mkdirSync2(EXE_AI_DIR, { recursive: true });
|
|
1769
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
1770
|
+
}
|
|
1767
1771
|
async function verifyLicenseJwt(token) {
|
|
1768
1772
|
try {
|
|
1769
1773
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -1853,7 +1857,21 @@ function getCacheAgeMs() {
|
|
|
1853
1857
|
}
|
|
1854
1858
|
}
|
|
1855
1859
|
async function checkLicense() {
|
|
1856
|
-
|
|
1860
|
+
let key = loadLicense();
|
|
1861
|
+
if (!key) {
|
|
1862
|
+
try {
|
|
1863
|
+
const configPath = path6.join(EXE_AI_DIR, "config.json");
|
|
1864
|
+
if (existsSync6(configPath)) {
|
|
1865
|
+
const raw = JSON.parse(readFileSync4(configPath, "utf8"));
|
|
1866
|
+
const cloud = raw.cloud;
|
|
1867
|
+
if (cloud?.apiKey) {
|
|
1868
|
+
key = cloud.apiKey;
|
|
1869
|
+
saveLicense(key);
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
} catch {
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1857
1875
|
if (!key) return FREE_LICENSE;
|
|
1858
1876
|
const cached = await getCachedLicense();
|
|
1859
1877
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -2712,16 +2730,16 @@ async function cloudSync(config) {
|
|
|
2712
2730
|
author_device_id, scope)
|
|
2713
2731
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2714
2732
|
args: [
|
|
2715
|
-
rec.id,
|
|
2716
|
-
rec.agent_id,
|
|
2717
|
-
rec.agent_role,
|
|
2718
|
-
rec.session_id,
|
|
2719
|
-
rec.timestamp,
|
|
2720
|
-
rec.tool_name,
|
|
2721
|
-
rec.project_name,
|
|
2722
|
-
rec.has_error,
|
|
2723
|
-
rec.raw_text,
|
|
2724
|
-
rec.version,
|
|
2733
|
+
rec.id ?? null,
|
|
2734
|
+
rec.agent_id ?? null,
|
|
2735
|
+
rec.agent_role ?? null,
|
|
2736
|
+
rec.session_id ?? null,
|
|
2737
|
+
rec.timestamp ?? null,
|
|
2738
|
+
rec.tool_name ?? null,
|
|
2739
|
+
rec.project_name ?? null,
|
|
2740
|
+
rec.has_error ?? 0,
|
|
2741
|
+
rec.raw_text ?? "",
|
|
2742
|
+
rec.version ?? 0,
|
|
2725
2743
|
rec.author_device_id ?? null,
|
|
2726
2744
|
rec.scope ?? "business"
|
|
2727
2745
|
]
|
|
@@ -3126,7 +3144,7 @@ async function cloudPullBehaviors(config) {
|
|
|
3126
3144
|
const existing = await client.execute({
|
|
3127
3145
|
sql: `SELECT COUNT(*) as cnt FROM behaviors
|
|
3128
3146
|
WHERE agent_id = ? AND content = ?`,
|
|
3129
|
-
args: [behavior.agent_id, behavior.content]
|
|
3147
|
+
args: [behavior.agent_id ?? null, behavior.content ?? null]
|
|
3130
3148
|
});
|
|
3131
3149
|
if (Number(existing.rows[0]?.cnt) > 0) continue;
|
|
3132
3150
|
await client.execute({
|
|
@@ -3134,15 +3152,15 @@ async function cloudPullBehaviors(config) {
|
|
|
3134
3152
|
(id, agent_id, project_name, domain, content, active, priority, created_at, updated_at)
|
|
3135
3153
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
3136
3154
|
args: [
|
|
3137
|
-
behavior.id,
|
|
3138
|
-
behavior.agent_id,
|
|
3155
|
+
behavior.id ?? null,
|
|
3156
|
+
behavior.agent_id ?? null,
|
|
3139
3157
|
behavior.project_name ?? null,
|
|
3140
3158
|
behavior.domain ?? null,
|
|
3141
|
-
behavior.content,
|
|
3142
|
-
behavior.active,
|
|
3159
|
+
behavior.content ?? null,
|
|
3160
|
+
behavior.active ?? 1,
|
|
3143
3161
|
behavior.priority ?? "p1",
|
|
3144
|
-
behavior.created_at,
|
|
3145
|
-
behavior.updated_at
|
|
3162
|
+
behavior.created_at ?? null,
|
|
3163
|
+
behavior.updated_at ?? null
|
|
3146
3164
|
]
|
|
3147
3165
|
});
|
|
3148
3166
|
pulled++;
|
|
@@ -3283,16 +3301,16 @@ async function cloudPullTasks(config) {
|
|
|
3283
3301
|
blocked_by, parent_task_id, budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at)
|
|
3284
3302
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
3285
3303
|
args: [
|
|
3286
|
-
t.id,
|
|
3287
|
-
t.title,
|
|
3288
|
-
t.assigned_to,
|
|
3289
|
-
t.assigned_by,
|
|
3290
|
-
t.project_name,
|
|
3304
|
+
t.id ?? null,
|
|
3305
|
+
t.title ?? null,
|
|
3306
|
+
t.assigned_to ?? null,
|
|
3307
|
+
t.assigned_by ?? null,
|
|
3308
|
+
t.project_name ?? null,
|
|
3291
3309
|
t.priority ?? "p1",
|
|
3292
3310
|
t.status ?? "open",
|
|
3293
3311
|
t.task_file ?? null,
|
|
3294
|
-
t.created_at,
|
|
3295
|
-
t.updated_at,
|
|
3312
|
+
t.created_at ?? null,
|
|
3313
|
+
t.updated_at ?? null,
|
|
3296
3314
|
t.blocked_by ?? null,
|
|
3297
3315
|
t.parent_task_id ?? null,
|
|
3298
3316
|
t.budget_tokens ?? null,
|
|
@@ -3330,15 +3348,15 @@ async function cloudPullConversations(config) {
|
|
|
3330
3348
|
content_metadata, agent_response, agent_name, timestamp, ingested_at)
|
|
3331
3349
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
3332
3350
|
args: [
|
|
3333
|
-
c.id,
|
|
3334
|
-
c.platform,
|
|
3351
|
+
c.id ?? null,
|
|
3352
|
+
c.platform ?? null,
|
|
3335
3353
|
c.external_id ?? null,
|
|
3336
|
-
c.sender_id,
|
|
3354
|
+
c.sender_id ?? null,
|
|
3337
3355
|
c.sender_name ?? null,
|
|
3338
3356
|
c.sender_phone ?? null,
|
|
3339
3357
|
c.sender_email ?? null,
|
|
3340
3358
|
c.recipient_id ?? null,
|
|
3341
|
-
c.channel_id,
|
|
3359
|
+
c.channel_id ?? null,
|
|
3342
3360
|
c.thread_id ?? null,
|
|
3343
3361
|
c.reply_to_id ?? null,
|
|
3344
3362
|
c.content_text ?? null,
|
|
@@ -3346,8 +3364,8 @@ async function cloudPullConversations(config) {
|
|
|
3346
3364
|
c.content_metadata ?? null,
|
|
3347
3365
|
c.agent_response ?? null,
|
|
3348
3366
|
c.agent_name ?? null,
|
|
3349
|
-
c.timestamp,
|
|
3350
|
-
c.ingested_at
|
|
3367
|
+
c.timestamp ?? null,
|
|
3368
|
+
c.ingested_at ?? null
|
|
3351
3369
|
]
|
|
3352
3370
|
}));
|
|
3353
3371
|
await client.batch(stmts, "write");
|
package/dist/lib/cloud-sync.js
CHANGED
|
@@ -297,6 +297,10 @@ function loadLicense() {
|
|
|
297
297
|
return null;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
+
function saveLicense(apiKey) {
|
|
301
|
+
mkdirSync(EXE_AI_DIR, { recursive: true });
|
|
302
|
+
writeFileSync(LICENSE_PATH, apiKey.trim(), { encoding: "utf8", mode: 384 });
|
|
303
|
+
}
|
|
300
304
|
async function verifyLicenseJwt(token) {
|
|
301
305
|
try {
|
|
302
306
|
const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
|
|
@@ -387,7 +391,21 @@ function getCacheAgeMs() {
|
|
|
387
391
|
}
|
|
388
392
|
}
|
|
389
393
|
async function checkLicense() {
|
|
390
|
-
|
|
394
|
+
let key = loadLicense();
|
|
395
|
+
if (!key) {
|
|
396
|
+
try {
|
|
397
|
+
const configPath = path3.join(EXE_AI_DIR, "config.json");
|
|
398
|
+
if (existsSync3(configPath)) {
|
|
399
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
400
|
+
const cloud = raw.cloud;
|
|
401
|
+
if (cloud?.apiKey) {
|
|
402
|
+
key = cloud.apiKey;
|
|
403
|
+
saveLicense(key);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
} catch {
|
|
407
|
+
}
|
|
408
|
+
}
|
|
391
409
|
if (!key) return FREE_LICENSE;
|
|
392
410
|
const cached = await getCachedLicense();
|
|
393
411
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
|
@@ -592,16 +610,16 @@ async function cloudSync(config) {
|
|
|
592
610
|
author_device_id, scope)
|
|
593
611
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
594
612
|
args: [
|
|
595
|
-
rec.id,
|
|
596
|
-
rec.agent_id,
|
|
597
|
-
rec.agent_role,
|
|
598
|
-
rec.session_id,
|
|
599
|
-
rec.timestamp,
|
|
600
|
-
rec.tool_name,
|
|
601
|
-
rec.project_name,
|
|
602
|
-
rec.has_error,
|
|
603
|
-
rec.raw_text,
|
|
604
|
-
rec.version,
|
|
613
|
+
rec.id ?? null,
|
|
614
|
+
rec.agent_id ?? null,
|
|
615
|
+
rec.agent_role ?? null,
|
|
616
|
+
rec.session_id ?? null,
|
|
617
|
+
rec.timestamp ?? null,
|
|
618
|
+
rec.tool_name ?? null,
|
|
619
|
+
rec.project_name ?? null,
|
|
620
|
+
rec.has_error ?? 0,
|
|
621
|
+
rec.raw_text ?? "",
|
|
622
|
+
rec.version ?? 0,
|
|
605
623
|
rec.author_device_id ?? null,
|
|
606
624
|
rec.scope ?? "business"
|
|
607
625
|
]
|
|
@@ -1007,7 +1025,7 @@ async function cloudPullBehaviors(config) {
|
|
|
1007
1025
|
const existing = await client.execute({
|
|
1008
1026
|
sql: `SELECT COUNT(*) as cnt FROM behaviors
|
|
1009
1027
|
WHERE agent_id = ? AND content = ?`,
|
|
1010
|
-
args: [behavior.agent_id, behavior.content]
|
|
1028
|
+
args: [behavior.agent_id ?? null, behavior.content ?? null]
|
|
1011
1029
|
});
|
|
1012
1030
|
if (Number(existing.rows[0]?.cnt) > 0) continue;
|
|
1013
1031
|
await client.execute({
|
|
@@ -1015,15 +1033,15 @@ async function cloudPullBehaviors(config) {
|
|
|
1015
1033
|
(id, agent_id, project_name, domain, content, active, priority, created_at, updated_at)
|
|
1016
1034
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1017
1035
|
args: [
|
|
1018
|
-
behavior.id,
|
|
1019
|
-
behavior.agent_id,
|
|
1036
|
+
behavior.id ?? null,
|
|
1037
|
+
behavior.agent_id ?? null,
|
|
1020
1038
|
behavior.project_name ?? null,
|
|
1021
1039
|
behavior.domain ?? null,
|
|
1022
|
-
behavior.content,
|
|
1023
|
-
behavior.active,
|
|
1040
|
+
behavior.content ?? null,
|
|
1041
|
+
behavior.active ?? 1,
|
|
1024
1042
|
behavior.priority ?? "p1",
|
|
1025
|
-
behavior.created_at,
|
|
1026
|
-
behavior.updated_at
|
|
1043
|
+
behavior.created_at ?? null,
|
|
1044
|
+
behavior.updated_at ?? null
|
|
1027
1045
|
]
|
|
1028
1046
|
});
|
|
1029
1047
|
pulled++;
|
|
@@ -1164,16 +1182,16 @@ async function cloudPullTasks(config) {
|
|
|
1164
1182
|
blocked_by, parent_task_id, budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at)
|
|
1165
1183
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1166
1184
|
args: [
|
|
1167
|
-
t.id,
|
|
1168
|
-
t.title,
|
|
1169
|
-
t.assigned_to,
|
|
1170
|
-
t.assigned_by,
|
|
1171
|
-
t.project_name,
|
|
1185
|
+
t.id ?? null,
|
|
1186
|
+
t.title ?? null,
|
|
1187
|
+
t.assigned_to ?? null,
|
|
1188
|
+
t.assigned_by ?? null,
|
|
1189
|
+
t.project_name ?? null,
|
|
1172
1190
|
t.priority ?? "p1",
|
|
1173
1191
|
t.status ?? "open",
|
|
1174
1192
|
t.task_file ?? null,
|
|
1175
|
-
t.created_at,
|
|
1176
|
-
t.updated_at,
|
|
1193
|
+
t.created_at ?? null,
|
|
1194
|
+
t.updated_at ?? null,
|
|
1177
1195
|
t.blocked_by ?? null,
|
|
1178
1196
|
t.parent_task_id ?? null,
|
|
1179
1197
|
t.budget_tokens ?? null,
|
|
@@ -1211,15 +1229,15 @@ async function cloudPullConversations(config) {
|
|
|
1211
1229
|
content_metadata, agent_response, agent_name, timestamp, ingested_at)
|
|
1212
1230
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
1213
1231
|
args: [
|
|
1214
|
-
c.id,
|
|
1215
|
-
c.platform,
|
|
1232
|
+
c.id ?? null,
|
|
1233
|
+
c.platform ?? null,
|
|
1216
1234
|
c.external_id ?? null,
|
|
1217
|
-
c.sender_id,
|
|
1235
|
+
c.sender_id ?? null,
|
|
1218
1236
|
c.sender_name ?? null,
|
|
1219
1237
|
c.sender_phone ?? null,
|
|
1220
1238
|
c.sender_email ?? null,
|
|
1221
1239
|
c.recipient_id ?? null,
|
|
1222
|
-
c.channel_id,
|
|
1240
|
+
c.channel_id ?? null,
|
|
1223
1241
|
c.thread_id ?? null,
|
|
1224
1242
|
c.reply_to_id ?? null,
|
|
1225
1243
|
c.content_text ?? null,
|
|
@@ -1227,8 +1245,8 @@ async function cloudPullConversations(config) {
|
|
|
1227
1245
|
c.content_metadata ?? null,
|
|
1228
1246
|
c.agent_response ?? null,
|
|
1229
1247
|
c.agent_name ?? null,
|
|
1230
|
-
c.timestamp,
|
|
1231
|
-
c.ingested_at
|
|
1248
|
+
c.timestamp ?? null,
|
|
1249
|
+
c.ingested_at ?? null
|
|
1232
1250
|
]
|
|
1233
1251
|
}));
|
|
1234
1252
|
await client.batch(stmts, "write");
|
package/dist/lib/license.js
CHANGED
|
@@ -269,7 +269,21 @@ function getCacheAgeMs() {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
async function checkLicense() {
|
|
272
|
-
|
|
272
|
+
let key = loadLicense();
|
|
273
|
+
if (!key) {
|
|
274
|
+
try {
|
|
275
|
+
const configPath = path2.join(EXE_AI_DIR, "config.json");
|
|
276
|
+
if (existsSync2(configPath)) {
|
|
277
|
+
const raw = JSON.parse(readFileSync2(configPath, "utf8"));
|
|
278
|
+
const cloud = raw.cloud;
|
|
279
|
+
if (cloud?.apiKey) {
|
|
280
|
+
key = cloud.apiKey;
|
|
281
|
+
saveLicense(key);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} catch {
|
|
285
|
+
}
|
|
286
|
+
}
|
|
273
287
|
if (!key) return FREE_LICENSE;
|
|
274
288
|
const cached = await getCachedLicense();
|
|
275
289
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/dist/mcp/server.js
CHANGED
|
@@ -3455,7 +3455,21 @@ function getCacheAgeMs() {
|
|
|
3455
3455
|
}
|
|
3456
3456
|
}
|
|
3457
3457
|
async function checkLicense() {
|
|
3458
|
-
|
|
3458
|
+
let key = loadLicense();
|
|
3459
|
+
if (!key) {
|
|
3460
|
+
try {
|
|
3461
|
+
const configPath = path10.join(EXE_AI_DIR, "config.json");
|
|
3462
|
+
if (existsSync8(configPath)) {
|
|
3463
|
+
const raw = JSON.parse(readFileSync6(configPath, "utf8"));
|
|
3464
|
+
const cloud = raw.cloud;
|
|
3465
|
+
if (cloud?.apiKey) {
|
|
3466
|
+
key = cloud.apiKey;
|
|
3467
|
+
saveLicense(key);
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
} catch {
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3459
3473
|
if (!key) return FREE_LICENSE;
|
|
3460
3474
|
const cached = await getCachedLicense();
|
|
3461
3475
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/dist/tui/App.js
CHANGED
|
@@ -1443,7 +1443,21 @@ function getCacheAgeMs() {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
}
|
|
1445
1445
|
async function checkLicense() {
|
|
1446
|
-
|
|
1446
|
+
let key = loadLicense();
|
|
1447
|
+
if (!key) {
|
|
1448
|
+
try {
|
|
1449
|
+
const configPath = path2.join(EXE_AI_DIR, "config.json");
|
|
1450
|
+
if (existsSync3(configPath)) {
|
|
1451
|
+
const raw = JSON.parse(readFileSync3(configPath, "utf8"));
|
|
1452
|
+
const cloud = raw.cloud;
|
|
1453
|
+
if (cloud?.apiKey) {
|
|
1454
|
+
key = cloud.apiKey;
|
|
1455
|
+
saveLicense(key);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
} catch {
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1447
1461
|
if (!key) return FREE_LICENSE;
|
|
1448
1462
|
const cached = await getCachedLicense();
|
|
1449
1463
|
if (cached && getCacheAgeMs() < CACHE_MAX_AGE_MS) return cached;
|
package/package.json
CHANGED