@askexenow/exe-os 0.8.44 → 0.8.46
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/exe-boot.js +33 -14
- package/dist/bin/exe-cloud.js +46 -39
- package/dist/bin/exe-link.js +999 -279
- package/dist/bin/exe-settings.js +36 -24
- package/dist/hooks/summary-worker.js +17 -6
- package/dist/lib/cloud-sync.js +1021 -274
- package/package.json +1 -1
package/dist/bin/exe-settings.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
|
+
var __esm = (fn, res) => function __init() {
|
|
3
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// src/lib/db-retry.ts
|
|
7
|
+
var init_db_retry = __esm({
|
|
8
|
+
"src/lib/db-retry.ts"() {
|
|
9
|
+
"use strict";
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
// src/lib/database.ts
|
|
14
|
+
import { createClient } from "@libsql/client";
|
|
15
|
+
var init_database = __esm({
|
|
16
|
+
"src/lib/database.ts"() {
|
|
17
|
+
"use strict";
|
|
18
|
+
init_db_retry();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
1
22
|
// src/bin/exe-settings.ts
|
|
2
23
|
import { createInterface } from "readline";
|
|
3
24
|
|
|
@@ -208,46 +229,37 @@ function isMainModule(importMetaUrl) {
|
|
|
208
229
|
}
|
|
209
230
|
|
|
210
231
|
// src/lib/cloud-sync.ts
|
|
211
|
-
|
|
232
|
+
init_database();
|
|
233
|
+
import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync4, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync, openSync, closeSync } from "fs";
|
|
212
234
|
import crypto2 from "crypto";
|
|
213
|
-
import
|
|
235
|
+
import path4 from "path";
|
|
214
236
|
import { homedir } from "os";
|
|
215
237
|
|
|
216
|
-
// src/lib/database.ts
|
|
217
|
-
import { createClient } from "@libsql/client";
|
|
218
|
-
|
|
219
238
|
// src/lib/crypto.ts
|
|
220
239
|
import crypto from "crypto";
|
|
221
240
|
|
|
222
241
|
// src/lib/compress.ts
|
|
223
242
|
import { brotliCompressSync, brotliDecompressSync, constants } from "zlib";
|
|
224
243
|
|
|
225
|
-
// src/lib/
|
|
226
|
-
import { readFileSync as
|
|
227
|
-
import
|
|
244
|
+
// src/lib/license.ts
|
|
245
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
|
|
246
|
+
import { randomUUID } from "crypto";
|
|
247
|
+
import path2 from "path";
|
|
248
|
+
import { jwtVerify, importSPKI } from "jose";
|
|
249
|
+
var LICENSE_PATH = path2.join(EXE_AI_DIR, "license.key");
|
|
250
|
+
var CACHE_PATH = path2.join(EXE_AI_DIR, "license-cache.json");
|
|
251
|
+
var DEVICE_ID_PATH = path2.join(EXE_AI_DIR, "device-id");
|
|
228
252
|
|
|
229
253
|
// src/lib/employees.ts
|
|
230
254
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
231
|
-
import { existsSync as
|
|
255
|
+
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync3 } from "fs";
|
|
232
256
|
import { execSync } from "child_process";
|
|
233
|
-
import path2 from "path";
|
|
234
|
-
var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
235
|
-
|
|
236
|
-
// src/lib/license.ts
|
|
237
|
-
import { readFileSync as readFileSync3, writeFileSync, existsSync as existsSync3, mkdirSync } from "fs";
|
|
238
|
-
import { randomUUID } from "crypto";
|
|
239
257
|
import path3 from "path";
|
|
240
|
-
|
|
241
|
-
var LICENSE_PATH = path3.join(EXE_AI_DIR, "license.key");
|
|
242
|
-
var CACHE_PATH = path3.join(EXE_AI_DIR, "license-cache.json");
|
|
243
|
-
var DEVICE_ID_PATH = path3.join(EXE_AI_DIR, "device-id");
|
|
244
|
-
|
|
245
|
-
// src/lib/plan-limits.ts
|
|
246
|
-
var CACHE_PATH2 = path4.join(EXE_AI_DIR, "license-cache.json");
|
|
258
|
+
var EMPLOYEES_PATH = path3.join(EXE_AI_DIR, "exe-employees.json");
|
|
247
259
|
|
|
248
260
|
// src/lib/cloud-sync.ts
|
|
249
261
|
var LOCALHOST_PATTERNS = /^(localhost|127\.0\.0\.1|\[::1\])$/i;
|
|
250
|
-
var ROSTER_LOCK_PATH =
|
|
262
|
+
var ROSTER_LOCK_PATH = path4.join(EXE_AI_DIR, "roster-merge.lock");
|
|
251
263
|
function assertSecureEndpoint(endpoint) {
|
|
252
264
|
if (endpoint.startsWith("https://")) return;
|
|
253
265
|
if (endpoint.startsWith("http://")) {
|
|
@@ -262,7 +274,7 @@ function assertSecureEndpoint(endpoint) {
|
|
|
262
274
|
);
|
|
263
275
|
}
|
|
264
276
|
}
|
|
265
|
-
var ROSTER_DELETIONS_PATH =
|
|
277
|
+
var ROSTER_DELETIONS_PATH = path4.join(EXE_AI_DIR, "roster-deletions.json");
|
|
266
278
|
|
|
267
279
|
// src/bin/exe-settings.ts
|
|
268
280
|
function label(value) {
|
|
@@ -2709,16 +2709,25 @@ async function cloudPull(sinceVersion, config) {
|
|
|
2709
2709
|
}
|
|
2710
2710
|
}
|
|
2711
2711
|
async function cloudSync(config) {
|
|
2712
|
-
await assertFeature("cloud_sync");
|
|
2713
2712
|
let client;
|
|
2714
2713
|
try {
|
|
2715
2714
|
client = getClient();
|
|
2716
2715
|
} catch {
|
|
2717
2716
|
throw new Error("[cloud-sync] Database not initialized. Call initStore() before cloudSync().");
|
|
2718
2717
|
}
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2718
|
+
let pullMeta;
|
|
2719
|
+
try {
|
|
2720
|
+
pullMeta = await client.execute(
|
|
2721
|
+
"SELECT value FROM sync_meta WHERE key = 'last_cloud_pull_version'"
|
|
2722
|
+
);
|
|
2723
|
+
} catch (e) {
|
|
2724
|
+
logError(`[cloud-sync] sync_meta read failed (${e instanceof Error ? e.message : String(e)}), attempting ensureSchema`);
|
|
2725
|
+
const { ensureSchema: ensureSchema2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
2726
|
+
await ensureSchema2();
|
|
2727
|
+
pullMeta = await client.execute(
|
|
2728
|
+
"SELECT value FROM sync_meta WHERE key = 'last_cloud_pull_version'"
|
|
2729
|
+
);
|
|
2730
|
+
}
|
|
2722
2731
|
const lastPullVersion = pullMeta.rows.length > 0 ? Number(pullMeta.rows[0].value) : 0;
|
|
2723
2732
|
const pullResult = await cloudPull(lastPullVersion, config);
|
|
2724
2733
|
let pulled = 0;
|
|
@@ -3435,7 +3444,6 @@ var init_cloud_sync = __esm({
|
|
|
3435
3444
|
init_database();
|
|
3436
3445
|
init_crypto();
|
|
3437
3446
|
init_compress();
|
|
3438
|
-
init_plan_limits();
|
|
3439
3447
|
init_license();
|
|
3440
3448
|
init_config();
|
|
3441
3449
|
init_employees();
|
|
@@ -4049,7 +4057,10 @@ async function main() {
|
|
|
4049
4057
|
await cloudSync2({ apiKey: cfg.cloud.apiKey, endpoint: cfg.cloud.endpoint });
|
|
4050
4058
|
}
|
|
4051
4059
|
} catch (err) {
|
|
4052
|
-
|
|
4060
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
4061
|
+
const stack = err instanceof Error && err.stack ? "\n " + err.stack.split("\n").slice(1, 4).join("\n ") : "";
|
|
4062
|
+
process.stderr.write(`[summary-worker] cloud sync failed: ${msg}${stack}
|
|
4063
|
+
`);
|
|
4053
4064
|
}
|
|
4054
4065
|
if (agentId !== "exe" && agentId !== "default") {
|
|
4055
4066
|
try {
|