@askexenow/exe-os 0.9.46 → 0.9.48

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/cli.js CHANGED
@@ -825,8 +825,8 @@ __export(installer_exports, {
825
825
  setupTmux: () => setupTmux
826
826
  });
827
827
  import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3, readdir } from "fs/promises";
828
- import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync4, copyFileSync, mkdirSync as mkdirSync3 } from "fs";
829
- import { createHash } from "crypto";
828
+ import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync4, copyFileSync, mkdirSync as mkdirSync3, chmodSync as chmodSync2 } from "fs";
829
+ import { createHash, randomBytes } from "crypto";
830
830
  import path6 from "path";
831
831
  import os5 from "os";
832
832
  import { execSync as execSync2 } from "child_process";
@@ -955,6 +955,55 @@ function detectMcpNameCollisions(homeDir = os5.homedir(), cwd2 = process.cwd())
955
955
  }
956
956
  return collisions;
957
957
  }
958
+ function readOrCreateDaemonToken(homeDir) {
959
+ const exeDir = path6.join(homeDir, ".exe-os");
960
+ const tokenPath = path6.join(exeDir, "exed.token");
961
+ try {
962
+ if (existsSync7(tokenPath)) {
963
+ const token2 = readFileSync5(tokenPath, "utf-8").trim();
964
+ if (token2) return token2;
965
+ }
966
+ } catch {
967
+ }
968
+ const token = randomBytes(32).toString("hex");
969
+ mkdirSync3(exeDir, { recursive: true });
970
+ writeFileSync4(tokenPath, `${token}
971
+ `, "utf-8");
972
+ try {
973
+ chmodSync2(tokenPath, 384);
974
+ } catch {
975
+ }
976
+ return token;
977
+ }
978
+ function buildHttpMcpEntry(homeDir) {
979
+ const port = process.env.EXE_MCP_PORT || "48739";
980
+ const token = readOrCreateDaemonToken(homeDir);
981
+ return {
982
+ type: "http",
983
+ url: `http://127.0.0.1:${port}/mcp`,
984
+ headers: {
985
+ Authorization: `Bearer ${token}`,
986
+ "X-Agent-Id": "${AGENT_ID:-exe}",
987
+ "X-Agent-Role": "${AGENT_ROLE:-COO}"
988
+ }
989
+ };
990
+ }
991
+ function buildStdioMcpEntry(packageRoot) {
992
+ return {
993
+ type: "stdio",
994
+ command: "node",
995
+ args: [path6.join(packageRoot, "dist", "mcp", "server.js")],
996
+ env: {}
997
+ };
998
+ }
999
+ function mcpTransportMode() {
1000
+ const value = process.env.EXE_OS_MCP_TRANSPORT?.trim().toLowerCase();
1001
+ if (value === "stdio") return "stdio";
1002
+ if (value === "http") return "http";
1003
+ const totalGB = os5.totalmem() / (1024 * 1024 * 1024);
1004
+ if (totalGB <= 8) return "stdio";
1005
+ return "http";
1006
+ }
958
1007
  async function registerMcpServer(packageRoot, homeDir = os5.homedir()) {
959
1008
  const claudeJsonPath = path6.join(homeDir, ".claude.json");
960
1009
  let claudeJson = {};
@@ -968,12 +1017,7 @@ async function registerMcpServer(packageRoot, homeDir = os5.homedir()) {
968
1017
  if (!claudeJson.mcpServers) {
969
1018
  claudeJson.mcpServers = {};
970
1019
  }
971
- const newEntry = {
972
- type: "stdio",
973
- command: "node",
974
- args: [path6.join(packageRoot, "dist", "mcp", "server.js")],
975
- env: {}
976
- };
1020
+ const newEntry = mcpTransportMode() === "stdio" ? buildStdioMcpEntry(packageRoot) : buildHttpMcpEntry(homeDir);
977
1021
  if (claudeJson.mcpServers[MCP_LEGACY_KEY]) {
978
1022
  delete claudeJson.mcpServers[MCP_LEGACY_KEY];
979
1023
  process.stderr.write("exe-os: migrated MCP server key exe-mem \u2192 exe-os\n");
@@ -15365,7 +15409,7 @@ import {
15365
15409
  readFileSync as readFileSync22,
15366
15410
  writeFileSync as writeFileSync18,
15367
15411
  mkdirSync as mkdirSync17,
15368
- chmodSync as chmodSync2,
15412
+ chmodSync as chmodSync3,
15369
15413
  readdirSync as readdirSync9,
15370
15414
  unlinkSync as unlinkSync13
15371
15415
  } from "fs";
@@ -15384,7 +15428,7 @@ function generateSessionWrappers(packageRoot, homeDir) {
15384
15428
  for (const src of candidates) {
15385
15429
  if (existsSync27(src)) {
15386
15430
  writeFileSync18(exeStartDst, readFileSync22(src));
15387
- chmodSync2(exeStartDst, 493);
15431
+ chmodSync3(exeStartDst, 493);
15388
15432
  break;
15389
15433
  }
15390
15434
  }
@@ -15419,11 +15463,11 @@ exec "${exeStartDst}" "$0" "$@"
15419
15463
  for (let n = 1; n <= MAX_N; n++) {
15420
15464
  const wrapperPath = path33.join(binDir, `${emp.name}${n}`);
15421
15465
  writeFileSync18(wrapperPath, wrapperContent);
15422
- chmodSync2(wrapperPath, 493);
15466
+ chmodSync3(wrapperPath, 493);
15423
15467
  created++;
15424
15468
  const codexPath = path33.join(binDir, `${emp.name}${n}-codex`);
15425
15469
  writeFileSync18(codexPath, wrapperContent);
15426
- chmodSync2(codexPath, 493);
15470
+ chmodSync3(codexPath, 493);
15427
15471
  created++;
15428
15472
  }
15429
15473
  }
@@ -15445,7 +15489,7 @@ exec "${exeStartDst}" "$0" "$@"
15445
15489
  exec node "${codexLauncher}" --agent ${emp.name} "$@"
15446
15490
  `;
15447
15491
  writeFileSync18(wrapperPath, content);
15448
- chmodSync2(wrapperPath, 493);
15492
+ chmodSync3(wrapperPath, 493);
15449
15493
  created++;
15450
15494
  }
15451
15495
  }
@@ -4486,7 +4486,11 @@ var DEFAULT_ROLE_MCP_MAP = {
4486
4486
  "content production specialist": ["exe-create"],
4487
4487
  "ai product lead": ["brave-search"]
4488
4488
  };
4489
- var ALWAYS_INCLUDE_SERVERS = ["exe-mem"];
4489
+ var ALWAYS_INCLUDE_SERVERS = ["exe-os", "exe-mem"];
4490
+ function leanMcpEnabled() {
4491
+ const value = process.env.EXE_OS_ENABLE_LEAN_MCP?.trim().toLowerCase();
4492
+ return value === "1" || value === "true" || value === "yes";
4493
+ }
4490
4494
  function collectAllMcpServers() {
4491
4495
  const servers = {};
4492
4496
  const sources = [
@@ -4551,6 +4555,7 @@ function generateLeanMcpConfig(agent, role) {
4551
4555
  }
4552
4556
  }
4553
4557
  function leanMcpConfigFor(agent) {
4558
+ if (!leanMcpEnabled()) return null;
4554
4559
  const p = path10.join(os7.homedir(), ".exe-os", "mcp-configs", `${agent}-lean.json`);
4555
4560
  return existsSync9(p) ? p : null;
4556
4561
  }
@@ -4793,7 +4798,9 @@ async function main() {
4793
4798
  return "employee";
4794
4799
  }
4795
4800
  })();
4796
- generateLeanMcpConfig(memoryAgent, empRole);
4801
+ if (leanMcpEnabled()) {
4802
+ generateLeanMcpConfig(memoryAgent, empRole);
4803
+ }
4797
4804
  const plan = buildLaunchPlan(agent, behaviorsPath, passthrough, hasAgentFlag, provider);
4798
4805
  process.env.AGENT_ID = memoryAgent;
4799
4806
  if (!process.env.EXE_SESSION_KEY) {
@@ -1272,8 +1272,8 @@ __export(installer_exports, {
1272
1272
  setupTmux: () => setupTmux
1273
1273
  });
1274
1274
  import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3, readdir } from "fs/promises";
1275
- import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync7, copyFileSync, mkdirSync as mkdirSync6 } from "fs";
1276
- import { createHash as createHash2 } from "crypto";
1275
+ import { existsSync as existsSync11, readFileSync as readFileSync9, writeFileSync as writeFileSync7, copyFileSync, mkdirSync as mkdirSync6, chmodSync as chmodSync3 } from "fs";
1276
+ import { createHash as createHash2, randomBytes } from "crypto";
1277
1277
  import path11 from "path";
1278
1278
  import os7 from "os";
1279
1279
  import { execSync as execSync2 } from "child_process";
@@ -1402,6 +1402,55 @@ function detectMcpNameCollisions(homeDir = os7.homedir(), cwd = process.cwd()) {
1402
1402
  }
1403
1403
  return collisions;
1404
1404
  }
1405
+ function readOrCreateDaemonToken(homeDir) {
1406
+ const exeDir = path11.join(homeDir, ".exe-os");
1407
+ const tokenPath = path11.join(exeDir, "exed.token");
1408
+ try {
1409
+ if (existsSync11(tokenPath)) {
1410
+ const token2 = readFileSync9(tokenPath, "utf-8").trim();
1411
+ if (token2) return token2;
1412
+ }
1413
+ } catch {
1414
+ }
1415
+ const token = randomBytes(32).toString("hex");
1416
+ mkdirSync6(exeDir, { recursive: true });
1417
+ writeFileSync7(tokenPath, `${token}
1418
+ `, "utf-8");
1419
+ try {
1420
+ chmodSync3(tokenPath, 384);
1421
+ } catch {
1422
+ }
1423
+ return token;
1424
+ }
1425
+ function buildHttpMcpEntry(homeDir) {
1426
+ const port = process.env.EXE_MCP_PORT || "48739";
1427
+ const token = readOrCreateDaemonToken(homeDir);
1428
+ return {
1429
+ type: "http",
1430
+ url: `http://127.0.0.1:${port}/mcp`,
1431
+ headers: {
1432
+ Authorization: `Bearer ${token}`,
1433
+ "X-Agent-Id": "${AGENT_ID:-exe}",
1434
+ "X-Agent-Role": "${AGENT_ROLE:-COO}"
1435
+ }
1436
+ };
1437
+ }
1438
+ function buildStdioMcpEntry(packageRoot) {
1439
+ return {
1440
+ type: "stdio",
1441
+ command: "node",
1442
+ args: [path11.join(packageRoot, "dist", "mcp", "server.js")],
1443
+ env: {}
1444
+ };
1445
+ }
1446
+ function mcpTransportMode() {
1447
+ const value = process.env.EXE_OS_MCP_TRANSPORT?.trim().toLowerCase();
1448
+ if (value === "stdio") return "stdio";
1449
+ if (value === "http") return "http";
1450
+ const totalGB = os7.totalmem() / (1024 * 1024 * 1024);
1451
+ if (totalGB <= 8) return "stdio";
1452
+ return "http";
1453
+ }
1405
1454
  async function registerMcpServer(packageRoot, homeDir = os7.homedir()) {
1406
1455
  const claudeJsonPath = path11.join(homeDir, ".claude.json");
1407
1456
  let claudeJson = {};
@@ -1415,12 +1464,7 @@ async function registerMcpServer(packageRoot, homeDir = os7.homedir()) {
1415
1464
  if (!claudeJson.mcpServers) {
1416
1465
  claudeJson.mcpServers = {};
1417
1466
  }
1418
- const newEntry = {
1419
- type: "stdio",
1420
- command: "node",
1421
- args: [path11.join(packageRoot, "dist", "mcp", "server.js")],
1422
- env: {}
1423
- };
1467
+ const newEntry = mcpTransportMode() === "stdio" ? buildStdioMcpEntry(packageRoot) : buildHttpMcpEntry(homeDir);
1424
1468
  if (claudeJson.mcpServers[MCP_LEGACY_KEY]) {
1425
1469
  delete claudeJson.mcpServers[MCP_LEGACY_KEY];
1426
1470
  process.stderr.write("exe-os: migrated MCP server key exe-mem \u2192 exe-os\n");
@@ -3608,8 +3608,8 @@ var init_preferences = __esm({
3608
3608
 
3609
3609
  // src/adapters/claude/installer.ts
3610
3610
  import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4, readdir } from "fs/promises";
3611
- import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, copyFileSync, mkdirSync as mkdirSync6 } from "fs";
3612
- import { createHash as createHash2 } from "crypto";
3611
+ import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, copyFileSync, mkdirSync as mkdirSync6, chmodSync as chmodSync2 } from "fs";
3612
+ import { createHash as createHash2, randomBytes } from "crypto";
3613
3613
  import path12 from "path";
3614
3614
  import os9 from "os";
3615
3615
  import { execSync as execSync5 } from "child_process";
@@ -3597,8 +3597,8 @@ var init_preferences = __esm({
3597
3597
 
3598
3598
  // src/adapters/claude/installer.ts
3599
3599
  import { readFile as readFile4, writeFile as writeFile4, mkdir as mkdir4, readdir } from "fs/promises";
3600
- import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, copyFileSync, mkdirSync as mkdirSync6 } from "fs";
3601
- import { createHash as createHash2 } from "crypto";
3600
+ import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, copyFileSync, mkdirSync as mkdirSync6, chmodSync as chmodSync2 } from "fs";
3601
+ import { createHash as createHash2, randomBytes } from "crypto";
3602
3602
  import path12 from "path";
3603
3603
  import os9 from "os";
3604
3604
  import { execSync as execSync5 } from "child_process";
@@ -610,8 +610,8 @@ var init_preferences = __esm({
610
610
 
611
611
  // src/adapters/claude/installer.ts
612
612
  import { readFile as readFile3, writeFile as writeFile3, mkdir as mkdir3, readdir } from "fs/promises";
613
- import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync4, copyFileSync, mkdirSync as mkdirSync3 } from "fs";
614
- import { createHash } from "crypto";
613
+ import { existsSync as existsSync7, readFileSync as readFileSync5, writeFileSync as writeFileSync4, copyFileSync, mkdirSync as mkdirSync3, chmodSync as chmodSync2 } from "fs";
614
+ import { createHash, randomBytes } from "crypto";
615
615
  import path6 from "path";
616
616
  import os5 from "os";
617
617
  import { execSync as execSync2 } from "child_process";
@@ -740,6 +740,55 @@ function detectMcpNameCollisions(homeDir = os5.homedir(), cwd = process.cwd()) {
740
740
  }
741
741
  return collisions;
742
742
  }
743
+ function readOrCreateDaemonToken(homeDir) {
744
+ const exeDir = path6.join(homeDir, ".exe-os");
745
+ const tokenPath = path6.join(exeDir, "exed.token");
746
+ try {
747
+ if (existsSync7(tokenPath)) {
748
+ const token2 = readFileSync5(tokenPath, "utf-8").trim();
749
+ if (token2) return token2;
750
+ }
751
+ } catch {
752
+ }
753
+ const token = randomBytes(32).toString("hex");
754
+ mkdirSync3(exeDir, { recursive: true });
755
+ writeFileSync4(tokenPath, `${token}
756
+ `, "utf-8");
757
+ try {
758
+ chmodSync2(tokenPath, 384);
759
+ } catch {
760
+ }
761
+ return token;
762
+ }
763
+ function buildHttpMcpEntry(homeDir) {
764
+ const port = process.env.EXE_MCP_PORT || "48739";
765
+ const token = readOrCreateDaemonToken(homeDir);
766
+ return {
767
+ type: "http",
768
+ url: `http://127.0.0.1:${port}/mcp`,
769
+ headers: {
770
+ Authorization: `Bearer ${token}`,
771
+ "X-Agent-Id": "${AGENT_ID:-exe}",
772
+ "X-Agent-Role": "${AGENT_ROLE:-COO}"
773
+ }
774
+ };
775
+ }
776
+ function buildStdioMcpEntry(packageRoot) {
777
+ return {
778
+ type: "stdio",
779
+ command: "node",
780
+ args: [path6.join(packageRoot, "dist", "mcp", "server.js")],
781
+ env: {}
782
+ };
783
+ }
784
+ function mcpTransportMode() {
785
+ const value = process.env.EXE_OS_MCP_TRANSPORT?.trim().toLowerCase();
786
+ if (value === "stdio") return "stdio";
787
+ if (value === "http") return "http";
788
+ const totalGB = os5.totalmem() / (1024 * 1024 * 1024);
789
+ if (totalGB <= 8) return "stdio";
790
+ return "http";
791
+ }
743
792
  async function registerMcpServer(packageRoot, homeDir = os5.homedir()) {
744
793
  const claudeJsonPath = path6.join(homeDir, ".claude.json");
745
794
  let claudeJson = {};
@@ -753,12 +802,7 @@ async function registerMcpServer(packageRoot, homeDir = os5.homedir()) {
753
802
  if (!claudeJson.mcpServers) {
754
803
  claudeJson.mcpServers = {};
755
804
  }
756
- const newEntry = {
757
- type: "stdio",
758
- command: "node",
759
- args: [path6.join(packageRoot, "dist", "mcp", "server.js")],
760
- env: {}
761
- };
805
+ const newEntry = mcpTransportMode() === "stdio" ? buildStdioMcpEntry(packageRoot) : buildHttpMcpEntry(homeDir);
762
806
  if (claudeJson.mcpServers[MCP_LEGACY_KEY]) {
763
807
  delete claudeJson.mcpServers[MCP_LEGACY_KEY];
764
808
  process.stderr.write("exe-os: migrated MCP server key exe-mem \u2192 exe-os\n");
@@ -1831,7 +1875,7 @@ import {
1831
1875
  readFileSync as readFileSync6,
1832
1876
  writeFileSync as writeFileSync5,
1833
1877
  mkdirSync as mkdirSync4,
1834
- chmodSync as chmodSync2,
1878
+ chmodSync as chmodSync3,
1835
1879
  readdirSync,
1836
1880
  unlinkSync as unlinkSync2
1837
1881
  } from "fs";
@@ -1851,7 +1895,7 @@ function generateSessionWrappers(packageRoot, homeDir) {
1851
1895
  for (const src of candidates) {
1852
1896
  if (existsSync8(src)) {
1853
1897
  writeFileSync5(exeStartDst, readFileSync6(src));
1854
- chmodSync2(exeStartDst, 493);
1898
+ chmodSync3(exeStartDst, 493);
1855
1899
  break;
1856
1900
  }
1857
1901
  }
@@ -1886,11 +1930,11 @@ exec "${exeStartDst}" "$0" "$@"
1886
1930
  for (let n = 1; n <= MAX_N; n++) {
1887
1931
  const wrapperPath = path7.join(binDir, `${emp.name}${n}`);
1888
1932
  writeFileSync5(wrapperPath, wrapperContent);
1889
- chmodSync2(wrapperPath, 493);
1933
+ chmodSync3(wrapperPath, 493);
1890
1934
  created++;
1891
1935
  const codexPath = path7.join(binDir, `${emp.name}${n}-codex`);
1892
1936
  writeFileSync5(codexPath, wrapperContent);
1893
- chmodSync2(codexPath, 493);
1937
+ chmodSync3(codexPath, 493);
1894
1938
  created++;
1895
1939
  }
1896
1940
  }
@@ -1912,7 +1956,7 @@ exec "${exeStartDst}" "$0" "$@"
1912
1956
  exec node "${codexLauncher}" --agent ${emp.name} "$@"
1913
1957
  `;
1914
1958
  writeFileSync5(wrapperPath, content);
1915
- chmodSync2(wrapperPath, 493);
1959
+ chmodSync3(wrapperPath, 493);
1916
1960
  created++;
1917
1961
  }
1918
1962
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askexenow/exe-os",
3
- "version": "0.9.46",
3
+ "version": "0.9.48",
4
4
  "description": "AI employee operating system — persistent memory, task management, and multi-agent coordination for Claude Code.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",