Document Hub and let docs pages nest (#2864)
* feat(website): nest docs pages under landable groups The docs sidebar could already render groups from subdirectories in public-docs, but nothing used it because every doc was a flat file, and two things stopped it being usable. A group had no page of its own, so its label was only a toggle and its name came from the directory name via formatLabel. A directory's index.md now supplies the group's label, order, and href, which makes the group landable and lets the label be authored rather than derived. Categories and top-level directories named the same thing, so a categorised doc at hub/index.md produced a group nested inside its own category. Only directories below the top level become groups now. Also fixes two behaviours in the sidebar: - The open/closed effect assigned containsActive on every change, so a group you expanded to browse collapsed the moment you navigated anywhere else. Navigating in now opens a group and navigating away leaves it alone. - The sidebar scrolls independently of the page and never scrolled the active entry into view, so loading or refreshing a page far down the list left the sidebar parked at the top with no visible position. The group row is a single target: it navigates and expands, and collapses when clicked again from the page it points at. A separate chevron button would put two actions a few pixels apart. * docs(hub): document Hub Adds a Hub section covering what it is, how it works, daemons, triggers, configuration, activity, and the two ways to run it. The section separates using Hub from running it. Overview, quickstart, daemons, triggers, and configuration hold regardless of who operates the deployment; the self-hosting branch owns deploying the service and creating the GitHub, Slack, and Discord apps it talks to. That split falls on a real seam, because those apps are exactly what a hosted Hub would own on your behalf. Hosted is a placeholder until it ships. Each provider gets a trigger page carrying its events, filter semantics, and the full paseo.event.* reference for the data a prompt can read. That data is the thing a config author actually needs and the thing they cannot get from anywhere else. Every YAML block was parsed against the Hub config schema rather than eyeballed, which kept several plausible-looking things out of the docs: worktree prNumber takes a literal number and not a merge variable, only daemon environments run today, and github.push has no actor so it can never satisfy the required from_users filter. Troubleshooting moves to order 90 so it stays last. * refactor(website): let the active docs entry scroll itself into view The layout queried the sidebar for the active entry after every navigation, which coupled it to when that entry mounts. A link inside a collapsed group only mounts once the group's own effect opens it, so the query could run against a DOM that does not contain it yet. Moving the scroll to the entry removes the ordering question rather than answering it, and drops the ref and the cross-component query. Reported by Greptile on #2864. The failure it described does not reproduce: navigating from a page outside a collapsed group into one of its children still scrolls correctly, verified with the group confirmed collapsed and the sidebar forced to the top. The coupling was real even though the bug was not. * docs(hub): stop listing BETTER_AUTH_URL as required It falls back to PASEO_CLOUD_PUBLIC_URL, so a deployment that sets the public origin already has a correct auth base URL. Listing it as required made the Fly recipe look incomplete when it was not. Moved to optional with its default, and recorded what actually breaks without BETTER_AUTH_SECRET: the auth routes close and nobody can sign in. Reported by Codex on #2864, which read the same inconsistency the other way round and proposed adding the variable to the Fly example. * docs(hub): attach a database in the Fly recipe The Fly section showed inline config and a secrets command, neither of which supplied DATABASE_URL. It defaults to localhost:5432, which on Fly reaches nothing, so the documented deployment could not start. fly postgres attach sets DATABASE_URL as a secret, so the step is the attach itself rather than another variable to copy. Reported by Codex on #2864. * docs: align Hub self-hosting contract
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
---
|
||||
title: Discord triggers
|
||||
description: Discord mentions as Hub triggers, snowflake filters, thread context, and the full paseo.event.discord data reference.
|
||||
nav: Discord
|
||||
order: 67
|
||||
category: Hub
|
||||
---
|
||||
|
||||
# Discord triggers
|
||||
|
||||
## 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.
|
||||
|
||||
## 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.
|
||||
|
||||
```yaml
|
||||
filters:
|
||||
guild: "123456789012345678"
|
||||
channels: ["234567890123456789"]
|
||||
from_users: ["345678901234567890"]
|
||||
```
|
||||
|
||||
Quote them. Unquoted snowflakes parse as numbers and lose precision.
|
||||
|
||||
- `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.
|
||||
|
||||
## Replying
|
||||
|
||||
```yaml
|
||||
allow_outputs:
|
||||
- type: discord.reply
|
||||
```
|
||||
|
||||
One plain-text reply per execution, in the triggering thread or channel.
|
||||
|
||||
## 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.
|
||||
```
|
||||
@@ -0,0 +1,113 @@
|
||||
---
|
||||
title: GitHub triggers
|
||||
description: GitHub events Hub can trigger on, how filters match them, and the full paseo.event.github data reference.
|
||||
nav: GitHub
|
||||
order: 65
|
||||
category: Hub
|
||||
---
|
||||
|
||||
# GitHub triggers
|
||||
|
||||
## Events
|
||||
|
||||
| `on` | Fires when |
|
||||
| ------------------------------------ | ------------------------------------- |
|
||||
| `github.issue_comment` | A comment on an issue or pull request |
|
||||
| `github.issues` | An issue is opened or edited |
|
||||
| `github.pull_request_review` | A review is submitted |
|
||||
| `github.pull_request_review_comment` | A comment on a diff |
|
||||
|
||||
Which repositories produce events is set on the GitHub connection's installation, not in Paseo.
|
||||
|
||||
## Filters
|
||||
|
||||
```yaml
|
||||
filters:
|
||||
repo: acme/api
|
||||
contains: "@paseo"
|
||||
from_users: [alice, bob]
|
||||
```
|
||||
|
||||
- `from_users` matches the GitHub **login** of the event's sender.
|
||||
- `repo` is `owner/name`, resolved to the repository's immutable id on activation.
|
||||
- `contains` is a substring test; `pattern` must match at the start.
|
||||
|
||||
The text those two search depends on the event:
|
||||
|
||||
| Event | Text searched |
|
||||
| ------------------------------------ | -------------------- |
|
||||
| `github.issue_comment` | The comment body |
|
||||
| `github.issues` | Issue title and body |
|
||||
| `github.pull_request_review` | The review body |
|
||||
| `github.pull_request_review_comment` | The comment body |
|
||||
|
||||
## Tokens
|
||||
|
||||
A GitHub-triggered execution automatically receives a `GH_TOKEN` scoped to the triggering repository, with `contents`, `issues`, and `pull_requests` write access. It is minted per execution and revoked when the execution ends. You do not map it in `env`.
|
||||
|
||||
For a token from a _different_ connection, or from a non-GitHub trigger, name it explicitly:
|
||||
|
||||
```yaml
|
||||
env:
|
||||
GH_TOKEN: ${{ paseo.connections.acme-github.token }}
|
||||
```
|
||||
|
||||
## Data reference
|
||||
|
||||
GitHub's webhook payload is available directly under `paseo.event.github`, unflattened. Anything GitHub sends, you can read:
|
||||
|
||||
```yaml
|
||||
prompt: |
|
||||
${{ paseo.event.github.issue.title }}
|
||||
by ${{ paseo.event.github.sender.login }}
|
||||
on ${{ paseo.event.github.repository.full_name }}
|
||||
```
|
||||
|
||||
Common paths by event:
|
||||
|
||||
| Event | Useful paths |
|
||||
| ------------------------------------ | ------------------------------------------------------------------------------- |
|
||||
| `github.issue_comment` | `comment.body`, `comment.html_url`, `issue.number`, `issue.title`, `issue.body` |
|
||||
| `github.issues` | `issue.number`, `issue.title`, `issue.body`, `action` |
|
||||
| `github.pull_request_review` | `review.body`, `review.state`, `pull_request.number` |
|
||||
| `github.pull_request_review_comment` | `comment.body`, `comment.path`, `comment.diff_hunk`, `pull_request.number` |
|
||||
|
||||
All events also carry `sender.login`, `repository.full_name`, and `repository.default_branch`.
|
||||
|
||||
Hub adds an envelope alongside GitHub's fields:
|
||||
|
||||
| Path | Value |
|
||||
| ---------------------- | ---------------------------------------------- |
|
||||
| `delivery_id` | GitHub's webhook delivery id |
|
||||
| `event_name` | `issue_comment`, `issues`, … |
|
||||
| `repository_full_name` | `owner/name` |
|
||||
| `installation_id` | The installation that delivered the event |
|
||||
| `received_at` | When Hub accepted it |
|
||||
| `trigger_url` | Canonical URL of the comment, issue, or review |
|
||||
|
||||
`trigger_url` is only present when the event has one. It is the field you usually want in a prompt.
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
triggers:
|
||||
- name: review-fix
|
||||
on: github.pull_request_review_comment
|
||||
environment: dev
|
||||
filters:
|
||||
repo: acme/api
|
||||
contains: "@paseo"
|
||||
from_users: [alice]
|
||||
agent:
|
||||
provider: codex
|
||||
mode: full-access
|
||||
prompt: |
|
||||
${{ paseo.event.github.sender.login }} left this on PR
|
||||
#${{ paseo.event.github.pull_request.number }},
|
||||
in ${{ paseo.event.github.comment.path }}:
|
||||
|
||||
${{ paseo.event.github.comment.body }}
|
||||
|
||||
Fix it and push. Reply on the thread with gh when you're done.
|
||||
${{ paseo.event.github.trigger_url }}
|
||||
```
|
||||
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: Hub triggers
|
||||
description: How Hub matches an inbound event to a trigger: events, filters, and the allowlist that gates every execution.
|
||||
nav: Triggers
|
||||
order: 64
|
||||
category: Hub
|
||||
---
|
||||
|
||||
# Triggers
|
||||
|
||||
A trigger says: when this event arrives, from this source, from these people, run this agent with this prompt.
|
||||
|
||||
```yaml
|
||||
triggers:
|
||||
- name: mention
|
||||
on: github.issue_comment
|
||||
environment: dev
|
||||
filters:
|
||||
repo: acme/api
|
||||
contains: "@paseo"
|
||||
from_users: [alice]
|
||||
agent:
|
||||
provider: codex
|
||||
mode: full-access
|
||||
prompt: ${{ paseo.event.github.comment.body }}
|
||||
```
|
||||
|
||||
Field-by-field detail is in the [`hub.yml` reference](/docs/hub/configuration/hub-yml). This page covers matching.
|
||||
|
||||
## Events
|
||||
|
||||
| `on` | Fires when |
|
||||
| ------------------------------------ | ------------------------------------- |
|
||||
| `github.issue_comment` | A comment on an issue or pull request |
|
||||
| `github.issues` | An issue is opened or edited |
|
||||
| `github.pull_request_review` | A review is submitted |
|
||||
| `github.pull_request_review_comment` | A comment on a diff |
|
||||
| `slack.mention` | The bot is mentioned in a channel |
|
||||
| `discord.mention` | The bot is mentioned in a guild |
|
||||
| `manual.run` | A run started from the API |
|
||||
|
||||
Each provider page documents its events and the data they expose:
|
||||
|
||||
- [GitHub triggers](/docs/hub/triggers/github)
|
||||
- [Slack triggers](/docs/hub/triggers/slack)
|
||||
- [Discord triggers](/docs/hub/triggers/discord)
|
||||
|
||||
## Filters
|
||||
|
||||
`filters` is required, and `from_users` must be present and non-empty. A trigger without it is rejected at validation.
|
||||
|
||||
The allowlist is what keeps a stranger's comment on a public issue from starting an agent on your machine. There is no default, because a safe default differs per repository.
|
||||
|
||||
| Filter | Applies to | Matches |
|
||||
| ------------ | -------------- | --------------------------------------------------------------- |
|
||||
| `from_users` | all | GitHub: login. Slack and Discord: **user id**, not display name |
|
||||
| `repo` | GitHub | `owner/name` |
|
||||
| `workspace` | Slack | Team id, `T01234567` |
|
||||
| `guild` | Discord | Guild id |
|
||||
| `channels` | Slack, Discord | Channel ids |
|
||||
| `contains` | all | Substring of the message text |
|
||||
| `pattern` | all | Prefix of the message text |
|
||||
| `connection` | all | A connection slug, when the organization has several |
|
||||
|
||||
All conditions must pass. There is no `any` mode.
|
||||
|
||||
## Which connection an event comes from
|
||||
|
||||
`repo`, `workspace`, and `guild` are resolved to immutable ids when the configuration activates, along with the connection that owns them. Naming a resource the organization has no connection for fails activation, so you find out on push rather than when someone comments.
|
||||
|
||||
Omit the resource filter and the trigger listens to every connection of that provider in the organization. To pin it to one:
|
||||
|
||||
```yaml
|
||||
filters:
|
||||
connection: acme-github
|
||||
from_users: [alice]
|
||||
```
|
||||
|
||||
See [How Hub works](/docs/hub/concepts) for what activation compiles.
|
||||
|
||||
## When two triggers match
|
||||
|
||||
Both run. Triggers are not ordered and do not shadow each other, in one configuration or across projects.
|
||||
|
||||
## Replying
|
||||
|
||||
`allow_outputs` gives the agent a single-use `reply` tool for the conversation that triggered it:
|
||||
|
||||
```yaml
|
||||
allow_outputs:
|
||||
- type: slack.reply
|
||||
```
|
||||
|
||||
Only `slack.reply` and `discord.reply` exist. GitHub-triggered agents reply with the scoped `GH_TOKEN` they already have, so `gh issue comment` works.
|
||||
@@ -0,0 +1,98 @@
|
||||
---
|
||||
title: Slack triggers
|
||||
description: Slack mentions as Hub triggers, ID-based filters, replies, and the full paseo.event.slack data reference.
|
||||
nav: Slack
|
||||
order: 66
|
||||
category: Hub
|
||||
---
|
||||
|
||||
# Slack triggers
|
||||
|
||||
## Events
|
||||
|
||||
| `on` | Fires when |
|
||||
| --------------- | -------------------------------------------------------- |
|
||||
| `slack.mention` | The bot is mentioned in a channel it has been invited to |
|
||||
|
||||
The bot must be in the channel. `/invite @Paseo` first, or nothing arrives.
|
||||
|
||||
## Filters
|
||||
|
||||
Slack filters take IDs, never display names. Copy a channel ID from the channel's details; copy a user ID from a member's profile menu.
|
||||
|
||||
```yaml
|
||||
filters:
|
||||
workspace: T01234567
|
||||
channels: [C01234567]
|
||||
from_users: [U01234567]
|
||||
```
|
||||
|
||||
- `from_users` matches the Slack user id of the author.
|
||||
- `workspace` is the team id, resolved to the connection on activation.
|
||||
- `channels` matches the channel id the message was posted in.
|
||||
- `pattern` matches the start of the text **after** the mention, and must end on a word boundary. `contains` is treated the same as `pattern` here.
|
||||
|
||||
The mention itself is always required. A message that does not mention the bot never produces an event.
|
||||
|
||||
## Replying
|
||||
|
||||
```yaml
|
||||
allow_outputs:
|
||||
- type: slack.reply
|
||||
```
|
||||
|
||||
That gives the agent one plain-text reply, posted in the thread. A root message gets a new thread; a threaded message gets a reply in the same thread.
|
||||
|
||||
## Data reference
|
||||
|
||||
Everything lives under `paseo.event.slack`.
|
||||
|
||||
| Path | Value |
|
||||
| ------------ | --------------------------------- |
|
||||
| `event_type` | `mention` |
|
||||
| `event_id` | Slack's Events API event id |
|
||||
| `event_ts` | Event timestamp from the envelope |
|
||||
| `event_time` | Envelope delivery time |
|
||||
| `team` | Workspace identity |
|
||||
| `app` | The installed app identity |
|
||||
|
||||
The message itself is `paseo.event.slack.trigger_message`:
|
||||
|
||||
| Path | Value |
|
||||
| ------------ | ----------------------------------------------------- |
|
||||
| `ts` | Native message timestamp, Slack's message id |
|
||||
| `content` | Raw text, including the `<@BOT>` mention |
|
||||
| `body` | Text with the mention stripped, usually what you want |
|
||||
| `author` | Author identity, including the user id |
|
||||
| `channel` | Channel identity |
|
||||
| `thread` | Thread identity, or `null` for a root message |
|
||||
| `created_at` | Derived from the message `ts` |
|
||||
|
||||
Use `body`, not `content`, unless you specifically need the mention text.
|
||||
|
||||
## Example
|
||||
|
||||
```yaml
|
||||
triggers:
|
||||
- name: slack-mention
|
||||
on: slack.mention
|
||||
environment: dev
|
||||
filters:
|
||||
workspace: T01234567
|
||||
channels: [C01234567]
|
||||
from_users: [U01234567]
|
||||
agent:
|
||||
provider: codex
|
||||
mode: full-access
|
||||
idle_timeout: 10m
|
||||
allow_outputs:
|
||||
- type: slack.reply
|
||||
prompt: |
|
||||
${{ paseo.event.slack.trigger_message.body }}
|
||||
|
||||
Reply in the thread when you're done.
|
||||
```
|
||||
|
||||
## Limits
|
||||
|
||||
Direct messages, slash commands, and interactive components do not produce triggers. Enterprise Grid org-wide installs are not supported.
|
||||
Reference in New Issue
Block a user