Repository navigation
fix(doc): replace getSuggestedRules with generationSuggestions in ToolBase #3238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3c70c00
bdca33f
b43cdab
9c6a93a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,12 +204,13 @@ PermissionContextState permCtx = | |
| import io.agentscope.core.event.ConfirmResult; | ||
|
|
||
| // ASK decisions carry suggestedRules on the ToolUseBlock. | ||
| // Accept them by attaching to the result: | ||
| // Accept them by attaching to the result. | ||
| // `tool` is the ToolBase instance that received the ASK (the tool named in the pending call): | ||
| ConfirmResult result = | ||
| new ConfirmResult( | ||
| /* confirmed = */ true, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Warning] The preceding comment is now stale: suggested rules are carried on // ASK decisions carry suggestedRules on the PermissionDecision, but they are not
// re-exposed on the pending ToolUseBlock — regenerate them from the tool itself:The |
||
| /* toolCall = */ toolCall, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Warning] // `tool` is the ToolBase instance that received the ASK (the tool named in the pending call)
ConfirmResult result =
new ConfirmResult(
/* confirmed = */ true,
/* toolCall = */ toolCall,
/* rules = */ tool.generateSuggestions(toolCall.getInput()));Same wording applies to the |
||
| /* rules = */ toolCall.getSuggestedRules()); | ||
| /* rules = */ tool.generateSuggestions(toolCall.getInput())); | ||
| ``` | ||
|
|
||
| Runnable examples: `agentscope-examples/documentation/.../tool/PermissionContextExample.java`, `hitl/PermissionHITLExample.java`. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -204,12 +204,13 @@ PermissionContextState permCtx = | |
| import io.agentscope.core.event.ConfirmResult; | ||
|
|
||
| // ASK 决策中包含基于本次调用生成的 suggestedRules(位于 ToolUseBlock 上)。 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Warning] 同上:中文文案里的 “(位于 ToolUseBlock 上)” 也和代码不一致。 |
||
| // 接受建议时,把它放入结果即可: | ||
| // 接受建议时,把它放入结果即可。 | ||
| // `tool` 是接收到 ASK 的 ToolBase 实例(即待确认调用中命名的 tool): | ||
| ConfirmResult result = | ||
| new ConfirmResult( | ||
| /* confirmed = */ true, | ||
| /* toolCall = */ toolCall, | ||
| /* rules = */ toolCall.getSuggestedRules()); | ||
| /* rules = */ tool.generateSuggestions(toolCall.getInput())); | ||
| ``` | ||
|
|
||
| 完整可运行示例:`agentscope-examples/documentation/.../tool/PermissionContextExample.java`、`hitl/PermissionHITLExample.java`。 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Warning] This sentence is still the stale claim from before the rename: suggested rules are not carried "on the ToolUseBlock" —
ToolUseBlockhas no such field (id / name / input / content / metadata / state only). They are attached to thePermissionDecisionbyPermissionEngine.checkPermissionviaaskDecision.withSuggestedRules(tool.generateSuggestions(input)), and read back withPermissionDecision.getSuggestedRules(). Since the whole point of this snippet is now "re-derive the suggestions from the tool", the wording should match, e.g.// ASK decisions carry suggestedRules on the PermissionDecision;or simply// Suggested rules are auto-generated per invocation by the tool:. Same fix needed atdocs/v2/zh/.../permission-system.md:206.