ConfirmResult
public class ConfirmResult
io/agentscope/core/event/ConfirmResult.java:35–93确认结果,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.event 包。核心成员包括 isConfirmed、getToolCall、getRules、getReason、ConfirmResult。
Represents the result of a single user confirmation decision for a tool call.
When confirmed, the caller may supply a modified #toolCall (allowing the user to
tweak input) and/or new #rules that the PermissionEngine should remember for
future calls — e.g. "always allow this command going forward".
When denied, the caller may supply a human-readable #reason explaining the denial;
it becomes the text of the DENIED tool result written back to the model context (and emitted
on the event stream), replacing the default "Permission denied by user" message.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules, String reason) | 初始化 `ConfirmResult` 实例。 Creates a new instance. |
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules) | 初始化 `ConfirmResult` 实例。 Convenience constructor without a denial reason. |
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall) | 初始化 `ConfirmResult` 实例。 Convenience constructor without rules. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public boolean isConfirmed() | 判断是否 `isConfirmed`。 Returns whether the confirmed. |
public ToolUseBlock getToolCall() | 获取工具调用。 Returns the tool call. |
public List<PermissionRule> getRules() | 获取规则。 New permission rules to register with the engine when `#confirmed` is true. |
public String getReason() | 获取推理。 Optional human-readable reason for a denial (`#confirmed` == false). |
构造器详情Constructor Detail
ConfirmResult
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules, String reason)
初始化 ConfirmResult 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
confirmed | boolean | confirmed(类型 `boolean`)。The confirmed. |
toolCall | ToolUseBlock | 工具调用(类型 `ToolUseBlock`)。The tool call. |
rules | List<PermissionRule> | 规则(类型 `List`)。The rules. |
reason | String | 原因(类型 `String`)。The reason. |
io/agentscope/core/event/ConfirmResult.java:42–52ConfirmResult
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules)
初始化 ConfirmResult 实例。
Convenience constructor without a denial reason.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
confirmed | boolean | confirmed(类型 `boolean`)。The confirmed. |
toolCall | ToolUseBlock | 工具调用(类型 `ToolUseBlock`)。The tool call. |
rules | List<PermissionRule> | 规则(类型 `List`)。The rules. |
io/agentscope/core/event/ConfirmResult.java:55–57ConfirmResult
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall)
初始化 ConfirmResult 实例。
Convenience constructor without rules.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
confirmed | boolean | confirmed(类型 `boolean`)。The confirmed. |
toolCall | ToolUseBlock | 工具调用(类型 `ToolUseBlock`)。The tool call. |
io/agentscope/core/event/ConfirmResult.java:60–62方法详情Method Detail
isConfirmed
public boolean isConfirmed()
判断是否 isConfirmed。
Returns whether the confirmed.
booleanio/agentscope/core/event/ConfirmResult.java:64–66getToolCall
public ToolUseBlock getToolCall()
获取工具调用。
Returns the tool call.
ToolUseBlockio/agentscope/core/event/ConfirmResult.java:68–70getRules
public List<PermissionRule> getRules()
获取规则。
New permission rules to register with the engine when #confirmed is true.
List<PermissionRule>io/agentscope/core/event/ConfirmResult.java:78–80getReason
public String getReason()
获取推理。
Optional human-readable reason for a denial (#confirmed == false).
Stringio/agentscope/core/event/ConfirmResult.java:90–92