agent-messenger 2.8.0 → 2.9.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/plugin.json +1 -1
- package/README.md +0 -11
- package/dist/package.json +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts +4 -2
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.js +86 -31
- package/dist/src/platforms/channeltalk/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.d.ts +3 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/snapshot.js +110 -60
- package/dist/src/platforms/channeltalkbot/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/discord/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/snapshot.js +48 -34
- package/dist/src/platforms/discord/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/discordbot/commands/snapshot.d.ts +2 -0
- package/dist/src/platforms/discordbot/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/commands/snapshot.js +46 -34
- package/dist/src/platforms/discordbot/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/snapshot.js +75 -55
- package/dist/src/platforms/slack/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/teams/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/snapshot.js +44 -31
- package/dist/src/platforms/teams/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.d.ts +1 -0
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.js +14 -7
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
- package/docs/content/docs/agent-skills.mdx +0 -10
- package/docs/content/docs/cli/channeltalk.mdx +18 -8
- package/docs/content/docs/cli/channeltalkbot.mdx +16 -6
- package/docs/content/docs/cli/discord.mdx +23 -7
- package/docs/content/docs/cli/discordbot.mdx +23 -7
- package/docs/content/docs/cli/slack.mdx +24 -7
- package/docs/content/docs/cli/teams.mdx +24 -8
- package/docs/content/docs/cli/webex.mdx +15 -2
- package/package.json +1 -1
- package/skills/agent-channeltalk/SKILL.md +19 -9
- package/skills/agent-channeltalk/references/common-patterns.md +10 -9
- package/skills/agent-channeltalkbot/SKILL.md +19 -9
- package/skills/agent-channeltalkbot/references/common-patterns.md +10 -9
- package/skills/agent-discord/SKILL.md +18 -9
- package/skills/agent-discord/references/common-patterns.md +8 -7
- package/skills/agent-discordbot/SKILL.md +18 -9
- 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 +19 -10
- package/skills/agent-slack/references/common-patterns.md +4 -7
- package/skills/agent-slackbot/SKILL.md +1 -1
- package/skills/agent-teams/SKILL.md +18 -9
- package/skills/agent-teams/references/common-patterns.md +9 -7
- package/skills/agent-telegram/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +13 -4
- package/skills/agent-webex/references/common-patterns.md +8 -2
- package/skills/agent-wechatbot/SKILL.md +1 -1
- package/skills/agent-whatsapp/SKILL.md +1 -1
- package/skills/agent-whatsappbot/SKILL.md +1 -1
- package/src/platforms/channeltalk/commands/snapshot.test.ts +58 -26
- package/src/platforms/channeltalk/commands/snapshot.ts +107 -33
- package/src/platforms/channeltalkbot/commands/snapshot.test.ts +26 -8
- package/src/platforms/channeltalkbot/commands/snapshot.ts +131 -64
- package/src/platforms/discord/commands/snapshot.test.ts +1 -1
- package/src/platforms/discord/commands/snapshot.ts +58 -42
- package/src/platforms/discordbot/commands/snapshot.test.ts +40 -18
- package/src/platforms/discordbot/commands/snapshot.ts +54 -37
- package/src/platforms/slack/commands/snapshot.test.ts +63 -8
- package/src/platforms/slack/commands/snapshot.ts +98 -66
- package/src/platforms/teams/commands/snapshot.test.ts +1 -1
- package/src/platforms/teams/commands/snapshot.ts +53 -38
- package/src/platforms/webex/commands/snapshot.test.ts +14 -1
- package/src/platforms/webex/commands/snapshot.ts +17 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-discordbot
|
|
3
3
|
description: Interact with Discord servers using bot tokens - send messages, read channels, manage reactions
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.9.0
|
|
5
5
|
allowed-tools: Bash(agent-discordbot:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -265,21 +265,30 @@ agent-discordbot thread archive <thread-id>
|
|
|
265
265
|
|
|
266
266
|
### Snapshot Command
|
|
267
267
|
|
|
268
|
-
Get
|
|
268
|
+
Get server overview for AI agents (brief by default):
|
|
269
269
|
|
|
270
270
|
```bash
|
|
271
|
-
#
|
|
271
|
+
# Brief snapshot (default) — fast, minimal API calls
|
|
272
272
|
agent-discordbot snapshot
|
|
273
273
|
|
|
274
|
-
#
|
|
275
|
-
agent-discordbot snapshot --
|
|
276
|
-
agent-discordbot snapshot --users-only
|
|
274
|
+
# Full snapshot — includes messages and members (slow, large output)
|
|
275
|
+
agent-discordbot snapshot --full
|
|
277
276
|
|
|
278
|
-
#
|
|
279
|
-
agent-discordbot snapshot --
|
|
277
|
+
# Filtered full snapshots
|
|
278
|
+
agent-discordbot snapshot --full --channels-only
|
|
279
|
+
agent-discordbot snapshot --full --users-only
|
|
280
|
+
|
|
281
|
+
# Limit messages per channel (only with --full)
|
|
282
|
+
agent-discordbot snapshot --full --limit 10
|
|
280
283
|
```
|
|
281
284
|
|
|
282
|
-
|
|
285
|
+
Default returns brief JSON with:
|
|
286
|
+
|
|
287
|
+
- Server ID
|
|
288
|
+
- Channels (id, name) — text channels only
|
|
289
|
+
- Hint for next commands
|
|
290
|
+
|
|
291
|
+
With `--full`, returns comprehensive JSON with:
|
|
283
292
|
|
|
284
293
|
- Server metadata (id, name)
|
|
285
294
|
- Channels (id, name, type, topic)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-slack
|
|
3
3
|
description: Interact with Slack workspaces - send messages, read channels, manage reactions
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.9.0
|
|
5
5
|
allowed-tools: Bash(agent-slack:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -473,24 +473,33 @@ agent-slack emoji list --pretty
|
|
|
473
473
|
|
|
474
474
|
### Snapshot Command
|
|
475
475
|
|
|
476
|
-
Get
|
|
476
|
+
Get workspace overview for AI agents (brief by default):
|
|
477
477
|
|
|
478
478
|
```bash
|
|
479
|
-
#
|
|
479
|
+
# Brief snapshot (default) — fast, minimal API calls
|
|
480
480
|
agent-slack snapshot
|
|
481
481
|
|
|
482
|
-
#
|
|
483
|
-
agent-slack snapshot --
|
|
484
|
-
agent-slack snapshot --users-only
|
|
482
|
+
# Full snapshot — includes messages, users, user groups (slow, large output)
|
|
483
|
+
agent-slack snapshot --full
|
|
485
484
|
|
|
486
|
-
#
|
|
487
|
-
agent-slack snapshot --
|
|
485
|
+
# Filtered full snapshots
|
|
486
|
+
agent-slack snapshot --full --channels-only
|
|
487
|
+
agent-slack snapshot --full --users-only
|
|
488
|
+
|
|
489
|
+
# Limit messages per channel (only with --full)
|
|
490
|
+
agent-slack snapshot --full --limit 10
|
|
488
491
|
```
|
|
489
492
|
|
|
490
|
-
|
|
493
|
+
Default returns brief JSON with:
|
|
494
|
+
|
|
495
|
+
- Workspace metadata
|
|
496
|
+
- Channels (id, name) — non-archived only
|
|
497
|
+
- Hint for next commands
|
|
498
|
+
|
|
499
|
+
With `--full`, returns comprehensive JSON with:
|
|
491
500
|
|
|
492
501
|
- Workspace metadata
|
|
493
|
-
- Channels (id, name, topic, purpose)
|
|
502
|
+
- Channels (id, name, topic, purpose, is_private, is_archived)
|
|
494
503
|
- Recent messages (ts, text, user, channel)
|
|
495
504
|
- Users (id, name, profile)
|
|
496
505
|
- User groups (id, name, handle, description, user_count, users)
|
|
@@ -71,28 +71,25 @@ done
|
|
|
71
71
|
```bash
|
|
72
72
|
#!/bin/bash
|
|
73
73
|
|
|
74
|
-
# Get
|
|
74
|
+
# Get brief snapshot (default — fast, minimal output)
|
|
75
75
|
SNAPSHOT=$(agent-slack snapshot)
|
|
76
76
|
|
|
77
77
|
# Extract key information
|
|
78
78
|
WORKSPACE_NAME=$(echo "$SNAPSHOT" | jq -r '.workspace.name')
|
|
79
79
|
CHANNEL_COUNT=$(echo "$SNAPSHOT" | jq -r '.channels | length')
|
|
80
|
-
USER_COUNT=$(echo "$SNAPSHOT" | jq -r '.users | length')
|
|
81
80
|
|
|
82
81
|
echo "Workspace: $WORKSPACE_NAME"
|
|
83
82
|
echo "Channels: $CHANNEL_COUNT"
|
|
84
|
-
echo "Users: $USER_COUNT"
|
|
85
83
|
|
|
86
84
|
# List all channels
|
|
87
85
|
echo -e "\nChannels:"
|
|
88
86
|
echo "$SNAPSHOT" | jq -r '.channels[] | " \(.name) (\(.id))"'
|
|
89
87
|
|
|
90
|
-
#
|
|
91
|
-
|
|
92
|
-
echo "$SNAPSHOT" | jq -r '.recent_messages[] | " \(.channel_name): \(.text[0:50])"'
|
|
88
|
+
# Then drill into specific channels for messages
|
|
89
|
+
agent-slack message list general --limit 10
|
|
93
90
|
```
|
|
94
91
|
|
|
95
|
-
**When to use**: Initial context gathering, status reports, workspace summaries.
|
|
92
|
+
**When to use**: Initial context gathering, status reports, workspace summaries. Start with brief snapshot, then use targeted commands for details.
|
|
96
93
|
|
|
97
94
|
## Pattern 4: Thread Conversation
|
|
98
95
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-teams
|
|
3
3
|
description: Interact with Microsoft Teams - send messages, read channels, manage reactions
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.9.0
|
|
5
5
|
allowed-tools: Bash(agent-teams:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -262,21 +262,30 @@ agent-teams file info <team-id> <channel-id> <file-id>
|
|
|
262
262
|
|
|
263
263
|
### Snapshot Command
|
|
264
264
|
|
|
265
|
-
Get
|
|
265
|
+
Get team overview for AI agents (brief by default):
|
|
266
266
|
|
|
267
267
|
```bash
|
|
268
|
-
#
|
|
268
|
+
# Brief snapshot (default) — fast, minimal API calls
|
|
269
269
|
agent-teams snapshot
|
|
270
270
|
|
|
271
|
-
#
|
|
272
|
-
agent-teams snapshot --
|
|
273
|
-
agent-teams snapshot --users-only
|
|
271
|
+
# Full snapshot — includes messages and members (slow, large output)
|
|
272
|
+
agent-teams snapshot --full
|
|
274
273
|
|
|
275
|
-
#
|
|
276
|
-
agent-teams snapshot --
|
|
274
|
+
# Filtered full snapshots
|
|
275
|
+
agent-teams snapshot --full --channels-only
|
|
276
|
+
agent-teams snapshot --full --users-only
|
|
277
|
+
|
|
278
|
+
# Limit messages per channel (only with --full)
|
|
279
|
+
agent-teams snapshot --full --limit 10
|
|
277
280
|
```
|
|
278
281
|
|
|
279
|
-
|
|
282
|
+
Default returns brief JSON with:
|
|
283
|
+
|
|
284
|
+
- Team metadata (id, name)
|
|
285
|
+
- Channels (id, name)
|
|
286
|
+
- Hint for next commands
|
|
287
|
+
|
|
288
|
+
With `--full`, returns comprehensive JSON with:
|
|
280
289
|
|
|
281
290
|
- Team metadata (id, name)
|
|
282
291
|
- Channels (id, name, type, description)
|
|
@@ -127,28 +127,30 @@ done
|
|
|
127
127
|
# Ensure fresh token
|
|
128
128
|
agent-teams auth extract 2>/dev/null || true
|
|
129
129
|
|
|
130
|
-
# Get
|
|
130
|
+
# Get brief snapshot (default — fast, minimal output)
|
|
131
131
|
SNAPSHOT=$(agent-teams snapshot)
|
|
132
132
|
|
|
133
133
|
# Extract key information
|
|
134
134
|
TEAM_NAME=$(echo "$SNAPSHOT" | jq -r '.team.name // "Unknown"')
|
|
135
135
|
CHANNEL_COUNT=$(echo "$SNAPSHOT" | jq -r '.channels | length')
|
|
136
|
-
MEMBER_COUNT=$(echo "$SNAPSHOT" | jq -r '.members | length')
|
|
137
136
|
|
|
138
137
|
echo "Team: $TEAM_NAME"
|
|
139
138
|
echo "Channels: $CHANNEL_COUNT"
|
|
140
|
-
echo "Members: $MEMBER_COUNT"
|
|
141
139
|
|
|
142
140
|
# List all channels
|
|
143
141
|
echo -e "\nChannels:"
|
|
144
142
|
echo "$SNAPSHOT" | jq -r '.channels[] | " #\(.name) (\(.id))"'
|
|
145
143
|
|
|
146
|
-
#
|
|
147
|
-
echo -
|
|
148
|
-
echo "$SNAPSHOT" | jq -r '.
|
|
144
|
+
# Then drill into a specific channel for recent activity
|
|
145
|
+
CHANNEL_ID=$(echo "$SNAPSHOT" | jq -r '.channels[0].id // empty')
|
|
146
|
+
TEAM_ID=$(echo "$SNAPSHOT" | jq -r '.team.id // empty')
|
|
147
|
+
if [ -n "$TEAM_ID" ] && [ -n "$CHANNEL_ID" ]; then
|
|
148
|
+
echo -e "\nRecent messages:"
|
|
149
|
+
agent-teams message list "$TEAM_ID" "$CHANNEL_ID" --limit 10
|
|
150
|
+
fi
|
|
149
151
|
```
|
|
150
152
|
|
|
151
|
-
**When to use**: Initial context gathering, status reports, team summaries.
|
|
153
|
+
**When to use**: Initial context gathering, status reports, team summaries. Start with brief snapshot, then use `message list <team-id> <channel-id>` or `member list <team-id>` for details.
|
|
152
154
|
|
|
153
155
|
## Pattern 4: Find Channel by Name
|
|
154
156
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agent-webex
|
|
3
3
|
description: Interact with Cisco Webex - send messages, read spaces, manage memberships
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.9.0
|
|
5
5
|
allowed-tools: Bash(agent-webex:*)
|
|
6
6
|
metadata:
|
|
7
7
|
openclaw:
|
|
@@ -247,15 +247,24 @@ agent-webex member list <space-id> --limit 100
|
|
|
247
247
|
|
|
248
248
|
### Snapshot Command
|
|
249
249
|
|
|
250
|
-
Get workspace
|
|
250
|
+
Get workspace overview for AI agents (brief by default):
|
|
251
251
|
|
|
252
252
|
```bash
|
|
253
|
+
# Brief snapshot (default) — fast, minimal output
|
|
253
254
|
agent-webex snapshot
|
|
255
|
+
|
|
256
|
+
# Full snapshot — includes type and lastActivity
|
|
257
|
+
agent-webex snapshot --full
|
|
254
258
|
```
|
|
255
259
|
|
|
256
|
-
|
|
260
|
+
Default returns brief JSON with:
|
|
261
|
+
|
|
262
|
+
- Spaces (id, title) — only spaces you're a member of
|
|
263
|
+
- Hint for next commands
|
|
264
|
+
|
|
265
|
+
With `--full`, returns:
|
|
257
266
|
|
|
258
|
-
- Spaces (id, title, type, lastActivity)
|
|
267
|
+
- Spaces (id, title, type, lastActivity)
|
|
259
268
|
|
|
260
269
|
For messages or members, use `message list <space-id>` or `member list <space-id>`.
|
|
261
270
|
|
|
@@ -336,10 +336,16 @@ SPACE_COUNT=$(echo "$SNAPSHOT" | jq -r '.spaces | length')
|
|
|
336
336
|
echo "Total spaces: $SPACE_COUNT"
|
|
337
337
|
|
|
338
338
|
# List all spaces
|
|
339
|
-
echo "$SNAPSHOT" | jq -r '.spaces[] | " \(.title) (\(.
|
|
339
|
+
echo "$SNAPSHOT" | jq -r '.spaces[] | " \(.title) (\(.id))"'
|
|
340
|
+
|
|
341
|
+
# Then drill into a specific space for details
|
|
342
|
+
SPACE_ID=$(echo "$SNAPSHOT" | jq -r '.spaces[0].id // empty')
|
|
343
|
+
if [ -n "$SPACE_ID" ]; then
|
|
344
|
+
agent-webex message list "$SPACE_ID" --limit 10
|
|
345
|
+
fi
|
|
340
346
|
```
|
|
341
347
|
|
|
342
|
-
**When to use**: Quick workspace overview to discover space IDs and titles.
|
|
348
|
+
**When to use**: Quick workspace overview to discover space IDs and titles. Start with brief snapshot, then use `message list <space-id>` or `member list <space-id>` for details.
|
|
343
349
|
|
|
344
350
|
## Pipeline Patterns
|
|
345
351
|
|
|
@@ -81,9 +81,54 @@ describe('snapshot command', () => {
|
|
|
81
81
|
mockListUserChats.mockClear()
|
|
82
82
|
})
|
|
83
83
|
|
|
84
|
-
test('returns workspace,
|
|
84
|
+
test('brief snapshot returns workspace, groups (name only), chat counts, and hint', async () => {
|
|
85
85
|
const result = await snapshotAction()
|
|
86
86
|
|
|
87
|
+
expect(result.error).toBeUndefined()
|
|
88
|
+
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
89
|
+
expect(result.groups).toEqual([
|
|
90
|
+
{ id: 'grp-1', name: 'Support' },
|
|
91
|
+
{ id: 'grp-2', name: 'Sales' },
|
|
92
|
+
])
|
|
93
|
+
expect(result.user_chats).toEqual({
|
|
94
|
+
total: 4,
|
|
95
|
+
by_state: { opened: 2, snoozed: 1, closed: 1 },
|
|
96
|
+
})
|
|
97
|
+
expect(result.hint).toBeDefined()
|
|
98
|
+
expect(result.managers).toBeUndefined()
|
|
99
|
+
expect(result.bots).toBeUndefined()
|
|
100
|
+
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('brief groups-only returns group names without messages', async () => {
|
|
104
|
+
const result = await snapshotAction({ groupsOnly: true })
|
|
105
|
+
|
|
106
|
+
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
107
|
+
expect(result.groups).toHaveLength(2)
|
|
108
|
+
expect(result.groups?.[0]).toEqual({ id: 'grp-1', name: 'Support' })
|
|
109
|
+
expect(result.hint).toBeDefined()
|
|
110
|
+
expect(result.user_chats).toBeUndefined()
|
|
111
|
+
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
112
|
+
expect(mockListUserChats).not.toHaveBeenCalled()
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
test('brief chats-only returns counts without recent details', async () => {
|
|
116
|
+
const result = await snapshotAction({ chatsOnly: true })
|
|
117
|
+
|
|
118
|
+
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
119
|
+
expect(result.groups).toBeUndefined()
|
|
120
|
+
expect(result.user_chats).toEqual({
|
|
121
|
+
total: 4,
|
|
122
|
+
by_state: { opened: 2, snoozed: 1, closed: 1 },
|
|
123
|
+
})
|
|
124
|
+
expect(result.hint).toBeDefined()
|
|
125
|
+
expect(mockListGroups).not.toHaveBeenCalled()
|
|
126
|
+
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
test('full snapshot returns workspace, managers, bots, groups, and user chats', async () => {
|
|
130
|
+
const result = await snapshotAction({ full: true })
|
|
131
|
+
|
|
87
132
|
expect(result.error).toBeUndefined()
|
|
88
133
|
expect(result).toEqual({
|
|
89
134
|
workspace: { id: 'ws-1', name: 'Workspace One' },
|
|
@@ -156,19 +201,21 @@ describe('snapshot command', () => {
|
|
|
156
201
|
})
|
|
157
202
|
})
|
|
158
203
|
|
|
159
|
-
test('groups-only
|
|
160
|
-
const result = await snapshotAction({ groupsOnly: true })
|
|
204
|
+
test('full groups-only includes messages', async () => {
|
|
205
|
+
const result = await snapshotAction({ full: true, groupsOnly: true, limit: 3 })
|
|
161
206
|
|
|
162
|
-
expect(
|
|
163
|
-
expect(
|
|
164
|
-
expect(result.
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
207
|
+
expect(mockGetGroupMessages).toHaveBeenCalledWith('ws-1', 'grp-1', { limit: 3, sortOrder: 'desc' })
|
|
208
|
+
expect(mockGetGroupMessages).toHaveBeenCalledWith('ws-1', 'grp-2', { limit: 3, sortOrder: 'desc' })
|
|
209
|
+
expect(result.groups?.[0].recent_messages?.[0]).toEqual({
|
|
210
|
+
id: 'grp-1-msg-1',
|
|
211
|
+
person_type: 'manager',
|
|
212
|
+
plain_text: 'Message for grp-1',
|
|
213
|
+
created_at: 1000,
|
|
214
|
+
})
|
|
168
215
|
})
|
|
169
216
|
|
|
170
|
-
test('chats-only
|
|
171
|
-
const result = await snapshotAction({ chatsOnly: true, limit: 1 })
|
|
217
|
+
test('full chats-only includes recent details', async () => {
|
|
218
|
+
const result = await snapshotAction({ full: true, chatsOnly: true, limit: 1 })
|
|
172
219
|
|
|
173
220
|
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
174
221
|
expect(result.groups).toBeUndefined()
|
|
@@ -189,20 +236,5 @@ describe('snapshot command', () => {
|
|
|
189
236
|
},
|
|
190
237
|
],
|
|
191
238
|
})
|
|
192
|
-
expect(mockListGroups).not.toHaveBeenCalled()
|
|
193
|
-
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
194
|
-
})
|
|
195
|
-
|
|
196
|
-
test('includes recent messages for each group with requested limit', async () => {
|
|
197
|
-
const result = await snapshotAction({ groupsOnly: true, limit: 3 })
|
|
198
|
-
|
|
199
|
-
expect(mockGetGroupMessages).toHaveBeenCalledWith('ws-1', 'grp-1', { limit: 3, sortOrder: 'desc' })
|
|
200
|
-
expect(mockGetGroupMessages).toHaveBeenCalledWith('ws-1', 'grp-2', { limit: 3, sortOrder: 'desc' })
|
|
201
|
-
expect(result.groups?.[0].recent_messages[0]).toEqual({
|
|
202
|
-
id: 'grp-1-msg-1',
|
|
203
|
-
person_type: 'manager',
|
|
204
|
-
plain_text: 'Message for grp-1',
|
|
205
|
-
created_at: 1000,
|
|
206
|
-
})
|
|
207
239
|
})
|
|
208
240
|
})
|
|
@@ -10,6 +10,7 @@ interface SnapshotOptions {
|
|
|
10
10
|
pretty?: boolean
|
|
11
11
|
groupsOnly?: boolean
|
|
12
12
|
chatsOnly?: boolean
|
|
13
|
+
full?: boolean
|
|
13
14
|
limit?: number | string
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -33,7 +34,7 @@ interface SnapshotResult {
|
|
|
33
34
|
groups?: Array<{
|
|
34
35
|
id: string
|
|
35
36
|
name: string
|
|
36
|
-
recent_messages
|
|
37
|
+
recent_messages?: Array<{
|
|
37
38
|
id: string
|
|
38
39
|
person_type?: string
|
|
39
40
|
plain_text?: string
|
|
@@ -43,7 +44,7 @@ interface SnapshotResult {
|
|
|
43
44
|
user_chats?: {
|
|
44
45
|
total: number
|
|
45
46
|
by_state: Record<string, number>
|
|
46
|
-
recent
|
|
47
|
+
recent?: Array<{
|
|
47
48
|
id: string
|
|
48
49
|
state?: string
|
|
49
50
|
assignee_id?: string
|
|
@@ -51,6 +52,7 @@ interface SnapshotResult {
|
|
|
51
52
|
updated_at?: number
|
|
52
53
|
}>
|
|
53
54
|
}
|
|
55
|
+
hint?: string
|
|
54
56
|
error?: string
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -58,7 +60,6 @@ export async function snapshotAction(options: SnapshotOptions = {}): Promise<Sna
|
|
|
58
60
|
try {
|
|
59
61
|
const client = await getClient(options)
|
|
60
62
|
const workspaceId = await getCurrentWorkspaceId(options)
|
|
61
|
-
const limit = parseLimit(options.limit)
|
|
62
63
|
|
|
63
64
|
const channel = await client.getChannel(workspaceId)
|
|
64
65
|
const workspace = {
|
|
@@ -66,42 +67,114 @@ export async function snapshotAction(options: SnapshotOptions = {}): Promise<Sna
|
|
|
66
67
|
name: channel.name,
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
if (options.
|
|
70
|
-
|
|
71
|
-
return { workspace, groups }
|
|
70
|
+
if (options.full) {
|
|
71
|
+
return buildFullSnapshot(client, workspaceId, workspace, options)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
return buildBriefSnapshot(client, workspaceId, workspace, options)
|
|
75
|
+
} catch (error) {
|
|
76
|
+
return { error: (error as Error).message }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async function buildBriefSnapshot(
|
|
81
|
+
client: Awaited<ReturnType<typeof getClient>>,
|
|
82
|
+
workspaceId: string,
|
|
83
|
+
workspace: { id: string; name: string },
|
|
84
|
+
options: SnapshotOptions,
|
|
85
|
+
): Promise<SnapshotResult> {
|
|
86
|
+
if (options.groupsOnly) {
|
|
87
|
+
const groups = await client.listGroups(workspaceId, { limit: 20 })
|
|
88
|
+
return {
|
|
89
|
+
workspace,
|
|
90
|
+
groups: groups.map((g) => ({ id: g.id, name: g.name })),
|
|
91
|
+
hint: "Use 'group messages <group>' for messages.",
|
|
77
92
|
}
|
|
93
|
+
}
|
|
78
94
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
client.
|
|
82
|
-
|
|
83
|
-
|
|
95
|
+
if (options.chatsOnly) {
|
|
96
|
+
const [openedChats, snoozedChats, closedChats] = await Promise.all([
|
|
97
|
+
client.listUserChats(workspaceId, { state: 'opened', limit: 100 }),
|
|
98
|
+
client.listUserChats(workspaceId, { state: 'snoozed', limit: 100 }),
|
|
99
|
+
client.listUserChats(workspaceId, { state: 'closed', limit: 100 }),
|
|
84
100
|
])
|
|
85
|
-
|
|
86
101
|
return {
|
|
87
102
|
workspace,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
name: bot.name,
|
|
98
|
-
avatar_url: bot.avatarUrl,
|
|
99
|
-
})),
|
|
100
|
-
groups,
|
|
101
|
-
user_chats: userChats,
|
|
103
|
+
user_chats: {
|
|
104
|
+
total: openedChats.length + snoozedChats.length + closedChats.length,
|
|
105
|
+
by_state: {
|
|
106
|
+
opened: openedChats.length,
|
|
107
|
+
snoozed: snoozedChats.length,
|
|
108
|
+
closed: closedChats.length,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
hint: "Use 'chat list --state opened' for chat details, 'chat messages <chat>' for messages.",
|
|
102
112
|
}
|
|
103
|
-
}
|
|
104
|
-
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const [groups, openedChats, snoozedChats, closedChats] = await Promise.all([
|
|
116
|
+
client.listGroups(workspaceId, { limit: 20 }),
|
|
117
|
+
client.listUserChats(workspaceId, { state: 'opened', limit: 100 }),
|
|
118
|
+
client.listUserChats(workspaceId, { state: 'snoozed', limit: 100 }),
|
|
119
|
+
client.listUserChats(workspaceId, { state: 'closed', limit: 100 }),
|
|
120
|
+
])
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
workspace,
|
|
124
|
+
groups: groups.map((g) => ({ id: g.id, name: g.name })),
|
|
125
|
+
user_chats: {
|
|
126
|
+
total: openedChats.length + snoozedChats.length + closedChats.length,
|
|
127
|
+
by_state: {
|
|
128
|
+
opened: openedChats.length,
|
|
129
|
+
snoozed: snoozedChats.length,
|
|
130
|
+
closed: closedChats.length,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
hint: "Use 'group messages <group>' for group messages, 'chat list --state opened' for chats, 'manager list' for managers.",
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function buildFullSnapshot(
|
|
138
|
+
client: Awaited<ReturnType<typeof getClient>>,
|
|
139
|
+
workspaceId: string,
|
|
140
|
+
workspace: { id: string; name: string },
|
|
141
|
+
options: SnapshotOptions,
|
|
142
|
+
): Promise<SnapshotResult> {
|
|
143
|
+
const limit = parseLimit(options.limit)
|
|
144
|
+
|
|
145
|
+
if (options.groupsOnly) {
|
|
146
|
+
const groups = await buildGroupsSnapshot(client, workspaceId, limit)
|
|
147
|
+
return { workspace, groups }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (options.chatsOnly) {
|
|
151
|
+
const userChats = await buildUserChatsSnapshot(client, workspaceId, limit)
|
|
152
|
+
return { workspace, user_chats: userChats }
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const [managers, bots, groups, userChats] = await Promise.all([
|
|
156
|
+
client.listManagers(workspaceId, { limit: 50 }),
|
|
157
|
+
client.listBots(workspaceId, { limit: 50 }),
|
|
158
|
+
buildGroupsSnapshot(client, workspaceId, limit),
|
|
159
|
+
buildUserChatsSnapshot(client, workspaceId, limit),
|
|
160
|
+
])
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
workspace,
|
|
164
|
+
managers: managers.map((manager) => ({
|
|
165
|
+
id: manager.id,
|
|
166
|
+
name: manager.name,
|
|
167
|
+
email: manager.email,
|
|
168
|
+
account_id: manager.accountId,
|
|
169
|
+
role_id: manager.roleId,
|
|
170
|
+
})),
|
|
171
|
+
bots: bots.map((bot) => ({
|
|
172
|
+
id: bot.id,
|
|
173
|
+
name: bot.name,
|
|
174
|
+
avatar_url: bot.avatarUrl,
|
|
175
|
+
})),
|
|
176
|
+
groups,
|
|
177
|
+
user_chats: userChats,
|
|
105
178
|
}
|
|
106
179
|
}
|
|
107
180
|
|
|
@@ -178,10 +251,11 @@ function cliOutput(result: SnapshotResult, pretty?: boolean): void {
|
|
|
178
251
|
|
|
179
252
|
export function createSnapshotCommand(): Command {
|
|
180
253
|
return new Command('snapshot')
|
|
181
|
-
.description('Workspace overview for AI
|
|
254
|
+
.description('Workspace overview for AI agents (brief by default, use --full for comprehensive data)')
|
|
255
|
+
.option('--full', 'Include messages, managers, and bots (verbose)')
|
|
182
256
|
.option('--groups-only', 'List groups only, skip user chats')
|
|
183
257
|
.option('--chats-only', 'List user chats only, skip groups')
|
|
184
|
-
.option('--limit <n>', 'Messages per group and recent opened chats', '5')
|
|
258
|
+
.option('--limit <n>', 'Messages per group and recent opened chats with --full', '5')
|
|
185
259
|
.option('--workspace <id>', 'Workspace ID')
|
|
186
260
|
.option('--pretty', 'Pretty print JSON output')
|
|
187
261
|
.action(async (options: SnapshotOptions) => {
|