PlanModeManager
public final class PlanModeManager
io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:39–115计划模式管理器,把复杂任务拆分为可执行步骤并驱动流程。位于 io.agentscope.harness.agent.workspace.plan 包。核心成员包括 isPlanActive、enter、exit、planFilePath、writePlan、PlanModeManager。
Coordinates plan mode for a single agent.
State (whether plan mode is active and which markdown file holds the current plan) lives in
PlanModeContextState inside the agent's AgentState, so it is persisted with the
session and survives restarts / cross-node hand-offs — this is the mechanism that makes dynamic
(runtime) plan-mode switching work in a distributed setting, where an in-process boolean would be
lost.
The plan markdown file is written exclusively through WorkspaceManager, never via
java.nio.file.Files, so it lands on whatever backend (local, sandbox, remote) the agent's
filesystem is configured with. The logical path stays <planDir>/PLAN.md for every
isolation scope; per-scope isolation is applied transparently by the filesystem (store namespace
for remote, snapshot key for sandbox) rather than by encoding it into the path.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
DEFAULT_PLAN_DIRstaticfinal | String | 默认计划目录字段。 Default workspace-relative directory for plan files. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public PlanModeManager(WorkspaceManager workspaceManager, String planDir) | 初始化 `PlanModeManager` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public boolean isPlanActive(AgentState state) | 判断是否 `isPlanActive`。 Returns whether the plan active. |
public String enter(AgentState state) | 设置该参数。 Enters plan mode. |
public void exit(AgentState state) | 设置该参数。 Exits plan mode (back to BUILD). |
public String planFilePath(AgentState state) | 设置计划文件路径。 Workspace-relative path of the plan file currently associated with this agent. |
public String writePlan(RuntimeContext rc, AgentState state, String content) | 执行写入计划相关操作。 Writes (creates or overwrites) the plan markdown file through the workspace filesystem and
records its path in state. |
字段详情Field Detail
DEFAULT_PLAN_DIR
public static final String DEFAULT_PLAN_DIR
默认计划目录字段。声明为 public static final String DEFAULT_PLAN_DIR。
Default workspace-relative directory for plan files.
io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:42构造器详情Constructor Detail
PlanModeManager
public PlanModeManager(WorkspaceManager workspaceManager, String planDir)
初始化 PlanModeManager 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workspaceManager | WorkspaceManager | 工作区管理器(类型 `WorkspaceManager`)。The workspace manager. |
planDir | String | 计划目录(类型 `String`)。The plan dir. |
io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:47–58方法详情Method Detail
isPlanActive
public boolean isPlanActive(AgentState state)
判断是否 isPlanActive。
Returns whether the plan active.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
state | AgentState | 状态对象(类型 `AgentState`)。The state. |
booleanio/agentscope/harness/agent/workspace/plan/PlanModeManager.java:60–62enter
public String enter(AgentState state)
设置该参数。
Enters plan mode.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
state | AgentState | 状态对象(类型 `AgentState`)。The state. |
Stringio/agentscope/harness/agent/workspace/plan/PlanModeManager.java:69–77exit
public void exit(AgentState state)
设置该参数。
Exits plan mode (back to BUILD).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
state | AgentState | 状态对象(类型 `AgentState`)。The state. |
io/agentscope/harness/agent/workspace/plan/PlanModeManager.java:80–83planFilePath
public String planFilePath(AgentState state)
设置计划文件路径。
Workspace-relative path of the plan file currently associated with this agent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
state | AgentState | 状态对象(类型 `AgentState`)。The state. |
Stringio/agentscope/harness/agent/workspace/plan/PlanModeManager.java:86–94writePlan
public String writePlan(RuntimeContext rc, AgentState state, String content)
执行写入计划相关操作。
Writes (creates or overwrites) the plan markdown file through the workspace filesystem and records its path in state.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
rc | RuntimeContext | rc(类型 `RuntimeContext`)。The rc. |
state | AgentState | 状态对象(类型 `AgentState`)。The state. |
content | String | 内容(类型 `String`)。The content. |
Stringio/agentscope/harness/agent/workspace/plan/PlanModeManager.java:102–110