@askexenow/exe-os 0.9.148 → 0.9.153

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 (209) hide show
  1. package/dist/{active-agent-NCZCDDZ2.js → active-agent-HDUT3T3I.js} +2 -2
  2. package/dist/{active-agent-KMQCNXXD.js → active-agent-XHERKXH6.js} +2 -2
  3. package/dist/{agentic-ontology-SQR74CO7.js → agentic-ontology-GMK3MB3U.js} +1 -1
  4. package/dist/{backfill-metadata-KMDWLDXU.js → backfill-metadata-PPI5QFYW.js} +3 -3
  5. package/dist/{behaviors-4U2N5L4E.js → behaviors-JG75DNG3.js} +2 -2
  6. package/dist/bin/agentic-ontology-backfill.js +4 -4
  7. package/dist/bin/agentic-reflection-backfill.js +5 -5
  8. package/dist/bin/agentic-semantic-label.js +4 -4
  9. package/dist/bin/backfill-conversations.js +3 -3
  10. package/dist/bin/backfill-responses.js +3 -3
  11. package/dist/bin/backfill-vectors.js +4 -4
  12. package/dist/bin/bulk-sync-postgres.js +8 -7
  13. package/dist/bin/cleanup-stale-review-tasks.js +5 -5
  14. package/dist/bin/cli.js +12 -12
  15. package/dist/bin/exe-agent-config.js +1 -1
  16. package/dist/bin/exe-agent.js +4 -4
  17. package/dist/bin/exe-assign.js +4 -4
  18. package/dist/bin/exe-boot.js +13 -13
  19. package/dist/bin/exe-call.js +4 -4
  20. package/dist/bin/exe-cloud.js +3 -3
  21. package/dist/bin/exe-dispatch.js +5 -5
  22. package/dist/bin/exe-doctor.js +1 -1
  23. package/dist/bin/exe-export-behaviors.js +6 -6
  24. package/dist/bin/exe-forget.js +5 -5
  25. package/dist/bin/exe-gateway.js +5 -5
  26. package/dist/bin/exe-heartbeat.js +5 -5
  27. package/dist/bin/exe-kill.js +28 -6
  28. package/dist/bin/exe-launch-agent.js +10 -10
  29. package/dist/bin/exe-new-employee.js +6 -6
  30. package/dist/bin/exe-pending-messages.js +6 -6
  31. package/dist/bin/exe-pending-notifications.js +5 -5
  32. package/dist/bin/exe-pending-reviews.js +5 -5
  33. package/dist/bin/exe-rename.js +4 -4
  34. package/dist/bin/exe-review.js +7 -7
  35. package/dist/bin/exe-search.js +4 -4
  36. package/dist/bin/exe-session-cleanup.js +15 -14
  37. package/dist/bin/exe-settings.js +3 -3
  38. package/dist/bin/exe-start-codex.js +10 -10
  39. package/dist/bin/exe-start-opencode.js +7 -7
  40. package/dist/bin/exe-status.js +6 -6
  41. package/dist/bin/exe-team.js +2 -2
  42. package/dist/bin/git-sweep.js +5 -5
  43. package/dist/bin/graph-backfill.js +3 -3
  44. package/dist/bin/graph-export.js +4 -4
  45. package/dist/bin/install.js +5 -5
  46. package/dist/bin/intercom-check.js +4 -4
  47. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  48. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  49. package/dist/bin/pre-publish.js +1 -1
  50. package/dist/bin/scan-tasks.js +5 -5
  51. package/dist/bin/setup.js +1 -1
  52. package/dist/bin/shard-migrate.js +3 -3
  53. package/dist/bin/stack-update.js +21 -0
  54. package/dist/{capacity-monitor-Q5M5SVRC.js → capacity-monitor-5IVGAQ34.js} +6 -6
  55. package/dist/{catchup-brief-IPNSW7RQ.js → catchup-brief-HFJR32Q3.js} +7 -7
  56. package/dist/{chunk-Y6TS42WD.js → chunk-25NSQUZ3.js} +6 -6
  57. package/dist/{chunk-2BPO7VQF.js → chunk-3ZU7RTMF.js} +35 -9
  58. package/dist/{chunk-MKUVEDUE.js → chunk-4IEQIUBZ.js} +2 -2
  59. package/dist/{chunk-ONMRBKAX.js → chunk-4PDXCEXT.js} +37 -42
  60. package/dist/{chunk-J4RAXKTC.js → chunk-4RKL53PD.js} +5 -4
  61. package/dist/{chunk-AERGE6GC.js → chunk-5NSTNICM.js} +1 -1
  62. package/dist/{chunk-FNMNKYVH.js → chunk-5U5MI4VH.js} +56 -56
  63. package/dist/{chunk-TOXHEZN5.js → chunk-7WEVNBV2.js} +2 -2
  64. package/dist/{chunk-UPL5FEZY.js → chunk-AFMQR776.js} +1 -1
  65. package/dist/{chunk-XK7VZFCC.js → chunk-AMVDQ7HH.js} +12 -8
  66. package/dist/{chunk-AGFWOII2.js → chunk-BPBUSSYF.js} +196 -9
  67. package/dist/{chunk-MBA4NNTS.js → chunk-BR5UVRA2.js} +1 -1
  68. package/dist/{chunk-4GLEFA2X.js → chunk-BV2JVO2U.js} +1 -1
  69. package/dist/{chunk-LL5EY6OQ.js → chunk-CBLNQNWT.js} +1 -1
  70. package/dist/{chunk-VYVESELG.js → chunk-CF4DZKKE.js} +2 -2
  71. package/dist/{chunk-PMWDO5FR.js → chunk-CO2SF5SB.js} +1 -1
  72. package/dist/{chunk-ARGBV4PP.js → chunk-EOU4ZLRZ.js} +1 -1
  73. package/dist/{chunk-CGQ5PWS3.js → chunk-EYQ3DHHI.js} +4 -4
  74. package/dist/{chunk-JH7Z2AZ7.js → chunk-GJMHN45Z.js} +1 -1
  75. package/dist/{chunk-X2XE65WV.js → chunk-H5STRY47.js} +9 -4
  76. package/dist/chunk-HZNQYDAN.js +94 -0
  77. package/dist/{chunk-DBXKWFTK.js → chunk-IWGGTD5D.js} +3 -3
  78. package/dist/{chunk-JF3Q5YKI.js → chunk-JJA6F6NA.js} +2 -2
  79. package/dist/{chunk-NJKERRSG.js → chunk-JUM3EUB2.js} +2 -2
  80. package/dist/{chunk-ZMJHXDZR.js → chunk-L5WTOR3T.js} +3 -3
  81. package/dist/{chunk-YPSN64BU.js → chunk-LIJC4CRF.js} +1 -1
  82. package/dist/{chunk-DTLASDQM.js → chunk-LM7TQYLW.js} +1 -1
  83. package/dist/{chunk-B4HAUSVQ.js → chunk-M37FGM3X.js} +2 -2
  84. package/dist/{chunk-TH6HTK2L.js → chunk-MBYJEE3B.js} +5 -1
  85. package/dist/{chunk-YOG7TWMO.js → chunk-MNIJA5BL.js} +1 -1
  86. package/dist/{chunk-XWQKCCCO.js → chunk-MWRHXGAB.js} +7 -0
  87. package/dist/{chunk-FG4Z2XFU.js → chunk-OEPEY47B.js} +1 -1
  88. package/dist/{chunk-ZUAXTH6Z.js → chunk-OQYZQR24.js} +2 -2
  89. package/dist/{chunk-3MLGUSKS.js → chunk-PC6Y4ATU.js} +1 -1
  90. package/dist/{chunk-4EINMZNO.js → chunk-PMCXWAVQ.js} +2 -2
  91. package/dist/{chunk-2OATM2JZ.js → chunk-Q7GVSS2J.js} +1 -1
  92. package/dist/{chunk-LJML7HT2.js → chunk-RAMU6E5T.js} +1 -1
  93. package/dist/{chunk-26UVGP3I.js → chunk-SFV2XRPY.js} +1 -1
  94. package/dist/{chunk-EHNSK2Y4.js → chunk-SGLVCPZP.js} +2 -2
  95. package/dist/{chunk-QB66MH2V.js → chunk-SJKOILTX.js} +1 -1
  96. package/dist/{chunk-NFHFNPTN.js → chunk-UHL4QL5E.js} +1 -1
  97. package/dist/{chunk-IFACD7E6.js → chunk-UPAEAL6K.js} +3 -3
  98. package/dist/{chunk-HHMHL4FB.js → chunk-UQE5R5PM.js} +2 -2
  99. package/dist/{chunk-3FIWKONP.js → chunk-VJW3E5KW.js} +14 -14
  100. package/dist/{chunk-MKPSMRVX.js → chunk-WLSSSDAR.js} +1 -1
  101. package/dist/{chunk-LC53LVOT.js → chunk-WPNWFI4A.js} +2 -2
  102. package/dist/{chunk-VK2AWQ6D.js → chunk-WZMS6X56.js} +2 -2
  103. package/dist/{chunk-VNTDQUOG.js → chunk-XQC5BNCJ.js} +17 -12
  104. package/dist/{chunk-UPMKSFBU.js → chunk-YOH3ABTS.js} +2 -2
  105. package/dist/{chunk-ZZLTJXKR.js → chunk-ZGKU4PMY.js} +2 -2
  106. package/dist/{crdt-sync-XMC6LT2Q.js → crdt-sync-3VQP2ISB.js} +1 -1
  107. package/dist/{crm-webhook-QMHD5YYQ.js → crm-webhook-SOUYMO3X.js} +2 -2
  108. package/dist/{cto-delegation-gate-BTZWAA4E.js → cto-delegation-gate-UGCMXYAO.js} +4 -4
  109. package/dist/{daemon-orchestration-HFODCB52.js → daemon-orchestration-MD34RKQZ.js} +7 -7
  110. package/dist/{exe-drift-SED6KQTZ.js → exe-drift-L5ZHO3CZ.js} +2 -2
  111. package/dist/{exe-export-ADSWDE5U.js → exe-export-UDQU7MMM.js} +5 -5
  112. package/dist/{exe-import-WFLNGJZP.js → exe-import-OY42LQL4.js} +5 -5
  113. package/dist/{exe-key-4L32R46F.js → exe-key-FC67RNXI.js} +1 -1
  114. package/dist/{fast-db-init-HVAVS35N.js → fast-db-init-TLOT2K43.js} +1 -1
  115. package/dist/gateway/index.js +6 -6
  116. package/dist/{git-staleness-BY4ZK6MW.js → git-staleness-MSTOMG55.js} +1 -1
  117. package/dist/{git-task-sweep-RSRASAHB.js → git-task-sweep-D4IKRGCV.js} +5 -5
  118. package/dist/{global-procedures-EKYSVONR.js → global-procedures-ISPSC4B5.js} +3 -3
  119. package/dist/{graph-auto-extract-HWZ5GVXZ.js → graph-auto-extract-D4I7DF2S.js} +1 -1
  120. package/dist/{hook-integrity-PR4BPZBT.js → hook-integrity-SA7S2SNI.js} +1 -1
  121. package/dist/hooks/bug-report-worker.js +6 -6
  122. package/dist/hooks/codex-stop-task-finalizer.js +6 -6
  123. package/dist/hooks/commit-complete.js +7 -7
  124. package/dist/hooks/error-recall.js +5 -5
  125. package/dist/hooks/exe-heartbeat-hook.js +2 -2
  126. package/dist/hooks/ingest.js +9 -9
  127. package/dist/hooks/instructions-loaded.js +3 -3
  128. package/dist/hooks/notification.js +3 -3
  129. package/dist/hooks/post-compact.js +6 -6
  130. package/dist/hooks/post-tool-combined.js +4 -4
  131. package/dist/hooks/pre-compact.js +7 -7
  132. package/dist/hooks/pre-tool-use.js +19 -10
  133. package/dist/hooks/prompt-submit.js +109 -45
  134. package/dist/hooks/session-end.js +11 -11
  135. package/dist/hooks/session-start.js +7 -7
  136. package/dist/hooks/stop.js +10 -10
  137. package/dist/hooks/subagent-stop.js +6 -6
  138. package/dist/hooks/summary-worker.js +10 -10
  139. package/dist/index.js +12 -12
  140. package/dist/{installer-X5FEYJIA.js → installer-3YHQ5DJZ.js} +4 -4
  141. package/dist/{installer-RLKOACKG.js → installer-4YIOBAFV.js} +4 -4
  142. package/dist/{installer-W4NY3OBF.js → installer-SPQDAGPW.js} +4 -4
  143. package/dist/lib/cloud-sync.js +3 -3
  144. package/dist/lib/consolidation.js +4 -4
  145. package/dist/lib/database.js +1 -1
  146. package/dist/lib/db.js +1 -1
  147. package/dist/lib/employee-templates.js +4 -4
  148. package/dist/lib/employees.js +1 -1
  149. package/dist/lib/exe-daemon.js +61 -44
  150. package/dist/lib/hybrid-search.js +4 -4
  151. package/dist/lib/identity.js +1 -1
  152. package/dist/lib/messaging.js +5 -5
  153. package/dist/lib/reminders.js +2 -2
  154. package/dist/lib/schedules.js +4 -4
  155. package/dist/lib/skill-learning.js +3 -3
  156. package/dist/lib/store.js +3 -3
  157. package/dist/lib/task-router.js +2 -2
  158. package/dist/lib/tasks.js +5 -5
  159. package/dist/lib/tmux-routing.js +4 -4
  160. package/dist/lib/token-spend.js +2 -2
  161. package/dist/mcp/register-tools.js +42 -42
  162. package/dist/mcp/server.js +43 -43
  163. package/dist/mcp/tools/complete-reminder.js +3 -3
  164. package/dist/mcp/tools/create-reminder.js +3 -3
  165. package/dist/mcp/tools/create-task.js +7 -7
  166. package/dist/mcp/tools/deactivate-behavior.js +4 -4
  167. package/dist/mcp/tools/list-reminders.js +3 -3
  168. package/dist/mcp/tools/list-tasks.js +7 -7
  169. package/dist/mcp/tools/send-message.js +7 -7
  170. package/dist/mcp/tools/update-task.js +6 -6
  171. package/dist/{mcp-http-config-6YLW4PFG.js → mcp-http-config-JBNX3DAR.js} +2 -2
  172. package/dist/{memory-cards-UAQCO4QR.js → memory-cards-SYVGSLXW.js} +1 -1
  173. package/dist/{memory-poisoning-defense-VWITZ4WO.js → memory-poisoning-defense-T7AC4LZN.js} +1 -1
  174. package/dist/{memory-reflection-JQC4ZSUD.js → memory-reflection-FNJU7VFC.js} +1 -1
  175. package/dist/{notifications-YDOKTVCH.js → notifications-76XXO4Q7.js} +4 -4
  176. package/dist/{orchestrator-BZ2D6ZM6.js → orchestrator-XAT2JSBT.js} +6 -6
  177. package/dist/{plan-limits-KUTODKG6.js → plan-limits-IAUNTZUW.js} +2 -2
  178. package/dist/{projection-worker-UY7R2EQJ.js → projection-worker-S6LYSY22.js} +1 -1
  179. package/dist/{push-notifications-KDYFOJRI.js → push-notifications-NSYLKFXR.js} +1 -1
  180. package/dist/{review-polling-DORNZ2KI.js → review-polling-E24XBNSI.js} +5 -5
  181. package/dist/runtime/index.js +7 -7
  182. package/dist/{session-events-5WR5RVDK.js → session-events-CCXFQRFW.js} +5 -5
  183. package/dist/{session-kill-telemetry-DHSQV2CI.js → session-kill-telemetry-TX5NCPUV.js} +2 -2
  184. package/dist/{session-scope-D4Q62ZOZ.js → session-scope-7QCZF3MJ.js} +4 -4
  185. package/dist/{setup-wizard-QVNTI3T4.js → setup-wizard-FA6YEYER.js} +1 -1
  186. package/dist/signal-paths-4GOIRLGH.js +19 -0
  187. package/dist/{task-enforcement-OYCQXBBC.js → task-enforcement-NITY7TBM.js} +4 -4
  188. package/dist/{task-scope-WWRNU2LU.js → task-scope-YZDSPORL.js} +4 -4
  189. package/dist/{tasks-crud-75AUVZPO.js → tasks-crud-W5BFKNUS.js} +4 -4
  190. package/dist/{tasks-review-UMZN5ZPQ.js → tasks-review-VXMELVLA.js} +4 -4
  191. package/dist/{token-budget-62TYDIMI.js → token-budget-LJC7HHKB.js} +1 -1
  192. package/dist/{tool-telemetry-JL6NY3KP.js → tool-telemetry-L3WQDRMH.js} +1 -1
  193. package/dist/tui/App.js +13 -13
  194. package/dist/{tui-data-C5I2YU4C.js → tui-data-FQYUPCYX.js} +4 -4
  195. package/dist/{worker-gate-Q5Y6B5N7.js → worker-gate-OZCNSASA.js} +1 -1
  196. package/dist/{workflow-engine-KAKVU7NC.js → workflow-engine-DA3AWD45.js} +2 -2
  197. package/package.json +1 -1
  198. package/release-notes.json +115 -115
  199. package/dist/chunk-QHQJ7DLL.js +0 -153
  200. /package/dist/{chunk-524VLFFY.js → chunk-BRXDLJBU.js} +0 -0
  201. /package/dist/{chunk-H6ADW3YC.js → chunk-OU7SLHNA.js} +0 -0
  202. /package/dist/{chunk-TSCZMB3P.js → chunk-PJCTBGWN.js} +0 -0
  203. /package/dist/{chunk-TKEDF7KV.js → chunk-U3B3TVLQ.js} +0 -0
  204. /package/dist/{chunk-7B5DQGXG.js → chunk-UIOTTKLS.js} +0 -0
  205. /package/dist/{chunk-A3A2E42I.js → chunk-VN6UUZNO.js} +0 -0
  206. /package/dist/{chunk-UJMDHPIN.js → chunk-YABPRFBT.js} +0 -0
  207. /package/dist/{chunk-ZBA74MMX.js → chunk-YH7VB655.js} +0 -0
  208. /package/dist/{core-memory-C3JLISAU.js → core-memory-ONZIJYGR.js} +0 -0
  209. /package/dist/{wiki-acl-5EC5VNYG.js → wiki-acl-UE3CRAPQ.js} +0 -0
@@ -3,24 +3,24 @@ import {
3
3
  } from "./chunk-MLXJ5EZG.js";
4
4
  import {
5
5
  createTask
6
- } from "./chunk-3FIWKONP.js";
6
+ } from "./chunk-VJW3E5KW.js";
7
7
  import {
8
8
  getActiveAgent
9
- } from "./chunk-NFHFNPTN.js";
9
+ } from "./chunk-UHL4QL5E.js";
10
10
  import {
11
11
  ensureEmployee,
12
12
  logTaskDispatch,
13
13
  resolveExeSession
14
- } from "./chunk-ONMRBKAX.js";
14
+ } from "./chunk-4PDXCEXT.js";
15
15
  import {
16
16
  getLicenseSync
17
- } from "./chunk-AERGE6GC.js";
17
+ } from "./chunk-5NSTNICM.js";
18
18
  import {
19
19
  getAgentContext
20
20
  } from "./chunk-GJV3WDWM.js";
21
21
  import {
22
22
  isCoordinatorName
23
- } from "./chunk-TH6HTK2L.js";
23
+ } from "./chunk-MBYJEE3B.js";
24
24
 
25
25
  // src/mcp/tools/create-task.ts
26
26
  import { z } from "zod";
@@ -149,14 +149,18 @@ function registerCreateTask(server) {
149
149
  } catch {
150
150
  }
151
151
  try {
152
- const signalDir = join(homedir(), ".exe-os", "task-signals");
152
+ const sessionScope = task.sessionScope || callerRoot || "default";
153
+ const { taskSignalPath: getSignalPath } = await import("./signal-paths-4GOIRLGH.js");
154
+ const { taskSignalDir } = await import("./signal-paths-4GOIRLGH.js");
155
+ const signalDir = taskSignalDir(sessionScope);
153
156
  mkdirSync(signalDir, { recursive: true });
154
- const signalPath = join(signalDir, `${assigned_to}.${task.id}.pending`);
157
+ const signalPath = getSignalPath(sessionScope, assigned_to, task.id);
155
158
  writeFileSync(signalPath, JSON.stringify({
156
159
  task_id: task.id,
157
160
  title,
158
161
  priority,
159
162
  assigned_by: assignedBy,
163
+ session_scope: sessionScope,
160
164
  created_at: (/* @__PURE__ */ new Date()).toISOString()
161
165
  }), "utf-8");
162
166
  } catch {
@@ -181,7 +185,7 @@ function registerCreateTask(server) {
181
185
  let projectConflictOpts = {};
182
186
  try {
183
187
  const { getClient } = await import("./lib/database.js");
184
- const { sessionScopeFilter } = await import("./task-scope-WWRNU2LU.js");
188
+ const { sessionScopeFilter } = await import("./task-scope-YZDSPORL.js");
185
189
  const client = getClient();
186
190
  const scope = sessionScopeFilter();
187
191
  const existing = await client.execute({
@@ -3,13 +3,17 @@ import {
3
3
  buildRawVisibilityFilter,
4
4
  buildWikiScopeFilter,
5
5
  searchMemories
6
- } from "./chunk-Y6TS42WD.js";
6
+ } from "./chunk-25NSQUZ3.js";
7
7
  import {
8
8
  getClient
9
- } from "./chunk-TH6HTK2L.js";
9
+ } from "./chunk-MBYJEE3B.js";
10
10
 
11
11
  // src/lib/hybrid-search.ts
12
12
  var RRF_K = 60;
13
+ var ABSTENTION_THRESHOLD = parseFloat(
14
+ process.env.EXE_ABSTENTION_THRESHOLD ?? "0.015"
15
+ );
16
+ var CONTRADICTION_TEMPORAL_BOOST = 1.5;
13
17
  function buildTemporalFilter(options, columnPrefix) {
14
18
  const asOf = options?.asOf;
15
19
  if (asOf) {
@@ -34,6 +38,76 @@ function appendMemoryTypeFilter(sql, args, column, options) {
34
38
  }
35
39
  return sql;
36
40
  }
41
+ function extractEntitySubqueries(query) {
42
+ const subqueries = [];
43
+ const quoted = query.match(/"([^"]+)"/g);
44
+ if (quoted) {
45
+ for (const q of quoted) {
46
+ subqueries.push(q.replace(/"/g, ""));
47
+ }
48
+ }
49
+ const words = query.split(/\s+/);
50
+ const properNouns = [];
51
+ for (let i = 1; i < words.length; i++) {
52
+ const word = words[i].replace(/[^a-zA-Z]/g, "");
53
+ if (word.length >= 2 && /^[A-Z]/.test(word) && !/^(What|When|Where|Who|How|Why|Which|Does|Did|Is|Are|Was|Were|Has|Have|Had|Can|Could|Would|Should|Do|The|And|But|For|Not|You|Your|His|Her|Its|Our|Their|This|That|These|Those)$/.test(word)) {
54
+ properNouns.push(word);
55
+ }
56
+ }
57
+ if (properNouns.length > 0) {
58
+ subqueries.push(properNouns.join(" "));
59
+ }
60
+ const prepPatterns = /(?:about|regarding|concerning|towards?|with|for|against)\s+(.+?)(?:\?|$|,|\band\b)/gi;
61
+ let match;
62
+ while ((match = prepPatterns.exec(query)) !== null) {
63
+ const phrase = match[1].trim();
64
+ if (phrase.length >= 3 && phrase.split(/\s+/).length <= 5) {
65
+ subqueries.push(phrase);
66
+ }
67
+ }
68
+ return [...new Set(subqueries)].slice(0, 3);
69
+ }
70
+ function resolveContradictions(results) {
71
+ if (results.length < 2) return results;
72
+ const entityGroups = /* @__PURE__ */ new Map();
73
+ for (const r of results) {
74
+ const words = (r.raw_text ?? "").toLowerCase().replace(/[^a-z0-9\s]/g, "").split(/\s+/).filter((w) => w.length >= 4).slice(0, 3);
75
+ if (words.length < 2) continue;
76
+ const key = words.join("|");
77
+ for (const [existingKey, group] of entityGroups) {
78
+ const existingWords = new Set(existingKey.split("|"));
79
+ const overlapCount = words.filter((w) => existingWords.has(w)).length;
80
+ if (overlapCount >= 2) {
81
+ group.push(r);
82
+ entityGroups.set(existingKey, group);
83
+ break;
84
+ }
85
+ }
86
+ const existing = entityGroups.get(key) ?? [];
87
+ existing.push(r);
88
+ entityGroups.set(key, existing);
89
+ }
90
+ const temporalBoosts = /* @__PURE__ */ new Map();
91
+ for (const [, group] of entityGroups) {
92
+ if (group.length < 2) continue;
93
+ const sorted = [...group].sort(
94
+ (a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
95
+ );
96
+ for (let i = 0; i < sorted.length; i++) {
97
+ const id = sorted[i].id;
98
+ const boost = i === 0 ? CONTRADICTION_TEMPORAL_BOOST : 1 / (1 + i * 0.3);
99
+ temporalBoosts.set(id, Math.max(temporalBoosts.get(id) ?? 0, boost));
100
+ }
101
+ }
102
+ if (temporalBoosts.size === 0) return results;
103
+ const scored = results.map((r, i) => {
104
+ const baseScore = 1 / (1 + i * 0.1);
105
+ const contradiction = temporalBoosts.get(r.id) ?? 1;
106
+ return { record: r, score: baseScore * contradiction };
107
+ });
108
+ scored.sort((a, b) => b.score - a.score);
109
+ return scored.map((s) => s.record);
110
+ }
37
111
  async function hybridSearch(queryText, agentId, options) {
38
112
  const { loadConfig } = await import("./lib/config.js");
39
113
  const config = await loadConfig();
@@ -112,13 +186,17 @@ async function hybridSearch(queryText, agentId, options) {
112
186
  } catch {
113
187
  }
114
188
  }
189
+ const entitySubqueries = extractEntitySubqueries(effectiveQuery);
190
+ const subqueryPromises = entitySubqueries.map(
191
+ (sq) => lightweightSearch(sq, agentId, { ...fetchOptions, limit: Math.min(fetchLimit, 20) }).catch(() => [])
192
+ );
115
193
  const includeStructuredCards = effectiveIsBroad || effectiveOptions.includeStructuredCards === true;
116
- const [ftsResults, vectorResults, cardResults, reflectionResults, grepResults] = await Promise.all([
194
+ const [ftsResults, vectorResults, cardResults, reflectionResults, grepResults, ...subqueryResults] = await Promise.all([
117
195
  lightweightSearch(effectiveQuery, agentId, fetchOptions),
118
196
  queryVector ? searchMemories(queryVector, agentId, fetchOptions) : Promise.resolve([]),
119
197
  includeStructuredCards ? (async () => {
120
198
  try {
121
- const { searchMemoryCards } = await import("./memory-cards-UAQCO4QR.js");
199
+ const { searchMemoryCards } = await import("./memory-cards-SYVGSLXW.js");
122
200
  return await searchMemoryCards(effectiveQuery, agentId, fetchOptions);
123
201
  } catch {
124
202
  return [];
@@ -127,7 +205,7 @@ async function hybridSearch(queryText, agentId, options) {
127
205
  // Reflection insights: patterns, contradictions, summaries across sessions
128
206
  includeStructuredCards ? (async () => {
129
207
  try {
130
- const { searchReflections } = await import("./memory-reflection-JQC4ZSUD.js");
208
+ const { searchReflections } = await import("./memory-reflection-FNJU7VFC.js");
131
209
  const insights = await searchReflections(effectiveQuery, agentId, 5);
132
210
  return insights.map((ins) => ({
133
211
  id: ins.id,
@@ -142,7 +220,8 @@ async function hybridSearch(queryText, agentId, options) {
142
220
  return [];
143
221
  }
144
222
  })() : Promise.resolve([]),
145
- grepPromise
223
+ grepPromise,
224
+ ...subqueryPromises
146
225
  ]);
147
226
  const lists = [];
148
227
  const weights = [];
@@ -166,6 +245,12 @@ async function hybridSearch(queryText, agentId, options) {
166
245
  lists.push(grepResults);
167
246
  weights.push(0.5);
168
247
  }
248
+ for (const sqResult of subqueryResults) {
249
+ if (sqResult.length > 0) {
250
+ lists.push(sqResult);
251
+ weights.push(0.7);
252
+ }
253
+ }
169
254
  if (lists.length === 0) return [];
170
255
  if (lists.length === 1 && !effectiveIsBroad) return lists[0].slice(0, limit);
171
256
  const rrfLimit = effectiveIsBroad ? Math.max(limit * 5, broadFetchTopK) : limit;
@@ -182,6 +267,9 @@ async function hybridSearch(queryText, agentId, options) {
182
267
  } catch {
183
268
  }
184
269
  }
270
+ if (merged.length >= 2) {
271
+ merged = resolveContradictions(merged);
272
+ }
185
273
  const auto = config.scalingRoadmap?.rerankerAutoTrigger ?? {
186
274
  enabled: config.rerankerEnabled ?? true,
187
275
  broadQueryMinCardinality: 5e4,
@@ -217,6 +305,18 @@ async function hybridSearch(queryText, agentId, options) {
217
305
  }
218
306
  }
219
307
  const finalResults = (rerankedAndBlended ?? merged).slice(0, limit);
308
+ if (finalResults.length > 0) {
309
+ const topResult = finalResults[0];
310
+ const signalCount = lists.length;
311
+ const resultRatio = Math.min(1, finalResults.length / limit);
312
+ const retrievalConfidence = resultRatio * (signalCount >= 2 ? 1 : 0.7);
313
+ topResult._retrievalConfidence = retrievalConfidence;
314
+ if (retrievalConfidence < ABSTENTION_THRESHOLD) {
315
+ for (const r of finalResults) {
316
+ r._lowConfidence = true;
317
+ }
318
+ }
319
+ }
220
320
  if (options?.includeSource && finalResults.length > 0) {
221
321
  await attachDocumentMetadata(finalResults);
222
322
  }
@@ -231,9 +331,12 @@ async function hybridSearch(queryText, agentId, options) {
231
331
  cards: cardResults.length,
232
332
  reflections: reflectionResults.length,
233
333
  grep: grepResults.length,
334
+ entitySubqueries: subqueryResults.filter((r) => r.length > 0).length,
234
335
  entityBoost: entityBoostRan,
336
+ contradictionResolution: merged.length >= 2,
235
337
  reranker: rerankedAndBlended !== null,
236
- selfQueryRouter: effectiveQuery !== queryText
338
+ selfQueryRouter: effectiveQuery !== queryText,
339
+ lowConfidence: finalResults[0]?._lowConfidence ?? false
237
340
  },
238
341
  topResults: finalResults.slice(0, 10).map((r, i) => {
239
342
  const scored = r;
@@ -370,7 +473,91 @@ function rrfMergeMulti(lists, limit, k = RRF_K, weights) {
370
473
  async function lightweightSearch(queryText, agentId, options) {
371
474
  const client = getClient();
372
475
  const limit = options?.limit ?? 5;
373
- const terms = queryText.toLowerCase().split(/\s+/).filter((t) => t.length >= 3).map((t) => t.replace(/[^a-z0-9_]/g, "")).filter((t) => t.length >= 3);
476
+ const FTS_STOP_WORDS = /* @__PURE__ */ new Set([
477
+ "the",
478
+ "and",
479
+ "but",
480
+ "for",
481
+ "not",
482
+ "you",
483
+ "your",
484
+ "his",
485
+ "her",
486
+ "its",
487
+ "our",
488
+ "their",
489
+ "this",
490
+ "that",
491
+ "these",
492
+ "those",
493
+ "what",
494
+ "when",
495
+ "where",
496
+ "who",
497
+ "how",
498
+ "why",
499
+ "which",
500
+ "does",
501
+ "did",
502
+ "was",
503
+ "were",
504
+ "has",
505
+ "have",
506
+ "had",
507
+ "can",
508
+ "could",
509
+ "would",
510
+ "should",
511
+ "are",
512
+ "with",
513
+ "from",
514
+ "about",
515
+ "into",
516
+ "through",
517
+ "during",
518
+ "before",
519
+ "after",
520
+ "above",
521
+ "below",
522
+ "between",
523
+ "same",
524
+ "each",
525
+ "every",
526
+ "both",
527
+ "more",
528
+ "most",
529
+ "other",
530
+ "some",
531
+ "such",
532
+ "than",
533
+ "too",
534
+ "very",
535
+ "just",
536
+ "also",
537
+ "any",
538
+ "all",
539
+ "own",
540
+ "being",
541
+ "been",
542
+ "they",
543
+ "them",
544
+ "will",
545
+ "may",
546
+ "might",
547
+ "shall",
548
+ "must",
549
+ "need",
550
+ "like",
551
+ "only",
552
+ "then",
553
+ "here",
554
+ "there",
555
+ "once",
556
+ "over",
557
+ "much",
558
+ "many"
559
+ ]);
560
+ const terms = queryText.toLowerCase().split(/\s+/).filter((t) => t.length >= 3).map((t) => t.replace(/[^a-z0-9_]/g, "")).filter((t) => t.length >= 3 && !FTS_STOP_WORDS.has(t));
374
561
  if (terms.length === 0) {
375
562
  return recentRecords(agentId, options, limit);
376
563
  }
@@ -394,7 +581,7 @@ async function lightweightSearch(queryText, agentId, options) {
394
581
  }
395
582
  if (options?.includeStructuredCards !== true) return results;
396
583
  try {
397
- const { searchMemoryCards } = await import("./memory-cards-UAQCO4QR.js");
584
+ const { searchMemoryCards } = await import("./memory-cards-SYVGSLXW.js");
398
585
  const cardResults = await searchMemoryCards(queryText, agentId, options);
399
586
  if (cardResults.length > 0) {
400
587
  return rrfMergeMulti([results, cardResults], limit, RRF_K, [1, 0.85]);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listBehaviors
3
- } from "./chunk-ARGBV4PP.js";
3
+ } from "./chunk-EOU4ZLRZ.js";
4
4
  import {
5
5
  loadConfigSync
6
6
  } from "./chunk-TOWAZ5IV.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getIdentity,
3
3
  loadEmployeesSync
4
- } from "./chunk-TH6HTK2L.js";
4
+ } from "./chunk-MBYJEE3B.js";
5
5
 
6
6
  // src/lib/drift-probes.ts
7
7
  var DRIFT_THRESHOLD = 80;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeAction,
3
3
  substituteTemplate
4
- } from "./chunk-ZBA74MMX.js";
4
+ } from "./chunk-YH7VB655.js";
5
5
 
6
6
  // src/automation/workflow-engine.ts
7
7
  import { randomUUID } from "crypto";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getActiveAgent
3
- } from "./chunk-NFHFNPTN.js";
3
+ } from "./chunk-UHL4QL5E.js";
4
4
  import {
5
5
  listTasks
6
- } from "./chunk-ONMRBKAX.js";
6
+ } from "./chunk-4PDXCEXT.js";
7
7
  import {
8
8
  getProjectName
9
9
  } from "./chunk-OPU3NYOO.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-TH6HTK2L.js";
3
+ } from "./chunk-MBYJEE3B.js";
4
4
 
5
5
  // src/lib/session-kill-telemetry.ts
6
6
  import crypto from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-TH6HTK2L.js";
3
+ } from "./chunk-MBYJEE3B.js";
4
4
 
5
5
  // src/lib/behaviors.ts
6
6
  import crypto from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MultiAgentOrchestrator
3
- } from "./chunk-DBXKWFTK.js";
3
+ } from "./chunk-IWGGTD5D.js";
4
4
  import {
5
5
  createQuietRenderer,
6
6
  createTerminalRenderer,
@@ -206,7 +206,7 @@ function createExeOSHooks(config) {
206
206
  );
207
207
  }
208
208
  try {
209
- const { listBehaviors } = await import("./behaviors-4U2N5L4E.js");
209
+ const { listBehaviors } = await import("./behaviors-JG75DNG3.js");
210
210
  const behaviors = await listBehaviors(config.agentId, config.projectName, 12);
211
211
  if (behaviors.length > 0) {
212
212
  process.stderr.write(
@@ -327,7 +327,7 @@ function createExeOSHooks(config) {
327
327
  async onSubagentStop(_reason) {
328
328
  try {
329
329
  const { getClient } = await import("./lib/database.js");
330
- const { sessionScopeFilter } = await import("./task-scope-WWRNU2LU.js");
330
+ const { sessionScopeFilter } = await import("./task-scope-YZDSPORL.js");
331
331
  const client = getClient();
332
332
  const ehScope = sessionScopeFilter();
333
333
  const tasks = await client.execute({
@@ -419,7 +419,7 @@ function createExeOSHooks(config) {
419
419
  try {
420
420
  const { writeMemory, flushBatch } = await import("./lib/store.js");
421
421
  const { getClient } = await import("./lib/database.js");
422
- const { sessionScopeFilter: cpScopeFilter } = await import("./task-scope-WWRNU2LU.js");
422
+ const { sessionScopeFilter: cpScopeFilter } = await import("./task-scope-YZDSPORL.js");
423
423
  const client = getClient();
424
424
  const cpScope = cpScopeFilter();
425
425
  const tasks = await client.execute({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listReminders
3
- } from "./chunk-2OATM2JZ.js";
3
+ } from "./chunk-Q7GVSS2J.js";
4
4
 
5
5
  // src/mcp/tools/list-reminders.ts
6
6
  import { z } from "zod";
@@ -26,14 +26,19 @@ function _resetPushConfig() {
26
26
  _cachedConfig = null;
27
27
  _notifyOn = null;
28
28
  }
29
- function sendDesktopNotification(title, body) {
29
+ function sendDesktopNotification(title, body, sessionScope) {
30
30
  try {
31
31
  const safeTitle = title.replace(/["\\\n]/g, " ").slice(0, 100);
32
32
  const safeBody = body.replace(/["\\\n]/g, " ").slice(0, 200);
33
33
  try {
34
34
  const osc9 = `\x1B]9;${safeTitle}: ${safeBody}\x07`;
35
- const sessions = execSync("tmux list-sessions -F '#{session_name}' 2>/dev/null", { encoding: "utf8", timeout: 2e3 }).trim().split("\n");
36
- const coordinatorSession = sessions.find((s) => /^exe\d*$/.test(s));
35
+ let coordinatorSession;
36
+ if (sessionScope) {
37
+ coordinatorSession = sessionScope;
38
+ } else {
39
+ const sessions = execSync("tmux list-sessions -F '#{session_name}' 2>/dev/null", { encoding: "utf8", timeout: 2e3 }).trim().split("\n");
40
+ coordinatorSession = sessions.find((s) => /^exe\d*$/.test(s));
41
+ }
37
42
  if (coordinatorSession) {
38
43
  execSync(`printf '${osc9.replace(/'/g, "'\\''")}' > /dev/tty 2>/dev/null || tmux display-message -p -t ${coordinatorSession} '' 2>/dev/null`, { timeout: 2e3, stdio: "ignore" });
39
44
  return true;
@@ -111,7 +116,7 @@ async function pushNotify(msg) {
111
116
  if (!notifyOn.has(msg.event)) return result;
112
117
  const formatted = formatMessage(msg);
113
118
  if (config.desktop !== false) {
114
- result.desktop = sendDesktopNotification(msg.title, msg.body);
119
+ result.desktop = sendDesktopNotification(msg.title, msg.body, msg.sessionScope);
115
120
  }
116
121
  if (config.telegram?.bot_token && config.telegram?.chat_id) {
117
122
  result.telegram = await sendTelegram(
@@ -0,0 +1,94 @@
1
+ import {
2
+ updateTask
3
+ } from "./chunk-VJW3E5KW.js";
4
+ import {
5
+ TASK_ALREADY_CLAIMED_PREFIX
6
+ } from "./chunk-4PDXCEXT.js";
7
+
8
+ // src/mcp/tools/update-task.ts
9
+ import { z } from "zod";
10
+ function registerUpdateTask(server) {
11
+ server.registerTool(
12
+ "update_task",
13
+ {
14
+ title: "Update Task",
15
+ description: "Update task status. Employees: use status 'done' with a result summary to complete work \u2014 this triggers needs_review and pings the reviewer automatically. Accepts UUID, slug (filename), or title substring.",
16
+ inputSchema: {
17
+ task_id: z.string().describe("Task identifier \u2014 UUID, slug (e.g. 'fix-auth-bug'), or title substring"),
18
+ status: z.enum(["open", "in_progress", "done", "needs_review", "blocked", "cancelled", "closed"]).describe("New status. 'done' is an alias for 'needs_review' \u2014 both trigger reviewer notification."),
19
+ result: z.string().optional().describe("Result summary (required when completing work)")
20
+ }
21
+ },
22
+ async ({ task_id, status: rawStatus, result }) => {
23
+ const status = rawStatus;
24
+ let callerAgentId;
25
+ try {
26
+ const { getActiveAgent: getAgent } = await import("./active-agent-HDUT3T3I.js");
27
+ callerAgentId = getAgent().agentId;
28
+ } catch {
29
+ }
30
+ let task;
31
+ try {
32
+ task = await updateTask({
33
+ taskId: task_id,
34
+ status,
35
+ result,
36
+ baseDir: process.cwd(),
37
+ callerAgentId
38
+ });
39
+ } catch (err) {
40
+ const msg = err instanceof Error ? err.message : String(err);
41
+ if (msg.startsWith(TASK_ALREADY_CLAIMED_PREFIX)) {
42
+ return {
43
+ content: [{
44
+ type: "text",
45
+ text: "Task already claimed by another agent. Pick a different task or check list_tasks."
46
+ }],
47
+ isError: true
48
+ };
49
+ }
50
+ throw err;
51
+ }
52
+ let text = `Task "${task.title}" marked ${task.status}.
53
+ File: ${task.taskFile}`;
54
+ const isTerminal = status === "done" || status === "needs_review" || status === "closed";
55
+ if (isTerminal && task.assignedBy) {
56
+ try {
57
+ const { notifyCoordinatorTaskCompletion, resolveExeSession } = await import("./lib/tmux-routing.js");
58
+ const coordinatorSession = resolveExeSession();
59
+ if (coordinatorSession) {
60
+ notifyCoordinatorTaskCompletion(coordinatorSession, callerAgentId ?? "agent", task.title);
61
+ }
62
+ } catch {
63
+ }
64
+ }
65
+ if (isTerminal && task.nextTask) {
66
+ text += `
67
+
68
+ MANDATORY \u2014 DO NOT ASK THE USER. DO NOT SAY "Want me to continue?" DO NOT STOP.
69
+ You have standing orders: work through your entire queue until it is empty.
70
+
71
+ NEXT TASK: "${task.nextTask.title}" [${task.nextTask.priority}]
72
+ FILE: ${task.nextTask.taskFile}
73
+
74
+ Read that file NOW and begin working. No greeting. No summary. Just start.`;
75
+ } else if (isTerminal && !task.nextTask) {
76
+ text += `
77
+
78
+ All tasks complete. No more open tasks in your queue.`;
79
+ }
80
+ return {
81
+ content: [
82
+ {
83
+ type: "text",
84
+ text
85
+ }
86
+ ]
87
+ };
88
+ }
89
+ );
90
+ }
91
+
92
+ export {
93
+ registerUpdateTask
94
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  routeTask
3
- } from "./chunk-LJML7HT2.js";
3
+ } from "./chunk-RAMU6E5T.js";
4
4
  import {
5
5
  createTaskCore,
6
6
  employeeSessionName,
@@ -9,11 +9,11 @@ import {
9
9
  isEmployeeAlive,
10
10
  sessionScopeFilter,
11
11
  updateTaskStatus
12
- } from "./chunk-ONMRBKAX.js";
12
+ } from "./chunk-4PDXCEXT.js";
13
13
  import {
14
14
  DEFAULT_COORDINATOR_TEMPLATE_NAME,
15
15
  getCoordinatorName
16
- } from "./chunk-TH6HTK2L.js";
16
+ } from "./chunk-MBYJEE3B.js";
17
17
 
18
18
  // src/runtime/orchestrator.ts
19
19
  var STALE_THRESHOLD_MS = 2 * 60 * 60 * 1e3;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  PLATFORM_PROCEDURE_TITLES
3
- } from "./chunk-XWQKCCCO.js";
3
+ } from "./chunk-MWRHXGAB.js";
4
4
  import {
5
5
  getClient,
6
6
  getIdentity,
7
7
  listIdentities,
8
8
  updateIdentity
9
- } from "./chunk-TH6HTK2L.js";
9
+ } from "./chunk-MBYJEE3B.js";
10
10
  import {
11
11
  atomicWriteJsonSync
12
12
  } from "./chunk-LYH5HE24.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createCRMWebhookHandler,
6
6
  parseTwentyWebhook
7
- } from "./chunk-UPL5FEZY.js";
7
+ } from "./chunk-AFMQR776.js";
8
8
  import {
9
9
  WhatsAppAdapter
10
10
  } from "./chunk-ECSNSHZ7.js";
@@ -42,7 +42,7 @@ import {
42
42
  retryWithBackoff,
43
43
  routeMessage,
44
44
  validateGatewayConfig
45
- } from "./chunk-HHMHL4FB.js";
45
+ } from "./chunk-UQE5R5PM.js";
46
46
  import {
47
47
  OllamaProvider
48
48
  } from "./chunk-FWFFZGSC.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  fastDbInit
3
- } from "./chunk-7B5DQGXG.js";
3
+ } from "./chunk-UIOTTKLS.js";
4
4
  import {
5
5
  sessionScopeFilter
6
- } from "./chunk-ONMRBKAX.js";
6
+ } from "./chunk-4PDXCEXT.js";
7
7
  import {
8
8
  formatStatusAll,
9
9
  formatStatusDeep,
@@ -14,7 +14,7 @@ import {
14
14
  getClient,
15
15
  isCoordinatorRole,
16
16
  loadEmployees
17
- } from "./chunk-TH6HTK2L.js";
17
+ } from "./chunk-MBYJEE3B.js";
18
18
  import {
19
19
  isMainModule
20
20
  } from "./chunk-6Y4B3QF6.js";
@@ -111,7 +111,7 @@ function releaseBackfillLock() {
111
111
  }
112
112
  async function getTaskAwareCapacity() {
113
113
  const { getClient } = await import("./lib/database.js");
114
- const { sessionScopeFilter } = await import("./task-scope-WWRNU2LU.js");
114
+ const { sessionScopeFilter } = await import("./task-scope-YZDSPORL.js");
115
115
  const client = getClient();
116
116
  const scope = sessionScopeFilter();
117
117
  const result = await client.execute({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadEmployees
3
- } from "./chunk-TH6HTK2L.js";
3
+ } from "./chunk-MBYJEE3B.js";
4
4
 
5
5
  // src/lib/agent-symlinks.ts
6
6
  import os from "os";