docs(hub): document durable workflow routing (#2943)
* docs(hub): document durable workflow routing * docs(hub): make workflow guide progressive
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Discord triggers
|
||||
description: Discord mentions as Hub triggers, snowflake filters, thread context, and the full paseo.event.discord data reference.
|
||||
description: Configure Discord mentions as Hub triggers and route them into durable workflows.
|
||||
nav: Discord
|
||||
order: 67
|
||||
category: Hub
|
||||
@@ -10,15 +10,13 @@ category: Hub
|
||||
|
||||
## Events
|
||||
|
||||
| `on` | Fires when |
|
||||
| ----------------- | ------------------------------------------------- |
|
||||
| `discord.mention` | The bot is mentioned in a guild channel or thread |
|
||||
|
||||
Mentioning a role the bot holds counts as mentioning the bot.
|
||||
| `on` | Fires when |
|
||||
| ----------------- | ------------------------------------------------------------------------------ |
|
||||
| `discord.mention` | The bot or one of its managed roles is mentioned in a guild channel or thread. |
|
||||
|
||||
## Filters
|
||||
|
||||
Discord filters take snowflake IDs. Turn on **Developer Mode** in Discord's advanced settings, then right-click a channel or user to copy its ID.
|
||||
Discord filters use quoted snowflake IDs:
|
||||
|
||||
```yaml
|
||||
filters:
|
||||
@@ -27,92 +25,28 @@ filters:
|
||||
from_users: ["345678901234567890"]
|
||||
```
|
||||
|
||||
Quote them. Unquoted snowflakes parse as numbers and lose precision.
|
||||
Turn on Developer Mode to copy IDs. `from_users` matches the author's user id, `guild` matches the connected guild, and `channels` matches the channel or thread parent. `pattern` matches the start of the text after the mention. All filters must pass.
|
||||
|
||||
- `from_users` matches the author's user id.
|
||||
- `guild` is resolved to the connection on activation.
|
||||
- `channels` matches the channel the message was posted in; in a thread, the thread's parent channel counts.
|
||||
- `pattern` matches the start of the text after the mention.
|
||||
## Invocation
|
||||
|
||||
## Replying
|
||||
Put leading inputs directly after the mention:
|
||||
|
||||
```text
|
||||
@Paseo repo=project investigate the failed sync
|
||||
```
|
||||
|
||||
Hub consumes only declared consecutive headers and passes `investigate the failed sync` as `${{ paseo.prompt }}`. See [Hub workflows](/docs/hub/workflows) for the provider-neutral input contract.
|
||||
|
||||
## Replies and repository access
|
||||
|
||||
Put the reply capability on a step:
|
||||
|
||||
```yaml
|
||||
allow_outputs:
|
||||
- type: discord.reply
|
||||
max: 5
|
||||
```
|
||||
|
||||
One plain-text reply per execution, in the triggering thread or channel.
|
||||
The reply is posted in the triggering thread or channel. A Discord trigger has no implicit GitHub credential. If a step needs another connection, configure that connection through the supported step environment for your deployment; Hub does not guess between GitHub installations.
|
||||
|
||||
## Repository access
|
||||
|
||||
A Discord trigger has no implicit GitHub credential. Name the connection you want:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
GH_TOKEN: ${{ paseo.connections.acme-github.token }}
|
||||
```
|
||||
|
||||
Hub will not guess between several GitHub installations.
|
||||
|
||||
## Data reference
|
||||
|
||||
The triggering message is `paseo.event.discord.trigger_message`:
|
||||
|
||||
| Path | Value |
|
||||
| -------------------- | ----------------------------------------------------- |
|
||||
| `id` | Message snowflake |
|
||||
| `content` | Raw text, including the mention |
|
||||
| `body` | Text with the mention stripped, usually what you want |
|
||||
| `url` | Canonical message link |
|
||||
| `author` | Author identity, including the user id |
|
||||
| `channel` | Channel identity |
|
||||
| `thread` | Thread identity, or `null` outside a thread |
|
||||
| `created_at` | Message creation time |
|
||||
| `attachments` | Typed list, see below |
|
||||
| `referenced_message` | Identity of a replied-to message, or `null` |
|
||||
|
||||
Each attachment has `id`, `filename`, `url`, `content_type`, and `size`. A `referenced_message` carries `id`, `channel_id`, and `guild_id`, without the message content.
|
||||
|
||||
Also available: `paseo.event.discord.event_type` and `paseo.event.discord.guild.id`.
|
||||
|
||||
### Thread context
|
||||
|
||||
In a thread, `paseo.event.discord.trigger_thread_context.messages` holds the preceding messages, **oldest first**, never including the triggering message. Each entry exposes the same identity, content, author, channel, creation time, attachment, and reference fields as `trigger_message`.
|
||||
|
||||
This is how you give an agent the conversation rather than one line:
|
||||
|
||||
```yaml
|
||||
prompt: |
|
||||
Thread so far:
|
||||
${{ paseo.event.discord.trigger_thread_context.messages }}
|
||||
|
||||
Latest request:
|
||||
${{ paseo.event.discord.trigger_message.body }}
|
||||
```
|
||||
|
||||
Outside a thread the list is empty.
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
triggers:
|
||||
- name: discord-fix
|
||||
on: discord.mention
|
||||
environment: dev
|
||||
filters:
|
||||
guild: "123456789012345678"
|
||||
channels: ["234567890123456789"]
|
||||
from_users: ["345678901234567890"]
|
||||
agent:
|
||||
provider: codex
|
||||
mode: full-access
|
||||
env:
|
||||
GH_TOKEN: ${{ paseo.connections.acme-github.token }}
|
||||
allow_outputs:
|
||||
- type: discord.reply
|
||||
prompt: |
|
||||
${{ paseo.event.discord.trigger_message.body }}
|
||||
|
||||
Context: ${{ paseo.event.discord.trigger_message.url }}
|
||||
Reply in the thread when you're done.
|
||||
```
|
||||
See the [workflow examples](/docs/hub/configuration/examples) for complete step configurations.
|
||||
|
||||
Reference in New Issue
Block a user