smart_message 0.0.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.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.envrc +3 -0
  3. data/.gitignore +8 -0
  4. data/.travis.yml +7 -0
  5. data/CHANGELOG.md +100 -0
  6. data/COMMITS.md +196 -0
  7. data/Gemfile +6 -0
  8. data/Gemfile.lock +71 -0
  9. data/README.md +303 -0
  10. data/Rakefile +10 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/docs/README.md +52 -0
  14. data/docs/architecture.md +370 -0
  15. data/docs/dispatcher.md +593 -0
  16. data/docs/examples.md +808 -0
  17. data/docs/getting-started.md +235 -0
  18. data/docs/ideas_to_think_about.md +329 -0
  19. data/docs/serializers.md +575 -0
  20. data/docs/transports.md +501 -0
  21. data/docs/troubleshooting.md +582 -0
  22. data/examples/01_point_to_point_orders.rb +200 -0
  23. data/examples/02_publish_subscribe_events.rb +364 -0
  24. data/examples/03_many_to_many_chat.rb +608 -0
  25. data/examples/README.md +335 -0
  26. data/examples/tmux_chat/README.md +283 -0
  27. data/examples/tmux_chat/bot_agent.rb +272 -0
  28. data/examples/tmux_chat/human_agent.rb +197 -0
  29. data/examples/tmux_chat/room_monitor.rb +158 -0
  30. data/examples/tmux_chat/shared_chat_system.rb +295 -0
  31. data/examples/tmux_chat/start_chat_demo.sh +190 -0
  32. data/examples/tmux_chat/stop_chat_demo.sh +22 -0
  33. data/lib/simple_stats.rb +57 -0
  34. data/lib/smart_message/base.rb +284 -0
  35. data/lib/smart_message/dispatcher/.keep +0 -0
  36. data/lib/smart_message/dispatcher.rb +146 -0
  37. data/lib/smart_message/errors.rb +29 -0
  38. data/lib/smart_message/header.rb +20 -0
  39. data/lib/smart_message/logger/base.rb +8 -0
  40. data/lib/smart_message/logger.rb +7 -0
  41. data/lib/smart_message/serializer/base.rb +23 -0
  42. data/lib/smart_message/serializer/json.rb +22 -0
  43. data/lib/smart_message/serializer.rb +10 -0
  44. data/lib/smart_message/transport/base.rb +85 -0
  45. data/lib/smart_message/transport/memory_transport.rb +69 -0
  46. data/lib/smart_message/transport/registry.rb +59 -0
  47. data/lib/smart_message/transport/stdout_transport.rb +62 -0
  48. data/lib/smart_message/transport.rb +41 -0
  49. data/lib/smart_message/version.rb +7 -0
  50. data/lib/smart_message/wrapper.rb +43 -0
  51. data/lib/smart_message.rb +54 -0
  52. data/smart_message.gemspec +53 -0
  53. metadata +252 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: efdcf78330a702d97c6c59ec11495c04a42ef746fbe6ed12011711ba127a792c
4
+ data.tar.gz: 395ae151a03376eab42036932e6ebbb437ddd0a42659a8ce8aca64fb80af45e7
5
+ SHA512:
6
+ metadata.gz: d307903f836b3f1252bc8e6723c09112c4a89ace6dcb1fbf07581e1782b4ab92899ebaa4d00b74e1c615dd75b7e34a754c2adc84c9c1c894c1e5a679862742a7
7
+ data.tar.gz: 966a81e21c5348b5c922f068a5edeb5709e73d6ae871eb0c653c76850b7f89ce4d1fde78ff5cd89df03e16cf8558fc6ce40c1949df179ba2f44f977ffe46b718
data/.envrc ADDED
@@ -0,0 +1,3 @@
1
+ # ./.envrc
2
+
3
+ export RR=`pwd`
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.0
7
+ before_install: gem install bundler -v 1.16.5
data/CHANGELOG.md ADDED
@@ -0,0 +1,100 @@
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
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] 2025-08-17
11
+
12
+ ### Added
13
+ - Comprehensive example applications demonstrating different messaging patterns
14
+ - Point-to-point order processing example (`examples/01_point_to_point_orders.rb`)
15
+ - Publish-subscribe event broadcasting example (`examples/02_publish_subscribe_events.rb`)
16
+ - Many-to-many chat system example (`examples/03_many_to_many_chat.rb`)
17
+ - Interactive tmux-based visualization system for many-to-many messaging
18
+ - File-based transport for inter-process communication (`examples/tmux_chat/`)
19
+ - Human chat agents with interactive command support
20
+ - Automated bot agents with joke, weather, stats, and help capabilities
21
+ - Real-time room activity monitors with visual status updates
22
+ - Complete tmux session management with automated setup and cleanup
23
+ - Comprehensive documentation with navigation instructions
24
+ - Development documentation and project guidance
25
+ - Added `CLAUDE.md` with development commands and architecture overview
26
+ - Enhanced README with comprehensive usage examples and API documentation
27
+
28
+ ### Changed
29
+ - **BREAKING**: Updated all public method signatures to use modern Ruby 3.4 keyword arguments
30
+ - `initialize` methods now use `**props` instead of `props = {}`
31
+ - Transport creation methods updated to use keyword argument expansion
32
+ - Maintained backward compatibility where possible
33
+ - Improved gem metadata with links to changelog, bug tracker, and documentation
34
+ - Enhanced error handling and console compatibility across different Ruby environments
35
+ - Updated transport terminology throughout codebase for consistency
36
+
37
+ ### Fixed
38
+ - IO.console compatibility issues in tmux chat visualization components
39
+ - Method signature consistency for keyword arguments across all transport classes
40
+ - Console detection and graceful fallbacks for terminal size detection
41
+ - Message processing error handling in dispatcher components
42
+
43
+ ### Documentation
44
+ - Complete architectural overview in `CLAUDE.md`
45
+ - Step-by-step usage examples for all messaging patterns
46
+ - Tmux navigation and interaction guides
47
+ - Development workflow and testing instructions
48
+ - API documentation with method signatures and examples
49
+
50
+ ### Examples
51
+ - **Point-to-Point**: Order processing with payment service integration
52
+ - **Publish-Subscribe**: User event broadcasting to multiple services (email, SMS, audit)
53
+ - **Many-to-Many**: Interactive chat system with rooms, bots, and human agents
54
+ - **Tmux Visualization**: Advanced multi-pane terminal interface for real-time message flow observation
55
+
56
+ ## [0.0.1] - 2025-08-17
57
+
58
+ ### Added
59
+ - Complete rewrite with transport abstraction layer
60
+ - Concurrent message processing with thread pools using `Concurrent::CachedThreadPool`
61
+ - Plugin registry system for transports and serializers
62
+ - Built-in statistics collection via SimpleStats
63
+ - Memory and STDOUT transport implementations
64
+ - Comprehensive test suite using Minitest with Shoulda
65
+ - Dual-level plugin configuration (class and instance level)
66
+ - Message header system with UUID, timestamps, and process tracking
67
+ - Gateway pattern support for cross-transport message routing
68
+ - Thread-safe message dispatcher with graceful shutdown
69
+ - Pluggable serialization system with JSON implementation
70
+ - Transport registry for dynamic plugin discovery
71
+
72
+ ### Changed
73
+ - Migrated from legacy Broker concept to modern Transport abstraction
74
+ - Updated dependencies to remove version constraints
75
+ - Improved error handling and custom exception types
76
+
77
+ ### Technical Details
78
+ - Built on Hashie::Dash with extensive extensions
79
+ - Uses ActiveSupport for string inflections
80
+ - Concurrent-ruby for thread pool management
81
+ - Supports Ruby >= 3.0.0
82
+
83
+ ---
84
+
85
+ ## Guidelines for Contributors
86
+
87
+ When updating this changelog:
88
+
89
+ 1. **Follow [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format**
90
+ 2. **Use these categories in order:**
91
+ - `Added` for new features
92
+ - `Changed` for changes in existing functionality
93
+ - `Deprecated` for soon-to-be removed features
94
+ - `Removed` for now removed features
95
+ - `Fixed` for any bug fixes
96
+ - `Security` for vulnerability fixes
97
+ 3. **Add entries to [Unreleased] section** until ready for release
98
+ 4. **Use present tense** ("Add feature" not "Added feature")
99
+ 5. **Include breaking changes** in `Changed` section with **BREAKING** prefix
100
+ 6. **Link to issues/PRs** when relevant: `[#123](https://github.com/MadBomber/smart_message/issues/123)`
data/COMMITS.md ADDED
@@ -0,0 +1,196 @@
1
+ ---
2
+ url: https://www.conventionalcommits.org/en/v1.0.0/
3
+ title: Conventional Commits
4
+ description: A specification for adding human and machine readable meaning to commit messages
5
+ access_date: 2025-07-31T20:51:29.000Z
6
+ current_date: 2025-07-31T20:51:29.601Z
7
+ ---
8
+
9
+ # Conventional Commits
10
+
11
+ A specification for adding human and machine readable meaning to commit messages
12
+
13
+ Quick Summary Full Specification Contribute
14
+
15
+ # Conventional Commits 1.0.0
16
+
17
+ ## Summary
18
+
19
+ The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history; which makes it easier to write automated tools on top of. This convention dovetails with SemVer, by describing the features, fixes, and breaking changes made in commit messages.
20
+
21
+ The commit message should be structured as follows:
22
+
23
+ ---
24
+
25
+ ```
26
+ <type>[optional scope]: <description>
27
+
28
+ [optional body]
29
+
30
+ [optional footer(s)]
31
+
32
+ ```
33
+
34
+ ---
35
+
36
+ The commit contains the following structural elements, to communicate intent to the consumers of your library:
37
+
38
+ 1. **fix:** a commit of the _type_ `fix` patches a bug in your codebase (this correlates with `PATCH` in Semantic Versioning).
39
+ 2. **feat:** a commit of the _type_ `feat` introduces a new feature to the codebase (this correlates with `MINOR` in Semantic Versioning).
40
+ 3. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with `MAJOR` in Semantic Versioning). A BREAKING CHANGE can be part of commits of any _type_.
41
+ 4. _types_ other than `fix:` and `feat:` are allowed, for example @commitlint/config-conventional (based on the Angular convention) recommends `build:`, `chore:`,`ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`, and others.
42
+ 5. _footers_ other than `BREAKING CHANGE: <description>` may be provided and follow a convention similar to git trailer format.
43
+
44
+ Additional types are not mandated by the Conventional Commits specification, and have no implicit effect in Semantic Versioning (unless they include a BREAKING CHANGE). A scope may be provided to a commit’s type, to provide additional contextual information and is contained within parenthesis, e.g., `feat(parser): add ability to parse arrays`.
45
+
46
+ ## Examples
47
+
48
+ ### Commit message with description and breaking change footer
49
+
50
+ ```
51
+ feat: allow provided config object to extend other configs
52
+
53
+ BREAKING CHANGE: `extends` key in config file is now used for extending other config files
54
+
55
+ ```
56
+
57
+ ### Commit message with `!` to draw attention to breaking change
58
+
59
+ ```
60
+ feat!: send an email to the customer when a product is shipped
61
+
62
+ ```
63
+
64
+ ### Commit message with scope and `!` to draw attention to breaking change
65
+
66
+ ```
67
+ feat(api)!: send an email to the customer when a product is shipped
68
+
69
+ ```
70
+
71
+ ### Commit message with both `!` and BREAKING CHANGE footer
72
+
73
+ ```
74
+ chore!: drop support for Node 6
75
+
76
+ BREAKING CHANGE: use JavaScript features not available in Node 6.
77
+
78
+ ```
79
+
80
+ ### Commit message with no body
81
+
82
+ ```
83
+ docs: correct spelling of CHANGELOG
84
+
85
+ ```
86
+
87
+ ### Commit message with scope
88
+
89
+ ```
90
+ feat(lang): add Polish language
91
+
92
+ ```
93
+
94
+ ### Commit message with multi-paragraph body and multiple footers
95
+
96
+ ```
97
+ fix: prevent racing of requests
98
+
99
+ Introduce a request id and a reference to latest request. Dismiss
100
+ incoming responses other than from latest request.
101
+
102
+ Remove timeouts which were used to mitigate the racing issue but are
103
+ obsolete now.
104
+
105
+ Reviewed-by: Z
106
+ Refs: #123
107
+
108
+ ```
109
+
110
+ ## Specification
111
+
112
+ The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
113
+
114
+ 1. Commits MUST be prefixed with a type, which consists of a noun, `feat`, `fix`, etc., followed by the OPTIONAL scope, OPTIONAL `!`, and REQUIRED terminal colon and space.
115
+ 2. The type `feat` MUST be used when a commit adds a new feature to your application or library.
116
+ 3. The type `fix` MUST be used when a commit represents a bug fix for your application.
117
+ 4. A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., `fix(parser):`
118
+ 5. A description MUST immediately follow the colon and space after the type/scope prefix. The description is a short summary of the code changes, e.g., _fix: array parsing issue when multiple spaces were contained in string_.
119
+ 6. A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
120
+ 7. A commit body is free-form and MAY consist of any number of newline separated paragraphs.
121
+ 8. One or more footers MAY be provided one blank line after the body. Each footer MUST consist of a word token, followed by either a `:<space>` or `<space>#` separator, followed by a string value (this is inspired by the git trailer convention).
122
+ 9. A footer’s token MUST use `-` in place of whitespace characters, e.g., `Acked-by` (this helps differentiate the footer section from a multi-paragraph body). An exception is made for `BREAKING CHANGE`, which MAY also be used as a token.
123
+ 10. A footer’s value MAY contain spaces and newlines, and parsing MUST terminate when the next valid footer token/separator pair is observed.
124
+ 11. Breaking changes MUST be indicated in the type/scope prefix of a commit, or as an entry in the footer.
125
+ 12. If included as a footer, a breaking change MUST consist of the uppercase text BREAKING CHANGE, followed by a colon, space, and description, e.g.,_BREAKING CHANGE: environment variables now take precedence over config files_.
126
+ 13. If included in the type/scope prefix, breaking changes MUST be indicated by a`!` immediately before the `:`. If `!` is used, `BREAKING CHANGE:` MAY be omitted from the footer section, and the commit description SHALL be used to describe the breaking change.
127
+ 14. Types other than `feat` and `fix` MAY be used in your commit messages, e.g., _docs: update ref docs._
128
+ 15. The units of information that make up Conventional Commits MUST NOT be treated as case sensitive by implementors, with the exception of BREAKING CHANGE which MUST be uppercase.
129
+ 16. BREAKING-CHANGE MUST be synonymous with BREAKING CHANGE, when used as a token in a footer.
130
+
131
+ ## Why Use Conventional Commits
132
+
133
+ * Automatically generating CHANGELOGs.
134
+ * Automatically determining a semantic version bump (based on the types of commits landed).
135
+ * Communicating the nature of changes to teammates, the public, and other stakeholders.
136
+ * Triggering build and publish processes.
137
+ * Making it easier for people to contribute to your projects, by allowing them to explore a more structured commit history.
138
+
139
+ ## FAQ
140
+
141
+ ### How should I deal with commit messages in the initial development phase?
142
+
143
+ We recommend that you proceed as if you’ve already released the product. Typically _somebody_, even if it’s your fellow software developers, is using your software. They’ll want to know what’s fixed, what breaks etc.
144
+
145
+ ### Are the types in the commit title uppercase or lowercase?
146
+
147
+ Any casing may be used, but it’s best to be consistent.
148
+
149
+ ### What do I do if the commit conforms to more than one of the commit types?
150
+
151
+ Go back and make multiple commits whenever possible. Part of the benefit of Conventional Commits is its ability to drive us to make more organized commits and PRs.
152
+
153
+ ### Doesn’t this discourage rapid development and fast iteration?
154
+
155
+ It discourages moving fast in a disorganized way. It helps you be able to move fast long term across multiple projects with varied contributors.
156
+
157
+ ### Might Conventional Commits lead developers to limit the type of commits they make because they’ll be thinking in the types provided?
158
+
159
+ Conventional Commits encourages us to make more of certain types of commits such as fixes. Other than that, the flexibility of Conventional Commits allows your team to come up with their own types and change those types over time.
160
+
161
+ ### How does this relate to SemVer?
162
+
163
+ `fix` type commits should be translated to `PATCH` releases. `feat` type commits should be translated to `MINOR` releases. Commits with `BREAKING CHANGE` in the commits, regardless of type, should be translated to `MAJOR` releases.
164
+
165
+ ### How should I version my extensions to the Conventional Commits Specification, e.g. `@jameswomack/conventional-commit-spec`?
166
+
167
+ We recommend using SemVer to release your own extensions to this specification (and encourage you to make these extensions!)
168
+
169
+ ### What do I do if I accidentally use the wrong commit type?
170
+
171
+ #### When you used a type that’s of the spec but not the correct type, e.g. `fix` instead of `feat`
172
+
173
+ Prior to merging or releasing the mistake, we recommend using `git rebase -i` to edit the commit history. After release, the cleanup will be different according to what tools and processes you use.
174
+
175
+ #### When you used a type _not_ of the spec, e.g. `feet` instead of `feat`
176
+
177
+ In a worst case scenario, it’s not the end of the world if a commit lands that does not meet the Conventional Commits specification. It simply means that commit will be missed by tools that are based on the spec.
178
+
179
+ ### Do all my contributors need to use the Conventional Commits specification?
180
+
181
+ No! If you use a squash based workflow on Git lead maintainers can clean up the commit messages as they’re merged—adding no workload to casual committers. A common workflow for this is to have your git system automatically squash commits from a pull request and present a form for the lead maintainer to enter the proper git commit message for the merge.
182
+
183
+ ### How does Conventional Commits handle revert commits?
184
+
185
+ Reverting code can be complicated: are you reverting multiple commits? if you revert a feature, should the next release instead be a patch?
186
+
187
+ Conventional Commits does not make an explicit effort to define revert behavior. Instead we leave it to tooling authors to use the flexibility of _types_ and _footers_ to develop their logic for handling reverts.
188
+
189
+ One recommendation is to use the `revert` type, and a footer that references the commit SHAs that are being reverted:
190
+
191
+ ```
192
+ revert: let us never again speak of the noodle incident
193
+
194
+ Refs: 676104e, a215868
195
+
196
+ ```
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in smart_message.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ smart_message (0.0.1)
5
+ activesupport
6
+ concurrent-ruby
7
+ hashie
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (8.0.2.1)
13
+ base64
14
+ benchmark (>= 0.3)
15
+ bigdecimal
16
+ concurrent-ruby (~> 1.0, >= 1.3.1)
17
+ connection_pool (>= 2.2.5)
18
+ drb
19
+ i18n (>= 1.6, < 2)
20
+ logger (>= 1.4.2)
21
+ minitest (>= 5.1)
22
+ securerandom (>= 0.3)
23
+ tzinfo (~> 2.0, >= 2.0.5)
24
+ uri (>= 0.13.1)
25
+ amazing_print (1.8.1)
26
+ base64 (0.3.0)
27
+ benchmark (0.4.1)
28
+ bigdecimal (3.2.2)
29
+ concurrent-ruby (1.3.5)
30
+ connection_pool (2.5.3)
31
+ debug_me (1.1.1)
32
+ drb (2.2.3)
33
+ hashie (5.0.0)
34
+ i18n (1.14.7)
35
+ concurrent-ruby (~> 1.0)
36
+ logger (1.7.0)
37
+ minitest (5.25.5)
38
+ minitest-power_assert (0.3.1)
39
+ minitest
40
+ power_assert (>= 1.1)
41
+ mutex_m (0.3.0)
42
+ power_assert (2.0.5)
43
+ rake (13.3.0)
44
+ securerandom (0.4.1)
45
+ shoulda (4.0.0)
46
+ shoulda-context (~> 2.0)
47
+ shoulda-matchers (~> 4.0)
48
+ shoulda-context (2.0.0)
49
+ shoulda-matchers (4.5.1)
50
+ activesupport (>= 4.2.0)
51
+ tzinfo (2.0.6)
52
+ concurrent-ruby (~> 1.0)
53
+ uri (1.0.3)
54
+
55
+ PLATFORMS
56
+ arm64-darwin-24
57
+ x86_64-darwin-20
58
+
59
+ DEPENDENCIES
60
+ amazing_print
61
+ bundler
62
+ debug_me
63
+ minitest
64
+ minitest-power_assert
65
+ mutex_m
66
+ rake
67
+ shoulda
68
+ smart_message!
69
+
70
+ BUNDLED WITH
71
+ 2.7.1