ad-agent_architecture 0.0.7 → 0.0.8

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: 25616fff163424e27ea21bf76cabec403e7113c7b018e791ed42fe523e7964aa
4
- data.tar.gz: a34ad7c9d1275dc3db2394623874408225b67ab6a1a6d39bf0f2b46fafc7608f
3
+ metadata.gz: 4f028f265371e8a636e96ebbd94eb147d157133faac830fb212e6d7863cff2e0
4
+ data.tar.gz: cb6231c112e8788b82f19325ad54716b03fed23905435716aa1592967b9f8f48
5
5
  SHA512:
6
- metadata.gz: f2acf82a7726aa7168e595cac40238e79e634a2a396c93899ab30394494bae8ba3d96e1a843e27a4a826e18c96fefbc290cd34ae4592dbdd24a83a7a12ec0734
7
- data.tar.gz: 6f7948ae17ac536b0608e5063d6b61411ea74408d5cbdc8007772e6dab32d372b5c714f5a31ff19043958513094a5e9322661bbff41fca466f81ee86e21eacc8
6
+ metadata.gz: 873afb3fa43cfba38266711436db58c76b8d83202f7926c6be23be7799c059b8de94715a8f68df3ef71c20a519215e1173bcd8eb3ddfb8c0cffe70d958270fb4
7
+ data.tar.gz: 794d569604a03b43a85aeadcfd42f566c7bba8e746445d69d30cae7bf6362c2d1a2e48a2967d8018b3fe3ce0aa9d1b539787f7a73a7d908a12a6d2343b5429a4
data/.rubocop.yml CHANGED
@@ -14,7 +14,7 @@ AllCops:
14
14
  Exclude:
15
15
  - ".builders/**/*"
16
16
  - "spec/samples/**/*"
17
- - "lib/ad/agent_architecture/db/*"
17
+ - "lib/ad/agent_architecture/database/*"
18
18
 
19
19
  Metrics/BlockLength:
20
20
  Exclude:
@@ -44,6 +44,7 @@ Metrics/MethodLength:
44
44
  Max: 25
45
45
  Exclude:
46
46
  - "lib/ad/agent_architecture/dsl/*"
47
+ - "lib/ad/agent_architecture/database/*"
47
48
 
48
49
  Layout/LineLength:
49
50
  Max: 200
@@ -92,6 +93,8 @@ Style/AccessorGrouping:
92
93
  Metrics/AbcSize:
93
94
  Exclude:
94
95
  - "lib/ad/agent_architecture/dsl/*"
96
+ - "lib/ad/agent_architecture/database/*"
97
+ - "lib/ad/agent_architecture/report/*"
95
98
  Metrics/NoExpectationExample:
96
99
  Exclude:
97
100
  - "spec/ad/agent_architecture/dsl/*"
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [0.0.7](https://github.com/appydave/ad-agent_architecture/compare/v0.0.6...v0.0.7) (2024-06-29)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add basic support for database persistence to DSL ([632c815](https://github.com/appydave/ad-agent_architecture/commit/632c815133b2cd31ab95dccb3c0b8564e25aa605))
7
+
1
8
  ## [0.0.6](https://github.com/appydave/ad-agent_architecture/compare/v0.0.5...v0.0.6) (2024-06-28)
2
9
 
3
10
 
@@ -3,6 +3,7 @@
3
3
  module Ad
4
4
  module AgentArchitecture
5
5
  module Database
6
+ # Save workflow graph to database
6
7
  class SaveWorkflowGraph
7
8
  def initialize(workflow_hash)
8
9
  @workflow_hash = workflow_hash
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ad
4
+ module AgentArchitecture
5
+ module Database
6
+ class SQLQuery
7
+ SQL_DIR = File.expand_path('../sql', __dir__)
8
+
9
+ def self.query(sql_filename, params = {})
10
+ sql_path = File.join(SQL_DIR, "#{sql_filename}.sql")
11
+
12
+ # puts "SQL_DIR: #{SQL_DIR}"
13
+ # puts "SQL Path: #{sql_path}"
14
+ raise "SQL file not found: #{sql_path}" unless File.exist?(sql_path)
15
+
16
+ sql = File.read(sql_path)
17
+ DB.fetch(sql, params)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'k_log'
4
+
5
+ module Ad
6
+ module AgentArchitecture
7
+ module Report
8
+ # Print workflow details
9
+ class WorkflowDetailReport
10
+ include KLog::Logging
11
+
12
+ def print(workflow)
13
+ log.section_heading 'Workflow Details Report'
14
+ log.kv 'Name', workflow.name
15
+ log.kv 'Description', workflow.description
16
+
17
+ workflow.sections.each do |section|
18
+ log.section_heading "Section: #{section.name}"
19
+ log.kv 'Order', section.order
20
+ section.steps.each do |step|
21
+ log.section_heading "Step: #{step.name}"
22
+ log.kv 'Order', step.order
23
+ log.kv 'Prompt', step.prompt
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(', ')
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'k_log'
4
+
5
+ module Ad
6
+ module AgentArchitecture
7
+ module Report
8
+ # Print workflow details
9
+ class WorkflowListReport
10
+ include KLog::Logging
11
+
12
+ def print
13
+ # tp query, :workflow_name, :workflow_description, :section_name, :section_description, :section_order, :step_name, :step_order, :step_prompt, :inputs, :outputs
14
+ tp query, :workflow_name, :workflow_description, :section_name, :step_name, :step_prompt, :inputs, :outputs
15
+ end
16
+
17
+ def query
18
+ Ad::AgentArchitecture::Database::SQLQuery.query(:workflow_details).map do |row|
19
+ row[:inputs] = JSON.parse(row[:inputs]) if row[:inputs]
20
+ row[:outputs] = JSON.parse(row[:outputs]) if row[:outputs]
21
+ row
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,35 @@
1
+ SELECT
2
+ workflows.id AS workflow_id,
3
+ workflows.name AS workflow_name,
4
+ workflows.description AS workflow_description,
5
+ sections.id AS section_id,
6
+ sections.name AS section_name,
7
+ sections.description AS section_description,
8
+ sections."order" AS section_order,
9
+ steps.id AS step_id,
10
+ steps.name AS step_name,
11
+ steps."order" AS step_order,
12
+ steps.prompt AS step_prompt,
13
+ json_group_array(
14
+ json_object(
15
+ 'name', input_attr.name,
16
+ 'type', input_attr.type,
17
+ 'is_array', input_attr.is_array
18
+ )
19
+ ) AS inputs,
20
+ json_group_array(
21
+ json_object(
22
+ 'name', output_attr.name,
23
+ 'type', output_attr.type,
24
+ 'is_array', output_attr.is_array
25
+ )
26
+ ) AS outputs
27
+ FROM workflows
28
+ LEFT JOIN sections ON workflows.id = sections.workflow_id
29
+ LEFT JOIN steps ON sections.id = steps.section_id
30
+ LEFT JOIN input_attributes ON steps.id = input_attributes.step_id
31
+ LEFT JOIN attributes AS input_attr ON input_attributes.attribute_id = input_attr.id
32
+ LEFT JOIN output_attributes ON steps.id = output_attributes.step_id
33
+ LEFT JOIN attributes AS output_attr ON output_attributes.attribute_id = output_attr.id
34
+ GROUP BY workflows.id, sections.id, steps.id
35
+ ORDER BY workflows.name, sections."order", steps."order";
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ad
4
4
  module AgentArchitecture
5
- VERSION = '0.0.7'
5
+ VERSION = '0.0.8'
6
6
  end
7
7
  end
@@ -2,16 +2,21 @@
2
2
 
3
3
  require 'sequel'
4
4
  require 'sqlite3'
5
+ require 'k_log'
5
6
 
6
7
  require 'ad/agent_architecture/version'
7
- require 'ad/agent_architecture/db/create_schema'
8
+ require 'ad/agent_architecture/database/create_schema'
8
9
 
9
10
  DB = Sequel.sqlite
10
11
 
11
12
  Ad::AgentArchitecture::Database::CreateSchema.new(DB).execute
12
13
 
13
- require 'ad/agent_architecture/db/models'
14
+ require 'ad/agent_architecture/database/models'
15
+ require 'ad/agent_architecture/database/sql_query'
16
+ require 'ad/agent_architecture/database/save_workflow_graph'
14
17
  require 'ad/agent_architecture/dsl/agent_workflow_dsl'
18
+ require 'ad/agent_architecture/report/workflow_detail_report'
19
+ require 'ad/agent_architecture/report/workflow_list_report'
15
20
 
16
21
  module Ad
17
22
  module AgentArchitecture
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "ad-agent_architecture",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "ad-agent_architecture",
9
- "version": "0.0.7",
9
+ "version": "0.0.8",
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.7",
3
+ "version": "0.0.8",
4
4
  "description": "Architecture/Schema for AI Agents",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ad-agent_architecture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Cruwys
@@ -80,10 +80,14 @@ files:
80
80
  - docs/requirements.md
81
81
  - docs/structure-youtube-script.yaml
82
82
  - lib/ad/agent_architecture.rb
83
- - lib/ad/agent_architecture/db/create_schema.rb
84
- - lib/ad/agent_architecture/db/models.rb
85
- - lib/ad/agent_architecture/db/save_workflow_graph.rb
83
+ - lib/ad/agent_architecture/database/create_schema.rb
84
+ - lib/ad/agent_architecture/database/models.rb
85
+ - lib/ad/agent_architecture/database/save_workflow_graph.rb
86
+ - lib/ad/agent_architecture/database/sql_query.rb
86
87
  - lib/ad/agent_architecture/dsl/agent_workflow_dsl.rb
88
+ - lib/ad/agent_architecture/report/workflow_detail_report.rb
89
+ - lib/ad/agent_architecture/report/workflow_list_report.rb
90
+ - lib/ad/agent_architecture/sql/workflow_details.sql
87
91
  - lib/ad/agent_architecture/version.rb
88
92
  - package-lock.json
89
93
  - package.json