agent-messenger 2.10.1 → 2.10.2
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/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +9 -2
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/shared/chromium/decryptor.d.ts +6 -0
- package/dist/src/shared/chromium/decryptor.d.ts.map +1 -1
- package/dist/src/shared/chromium/decryptor.js +26 -6
- package/dist/src/shared/chromium/decryptor.js.map +1 -1
- package/e2e/channeltalk.e2e.test.ts +13 -13
- package/e2e/channeltalkbot.e2e.test.ts +13 -13
- package/e2e/discord.e2e.test.ts +24 -24
- package/e2e/discordbot.e2e.test.ts +16 -16
- package/e2e/instagram.e2e.test.ts +10 -10
- package/e2e/kakaotalk.e2e.test.ts +7 -7
- package/e2e/line.e2e.test.ts +8 -8
- package/e2e/slack.e2e.test.ts +34 -34
- package/e2e/slackbot.e2e.test.ts +14 -14
- package/e2e/teams.e2e.test.ts +23 -23
- package/e2e/telegram.e2e.test.ts +8 -8
- package/e2e/webex.e2e.test.ts +14 -14
- package/e2e/whatsapp.e2e.test.ts +8 -8
- package/e2e/whatsappbot.e2e.test.ts +6 -6
- 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-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/channeltalk/client.test.ts +26 -26
- package/src/platforms/channeltalk/commands/auth.test.ts +16 -16
- package/src/platforms/channeltalk/commands/bot.test.ts +2 -2
- package/src/platforms/channeltalk/commands/chat.test.ts +3 -3
- package/src/platforms/channeltalk/commands/group.test.ts +4 -4
- package/src/platforms/channeltalk/commands/manager.test.ts +2 -2
- package/src/platforms/channeltalk/commands/message.test.ts +17 -17
- package/src/platforms/channeltalk/commands/snapshot.test.ts +7 -7
- package/src/platforms/channeltalk/commands/whoami.test.ts +3 -3
- package/src/platforms/channeltalk/credential-manager.test.ts +18 -18
- package/src/platforms/channeltalk/ensure-auth.test.ts +5 -5
- package/src/platforms/channeltalk/index.test.ts +23 -23
- package/src/platforms/channeltalk/token-extractor.test.ts +21 -21
- package/src/platforms/channeltalk/types.test.ts +12 -12
- package/src/platforms/channeltalkbot/client.test.ts +14 -14
- package/src/platforms/channeltalkbot/commands/auth.test.ts +16 -16
- package/src/platforms/channeltalkbot/commands/bot.test.ts +6 -6
- package/src/platforms/channeltalkbot/commands/chat.test.ts +9 -9
- package/src/platforms/channeltalkbot/commands/group.test.ts +6 -6
- package/src/platforms/channeltalkbot/commands/manager.test.ts +3 -3
- package/src/platforms/channeltalkbot/commands/message.test.ts +10 -10
- package/src/platforms/channeltalkbot/commands/snapshot.test.ts +7 -7
- package/src/platforms/channeltalkbot/commands/whoami.test.ts +4 -4
- package/src/platforms/channeltalkbot/credential-manager.test.ts +27 -27
- package/src/platforms/channeltalkbot/index.test.ts +15 -15
- package/src/platforms/discord/client.test.ts +28 -28
- package/src/platforms/discord/commands/auth.test.ts +7 -7
- package/src/platforms/discord/commands/channel.test.ts +7 -7
- package/src/platforms/discord/commands/dm.test.ts +4 -4
- package/src/platforms/discord/commands/file.test.ts +4 -4
- package/src/platforms/discord/commands/friend.test.ts +6 -6
- package/src/platforms/discord/commands/member.test.ts +5 -5
- package/src/platforms/discord/commands/mention.test.ts +5 -5
- package/src/platforms/discord/commands/message.test.ts +9 -9
- package/src/platforms/discord/commands/note.test.ts +6 -6
- package/src/platforms/discord/commands/profile.test.ts +4 -4
- package/src/platforms/discord/commands/reaction.test.ts +5 -5
- package/src/platforms/discord/commands/server.test.ts +7 -7
- package/src/platforms/discord/commands/snapshot.test.ts +6 -6
- package/src/platforms/discord/commands/thread.test.ts +6 -6
- package/src/platforms/discord/commands/user.test.ts +5 -5
- package/src/platforms/discord/commands/whoami.test.ts +6 -6
- package/src/platforms/discord/credential-manager.test.ts +16 -16
- package/src/platforms/discord/ensure-auth.test.ts +8 -8
- package/src/platforms/discord/index.test.ts +17 -17
- package/src/platforms/discord/listener.test.ts +33 -33
- package/src/platforms/discord/token-extractor.test.ts +53 -53
- package/src/platforms/discord/types.test.ts +26 -26
- package/src/platforms/discordbot/client.test.ts +31 -31
- package/src/platforms/discordbot/commands/auth.test.ts +18 -18
- package/src/platforms/discordbot/commands/channel.test.ts +11 -11
- package/src/platforms/discordbot/commands/file.test.ts +7 -7
- package/src/platforms/discordbot/commands/message.test.ts +25 -25
- package/src/platforms/discordbot/commands/reaction.test.ts +6 -6
- package/src/platforms/discordbot/commands/server.test.ts +12 -12
- package/src/platforms/discordbot/commands/snapshot.test.ts +13 -13
- package/src/platforms/discordbot/commands/thread.test.ts +10 -10
- package/src/platforms/discordbot/commands/user.test.ts +9 -9
- package/src/platforms/discordbot/commands/whoami.test.ts +4 -4
- package/src/platforms/discordbot/credential-manager.test.ts +28 -28
- package/src/platforms/instagram/client.test.ts +18 -18
- package/src/platforms/instagram/commands/auth.test.ts +11 -11
- package/src/platforms/instagram/commands/chat.test.ts +6 -6
- package/src/platforms/instagram/commands/message.test.ts +11 -11
- package/src/platforms/instagram/commands/shared.test.ts +12 -12
- package/src/platforms/instagram/commands/whoami.test.ts +3 -3
- package/src/platforms/instagram/credential-manager.test.ts +21 -21
- package/src/platforms/instagram/ensure-auth.test.ts +4 -4
- package/src/platforms/instagram/index.test.ts +9 -9
- package/src/platforms/instagram/listener.test.ts +8 -8
- package/src/platforms/instagram/token-extractor.test.ts +35 -35
- package/src/platforms/kakaotalk/client.test.ts +33 -33
- package/src/platforms/kakaotalk/commands/auth.test.ts +11 -11
- package/src/platforms/kakaotalk/commands/chat.test.ts +6 -6
- package/src/platforms/kakaotalk/commands/message.test.ts +7 -7
- package/src/platforms/kakaotalk/commands/whoami.test.ts +5 -5
- package/src/platforms/kakaotalk/credential-manager.test.ts +15 -15
- package/src/platforms/kakaotalk/index.test.ts +15 -15
- package/src/platforms/kakaotalk/listener.test.ts +17 -17
- package/src/platforms/line/client.test.ts +17 -17
- package/src/platforms/line/commands/auth.test.ts +8 -8
- package/src/platforms/line/commands/chat.test.ts +7 -7
- package/src/platforms/line/commands/friend.test.ts +6 -6
- package/src/platforms/line/commands/message.test.ts +7 -7
- package/src/platforms/line/commands/whoami.test.ts +6 -6
- package/src/platforms/line/credential-manager.test.ts +17 -17
- package/src/platforms/line/index.test.ts +10 -10
- package/src/platforms/line/listener.test.ts +15 -15
- package/src/platforms/line/types.test.ts +14 -14
- package/src/platforms/slack/cli.test.ts +8 -8
- package/src/platforms/slack/client.test.ts +151 -151
- package/src/platforms/slack/commands/activity.test.ts +13 -13
- package/src/platforms/slack/commands/auth.test.ts +34 -34
- package/src/platforms/slack/commands/bookmark.test.ts +9 -9
- package/src/platforms/slack/commands/channel.test.ts +17 -17
- package/src/platforms/slack/commands/drafts.test.ts +7 -7
- package/src/platforms/slack/commands/emoji.test.ts +3 -3
- package/src/platforms/slack/commands/file.test.ts +12 -12
- package/src/platforms/slack/commands/message.test.ts +19 -19
- package/src/platforms/slack/commands/pin.test.ts +7 -7
- package/src/platforms/slack/commands/reaction.test.ts +10 -10
- package/src/platforms/slack/commands/reminder.test.ts +9 -9
- package/src/platforms/slack/commands/saved.test.ts +7 -7
- package/src/platforms/slack/commands/sections.test.ts +5 -5
- package/src/platforms/slack/commands/snapshot.test.ts +13 -13
- package/src/platforms/slack/commands/unread.test.ts +6 -6
- package/src/platforms/slack/commands/user.test.ts +10 -10
- package/src/platforms/slack/commands/usergroup.test.ts +15 -15
- package/src/platforms/slack/commands/whoami.test.ts +6 -6
- package/src/platforms/slack/commands/workspace.test.ts +26 -26
- package/src/platforms/slack/credential-manager.test.ts +14 -14
- package/src/platforms/slack/ensure-auth.test.ts +21 -21
- package/src/platforms/slack/index.test.ts +12 -12
- package/src/platforms/slack/listener.test.ts +17 -17
- package/src/platforms/slack/token-extractor-node.test.ts +2 -2
- package/src/platforms/slack/token-extractor.test.ts +37 -37
- package/src/platforms/slack/types.test.ts +21 -21
- package/src/platforms/slackbot/client.test.ts +22 -22
- package/src/platforms/slackbot/commands/auth.test.ts +14 -14
- package/src/platforms/slackbot/commands/channel.test.ts +7 -7
- package/src/platforms/slackbot/commands/message.test.ts +13 -13
- package/src/platforms/slackbot/commands/reaction.test.ts +6 -6
- package/src/platforms/slackbot/commands/user.test.ts +7 -7
- package/src/platforms/slackbot/commands/whoami.test.ts +4 -4
- package/src/platforms/slackbot/credential-manager.test.ts +22 -22
- package/src/platforms/slackbot/types.test.ts +7 -7
- package/src/platforms/teams/client.test.ts +30 -30
- package/src/platforms/teams/commands/auth.test.ts +8 -8
- package/src/platforms/teams/commands/channel.test.ts +7 -7
- package/src/platforms/teams/commands/file.test.ts +4 -4
- package/src/platforms/teams/commands/message.test.ts +5 -5
- package/src/platforms/teams/commands/reaction.test.ts +4 -4
- package/src/platforms/teams/commands/snapshot.test.ts +7 -7
- package/src/platforms/teams/commands/team.test.ts +8 -8
- package/src/platforms/teams/commands/user.test.ts +4 -4
- package/src/platforms/teams/commands/whoami.test.ts +6 -6
- package/src/platforms/teams/credential-manager.test.ts +17 -17
- package/src/platforms/teams/ensure-auth.test.ts +13 -13
- package/src/platforms/teams/index.test.ts +15 -15
- package/src/platforms/teams/token-extractor.test.ts +109 -49
- package/src/platforms/teams/token-extractor.ts +7 -2
- package/src/platforms/teams/types.test.ts +26 -26
- package/src/platforms/telegram/app-config.test.ts +4 -4
- package/src/platforms/telegram/chat-utils.test.ts +12 -12
- package/src/platforms/telegram/client.test.ts +4 -4
- package/src/platforms/telegram/commands/auth.test.ts +16 -16
- package/src/platforms/telegram/commands/chat.test.ts +9 -9
- package/src/platforms/telegram/commands/message.test.ts +6 -6
- package/src/platforms/telegram/commands/shared.test.ts +3 -3
- package/src/platforms/telegram/commands/whoami.test.ts +3 -3
- package/src/platforms/telegram/credential-manager.test.ts +10 -10
- package/src/platforms/telegram/types.test.ts +6 -6
- package/src/platforms/webex/app-config.test.ts +8 -8
- package/src/platforms/webex/cli.test.ts +5 -5
- package/src/platforms/webex/client.test.ts +65 -65
- package/src/platforms/webex/commands/auth.test.ts +18 -18
- package/src/platforms/webex/commands/member.test.ts +5 -5
- package/src/platforms/webex/commands/message.test.ts +12 -12
- package/src/platforms/webex/commands/snapshot.test.ts +5 -5
- package/src/platforms/webex/commands/space.test.ts +10 -10
- package/src/platforms/webex/commands/whoami.test.ts +6 -6
- package/src/platforms/webex/credential-manager.test.ts +22 -22
- package/src/platforms/webex/encryption.test.ts +4 -4
- package/src/platforms/webex/ensure-auth.test.ts +5 -5
- package/src/platforms/webex/index.test.ts +5 -5
- package/src/platforms/webex/markdown-to-html.test.ts +33 -33
- package/src/platforms/webex/token-extractor.test.ts +23 -23
- package/src/platforms/webex/types.test.ts +27 -27
- package/src/platforms/wechatbot/client.test.ts +27 -27
- package/src/platforms/wechatbot/commands/auth.test.ts +15 -15
- package/src/platforms/wechatbot/commands/message.test.ts +8 -8
- package/src/platforms/wechatbot/commands/template.test.ts +9 -9
- package/src/platforms/wechatbot/commands/user.test.ts +7 -7
- package/src/platforms/wechatbot/commands/whoami.test.ts +5 -5
- package/src/platforms/wechatbot/credential-manager.test.ts +18 -18
- package/src/platforms/wechatbot/index.test.ts +10 -10
- package/src/platforms/wechatbot/types.test.ts +25 -25
- package/src/platforms/whatsapp/commands/auth.test.ts +13 -13
- package/src/platforms/whatsapp/commands/chat.test.ts +8 -8
- package/src/platforms/whatsapp/commands/message.test.ts +10 -10
- package/src/platforms/whatsapp/commands/whoami.test.ts +3 -3
- package/src/platforms/whatsapp/credential-manager.test.ts +23 -23
- package/src/platforms/whatsapp/ensure-auth.test.ts +4 -4
- package/src/platforms/whatsapp/index.test.ts +8 -8
- package/src/platforms/whatsapp/types.test.ts +42 -42
- package/src/platforms/whatsappbot/client.test.ts +27 -27
- package/src/platforms/whatsappbot/commands/auth.test.ts +14 -14
- package/src/platforms/whatsappbot/commands/message.test.ts +16 -16
- package/src/platforms/whatsappbot/commands/template.test.ts +9 -9
- package/src/platforms/whatsappbot/commands/whoami.test.ts +5 -5
- package/src/platforms/whatsappbot/credential-manager.test.ts +18 -18
- package/src/platforms/whatsappbot/index.test.ts +7 -7
- package/src/platforms/whatsappbot/types.test.ts +18 -18
- package/src/shared/chromium/browsers.test.ts +22 -22
- package/src/shared/chromium/cookie-reader.test.ts +13 -13
- package/src/shared/chromium/decryptor.test.ts +97 -32
- package/src/shared/chromium/decryptor.ts +27 -6
- package/src/shared/utils/concurrency.test.ts +6 -6
- package/src/shared/utils/derived-key-cache.test.ts +11 -11
- package/src/tui/utils.test.ts +31 -31
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
const mockSendGroupMessage = mock(() =>
|
|
4
4
|
Promise.resolve({
|
|
@@ -306,7 +306,7 @@ describe('message commands', () => {
|
|
|
306
306
|
)
|
|
307
307
|
})
|
|
308
308
|
|
|
309
|
-
|
|
309
|
+
it('sendAction sends a group message with wrapped blocks', async () => {
|
|
310
310
|
const result = await sendAction('group', 'grp-1', 'Hello group')
|
|
311
311
|
|
|
312
312
|
expect(mockSendGroupMessage).toHaveBeenCalledWith('ws-1', 'grp-1', [{ type: 'text', value: 'Hello group' }])
|
|
@@ -319,7 +319,7 @@ describe('message commands', () => {
|
|
|
319
319
|
})
|
|
320
320
|
})
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
it('sendAction sends a user chat message with wrapped blocks', async () => {
|
|
323
323
|
const result = await sendAction('user-chat', 'chat-1', 'Hello user chat')
|
|
324
324
|
|
|
325
325
|
expect(mockSendUserChatMessage).toHaveBeenCalledWith('ws-1', 'chat-1', [{ type: 'text', value: 'Hello user chat' }])
|
|
@@ -332,7 +332,7 @@ describe('message commands', () => {
|
|
|
332
332
|
})
|
|
333
333
|
})
|
|
334
334
|
|
|
335
|
-
|
|
335
|
+
it('sendAction sends a direct chat message with wrapped blocks', async () => {
|
|
336
336
|
const result = await sendAction('direct-chat', 'dm-1', 'Hello direct chat')
|
|
337
337
|
|
|
338
338
|
expect(mockSendDirectChatMessage).toHaveBeenCalledWith('ws-1', 'dm-1', [
|
|
@@ -347,7 +347,7 @@ describe('message commands', () => {
|
|
|
347
347
|
})
|
|
348
348
|
})
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
it('listAction lists group messages with limit and sort options', async () => {
|
|
351
351
|
const result = await listAction('group', 'grp-1', { limit: '10', sort: 'asc' })
|
|
352
352
|
|
|
353
353
|
expect(mockGetGroupMessages).toHaveBeenCalledWith('ws-1', 'grp-1', { limit: 10, sortOrder: 'asc' })
|
|
@@ -365,7 +365,7 @@ describe('message commands', () => {
|
|
|
365
365
|
])
|
|
366
366
|
})
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
it('listAction lists user chat messages', async () => {
|
|
369
369
|
const result = await listAction('user-chat', 'chat-1')
|
|
370
370
|
|
|
371
371
|
expect(mockGetUserChatMessages).toHaveBeenCalledWith('ws-1', 'chat-1', { limit: 25, sortOrder: 'desc' })
|
|
@@ -376,7 +376,7 @@ describe('message commands', () => {
|
|
|
376
376
|
})
|
|
377
377
|
})
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
it('listAction lists direct chat messages', async () => {
|
|
380
380
|
const result = await listAction('direct-chat', 'dm-1')
|
|
381
381
|
|
|
382
382
|
expect(mockGetDirectChatMessages).toHaveBeenCalledWith('ws-1', 'dm-1', { limit: 25, sortOrder: 'desc' })
|
|
@@ -387,21 +387,21 @@ describe('message commands', () => {
|
|
|
387
387
|
})
|
|
388
388
|
})
|
|
389
389
|
|
|
390
|
-
|
|
390
|
+
it('getAction returns specific message by ID', async () => {
|
|
391
391
|
const result = await getAction('group', 'grp-1', 'msg-group-list-1')
|
|
392
392
|
|
|
393
393
|
expect(result.error).toBeUndefined()
|
|
394
394
|
expect(result.id).toBe('msg-group-list-1')
|
|
395
395
|
})
|
|
396
396
|
|
|
397
|
-
|
|
397
|
+
it('getAction returns error when message not found', async () => {
|
|
398
398
|
const result = await getAction('group', 'grp-1', 'nonexistent')
|
|
399
399
|
|
|
400
400
|
expect(result.error).toBeDefined()
|
|
401
401
|
expect(result.error).toContain('not found')
|
|
402
402
|
})
|
|
403
403
|
|
|
404
|
-
|
|
404
|
+
it('searchAction searches team chat messages by default', async () => {
|
|
405
405
|
const result = await searchAction('search')
|
|
406
406
|
|
|
407
407
|
expect(mockSearchTeamChatMessages).toHaveBeenCalledWith('ws-1', 'search', { limit: undefined })
|
|
@@ -420,7 +420,7 @@ describe('message commands', () => {
|
|
|
420
420
|
])
|
|
421
421
|
})
|
|
422
422
|
|
|
423
|
-
|
|
423
|
+
it('searchAction searches user chat messages with scope option', async () => {
|
|
424
424
|
const result = await searchAction('search', { scope: 'user-chat' })
|
|
425
425
|
|
|
426
426
|
expect(mockSearchUserChatMessages).toHaveBeenCalledWith('ws-1', 'search', { limit: undefined })
|
|
@@ -439,13 +439,13 @@ describe('message commands', () => {
|
|
|
439
439
|
])
|
|
440
440
|
})
|
|
441
441
|
|
|
442
|
-
|
|
442
|
+
it('searchAction passes limit parameter', async () => {
|
|
443
443
|
await searchAction('test', { limit: '5' })
|
|
444
444
|
|
|
445
445
|
expect(mockSearchTeamChatMessages).toHaveBeenCalledWith('ws-1', 'test', { limit: 5 })
|
|
446
446
|
})
|
|
447
447
|
|
|
448
|
-
|
|
448
|
+
it('searchAction returns error on failure', async () => {
|
|
449
449
|
mockSearchTeamChatMessages.mockImplementation(() => Promise.reject(new Error('Network error')))
|
|
450
450
|
|
|
451
451
|
const result = await searchAction('test')
|
|
@@ -454,7 +454,7 @@ describe('message commands', () => {
|
|
|
454
454
|
expect(result.results).toBeUndefined()
|
|
455
455
|
})
|
|
456
456
|
|
|
457
|
-
|
|
457
|
+
it('searchAction returns error for invalid scope', async () => {
|
|
458
458
|
const result = await searchAction('test', { scope: 'invalid' })
|
|
459
459
|
|
|
460
460
|
expect(result.error).toContain('Invalid --scope value')
|
|
@@ -462,7 +462,7 @@ describe('message commands', () => {
|
|
|
462
462
|
expect(result.results).toBeUndefined()
|
|
463
463
|
})
|
|
464
464
|
|
|
465
|
-
|
|
465
|
+
it('searchAction handles zero hits', async () => {
|
|
466
466
|
mockSearchTeamChatMessages.mockImplementation(() =>
|
|
467
467
|
Promise.resolve({ hits: [], bots: [], sessions: [], groups: [] }),
|
|
468
468
|
)
|
|
@@ -473,7 +473,7 @@ describe('message commands', () => {
|
|
|
473
473
|
expect(result.error).toBeUndefined()
|
|
474
474
|
})
|
|
475
475
|
|
|
476
|
-
|
|
476
|
+
it('searchAction handles missing highlight plainText key', async () => {
|
|
477
477
|
mockSearchTeamChatMessages.mockImplementation(() =>
|
|
478
478
|
Promise.resolve({
|
|
479
479
|
hits: [
|
|
@@ -506,7 +506,7 @@ describe('message commands', () => {
|
|
|
506
506
|
expect(result.results?.[0]?.plain_text).toBe('some message')
|
|
507
507
|
})
|
|
508
508
|
|
|
509
|
-
|
|
509
|
+
it('searchAction uses extractText for block-only messages', async () => {
|
|
510
510
|
mockSearchTeamChatMessages.mockImplementation(() =>
|
|
511
511
|
Promise.resolve({
|
|
512
512
|
hits: [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
const mockGetChannel = mock(() => Promise.resolve({ id: 'ws-1', name: 'Workspace One' }))
|
|
4
4
|
const mockListManagers = mock(() =>
|
|
@@ -81,7 +81,7 @@ describe('snapshot command', () => {
|
|
|
81
81
|
mockListUserChats.mockClear()
|
|
82
82
|
})
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
it('brief snapshot returns workspace, groups (name only), chat counts, and hint', async () => {
|
|
85
85
|
const result = await snapshotAction()
|
|
86
86
|
|
|
87
87
|
expect(result.error).toBeUndefined()
|
|
@@ -100,7 +100,7 @@ describe('snapshot command', () => {
|
|
|
100
100
|
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
it('brief groups-only returns group names without messages', async () => {
|
|
104
104
|
const result = await snapshotAction({ groupsOnly: true })
|
|
105
105
|
|
|
106
106
|
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
@@ -112,7 +112,7 @@ describe('snapshot command', () => {
|
|
|
112
112
|
expect(mockListUserChats).not.toHaveBeenCalled()
|
|
113
113
|
})
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
it('brief chats-only returns counts without recent details', async () => {
|
|
116
116
|
const result = await snapshotAction({ chatsOnly: true })
|
|
117
117
|
|
|
118
118
|
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
@@ -126,7 +126,7 @@ describe('snapshot command', () => {
|
|
|
126
126
|
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
127
127
|
})
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
it('full snapshot returns workspace, managers, bots, groups, and user chats', async () => {
|
|
130
130
|
const result = await snapshotAction({ full: true })
|
|
131
131
|
|
|
132
132
|
expect(result.error).toBeUndefined()
|
|
@@ -201,7 +201,7 @@ describe('snapshot command', () => {
|
|
|
201
201
|
})
|
|
202
202
|
})
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
it('full groups-only includes messages', async () => {
|
|
205
205
|
const result = await snapshotAction({ full: true, groupsOnly: true, limit: 3 })
|
|
206
206
|
|
|
207
207
|
expect(mockGetGroupMessages).toHaveBeenCalledWith('ws-1', 'grp-1', { limit: 3, sortOrder: 'desc' })
|
|
@@ -214,7 +214,7 @@ describe('snapshot command', () => {
|
|
|
214
214
|
})
|
|
215
215
|
})
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
it('full chats-only includes recent details', async () => {
|
|
218
218
|
const result = await snapshotAction({ full: true, chatsOnly: true, limit: 1 })
|
|
219
219
|
|
|
220
220
|
expect(result.workspace).toEqual({ id: 'ws-1', name: 'Workspace One' })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, mock,
|
|
1
|
+
import { beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
const mockGetAccount = mock(() =>
|
|
4
4
|
Promise.resolve({
|
|
@@ -37,7 +37,7 @@ describe('whoami command', () => {
|
|
|
37
37
|
)
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
it('returns account info', async () => {
|
|
41
41
|
const result = await whoamiAction({})
|
|
42
42
|
|
|
43
43
|
expect(mockGetAccount).toHaveBeenCalled()
|
|
@@ -53,7 +53,7 @@ describe('whoami command', () => {
|
|
|
53
53
|
expect(result.error).toBeUndefined()
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
it('returns error when getAccount fails', async () => {
|
|
57
57
|
mockGetAccount.mockImplementation(() => Promise.reject(new Error('Not authenticated')))
|
|
58
58
|
|
|
59
59
|
const result = await whoamiAction({})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
2
2
|
import { existsSync, mkdtempSync, rmSync } from 'node:fs'
|
|
3
3
|
import { stat } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -42,14 +42,14 @@ describe('ChannelCredentialManager', () => {
|
|
|
42
42
|
delete process.env.E2E_CHANNEL_WORKSPACE_ID
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
it('returns empty config when no file exists', async () => {
|
|
46
46
|
const config = await manager.load()
|
|
47
47
|
|
|
48
48
|
expect(config.current).toBeNull()
|
|
49
49
|
expect(config.workspaces).toEqual({})
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('persists config to file', async () => {
|
|
53
53
|
const config = {
|
|
54
54
|
current: { workspace_id: '232986' },
|
|
55
55
|
workspaces: {
|
|
@@ -63,11 +63,11 @@ describe('ChannelCredentialManager', () => {
|
|
|
63
63
|
expect(loaded).toEqual(config)
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
it('returns null when no credentials exist', async () => {
|
|
67
67
|
expect(await manager.getCredentials()).toBeNull()
|
|
68
68
|
})
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
it('returns current workspace credentials', async () => {
|
|
71
71
|
await manager.setCredentials(WORKSPACE_A)
|
|
72
72
|
|
|
73
73
|
expect(await manager.getCredentials()).toEqual({
|
|
@@ -78,7 +78,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
78
78
|
})
|
|
79
79
|
})
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
it('returns specific workspace by id', async () => {
|
|
82
82
|
await manager.setCredentials(WORKSPACE_A)
|
|
83
83
|
await manager.setCredentials(WORKSPACE_B)
|
|
84
84
|
|
|
@@ -90,13 +90,13 @@ describe('ChannelCredentialManager', () => {
|
|
|
90
90
|
})
|
|
91
91
|
})
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
it('returns null for unknown workspace id', async () => {
|
|
94
94
|
await manager.setCredentials(WORKSPACE_A)
|
|
95
95
|
|
|
96
96
|
expect(await manager.getCredentials('missing')).toBeNull()
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
it('env vars take precedence when no workspace id is specified', async () => {
|
|
100
100
|
await manager.setCredentials(WORKSPACE_A)
|
|
101
101
|
|
|
102
102
|
process.env.E2E_CHANNEL_ACCOUNT_COOKIE = 'env-account-cookie'
|
|
@@ -111,7 +111,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
111
111
|
})
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
it('env vars are ignored when a workspace id is explicitly provided', async () => {
|
|
115
115
|
await manager.setCredentials(WORKSPACE_A)
|
|
116
116
|
|
|
117
117
|
process.env.E2E_CHANNEL_ACCOUNT_COOKIE = 'env-account-cookie'
|
|
@@ -126,7 +126,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
126
126
|
})
|
|
127
127
|
})
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
it('stores multiple workspaces and marks the latest current', async () => {
|
|
130
130
|
await manager.setCredentials(WORKSPACE_A)
|
|
131
131
|
await manager.setCredentials(WORKSPACE_B)
|
|
132
132
|
|
|
@@ -136,7 +136,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
136
136
|
expect(config.current).toEqual({ workspace_id: '232987' })
|
|
137
137
|
})
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
it('lists all workspaces with current flag', async () => {
|
|
140
140
|
await manager.setCredentials(WORKSPACE_A)
|
|
141
141
|
await manager.setCredentials(WORKSPACE_B)
|
|
142
142
|
|
|
@@ -147,7 +147,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
147
147
|
expect(all.find((workspace) => workspace.workspace_id === '232987')?.is_current).toBe(true)
|
|
148
148
|
})
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
it('switches current workspace', async () => {
|
|
151
151
|
await manager.setCredentials(WORKSPACE_A)
|
|
152
152
|
await manager.setCredentials(WORKSPACE_B)
|
|
153
153
|
|
|
@@ -160,11 +160,11 @@ describe('ChannelCredentialManager', () => {
|
|
|
160
160
|
})
|
|
161
161
|
})
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
it('returns false when setting an unknown current workspace', async () => {
|
|
164
164
|
expect(await manager.setCurrent('missing')).toBe(false)
|
|
165
165
|
})
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
it('removes a workspace by id', async () => {
|
|
168
168
|
await manager.setCredentials(WORKSPACE_A)
|
|
169
169
|
await manager.setCredentials(WORKSPACE_B)
|
|
170
170
|
|
|
@@ -172,7 +172,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
172
172
|
expect(await manager.listAll()).toHaveLength(1)
|
|
173
173
|
})
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
it('clears current when current workspace is removed', async () => {
|
|
176
176
|
await manager.setCredentials(WORKSPACE_A)
|
|
177
177
|
|
|
178
178
|
await manager.removeWorkspace(WORKSPACE_A.workspace_id)
|
|
@@ -181,11 +181,11 @@ describe('ChannelCredentialManager', () => {
|
|
|
181
181
|
expect(config.current).toBeNull()
|
|
182
182
|
})
|
|
183
183
|
|
|
184
|
-
|
|
184
|
+
it('returns false when removing an unknown workspace', async () => {
|
|
185
185
|
expect(await manager.removeWorkspace('missing')).toBe(false)
|
|
186
186
|
})
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
it('clears all credentials', async () => {
|
|
189
189
|
await manager.setCredentials(WORKSPACE_A)
|
|
190
190
|
await manager.setCredentials(WORKSPACE_B)
|
|
191
191
|
|
|
@@ -196,7 +196,7 @@ describe('ChannelCredentialManager', () => {
|
|
|
196
196
|
expect(config.workspaces).toEqual({})
|
|
197
197
|
})
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
it('saves file with secure permissions', async () => {
|
|
200
200
|
await manager.setCredentials(WORKSPACE_A)
|
|
201
201
|
|
|
202
202
|
const credentialsPath = join(tempDir, 'channel-credentials.json')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterAll, beforeEach, describe, expect, mock,
|
|
1
|
+
import { afterAll, beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ensureChannelAuth,
|
|
@@ -62,7 +62,7 @@ describe('ensureChannelAuth', () => {
|
|
|
62
62
|
mockListChannels.mockImplementation(() => Promise.resolve([{ id: 'ws-1', name: 'Workspace 1' }]))
|
|
63
63
|
})
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
it('extracts and saves workspaces when no credentials exist', async () => {
|
|
66
66
|
mockExtract.mockImplementation(() =>
|
|
67
67
|
Promise.resolve([
|
|
68
68
|
{
|
|
@@ -101,7 +101,7 @@ describe('ensureChannelAuth', () => {
|
|
|
101
101
|
expect(mockSetCurrent).toHaveBeenCalledWith('ws-1')
|
|
102
102
|
})
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
it('returns early when stored credentials are valid', async () => {
|
|
105
105
|
mockGetCredentials.mockImplementation(() =>
|
|
106
106
|
Promise.resolve({
|
|
107
107
|
workspace_id: 'ws-1',
|
|
@@ -118,7 +118,7 @@ describe('ensureChannelAuth', () => {
|
|
|
118
118
|
expect(mockSetCredentials).not.toHaveBeenCalled()
|
|
119
119
|
})
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
it('re-extracts when stored credentials are invalid', async () => {
|
|
122
122
|
mockGetCredentials.mockImplementation(() =>
|
|
123
123
|
Promise.resolve({
|
|
124
124
|
workspace_id: 'ws-1',
|
|
@@ -148,7 +148,7 @@ describe('ensureChannelAuth', () => {
|
|
|
148
148
|
expect(mockSetCurrent).toHaveBeenCalledWith('ws-1')
|
|
149
149
|
})
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
it('returns gracefully when extractor yields no cookies', async () => {
|
|
152
152
|
await ensureChannelAuth()
|
|
153
153
|
|
|
154
154
|
expect(mockExtract).toHaveBeenCalledTimes(1)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect,
|
|
1
|
+
import { expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
BlockInlineAttrsSchema,
|
|
@@ -25,90 +25,90 @@ import {
|
|
|
25
25
|
MessageBlockSchema,
|
|
26
26
|
} from '@/platforms/channeltalk/index'
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
it('ChannelClient is exported from barrel', () => {
|
|
29
29
|
expect(typeof ChannelClient).toBe('function')
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
it('ChannelError is exported from barrel', () => {
|
|
33
33
|
expect(typeof ChannelError).toBe('function')
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
it('ChannelCredentialManager is exported from barrel', () => {
|
|
37
37
|
expect(typeof ChannelCredentialManager).toBe('function')
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
it('ChannelSchema is exported from barrel', () => {
|
|
41
41
|
expect(typeof ChannelSchema.parse).toBe('function')
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
it('ChannelAccountSchema is exported from barrel', () => {
|
|
45
45
|
expect(typeof ChannelAccountSchema.parse).toBe('function')
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
it('ChannelBotSchema is exported from barrel', () => {
|
|
49
49
|
expect(typeof ChannelBotSchema.parse).toBe('function')
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('ChannelConfigSchema is exported from barrel', () => {
|
|
53
53
|
expect(typeof ChannelConfigSchema.parse).toBe('function')
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
it('ChannelCredentialsSchema is exported from barrel', () => {
|
|
57
57
|
expect(typeof ChannelCredentialsSchema.parse).toBe('function')
|
|
58
58
|
})
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
it('ChannelDirectChatSchema is exported from barrel', () => {
|
|
61
61
|
expect(typeof ChannelDirectChatSchema.parse).toBe('function')
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
it('ChannelGroupSchema is exported from barrel', () => {
|
|
65
65
|
expect(typeof ChannelGroupSchema.parse).toBe('function')
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
it('ChannelManagerSchema is exported from barrel', () => {
|
|
69
69
|
expect(typeof ChannelManagerSchema.parse).toBe('function')
|
|
70
70
|
})
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
it('ChannelMessageSchema is exported from barrel', () => {
|
|
73
73
|
expect(typeof ChannelMessageSchema.parse).toBe('function')
|
|
74
74
|
})
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
it('ChannelSessionSchema is exported from barrel', () => {
|
|
77
77
|
expect(typeof ChannelSessionSchema.parse).toBe('function')
|
|
78
78
|
})
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
it('ChannelUserChatSchema is exported from barrel', () => {
|
|
81
81
|
expect(typeof ChannelUserChatSchema.parse).toBe('function')
|
|
82
82
|
})
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
it('ChannelWorkspaceEntrySchema is exported from barrel', () => {
|
|
85
85
|
expect(typeof ChannelWorkspaceEntrySchema.parse).toBe('function')
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
it('ChannelSearchHighlightSchema is exported from barrel', () => {
|
|
89
89
|
expect(typeof ChannelSearchHighlightSchema.parse).toBe('function')
|
|
90
90
|
})
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
it('ChannelSearchHitSchema is exported from barrel', () => {
|
|
93
93
|
expect(typeof ChannelSearchHitSchema.parse).toBe('function')
|
|
94
94
|
})
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
it('ChannelSearchResponseSchema is exported from barrel', () => {
|
|
97
97
|
expect(typeof ChannelSearchResponseSchema.parse).toBe('function')
|
|
98
98
|
})
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
it('ExtractedChannelTokenSchema is exported from barrel', () => {
|
|
101
101
|
expect(typeof ExtractedChannelTokenSchema.parse).toBe('function')
|
|
102
102
|
})
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
it('MessageBlockSchema is exported from barrel', () => {
|
|
105
105
|
expect(typeof MessageBlockSchema.parse).toBe('function')
|
|
106
106
|
})
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
it('BlockInlineSchema is exported from barrel', () => {
|
|
109
109
|
expect(typeof BlockInlineSchema.parse).toBe('function')
|
|
110
110
|
})
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
it('BlockInlineAttrsSchema is exported from barrel', () => {
|
|
113
113
|
expect(typeof BlockInlineAttrsSchema.parse).toBe('function')
|
|
114
114
|
})
|