@askexenow/exe-os 0.9.7 → 0.9.8
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 +754 -79
- package/dist/bin/backfill-responses.js +752 -77
- package/dist/bin/backfill-vectors.js +752 -77
- package/dist/bin/cleanup-stale-review-tasks.js +657 -35
- package/dist/bin/cli.js +1388 -605
- package/dist/bin/exe-agent-config.js +123 -95
- package/dist/bin/exe-agent.js +41 -25
- package/dist/bin/exe-assign.js +732 -57
- package/dist/bin/exe-boot.js +784 -153
- package/dist/bin/exe-call.js +209 -138
- package/dist/bin/exe-cloud.js +35 -12
- package/dist/bin/exe-dispatch.js +692 -70
- package/dist/bin/exe-doctor.js +648 -26
- package/dist/bin/exe-export-behaviors.js +650 -20
- package/dist/bin/exe-forget.js +635 -13
- package/dist/bin/exe-gateway.js +1053 -271
- package/dist/bin/exe-heartbeat.js +665 -43
- package/dist/bin/exe-kill.js +646 -16
- package/dist/bin/exe-launch-agent.js +887 -97
- package/dist/bin/exe-link.js +658 -43
- package/dist/bin/exe-new-employee.js +378 -177
- package/dist/bin/exe-pending-messages.js +656 -34
- package/dist/bin/exe-pending-notifications.js +635 -13
- package/dist/bin/exe-pending-reviews.js +659 -37
- package/dist/bin/exe-rename.js +645 -30
- package/dist/bin/exe-review.js +635 -13
- package/dist/bin/exe-search.js +771 -88
- package/dist/bin/exe-session-cleanup.js +834 -150
- package/dist/bin/exe-settings.js +127 -91
- package/dist/bin/exe-start-codex.js +729 -94
- package/dist/bin/exe-start-opencode.js +717 -82
- package/dist/bin/exe-status.js +657 -35
- package/dist/bin/exe-team.js +635 -13
- package/dist/bin/git-sweep.js +720 -89
- package/dist/bin/graph-backfill.js +643 -13
- package/dist/bin/graph-export.js +646 -16
- package/dist/bin/install.js +596 -193
- package/dist/bin/scan-tasks.js +724 -93
- package/dist/bin/setup.js +1038 -210
- package/dist/bin/shard-migrate.js +645 -15
- package/dist/bin/wiki-sync.js +646 -16
- package/dist/gateway/index.js +1027 -245
- package/dist/hooks/bug-report-worker.js +891 -170
- package/dist/hooks/commit-complete.js +718 -87
- package/dist/hooks/error-recall.js +776 -93
- package/dist/hooks/exe-heartbeat-hook.js +85 -71
- package/dist/hooks/ingest-worker.js +840 -156
- package/dist/hooks/ingest.js +90 -73
- package/dist/hooks/instructions-loaded.js +669 -38
- package/dist/hooks/notification.js +661 -30
- package/dist/hooks/post-compact.js +674 -43
- package/dist/hooks/pre-compact.js +718 -87
- package/dist/hooks/pre-tool-use.js +872 -125
- package/dist/hooks/prompt-ingest-worker.js +758 -83
- package/dist/hooks/prompt-submit.js +1060 -319
- package/dist/hooks/response-ingest-worker.js +758 -83
- package/dist/hooks/session-end.js +721 -90
- package/dist/hooks/session-start.js +1031 -207
- package/dist/hooks/stop.js +680 -49
- package/dist/hooks/subagent-stop.js +674 -43
- package/dist/hooks/summary-worker.js +816 -132
- package/dist/index.js +1015 -232
- package/dist/lib/cloud-sync.js +663 -48
- package/dist/lib/consolidation.js +26 -3
- package/dist/lib/database.js +626 -18
- package/dist/lib/db.js +2261 -0
- package/dist/lib/device-registry.js +640 -25
- package/dist/lib/embedder.js +96 -43
- package/dist/lib/employee-templates.js +16 -0
- package/dist/lib/employees.js +259 -83
- package/dist/lib/exe-daemon-client.js +101 -63
- package/dist/lib/exe-daemon.js +894 -162
- package/dist/lib/hybrid-search.js +771 -88
- package/dist/lib/identity.js +27 -7
- package/dist/lib/messaging.js +55 -28
- package/dist/lib/reminders.js +21 -1
- package/dist/lib/schedules.js +636 -14
- package/dist/lib/skill-learning.js +21 -1
- package/dist/lib/store.js +643 -13
- package/dist/lib/task-router.js +82 -71
- package/dist/lib/tasks.js +98 -71
- package/dist/lib/tmux-routing.js +87 -60
- package/dist/lib/token-spend.js +26 -6
- package/dist/mcp/server.js +1784 -458
- package/dist/mcp/tools/complete-reminder.js +21 -1
- package/dist/mcp/tools/create-reminder.js +21 -1
- package/dist/mcp/tools/create-task.js +290 -164
- package/dist/mcp/tools/deactivate-behavior.js +24 -4
- package/dist/mcp/tools/list-reminders.js +21 -1
- package/dist/mcp/tools/list-tasks.js +195 -38
- package/dist/mcp/tools/send-message.js +58 -31
- package/dist/mcp/tools/update-task.js +75 -48
- package/dist/runtime/index.js +720 -89
- package/dist/tui/App.js +853 -123
- package/package.json +3 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
};
|
|
6
6
|
|
|
7
7
|
// src/lib/config.ts
|
|
8
8
|
import { readFile, writeFile, mkdir, chmod } from "fs/promises";
|
|
@@ -25,103 +25,106 @@ function resolveDataDir() {
|
|
|
25
25
|
}
|
|
26
26
|
return newDir;
|
|
27
27
|
}
|
|
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
|
-
|
|
28
|
+
var EXE_AI_DIR, DB_PATH, MODELS_DIR, CONFIG_PATH, LEGACY_LANCE_PATH, CURRENT_CONFIG_VERSION, DEFAULT_CONFIG;
|
|
29
|
+
var init_config = __esm({
|
|
30
|
+
"src/lib/config.ts"() {
|
|
31
|
+
"use strict";
|
|
32
|
+
EXE_AI_DIR = resolveDataDir();
|
|
33
|
+
DB_PATH = path.join(EXE_AI_DIR, "memories.db");
|
|
34
|
+
MODELS_DIR = path.join(EXE_AI_DIR, "models");
|
|
35
|
+
CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
|
|
36
|
+
LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
|
|
37
|
+
CURRENT_CONFIG_VERSION = 1;
|
|
38
|
+
DEFAULT_CONFIG = {
|
|
39
|
+
config_version: CURRENT_CONFIG_VERSION,
|
|
40
|
+
dbPath: DB_PATH,
|
|
41
|
+
modelFile: "jina-embeddings-v5-small-q4_k_m.gguf",
|
|
42
|
+
embeddingDim: 1024,
|
|
43
|
+
batchSize: 20,
|
|
44
|
+
flushIntervalMs: 1e4,
|
|
45
|
+
autoIngestion: true,
|
|
46
|
+
autoRetrieval: true,
|
|
47
|
+
searchMode: "hybrid",
|
|
48
|
+
hookSearchMode: "hybrid",
|
|
49
|
+
fileGrepEnabled: true,
|
|
50
|
+
splashEffect: true,
|
|
51
|
+
consolidationEnabled: true,
|
|
52
|
+
consolidationIntervalMs: 6 * 60 * 60 * 1e3,
|
|
53
|
+
consolidationModel: "claude-haiku-4-5-20251001",
|
|
54
|
+
consolidationMaxCallsPerRun: 20,
|
|
55
|
+
selfQueryRouter: true,
|
|
56
|
+
selfQueryModel: "claude-haiku-4-5-20251001",
|
|
57
|
+
rerankerEnabled: true,
|
|
58
|
+
scalingRoadmap: {
|
|
59
|
+
rerankerAutoTrigger: {
|
|
60
|
+
enabled: true,
|
|
61
|
+
broadQueryMinCardinality: 5e4,
|
|
62
|
+
fetchTopK: 150,
|
|
63
|
+
returnTopK: 5
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
graphRagEnabled: true,
|
|
67
|
+
wikiEnabled: false,
|
|
68
|
+
wikiUrl: "",
|
|
69
|
+
wikiApiKey: "",
|
|
70
|
+
wikiSyncIntervalMs: 30 * 60 * 1e3,
|
|
71
|
+
wikiWorkspaceMapping: {},
|
|
72
|
+
wikiAutoUpdate: true,
|
|
73
|
+
wikiAutoUpdateThreshold: 0.5,
|
|
74
|
+
wikiAutoUpdateCreateNew: true,
|
|
75
|
+
skillLearning: true,
|
|
76
|
+
skillThreshold: 3,
|
|
77
|
+
skillModel: "claude-haiku-4-5-20251001",
|
|
78
|
+
exeHeartbeat: {
|
|
79
|
+
enabled: true,
|
|
80
|
+
intervalSeconds: 60,
|
|
81
|
+
staleInProgressThresholdHours: 2
|
|
82
|
+
},
|
|
83
|
+
sessionLifecycle: {
|
|
84
|
+
idleKillEnabled: true,
|
|
85
|
+
idleKillTicksRequired: 3,
|
|
86
|
+
idleKillIntercomAckWindowMs: 1e4,
|
|
87
|
+
maxAutoInstances: 10
|
|
88
|
+
},
|
|
89
|
+
autoUpdate: {
|
|
90
|
+
checkOnBoot: true,
|
|
91
|
+
autoInstall: false,
|
|
92
|
+
checkIntervalMs: 24 * 60 * 60 * 1e3
|
|
93
|
+
}
|
|
94
|
+
};
|
|
89
95
|
}
|
|
90
|
-
};
|
|
96
|
+
});
|
|
91
97
|
|
|
92
98
|
// src/lib/runtime-table.ts
|
|
93
|
-
var RUNTIME_TABLE
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
var RUNTIME_TABLE, DEFAULT_RUNTIME;
|
|
100
|
+
var init_runtime_table = __esm({
|
|
101
|
+
"src/lib/runtime-table.ts"() {
|
|
102
|
+
"use strict";
|
|
103
|
+
RUNTIME_TABLE = {
|
|
104
|
+
codex: {
|
|
105
|
+
binary: "codex",
|
|
106
|
+
launchMode: "interactive",
|
|
107
|
+
autoApproveFlag: "--dangerously-bypass-approvals-and-sandbox",
|
|
108
|
+
inlineFlag: "--no-alt-screen",
|
|
109
|
+
apiKeyEnv: "OPENAI_API_KEY",
|
|
110
|
+
defaultModel: "gpt-5.4"
|
|
111
|
+
},
|
|
112
|
+
opencode: {
|
|
113
|
+
binary: "opencode",
|
|
114
|
+
launchMode: "exec",
|
|
115
|
+
autoApproveFlag: "--dangerously-skip-permissions",
|
|
116
|
+
inlineFlag: "",
|
|
117
|
+
apiKeyEnv: "ANTHROPIC_API_KEY",
|
|
118
|
+
defaultModel: "anthropic/claude-sonnet-4-6"
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
DEFAULT_RUNTIME = "claude";
|
|
109
122
|
}
|
|
110
|
-
};
|
|
111
|
-
var DEFAULT_RUNTIME = "claude";
|
|
123
|
+
});
|
|
112
124
|
|
|
113
125
|
// 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
|
-
};
|
|
126
|
+
import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync2, mkdirSync } from "fs";
|
|
127
|
+
import path2 from "path";
|
|
125
128
|
function loadAgentConfig() {
|
|
126
129
|
if (!existsSync2(AGENT_CONFIG_PATH)) return {};
|
|
127
130
|
try {
|
|
@@ -167,8 +170,32 @@ function clearAgentRuntime(agentId) {
|
|
|
167
170
|
delete config[agentId];
|
|
168
171
|
saveAgentConfig(config);
|
|
169
172
|
}
|
|
173
|
+
var AGENT_CONFIG_PATH, KNOWN_RUNTIMES, DEFAULT_MODELS;
|
|
174
|
+
var init_agent_config = __esm({
|
|
175
|
+
"src/lib/agent-config.ts"() {
|
|
176
|
+
"use strict";
|
|
177
|
+
init_config();
|
|
178
|
+
init_runtime_table();
|
|
179
|
+
AGENT_CONFIG_PATH = path2.join(EXE_AI_DIR, "agent-config.json");
|
|
180
|
+
KNOWN_RUNTIMES = {
|
|
181
|
+
claude: ["claude-opus-4", "claude-sonnet-4", "claude-haiku-4.5"],
|
|
182
|
+
codex: ["gpt-5.4", "gpt-5.5", "gpt-5.3-codex-spark", "o3", "o4-mini"],
|
|
183
|
+
opencode: ["anthropic/claude-sonnet-4-6", "openai/gpt-5.4", "google/gemini-2.5-pro", "deepseek/deepseek-r3", "minimax/minimax-m2.5"]
|
|
184
|
+
};
|
|
185
|
+
DEFAULT_MODELS = {
|
|
186
|
+
claude: "claude-opus-4",
|
|
187
|
+
codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
|
|
188
|
+
opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// src/bin/exe-agent-config.ts
|
|
194
|
+
init_agent_config();
|
|
195
|
+
init_runtime_table();
|
|
170
196
|
|
|
171
197
|
// src/lib/employees.ts
|
|
198
|
+
init_config();
|
|
172
199
|
import { readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2 } from "fs/promises";
|
|
173
200
|
import { existsSync as existsSync3, symlinkSync, readlinkSync, readFileSync as readFileSync3, renameSync as renameSync2, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
174
201
|
import { execSync } from "child_process";
|
|
@@ -183,6 +210,7 @@ function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
|
|
|
183
210
|
return [];
|
|
184
211
|
}
|
|
185
212
|
}
|
|
213
|
+
var IDENTITY_DIR = path3.join(EXE_AI_DIR, "identity");
|
|
186
214
|
|
|
187
215
|
// src/bin/exe-agent-config.ts
|
|
188
216
|
function showAll() {
|
package/dist/bin/exe-agent.js
CHANGED
|
@@ -98,8 +98,8 @@ var init_config = __esm({
|
|
|
98
98
|
// src/bin/exe-agent.ts
|
|
99
99
|
import { createInterface } from "readline";
|
|
100
100
|
import { readFileSync as readFileSync3 } from "fs";
|
|
101
|
-
import
|
|
102
|
-
import
|
|
101
|
+
import path10 from "path";
|
|
102
|
+
import os5 from "os";
|
|
103
103
|
|
|
104
104
|
// src/runtime/external-agent-mode.ts
|
|
105
105
|
var HARD_BLOCKED_TOOLS = /* @__PURE__ */ new Set([
|
|
@@ -1264,6 +1264,22 @@ import { execSync } from "child_process";
|
|
|
1264
1264
|
import path2 from "path";
|
|
1265
1265
|
import os2 from "os";
|
|
1266
1266
|
var EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
|
|
1267
|
+
var IDENTITY_DIR = path2.join(EXE_AI_DIR, "identity");
|
|
1268
|
+
|
|
1269
|
+
// src/lib/database-adapter.ts
|
|
1270
|
+
import os3 from "os";
|
|
1271
|
+
import path3 from "path";
|
|
1272
|
+
import { createRequire } from "module";
|
|
1273
|
+
import { pathToFileURL } from "url";
|
|
1274
|
+
var BOOLEAN_COLUMNS_BY_TABLE = {
|
|
1275
|
+
memories: /* @__PURE__ */ new Set(["has_error", "draft"]),
|
|
1276
|
+
behaviors: /* @__PURE__ */ new Set(["active"]),
|
|
1277
|
+
notifications: /* @__PURE__ */ new Set(["read"]),
|
|
1278
|
+
users: /* @__PURE__ */ new Set(["has_personal_memory"])
|
|
1279
|
+
};
|
|
1280
|
+
var BOOLEAN_COLUMN_NAMES = new Set(
|
|
1281
|
+
Object.values(BOOLEAN_COLUMNS_BY_TABLE).flatMap((cols) => [...cols])
|
|
1282
|
+
);
|
|
1267
1283
|
|
|
1268
1284
|
// src/lib/platform-procedures.ts
|
|
1269
1285
|
var PLATFORM_PROCEDURES = [
|
|
@@ -1719,13 +1735,13 @@ var BashTool = {
|
|
|
1719
1735
|
|
|
1720
1736
|
// src/runtime/tools/file-read.ts
|
|
1721
1737
|
import fs from "fs/promises";
|
|
1722
|
-
import
|
|
1738
|
+
import path5 from "path";
|
|
1723
1739
|
import { z as z2 } from "zod";
|
|
1724
1740
|
|
|
1725
1741
|
// src/runtime/safety-checks.ts
|
|
1726
|
-
import
|
|
1727
|
-
import
|
|
1728
|
-
var HOME =
|
|
1742
|
+
import path4 from "path";
|
|
1743
|
+
import os4 from "os";
|
|
1744
|
+
var HOME = os4.homedir();
|
|
1729
1745
|
var BYPASS_IMMUNE_PATTERNS = [
|
|
1730
1746
|
{
|
|
1731
1747
|
pattern: /\/\.git\/hooks\//,
|
|
@@ -1736,11 +1752,11 @@ var BYPASS_IMMUNE_PATTERNS = [
|
|
|
1736
1752
|
reason: "Git config can set hooks and command execution"
|
|
1737
1753
|
},
|
|
1738
1754
|
{
|
|
1739
|
-
pattern: (p) => p.startsWith(
|
|
1755
|
+
pattern: (p) => p.startsWith(path4.join(HOME, ".claude")),
|
|
1740
1756
|
reason: "Claude configuration files are protected"
|
|
1741
1757
|
},
|
|
1742
1758
|
{
|
|
1743
|
-
pattern: (p) => p.startsWith(
|
|
1759
|
+
pattern: (p) => p.startsWith(path4.join(HOME, ".exe-os")),
|
|
1744
1760
|
reason: "exe-os configuration files are protected"
|
|
1745
1761
|
},
|
|
1746
1762
|
{
|
|
@@ -1757,7 +1773,7 @@ var BYPASS_IMMUNE_PATTERNS = [
|
|
|
1757
1773
|
},
|
|
1758
1774
|
{
|
|
1759
1775
|
pattern: (p) => {
|
|
1760
|
-
const name =
|
|
1776
|
+
const name = path4.basename(p);
|
|
1761
1777
|
return [".bashrc", ".zshrc", ".profile", ".bash_profile", ".zprofile", ".zshenv"].includes(name);
|
|
1762
1778
|
},
|
|
1763
1779
|
reason: "Shell configuration files can execute arbitrary code on login"
|
|
@@ -1776,7 +1792,7 @@ var BYPASS_IMMUNE_PATTERNS = [
|
|
|
1776
1792
|
}
|
|
1777
1793
|
];
|
|
1778
1794
|
function checkPathSafety(filePath) {
|
|
1779
|
-
const resolved =
|
|
1795
|
+
const resolved = path4.resolve(filePath);
|
|
1780
1796
|
for (const { pattern, reason } of BYPASS_IMMUNE_PATTERNS) {
|
|
1781
1797
|
const matches = typeof pattern === "function" ? pattern(resolved) : pattern.test(resolved);
|
|
1782
1798
|
if (matches) {
|
|
@@ -1786,7 +1802,7 @@ function checkPathSafety(filePath) {
|
|
|
1786
1802
|
return { safe: true, bypassImmune: true };
|
|
1787
1803
|
}
|
|
1788
1804
|
function checkReadPathSafety(filePath) {
|
|
1789
|
-
const resolved =
|
|
1805
|
+
const resolved = path4.resolve(filePath);
|
|
1790
1806
|
const credPatterns = BYPASS_IMMUNE_PATTERNS.filter(
|
|
1791
1807
|
(p) => typeof p.pattern !== "function" && (p.reason.includes("secrets") || p.reason.includes("Private key") || p.reason.includes("Credential"))
|
|
1792
1808
|
);
|
|
@@ -1822,7 +1838,7 @@ var FileReadTool = {
|
|
|
1822
1838
|
return { behavior: "allow" };
|
|
1823
1839
|
},
|
|
1824
1840
|
async call(input, context) {
|
|
1825
|
-
const filePath =
|
|
1841
|
+
const filePath = path5.isAbsolute(input.file_path) ? input.file_path : path5.resolve(context.cwd, input.file_path);
|
|
1826
1842
|
let stat;
|
|
1827
1843
|
try {
|
|
1828
1844
|
stat = await fs.stat(filePath);
|
|
@@ -1862,7 +1878,7 @@ function isBinary(buf) {
|
|
|
1862
1878
|
|
|
1863
1879
|
// src/runtime/tools/file-edit.ts
|
|
1864
1880
|
import fs2 from "fs/promises";
|
|
1865
|
-
import
|
|
1881
|
+
import path6 from "path";
|
|
1866
1882
|
import { z as z3 } from "zod";
|
|
1867
1883
|
var inputSchema3 = z3.object({
|
|
1868
1884
|
file_path: z3.string(),
|
|
@@ -1887,7 +1903,7 @@ var FileEditTool = {
|
|
|
1887
1903
|
return { behavior: "allow" };
|
|
1888
1904
|
},
|
|
1889
1905
|
async call(input, context) {
|
|
1890
|
-
const filePath =
|
|
1906
|
+
const filePath = path6.isAbsolute(input.file_path) ? input.file_path : path6.resolve(context.cwd, input.file_path);
|
|
1891
1907
|
let content;
|
|
1892
1908
|
try {
|
|
1893
1909
|
content = await fs2.readFile(filePath, "utf-8");
|
|
@@ -1936,7 +1952,7 @@ function countOccurrences(haystack, needle) {
|
|
|
1936
1952
|
|
|
1937
1953
|
// src/runtime/tools/file-write.ts
|
|
1938
1954
|
import fs3 from "fs/promises";
|
|
1939
|
-
import
|
|
1955
|
+
import path7 from "path";
|
|
1940
1956
|
import { z as z4 } from "zod";
|
|
1941
1957
|
var inputSchema4 = z4.object({
|
|
1942
1958
|
file_path: z4.string(),
|
|
@@ -1959,8 +1975,8 @@ var FileWriteTool = {
|
|
|
1959
1975
|
return { behavior: "allow" };
|
|
1960
1976
|
},
|
|
1961
1977
|
async call(input, context) {
|
|
1962
|
-
const filePath =
|
|
1963
|
-
const dir =
|
|
1978
|
+
const filePath = path7.isAbsolute(input.file_path) ? input.file_path : path7.resolve(context.cwd, input.file_path);
|
|
1979
|
+
const dir = path7.dirname(filePath);
|
|
1964
1980
|
await fs3.mkdir(dir, { recursive: true });
|
|
1965
1981
|
await fs3.writeFile(filePath, input.content, "utf-8");
|
|
1966
1982
|
return {
|
|
@@ -1972,7 +1988,7 @@ var FileWriteTool = {
|
|
|
1972
1988
|
|
|
1973
1989
|
// src/runtime/tools/glob.ts
|
|
1974
1990
|
import fs4 from "fs/promises";
|
|
1975
|
-
import
|
|
1991
|
+
import path8 from "path";
|
|
1976
1992
|
import { z as z5 } from "zod";
|
|
1977
1993
|
var inputSchema5 = z5.object({
|
|
1978
1994
|
pattern: z5.string(),
|
|
@@ -1984,11 +2000,11 @@ var GlobTool = {
|
|
|
1984
2000
|
inputSchema: inputSchema5,
|
|
1985
2001
|
isReadOnly: true,
|
|
1986
2002
|
async call(input, context) {
|
|
1987
|
-
const baseDir = input.path ?
|
|
2003
|
+
const baseDir = input.path ? path8.isAbsolute(input.path) ? input.path : path8.resolve(context.cwd, input.path) : context.cwd;
|
|
1988
2004
|
try {
|
|
1989
2005
|
const entries = await walkDir(baseDir);
|
|
1990
2006
|
const matched = entries.filter(
|
|
1991
|
-
(e) => simpleGlobMatch(
|
|
2007
|
+
(e) => simpleGlobMatch(path8.relative(baseDir, e.path), input.pattern)
|
|
1992
2008
|
);
|
|
1993
2009
|
matched.sort((a, b) => b.mtime - a.mtime);
|
|
1994
2010
|
if (matched.length === 0) {
|
|
@@ -2018,7 +2034,7 @@ async function walkDir(dir, maxDepth = 10) {
|
|
|
2018
2034
|
if (entry.isDirectory() && (entry.name === "node_modules" || entry.name === ".git")) {
|
|
2019
2035
|
continue;
|
|
2020
2036
|
}
|
|
2021
|
-
const fullPath =
|
|
2037
|
+
const fullPath = path8.join(current, entry.name);
|
|
2022
2038
|
if (entry.isDirectory()) {
|
|
2023
2039
|
await walk(fullPath, depth + 1);
|
|
2024
2040
|
} else {
|
|
@@ -2042,7 +2058,7 @@ function simpleGlobMatch(filePath, pattern) {
|
|
|
2042
2058
|
// src/runtime/tools/grep.ts
|
|
2043
2059
|
import { spawn as spawn2 } from "child_process";
|
|
2044
2060
|
import fs5 from "fs/promises";
|
|
2045
|
-
import
|
|
2061
|
+
import path9 from "path";
|
|
2046
2062
|
import { z as z6 } from "zod";
|
|
2047
2063
|
var inputSchema6 = z6.object({
|
|
2048
2064
|
pattern: z6.string(),
|
|
@@ -2056,7 +2072,7 @@ var GrepTool = {
|
|
|
2056
2072
|
inputSchema: inputSchema6,
|
|
2057
2073
|
isReadOnly: true,
|
|
2058
2074
|
async call(input, context) {
|
|
2059
|
-
const searchPath = input.path ?
|
|
2075
|
+
const searchPath = input.path ? path9.isAbsolute(input.path) ? input.path : path9.resolve(context.cwd, input.path) : context.cwd;
|
|
2060
2076
|
try {
|
|
2061
2077
|
const result = await runRipgrep(input, searchPath, context);
|
|
2062
2078
|
return result;
|
|
@@ -2124,7 +2140,7 @@ async function nodeGrep(input, searchPath) {
|
|
|
2124
2140
|
}
|
|
2125
2141
|
for (const entry of entries) {
|
|
2126
2142
|
if (entry.name === "node_modules" || entry.name === ".git") continue;
|
|
2127
|
-
const fullPath =
|
|
2143
|
+
const fullPath = path9.join(dir, entry.name);
|
|
2128
2144
|
if (entry.isDirectory()) {
|
|
2129
2145
|
await walk(fullPath);
|
|
2130
2146
|
} else {
|
|
@@ -2171,7 +2187,7 @@ function parseArgs(argv) {
|
|
|
2171
2187
|
}
|
|
2172
2188
|
function loadEmployee(name) {
|
|
2173
2189
|
try {
|
|
2174
|
-
const rosterPath =
|
|
2190
|
+
const rosterPath = path10.join(os5.homedir(), ".exe-os", "exe-employees.json");
|
|
2175
2191
|
const roster = JSON.parse(readFileSync3(rosterPath, "utf8"));
|
|
2176
2192
|
return roster.find((e) => e.name.toLowerCase() === name.toLowerCase()) ?? null;
|
|
2177
2193
|
} catch {
|