agents
Version:
A home for your AI agents
151 lines (149 loc) • 4.45 kB
TypeScript
import {
D as ChannelIngress,
c as ChannelRoute,
n as Channel,
o as ChannelMessage,
s as ChannelParticipant
} from "../../../channel-Bak_6zDP.js";
import { b as ChannelMessageSurface } from "../../../protocol-CukuI73M.js";
//#region src/experimental/channels/slack/index.d.ts
/** The subset of a Slack event used by the adapter, with unknown fields retained. */
type SlackEvent = {
type?: string;
user?: string;
text?: string;
ts?: string;
thread_ts?: string;
channel?: string;
channel_type?: string;
subtype?: string;
bot_id?: string;
app_id?: string;
[]: unknown;
};
type SlackAuthorization = {
team_id?: string;
user_id?: string;
is_bot?: boolean;
[]: unknown;
};
/** A typed Slack Events API callback retained in an ingress envelope. */
type SlackEventCallback = {
type: "event_callback";
event_id: string;
team_id: string;
event: SlackEvent;
authorizations?: readonly SlackAuthorization[];
[]: unknown;
};
/** A typed Slack URL verification request. */
type SlackUrlVerification = {
type: "url_verification";
challenge: string;
[]: unknown;
};
type SlackBlockAction = {
action_id?: string;
action_ts?: string;
value?: string;
[]: unknown;
};
/** A typed Slack Block Kit interaction retained in an ingress envelope. */
type SlackBlockActions = {
type: "block_actions";
team?: {
id?: string;
[]: unknown;
};
user?: {
id?: string;
username?: string;
name?: string;
[]: unknown;
};
channel?: {
id?: string;
[]: unknown;
};
message?: {
ts?: string;
thread_ts?: string;
[]: unknown;
};
container?: {
channel_id?: string;
message_ts?: string;
thread_ts?: string;
[]: unknown;
};
actions?: readonly SlackBlockAction[];
[]: unknown;
};
/** Authenticated Slack payloads which may be passed to a Channel route. */
type SlackIngressPayload = SlackEventCallback | SlackBlockActions;
type SlackWebhookOptions = {
/** Slack app signing secret. */ signingSecret: string /** Exact webhook pathname accepted by this ingress. @default "/webhooks/slack" */;
path?: string /** Maximum accepted request timestamp skew in seconds. @default 300 */;
maxSkewSeconds?: number /** Bot user id used to discard events sent by this app. */;
botUserId?: string;
};
type SlackMessageSurface = ChannelMessageSurface<
string,
| {
channelId: string;
threadTs?: string /** The reader a channel stream is rendered for. Slack requires it. */;
recipientUserId?: string;
recipientTeamId?: string;
}
| {
teamId: string;
userId: string;
}
>;
/** Configuration for a Slack Channel. */
type SlackChannelOptions = {
/** Bot token used with chat.postMessage. */ botToken: string /** Slack Web API origin. @default "https://slack.com/api" */;
apiBaseUrl?: string /** Project canonical Channel Markdown into Slack mrkdwn text. */;
toText?: (message: ChannelMessage) => string;
/**
* Smallest gap between `chat.appendStream` calls. Chunks produced inside
* one interval are appended together. @default 500
*/
streamIntervalMs?: number /** Add signed Slack HTTP ingress to the returned Channel. */;
webhook?: SlackWebhookOptions;
/**
* Who sent a verified Slack event, such as your user linked to
* `event.actor`. Return null to drop the event. Required with `webhook`.
*/
participant?: ChannelParticipant<SlackIngressPayload>;
/**
* Pick the agent object an event reaches. Default: a room of the
* participant's own, so a shared thread is not shared by accident.
*/
route?: ChannelRoute<SlackIngressPayload> /** Override fetch for testing or custom network routing. */;
fetch?: typeof globalThis.fetch;
};
/** Create dependency-free, request-signed Slack HTTP ingress. */
declare function slackWebhook(
options: SlackWebhookOptions
): ChannelIngress<SlackIngressPayload>;
/** Create a configured Slack ingress Channel. */
declare function slack(
options: SlackChannelOptions
): Channel<SlackIngressPayload>;
//#endregion
export {
SlackAuthorization,
SlackBlockAction,
SlackBlockActions,
SlackChannelOptions,
SlackEvent,
SlackEventCallback,
SlackIngressPayload,
SlackMessageSurface,
SlackUrlVerification,
SlackWebhookOptions,
slack,
slackWebhook
};
//# sourceMappingURL=index.d.ts.map