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.
Files changed (78) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/dist/package.json +1 -1
  3. package/dist/src/platforms/channeltalk/cli.js +1 -1
  4. package/dist/src/platforms/channeltalk/cli.js.map +1 -1
  5. package/dist/src/platforms/channeltalk/client.js +1 -1
  6. package/dist/src/platforms/channeltalk/client.js.map +1 -1
  7. package/dist/src/platforms/channeltalk/commands/auth.d.ts +2 -0
  8. package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
  9. package/dist/src/platforms/channeltalk/commands/auth.js +9 -3
  10. package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
  11. package/dist/src/platforms/discord/client.js +1 -1
  12. package/dist/src/platforms/discord/client.js.map +1 -1
  13. package/dist/src/platforms/discord/commands/auth.d.ts +1 -0
  14. package/dist/src/platforms/discord/commands/auth.d.ts.map +1 -1
  15. package/dist/src/platforms/discord/commands/auth.js +6 -3
  16. package/dist/src/platforms/discord/commands/auth.js.map +1 -1
  17. package/dist/src/platforms/slack/cli.js +1 -1
  18. package/dist/src/platforms/slack/cli.js.map +1 -1
  19. package/dist/src/platforms/slack/client.js +1 -1
  20. package/dist/src/platforms/slack/client.js.map +1 -1
  21. package/dist/src/platforms/slack/commands/auth.d.ts +1 -0
  22. package/dist/src/platforms/slack/commands/auth.d.ts.map +1 -1
  23. package/dist/src/platforms/slack/commands/auth.js +8 -5
  24. package/dist/src/platforms/slack/commands/auth.js.map +1 -1
  25. package/dist/src/platforms/teams/client.js +1 -1
  26. package/dist/src/platforms/teams/client.js.map +1 -1
  27. package/dist/src/platforms/teams/commands/auth.d.ts +1 -0
  28. package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
  29. package/dist/src/platforms/teams/commands/auth.js +12 -7
  30. package/dist/src/platforms/teams/commands/auth.js.map +1 -1
  31. package/dist/src/platforms/webex/client.d.ts +3 -0
  32. package/dist/src/platforms/webex/client.d.ts.map +1 -1
  33. package/dist/src/platforms/webex/client.js +6 -0
  34. package/dist/src/platforms/webex/client.js.map +1 -1
  35. package/dist/src/platforms/webex/commands/snapshot.d.ts +0 -3
  36. package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
  37. package/dist/src/platforms/webex/commands/snapshot.js +9 -47
  38. package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
  39. package/docs/content/docs/cli/webex.mdx +3 -11
  40. package/package.json +1 -1
  41. package/skills/agent-channeltalk/SKILL.md +3 -3
  42. package/skills/agent-channeltalk/references/authentication.md +3 -3
  43. package/skills/agent-channeltalk/templates/monitor-chat.sh +1 -1
  44. package/skills/agent-channeltalk/templates/post-message.sh +2 -2
  45. package/skills/agent-channeltalk/templates/workspace-summary.sh +1 -1
  46. package/skills/agent-channeltalkbot/SKILL.md +1 -1
  47. package/skills/agent-discord/SKILL.md +1 -1
  48. package/skills/agent-discordbot/SKILL.md +1 -1
  49. package/skills/agent-instagram/SKILL.md +1 -1
  50. package/skills/agent-kakaotalk/SKILL.md +1 -1
  51. package/skills/agent-line/SKILL.md +1 -1
  52. package/skills/agent-slack/SKILL.md +1 -1
  53. package/skills/agent-slack/references/authentication.md +3 -3
  54. package/skills/agent-slackbot/SKILL.md +1 -1
  55. package/skills/agent-teams/SKILL.md +1 -1
  56. package/skills/agent-telegram/SKILL.md +1 -1
  57. package/skills/agent-webex/SKILL.md +6 -14
  58. package/skills/agent-webex/references/common-patterns.md +3 -32
  59. package/skills/agent-wechatbot/SKILL.md +1 -1
  60. package/skills/agent-whatsapp/SKILL.md +1 -1
  61. package/skills/agent-whatsappbot/SKILL.md +1 -1
  62. package/src/platforms/channeltalk/cli.ts +1 -1
  63. package/src/platforms/channeltalk/client.ts +1 -1
  64. package/src/platforms/channeltalk/commands/auth.test.ts +4 -2
  65. package/src/platforms/channeltalk/commands/auth.ts +11 -3
  66. package/src/platforms/discord/client.ts +1 -1
  67. package/src/platforms/discord/commands/auth.test.ts +5 -0
  68. package/src/platforms/discord/commands/auth.ts +7 -3
  69. package/src/platforms/slack/cli.ts +1 -1
  70. package/src/platforms/slack/client.ts +1 -1
  71. package/src/platforms/slack/commands/auth.test.ts +31 -6
  72. package/src/platforms/slack/commands/auth.ts +9 -5
  73. package/src/platforms/teams/client.ts +1 -1
  74. package/src/platforms/teams/commands/auth.test.ts +5 -0
  75. package/src/platforms/teams/commands/auth.ts +14 -7
  76. package/src/platforms/webex/client.ts +10 -0
  77. package/src/platforms/webex/commands/snapshot.test.ts +13 -41
  78. 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 mockMessages = [
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 mockListMessages = mock(() => Promise.resolve(mockMessages as any))
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
- listMessages: mockListMessages,
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
- mockListMessages.mockReset().mockImplementation(() => Promise.resolve(mockMessages as any))
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('full snapshot includes spaces, recent_messages, members', async () => {
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).toBeDefined()
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.recent_messages).toBeDefined()
72
- expect(output.recent_messages[0].id).toBe('msg-1')
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('--members-only includes only members (no spaces, no messages)', async () => {
89
- await snapshotAction({ membersOnly: true })
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).toBeUndefined()
94
- expect(output.recent_messages).toBeUndefined()
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
- if (!options.membersOnly) {
20
- const spaces = await client.listSpaces({ max: 50 })
21
- snapshot.spaces = spaces.map((s) => ({
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 comprehensive workspace state for AI agents')
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
  })