ad-agent_architecture 0.0.11 → 0.0.12

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: 2e62425f0ffeff140581be7741ce8b429fb9437a196294e071d017e343894562
4
- data.tar.gz: b7da8713c09d8179f840a676787aac6608143fde09a112fbe683c9205e9a37d2
3
+ metadata.gz: cbe6603e537c91457b8d7a3694ecaa23f77eec779bc43ae46a175f37c51e957b
4
+ data.tar.gz: a65c74eae0fc6fdd21296f5da8b6b03d1ef46f6a6dd407d1b6deb38577dbf116
5
5
  SHA512:
6
- metadata.gz: 9e11fffa978aa478142fe2a540c08c2917aa9a169ab0c19f35a19ea449fb7d9a6b06ddbce72a58b489cd50a367cd2e2dd571622f818a14ad63813a770c931626
7
- data.tar.gz: 733bf3314271fa108de844ffc4fb2189bb7d77742bbfae31e2316b2883995eb2bc21d2888b49da7954db0865bf9cb9c226edce7cc4bde490f4fda535f206f222
6
+ metadata.gz: 9e9c114cd087a31e91352a3c9165cbad5b3e11b8668a77c37bd3226503e4746e2e6cdd53fb30b9c0b3a2bba84b4b050b32bce525b9b1d4e79ce215e9a7355f33
7
+ data.tar.gz: c0473487b838ebc28e5a59ef16b9b9d77e3a4bb3ba210f1ff771a1747053736500747dd06542c482b5326a5cd97b8e1d9058a0697e02bae9b9f1dbc76e343a15
data/.rubocop.yml CHANGED
@@ -93,9 +93,6 @@ Style/AccessorGrouping:
93
93
  Metrics/AbcSize:
94
94
  Exclude:
95
95
  - "lib/ad/agent_architecture/**/*"
96
- Metrics/NoExpectationExample:
97
- Exclude:
98
- - "spec/ad/agent_architecture/dsl/*"
99
96
 
100
97
  Layout/SpaceBeforeComma:
101
98
  Enabled: false
@@ -112,18 +109,19 @@ RSpec/SpecFilePathSuffix:
112
109
  Enabled: true
113
110
 
114
111
  RSpec/NamedSubject:
115
- Exclude:
116
- - "**/spec/**/*"
112
+ Enabled: false
117
113
 
118
114
  RSpec/ExampleLength:
119
- Exclude:
120
- - "**/spec/**/*"
115
+ Enabled: false
121
116
 
122
117
  RSpec/MultipleExpectations:
123
118
  Max: 3
124
119
  Exclude:
125
120
  - "spec/ad/agent_architecture/dsl/actions/save_database_spec.rb"
126
121
 
122
+ RSpec/MultipleMemoizedHelpers:
123
+ Enabled: false
124
+
127
125
  Metrics/CyclomaticComplexity:
128
126
  Exclude:
129
127
  - "lib/ad/agent_architecture/dsl/actions/save_database.rb"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.0.11](https://github.com/appydave/ad-agent_architecture/compare/v0.0.10...v0.0.11) (2024-06-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * improve reports ([62aac63](https://github.com/appydave/ad-agent_architecture/commit/62aac63af8b48b30514f21b940005e899538307f))
7
+
1
8
  ## [0.0.10](https://github.com/appydave/ad-agent_architecture/compare/v0.0.9...v0.0.10) (2024-06-29)
2
9
 
3
10
 
data/Guardfile CHANGED
@@ -28,9 +28,9 @@ group :green_pass_then_cop, halt_on_fail: true do
28
28
  watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
29
29
  end
30
30
 
31
- guard :shell do
32
- watch(%r{^spec/usecases/.+\.rbx$}) do |m|
33
- `ruby -r ./spec/usecases/dsl_initialize.rb #{m[0]}`
34
- end
35
- end
31
+ # guard :shell do
32
+ # watch(%r{^spec/usecases/.+\.rbx$}) do |m|
33
+ # `ruby -r ./spec/usecases/dsl_initialize.rb #{m[0]}`
34
+ # end
35
+ # end
36
36
  end
@@ -17,6 +17,10 @@ module Ad
17
17
  @workflow = WorkflowDsl.new(name)
18
18
  end
19
19
 
20
+ def settings(&block)
21
+ @workflow.settings(&block)
22
+ end
23
+
20
24
  def attributes(&block)
21
25
  @workflow.attributes(&block)
22
26
  end
@@ -25,8 +29,8 @@ module Ad
25
29
  @workflow.prompts(&block)
26
30
  end
27
31
 
28
- def section(name:, &block)
29
- @workflow.section(name: name, &block)
32
+ def section(name, &block)
33
+ @workflow.section(name, &block)
30
34
  end
31
35
 
32
36
  def save
@@ -4,13 +4,9 @@ module Ad
4
4
  module AgentArchitecture
5
5
  module Dsl
6
6
  # This class is responsible for defining the attributes of a workflow
7
- class AttributeDsl
8
- def initialize(attributes)
9
- @attributes = attributes
10
- end
11
-
7
+ class AttributeDsl < ChildDsl
12
8
  def attribute(name, type:, is_array: false)
13
- @attributes[name] = { name: name, type: type, is_array: is_array }
9
+ workflow[:attributes][name] = { name: name, type: type, is_array: is_array }
14
10
  end
15
11
  end
16
12
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ad
4
+ module AgentArchitecture
5
+ module Dsl
6
+ # This is the base class for all child DSLs
7
+ class ChildDsl
8
+ attr_reader :workflow
9
+
10
+ def initialize(workflow)
11
+ @workflow = workflow
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -4,13 +4,17 @@ module Ad
4
4
  module AgentArchitecture
5
5
  module Dsl
6
6
  # This class is responsible for defining the prompts of a workflow
7
- class PromptDsl
8
- def initialize(prompts)
9
- @prompts = prompts
7
+ class PromptDsl < ChildDsl
8
+ def prompt(name, path: nil, content: nil)
9
+ workflow[:prompts][name] = { name: name, content: content }
10
10
  end
11
11
 
12
- def prompt(name, path: nil, content: nil)
13
- @prompts[name] = { name: name, path: path, content: content }
12
+ def prompt_file(file)
13
+ prompt_path = workflow[:settings][:prompt_path]
14
+ raise 'Prompt path not defined in settings' unless prompt_path
15
+
16
+ full_path = File.join(prompt_path, file)
17
+ File.read(full_path)
14
18
  end
15
19
  end
16
20
  end
@@ -4,16 +4,17 @@ module Ad
4
4
  module AgentArchitecture
5
5
  module Dsl
6
6
  # This class is responsible for creating a section in the workflow
7
- class SectionDsl
8
- def initialize(name, order, sections)
7
+ class SectionDsl < ChildDsl
8
+ def initialize(workflow, name, order)
9
+ super(workflow)
10
+
9
11
  @section = { name: name, order: order, steps: [] }
10
- @sections = sections
12
+ @workflow[:sections] << @section
11
13
  @current_step_order = 1
12
- @sections << @section
13
14
  end
14
15
 
15
16
  def step(name:, &block)
16
- StepDsl.new(name, @current_step_order, @section[:steps]).instance_eval(&block)
17
+ StepDsl.new(workflow, @section, name, @current_step_order).instance_eval(&block)
17
18
  @current_step_order += 1
18
19
  end
19
20
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ad
4
+ module AgentArchitecture
5
+ module Dsl
6
+ # This class is responsible for defining the settings of a workflow
7
+ class SettingsDsl < ChildDsl
8
+ def method_missing(name, *args, &block)
9
+ if args.length == 1 && block.nil?
10
+ workflow[:settings][name] = args.first
11
+ else
12
+ super
13
+ end
14
+ end
15
+
16
+ def respond_to_missing?(_name, _include_private = false)
17
+ true
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -5,10 +5,16 @@ module Ad
5
5
  module Dsl
6
6
  # This class is responsible for defining the steps of a section
7
7
  class StepDsl
8
- def initialize(name, order, steps)
9
- @step = { name: name, order: order, input_attributes: [], output_attributes: [], prompt: '' }
10
- @steps = steps
11
- @steps << @step
8
+ def initialize(_workflow, section, name, order)
9
+ @step = {
10
+ name: name,
11
+ order: order,
12
+ prompt: '',
13
+ input_attributes: [],
14
+ output_attributes: []
15
+ }
16
+
17
+ section[:steps] << @step
12
18
  end
13
19
 
14
20
  def input(attr_name, **_opts)
@@ -8,24 +8,33 @@ module Ad
8
8
  attr_reader :workflow
9
9
 
10
10
  def initialize(name)
11
- @workflow = { name: name, sections: [], attributes: {}, prompts: {} }
11
+ @workflow = { name: name, sections: [], attributes: {}, prompts: {}, settings: {} }
12
12
  @current_section_order = 1
13
13
  end
14
14
 
15
+ def settings(&block)
16
+ dsl = SettingsDsl.new(@workflow)
17
+ dsl.instance_eval(&block) if block_given?
18
+ dsl
19
+ end
20
+
15
21
  def attributes(&block)
16
- dsl = AttributeDsl.new(@workflow[:attributes])
22
+ dsl = AttributeDsl.new(@workflow)
17
23
  dsl.instance_eval(&block) if block_given?
24
+ dsl
18
25
  end
19
26
 
20
27
  def prompts(&block)
21
- dsl = PromptDsl.new(@workflow[:prompts])
28
+ dsl = PromptDsl.new(@workflow)
22
29
  dsl.instance_eval(&block) if block_given?
30
+ dsl
23
31
  end
24
32
 
25
- def section(name:, &block)
26
- dsl = SectionDsl.new(name, @current_section_order, @workflow[:sections])
27
- dsl.instance_eval(&block) if block_given?
33
+ def section(name, &block)
34
+ dsl = SectionDsl.new(@workflow, name, @current_section_order)
28
35
  @current_section_order += 1
36
+ dsl.instance_eval(&block) if block_given?
37
+ dsl
29
38
  end
30
39
  end
31
40
  end
@@ -22,7 +22,7 @@ module Ad
22
22
  # puts step.input_attributes.first
23
23
  # An ERROR here means you have not configured an attribute name
24
24
  log.kv 'Input Attributes', step.input_attributes.map { |ia| ia.attribute.name }.join(', ')
25
- log.kv 'Output Attributes', step.output_attributes.map { |oa| oa.attribute.name }.join(', ')
25
+ log.kv 'Output Attributes', step.output_attributes.map { |oa| oa.attribute&.name }.join(', ')
26
26
  end
27
27
  end
28
28
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ad
4
4
  module AgentArchitecture
5
- VERSION = '0.0.11'
5
+ VERSION = '0.0.12'
6
6
  end
7
7
  end
@@ -13,10 +13,12 @@ Ad::AgentArchitecture::Database::CreateSchema.new(DB).execute
13
13
 
14
14
  require 'ad/agent_architecture/database/models'
15
15
  require 'ad/agent_architecture/database/sql_query'
16
+ require 'ad/agent_architecture/dsl/child_dsl'
16
17
  require 'ad/agent_architecture/dsl/attribute_dsl'
17
18
  require 'ad/agent_architecture/dsl/prompt_dsl'
18
19
  require 'ad/agent_architecture/dsl/section_dsl'
19
20
  require 'ad/agent_architecture/dsl/step_dsl'
21
+ require 'ad/agent_architecture/dsl/settings_dsl'
20
22
  require 'ad/agent_architecture/dsl/workflow_dsl'
21
23
  require 'ad/agent_architecture/dsl/agent_dsl'
22
24
  require 'ad/agent_architecture/dsl/actions/save_database'
@@ -25,15 +27,25 @@ require 'ad/agent_architecture/dsl/actions/save_yaml'
25
27
  require 'ad/agent_architecture/report/workflow_detail_report'
26
28
  require 'ad/agent_architecture/report/workflow_list_report'
27
29
 
28
- # Alias'
30
+ # AgentDsl Alias
29
31
  Agent = Ad::AgentArchitecture::Dsl::AgentDsl
30
32
 
31
33
  module Ad
34
+ # Module for the Agent Architecture gem
32
35
  module AgentArchitecture
33
36
  # raise Ad::AgentArchitecture::Error, 'Sample message'
34
37
  Error = Class.new(StandardError)
35
38
 
36
- # Your code goes here...
39
+ # Define the root path of the gem
40
+ ROOT_PATH = Pathname.new(File.expand_path('../..', __dir__))
41
+
42
+ def self.gem_root
43
+ ROOT_PATH
44
+ end
45
+
46
+ def self.gem_relative_file(*args)
47
+ File.join(ROOT_PATH, *args)
48
+ end
37
49
  end
38
50
  end
39
51
 
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ad-agent_architecture",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "ad-agent_architecture",
9
- "version": "0.0.11",
9
+ "version": "0.0.12",
10
10
  "devDependencies": {
11
11
  "@klueless-js/semantic-release-rubygem": "github:klueless-js/semantic-release-rubygem",
12
12
  "@semantic-release/changelog": "^6.0.3",
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ad-agent_architecture",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Architecture/Schema for AI Agents",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad-agent_architecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-06-29 00:00:00.000000000 Z
11
+ date: 2024-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: k_log
@@ -89,8 +89,10 @@ files:
89
89
  - lib/ad/agent_architecture/dsl/agent_dsl.rb
90
90
  - lib/ad/agent_architecture/dsl/agent_workflow_dsl.rb.old
91
91
  - lib/ad/agent_architecture/dsl/attribute_dsl.rb
92
+ - lib/ad/agent_architecture/dsl/child_dsl.rb
92
93
  - lib/ad/agent_architecture/dsl/prompt_dsl.rb
93
94
  - lib/ad/agent_architecture/dsl/section_dsl.rb
95
+ - lib/ad/agent_architecture/dsl/settings_dsl.rb
94
96
  - lib/ad/agent_architecture/dsl/step_dsl.rb
95
97
  - lib/ad/agent_architecture/dsl/workflow_dsl.rb
96
98
  - lib/ad/agent_architecture/report/workflow_detail_report.rb