Skip to Content
Living documentation — last reviewed 2026-05-28
FeaturesPeople SearchCode map — people search

Code map — people search

Shared

PathResponsibility
libs/shared/src/lib/schemas/people-search.schema.tsMin/max query length, group limit, match values, member/lead hit and result schemas
libs/shared/src/lib/agent-schemas/read.tsreadPeopleSearchInputSchema ({ query })
libs/shared/src/lib/i18n/dictionaries/{en,he,ru}.jsonagent.tools['read.people_search'], agent.summary.{similarName,archived,noPeople}; reuses members.roleOptions, members.statusOptions, leads.statusOptions

API

PathResponsibility
apps/api/src/people-search/people-search.service.tsStaff gate, lead visibility via SalesWorkspaceAccessService, member and lead queries, embedding candidates with lexical fallback
apps/api/src/people-search/people-search-query.tsPure: peopleSearchPlan, phoneSearchDigits, directPeopleQuery (the no-model lane), classifyMatch, rankHits
apps/api/src/people-search/people-search.module.tsProvides and exports the service; imported by ai/ai.module.ts
apps/api/src/ai/agent/tools/leaves/read.tools.tsread.people_search (quick action, quickAnswer: 'card'); read.search_anything’s member/lead scopes delegate to the service
apps/api/src/ai/agent/agent.orchestrator.tstryQuickRoute: direct lane, flattened-args tolerance, card-only skip of summarizeQuickRoute, verbatim title
apps/api/src/ai/agent/tools/tool.types.ts, decorators.tsquickAnswer: 'prose' | 'card' tool metadata
apps/api/src/ai/agent/compaction.service.tsgenerateTitleIfMissing(..., { verbatim })
apps/api/src/ai/embeddings/person-name-embedding.service.tsExisting multilingual name candidates (reused, unchanged)

Web

PathResponsibility
apps/web/src/components/agent/people-results.tsxPeopleResults: the person rows, links, badges, empty state; closes the sheet on pick
apps/web/src/components/agent/tool-call-card.tsxReadResultView renders PeopleResults for read.people_search

Tests

PathCovers
apps/api/src/people-search/people-search-query.unit.spec.tsPhone digit reduction, the direct lane’s shapes, when embeddings are asked, match labels, ranking
apps/api/src/people-search/people-search.int.spec.tsReal 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.tsDirect 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.tsxPerson rows link to profile / lead sheet, badges, sheet closes, empty state