Skip to content

Comments

Merg#415

Merged
serefyarar merged 79 commits intomainfrom
dev
Feb 18, 2026
Merged

Merg#415
serefyarar merged 79 commits intomainfrom
dev

Conversation

@serefyarar
Copy link
Contributor

No description provided.

yanekyuk and others added 30 commits February 16, 2026 18:07
- Extend ResolvedToolContext with user, userProfile, userIndexes, scopedIndex, scopedMembershipRole
- Add resolveChatContext() to preload user identity, profile, memberships, and scoped index role
- Enforce index scope: throw ChatContextAccessError when indexId is set and user is not a member
- Export ChatContextAccessError for controller HTTP mapping (404/403)
- ChatAgent.create() uses resolveChatContext() and passes result to createChatTools
- createChatTools() accepts optional preResolvedContext to avoid duplicate DB fetches
- Agent and tools now share identical ResolvedToolContext for system prompt and handlers
- Inject Current User, Profile, Index Memberships, and Scoped Index as JSON in system prompt
- Add Preloaded Context Policy: answer from preload first, do not call tools for already-present data
- Prefer preloaded memberships for 'communities I belong to' questions; use tools only when missing or user asks to refresh
- Narration: one tool at a time (only when needed)
… non-members

- Add ChatSessionService.validateIndexScope(userId, indexId) for existence and membership
- messageStream: validate requested indexId and effective (session) indexId before opening SSE
- Return 404 when index not found, 403 when user is not a member of scoped index
- Add tool.helpers.spec: resolveChatContext preload, owner/member role, non-member throws 403
- chat.controller.spec: messageStream returns 403 when scoped index is not a member index (use ChatDatabaseAdapter for createIndex)
- chat.tools.spec: mock getIndex returns id/title so resolver does not fail
- Chat graph specs: mock getUser (minimal user), getIndex (id/title), isIndexMember true so context resolution succeeds
Trigger background profile sync from /auth/me only when users have a name, at least one social link, and no existing profile.
Add /auth/me tests for trigger and no-trigger cases to ensure profile sync runs only for eligible users without an existing profile.
- Commons, Vault (general); Stack, Latent, Pixel, Launch (category)
- Atelier, Arena, Syllabus, Reps, Tribe, Bench (lifestyle)
- Update references in chat spec, opportunity test, docs, prompt, interface
On insert failure, look up by email then by privyId; throw with clear
message if no existing user found. Prevents personaUsers[i].id crash.
Strip embedding when building ResolvedToolContext in resolveChatContext
so prompts and in-memory context stay lean. Introduce ProfileContext
type (Omit<ProfileDocument, 'embedding'> | null) and assign sanitized
profile after getProfile().
…when membership missing

- Add getIndexMembership(indexId, userId) to Database and ChatGraphCompositeDatabase
- Implement getIndexMembership in ChatDatabaseAdapter (single membership by index+user)
- In resolveChatContext, when userIndexes.find(...) is undefined after isIndexMember
  check, fetch membership via getIndexMembership so scopedIndex.prompt is not lost
  (e.g. when getIndexMemberships returned [] or list was stale)
…at.tools.spec fixes

- tool.helpers.spec: add getIndexMembership to context mock and test that prompt
  is set from getIndexMembership when userIndexes is empty but user is member
- chat.tools.spec: add getIndexMembership to mock; expect read_index_memberships
  instead of read_users; fix getUser mock for intent userId test; add isIndexMember
  where context has indexId; align read_intents tests with current API (no
  allUserIntents/allMemberIntents in schema); use update_opportunity with
  status pending instead of send_opportunity; relax scrape_url and
  update_intent/delete_intent assertions to match current behavior
…g tests

- Extend intent graph mock to accept targetIntentIds and enforce index
  scoping for update/delete when indexId is set
- Assert success false and error for intent not in index
- Add tests for intent in index asserting success and data shape
…atContext

Replace IIFE with destructuring in conditional block
…ejection assertion

- Replace try/catch + expect(true).toBe(false) with .catch() and assert on error
- Add test for getUser returns null (USER_NOT_FOUND, 404)
- Add test for getIndex returns null with indexId (INDEX_NOT_FOUND, 404)
Add onboarding and lastWeeklyEmailSentAt to mock so it matches
UserWithGraph and fixes tsc build.
feat(protocol): preload chat identity context (user, profile, indexes) and validate index scope
Refresh prompt and fallback wording to reduce repetitive internal jargon, avoid labeling intents as goals, and diversify connection language for more natural user-facing responses.
Clarify presenter instructions so introduced-party summaries focus on mutual fit while the introducer context stays in narrator messaging.
Update chat and opportunity presenter prompt rules to prefer first names in user-facing copy and avoid repetitive full-name usage unless disambiguation is needed.
Drop ChatGraphDatabase, OpportunityMaintenanceDatabase,
IntentExecutorDatabase, and IndexOwnershipDatabase. Call sites use
ChatGraphCompositeDatabase and full Database or other narrowed types.
…dapter

Make ChatSession, ChatMessage, CreateSessionInput, CreateMessageInput,
UserWithGraph, NewsletterUserData, BasicUserInfo, FileRow, FileMetadata,
and FileListResult non-exported; they are only used within the adapter.
…Index

- Add UserDatabase (own resources only, not index-scoped) and SystemDatabase (index-scoped cross-user) interfaces
- Add removeMemberFromIndex to Database and SystemDatabase for index owners to remove members
- Implement in database adapter and expose via createUserDatabase/createSystemDatabase factories
- Filter indexes context to active index when chat is index-scoped
- Add instructions for LLM to use _scopeRestriction metadata when informing user about scope limits
…h intentId and indexId

- When both params provided, check single link via isIntentAssignedToIndex instead of returning all indexes
- Prevents scope leak where scoped chat could receive all indexes an intent is linked to
- removeMemberNode calls database.removeMemberFromIndex for owner-initiated removal
- Handle self-removal disallowed, wasOwner, notMember results
- read_indexes: hardcode showAll false, add _scopeRestriction when scoped
- read_index_memberships: strict scope, no crossScope; scope checks for update/delete/create index and delete_index_membership
- intent tools: scope checks for update/delete intent, read_intent_indexes defaults indexId when scoped and requires indexId when unscoped
- opportunity/profile tools: membership and scope checks for cross-user operations
- Add ToolContext.indexId/indexName and delete_index_membership tool
- Update test to expect scope enforced when context.indexId set; showAll no longer bypasses
- Show session-scoped index in chat header (badge with Lock/Globe and title)
- Show index title on sidebar conversation items when session has indexId
- AIChatContext: sessionIndexId and selectedIndexId for scope display; ClientWrapper passes indexId in session
yanekyuk and others added 28 commits February 17, 2026 16:09
Use test.skipIf(!HAS_OPENROUTER_KEY) so CI runs without OPENROUTER_API_KEY
without failing; empty-messages test still runs.
feat(chat): context-aware suggestion chips from chat done event
- Add LangGraph patterns summary with graph/state file structure
- Add Bun test standards with timeout guidelines
- Add file naming convention table with purpose types
- Add import ordering rules
- Add Git workflow section (conventional commits, branches, PRs)
- Add fix-migrations script documentation
- Update test framework from Vitest to bun test
- Update ChatAgent to include opportunity details in response via OpportunityPresenter
- Enhanced chat prompt to guide LLM in including opportunity blocks
- Modified chat streamer to handle and emit subgraph results for opportunities
- Added support for fetching and presenting opportunity details in chat flow
- Created OpportunityCardInChat component for inline display
- Updated ChatContent to parse ```opportunity blocks and render cards
- Added skeleton loading state for opportunities during streaming
- Enhanced AIChatContext to persist and retrieve opportunity data from session history
…rd render

- list_opportunities: use minimal card data (no LLM presenter), only counterpart name/avatar and optional introducer name
- create_opportunities discovery: add minimalForChat to skip presenter and return static labels
- create_opportunities introduction: return ```opportunity block with full card shape and truncate mainText so frontend renders card and JSON stays valid
… prompt

- Add analysis doc for create_intent/read_intents scope mismatch
- In prompt: note that index-scoped read_intents shows only this community
- In prompt: state create_intent still uses all user intents for dedup/update
- Instruct model not to infer 'fresh slate' or 'no similar priorities' from empty read_intents
- ChatContent: stable opportunity IDs (useMemo + key), debounce 200ms, Promise.allSettled for status fetches; rename homeActionLoadingByOpportunity to opportunityActionLoading
- OpportunityCardInChat: cross-reference comment for OpportunityCardPayload; try/catch in action handlers
- chat.controller: reuse session for effectiveIndexId, remove redundant getSession; createDoneEvent options object
- chat.agent: extractTextFromChunk helper; prefer tool summary in heuristic
- opportunity.presenter: narratorRemark .max(80), remove duplicate prompt line, drop invoke cast; use detection.createdByName
- opportunity.discover: set presenterContexts in minimal path from detection.createdByName; remove /i from regexes
- opportunity.tools: guard empty introducedPartyUserIds; compact JSON; buildMinimalOpportunityCard uses truncateForCardText; batch getProfile/getUser in list_opportunities; use detection.createdByName
- database.schema: add createdByName to OpportunityDetection
- chat-streaming.types: createDoneEvent(sessionId, response, options?)
- Add actionError state; on primary action failure show error + retry instead of dismissed
- Remove 'draft' from ACTIONABLE_STATUSES to match DB enum (latent, pending)
…ence JSON

- Compute introducedPartyUserIds and return error before createOpportunity
- Add sanitizeJsonForCodeFence to escape backticks in opportunity blocks (create, list, discover)
- Batch-fetch user avatars via database.getUser for discovery results
- Introduce MinimalPresenterContext for minimal path; keep full type in presenter branch
…unk types

- Prefer parsed.summary ?? 'Done' for tool activity; remove deep shape checks
- Use type predicate in extractTextFromChunk for ContentBlock | Text
…tern

- Mock database must implement getUser for avatar batch in runDiscoverFromQuery
- Accept 'member of' in read_intents error matcher for intent tool message
… status

- Add role=link, tabIndex, onKeyDown, aria-label to profile and narrator chip
- Only set dismissed state after successful onSecondaryAction; use setActionError in catch
- Remove unused getStatusMessage case for 'connected'
…red constant

- Use 'Connection with' headline in create_opportunities to match buildMinimalOpportunityCard
- effectiveIndexId fallback null -> undefined in create_opportunities
- Reuse introducedPartyUserIds instead of requiredPartyUserIds
- Dedupe allUserIds in list_opportunities with Set
- Add opportunity.constants.ts with MINIMAL_MAIN_TEXT_MAX_CHARS; use in tools and discover
Show Accept/Skip for viewed opportunities so the card is no longer in a
limbo state; aligns with backend opportunity.utils semantics.
Extend candidateUserIds with introducer userIds from opportunity.actors
and set narratorChip.avatar so introducer avatars render in discovery results.
…portunity tools

- Fetch counterpart user for introduction card and set cardData.avatar
  (same source as list_opportunities)
- Remove OpportunityPresenter instantiation and omit presenter and
  useHomeCardFormat from runDiscoverFromQuery when using minimalForChat
Set logOutput: false in withCallLogging so DiscoverResult.opportunities
(name, bio, userId, matchReason, homeCardPresentation, narratorChip) are
not written to logs. Inputs, context, and duration still logged.
… cards

Add introducerAvatar param to buildMinimalOpportunityCard and set
narratorChip.avatar when introducer exists. list_opportunities passes
avatar from userMap so cards show introducer avatar like discover path.
…n-chat

feat(chat): render opportunity cards in message stream
Rename the About page from /app/pages/about to /app/about and update internal links to use the cleaner /about path. Also pass hideFeedback to ClientLayout in the About page to hide the feedback widget. Update Header and Footer to link to /about instead of /pages/about.
Introduce a user feedback system across frontend and evaluator backend: add DB migration and schema for user_feedback, implement feedback API routes (POST/GET) and a retry endpoint to replay conversations via the chat client, and add middleware to set CORS headers for API routes. Update the evaluator app to include a Feedback tab with list/detail view, retry action, and UI components; update the frontend feedback widget to submit sessionId and recent conversation to the evaluator. Also update drizzle migration journal metadata.
Remove the userId WHERE clause in the feedback GET handler so feedback entries are returned without filtering by user. Simplify the CORS middleware by replacing the origin whitelist and origin detection with a single corsHeaders() that sets Access-Control-Allow-Origin to "*", and update OPTIONS and response handling to use the new function. This makes CORS handling simpler and allows requests from any origin (note: broader exposure).
Add a ConversationView and AssistantContent to render messages using react-markdown + remark-gfm and to inline OpportunityCard blocks (new components/OpportunityCard.tsx and parsing logic). Replace previous plain message boxes with the new ConversationView in FeedbackTab and scenario views. Add chat-markdown styles to globals.css and add react-markdown/remark-gfm to package.json. Also relax the feedback retry API query to look up entries by id only (removed the userId constraint).
@serefyarar serefyarar merged commit fd5c6da into main Feb 18, 2026
3 of 4 checks passed
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants