Class SessionOperations

java.lang.Object
io.agentscope.spring.boot.admin.service.SessionOperations

public final class SessionOperations extends Object
Business logic for the per-session data-plane admin actions.

Designed so that the REST controller is a thin shell: it parses the request, defers to one method here, and serializes the result. All blocking I/O (AgentStateStore reads, JSON serialization) is pushed off the request thread via Schedulers.boundedElastic().

  • Constructor Details

  • Method Details

    • listSessions

      public reactor.core.publisher.Mono<List<String>> listSessions(io.agentscope.core.state.AgentStateStore stateStore)
      Read-only listing of known session ids from AgentStateStore.listSessionIds(String).
    • listMessages

      public reactor.core.publisher.Mono<List<MessageView>> listMessages(String agentIdOrSessionId)
      Return the in-memory message list of a registered agent.
    • exportMarkdown

      public reactor.core.publisher.Mono<String> exportMarkdown(String agentIdOrSessionId)
      Render the conversation as a Markdown transcript.
    • dumpStateJson

      public reactor.core.publisher.Mono<String> dumpStateJson(String agentIdOrSessionId)
      Dump the full AgentState JSON for a session.
    • abort

      public reactor.core.publisher.Mono<Void> abort(String agentIdOrSessionId)
      Cooperatively interrupt the agent.
    • compact

      public reactor.core.publisher.Mono<CompactResponse> compact(String agentIdOrSessionId, CompactRequest request)
      Compact a session: summarize the older portion of the context, truncate to the last keepLast messages, and persist via the agent's AgentStateStore.

      Returns metrics describing the change. Falls back gracefully when summarization fails — the prior summary is preserved and the context is left untouched.

    • undo

      public reactor.core.publisher.Mono<SessionOperations.UndoResult> undo(String agentIdOrSessionId)
      Restore the agent's state to the snapshot stored before the most recent mutation. Returns empty (not an error) if there is no undo history.
    • redo

      public reactor.core.publisher.Mono<SessionOperations.UndoResult> redo(String agentIdOrSessionId)
      Reverse a previous undo(String).
    • planState

      public reactor.core.publisher.Mono<PlanModeView> planState(String agentIdOrSessionId)
      Read the current plan-mode state of a session.
    • enterPlanMode

      public reactor.core.publisher.Mono<PlanModeView> enterPlanMode(String agentIdOrSessionId)
      Switch the agent into plan mode. Only supported on HarnessAgent — the PlanModeManager that enforces read-only behavior is configured by HarnessAgent.Builder, and flipping the AgentState flag on a bare ReActAgent would silently bypass the enforcement chain.
    • exitPlanMode

      public reactor.core.publisher.Mono<PlanModeView> exitPlanMode(String agentIdOrSessionId)
      Exit plan mode. See enterPlanMode(String) for the HarnessAgent-only restriction.
    • listAgentTasks

      public reactor.core.publisher.Mono<List<AgentTaskView>> listAgentTasks(String agentIdOrSessionId)
      List the per-AgentState task records of a session.