@relayflows/slack-primitive 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/post-message.d.ts +9 -0
- package/dist/actions/post-message.d.ts.map +1 -0
- package/dist/actions/post-message.js +48 -0
- package/dist/actions/post-message.js.map +1 -0
- package/dist/actions/resolve-channel.d.ts +9 -0
- package/dist/actions/resolve-channel.d.ts.map +1 -0
- package/dist/actions/resolve-channel.js +29 -0
- package/dist/actions/resolve-channel.js.map +1 -0
- package/dist/actions/resolve-user.d.ts +13 -0
- package/dist/actions/resolve-user.d.ts.map +1 -0
- package/dist/actions/resolve-user.js +93 -0
- package/dist/actions/resolve-user.js.map +1 -0
- package/dist/adapter.d.ts +23 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +194 -0
- package/dist/adapter.js.map +1 -0
- package/dist/client.d.ts +62 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +91 -0
- package/dist/client.js.map +1 -0
- package/dist/cloud-relay-runtime.d.ts +32 -0
- package/dist/cloud-relay-runtime.d.ts.map +1 -0
- package/dist/cloud-relay-runtime.js +156 -0
- package/dist/cloud-relay-runtime.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/local-runtime.d.ts +17 -0
- package/dist/local-runtime.d.ts.map +1 -0
- package/dist/local-runtime.js +28 -0
- package/dist/local-runtime.js.map +1 -0
- package/dist/noop-runtime.d.ts +22 -0
- package/dist/noop-runtime.d.ts.map +1 -0
- package/dist/noop-runtime.js +70 -0
- package/dist/noop-runtime.js.map +1 -0
- package/dist/types.d.ts +202 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +27 -0
- package/dist/types.js.map +1 -0
- package/examples/README.md +40 -0
- package/package.json +44 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Slack Primitive Examples
|
|
2
|
+
|
|
3
|
+
## Runtime selection
|
|
4
|
+
|
|
5
|
+
`SlackClient` / `SlackStepExecutor` picks one of three runtimes automatically based on what's in the environment:
|
|
6
|
+
|
|
7
|
+
| Priority | Runtime | Activated by | Transport |
|
|
8
|
+
| -------- | ------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| 1 | `cloud-relay` | `CLOUD_API_TOKEN` + `CLOUD_API_URL` | `POST /api/v1/slack/post-message` on relay-cloud, which uses the workspace's Nango Slack connection (the ricky app). The caller never holds a Slack bot token. |
|
|
10
|
+
| 2 | `local` | `SLACK_BOT_TOKEN` | `@slack/web-api` direct to Slack. |
|
|
11
|
+
| 3 | `noop` | _(neither)_ | Calls succeed, log a warning, and return a placeholder `ts`. Useful for CI / smoke runs where Slack delivery isn't required. |
|
|
12
|
+
|
|
13
|
+
Override with `runtime: 'local' | 'cloud-relay' | 'noop' | 'auto'` in the config.
|
|
14
|
+
|
|
15
|
+
> v1 limitation: in `cloud-relay` mode, `resolveUser` and `resolveChannel` throw `unsupported_in_cloud_relay`. Pass Slack user/channel IDs directly. Mention resolution (`@email@example.com`, `@handle`) is local-only.
|
|
16
|
+
|
|
17
|
+
## Manual Smoke Test (local runtime)
|
|
18
|
+
|
|
19
|
+
Set `SLACK_BOT_TOKEN` to a bot token with `chat:write`, `channels:read`, `groups:read`, `users:read`, and `users:read.email` scopes. Invite the bot to the destination channel and set `SLACK_CHANNEL` to either a channel id or a `#channel-name` reference.
|
|
20
|
+
|
|
21
|
+
Run the notification example from `packages/slack-primitive`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
SLACK_BOT_TOKEN=xoxb-... SLACK_CHANNEL=#engineering npx tsx examples/notify-on-pr.ts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The workflow should open the configured GitHub pull request step and then post a one-line Slack announcement containing the pull request URL. Use `GITHUB_REPO`, `GITHUB_BASE_BRANCH`, and `GITHUB_BRANCH_OVERRIDE` to point the GitHub step at a prepared sandbox branch.
|
|
28
|
+
|
|
29
|
+
## Manual Smoke Test (cloud-relay runtime)
|
|
30
|
+
|
|
31
|
+
Connect Slack on the workspace (one-time, via the cloud dashboard's integrations page). Then point the example at relay-cloud with a CLI api token:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
CLOUD_API_TOKEN=rk_cli_... \
|
|
35
|
+
CLOUD_API_URL=https://api.agentrelay.com \
|
|
36
|
+
SLACK_CHANNEL=#engineering \
|
|
37
|
+
npx tsx examples/notify-on-pr.ts
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
No `SLACK_BOT_TOKEN` is required — the message is posted via the workspace's existing Nango Slack connection.
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@relayflows/slack-primitive",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Slack workflow primitive for Agent Relay",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"examples",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"typecheck:examples": "tsc -p tsconfig.examples.json --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@slack/web-api": "^7.16.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@relayflows/github-primitive": "0.1.0",
|
|
32
|
+
"@types/node": "^22.19.3",
|
|
33
|
+
"typescript": "^5.9.3",
|
|
34
|
+
"vitest": "^3.2.4"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/AgentWorkforce/relayflows.git",
|
|
42
|
+
"directory": "packages/slack-primitive"
|
|
43
|
+
}
|
|
44
|
+
}
|