agent-messenger 2.6.3 → 2.8.0
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/.github/workflows/ci.yml +6 -0
- package/.oxfmtrc.json +13 -1
- package/.oxlintrc.json +10 -1
- package/README.md +1 -1
- package/dist/package.json +59 -58
- package/dist/src/platforms/channeltalk/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/client.js +2 -2
- package/dist/src/platforms/channeltalk/client.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/message.js.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/ensure-auth.js.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.d.ts +9 -23
- package/dist/src/platforms/channeltalk/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/channeltalk/token-extractor.js +109 -341
- package/dist/src/platforms/channeltalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts +1 -1
- package/dist/src/platforms/channeltalkbot/client.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/client.js +4 -4
- package/dist/src/platforms/channeltalkbot/client.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js +4 -1
- package/dist/src/platforms/channeltalkbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/channeltalkbot/commands/shared.js.map +1 -1
- package/dist/src/platforms/discord/commands/auth.js.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/discord/commands/whoami.js.map +1 -1
- package/dist/src/platforms/discord/token-extractor.d.ts +2 -10
- package/dist/src/platforms/discord/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/discord/token-extractor.js +38 -172
- package/dist/src/platforms/discord/token-extractor.js.map +1 -1
- package/dist/src/platforms/discordbot/client.d.ts.map +1 -1
- package/dist/src/platforms/discordbot/client.js.map +1 -1
- package/dist/src/platforms/instagram/cli.d.ts.map +1 -1
- package/dist/src/platforms/instagram/cli.js +1 -4
- package/dist/src/platforms/instagram/cli.js.map +1 -1
- package/dist/src/platforms/instagram/client.d.ts.map +1 -1
- package/dist/src/platforms/instagram/client.js +8 -7
- package/dist/src/platforms/instagram/client.js.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/auth.js.map +1 -1
- package/dist/src/platforms/instagram/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/chat.js.map +1 -1
- package/dist/src/platforms/instagram/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/message.js.map +1 -1
- package/dist/src/platforms/instagram/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/instagram/commands/shared.js.map +1 -1
- package/dist/src/platforms/instagram/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/instagram/credential-manager.js +1 -1
- package/dist/src/platforms/instagram/credential-manager.js.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/instagram/ensure-auth.js.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.d.ts +7 -19
- package/dist/src/platforms/instagram/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/instagram/token-extractor.js +44 -270
- package/dist/src/platforms/instagram/token-extractor.js.map +1 -1
- package/dist/src/platforms/instagram/types.d.ts.map +1 -1
- package/dist/src/platforms/instagram/types.js +4 -2
- package/dist/src/platforms/instagram/types.js.map +1 -1
- package/dist/src/platforms/kakaotalk/auth/kakao-login.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js +18 -4
- package/dist/src/platforms/kakaotalk/auth/kakao-login.js.map +1 -1
- package/dist/src/platforms/kakaotalk/client.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/client.js +3 -3
- package/dist/src/platforms/kakaotalk/client.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/auth.js +15 -9
- package/dist/src/platforms/kakaotalk/commands/auth.js.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/commands/shared.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/connection.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/crypto.js +1 -1
- package/dist/src/platforms/kakaotalk/protocol/crypto.js.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/protocol/session.js +1 -3
- package/dist/src/platforms/kakaotalk/protocol/session.js.map +1 -1
- package/dist/src/platforms/kakaotalk/token-extractor.js +5 -2
- package/dist/src/platforms/kakaotalk/token-extractor.js.map +1 -1
- package/dist/src/platforms/kakaotalk/types.d.ts.map +1 -1
- package/dist/src/platforms/kakaotalk/types.js +4 -2
- package/dist/src/platforms/kakaotalk/types.js.map +1 -1
- package/dist/src/platforms/line/cli.d.ts.map +1 -1
- package/dist/src/platforms/line/cli.js +1 -4
- package/dist/src/platforms/line/cli.js.map +1 -1
- package/dist/src/platforms/line/client.d.ts.map +1 -1
- package/dist/src/platforms/line/client.js +5 -13
- package/dist/src/platforms/line/client.js.map +1 -1
- package/dist/src/platforms/line/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/chat.js.map +1 -1
- package/dist/src/platforms/line/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/line/commands/message.js.map +1 -1
- package/dist/src/platforms/line/listener.js +1 -1
- package/dist/src/platforms/line/listener.js.map +1 -1
- package/dist/src/platforms/slack/cli.d.ts.map +1 -1
- package/dist/src/platforms/slack/cli.js.map +1 -1
- package/dist/src/platforms/slack/client-mappers.d.ts +14 -0
- package/dist/src/platforms/slack/client-mappers.d.ts.map +1 -0
- package/dist/src/platforms/slack/client-mappers.js +245 -0
- package/dist/src/platforms/slack/client-mappers.js.map +1 -0
- package/dist/src/platforms/slack/client.d.ts +0 -1
- package/dist/src/platforms/slack/client.d.ts.map +1 -1
- package/dist/src/platforms/slack/client.js +41 -455
- package/dist/src/platforms/slack/client.js.map +1 -1
- package/dist/src/platforms/slack/commands/channel.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/channel.js.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/emoji.js +1 -3
- package/dist/src/platforms/slack/commands/emoji.js.map +1 -1
- package/dist/src/platforms/slack/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/message.js.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/reminder.js.map +1 -1
- package/dist/src/platforms/slack/commands/user.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/user.js.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/usergroup.js.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/slack/commands/whoami.js.map +1 -1
- package/dist/src/platforms/slack/token-extractor.d.ts +2 -6
- package/dist/src/platforms/slack/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/slack/token-extractor.js +35 -229
- package/dist/src/platforms/slack/token-extractor.js.map +1 -1
- package/dist/src/platforms/slackbot/cli.d.ts.map +1 -1
- package/dist/src/platforms/slackbot/cli.js +1 -1
- package/dist/src/platforms/slackbot/cli.js.map +1 -1
- package/dist/src/platforms/teams/client.d.ts.map +1 -1
- package/dist/src/platforms/teams/client.js +1 -1
- package/dist/src/platforms/teams/client.js.map +1 -1
- package/dist/src/platforms/teams/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/auth.js +4 -1
- package/dist/src/platforms/teams/commands/auth.js.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/teams/commands/whoami.js.map +1 -1
- package/dist/src/platforms/teams/token-extractor.d.ts +6 -18
- package/dist/src/platforms/teams/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/teams/token-extractor.js +71 -324
- package/dist/src/platforms/teams/token-extractor.js.map +1 -1
- package/dist/src/platforms/telegram/cli.d.ts.map +1 -1
- package/dist/src/platforms/telegram/cli.js +1 -4
- package/dist/src/platforms/telegram/cli.js.map +1 -1
- package/dist/src/platforms/telegram/client.d.ts.map +1 -1
- package/dist/src/platforms/telegram/client.js.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/auth.js +1 -1
- package/dist/src/platforms/telegram/commands/auth.js.map +1 -1
- package/dist/src/platforms/telegram/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/chat.js.map +1 -1
- package/dist/src/platforms/telegram/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/telegram/commands/message.js.map +1 -1
- package/dist/src/platforms/telegram/commands/whoami.js +1 -1
- package/dist/src/platforms/telegram/commands/whoami.js.map +1 -1
- package/dist/src/platforms/telegram/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/telegram/credential-manager.js +6 -2
- package/dist/src/platforms/telegram/credential-manager.js.map +1 -1
- package/dist/src/platforms/telegram/my-telegram-org.js.map +1 -1
- package/dist/src/platforms/webex/cli.d.ts.map +1 -1
- package/dist/src/platforms/webex/cli.js +1 -4
- package/dist/src/platforms/webex/cli.js.map +1 -1
- package/dist/src/platforms/webex/client.d.ts.map +1 -1
- package/dist/src/platforms/webex/client.js +19 -15
- package/dist/src/platforms/webex/client.js.map +1 -1
- package/dist/src/platforms/webex/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/auth.js +1 -3
- package/dist/src/platforms/webex/commands/auth.js.map +1 -1
- package/dist/src/platforms/webex/commands/member.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/member.js +1 -3
- package/dist/src/platforms/webex/commands/member.js.map +1 -1
- package/dist/src/platforms/webex/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/message.js.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/snapshot.js.map +1 -1
- package/dist/src/platforms/webex/commands/space.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/space.js.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.d.ts.map +1 -1
- package/dist/src/platforms/webex/commands/whoami.js.map +1 -1
- package/dist/src/platforms/webex/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/webex/credential-manager.js.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/webex/ensure-auth.js +1 -3
- package/dist/src/platforms/webex/ensure-auth.js.map +1 -1
- package/dist/src/platforms/webex/index.d.ts +1 -1
- package/dist/src/platforms/webex/index.d.ts.map +1 -1
- package/dist/src/platforms/webex/index.js.map +1 -1
- package/dist/src/platforms/webex/markdown-to-html.d.ts +3 -0
- package/dist/src/platforms/webex/markdown-to-html.d.ts.map +1 -0
- package/dist/src/platforms/webex/markdown-to-html.js +161 -0
- package/dist/src/platforms/webex/markdown-to-html.js.map +1 -0
- package/dist/src/platforms/webex/token-extractor.d.ts.map +1 -1
- package/dist/src/platforms/webex/token-extractor.js +5 -14
- package/dist/src/platforms/webex/token-extractor.js.map +1 -1
- package/dist/src/platforms/wechatbot/client.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/client.js.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/wechatbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsapp/cli.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/cli.js +1 -4
- package/dist/src/platforms/whatsapp/cli.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/chat.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/chat.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/commands/shared.js.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js +1 -1
- package/dist/src/platforms/whatsapp/credential-manager.js.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsapp/ensure-auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/client.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/client.js +2 -2
- package/dist/src/platforms/whatsappbot/client.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js +4 -1
- package/dist/src/platforms/whatsappbot/commands/auth.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/message.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/message.js.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/shared.d.ts.map +1 -1
- package/dist/src/platforms/whatsappbot/commands/shared.js.map +1 -1
- package/dist/src/shared/chromium/browsers.d.ts +7 -0
- package/dist/src/shared/chromium/browsers.d.ts.map +1 -0
- package/dist/src/shared/chromium/browsers.js +89 -0
- package/dist/src/shared/chromium/browsers.js.map +1 -0
- package/dist/src/shared/chromium/cookie-reader.d.ts +20 -0
- package/dist/src/shared/chromium/cookie-reader.d.ts.map +1 -0
- package/dist/src/shared/chromium/cookie-reader.js +99 -0
- package/dist/src/shared/chromium/cookie-reader.js.map +1 -0
- package/dist/src/shared/chromium/decryptor.d.ts +42 -0
- package/dist/src/shared/chromium/decryptor.d.ts.map +1 -0
- package/dist/src/shared/chromium/decryptor.js +205 -0
- package/dist/src/shared/chromium/decryptor.js.map +1 -0
- package/dist/src/shared/chromium/index.d.ts +6 -0
- package/dist/src/shared/chromium/index.d.ts.map +1 -0
- package/dist/src/shared/chromium/index.js +4 -0
- package/dist/src/shared/chromium/index.js.map +1 -0
- package/dist/src/shared/chromium/types.d.ts +11 -0
- package/dist/src/shared/chromium/types.d.ts.map +1 -0
- package/dist/src/shared/chromium/types.js +2 -0
- package/dist/src/shared/chromium/types.js.map +1 -0
- package/dist/src/shared/utils/derived-key-cache.d.ts +1 -1
- package/dist/src/shared/utils/derived-key-cache.d.ts.map +1 -1
- package/dist/src/shared/utils/linux-keyring.js +4 -1
- package/dist/src/shared/utils/linux-keyring.js.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.d.ts.map +1 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js +6 -1
- package/dist/src/tui/adapters/kakaotalk-adapter.js.map +1 -1
- package/dist/src/tui/adapters/telegram-adapter.js +1 -1
- package/dist/src/tui/adapters/telegram-adapter.js.map +1 -1
- package/dist/src/tui/adapters/webex-adapter.js +1 -1
- package/dist/src/tui/adapters/webex-adapter.js.map +1 -1
- package/dist/src/tui/app.d.ts.map +1 -1
- package/dist/src/tui/app.js +112 -23
- package/dist/src/tui/app.js.map +1 -1
- package/dist/src/tui/utils.d.ts.map +1 -1
- package/dist/src/tui/utils.js +11 -13
- package/dist/src/tui/utils.js.map +1 -1
- package/dist/src/tui/views/channel-picker.d.ts.map +1 -1
- package/dist/src/tui/views/channel-picker.js.map +1 -1
- package/dist/src/tui/views/workspace-picker.d.ts.map +1 -1
- package/dist/src/tui/views/workspace-picker.js.map +1 -1
- package/docs/content/docs/cli/channeltalk.mdx +24 -22
- package/docs/content/docs/cli/channeltalkbot.mdx +7 -7
- package/docs/content/docs/cli/instagram.mdx +4 -4
- package/docs/content/docs/cli/kakaotalk.mdx +9 -8
- package/docs/content/docs/cli/line.mdx +14 -14
- package/docs/content/docs/cli/webex.mdx +19 -19
- package/docs/content/docs/cli/wechatbot.mdx +12 -11
- package/docs/content/docs/cli/whatsapp.mdx +5 -4
- package/docs/content/docs/cli/whatsappbot.mdx +11 -11
- package/docs/content/docs/index.mdx +7 -7
- package/docs/content/docs/meta.json +1 -9
- package/docs/content/docs/sdk/channeltalk.mdx +5 -6
- package/docs/content/docs/sdk/channeltalkbot.mdx +6 -12
- package/docs/content/docs/sdk/discord.mdx +36 -43
- package/docs/content/docs/sdk/instagram.mdx +18 -18
- package/docs/content/docs/sdk/kakaotalk.mdx +27 -18
- package/docs/content/docs/sdk/line.mdx +8 -13
- package/docs/content/docs/sdk/meta.json +14 -1
- package/docs/content/docs/sdk/slack.mdx +36 -42
- package/docs/content/docs/sdk/teams.mdx +2 -8
- package/docs/content/docs/sdk/webex.mdx +2 -12
- package/docs/content/docs/sdk/wechatbot.mdx +1 -5
- package/docs/content/docs/sdk/whatsapp.mdx +10 -19
- package/docs/content/docs/sdk/whatsappbot.mdx +2 -10
- package/docs/content/docs/tui.mdx +23 -23
- package/docs/src/app/page.tsx +353 -108
- package/e2e/channeltalkbot.e2e.test.ts +1 -5
- package/e2e/config.ts +6 -2
- package/package.json +59 -58
- package/scripts/prepublish.ts +1 -3
- 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 +116 -29
- package/src/platforms/channeltalk/client.ts +26 -6
- package/src/platforms/channeltalk/commands/auth.test.ts +5 -5
- package/src/platforms/channeltalk/commands/auth.ts +19 -5
- package/src/platforms/channeltalk/commands/message.test.ts +2 -6
- package/src/platforms/channeltalk/commands/message.ts +5 -1
- package/src/platforms/channeltalk/commands/snapshot.test.ts +19 -4
- package/src/platforms/channeltalk/commands/snapshot.ts +5 -1
- package/src/platforms/channeltalk/ensure-auth.test.ts +20 -17
- package/src/platforms/channeltalk/ensure-auth.ts +6 -7
- package/src/platforms/channeltalk/index.ts +0 -1
- package/src/platforms/channeltalk/token-extractor.test.ts +33 -25
- package/src/platforms/channeltalk/token-extractor.ts +120 -372
- package/src/platforms/channeltalkbot/client.test.ts +1 -3
- package/src/platforms/channeltalkbot/client.ts +39 -13
- package/src/platforms/channeltalkbot/commands/auth.test.ts +3 -1
- package/src/platforms/channeltalkbot/commands/auth.ts +4 -1
- package/src/platforms/channeltalkbot/commands/bot.test.ts +13 -5
- package/src/platforms/channeltalkbot/commands/message.test.ts +12 -6
- package/src/platforms/channeltalkbot/commands/shared.ts +6 -2
- package/src/platforms/channeltalkbot/commands/snapshot.test.ts +17 -5
- package/src/platforms/channeltalkbot/credential-manager.test.ts +1 -1
- package/src/platforms/channeltalkbot/index.test.ts +0 -2
- package/src/platforms/channeltalkbot/index.ts +0 -1
- package/src/platforms/discord/commands/auth.test.ts +6 -4
- package/src/platforms/discord/commands/auth.ts +14 -14
- package/src/platforms/discord/commands/whoami.test.ts +2 -4
- package/src/platforms/discord/commands/whoami.ts +2 -0
- package/src/platforms/discord/ensure-auth.test.ts +5 -3
- package/src/platforms/discord/index.ts +0 -1
- package/src/platforms/discord/listener.test.ts +7 -1
- package/src/platforms/discord/token-extractor.test.ts +18 -12
- package/src/platforms/discord/token-extractor.ts +46 -190
- package/src/platforms/discordbot/client.ts +1 -4
- package/src/platforms/discordbot/commands/auth.test.ts +3 -1
- package/src/platforms/discordbot/commands/channel.test.ts +3 -1
- package/src/platforms/discordbot/commands/message.test.ts +3 -1
- package/src/platforms/discordbot/commands/server.test.ts +3 -1
- package/src/platforms/discordbot/commands/snapshot.test.ts +3 -1
- package/src/platforms/discordbot/commands/thread.test.ts +3 -1
- package/src/platforms/discordbot/commands/user.test.ts +3 -1
- package/src/platforms/instagram/cli.ts +1 -4
- package/src/platforms/instagram/client.test.ts +3 -8
- package/src/platforms/instagram/client.ts +39 -34
- package/src/platforms/instagram/commands/auth.test.ts +13 -12
- package/src/platforms/instagram/commands/auth.ts +136 -71
- package/src/platforms/instagram/commands/chat.test.ts +21 -24
- package/src/platforms/instagram/commands/chat.ts +2 -0
- package/src/platforms/instagram/commands/message.test.ts +29 -24
- package/src/platforms/instagram/commands/message.ts +3 -4
- package/src/platforms/instagram/commands/shared.ts +2 -5
- package/src/platforms/instagram/commands/whoami.test.ts +4 -6
- package/src/platforms/instagram/credential-manager.ts +2 -6
- package/src/platforms/instagram/ensure-auth.test.ts +1 -4
- package/src/platforms/instagram/ensure-auth.ts +6 -3
- package/src/platforms/instagram/listener.test.ts +7 -3
- package/src/platforms/instagram/token-extractor.test.ts +4 -16
- package/src/platforms/instagram/token-extractor.ts +55 -309
- package/src/platforms/instagram/types.test.ts +2 -6
- package/src/platforms/instagram/types.ts +4 -2
- package/src/platforms/kakaotalk/auth/kakao-login.ts +30 -8
- package/src/platforms/kakaotalk/client.test.ts +37 -25
- package/src/platforms/kakaotalk/client.ts +23 -12
- package/src/platforms/kakaotalk/commands/auth.test.ts +6 -18
- package/src/platforms/kakaotalk/commands/auth.ts +101 -47
- package/src/platforms/kakaotalk/commands/chat.test.ts +8 -11
- package/src/platforms/kakaotalk/commands/message.test.ts +15 -24
- package/src/platforms/kakaotalk/commands/shared.ts +1 -0
- package/src/platforms/kakaotalk/commands/whoami.test.ts +6 -10
- package/src/platforms/kakaotalk/credential-manager.test.ts +1 -4
- package/src/platforms/kakaotalk/index.test.ts +1 -0
- package/src/platforms/kakaotalk/index.ts +0 -2
- package/src/platforms/kakaotalk/listener.test.ts +7 -1
- package/src/platforms/kakaotalk/protocol/connection.ts +4 -1
- package/src/platforms/kakaotalk/protocol/crypto.ts +1 -1
- package/src/platforms/kakaotalk/protocol/session.ts +12 -6
- package/src/platforms/kakaotalk/token-extractor.ts +5 -5
- package/src/platforms/kakaotalk/types.ts +8 -7
- package/src/platforms/line/cli.ts +1 -4
- package/src/platforms/line/client.ts +12 -20
- package/src/platforms/line/commands/auth.test.ts +2 -1
- package/src/platforms/line/commands/chat.test.ts +2 -1
- package/src/platforms/line/commands/chat.ts +1 -4
- package/src/platforms/line/commands/friend.test.ts +2 -1
- package/src/platforms/line/commands/message.test.ts +2 -1
- package/src/platforms/line/commands/message.ts +2 -9
- package/src/platforms/line/commands/whoami.test.ts +2 -1
- package/src/platforms/line/credential-manager.test.ts +1 -2
- package/src/platforms/line/index.test.ts +1 -0
- package/src/platforms/line/listener.ts +1 -1
- package/src/platforms/line/types.test.ts +1 -0
- package/src/platforms/slack/cli.ts +3 -1
- package/src/platforms/slack/client-mappers.ts +297 -0
- package/src/platforms/slack/client.test.ts +532 -17
- package/src/platforms/slack/client.ts +69 -458
- package/src/platforms/slack/commands/channel.ts +1 -4
- package/src/platforms/slack/commands/emoji.test.ts +6 -4
- package/src/platforms/slack/commands/emoji.ts +20 -22
- package/src/platforms/slack/commands/message.ts +6 -1
- package/src/platforms/slack/commands/pin.test.ts +14 -12
- package/src/platforms/slack/commands/reminder.ts +7 -6
- package/src/platforms/slack/commands/user.ts +6 -1
- package/src/platforms/slack/commands/usergroup.test.ts +3 -3
- package/src/platforms/slack/commands/usergroup.ts +10 -7
- package/src/platforms/slack/commands/whoami.test.ts +1 -1
- package/src/platforms/slack/commands/whoami.ts +2 -0
- package/src/platforms/slack/index.ts +0 -2
- package/src/platforms/slack/listener.test.ts +1 -0
- package/src/platforms/slack/token-extractor.test.ts +7 -12
- package/src/platforms/slack/token-extractor.ts +47 -255
- package/src/platforms/slackbot/cli.ts +8 -1
- package/src/platforms/slackbot/commands/auth.test.ts +3 -1
- package/src/platforms/teams/client.ts +1 -1
- package/src/platforms/teams/commands/auth.test.ts +1 -1
- package/src/platforms/teams/commands/auth.ts +4 -1
- package/src/platforms/teams/commands/whoami.test.ts +2 -4
- package/src/platforms/teams/commands/whoami.ts +2 -0
- package/src/platforms/teams/index.ts +0 -1
- package/src/platforms/teams/token-extractor.ts +82 -350
- package/src/platforms/telegram/app-config.test.ts +1 -0
- package/src/platforms/telegram/chat-utils.test.ts +5 -1
- package/src/platforms/telegram/cli.ts +2 -4
- package/src/platforms/telegram/client.test.ts +16 -3
- package/src/platforms/telegram/client.ts +14 -4
- package/src/platforms/telegram/commands/auth.test.ts +1 -0
- package/src/platforms/telegram/commands/auth.ts +3 -4
- package/src/platforms/telegram/commands/chat.test.ts +2 -5
- package/src/platforms/telegram/commands/chat.ts +1 -0
- package/src/platforms/telegram/commands/message.test.ts +2 -5
- package/src/platforms/telegram/commands/message.ts +1 -0
- package/src/platforms/telegram/commands/shared.test.ts +1 -0
- package/src/platforms/telegram/commands/whoami.test.ts +5 -7
- package/src/platforms/telegram/commands/whoami.ts +1 -1
- package/src/platforms/telegram/credential-manager.test.ts +1 -0
- package/src/platforms/telegram/credential-manager.ts +11 -2
- package/src/platforms/telegram/my-telegram-org.ts +6 -2
- package/src/platforms/telegram/types.test.ts +1 -0
- package/src/platforms/webex/app-config.test.ts +1 -0
- package/src/platforms/webex/cli.ts +1 -4
- package/src/platforms/webex/client.test.ts +39 -12
- package/src/platforms/webex/client.ts +30 -61
- package/src/platforms/webex/commands/auth.test.ts +7 -1
- package/src/platforms/webex/commands/auth.ts +12 -15
- package/src/platforms/webex/commands/member.test.ts +1 -3
- package/src/platforms/webex/commands/member.ts +14 -19
- package/src/platforms/webex/commands/message.ts +4 -15
- package/src/platforms/webex/commands/snapshot.test.ts +28 -3
- package/src/platforms/webex/commands/snapshot.ts +3 -3
- package/src/platforms/webex/commands/space.test.ts +3 -3
- package/src/platforms/webex/commands/space.ts +2 -9
- package/src/platforms/webex/commands/whoami.test.ts +12 -5
- package/src/platforms/webex/commands/whoami.ts +2 -0
- package/src/platforms/webex/credential-manager.ts +11 -2
- package/src/platforms/webex/ensure-auth.ts +1 -3
- package/src/platforms/webex/index.ts +1 -7
- package/src/platforms/webex/markdown-to-html.test.ts +141 -0
- package/src/platforms/webex/markdown-to-html.ts +194 -0
- package/src/platforms/webex/token-extractor.ts +6 -29
- package/src/platforms/wechatbot/cli.ts +0 -0
- package/src/platforms/wechatbot/client.test.ts +6 -2
- package/src/platforms/wechatbot/client.ts +6 -1
- package/src/platforms/wechatbot/commands/auth.test.ts +3 -7
- package/src/platforms/wechatbot/commands/message.test.ts +1 -4
- package/src/platforms/wechatbot/commands/message.ts +5 -1
- package/src/platforms/wechatbot/commands/template.test.ts +1 -4
- package/src/platforms/wechatbot/commands/user.test.ts +2 -7
- package/src/platforms/whatsapp/cli.ts +1 -4
- package/src/platforms/whatsapp/commands/auth.test.ts +19 -22
- package/src/platforms/whatsapp/commands/chat.test.ts +21 -24
- package/src/platforms/whatsapp/commands/chat.ts +2 -0
- package/src/platforms/whatsapp/commands/message.test.ts +22 -24
- package/src/platforms/whatsapp/commands/message.ts +3 -5
- package/src/platforms/whatsapp/commands/shared.ts +2 -5
- package/src/platforms/whatsapp/commands/whoami.test.ts +2 -2
- package/src/platforms/whatsapp/credential-manager.ts +2 -6
- package/src/platforms/whatsapp/ensure-auth.test.ts +1 -4
- package/src/platforms/whatsapp/ensure-auth.ts +14 -6
- package/src/platforms/whatsapp/index.ts +0 -2
- package/src/platforms/whatsappbot/client.test.ts +13 -7
- package/src/platforms/whatsappbot/client.ts +18 -4
- package/src/platforms/whatsappbot/commands/auth.ts +4 -1
- package/src/platforms/whatsappbot/commands/message.test.ts +12 -2
- package/src/platforms/whatsappbot/commands/message.ts +16 -3
- package/src/platforms/whatsappbot/commands/shared.ts +3 -1
- package/src/platforms/whatsappbot/commands/whoami.test.ts +1 -3
- package/src/platforms/whatsappbot/index.ts +0 -2
- package/src/shared/chromium/browsers.test.ts +274 -0
- package/src/shared/chromium/browsers.ts +86 -0
- package/src/shared/chromium/cookie-reader.test.ts +274 -0
- package/src/shared/chromium/cookie-reader.ts +111 -0
- package/src/shared/chromium/decryptor.test.ts +449 -0
- package/src/shared/chromium/decryptor.ts +227 -0
- package/src/shared/chromium/index.ts +11 -0
- package/src/shared/chromium/types.ts +11 -0
- package/src/shared/utils/derived-key-cache.ts +1 -1
- package/src/shared/utils/linux-keyring.ts +4 -4
- package/src/tui/adapters/kakaotalk-adapter.ts +6 -1
- package/src/tui/adapters/telegram-adapter.ts +1 -1
- package/src/tui/adapters/webex-adapter.ts +1 -1
- package/src/tui/app.ts +149 -59
- package/src/tui/utils.test.ts +144 -145
- package/src/tui/utils.ts +27 -29
- package/src/tui/views/channel-picker.ts +1 -1
- package/src/tui/views/workspace-picker.ts +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ChannelBotCredentialManager } from './credential-manager'
|
|
2
|
+
import { wrapTextInBlocks } from './message-utils'
|
|
1
3
|
import type {
|
|
2
4
|
ChannelBotBot,
|
|
3
5
|
ChannelBotChannel,
|
|
@@ -9,8 +11,6 @@ import type {
|
|
|
9
11
|
MessageBlock,
|
|
10
12
|
} from './types'
|
|
11
13
|
import { ChannelBotError as ChannelBotErrorClass } from './types'
|
|
12
|
-
import { wrapTextInBlocks } from './message-utils'
|
|
13
|
-
import { ChannelBotCredentialManager } from './credential-manager'
|
|
14
14
|
|
|
15
15
|
const BASE_URL = 'https://api.channel.io/open/v5'
|
|
16
16
|
const MAX_RETRIES = 3
|
|
@@ -82,7 +82,12 @@ export class ChannelBotClient {
|
|
|
82
82
|
limit?: number
|
|
83
83
|
},
|
|
84
84
|
): Promise<ChannelBotMessage[]> {
|
|
85
|
-
return this.request<ChannelBotMessage[]>(
|
|
85
|
+
return this.request<ChannelBotMessage[]>(
|
|
86
|
+
'GET',
|
|
87
|
+
this.buildPath(`/user-chats/${chatId}/messages`, params),
|
|
88
|
+
undefined,
|
|
89
|
+
'messages',
|
|
90
|
+
)
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
async sendUserChatMessage(chatId: string, blocks: MessageBlock[], botName?: string): Promise<ChannelBotMessage> {
|
|
@@ -95,7 +100,12 @@ export class ChannelBotClient {
|
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
async closeUserChat(chatId: string, botName: string): Promise<ChannelBotUserChat> {
|
|
98
|
-
return this.request<ChannelBotUserChat>(
|
|
103
|
+
return this.request<ChannelBotUserChat>(
|
|
104
|
+
'PATCH',
|
|
105
|
+
this.buildPath(`/user-chats/${chatId}/close`, { botName }),
|
|
106
|
+
undefined,
|
|
107
|
+
'userChat',
|
|
108
|
+
)
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
async deleteUserChat(chatId: string): Promise<void> {
|
|
@@ -129,7 +139,12 @@ export class ChannelBotClient {
|
|
|
129
139
|
limit?: number
|
|
130
140
|
},
|
|
131
141
|
): Promise<ChannelBotMessage[]> {
|
|
132
|
-
return this.request<ChannelBotMessage[]>(
|
|
142
|
+
return this.request<ChannelBotMessage[]>(
|
|
143
|
+
'GET',
|
|
144
|
+
this.buildPath(`/groups/${groupId}/messages`, params),
|
|
145
|
+
undefined,
|
|
146
|
+
'messages',
|
|
147
|
+
)
|
|
133
148
|
}
|
|
134
149
|
|
|
135
150
|
async sendGroupMessage(groupId: string, blocks: MessageBlock[], botName?: string): Promise<ChannelBotMessage> {
|
|
@@ -165,10 +180,15 @@ export class ChannelBotClient {
|
|
|
165
180
|
}
|
|
166
181
|
|
|
167
182
|
async createBot(name: string, options?: { color?: string; avatarUrl?: string }): Promise<ChannelBotBot> {
|
|
168
|
-
return this.request<ChannelBotBot>(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
183
|
+
return this.request<ChannelBotBot>(
|
|
184
|
+
'POST',
|
|
185
|
+
'/bots',
|
|
186
|
+
{
|
|
187
|
+
name,
|
|
188
|
+
...options,
|
|
189
|
+
},
|
|
190
|
+
'bot',
|
|
191
|
+
)
|
|
172
192
|
}
|
|
173
193
|
|
|
174
194
|
async deleteBot(botId: string): Promise<void> {
|
|
@@ -265,19 +285,25 @@ export class ChannelBotClient {
|
|
|
265
285
|
continue
|
|
266
286
|
}
|
|
267
287
|
|
|
268
|
-
const errorBody = await response.json().catch(() => ({})) as {
|
|
288
|
+
const errorBody = (await response.json().catch(() => ({}))) as {
|
|
269
289
|
message?: string
|
|
270
290
|
code?: string
|
|
271
291
|
}
|
|
272
|
-
throw new ChannelBotErrorClass(
|
|
292
|
+
throw new ChannelBotErrorClass(
|
|
293
|
+
errorBody.message || `HTTP ${response.status}`,
|
|
294
|
+
errorBody.code || `http_${response.status}`,
|
|
295
|
+
)
|
|
273
296
|
}
|
|
274
297
|
|
|
275
298
|
if (!response.ok) {
|
|
276
|
-
const errorBody = await response.json().catch(() => ({})) as {
|
|
299
|
+
const errorBody = (await response.json().catch(() => ({}))) as {
|
|
277
300
|
message?: string
|
|
278
301
|
code?: string
|
|
279
302
|
}
|
|
280
|
-
throw new ChannelBotErrorClass(
|
|
303
|
+
throw new ChannelBotErrorClass(
|
|
304
|
+
errorBody.message || `HTTP ${response.status}`,
|
|
305
|
+
errorBody.code || `http_${response.status}`,
|
|
306
|
+
)
|
|
281
307
|
}
|
|
282
308
|
|
|
283
309
|
if (response.status === 204) {
|
|
@@ -13,7 +13,9 @@ const mockGetChannel = mock(() =>
|
|
|
13
13
|
|
|
14
14
|
mock.module('../client', () => ({
|
|
15
15
|
ChannelBotClient: class MockChannelBotClient {
|
|
16
|
-
async login(_credentials?: any) {
|
|
16
|
+
async login(_credentials?: any) {
|
|
17
|
+
return this
|
|
18
|
+
}
|
|
17
19
|
getChannel = mockGetChannel
|
|
18
20
|
},
|
|
19
21
|
}))
|
|
@@ -66,7 +66,10 @@ export async function statusAction(options: ActionOptions): Promise<ActionResult
|
|
|
66
66
|
let workspaceName: string | undefined
|
|
67
67
|
|
|
68
68
|
try {
|
|
69
|
-
const client = await new ChannelBotClient().login({
|
|
69
|
+
const client = await new ChannelBotClient().login({
|
|
70
|
+
accessKey: creds.access_key,
|
|
71
|
+
accessSecret: creds.access_secret,
|
|
72
|
+
})
|
|
70
73
|
const channel = await client.getChannel()
|
|
71
74
|
valid = true
|
|
72
75
|
workspaceId = channel.id
|
|
@@ -6,14 +6,18 @@ import { join } from 'node:path'
|
|
|
6
6
|
|
|
7
7
|
const mockListBots = mock(() =>
|
|
8
8
|
Promise.resolve([
|
|
9
|
-
{
|
|
9
|
+
{
|
|
10
|
+
id: 'bot1',
|
|
11
|
+
channelId: 'ch1',
|
|
12
|
+
name: 'Support Bot',
|
|
13
|
+
avatarUrl: 'https://example.com/avatar.png',
|
|
14
|
+
color: '#FF0000',
|
|
15
|
+
},
|
|
10
16
|
{ id: 'bot2', channelId: 'ch1', name: 'Sales Bot' },
|
|
11
17
|
]),
|
|
12
18
|
)
|
|
13
19
|
|
|
14
|
-
const mockCreateBot = mock(() =>
|
|
15
|
-
Promise.resolve({ id: 'bot3', channelId: 'ch1', name: 'New Bot', color: '#00FF00' }),
|
|
16
|
-
)
|
|
20
|
+
const mockCreateBot = mock(() => Promise.resolve({ id: 'bot3', channelId: 'ch1', name: 'New Bot', color: '#00FF00' }))
|
|
17
21
|
|
|
18
22
|
const mockDeleteBot = mock(() => Promise.resolve(undefined))
|
|
19
23
|
|
|
@@ -86,7 +90,11 @@ describe('bot commands', () => {
|
|
|
86
90
|
|
|
87
91
|
test('creates bot with optional color and avatar', async () => {
|
|
88
92
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
89
|
-
await createAction('New Bot', {
|
|
93
|
+
await createAction('New Bot', {
|
|
94
|
+
color: '#00FF00',
|
|
95
|
+
avatarUrl: 'https://example.com/avatar.png',
|
|
96
|
+
_credManager: manager,
|
|
97
|
+
})
|
|
90
98
|
|
|
91
99
|
expect(capturedCreateArgs[1]).toMatchObject({ color: '#00FF00', avatarUrl: 'https://example.com/avatar.png' })
|
|
92
100
|
})
|
|
@@ -115,12 +115,12 @@ describe('message commands', () => {
|
|
|
115
115
|
describe('sendAction', () => {
|
|
116
116
|
test('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
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
expect(result.error).toBeUndefined()
|
|
121
|
+
expect(result.id).toBe('msg1')
|
|
122
|
+
expect(capturedSendUserChatArgs[1]).toEqual([{ type: 'text', value: 'Hello world' }])
|
|
123
|
+
})
|
|
124
124
|
|
|
125
125
|
test('sends to group when type=group', async () => {
|
|
126
126
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
@@ -167,7 +167,13 @@ describe('message commands', () => {
|
|
|
167
167
|
|
|
168
168
|
test('passes pagination params', async () => {
|
|
169
169
|
const manager = new ChannelBotCredentialManager(tempDir)
|
|
170
|
-
await listAction('chat1', {
|
|
170
|
+
await listAction('chat1', {
|
|
171
|
+
type: 'userchat',
|
|
172
|
+
limit: '10',
|
|
173
|
+
sort: 'asc',
|
|
174
|
+
since: 'cursor123',
|
|
175
|
+
_credManager: manager,
|
|
176
|
+
})
|
|
171
177
|
|
|
172
178
|
expect(capturedGetUserChatMsgArgs[0]).toBe('chat1')
|
|
173
179
|
expect(capturedGetUserChatMsgArgs[1]).toMatchObject({ limit: 10, sortOrder: 'asc', since: 'cursor123' })
|
|
@@ -15,7 +15,9 @@ export async function getClient(options: WorkspaceOption): Promise<ChannelBotCli
|
|
|
15
15
|
const creds = await credManager.getCredentials(options.workspace)
|
|
16
16
|
|
|
17
17
|
if (!creds) {
|
|
18
|
-
console.log(
|
|
18
|
+
console.log(
|
|
19
|
+
formatOutput({ error: 'No credentials. Run "auth set <access-key> <access-secret>" first.' }, options.pretty),
|
|
20
|
+
)
|
|
19
21
|
process.exit(1)
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -29,7 +31,9 @@ export async function getCurrentWorkspace(options: WorkspaceOption): Promise<str
|
|
|
29
31
|
const creds = await credManager.getCredentials()
|
|
30
32
|
|
|
31
33
|
if (!creds) {
|
|
32
|
-
console.log(
|
|
34
|
+
console.log(
|
|
35
|
+
formatOutput({ error: 'No workspace set. Run "auth set <access-key> <access-secret>" first.' }, options.pretty),
|
|
36
|
+
)
|
|
33
37
|
process.exit(1)
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -4,12 +4,24 @@ import { mkdir } from 'node:fs/promises'
|
|
|
4
4
|
import { tmpdir } from 'node:os'
|
|
5
5
|
import { join } from 'node:path'
|
|
6
6
|
|
|
7
|
-
const mockGetChannel = mock(() =>
|
|
7
|
+
const mockGetChannel = mock(() =>
|
|
8
|
+
Promise.resolve({ id: 'ch1', name: 'Test Workspace', homepageUrl: 'https://example.com' }),
|
|
9
|
+
)
|
|
8
10
|
const mockListGroups = mock(() => Promise.resolve([{ id: 'grp1', channelId: 'ch1', name: 'Team Alpha' }]))
|
|
9
|
-
const mockGetGroupMessages = mock(() =>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const mockGetGroupMessages = mock(() =>
|
|
12
|
+
Promise.resolve([
|
|
13
|
+
{ id: 'msg1', chatId: 'grp1', personType: 'manager' as const, plainText: 'Hello', createdAt: 1234567890 },
|
|
14
|
+
]),
|
|
15
|
+
)
|
|
16
|
+
const mockListUserChats = mock(() =>
|
|
17
|
+
Promise.resolve([{ id: 'chat1', channelId: 'ch1', state: 'opened' as const, userId: 'user1' }]),
|
|
18
|
+
)
|
|
19
|
+
const mockGetUserChatMessages = mock(() =>
|
|
20
|
+
Promise.resolve([{ id: 'msg2', chatId: 'chat1', plainText: 'Hi', createdAt: 1234567890 }]),
|
|
21
|
+
)
|
|
22
|
+
const mockListManagers = mock(() =>
|
|
23
|
+
Promise.resolve([{ id: 'mgr1', channelId: 'ch1', name: 'Alice', description: 'Lead' }]),
|
|
24
|
+
)
|
|
13
25
|
const mockListBots = mock(() => Promise.resolve([{ id: 'bot1', channelId: 'ch1', name: 'Support Bot' }]))
|
|
14
26
|
|
|
15
27
|
mock.module('../client', () => ({
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { afterEach, beforeEach, expect, spyOn, test } from 'bun:test'
|
|
2
2
|
|
|
3
|
-
import { getNoDiscordTokenFoundMessage } from './auth'
|
|
4
3
|
import { DiscordClient } from '../client'
|
|
5
4
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
5
|
import { DiscordTokenExtractor } from '../token-extractor'
|
|
6
|
+
import { getNoDiscordTokenFoundMessage } from './auth'
|
|
7
7
|
|
|
8
8
|
let extractorExtractSpy: ReturnType<typeof spyOn>
|
|
9
9
|
let clientTestAuthSpy: ReturnType<typeof spyOn>
|
|
@@ -14,9 +14,11 @@ let credManagerClearTokenSpy: ReturnType<typeof spyOn>
|
|
|
14
14
|
|
|
15
15
|
beforeEach(() => {
|
|
16
16
|
// Spy on DiscordTokenExtractor.prototype.extract
|
|
17
|
-
extractorExtractSpy = spyOn(DiscordTokenExtractor.prototype, 'extract').mockResolvedValue([
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
extractorExtractSpy = spyOn(DiscordTokenExtractor.prototype, 'extract').mockResolvedValue([
|
|
18
|
+
{
|
|
19
|
+
token: 'test-token-123',
|
|
20
|
+
},
|
|
21
|
+
])
|
|
20
22
|
|
|
21
23
|
// Spy on DiscordClient.prototype methods
|
|
22
24
|
clientTestAuthSpy = spyOn(DiscordClient.prototype, 'testAuth').mockResolvedValue({
|
|
@@ -98,23 +98,23 @@ export async function extractAction(options: { pretty?: boolean; debug?: boolean
|
|
|
98
98
|
|
|
99
99
|
await credManager.save(config)
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (options.debug) {
|
|
102
|
+
debug(`[debug] ✓ Credentials saved`)
|
|
103
|
+
}
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
const output = {
|
|
106
|
+
servers: servers.map((g) => `${g.id}/${g.name}`),
|
|
107
|
+
current: servers[0].id,
|
|
108
|
+
}
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
console.log(formatOutput(output, options.pretty))
|
|
111
|
+
return
|
|
112
|
+
} catch (error) {
|
|
113
|
+
if (options.debug) {
|
|
114
|
+
debug(`[debug] Token validation failed: ${(error as Error).message}, trying next...`)
|
|
115
|
+
}
|
|
116
|
+
continue
|
|
115
117
|
}
|
|
116
|
-
continue
|
|
117
|
-
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
console.log(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { afterEach, beforeEach, expect, spyOn, test } from 'bun:test'
|
|
2
2
|
|
|
3
3
|
import { DiscordClient } from '@/platforms/discord/client'
|
|
4
|
-
import { DiscordCredentialManager } from '@/platforms/discord/credential-manager'
|
|
5
4
|
import { whoamiAction, whoamiCommand } from '@/platforms/discord/commands/whoami'
|
|
5
|
+
import { DiscordCredentialManager } from '@/platforms/discord/credential-manager'
|
|
6
6
|
|
|
7
7
|
let credManagerSpy: ReturnType<typeof spyOn>
|
|
8
8
|
let clientTestAuthSpy: ReturnType<typeof spyOn>
|
|
@@ -84,8 +84,6 @@ test('whoami exits with error when not authenticated', async () => {
|
|
|
84
84
|
|
|
85
85
|
await whoamiAction({})
|
|
86
86
|
|
|
87
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
88
|
-
JSON.stringify({ error: 'Not authenticated. Run "auth extract" first.' }),
|
|
89
|
-
)
|
|
87
|
+
expect(consoleLogSpy).toHaveBeenCalledWith(JSON.stringify({ error: 'Not authenticated. Run "auth extract" first.' }))
|
|
90
88
|
expect(processExitSpy).toHaveBeenCalledWith(1)
|
|
91
89
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander'
|
|
2
|
+
|
|
2
3
|
import { handleError } from '@/shared/utils/error-handler'
|
|
3
4
|
import { formatOutput } from '@/shared/utils/output'
|
|
5
|
+
|
|
4
6
|
import { DiscordClient } from '../client'
|
|
5
7
|
import { DiscordCredentialManager } from '../credential-manager'
|
|
6
8
|
|
|
@@ -14,9 +14,11 @@ let saveSpy: ReturnType<typeof spyOn>
|
|
|
14
14
|
beforeEach(() => {
|
|
15
15
|
getTokenSpy = spyOn(DiscordCredentialManager.prototype, 'getToken').mockResolvedValue(null)
|
|
16
16
|
|
|
17
|
-
extractSpy = spyOn(DiscordTokenExtractor.prototype, 'extract').mockResolvedValue([
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
extractSpy = spyOn(DiscordTokenExtractor.prototype, 'extract').mockResolvedValue([
|
|
18
|
+
{
|
|
19
|
+
token: 'test-token-123',
|
|
20
|
+
},
|
|
21
|
+
])
|
|
20
22
|
|
|
21
23
|
testAuthSpy = spyOn(DiscordClient.prototype, 'testAuth').mockResolvedValue({
|
|
22
24
|
id: 'user-123',
|
|
@@ -22,6 +22,7 @@ class MockWs {
|
|
|
22
22
|
sent: string[] = []
|
|
23
23
|
|
|
24
24
|
constructor(_url: string, _options?: any) {
|
|
25
|
+
// oxlint-disable-next-line typescript-eslint/no-this-alias
|
|
25
26
|
mockWsInstance = this
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -760,7 +761,12 @@ describe('DiscordListener', () => {
|
|
|
760
761
|
5,
|
|
761
762
|
)
|
|
762
763
|
|
|
763
|
-
mockWsInstance.simulateMessage({
|
|
764
|
+
mockWsInstance.simulateMessage({
|
|
765
|
+
op: 0,
|
|
766
|
+
t: 'TYPING_START',
|
|
767
|
+
s: null,
|
|
768
|
+
d: { user_id: 'U1', channel_id: 'C1', timestamp: 1 },
|
|
769
|
+
})
|
|
764
770
|
|
|
765
771
|
expect((listener as any).sequence).toBe(5)
|
|
766
772
|
})
|
|
@@ -202,7 +202,9 @@ describe('DiscordTokenExtractor', () => {
|
|
|
202
202
|
test('returns empty array when no Discord directories exist on linux', async () => {
|
|
203
203
|
const linuxExtractor = new DiscordTokenExtractor('linux')
|
|
204
204
|
const extractFromLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromLevelDB').mockResolvedValue([])
|
|
205
|
-
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
205
|
+
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
206
|
+
[],
|
|
207
|
+
)
|
|
206
208
|
|
|
207
209
|
const result = await linuxExtractor.extract()
|
|
208
210
|
expect(result).toEqual([])
|
|
@@ -218,7 +220,9 @@ describe('DiscordTokenExtractor', () => {
|
|
|
218
220
|
const extractFromLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromLevelDB').mockResolvedValue([
|
|
219
221
|
{ token: mockToken },
|
|
220
222
|
])
|
|
221
|
-
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
223
|
+
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
224
|
+
[],
|
|
225
|
+
)
|
|
222
226
|
|
|
223
227
|
const result = await linuxExtractor.extract()
|
|
224
228
|
|
|
@@ -234,10 +238,9 @@ describe('DiscordTokenExtractor', () => {
|
|
|
234
238
|
|
|
235
239
|
const linuxExtractor = new DiscordTokenExtractor('linux')
|
|
236
240
|
const extractFromLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromLevelDB').mockResolvedValue([])
|
|
237
|
-
const extractFromBrowserLevelDBSpy = spyOn(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
).mockResolvedValue([{ token: mockToken }])
|
|
241
|
+
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue([
|
|
242
|
+
{ token: mockToken },
|
|
243
|
+
])
|
|
241
244
|
|
|
242
245
|
const result = await linuxExtractor.extract()
|
|
243
246
|
|
|
@@ -254,10 +257,9 @@ describe('DiscordTokenExtractor', () => {
|
|
|
254
257
|
|
|
255
258
|
const darwinExtractor = new DiscordTokenExtractor('darwin', 0)
|
|
256
259
|
const extractFromLevelDBSpy = spyOn(darwinExtractor as any, 'extractFromLevelDB').mockResolvedValue([])
|
|
257
|
-
const extractFromBrowserLevelDBSpy = spyOn(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
).mockResolvedValue([])
|
|
260
|
+
const extractFromBrowserLevelDBSpy = spyOn(darwinExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
261
|
+
[],
|
|
262
|
+
)
|
|
261
263
|
const tryExtractViaCDPSpy = spyOn(darwinExtractor as any, 'tryExtractViaCDP').mockResolvedValue(mockToken)
|
|
262
264
|
|
|
263
265
|
const result = await darwinExtractor.extract()
|
|
@@ -308,7 +310,9 @@ describe('DiscordTokenExtractor', () => {
|
|
|
308
310
|
const extractFromLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromLevelDB').mockResolvedValue([
|
|
309
311
|
{ token: mockToken },
|
|
310
312
|
])
|
|
311
|
-
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
313
|
+
const extractFromBrowserLevelDBSpy = spyOn(linuxExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
314
|
+
[],
|
|
315
|
+
)
|
|
312
316
|
|
|
313
317
|
const result = await linuxExtractor.extract()
|
|
314
318
|
|
|
@@ -365,7 +369,9 @@ describe('DiscordTokenExtractor', () => {
|
|
|
365
369
|
const extractFromLevelDBSpy = spyOn(darwinExtractor as any, 'extractFromLevelDB').mockResolvedValue([
|
|
366
370
|
{ token: mockToken },
|
|
367
371
|
])
|
|
368
|
-
const extractFromBrowserLevelDBSpy = spyOn(darwinExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
372
|
+
const extractFromBrowserLevelDBSpy = spyOn(darwinExtractor as any, 'extractFromBrowserLevelDB').mockResolvedValue(
|
|
373
|
+
[],
|
|
374
|
+
)
|
|
369
375
|
const tryExtractViaCDPSpy = spyOn(darwinExtractor as any, 'tryExtractViaCDP').mockResolvedValue(null)
|
|
370
376
|
|
|
371
377
|
await darwinExtractor.extract()
|