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 { afterEach, beforeEach, describe, expect, mock,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
import { existsSync, rmSync } from 'node:fs'
|
|
3
3
|
import { mkdir } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -86,7 +86,7 @@ describe('group commands', () => {
|
|
|
86
86
|
})
|
|
87
87
|
|
|
88
88
|
describe('listAction', () => {
|
|
89
|
-
|
|
89
|
+
it('lists all groups', async () => {
|
|
90
90
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
91
91
|
const result = await listAction({ _credManager: manager })
|
|
92
92
|
|
|
@@ -97,7 +97,7 @@ describe('group commands', () => {
|
|
|
97
97
|
})
|
|
98
98
|
|
|
99
99
|
describe('getAction', () => {
|
|
100
|
-
|
|
100
|
+
it('resolves group by ID', async () => {
|
|
101
101
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
102
102
|
const result = await getAction('grp1', { _credManager: manager })
|
|
103
103
|
|
|
@@ -106,7 +106,7 @@ describe('group commands', () => {
|
|
|
106
106
|
expect(capturedResolveArg).toBe('grp1')
|
|
107
107
|
})
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
it('resolves group by @name', async () => {
|
|
110
110
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
111
111
|
const result = await getAction('@team-alpha', { _credManager: manager })
|
|
112
112
|
|
|
@@ -116,7 +116,7 @@ describe('group commands', () => {
|
|
|
116
116
|
})
|
|
117
117
|
|
|
118
118
|
describe('messagesAction', () => {
|
|
119
|
-
|
|
119
|
+
it('gets messages from group', async () => {
|
|
120
120
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
121
121
|
const result = await messagesAction('grp1', { _credManager: manager })
|
|
122
122
|
|
|
@@ -125,7 +125,7 @@ describe('group commands', () => {
|
|
|
125
125
|
expect(result.messages?.[0].id).toBe('msg1')
|
|
126
126
|
})
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
it('resolves group by @name before fetching messages', async () => {
|
|
129
129
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
130
130
|
await messagesAction('@team-alpha', { _credManager: manager })
|
|
131
131
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, mock,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
import { existsSync, rmSync } from 'node:fs'
|
|
3
3
|
import { mkdir } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -48,7 +48,7 @@ describe('manager commands', () => {
|
|
|
48
48
|
})
|
|
49
49
|
|
|
50
50
|
describe('listAction', () => {
|
|
51
|
-
|
|
51
|
+
it('returns all managers with id, name, description', async () => {
|
|
52
52
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
53
53
|
const result = await listAction({ _credManager: manager })
|
|
54
54
|
|
|
@@ -60,7 +60,7 @@ describe('manager commands', () => {
|
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
describe('getAction', () => {
|
|
63
|
-
|
|
63
|
+
it('returns specific manager', async () => {
|
|
64
64
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
65
65
|
const result = await getAction('mgr1', { _credManager: manager })
|
|
66
66
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, mock,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
import { existsSync, rmSync } from 'node:fs'
|
|
3
3
|
import { mkdir } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -113,7 +113,7 @@ describe('message commands', () => {
|
|
|
113
113
|
})
|
|
114
114
|
|
|
115
115
|
describe('sendAction', () => {
|
|
116
|
-
|
|
116
|
+
it('sends to userchat and wraps text in blocks', async () => {
|
|
117
117
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
118
118
|
const result = await sendAction('chat1', 'Hello world', { type: 'userchat', _credManager: manager })
|
|
119
119
|
|
|
@@ -122,7 +122,7 @@ describe('message commands', () => {
|
|
|
122
122
|
expect(capturedSendUserChatArgs[1]).toEqual([{ type: 'text', value: 'Hello world' }])
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
it('sends to group when type=group', async () => {
|
|
126
126
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
127
127
|
const result = await sendAction('grp1', 'Hello group', { type: 'group', _credManager: manager })
|
|
128
128
|
|
|
@@ -131,14 +131,14 @@ describe('message commands', () => {
|
|
|
131
131
|
expect(mockSendGroupMessage).toHaveBeenCalledTimes(1)
|
|
132
132
|
})
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
it('includes botName in request when --bot provided', async () => {
|
|
135
135
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
136
136
|
await sendAction('chat1', 'Hello', { type: 'userchat', bot: 'my-bot', _credManager: manager })
|
|
137
137
|
|
|
138
138
|
expect(capturedSendUserChatArgs[2]).toBe('my-bot')
|
|
139
139
|
})
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
it('auto-detects group target from @ prefix', async () => {
|
|
142
142
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
143
143
|
await sendAction('@team', 'Hello', { _credManager: manager })
|
|
144
144
|
|
|
@@ -147,7 +147,7 @@ describe('message commands', () => {
|
|
|
147
147
|
})
|
|
148
148
|
|
|
149
149
|
describe('listAction', () => {
|
|
150
|
-
|
|
150
|
+
it('lists userchat messages', async () => {
|
|
151
151
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
152
152
|
const result = await listAction('chat1', { type: 'userchat', _credManager: manager })
|
|
153
153
|
|
|
@@ -156,7 +156,7 @@ describe('message commands', () => {
|
|
|
156
156
|
expect(result.messages?.[0].id).toBe('msg1')
|
|
157
157
|
})
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
it('lists group messages when type=group', async () => {
|
|
160
160
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
161
161
|
const result = await listAction('grp1', { type: 'group', _credManager: manager })
|
|
162
162
|
|
|
@@ -165,7 +165,7 @@ describe('message commands', () => {
|
|
|
165
165
|
expect(result.messages?.[0].id).toBe('msg2')
|
|
166
166
|
})
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
it('passes pagination params', async () => {
|
|
169
169
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
170
170
|
await listAction('chat1', {
|
|
171
171
|
type: 'userchat',
|
|
@@ -181,7 +181,7 @@ describe('message commands', () => {
|
|
|
181
181
|
})
|
|
182
182
|
|
|
183
183
|
describe('getAction', () => {
|
|
184
|
-
|
|
184
|
+
it('returns specific message by ID', async () => {
|
|
185
185
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
186
186
|
const result = await getAction('chat1', 'msg1', { type: 'userchat', _credManager: manager })
|
|
187
187
|
|
|
@@ -189,7 +189,7 @@ describe('message commands', () => {
|
|
|
189
189
|
expect(result.id).toBe('msg1')
|
|
190
190
|
})
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
it('returns error when message not found', async () => {
|
|
193
193
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
194
194
|
const result = await getAction('chat1', 'nonexistent', { type: 'userchat', _credManager: manager })
|
|
195
195
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, mock,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
import { existsSync, rmSync } from 'node:fs'
|
|
3
3
|
import { mkdir } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -67,7 +67,7 @@ describe('snapshot command', () => {
|
|
|
67
67
|
})
|
|
68
68
|
|
|
69
69
|
describe('snapshotAction', () => {
|
|
70
|
-
|
|
70
|
+
it('brief snapshot returns workspace, groups (names), chat counts, and hint', async () => {
|
|
71
71
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
72
72
|
const result = await snapshotAction({ _credManager: manager })
|
|
73
73
|
|
|
@@ -85,7 +85,7 @@ describe('snapshot command', () => {
|
|
|
85
85
|
expect(mockGetGroupMessages).not.toHaveBeenCalled()
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
it('full snapshot returns workspace, groups, user_chats, managers, bots', async () => {
|
|
89
89
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
90
90
|
const result = await snapshotAction({ full: true, _credManager: manager })
|
|
91
91
|
|
|
@@ -99,7 +99,7 @@ describe('snapshot command', () => {
|
|
|
99
99
|
expect(result.bots).toBeDefined()
|
|
100
100
|
})
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
it('groups-only flag skips user_chats, managers, bots', async () => {
|
|
103
103
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
104
104
|
const result = await snapshotAction({ full: true, groupsOnly: true, _credManager: manager })
|
|
105
105
|
|
|
@@ -111,7 +111,7 @@ describe('snapshot command', () => {
|
|
|
111
111
|
expect(result.bots).toBeUndefined()
|
|
112
112
|
})
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
it('chats-only flag skips groups, managers, bots', async () => {
|
|
115
115
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
116
116
|
const result = await snapshotAction({ full: true, chatsOnly: true, _credManager: manager })
|
|
117
117
|
|
|
@@ -123,7 +123,7 @@ describe('snapshot command', () => {
|
|
|
123
123
|
expect(result.bots).toBeUndefined()
|
|
124
124
|
})
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
it('full groups include recent messages', async () => {
|
|
127
127
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
128
128
|
const result = await snapshotAction({ full: true, groupsOnly: true, limit: 3, _credManager: manager })
|
|
129
129
|
|
|
@@ -131,7 +131,7 @@ describe('snapshot command', () => {
|
|
|
131
131
|
expect(result.groups?.[0].messages?.[0].id).toBe('msg1')
|
|
132
132
|
})
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
it('full user_chats includes counts and recent opened', async () => {
|
|
135
135
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
136
136
|
const result = await snapshotAction({ full: true, chatsOnly: true, _credManager: manager })
|
|
137
137
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, mock,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, mock, it } from 'bun:test'
|
|
2
2
|
import { existsSync, rmSync } from 'node:fs'
|
|
3
3
|
import { mkdir } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -45,7 +45,7 @@ describe('whoami command', () => {
|
|
|
45
45
|
process.env = originalEnv
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
it('returns channel info for current workspace', async () => {
|
|
49
49
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
50
50
|
await manager.setCredentials({
|
|
51
51
|
workspace_id: 'workspace1',
|
|
@@ -63,7 +63,7 @@ describe('whoami command', () => {
|
|
|
63
63
|
expect(result.error).toBeUndefined()
|
|
64
64
|
})
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
it('returns channel info for specific --workspace', async () => {
|
|
67
67
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
68
68
|
await manager.setCredentials({
|
|
69
69
|
workspace_id: 'workspace1',
|
|
@@ -85,7 +85,7 @@ describe('whoami command', () => {
|
|
|
85
85
|
expect(mockGetChannel).toHaveBeenCalledTimes(1)
|
|
86
86
|
})
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
it('returns error when client throws', async () => {
|
|
89
89
|
mockGetChannel.mockImplementationOnce(() => Promise.reject(new Error('API Error')))
|
|
90
90
|
|
|
91
91
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
2
2
|
import { existsSync, rmSync } from 'node:fs'
|
|
3
3
|
import { mkdir, stat } from 'node:fs/promises'
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
@@ -39,7 +39,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
39
39
|
})
|
|
40
40
|
|
|
41
41
|
describe('load', () => {
|
|
42
|
-
|
|
42
|
+
it('returns empty config when no file exists', async () => {
|
|
43
43
|
const config = await manager.load()
|
|
44
44
|
|
|
45
45
|
expect(config.current).toBeNull()
|
|
@@ -49,7 +49,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
49
49
|
})
|
|
50
50
|
|
|
51
51
|
describe('save and load', () => {
|
|
52
|
-
|
|
52
|
+
it('persists config to file', async () => {
|
|
53
53
|
const config = {
|
|
54
54
|
current: { workspace_id: 'ch_abc123' },
|
|
55
55
|
workspaces: {
|
|
@@ -71,11 +71,11 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
71
71
|
})
|
|
72
72
|
|
|
73
73
|
describe('getCredentials', () => {
|
|
74
|
-
|
|
74
|
+
it('returns null when no credentials exist', async () => {
|
|
75
75
|
expect(await manager.getCredentials()).toBeNull()
|
|
76
76
|
})
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
it('returns current workspace credentials', async () => {
|
|
79
79
|
await manager.setCredentials(WORKSPACE_A)
|
|
80
80
|
|
|
81
81
|
const creds = await manager.getCredentials()
|
|
@@ -83,7 +83,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
83
83
|
expect(creds).toEqual(WORKSPACE_A)
|
|
84
84
|
})
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
it('returns specific workspace by id', async () => {
|
|
87
87
|
await manager.setCredentials(WORKSPACE_A)
|
|
88
88
|
await manager.setCredentials(WORKSPACE_B)
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
92
92
|
expect(creds).toEqual(WORKSPACE_A)
|
|
93
93
|
})
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
it('returns null for non-existent workspace id', async () => {
|
|
96
96
|
await manager.setCredentials(WORKSPACE_A)
|
|
97
97
|
|
|
98
98
|
const creds = await manager.getCredentials('nonexistent')
|
|
@@ -100,7 +100,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
100
100
|
expect(creds).toBeNull()
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
it('env vars take precedence when no workspaceId specified', async () => {
|
|
104
104
|
await manager.setCredentials(WORKSPACE_A)
|
|
105
105
|
|
|
106
106
|
process.env.E2E_CHANNELBOT_ACCESS_KEY = 'env-key'
|
|
@@ -114,7 +114,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
114
114
|
expect(creds?.workspace_name).toBe('env')
|
|
115
115
|
})
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
it('env vars ignored when workspaceId explicitly provided', async () => {
|
|
118
118
|
await manager.setCredentials(WORKSPACE_A)
|
|
119
119
|
|
|
120
120
|
process.env.E2E_CHANNELBOT_ACCESS_KEY = 'env-key'
|
|
@@ -129,7 +129,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
129
129
|
})
|
|
130
130
|
|
|
131
131
|
describe('setCredentials', () => {
|
|
132
|
-
|
|
132
|
+
it('stores workspace and sets as current', async () => {
|
|
133
133
|
await manager.setCredentials(WORKSPACE_A)
|
|
134
134
|
|
|
135
135
|
const config = await manager.load()
|
|
@@ -137,7 +137,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
137
137
|
expect(config.workspaces['ch_abc123']).toEqual(WORKSPACE_A)
|
|
138
138
|
})
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
it('stores multiple workspaces', async () => {
|
|
141
141
|
await manager.setCredentials(WORKSPACE_A)
|
|
142
142
|
await manager.setCredentials(WORKSPACE_B)
|
|
143
143
|
|
|
@@ -146,7 +146,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
146
146
|
expect(config.current).toEqual({ workspace_id: 'ch_def456' })
|
|
147
147
|
})
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
it('overwrites existing workspace with same id', async () => {
|
|
150
150
|
await manager.setCredentials(WORKSPACE_A)
|
|
151
151
|
const updated = { ...WORKSPACE_A, workspace_name: 'Updated Company A' }
|
|
152
152
|
await manager.setCredentials(updated)
|
|
@@ -158,7 +158,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
158
158
|
})
|
|
159
159
|
|
|
160
160
|
describe('listAll', () => {
|
|
161
|
-
|
|
161
|
+
it('returns all workspaces with current flag', async () => {
|
|
162
162
|
await manager.setCredentials(WORKSPACE_A)
|
|
163
163
|
await manager.setCredentials(WORKSPACE_B)
|
|
164
164
|
|
|
@@ -169,7 +169,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
169
169
|
expect(all.find((w) => w.workspace_id === 'ch_def456')?.is_current).toBe(true)
|
|
170
170
|
})
|
|
171
171
|
|
|
172
|
-
|
|
172
|
+
it('returns empty array when no workspaces exist', async () => {
|
|
173
173
|
const all = await manager.listAll()
|
|
174
174
|
|
|
175
175
|
expect(all).toEqual([])
|
|
@@ -177,7 +177,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
177
177
|
})
|
|
178
178
|
|
|
179
179
|
describe('setCurrent', () => {
|
|
180
|
-
|
|
180
|
+
it('switches current workspace', async () => {
|
|
181
181
|
await manager.setCredentials(WORKSPACE_A)
|
|
182
182
|
await manager.setCredentials(WORKSPACE_B)
|
|
183
183
|
|
|
@@ -188,13 +188,13 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
188
188
|
expect(creds?.workspace_id).toBe('ch_abc123')
|
|
189
189
|
})
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
it('returns false for unknown workspace', async () => {
|
|
192
192
|
expect(await manager.setCurrent('nonexistent')).toBe(false)
|
|
193
193
|
})
|
|
194
194
|
})
|
|
195
195
|
|
|
196
196
|
describe('removeWorkspace', () => {
|
|
197
|
-
|
|
197
|
+
it('removes a workspace by id', async () => {
|
|
198
198
|
await manager.setCredentials(WORKSPACE_A)
|
|
199
199
|
await manager.setCredentials(WORKSPACE_B)
|
|
200
200
|
|
|
@@ -205,7 +205,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
205
205
|
expect(Object.keys(config.workspaces)).toEqual(['ch_def456'])
|
|
206
206
|
})
|
|
207
207
|
|
|
208
|
-
|
|
208
|
+
it('clears current when current workspace removed', async () => {
|
|
209
209
|
await manager.setCredentials(WORKSPACE_A)
|
|
210
210
|
|
|
211
211
|
await manager.removeWorkspace('ch_abc123')
|
|
@@ -214,11 +214,11 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
214
214
|
expect(config.current).toBeNull()
|
|
215
215
|
})
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
it('returns false for unknown workspace', async () => {
|
|
218
218
|
expect(await manager.removeWorkspace('nonexistent')).toBe(false)
|
|
219
219
|
})
|
|
220
220
|
|
|
221
|
-
|
|
221
|
+
it('does not clear current if removing non-current workspace', async () => {
|
|
222
222
|
await manager.setCredentials(WORKSPACE_A)
|
|
223
223
|
await manager.setCredentials(WORKSPACE_B)
|
|
224
224
|
|
|
@@ -230,7 +230,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
230
230
|
})
|
|
231
231
|
|
|
232
232
|
describe('clearCredentials', () => {
|
|
233
|
-
|
|
233
|
+
it('removes all credentials', async () => {
|
|
234
234
|
await manager.setCredentials(WORKSPACE_A)
|
|
235
235
|
await manager.setCredentials(WORKSPACE_B)
|
|
236
236
|
|
|
@@ -244,13 +244,13 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
244
244
|
})
|
|
245
245
|
|
|
246
246
|
describe('getDefaultBot', () => {
|
|
247
|
-
|
|
247
|
+
it('returns null initially', async () => {
|
|
248
248
|
const bot = await manager.getDefaultBot()
|
|
249
249
|
|
|
250
250
|
expect(bot).toBeNull()
|
|
251
251
|
})
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
it('returns default bot name', async () => {
|
|
254
254
|
await manager.setDefaultBot('my-bot')
|
|
255
255
|
|
|
256
256
|
const bot = await manager.getDefaultBot()
|
|
@@ -260,7 +260,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
260
260
|
})
|
|
261
261
|
|
|
262
262
|
describe('setDefaultBot', () => {
|
|
263
|
-
|
|
263
|
+
it('saves and retrieves default bot', async () => {
|
|
264
264
|
await manager.setDefaultBot('my-bot')
|
|
265
265
|
|
|
266
266
|
const bot = await manager.getDefaultBot()
|
|
@@ -268,7 +268,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
268
268
|
expect(bot).toBe('my-bot')
|
|
269
269
|
})
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
it('updates existing default bot', async () => {
|
|
272
272
|
await manager.setDefaultBot('bot-1')
|
|
273
273
|
await manager.setDefaultBot('bot-2')
|
|
274
274
|
|
|
@@ -277,7 +277,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
277
277
|
expect(bot).toBe('bot-2')
|
|
278
278
|
})
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
it('scopes default bot to current workspace', async () => {
|
|
281
281
|
// given
|
|
282
282
|
await manager.setCredentials(WORKSPACE_A)
|
|
283
283
|
await manager.setDefaultBot('bot-a')
|
|
@@ -296,7 +296,7 @@ describe('ChannelBotCredentialManager', () => {
|
|
|
296
296
|
})
|
|
297
297
|
|
|
298
298
|
describe('file permissions', () => {
|
|
299
|
-
|
|
299
|
+
it('saves file with secure permissions (600)', async () => {
|
|
300
300
|
await manager.setCredentials(WORKSPACE_A)
|
|
301
301
|
|
|
302
302
|
const credPath = join(tempDir, 'channelbot-credentials.json')
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expect,
|
|
1
|
+
import { expect, it } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
ChannelBotBotSchema,
|
|
@@ -17,58 +17,58 @@ import {
|
|
|
17
17
|
MessageBlockSchema,
|
|
18
18
|
} from '@/platforms/channeltalkbot/index'
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
it('ChannelBotClient is exported from barrel', () => {
|
|
21
21
|
expect(typeof ChannelBotClient).toBe('function')
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
it('ChannelBotError is exported from barrel', () => {
|
|
25
25
|
expect(typeof ChannelBotError).toBe('function')
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
it('ChannelBotCredentialManager is exported from barrel', () => {
|
|
29
29
|
expect(typeof ChannelBotCredentialManager).toBe('function')
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
it('ChannelBotBotSchema is exported from barrel', () => {
|
|
33
33
|
expect(typeof ChannelBotBotSchema.parse).toBe('function')
|
|
34
34
|
})
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
it('ChannelBotChannelSchema is exported from barrel', () => {
|
|
37
37
|
expect(typeof ChannelBotChannelSchema.parse).toBe('function')
|
|
38
38
|
})
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
it('ChannelBotConfigSchema is exported from barrel', () => {
|
|
41
41
|
expect(typeof ChannelBotConfigSchema.parse).toBe('function')
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
it('ChannelBotCredentialsSchema is exported from barrel', () => {
|
|
45
45
|
expect(typeof ChannelBotCredentialsSchema.parse).toBe('function')
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
it('ChannelBotGroupSchema is exported from barrel', () => {
|
|
49
49
|
expect(typeof ChannelBotGroupSchema.parse).toBe('function')
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
it('ChannelBotManagerSchema is exported from barrel', () => {
|
|
53
53
|
expect(typeof ChannelBotManagerSchema.parse).toBe('function')
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
it('ChannelBotMessageSchema is exported from barrel', () => {
|
|
57
57
|
expect(typeof ChannelBotMessageSchema.parse).toBe('function')
|
|
58
58
|
})
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
it('ChannelBotUserChatSchema is exported from barrel', () => {
|
|
61
61
|
expect(typeof ChannelBotUserChatSchema.parse).toBe('function')
|
|
62
62
|
})
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
it('ChannelBotUserSchema is exported from barrel', () => {
|
|
65
65
|
expect(typeof ChannelBotUserSchema.parse).toBe('function')
|
|
66
66
|
})
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
it('ChannelBotWorkspaceEntrySchema is exported from barrel', () => {
|
|
69
69
|
expect(typeof ChannelBotWorkspaceEntrySchema.parse).toBe('function')
|
|
70
70
|
})
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
it('MessageBlockSchema is exported from barrel', () => {
|
|
73
73
|
expect(typeof MessageBlockSchema.parse).toBe('function')
|
|
74
74
|
})
|