@askexenow/exe-os 0.9.112 → 0.9.113

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/README.md +9 -7
  2. package/dist/bin/agentic-ontology-backfill.js +54 -11
  3. package/dist/bin/agentic-reflection-backfill.js +29 -1
  4. package/dist/bin/agentic-semantic-label.js +29 -1
  5. package/dist/bin/backfill-conversations.js +53 -10
  6. package/dist/bin/backfill-responses.js +54 -11
  7. package/dist/bin/backfill-vectors.js +29 -1
  8. package/dist/bin/bulk-sync-postgres.js +55 -12
  9. package/dist/bin/cleanup-stale-review-tasks.js +75 -15
  10. package/dist/bin/cli.js +293 -76
  11. package/dist/bin/exe-agent-config.js +7 -1
  12. package/dist/bin/exe-agent.js +28 -2
  13. package/dist/bin/exe-assign.js +54 -11
  14. package/dist/bin/exe-boot.js +481 -147
  15. package/dist/bin/exe-call.js +45 -4
  16. package/dist/bin/exe-cloud.js +93 -15
  17. package/dist/bin/exe-dispatch.js +369 -24
  18. package/dist/bin/exe-doctor.js +53 -10
  19. package/dist/bin/exe-export-behaviors.js +54 -11
  20. package/dist/bin/exe-forget.js +54 -11
  21. package/dist/bin/exe-gateway.js +128 -23
  22. package/dist/bin/exe-heartbeat.js +75 -15
  23. package/dist/bin/exe-kill.js +54 -11
  24. package/dist/bin/exe-launch-agent.js +70 -12
  25. package/dist/bin/exe-new-employee.js +175 -7
  26. package/dist/bin/exe-pending-messages.js +75 -15
  27. package/dist/bin/exe-pending-notifications.js +75 -15
  28. package/dist/bin/exe-pending-reviews.js +75 -15
  29. package/dist/bin/exe-rename.js +54 -11
  30. package/dist/bin/exe-review.js +54 -11
  31. package/dist/bin/exe-search.js +54 -11
  32. package/dist/bin/exe-session-cleanup.js +491 -146
  33. package/dist/bin/exe-settings.js +10 -4
  34. package/dist/bin/exe-start-codex.js +524 -245
  35. package/dist/bin/exe-start-opencode.js +534 -165
  36. package/dist/bin/exe-status.js +75 -15
  37. package/dist/bin/exe-support.js +1 -1
  38. package/dist/bin/exe-team.js +54 -11
  39. package/dist/bin/git-sweep.js +369 -24
  40. package/dist/bin/graph-backfill.js +54 -11
  41. package/dist/bin/graph-export.js +54 -11
  42. package/dist/bin/install.js +62 -4
  43. package/dist/bin/intercom-check.js +491 -146
  44. package/dist/bin/pre-publish.js +13 -1
  45. package/dist/bin/scan-tasks.js +369 -24
  46. package/dist/bin/setup.js +91 -13
  47. package/dist/bin/shard-migrate.js +54 -11
  48. package/dist/bin/stack-update.js +1 -1
  49. package/dist/bin/update.js +3 -3
  50. package/dist/gateway/index.js +128 -23
  51. package/dist/hooks/bug-report-worker.js +128 -23
  52. package/dist/hooks/codex-stop-task-finalizer.js +512 -140
  53. package/dist/hooks/commit-complete.js +369 -24
  54. package/dist/hooks/error-recall.js +54 -11
  55. package/dist/hooks/ingest.js +4575 -252
  56. package/dist/hooks/instructions-loaded.js +54 -11
  57. package/dist/hooks/notification.js +54 -11
  58. package/dist/hooks/post-compact.js +75 -15
  59. package/dist/hooks/post-tool-combined.js +75 -15
  60. package/dist/hooks/pre-compact.js +449 -104
  61. package/dist/hooks/pre-tool-use.js +90 -15
  62. package/dist/hooks/prompt-submit.js +129 -24
  63. package/dist/hooks/session-end.js +451 -109
  64. package/dist/hooks/session-start.js +104 -16
  65. package/dist/hooks/stop.js +74 -14
  66. package/dist/hooks/subagent-stop.js +75 -15
  67. package/dist/hooks/summary-worker.js +73 -7
  68. package/dist/index.js +128 -23
  69. package/dist/lib/agent-config.js +16 -1
  70. package/dist/lib/cloud-sync.js +38 -1
  71. package/dist/lib/consolidation.js +16 -1
  72. package/dist/lib/database.js +16 -0
  73. package/dist/lib/db.js +16 -0
  74. package/dist/lib/device-registry.js +16 -0
  75. package/dist/lib/employee-templates.js +29 -3
  76. package/dist/lib/employees.js +16 -1
  77. package/dist/lib/exe-daemon.js +268 -42
  78. package/dist/lib/hybrid-search.js +54 -11
  79. package/dist/lib/license.js +3 -3
  80. package/dist/lib/messaging.js +21 -4
  81. package/dist/lib/schedules.js +29 -1
  82. package/dist/lib/skill-learning.js +458 -70
  83. package/dist/lib/status-brief.js +14 -1
  84. package/dist/lib/store.js +54 -11
  85. package/dist/lib/tasks.js +393 -91
  86. package/dist/lib/tmux-routing.js +316 -14
  87. package/dist/mcp/server.js +169 -30
  88. package/dist/mcp/tools/create-task.js +75 -13
  89. package/dist/mcp/tools/deactivate-behavior.js +33 -24
  90. package/dist/mcp/tools/list-tasks.js +21 -4
  91. package/dist/mcp/tools/send-message.js +21 -4
  92. package/dist/mcp/tools/update-task.js +390 -91
  93. package/dist/runtime/index.js +446 -101
  94. package/dist/tui/App.js +208 -54
  95. package/package.json +1 -1
@@ -983,6 +983,7 @@ __export(agent_config_exports, {
983
983
  getAgentRuntime: () => getAgentRuntime,
984
984
  loadAgentConfig: () => loadAgentConfig,
985
985
  saveAgentConfig: () => saveAgentConfig,
986
+ setAgentMcps: () => setAgentMcps,
986
987
  setAgentRuntime: () => setAgentRuntime
987
988
  });
988
989
  import { readFileSync as readFileSync4, writeFileSync as writeFileSync2, existsSync as existsSync5 } from "fs";
@@ -1009,7 +1010,7 @@ function getAgentRuntime(agentId) {
1009
1010
  if (orgDefault) return orgDefault;
1010
1011
  return { runtime: DEFAULT_RUNTIME, model: DEFAULT_MODELS[DEFAULT_RUNTIME] };
1011
1012
  }
1012
- function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
1013
+ function setAgentRuntime(agentId, runtime, model, reasoning_effort, mcps) {
1013
1014
  const knownModels = KNOWN_RUNTIMES[runtime];
1014
1015
  if (!knownModels) {
1015
1016
  return {
@@ -1024,12 +1025,26 @@ function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
1024
1025
  };
1025
1026
  }
1026
1027
  const config2 = loadAgentConfig();
1028
+ const existing = config2[agentId];
1027
1029
  const entry = { runtime, model };
1028
1030
  if (reasoning_effort) entry.reasoning_effort = reasoning_effort;
1031
+ if (mcps !== void 0) {
1032
+ entry.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
1033
+ } else if (existing?.mcps) {
1034
+ entry.mcps = existing.mcps;
1035
+ }
1029
1036
  config2[agentId] = entry;
1030
1037
  saveAgentConfig(config2);
1031
1038
  return { ok: true };
1032
1039
  }
1040
+ function setAgentMcps(agentId, mcps) {
1041
+ const config2 = loadAgentConfig();
1042
+ const existing = config2[agentId] ?? getAgentRuntime(agentId);
1043
+ existing.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
1044
+ config2[agentId] = existing;
1045
+ saveAgentConfig(config2);
1046
+ return { ok: true };
1047
+ }
1033
1048
  function clearAgentRuntime(agentId) {
1034
1049
  const config2 = loadAgentConfig();
1035
1050
  delete config2[agentId];
@@ -3727,6 +3742,22 @@ async function ensureSchema() {
3727
3742
  } catch (e) {
3728
3743
  logCatchDebug("migration", e);
3729
3744
  }
3745
+ try {
3746
+ await client.execute({
3747
+ sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
3748
+ args: []
3749
+ });
3750
+ } catch (e) {
3751
+ logCatchDebug("migration", e);
3752
+ }
3753
+ try {
3754
+ await client.execute({
3755
+ sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
3756
+ args: []
3757
+ });
3758
+ } catch (e) {
3759
+ logCatchDebug("migration", e);
3760
+ }
3730
3761
  }
3731
3762
  async function disposeDatabase() {
3732
3763
  if (_walCheckpointTimer) {
@@ -5038,11 +5069,17 @@ var init_platform_procedures = __esm({
5038
5069
  content: "Founder -> coordinator (the executive agent, internally routed as 'COO') -> CTO/CMO. CTO -> engineers. CMO -> content production. Never skip levels: the coordinator does not bypass managers for specialist work. Specialists report to their manager. If you need cross-team info, use ask_team_memory \u2014 don't read other agents' task folders. Each level owns dispatch downward and review upward."
5039
5070
  },
5040
5071
  {
5041
- title: "Customer orchestration maturity \u2014 recommend, never trap",
5072
+ title: "Orchestration phase guidance \u2014 recommend, never trap",
5042
5073
  domain: "workflow",
5043
5074
  priority: "p1",
5044
5075
  content: "New customers start best in Phase 1: founder \u2194 coordinator/Chief of Staff, building company context. Suggest Phase 2 executives when domain work repeats; suggest Phase 3 parallel execution only when review/permission gates are ready. This is guidance, not a blocker: users may jump phases anytime. Never overwrite their phase, role titles, identities, or custom org design."
5045
5076
  },
5077
+ {
5078
+ title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
5079
+ domain: "identity",
5080
+ priority: "p0",
5081
+ content: "These procedures reference 'COO' as a shorthand for the coordinator role. This is an INTERNAL routing slot used by exe-os code (chain-of-command checks, dispatch logic, session detection). It is NOT your display title. Your actual title comes from your identity file's `title:` field \u2014 that is what you use externally: introductions, sign-offs, team comms, and any user-facing text. If your identity says `title: AI Chief of Staff`, you are the AI Chief of Staff. The routing slot stays `role: coo` for code compatibility \u2014 never rename it, but also never introduce yourself as 'COO' unless your identity file explicitly says so. The founder chose your title; respect it."
5082
+ },
5046
5083
  {
5047
5084
  title: "Single dispatch path \u2014 create_task only",
5048
5085
  domain: "workflow",
@@ -5076,6 +5113,12 @@ var init_platform_procedures = __esm({
5076
5113
  priority: "p0",
5077
5114
  content: "NEVER: (1) Access the database directly \u2014 it's SQLCipher encrypted, always fails. Use MCP tools only. (2) Manually spawn tmux sessions \u2014 create_task handles it. (3) Run git checkout main \u2014 agents work in worktrees. (4) Modify another agent's in-progress task. (5) Push to remote \u2014 the COO reviews and pushes. (6) Skip update_task(done) \u2014 it's the ONLY way your work gets reviewed. (7) Run git init."
5078
5115
  },
5116
+ {
5117
+ title: "Destructive operations \u2014 mandatory reviewer gate",
5118
+ domain: "security",
5119
+ priority: "p0",
5120
+ content: "Before ANY destructive operation (delete, remove, overwrite, drop, reset, force-push, truncate), you MUST: (1) Have your full task spec accessible \u2014 if you cannot read it, STOP and report to your reviewer. Never improvise destructive actions. (2) Confirm with your reviewer (assigned_by or COO) before executing. (3) If the task spec explicitly authorizes the operation, proceed \u2014 but log it. Violation = immediate task failure. This applies to ALL agents regardless of role."
5121
+ },
5079
5122
  {
5080
5123
  title: "Customer patch triage \u2014 upstream bug vs customization",
5081
5124
  domain: "support",
@@ -5361,10 +5404,24 @@ function stableId(memoryId, type, content) {
5361
5404
  return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
5362
5405
  }
5363
5406
  function cleanText(text3) {
5364
- return text3.replace(/```[\s\S]*?```/g, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
5407
+ let cleaned = text3.replace(
5408
+ /```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
5409
+ (_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
5410
+ );
5411
+ cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
5412
+ return cleaned;
5365
5413
  }
5366
- function splitSentences(text3) {
5367
- return cleanText(text3).split(/(?<=[.!?])\s+|\n+/).map((s) => s.trim()).filter((s) => s.length >= 24 && s.length <= MAX_SENTENCE_CHARS);
5414
+ function splitSegments(text3) {
5415
+ const cleaned = cleanText(text3);
5416
+ const segments = cleaned.split(/(?<=[.!?:;])\s+|\n{2,}|(?<=\))\s+(?=[A-Z])|\s*[|│]\s*/).map((s) => s.trim()).filter((s) => s.length >= MIN_SEGMENT_CHARS && s.length <= MAX_SEGMENT_CHARS);
5417
+ if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
5418
+ const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
5419
+ if (lines.length > 0) return lines;
5420
+ if (cleaned.length >= MIN_SEGMENT_CHARS) {
5421
+ return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
5422
+ }
5423
+ }
5424
+ return segments;
5368
5425
  }
5369
5426
  function inferCardType(sentence, toolName) {
5370
5427
  const lower = sentence.toLowerCase();
@@ -5396,12 +5453,12 @@ function predicateFor(type) {
5396
5453
  }
5397
5454
  }
5398
5455
  function extractMemoryCards(row) {
5399
- const sentences = splitSentences(row.raw_text);
5456
+ const segments = splitSegments(row.raw_text);
5400
5457
  const cards = [];
5401
- for (const sentence of sentences) {
5458
+ for (const sentence of segments) {
5402
5459
  const type = inferCardType(sentence, row.tool_name);
5403
5460
  const subject = extractSubject(sentence, row.agent_id);
5404
- const content = sentence.length > MAX_SENTENCE_CHARS ? `${sentence.slice(0, MAX_SENTENCE_CHARS - 1)}\u2026` : sentence;
5461
+ const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
5405
5462
  cards.push({
5406
5463
  id: stableId(row.id, type, content),
5407
5464
  memory_id: row.id,
@@ -5497,13 +5554,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
5497
5554
  last_accessed: String(row.timestamp)
5498
5555
  }));
5499
5556
  }
5500
- var MAX_CARDS_PER_MEMORY, MAX_SENTENCE_CHARS;
5557
+ var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
5501
5558
  var init_memory_cards = __esm({
5502
5559
  "src/lib/memory-cards.ts"() {
5503
5560
  "use strict";
5504
5561
  init_database();
5505
- MAX_CARDS_PER_MEMORY = 6;
5506
- MAX_SENTENCE_CHARS = 360;
5562
+ MAX_CARDS_PER_MEMORY = 8;
5563
+ MAX_SEGMENT_CHARS = 500;
5564
+ MIN_SEGMENT_CHARS = 20;
5507
5565
  }
5508
5566
  });
5509
5567
 
@@ -7747,7 +7805,7 @@ async function hybridSearch(queryText, agentId, options) {
7747
7805
  try {
7748
7806
  const client = getClient();
7749
7807
  void client.execute({
7750
- sql: `UPDATE memories SET last_accessed = ?, retrieval_count = COALESCE(retrieval_count, 0) + 1 WHERE id IN (${placeholders})`,
7808
+ sql: `UPDATE memories SET last_accessed = ?, retrieval_count = COALESCE(retrieval_count, 0) + 1, strength = MIN(1.0, COALESCE(strength, 1.0) + 0.1) WHERE id IN (${placeholders})`,
7751
7809
  args: [now, ...ids]
7752
7810
  }).catch(() => {
7753
7811
  });
@@ -8836,7 +8894,7 @@ async function assertVpsLicense(opts) {
8836
8894
  }
8837
8895
  if (!transientFailure) {
8838
8896
  throw new Error(
8839
- "License validation failed: unknown backend state. Restore network connectivity to https://askexe.com/cloud and retry."
8897
+ "License validation failed: unknown backend state. Restore network connectivity to https://cloud.askexe.com and retry."
8840
8898
  );
8841
8899
  }
8842
8900
  const fresh = await getCachedLicense();
@@ -8873,7 +8931,7 @@ async function assertVpsLicense(opts) {
8873
8931
  } catch {
8874
8932
  }
8875
8933
  throw new Error(
8876
- `License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://askexe.com/cloud and retry. This VPS image refuses to boot after the offline grace window.`
8934
+ `License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://cloud.askexe.com and retry. This VPS image refuses to boot after the offline grace window.`
8877
8935
  );
8878
8936
  }
8879
8937
  function startLicenseRevalidation(intervalMs = 36e5) {
@@ -8905,7 +8963,7 @@ var init_license = __esm({
8905
8963
  LICENSE_PATH = path13.join(EXE_AI_DIR, "license.key");
8906
8964
  CACHE_PATH = path13.join(EXE_AI_DIR, "license-cache.json");
8907
8965
  DEVICE_ID_PATH = path13.join(EXE_AI_DIR, "device-id");
8908
- API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://askexe.com/cloud";
8966
+ API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://cloud.askexe.com";
8909
8967
  RETRY_DELAY_MS = 500;
8910
8968
  LICENSE_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----
8911
8969
  MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
@@ -10854,11 +10912,12 @@ function getDispatchedBy(sessionKey) {
10854
10912
  }
10855
10913
  }
10856
10914
  function resolveExeSession() {
10915
+ if (process.env.EXE_SESSION_NAME) {
10916
+ const fromEnv = extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
10917
+ if (fromEnv) return fromEnv;
10918
+ }
10857
10919
  const mySession = getMySession();
10858
10920
  if (!mySession) {
10859
- if (process.env.EXE_SESSION_NAME) {
10860
- return extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
10861
- }
10862
10921
  return null;
10863
10922
  }
10864
10923
  const fromSessionName = extractRootExe(mySession);
@@ -10873,6 +10932,10 @@ function resolveExeSession() {
10873
10932
  `[tmux-routing] WARN: cache says "${fromCache}" but session name says "${fromSessionName}". Trusting session name.
10874
10933
  `
10875
10934
  );
10935
+ try {
10936
+ registerParentExe(key, fromSessionName);
10937
+ } catch {
10938
+ }
10876
10939
  candidate = fromSessionName;
10877
10940
  } else {
10878
10941
  candidate = fromCache;
@@ -11800,6 +11863,19 @@ async function resolveTask(client, identifier, scopeSession) {
11800
11863
  args: [identifier, ...scope.args]
11801
11864
  });
11802
11865
  if (result3.rows.length === 1) return result3.rows[0];
11866
+ if (/^[a-f0-9]{7,12}$/i.test(identifier)) {
11867
+ result3 = await client.execute({
11868
+ sql: `SELECT * FROM tasks WHERE id LIKE ?`,
11869
+ args: [`${identifier}%`]
11870
+ });
11871
+ if (result3.rows.length === 1) return result3.rows[0];
11872
+ if (result3.rows.length > 1) {
11873
+ const matches = result3.rows.map((r) => `${String(r.id)} "${String(r.title)}" (${String(r.status)})`).join(", ");
11874
+ throw new Error(
11875
+ `Multiple tasks match short-ID "${identifier}": ${matches}. Use a longer prefix to disambiguate.`
11876
+ );
11877
+ }
11878
+ }
11803
11879
  result3 = await client.execute({
11804
11880
  sql: `SELECT * FROM tasks WHERE task_file LIKE ?${scope.sql}`,
11805
11881
  args: [`%${identifier}%`, ...scope.args]
@@ -12346,12 +12422,13 @@ async function cascadeUnblock(taskId, baseDir, now) {
12346
12422
  WHERE blocked_by = ? AND status = 'blocked'`,
12347
12423
  args: [now, taskId]
12348
12424
  });
12349
- if (baseDir && unblocked.rowsAffected > 0) {
12350
- const ubScope = sessionScopeFilter();
12351
- const unblockedRows = await client.execute({
12352
- sql: `SELECT task_file FROM tasks WHERE blocked_by IS NULL AND updated_at = ?${ubScope.sql}`,
12353
- args: [now, ...ubScope.args]
12354
- });
12425
+ if (unblocked.rowsAffected === 0) return;
12426
+ const ubScope = sessionScopeFilter();
12427
+ const unblockedRows = await client.execute({
12428
+ sql: `SELECT id, title, assigned_to, priority, task_file FROM tasks WHERE blocked_by IS NULL AND updated_at = ?${ubScope.sql}`,
12429
+ args: [now, ...ubScope.args]
12430
+ });
12431
+ if (baseDir) {
12355
12432
  for (const ur of unblockedRows.rows) {
12356
12433
  try {
12357
12434
  const ubFile = path24.join(baseDir, String(ur.task_file));
@@ -12363,6 +12440,19 @@ async function cascadeUnblock(taskId, baseDir, now) {
12363
12440
  }
12364
12441
  }
12365
12442
  }
12443
+ if (unblockedRows.rows.length > 0 && !process.env.VITEST) {
12444
+ try {
12445
+ const { queueIntercom: queueIntercom2 } = await Promise.resolve().then(() => (init_intercom_queue(), intercom_queue_exports));
12446
+ const dispatched = /* @__PURE__ */ new Set();
12447
+ for (const ur of unblockedRows.rows) {
12448
+ const assignee = String(ur.assigned_to);
12449
+ if (dispatched.has(assignee)) continue;
12450
+ dispatched.add(assignee);
12451
+ queueIntercom2(`${assignee}`, `unblocked: "${String(ur.title)}" is now ready`);
12452
+ }
12453
+ } catch {
12454
+ }
12455
+ }
12366
12456
  }
12367
12457
  async function findNextTask(assignedTo) {
12368
12458
  const client = getClient();
@@ -12504,6 +12594,15 @@ var init_tasks_notify = __esm({
12504
12594
  // src/lib/behaviors.ts
12505
12595
  import crypto8 from "crypto";
12506
12596
  async function storeBehavior(opts) {
12597
+ try {
12598
+ const { loadEmployeesSync: loadEmployeesSync2 } = await Promise.resolve().then(() => (init_employees(), employees_exports));
12599
+ const roster = loadEmployeesSync2();
12600
+ if (roster.length > 0 && !roster.some((e) => e.name === opts.agentId)) {
12601
+ throw new Error(`Agent "${opts.agentId}" not found in roster. Cannot store behavior for unregistered agent.`);
12602
+ }
12603
+ } catch (e) {
12604
+ if (e instanceof Error && e.message.includes("not found in roster")) throw e;
12605
+ }
12507
12606
  const client = getClient();
12508
12607
  const id = crypto8.randomUUID();
12509
12608
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -12989,6 +13088,12 @@ async function updateTask(input) {
12989
13088
  }
12990
13089
  }
12991
13090
  }
13091
+ if (input.status === "cancelled") {
13092
+ try {
13093
+ await cascadeUnblock(taskId, input.baseDir, now);
13094
+ } catch {
13095
+ }
13096
+ }
12992
13097
  if ((input.status === "done" || input.status === "closed") && !isCoordinatorName(String(row.assigned_to)) && !process.env.VITEST) {
12993
13098
  Promise.resolve().then(() => (init_skill_learning(), skill_learning_exports)).then(
12994
13099
  ({ captureAndLearn: captureAndLearn2 }) => captureAndLearn2({
@@ -19805,15 +19910,16 @@ function registerSetAgentConfig(server2) {
19805
19910
  "set_agent_config",
19806
19911
  {
19807
19912
  title: "Set Agent Config",
19808
- description: "Set or view per-agent runtime + model configuration. Controls which runtime (claude, codex, opencode) and model each agent uses when dispatched. COO-only. Omit runtime/model to view current config for an agent or all agents.",
19913
+ description: "Set or view per-agent runtime, model, and MCP configuration. Controls which runtime (claude, codex, opencode), model, and MCP servers each agent uses when dispatched. COO-only. Omit runtime/model to view current config for an agent or all agents. Pass mcps to restrict which MCP servers an agent loads (exe-os always included).",
19809
19914
  inputSchema: {
19810
19915
  agent_id: z48.string().optional().describe("Agent name, or 'default' for org-wide default. Omit to view all agents."),
19811
19916
  runtime: z48.string().optional().describe(`Runtime: ${Object.keys(KNOWN_RUNTIMES).join(", ")}`),
19812
19917
  model: z48.string().optional().describe("Model name (e.g. claude-opus-4, gpt-5.4, anthropic/claude-sonnet-4-6)"),
19813
- reasoning_effort: z48.string().optional().describe("Codex reasoning effort: low, medium, high, xhigh. Per-agent override for thinking/reasoning depth.")
19918
+ reasoning_effort: z48.string().optional().describe("Codex reasoning effort: low, medium, high, xhigh. Per-agent override for thinking/reasoning depth."),
19919
+ mcps: z48.array(z48.string()).optional().describe("MCP server allowlist. Only these servers load for this agent. exe-os always included. Omit to load all MCPs.")
19814
19920
  }
19815
19921
  },
19816
- async ({ agent_id, runtime, model, reasoning_effort }) => {
19922
+ async ({ agent_id, runtime, model, reasoning_effort, mcps }) => {
19817
19923
  const { agentId, agentRole } = getActiveAgent();
19818
19924
  const isCoordinator = isCoordinatorRole(agentRole) || (() => {
19819
19925
  try {
@@ -19845,15 +19951,26 @@ function registerSetAgentConfig(server2) {
19845
19951
  isError: true
19846
19952
  };
19847
19953
  }
19954
+ if (mcps && agent_id && !runtime && !model) {
19955
+ const { setAgentMcps: setAgentMcps2 } = await Promise.resolve().then(() => (init_agent_config(), agent_config_exports));
19956
+ const result4 = setAgentMcps2(agent_id, mcps);
19957
+ if (!result4.ok) {
19958
+ return { content: [{ type: "text", text: result4.error }], isError: true };
19959
+ }
19960
+ return {
19961
+ content: [{ type: "text", text: `Set ${agent_id} MCPs \u2192 [${mcps.join(", ")}] (exe-os always included)` }]
19962
+ };
19963
+ }
19848
19964
  if (!runtime || !model) {
19849
19965
  if (agent_id) {
19850
19966
  const cfg = getAgentRuntime(agent_id);
19851
19967
  const label = RUNTIME_LABELS[cfg.runtime] ?? cfg.runtime;
19968
+ const mcpInfo = cfg.mcps ? ` | MCPs: [${cfg.mcps.join(", ")}]` : " | MCPs: all";
19852
19969
  return {
19853
19970
  content: [
19854
19971
  {
19855
19972
  type: "text",
19856
- text: `${agent_id}: ${label} / ${cfg.model}`
19973
+ text: `${agent_id}: ${label} / ${cfg.model}${mcpInfo}`
19857
19974
  }
19858
19975
  ]
19859
19976
  };
@@ -19900,7 +20017,7 @@ function registerSetAgentConfig(server2) {
19900
20017
  isError: true
19901
20018
  };
19902
20019
  }
19903
- const result3 = setAgentRuntime(agent_id, runtime, model, reasoning_effort);
20020
+ const result3 = setAgentRuntime(agent_id, runtime, model, reasoning_effort, mcps);
19904
20021
  if (!result3.ok) {
19905
20022
  return {
19906
20023
  content: [{ type: "text", text: result3.error }],
@@ -19909,6 +20026,7 @@ function registerSetAgentConfig(server2) {
19909
20026
  }
19910
20027
  const parts = [`Set ${agent_id} \u2192 runtime=${runtime} model=${model}`];
19911
20028
  if (reasoning_effort) parts[0] += ` reasoning_effort=${reasoning_effort}`;
20029
+ if (mcps) parts[0] += ` mcps=[${mcps.join(", ")}]`;
19912
20030
  return {
19913
20031
  content: [{ type: "text", text: parts[0] }]
19914
20032
  };
@@ -22661,6 +22779,27 @@ async function cloudSync(config2) {
22661
22779
  if (stmts.length > 0) await client.batch(stmts, "write");
22662
22780
  pulled = pullResult.records.length;
22663
22781
  } else {
22782
+ try {
22783
+ const incomingIds = pullResult.records.map((r) => sqlSafe(r.id));
22784
+ if (incomingIds.length > 0) {
22785
+ const ph = incomingIds.map(() => "?").join(",");
22786
+ const existing = await client.execute({
22787
+ sql: `SELECT id, version, timestamp FROM memories WHERE id IN (${ph})`,
22788
+ args: incomingIds
22789
+ });
22790
+ const localMap = new Map(existing.rows.map((r) => [String(r.id), r]));
22791
+ for (const rec of pullResult.records) {
22792
+ const local = localMap.get(String(rec.id));
22793
+ if (local && Number(local.version) > 0 && Number(local.version) !== Number(rec.version ?? 0)) {
22794
+ process.stderr.write(
22795
+ `[cloud-sync] CONFLICT: memory ${String(rec.id).slice(0, 8)} \u2014 local v${local.version} vs remote v${rec.version ?? 0}. Remote wins (LWW).
22796
+ `
22797
+ );
22798
+ }
22799
+ }
22800
+ }
22801
+ } catch {
22802
+ }
22664
22803
  const stmts = pullResult.records.map((rec) => ({
22665
22804
  sql: `INSERT OR REPLACE INTO memories
22666
22805
  (id, agent_id, agent_role, session_id, timestamp,
@@ -25691,7 +25830,7 @@ var CLIENT_COO_PLACEHOLDERS = [
25691
25830
  "title"
25692
25831
  ];
25693
25832
  function renderClientCOOTemplate(vars) {
25694
- const resolved = { ...vars, title: vars.title || "Chief Operating Officer" };
25833
+ const resolved = { ...vars, title: vars.title || "Chief of Staff" };
25695
25834
  for (const key of CLIENT_COO_PLACEHOLDERS) {
25696
25835
  const value = resolved[key];
25697
25836
  if (typeof value !== "string" || value.length === 0) {
@@ -375,6 +375,7 @@ __export(agent_config_exports, {
375
375
  getAgentRuntime: () => getAgentRuntime,
376
376
  loadAgentConfig: () => loadAgentConfig,
377
377
  saveAgentConfig: () => saveAgentConfig,
378
+ setAgentMcps: () => setAgentMcps,
378
379
  setAgentRuntime: () => setAgentRuntime
379
380
  });
380
381
  import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync3 } from "fs";
@@ -401,7 +402,7 @@ function getAgentRuntime(agentId) {
401
402
  if (orgDefault) return orgDefault;
402
403
  return { runtime: DEFAULT_RUNTIME, model: DEFAULT_MODELS[DEFAULT_RUNTIME] };
403
404
  }
404
- function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
405
+ function setAgentRuntime(agentId, runtime, model, reasoning_effort, mcps) {
405
406
  const knownModels = KNOWN_RUNTIMES[runtime];
406
407
  if (!knownModels) {
407
408
  return {
@@ -416,12 +417,26 @@ function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
416
417
  };
417
418
  }
418
419
  const config = loadAgentConfig();
420
+ const existing = config[agentId];
419
421
  const entry = { runtime, model };
420
422
  if (reasoning_effort) entry.reasoning_effort = reasoning_effort;
423
+ if (mcps !== void 0) {
424
+ entry.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
425
+ } else if (existing?.mcps) {
426
+ entry.mcps = existing.mcps;
427
+ }
421
428
  config[agentId] = entry;
422
429
  saveAgentConfig(config);
423
430
  return { ok: true };
424
431
  }
432
+ function setAgentMcps(agentId, mcps) {
433
+ const config = loadAgentConfig();
434
+ const existing = config[agentId] ?? getAgentRuntime(agentId);
435
+ existing.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
436
+ config[agentId] = existing;
437
+ saveAgentConfig(config);
438
+ return { ok: true };
439
+ }
425
440
  function clearAgentRuntime(agentId) {
426
441
  const config = loadAgentConfig();
427
442
  delete config[agentId];
@@ -1579,7 +1594,7 @@ async function assertVpsLicense(opts) {
1579
1594
  }
1580
1595
  if (!transientFailure) {
1581
1596
  throw new Error(
1582
- "License validation failed: unknown backend state. Restore network connectivity to https://askexe.com/cloud and retry."
1597
+ "License validation failed: unknown backend state. Restore network connectivity to https://cloud.askexe.com and retry."
1583
1598
  );
1584
1599
  }
1585
1600
  const fresh = await getCachedLicense();
@@ -1616,7 +1631,7 @@ async function assertVpsLicense(opts) {
1616
1631
  } catch {
1617
1632
  }
1618
1633
  throw new Error(
1619
- `License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://askexe.com/cloud and retry. This VPS image refuses to boot after the offline grace window.`
1634
+ `License validation unreachable for more than ${graceDays} days. Restore network connectivity to https://cloud.askexe.com and retry. This VPS image refuses to boot after the offline grace window.`
1620
1635
  );
1621
1636
  }
1622
1637
  function startLicenseRevalidation(intervalMs = 36e5) {
@@ -1648,7 +1663,7 @@ var init_license = __esm({
1648
1663
  LICENSE_PATH = path7.join(EXE_AI_DIR, "license.key");
1649
1664
  CACHE_PATH = path7.join(EXE_AI_DIR, "license-cache.json");
1650
1665
  DEVICE_ID_PATH = path7.join(EXE_AI_DIR, "device-id");
1651
- API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://askexe.com/cloud";
1666
+ API_BASE = process.env.EXE_CLOUD_ENDPOINT ?? "https://cloud.askexe.com";
1652
1667
  RETRY_DELAY_MS = 500;
1653
1668
  LICENSE_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----
1654
1669
  MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEeHztAMOpR/ZMh+rWuOASjEZ54CGY
@@ -2674,11 +2689,12 @@ function getDispatchedBy(sessionKey) {
2674
2689
  }
2675
2690
  }
2676
2691
  function resolveExeSession() {
2692
+ if (process.env.EXE_SESSION_NAME) {
2693
+ const fromEnv = extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
2694
+ if (fromEnv) return fromEnv;
2695
+ }
2677
2696
  const mySession = getMySession();
2678
2697
  if (!mySession) {
2679
- if (process.env.EXE_SESSION_NAME) {
2680
- return extractRootExe(process.env.EXE_SESSION_NAME) ?? process.env.EXE_SESSION_NAME;
2681
- }
2682
2698
  return null;
2683
2699
  }
2684
2700
  const fromSessionName = extractRootExe(mySession);
@@ -2693,6 +2709,10 @@ function resolveExeSession() {
2693
2709
  `[tmux-routing] WARN: cache says "${fromCache}" but session name says "${fromSessionName}". Trusting session name.
2694
2710
  `
2695
2711
  );
2712
+ try {
2713
+ registerParentExe(key, fromSessionName);
2714
+ } catch {
2715
+ }
2696
2716
  candidate = fromSessionName;
2697
2717
  } else {
2698
2718
  candidate = fromCache;
@@ -3646,6 +3666,19 @@ async function resolveTask(client, identifier, scopeSession) {
3646
3666
  args: [identifier, ...scope.args]
3647
3667
  });
3648
3668
  if (result.rows.length === 1) return result.rows[0];
3669
+ if (/^[a-f0-9]{7,12}$/i.test(identifier)) {
3670
+ result = await client.execute({
3671
+ sql: `SELECT * FROM tasks WHERE id LIKE ?`,
3672
+ args: [`${identifier}%`]
3673
+ });
3674
+ if (result.rows.length === 1) return result.rows[0];
3675
+ if (result.rows.length > 1) {
3676
+ const matches = result.rows.map((r) => `${String(r.id)} "${String(r.title)}" (${String(r.status)})`).join(", ");
3677
+ throw new Error(
3678
+ `Multiple tasks match short-ID "${identifier}": ${matches}. Use a longer prefix to disambiguate.`
3679
+ );
3680
+ }
3681
+ }
3649
3682
  result = await client.execute({
3650
3683
  sql: `SELECT * FROM tasks WHERE task_file LIKE ?${scope.sql}`,
3651
3684
  args: [`%${identifier}%`, ...scope.args]
@@ -4192,12 +4225,13 @@ async function cascadeUnblock(taskId, baseDir, now) {
4192
4225
  WHERE blocked_by = ? AND status = 'blocked'`,
4193
4226
  args: [now, taskId]
4194
4227
  });
4195
- if (baseDir && unblocked.rowsAffected > 0) {
4196
- const ubScope = sessionScopeFilter();
4197
- const unblockedRows = await client.execute({
4198
- sql: `SELECT task_file FROM tasks WHERE blocked_by IS NULL AND updated_at = ?${ubScope.sql}`,
4199
- args: [now, ...ubScope.args]
4200
- });
4228
+ if (unblocked.rowsAffected === 0) return;
4229
+ const ubScope = sessionScopeFilter();
4230
+ const unblockedRows = await client.execute({
4231
+ sql: `SELECT id, title, assigned_to, priority, task_file FROM tasks WHERE blocked_by IS NULL AND updated_at = ?${ubScope.sql}`,
4232
+ args: [now, ...ubScope.args]
4233
+ });
4234
+ if (baseDir) {
4201
4235
  for (const ur of unblockedRows.rows) {
4202
4236
  try {
4203
4237
  const ubFile = path15.join(baseDir, String(ur.task_file));
@@ -4209,6 +4243,19 @@ async function cascadeUnblock(taskId, baseDir, now) {
4209
4243
  }
4210
4244
  }
4211
4245
  }
4246
+ if (unblockedRows.rows.length > 0 && !process.env.VITEST) {
4247
+ try {
4248
+ const { queueIntercom: queueIntercom2 } = await Promise.resolve().then(() => (init_intercom_queue(), intercom_queue_exports));
4249
+ const dispatched = /* @__PURE__ */ new Set();
4250
+ for (const ur of unblockedRows.rows) {
4251
+ const assignee = String(ur.assigned_to);
4252
+ if (dispatched.has(assignee)) continue;
4253
+ dispatched.add(assignee);
4254
+ queueIntercom2(`${assignee}`, `unblocked: "${String(ur.title)}" is now ready`);
4255
+ }
4256
+ } catch {
4257
+ }
4258
+ }
4212
4259
  }
4213
4260
  async function findNextTask(assignedTo) {
4214
4261
  const client = getClient();
@@ -4867,6 +4914,15 @@ var init_embedder = __esm({
4867
4914
  // src/lib/behaviors.ts
4868
4915
  import crypto5 from "crypto";
4869
4916
  async function storeBehavior(opts) {
4917
+ try {
4918
+ const { loadEmployeesSync: loadEmployeesSync2 } = await Promise.resolve().then(() => (init_employees(), employees_exports));
4919
+ const roster = loadEmployeesSync2();
4920
+ if (roster.length > 0 && !roster.some((e) => e.name === opts.agentId)) {
4921
+ throw new Error(`Agent "${opts.agentId}" not found in roster. Cannot store behavior for unregistered agent.`);
4922
+ }
4923
+ } catch (e) {
4924
+ if (e instanceof Error && e.message.includes("not found in roster")) throw e;
4925
+ }
4870
4926
  const client = getClient();
4871
4927
  const id = crypto5.randomUUID();
4872
4928
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -5320,6 +5376,12 @@ async function updateTask(input) {
5320
5376
  }
5321
5377
  }
5322
5378
  }
5379
+ if (input.status === "cancelled") {
5380
+ try {
5381
+ await cascadeUnblock(taskId, input.baseDir, now);
5382
+ } catch {
5383
+ }
5384
+ }
5323
5385
  if ((input.status === "done" || input.status === "closed") && !isCoordinatorName(String(row.assigned_to)) && !process.env.VITEST) {
5324
5386
  Promise.resolve().then(() => (init_skill_learning(), skill_learning_exports)).then(
5325
5387
  ({ captureAndLearn: captureAndLearn2 }) => captureAndLearn2({