@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
@@ -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, mkdir, chmod } from "fs/promises";
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 (!existsSync(newDir) && existsSync(legacyDir)) {
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");
@@ -106,7 +116,7 @@ import { createClient } from "@libsql/client";
106
116
  // src/lib/employees.ts
107
117
  init_config();
108
118
  import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
109
- import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
119
+ import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
110
120
  import { execSync } from "child_process";
111
121
  import path2 from "path";
112
122
  import os2 from "os";
@@ -133,7 +143,7 @@ function canCoordinate(agentName, agentRole, employees = loadEmployeesSync()) {
133
143
  return agentName === "default" || isCoordinatorRole(agentRole) || isCoordinatorName(agentName, employees);
134
144
  }
135
145
  function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
136
- if (!existsSync2(employeesPath)) return [];
146
+ if (!existsSync3(employeesPath)) return [];
137
147
  try {
138
148
  return JSON.parse(readFileSync2(employeesPath, "utf-8"));
139
149
  } catch {
@@ -143,14 +153,34 @@ function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
143
153
  function getEmployee(employees, name) {
144
154
  return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
145
155
  }
156
+ var IDENTITY_DIR = path2.join(EXE_AI_DIR, "identity");
157
+
158
+ // src/lib/database-adapter.ts
159
+ import os3 from "os";
160
+ import path3 from "path";
161
+ import { createRequire } from "module";
162
+ import { pathToFileURL } from "url";
163
+ var BOOLEAN_COLUMNS_BY_TABLE = {
164
+ memories: /* @__PURE__ */ new Set(["has_error", "draft"]),
165
+ behaviors: /* @__PURE__ */ new Set(["active"]),
166
+ notifications: /* @__PURE__ */ new Set(["read"]),
167
+ users: /* @__PURE__ */ new Set(["has_personal_memory"])
168
+ };
169
+ var BOOLEAN_COLUMN_NAMES = new Set(
170
+ Object.values(BOOLEAN_COLUMNS_BY_TABLE).flatMap((cols) => [...cols])
171
+ );
146
172
 
147
173
  // src/lib/database.ts
148
174
  var _resilientClient = null;
149
175
  var _daemonClient = null;
176
+ var _adapterClient = null;
150
177
  function getClient() {
151
- if (!_resilientClient) {
178
+ if (!_adapterClient) {
152
179
  throw new Error("Database client not initialized. Call initDatabase() first.");
153
180
  }
181
+ if (process.env.DATABASE_URL) {
182
+ return _adapterClient;
183
+ }
154
184
  if (process.env.EXE_IS_DAEMON === "1") {
155
185
  return _resilientClient;
156
186
  }
@@ -172,9 +202,9 @@ async function deactivateBehavior(id) {
172
202
 
173
203
  // src/lib/active-agent.ts
174
204
  init_config();
175
- import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, unlinkSync as unlinkSync2, readdirSync } from "fs";
205
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, readdirSync } from "fs";
176
206
  import { execSync as execSync3 } from "child_process";
177
- import path3 from "path";
207
+ import path4 from "path";
178
208
 
179
209
  // src/lib/session-key.ts
180
210
  import { execSync as execSync2 } from "child_process";
@@ -239,7 +269,7 @@ function getSessionKey() {
239
269
  }
240
270
 
241
271
  // src/lib/active-agent.ts
242
- var CACHE_DIR = path3.join(EXE_AI_DIR, "session-cache");
272
+ var CACHE_DIR = path4.join(EXE_AI_DIR, "session-cache");
243
273
  var STALE_MS = 24 * 60 * 60 * 1e3;
244
274
  function isNameWithOptionalInstance(candidate, baseName) {
245
275
  if (candidate === baseName) return true;
@@ -284,7 +314,7 @@ function resolveActiveAgentFromTmuxSession(sessionName) {
284
314
  return null;
285
315
  }
286
316
  function getMarkerPath() {
287
- return path3.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
317
+ return path4.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
288
318
  }
289
319
  function getActiveAgent() {
290
320
  try {
@@ -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, mkdir, chmod } from "fs/promises";
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 (!existsSync(newDir) && existsSync(legacyDir)) {
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");
@@ -106,19 +116,39 @@ import { createClient } from "@libsql/client";
106
116
  // src/lib/employees.ts
107
117
  init_config();
108
118
  import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
109
- import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
119
+ import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
110
120
  import { execSync } from "child_process";
111
121
  import path2 from "path";
112
122
  import os2 from "os";
113
123
  var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
124
+ var IDENTITY_DIR = path2.join(EXE_AI_DIR, "identity");
125
+
126
+ // src/lib/database-adapter.ts
127
+ import os3 from "os";
128
+ import path3 from "path";
129
+ import { createRequire } from "module";
130
+ import { pathToFileURL } from "url";
131
+ var BOOLEAN_COLUMNS_BY_TABLE = {
132
+ memories: /* @__PURE__ */ new Set(["has_error", "draft"]),
133
+ behaviors: /* @__PURE__ */ new Set(["active"]),
134
+ notifications: /* @__PURE__ */ new Set(["read"]),
135
+ users: /* @__PURE__ */ new Set(["has_personal_memory"])
136
+ };
137
+ var BOOLEAN_COLUMN_NAMES = new Set(
138
+ Object.values(BOOLEAN_COLUMNS_BY_TABLE).flatMap((cols) => [...cols])
139
+ );
114
140
 
115
141
  // src/lib/database.ts
116
142
  var _resilientClient = null;
117
143
  var _daemonClient = null;
144
+ var _adapterClient = null;
118
145
  function getClient() {
119
- if (!_resilientClient) {
146
+ if (!_adapterClient) {
120
147
  throw new Error("Database client not initialized. Call initDatabase() first.");
121
148
  }
149
+ if (process.env.DATABASE_URL) {
150
+ return _adapterClient;
151
+ }
122
152
  if (process.env.EXE_IS_DAEMON === "1") {
123
153
  return _resilientClient;
124
154
  }