Class: Pikuri::Tasks::Completed
- Inherits:
-
Pikuri::Tool
- Object
- Pikuri::Tool
- Pikuri::Tasks::Completed
- Defined in:
- lib/pikuri/tasks/completed.rb
Overview
The task_completed tool: mark the item with the given id as
completed. Same shape as InProgress (status in the tool name,
item addressed by numeric #id). Returns List#render; a bad id
returns "Error: no such task id" plus the current list.
Sharing: P_one_agent — closes over one agent's List; see its
== Sharing.
Constant Summary collapse
- DESCRIPTION =
<<~DESC Mark a task as `completed` once the work — including any required verification — is actually done. Usage: - Pass the task's numeric `id` as shown in the rendered list (`- #3 [in_progress] ...` → id 3). - Do NOT mark `completed` based on intent; mark it only after the underlying work is verified. - If the work is partially done or blocked, leave the task `in_progress` and add a follow-up via `task_create`. - On `Error: no such task id: ...` the call did nothing — the error includes the current list; pick the right id from it. - On success the full current list is returned for you to read back. DESC
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(list:) ⇒ Completed constructor
Constructor Details
#initialize(list:) ⇒ Completed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pikuri/tasks/completed.rb', line 27 def initialize(list:) super( name: 'task_completed', description: DESCRIPTION, parameters: Pikuri::Tool::Parameters.build { |p| p.required_integer :id, 'Numeric id of the existing task to mark as ' \ 'completed, as shown in the rendered list, e.g. 3.' }, execute: lambda { |id:| Completed.execute(list: list, id: id) }, # No legs; see {Create}. trifecta_legs: Pikuri::Tool::TrifectaLegs::NONE ) end |
Class Method Details
.execute(list:, id:) ⇒ String
47 48 49 50 51 52 |
# File 'lib/pikuri/tasks/completed.rb', line 47 def self.execute(list:, id:) list.set_status(id: id, status: 'completed') list.render rescue ItemNotFound "Error: no such task id: #{id}. Current list:\n#{list.render}" end |