@openpalm/slack-portal 0.12.7
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/README.md +95 -0
- package/package.json +24 -0
- package/src/index.test.ts +1580 -0
- package/src/index.ts +1177 -0
- package/src/oc-events.ts +157 -0
- package/src/opencode.test.ts +79 -0
- package/src/opencode.ts +130 -0
- package/src/permissions.ts +46 -0
- package/src/runtime.ts +211 -0
- package/src/stream-render.test.ts +182 -0
- package/src/stream-render.ts +517 -0
- package/src/types.ts +17 -0
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @openpalm/slack-portal
|
|
2
|
+
|
|
3
|
+
Slack Socket Mode adapter for OpenPalm.
|
|
4
|
+
It normally runs via the `addon.slack` Compose profile and connects outbound to Slack, so no public inbound URL is required.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- Socket Mode WebSocket connection
|
|
9
|
+
- Direct messages and channel @mentions
|
|
10
|
+
- Threaded replies for channel conversations
|
|
11
|
+
- Slash commands: `/ask`, `/clear`, `/help`
|
|
12
|
+
- Global shortcut: `Ask OpenPalm` modal entry point
|
|
13
|
+
- Message shortcut: `Ask OpenPalm about this message` with prefilled context
|
|
14
|
+
- App Home onboarding tab with quick usage guidance
|
|
15
|
+
- Per-session request queueing and thinking indicators
|
|
16
|
+
|
|
17
|
+
## Deployment model
|
|
18
|
+
|
|
19
|
+
- Shipped service definition: `.openpalm/config/stack/portals.compose.yml`, profile `addon.slack`
|
|
20
|
+
- Non-secret values: `~/.openpalm/knowledge/env/stack.env`
|
|
21
|
+
- Secret values: files under `~/.openpalm/knowledge/secrets/`
|
|
22
|
+
|
|
23
|
+
Manual start example:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd "$HOME/.openpalm/config/stack"
|
|
27
|
+
docker compose \
|
|
28
|
+
--project-name openpalm \
|
|
29
|
+
--env-file ../../knowledge/env/stack.env \
|
|
30
|
+
-f core.compose.yml \
|
|
31
|
+
-f services.compose.yml \
|
|
32
|
+
-f portals.compose.yml \
|
|
33
|
+
-f custom.compose.yml \
|
|
34
|
+
--profile addon.slack \
|
|
35
|
+
up -d
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The service definition uses explicit non-secret environment entries and Docker secret grants. It does not use service-level `env_file`.
|
|
39
|
+
|
|
40
|
+
The Slack portal container uses `PRINCIPAL_ID` + `PRINCIPAL_SECRET_FILE` to authenticate guardian `/oc/*` calls.
|
|
41
|
+
|
|
42
|
+
See `docs/portals/slack-setup.md` for the full setup guide.
|
|
43
|
+
|
|
44
|
+
## Environment variables
|
|
45
|
+
|
|
46
|
+
| Variable | Required | Purpose |
|
|
47
|
+
|---|---|---|
|
|
48
|
+
| `OPENCODE_BASE_URL` | no | OpenCode/guardian `/oc` base URL, default `http://guardian:8080/oc` |
|
|
49
|
+
| `PRINCIPAL_ID` | system-managed | Guardian principal id used for Basic auth |
|
|
50
|
+
| `PRINCIPAL_SECRET_FILE` | system-managed | Shared secret file path used for Basic auth |
|
|
51
|
+
| `SLACK_BOT_TOKEN_FILE` | yes | Bot User OAuth token file path |
|
|
52
|
+
| `SLACK_APP_TOKEN_FILE` | yes | App-level Socket Mode token file path |
|
|
53
|
+
| `SLACK_ALLOWED_CHANNELS` | no | Comma-separated channel allowlist |
|
|
54
|
+
| `SLACK_ALLOWED_USERS` | no | Comma-separated user allowlist |
|
|
55
|
+
| `SLACK_BLOCKED_USERS` | no | Comma-separated user blocklist |
|
|
56
|
+
|
|
57
|
+
Secret values are stored as files and exposed only through `*_FILE` variables. The schema may collect `SLACK_BOT_TOKEN` and `SLACK_APP_TOKEN` for setup, but setup persists them under `knowledge/secrets/` and the runtime receives `SLACK_BOT_TOKEN_FILE` and `SLACK_APP_TOKEN_FILE`, not raw tokens.
|
|
58
|
+
|
|
59
|
+
The shipped Compose overlay exposes per-portal overrides through `SLACK_OPENCODE_BASE_URL`, `SLACK_PRINCIPAL_ID`, and `SLACK_PRINCIPAL_SECRET_FILE`; each defaults to the guardian-backed first-party wiring.
|
|
60
|
+
|
|
61
|
+
## Slack app configuration
|
|
62
|
+
|
|
63
|
+
Required bot scopes:
|
|
64
|
+
|
|
65
|
+
- `app_mentions:read`
|
|
66
|
+
- `chat:write`
|
|
67
|
+
- `im:history`
|
|
68
|
+
- `channels:history`
|
|
69
|
+
- `groups:history`
|
|
70
|
+
- `users:read`
|
|
71
|
+
- `commands`
|
|
72
|
+
|
|
73
|
+
Required event subscriptions:
|
|
74
|
+
|
|
75
|
+
- `app_mention`
|
|
76
|
+
- `message.im`
|
|
77
|
+
- `message.channels`
|
|
78
|
+
- `message.groups`
|
|
79
|
+
- `app_home_opened`
|
|
80
|
+
|
|
81
|
+
Required Interactivity setup:
|
|
82
|
+
|
|
83
|
+
- Enable **Interactivity & Shortcuts** in your Slack app
|
|
84
|
+
- Add a global shortcut with callback ID `ask_openpalm`
|
|
85
|
+
- Add a message shortcut with callback ID `ask_openpalm_message`
|
|
86
|
+
- Socket Mode apps can use any placeholder Request URL for interactivity
|
|
87
|
+
|
|
88
|
+
The adapter does not require reaction scopes.
|
|
89
|
+
|
|
90
|
+
## Conversation behavior
|
|
91
|
+
|
|
92
|
+
- DMs are per-user sessions
|
|
93
|
+
- Channel mentions reply in a thread
|
|
94
|
+
- Follow-ups sent while a session is busy are queued
|
|
95
|
+
- `/clear` clears the active session and drops queued follow-ups
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openpalm/slack-portal",
|
|
3
|
+
"description": "Slack bot portal adapter for OpenPalm",
|
|
4
|
+
"version": "0.12.7",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MPL-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/itlackey/openpalm.git",
|
|
10
|
+
"directory": "portals/slack"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"bun": ">=1.0.0"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"main": "src/index.ts",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@opencode-ai/sdk": "1.17.7",
|
|
22
|
+
"@slack/bolt": "^4.1.0"
|
|
23
|
+
}
|
|
24
|
+
}
|