Skip to content

chore(compass-assistant): make compass-assistant a real store COMPASS-10571#7987

Open
lerouxb wants to merge 3 commits intomainfrom
assistant-store
Open

chore(compass-assistant): make compass-assistant a real store COMPASS-10571#7987
lerouxb wants to merge 3 commits intomainfrom
assistant-store

Conversation

@lerouxb
Copy link
Copy Markdown
Member

@lerouxb lerouxb commented Apr 16, 2026

COMPASS-10571

This is just a step. There's discussion around whether or not to move messages into the store and then remove access to chat from elsewhere.

Copilot AI review requested due to automatic review settings April 16, 2026 10:45
preferences: PreferencesAccess;
logger: Logger;
track: TrackFunction;
lastContextPromptRef: { current: string | null };
Copy link
Copy Markdown
Member Author

@lerouxb lerouxb Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erm.. wondering about this lastContextPromptRef "ref"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is technically not used in a react component or similar.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref is just a name for an object that can keep a reference to a value without necessarily being relevant for actual state updates that need to be tracked, not necessarily a react concept (even if the name got popularised there). Can rename it to a Box or something, but we're already using ref in other places 🙂

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Makes compass-assistant use a “real” Redux store during plugin activation so runtime services aren’t pulled directly from React rendering context.

Changes:

  • Replaces the previous “fake store” object with a Redux store + redux-thunk extra-args for assistant services.
  • Refactors assistant send/entry-point logic into thunk actions that consume services via thunk extra args.
  • Adds Redux-related dependencies to packages/compass-assistant.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/compass-assistant/src/compass-assistant-provider.tsx Introduces Redux store activation and thunk-based assistant actions, wiring provider via react-redux.
packages/compass-assistant/package.json Adds react-redux, redux, and redux-thunk dependencies needed for the new store approach.
package-lock.json Updates lockfile for the new dependencies.

Comment thread packages/compass-assistant/src/compass-assistant-provider.tsx Outdated
@lerouxb lerouxb marked this pull request as ready for review April 16, 2026 11:35
@lerouxb lerouxb requested a review from a team as a code owner April 16, 2026 11:35
@lerouxb lerouxb requested a review from mabaasit April 16, 2026 11:35
preferences: PreferencesAccess;
logger: Logger;
track: TrackFunction;
lastContextPromptRef: { current: string | null };
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref is just a name for an object that can keep a reference to a value without necessarily being relevant for actual state updates that need to be tracked, not necessarily a react concept (even if the name got popularised there). Can rename it to a Box or something, but we're already using ref in other places 🙂

Comment thread packages/compass-assistant/src/compass-assistant-provider.tsx Outdated
}) => {
// chat is stable — created once in activate, never changes
const [chat] = React.useState(() => thunkDispatch(getChat()));
const [chat] = React.useState(() => getChatAction());
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This I imagine we'd be removing in a follow-up.

)
);

return { store, deactivate: cleanup };
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to addCleanup to chat.stop() the chat on deactivate? Not sure if there are any in progress requests we might want to abort or something like that. Not a blocker.

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.

4 participants