fix: use directory-aware client for delete, rename, command, permissions, questions

- sessions.ts: deleteSession looks up session.directory and uses clientFor()
  instead of bare client, so cross-project deletes hit the right server path
- index.tsx: submitRename uses clientForDirectory(session.directory) so renames
  work for sessions not owned by the active project directory
- index.tsx: handleSwitchDirectory calls catalog.load() after a directory switch
  so agents/commands/providers refresh for the new project
- session/[id].tsx: introduce sessionClient (directory-aware) and use it in
  handlePermissionReply, handleQuestionReply, handleQuestionReject, slash-command
  send, and the refreshPending bootstrap call; also add 'directory' to useEffect deps
- catalog.ts: remove debug console.log
This commit is contained in:
Dzianis Vauchok
2026-05-26 08:22:56 +00:00
committed by Dennis V
parent ce598e2a52
commit 0ef3dd37b6
4 changed files with 30 additions and 26 deletions

View File

@@ -85,16 +85,6 @@ export const useCatalog = create<CatalogState>((set, get) => ({
.filter((p) => p.models.length > 0)
: []
console.log(
"[catalog] loaded:",
agents.length,
"agents,",
commands.length,
"commands,",
providers.length,
"providers (" + providers.reduce((n, p) => n + p.models.length, 0) + " models)",
)
// Filter out hidden agents
const visible = agents.filter((a) => !a.hidden)

View File

@@ -193,7 +193,8 @@ export const useSessions = create<SessionsState>((set, get) => ({
},
deleteSession: async (sessionID) => {
const client = useConnections.getState().client
const session = get().sessions.find((s) => s.id === sessionID)
const client = clientFor(session?.directory)
if (!client) {
set({ error: "No active connection" })
return