agent-messenger 2.19.0 → 2.19.1
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/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +51 -1
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/package.json +1 -1
- 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-telegrambot/SKILL.md +1 -1
- package/skills/agent-webex/SKILL.md +1 -1
- 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/kakaotalk/client.test.ts +39 -0
- package/src/platforms/kakaotalk/client.ts +59 -1
- package/src/platforms/webex/commands/auth.test.ts +8 -2
- package/src/platforms/webex/commands/member.test.ts +29 -27
- package/src/platforms/webex/commands/message.test.ts +36 -38
- package/src/platforms/webex/commands/snapshot.test.ts +25 -26
- package/src/platforms/webex/commands/space.test.ts +31 -29
- package/src/platforms/webex/commands/whoami.test.ts +3 -1
- package/src/platforms/webex/credential-manager.test.ts +3 -0
- package/src/platforms/whatsapp/commands/auth.test.ts +14 -20
- package/src/platforms/whatsapp/commands/chat.test.ts +17 -24
- package/src/platforms/whatsapp/commands/message.test.ts +31 -41
|
@@ -2,12 +2,6 @@ import { afterEach, beforeEach, describe, expect, mock, spyOn, it } from 'bun:te
|
|
|
2
2
|
|
|
3
3
|
const originalConsoleLog = console.log
|
|
4
4
|
|
|
5
|
-
mock.module('@/shared/utils/error-handler', () => ({
|
|
6
|
-
handleError: (err: Error) => {
|
|
7
|
-
throw err
|
|
8
|
-
},
|
|
9
|
-
}))
|
|
10
|
-
|
|
11
5
|
const mockGetAccount = mock(() =>
|
|
12
6
|
Promise.resolve({
|
|
13
7
|
account_id: 'plus-12025551234',
|
|
@@ -69,6 +63,7 @@ import { chatCommand } from './chat'
|
|
|
69
63
|
|
|
70
64
|
describe('chat commands', () => {
|
|
71
65
|
let consoleLogSpy: ReturnType<typeof mock>
|
|
66
|
+
let consoleErrorSpy: ReturnType<typeof spyOn>
|
|
72
67
|
let processExitSpy: ReturnType<typeof spyOn>
|
|
73
68
|
|
|
74
69
|
beforeEach(() => {
|
|
@@ -118,21 +113,22 @@ describe('chat commands', () => {
|
|
|
118
113
|
|
|
119
114
|
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
120
115
|
console.log = consoleLogSpy
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
116
|
+
consoleErrorSpy = spyOn(console, 'error').mockImplementation(() => {})
|
|
117
|
+
processExitSpy = spyOn(process, 'exit').mockImplementation((_code?: number) => undefined as never)
|
|
124
118
|
processExitSpy.mockClear()
|
|
125
119
|
})
|
|
126
120
|
|
|
127
121
|
afterEach(() => {
|
|
128
122
|
console.log = originalConsoleLog
|
|
123
|
+
consoleErrorSpy.mockRestore()
|
|
129
124
|
processExitSpy.mockRestore()
|
|
130
125
|
})
|
|
131
126
|
|
|
132
127
|
describe('list', () => {
|
|
133
128
|
it('lists chats with default limit', async () => {
|
|
134
|
-
await
|
|
129
|
+
await chatCommand.parseAsync(['list'], { from: 'user' })
|
|
135
130
|
|
|
131
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
136
132
|
expect(mockListChats).toHaveBeenCalledWith(20)
|
|
137
133
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
138
134
|
expect(output).toHaveLength(1)
|
|
@@ -141,25 +137,23 @@ describe('chat commands', () => {
|
|
|
141
137
|
})
|
|
142
138
|
|
|
143
139
|
it('respects --limit option', async () => {
|
|
144
|
-
await
|
|
145
|
-
'process.exit(0)',
|
|
146
|
-
)
|
|
140
|
+
await chatCommand.parseAsync(['list', '--limit', '5'], { from: 'user' })
|
|
147
141
|
|
|
142
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
148
143
|
expect(mockListChats).toHaveBeenCalledWith(5)
|
|
149
144
|
})
|
|
150
145
|
|
|
151
146
|
it('passes account option to credential manager', async () => {
|
|
152
|
-
await
|
|
153
|
-
'process.exit(0)',
|
|
154
|
-
)
|
|
147
|
+
await chatCommand.parseAsync(['list', '--account', 'my-account'], { from: 'user' })
|
|
155
148
|
|
|
149
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
156
150
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
157
151
|
})
|
|
158
152
|
|
|
159
153
|
it('exits with error when no account configured', async () => {
|
|
160
154
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
161
155
|
|
|
162
|
-
await
|
|
156
|
+
await chatCommand.parseAsync(['list'], { from: 'user' })
|
|
163
157
|
|
|
164
158
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
165
159
|
})
|
|
@@ -167,8 +161,9 @@ describe('chat commands', () => {
|
|
|
167
161
|
|
|
168
162
|
describe('search', () => {
|
|
169
163
|
it('searches chats by query', async () => {
|
|
170
|
-
await
|
|
164
|
+
await chatCommand.parseAsync(['search', 'Bob'], { from: 'user' })
|
|
171
165
|
|
|
166
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
172
167
|
expect(mockSearchChats).toHaveBeenCalledWith('Bob', 20)
|
|
173
168
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
174
169
|
expect(output).toHaveLength(1)
|
|
@@ -177,18 +172,16 @@ describe('chat commands', () => {
|
|
|
177
172
|
})
|
|
178
173
|
|
|
179
174
|
it('respects --limit option', async () => {
|
|
180
|
-
await
|
|
181
|
-
'process.exit(0)',
|
|
182
|
-
)
|
|
175
|
+
await chatCommand.parseAsync(['search', 'Alice', '--limit', '3'], { from: 'user' })
|
|
183
176
|
|
|
177
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
184
178
|
expect(mockSearchChats).toHaveBeenCalledWith('Alice', 3)
|
|
185
179
|
})
|
|
186
180
|
|
|
187
181
|
it('passes account option to credential manager', async () => {
|
|
188
|
-
await
|
|
189
|
-
chatCommand.parseAsync(['search', 'test', '--account', 'my-account'], { from: 'user' }),
|
|
190
|
-
).rejects.toThrow('process.exit(0)')
|
|
182
|
+
await chatCommand.parseAsync(['search', 'test', '--account', 'my-account'], { from: 'user' })
|
|
191
183
|
|
|
184
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
192
185
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
193
186
|
})
|
|
194
187
|
})
|
|
@@ -2,12 +2,6 @@ import { afterEach, beforeEach, describe, expect, mock, spyOn, it } from 'bun:te
|
|
|
2
2
|
|
|
3
3
|
const originalConsoleLog = console.log
|
|
4
4
|
|
|
5
|
-
mock.module('@/shared/utils/error-handler', () => ({
|
|
6
|
-
handleError: (err: Error) => {
|
|
7
|
-
throw err
|
|
8
|
-
},
|
|
9
|
-
}))
|
|
10
|
-
|
|
11
5
|
const mockGetAccount = mock(() =>
|
|
12
6
|
Promise.resolve({
|
|
13
7
|
account_id: 'plus-12025551234',
|
|
@@ -69,6 +63,7 @@ import { messageCommand } from './message'
|
|
|
69
63
|
|
|
70
64
|
describe('message commands', () => {
|
|
71
65
|
let consoleLogSpy: ReturnType<typeof mock>
|
|
66
|
+
let consoleErrorSpy: ReturnType<typeof spyOn>
|
|
72
67
|
let processExitSpy: ReturnType<typeof spyOn>
|
|
73
68
|
|
|
74
69
|
beforeEach(() => {
|
|
@@ -118,23 +113,22 @@ describe('message commands', () => {
|
|
|
118
113
|
|
|
119
114
|
consoleLogSpy = mock((..._args: unknown[]) => {})
|
|
120
115
|
console.log = consoleLogSpy
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
})
|
|
116
|
+
consoleErrorSpy = spyOn(console, 'error').mockImplementation(() => {})
|
|
117
|
+
processExitSpy = spyOn(process, 'exit').mockImplementation((_code?: number) => undefined as never)
|
|
124
118
|
processExitSpy.mockClear()
|
|
125
119
|
})
|
|
126
120
|
|
|
127
121
|
afterEach(() => {
|
|
128
122
|
console.log = originalConsoleLog
|
|
123
|
+
consoleErrorSpy.mockRestore()
|
|
129
124
|
processExitSpy.mockRestore()
|
|
130
125
|
})
|
|
131
126
|
|
|
132
127
|
describe('list', () => {
|
|
133
128
|
it('fetches messages for a chat', async () => {
|
|
134
|
-
await
|
|
135
|
-
'process.exit(0)',
|
|
136
|
-
)
|
|
129
|
+
await messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net'], { from: 'user' })
|
|
137
130
|
|
|
131
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
138
132
|
expect(mockGetMessages).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 25)
|
|
139
133
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
140
134
|
expect(output).toHaveLength(1)
|
|
@@ -143,27 +137,25 @@ describe('message commands', () => {
|
|
|
143
137
|
})
|
|
144
138
|
|
|
145
139
|
it('respects --limit option', async () => {
|
|
146
|
-
await
|
|
147
|
-
messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net', '--limit', '10'], { from: 'user' }),
|
|
148
|
-
).rejects.toThrow('process.exit(0)')
|
|
140
|
+
await messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net', '--limit', '10'], { from: 'user' })
|
|
149
141
|
|
|
142
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
150
143
|
expect(mockGetMessages).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 10)
|
|
151
144
|
})
|
|
152
145
|
|
|
153
146
|
it('passes account option to credential manager', async () => {
|
|
154
|
-
await
|
|
155
|
-
|
|
156
|
-
)
|
|
147
|
+
await messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net', '--account', 'my-account'], {
|
|
148
|
+
from: 'user',
|
|
149
|
+
})
|
|
157
150
|
|
|
151
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
158
152
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
159
153
|
})
|
|
160
154
|
|
|
161
155
|
it('exits with error when no account configured', async () => {
|
|
162
156
|
mockGetAccount.mockImplementation(() => Promise.resolve(null))
|
|
163
157
|
|
|
164
|
-
await
|
|
165
|
-
'process.exit(1)',
|
|
166
|
-
)
|
|
158
|
+
await messageCommand.parseAsync(['list', '12025551234@s.whatsapp.net'], { from: 'user' })
|
|
167
159
|
|
|
168
160
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
169
161
|
})
|
|
@@ -171,10 +163,9 @@ describe('message commands', () => {
|
|
|
171
163
|
|
|
172
164
|
describe('send', () => {
|
|
173
165
|
it('sends a message to a chat', async () => {
|
|
174
|
-
await
|
|
175
|
-
messageCommand.parseAsync(['send', '12025551234@s.whatsapp.net', 'Hello world'], { from: 'user' }),
|
|
176
|
-
).rejects.toThrow('process.exit(0)')
|
|
166
|
+
await messageCommand.parseAsync(['send', '12025551234@s.whatsapp.net', 'Hello world'], { from: 'user' })
|
|
177
167
|
|
|
168
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
178
169
|
expect(mockSendMessage).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 'Hello world')
|
|
179
170
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
180
171
|
expect(output.id).toBe('msg-2')
|
|
@@ -182,22 +173,20 @@ describe('message commands', () => {
|
|
|
182
173
|
})
|
|
183
174
|
|
|
184
175
|
it('passes account option to credential manager', async () => {
|
|
185
|
-
await
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}),
|
|
189
|
-
).rejects.toThrow('process.exit(0)')
|
|
176
|
+
await messageCommand.parseAsync(['send', '12025551234@s.whatsapp.net', 'Hi', '--account', 'my-account'], {
|
|
177
|
+
from: 'user',
|
|
178
|
+
})
|
|
190
179
|
|
|
180
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
191
181
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
192
182
|
})
|
|
193
183
|
})
|
|
194
184
|
|
|
195
185
|
describe('react', () => {
|
|
196
186
|
it('sends a reaction to a message', async () => {
|
|
197
|
-
await
|
|
198
|
-
messageCommand.parseAsync(['react', '12025551234@s.whatsapp.net', 'msg-1', '👍'], { from: 'user' }),
|
|
199
|
-
).rejects.toThrow('process.exit(0)')
|
|
187
|
+
await messageCommand.parseAsync(['react', '12025551234@s.whatsapp.net', 'msg-1', '👍'], { from: 'user' })
|
|
200
188
|
|
|
189
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
201
190
|
expect(mockSendReaction).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 'msg-1', '👍', undefined)
|
|
202
191
|
const output = JSON.parse(consoleLogSpy.mock.calls[0][0])
|
|
203
192
|
expect(output.success).toBe(true)
|
|
@@ -207,22 +196,23 @@ describe('message commands', () => {
|
|
|
207
196
|
})
|
|
208
197
|
|
|
209
198
|
it('passes --from-me flag to sendReaction', async () => {
|
|
210
|
-
await
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}),
|
|
214
|
-
).rejects.toThrow('process.exit(0)')
|
|
199
|
+
await messageCommand.parseAsync(['react', '12025551234@s.whatsapp.net', 'msg-1', '❤️', '--from-me'], {
|
|
200
|
+
from: 'user',
|
|
201
|
+
})
|
|
215
202
|
|
|
203
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
216
204
|
expect(mockSendReaction).toHaveBeenCalledWith('12025551234@s.whatsapp.net', 'msg-1', '❤️', true)
|
|
217
205
|
})
|
|
218
206
|
|
|
219
207
|
it('passes account option to credential manager', async () => {
|
|
220
|
-
await
|
|
221
|
-
|
|
208
|
+
await messageCommand.parseAsync(
|
|
209
|
+
['react', '12025551234@s.whatsapp.net', 'msg-1', '👍', '--account', 'my-account'],
|
|
210
|
+
{
|
|
222
211
|
from: 'user',
|
|
223
|
-
}
|
|
224
|
-
)
|
|
212
|
+
},
|
|
213
|
+
)
|
|
225
214
|
|
|
215
|
+
expect(processExitSpy).toHaveBeenCalledWith(0)
|
|
226
216
|
expect(mockGetAccount).toHaveBeenCalledWith('my-account')
|
|
227
217
|
})
|
|
228
218
|
})
|