@askexenow/exe-os 0.8.0 → 0.8.2

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 (107) hide show
  1. package/README.md +178 -79
  2. package/package.json +1 -1
  3. package/dist/bin/backfill-responses.js +0 -1912
  4. package/dist/bin/backfill-vectors.js +0 -1642
  5. package/dist/bin/cleanup-stale-review-tasks.js +0 -1339
  6. package/dist/bin/cli.js +0 -18800
  7. package/dist/bin/exe-agent.js +0 -1858
  8. package/dist/bin/exe-assign.js +0 -1957
  9. package/dist/bin/exe-boot.js +0 -6460
  10. package/dist/bin/exe-call.js +0 -197
  11. package/dist/bin/exe-cloud.js +0 -850
  12. package/dist/bin/exe-dispatch.js +0 -1146
  13. package/dist/bin/exe-doctor.js +0 -1657
  14. package/dist/bin/exe-export-behaviors.js +0 -1494
  15. package/dist/bin/exe-forget.js +0 -1627
  16. package/dist/bin/exe-gateway.js +0 -7732
  17. package/dist/bin/exe-healthcheck.js +0 -207
  18. package/dist/bin/exe-heartbeat.js +0 -1647
  19. package/dist/bin/exe-kill.js +0 -1479
  20. package/dist/bin/exe-launch-agent.js +0 -1704
  21. package/dist/bin/exe-link.js +0 -192
  22. package/dist/bin/exe-new-employee.js +0 -852
  23. package/dist/bin/exe-pending-messages.js +0 -1446
  24. package/dist/bin/exe-pending-notifications.js +0 -1321
  25. package/dist/bin/exe-pending-reviews.js +0 -1468
  26. package/dist/bin/exe-repo-drift.js +0 -95
  27. package/dist/bin/exe-review.js +0 -1590
  28. package/dist/bin/exe-search.js +0 -2651
  29. package/dist/bin/exe-session-cleanup.js +0 -3173
  30. package/dist/bin/exe-settings.js +0 -354
  31. package/dist/bin/exe-status.js +0 -1532
  32. package/dist/bin/exe-team.js +0 -1324
  33. package/dist/bin/git-sweep.js +0 -2185
  34. package/dist/bin/graph-backfill.js +0 -1968
  35. package/dist/bin/graph-export.js +0 -1604
  36. package/dist/bin/install.js +0 -656
  37. package/dist/bin/list-providers.js +0 -140
  38. package/dist/bin/scan-tasks.js +0 -1820
  39. package/dist/bin/setup.js +0 -951
  40. package/dist/bin/shard-migrate.js +0 -1494
  41. package/dist/bin/update.js +0 -95
  42. package/dist/bin/wiki-sync.js +0 -1514
  43. package/dist/gateway/index.js +0 -8848
  44. package/dist/hooks/bug-report-worker.js +0 -2743
  45. package/dist/hooks/commit-complete.js +0 -2108
  46. package/dist/hooks/error-recall.js +0 -2861
  47. package/dist/hooks/exe-heartbeat-hook.js +0 -232
  48. package/dist/hooks/ingest-worker.js +0 -4793
  49. package/dist/hooks/ingest.js +0 -684
  50. package/dist/hooks/instructions-loaded.js +0 -1880
  51. package/dist/hooks/notification.js +0 -1726
  52. package/dist/hooks/post-compact.js +0 -1751
  53. package/dist/hooks/pre-compact.js +0 -1746
  54. package/dist/hooks/pre-tool-use.js +0 -2191
  55. package/dist/hooks/prompt-ingest-worker.js +0 -2126
  56. package/dist/hooks/prompt-submit.js +0 -4693
  57. package/dist/hooks/response-ingest-worker.js +0 -1936
  58. package/dist/hooks/session-end.js +0 -1752
  59. package/dist/hooks/session-start.js +0 -2795
  60. package/dist/hooks/stop.js +0 -1835
  61. package/dist/hooks/subagent-stop.js +0 -1726
  62. package/dist/hooks/summary-worker.js +0 -2661
  63. package/dist/index.js +0 -11834
  64. package/dist/lib/cloud-sync.js +0 -495
  65. package/dist/lib/config.js +0 -222
  66. package/dist/lib/consolidation.js +0 -476
  67. package/dist/lib/crypto.js +0 -51
  68. package/dist/lib/database.js +0 -730
  69. package/dist/lib/device-registry.js +0 -900
  70. package/dist/lib/embedder.js +0 -632
  71. package/dist/lib/employee-templates.js +0 -543
  72. package/dist/lib/employees.js +0 -177
  73. package/dist/lib/error-detector.js +0 -156
  74. package/dist/lib/exe-daemon-client.js +0 -451
  75. package/dist/lib/exe-daemon.js +0 -8285
  76. package/dist/lib/file-grep.js +0 -199
  77. package/dist/lib/hybrid-search.js +0 -1819
  78. package/dist/lib/identity-templates.js +0 -320
  79. package/dist/lib/identity.js +0 -223
  80. package/dist/lib/keychain.js +0 -145
  81. package/dist/lib/license.js +0 -377
  82. package/dist/lib/messaging.js +0 -1376
  83. package/dist/lib/reminders.js +0 -63
  84. package/dist/lib/schedules.js +0 -1396
  85. package/dist/lib/session-registry.js +0 -52
  86. package/dist/lib/skill-learning.js +0 -477
  87. package/dist/lib/status-brief.js +0 -235
  88. package/dist/lib/store.js +0 -1551
  89. package/dist/lib/task-router.js +0 -62
  90. package/dist/lib/tasks.js +0 -2456
  91. package/dist/lib/tmux-routing.js +0 -2836
  92. package/dist/lib/tmux-status.js +0 -261
  93. package/dist/lib/tmux-transport.js +0 -83
  94. package/dist/lib/transport.js +0 -128
  95. package/dist/lib/ws-auth.js +0 -19
  96. package/dist/lib/ws-client.js +0 -160
  97. package/dist/mcp/server.js +0 -10538
  98. package/dist/mcp/tools/complete-reminder.js +0 -67
  99. package/dist/mcp/tools/create-reminder.js +0 -52
  100. package/dist/mcp/tools/create-task.js +0 -1853
  101. package/dist/mcp/tools/deactivate-behavior.js +0 -263
  102. package/dist/mcp/tools/list-reminders.js +0 -62
  103. package/dist/mcp/tools/list-tasks.js +0 -463
  104. package/dist/mcp/tools/send-message.js +0 -1382
  105. package/dist/mcp/tools/update-task.js +0 -1692
  106. package/dist/runtime/index.js +0 -6809
  107. package/dist/tui/App.js +0 -17479
@@ -1,377 +0,0 @@
1
- // src/lib/license.ts
2
- import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
3
- import { randomUUID } from "crypto";
4
- import path2 from "path";
5
- import { jwtVerify, importSPKI } from "jose";
6
-
7
- // src/lib/config.ts
8
- import { readFile, writeFile, mkdir } from "fs/promises";
9
- import { readFileSync, existsSync, renameSync } from "fs";
10
- import path from "path";
11
- import os from "os";
12
- function resolveDataDir() {
13
- if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
14
- if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
15
- const newDir = path.join(os.homedir(), ".exe-os");
16
- const legacyDir = path.join(os.homedir(), ".exe-mem");
17
- if (!existsSync(newDir) && existsSync(legacyDir)) {
18
- try {
19
- renameSync(legacyDir, newDir);
20
- process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
21
- `);
22
- } catch {
23
- return legacyDir;
24
- }
25
- }
26
- return newDir;
27
- }
28
- var EXE_AI_DIR = resolveDataDir();
29
- var DB_PATH = path.join(EXE_AI_DIR, "memories.db");
30
- var MODELS_DIR = path.join(EXE_AI_DIR, "models");
31
- var CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
32
- var LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
33
- var CURRENT_CONFIG_VERSION = 1;
34
- var DEFAULT_CONFIG = {
35
- config_version: CURRENT_CONFIG_VERSION,
36
- dbPath: DB_PATH,
37
- modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
38
- embeddingDim: 1024,
39
- batchSize: 20,
40
- flushIntervalMs: 1e4,
41
- autoIngestion: true,
42
- autoRetrieval: true,
43
- searchMode: "hybrid",
44
- hookSearchMode: "hybrid",
45
- fileGrepEnabled: true,
46
- splashEffect: true,
47
- consolidationEnabled: true,
48
- consolidationIntervalMs: 6 * 60 * 60 * 1e3,
49
- consolidationModel: "claude-haiku-4-5-20251001",
50
- consolidationMaxCallsPerRun: 20,
51
- selfQueryRouter: true,
52
- selfQueryModel: "claude-haiku-4-5-20251001",
53
- rerankerEnabled: true,
54
- scalingRoadmap: {
55
- rerankerAutoTrigger: {
56
- enabled: true,
57
- broadQueryMinCardinality: 5e4,
58
- fetchTopK: 150,
59
- returnTopK: 5
60
- }
61
- },
62
- graphRagEnabled: true,
63
- wikiEnabled: false,
64
- wikiUrl: "",
65
- wikiApiKey: "",
66
- wikiSyncIntervalMs: 30 * 60 * 1e3,
67
- wikiWorkspaceMapping: {
68
- exe: "Executive",
69
- yoshi: "Engineering",
70
- mari: "Marketing",
71
- tom: "Engineering",
72
- sasha: "Production"
73
- },
74
- wikiAutoUpdate: true,
75
- wikiAutoUpdateThreshold: 0.5,
76
- wikiAutoUpdateCreateNew: true,
77
- skillLearning: true,
78
- skillThreshold: 3,
79
- skillModel: "claude-haiku-4-5-20251001",
80
- exeHeartbeat: {
81
- enabled: true,
82
- intervalSeconds: 60,
83
- staleInProgressThresholdHours: 2
84
- },
85
- sessionLifecycle: {
86
- idleKillEnabled: true,
87
- idleKillTicksRequired: 3,
88
- idleKillIntercomAckWindowMs: 1e4,
89
- maxAutoInstances: 10
90
- }
91
- };
92
-
93
- // src/lib/license.ts
94
- var LICENSE_PATH = path2.join(EXE_AI_DIR, "license.key");
95
- var CACHE_PATH = path2.join(EXE_AI_DIR, "license-cache.json");
96
- var DEVICE_ID_PATH = path2.join(EXE_AI_DIR, "device-id");
97
- var API_BASE = "https://askexe.com/cloud";
98
- var LICENSE_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----
99
- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
100
- 4uj+UqeKCcvtgNHKmOK278HJaJcANe9xAeji8AFYu27q3WtzCi04pHudow==
101
- -----END PUBLIC KEY-----`;
102
- var LICENSE_JWT_ALG = "ES256";
103
- var PLAN_LIMITS = {
104
- free: { devices: 1, employees: 1, memories: 5e3 },
105
- pro: { devices: 2, employees: 5, memories: 1e5 },
106
- team: { devices: 10, employees: 20, memories: 1e6 },
107
- agency: { devices: 50, employees: 100, memories: 1e7 },
108
- enterprise: { devices: -1, employees: -1, memories: -1 }
109
- };
110
- var FREE_LICENSE = {
111
- valid: true,
112
- plan: "free",
113
- email: "",
114
- expiresAt: null,
115
- deviceLimit: 1,
116
- employeeLimit: 1,
117
- memoryLimit: 5e3
118
- };
119
- function loadDeviceId() {
120
- const deviceJsonPath = path2.join(EXE_AI_DIR, "device.json");
121
- try {
122
- if (existsSync2(deviceJsonPath)) {
123
- const data = JSON.parse(readFileSync2(deviceJsonPath, "utf8"));
124
- if (data.deviceId) return data.deviceId;
125
- }
126
- } catch {
127
- }
128
- try {
129
- if (existsSync2(DEVICE_ID_PATH)) {
130
- const id2 = readFileSync2(DEVICE_ID_PATH, "utf8").trim();
131
- if (id2) return id2;
132
- }
133
- } catch {
134
- }
135
- const id = randomUUID();
136
- mkdirSync(EXE_AI_DIR, { recursive: true });
137
- writeFileSync(DEVICE_ID_PATH, id, "utf8");
138
- return id;
139
- }
140
- function loadLicense() {
141
- try {
142
- if (!existsSync2(LICENSE_PATH)) return null;
143
- return readFileSync2(LICENSE_PATH, "utf8").trim();
144
- } catch {
145
- return null;
146
- }
147
- }
148
- function saveLicense(apiKey) {
149
- mkdirSync(EXE_AI_DIR, { recursive: true });
150
- writeFileSync(LICENSE_PATH, apiKey.trim(), "utf8");
151
- }
152
- async function verifyLicenseJwt(token) {
153
- try {
154
- const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
155
- const { payload } = await jwtVerify(token, key, {
156
- algorithms: [LICENSE_JWT_ALG]
157
- });
158
- const plan = payload.plan ?? "free";
159
- const email = payload.sub ?? "";
160
- const limits = PLAN_LIMITS[plan] ?? PLAN_LIMITS.free;
161
- return {
162
- valid: true,
163
- plan,
164
- email,
165
- expiresAt: payload.exp ? new Date(payload.exp * 1e3).toISOString() : null,
166
- deviceLimit: limits.devices,
167
- employeeLimit: limits.employees,
168
- memoryLimit: limits.memories
169
- };
170
- } catch {
171
- return null;
172
- }
173
- }
174
- async function getCachedLicense() {
175
- try {
176
- if (!existsSync2(CACHE_PATH)) return null;
177
- const raw = JSON.parse(readFileSync2(CACHE_PATH, "utf8"));
178
- if (!raw.token || typeof raw.token !== "string") return null;
179
- return await verifyLicenseJwt(raw.token);
180
- } catch {
181
- return null;
182
- }
183
- }
184
- function readCachedToken() {
185
- try {
186
- if (!existsSync2(CACHE_PATH)) return null;
187
- const raw = JSON.parse(readFileSync2(CACHE_PATH, "utf8"));
188
- return typeof raw.token === "string" ? raw.token : null;
189
- } catch {
190
- return null;
191
- }
192
- }
193
- function cacheResponse(token) {
194
- try {
195
- writeFileSync(CACHE_PATH, JSON.stringify({ token }), "utf8");
196
- } catch {
197
- }
198
- }
199
- async function validateLicense(apiKey, deviceId) {
200
- const did = deviceId ?? loadDeviceId();
201
- try {
202
- const res = await fetch(`${API_BASE}/auth/activate`, {
203
- method: "POST",
204
- headers: { "Content-Type": "application/json" },
205
- body: JSON.stringify({ apiKey, deviceId: did }),
206
- signal: AbortSignal.timeout(1e4)
207
- });
208
- if (res.ok) {
209
- const data = await res.json();
210
- if (data.error === "device_limit_exceeded") {
211
- const cached2 = await getCachedLicense();
212
- if (cached2) return cached2;
213
- return { ...FREE_LICENSE, valid: false, plan: "free" };
214
- }
215
- if (data.token) {
216
- cacheResponse(data.token);
217
- const verified = await verifyLicenseJwt(data.token);
218
- if (verified) return verified;
219
- }
220
- const limits = PLAN_LIMITS[data.plan] ?? PLAN_LIMITS.free;
221
- return {
222
- valid: data.valid,
223
- plan: data.plan,
224
- email: data.email,
225
- expiresAt: data.expiresAt,
226
- deviceLimit: limits.devices,
227
- employeeLimit: limits.employees,
228
- memoryLimit: limits.memories
229
- };
230
- }
231
- const cached = await getCachedLicense();
232
- if (cached) return cached;
233
- return { ...FREE_LICENSE, valid: false, plan: "free" };
234
- } catch {
235
- const cached = await getCachedLicense();
236
- if (cached) return cached;
237
- return FREE_LICENSE;
238
- }
239
- }
240
- async function checkLicense() {
241
- const key = loadLicense();
242
- if (!key) return FREE_LICENSE;
243
- const cached = await getCachedLicense();
244
- if (cached) return cached;
245
- const deviceId = loadDeviceId();
246
- return validateLicense(key, deviceId);
247
- }
248
- function isFeatureAllowed(license, feature) {
249
- switch (feature) {
250
- case "cloud_sync":
251
- case "external_agents":
252
- case "wiki":
253
- return license.plan !== "free";
254
- case "unlimited_employees":
255
- return license.plan === "team" || license.plan === "agency" || license.plan === "enterprise";
256
- }
257
- }
258
- function mirrorLicenseKey(apiKey) {
259
- const trimmed = apiKey.trim();
260
- if (!trimmed) return;
261
- saveLicense(trimmed);
262
- }
263
- async function assertVpsLicense(opts) {
264
- const env = opts?.env ?? process.env;
265
- const inProduction = env.NODE_ENV === "production";
266
- if (!opts?.force && !inProduction) {
267
- return { ...FREE_LICENSE, plan: "free" };
268
- }
269
- const envKey = env.EXE_LICENSE_KEY?.trim();
270
- if (envKey) {
271
- saveLicense(envKey);
272
- }
273
- const apiKey = envKey ?? loadLicense();
274
- if (!apiKey) {
275
- throw new Error(
276
- "License required: set EXE_LICENSE_KEY env var with your exe_sk_* key. Purchase at https://askexe.com. This VPS image refuses to boot without a valid license."
277
- );
278
- }
279
- const deviceId = loadDeviceId();
280
- let backendResponse = null;
281
- let explicitRejection = false;
282
- let transientFailure = false;
283
- try {
284
- const res = await fetch(`${API_BASE}/auth/activate`, {
285
- method: "POST",
286
- headers: { "Content-Type": "application/json" },
287
- body: JSON.stringify({ apiKey, deviceId }),
288
- signal: AbortSignal.timeout(1e4)
289
- });
290
- if (res.ok) {
291
- backendResponse = await res.json();
292
- if (!backendResponse.valid) explicitRejection = true;
293
- } else if (res.status === 401 || res.status === 403) {
294
- explicitRejection = true;
295
- } else {
296
- transientFailure = true;
297
- }
298
- } catch {
299
- transientFailure = true;
300
- }
301
- if (backendResponse?.valid) {
302
- if (backendResponse.token) {
303
- cacheResponse(backendResponse.token);
304
- const verified = await verifyLicenseJwt(backendResponse.token);
305
- if (verified) return verified;
306
- }
307
- const limits = PLAN_LIMITS[backendResponse.plan] ?? PLAN_LIMITS.free;
308
- return {
309
- valid: true,
310
- plan: backendResponse.plan,
311
- email: backendResponse.email,
312
- expiresAt: backendResponse.expiresAt,
313
- deviceLimit: limits.devices,
314
- employeeLimit: limits.employees,
315
- memoryLimit: limits.memories
316
- };
317
- }
318
- if (explicitRejection) {
319
- throw new Error(
320
- `License invalid or expired. Renew at https://askexe.com, then restart. Backend rejected key ending in ...${apiKey.slice(-4)}.`
321
- );
322
- }
323
- if (!transientFailure) {
324
- throw new Error(
325
- "License validation failed: unknown backend state. Restore network connectivity to https://askexe.com/cloud and retry."
326
- );
327
- }
328
- const fresh = await getCachedLicense();
329
- if (fresh && fresh.valid) return fresh;
330
- const graceDays = opts?.offlineGraceDays ?? 7;
331
- const graceMs = graceDays * 24 * 60 * 60 * 1e3;
332
- try {
333
- const token = readCachedToken();
334
- if (token) {
335
- const payloadB64 = token.split(".")[1];
336
- if (payloadB64) {
337
- const payload = JSON.parse(Buffer.from(payloadB64, "base64url").toString());
338
- const expMs = (payload.exp ?? 0) * 1e3;
339
- if (Date.now() < expMs + graceMs) {
340
- const key = await importSPKI(LICENSE_PUBLIC_KEY_PEM, LICENSE_JWT_ALG);
341
- const { payload: verified } = await jwtVerify(token, key, {
342
- algorithms: [LICENSE_JWT_ALG],
343
- clockTolerance: graceDays * 24 * 60 * 60
344
- });
345
- const plan = verified.plan ?? "free";
346
- const limits = PLAN_LIMITS[plan] ?? PLAN_LIMITS.free;
347
- return {
348
- valid: true,
349
- plan,
350
- email: verified.sub ?? "",
351
- expiresAt: verified.exp ? new Date(verified.exp * 1e3).toISOString() : null,
352
- deviceLimit: limits.devices,
353
- employeeLimit: limits.employees,
354
- memoryLimit: limits.memories
355
- };
356
- }
357
- }
358
- }
359
- } catch {
360
- }
361
- throw new Error(
362
- `License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://askexe.com/cloud and retry. This VPS image refuses to boot after the offline grace window.`
363
- );
364
- }
365
- export {
366
- LICENSE_PUBLIC_KEY_PEM,
367
- PLAN_LIMITS,
368
- assertVpsLicense,
369
- checkLicense,
370
- getCachedLicense,
371
- isFeatureAllowed,
372
- loadDeviceId,
373
- loadLicense,
374
- mirrorLicenseKey,
375
- saveLicense,
376
- validateLicense
377
- };