Class: Insika::DSL::WorkflowAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/insika/dsl/workflow_adapter.rb

Overview

Adapts a DSL workflow "name" do |input, ctx| … end block to the engine's canonical workflow callable, #call(input, context:, tools:).

The engine contract is unchanged — this only decides what the AUTHOR holds. A workflow's job is orchestrating agent turns, so the second argument is a small context whose main verb is ask; the raw context/tools the Executor passes stay reachable for the rare workflow that wants them.

Defined Under Namespace

Classes: Context

Instance Method Summary collapse

Constructor Details

#initialize(block:, runtime:) ⇒ WorkflowAdapter

Returns a new instance of WorkflowAdapter.



13
14
15
16
# File 'lib/insika/dsl/workflow_adapter.rb', line 13

def initialize(block:, runtime:)
  @block = block
  @runtime = runtime
end

Instance Method Details

#call(input, context:, tools:) ⇒ Object



18
19
20
21
# File 'lib/insika/dsl/workflow_adapter.rb', line 18

def call(input, context:, tools:)
  ctx = Context.new(runtime: @runtime, context: context, tools: tools)
  @block.arity == 1 ? @block.call(input) : @block.call(input, ctx)
end