Class: Rubino::Interaction::Probe

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/interaction/probe.rb

Overview

An ephemeral, read-only side-question against the CURRENT session.

‘probe` is the principal-chat counterpart of the subagent-level probe: it answers a lateral question from the session’s context-so-far and then VANISHES — neither the question nor the answer is written to the session transcript, so the next real turn proceeds exactly as if it never happened (Claude Code’s ‘/btw` semantics).

Reuse, not reinvention:

- Context::PromptAssembler.build gives the SAME message array a real
  turn would send (system + summary + history snapshot). We append the
  question as a final user message and call the adapter ONCE.
- LLM::AdapterFactory.build(...).chat(messages:, tools: nil) is the
  existing one-shot completion seam — no Loop, no tools, no persistence.

Nothing here touches Session::Store, so the probe is screen-only: the only artifact is the dim aside the CLI renders.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(session:, config: Rubino.configuration, model_override: nil, provider_override: nil) ⇒ Probe

Returns a new instance of Probe.



25
26
27
28
29
30
31
# File 'lib/rubino/interaction/probe.rb', line 25

def initialize(session:, config: Rubino.configuration, model_override: nil,
               provider_override: nil)
  @session           = session
  @config            = config
  @model_override    = model_override
  @provider_override = provider_override
end

Instance Method Details

#ask(question) ⇒ Object

Runs the one-shot side-inference over a SNAPSHOT of the session and the question. Returns a Result(question:, answer:). Read-only: the session’s message store is never written.



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rubino/interaction/probe.rb', line 36

def ask(question)
  messages = snapshot_messages
  messages << { role: "user", content: question }

  adapter  = LLM::AdapterFactory.build(
    model_id: @model_override || @session[:model],
    provider: @provider_override || @config.model_provider,
    config: @config
  )
  response = adapter.chat(messages: messages, tools: nil)

  Result.new(question: question, answer: response.content.to_s)
end