Class SessionOperations
java.lang.Object
io.agentscope.spring.boot.admin.service.SessionOperations
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().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOutcome of an undo/redo invocation. -
Constructor Summary
ConstructorsConstructorDescriptionSessionOperations(AgentRegistry registry, SummarizationStrategy summarizer, AdminProperties properties, SnapshotStore snapshots) -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>Cooperatively interrupt the agent.reactor.core.publisher.Mono<CompactResponse>compact(String agentIdOrSessionId, CompactRequest request) Compact a session: summarize the older portion of the context, truncate to the lastkeepLastmessages, and persist via the agent'sAgentStateStore.reactor.core.publisher.Mono<String>dumpStateJson(String agentIdOrSessionId) Dump the fullAgentStateJSON for a session.reactor.core.publisher.Mono<PlanModeView>enterPlanMode(String agentIdOrSessionId) Switch the agent into plan mode.reactor.core.publisher.Mono<PlanModeView>exitPlanMode(String agentIdOrSessionId) Exit plan mode.reactor.core.publisher.Mono<String>exportMarkdown(String agentIdOrSessionId) Render the conversation as a Markdown transcript.reactor.core.publisher.Mono<List<AgentTaskView>>listAgentTasks(String agentIdOrSessionId) List the per-AgentStatetask records of a session.reactor.core.publisher.Mono<List<MessageView>>listMessages(String agentIdOrSessionId) Return the in-memory message list of a registered agent.listSessions(io.agentscope.core.state.AgentStateStore stateStore) Read-only listing of known session ids fromAgentStateStore.listSessionIds(String).reactor.core.publisher.Mono<PlanModeView>Read the current plan-mode state of a session.reactor.core.publisher.Mono<SessionOperations.UndoResult>Reverse a previousundo(String).reactor.core.publisher.Mono<SessionOperations.UndoResult>Restore the agent's state to the snapshot stored before the most recent mutation.
-
Constructor Details
-
SessionOperations
public SessionOperations(AgentRegistry registry, SummarizationStrategy summarizer, AdminProperties properties, SnapshotStore snapshots)
-
-
Method Details
-
listSessions
public reactor.core.publisher.Mono<List<String>> listSessions(io.agentscope.core.state.AgentStateStore stateStore) Read-only listing of known session ids fromAgentStateStore.listSessionIds(String). -
listMessages
Return the in-memory message list of a registered agent. -
exportMarkdown
Render the conversation as a Markdown transcript. -
dumpStateJson
Dump the fullAgentStateJSON for a session. -
abort
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 lastkeepLastmessages, and persist via the agent'sAgentStateStore.Returns metrics describing the change. Falls back gracefully when summarization fails — the prior summary is preserved and the context is left untouched.
-
undo
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
Reverse a previousundo(String). -
planState
Read the current plan-mode state of a session. -
enterPlanMode
Switch the agent into plan mode. Only supported onHarnessAgent— thePlanModeManagerthat 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
Exit plan mode. SeeenterPlanMode(String)for the HarnessAgent-only restriction. -
listAgentTasks
List the per-AgentStatetask records of a session.
-