a2a-ruby 1.0.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.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +137 -0
  4. data/.simplecov +46 -0
  5. data/.yardopts +10 -0
  6. data/CHANGELOG.md +33 -0
  7. data/CODE_OF_CONDUCT.md +128 -0
  8. data/CONTRIBUTING.md +165 -0
  9. data/Gemfile +43 -0
  10. data/Guardfile +34 -0
  11. data/LICENSE.txt +21 -0
  12. data/PUBLISHING_CHECKLIST.md +214 -0
  13. data/README.md +171 -0
  14. data/Rakefile +165 -0
  15. data/docs/agent_execution.md +309 -0
  16. data/docs/api_reference.md +792 -0
  17. data/docs/configuration.md +780 -0
  18. data/docs/events.md +475 -0
  19. data/docs/getting_started.md +668 -0
  20. data/docs/integration.md +262 -0
  21. data/docs/server_apps.md +621 -0
  22. data/docs/troubleshooting.md +765 -0
  23. data/lib/a2a/client/api_methods.rb +263 -0
  24. data/lib/a2a/client/auth/api_key.rb +161 -0
  25. data/lib/a2a/client/auth/interceptor.rb +288 -0
  26. data/lib/a2a/client/auth/jwt.rb +189 -0
  27. data/lib/a2a/client/auth/oauth2.rb +146 -0
  28. data/lib/a2a/client/auth.rb +137 -0
  29. data/lib/a2a/client/base.rb +316 -0
  30. data/lib/a2a/client/config.rb +210 -0
  31. data/lib/a2a/client/connection_pool.rb +233 -0
  32. data/lib/a2a/client/http_client.rb +524 -0
  33. data/lib/a2a/client/json_rpc_handler.rb +136 -0
  34. data/lib/a2a/client/middleware/circuit_breaker_interceptor.rb +245 -0
  35. data/lib/a2a/client/middleware/logging_interceptor.rb +371 -0
  36. data/lib/a2a/client/middleware/rate_limit_interceptor.rb +142 -0
  37. data/lib/a2a/client/middleware/retry_interceptor.rb +161 -0
  38. data/lib/a2a/client/middleware.rb +116 -0
  39. data/lib/a2a/client/performance_tracker.rb +60 -0
  40. data/lib/a2a/configuration/defaults.rb +34 -0
  41. data/lib/a2a/configuration/environment_loader.rb +76 -0
  42. data/lib/a2a/configuration/file_loader.rb +115 -0
  43. data/lib/a2a/configuration/inheritance.rb +101 -0
  44. data/lib/a2a/configuration/validator.rb +180 -0
  45. data/lib/a2a/configuration.rb +201 -0
  46. data/lib/a2a/errors.rb +291 -0
  47. data/lib/a2a/modules.rb +50 -0
  48. data/lib/a2a/monitoring/alerting.rb +490 -0
  49. data/lib/a2a/monitoring/distributed_tracing.rb +398 -0
  50. data/lib/a2a/monitoring/health_endpoints.rb +204 -0
  51. data/lib/a2a/monitoring/metrics_collector.rb +438 -0
  52. data/lib/a2a/monitoring.rb +463 -0
  53. data/lib/a2a/plugin.rb +358 -0
  54. data/lib/a2a/plugin_manager.rb +159 -0
  55. data/lib/a2a/plugins/example_auth.rb +81 -0
  56. data/lib/a2a/plugins/example_middleware.rb +118 -0
  57. data/lib/a2a/plugins/example_transport.rb +76 -0
  58. data/lib/a2a/protocol/agent_card.rb +8 -0
  59. data/lib/a2a/protocol/agent_card_server.rb +584 -0
  60. data/lib/a2a/protocol/capability.rb +496 -0
  61. data/lib/a2a/protocol/json_rpc.rb +254 -0
  62. data/lib/a2a/protocol/message.rb +8 -0
  63. data/lib/a2a/protocol/task.rb +8 -0
  64. data/lib/a2a/rails/a2a_controller.rb +258 -0
  65. data/lib/a2a/rails/controller_helpers.rb +499 -0
  66. data/lib/a2a/rails/engine.rb +167 -0
  67. data/lib/a2a/rails/generators/agent_generator.rb +311 -0
  68. data/lib/a2a/rails/generators/install_generator.rb +209 -0
  69. data/lib/a2a/rails/generators/migration_generator.rb +232 -0
  70. data/lib/a2a/rails/generators/templates/add_a2a_indexes.rb +57 -0
  71. data/lib/a2a/rails/generators/templates/agent_controller.rb +122 -0
  72. data/lib/a2a/rails/generators/templates/agent_controller_spec.rb +160 -0
  73. data/lib/a2a/rails/generators/templates/agent_readme.md +200 -0
  74. data/lib/a2a/rails/generators/templates/create_a2a_push_notification_configs.rb +68 -0
  75. data/lib/a2a/rails/generators/templates/create_a2a_tasks.rb +83 -0
  76. data/lib/a2a/rails/generators/templates/example_agent_controller.rb +228 -0
  77. data/lib/a2a/rails/generators/templates/initializer.rb +108 -0
  78. data/lib/a2a/rails/generators/templates/push_notification_config_model.rb +228 -0
  79. data/lib/a2a/rails/generators/templates/task_model.rb +200 -0
  80. data/lib/a2a/rails/tasks/a2a.rake +228 -0
  81. data/lib/a2a/server/a2a_methods.rb +520 -0
  82. data/lib/a2a/server/agent.rb +537 -0
  83. data/lib/a2a/server/agent_execution/agent_executor.rb +279 -0
  84. data/lib/a2a/server/agent_execution/request_context.rb +219 -0
  85. data/lib/a2a/server/apps/rack_app.rb +311 -0
  86. data/lib/a2a/server/apps/sinatra_app.rb +261 -0
  87. data/lib/a2a/server/default_request_handler.rb +350 -0
  88. data/lib/a2a/server/events/event_consumer.rb +116 -0
  89. data/lib/a2a/server/events/event_queue.rb +226 -0
  90. data/lib/a2a/server/example_agent.rb +248 -0
  91. data/lib/a2a/server/handler.rb +281 -0
  92. data/lib/a2a/server/middleware/authentication_middleware.rb +212 -0
  93. data/lib/a2a/server/middleware/cors_middleware.rb +171 -0
  94. data/lib/a2a/server/middleware/logging_middleware.rb +362 -0
  95. data/lib/a2a/server/middleware/rate_limit_middleware.rb +382 -0
  96. data/lib/a2a/server/middleware.rb +213 -0
  97. data/lib/a2a/server/push_notification_manager.rb +327 -0
  98. data/lib/a2a/server/request_handler.rb +136 -0
  99. data/lib/a2a/server/storage/base.rb +141 -0
  100. data/lib/a2a/server/storage/database.rb +266 -0
  101. data/lib/a2a/server/storage/memory.rb +274 -0
  102. data/lib/a2a/server/storage/redis.rb +320 -0
  103. data/lib/a2a/server/storage.rb +38 -0
  104. data/lib/a2a/server/task_manager.rb +534 -0
  105. data/lib/a2a/transport/grpc.rb +481 -0
  106. data/lib/a2a/transport/http.rb +415 -0
  107. data/lib/a2a/transport/sse.rb +499 -0
  108. data/lib/a2a/types/agent_card.rb +540 -0
  109. data/lib/a2a/types/artifact.rb +99 -0
  110. data/lib/a2a/types/base_model.rb +223 -0
  111. data/lib/a2a/types/events.rb +117 -0
  112. data/lib/a2a/types/message.rb +106 -0
  113. data/lib/a2a/types/part.rb +288 -0
  114. data/lib/a2a/types/push_notification.rb +139 -0
  115. data/lib/a2a/types/security.rb +167 -0
  116. data/lib/a2a/types/task.rb +154 -0
  117. data/lib/a2a/types.rb +88 -0
  118. data/lib/a2a/utils/helpers.rb +245 -0
  119. data/lib/a2a/utils/message_buffer.rb +278 -0
  120. data/lib/a2a/utils/performance.rb +247 -0
  121. data/lib/a2a/utils/rails_detection.rb +97 -0
  122. data/lib/a2a/utils/structured_logger.rb +306 -0
  123. data/lib/a2a/utils/time_helpers.rb +167 -0
  124. data/lib/a2a/utils/validation.rb +8 -0
  125. data/lib/a2a/version.rb +6 -0
  126. data/lib/a2a-rails.rb +58 -0
  127. data/lib/a2a.rb +198 -0
  128. metadata +437 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c71377405a82ac9efb791ae5c4e48074f193d77c4386ea7b0aac7787f38d4d60
4
+ data.tar.gz: 40dae6264c406b175eda797c6748630c122e24af58c1473792805b1d423f78c1
5
+ SHA512:
6
+ metadata.gz: 03b6d5477fc84375dabf6f84cc86190aa989cd34e9d11b361cf834dd745e1db5c8bd66b9f5510b85b05299ecec2e1b3f4c551ff763ae52fc75783f88a717aa21
7
+ data.tar.gz: 5362b66afd823baaff6f57e7bd182acb62708aa8de6ce6b4ee2e826e7642631b5b83840f7106fc2c5c24220819985c4807cd860e7aaeee82ba917564f1192fba
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,137 @@
1
+ # RuboCop configuration for A2A Ruby gem
2
+ # Simple and practical configuration without problematic plugins
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 3.0
6
+ NewCops: enable
7
+ SuggestExtensions: false
8
+ Exclude:
9
+ - 'vendor/**/*'
10
+ - 'tmp/**/*'
11
+ - 'bin/**/*'
12
+ - 'node_modules/**/*'
13
+ - 'db/schema.rb'
14
+ - '.git/**/*'
15
+ - 'spec/**/*' # Skip all spec files to avoid RSpec plugin issues
16
+ - 'lib/a2a/rails/generators/templates/**/*' # Skip ERB templates
17
+
18
+ # Layout and formatting
19
+ Layout/LineLength:
20
+ Max: 130 # Allow slightly longer lines for complex expressions
21
+ Exclude:
22
+ - '*.gemspec'
23
+
24
+ # Style rules - be practical
25
+ Style/Documentation:
26
+ Enabled: false
27
+
28
+ Style/StringLiterals:
29
+ EnforcedStyle: double_quotes
30
+
31
+ Style/FrozenStringLiteralComment:
32
+ Enabled: true
33
+ EnforcedStyle: always
34
+
35
+ # Metrics - be realistic for complex gem
36
+ Metrics/BlockLength:
37
+ Max: 50
38
+ Exclude:
39
+ - '*.gemspec'
40
+ - 'config/**/*'
41
+ - 'lib/a2a/rails/tasks/**/*'
42
+
43
+ Metrics/AbcSize:
44
+ Max: 50
45
+ Exclude:
46
+ - 'lib/a2a/transport/**/*' # Transport layer can be complex
47
+ - 'lib/a2a/protocol/**/*' # Protocol implementation can be complex
48
+
49
+ Metrics/ClassLength:
50
+ Max: 300
51
+ Exclude:
52
+ - 'lib/a2a/rails/generators/**/*'
53
+
54
+ Metrics/MethodLength:
55
+ Max: 50
56
+ Exclude:
57
+ - 'lib/a2a/transport/**/*'
58
+ - 'lib/a2a/protocol/**/*'
59
+ - 'lib/a2a/server/**/*'
60
+
61
+ Metrics/CyclomaticComplexity:
62
+ Max: 20
63
+ Exclude:
64
+ - 'lib/a2a/transport/**/*'
65
+ - 'lib/a2a/protocol/**/*'
66
+ - 'lib/a2a/client/**/*'
67
+
68
+ Metrics/PerceivedComplexity:
69
+ Max: 20
70
+ Exclude:
71
+ - 'lib/a2a/transport/**/*'
72
+ - 'lib/a2a/protocol/**/*'
73
+ - 'lib/a2a/client/**/*'
74
+
75
+ Metrics/ModuleLength:
76
+ Max: 300
77
+ Exclude:
78
+ - 'lib/a2a/rails/**/*' # Rails helpers can be longer
79
+
80
+ Metrics/ParameterLists:
81
+ Max: 10 # Allow more parameters for complex constructors
82
+ Exclude:
83
+ - 'lib/a2a/types/**/*' # Type constructors can have many parameters
84
+ - 'lib/a2a/client/**/*' # Client classes can have many config parameters
85
+ - 'lib/a2a/protocol/**/*' # Protocol classes can have many parameters
86
+
87
+ # Naming rules
88
+ Naming/FileName:
89
+ Exclude:
90
+ - 'lib/a2a-rails.rb' # Allow this specific file name
91
+
92
+ # Gemspec rules
93
+ Gemspec/DevelopmentDependencies:
94
+ Enabled: false # Allow dev dependencies in gemspec
95
+
96
+ Gemspec/RequiredRubyVersion:
97
+ Enabled: false # Allow different Ruby version requirements
98
+
99
+ # Lint rules - be practical
100
+ Lint/MissingSuper:
101
+ Enabled: false # Many classes intentionally don't call super
102
+
103
+ Lint/DuplicateBranch:
104
+ Enabled: false # Sometimes duplicate branches are clearer
105
+
106
+ Lint/DuplicateMethods:
107
+ Enabled: false # Allow method redefinition in some cases
108
+
109
+ Lint/IneffectiveAccessModifier:
110
+ Enabled: false # Allow flexible access modifiers
111
+
112
+ Lint/HashCompareByIdentity:
113
+ Enabled: false # Allow object_id as hash keys where needed
114
+
115
+ # Syntax errors must be fixed manually
116
+
117
+ # Naming rules - be flexible
118
+ Naming/AccessorMethodName:
119
+ Enabled: false # Allow get_/set_ prefixes
120
+
121
+ Naming/PredicatePrefix:
122
+ Enabled: false # Allow has_ prefixes
123
+
124
+ Naming/PredicateMethod:
125
+ Enabled: false # Allow validate_ methods
126
+
127
+ # Style rules - be practical
128
+ Style/OptionalBooleanParameter:
129
+ Enabled: false # Allow boolean default parameters
130
+
131
+ Style/EmptyElse:
132
+ Enabled: false # Sometimes empty else is clearer
133
+
134
+ Style/RedundantCondition:
135
+ Enabled: false # Sometimes redundant conditions are clearer
136
+
137
+ # Performance rules removed - require rubocop-performance plugin
data/.simplecov ADDED
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SimpleCov configuration for A2A Ruby SDK
4
+ # Following a2a-python coverage patterns
5
+
6
+ require "simplecov-lcov"
7
+
8
+ SimpleCov.start do
9
+ # Output formats
10
+ if ENV["CI"]
11
+ formatter SimpleCov::Formatter::LcovFormatter
12
+ else
13
+ formatter SimpleCov::Formatter::MultiFormatter.new([
14
+ SimpleCov::Formatter::HTMLFormatter,
15
+ SimpleCov::Formatter::LcovFormatter
16
+ ])
17
+ end
18
+
19
+ # Coverage tracking
20
+ enable_coverage :branch
21
+ primary_coverage :line
22
+
23
+ # Filters
24
+ add_filter "/spec/"
25
+ add_filter "/test/"
26
+ add_filter "/vendor/"
27
+ add_filter "/tmp/"
28
+ add_filter "/coverage/"
29
+ add_filter "/.bundle/"
30
+
31
+ # Groups (matching a2a-python structure)
32
+ add_group "Types", "lib/a2a/types"
33
+ add_group "Protocol", "lib/a2a/protocol"
34
+ add_group "Client", "lib/a2a/client"
35
+ add_group "Server", "lib/a2a/server"
36
+ add_group "Transport", "lib/a2a/transport"
37
+ add_group "Utils", "lib/a2a/utils"
38
+ add_group "Rails", "lib/a2a/rails"
39
+
40
+ # Coverage thresholds (will be raised as implementation progresses)
41
+ minimum_coverage 50
42
+ minimum_coverage_by_file 5
43
+
44
+ # Refuse to merge results older than 8 hours
45
+ merge_timeout 28_800
46
+ end
data/.yardopts ADDED
@@ -0,0 +1,10 @@
1
+ --markup markdown
2
+ --markup-provider kramdown
3
+ --output-dir doc
4
+ --protected
5
+ --private
6
+ lib/**/*.rb
7
+ -
8
+ README.md
9
+ CHANGELOG.md
10
+ LICENSE.txt
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2025-09-15
9
+
10
+ ### Added
11
+ - Complete A2A Protocol v0.3.0 implementation
12
+ - JSON-RPC 2.0 client and server support
13
+ - Agent card generation and discovery system
14
+ - Task lifecycle management with push notifications
15
+ - Multiple transport protocols (JSON-RPC, gRPC, HTTP+JSON)
16
+ - Real-time streaming with Server-Sent Events
17
+ - Authentication strategies (OAuth 2.0, JWT, API Key, mTLS)
18
+ - Rails engine with generators and middleware
19
+ - Comprehensive error handling and validation
20
+ - Performance optimizations and monitoring
21
+ - Production-ready logging and metrics
22
+ - Type-safe protocol implementation with validation
23
+
24
+ ### Features
25
+ - **Client Components**: HTTP client with streaming, authentication, middleware
26
+ - **Server Components**: Agent DSL, request handling, middleware system
27
+ - **Task Management**: Complete lifecycle, persistence, push notifications
28
+ - **Transport Layer**: HTTP, SSE, optional gRPC support
29
+ - **Rails Integration**: Engine, generators, controller helpers
30
+ - **Configuration**: Flexible configuration system with environment support
31
+ - **Monitoring**: Health checks, metrics collection, structured logging
32
+ - **Testing**: Comprehensive test suite with compliance tests
33
+ - **Documentation**: Complete API documentation and integration guides
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ team@a2a-ruby.org.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,165 @@
1
+ # Contributing to A2A Ruby SDK
2
+
3
+ We love your input! We want to make contributing to the A2A Ruby SDK as easy and transparent as possible, whether it's:
4
+
5
+ - Reporting a bug
6
+ - Discussing the current state of the code
7
+ - Submitting a fix
8
+ - Proposing new features
9
+ - Becoming a maintainer
10
+
11
+ ## Development Process
12
+
13
+ We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
14
+
15
+ 1. Fork the repo and create your branch from `main`.
16
+ 2. If you've added code that should be tested, add tests.
17
+ 3. If you've changed APIs, update the documentation.
18
+ 4. Ensure the test suite passes.
19
+ 5. Make sure your code lints.
20
+ 6. Issue that pull request!
21
+
22
+ ## Setting Up Development Environment
23
+
24
+ 1. **Clone the repository:**
25
+ ```bash
26
+ git clone https://github.com/a2aproject/a2a-ruby.git
27
+ cd a2a-ruby
28
+ ```
29
+
30
+ 2. **Install dependencies:**
31
+ ```bash
32
+ bin/setup
33
+ ```
34
+
35
+ 3. **Run tests:**
36
+ ```bash
37
+ bundle exec rspec
38
+ ```
39
+
40
+ 4. **Run linting:**
41
+ ```bash
42
+ bundle exec rubocop
43
+ ```
44
+
45
+ 5. **Start console:**
46
+ ```bash
47
+ bin/console
48
+ ```
49
+
50
+ ## Code Style
51
+
52
+ We use RuboCop to maintain consistent code style. Please ensure your code follows our style guide:
53
+
54
+ ```bash
55
+ # Check style
56
+ bundle exec rubocop
57
+
58
+ # Auto-fix issues
59
+ bundle exec rubocop -a
60
+ ```
61
+
62
+ ## Testing
63
+
64
+ We use RSpec for testing. Please ensure:
65
+
66
+ - All new features have corresponding tests
67
+ - All tests pass before submitting PR
68
+ - Maintain or improve code coverage
69
+
70
+ ```bash
71
+ # Run all tests
72
+ bundle exec rspec
73
+
74
+ # Run specific test file
75
+ bundle exec rspec spec/a2a/client_spec.rb
76
+
77
+ # Run with coverage
78
+ COVERAGE=true bundle exec rspec
79
+ ```
80
+
81
+ ## Documentation
82
+
83
+ - Update relevant documentation for any API changes
84
+ - Add YARD comments for new public methods
85
+ - Update README.md if needed
86
+ - Add examples for new features
87
+
88
+ Generate documentation:
89
+ ```bash
90
+ bundle exec yard doc
91
+ ```
92
+
93
+ ## Pull Request Process
94
+
95
+ 1. **Create a feature branch:**
96
+ ```bash
97
+ git checkout -b feature/amazing-feature
98
+ ```
99
+
100
+ 2. **Make your changes and commit:**
101
+ ```bash
102
+ git commit -m "Add amazing feature"
103
+ ```
104
+
105
+ 3. **Push to your fork:**
106
+ ```bash
107
+ git push origin feature/amazing-feature
108
+ ```
109
+
110
+ 4. **Create a Pull Request** with:
111
+ - Clear title and description
112
+ - Reference any related issues
113
+ - Include tests for new functionality
114
+ - Update documentation as needed
115
+
116
+ ## Reporting Bugs
117
+
118
+ We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/a2aproject/a2a-ruby/issues).
119
+
120
+ **Great Bug Reports** tend to have:
121
+
122
+ - A quick summary and/or background
123
+ - Steps to reproduce
124
+ - Be specific!
125
+ - Give sample code if you can
126
+ - What you expected would happen
127
+ - What actually happens
128
+ - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
129
+
130
+ ## Feature Requests
131
+
132
+ We welcome feature requests! Please:
133
+
134
+ 1. Check if the feature already exists or is planned
135
+ 2. Open an issue with the `enhancement` label
136
+ 3. Describe the feature and its use case
137
+ 4. Discuss the implementation approach
138
+
139
+ ## Versioning
140
+
141
+ We use [Semantic Versioning](http://semver.org/). For the versions available, see the [tags on this repository](https://github.com/a2aproject/a2a-ruby/tags).
142
+
143
+ ## Release Process
144
+
145
+ 1. Update version in `lib/a2a/version.rb`
146
+ 2. Update `CHANGELOG.md`
147
+ 3. Create a pull request
148
+ 4. After merge, create a release tag
149
+ 5. Gem is automatically published via GitHub Actions
150
+
151
+ ## Code of Conduct
152
+
153
+ This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
154
+
155
+ ## License
156
+
157
+ By contributing, you agree that your contributions will be licensed under the MIT License.
158
+
159
+ ## Questions?
160
+
161
+ Feel free to contact the maintainers:
162
+ - Open an issue for public discussion
163
+ - Email: team@a2a-ruby.org
164
+
165
+ Thank you for contributing! 🎉
data/Gemfile ADDED
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in a2a-ruby.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ group :development, :test do
11
+ gem "debug", platforms: %i[mri mingw x64_mingw]
12
+ gem "pry", "~> 0.14"
13
+ gem "pry-byebug", "~> 3.10"
14
+
15
+ # Environment management
16
+ gem "dotenv", "~> 2.8"
17
+ end
18
+
19
+ group :test do
20
+ gem "factory_bot", "~> 6.0"
21
+ gem "rspec", "~> 3.12"
22
+ gem "simplecov", "~> 0.22"
23
+ gem "simplecov-lcov", "~> 0.8"
24
+ gem "vcr", "~> 6.0"
25
+ gem "webmock", "~> 3.18"
26
+
27
+ # Performance testing
28
+ gem "benchmark-ips", "~> 2.12"
29
+ gem "memory_profiler", "~> 1.0"
30
+ end
31
+
32
+ group :development do
33
+ gem "rubocop", "~> 1.57"
34
+ gem "rubocop-performance", "~> 1.19"
35
+ gem "rubocop-rspec", "~> 2.25"
36
+
37
+ gem "guard", "~> 2.18"
38
+ gem "guard-rspec", "~> 4.7"
39
+ gem "yard", "~> 0.9"
40
+
41
+ # Security auditing
42
+ gem "bundler-audit", "~> 0.9"
43
+ end
data/Guardfile ADDED
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Guard configuration for A2A Ruby SDK
4
+ # Provides automatic testing similar to pytest watch mode
5
+
6
+ guard :rspec, cmd: "bundle exec rspec" do
7
+ require "guard/rspec/dsl"
8
+ dsl = Guard::RSpec::Dsl.new(self)
9
+
10
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+
20
+ # A2A-specific file patterns
21
+ watch(%r{^lib/a2a/(.+)\.rb$}) { |m| "spec/a2a/#{m[1]}_spec.rb" }
22
+ watch(%r{^lib/a2a/types/(.+)\.rb$}) { |m| "spec/a2a/types/#{m[1]}_spec.rb" }
23
+ watch(%r{^lib/a2a/client/(.+)\.rb$}) { |m| "spec/a2a/client/#{m[1]}_spec.rb" }
24
+ watch(%r{^lib/a2a/server/(.+)\.rb$}) { |m| "spec/a2a/server/#{m[1]}_spec.rb" }
25
+ watch(%r{^lib/a2a/protocol/(.+)\.rb$}) { |m| "spec/a2a/protocol/#{m[1]}_spec.rb" }
26
+ watch(%r{^lib/a2a/transport/(.+)\.rb$}) { |m| "spec/a2a/transport/#{m[1]}_spec.rb" }
27
+
28
+ # Integration tests
29
+ watch(%r{^lib/a2a/(.+)\.rb$}) { "spec/integration" }
30
+
31
+ # Configuration changes
32
+ watch("lib/a2a/configuration.rb") { "spec/a2a/configuration_spec.rb" }
33
+ watch("lib/a2a.rb") { "spec/a2a_spec.rb" }
34
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 A2A Ruby Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.