Files
BrowserOS/packages/browseros-agent/apps/agent/entrypoints/sidepanel/layout/ChatSessionContext.tsx
Dani Akash 2a6848bc1d feat: improved system prompt (#466)
* feat: added ai-sdk dev tools

* feat: new system prompt section

* feat: tests to maintain prompt integrity

* feat: update mcp sync to use react query

* fix: refetch logic for sync

* chore: remove limits on fetching integrations

* fix: refetch integrations on delete

* fix: review comment

* chore: update tests

* fix: improved memory classification

* fix: lint issues

* fix: core memory prompts

* fix: handle scenario where soul file is empty
2026-03-17 19:01:10 +05:30

36 lines
1010 B
TypeScript

import { createContext, type FC, type ReactNode, useContext } from 'react'
import { useSyncRemoteIntegrations } from '@/lib/mcp/useSyncRemoteIntegrations'
import {
type ChatSessionOptions,
useChatSession,
} from '../index/useChatSession'
type ChatSessionContextValue = ReturnType<typeof useChatSession>
const ChatSessionContext = createContext<ChatSessionContextValue | null>(null)
export const ChatSessionProvider: FC<
{ children: ReactNode } & ChatSessionOptions
> = ({ children, ...options }) => {
const { hasSynced } = useSyncRemoteIntegrations()
const session = useChatSession({
...options,
isIntegrationsSynced: hasSynced,
})
return (
<ChatSessionContext.Provider value={session}>
{children}
</ChatSessionContext.Provider>
)
}
export const useChatSessionContext = () => {
const context = useContext(ChatSessionContext)
if (!context) {
throw new Error(
'useChatSessionContext must be used within a ChatSessionProvider',
)
}
return context
}