openclaw/src/routing
OfflynAI b554516f21
routing: support wildcard peer bindings (peer.id="*") for multi-agent routing (#58609)
* routing: support wildcard peer bindings (peer.id="*") for multi-agent routing

Bindings with `peer: { kind: "direct", id: "*" }` were treated as a literal
peer ID "*" instead of a wildcard. This caused the binding to be indexed
exclusively in the byPeer map under key "direct:*", which never matches
actual incoming peer IDs like "direct:12345678". The binding silently fell
through to the default agent ("main"), breaking multi-agent setups that use
wildcard peer constraints to route all DMs on a named account to a specific
agent.

Add a "wildcard-kind" peer constraint state that restricts on chat type
(direct/group/channel) without requiring an exact peer ID match. Wildcard
peer bindings now fall through to the byAccount/byChannel index tiers and
correctly match via matchesBindingScope with kind-only filtering.

Resolves #58546

Made-with: Cursor

* routing: add dedicated binding.peer.wildcard tier for clarity

Address Greptile feedback: wildcard-peer bindings now report
matchedBy: "binding.peer.wildcard" instead of "binding.account",
making logs/debugging clearer for operators.

- Add byPeerWildcard index bucket
- Add binding.peer.wildcard tier between peer.parent and guild+roles
- Update tests to expect the new matchedBy value

Made-with: Cursor
2026-03-31 21:10:18 -04:00
..
account-id.test.ts test: dedupe routing and text suites 2026-03-28 07:31:40 +00:00
account-id.ts
account-lookup.test.ts test: dedupe routing and text suites 2026-03-28 07:31:40 +00:00
account-lookup.ts
bindings.ts
default-account-warnings.ts
resolve-route.test.ts routing: support wildcard peer bindings (peer.id="*") for multi-agent routing (#58609) 2026-03-31 21:10:18 -04:00
resolve-route.ts routing: support wildcard peer bindings (peer.id="*") for multi-agent routing (#58609) 2026-03-31 21:10:18 -04:00
session-key.continuity.test.ts test: dedupe routing and text suites 2026-03-28 07:31:40 +00:00
session-key.test.ts Fix: move bootstrap session grammar into plugin-owned session-key surfaces (#58400) 2026-03-31 19:41:01 -04:00
session-key.ts