@askexenow/exe-os 0.9.84 → 0.9.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/bin/agentic-ontology-backfill.js +32 -14
  2. package/dist/bin/agentic-reflection-backfill.js +32 -14
  3. package/dist/bin/agentic-semantic-label.js +32 -14
  4. package/dist/bin/backfill-conversations.js +32 -14
  5. package/dist/bin/backfill-responses.js +32 -14
  6. package/dist/bin/backfill-vectors.js +32 -14
  7. package/dist/bin/bulk-sync-postgres.js +32 -14
  8. package/dist/bin/cleanup-stale-review-tasks.js +35 -17
  9. package/dist/bin/cli.js +224 -86
  10. package/dist/bin/exe-assign.js +32 -14
  11. package/dist/bin/exe-boot.js +57 -39
  12. package/dist/bin/exe-cloud.js +22 -4
  13. package/dist/bin/exe-dispatch.js +43 -25
  14. package/dist/bin/exe-doctor.js +22 -4
  15. package/dist/bin/exe-export-behaviors.js +32 -14
  16. package/dist/bin/exe-forget.js +32 -14
  17. package/dist/bin/exe-gateway.js +47 -29
  18. package/dist/bin/exe-heartbeat.js +37 -19
  19. package/dist/bin/exe-kill.js +36 -18
  20. package/dist/bin/exe-launch-agent.js +170 -79
  21. package/dist/bin/exe-new-employee.js +32 -0
  22. package/dist/bin/exe-pending-messages.js +35 -17
  23. package/dist/bin/exe-pending-notifications.js +35 -17
  24. package/dist/bin/exe-pending-reviews.js +37 -19
  25. package/dist/bin/exe-rename.js +34 -16
  26. package/dist/bin/exe-review.js +32 -14
  27. package/dist/bin/exe-search.js +40 -22
  28. package/dist/bin/exe-session-cleanup.js +67 -44
  29. package/dist/bin/exe-start-codex.js +39 -21
  30. package/dist/bin/exe-start-opencode.js +37 -19
  31. package/dist/bin/exe-status.js +44 -26
  32. package/dist/bin/exe-team.js +32 -14
  33. package/dist/bin/git-sweep.js +45 -27
  34. package/dist/bin/graph-backfill.js +32 -14
  35. package/dist/bin/graph-export.js +32 -14
  36. package/dist/bin/install.js +32 -0
  37. package/dist/bin/intercom-check.js +49 -31
  38. package/dist/bin/scan-tasks.js +45 -27
  39. package/dist/bin/setup.js +29 -11
  40. package/dist/bin/shard-migrate.js +32 -14
  41. package/dist/bin/stack-update.js +95 -7
  42. package/dist/bin/update.js +1 -1
  43. package/dist/gateway/index.js +47 -29
  44. package/dist/hooks/bug-report-worker.js +47 -29
  45. package/dist/hooks/codex-stop-task-finalizer.js +41 -23
  46. package/dist/hooks/commit-complete.js +46 -28
  47. package/dist/hooks/error-recall.js +44 -26
  48. package/dist/hooks/ingest-worker.js +4 -4
  49. package/dist/hooks/ingest.js +38 -20
  50. package/dist/hooks/instructions-loaded.js +32 -14
  51. package/dist/hooks/notification.js +32 -14
  52. package/dist/hooks/post-compact.js +32 -14
  53. package/dist/hooks/post-tool-combined.js +45 -27
  54. package/dist/hooks/pre-compact.js +43 -25
  55. package/dist/hooks/pre-tool-use.js +40 -22
  56. package/dist/hooks/prompt-submit.js +60 -42
  57. package/dist/hooks/session-end.js +48 -30
  58. package/dist/hooks/session-start.js +50 -32
  59. package/dist/hooks/stop.js +35 -17
  60. package/dist/hooks/subagent-stop.js +32 -14
  61. package/dist/hooks/summary-worker.js +37 -19
  62. package/dist/index.js +43 -25
  63. package/dist/lib/cloud-sync.js +32 -14
  64. package/dist/lib/database.js +22 -4
  65. package/dist/lib/db-daemon-client.js +16 -4
  66. package/dist/lib/db.js +22 -4
  67. package/dist/lib/device-registry.js +22 -4
  68. package/dist/lib/embedder.js +16 -4
  69. package/dist/lib/exe-daemon-client.js +16 -4
  70. package/dist/lib/exe-daemon.js +165 -66
  71. package/dist/lib/hybrid-search.js +40 -22
  72. package/dist/lib/schedules.js +35 -17
  73. package/dist/lib/skill-learning.js +16 -4
  74. package/dist/lib/store.js +32 -14
  75. package/dist/lib/tasks.js +16 -4
  76. package/dist/lib/tmux-routing.js +18 -6
  77. package/dist/mcp/server.js +142 -60
  78. package/dist/mcp/tools/create-task.js +18 -6
  79. package/dist/mcp/tools/update-task.js +18 -6
  80. package/dist/runtime/index.js +43 -25
  81. package/dist/tui/App.js +73 -55
  82. package/package.json +1 -1
@@ -1090,7 +1090,7 @@ __export(exe_daemon_client_exports, {
1090
1090
  });
1091
1091
  import net from "net";
1092
1092
  import os4 from "os";
1093
- import { spawn } from "child_process";
1093
+ import { spawn, execSync as execSync2 } from "child_process";
1094
1094
  import { randomUUID } from "crypto";
1095
1095
  import { existsSync as existsSync5, unlinkSync as unlinkSync2, readFileSync as readFileSync4, openSync, closeSync, statSync } from "fs";
1096
1096
  import path5 from "path";
@@ -1120,6 +1120,14 @@ function handleData(chunk) {
1120
1120
  }
1121
1121
  }
1122
1122
  }
1123
+ function isZombie(pid) {
1124
+ try {
1125
+ const state = execSync2(`ps -p ${pid} -o state=`, { encoding: "utf8", timeout: 2e3 }).trim();
1126
+ return state.startsWith("Z");
1127
+ } catch {
1128
+ return false;
1129
+ }
1130
+ }
1123
1131
  function cleanupStaleFiles() {
1124
1132
  if (existsSync5(PID_PATH)) {
1125
1133
  try {
@@ -1127,7 +1135,11 @@ function cleanupStaleFiles() {
1127
1135
  if (pid > 0) {
1128
1136
  try {
1129
1137
  process.kill(pid, 0);
1130
- return;
1138
+ if (!isZombie(pid)) {
1139
+ return;
1140
+ }
1141
+ process.stderr.write(`[exed-client] PID ${pid} is a zombie \u2014 cleaning up stale files
1142
+ `);
1131
1143
  } catch {
1132
1144
  }
1133
1145
  }
@@ -1155,8 +1167,8 @@ function findPackageRoot() {
1155
1167
  function getAvailableMemoryGB() {
1156
1168
  if (process.platform === "darwin") {
1157
1169
  try {
1158
- const { execSync: execSync7 } = __require("child_process");
1159
- const vmstat = execSync7("vm_stat", { encoding: "utf8" });
1170
+ const { execSync: execSync8 } = __require("child_process");
1171
+ const vmstat = execSync8("vm_stat", { encoding: "utf8" });
1160
1172
  const pageSize = 16384;
1161
1173
  const pageSizeMatch = vmstat.match(/page size of (\d+) bytes/);
1162
1174
  const actualPageSize = pageSizeMatch ? parseInt(pageSizeMatch[1], 10) : pageSize;
@@ -3146,6 +3158,12 @@ async function disposeDatabase() {
3146
3158
  clearInterval(_walCheckpointTimer);
3147
3159
  _walCheckpointTimer = null;
3148
3160
  }
3161
+ if (_client) {
3162
+ try {
3163
+ await _client.execute("PRAGMA wal_checkpoint(PASSIVE)");
3164
+ } catch {
3165
+ }
3166
+ }
3149
3167
  if (_daemonClient) {
3150
3168
  _daemonClient.close();
3151
3169
  _daemonClient = null;
@@ -3182,7 +3200,7 @@ var init_database = __esm({
3182
3200
  // src/lib/keychain.ts
3183
3201
  import { readFile as readFile3, writeFile as writeFile3, unlink, mkdir as mkdir3, chmod as chmod2 } from "fs/promises";
3184
3202
  import { existsSync as existsSync6, statSync as statSync2 } from "fs";
3185
- import { execSync as execSync2 } from "child_process";
3203
+ import { execSync as execSync3 } from "child_process";
3186
3204
  import path6 from "path";
3187
3205
  import os5 from "os";
3188
3206
  function getKeyDir() {
@@ -3199,13 +3217,13 @@ function linuxSecretAvailable() {
3199
3217
  if (process.platform !== "linux") return false;
3200
3218
  if (linuxSecretAvailability !== null) return linuxSecretAvailability;
3201
3219
  try {
3202
- execSync2("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3220
+ execSync3("command -v secret-tool >/dev/null 2>&1", { timeout: 1e3 });
3203
3221
  } catch {
3204
3222
  linuxSecretAvailability = false;
3205
3223
  return false;
3206
3224
  }
3207
3225
  try {
3208
- execSync2("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3226
+ execSync3("secret-tool search --all exe-os probe >/dev/null 2>&1", { timeout: 1e3 });
3209
3227
  linuxSecretAvailability = true;
3210
3228
  } catch {
3211
3229
  linuxSecretAvailability = false;
@@ -3229,7 +3247,7 @@ function macKeychainGet(service = SERVICE) {
3229
3247
  if (!nativeKeychainAllowed()) return null;
3230
3248
  if (process.platform !== "darwin") return null;
3231
3249
  try {
3232
- return execSync2(
3250
+ return execSync3(
3233
3251
  `security find-generic-password -s "${service}" -a "${ACCOUNT}" -w 2>/dev/null`,
3234
3252
  { encoding: "utf-8", timeout: 5e3 }
3235
3253
  ).trim();
@@ -3242,13 +3260,13 @@ function macKeychainSet(value, service = SERVICE) {
3242
3260
  if (process.platform !== "darwin") return false;
3243
3261
  try {
3244
3262
  try {
3245
- execSync2(
3263
+ execSync3(
3246
3264
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3247
3265
  { timeout: 5e3 }
3248
3266
  );
3249
3267
  } catch {
3250
3268
  }
3251
- execSync2(
3269
+ execSync3(
3252
3270
  `security add-generic-password -s "${service}" -a "${ACCOUNT}" -w "${value}"`,
3253
3271
  { timeout: 5e3 }
3254
3272
  );
@@ -3261,7 +3279,7 @@ function macKeychainDelete(service = SERVICE) {
3261
3279
  if (!nativeKeychainAllowed()) return false;
3262
3280
  if (process.platform !== "darwin") return false;
3263
3281
  try {
3264
- execSync2(
3282
+ execSync3(
3265
3283
  `security delete-generic-password -s "${service}" -a "${ACCOUNT}" 2>/dev/null`,
3266
3284
  { timeout: 5e3 }
3267
3285
  );
@@ -3273,7 +3291,7 @@ function macKeychainDelete(service = SERVICE) {
3273
3291
  function linuxSecretGet(service = SERVICE) {
3274
3292
  if (!linuxSecretAvailable()) return null;
3275
3293
  try {
3276
- return execSync2(
3294
+ return execSync3(
3277
3295
  `secret-tool lookup service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3278
3296
  { encoding: "utf-8", timeout: 5e3 }
3279
3297
  ).trim();
@@ -3284,7 +3302,7 @@ function linuxSecretGet(service = SERVICE) {
3284
3302
  function linuxSecretSet(value, service = SERVICE) {
3285
3303
  if (!linuxSecretAvailable()) return false;
3286
3304
  try {
3287
- execSync2(
3305
+ execSync3(
3288
3306
  `echo -n "${value}" | secret-tool store --label="exe-os master key" service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3289
3307
  { timeout: 5e3 }
3290
3308
  );
@@ -3297,7 +3315,7 @@ function linuxSecretDelete(service = SERVICE) {
3297
3315
  if (!nativeKeychainAllowed()) return false;
3298
3316
  if (process.platform !== "linux") return false;
3299
3317
  try {
3300
- execSync2(
3318
+ execSync3(
3301
3319
  `secret-tool clear service "${service}" account "${ACCOUNT}" 2>/dev/null`,
3302
3320
  { timeout: 5e3 }
3303
3321
  );
@@ -3332,8 +3350,8 @@ function deriveMachineKey() {
3332
3350
  }
3333
3351
  function readMachineId() {
3334
3352
  try {
3335
- const { readFileSync: readFileSync7 } = __require("fs");
3336
- return readFileSync7("/etc/machine-id", "utf-8").trim();
3353
+ const { readFileSync: readFileSync8 } = __require("fs");
3354
+ return readFileSync8("/etc/machine-id", "utf-8").trim();
3337
3355
  } catch {
3338
3356
  return "";
3339
3357
  }
@@ -5473,8 +5491,70 @@ var init_store = __esm({
5473
5491
  }
5474
5492
  });
5475
5493
 
5494
+ // src/lib/runtime-table.ts
5495
+ var RUNTIME_TABLE, DEFAULT_RUNTIME;
5496
+ var init_runtime_table = __esm({
5497
+ "src/lib/runtime-table.ts"() {
5498
+ "use strict";
5499
+ RUNTIME_TABLE = {
5500
+ codex: {
5501
+ binary: "codex",
5502
+ launchMode: "interactive",
5503
+ autoApproveFlag: "--dangerously-bypass-approvals-and-sandbox",
5504
+ inlineFlag: "--no-alt-screen",
5505
+ apiKeyEnv: "OPENAI_API_KEY",
5506
+ defaultModel: "gpt-5.5"
5507
+ },
5508
+ opencode: {
5509
+ binary: "opencode",
5510
+ launchMode: "exec",
5511
+ autoApproveFlag: "--dangerously-skip-permissions",
5512
+ inlineFlag: "",
5513
+ apiKeyEnv: "ANTHROPIC_API_KEY",
5514
+ defaultModel: "anthropic/claude-sonnet-4-6"
5515
+ }
5516
+ };
5517
+ DEFAULT_RUNTIME = "claude";
5518
+ }
5519
+ });
5520
+
5521
+ // src/lib/agent-config.ts
5522
+ import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, existsSync as existsSync9 } from "fs";
5523
+ import path9 from "path";
5524
+ function loadAgentConfig() {
5525
+ if (!existsSync9(AGENT_CONFIG_PATH)) return {};
5526
+ try {
5527
+ return JSON.parse(readFileSync5(AGENT_CONFIG_PATH, "utf-8"));
5528
+ } catch {
5529
+ return {};
5530
+ }
5531
+ }
5532
+ function getAgentRuntime(agentId) {
5533
+ const config = loadAgentConfig();
5534
+ const entry = config[agentId];
5535
+ if (entry) return entry;
5536
+ const orgDefault = config["default"];
5537
+ if (orgDefault) return orgDefault;
5538
+ return { runtime: DEFAULT_RUNTIME, model: DEFAULT_MODELS[DEFAULT_RUNTIME] };
5539
+ }
5540
+ var AGENT_CONFIG_PATH, DEFAULT_MODELS;
5541
+ var init_agent_config = __esm({
5542
+ "src/lib/agent-config.ts"() {
5543
+ "use strict";
5544
+ init_config();
5545
+ init_runtime_table();
5546
+ init_secure_files();
5547
+ AGENT_CONFIG_PATH = path9.join(EXE_AI_DIR, "agent-config.json");
5548
+ DEFAULT_MODELS = {
5549
+ claude: "claude-opus-4.6",
5550
+ codex: RUNTIME_TABLE.codex?.defaultModel ?? "gpt-5.4",
5551
+ opencode: RUNTIME_TABLE.opencode?.defaultModel ?? "anthropic/claude-sonnet-4-6"
5552
+ };
5553
+ }
5554
+ });
5555
+
5476
5556
  // src/lib/session-key.ts
5477
- import { execSync as execSync4 } from "child_process";
5557
+ import { execSync as execSync5 } from "child_process";
5478
5558
  function normalizeCommand(command) {
5479
5559
  const trimmed = command.trim().toLowerCase();
5480
5560
  const parts = trimmed.split(/[\\/]/);
@@ -5493,7 +5573,7 @@ function resolveRuntimeProcess() {
5493
5573
  let pid = process.ppid;
5494
5574
  for (let i = 0; i < 10; i++) {
5495
5575
  try {
5496
- const info = execSync4(`ps -p ${pid} -o ppid=,comm=`, {
5576
+ const info = execSync5(`ps -p ${pid} -o ppid=,comm=`, {
5497
5577
  encoding: "utf8",
5498
5578
  timeout: 2e3
5499
5579
  }).trim();
@@ -5564,9 +5644,9 @@ __export(active_agent_exports, {
5564
5644
  resolveActiveAgentFromTmuxSession: () => resolveActiveAgentFromTmuxSession,
5565
5645
  writeActiveAgent: () => writeActiveAgent
5566
5646
  });
5567
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4, readdirSync as readdirSync3 } from "fs";
5568
- import { execSync as execSync5 } from "child_process";
5569
- import path9 from "path";
5647
+ import { readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync as unlinkSync4, readdirSync as readdirSync3 } from "fs";
5648
+ import { execSync as execSync6 } from "child_process";
5649
+ import path10 from "path";
5570
5650
  function isNameWithOptionalInstance(candidate, baseName) {
5571
5651
  if (candidate === baseName) return true;
5572
5652
  if (!candidate.startsWith(baseName)) return false;
@@ -5610,12 +5690,12 @@ function resolveActiveAgentFromTmuxSession(sessionName) {
5610
5690
  return null;
5611
5691
  }
5612
5692
  function getMarkerPath() {
5613
- return path9.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
5693
+ return path10.join(CACHE_DIR, `active-agent-${getSessionKey()}.json`);
5614
5694
  }
5615
5695
  function writeActiveAgent(agentId, agentRole) {
5616
5696
  try {
5617
5697
  mkdirSync4(CACHE_DIR, { recursive: true });
5618
- writeFileSync4(
5698
+ writeFileSync5(
5619
5699
  getMarkerPath(),
5620
5700
  JSON.stringify({ agentId, agentRole, startedAt: (/* @__PURE__ */ new Date()).toISOString() })
5621
5701
  );
@@ -5633,7 +5713,7 @@ function getActiveAgent() {
5633
5713
  if (httpCtx) return httpCtx;
5634
5714
  try {
5635
5715
  const markerPath = getMarkerPath();
5636
- const raw = readFileSync5(markerPath, "utf8");
5716
+ const raw = readFileSync6(markerPath, "utf8");
5637
5717
  const data = JSON.parse(raw);
5638
5718
  if (data.agentId) {
5639
5719
  if (data.startedAt) {
@@ -5659,7 +5739,7 @@ function getActiveAgent() {
5659
5739
  } catch {
5660
5740
  }
5661
5741
  try {
5662
- const sessionName = execSync5(
5742
+ const sessionName = execSync6(
5663
5743
  "tmux display-message -p '#{session_name}' 2>/dev/null",
5664
5744
  { encoding: "utf8", timeout: 2e3 }
5665
5745
  ).trim();
@@ -5681,14 +5761,14 @@ function getAllActiveAgents() {
5681
5761
  const key = file.slice("active-agent-".length, -".json".length);
5682
5762
  if (key === "undefined") continue;
5683
5763
  try {
5684
- const raw = readFileSync5(path9.join(CACHE_DIR, file), "utf8");
5764
+ const raw = readFileSync6(path10.join(CACHE_DIR, file), "utf8");
5685
5765
  const data = JSON.parse(raw);
5686
5766
  if (!data.agentId) continue;
5687
5767
  if (data.startedAt) {
5688
5768
  const age = Date.now() - new Date(data.startedAt).getTime();
5689
5769
  if (age > STALE_MS) {
5690
5770
  try {
5691
- unlinkSync4(path9.join(CACHE_DIR, file));
5771
+ unlinkSync4(path10.join(CACHE_DIR, file));
5692
5772
  } catch {
5693
5773
  }
5694
5774
  continue;
@@ -5711,11 +5791,11 @@ function getAllActiveAgents() {
5711
5791
  function cleanupSessionMarkers() {
5712
5792
  const key = getSessionKey();
5713
5793
  try {
5714
- unlinkSync4(path9.join(CACHE_DIR, `active-agent-${key}.json`));
5794
+ unlinkSync4(path10.join(CACHE_DIR, `active-agent-${key}.json`));
5715
5795
  } catch {
5716
5796
  }
5717
5797
  try {
5718
- unlinkSync4(path9.join(CACHE_DIR, "active-agent-undefined.json"));
5798
+ unlinkSync4(path10.join(CACHE_DIR, "active-agent-undefined.json"));
5719
5799
  } catch {
5720
5800
  }
5721
5801
  }
@@ -5727,7 +5807,7 @@ var init_active_agent = __esm({
5727
5807
  init_session_key();
5728
5808
  init_agent_context();
5729
5809
  init_employees();
5730
- CACHE_DIR = path9.join(EXE_AI_DIR, "session-cache");
5810
+ CACHE_DIR = path10.join(EXE_AI_DIR, "session-cache");
5731
5811
  STALE_MS = 24 * 60 * 60 * 1e3;
5732
5812
  }
5733
5813
  });
@@ -5735,8 +5815,8 @@ var init_active_agent = __esm({
5735
5815
  // src/bin/exe-launch-agent.ts
5736
5816
  init_store();
5737
5817
  import os7 from "os";
5738
- import path10 from "path";
5739
- import { existsSync as existsSync9, readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync4 } from "fs";
5818
+ import path11 from "path";
5819
+ import { existsSync as existsSync10, readFileSync as readFileSync7, writeFileSync as writeFileSync6, mkdirSync as mkdirSync5, readdirSync as readdirSync4 } from "fs";
5740
5820
  import { spawnSync } from "child_process";
5741
5821
 
5742
5822
  // src/bin/fast-db-init.ts
@@ -6074,7 +6154,7 @@ ${BASE_OPERATING_PROCEDURES}`;
6074
6154
  }
6075
6155
 
6076
6156
  // src/lib/cc-agent-support.ts
6077
- import { execSync as execSync3 } from "child_process";
6157
+ import { execSync as execSync4 } from "child_process";
6078
6158
  var _cachedSupport = null;
6079
6159
  function _resetCcAgentSupportCache() {
6080
6160
  _cachedSupport = null;
@@ -6082,7 +6162,7 @@ function _resetCcAgentSupportCache() {
6082
6162
  function claudeSupportsAgentFlag() {
6083
6163
  if (_cachedSupport !== null) return _cachedSupport;
6084
6164
  try {
6085
- const helpOutput = execSync3("claude --help 2>&1", {
6165
+ const helpOutput = execSync4("claude --help 2>&1", {
6086
6166
  encoding: "utf-8",
6087
6167
  timeout: 5e3
6088
6168
  });
@@ -6095,7 +6175,7 @@ function claudeSupportsAgentFlag() {
6095
6175
 
6096
6176
  // src/bin/exe-launch-agent.ts
6097
6177
  init_employees();
6098
- import { execSync as execSync6 } from "child_process";
6178
+ import { execSync as execSync7 } from "child_process";
6099
6179
 
6100
6180
  // src/lib/provider-table.ts
6101
6181
  var PROVIDER_TABLE = {
@@ -6108,6 +6188,7 @@ var PROVIDER_TABLE = {
6108
6188
  var DEFAULT_PROVIDER = "default";
6109
6189
 
6110
6190
  // src/bin/exe-launch-agent.ts
6191
+ init_agent_config();
6111
6192
  function getKnownAgents() {
6112
6193
  try {
6113
6194
  return loadEmployeesSync().map((e) => e.name);
@@ -6125,7 +6206,7 @@ function parseBasename(basename) {
6125
6206
  return { agent, provider };
6126
6207
  }
6127
6208
  function resolveAgent(argv) {
6128
- const invokedAs = path10.basename(argv[1] ?? "");
6209
+ const invokedAs = path11.basename(argv[1] ?? "");
6129
6210
  if (invokedAs && invokedAs !== "exe-launch-agent" && !invokedAs.endsWith(".js")) {
6130
6211
  const { agent: agent2, provider } = parseBasename(invokedAs.toLowerCase());
6131
6212
  return { agent: agent2, provider, passthrough: argv.slice(2) };
@@ -6154,13 +6235,13 @@ async function isKnownAgent(agent) {
6154
6235
  }
6155
6236
  }
6156
6237
  function identityPathFor(agent) {
6157
- const dir = path10.join(os7.homedir(), ".exe-os", "identity");
6158
- const exactPath = path10.join(dir, `${agent}.md`);
6159
- if (existsSync9(exactPath)) return exactPath;
6238
+ const dir = path11.join(os7.homedir(), ".exe-os", "identity");
6239
+ const exactPath = path11.join(dir, `${agent}.md`);
6240
+ if (existsSync10(exactPath)) return exactPath;
6160
6241
  try {
6161
6242
  const files = readdirSync4(dir);
6162
6243
  const match = files.find((f) => f.toLowerCase() === `${agent.toLowerCase()}.md`);
6163
- if (match) return path10.join(dir, match);
6244
+ if (match) return path11.join(dir, match);
6164
6245
  } catch {
6165
6246
  }
6166
6247
  return exactPath;
@@ -6182,13 +6263,13 @@ function leanMcpEnabled() {
6182
6263
  function collectAllMcpServers() {
6183
6264
  const servers = {};
6184
6265
  const sources = [
6185
- path10.join(os7.homedir(), ".claude.json"),
6186
- path10.join(os7.homedir(), ".claude", "settings.json")
6266
+ path11.join(os7.homedir(), ".claude.json"),
6267
+ path11.join(os7.homedir(), ".claude", "settings.json")
6187
6268
  ];
6188
6269
  for (const src of sources) {
6189
6270
  try {
6190
- if (!existsSync9(src)) continue;
6191
- const data = JSON.parse(readFileSync6(src, "utf-8"));
6271
+ if (!existsSync10(src)) continue;
6272
+ const data = JSON.parse(readFileSync7(src, "utf-8"));
6192
6273
  const block = data.mcpServers;
6193
6274
  if (!block) continue;
6194
6275
  for (const [name, cfg] of Object.entries(block)) {
@@ -6214,18 +6295,18 @@ function generateLeanMcpConfig(agent, role) {
6214
6295
  }
6215
6296
  if (Object.keys(leanServers).length >= Object.keys(allServers).length) return null;
6216
6297
  if (!leanServers["exe-mem"]) {
6217
- const packageRoot = path10.resolve(path10.dirname(new URL(import.meta.url).pathname), "..", "..");
6298
+ const packageRoot = path11.resolve(path11.dirname(new URL(import.meta.url).pathname), "..", "..");
6218
6299
  leanServers["exe-mem"] = {
6219
6300
  type: "stdio",
6220
6301
  command: "node",
6221
- args: [path10.join(packageRoot, "dist", "mcp", "server.js")],
6302
+ args: [path11.join(packageRoot, "dist", "mcp", "server.js")],
6222
6303
  env: {}
6223
6304
  };
6224
6305
  }
6225
- const configDir = path10.join(os7.homedir(), ".exe-os", "mcp-configs");
6306
+ const configDir = path11.join(os7.homedir(), ".exe-os", "mcp-configs");
6226
6307
  mkdirSync5(configDir, { recursive: true });
6227
- const configPath = path10.join(configDir, `${agent}-lean.json`);
6228
- writeFileSync5(configPath, JSON.stringify({ mcpServers: leanServers }, null, 2), "utf-8");
6308
+ const configPath = path11.join(configDir, `${agent}-lean.json`);
6309
+ writeFileSync6(configPath, JSON.stringify({ mcpServers: leanServers }, null, 2), "utf-8");
6229
6310
  const saved = Object.keys(allServers).length - Object.keys(leanServers).length;
6230
6311
  if (saved > 0) {
6231
6312
  process.stderr.write(
@@ -6244,14 +6325,14 @@ function generateLeanMcpConfig(agent, role) {
6244
6325
  }
6245
6326
  function leanMcpConfigFor(agent) {
6246
6327
  if (!leanMcpEnabled()) return null;
6247
- const p = path10.join(os7.homedir(), ".exe-os", "mcp-configs", `${agent}-lean.json`);
6248
- return existsSync9(p) ? p : null;
6328
+ const p = path11.join(os7.homedir(), ".exe-os", "mcp-configs", `${agent}-lean.json`);
6329
+ return existsSync10(p) ? p : null;
6249
6330
  }
6250
6331
  var _ccHelpOutput = null;
6251
6332
  function getCcHelpOutput() {
6252
6333
  if (_ccHelpOutput === null) {
6253
6334
  try {
6254
- const result = execSync6("claude --help 2>&1", { encoding: "utf8", timeout: 5e3 });
6335
+ const result = execSync7("claude --help 2>&1", { encoding: "utf8", timeout: 5e3 });
6255
6336
  _ccHelpOutput = typeof result === "string" ? result : "";
6256
6337
  } catch {
6257
6338
  _ccHelpOutput = "";
@@ -6268,39 +6349,39 @@ function _resetCcHelpCache() {
6268
6349
  function buildLaunchPlan(agent, behaviorsPath, passthrough, _hasAgentFlag, _provider) {
6269
6350
  const args = ["--dangerously-skip-permissions"];
6270
6351
  const idPath = identityPathFor(agent);
6271
- const ccAgentPath = path10.join(os7.homedir(), ".claude", "agents", `${agent}.md`);
6352
+ const ccAgentPath = path11.join(os7.homedir(), ".claude", "agents", `${agent}.md`);
6272
6353
  let effectiveCcPath = null;
6273
- if (existsSync9(ccAgentPath)) {
6354
+ if (existsSync10(ccAgentPath)) {
6274
6355
  effectiveCcPath = ccAgentPath;
6275
6356
  } else {
6276
6357
  try {
6277
- const ccAgentDir = path10.join(os7.homedir(), ".claude", "agents");
6358
+ const ccAgentDir = path11.join(os7.homedir(), ".claude", "agents");
6278
6359
  const ccFiles = readdirSync4(ccAgentDir);
6279
6360
  const ccMatch = ccFiles.find((f) => f.toLowerCase() === `${agent.toLowerCase()}.md`);
6280
- if (ccMatch) effectiveCcPath = path10.join(ccAgentDir, ccMatch);
6361
+ if (ccMatch) effectiveCcPath = path11.join(ccAgentDir, ccMatch);
6281
6362
  } catch {
6282
6363
  }
6283
6364
  }
6284
- const effectiveIdPath = existsSync9(idPath) ? idPath : effectiveCcPath;
6365
+ const effectiveIdPath = existsSync10(idPath) ? idPath : effectiveCcPath;
6285
6366
  let identityContent = null;
6286
- if (effectiveIdPath && existsSync9(effectiveIdPath)) {
6367
+ if (effectiveIdPath && existsSync10(effectiveIdPath)) {
6287
6368
  try {
6288
- const content = readFileSync6(effectiveIdPath, "utf-8");
6369
+ const content = readFileSync7(effectiveIdPath, "utf-8");
6289
6370
  if (content.trim().length > 0) identityContent = content;
6290
6371
  } catch {
6291
6372
  }
6292
6373
  }
6293
6374
  if (!identityContent) {
6294
6375
  try {
6295
- const rosterPath = path10.join(os7.homedir(), ".exe-os", "exe-employees.json");
6296
- if (existsSync9(rosterPath)) {
6297
- const roster = JSON.parse(readFileSync6(rosterPath, "utf8"));
6376
+ const rosterPath = path11.join(os7.homedir(), ".exe-os", "exe-employees.json");
6377
+ if (existsSync10(rosterPath)) {
6378
+ const roster = JSON.parse(readFileSync7(rosterPath, "utf8"));
6298
6379
  const emp = roster.find((e) => e.name.toLowerCase() === agent.toLowerCase());
6299
6380
  if (emp?.systemPrompt && emp.systemPrompt.trim().length > 20) {
6300
6381
  identityContent = emp.systemPrompt;
6301
6382
  try {
6302
- const dir = path10.dirname(idPath);
6303
- if (!existsSync9(dir)) mkdirSync5(dir, { recursive: true });
6383
+ const dir = path11.dirname(idPath);
6384
+ if (!existsSync10(dir)) mkdirSync5(dir, { recursive: true });
6304
6385
  const hasFrontmatter = identityContent.trimStart().startsWith("---");
6305
6386
  const fileContent = hasFrontmatter ? identityContent : `---
6306
6387
  role: ${(emp.role ?? "employee").toLowerCase()}
@@ -6312,7 +6393,7 @@ updated_at: ${(/* @__PURE__ */ new Date()).toISOString()}
6312
6393
  ---
6313
6394
 
6314
6395
  ${identityContent}`;
6315
- writeFileSync5(idPath, fileContent, "utf-8");
6396
+ writeFileSync6(idPath, fileContent, "utf-8");
6316
6397
  identityContent = fileContent;
6317
6398
  process.stderr.write(`[exe-launch-agent] self-healed missing identity file: ${idPath}
6318
6399
  `);
@@ -6340,15 +6421,15 @@ ${identityContent}`;
6340
6421
  args.push("--system-prompt", getSessionPrompt(identityContent));
6341
6422
  } else {
6342
6423
  try {
6343
- const tmpPath = path10.join(os7.homedir(), ".exe-os", "session-cache", `${agent}-identity.md`);
6344
- mkdirSync5(path10.dirname(tmpPath), { recursive: true });
6345
- writeFileSync5(tmpPath, identityContent, "utf-8");
6424
+ const tmpPath = path11.join(os7.homedir(), ".exe-os", "session-cache", `${agent}-identity.md`);
6425
+ mkdirSync5(path11.dirname(tmpPath), { recursive: true });
6426
+ writeFileSync6(tmpPath, identityContent, "utf-8");
6346
6427
  args.push("--append-system-prompt-file", tmpPath);
6347
6428
  } catch {
6348
6429
  }
6349
6430
  }
6350
6431
  }
6351
- if (behaviorsPath && existsSync9(behaviorsPath)) {
6432
+ if (behaviorsPath && existsSync10(behaviorsPath)) {
6352
6433
  args.push("--append-system-prompt-file", behaviorsPath);
6353
6434
  }
6354
6435
  const leanMcp = leanMcpConfigFor(agent);
@@ -6440,28 +6521,28 @@ async function main() {
6440
6521
  _resetCcAgentSupportCache();
6441
6522
  const hasAgentFlag = claudeSupportsAgentFlag();
6442
6523
  if (hasAgentFlag) {
6443
- const ccAgentDir = path10.join(os7.homedir(), ".claude", "agents");
6444
- const ccAgentFile = path10.join(ccAgentDir, `${agent}.md`);
6445
- if (!existsSync9(ccAgentFile)) {
6524
+ const ccAgentDir = path11.join(os7.homedir(), ".claude", "agents");
6525
+ const ccAgentFile = path11.join(ccAgentDir, `${agent}.md`);
6526
+ if (!existsSync10(ccAgentFile)) {
6446
6527
  const exeIdentity = identityPathFor(agent);
6447
6528
  let sourceFile = null;
6448
- if (existsSync9(exeIdentity)) {
6529
+ if (existsSync10(exeIdentity)) {
6449
6530
  sourceFile = exeIdentity;
6450
6531
  } else {
6451
6532
  try {
6452
- const identityDir = path10.dirname(exeIdentity);
6533
+ const identityDir = path11.dirname(exeIdentity);
6453
6534
  const files = readdirSync4(identityDir);
6454
6535
  const match = files.find((f) => f.toLowerCase() === `${agent.toLowerCase()}.md`);
6455
- if (match) sourceFile = path10.join(identityDir, match);
6536
+ if (match) sourceFile = path11.join(identityDir, match);
6456
6537
  } catch {
6457
6538
  }
6458
6539
  }
6459
6540
  if (sourceFile) {
6460
6541
  try {
6461
6542
  mkdirSync5(ccAgentDir, { recursive: true });
6462
- let content = readFileSync6(sourceFile, "utf-8");
6543
+ let content = readFileSync7(sourceFile, "utf-8");
6463
6544
  content = content.replace(/\$\{agent_id\}/g, baseAgentName(agent));
6464
- writeFileSync5(ccAgentFile, content, "utf-8");
6545
+ writeFileSync6(ccAgentFile, content, "utf-8");
6465
6546
  process.stderr.write(
6466
6547
  `[exe-launch-agent] auto-provisioned ${ccAgentFile} from ${sourceFile}
6467
6548
  `
@@ -6474,8 +6555,8 @@ async function main() {
6474
6555
  const memoryAgent = baseAgentName(agent);
6475
6556
  const empRole = (() => {
6476
6557
  try {
6477
- const emps = readFileSync6(
6478
- path10.join(os7.homedir(), ".exe-os", "exe-employees.json"),
6558
+ const emps = readFileSync7(
6559
+ path11.join(os7.homedir(), ".exe-os", "exe-employees.json"),
6479
6560
  "utf-8"
6480
6561
  );
6481
6562
  const found = JSON.parse(emps).find(
@@ -6504,6 +6585,16 @@ async function main() {
6504
6585
  if (!process.env.CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING) {
6505
6586
  process.env.CLAUDE_CODE_DISABLE_ADAPTIVE_THINKING = "1";
6506
6587
  }
6588
+ if (provider === DEFAULT_PROVIDER) {
6589
+ const rtConfig = getAgentRuntime(memoryAgent);
6590
+ if (rtConfig.runtime === "claude" && rtConfig.model) {
6591
+ let ccModel = rtConfig.model.replace(/(\d+)\.(\d+)/g, "$1-$2");
6592
+ if (/claude-(opus|sonnet)-4-[6-9]/.test(ccModel) && !ccModel.includes("[1m]")) {
6593
+ ccModel += "[1m]";
6594
+ }
6595
+ process.env.ANTHROPIC_MODEL = ccModel;
6596
+ }
6597
+ }
6507
6598
  const child = spawnSync(plan.command, plan.args, { stdio: "inherit" });
6508
6599
  if (child.error) {
6509
6600
  const err = child.error;
@@ -1662,6 +1662,7 @@ async function registerMcpServer(packageRoot, homeDir = os8.homedir()) {
1662
1662
  `
1663
1663
  );
1664
1664
  }
1665
+ await registerExeRustMcpConfig(packageRoot, homeDir);
1665
1666
  return false;
1666
1667
  }
1667
1668
  claudeJson.mcpServers[MCP_PRIMARY_KEY] = newEntry;
@@ -1675,8 +1676,39 @@ async function registerMcpServer(packageRoot, homeDir = os8.homedir()) {
1675
1676
  `
1676
1677
  );
1677
1678
  }
1679
+ await registerExeRustMcpConfig(packageRoot, homeDir);
1678
1680
  return true;
1679
1681
  }
1682
+ async function registerExeRustMcpConfig(packageRoot, homeDir) {
1683
+ const exeDir = path12.join(homeDir, ".exe");
1684
+ const exeMcpPath = path12.join(exeDir, "mcp.json");
1685
+ await mkdir3(exeDir, { recursive: true });
1686
+ let config = { servers: {} };
1687
+ if (existsSync12(exeMcpPath)) {
1688
+ try {
1689
+ config = JSON.parse(await readFile3(exeMcpPath, "utf-8"));
1690
+ if (!config.servers) config.servers = {};
1691
+ } catch {
1692
+ config = { servers: {} };
1693
+ }
1694
+ }
1695
+ const stdioEntry = {
1696
+ command: "node",
1697
+ args: [path12.join(packageRoot, "dist", "mcp", "server.js")],
1698
+ env: {},
1699
+ shared: true
1700
+ };
1701
+ const existing = config.servers[MCP_PRIMARY_KEY];
1702
+ if (existing && JSON.stringify(existing) === JSON.stringify(stdioEntry)) {
1703
+ return;
1704
+ }
1705
+ if (config.servers[MCP_LEGACY_KEY]) {
1706
+ delete config.servers[MCP_LEGACY_KEY];
1707
+ }
1708
+ config.servers[MCP_PRIMARY_KEY] = stdioEntry;
1709
+ await writeFile3(exeMcpPath, JSON.stringify(config, null, 2) + "\n");
1710
+ process.stderr.write("exe-os: registered MCP server in ~/.exe/mcp.json (Rust runtime)\n");
1711
+ }
1680
1712
  async function cleanSettingsJsonMcp(settingsPath) {
1681
1713
  if (!existsSync12(settingsPath)) return;
1682
1714
  try {