flowengine 0.4.0 → 0.4.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: abf9fcf3a78e2d13e003360a8dbce3ab2c21a2f7b30ff7d0d45e890d70ac1a65
4
- data.tar.gz: 958fce5978e1724238d4a109efe37f11be5e4885e9f723563262aea2434da0b1
3
+ metadata.gz: 44af196ec2b3b9611c304c0ad30c8bbd600d679657e9e91990a17c23a10ca13c
4
+ data.tar.gz: 69234ea59516677cde345b7e90fd2f253b98819e1d07c8c0286cf3ffc9c4a2bd
5
5
  SHA512:
6
- metadata.gz: ea803aeac9367ea3427582b3a1b9b1f113c1e60af83e26663c1a5ef50cdde45b5a69a136d373902785c9fc8ca8e98923581735f604fa1c54635aa03f083c64eb
7
- data.tar.gz: fb5bfc06c0f1f35b32088dea9247e8878a820c8a95798c4411dbcf8af11e8929e3f0826001ea90afe3ab1a781fcf8c457eb8007a3d348def4a7491cc25778435
6
+ metadata.gz: 05d907c2ddac65e926e3685030738e21043c685193bd0cf62f36612686a28be9a8028e0eef0cd9edf4548e0617f7d0cc74ee0a2fe5d03df7a2138c19cf38a894
7
+ data.tar.gz: 4a7d114b6507dae87bbcc760308d4af32eff632aad373d409869f9a04fe114e9c40e9881d0135f2c925389a25bff5ab7812bf58166727fdf7596bf16af404551
data/.envrc CHANGED
@@ -4,3 +4,4 @@ PATH_add exe
4
4
  if [[ -f .env ]]; then
5
5
  eval "$(cat .env | sed '/^#.*/d; /^$/d; s/^/export /g')"
6
6
  fi
7
+
data/README.md CHANGED
@@ -485,6 +485,92 @@ The core has **zero UI logic**, **zero DB logic**, and **zero framework dependen
485
485
  | `LLM::SensitiveDataFilter` | Rejects text containing SSN, ITIN, EIN patterns |
486
486
  | `Graph::MermaidExporter` | Exports flow as a Mermaid diagram |
487
487
 
488
+ ## Beyond the DSL: LLM-Driven Tools
489
+
490
+ The declarative DSL is the primary way to define flows, but it is not the only way to use FlowEngine. The gem's LLM integration layer — adapters, client, and sensitive data filter — can power conversational tools that don't use the DSL at all.
491
+
492
+ ### `bin/tax-estimate` (Experimental)
493
+
494
+ An interactive CLI tool that estimates tax return complexity and preparation cost entirely through LLM-driven conversation. Instead of defining steps in the DSL, the LLM decides what to ask, generates Ruby code for rich terminal prompts (`TTY::Prompt`), and produces a final YAML estimate when it has enough information.
495
+
496
+ ```bash
497
+ bin/tax-estimate
498
+ ```
499
+
500
+ How it works:
501
+
502
+ 1. A system prompt describes tax complexity factors (filing status, income sources, deductions, special situations)
503
+ 2. The LLM returns JSON containing a natural-language question and a `question_eval` field with Ruby code that uses `TTY::Prompt` for multi-select, radio buttons, text input, etc.
504
+ 3. The generated code is evaluated to collect the user's answer, which is appended to the chat history
505
+ 4. The loop continues until the LLM produces a `final_estimate` — a YAML object with complexity score, cost range, and explanation
506
+
507
+ This approach trades the safety and predictability of a predefined flow graph for maximum flexibility — the LLM adapts its questions based on prior answers without any step definitions.
508
+
509
+ ```ruby
510
+ # The only FlowEngine dependency is the LLM client
511
+ client = FlowEngine::LLM.auto_client
512
+ response = client.adapter.chat(
513
+ system_prompt: tax_system_prompt,
514
+ user_prompt: "Chat history: #{chat_history.to_json}",
515
+ model: client.model
516
+ )
517
+ ```
518
+
519
+ Here is an example of the final YAML estimate for a simple single-filer return:
520
+
521
+ ```yaml
522
+ ---
523
+ client_profile:
524
+ filing_status: Single
525
+ dependents: 0
526
+ states_required: 1
527
+
528
+ income_sources:
529
+ w2_employers: 1
530
+ self_employment: false
531
+ rental_income: false
532
+ investment_income: false
533
+ retirement_distributions: false
534
+ foreign_income: false
535
+
536
+ deductions_and_credits:
537
+ itemized_deductions: false
538
+ business_expenses: false
539
+ education_credits: false
540
+ energy_credits: false
541
+ child_dependent_care_credits: false
542
+
543
+ special_situations:
544
+ stock_options: false
545
+ cryptocurrency: false
546
+ foreign_accounts: false
547
+ prior_year_carryforwards: false
548
+ amended_return: false
549
+ irs_notices: false
550
+
551
+ complexity_assessment:
552
+ score: 1
553
+ out_of: 10
554
+ rationale: >
555
+ This is a straightforward return. Single filer, no dependents,
556
+ one W-2 from a single employer, one state return, no itemized
557
+ deductions, no special income sources, and no special situations.
558
+
559
+ cost_estimate:
560
+ low: $150
561
+ high: $300
562
+ average: $200
563
+ currency: USD
564
+ notes: >
565
+ Cost reflects a simple federal Form 1040 with a single W-2 and
566
+ one state return. Rush fees may apply if filing close to the
567
+ deadline.
568
+
569
+ estimated_time_to_complete: 1-2 hours
570
+ ```
571
+
572
+ See `examples/` for more sample outputs including complex multi-income scenarios.
573
+
488
574
  ## Ecosystem
489
575
 
490
576
  | Gem | Purpose |