Skip to content

feat(chat-sdk-bridge): add channelType override + webhook routingPath#2617

Open
mmahmed wants to merge 1 commit into
nanocoai:mainfrom
mmahmed:feat/chat-sdk-bridge-channel-type-override
Open

feat(chat-sdk-bridge): add channelType override + webhook routingPath#2617
mmahmed wants to merge 1 commit into
nanocoai:mainfrom
mmahmed:feat/chat-sdk-bridge-channel-type-override

Conversation

@mmahmed
Copy link
Copy Markdown
Contributor

@mmahmed mmahmed commented May 25, 2026

Type of Change

  • Feature skill - adds a channel or integration (source code changes + SKILL.md)
  • Utility skill - adds a standalone tool (code files in .claude/skills/<name>/, no source changes)
  • Operational/container skill - adds a workflow or agent skill (SKILL.md only, no source changes)
  • Fix - bug fix or security fix to source code
  • Simplification - reduces or simplifies source code
  • Documentation - docs, README, or CONTRIBUTING changes only

Description

What

Two additive optional config knobs that remove the implicit coupling between webhook route, Chat SDK adapter name, and registry channelType:

  • ChatSdkBridgeConfig.channelType?: string — when set, overrides the bridge's effective .name, .channelType, and webhook route. Defaults to adapter.name (current behavior).
  • registerWebhookAdapter(chat, adapterName, routingPath?) — optional 3rd parameter. When set, the route URL becomes /webhook/<routingPath>; chat.webhooks[adapterName] lookup is unchanged.

Why

channel-registry.ts keys live adapters by adapter.channelType; chat-sdk-bridge.ts hardcodes the webhook route to adapter.name. Two bridges sharing the same Chat SDK adapter type silently collide on both — the second registration overwrites the first in the registry, and both registrations target the same /webhook/<adapter.name> URL.

Removing the coupling unblocks any channel module that needs N bridges of the same Chat SDK adapter type on one host. #1804 documents the gap for multi-workspace Slack; the same primitive applies to multi-bot Teams and any future channel with the same shape.

How

Both fields default to current behavior. The only call site of registerWebhookAdapter is inside chat-sdk-bridge.ts; all existing channel consumers of createChatSdkBridge continue to work identically. No semantic changes for single-instance channels.

Shape matches the prototype proposed on #1804 at davekim917@33274a9 — adopting it verbatim so a single primitive landing unblocks Slack, Teams, and any other channel adopting the same pattern.

How it was tested

  • pnpm test — 339/339 pass, including 7 new tests:
    • src/channels/chat-sdk-bridge.test.ts — default behavior, override behavior, two bridges with distinct overrides.
    • src/webhook-server.test.ts — default routing, override routing with handler-lookup invariant, collision avoidance between bridges sharing an adapterName under distinct routingPaths, 404 for unregistered routes.
  • pnpm run typecheck — clean.
  • pnpm run lint — no new errors or warnings introduced (the pre-existing errors/warnings on main are unchanged).

For Skills

  • SKILL.md contains instructions, not inline code (code goes in separate files)
  • SKILL.md is under 500 lines
  • I tested this skill on a fresh clone

Refs #1804.

- Chat SDK-bridge channels can't run two bridges of the same adapter type today: registry key and webhook route both derive from adapter.name
- Optional channelType on the bridge and routingPath on registerWebhookAdapter remove the coupling so channel modules can register N instances; defaults preserve existing behavior

Refs nanocoai#1804.
@github-actions github-actions Bot added follows-guidelines PR was created using the current contributing template PR: Refactor Code restructuring without behavior change labels May 25, 2026
mmahmed added a commit to mmahmed/nanoclaw that referenced this pull request May 25, 2026
- Records what's stacked on top of origin/main (PRs nanocoai#2591, nanocoai#2617, multi-bot Teams, bootstrap)
- Documents how to refresh when upstream consumes a PR, how to add a new carry, how to bump deps
- Captures the non-standard remote convention (origin = upstream, fork = our fork)
mmahmed added a commit to mmahmed/nanoclaw that referenced this pull request May 25, 2026
- Records what's stacked on top of origin/main (PRs nanocoai#2591, nanocoai#2617, multi-bot Teams, bootstrap)
- Documents how to refresh when upstream consumes a PR, how to add a new carry, how to bump deps
- Captures the non-standard remote convention (origin = upstream, fork = our fork)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follows-guidelines PR was created using the current contributing template PR: Refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant