feat(util-agent): extend AgentOptions with fork / cleanup (Phase 2a) #155
Reference in New Issue
Block a user
Delete Branch "fix/145-agent-fork-cleanup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Phase 2a infrastructure for the upcoming
step askcommand (#142). ExtendsAgentOptionsin@united-workforce/util-agentwithforkandcleanuphooks, and adds session-cache helpers keyed bystepHash:askso ask sessions can coexist with exec sessions in the same per-agent cache file.Why
The
step askcommand (Phase 2b) needs to fork an existing agent session and run an isolated supplementary turn without mutating the thread head. This change lands the type and cache surface first so the four adapters can be migrated independently in Phase 2b.Changes
AgentForkFnandAgentCleanupFntype aliases; extendAgentOptionswithfork: AgentForkFn | nullandcleanup: AgentCleanupFn | nullfields (no optional properties).askCacheKey(),getAskSessionId(),setAskSessionId()helpers using<stepHash>:askkey shape; coexists with existing<threadId>:<role>exec keys.agent-mock,agent-builtin,agent-hermes,agent-claude-codeall passfork: null, cleanup: nullplaceholders. Real wiring lands in Phase 2b.util-agentminor; 4 adapters patch.Ref
Fixes #145
LGTM ✅
代码审查通过:
stepHash:ask与现有threadId:role无碰撞小橘 solve-issue 全流程跑通 + 代码质量也很高,双重 🎉