pub struct FinishTaskTool;Expand description
ToolExecutor for the finish_task tool (#2072, §5.8).
Why: Gives the model an explicit, schema-validated way to signal completion
instead of relying solely on the implicit no-tool-call convention.
What: Stateless — execute only formats its (already schema-validated)
arguments; it has no side effects on the filesystem, network, or process.
Test: tests::*.
Implementations§
Trait Implementations§
Source§impl Debug for FinishTaskTool
impl Debug for FinishTaskTool
Source§impl Default for FinishTaskTool
impl Default for FinishTaskTool
Source§fn default() -> FinishTaskTool
fn default() -> FinishTaskTool
Source§impl ToolExecutor for FinishTaskTool
impl ToolExecutor for FinishTaskTool
Source§fn schema(&self) -> Value
fn schema(&self) -> Value
JSON schema for finish_task, matching §5.8 of the vision spec exactly.
Why: This is the schema ToolRegistry::schema_for hands to
llm::ToolCallExtractor (#1023), which validates every call’s arguments
against it before execute ever runs.
What: status (enum, required), summary (string, required), changes
(optional array of {file, lines_added, lines_removed}), tests_run /
tests_passed (optional integers). additionalProperties: false matches
this crate’s convention for every other tool’s schema.
Test: tests::schema_has_required_fields_and_enum.
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Render the (already schema-validated) arguments into a ToolResult.
Why: By the time execute runs, agent_loop::dispatch_all has already
validated args against Self::schema via #1023’s
ToolCallExtractor::parse_and_validate — a missing required field or an
invalid status enum value never reaches here at all; those are caught
upstream and fed back through the SAME recoverable-error + repair path
every other tool uses. The Err branch below is therefore a defensive
fallback (no unwrap/panic) for a shape the loose JSON-Schema-subset
validator accepted but strict serde deserialisation still rejects —
exercised directly in tests::execute_bypassing_schema_validation_is_recoverable.
What: Ok → ToolResult::ok(render_finish_summary(&parsed)). Err →
ToolResult::err naming the deserialisation failure so the model can
retry with a corrected call.
Test: tests::execute_valid_args_renders_summary,
tests::execute_with_changes_and_tests_renders_all_fields,
tests::execute_bypassing_schema_validation_is_recoverable.
Source§fn restricted_tiers(&self) -> &[ServiceTier]
fn restricted_tiers(&self) -> &[ServiceTier]
Auto Trait Implementations§
impl Freeze for FinishTaskTool
impl RefUnwindSafe for FinishTaskTool
impl Send for FinishTaskTool
impl Sync for FinishTaskTool
impl Unpin for FinishTaskTool
impl UnsafeUnpin for FinishTaskTool
impl UnwindSafe for FinishTaskTool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more