ad-agent_architecture 0.0.17 → 0.0.18
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/ad/agent_architecture/dsl/agent_dsl.rb +3 -3
- data/lib/ad/agent_architecture/dsl/attribute_dsl.rb +3 -3
- data/lib/ad/agent_architecture/dsl/child_dsl.rb +7 -2
- data/lib/ad/agent_architecture/dsl/data_accessors.rb +38 -0
- data/lib/ad/agent_architecture/dsl/prompt_dsl.rb +2 -2
- data/lib/ad/agent_architecture/dsl/section_dsl.rb +1 -1
- data/lib/ad/agent_architecture/dsl/settings_dsl.rb +1 -1
- data/lib/ad/agent_architecture/dsl/step_dsl.rb +1 -0
- data/lib/ad/agent_architecture/dsl/workflow_dsl.rb +8 -6
- data/lib/ad/agent_architecture/version.rb +1 -1
- data/lib/ad/agent_architecture.rb +1 -0
- data/package-lock.json +2 -2
- data/package.json +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dac798e05760933625c449dbe26204f844588554476dd8d6ce32c443081881a9
|
4
|
+
data.tar.gz: 6b3fb54a748dbcf5a33b56e6de0c80b910ea429f67e31fbeaf7bf46c7dbb1de8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b959b1130a64ef8956c35e98745bea434b6639b04c5796e53cb6ba8d91f2871377e45d5a439f024c0236e31d367d8d21ad3622b9641b8c5ad4eb4bddafafe34
|
7
|
+
data.tar.gz: b1d59d4aa15a2b85005c50098d42fef5d2ce32b08cb2b19183df0bc8f7e7f8299f8fb1a8bab311b329818c9f0679f95965fd8c3efc236561d27c7da2d47a8501
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.0.17](https://github.com/appydave/ad-agent_architecture/compare/v0.0.16...v0.0.17) (2024-07-03)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* cops ([36d85fc](https://github.com/appydave/ad-agent_architecture/commit/36d85fc622eaf609c12bbf2c2d81fd25daa17915))
|
7
|
+
* update project plan ([eaf460d](https://github.com/appydave/ad-agent_architecture/commit/eaf460d5c12ec1383f47fd38ab76135f3d844b54))
|
8
|
+
|
1
9
|
## [0.0.16](https://github.com/appydave/ad-agent_architecture/compare/v0.0.15...v0.0.16) (2024-07-03)
|
2
10
|
|
3
11
|
|
@@ -38,21 +38,21 @@ module Ad
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def save
|
41
|
-
Ad::AgentArchitecture::Dsl::Actions::SaveDatabase.new(@workflow.
|
41
|
+
Ad::AgentArchitecture::Dsl::Actions::SaveDatabase.new(@workflow.data).save
|
42
42
|
|
43
43
|
self
|
44
44
|
end
|
45
45
|
|
46
46
|
def save_json(file_name = nil)
|
47
47
|
full_file_name = file_name || 'workflow.json'
|
48
|
-
Ad::AgentArchitecture::Dsl::Actions::SaveJson.new(@workflow.
|
48
|
+
Ad::AgentArchitecture::Dsl::Actions::SaveJson.new(@workflow.data).save(full_file_name)
|
49
49
|
|
50
50
|
self
|
51
51
|
end
|
52
52
|
|
53
53
|
def save_yaml(file_name = nil)
|
54
54
|
full_file_name = file_name || 'workflow.yaml'
|
55
|
-
Ad::AgentArchitecture::Dsl::Actions::SaveYaml.new(@workflow.
|
55
|
+
Ad::AgentArchitecture::Dsl::Actions::SaveYaml.new(@workflow.data).save(full_file_name)
|
56
56
|
|
57
57
|
self
|
58
58
|
end
|
@@ -8,17 +8,17 @@ module Ad
|
|
8
8
|
def attribute(name, type:, is_array: false)
|
9
9
|
raise ArgumentError, 'Attribute name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)
|
10
10
|
|
11
|
-
|
11
|
+
attributes[name] = { name: name, type: type, is_array: is_array }
|
12
12
|
end
|
13
13
|
|
14
14
|
def infer_attribute(name)
|
15
15
|
raise ArgumentError, 'Attribute name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)
|
16
16
|
|
17
|
-
return if
|
17
|
+
return if attributes.key?(name)
|
18
18
|
|
19
19
|
# May want to add more sophisticated type inference here
|
20
20
|
type = name.to_s.end_with?('s') ? 'array' : 'string'
|
21
|
-
|
21
|
+
attributes[name] = { name: name, type: type, is_array: type == 'array' }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -5,10 +5,15 @@ module Ad
|
|
5
5
|
module Dsl
|
6
6
|
# This is the base class for all child DSLs
|
7
7
|
class ChildDsl
|
8
|
+
include DataAccessors
|
8
9
|
attr_reader :workflow
|
9
10
|
|
10
|
-
def initialize(
|
11
|
-
@workflow =
|
11
|
+
def initialize(workflow_dsl)
|
12
|
+
@workflow = workflow_dsl
|
13
|
+
end
|
14
|
+
|
15
|
+
def data
|
16
|
+
@workflow.data
|
12
17
|
end
|
13
18
|
end
|
14
19
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ad
|
4
|
+
module AgentArchitecture
|
5
|
+
module Dsl
|
6
|
+
# Helper methods for accessing data in the workflow DSL
|
7
|
+
module DataAccessors
|
8
|
+
def settings
|
9
|
+
data[:settings]
|
10
|
+
end
|
11
|
+
|
12
|
+
def sections
|
13
|
+
data[:sections]
|
14
|
+
end
|
15
|
+
|
16
|
+
def get_setting(name)
|
17
|
+
settings[name.to_sym] || settings[name.to_s]
|
18
|
+
end
|
19
|
+
|
20
|
+
def attributes
|
21
|
+
data[:attributes]
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_attribute(name)
|
25
|
+
attributes[name.to_sym] || attributes[name.to_s]
|
26
|
+
end
|
27
|
+
|
28
|
+
def prompts
|
29
|
+
data[:prompts]
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_prompt(name)
|
33
|
+
prompts[name.to_sym] || prompts[name.to_s]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -8,11 +8,11 @@ module Ad
|
|
8
8
|
def prompt(name, path: nil, content: nil)
|
9
9
|
raise ArgumentError, 'Prompt name must be a string or symbol' unless name.is_a?(String) || name.is_a?(Symbol)
|
10
10
|
|
11
|
-
|
11
|
+
prompts[name] = { name: name, content: content }
|
12
12
|
end
|
13
13
|
|
14
14
|
def prompt_file(file)
|
15
|
-
prompt_path =
|
15
|
+
prompt_path = settings[:prompt_path]
|
16
16
|
raise 'Prompt path not defined in settings. Set "prompt_path" to the path where you are keping prompts' unless prompt_path
|
17
17
|
|
18
18
|
full_path = File.join(prompt_path, file)
|
@@ -5,33 +5,35 @@ module Ad
|
|
5
5
|
module Dsl
|
6
6
|
# This class is responsible for defining the workflow DSL
|
7
7
|
class WorkflowDsl
|
8
|
-
|
8
|
+
include DataAccessors
|
9
|
+
|
10
|
+
attr_reader :data
|
9
11
|
|
10
12
|
def initialize(name)
|
11
|
-
@
|
13
|
+
@data = { name: name, sections: [], attributes: {}, prompts: {}, settings: {} }
|
12
14
|
@current_section_order = 1
|
13
15
|
end
|
14
16
|
|
15
17
|
def settings(&block)
|
16
|
-
dsl = SettingsDsl.new(
|
18
|
+
dsl = SettingsDsl.new(self)
|
17
19
|
dsl.instance_eval(&block) if block_given?
|
18
20
|
dsl
|
19
21
|
end
|
20
22
|
|
21
23
|
def attributes(&block)
|
22
|
-
dsl = AttributeDsl.new(
|
24
|
+
dsl = AttributeDsl.new(self)
|
23
25
|
dsl.instance_eval(&block) if block_given?
|
24
26
|
dsl
|
25
27
|
end
|
26
28
|
|
27
29
|
def prompts(&block)
|
28
|
-
dsl = PromptDsl.new(
|
30
|
+
dsl = PromptDsl.new(self)
|
29
31
|
dsl.instance_eval(&block) if block_given?
|
30
32
|
dsl
|
31
33
|
end
|
32
34
|
|
33
35
|
def section(name, &block)
|
34
|
-
dsl = SectionDsl.new(
|
36
|
+
dsl = SectionDsl.new(self, name, @current_section_order)
|
35
37
|
@current_section_order += 1
|
36
38
|
dsl.instance_eval(&block) if block_given?
|
37
39
|
dsl
|
@@ -13,6 +13,7 @@ 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/data_accessors'
|
16
17
|
require 'ad/agent_architecture/dsl/child_dsl'
|
17
18
|
require 'ad/agent_architecture/dsl/attribute_dsl'
|
18
19
|
require 'ad/agent_architecture/dsl/prompt_dsl'
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "ad-agent_architecture",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.18",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "ad-agent_architecture",
|
9
|
-
"version": "0.0.
|
9
|
+
"version": "0.0.18",
|
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
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.
|
4
|
+
version: 0.0.18
|
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-07-
|
11
|
+
date: 2024-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: k_log
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- lib/ad/agent_architecture/dsl/agent_dsl.rb
|
97
97
|
- lib/ad/agent_architecture/dsl/attribute_dsl.rb
|
98
98
|
- lib/ad/agent_architecture/dsl/child_dsl.rb
|
99
|
+
- lib/ad/agent_architecture/dsl/data_accessors.rb
|
99
100
|
- lib/ad/agent_architecture/dsl/prompt_dsl.rb
|
100
101
|
- lib/ad/agent_architecture/dsl/section_dsl.rb
|
101
102
|
- lib/ad/agent_architecture/dsl/settings_dsl.rb
|