Code map — people search
Shared
| Path | Responsibility |
|---|---|
libs/shared/src/lib/schemas/people-search.schema.ts | Min/max query length, group limit, match values, member/lead hit and result schemas |
libs/shared/src/lib/agent-schemas/read.ts | readPeopleSearchInputSchema ({ query }) |
libs/shared/src/lib/i18n/dictionaries/{en,he,ru}.json | agent.tools['read.people_search'], agent.summary.{similarName,archived,noPeople}; reuses members.roleOptions, members.statusOptions, leads.statusOptions |
API
| Path | Responsibility |
|---|---|
apps/api/src/people-search/people-search.service.ts | Staff gate, lead visibility via SalesWorkspaceAccessService, member and lead queries, embedding candidates with lexical fallback |
apps/api/src/people-search/people-search-query.ts | Pure: peopleSearchPlan, phoneSearchDigits, directPeopleQuery (the no-model lane), classifyMatch, rankHits |
apps/api/src/people-search/people-search.module.ts | Provides and exports the service; imported by ai/ai.module.ts |
apps/api/src/ai/agent/tools/leaves/read.tools.ts | read.people_search (quick action, quickAnswer: 'card'); read.search_anything’s member/lead scopes delegate to the service |
apps/api/src/ai/agent/agent.orchestrator.ts | tryQuickRoute: direct lane, flattened-args tolerance, card-only skip of summarizeQuickRoute, verbatim title |
apps/api/src/ai/agent/tools/tool.types.ts, decorators.ts | quickAnswer: 'prose' | 'card' tool metadata |
apps/api/src/ai/agent/compaction.service.ts | generateTitleIfMissing(..., { verbatim }) |
apps/api/src/ai/embeddings/person-name-embedding.service.ts | Existing multilingual name candidates (reused, unchanged) |
Web
| Path | Responsibility |
|---|---|
apps/web/src/components/agent/people-results.tsx | PeopleResults: the person rows, links, badges, empty state; closes the sheet on pick |
apps/web/src/components/agent/tool-call-card.tsx | ReadResultView renders PeopleResults for read.people_search |
Tests
| Path | Covers |
|---|---|
apps/api/src/people-search/people-search-query.unit.spec.ts | Phone digit reduction, the direct lane’s shapes, when embeddings are asked, match labels, ranking |
apps/api/src/people-search/people-search.int.spec.ts | Real SQL: org isolation, statuses and archived leads, removed members, full name, E.164 and legacy phones, email, embedding candidates and fallback, coach / own-scope Sales / member visibility |
apps/api/src/ai/agent/agent.orchestrator.usage.unit.spec.ts | Direct lane makes no model call and titles verbatim; same number later in a conversation goes to the router; card-only tool skips the answer call; flattened router args |
apps/web/src/components/agent/tool-call-card.int.spec.tsx | Person rows link to profile / lead sheet, badges, sheet closes, empty state |