Class: Insika::Workflow::Definition
- Inherits:
-
Data
- Object
- Data
- Insika::Workflow::Definition
- Defined in:
- lib/insika/workflow.rb
Overview
Bundles a registered workflow's callable factory with its metadata (schemas + description). Built lazily by WorkflowRegistry#definition — it does NOT resolve the factory (the Executor resolves inside the fiber; the contract forbids instantiating outside it). Schema validation touches only the schemas.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#factory ⇒ Object
readonly
Returns the value of attribute factory.
-
#input_schema ⇒ Object
readonly
Returns the value of attribute input_schema.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_schema ⇒ Object
readonly
Returns the value of attribute output_schema.
Instance Method Summary collapse
-
#call(input, context:, tools:) ⇒ Object
Resolves the factory (INSIDE the fiber) and invokes the orchestrator with the canonical signature
#call(input, context:, tools:). -
#catalog_entry ⇒ Object
Discovery view (GET /v1/workflows): name + description + the I/O contract.
-
#validate_input!(input) ⇒ Object
Raises WorkflowSchemaError (< ValidationError) when the input does not conform.
-
#validate_output!(output) ⇒ Object
Raises WorkflowSchemaError when the RETURN does not conform.
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description
24 25 26 |
# File 'lib/insika/workflow.rb', line 24 def description @description end |
#factory ⇒ Object (readonly)
Returns the value of attribute factory
24 25 26 |
# File 'lib/insika/workflow.rb', line 24 def factory @factory end |
#input_schema ⇒ Object (readonly)
Returns the value of attribute input_schema
24 25 26 |
# File 'lib/insika/workflow.rb', line 24 def input_schema @input_schema end |
#name ⇒ Object (readonly)
Returns the value of attribute name
24 25 26 |
# File 'lib/insika/workflow.rb', line 24 def name @name end |
#output_schema ⇒ Object (readonly)
Returns the value of attribute output_schema
24 25 26 |
# File 'lib/insika/workflow.rb', line 24 def output_schema @output_schema end |
Instance Method Details
#call(input, context:, tools:) ⇒ Object
Resolves the factory (INSIDE the fiber) and invokes the orchestrator with the
canonical signature #call(input, context:, tools:).
37 38 39 |
# File 'lib/insika/workflow.rb', line 37 def call(input, context:, tools:) factory.call.call(input, context: context, tools: tools) end |
#catalog_entry ⇒ Object
Discovery view (GET /v1/workflows): name + description + the I/O contract. A JSON-Schema-backed schema exposes its schema Hash; a duck-typed validator (dry-schema etc.) is opaque to introspection -> "opaque".
44 45 46 47 48 49 50 51 |
# File 'lib/insika/workflow.rb', line 44 def catalog_entry { "name" => name, "description" => description, "input_schema" => schema_view(input_schema), "output_schema" => schema_view(output_schema) } end |
#validate_input!(input) ⇒ Object
Raises WorkflowSchemaError (< ValidationError) when the input does not conform. No-op without an input_schema (parity). Called synchronously by TriggerWorkflow -> a bad input is a 422 with no run created.
28 |
# File 'lib/insika/workflow.rb', line 28 def validate_input!(input) = enforce!(input_schema, input, :input) |
#validate_output!(output) ⇒ Object
Raises WorkflowSchemaError when the RETURN does not conform. No-op without an output_schema. Called inside the fiber after the workflow returns -> a bad output fails the run at the :workflow_schema stage.
33 |
# File 'lib/insika/workflow.rb', line 33 def validate_output!(output) = enforce!(output_schema, output, :output) |