diff --git a/core/config/ProfileLifecycleManager.ts b/core/config/ProfileLifecycleManager.ts
index b7946ed7d..aca588a22 100644
--- a/core/config/ProfileLifecycleManager.ts
+++ b/core/config/ProfileLifecycleManager.ts
@@ -1,4 +1,5 @@
import {
+ AssistantUnrolled,
ConfigResult,
ConfigValidationError,
FullSlug,
@@ -22,6 +23,7 @@ export interface ProfileDescription {
iconUrl: string;
errors: ConfigValidationError[] | undefined;
uri: string;
+ unrolledAssistant?: AssistantUnrolled;
}
export interface OrganizationDescription {
diff --git a/core/config/profile/PlatformProfileLoader.ts b/core/config/profile/PlatformProfileLoader.ts
index 329a7a59e..4414b3d02 100644
--- a/core/config/profile/PlatformProfileLoader.ts
+++ b/core/config/profile/PlatformProfileLoader.ts
@@ -62,6 +62,7 @@ export default class PlatformProfileLoader implements IProfileLoader {
errors: configResult.errors,
iconUrl: iconUrl,
uri: `${controlPlaneEnv}${ownerSlug}/${packageSlug}`,
+ unrolledAssistant: configResult.config,
};
return new PlatformProfileLoader(
diff --git a/gui/package-lock.json b/gui/package-lock.json
index 583c83642..3c4822050 100644
--- a/gui/package-lock.json
+++ b/gui/package-lock.json
@@ -46,6 +46,7 @@
"react-switch": "^7.0.0",
"react-syntax-highlighter": "^15.5.0",
"react-tooltip": "^5.18.0",
+ "redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-persist-transform-filter": "^0.0.22",
"redux-thunk": "^3.1.0",
@@ -79,6 +80,7 @@
"@types/react-dom": "^18.3.1",
"@types/react-router-dom": "^5.3.3",
"@types/react-syntax-highlighter": "^15.5.7",
+ "@types/redux-logger": "^3.0.13",
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-v8": "^2.1.3",
@@ -3061,6 +3063,15 @@
"@types/react": "*"
}
},
+ "node_modules/@types/redux-logger": {
+ "version": "3.0.13",
+ "resolved": "https://registry.npmjs.org/@types/redux-logger/-/redux-logger-3.0.13.tgz",
+ "integrity": "sha512-jylqZXQfMxahkuPcO8J12AKSSCQngdEWQrw7UiLUJzMBcv1r4Qg77P6mjGLjM27e5gFQDPD8vwUMJ9AyVxFSsg==",
+ "dev": true,
+ "dependencies": {
+ "redux": "^5.0.0"
+ }
+ },
"node_modules/@types/responselike": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.3.tgz",
@@ -4532,6 +4543,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/deep-diff": {
+ "version": "0.3.8",
+ "resolved": "https://registry.npmjs.org/deep-diff/-/deep-diff-0.3.8.tgz",
+ "integrity": "sha512-yVn6RZmHiGnxRKR9sJb3iVV2XTF1Ghh2DiWRZ3dMnGc43yUdWWF/kX6lQyk3+P84iprfWKU/8zFTrlkvtFm1ug=="
+ },
"node_modules/deep-eql": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz",
@@ -10153,6 +10169,14 @@
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
},
+ "node_modules/redux-logger": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/redux-logger/-/redux-logger-3.0.6.tgz",
+ "integrity": "sha512-JoCIok7bg/XpqA1JqCqXFypuqBbQzGQySrhFzewB7ThcnysTO30l4VCst86AuB9T9tuT03MAA56Jw2PNhRSNCg==",
+ "dependencies": {
+ "deep-diff": "^0.3.5"
+ }
+ },
"node_modules/redux-persist": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/redux-persist/-/redux-persist-6.0.0.tgz",
diff --git a/gui/package.json b/gui/package.json
index 2a7987c24..2f0632e08 100644
--- a/gui/package.json
+++ b/gui/package.json
@@ -54,6 +54,7 @@
"react-switch": "^7.0.0",
"react-syntax-highlighter": "^15.5.0",
"react-tooltip": "^5.18.0",
+ "redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-persist-transform-filter": "^0.0.22",
"redux-thunk": "^3.1.0",
@@ -87,6 +88,7 @@
"@types/react-dom": "^18.3.1",
"@types/react-router-dom": "^5.3.3",
"@types/react-syntax-highlighter": "^15.5.7",
+ "@types/redux-logger": "^3.0.13",
"@types/styled-components": "^5.1.26",
"@vitejs/plugin-react-swc": "^3.7.0",
"@vitest/coverage-v8": "^2.1.3",
diff --git a/gui/src/context/Auth.tsx b/gui/src/context/Auth.tsx
index d4e6f7925..8ca1e5be0 100644
--- a/gui/src/context/Auth.tsx
+++ b/gui/src/context/Auth.tsx
@@ -14,6 +14,7 @@ import ConfirmationDialog from "../components/dialogs/ConfirmationDialog";
import { useWebviewListener } from "../hooks/useWebviewListener";
import { useAppDispatch, useAppSelector } from "../redux/hooks";
import { setLastControlServerBetaEnabledStatus } from "../redux/slices/miscSlice";
+import { selectSelectedProfile } from "../redux/slices/sessionSlice";
import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice";
import {
updateOrgsThunk,
@@ -60,9 +61,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
// Profiles
const profiles = useAppSelector((store) => store.session.availableProfiles);
- const selectedProfile = useAppSelector(
- (store) => store.session.selectedProfile,
- );
+ const selectedProfile = useAppSelector(selectSelectedProfile);
const login: AuthContextType["login"] = (useOnboarding: boolean) => {
return new Promise((resolve) => {
diff --git a/gui/src/pages/More/More.tsx b/gui/src/pages/More/More.tsx
index da4bf89d0..957810a74 100644
--- a/gui/src/pages/More/More.tsx
+++ b/gui/src/pages/More/More.tsx
@@ -15,6 +15,7 @@ import { saveCurrentSession } from "../../redux/thunks/session";
import IndexingProgress from "./IndexingProgress";
import KeyboardShortcuts from "./KeyboardShortcuts";
import MoreHelpRow from "./MoreHelpRow";
+import { RulesPreview } from "./RulesPreview";
function MorePage() {
useNavigationListener();
@@ -55,6 +56,10 @@ function MorePage() {
+
+
+
+
Help center
diff --git a/gui/src/pages/More/RulesPreview/index.tsx b/gui/src/pages/More/RulesPreview/index.tsx
new file mode 100644
index 000000000..3dee60423
--- /dev/null
+++ b/gui/src/pages/More/RulesPreview/index.tsx
@@ -0,0 +1,36 @@
+import { useAuth } from "../../../context/Auth";
+
+/**
+ * Displays a formatted preview of the AI assistant's rules in a code editor style
+ */
+export function RulesPreview() {
+ const { selectedProfile } = useAuth();
+ const rules = selectedProfile?.unrolledAssistant?.rules ?? [];
+
+ return (
+
+
+
rules
+
:
+
+ {rules.map((rule, index) => (
+
+ -
+
+ {rule}
+
+
+ ))}
+
+ {rules.length === 0 && (
+
+ # No rules defined
+
+ )}
+
+
+ );
+}
diff --git a/gui/src/pages/gui/StreamError.tsx b/gui/src/pages/gui/StreamError.tsx
index 7e372720c..c57f71422 100644
--- a/gui/src/pages/gui/StreamError.tsx
+++ b/gui/src/pages/gui/StreamError.tsx
@@ -9,6 +9,7 @@ import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { selectUseHub } from "../../redux/selectors";
import { selectDefaultModel } from "../../redux/slices/configSlice";
+import { selectSelectedProfile } from "../../redux/slices/sessionSlice";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { isLocalProfile } from "../../util";
import { providers } from "../AddNewModel/configs/providers";
@@ -21,9 +22,7 @@ const StreamErrorDialog = ({ error }: StreamErrorProps) => {
const ideMessenger = useContext(IdeMessengerContext);
const selectedModel = useAppSelector(selectDefaultModel);
const hubEnabled = useAppSelector(selectUseHub);
- const selectedProfile = useAppSelector(
- (store) => store.session.selectedProfile,
- );
+ const selectedProfile = useAppSelector(selectSelectedProfile);
const { session, refreshProfiles } = useAuth();
const handleRefreshProfiles = () => {
diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts
index be4d3aa77..b5feda046 100644
--- a/gui/src/redux/slices/sessionSlice.ts
+++ b/gui/src/redux/slices/sessionSlice.ts
@@ -47,7 +47,7 @@ type SessionState = {
id: string;
/** null indicates loading state */
availableProfiles: ProfileDescription[] | null;
- selectedProfile: ProfileDescription | null;
+ selectedProfileId: string | null;
organizations: OrganizationDescription[];
selectedOrganizationId: string | null;
streamAborter: AbortController;
@@ -88,7 +88,7 @@ const initialState: SessionState = {
isStreaming: false,
title: NEW_SESSION_TITLE,
id: uuidv4(),
- selectedProfile: null,
+ selectedProfileId: null,
availableProfiles: null,
organizations: [],
selectedOrganizationId: "",
@@ -328,7 +328,7 @@ export const sessionSlice = createSlice({
!(!lastMessage.toolCalls?.length && !lastMessage.content) &&
// And there's a difference in tool call presence
(lastMessage.toolCalls?.length ?? 0) !==
- (message.toolCalls?.length ?? 0))
+ (message.toolCalls?.length ?? 0))
) {
// Create a new message
const historyItem: ChatHistoryItemWithMessageId = {
@@ -473,9 +473,9 @@ export const sessionSlice = createSlice({
state.allSessionMetadata = state.allSessionMetadata.map((session) =>
session.sessionId === payload.sessionId
? {
- ...session,
- ...payload,
- }
+ ...session,
+ ...payload,
+ }
: session,
);
if (payload.title && payload.sessionId === state.id) {
@@ -510,8 +510,9 @@ export const sessionSlice = createSlice({
payload.rangeInFileWithContents.filepath,
);
- const lineNums = `(${payload.rangeInFileWithContents.range.start.line + 1
- }-${payload.rangeInFileWithContents.range.end.line + 1})`;
+ const lineNums = `(${
+ payload.rangeInFileWithContents.range.start.line + 1
+ }-${payload.rangeInFileWithContents.range.end.line + 1})`;
contextItems.push({
name: `${fileName} ${lineNums}`,
@@ -533,11 +534,8 @@ export const sessionSlice = createSlice({
},
// Important: these reducers don't handle selected profile/organization fallback logic
// That is done in thunks
- setSelectedProfile: (
- state,
- { payload }: PayloadAction
,
- ) => {
- state.selectedProfile = payload;
+ setSelectedProfile: (state, { payload }: PayloadAction) => {
+ state.selectedProfileId = payload;
},
setAvailableProfiles: (
state,
@@ -670,6 +668,15 @@ export const sessionSlice = createSlice({
selectIsInEditMode: (state) => {
return state.mode === "edit";
},
+ selectSelectedProfile: (state) => {
+ // state.session.availableProfiles.find((p) => p.id === newId) ?? null,
+
+ return (
+ state.availableProfiles?.find(
+ (profile) => profile.id === state.selectedProfileId,
+ ) ?? null
+ );
+ },
selectIsSingleRangeEditOrInsertion: (state) => {
if (state.mode !== "edit") {
return false;
@@ -696,9 +703,9 @@ function addPassthroughCases(
) {
thunks.forEach((thunk) => {
builder
- .addCase(thunk.fulfilled, (state, action) => { })
- .addCase(thunk.rejected, (state, action) => { })
- .addCase(thunk.pending, (state, action) => { });
+ .addCase(thunk.fulfilled, (state, action) => {})
+ .addCase(thunk.rejected, (state, action) => {})
+ .addCase(thunk.pending, (state, action) => {});
});
}
@@ -765,6 +772,7 @@ export const {
export const {
selectIsGatheringContext,
selectIsInEditMode,
+ selectSelectedProfile,
selectIsSingleRangeEditOrInsertion,
selectHasCodeToEdit,
} = sessionSlice.selectors;
diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts
index e77ca3ef9..b9843b9e4 100644
--- a/gui/src/redux/store.ts
+++ b/gui/src/redux/store.ts
@@ -1,4 +1,5 @@
import { combineReducers, configureStore } from "@reduxjs/toolkit";
+import { createLogger } from "redux-logger";
import {
createMigrate,
MigrationManifest,
@@ -14,8 +15,8 @@ import editModeStateReducer from "./slices/editModeState";
import indexingReducer from "./slices/indexingSlice";
import miscReducer from "./slices/miscSlice";
import sessionReducer from "./slices/sessionSlice";
-import uiReducer from "./slices/uiSlice";
import tabsReducer from "./slices/tabsSlice";
+import uiReducer from "./slices/uiSlice";
export interface ChatMessage {
role: "system" | "user" | "assistant";
@@ -75,11 +76,14 @@ const migrations: MigrationManifest = {
id: oldState?.state?.sessionId ?? "",
},
tabs: {
- tabs: [{
- id: Date.now().toString(36) + Math.random().toString(36).substring(2),
- title: "Chat 1",
- isActive: true
- }]
+ tabs: [
+ {
+ id:
+ Date.now().toString(36) + Math.random().toString(36).substring(2),
+ title: "Chat 1",
+ isActive: true,
+ },
+ ],
},
_persist: oldState?._persist,
};
@@ -101,6 +105,13 @@ const persistedReducer = persistReducer>(
);
export function setupStore() {
+ const logger = createLogger({
+ // Customize logger options if needed
+ collapsed: true, // Collapse console groups by default
+ timestamp: false, // Remove timestamps from log
+ diff: true, // Show diff between states
+ });
+
return configureStore({
// persistedReducer causes type errors with async thunks
reducer: persistedReducer as unknown as typeof rootReducer,
@@ -113,7 +124,7 @@ export function setupStore() {
ideMessenger: new IdeMessenger(),
},
},
- }),
+ }).concat(logger),
});
}
diff --git a/gui/src/redux/thunks/profileAndOrg.ts b/gui/src/redux/thunks/profileAndOrg.ts
index 82a9602c0..0b378db66 100644
--- a/gui/src/redux/thunks/profileAndOrg.ts
+++ b/gui/src/redux/thunks/profileAndOrg.ts
@@ -21,7 +21,7 @@ export const selectProfileThunk = createAsyncThunk<
return;
}
- const initialId = state.session.selectedProfile?.id;
+ const initialId = state.session.selectedProfileId;
let newId = id;
@@ -44,11 +44,7 @@ export const selectProfileThunk = createAsyncThunk<
// Only update if there's a change
if ((newId ?? null) !== (initialId ?? null)) {
- dispatch(
- setSelectedProfile(
- state.session.availableProfiles.find((p) => p.id === newId) ?? null,
- ),
- );
+ dispatch(setSelectedProfile(newId));
extra.ideMessenger.post("didChangeSelectedProfile", {
id: newId,
});
@@ -72,8 +68,8 @@ export const cycleProfile = createAsyncThunk(
return;
}
let nextId = profileIds[0];
- if (state.session.selectedProfile) {
- const curIndex = profileIds.indexOf(state.session.selectedProfile?.id);
+ if (state.session.selectedProfileId) {
+ const curIndex = profileIds.indexOf(state.session.selectedProfileId);
const nextIndex = (curIndex + 1) % profileIds.length;
nextId = profileIds[nextIndex];
}