|
| 1 | +import type { Block, KnownBlock } from '@slack/types'; |
| 2 | + |
1 | 3 | import type { TokenOverridable } from './common'; |
2 | 4 |
|
| 5 | +// https://docs.slack.dev/reference/methods/agents.conversations.archive |
| 6 | +export interface AgentsConversationsArchiveArguments extends TokenOverridable { |
| 7 | + /** @description ID of the code channel to archive. */ |
| 8 | + channel_id: string; |
| 9 | + /** |
| 10 | + * @description Timestamp of a message in the code channel to share back as a thread reply on the origin message. |
| 11 | + * Requires the channel to have an `origin_link` set. |
| 12 | + */ |
| 13 | + summary_message_ts?: string; |
| 14 | +} |
| 15 | + |
| 16 | +// https://docs.slack.dev/reference/methods/agents.conversations.create |
| 17 | +export interface AgentsConversationsCreateArguments extends TokenOverridable { |
| 18 | + /** |
| 19 | + * @description Encoded team ID to create the channel in. Required for org tokens when `origin_channel_id` is not |
| 20 | + * provided. When omitted, the workspace is derived from the origin channel. |
| 21 | + */ |
| 22 | + team_id?: string; |
| 23 | + /** |
| 24 | + * @description An opaque identifier for the agent session. When provided, the call is idempotent: if a channel already |
| 25 | + * exists for this `session_id`, it is returned instead of creating a new one. |
| 26 | + */ |
| 27 | + session_id?: string; |
| 28 | + /** |
| 29 | + * @description A friendly display name for the code channel. Optional when `origin_channel_id` and `origin_message_ts` |
| 30 | + * are provided — in that case the channel is named from the origin message and re-titled automatically. Required when no origin link is given. |
| 31 | + */ |
| 32 | + name: string; |
| 33 | + /** @description Create a private channel instead of a public one. */ |
| 34 | + is_private?: boolean; |
| 35 | + /** |
| 36 | + * @description The channel ID where the agent session was initiated from. Must be provided together with |
| 37 | + * `origin_message_ts`. The channel must be accessible to the calling user and must not be externally shared (Slack Connect). When `team_id` is omitted with an org token, the channel is created in the same workspace as this origin channel. |
| 38 | + */ |
| 39 | + origin_channel_id?: string; |
| 40 | + /** |
| 41 | + * @description The message timestamp in the origin channel that started the agent session. Must be provided together |
| 42 | + * with `origin_channel_id`. The author of this message is automatically invited to the newly created code channel. |
| 43 | + */ |
| 44 | + origin_message_ts?: string; |
| 45 | +} |
| 46 | + |
| 47 | +// https://docs.slack.dev/reference/methods/agents.conversations.getCanvas |
| 48 | +export interface AgentsConversationsGetCanvasArguments extends TokenOverridable { |
| 49 | + /** @description ID of the agent session channel the canvas belongs to. */ |
| 50 | + channel: string; |
| 51 | + /** @description Encoded ID of the canvas to fetch. */ |
| 52 | + canvas_id: string; |
| 53 | + /** @description Format to render the canvas content in. Defaults to `markdown`. */ |
| 54 | + content_format?: string; |
| 55 | + /** @description Whether to include resolved comment threads in the response. Defaults to `false`. */ |
| 56 | + include_resolved?: boolean; |
| 57 | +} |
| 58 | + |
| 59 | +// https://docs.slack.dev/reference/methods/agents.conversations.listViews |
| 60 | +export interface AgentsConversationsListViewsArguments extends TokenOverridable { |
| 61 | + /** @description ID of the code channel to list views for. */ |
| 62 | + channel_id: string; |
| 63 | +} |
| 64 | + |
| 65 | +// https://docs.slack.dev/reference/methods/agents.conversations.removeView |
| 66 | +export interface AgentsConversationsRemoveViewArguments extends TokenOverridable { |
| 67 | + /** @description ID of the code channel to remove the view from. */ |
| 68 | + channel_id: string; |
| 69 | + /** @description Agent-assigned key of the view to remove. Provide exactly one of `view_key` or `view_id`. */ |
| 70 | + view_key?: string; |
| 71 | + /** @description Encoded channel tab ID of the view to remove. Provide exactly one of `view_key` or `view_id`. */ |
| 72 | + view_id?: string; |
| 73 | +} |
| 74 | + |
| 75 | +// https://docs.slack.dev/reference/methods/agents.conversations.setCanvasContent |
| 76 | +export interface AgentsConversationsSetCanvasContentArguments extends TokenOverridable { |
| 77 | + /** @description ID of the agent session channel the canvas is attached to. */ |
| 78 | + channel: string; |
| 79 | + /** @description Encoded ID of the canvas whose content to replace. */ |
| 80 | + canvas_id: string; |
| 81 | + /** |
| 82 | + * @description The full new canvas content as markdown. The server diffs this against the current content and applies |
| 83 | + * only the changed sections. |
| 84 | + */ |
| 85 | + content: string; |
| 86 | +} |
| 87 | + |
| 88 | +// https://docs.slack.dev/reference/methods/agents.conversations.setCommands |
| 89 | +export interface AgentsConversationsSetCommandsArguments extends TokenOverridable { |
| 90 | + /** @description ID of the code channel to register commands for. */ |
| 91 | + channel_id: string; |
| 92 | + /** |
| 93 | + * @description Full set of commands to register for the calling agent in this channel, replacing that agent's |
| 94 | + * previously registered set. Pass an empty array to clear the agent's commands. At most 10 commands may exist across all agents in the channel; names must be unique within the set and must not collide with builtin Slack commands. |
| 95 | + */ |
| 96 | + commands: { |
| 97 | + /** @description Command name, without a leading slash. 1-31 characters, unique within the set. */ |
| 98 | + name: string; |
| 99 | + /** @description Short description of what the command does. */ |
| 100 | + description?: string; |
| 101 | + /** @description Hint describing the command's arguments, shown in the typeahead. */ |
| 102 | + argument_hint?: string; |
| 103 | + /** |
| 104 | + * @description When true, channel, user, and link references in the command's text are escaped/parsed before |
| 105 | + * being sent to the agent app, matching the slash-command `should_escape` behavior. Absent is treated as false. |
| 106 | + */ |
| 107 | + should_escape?: boolean; |
| 108 | + }[]; |
| 109 | +} |
| 110 | + |
| 111 | +// https://docs.slack.dev/reference/methods/agents.conversations.setProperties |
| 112 | +export interface AgentsConversationsSetPropertiesArguments extends TokenOverridable { |
| 113 | + /** @description ID of the code channel to update. */ |
| 114 | + channel_id: string; |
| 115 | + /** @description Code channel properties to set. Only provided fields are updated. */ |
| 116 | + code_channel?: { |
| 117 | + /** @description Items displayed in the channel context bar. Maximum 5 items. The array replaces the current set. */ |
| 118 | + context_bar_items?: { |
| 119 | + /** @description Unique identifier for the item within the channel. Maximum 64 characters. */ |
| 120 | + key: string; |
| 121 | + /** @description Display text. Maximum 128 characters. */ |
| 122 | + label: string; |
| 123 | + /** @description Icon shown beside the label: `branch`, `folder`, `hierarchy`, `life-ring`, `link`, `globe`, `terminal`, `code`, `search`, or `lock`. */ |
| 124 | + icon?: string; |
| 125 | + /** @description Makes the item a link to this URL. Maximum 2048 characters. */ |
| 126 | + url?: string; |
| 127 | + /** @description `info` (default, informational) or `action` (interactive; clicking delivers a `code_channel_action` event). */ |
| 128 | + item_type?: string; |
| 129 | + }[]; |
| 130 | + /** @description Records which message in the channel represents the current session summary. */ |
| 131 | + summary_message?: { |
| 132 | + /** @description Timestamp of the summary message in the code channel. */ |
| 133 | + message_ts: string; |
| 134 | + /** @description Thread timestamp if the summary message is a thread reply. Clients need this to fetch the message via conversations.replies. */ |
| 135 | + thread_ts?: string; |
| 136 | + }; |
| 137 | + }; |
| 138 | + /** @description Agent resource properties to set. Only provided fields are updated. */ |
| 139 | + agent_resource?: { |
| 140 | + /** @description URL of the external resource. Maximum 2048 characters. */ |
| 141 | + url?: string; |
| 142 | + /** @description Type of the external resource. Maximum 64 characters. */ |
| 143 | + resource_type?: string; |
| 144 | + /** @description Display title of the external resource. Maximum 255 characters. */ |
| 145 | + title?: string; |
| 146 | + /** @description Provider of the external resource. Maximum 64 characters. */ |
| 147 | + provider?: string; |
| 148 | + }; |
| 149 | +} |
| 150 | + |
| 151 | +// https://docs.slack.dev/reference/methods/agents.conversations.setView |
| 152 | +export interface AgentsConversationsSetViewArguments extends TokenOverridable { |
| 153 | + /** @description ID of the code channel to render the view in. */ |
| 154 | + channel_id: string; |
| 155 | + /** |
| 156 | + * @description The kind of view to create or update. Defaults to `html`. Determines which other arguments are |
| 157 | + * required: `html` and `diff` require `content`, `block_kit` requires `blocks`, `canvas` requires `canvas_id`, |
| 158 | + * `pull_request` requires `pr_url`. |
| 159 | + */ |
| 160 | + type?: string; |
| 161 | + /** |
| 162 | + * @description Agent-assigned stable identity for the view (e.g. the source file path on the agent's machine). Used as |
| 163 | + * the upsert key: calls with the same `view_key` update the same view. Required for html, block_kit, and canvas views; ignored for diff (a diff view is a per-channel singleton). |
| 164 | + */ |
| 165 | + view_key?: string; |
| 166 | + /** |
| 167 | + * @description View content. For `html`, a full self-contained HTML document; for `diff`, raw unified diff text. |
| 168 | + * Capped at 1,000,000 bytes — larger content returns content_too_large. The cap is enforced by the handler (not schema maxLength) so the documented error code actually surfaces instead of a generic argument-validation failure. Required when type is html or diff. |
| 169 | + */ |
| 170 | + content?: string; |
| 171 | + /** @description Block Kit blocks to render in the view tab. Required when `type` is `block_kit`; ignored otherwise. */ |
| 172 | + blocks?: (KnownBlock | Block)[]; |
| 173 | + /** @description Encoded ID of the canvas to attach as the view. Required when `type` is `canvas`; ignored otherwise. */ |
| 174 | + canvas_id?: string; |
| 175 | + /** |
| 176 | + * @description For canvas views: access level granted to the channel for the canvas tab. Defaults to `write`. Use |
| 177 | + * `comment` to grant channel members comment access (read and comment, no editing) so the agent remains the sole author of the canvas text. |
| 178 | + */ |
| 179 | + access_level?: string; |
| 180 | + /** |
| 181 | + * @description For canvas views: hash of the canvas-derived markdown the agent last wrote, recorded so the agent can |
| 182 | + * later detect human edits to the canvas. Opaque to the server. |
| 183 | + */ |
| 184 | + agent_content_hash?: string; |
| 185 | + /** @description For pull_request views: the pull request's URL. Required when `type` is `pull_request`; ignored otherwise. */ |
| 186 | + pr_url?: string; |
| 187 | + /** @description For diff views: base branch name for display purposes. */ |
| 188 | + base_branch?: string; |
| 189 | + /** @description For diff views: head branch name for display purposes. */ |
| 190 | + head_branch?: string; |
| 191 | + /** |
| 192 | + * @description Display label for the view tab (`name` wins if both are |
| 193 | + * supplied). Defaults to the last path segment of `view_key`, stripped of any .html/.htm extension. |
| 194 | + */ |
| 195 | + name?: string; |
| 196 | + /** |
| 197 | + * @description Content-Security-Policy domain declarations for the view. Domains are validated server-side |
| 198 | + * (https-only, no private/internal hosts) and persisted. Only resource_domains is honored at render time today; connect_domains is accepted and stored for forward-compatibility but NOT honored yet. |
| 199 | + */ |
| 200 | + csp?: { |
| 201 | + /** @description Origins the view may fetch()/XHR/WebSocket to. Accepted and stored, but not honored at render time yet. */ |
| 202 | + connect_domains?: string[]; |
| 203 | + /** @description Origins the view may load scripts/styles/fonts/images/media from, merged into the curated CDN allowlist at render time. */ |
| 204 | + resource_domains?: string[]; |
| 205 | + }; |
| 206 | +} |
| 207 | + |
3 | 208 | // https://docs.slack.dev/reference/methods/agents.sessions.rename |
4 | 209 | export interface AgentsSessionsRenameArguments extends TokenOverridable { |
5 | 210 | /** @description ID of the channel containing the agent session. */ |
|
0 commit comments