Skip to main content

Module thread_identity

Module thread_identity 

Source
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)