ShellPathPolicy
public final class ShellPathPolicy
io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:38–162Shell 路径策略,让智能体以受控方式调用外部能力。位于 io.agentscope.harness.agent.skill.runtime 包。核心成员包括 noShell、sandbox、localWithShell、mode、resolve、SANDBOX_WORKSPACE_PREFIX。
Resolves the absolute filesRoot path emitted in <available_skills> and
load_skill_through_path responses, given a skill's StageResult and the
current shell mode.
Three modes the policy knows about:
-
Mode#NO_SHELL— noShellExecuteToolregistered. Returnsnullfor every skill so the prompt omits<files-root>and the code-execution instruction block entirely. -
Mode#SANDBOX— sandbox-backed filesystem. Paths use the sandbox-internal prefix (/workspace/). -
Mode#LOCAL_WITH_SHELL—LocalFilesystemWithShell. Paths use the absolute host workspace root.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Mode | 枚举enum | 定义模式相关取值的枚举。 A enum in io.agentscope.harness.agent.skill.runtime that defines enum values used when components lets agents invoke external capabilities under control. |
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
SANDBOX_WORKSPACE_PREFIXstaticfinal | String | 沙箱工作区 PREFIX字段。 The SANDBOX WORKSPACE PREFIX field. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static ShellPathPolicy noShell()static | 返回 `noShell` 结果。 No shell is available; every `filesRoot` resolves to `null`. |
public static ShellPathPolicy sandbox()static | 返回沙箱。 Sandbox mode — paths under the default `/workspace/` prefix. |
public static ShellPathPolicy sandbox(String workspacePrefix)static | 设置沙箱。 Sandbox mode with a custom workspace prefix. |
public static ShellPathPolicy localWithShell(Path workspaceRoot)static | 设置该参数。 Local-with-shell mode — paths absolute on the host. |
public Mode mode() | 返回模式。 Returns the mode. |
public String resolve(String skillName, StageResult stage) | 执行解析相关操作。 Returns the absolute `filesRoot` for the given skill, or `null` when shell
is unavailable / the skill has no shell-reachable representation. |
字段详情Field Detail
SANDBOX_WORKSPACE_PREFIX
public static final String SANDBOX_WORKSPACE_PREFIX
沙箱工作区 PREFIX字段。声明为 public static final String SANDBOX_WORKSPACE_PREFIX。
The SANDBOX WORKSPACE PREFIX field.
io/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:46方法详情Method Detail
noShell
public static ShellPathPolicy noShell()
返回 noShell 结果。
No shell is available; every filesRoot resolves to null.
ShellPathPolicyio/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:59–61sandbox
public static ShellPathPolicy sandbox()
返回沙箱。
Sandbox mode — paths under the default /workspace/ prefix.
ShellPathPolicyio/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:64–66sandbox
public static ShellPathPolicy sandbox(String workspacePrefix)
设置沙箱。
Sandbox mode with a custom workspace prefix.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workspacePrefix | String | 工作区 Prefix(类型 `String`)。absolute path of the workspace root inside the sandbox |
ShellPathPolicyio/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:74–79localWithShell
public static ShellPathPolicy localWithShell(Path workspaceRoot)
设置该参数。
Local-with-shell mode — paths absolute on the host.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workspaceRoot | Path | 工作区根(类型 `Path`)。The workspace root. |
ShellPathPolicyio/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:82–87mode
public Mode mode()
返回模式。
Returns the mode.
Modeio/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:89–91resolve
public String resolve(String skillName, StageResult stage)
执行解析相关操作。
Returns the absolute filesRoot for the given skill, or null when shell is unavailable / the skill has no shell-reachable representation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillName | String | 技能's`name`。the skill's `name` |
stage | StageResult | 阶段(类型 `StageResult`)。staging outcome from `MarketplaceStager#stage` |
Stringio/agentscope/harness/agent/skill/runtime/ShellPathPolicy.java:100–111嵌套类详情Nested Class Detail
Mode
public enum Mode定义模式相关取值的枚举。位于 io.agentscope.harness.agent.skill.runtime 包。核心成员包括 NO_SHELL、SANDBOX、LOCAL_WITH_SHELL。
A enum in io.agentscope.harness.agent.skill.runtime that defines enum values used when components lets agents invoke external capabilities under control. Declared in io.agentscope.harness.agent.skill.runtime.