Class AtPathExpansionMiddleware
java.lang.Object
io.agentscope.harness.agent.middleware.AtPathExpansionMiddleware
- All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase,HarnessRuntimeMiddleware
Expands
@path references in user messages by reading the referenced files through the
active AbstractFilesystem and appending an <attached_file> block at the end of
the message. Mirrors the Claude Code CLI's @file input syntax.
Dispatch by filesystem type (kept as in-line instanceof since there is exactly one
call site):
- Local (
OverlayFilesystemwrappingLocalFilesystemWithShell) — attemptsfs.read; success triggers attachment, failure (typically because the path falls outside thePathPolicyallow-list) leaves the@pathtext untouched. - Sandbox (
AbstractSandboxFilesystem, not wrapped in overlay) — treats the reference as a path inside the sandbox; host-path upload is out of scope for this stage. - Remote (
CompositeFilesystem) — disabled. The agent is not co-located with the user so@pathhas no meaningful resolution; references are left as-is.
Recognises three reference shapes: absolute (@/abs/path), relative
(@./rel or @rel/foo), and home-anchored (@~/file). A bare @word
with no path-like character (slash, dot, tilde) is ignored to avoid swallowing handles such as
@alice.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>onAgent(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.AgentInput input, Function<io.agentscope.core.middleware.AgentInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.core.middleware.MiddlewareBase
onActing, onModelCall, onReasoning, onSystemPrompt, order
-
Constructor Details
-
AtPathExpansionMiddleware
-
-
Method Details
-
onAgent
public reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent> onAgent(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.AgentInput input, Function<io.agentscope.core.middleware.AgentInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next) - Specified by:
onAgentin interfaceio.agentscope.core.middleware.MiddlewareBase
-