Class: Insika::WorkflowRegistry

Inherits:
Registry
  • Object
show all
Defined in:
lib/insika/workflow_registry.rb

Overview

Workflow registry. A workflow is a Ruby callable with the signature #call(input, context:, tools:) that orchestrates RubyLLM Agents/Workflows FROM WITHIN (RubyLLM First): context: is the ContextPackage, tools: are instances already filtered by the Resolution. Execution = one logical turn; checkpoint at the end. Nothing is validated at registration (the callable may come via a factory block). Consumed by the TriggerWorkflow handler.

Item 22 / §4.4 — the EXPOSED surface: a registration may carry input_schema: / output_schema: (a JSON Schema Hash or any dry-schema-compatible validator) and a description: in its metadata. definition bundles them with the factory into a Workflow::Definition (schemas resolved, factory left lazy); catalog is the discovery view (GET /v1/workflows).

Instance Method Summary collapse

Methods inherited from Registry

#deregister_plugin, #entries, #entry, #initialize, #names, #register, #resolve

Constructor Details

This class inherits a constructor from Insika::Registry

Instance Method Details

#catalogObject

Discovery: [{ "name", "description", "input_schema", "output_schema" }, …].



31
# File 'lib/insika/workflow_registry.rb', line 31

def catalog = entries.map { |e| definition(e.name).catalog_entry }

#definition(name) ⇒ Object

-> Workflow::Definition (does NOT resolve the factory — the Executor resolves inside the fiber). Raises NotFoundError for an unregistered name.



19
20
21
22
23
24
25
26
27
28
# File 'lib/insika/workflow_registry.rb', line 19

def definition(name)
  e = entry(name)
  Insika::Workflow::Definition.new(
    name: e.name,
    description: e.[:description],
    input_schema: Insika::Workflow::Schema.coerce(e.[:input_schema]),
    output_schema: Insika::Workflow::Schema.coerce(e.[:output_schema]),
    factory: e.factory
  )
end