smart_message 0.0.10 → 0.0.12
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 +4 -4
- data/.github/workflows/deploy-github-pages.yml +38 -0
- data/.gitignore +5 -0
- data/CHANGELOG.md +30 -0
- data/Gemfile.lock +35 -4
- data/README.md +169 -71
- data/Rakefile +29 -4
- data/docs/assets/images/ddq_architecture.svg +130 -0
- data/docs/assets/images/dlq_architecture.svg +115 -0
- data/docs/assets/images/enhanced-dual-publishing.svg +136 -0
- data/docs/assets/images/enhanced-fluent-api.svg +149 -0
- data/docs/assets/images/enhanced-microservices-routing.svg +115 -0
- data/docs/assets/images/enhanced-pattern-matching.svg +107 -0
- data/docs/assets/images/fluent-api-demo.svg +59 -0
- data/docs/assets/images/performance-comparison.svg +161 -0
- data/docs/assets/images/redis-basic-architecture.svg +53 -0
- data/docs/assets/images/redis-enhanced-architecture.svg +88 -0
- data/docs/assets/images/redis-queue-architecture.svg +101 -0
- data/docs/assets/images/smart_message.jpg +0 -0
- data/docs/assets/images/smart_message_walking.jpg +0 -0
- data/docs/assets/images/smartmessage_architecture_overview.svg +173 -0
- data/docs/assets/images/transport-comparison-matrix.svg +171 -0
- data/docs/assets/javascripts/mathjax.js +17 -0
- data/docs/assets/stylesheets/extra.css +51 -0
- data/docs/{addressing.md → core-concepts/addressing.md} +5 -7
- data/docs/{architecture.md → core-concepts/architecture.md} +78 -138
- data/docs/{dispatcher.md → core-concepts/dispatcher.md} +21 -21
- data/docs/{message_filtering.md → core-concepts/message-filtering.md} +2 -3
- data/docs/{message_processing.md → core-concepts/message-processing.md} +17 -17
- data/docs/{troubleshooting.md → development/troubleshooting.md} +7 -7
- data/docs/{examples.md → getting-started/examples.md} +115 -89
- data/docs/{getting-started.md → getting-started/quick-start.md} +47 -18
- data/docs/guides/redis-queue-getting-started.md +697 -0
- data/docs/guides/redis-queue-patterns.md +889 -0
- data/docs/guides/redis-queue-production.md +1091 -0
- data/docs/index.md +64 -0
- data/docs/{dead_letter_queue.md → reference/dead-letter-queue.md} +2 -3
- data/docs/{logging.md → reference/logging.md} +1 -1
- data/docs/{message_deduplication.md → reference/message-deduplication.md} +1 -0
- data/docs/{proc_handlers_summary.md → reference/proc-handlers.md} +7 -6
- data/docs/{serializers.md → reference/serializers.md} +3 -5
- data/docs/{transports.md → reference/transports.md} +133 -11
- data/docs/transports/memory-transport.md +374 -0
- data/docs/transports/redis-enhanced-transport.md +524 -0
- data/docs/transports/redis-queue-transport.md +1304 -0
- data/docs/transports/redis-transport-comparison.md +496 -0
- data/docs/transports/redis-transport.md +509 -0
- data/examples/README.md +98 -5
- data/examples/city_scenario/911_emergency_call_flow.svg +99 -0
- data/examples/city_scenario/README.md +515 -0
- data/examples/city_scenario/ai_visitor_intelligence_flow.svg +108 -0
- data/examples/city_scenario/citizen.rb +195 -0
- data/examples/city_scenario/city_diagram.svg +125 -0
- data/examples/city_scenario/common/health_monitor.rb +80 -0
- data/examples/city_scenario/common/logger.rb +30 -0
- data/examples/city_scenario/emergency_dispatch_center.rb +270 -0
- data/examples/city_scenario/fire_department.rb +446 -0
- data/examples/city_scenario/fire_emergency_flow.svg +95 -0
- data/examples/city_scenario/health_department.rb +100 -0
- data/examples/city_scenario/health_monitoring_system.svg +130 -0
- data/examples/city_scenario/house.rb +244 -0
- data/examples/city_scenario/local_bank.rb +217 -0
- data/examples/city_scenario/messages/emergency_911_message.rb +81 -0
- data/examples/city_scenario/messages/emergency_resolved_message.rb +43 -0
- data/examples/city_scenario/messages/fire_dispatch_message.rb +43 -0
- data/examples/city_scenario/messages/fire_emergency_message.rb +45 -0
- data/examples/city_scenario/messages/health_check_message.rb +22 -0
- data/examples/city_scenario/messages/health_status_message.rb +35 -0
- data/examples/city_scenario/messages/police_dispatch_message.rb +46 -0
- data/examples/city_scenario/messages/silent_alarm_message.rb +38 -0
- data/examples/city_scenario/police_department.rb +316 -0
- data/examples/city_scenario/redis_monitor.rb +129 -0
- data/examples/city_scenario/redis_stats.rb +743 -0
- data/examples/city_scenario/room_for_improvement.md +240 -0
- data/examples/city_scenario/security_emergency_flow.svg +95 -0
- data/examples/city_scenario/service_internal_architecture.svg +154 -0
- data/examples/city_scenario/smart_message_ai_agent.rb +364 -0
- data/examples/city_scenario/start_demo.sh +236 -0
- data/examples/city_scenario/stop_demo.sh +106 -0
- data/examples/city_scenario/visitor.rb +631 -0
- data/examples/{10_message_deduplication.rb → memory/01_message_deduplication_demo.rb} +1 -1
- data/examples/{09_dead_letter_queue_demo.rb → memory/02_dead_letter_queue_demo.rb} +13 -40
- data/examples/{01_point_to_point_orders.rb → memory/03_point_to_point_orders.rb} +1 -1
- data/examples/{02_publish_subscribe_events.rb → memory/04_publish_subscribe_events.rb} +2 -2
- data/examples/{03_many_to_many_chat.rb → memory/05_many_to_many_chat.rb} +4 -4
- data/examples/{show_me.rb → memory/06_pretty_print_demo.rb} +1 -1
- data/examples/{05_proc_handlers.rb → memory/07_proc_handlers_demo.rb} +2 -2
- data/examples/{06_custom_logger_example.rb → memory/08_custom_logger_demo.rb} +17 -14
- data/examples/{07_error_handling_scenarios.rb → memory/09_error_handling_demo.rb} +4 -4
- data/examples/{08_entity_addressing_basic.rb → memory/10_entity_addressing_basic.rb} +8 -8
- data/examples/{08_entity_addressing_with_filtering.rb → memory/11_entity_addressing_with_filtering.rb} +6 -6
- data/examples/{09_regex_filtering_microservices.rb → memory/12_regex_filtering_microservices.rb} +2 -2
- data/examples/{10_header_block_configuration.rb → memory/13_header_block_configuration.rb} +6 -6
- data/examples/{11_global_configuration_example.rb → memory/14_global_configuration_demo.rb} +19 -8
- data/examples/{show_logger.rb → memory/15_logger_demo.rb} +1 -1
- data/examples/memory/README.md +163 -0
- data/examples/memory/memory_transport_architecture.svg +90 -0
- data/examples/memory/point_to_point_pattern.svg +94 -0
- data/examples/memory/publish_subscribe_pattern.svg +125 -0
- data/examples/{04_redis_smart_home_iot.rb → redis/01_smart_home_iot_demo.rb} +5 -5
- data/examples/redis/README.md +230 -0
- data/examples/redis/alert_system_flow.svg +127 -0
- data/examples/redis/dashboard_status_flow.svg +107 -0
- data/examples/redis/device_command_flow.svg +113 -0
- data/examples/redis/redis_transport_architecture.svg +115 -0
- data/examples/{smart_home_iot_dataflow.md → redis/smart_home_iot_dataflow.md} +4 -116
- data/examples/redis/smart_home_system_architecture.svg +133 -0
- data/examples/redis_enhanced/README.md +319 -0
- data/examples/redis_enhanced/enhanced_01_basic_patterns.rb +233 -0
- data/examples/redis_enhanced/enhanced_02_fluent_api.rb +331 -0
- data/examples/redis_enhanced/enhanced_03_dual_publishing.rb +281 -0
- data/examples/redis_enhanced/enhanced_04_advanced_routing.rb +419 -0
- data/examples/redis_queue/01_basic_messaging.rb +221 -0
- data/examples/redis_queue/01_comprehensive_examples.rb +508 -0
- data/examples/redis_queue/02_pattern_routing.rb +405 -0
- data/examples/redis_queue/03_fluent_api.rb +422 -0
- data/examples/redis_queue/04_load_balancing.rb +486 -0
- data/examples/redis_queue/05_microservices.rb +735 -0
- data/examples/redis_queue/06_emergency_alerts.rb +777 -0
- data/examples/redis_queue/07_queue_management.rb +587 -0
- data/examples/redis_queue/README.md +366 -0
- data/examples/redis_queue/enhanced_01_basic_patterns.rb +233 -0
- data/examples/redis_queue/enhanced_02_fluent_api.rb +331 -0
- data/examples/redis_queue/enhanced_03_dual_publishing.rb +281 -0
- data/examples/redis_queue/enhanced_04_advanced_routing.rb +419 -0
- data/examples/redis_queue/redis_queue_architecture.svg +148 -0
- data/ideas/README.md +41 -0
- data/ideas/agents.md +1001 -0
- data/ideas/database_transport.md +980 -0
- data/ideas/improvement.md +359 -0
- data/ideas/meshage.md +1788 -0
- data/ideas/message_discovery.md +178 -0
- data/ideas/message_schema.md +1381 -0
- data/lib/smart_message/.idea/.gitignore +8 -0
- data/lib/smart_message/.idea/markdown.xml +6 -0
- data/lib/smart_message/.idea/misc.xml +4 -0
- data/lib/smart_message/.idea/modules.xml +8 -0
- data/lib/smart_message/.idea/smart_message.iml +16 -0
- data/lib/smart_message/.idea/vcs.xml +6 -0
- data/lib/smart_message/addressing.rb +15 -0
- data/lib/smart_message/base.rb +0 -2
- data/lib/smart_message/configuration.rb +1 -1
- data/lib/smart_message/logger.rb +15 -4
- data/lib/smart_message/plugins.rb +5 -2
- data/lib/smart_message/serializer.rb +14 -0
- data/lib/smart_message/transport/redis_enhanced_transport.rb +399 -0
- data/lib/smart_message/transport/redis_queue_transport.rb +555 -0
- data/lib/smart_message/transport/registry.rb +1 -0
- data/lib/smart_message/transport.rb +34 -1
- data/lib/smart_message/version.rb +1 -1
- data/lib/smart_message.rb +5 -52
- data/mkdocs.yml +184 -0
- data/p2p_plan.md +326 -0
- data/p2p_roadmap.md +287 -0
- data/smart_message.gemspec +2 -0
- data/smart_message.svg +51 -0
- metadata +170 -44
- data/docs/README.md +0 -57
- data/examples/dead_letters.jsonl +0 -12
- data/examples/temp.txt +0 -94
- data/examples/tmux_chat/README.md +0 -283
- data/examples/tmux_chat/bot_agent.rb +0 -278
- data/examples/tmux_chat/human_agent.rb +0 -199
- data/examples/tmux_chat/room_monitor.rb +0 -160
- data/examples/tmux_chat/shared_chat_system.rb +0 -328
- data/examples/tmux_chat/start_chat_demo.sh +0 -190
- data/examples/tmux_chat/stop_chat_demo.sh +0 -22
- /data/docs/{properties.md → core-concepts/properties.md} +0 -0
- /data/docs/{ideas_to_think_about.md → development/ideas.md} +0 -0
data/mkdocs.yml
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
site_name: SmartMessage Documentation
|
2
|
+
site_description: "Intelligent messages that know what to do and how to do it"
|
3
|
+
site_author: "madbomber"
|
4
|
+
site_url: "https://madbomber.github.io/smart_message/"
|
5
|
+
|
6
|
+
repo_name: "madbomber/smart_message"
|
7
|
+
repo_url: "https://github.com/madbomber/smart_message"
|
8
|
+
edit_uri: "edit/main/docs/"
|
9
|
+
|
10
|
+
theme:
|
11
|
+
name: material
|
12
|
+
language: en
|
13
|
+
|
14
|
+
# Logo and favicon
|
15
|
+
logo: assets/smart_message.jpg
|
16
|
+
favicon: assets/smart_message.jpg
|
17
|
+
|
18
|
+
# Color palette
|
19
|
+
palette:
|
20
|
+
# Light mode
|
21
|
+
- media: "(prefers-color-scheme: light)"
|
22
|
+
scheme: default
|
23
|
+
primary: brown
|
24
|
+
accent: amber
|
25
|
+
toggle:
|
26
|
+
icon: material/brightness-7
|
27
|
+
name: Switch to dark mode
|
28
|
+
|
29
|
+
# Dark mode
|
30
|
+
- media: "(prefers-color-scheme: dark)"
|
31
|
+
scheme: slate
|
32
|
+
primary: brown
|
33
|
+
accent: amber
|
34
|
+
toggle:
|
35
|
+
icon: material/brightness-4
|
36
|
+
name: Switch to light mode
|
37
|
+
|
38
|
+
# Font configuration
|
39
|
+
font:
|
40
|
+
text: Roboto
|
41
|
+
code: Roboto Mono
|
42
|
+
|
43
|
+
# Theme features
|
44
|
+
features:
|
45
|
+
# Navigation
|
46
|
+
- navigation.instant
|
47
|
+
- navigation.tracking
|
48
|
+
- navigation.tabs
|
49
|
+
- navigation.tabs.sticky
|
50
|
+
- navigation.sections
|
51
|
+
- navigation.path
|
52
|
+
- navigation.indexes
|
53
|
+
- navigation.top
|
54
|
+
|
55
|
+
# Table of contents
|
56
|
+
- toc.follow
|
57
|
+
|
58
|
+
# Search
|
59
|
+
- search.suggest
|
60
|
+
- search.highlight
|
61
|
+
- search.share
|
62
|
+
|
63
|
+
# Header
|
64
|
+
- header.autohide
|
65
|
+
|
66
|
+
# Content
|
67
|
+
- content.code.copy
|
68
|
+
- content.code.annotate
|
69
|
+
- content.tabs.link
|
70
|
+
- content.tooltips
|
71
|
+
- content.action.edit
|
72
|
+
- content.action.view
|
73
|
+
|
74
|
+
# Plugins
|
75
|
+
plugins:
|
76
|
+
- search:
|
77
|
+
separator: '[\s\-,:!=\[\]()"`/]+|\.(?!\d)|&[lg]t;|(?!\b)(?=[A-Z][a-z])'
|
78
|
+
- macros
|
79
|
+
|
80
|
+
# Extensions
|
81
|
+
markdown_extensions:
|
82
|
+
# Python Markdown
|
83
|
+
- abbr
|
84
|
+
- admonition
|
85
|
+
- attr_list
|
86
|
+
- def_list
|
87
|
+
- footnotes
|
88
|
+
- md_in_html
|
89
|
+
- toc:
|
90
|
+
permalink: true
|
91
|
+
title: On this page
|
92
|
+
|
93
|
+
# Python Markdown Extensions
|
94
|
+
- pymdownx.arithmatex:
|
95
|
+
generic: true
|
96
|
+
- pymdownx.betterem:
|
97
|
+
smart_enable: all
|
98
|
+
- pymdownx.caret
|
99
|
+
- pymdownx.details
|
100
|
+
- pymdownx.emoji:
|
101
|
+
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
102
|
+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
103
|
+
- pymdownx.highlight:
|
104
|
+
anchor_linenums: true
|
105
|
+
line_spans: __span
|
106
|
+
pygments_lang_class: true
|
107
|
+
- pymdownx.inlinehilite
|
108
|
+
- pymdownx.keys
|
109
|
+
- pymdownx.magiclink:
|
110
|
+
repo_url_shorthand: true
|
111
|
+
user: madbomber
|
112
|
+
repo: smart_message
|
113
|
+
- pymdownx.mark
|
114
|
+
- pymdownx.smartsymbols
|
115
|
+
- pymdownx.superfences:
|
116
|
+
custom_fences:
|
117
|
+
- name: mermaid
|
118
|
+
class: mermaid
|
119
|
+
format: !!python/name:pymdownx.superfences.fence_code_format
|
120
|
+
- pymdownx.tabbed:
|
121
|
+
alternate_style: true
|
122
|
+
- pymdownx.tasklist:
|
123
|
+
custom_checkbox: true
|
124
|
+
- pymdownx.tilde
|
125
|
+
|
126
|
+
# Additional CSS and JavaScript
|
127
|
+
extra_css:
|
128
|
+
- assets/stylesheets/extra.css
|
129
|
+
|
130
|
+
extra_javascript:
|
131
|
+
- assets/javascripts/mathjax.js
|
132
|
+
- https://polyfill.io/v3/polyfill.min.js?features=es6
|
133
|
+
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
|
134
|
+
|
135
|
+
# Extra content
|
136
|
+
extra:
|
137
|
+
# Version string
|
138
|
+
version: 0.1.11
|
139
|
+
|
140
|
+
# Social media links
|
141
|
+
social:
|
142
|
+
- icon: fontawesome/brands/github
|
143
|
+
link: https://github.com/madbomber/smart_message
|
144
|
+
name: GitHub Repository
|
145
|
+
|
146
|
+
# Generator notice
|
147
|
+
generator: false
|
148
|
+
|
149
|
+
# Navigation with icons
|
150
|
+
nav:
|
151
|
+
- Home: index.md
|
152
|
+
- 🚀 Getting Started:
|
153
|
+
- Quick Start: getting-started/quick-start.md
|
154
|
+
- Examples: getting-started/examples.md
|
155
|
+
- 📖 Core Concepts:
|
156
|
+
- Architecture: core-concepts/architecture.md
|
157
|
+
- Properties: core-concepts/properties.md
|
158
|
+
- Addressing: core-concepts/addressing.md
|
159
|
+
- Dispatcher: core-concepts/dispatcher.md
|
160
|
+
- Message Filtering: core-concepts/message-filtering.md
|
161
|
+
- Message Processing: core-concepts/message-processing.md
|
162
|
+
- 🔌 Reference:
|
163
|
+
- Transports: reference/transports.md
|
164
|
+
- Serializers: reference/serializers.md
|
165
|
+
- Logging: reference/logging.md
|
166
|
+
- Dead Letter Queue: reference/dead-letter-queue.md
|
167
|
+
- Message Deduplication: reference/message-deduplication.md
|
168
|
+
- Proc Handlers: reference/proc-handlers.md
|
169
|
+
- 🚚 Transports:
|
170
|
+
- Memory Transport: transports/memory-transport.md
|
171
|
+
- Redis Transport: transports/redis-transport.md
|
172
|
+
- Redis Enhanced Transport: transports/redis-enhanced-transport.md
|
173
|
+
- Redis Queue Transport: transports/redis-queue-transport.md
|
174
|
+
- Redis Transport Comparison: transports/redis-transport-comparison.md
|
175
|
+
- 📚 Guides:
|
176
|
+
- Redis Queue Getting Started: guides/redis-queue-getting-started.md
|
177
|
+
- Redis Queue Patterns: guides/redis-queue-patterns.md
|
178
|
+
- Redis Queue Production: guides/redis-queue-production.md
|
179
|
+
- ⚙️ Development:
|
180
|
+
- Troubleshooting: development/troubleshooting.md
|
181
|
+
- Ideas & Roadmap: development/ideas.md
|
182
|
+
|
183
|
+
# Copyright
|
184
|
+
copyright: Copyright © 2025 madbomber
|
data/p2p_plan.md
ADDED
@@ -0,0 +1,326 @@
|
|
1
|
+
# SmartMessage P2P Communication Plan
|
2
|
+
|
3
|
+
## SmartMessage in Multi-Gem Integration Strategy
|
4
|
+
|
5
|
+
### Enhanced BunnyFarm + SmartMessage Extension Architecture
|
6
|
+
|
7
|
+
**Strategic Insight**: Instead of integrating four separate gems, enhance BunnyFarm with SmartMessage capabilities first, creating a powerful messaging foundation for Agent99. Use extension gems for transport modularity.
|
8
|
+
|
9
|
+
**Revised Architecture:**
|
10
|
+
|
11
|
+
The integrated architecture provides clean separation of concerns with enhanced BunnyFarm as the unified messaging layer, supported by modular transport extensions.
|
12
|
+
|
13
|
+
## BunnyFarm + SmartMessage Integration Analysis
|
14
|
+
|
15
|
+
### SmartMessage Enhancement Strategy
|
16
|
+
|
17
|
+
**Replace `BunnyFarm::Message` with `SmartMessage::Base`:**
|
18
|
+
```ruby
|
19
|
+
# Enhanced BunnyFarm using SmartMessage
|
20
|
+
class CapabilityRequest < SmartMessage::Base
|
21
|
+
config do
|
22
|
+
transport BunnyFarm::Transport.new # Retains workflow capabilities
|
23
|
+
serializer SmartMessage::Serializer::JSON.new
|
24
|
+
end
|
25
|
+
|
26
|
+
# BunnyFarm's workflow methods
|
27
|
+
def process
|
28
|
+
# Message processing with transport abstraction
|
29
|
+
end
|
30
|
+
|
31
|
+
def success
|
32
|
+
# Success handling across any transport
|
33
|
+
end
|
34
|
+
|
35
|
+
def failure
|
36
|
+
# Failure handling with transport flexibility
|
37
|
+
end
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
### Enhanced BunnyFarm Benefits
|
42
|
+
1. **Unified Messaging System**: SmartMessage transport abstraction + BunnyFarm workflows
|
43
|
+
2. **Multi-Transport Workflows**: Run BunnyFarm patterns across rabb, Lanet, NATS
|
44
|
+
3. **Stronger Foundation**: Single enhanced gem vs multiple integrations
|
45
|
+
4. **Reusable Components**: Enhanced BunnyFarm benefits other projects
|
46
|
+
5. **Proven Patterns**: Combines best of both architectural approaches
|
47
|
+
|
48
|
+
## Lanet Gem Integration Analysis
|
49
|
+
|
50
|
+
### Integrated Three-Gem Strategy
|
51
|
+
|
52
|
+
**Recommended Approach: SmartMessage + Lanet + Existing Brokers**
|
53
|
+
- **SmartMessage provides unified messaging API** across all transports
|
54
|
+
- **Lanet handles LAN P2P communication** (high-performance local scenarios)
|
55
|
+
- **Existing NATS/rabbitmq brokers handle WAN** communication and initial discovery
|
56
|
+
- **Registry remains** for global agent discovery and coordination
|
57
|
+
|
58
|
+
**Implementation Benefits:**
|
59
|
+
- **Unified API**: SmartMessage provides consistent interface across all transports
|
60
|
+
- **Transport Abstraction**: Easy to switch or combine Lanet, NATS, rabbitmq
|
61
|
+
- **Proven Components**: Leverages existing gems rather than custom implementation
|
62
|
+
- **Built-in Security**: Lanet's encryption + SmartMessage's serialization
|
63
|
+
- **Flexible Routing**: SmartMessage can intelligently choose transport based on recipient
|
64
|
+
|
65
|
+
**Integration Points:**
|
66
|
+
```ruby
|
67
|
+
# SmartMessage transport plugins for Agent99
|
68
|
+
class Agent99::LanetTransport < SmartMessage::Transport::Base
|
69
|
+
def initialize(options = {})
|
70
|
+
@lanet_sender = Lanet::Sender.new
|
71
|
+
@lanet_receiver = Lanet::Receiver.new
|
72
|
+
end
|
73
|
+
|
74
|
+
def publish(message, options = {})
|
75
|
+
target_ip = resolve_agent_ip(message.to)
|
76
|
+
@lanet_sender.send_to(target_ip, message.to_json, encrypt: true)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Agent message classes using SmartMessage
|
81
|
+
class Agent99::RequestMessage < SmartMessage::Base
|
82
|
+
config do
|
83
|
+
# Automatically choose best transport based on target
|
84
|
+
transport Agent99::SmartTransport.new
|
85
|
+
serializer SmartMessage::Serializer::JSON.new
|
86
|
+
end
|
87
|
+
|
88
|
+
# Agent99 can now use clean messaging API
|
89
|
+
def send_capability_request(target_agent, capability)
|
90
|
+
publish :capability_request,
|
91
|
+
to: target_agent,
|
92
|
+
capability: capability
|
93
|
+
end
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
**Smart Transport Selection Strategy:**
|
98
|
+
|
99
|
+
**Agent99 Multi-Process Transport Selection:**
|
100
|
+
1. **Same Process**: Memory transport (instant delivery)
|
101
|
+
2. **Same Machine (Direct)**: Named Pipes transport (OS-level IPC)
|
102
|
+
3. **Same Machine (Pub/Sub)**: Redis transport (local pub/sub)
|
103
|
+
4. **Same LAN**: Lanet transport (P2P encrypted)
|
104
|
+
5. **Reliable Required**: rabbitmq transport (guaranteed delivery)
|
105
|
+
6. **High Performance**: NATS transport (distributed coordination)
|
106
|
+
|
107
|
+
**Transport Performance Characteristics:**
|
108
|
+
- **Memory**: ~1μs latency (in-process)
|
109
|
+
- **Named Pipes**: ~25μs latency (kernel-level IPC)
|
110
|
+
- **Redis**: ~100μs latency (local network stack)
|
111
|
+
- **Lanet**: ~1ms latency (LAN P2P encrypted)
|
112
|
+
- **NATS**: ~2ms latency (high-performance distributed)
|
113
|
+
- **rabbitmq**: ~5ms latency (reliable enterprise messaging)
|
114
|
+
|
115
|
+
## SmartMessage Transport Extension System
|
116
|
+
|
117
|
+
### Extension Gem Architecture
|
118
|
+
|
119
|
+
**Modular Transport Design:**
|
120
|
+
- **Core SmartMessage**: Lightweight with Memory + Redis transports
|
121
|
+
- **Extension Gems**: Optional transport implementations
|
122
|
+
- **Plugin System**: Auto-registration when gems are loaded
|
123
|
+
- **Unified API**: Same interface across all transports
|
124
|
+
|
125
|
+
### Extension Gem Structure
|
126
|
+
|
127
|
+
**Recommended Extension Gems:**
|
128
|
+
```ruby
|
129
|
+
# Core lightweight gem
|
130
|
+
gem 'smart_message' # Memory + Redis
|
131
|
+
|
132
|
+
# Transport extensions (install as needed)
|
133
|
+
gem 'smart_message-transport-named_pipes' # OS-level IPC for same-machine
|
134
|
+
gem 'smart_message-transport-rabbitmq' # Enterprise reliability
|
135
|
+
gem 'smart_message-transport-lanet' # LAN P2P optimization
|
136
|
+
gem 'smart_message-transport-nats' # High-performance distributed
|
137
|
+
```
|
138
|
+
|
139
|
+
## Named Pipes Transport Design
|
140
|
+
|
141
|
+
### Naming Convention & Configuration
|
142
|
+
|
143
|
+
**Standard Naming Pattern:**
|
144
|
+
```
|
145
|
+
/tmp/agent99/pipes/{namespace}/{agent_id}.{direction}.pipe
|
146
|
+
```
|
147
|
+
|
148
|
+
**Components:**
|
149
|
+
- **Base Path**: `/tmp/agent99/pipes/` (configurable via ENV)
|
150
|
+
- **Namespace**: Group agents by application/environment
|
151
|
+
- **Agent ID**: Unique agent identifier (UUID or name)
|
152
|
+
- **Direction**: `in` (receive) or `out` (send) for unidirectional pipes
|
153
|
+
- **Extension**: `.pipe` for clarity
|
154
|
+
|
155
|
+
**Configuration Options:**
|
156
|
+
```ruby
|
157
|
+
class SmartMessage::Transport::NamedPipes
|
158
|
+
DEFAULT_CONFIG = {
|
159
|
+
base_path: ENV['AGENT99_PIPE_BASE'] || '/tmp/agent99/pipes',
|
160
|
+
namespace: ENV['AGENT99_NAMESPACE'] || 'default',
|
161
|
+
mode: :unidirectional, # Recommended for avoiding deadlocks
|
162
|
+
permissions: 0600, # Owner read/write only
|
163
|
+
cleanup: true, # Delete pipes on shutdown
|
164
|
+
buffer_size: 65536 # 64KB default buffer
|
165
|
+
}
|
166
|
+
end
|
167
|
+
```
|
168
|
+
|
169
|
+
### Named Pipes vs Redis Comparison
|
170
|
+
|
171
|
+
**Named Pipes Advantages:**
|
172
|
+
- **Performance**: 4x faster than Redis (~25μs vs ~100μs)
|
173
|
+
- **Zero Dependencies**: No Redis server required
|
174
|
+
- **Lower Resources**: Direct kernel communication
|
175
|
+
- **Native OS Support**: Built into all *nix systems
|
176
|
+
- **File System Security**: OS-level permission control
|
177
|
+
|
178
|
+
**Redis Advantages:**
|
179
|
+
- **Persistence**: Survives process restarts
|
180
|
+
- **Pub/Sub**: Built-in fan-out capabilities
|
181
|
+
- **Network Ready**: Can scale across machines
|
182
|
+
- **Mature Tooling**: Extensive debugging tools
|
183
|
+
|
184
|
+
**Selection Strategy:**
|
185
|
+
```ruby
|
186
|
+
def select_same_machine_transport(message_type)
|
187
|
+
if persistence_required?(message_type) || fan_out_required?(message_type)
|
188
|
+
:redis # Complex scenarios requiring pub/sub or persistence
|
189
|
+
else
|
190
|
+
:named_pipes # Default for direct agent-to-agent communication
|
191
|
+
end
|
192
|
+
end
|
193
|
+
```
|
194
|
+
|
195
|
+
### Transport Extension Benefits
|
196
|
+
|
197
|
+
**Modular Architecture Advantages:**
|
198
|
+
1. **Lightweight Core**: SmartMessage stays minimal with essential transports
|
199
|
+
2. **Optional Dependencies**: Users install only needed transport gems
|
200
|
+
3. **Independent Evolution**: Each transport can develop at its own pace
|
201
|
+
4. **Community Growth**: Plugin ecosystem encourages transport contributions
|
202
|
+
5. **Flexible Deployment**: Choose transports based on infrastructure needs
|
203
|
+
6. **Performance Optimization**: Named pipes for local, Redis for pub/sub
|
204
|
+
|
205
|
+
### Technical Considerations
|
206
|
+
|
207
|
+
**Message Format Adaptation:**
|
208
|
+
- SmartMessage handles JSON serialization uniformly across all transports
|
209
|
+
- Agent99 message headers map to SmartMessage entity addressing (FROM/TO/REPLY_TO)
|
210
|
+
- Enhanced BunnyFarm workflow methods (process/success/failure) work across transports
|
211
|
+
- Maintain compatibility with existing Agent99 message structure
|
212
|
+
|
213
|
+
**Transport Selection Logic:**
|
214
|
+
- Intelligent routing based on target agent location and message requirements
|
215
|
+
- Automatic fallback mechanisms when preferred transport unavailable
|
216
|
+
- Performance optimization through transport-specific configurations
|
217
|
+
- Health monitoring and connection management per transport
|
218
|
+
|
219
|
+
**Security Integration:**
|
220
|
+
- Transport-specific security implementations (Lanet encryption, rabbitmq SSL, etc.)
|
221
|
+
- SmartMessage can layer additional security through serialization
|
222
|
+
- Enhanced BunnyFarm maintains message workflow integrity across transports
|
223
|
+
- Centralized key management through Agent99 registry integration
|
224
|
+
|
225
|
+
## Revised Implementation Roadmap
|
226
|
+
|
227
|
+
### Phase 1: Enhanced BunnyFarm Foundation (Weeks 1-4)
|
228
|
+
1. **BunnyFarm + SmartMessage Integration**:
|
229
|
+
- Replace `BunnyFarm::Message` with `SmartMessage::Base`
|
230
|
+
- Migrate BunnyFarm's workflow capabilities to SmartMessage pattern
|
231
|
+
- Maintain automatic routing and configuration flexibility
|
232
|
+
2. **Multi-Transport Support**:
|
233
|
+
- Add transport abstraction while preserving BunnyFarm workflows
|
234
|
+
- Implement rabbitmq transport plugin using existing BunnyFarm patterns
|
235
|
+
- Design plugin architecture for future transports
|
236
|
+
3. **Enhanced Workflow System**:
|
237
|
+
- Extend BunnyFarm's process/success/failure pattern across transports
|
238
|
+
- Add SmartMessage entity addressing (FROM/TO/REPLY_TO)
|
239
|
+
- Maintain BunnyFarm's K.I.S.S. design philosophy
|
240
|
+
|
241
|
+
### Phase 2: Agent99 Integration (Weeks 5-6)
|
242
|
+
1. **Replace Agent99's rabbitmq Client**:
|
243
|
+
- Substitute basic rabbitmq client with enhanced BunnyFarm
|
244
|
+
- Map Agent99 message patterns to enhanced BunnyFarm workflows
|
245
|
+
- Maintain existing Agent99 API compatibility
|
246
|
+
2. **Workflow Integration**:
|
247
|
+
- Leverage enhanced BunnyFarm's workflow capabilities for agent processing
|
248
|
+
- Add success/failure handling to Agent99 message types
|
249
|
+
- Implement automatic routing for agent-to-agent communication
|
250
|
+
|
251
|
+
### Phase 3: Lanet P2P Integration (Weeks 7-8)
|
252
|
+
1. **Lanet Transport Plugin**:
|
253
|
+
- Add Lanet transport to enhanced BunnyFarm system
|
254
|
+
- Implement BunnyFarm workflow patterns over Lanet P2P
|
255
|
+
- Network discovery integration (registry + Lanet scanning)
|
256
|
+
2. **Intelligent Routing**:
|
257
|
+
- Smart transport selection (LAN via Lanet, WAN via rabbitmq)
|
258
|
+
- Fallback mechanisms and connection health monitoring
|
259
|
+
- Complete hybrid P2P system with workflow support
|
260
|
+
|
261
|
+
### Phase 4: Production Readiness (Weeks 9-10)
|
262
|
+
1. **System Integration**:
|
263
|
+
- End-to-end testing of Agent99 + Enhanced BunnyFarm + Lanet
|
264
|
+
- Performance optimization and monitoring
|
265
|
+
- Documentation and migration guides
|
266
|
+
2. **Advanced Features**:
|
267
|
+
- Load balancing and auto-scaling capabilities
|
268
|
+
- Advanced security and authentication integration
|
269
|
+
- Backward compatibility validation
|
270
|
+
|
271
|
+
## Open Questions
|
272
|
+
|
273
|
+
### Enhanced BunnyFarm + SmartMessage Questions
|
274
|
+
1. How do we migrate BunnyFarm's message workflows to SmartMessage without losing functionality?
|
275
|
+
2. Can BunnyFarm's automatic routing (`ClassName.action`) work with SmartMessage transport abstraction?
|
276
|
+
3. How do we maintain BunnyFarm's configuration flexibility while adding transport plugins?
|
277
|
+
4. What's the performance impact of adding transport abstraction to BunnyFarm workflows?
|
278
|
+
|
279
|
+
### Transport Extension Questions
|
280
|
+
5. Should transport extensions be auto-loaded or explicitly required?
|
281
|
+
6. How do we handle version compatibility between core SmartMessage and transport extensions?
|
282
|
+
7. What's the plugin registration mechanism for transport discovery?
|
283
|
+
8. How do we manage transport-specific configuration and connection pooling?
|
284
|
+
|
285
|
+
### Lanet Integration Questions
|
286
|
+
9. How does Lanet handle enhanced BunnyFarm workflow messages?
|
287
|
+
10. Can Lanet's network discovery integrate with Agent99's registry system?
|
288
|
+
11. What are Lanet's performance characteristics compared to other transports?
|
289
|
+
12. How should we handle key management for Lanet's encryption across multiple agents?
|
290
|
+
|
291
|
+
### NATS Integration Questions
|
292
|
+
13. How does NATS subject-based routing map to Agent99's capability-based routing?
|
293
|
+
14. Can NATS handle enhanced BunnyFarm workflow patterns effectively?
|
294
|
+
15. What's the optimal NATS clustering strategy for Agent99 multi-process coordination?
|
295
|
+
16. How do we integrate NATS monitoring with Agent99's health check system?
|
296
|
+
|
297
|
+
## Summary
|
298
|
+
|
299
|
+
This plan proposes enhancing BunnyFarm with SmartMessage capabilities first, creating a powerful unified messaging foundation for Agent99's P2P evolution:
|
300
|
+
|
301
|
+
**Revised Strategy Benefits:**
|
302
|
+
- **Enhanced BunnyFarm Foundation**: Single powerful messaging gem instead of multiple integrations
|
303
|
+
- **Workflow-Enabled Multi-Transport**: BunnyFarm's process/success/failure patterns across all transports
|
304
|
+
- **Cleaner Architecture**: Agent99 builds on enhanced BunnyFarm rather than managing multiple gems
|
305
|
+
- **Stronger Foundation**: Enhanced BunnyFarm benefits other projects beyond Agent99
|
306
|
+
- **Proven Patterns**: Combines SmartMessage transport abstraction with BunnyFarm workflow design
|
307
|
+
|
308
|
+
**Key Advantages:**
|
309
|
+
- **Unified Messaging System**: Enhanced BunnyFarm becomes the messaging layer for Agent99
|
310
|
+
- **Automatic Optimization**: Smart routing (LAN via Lanet, WAN via rabbitmq) with workflow support
|
311
|
+
- **Built-in Security**: Lanet encryption + SmartMessage abstraction + BunnyFarm reliability
|
312
|
+
- **Extensibility**: Plugin architecture in enhanced BunnyFarm supports future transports
|
313
|
+
- **Reusability**: Enhanced BunnyFarm becomes valuable for broader Ruby ecosystem
|
314
|
+
|
315
|
+
**Strategic Impact:**
|
316
|
+
- Creates a more cohesive and maintainable architecture
|
317
|
+
- Reduces integration complexity while increasing capabilities
|
318
|
+
- Positions both BunnyFarm and Agent99 as leading Ruby messaging solutions
|
319
|
+
- Provides foundation for advanced AI agent communication patterns
|
320
|
+
|
321
|
+
This approach transforms both BunnyFarm and Agent99 into industry-leading tools while maintaining their core design philosophies.
|
322
|
+
|
323
|
+
---
|
324
|
+
|
325
|
+
*Last Updated: 2025-01-03*
|
326
|
+
*Status: Planning Complete - Ready for Implementation*
|