@askexenow/exe-os 0.9.141 → 0.9.143

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 (94) hide show
  1. package/dist/bin/bulk-sync-postgres.js +1 -1
  2. package/dist/bin/cleanup-stale-review-tasks.js +1 -1
  3. package/dist/bin/cli.js +2 -2
  4. package/dist/bin/exe-boot.js +1 -1
  5. package/dist/bin/exe-cloud.js +1 -1
  6. package/dist/bin/exe-dispatch.js +1 -1
  7. package/dist/bin/exe-gateway.js +4 -4
  8. package/dist/bin/exe-heartbeat.js +1 -1
  9. package/dist/bin/exe-launch-agent.js +15 -2
  10. package/dist/bin/exe-pending-messages.js +2 -2
  11. package/dist/bin/exe-pending-notifications.js +1 -1
  12. package/dist/bin/exe-pending-reviews.js +1 -1
  13. package/dist/bin/exe-review.js +1 -1
  14. package/dist/bin/exe-session-cleanup.js +4 -4
  15. package/dist/bin/exe-settings.js +1 -1
  16. package/dist/bin/exe-status.js +2 -2
  17. package/dist/bin/git-sweep.js +2 -2
  18. package/dist/bin/intercom-check.js +2 -2
  19. package/dist/bin/scan-tasks.js +1 -1
  20. package/dist/bin/setup.js +1 -1
  21. package/dist/{capacity-monitor-ZIAX3FBS.js → capacity-monitor-D3RGDLMN.js} +2 -2
  22. package/dist/{catchup-brief-GYZWGUDP.js → catchup-brief-LD2QLE2D.js} +1 -1
  23. package/dist/{chunk-NTALKXBR.js → chunk-25QUV6FU.js} +2 -2
  24. package/dist/{chunk-NW4AUWIT.js → chunk-32Z4GK25.js} +2 -2
  25. package/dist/{chunk-CXXGHL7T.js → chunk-4CBBN2XD.js} +123 -34
  26. package/dist/{chunk-K6WORHFF.js → chunk-4YSDLTCT.js} +3 -3
  27. package/dist/{chunk-IBWVMMLN.js → chunk-5PZ3HSGP.js} +44 -34
  28. package/dist/{chunk-EP523LJD.js → chunk-7BPUBHGW.js} +1 -1
  29. package/dist/{chunk-Y3JNBCZI.js → chunk-AOJHEMHE.js} +24 -5
  30. package/dist/{chunk-4NKNXOA5.js → chunk-CHXX73NX.js} +2 -2
  31. package/dist/{chunk-P3RKVFBX.js → chunk-CK5ZAMWX.js} +2 -2
  32. package/dist/{chunk-HSJKFTKP.js → chunk-DKWTDULH.js} +2 -2
  33. package/dist/{chunk-QWOQHCRO.js → chunk-E2KEN3PG.js} +1 -1
  34. package/dist/{chunk-T62RXVA4.js → chunk-EENNKZMN.js} +2 -2
  35. package/dist/{chunk-47D4UN72.js → chunk-JMMY24KD.js} +2 -2
  36. package/dist/{chunk-RGKFUMLQ.js → chunk-JSVRX6IW.js} +3 -3
  37. package/dist/{chunk-BBOD5TVX.js → chunk-KCLL5ECT.js} +1 -1
  38. package/dist/{chunk-ENL5P2CU.js → chunk-LFVL3R6H.js} +1 -1
  39. package/dist/{chunk-UEJTDPRA.js → chunk-MRX42FAS.js} +1 -1
  40. package/dist/{chunk-PB5TRWLG.js → chunk-NWUWTV7B.js} +1 -1
  41. package/dist/{chunk-GQNG4MKL.js → chunk-TJI7DMBT.js} +1 -1
  42. package/dist/{chunk-GVGISFMN.js → chunk-UB7E2FEB.js} +1 -1
  43. package/dist/{chunk-EP3OKNTW.js → chunk-UYNFWD54.js} +1 -1
  44. package/dist/{crm-webhook-7654EZEJ.js → crm-webhook-HGUHXI6W.js} +2 -2
  45. package/dist/{cto-delegation-gate-43UJFGMT.js → cto-delegation-gate-RJ5EVOY3.js} +1 -1
  46. package/dist/{daemon-orchestration-NB5HYPXS.js → daemon-orchestration-3E3BIK7E.js} +4 -4
  47. package/dist/gateway/index.js +5 -5
  48. package/dist/{git-task-sweep-ATQQNA7A.js → git-task-sweep-O4OIPQB3.js} +2 -2
  49. package/dist/hooks/bug-report-worker.js +3 -3
  50. package/dist/hooks/codex-stop-task-finalizer.js +3 -3
  51. package/dist/hooks/commit-complete.js +3 -3
  52. package/dist/hooks/ingest.js +1 -1
  53. package/dist/hooks/post-compact.js +1 -1
  54. package/dist/hooks/post-tool-combined.js +1 -1
  55. package/dist/hooks/pre-compact.js +2 -2
  56. package/dist/hooks/pre-tool-use.js +9 -6
  57. package/dist/hooks/prompt-submit.js +3 -3
  58. package/dist/hooks/session-end.js +5 -5
  59. package/dist/hooks/session-start.js +2 -2
  60. package/dist/hooks/stop.js +2 -2
  61. package/dist/hooks/subagent-stop.js +1 -1
  62. package/dist/hooks/summary-worker.js +2 -2
  63. package/dist/index.js +8 -8
  64. package/dist/lib/cloud-sync.js +1 -1
  65. package/dist/lib/exe-daemon.js +63 -11
  66. package/dist/lib/messaging.js +2 -2
  67. package/dist/lib/tasks.js +3 -3
  68. package/dist/lib/tmux-routing.js +1 -1
  69. package/dist/mcp/register-tools.js +15 -15
  70. package/dist/mcp/server.js +15 -15
  71. package/dist/mcp/tools/create-task.js +4 -4
  72. package/dist/mcp/tools/list-tasks.js +4 -4
  73. package/dist/mcp/tools/send-message.js +3 -3
  74. package/dist/mcp/tools/update-task.js +4 -4
  75. package/dist/message-queue-client-2YTGEB5H.js +92 -0
  76. package/dist/{notifications-OXEFBG2D.js → notifications-APKWB63A.js} +1 -1
  77. package/dist/{orchestrator-6ULAKZQP.js → orchestrator-W62CLQLP.js} +2 -2
  78. package/dist/runtime/index.js +3 -3
  79. package/dist/{session-events-5X2SSRXX.js → session-events-SR2WX2X4.js} +2 -2
  80. package/dist/{session-scope-42JIV5KF.js → session-scope-S5DODJU4.js} +2 -2
  81. package/dist/{setup-wizard-MAPYQDKT.js → setup-wizard-H4TZHU36.js} +1 -1
  82. package/dist/{task-enforcement-V2CQEPXS.js → task-enforcement-L7EGD6LJ.js} +1 -1
  83. package/dist/{task-scope-EY3G5623.js → task-scope-QNRAYD7S.js} +1 -1
  84. package/dist/{tasks-crud-FPWY4RZ2.js → tasks-crud-JHHIROCS.js} +1 -1
  85. package/dist/{tasks-review-XDSW3WRG.js → tasks-review-TXMVOOFN.js} +1 -1
  86. package/dist/tui/App.js +7 -7
  87. package/dist/{tui-data-FQ2F5WA3.js → tui-data-65WM7L5Q.js} +1 -1
  88. package/dist/{workflow-engine-6QPTYDQI.js → workflow-engine-PK2TC7UE.js} +2 -2
  89. package/package.json +1 -1
  90. package/release-notes.json +207 -199
  91. /package/dist/{chunk-T7SJCDG3.js → chunk-72O7CSKA.js} +0 -0
  92. /package/dist/{chunk-CU2XXD5I.js → chunk-UYFPFO6Q.js} +0 -0
  93. /package/dist/{chunk-XFBKSNNI.js → chunk-XRPIVNFS.js} +0 -0
  94. /package/dist/{exe-key-KHNNQGSZ.js → exe-key-KNR4LT2L.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  pushToPostgres
4
- } from "../chunk-IBWVMMLN.js";
4
+ } from "../chunk-5PZ3HSGP.js";
5
5
  import "../chunk-JZB67O4M.js";
6
6
  import "../chunk-HJMM4QMY.js";
7
7
  import {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  init_task_scope,
7
7
  sessionScopeFilter
8
- } from "../chunk-Y3JNBCZI.js";
8
+ } from "../chunk-AOJHEMHE.js";
9
9
  import "../chunk-2OG5NAO2.js";
10
10
  import "../chunk-NEAHEC5G.js";
11
11
  import "../chunk-KRLOFIPI.js";
package/dist/bin/cli.js CHANGED
@@ -107,7 +107,7 @@ if (args.includes("--global")) {
107
107
  process.exit(1);
108
108
  }
109
109
  } else if (args[0] === "key") {
110
- const { main: runKey } = await import("../exe-key-KHNNQGSZ.js");
110
+ const { main: runKey } = await import("../exe-key-KNR4LT2L.js");
111
111
  await runKey(args.slice(1));
112
112
  } else if (args[0] === "link") {
113
113
  console.error("`exe-os link` has been removed from the customer command surface.");
@@ -293,7 +293,7 @@ ID: ${result.id}`);
293
293
  process.exit(1);
294
294
  }
295
295
  } else if (args[0] === "setup" || args[0] === "-setup" || args[0] === "--setup") {
296
- const { runSetupWizard } = await import("../setup-wizard-MAPYQDKT.js");
296
+ const { runSetupWizard } = await import("../setup-wizard-H4TZHU36.js");
297
297
  await runSetupWizard({ skipModel: args.includes("--skip-model") });
298
298
  } else if (args[0] === "update") {
299
299
  const { runUpdate } = await import("./update.js");
@@ -30,7 +30,7 @@ import {
30
30
  resolveExeSession,
31
31
  sessionScopeFilter,
32
32
  updateTaskStatus
33
- } from "../chunk-Y3JNBCZI.js";
33
+ } from "../chunk-AOJHEMHE.js";
34
34
  import "../chunk-2OG5NAO2.js";
35
35
  import "../chunk-NEAHEC5G.js";
36
36
  import {
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-6KFICEAT.js";
7
7
  import {
8
8
  assertSecureEndpoint
9
- } from "../chunk-IBWVMMLN.js";
9
+ } from "../chunk-5PZ3HSGP.js";
10
10
  import "../chunk-JZB67O4M.js";
11
11
  import "../chunk-HJMM4QMY.js";
12
12
  import "../chunk-55LEDLDE.js";
@@ -8,7 +8,7 @@ import {
8
8
  init_tasks_crud,
9
9
  init_tmux_routing,
10
10
  resolveExeSession
11
- } from "../chunk-Y3JNBCZI.js";
11
+ } from "../chunk-AOJHEMHE.js";
12
12
  import "../chunk-2OG5NAO2.js";
13
13
  import "../chunk-NEAHEC5G.js";
14
14
  import "../chunk-KRLOFIPI.js";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  BotRegistry,
4
4
  Gateway
5
- } from "../chunk-GQNG4MKL.js";
6
- import "../chunk-QWOQHCRO.js";
7
- import "../chunk-T7SJCDG3.js";
5
+ } from "../chunk-TJI7DMBT.js";
6
+ import "../chunk-E2KEN3PG.js";
7
+ import "../chunk-72O7CSKA.js";
8
8
  import "../chunk-GCNWCYJI.js";
9
9
  import "../chunk-WZQ4CPRG.js";
10
10
  import {
@@ -1060,7 +1060,7 @@ async function main() {
1060
1060
  console.log("[exe-gateway] Generic webhook adapter registered");
1061
1061
  }
1062
1062
  {
1063
- const { createCRMWebhookHandler } = await import("../crm-webhook-7654EZEJ.js");
1063
+ const { createCRMWebhookHandler } = await import("../crm-webhook-HGUHXI6W.js");
1064
1064
  const handler = createCRMWebhookHandler();
1065
1065
  server.onPlatform("crm", handler);
1066
1066
  console.log("[exe-gateway] CRM webhook adapter registered");
@@ -9,7 +9,7 @@ import {
9
9
  isExeSession,
10
10
  listPendingReviews,
11
11
  strictSessionScopeFilter
12
- } from "../chunk-Y3JNBCZI.js";
12
+ } from "../chunk-AOJHEMHE.js";
13
13
  import "../chunk-2OG5NAO2.js";
14
14
  import "../chunk-NEAHEC5G.js";
15
15
  import "../chunk-KRLOFIPI.js";
@@ -90,13 +90,15 @@ function resolveAgent(argv) {
90
90
  return { agent, provider: DEFAULT_PROVIDER, passthrough };
91
91
  }
92
92
  async function isKnownAgent(agent) {
93
+ const baseName = baseAgentName(agent);
94
+ const candidates = [agent.toLowerCase(), baseName.toLowerCase()];
93
95
  const knownAgents = getKnownAgents();
94
96
  if (knownAgents.length === 0) return true;
95
- if (knownAgents.some((a) => a.toLowerCase() === agent.toLowerCase())) return true;
97
+ if (knownAgents.some((a) => candidates.includes(a.toLowerCase()))) return true;
96
98
  try {
97
99
  const employees = await loadEmployees();
98
100
  if (employees.length === 0) return true;
99
- return employees.some((e) => e.name.toLowerCase() === agent.toLowerCase());
101
+ return employees.some((e) => candidates.includes(e.name.toLowerCase()));
100
102
  } catch {
101
103
  return true;
102
104
  }
@@ -111,6 +113,17 @@ function identityPathFor(agent) {
111
113
  if (match) return path.join(dir, match);
112
114
  } catch {
113
115
  }
116
+ const baseName = agent.replace(/\d+$/, "");
117
+ if (baseName !== agent) {
118
+ const basePath = path.join(dir, `${baseName}.md`);
119
+ if (existsSync(basePath)) return basePath;
120
+ try {
121
+ const files = readdirSync(dir);
122
+ const match = files.find((f) => f.toLowerCase() === `${baseName.toLowerCase()}.md`);
123
+ if (match) return path.join(dir, match);
124
+ } catch {
125
+ }
126
+ }
114
127
  return exactPath;
115
128
  }
116
129
  var DEFAULT_ROLE_MCP_MAP = {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getPendingMessages,
3
3
  markRead
4
- } from "../chunk-T62RXVA4.js";
4
+ } from "../chunk-EENNKZMN.js";
5
5
  import {
6
6
  fastDbInit
7
7
  } from "../chunk-7A2YCQNM.js";
8
- import "../chunk-Y3JNBCZI.js";
8
+ import "../chunk-AOJHEMHE.js";
9
9
  import "../chunk-2OG5NAO2.js";
10
10
  import "../chunk-NEAHEC5G.js";
11
11
  import "../chunk-KRLOFIPI.js";
@@ -6,7 +6,7 @@ import {
6
6
  init_notifications,
7
7
  markAsRead,
8
8
  readUnreadNotifications
9
- } from "../chunk-Y3JNBCZI.js";
9
+ } from "../chunk-AOJHEMHE.js";
10
10
  import "../chunk-2OG5NAO2.js";
11
11
  import "../chunk-NEAHEC5G.js";
12
12
  import "../chunk-KRLOFIPI.js";
@@ -11,7 +11,7 @@ import {
11
11
  isExeSession,
12
12
  isStale,
13
13
  listPendingReviews
14
- } from "../chunk-Y3JNBCZI.js";
14
+ } from "../chunk-AOJHEMHE.js";
15
15
  import "../chunk-2OG5NAO2.js";
16
16
  import "../chunk-NEAHEC5G.js";
17
17
  import "../chunk-KRLOFIPI.js";
@@ -11,7 +11,7 @@ import {
11
11
  getCurrentSessionScope,
12
12
  init_task_scope,
13
13
  strictSessionScopeFilter
14
- } from "../chunk-Y3JNBCZI.js";
14
+ } from "../chunk-AOJHEMHE.js";
15
15
  import "../chunk-2OG5NAO2.js";
16
16
  import "../chunk-NEAHEC5G.js";
17
17
  import "../chunk-KRLOFIPI.js";
@@ -14,7 +14,7 @@ import {
14
14
  init_tasks_crud,
15
15
  sessionScopeFilter,
16
16
  updateTaskStatus
17
- } from "../chunk-Y3JNBCZI.js";
17
+ } from "../chunk-AOJHEMHE.js";
18
18
  import "../chunk-2OG5NAO2.js";
19
19
  import "../chunk-NEAHEC5G.js";
20
20
  import "../chunk-KRLOFIPI.js";
@@ -146,7 +146,7 @@ try {
146
146
  `
147
147
  );
148
148
  try {
149
- const { createReviewForCompletedTask } = await import("../tasks-review-XDSW3WRG.js");
149
+ const { createReviewForCompletedTask } = await import("../tasks-review-TXMVOOFN.js");
150
150
  await createReviewForCompletedTask(
151
151
  {
152
152
  id: String(dt.id),
@@ -182,7 +182,7 @@ try {
182
182
  if (result.rows.length === 0) process.exit(0);
183
183
  let commits = [];
184
184
  try {
185
- const { getRecentCommits } = await import("../git-task-sweep-ATQQNA7A.js");
185
+ const { getRecentCommits } = await import("../git-task-sweep-O4OIPQB3.js");
186
186
  commits = getRecentCommits(30);
187
187
  } catch {
188
188
  }
@@ -195,7 +195,7 @@ try {
195
195
  const context = row.context ? String(row.context) : void 0;
196
196
  if (commits.length > 0) {
197
197
  try {
198
- const { findBestMatch } = await import("../git-task-sweep-ATQQNA7A.js");
198
+ const { findBestMatch } = await import("../git-task-sweep-O4OIPQB3.js");
199
199
  const match = findBestMatch({ id: taskId, title, context }, commits);
200
200
  if (match) {
201
201
  try {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  assertSecureEndpoint
3
- } from "../chunk-IBWVMMLN.js";
3
+ } from "../chunk-5PZ3HSGP.js";
4
4
  import "../chunk-JZB67O4M.js";
5
5
  import "../chunk-HJMM4QMY.js";
6
6
  import {
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  status
4
- } from "../chunk-UEJTDPRA.js";
4
+ } from "../chunk-MRX42FAS.js";
5
5
  import "../chunk-7A2YCQNM.js";
6
- import "../chunk-Y3JNBCZI.js";
6
+ import "../chunk-AOJHEMHE.js";
7
7
  import "../chunk-2OG5NAO2.js";
8
8
  import "../chunk-NEAHEC5G.js";
9
9
  import "../chunk-KRLOFIPI.js";
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  sweepTasks
4
- } from "../chunk-HSJKFTKP.js";
5
- import "../chunk-Y3JNBCZI.js";
4
+ } from "../chunk-DKWTDULH.js";
5
+ import "../chunk-AOJHEMHE.js";
6
6
  import "../chunk-2OG5NAO2.js";
7
7
  import "../chunk-NEAHEC5G.js";
8
8
  import "../chunk-KRLOFIPI.js";
@@ -17,7 +17,7 @@ async function main() {
17
17
  }
18
18
  if (isCoordinator) {
19
19
  try {
20
- const { listPendingReviews, cleanupOrphanedReviews, formatAge, isStale } = await import("../tasks-review-XDSW3WRG.js");
20
+ const { listPendingReviews, cleanupOrphanedReviews, formatAge, isStale } = await import("../tasks-review-TXMVOOFN.js");
21
21
  const { extractRootExe } = await import("../lib/tmux-routing.js");
22
22
  await cleanupOrphanedReviews();
23
23
  let sessionScope = process.env.EXE_SESSION ? extractRootExe(process.env.EXE_SESSION) ?? void 0 : void 0;
@@ -107,7 +107,7 @@ async function main() {
107
107
  }
108
108
  }
109
109
  try {
110
- const { readUnreadNotifications, markAsRead } = await import("../notifications-OXEFBG2D.js");
110
+ const { readUnreadNotifications, markAsRead } = await import("../notifications-APKWB63A.js");
111
111
  const notifications = await readUnreadNotifications(agent);
112
112
  const recentCutoff = Date.now() - 24 * 60 * 60 * 1e3;
113
113
  const pending = notifications.filter((row) => new Date(row.timestamp).getTime() > recentCutoff);
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  init_task_scope,
4
4
  sessionScopeFilter
5
- } from "../chunk-Y3JNBCZI.js";
5
+ } from "../chunk-AOJHEMHE.js";
6
6
  import "../chunk-2OG5NAO2.js";
7
7
  import "../chunk-NEAHEC5G.js";
8
8
  import "../chunk-KRLOFIPI.js";
package/dist/bin/setup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runSetupWizard
4
- } from "../chunk-CU2XXD5I.js";
4
+ } from "../chunk-UYFPFO6Q.js";
5
5
  import "../chunk-4JZNDVZH.js";
6
6
  import "../chunk-VA42PIIY.js";
7
7
  import "../chunk-FZ23OZL3.js";
@@ -9,9 +9,9 @@ import {
9
9
  isAtCapacity,
10
10
  isWithinRelaunchCooldown,
11
11
  pollCapacityDead
12
- } from "./chunk-GVGISFMN.js";
12
+ } from "./chunk-UB7E2FEB.js";
13
13
  import "./chunk-EZUWMBWA.js";
14
- import "./chunk-Y3JNBCZI.js";
14
+ import "./chunk-AOJHEMHE.js";
15
15
  import "./chunk-2OG5NAO2.js";
16
16
  import "./chunk-NEAHEC5G.js";
17
17
  import "./chunk-KRLOFIPI.js";
@@ -7,7 +7,7 @@ import {
7
7
  init_task_scope,
8
8
  sessionScopeFilter,
9
9
  strictSessionScopeFilter
10
- } from "./chunk-Y3JNBCZI.js";
10
+ } from "./chunk-AOJHEMHE.js";
11
11
  import "./chunk-2OG5NAO2.js";
12
12
  import "./chunk-NEAHEC5G.js";
13
13
  import "./chunk-KRLOFIPI.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createTask,
3
3
  init_tasks
4
- } from "./chunk-RGKFUMLQ.js";
4
+ } from "./chunk-JSVRX6IW.js";
5
5
  import {
6
6
  getActiveAgent
7
7
  } from "./chunk-CBSUVFZ7.js";
@@ -11,7 +11,7 @@ import {
11
11
  init_tmux_routing,
12
12
  logTaskDispatch,
13
13
  resolveExeSession
14
- } from "./chunk-Y3JNBCZI.js";
14
+ } from "./chunk-AOJHEMHE.js";
15
15
  import {
16
16
  getLicenseSync,
17
17
  init_plan_limits
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  init_tasks,
3
3
  updateTask
4
- } from "./chunk-RGKFUMLQ.js";
4
+ } from "./chunk-JSVRX6IW.js";
5
5
  import {
6
6
  TASK_ALREADY_CLAIMED_PREFIX,
7
7
  init_tasks_crud,
8
8
  resolveTask
9
- } from "./chunk-Y3JNBCZI.js";
9
+ } from "./chunk-AOJHEMHE.js";
10
10
  import {
11
11
  canCoordinate,
12
12
  getClient,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-XIIVMIS4.js";
4
4
  import {
5
5
  AUTO_WAKE_MAX_RETRIES
6
- } from "./chunk-47D4UN72.js";
6
+ } from "./chunk-JMMY24KD.js";
7
7
  import {
8
8
  getToolCapabilityIndex
9
9
  } from "./chunk-267IKUT5.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-E6ORBQHP.js";
29
29
  import {
30
30
  listRecentSessionEvents
31
- } from "./chunk-BBOD5TVX.js";
31
+ } from "./chunk-KCLL5ECT.js";
32
32
  import {
33
33
  analyzeBlastRadius,
34
34
  buildCodeContextIndex,
@@ -53,7 +53,7 @@ import {
53
53
  import {
54
54
  createOrRefreshResumeTask,
55
55
  init_capacity_monitor
56
- } from "./chunk-GVGISFMN.js";
56
+ } from "./chunk-UB7E2FEB.js";
57
57
  import {
58
58
  registerCompleteReminder
59
59
  } from "./chunk-LGPTAJZC.js";
@@ -62,16 +62,16 @@ import {
62
62
  } from "./chunk-DUDPJVAC.js";
63
63
  import {
64
64
  registerSendMessage
65
- } from "./chunk-ENL5P2CU.js";
65
+ } from "./chunk-LFVL3R6H.js";
66
66
  import {
67
67
  registerCreateTask
68
- } from "./chunk-NTALKXBR.js";
68
+ } from "./chunk-25QUV6FU.js";
69
69
  import {
70
70
  registerListTasks
71
- } from "./chunk-P3RKVFBX.js";
71
+ } from "./chunk-CK5ZAMWX.js";
72
72
  import {
73
73
  registerUpdateTask
74
- } from "./chunk-NW4AUWIT.js";
74
+ } from "./chunk-32Z4GK25.js";
75
75
  import {
76
76
  registerCreateReminder
77
77
  } from "./chunk-6V6UTSOP.js";
@@ -85,7 +85,7 @@ import {
85
85
  } from "./chunk-BKEJSHDE.js";
86
86
  import {
87
87
  status
88
- } from "./chunk-UEJTDPRA.js";
88
+ } from "./chunk-MRX42FAS.js";
89
89
  import {
90
90
  TOKENS_PER_IDLE_MINUTE,
91
91
  countKillsSince,
@@ -152,7 +152,7 @@ import {
152
152
  cloudSync,
153
153
  getCloudReuploadRequired,
154
154
  markCloudReuploadRequired
155
- } from "./chunk-IBWVMMLN.js";
155
+ } from "./chunk-5PZ3HSGP.js";
156
156
  import {
157
157
  crypto_exports,
158
158
  init_crypto
@@ -172,7 +172,7 @@ import {
172
172
  import {
173
173
  init_tasks,
174
174
  updateTask
175
- } from "./chunk-RGKFUMLQ.js";
175
+ } from "./chunk-JSVRX6IW.js";
176
176
  import {
177
177
  fastDbInit
178
178
  } from "./chunk-7A2YCQNM.js";
@@ -209,7 +209,7 @@ import {
209
209
  tmux_routing_exports,
210
210
  updateTaskStatus,
211
211
  writeCheckpoint
212
- } from "./chunk-Y3JNBCZI.js";
212
+ } from "./chunk-AOJHEMHE.js";
213
213
  import {
214
214
  init_session_registry,
215
215
  listSessions
@@ -242,7 +242,7 @@ import {
242
242
  createNewTrigger,
243
243
  isScheduledTrigger,
244
244
  loadTriggers
245
- } from "./chunk-T7SJCDG3.js";
245
+ } from "./chunk-72O7CSKA.js";
246
246
  import {
247
247
  pushConversationToCRM
248
248
  } from "./chunk-GCNWCYJI.js";
@@ -1931,7 +1931,7 @@ function registerCloseTask(server) {
1931
1931
  }
1932
1932
  } catch {
1933
1933
  }
1934
- let mergeWarning = "";
1934
+ let mergeNote = "";
1935
1935
  try {
1936
1936
  const { getClient: getClient2 } = await import("./lib/database.js");
1937
1937
  const client = getClient2();
@@ -1944,17 +1944,39 @@ function registerCloseTask(server) {
1944
1944
  const { execSync } = await import("child_process");
1945
1945
  try {
1946
1946
  const openPRs = execSync(
1947
- `gh pr list --state open --json number,title,headRefName --author ${assignee} 2>/dev/null`,
1947
+ `gh pr list --state open --json number,title,headRefName 2>/dev/null`,
1948
1948
  { encoding: "utf8", timeout: 5e3 }
1949
1949
  ).trim();
1950
- const prs = JSON.parse(openPRs || "[]");
1950
+ const allPrs = JSON.parse(openPRs || "[]");
1951
+ const baseName = assignee.replace(/\d+$/, "");
1952
+ const prs = allPrs.filter(
1953
+ (p) => p.headRefName.startsWith(`${assignee}-`) || p.headRefName.startsWith(`${baseName}-`) || p.headRefName === `${assignee}-work` || p.headRefName === `${baseName}-work`
1954
+ );
1955
+ for (const pr of prs) {
1956
+ try {
1957
+ execSync(`gh pr merge ${pr.number} --squash --admin --delete-branch 2>/dev/null`, { timeout: 15e3 });
1958
+ mergeNote += `
1959
+ \u2705 Auto-merged PR #${pr.number}: ${pr.title}`;
1960
+ process.stderr.write(`[close-task] Auto-merged PR #${pr.number} (${pr.headRefName})
1961
+ `);
1962
+ } catch (mergeErr) {
1963
+ mergeNote += `
1964
+ \u26A0\uFE0F Failed to merge PR #${pr.number}: ${mergeErr instanceof Error ? mergeErr.message : "unknown error"}`;
1965
+ }
1966
+ }
1951
1967
  if (prs.length > 0) {
1952
- const prList = prs.map((p) => ` #${p.number}: ${p.title} (${p.headRefName})`).join("\n");
1953
- mergeWarning = `
1954
-
1955
- \u26A0\uFE0F MERGE CHECK: ${assignee} has ${prs.length} open PR(s) \u2014 did you merge before closing?
1956
- ${prList}
1957
- Run: gh pr merge <number> --squash --delete-branch`;
1968
+ try {
1969
+ execSync("git pull origin main 2>/dev/null", { timeout: 1e4 });
1970
+ mergeNote += "\n\u2705 Pulled latest main";
1971
+ } catch {
1972
+ mergeNote += "\n\u26A0\uFE0F git pull failed \u2014 run manually";
1973
+ }
1974
+ try {
1975
+ execSync("npm run build 2>/dev/null", { timeout: 6e4 });
1976
+ mergeNote += "\n\u2705 Build verified";
1977
+ } catch {
1978
+ mergeNote += "\n\u26A0\uFE0F Build failed after merge \u2014 investigate";
1979
+ }
1958
1980
  }
1959
1981
  } catch {
1960
1982
  }
@@ -1971,7 +1993,53 @@ Run: gh pr merge <number> --squash --delete-branch`;
1971
1993
  });
1972
1994
  let text3 = `Task "${task.title}" marked ${task.status}.
1973
1995
  File: ${task.taskFile}`;
1974
- if (mergeWarning) text3 += mergeWarning;
1996
+ if (mergeNote) text3 += mergeNote;
1997
+ let respawnNote = "";
1998
+ if (status2 === "closed" || status2 === "done") {
1999
+ try {
2000
+ const { getClient: getRespawnClient } = await import("./lib/database.js");
2001
+ const rClient = getRespawnClient();
2002
+ const assignee = task.assignedTo;
2003
+ if (assignee) {
2004
+ const remaining = await rClient.execute({
2005
+ sql: "SELECT COUNT(*) as cnt FROM tasks WHERE assigned_to = ? AND status IN ('open', 'in_progress')",
2006
+ args: [assignee]
2007
+ });
2008
+ const count = Number(remaining.rows[0]?.cnt ?? 0);
2009
+ if (count > 0) {
2010
+ try {
2011
+ const { isMultiInstance } = await import("./lib/employees.js");
2012
+ if (isMultiInstance(assignee)) {
2013
+ const { resolveExeSession: resolveExeSession2, employeeSessionName, ensureEmployee } = await import("./lib/tmux-routing.js");
2014
+ const exeSession = resolveExeSession2();
2015
+ if (exeSession) {
2016
+ const oldSession = employeeSessionName(assignee, exeSession);
2017
+ const { execSync } = await import("child_process");
2018
+ try {
2019
+ execSync(`tmux kill-session -t ${oldSession} 2>/dev/null`, { timeout: 3e3 });
2020
+ } catch {
2021
+ }
2022
+ const baseName = assignee.replace(/\d+$/, "") || assignee;
2023
+ try {
2024
+ execSync(`git worktree remove .worktrees/${baseName} --force 2>/dev/null`, { timeout: 5e3, cwd: baseDir });
2025
+ process.stderr.write(`[close-task] Pruned worktree .worktrees/${baseName}
2026
+ `);
2027
+ } catch {
2028
+ }
2029
+ const result4 = ensureEmployee(assignee, exeSession, baseDir, { autoInstance: true });
2030
+ respawnNote = `
2031
+
2032
+ \u{1F504} Auto-respawn: ${assignee} has ${count} more task(s). Killed old session, spawned ${result4.sessionName ?? "fresh instance"} with clean worktree.`;
2033
+ }
2034
+ }
2035
+ } catch {
2036
+ }
2037
+ }
2038
+ }
2039
+ } catch {
2040
+ }
2041
+ }
2042
+ if (respawnNote) text3 += respawnNote;
1975
2043
  if ((status2 === "done" || status2 === "closed") && task.nextTask) {
1976
2044
  text3 += `
1977
2045
 
@@ -2076,7 +2144,7 @@ function registerResumeEmployee(server) {
2076
2144
  };
2077
2145
  }
2078
2146
  try {
2079
- const { isTmuxSessionAlive } = await import("./tasks-crud-FPWY4RZ2.js");
2147
+ const { isTmuxSessionAlive } = await import("./tasks-crud-JHHIROCS.js");
2080
2148
  const now = (/* @__PURE__ */ new Date()).toISOString();
2081
2149
  for (const row of openTasks.rows) {
2082
2150
  const status2 = String(row.status);
@@ -2112,7 +2180,10 @@ function registerResumeEmployee(server) {
2112
2180
  const { ensureEmployee, resolveExeSession: resolveExeSession2 } = await import("./lib/tmux-routing.js");
2113
2181
  const exeSession = resolveExeSession2();
2114
2182
  if (!exeSession) throw new Error("No coordinator session found");
2115
- const result3 = ensureEmployee(agent_id, exeSession, process.cwd());
2183
+ const { isMultiInstance } = await import("./lib/employees.js");
2184
+ const result3 = ensureEmployee(agent_id, exeSession, process.cwd(), {
2185
+ autoInstance: isMultiInstance(agent_id)
2186
+ });
2116
2187
  switch (result3.status) {
2117
2188
  case "intercom_sent":
2118
2189
  dispatchStatus = `
@@ -2282,6 +2353,10 @@ function registerStoreBehavior(server) {
2282
2353
  };
2283
2354
  }
2284
2355
  } catch {
2356
+ return {
2357
+ content: [{ type: "text", text: `Authorization denied: unable to verify coordinator role for ${activeAgent.agentId}. Cross-agent behavior writes require roster validation.` }],
2358
+ isError: true
2359
+ };
2285
2360
  }
2286
2361
  }
2287
2362
  let resolvedProject;
@@ -2308,6 +2383,12 @@ function registerStoreBehavior(server) {
2308
2383
  }
2309
2384
  }
2310
2385
  } catch {
2386
+ if (agent_id && agent_id !== activeAgent.agentId) {
2387
+ return {
2388
+ content: [{ type: "text", text: `Unable to verify agent "${resolvedAgent}" \u2014 roster file unavailable. Cannot store cross-agent behavior without roster validation.` }],
2389
+ isError: true
2390
+ };
2391
+ }
2311
2392
  }
2312
2393
  const id = await storeBehavior({
2313
2394
  agentId: resolvedAgent,
@@ -5056,7 +5137,7 @@ async function getAgentSessionLoad() {
5056
5137
  return { sessions: [], totalLive: 0, busySessions: 0, idleSessions: 0 };
5057
5138
  }
5058
5139
  const { getClient: getClient2 } = await import("./lib/database.js");
5059
- const { sessionScopeFilter: sessionScopeFilter2 } = await import("./task-scope-EY3G5623.js");
5140
+ const { sessionScopeFilter: sessionScopeFilter2 } = await import("./task-scope-QNRAYD7S.js");
5060
5141
  const client = getClient2();
5061
5142
  const scope = sessionScopeFilter2();
5062
5143
  for (const s of liveAgentSessions) {
@@ -8060,6 +8141,20 @@ ${lines.join("\n")}`
8060
8141
  };
8061
8142
  }
8062
8143
  const resolvedAgent = agent_id ?? getActiveAgent().agentId;
8144
+ const isCrossAgentWrite = agent_id != null && agent_id !== getActiveAgent().agentId;
8145
+ if (isCrossAgentWrite) {
8146
+ const caller2 = getActiveAgent();
8147
+ const allowed2 = canCoordinate(caller2.agentId, caller2.agentRole);
8148
+ if (!allowed2) {
8149
+ return {
8150
+ content: [{
8151
+ type: "text",
8152
+ text: `Permission denied. Only the coordinator or founder sessions can store behaviors for other agents. You are "${caller2.agentId}".`
8153
+ }],
8154
+ isError: true
8155
+ };
8156
+ }
8157
+ }
8063
8158
  if (resolvedAgent && resolvedAgent !== "default") {
8064
8159
  try {
8065
8160
  const { loadEmployeesSync: loadEmployeesSync2 } = await import("./lib/employees.js");
@@ -8074,17 +8169,11 @@ ${lines.join("\n")}`
8074
8169
  };
8075
8170
  }
8076
8171
  } catch {
8077
- }
8078
- }
8079
- if (agent_id) {
8080
- const caller2 = getActiveAgent();
8081
- if (agent_id !== caller2.agentId) {
8082
- const allowed2 = canCoordinate(caller2.agentId, caller2.agentRole);
8083
- if (!allowed2) {
8172
+ if (isCrossAgentWrite) {
8084
8173
  return {
8085
8174
  content: [{
8086
8175
  type: "text",
8087
- text: `Permission denied. Only the coordinator or founder sessions can store behaviors for other agents. You are "${caller2.agentId}".`
8176
+ text: `Unable to verify agent "${resolvedAgent}" \u2014 roster file unavailable. Cannot store cross-agent behavior without roster validation.`
8088
8177
  }],
8089
8178
  isError: true
8090
8179
  };
@@ -9093,7 +9182,7 @@ function registerWorkflowTool(server) {
9093
9182
  getWorkflowInstance,
9094
9183
  listWorkflowInstances,
9095
9184
  approveWorkflowStep
9096
- } = await import("./workflow-engine-6QPTYDQI.js");
9185
+ } = await import("./workflow-engine-PK2TC7UE.js");
9097
9186
  try {
9098
9187
  switch (input.action) {
9099
9188
  case "create_workflow": {