feat: inbound tasks run through the DSH agent loop (tools, memory, auth) - #1
Merged
Merged
Conversation
Add `createDshAgentExecutor`: when an agent-loop factory is present, inbound
tasks run through this harness's own agent session instead of being refused.
- One session per A2A `contextId` (create-or-resume, reused across tasks so
history accumulates; per-context serialized, distinct contexts parallel).
- Mount the deployment's agent preset in the create `setup` hook so the
spawned agent actually gets tools/persona/skills (without it the agent
publishes against the empty global layer and can't run bash/fs).
- Seed the model per task from `ctx.agentDefaultModel` so the persona prompt's
`{{model}}` variable resolves (otherwise the turn errors before any output).
- Name each session `A2A: <first prompt summary>` via `ctx.sessionTitle`;
inbound sessions use a dedicated `<profile>/.a2a-sessions` cwd.
- Dispose all live sessions on plugin unload.
Also:
- CancelTask now aborts the running executor's signal (was a no-op) and no
longer lets the returning executor overwrite the CANCELED state.
- Outbound tools reuse one `contextId` per local agent session, giving remote
agents cross-turn memory; distinct local sessions stay isolated.
- Optional host services (agents/agentDefaultModel/sessionTitle/agentPresets)
are read structurally via a reflection probe — no hard dependency added.
- Executor precedence: per-contextId DSH agent session by default, refuse when no agent loop is present. - Outbound cross-turn memory (one contextId per local agent session). - Inbound bearer-token auth capability; note both outbound and inbound tokens are stored plaintext in a2a.json.
Recapture the settings panel: outbound tab with the bearer-token input (client), A2A service tab with the executor note and inbound-auth control (server).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Server 模式收到入站 A2A 任务时,默认交给本 DSH 自己的 agent
会话执行(不再只能拒绝),并补齐让它真正能干活的配套:工具、跨轮
记忆、鉴权。
改动
入站 executor(核心)
createDshAgentExecutor:检测到 agent-loop factory时,入站任务 → 本 DSH agent 会话执行;缺 factory 时退回
notConfiguredExecutor(拒绝并给可读指引)。contextId一个会话:首个任务 create,同 contextId后续复用(历史累积),进程重启按需 resume;同 context
串行、不同 context 并行;卸载/下线时统一 dispose。
setup钩子调agentPresets.mount)——否则 spawn 的 agent 落在 empty globallayer,没有 bash/fs 工具,只能把
<invoke>当文本输出。ctx.agentDefaultModel注入 model——否则 persona systemprompt 的
{{model}}变量为空,回合直接报错。A2A: <首条消息摘要>(入站消息带 plugin 来源,DSH自动标题只认 human 消息,故显式命名);入站会话用专用 cwd
<profile>/.a2a-sessions,落在会话列表「未分组」。修复
CancelTask现在真正 abort 运行中 executor 的信号(之前runTask用的是丢弃了 controller 的 signal,abort是死代码);并且不再让返回的 executor 把已 CANCELED 的任务覆盖成
COMPLETED、避免
onTaskSettled二次触发。出站
contextId,使远程agent 获得跨轮记忆;不同本地会话相互隔离,无 agent
上下文时用稳定 fallback。
鉴权 / UI
A2AServer.setAuthToken()+持久化到
a2a.json;AgentCard 声明bearerAuth,未带/错误token 返回 401(单次调用与 SSE 流均生效)。
服务」加入站鉴权设置/清除控件;修正 executor
语义提示(旧的"默认会执行 shell"假警告已移除)。
修复
CancelTask现在真正 abort 运行中 executor 的信号(之前runTask用的是丢弃了controller 的 signal,abort 是死代码);并且不再让返回的 executor 把已 CANCELED
的任务覆盖成 COMPLETED、避免
onTaskSettled二次触发。出站
contextId,使远程 agent获得跨轮记忆;不同本地会话相互隔离,无 agent 上下文时用稳定 fallback。
鉴权 / UI
A2AServer.setAuthToken()+ 持久化到a2a.json;AgentCard 声明bearerAuth,未带/错误 token 返回 401(单次调用与 SSE流均生效)。
服务」加入站鉴权设置/清除控件;修正 executor 语义提示(旧的"默认会执行
shell"假警告已移除)。
所有可选宿主服务(
agents/agentDefaultModel/sessionTitle/agentPresets)经反射探测、结构化读取,不引入硬依赖;缺失则优雅退化。测试
复用/隔离、取消中止 agent 回合、Bearer 401/放行、model 注入。