flowengine 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ # Project Structure
2
+
3
+ ```text
4
+ lib/flowengine/
5
+ flowengine.rb # Module entry: define() and load_dsl()
6
+ version.rb # VERSION = "0.3.1"
7
+ errors.rb # Error hierarchy (8 classes)
8
+ clarification_result.rb # Data.define for AI intake round results
9
+ introduction.rb # Data.define(:label, :placeholder, :maxlength)
10
+ definition.rb # Immutable flow graph container
11
+ node.rb # Single flow step (question, type, transitions, max_clarifications)
12
+ transition.rb # Directed edge with optional rule condition
13
+ evaluator.rb # Rule evaluation against answers
14
+ engine.rb # Runtime session (answers, history, navigation, AI intake state)
15
+ engine/
16
+ state_serializer.rb # Symbolizes string-keyed state from JSON round-trips
17
+ dsl/
18
+ flow_builder.rb # FlowEngine.define {} context (start, introduction, step)
19
+ step_builder.rb # step {} block builder (includes max_clarifications)
20
+ rule_helpers.rb # contains(), equals(), all(), any(), etc.
21
+ rules/
22
+ base.rb # Abstract rule (evaluate + to_s)
23
+ contains.rb # Array.include? semantics
24
+ equals.rb # Simple equality
25
+ greater_than.rb # Numeric > comparison (coerces to_i)
26
+ less_than.rb # Numeric < comparison (coerces to_i)
27
+ not_empty.rb # !nil && !empty?
28
+ all.rb # Composite AND
29
+ any.rb # Composite OR
30
+ validation/
31
+ adapter.rb # Abstract validator interface
32
+ null_adapter.rb # No-op default validator
33
+ llm/
34
+ adapter.rb # Abstract LLM adapter interface
35
+ adapters.rb # Requires all concrete adapters
36
+ auto_client.rb # FlowEngine::LLM.auto_client factory
37
+ provider.rb # Provider/model registry from models.yml
38
+ client.rb # High-level LLM client (prompt building + response parsing)
39
+ system_prompt_builder.rb # Builds system prompt for introduction pre-fill
40
+ intake_prompt_builder.rb # Builds system prompt for AI intake steps
41
+ sensitive_data_filter.rb # Rejects SSN, ITIN, EIN patterns
42
+ graph/
43
+ mermaid_exporter.rb # Exports Definition to Mermaid diagram
44
+ resources/
45
+ models.yml # Vendor/model registry (Anthropic, OpenAI, Gemini)
46
+ prompts/
47
+ generic-dsl-intake.j2 # Static system prompt template for LLM parsing
48
+ spec/
49
+ flowengine_spec.rb # Top-level define/load_dsl tests
50
+ flowengine/ # Mirrors lib/ structure
51
+ engine_spec.rb # Core engine tests
52
+ engine_ai_intake_spec.rb # AI intake step tests
53
+ engine_introduction_spec.rb # Introduction pre-fill tests
54
+ engine_state_spec.rb # State persistence tests
55
+ clarification_result_spec.rb
56
+ llm/ # LLM adapter, client, filter, prompt builder specs
57
+ integration/
58
+ introduction_flow_spec.rb # Introduction + LLM pre-fill integration
59
+ multi_ai_intake_spec.rb # Multi-AI intake integration test
60
+ tax_intake_flow_spec.rb # Real-world tax intake example
61
+ complex_flow_spec.rb # Complex branching tests
62
+ fixtures/
63
+ complex_tax_intake.rb # 17-step tax intake flow definition
64
+ ```
Binary file
data/lefthook.yml ADDED
@@ -0,0 +1,16 @@
1
+ pre-commit:
2
+ parallel: true
3
+ jobs:
4
+ - name: format
5
+ glob: "*.{js,ts,tsx}"
6
+ run: npx biome format --write {staged_files}
7
+ stage_fixed: true
8
+
9
+ - name: rubocop
10
+ glob: "*.{rb,rake}"
11
+ run: bundle exec rubocop -a --format progress {staged_files}
12
+ staged_fixed: true
13
+
14
+ - name: rspecs
15
+ glob: "spec/**/*_spec.rb"
16
+ run: bundle exec rspec --format progress
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FlowEngine
4
+ module LLM
5
+ module Adapters
6
+ class AnthropicAdapter < Adapter
7
+ def self.api_key_var_name
8
+ "ANTHROPIC_API_KEY"
9
+ end
10
+
11
+ def self.default_model
12
+ "claude-sonnet-4-6"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FlowEngine
4
+ module LLM
5
+ module Adapters
6
+ class GeminiAdapter < Adapter
7
+ def self.api_key_var_name
8
+ "GEMINI_API_KEY"
9
+ end
10
+
11
+ def self.default_model
12
+ "gemini-2.5-flash"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FlowEngine
4
+ module LLM
5
+ module Adapters
6
+ class OpenAIAdapter < Adapter
7
+ def self.api_key_var_name
8
+ "OPENAI_API_KEY"
9
+ end
10
+
11
+ def self.default_model
12
+ "gpt-5-mini"
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FlowEngine
4
4
  # Semantic version of the flowengine gem (major.minor.patch).
5
- VERSION = "0.3.1"
5
+ VERSION = "0.4.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flowengine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
@@ -23,6 +23,34 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: tty-box
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: tty-prompt
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
26
54
  - !ruby/object:Gem::Dependency
27
55
  name: zeitwerk
28
56
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +148,18 @@ files:
120
148
  - ".env.example"
121
149
  - ".envrc"
122
150
  - ".rubocop_todo.yml"
151
+ - Brewfile
123
152
  - LICENSE.txt
124
153
  - README.md
125
154
  - Rakefile
155
+ - docs/PROJECT_STRUCTURE.md
126
156
  - docs/badges/coverage_badge.svg
127
- - docs/floweingine-architecture.png
157
+ - docs/flowengine-architecture.png
128
158
  - docs/flowengine-example.png
159
+ - docs/flowengine-processing.png
129
160
  - exe/flowengine
130
161
  - justfile
162
+ - lefthook.yml
131
163
  - lib/flowengine.rb
132
164
  - lib/flowengine/clarification_result.rb
133
165
  - lib/flowengine/definition.rb
@@ -144,6 +176,9 @@ files:
144
176
  - lib/flowengine/llm.rb
145
177
  - lib/flowengine/llm/adapter.rb
146
178
  - lib/flowengine/llm/adapters.rb
179
+ - lib/flowengine/llm/adapters/anthropic_adapter.rb
180
+ - lib/flowengine/llm/adapters/gemini_adapter.rb
181
+ - lib/flowengine/llm/adapters/openai_adapter.rb
147
182
  - lib/flowengine/llm/auto_client.rb
148
183
  - lib/flowengine/llm/client.rb
149
184
  - lib/flowengine/llm/intake_prompt_builder.rb