@askexenow/exe-os 0.9.7 → 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.
Files changed (101) hide show
  1. package/dist/bin/backfill-conversations.js +953 -105
  2. package/dist/bin/backfill-responses.js +952 -104
  3. package/dist/bin/backfill-vectors.js +956 -108
  4. package/dist/bin/cleanup-stale-review-tasks.js +802 -58
  5. package/dist/bin/cli.js +2292 -1070
  6. package/dist/bin/exe-agent-config.js +157 -101
  7. package/dist/bin/exe-agent.js +55 -29
  8. package/dist/bin/exe-assign.js +940 -92
  9. package/dist/bin/exe-boot.js +1424 -442
  10. package/dist/bin/exe-call.js +240 -141
  11. package/dist/bin/exe-cloud.js +198 -70
  12. package/dist/bin/exe-dispatch.js +951 -192
  13. package/dist/bin/exe-doctor.js +791 -51
  14. package/dist/bin/exe-export-behaviors.js +790 -42
  15. package/dist/bin/exe-forget.js +771 -31
  16. package/dist/bin/exe-gateway.js +1592 -521
  17. package/dist/bin/exe-heartbeat.js +850 -109
  18. package/dist/bin/exe-kill.js +783 -35
  19. package/dist/bin/exe-launch-agent.js +1030 -107
  20. package/dist/bin/exe-link.js +916 -110
  21. package/dist/bin/exe-new-employee.js +526 -217
  22. package/dist/bin/exe-pending-messages.js +1046 -62
  23. package/dist/bin/exe-pending-notifications.js +1318 -111
  24. package/dist/bin/exe-pending-reviews.js +1040 -72
  25. package/dist/bin/exe-rename.js +772 -59
  26. package/dist/bin/exe-review.js +772 -32
  27. package/dist/bin/exe-search.js +982 -128
  28. package/dist/bin/exe-session-cleanup.js +1180 -306
  29. package/dist/bin/exe-settings.js +185 -105
  30. package/dist/bin/exe-start-codex.js +886 -132
  31. package/dist/bin/exe-start-opencode.js +873 -119
  32. package/dist/bin/exe-status.js +803 -59
  33. package/dist/bin/exe-team.js +772 -32
  34. package/dist/bin/git-sweep.js +1046 -223
  35. package/dist/bin/graph-backfill.js +779 -31
  36. package/dist/bin/graph-export.js +785 -37
  37. package/dist/bin/install.js +632 -200
  38. package/dist/bin/scan-tasks.js +1055 -232
  39. package/dist/bin/setup.js +1419 -320
  40. package/dist/bin/shard-migrate.js +783 -35
  41. package/dist/bin/update.js +138 -49
  42. package/dist/bin/wiki-sync.js +782 -34
  43. package/dist/gateway/index.js +1444 -449
  44. package/dist/hooks/bug-report-worker.js +1141 -269
  45. package/dist/hooks/codex-stop-task-finalizer.js +4678 -0
  46. package/dist/hooks/commit-complete.js +1044 -221
  47. package/dist/hooks/error-recall.js +989 -135
  48. package/dist/hooks/exe-heartbeat-hook.js +99 -75
  49. package/dist/hooks/ingest-worker.js +4176 -3226
  50. package/dist/hooks/ingest.js +920 -168
  51. package/dist/hooks/instructions-loaded.js +874 -70
  52. package/dist/hooks/notification.js +860 -56
  53. package/dist/hooks/post-compact.js +881 -73
  54. package/dist/hooks/pre-compact.js +1050 -227
  55. package/dist/hooks/pre-tool-use.js +1084 -159
  56. package/dist/hooks/prompt-ingest-worker.js +1089 -164
  57. package/dist/hooks/prompt-submit.js +1469 -515
  58. package/dist/hooks/response-ingest-worker.js +1104 -179
  59. package/dist/hooks/session-end.js +1085 -251
  60. package/dist/hooks/session-start.js +1241 -231
  61. package/dist/hooks/stop.js +935 -109
  62. package/dist/hooks/subagent-stop.js +881 -73
  63. package/dist/hooks/summary-worker.js +1323 -307
  64. package/dist/index.js +1449 -452
  65. package/dist/lib/agent-config.js +28 -6
  66. package/dist/lib/cloud-sync.js +909 -115
  67. package/dist/lib/config.js +30 -10
  68. package/dist/lib/consolidation.js +42 -9
  69. package/dist/lib/database.js +739 -33
  70. package/dist/lib/db-daemon-client.js +73 -19
  71. package/dist/lib/db.js +2359 -0
  72. package/dist/lib/device-registry.js +760 -47
  73. package/dist/lib/embedder.js +201 -73
  74. package/dist/lib/employee-templates.js +30 -4
  75. package/dist/lib/employees.js +290 -86
  76. package/dist/lib/exe-daemon-client.js +187 -83
  77. package/dist/lib/exe-daemon.js +1696 -616
  78. package/dist/lib/hybrid-search.js +982 -128
  79. package/dist/lib/identity.js +43 -13
  80. package/dist/lib/license.js +133 -48
  81. package/dist/lib/messaging.js +167 -80
  82. package/dist/lib/reminders.js +35 -5
  83. package/dist/lib/schedules.js +772 -32
  84. package/dist/lib/skill-learning.js +54 -7
  85. package/dist/lib/store.js +779 -31
  86. package/dist/lib/task-router.js +94 -73
  87. package/dist/lib/tasks.js +298 -225
  88. package/dist/lib/tmux-routing.js +246 -172
  89. package/dist/lib/token-spend.js +52 -14
  90. package/dist/mcp/server.js +2893 -850
  91. package/dist/mcp/tools/complete-reminder.js +35 -5
  92. package/dist/mcp/tools/create-reminder.js +35 -5
  93. package/dist/mcp/tools/create-task.js +507 -323
  94. package/dist/mcp/tools/deactivate-behavior.js +40 -10
  95. package/dist/mcp/tools/list-reminders.js +35 -5
  96. package/dist/mcp/tools/list-tasks.js +277 -104
  97. package/dist/mcp/tools/send-message.js +129 -56
  98. package/dist/mcp/tools/update-task.js +1864 -188
  99. package/dist/runtime/index.js +1083 -259
  100. package/dist/tui/App.js +1501 -434
  101. package/package.json +3 -2
@@ -1,14 +1,35 @@
1
1
  // src/lib/config.ts
2
- import { readFile, writeFile, mkdir, chmod } from "fs/promises";
3
- import { readFileSync, existsSync, renameSync } from "fs";
2
+ import { readFile, writeFile } from "fs/promises";
3
+ import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
4
4
  import path from "path";
5
5
  import os from "os";
6
+
7
+ // src/lib/secure-files.ts
8
+ import { chmodSync, existsSync, mkdirSync } from "fs";
9
+ import { chmod, mkdir } from "fs/promises";
10
+ var PRIVATE_DIR_MODE = 448;
11
+ var PRIVATE_FILE_MODE = 384;
12
+ async function ensurePrivateDir(dirPath) {
13
+ await mkdir(dirPath, { recursive: true, mode: PRIVATE_DIR_MODE });
14
+ try {
15
+ await chmod(dirPath, PRIVATE_DIR_MODE);
16
+ } catch {
17
+ }
18
+ }
19
+ async function enforcePrivateFile(filePath) {
20
+ try {
21
+ await chmod(filePath, PRIVATE_FILE_MODE);
22
+ } catch {
23
+ }
24
+ }
25
+
26
+ // src/lib/config.ts
6
27
  function resolveDataDir() {
7
28
  if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
8
29
  if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
9
30
  const newDir = path.join(os.homedir(), ".exe-os");
10
31
  const legacyDir = path.join(os.homedir(), ".exe-mem");
11
- if (!existsSync(newDir) && existsSync(legacyDir)) {
32
+ if (!existsSync2(newDir) && existsSync2(legacyDir)) {
12
33
  try {
13
34
  renameSync(legacyDir, newDir);
14
35
  process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
@@ -144,9 +165,9 @@ function normalizeAutoUpdate(raw) {
144
165
  }
145
166
  async function loadConfig() {
146
167
  const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
147
- await mkdir(dir, { recursive: true });
168
+ await ensurePrivateDir(dir);
148
169
  const configPath = path.join(dir, "config.json");
149
- if (!existsSync(configPath)) {
170
+ if (!existsSync2(configPath)) {
150
171
  return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
151
172
  }
152
173
  const raw = await readFile(configPath, "utf-8");
@@ -159,6 +180,7 @@ async function loadConfig() {
159
180
  `);
160
181
  try {
161
182
  await writeFile(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
183
+ await enforcePrivateFile(configPath);
162
184
  } catch {
163
185
  }
164
186
  }
@@ -177,7 +199,7 @@ async function loadConfig() {
177
199
  function loadConfigSync() {
178
200
  const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
179
201
  const configPath = path.join(dir, "config.json");
180
- if (!existsSync(configPath)) {
202
+ if (!existsSync2(configPath)) {
181
203
  return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
182
204
  }
183
205
  try {
@@ -195,12 +217,10 @@ function loadConfigSync() {
195
217
  }
196
218
  async function saveConfig(config) {
197
219
  const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
198
- await mkdir(dir, { recursive: true });
220
+ await ensurePrivateDir(dir);
199
221
  const configPath = path.join(dir, "config.json");
200
222
  await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
201
- if (config.cloud?.apiKey) {
202
- await chmod(configPath, 384);
203
- }
223
+ await enforcePrivateFile(configPath);
204
224
  }
205
225
  async function loadConfigFrom(configPath) {
206
226
  const raw = await readFile(configPath, "utf-8");
@@ -10,9 +10,18 @@ var init_db_retry = __esm({
10
10
  }
11
11
  });
12
12
 
13
+ // src/lib/secure-files.ts
14
+ import { chmodSync, existsSync, mkdirSync } from "fs";
15
+ import { chmod, mkdir } from "fs/promises";
16
+ var init_secure_files = __esm({
17
+ "src/lib/secure-files.ts"() {
18
+ "use strict";
19
+ }
20
+ });
21
+
13
22
  // src/lib/config.ts
14
- import { readFile, writeFile, mkdir, chmod } from "fs/promises";
15
- import { readFileSync, existsSync, renameSync } from "fs";
23
+ import { readFile, writeFile } from "fs/promises";
24
+ import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
16
25
  import path from "path";
17
26
  import os from "os";
18
27
  function resolveDataDir() {
@@ -20,7 +29,7 @@ function resolveDataDir() {
20
29
  if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
21
30
  const newDir = path.join(os.homedir(), ".exe-os");
22
31
  const legacyDir = path.join(os.homedir(), ".exe-mem");
23
- if (!existsSync(newDir) && existsSync(legacyDir)) {
32
+ if (!existsSync2(newDir) && existsSync2(legacyDir)) {
24
33
  try {
25
34
  renameSync(legacyDir, newDir);
26
35
  process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
@@ -35,6 +44,7 @@ var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CON
35
44
  var init_config = __esm({
36
45
  "src/lib/config.ts"() {
37
46
  "use strict";
47
+ init_secure_files();
38
48
  EXE_AI_DIR = resolveDataDir();
39
49
  DB_PATH = path.join(EXE_AI_DIR, "memories.db");
40
50
  MODELS_DIR = path.join(EXE_AI_DIR, "models");
@@ -103,7 +113,7 @@ var init_config = __esm({
103
113
 
104
114
  // src/lib/employees.ts
105
115
  import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
106
- import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
116
+ import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
107
117
  import { execSync } from "child_process";
108
118
  import path2 from "path";
109
119
  import os2 from "os";
@@ -124,14 +134,14 @@ function isCoordinatorName(agentName, employees = loadEmployeesSync()) {
124
134
  return agentName.toLowerCase() === getCoordinatorName(employees).toLowerCase();
125
135
  }
126
136
  function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
127
- if (!existsSync2(employeesPath)) return [];
137
+ if (!existsSync3(employeesPath)) return [];
128
138
  try {
129
139
  return JSON.parse(readFileSync2(employeesPath, "utf-8"));
130
140
  } catch {
131
141
  return [];
132
142
  }
133
143
  }
134
- var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
144
+ var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE, IDENTITY_DIR;
135
145
  var init_employees = __esm({
136
146
  "src/lib/employees.ts"() {
137
147
  "use strict";
@@ -139,6 +149,28 @@ var init_employees = __esm({
139
149
  EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
140
150
  DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
141
151
  COORDINATOR_ROLE = "COO";
152
+ IDENTITY_DIR = path2.join(EXE_AI_DIR, "identity");
153
+ }
154
+ });
155
+
156
+ // src/lib/database-adapter.ts
157
+ import os3 from "os";
158
+ import path3 from "path";
159
+ import { createRequire } from "module";
160
+ import { pathToFileURL } from "url";
161
+ var BOOLEAN_COLUMNS_BY_TABLE, BOOLEAN_COLUMN_NAMES;
162
+ var init_database_adapter = __esm({
163
+ "src/lib/database-adapter.ts"() {
164
+ "use strict";
165
+ BOOLEAN_COLUMNS_BY_TABLE = {
166
+ memories: /* @__PURE__ */ new Set(["has_error", "draft"]),
167
+ behaviors: /* @__PURE__ */ new Set(["active"]),
168
+ notifications: /* @__PURE__ */ new Set(["read"]),
169
+ users: /* @__PURE__ */ new Set(["has_personal_memory"])
170
+ };
171
+ BOOLEAN_COLUMN_NAMES = new Set(
172
+ Object.values(BOOLEAN_COLUMNS_BY_TABLE).flatMap((cols) => [...cols])
173
+ );
142
174
  }
143
175
  });
144
176
 
@@ -149,6 +181,7 @@ var init_database = __esm({
149
181
  "use strict";
150
182
  init_db_retry();
151
183
  init_employees();
184
+ init_database_adapter();
152
185
  }
153
186
  });
154
187
 
@@ -161,9 +194,9 @@ init_database();
161
194
 
162
195
  // src/lib/keychain.ts
163
196
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
164
- import { existsSync as existsSync3 } from "fs";
165
- import path3 from "path";
166
- import os3 from "os";
197
+ import { existsSync as existsSync4 } from "fs";
198
+ import path4 from "path";
199
+ import os4 from "os";
167
200
 
168
201
  // src/lib/store.ts
169
202
  init_config();