@askexenow/exe-os 0.8.0

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 (131) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +139 -0
  3. package/dist/bin/backfill-responses.js +1912 -0
  4. package/dist/bin/backfill-vectors.js +1642 -0
  5. package/dist/bin/cleanup-stale-review-tasks.js +1339 -0
  6. package/dist/bin/cli.js +18800 -0
  7. package/dist/bin/exe-agent.js +1858 -0
  8. package/dist/bin/exe-assign.js +1957 -0
  9. package/dist/bin/exe-boot.js +6460 -0
  10. package/dist/bin/exe-call.js +197 -0
  11. package/dist/bin/exe-cloud.js +850 -0
  12. package/dist/bin/exe-dispatch.js +1146 -0
  13. package/dist/bin/exe-doctor.js +1657 -0
  14. package/dist/bin/exe-export-behaviors.js +1494 -0
  15. package/dist/bin/exe-forget.js +1627 -0
  16. package/dist/bin/exe-gateway.js +7732 -0
  17. package/dist/bin/exe-healthcheck.js +207 -0
  18. package/dist/bin/exe-heartbeat.js +1647 -0
  19. package/dist/bin/exe-kill.js +1479 -0
  20. package/dist/bin/exe-launch-agent.js +1704 -0
  21. package/dist/bin/exe-link.js +192 -0
  22. package/dist/bin/exe-new-employee.js +852 -0
  23. package/dist/bin/exe-pending-messages.js +1446 -0
  24. package/dist/bin/exe-pending-notifications.js +1321 -0
  25. package/dist/bin/exe-pending-reviews.js +1468 -0
  26. package/dist/bin/exe-repo-drift.js +95 -0
  27. package/dist/bin/exe-review.js +1590 -0
  28. package/dist/bin/exe-search.js +2651 -0
  29. package/dist/bin/exe-session-cleanup.js +3173 -0
  30. package/dist/bin/exe-settings.js +354 -0
  31. package/dist/bin/exe-status.js +1532 -0
  32. package/dist/bin/exe-team.js +1324 -0
  33. package/dist/bin/git-sweep.js +2185 -0
  34. package/dist/bin/graph-backfill.js +1968 -0
  35. package/dist/bin/graph-export.js +1604 -0
  36. package/dist/bin/install.js +656 -0
  37. package/dist/bin/list-providers.js +140 -0
  38. package/dist/bin/scan-tasks.js +1820 -0
  39. package/dist/bin/setup.js +951 -0
  40. package/dist/bin/shard-migrate.js +1494 -0
  41. package/dist/bin/update.js +95 -0
  42. package/dist/bin/wiki-sync.js +1514 -0
  43. package/dist/gateway/index.js +8848 -0
  44. package/dist/hooks/bug-report-worker.js +2743 -0
  45. package/dist/hooks/commit-complete.js +2108 -0
  46. package/dist/hooks/error-recall.js +2861 -0
  47. package/dist/hooks/exe-heartbeat-hook.js +232 -0
  48. package/dist/hooks/ingest-worker.js +4793 -0
  49. package/dist/hooks/ingest.js +684 -0
  50. package/dist/hooks/instructions-loaded.js +1880 -0
  51. package/dist/hooks/notification.js +1726 -0
  52. package/dist/hooks/post-compact.js +1751 -0
  53. package/dist/hooks/pre-compact.js +1746 -0
  54. package/dist/hooks/pre-tool-use.js +2191 -0
  55. package/dist/hooks/prompt-ingest-worker.js +2126 -0
  56. package/dist/hooks/prompt-submit.js +4693 -0
  57. package/dist/hooks/response-ingest-worker.js +1936 -0
  58. package/dist/hooks/session-end.js +1752 -0
  59. package/dist/hooks/session-start.js +2795 -0
  60. package/dist/hooks/stop.js +1835 -0
  61. package/dist/hooks/subagent-stop.js +1726 -0
  62. package/dist/hooks/summary-worker.js +2661 -0
  63. package/dist/index.js +11834 -0
  64. package/dist/lib/cloud-sync.js +495 -0
  65. package/dist/lib/config.js +222 -0
  66. package/dist/lib/consolidation.js +476 -0
  67. package/dist/lib/crypto.js +51 -0
  68. package/dist/lib/database.js +730 -0
  69. package/dist/lib/device-registry.js +900 -0
  70. package/dist/lib/embedder.js +632 -0
  71. package/dist/lib/employee-templates.js +543 -0
  72. package/dist/lib/employees.js +177 -0
  73. package/dist/lib/error-detector.js +156 -0
  74. package/dist/lib/exe-daemon-client.js +451 -0
  75. package/dist/lib/exe-daemon.js +8285 -0
  76. package/dist/lib/file-grep.js +199 -0
  77. package/dist/lib/hybrid-search.js +1819 -0
  78. package/dist/lib/identity-templates.js +320 -0
  79. package/dist/lib/identity.js +223 -0
  80. package/dist/lib/keychain.js +145 -0
  81. package/dist/lib/license.js +377 -0
  82. package/dist/lib/messaging.js +1376 -0
  83. package/dist/lib/reminders.js +63 -0
  84. package/dist/lib/schedules.js +1396 -0
  85. package/dist/lib/session-registry.js +52 -0
  86. package/dist/lib/skill-learning.js +477 -0
  87. package/dist/lib/status-brief.js +235 -0
  88. package/dist/lib/store.js +1551 -0
  89. package/dist/lib/task-router.js +62 -0
  90. package/dist/lib/tasks.js +2456 -0
  91. package/dist/lib/tmux-routing.js +2836 -0
  92. package/dist/lib/tmux-status.js +261 -0
  93. package/dist/lib/tmux-transport.js +83 -0
  94. package/dist/lib/transport.js +128 -0
  95. package/dist/lib/ws-auth.js +19 -0
  96. package/dist/lib/ws-client.js +160 -0
  97. package/dist/mcp/server.js +10538 -0
  98. package/dist/mcp/tools/complete-reminder.js +67 -0
  99. package/dist/mcp/tools/create-reminder.js +52 -0
  100. package/dist/mcp/tools/create-task.js +1853 -0
  101. package/dist/mcp/tools/deactivate-behavior.js +263 -0
  102. package/dist/mcp/tools/list-reminders.js +62 -0
  103. package/dist/mcp/tools/list-tasks.js +463 -0
  104. package/dist/mcp/tools/send-message.js +1382 -0
  105. package/dist/mcp/tools/update-task.js +1692 -0
  106. package/dist/runtime/index.js +6809 -0
  107. package/dist/tui/App.js +17479 -0
  108. package/package.json +104 -0
  109. package/src/commands/exe/assign.md +17 -0
  110. package/src/commands/exe/build-adv.md +381 -0
  111. package/src/commands/exe/call.md +133 -0
  112. package/src/commands/exe/cloud.md +17 -0
  113. package/src/commands/exe/employee-heartbeat.md +44 -0
  114. package/src/commands/exe/forget.md +15 -0
  115. package/src/commands/exe/heartbeat.md +92 -0
  116. package/src/commands/exe/intercom.md +81 -0
  117. package/src/commands/exe/kill.md +34 -0
  118. package/src/commands/exe/launch.md +52 -0
  119. package/src/commands/exe/link.md +17 -0
  120. package/src/commands/exe/logs.md +22 -0
  121. package/src/commands/exe/new-employee.md +12 -0
  122. package/src/commands/exe/review.md +14 -0
  123. package/src/commands/exe/schedule.md +108 -0
  124. package/src/commands/exe/search.md +13 -0
  125. package/src/commands/exe/sessions.md +25 -0
  126. package/src/commands/exe/settings.md +13 -0
  127. package/src/commands/exe/setup.md +171 -0
  128. package/src/commands/exe/status.md +15 -0
  129. package/src/commands/exe/team.md +11 -0
  130. package/src/commands/exe/update.md +11 -0
  131. package/src/commands/exe.md +181 -0
@@ -0,0 +1,354 @@
1
+ // src/bin/exe-settings.ts
2
+ import { createInterface } from "readline";
3
+
4
+ // src/lib/config.ts
5
+ import { readFile, writeFile, mkdir } from "fs/promises";
6
+ import { readFileSync, existsSync, renameSync } from "fs";
7
+ import path from "path";
8
+ import os from "os";
9
+ function resolveDataDir() {
10
+ if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
11
+ if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
12
+ const newDir = path.join(os.homedir(), ".exe-os");
13
+ const legacyDir = path.join(os.homedir(), ".exe-mem");
14
+ if (!existsSync(newDir) && existsSync(legacyDir)) {
15
+ try {
16
+ renameSync(legacyDir, newDir);
17
+ process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
18
+ `);
19
+ } catch {
20
+ return legacyDir;
21
+ }
22
+ }
23
+ return newDir;
24
+ }
25
+ var EXE_AI_DIR = resolveDataDir();
26
+ var DB_PATH = path.join(EXE_AI_DIR, "memories.db");
27
+ var MODELS_DIR = path.join(EXE_AI_DIR, "models");
28
+ var CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
29
+ var LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
30
+ var CURRENT_CONFIG_VERSION = 1;
31
+ var DEFAULT_CONFIG = {
32
+ config_version: CURRENT_CONFIG_VERSION,
33
+ dbPath: DB_PATH,
34
+ modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
35
+ embeddingDim: 1024,
36
+ batchSize: 20,
37
+ flushIntervalMs: 1e4,
38
+ autoIngestion: true,
39
+ autoRetrieval: true,
40
+ searchMode: "hybrid",
41
+ hookSearchMode: "hybrid",
42
+ fileGrepEnabled: true,
43
+ splashEffect: true,
44
+ consolidationEnabled: true,
45
+ consolidationIntervalMs: 6 * 60 * 60 * 1e3,
46
+ consolidationModel: "claude-haiku-4-5-20251001",
47
+ consolidationMaxCallsPerRun: 20,
48
+ selfQueryRouter: true,
49
+ selfQueryModel: "claude-haiku-4-5-20251001",
50
+ rerankerEnabled: true,
51
+ scalingRoadmap: {
52
+ rerankerAutoTrigger: {
53
+ enabled: true,
54
+ broadQueryMinCardinality: 5e4,
55
+ fetchTopK: 150,
56
+ returnTopK: 5
57
+ }
58
+ },
59
+ graphRagEnabled: true,
60
+ wikiEnabled: false,
61
+ wikiUrl: "",
62
+ wikiApiKey: "",
63
+ wikiSyncIntervalMs: 30 * 60 * 1e3,
64
+ wikiWorkspaceMapping: {
65
+ exe: "Executive",
66
+ yoshi: "Engineering",
67
+ mari: "Marketing",
68
+ tom: "Engineering",
69
+ sasha: "Production"
70
+ },
71
+ wikiAutoUpdate: true,
72
+ wikiAutoUpdateThreshold: 0.5,
73
+ wikiAutoUpdateCreateNew: true,
74
+ skillLearning: true,
75
+ skillThreshold: 3,
76
+ skillModel: "claude-haiku-4-5-20251001",
77
+ exeHeartbeat: {
78
+ enabled: true,
79
+ intervalSeconds: 60,
80
+ staleInProgressThresholdHours: 2
81
+ },
82
+ sessionLifecycle: {
83
+ idleKillEnabled: true,
84
+ idleKillTicksRequired: 3,
85
+ idleKillIntercomAckWindowMs: 1e4,
86
+ maxAutoInstances: 10
87
+ }
88
+ };
89
+ function migrateLegacyConfig(raw) {
90
+ if ("r2" in raw) {
91
+ process.stderr.write(
92
+ "[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"
93
+ );
94
+ delete raw.r2;
95
+ }
96
+ if ("syncIntervalMs" in raw) {
97
+ delete raw.syncIntervalMs;
98
+ }
99
+ return raw;
100
+ }
101
+ var CONFIG_MIGRATIONS = [
102
+ {
103
+ from: 0,
104
+ to: 1,
105
+ migrate: (cfg) => {
106
+ cfg.config_version = 1;
107
+ return cfg;
108
+ }
109
+ }
110
+ ];
111
+ function migrateConfig(raw) {
112
+ const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
113
+ let currentVersion = fromVersion;
114
+ let migrated = false;
115
+ if (currentVersion > CURRENT_CONFIG_VERSION) {
116
+ return { config: raw, migrated: false, fromVersion };
117
+ }
118
+ for (const migration of CONFIG_MIGRATIONS) {
119
+ if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
120
+ raw = migration.migrate(raw);
121
+ currentVersion = migration.to;
122
+ migrated = true;
123
+ }
124
+ }
125
+ return { config: raw, migrated, fromVersion };
126
+ }
127
+ function normalizeScalingRoadmap(raw) {
128
+ const defaultAuto = DEFAULT_CONFIG.scalingRoadmap.rerankerAutoTrigger;
129
+ const userRoadmap = raw.scalingRoadmap ?? {};
130
+ const userAuto = userRoadmap.rerankerAutoTrigger ?? {};
131
+ if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
132
+ userAuto.enabled = raw.rerankerEnabled;
133
+ }
134
+ raw.scalingRoadmap = {
135
+ ...userRoadmap,
136
+ rerankerAutoTrigger: { ...defaultAuto, ...userAuto }
137
+ };
138
+ }
139
+ function normalizeSessionLifecycle(raw) {
140
+ const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
141
+ const userSL = raw.sessionLifecycle ?? {};
142
+ raw.sessionLifecycle = { ...defaultSL, ...userSL };
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
+ const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
167
+ if (config.dbPath.startsWith("~")) {
168
+ config.dbPath = config.dbPath.replace(/^~/, os.homedir());
169
+ }
170
+ return config;
171
+ } catch {
172
+ return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
173
+ }
174
+ }
175
+ async function saveConfig(config) {
176
+ const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
177
+ await mkdir(dir, { recursive: true });
178
+ const configPath = path.join(dir, "config.json");
179
+ await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
180
+ }
181
+
182
+ // src/lib/is-main.ts
183
+ import { realpathSync } from "fs";
184
+ import { fileURLToPath } from "url";
185
+ function isMainModule(importMetaUrl) {
186
+ if (process.argv[1] == null) return false;
187
+ try {
188
+ const scriptPath = realpathSync(process.argv[1]);
189
+ const modulePath = realpathSync(fileURLToPath(importMetaUrl));
190
+ return scriptPath === modulePath;
191
+ } catch {
192
+ return importMetaUrl === `file://${process.argv[1]}` || importMetaUrl === new URL(process.argv[1], "file://").href;
193
+ }
194
+ }
195
+
196
+ // src/bin/exe-settings.ts
197
+ function label(value) {
198
+ return value ? "ON" : "OFF";
199
+ }
200
+ function searchLabel(mode) {
201
+ if (mode === "hybrid") return "hybrid FTS + vector (best quality, uses embedding model)";
202
+ return "fts Keywords only (fast, no embedding model)";
203
+ }
204
+ function hookSearchLabel(mode) {
205
+ if (mode === "hybrid") return "hybrid FTS + vector (loads 639MB model \u2014 adds 3-8s on first call)";
206
+ return "fts Keywords only (fast, ~200ms, no model load)";
207
+ }
208
+ function syncStatus(config) {
209
+ if (config.cloud?.apiKey) return "Exe Cloud";
210
+ if (config.turso?.url) return "libSQL (self-hosted)";
211
+ return "local-only";
212
+ }
213
+ function printSettings(config) {
214
+ console.log(`
215
+ \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
216
+ \u2502 exe-os settings \u2502
217
+ \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
218
+
219
+ 1. Auto-ingestion: ${label(config.autoIngestion).padEnd(5)} Store every tool call as a memory
220
+ 2. Auto-retrieval: ${label(config.autoRetrieval).padEnd(5)} Inject relevant memories into context
221
+ 3. MCP search mode: ${searchLabel(config.searchMode)}
222
+ 4. Hook search mode: ${hookSearchLabel(config.hookSearchMode)}
223
+ 5. Cloud sync: ${syncStatus(config)}
224
+
225
+ Model: ${config.modelFile}
226
+
227
+ Type a number to toggle, or "q" to quit.
228
+ `);
229
+ }
230
+ async function main() {
231
+ const config = await loadConfig();
232
+ const rl = createInterface({
233
+ input: process.stdin,
234
+ output: process.stdout
235
+ });
236
+ const prompt = () => {
237
+ printSettings(config);
238
+ rl.question("> ", async (answer) => {
239
+ const choice = answer.trim().toLowerCase();
240
+ if (choice === "1") {
241
+ config.autoIngestion = !config.autoIngestion;
242
+ await saveConfig(config);
243
+ console.log(`
244
+ Auto-ingestion ${label(config.autoIngestion)}`);
245
+ if (!config.autoIngestion) {
246
+ console.log(" Tool calls will no longer be saved to memory.");
247
+ console.log(" Use the store_memory MCP tool to save manually.");
248
+ }
249
+ prompt();
250
+ } else if (choice === "2") {
251
+ config.autoRetrieval = !config.autoRetrieval;
252
+ await saveConfig(config);
253
+ console.log(`
254
+ Auto-retrieval ${label(config.autoRetrieval)}`);
255
+ if (!config.autoRetrieval) {
256
+ console.log(" Memories won't be injected automatically.");
257
+ console.log(" Use recall_my_memory MCP tool to search manually.");
258
+ }
259
+ prompt();
260
+ } else if (choice === "3") {
261
+ config.searchMode = config.searchMode === "hybrid" ? "fts" : "hybrid";
262
+ await saveConfig(config);
263
+ console.log(`
264
+ MCP search mode: ${config.searchMode}`);
265
+ if (config.searchMode === "fts") {
266
+ console.log(" MCP tools now use keyword search only.");
267
+ console.log(" Faster queries, no embedding model needed for search.");
268
+ } else {
269
+ console.log(" MCP tools now use hybrid search (FTS + vector + RRF).");
270
+ console.log(" Best quality \u2014 model is already warm in MCP server.");
271
+ }
272
+ prompt();
273
+ } else if (choice === "4") {
274
+ config.hookSearchMode = config.hookSearchMode === "fts" ? "hybrid" : "fts";
275
+ await saveConfig(config);
276
+ console.log(`
277
+ Hook search mode: ${config.hookSearchMode}`);
278
+ if (config.hookSearchMode === "hybrid") {
279
+ console.log(" Hooks will load the embedding model for semantic search.");
280
+ console.log(" Better recall, but first invocation adds 3-8s cold-start.");
281
+ } else {
282
+ console.log(" Hooks use keyword search only (~200ms, no model load).");
283
+ console.log(" Recommended for daily use.");
284
+ }
285
+ prompt();
286
+ } else if (choice === "5") {
287
+ console.log(`
288
+ Current sync: ${syncStatus(config)}`);
289
+ console.log("\n Configure cloud sync:");
290
+ console.log(" a. Exe Cloud \u2014 paste your API key (exe_sk_...)");
291
+ console.log(" b. Disconnect \u2014 switch to local-only");
292
+ console.log(" c. Cancel");
293
+ rl.question("\n > ", async (syncChoice) => {
294
+ const sc = syncChoice.trim().toLowerCase();
295
+ if (sc === "a") {
296
+ rl.question(" API key: ", async (apiKey) => {
297
+ const key = apiKey.trim();
298
+ if (!key) {
299
+ console.log(" Cancelled.");
300
+ prompt();
301
+ return;
302
+ }
303
+ rl.question(" Endpoint [https://askexe.com/cloud]: ", async (ep) => {
304
+ const endpoint = ep.trim() || "https://askexe.com/cloud";
305
+ console.log(" Validating...");
306
+ try {
307
+ const resp = await fetch(`${endpoint}/auth/verify`, {
308
+ method: "POST",
309
+ headers: { "Authorization": `Bearer ${key}`, "Content-Type": "application/json" }
310
+ });
311
+ if (resp.ok) {
312
+ config.cloud = { apiKey: key, endpoint };
313
+ delete config.turso;
314
+ await saveConfig(config);
315
+ console.log(" \u2713 Cloud sync configured. Memories will sync on next ingestion.");
316
+ } else {
317
+ console.log(` \u2717 Validation failed (${resp.status}). Key not saved.`);
318
+ }
319
+ } catch (err) {
320
+ console.log(` \u2717 Could not reach endpoint: ${err instanceof Error ? err.message : String(err)}`);
321
+ console.log(" Key not saved. Check the endpoint URL.");
322
+ }
323
+ prompt();
324
+ });
325
+ });
326
+ } else if (sc === "b") {
327
+ delete config.cloud;
328
+ delete config.turso;
329
+ await saveConfig(config);
330
+ console.log(" \u2713 Switched to local-only. Cloud sync disconnected.");
331
+ prompt();
332
+ } else {
333
+ prompt();
334
+ }
335
+ });
336
+ } else if (choice === "q" || choice === "quit" || choice === "") {
337
+ rl.close();
338
+ } else {
339
+ console.log("\n Unknown option. Type 1-5, or q.");
340
+ prompt();
341
+ }
342
+ });
343
+ };
344
+ prompt();
345
+ }
346
+ if (isMainModule(import.meta.url)) {
347
+ main().catch((err) => {
348
+ console.error("Settings error:", err instanceof Error ? err.message : err);
349
+ process.exit(1);
350
+ });
351
+ }
352
+ export {
353
+ main
354
+ };