@lobu/cli 3.0.5 → 3.0.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/dist/api/context.js +2 -2
- package/dist/api/context.js.map +1 -1
- package/dist/commands/chat.js +2 -2
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +79 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +4 -4
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/providers/add.d.ts.map +1 -1
- package/dist/commands/providers/add.js +2 -2
- package/dist/commands/providers/add.js.map +1 -1
- package/dist/commands/providers/list.js +1 -1
- package/dist/commands/providers/list.js.map +1 -1
- package/dist/commands/skills/add.d.ts.map +1 -1
- package/dist/commands/skills/add.js +2 -2
- package/dist/commands/skills/add.js.map +1 -1
- package/dist/commands/skills/info.js +1 -1
- package/dist/commands/skills/info.js.map +1 -1
- package/dist/commands/skills/list.js +2 -2
- package/dist/commands/skills/list.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/validate.js +1 -1
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/whoami.js +1 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-servers.json +216 -0
- package/dist/system-skills.json +364 -0
- package/dist/templates/.env.tmpl +18 -0
- package/dist/templates/.gitignore.tmpl +33 -0
- package/dist/templates/AGENTS.md.tmpl +1 -0
- package/dist/templates/Dockerfile.worker.tmpl +29 -0
- package/dist/templates/README.md.tmpl +94 -0
- package/dist/templates/TESTING.md.tmpl +225 -0
- package/package.json +1 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Testing Your Lobu
|
|
2
|
+
|
|
3
|
+
This bot provides HTTP APIs for testing and automation. These endpoints allow AI agents and developers to interact with your bot programmatically.
|
|
4
|
+
|
|
5
|
+
## 1. Messaging API
|
|
6
|
+
|
|
7
|
+
Send messages to your bot with optional file uploads.
|
|
8
|
+
|
|
9
|
+
### Endpoint
|
|
10
|
+
```
|
|
11
|
+
POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Authentication
|
|
15
|
+
|
|
16
|
+
**Bearer Token in Header:**
|
|
17
|
+
```
|
|
18
|
+
Authorization: Bearer xoxb-your-bot-token
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The bot token must be provided in the `Authorization` header, not in the request body.
|
|
22
|
+
|
|
23
|
+
### Request Format
|
|
24
|
+
|
|
25
|
+
#### JSON Request (Simple Message)
|
|
26
|
+
```bash
|
|
27
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
28
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
29
|
+
-H "Content-Type: application/json" \
|
|
30
|
+
-d '{
|
|
31
|
+
"platform": "slack",
|
|
32
|
+
"channel": "general",
|
|
33
|
+
"content": "what is 2+2?"
|
|
34
|
+
}'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Multipart Request (With File Upload)
|
|
38
|
+
```bash
|
|
39
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
40
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
41
|
+
-F "platform=slack" \
|
|
42
|
+
-F "channel=C12345678" \
|
|
43
|
+
-F "content=please review this file" \
|
|
44
|
+
-F "file=@/path/to/document.pdf"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Parameters
|
|
48
|
+
|
|
49
|
+
| Field | Required | Description |
|
|
50
|
+
|-------|----------|-------------|
|
|
51
|
+
| `platform` | Yes | Platform name (currently: "slack") |
|
|
52
|
+
| `channel` | Yes | Channel ID (e.g., `C12345678`) or name (e.g., `general`, `#general`) |
|
|
53
|
+
| `content` | Yes | Message text to send (use `@me` to mention the bot) |
|
|
54
|
+
| `threadId` | No | Thread ID to reply to (for thread continuity) |
|
|
55
|
+
| `files` | No | File attachments (multipart/form-data, up to 10 files) |
|
|
56
|
+
|
|
57
|
+
### Response Format
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"success": true,
|
|
62
|
+
"channel": "C12345678",
|
|
63
|
+
"messageId": "1234567890.123456",
|
|
64
|
+
"threadId": "1234567890.123456",
|
|
65
|
+
"threadUrl": "https://app.slack.com/client/T12345/C12345678/thread/1234567890.123456"
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Note about `threadId`:**
|
|
70
|
+
- When posting a new message (no `threadId` parameter), `threadId` equals `messageId`
|
|
71
|
+
- When replying to a thread (with `threadId` parameter), `threadId` is the original thread's ID
|
|
72
|
+
|
|
73
|
+
### Bot Mentions
|
|
74
|
+
|
|
75
|
+
Use the `@me` placeholder to mention the bot in a platform-agnostic way:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"content": "@me what is 2+2?"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The API automatically replaces `@me` with the correct bot mention for the platform:
|
|
84
|
+
- **Slack**: `<@U12345>`
|
|
85
|
+
- **Discord** (future): `<@123456>`
|
|
86
|
+
- **Telegram** (future): `@botname`
|
|
87
|
+
|
|
88
|
+
If you don't want to mention the bot, simply omit `@me` from your message.
|
|
89
|
+
|
|
90
|
+
### Example: Simple Text Message (with @me)
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
94
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
95
|
+
-H "Content-Type: application/json" \
|
|
96
|
+
-d '{
|
|
97
|
+
"platform": "slack",
|
|
98
|
+
"channel": "general",
|
|
99
|
+
"content": "@me what is 2+2?"
|
|
100
|
+
}'
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Example: Without Bot Mention
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
107
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
108
|
+
-H "Content-Type: application/json" \
|
|
109
|
+
-d '{
|
|
110
|
+
"platform": "slack",
|
|
111
|
+
"channel": "general",
|
|
112
|
+
"content": "just a regular message"
|
|
113
|
+
}'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Example: Thread Reply
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
120
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
121
|
+
-H "Content-Type: application/json" \
|
|
122
|
+
-d '{
|
|
123
|
+
"platform": "slack",
|
|
124
|
+
"channel": "C12345678",
|
|
125
|
+
"content": "tell me more about that",
|
|
126
|
+
"threadId": "1234567890.123456"
|
|
127
|
+
}'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Example: Single File Upload
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
134
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
135
|
+
-F "platform=slack" \
|
|
136
|
+
-F "channel=dev-channel" \
|
|
137
|
+
-F "content=@me analyze this CSV" \
|
|
138
|
+
-F "files=@data.csv"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Example: Multiple File Upload
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
curl -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
145
|
+
-H "Authorization: Bearer xoxb-your-bot-token" \
|
|
146
|
+
-F "platform=slack" \
|
|
147
|
+
-F "channel=dev-channel" \
|
|
148
|
+
-F "content=@me review these documents" \
|
|
149
|
+
-F "files=@document1.pdf" \
|
|
150
|
+
-F "files=@document2.pdf" \
|
|
151
|
+
-F "files=@spreadsheet.xlsx"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Channel Name Resolution
|
|
155
|
+
|
|
156
|
+
The API automatically resolves channel names to IDs:
|
|
157
|
+
- `"general"` → `"C12345678"`
|
|
158
|
+
- `"#general"` → `"C12345678"`
|
|
159
|
+
- `"C12345678"` → `"C12345678"` (already an ID)
|
|
160
|
+
|
|
161
|
+
### Error Handling
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"success": false,
|
|
166
|
+
"error": "Failed to send message",
|
|
167
|
+
"details": "Channel \"nonexistent\" not found"
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Common errors:
|
|
172
|
+
- `400`: Missing required fields (`platform`, `channel`, or `message`)
|
|
173
|
+
- `401`: Missing or invalid `Authorization` header
|
|
174
|
+
- `404`: Platform not found
|
|
175
|
+
- `500`: Platform API error (invalid token, channel not found, etc.)
|
|
176
|
+
- `501`: Platform doesn't support `sendMessage`
|
|
177
|
+
|
|
178
|
+
### Platform-Agnostic Design
|
|
179
|
+
|
|
180
|
+
The messaging API is designed to work across multiple chat platforms:
|
|
181
|
+
|
|
182
|
+
**Current Support:**
|
|
183
|
+
- Slack (bot mentions: `<@U12345>`, uses `@me` placeholder)
|
|
184
|
+
|
|
185
|
+
**Future Support:**
|
|
186
|
+
- Discord (bot mentions: `<@123456>`, uses `@me` placeholder)
|
|
187
|
+
- Telegram (bot mentions: `@botname`, uses `@me` placeholder)
|
|
188
|
+
|
|
189
|
+
The `@me` placeholder ensures your code works across all platforms without modification.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## 2. Complete E2E Testing Example
|
|
194
|
+
|
|
195
|
+
Testing a full conversation:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Step 1: Send initial message
|
|
199
|
+
RESPONSE=$(curl -s -X POST http://localhost:{{GATEWAY_PORT}}/api/v1/agents/{agentId}/messages \
|
|
200
|
+
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
|
|
201
|
+
-H "Content-Type: application/json" \
|
|
202
|
+
-d '{
|
|
203
|
+
"platform": "slack",
|
|
204
|
+
"channel": "test-channel",
|
|
205
|
+
"content": "@me give me three options"
|
|
206
|
+
}')
|
|
207
|
+
|
|
208
|
+
THREAD_ID=$(echo $RESPONSE | jq -r '.threadId')
|
|
209
|
+
echo "Thread ID: $THREAD_ID"
|
|
210
|
+
|
|
211
|
+
# Step 2: Verify bot response
|
|
212
|
+
# (Check thread for follow-up message)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 4. Notes for AI Agents
|
|
218
|
+
|
|
219
|
+
These APIs enable your AI agents to:
|
|
220
|
+
- **Test connectivity**: Verify bot deployment is working
|
|
221
|
+
- **E2E testing**: Automate full conversation flows
|
|
222
|
+
- **CI/CD integration**: Run automated tests before deployment
|
|
223
|
+
- **Development**: Quickly test bot behavior without manual Slack interaction
|
|
224
|
+
|
|
225
|
+
The messaging endpoint is **platform-agnostic** by design. While Slack is currently supported, the same API structure will work for Discord, Teams, and other platforms in the future.
|