Class: Rubino::Tools::BackgroundTasks::Entry
- Inherits:
-
Struct
- Object
- Struct
- Rubino::Tools::BackgroundTasks::Entry
- Defined in:
- lib/rubino/tools/background_tasks.rb
Overview
last_activity / tool_count / activity_log — live-progress fields written
by a subagent's UI::CLI#tool_started / #tool_finished (via
#record_tool_started / #record_tool_finished) under the registry mutex
and read by the parent renderer (UI::SubagentCards) and
the /agents drill-in. activity_log is a bounded ring of the last few
✓ verb · hint lines for the live drill-in; output_tail is the bounded
line buffer of the CURRENTLY RUNNING tool's streamed output (fed by
#record_tool_output, wiped at #record_tool_finished) that the drill-in's
output: block tails (#5). Nothing is persisted (it dies with the
process, like the rest of the registry).
approval_gate / approval_question / approval_command are the
Option-2 approval-surfacing state: when a background child's tool needs
approval the child thread parks on approval_gate (a Run::ApprovalGate)
and the entry flips to status :needs_approval with the question/command
shown on the card; the user resolves it via /agents
budget_request (#574) REUSES that exact :needs_approval gate for a different ask: a BACKGROUND child that hit its tool-iteration ceiling parks on the same gate to ask the human for MORE budget instead of silently force-summarizing. The flag only re-flavors the surfaces (card / menu row / the /agents resolve prompt read "wants +budget — grant?", and the allowlist-persisting "always" option is dropped — there is no command to remember); the parking/wake/stop-cancel plumbing is identical.
Instance Attribute Summary collapse
-
#activity_log ⇒ Object
Returns the value of attribute activity_log.
-
#approval_command ⇒ Object
Returns the value of attribute approval_command.
-
#approval_gate ⇒ Object
Returns the value of attribute approval_gate.
-
#approval_id ⇒ Object
Returns the value of attribute approval_id.
-
#approval_question ⇒ Object
Returns the value of attribute approval_question.
-
#approval_seq ⇒ Object
Returns the value of attribute approval_seq.
-
#approval_snoozed ⇒ Object
Returns the value of attribute approval_snoozed.
-
#budget_request ⇒ Object
Returns the value of attribute budget_request.
-
#depth ⇒ Object
Returns the value of attribute depth.
-
#error ⇒ Object
Returns the value of attribute error.
-
#finished_at ⇒ Object
Returns the value of attribute finished_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_activity ⇒ Object
Returns the value of attribute last_activity.
-
#output_tail ⇒ Object
Returns the value of attribute output_tail.
-
#owner_subagent_id ⇒ Object
Returns the value of attribute owner_subagent_id.
-
#probe_count ⇒ Object
Returns the value of attribute probe_count.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
-
#result ⇒ Object
Returns the value of attribute result.
-
#runner ⇒ Object
Returns the value of attribute runner.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#steer_queue ⇒ Object
Returns the value of attribute steer_queue.
-
#stop_reason ⇒ Object
Returns the value of attribute stop_reason.
-
#subagent ⇒ Object
Returns the value of attribute subagent.
-
#thread ⇒ Object
Returns the value of attribute thread.
-
#tool_count ⇒ Object
Returns the value of attribute tool_count.
Instance Method Summary collapse
-
#messages ⇒ Object
The child subagent's FULL persisted transcript.
-
#peek(question) ⇒ Object
Ephemeral read-only peek: a synchronous LLM side-inference over the child's current context.
-
#peek_hint ⇒ Object
A dim hint shown ABOVE a probe answer, or nil.
-
#shell? ⇒ Boolean
A subagent IS NOT a shell — the discriminator the shared /stop, steer, probe and attach paths dispatch on (ShellEntryAdapter#shell? ⇒ true).
-
#steer(text) ⇒ Object
Parent→child steer: park a turn-boundary note on the child's queue (folded in at its next iteration).
Instance Attribute Details
#activity_log ⇒ Object
Returns the value of attribute activity_log
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def activity_log @activity_log end |
#approval_command ⇒ Object
Returns the value of attribute approval_command
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def approval_command @approval_command end |
#approval_gate ⇒ Object
Returns the value of attribute approval_gate
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def approval_gate @approval_gate end |
#approval_id ⇒ Object
Returns the value of attribute approval_id
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def approval_id @approval_id end |
#approval_question ⇒ Object
Returns the value of attribute approval_question
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def approval_question @approval_question end |
#approval_seq ⇒ Object
Returns the value of attribute approval_seq
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def approval_seq @approval_seq end |
#approval_snoozed ⇒ Object
Returns the value of attribute approval_snoozed
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def approval_snoozed @approval_snoozed end |
#budget_request ⇒ Object
Returns the value of attribute budget_request
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def budget_request @budget_request end |
#depth ⇒ Object
Returns the value of attribute depth
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def depth @depth end |
#error ⇒ Object
Returns the value of attribute error
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def error @error end |
#finished_at ⇒ Object
Returns the value of attribute finished_at
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def finished_at @finished_at end |
#id ⇒ Object
Returns the value of attribute id
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def id @id end |
#last_activity ⇒ Object
Returns the value of attribute last_activity
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def last_activity @last_activity end |
#output_tail ⇒ Object
Returns the value of attribute output_tail
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def output_tail @output_tail end |
#owner_subagent_id ⇒ Object
Returns the value of attribute owner_subagent_id
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def owner_subagent_id @owner_subagent_id end |
#probe_count ⇒ Object
Returns the value of attribute probe_count
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def probe_count @probe_count end |
#prompt ⇒ Object
Returns the value of attribute prompt
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def prompt @prompt end |
#result ⇒ Object
Returns the value of attribute result
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def result @result end |
#runner ⇒ Object
Returns the value of attribute runner
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def runner @runner end |
#started_at ⇒ Object
Returns the value of attribute started_at
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def started_at @started_at end |
#status ⇒ Object
Returns the value of attribute status
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def status @status end |
#steer_queue ⇒ Object
Returns the value of attribute steer_queue
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def steer_queue @steer_queue end |
#stop_reason ⇒ Object
Returns the value of attribute stop_reason
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def stop_reason @stop_reason end |
#subagent ⇒ Object
Returns the value of attribute subagent
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def subagent @subagent end |
#thread ⇒ Object
Returns the value of attribute thread
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def thread @thread end |
#tool_count ⇒ Object
Returns the value of attribute tool_count
60 61 62 |
# File 'lib/rubino/tools/background_tasks.rb', line 60 def tool_count @tool_count end |
Instance Method Details
#messages ⇒ Object
The child subagent's FULL persisted transcript. A background child runs
its own Agent::Runner with its own session, so its complete message
history (its tool calls + what it said) lives in the session store under
runner.session[:id] — the agent-attach view replays exactly this.
Empty when no runner/session is wired (sync/foreground/headless spawn).
111 112 113 114 |
# File 'lib/rubino/tools/background_tasks.rb', line 111 def session_id = runner&.session&.dig(:id) session_id ? ::Rubino::Session::Store.new.for_session(session_id) : [] end |
#peek(question) ⇒ Object
Ephemeral read-only peek: a synchronous LLM side-inference over the child's current context. The shell analogue is an output snapshot.
131 132 133 |
# File 'lib/rubino/tools/background_tasks.rb', line 131 def peek(question) ::Rubino::Tools::SubagentProbe.new.peek(entry: self, question: question) end |
#peek_hint ⇒ Object
A dim hint shown ABOVE a probe answer, or nil. A just-spawned subagent has an empty context, so its honest "I'm not doing anything yet" reply would read as broken (#112) without this; a shell has no such notion (its peek IS its output), so the adapter returns nil.
139 140 141 142 143 144 |
# File 'lib/rubino/tools/background_tasks.rb', line 139 def peek_hint return unless tool_count.to_i.zero? "(snapshot at this instant — the child just started and its context is " \ "still empty; probe again in a moment)" end |
#shell? ⇒ Boolean
A subagent IS NOT a shell — the discriminator the shared /stop, steer, probe and attach paths dispatch on (ShellEntryAdapter#shell? ⇒ true).
118 |
# File 'lib/rubino/tools/background_tasks.rb', line 118 def shell? = false |
#steer(text) ⇒ Object
Parent→child steer: park a turn-boundary note on the child's queue (folded in at its next iteration). The shell analogue is a stdin write.
122 123 124 125 126 127 |
# File 'lib/rubino/tools/background_tasks.rb', line 122 def steer(text) return false unless steer_queue steer_queue.push(text) true end |