Ready
data class Ready(val result: JsonElement, val request: (reason: String) -> ToolPresentation, val executing: () -> ToolPresentation, val cancelled: () -> ToolPresentation, val rejected: (reason: String?) -> ToolPresentation, val failed: (e: Throwable) -> ToolPresentation, val timeout: (elapsed: Duration) -> ToolPresentation) : Tool.ResolveResult(source)
参数解析成功,接下来会由程序或用户进行审批,审批通过后会使用 result 作为 execute 的 request。
Parameters
result
建议反序列化自数据类,数据格式可以自由决定。
request
用于请求用户审批的 i18n 消息,格式应如 '请求读取 README.md($reason)',中文文案应以 '请求' 开头。
executing
用于工具执行过程中为用户显示的状态信息,应类似 '正在读取 README.md',中文文案应以 '正在' 开头。
cancelled
如果工具被取消,为用户显示的消息,例如 '读取 README.md 被取消'。
rejected
如果工具被拒绝,为用户显示的消息,例如 '读取 README.md 被拒绝',或 '读取 README.md 被拒绝:$reason'。
failed
如果工具执行中抛出异常,为用户显示的消息,例如 '读取 README.md 失败:${e.message()}'。
timeout
如果工具执行超时,为用户显示的消息,例如 '读取 README.md 超时:$elapsed'
Constructors
Link copied to clipboard
constructor(result: JsonElement, request: (reason: String) -> ToolPresentation, executing: () -> ToolPresentation, cancelled: () -> ToolPresentation, rejected: (reason: String?) -> ToolPresentation, failed: (e: Throwable) -> ToolPresentation, timeout: (elapsed: Duration) -> ToolPresentation)