@askexenow/exe-os 0.8.44 → 0.8.45

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,14 +229,12 @@ function isMainModule(importMetaUrl) {
208
229
  }
209
230
 
210
231
  // src/lib/cloud-sync.ts
232
+ init_database();
211
233
  import { readFileSync as readFileSync5, writeFileSync as writeFileSync2, existsSync as existsSync5, readdirSync, mkdirSync as mkdirSync2, appendFileSync, unlinkSync, openSync, closeSync } from "fs";
212
234
  import crypto2 from "crypto";
213
235
  import path5 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
 
@@ -223,6 +242,7 @@ import crypto from "crypto";
223
242
  import { brotliCompressSync, brotliDecompressSync, constants } from "zlib";
224
243
 
225
244
  // src/lib/plan-limits.ts
245
+ init_database();
226
246
  import { readFileSync as readFileSync4, existsSync as existsSync4 } from "fs";
227
247
  import path4 from "path";
228
248
 
@@ -2716,9 +2716,19 @@ async function cloudSync(config) {
2716
2716
  } catch {
2717
2717
  throw new Error("[cloud-sync] Database not initialized. Call initStore() before cloudSync().");
2718
2718
  }
2719
- const pullMeta = await client.execute(
2720
- "SELECT value FROM sync_meta WHERE key = 'last_cloud_pull_version'"
2721
- );
2719
+ let pullMeta;
2720
+ try {
2721
+ pullMeta = await client.execute(
2722
+ "SELECT value FROM sync_meta WHERE key = 'last_cloud_pull_version'"
2723
+ );
2724
+ } catch (e) {
2725
+ logError(`[cloud-sync] sync_meta read failed (${e instanceof Error ? e.message : String(e)}), attempting ensureSchema`);
2726
+ const { ensureSchema: ensureSchema2 } = await Promise.resolve().then(() => (init_database(), database_exports));
2727
+ await ensureSchema2();
2728
+ pullMeta = await client.execute(
2729
+ "SELECT value FROM sync_meta WHERE key = 'last_cloud_pull_version'"
2730
+ );
2731
+ }
2722
2732
  const lastPullVersion = pullMeta.rows.length > 0 ? Number(pullMeta.rows[0].value) : 0;
2723
2733
  const pullResult = await cloudPull(lastPullVersion, config);
2724
2734
  let pulled = 0;
@@ -4049,7 +4059,10 @@ async function main() {
4049
4059
  await cloudSync2({ apiKey: cfg.cloud.apiKey, endpoint: cfg.cloud.endpoint });
4050
4060
  }
4051
4061
  } catch (err) {
4052
- process.stderr.write("[summary-worker] cloud sync failed: " + (err instanceof Error ? err.message : String(err)) + "\n");
4062
+ const msg = err instanceof Error ? err.message : String(err);
4063
+ const stack = err instanceof Error && err.stack ? "\n " + err.stack.split("\n").slice(1, 4).join("\n ") : "";
4064
+ process.stderr.write(`[summary-worker] cloud sync failed: ${msg}${stack}
4065
+ `);
4053
4066
  }
4054
4067
  if (agentId !== "exe" && agentId !== "default") {
4055
4068
  try {