agent-messenger 2.6.1 → 2.6.3
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/dist/package.json +1 -1
- package/dist/src/platforms/channeltalk/cli.js +1 -1
- package/dist/src/platforms/channeltalk/cli.js.map +1 -1
- package/dist/src/platforms/channeltalk/client.js +1 -1
- package/dist/src/platforms/channeltalk/client.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts +2 -0
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js +9 -3
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/client.js +1 -1
- package/dist/src/platforms/discord/client.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.d.ts +1 -0
- package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js +6 -3
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/slack/cli.js +1 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client.js +1 -1
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/auth.d.ts +1 -0
- package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/auth.js +8 -5
- package/dist/src/platforms/slack/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/client.js +1 -1
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts +1 -0
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +12 -7
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/client.d.ts +3 -0
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +6 -0
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.d.ts +0 -3
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.js +9 -47
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
- package/docs/content/docs/cli/webex.mdx +3 -11
- package/package.json +1 -1
- package/skills/agent-channeltalk/SKILL.md +3 -3
- package/skills/agent-channeltalk/references/authentication.md +3 -3
- package/skills/agent-channeltalk/templates/monitor-chat.sh +1 -1
- package/skills/agent-channeltalk/templates/post-message.sh +2 -2
- package/skills/agent-channeltalk/templates/workspace-summary.sh +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-slack/references/authentication.md +3 -3
- 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 +6 -14
- package/skills/agent-webex/references/common-patterns.md +3 -32
- 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/cli.ts +1 -1
- package/src/platforms/channeltalk/client.ts +1 -1
- package/src/platforms/channeltalk/commands/auth.test.ts +4 -2
- package/src/platforms/channeltalk/commands/auth.ts +11 -3
- package/src/platforms/discord/client.ts +1 -1
- package/src/platforms/discord/commands/auth.test.ts +5 -0
- package/src/platforms/discord/commands/auth.ts +7 -3
- package/src/platforms/slack/cli.ts +1 -1
- package/src/platforms/slack/client.ts +1 -1
- package/src/platforms/slack/commands/auth.test.ts +31 -6
- package/src/platforms/slack/commands/auth.ts +9 -5
- package/src/platforms/teams/client.ts +1 -1
- package/src/platforms/teams/commands/auth.test.ts +5 -0
- package/src/platforms/teams/commands/auth.ts +14 -7
- package/src/platforms/webex/client.ts +10 -0
- package/src/platforms/webex/commands/snapshot.test.ts +13 -41
- package/src/platforms/webex/commands/snapshot.ts +10 -61
|
@@ -11,24 +11,19 @@ mock.module('@/shared/utils/error-handler', () => ({
|
|
|
11
11
|
|
|
12
12
|
const mockSpaces = [
|
|
13
13
|
{ id: 'space-1', title: 'General', type: 'group', isLocked: false, lastActivity: '2024-01-15T00:00:00.000Z', created: '2024-01-01T00:00:00.000Z', creatorId: 'person-1' },
|
|
14
|
+
{ id: 'space-2', title: 'Random', type: 'group', isLocked: false, lastActivity: '2024-01-14T00:00:00.000Z', created: '2024-01-01T00:00:00.000Z', creatorId: 'person-1' },
|
|
14
15
|
]
|
|
15
16
|
|
|
16
|
-
const
|
|
17
|
-
{ id: 'msg-1', roomId: 'space-1', roomType: 'group', text: 'Hello', personId: 'person-1', personEmail: 'alice@example.com', created: '2024-01-15T00:00:00.000Z' },
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
const mockMembers = [
|
|
17
|
+
const mockMyMemberships = [
|
|
21
18
|
{ id: 'mem-1', roomId: 'space-1', personId: 'person-1', personEmail: 'alice@example.com', personDisplayName: 'Alice', isModerator: true, created: '2024-01-01T00:00:00.000Z' },
|
|
22
19
|
]
|
|
23
20
|
|
|
24
21
|
const mockListSpaces = mock(() => Promise.resolve(mockSpaces as any))
|
|
25
|
-
const
|
|
26
|
-
const mockListMemberships = mock(() => Promise.resolve(mockMembers as any))
|
|
22
|
+
const mockListMyMemberships = mock(() => Promise.resolve(mockMyMemberships as any))
|
|
27
23
|
|
|
28
24
|
const mockClient = {
|
|
29
25
|
listSpaces: mockListSpaces,
|
|
30
|
-
|
|
31
|
-
listMemberships: mockListMemberships,
|
|
26
|
+
listMyMemberships: mockListMyMemberships,
|
|
32
27
|
}
|
|
33
28
|
|
|
34
29
|
const mockLogin = mock(() => Promise.resolve(mockClient))
|
|
@@ -46,8 +41,7 @@ describe('snapshot command', () => {
|
|
|
46
41
|
|
|
47
42
|
beforeEach(() => {
|
|
48
43
|
mockListSpaces.mockReset().mockImplementation(() => Promise.resolve(mockSpaces as any))
|
|
49
|
-
|
|
50
|
-
mockListMemberships.mockReset().mockImplementation(() => Promise.resolve(mockMembers as any))
|
|
44
|
+
mockListMyMemberships.mockReset().mockImplementation(() => Promise.resolve(mockMyMemberships as any))
|
|
51
45
|
mockLogin.mockReset().mockImplementation(() => Promise.resolve(mockClient))
|
|
52
46
|
mockHandleError.mockReset().mockImplementation((err: Error) => {
|
|
53
47
|
throw err
|
|
@@ -60,40 +54,24 @@ describe('snapshot command', () => {
|
|
|
60
54
|
consoleSpy.mockRestore()
|
|
61
55
|
})
|
|
62
56
|
|
|
63
|
-
test('
|
|
57
|
+
test('returns spaces with id, title, type, lastActivity', async () => {
|
|
64
58
|
await snapshotAction({})
|
|
65
59
|
|
|
66
60
|
expect(consoleSpy).toHaveBeenCalled()
|
|
67
61
|
const output = JSON.parse(consoleSpy.mock.calls[consoleSpy.mock.calls.length - 1][0])
|
|
68
|
-
expect(output.spaces).
|
|
62
|
+
expect(output.spaces).toHaveLength(1)
|
|
69
63
|
expect(output.spaces[0].id).toBe('space-1')
|
|
70
64
|
expect(output.spaces[0].title).toBe('General')
|
|
71
|
-
expect(output.
|
|
72
|
-
expect(output.
|
|
73
|
-
expect(output.recent_messages[0].author).toBe('alice@example.com')
|
|
74
|
-
expect(output.members).toBeDefined()
|
|
75
|
-
expect(output.members[0].personEmail).toBe('alice@example.com')
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
test('--spaces-only includes only spaces (no messages, no members)', async () => {
|
|
79
|
-
await snapshotAction({ spacesOnly: true })
|
|
80
|
-
|
|
81
|
-
expect(consoleSpy).toHaveBeenCalled()
|
|
82
|
-
const output = JSON.parse(consoleSpy.mock.calls[consoleSpy.mock.calls.length - 1][0])
|
|
83
|
-
expect(output.spaces).toBeDefined()
|
|
84
|
-
expect(output.recent_messages).toBeUndefined()
|
|
85
|
-
expect(output.members).toBeUndefined()
|
|
65
|
+
expect(output.spaces[0].type).toBe('group')
|
|
66
|
+
expect(output.spaces[0].lastActivity).toBe('2024-01-15T00:00:00.000Z')
|
|
86
67
|
})
|
|
87
68
|
|
|
88
|
-
test('
|
|
89
|
-
await snapshotAction({
|
|
69
|
+
test('filters spaces to only those in my memberships', async () => {
|
|
70
|
+
await snapshotAction({})
|
|
90
71
|
|
|
91
|
-
expect(consoleSpy).toHaveBeenCalled()
|
|
92
72
|
const output = JSON.parse(consoleSpy.mock.calls[consoleSpy.mock.calls.length - 1][0])
|
|
93
|
-
expect(output.spaces).
|
|
94
|
-
expect(output.
|
|
95
|
-
expect(output.members).toBeDefined()
|
|
96
|
-
expect(output.members[0].personEmail).toBe('alice@example.com')
|
|
73
|
+
expect(output.spaces).toHaveLength(1)
|
|
74
|
+
expect(output.spaces[0].id).toBe('space-1')
|
|
97
75
|
})
|
|
98
76
|
|
|
99
77
|
test('not authenticated outputs error', async () => {
|
|
@@ -105,10 +83,4 @@ describe('snapshot command', () => {
|
|
|
105
83
|
|
|
106
84
|
expect(mockHandleError).toHaveBeenCalledWith(expect.any(WebexError))
|
|
107
85
|
})
|
|
108
|
-
|
|
109
|
-
test('passes limit option to listMessages', async () => {
|
|
110
|
-
await snapshotAction({ limit: 5 })
|
|
111
|
-
|
|
112
|
-
expect(mockListMessages).toHaveBeenCalledWith('space-1', { max: 5 })
|
|
113
|
-
})
|
|
114
86
|
})
|
|
@@ -1,72 +1,27 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
-
import { parallelMap } from '@/shared/utils/concurrency'
|
|
3
2
|
import { handleError } from '@/shared/utils/error-handler'
|
|
4
3
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
4
|
import { WebexClient } from '../client'
|
|
6
|
-
import type { WebexSpace } from '../types'
|
|
7
5
|
|
|
8
6
|
export async function snapshotAction(options: {
|
|
9
|
-
spacesOnly?: boolean
|
|
10
|
-
membersOnly?: boolean
|
|
11
|
-
limit?: number
|
|
12
7
|
pretty?: boolean
|
|
13
8
|
}): Promise<void> {
|
|
14
9
|
try {
|
|
15
10
|
const client = await new WebexClient().login()
|
|
16
|
-
const messageLimit = options.limit || 20
|
|
17
|
-
const snapshot: Record<string, unknown> = {}
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const myMemberships = await client.listMyMemberships({ max: 100 })
|
|
13
|
+
const myRoomIds = new Set(myMemberships.map((m) => m.roomId))
|
|
14
|
+
|
|
15
|
+
const allSpaces = await client.listSpaces({ max: 100 })
|
|
16
|
+
const spaces = allSpaces.filter((s) => myRoomIds.has(s.id))
|
|
17
|
+
|
|
18
|
+
const snapshot = {
|
|
19
|
+
spaces: spaces.map((s) => ({
|
|
22
20
|
id: s.id,
|
|
23
21
|
title: s.title,
|
|
24
22
|
type: s.type,
|
|
25
23
|
lastActivity: s.lastActivity,
|
|
26
|
-
}))
|
|
27
|
-
|
|
28
|
-
if (!options.spacesOnly) {
|
|
29
|
-
const spaceMessages = await parallelMap(
|
|
30
|
-
spaces,
|
|
31
|
-
async (space: WebexSpace) => {
|
|
32
|
-
const messages = await client.listMessages(space.id, { max: messageLimit })
|
|
33
|
-
return messages.map((msg) => ({
|
|
34
|
-
...msg,
|
|
35
|
-
space_title: space.title,
|
|
36
|
-
}))
|
|
37
|
-
},
|
|
38
|
-
5,
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
snapshot.recent_messages = spaceMessages.flat().map((msg) => ({
|
|
42
|
-
space_id: msg.roomId,
|
|
43
|
-
space_title: msg.space_title,
|
|
44
|
-
id: msg.id,
|
|
45
|
-
author: msg.personEmail,
|
|
46
|
-
text: msg.text || msg.markdown || '',
|
|
47
|
-
created: msg.created,
|
|
48
|
-
}))
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (!options.spacesOnly) {
|
|
53
|
-
// Get members for the first few spaces (avoid massive API calls)
|
|
54
|
-
const spaces = await client.listSpaces({ max: 10 })
|
|
55
|
-
const spaceMembers = await parallelMap(
|
|
56
|
-
spaces,
|
|
57
|
-
async (space: WebexSpace) => {
|
|
58
|
-
const members = await client.listMemberships(space.id, { max: 100 })
|
|
59
|
-
return members.map((m) => ({
|
|
60
|
-
space_id: space.id,
|
|
61
|
-
space_title: space.title,
|
|
62
|
-
personEmail: m.personEmail,
|
|
63
|
-
personDisplayName: m.personDisplayName,
|
|
64
|
-
isModerator: m.isModerator,
|
|
65
|
-
}))
|
|
66
|
-
},
|
|
67
|
-
5,
|
|
68
|
-
)
|
|
69
|
-
snapshot.members = spaceMembers.flat()
|
|
24
|
+
})),
|
|
70
25
|
}
|
|
71
26
|
|
|
72
27
|
console.log(formatOutput(snapshot, options.pretty))
|
|
@@ -76,16 +31,10 @@ export async function snapshotAction(options: {
|
|
|
76
31
|
}
|
|
77
32
|
|
|
78
33
|
export const snapshotCommand = new Command('snapshot')
|
|
79
|
-
.description('Get
|
|
80
|
-
.option('--spaces-only', 'Include only spaces (exclude messages and members)')
|
|
81
|
-
.option('--members-only', 'Include only members (exclude spaces and messages)')
|
|
82
|
-
.option('--limit <n>', 'Number of recent messages per space (default: 20)', '20')
|
|
34
|
+
.description('Get workspace spaces overview for AI agents')
|
|
83
35
|
.option('--pretty', 'Pretty print JSON output')
|
|
84
36
|
.action(async (options) => {
|
|
85
37
|
await snapshotAction({
|
|
86
|
-
spacesOnly: options.spacesOnly,
|
|
87
|
-
membersOnly: options.membersOnly,
|
|
88
|
-
limit: parseInt(options.limit, 10),
|
|
89
38
|
pretty: options.pretty,
|
|
90
39
|
})
|
|
91
40
|
})
|