Files
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

71 lines
2.3 KiB
TypeScript

/**
* The human-in-the-loop approval card. A tool handler calls
* `await thread.awaitChoice(<ConfirmAction .../>)`, which posts this interactive
* Adaptive Card and **blocks until the user clicks Approve or Reject** (even
* minutes later), resolving to the clicked button's `value` (`{confirmed}`).
*
* Each button also carries an `onClick` that updates the card in place to a
* resolved (green) or declined (red) state, so the card reflects the decision the
* moment it's clicked. This is the cross-platform `bot-ui` equivalent of React's
* `useHumanInTheLoop`: the same JSX renders as an Adaptive Card on Teams and a
* Block Kit message on Slack.
*/
import {
Message,
Header,
Section,
Context,
Actions,
Button,
} from "@copilotkit/channels-ui";
import type { InteractionContext } from "@copilotkit/channels-ui";
export interface ConfirmActionProps {
/** Short imperative title of the action, e.g. 'Send announcement'. */
action: string;
/** The specifics being approved: the drafted announcement text, etc. */
detail?: string;
}
export function ConfirmAction({ action, detail }: ConfirmActionProps) {
return (
<Message accent="#E2B340">
<Header>{`📣 ${action}?`}</Header>
{detail ? <Section>{detail}</Section> : null}
<Context>{"🔒 Nothing is sent until you click **Approve**."}</Context>
<Actions>
<Button
value={{ confirmed: true }}
style="primary"
onClick={async ({ thread, message }: InteractionContext) => {
await thread.update(
message.ref,
<Message accent="#27AE60">
<Header>{`✅ ${action}`}</Header>
<Context>{"✔️ Approved. Sending now."}</Context>
</Message>,
);
}}
>
Approve
</Button>
<Button
value={{ confirmed: false }}
style="danger"
onClick={async ({ thread, message }: InteractionContext) => {
await thread.update(
message.ref,
<Message accent="#EB5757">
<Header>{`🚫 ${action}`}</Header>
<Context>{"🛑 Declined. Nothing was sent."}</Context>
</Message>,
);
}}
>
Reject
</Button>
</Actions>
</Message>
);
}