agent-messenger 2.0.0 → 2.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/.claude-plugin/marketplace.json +14 -1
- package/.claude-plugin/plugin.json +4 -2
- package/README.md +33 -29
- package/dist/package.json +10 -2
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/platforms/webex/app-config.d.ts +7 -0
- package/dist/src/platforms/webex/app-config.d.ts.map +1 -0
- package/dist/src/platforms/webex/app-config.js +20 -0
- package/dist/src/platforms/webex/app-config.js.map +1 -0
- package/dist/src/platforms/webex/cli.d.ts +5 -0
- package/dist/src/platforms/webex/cli.d.ts.map +1 -0
- package/dist/src/platforms/webex/cli.js +32 -0
- package/dist/src/platforms/webex/cli.js.map +1 -0
- package/dist/src/platforms/webex/client.d.ts +45 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -0
- package/dist/src/platforms/webex/client.js +175 -0
- package/dist/src/platforms/webex/client.js.map +1 -0
- package/dist/src/platforms/webex/commands/auth.d.ts +15 -0
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/auth.js +124 -0
- package/dist/src/platforms/webex/commands/auth.js.map +1 -0
- package/dist/src/platforms/webex/commands/index.d.ts +6 -0
- package/dist/src/platforms/webex/commands/index.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/index.js +6 -0
- package/dist/src/platforms/webex/commands/index.js.map +1 -0
- package/dist/src/platforms/webex/commands/member.d.ts +7 -0
- package/dist/src/platforms/webex/commands/member.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/member.js +34 -0
- package/dist/src/platforms/webex/commands/member.js.map +1 -0
- package/dist/src/platforms/webex/commands/message.d.ts +26 -0
- package/dist/src/platforms/webex/commands/message.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/message.js +153 -0
- package/dist/src/platforms/webex/commands/message.js.map +1 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts +9 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/snapshot.js +72 -0
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -0
- package/dist/src/platforms/webex/commands/space.d.ts +11 -0
- package/dist/src/platforms/webex/commands/space.d.ts.map +1 -0
- package/dist/src/platforms/webex/commands/space.js +59 -0
- package/dist/src/platforms/webex/commands/space.js.map +1 -0
- package/dist/src/platforms/webex/credential-manager.d.ts +23 -0
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -0
- package/dist/src/platforms/webex/credential-manager.js +148 -0
- package/dist/src/platforms/webex/credential-manager.js.map +1 -0
- package/dist/src/platforms/webex/ensure-auth.d.ts +2 -0
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -0
- package/dist/src/platforms/webex/ensure-auth.js +20 -0
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -0
- package/dist/src/platforms/webex/index.d.ts +6 -0
- package/dist/src/platforms/webex/index.d.ts.map +1 -0
- package/dist/src/platforms/webex/index.js +5 -0
- package/dist/src/platforms/webex/index.js.map +1 -0
- package/dist/src/platforms/webex/types.d.ts +124 -0
- package/dist/src/platforms/webex/types.d.ts.map +1 -0
- package/dist/src/platforms/webex/types.js +63 -0
- package/dist/src/platforms/webex/types.js.map +1 -0
- package/dist/src/tui/adapters/webex-adapter.d.ts +14 -0
- package/dist/src/tui/adapters/webex-adapter.d.ts.map +1 -0
- package/dist/src/tui/adapters/webex-adapter.js +79 -0
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -0
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +2 -0
- package/dist/src/tui/app.js.map +1 -1
- package/docs/content/docs/cli/meta.json +1 -0
- package/docs/content/docs/cli/webex.mdx +291 -0
- package/docs/content/docs/sdk/meta.json +1 -1
- package/docs/content/docs/sdk/webex.mdx +260 -0
- package/docs/content/docs/tui.mdx +4 -3
- package/docs/src/app/page.tsx +2 -2
- package/package.json +10 -2
- package/skills/agent-channeltalk/SKILL.md +1 -1
- package/skills/agent-channeltalkbot/SKILL.md +1 -1
- package/skills/agent-discord/SKILL.md +1 -1
- package/skills/agent-discordbot/SKILL.md +1 -1
- package/skills/agent-instagram/SKILL.md +1 -1
- package/skills/agent-kakaotalk/SKILL.md +1 -1
- package/skills/agent-line/SKILL.md +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +1 -1
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +386 -0
- package/skills/agent-webex/references/authentication.md +318 -0
- package/skills/agent-webex/references/common-patterns.md +723 -0
- package/skills/agent-webex/templates/monitor-space.sh +165 -0
- package/skills/agent-webex/templates/post-message.sh +170 -0
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/cli.ts +4 -0
- package/src/platforms/webex/app-config.test.ts +98 -0
- package/src/platforms/webex/app-config.ts +31 -0
- package/src/platforms/webex/cli.test.ts +58 -0
- package/src/platforms/webex/cli.ts +39 -0
- package/src/platforms/webex/client.test.ts +429 -0
- package/src/platforms/webex/client.ts +247 -0
- package/src/platforms/webex/commands/auth.test.ts +222 -0
- package/src/platforms/webex/commands/auth.ts +180 -0
- package/src/platforms/webex/commands/index.ts +5 -0
- package/src/platforms/webex/commands/member.test.ts +103 -0
- package/src/platforms/webex/commands/member.ts +45 -0
- package/src/platforms/webex/commands/message.test.ts +231 -0
- package/src/platforms/webex/commands/message.ts +204 -0
- package/src/platforms/webex/commands/snapshot.test.ts +96 -0
- package/src/platforms/webex/commands/snapshot.ts +91 -0
- package/src/platforms/webex/commands/space.test.ts +206 -0
- package/src/platforms/webex/commands/space.ts +74 -0
- package/src/platforms/webex/credential-manager.test.ts +314 -0
- package/src/platforms/webex/credential-manager.ts +197 -0
- package/src/platforms/webex/ensure-auth.test.ts +85 -0
- package/src/platforms/webex/ensure-auth.ts +19 -0
- package/src/platforms/webex/index.test.ts +25 -0
- package/src/platforms/webex/index.ts +17 -0
- package/src/platforms/webex/types.test.ts +307 -0
- package/src/platforms/webex/types.ts +127 -0
- package/src/tui/adapters/webex-adapter.ts +103 -0
- package/src/tui/app.ts +2 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# Authentication Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
agent-webex supports three authentication methods against the Webex REST API (`https://webexapis.com/v1`):
|
|
6
|
+
|
|
7
|
+
1. **OAuth Device Grant** (default): Zero-config. Run `auth login`, approve in browser, done. Tokens refresh automatically.
|
|
8
|
+
2. **Bot Token**: Pass via `auth login --token`. Never expires. Best for CI/CD.
|
|
9
|
+
3. **Personal Access Token (PAT)**: Pass via `auth login --token`. Expires in 12 hours. For quick testing.
|
|
10
|
+
|
|
11
|
+
## Token Types
|
|
12
|
+
|
|
13
|
+
### OAuth Device Grant (default)
|
|
14
|
+
|
|
15
|
+
The primary authentication method. No credentials to copy, no developer portal setup required.
|
|
16
|
+
|
|
17
|
+
- **How it works**: Run `agent-webex auth login`. The CLI requests a device code from Webex, opens your browser, and waits for you to approve. Once approved, access and refresh tokens are stored automatically.
|
|
18
|
+
- **Access token lifetime**: 14 days
|
|
19
|
+
- **Refresh token lifetime**: 90 days
|
|
20
|
+
- **Auto-refresh**: The CLI refreshes expired access tokens automatically using the stored refresh token. No manual intervention needed until the refresh token itself expires (90 days).
|
|
21
|
+
- **Permissions**: `spark:all` scope (full access to your Webex account)
|
|
22
|
+
- **Best for**: Interactive use, development, any scenario where a human can approve via browser
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
agent-webex auth login
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The CLI ships with built-in Integration credentials so this works out of the box. You can override them with your own (see [Environment Variables](#environment-variables)).
|
|
29
|
+
|
|
30
|
+
### Bot Token
|
|
31
|
+
|
|
32
|
+
A permanent token tied to a Webex bot identity.
|
|
33
|
+
|
|
34
|
+
- **Lifetime**: Never expires (unless you regenerate it)
|
|
35
|
+
- **How to get one**: Create a bot at https://developer.webex.com/my-apps/new/bot. The token is shown once at creation time. Save it immediately.
|
|
36
|
+
- **Permissions**: The bot can only interact with spaces it has been added to
|
|
37
|
+
- **Best for**: Long-running automations, CI/CD pipelines, production scripts
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
agent-webex auth login --token "YOUR_BOT_TOKEN_HERE"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Personal Access Token (PAT)
|
|
44
|
+
|
|
45
|
+
A short-lived token for development and testing.
|
|
46
|
+
|
|
47
|
+
- **Lifetime**: 12 hours from generation
|
|
48
|
+
- **How to get one**: Visit https://developer.webex.com/docs/getting-started and copy the token shown on the page
|
|
49
|
+
- **Permissions**: Full access to everything your Webex account can do
|
|
50
|
+
- **Best for**: Quick testing, one-off scripts
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
agent-webex auth login --token "YOUR_PAT_HERE"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Logging In
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Device Grant (default, zero-config)
|
|
60
|
+
agent-webex auth login
|
|
61
|
+
|
|
62
|
+
# With custom Integration credentials
|
|
63
|
+
agent-webex auth login --client-id <id> --client-secret <secret>
|
|
64
|
+
|
|
65
|
+
# Bot token
|
|
66
|
+
agent-webex auth login --token <bot-token>
|
|
67
|
+
|
|
68
|
+
# PAT
|
|
69
|
+
agent-webex auth login --token <pat>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
When using `--token`, the CLI validates the token against the Webex API before saving. If validation fails, you'll see an error and the token won't be stored.
|
|
73
|
+
|
|
74
|
+
When using Device Grant, the CLI prints a URL and code, opens your browser, then polls until you approve (or the code expires).
|
|
75
|
+
|
|
76
|
+
## Checking Status
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
agent-webex auth status
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Output when authenticated:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"authenticated": true,
|
|
87
|
+
"user": {
|
|
88
|
+
"id": "Y2lz...",
|
|
89
|
+
"displayName": "Alice Chen",
|
|
90
|
+
"emails": ["alice@example.com"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Output when not authenticated:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"error": "Not authenticated. Run \"auth login\" first."
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Logging Out
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
agent-webex auth logout
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This removes the stored credentials from disk.
|
|
110
|
+
|
|
111
|
+
## Credential Storage
|
|
112
|
+
|
|
113
|
+
### Location
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
~/.config/agent-messenger/webex-credentials.json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Format
|
|
120
|
+
|
|
121
|
+
OAuth credentials (from Device Grant):
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"accessToken": "...",
|
|
126
|
+
"refreshToken": "...",
|
|
127
|
+
"expiresAt": 1234567890,
|
|
128
|
+
"clientId": "...",
|
|
129
|
+
"clientSecret": "...",
|
|
130
|
+
"tokenType": "oauth"
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Manual credentials (from `--token`):
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"accessToken": "...",
|
|
139
|
+
"refreshToken": "",
|
|
140
|
+
"expiresAt": 0,
|
|
141
|
+
"tokenType": "manual"
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Security
|
|
146
|
+
|
|
147
|
+
- File permissions: `0600` (owner read/write only)
|
|
148
|
+
- Credentials are stored in plaintext (same approach as other agent-messenger platforms)
|
|
149
|
+
- Writes are atomic (tmp file + rename) to prevent corruption
|
|
150
|
+
- Keep this file secure. It grants access to your Webex account
|
|
151
|
+
- Built-in OAuth credentials are public bootstrap credentials, not secrets
|
|
152
|
+
- Custom client secrets (from `--client-id`/`--client-secret` or env vars) are stored in plaintext alongside tokens
|
|
153
|
+
- Bot tokens never expire. Treat them like passwords
|
|
154
|
+
- PATs auto-expire in 12 hours, which limits exposure
|
|
155
|
+
|
|
156
|
+
## Token Lifecycle
|
|
157
|
+
|
|
158
|
+
### OAuth Device Grant
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
auth login -> Device code -> Browser approval -> Access token (14 days) + Refresh token (90 days)
|
|
162
|
+
|
|
|
163
|
+
Token expires
|
|
164
|
+
|
|
|
165
|
+
Auto-refresh via refresh token
|
|
166
|
+
|
|
|
167
|
+
Refresh token expires (90 days)
|
|
168
|
+
|
|
|
169
|
+
Re-run "auth login"
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The CLI checks token expiry before each API call and refreshes automatically when needed. You won't notice this happening.
|
|
173
|
+
|
|
174
|
+
### Bot Tokens
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
Created with bot registration -> Valid forever -> Only invalidated if you regenerate
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Bot tokens are ideal for automation. The bot must be added to each space it needs to interact with.
|
|
181
|
+
|
|
182
|
+
### Personal Access Tokens
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
Generated at developer.webex.com -> Valid for 12 hours -> Expires -> Generate a new one
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
PATs are the quickest way to get started but require manual renewal. For scripts that run longer than 12 hours, use a bot token or Device Grant.
|
|
189
|
+
|
|
190
|
+
## Environment Variables
|
|
191
|
+
|
|
192
|
+
Override the built-in Integration credentials with your own:
|
|
193
|
+
|
|
194
|
+
| Variable | Description |
|
|
195
|
+
|---|---|
|
|
196
|
+
| `AGENT_WEBEX_CLIENT_ID` | Webex Integration client ID |
|
|
197
|
+
| `AGENT_WEBEX_CLIENT_SECRET` | Webex Integration client secret |
|
|
198
|
+
|
|
199
|
+
Both must be set together. When set, `auth login` (without `--token`) uses these instead of the built-in credentials.
|
|
200
|
+
|
|
201
|
+
Legacy aliases `AGENT_MESSENGER_WEBEX_CLIENT_ID` and `AGENT_MESSENGER_WEBEX_CLIENT_SECRET` are also supported.
|
|
202
|
+
|
|
203
|
+
## Troubleshooting
|
|
204
|
+
|
|
205
|
+
### "Not authenticated"
|
|
206
|
+
|
|
207
|
+
No credentials stored. Log in first:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
agent-webex auth login
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### "401 Unauthorized"
|
|
214
|
+
|
|
215
|
+
Token is expired or invalid.
|
|
216
|
+
|
|
217
|
+
**If using Device Grant**: The CLI auto-refreshes tokens, so this usually means the refresh token has expired (after 90 days). Run `agent-webex auth login` again.
|
|
218
|
+
|
|
219
|
+
**If using a PAT**: Generate a new one at https://developer.webex.com/docs/getting-started
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
agent-webex auth login --token <new-pat>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**If using a bot token**: Bot tokens don't expire. Double-check you copied the full token. If you lost it, regenerate at https://developer.webex.com/my-apps.
|
|
226
|
+
|
|
227
|
+
### "Device authorization failed"
|
|
228
|
+
|
|
229
|
+
The device code request was rejected. Possible causes:
|
|
230
|
+
|
|
231
|
+
- Network connectivity issues
|
|
232
|
+
- Custom client ID is invalid or revoked
|
|
233
|
+
- Webex API is temporarily unavailable
|
|
234
|
+
|
|
235
|
+
### "Device authorization timed out"
|
|
236
|
+
|
|
237
|
+
You didn't approve the request in the browser before the code expired. Run `auth login` again.
|
|
238
|
+
|
|
239
|
+
### "Token validation failed"
|
|
240
|
+
|
|
241
|
+
The token was rejected by the Webex API during login. Common causes:
|
|
242
|
+
|
|
243
|
+
- Token was copied incorrectly (missing characters, extra whitespace)
|
|
244
|
+
- Token has already expired (PATs last 12 hours)
|
|
245
|
+
- Token was revoked or regenerated
|
|
246
|
+
|
|
247
|
+
### Permission errors on credentials file
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Fix permissions
|
|
251
|
+
chmod 600 ~/.config/agent-messenger/webex-credentials.json
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Token works in browser but not in CLI
|
|
255
|
+
|
|
256
|
+
Make sure you're using the actual API token, not a session cookie or CSRF token from the browser. The correct token comes from the Developer Portal's "Getting Started" page or from bot/integration creation.
|
|
257
|
+
|
|
258
|
+
## Security Considerations
|
|
259
|
+
|
|
260
|
+
### What agent-webex Can Access
|
|
261
|
+
|
|
262
|
+
With a valid token, agent-webex has the same permissions as the token owner:
|
|
263
|
+
|
|
264
|
+
- **OAuth Device Grant**: `spark:all` scope, full access to your Webex account
|
|
265
|
+
- **PAT**: Read and write to all spaces you belong to, list members, send messages
|
|
266
|
+
- **Bot**: Read and write only in spaces the bot has been added to
|
|
267
|
+
|
|
268
|
+
### What agent-webex Cannot Do
|
|
269
|
+
|
|
270
|
+
- Access spaces you (or the bot) haven't been added to
|
|
271
|
+
- Perform admin operations (unless the token owner is an admin)
|
|
272
|
+
- Create or delete spaces (not implemented in the CLI)
|
|
273
|
+
- Upload or download files (not implemented in the CLI)
|
|
274
|
+
|
|
275
|
+
### Best Practices
|
|
276
|
+
|
|
277
|
+
1. **Use Device Grant for interactive work**: Zero-config, auto-refreshing, scoped access
|
|
278
|
+
2. **Use bot tokens for automation**: They don't expire and have scoped access
|
|
279
|
+
3. **Protect credentials.json**: Never commit to version control
|
|
280
|
+
4. **Rotate PATs regularly**: Don't reuse expired tokens. Generate fresh ones
|
|
281
|
+
5. **Revoke compromised tokens**: Regenerate bot tokens at https://developer.webex.com/my-apps if compromised
|
|
282
|
+
6. **Use custom Integration credentials for production**: Set `AGENT_WEBEX_CLIENT_ID` and `AGENT_WEBEX_CLIENT_SECRET` instead of relying on built-in bootstrap credentials
|
|
283
|
+
|
|
284
|
+
## Manual Credential Setup (Advanced)
|
|
285
|
+
|
|
286
|
+
If you need to create the credentials file manually:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
# Create config directory
|
|
290
|
+
mkdir -p ~/.config/agent-messenger
|
|
291
|
+
|
|
292
|
+
# OAuth credentials
|
|
293
|
+
cat > ~/.config/agent-messenger/webex-credentials.json << 'EOF'
|
|
294
|
+
{
|
|
295
|
+
"accessToken": "YOUR_ACCESS_TOKEN",
|
|
296
|
+
"refreshToken": "YOUR_REFRESH_TOKEN",
|
|
297
|
+
"expiresAt": 1234567890000,
|
|
298
|
+
"clientId": "YOUR_CLIENT_ID",
|
|
299
|
+
"clientSecret": "YOUR_CLIENT_SECRET",
|
|
300
|
+
"tokenType": "oauth"
|
|
301
|
+
}
|
|
302
|
+
EOF
|
|
303
|
+
|
|
304
|
+
# Or manual token
|
|
305
|
+
cat > ~/.config/agent-messenger/webex-credentials.json << 'EOF'
|
|
306
|
+
{
|
|
307
|
+
"accessToken": "YOUR_TOKEN_HERE",
|
|
308
|
+
"refreshToken": "",
|
|
309
|
+
"expiresAt": 0,
|
|
310
|
+
"tokenType": "manual"
|
|
311
|
+
}
|
|
312
|
+
EOF
|
|
313
|
+
|
|
314
|
+
# Set secure permissions
|
|
315
|
+
chmod 600 ~/.config/agent-messenger/webex-credentials.json
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Always prefer `agent-webex auth login` over manual file creation. The login command validates tokens and handles the OAuth flow correctly.
|