Agents: add account-scoped bind and routing commands#27195
Conversation
Greptile SummaryThis PR adds account-scoped channel bindings and routing commands to support multi-agent configurations with account-level isolation. Key additions:
Implementation highlights:
Testing:
Confidence Score: 5/5
Last reviewed commit: afd13a2 |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive agent binding and routing management commands to the CLI, enabling users to configure how channels and accounts are routed to different agents. The implementation includes account-scoped bindings with automatic resolution via plugin hooks, support for binding upgrades without duplicates, and integration with the existing channels setup wizard.
Changes:
- Added
openclaw agents bindings,bind, andunbindcommands for managing routing bindings - Implemented account-scoped binding upgrades that preserve existing bindings while refining their scope
- Integrated optional interactive binding step into
channels addwizard when accountIds are configured
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/commands/agents.bindings.ts | Enhanced binding identity key to include roles; added canUpgradeBindingAccountScope for progressive refinement; implemented removeAgentBindings and resolveBindingAccountId with plugin hook support |
| src/commands/agents.commands.bind.ts | New file implementing three commands: bindings (list), bind (add), and unbind (remove) with JSON output support and conflict detection |
| src/commands/agents.commands.add.ts | Updated to include updated field in binding results payload |
| src/commands/agents.test.ts | Added comprehensive tests for binding upgrades, role-based bindings, and removal behavior |
| src/commands/agents.bind.commands.test.ts | New test file with mock matrix-js plugin demonstrating resolveBindingAccountId hook usage |
| src/commands/channels/add.ts | Moved accountId resolution after input construction to support new input parameter; added interactive binding prompt for channels with accountIds |
| src/cli/program/register.agent.ts | Registered three new commands with proper option parsing and help text |
| src/cli/program/register.agent.test.ts | Added tests verifying command registration and option forwarding |
| src/cli/program/preaction.ts | Added agents to PLUGIN_REQUIRED_COMMANDS set |
| src/cli/program/preaction.test.ts | Added test ensuring plugin registry loads for agents command |
| src/channels/plugins/types.adapters.ts | Added resolveBindingAccountId hook and input parameter to resolveAccountId |
| src/commands/agents.ts | Exported new agents.commands.bind.js module |
Comments suppressed due to low confidence (1)
src/commands/agents.bindings.ts:72
- The describeBinding function doesn't include roles in the description output, but roles are part of the binding identity key and affect routing. When users list or view bindings with roles, the roles won't be shown in the description, making it unclear how the binding differs from one without roles. Consider adding roles to the description output similar to how guildId and teamId are included.
export function describeBinding(binding: AgentBinding) {
const match = binding.match;
const parts = [match.channel];
if (match.accountId) {
parts.push(`accountId=${match.accountId}`);
}
if (match.peer) {
parts.push(`peer=${match.peer.kind}:${match.peer.id}`);
}
if (match.guildId) {
parts.push(`guild=${match.guildId}`);
}
if (match.teamId) {
parts.push(`team=${match.teamId}`);
}
return parts.join(" ");
}
afd13a2 to
a975d31
Compare
|
Merged via squash. Thanks @gumadeiras! |
Syncs 29 upstream commits including: - Account-scoped bind and routing commands (openclaw#27195) - Single-account config migration to accounts.default (openclaw#27334) - Preserve agent-level apiKey/baseUrl during models.json merge (openclaw#27293) - Plugin-owned interactive channel onboarding flows (openclaw#27191) - Android notifications.list, invoke refactoring - Daemon launchd restart hardening - SSRF dispatcher fix, doctor improvements Conflict resolution: 4 import-order conflicts in onboarding/channel commands resolved by taking upstream (no custom code in those files).
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: ad35a45 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Summary
openclaw agents bindings,openclaw agents bind, andopenclaw agents unbindchannels addwhen account IDs are configuredValidation
Notes
extensions/matrix-jsis not inmainyet.