Expand description
线程级 Agent 身份与工作目录隔离。
主 Agent、SubAgent、Teammate 各自运行在独立线程中, 通过 thread_local 记录当前线程所属的 agent 名称/类型以及工作目录覆盖。
Functions§
- clear_
thread_ cwd - 清除当前线程的工作目录覆盖
- current_
agent_ name - 获取当前线程的 agent 名称(含类型前缀)
- current_
agent_ type - 获取当前线程的 agent 类型
- set_
current_ agent_ name - 设置当前线程的 agent 名称(在 teammate/subagent agent loop 启动时调用)
- set_
current_ agent_ type - 设置当前线程的 agent 类型
- set_
thread_ cwd - 设置当前线程的工作目录(进入 worktree 时调用)
- thread_
cwd - 获取当前线程的工作目录覆盖(None 表示未进入 worktree)