@askexenow/exe-os 0.9.331 → 0.9.335

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 (173) hide show
  1. package/dist/{backfill-metadata-AVWHS332.js → backfill-metadata-7JFKICS3.js} +1 -1
  2. package/dist/{behaviors-ZV6HNI2M.js → behaviors-QTG3MHDO.js} +2 -2
  3. package/dist/bin/agentic-ontology-backfill.js +1 -1
  4. package/dist/bin/agentic-reflection-backfill.js +1 -1
  5. package/dist/bin/agentic-semantic-label.js +1 -1
  6. package/dist/bin/backfill-conversations.js +1 -1
  7. package/dist/bin/backfill-responses.js +1 -1
  8. package/dist/bin/backfill-vectors.js +2 -2
  9. package/dist/bin/bulk-sync-postgres.js +3 -3
  10. package/dist/bin/cleanup-stale-review-tasks.js +4 -4
  11. package/dist/bin/cli.js +6 -6
  12. package/dist/bin/deferred-daemon-restart.js +34 -34
  13. package/dist/bin/exe-assign.js +1 -1
  14. package/dist/bin/exe-boot.js +8 -8
  15. package/dist/bin/exe-cloud.js +3 -3
  16. package/dist/bin/exe-dispatch.js +4 -4
  17. package/dist/bin/exe-doctor.js +1 -1
  18. package/dist/bin/exe-export-behaviors.js +4 -4
  19. package/dist/bin/exe-forget.js +3 -3
  20. package/dist/bin/exe-gateway.js +5 -5
  21. package/dist/bin/exe-heartbeat.js +4 -4
  22. package/dist/bin/exe-kill.js +6 -6
  23. package/dist/bin/exe-launch-agent.js +7 -7
  24. package/dist/bin/exe-pending-messages.js +5 -5
  25. package/dist/bin/exe-pending-notifications.js +4 -4
  26. package/dist/bin/exe-pending-reviews.js +4 -4
  27. package/dist/bin/exe-review.js +5 -5
  28. package/dist/bin/exe-search.js +2 -2
  29. package/dist/bin/exe-session-cleanup.js +7 -7
  30. package/dist/bin/exe-settings.js +3 -3
  31. package/dist/bin/exe-start-codex.js +4 -4
  32. package/dist/bin/exe-start-opencode.js +3 -3
  33. package/dist/bin/exe-status.js +5 -5
  34. package/dist/bin/exe-team.js +1 -1
  35. package/dist/bin/git-sweep.js +5 -5
  36. package/dist/bin/graph-backfill.js +1 -1
  37. package/dist/bin/graph-export.js +2 -2
  38. package/dist/bin/import-history.js +2 -2
  39. package/dist/bin/install.js +34 -34
  40. package/dist/bin/intercom-check.js +4 -4
  41. package/dist/bin/mcp-sessions.js +2 -2
  42. package/dist/bin/orchestration-metrics.js +1 -1
  43. package/dist/bin/scan-tasks.js +4 -4
  44. package/dist/bin/setup.js +1 -1
  45. package/dist/bin/shard-migrate.js +1 -1
  46. package/dist/{capacity-monitor-VNAUNTTH.js → capacity-monitor-4U2Y7CSW.js} +5 -5
  47. package/dist/{catchup-brief-5ELWS6IF.js → catchup-brief-LFSFSDBA.js} +5 -5
  48. package/dist/{chunk-CPXFQBBN.js → chunk-2OZMCTYQ.js} +1 -1
  49. package/dist/{chunk-OLQYIAOQ.js → chunk-54X2PQBA.js} +3 -3
  50. package/dist/{chunk-O6RMSGXQ.js → chunk-5ZG2JMZH.js} +1 -1
  51. package/dist/{chunk-QXXG2MCZ.js → chunk-6L4LI4VQ.js} +29 -3
  52. package/dist/{chunk-UX5YA6ZY.js → chunk-6UJ4CX5L.js} +2 -2
  53. package/dist/{chunk-BGCJZQGQ.js → chunk-75L2YCD4.js} +1 -1
  54. package/dist/{chunk-MTX3FQRR.js → chunk-AQGBOSA4.js} +1 -1
  55. package/dist/{chunk-MNLSPTWM.js → chunk-D2527Q5Y.js} +1 -1
  56. package/dist/{chunk-YSU4JO3J.js → chunk-ESIZMMWY.js} +1 -1
  57. package/dist/chunk-FLNSJ2TC.js +23 -0
  58. package/dist/{chunk-VV422PGC.js → chunk-GFWND35H.js} +21 -0
  59. package/dist/{chunk-DDA7IAWM.js → chunk-H5C4PS64.js} +2 -2
  60. package/dist/{chunk-LKB2VIIV.js → chunk-I33GPQUB.js} +1 -1
  61. package/dist/{chunk-KKZPF6YI.js → chunk-J6REQ7CV.js} +1 -1
  62. package/dist/{chunk-YL5S6I3R.js → chunk-JEDQHPPC.js} +2 -2
  63. package/dist/{chunk-KCHIJUYX.js → chunk-JKSK4VFX.js} +1 -1
  64. package/dist/{chunk-OV7OFYIR.js → chunk-LK5RBBMQ.js} +1 -1
  65. package/dist/{chunk-GSFGVYCG.js → chunk-QFNRI3PS.js} +2 -2
  66. package/dist/{chunk-CERY66PJ.js → chunk-QLZ3HCNN.js} +1 -1
  67. package/dist/{chunk-W7F3ZBHH.js → chunk-QYTUXYAM.js} +51 -51
  68. package/dist/{chunk-7RDZDCWY.js → chunk-RGHT5J2L.js} +4 -4
  69. package/dist/{chunk-IJYBKQDJ.js → chunk-ROHUOHJI.js} +2 -2
  70. package/dist/{chunk-CASOKILE.js → chunk-SDZ654BU.js} +6 -6
  71. package/dist/{chunk-4NGPNH3F.js → chunk-SRGBHZ3H.js} +1 -1
  72. package/dist/{chunk-5JILQMRS.js → chunk-U6M5C3MB.js} +6 -6
  73. package/dist/{chunk-N5ACQ7C2.js → chunk-U7N2GEBI.js} +1 -1
  74. package/dist/{chunk-QOMCLPQI.js → chunk-UDX46CNG.js} +2 -2
  75. package/dist/{chunk-SNJEQPPA.js → chunk-UWT664G5.js} +1 -1
  76. package/dist/{chunk-D5SZ3U5L.js → chunk-VAEYG5V5.js} +37 -6
  77. package/dist/{chunk-DSL5D3TH.js → chunk-VI7I6K4G.js} +2 -2
  78. package/dist/{chunk-ZWWHEX3Y.js → chunk-VINX2BZI.js} +1 -1
  79. package/dist/{chunk-QAYGX7KA.js → chunk-VST5V263.js} +1 -1
  80. package/dist/{chunk-GTCJU2RF.js → chunk-VXSORLMJ.js} +1 -1
  81. package/dist/{chunk-UJRZD77V.js → chunk-WI3T3GTH.js} +1 -1
  82. package/dist/{chunk-ZSMF37M6.js → chunk-X3VIRILN.js} +70 -87
  83. package/dist/{chunk-EQCYEYCJ.js → chunk-X5EGTW2P.js} +1 -1
  84. package/dist/{chunk-MZ2MBZ3E.js → chunk-XA753DUQ.js} +1 -1
  85. package/dist/{chunk-JCBQQIUV.js → chunk-XMVEGUPC.js} +1 -1
  86. package/dist/{chunk-XDJEPGMF.js → chunk-ZA7NMOTA.js} +1 -1
  87. package/dist/{chunk-RY7UV6CU.js → chunk-ZHKMRKH3.js} +1 -1
  88. package/dist/{chunk-MTHQR76V.js → chunk-ZWIYJV2F.js} +5 -5
  89. package/dist/{cleanup-graph-garbage-FD34BPLR.js → cleanup-graph-garbage-OP7NAXDZ.js} +1 -1
  90. package/dist/{crm-webhook-6YDLPLVH.js → crm-webhook-REDANIV7.js} +2 -2
  91. package/dist/{cto-delegation-gate-JMO6VVTO.js → cto-delegation-gate-HN3J76UI.js} +3 -3
  92. package/dist/{daemon-orchestration-U5HW7YT5.js → daemon-orchestration-KIAYDBWN.js} +7 -7
  93. package/dist/daemon-ready-5XI5BIJD.js +7 -0
  94. package/dist/{documents-TXMACEEP.js → documents-J4MQBIYZ.js} +2 -2
  95. package/dist/{dreaming-KJ4P52EC.js → dreaming-RCAAKENX.js} +4 -4
  96. package/dist/{exe-export-PH23G3F7.js → exe-export-Z626JBSJ.js} +3 -3
  97. package/dist/{exe-import-QCAFH4AM.js → exe-import-47MHFJUB.js} +3 -3
  98. package/dist/{exe-key-MGEOBRCI.js → exe-key-RLMYYUTW.js} +34 -34
  99. package/dist/{exe-snapshot-DDSSZ377.js → exe-snapshot-VHSZP5VK.js} +6 -6
  100. package/dist/{fast-db-init-6KBEZK66.js → fast-db-init-KIS7XQO5.js} +1 -1
  101. package/dist/gateway/index.js +6 -6
  102. package/dist/hooks/bug-report-worker.js +6 -6
  103. package/dist/hooks/codex-stop-task-finalizer.js +6 -6
  104. package/dist/hooks/commit-complete.js +6 -6
  105. package/dist/hooks/error-recall.js +7 -4
  106. package/dist/hooks/ingest.js +2 -2
  107. package/dist/hooks/instructions-loaded.js +1 -1
  108. package/dist/hooks/manifest.json +18 -18
  109. package/dist/hooks/notification.js +1 -1
  110. package/dist/hooks/post-compact.js +4 -4
  111. package/dist/hooks/post-tool-combined.js +2 -2
  112. package/dist/hooks/pre-compact.js +5 -5
  113. package/dist/hooks/pre-tool-use.js +8 -8
  114. package/dist/hooks/prompt-submit.js +36 -39
  115. package/dist/hooks/session-end.js +7 -7
  116. package/dist/hooks/session-start.js +9 -28
  117. package/dist/hooks/stop.js +7 -7
  118. package/dist/hooks/subagent-stop.js +4 -4
  119. package/dist/hooks/summary-worker.js +7 -7
  120. package/dist/index.js +11 -11
  121. package/dist/{intercom-queue-4A7XH72M.js → intercom-queue-XJ3RTJ2C.js} +3 -3
  122. package/dist/lib/cloud-sync.js +3 -3
  123. package/dist/lib/consolidation.js +2 -2
  124. package/dist/lib/exe-daemon.js +31 -31
  125. package/dist/lib/hybrid-search.js +2 -2
  126. package/dist/lib/messaging.js +4 -4
  127. package/dist/lib/schedules.js +2 -2
  128. package/dist/lib/skill-learning.js +3 -3
  129. package/dist/lib/store.js +1 -1
  130. package/dist/lib/tasks.js +5 -5
  131. package/dist/lib/tmux-routing.js +3 -3
  132. package/dist/mcp/register-tools.js +33 -33
  133. package/dist/mcp/server.js +34 -34
  134. package/dist/mcp/tools/create-task.js +6 -6
  135. package/dist/mcp/tools/deactivate-behavior.js +3 -3
  136. package/dist/mcp/tools/list-tasks.js +6 -6
  137. package/dist/mcp/tools/send-message.js +5 -5
  138. package/dist/mcp/tools/update-task.js +6 -6
  139. package/dist/{memory-cards-7Z66A6AF.js → memory-cards-E5O4IPYV.js} +1 -1
  140. package/dist/{memory-pressure-watchdog-Z25XTMNY.js → memory-pressure-watchdog-4RVYB2JC.js} +4 -4
  141. package/dist/{notifications-3MIUQXX6.js → notifications-LDDVXMH7.js} +3 -3
  142. package/dist/{orchestrator-IKRGCGWD.js → orchestrator-UFYOUXGZ.js} +4 -4
  143. package/dist/{pipeline-router-BNKNM454.js → pipeline-router-PLYAEQN7.js} +1 -1
  144. package/dist/{projection-worker-RIOEZPKQ.js → projection-worker-N4KVTVZE.js} +1 -1
  145. package/dist/{reranker-WHMDMYZP.js → reranker-267LQRRT.js} +1 -1
  146. package/dist/{review-polling-FDHBFWSY.js → review-polling-4IFCCPGQ.js} +4 -4
  147. package/dist/runtime/index.js +5 -5
  148. package/dist/{session-events-GM2OUFON.js → session-events-CVNW7DBW.js} +4 -4
  149. package/dist/{session-kill-telemetry-XN6LYPWA.js → session-kill-telemetry-56HNNXLH.js} +4 -4
  150. package/dist/{session-scope-3OGEPOW7.js → session-scope-RMKL6YLU.js} +3 -3
  151. package/dist/{setup-wizard-ISCAH4EV.js → setup-wizard-L6JMCB33.js} +1 -1
  152. package/dist/{skill-refinement-X4HZANPI.js → skill-refinement-FA5DM3NA.js} +1 -1
  153. package/dist/{task-enforcement-7GXGH6DB.js → task-enforcement-XO6CYQVG.js} +4 -4
  154. package/dist/{task-scope-J3OMPV5A.js → task-scope-7BWIG4G3.js} +3 -3
  155. package/dist/{tasks-crud-NGMRLJH5.js → tasks-crud-IW3ZBFHL.js} +3 -3
  156. package/dist/{tasks-notify-4OZXON6S.js → tasks-notify-MOSUAR3U.js} +4 -4
  157. package/dist/{tasks-review-U5QEKLNP.js → tasks-review-S2IYB6AA.js} +3 -3
  158. package/dist/{telemetry-upload-QCM44FAE.js → telemetry-upload-IG4AGZFK.js} +1 -1
  159. package/dist/tui/App.js +20 -20
  160. package/dist/{tui-data-YPS2SMWF.js → tui-data-KCMCI6Z5.js} +3 -3
  161. package/dist/{worker-gate-M6OGQF7H.js → worker-gate-YY7OZOJH.js} +1 -1
  162. package/dist/{workflow-engine-OVVJRMD2.js → workflow-engine-TZW4ZQV3.js} +2 -2
  163. package/dist/{worktree-3RKV6KQO.js → worktree-WF7X43XI.js} +1 -1
  164. package/dist/{worktree-sweep-PYREGLPP.js → worktree-sweep-QOAXY6CT.js} +2 -2
  165. package/package.json +3 -3
  166. package/release-notes.json +7 -3
  167. /package/dist/{chunk-BPH6YPHA.js → chunk-45AA4HOH.js} +0 -0
  168. /package/dist/{chunk-YOOK5NOZ.js → chunk-6A5DGGRT.js} +0 -0
  169. /package/dist/{chunk-ME3WDWL6.js → chunk-FXS5YIK5.js} +0 -0
  170. /package/dist/{chunk-TOEQZTYB.js → chunk-NF2OBCEI.js} +0 -0
  171. /package/dist/{chunk-NPAGBSEN.js → chunk-OMJH4DQ7.js} +0 -0
  172. /package/dist/{chunk-N4G4M6LE.js → chunk-S4Y5YXPX.js} +0 -0
  173. /package/dist/{core-memory-YHACNEAS.js → core-memory-HCJMR32C.js} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  buildStatusFilter,
9
9
  buildWikiScopeFilter,
10
10
  searchMemories
11
- } from "./chunk-KKZPF6YI.js";
11
+ } from "./chunk-J6REQ7CV.js";
12
12
  import {
13
13
  blobToVector
14
14
  } from "./chunk-OTVEIJUQ.js";
@@ -359,7 +359,7 @@ async function hybridSearch(queryText, agentId, options) {
359
359
  let rerankerAvailable = false;
360
360
  if (process.env.EXE_IS_DAEMON === "1") {
361
361
  try {
362
- const { isRerankerAvailable } = await import("./reranker-WHMDMYZP.js");
362
+ const { isRerankerAvailable } = await import("./reranker-267LQRRT.js");
363
363
  rerankerAvailable = isRerankerAvailable();
364
364
  } catch {
365
365
  }
@@ -427,7 +427,7 @@ async function hybridSearch(queryText, agentId, options) {
427
427
  ]).catch(() => []),
428
428
  includeStructuredCards ? (async () => {
429
429
  try {
430
- const { searchMemoryCards } = await import("./memory-cards-7Z66A6AF.js");
430
+ const { searchMemoryCards } = await import("./memory-cards-E5O4IPYV.js");
431
431
  return await searchMemoryCards(effectiveQuery, agentId, fetchOptions);
432
432
  } catch {
433
433
  return [];
@@ -561,7 +561,7 @@ async function hybridSearch(queryText, agentId, options) {
561
561
  try {
562
562
  let rerankedRecords;
563
563
  if (graphContextMap.size > 0) {
564
- const { rerankWithContext } = await import("./reranker-WHMDMYZP.js");
564
+ const { rerankWithContext } = await import("./reranker-267LQRRT.js");
565
565
  const candidates = merged.map((m) => ({
566
566
  text: m.raw_text,
567
567
  context: graphContextMap.get(m.id)
@@ -569,7 +569,7 @@ async function hybridSearch(queryText, agentId, options) {
569
569
  const scored = await rerankWithContext(effectiveQuery, candidates, rerankReturnLimit);
570
570
  rerankedRecords = scored.map((s) => merged[s.index]);
571
571
  } else {
572
- const { rerank } = await import("./reranker-WHMDMYZP.js");
572
+ const { rerank } = await import("./reranker-267LQRRT.js");
573
573
  rerankedRecords = await rerank(effectiveQuery, merged, rerankReturnLimit);
574
574
  }
575
575
  if (rerankedRecords.length > 0) {
@@ -939,7 +939,7 @@ async function lightweightSearch(queryText, agentId, options) {
939
939
  }
940
940
  if (options?.includeStructuredCards !== true) return results;
941
941
  try {
942
- const { searchMemoryCards } = await import("./memory-cards-7Z66A6AF.js");
942
+ const { searchMemoryCards } = await import("./memory-cards-E5O4IPYV.js");
943
943
  const cardResults = await searchMemoryCards(queryText, agentId, options);
944
944
  if (cardResults.length > 0) {
945
945
  return rrfMergeMulti([results, cardResults], limit, RRF_K, [1, 0.85]);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  processCRMEvent
3
- } from "./chunk-N4G4M6LE.js";
3
+ } from "./chunk-S4Y5YXPX.js";
4
4
 
5
5
  // src/gateway/adapters/crm-webhook.ts
6
6
  function parseTwentyWebhook(payload) {
@@ -2,7 +2,7 @@ import {
2
2
  dispatchTaskToEmployee,
3
3
  markTaskNotificationsRead,
4
4
  notifyTaskDone
5
- } from "./chunk-YL5S6I3R.js";
5
+ } from "./chunk-JEDQHPPC.js";
6
6
  import {
7
7
  cleanupReviewFile,
8
8
  createTaskCore,
@@ -11,7 +11,7 @@ import {
11
11
  sessionScopeFilter,
12
12
  updateTaskStatus,
13
13
  writeNotification
14
- } from "./chunk-ZSMF37M6.js";
14
+ } from "./chunk-X3VIRILN.js";
15
15
  import {
16
16
  orgBus
17
17
  } from "./chunk-MP2AFCGL.js";
@@ -61,7 +61,7 @@ async function cascadeUnblock(taskId, baseDir, now) {
61
61
  }
62
62
  if (unblockedRows.rows.length > 0 && !process.env.VITEST) {
63
63
  try {
64
- const { dispatchTaskToEmployee: dispatchTaskToEmployee2 } = await import("./tasks-notify-4OZXON6S.js");
64
+ const { dispatchTaskToEmployee: dispatchTaskToEmployee2 } = await import("./tasks-notify-MOSUAR3U.js");
65
65
  const dispatched = /* @__PURE__ */ new Set();
66
66
  for (const ur of unblockedRows.rows) {
67
67
  const assignee = String(ur.assigned_to);
@@ -86,7 +86,7 @@ async function cascadeUnblock(taskId, baseDir, now) {
86
86
  }
87
87
  } catch {
88
88
  try {
89
- const { queueIntercom } = await import("./intercom-queue-4A7XH72M.js");
89
+ const { queueIntercom } = await import("./intercom-queue-XJ3RTJ2C.js");
90
90
  const dispatched = /* @__PURE__ */ new Set();
91
91
  for (const ur of unblockedRows.rows) {
92
92
  const assignee = String(ur.assigned_to);
@@ -289,7 +289,7 @@ async function updateTask(input) {
289
289
  try {
290
290
  process.stderr.write(`[tasks] EVENT: tmux delivery failed for reviewer="${reviewer}". Queueing for daemon delivery.
291
291
  `);
292
- const { queueIntercom } = await import("./intercom-queue-4A7XH72M.js");
292
+ const { queueIntercom } = await import("./intercom-queue-XJ3RTJ2C.js");
293
293
  const { resolveExeSession } = await import("./lib/tmux-routing.js");
294
294
  const exeSession = row.session_scope ? String(row.session_scope) : resolveExeSession();
295
295
  if (exeSession) {
@@ -333,7 +333,7 @@ async function updateTask(input) {
333
333
  await markTaskNotificationsRead(taskFile);
334
334
  if (isCompletionReviewTransition && !isCoordinator && row.reviewer) {
335
335
  try {
336
- const { writeNotification: writeNotification2 } = await import("./notifications-3MIUQXX6.js");
336
+ const { writeNotification: writeNotification2 } = await import("./notifications-LDDVXMH7.js");
337
337
  const reviewer = String(row.reviewer);
338
338
  await writeNotification2({
339
339
  agentId: reviewer,
@@ -4,7 +4,7 @@ import {
4
4
  resolveExeSession,
5
5
  sendIntercom,
6
6
  strictSessionScopeFilter
7
- } from "./chunk-ZSMF37M6.js";
7
+ } from "./chunk-X3VIRILN.js";
8
8
  import {
9
9
  parseMessage,
10
10
  serializeMessage
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createCRMWebhookHandler,
3
3
  parseTwentyWebhook
4
- } from "./chunk-4NGPNH3F.js";
4
+ } from "./chunk-SRGBHZ3H.js";
5
5
  import {
6
6
  WhatsAppAdapter
7
7
  } from "./chunk-ECSNSHZ7.js";
@@ -42,7 +42,7 @@ import {
42
42
  retryWithBackoff,
43
43
  routeMessage,
44
44
  validateGatewayConfig
45
- } from "./chunk-DSL5D3TH.js";
45
+ } from "./chunk-VI7I6K4G.js";
46
46
  import {
47
47
  OllamaProvider
48
48
  } from "./chunk-FWFFZGSC.js";
@@ -54,7 +54,7 @@ function parseInstanceLabel(label) {
54
54
  return { base: label };
55
55
  }
56
56
  function ensureWorktree(projectDir, employeeName, instance) {
57
- const repoRoot = getGitRoot(projectDir);
57
+ const repoRoot = getMainRepoRoot(projectDir);
58
58
  if (!repoRoot) return null;
59
59
  const wtPath = worktreePath(repoRoot, employeeName, instance);
60
60
  const branch = worktreeBranch(employeeName, instance);
@@ -1,12 +1,35 @@
1
1
  import {
2
2
  updateTask
3
- } from "./chunk-5JILQMRS.js";
3
+ } from "./chunk-U6M5C3MB.js";
4
4
  import {
5
5
  TASK_ALREADY_CLAIMED_PREFIX
6
- } from "./chunk-ZSMF37M6.js";
6
+ } from "./chunk-X3VIRILN.js";
7
+ import {
8
+ getAgentContext
9
+ } from "./chunk-GJV3WDWM.js";
10
+ import {
11
+ isCoordinatorName
12
+ } from "./chunk-BIM763ML.js";
7
13
 
8
14
  // src/mcp/tools/update-task.ts
9
15
  import { z } from "zod";
16
+ import { execFileSync } from "child_process";
17
+ function resolveCallerSessionForUpdate() {
18
+ const contextual = getAgentContext()?.sessionHint || process.env.EXE_SESSION_NAME || process.env.EXE_SESSION || void 0;
19
+ if (contextual) return contextual;
20
+ if (getAgentContext()) return void 0;
21
+ if (process.env.VITEST === "true" || process.env.NODE_ENV === "test") return void 0;
22
+ try {
23
+ const session = execFileSync(
24
+ "tmux",
25
+ ["display-message", "-p", "#{session_name}"],
26
+ { encoding: "utf8", timeout: 1500 }
27
+ ).trim();
28
+ return session || void 0;
29
+ } catch {
30
+ return void 0;
31
+ }
32
+ }
10
33
  function registerUpdateTask(server) {
11
34
  server.registerTool(
12
35
  "update_task",
@@ -42,10 +65,18 @@ function registerUpdateTask(server) {
42
65
  try {
43
66
  const { getActiveAgent: getAgent } = await import("./active-agent-AIK6FSYE.js");
44
67
  callerAgentId = getAgent().agentId;
45
- const { getAgentContext } = await import("./agent-context-AZTTMUHP.js");
46
- callerSession = getAgentContext()?.sessionHint || process.env.EXE_SESSION_NAME || process.env.EXE_SESSION || void 0;
68
+ callerSession = resolveCallerSessionForUpdate();
47
69
  } catch {
48
70
  }
71
+ if (status === "in_progress" && callerAgentId && !isCoordinatorName(callerAgentId) && !callerSession && process.env.VITEST !== "true" && process.env.NODE_ENV !== "test") {
72
+ return {
73
+ content: [{
74
+ type: "text",
75
+ text: "Refusing to claim task without a concrete caller tmux session. Parallel employee instances require exact session binding (X-Exe-Session/EXE_SESSION) so one instance cannot claim another instance's assigned task/worktree. Reconnect MCP or use the task dispatch signal from the correct session."
76
+ }],
77
+ isError: true
78
+ };
79
+ }
49
80
  let task;
50
81
  try {
51
82
  task = await updateTask({
@@ -86,10 +117,10 @@ File: ${task.taskFile}`;
86
117
  if (isTerminal && task.reviewer) {
87
118
  try {
88
119
  const { notifyCoordinatorTaskCompletion } = await import("./lib/tmux-routing.js");
89
- const { isCoordinatorName } = await import("./lib/employees.js");
120
+ const { isCoordinatorName: isCoordinatorName2 } = await import("./lib/employees.js");
90
121
  const reviewer = String(task.reviewer);
91
122
  const coordinatorSession = task.sessionScope;
92
- if (coordinatorSession && isCoordinatorName(reviewer)) {
123
+ if (coordinatorSession && isCoordinatorName2(reviewer)) {
93
124
  notifyCoordinatorTaskCompletion(coordinatorSession, callerAgentId ?? "agent", task.title);
94
125
  }
95
126
  } catch {
@@ -2,10 +2,10 @@ import {
2
2
  listWorkflowDefinitions,
3
3
  runWorkflow,
4
4
  startWorkflow
5
- } from "./chunk-GTCJU2RF.js";
5
+ } from "./chunk-VXSORLMJ.js";
6
6
  import {
7
7
  ingest
8
- } from "./chunk-ME3WDWL6.js";
8
+ } from "./chunk-FXS5YIK5.js";
9
9
  import {
10
10
  initCRMBridge
11
11
  } from "./chunk-ML4S5SHZ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  deactivateBehavior
3
- } from "./chunk-KCHIJUYX.js";
3
+ } from "./chunk-JKSK4VFX.js";
4
4
  import {
5
5
  getActiveAgent
6
6
  } from "./chunk-EOYVD5U3.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-75H4R62K.js";
4
4
  import {
5
5
  initStore
6
- } from "./chunk-KKZPF6YI.js";
6
+ } from "./chunk-J6REQ7CV.js";
7
7
  import {
8
8
  getClient,
9
9
  isInitialized
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeAction,
3
3
  substituteTemplate
4
- } from "./chunk-N4G4M6LE.js";
4
+ } from "./chunk-S4Y5YXPX.js";
5
5
 
6
6
  // src/automation/workflow-engine.ts
7
7
  import { randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  sendMessage
3
- } from "./chunk-N5ACQ7C2.js";
3
+ } from "./chunk-U7N2GEBI.js";
4
4
  import {
5
5
  getActiveAgent
6
6
  } from "./chunk-EOYVD5U3.js";
@@ -5,10 +5,10 @@ import {
5
5
  ensureWorktree,
6
6
  getGitRoot,
7
7
  isWorktreeDirty
8
- } from "./chunk-SNJEQPPA.js";
8
+ } from "./chunk-UWT664G5.js";
9
9
  import {
10
10
  incrementSkillSuccess
11
- } from "./chunk-BPH6YPHA.js";
11
+ } from "./chunk-45AA4HOH.js";
12
12
  import {
13
13
  reviewSignalPath,
14
14
  taskSignalDir
@@ -1219,7 +1219,7 @@ async function createTaskCore(input) {
1219
1219
  if (isCoordinatorSession) {
1220
1220
  earlySessionScope = resolved;
1221
1221
  } else {
1222
- const { getSessionProject } = await import("./session-scope-3OGEPOW7.js");
1222
+ const { getSessionProject } = await import("./session-scope-RMKL6YLU.js");
1223
1223
  const sessionProject = getSessionProject(resolved);
1224
1224
  if (sessionProject && sessionProject !== input.projectName) {
1225
1225
  scopeMismatchWarning = `session/project mismatch: session "${resolved}" owns "${sessionProject}" but task targets "${input.projectName}". Routed to default scope.`;
@@ -1783,6 +1783,66 @@ ${input.result}` : `\u26A0\uFE0F ${warning}`;
1783
1783
  const curStatus = cur?.status ?? "unknown";
1784
1784
  const claimedBySession = cur?.assigned_tmux ?? "";
1785
1785
  const assignedBy = cur?.assigned_by ?? "";
1786
+ if (curStatus === "open" && claimedBySession && !isTmuxSessionAlive(claimedBySession)) {
1787
+ process.stderr.write(
1788
+ `[tasks] Auto-clearing dead open-task pre-bind on ${taskId} (was ${claimedBySession})
1789
+ `
1790
+ );
1791
+ await client.execute({
1792
+ sql: `UPDATE tasks
1793
+ SET assigned_tmux = NULL,
1794
+ instance_id = NULL,
1795
+ updated_at = ?
1796
+ WHERE id = ?
1797
+ AND status = 'open'
1798
+ AND assigned_tmux = ?`,
1799
+ args: [now, taskId, claimedBySession]
1800
+ });
1801
+ const retriedOpen = await client.execute({
1802
+ sql: `UPDATE tasks
1803
+ SET status = 'in_progress', assigned_tmux = ?, updated_at = ?,
1804
+ claimed_by = ?, claimed_at = ?, last_heartbeat_at = ?,
1805
+ lease_expires_at = ?,
1806
+ claim_count = COALESCE(claim_count, 0) + 1,
1807
+ started_at = COALESCE(started_at, ?),
1808
+ estimated_minutes = COALESCE(?, estimated_minutes),
1809
+ estimate_confidence = COALESCE(?, estimate_confidence)
1810
+ WHERE id = ? AND status = 'open'${claimGuardSql}`,
1811
+ args: [tmuxSession, now, claimAgent, now, now, leaseExpiry, now, estMin, estConf, taskId, ...claimGuardArgs]
1812
+ });
1813
+ if (retriedOpen.rowsAffected > 0) {
1814
+ try {
1815
+ await writeCheckpoint({
1816
+ taskId,
1817
+ step: "reclaimed_dead_open_prebind",
1818
+ contextSummary: `Task claimed after dead open-task pre-bind ${claimedBySession} was cleared.`
1819
+ });
1820
+ } catch {
1821
+ }
1822
+ recordOrchestrationEventBestEffort({
1823
+ eventType: "task.claimed",
1824
+ source: "tasks-crud.updateTaskStatus",
1825
+ taskId,
1826
+ agentId: eventAgentId,
1827
+ sessionScope: eventSessionScope,
1828
+ projectName: eventProjectName,
1829
+ tmuxSession,
1830
+ result: "reclaimed_dead_open_prebind",
1831
+ payload: { previousAssignedTmux: claimedBySession }
1832
+ });
1833
+ recordOrchestrationEventBestEffort({
1834
+ eventType: "task.in_progress",
1835
+ source: "tasks-crud.updateTaskStatus",
1836
+ taskId,
1837
+ agentId: eventAgentId,
1838
+ sessionScope: eventSessionScope,
1839
+ projectName: eventProjectName,
1840
+ tmuxSession,
1841
+ result: "reclaimed_dead_open_prebind"
1842
+ });
1843
+ return { row, taskFile, now, taskId, previousStatus, requestedStatus };
1844
+ }
1845
+ }
1786
1846
  if (curStatus === "in_progress" && claimedBySession && !isTmuxSessionAlive(claimedBySession)) {
1787
1847
  process.stderr.write(
1788
1848
  `[tasks] Auto-releasing dead claim on ${taskId} (was ${claimedBySession})
@@ -3857,11 +3917,8 @@ function resolveExeSession() {
3857
3917
  });
3858
3918
  return liveRoots[0];
3859
3919
  } else if (liveRoots.length > 1) {
3860
- const base = candidate.replace(/\d+$/, "");
3861
- const match = liveRoots.find((s) => s.startsWith(base));
3862
- const chosen = match ?? liveRoots[0];
3863
3920
  process.stderr.write(
3864
- `[tmux-routing] WARN: resolved session "${candidate}" is dead. ${liveRoots.length} live roots found, using "${chosen}".
3921
+ `[tmux-routing] ERROR: resolved session "${candidate}" is dead and ${liveRoots.length} live coordinator sessions exist; refusing to guess. Provide X-Exe-Session/EXE_SESSION.
3865
3922
  `
3866
3923
  );
3867
3924
  logSessionResolve({
@@ -3871,11 +3928,11 @@ function resolveExeSession() {
3871
3928
  envHint,
3872
3929
  cacheHit,
3873
3930
  liveRoots,
3874
- resolved: chosen,
3875
- path: `liveness_fallback_multi (base="${base}", match=${match ?? "none"})`,
3931
+ resolved: null,
3932
+ path: "liveness_fallback_multi_refused",
3876
3933
  mismatch: true
3877
3934
  });
3878
- return chosen;
3935
+ return null;
3879
3936
  }
3880
3937
  process.stderr.write(
3881
3938
  `[tmux-routing] WARN: resolved session "${candidate}" is dead and no live coordinator found.
@@ -3934,7 +3991,7 @@ async function verifyPaneAtCapacity(sessionName) {
3934
3991
  reason: `capture-pane failed: ${err instanceof Error ? err.message : String(err)}`
3935
3992
  };
3936
3993
  }
3937
- const { isAtCapacity } = await import("./capacity-monitor-VNAUNTTH.js");
3994
+ const { isAtCapacity } = await import("./capacity-monitor-4U2Y7CSW.js");
3938
3995
  if (!isAtCapacity(pane)) {
3939
3996
  return {
3940
3997
  atCapacity: false,
@@ -4300,7 +4357,7 @@ function scheduleDeferredSpawnNudge(input) {
4300
4357
  return;
4301
4358
  }
4302
4359
  queueIntercom(input.sessionName, `spawn nudge failed after ${attempt} attempts: ${msg}`, "signal");
4303
- void import("./notifications-3MIUQXX6.js").then(({ writeNotification: writeNotification2 }) => writeNotification2({
4360
+ void import("./notifications-LDDVXMH7.js").then(({ writeNotification: writeNotification2 }) => writeNotification2({
4304
4361
  agentId: getCoordinatorName(),
4305
4362
  agentRole: "COO",
4306
4363
  event: "error_spike",
@@ -4502,81 +4559,7 @@ function notifyCoordinatorTaskCompletion(coordinatorSession, agentName, taskTitl
4502
4559
  }
4503
4560
  }
4504
4561
  async function ensureWorktreeAsync(projectDir, employeeName, instance) {
4505
- try {
4506
- const { stdout: rootOut } = await execFileAsync("git", ["-C", projectDir, "rev-parse", "--show-toplevel"], {
4507
- encoding: "utf8",
4508
- timeout: 1e4
4509
- });
4510
- const repoRoot = rootOut.trim();
4511
- if (!repoRoot) return null;
4512
- const label = instance != null && instance > 0 ? `${employeeName}${instance}` : employeeName;
4513
- const wtPath = path8.join(repoRoot, ".worktrees", label);
4514
- const branch = `${label}-work`;
4515
- if (existsSync9(path8.join(wtPath, ".git"))) {
4516
- let currentBranch = null;
4517
- try {
4518
- const { stdout } = await execFileAsync("git", ["branch", "--show-current"], {
4519
- cwd: wtPath,
4520
- encoding: "utf8",
4521
- timeout: 5e3
4522
- });
4523
- currentBranch = stdout.trim() || null;
4524
- } catch {
4525
- currentBranch = null;
4526
- }
4527
- if (currentBranch === branch) return wtPath;
4528
- let dirty = true;
4529
- try {
4530
- const { stdout } = await execFileAsync("git", ["status", "--porcelain"], {
4531
- cwd: wtPath,
4532
- encoding: "utf8",
4533
- timeout: 5e3
4534
- });
4535
- dirty = stdout.trim().length > 0;
4536
- } catch {
4537
- dirty = true;
4538
- }
4539
- recordOrchestrationEventBestEffort({
4540
- eventType: "worktree.branch_mismatch",
4541
- source: "tmux-routing.ensureWorktreeAsync",
4542
- severity: "warn",
4543
- agentId: employeeName,
4544
- instanceId: instance != null ? String(instance) : null,
4545
- payload: { expectedBranch: branch, actualBranch: currentBranch, dirty }
4546
- });
4547
- if (dirty) return null;
4548
- await execFileAsync("git", ["worktree", "remove", wtPath], { cwd: repoRoot, timeout: 1e4 });
4549
- }
4550
- mkdirSync6(path8.join(repoRoot, ".worktrees"), { recursive: true });
4551
- try {
4552
- await execFileAsync("git", ["worktree", "prune"], { cwd: repoRoot, timeout: 1e4 });
4553
- } catch {
4554
- }
4555
- let branchExists = false;
4556
- try {
4557
- await execFileAsync("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branch}`], { cwd: repoRoot, timeout: 5e3 });
4558
- branchExists = true;
4559
- } catch {
4560
- branchExists = false;
4561
- }
4562
- await execFileAsync(
4563
- "git",
4564
- branchExists ? ["worktree", "add", wtPath, branch] : ["worktree", "add", wtPath, "-b", branch, "HEAD"],
4565
- { cwd: repoRoot, timeout: 1e4 }
4566
- );
4567
- recordOrchestrationEventBestEffort({
4568
- eventType: "worktree.created",
4569
- source: "tmux-routing.ensureWorktreeAsync",
4570
- agentId: employeeName,
4571
- instanceId: instance != null ? String(instance) : null,
4572
- payload: { branch, reusedBranch: branchExists }
4573
- });
4574
- return wtPath;
4575
- } catch (err) {
4576
- process.stderr.write(`[tmux-routing] async worktree setup failed for ${employeeName}: ${err instanceof Error ? err.message : String(err)}
4577
- `);
4578
- return null;
4579
- }
4562
+ return ensureWorktree(projectDir, employeeName, instance);
4580
4563
  }
4581
4564
  function ensureEmployee(employeeName, exeSession, projectDir, opts) {
4582
4565
  employeeName = employeeName.toLowerCase();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  storeBehavior
3
- } from "./chunk-KCHIJUYX.js";
3
+ } from "./chunk-JKSK4VFX.js";
4
4
  import {
5
5
  getClient
6
6
  } from "./chunk-BIM763ML.js";
@@ -119,7 +119,7 @@ function releaseBackfillLock() {
119
119
  }
120
120
  async function getTaskAwareCapacity() {
121
121
  const { getClient } = await import("./lib/database.js");
122
- const { sessionScopeFilter } = await import("./task-scope-J3OMPV5A.js");
122
+ const { sessionScopeFilter } = await import("./task-scope-7BWIG4G3.js");
123
123
  const client = getClient();
124
124
  const scope = sessionScopeFilter();
125
125
  const result = await client.execute({
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-A47MXY2I.js";
4
4
  import {
5
5
  isGhostBehaviorRow
6
- } from "./chunk-KCHIJUYX.js";
6
+ } from "./chunk-JKSK4VFX.js";
7
7
  import {
8
8
  getClient,
9
9
  getIdentity,
@@ -9,7 +9,7 @@ import {
9
9
  isEmployeeAlive,
10
10
  sessionScopeFilter,
11
11
  updateTaskStatus
12
- } from "./chunk-ZSMF37M6.js";
12
+ } from "./chunk-X3VIRILN.js";
13
13
  import {
14
14
  DEFAULT_COORDINATOR_TEMPLATE_NAME,
15
15
  getCoordinatorName
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCurrentSessionScope,
3
3
  strictSessionScopeFilter
4
- } from "./chunk-ZSMF37M6.js";
4
+ } from "./chunk-X3VIRILN.js";
5
5
  import {
6
6
  getProjectName
7
7
  } from "./chunk-OPU3NYOO.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  recordSessionKill
3
- } from "./chunk-MNLSPTWM.js";
3
+ } from "./chunk-D2527Q5Y.js";
4
4
  import {
5
5
  updateTask
6
- } from "./chunk-5JILQMRS.js";
6
+ } from "./chunk-U6M5C3MB.js";
7
7
  import {
8
8
  countPendingReviews,
9
9
  ensureEmployeeAsync,
@@ -16,7 +16,7 @@ import {
16
16
  sessionScopeFilter,
17
17
  strictSessionScopeFilter,
18
18
  writeNotification
19
- } from "./chunk-ZSMF37M6.js";
19
+ } from "./chunk-X3VIRILN.js";
20
20
  import {
21
21
  isLeaseExpired
22
22
  } from "./chunk-E23LNUWJ.js";
@@ -2298,7 +2298,7 @@ async function reapOrphanedWorktrees(deps, nowMs = Date.now()) {
2298
2298
  }
2299
2299
  async function createWorktreeReaperRealDeps() {
2300
2300
  const { getPaneCwdAsync } = await import("./lib/tmux-status.js");
2301
- const { getGitRoot, isWorktreeDirty: isDirty } = await import("./worktree-3RKV6KQO.js");
2301
+ const { getGitRoot, isWorktreeDirty: isDirty } = await import("./worktree-WF7X43XI.js");
2302
2302
  const { statSync: statSync3 } = await import("fs");
2303
2303
  const { basename: basename2 } = await import("path");
2304
2304
  const { promisify: promisify2 } = await import("util");
@@ -2513,7 +2513,7 @@ async function gcStaleCheckpoints() {
2513
2513
  }
2514
2514
  async function pollTaskGroupBarriers() {
2515
2515
  try {
2516
- const { checkAndFireBarriers } = await import("./tasks-crud-NGMRLJH5.js");
2516
+ const { checkAndFireBarriers } = await import("./tasks-crud-IW3ZBFHL.js");
2517
2517
  const firedGroupIds = await checkAndFireBarriers();
2518
2518
  if (firedGroupIds.length === 0) return 0;
2519
2519
  const { getClient } = await import("./lib/database.js");
@@ -7,7 +7,7 @@ import "./chunk-Z6BZQHP5.js";
7
7
  import "./chunk-GUMRIUI5.js";
8
8
  import {
9
9
  fastDbInit
10
- } from "./chunk-NPAGBSEN.js";
10
+ } from "./chunk-OMJH4DQ7.js";
11
11
  import {
12
12
  getClient
13
13
  } from "./chunk-BIM763ML.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createCRMWebhookHandler,
3
3
  parseTwentyWebhook
4
- } from "./chunk-4NGPNH3F.js";
5
- import "./chunk-N4G4M6LE.js";
4
+ } from "./chunk-SRGBHZ3H.js";
5
+ import "./chunk-S4Y5YXPX.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  createCRMWebhookHandler,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  sessionScopeFilter
3
- } from "./chunk-ZSMF37M6.js";
3
+ } from "./chunk-X3VIRILN.js";
4
4
  import "./chunk-YYKY45TM.js";
5
- import "./chunk-SNJEQPPA.js";
6
- import "./chunk-BPH6YPHA.js";
5
+ import "./chunk-UWT664G5.js";
6
+ import "./chunk-45AA4HOH.js";
7
7
  import "./chunk-EIKATSE4.js";
8
8
  import "./chunk-E23LNUWJ.js";
9
9
  import "./chunk-4JERP7NT.js";
@@ -58,14 +58,14 @@ import {
58
58
  shouldKillIdleSession,
59
59
  shouldKillSession,
60
60
  shouldNudgeEmployee
61
- } from "./chunk-MTHQR76V.js";
62
- import "./chunk-MNLSPTWM.js";
63
- import "./chunk-5JILQMRS.js";
64
- import "./chunk-YL5S6I3R.js";
65
- import "./chunk-ZSMF37M6.js";
61
+ } from "./chunk-ZWIYJV2F.js";
62
+ import "./chunk-D2527Q5Y.js";
63
+ import "./chunk-U6M5C3MB.js";
64
+ import "./chunk-JEDQHPPC.js";
65
+ import "./chunk-X3VIRILN.js";
66
66
  import "./chunk-YYKY45TM.js";
67
- import "./chunk-SNJEQPPA.js";
68
- import "./chunk-BPH6YPHA.js";
67
+ import "./chunk-UWT664G5.js";
68
+ import "./chunk-45AA4HOH.js";
69
69
  import "./chunk-EIKATSE4.js";
70
70
  import "./chunk-E23LNUWJ.js";
71
71
  import "./chunk-4JERP7NT.js";
@@ -0,0 +1,7 @@
1
+ import {
2
+ waitForDaemonReady
3
+ } from "./chunk-FLNSJ2TC.js";
4
+ import "./chunk-MLKGABMK.js";
5
+ export {
6
+ waitForDaemonReady
7
+ };
@@ -14,9 +14,9 @@ import {
14
14
  rowToDocument,
15
15
  rowToWorkspace,
16
16
  updateChunksImportance
17
- } from "./chunk-CPXFQBBN.js";
17
+ } from "./chunk-2OZMCTYQ.js";
18
18
  import "./chunk-3QDSCJ3F.js";
19
- import "./chunk-KKZPF6YI.js";
19
+ import "./chunk-J6REQ7CV.js";
20
20
  import "./chunk-CHCA3ZM2.js";
21
21
  import "./chunk-OTVEIJUQ.js";
22
22
  import "./chunk-66RCRDIF.js";