@askexenow/exe-os 0.9.111 → 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 +62 -12
  3. package/dist/bin/agentic-reflection-backfill.js +37 -2
  4. package/dist/bin/agentic-semantic-label.js +37 -2
  5. package/dist/bin/backfill-conversations.js +61 -11
  6. package/dist/bin/backfill-responses.js +62 -12
  7. package/dist/bin/backfill-vectors.js +37 -2
  8. package/dist/bin/bulk-sync-postgres.js +63 -13
  9. package/dist/bin/cleanup-stale-review-tasks.js +83 -16
  10. package/dist/bin/cli.js +312 -80
  11. package/dist/bin/exe-agent-config.js +7 -1
  12. package/dist/bin/exe-agent.js +29 -3
  13. package/dist/bin/exe-assign.js +62 -12
  14. package/dist/bin/exe-boot.js +500 -151
  15. package/dist/bin/exe-call.js +46 -5
  16. package/dist/bin/exe-cloud.js +101 -16
  17. package/dist/bin/exe-dispatch.js +827 -27
  18. package/dist/bin/exe-doctor.js +61 -11
  19. package/dist/bin/exe-export-behaviors.js +67 -14
  20. package/dist/bin/exe-forget.js +62 -12
  21. package/dist/bin/exe-gateway.js +147 -27
  22. package/dist/bin/exe-heartbeat.js +83 -16
  23. package/dist/bin/exe-kill.js +62 -12
  24. package/dist/bin/exe-launch-agent.js +83 -15
  25. package/dist/bin/exe-new-employee.js +176 -8
  26. package/dist/bin/exe-pending-messages.js +83 -16
  27. package/dist/bin/exe-pending-notifications.js +83 -16
  28. package/dist/bin/exe-pending-reviews.js +83 -16
  29. package/dist/bin/exe-rename.js +62 -12
  30. package/dist/bin/exe-review.js +62 -12
  31. package/dist/bin/exe-search.js +62 -12
  32. package/dist/bin/exe-session-cleanup.js +949 -149
  33. package/dist/bin/exe-settings.js +10 -4
  34. package/dist/bin/exe-start-codex.js +537 -248
  35. package/dist/bin/exe-start-opencode.js +547 -168
  36. package/dist/bin/exe-status.js +83 -16
  37. package/dist/bin/exe-support.js +1 -1
  38. package/dist/bin/exe-team.js +62 -12
  39. package/dist/bin/git-sweep.js +827 -27
  40. package/dist/bin/graph-backfill.js +62 -12
  41. package/dist/bin/graph-export.js +62 -12
  42. package/dist/bin/install.js +62 -4
  43. package/dist/bin/intercom-check.js +949 -149
  44. package/dist/bin/pre-publish.js +14 -2
  45. package/dist/bin/scan-tasks.js +827 -27
  46. package/dist/bin/setup.js +99 -14
  47. package/dist/bin/shard-migrate.js +62 -12
  48. package/dist/bin/stack-update.js +1 -1
  49. package/dist/bin/update.js +3 -3
  50. package/dist/gateway/index.js +586 -26
  51. package/dist/hooks/bug-report-worker.js +586 -26
  52. package/dist/hooks/codex-stop-task-finalizer.js +977 -143
  53. package/dist/hooks/commit-complete.js +827 -27
  54. package/dist/hooks/error-recall.js +62 -12
  55. package/dist/hooks/ingest.js +4579 -249
  56. package/dist/hooks/instructions-loaded.js +62 -12
  57. package/dist/hooks/notification.js +62 -12
  58. package/dist/hooks/post-compact.js +83 -16
  59. package/dist/hooks/post-tool-combined.js +83 -16
  60. package/dist/hooks/pre-compact.js +907 -107
  61. package/dist/hooks/pre-tool-use.js +98 -16
  62. package/dist/hooks/prompt-submit.js +596 -30
  63. package/dist/hooks/session-end.js +909 -112
  64. package/dist/hooks/session-start.js +112 -17
  65. package/dist/hooks/stop.js +82 -15
  66. package/dist/hooks/subagent-stop.js +83 -16
  67. package/dist/hooks/summary-worker.js +81 -8
  68. package/dist/index.js +595 -29
  69. package/dist/lib/agent-config.js +16 -1
  70. package/dist/lib/cloud-sync.js +45 -1
  71. package/dist/lib/consolidation.js +16 -1
  72. package/dist/lib/database.js +23 -0
  73. package/dist/lib/db.js +23 -0
  74. package/dist/lib/device-registry.js +23 -0
  75. package/dist/lib/employee-templates.js +30 -4
  76. package/dist/lib/employees.js +16 -1
  77. package/dist/lib/exe-daemon.js +482 -52
  78. package/dist/lib/hybrid-search.js +62 -12
  79. package/dist/lib/license.js +3 -3
  80. package/dist/lib/messaging.js +21 -4
  81. package/dist/lib/schedules.js +37 -2
  82. package/dist/lib/skill-learning.js +910 -41
  83. package/dist/lib/status-brief.js +14 -1
  84. package/dist/lib/store.js +62 -12
  85. package/dist/lib/tasks.js +843 -93
  86. package/dist/lib/tmux-routing.js +766 -16
  87. package/dist/mcp/server.js +238 -41
  88. package/dist/mcp/tools/create-task.js +525 -15
  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 +840 -93
  93. package/dist/runtime/index.js +913 -107
  94. package/dist/tui/App.js +227 -58
  95. package/package.json +1 -1
@@ -1811,6 +1811,13 @@ async function ensureSchema() {
1811
1811
  } catch (e) {
1812
1812
  logCatchDebug("migration", e);
1813
1813
  }
1814
+ for (const col of ["created_by_agent TEXT", "created_by_device TEXT", "source_session_id TEXT"]) {
1815
+ try {
1816
+ await client.execute({ sql: `ALTER TABLE behaviors ADD COLUMN ${col}`, args: [] });
1817
+ } catch (e) {
1818
+ logCatchDebug("migration", e);
1819
+ }
1820
+ }
1814
1821
  try {
1815
1822
  await client.execute({
1816
1823
  sql: `ALTER TABLE tasks ADD COLUMN blocked_by TEXT`,
@@ -3027,6 +3034,22 @@ async function ensureSchema() {
3027
3034
  } catch (e) {
3028
3035
  logCatchDebug("migration", e);
3029
3036
  }
3037
+ try {
3038
+ await client.execute({
3039
+ sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
3040
+ args: []
3041
+ });
3042
+ } catch (e) {
3043
+ logCatchDebug("migration", e);
3044
+ }
3045
+ try {
3046
+ await client.execute({
3047
+ sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
3048
+ args: []
3049
+ });
3050
+ } catch (e) {
3051
+ logCatchDebug("migration", e);
3052
+ }
3030
3053
  }
3031
3054
  async function disposeDatabase() {
3032
3055
  if (_walCheckpointTimer) {
@@ -3593,11 +3616,17 @@ var init_platform_procedures = __esm({
3593
3616
  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."
3594
3617
  },
3595
3618
  {
3596
- title: "Customer orchestration maturity \u2014 recommend, never trap",
3619
+ title: "Orchestration phase guidance \u2014 recommend, never trap",
3597
3620
  domain: "workflow",
3598
3621
  priority: "p1",
3599
3622
  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."
3600
3623
  },
3624
+ {
3625
+ title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
3626
+ domain: "identity",
3627
+ priority: "p0",
3628
+ 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."
3629
+ },
3601
3630
  {
3602
3631
  title: "Single dispatch path \u2014 create_task only",
3603
3632
  domain: "workflow",
@@ -3631,6 +3660,12 @@ var init_platform_procedures = __esm({
3631
3660
  priority: "p0",
3632
3661
  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."
3633
3662
  },
3663
+ {
3664
+ title: "Destructive operations \u2014 mandatory reviewer gate",
3665
+ domain: "security",
3666
+ priority: "p0",
3667
+ 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."
3668
+ },
3634
3669
  {
3635
3670
  title: "Customer patch triage \u2014 upstream bug vs customization",
3636
3671
  domain: "support",
@@ -3782,7 +3817,7 @@ var init_platform_procedures = __esm({
3782
3817
  title: "MCP tool dispatch \u2014 all tools use action parameter",
3783
3818
  domain: "tool-use",
3784
3819
  priority: "p0",
3785
- content: 'exe-os MCP tools come in two surfaces depending on EXE_MCP_TOOL_SURFACE config. Consolidated (19 tools): action-based dispatch \u2014 memory(action="recall"), task(action="create"), etc. Legacy (108 tools): one tool per operation \u2014 recall_my_memory, create_task, etc. Both surfaces have identical functionality. Use whichever tool names are available in your session. If you see domain tools (memory, task, config, etc.), use the action parameter. If you see specific tools (recall_my_memory, create_task, etc.), call them directly.'
3820
+ content: 'exe-os MCP tools use consolidated action-based dispatch by default (19 tools). Call domain tools with an action parameter: memory(action="recall"), task(action="create"), config(action="list_employees"), etc. Legacy mode (108 separate tools like recall_my_memory, create_task) is still available via EXE_MCP_TOOL_SURFACE=legacy but will be removed in a future version. If you see specific tool names, call them directly \u2014 both surfaces are identical. Consolidated is the default and recommended surface.'
3786
3821
  },
3787
3822
  {
3788
3823
  title: "MCP tools \u2014 memory, decision, and search",
@@ -3916,10 +3951,24 @@ function stableId(memoryId, type, content) {
3916
3951
  return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
3917
3952
  }
3918
3953
  function cleanText(text) {
3919
- return text.replace(/```[\s\S]*?```/g, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
3920
- }
3921
- function splitSentences(text) {
3922
- return cleanText(text).split(/(?<=[.!?])\s+|\n+/).map((s) => s.trim()).filter((s) => s.length >= 24 && s.length <= MAX_SENTENCE_CHARS);
3954
+ let cleaned = text.replace(
3955
+ /```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
3956
+ (_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
3957
+ );
3958
+ cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
3959
+ return cleaned;
3960
+ }
3961
+ function splitSegments(text) {
3962
+ const cleaned = cleanText(text);
3963
+ 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);
3964
+ if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
3965
+ const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
3966
+ if (lines.length > 0) return lines;
3967
+ if (cleaned.length >= MIN_SEGMENT_CHARS) {
3968
+ return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
3969
+ }
3970
+ }
3971
+ return segments;
3923
3972
  }
3924
3973
  function inferCardType(sentence, toolName) {
3925
3974
  const lower = sentence.toLowerCase();
@@ -3951,12 +4000,12 @@ function predicateFor(type) {
3951
4000
  }
3952
4001
  }
3953
4002
  function extractMemoryCards(row) {
3954
- const sentences = splitSentences(row.raw_text);
4003
+ const segments = splitSegments(row.raw_text);
3955
4004
  const cards = [];
3956
- for (const sentence of sentences) {
4005
+ for (const sentence of segments) {
3957
4006
  const type = inferCardType(sentence, row.tool_name);
3958
4007
  const subject = extractSubject(sentence, row.agent_id);
3959
- const content = sentence.length > MAX_SENTENCE_CHARS ? `${sentence.slice(0, MAX_SENTENCE_CHARS - 1)}\u2026` : sentence;
4008
+ const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
3960
4009
  cards.push({
3961
4010
  id: stableId(row.id, type, content),
3962
4011
  memory_id: row.id,
@@ -4052,13 +4101,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
4052
4101
  last_accessed: String(row.timestamp)
4053
4102
  }));
4054
4103
  }
4055
- var MAX_CARDS_PER_MEMORY, MAX_SENTENCE_CHARS;
4104
+ var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
4056
4105
  var init_memory_cards = __esm({
4057
4106
  "src/lib/memory-cards.ts"() {
4058
4107
  "use strict";
4059
4108
  init_database();
4060
- MAX_CARDS_PER_MEMORY = 6;
4061
- MAX_SENTENCE_CHARS = 360;
4109
+ MAX_CARDS_PER_MEMORY = 8;
4110
+ MAX_SEGMENT_CHARS = 500;
4111
+ MIN_SEGMENT_CHARS = 20;
4062
4112
  }
4063
4113
  });
4064
4114
 
@@ -2026,6 +2026,13 @@ async function ensureSchema() {
2026
2026
  } catch (e) {
2027
2027
  logCatchDebug("migration", e);
2028
2028
  }
2029
+ for (const col of ["created_by_agent TEXT", "created_by_device TEXT", "source_session_id TEXT"]) {
2030
+ try {
2031
+ await client.execute({ sql: `ALTER TABLE behaviors ADD COLUMN ${col}`, args: [] });
2032
+ } catch (e) {
2033
+ logCatchDebug("migration", e);
2034
+ }
2035
+ }
2029
2036
  try {
2030
2037
  await client.execute({
2031
2038
  sql: `ALTER TABLE tasks ADD COLUMN blocked_by TEXT`,
@@ -3242,6 +3249,22 @@ async function ensureSchema() {
3242
3249
  } catch (e) {
3243
3250
  logCatchDebug("migration", e);
3244
3251
  }
3252
+ try {
3253
+ await client.execute({
3254
+ sql: `ALTER TABLE memories ADD COLUMN visibility TEXT DEFAULT 'private'`,
3255
+ args: []
3256
+ });
3257
+ } catch (e) {
3258
+ logCatchDebug("migration", e);
3259
+ }
3260
+ try {
3261
+ await client.execute({
3262
+ sql: `ALTER TABLE memories ADD COLUMN strength REAL DEFAULT 1.0`,
3263
+ args: []
3264
+ });
3265
+ } catch (e) {
3266
+ logCatchDebug("migration", e);
3267
+ }
3245
3268
  }
3246
3269
  async function disposeDatabase() {
3247
3270
  if (_walCheckpointTimer) {
@@ -4365,11 +4388,17 @@ var init_platform_procedures = __esm({
4365
4388
  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."
4366
4389
  },
4367
4390
  {
4368
- title: "Customer orchestration maturity \u2014 recommend, never trap",
4391
+ title: "Orchestration phase guidance \u2014 recommend, never trap",
4369
4392
  domain: "workflow",
4370
4393
  priority: "p1",
4371
4394
  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."
4372
4395
  },
4396
+ {
4397
+ title: "Routing slot vs display title \u2014 internal 'coo' is plumbing, not your name",
4398
+ domain: "identity",
4399
+ priority: "p0",
4400
+ 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."
4401
+ },
4373
4402
  {
4374
4403
  title: "Single dispatch path \u2014 create_task only",
4375
4404
  domain: "workflow",
@@ -4403,6 +4432,12 @@ var init_platform_procedures = __esm({
4403
4432
  priority: "p0",
4404
4433
  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."
4405
4434
  },
4435
+ {
4436
+ title: "Destructive operations \u2014 mandatory reviewer gate",
4437
+ domain: "security",
4438
+ priority: "p0",
4439
+ 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."
4440
+ },
4406
4441
  {
4407
4442
  title: "Customer patch triage \u2014 upstream bug vs customization",
4408
4443
  domain: "support",
@@ -4554,7 +4589,7 @@ var init_platform_procedures = __esm({
4554
4589
  title: "MCP tool dispatch \u2014 all tools use action parameter",
4555
4590
  domain: "tool-use",
4556
4591
  priority: "p0",
4557
- content: 'exe-os MCP tools come in two surfaces depending on EXE_MCP_TOOL_SURFACE config. Consolidated (19 tools): action-based dispatch \u2014 memory(action="recall"), task(action="create"), etc. Legacy (108 tools): one tool per operation \u2014 recall_my_memory, create_task, etc. Both surfaces have identical functionality. Use whichever tool names are available in your session. If you see domain tools (memory, task, config, etc.), use the action parameter. If you see specific tools (recall_my_memory, create_task, etc.), call them directly.'
4592
+ content: 'exe-os MCP tools use consolidated action-based dispatch by default (19 tools). Call domain tools with an action parameter: memory(action="recall"), task(action="create"), config(action="list_employees"), etc. Legacy mode (108 separate tools like recall_my_memory, create_task) is still available via EXE_MCP_TOOL_SURFACE=legacy but will be removed in a future version. If you see specific tool names, call them directly \u2014 both surfaces are identical. Consolidated is the default and recommended surface.'
4558
4593
  },
4559
4594
  {
4560
4595
  title: "MCP tools \u2014 memory, decision, and search",
@@ -4688,10 +4723,24 @@ function stableId(memoryId, type, content) {
4688
4723
  return createHash2("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
4689
4724
  }
4690
4725
  function cleanText(text) {
4691
- return text.replace(/```[\s\S]*?```/g, " ").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
4692
- }
4693
- function splitSentences(text) {
4694
- return cleanText(text).split(/(?<=[.!?])\s+|\n+/).map((s) => s.trim()).filter((s) => s.length >= 24 && s.length <= MAX_SENTENCE_CHARS);
4726
+ let cleaned = text.replace(
4727
+ /```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
4728
+ (_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
4729
+ );
4730
+ cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
4731
+ return cleaned;
4732
+ }
4733
+ function splitSegments(text) {
4734
+ const cleaned = cleanText(text);
4735
+ 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);
4736
+ if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
4737
+ const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
4738
+ if (lines.length > 0) return lines;
4739
+ if (cleaned.length >= MIN_SEGMENT_CHARS) {
4740
+ return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
4741
+ }
4742
+ }
4743
+ return segments;
4695
4744
  }
4696
4745
  function inferCardType(sentence, toolName) {
4697
4746
  const lower = sentence.toLowerCase();
@@ -4723,12 +4772,12 @@ function predicateFor(type) {
4723
4772
  }
4724
4773
  }
4725
4774
  function extractMemoryCards(row) {
4726
- const sentences = splitSentences(row.raw_text);
4775
+ const segments = splitSegments(row.raw_text);
4727
4776
  const cards = [];
4728
- for (const sentence of sentences) {
4777
+ for (const sentence of segments) {
4729
4778
  const type = inferCardType(sentence, row.tool_name);
4730
4779
  const subject = extractSubject(sentence, row.agent_id);
4731
- const content = sentence.length > MAX_SENTENCE_CHARS ? `${sentence.slice(0, MAX_SENTENCE_CHARS - 1)}\u2026` : sentence;
4780
+ const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
4732
4781
  cards.push({
4733
4782
  id: stableId(row.id, type, content),
4734
4783
  memory_id: row.id,
@@ -4824,13 +4873,14 @@ Source memory: ${String(row.source_ref ?? row.memory_id)}`,
4824
4873
  last_accessed: String(row.timestamp)
4825
4874
  }));
4826
4875
  }
4827
- var MAX_CARDS_PER_MEMORY, MAX_SENTENCE_CHARS;
4876
+ var MAX_CARDS_PER_MEMORY, MAX_SEGMENT_CHARS, MIN_SEGMENT_CHARS;
4828
4877
  var init_memory_cards = __esm({
4829
4878
  "src/lib/memory-cards.ts"() {
4830
4879
  "use strict";
4831
4880
  init_database();
4832
- MAX_CARDS_PER_MEMORY = 6;
4833
- MAX_SENTENCE_CHARS = 360;
4881
+ MAX_CARDS_PER_MEMORY = 8;
4882
+ MAX_SEGMENT_CHARS = 500;
4883
+ MIN_SEGMENT_CHARS = 20;
4834
4884
  }
4835
4885
  });
4836
4886
 
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __esm = (fn, res) => function __init() {
5
7
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
6
8
  };
@@ -8,6 +10,15 @@ var __export = (target, all) => {
8
10
  for (var name in all)
9
11
  __defProp(target, name, { get: all[name], enumerable: true });
10
12
  };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
11
22
 
12
23
  // src/lib/secure-files.ts
13
24
  import { chmodSync, existsSync, mkdirSync } from "fs";
@@ -171,6 +182,7 @@ __export(agent_config_exports, {
171
182
  getAgentRuntime: () => getAgentRuntime,
172
183
  loadAgentConfig: () => loadAgentConfig,
173
184
  saveAgentConfig: () => saveAgentConfig,
185
+ setAgentMcps: () => setAgentMcps,
174
186
  setAgentRuntime: () => setAgentRuntime
175
187
  });
176
188
  import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync3 } from "fs";
@@ -197,7 +209,7 @@ function getAgentRuntime(agentId) {
197
209
  if (orgDefault) return orgDefault;
198
210
  return { runtime: DEFAULT_RUNTIME, model: DEFAULT_MODELS[DEFAULT_RUNTIME] };
199
211
  }
200
- function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
212
+ function setAgentRuntime(agentId, runtime, model, reasoning_effort, mcps) {
201
213
  const knownModels = KNOWN_RUNTIMES[runtime];
202
214
  if (!knownModels) {
203
215
  return {
@@ -212,12 +224,26 @@ function setAgentRuntime(agentId, runtime, model, reasoning_effort) {
212
224
  };
213
225
  }
214
226
  const config = loadAgentConfig();
227
+ const existing = config[agentId];
215
228
  const entry = { runtime, model };
216
229
  if (reasoning_effort) entry.reasoning_effort = reasoning_effort;
230
+ if (mcps !== void 0) {
231
+ entry.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
232
+ } else if (existing?.mcps) {
233
+ entry.mcps = existing.mcps;
234
+ }
217
235
  config[agentId] = entry;
218
236
  saveAgentConfig(config);
219
237
  return { ok: true };
220
238
  }
239
+ function setAgentMcps(agentId, mcps) {
240
+ const config = loadAgentConfig();
241
+ const existing = config[agentId] ?? getAgentRuntime(agentId);
242
+ existing.mcps = mcps.includes("exe-os") ? mcps : ["exe-os", ...mcps];
243
+ config[agentId] = existing;
244
+ saveAgentConfig(config);
245
+ return { ok: true };
246
+ }
221
247
  function clearAgentRuntime(agentId) {
222
248
  const config = loadAgentConfig();
223
249
  delete config[agentId];
@@ -614,6 +640,16 @@ import { chmodSync as chmodSync2, existsSync as existsSync7, mkdirSync as mkdirS
614
640
  import { randomBytes } from "crypto";
615
641
  import path6 from "path";
616
642
  import os5 from "os";
643
+ function resolveDefaultAgentId() {
644
+ if (process.env.AGENT_ID && process.env.AGENT_ID !== "default") return process.env.AGENT_ID;
645
+ try {
646
+ const { loadEmployeesSync: loadEmployeesSync2 } = (init_employees(), __toCommonJS(employees_exports));
647
+ const coo = loadEmployeesSync2().find((e) => e.role === "COO");
648
+ if (coo) return coo.name;
649
+ } catch {
650
+ }
651
+ return "exe";
652
+ }
617
653
  function mcpHttpPort() {
618
654
  return process.env.EXE_MCP_PORT || DEFAULT_MCP_HTTP_PORT;
619
655
  }
@@ -643,11 +679,14 @@ function readOrCreateDaemonToken(homeDir = os5.homedir()) {
643
679
  function buildMcpHttpHeaders(homeDir = os5.homedir(), opts = {}) {
644
680
  const agentId = opts.useShellPlaceholders ? "${AGENT_ID:-exe}" : opts.agentId ?? DEFAULT_MCP_HTTP_AGENT_ID;
645
681
  const agentRole = opts.useShellPlaceholders ? "${AGENT_ROLE:-COO}" : opts.agentRole ?? DEFAULT_MCP_HTTP_AGENT_ROLE;
646
- return {
682
+ const sessionName = opts.useShellPlaceholders ? "$(tmux display-message -p '#{session_name}' 2>/dev/null || echo '')" : process.env.EXE_SESSION_NAME ?? "";
683
+ const headers = {
647
684
  Authorization: `Bearer ${readOrCreateDaemonToken(homeDir)}`,
648
685
  "X-Agent-Id": agentId,
649
686
  "X-Agent-Role": agentRole
650
687
  };
688
+ if (sessionName) headers["X-Exe-Session"] = sessionName;
689
+ return headers;
651
690
  }
652
691
  function buildClaudeHttpMcpEntry(homeDir = os5.homedir()) {
653
692
  return {
@@ -661,19 +700,22 @@ var init_mcp_http_config = __esm({
661
700
  "src/adapters/mcp-http-config.ts"() {
662
701
  "use strict";
663
702
  DEFAULT_MCP_HTTP_PORT = "48739";
664
- DEFAULT_MCP_HTTP_AGENT_ID = "exe";
703
+ DEFAULT_MCP_HTTP_AGENT_ID = resolveDefaultAgentId();
665
704
  DEFAULT_MCP_HTTP_AGENT_ROLE = "COO";
666
705
  }
667
706
  });
668
707
 
669
708
  // src/adapters/runtime-hook-manifest.ts
709
+ function isLegacyHomeDirHookCommand(command) {
710
+ return LEGACY_HOME_DIR_HOOK_PATTERNS.some((pattern) => command.includes(pattern));
711
+ }
670
712
  function commandHasAnyMarker(command, markers) {
671
713
  return markers.some((marker) => command.includes(marker));
672
714
  }
673
715
  function isLegacySplitPostToolCommand(command) {
674
716
  return commandHasAnyMarker(command, LEGACY_SPLIT_POST_TOOL_HOOK_MARKERS);
675
717
  }
676
- var EXE_HOOKS, EXE_HOOK_MANIFEST, LEGACY_SPLIT_POST_TOOL_HOOK_MARKERS;
718
+ var EXE_HOOKS, EXE_HOOK_MANIFEST, LEGACY_SPLIT_POST_TOOL_HOOK_MARKERS, LEGACY_HOME_DIR_HOOK_PATTERNS;
677
719
  var init_runtime_hook_manifest = __esm({
678
720
  "src/adapters/runtime-hook-manifest.ts"() {
679
721
  "use strict";
@@ -806,6 +848,14 @@ var init_runtime_hook_manifest = __esm({
806
848
  "dist/hooks/error-recall.js",
807
849
  "dist/hooks/ingest-worker.js"
808
850
  ];
851
+ LEGACY_HOME_DIR_HOOK_PATTERNS = [
852
+ ".exe-os/hooks/",
853
+ // Old hook storage path (pre-npm-package era)
854
+ "log-prefix.js",
855
+ // Removed hook from early versions
856
+ "approval-bridge.log"
857
+ // Removed log redirect from early versions
858
+ ];
809
859
  }
810
860
  });
811
861
 
@@ -1272,6 +1322,14 @@ async function mergeHooks(packageRoot, homeDir = os6.homedir()) {
1272
1322
  ];
1273
1323
  let added = 0;
1274
1324
  let skipped = 0;
1325
+ for (const eventKey of Object.keys(settings.hooks)) {
1326
+ const groups = settings.hooks[eventKey];
1327
+ if (!Array.isArray(groups)) continue;
1328
+ settings.hooks[eventKey] = groups.map((g) => ({
1329
+ ...g,
1330
+ hooks: g.hooks.filter((h) => !isLegacyHomeDirHookCommand(h.command))
1331
+ })).filter((g) => g.hooks.length > 0);
1332
+ }
1275
1333
  const postToolGroups = settings.hooks["PostToolUse"];
1276
1334
  if (Array.isArray(postToolGroups)) {
1277
1335
  settings.hooks["PostToolUse"] = postToolGroups.map((g) => ({