Skip to content

Commit 222b062

Browse files
Sergey Kleinclaude
andcommitted
feat: add adapter base class and project roadmap
Add PulseAdapter abstract base class — the foundation for the adapter ecosystem (v0.6.0). Adapters bridge PULSE messages to external APIs, enabling "write once, work with any service" pattern. Features: - Abstract base class with send/to_native/call_api/from_native pipeline - HTTP error code → PULSE error concept mapping - Health check with request/error tracking - Standardized error response creation - Action support declaration and checking - Connection lifecycle management (connect/disconnect) Also: - Add ROADMAP.md with v0.6.0-v1.0.0 development plan - Fix pyproject.toml version (0.4.0 → 0.5.0) and GitHub URLs - 28 new adapter tests (total: 284 tests, all passing) - Export PulseAdapter, AdapterError, AdapterConnectionError from pulse package Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2f72840 commit 222b062

5 files changed

Lines changed: 925 additions & 6 deletions

File tree

ROADMAP.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# PULSE Protocol — Roadmap
2+
3+
## Current: v0.5.0 (Alpha)
4+
5+
**Completed:**
6+
- Core message system (3-layer architecture)
7+
- JSON encoding (human-readable)
8+
- Binary encoding (MessagePack, 10x compression)
9+
- Compact encoding (13x compression)
10+
- Vocabulary system (1,000 concepts, 10 categories)
11+
- 3-stage message validation
12+
- HMAC-SHA256 signing & verification
13+
- Replay protection (timestamp + nonce)
14+
- TLS transport layer (HTTPS client/server)
15+
- CLI tool (6 commands)
16+
- 256+ tests, 90%+ coverage
17+
- 8 working examples
18+
19+
---
20+
21+
## Next: v0.6.0 — Adapters (The Bridge Phase)
22+
23+
**Goal:** Make PULSE useful TODAY, before anyone adopts it natively.
24+
25+
Adapters translate PULSE messages into existing APIs. Your bot speaks PULSE, the adapter translates. The target service doesn't even know PULSE exists.
26+
27+
```
28+
Your bot → PULSE message → Adapter → Target API
29+
Target API → Response → Adapter → PULSE message → Your bot
30+
```
31+
32+
### Priority Adapters
33+
34+
| Adapter | Package | What it does |
35+
|---------|---------|-------------|
36+
| **OpenAI** | `pulse-openai` | Talk to GPT models via PULSE messages |
37+
| **Anthropic** | `pulse-anthropic` | Talk to Claude via PULSE messages |
38+
| **Binance** | `pulse-binance` | Trade on Binance via PULSE messages |
39+
| **Slack** | `pulse-slack` | Send/receive Slack messages via PULSE |
40+
| **GitHub** | `pulse-github` | Interact with GitHub API via PULSE |
41+
42+
### How Adapters Work
43+
44+
```python
45+
from pulse import PulseMessage
46+
from pulse_openai import OpenAIAdapter
47+
48+
adapter = OpenAIAdapter(api_key="sk-...")
49+
50+
# Your bot speaks PULSE — adapter translates to OpenAI API
51+
request = PulseMessage(
52+
action="ACT.ANALYZE.SENTIMENT",
53+
target="ENT.DATA.TEXT",
54+
parameters={"text": "Bitcoin is going to the moon!"}
55+
)
56+
57+
# Adapter converts PULSE → OpenAI API call → PULSE response
58+
response = adapter.send(request)
59+
# response.content["result"]["sentiment"] == "PROP.SENTIMENT.POSITIVE"
60+
```
61+
62+
### Switching providers = one line change
63+
64+
```python
65+
# Today: OpenAI
66+
from pulse_openai import OpenAIAdapter
67+
adapter = OpenAIAdapter(api_key="sk-...")
68+
69+
# Tomorrow: Anthropic (same bot code, different adapter)
70+
from pulse_anthropic import AnthropicAdapter
71+
adapter = AnthropicAdapter(api_key="sk-ant-...")
72+
73+
# Same request works with both:
74+
response = adapter.send(request)
75+
```
76+
77+
### Adapter Architecture
78+
79+
Every adapter implements the same interface:
80+
81+
```python
82+
class PulseAdapter:
83+
"""Base adapter interface."""
84+
85+
def send(self, message: PulseMessage) -> PulseMessage:
86+
"""Send PULSE message, get PULSE response."""
87+
native_request = self.to_native(message) # PULSE → API format
88+
native_response = self.call_api(native_request) # Call target API
89+
return self.from_native(native_response) # API format → PULSE
90+
91+
def to_native(self, message: PulseMessage) -> dict:
92+
"""Convert PULSE message to target API format."""
93+
...
94+
95+
def from_native(self, response: dict) -> PulseMessage:
96+
"""Convert target API response to PULSE message."""
97+
...
98+
```
99+
100+
---
101+
102+
## v0.7.0 — Multi-Agent Framework
103+
104+
**Goal:** Enable multiple PULSE agents to work together.
105+
106+
- Agent registry (discover other agents)
107+
- Message routing (send to the right agent)
108+
- Workflow orchestration (chain agents together)
109+
- Load balancing (distribute work across agents)
110+
111+
---
112+
113+
## v0.8.0 — PULSE Transactions
114+
115+
**Goal:** Economic layer for autonomous AI agents.
116+
117+
- Transaction vocabulary (`ACT.TRANSACT.*`, `PROP.COST.*`, `ENT.RESOURCE.*`)
118+
- Transaction lifecycle (request → offer → accept → settle)
119+
- Cryptographic settlement (signed, verified, auditable)
120+
- See: [pulse-transactions/](../pulse-transactions/)
121+
122+
---
123+
124+
## v1.0.0 — Production Release
125+
126+
**Goal:** Production-ready protocol for enterprise and community use.
127+
128+
- Stable API (no breaking changes after v1.0)
129+
- PyPI publication (`pip install pulse-protocol`)
130+
- Complete documentation
131+
- Security audit
132+
- Performance optimization
133+
- Framework integrations (LangChain, CrewAI, AutoGen)
134+
135+
---
136+
137+
## Future
138+
139+
- **Rust implementation** — High-performance, embedded systems
140+
- **Go implementation** — Cloud-native, microservices
141+
- **JavaScript/TypeScript** — Browser and Node.js
142+
- **Native adoption** — Platforms support PULSE directly (no adapters needed)
143+
- **IETF RFC** — Submit PULSE as an internet standard
144+
145+
---
146+
147+
## Adoption Strategy
148+
149+
### Phase 1: Adapters (v0.6.0)
150+
Developers use PULSE between their own agents. Adapters translate to existing APIs. No one else needs to change anything.
151+
152+
### Phase 2: Community (v0.7.0-v0.8.0)
153+
Multi-agent frameworks and transaction support attract more developers. Open-source adapters grow organically.
154+
155+
### Phase 3: Native Adoption (v1.0+)
156+
When enough bots use PULSE, platforms adopt it natively. Adapters become unnecessary. Full speed, full compression, full benefit.
157+
158+
**This is exactly how HTTP, TCP/IP, and USB became standards — bottom-up adoption, not top-down mandate.**
159+
160+
---
161+
162+
*Created by Sergej Klein*
163+
*License: Apache 2.0 — free forever*

pulse/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from pulse.client import PulseClient
1515
from pulse.server import PulseServer
1616
from pulse.tls import TLSConfig, generate_self_signed_cert
17+
from pulse.adapter import PulseAdapter, AdapterError, AdapterConnectionError
1718
from pulse.exceptions import (
1819
PulseException,
1920
ValidationError,
@@ -41,6 +42,9 @@
4142
"PulseServer",
4243
"TLSConfig",
4344
"generate_self_signed_cert",
45+
"PulseAdapter",
46+
"AdapterError",
47+
"AdapterConnectionError",
4448
"PulseException",
4549
"ValidationError",
4650
"EncodingError",

0 commit comments

Comments
 (0)