Package io.agentscope.extensions.aistio
Class SessionBridge
java.lang.Object
io.agentscope.extensions.aistio.SessionBridge
- All Implemented Interfaces:
ContractProvider,AutoCloseable
The reporting engine that sits between a framework adapter and the aistio control plane.
It owns everything the adapter should not care about: sequence numbering, the Level-2 event durable event outbox, incremental context tracking, Level-1 aggregation, debounced Level-4 pushes, inventory, command dispatch from both channels, and the in-process contract server.
Bypass principle: every reporting path swallows its own failures. Nothing here may propagate into the agent's conversation path.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.agentscope.extensions.aistio.transport.ContractProvider
ContractProvider.BusyException, ContractProvider.NotFoundException, ContractProvider.UnauthorizedException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intContract level 3: discovery, sessions, and commands.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAborts the current turn without terminating the session.attach(Object target, FrameworkAdapter adapter) voidcancelSubagentTask(String sessionId, String taskId) Cancel a background subagent task.voidclose()voidvoiddescribeSession(String sessionId, String systemPrompt, List<ContextSnapshot.ToolInfo> tools, int maxTokens) Lets the adapter seed the tracker with data the event stream does not carry.voiddescribeSession(String sessionId, String systemPrompt, List<ContextSnapshot.ToolInfo> tools, int maxTokens, String model) Lets the adapter seed the tracker, including the model name when known.effectiveSystemPrompt(String sessionId) Last effective system prompt for the session, or empty.exportTranscript(String sessionId) Optional transcript export.intActual contract HTTP port, which matters when the configured port was 0.Returns the stable Catalog identity issued by the latest successful self-registration.info()voidonEvent(SessionEvent event) Adapter callback.voidEnter/exit plan mode.voidpostMessage(String sessionId, byte[] body) Inject a user message into the live session.sessionPhase(String sessionId) Current phase string for command success responses.sessions()sessionState(String sessionId) voidRecords whether a turn is in progress by drivingphase:activewhile busy,idlewhen the turn ends.voidsetContextUsedTokens(String sessionId, int usedTokens) Updates context-window occupancy used for Level-1contextPressure.voidsetEffectiveSystemPrompt(String sessionId, String prompt) Stores the last middleware-composed system prompt for a session.voidSets operational phase explicitly (e.g. compressing).start()subagentTasks(String sessionId) Background subagent tasks (not todolist).Session task inventory.void
-
Field Details
-
SDK_VERSION
- See Also:
-
CONTRACT_LEVEL
public static final int CONTRACT_LEVELContract level 3: discovery, sessions, and commands. Finer gating is by capability.- See Also:
-
-
Constructor Details
-
SessionBridge
-
-
Method Details
-
attach
-
getAdapter
-
getConfig
-
getRegisteredIdentity
Returns the stable Catalog identity issued by the latest successful self-registration. Applications can use the one-time credential from this value to persist their identity in an application-owned secret store. -
getContractPort
public int getContractPort()Actual contract HTTP port, which matters when the configured port was 0. -
start
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-
capabilities
-
onEvent
Adapter callback. Assigns a sequence number, updates the view, and triggers reports. -
describeSession
public void describeSession(String sessionId, String systemPrompt, List<ContextSnapshot.ToolInfo> tools, int maxTokens) Lets the adapter seed the tracker with data the event stream does not carry. -
describeSession
public void describeSession(String sessionId, String systemPrompt, List<ContextSnapshot.ToolInfo> tools, int maxTokens, String model) Lets the adapter seed the tracker, including the model name when known. -
setEffectiveSystemPrompt
Stores the last middleware-composed system prompt for a session. -
effectiveSystemPrompt
Last effective system prompt for the session, or empty. -
setBusy
Records whether a turn is in progress by drivingphase:activewhile busy,idlewhen the turn ends.busyon Level-1 responses is derived from phase. -
setPhase
Sets operational phase explicitly (e.g. compressing). -
setContextUsedTokens
Updates context-window occupancy used for Level-1contextPressure. -
info
- Specified by:
infoin interfaceContractProvider
-
sessions
- Specified by:
sessionsin interfaceContractProvider
-
sessionState
- Specified by:
sessionStatein interfaceContractProvider
-
context
- Specified by:
contextin interfaceContractProvider
-
messages
- Specified by:
messagesin interfaceContractProvider
-
subagents
- Specified by:
subagentsin interfaceContractProvider
-
workspaces
- Specified by:
workspacesin interfaceContractProvider
-
compress
- Specified by:
compressin interfaceContractProvider
-
terminate
- Specified by:
terminatein interfaceContractProvider
-
abort
Description copied from interface:ContractProviderAborts the current turn without terminating the session. Capability:session-abort.- Specified by:
abortin interfaceContractProvider
-
tasks
Description copied from interface:ContractProviderSession task inventory. Capability:task-query. Returns a map with ataskslist.- Specified by:
tasksin interfaceContractProvider
-
subagentTasks
Description copied from interface:ContractProviderBackground subagent tasks (not todolist). Capability:subagent-task-query.- Specified by:
subagentTasksin interfaceContractProvider
-
cancelSubagentTask
Description copied from interface:ContractProviderCancel a background subagent task. Capability:subagent-task-command.- Specified by:
cancelSubagentTaskin interfaceContractProvider
-
planMode
Description copied from interface:ContractProviderEnter/exit plan mode. Body is JSON{"active":true|false}. Capability:plan-mode.- Specified by:
planModein interfaceContractProvider
-
postMessage
Description copied from interface:ContractProviderInject a user message into the live session. Body is JSON{"content":"..."}. Busy sessions should throwContractProvider.BusyException.- Specified by:
postMessagein interfaceContractProvider
-
exportTranscript
Description copied from interface:ContractProviderOptional transcript export. Capability:export-transcript.- Specified by:
exportTranscriptin interfaceContractProvider
-
sessionPhase
Description copied from interface:ContractProviderCurrent phase string for command success responses.- Specified by:
sessionPhasein interfaceContractProvider
-