@askexenow/exe-os 0.8.43 → 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.
- package/dist/bin/exe-boot.js +63 -34
- package/dist/bin/exe-cloud.js +18 -3
- package/dist/bin/exe-link.js +956 -41
- package/dist/bin/exe-settings.js +23 -3
- package/dist/hooks/summary-worker.js +47 -34
- package/dist/lib/cloud-sync.js +986 -46
- 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,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
|
-
|
|
2720
|
-
|
|
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;
|
|
@@ -2730,16 +2740,16 @@ async function cloudSync(config) {
|
|
|
2730
2740
|
author_device_id, scope)
|
|
2731
2741
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
2732
2742
|
args: [
|
|
2733
|
-
rec.id,
|
|
2734
|
-
rec.agent_id,
|
|
2735
|
-
rec.agent_role,
|
|
2736
|
-
rec.session_id,
|
|
2737
|
-
rec.timestamp,
|
|
2738
|
-
rec.tool_name,
|
|
2739
|
-
rec.project_name,
|
|
2740
|
-
rec.has_error,
|
|
2741
|
-
rec.raw_text,
|
|
2742
|
-
rec.version,
|
|
2743
|
+
rec.id ?? null,
|
|
2744
|
+
rec.agent_id ?? null,
|
|
2745
|
+
rec.agent_role ?? null,
|
|
2746
|
+
rec.session_id ?? null,
|
|
2747
|
+
rec.timestamp ?? null,
|
|
2748
|
+
rec.tool_name ?? null,
|
|
2749
|
+
rec.project_name ?? null,
|
|
2750
|
+
rec.has_error ?? 0,
|
|
2751
|
+
rec.raw_text ?? "",
|
|
2752
|
+
rec.version ?? 0,
|
|
2743
2753
|
rec.author_device_id ?? null,
|
|
2744
2754
|
rec.scope ?? "business"
|
|
2745
2755
|
]
|
|
@@ -3144,7 +3154,7 @@ async function cloudPullBehaviors(config) {
|
|
|
3144
3154
|
const existing = await client.execute({
|
|
3145
3155
|
sql: `SELECT COUNT(*) as cnt FROM behaviors
|
|
3146
3156
|
WHERE agent_id = ? AND content = ?`,
|
|
3147
|
-
args: [behavior.agent_id, behavior.content]
|
|
3157
|
+
args: [behavior.agent_id ?? null, behavior.content ?? null]
|
|
3148
3158
|
});
|
|
3149
3159
|
if (Number(existing.rows[0]?.cnt) > 0) continue;
|
|
3150
3160
|
await client.execute({
|
|
@@ -3152,15 +3162,15 @@ async function cloudPullBehaviors(config) {
|
|
|
3152
3162
|
(id, agent_id, project_name, domain, content, active, priority, created_at, updated_at)
|
|
3153
3163
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
3154
3164
|
args: [
|
|
3155
|
-
behavior.id,
|
|
3156
|
-
behavior.agent_id,
|
|
3165
|
+
behavior.id ?? null,
|
|
3166
|
+
behavior.agent_id ?? null,
|
|
3157
3167
|
behavior.project_name ?? null,
|
|
3158
3168
|
behavior.domain ?? null,
|
|
3159
|
-
behavior.content,
|
|
3160
|
-
behavior.active,
|
|
3169
|
+
behavior.content ?? null,
|
|
3170
|
+
behavior.active ?? 1,
|
|
3161
3171
|
behavior.priority ?? "p1",
|
|
3162
|
-
behavior.created_at,
|
|
3163
|
-
behavior.updated_at
|
|
3172
|
+
behavior.created_at ?? null,
|
|
3173
|
+
behavior.updated_at ?? null
|
|
3164
3174
|
]
|
|
3165
3175
|
});
|
|
3166
3176
|
pulled++;
|
|
@@ -3301,16 +3311,16 @@ async function cloudPullTasks(config) {
|
|
|
3301
3311
|
blocked_by, parent_task_id, budget_tokens, budget_fallback_model, tokens_used, tokens_warned_at)
|
|
3302
3312
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
3303
3313
|
args: [
|
|
3304
|
-
t.id,
|
|
3305
|
-
t.title,
|
|
3306
|
-
t.assigned_to,
|
|
3307
|
-
t.assigned_by,
|
|
3308
|
-
t.project_name,
|
|
3314
|
+
t.id ?? null,
|
|
3315
|
+
t.title ?? null,
|
|
3316
|
+
t.assigned_to ?? null,
|
|
3317
|
+
t.assigned_by ?? null,
|
|
3318
|
+
t.project_name ?? null,
|
|
3309
3319
|
t.priority ?? "p1",
|
|
3310
3320
|
t.status ?? "open",
|
|
3311
3321
|
t.task_file ?? null,
|
|
3312
|
-
t.created_at,
|
|
3313
|
-
t.updated_at,
|
|
3322
|
+
t.created_at ?? null,
|
|
3323
|
+
t.updated_at ?? null,
|
|
3314
3324
|
t.blocked_by ?? null,
|
|
3315
3325
|
t.parent_task_id ?? null,
|
|
3316
3326
|
t.budget_tokens ?? null,
|
|
@@ -3348,15 +3358,15 @@ async function cloudPullConversations(config) {
|
|
|
3348
3358
|
content_metadata, agent_response, agent_name, timestamp, ingested_at)
|
|
3349
3359
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
3350
3360
|
args: [
|
|
3351
|
-
c.id,
|
|
3352
|
-
c.platform,
|
|
3361
|
+
c.id ?? null,
|
|
3362
|
+
c.platform ?? null,
|
|
3353
3363
|
c.external_id ?? null,
|
|
3354
|
-
c.sender_id,
|
|
3364
|
+
c.sender_id ?? null,
|
|
3355
3365
|
c.sender_name ?? null,
|
|
3356
3366
|
c.sender_phone ?? null,
|
|
3357
3367
|
c.sender_email ?? null,
|
|
3358
3368
|
c.recipient_id ?? null,
|
|
3359
|
-
c.channel_id,
|
|
3369
|
+
c.channel_id ?? null,
|
|
3360
3370
|
c.thread_id ?? null,
|
|
3361
3371
|
c.reply_to_id ?? null,
|
|
3362
3372
|
c.content_text ?? null,
|
|
@@ -3364,8 +3374,8 @@ async function cloudPullConversations(config) {
|
|
|
3364
3374
|
c.content_metadata ?? null,
|
|
3365
3375
|
c.agent_response ?? null,
|
|
3366
3376
|
c.agent_name ?? null,
|
|
3367
|
-
c.timestamp,
|
|
3368
|
-
c.ingested_at
|
|
3377
|
+
c.timestamp ?? null,
|
|
3378
|
+
c.ingested_at ?? null
|
|
3369
3379
|
]
|
|
3370
3380
|
}));
|
|
3371
3381
|
await client.batch(stmts, "write");
|
|
@@ -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
|
-
|
|
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 {
|