@askexenow/exe-os 0.8.83 → 0.8.85

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 (95) hide show
  1. package/dist/bin/backfill-conversations.js +746 -595
  2. package/dist/bin/backfill-responses.js +745 -594
  3. package/dist/bin/backfill-vectors.js +312 -226
  4. package/dist/bin/cleanup-stale-review-tasks.js +97 -2
  5. package/dist/bin/cli.js +14350 -12518
  6. package/dist/bin/exe-agent.js +97 -88
  7. package/dist/bin/exe-assign.js +1003 -854
  8. package/dist/bin/exe-boot.js +1257 -320
  9. package/dist/bin/exe-call.js +10 -0
  10. package/dist/bin/exe-cloud.js +29 -6
  11. package/dist/bin/exe-dispatch.js +210 -34
  12. package/dist/bin/exe-doctor.js +403 -6
  13. package/dist/bin/exe-export-behaviors.js +175 -72
  14. package/dist/bin/exe-forget.js +97 -2
  15. package/dist/bin/exe-gateway.js +550 -171
  16. package/dist/bin/exe-healthcheck.js +1 -0
  17. package/dist/bin/exe-heartbeat.js +100 -5
  18. package/dist/bin/exe-kill.js +175 -72
  19. package/dist/bin/exe-launch-agent.js +189 -76
  20. package/dist/bin/exe-link.js +902 -80
  21. package/dist/bin/exe-new-employee.js +38 -8
  22. package/dist/bin/exe-pending-messages.js +96 -2
  23. package/dist/bin/exe-pending-notifications.js +97 -2
  24. package/dist/bin/exe-pending-reviews.js +98 -3
  25. package/dist/bin/exe-rename.js +564 -23
  26. package/dist/bin/exe-review.js +231 -73
  27. package/dist/bin/exe-search.js +989 -226
  28. package/dist/bin/exe-session-cleanup.js +4806 -1665
  29. package/dist/bin/exe-settings.js +20 -5
  30. package/dist/bin/exe-status.js +97 -2
  31. package/dist/bin/exe-team.js +97 -2
  32. package/dist/bin/git-sweep.js +899 -207
  33. package/dist/bin/graph-backfill.js +175 -72
  34. package/dist/bin/graph-export.js +175 -72
  35. package/dist/bin/install.js +38 -7
  36. package/dist/bin/list-providers.js +1 -0
  37. package/dist/bin/scan-tasks.js +904 -211
  38. package/dist/bin/setup.js +867 -268
  39. package/dist/bin/shard-migrate.js +175 -72
  40. package/dist/bin/update.js +1 -0
  41. package/dist/bin/wiki-sync.js +175 -72
  42. package/dist/gateway/index.js +548 -166
  43. package/dist/hooks/bug-report-worker.js +208 -23
  44. package/dist/hooks/commit-complete.js +897 -205
  45. package/dist/hooks/error-recall.js +988 -226
  46. package/dist/hooks/ingest-worker.js +1638 -1194
  47. package/dist/hooks/ingest.js +3 -0
  48. package/dist/hooks/instructions-loaded.js +707 -97
  49. package/dist/hooks/notification.js +699 -89
  50. package/dist/hooks/post-compact.js +714 -104
  51. package/dist/hooks/pre-compact.js +897 -205
  52. package/dist/hooks/pre-tool-use.js +742 -123
  53. package/dist/hooks/prompt-ingest-worker.js +242 -101
  54. package/dist/hooks/prompt-submit.js +995 -233
  55. package/dist/hooks/response-ingest-worker.js +242 -101
  56. package/dist/hooks/session-end.js +3941 -400
  57. package/dist/hooks/session-start.js +1001 -226
  58. package/dist/hooks/stop.js +725 -115
  59. package/dist/hooks/subagent-stop.js +714 -104
  60. package/dist/hooks/summary-worker.js +1964 -1330
  61. package/dist/index.js +1651 -1053
  62. package/dist/lib/cloud-sync.js +907 -86
  63. package/dist/lib/consolidation.js +2 -1
  64. package/dist/lib/database.js +642 -87
  65. package/dist/lib/db-daemon-client.js +503 -0
  66. package/dist/lib/device-registry.js +547 -7
  67. package/dist/lib/embedder.js +14 -28
  68. package/dist/lib/employee-templates.js +84 -74
  69. package/dist/lib/employees.js +9 -0
  70. package/dist/lib/exe-daemon-client.js +16 -29
  71. package/dist/lib/exe-daemon.js +1955 -922
  72. package/dist/lib/hybrid-search.js +988 -226
  73. package/dist/lib/identity.js +87 -67
  74. package/dist/lib/keychain.js +9 -1
  75. package/dist/lib/messaging.js +8 -1
  76. package/dist/lib/reminders.js +91 -74
  77. package/dist/lib/schedules.js +96 -2
  78. package/dist/lib/skill-learning.js +103 -85
  79. package/dist/lib/store.js +234 -73
  80. package/dist/lib/tasks.js +111 -22
  81. package/dist/lib/tmux-routing.js +120 -31
  82. package/dist/lib/token-spend.js +273 -0
  83. package/dist/lib/ws-client.js +11 -0
  84. package/dist/mcp/server.js +5222 -475
  85. package/dist/mcp/tools/complete-reminder.js +94 -77
  86. package/dist/mcp/tools/create-reminder.js +94 -77
  87. package/dist/mcp/tools/create-task.js +120 -22
  88. package/dist/mcp/tools/deactivate-behavior.js +95 -77
  89. package/dist/mcp/tools/list-reminders.js +94 -77
  90. package/dist/mcp/tools/list-tasks.js +31 -1
  91. package/dist/mcp/tools/send-message.js +8 -1
  92. package/dist/mcp/tools/update-task.js +39 -10
  93. package/dist/runtime/index.js +911 -219
  94. package/dist/tui/App.js +997 -295
  95. package/package.json +6 -1
@@ -319,6 +319,12 @@ function getClient() {
319
319
  if (!_resilientClient) {
320
320
  throw new Error("Database client not initialized. Call initDatabase() first.");
321
321
  }
322
+ if (process.env.EXE_IS_DAEMON === "1") {
323
+ return _resilientClient;
324
+ }
325
+ if (_daemonClient && _daemonClient._isDaemonActive()) {
326
+ return _daemonClient;
327
+ }
322
328
  return _resilientClient;
323
329
  }
324
330
  function getRawClient() {
@@ -807,6 +813,12 @@ async function ensureSchema() {
807
813
  } catch {
808
814
  }
809
815
  }
816
+ try {
817
+ await client.execute(
818
+ `CREATE INDEX IF NOT EXISTS idx_memories_content_hash ON memories(content_hash, agent_id)`
819
+ );
820
+ } catch {
821
+ }
810
822
  await client.executeMultiple(`
811
823
  CREATE TABLE IF NOT EXISTS entities (
812
824
  id TEXT PRIMARY KEY,
@@ -859,7 +871,30 @@ async function ensureSchema() {
859
871
  entity_id TEXT NOT NULL,
860
872
  PRIMARY KEY (hyperedge_id, entity_id)
861
873
  );
874
+
875
+ CREATE VIRTUAL TABLE IF NOT EXISTS entities_fts USING fts5(
876
+ name,
877
+ content=entities,
878
+ content_rowid=rowid
879
+ );
880
+
881
+ CREATE TRIGGER IF NOT EXISTS entities_fts_ai AFTER INSERT ON entities BEGIN
882
+ INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
883
+ END;
884
+
885
+ CREATE TRIGGER IF NOT EXISTS entities_fts_ad AFTER DELETE ON entities BEGIN
886
+ INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
887
+ END;
888
+
889
+ CREATE TRIGGER IF NOT EXISTS entities_fts_au AFTER UPDATE ON entities BEGIN
890
+ INSERT INTO entities_fts(entities_fts, rowid, name) VALUES('delete', old.rowid, old.name);
891
+ INSERT INTO entities_fts(rowid, name) VALUES (new.rowid, new.name);
892
+ END;
862
893
  `);
894
+ try {
895
+ await client.execute("INSERT INTO entities_fts(entities_fts) VALUES('rebuild')");
896
+ } catch {
897
+ }
863
898
  await client.executeMultiple(`
864
899
  CREATE TABLE IF NOT EXISTS entity_aliases (
865
900
  alias TEXT NOT NULL PRIMARY KEY,
@@ -1040,6 +1075,33 @@ async function ensureSchema() {
1040
1075
  CREATE INDEX IF NOT EXISTS idx_conversations_channel
1041
1076
  ON conversations(channel_id);
1042
1077
  `);
1078
+ await client.executeMultiple(`
1079
+ CREATE TABLE IF NOT EXISTS session_agent_map (
1080
+ session_uuid TEXT PRIMARY KEY,
1081
+ agent_id TEXT NOT NULL,
1082
+ session_name TEXT,
1083
+ task_id TEXT,
1084
+ project_name TEXT,
1085
+ started_at TEXT NOT NULL
1086
+ );
1087
+
1088
+ CREATE INDEX IF NOT EXISTS idx_session_agent_map_agent
1089
+ ON session_agent_map(agent_id);
1090
+ `);
1091
+ try {
1092
+ const mapCount = await client.execute({ sql: `SELECT COUNT(*) as cnt FROM session_agent_map`, args: [] });
1093
+ if (Number(mapCount.rows[0]?.cnt ?? 0) === 0) {
1094
+ await client.execute({
1095
+ sql: `INSERT OR IGNORE INTO session_agent_map (session_uuid, agent_id, session_name, started_at)
1096
+ SELECT session_id, agent_id, '', MIN(timestamp)
1097
+ FROM memories
1098
+ WHERE session_id IS NOT NULL AND session_id != '' AND agent_id IS NOT NULL AND agent_id != ''
1099
+ GROUP BY session_id, agent_id`,
1100
+ args: []
1101
+ });
1102
+ }
1103
+ } catch {
1104
+ }
1043
1105
  try {
1044
1106
  await client.execute({
1045
1107
  sql: `ALTER TABLE tasks ADD COLUMN budget_tokens INTEGER`,
@@ -1173,8 +1235,30 @@ async function ensureSchema() {
1173
1235
  });
1174
1236
  } catch {
1175
1237
  }
1238
+ for (const col of [
1239
+ "ALTER TABLE memories ADD COLUMN intent TEXT",
1240
+ "ALTER TABLE memories ADD COLUMN outcome TEXT",
1241
+ "ALTER TABLE memories ADD COLUMN domain TEXT",
1242
+ "ALTER TABLE memories ADD COLUMN referenced_entities TEXT",
1243
+ "ALTER TABLE memories ADD COLUMN retrieval_count INTEGER DEFAULT 0",
1244
+ "ALTER TABLE memories ADD COLUMN chain_position TEXT",
1245
+ "ALTER TABLE memories ADD COLUMN review_status TEXT",
1246
+ "ALTER TABLE memories ADD COLUMN context_window_pct INTEGER",
1247
+ "ALTER TABLE memories ADD COLUMN file_paths TEXT",
1248
+ "ALTER TABLE memories ADD COLUMN commit_hash TEXT",
1249
+ "ALTER TABLE memories ADD COLUMN duration_ms INTEGER",
1250
+ "ALTER TABLE memories ADD COLUMN token_cost REAL",
1251
+ "ALTER TABLE memories ADD COLUMN audience TEXT",
1252
+ "ALTER TABLE memories ADD COLUMN language_type TEXT",
1253
+ "ALTER TABLE memories ADD COLUMN parent_memory_id TEXT"
1254
+ ]) {
1255
+ try {
1256
+ await client.execute(col);
1257
+ } catch {
1258
+ }
1259
+ }
1176
1260
  }
1177
- var _client, _resilientClient, initTurso;
1261
+ var _client, _resilientClient, _daemonClient, initTurso;
1178
1262
  var init_database = __esm({
1179
1263
  "src/lib/database.ts"() {
1180
1264
  "use strict";
@@ -1182,6 +1266,7 @@ var init_database = __esm({
1182
1266
  init_employees();
1183
1267
  _client = null;
1184
1268
  _resilientClient = null;
1269
+ _daemonClient = null;
1185
1270
  initTurso = initDatabase;
1186
1271
  }
1187
1272
  });
@@ -1616,6 +1701,9 @@ ${p.content}`).join("\n\n");
1616
1701
  init_employees();
1617
1702
  import { randomUUID as randomUUID2 } from "crypto";
1618
1703
 
1704
+ // src/lib/store.ts
1705
+ import { createHash } from "crypto";
1706
+
1619
1707
  // src/types/memory.ts
1620
1708
  var EMBEDDING_DIM = 1024;
1621
1709
 
@@ -1655,12 +1743,20 @@ async function getMasterKey() {
1655
1743
  }
1656
1744
  const keyPath = getKeyPath();
1657
1745
  if (!existsSync3(keyPath)) {
1746
+ process.stderr.write(
1747
+ `[keychain] Key not found at ${keyPath} (HOME=${os3.homedir()}, EXE_OS_DIR=${process.env.EXE_OS_DIR ?? "unset"})
1748
+ `
1749
+ );
1658
1750
  return null;
1659
1751
  }
1660
1752
  try {
1661
1753
  const content = await readFile3(keyPath, "utf-8");
1662
1754
  return Buffer.from(content.trim(), "base64");
1663
- } catch {
1755
+ } catch (err) {
1756
+ process.stderr.write(
1757
+ `[keychain] Key read failed at ${keyPath}: ${err instanceof Error ? err.message : String(err)}
1758
+ `
1759
+ );
1664
1760
  return null;
1665
1761
  }
1666
1762
  }
@@ -1799,12 +1895,52 @@ function classifyTier(record) {
1799
1895
  if (["store_memory", "manual"].includes(record.tool_name ?? "") && (record.importance ?? 0) >= 5) return 2;
1800
1896
  return 3;
1801
1897
  }
1898
+ function inferFilePaths(record) {
1899
+ if (!["Read", "Write", "Edit"].includes(record.tool_name)) return null;
1900
+ const firstLine = record.raw_text.split("\n")[0] ?? "";
1901
+ const match = firstLine.match(/(\/[\w./-]+\.\w+)/);
1902
+ return match ? JSON.stringify([match[1]]) : null;
1903
+ }
1904
+ function inferCommitHash(record) {
1905
+ if (record.tool_name !== "Bash") return null;
1906
+ const match = record.raw_text.match(/\b([a-f0-9]{7,40})\b/);
1907
+ return match ? match[1] : null;
1908
+ }
1909
+ function inferLanguageType(record) {
1910
+ const text = record.raw_text;
1911
+ if (!text || text.length < 10) return null;
1912
+ const trimmed = text.trimStart();
1913
+ if (trimmed.startsWith("{") || trimmed.startsWith("[")) return "json";
1914
+ if (/\b(SELECT|INSERT|UPDATE|DELETE|CREATE TABLE|ALTER TABLE)\b/i.test(text)) return "sql";
1915
+ if (/\b(function |const |import |export |class |def |async |=>)\b/.test(text)) return "code";
1916
+ if (trimmed.startsWith("#") || trimmed.startsWith("*")) return "prose";
1917
+ return "mixed";
1918
+ }
1919
+ function inferDomain(record) {
1920
+ const proj = (record.project_name ?? "").toLowerCase();
1921
+ if (proj.includes("marketing") || proj.includes("content")) return "marketing";
1922
+ if (proj.includes("crm") || proj.includes("customer")) return "customer";
1923
+ return null;
1924
+ }
1802
1925
  async function writeMemory(record) {
1803
1926
  if (record.vector !== null && record.vector.length !== EMBEDDING_DIM) {
1804
1927
  throw new Error(
1805
1928
  `Expected ${EMBEDDING_DIM}-dim vector, got ${record.vector.length}`
1806
1929
  );
1807
1930
  }
1931
+ const contentHash = createHash("md5").update(record.raw_text).digest("hex");
1932
+ if (_pendingRecords.some((r) => r.content_hash === contentHash && r.agent_id === record.agent_id)) {
1933
+ return;
1934
+ }
1935
+ try {
1936
+ const client = getClient();
1937
+ const existing = await client.execute({
1938
+ sql: "SELECT id FROM memories WHERE content_hash = ? AND agent_id = ? LIMIT 1",
1939
+ args: [contentHash, record.agent_id]
1940
+ });
1941
+ if (existing.rows.length > 0) return;
1942
+ } catch {
1943
+ }
1808
1944
  const dbRow = {
1809
1945
  id: record.id,
1810
1946
  agent_id: record.agent_id,
@@ -1834,7 +1970,23 @@ async function writeMemory(record) {
1834
1970
  supersedes_id: record.supersedes_id ?? null,
1835
1971
  draft: record.draft ? 1 : 0,
1836
1972
  memory_type: record.memory_type ?? "raw",
1837
- trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null
1973
+ trajectory: record.trajectory ? JSON.stringify(record.trajectory) : null,
1974
+ content_hash: contentHash,
1975
+ intent: record.intent ?? null,
1976
+ outcome: record.outcome ?? null,
1977
+ domain: record.domain ?? inferDomain(record),
1978
+ referenced_entities: record.referenced_entities ?? null,
1979
+ retrieval_count: record.retrieval_count ?? 0,
1980
+ chain_position: record.chain_position ?? null,
1981
+ review_status: record.review_status ?? null,
1982
+ context_window_pct: record.context_window_pct ?? null,
1983
+ file_paths: record.file_paths ?? inferFilePaths(record),
1984
+ commit_hash: record.commit_hash ?? inferCommitHash(record),
1985
+ duration_ms: record.duration_ms ?? null,
1986
+ token_cost: record.token_cost ?? null,
1987
+ audience: record.audience ?? null,
1988
+ language_type: record.language_type ?? inferLanguageType(record),
1989
+ parent_memory_id: record.parent_memory_id ?? null
1838
1990
  };
1839
1991
  _pendingRecords.push(dbRow);
1840
1992
  orgBus.emit({
@@ -1892,80 +2044,85 @@ async function flushBatch() {
1892
2044
  const draft = row.draft ? 1 : 0;
1893
2045
  const memoryType = row.memory_type ?? "raw";
1894
2046
  const trajectory = row.trajectory ?? null;
1895
- return {
1896
- sql: hasVector ? `INSERT OR IGNORE INTO memories
1897
- (id, agent_id, agent_role, session_id, timestamp,
1898
- tool_name, project_name,
1899
- has_error, raw_text, vector, version, task_id, importance, status,
1900
- confidence, last_accessed,
1901
- workspace_id, document_id, user_id, char_offset, page_number,
1902
- source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
1903
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories
1904
- (id, agent_id, agent_role, session_id, timestamp,
2047
+ const contentHash = row.content_hash ?? null;
2048
+ const intent = row.intent ?? null;
2049
+ const outcome = row.outcome ?? null;
2050
+ const domain = row.domain ?? null;
2051
+ const referencedEntities = row.referenced_entities ?? null;
2052
+ const retrievalCount = row.retrieval_count ?? 0;
2053
+ const chainPosition = row.chain_position ?? null;
2054
+ const reviewStatus = row.review_status ?? null;
2055
+ const contextWindowPct = row.context_window_pct ?? null;
2056
+ const filePaths = row.file_paths ?? null;
2057
+ const commitHash = row.commit_hash ?? null;
2058
+ const durationMs = row.duration_ms ?? null;
2059
+ const tokenCost = row.token_cost ?? null;
2060
+ const audience = row.audience ?? null;
2061
+ const languageType = row.language_type ?? null;
2062
+ const parentMemoryId = row.parent_memory_id ?? null;
2063
+ const cols = `id, agent_id, agent_role, session_id, timestamp,
1905
2064
  tool_name, project_name,
1906
2065
  has_error, raw_text, vector, version, task_id, importance, status,
1907
2066
  confidence, last_accessed,
1908
2067
  workspace_id, document_id, user_id, char_offset, page_number,
1909
- source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory)
1910
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
1911
- args: hasVector ? [
1912
- row.id,
1913
- row.agent_id,
1914
- row.agent_role,
1915
- row.session_id,
1916
- row.timestamp,
1917
- row.tool_name,
1918
- row.project_name,
1919
- row.has_error,
1920
- row.raw_text,
1921
- vectorToBlob(row.vector),
1922
- row.version,
1923
- taskId,
1924
- importance,
1925
- status,
1926
- confidence,
1927
- lastAccessed,
1928
- workspaceId,
1929
- documentId,
1930
- userId,
1931
- charOffset,
1932
- pageNumber,
1933
- sourcePath,
1934
- sourceType,
1935
- tier,
1936
- supersedesId,
1937
- draft,
1938
- memoryType,
1939
- trajectory
1940
- ] : [
1941
- row.id,
1942
- row.agent_id,
1943
- row.agent_role,
1944
- row.session_id,
1945
- row.timestamp,
1946
- row.tool_name,
1947
- row.project_name,
1948
- row.has_error,
1949
- row.raw_text,
1950
- row.version,
1951
- taskId,
1952
- importance,
1953
- status,
1954
- confidence,
1955
- lastAccessed,
1956
- workspaceId,
1957
- documentId,
1958
- userId,
1959
- charOffset,
1960
- pageNumber,
1961
- sourcePath,
1962
- sourceType,
1963
- tier,
1964
- supersedesId,
1965
- draft,
1966
- memoryType,
1967
- trajectory
1968
- ]
2068
+ source_path, source_type, tier, supersedes_id, draft, memory_type, trajectory, content_hash,
2069
+ intent, outcome, domain, referenced_entities, retrieval_count,
2070
+ chain_position, review_status, context_window_pct, file_paths, commit_hash,
2071
+ duration_ms, token_cost, audience, language_type, parent_memory_id`;
2072
+ const metaArgs = [
2073
+ intent,
2074
+ outcome,
2075
+ domain,
2076
+ referencedEntities,
2077
+ retrievalCount,
2078
+ chainPosition,
2079
+ reviewStatus,
2080
+ contextWindowPct,
2081
+ filePaths,
2082
+ commitHash,
2083
+ durationMs,
2084
+ tokenCost,
2085
+ audience,
2086
+ languageType,
2087
+ parentMemoryId
2088
+ ];
2089
+ const baseArgs = [
2090
+ row.id,
2091
+ row.agent_id,
2092
+ row.agent_role,
2093
+ row.session_id,
2094
+ row.timestamp,
2095
+ row.tool_name,
2096
+ row.project_name,
2097
+ row.has_error,
2098
+ row.raw_text
2099
+ ];
2100
+ const sharedArgs = [
2101
+ row.version,
2102
+ taskId,
2103
+ importance,
2104
+ status,
2105
+ confidence,
2106
+ lastAccessed,
2107
+ workspaceId,
2108
+ documentId,
2109
+ userId,
2110
+ charOffset,
2111
+ pageNumber,
2112
+ sourcePath,
2113
+ sourceType,
2114
+ tier,
2115
+ supersedesId,
2116
+ draft,
2117
+ memoryType,
2118
+ trajectory,
2119
+ contentHash
2120
+ ];
2121
+ return {
2122
+ sql: hasVector ? `INSERT OR IGNORE INTO memories (${cols})
2123
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, vector32(?), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` : `INSERT OR IGNORE INTO memories (${cols})
2124
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
2125
+ args: hasVector ? [...baseArgs, vectorToBlob(row.vector), ...sharedArgs, ...metaArgs] : [...baseArgs, ...sharedArgs, ...metaArgs]
1969
2126
  };
1970
2127
  };
1971
2128
  const globalClient = getClient();
@@ -2014,6 +2171,7 @@ import { realpathSync } from "fs";
2014
2171
  import { fileURLToPath } from "url";
2015
2172
  function isMainModule(importMetaUrl) {
2016
2173
  if (process.argv[1] == null) return false;
2174
+ if (process.argv[1].includes("mcp/server")) return false;
2017
2175
  try {
2018
2176
  const scriptPath = realpathSync(process.argv[1]);
2019
2177
  const modulePath = realpathSync(fileURLToPath(importMetaUrl));