@askexenow/exe-os 0.9.8 → 0.9.9
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 +222 -49
- package/dist/bin/backfill-responses.js +221 -48
- package/dist/bin/backfill-vectors.js +225 -52
- package/dist/bin/cleanup-stale-review-tasks.js +150 -28
- package/dist/bin/cli.js +1295 -856
- package/dist/bin/exe-agent-config.js +36 -8
- package/dist/bin/exe-agent.js +14 -4
- package/dist/bin/exe-assign.js +221 -48
- package/dist/bin/exe-boot.js +778 -427
- package/dist/bin/exe-call.js +41 -13
- package/dist/bin/exe-cloud.js +163 -58
- package/dist/bin/exe-dispatch.js +276 -139
- package/dist/bin/exe-doctor.js +145 -27
- package/dist/bin/exe-export-behaviors.js +141 -23
- package/dist/bin/exe-forget.js +137 -19
- package/dist/bin/exe-gateway.js +677 -388
- package/dist/bin/exe-heartbeat.js +227 -108
- package/dist/bin/exe-kill.js +138 -20
- package/dist/bin/exe-launch-agent.js +172 -39
- package/dist/bin/exe-link.js +291 -100
- package/dist/bin/exe-new-employee.js +214 -106
- package/dist/bin/exe-pending-messages.js +395 -33
- package/dist/bin/exe-pending-notifications.js +684 -99
- package/dist/bin/exe-pending-reviews.js +420 -74
- package/dist/bin/exe-rename.js +147 -49
- package/dist/bin/exe-review.js +138 -20
- package/dist/bin/exe-search.js +240 -69
- package/dist/bin/exe-session-cleanup.js +440 -250
- package/dist/bin/exe-settings.js +61 -17
- package/dist/bin/exe-start-codex.js +158 -39
- package/dist/bin/exe-start-opencode.js +157 -38
- package/dist/bin/exe-status.js +151 -29
- package/dist/bin/exe-team.js +138 -20
- package/dist/bin/git-sweep.js +404 -212
- package/dist/bin/graph-backfill.js +137 -19
- package/dist/bin/graph-export.js +140 -22
- package/dist/bin/install.js +90 -61
- package/dist/bin/scan-tasks.js +412 -220
- package/dist/bin/setup.js +564 -293
- package/dist/bin/shard-migrate.js +139 -21
- package/dist/bin/update.js +138 -49
- package/dist/bin/wiki-sync.js +137 -19
- package/dist/gateway/index.js +533 -320
- package/dist/hooks/bug-report-worker.js +344 -193
- package/dist/hooks/codex-stop-task-finalizer.js +4678 -0
- package/dist/hooks/commit-complete.js +402 -210
- package/dist/hooks/error-recall.js +245 -74
- package/dist/hooks/exe-heartbeat-hook.js +16 -6
- package/dist/hooks/ingest-worker.js +3423 -3157
- package/dist/hooks/ingest.js +832 -97
- package/dist/hooks/instructions-loaded.js +227 -54
- package/dist/hooks/notification.js +216 -43
- package/dist/hooks/post-compact.js +239 -62
- package/dist/hooks/pre-compact.js +408 -216
- package/dist/hooks/pre-tool-use.js +268 -90
- package/dist/hooks/prompt-ingest-worker.js +352 -102
- package/dist/hooks/prompt-submit.js +541 -328
- package/dist/hooks/response-ingest-worker.js +372 -122
- package/dist/hooks/session-end.js +443 -240
- package/dist/hooks/session-start.js +313 -127
- package/dist/hooks/stop.js +293 -98
- package/dist/hooks/subagent-stop.js +239 -62
- package/dist/hooks/summary-worker.js +568 -236
- package/dist/index.js +538 -324
- package/dist/lib/agent-config.js +28 -6
- package/dist/lib/cloud-sync.js +284 -105
- package/dist/lib/config.js +30 -10
- package/dist/lib/consolidation.js +16 -6
- package/dist/lib/database.js +123 -25
- package/dist/lib/db-daemon-client.js +73 -19
- package/dist/lib/db.js +123 -25
- package/dist/lib/device-registry.js +133 -35
- package/dist/lib/embedder.js +107 -32
- package/dist/lib/employee-templates.js +14 -4
- package/dist/lib/employees.js +41 -13
- package/dist/lib/exe-daemon-client.js +88 -22
- package/dist/lib/exe-daemon.js +935 -587
- package/dist/lib/hybrid-search.js +240 -69
- package/dist/lib/identity.js +18 -8
- package/dist/lib/license.js +133 -48
- package/dist/lib/messaging.js +116 -56
- package/dist/lib/reminders.js +14 -4
- package/dist/lib/schedules.js +137 -19
- package/dist/lib/skill-learning.js +33 -6
- package/dist/lib/store.js +137 -19
- package/dist/lib/task-router.js +14 -4
- package/dist/lib/tasks.js +280 -234
- package/dist/lib/tmux-routing.js +172 -125
- package/dist/lib/token-spend.js +26 -8
- package/dist/mcp/server.js +1326 -609
- package/dist/mcp/tools/complete-reminder.js +14 -4
- package/dist/mcp/tools/create-reminder.js +14 -4
- package/dist/mcp/tools/create-task.js +306 -248
- package/dist/mcp/tools/deactivate-behavior.js +16 -6
- package/dist/mcp/tools/list-reminders.js +14 -4
- package/dist/mcp/tools/list-tasks.js +123 -107
- package/dist/mcp/tools/send-message.js +75 -29
- package/dist/mcp/tools/update-task.js +1848 -199
- package/dist/runtime/index.js +441 -248
- package/dist/tui/App.js +761 -424
- package/package.json +1 -1
package/dist/lib/store.js
CHANGED
|
@@ -63,9 +63,34 @@ var init_db_retry = __esm({
|
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
// src/lib/secure-files.ts
|
|
67
|
+
import { chmodSync, existsSync, mkdirSync } from "fs";
|
|
68
|
+
import { chmod, mkdir } from "fs/promises";
|
|
69
|
+
async function ensurePrivateDir(dirPath) {
|
|
70
|
+
await mkdir(dirPath, { recursive: true, mode: PRIVATE_DIR_MODE });
|
|
71
|
+
try {
|
|
72
|
+
await chmod(dirPath, PRIVATE_DIR_MODE);
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function enforcePrivateFile(filePath) {
|
|
77
|
+
try {
|
|
78
|
+
await chmod(filePath, PRIVATE_FILE_MODE);
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
var PRIVATE_DIR_MODE, PRIVATE_FILE_MODE;
|
|
83
|
+
var init_secure_files = __esm({
|
|
84
|
+
"src/lib/secure-files.ts"() {
|
|
85
|
+
"use strict";
|
|
86
|
+
PRIVATE_DIR_MODE = 448;
|
|
87
|
+
PRIVATE_FILE_MODE = 384;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
66
91
|
// src/lib/config.ts
|
|
67
|
-
import { readFile, writeFile
|
|
68
|
-
import { readFileSync, existsSync, renameSync } from "fs";
|
|
92
|
+
import { readFile, writeFile } from "fs/promises";
|
|
93
|
+
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
69
94
|
import path from "path";
|
|
70
95
|
import os from "os";
|
|
71
96
|
function resolveDataDir() {
|
|
@@ -73,7 +98,7 @@ function resolveDataDir() {
|
|
|
73
98
|
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
74
99
|
const newDir = path.join(os.homedir(), ".exe-os");
|
|
75
100
|
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
76
|
-
if (!
|
|
101
|
+
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
77
102
|
try {
|
|
78
103
|
renameSync(legacyDir, newDir);
|
|
79
104
|
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
@@ -136,9 +161,9 @@ function normalizeAutoUpdate(raw) {
|
|
|
136
161
|
}
|
|
137
162
|
async function loadConfig() {
|
|
138
163
|
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
139
|
-
await
|
|
164
|
+
await ensurePrivateDir(dir);
|
|
140
165
|
const configPath = path.join(dir, "config.json");
|
|
141
|
-
if (!
|
|
166
|
+
if (!existsSync2(configPath)) {
|
|
142
167
|
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
143
168
|
}
|
|
144
169
|
const raw = await readFile(configPath, "utf-8");
|
|
@@ -151,6 +176,7 @@ async function loadConfig() {
|
|
|
151
176
|
`);
|
|
152
177
|
try {
|
|
153
178
|
await writeFile(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
179
|
+
await enforcePrivateFile(configPath);
|
|
154
180
|
} catch {
|
|
155
181
|
}
|
|
156
182
|
}
|
|
@@ -170,6 +196,7 @@ var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CON
|
|
|
170
196
|
var init_config = __esm({
|
|
171
197
|
"src/lib/config.ts"() {
|
|
172
198
|
"use strict";
|
|
199
|
+
init_secure_files();
|
|
173
200
|
EXE_AI_DIR = resolveDataDir();
|
|
174
201
|
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
175
202
|
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
@@ -248,7 +275,7 @@ var init_config = __esm({
|
|
|
248
275
|
|
|
249
276
|
// src/lib/employees.ts
|
|
250
277
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
251
|
-
import { existsSync as
|
|
278
|
+
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
252
279
|
import { execSync } from "child_process";
|
|
253
280
|
import path2 from "path";
|
|
254
281
|
import os2 from "os";
|
|
@@ -265,7 +292,7 @@ function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
|
265
292
|
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
266
293
|
}
|
|
267
294
|
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
268
|
-
if (!
|
|
295
|
+
if (!existsSync3(employeesPath)) return [];
|
|
269
296
|
try {
|
|
270
297
|
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
271
298
|
} catch {
|
|
@@ -1210,6 +1237,7 @@ async function ensureSchema() {
|
|
|
1210
1237
|
project TEXT NOT NULL,
|
|
1211
1238
|
summary TEXT NOT NULL,
|
|
1212
1239
|
task_file TEXT,
|
|
1240
|
+
session_scope TEXT,
|
|
1213
1241
|
read INTEGER NOT NULL DEFAULT 0,
|
|
1214
1242
|
created_at TEXT NOT NULL
|
|
1215
1243
|
);
|
|
@@ -1218,7 +1246,7 @@ async function ensureSchema() {
|
|
|
1218
1246
|
ON notifications(read);
|
|
1219
1247
|
|
|
1220
1248
|
CREATE INDEX IF NOT EXISTS idx_notifications_agent
|
|
1221
|
-
ON notifications(agent_id);
|
|
1249
|
+
ON notifications(agent_id, session_scope);
|
|
1222
1250
|
|
|
1223
1251
|
CREATE INDEX IF NOT EXISTS idx_notifications_task_file
|
|
1224
1252
|
ON notifications(task_file);
|
|
@@ -1256,6 +1284,7 @@ async function ensureSchema() {
|
|
|
1256
1284
|
target_agent TEXT NOT NULL,
|
|
1257
1285
|
target_project TEXT,
|
|
1258
1286
|
target_device TEXT NOT NULL DEFAULT 'local',
|
|
1287
|
+
session_scope TEXT,
|
|
1259
1288
|
content TEXT NOT NULL,
|
|
1260
1289
|
priority TEXT DEFAULT 'normal',
|
|
1261
1290
|
status TEXT DEFAULT 'pending',
|
|
@@ -1269,10 +1298,31 @@ async function ensureSchema() {
|
|
|
1269
1298
|
);
|
|
1270
1299
|
|
|
1271
1300
|
CREATE INDEX IF NOT EXISTS idx_messages_target
|
|
1272
|
-
ON messages(target_agent, status);
|
|
1301
|
+
ON messages(target_agent, session_scope, status);
|
|
1273
1302
|
|
|
1274
1303
|
CREATE INDEX IF NOT EXISTS idx_messages_conversation_order
|
|
1275
|
-
ON messages(target_agent, from_agent, server_seq);
|
|
1304
|
+
ON messages(target_agent, session_scope, from_agent, server_seq);
|
|
1305
|
+
`);
|
|
1306
|
+
try {
|
|
1307
|
+
await client.execute({
|
|
1308
|
+
sql: `ALTER TABLE notifications ADD COLUMN session_scope TEXT`,
|
|
1309
|
+
args: []
|
|
1310
|
+
});
|
|
1311
|
+
} catch {
|
|
1312
|
+
}
|
|
1313
|
+
try {
|
|
1314
|
+
await client.execute({
|
|
1315
|
+
sql: `ALTER TABLE messages ADD COLUMN session_scope TEXT`,
|
|
1316
|
+
args: []
|
|
1317
|
+
});
|
|
1318
|
+
} catch {
|
|
1319
|
+
}
|
|
1320
|
+
await client.executeMultiple(`
|
|
1321
|
+
CREATE INDEX IF NOT EXISTS idx_notifications_agent_scope_read
|
|
1322
|
+
ON notifications(agent_id, session_scope, read, created_at);
|
|
1323
|
+
|
|
1324
|
+
CREATE INDEX IF NOT EXISTS idx_messages_target_scope_status
|
|
1325
|
+
ON messages(target_agent, session_scope, status, created_at);
|
|
1276
1326
|
`);
|
|
1277
1327
|
try {
|
|
1278
1328
|
await client.execute({
|
|
@@ -1856,6 +1906,13 @@ async function ensureSchema() {
|
|
|
1856
1906
|
} catch {
|
|
1857
1907
|
}
|
|
1858
1908
|
}
|
|
1909
|
+
try {
|
|
1910
|
+
await client.execute({
|
|
1911
|
+
sql: `UPDATE tasks SET status = 'closed' WHERE status = 'done' AND result IS NOT NULL`,
|
|
1912
|
+
args: []
|
|
1913
|
+
});
|
|
1914
|
+
} catch {
|
|
1915
|
+
}
|
|
1859
1916
|
}
|
|
1860
1917
|
async function disposeDatabase() {
|
|
1861
1918
|
if (_walCheckpointTimer) {
|
|
@@ -1898,6 +1955,7 @@ var shard_manager_exports = {};
|
|
|
1898
1955
|
__export(shard_manager_exports, {
|
|
1899
1956
|
disposeShards: () => disposeShards,
|
|
1900
1957
|
ensureShardSchema: () => ensureShardSchema,
|
|
1958
|
+
getOpenShardCount: () => getOpenShardCount,
|
|
1901
1959
|
getReadyShardClient: () => getReadyShardClient,
|
|
1902
1960
|
getShardClient: () => getShardClient,
|
|
1903
1961
|
getShardsDir: () => getShardsDir,
|
|
@@ -1907,14 +1965,17 @@ __export(shard_manager_exports, {
|
|
|
1907
1965
|
shardExists: () => shardExists
|
|
1908
1966
|
});
|
|
1909
1967
|
import path5 from "path";
|
|
1910
|
-
import { existsSync as
|
|
1968
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync2, readdirSync } from "fs";
|
|
1911
1969
|
import { createClient as createClient2 } from "@libsql/client";
|
|
1912
1970
|
function initShardManager(encryptionKey) {
|
|
1913
1971
|
_encryptionKey = encryptionKey;
|
|
1914
|
-
if (!
|
|
1915
|
-
|
|
1972
|
+
if (!existsSync5(SHARDS_DIR)) {
|
|
1973
|
+
mkdirSync2(SHARDS_DIR, { recursive: true });
|
|
1916
1974
|
}
|
|
1917
1975
|
_shardingEnabled = true;
|
|
1976
|
+
if (_evictionTimer) clearInterval(_evictionTimer);
|
|
1977
|
+
_evictionTimer = setInterval(evictIdleShards, EVICTION_INTERVAL_MS);
|
|
1978
|
+
_evictionTimer.unref();
|
|
1918
1979
|
}
|
|
1919
1980
|
function isShardingEnabled() {
|
|
1920
1981
|
return _shardingEnabled;
|
|
@@ -1931,21 +1992,28 @@ function getShardClient(projectName) {
|
|
|
1931
1992
|
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
1932
1993
|
}
|
|
1933
1994
|
const cached = _shards.get(safeName);
|
|
1934
|
-
if (cached)
|
|
1995
|
+
if (cached) {
|
|
1996
|
+
_shardLastAccess.set(safeName, Date.now());
|
|
1997
|
+
return cached;
|
|
1998
|
+
}
|
|
1999
|
+
while (_shards.size >= MAX_OPEN_SHARDS) {
|
|
2000
|
+
evictLRU();
|
|
2001
|
+
}
|
|
1935
2002
|
const dbPath = path5.join(SHARDS_DIR, `${safeName}.db`);
|
|
1936
2003
|
const client = createClient2({
|
|
1937
2004
|
url: `file:${dbPath}`,
|
|
1938
2005
|
encryptionKey: _encryptionKey
|
|
1939
2006
|
});
|
|
1940
2007
|
_shards.set(safeName, client);
|
|
2008
|
+
_shardLastAccess.set(safeName, Date.now());
|
|
1941
2009
|
return client;
|
|
1942
2010
|
}
|
|
1943
2011
|
function shardExists(projectName) {
|
|
1944
2012
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1945
|
-
return
|
|
2013
|
+
return existsSync5(path5.join(SHARDS_DIR, `${safeName}.db`));
|
|
1946
2014
|
}
|
|
1947
2015
|
function listShards() {
|
|
1948
|
-
if (!
|
|
2016
|
+
if (!existsSync5(SHARDS_DIR)) return [];
|
|
1949
2017
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
1950
2018
|
}
|
|
1951
2019
|
async function ensureShardSchema(client) {
|
|
@@ -1997,6 +2065,8 @@ async function ensureShardSchema(client) {
|
|
|
1997
2065
|
for (const col of [
|
|
1998
2066
|
"ALTER TABLE memories ADD COLUMN task_id TEXT",
|
|
1999
2067
|
"ALTER TABLE memories ADD COLUMN consolidated INTEGER NOT NULL DEFAULT 0",
|
|
2068
|
+
"ALTER TABLE memories ADD COLUMN author_device_id TEXT",
|
|
2069
|
+
"ALTER TABLE memories ADD COLUMN scope TEXT NOT NULL DEFAULT 'business'",
|
|
2000
2070
|
"ALTER TABLE memories ADD COLUMN importance INTEGER DEFAULT 5",
|
|
2001
2071
|
"ALTER TABLE memories ADD COLUMN status TEXT DEFAULT 'active'",
|
|
2002
2072
|
"ALTER TABLE memories ADD COLUMN wiki_synced INTEGER DEFAULT 0",
|
|
@@ -2134,21 +2204,69 @@ async function getReadyShardClient(projectName) {
|
|
|
2134
2204
|
await ensureShardSchema(client);
|
|
2135
2205
|
return client;
|
|
2136
2206
|
}
|
|
2207
|
+
function evictLRU() {
|
|
2208
|
+
let oldest = null;
|
|
2209
|
+
let oldestTime = Infinity;
|
|
2210
|
+
for (const [name, time] of _shardLastAccess) {
|
|
2211
|
+
if (time < oldestTime) {
|
|
2212
|
+
oldestTime = time;
|
|
2213
|
+
oldest = name;
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
if (oldest) {
|
|
2217
|
+
const client = _shards.get(oldest);
|
|
2218
|
+
if (client) {
|
|
2219
|
+
client.close();
|
|
2220
|
+
}
|
|
2221
|
+
_shards.delete(oldest);
|
|
2222
|
+
_shardLastAccess.delete(oldest);
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
function evictIdleShards() {
|
|
2226
|
+
const now = Date.now();
|
|
2227
|
+
const toEvict = [];
|
|
2228
|
+
for (const [name, lastAccess] of _shardLastAccess) {
|
|
2229
|
+
if (now - lastAccess > SHARD_IDLE_MS) {
|
|
2230
|
+
toEvict.push(name);
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
for (const name of toEvict) {
|
|
2234
|
+
const client = _shards.get(name);
|
|
2235
|
+
if (client) {
|
|
2236
|
+
client.close();
|
|
2237
|
+
}
|
|
2238
|
+
_shards.delete(name);
|
|
2239
|
+
_shardLastAccess.delete(name);
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
function getOpenShardCount() {
|
|
2243
|
+
return _shards.size;
|
|
2244
|
+
}
|
|
2137
2245
|
function disposeShards() {
|
|
2246
|
+
if (_evictionTimer) {
|
|
2247
|
+
clearInterval(_evictionTimer);
|
|
2248
|
+
_evictionTimer = null;
|
|
2249
|
+
}
|
|
2138
2250
|
for (const [, client] of _shards) {
|
|
2139
2251
|
client.close();
|
|
2140
2252
|
}
|
|
2141
2253
|
_shards.clear();
|
|
2254
|
+
_shardLastAccess.clear();
|
|
2142
2255
|
_shardingEnabled = false;
|
|
2143
2256
|
_encryptionKey = null;
|
|
2144
2257
|
}
|
|
2145
|
-
var SHARDS_DIR, _shards, _encryptionKey, _shardingEnabled;
|
|
2258
|
+
var SHARDS_DIR, SHARD_IDLE_MS, MAX_OPEN_SHARDS, EVICTION_INTERVAL_MS, _shards, _shardLastAccess, _evictionTimer, _encryptionKey, _shardingEnabled;
|
|
2146
2259
|
var init_shard_manager = __esm({
|
|
2147
2260
|
"src/lib/shard-manager.ts"() {
|
|
2148
2261
|
"use strict";
|
|
2149
2262
|
init_config();
|
|
2150
2263
|
SHARDS_DIR = path5.join(EXE_AI_DIR, "shards");
|
|
2264
|
+
SHARD_IDLE_MS = 5 * 60 * 1e3;
|
|
2265
|
+
MAX_OPEN_SHARDS = 10;
|
|
2266
|
+
EVICTION_INTERVAL_MS = 60 * 1e3;
|
|
2151
2267
|
_shards = /* @__PURE__ */ new Map();
|
|
2268
|
+
_shardLastAccess = /* @__PURE__ */ new Map();
|
|
2269
|
+
_evictionTimer = null;
|
|
2152
2270
|
_encryptionKey = null;
|
|
2153
2271
|
_shardingEnabled = false;
|
|
2154
2272
|
}
|
|
@@ -2352,7 +2470,7 @@ init_database();
|
|
|
2352
2470
|
|
|
2353
2471
|
// src/lib/keychain.ts
|
|
2354
2472
|
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
2355
|
-
import { existsSync as
|
|
2473
|
+
import { existsSync as existsSync4 } from "fs";
|
|
2356
2474
|
import path4 from "path";
|
|
2357
2475
|
import os4 from "os";
|
|
2358
2476
|
var SERVICE = "exe-mem";
|
|
@@ -2382,7 +2500,7 @@ async function getMasterKey() {
|
|
|
2382
2500
|
}
|
|
2383
2501
|
}
|
|
2384
2502
|
const keyPath = getKeyPath();
|
|
2385
|
-
if (!
|
|
2503
|
+
if (!existsSync4(keyPath)) {
|
|
2386
2504
|
process.stderr.write(
|
|
2387
2505
|
`[keychain] Key not found at ${keyPath} (HOME=${os4.homedir()}, EXE_OS_DIR=${process.env.EXE_OS_DIR ?? "unset"})
|
|
2388
2506
|
`
|
package/dist/lib/task-router.js
CHANGED
|
@@ -3,9 +3,18 @@ var __esm = (fn, res) => function __init() {
|
|
|
3
3
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
+
// src/lib/secure-files.ts
|
|
7
|
+
import { chmodSync, existsSync, mkdirSync } from "fs";
|
|
8
|
+
import { chmod, mkdir } from "fs/promises";
|
|
9
|
+
var init_secure_files = __esm({
|
|
10
|
+
"src/lib/secure-files.ts"() {
|
|
11
|
+
"use strict";
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
6
15
|
// src/lib/config.ts
|
|
7
|
-
import { readFile, writeFile
|
|
8
|
-
import { readFileSync, existsSync, renameSync } from "fs";
|
|
16
|
+
import { readFile, writeFile } from "fs/promises";
|
|
17
|
+
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
9
18
|
import path from "path";
|
|
10
19
|
import os from "os";
|
|
11
20
|
function resolveDataDir() {
|
|
@@ -13,7 +22,7 @@ function resolveDataDir() {
|
|
|
13
22
|
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
14
23
|
const newDir = path.join(os.homedir(), ".exe-os");
|
|
15
24
|
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
16
|
-
if (!
|
|
25
|
+
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
17
26
|
try {
|
|
18
27
|
renameSync(legacyDir, newDir);
|
|
19
28
|
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
@@ -28,6 +37,7 @@ var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CON
|
|
|
28
37
|
var init_config = __esm({
|
|
29
38
|
"src/lib/config.ts"() {
|
|
30
39
|
"use strict";
|
|
40
|
+
init_secure_files();
|
|
31
41
|
EXE_AI_DIR = resolveDataDir();
|
|
32
42
|
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
33
43
|
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
@@ -100,7 +110,7 @@ import { randomUUID } from "crypto";
|
|
|
100
110
|
// src/lib/employees.ts
|
|
101
111
|
init_config();
|
|
102
112
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
103
|
-
import { existsSync as
|
|
113
|
+
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
104
114
|
import { execSync } from "child_process";
|
|
105
115
|
import path2 from "path";
|
|
106
116
|
import os2 from "os";
|