diff --git a/AgentCompany-New/src/main/services/agent-run-loop.ts b/AgentCompany-New/src/main/services/agent-run-loop.ts
index d21fcff7..ee7d5e4e 100644
--- a/AgentCompany-New/src/main/services/agent-run-loop.ts
+++ b/AgentCompany-New/src/main/services/agent-run-loop.ts
@@ -1,6 +1,6 @@
import type { ProviderService } from "./provider-service";
import { AGENT_TOOLS, dispatchAgentTool, type AgentToolContext, type AgentToolDeps } from "./agent-tools";
-import { canonicalMentionHandle } from "./mention-handles";
+import { canonicalMentionHandle } from "../../shared/mention-handles";
import type { AgentTurnMessage } from "./provider-tool-turn";
const MAX_ITERATIONS = 12;
diff --git a/AgentCompany-New/src/main/services/agent-tools.ts b/AgentCompany-New/src/main/services/agent-tools.ts
index 866a06f0..75ed4f9d 100644
--- a/AgentCompany-New/src/main/services/agent-tools.ts
+++ b/AgentCompany-New/src/main/services/agent-tools.ts
@@ -6,7 +6,7 @@ import type { ChatService } from "./chat-service";
import { writeDeliverable } from "./deliverable-writer";
import { DocumentService } from "./document-service";
import { recordWorkspaceFile } from "./files/file-object-store";
-import { canonicalMentionHandle } from "./mention-handles";
+import { canonicalMentionHandle } from "../../shared/mention-handles";
import type { JsonRecord } from "./provider-http";
import type { ToolCall, ToolDefinition } from "./provider-tool-turn";
diff --git a/AgentCompany-New/src/main/services/chat-mentions.ts b/AgentCompany-New/src/main/services/chat-mentions.ts
index 066a3246..32934921 100644
--- a/AgentCompany-New/src/main/services/chat-mentions.ts
+++ b/AgentCompany-New/src/main/services/chat-mentions.ts
@@ -1,5 +1,5 @@
import type { DatabaseSync } from "node:sqlite";
-import { canonicalMentionHandle } from "./mention-handles";
+import { canonicalMentionHandle } from "../../shared/mention-handles";
export interface MentionTarget {
type: "employee" | "agent" | "board" | "org_group";
diff --git a/AgentCompany-New/src/main/services/organization-seed.ts b/AgentCompany-New/src/main/services/organization-seed.ts
index 74be85a6..ef94d7a1 100644
--- a/AgentCompany-New/src/main/services/organization-seed.ts
+++ b/AgentCompany-New/src/main/services/organization-seed.ts
@@ -8,7 +8,7 @@ import { IdentityAccessService } from "./identity-access-service";
import { OrgGovernanceService } from "./org-governance-service";
import { OperationsService } from "./operations-service";
import { SdlcService } from "./sdlc-service";
-import { assertUsableMentionName } from "./mention-handles";
+import { assertUsableMentionName } from "../../shared/mention-handles";
/**
* Seeds a brand-new organization in one transaction's worth of writes: the org
diff --git a/AgentCompany-New/src/main/services/organization-service.ts b/AgentCompany-New/src/main/services/organization-service.ts
index bec22ed9..2c41da14 100644
--- a/AgentCompany-New/src/main/services/organization-service.ts
+++ b/AgentCompany-New/src/main/services/organization-service.ts
@@ -7,7 +7,7 @@ import { ensureAgentHeartbeat, resolveGoalKickoff, type GoalKickoffPlan } from "
import { PolicyService } from "./policy-service";
import { IdentityAccessService } from "./identity-access-service";
import { OrgGovernanceService } from "./org-governance-service";
-import { assertUsableMentionName } from "./mention-handles";
+import { assertUsableMentionName } from "../../shared/mention-handles";
import { seedOrganization } from "./organization-seed";
export class OrganizationService {
diff --git a/AgentCompany-New/src/main/services/task-prompts.ts b/AgentCompany-New/src/main/services/task-prompts.ts
index 96ad27e9..60fa0325 100644
--- a/AgentCompany-New/src/main/services/task-prompts.ts
+++ b/AgentCompany-New/src/main/services/task-prompts.ts
@@ -1,4 +1,4 @@
-import { canonicalMentionHandle } from "./mention-handles";
+import { canonicalMentionHandle } from "../../shared/mention-handles";
export interface TaskExecutionTaskRow {
id: string;
diff --git a/AgentCompany-New/src/renderer/src/pages/chat/MentionTextarea.tsx b/AgentCompany-New/src/renderer/src/pages/chat/MentionTextarea.tsx
index f0f62e83..48cb87bd 100644
--- a/AgentCompany-New/src/renderer/src/pages/chat/MentionTextarea.tsx
+++ b/AgentCompany-New/src/renderer/src/pages/chat/MentionTextarea.tsx
@@ -1,17 +1,19 @@
import { useRef, useState, type MutableRefObject } from "react";
import { Avatar } from "../../shared/ui";
import type { AgentRecord, EmployeeRecord } from "../../../../shared/domain";
+import { canonicalMentionHandle } from "../../../../shared/mention-handles";
interface MentionCandidate {
handle: string;
+ displayName: string;
label: string;
bot: boolean;
}
function buildCandidates(agents: AgentRecord[], employees: EmployeeRecord[]): MentionCandidate[] {
return [
- ...agents.map((a) => ({ handle: a.name, label: `${a.name} · ${a.role}`, bot: true })),
- ...employees.map((e) => ({ handle: e.displayName, label: `${e.displayName} · ${e.role}`, bot: false })),
+ ...agents.map((a) => ({ handle: canonicalMentionHandle(a.name), displayName: a.name, label: `${a.name} · ${a.role}`, bot: true })),
+ ...employees.map((e) => ({ handle: canonicalMentionHandle(e.displayName), displayName: e.displayName, label: `${e.displayName} · ${e.role}`, bot: false })),
];
}
@@ -41,7 +43,10 @@ export function MentionTextarea({
const ref = textareaRef ?? innerRef;
const candidates = buildCandidates(agents, employees);
const filtered = query !== null
- ? candidates.filter((c) => c.handle.toLowerCase().includes(query.toLowerCase()))
+ ? candidates.filter((c) => {
+ const q = query.toLowerCase();
+ return c.handle.includes(q) || c.displayName.toLowerCase().includes(q);
+ })
: [];
const close = () => setQuery(null);
@@ -138,7 +143,7 @@ export function MentionTextarea({
textAlign: "left",
}}
>
-
+
{c.label}
))}
diff --git a/AgentCompany-New/src/main/services/mention-handles.ts b/AgentCompany-New/src/shared/mention-handles.ts
similarity index 100%
rename from AgentCompany-New/src/main/services/mention-handles.ts
rename to AgentCompany-New/src/shared/mention-handles.ts
diff --git a/AgentCompany-New/tests/integration/agent-reply.test.ts b/AgentCompany-New/tests/integration/agent-reply.test.ts
index 04e3cd22..467ed14a 100644
--- a/AgentCompany-New/tests/integration/agent-reply.test.ts
+++ b/AgentCompany-New/tests/integration/agent-reply.test.ts
@@ -9,7 +9,7 @@ import { providerAdapters } from "../../src/main/services/provider-adapters";
import { TaskExecutionService } from "../../src/main/services/task-execution-service";
import { SnapshotService } from "../../src/main/services/snapshot-service";
import { claimNextQueuedRun } from "../../src/main/app/task-queue-worker";
-import { canonicalMentionHandle } from "../../src/main/services/mention-handles";
+import { canonicalMentionHandle } from "../../src/shared/mention-handles";
import type { AgentTurnResult, ProviderToolTurnInput, ToolCall } from "../../src/main/services/provider-tool-turn";
const testVault = {
diff --git a/AgentCompany-New/tests/unit/agent-run-loop.test.ts b/AgentCompany-New/tests/unit/agent-run-loop.test.ts
index a38d7d68..42fd5493 100644
--- a/AgentCompany-New/tests/unit/agent-run-loop.test.ts
+++ b/AgentCompany-New/tests/unit/agent-run-loop.test.ts
@@ -7,7 +7,7 @@ import { DatabaseConnection } from "../../src/main/database/connection";
import { OrganizationService } from "../../src/main/services/organization-service";
import { ChatService } from "../../src/main/services/chat-service";
import { runAgentLoop } from "../../src/main/services/agent-run-loop";
-import { canonicalMentionHandle } from "../../src/main/services/mention-handles";
+import { canonicalMentionHandle } from "../../src/shared/mention-handles";
import type { AgentToolContext } from "../../src/main/services/agent-tools";
import type { AgentTurnResult, ToolCall } from "../../src/main/services/provider-tool-turn";