89 lines
2.5 KiB
Markdown
89 lines
2.5 KiB
Markdown
# Bridge Sequence Flows (v1.1)
|
|
|
|
## Actors
|
|
- Dingo (human)
|
|
- agentchattr
|
|
- bridge
|
|
- shard-adapter -> Shard runtime
|
|
- prime-adapter -> Prime runtime
|
|
|
|
---
|
|
|
|
## Conversation-ID behavior note
|
|
- Inherit existing `conversation_id` for mapped reply/thread/job by default.
|
|
- Create new `conversation_id` for new top-level conversation starts.
|
|
- Fork to new `conversation_id` only on explicit fork or policy-triggered drift split.
|
|
|
|
---
|
|
|
|
## Flow A: Unmentioned message (fanout to both)
|
|
|
|
1. Dingo posts in `#general`: "Status check"
|
|
2. bridge reads event from chattr
|
|
3. bridge resolves targets = `[shard, prime]` (fanout policy)
|
|
4. bridge assigns/reuses `conversation_id`
|
|
5. bridge builds envelope + handoff (if needed)
|
|
6. bridge sends `POST /ingest` to shard-adapter and prime-adapter
|
|
7. adapters inject into existing runtime sessions
|
|
8. runtimes may respond (0/1/2 responses are all valid)
|
|
9. adapters return response events with same `correlation_id`
|
|
10. bridge posts responses back to chattr channel/thread
|
|
11. bridge records audit + dedupe state
|
|
|
|
---
|
|
|
|
## Flow B: Explicit mention to one actor
|
|
|
|
1. Dingo posts: "@prime please review routing"
|
|
2. bridge parses explicit target = `prime`
|
|
3. bridge sends only to prime-adapter
|
|
4. Prime response posted back with attribution `prime`
|
|
|
|
---
|
|
|
|
## Flow C: Cross-agent relay (prefer explicit mention)
|
|
|
|
1. Prime response includes explicit `@shard` ask
|
|
2. bridge routes to shard-adapter (increment `hop_count`)
|
|
3. Shard responds
|
|
4. bridge posts response
|
|
5. if loop controls trigger (hop/cycle/cooldown), bridge halts relay and posts loop-guard notice
|
|
|
|
Note: Agent-to-agent relay should generally require explicit mention to reduce noisy ping-pong.
|
|
|
|
---
|
|
|
|
## Flow D: Surface switch handoff (Telegram -> chattr)
|
|
|
|
1. Ongoing context exists on Telegram
|
|
2. First message for same logical task arrives on chattr
|
|
3. bridge attaches handoff packet:
|
|
- conversation_id
|
|
- task summary
|
|
- recent context window
|
|
- participants
|
|
- memory refs
|
|
4. adapter injects handoff + message into existing runtime
|
|
5. runtime answers with continuity preserved by handoff context
|
|
|
|
---
|
|
|
|
## Flow E: Dedupe handling
|
|
|
|
1. Duplicate delivery/event replay received by bridge
|
|
2. dedupe_key matches processed entry
|
|
3. bridge drops duplicate
|
|
4. optional debug log entry only; no reroute
|
|
|
|
---
|
|
|
|
## Suggested defaults
|
|
- max_hop_count: 4
|
|
- dedupe_ttl_sec: 600
|
|
- handoff_inactivity_min: 30
|
|
- handoff_max_msgs_without_refresh: 40
|
|
- handoff_max_payload_kb: 16
|
|
- adapter_timeout_sec: 45
|
|
- retry_max_attempts: 8
|
|
- relay_cooldown_sec: 5
|