@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
|
@@ -59,7 +59,7 @@ function wrapWithRetry(client) {
|
|
|
59
59
|
return (sql) => retryOnBusy(() => target.execute(sql), "execute");
|
|
60
60
|
}
|
|
61
61
|
if (prop === "batch") {
|
|
62
|
-
return (stmts) => retryOnBusy(() => target.batch(stmts), "batch");
|
|
62
|
+
return (stmts, mode) => retryOnBusy(() => target.batch(stmts, mode), "batch");
|
|
63
63
|
}
|
|
64
64
|
return Reflect.get(target, prop, receiver);
|
|
65
65
|
}
|
|
@@ -75,6 +75,226 @@ var init_db_retry = __esm({
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
|
|
78
|
+
// src/lib/config.ts
|
|
79
|
+
import { readFile, writeFile, mkdir, chmod } from "fs/promises";
|
|
80
|
+
import { readFileSync, existsSync, renameSync } from "fs";
|
|
81
|
+
import path from "path";
|
|
82
|
+
import os from "os";
|
|
83
|
+
function resolveDataDir() {
|
|
84
|
+
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
85
|
+
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
86
|
+
const newDir = path.join(os.homedir(), ".exe-os");
|
|
87
|
+
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
88
|
+
if (!existsSync(newDir) && existsSync(legacyDir)) {
|
|
89
|
+
try {
|
|
90
|
+
renameSync(legacyDir, newDir);
|
|
91
|
+
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
92
|
+
`);
|
|
93
|
+
} catch {
|
|
94
|
+
return legacyDir;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return newDir;
|
|
98
|
+
}
|
|
99
|
+
function migrateLegacyConfig(raw) {
|
|
100
|
+
if ("r2" in raw) {
|
|
101
|
+
process.stderr.write(
|
|
102
|
+
"[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"
|
|
103
|
+
);
|
|
104
|
+
delete raw.r2;
|
|
105
|
+
}
|
|
106
|
+
if ("syncIntervalMs" in raw) {
|
|
107
|
+
delete raw.syncIntervalMs;
|
|
108
|
+
}
|
|
109
|
+
return raw;
|
|
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
|
+
function normalizeAutoUpdate(raw) {
|
|
145
|
+
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
146
|
+
const userAU = raw.autoUpdate ?? {};
|
|
147
|
+
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
148
|
+
}
|
|
149
|
+
async function loadConfig() {
|
|
150
|
+
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
151
|
+
await mkdir(dir, { recursive: true });
|
|
152
|
+
const configPath = path.join(dir, "config.json");
|
|
153
|
+
if (!existsSync(configPath)) {
|
|
154
|
+
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
155
|
+
}
|
|
156
|
+
const raw = await readFile(configPath, "utf-8");
|
|
157
|
+
try {
|
|
158
|
+
let parsed = JSON.parse(raw);
|
|
159
|
+
parsed = migrateLegacyConfig(parsed);
|
|
160
|
+
const { config: migratedCfg, migrated, fromVersion } = migrateConfig(parsed);
|
|
161
|
+
if (migrated) {
|
|
162
|
+
process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
|
|
163
|
+
`);
|
|
164
|
+
try {
|
|
165
|
+
await writeFile(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
166
|
+
} catch {
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
normalizeScalingRoadmap(migratedCfg);
|
|
170
|
+
normalizeSessionLifecycle(migratedCfg);
|
|
171
|
+
normalizeAutoUpdate(migratedCfg);
|
|
172
|
+
const config = { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db"), ...migratedCfg };
|
|
173
|
+
if (config.dbPath.startsWith("~")) {
|
|
174
|
+
config.dbPath = config.dbPath.replace(/^~/, os.homedir());
|
|
175
|
+
}
|
|
176
|
+
return config;
|
|
177
|
+
} catch {
|
|
178
|
+
return { ...DEFAULT_CONFIG, dbPath: path.join(dir, "memories.db") };
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG, CONFIG_MIGRATIONS;
|
|
182
|
+
var init_config = __esm({
|
|
183
|
+
"src/lib/config.ts"() {
|
|
184
|
+
"use strict";
|
|
185
|
+
EXE_AI_DIR = resolveDataDir();
|
|
186
|
+
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
187
|
+
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
188
|
+
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
189
|
+
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
190
|
+
CURRENT_CONFIG_VERSION = 1;
|
|
191
|
+
DEFAULT_CONFIG = {
|
|
192
|
+
config_version: CURRENT_CONFIG_VERSION,
|
|
193
|
+
dbPath: DB_PATH,
|
|
194
|
+
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
195
|
+
embeddingDim: 1024,
|
|
196
|
+
batchSize: 20,
|
|
197
|
+
flushIntervalMs: 1e4,
|
|
198
|
+
autoIngestion: true,
|
|
199
|
+
autoRetrieval: true,
|
|
200
|
+
searchMode: "hybrid",
|
|
201
|
+
hookSearchMode: "hybrid",
|
|
202
|
+
fileGrepEnabled: true,
|
|
203
|
+
splashEffect: true,
|
|
204
|
+
consolidationEnabled: true,
|
|
205
|
+
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
206
|
+
consolidationModel: "claude-haiku-4-5-20251001",
|
|
207
|
+
consolidationMaxCallsPerRun: 20,
|
|
208
|
+
selfQueryRouter: true,
|
|
209
|
+
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
210
|
+
rerankerEnabled: true,
|
|
211
|
+
scalingRoadmap: {
|
|
212
|
+
rerankerAutoTrigger: {
|
|
213
|
+
enabled: true,
|
|
214
|
+
broadQueryMinCardinality: 5e4,
|
|
215
|
+
fetchTopK: 150,
|
|
216
|
+
returnTopK: 5
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
graphRagEnabled: true,
|
|
220
|
+
wikiEnabled: false,
|
|
221
|
+
wikiUrl: "",
|
|
222
|
+
wikiApiKey: "",
|
|
223
|
+
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
224
|
+
wikiWorkspaceMapping: {},
|
|
225
|
+
wikiAutoUpdate: true,
|
|
226
|
+
wikiAutoUpdateThreshold: 0.5,
|
|
227
|
+
wikiAutoUpdateCreateNew: true,
|
|
228
|
+
skillLearning: true,
|
|
229
|
+
skillThreshold: 3,
|
|
230
|
+
skillModel: "claude-haiku-4-5-20251001",
|
|
231
|
+
exeHeartbeat: {
|
|
232
|
+
enabled: true,
|
|
233
|
+
intervalSeconds: 60,
|
|
234
|
+
staleInProgressThresholdHours: 2
|
|
235
|
+
},
|
|
236
|
+
sessionLifecycle: {
|
|
237
|
+
idleKillEnabled: true,
|
|
238
|
+
idleKillTicksRequired: 3,
|
|
239
|
+
idleKillIntercomAckWindowMs: 1e4,
|
|
240
|
+
maxAutoInstances: 10
|
|
241
|
+
},
|
|
242
|
+
autoUpdate: {
|
|
243
|
+
checkOnBoot: true,
|
|
244
|
+
autoInstall: false,
|
|
245
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
CONFIG_MIGRATIONS = [
|
|
249
|
+
{
|
|
250
|
+
from: 0,
|
|
251
|
+
to: 1,
|
|
252
|
+
migrate: (cfg) => {
|
|
253
|
+
cfg.config_version = 1;
|
|
254
|
+
return cfg;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
];
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
// src/lib/employees.ts
|
|
262
|
+
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
263
|
+
import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
264
|
+
import { execSync } from "child_process";
|
|
265
|
+
import path2 from "path";
|
|
266
|
+
import os2 from "os";
|
|
267
|
+
function normalizeRole(role) {
|
|
268
|
+
return (role ?? "").trim().toLowerCase();
|
|
269
|
+
}
|
|
270
|
+
function isCoordinatorRole(role) {
|
|
271
|
+
return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
|
|
272
|
+
}
|
|
273
|
+
function getCoordinatorEmployee(employees) {
|
|
274
|
+
return employees.find((e) => isCoordinatorRole(e.role));
|
|
275
|
+
}
|
|
276
|
+
function getCoordinatorName(employees = loadEmployeesSync()) {
|
|
277
|
+
return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
|
|
278
|
+
}
|
|
279
|
+
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
280
|
+
if (!existsSync2(employeesPath)) return [];
|
|
281
|
+
try {
|
|
282
|
+
return JSON.parse(readFileSync2(employeesPath, "utf-8"));
|
|
283
|
+
} catch {
|
|
284
|
+
return [];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE;
|
|
288
|
+
var init_employees = __esm({
|
|
289
|
+
"src/lib/employees.ts"() {
|
|
290
|
+
"use strict";
|
|
291
|
+
init_config();
|
|
292
|
+
EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
293
|
+
DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
|
|
294
|
+
COORDINATOR_ROLE = "COO";
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
|
|
78
298
|
// src/lib/database.ts
|
|
79
299
|
import { createClient } from "@libsql/client";
|
|
80
300
|
async function initDatabase(config) {
|
|
@@ -208,22 +428,24 @@ async function ensureSchema() {
|
|
|
208
428
|
ON behaviors(agent_id, active);
|
|
209
429
|
`);
|
|
210
430
|
try {
|
|
431
|
+
const coordinatorName = getCoordinatorName();
|
|
211
432
|
const existing = await client.execute({
|
|
212
|
-
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id =
|
|
213
|
-
args: []
|
|
433
|
+
sql: "SELECT COUNT(*) as cnt FROM behaviors WHERE agent_id = ?",
|
|
434
|
+
args: [coordinatorName]
|
|
214
435
|
});
|
|
215
436
|
if (Number(existing.rows[0]?.cnt) === 0) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
437
|
+
const seededAt = "2026-03-25T00:00:00Z";
|
|
438
|
+
for (const [domain, content] of [
|
|
439
|
+
["workflow", `Don't ask "keep going?" \u2014 just keep executing phases/plans autonomously`],
|
|
440
|
+
["tool-use", "Always use create_task MCP tool, never write .md files directly for task creation"],
|
|
441
|
+
["workflow", "Auto-start reviewing when idle and reviews are pending \u2014 never ask founder for permission"]
|
|
442
|
+
]) {
|
|
443
|
+
await client.execute({
|
|
444
|
+
sql: `INSERT INTO behaviors (id, agent_id, project_name, domain, content, active, created_at, updated_at)
|
|
445
|
+
VALUES (hex(randomblob(16)), ?, NULL, ?, ?, 1, ?, ?)`,
|
|
446
|
+
args: [coordinatorName, domain, content, seededAt, seededAt]
|
|
447
|
+
});
|
|
448
|
+
}
|
|
227
449
|
}
|
|
228
450
|
} catch {
|
|
229
451
|
}
|
|
@@ -915,204 +1137,49 @@ async function ensureSchema() {
|
|
|
915
1137
|
} catch {
|
|
916
1138
|
}
|
|
917
1139
|
}
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
_client = null;
|
|
925
|
-
_resilientClient = null;
|
|
926
|
-
initTurso = initDatabase;
|
|
927
|
-
}
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
// src/lib/config.ts
|
|
931
|
-
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, chmod as chmod2 } from "fs/promises";
|
|
932
|
-
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
933
|
-
import path2 from "path";
|
|
934
|
-
import os2 from "os";
|
|
935
|
-
function resolveDataDir() {
|
|
936
|
-
if (process.env.EXE_OS_DIR) return process.env.EXE_OS_DIR;
|
|
937
|
-
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
938
|
-
const newDir = path2.join(os2.homedir(), ".exe-os");
|
|
939
|
-
const legacyDir = path2.join(os2.homedir(), ".exe-mem");
|
|
940
|
-
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
941
|
-
try {
|
|
942
|
-
renameSync(legacyDir, newDir);
|
|
943
|
-
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
944
|
-
`);
|
|
945
|
-
} catch {
|
|
946
|
-
return legacyDir;
|
|
947
|
-
}
|
|
1140
|
+
try {
|
|
1141
|
+
await client.execute({
|
|
1142
|
+
sql: `ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0`,
|
|
1143
|
+
args: []
|
|
1144
|
+
});
|
|
1145
|
+
} catch {
|
|
948
1146
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
if ("r2" in raw) {
|
|
953
|
-
process.stderr.write(
|
|
954
|
-
"[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"
|
|
1147
|
+
try {
|
|
1148
|
+
await client.execute(
|
|
1149
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_draft ON memories(draft) WHERE draft = 1`
|
|
955
1150
|
);
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
if ("syncIntervalMs" in raw) {
|
|
959
|
-
delete raw.syncIntervalMs;
|
|
960
|
-
}
|
|
961
|
-
return raw;
|
|
962
|
-
}
|
|
963
|
-
function migrateConfig(raw) {
|
|
964
|
-
const fromVersion = typeof raw.config_version === "number" ? raw.config_version : 0;
|
|
965
|
-
let currentVersion = fromVersion;
|
|
966
|
-
let migrated = false;
|
|
967
|
-
if (currentVersion > CURRENT_CONFIG_VERSION) {
|
|
968
|
-
return { config: raw, migrated: false, fromVersion };
|
|
969
|
-
}
|
|
970
|
-
for (const migration of CONFIG_MIGRATIONS) {
|
|
971
|
-
if (currentVersion === migration.from && migration.to <= CURRENT_CONFIG_VERSION) {
|
|
972
|
-
raw = migration.migrate(raw);
|
|
973
|
-
currentVersion = migration.to;
|
|
974
|
-
migrated = true;
|
|
975
|
-
}
|
|
1151
|
+
} catch {
|
|
976
1152
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
if (userAuto.enabled === void 0 && raw.rerankerEnabled !== void 0) {
|
|
984
|
-
userAuto.enabled = raw.rerankerEnabled;
|
|
1153
|
+
try {
|
|
1154
|
+
await client.execute({
|
|
1155
|
+
sql: `ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'`,
|
|
1156
|
+
args: []
|
|
1157
|
+
});
|
|
1158
|
+
} catch {
|
|
985
1159
|
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
}
|
|
991
|
-
function normalizeSessionLifecycle(raw) {
|
|
992
|
-
const defaultSL = DEFAULT_CONFIG.sessionLifecycle;
|
|
993
|
-
const userSL = raw.sessionLifecycle ?? {};
|
|
994
|
-
raw.sessionLifecycle = { ...defaultSL, ...userSL };
|
|
995
|
-
}
|
|
996
|
-
function normalizeAutoUpdate(raw) {
|
|
997
|
-
const defaultAU = DEFAULT_CONFIG.autoUpdate;
|
|
998
|
-
const userAU = raw.autoUpdate ?? {};
|
|
999
|
-
raw.autoUpdate = { ...defaultAU, ...userAU };
|
|
1000
|
-
}
|
|
1001
|
-
async function loadConfig() {
|
|
1002
|
-
const dir = process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? EXE_AI_DIR;
|
|
1003
|
-
await mkdir2(dir, { recursive: true });
|
|
1004
|
-
const configPath = path2.join(dir, "config.json");
|
|
1005
|
-
if (!existsSync2(configPath)) {
|
|
1006
|
-
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
1160
|
+
try {
|
|
1161
|
+
await client.execute(
|
|
1162
|
+
`CREATE INDEX IF NOT EXISTS idx_memories_type ON memories(memory_type)`
|
|
1163
|
+
);
|
|
1164
|
+
} catch {
|
|
1007
1165
|
}
|
|
1008
|
-
const raw = await readFile2(configPath, "utf-8");
|
|
1009
1166
|
try {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
process.stderr.write(`[exe-os] Config migrated from v${fromVersion} to v${migratedCfg.config_version}
|
|
1015
|
-
`);
|
|
1016
|
-
try {
|
|
1017
|
-
await writeFile2(configPath, JSON.stringify(migratedCfg, null, 2) + "\n");
|
|
1018
|
-
} catch {
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
normalizeScalingRoadmap(migratedCfg);
|
|
1022
|
-
normalizeSessionLifecycle(migratedCfg);
|
|
1023
|
-
normalizeAutoUpdate(migratedCfg);
|
|
1024
|
-
const config = { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db"), ...migratedCfg };
|
|
1025
|
-
if (config.dbPath.startsWith("~")) {
|
|
1026
|
-
config.dbPath = config.dbPath.replace(/^~/, os2.homedir());
|
|
1027
|
-
}
|
|
1028
|
-
return config;
|
|
1167
|
+
await client.execute({
|
|
1168
|
+
sql: `ALTER TABLE memories ADD COLUMN trajectory TEXT`,
|
|
1169
|
+
args: []
|
|
1170
|
+
});
|
|
1029
1171
|
} catch {
|
|
1030
|
-
return { ...DEFAULT_CONFIG, dbPath: path2.join(dir, "memories.db") };
|
|
1031
1172
|
}
|
|
1032
1173
|
}
|
|
1033
|
-
var
|
|
1034
|
-
var
|
|
1035
|
-
"src/lib/
|
|
1174
|
+
var _client, _resilientClient, initTurso;
|
|
1175
|
+
var init_database = __esm({
|
|
1176
|
+
"src/lib/database.ts"() {
|
|
1036
1177
|
"use strict";
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
CURRENT_CONFIG_VERSION = 1;
|
|
1043
|
-
DEFAULT_CONFIG = {
|
|
1044
|
-
config_version: CURRENT_CONFIG_VERSION,
|
|
1045
|
-
dbPath: DB_PATH,
|
|
1046
|
-
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
1047
|
-
embeddingDim: 1024,
|
|
1048
|
-
batchSize: 20,
|
|
1049
|
-
flushIntervalMs: 1e4,
|
|
1050
|
-
autoIngestion: true,
|
|
1051
|
-
autoRetrieval: true,
|
|
1052
|
-
searchMode: "hybrid",
|
|
1053
|
-
hookSearchMode: "hybrid",
|
|
1054
|
-
fileGrepEnabled: true,
|
|
1055
|
-
splashEffect: true,
|
|
1056
|
-
consolidationEnabled: true,
|
|
1057
|
-
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
1058
|
-
consolidationModel: "claude-haiku-4-5-20251001",
|
|
1059
|
-
consolidationMaxCallsPerRun: 20,
|
|
1060
|
-
selfQueryRouter: true,
|
|
1061
|
-
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
1062
|
-
rerankerEnabled: true,
|
|
1063
|
-
scalingRoadmap: {
|
|
1064
|
-
rerankerAutoTrigger: {
|
|
1065
|
-
enabled: true,
|
|
1066
|
-
broadQueryMinCardinality: 5e4,
|
|
1067
|
-
fetchTopK: 150,
|
|
1068
|
-
returnTopK: 5
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
graphRagEnabled: true,
|
|
1072
|
-
wikiEnabled: false,
|
|
1073
|
-
wikiUrl: "",
|
|
1074
|
-
wikiApiKey: "",
|
|
1075
|
-
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
1076
|
-
wikiWorkspaceMapping: {
|
|
1077
|
-
exe: "Executive",
|
|
1078
|
-
yoshi: "Engineering",
|
|
1079
|
-
mari: "Marketing",
|
|
1080
|
-
tom: "Engineering",
|
|
1081
|
-
sasha: "Production"
|
|
1082
|
-
},
|
|
1083
|
-
wikiAutoUpdate: true,
|
|
1084
|
-
wikiAutoUpdateThreshold: 0.5,
|
|
1085
|
-
wikiAutoUpdateCreateNew: true,
|
|
1086
|
-
skillLearning: true,
|
|
1087
|
-
skillThreshold: 3,
|
|
1088
|
-
skillModel: "claude-haiku-4-5-20251001",
|
|
1089
|
-
exeHeartbeat: {
|
|
1090
|
-
enabled: true,
|
|
1091
|
-
intervalSeconds: 60,
|
|
1092
|
-
staleInProgressThresholdHours: 2
|
|
1093
|
-
},
|
|
1094
|
-
sessionLifecycle: {
|
|
1095
|
-
idleKillEnabled: true,
|
|
1096
|
-
idleKillTicksRequired: 3,
|
|
1097
|
-
idleKillIntercomAckWindowMs: 1e4,
|
|
1098
|
-
maxAutoInstances: 10
|
|
1099
|
-
},
|
|
1100
|
-
autoUpdate: {
|
|
1101
|
-
checkOnBoot: true,
|
|
1102
|
-
autoInstall: false,
|
|
1103
|
-
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
1104
|
-
}
|
|
1105
|
-
};
|
|
1106
|
-
CONFIG_MIGRATIONS = [
|
|
1107
|
-
{
|
|
1108
|
-
from: 0,
|
|
1109
|
-
to: 1,
|
|
1110
|
-
migrate: (cfg) => {
|
|
1111
|
-
cfg.config_version = 1;
|
|
1112
|
-
return cfg;
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
];
|
|
1178
|
+
init_db_retry();
|
|
1179
|
+
init_employees();
|
|
1180
|
+
_client = null;
|
|
1181
|
+
_resilientClient = null;
|
|
1182
|
+
initTurso = initDatabase;
|
|
1116
1183
|
}
|
|
1117
1184
|
});
|
|
1118
1185
|
|
|
@@ -1184,12 +1251,12 @@ __export(shard_manager_exports, {
|
|
|
1184
1251
|
listShards: () => listShards,
|
|
1185
1252
|
shardExists: () => shardExists
|
|
1186
1253
|
});
|
|
1187
|
-
import
|
|
1188
|
-
import { existsSync as
|
|
1254
|
+
import path4 from "path";
|
|
1255
|
+
import { existsSync as existsSync4, mkdirSync, readdirSync } from "fs";
|
|
1189
1256
|
import { createClient as createClient2 } from "@libsql/client";
|
|
1190
1257
|
function initShardManager(encryptionKey) {
|
|
1191
1258
|
_encryptionKey = encryptionKey;
|
|
1192
|
-
if (!
|
|
1259
|
+
if (!existsSync4(SHARDS_DIR)) {
|
|
1193
1260
|
mkdirSync(SHARDS_DIR, { recursive: true });
|
|
1194
1261
|
}
|
|
1195
1262
|
_shardingEnabled = true;
|
|
@@ -1210,7 +1277,7 @@ function getShardClient(projectName) {
|
|
|
1210
1277
|
}
|
|
1211
1278
|
const cached = _shards.get(safeName);
|
|
1212
1279
|
if (cached) return cached;
|
|
1213
|
-
const dbPath =
|
|
1280
|
+
const dbPath = path4.join(SHARDS_DIR, `${safeName}.db`);
|
|
1214
1281
|
const client = createClient2({
|
|
1215
1282
|
url: `file:${dbPath}`,
|
|
1216
1283
|
encryptionKey: _encryptionKey
|
|
@@ -1220,10 +1287,10 @@ function getShardClient(projectName) {
|
|
|
1220
1287
|
}
|
|
1221
1288
|
function shardExists(projectName) {
|
|
1222
1289
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
1223
|
-
return
|
|
1290
|
+
return existsSync4(path4.join(SHARDS_DIR, `${safeName}.db`));
|
|
1224
1291
|
}
|
|
1225
1292
|
function listShards() {
|
|
1226
|
-
if (!
|
|
1293
|
+
if (!existsSync4(SHARDS_DIR)) return [];
|
|
1227
1294
|
return readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db")).map((f) => f.replace(".db", ""));
|
|
1228
1295
|
}
|
|
1229
1296
|
async function ensureShardSchema(client) {
|
|
@@ -1293,7 +1360,11 @@ async function ensureShardSchema(client) {
|
|
|
1293
1360
|
"ALTER TABLE memories ADD COLUMN source_path TEXT",
|
|
1294
1361
|
"ALTER TABLE memories ADD COLUMN source_type TEXT DEFAULT 'text'",
|
|
1295
1362
|
"ALTER TABLE memories ADD COLUMN tier INTEGER DEFAULT 3",
|
|
1296
|
-
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT"
|
|
1363
|
+
"ALTER TABLE memories ADD COLUMN supersedes_id TEXT",
|
|
1364
|
+
// MS-11: draft staging, MS-6a: memory_type, MS-7: trajectory
|
|
1365
|
+
"ALTER TABLE memories ADD COLUMN draft INTEGER DEFAULT 0",
|
|
1366
|
+
"ALTER TABLE memories ADD COLUMN memory_type TEXT DEFAULT 'raw'",
|
|
1367
|
+
"ALTER TABLE memories ADD COLUMN trajectory TEXT"
|
|
1297
1368
|
]) {
|
|
1298
1369
|
try {
|
|
1299
1370
|
await client.execute(col);
|
|
@@ -1405,7 +1476,7 @@ var init_shard_manager = __esm({
|
|
|
1405
1476
|
"src/lib/shard-manager.ts"() {
|
|
1406
1477
|
"use strict";
|
|
1407
1478
|
init_config();
|
|
1408
|
-
SHARDS_DIR =
|
|
1479
|
+
SHARDS_DIR = path4.join(EXE_AI_DIR, "shards");
|
|
1409
1480
|
_shards = /* @__PURE__ */ new Map();
|
|
1410
1481
|
_encryptionKey = null;
|
|
1411
1482
|
_shardingEnabled = false;
|
|
@@ -1423,26 +1494,26 @@ var init_platform_procedures = __esm({
|
|
|
1423
1494
|
title: "What is exe-os \u2014 the operating model every agent must understand",
|
|
1424
1495
|
domain: "architecture",
|
|
1425
1496
|
priority: "p0",
|
|
1426
|
-
content: "Exe OS is an AI employee operating system. A founder runs 5-10 AI agents as a real org: COO
|
|
1497
|
+
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."
|
|
1427
1498
|
},
|
|
1428
1499
|
{
|
|
1429
1500
|
title: "Mode 1 \u2014 how exe-os runs inside Claude Code",
|
|
1430
1501
|
domain: "architecture",
|
|
1431
1502
|
priority: "p0",
|
|
1432
|
-
content: "Mode 1: exe-os runs AS hooks + MCP + skills inside Claude Code. The founder opens CC
|
|
1503
|
+
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."
|
|
1433
1504
|
},
|
|
1434
1505
|
{
|
|
1435
|
-
title: "Sessions explained \u2014
|
|
1506
|
+
title: "Sessions explained \u2014 coordinator session names and projects",
|
|
1436
1507
|
domain: "architecture",
|
|
1437
1508
|
priority: "p0",
|
|
1438
|
-
content: "Each
|
|
1509
|
+
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."
|
|
1439
1510
|
},
|
|
1440
1511
|
// --- Hierarchy and dispatch ---
|
|
1441
1512
|
{
|
|
1442
1513
|
title: "Chain of command \u2014 who talks to whom",
|
|
1443
1514
|
domain: "workflow",
|
|
1444
1515
|
priority: "p0",
|
|
1445
|
-
content: "Founder
|
|
1516
|
+
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."
|
|
1446
1517
|
},
|
|
1447
1518
|
{
|
|
1448
1519
|
title: "Single dispatch path \u2014 create_task only",
|
|
@@ -1452,30 +1523,30 @@ var init_platform_procedures = __esm({
|
|
|
1452
1523
|
},
|
|
1453
1524
|
// --- Session isolation ---
|
|
1454
1525
|
{
|
|
1455
|
-
title: "Session scoping \u2014 stay in your
|
|
1526
|
+
title: "Session scoping \u2014 stay in your coordinator boundary",
|
|
1456
1527
|
domain: "security",
|
|
1457
1528
|
priority: "p0",
|
|
1458
|
-
content: "Session scoping is mandatory. Managers dispatch to workers within their own
|
|
1529
|
+
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."
|
|
1459
1530
|
},
|
|
1460
1531
|
{
|
|
1461
1532
|
title: "Session isolation \u2014 never touch another session's work",
|
|
1462
1533
|
domain: "workflow",
|
|
1463
1534
|
priority: "p0",
|
|
1464
|
-
content:
|
|
1535
|
+
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."
|
|
1465
1536
|
},
|
|
1466
1537
|
// --- Engineering: session scoping in code ---
|
|
1467
1538
|
{
|
|
1468
1539
|
title: "Three-dimensional scoping \u2014 session, project, role \u2014 enforced in every query",
|
|
1469
1540
|
domain: "architecture",
|
|
1470
1541
|
priority: "p0",
|
|
1471
|
-
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
|
|
1542
|
+
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."
|
|
1472
1543
|
},
|
|
1473
1544
|
// --- Hard constraints ---
|
|
1474
1545
|
{
|
|
1475
1546
|
title: "What you CANNOT do in exe-os \u2014 hard constraints",
|
|
1476
1547
|
domain: "security",
|
|
1477
1548
|
priority: "p0",
|
|
1478
|
-
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
|
|
1549
|
+
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."
|
|
1479
1550
|
},
|
|
1480
1551
|
// --- Operations ---
|
|
1481
1552
|
{
|
|
@@ -1594,24 +1665,24 @@ ${p.content}`).join("\n\n");
|
|
|
1594
1665
|
});
|
|
1595
1666
|
|
|
1596
1667
|
// src/lib/session-registry.ts
|
|
1597
|
-
import
|
|
1598
|
-
import
|
|
1668
|
+
import path5 from "path";
|
|
1669
|
+
import os4 from "os";
|
|
1599
1670
|
var REGISTRY_PATH;
|
|
1600
1671
|
var init_session_registry = __esm({
|
|
1601
1672
|
"src/lib/session-registry.ts"() {
|
|
1602
1673
|
"use strict";
|
|
1603
|
-
REGISTRY_PATH =
|
|
1674
|
+
REGISTRY_PATH = path5.join(os4.homedir(), ".exe-os", "session-registry.json");
|
|
1604
1675
|
}
|
|
1605
1676
|
});
|
|
1606
1677
|
|
|
1607
1678
|
// src/lib/session-key.ts
|
|
1608
|
-
import { execSync } from "child_process";
|
|
1679
|
+
import { execSync as execSync2 } from "child_process";
|
|
1609
1680
|
function getSessionKey() {
|
|
1610
1681
|
if (_cached) return _cached;
|
|
1611
1682
|
let pid = process.ppid;
|
|
1612
1683
|
for (let i = 0; i < 10; i++) {
|
|
1613
1684
|
try {
|
|
1614
|
-
const info =
|
|
1685
|
+
const info = execSync2(`ps -p ${pid} -o ppid=,comm=`, {
|
|
1615
1686
|
encoding: "utf8",
|
|
1616
1687
|
timeout: 2e3
|
|
1617
1688
|
}).trim();
|
|
@@ -1747,7 +1818,7 @@ var init_transport = __esm({
|
|
|
1747
1818
|
});
|
|
1748
1819
|
|
|
1749
1820
|
// src/lib/cc-agent-support.ts
|
|
1750
|
-
import { execSync as
|
|
1821
|
+
import { execSync as execSync3 } from "child_process";
|
|
1751
1822
|
var init_cc_agent_support = __esm({
|
|
1752
1823
|
"src/lib/cc-agent-support.ts"() {
|
|
1753
1824
|
"use strict";
|
|
@@ -1776,31 +1847,16 @@ var init_provider_table = __esm({
|
|
|
1776
1847
|
});
|
|
1777
1848
|
|
|
1778
1849
|
// src/lib/intercom-queue.ts
|
|
1779
|
-
import { readFileSync as
|
|
1780
|
-
import
|
|
1781
|
-
import
|
|
1850
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, renameSync as renameSync3, existsSync as existsSync5, mkdirSync as mkdirSync2 } from "fs";
|
|
1851
|
+
import path6 from "path";
|
|
1852
|
+
import os5 from "os";
|
|
1782
1853
|
var QUEUE_PATH, TTL_MS, INTERCOM_LOG;
|
|
1783
1854
|
var init_intercom_queue = __esm({
|
|
1784
1855
|
"src/lib/intercom-queue.ts"() {
|
|
1785
1856
|
"use strict";
|
|
1786
|
-
QUEUE_PATH =
|
|
1857
|
+
QUEUE_PATH = path6.join(os5.homedir(), ".exe-os", "intercom-queue.json");
|
|
1787
1858
|
TTL_MS = 60 * 60 * 1e3;
|
|
1788
|
-
INTERCOM_LOG =
|
|
1789
|
-
}
|
|
1790
|
-
});
|
|
1791
|
-
|
|
1792
|
-
// src/lib/employees.ts
|
|
1793
|
-
import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3 } from "fs/promises";
|
|
1794
|
-
import { existsSync as existsSync5, symlinkSync, readlinkSync, readFileSync as readFileSync3, renameSync as renameSync3, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1795
|
-
import { execSync as execSync3 } from "child_process";
|
|
1796
|
-
import path6 from "path";
|
|
1797
|
-
import os5 from "os";
|
|
1798
|
-
var EMPLOYEES_PATH;
|
|
1799
|
-
var init_employees = __esm({
|
|
1800
|
-
"src/lib/employees.ts"() {
|
|
1801
|
-
"use strict";
|
|
1802
|
-
init_config();
|
|
1803
|
-
EMPLOYEES_PATH = path6.join(EXE_AI_DIR, "exe-employees.json");
|
|
1859
|
+
INTERCOM_LOG = path6.join(os5.homedir(), ".exe-os", "intercom.log");
|
|
1804
1860
|
}
|
|
1805
1861
|
});
|
|
1806
1862
|
|
|
@@ -1844,8 +1900,10 @@ function getMySession() {
|
|
|
1844
1900
|
return getTransport().getMySession();
|
|
1845
1901
|
}
|
|
1846
1902
|
function extractRootExe(name) {
|
|
1847
|
-
|
|
1848
|
-
|
|
1903
|
+
if (!name) return null;
|
|
1904
|
+
if (!name.includes("-")) return name;
|
|
1905
|
+
const parts = name.split("-").filter(Boolean);
|
|
1906
|
+
return parts.length > 0 ? parts[parts.length - 1] : null;
|
|
1849
1907
|
}
|
|
1850
1908
|
function getParentExe(sessionKey) {
|
|
1851
1909
|
try {
|
|
@@ -1880,6 +1938,7 @@ var init_tmux_routing = __esm({
|
|
|
1880
1938
|
init_provider_table();
|
|
1881
1939
|
init_intercom_queue();
|
|
1882
1940
|
init_plan_limits();
|
|
1941
|
+
init_employees();
|
|
1883
1942
|
SPAWN_LOCK_DIR = path9.join(os6.homedir(), ".exe-os", "spawn-locks");
|
|
1884
1943
|
SESSION_CACHE = path9.join(os6.homedir(), ".exe-os", "session-cache");
|
|
1885
1944
|
INTERCOM_LOG2 = path9.join(os6.homedir(), ".exe-os", "intercom.log");
|
|
@@ -1916,17 +1975,17 @@ var init_task_scope = __esm({
|
|
|
1916
1975
|
init_database();
|
|
1917
1976
|
|
|
1918
1977
|
// src/lib/keychain.ts
|
|
1919
|
-
import { readFile, writeFile, unlink, mkdir, chmod } from "fs/promises";
|
|
1920
|
-
import { existsSync } from "fs";
|
|
1921
|
-
import
|
|
1922
|
-
import
|
|
1978
|
+
import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
|
|
1979
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1980
|
+
import path3 from "path";
|
|
1981
|
+
import os3 from "os";
|
|
1923
1982
|
var SERVICE = "exe-mem";
|
|
1924
1983
|
var ACCOUNT = "master-key";
|
|
1925
1984
|
function getKeyDir() {
|
|
1926
|
-
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ??
|
|
1985
|
+
return process.env.EXE_OS_DIR ?? process.env.EXE_MEM_DIR ?? path3.join(os3.homedir(), ".exe-os");
|
|
1927
1986
|
}
|
|
1928
1987
|
function getKeyPath() {
|
|
1929
|
-
return
|
|
1988
|
+
return path3.join(getKeyDir(), "master.key");
|
|
1930
1989
|
}
|
|
1931
1990
|
async function tryKeytar() {
|
|
1932
1991
|
try {
|
|
@@ -1947,11 +2006,11 @@ async function getMasterKey() {
|
|
|
1947
2006
|
}
|
|
1948
2007
|
}
|
|
1949
2008
|
const keyPath = getKeyPath();
|
|
1950
|
-
if (!
|
|
2009
|
+
if (!existsSync3(keyPath)) {
|
|
1951
2010
|
return null;
|
|
1952
2011
|
}
|
|
1953
2012
|
try {
|
|
1954
|
-
const content = await
|
|
2013
|
+
const content = await readFile3(keyPath, "utf-8");
|
|
1955
2014
|
return Buffer.from(content.trim(), "base64");
|
|
1956
2015
|
} catch {
|
|
1957
2016
|
return null;
|