@askexenow/exe-os 0.8.80 → 0.8.82

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.
Files changed (110) hide show
  1. package/dist/bin/backfill-conversations.js +359 -267
  2. package/dist/bin/backfill-responses.js +357 -265
  3. package/dist/bin/backfill-vectors.js +339 -264
  4. package/dist/bin/cleanup-stale-review-tasks.js +315 -256
  5. package/dist/bin/cli.js +494 -240
  6. package/dist/bin/exe-agent.js +141 -46
  7. package/dist/bin/exe-assign.js +151 -63
  8. package/dist/bin/exe-boot.js +294 -115
  9. package/dist/bin/exe-call.js +76 -51
  10. package/dist/bin/exe-cloud.js +58 -45
  11. package/dist/bin/exe-dispatch.js +434 -277
  12. package/dist/bin/exe-doctor.js +317 -246
  13. package/dist/bin/exe-export-behaviors.js +328 -248
  14. package/dist/bin/exe-forget.js +314 -231
  15. package/dist/bin/exe-gateway.js +2676 -1402
  16. package/dist/bin/exe-heartbeat.js +329 -264
  17. package/dist/bin/exe-kill.js +324 -244
  18. package/dist/bin/exe-launch-agent.js +574 -463
  19. package/dist/bin/exe-link.js +1055 -95
  20. package/dist/bin/exe-new-employee.js +49 -54
  21. package/dist/bin/exe-pending-messages.js +310 -253
  22. package/dist/bin/exe-pending-notifications.js +299 -228
  23. package/dist/bin/exe-pending-reviews.js +314 -245
  24. package/dist/bin/exe-rename.js +259 -195
  25. package/dist/bin/exe-review.js +140 -64
  26. package/dist/bin/exe-search.js +543 -356
  27. package/dist/bin/exe-session-cleanup.js +463 -382
  28. package/dist/bin/exe-settings.js +129 -99
  29. package/dist/bin/exe-start.sh +6 -6
  30. package/dist/bin/exe-status.js +95 -36
  31. package/dist/bin/exe-team.js +116 -51
  32. package/dist/bin/git-sweep.js +482 -307
  33. package/dist/bin/graph-backfill.js +357 -245
  34. package/dist/bin/graph-export.js +324 -244
  35. package/dist/bin/install.js +33 -10
  36. package/dist/bin/scan-tasks.js +481 -307
  37. package/dist/bin/setup.js +1147 -140
  38. package/dist/bin/shard-migrate.js +321 -241
  39. package/dist/bin/update.js +1 -7
  40. package/dist/bin/wiki-sync.js +318 -238
  41. package/dist/gateway/index.js +2656 -1383
  42. package/dist/hooks/bug-report-worker.js +641 -472
  43. package/dist/hooks/commit-complete.js +482 -307
  44. package/dist/hooks/error-recall.js +363 -135
  45. package/dist/hooks/exe-heartbeat-hook.js +97 -27
  46. package/dist/hooks/ingest-worker.js +584 -397
  47. package/dist/hooks/ingest.js +123 -58
  48. package/dist/hooks/instructions-loaded.js +212 -82
  49. package/dist/hooks/notification.js +200 -70
  50. package/dist/hooks/post-compact.js +199 -81
  51. package/dist/hooks/pre-compact.js +352 -140
  52. package/dist/hooks/pre-tool-use.js +416 -278
  53. package/dist/hooks/prompt-ingest-worker.js +376 -299
  54. package/dist/hooks/prompt-submit.js +414 -188
  55. package/dist/hooks/response-ingest-worker.js +408 -338
  56. package/dist/hooks/session-end.js +209 -83
  57. package/dist/hooks/session-start.js +382 -158
  58. package/dist/hooks/stop.js +209 -83
  59. package/dist/hooks/subagent-stop.js +209 -85
  60. package/dist/hooks/summary-worker.js +606 -510
  61. package/dist/index.js +2133 -855
  62. package/dist/lib/cloud-sync.js +1175 -184
  63. package/dist/lib/config.js +1 -9
  64. package/dist/lib/consolidation.js +71 -34
  65. package/dist/lib/database.js +166 -14
  66. package/dist/lib/device-registry.js +189 -117
  67. package/dist/lib/embedder.js +6 -10
  68. package/dist/lib/employee-templates.js +134 -39
  69. package/dist/lib/employees.js +30 -7
  70. package/dist/lib/exe-daemon-client.js +5 -7
  71. package/dist/lib/exe-daemon.js +514 -152
  72. package/dist/lib/hybrid-search.js +543 -356
  73. package/dist/lib/identity-templates.js +15 -15
  74. package/dist/lib/identity.js +19 -15
  75. package/dist/lib/license.js +1 -7
  76. package/dist/lib/messaging.js +157 -135
  77. package/dist/lib/reminders.js +97 -0
  78. package/dist/lib/schedules.js +302 -231
  79. package/dist/lib/skill-learning.js +33 -27
  80. package/dist/lib/status-brief.js +11 -14
  81. package/dist/lib/store.js +326 -237
  82. package/dist/lib/task-router.js +105 -1
  83. package/dist/lib/tasks.js +233 -116
  84. package/dist/lib/tmux-routing.js +173 -56
  85. package/dist/lib/ws-client.js +13 -3
  86. package/dist/mcp/server.js +2009 -1015
  87. package/dist/mcp/tools/complete-reminder.js +97 -0
  88. package/dist/mcp/tools/create-reminder.js +97 -0
  89. package/dist/mcp/tools/create-task.js +426 -262
  90. package/dist/mcp/tools/deactivate-behavior.js +119 -44
  91. package/dist/mcp/tools/list-reminders.js +97 -0
  92. package/dist/mcp/tools/list-tasks.js +56 -57
  93. package/dist/mcp/tools/send-message.js +206 -143
  94. package/dist/mcp/tools/update-task.js +259 -85
  95. package/dist/runtime/index.js +495 -316
  96. package/dist/tui/App.js +1128 -919
  97. package/package.json +2 -10
  98. package/src/commands/exe/afk.md +8 -8
  99. package/src/commands/exe/assign.md +1 -1
  100. package/src/commands/exe/build-adv.md +1 -1
  101. package/src/commands/exe/call.md +10 -10
  102. package/src/commands/exe/employee-heartbeat.md +9 -6
  103. package/src/commands/exe/heartbeat.md +5 -5
  104. package/src/commands/exe/intercom.md +26 -15
  105. package/src/commands/exe/launch.md +2 -2
  106. package/src/commands/exe/new-employee.md +1 -1
  107. package/src/commands/exe/review.md +2 -2
  108. package/src/commands/exe/schedule.md +1 -1
  109. package/src/commands/exe/sessions.md +2 -2
  110. package/src/commands/exe.md +22 -20
@@ -54,7 +54,7 @@ function wrapWithRetry(client) {
54
54
  return (sql) => retryOnBusy(() => target.execute(sql), "execute");
55
55
  }
56
56
  if (prop === "batch") {
57
- return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
57
+ return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
58
58
  }
59
59
  return Reflect.get(target, prop, receiver);
60
60
  }
@@ -70,6 +70,226 @@ var init_db_retry = __esm({
70
70
  }
71
71
  });
72
72
 
73
+ // src/lib/config.ts
74
+ import { readFile, writeFile, mkdir, chmod } from "fs/promises";
75
+ import { readFileSync, existsSync, renameSync } from "fs";
76
+ import path from "path";
77
+ import os from "os";
78
+ function resolveDataDir() {
79
+ if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
80
+ if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
81
+ const newDir = path.join(os.homedir(), ".exe-os");
82
+ const legacyDir = path.join(os.homedir(), ".exe-mem");
83
+ if (!existsSync(newDir) && existsSync(legacyDir)) {
84
+ try {
85
+ renameSync(legacyDir, newDir);
86
+ process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
87
+ `);
88
+ } catch {
89
+ return legacyDir;
90
+ }
91
+ }
92
+ return newDir;
93
+ }
94
+ function migrateLegacyConfig(raw) {
95
+ if ("r2" in raw) {
96
+ process.stderr.write(
97
+ "[exe-os] Warning: config.json contains deprecated 'r2' field from v1.0. R2 sync has been replaced in v1.1. The 'r2' field will be ignored.\n"
98
+ );
99
+ delete raw.r2;
100
+ }
101
+ if ("syncIntervalMs" in raw) {
102
+ delete raw.syncIntervalMs;
103
+ }
104
+ return raw;
105
+ }
106
+ function migrateConfig(raw) {
107
+ const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
108
+ let currentVersion = fromVersion;
109
+ let migrated = false;
110
+ if (currentVersion > CURRENT_CONFIG_VERSION) {
111
+ return { config: raw, migrated: false, fromVersion };
112
+ }
113
+ for (const migration of CONFIG_MIGRATIONS) {
114
+ if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
115
+ raw = migration.migrate(raw);
116
+ currentVersion = migration.to;
117
+ migrated = true;
118
+ }
119
+ }
120
+ return { config: raw, migrated, fromVersion };
121
+ }
122
+ function normalizeScalingRoadmap(raw) {
123
+ const defaultAuto = DEFAULT_CONFIG.scalingRoadmap.rerankerAutoTrigger;
124
+ const userRoadmap = raw.scalingRoadmap ?? {};
125
+ const userAuto = userRoadmap.rerankerAutoTrigger ?? {};
126
+ if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
127
+ userAuto.enabled = raw.rerankerEnabled;
128
+ }
129
+ raw.scalingRoadmap = {
130
+ ...userRoadmap,
131
+ rerankerAutoTrigger: { ...defaultAuto, ...userAuto }
132
+ };
133
+ }
134
+ function normalizeSessionLifecycle(raw) {
135
+ const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
136
+ const userSL = raw.sessionLifecycle ?? {};
137
+ raw.sessionLifecycle = { ...defaultSL, ...userSL };
138
+ }
139
+ function normalizeAutoUpdate(raw) {
140
+ const defaultAU = DEFAULT_CONFIG.autoUpdate;
141
+ const userAU = raw.autoUpdate ?? {};
142
+ raw.autoUpdate = { ...defaultAU, ...userAU };
143
+ }
144
+ async function loadConfig() {
145
+ const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
146
+ await mkdir(dir, { recursive: true });
147
+ const configPath = path.join(dir, "config.json");
148
+ if (!existsSync(configPath)) {
149
+ return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
150
+ }
151
+ const raw = await readFile(configPath, "utf-8");
152
+ try {
153
+ let parsed = JSON.parse(raw);
154
+ parsed = migrateLegacyConfig(parsed);
155
+ const { config: migratedCfg, migrated, fromVersion } = migrateConfig(parsed);
156
+ if (migrated) {
157
+ process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
158
+ `);
159
+ try {
160
+ await writeFile(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
161
+ } catch {
162
+ }
163
+ }
164
+ normalizeScalingRoadmap(migratedCfg);
165
+ normalizeSessionLifecycle(migratedCfg);
166
+ normalizeAutoUpdate(migratedCfg);
167
+ const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
168
+ if (config.dbPath.startsWith("~")) {
169
+ config.dbPath = config.dbPath.replace(/^~/, os.homedir());
170
+ }
171
+ return config;
172
+ } catch {
173
+ return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
174
+ }
175
+ }
176
+ var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
177
+ var init_config = __esm({
178
+ "src/lib/config.ts"() {
179
+ "use strict";
180
+ EXE_AI_DIR = resolveDataDir();
181
+ DB_PATH = path.join(EXE_AI_DIR, "memories.db");
182
+ MODELS_DIR = path.join(EXE_AI_DIR, "models");
183
+ CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
184
+ LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
185
+ CURRENT_CONFIG_VERSION = 1;
186
+ DEFAULT_CONFIG = {
187
+ config_version: CURRENT_CONFIG_VERSION,
188
+ dbPath: DB_PATH,
189
+ modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
190
+ embeddingDim: 1024,
191
+ batchSize: 20,
192
+ flushIntervalMs: 1e4,
193
+ autoIngestion: true,
194
+ autoRetrieval: true,
195
+ searchMode: "hybrid",
196
+ hookSearchMode: "hybrid",
197
+ fileGrepEnabled: true,
198
+ splashEffect: true,
199
+ consolidationEnabled: true,
200
+ consolidationIntervalMs: 6 * 60 * 60 * 1e3,
201
+ consolidationModel: "claude-haiku-4-5-20251001",
202
+ consolidationMaxCallsPerRun: 20,
203
+ selfQueryRouter: true,
204
+ selfQueryModel: "claude-haiku-4-5-20251001",
205
+ rerankerEnabled: true,
206
+ scalingRoadmap: {
207
+ rerankerAutoTrigger: {
208
+ enabled: true,
209
+ broadQueryMinCardinality: 5e4,
210
+ fetchTopK: 150,
211
+ returnTopK: 5
212
+ }
213
+ },
214
+ graphRagEnabled: true,
215
+ wikiEnabled: false,
216
+ wikiUrl: "",
217
+ wikiApiKey: "",
218
+ wikiSyncIntervalMs: 30 * 60 * 1e3,
219
+ wikiWorkspaceMapping: {},
220
+ wikiAutoUpdate: true,
221
+ wikiAutoUpdateThreshold: 0.5,
222
+ wikiAutoUpdateCreateNew: true,
223
+ skillLearning: true,
224
+ skillThreshold: 3,
225
+ skillModel: "claude-haiku-4-5-20251001",
226
+ exeHeartbeat: {
227
+ enabled: true,
228
+ intervalSeconds: 60,
229
+ staleInProgressThresholdHours: 2
230
+ },
231
+ sessionLifecycle: {
232
+ idleKillEnabled: true,
233
+ idleKillTicksRequired: 3,
234
+ idleKillIntercomAckWindowMs: 1e4,
235
+ maxAutoInstances: 10
236
+ },
237
+ autoUpdate: {
238
+ checkOnBoot: true,
239
+ autoInstall: false,
240
+ checkIntervalMs: 24 * 60 * 60 * 1e3
241
+ }
242
+ };
243
+ CONFIG_MIGRATIONS = [
244
+ {
245
+ from: 0,
246
+ to: 1,
247
+ migrate: (cfg) => {
248
+ cfg.config_version = 1;
249
+ return cfg;
250
+ }
251
+ }
252
+ ];
253
+ }
254
+ });
255
+
256
+ // src/lib/employees.ts
257
+ import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
258
+ import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
259
+ import { execSync } from "child_process";
260
+ import path2 from "path";
261
+ import os2 from "os";
262
+ function normalizeRole(role) {
263
+ return (role ?? "").trim().toLowerCase();
264
+ }
265
+ function isCoordinatorRole(role) {
266
+ return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
267
+ }
268
+ function getCoordinatorEmployee(employees) {
269
+ return employees.find((e) => isCoordinatorRole(e.role));
270
+ }
271
+ function getCoordinatorName(employees = loadEmployeesSync()) {
272
+ return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
273
+ }
274
+ function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
275
+ if (!existsSync2(employeesPath)) return [];
276
+ try {
277
+ return JSON.parse(readFileSync2(employeesPath, "utf-8"));
278
+ } catch {
279
+ return [];
280
+ }
281
+ }
282
+ var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
283
+ var init_employees = __esm({
284
+ "src/lib/employees.ts"() {
285
+ "use strict";
286
+ init_config();
287
+ EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
288
+ DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
289
+ COORDINATOR_ROLE = "COO";
290
+ }
291
+ });
292
+
73
293
  // src/lib/database.ts
74
294
  import { createClient } from "@libsql/client";
75
295
  async function initDatabase(config) {
@@ -203,22 +423,24 @@ async function ensureSchema() {
203
423
  ON behaviors(agent_id, active);
204
424
  `);
205
425
  try {
426
+ const coordinatorName = getCoordinatorName();
206
427
  const existing = await client.execute({
207
- sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = 'exe'",
208
- args: []
428
+ sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
429
+ args: [coordinatorName]
209
430
  });
210
431
  if (Number(existing.rows[0]?.cnt) === 0) {
211
- await client.executeMultiple(`
212
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
213
- VALUES
214
- (hex(randomblob(16)), 'exe', NULL, 'workflow', 'Don''t ask "keep going?" \u2014 just keep executing phases/plans autonomously', 1, '2026-03-25T00:00:00Z', '2026-03-25T00:00:00Z');
215
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
216
- VALUES
217
- (hex(randomblob(16)), 'exe', NULL, 'tool-use', 'Always use create_task MCP tool, never write .md files directly for task creation', 1, '2026-03-25T00:00:00Z', '2026-03-25T00:00:00Z');
218
- INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
219
- VALUES
220
- (hex(randomblob(16)), 'exe', NULL, 'workflow', 'Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission', 1, '2026-03-25T00:00:00Z', '2026-03-25T00:00:00Z');
221
- `);
432
+ const seededAt = "2026-03-25T00:00:00Z";
433
+ for (const [domain, content] of [
434
+ ["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
435
+ ["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
436
+ ["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
437
+ ]) {
438
+ await client.execute({
439
+ sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
440
+ VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
441
+ args: [coordinatorName, domain, content, seededAt, seededAt]
442
+ });
443
+ }
222
444
  }
223
445
  } catch {
224
446
  }
@@ -910,204 +1132,49 @@ async function ensureSchema() {
910
1132
  } catch {
911
1133
  }
912
1134
  }
913
- }
914
- var _client, _resilientClient, initTurso;
915
- var init_database = __esm({
916
- "src/lib/database.ts"() {
917
- "use strict";
918
- init_db_retry();
919
- _client = null;
920
- _resilientClient = null;
921
- initTurso = initDatabase;
922
- }
923
- });
924
-
925
- // src/lib/config.ts
926
- import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, chmod as chmod2 } from "fs/promises";
927
- import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
928
- import path2 from "path";
929
- import os2 from "os";
930
- function resolveDataDir() {
931
- if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
932
- if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
933
- const newDir = path2.join(os2.homedir(), ".exe-os");
934
- const legacyDir = path2.join(os2.homedir(), ".exe-mem");
935
- if (!existsSync2(newDir) && existsSync2(legacyDir)) {
936
- try {
937
- renameSync(legacyDir, newDir);
938
- process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
939
- `);
940
- } catch {
941
- return legacyDir;
942
- }
1135
+ try {
1136
+ await client.execute({
1137
+ sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
1138
+ args: []
1139
+ });
1140
+ } catch {
943
1141
  }
944
- return newDir;
945
- }
946
- function migrateLegacyConfig(raw) {
947
- if ("r2" in raw) {
948
- process.stderr.write(
949
- "[exe-os] Warning: config.json contains deprecated 'r2' field from v1.0. R2 sync has been replaced in v1.1. The 'r2' field will be ignored.\n"
1142
+ try {
1143
+ await client.execute(
1144
+ `CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
950
1145
  );
951
- delete raw.r2;
952
- }
953
- if ("syncIntervalMs" in raw) {
954
- delete raw.syncIntervalMs;
955
- }
956
- return raw;
957
- }
958
- function migrateConfig(raw) {
959
- const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
960
- let currentVersion = fromVersion;
961
- let migrated = false;
962
- if (currentVersion > CURRENT_CONFIG_VERSION) {
963
- return { config: raw, migrated: false, fromVersion };
964
- }
965
- for (const migration of CONFIG_MIGRATIONS) {
966
- if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
967
- raw = migration.migrate(raw);
968
- currentVersion = migration.to;
969
- migrated = true;
970
- }
1146
+ } catch {
971
1147
  }
972
- return { config: raw, migrated, fromVersion };
973
- }
974
- function normalizeScalingRoadmap(raw) {
975
- const defaultAuto = DEFAULT_CONFIG.scalingRoadmap.rerankerAutoTrigger;
976
- const userRoadmap = raw.scalingRoadmap ?? {};
977
- const userAuto = userRoadmap.rerankerAutoTrigger ?? {};
978
- if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
979
- userAuto.enabled = raw.rerankerEnabled;
1148
+ try {
1149
+ await client.execute({
1150
+ sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
1151
+ args: []
1152
+ });
1153
+ } catch {
980
1154
  }
981
- raw.scalingRoadmap = {
982
- ...userRoadmap,
983
- rerankerAutoTrigger: { ...defaultAuto, ...userAuto }
984
- };
985
- }
986
- function normalizeSessionLifecycle(raw) {
987
- const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
988
- const userSL = raw.sessionLifecycle ?? {};
989
- raw.sessionLifecycle = { ...defaultSL, ...userSL };
990
- }
991
- function normalizeAutoUpdate(raw) {
992
- const defaultAU = DEFAULT_CONFIG.autoUpdate;
993
- const userAU = raw.autoUpdate ?? {};
994
- raw.autoUpdate = { ...defaultAU, ...userAU };
995
- }
996
- async function loadConfig() {
997
- const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
998
- await mkdir2(dir, { recursive: true });
999
- const configPath = path2.join(dir, "config.json");
1000
- if (!existsSync2(configPath)) {
1001
- return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
1155
+ try {
1156
+ await client.execute(
1157
+ `CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
1158
+ );
1159
+ } catch {
1002
1160
  }
1003
- const raw = await readFile2(configPath, "utf-8");
1004
1161
  try {
1005
- let parsed = JSON.parse(raw);
1006
- parsed = migrateLegacyConfig(parsed);
1007
- const { config: migratedCfg, migrated, fromVersion } = migrateConfig(parsed);
1008
- if (migrated) {
1009
- process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
1010
- `);
1011
- try {
1012
- await writeFile2(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
1013
- } catch {
1014
- }
1015
- }
1016
- normalizeScalingRoadmap(migratedCfg);
1017
- normalizeSessionLifecycle(migratedCfg);
1018
- normalizeAutoUpdate(migratedCfg);
1019
- const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
1020
- if (config.dbPath.startsWith("~")) {
1021
- config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
1022
- }
1023
- return config;
1162
+ await client.execute({
1163
+ sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
1164
+ args: []
1165
+ });
1024
1166
  } catch {
1025
- return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
1026
1167
  }
1027
1168
  }
1028
- var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
1029
- var init_config = __esm({
1030
- "src/lib/config.ts"() {
1169
+ var _client, _resilientClient, initTurso;
1170
+ var init_database = __esm({
1171
+ "src/lib/database.ts"() {
1031
1172
  "use strict";
1032
- EXE_AI_DIR = resolveDataDir();
1033
- DB_PATH = path2.join(EXE_AI_DIR, "memories.db");
1034
- MODELS_DIR = path2.join(EXE_AI_DIR, "models");
1035
- CONFIG_PATH = path2.join(EXE_AI_DIR, "config.json");
1036
- LEGACY_LANCE_PATH = path2.join(EXE_AI_DIR, "local.lance");
1037
- CURRENT_CONFIG_VERSION = 1;
1038
- DEFAULT_CONFIG = {
1039
- config_version: CURRENT_CONFIG_VERSION,
1040
- dbPath: DB_PATH,
1041
- modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
1042
- embeddingDim: 1024,
1043
- batchSize: 20,
1044
- flushIntervalMs: 1e4,
1045
- autoIngestion: true,
1046
- autoRetrieval: true,
1047
- searchMode: "hybrid",
1048
- hookSearchMode: "hybrid",
1049
- fileGrepEnabled: true,
1050
- splashEffect: true,
1051
- consolidationEnabled: true,
1052
- consolidationIntervalMs: 6 * 60 * 60 * 1e3,
1053
- consolidationModel: "claude-haiku-4-5-20251001",
1054
- consolidationMaxCallsPerRun: 20,
1055
- selfQueryRouter: true,
1056
- selfQueryModel: "claude-haiku-4-5-20251001",
1057
- rerankerEnabled: true,
1058
- scalingRoadmap: {
1059
- rerankerAutoTrigger: {
1060
- enabled: true,
1061
- broadQueryMinCardinality: 5e4,
1062
- fetchTopK: 150,
1063
- returnTopK: 5
1064
- }
1065
- },
1066
- graphRagEnabled: true,
1067
- wikiEnabled: false,
1068
- wikiUrl: "",
1069
- wikiApiKey: "",
1070
- wikiSyncIntervalMs: 30 * 60 * 1e3,
1071
- wikiWorkspaceMapping: {
1072
- exe: "Executive",
1073
- yoshi: "Engineering",
1074
- mari: "Marketing",
1075
- tom: "Engineering",
1076
- sasha: "Production"
1077
- },
1078
- wikiAutoUpdate: true,
1079
- wikiAutoUpdateThreshold: 0.5,
1080
- wikiAutoUpdateCreateNew: true,
1081
- skillLearning: true,
1082
- skillThreshold: 3,
1083
- skillModel: "claude-haiku-4-5-20251001",
1084
- exeHeartbeat: {
1085
- enabled: true,
1086
- intervalSeconds: 60,
1087
- staleInProgressThresholdHours: 2
1088
- },
1089
- sessionLifecycle: {
1090
- idleKillEnabled: true,
1091
- idleKillTicksRequired: 3,
1092
- idleKillIntercomAckWindowMs: 1e4,
1093
- maxAutoInstances: 10
1094
- },
1095
- autoUpdate: {
1096
- checkOnBoot: true,
1097
- autoInstall: false,
1098
- checkIntervalMs: 24 * 60 * 60 * 1e3
1099
- }
1100
- };
1101
- CONFIG_MIGRATIONS = [
1102
- {
1103
- from: 0,
1104
- to: 1,
1105
- migrate: (cfg) => {
1106
- cfg.config_version = 1;
1107
- return cfg;
1108
- }
1109
- }
1110
- ];
1173
+ init_db_retry();
1174
+ init_employees();
1175
+ _client = null;
1176
+ _resilientClient = null;
1177
+ initTurso = initDatabase;
1111
1178
  }
1112
1179
  });
1113
1180
 
@@ -1124,12 +1191,12 @@ __export(shard_manager_exports, {
1124
1191
  listShards: () => listShards,
1125
1192
  shardExists: () => shardExists
1126
1193
  });
1127
- import path3 from "path";
1128
- import { existsSync as existsSync3, mkdirSync, readdirSync } from "fs";
1194
+ import path4 from "path";
1195
+ import { existsSync as existsSync4, mkdirSync, readdirSync } from "fs";
1129
1196
  import { createClient as createClient2 } from "@libsql/client";
1130
1197
  function initShardManager(encryptionKey) {
1131
1198
  _encryptionKey = encryptionKey;
1132
- if (!existsSync3(SHARDS_DIR)) {
1199
+ if (!existsSync4(SHARDS_DIR)) {
1133
1200
  mkdirSync(SHARDS_DIR, { recursive: true });
1134
1201
  }
1135
1202
  _shardingEnabled = true;
@@ -1150,7 +1217,7 @@ function getShardClient(projectName) {
1150
1217
  }
1151
1218
  const cached = _shards.get(safeName);
1152
1219
  if (cached) return cached;
1153
- const dbPath = path3.join(SHARDS_DIR, `${safeName}.db`);
1220
+ const dbPath = path4.join(SHARDS_DIR, `${safeName}.db`);
1154
1221
  const client = createClient2({
1155
1222
  url: `file:${dbPath}`,
1156
1223
  encryptionKey: _encryptionKey
@@ -1160,10 +1227,10 @@ function getShardClient(projectName) {
1160
1227
  }
1161
1228
  function shardExists(projectName) {
1162
1229
  const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
1163
- return existsSync3(path3.join(SHARDS_DIR, `${safeName}.db`));
1230
+ return existsSync4(path4.join(SHARDS_DIR, `${safeName}.db`));
1164
1231
  }
1165
1232
  function listShards() {
1166
- if (!existsSync3(SHARDS_DIR)) return [];
1233
+ if (!existsSync4(SHARDS_DIR)) return [];
1167
1234
  return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
1168
1235
  }
1169
1236
  async function ensureShardSchema(client) {
@@ -1233,7 +1300,11 @@ async function ensureShardSchema(client) {
1233
1300
  "ALTER TABLE memories ADD COLUMN source_path TEXT",
1234
1301
  "ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
1235
1302
  "ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
1236
- "ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
1303
+ "ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
1304
+ // MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
1305
+ "ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
1306
+ "ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
1307
+ "ALTER TABLE memories ADD COLUMN trajectory TEXT"
1237
1308
  ]) {
1238
1309
  try {
1239
1310
  await client.execute(col);
@@ -1345,7 +1416,7 @@ var init_shard_manager = __esm({
1345
1416
  "src/lib/shard-manager.ts"() {
1346
1417
  "use strict";
1347
1418
  init_config();
1348
- SHARDS_DIR = path3.join(EXE_AI_DIR, "shards");
1419
+ SHARDS_DIR = path4.join(EXE_AI_DIR, "shards");
1349
1420
  _shards = /* @__PURE__ */ new Map();
1350
1421
  _encryptionKey = null;
1351
1422
  _shardingEnabled = false;
@@ -1363,26 +1434,26 @@ var init_platform_procedures = __esm({
1363
1434
  title: "What is exe-os \u2014 the operating model every agent must understand",
1364
1435
  domain: "architecture",
1365
1436
  priority: "p0",
1366
- content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO (exe), CTO (yoshi), CMO (mari), engineers (tom), content (sasha). Each agent has identity, expertise, and experience layers \u2014 persistent memory that makes them better over time. All data is local-first, E2EE, owned by the user. The MCP server is the ONLY data interface \u2014 never access the DB directly."
1437
+ content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO, CTO, CMO, engineers, and content production specialists. Each agent has identity, expertise, and experience layers \u2014 persistent memory that makes them better over time. All data is local-first, E2EE, owned by the user. The MCP server is the ONLY data interface \u2014 never access the DB directly."
1367
1438
  },
1368
1439
  {
1369
1440
  title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
1370
1441
  domain: "architecture",
1371
1442
  priority: "p0",
1372
- content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC, runs /exe to boot the COO. exe manages employees in tmux sessions. Each exeN is a separate CC window/project. Employees (yoshi, tom, mari) run in their own tmux panes via create_task auto-spawn. The founder talks to exe; exe orchestrates the team. CC is the shell, exe-os is the brain."
1443
+ content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC and boots the COO. The COO manages employees in tmux sessions. Each coordinator session is a separate CC window/project. Employees run in their own tmux panes via create_task auto-spawn. The founder talks to the COO; the COO orchestrates the team. CC is the shell, exe-os is the brain."
1373
1444
  },
1374
1445
  {
1375
- title: "Sessions explained \u2014 what exeN means and how projects work",
1446
+ title: "Sessions explained \u2014 coordinator session names and projects",
1376
1447
  domain: "architecture",
1377
1448
  priority: "p0",
1378
- content: "Each exeN (exe1, exe2, exe3) is an isolated project session. exe1 might be exe-os development, exe2 might be exe-wiki. Each session spawns its own employees: exe1\u2192yoshi-exe1\u2192tom-exe1. Sessions share the same memory DB but tasks are scoped to the session that created them. A founder can run multiple projects simultaneously. Sessions never interfere with each other."
1449
+ content: "Each coordinator session is an isolated project session. One might be exe-os development, another might be exe-wiki. Each session spawns its own employees using {employee}-{coordinatorSession}. Sessions share the same memory DB but tasks are scoped to the session that created them. A founder can run multiple projects simultaneously. Sessions never interfere with each other."
1379
1450
  },
1380
1451
  // --- Hierarchy and dispatch ---
1381
1452
  {
1382
1453
  title: "Chain of command \u2014 who talks to whom",
1383
1454
  domain: "workflow",
1384
1455
  priority: "p0",
1385
- content: "Founder \u2192 exe (COO) \u2192 yoshi (CTO) / mari (CMO). Yoshi \u2192 tom (engineer). Mari \u2192 sasha (content). Never skip levels: exe never assigns directly to tom. Tom never reports directly to exe. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
1456
+ content: "Founder -> COO -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the COO does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
1386
1457
  },
1387
1458
  {
1388
1459
  title: "Single dispatch path \u2014 create_task only",
@@ -1392,30 +1463,30 @@ var init_platform_procedures = __esm({
1392
1463
  },
1393
1464
  // --- Session isolation ---
1394
1465
  {
1395
- title: "Session scoping \u2014 stay in your exe boundary",
1466
+ title: "Session scoping \u2014 stay in your coordinator boundary",
1396
1467
  domain: "security",
1397
1468
  priority: "p0",
1398
- content: "Session scoping is mandatory. Managers dispatch to workers within their own exe session ONLY. exe1\u2192yoshi-exe1\u2192tom-exe1. exe2\u2192yoshi-exe2\u2192tom2-exe2. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating exe session."
1469
+ content: "Session scoping is mandatory. Managers dispatch to workers within their own coordinator session ONLY. Employee sessions use {employee}-{coordinatorSession}. Cross-session dispatch is blocked by the system. Verify session names before dispatch. Tasks are scoped to the creating coordinator session."
1399
1470
  },
1400
1471
  {
1401
1472
  title: "Session isolation \u2014 never touch another session's work",
1402
1473
  domain: "workflow",
1403
1474
  priority: "p0",
1404
- content: `Sessions are isolated. exeN owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another exe session. (2) Never review work from a different session \u2014 report "belongs to exeN" and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: yoshi-exe1 works ONLY on exe1 tasks. Cross-session work is a system violation.`
1475
+ content: "Sessions are isolated. A coordinator session owns ONLY tasks it dispatched. (1) Never close/update/cancel tasks from another coordinator session. (2) Never review work from a different session \u2014 report that it belongs to another session and skip. (3) Ignore other sessions' items in list_tasks results. (4) Employees inherit session: employee sessions work ONLY on their parent coordinator session's tasks. Cross-session work is a system violation."
1405
1476
  },
1406
1477
  // --- Engineering: session scoping in code ---
1407
1478
  {
1408
1479
  title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
1409
1480
  domain: "architecture",
1410
1481
  priority: "p0",
1411
- content: "Every DB query, notification, review count, and task operation MUST be scoped on 3 dimensions: (1) Session \u2014 filter by session_scope matching current exeN. (2) Project \u2014 filter by project_name. (3) Role \u2014 agents only see data at their hierarchy level. When writing ANY function that touches tasks, reviews, messages, or notifications: always accept a sessionScope parameter and pass it to the SQL WHERE clause. Unscoped queries are bugs. Test by running 2+ exe sessions simultaneously."
1482
+ content: "Every DB query, notification, review count, and task operation MUST be scoped on 3 dimensions: (1) Session \u2014 filter by session_scope matching the current coordinator session. (2) Project \u2014 filter by project_name. (3) Role \u2014 agents only see data at their hierarchy level. When writing ANY function that touches tasks, reviews, messages, or notifications: always accept a sessionScope parameter and pass it to the SQL WHERE clause. Unscoped queries are bugs. Test by running 2+ coordinator sessions simultaneously."
1412
1483
  },
1413
1484
  // --- Hard constraints ---
1414
1485
  {
1415
1486
  title: "What you CANNOT do in exe-os \u2014 hard constraints",
1416
1487
  domain: "security",
1417
1488
  priority: "p0",
1418
- content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 exe reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
1489
+ content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
1419
1490
  },
1420
1491
  // --- Operations ---
1421
1492
  {
@@ -1543,14 +1614,14 @@ __export(worker_gate_exports, {
1543
1614
  tryAcquireBackfillLock: () => tryAcquireBackfillLock,
1544
1615
  tryAcquireWorkerSlot: () => tryAcquireWorkerSlot
1545
1616
  });
1546
- import { readdirSync as readdirSync2, writeFileSync, unlinkSync, mkdirSync as mkdirSync2, existsSync as existsSync4 } from "fs";
1547
- import path4 from "path";
1617
+ import { readdirSync as readdirSync2, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2, mkdirSync as mkdirSync2, existsSync as existsSync5 } from "fs";
1618
+ import path5 from "path";
1548
1619
  function tryAcquireWorkerSlot() {
1549
1620
  try {
1550
1621
  mkdirSync2(WORKER_PID_DIR, { recursive: true });
1551
1622
  const reservationId = `res-${process.pid}-${Date.now()}`;
1552
- const reservationPath = path4.join(WORKER_PID_DIR, `${reservationId}.pid`);
1553
- writeFileSync(reservationPath, String(process.pid));
1623
+ const reservationPath = path5.join(WORKER_PID_DIR, `${reservationId}.pid`);
1624
+ writeFileSync2(reservationPath, String(process.pid));
1554
1625
  const files = readdirSync2(WORKER_PID_DIR);
1555
1626
  let alive = 0;
1556
1627
  for (const f of files) {
@@ -1567,20 +1638,20 @@ function tryAcquireWorkerSlot() {
1567
1638
  alive++;
1568
1639
  } catch {
1569
1640
  try {
1570
- unlinkSync(path4.join(WORKER_PID_DIR, f));
1641
+ unlinkSync2(path5.join(WORKER_PID_DIR, f));
1571
1642
  } catch {
1572
1643
  }
1573
1644
  }
1574
1645
  }
1575
1646
  if (alive > MAX_CONCURRENT_WORKERS) {
1576
1647
  try {
1577
- unlinkSync(reservationPath);
1648
+ unlinkSync2(reservationPath);
1578
1649
  } catch {
1579
1650
  }
1580
1651
  return false;
1581
1652
  }
1582
1653
  try {
1583
- unlinkSync(reservationPath);
1654
+ unlinkSync2(reservationPath);
1584
1655
  } catch {
1585
1656
  }
1586
1657
  return true;
@@ -1591,20 +1662,20 @@ function tryAcquireWorkerSlot() {
1591
1662
  function registerWorkerPid(pid) {
1592
1663
  try {
1593
1664
  mkdirSync2(WORKER_PID_DIR, { recursive: true });
1594
- writeFileSync(path4.join(WORKER_PID_DIR, `worker-${pid}.pid`), String(pid));
1665
+ writeFileSync2(path5.join(WORKER_PID_DIR, `worker-${pid}.pid`), String(pid));
1595
1666
  } catch {
1596
1667
  }
1597
1668
  }
1598
1669
  function cleanupWorkerPid() {
1599
1670
  try {
1600
- unlinkSync(path4.join(WORKER_PID_DIR, `worker-${process.pid}.pid`));
1671
+ unlinkSync2(path5.join(WORKER_PID_DIR, `worker-${process.pid}.pid`));
1601
1672
  } catch {
1602
1673
  }
1603
1674
  }
1604
1675
  function tryAcquireBackfillLock() {
1605
1676
  try {
1606
1677
  mkdirSync2(WORKER_PID_DIR, { recursive: true });
1607
- if (existsSync4(BACKFILL_LOCK)) {
1678
+ if (existsSync5(BACKFILL_LOCK)) {
1608
1679
  try {
1609
1680
  const pid = parseInt(
1610
1681
  __require("fs").readFileSync(BACKFILL_LOCK, "utf8").trim(),
@@ -1620,7 +1691,7 @@ function tryAcquireBackfillLock() {
1620
1691
  } catch {
1621
1692
  }
1622
1693
  }
1623
- writeFileSync(BACKFILL_LOCK, String(process.pid));
1694
+ writeFileSync2(BACKFILL_LOCK, String(process.pid));
1624
1695
  return true;
1625
1696
  } catch {
1626
1697
  return true;
@@ -1628,7 +1699,7 @@ function tryAcquireBackfillLock() {
1628
1699
  }
1629
1700
  function releaseBackfillLock() {
1630
1701
  try {
1631
- unlinkSync(BACKFILL_LOCK);
1702
+ unlinkSync2(BACKFILL_LOCK);
1632
1703
  } catch {
1633
1704
  }
1634
1705
  }
@@ -1637,9 +1708,9 @@ var init_worker_gate = __esm({
1637
1708
  "src/lib/worker-gate.ts"() {
1638
1709
  "use strict";
1639
1710
  init_config();
1640
- WORKER_PID_DIR = path4.join(EXE_AI_DIR, "worker-pids");
1711
+ WORKER_PID_DIR = path5.join(EXE_AI_DIR, "worker-pids");
1641
1712
  MAX_CONCURRENT_WORKERS = 3;
1642
- BACKFILL_LOCK = path4.join(WORKER_PID_DIR, "backfill.lock");
1713
+ BACKFILL_LOCK = path5.join(WORKER_PID_DIR, "backfill.lock");
1643
1714
  }
1644
1715
  });
1645
1716
 
@@ -1647,17 +1718,17 @@ var init_worker_gate = __esm({
1647
1718
  init_database();
1648
1719
 
1649
1720
  // src/lib/keychain.ts
1650
- import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
1651
- import { existsSync } from "fs";
1652
- import path from "path";
1653
- import os from "os";
1721
+ import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
1722
+ import { existsSync as existsSync3 } from "fs";
1723
+ import path3 from "path";
1724
+ import os3 from "os";
1654
1725
  var SERVICE = "exe-mem";
1655
1726
  var ACCOUNT = "master-key";
1656
1727
  function getKeyDir() {
1657
- return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path.join(os.homedir(), ".exe-os");
1728
+ return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path3.join(os3.homedir(), ".exe-os");
1658
1729
  }
1659
1730
  function getKeyPath() {
1660
- return path.join(getKeyDir(), "master.key");
1731
+ return path3.join(getKeyDir(), "master.key");
1661
1732
  }
1662
1733
  async function tryKeytar() {
1663
1734
  try {
@@ -1678,11 +1749,11 @@ async function getMasterKey() {
1678
1749
  }
1679
1750
  }
1680
1751
  const keyPath = getKeyPath();
1681
- if (!existsSync(keyPath)) {
1752
+ if (!existsSync3(keyPath)) {
1682
1753
  return null;
1683
1754
  }
1684
1755
  try {
1685
- const content = await readFile(keyPath, "utf-8");
1756
+ const content = await readFile3(keyPath, "utf-8");
1686
1757
  return Buffer.from(content.trim(), "base64");
1687
1758
  } catch {
1688
1759
  return null;
@@ -1837,9 +1908,9 @@ function isMainModule(importMetaUrl) {
1837
1908
  }
1838
1909
 
1839
1910
  // src/bin/exe-doctor.ts
1840
- import { existsSync as existsSync5 } from "fs";
1911
+ import { existsSync as existsSync6 } from "fs";
1841
1912
  import { spawn } from "child_process";
1842
- import path5 from "path";
1913
+ import path6 from "path";
1843
1914
  import { randomUUID as randomUUID2 } from "crypto";
1844
1915
  function parseFlags(argv) {
1845
1916
  const flags = { fix: false, dryRun: false, verbose: false };
@@ -1980,7 +2051,7 @@ async function auditOrphanedProjects(client) {
1980
2051
  for (const row of result.rows) {
1981
2052
  const name = row.project_name;
1982
2053
  const count = Number(row.cnt);
1983
- const exists = existsSync5(path5.join(home, name)) || existsSync5(path5.join(home, "..", name)) || existsSync5(path5.join(process.cwd(), "..", name));
2054
+ const exists = existsSync6(path6.join(home, name)) || existsSync6(path6.join(home, "..", name)) || existsSync6(path6.join(process.cwd(), "..", name));
1984
2055
  if (!exists) {
1985
2056
  orphans.push({ project_name: name, count });
1986
2057
  }
@@ -2098,7 +2169,7 @@ async function fixNullVectors() {
2098
2169
  }
2099
2170
  }
2100
2171
  const npmRoot = (await import("child_process")).execSync("npm root -g", { encoding: "utf8" }).trim();
2101
- const backfillPath = path5.join(npmRoot, "exe-os", "dist", "bin", "backfill-vectors.js");
2172
+ const backfillPath = path6.join(npmRoot, "exe-os", "dist", "bin", "backfill-vectors.js");
2102
2173
  return new Promise((resolve, reject) => {
2103
2174
  const child = spawn("node", [backfillPath], { stdio: "inherit" });
2104
2175
  if (child.pid) registerWorkerPid2(child.pid);