@askexenow/exe-os 0.9.38 → 0.9.39
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/backfill-conversations.js +34 -7
- package/dist/bin/backfill-responses.js +34 -7
- package/dist/bin/backfill-vectors.js +34 -7
- package/dist/bin/cleanup-stale-review-tasks.js +35 -8
- package/dist/bin/cli.js +72 -42
- package/dist/bin/exe-agent.js +11 -3
- package/dist/bin/exe-assign.js +34 -7
- package/dist/bin/exe-boot.js +48 -18
- package/dist/bin/exe-call.js +132 -340
- package/dist/bin/exe-dispatch.js +34 -7
- package/dist/bin/exe-doctor.js +37 -10
- package/dist/bin/exe-export-behaviors.js +36 -9
- package/dist/bin/exe-forget.js +34 -7
- package/dist/bin/exe-gateway.js +40 -12
- package/dist/bin/exe-heartbeat.js +35 -8
- package/dist/bin/exe-kill.js +34 -7
- package/dist/bin/exe-launch-agent.js +285 -1079
- package/dist/bin/exe-new-employee.js +29 -10
- package/dist/bin/exe-pending-messages.js +34 -7
- package/dist/bin/exe-pending-notifications.js +34 -7
- package/dist/bin/exe-pending-reviews.js +34 -7
- package/dist/bin/exe-rename.js +41 -13
- package/dist/bin/exe-review.js +34 -7
- package/dist/bin/exe-search.js +36 -9
- package/dist/bin/exe-session-cleanup.js +36 -9
- package/dist/bin/exe-start-codex.js +36 -9
- package/dist/bin/exe-start-opencode.js +36 -9
- package/dist/bin/exe-status.js +35 -8
- package/dist/bin/exe-team.js +34 -7
- package/dist/bin/git-sweep.js +34 -7
- package/dist/bin/graph-backfill.js +34 -7
- package/dist/bin/graph-export.js +34 -7
- package/dist/bin/install.js +2 -1
- package/dist/bin/intercom-check.js +36 -9
- package/dist/bin/scan-tasks.js +34 -7
- package/dist/bin/setup.js +18 -17
- package/dist/bin/shard-migrate.js +34 -7
- package/dist/gateway/index.js +38 -10
- package/dist/hooks/bug-report-worker.js +38 -10
- package/dist/hooks/codex-stop-task-finalizer.js +36 -9
- package/dist/hooks/commit-complete.js +34 -7
- package/dist/hooks/error-recall.js +36 -9
- package/dist/hooks/ingest.js +36 -8
- package/dist/hooks/instructions-loaded.js +42 -10
- package/dist/hooks/notification.js +34 -7
- package/dist/hooks/post-compact.js +34 -7
- package/dist/hooks/post-tool-combined.js +37 -10
- package/dist/hooks/pre-compact.js +35 -8
- package/dist/hooks/pre-tool-use.js +36 -8
- package/dist/hooks/prompt-submit.js +41 -13
- package/dist/hooks/session-end.js +35 -8
- package/dist/hooks/session-start.js +47 -14
- package/dist/hooks/stop.js +35 -8
- package/dist/hooks/subagent-stop.js +34 -7
- package/dist/hooks/summary-worker.js +43 -16
- package/dist/index.js +36 -8
- package/dist/lib/consolidation.js +2 -1
- package/dist/lib/employee-templates.js +2 -1
- package/dist/lib/employees.js +2 -1
- package/dist/lib/exe-daemon.js +136 -36
- package/dist/lib/hybrid-search.js +36 -9
- package/dist/lib/identity.js +8 -3
- package/dist/lib/schedules.js +34 -7
- package/dist/lib/store.js +34 -7
- package/dist/mcp/server.js +133 -33
- package/dist/mcp/tools/create-task.js +10 -4
- package/dist/runtime/index.js +34 -7
- package/dist/tui/App.js +40 -11
- package/package.json +1 -1
package/dist/hooks/stop.js
CHANGED
|
@@ -3698,7 +3698,7 @@ __export(shard_manager_exports, {
|
|
|
3698
3698
|
shardExists: () => shardExists
|
|
3699
3699
|
});
|
|
3700
3700
|
import path14 from "path";
|
|
3701
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync3 } from "fs";
|
|
3701
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync3, renameSync as renameSync4, statSync as statSync2 } from "fs";
|
|
3702
3702
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3703
3703
|
function initShardManager(encryptionKey) {
|
|
3704
3704
|
_encryptionKey = encryptionKey;
|
|
@@ -3720,7 +3720,7 @@ function getShardClient(projectName) {
|
|
|
3720
3720
|
if (!_encryptionKey) {
|
|
3721
3721
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3722
3722
|
}
|
|
3723
|
-
const safeName = projectName
|
|
3723
|
+
const safeName = safeShardName(projectName);
|
|
3724
3724
|
if (!safeName || safeName === "unknown") {
|
|
3725
3725
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3726
3726
|
}
|
|
@@ -3742,9 +3742,12 @@ function getShardClient(projectName) {
|
|
|
3742
3742
|
return client;
|
|
3743
3743
|
}
|
|
3744
3744
|
function shardExists(projectName) {
|
|
3745
|
-
const safeName = projectName
|
|
3745
|
+
const safeName = safeShardName(projectName);
|
|
3746
3746
|
return existsSync12(path14.join(SHARDS_DIR, `${safeName}.db`));
|
|
3747
3747
|
}
|
|
3748
|
+
function safeShardName(projectName) {
|
|
3749
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3750
|
+
}
|
|
3748
3751
|
function listShards() {
|
|
3749
3752
|
if (!existsSync12(SHARDS_DIR)) return [];
|
|
3750
3753
|
return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3838,7 +3841,8 @@ async function ensureShardSchema(client) {
|
|
|
3838
3841
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3839
3842
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3840
3843
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3841
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3844
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3845
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3842
3846
|
]) {
|
|
3843
3847
|
try {
|
|
3844
3848
|
await client.execute(col);
|
|
@@ -3934,9 +3938,32 @@ async function ensureShardSchema(client) {
|
|
|
3934
3938
|
}
|
|
3935
3939
|
}
|
|
3936
3940
|
async function getReadyShardClient(projectName) {
|
|
3937
|
-
const
|
|
3938
|
-
|
|
3939
|
-
|
|
3941
|
+
const safeName = safeShardName(projectName);
|
|
3942
|
+
let client = getShardClient(projectName);
|
|
3943
|
+
try {
|
|
3944
|
+
await ensureShardSchema(client);
|
|
3945
|
+
return client;
|
|
3946
|
+
} catch (err) {
|
|
3947
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3948
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3949
|
+
client.close();
|
|
3950
|
+
_shards.delete(safeName);
|
|
3951
|
+
_shardLastAccess.delete(safeName);
|
|
3952
|
+
const dbPath = path14.join(SHARDS_DIR, `${safeName}.db`);
|
|
3953
|
+
if (existsSync12(dbPath)) {
|
|
3954
|
+
const stat = statSync2(dbPath);
|
|
3955
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3956
|
+
const archivedPath = path14.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3957
|
+
renameSync4(dbPath, archivedPath);
|
|
3958
|
+
process.stderr.write(
|
|
3959
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3960
|
+
`
|
|
3961
|
+
);
|
|
3962
|
+
}
|
|
3963
|
+
client = getShardClient(projectName);
|
|
3964
|
+
await ensureShardSchema(client);
|
|
3965
|
+
return client;
|
|
3966
|
+
}
|
|
3940
3967
|
}
|
|
3941
3968
|
function evictLRU() {
|
|
3942
3969
|
let oldest = null;
|
|
@@ -4941,7 +4968,7 @@ var init_fast_db_init = __esm({
|
|
|
4941
4968
|
});
|
|
4942
4969
|
|
|
4943
4970
|
// src/lib/memory-queue.ts
|
|
4944
|
-
import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as
|
|
4971
|
+
import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync4, existsSync as existsSync13, statSync as statSync3 } from "fs";
|
|
4945
4972
|
import path15 from "path";
|
|
4946
4973
|
function enqueueMemory(entry) {
|
|
4947
4974
|
appendFileSync2(QUEUE_PATH2, JSON.stringify(entry) + "\n");
|
|
@@ -3679,7 +3679,7 @@ __export(shard_manager_exports, {
|
|
|
3679
3679
|
shardExists: () => shardExists
|
|
3680
3680
|
});
|
|
3681
3681
|
import path14 from "path";
|
|
3682
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync3 } from "fs";
|
|
3682
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync6, readdirSync as readdirSync3, renameSync as renameSync4, statSync as statSync2 } from "fs";
|
|
3683
3683
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3684
3684
|
function initShardManager(encryptionKey) {
|
|
3685
3685
|
_encryptionKey = encryptionKey;
|
|
@@ -3701,7 +3701,7 @@ function getShardClient(projectName) {
|
|
|
3701
3701
|
if (!_encryptionKey) {
|
|
3702
3702
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3703
3703
|
}
|
|
3704
|
-
const safeName = projectName
|
|
3704
|
+
const safeName = safeShardName(projectName);
|
|
3705
3705
|
if (!safeName || safeName === "unknown") {
|
|
3706
3706
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3707
3707
|
}
|
|
@@ -3723,9 +3723,12 @@ function getShardClient(projectName) {
|
|
|
3723
3723
|
return client;
|
|
3724
3724
|
}
|
|
3725
3725
|
function shardExists(projectName) {
|
|
3726
|
-
const safeName = projectName
|
|
3726
|
+
const safeName = safeShardName(projectName);
|
|
3727
3727
|
return existsSync12(path14.join(SHARDS_DIR, `${safeName}.db`));
|
|
3728
3728
|
}
|
|
3729
|
+
function safeShardName(projectName) {
|
|
3730
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3731
|
+
}
|
|
3729
3732
|
function listShards() {
|
|
3730
3733
|
if (!existsSync12(SHARDS_DIR)) return [];
|
|
3731
3734
|
return readdirSync3(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3819,7 +3822,8 @@ async function ensureShardSchema(client) {
|
|
|
3819
3822
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3820
3823
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3821
3824
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3822
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3825
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3826
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3823
3827
|
]) {
|
|
3824
3828
|
try {
|
|
3825
3829
|
await client.execute(col);
|
|
@@ -3915,9 +3919,32 @@ async function ensureShardSchema(client) {
|
|
|
3915
3919
|
}
|
|
3916
3920
|
}
|
|
3917
3921
|
async function getReadyShardClient(projectName) {
|
|
3918
|
-
const
|
|
3919
|
-
|
|
3920
|
-
|
|
3922
|
+
const safeName = safeShardName(projectName);
|
|
3923
|
+
let client = getShardClient(projectName);
|
|
3924
|
+
try {
|
|
3925
|
+
await ensureShardSchema(client);
|
|
3926
|
+
return client;
|
|
3927
|
+
} catch (err) {
|
|
3928
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3929
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3930
|
+
client.close();
|
|
3931
|
+
_shards.delete(safeName);
|
|
3932
|
+
_shardLastAccess.delete(safeName);
|
|
3933
|
+
const dbPath = path14.join(SHARDS_DIR, `${safeName}.db`);
|
|
3934
|
+
if (existsSync12(dbPath)) {
|
|
3935
|
+
const stat = statSync2(dbPath);
|
|
3936
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3937
|
+
const archivedPath = path14.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3938
|
+
renameSync4(dbPath, archivedPath);
|
|
3939
|
+
process.stderr.write(
|
|
3940
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3941
|
+
`
|
|
3942
|
+
);
|
|
3943
|
+
}
|
|
3944
|
+
client = getShardClient(projectName);
|
|
3945
|
+
await ensureShardSchema(client);
|
|
3946
|
+
return client;
|
|
3947
|
+
}
|
|
3921
3948
|
}
|
|
3922
3949
|
function evictLRU() {
|
|
3923
3950
|
let oldest = null;
|
|
@@ -3232,7 +3232,7 @@ __export(shard_manager_exports, {
|
|
|
3232
3232
|
shardExists: () => shardExists
|
|
3233
3233
|
});
|
|
3234
3234
|
import path7 from "path";
|
|
3235
|
-
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
3235
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readdirSync, renameSync as renameSync3, statSync as statSync2 } from "fs";
|
|
3236
3236
|
import { createClient as createClient2 } from "@libsql/client";
|
|
3237
3237
|
function initShardManager(encryptionKey) {
|
|
3238
3238
|
_encryptionKey = encryptionKey;
|
|
@@ -3254,7 +3254,7 @@ function getShardClient(projectName) {
|
|
|
3254
3254
|
if (!_encryptionKey) {
|
|
3255
3255
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3256
3256
|
}
|
|
3257
|
-
const safeName = projectName
|
|
3257
|
+
const safeName = safeShardName(projectName);
|
|
3258
3258
|
if (!safeName || safeName === "unknown") {
|
|
3259
3259
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3260
3260
|
}
|
|
@@ -3276,9 +3276,12 @@ function getShardClient(projectName) {
|
|
|
3276
3276
|
return client;
|
|
3277
3277
|
}
|
|
3278
3278
|
function shardExists(projectName) {
|
|
3279
|
-
const safeName = projectName
|
|
3279
|
+
const safeName = safeShardName(projectName);
|
|
3280
3280
|
return existsSync7(path7.join(SHARDS_DIR, `${safeName}.db`));
|
|
3281
3281
|
}
|
|
3282
|
+
function safeShardName(projectName) {
|
|
3283
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3284
|
+
}
|
|
3282
3285
|
function listShards() {
|
|
3283
3286
|
if (!existsSync7(SHARDS_DIR)) return [];
|
|
3284
3287
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -3372,7 +3375,8 @@ async function ensureShardSchema(client) {
|
|
|
3372
3375
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
3373
3376
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
3374
3377
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
3375
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
3378
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
3379
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
3376
3380
|
]) {
|
|
3377
3381
|
try {
|
|
3378
3382
|
await client.execute(col);
|
|
@@ -3468,9 +3472,32 @@ async function ensureShardSchema(client) {
|
|
|
3468
3472
|
}
|
|
3469
3473
|
}
|
|
3470
3474
|
async function getReadyShardClient(projectName) {
|
|
3471
|
-
const
|
|
3472
|
-
|
|
3473
|
-
|
|
3475
|
+
const safeName = safeShardName(projectName);
|
|
3476
|
+
let client = getShardClient(projectName);
|
|
3477
|
+
try {
|
|
3478
|
+
await ensureShardSchema(client);
|
|
3479
|
+
return client;
|
|
3480
|
+
} catch (err) {
|
|
3481
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
3482
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
3483
|
+
client.close();
|
|
3484
|
+
_shards.delete(safeName);
|
|
3485
|
+
_shardLastAccess.delete(safeName);
|
|
3486
|
+
const dbPath = path7.join(SHARDS_DIR, `${safeName}.db`);
|
|
3487
|
+
if (existsSync7(dbPath)) {
|
|
3488
|
+
const stat = statSync2(dbPath);
|
|
3489
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
3490
|
+
const archivedPath = path7.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
3491
|
+
renameSync3(dbPath, archivedPath);
|
|
3492
|
+
process.stderr.write(
|
|
3493
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
3494
|
+
`
|
|
3495
|
+
);
|
|
3496
|
+
}
|
|
3497
|
+
client = getShardClient(projectName);
|
|
3498
|
+
await ensureShardSchema(client);
|
|
3499
|
+
return client;
|
|
3500
|
+
}
|
|
3474
3501
|
}
|
|
3475
3502
|
function evictLRU() {
|
|
3476
3503
|
let oldest = null;
|
|
@@ -4060,7 +4087,7 @@ var init_agent_config = __esm({
|
|
|
4060
4087
|
});
|
|
4061
4088
|
|
|
4062
4089
|
// src/lib/intercom-queue.ts
|
|
4063
|
-
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, renameSync as
|
|
4090
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync4, renameSync as renameSync4, existsSync as existsSync9, mkdirSync as mkdirSync3 } from "fs";
|
|
4064
4091
|
import path10 from "path";
|
|
4065
4092
|
import os7 from "os";
|
|
4066
4093
|
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
@@ -4334,8 +4361,8 @@ async function validateLicense(apiKey, deviceId) {
|
|
|
4334
4361
|
}
|
|
4335
4362
|
function getCacheAgeMs() {
|
|
4336
4363
|
try {
|
|
4337
|
-
const { statSync:
|
|
4338
|
-
const s =
|
|
4364
|
+
const { statSync: statSync6 } = __require("fs");
|
|
4365
|
+
const s = statSync6(CACHE_PATH);
|
|
4339
4366
|
return Date.now() - s.mtimeMs;
|
|
4340
4367
|
} catch {
|
|
4341
4368
|
return Infinity;
|
|
@@ -5294,7 +5321,7 @@ __export(db_backup_exports, {
|
|
|
5294
5321
|
listBackups: () => listBackups,
|
|
5295
5322
|
rotateBackups: () => rotateBackups
|
|
5296
5323
|
});
|
|
5297
|
-
import { copyFileSync, existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync5, unlinkSync as unlinkSync7, statSync as
|
|
5324
|
+
import { copyFileSync, existsSync as existsSync17, mkdirSync as mkdirSync8, readdirSync as readdirSync5, unlinkSync as unlinkSync7, statSync as statSync4 } from "fs";
|
|
5298
5325
|
import path18 from "path";
|
|
5299
5326
|
function findActiveDb() {
|
|
5300
5327
|
for (const name of DB_NAMES) {
|
|
@@ -5338,7 +5365,7 @@ function rotateBackups(keepDays = DEFAULT_KEEP_DAYS) {
|
|
|
5338
5365
|
if (!file.endsWith(".db") && !file.endsWith(".db-wal") && !file.endsWith(".db-shm")) continue;
|
|
5339
5366
|
const filePath = path18.join(BACKUP_DIR, file);
|
|
5340
5367
|
try {
|
|
5341
|
-
const stat =
|
|
5368
|
+
const stat = statSync4(filePath);
|
|
5342
5369
|
if (stat.mtimeMs < cutoff) {
|
|
5343
5370
|
unlinkSync7(filePath);
|
|
5344
5371
|
deleted++;
|
|
@@ -5356,7 +5383,7 @@ function listBackups() {
|
|
|
5356
5383
|
const files = readdirSync5(BACKUP_DIR).filter((f) => f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm"));
|
|
5357
5384
|
return files.map((name) => {
|
|
5358
5385
|
const p = path18.join(BACKUP_DIR, name);
|
|
5359
|
-
const stat =
|
|
5386
|
+
const stat = statSync4(p);
|
|
5360
5387
|
return { path: p, name, size: stat.size, date: stat.mtime };
|
|
5361
5388
|
}).sort((a, b) => b.date.getTime() - a.date.getTime());
|
|
5362
5389
|
} catch {
|
|
@@ -5415,7 +5442,7 @@ __export(cloud_sync_exports, {
|
|
|
5415
5442
|
pushToPostgres: () => pushToPostgres,
|
|
5416
5443
|
recordRosterDeletion: () => recordRosterDeletion
|
|
5417
5444
|
});
|
|
5418
|
-
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, existsSync as existsSync18, readdirSync as readdirSync6, mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, unlinkSync as unlinkSync8, openSync as openSync2, closeSync as closeSync2, statSync as
|
|
5445
|
+
import { readFileSync as readFileSync13, writeFileSync as writeFileSync9, existsSync as existsSync18, readdirSync as readdirSync6, mkdirSync as mkdirSync9, appendFileSync as appendFileSync3, unlinkSync as unlinkSync8, openSync as openSync2, closeSync as closeSync2, statSync as statSync5 } from "fs";
|
|
5419
5446
|
import crypto4 from "crypto";
|
|
5420
5447
|
import path19 from "path";
|
|
5421
5448
|
import { homedir as homedir2 } from "os";
|
|
@@ -5907,7 +5934,7 @@ async function cloudSync(config) {
|
|
|
5907
5934
|
const { getLatestBackup: getLatestBackup2 } = await Promise.resolve().then(() => (init_db_backup(), db_backup_exports));
|
|
5908
5935
|
const latestBackup = getLatestBackup2();
|
|
5909
5936
|
if (latestBackup) {
|
|
5910
|
-
const backupSize =
|
|
5937
|
+
const backupSize = statSync5(latestBackup).size;
|
|
5911
5938
|
const MAX_CLOUD_BACKUP_BYTES = 50 * 1024 * 1024;
|
|
5912
5939
|
if (backupSize <= MAX_CLOUD_BACKUP_BYTES) {
|
|
5913
5940
|
const backupData = readFileSync13(latestBackup);
|
|
@@ -6709,7 +6736,7 @@ init_exe_daemon_client();
|
|
|
6709
6736
|
|
|
6710
6737
|
// src/lib/memory-queue.ts
|
|
6711
6738
|
init_config();
|
|
6712
|
-
import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as
|
|
6739
|
+
import { appendFileSync as appendFileSync2, readFileSync as readFileSync11, renameSync as renameSync5, unlinkSync as unlinkSync4, existsSync as existsSync14, statSync as statSync3 } from "fs";
|
|
6713
6740
|
import path15 from "path";
|
|
6714
6741
|
var QUEUE_PATH2 = path15.join(EXE_AI_DIR, "memory-queue.jsonl");
|
|
6715
6742
|
var PROCESSING_PATH = QUEUE_PATH2 + ".processing";
|
package/dist/index.js
CHANGED
|
@@ -539,7 +539,8 @@ function isMultiInstance(agentName, employees) {
|
|
|
539
539
|
return MULTI_INSTANCE_ROLES.has(emp.role.toLowerCase());
|
|
540
540
|
}
|
|
541
541
|
function addEmployee(employees, employee) {
|
|
542
|
-
const
|
|
542
|
+
const { systemPrompt: _legacyPrompt, ...rest } = employee;
|
|
543
|
+
const normalized = { ...rest, name: employee.name.toLowerCase() };
|
|
543
544
|
if (employees.some((e) => e.name.toLowerCase() === normalized.name)) {
|
|
544
545
|
throw new Error(`Employee '${normalized.name}' already exists`);
|
|
545
546
|
}
|
|
@@ -7223,7 +7224,7 @@ __export(shard_manager_exports, {
|
|
|
7223
7224
|
shardExists: () => shardExists
|
|
7224
7225
|
});
|
|
7225
7226
|
import path20 from "path";
|
|
7226
|
-
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readdirSync as readdirSync4 } from "fs";
|
|
7227
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync7, readdirSync as readdirSync4, renameSync as renameSync4, statSync as statSync2 } from "fs";
|
|
7227
7228
|
import { createClient as createClient2 } from "@libsql/client";
|
|
7228
7229
|
function initShardManager(encryptionKey) {
|
|
7229
7230
|
_encryptionKey = encryptionKey;
|
|
@@ -7245,7 +7246,7 @@ function getShardClient(projectName) {
|
|
|
7245
7246
|
if (!_encryptionKey) {
|
|
7246
7247
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
7247
7248
|
}
|
|
7248
|
-
const safeName = projectName
|
|
7249
|
+
const safeName = safeShardName(projectName);
|
|
7249
7250
|
if (!safeName || safeName === "unknown") {
|
|
7250
7251
|
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
7251
7252
|
}
|
|
@@ -7267,9 +7268,12 @@ function getShardClient(projectName) {
|
|
|
7267
7268
|
return client;
|
|
7268
7269
|
}
|
|
7269
7270
|
function shardExists(projectName) {
|
|
7270
|
-
const safeName = projectName
|
|
7271
|
+
const safeName = safeShardName(projectName);
|
|
7271
7272
|
return existsSync16(path20.join(SHARDS_DIR, `${safeName}.db`));
|
|
7272
7273
|
}
|
|
7274
|
+
function safeShardName(projectName) {
|
|
7275
|
+
return projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
7276
|
+
}
|
|
7273
7277
|
function listShards() {
|
|
7274
7278
|
if (!existsSync16(SHARDS_DIR)) return [];
|
|
7275
7279
|
return readdirSync4(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
@@ -7363,7 +7367,8 @@ async function ensureShardSchema(client) {
|
|
|
7363
7367
|
"ALTER TABLE memories ADD COLUMN token_cost REAL",
|
|
7364
7368
|
"ALTER TABLE memories ADD COLUMN audience TEXT",
|
|
7365
7369
|
"ALTER TABLE memories ADD COLUMN language_type TEXT",
|
|
7366
|
-
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
|
|
7370
|
+
"ALTER TABLE memories ADD COLUMN parent_memory_id TEXT",
|
|
7371
|
+
"ALTER TABLE memories ADD COLUMN deleted_at TEXT"
|
|
7367
7372
|
]) {
|
|
7368
7373
|
try {
|
|
7369
7374
|
await client.execute(col);
|
|
@@ -7459,9 +7464,32 @@ async function ensureShardSchema(client) {
|
|
|
7459
7464
|
}
|
|
7460
7465
|
}
|
|
7461
7466
|
async function getReadyShardClient(projectName) {
|
|
7462
|
-
const
|
|
7463
|
-
|
|
7464
|
-
|
|
7467
|
+
const safeName = safeShardName(projectName);
|
|
7468
|
+
let client = getShardClient(projectName);
|
|
7469
|
+
try {
|
|
7470
|
+
await ensureShardSchema(client);
|
|
7471
|
+
return client;
|
|
7472
|
+
} catch (err) {
|
|
7473
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
7474
|
+
if (!/SQLITE_NOTADB|file is not a database/i.test(message)) throw err;
|
|
7475
|
+
client.close();
|
|
7476
|
+
_shards.delete(safeName);
|
|
7477
|
+
_shardLastAccess.delete(safeName);
|
|
7478
|
+
const dbPath = path20.join(SHARDS_DIR, `${safeName}.db`);
|
|
7479
|
+
if (existsSync16(dbPath)) {
|
|
7480
|
+
const stat = statSync2(dbPath);
|
|
7481
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
7482
|
+
const archivedPath = path20.join(SHARDS_DIR, `${safeName}.db.broken-${stamp}`);
|
|
7483
|
+
renameSync4(dbPath, archivedPath);
|
|
7484
|
+
process.stderr.write(
|
|
7485
|
+
`[shard-manager] Archived unreadable shard ${safeName}: ${archivedPath} (${stat.size} bytes, mtime ${stat.mtime.toISOString()})
|
|
7486
|
+
`
|
|
7487
|
+
);
|
|
7488
|
+
}
|
|
7489
|
+
client = getShardClient(projectName);
|
|
7490
|
+
await ensureShardSchema(client);
|
|
7491
|
+
return client;
|
|
7492
|
+
}
|
|
7465
7493
|
}
|
|
7466
7494
|
function evictLRU() {
|
|
7467
7495
|
let oldest = null;
|
|
@@ -375,7 +375,8 @@ function isMultiInstance(agentName, employees) {
|
|
|
375
375
|
return MULTI_INSTANCE_ROLES.has(emp.role.toLowerCase());
|
|
376
376
|
}
|
|
377
377
|
function addEmployee(employees, employee) {
|
|
378
|
-
const
|
|
378
|
+
const { systemPrompt: _legacyPrompt, ...rest } = employee;
|
|
379
|
+
const normalized = { ...rest, name: employee.name.toLowerCase() };
|
|
379
380
|
if (employees.some((e) => e.name.toLowerCase() === normalized.name)) {
|
|
380
381
|
throw new Error(`Employee '${normalized.name}' already exists`);
|
|
381
382
|
}
|
|
@@ -472,7 +472,8 @@ var TEMPLATE_VERSION = 1;
|
|
|
472
472
|
var PROCEDURES_MARKER = "EXE OS \u2014 VISION AND NON-NEGOTIABLE PRINCIPLES";
|
|
473
473
|
function getSessionPrompt(storedPrompt) {
|
|
474
474
|
const markerIndex = storedPrompt.indexOf(PROCEDURES_MARKER);
|
|
475
|
-
const
|
|
475
|
+
const withoutProcedures = markerIndex >= 0 ? storedPrompt.slice(0, markerIndex).trimEnd() : storedPrompt;
|
|
476
|
+
const rolePrompt = withoutProcedures.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "").replace(/<!--[\s\S]*?-->/g, "").trimStart();
|
|
476
477
|
const globalBlock = getGlobalProceduresBlock();
|
|
477
478
|
return `${globalBlock}${rolePrompt}
|
|
478
479
|
${BASE_OPERATING_PROCEDURES}`;
|
package/dist/lib/employees.js
CHANGED
|
@@ -340,7 +340,8 @@ function isMultiInstance(agentName, employees) {
|
|
|
340
340
|
return MULTI_INSTANCE_ROLES.has(emp.role.toLowerCase());
|
|
341
341
|
}
|
|
342
342
|
function addEmployee(employees, employee) {
|
|
343
|
-
const
|
|
343
|
+
const { systemPrompt: _legacyPrompt, ...rest } = employee;
|
|
344
|
+
const normalized = { ...rest, name: employee.name.toLowerCase() };
|
|
344
345
|
if (employees.some((e) => e.name.toLowerCase() === normalized.name)) {
|
|
345
346
|
throw new Error(`Employee '${normalized.name}' already exists`);
|
|
346
347
|
}
|