smart_message 0.0.10 → 0.0.13

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/deploy-github-pages.yml +38 -0
  3. data/.gitignore +5 -0
  4. data/CHANGELOG.md +64 -0
  5. data/Gemfile.lock +35 -4
  6. data/README.md +169 -71
  7. data/Rakefile +29 -4
  8. data/docs/assets/images/ddq_architecture.svg +130 -0
  9. data/docs/assets/images/dlq_architecture.svg +115 -0
  10. data/docs/assets/images/enhanced-dual-publishing.svg +136 -0
  11. data/docs/assets/images/enhanced-fluent-api.svg +149 -0
  12. data/docs/assets/images/enhanced-microservices-routing.svg +115 -0
  13. data/docs/assets/images/enhanced-pattern-matching.svg +107 -0
  14. data/docs/assets/images/fluent-api-demo.svg +59 -0
  15. data/docs/assets/images/performance-comparison.svg +161 -0
  16. data/docs/assets/images/redis-basic-architecture.svg +53 -0
  17. data/docs/assets/images/redis-enhanced-architecture.svg +88 -0
  18. data/docs/assets/images/redis-queue-architecture.svg +101 -0
  19. data/docs/assets/images/smart_message.jpg +0 -0
  20. data/docs/assets/images/smart_message_walking.jpg +0 -0
  21. data/docs/assets/images/smartmessage_architecture_overview.svg +173 -0
  22. data/docs/assets/images/transport-comparison-matrix.svg +171 -0
  23. data/docs/assets/javascripts/mathjax.js +17 -0
  24. data/docs/assets/stylesheets/extra.css +51 -0
  25. data/docs/{addressing.md → core-concepts/addressing.md} +5 -7
  26. data/docs/{architecture.md → core-concepts/architecture.md} +80 -145
  27. data/docs/{dispatcher.md → core-concepts/dispatcher.md} +21 -21
  28. data/docs/{message_filtering.md → core-concepts/message-filtering.md} +2 -3
  29. data/docs/{message_processing.md → core-concepts/message-processing.md} +17 -17
  30. data/docs/{troubleshooting.md → development/troubleshooting.md} +7 -7
  31. data/docs/{examples.md → getting-started/examples.md} +103 -89
  32. data/docs/{getting-started.md → getting-started/quick-start.md} +47 -23
  33. data/docs/index.md +64 -0
  34. data/docs/{dead_letter_queue.md → reference/dead-letter-queue.md} +2 -3
  35. data/docs/{logging.md → reference/logging.md} +1 -1
  36. data/docs/{message_deduplication.md → reference/message-deduplication.md} +1 -0
  37. data/docs/{proc_handlers_summary.md → reference/proc-handlers.md} +7 -6
  38. data/docs/reference/serializers.md +245 -0
  39. data/docs/{transports.md → reference/transports.md} +9 -11
  40. data/docs/transports/memory-transport.md +374 -0
  41. data/docs/transports/redis-transport-comparison.md +361 -0
  42. data/docs/transports/redis-transport.md +490 -0
  43. data/examples/README.md +104 -14
  44. data/examples/city_scenario/911_emergency_call_flow.svg +99 -0
  45. data/examples/city_scenario/README.md +515 -0
  46. data/examples/city_scenario/ai_visitor_intelligence_flow.svg +108 -0
  47. data/examples/city_scenario/citizen.rb +195 -0
  48. data/examples/city_scenario/city_diagram.svg +125 -0
  49. data/examples/city_scenario/common/health_monitor.rb +80 -0
  50. data/examples/city_scenario/common/logger.rb +30 -0
  51. data/examples/city_scenario/emergency_dispatch_center.rb +270 -0
  52. data/examples/city_scenario/fire_department.rb +446 -0
  53. data/examples/city_scenario/fire_emergency_flow.svg +95 -0
  54. data/examples/city_scenario/health_department.rb +100 -0
  55. data/examples/city_scenario/health_monitoring_system.svg +130 -0
  56. data/examples/city_scenario/house.rb +244 -0
  57. data/examples/city_scenario/local_bank.rb +217 -0
  58. data/examples/city_scenario/messages/emergency_911_message.rb +80 -0
  59. data/examples/city_scenario/messages/emergency_resolved_message.rb +42 -0
  60. data/examples/city_scenario/messages/fire_dispatch_message.rb +42 -0
  61. data/examples/city_scenario/messages/fire_emergency_message.rb +44 -0
  62. data/examples/city_scenario/messages/health_check_message.rb +21 -0
  63. data/examples/city_scenario/messages/health_status_message.rb +34 -0
  64. data/examples/city_scenario/messages/police_dispatch_message.rb +45 -0
  65. data/examples/city_scenario/messages/silent_alarm_message.rb +37 -0
  66. data/examples/city_scenario/police_department.rb +316 -0
  67. data/examples/city_scenario/redis_monitor.rb +129 -0
  68. data/examples/city_scenario/redis_stats.rb +743 -0
  69. data/examples/city_scenario/room_for_improvement.md +240 -0
  70. data/examples/city_scenario/security_emergency_flow.svg +95 -0
  71. data/examples/city_scenario/service_internal_architecture.svg +154 -0
  72. data/examples/city_scenario/smart_message_ai_agent.rb +364 -0
  73. data/examples/city_scenario/start_demo.sh +236 -0
  74. data/examples/city_scenario/stop_demo.sh +106 -0
  75. data/examples/city_scenario/visitor.rb +631 -0
  76. data/examples/{10_message_deduplication.rb → memory/01_message_deduplication_demo.rb} +1 -3
  77. data/examples/{09_dead_letter_queue_demo.rb → memory/02_dead_letter_queue_demo.rb} +10 -40
  78. data/examples/{01_point_to_point_orders.rb → memory/03_point_to_point_orders.rb} +1 -3
  79. data/examples/{02_publish_subscribe_events.rb → memory/04_publish_subscribe_events.rb} +1 -2
  80. data/examples/{03_many_to_many_chat.rb → memory/05_many_to_many_chat.rb} +1 -4
  81. data/examples/{show_me.rb → memory/06_pretty_print_demo.rb} +1 -1
  82. data/examples/{05_proc_handlers.rb → memory/07_proc_handlers_demo.rb} +1 -2
  83. data/examples/{06_custom_logger_example.rb → memory/08_custom_logger_demo.rb} +13 -14
  84. data/examples/{07_error_handling_scenarios.rb → memory/09_error_handling_demo.rb} +1 -4
  85. data/examples/{08_entity_addressing_basic.rb → memory/10_entity_addressing_basic.rb} +2 -8
  86. data/examples/{08_entity_addressing_with_filtering.rb → memory/11_entity_addressing_with_filtering.rb} +2 -6
  87. data/examples/{09_regex_filtering_microservices.rb → memory/12_regex_filtering_microservices.rb} +1 -2
  88. data/examples/{10_header_block_configuration.rb → memory/13_header_block_configuration.rb} +1 -6
  89. data/examples/{11_global_configuration_example.rb → memory/14_global_configuration_demo.rb} +17 -8
  90. data/examples/{show_logger.rb → memory/15_logger_demo.rb} +1 -2
  91. data/examples/memory/README.md +163 -0
  92. data/examples/memory/memory_transport_architecture.svg +90 -0
  93. data/examples/memory/point_to_point_pattern.svg +94 -0
  94. data/examples/memory/publish_subscribe_pattern.svg +125 -0
  95. data/examples/{04_redis_smart_home_iot.rb → redis/01_smart_home_iot_demo.rb} +1 -5
  96. data/examples/redis/README.md +228 -0
  97. data/examples/redis/alert_system_flow.svg +127 -0
  98. data/examples/redis/dashboard_status_flow.svg +107 -0
  99. data/examples/redis/device_command_flow.svg +113 -0
  100. data/examples/redis/redis_transport_architecture.svg +115 -0
  101. data/examples/{smart_home_iot_dataflow.md → redis/smart_home_iot_dataflow.md} +4 -116
  102. data/examples/redis/smart_home_system_architecture.svg +133 -0
  103. data/ideas/README.md +41 -0
  104. data/ideas/agents.md +1001 -0
  105. data/ideas/database_transport.md +980 -0
  106. data/ideas/improvement.md +359 -0
  107. data/ideas/meshage.md +1788 -0
  108. data/ideas/message_discovery.md +178 -0
  109. data/ideas/message_schema.md +1381 -0
  110. data/lib/smart_message/.idea/.gitignore +8 -0
  111. data/lib/smart_message/.idea/markdown.xml +6 -0
  112. data/lib/smart_message/.idea/misc.xml +4 -0
  113. data/lib/smart_message/.idea/modules.xml +8 -0
  114. data/lib/smart_message/.idea/smart_message.iml +16 -0
  115. data/lib/smart_message/.idea/vcs.xml +6 -0
  116. data/lib/smart_message/addressing.rb +15 -0
  117. data/lib/smart_message/base.rb +19 -12
  118. data/lib/smart_message/configuration.rb +2 -23
  119. data/lib/smart_message/dead_letter_queue.rb +1 -1
  120. data/lib/smart_message/logger.rb +15 -4
  121. data/lib/smart_message/messaging.rb +3 -62
  122. data/lib/smart_message/plugins.rb +6 -44
  123. data/lib/smart_message/serializer.rb +14 -0
  124. data/lib/smart_message/transport/base.rb +42 -8
  125. data/lib/smart_message/transport/memory_transport.rb +23 -4
  126. data/lib/smart_message/transport/redis_transport.rb +11 -0
  127. data/lib/smart_message/transport/stdout_transport.rb +28 -10
  128. data/lib/smart_message/transport.rb +33 -1
  129. data/lib/smart_message/version.rb +1 -1
  130. data/lib/smart_message.rb +5 -52
  131. data/mkdocs.yml +184 -0
  132. data/p2p_plan.md +326 -0
  133. data/p2p_roadmap.md +287 -0
  134. data/smart_message.gemspec +2 -0
  135. data/smart_message.svg +51 -0
  136. metadata +145 -45
  137. data/docs/README.md +0 -57
  138. data/docs/serializers.md +0 -575
  139. data/examples/dead_letters.jsonl +0 -12
  140. data/examples/temp.txt +0 -94
  141. data/examples/tmux_chat/README.md +0 -283
  142. data/examples/tmux_chat/bot_agent.rb +0 -278
  143. data/examples/tmux_chat/human_agent.rb +0 -199
  144. data/examples/tmux_chat/room_monitor.rb +0 -160
  145. data/examples/tmux_chat/shared_chat_system.rb +0 -328
  146. data/examples/tmux_chat/start_chat_demo.sh +0 -190
  147. data/examples/tmux_chat/stop_chat_demo.sh +0 -22
  148. /data/docs/{properties.md → core-concepts/properties.md} +0 -0
  149. /data/docs/{ideas_to_think_about.md → development/ideas.md} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8485ad851b6868c57b813977a4b2be3b1e06fe2843510a5b64c79468da3a65cf
4
- data.tar.gz: 1c2345c52d1dd57202a83a49d3d4e7769f14b2855d0a08745d3ed4c970ef0f0e
3
+ metadata.gz: 38b75aa70a9ab79b0fd9ac311d7e5634491789e5813161630ff7e04f17d61373
4
+ data.tar.gz: 8196665b3a660cfaad1c30753697f020c4a54b50c25d23be6f6c3c6ad9149e38
5
5
  SHA512:
6
- metadata.gz: 26cfdd1030e880074e557f7bc315220995b3267ec0a11fd4d0f621933e2101f40f35da425649388b83bf8055246934e6c9f8e60a281246e04e5cd89763c33e07
7
- data.tar.gz: 25d66186e9ebe3f3fcf595e7093ec08c50db83d84205fcb4567b0c69804e44b80496693c40e36a0ea30b9f315a36d2070e701977bec6a0660f3c3bda327f1d88
6
+ metadata.gz: 876f94f732eb022c568a200747438ab6a0938602735f89601fc7c9e48f34bf21791c75608b2d877475d9190a9629974a63448f5ceb6eeb24bf073b0cc1e4ee19
7
+ data.tar.gz: 310150522f4d6561c40e7322072a75778867b643b5eb6b79364b750a39689e27cbfd7c7022ae0f0c8a44ae9a850549c02e94005930d4b878ba75cb1eb1192a58
@@ -0,0 +1,38 @@
1
+ name: Deploy Documentation to GitHub Pages
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ paths:
7
+ - "docs/**"
8
+ - "mkdocs.yml"
9
+ - ".github/workflows/deploy-github-pages.yml"
10
+ workflow_dispatch:
11
+
12
+ permissions:
13
+ contents: write
14
+ pages: write
15
+ id-token: write
16
+
17
+ jobs:
18
+ deploy:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout code
22
+ uses: actions/checkout@v4
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Setup Python
27
+ uses: actions/setup-python@v5
28
+ with:
29
+ python-version: 3.x
30
+
31
+ - name: Install dependencies
32
+ run: |
33
+ pip install mkdocs
34
+ pip install mkdocs-material
35
+ pip install mkdocs-macros-plugin
36
+
37
+ - name: Deploy to GitHub Pages
38
+ run: mkdocs gh-deploy --force
data/.gitignore CHANGED
@@ -8,3 +8,8 @@
8
8
  /pkg/
9
9
  /spec/reports/
10
10
  /tmp/
11
+ /.aigcm_msg/
12
+ site
13
+ .aigcm_msg
14
+ /log/
15
+ /logs/
data/CHANGELOG.md CHANGED
@@ -7,6 +7,70 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.0.13] 2025-09-10
11
+
12
+ ### Changed
13
+ - **BREAKING: Transport-Level Serialization Architecture**: Major architectural rework moving serializer responsibility from message classes to transport layer
14
+ - **Core Change**: Serializers now associated with transports instead of message classes, enabling different transports to use different serialization formats
15
+ - **Message Structure**: Eliminated wrapper objects in favor of flat message structure with `_sm_header` routing metadata
16
+ - **Serialization Format**: Messages now serialized as single JSON objects containing both header and payload data (e.g., `{"_sm_header": {...}, "content": "value", "property": "data"}`)
17
+ - **Transport Flexibility**: Each transport can now use its own serializer (JSON, MessagePack, etc.) independently
18
+ - **Backward Compatibility**: Added `_sm_payload` and `split` methods to maintain compatibility with existing proc handlers
19
+ - **Performance**: Simplified message processing pipeline with direct message instance passing instead of complex wrapper handling
20
+
21
+ ### Fixed
22
+ - **Message Reconstruction**: Fixed critical bug in `SmartMessage::Base#initialize` where payload properties were not properly extracted from flat serialized structure
23
+ - **Root Cause**: Initialization logic looked for `props[:_sm_payload]` but flat structure stores properties directly in `props`
24
+ - **Solution**: Changed to `payload_props = props.except(:_sm_header)` to extract all non-header properties
25
+ - **Impact**: Proc handlers now receive correct message content, resolving nil property values in `_sm_payload`
26
+ - **Circuit Breaker Test Compatibility**: Updated circuit breaker tests to use new transport method signatures
27
+ - **Issue**: Tests were calling `transport.publish(header, payload)` with two arguments
28
+ - **Fix**: Updated to `transport.publish(message_instance)` with single message parameter
29
+ - **Result**: All circuit breaker tests now pass with new architecture
30
+ - **Deduplication Test Format**: Updated deduplication tests from old wrapper format to new flat structure
31
+ - **Changed**: `_sm_payload: { content: "value" }` → `content: "value"`
32
+ - **Maintained**: Full deduplication functionality with handler-scoped DDQ system
33
+
34
+ ### Enhanced
35
+ - **Transport Serialization Control**: Each transport implementation can now specify its preferred serializer
36
+ - **Memory Transport**: Returns message objects directly without serialization for performance
37
+ - **STDOUT Transport**: Uses JSON serializer with pretty printing for human readability
38
+ - **Redis Transport**: Uses MessagePack with JSON fallback for efficient network transmission
39
+ - **Message Processing Pipeline**: Streamlined architecture with direct message instance routing
40
+ - **Eliminated**: Complex wrapper object creation and management overhead
41
+ - **Simplified**: Transport `receive` method now directly reconstructs message instances from flat data
42
+ - **Improved**: Cleaner separation between transport concerns and message processing logic
43
+
44
+ ### Added
45
+ - **Emergency Services Multi-Program Demo**: Complete emergency dispatch simulation system
46
+ - Added comprehensive emergency services message definitions with validation
47
+ - Emergency Dispatch Center (911) routing calls to appropriate departments
48
+ - Fire Department, Police Department, and Health Department service implementations
49
+ - AI-powered visitor generating realistic emergency scenarios with retry logic
50
+ - Health monitoring system across all city services with status reporting
51
+ - Continuous observation generation with diverse emergency scenarios every 15 seconds
52
+
53
+ ### Enhanced
54
+ - **Message Definition Property System**: Improved DRY principles and AI integration
55
+ - Extracted inline array validations into VALID_* constants (VALID_SEVERITY, VALID_EMERGENCY_TYPES, etc.)
56
+ - Updated property descriptions to use constants dynamically (#{VALID_SEVERITY.join(', ')})
57
+ - Enhanced property descriptions to include valid values for better AI prompting
58
+ - Standardized validation message format using constant interpolation across all message types
59
+ - **SmartMessage Class-Level Addressing**: Added setter method support for flexible syntax
60
+ - Added from=, to=, reply_to= setter methods to complement existing getter methods
61
+ - Enables both ClassName.from(value) and ClassName.from = value syntax patterns
62
+ - Maintains backward compatibility while improving developer experience
63
+
64
+ ### Added
65
+ - **Documentation Website**: MkDocs-based documentation site with GitHub Pages deployment
66
+ - Added `mkdocs.yml` configuration with Material theme and SmartMessage branding
67
+ - Created GitHub Actions workflow (`.github/workflows/deploy-github-pages.yml`) for automatic documentation deployment
68
+ - Reorganized documentation structure into logical sections: Getting Started, Core Concepts, Reference, and Development
69
+ - Added custom CSS styling for improved header visibility and readability
70
+ - Integrated SmartMessage logo and branding throughout the documentation
71
+ - Documentation now automatically deploys to GitHub Pages on push to master branch
72
+ - Live documentation available at: https://madbomber.github.io/smart_message/
73
+
10
74
  ## [0.0.10] 2025-08-20
11
75
  ### Added
12
76
  - **Handler-Scoped Message Deduplication**: Advanced DDQ (Deduplication Queue) system with automatic handler isolation
data/Gemfile.lock CHANGED
@@ -1,8 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_message (0.0.10)
4
+ smart_message (0.0.13)
5
5
  activesupport
6
+ async
7
+ async-redis
6
8
  breaker_machines
7
9
  colorize
8
10
  concurrent-ruby
@@ -28,9 +30,23 @@ GEM
28
30
  tzinfo (~> 2.0, >= 2.0.5)
29
31
  uri (>= 0.13.1)
30
32
  amazing_print (1.8.1)
33
+ async (2.31.0)
34
+ console (~> 1.29)
35
+ fiber-annotation
36
+ io-event (~> 1.11)
37
+ metrics (~> 0.12)
38
+ traces (~> 0.18)
39
+ async-pool (0.11.0)
40
+ async (>= 2.0)
41
+ async-redis (0.12.0)
42
+ async (~> 2.10)
43
+ async-pool (~> 0.2)
44
+ io-endpoint (~> 0.10)
45
+ io-stream (~> 0.4)
46
+ protocol-redis (~> 0.11)
31
47
  base64 (0.3.0)
32
48
  benchmark (0.4.1)
33
- bigdecimal (3.2.2)
49
+ bigdecimal (3.2.3)
34
50
  breaker_machines (0.4.0)
35
51
  activesupport (>= 7.2)
36
52
  concurrent-ruby (~> 1.3)
@@ -38,20 +54,34 @@ GEM
38
54
  zeitwerk (~> 2.7)
39
55
  colorize (1.1.0)
40
56
  concurrent-ruby (1.3.5)
41
- connection_pool (2.5.3)
57
+ connection_pool (2.5.4)
58
+ console (1.34.0)
59
+ fiber-annotation
60
+ fiber-local (~> 1.1)
61
+ json
42
62
  debug_me (1.1.1)
43
63
  drb (2.2.3)
64
+ fiber-annotation (0.2.0)
65
+ fiber-local (1.1.0)
66
+ fiber-storage
67
+ fiber-storage (1.0.1)
44
68
  hashie (5.0.0)
45
69
  i18n (1.14.7)
46
70
  concurrent-ruby (~> 1.0)
71
+ io-endpoint (0.15.2)
72
+ io-event (1.14.0)
73
+ io-stream (0.10.0)
74
+ json (2.13.2)
47
75
  logger (1.7.0)
48
- lumberjack (1.4.0)
76
+ lumberjack (1.4.1)
77
+ metrics (0.14.1)
49
78
  minitest (5.25.5)
50
79
  minitest-power_assert (0.3.1)
51
80
  minitest
52
81
  power_assert (>= 1.1)
53
82
  mutex_m (0.3.0)
54
83
  power_assert (2.0.5)
84
+ protocol-redis (0.12.0)
55
85
  rake (13.3.0)
56
86
  redis (5.4.1)
57
87
  redis-client (>= 0.22.0)
@@ -65,6 +95,7 @@ GEM
65
95
  shoulda-matchers (4.5.1)
66
96
  activesupport (>= 4.2.0)
67
97
  state_machines (0.100.1)
98
+ traces (0.18.2)
68
99
  tzinfo (2.0.6)
69
100
  concurrent-ruby (~> 1.0)
70
101
  uri (1.0.3)