Class SessionUiController
java.lang.Object
ai.mindconnect.adminui.ui.controller.SessionUiController
-
Constructor Summary
ConstructorsConstructorDescriptionSessionUiController(ai.mindconnect.agent.service.AgentSessionService sessionService, ai.mindconnect.agent.service.AgentChatService chatService, ai.mindconnect.agent.port.out.AgentDefinitionRepository agentRepository, ai.mindconnect.agent.port.out.AgentSessionRepository sessionRepository, ai.mindconnect.agent.tools.todo.TodoListService todoListService, ai.mindconnect.agent.tools.workspace.WorkspaceStore workspaceStore, ai.mindconnect.common.Namespace defaultNamespace, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ai.mindconnect.agent.port.out.LlmCallTraceRepository traceRepository, ActiveStreams activeStreams, SessionFileService sessionFiles, AdminLayoutFactory layoutFactory, ai.mindconnect.agent.service.approval.ToolApprovalStore approvalStore) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> approvalAnswered(UUID sessionId, String callId, boolean approved, String scope) The answer to ANY approval card.org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> attachDialog(UUID sessionId) The attach dialog the chat form's "+" opens: the drop-zone in a modal, patched over the untouched chat page.org.springframework.http.ResponseEntity<Void> cancelChat(UUID sessionId) Cooperatively cancels a running chat turn.org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.SseEmitter> chatStream(UUID sessionId, Map<String, Object> raw) org.springframework.http.ResponseEntity<?> clearTodos(UUID sessionId) Resets the session's todo list.org.springframework.http.ResponseEntity<?> compressMemory(UUID sessionId) Compresses unsummarized messages via the configured memory strategy and re-renders the working-memory page with the new (smaller) snapshot, so the operator immediately sees the effect of the compression — fewer tokens, freshly-marked(compressed)entries, etc.org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> deleteMessages(UUID sessionId, int fromSeq, int toSeq) Deletes a range of messages by sequenceNum (fromSeq..toSeqinclusive).org.springframework.http.ResponseEntity<byte[]> downloadWorkspaceFile(UUID sessionId, String scope, String name, boolean download) Streams a single workspace file back to the browser.org.springframework.http.ResponseEntity<?> Working-memory debug page.org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPage> getSession(UUID sessionId) org.springframework.http.ResponseEntity<?> Todo-list inspector page.org.springframework.http.ResponseEntity<?> Per-turn LLM call traces.org.springframework.http.ResponseEntity<?> getWorkspace(UUID sessionId, boolean dialog) Workspace browser page — three scopes (SESSION / AGENT_USER / USER) each with a file listing, sizes, and view/download links per file.org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.SseEmitter> regenerate(UUID sessionId, int seq) Regenerates the assistant response for a user message: deletes that message and everything after it, then re-runs the turn (streaming) with the same user text.org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPage> startSession(UUID agentId, org.springframework.security.oauth2.core.oidc.user.OidcUser user)
-
Constructor Details
-
SessionUiController
public SessionUiController(ai.mindconnect.agent.service.AgentSessionService sessionService, ai.mindconnect.agent.service.AgentChatService chatService, ai.mindconnect.agent.port.out.AgentDefinitionRepository agentRepository, ai.mindconnect.agent.port.out.AgentSessionRepository sessionRepository, ai.mindconnect.agent.tools.todo.TodoListService todoListService, ai.mindconnect.agent.tools.workspace.WorkspaceStore workspaceStore, ai.mindconnect.common.Namespace defaultNamespace, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ai.mindconnect.agent.port.out.LlmCallTraceRepository traceRepository, ActiveStreams activeStreams, SessionFileService sessionFiles, AdminLayoutFactory layoutFactory, ai.mindconnect.agent.service.approval.ToolApprovalStore approvalStore)
-
-
Method Details
-
startSession
@PostMapping("/agents/{agentId}/sessions") public org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPage> startSession(@PathVariable UUID agentId, @AuthenticationPrincipal org.springframework.security.oauth2.core.oidc.user.OidcUser user) -
attachDialog
@GetMapping("/sessions/{sessionId}/attach-dialog") public org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> attachDialog(@PathVariable UUID sessionId) The attach dialog the chat form's "+" opens: the drop-zone in a modal, patched over the untouched chat page. Uploads patch the page's chat-attachments panel behind the dialog, so the chips are current the moment it closes. -
getSession
@GetMapping("/sessions/{sessionId}") public org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPage> getSession(@PathVariable UUID sessionId) -
getMemory
@GetMapping("/sessions/{sessionId}/memory") public org.springframework.http.ResponseEntity<?> getMemory(@PathVariable UUID sessionId, @RequestParam(value="seq",required=false) Integer seq, @RequestParam(value="dialog",defaultValue="false") boolean dialog) Working-memory debug page. Withoutseq: full master-detail page with the system prompt pre-selected. Withseq: a UiPatch that replaces only the detail pane (clicked from the master list). -
compressMemory
@PostMapping("/sessions/{sessionId}/memory/compress") public org.springframework.http.ResponseEntity<?> compressMemory(@PathVariable UUID sessionId) Compresses unsummarized messages via the configured memory strategy and re-renders the working-memory page with the new (smaller) snapshot, so the operator immediately sees the effect of the compression — fewer tokens, freshly-marked(compressed)entries, etc. Returns a full UiPage so the front-end's existing data-action handler swaps the page in place. -
getTraces
@GetMapping("/sessions/{sessionId}/traces") public org.springframework.http.ResponseEntity<?> getTraces(@PathVariable UUID sessionId, @RequestParam(value="turnId",required=false) UUID turnId, @RequestParam(value="dialog",defaultValue="false") boolean dialog) Per-turn LLM call traces. WithoutturnId: full master-detail page (most recent turn pre-selected). WithturnId: a UiPatch that swaps only the detail pane to show that turn's roundtrips. -
getTodos
@GetMapping("/sessions/{sessionId}/todos") public org.springframework.http.ResponseEntity<?> getTodos(@PathVariable UUID sessionId, @RequestParam(value="dialog",defaultValue="false") boolean dialog) Todo-list inspector page. Shows the same checklist the LLM is being fed viatodo_list_mdin its prompt context. -
clearTodos
@DeleteMapping("/sessions/{sessionId}/todos") public org.springframework.http.ResponseEntity<?> clearTodos(@PathVariable UUID sessionId) Resets the session's todo list. Returns the re-rendered todos page so the operator sees the empty state immediately. -
getWorkspace
@GetMapping("/sessions/{sessionId}/workspace") public org.springframework.http.ResponseEntity<?> getWorkspace(@PathVariable UUID sessionId, @RequestParam(value="dialog",defaultValue="false") boolean dialog) Workspace browser page — three scopes (SESSION / AGENT_USER / USER) each with a file listing, sizes, and view/download links per file. -
downloadWorkspaceFile
@GetMapping("/sessions/{sessionId}/workspace/{scope}/file") public org.springframework.http.ResponseEntity<byte[]> downloadWorkspaceFile(@PathVariable UUID sessionId, @PathVariable String scope, @RequestParam("name") String name, @RequestParam(value="download",defaultValue="false") boolean download) Streams a single workspace file back to the browser.scopepicks the workspace (session/agent/user),nameis the filename. Withdownload=truethe response carries aContent-Disposition: attachmentso the browser downloads instead of rendering inline. -
chat
-
cancelChat
@DeleteMapping("/sessions/{sessionId}/chat") public org.springframework.http.ResponseEntity<Void> cancelChat(@PathVariable UUID sessionId) Cooperatively cancels a running chat turn. Returns 204 if a live turn was signalled, 404 if no chat is currently running. The stream completes via the normalDoneflow once the loop reaches its next cancel-check point. -
deleteMessages
@DeleteMapping("/sessions/{sessionId}/messages") public org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> deleteMessages(@PathVariable UUID sessionId, @RequestParam int fromSeq, @RequestParam int toSeq) Deletes a range of messages by sequenceNum (fromSeq..toSeqinclusive). The UI's "delete from here" button passestoSeq=Integer.MAX_VALUEto drop this message and everything after it. Returns a UI patch that refreshes the conversation list (with the updated header tokens) so the deleted items disappear. Sub-agent sessions spawned by the removed turns are not cleaned up. -
chatStream
-
approvalAnswered
@PostMapping("/sessions/{sessionId}/approval") public org.springframework.http.ResponseEntity<ai.mindconnect.ui.model.UiPatch> approvalAnswered(@PathVariable UUID sessionId, @RequestParam String callId, @RequestParam boolean approved, @RequestParam(defaultValue="once") String scope) The answer to ANY approval card. The callId is the whole identity — tool task, tool name and origin live in the ToolApprovalStore. No new stream: the turn never ended (it is suspended on the parked tool task) and its original stream carries the continuation; this delivers the decision and refreshes the list so the card disappears. A STALE card (no store entry any more) delivers nothing — the refresh alone drops it. -
regenerate
@PostMapping(value="/sessions/{sessionId}/messages/{seq}/regenerate", produces="text/event-stream") public org.springframework.http.ResponseEntity<org.springframework.web.servlet.mvc.method.annotation.SseEmitter> regenerate(@PathVariable UUID sessionId, @PathVariable int seq) Regenerates the assistant response for a user message: deletes that message and everything after it, then re-runs the turn (streaming) with the same user text. The new user message and reply are persisted fresh.Only meaningful on USER messages — the UI exposes the button there. Sub-agent sessions spawned by the discarded turns are intentionally left in place (not cleaned up).
-