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
@@ -1,190 +0,0 @@
1
- #!/bin/bash
2
- # examples/tmux_chat/start_chat_demo.sh
3
- #
4
- # Tmux session manager for the many-to-many chat visualization
5
-
6
- set -e
7
-
8
- SESSION_NAME="smart_message_chat"
9
- CHAT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
-
11
- # Colors for output
12
- RED='\033[0;31m'
13
- GREEN='\033[0;32m'
14
- YELLOW='\033[1;33m'
15
- BLUE='\033[0;34m'
16
- NC='\033[0m' # No Color
17
-
18
- echo -e "${BLUE}🚀 Starting SmartMessage Tmux Chat Demo${NC}"
19
- echo -e "${BLUE}======================================${NC}"
20
-
21
- # Check if tmux is installed
22
- if ! command -v tmux &> /dev/null; then
23
- echo -e "${RED}❌ tmux is not installed. Please install tmux first.${NC}"
24
- echo "On macOS: brew install tmux"
25
- echo "On Ubuntu: sudo apt-get install tmux"
26
- exit 1
27
- fi
28
-
29
- # Check if Ruby is available
30
- if ! command -v ruby &> /dev/null; then
31
- echo -e "${RED}❌ Ruby is not installed.${NC}"
32
- exit 1
33
- fi
34
-
35
- # Clean up any existing session
36
- if tmux has-session -t $SESSION_NAME 2>/dev/null; then
37
- echo -e "${YELLOW}🧹 Cleaning up existing session...${NC}"
38
- tmux kill-session -t $SESSION_NAME
39
- fi
40
-
41
- # Clean up shared message queues
42
- echo -e "${YELLOW}🧹 Cleaning up message queues...${NC}"
43
- rm -rf /tmp/smart_message_chat
44
-
45
- echo -e "${GREEN}📺 Creating tmux session layout...${NC}"
46
-
47
- # Create new session with first window
48
- tmux new-session -d -s $SESSION_NAME -x 120 -y 40
49
-
50
- # Rename first window and set up control center
51
- tmux rename-window -t $SESSION_NAME:0 "Chat-Control"
52
-
53
- # Window 0: Control Center (2x2 layout)
54
- echo -e "${GREEN}🏢 Setting up Control Center...${NC}"
55
-
56
- # Top left: General room monitor
57
- tmux send-keys -t $SESSION_NAME:0 "cd '$CHAT_DIR'" C-m
58
- tmux send-keys -t $SESSION_NAME:0 "ruby room_monitor.rb general" C-m
59
-
60
- # Split horizontally for top right: Tech room monitor
61
- tmux split-window -t $SESSION_NAME:0 -h
62
- tmux send-keys -t $SESSION_NAME:0.1 "cd '$CHAT_DIR'" C-m
63
- tmux send-keys -t $SESSION_NAME:0.1 "ruby room_monitor.rb tech" C-m
64
-
65
- # Split vertically (bottom left): Random room monitor
66
- tmux split-window -t $SESSION_NAME:0.0 -v
67
- tmux send-keys -t $SESSION_NAME:0.2 "cd '$CHAT_DIR'" C-m
68
- tmux send-keys -t $SESSION_NAME:0.2 "ruby room_monitor.rb random" C-m
69
-
70
- # Split vertically (bottom right): System overview
71
- tmux split-window -t $SESSION_NAME:0.1 -v
72
- tmux send-keys -t $SESSION_NAME:0.3 "cd '$CHAT_DIR'" C-m
73
- tmux send-keys -t $SESSION_NAME:0.3 "echo 'SmartMessage Chat System'; echo '========================'; echo 'Rooms: general, tech, random'; echo 'Agents starting up...'; echo ''; echo 'Instructions:'; echo '1. Switch to other windows to see agents'; echo '2. In agent windows, type messages or commands'; echo '3. Use /join <room> to join rooms'; echo '4. Use /help for more commands'; tail -f /dev/null" C-m
74
-
75
- # Wait a moment for room monitors to start
76
- sleep 2
77
-
78
- # Window 1: Human Agents (3 panes)
79
- echo -e "${GREEN}👥 Setting up Human Agents...${NC}"
80
- tmux new-window -t $SESSION_NAME -n "Human-Agents"
81
-
82
- # Alice (left pane)
83
- tmux send-keys -t $SESSION_NAME:1 "cd '$CHAT_DIR'" C-m
84
- tmux send-keys -t $SESSION_NAME:1 "ruby human_agent.rb alice Alice" C-m
85
-
86
- # Split for Bob (top right)
87
- tmux split-window -t $SESSION_NAME:1 -h
88
- tmux send-keys -t $SESSION_NAME:1.1 "cd '$CHAT_DIR'" C-m
89
- tmux send-keys -t $SESSION_NAME:1.1 "ruby human_agent.rb bob Bob" C-m
90
-
91
- # Split for Carol (bottom right)
92
- tmux split-window -t $SESSION_NAME:1.1 -v
93
- tmux send-keys -t $SESSION_NAME:1.2 "cd '$CHAT_DIR'" C-m
94
- tmux send-keys -t $SESSION_NAME:1.2 "ruby human_agent.rb carol Carol" C-m
95
-
96
- # Wait for agents to start
97
- sleep 2
98
-
99
- # Window 2: Bot Agents (2 panes)
100
- echo -e "${GREEN}🤖 Setting up Bot Agents...${NC}"
101
- tmux new-window -t $SESSION_NAME -n "Bot-Agents"
102
-
103
- # HelpBot (left pane)
104
- tmux send-keys -t $SESSION_NAME:2 "cd '$CHAT_DIR'" C-m
105
- tmux send-keys -t $SESSION_NAME:2 "ruby bot_agent.rb helpbot HelpBot help,stats,time" C-m
106
-
107
- # Split for FunBot (right pane)
108
- tmux split-window -t $SESSION_NAME:2 -h
109
- tmux send-keys -t $SESSION_NAME:2.1 "cd '$CHAT_DIR'" C-m
110
- tmux send-keys -t $SESSION_NAME:2.1 "ruby bot_agent.rb funbot FunBot joke,weather,echo" C-m
111
-
112
- # Wait for bots to start
113
- sleep 2
114
-
115
- # Auto-join agents to rooms for demo
116
- echo -e "${GREEN}🏠 Auto-joining agents to rooms...${NC}"
117
-
118
- # Alice joins general and tech
119
- tmux send-keys -t $SESSION_NAME:1.0 "/join general" C-m
120
- sleep 0.5
121
- tmux send-keys -t $SESSION_NAME:1.0 "/join tech" C-m
122
-
123
- # Bob joins general and random
124
- tmux send-keys -t $SESSION_NAME:1.1 "/join general" C-m
125
- sleep 0.5
126
- tmux send-keys -t $SESSION_NAME:1.1 "/join random" C-m
127
-
128
- # Carol joins tech and random
129
- tmux send-keys -t $SESSION_NAME:1.2 "/join tech" C-m
130
- sleep 0.5
131
- tmux send-keys -t $SESSION_NAME:1.2 "/join random" C-m
132
-
133
- # Bots join rooms
134
- tmux send-keys -t $SESSION_NAME:2.0 "/join general" C-m
135
- sleep 0.5
136
- tmux send-keys -t $SESSION_NAME:2.0 "/join tech" C-m
137
-
138
- tmux send-keys -t $SESSION_NAME:2.1 "/join general" C-m
139
- sleep 0.5
140
- tmux send-keys -t $SESSION_NAME:2.1 "/join random" C-m
141
-
142
- sleep 1
143
-
144
- # Send some initial messages to demonstrate the system
145
- echo -e "${GREEN}💬 Sending demo messages...${NC}"
146
-
147
- tmux send-keys -t $SESSION_NAME:1.0 "Hello everyone! I'm Alice." C-m
148
- sleep 1
149
- tmux send-keys -t $SESSION_NAME:1.1 "Hi Alice! Bob here." C-m
150
- sleep 1
151
- tmux send-keys -t $SESSION_NAME:1.2 "Carol joining the conversation!" C-m
152
- sleep 1
153
- tmux send-keys -t $SESSION_NAME:1.0 "/help" C-m
154
- sleep 2
155
- tmux send-keys -t $SESSION_NAME:1.1 "/joke" C-m
156
- sleep 2
157
-
158
- # Set focus to Human Agents window
159
- tmux select-window -t $SESSION_NAME:1
160
-
161
- echo -e "${GREEN}✅ Chat demo is ready!${NC}"
162
- echo ""
163
- echo -e "${BLUE}Navigation:${NC}"
164
- echo "• Ctrl+b then 0: Control Center (room monitors)"
165
- echo "• Ctrl+b then 1: Human Agents (Alice, Bob, Carol)"
166
- echo "• Ctrl+b then 2: Bot Agents (HelpBot, FunBot)"
167
- echo "• Ctrl+b then o: Cycle through panes"
168
- echo "• Ctrl+b then arrow keys: Navigate panes"
169
- echo ""
170
- echo -e "${BLUE}Commands in agent panes:${NC}"
171
- echo "• /join <room>: Join a room"
172
- echo "• /leave <room>: Leave a room"
173
- echo "• /list: List your active rooms"
174
- echo "• /help: Show available commands"
175
- echo "• /quit: Exit the agent"
176
- echo ""
177
- echo -e "${BLUE}Bot commands:${NC}"
178
- echo "• /help: Show bot capabilities"
179
- echo "• /joke: Get a random joke"
180
- echo "• /weather <location>: Get weather"
181
- echo "• /stats: Show bot statistics"
182
- echo "• /time: Show current time"
183
- echo "• /echo <message>: Echo your message"
184
- echo ""
185
- echo -e "${YELLOW}💡 Tip: Type messages directly to chat in your active rooms!${NC}"
186
- echo ""
187
- echo -e "${GREEN}🎭 Attaching to tmux session...${NC}"
188
-
189
- # Attach to the session
190
- tmux attach-session -t $SESSION_NAME
@@ -1,22 +0,0 @@
1
- #!/bin/bash
2
- # examples/tmux_chat/stop_chat_demo.sh
3
- #
4
- # Cleanup script for the tmux chat demo
5
-
6
- SESSION_NAME="smart_message_chat"
7
-
8
- echo "🧹 Stopping SmartMessage Tmux Chat Demo..."
9
-
10
- # Kill the tmux session if it exists
11
- if tmux has-session -t $SESSION_NAME 2>/dev/null; then
12
- echo "🔴 Terminating tmux session..."
13
- tmux kill-session -t $SESSION_NAME
14
- else
15
- echo "ℹ️ No active tmux session found."
16
- fi
17
-
18
- # Clean up shared message queues
19
- echo "🗑️ Cleaning up message queues..."
20
- rm -rf /tmp/smart_message_chat
21
-
22
- echo "✅ Cleanup complete!"