@askexenow/exe-os 0.9.7 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/backfill-conversations.js +953 -105
- package/dist/bin/backfill-responses.js +952 -104
- package/dist/bin/backfill-vectors.js +956 -108
- package/dist/bin/cleanup-stale-review-tasks.js +802 -58
- package/dist/bin/cli.js +2292 -1070
- package/dist/bin/exe-agent-config.js +157 -101
- package/dist/bin/exe-agent.js +55 -29
- package/dist/bin/exe-assign.js +940 -92
- package/dist/bin/exe-boot.js +1424 -442
- package/dist/bin/exe-call.js +240 -141
- package/dist/bin/exe-cloud.js +198 -70
- package/dist/bin/exe-dispatch.js +951 -192
- package/dist/bin/exe-doctor.js +791 -51
- package/dist/bin/exe-export-behaviors.js +790 -42
- package/dist/bin/exe-forget.js +771 -31
- package/dist/bin/exe-gateway.js +1592 -521
- package/dist/bin/exe-heartbeat.js +850 -109
- package/dist/bin/exe-kill.js +783 -35
- package/dist/bin/exe-launch-agent.js +1030 -107
- package/dist/bin/exe-link.js +916 -110
- package/dist/bin/exe-new-employee.js +526 -217
- package/dist/bin/exe-pending-messages.js +1046 -62
- package/dist/bin/exe-pending-notifications.js +1318 -111
- package/dist/bin/exe-pending-reviews.js +1040 -72
- package/dist/bin/exe-rename.js +772 -59
- package/dist/bin/exe-review.js +772 -32
- package/dist/bin/exe-search.js +982 -128
- package/dist/bin/exe-session-cleanup.js +1180 -306
- package/dist/bin/exe-settings.js +185 -105
- package/dist/bin/exe-start-codex.js +886 -132
- package/dist/bin/exe-start-opencode.js +873 -119
- package/dist/bin/exe-status.js +803 -59
- package/dist/bin/exe-team.js +772 -32
- package/dist/bin/git-sweep.js +1046 -223
- package/dist/bin/graph-backfill.js +779 -31
- package/dist/bin/graph-export.js +785 -37
- package/dist/bin/install.js +632 -200
- package/dist/bin/scan-tasks.js +1055 -232
- package/dist/bin/setup.js +1419 -320
- package/dist/bin/shard-migrate.js +783 -35
- package/dist/bin/update.js +138 -49
- package/dist/bin/wiki-sync.js +782 -34
- package/dist/gateway/index.js +1444 -449
- package/dist/hooks/bug-report-worker.js +1141 -269
- package/dist/hooks/codex-stop-task-finalizer.js +4678 -0
- package/dist/hooks/commit-complete.js +1044 -221
- package/dist/hooks/error-recall.js +989 -135
- package/dist/hooks/exe-heartbeat-hook.js +99 -75
- package/dist/hooks/ingest-worker.js +4176 -3226
- package/dist/hooks/ingest.js +920 -168
- package/dist/hooks/instructions-loaded.js +874 -70
- package/dist/hooks/notification.js +860 -56
- package/dist/hooks/post-compact.js +881 -73
- package/dist/hooks/pre-compact.js +1050 -227
- package/dist/hooks/pre-tool-use.js +1084 -159
- package/dist/hooks/prompt-ingest-worker.js +1089 -164
- package/dist/hooks/prompt-submit.js +1469 -515
- package/dist/hooks/response-ingest-worker.js +1104 -179
- package/dist/hooks/session-end.js +1085 -251
- package/dist/hooks/session-start.js +1241 -231
- package/dist/hooks/stop.js +935 -109
- package/dist/hooks/subagent-stop.js +881 -73
- package/dist/hooks/summary-worker.js +1323 -307
- package/dist/index.js +1449 -452
- package/dist/lib/agent-config.js +28 -6
- package/dist/lib/cloud-sync.js +909 -115
- package/dist/lib/config.js +30 -10
- package/dist/lib/consolidation.js +42 -9
- package/dist/lib/database.js +739 -33
- package/dist/lib/db-daemon-client.js +73 -19
- package/dist/lib/db.js +2359 -0
- package/dist/lib/device-registry.js +760 -47
- package/dist/lib/embedder.js +201 -73
- package/dist/lib/employee-templates.js +30 -4
- package/dist/lib/employees.js +290 -86
- package/dist/lib/exe-daemon-client.js +187 -83
- package/dist/lib/exe-daemon.js +1696 -616
- package/dist/lib/hybrid-search.js +982 -128
- package/dist/lib/identity.js +43 -13
- package/dist/lib/license.js +133 -48
- package/dist/lib/messaging.js +167 -80
- package/dist/lib/reminders.js +35 -5
- package/dist/lib/schedules.js +772 -32
- package/dist/lib/skill-learning.js +54 -7
- package/dist/lib/store.js +779 -31
- package/dist/lib/task-router.js +94 -73
- package/dist/lib/tasks.js +298 -225
- package/dist/lib/tmux-routing.js +246 -172
- package/dist/lib/token-spend.js +52 -14
- package/dist/mcp/server.js +2893 -850
- package/dist/mcp/tools/complete-reminder.js +35 -5
- package/dist/mcp/tools/create-reminder.js +35 -5
- package/dist/mcp/tools/create-task.js +507 -323
- package/dist/mcp/tools/deactivate-behavior.js +40 -10
- package/dist/mcp/tools/list-reminders.js +35 -5
- package/dist/mcp/tools/list-tasks.js +277 -104
- package/dist/mcp/tools/send-message.js +129 -56
- package/dist/mcp/tools/update-task.js +1864 -188
- package/dist/runtime/index.js +1083 -259
- package/dist/tui/App.js +1501 -434
- package/package.json +3 -2
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __esm = (fn, res) => function __init() {
|
|
4
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
|
+
};
|
|
2
6
|
|
|
3
|
-
// src/lib/
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
7
|
+
// src/lib/secure-files.ts
|
|
8
|
+
import { chmodSync, existsSync, mkdirSync } from "fs";
|
|
9
|
+
import { chmod, mkdir } from "fs/promises";
|
|
10
|
+
function ensurePrivateDirSync(dirPath) {
|
|
11
|
+
mkdirSync(dirPath, { recursive: true, mode: PRIVATE_DIR_MODE });
|
|
12
|
+
try {
|
|
13
|
+
chmodSync(dirPath, PRIVATE_DIR_MODE);
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function enforcePrivateFileSync(filePath) {
|
|
18
|
+
try {
|
|
19
|
+
if (existsSync(filePath)) chmodSync(filePath, PRIVATE_FILE_MODE);
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
var PRIVATE_DIR_MODE, PRIVATE_FILE_MODE;
|
|
24
|
+
var init_secure_files = __esm({
|
|
25
|
+
"src/lib/secure-files.ts"() {
|
|
26
|
+
"use strict";
|
|
27
|
+
PRIVATE_DIR_MODE = 448;
|
|
28
|
+
PRIVATE_FILE_MODE = 384;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
6
31
|
|
|
7
32
|
// src/lib/config.ts
|
|
8
|
-
import { readFile, writeFile
|
|
9
|
-
import { readFileSync, existsSync, renameSync } from "fs";
|
|
33
|
+
import { readFile, writeFile } from "fs/promises";
|
|
34
|
+
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
10
35
|
import path from "path";
|
|
11
36
|
import os from "os";
|
|
12
37
|
function resolveDataDir() {
|
|
@@ -14,7 +39,7 @@ function resolveDataDir() {
|
|
|
14
39
|
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
15
40
|
const newDir = path.join(os.homedir(), ".exe-os");
|
|
16
41
|
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
17
|
-
if (!
|
|
42
|
+
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
18
43
|
try {
|
|
19
44
|
renameSync(legacyDir, newDir);
|
|
20
45
|
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
@@ -25,105 +50,109 @@ function resolveDataDir() {
|
|
|
25
50
|
}
|
|
26
51
|
return newDir;
|
|
27
52
|
}
|
|
28
|
-
var EXE_AI_DIR
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
53
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG;
|
|
54
|
+
var init_config = __esm({
|
|
55
|
+
"src/lib/config.ts"() {
|
|
56
|
+
"use strict";
|
|
57
|
+
init_secure_files();
|
|
58
|
+
EXE_AI_DIR = resolveDataDir();
|
|
59
|
+
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
60
|
+
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
61
|
+
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
62
|
+
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
63
|
+
CURRENT_CONFIG_VERSION = 1;
|
|
64
|
+
DEFAULT_CONFIG = {
|
|
65
|
+
config_version: CURRENT_CONFIG_VERSION,
|
|
66
|
+
dbPath: DB_PATH,
|
|
67
|
+
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
68
|
+
embeddingDim: 1024,
|
|
69
|
+
batchSize: 20,
|
|
70
|
+
flushIntervalMs: 1e4,
|
|
71
|
+
autoIngestion: true,
|
|
72
|
+
autoRetrieval: true,
|
|
73
|
+
searchMode: "hybrid",
|
|
74
|
+
hookSearchMode: "hybrid",
|
|
75
|
+
fileGrepEnabled: true,
|
|
76
|
+
splashEffect: true,
|
|
77
|
+
consolidationEnabled: true,
|
|
78
|
+
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
79
|
+
consolidationModel: "claude-haiku-4-5-20251001",
|
|
80
|
+
consolidationMaxCallsPerRun: 20,
|
|
81
|
+
selfQueryRouter: true,
|
|
82
|
+
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
83
|
+
rerankerEnabled: true,
|
|
84
|
+
scalingRoadmap: {
|
|
85
|
+
rerankerAutoTrigger: {
|
|
86
|
+
enabled: true,
|
|
87
|
+
broadQueryMinCardinality: 5e4,
|
|
88
|
+
fetchTopK: 150,
|
|
89
|
+
returnTopK: 5
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
graphRagEnabled: true,
|
|
93
|
+
wikiEnabled: false,
|
|
94
|
+
wikiUrl: "",
|
|
95
|
+
wikiApiKey: "",
|
|
96
|
+
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
97
|
+
wikiWorkspaceMapping: {},
|
|
98
|
+
wikiAutoUpdate: true,
|
|
99
|
+
wikiAutoUpdateThreshold: 0.5,
|
|
100
|
+
wikiAutoUpdateCreateNew: true,
|
|
101
|
+
skillLearning: true,
|
|
102
|
+
skillThreshold: 3,
|
|
103
|
+
skillModel: "claude-haiku-4-5-20251001",
|
|
104
|
+
exeHeartbeat: {
|
|
105
|
+
enabled: true,
|
|
106
|
+
intervalSeconds: 60,
|
|
107
|
+
staleInProgressThresholdHours: 2
|
|
108
|
+
},
|
|
109
|
+
sessionLifecycle: {
|
|
110
|
+
idleKillEnabled: true,
|
|
111
|
+
idleKillTicksRequired: 3,
|
|
112
|
+
idleKillIntercomAckWindowMs: 1e4,
|
|
113
|
+
maxAutoInstances: 10
|
|
114
|
+
},
|
|
115
|
+
autoUpdate: {
|
|
116
|
+
checkOnBoot: true,
|
|
117
|
+
autoInstall: false,
|
|
118
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
119
|
+
}
|
|
120
|
+
};
|
|
89
121
|
}
|
|
90
|
-
};
|
|
122
|
+
});
|
|
91
123
|
|
|
92
124
|
// src/lib/runtime-table.ts
|
|
93
|
-
var RUNTIME_TABLE
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
125
|
+
var RUNTIME_TABLE, DEFAULT_RUNTIME;
|
|
126
|
+
var init_runtime_table = __esm({
|
|
127
|
+
"src/lib/runtime-table.ts"() {
|
|
128
|
+
"use strict";
|
|
129
|
+
RUNTIME_TABLE = {
|
|
130
|
+
codex: {
|
|
131
|
+
binary: "codex",
|
|
132
|
+
launchMode: "interactive",
|
|
133
|
+
autoApproveFlag: "--dangerously-bypass-approvals-and-sandbox",
|
|
134
|
+
inlineFlag: "--no-alt-screen",
|
|
135
|
+
apiKeyEnv: "OPENAI_API_KEY",
|
|
136
|
+
defaultModel: "gpt-5.4"
|
|
137
|
+
},
|
|
138
|
+
opencode: {
|
|
139
|
+
binary: "opencode",
|
|
140
|
+
launchMode: "exec",
|
|
141
|
+
autoApproveFlag: "--dangerously-skip-permissions",
|
|
142
|
+
inlineFlag: "",
|
|
143
|
+
apiKeyEnv: "ANTHROPIC_API_KEY",
|
|
144
|
+
defaultModel: "anthropic/claude-sonnet-4-6"
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
DEFAULT_RUNTIME = "claude";
|
|
109
148
|
}
|
|
110
|
-
};
|
|
111
|
-
var DEFAULT_RUNTIME = "claude";
|
|
149
|
+
});
|
|
112
150
|
|
|
113
151
|
// src/lib/agent-config.ts
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
claude: ["claude-opus-4", "claude-sonnet-4", "claude-haiku-4.5"],
|
|
117
|
-
codex: ["gpt-5.4", "gpt-5.5", "gpt-5.3-codex-spark", "o3", "o4-mini"],
|
|
118
|
-
opencode: ["anthropic/claude-sonnet-4-6", "openai/gpt-5.4", "google/gemini-2.5-pro", "deepseek/deepseek-r3", "minimax/minimax-m2.5"]
|
|
119
|
-
};
|
|
120
|
-
var DEFAULT_MODELS = {
|
|
121
|
-
claude: "claude-opus-4",
|
|
122
|
-
codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
|
|
123
|
-
opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
|
|
124
|
-
};
|
|
152
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync3 } from "fs";
|
|
153
|
+
import path2 from "path";
|
|
125
154
|
function loadAgentConfig() {
|
|
126
|
-
if (!
|
|
155
|
+
if (!existsSync3(AGENT_CONFIG_PATH)) return {};
|
|
127
156
|
try {
|
|
128
157
|
return JSON.parse(readFileSync2(AGENT_CONFIG_PATH, "utf-8"));
|
|
129
158
|
} catch {
|
|
@@ -132,8 +161,9 @@ function loadAgentConfig() {
|
|
|
132
161
|
}
|
|
133
162
|
function saveAgentConfig(config) {
|
|
134
163
|
const dir = path2.dirname(AGENT_CONFIG_PATH);
|
|
135
|
-
|
|
164
|
+
ensurePrivateDirSync(dir);
|
|
136
165
|
writeFileSync(AGENT_CONFIG_PATH, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
166
|
+
enforcePrivateFileSync(AGENT_CONFIG_PATH);
|
|
137
167
|
}
|
|
138
168
|
function getAgentRuntime(agentId) {
|
|
139
169
|
const config = loadAgentConfig();
|
|
@@ -167,22 +197,48 @@ function clearAgentRuntime(agentId) {
|
|
|
167
197
|
delete config[agentId];
|
|
168
198
|
saveAgentConfig(config);
|
|
169
199
|
}
|
|
200
|
+
var AGENT_CONFIG_PATH, KNOWN_RUNTIMES, DEFAULT_MODELS;
|
|
201
|
+
var init_agent_config = __esm({
|
|
202
|
+
"src/lib/agent-config.ts"() {
|
|
203
|
+
"use strict";
|
|
204
|
+
init_config();
|
|
205
|
+
init_runtime_table();
|
|
206
|
+
init_secure_files();
|
|
207
|
+
AGENT_CONFIG_PATH = path2.join(EXE_AI_DIR, "agent-config.json");
|
|
208
|
+
KNOWN_RUNTIMES = {
|
|
209
|
+
claude: ["claude-opus-4", "claude-sonnet-4", "claude-haiku-4.5"],
|
|
210
|
+
codex: ["gpt-5.4", "gpt-5.5", "gpt-5.3-codex-spark", "o3", "o4-mini"],
|
|
211
|
+
opencode: ["anthropic/claude-sonnet-4-6", "openai/gpt-5.4", "google/gemini-2.5-pro", "deepseek/deepseek-r3", "minimax/minimax-m2.5"]
|
|
212
|
+
};
|
|
213
|
+
DEFAULT_MODELS = {
|
|
214
|
+
claude: "claude-opus-4",
|
|
215
|
+
codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
|
|
216
|
+
opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// src/bin/exe-agent-config.ts
|
|
222
|
+
init_agent_config();
|
|
223
|
+
init_runtime_table();
|
|
170
224
|
|
|
171
225
|
// src/lib/employees.ts
|
|
226
|
+
init_config();
|
|
172
227
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
173
|
-
import { existsSync as
|
|
228
|
+
import { existsSync as existsSync4, symlinkSync, readlinkSync, readFileSync as readFileSync3, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
174
229
|
import { execSync } from "child_process";
|
|
175
230
|
import path3 from "path";
|
|
176
231
|
import os2 from "os";
|
|
177
232
|
var EMPLOYEES_PATH = path3.join(EXE_AI_DIR, "exe-employees.json");
|
|
178
233
|
function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
179
|
-
if (!
|
|
234
|
+
if (!existsSync4(employeesPath)) return [];
|
|
180
235
|
try {
|
|
181
236
|
return JSON.parse(readFileSync3(employeesPath, "utf-8"));
|
|
182
237
|
} catch {
|
|
183
238
|
return [];
|
|
184
239
|
}
|
|
185
240
|
}
|
|
241
|
+
var IDENTITY_DIR = path3.join(EXE_AI_DIR, "identity");
|
|
186
242
|
|
|
187
243
|
// src/bin/exe-agent-config.ts
|
|
188
244
|
function showAll() {
|
package/dist/bin/exe-agent.js
CHANGED
|
@@ -4,9 +4,18 @@ var __esm = (fn, res) => function __init() {
|
|
|
4
4
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
+
// src/lib/secure-files.ts
|
|
8
|
+
import { chmodSync, existsSync, mkdirSync } from "fs";
|
|
9
|
+
import { chmod, mkdir } from "fs/promises";
|
|
10
|
+
var init_secure_files = __esm({
|
|
11
|
+
"src/lib/secure-files.ts"() {
|
|
12
|
+
"use strict";
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
7
16
|
// src/lib/config.ts
|
|
8
|
-
import { readFile, writeFile
|
|
9
|
-
import { readFileSync, existsSync, renameSync } from "fs";
|
|
17
|
+
import { readFile, writeFile } from "fs/promises";
|
|
18
|
+
import { readFileSync, existsSync as existsSync2, renameSync } from "fs";
|
|
10
19
|
import path from "path";
|
|
11
20
|
import os from "os";
|
|
12
21
|
function resolveDataDir() {
|
|
@@ -14,7 +23,7 @@ function resolveDataDir() {
|
|
|
14
23
|
if (process.env.EXE_MEM_DIR) return process.env.EXE_MEM_DIR;
|
|
15
24
|
const newDir = path.join(os.homedir(), ".exe-os");
|
|
16
25
|
const legacyDir = path.join(os.homedir(), ".exe-mem");
|
|
17
|
-
if (!
|
|
26
|
+
if (!existsSync2(newDir) && existsSync2(legacyDir)) {
|
|
18
27
|
try {
|
|
19
28
|
renameSync(legacyDir, newDir);
|
|
20
29
|
process.stderr.write(`[exe-os] Migrated data directory: ~/.exe-mem \u2192 ~/.exe-os
|
|
@@ -29,6 +38,7 @@ var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CON
|
|
|
29
38
|
var init_config = __esm({
|
|
30
39
|
"src/lib/config.ts"() {
|
|
31
40
|
"use strict";
|
|
41
|
+
init_secure_files();
|
|
32
42
|
EXE_AI_DIR = resolveDataDir();
|
|
33
43
|
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
34
44
|
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
@@ -98,8 +108,8 @@ var init_config = __esm({
|
|
|
98
108
|
// src/bin/exe-agent.ts
|
|
99
109
|
import { createInterface } from "readline";
|
|
100
110
|
import { readFileSync as readFileSync3 } from "fs";
|
|
101
|
-
import
|
|
102
|
-
import
|
|
111
|
+
import path10 from "path";
|
|
112
|
+
import os5 from "os";
|
|
103
113
|
|
|
104
114
|
// src/runtime/external-agent-mode.ts
|
|
105
115
|
var HARD_BLOCKED_TOOLS = /* @__PURE__ */ new Set([
|
|
@@ -1259,11 +1269,27 @@ import { createClient } from "@libsql/client";
|
|
|
1259
1269
|
// src/lib/employees.ts
|
|
1260
1270
|
init_config();
|
|
1261
1271
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
1262
|
-
import { existsSync as
|
|
1272
|
+
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync as renameSync2, unlinkSync, writeFileSync } from "fs";
|
|
1263
1273
|
import { execSync } from "child_process";
|
|
1264
1274
|
import path2 from "path";
|
|
1265
1275
|
import os2 from "os";
|
|
1266
1276
|
var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
1277
|
+
var IDENTITY_DIR = path2.join(EXE_AI_DIR, "identity");
|
|
1278
|
+
|
|
1279
|
+
// src/lib/database-adapter.ts
|
|
1280
|
+
import os3 from "os";
|
|
1281
|
+
import path3 from "path";
|
|
1282
|
+
import { createRequire } from "module";
|
|
1283
|
+
import { pathToFileURL } from "url";
|
|
1284
|
+
var BOOLEAN_COLUMNS_BY_TABLE = {
|
|
1285
|
+
memories: /* @__PURE__ */ new Set(["has_error", "draft"]),
|
|
1286
|
+
behaviors: /* @__PURE__ */ new Set(["active"]),
|
|
1287
|
+
notifications: /* @__PURE__ */ new Set(["read"]),
|
|
1288
|
+
users: /* @__PURE__ */ new Set(["has_personal_memory"])
|
|
1289
|
+
};
|
|
1290
|
+
var BOOLEAN_COLUMN_NAMES = new Set(
|
|
1291
|
+
Object.values(BOOLEAN_COLUMNS_BY_TABLE).flatMap((cols) => [...cols])
|
|
1292
|
+
);
|
|
1267
1293
|
|
|
1268
1294
|
// src/lib/platform-procedures.ts
|
|
1269
1295
|
var PLATFORM_PROCEDURES = [
|
|
@@ -1719,13 +1745,13 @@ var BashTool = {
|
|
|
1719
1745
|
|
|
1720
1746
|
// src/runtime/tools/file-read.ts
|
|
1721
1747
|
import fs from "fs/promises";
|
|
1722
|
-
import
|
|
1748
|
+
import path5 from "path";
|
|
1723
1749
|
import { z as z2 } from "zod";
|
|
1724
1750
|
|
|
1725
1751
|
// src/runtime/safety-checks.ts
|
|
1726
|
-
import
|
|
1727
|
-
import
|
|
1728
|
-
var HOME =
|
|
1752
|
+
import path4 from "path";
|
|
1753
|
+
import os4 from "os";
|
|
1754
|
+
var HOME = os4.homedir();
|
|
1729
1755
|
var BYPASS_IMMUNE_PATTERNS = [
|
|
1730
1756
|
{
|
|
1731
1757
|
pattern: /\/\.git\/hooks\//,
|
|
@@ -1736,11 +1762,11 @@ var BYPASS_IMMUNE_PATTERNS = [
|
|
|
1736
1762
|
reason: "Git config can set hooks and command execution"
|
|
1737
1763
|
},
|
|
1738
1764
|
{
|
|
1739
|
-
pattern: (p) => p.startsWith(
|
|
1765
|
+
pattern: (p) => p.startsWith(path4.join(HOME, ".claude")),
|
|
1740
1766
|
reason: "Claude configuration files are protected"
|
|
1741
1767
|
},
|
|
1742
1768
|
{
|
|
1743
|
-
pattern: (p) => p.startsWith(
|
|
1769
|
+
pattern: (p) => p.startsWith(path4.join(HOME, ".exe-os")),
|
|
1744
1770
|
reason: "exe-os configuration files are protected"
|
|
1745
1771
|
},
|
|
1746
1772
|
{
|
|
@@ -1757,7 +1783,7 @@ var BYPASS_IMMUNE_PATTERNS = [
|
|
|
1757
1783
|
},
|
|
1758
1784
|
{
|
|
1759
1785
|
pattern: (p) => {
|
|
1760
|
-
const name =
|
|
1786
|
+
const name = path4.basename(p);
|
|
1761
1787
|
return [".bashrc", ".zshrc", ".profile", ".bash_profile", ".zprofile", ".zshenv"].includes(name);
|
|
1762
1788
|
},
|
|
1763
1789
|
reason: "Shell configuration files can execute arbitrary code on login"
|
|
@@ -1776,7 +1802,7 @@ var BYPASS_IMMUNE_PATTERNS = [
|
|
|
1776
1802
|
}
|
|
1777
1803
|
];
|
|
1778
1804
|
function checkPathSafety(filePath) {
|
|
1779
|
-
const resolved =
|
|
1805
|
+
const resolved = path4.resolve(filePath);
|
|
1780
1806
|
for (const { pattern, reason } of BYPASS_IMMUNE_PATTERNS) {
|
|
1781
1807
|
const matches = typeof pattern === "function" ? pattern(resolved) : pattern.test(resolved);
|
|
1782
1808
|
if (matches) {
|
|
@@ -1786,7 +1812,7 @@ function checkPathSafety(filePath) {
|
|
|
1786
1812
|
return { safe: true, bypassImmune: true };
|
|
1787
1813
|
}
|
|
1788
1814
|
function checkReadPathSafety(filePath) {
|
|
1789
|
-
const resolved =
|
|
1815
|
+
const resolved = path4.resolve(filePath);
|
|
1790
1816
|
const credPatterns = BYPASS_IMMUNE_PATTERNS.filter(
|
|
1791
1817
|
(p) => typeof p.pattern !== "function" && (p.reason.includes("secrets") || p.reason.includes("Private key") || p.reason.includes("Credential"))
|
|
1792
1818
|
);
|
|
@@ -1822,7 +1848,7 @@ var FileReadTool = {
|
|
|
1822
1848
|
return { behavior: "allow" };
|
|
1823
1849
|
},
|
|
1824
1850
|
async call(input, context) {
|
|
1825
|
-
const filePath =
|
|
1851
|
+
const filePath = path5.isAbsolute(input.file_path) ? input.file_path : path5.resolve(context.cwd, input.file_path);
|
|
1826
1852
|
let stat;
|
|
1827
1853
|
try {
|
|
1828
1854
|
stat = await fs.stat(filePath);
|
|
@@ -1862,7 +1888,7 @@ function isBinary(buf) {
|
|
|
1862
1888
|
|
|
1863
1889
|
// src/runtime/tools/file-edit.ts
|
|
1864
1890
|
import fs2 from "fs/promises";
|
|
1865
|
-
import
|
|
1891
|
+
import path6 from "path";
|
|
1866
1892
|
import { z as z3 } from "zod";
|
|
1867
1893
|
var inputSchema3 = z3.object({
|
|
1868
1894
|
file_path: z3.string(),
|
|
@@ -1887,7 +1913,7 @@ var FileEditTool = {
|
|
|
1887
1913
|
return { behavior: "allow" };
|
|
1888
1914
|
},
|
|
1889
1915
|
async call(input, context) {
|
|
1890
|
-
const filePath =
|
|
1916
|
+
const filePath = path6.isAbsolute(input.file_path) ? input.file_path : path6.resolve(context.cwd, input.file_path);
|
|
1891
1917
|
let content;
|
|
1892
1918
|
try {
|
|
1893
1919
|
content = await fs2.readFile(filePath, "utf-8");
|
|
@@ -1936,7 +1962,7 @@ function countOccurrences(haystack, needle) {
|
|
|
1936
1962
|
|
|
1937
1963
|
// src/runtime/tools/file-write.ts
|
|
1938
1964
|
import fs3 from "fs/promises";
|
|
1939
|
-
import
|
|
1965
|
+
import path7 from "path";
|
|
1940
1966
|
import { z as z4 } from "zod";
|
|
1941
1967
|
var inputSchema4 = z4.object({
|
|
1942
1968
|
file_path: z4.string(),
|
|
@@ -1959,8 +1985,8 @@ var FileWriteTool = {
|
|
|
1959
1985
|
return { behavior: "allow" };
|
|
1960
1986
|
},
|
|
1961
1987
|
async call(input, context) {
|
|
1962
|
-
const filePath =
|
|
1963
|
-
const dir =
|
|
1988
|
+
const filePath = path7.isAbsolute(input.file_path) ? input.file_path : path7.resolve(context.cwd, input.file_path);
|
|
1989
|
+
const dir = path7.dirname(filePath);
|
|
1964
1990
|
await fs3.mkdir(dir, { recursive: true });
|
|
1965
1991
|
await fs3.writeFile(filePath, input.content, "utf-8");
|
|
1966
1992
|
return {
|
|
@@ -1972,7 +1998,7 @@ var FileWriteTool = {
|
|
|
1972
1998
|
|
|
1973
1999
|
// src/runtime/tools/glob.ts
|
|
1974
2000
|
import fs4 from "fs/promises";
|
|
1975
|
-
import
|
|
2001
|
+
import path8 from "path";
|
|
1976
2002
|
import { z as z5 } from "zod";
|
|
1977
2003
|
var inputSchema5 = z5.object({
|
|
1978
2004
|
pattern: z5.string(),
|
|
@@ -1984,11 +2010,11 @@ var GlobTool = {
|
|
|
1984
2010
|
inputSchema: inputSchema5,
|
|
1985
2011
|
isReadOnly: true,
|
|
1986
2012
|
async call(input, context) {
|
|
1987
|
-
const baseDir = input.path ?
|
|
2013
|
+
const baseDir = input.path ? path8.isAbsolute(input.path) ? input.path : path8.resolve(context.cwd, input.path) : context.cwd;
|
|
1988
2014
|
try {
|
|
1989
2015
|
const entries = await walkDir(baseDir);
|
|
1990
2016
|
const matched = entries.filter(
|
|
1991
|
-
(e) => simpleGlobMatch(
|
|
2017
|
+
(e) => simpleGlobMatch(path8.relative(baseDir, e.path), input.pattern)
|
|
1992
2018
|
);
|
|
1993
2019
|
matched.sort((a, b) => b.mtime - a.mtime);
|
|
1994
2020
|
if (matched.length === 0) {
|
|
@@ -2018,7 +2044,7 @@ async function walkDir(dir, maxDepth = 10) {
|
|
|
2018
2044
|
if (entry.isDirectory() && (entry.name === "node_modules" || entry.name === ".git")) {
|
|
2019
2045
|
continue;
|
|
2020
2046
|
}
|
|
2021
|
-
const fullPath =
|
|
2047
|
+
const fullPath = path8.join(current, entry.name);
|
|
2022
2048
|
if (entry.isDirectory()) {
|
|
2023
2049
|
await walk(fullPath, depth + 1);
|
|
2024
2050
|
} else {
|
|
@@ -2042,7 +2068,7 @@ function simpleGlobMatch(filePath, pattern) {
|
|
|
2042
2068
|
// src/runtime/tools/grep.ts
|
|
2043
2069
|
import { spawn as spawn2 } from "child_process";
|
|
2044
2070
|
import fs5 from "fs/promises";
|
|
2045
|
-
import
|
|
2071
|
+
import path9 from "path";
|
|
2046
2072
|
import { z as z6 } from "zod";
|
|
2047
2073
|
var inputSchema6 = z6.object({
|
|
2048
2074
|
pattern: z6.string(),
|
|
@@ -2056,7 +2082,7 @@ var GrepTool = {
|
|
|
2056
2082
|
inputSchema: inputSchema6,
|
|
2057
2083
|
isReadOnly: true,
|
|
2058
2084
|
async call(input, context) {
|
|
2059
|
-
const searchPath = input.path ?
|
|
2085
|
+
const searchPath = input.path ? path9.isAbsolute(input.path) ? input.path : path9.resolve(context.cwd, input.path) : context.cwd;
|
|
2060
2086
|
try {
|
|
2061
2087
|
const result = await runRipgrep(input, searchPath, context);
|
|
2062
2088
|
return result;
|
|
@@ -2124,7 +2150,7 @@ async function nodeGrep(input, searchPath) {
|
|
|
2124
2150
|
}
|
|
2125
2151
|
for (const entry of entries) {
|
|
2126
2152
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
2127
|
-
const fullPath =
|
|
2153
|
+
const fullPath = path9.join(dir, entry.name);
|
|
2128
2154
|
if (entry.isDirectory()) {
|
|
2129
2155
|
await walk(fullPath);
|
|
2130
2156
|
} else {
|
|
@@ -2171,7 +2197,7 @@ function parseArgs(argv) {
|
|
|
2171
2197
|
}
|
|
2172
2198
|
function loadEmployee(name) {
|
|
2173
2199
|
try {
|
|
2174
|
-
const rosterPath =
|
|
2200
|
+
const rosterPath = path10.join(os5.homedir(), ".exe-os", "exe-employees.json");
|
|
2175
2201
|
const roster = JSON.parse(readFileSync3(rosterPath, "utf8"));
|
|
2176
2202
|
return roster.find((e) => e.name.toLowerCase() === name.toLowerCase()) ?? null;
|
|
2177
2203
|
} catch {
|