@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.
- package/dist/bin/backfill-conversations.js +359 -267
- package/dist/bin/backfill-responses.js +357 -265
- package/dist/bin/backfill-vectors.js +339 -264
- package/dist/bin/cleanup-stale-review-tasks.js +315 -256
- package/dist/bin/cli.js +494 -240
- package/dist/bin/exe-agent.js +141 -46
- package/dist/bin/exe-assign.js +151 -63
- package/dist/bin/exe-boot.js +294 -115
- package/dist/bin/exe-call.js +76 -51
- package/dist/bin/exe-cloud.js +58 -45
- package/dist/bin/exe-dispatch.js +434 -277
- package/dist/bin/exe-doctor.js +317 -246
- package/dist/bin/exe-export-behaviors.js +328 -248
- package/dist/bin/exe-forget.js +314 -231
- package/dist/bin/exe-gateway.js +2676 -1402
- package/dist/bin/exe-heartbeat.js +329 -264
- package/dist/bin/exe-kill.js +324 -244
- package/dist/bin/exe-launch-agent.js +574 -463
- package/dist/bin/exe-link.js +1055 -95
- package/dist/bin/exe-new-employee.js +49 -54
- package/dist/bin/exe-pending-messages.js +310 -253
- package/dist/bin/exe-pending-notifications.js +299 -228
- package/dist/bin/exe-pending-reviews.js +314 -245
- package/dist/bin/exe-rename.js +259 -195
- package/dist/bin/exe-review.js +140 -64
- package/dist/bin/exe-search.js +543 -356
- package/dist/bin/exe-session-cleanup.js +463 -382
- package/dist/bin/exe-settings.js +129 -99
- package/dist/bin/exe-start.sh +6 -6
- package/dist/bin/exe-status.js +95 -36
- package/dist/bin/exe-team.js +116 -51
- package/dist/bin/git-sweep.js +482 -307
- package/dist/bin/graph-backfill.js +357 -245
- package/dist/bin/graph-export.js +324 -244
- package/dist/bin/install.js +33 -10
- package/dist/bin/scan-tasks.js +481 -307
- package/dist/bin/setup.js +1147 -140
- package/dist/bin/shard-migrate.js +321 -241
- package/dist/bin/update.js +1 -7
- package/dist/bin/wiki-sync.js +318 -238
- package/dist/gateway/index.js +2656 -1383
- package/dist/hooks/bug-report-worker.js +641 -472
- package/dist/hooks/commit-complete.js +482 -307
- package/dist/hooks/error-recall.js +363 -135
- package/dist/hooks/exe-heartbeat-hook.js +97 -27
- package/dist/hooks/ingest-worker.js +584 -397
- package/dist/hooks/ingest.js +123 -58
- package/dist/hooks/instructions-loaded.js +212 -82
- package/dist/hooks/notification.js +200 -70
- package/dist/hooks/post-compact.js +199 -81
- package/dist/hooks/pre-compact.js +352 -140
- package/dist/hooks/pre-tool-use.js +416 -278
- package/dist/hooks/prompt-ingest-worker.js +376 -299
- package/dist/hooks/prompt-submit.js +414 -188
- package/dist/hooks/response-ingest-worker.js +408 -338
- package/dist/hooks/session-end.js +209 -83
- package/dist/hooks/session-start.js +382 -158
- package/dist/hooks/stop.js +209 -83
- package/dist/hooks/subagent-stop.js +209 -85
- package/dist/hooks/summary-worker.js +606 -510
- package/dist/index.js +2133 -855
- package/dist/lib/cloud-sync.js +1175 -184
- package/dist/lib/config.js +1 -9
- package/dist/lib/consolidation.js +71 -34
- package/dist/lib/database.js +166 -14
- package/dist/lib/device-registry.js +189 -117
- package/dist/lib/embedder.js +6 -10
- package/dist/lib/employee-templates.js +134 -39
- package/dist/lib/employees.js +30 -7
- package/dist/lib/exe-daemon-client.js +5 -7
- package/dist/lib/exe-daemon.js +514 -152
- package/dist/lib/hybrid-search.js +543 -356
- package/dist/lib/identity-templates.js +15 -15
- package/dist/lib/identity.js +19 -15
- package/dist/lib/license.js +1 -7
- package/dist/lib/messaging.js +157 -135
- package/dist/lib/reminders.js +97 -0
- package/dist/lib/schedules.js +302 -231
- package/dist/lib/skill-learning.js +33 -27
- package/dist/lib/status-brief.js +11 -14
- package/dist/lib/store.js +326 -237
- package/dist/lib/task-router.js +105 -1
- package/dist/lib/tasks.js +233 -116
- package/dist/lib/tmux-routing.js +173 -56
- package/dist/lib/ws-client.js +13 -3
- package/dist/mcp/server.js +2009 -1015
- package/dist/mcp/tools/complete-reminder.js +97 -0
- package/dist/mcp/tools/create-reminder.js +97 -0
- package/dist/mcp/tools/create-task.js +426 -262
- package/dist/mcp/tools/deactivate-behavior.js +119 -44
- package/dist/mcp/tools/list-reminders.js +97 -0
- package/dist/mcp/tools/list-tasks.js +56 -57
- package/dist/mcp/tools/send-message.js +206 -143
- package/dist/mcp/tools/update-task.js +259 -85
- package/dist/runtime/index.js +495 -316
- package/dist/tui/App.js +1128 -919
- package/package.json +2 -10
- package/src/commands/exe/afk.md +8 -8
- package/src/commands/exe/assign.md +1 -1
- package/src/commands/exe/build-adv.md +1 -1
- package/src/commands/exe/call.md +10 -10
- package/src/commands/exe/employee-heartbeat.md +9 -6
- package/src/commands/exe/heartbeat.md +5 -5
- package/src/commands/exe/intercom.md +26 -15
- package/src/commands/exe/launch.md +2 -2
- package/src/commands/exe/new-employee.md +1 -1
- package/src/commands/exe/review.md +2 -2
- package/src/commands/exe/schedule.md +1 -1
- package/src/commands/exe/sessions.md +2 -2
- package/src/commands/exe.md +22 -20
|
@@ -48,7 +48,7 @@ function wrapWithRetry(client) {
|
|
|
48
48
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
49
49
|
}
|
|
50
50
|
if (prop === "batch") {
|
|
51
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
51
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
52
52
|
}
|
|
53
53
|
return Reflect.get(target, prop, receiver);
|
|
54
54
|
}
|
|
@@ -64,6 +64,226 @@ var init_db_retry = __esm({
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
+
// src/lib/config.ts
|
|
68
|
+
import { readFile, writeFile, mkdir, chmod } from "fs/promises";
|
|
69
|
+
import { readFileSync, existsSync, renameSync } from "fs";
|
|
70
|
+
import path from "path";
|
|
71
|
+
import os from "os";
|
|
72
|
+
function resolveDataDir() {
|
|
73
|
+
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
74
|
+
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
75
|
+
const newDir = path.join(os.homedir(), ".exe-os");
|
|
76
|
+
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
77
|
+
if (!existsSync(newDir) && existsSync(legacyDir)) {
|
|
78
|
+
try {
|
|
79
|
+
renameSync(legacyDir, newDir);
|
|
80
|
+
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
81
|
+
`);
|
|
82
|
+
} catch {
|
|
83
|
+
return legacyDir;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return newDir;
|
|
87
|
+
}
|
|
88
|
+
function migrateLegacyConfig(raw) {
|
|
89
|
+
if ("r2" in raw) {
|
|
90
|
+
process.stderr.write(
|
|
91
|
+
"[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"
|
|
92
|
+
);
|
|
93
|
+
delete raw.r2;
|
|
94
|
+
}
|
|
95
|
+
if ("syncIntervalMs" in raw) {
|
|
96
|
+
delete raw.syncIntervalMs;
|
|
97
|
+
}
|
|
98
|
+
return raw;
|
|
99
|
+
}
|
|
100
|
+
function migrateConfig(raw) {
|
|
101
|
+
const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
|
|
102
|
+
let currentVersion = fromVersion;
|
|
103
|
+
let migrated = false;
|
|
104
|
+
if (currentVersion > CURRENT_CONFIG_VERSION) {
|
|
105
|
+
return { config: raw, migrated: false, fromVersion };
|
|
106
|
+
}
|
|
107
|
+
for (const migration of CONFIG_MIGRATIONS) {
|
|
108
|
+
if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
|
|
109
|
+
raw = migration.migrate(raw);
|
|
110
|
+
currentVersion = migration.to;
|
|
111
|
+
migrated = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return { config: raw, migrated, fromVersion };
|
|
115
|
+
}
|
|
116
|
+
function normalizeScalingRoadmap(raw) {
|
|
117
|
+
const defaultAuto = DEFAULT_CONFIG.scalingRoadmap.rerankerAutoTrigger;
|
|
118
|
+
const userRoadmap = raw.scalingRoadmap ?? {};
|
|
119
|
+
const userAuto = userRoadmap.rerankerAutoTrigger ?? {};
|
|
120
|
+
if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
|
|
121
|
+
userAuto.enabled = raw.rerankerEnabled;
|
|
122
|
+
}
|
|
123
|
+
raw.scalingRoadmap = {
|
|
124
|
+
...userRoadmap,
|
|
125
|
+
rerankerAutoTrigger: { ...defaultAuto, ...userAuto }
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function normalizeSessionLifecycle(raw) {
|
|
129
|
+
const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
|
|
130
|
+
const userSL = raw.sessionLifecycle ?? {};
|
|
131
|
+
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
132
|
+
}
|
|
133
|
+
function normalizeAutoUpdate(raw) {
|
|
134
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
135
|
+
const userAU = raw.autoUpdate ?? {};
|
|
136
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
137
|
+
}
|
|
138
|
+
async function loadConfig() {
|
|
139
|
+
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
140
|
+
await mkdir(dir, { recursive: true });
|
|
141
|
+
const configPath = path.join(dir, "config.json");
|
|
142
|
+
if (!existsSync(configPath)) {
|
|
143
|
+
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
144
|
+
}
|
|
145
|
+
const raw = await readFile(configPath, "utf-8");
|
|
146
|
+
try {
|
|
147
|
+
let parsed = JSON.parse(raw);
|
|
148
|
+
parsed = migrateLegacyConfig(parsed);
|
|
149
|
+
const { config: migratedCfg, migrated, fromVersion } = migrateConfig(parsed);
|
|
150
|
+
if (migrated) {
|
|
151
|
+
process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
|
|
152
|
+
`);
|
|
153
|
+
try {
|
|
154
|
+
await writeFile(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
155
|
+
} catch {
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
normalizeScalingRoadmap(migratedCfg);
|
|
159
|
+
normalizeSessionLifecycle(migratedCfg);
|
|
160
|
+
normalizeAutoUpdate(migratedCfg);
|
|
161
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
162
|
+
if (config.dbPath.startsWith("~")) {
|
|
163
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
164
|
+
}
|
|
165
|
+
return config;
|
|
166
|
+
} catch {
|
|
167
|
+
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
171
|
+
var init_config = __esm({
|
|
172
|
+
"src/lib/config.ts"() {
|
|
173
|
+
"use strict";
|
|
174
|
+
EXE_AI_DIR = resolveDataDir();
|
|
175
|
+
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
176
|
+
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
177
|
+
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
178
|
+
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
179
|
+
CURRENT_CONFIG_VERSION = 1;
|
|
180
|
+
DEFAULT_CONFIG = {
|
|
181
|
+
config_version: CURRENT_CONFIG_VERSION,
|
|
182
|
+
dbPath: DB_PATH,
|
|
183
|
+
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
184
|
+
embeddingDim: 1024,
|
|
185
|
+
batchSize: 20,
|
|
186
|
+
flushIntervalMs: 1e4,
|
|
187
|
+
autoIngestion: true,
|
|
188
|
+
autoRetrieval: true,
|
|
189
|
+
searchMode: "hybrid",
|
|
190
|
+
hookSearchMode: "hybrid",
|
|
191
|
+
fileGrepEnabled: true,
|
|
192
|
+
splashEffect: true,
|
|
193
|
+
consolidationEnabled: true,
|
|
194
|
+
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
195
|
+
consolidationModel: "claude-haiku-4-5-20251001",
|
|
196
|
+
consolidationMaxCallsPerRun: 20,
|
|
197
|
+
selfQueryRouter: true,
|
|
198
|
+
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
199
|
+
rerankerEnabled: true,
|
|
200
|
+
scalingRoadmap: {
|
|
201
|
+
rerankerAutoTrigger: {
|
|
202
|
+
enabled: true,
|
|
203
|
+
broadQueryMinCardinality: 5e4,
|
|
204
|
+
fetchTopK: 150,
|
|
205
|
+
returnTopK: 5
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
graphRagEnabled: true,
|
|
209
|
+
wikiEnabled: false,
|
|
210
|
+
wikiUrl: "",
|
|
211
|
+
wikiApiKey: "",
|
|
212
|
+
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
213
|
+
wikiWorkspaceMapping: {},
|
|
214
|
+
wikiAutoUpdate: true,
|
|
215
|
+
wikiAutoUpdateThreshold: 0.5,
|
|
216
|
+
wikiAutoUpdateCreateNew: true,
|
|
217
|
+
skillLearning: true,
|
|
218
|
+
skillThreshold: 3,
|
|
219
|
+
skillModel: "claude-haiku-4-5-20251001",
|
|
220
|
+
exeHeartbeat: {
|
|
221
|
+
enabled: true,
|
|
222
|
+
intervalSeconds: 60,
|
|
223
|
+
staleInProgressThresholdHours: 2
|
|
224
|
+
},
|
|
225
|
+
sessionLifecycle: {
|
|
226
|
+
idleKillEnabled: true,
|
|
227
|
+
idleKillTicksRequired: 3,
|
|
228
|
+
idleKillIntercomAckWindowMs: 1e4,
|
|
229
|
+
maxAutoInstances: 10
|
|
230
|
+
},
|
|
231
|
+
autoUpdate: {
|
|
232
|
+
checkOnBoot: true,
|
|
233
|
+
autoInstall: false,
|
|
234
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
CONFIG_MIGRATIONS = [
|
|
238
|
+
{
|
|
239
|
+
from: 0,
|
|
240
|
+
to: 1,
|
|
241
|
+
migrate: (cfg) => {
|
|
242
|
+
cfg.config_version = 1;
|
|
243
|
+
return cfg;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
];
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
// src/lib/employees.ts
|
|
251
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
252
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
253
|
+
import { execSync } from "child_process";
|
|
254
|
+
import path2 from "path";
|
|
255
|
+
import os2 from "os";
|
|
256
|
+
function normalizeRole(role) {
|
|
257
|
+
return (role ?? "").trim().toLowerCase();
|
|
258
|
+
}
|
|
259
|
+
function isCoordinatorRole(role) {
|
|
260
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
261
|
+
}
|
|
262
|
+
function getCoordinatorEmployee(employees) {
|
|
263
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
264
|
+
}
|
|
265
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
266
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
267
|
+
}
|
|
268
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
269
|
+
if (!existsSync2(employeesPath)) return [];
|
|
270
|
+
try {
|
|
271
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
272
|
+
} catch {
|
|
273
|
+
return [];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
277
|
+
var init_employees = __esm({
|
|
278
|
+
"src/lib/employees.ts"() {
|
|
279
|
+
"use strict";
|
|
280
|
+
init_config();
|
|
281
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
282
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
283
|
+
COORDINATOR_ROLE = "COO";
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
67
287
|
// src/lib/database.ts
|
|
68
288
|
import { createClient } from "@libsql/client";
|
|
69
289
|
async function initDatabase(config) {
|
|
@@ -197,22 +417,24 @@ async function ensureSchema() {
|
|
|
197
417
|
ON behaviors(agent_id, active);
|
|
198
418
|
`);
|
|
199
419
|
try {
|
|
420
|
+
const coordinatorName = getCoordinatorName();
|
|
200
421
|
const existing = await client.execute({
|
|
201
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
202
|
-
args: []
|
|
422
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
423
|
+
args: [coordinatorName]
|
|
203
424
|
});
|
|
204
425
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
426
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
427
|
+
for (const [domain, content] of [
|
|
428
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
429
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
430
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
431
|
+
]) {
|
|
432
|
+
await client.execute({
|
|
433
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
434
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
435
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
436
|
+
});
|
|
437
|
+
}
|
|
216
438
|
}
|
|
217
439
|
} catch {
|
|
218
440
|
}
|
|
@@ -904,204 +1126,49 @@ async function ensureSchema() {
|
|
|
904
1126
|
} catch {
|
|
905
1127
|
}
|
|
906
1128
|
}
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
_client = null;
|
|
914
|
-
_resilientClient = null;
|
|
915
|
-
initTurso = initDatabase;
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
|
|
919
|
-
// src/lib/config.ts
|
|
920
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, chmod as chmod2 } from "fs/promises";
|
|
921
|
-
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
922
|
-
import path2 from "path";
|
|
923
|
-
import os2 from "os";
|
|
924
|
-
function resolveDataDir() {
|
|
925
|
-
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
926
|
-
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
927
|
-
const newDir = path2.join(os2.homedir(), ".exe-os");
|
|
928
|
-
const legacyDir = path2.join(os2.homedir(), ".exe-mem");
|
|
929
|
-
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
930
|
-
try {
|
|
931
|
-
renameSync(legacyDir, newDir);
|
|
932
|
-
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
933
|
-
`);
|
|
934
|
-
} catch {
|
|
935
|
-
return legacyDir;
|
|
936
|
-
}
|
|
1129
|
+
try {
|
|
1130
|
+
await client.execute({
|
|
1131
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1132
|
+
args: []
|
|
1133
|
+
});
|
|
1134
|
+
} catch {
|
|
937
1135
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
if ("r2" in raw) {
|
|
942
|
-
process.stderr.write(
|
|
943
|
-
"[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"
|
|
1136
|
+
try {
|
|
1137
|
+
await client.execute(
|
|
1138
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
944
1139
|
);
|
|
945
|
-
|
|
946
|
-
}
|
|
947
|
-
if ("syncIntervalMs" in raw) {
|
|
948
|
-
delete raw.syncIntervalMs;
|
|
949
|
-
}
|
|
950
|
-
return raw;
|
|
951
|
-
}
|
|
952
|
-
function migrateConfig(raw) {
|
|
953
|
-
const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
|
|
954
|
-
let currentVersion = fromVersion;
|
|
955
|
-
let migrated = false;
|
|
956
|
-
if (currentVersion > CURRENT_CONFIG_VERSION) {
|
|
957
|
-
return { config: raw, migrated: false, fromVersion };
|
|
958
|
-
}
|
|
959
|
-
for (const migration of CONFIG_MIGRATIONS) {
|
|
960
|
-
if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
|
|
961
|
-
raw = migration.migrate(raw);
|
|
962
|
-
currentVersion = migration.to;
|
|
963
|
-
migrated = true;
|
|
964
|
-
}
|
|
1140
|
+
} catch {
|
|
965
1141
|
}
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
|
|
973
|
-
userAuto.enabled = raw.rerankerEnabled;
|
|
1142
|
+
try {
|
|
1143
|
+
await client.execute({
|
|
1144
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1145
|
+
args: []
|
|
1146
|
+
});
|
|
1147
|
+
} catch {
|
|
974
1148
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
980
|
-
function normalizeSessionLifecycle(raw) {
|
|
981
|
-
const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
|
|
982
|
-
const userSL = raw.sessionLifecycle ?? {};
|
|
983
|
-
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
984
|
-
}
|
|
985
|
-
function normalizeAutoUpdate(raw) {
|
|
986
|
-
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
987
|
-
const userAU = raw.autoUpdate ?? {};
|
|
988
|
-
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
989
|
-
}
|
|
990
|
-
async function loadConfig() {
|
|
991
|
-
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
992
|
-
await mkdir2(dir, { recursive: true });
|
|
993
|
-
const configPath = path2.join(dir, "config.json");
|
|
994
|
-
if (!existsSync2(configPath)) {
|
|
995
|
-
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
1149
|
+
try {
|
|
1150
|
+
await client.execute(
|
|
1151
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1152
|
+
);
|
|
1153
|
+
} catch {
|
|
996
1154
|
}
|
|
997
|
-
const raw = await readFile2(configPath, "utf-8");
|
|
998
1155
|
try {
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
|
|
1004
|
-
`);
|
|
1005
|
-
try {
|
|
1006
|
-
await writeFile2(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
1007
|
-
} catch {
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1010
|
-
normalizeScalingRoadmap(migratedCfg);
|
|
1011
|
-
normalizeSessionLifecycle(migratedCfg);
|
|
1012
|
-
normalizeAutoUpdate(migratedCfg);
|
|
1013
|
-
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
1014
|
-
if (config.dbPath.startsWith("~")) {
|
|
1015
|
-
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
1016
|
-
}
|
|
1017
|
-
return config;
|
|
1156
|
+
await client.execute({
|
|
1157
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1158
|
+
args: []
|
|
1159
|
+
});
|
|
1018
1160
|
} catch {
|
|
1019
|
-
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
1020
1161
|
}
|
|
1021
1162
|
}
|
|
1022
|
-
var
|
|
1023
|
-
var
|
|
1024
|
-
"src/lib/
|
|
1163
|
+
var _client, _resilientClient, initTurso;
|
|
1164
|
+
var init_database = __esm({
|
|
1165
|
+
"src/lib/database.ts"() {
|
|
1025
1166
|
"use strict";
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
CURRENT_CONFIG_VERSION = 1;
|
|
1032
|
-
DEFAULT_CONFIG = {
|
|
1033
|
-
config_version: CURRENT_CONFIG_VERSION,
|
|
1034
|
-
dbPath: DB_PATH,
|
|
1035
|
-
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
1036
|
-
embeddingDim: 1024,
|
|
1037
|
-
batchSize: 20,
|
|
1038
|
-
flushIntervalMs: 1e4,
|
|
1039
|
-
autoIngestion: true,
|
|
1040
|
-
autoRetrieval: true,
|
|
1041
|
-
searchMode: "hybrid",
|
|
1042
|
-
hookSearchMode: "hybrid",
|
|
1043
|
-
fileGrepEnabled: true,
|
|
1044
|
-
splashEffect: true,
|
|
1045
|
-
consolidationEnabled: true,
|
|
1046
|
-
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
1047
|
-
consolidationModel: "claude-haiku-4-5-20251001",
|
|
1048
|
-
consolidationMaxCallsPerRun: 20,
|
|
1049
|
-
selfQueryRouter: true,
|
|
1050
|
-
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
1051
|
-
rerankerEnabled: true,
|
|
1052
|
-
scalingRoadmap: {
|
|
1053
|
-
rerankerAutoTrigger: {
|
|
1054
|
-
enabled: true,
|
|
1055
|
-
broadQueryMinCardinality: 5e4,
|
|
1056
|
-
fetchTopK: 150,
|
|
1057
|
-
returnTopK: 5
|
|
1058
|
-
}
|
|
1059
|
-
},
|
|
1060
|
-
graphRagEnabled: true,
|
|
1061
|
-
wikiEnabled: false,
|
|
1062
|
-
wikiUrl: "",
|
|
1063
|
-
wikiApiKey: "",
|
|
1064
|
-
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
1065
|
-
wikiWorkspaceMapping: {
|
|
1066
|
-
exe: "Executive",
|
|
1067
|
-
yoshi: "Engineering",
|
|
1068
|
-
mari: "Marketing",
|
|
1069
|
-
tom: "Engineering",
|
|
1070
|
-
sasha: "Production"
|
|
1071
|
-
},
|
|
1072
|
-
wikiAutoUpdate: true,
|
|
1073
|
-
wikiAutoUpdateThreshold: 0.5,
|
|
1074
|
-
wikiAutoUpdateCreateNew: true,
|
|
1075
|
-
skillLearning: true,
|
|
1076
|
-
skillThreshold: 3,
|
|
1077
|
-
skillModel: "claude-haiku-4-5-20251001",
|
|
1078
|
-
exeHeartbeat: {
|
|
1079
|
-
enabled: true,
|
|
1080
|
-
intervalSeconds: 60,
|
|
1081
|
-
staleInProgressThresholdHours: 2
|
|
1082
|
-
},
|
|
1083
|
-
sessionLifecycle: {
|
|
1084
|
-
idleKillEnabled: true,
|
|
1085
|
-
idleKillTicksRequired: 3,
|
|
1086
|
-
idleKillIntercomAckWindowMs: 1e4,
|
|
1087
|
-
maxAutoInstances: 10
|
|
1088
|
-
},
|
|
1089
|
-
autoUpdate: {
|
|
1090
|
-
checkOnBoot: true,
|
|
1091
|
-
autoInstall: false,
|
|
1092
|
-
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
CONFIG_MIGRATIONS = [
|
|
1096
|
-
{
|
|
1097
|
-
from: 0,
|
|
1098
|
-
to: 1,
|
|
1099
|
-
migrate: (cfg) => {
|
|
1100
|
-
cfg.config_version = 1;
|
|
1101
|
-
return cfg;
|
|
1102
|
-
}
|
|
1103
|
-
}
|
|
1104
|
-
];
|
|
1167
|
+
init_db_retry();
|
|
1168
|
+
init_employees();
|
|
1169
|
+
_client = null;
|
|
1170
|
+
_resilientClient = null;
|
|
1171
|
+
initTurso = initDatabase;
|
|
1105
1172
|
}
|
|
1106
1173
|
});
|
|
1107
1174
|
|
|
@@ -1173,12 +1240,12 @@ __export(shard_manager_exports, {
|
|
|
1173
1240
|
listShards: () => listShards,
|
|
1174
1241
|
shardExists: () => shardExists
|
|
1175
1242
|
});
|
|
1176
|
-
import
|
|
1177
|
-
import { existsSync as
|
|
1243
|
+
import path4 from "path";
|
|
1244
|
+
import { existsSync as existsSync4, mkdirSync, readdirSync } from "fs";
|
|
1178
1245
|
import { createClient as createClient2 } from "@libsql/client";
|
|
1179
1246
|
function initShardManager(encryptionKey) {
|
|
1180
1247
|
_encryptionKey = encryptionKey;
|
|
1181
|
-
if (!
|
|
1248
|
+
if (!existsSync4(SHARDS_DIR)) {
|
|
1182
1249
|
mkdirSync(SHARDS_DIR, { recursive: true });
|
|
1183
1250
|
}
|
|
1184
1251
|
_shardingEnabled = true;
|
|
@@ -1199,7 +1266,7 @@ function getShardClient(projectName) {
|
|
|
1199
1266
|
}
|
|
1200
1267
|
const cached = _shards.get(safeName);
|
|
1201
1268
|
if (cached) return cached;
|
|
1202
|
-
const dbPath =
|
|
1269
|
+
const dbPath = path4.join(SHARDS_DIR, `${safeName}.db`);
|
|
1203
1270
|
const client = createClient2({
|
|
1204
1271
|
url: `file:${dbPath}`,
|
|
1205
1272
|
encryptionKey: _encryptionKey
|
|
@@ -1209,10 +1276,10 @@ function getShardClient(projectName) {
|
|
|
1209
1276
|
}
|
|
1210
1277
|
function shardExists(projectName) {
|
|
1211
1278
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1212
|
-
return
|
|
1279
|
+
return existsSync4(path4.join(SHARDS_DIR, `${safeName}.db`));
|
|
1213
1280
|
}
|
|
1214
1281
|
function listShards() {
|
|
1215
|
-
if (!
|
|
1282
|
+
if (!existsSync4(SHARDS_DIR)) return [];
|
|
1216
1283
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
1217
1284
|
}
|
|
1218
1285
|
async function ensureShardSchema(client) {
|
|
@@ -1282,7 +1349,11 @@ async function ensureShardSchema(client) {
|
|
|
1282
1349
|
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1283
1350
|
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1284
1351
|
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1285
|
-
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1352
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
|
|
1353
|
+
// MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
|
|
1354
|
+
"ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
|
|
1355
|
+
"ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
|
|
1356
|
+
"ALTER TABLE memories ADD COLUMN trajectory TEXT"
|
|
1286
1357
|
]) {
|
|
1287
1358
|
try {
|
|
1288
1359
|
await client.execute(col);
|
|
@@ -1394,7 +1465,7 @@ var init_shard_manager = __esm({
|
|
|
1394
1465
|
"src/lib/shard-manager.ts"() {
|
|
1395
1466
|
"use strict";
|
|
1396
1467
|
init_config();
|
|
1397
|
-
SHARDS_DIR =
|
|
1468
|
+
SHARDS_DIR = path4.join(EXE_AI_DIR, "shards");
|
|
1398
1469
|
_shards = /* @__PURE__ */ new Map();
|
|
1399
1470
|
_encryptionKey = null;
|
|
1400
1471
|
_shardingEnabled = false;
|
|
@@ -1412,26 +1483,26 @@ var init_platform_procedures = __esm({
|
|
|
1412
1483
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1413
1484
|
domain: "architecture",
|
|
1414
1485
|
priority: "p0",
|
|
1415
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1486
|
+
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."
|
|
1416
1487
|
},
|
|
1417
1488
|
{
|
|
1418
1489
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1419
1490
|
domain: "architecture",
|
|
1420
1491
|
priority: "p0",
|
|
1421
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1492
|
+
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."
|
|
1422
1493
|
},
|
|
1423
1494
|
{
|
|
1424
|
-
title: "Sessions explained \u2014
|
|
1495
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1425
1496
|
domain: "architecture",
|
|
1426
1497
|
priority: "p0",
|
|
1427
|
-
content: "Each
|
|
1498
|
+
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."
|
|
1428
1499
|
},
|
|
1429
1500
|
// --- Hierarchy and dispatch ---
|
|
1430
1501
|
{
|
|
1431
1502
|
title: "Chain of command \u2014 who talks to whom",
|
|
1432
1503
|
domain: "workflow",
|
|
1433
1504
|
priority: "p0",
|
|
1434
|
-
content: "Founder
|
|
1505
|
+
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."
|
|
1435
1506
|
},
|
|
1436
1507
|
{
|
|
1437
1508
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1441,30 +1512,30 @@ var init_platform_procedures = __esm({
|
|
|
1441
1512
|
},
|
|
1442
1513
|
// --- Session isolation ---
|
|
1443
1514
|
{
|
|
1444
|
-
title: "Session scoping \u2014 stay in your
|
|
1515
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1445
1516
|
domain: "security",
|
|
1446
1517
|
priority: "p0",
|
|
1447
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1518
|
+
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."
|
|
1448
1519
|
},
|
|
1449
1520
|
{
|
|
1450
1521
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1451
1522
|
domain: "workflow",
|
|
1452
1523
|
priority: "p0",
|
|
1453
|
-
content:
|
|
1524
|
+
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."
|
|
1454
1525
|
},
|
|
1455
1526
|
// --- Engineering: session scoping in code ---
|
|
1456
1527
|
{
|
|
1457
1528
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1458
1529
|
domain: "architecture",
|
|
1459
1530
|
priority: "p0",
|
|
1460
|
-
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
|
|
1531
|
+
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."
|
|
1461
1532
|
},
|
|
1462
1533
|
// --- Hard constraints ---
|
|
1463
1534
|
{
|
|
1464
1535
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1465
1536
|
domain: "security",
|
|
1466
1537
|
priority: "p0",
|
|
1467
|
-
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
|
|
1538
|
+
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."
|
|
1468
1539
|
},
|
|
1469
1540
|
// --- Operations ---
|
|
1470
1541
|
{
|
|
@@ -1582,21 +1653,6 @@ ${p.content}`).join("\n\n");
|
|
|
1582
1653
|
}
|
|
1583
1654
|
});
|
|
1584
1655
|
|
|
1585
|
-
// src/lib/employees.ts
|
|
1586
|
-
import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
|
|
1587
|
-
import { existsSync as existsSync4, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
1588
|
-
import { execSync } from "child_process";
|
|
1589
|
-
import path4 from "path";
|
|
1590
|
-
import os3 from "os";
|
|
1591
|
-
var EMPLOYEES_PATH;
|
|
1592
|
-
var init_employees = __esm({
|
|
1593
|
-
"src/lib/employees.ts"() {
|
|
1594
|
-
"use strict";
|
|
1595
|
-
init_config();
|
|
1596
|
-
EMPLOYEES_PATH = path4.join(EXE_AI_DIR, "exe-employees.json");
|
|
1597
|
-
}
|
|
1598
|
-
});
|
|
1599
|
-
|
|
1600
1656
|
// src/lib/notifications.ts
|
|
1601
1657
|
import crypto from "crypto";
|
|
1602
1658
|
import path5 from "path";
|
|
@@ -1719,6 +1775,17 @@ var init_plan_limits = __esm({
|
|
|
1719
1775
|
import path10 from "path";
|
|
1720
1776
|
import os7 from "os";
|
|
1721
1777
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1778
|
+
function extractRootExe(name) {
|
|
1779
|
+
if (!name) return null;
|
|
1780
|
+
if (!name.includes("-")) return name;
|
|
1781
|
+
const parts = name.split("-").filter(Boolean);
|
|
1782
|
+
return parts.length > 0 ? parts[parts.length - 1] : null;
|
|
1783
|
+
}
|
|
1784
|
+
function isExeSession(sessionName) {
|
|
1785
|
+
const matchesBaseWithInstance = (baseName) => sessionName === baseName || sessionName.startsWith(baseName) && /^\d+$/.test(sessionName.slice(baseName.length));
|
|
1786
|
+
const coordinatorName = getCoordinatorName();
|
|
1787
|
+
return matchesBaseWithInstance(coordinatorName) || matchesBaseWithInstance("exe");
|
|
1788
|
+
}
|
|
1722
1789
|
var SPAWN_LOCK_DIR, SESSION_CACHE, INTERCOM_LOG2, DEBOUNCE_FILE, DEBOUNCE_CLEANUP_AGE_MS;
|
|
1723
1790
|
var init_tmux_routing = __esm({
|
|
1724
1791
|
"src/lib/tmux-routing.ts"() {
|
|
@@ -1731,6 +1798,7 @@ var init_tmux_routing = __esm({
|
|
|
1731
1798
|
init_provider_table();
|
|
1732
1799
|
init_intercom_queue();
|
|
1733
1800
|
init_plan_limits();
|
|
1801
|
+
init_employees();
|
|
1734
1802
|
SPAWN_LOCK_DIR = path10.join(os7.homedir(), ".exe-os", "spawn-locks");
|
|
1735
1803
|
SESSION_CACHE = path10.join(os7.homedir(), ".exe-os", "session-cache");
|
|
1736
1804
|
INTERCOM_LOG2 = path10.join(os7.homedir(), ".exe-os", "intercom.log");
|
|
@@ -1814,17 +1882,17 @@ var init_tasks_review = __esm({
|
|
|
1814
1882
|
init_database();
|
|
1815
1883
|
|
|
1816
1884
|
// src/lib/keychain.ts
|
|
1817
|
-
import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
1818
|
-
import { existsSync } from "fs";
|
|
1819
|
-
import
|
|
1820
|
-
import
|
|
1885
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
1886
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1887
|
+
import path3 from "path";
|
|
1888
|
+
import os3 from "os";
|
|
1821
1889
|
var SERVICE = "exe-mem";
|
|
1822
1890
|
var ACCOUNT = "master-key";
|
|
1823
1891
|
function getKeyDir() {
|
|
1824
|
-
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ??
|
|
1892
|
+
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path3.join(os3.homedir(), ".exe-os");
|
|
1825
1893
|
}
|
|
1826
1894
|
function getKeyPath() {
|
|
1827
|
-
return
|
|
1895
|
+
return path3.join(getKeyDir(), "master.key");
|
|
1828
1896
|
}
|
|
1829
1897
|
async function tryKeytar() {
|
|
1830
1898
|
try {
|
|
@@ -1845,11 +1913,11 @@ async function getMasterKey() {
|
|
|
1845
1913
|
}
|
|
1846
1914
|
}
|
|
1847
1915
|
const keyPath = getKeyPath();
|
|
1848
|
-
if (!
|
|
1916
|
+
if (!existsSync3(keyPath)) {
|
|
1849
1917
|
return null;
|
|
1850
1918
|
}
|
|
1851
1919
|
try {
|
|
1852
|
-
const content = await
|
|
1920
|
+
const content = await readFile3(keyPath, "utf-8");
|
|
1853
1921
|
return Buffer.from(content.trim(), "base64");
|
|
1854
1922
|
} catch {
|
|
1855
1923
|
return null;
|
|
@@ -1952,16 +2020,17 @@ function isMainModule(importMetaUrl) {
|
|
|
1952
2020
|
|
|
1953
2021
|
// src/bin/exe-pending-reviews.ts
|
|
1954
2022
|
init_tasks_review();
|
|
2023
|
+
init_tmux_routing();
|
|
1955
2024
|
var PENDING_REVIEW_LIMIT = 10;
|
|
1956
2025
|
async function main() {
|
|
1957
2026
|
await initStore();
|
|
1958
2027
|
await cleanupOrphanedReviews();
|
|
1959
|
-
let sessionScope = process.env.EXE_SESSION
|
|
2028
|
+
let sessionScope = process.env.EXE_SESSION ? extractRootExe(process.env.EXE_SESSION) ?? void 0 : void 0;
|
|
1960
2029
|
if (!sessionScope) {
|
|
1961
2030
|
try {
|
|
1962
2031
|
const { execSync: execSync4 } = await import("child_process");
|
|
1963
2032
|
const tmuxSession = execSync4("tmux display-message -p '#{session_name}'", { encoding: "utf8", timeout: 2e3 }).trim();
|
|
1964
|
-
if (
|
|
2033
|
+
if (isExeSession(tmuxSession)) sessionScope = tmuxSession;
|
|
1965
2034
|
} catch {
|
|
1966
2035
|
}
|
|
1967
2036
|
}
|