Files
copilotkit__copilotkit/examples/slack/app/sender-context.ts
Benjamin Taylor b394f06fdc refactor(channels): rename @copilotkit/bot* packages to @copilotkit/channels* (OSS-438)
Renames the Bots SDK to the Channels SDK. Names only — no behavior change.

- 8 packages @copilotkit/bot* -> @copilotkit/channels* (git mv dirs, names,
  workspace: cross-deps). Now includes @copilotkit/bot-intelligence ->
  @copilotkit/channels-intelligence (landed on main via #5761; unpublished, so
  renamed fresh with the family).
- release.config.json scope keys + versionSource; ReleaseScope union;
  canary/stable-release/publish-release scope dropdowns; verify script
- examples/slack (Kite) + examples/teams: deps, jsxImportSource, imports
- showcase/shell-docs: content dirs docs/bots->docs/channels and
  reference/bot->reference/channels, nav registry, redirects

createBot and other API names unchanged. Old @copilotkit/bot* to be deprecated
after the new packages publish (bot-intelligence was never published).

Re-derived onto latest main (was conflicting after #5761 landed).

Refs OSS-438
2026-07-08 13:27:35 -05:00

23 lines
1.1 KiB
TypeScript

import type { ContextEntry } from "@copilotkit/channels";
import type { PlatformUser } from "@copilotkit/channels-ui";
/**
* Build the per-turn context naming the requesting user, so the agent can act
* "as" them (filter Linear by their email, @-mention/tag them). The platform
* adapter resolves `{ id, name?, email? }` per turn; if it's absent there's
* nothing to attribute, so we add no entry. `platform` is the surface the turn
* came from (`thread.platform`), so the label is correct across Slack, Discord,
* Telegram, and WhatsApp alike.
*/
export function senderContext(
user: PlatformUser | undefined,
platform: string,
): ContextEntry[] {
// `createBot` substitutes `{ id: "" }` for an unresolved sender (a truthy
// object), so guard on a usable id — not mere object presence — otherwise we
// emit a "Requesting <platform> user (... id )" entry with nothing to attribute.
if (!user?.id) return [];
const label = `${user.name ?? user.id}${user.email ? ` <${user.email}>` : ""} (${platform} id ${user.id})`;
return [{ description: `Requesting ${platform} user`, value: label }];
}