@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.
@@ -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
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, existsSync as existsSync5, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync, openSync, closeSync } from "fs";
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 path5 from "path";
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/plan-limits.ts
226
- import { readFileSync as readFileSync4, existsSync as existsSync4 } from "fs";
227
- import path4 from "path";
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 existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2 } from "fs";
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
- import { jwtVerify, importSPKI } from "jose";
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 = path5.join(EXE_AI_DIR, "roster-merge.lock");
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 = path5.join(EXE_AI_DIR, "roster-deletions.json");
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
- const pullMeta = await client.execute(
2720
- "SELECT value FROM sync_meta WHERE key = 'last_cloud_pull_version'"
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
- process.stderr.write("[summary-worker] cloud sync failed: " + (err instanceof Error ? err.message : String(err)) + "\n");
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 {